Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/common/stores/account-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ const controller = {
getStore().dispatch(setSelectedOrganisationId(id))
store.changed()
identifyChatUser()
API.setFlagsmithSubscriptionPlanTrait()
},

setToken: (token) => {
Expand Down
4 changes: 4 additions & 0 deletions frontend/common/utils/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ const Utils = Object.assign({}, BaseUtils, {
}
}
},

getPlanName: (_plan: string) => {
const plan = (_plan || '')?.toLowerCase()
if (plan.includes('free')) {
Expand All @@ -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) {
Expand All @@ -508,6 +510,7 @@ const Utils = Object.assign({}, BaseUtils, {
}
return true
},

getPlansPermission: (feature: PaidFeature) => {
const isOrgPermission = feature !== '2FA'
let plans
Expand All @@ -527,6 +530,7 @@ const Utils = Object.assign({}, BaseUtils, {
)
return !!found
},

getProjectColour(index: number) {
return Constants.projectColors[index % (Constants.projectColors.length - 1)]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ const ExperimentsFakeDoor: FC = () => {
I would like to participate in beta testing
</span>
<span className='experiments-fake-door__cta-subtitle'>
Get early access to Experiments and help shape the feature
Get early access to Experiments and help shape the feature.{' '}
<a
href='https://docs.flagsmith.com/experiment-statistics'
target='_blank'
rel='noreferrer'
Comment on lines +49 to +52

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seized the opportunity to add the link to the doc as it is somehow related to the trait addition

>
Learn more
</a>
</span>
</div>
{signedUp ? (
Expand Down
10 changes: 10 additions & 0 deletions frontend/web/project/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
return
}
if (res instanceof Error) {
console.error(res)

Check warning on line 31 in frontend/web/project/api.ts

View workflow job for this annotation

GitHub Actions / Lint changed files

Unexpected console statement
store.error = res
store.goneABitWest()
return
Expand Down Expand Up @@ -85,7 +85,7 @@
if (Project.reo) {
loadReoScript({ clientID: Project.reo }).then(
(Reo: typeof ReoInstance) => {
Reo.init({ clientID: Project.reo! })

Check warning on line 88 in frontend/web/project/api.ts

View workflow job for this annotation

GitHub Actions / Lint changed files

Forbidden non-null assertion
let authType = 'userID'
switch (user.auth_type) {
case 'EMAIL':
Expand Down Expand Up @@ -140,6 +140,8 @@
organisations: user.organisations
? user.organisations.map((o) => String(o.id)).join(',')
: '',
'subscription.plan':
AccountStore.getOrganisation()?.subscription?.plan || '',
})
.then(() =>
flagsmith.setTrait(
Expand Down Expand Up @@ -191,7 +193,7 @@
getReferrer(): any {
const r = Cookies.get('r')
try {
return JSON.parse(r!)

Check warning on line 196 in frontend/web/project/api.ts

View workflow job for this annotation

GitHub Actions / Lint changed files

Forbidden non-null assertion
} catch {
return null
}
Expand Down Expand Up @@ -243,12 +245,12 @@
})
API.flagsmithIdentify()
} catch (err) {
console.error('Error identifying', err)

Check warning on line 248 in frontend/web/project/api.ts

View workflow job for this annotation

GitHub Actions / Lint changed files

Unexpected console statement
}
},

log(...args: any[]): void {
console.log(...args)

Check warning on line 253 in frontend/web/project/api.ts

View workflow job for this annotation

GitHub Actions / Lint changed files

Unexpected console statement
},

postEvent(event: string, tag?: string): Promise<any> | void {
Expand Down Expand Up @@ -285,6 +287,14 @@
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)
},
Expand All @@ -304,9 +314,9 @@
extra?: Record<string, any>
}): void {
if (Project.ga) {
if (Project.logAnalytics) console.log('ANALYTICS EVENT', data)

Check warning on line 317 in frontend/web/project/api.ts

View workflow job for this annotation

GitHub Actions / Lint changed files

Unexpected console statement
if (!data || !data.category || !data.event)
return console.error('Invalid event provided', data)

Check warning on line 319 in frontend/web/project/api.ts

View workflow job for this annotation

GitHub Actions / Lint changed files

Unexpected console statement
if (data.category === 'First')
API.postEvent(
`${data.event}${data.extra ? ` ${JSON.stringify(data.extra)}` : ''}`,
Expand Down
Loading