diff --git a/frontend/common/stores/account-store.js b/frontend/common/stores/account-store.js index 2deb58f93073..d57110e0b9a5 100644 --- a/frontend/common/stores/account-store.js +++ b/frontend/common/stores/account-store.js @@ -314,6 +314,7 @@ const controller = { getStore().dispatch(setSelectedOrganisationId(id)) store.changed() identifyChatUser() + API.setFlagsmithSubscriptionPlanTrait() }, setToken: (token) => { diff --git a/frontend/common/utils/utils.tsx b/frontend/common/utils/utils.tsx index db241e4457f6..be6dd74ddbab 100644 --- a/frontend/common/utils/utils.tsx +++ b/frontend/common/utils/utils.tsx @@ -467,6 +467,7 @@ const Utils = Object.assign({}, BaseUtils, { } } }, + getPlanName: (_plan: string) => { const plan = (_plan || '')?.toLowerCase() if (plan.includes('free')) { @@ -489,6 +490,7 @@ const Utils = Object.assign({}, BaseUtils, { } return planNames.free }, + getPlanPermission: (plan: string, feature: PaidFeature) => { const planName = Utils.getPlanName(plan) if (!plan || planName === planNames.free) { @@ -508,6 +510,7 @@ const Utils = Object.assign({}, BaseUtils, { } return true }, + getPlansPermission: (feature: PaidFeature) => { const isOrgPermission = feature !== '2FA' let plans @@ -527,6 +530,7 @@ const Utils = Object.assign({}, BaseUtils, { ) return !!found }, + getProjectColour(index: number) { return Constants.projectColors[index % (Constants.projectColors.length - 1)] }, diff --git a/frontend/web/components/experiments/ExperimentsFakeDoor/ExperimentsFakeDoor.tsx b/frontend/web/components/experiments/ExperimentsFakeDoor/ExperimentsFakeDoor.tsx index 02864130387b..2b74d202057a 100644 --- a/frontend/web/components/experiments/ExperimentsFakeDoor/ExperimentsFakeDoor.tsx +++ b/frontend/web/components/experiments/ExperimentsFakeDoor/ExperimentsFakeDoor.tsx @@ -45,7 +45,14 @@ const ExperimentsFakeDoor: FC = () => { I would like to participate in beta testing - Get early access to Experiments and help shape the feature + Get early access to Experiments and help shape the feature.{' '} + + Learn more + {signedUp ? ( diff --git a/frontend/web/project/api.ts b/frontend/web/project/api.ts index bf1535b36666..6782be510782 100644 --- a/frontend/web/project/api.ts +++ b/frontend/web/project/api.ts @@ -140,6 +140,8 @@ const API = { organisations: user.organisations ? user.organisations.map((o) => String(o.id)).join(',') : '', + 'subscription.plan': + AccountStore.getOrganisation()?.subscription?.plan || '', }) .then(() => flagsmith.setTrait( @@ -285,6 +287,14 @@ const API = { API.setCookie('event', v) }, + setFlagsmithSubscriptionPlanTrait: () => { + const organisation = AccountStore.getOrganisation() + return flagsmith.setTrait( + 'subscription.plan', + organisation?.subscription?.plan || '', + ) + }, + setInvite(id: string): void { Cookies.set('invite', id) },