From cfc2ea91176e58d4efdaab4cd219c6cc28abe07d Mon Sep 17 00:00:00 2001 From: melohagan <101575380+melohagan@users.noreply.github.com> Date: Tue, 7 May 2024 12:44:57 +0100 Subject: [PATCH 1/5] Add free trial modal (#13609) * Add free_trial to deploy camunda script * WIP FreeTrial modal * Handle free trial modal via self endpoint * Set correct plan title for trial * Remove catch * lint * Refactor * Remove unnecessary code * Rename to EnterpriseBasicTrialModal --- packages/builder/assets/FreeTrial.svelte | 46 +++++++++++++ .../EnterpriseBasicTrialModal.svelte | 64 +++++++++++++++++++ packages/builder/src/helpers/planTitle.js | 3 + .../builder/app/[application]/_layout.svelte | 3 + .../builder/src/stores/portal/licensing.js | 3 + packages/frontend-core/src/constants.js | 1 + packages/types/src/api/web/auth.ts | 1 + packages/types/src/documents/global/user.ts | 1 + .../src/api/routes/global/tests/self.spec.ts | 2 + .../worker/src/api/routes/validation/users.ts | 1 + scripts/deploy-camunda.sh | 1 + 11 files changed, 126 insertions(+) create mode 100644 packages/builder/assets/FreeTrial.svelte create mode 100644 packages/builder/src/components/portal/onboarding/EnterpriseBasicTrialModal.svelte diff --git a/packages/builder/assets/FreeTrial.svelte b/packages/builder/assets/FreeTrial.svelte new file mode 100644 index 0000000000..79a722d90c --- /dev/null +++ b/packages/builder/assets/FreeTrial.svelte @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + diff --git a/packages/builder/src/components/portal/onboarding/EnterpriseBasicTrialModal.svelte b/packages/builder/src/components/portal/onboarding/EnterpriseBasicTrialModal.svelte new file mode 100644 index 0000000000..fa789311d1 --- /dev/null +++ b/packages/builder/src/components/portal/onboarding/EnterpriseBasicTrialModal.svelte @@ -0,0 +1,64 @@ + + + + { + if (get(auth).user) { + try { + await API.updateSelf({ + freeTrialConfirmedAt: new Date().toISOString(), + }) + // Update the cached user + await auth.getSelf() + } finally { + freeTrialModal.hide() + } + } + }} + > + Experience all of Budibase with a free 14-day trial + + We've upgraded you to a free 14-day trial that allows you to try all our + features before deciding which plan is right for you. + + At the end of your trial, we'll automatically downgrade you to the Free + plan unless you choose to upgrade. + + + + + + + diff --git a/packages/builder/src/helpers/planTitle.js b/packages/builder/src/helpers/planTitle.js index 79f2bc2382..c08b8bf3fe 100644 --- a/packages/builder/src/helpers/planTitle.js +++ b/packages/builder/src/helpers/planTitle.js @@ -20,6 +20,9 @@ export function getFormattedPlanName(userPlanType) { case PlanType.ENTERPRISE: planName = "Enterprise" break + case PlanType.ENTERPRISE_BASIC_TRIAL: + planName = "Trial" + break default: planName = "Free" // Default to "Free" if the type is not explicitly handled } diff --git a/packages/builder/src/pages/builder/app/[application]/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/_layout.svelte index fd6a97560d..60c45fd2e4 100644 --- a/packages/builder/src/pages/builder/app/[application]/_layout.svelte +++ b/packages/builder/src/pages/builder/app/[application]/_layout.svelte @@ -32,6 +32,7 @@ import { UserAvatars } from "@budibase/frontend-core" import { TOUR_KEYS } from "components/portal/onboarding/tours.js" import PreviewOverlay from "./_components/PreviewOverlay.svelte" + import EnterpriseBasicTrialModal from "components/portal/onboarding/EnterpriseBasicTrialModal.svelte" export let application @@ -192,6 +193,8 @@ + +
+ At the end of your trial, we'll automatically downgrade you to the Free + plan unless you choose to upgrade. +