From 66d333a9717bf00741b4dbf2c4a44d7776a4c313 Mon Sep 17 00:00:00 2001 From: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue, 20 May 2025 21:08:34 +0100 Subject: [PATCH 1/8] fix license activation update and add license settings page --- apps/desktop/src/routes/(window-chrome)/licensing.tsx | 11 ++++++++--- apps/desktop/src/routes/(window-chrome)/settings.tsx | 5 +++++ .../src/routes/(window-chrome)/settings/license.tsx | 1 + apps/desktop/src/routes/(window-chrome)/upgrade.tsx | 4 +++- 4 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 apps/desktop/src/routes/(window-chrome)/settings/license.tsx diff --git a/apps/desktop/src/routes/(window-chrome)/licensing.tsx b/apps/desktop/src/routes/(window-chrome)/licensing.tsx index f58a509ac75..0b9587b296b 100644 --- a/apps/desktop/src/routes/(window-chrome)/licensing.tsx +++ b/apps/desktop/src/routes/(window-chrome)/licensing.tsx @@ -1,7 +1,7 @@ import { Button } from "@cap/ui-solid"; import { licenseContract } from "@cap/web-api-contract"; import { useNavigate } from "@solidjs/router"; -import { createMutation } from "@tanstack/solid-query"; +import { createMutation, useQueryClient } from "@tanstack/solid-query"; import * as tauriShell from "@tauri-apps/plugin-shell"; import { ClientInferResponseBody } from "@ts-rest/core"; import { @@ -20,6 +20,7 @@ import { Input } from "../editor/ui"; export default function Page() { const license = createLicenseQuery(); const navigate = useNavigate(); + const queryClient = useQueryClient(); return (
@@ -96,6 +97,7 @@ function LicenseKeyActivate(props: { ) => void; }) { const [store] = createResource(() => generalSettingsStore.get()); + const queryClient = useQueryClient(); return ( @@ -122,8 +124,10 @@ function LicenseKeyActivate(props: { throw resp.body.message; throw new Error((resp.body as any).toString()); }, - onSuccess: (value, { licenseKey }) => - props.onActivated({ ...value, licenseKey }), + onSuccess: (value, { licenseKey }) => { + props.onActivated({ ...value, licenseKey }); + queryClient.refetchQueries({ queryKey: ["bruh"] }); + }, })); return ( @@ -279,6 +283,7 @@ function CommercialLicensePurchase() { licenseKey: value.licenseKey, }, }); + await queryClient.refetchQueries({ queryKey: ["bruh"] }); }} /> diff --git a/apps/desktop/src/routes/(window-chrome)/settings.tsx b/apps/desktop/src/routes/(window-chrome)/settings.tsx index 3aee9259737..c3f8864981b 100644 --- a/apps/desktop/src/routes/(window-chrome)/settings.tsx +++ b/apps/desktop/src/routes/(window-chrome)/settings.tsx @@ -46,6 +46,11 @@ export default function Settings(props: RouteSectionProps) { name: "Integrations", icon: IconLucideUnplug, }, + { + href: "license", + name: "License", + icon: IconLucideGift, + }, { href: "experimental", name: "Experimental", diff --git a/apps/desktop/src/routes/(window-chrome)/settings/license.tsx b/apps/desktop/src/routes/(window-chrome)/settings/license.tsx new file mode 100644 index 00000000000..3fac1ed0ac8 --- /dev/null +++ b/apps/desktop/src/routes/(window-chrome)/settings/license.tsx @@ -0,0 +1 @@ +export { default } from "../licensing"; diff --git a/apps/desktop/src/routes/(window-chrome)/upgrade.tsx b/apps/desktop/src/routes/(window-chrome)/upgrade.tsx index 888468b63bb..8f2b890b82e 100644 --- a/apps/desktop/src/routes/(window-chrome)/upgrade.tsx +++ b/apps/desktop/src/routes/(window-chrome)/upgrade.tsx @@ -1,7 +1,7 @@ import { createRive } from "@aerofoil/rive-solid-canvas"; import { Button } from "@cap/ui-solid"; import { action, useAction } from "@solidjs/router"; -import { createMutation } from "@tanstack/solid-query"; +import { createMutation, useQueryClient } from "@tanstack/solid-query"; import { invoke } from "@tauri-apps/api/core"; import { listen } from "@tauri-apps/api/event"; import { getCurrentWindow, Window } from "@tauri-apps/api/window"; @@ -701,6 +701,7 @@ interface Props { const ActivateLicenseDialog = ({ open, onOpenChange }: Props) => { const [licenseKey, setLicenseKey] = createSignal(""); + const queryClient = useQueryClient(); const activateLicenseKey = createMutation(() => ({ mutationFn: async (vars: { licenseKey: string }) => { @@ -731,6 +732,7 @@ const ActivateLicenseDialog = ({ open, onOpenChange }: Props) => { licenseKey: value.licenseKey, }, }); + await queryClient.refetchQueries({ queryKey: ["bruh"] }); }, })); return ( From 89fc7a9525728885d07daec64f7cac7cfe42d1b5 Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Wed, 21 May 2025 21:55:39 +0800 Subject: [PATCH 2/8] move license page to correct location --- .../src/routes/(window-chrome)/licensing.tsx | 291 ----------------- .../(window-chrome)/settings/license.tsx | 292 +++++++++++++++++- 2 files changed, 291 insertions(+), 292 deletions(-) delete mode 100644 apps/desktop/src/routes/(window-chrome)/licensing.tsx diff --git a/apps/desktop/src/routes/(window-chrome)/licensing.tsx b/apps/desktop/src/routes/(window-chrome)/licensing.tsx deleted file mode 100644 index 0b9587b296b..00000000000 --- a/apps/desktop/src/routes/(window-chrome)/licensing.tsx +++ /dev/null @@ -1,291 +0,0 @@ -import { Button } from "@cap/ui-solid"; -import { licenseContract } from "@cap/web-api-contract"; -import { useNavigate } from "@solidjs/router"; -import { createMutation, useQueryClient } from "@tanstack/solid-query"; -import * as tauriShell from "@tauri-apps/plugin-shell"; -import { ClientInferResponseBody } from "@ts-rest/core"; -import { - createResource, - createSignal, - Match, - Show, - Suspense, - Switch, -} from "solid-js"; -import { generalSettingsStore } from "~/store"; -import { createLicenseQuery } from "~/utils/queries"; -import { licenseApiClient } from "~/utils/web-api"; -import { Input } from "../editor/ui"; - -export default function Page() { - const license = createLicenseQuery(); - const navigate = useNavigate(); - const queryClient = useQueryClient(); - - return ( -
-
-

- Commercial License -

-

- Permits using Cap for commercial purposes, but without paying for - cloud features. -

-
- - }> - -
-

- Your account is upgraded to Cap Pro and already includes a - commercial license. -

-
-
- - {(license) => ( -
-

- Your License -

-
- -
-                  {license().licenseKey}
-                
-
- - {(expiry) => ( -
- - - {new Date(expiry()).toUTCString()} - -
- )} -
- - {/*

- Instance ID: {license().instanceId} -

*/} -
- -
-
- )} -
-
-
- ); -} - -function LicenseKeyActivate(props: { - onActivated: ( - value: ClientInferResponseBody< - (typeof licenseContract)["activateCommercialLicense"], - 200 - > & { licenseKey: string } - ) => void; -}) { - const [store] = createResource(() => generalSettingsStore.get()); - const queryClient = useQueryClient(); - - return ( - - - {(generalSettings) => { - const [licenseKey, setLicenseKey] = createSignal(""); - - const activateLicenseKey = createMutation(() => ({ - mutationFn: async (vars: { licenseKey: string }) => { - const resp = await licenseApiClient.activateCommercialLicense({ - headers: { - licensekey: vars.licenseKey, - instanceid: generalSettings().instanceId!, - }, - body: { reset: false }, - }); - - if (resp.status === 200) return resp.body; - if ( - typeof resp.body === "object" && - resp.body && - "message" in resp.body - ) - throw resp.body.message; - throw new Error((resp.body as any).toString()); - }, - onSuccess: (value, { licenseKey }) => { - props.onActivated({ ...value, licenseKey }); - queryClient.refetchQueries({ queryKey: ["bruh"] }); - }, - })); - - return ( -
-

- Got a license key? Enter it below -

- setLicenseKey(e.currentTarget.value)} - /> - - {/*

- Instance ID: {generalSettings().instanceId} -

*/} -
- ); - }} -
-
- ); -} - -type CommercialLicenseType = "yearly" | "lifetime"; -function CommercialLicensePurchase() { - const openCheckoutInExternalBrowser = createMutation(() => ({ - mutationFn: async ({ type }: { type: CommercialLicenseType }) => { - const resp = await licenseApiClient.createCommercialCheckoutUrl({ - body: { type }, - }); - - if (resp.status === 200) tauriShell.open(resp.body.url); - else throw resp.body; - }, - })); - - const [type, setType] = createSignal("yearly"); - - return ( - <> -
-
-
-

- Commercial License -

-

- For professional use without cloud features. -

-
-
-

- {type() === "yearly" ? "$29/year" : "$58"} -

-
- {type() === "lifetime" && ( -

- billed once -

- )} - {type() === "lifetime" && ( -

- or, $29/year. -

- )} -
-
-
-
-
-
- - Switch to {type() === "yearly" ? "lifetime" : "yearly"} - - -
-
-
- -
-
-
-
-
    - {[ - "Commercial Use of Cap Recorder + Editor", - "Community Support", - ].map((feature) => ( -
  • -
    - -
    - - {feature} - -
  • - ))} -
-
-
-
-
-
- { - await generalSettingsStore.set({ - commercialLicense: { - activatedOn: Date.now(), - expiryDate: value.expiryDate ?? null, - refresh: value.refresh, - licenseKey: value.licenseKey, - }, - }); - await queryClient.refetchQueries({ queryKey: ["bruh"] }); - }} - /> - - ); -} diff --git a/apps/desktop/src/routes/(window-chrome)/settings/license.tsx b/apps/desktop/src/routes/(window-chrome)/settings/license.tsx index 3fac1ed0ac8..bc99bec804a 100644 --- a/apps/desktop/src/routes/(window-chrome)/settings/license.tsx +++ b/apps/desktop/src/routes/(window-chrome)/settings/license.tsx @@ -1 +1,291 @@ -export { default } from "../licensing"; +import { Button } from "@cap/ui-solid"; +import { licenseContract } from "@cap/web-api-contract"; +import { useNavigate } from "@solidjs/router"; +import { createMutation, useQueryClient } from "@tanstack/solid-query"; +import * as tauriShell from "@tauri-apps/plugin-shell"; +import { ClientInferResponseBody } from "@ts-rest/core"; +import { + createResource, + createSignal, + Match, + Show, + Suspense, + Switch, +} from "solid-js"; +import { generalSettingsStore } from "~/store"; +import { createLicenseQuery } from "~/utils/queries"; +import { licenseApiClient } from "~/utils/web-api"; +import { Input } from "../../editor/ui"; + +export default function Page() { + const license = createLicenseQuery(); + const navigate = useNavigate(); + const queryClient = useQueryClient(); + + return ( +
+
+

+ Commercial License +

+

+ Permits using Cap for commercial purposes, but without paying for + cloud features. +

+
+ + }> + +
+

+ Your account is upgraded to Cap Pro and already includes a + commercial license. +

+
+
+ + {(license) => ( +
+

+ Your License +

+
+ +
+                  {license().licenseKey}
+                
+
+ + {(expiry) => ( +
+ + + {new Date(expiry()).toUTCString()} + +
+ )} +
+ + {/*

+ Instance ID: {license().instanceId} +

*/} +
+ +
+
+ )} +
+
+
+ ); +} + +function LicenseKeyActivate(props: { + onActivated: ( + value: ClientInferResponseBody< + (typeof licenseContract)["activateCommercialLicense"], + 200 + > & { licenseKey: string } + ) => void; +}) { + const [store] = createResource(() => generalSettingsStore.get()); + const queryClient = useQueryClient(); + + return ( + + + {(generalSettings) => { + const [licenseKey, setLicenseKey] = createSignal(""); + + const activateLicenseKey = createMutation(() => ({ + mutationFn: async (vars: { licenseKey: string }) => { + const resp = await licenseApiClient.activateCommercialLicense({ + headers: { + licensekey: vars.licenseKey, + instanceid: generalSettings().instanceId!, + }, + body: { reset: false }, + }); + + if (resp.status === 200) return resp.body; + if ( + typeof resp.body === "object" && + resp.body && + "message" in resp.body + ) + throw resp.body.message; + throw new Error((resp.body as any).toString()); + }, + onSuccess: (value, { licenseKey }) => { + props.onActivated({ ...value, licenseKey }); + queryClient.refetchQueries({ queryKey: ["bruh"] }); + }, + })); + + return ( +
+

+ Got a license key? Enter it below +

+ setLicenseKey(e.currentTarget.value)} + /> + + {/*

+ Instance ID: {generalSettings().instanceId} +

*/} +
+ ); + }} +
+
+ ); +} + +type CommercialLicenseType = "yearly" | "lifetime"; +function CommercialLicensePurchase() { + const openCheckoutInExternalBrowser = createMutation(() => ({ + mutationFn: async ({ type }: { type: CommercialLicenseType }) => { + const resp = await licenseApiClient.createCommercialCheckoutUrl({ + body: { type }, + }); + + if (resp.status === 200) tauriShell.open(resp.body.url); + else throw resp.body; + }, + })); + + const [type, setType] = createSignal("yearly"); + + return ( + <> +
+
+
+

+ Commercial License +

+

+ For professional use without cloud features. +

+
+
+

+ {type() === "yearly" ? "$29/year" : "$58"} +

+
+ {type() === "lifetime" && ( +

+ billed once +

+ )} + {type() === "lifetime" && ( +

+ or, $29/year. +

+ )} +
+
+
+
+
+
+ + Switch to {type() === "yearly" ? "lifetime" : "yearly"} + + +
+
+
+ +
+
+
+
+
    + {[ + "Commercial Use of Cap Recorder + Editor", + "Community Support", + ].map((feature) => ( +
  • +
    + +
    + + {feature} + +
  • + ))} +
+
+
+
+
+
+ { + await generalSettingsStore.set({ + commercialLicense: { + activatedOn: Date.now(), + expiryDate: value.expiryDate ?? null, + refresh: value.refresh, + licenseKey: value.licenseKey, + }, + }); + await queryClient.refetchQueries({ queryKey: ["bruh"] }); + }} + /> + + ); +} From 996bf48b815e4620f6b47c509445c5fcb6915660 Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Wed, 21 May 2025 22:31:49 +0800 Subject: [PATCH 3/8] update tauri plugin http --- Cargo.lock | 4 +- apps/desktop/package.json | 2 +- apps/desktop/src/utils/web-api.ts | 2 +- pnpm-lock.yaml | 86 +++++++++++++++++++++---------- 4 files changed, 62 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cddf8da31e4..e43fa8a85cb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7584,9 +7584,9 @@ dependencies = [ [[package]] name = "tauri-plugin-http" -version = "2.2.0" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e62a9bde54d6a0218b63f5a248f02056ad4316ba6ad81dfb9e4f73715df5deb1" +checksum = "696ef548befeee6c6c17b80ef73e7c41205b6c2204e87ef78ccc231212389a5c" dependencies = [ "data-url", "http", diff --git a/apps/desktop/package.json b/apps/desktop/package.json index 8a598bec870..0fd58ec5815 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -41,7 +41,7 @@ "@tauri-apps/plugin-deep-link": "^2.2.0", "@tauri-apps/plugin-dialog": "2.0.1", "@tauri-apps/plugin-fs": "2.2.0", - "@tauri-apps/plugin-http": "^2.0.1", + "@tauri-apps/plugin-http": "^2.4.4", "@tauri-apps/plugin-notification": "2.0.0", "@tauri-apps/plugin-opener": "^2.2.6", "@tauri-apps/plugin-os": "2.0.0", diff --git a/apps/desktop/src/utils/web-api.ts b/apps/desktop/src/utils/web-api.ts index 152fb113f4a..71784008bd0 100644 --- a/apps/desktop/src/utils/web-api.ts +++ b/apps/desktop/src/utils/web-api.ts @@ -20,7 +20,7 @@ const api: ApiFetcher = async (args) => { body = await resp.text(); } - console.log({ body }); + console.log({ resp, body }); return { body, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f693b71fd27..5decb693c8a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -120,8 +120,8 @@ importers: specifier: 2.2.0 version: 2.2.0 '@tauri-apps/plugin-http': - specifier: ^2.0.1 - version: 2.4.3 + specifier: ^2.4.4 + version: 2.4.4 '@tauri-apps/plugin-notification': specifier: 2.0.0 version: 2.0.0 @@ -145,7 +145,7 @@ importers: version: 2.0.0 '@ts-rest/core': specifier: ^3.52.1 - version: 3.52.1(@types/node@22.15.17)(zod@3.24.4) + version: 3.52.1(@types/node@22.15.17)(zod@3.25.17) '@types/react-tooltip': specifier: ^4.2.4 version: 4.2.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -5014,10 +5014,10 @@ packages: react-dom: optional: true - '@storybook/builder-vite@9.0.0-rc.0': - resolution: {integrity: sha512-z0VUmeKDPv5dhP2XUu6ruJMCZFF6YW4Vn2riIz7s462ezjMaMPrA+mNOfpgXIWQbj/WJrprR1TjlNXjS/4q6gA==} + '@storybook/builder-vite@9.0.0-rc.4': + resolution: {integrity: sha512-MUNSYSc30qO2Ppdz454PCp8IJyV56h+1DR+BjAYzLmF1857jIND3rdjGDHi/6cTjN7owlpFytSMzlQFUDgEXJg==} peerDependencies: - storybook: ^9.0.0-rc.0 + storybook: ^9.0.0-rc.4 vite: ^5.0.0 || ^6.0.0 '@storybook/core@8.6.12': @@ -5033,10 +5033,10 @@ packages: peerDependencies: storybook: ^8.6.12 - '@storybook/csf-plugin@9.0.0-rc.0': - resolution: {integrity: sha512-6bGUD69+qWjG4OFYh6+ibA+ehGBAo4fvNAyGjMiUZyiUIg1Fb2X34G/PKYFoYsBQay0MOpcjan9SwiZquYnO4A==} + '@storybook/csf-plugin@9.0.0-rc.4': + resolution: {integrity: sha512-ljiVNS+6Y7kYT0S5YmnLL20cVyPTwM4yUKGUbwH5xno6baS5MPAAIGrZD9zu0silC527NfEI1m3Yax8u9sSGKQ==} peerDependencies: - storybook: ^9.0.0-rc.0 + storybook: ^9.0.0-rc.4 '@storybook/docs-tools@8.6.12': resolution: {integrity: sha512-bOmTNJE4FM6+3/1hPQVgha8cLxX2Nyi/4Z+tYq0pCDEyQqGRTD2KXre9XsSCnziRaGxiW80OrKkmqWY8Otuu4A==} @@ -5342,8 +5342,8 @@ packages: '@tauri-apps/plugin-fs@2.2.0': resolution: {integrity: sha512-+08mApuONKI8/sCNEZ6AR8vf5vI9DXD4YfrQ9NQmhRxYKMLVhRW164vdW5BSLmMpuevftpQ2FVoL9EFkfG9Z+g==} - '@tauri-apps/plugin-http@2.4.3': - resolution: {integrity: sha512-Us8X+FikzpaZRNr4kH4HLwyXascHbM42p6LxAqRTQnHPrrqp1usaH4vxWAZalPvTbHJ3gBEMJPHusFJgtjGJjA==} + '@tauri-apps/plugin-http@2.4.4': + resolution: {integrity: sha512-IjlaaS4z8ybB10qnh6djZ2FIaHdWVs/U1D1C56udKcjX1f+jAmR8/s7qBV5cv/OmcGkOIzet3LWuH70LKf4J2A==} '@tauri-apps/plugin-notification@2.0.0': resolution: {integrity: sha512-6qEDYJS7mgXZWLXA0EFL+DVCJh8sJlzSoyw6B50pxhLPVFjc5Vr5DVzl5W3mUHaYhod5wsC984eQnlCCGqxYDA==} @@ -12101,6 +12101,9 @@ packages: ts-pattern@5.7.0: resolution: {integrity: sha512-0/FvIG4g3kNkYgbNwBBW5pZBkfpeYQnH+2AA3xmjkCAit/DSDPKmgwC3fKof4oYUq6gupClVOJlFl+939VRBMg==} + ts-pattern@5.7.1: + resolution: {integrity: sha512-EGs8PguQqAAUIcQfK4E9xdXxB6s2GK4sJfT/vcc9V1ELIvC4LH/zXu2t/5fajtv6oiRCxdv7BgtVK3vWgROxag==} + tsconfck@3.1.5: resolution: {integrity: sha512-CLDfGgUp7XPswWnezWwsCRxNmgQjhYq3VXHM0/XIRxhVrKw0M1if9agzryh1QS3nxjCROvV+xWxoJO1YctzzWg==} engines: {node: ^18 || >=20} @@ -13100,6 +13103,9 @@ packages: zod@3.24.4: resolution: {integrity: sha512-OdqJE9UDRPwWsrHjLN2F8bPxvwJBK22EHLWtanu0LSYr5YqzsaaW3RMgmjwr8Rypg5k+meEJdSPXJZXE/yqOMg==} + zod@3.25.17: + resolution: {integrity: sha512-8hQzQ/kMOIFbwOgPrm9Sf9rtFHpFUMy4HvN0yEB0spw14aYi0uT5xG5CE2DB9cd51GWNsz+DNO7se1kztHMKnw==} + zwitch@2.0.4: resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} @@ -14084,10 +14090,10 @@ snapshots: gray-matter: 4.0.3 imagescript: 1.3.0 micromatch: 4.0.8 - ts-pattern: 5.7.0 + ts-pattern: 5.7.1 unified: 11.0.5 yaml: 2.8.0 - zod: 3.24.4 + zod: 3.25.17 transitivePeerDependencies: - '@effect-ts/otel-node' - acorn @@ -17812,9 +17818,9 @@ snapshots: react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - '@storybook/builder-vite@9.0.0-rc.0(storybook@8.6.12(prettier@2.8.8))(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0))': + '@storybook/builder-vite@9.0.0-rc.4(storybook@8.6.12(prettier@2.8.8))(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0))': dependencies: - '@storybook/csf-plugin': 9.0.0-rc.0(storybook@8.6.12(prettier@2.8.8)) + '@storybook/csf-plugin': 9.0.0-rc.4(storybook@8.6.12(prettier@2.8.8)) storybook: 8.6.12(prettier@2.8.8) ts-dedent: 2.2.0 vite: 6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0) @@ -17845,7 +17851,7 @@ snapshots: storybook: 8.6.12(prettier@2.8.8) unplugin: 1.16.1 - '@storybook/csf-plugin@9.0.0-rc.0(storybook@8.6.12(prettier@2.8.8))': + '@storybook/csf-plugin@9.0.0-rc.4(storybook@8.6.12(prettier@2.8.8))': dependencies: storybook: 8.6.12(prettier@2.8.8) unplugin: 1.16.1 @@ -18158,7 +18164,7 @@ snapshots: dependencies: '@tauri-apps/api': 2.5.0 - '@tauri-apps/plugin-http@2.4.3': + '@tauri-apps/plugin-http@2.4.4': dependencies: '@tauri-apps/api': 2.5.0 @@ -18242,6 +18248,11 @@ snapshots: '@types/node': 22.15.17 zod: 3.24.4 + '@ts-rest/core@3.52.1(@types/node@22.15.17)(zod@3.25.17)': + optionalDependencies: + '@types/node': 22.15.17 + zod: 3.25.17 + '@tsconfig/bun@1.0.7': {} '@tsconfig/node10@1.0.11': {} @@ -20805,8 +20816,8 @@ snapshots: '@typescript-eslint/parser': 5.62.0(eslint@8.57.1)(typescript@5.8.3) eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.31.0)(eslint@8.57.1) - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@8.57.1) + eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1) eslint-plugin-jsx-a11y: 6.10.2(eslint@8.57.1) eslint-plugin-react: 7.37.5(eslint@8.57.1) eslint-plugin-react-hooks: 4.6.2(eslint@8.57.1) @@ -20853,6 +20864,21 @@ snapshots: transitivePeerDependencies: - supports-color + eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1): + dependencies: + '@nolyfill/is-core-module': 1.0.39 + debug: 4.4.0(supports-color@5.5.0) + eslint: 8.57.1 + get-tsconfig: 4.10.0 + is-bun-module: 2.0.0 + stable-hash: 0.0.5 + tinyglobby: 0.2.13 + unrs-resolver: 1.7.2 + optionalDependencies: + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1) + transitivePeerDependencies: + - supports-color + eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(eslint@8.57.1))(eslint@8.57.1): dependencies: '@nolyfill/is-core-module': 1.0.39 @@ -20883,25 +20909,25 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1): + eslint-module-utils@2.12.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1): dependencies: debug: 3.2.7 optionalDependencies: '@typescript-eslint/parser': 5.62.0(eslint@8.57.1)(typescript@5.8.3) eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.31.0(eslint@8.57.1))(eslint@8.57.1) + eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1) transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1)(eslint@8.57.1): + eslint-module-utils@2.12.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1): dependencies: debug: 3.2.7 optionalDependencies: '@typescript-eslint/parser': 5.62.0(eslint@8.57.1)(typescript@5.8.3) eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.31.0)(eslint@8.57.1) + eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.31.0(eslint@8.57.1))(eslint@8.57.1) transitivePeerDependencies: - supports-color @@ -20916,7 +20942,7 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1): + eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.8 @@ -20927,7 +20953,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1) hasown: 2.0.2 is-core-module: 2.16.1 is-glob: 4.0.3 @@ -20945,7 +20971,7 @@ snapshots: - eslint-import-resolver-webpack - supports-color - eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@8.57.1): + eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.8 @@ -20956,7 +20982,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1)(eslint@8.57.1) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1) hasown: 2.0.2 is-core-module: 2.16.1 is-glob: 4.0.3 @@ -26222,7 +26248,7 @@ snapshots: storybook-solidjs-vite@1.0.0-beta.7(@storybook/test@8.6.12(storybook@8.6.12(prettier@2.8.8)))(solid-js@1.9.6)(storybook@8.6.12(prettier@2.8.8))(vite-plugin-solid@2.11.6(@testing-library/jest-dom@6.5.0)(solid-js@1.9.6)(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)))(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)): dependencies: - '@storybook/builder-vite': 9.0.0-rc.0(storybook@8.6.12(prettier@2.8.8))(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)) + '@storybook/builder-vite': 9.0.0-rc.4(storybook@8.6.12(prettier@2.8.8))(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)) '@storybook/types': 9.0.0-alpha.1(storybook@8.6.12(prettier@2.8.8)) magic-string: 0.30.17 solid-js: 1.9.6 @@ -26759,6 +26785,8 @@ snapshots: ts-pattern@5.7.0: {} + ts-pattern@5.7.1: {} + tsconfck@3.1.5(typescript@5.8.3): optionalDependencies: typescript: 5.8.3 @@ -27897,4 +27925,6 @@ snapshots: zod@3.24.4: {} + zod@3.25.17: {} + zwitch@2.0.4: {} From ce96dd30d166bd002c631705aabb8b033cf32e0f Mon Sep 17 00:00:00 2001 From: ameer2468 <33054370+ameer2468@users.noreply.github.com> Date: Wed, 21 May 2025 19:46:12 +0300 Subject: [PATCH 4/8] ui tweaks --- .../(window-chrome)/settings/license.tsx | 357 ++++++++++-------- apps/desktop/src/routes/editor/ui.tsx | 2 +- 2 files changed, 202 insertions(+), 157 deletions(-) diff --git a/apps/desktop/src/routes/(window-chrome)/settings/license.tsx b/apps/desktop/src/routes/(window-chrome)/settings/license.tsx index bc99bec804a..e734115e3af 100644 --- a/apps/desktop/src/routes/(window-chrome)/settings/license.tsx +++ b/apps/desktop/src/routes/(window-chrome)/settings/license.tsx @@ -1,3 +1,4 @@ +import { createRive } from "@aerofoil/rive-solid-canvas"; import { Button } from "@cap/ui-solid"; import { licenseContract } from "@cap/web-api-contract"; import { useNavigate } from "@solidjs/router"; @@ -14,7 +15,9 @@ import { } from "solid-js"; import { generalSettingsStore } from "~/store"; import { createLicenseQuery } from "~/utils/queries"; +import { commands } from "~/utils/tauri"; import { licenseApiClient } from "~/utils/web-api"; +import PricingRive from "../../../assets/rive/pricing.riv"; import { Input } from "../../editor/ui"; export default function Page() { @@ -23,62 +26,89 @@ export default function Page() { const queryClient = useQueryClient(); return ( -
-
-

+
+
+

Commercial License

-

+

Permits using Cap for commercial purposes, but without paying for cloud features.

-
+
}> -
-

- Your account is upgraded to Cap Pro and already includes a - commercial license. -

+
+
+
+ +

Cap Pro License

+
+

+ Your account is upgraded to{" "} + Cap Pro and + already includes a commercial license. +

+
+ +
+
{(license) => ( -
-

- Your License -

-
- -
-                  {license().licenseKey}
-                
-
- - {(expiry) => ( -
- - - {new Date(expiry()).toUTCString()} - -
- )} -
- - {/*

- Instance ID: {license().instanceId} -

*/} -
- +
+
+
+ +

Commercial License

+
+
+ +
+                    {license().licenseKey}
+                  
+
+ + {(expiry) => ( +
+ +

+ {new Date(expiry()).toLocaleDateString()} +

+
+ )} +
+
+ +
)} @@ -131,26 +161,38 @@ function LicenseKeyActivate(props: { })); return ( -
-

- Got a license key? Enter it below -

- setLicenseKey(e.currentTarget.value)} - /> - - {/*

- Instance ID: {generalSettings().instanceId} -

*/} +
+
+

+ Have a license key? +

+ setLicenseKey(e.currentTarget.value)} + class="w-full bg-gray-3 border-gray-4" + /> +
+ +
+ +

+ {String(activateLicenseKey.error)} +

+
+
); }} @@ -161,118 +203,121 @@ function LicenseKeyActivate(props: { type CommercialLicenseType = "yearly" | "lifetime"; function CommercialLicensePurchase() { - const openCheckoutInExternalBrowser = createMutation(() => ({ - mutationFn: async ({ type }: { type: CommercialLicenseType }) => { + const queryClient = useQueryClient(); + + const [type, setType] = createSignal("yearly"); + + const [isCommercialAnnual, setIsCommercialAnnual] = createSignal(true); + + const { rive: CommercialRive, RiveComponent: Commercial } = createRive(() => ({ + src: PricingRive, + autoplay: true, + artboard: "commercial", + animations: ["card-stack"], + })); + + const openCommercialCheckout = createMutation(() => ({ + mutationFn: async () => { const resp = await licenseApiClient.createCommercialCheckoutUrl({ - body: { type }, + body: { type: isCommercialAnnual() ? "yearly" : "lifetime" }, }); - if (resp.status === 200) tauriShell.open(resp.body.url); - else throw resp.body; + if (resp.status === 200) { + commands.openExternalLink(resp.body.url); + } }, })); - const [type, setType] = createSignal("yearly"); - return ( <> -
-
-
-

- Commercial License -

-

- For professional use without cloud features. -

-
-
-

- {type() === "yearly" ? "$29/year" : "$58"} -

-
- {type() === "lifetime" && ( -

- billed once -

- )} - {type() === "lifetime" && ( -

- or, $29/year. -

- )} -
-
+
+
+ {/* Left Column */} +
{ + const riveInstance = CommercialRive(); + if (riveInstance) { + // Stop any current animations first + riveInstance.stop(); + // Play the enter animation + riveInstance.play("cards"); + } + }} + onMouseLeave={() => { + const riveInstance = CommercialRive(); + if (riveInstance) { + // Stop any current animations first + riveInstance.stop(); + // Play the leave animation + riveInstance.play("card-stack"); + } + }} + class="flex flex-col gap-4 items-center p-5 rounded-t-xl border md:rounded-tr-none md:rounded-tl-xl md:rounded-bl-xl border-gray-4 md:w-1/2 bg-gray-3"> + +
+

+ Commercial License +

+

+ For commercial use +

-
-
-
- - Switch to {type() === "yearly" ? "lifetime" : "yearly"} - - +
+

+ {isCommercialAnnual() ? "$29" : "$58"} + .00 / +

+

+ {isCommercialAnnual() ? "billed annually" : "one-time payment"} +

-
-
- -
-
-
-
-
    - {[ - "Commercial Use of Cap Recorder + Editor", - "Community Support", - ].map((feature) => ( -
  • -
    - -
    - - {feature} - -
  • - ))} -
-
+

+ Switch to {isCommercialAnnual() ? "lifetime" : "yearly"}:{" "} + + {isCommercialAnnual() ? "$58" : "$29"} + +

+ +
+ + {/* Right Column */} +
+
    + {[ + "Commercial Use of Cap Recorder + Editor", + "Community Support", + "Local-only features", + "Perpetual license option", + ].map((feature) => ( +
  • +
    + +
    + + {feature} + +
  • + ))} +
+ { await generalSettingsStore.set({ diff --git a/apps/desktop/src/routes/editor/ui.tsx b/apps/desktop/src/routes/editor/ui.tsx index 003a90a71c0..e2fdc31d15c 100644 --- a/apps/desktop/src/routes/editor/ui.tsx +++ b/apps/desktop/src/routes/editor/ui.tsx @@ -151,7 +151,7 @@ export function Input(props: ComponentProps<"input">) { From e1ea62ac79c7dd6877afdec49e385dc06ed549e5 Mon Sep 17 00:00:00 2001 From: ameer2468 <33054370+ameer2468@users.noreply.github.com> Date: Wed, 21 May 2025 20:12:22 +0300 Subject: [PATCH 5/8] cleanup ui --- .../(window-chrome)/settings/license.tsx | 3 +- .../src/routes/(window-chrome)/upgrade.tsx | 40 ++++++++----------- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/apps/desktop/src/routes/(window-chrome)/settings/license.tsx b/apps/desktop/src/routes/(window-chrome)/settings/license.tsx index e734115e3af..1b0e0e25e92 100644 --- a/apps/desktop/src/routes/(window-chrome)/settings/license.tsx +++ b/apps/desktop/src/routes/(window-chrome)/settings/license.tsx @@ -96,7 +96,8 @@ export default function Page() {
)} -
+
+
-

- This will remove the license key from this device. -

From 8cd207702bfbc52ef59617c5ffc838ea91cc048c Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Fri, 23 May 2025 02:44:01 +0800 Subject: [PATCH 6/8] fix up license/upgrade page flows --- .../(window-chrome)/settings/experimental.tsx | 4 +- .../(window-chrome)/settings/license.tsx | 105 +++++++++--------- 2 files changed, 55 insertions(+), 54 deletions(-) diff --git a/apps/desktop/src/routes/(window-chrome)/settings/experimental.tsx b/apps/desktop/src/routes/(window-chrome)/settings/experimental.tsx index c6740bcfae2..38b44c65f6b 100644 --- a/apps/desktop/src/routes/(window-chrome)/settings/experimental.tsx +++ b/apps/desktop/src/routes/(window-chrome)/settings/experimental.tsx @@ -41,10 +41,10 @@ function Inner(props: { initialStore: GeneralSettingsStore | null }) {
-

+

Experimental Features

-

+

These features are still in development and may not work as expected.

diff --git a/apps/desktop/src/routes/(window-chrome)/settings/license.tsx b/apps/desktop/src/routes/(window-chrome)/settings/license.tsx index 1b0e0e25e92..2b372d1736f 100644 --- a/apps/desktop/src/routes/(window-chrome)/settings/license.tsx +++ b/apps/desktop/src/routes/(window-chrome)/settings/license.tsx @@ -26,32 +26,34 @@ export default function Page() { const queryClient = useQueryClient(); return ( -
-
-

- Commercial License -

-

+

+
+

Commercial License

+

Permits using Cap for commercial purposes, but without paying for cloud features. + +
+ Need cloud features?{" "} + +

-
}> -
+
- -

Cap Pro License

+

+ Cap Pro License +

-

+

Your account is upgraded to{" "} Cap Pro and already includes a commercial license. @@ -87,9 +89,7 @@ export default function Page() { {(expiry) => (

- +

{new Date(expiry()).toLocaleDateString()}

@@ -162,11 +162,9 @@ function LicenseKeyActivate(props: { })); return ( -
-
-

- Have a license key? -

+
+
+

Have a license key?

({ - src: PricingRive, - autoplay: true, - artboard: "commercial", - animations: ["card-stack"], - })); + const { rive: CommercialRive, RiveComponent: Commercial } = createRive( + () => ({ + src: PricingRive, + autoplay: true, + artboard: "commercial", + animations: ["card-stack"], + }) + ); const openCommercialCheckout = createMutation(() => ({ mutationFn: async () => { @@ -234,26 +234,27 @@ function CommercialLicensePurchase() {
{/* Left Column */} -
{ - const riveInstance = CommercialRive(); - if (riveInstance) { - // Stop any current animations first - riveInstance.stop(); - // Play the enter animation - riveInstance.play("cards"); - } - }} - onMouseLeave={() => { - const riveInstance = CommercialRive(); - if (riveInstance) { - // Stop any current animations first - riveInstance.stop(); - // Play the leave animation - riveInstance.play("card-stack"); - } - }} - class="flex flex-col gap-4 items-center p-5 rounded-t-xl border md:rounded-tr-none md:rounded-tl-xl md:rounded-bl-xl border-gray-4 md:w-1/2 bg-gray-3"> +
{ + const riveInstance = CommercialRive(); + if (riveInstance) { + // Stop any current animations first + riveInstance.stop(); + // Play the enter animation + riveInstance.play("cards"); + } + }} + onMouseLeave={() => { + const riveInstance = CommercialRive(); + if (riveInstance) { + // Stop any current animations first + riveInstance.stop(); + // Play the leave animation + riveInstance.play("card-stack"); + } + }} + class="flex flex-col gap-4 items-center p-5 rounded-t-xl border md:rounded-tr-none md:rounded-tl-xl md:rounded-bl-xl border-gray-4 md:w-1/2 bg-gray-3" + >

@@ -295,7 +296,7 @@ function CommercialLicensePurchase() { : "Purchase License"}

- + {/* Right Column */}
    From 9ab1fd1353c8d56473f554ff17383af1d4928d01 Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Fri, 23 May 2025 02:45:44 +0800 Subject: [PATCH 7/8] remove Manage Subscription button --- .../src/routes/(window-chrome)/settings/license.tsx | 9 --------- 1 file changed, 9 deletions(-) diff --git a/apps/desktop/src/routes/(window-chrome)/settings/license.tsx b/apps/desktop/src/routes/(window-chrome)/settings/license.tsx index 2b372d1736f..2b33354592c 100644 --- a/apps/desktop/src/routes/(window-chrome)/settings/license.tsx +++ b/apps/desktop/src/routes/(window-chrome)/settings/license.tsx @@ -58,15 +58,6 @@ export default function Page() { Cap Pro and already includes a commercial license.

    -
    - -
From 79c6f5b47c11677d2c0204c8eac0967f3aea1c53 Mon Sep 17 00:00:00 2001 From: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri, 23 May 2025 00:37:43 +0100 Subject: [PATCH 8/8] fix: License text colour --- apps/desktop/src/routes/(window-chrome)/settings/license.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/desktop/src/routes/(window-chrome)/settings/license.tsx b/apps/desktop/src/routes/(window-chrome)/settings/license.tsx index 2b33354592c..af346be3863 100644 --- a/apps/desktop/src/routes/(window-chrome)/settings/license.tsx +++ b/apps/desktop/src/routes/(window-chrome)/settings/license.tsx @@ -67,7 +67,9 @@ export default function Page() {
-

Commercial License

+

+ Commercial License +