@adtrackify/at-service-common 1.0.54 → 1.0.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adtrackify/at-service-common",
3
- "version": "1.0.54",
3
+ "version": "1.0.56",
4
4
  "description": "",
5
5
  "module": "./dist/index.js",
6
6
  "main": "./dist/index.js",
@@ -36,7 +36,7 @@
36
36
  "uuid": "^9.0.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@adtrackify/at-tracking-event-types": "^1.0.35",
39
+ "@adtrackify/at-tracking-event-types": "^1.0.36",
40
40
  "@babel/cli": "^7.13.16",
41
41
  "@babel/core": "^7.19.1",
42
42
  "@babel/plugin-proposal-optional-chaining": "^7.13.8",
@@ -2,3 +2,4 @@ export * from './input-validation-helper';
2
2
  export * from './logging-helper';
3
3
  export * from './response-helper';
4
4
  export * from './shopify-helper';
5
+ export * from './subscription-helper';
@@ -0,0 +1,113 @@
1
+ import { SubscriptionPlan, PLAN_BILLING_FREQUENCY } from '@adtrackify/at-tracking-event-types';
2
+
3
+ export const StripeBillingMap: any = {
4
+ dev: {
5
+ 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',
6
+ 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
7
+ 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
8
+ 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',
9
+ 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',
10
+ 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',
11
+ 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'
12
+ },
13
+ qa: {
14
+ 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',
15
+ 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
16
+ 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
17
+ 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',
18
+ 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',
19
+ 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',
20
+ 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'
21
+ },
22
+ prod: {
23
+ 'free': 'price_1KAFsIK7krGh4037RsaAYMEl',
24
+ 'starter_monthly': 'price_1KAFsMK7krGh4037Lz3P0ksU',
25
+ 'starter_yearly': 'price_1KAFsMK7krGh4037Dj1WmSi8',
26
+ 'scale_monthly': 'price_1KAFrxK7krGh4037zWCdaTly',
27
+ 'scale_yearly': 'price_1KAFrxK7krGh40375fhymyWP',
28
+ 'growth_monthly': 'price_1KAFs7K7krGh4037JChjz5Cr',
29
+ 'growth_yearly': 'price_1KAFs7K7krGh4037rZElg12s'
30
+ }
31
+ };
32
+ export const SubscriptionPlanSeedItems: {
33
+ items: SubscriptionPlan[];
34
+ } = {
35
+ items: [ {
36
+ id: 1,
37
+ planName: 'free',
38
+ sku: 'ADT-001',
39
+ description: 'Free Plan - Monthly',
40
+ price: '0',
41
+ billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,
42
+ trialLengthDays: 30,
43
+ trialRequiresCreditCard: false
44
+ },
45
+ // STARTER PLANS
46
+ {
47
+ id: 2,
48
+ planName: 'starter_monthly',
49
+ sku: 'ADT-002',
50
+ description: 'Starter Plan - Monthly',
51
+ price: '9.99',
52
+ billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,
53
+ trialLengthDays: 30,
54
+ trialRequiresCreditCard: false
55
+ }, {
56
+ id: 3,
57
+ planName: 'starter_yearly',
58
+ sku: 'ADT-003',
59
+ description: 'Starter Plan - Yearly',
60
+ price: '96.00',
61
+ billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,
62
+ trialLengthDays: 30,
63
+ trialRequiresCreditCard: false
64
+ },
65
+ // SCALE PLANS
66
+ {
67
+ id: 4,
68
+ planName: 'scale_monthly',
69
+ sku: 'ADT-004',
70
+ description: 'Scale Plan - Monthly',
71
+ price: '59.99',
72
+ billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,
73
+ trialLengthDays: 30,
74
+ trialRequiresCreditCard: false
75
+ }, {
76
+ id: 5,
77
+ planName: 'scale_yearly',
78
+ sku: 'ADT-005',
79
+ description: 'Scale Plan - Yearly',
80
+ price: '588.00',
81
+ billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,
82
+ trialLengthDays: 30,
83
+ trialRequiresCreditCard: false
84
+ },
85
+ // GROWTH PLANS
86
+ {
87
+ id: 6,
88
+ planName: 'growth_monthly',
89
+ sku: 'ADT-006',
90
+ description: 'Growth Plan - Monthly',
91
+ price: '159.99',
92
+ billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,
93
+ trialLengthDays: 30,
94
+ trialRequiresCreditCard: false
95
+ }, {
96
+ id: 7,
97
+ planName: 'growth_yearly',
98
+ sku: 'ADT-007',
99
+ description: 'Growth Plan - Yearly',
100
+ price: '1596.00',
101
+ billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,
102
+ trialLengthDays: 30,
103
+ trialRequiresCreditCard: false
104
+ },
105
+ ]
106
+ };
107
+
108
+
109
+ export const getPlanDetails = (planId: number, stage: string) => {
110
+ const plan = SubscriptionPlanSeedItems.items.filter(x => x.id === planId)[ 0 ] as any;
111
+ plan.stripePriceId = StripeBillingMap[ stage ][ plan.planName ];
112
+ return plan as SubscriptionPlan;
113
+ };