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 (
- 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().licenseKey}
-
- - Instance ID: {license().instanceId} -
*/} -- Got a license key? Enter it below -
- setLicenseKey(e.currentTarget.value)} - /> - - {/*- Instance ID: {generalSettings().instanceId} -
*/} -- For professional use without cloud features. -
-- billed once -
- )} - {type() === "lifetime" && ( -- or, $29/year. -
- )} -+ 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().licenseKey}
+
+ + Instance ID: {license().instanceId} +
*/} ++ Got a license key? Enter it below +
+ setLicenseKey(e.currentTarget.value)} + /> + + {/*+ Instance ID: {generalSettings().instanceId} +
*/} ++ For professional use without cloud features. +
++ billed once +
+ )} + {type() === "lifetime" && ( ++ or, $29/year. +
+ )} ++
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. -
++ Your account is upgraded to{" "} + Cap Pro and + already includes a commercial license. +
+
- {license().licenseKey}
-
- - Instance ID: {license().instanceId} -
*/} -
+ {license().licenseKey}
+
+ + {new Date(expiry()).toLocaleDateString()} +
+- Got a license key? Enter it below -
- setLicenseKey(e.currentTarget.value)} - /> - - {/*- Instance ID: {generalSettings().instanceId} -
*/} ++ {String(activateLicenseKey.error)} +
+- For professional use without cloud features. -
-- billed once -
- )} - {type() === "lifetime" && ( -- or, $29/year. -
- )} -+ For commercial use +
+ {isCommercialAnnual() ? "billed annually" : "one-time payment"} +
- License details for Cap commercial use +
+ Your license details for Cap commercial use