{"version":3,"sources":["src/app/helpers/quota.ts","src/app/store/subscription/subscription.service.ts","src/app/pages/internal/settings/pages/subscription/dialogs/update-subscription/update-subscription.component.ts","src/app/pages/internal/settings/pages/subscription/dialogs/update-subscription/update-subscription.component.html","src/app/store/subscription/subscription.state.ts"],"sourcesContent":["import { Feature } from '../models/subscription-plan';\n\nexport const HasQuota = (feature: Feature): boolean => {\n if (!feature.quota) {\n return true;\n }\n\n if (feature.quota.quota === 0) {\n return false;\n }\n\n if (!feature.usage) {\n return true;\n }\n\n return feature.quota.quota > feature.usage.value;\n};\n","import { Injectable, inject } from '@angular/core';\nimport { Apollo, gql } from 'apollo-angular';\nimport { Observable, map } from 'rxjs';\nimport { toIdentifiableEntities } from 'src/app/helpers/graphql';\nimport {\n ChangeSubscriptionOptions,\n Plan,\n SubscriptionPlan,\n} from 'src/app/models/subscription-plan';\nimport { IdentifiableEntities } from '../common/list-entity';\n\nconst FIELDS = `\n id\n status\n canStartTrial\n canChange\n plan {\n id\n name\n features {\n name\n tier\n quota {\n type\n quota\n }\n usage {\n unit\n value\n }\n }\n }\n`;\n\nconst DETAILS_FIELDS = `\n details {\n currentPlan {\n plan {\n name\n features {\n name\n tier\n quota {\n type\n quota\n }\n usage {\n unit\n value\n }\n }\n }\n price\n currency\n billingCycle\n }\n changeAt\n nextPlan {\n plan {\n name\n features {\n name\n tier\n quota {\n type\n quota\n }\n usage {\n unit\n value\n }\n }\n }\n price\n currency\n billingCycle\n }\n upcomingInvoice {\n currency\n subtotal\n subtotalExcludingTax\n tax\n creationDate\n }\n currentPeriodStart\n currentPeriodEnd\n cancelAt\n }\n`;\n\nconst CANCEL_SUBSCRIPTION_MUTATION = gql`\n mutation CancelSubscription($organizationId: ID!) {\n cancelSubscription(organizationId: $organizationId) {\n ${FIELDS}\n ${DETAILS_FIELDS}\n }\n }\n`;\n\nconst UNCANCEL_SUBSCRIPTION_MUTATION = gql`\n mutation UnCancelSubscription($organizationId: ID!) {\n unCancelSubscription(organizationId: $organizationId) {\n ${FIELDS}\n ${DETAILS_FIELDS}\n }\n }\n`;\n\nconst CANCEL_SUBSCRIPTION_DOWNGRADE_MUTATION = gql`\n mutation CancelSubscriptionDowngrade($organizationId: ID!) {\n cancelSubscriptionDowngrade(organizationId: $organizationId) {\n ${FIELDS}\n ${DETAILS_FIELDS}\n }\n }\n`;\n\nconst CHANGE_SUBSCRIPTION_MUTATION = gql`\n mutation ChangeSubscription($organizationId: ID!, $options: ChangeSubscriptionOptions!) {\n changeSubscription(organizationId: $organizationId, options: $options) {\n ${FIELDS}\n ${DETAILS_FIELDS}\n }\n }\n`;\n\nconst CREATE_SUBSCRIPTION_MUTATION = gql`\n mutation CreateSubscription($organizationId: ID!, $options: CreateSubscriptionOptions!) {\n createSubscription(organizationId: $organizationId, options: $options) {\n ${FIELDS}\n ${DETAILS_FIELDS}\n }\n }\n`;\n\nconst GET_SUBSCRIPTION = gql`\n query GetSubscription($organizationId: ID!) {\n subscription(organizationId: $organizationId) {\n ${FIELDS}\n }\n }\n`;\n\nconst GET_SUBSCRIPTION_DETAILS = gql`\n query GetSubscriptionDetails($organizationId: ID!) {\n subscription(organizationId: $organizationId) {\n ${FIELDS}\n ${DETAILS_FIELDS}\n }\n }\n`;\n\nconst GET_PLANS = gql`\n query GetPlans($organizationId: ID!) {\n plans(organizationId: $organizationId) {\n id\n name\n order\n features {\n name\n tier\n quota {\n type\n quota\n }\n usage {\n unit\n value\n }\n }\n prices {\n id\n currency\n interval\n intervalCount\n trialPeriodDays\n amount\n }\n }\n }\n`;\n\n@Injectable()\nexport class SubscriptionService {\n private apollo = inject(Apollo);\n\n getSubscription(\n organizationId: string,\n withDetails = false\n ): Observable {\n return this.apollo\n .query<{ subscription: SubscriptionPlan }>({\n query: withDetails ? GET_SUBSCRIPTION_DETAILS : GET_SUBSCRIPTION,\n variables: {\n organizationId: organizationId,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.subscription;\n })\n );\n }\n\n cancelSubscription(organizationId: string): Observable {\n return this.apollo\n .mutate<{ cancelSubscription: SubscriptionPlan }>({\n mutation: CANCEL_SUBSCRIPTION_MUTATION,\n variables: {\n organizationId: organizationId,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.cancelSubscription;\n })\n );\n }\n\n cancelSubscriptionDowngrade(\n organizationId: string\n ): Observable {\n return this.apollo\n .mutate<{ cancelSubscriptionDowngrade: SubscriptionPlan }>({\n mutation: CANCEL_SUBSCRIPTION_DOWNGRADE_MUTATION,\n variables: {\n organizationId: organizationId,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.cancelSubscriptionDowngrade;\n })\n );\n }\n\n unCancelSubscription(organizationId: string): Observable {\n return this.apollo\n .mutate<{ unCancelSubscription: SubscriptionPlan }>({\n mutation: UNCANCEL_SUBSCRIPTION_MUTATION,\n variables: {\n organizationId: organizationId,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.unCancelSubscription;\n })\n );\n }\n\n createSubscription(\n organizationId: string,\n options: ChangeSubscriptionOptions\n ): Observable {\n return this.apollo\n .mutate<{ createSubscription: SubscriptionPlan }>({\n mutation: CREATE_SUBSCRIPTION_MUTATION,\n variables: {\n organizationId: organizationId,\n options: options,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.createSubscription;\n })\n );\n }\n\n changeSubscription(\n organizationId: string,\n options: ChangeSubscriptionOptions\n ): Observable {\n // isTrial is not supported for change subscription requests\n delete options.isTrial;\n\n return this.apollo\n .mutate<{ changeSubscription: SubscriptionPlan }>({\n mutation: CHANGE_SUBSCRIPTION_MUTATION,\n variables: {\n organizationId: organizationId,\n options: options,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.changeSubscription;\n })\n );\n }\n\n getPlans(organizationId: string): Observable> {\n return this.apollo\n .query<{ plans: Plan[] }>({\n query: GET_PLANS,\n variables: {\n organizationId: organizationId,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return toIdentifiableEntities(data.data!.plans, 'id');\n })\n );\n }\n}\n","import { Component } from '@angular/core';\n\n@Component({\n imports: [],\n selector: 'app-dialog-update-subscription',\n templateUrl: './update-subscription.component.html',\n})\nexport class UpdateSubscriptionDialogComponent {}\n","
\n \n

Updating Subscription

\n

Please wait while we are updating your subscription

\n
\n","import { inject, Injectable } from '@angular/core';\nimport { TranslateService } from '@ngx-translate/core';\nimport {\n Action,\n createSelector,\n Selector,\n State,\n StateContext,\n Store,\n} from '@ngxs/store';\nimport { patch, updateItem } from '@ngxs/store/operators';\nimport { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog';\nimport { catchError, tap } from 'rxjs';\nimport { HasQuota } from 'src/app/helpers/quota';\nimport {\n Feature,\n Plan,\n SubscriptionPlan,\n} from 'src/app/models/subscription-plan';\nimport { UpdateSubscriptionDialogComponent } from 'src/app/pages/internal/settings/pages/subscription/dialogs/update-subscription/update-subscription.component';\nimport { ToastService } from 'src/app/services/toast/toast.service';\nimport { UserState } from 'src/app/store/user/user.state';\nimport { Entity, loadEntity, NewEntity, saveEntity } from '../common/entity';\nimport {\n ListEntities,\n loadEntities,\n NewListEntities,\n} from '../common/list-entity';\nimport {\n TrackSubscriptionCanceledEventAction,\n TrackSubscriptionChangedEventAction,\n TrackSubscriptionDowngradedCanceledEventAction,\n TrackSubscriptionUnCanceledEventAction,\n} from '../tracking/tracking.actions';\nimport {\n CancelSubscriptionAction,\n CancelSubscriptionDowngradeAction,\n ChangeSubscriptionAction,\n LoadAvailablePlansAction,\n LoadSubscriptionAction,\n UnCancelSubscriptionAction,\n UsageUpdatedAction,\n} from './subscription.actions';\nimport { SubscriptionService } from './subscription.service';\n\nexport interface SubscriptionStateModel {\n subscription: Entity;\n availablePlans: ListEntities;\n}\n\nexport type FeatureWithAvailability = Feature & {\n availability: FeatureAvailability;\n};\n\nexport enum FeatureAvailability {\n // Feature is not available at all\n NOT_AVAILABLE,\n // Feature is not available in the current plan\n NOT_AVAILABLE_IN_PLAN,\n // Feature is available, but the quota is exceeded\n QUOTA_EXCEEDED,\n // Feature is available and the quota is not exceeded\n AVAILABLE,\n}\n\n@State({\n name: 'subscription',\n defaults: {\n subscription: NewEntity(),\n availablePlans: NewListEntities(),\n },\n})\n@Injectable()\nexport class SubscriptionState {\n store = inject(Store);\n toast = inject(ToastService);\n subscriptionService = inject(SubscriptionService);\n dialogService = inject(DialogService);\n\n t = inject(TranslateService);\n\n @Selector()\n static subscription(state: SubscriptionStateModel) {\n return state.subscription;\n }\n\n @Selector()\n static canChangeSubscription(state: SubscriptionStateModel) {\n return state.subscription.data?.canChange;\n }\n\n @Selector()\n static availablePlans(state: SubscriptionStateModel) {\n return state.availablePlans;\n }\n\n static feature(featureName: string) {\n return createSelector(\n [SubscriptionState],\n (state: SubscriptionStateModel): FeatureWithAvailability | undefined => {\n if (state.subscription.isLoading) return;\n\n const feature = state.subscription.data?.plan.features.find(\n f => f.name === featureName\n );\n\n if (!feature) {\n return {\n id: '',\n tier: 0,\n name: featureName,\n availability: FeatureAvailability.NOT_AVAILABLE_IN_PLAN,\n };\n }\n\n let availability = FeatureAvailability.AVAILABLE;\n\n if (feature.quota) {\n if (feature.quota.quota === 0) {\n // Feature is not available in the current plan\n availability = FeatureAvailability.NOT_AVAILABLE_IN_PLAN;\n } else if (!HasQuota(feature)) {\n // Feature is available, but the quota is exceeded\n availability = FeatureAvailability.QUOTA_EXCEEDED;\n }\n }\n\n return {\n ...feature,\n availability: availability,\n };\n }\n );\n }\n\n @Action(UsageUpdatedAction)\n usageUpdated(\n ctx: StateContext,\n { featureName, newUsage }: UsageUpdatedAction\n ) {\n const currentState = ctx.getState();\n\n if (!currentState.subscription.data) {\n return;\n }\n\n return ctx.setState(\n patch({\n subscription: patch({\n data: patch({\n details: currentState.subscription.data.details\n ? patch({\n currentPlan: patch({\n plan: patch({\n features: updateItem(\n f => f.name === featureName,\n patch({ usage: newUsage })\n ),\n }),\n }),\n })\n : undefined,\n plan: patch({\n features: updateItem(\n f => f.name === featureName,\n patch({ usage: newUsage })\n ),\n }),\n }),\n }),\n })\n );\n }\n\n @Action(LoadSubscriptionAction)\n getSubscription(\n ctx: StateContext,\n { withDetails }: LoadSubscriptionAction\n ) {\n const organizationID = this.store.selectSnapshot(\n UserState.getCurrentOrganizationID\n );\n\n if (!organizationID) throw new Error('No organization ID set');\n\n return loadEntity(\n ctx,\n 'subscription',\n this.subscriptionService.getSubscription(organizationID, withDetails),\n true\n );\n }\n\n @Action(ChangeSubscriptionAction)\n changeSubscription(\n ctx: StateContext,\n { options, silently }: ChangeSubscriptionAction\n ) {\n const organizationID = this.store.selectSnapshot(\n UserState.getCurrentOrganizationID\n );\n\n if (!organizationID) throw new Error('No organization ID set');\n\n let ref: DynamicDialogRef;\n if (!silently) {\n ref = this.dialogService.open(UpdateSubscriptionDialogComponent, {\n closable: false,\n focusOnShow: false,\n modal: true,\n dismissableMask: true,\n });\n }\n\n const hasActiveSubscription =\n ctx.getState().subscription.data?.plan.name !== 'free';\n\n let observable;\n\n if (!hasActiveSubscription) {\n observable = this.subscriptionService.createSubscription(\n organizationID,\n options\n );\n } else {\n observable = this.subscriptionService.changeSubscription(\n organizationID,\n options\n );\n }\n\n return saveEntity(ctx, 'subscription', observable).pipe(\n tap(() => {\n ctx.dispatch(\n new TrackSubscriptionChangedEventAction(\n options.planName,\n options.priceId,\n options.isTrial,\n options.discountCodes\n )\n );\n ref?.close();\n }),\n catchError(err => {\n if (!silently) this.toast.showError(err);\n throw err;\n })\n );\n }\n\n @Action(CancelSubscriptionAction)\n cancelSubscription(ctx: StateContext) {\n const organizationID = this.store.selectSnapshot(\n UserState.getCurrentOrganizationID\n );\n\n if (!organizationID) throw new Error('No organization ID set');\n\n const ref = this.dialogService.open(UpdateSubscriptionDialogComponent, {\n closable: false,\n focusOnShow: false,\n modal: true,\n dismissableMask: true,\n });\n\n const currentSubscription = ctx.getState().subscription.data;\n\n return saveEntity(\n ctx,\n 'subscription',\n this.subscriptionService.cancelSubscription(organizationID)\n ).pipe(\n tap(() => {\n ref.close();\n\n ctx.dispatch(\n new TrackSubscriptionCanceledEventAction(\n currentSubscription?.plan.name ?? 'Unknown Plan'\n )\n );\n }),\n catchError(err => {\n ref.close();\n this.toast.showError(err);\n throw err;\n })\n );\n }\n\n @Action(CancelSubscriptionDowngradeAction)\n cancelSubscriptionDowngrade(ctx: StateContext) {\n const organizationID = this.store.selectSnapshot(\n UserState.getCurrentOrganizationID\n );\n\n if (!organizationID) throw new Error('No organization ID set');\n\n const currentSubscription = ctx.getState().subscription.data;\n\n const ref = this.dialogService.open(UpdateSubscriptionDialogComponent, {\n closable: false,\n focusOnShow: false,\n modal: true,\n dismissableMask: true,\n });\n\n return saveEntity(\n ctx,\n 'subscription',\n this.subscriptionService.cancelSubscriptionDowngrade(organizationID)\n ).pipe(\n tap(() => {\n ref.close();\n\n ctx.dispatch(\n new TrackSubscriptionDowngradedCanceledEventAction(\n currentSubscription?.plan.name ?? 'Unknown Plan'\n )\n );\n }),\n catchError(err => {\n ref.close();\n this.toast.showError(err);\n throw err;\n })\n );\n }\n\n @Action(UnCancelSubscriptionAction)\n unCancelSubscription(ctx: StateContext) {\n const organizationID = this.store.selectSnapshot(\n UserState.getCurrentOrganizationID\n );\n\n if (!organizationID) throw new Error('No organization ID set');\n\n const currentSubscription = ctx.getState().subscription.data;\n\n const ref = this.dialogService.open(UpdateSubscriptionDialogComponent, {\n closable: false,\n focusOnShow: false,\n modal: true,\n dismissableMask: true,\n });\n\n return saveEntity(\n ctx,\n 'subscription',\n this.subscriptionService.unCancelSubscription(organizationID)\n ).pipe(\n tap(() => {\n ref.close();\n\n ctx.dispatch(\n new TrackSubscriptionUnCanceledEventAction(\n currentSubscription?.plan.name ?? 'Unknown Plan'\n )\n );\n }),\n catchError(err => {\n ref.close();\n this.toast.showError(err);\n throw err;\n })\n );\n }\n\n @Action(LoadAvailablePlansAction)\n loadAvailablePlans(ctx: StateContext) {\n const organizationID = this.store.selectSnapshot(\n UserState.getCurrentOrganizationID\n );\n\n if (!organizationID) throw new Error('No organization ID set');\n\n return loadEntities(\n ctx,\n 'availablePlans',\n this.subscriptionService.getPlans(organizationID)\n );\n }\n}\n"],"names":["HasQuota","feature","quota","usage","value","FIELDS","DETAILS_FIELDS","CANCEL_SUBSCRIPTION_MUTATION","gql","UNCANCEL_SUBSCRIPTION_MUTATION","CANCEL_SUBSCRIPTION_DOWNGRADE_MUTATION","CHANGE_SUBSCRIPTION_MUTATION","CREATE_SUBSCRIPTION_MUTATION","GET_SUBSCRIPTION","GET_SUBSCRIPTION_DETAILS","GET_PLANS","SubscriptionService","constructor","apollo","inject","Apollo","getSubscription","organizationId","withDetails","query","variables","pipe","map","data","errors","Error","message","subscription","cancelSubscription","mutate","mutation","cancelSubscriptionDowngrade","unCancelSubscription","createSubscription","options","changeSubscription","isTrial","getPlans","toIdentifiableEntities","plans","factory","ɵfac","UpdateSubscriptionDialogComponent","selectors","decls","vars","consts","template","rf","ctx","ɵɵelementStart","ɵɵelement","ɵɵtext","ɵɵelementEnd","FeatureAvailability","SubscriptionState","constructor","store","inject","Store","toast","ToastService","subscriptionService","SubscriptionService","dialogService","DialogService","t","TranslateService","subscription","state","canChangeSubscription","data","canChange","availablePlans","feature","featureName","createSelector","SubscriptionState_1","isLoading","plan","features","find","f","name","id","tier","availability","NOT_AVAILABLE_IN_PLAN","AVAILABLE","quota","HasQuota","QUOTA_EXCEEDED","__spreadProps","__spreadValues","usageUpdated","ctx","newUsage","currentState","getState","setState","patch","details","currentPlan","updateItem","usage","undefined","getSubscription","withDetails","organizationID","selectSnapshot","UserState","getCurrentOrganizationID","Error","loadEntity","changeSubscription","options","silently","ref","open","UpdateSubscriptionDialogComponent","closable","focusOnShow","modal","dismissableMask","hasActiveSubscription","observable","createSubscription","saveEntity","pipe","tap","dispatch","TrackSubscriptionChangedEventAction","planName","priceId","isTrial","discountCodes","close","catchError","err","showError","cancelSubscription","currentSubscription","TrackSubscriptionCanceledEventAction","cancelSubscriptionDowngrade","TrackSubscriptionDowngradedCanceledEventAction","unCancelSubscription","TrackSubscriptionUnCanceledEventAction","loadAvailablePlans","loadEntities","getPlans","factory","ɵfac","__decorate","Action","UsageUpdatedAction","LoadSubscriptionAction","ChangeSubscriptionAction","CancelSubscriptionAction","CancelSubscriptionDowngradeAction","UnCancelSubscriptionAction","LoadAvailablePlansAction","Selector","State","defaults","NewEntity","NewListEntities"],"mappings":";;saAEO,IAAMA,GAAYC,GAClBA,EAAQC,MAITD,EAAQC,MAAMA,QAAU,EACnB,GAGJD,EAAQE,MAINF,EAAQC,MAAMA,MAAQD,EAAQE,MAAMC,MAHlC,GARA,GCOX,IAAMC,EAAS;;;;;;;;;;;;;;;;;;;;;EAuBTC,EAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwDjBC,GAA+BC;;;QAG7BH,CAAM;QACNC,CAAc;;;EAKhBG,GAAiCD;;;QAG/BH,CAAM;QACNC,CAAc;;;EAKhBI,GAAyCF;;;QAGvCH,CAAM;QACNC,CAAc;;;EAKhBK,GAA+BH;;;QAG7BH,CAAM;QACNC,CAAc;;;EAKhBM,GAA+BJ;;;QAG7BH,CAAM;QACNC,CAAc;;;EAKhBO,GAAmBL;;;QAGjBH,CAAM;;;EAKRS,GAA2BN;;;QAGzBH,CAAM;QACNC,CAAc;;;EAKhBS,GAAYP;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BLQ,IAAmB,IAAA,CAA1B,MAAOA,CAAmB,CADhCC,aAAA,CAEU,KAAAC,OAASC,EAAOC,CAAM,EAE9BC,gBACEC,EACAC,EAAc,GAAK,CAEnB,OAAO,KAAKL,OACTM,MAA0C,CACzCA,MAAOD,EAAcT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