diff --git a/packages/web/src/EnterLicensePage.svelte b/packages/web/src/EnterLicensePage.svelte index a9ae12c3f..1702b7f44 100644 --- a/packages/web/src/EnterLicensePage.svelte +++ b/packages/web/src/EnterLicensePage.svelte @@ -14,6 +14,7 @@ import ErrorInfo from './elements/ErrorInfo.svelte'; import { isOneOfPage } from './utility/pageDefs'; import { openWebLink } from './utility/simpleTools'; + import FontIcon from './icons/FontIcon.svelte'; const config = useConfig(); const values = writable({ amoid: null, databaseServer: null }); @@ -22,12 +23,10 @@ $: trialDaysLeft = $config?.trialDaysLeft; let errorMessage = ''; - let expiredMessageSet = false; - $: if (isExpired && !expiredMessageSet) { - errorMessage = 'Your license is expired'; - expiredMessageSet = true; - } + let isInsertingLicense = false; + + $: trialButtonAvailable = !isExpired && trialDaysLeft == null; // $: console.log('CONFIG', $config); @@ -41,83 +40,126 @@ {#if getElectron() || ($config?.storageDatabase && hasPermission('admin/license'))} -
License
- +
Thank you for using DbGate!
-
- { - sessionStorage.setItem('continueTrialConfirmed', '1'); - const { licenseKey } = e.detail; - const resp = await apiCall('config/save-license-key', { licenseKey, tryToRenew: true }); - if (resp?.status == 'ok') { - internalRedirectTo(isOneOfPage('admin-license') ? '/admin.html' : '/index.html'); - } else { - errorMessage = resp?.errorMessage || 'Error saving license key'; - } - }} - /> -
+ {#if isExpired} +
Your license has expired. Please insert new license.
+ {:else if trialDaysLeft > 0} +
+ Your trial period will expire in {trialDaysLeft} day{trialDaysLeft != 1 + ? 's' + : ''}. +
+ {:else} +
+ Please choose licensing model. You could either purchase Premium edition + {#if trialButtonAvailable}, use 30-day free trial{/if} or download free + Community edition. +
+ {/if} - {#if !isExpired && trialDaysLeft == null} + {#if isInsertingLicense} + + +
+
+
+ { + sessionStorage.setItem('continueTrialConfirmed', '1'); + const { licenseKey } = e.detail; + const resp = await apiCall('config/save-license-key', { licenseKey, tryToRenew: true }); + if (resp?.status == 'ok') { + internalRedirectTo(isOneOfPage('admin-license') ? '/admin.html' : '/index.html'); + } else { + errorMessage = resp?.errorMessage || 'Error saving license key'; + } + }} + /> +
+
+ { + isInsertingLicense = false; + errorMessage = ''; + }} + /> +
+
+
+ {/if} + + {#if !isInsertingLicense}
{ - errorMessage = ''; - const license = await apiCall('config/start-trial'); - if (license?.status == 'ok') { + value="Insert license key" + on:click={() => { + isInsertingLicense = true; + }} + /> +
+ + {#if trialButtonAvailable} +
+ { + errorMessage = ''; + const license = await apiCall('config/start-trial'); + if (license?.status == 'ok') { + sessionStorage.setItem('continueTrialConfirmed', '1'); + internalRedirectTo(isOneOfPage('admin-license') ? '/admin.html' : '/index.html'); + } else { + errorMessage = license?.errorMessage || 'Error starting trial'; + } + }} + /> +
+ {/if} + + {#if trialDaysLeft > 0} +
+ { sessionStorage.setItem('continueTrialConfirmed', '1'); internalRedirectTo(isOneOfPage('admin-license') ? '/admin.html' : '/index.html'); - } else { - errorMessage = license?.errorMessage || 'Error starting trial'; - } - }} - /> -
- {/if} + }} + /> + + {/if} - {#if trialDaysLeft > 0}
{ - sessionStorage.setItem('continueTrialConfirmed', '1'); - internalRedirectTo(isOneOfPage('admin-license') ? '/admin.html' : '/index.html'); + // openWebLink( + // `https://auth.dbgate.eu/create-checkout-session-simple?source=trial-${isExpired ? 'expired' : (trialDaysLeft ?? 'no')}` + // ); + + // openWebLink( + // `https://auth-proxy.dbgate.udolni.net/redirect-to-purchase?product=${getElectron() ? 'premium' : 'teram-premium'}&source=trial-${isExpired ? 'expired' : (trialDaysLeft ?? 'no')}` + // ); + + openWebLink( + `https://auth.dbgate.eu/redirect-to-purchase?product=${getElectron() ? 'premium' : 'team-premium'}&source=trial-${isExpired ? 'expired' : (trialDaysLeft ?? 'no')}` + ); }} />
- {/if} -
- { - // openWebLink( - // `https://auth.dbgate.eu/create-checkout-session-simple?source=trial-${isExpired ? 'expired' : (trialDaysLeft ?? 'no')}` - // ); - - // openWebLink( - // `https://auth-proxy.dbgate.udolni.net/redirect-to-purchase?product=${getElectron() ? 'premium' : 'teram-premium'}&source=trial-${isExpired ? 'expired' : (trialDaysLeft ?? 'no')}` - // ); - - openWebLink( - `https://auth.dbgate.eu/redirect-to-purchase?product=${getElectron() ? 'premium' : 'team-premium'}&source=trial-${isExpired ? 'expired' : (trialDaysLeft ?? 'no')}` - ); - }} - /> -
- - {#if getElectron()} -
- { - getElectron().send('quit-app'); - }} - /> -
+ {#if getElectron()} +
+ { + getElectron().send('quit-app'); + }} + /> +
+ {/if} {/if} {#if errorMessage} @@ -141,6 +183,10 @@ font-size: xx-large; } + .infotext { + margin: 1em; + } + .submit { margin: var(--dim-large-form-margin); display: flex;