@adtrackify/at-service-common 1.0.55 → 1.0.57
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/dist/index.d.ts +10 -0
- package/dist/index.js +5102 -14
- package/dist/index.js.map +4 -4
- package/package.json +7 -7
- package/src/helpers/index.ts +1 -0
- package/src/helpers/subscription-helper.ts +113 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adtrackify/at-service-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.57",
|
|
4
4
|
"description": "",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,10 +33,15 @@
|
|
|
33
33
|
"lambda-log": "^3.1.0",
|
|
34
34
|
"luxon": "^3.0.3",
|
|
35
35
|
"ua-parser-js": "^1.0.2",
|
|
36
|
+
"@types/axios": "^0.14.0",
|
|
37
|
+
"@types/lambda-log": "^2.2.1",
|
|
38
|
+
"@types/luxon": "^3.0.1",
|
|
39
|
+
"@types/ua-parser-js": "^0.7.36",
|
|
40
|
+
"@types/uuid": "^8.3.4",
|
|
36
41
|
"uuid": "^9.0.0"
|
|
37
42
|
},
|
|
38
43
|
"devDependencies": {
|
|
39
|
-
"@adtrackify/at-tracking-event-types": "^1.0.
|
|
44
|
+
"@adtrackify/at-tracking-event-types": "^1.0.37",
|
|
40
45
|
"@babel/cli": "^7.13.16",
|
|
41
46
|
"@babel/core": "^7.19.1",
|
|
42
47
|
"@babel/plugin-proposal-optional-chaining": "^7.13.8",
|
|
@@ -45,12 +50,7 @@
|
|
|
45
50
|
"@babel/preset-typescript": "^7.16.7",
|
|
46
51
|
"@babel/runtime-corejs3": "^7.19.1",
|
|
47
52
|
"@faker-js/faker": "^7.5.0",
|
|
48
|
-
"@types/axios": "^0.14.0",
|
|
49
|
-
"@types/lambda-log": "^2.2.1",
|
|
50
|
-
"@types/luxon": "^3.0.1",
|
|
51
53
|
"@types/node": "^17.0.8",
|
|
52
|
-
"@types/ua-parser-js": "^0.7.36",
|
|
53
|
-
"@types/uuid": "^8.3.4",
|
|
54
54
|
"@typescript-eslint/eslint-plugin": "^5.37.0",
|
|
55
55
|
"@typescript-eslint/parser": "^5.37.0",
|
|
56
56
|
"aws-sdk": "^2.1217.0",
|
package/src/helpers/index.ts
CHANGED
|
@@ -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
|
+
};
|