diff --git a/assets/js/hubsubscription.js b/assets/js/hubsubscription.js index 319835a5d..2edc6d4cf 100644 --- a/assets/js/hubsubscription.js +++ b/assets/js/hubsubscription.js @@ -12,10 +12,21 @@ class HubSubscription { constructor(form, subscriptionData, searchParams) { this._form = form; this._subscriptionData = subscriptionData; - this._subscriptionData.hubId = searchParams.get('hub_id'); - let encodedReturnUrl = searchParams.get('return_url'); - if (encodedReturnUrl) { - this._subscriptionData.returnUrl = decodeURIComponent(encodedReturnUrl); + let fragmentParams = new URLSearchParams(location.hash.substring(1)); + this._subscriptionData.oldLicense = fragmentParams.get('oldLicense'); + if (this._subscriptionData.oldLicense) { + try { + let base64 = this._subscriptionData.oldLicense.split('.')[1].replace(/-/g, '+').replace(/_/g, '/'); + this._subscriptionData.hubId = JSON.parse(atob(base64)).jti; + } catch (e) { + console.error('Failed to parse hub token:', e); + this._subscriptionData.oldLicense = null; + } + } + this._subscriptionData.hubId = this._subscriptionData.hubId ?? searchParams.get('hub_id'); + let returnUrl = fragmentParams.get('returnUrl') ?? searchParams.get('return_url'); + if (returnUrl) { + this._subscriptionData.returnUrl = returnUrl; } this._subscriptionData.session = searchParams.get('session'); if (this._subscriptionData.hubId && this._subscriptionData.hubId.length > 0 && this._subscriptionData.returnUrl && this._subscriptionData.returnUrl.length > 0) { @@ -57,7 +68,7 @@ class HubSubscription { } onLoadSubscriptionSucceeded(data) { - this._subscriptionData.verificationToken = data.token; + this._subscriptionData.oldLicense = data.token; this._subscriptionData.details = data.subscription; if (data.subscription.quantity) { this._subscriptionData.quantity = data.subscription.quantity; @@ -313,7 +324,7 @@ class HubSubscription { onPostSucceeded(data) { this._subscriptionData.state = 'EXISTING_CUSTOMER'; - this._subscriptionData.verificationToken = data.token; + this._subscriptionData.oldLicense = data.token; this._subscriptionData.details = data.subscription; this._subscriptionData.session = data.session; var searchParams = new URLSearchParams(window.location.search) @@ -480,7 +491,7 @@ class HubSubscription { } onPutSucceeded(data, shouldOpenReturnUrl) { - this._subscriptionData.verificationToken = data.token; + this._subscriptionData.oldLicense = data.token; this._subscriptionData.details = data.subscription; this._subscriptionData.errorMessage = ''; this._subscriptionData.inProgress = false; @@ -505,7 +516,7 @@ class HubSubscription { url: REFRESH_LICENSE_URL, type: 'POST', data: { - token: this._subscriptionData.verificationToken, + token: this._subscriptionData.oldLicense, captcha: this._subscriptionData.captcha } }).done(token => { diff --git a/i18n/de.yaml b/i18n/de.yaml index 10ce868a8..38e683990 100644 --- a/i18n/de.yaml +++ b/i18n/de.yaml @@ -34,6 +34,8 @@ translation: "Ich bin damit einverstanden, Neuigkeiten von Cryptomator Hub zu erhalten, und akzeptiere die Datenschutzerklärung." - id: accept_hub_newsletter_optional translation: "Ich bin damit einverstanden, Neuigkeiten von Cryptomator Hub per E-Mail zu erhalten (optional)." +- id: accept_hub_managed_early_access_optional + translation: "BETA Early Access von Cryptomator Hub 1.5.0 mit brandneuen Features und einer verlängerten 100-Tage-Testphase testen (optional)." - id: accept_privacy translation: "Ich akzeptiere die Datenschutzerklärung." - id: accept_privacy_implicitly @@ -613,6 +615,19 @@ - id: hub_billing_checkout_standard_submit translation: "Zur Zahlung" +- id: hub_billing_checkout_community_title + translation: "Community" +- id: hub_billing_checkout_community_statement + translation: "Kostenlos" +- id: hub_billing_checkout_community_description + translation: "bis zu 5 Sitze inklusive" +- id: hub_billing_checkout_community_subtitle + translation: "Kostenlos starten" +- id: hub_billing_checkout_community_cta + translation: "Deine Hub-Instanz unterstützt die Community Edition. Registriere dich für eine kostenlose Lizenz mit bis zu 5 Sitzen." +- id: hub_billing_checkout_community_action + translation: "Kostenlos registrieren" + - id: hub_billing_checkout_enterprise_title translation: "Enterprise" - id: hub_billing_checkout_enterprise_statement diff --git a/i18n/en.yaml b/i18n/en.yaml index 82551964a..ee025e67c 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -34,6 +34,8 @@ translation: "I agree to get updates from Cryptomator Hub and accept the Privacy Policy." - id: accept_hub_newsletter_optional translation: "I agree to get updates from Cryptomator Hub via email (optional)." +- id: accept_hub_managed_early_access_optional + translation: "BETA Try out early access of Cryptomator Hub 1.5.0 with brand new features and an extended 100-day trial (optional)." - id: accept_privacy translation: "I accept the Privacy Policy." - id: accept_privacy_implicitly @@ -613,6 +615,19 @@ - id: hub_billing_checkout_standard_submit translation: "Checkout" +- id: hub_billing_checkout_community_title + translation: "Community" +- id: hub_billing_checkout_community_statement + translation: "Free" +- id: hub_billing_checkout_community_description + translation: "up to 5 seats included" +- id: hub_billing_checkout_community_subtitle + translation: "Get Started for Free" +- id: hub_billing_checkout_community_cta + translation: "Your Hub instance supports the Community Edition. Register for a free license with up to 5 seats." +- id: hub_billing_checkout_community_action + translation: "Register for Free" + - id: hub_billing_checkout_enterprise_title translation: "Enterprise" - id: hub_billing_checkout_enterprise_statement diff --git a/layouts/hub-billing/single.html b/layouts/hub-billing/single.html index 4266a7dd7..b237b57d8 100644 --- a/layouts/hub-billing/single.html +++ b/layouts/hub-billing/single.html @@ -3,7 +3,7 @@ {{ end }} {{ define "main" }}