af3857a209
* feat(gatekeeper): add gatekeeper module feature flag * feat(gatekeeper): add workspace pricing table domain * feat(gatekeeper): add checkout session creation * feat(gatekeeper): verify stripe signature * wip(gatekeeper): checkout callbacks * feat(gatekeeper): add unlimited and academia plan types * refactor(envHelper): getStringFromEnv helper * chore(gatekeeper): add future todos * feat(gatekeeper): add productId to the subscription domain * feat(gatekeeper): add in memory repositories * feat(gatekeeper): add more errors * feat(gatekeeper): complete checkout session service * feat(gatekeeper): add stripe client implementation * feat(gatekeeper): add checkout session completion webhook callback path * feat(gendo): fix not needing env vars if gendo module is not enabled * feat(gatekeeper): require a license for billing * chore(gatekeeper): cleanup before testing * feat(gatekeeper): subscriptionData parsing model * ci: add billing integration and gatekeeper modules to test config * test(gatekeeper): add checkout service tests * feat(gatekeeper): make completeCheckout callback idempotent properly * feat(gatekeeper): move to knex based repositories * test(gatekeeper): billing repository tests * feat(gatekeeper): add yearly billing cycle toggle * feat(ci): add stripe integration context to test job * feat(billingPage): conditionally render the checkout CTAs * fix(gatekeeper): remove flaky test condition * feat(helm): add billing integration feature flag * WIP billing gql api * feat(gatekeeper): cancel checkout session api * feat(gatekeeper): handle existing checkout sessions, when trying to create a new one * feat(gatekeeper): add workspace plans gql api * feat(gatekeeper): handle cancelation and subscription updates * fix(gatekeeper): scope initialization * fix(gatekeeper): eliminate stripe client import sideeffect * fix(gatekeeper): eliminate stripe client import sideeffect 2 * fix(mainConstants): fitler gatekeeper scopes with feature flag
52 lines
1.2 KiB
TypeScript
52 lines
1.2 KiB
TypeScript
import { Roles, Scopes, AllScopes as BaseAllScopes } from '@speckle/shared'
|
|
import { getFeatureFlags } from '@/modules/shared/helpers/envHelper'
|
|
|
|
const {
|
|
FF_AUTOMATE_MODULE_ENABLED,
|
|
FF_WORKSPACES_MODULE_ENABLED,
|
|
FF_GATEKEEPER_MODULE_ENABLED
|
|
} = getFeatureFlags()
|
|
|
|
const buildAllScopes = () => {
|
|
let base = BaseAllScopes
|
|
|
|
if (!FF_AUTOMATE_MODULE_ENABLED) {
|
|
base = base.filter(
|
|
(s: string) =>
|
|
!(
|
|
[
|
|
Scopes.AutomateFunctions.Read,
|
|
Scopes.AutomateFunctions.Write,
|
|
Scopes.Automate.ReportResults
|
|
] as string[]
|
|
).includes(s)
|
|
)
|
|
}
|
|
|
|
if (!FF_WORKSPACES_MODULE_ENABLED) {
|
|
base = base.filter(
|
|
(s: string) =>
|
|
!(
|
|
[
|
|
Scopes.Workspaces.Create,
|
|
Scopes.Workspaces.Read,
|
|
Scopes.Workspaces.Update,
|
|
Scopes.Workspaces.Delete
|
|
] as string[]
|
|
).includes(s)
|
|
)
|
|
}
|
|
|
|
if (!FF_GATEKEEPER_MODULE_ENABLED) {
|
|
base = base.filter(
|
|
(s: string) => !([Scopes.Gatekeeper.WorkspaceBilling] as string[]).includes(s)
|
|
)
|
|
}
|
|
return base
|
|
}
|
|
|
|
const AllScopes = buildAllScopes()
|
|
|
|
export type { ServerRoles, StreamRoles } from '@speckle/shared'
|
|
export { Roles, Scopes, AllScopes }
|