@adtrackify/at-service-common 1.1.18 → 1.1.20
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/.eslintignore +3 -0
- package/.vscode/settings.json +9 -9
- package/build.js +27 -10
- package/dist/index.d.ts +57 -54
- package/dist/index.esm.js +1335 -0
- package/dist/index.esm.js.map +7 -0
- package/dist/index.js +357 -234
- package/dist/index.js.map +4 -4
- package/jest.config.ts +40 -40
- package/package.json +27 -27
- package/src/__tests__/helpers/subscription-helper.spec.ts +1 -1
- package/src/clients/generic/axios.d.ts +7 -7
- package/src/clients/generic/cognito-client.ts +37 -36
- package/src/clients/generic/eventbridge-client.ts +1 -1
- package/src/clients/generic/http-client.ts +2 -3
- package/src/clients/generic/index.ts +5 -5
- package/src/clients/generic/s3-client.ts +5 -9
- package/src/clients/index.ts +3 -3
- package/src/clients/internal-api/accounts-client.ts +2 -2
- package/src/clients/internal-api/destinations-client.ts +2 -2
- package/src/clients/internal-api/index.ts +4 -4
- package/src/clients/internal-api/shopify-app-install-client.ts +4 -4
- package/src/clients/internal-api/users-auth-client.ts +4 -3
- package/src/clients/third-party/index.ts +1 -1
- package/src/clients/third-party/shopify-client.ts +1 -1
- package/src/helpers/index.ts +5 -5
- package/src/helpers/input-validation-helper.ts +1 -1
- package/src/helpers/shopify-helper.ts +2 -2
- package/src/index.ts +5 -5
- package/src/libs/index.ts +6 -6
- package/src/libs/url.ts +9 -9
- package/src/services/eventbridge-integration-service.ts +1 -1
- package/src/services/index.ts +1 -1
- package/src/types/index.ts +1 -1
- package/src/types/internal-events/event-detail-types.ts +9 -9
- package/src/types/internal-events/index.ts +1 -1
- package/tsconfig.json +2 -3
package/dist/index.js
CHANGED
|
@@ -1,14 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
1
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
2
8
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
3
30
|
var __publicField = (obj, key, value) => {
|
|
4
31
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
32
|
return value;
|
|
6
33
|
};
|
|
7
34
|
|
|
35
|
+
// src/index.ts
|
|
36
|
+
var src_exports = {};
|
|
37
|
+
__export(src_exports, {
|
|
38
|
+
ADTRACKIFY_EVENT_BRIDGE_EVENTS: () => ADTRACKIFY_EVENT_BRIDGE_EVENTS,
|
|
39
|
+
ADTRACKIFY_EVENT_SOURCES: () => ADTRACKIFY_EVENT_SOURCES,
|
|
40
|
+
ADTRACKIFY_EVENT_TYPES: () => ADTRACKIFY_EVENT_TYPES,
|
|
41
|
+
AccountsClient: () => AccountsClient,
|
|
42
|
+
CognitoClient: () => CognitoClient,
|
|
43
|
+
CommonPlanInfo: () => CommonPlanInfo,
|
|
44
|
+
DestinationsClient: () => DestinationsClient,
|
|
45
|
+
DynamoDbClient: () => DynamoDbClient,
|
|
46
|
+
EventBridgeClient: () => EventBridgeClient,
|
|
47
|
+
EventBridgeIntegrationService: () => EventBridgeIntegrationService,
|
|
48
|
+
HttpError: () => HttpError,
|
|
49
|
+
HttpStatusCodes: () => HttpStatusCodes,
|
|
50
|
+
PostmarkRequestType: () => PostmarkRequestType,
|
|
51
|
+
S3Client: () => S3Client,
|
|
52
|
+
ShopifyAppInstallClient: () => ShopifyAppInstallClient,
|
|
53
|
+
ShopifyClient: () => ShopifyClient,
|
|
54
|
+
StripeBillingMap: () => StripeBillingMap,
|
|
55
|
+
SubscriptionPlanSeedItems: () => SubscriptionPlanSeedItems,
|
|
56
|
+
UsersAuthClient: () => UsersAuthClient,
|
|
57
|
+
axiosHttpService: () => axiosHttpService,
|
|
58
|
+
buildResponse: () => buildResponse,
|
|
59
|
+
configureLogger: () => configureLogger,
|
|
60
|
+
dictToAwsAttributes: () => dictToAwsAttributes,
|
|
61
|
+
failure: () => failure,
|
|
62
|
+
generatePublicKey: () => generatePublicKey,
|
|
63
|
+
getCurrentDate: () => getCurrentDate,
|
|
64
|
+
getCurrentTimestamp: () => getCurrentTimestamp,
|
|
65
|
+
getDateFromTimestamp: () => getDateFromTimestamp,
|
|
66
|
+
getPlanByStripePriceId: () => getPlanByStripePriceId,
|
|
67
|
+
getPlanDetails: () => getPlanDetails,
|
|
68
|
+
isShopifyRequestValid: () => isShopifyRequestValid,
|
|
69
|
+
mapObjectToQueryString: () => mapObjectToQueryString,
|
|
70
|
+
success: () => success,
|
|
71
|
+
validateInput: () => validateInput,
|
|
72
|
+
validateShopifyRequest: () => validateShopifyRequest
|
|
73
|
+
});
|
|
74
|
+
module.exports = __toCommonJS(src_exports);
|
|
75
|
+
|
|
8
76
|
// src/clients/generic/dynamodb-client.ts
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
77
|
+
var import_client_dynamodb = require("@aws-sdk/client-dynamodb");
|
|
78
|
+
var import_lib_dynamodb = require("@aws-sdk/lib-dynamodb");
|
|
79
|
+
var log = __toESM(require("lambda-log"), 1);
|
|
12
80
|
var marshallOptions = {
|
|
13
81
|
convertEmptyValues: false,
|
|
14
82
|
removeUndefinedValues: false,
|
|
@@ -18,8 +86,8 @@ var unmarshallOptions = {
|
|
|
18
86
|
wrapNumbers: false
|
|
19
87
|
};
|
|
20
88
|
var translateConfig = { marshallOptions, unmarshallOptions };
|
|
21
|
-
var ddbClient = new DynamoDBClient({});
|
|
22
|
-
var client = DynamoDBDocument.from(ddbClient, translateConfig);
|
|
89
|
+
var ddbClient = new import_client_dynamodb.DynamoDBClient({});
|
|
90
|
+
var client = import_lib_dynamodb.DynamoDBDocument.from(ddbClient, translateConfig);
|
|
23
91
|
var _DynamoDbClient = class {
|
|
24
92
|
};
|
|
25
93
|
var DynamoDbClient = _DynamoDbClient;
|
|
@@ -126,13 +194,13 @@ __publicField(DynamoDbClient, "update", (params) => client.update(params));
|
|
|
126
194
|
__publicField(DynamoDbClient, "delete", (params) => client.delete(params));
|
|
127
195
|
|
|
128
196
|
// src/clients/generic/eventbridge-client.ts
|
|
129
|
-
|
|
130
|
-
|
|
197
|
+
var import_client_eventbridge = require("@aws-sdk/client-eventbridge");
|
|
198
|
+
var import_uuid = require("uuid");
|
|
131
199
|
|
|
132
200
|
// src/libs/dates.ts
|
|
133
|
-
|
|
201
|
+
var import_luxon = require("luxon");
|
|
134
202
|
var getCurrentTimestamp = () => {
|
|
135
|
-
return DateTime.utc().toJSDate().toISOString();
|
|
203
|
+
return import_luxon.DateTime.utc().toJSDate().toISOString();
|
|
136
204
|
};
|
|
137
205
|
var getDateFromTimestamp = (timestamp) => {
|
|
138
206
|
return timestamp.split("T")[0];
|
|
@@ -142,19 +210,19 @@ var getCurrentDate = () => {
|
|
|
142
210
|
};
|
|
143
211
|
|
|
144
212
|
// src/clients/generic/eventbridge-client.ts
|
|
145
|
-
|
|
213
|
+
var log2 = __toESM(require("lambda-log"), 1);
|
|
146
214
|
var EventBridgeClient = class {
|
|
147
215
|
eventBridge;
|
|
148
216
|
EVENT_BUS_NAME;
|
|
149
217
|
constructor(eventBusName) {
|
|
150
|
-
this.eventBridge = new
|
|
218
|
+
this.eventBridge = new import_client_eventbridge.EventBridgeClient({});
|
|
151
219
|
this.EVENT_BUS_NAME = eventBusName;
|
|
152
220
|
}
|
|
153
221
|
buildAndSendEvent = async (eventSource, eventType, eventData) => {
|
|
154
222
|
const event = this.buildEvent(eventType, eventData);
|
|
155
223
|
return await this.putEvent(eventSource, eventType, event);
|
|
156
224
|
};
|
|
157
|
-
buildEvent = (eventType, eventData, eventId =
|
|
225
|
+
buildEvent = (eventType, eventData, eventId = (0, import_uuid.v4)(), eventTime = getCurrentTimestamp()) => {
|
|
158
226
|
return {
|
|
159
227
|
eventId,
|
|
160
228
|
eventType,
|
|
@@ -169,10 +237,10 @@ var EventBridgeClient = class {
|
|
|
169
237
|
DetailType: detailType,
|
|
170
238
|
EventBusName: this.EVENT_BUS_NAME,
|
|
171
239
|
Source: source,
|
|
172
|
-
Time: new Date()
|
|
240
|
+
Time: /* @__PURE__ */ new Date()
|
|
173
241
|
}]
|
|
174
242
|
};
|
|
175
|
-
const putEventscommand = new PutEventsCommand(params);
|
|
243
|
+
const putEventscommand = new import_client_eventbridge.PutEventsCommand(params);
|
|
176
244
|
const response = await this.eventBridge.send(putEventscommand);
|
|
177
245
|
log2.debug(
|
|
178
246
|
"EventBus Event Published",
|
|
@@ -189,10 +257,9 @@ var EventBridgeClient = class {
|
|
|
189
257
|
};
|
|
190
258
|
|
|
191
259
|
// src/clients/generic/http-client.ts
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
import httpAdapter from "axios/lib/adapters/http";
|
|
260
|
+
var import_axios = __toESM(require("axios"), 1);
|
|
261
|
+
var import_https = __toESM(require("https"), 1);
|
|
262
|
+
var import_http = __toESM(require("axios/lib/adapters/http"), 1);
|
|
196
263
|
var httpResponse = (res = {}) => {
|
|
197
264
|
return {
|
|
198
265
|
headers: res?.header || {},
|
|
@@ -206,10 +273,9 @@ var handleAxiosError = (error7) => {
|
|
|
206
273
|
return error7.response ? httpResponse(error7.response) : httpResponse({ status: 500, data: { error: error7.request } });
|
|
207
274
|
};
|
|
208
275
|
var axiosHttpService = (config = {}) => {
|
|
209
|
-
config.adapter =
|
|
210
|
-
config.httpsAgent = new
|
|
211
|
-
const axiosService =
|
|
212
|
-
axiosRetry(axiosService, { retryDelay: axiosRetry.exponentialDelay, retries: 3 });
|
|
276
|
+
config.adapter = import_http.default;
|
|
277
|
+
config.httpsAgent = new import_https.default.Agent({ keepAlive: true });
|
|
278
|
+
const axiosService = import_axios.default.create(config);
|
|
213
279
|
return {
|
|
214
280
|
instance: () => axiosService,
|
|
215
281
|
get: (url, config2) => axiosService.get(url, config2).then(httpResponse, handleAxiosError),
|
|
@@ -222,21 +288,17 @@ var axiosHttpService = (config = {}) => {
|
|
|
222
288
|
};
|
|
223
289
|
|
|
224
290
|
// src/clients/generic/s3-client.ts
|
|
225
|
-
|
|
226
|
-
|
|
291
|
+
var import_client_s3 = require("@aws-sdk/client-s3");
|
|
292
|
+
var log3 = __toESM(require("lambda-log"), 1);
|
|
227
293
|
var S3Client = class {
|
|
228
294
|
s3;
|
|
229
|
-
constructor(
|
|
230
|
-
this.s3 = new S3({
|
|
231
|
-
credentials: {
|
|
232
|
-
accessKeyId,
|
|
233
|
-
secretAccessKey
|
|
234
|
-
}
|
|
235
|
-
});
|
|
295
|
+
constructor(region = "us-west-2") {
|
|
296
|
+
this.s3 = new import_client_s3.S3({ region });
|
|
236
297
|
}
|
|
237
|
-
async uploadJson(path, bucket, jsonData) {
|
|
298
|
+
async uploadJson(path, bucket, jsonData, ACL = import_client_s3.ObjectCannedACL.private) {
|
|
238
299
|
try {
|
|
239
300
|
const res = await this.s3.putObject({
|
|
301
|
+
ACL,
|
|
240
302
|
Bucket: bucket,
|
|
241
303
|
ContentType: "application/json; charset=utf-8",
|
|
242
304
|
Body: JSON.stringify(jsonData),
|
|
@@ -251,11 +313,8 @@ var S3Client = class {
|
|
|
251
313
|
};
|
|
252
314
|
|
|
253
315
|
// src/clients/generic/cognito-client.ts
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
var cognitoClient = new CognitoIdentityProvider({});
|
|
257
|
-
var USER_POOL_NO_SECRET_CLIENT_ID;
|
|
258
|
-
var USER_POOL_ID;
|
|
316
|
+
var import_client_cognito_identity_provider = require("@aws-sdk/client-cognito-identity-provider");
|
|
317
|
+
var log4 = __toESM(require("lambda-log"), 1);
|
|
259
318
|
function dictToAwsAttributes(input) {
|
|
260
319
|
delete input.email;
|
|
261
320
|
delete input.password;
|
|
@@ -274,123 +333,126 @@ var buildAttributes = (data) => {
|
|
|
274
333
|
};
|
|
275
334
|
return dictToAwsAttributes(attributes);
|
|
276
335
|
};
|
|
277
|
-
var
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
336
|
+
var CognitoClient = class {
|
|
337
|
+
cognitoClient;
|
|
338
|
+
USER_POOL_ID;
|
|
339
|
+
USER_POOL_NO_SECRET_CLIENT_ID;
|
|
340
|
+
constructor(userPoolId, userPoolNoSecretClientId) {
|
|
341
|
+
this.cognitoClient = new import_client_cognito_identity_provider.CognitoIdentityProvider({});
|
|
342
|
+
this.USER_POOL_ID = userPoolId;
|
|
343
|
+
this.USER_POOL_NO_SECRET_CLIENT_ID = userPoolNoSecretClientId;
|
|
344
|
+
}
|
|
345
|
+
signupUser = async (data) => {
|
|
346
|
+
const params = {
|
|
347
|
+
ClientId: this.USER_POOL_NO_SECRET_CLIENT_ID,
|
|
348
|
+
Password: data.password,
|
|
349
|
+
Username: data.email,
|
|
350
|
+
UserAttributes: buildAttributes(data)
|
|
351
|
+
};
|
|
352
|
+
const cognitoResponse = await this.cognitoClient.signUp(params);
|
|
353
|
+
log4.debug("Successfully Registered User", { cognitoResponse });
|
|
354
|
+
return cognitoResponse;
|
|
290
355
|
};
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
356
|
+
forgotPassword = async (email) => {
|
|
357
|
+
await this.adminEmailVerify(email);
|
|
358
|
+
const params = {
|
|
359
|
+
ClientId: this.USER_POOL_NO_SECRET_CLIENT_ID,
|
|
360
|
+
Username: email
|
|
361
|
+
};
|
|
362
|
+
const cognitoResponse = await this.cognitoClient.forgotPassword(params);
|
|
363
|
+
log4.debug("Sent Forgot Password", { cognitoResponse });
|
|
364
|
+
return cognitoResponse;
|
|
300
365
|
};
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
await _CognitoClient.forceValidateEmail(email);
|
|
366
|
+
adminEmailVerify = async (email) => {
|
|
367
|
+
try {
|
|
368
|
+
const user = await this.getUserByEmail(email);
|
|
369
|
+
if (user && user?.UserStatus === "CONFIRMED" && user?.email_verified !== "true") {
|
|
370
|
+
await this.forceValidateEmail(email);
|
|
371
|
+
}
|
|
372
|
+
} catch (error7) {
|
|
373
|
+
log4.error("Failed admin email verify", { error: error7 });
|
|
310
374
|
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
375
|
+
};
|
|
376
|
+
forceValidateEmail = async (email) => {
|
|
377
|
+
try {
|
|
378
|
+
const params = {
|
|
379
|
+
UserPoolId: this.USER_POOL_ID,
|
|
380
|
+
Username: email,
|
|
381
|
+
UserAttributes: [
|
|
382
|
+
{
|
|
383
|
+
Name: "email_verified",
|
|
384
|
+
Value: "true"
|
|
385
|
+
}
|
|
386
|
+
]
|
|
387
|
+
};
|
|
388
|
+
await this.cognitoClient.adminUpdateUserAttributes(params);
|
|
389
|
+
} catch (error7) {
|
|
390
|
+
log4.error("Failed force validate email", { email, error: error7 });
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
adminConfirmUser = async (data) => {
|
|
317
394
|
const params = {
|
|
318
|
-
UserPoolId: USER_POOL_ID,
|
|
319
|
-
Username: email
|
|
320
|
-
UserAttributes: [
|
|
321
|
-
{
|
|
322
|
-
Name: "email_verified",
|
|
323
|
-
Value: "true"
|
|
324
|
-
}
|
|
325
|
-
]
|
|
395
|
+
UserPoolId: this.USER_POOL_ID,
|
|
396
|
+
Username: data.email
|
|
326
397
|
};
|
|
327
|
-
await cognitoClient.
|
|
328
|
-
|
|
329
|
-
log4.
|
|
330
|
-
|
|
331
|
-
});
|
|
332
|
-
__publicField(CognitoClient, "adminConfirmUser", async (data) => {
|
|
333
|
-
const params = {
|
|
334
|
-
UserPoolId: USER_POOL_ID,
|
|
335
|
-
Username: data.email
|
|
336
|
-
};
|
|
337
|
-
const cognitoResponse = await cognitoClient.adminConfirmSignUp(params);
|
|
338
|
-
await _CognitoClient.forceValidateEmail(data.email);
|
|
339
|
-
log4.debug("Admin Successfully Confirmed User", { cognitoResponse });
|
|
340
|
-
return cognitoResponse;
|
|
341
|
-
});
|
|
342
|
-
__publicField(CognitoClient, "confirmUser", async (data) => {
|
|
343
|
-
const params = {
|
|
344
|
-
ClientId: USER_POOL_NO_SECRET_CLIENT_ID,
|
|
345
|
-
ConfirmationCode: data.confirmationCode,
|
|
346
|
-
Username: data.email
|
|
398
|
+
const cognitoResponse = await this.cognitoClient.adminConfirmSignUp(params);
|
|
399
|
+
await this.forceValidateEmail(data.email);
|
|
400
|
+
log4.debug("Admin Successfully Confirmed User", { cognitoResponse });
|
|
401
|
+
return cognitoResponse;
|
|
347
402
|
};
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
403
|
+
confirmUser = async (data) => {
|
|
404
|
+
const params = {
|
|
405
|
+
ClientId: this.USER_POOL_NO_SECRET_CLIENT_ID,
|
|
406
|
+
ConfirmationCode: data.confirmationCode,
|
|
407
|
+
Username: data.email
|
|
408
|
+
};
|
|
409
|
+
const cognitoResponse = await this.cognitoClient.confirmSignUp(params);
|
|
410
|
+
log4.debug("Successfully Confirmed User", { cognitoResponse });
|
|
411
|
+
return cognitoResponse;
|
|
356
412
|
};
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
413
|
+
resendCode = async (email) => {
|
|
414
|
+
const params = {
|
|
415
|
+
ClientId: this.USER_POOL_NO_SECRET_CLIENT_ID,
|
|
416
|
+
Username: email
|
|
417
|
+
};
|
|
418
|
+
await this.cognitoClient.resendConfirmationCode(params);
|
|
419
|
+
log4.debug("Successfully Resend Confirmation Code", { email });
|
|
420
|
+
return;
|
|
365
421
|
};
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
Limit: 1
|
|
422
|
+
adminDeleteUser = async (userId) => {
|
|
423
|
+
const params = {
|
|
424
|
+
UserPoolId: this.USER_POOL_ID,
|
|
425
|
+
Username: userId
|
|
426
|
+
};
|
|
427
|
+
await this.cognitoClient.adminDeleteUser(params);
|
|
428
|
+
return true;
|
|
374
429
|
};
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
...cognitoResponse.Users[0],
|
|
381
|
-
Attributes: void 0,
|
|
382
|
-
id: cognitoResponse.Users[0].sub
|
|
430
|
+
getUserByEmail = async (email) => {
|
|
431
|
+
const params = {
|
|
432
|
+
UserPoolId: this.USER_POOL_ID,
|
|
433
|
+
Filter: `email="${email}"`,
|
|
434
|
+
Limit: 1
|
|
383
435
|
};
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
436
|
+
const cognitoResponse = await this.cognitoClient.listUsers(params);
|
|
437
|
+
log4.debug("Get Users by Email", { cognitoResponse });
|
|
438
|
+
if (cognitoResponse?.Users && cognitoResponse?.Users.length > 0) {
|
|
439
|
+
const attributes = cognitoResponse.Users[0].Attributes;
|
|
440
|
+
const user = {
|
|
441
|
+
...cognitoResponse.Users[0],
|
|
442
|
+
Attributes: void 0,
|
|
443
|
+
id: cognitoResponse.Users[0].sub
|
|
444
|
+
};
|
|
445
|
+
attributes.forEach((attr) => {
|
|
446
|
+
user[attr.Name] = attr?.Value;
|
|
447
|
+
});
|
|
448
|
+
return user;
|
|
449
|
+
}
|
|
450
|
+
return null;
|
|
451
|
+
};
|
|
452
|
+
};
|
|
391
453
|
|
|
392
454
|
// src/clients/internal-api/destinations-client.ts
|
|
393
|
-
|
|
455
|
+
var log5 = __toESM(require("lambda-log"), 1);
|
|
394
456
|
var DestinationsClient = class {
|
|
395
457
|
BASE_API_URL;
|
|
396
458
|
DESTINATIONS_API_KEY;
|
|
@@ -427,7 +489,7 @@ var DestinationsClient = class {
|
|
|
427
489
|
};
|
|
428
490
|
|
|
429
491
|
// src/clients/internal-api/accounts-client.ts
|
|
430
|
-
|
|
492
|
+
var log6 = __toESM(require("lambda-log"), 1);
|
|
431
493
|
var AccountsClient = class {
|
|
432
494
|
BASE_API_URL;
|
|
433
495
|
ACCOUNTS_API_KEY;
|
|
@@ -505,54 +567,19 @@ var AccountsClient = class {
|
|
|
505
567
|
log6.info("add user account response", { response });
|
|
506
568
|
return response;
|
|
507
569
|
};
|
|
570
|
+
// setAccountSubscriptionId = async (accountId: string, subscriptionId: string): Promise<ApiResponse<any>> => {
|
|
571
|
+
// const client = await this.getClient();
|
|
572
|
+
// const pixelResponse = await client.get(`/px/${pixelId}/config`);
|
|
573
|
+
// log.debug('pixelResponse', { pixelResponse });
|
|
574
|
+
// return pixelResponse;
|
|
575
|
+
// };
|
|
508
576
|
};
|
|
509
577
|
|
|
510
578
|
// src/clients/internal-api/users-auth-client.ts
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
// src/helpers/shopify-helper.ts
|
|
514
|
-
import { createHmac } from "crypto";
|
|
515
|
-
import * as log7 from "lambda-log";
|
|
516
|
-
|
|
517
|
-
// src/libs/url.ts
|
|
518
|
-
var mapObjectToQueryString = (inputObj) => {
|
|
519
|
-
const qsp = Object.entries(inputObj).sort((a2, b) => a2[0] < b[0] ? -1 : 1);
|
|
520
|
-
const urlParams = new URLSearchParams();
|
|
521
|
-
qsp.map((p2) => {
|
|
522
|
-
urlParams.append(p2[0], p2[1]);
|
|
523
|
-
});
|
|
524
|
-
const qs = urlParams.toString();
|
|
525
|
-
return qs;
|
|
526
|
-
};
|
|
527
|
-
|
|
528
|
-
// src/helpers/shopify-helper.ts
|
|
529
|
-
var isShopifyRequestValid = (validationParams, validationHmac, shopifyAppApiSecret) => {
|
|
530
|
-
delete validationParams.hmac;
|
|
531
|
-
const hmacString = mapObjectToQueryString(validationParams);
|
|
532
|
-
const generatedHash = createHmac("sha256", shopifyAppApiSecret).update(hmacString).digest("hex");
|
|
533
|
-
return generatedHash === validationHmac;
|
|
534
|
-
};
|
|
535
|
-
var validateShopifyRequest = (validationParams, validationHmac, shopifyAppApiSecret) => {
|
|
536
|
-
log7.info("Validating shopify request is authentic", { validationParams });
|
|
537
|
-
const isValid = isShopifyRequestValid(validationParams, validationHmac, shopifyAppApiSecret);
|
|
538
|
-
if (!isValid) {
|
|
539
|
-
const message = "Failed: Shopify Request hmac validation";
|
|
540
|
-
log7.error(message);
|
|
541
|
-
throw HttpError.badRequest(message);
|
|
542
|
-
}
|
|
543
|
-
log7.info("Sucess: Shopify Request hmac validation");
|
|
544
|
-
return true;
|
|
545
|
-
};
|
|
546
|
-
|
|
547
|
-
// src/libs/crypto.ts
|
|
548
|
-
import crypto from "crypto";
|
|
549
|
-
var generatePublicKey = () => {
|
|
550
|
-
const publicKey = crypto.randomBytes(26);
|
|
551
|
-
return publicKey.toString("utf8");
|
|
552
|
-
};
|
|
579
|
+
var log7 = __toESM(require("lambda-log"), 1);
|
|
553
580
|
|
|
554
581
|
// src/libs/http-error.ts
|
|
555
|
-
|
|
582
|
+
var import_assert = require("assert");
|
|
556
583
|
var deepClone = (o = {}) => JSON.parse(JSON.stringify(o));
|
|
557
584
|
var containsStackTrace = (text = "") => /at.+\.js:\d+:\d+/.test(text);
|
|
558
585
|
var objectContainsStackTrace = (obj) => !obj ? false : containsStackTrace(JSON.stringify(obj));
|
|
@@ -581,18 +608,18 @@ var _HttpError = class extends Error {
|
|
|
581
608
|
statusCode;
|
|
582
609
|
isServerError;
|
|
583
610
|
constructor(statusCode, message, body, headers) {
|
|
584
|
-
|
|
611
|
+
(0, import_assert.strict)(statusCode in supportedStatusCodes, supportedStatusCodesMessage);
|
|
585
612
|
const isServerError = statusCode > 499;
|
|
586
|
-
|
|
613
|
+
(0, import_assert.strict)(
|
|
587
614
|
body === void 0 || typeof body === "object",
|
|
588
615
|
"body must be an object or omitted"
|
|
589
616
|
);
|
|
590
|
-
|
|
617
|
+
(0, import_assert.strict)(
|
|
591
618
|
headers === void 0 || typeof headers === "object",
|
|
592
619
|
"headers must be an object or omitted"
|
|
593
620
|
);
|
|
594
621
|
message = message ?? supportedStatusCodes[statusCode];
|
|
595
|
-
|
|
622
|
+
(0, import_assert.strict)(
|
|
596
623
|
!containsStackTrace(message) && !objectContainsStackTrace(body),
|
|
597
624
|
"the message or data parameters may not contain errors or stack traces"
|
|
598
625
|
);
|
|
@@ -710,19 +737,20 @@ var UsersAuthClient = class {
|
|
|
710
737
|
return user;
|
|
711
738
|
};
|
|
712
739
|
signupUser = async (userSignupRequest) => {
|
|
713
|
-
|
|
740
|
+
log7.info("Attempting to signup user", { email: userSignupRequest.email });
|
|
714
741
|
const client2 = await this.getClient();
|
|
715
742
|
const response = await client2.post("/signup", userSignupRequest);
|
|
716
743
|
if (response.status !== 200 || !response?.data?.user) {
|
|
717
744
|
const message = "User Signup Failed";
|
|
718
|
-
|
|
745
|
+
log7.error(message, { response });
|
|
719
746
|
throw new HttpError(500 /* INTERNAL_SERVER_ERROR */, message);
|
|
720
747
|
}
|
|
721
|
-
|
|
748
|
+
log7.info("User Signup Successful", { response });
|
|
722
749
|
return response.data.user;
|
|
723
750
|
};
|
|
751
|
+
//userName is same as user id
|
|
724
752
|
adminConfirmUser = async (email) => {
|
|
725
|
-
|
|
753
|
+
log7.info("Attempting to admin confirm user", { email });
|
|
726
754
|
const client2 = await this.getClient();
|
|
727
755
|
const response = await client2.post(
|
|
728
756
|
"/admin/confirm",
|
|
@@ -737,10 +765,10 @@ var UsersAuthClient = class {
|
|
|
737
765
|
);
|
|
738
766
|
if (response.status !== 200) {
|
|
739
767
|
const message = "Admin User Confirmation Failed";
|
|
740
|
-
|
|
768
|
+
log7.error(message, { response });
|
|
741
769
|
throw new HttpError(500 /* INTERNAL_SERVER_ERROR */, message);
|
|
742
770
|
}
|
|
743
|
-
|
|
771
|
+
log7.info("Admin User Confirmation Successful", { response });
|
|
744
772
|
return response;
|
|
745
773
|
};
|
|
746
774
|
getUserByEmail = async (email) => {
|
|
@@ -753,13 +781,13 @@ var UsersAuthClient = class {
|
|
|
753
781
|
email
|
|
754
782
|
}
|
|
755
783
|
});
|
|
756
|
-
|
|
784
|
+
log7.info("getUserResponse", { getUserResponse });
|
|
757
785
|
return getUserResponse;
|
|
758
786
|
};
|
|
759
787
|
};
|
|
760
788
|
|
|
761
789
|
// src/clients/internal-api/shopify-app-install-client.ts
|
|
762
|
-
|
|
790
|
+
var import_lambda_log = __toESM(require("lambda-log"), 1);
|
|
763
791
|
var ShopifyAppInstallClient = class {
|
|
764
792
|
BASE_API_URL;
|
|
765
793
|
SHOPIFY_APP_INSTALL_API_KEY;
|
|
@@ -784,25 +812,25 @@ var ShopifyAppInstallClient = class {
|
|
|
784
812
|
updateShopifyAppInstall = async (shopifyAppInstallId, updateShopifyAppInstallRequest) => {
|
|
785
813
|
const client2 = await this.getClient();
|
|
786
814
|
const response = await client2.put(`/${shopifyAppInstallId}`, updateShopifyAppInstallRequest);
|
|
787
|
-
|
|
815
|
+
import_lambda_log.default.info("updateShopifyAppInstall", { response });
|
|
788
816
|
return response;
|
|
789
817
|
};
|
|
790
818
|
getShopifyAppInstall = async (shopifyAppInstallId) => {
|
|
791
819
|
const client2 = await this.getClient();
|
|
792
820
|
const response = await client2.get(`/${shopifyAppInstallId}`);
|
|
793
|
-
|
|
821
|
+
import_lambda_log.default.info("getShopifyAppInstall", { response });
|
|
794
822
|
return response;
|
|
795
823
|
};
|
|
796
824
|
getShopifyAppInstallByShop = async (shop) => {
|
|
797
825
|
const client2 = await this.getClient();
|
|
798
826
|
const response = await client2.get(`/?shop=${shop}`);
|
|
799
|
-
|
|
827
|
+
import_lambda_log.default.info("getShopifyAppInstallByShop", { response });
|
|
800
828
|
return response;
|
|
801
829
|
};
|
|
802
830
|
};
|
|
803
831
|
|
|
804
832
|
// src/clients/third-party/shopify-client.ts
|
|
805
|
-
|
|
833
|
+
var log9 = __toESM(require("lambda-log"), 1);
|
|
806
834
|
var _ShopifyClient = class {
|
|
807
835
|
};
|
|
808
836
|
var ShopifyClient = _ShopifyClient;
|
|
@@ -846,9 +874,9 @@ __publicField(ShopifyClient, "registerWebhookTopic", async (shop, accessToken, e
|
|
|
846
874
|
};
|
|
847
875
|
const res = await client2.post(url, payload, { headers: { "X-Shopify-Access-Token": accessToken } });
|
|
848
876
|
if (res.status >= 400) {
|
|
849
|
-
|
|
877
|
+
log9.error("Failed to register Webhook Topic", { shop, accessToken, eventBridgeArn, topic, url, payload });
|
|
850
878
|
}
|
|
851
|
-
|
|
879
|
+
log9.debug("Shopify Client Webhook Registration Response", { registrationResponse: res });
|
|
852
880
|
return res;
|
|
853
881
|
});
|
|
854
882
|
__publicField(ShopifyClient, "updateShopifyAppMetafield", async (shop, accessToken, pixelId) => {
|
|
@@ -863,7 +891,7 @@ __publicField(ShopifyClient, "updateShopifyAppMetafield", async (shop, accessTok
|
|
|
863
891
|
};
|
|
864
892
|
const res = await _ShopifyClient.genericShopifyPost(url, accessToken, payload);
|
|
865
893
|
if (res.status >= 400) {
|
|
866
|
-
|
|
894
|
+
log9.error("Failed to update Shopify app Metafield ", { shop, accessToken, url, payload });
|
|
867
895
|
}
|
|
868
896
|
return res;
|
|
869
897
|
});
|
|
@@ -871,7 +899,7 @@ __publicField(ShopifyClient, "getShopifyStoreProperties", async (shop, accessTok
|
|
|
871
899
|
const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/shop.json`;
|
|
872
900
|
const res = await _ShopifyClient.genericShopifyGet(url, accessToken);
|
|
873
901
|
if (res.status >= 400) {
|
|
874
|
-
|
|
902
|
+
log9.error("Failed to get Shopify Store Properties", { shop, accessToken, url });
|
|
875
903
|
}
|
|
876
904
|
return res;
|
|
877
905
|
});
|
|
@@ -886,7 +914,7 @@ __publicField(ShopifyClient, "createAppSubscription", async (shop, accessToken,
|
|
|
886
914
|
};
|
|
887
915
|
const res = await _ShopifyClient.genericShopifyPost(url, accessToken, { recurring_application_charge });
|
|
888
916
|
if (res.status >= 400) {
|
|
889
|
-
|
|
917
|
+
log9.error("Failed to create App Subscription", { shop, accessToken, url });
|
|
890
918
|
}
|
|
891
919
|
return res;
|
|
892
920
|
});
|
|
@@ -895,7 +923,7 @@ __publicField(ShopifyClient, "cancelAppSubscription", async (shop, accessToken,
|
|
|
895
923
|
const client2 = axiosHttpService();
|
|
896
924
|
const res = await client2.delete(url, { headers: { "X-Shopify-Access-Token": accessToken } });
|
|
897
925
|
if (res.status !== 200) {
|
|
898
|
-
|
|
926
|
+
log9.error("Failed to cancel recurring App billing", { shop, accessToken, url });
|
|
899
927
|
}
|
|
900
928
|
return res;
|
|
901
929
|
});
|
|
@@ -903,35 +931,35 @@ __publicField(ShopifyClient, "listAppSubscriptions", async (shop, accessToken) =
|
|
|
903
931
|
const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/recurring_application_charges.json`;
|
|
904
932
|
const res = await _ShopifyClient.genericShopifyGet(url, accessToken);
|
|
905
933
|
if (res.status >= 400) {
|
|
906
|
-
|
|
934
|
+
log9.error("Failed to get App Subscriptions", { shop, accessToken, url });
|
|
907
935
|
}
|
|
908
936
|
return res;
|
|
909
937
|
});
|
|
910
938
|
__publicField(ShopifyClient, "genericShopifyPost", async (url, accessToken, payload) => {
|
|
911
939
|
const client2 = axiosHttpService();
|
|
912
940
|
const res = await client2.post(url, payload, { headers: { "X-Shopify-Access-Token": accessToken, "Content-Type": "application/json" } });
|
|
913
|
-
|
|
941
|
+
log9.debug("Shopify Client Response", { res });
|
|
914
942
|
return res;
|
|
915
943
|
});
|
|
916
944
|
__publicField(ShopifyClient, "genericShopifyGet", async (url, accessToken) => {
|
|
917
945
|
const client2 = axiosHttpService();
|
|
918
946
|
const res = await client2.get(url, { headers: { "X-Shopify-Access-Token": accessToken } });
|
|
919
|
-
|
|
947
|
+
log9.debug("Shopify Client Response", { res });
|
|
920
948
|
return res;
|
|
921
949
|
});
|
|
922
950
|
__publicField(ShopifyClient, "genericShopifyPut", async (url, accessToken, payload) => {
|
|
923
951
|
const client2 = axiosHttpService();
|
|
924
952
|
const res = await client2.put(url, payload, { headers: { "X-Shopify-Access-Token": accessToken } });
|
|
925
|
-
|
|
953
|
+
log9.debug("Shopify Client Response", { res });
|
|
926
954
|
return res;
|
|
927
955
|
});
|
|
928
956
|
|
|
929
957
|
// src/helpers/input-validation-helper.ts
|
|
930
|
-
|
|
958
|
+
var log10 = __toESM(require("lambda-log"), 1);
|
|
931
959
|
var validateInput = (schema, input) => {
|
|
932
960
|
const { error: error7, value } = schema.validate(input);
|
|
933
961
|
if (error7) {
|
|
934
|
-
|
|
962
|
+
log10.info("", { error: error7 });
|
|
935
963
|
const httperr = HttpError.badRequest("Bad Request", {
|
|
936
964
|
errors: error7.details.map((detail) => ({
|
|
937
965
|
message: detail?.message,
|
|
@@ -939,21 +967,21 @@ var validateInput = (schema, input) => {
|
|
|
939
967
|
path: detail?.path
|
|
940
968
|
}))
|
|
941
969
|
});
|
|
942
|
-
|
|
970
|
+
log10.info("", { httperr });
|
|
943
971
|
throw httperr;
|
|
944
972
|
}
|
|
945
973
|
return value;
|
|
946
974
|
};
|
|
947
975
|
|
|
948
976
|
// src/helpers/logging-helper.ts
|
|
949
|
-
|
|
977
|
+
var log11 = __toESM(require("lambda-log"), 1);
|
|
950
978
|
var stage = process?.env?.STAGE;
|
|
951
979
|
var configureLogger = (event, context, debug5 = true) => {
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
980
|
+
log11.options.meta.stage = stage;
|
|
981
|
+
log11.options.meta.source_name = context?.functionName || "unknown";
|
|
982
|
+
log11.options.meta.awsRequestId = context?.awsRequestId || "unknown";
|
|
983
|
+
log11.options.meta.lambdaEvent = event;
|
|
984
|
+
log11.options.debug = debug5;
|
|
957
985
|
};
|
|
958
986
|
|
|
959
987
|
// src/helpers/response-helper.ts
|
|
@@ -983,25 +1011,60 @@ var buildResponse = (statusCode, body = {}) => {
|
|
|
983
1011
|
"Access-Control-Allow-Origin": "*",
|
|
984
1012
|
"Access-Control-Allow-Credentials": true,
|
|
985
1013
|
"cache-control": "max-age=86400",
|
|
986
|
-
Date: new Date(),
|
|
987
|
-
"Last-Modified": new Date(),
|
|
1014
|
+
Date: /* @__PURE__ */ new Date(),
|
|
1015
|
+
"Last-Modified": /* @__PURE__ */ new Date(),
|
|
988
1016
|
"Access-Control-Allow-Headers": "Content-Type, Content-Encoding"
|
|
989
1017
|
},
|
|
990
1018
|
body: JSON.stringify(body)
|
|
991
1019
|
};
|
|
992
1020
|
};
|
|
993
1021
|
|
|
1022
|
+
// src/helpers/shopify-helper.ts
|
|
1023
|
+
var import_crypto = require("crypto");
|
|
1024
|
+
var log12 = __toESM(require("lambda-log"), 1);
|
|
1025
|
+
|
|
1026
|
+
// src/libs/url.ts
|
|
1027
|
+
var mapObjectToQueryString = (inputObj) => {
|
|
1028
|
+
const qsp = Object.entries(inputObj).sort((a, b) => a[0] < b[0] ? -1 : 1);
|
|
1029
|
+
const urlParams = new URLSearchParams();
|
|
1030
|
+
qsp.map((p2) => {
|
|
1031
|
+
urlParams.append(p2[0], p2[1]);
|
|
1032
|
+
});
|
|
1033
|
+
const qs = urlParams.toString();
|
|
1034
|
+
return qs;
|
|
1035
|
+
};
|
|
1036
|
+
|
|
1037
|
+
// src/helpers/shopify-helper.ts
|
|
1038
|
+
var isShopifyRequestValid = (validationParams, validationHmac, shopifyAppApiSecret) => {
|
|
1039
|
+
delete validationParams.hmac;
|
|
1040
|
+
const hmacString = mapObjectToQueryString(validationParams);
|
|
1041
|
+
const generatedHash = (0, import_crypto.createHmac)("sha256", shopifyAppApiSecret).update(hmacString).digest("hex");
|
|
1042
|
+
return generatedHash === validationHmac;
|
|
1043
|
+
};
|
|
1044
|
+
var validateShopifyRequest = (validationParams, validationHmac, shopifyAppApiSecret) => {
|
|
1045
|
+
log12.info("Validating shopify request is authentic", { validationParams });
|
|
1046
|
+
const isValid = isShopifyRequestValid(validationParams, validationHmac, shopifyAppApiSecret);
|
|
1047
|
+
if (!isValid) {
|
|
1048
|
+
const message = "Failed: Shopify Request hmac validation";
|
|
1049
|
+
log12.error(message);
|
|
1050
|
+
throw HttpError.badRequest(message);
|
|
1051
|
+
}
|
|
1052
|
+
log12.info("Sucess: Shopify Request hmac validation");
|
|
1053
|
+
return true;
|
|
1054
|
+
};
|
|
1055
|
+
|
|
994
1056
|
// node_modules/@adtrackify/at-tracking-event-types/dist/index.js
|
|
995
|
-
var
|
|
1057
|
+
var s = ((n) => (n.PENDING = "pending", n.ACTIVE = "active", n.INACTIVE = "inactive", n))(s || {});
|
|
996
1058
|
var g = ((i) => (i.FACEBOOK = "facebook", i.TIKTOK = "tiktok", i.GOOGLE_ADS = "googleAds", i.GOOGLE_ANALYTICS_4 = "googleAnalytics4", i.HUBSPOT = "hubspot", i.WEBHOOK = "webhook", i.CUSTOM_HTML = "customHTML", i.CUSTOM_JS = "customJS", i.SNAPCHAT = "snapchat", i.TWITTER = "twitter", i.REDDIT = "reddit", i))(g || {});
|
|
997
|
-
var c = ((
|
|
998
|
-
var p = ((
|
|
999
|
-
var d = ((
|
|
1000
|
-
var f = ((
|
|
1001
|
-
var
|
|
1002
|
-
var
|
|
1003
|
-
var
|
|
1004
|
-
var x = ((t) => (t.ADD_PAYMENT_INFO = "add_payment_info", t.ADD_SHIPPING_INFO = "add_shipping_info", t.ADD_TO_CART = "add_to_cart", t.ADD_TO_WISHLIST = "add_to_wishlist", t.INITIATE_CHECKOUT = "initiate_checkout", t.LEAD = "lead", t.LOGIN = "login", t.PAGE_VIEW = "page_view", t.PURCHASE = "purchase", t.REFUND = "refund", t.SEARCH = "search", t.SIGN_UP = "sign_up", t.VIEW_CART = "view_cart", t.VIEW_CONTENT = "view_content", t.SELECT_SHIPPING_METHOD = "select_shipping_method", t.VIRTUALIZED_VIEWED_PAYMENT_FORM = "virtualized_viewd_payment_form", t))(x || {});
|
|
1059
|
+
var c = ((n) => (n.HEADER = "header", n.FOOTER = "footer", n.BODY = "body", n))(c || {});
|
|
1060
|
+
var p = ((o) => (o.STARTED = "started", o.COMPLETED = "completed", o.UNINSTALLED = "uninstalled", o.FAILED = "failed", o.NONE = "none", o))(p || {});
|
|
1061
|
+
var d = ((e) => (e.ACTIVE = "active", e.CANCELLED = "cancelled", e.DECLINED = "declined", e.EXPIRED = "expired", e.FROZEN = "frozen", e.PENDING = "pending", e.NOT_SUBMITTED = "na", e))(d || {});
|
|
1062
|
+
var f = ((a) => (a.MONTHLY = "monthly", a.YEARLY = "yearly", a))(f || {});
|
|
1063
|
+
var m = ((r) => (r.CURRENT = "current", r.PAST_DUE = "past_due", r.CANCELLED = "cancelled", r.FAILED = "failed", r))(m || {});
|
|
1064
|
+
var l = ((e) => (e.ACTIVE = "active", e.CANCELLED = "cancelled", e.DECLINED = "declined", e.EXPIRED = "expired", e.FROZEN = "frozen", e.PENDING = "pending", e.NOT_SUBMITTED = "na", e))(l || {});
|
|
1065
|
+
var u = ((n) => (n.STRIPE = "stripe", n.PAYPAL = "paypal", n.SHOPIFY = "shopify", n))(u || {});
|
|
1066
|
+
var x = ((t) => (t.ADD_PAYMENT_INFO = "add_payment_info", t.ADD_SHIPPING_INFO = "add_shipping_info", t.ADD_TO_CART = "add_to_cart", t.ADD_TO_WISHLIST = "add_to_wishlist", t.INITIATE_CHECKOUT = "initiate_checkout", t.LEAD = "lead", t.LOGIN = "login", t.PAGE_VIEW = "page_view", t.PURCHASE = "purchase", t.REFUND = "refund", t.SEARCH = "search", t.SIGN_UP = "sign_up", t.VIEW_CART = "view_cart", t.VIEW_CONTENT = "view_content", t.SELECT_SHIPPING_METHOD = "select_shipping_method", t.VIRTUALIZED_VIEWED_PAYMENT_FORM = "virtualized_viewd_payment_form", t.METRIC = "metric", t.WEB_VITAL = "web_vital", t))(x || {});
|
|
1067
|
+
var C = ((r) => (r.TRACKING = "tracking", r.METRIC = "metric", r.IDENTIFY = "identify", r.LOG = "log", r))(C || {});
|
|
1005
1068
|
|
|
1006
1069
|
// src/helpers/subscription-helper.ts
|
|
1007
1070
|
var StripeBillingMap = {
|
|
@@ -1061,6 +1124,7 @@ var StripeBillingMap = {
|
|
|
1061
1124
|
}
|
|
1062
1125
|
};
|
|
1063
1126
|
var CommonPlanInfo = [
|
|
1127
|
+
//'60-day Risk Free Trial',
|
|
1064
1128
|
"Free Server Side Tracking & Conversion API",
|
|
1065
1129
|
"MultiPixel Support (Multiple facebook, tiktok, etc)",
|
|
1066
1130
|
"Corrects Facebook Conversion Tracking post IOS14",
|
|
@@ -1090,6 +1154,7 @@ var SubscriptionPlanSeedItems = {
|
|
|
1090
1154
|
isHighlighted: false,
|
|
1091
1155
|
isBanner: false
|
|
1092
1156
|
},
|
|
1157
|
+
// STARTER PLANS
|
|
1093
1158
|
{
|
|
1094
1159
|
id: 2,
|
|
1095
1160
|
planName: "starter_monthly",
|
|
@@ -1133,6 +1198,7 @@ var SubscriptionPlanSeedItems = {
|
|
|
1133
1198
|
bannerColor: "blue",
|
|
1134
1199
|
bannerText: "MOST POPULAR"
|
|
1135
1200
|
},
|
|
1201
|
+
// SCALE PLANS
|
|
1136
1202
|
{
|
|
1137
1203
|
id: 4,
|
|
1138
1204
|
planName: "scale_monthly",
|
|
@@ -1173,6 +1239,55 @@ var SubscriptionPlanSeedItems = {
|
|
|
1173
1239
|
isHighlighted: false,
|
|
1174
1240
|
isBanner: false
|
|
1175
1241
|
}
|
|
1242
|
+
// // GROWTH PLANS
|
|
1243
|
+
// {
|
|
1244
|
+
// id: 6,
|
|
1245
|
+
// planName: 'growth_monthly',
|
|
1246
|
+
// displayName: 'Growth',
|
|
1247
|
+
// sku: 'ADT-006',
|
|
1248
|
+
// description: 'Growth Plan - Monthly',
|
|
1249
|
+
// price: '199.99',
|
|
1250
|
+
// displayPrice: '$199.99',
|
|
1251
|
+
// billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,
|
|
1252
|
+
// trialLengthDays: 60,
|
|
1253
|
+
// trialRequiresCreditCard: false,
|
|
1254
|
+
// planDesc: [
|
|
1255
|
+
// '60-day Risk Free Trial',
|
|
1256
|
+
// ...CommonPlanInfo,
|
|
1257
|
+
// '250,000 tracking events/mo'
|
|
1258
|
+
// ],
|
|
1259
|
+
// unitPriceText: 'billed yearly ($540) - 25% savings',
|
|
1260
|
+
// isHighlighted: false,
|
|
1261
|
+
// isBanner: true,
|
|
1262
|
+
// bannerColor: 'orange',
|
|
1263
|
+
// bannerText: 'BEST VALUE'
|
|
1264
|
+
// }, {
|
|
1265
|
+
// id: 7,
|
|
1266
|
+
// planName: 'growth_yearly',
|
|
1267
|
+
// displayName: 'Growth',
|
|
1268
|
+
// sku: 'ADT-007',
|
|
1269
|
+
// description: 'Growth Plan - Yearly',
|
|
1270
|
+
// price: '1799.91',
|
|
1271
|
+
// displayPrice: '$149.99',
|
|
1272
|
+
// billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,
|
|
1273
|
+
// trialLengthDays: 60,
|
|
1274
|
+
// trialRequiresCreditCard: false,
|
|
1275
|
+
// planDesc: [
|
|
1276
|
+
// '30-day Risk Free Trial',
|
|
1277
|
+
// 'Fixes IOS14.5 tracking',
|
|
1278
|
+
// 'Multi Pixel Support',
|
|
1279
|
+
// 'Enhanced Tracking / Attribution',
|
|
1280
|
+
// 'Unlimited Facebook Conversion API',
|
|
1281
|
+
// 'Unlimited Integrations',
|
|
1282
|
+
// 'Easy no code setup',
|
|
1283
|
+
// '100,000 tracking events/mo'
|
|
1284
|
+
// ],
|
|
1285
|
+
// unitPriceText: 'billed yearly ($1799.91) - 25% savings',
|
|
1286
|
+
// isHighlighted: false,
|
|
1287
|
+
// isBanner: true,
|
|
1288
|
+
// bannerColor: 'orange',
|
|
1289
|
+
// bannerText: 'BEST VALUE'
|
|
1290
|
+
// },
|
|
1176
1291
|
]
|
|
1177
1292
|
};
|
|
1178
1293
|
var getPlanDetails = (planId, stage2) => {
|
|
@@ -1188,6 +1303,13 @@ var getPlanByStripePriceId = (stripePriceId, stage2) => {
|
|
|
1188
1303
|
return plan;
|
|
1189
1304
|
};
|
|
1190
1305
|
|
|
1306
|
+
// src/libs/crypto.ts
|
|
1307
|
+
var import_crypto2 = __toESM(require("crypto"), 1);
|
|
1308
|
+
var generatePublicKey = () => {
|
|
1309
|
+
const publicKey = import_crypto2.default.randomBytes(26);
|
|
1310
|
+
return publicKey.toString("utf8");
|
|
1311
|
+
};
|
|
1312
|
+
|
|
1191
1313
|
// src/types/internal-events/event-detail-types.ts
|
|
1192
1314
|
var ADTRACKIFY_EVENT_TYPES = /* @__PURE__ */ ((ADTRACKIFY_EVENT_TYPES2) => {
|
|
1193
1315
|
ADTRACKIFY_EVENT_TYPES2["NOTIFY_SHOPIFY_SUBSCRIPTION_CREATED"] = "shopifySubscriptionCreated";
|
|
@@ -1241,7 +1363,8 @@ var EventBridgeIntegrationService = class {
|
|
|
1241
1363
|
);
|
|
1242
1364
|
};
|
|
1243
1365
|
};
|
|
1244
|
-
export
|
|
1366
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1367
|
+
0 && (module.exports = {
|
|
1245
1368
|
ADTRACKIFY_EVENT_BRIDGE_EVENTS,
|
|
1246
1369
|
ADTRACKIFY_EVENT_SOURCES,
|
|
1247
1370
|
ADTRACKIFY_EVENT_TYPES,
|
|
@@ -1277,5 +1400,5 @@ export {
|
|
|
1277
1400
|
success,
|
|
1278
1401
|
validateInput,
|
|
1279
1402
|
validateShopifyRequest
|
|
1280
|
-
};
|
|
1403
|
+
});
|
|
1281
1404
|
//# sourceMappingURL=index.js.map
|