@adtrackify/at-service-common 1.0.73 → 1.0.75
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/.editorconfig +12 -12
- package/.vscode/settings.json +9 -9
- package/bitbucket-pipelines.yml +20 -20
- package/build.js +21 -21
- package/dist/index.d.ts +9 -4
- package/dist/index.js +10 -1
- package/dist/index.js.map +2 -2
- package/jest.config.ts +40 -40
- package/package.json +1 -1
- package/src/__tests__/helpers/subscription-helper.spec.ts +40 -40
- package/src/clients/generic/axios.d.ts +7 -7
- package/src/clients/generic/dynamodb-client.ts +113 -113
- package/src/clients/generic/eventbridge-client.ts +52 -52
- package/src/clients/internal-api/destinations-client.ts +58 -58
- package/src/clients/internal-api/index.ts +4 -4
- package/src/clients/internal-api/shopify-app-install-client.ts +59 -59
- package/src/clients/internal-api/users-auth-client.ts +111 -111
- package/src/clients/third-party/shopify-client.ts +12 -1
- package/src/helpers/index.ts +5 -5
- package/src/helpers/input-validation-helper.ts +21 -21
- package/src/helpers/shopify-helper.ts +39 -39
- package/src/helpers/subscription-helper.ts +234 -234
- package/src/index.ts +4 -4
- package/src/libs/index.ts +7 -7
- package/src/libs/url.ts +9 -9
- package/src/services/eventbridge-integration-service.ts +44 -44
- package/src/types/internal-events/event-detail-types.ts +9 -9
- package/tsconfig.json +35 -35
|
@@ -1,235 +1,235 @@
|
|
|
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
|
-
displayName: 'Free',
|
|
39
|
-
sku: 'ADT-001',
|
|
40
|
-
description: 'Free Plan - Monthly',
|
|
41
|
-
price: '0',
|
|
42
|
-
displayPrice: '$0',
|
|
43
|
-
billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,
|
|
44
|
-
trialLengthDays: 30,
|
|
45
|
-
trialRequiresCreditCard: false,
|
|
46
|
-
planDesc: [
|
|
47
|
-
'Fixes IOS14.5 tracking',
|
|
48
|
-
'Multi Pixel Support',
|
|
49
|
-
'Enhanced Tracking / Attribution',
|
|
50
|
-
'Unlimited Facebook Conversion API',
|
|
51
|
-
'Unlimited Integrations',
|
|
52
|
-
'Easy no code setup',
|
|
53
|
-
'1,000 tracking events/mo'
|
|
54
|
-
],
|
|
55
|
-
unitPriceText: 'try now - free forever',
|
|
56
|
-
isHighlighted: false,
|
|
57
|
-
isBanner: false
|
|
58
|
-
},
|
|
59
|
-
// STARTER PLANS
|
|
60
|
-
{
|
|
61
|
-
id: 2,
|
|
62
|
-
planName: 'starter_monthly',
|
|
63
|
-
displayName: 'Starter',
|
|
64
|
-
sku: 'ADT-002',
|
|
65
|
-
description: 'Starter Plan - Monthly',
|
|
66
|
-
price: '9.99',
|
|
67
|
-
displayPrice: '$9.99',
|
|
68
|
-
billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,
|
|
69
|
-
trialLengthDays: 30,
|
|
70
|
-
trialRequiresCreditCard: false,
|
|
71
|
-
planDesc: [
|
|
72
|
-
'30-day Risk Free Trial',
|
|
73
|
-
'Fixes IOS14.5 tracking',
|
|
74
|
-
'Multi Pixel Support',
|
|
75
|
-
'Enhanced Tracking / Attribution',
|
|
76
|
-
'Unlimited Facebook Conversion API',
|
|
77
|
-
'Unlimited Integrations',
|
|
78
|
-
'Easy no code setup',
|
|
79
|
-
'2,500 tracking events/mo'
|
|
80
|
-
],
|
|
81
|
-
unitPriceText: '',
|
|
82
|
-
isHighlighted: false,
|
|
83
|
-
isBanner: false,
|
|
84
|
-
}, {
|
|
85
|
-
id: 3,
|
|
86
|
-
planName: 'starter_yearly',
|
|
87
|
-
displayName: 'Starter',
|
|
88
|
-
sku: 'ADT-003',
|
|
89
|
-
description: 'Starter Plan - Yearly',
|
|
90
|
-
price: '96.00',
|
|
91
|
-
displayPrice: '$8',
|
|
92
|
-
billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,
|
|
93
|
-
trialLengthDays: 30,
|
|
94
|
-
trialRequiresCreditCard: false,
|
|
95
|
-
planDesc: [
|
|
96
|
-
'30-day Risk Free Trial',
|
|
97
|
-
'Fixes IOS14.5 tracking',
|
|
98
|
-
'Multi Pixel Support',
|
|
99
|
-
'Enhanced Tracking / Attribution',
|
|
100
|
-
'Unlimited Facebook Conversion API',
|
|
101
|
-
'Unlimited Integrations',
|
|
102
|
-
'Easy no code setup',
|
|
103
|
-
'2,500 tracking events/mo'
|
|
104
|
-
],
|
|
105
|
-
unitPriceText: 'billed yearly ($96) - 20% savings',
|
|
106
|
-
isHighlighted: false,
|
|
107
|
-
isBanner: false
|
|
108
|
-
},
|
|
109
|
-
// SCALE PLANS
|
|
110
|
-
{
|
|
111
|
-
id: 4,
|
|
112
|
-
planName: 'scale_monthly',
|
|
113
|
-
displayName: 'Scale',
|
|
114
|
-
sku: 'ADT-004',
|
|
115
|
-
description: 'Scale Plan - Monthly',
|
|
116
|
-
price: '59.99',
|
|
117
|
-
displayPrice: '$59.99',
|
|
118
|
-
billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,
|
|
119
|
-
trialLengthDays: 30,
|
|
120
|
-
trialRequiresCreditCard: false,
|
|
121
|
-
planDesc: [
|
|
122
|
-
'30-day Risk Free Trial',
|
|
123
|
-
'Fixes IOS14.5 tracking',
|
|
124
|
-
'Multi Pixel Support',
|
|
125
|
-
'Enhanced Tracking / Attribution',
|
|
126
|
-
'Unlimited Facebook Conversion API',
|
|
127
|
-
'Unlimited Integrations',
|
|
128
|
-
'Easy no code setup',
|
|
129
|
-
'25,000 tracking events/mo'
|
|
130
|
-
],
|
|
131
|
-
unitPriceText: 'billed yearly ($96) - 20% savings',
|
|
132
|
-
isHighlighted: true,
|
|
133
|
-
isBanner: true,
|
|
134
|
-
bannerColor: 'blue',
|
|
135
|
-
bannerText: 'MOST POPULAR'
|
|
136
|
-
}, {
|
|
137
|
-
id: 5,
|
|
138
|
-
planName: 'scale_yearly',
|
|
139
|
-
displayName: 'Scale',
|
|
140
|
-
sku: 'ADT-005',
|
|
141
|
-
description: 'Scale Plan - Yearly',
|
|
142
|
-
price: '540.00',
|
|
143
|
-
displayPrice: '$45',
|
|
144
|
-
billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,
|
|
145
|
-
trialLengthDays: 30,
|
|
146
|
-
trialRequiresCreditCard: false,
|
|
147
|
-
planDesc: [
|
|
148
|
-
'30-day Risk Free Trial',
|
|
149
|
-
'Fixes IOS14.5 tracking',
|
|
150
|
-
'Multi Pixel Support',
|
|
151
|
-
'Enhanced Tracking / Attribution',
|
|
152
|
-
'Unlimited Facebook Conversion API',
|
|
153
|
-
'Unlimited Integrations',
|
|
154
|
-
'Easy no code setup',
|
|
155
|
-
'25,000 tracking events/mo'
|
|
156
|
-
],
|
|
157
|
-
unitPriceText: 'billed yearly ($540) - 25% savings',
|
|
158
|
-
isHighlighted: true,
|
|
159
|
-
isBanner: true,
|
|
160
|
-
bannerColor: 'blue',
|
|
161
|
-
bannerText: 'MOST POPULAR'
|
|
162
|
-
},
|
|
163
|
-
// GROWTH PLANS
|
|
164
|
-
{
|
|
165
|
-
id: 6,
|
|
166
|
-
planName: 'growth_monthly',
|
|
167
|
-
displayName: 'Growth',
|
|
168
|
-
sku: 'ADT-006',
|
|
169
|
-
description: 'Growth Plan - Monthly',
|
|
170
|
-
price: '159.99',
|
|
171
|
-
displayPrice: '$159.99',
|
|
172
|
-
billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,
|
|
173
|
-
trialLengthDays: 30,
|
|
174
|
-
trialRequiresCreditCard: false,
|
|
175
|
-
planDesc: [
|
|
176
|
-
'30-day Risk Free Trial',
|
|
177
|
-
'Fixes IOS14.5 tracking',
|
|
178
|
-
'Multi Pixel Support',
|
|
179
|
-
'Enhanced Tracking / Attribution',
|
|
180
|
-
'Unlimited Facebook Conversion API',
|
|
181
|
-
'Unlimited Integrations',
|
|
182
|
-
'Easy no code setup',
|
|
183
|
-
'100,000 tracking events/mo'
|
|
184
|
-
],
|
|
185
|
-
unitPriceText: 'billed yearly ($540) - 25% savings',
|
|
186
|
-
isHighlighted: false,
|
|
187
|
-
isBanner: true,
|
|
188
|
-
bannerColor: 'orange',
|
|
189
|
-
bannerText: 'BEST VALUE'
|
|
190
|
-
}, {
|
|
191
|
-
id: 7,
|
|
192
|
-
planName: 'growth_yearly',
|
|
193
|
-
displayName: 'Growth',
|
|
194
|
-
sku: 'ADT-007',
|
|
195
|
-
description: 'Growth Plan - Yearly',
|
|
196
|
-
price: '1344.00',
|
|
197
|
-
displayPrice: '$112',
|
|
198
|
-
billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,
|
|
199
|
-
trialLengthDays: 30,
|
|
200
|
-
trialRequiresCreditCard: false,
|
|
201
|
-
planDesc: [
|
|
202
|
-
'30-day Risk Free Trial',
|
|
203
|
-
'Fixes IOS14.5 tracking',
|
|
204
|
-
'Multi Pixel Support',
|
|
205
|
-
'Enhanced Tracking / Attribution',
|
|
206
|
-
'Unlimited Facebook Conversion API',
|
|
207
|
-
'Unlimited Integrations',
|
|
208
|
-
'Easy no code setup',
|
|
209
|
-
'100,000 tracking events/mo'
|
|
210
|
-
],
|
|
211
|
-
unitPriceText: 'billed yearly ($1344) - 30% savings',
|
|
212
|
-
isHighlighted: false,
|
|
213
|
-
isBanner: true,
|
|
214
|
-
bannerColor: 'orange',
|
|
215
|
-
bannerText: 'BEST VALUE'
|
|
216
|
-
},
|
|
217
|
-
]
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
export const getPlanDetails = (planId: number, stage: string) => {
|
|
222
|
-
const plan = SubscriptionPlanSeedItems.items.filter(x => x.id === planId)[ 0 ] as any;
|
|
223
|
-
plan.stripePriceId = StripeBillingMap[ stage ][ plan.planName ];
|
|
224
|
-
return plan as SubscriptionPlan;
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
export const getPlanByStripePriceId = (stripePriceId: string, stage: string) => {
|
|
228
|
-
const stripePriceIds = StripeBillingMap[stage];
|
|
229
|
-
const planName = Object.keys(stripePriceIds).find(key => stripePriceIds[key] === stripePriceId);
|
|
230
|
-
|
|
231
|
-
const plan = SubscriptionPlanSeedItems.items.filter(x => x.planName === planName)[0] as any;
|
|
232
|
-
plan.stripePriceId = stripePriceId;
|
|
233
|
-
|
|
234
|
-
return plan as SubscriptionPlan;
|
|
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
|
+
displayName: 'Free',
|
|
39
|
+
sku: 'ADT-001',
|
|
40
|
+
description: 'Free Plan - Monthly',
|
|
41
|
+
price: '0',
|
|
42
|
+
displayPrice: '$0',
|
|
43
|
+
billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,
|
|
44
|
+
trialLengthDays: 30,
|
|
45
|
+
trialRequiresCreditCard: false,
|
|
46
|
+
planDesc: [
|
|
47
|
+
'Fixes IOS14.5 tracking',
|
|
48
|
+
'Multi Pixel Support',
|
|
49
|
+
'Enhanced Tracking / Attribution',
|
|
50
|
+
'Unlimited Facebook Conversion API',
|
|
51
|
+
'Unlimited Integrations',
|
|
52
|
+
'Easy no code setup',
|
|
53
|
+
'1,000 tracking events/mo'
|
|
54
|
+
],
|
|
55
|
+
unitPriceText: 'try now - free forever',
|
|
56
|
+
isHighlighted: false,
|
|
57
|
+
isBanner: false
|
|
58
|
+
},
|
|
59
|
+
// STARTER PLANS
|
|
60
|
+
{
|
|
61
|
+
id: 2,
|
|
62
|
+
planName: 'starter_monthly',
|
|
63
|
+
displayName: 'Starter',
|
|
64
|
+
sku: 'ADT-002',
|
|
65
|
+
description: 'Starter Plan - Monthly',
|
|
66
|
+
price: '9.99',
|
|
67
|
+
displayPrice: '$9.99',
|
|
68
|
+
billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,
|
|
69
|
+
trialLengthDays: 30,
|
|
70
|
+
trialRequiresCreditCard: false,
|
|
71
|
+
planDesc: [
|
|
72
|
+
'30-day Risk Free Trial',
|
|
73
|
+
'Fixes IOS14.5 tracking',
|
|
74
|
+
'Multi Pixel Support',
|
|
75
|
+
'Enhanced Tracking / Attribution',
|
|
76
|
+
'Unlimited Facebook Conversion API',
|
|
77
|
+
'Unlimited Integrations',
|
|
78
|
+
'Easy no code setup',
|
|
79
|
+
'2,500 tracking events/mo'
|
|
80
|
+
],
|
|
81
|
+
unitPriceText: '',
|
|
82
|
+
isHighlighted: false,
|
|
83
|
+
isBanner: false,
|
|
84
|
+
}, {
|
|
85
|
+
id: 3,
|
|
86
|
+
planName: 'starter_yearly',
|
|
87
|
+
displayName: 'Starter',
|
|
88
|
+
sku: 'ADT-003',
|
|
89
|
+
description: 'Starter Plan - Yearly',
|
|
90
|
+
price: '96.00',
|
|
91
|
+
displayPrice: '$8',
|
|
92
|
+
billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,
|
|
93
|
+
trialLengthDays: 30,
|
|
94
|
+
trialRequiresCreditCard: false,
|
|
95
|
+
planDesc: [
|
|
96
|
+
'30-day Risk Free Trial',
|
|
97
|
+
'Fixes IOS14.5 tracking',
|
|
98
|
+
'Multi Pixel Support',
|
|
99
|
+
'Enhanced Tracking / Attribution',
|
|
100
|
+
'Unlimited Facebook Conversion API',
|
|
101
|
+
'Unlimited Integrations',
|
|
102
|
+
'Easy no code setup',
|
|
103
|
+
'2,500 tracking events/mo'
|
|
104
|
+
],
|
|
105
|
+
unitPriceText: 'billed yearly ($96) - 20% savings',
|
|
106
|
+
isHighlighted: false,
|
|
107
|
+
isBanner: false
|
|
108
|
+
},
|
|
109
|
+
// SCALE PLANS
|
|
110
|
+
{
|
|
111
|
+
id: 4,
|
|
112
|
+
planName: 'scale_monthly',
|
|
113
|
+
displayName: 'Scale',
|
|
114
|
+
sku: 'ADT-004',
|
|
115
|
+
description: 'Scale Plan - Monthly',
|
|
116
|
+
price: '59.99',
|
|
117
|
+
displayPrice: '$59.99',
|
|
118
|
+
billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,
|
|
119
|
+
trialLengthDays: 30,
|
|
120
|
+
trialRequiresCreditCard: false,
|
|
121
|
+
planDesc: [
|
|
122
|
+
'30-day Risk Free Trial',
|
|
123
|
+
'Fixes IOS14.5 tracking',
|
|
124
|
+
'Multi Pixel Support',
|
|
125
|
+
'Enhanced Tracking / Attribution',
|
|
126
|
+
'Unlimited Facebook Conversion API',
|
|
127
|
+
'Unlimited Integrations',
|
|
128
|
+
'Easy no code setup',
|
|
129
|
+
'25,000 tracking events/mo'
|
|
130
|
+
],
|
|
131
|
+
unitPriceText: 'billed yearly ($96) - 20% savings',
|
|
132
|
+
isHighlighted: true,
|
|
133
|
+
isBanner: true,
|
|
134
|
+
bannerColor: 'blue',
|
|
135
|
+
bannerText: 'MOST POPULAR'
|
|
136
|
+
}, {
|
|
137
|
+
id: 5,
|
|
138
|
+
planName: 'scale_yearly',
|
|
139
|
+
displayName: 'Scale',
|
|
140
|
+
sku: 'ADT-005',
|
|
141
|
+
description: 'Scale Plan - Yearly',
|
|
142
|
+
price: '540.00',
|
|
143
|
+
displayPrice: '$45',
|
|
144
|
+
billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,
|
|
145
|
+
trialLengthDays: 30,
|
|
146
|
+
trialRequiresCreditCard: false,
|
|
147
|
+
planDesc: [
|
|
148
|
+
'30-day Risk Free Trial',
|
|
149
|
+
'Fixes IOS14.5 tracking',
|
|
150
|
+
'Multi Pixel Support',
|
|
151
|
+
'Enhanced Tracking / Attribution',
|
|
152
|
+
'Unlimited Facebook Conversion API',
|
|
153
|
+
'Unlimited Integrations',
|
|
154
|
+
'Easy no code setup',
|
|
155
|
+
'25,000 tracking events/mo'
|
|
156
|
+
],
|
|
157
|
+
unitPriceText: 'billed yearly ($540) - 25% savings',
|
|
158
|
+
isHighlighted: true,
|
|
159
|
+
isBanner: true,
|
|
160
|
+
bannerColor: 'blue',
|
|
161
|
+
bannerText: 'MOST POPULAR'
|
|
162
|
+
},
|
|
163
|
+
// GROWTH PLANS
|
|
164
|
+
{
|
|
165
|
+
id: 6,
|
|
166
|
+
planName: 'growth_monthly',
|
|
167
|
+
displayName: 'Growth',
|
|
168
|
+
sku: 'ADT-006',
|
|
169
|
+
description: 'Growth Plan - Monthly',
|
|
170
|
+
price: '159.99',
|
|
171
|
+
displayPrice: '$159.99',
|
|
172
|
+
billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,
|
|
173
|
+
trialLengthDays: 30,
|
|
174
|
+
trialRequiresCreditCard: false,
|
|
175
|
+
planDesc: [
|
|
176
|
+
'30-day Risk Free Trial',
|
|
177
|
+
'Fixes IOS14.5 tracking',
|
|
178
|
+
'Multi Pixel Support',
|
|
179
|
+
'Enhanced Tracking / Attribution',
|
|
180
|
+
'Unlimited Facebook Conversion API',
|
|
181
|
+
'Unlimited Integrations',
|
|
182
|
+
'Easy no code setup',
|
|
183
|
+
'100,000 tracking events/mo'
|
|
184
|
+
],
|
|
185
|
+
unitPriceText: 'billed yearly ($540) - 25% savings',
|
|
186
|
+
isHighlighted: false,
|
|
187
|
+
isBanner: true,
|
|
188
|
+
bannerColor: 'orange',
|
|
189
|
+
bannerText: 'BEST VALUE'
|
|
190
|
+
}, {
|
|
191
|
+
id: 7,
|
|
192
|
+
planName: 'growth_yearly',
|
|
193
|
+
displayName: 'Growth',
|
|
194
|
+
sku: 'ADT-007',
|
|
195
|
+
description: 'Growth Plan - Yearly',
|
|
196
|
+
price: '1344.00',
|
|
197
|
+
displayPrice: '$112',
|
|
198
|
+
billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,
|
|
199
|
+
trialLengthDays: 30,
|
|
200
|
+
trialRequiresCreditCard: false,
|
|
201
|
+
planDesc: [
|
|
202
|
+
'30-day Risk Free Trial',
|
|
203
|
+
'Fixes IOS14.5 tracking',
|
|
204
|
+
'Multi Pixel Support',
|
|
205
|
+
'Enhanced Tracking / Attribution',
|
|
206
|
+
'Unlimited Facebook Conversion API',
|
|
207
|
+
'Unlimited Integrations',
|
|
208
|
+
'Easy no code setup',
|
|
209
|
+
'100,000 tracking events/mo'
|
|
210
|
+
],
|
|
211
|
+
unitPriceText: 'billed yearly ($1344) - 30% savings',
|
|
212
|
+
isHighlighted: false,
|
|
213
|
+
isBanner: true,
|
|
214
|
+
bannerColor: 'orange',
|
|
215
|
+
bannerText: 'BEST VALUE'
|
|
216
|
+
},
|
|
217
|
+
]
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
export const getPlanDetails = (planId: number, stage: string) => {
|
|
222
|
+
const plan = SubscriptionPlanSeedItems.items.filter(x => x.id === planId)[ 0 ] as any;
|
|
223
|
+
plan.stripePriceId = StripeBillingMap[ stage ][ plan.planName ];
|
|
224
|
+
return plan as SubscriptionPlan;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
export const getPlanByStripePriceId = (stripePriceId: string, stage: string) => {
|
|
228
|
+
const stripePriceIds = StripeBillingMap[stage];
|
|
229
|
+
const planName = Object.keys(stripePriceIds).find(key => stripePriceIds[key] === stripePriceId);
|
|
230
|
+
|
|
231
|
+
const plan = SubscriptionPlanSeedItems.items.filter(x => x.planName === planName)[0] as any;
|
|
232
|
+
plan.stripePriceId = stripePriceId;
|
|
233
|
+
|
|
234
|
+
return plan as SubscriptionPlan;
|
|
235
235
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './clients';
|
|
2
|
-
export * from './helpers';
|
|
3
|
-
export * from './libs';
|
|
4
|
-
export * from './types';
|
|
1
|
+
export * from './clients';
|
|
2
|
+
export * from './helpers';
|
|
3
|
+
export * from './libs';
|
|
4
|
+
export * from './types';
|
|
5
5
|
export * from './services';
|
package/src/libs/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from '../helpers/shopify-helper';
|
|
2
|
-
export * from './crypto';
|
|
3
|
-
export * from './dates';
|
|
4
|
-
export * from './http-error';
|
|
5
|
-
export * from './http-status-codes';
|
|
6
|
-
export * from './url';
|
|
7
|
-
|
|
1
|
+
export * from '../helpers/shopify-helper';
|
|
2
|
+
export * from './crypto';
|
|
3
|
+
export * from './dates';
|
|
4
|
+
export * from './http-error';
|
|
5
|
+
export * from './http-status-codes';
|
|
6
|
+
export * from './url';
|
|
7
|
+
|
package/src/libs/url.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// Record<string, string> is any object
|
|
2
|
-
export const mapObjectToQueryString = (inputObj: any): string => {
|
|
3
|
-
const qsp = Object.entries(inputObj).sort((a, b) => a[ 0 ] < b[ 0 ] ? -1 : 1);
|
|
4
|
-
const urlParams = new URLSearchParams();
|
|
5
|
-
qsp.map(p => {
|
|
6
|
-
urlParams.append(p[ 0 ], p[ 1 ] as string);
|
|
7
|
-
});
|
|
8
|
-
const qs = urlParams.toString();
|
|
9
|
-
return qs;
|
|
1
|
+
// Record<string, string> is any object
|
|
2
|
+
export const mapObjectToQueryString = (inputObj: any): string => {
|
|
3
|
+
const qsp = Object.entries(inputObj).sort((a, b) => a[ 0 ] < b[ 0 ] ? -1 : 1);
|
|
4
|
+
const urlParams = new URLSearchParams();
|
|
5
|
+
qsp.map(p => {
|
|
6
|
+
urlParams.append(p[ 0 ], p[ 1 ] as string);
|
|
7
|
+
});
|
|
8
|
+
const qs = urlParams.toString();
|
|
9
|
+
return qs;
|
|
10
10
|
};
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { EventBridgeClient } from '../clients';
|
|
2
|
-
import { Message, TemplatedMessage } from 'postmark';
|
|
3
|
-
|
|
4
|
-
export const enum PostmarkRequestType {
|
|
5
|
-
SINGLE_EMAIL = 'single_email',
|
|
6
|
-
TEMPLATE_EMAIL = 'template_email'
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export enum ADTRACKIFY_EVENT_BRIDGE_EVENTS {
|
|
10
|
-
SEND_POSTMARK_EMAIL = 'integration.sendPostmarkEmail',
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class EventBridgeIntegrationService {
|
|
14
|
-
public eventBridgeClient: EventBridgeClient;
|
|
15
|
-
public EVENT_BUS_NAME: string;
|
|
16
|
-
|
|
17
|
-
constructor (eventBusName: string) {
|
|
18
|
-
this.eventBridgeClient = new EventBridgeClient(eventBusName);
|
|
19
|
-
this.EVENT_BUS_NAME = eventBusName;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
public sendPostmarkEmailEvent = async (eventSource: string, postmarkMessage: Message, postmarkServerToken: string) => {
|
|
23
|
-
return await this.eventBridgeClient.buildAndSendEvent(
|
|
24
|
-
eventSource,
|
|
25
|
-
ADTRACKIFY_EVENT_BRIDGE_EVENTS.SEND_POSTMARK_EMAIL,
|
|
26
|
-
{
|
|
27
|
-
postmarkMessage,
|
|
28
|
-
postmarkRequestType: PostmarkRequestType.SINGLE_EMAIL,
|
|
29
|
-
postmarkServerToken
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
public sendPostmarkTemplatedEmailEvent = async (eventSource: string, postmarkMessage: TemplatedMessage, postmarkServerToken: string) => {
|
|
34
|
-
return await this.eventBridgeClient.buildAndSendEvent(
|
|
35
|
-
eventSource,
|
|
36
|
-
ADTRACKIFY_EVENT_BRIDGE_EVENTS.SEND_POSTMARK_EMAIL,
|
|
37
|
-
{
|
|
38
|
-
postmarkMessage,
|
|
39
|
-
postmarkRequestType: PostmarkRequestType.TEMPLATE_EMAIL,
|
|
40
|
-
postmarkServerToken
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
}
|
|
1
|
+
import { EventBridgeClient } from '../clients';
|
|
2
|
+
import { Message, TemplatedMessage } from 'postmark';
|
|
3
|
+
|
|
4
|
+
export const enum PostmarkRequestType {
|
|
5
|
+
SINGLE_EMAIL = 'single_email',
|
|
6
|
+
TEMPLATE_EMAIL = 'template_email'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export enum ADTRACKIFY_EVENT_BRIDGE_EVENTS {
|
|
10
|
+
SEND_POSTMARK_EMAIL = 'integration.sendPostmarkEmail',
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class EventBridgeIntegrationService {
|
|
14
|
+
public eventBridgeClient: EventBridgeClient;
|
|
15
|
+
public EVENT_BUS_NAME: string;
|
|
16
|
+
|
|
17
|
+
constructor (eventBusName: string) {
|
|
18
|
+
this.eventBridgeClient = new EventBridgeClient(eventBusName);
|
|
19
|
+
this.EVENT_BUS_NAME = eventBusName;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public sendPostmarkEmailEvent = async (eventSource: string, postmarkMessage: Message, postmarkServerToken: string) => {
|
|
23
|
+
return await this.eventBridgeClient.buildAndSendEvent(
|
|
24
|
+
eventSource,
|
|
25
|
+
ADTRACKIFY_EVENT_BRIDGE_EVENTS.SEND_POSTMARK_EMAIL,
|
|
26
|
+
{
|
|
27
|
+
postmarkMessage,
|
|
28
|
+
postmarkRequestType: PostmarkRequestType.SINGLE_EMAIL,
|
|
29
|
+
postmarkServerToken
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
public sendPostmarkTemplatedEmailEvent = async (eventSource: string, postmarkMessage: TemplatedMessage, postmarkServerToken: string) => {
|
|
34
|
+
return await this.eventBridgeClient.buildAndSendEvent(
|
|
35
|
+
eventSource,
|
|
36
|
+
ADTRACKIFY_EVENT_BRIDGE_EVENTS.SEND_POSTMARK_EMAIL,
|
|
37
|
+
{
|
|
38
|
+
postmarkMessage,
|
|
39
|
+
postmarkRequestType: PostmarkRequestType.TEMPLATE_EMAIL,
|
|
40
|
+
postmarkServerToken
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export enum ADTRACKIFY_EVENT_TYPES {
|
|
2
|
-
NOTIFY_SHOPIFY_SUBSCRIPTION_CREATED = 'shopifySubscriptionCreated',
|
|
3
|
-
NOTIFY_SUBSCRIPTION_SIGNUP_COMPLETED = 'subscription.signupCompleted',
|
|
4
|
-
REQUEST_SET_ACCOUNT_OWNER = 'setAccountOwner',
|
|
5
|
-
REQUEST_SET_ACCOUNT_SUBSCRIPTION_ID = 'setAccountSubscriptionId',
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export enum ADTRACKIFY_EVENT_SOURCES {
|
|
9
|
-
SUBSCRIPTIONS = 'subscriptions',
|
|
1
|
+
export enum ADTRACKIFY_EVENT_TYPES {
|
|
2
|
+
NOTIFY_SHOPIFY_SUBSCRIPTION_CREATED = 'shopifySubscriptionCreated',
|
|
3
|
+
NOTIFY_SUBSCRIPTION_SIGNUP_COMPLETED = 'subscription.signupCompleted',
|
|
4
|
+
REQUEST_SET_ACCOUNT_OWNER = 'setAccountOwner',
|
|
5
|
+
REQUEST_SET_ACCOUNT_SUBSCRIPTION_ID = 'setAccountSubscriptionId',
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export enum ADTRACKIFY_EVENT_SOURCES {
|
|
9
|
+
SUBSCRIPTIONS = 'subscriptions',
|
|
10
10
|
}
|