@adtrackify/at-service-common 1.1.17 → 1.1.18
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
CHANGED
|
@@ -2,12 +2,12 @@ declare module '@adtrackify/at-service-common/__tests__/helpers/subscription-hel
|
|
|
2
2
|
export {};
|
|
3
3
|
|
|
4
4
|
}
|
|
5
|
-
declare module '@adtrackify/at-service-common/clients/generic/cognito-
|
|
5
|
+
declare module '@adtrackify/at-service-common/clients/generic/cognito-client' {
|
|
6
6
|
export function dictToAwsAttributes(input: any): {
|
|
7
7
|
Name: string;
|
|
8
8
|
Value: any;
|
|
9
9
|
}[];
|
|
10
|
-
export class
|
|
10
|
+
export class CognitoClient {
|
|
11
11
|
static setCredentials: (userPoolId: string, userPoolNoSecretClientId: string) => void;
|
|
12
12
|
static signupUser: (data: any) => Promise<import("@aws-sdk/client-cognito-identity-provider").SignUpCommandOutput>;
|
|
13
13
|
static forgotPassword: (email: string) => Promise<import("@aws-sdk/client-cognito-identity-provider").ForgotPasswordCommandOutput>;
|
|
@@ -93,6 +93,7 @@ declare module '@adtrackify/at-service-common/clients/generic/index' {
|
|
|
93
93
|
export * from '@adtrackify/at-service-common/clients/generic/eventbridge-client';
|
|
94
94
|
export * from '@adtrackify/at-service-common/clients/generic/http-client';
|
|
95
95
|
export * from '@adtrackify/at-service-common/clients/generic/s3-client';
|
|
96
|
+
export * from '@adtrackify/at-service-common/clients/generic/cognito-client';
|
|
96
97
|
|
|
97
98
|
}
|
|
98
99
|
declare module '@adtrackify/at-service-common/clients/generic/s3-client' {
|
package/dist/index.js
CHANGED
|
@@ -200,10 +200,10 @@ var httpResponse = (res = {}) => {
|
|
|
200
200
|
status: res?.status || 0
|
|
201
201
|
};
|
|
202
202
|
};
|
|
203
|
-
var handleAxiosError = (
|
|
204
|
-
if (!
|
|
205
|
-
throw
|
|
206
|
-
return
|
|
203
|
+
var handleAxiosError = (error7) => {
|
|
204
|
+
if (!error7?.response && !error7?.request)
|
|
205
|
+
throw error7;
|
|
206
|
+
return error7.response ? httpResponse(error7.response) : httpResponse({ status: 500, data: { error: error7.request } });
|
|
207
207
|
};
|
|
208
208
|
var axiosHttpService = (config = {}) => {
|
|
209
209
|
config.adapter = httpAdapter;
|
|
@@ -243,15 +243,154 @@ var S3Client = class {
|
|
|
243
243
|
Key: path
|
|
244
244
|
});
|
|
245
245
|
return res;
|
|
246
|
-
} catch (
|
|
247
|
-
log3.error("Error in s3 upload json", { error:
|
|
248
|
-
return
|
|
246
|
+
} catch (error7) {
|
|
247
|
+
log3.error("Error in s3 upload json", { error: error7 });
|
|
248
|
+
return error7;
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
};
|
|
252
252
|
|
|
253
|
-
// src/clients/
|
|
253
|
+
// src/clients/generic/cognito-client.ts
|
|
254
|
+
import { CognitoIdentityProvider } from "@aws-sdk/client-cognito-identity-provider";
|
|
254
255
|
import * as log4 from "lambda-log";
|
|
256
|
+
var cognitoClient = new CognitoIdentityProvider({});
|
|
257
|
+
var USER_POOL_NO_SECRET_CLIENT_ID;
|
|
258
|
+
var USER_POOL_ID;
|
|
259
|
+
function dictToAwsAttributes(input) {
|
|
260
|
+
delete input.email;
|
|
261
|
+
delete input.password;
|
|
262
|
+
const output = [];
|
|
263
|
+
for (const att in input) {
|
|
264
|
+
if (Object.prototype.hasOwnProperty.call(input, att)) {
|
|
265
|
+
output.push({ Name: att, Value: input[att] });
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return output;
|
|
269
|
+
}
|
|
270
|
+
var buildAttributes = (data) => {
|
|
271
|
+
const attributes = {
|
|
272
|
+
name: data.givenName,
|
|
273
|
+
family_name: data.familyName
|
|
274
|
+
};
|
|
275
|
+
return dictToAwsAttributes(attributes);
|
|
276
|
+
};
|
|
277
|
+
var _CognitoClient = class {
|
|
278
|
+
};
|
|
279
|
+
var CognitoClient = _CognitoClient;
|
|
280
|
+
__publicField(CognitoClient, "setCredentials", (userPoolId, userPoolNoSecretClientId) => {
|
|
281
|
+
USER_POOL_ID = userPoolId;
|
|
282
|
+
USER_POOL_NO_SECRET_CLIENT_ID = userPoolNoSecretClientId;
|
|
283
|
+
});
|
|
284
|
+
__publicField(CognitoClient, "signupUser", async (data) => {
|
|
285
|
+
const params = {
|
|
286
|
+
ClientId: USER_POOL_NO_SECRET_CLIENT_ID,
|
|
287
|
+
Password: data.password,
|
|
288
|
+
Username: data.email,
|
|
289
|
+
UserAttributes: buildAttributes(data)
|
|
290
|
+
};
|
|
291
|
+
const cognitoResponse = await cognitoClient.signUp(params);
|
|
292
|
+
log4.debug("Successfully Registered User", { cognitoResponse });
|
|
293
|
+
return cognitoResponse;
|
|
294
|
+
});
|
|
295
|
+
__publicField(CognitoClient, "forgotPassword", async (email) => {
|
|
296
|
+
await _CognitoClient.adminEmailVerify(email);
|
|
297
|
+
const params = {
|
|
298
|
+
ClientId: USER_POOL_NO_SECRET_CLIENT_ID,
|
|
299
|
+
Username: email
|
|
300
|
+
};
|
|
301
|
+
const cognitoResponse = await cognitoClient.forgotPassword(params);
|
|
302
|
+
log4.debug("Sent Forgot Password", { cognitoResponse });
|
|
303
|
+
return cognitoResponse;
|
|
304
|
+
});
|
|
305
|
+
__publicField(CognitoClient, "adminEmailVerify", async (email) => {
|
|
306
|
+
try {
|
|
307
|
+
const user = await _CognitoClient.getUserByEmail(email);
|
|
308
|
+
if (user && user?.UserStatus === "CONFIRMED" && user?.email_verified !== "true") {
|
|
309
|
+
await _CognitoClient.forceValidateEmail(email);
|
|
310
|
+
}
|
|
311
|
+
} catch (error7) {
|
|
312
|
+
log4.error("Failed admin email verify", { error: error7 });
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
__publicField(CognitoClient, "forceValidateEmail", async (email) => {
|
|
316
|
+
try {
|
|
317
|
+
const params = {
|
|
318
|
+
UserPoolId: USER_POOL_ID,
|
|
319
|
+
Username: email,
|
|
320
|
+
UserAttributes: [
|
|
321
|
+
{
|
|
322
|
+
Name: "email_verified",
|
|
323
|
+
Value: "true"
|
|
324
|
+
}
|
|
325
|
+
]
|
|
326
|
+
};
|
|
327
|
+
await cognitoClient.adminUpdateUserAttributes(params);
|
|
328
|
+
} catch (error7) {
|
|
329
|
+
log4.error("Failed force validate email", { email, error: error7 });
|
|
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
|
|
347
|
+
};
|
|
348
|
+
const cognitoResponse = await cognitoClient.confirmSignUp(params);
|
|
349
|
+
log4.debug("Successfully Confirmed User", { cognitoResponse });
|
|
350
|
+
return cognitoResponse;
|
|
351
|
+
});
|
|
352
|
+
__publicField(CognitoClient, "resendCode", async (email) => {
|
|
353
|
+
const params = {
|
|
354
|
+
ClientId: USER_POOL_NO_SECRET_CLIENT_ID,
|
|
355
|
+
Username: email
|
|
356
|
+
};
|
|
357
|
+
await cognitoClient.resendConfirmationCode(params);
|
|
358
|
+
log4.debug("Successfully Resend Confirmation Code", { email });
|
|
359
|
+
return;
|
|
360
|
+
});
|
|
361
|
+
__publicField(CognitoClient, "adminDeleteUser", async (userId) => {
|
|
362
|
+
const params = {
|
|
363
|
+
UserPoolId: USER_POOL_ID,
|
|
364
|
+
Username: userId
|
|
365
|
+
};
|
|
366
|
+
await cognitoClient.adminDeleteUser(params);
|
|
367
|
+
return true;
|
|
368
|
+
});
|
|
369
|
+
__publicField(CognitoClient, "getUserByEmail", async (email) => {
|
|
370
|
+
const params = {
|
|
371
|
+
UserPoolId: USER_POOL_ID,
|
|
372
|
+
Filter: `email="${email}"`,
|
|
373
|
+
Limit: 1
|
|
374
|
+
};
|
|
375
|
+
const cognitoResponse = await cognitoClient.listUsers(params);
|
|
376
|
+
log4.debug("Get Users by Email", { cognitoResponse });
|
|
377
|
+
if (cognitoResponse?.Users && cognitoResponse?.Users.length > 0) {
|
|
378
|
+
const attributes = cognitoResponse.Users[0].Attributes;
|
|
379
|
+
const user = {
|
|
380
|
+
...cognitoResponse.Users[0],
|
|
381
|
+
Attributes: void 0,
|
|
382
|
+
id: cognitoResponse.Users[0].sub
|
|
383
|
+
};
|
|
384
|
+
attributes.forEach((attr) => {
|
|
385
|
+
user[attr.Name] = attr?.Value;
|
|
386
|
+
});
|
|
387
|
+
return user;
|
|
388
|
+
}
|
|
389
|
+
return null;
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
// src/clients/internal-api/destinations-client.ts
|
|
393
|
+
import * as log5 from "lambda-log";
|
|
255
394
|
var DestinationsClient = class {
|
|
256
395
|
BASE_API_URL;
|
|
257
396
|
DESTINATIONS_API_KEY;
|
|
@@ -276,19 +415,19 @@ var DestinationsClient = class {
|
|
|
276
415
|
createDestination = async (createDestinationRequest) => {
|
|
277
416
|
const client2 = await this.getClient();
|
|
278
417
|
const response = await client2.post("/", createDestinationRequest);
|
|
279
|
-
|
|
418
|
+
log5.info("createDestinationResponse", { response });
|
|
280
419
|
return response;
|
|
281
420
|
};
|
|
282
421
|
getPixelDestinations = async (pixelId) => {
|
|
283
422
|
const client2 = await this.getClient();
|
|
284
423
|
const response = await client2.get(`/?pixelId=${pixelId}`);
|
|
285
|
-
|
|
424
|
+
log5.info("getPixelResponse", { response });
|
|
286
425
|
return response;
|
|
287
426
|
};
|
|
288
427
|
};
|
|
289
428
|
|
|
290
429
|
// src/clients/internal-api/accounts-client.ts
|
|
291
|
-
import * as
|
|
430
|
+
import * as log6 from "lambda-log";
|
|
292
431
|
var AccountsClient = class {
|
|
293
432
|
BASE_API_URL;
|
|
294
433
|
ACCOUNTS_API_KEY;
|
|
@@ -316,19 +455,19 @@ var AccountsClient = class {
|
|
|
316
455
|
createAccount = async (createAccountRequest) => {
|
|
317
456
|
const client2 = await this.getClient();
|
|
318
457
|
const createAccountResponse = await client2.post("", createAccountRequest);
|
|
319
|
-
|
|
458
|
+
log6.info("createAccountResponse", { createAccountResponse });
|
|
320
459
|
return createAccountResponse;
|
|
321
460
|
};
|
|
322
461
|
updateAccount = async (accountId, body) => {
|
|
323
462
|
const client2 = await this.getClient();
|
|
324
463
|
const response = await client2.patch(`/${accountId}/`, body);
|
|
325
|
-
|
|
464
|
+
log6.info("update Account response", { response });
|
|
326
465
|
return response;
|
|
327
466
|
};
|
|
328
467
|
addOwner = async (accountId, userId) => {
|
|
329
468
|
const client2 = await this.getClient();
|
|
330
469
|
const addOwnerResponse = await client2.post("/addOwner", { accountId, userId });
|
|
331
|
-
|
|
470
|
+
log6.info("addOwnerResponse", { addOwnerResponse });
|
|
332
471
|
return addOwnerResponse;
|
|
333
472
|
};
|
|
334
473
|
isAuthorizedUser = async (userId, accountId, pixelId) => {
|
|
@@ -339,41 +478,41 @@ var AccountsClient = class {
|
|
|
339
478
|
pixelId
|
|
340
479
|
};
|
|
341
480
|
const response = await client2.post("/checkUserAuthorization", body);
|
|
342
|
-
|
|
481
|
+
log6.info("checkUserAuthorization", { response });
|
|
343
482
|
return response;
|
|
344
483
|
};
|
|
345
484
|
adminDeleteAccount = async (accountId) => {
|
|
346
485
|
const client2 = await this.getClient();
|
|
347
486
|
const success2 = await client2.delete(`/${accountId}`);
|
|
348
|
-
|
|
487
|
+
log6.info("adminDeleteAccount");
|
|
349
488
|
return success2;
|
|
350
489
|
};
|
|
351
490
|
getPixelConfigById = async (pixelId) => {
|
|
352
491
|
const client2 = await this.getClient();
|
|
353
492
|
const pixelResponse = await client2.get(`/px/${pixelId}/config`);
|
|
354
|
-
|
|
493
|
+
log6.debug("get pixelResponse", { pixelResponse });
|
|
355
494
|
return pixelResponse;
|
|
356
495
|
};
|
|
357
496
|
getAccount = async (accountId) => {
|
|
358
497
|
const client2 = await this.getClient();
|
|
359
498
|
const response = await client2.get(`/${accountId}/`);
|
|
360
|
-
|
|
499
|
+
log6.info("get account response", { response });
|
|
361
500
|
return response;
|
|
362
501
|
};
|
|
363
502
|
addUserToAccount = async (accountId, userId) => {
|
|
364
503
|
const client2 = await this.getClient();
|
|
365
504
|
const response = await client2.post("/addUser", { accountId, userId });
|
|
366
|
-
|
|
505
|
+
log6.info("add user account response", { response });
|
|
367
506
|
return response;
|
|
368
507
|
};
|
|
369
508
|
};
|
|
370
509
|
|
|
371
510
|
// src/clients/internal-api/users-auth-client.ts
|
|
372
|
-
import * as
|
|
511
|
+
import * as log8 from "lambda-log";
|
|
373
512
|
|
|
374
513
|
// src/helpers/shopify-helper.ts
|
|
375
514
|
import { createHmac } from "crypto";
|
|
376
|
-
import * as
|
|
515
|
+
import * as log7 from "lambda-log";
|
|
377
516
|
|
|
378
517
|
// src/libs/url.ts
|
|
379
518
|
var mapObjectToQueryString = (inputObj) => {
|
|
@@ -394,14 +533,14 @@ var isShopifyRequestValid = (validationParams, validationHmac, shopifyAppApiSecr
|
|
|
394
533
|
return generatedHash === validationHmac;
|
|
395
534
|
};
|
|
396
535
|
var validateShopifyRequest = (validationParams, validationHmac, shopifyAppApiSecret) => {
|
|
397
|
-
|
|
536
|
+
log7.info("Validating shopify request is authentic", { validationParams });
|
|
398
537
|
const isValid = isShopifyRequestValid(validationParams, validationHmac, shopifyAppApiSecret);
|
|
399
538
|
if (!isValid) {
|
|
400
539
|
const message = "Failed: Shopify Request hmac validation";
|
|
401
|
-
|
|
540
|
+
log7.error(message);
|
|
402
541
|
throw HttpError.badRequest(message);
|
|
403
542
|
}
|
|
404
|
-
|
|
543
|
+
log7.info("Sucess: Shopify Request hmac validation");
|
|
405
544
|
return true;
|
|
406
545
|
};
|
|
407
546
|
|
|
@@ -571,19 +710,19 @@ var UsersAuthClient = class {
|
|
|
571
710
|
return user;
|
|
572
711
|
};
|
|
573
712
|
signupUser = async (userSignupRequest) => {
|
|
574
|
-
|
|
713
|
+
log8.info("Attempting to signup user", { email: userSignupRequest.email });
|
|
575
714
|
const client2 = await this.getClient();
|
|
576
715
|
const response = await client2.post("/signup", userSignupRequest);
|
|
577
716
|
if (response.status !== 200 || !response?.data?.user) {
|
|
578
717
|
const message = "User Signup Failed";
|
|
579
|
-
|
|
718
|
+
log8.error(message, { response });
|
|
580
719
|
throw new HttpError(500 /* INTERNAL_SERVER_ERROR */, message);
|
|
581
720
|
}
|
|
582
|
-
|
|
721
|
+
log8.info("User Signup Successful", { response });
|
|
583
722
|
return response.data.user;
|
|
584
723
|
};
|
|
585
724
|
adminConfirmUser = async (email) => {
|
|
586
|
-
|
|
725
|
+
log8.info("Attempting to admin confirm user", { email });
|
|
587
726
|
const client2 = await this.getClient();
|
|
588
727
|
const response = await client2.post(
|
|
589
728
|
"/admin/confirm",
|
|
@@ -598,10 +737,10 @@ var UsersAuthClient = class {
|
|
|
598
737
|
);
|
|
599
738
|
if (response.status !== 200) {
|
|
600
739
|
const message = "Admin User Confirmation Failed";
|
|
601
|
-
|
|
740
|
+
log8.error(message, { response });
|
|
602
741
|
throw new HttpError(500 /* INTERNAL_SERVER_ERROR */, message);
|
|
603
742
|
}
|
|
604
|
-
|
|
743
|
+
log8.info("Admin User Confirmation Successful", { response });
|
|
605
744
|
return response;
|
|
606
745
|
};
|
|
607
746
|
getUserByEmail = async (email) => {
|
|
@@ -614,13 +753,13 @@ var UsersAuthClient = class {
|
|
|
614
753
|
email
|
|
615
754
|
}
|
|
616
755
|
});
|
|
617
|
-
|
|
756
|
+
log8.info("getUserResponse", { getUserResponse });
|
|
618
757
|
return getUserResponse;
|
|
619
758
|
};
|
|
620
759
|
};
|
|
621
760
|
|
|
622
761
|
// src/clients/internal-api/shopify-app-install-client.ts
|
|
623
|
-
import
|
|
762
|
+
import log9 from "lambda-log";
|
|
624
763
|
var ShopifyAppInstallClient = class {
|
|
625
764
|
BASE_API_URL;
|
|
626
765
|
SHOPIFY_APP_INSTALL_API_KEY;
|
|
@@ -645,25 +784,25 @@ var ShopifyAppInstallClient = class {
|
|
|
645
784
|
updateShopifyAppInstall = async (shopifyAppInstallId, updateShopifyAppInstallRequest) => {
|
|
646
785
|
const client2 = await this.getClient();
|
|
647
786
|
const response = await client2.put(`/${shopifyAppInstallId}`, updateShopifyAppInstallRequest);
|
|
648
|
-
|
|
787
|
+
log9.info("updateShopifyAppInstall", { response });
|
|
649
788
|
return response;
|
|
650
789
|
};
|
|
651
790
|
getShopifyAppInstall = async (shopifyAppInstallId) => {
|
|
652
791
|
const client2 = await this.getClient();
|
|
653
792
|
const response = await client2.get(`/${shopifyAppInstallId}`);
|
|
654
|
-
|
|
793
|
+
log9.info("getShopifyAppInstall", { response });
|
|
655
794
|
return response;
|
|
656
795
|
};
|
|
657
796
|
getShopifyAppInstallByShop = async (shop) => {
|
|
658
797
|
const client2 = await this.getClient();
|
|
659
798
|
const response = await client2.get(`/?shop=${shop}`);
|
|
660
|
-
|
|
799
|
+
log9.info("getShopifyAppInstallByShop", { response });
|
|
661
800
|
return response;
|
|
662
801
|
};
|
|
663
802
|
};
|
|
664
803
|
|
|
665
804
|
// src/clients/third-party/shopify-client.ts
|
|
666
|
-
import * as
|
|
805
|
+
import * as log10 from "lambda-log";
|
|
667
806
|
var _ShopifyClient = class {
|
|
668
807
|
};
|
|
669
808
|
var ShopifyClient = _ShopifyClient;
|
|
@@ -707,9 +846,9 @@ __publicField(ShopifyClient, "registerWebhookTopic", async (shop, accessToken, e
|
|
|
707
846
|
};
|
|
708
847
|
const res = await client2.post(url, payload, { headers: { "X-Shopify-Access-Token": accessToken } });
|
|
709
848
|
if (res.status >= 400) {
|
|
710
|
-
|
|
849
|
+
log10.error("Failed to register Webhook Topic", { shop, accessToken, eventBridgeArn, topic, url, payload });
|
|
711
850
|
}
|
|
712
|
-
|
|
851
|
+
log10.debug("Shopify Client Webhook Registration Response", { registrationResponse: res });
|
|
713
852
|
return res;
|
|
714
853
|
});
|
|
715
854
|
__publicField(ShopifyClient, "updateShopifyAppMetafield", async (shop, accessToken, pixelId) => {
|
|
@@ -724,7 +863,7 @@ __publicField(ShopifyClient, "updateShopifyAppMetafield", async (shop, accessTok
|
|
|
724
863
|
};
|
|
725
864
|
const res = await _ShopifyClient.genericShopifyPost(url, accessToken, payload);
|
|
726
865
|
if (res.status >= 400) {
|
|
727
|
-
|
|
866
|
+
log10.error("Failed to update Shopify app Metafield ", { shop, accessToken, url, payload });
|
|
728
867
|
}
|
|
729
868
|
return res;
|
|
730
869
|
});
|
|
@@ -732,7 +871,7 @@ __publicField(ShopifyClient, "getShopifyStoreProperties", async (shop, accessTok
|
|
|
732
871
|
const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/shop.json`;
|
|
733
872
|
const res = await _ShopifyClient.genericShopifyGet(url, accessToken);
|
|
734
873
|
if (res.status >= 400) {
|
|
735
|
-
|
|
874
|
+
log10.error("Failed to get Shopify Store Properties", { shop, accessToken, url });
|
|
736
875
|
}
|
|
737
876
|
return res;
|
|
738
877
|
});
|
|
@@ -747,7 +886,7 @@ __publicField(ShopifyClient, "createAppSubscription", async (shop, accessToken,
|
|
|
747
886
|
};
|
|
748
887
|
const res = await _ShopifyClient.genericShopifyPost(url, accessToken, { recurring_application_charge });
|
|
749
888
|
if (res.status >= 400) {
|
|
750
|
-
|
|
889
|
+
log10.error("Failed to create App Subscription", { shop, accessToken, url });
|
|
751
890
|
}
|
|
752
891
|
return res;
|
|
753
892
|
});
|
|
@@ -756,7 +895,7 @@ __publicField(ShopifyClient, "cancelAppSubscription", async (shop, accessToken,
|
|
|
756
895
|
const client2 = axiosHttpService();
|
|
757
896
|
const res = await client2.delete(url, { headers: { "X-Shopify-Access-Token": accessToken } });
|
|
758
897
|
if (res.status !== 200) {
|
|
759
|
-
|
|
898
|
+
log10.error("Failed to cancel recurring App billing", { shop, accessToken, url });
|
|
760
899
|
}
|
|
761
900
|
return res;
|
|
762
901
|
});
|
|
@@ -764,57 +903,57 @@ __publicField(ShopifyClient, "listAppSubscriptions", async (shop, accessToken) =
|
|
|
764
903
|
const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/recurring_application_charges.json`;
|
|
765
904
|
const res = await _ShopifyClient.genericShopifyGet(url, accessToken);
|
|
766
905
|
if (res.status >= 400) {
|
|
767
|
-
|
|
906
|
+
log10.error("Failed to get App Subscriptions", { shop, accessToken, url });
|
|
768
907
|
}
|
|
769
908
|
return res;
|
|
770
909
|
});
|
|
771
910
|
__publicField(ShopifyClient, "genericShopifyPost", async (url, accessToken, payload) => {
|
|
772
911
|
const client2 = axiosHttpService();
|
|
773
912
|
const res = await client2.post(url, payload, { headers: { "X-Shopify-Access-Token": accessToken, "Content-Type": "application/json" } });
|
|
774
|
-
|
|
913
|
+
log10.debug("Shopify Client Response", { res });
|
|
775
914
|
return res;
|
|
776
915
|
});
|
|
777
916
|
__publicField(ShopifyClient, "genericShopifyGet", async (url, accessToken) => {
|
|
778
917
|
const client2 = axiosHttpService();
|
|
779
918
|
const res = await client2.get(url, { headers: { "X-Shopify-Access-Token": accessToken } });
|
|
780
|
-
|
|
919
|
+
log10.debug("Shopify Client Response", { res });
|
|
781
920
|
return res;
|
|
782
921
|
});
|
|
783
922
|
__publicField(ShopifyClient, "genericShopifyPut", async (url, accessToken, payload) => {
|
|
784
923
|
const client2 = axiosHttpService();
|
|
785
924
|
const res = await client2.put(url, payload, { headers: { "X-Shopify-Access-Token": accessToken } });
|
|
786
|
-
|
|
925
|
+
log10.debug("Shopify Client Response", { res });
|
|
787
926
|
return res;
|
|
788
927
|
});
|
|
789
928
|
|
|
790
929
|
// src/helpers/input-validation-helper.ts
|
|
791
|
-
import * as
|
|
930
|
+
import * as log11 from "lambda-log";
|
|
792
931
|
var validateInput = (schema, input) => {
|
|
793
|
-
const { error:
|
|
794
|
-
if (
|
|
795
|
-
|
|
932
|
+
const { error: error7, value } = schema.validate(input);
|
|
933
|
+
if (error7) {
|
|
934
|
+
log11.info("", { error: error7 });
|
|
796
935
|
const httperr = HttpError.badRequest("Bad Request", {
|
|
797
|
-
errors:
|
|
936
|
+
errors: error7.details.map((detail) => ({
|
|
798
937
|
message: detail?.message,
|
|
799
938
|
key: detail?.context?.key,
|
|
800
939
|
path: detail?.path
|
|
801
940
|
}))
|
|
802
941
|
});
|
|
803
|
-
|
|
942
|
+
log11.info("", { httperr });
|
|
804
943
|
throw httperr;
|
|
805
944
|
}
|
|
806
945
|
return value;
|
|
807
946
|
};
|
|
808
947
|
|
|
809
948
|
// src/helpers/logging-helper.ts
|
|
810
|
-
import * as
|
|
949
|
+
import * as log12 from "lambda-log";
|
|
811
950
|
var stage = process?.env?.STAGE;
|
|
812
|
-
var configureLogger = (event, context,
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
951
|
+
var configureLogger = (event, context, debug5 = true) => {
|
|
952
|
+
log12.options.meta.stage = stage;
|
|
953
|
+
log12.options.meta.source_name = context?.functionName || "unknown";
|
|
954
|
+
log12.options.meta.awsRequestId = context?.awsRequestId || "unknown";
|
|
955
|
+
log12.options.meta.lambdaEvent = event;
|
|
956
|
+
log12.options.debug = debug5;
|
|
818
957
|
};
|
|
819
958
|
|
|
820
959
|
// src/helpers/response-helper.ts
|
|
@@ -824,13 +963,13 @@ var success = (body) => {
|
|
|
824
963
|
var defaultError = {
|
|
825
964
|
message: "internalServerError"
|
|
826
965
|
};
|
|
827
|
-
var failure = (
|
|
828
|
-
statusCode =
|
|
966
|
+
var failure = (error7, statusCode = 500) => {
|
|
967
|
+
statusCode = error7?.statusCode ?? statusCode;
|
|
829
968
|
let body = defaultError;
|
|
830
|
-
if (
|
|
831
|
-
body =
|
|
832
|
-
} else if (
|
|
833
|
-
body = { message:
|
|
969
|
+
if (error7?.body) {
|
|
970
|
+
body = error7.body;
|
|
971
|
+
} else if (error7?.message) {
|
|
972
|
+
body = { message: error7.message };
|
|
834
973
|
} else if (statusCode === 500) {
|
|
835
974
|
body = defaultError;
|
|
836
975
|
}
|
|
@@ -1107,6 +1246,7 @@ export {
|
|
|
1107
1246
|
ADTRACKIFY_EVENT_SOURCES,
|
|
1108
1247
|
ADTRACKIFY_EVENT_TYPES,
|
|
1109
1248
|
AccountsClient,
|
|
1249
|
+
CognitoClient,
|
|
1110
1250
|
CommonPlanInfo,
|
|
1111
1251
|
DestinationsClient,
|
|
1112
1252
|
DynamoDbClient,
|
|
@@ -1124,6 +1264,7 @@ export {
|
|
|
1124
1264
|
axiosHttpService,
|
|
1125
1265
|
buildResponse,
|
|
1126
1266
|
configureLogger,
|
|
1267
|
+
dictToAwsAttributes,
|
|
1127
1268
|
failure,
|
|
1128
1269
|
generatePublicKey,
|
|
1129
1270
|
getCurrentDate,
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/clients/generic/dynamodb-client.ts", "../src/clients/generic/eventbridge-client.ts", "../src/libs/dates.ts", "../src/clients/generic/http-client.ts", "../src/clients/generic/s3-client.ts", "../src/clients/internal-api/destinations-client.ts", "../src/clients/internal-api/accounts-client.ts", "../src/clients/internal-api/users-auth-client.ts", "../src/helpers/shopify-helper.ts", "../src/libs/url.ts", "../src/libs/crypto.ts", "../src/libs/http-error.ts", "../src/libs/http-status-codes.ts", "../src/clients/internal-api/shopify-app-install-client.ts", "../src/clients/third-party/shopify-client.ts", "../src/helpers/input-validation-helper.ts", "../src/helpers/logging-helper.ts", "../src/helpers/response-helper.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/api/account.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/api/destinations/destinations.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/api/destinations/third-party-destination-configs.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/api/shopify-app-install.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/api/subscription.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/adtrackify-standard-events.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/tracking-events/tracking-event-type.ts", "../src/helpers/subscription-helper.ts", "../src/types/internal-events/event-detail-types.ts", "../src/services/eventbridge-integration-service.ts"],
|
|
4
|
-
"sourcesContent": ["import { DynamoDBClient, QueryOutput } from '@aws-sdk/client-dynamodb';\nimport { DynamoDBDocument } from '@aws-sdk/lib-dynamodb';\nimport * as log from 'lambda-log';\n\nconst marshallOptions = {\n convertEmptyValues: false,\n removeUndefinedValues: false,\n convertClassInstanceToMap: true\n};\n\nconst unmarshallOptions = {\n wrapNumbers: false,\n};\n\nconst translateConfig = { marshallOptions, unmarshallOptions };\nconst ddbClient = new DynamoDBClient({});\nconst client = DynamoDBDocument.from(ddbClient, translateConfig);\n\nexport class DynamoDbClient {\n static safeGet = async (tableName: string, keyName: string, keyValue: any) => {\n try {\n const params = {\n TableName: tableName,\n Key: {\n [ keyName ]: keyValue\n }\n };\n const res = await client.get(params);\n return res?.Item ?? null;\n } catch (e: any) {\n log.error(e, { message: 'Dynamo Client Get Failed' });\n return null;\n }\n };\n\n static safePut = async (tableName: string, data: any) => {\n try {\n const params = {\n TableName: tableName,\n Item: data\n };\n const res = await client.put(params);\n return res;\n } catch (e: any) {\n log.error(e, { message: 'Dynamo failed simplePut' });\n return null;\n }\n };\n\n static safeDelete = async (tableName: string, keyName: string, keyValue: any) => {\n try {\n const params = {\n TableName: tableName,\n Key: {\n [ keyName ]: keyValue\n }\n };\n const res = await client.delete(params);\n return res;\n } catch (e: any) {\n log.error(e, { message: 'Dynamo failed safeDelete' });\n return null;\n }\n };\n\n static safeQueryByGSI = async (tableName: string, gsiName: string, keyName: string, keyValue: any) => {\n const query = {\n TableName: tableName,\n IndexName: gsiName,\n KeyConditionExpression: `${keyName} = :value`,\n ExpressionAttributeValues: {\n ':value': keyValue\n }\n };\n const results = await DynamoDbClient.queryAll(query);\n return results;\n };\n\n static safeBatchGet = async (tableName: string, keys: any) => {\n try {\n const params: any = {\n RequestItems: {}\n };\n params.RequestItems[ tableName ] = {\n Keys: keys\n };\n const res = await client.batchGet(params);\n log.info('batchget res', { batchGetRes: res });\n if (res?.Responses?.[ tableName ]) {\n return res?.Responses?.[ tableName ];\n }\n return [];\n } catch (e: any) {\n log.error(e, { message: 'Dynamo failed safeBatchGet' });\n return [];\n }\n };\n\n static queryAll = async (params: any) => {\n try {\n log.info('Invoke Query All', { params });\n let currentResult: QueryOutput, exclusiveStartKey;\n let accumulatedResults: any[] = [];\n do {\n params.ExclusiveStartKey = exclusiveStartKey;\n params.Limit = 200;\n currentResult = await client.query(params);\n if (currentResult.Items) {\n exclusiveStartKey = currentResult.LastEvaluatedKey;\n accumulatedResults = [ ...accumulatedResults, ...currentResult.Items ];\n }\n } while (currentResult.Items && currentResult.Items.length > 0 && currentResult.LastEvaluatedKey);\n return accumulatedResults;\n } catch (e: any) {\n log.error(e, { message: 'Dynamo failed queryAll' });\n return null;\n }\n };\n\n static batchGet = (params: any) => client.batchGet(params);\n static get = (params: any) => client.get(params);\n static put = (params: any) => client.put(params);\n static query = (params: any) => client.query(params);\n static scan = (params: any) => client.scan(params);\n static update = (params: any) => client.update(params);\n static delete = (params: any) => client.delete(params);\n}", "import { EventBridgeClient as EventBridge, PutEventsCommand, PutEventsCommandInput } from '@aws-sdk/client-eventbridge';\nimport { v4 as uuidv4 } from 'uuid';\nimport { getCurrentTimestamp } from '../../libs/dates';\nimport * as log from 'lambda-log';\n\nexport class EventBridgeClient {\n public eventBridge: EventBridge;\n public EVENT_BUS_NAME: string;\n\n constructor (eventBusName: string) {\n this.eventBridge = new EventBridge({});\n this.EVENT_BUS_NAME = eventBusName;\n }\n\n public buildAndSendEvent = async (eventSource: string, eventType: string, eventData: any) => {\n const event = this.buildEvent(eventType, eventData);\n return await this.putEvent(eventSource, eventType, event);\n };\n\n public buildEvent = (eventType: string, eventData: any, eventId: string = uuidv4(), eventTime: string = getCurrentTimestamp()) => {\n return {\n eventId,\n eventType,\n eventTime,\n eventData\n };\n };\n\n public putEvent = async (source: string, detailType: string, data: any, headers: any = null) => {\n const params: PutEventsCommandInput = {\n Entries: [ {\n Detail: JSON.stringify({ headers, data }),\n DetailType: detailType,\n EventBusName: this.EVENT_BUS_NAME,\n Source: source,\n Time: new Date(),\n } ],\n };\n const putEventscommand = new PutEventsCommand(params);\n const response = await this.eventBridge.send(putEventscommand);\n log.debug('EventBus Event Published',\n {\n eventBusName: this.EVENT_BUS_NAME,\n eventSource: source,\n eventType: detailType,\n event: data,\n response\n });\n return response;\n };\n\n}\n\n", "\nimport { DateTime } from 'luxon';\n\nexport const getCurrentTimestamp = (): string => {\n return DateTime.utc().toJSDate().toISOString();\n}\n\nexport const getDateFromTimestamp = (timestamp: string) => {\n return timestamp.split('T')[0];\n}\n\nexport const getCurrentDate = (): string => {\n return getDateFromTimestamp(getCurrentTimestamp());\n}", "import axios from 'axios';\nimport axiosRetry from 'axios-retry';\nimport https from 'https';\nimport httpAdapter from 'axios/lib/adapters/http';\n\nconst httpResponse = (res: any = {}) => {\n return {\n headers: res?.header || {},\n data: res?.data || {},\n status: res?.status || 0,\n };\n};\n\nconst handleAxiosError = (error: any) => {\n if (!error?.response && !error?.request) throw error;\n return error.response ? httpResponse(error.response) : httpResponse({ status: 500, data: { error: error.request } });\n};\n\nexport const axiosHttpService = (config: any = {}) => {\n config.adapter = httpAdapter;\n config.httpsAgent = new https.Agent({ keepAlive: true });\n const axiosService = axios.create(config);\n\n axiosRetry(axiosService, { retryDelay: axiosRetry.exponentialDelay, retries: 3 });\n\n return {\n instance: () => axiosService,\n get: (url: string, config?: any) => axiosService.get(url, config).then(httpResponse, handleAxiosError),\n post: (url: string, data?: any, config?: any) => axiosService.post(url, data, config).then(httpResponse, handleAxiosError),\n delete: (url: string, config?: any) => axiosService.delete(url, config).then(httpResponse, handleAxiosError),\n put: (url: string, data?: any, config?: any) => axiosService.put(url, data, config).then(httpResponse, handleAxiosError),\n patch: (url: string, data?: any, config?: any) => axiosService.patch(url, data, config).then(httpResponse, handleAxiosError),\n setBaseUrl: (url: string) => !!(axiosService.defaults.baseURL = url)\n };\n};\n", "import { S3 } from '@aws-sdk/client-s3';\nimport * as log from 'lambda-log';\n\nexport class S3Client {\n s3: S3;\n\n constructor(accessKeyId: string, secretAccessKey: string){\n this.s3 = new S3({\n credentials: {\n accessKeyId,\n secretAccessKey\n }\n })\n }\n\n async uploadJson(path: string, bucket: string, jsonData: any){\n try {\n const res = await this.s3.putObject({\n Bucket: bucket,\n ContentType: 'application/json; charset=utf-8',\n Body: JSON.stringify(jsonData),\n Key: path\n });\n\n return res;\n } catch (error) {\n log.error('Error in s3 upload json', { error });\n return error;\n }\n }\n}", "import * as log from 'lambda-log';\n//const log = require('lambda-log');\nimport { ApiResponse } from '../../types/api-response';\nimport { axiosHttpService } from '../generic/http-client';\nimport { Destination } from '@adtrackify/at-tracking-event-types';\n//const BASE_API_URL = process.env.BASE_API_URL;\n//const DESTINATIONS_API_KEY = process.env.DESTINATIONS_API_KEY;\n\nexport interface GetDestinationsResponseData {\n destinations: Destination[];\n [ key: string ]: any;\n}\nexport interface CreateDestinationResponseData {\n destination: Destination;\n [ key: string ]: any;\n}\n\n\nexport class DestinationsClient {\n\n public BASE_API_URL: string;\n public DESTINATIONS_API_KEY: string;\n\n constructor (baseApiUrl: string, destinationsApiKey: string) {\n this.BASE_API_URL = baseApiUrl;\n this.DESTINATIONS_API_KEY = destinationsApiKey;\n }\n\n getConfig = () => {\n const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/destinations`;\n return {\n baseURL: SERVICE_API_ROOT_URL,\n headers: {\n common: {\n 'x-api-key': this.DESTINATIONS_API_KEY\n }\n }\n };\n };\n\n getClient = async () => {\n return axiosHttpService(this.getConfig());\n };\n\n createDestination = async (createDestinationRequest: any): Promise<ApiResponse<CreateDestinationResponseData>> => {\n const client = await this.getClient();\n const response = await client.post('/', createDestinationRequest);\n log.info('createDestinationResponse', { response });\n return response as ApiResponse<CreateDestinationResponseData>;\n };\n\n getPixelDestinations = async (pixelId: string): Promise<ApiResponse<GetDestinationsResponseData>> => {\n const client = await this.getClient();\n const response = await client.get(`/?pixelId=${pixelId}`);\n log.info('getPixelResponse', { response });\n return response as ApiResponse<GetDestinationsResponseData>;\n };\n}\n", "import * as log from 'lambda-log';\nimport { ApiResponse } from '../../types/api-response';\nimport { Account, ACCOUNT_STATUS, Destination } from '@adtrackify/at-tracking-event-types';\nimport { axiosHttpService } from '../generic/http-client';\n\n//const BASE_API_URL = process.env.BASE_API_URL;\n\n//const SERVICE_API_ROOT_URL = `${BASE_API_URL}/accounts`;\n//const ACCOUNTS_API_KEY = process.env.ACCOUNTS_API_KEY;\n\nexport interface AccountResponseData {\n account: Account;\n [ key: string ]: any;\n}\n\nexport interface IsAuthorizedUserResponseData {\n isAccountUser: boolean;\n [ key: string ]: any;\n}\nexport interface PixelConfigResponseData {\n id: string;\n destinations: Destination[];\n [ key: string ]: any;\n}\nexport interface AddUserToAccountResponseData {\n userId: string;\n accountId: string;\n}\n\nexport interface UpdateAccountRequest {\n accountName?: string,\n companyName?: string,\n primaryEmail?: string,\n ownerId?: string,\n subscriptionId?: string,\n accountStatus?: ACCOUNT_STATUS;\n}\n\nexport class AccountsClient {\n public BASE_API_URL: string;\n public ACCOUNTS_API_KEY?: string;\n\n constructor (baseApiUrl: string, accountsApiKey?: string) {\n this.BASE_API_URL = baseApiUrl;\n this.ACCOUNTS_API_KEY = accountsApiKey;\n }\n\n getConfig = () => {\n const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/accounts`;\n const params: any = {\n baseURL: SERVICE_API_ROOT_URL\n };\n if (this.ACCOUNTS_API_KEY) {\n params.headers = {\n common: {\n 'x-api-key': this.ACCOUNTS_API_KEY\n }\n };\n }\n return params;\n };\n\n getClient = async () => {\n return axiosHttpService(this.getConfig());\n };\n\n createAccount = async (createAccountRequest: any) => {\n const client = await this.getClient();\n const createAccountResponse = await client.post('', createAccountRequest);\n log.info('createAccountResponse', { createAccountResponse });\n return createAccountResponse;\n };\n updateAccount = async (accountId: string, body: any): Promise<ApiResponse<AccountResponseData>> => {\n const client = await this.getClient();\n const response = await client.patch(`/${accountId}/`, body);\n log.info('update Account response', { response });\n return response as ApiResponse<AccountResponseData>;\n };\n addOwner = async (accountId: string, userId: string) => {\n const client = await this.getClient();\n const addOwnerResponse = await client.post('/addOwner', { accountId, userId });\n log.info('addOwnerResponse', { addOwnerResponse });\n return addOwnerResponse;\n };\n isAuthorizedUser = async (userId: string, accountId: string, pixelId?: string): Promise<ApiResponse<IsAuthorizedUserResponseData>> => {\n const client = await this.getClient();\n const body = {\n userId, accountId, pixelId\n };\n const response = await client.post('/checkUserAuthorization', body);\n log.info('checkUserAuthorization', { response });\n return response as ApiResponse<IsAuthorizedUserResponseData>;\n };\n adminDeleteAccount = async (accountId: string) => {\n const client = await this.getClient();\n const success = await client.delete(`/${accountId}`);\n log.info('adminDeleteAccount');\n return success;\n };\n getPixelConfigById = async (pixelId: string): Promise<ApiResponse<PixelConfigResponseData>> => {\n const client = await this.getClient();\n const pixelResponse = await client.get(`/px/${pixelId}/config`);\n log.debug('get pixelResponse', { pixelResponse });\n return pixelResponse;\n };\n getAccount = async (accountId: string): Promise<ApiResponse<AccountResponseData>> => {\n const client = await this.getClient();\n const response = await client.get(`/${accountId}/`);\n log.info('get account response', { response });\n return response as ApiResponse<AccountResponseData>;\n };\n addUserToAccount = async (accountId: string, userId: string): Promise<ApiResponse<AddUserToAccountResponseData>> => {\n const client = await this.getClient();\n const response = await client.post('/addUser', { accountId, userId });\n log.info('add user account response', { response });\n return response as ApiResponse<AddUserToAccountResponseData>;\n };\n\n\n // setAccountSubscriptionId = async (accountId: string, subscriptionId: string): Promise<ApiResponse<any>> => {\n // const client = await this.getClient();\n // const pixelResponse = await client.get(`/px/${pixelId}/config`);\n // log.debug('pixelResponse', { pixelResponse });\n // return pixelResponse;\n // };\n}", "import { User } from '@adtrackify/at-tracking-event-types';\nimport * as log from 'lambda-log';\nimport { HttpError, HttpStatusCodes } from '../../libs';\nimport { ApiResponse } from '../../types/api-response';\nimport { axiosHttpService } from '../generic/http-client';\n\nexport interface UserResponseData {\n user: User;\n [ key: string ]: any;\n}\n\nexport interface UserSignupRequest {\n email: string,\n password: string,\n givenName: string,\n familyName: string;\n}\n\nexport class UsersAuthClient {\n\n public SERVICE_API_ROOT_URL: string;\n public BASE_API_URL: string;\n public USERS_AUTH_API_KEY: string;\n constructor (baseApiUrl: string, usersAuthApiKey?: string) {\n this.BASE_API_URL = baseApiUrl;\n this.USERS_AUTH_API_KEY = usersAuthApiKey as string;\n this.SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/auth`;\n }\n\n getConfig = () => {\n return {\n baseURL: this.SERVICE_API_ROOT_URL,\n headers: {\n common: {\n }\n }\n };\n };\n\n getClient = async () => {\n return axiosHttpService(this.getConfig());\n };\n\n signupAndConfirmUser = async (userSignupRequest: any): Promise<any> => {\n const user = await this.signupUser(userSignupRequest);\n await this.adminConfirmUser(user.email);\n // if fail - delete user and throw error\n return user;\n };\n\n signupUser = async (userSignupRequest: UserSignupRequest): Promise<any> => {\n log.info('Attempting to signup user', { email: userSignupRequest.email });\n\n const client = await this.getClient();\n const response = await client.post('/signup', userSignupRequest);\n\n // Check if Successful or throw error\n if (response.status !== 200 || !response?.data?.user) {\n const message = 'User Signup Failed';\n log.error(message, { response });\n throw new HttpError(HttpStatusCodes.INTERNAL_SERVER_ERROR, message);\n }\n\n log.info('User Signup Successful', { response });\n return response.data.user;\n };\n\n //userName is same as user id\n adminConfirmUser = async (email: string) => {\n //confirm user\n //@TODO update user auth service with admin confirm user endpoint\n log.info('Attempting to admin confirm user', { email });\n\n const client = await this.getClient();\n const response = await client.post('/admin/confirm',\n {\n email\n }, {\n headers: {\n 'x-api-key': this.USERS_AUTH_API_KEY\n }\n }\n );\n\n // Check if Successful or throw error\n if (response.status !== 200) {\n const message = 'Admin User Confirmation Failed';\n log.error(message, { response });\n throw new HttpError(HttpStatusCodes.INTERNAL_SERVER_ERROR, message);\n }\n\n log.info('Admin User Confirmation Successful', { response });\n return response;\n };\n\n getUserByEmail = async (email: string): Promise<ApiResponse<UserResponseData>> => {\n const client = await this.getClient();\n const getUserResponse = await client.get('/lookup', {\n headers: {\n 'x-api-key': this.USERS_AUTH_API_KEY\n },\n params: {\n email\n }\n });\n log.info('getUserResponse', { getUserResponse });\n return getUserResponse;\n };\n\n}\n\n", "import { createHmac } from 'crypto';\nimport * as log from 'lambda-log';\nimport { HttpError } from '../libs';\nimport { mapObjectToQueryString } from '../libs/url';\nexport interface ShopifyRequestValidationParameters {\n code: string,\n hmac?: string,\n shop: string,\n state: string,\n timestamp: string;\n}\n\nexport const isShopifyRequestValid = (validationParams: ShopifyRequestValidationParameters, validationHmac: string, shopifyAppApiSecret: string): boolean => {\n // remove hmac if it exists\n // map input to query string\n // generate hash using api secret key and validate it matches hmac\n delete validationParams.hmac;\n const hmacString = mapObjectToQueryString(validationParams);\n\n\n const generatedHash = createHmac('sha256', shopifyAppApiSecret)\n .update(hmacString)\n .digest('hex');\n\n return generatedHash === validationHmac;\n};\n\nexport const validateShopifyRequest = (validationParams: ShopifyRequestValidationParameters, validationHmac: string, shopifyAppApiSecret: string) => {\n log.info('Validating shopify request is authentic', { validationParams });\n const isValid = isShopifyRequestValid(validationParams, validationHmac as string, shopifyAppApiSecret);\n if (!isValid) {\n const message = 'Failed: Shopify Request hmac validation';\n log.error(message);\n throw HttpError.badRequest(message);\n }\n log.info('Sucess: Shopify Request hmac validation');\n return true;\n}\n\n", "// Record<string, string> is any object\nexport const mapObjectToQueryString = (inputObj: any): string => {\n const qsp = Object.entries(inputObj).sort((a, b) => a[ 0 ] < b[ 0 ] ? -1 : 1);\n const urlParams = new URLSearchParams();\n qsp.map(p => {\n urlParams.append(p[ 0 ], p[ 1 ] as string);\n });\n const qs = urlParams.toString();\n return qs;\n};", "import crypto from 'crypto';\n\nexport const generatePublicKey = (): string => {\n const publicKey = crypto.randomBytes(26);\n return publicKey.toString('utf8');\n};", "/* eslint-disable no-dupe-class-members */\nimport { strict as assert } from 'assert';\n\nconst deepClone = (o = {}) => JSON.parse(JSON.stringify(o));\nconst containsStackTrace = (text = '') => /at.+\\.js:\\d+:\\d+/.test(text);\nconst objectContainsStackTrace = (obj: any) =>\n !obj ? false : containsStackTrace(JSON.stringify(obj));\n\n// may only be expanded by governance, never reduced\nconst supportedStatusCodes: any = {\n 400: 'Bad Request',\n 401: 'Unauthorized',\n 403: 'Forbidden',\n 404: 'Not Found',\n 405: 'Method Not Allowed',\n 409: 'Conflict',\n 412: 'Precondition Failed',\n 413: 'Payload Too Large',\n 415: 'Unsupported Media Type',\n 428: 'Precondition Required',\n 429: 'Too Many Requests',\n 500: 'Internal Server Error',\n 501: 'Not Implemented',\n 502: 'Bad Gateway',\n 503: 'Service Unavailable',\n 504: 'Gateway Timeout'\n};\n\nconst supportedStatusCodesMessage = `statusCode must be one of the following: ${JSON.stringify(Object.keys(supportedStatusCodes))}`;\n//const onlyStatusCodeMessage = 'Server errors may not specify any parameter except statusCode';\n\n//const isNullOrUndefined = (value: any) => value === null || value === undefined;\n\nexport class HttpError extends Error {\n body: {\n [ key: string ]: any;\n };\n headers: object[];\n statusCode: number;\n isServerError: boolean;\n\n constructor (statusCode: number,\n message?: string,\n body?: {\n [ key: string ]: any;\n },\n headers?: object[]) {\n assert(statusCode in supportedStatusCodes, supportedStatusCodesMessage);\n\n const isServerError = statusCode > 499;\n\n assert(\n body === undefined || typeof body === 'object',\n 'body must be an object or omitted'\n );\n assert(\n headers === undefined || typeof headers === 'object',\n 'headers must be an object or omitted'\n );\n\n message = message ?? supportedStatusCodes[ statusCode ];\n\n assert(\n !containsStackTrace(message) && !objectContainsStackTrace(body),\n 'the message or data parameters may not contain errors or stack traces'\n );\n\n super(message);\n\n this.body = deepClone(body);\n this.headers = deepClone(headers);\n this.statusCode = statusCode;\n this.isServerError = isServerError;\n if (!this?.body?.message) {\n this.body.message = this.message;\n }\n }\n\n\n static get supportedStatusCodes() { return supportedStatusCodes; }\n static badRequest = (message?: string, body?: object, headers?: object[]) => { return new HttpError(400, message, body, headers); };\n static unauthorized = (message?: string, body?: object, headers?: object[]) => new HttpError(401, message, body, headers);\n static forbidden = (message?: string, body?: object, headers?: object[]) => new HttpError(403, message, body, headers);\n static notFound = (message?: string, body?: object, headers?: object[]) => new HttpError(404, message, body, headers);\n static internal = (message?: string, body?: object, headers?: object[]) => new HttpError(500, message, body, headers);\n static notImplemented = () => new HttpError(501);\n static badGateway = () => new HttpError(502);\n static serviceUnavailable = (headers: object[]) => new HttpError(503, undefined, undefined, headers);\n static gatewayTimeout = () => new HttpError(504);\n}\n", "export enum HttpStatusCodes {\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.1\n *\n * This interim response indicates that everything so far is OK and that the client should continue with the request or ignore it if it is already finished.\n */\n CONTINUE = 100,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.2\n *\n * This code is sent in response to an Upgrade request header by the client, and indicates the protocol the server is switching too.\n */\n SWITCHING_PROTOCOLS = 101,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.1\n *\n * This code indicates that the server has received and is processing the request, but no response is available yet.\n */\n PROCESSING = 102,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.1\n *\n * The request has succeeded. The meaning of a success varies depending on the HTTP method:\n * GET: The resource has been fetched and is transmitted in the message body.\n * HEAD: The entity headers are in the message body.\n * POST: The resource describing the result of the action is transmitted in the message body.\n * TRACE: The message body contains the request message as received by the server\n */\n OK = 200,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.2\n *\n * The request has succeeded and a new resource has been created as a result of it. This is typically the response sent after a PUT request.\n */\n CREATED = 201,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.3\n *\n * The request has been received but not yet acted upon. It is non-committal, meaning that there is no way in HTTP to later send an asynchronous response indicating the outcome of processing the request. It is intended for cases where another process or server handles the request, or for batch processing.\n */\n ACCEPTED = 202,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.4\n *\n * This response code means returned meta-information set is not exact set as available from the origin server, but collected from a local or a third party copy. Except this condition, 200 OK response should be preferred instead of this response.\n */\n NON_AUTHORITATIVE_INFORMATION = 203,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.5\n *\n * There is no content to send for this request, but the headers may be useful. The user-agent may update its cached headers for this resource with the new ones.\n */\n NO_CONTENT = 204,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.6\n *\n * This response code is sent after accomplishing request to tell user agent reset document view which sent this request.\n */\n RESET_CONTENT = 205,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7233#section-4.1\n *\n * This response code is used because of range header sent by the client to separate download into multiple streams.\n */\n PARTIAL_CONTENT = 206,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.2\n *\n * A Multi-Status response conveys information about multiple resources in situations where multiple status codes might be appropriate.\n */\n MULTI_STATUS = 207,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.1\n *\n * The request has more than one possible responses. User-agent or user should choose one of them. There is no standardized way to choose one of the responses.\n */\n MULTIPLE_CHOICES = 300,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.2\n *\n * This response code means that URI of requested resource has been changed. Probably, new URI would be given in the response.\n */\n MOVED_PERMANENTLY = 301,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.3\n *\n * This response code means that URI of requested resource has been changed temporarily. New changes in the URI might be made in the future. Therefore, this same URI should be used by the client in future requests.\n */\n MOVED_TEMPORARILY = 302,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.4\n *\n * Server sent this response to directing client to get requested resource to another URI with an GET request.\n */\n SEE_OTHER = 303,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7232#section-4.1\n *\n * This is used for caching purposes. It is telling to client that response has not been modified. So, client can continue to use same cached version of response.\n */\n NOT_MODIFIED = 304,\n /**\n * @deprecated\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.6\n *\n * Was defined in a previous version of the HTTP specification to indicate that a requested response must be accessed by a proxy. It has been deprecated due to security concerns regarding in-band configuration of a proxy.\n */\n USE_PROXY = 305,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.7\n *\n * Server sent this response to directing client to get requested resource to another URI with same method that used prior request. This has the same semantic than the 302 Found HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request.\n */\n TEMPORARY_REDIRECT = 307,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7538#section-3\n *\n * This means that the resource is now permanently located at another URI, specified by the Location: HTTP Response header. This has the same semantics as the 301 Moved Permanently HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request.\n */\n PERMANENT_REDIRECT = 308,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.1\n *\n * This response means that server could not understand the request due to invalid syntax.\n */\n BAD_REQUEST = 400,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7235#section-3.1\n *\n * Although the HTTP standard specifies \"unauthorized\", semantically this response means \"unauthenticated\". That is, the client must authenticate itself to get the requested response.\n */\n UNAUTHORIZED = 401,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.2\n *\n * This response code is reserved for future use. Initial aim for creating this code was using it for digital payment systems however this is not used currently.\n */\n PAYMENT_REQUIRED = 402,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.3\n *\n * The client does not have access rights to the content, i.e. they are unauthorized, so server is rejecting to give proper response. Unlike 401, the client's identity is known to the server.\n */\n FORBIDDEN = 403,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.4\n *\n * The server can not find requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 to hide the existence of a resource from an unauthorized client. This response code is probably the most famous one due to its frequent occurence on the web.\n */\n NOT_FOUND = 404,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.5\n *\n * The request method is known by the server but has been disabled and cannot be used. For example, an API may forbid DELETE-ing a resource. The two mandatory methods, GET and HEAD, must never be disabled and should not return this error code.\n */\n METHOD_NOT_ALLOWED = 405,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.6\n *\n * This response is sent when the web server, after performing server-driven content negotiation, doesn't find any content following the criteria given by the user agent.\n */\n NOT_ACCEPTABLE = 406,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7235#section-3.2\n *\n * This is similar to 401 but authentication is needed to be done by a proxy.\n */\n PROXY_AUTHENTICATION_REQUIRED = 407,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.7\n *\n * This response is sent on an idle connection by some servers, even without any previous request by the client. It means that the server would like to shut down this unused connection. This response is used much more since some browsers, like Chrome, Firefox 27+, or IE9, use HTTP pre-connection mechanisms to speed up surfing. Also note that some servers merely shut down the connection without sending this message.\n */\n REQUEST_TIMEOUT = 408,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.8\n *\n * This response is sent when a request conflicts with the current state of the server.\n */\n CONFLICT = 409,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.9\n *\n * This response would be sent when the requested content has been permenantly deleted from server, with no forwarding address. Clients are expected to remove their caches and links to the resource. The HTTP specification intends this status code to be used for \"limited-time, promotional services\". APIs should not feel compelled to indicate resources that have been deleted with this status code.\n */\n GONE = 410,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.10\n *\n * The server rejected the request because the Content-Length header field is not defined and the server requires it.\n */\n LENGTH_REQUIRED = 411,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7232#section-4.2\n *\n * The client has indicated preconditions in its headers which the server does not meet.\n */\n PRECONDITION_FAILED = 412,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.11\n *\n * Request entity is larger than limits defined by server; the server might close the connection or return an Retry-After header field.\n */\n REQUEST_TOO_LONG = 413,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.12\n *\n * The URI requested by the client is longer than the server is willing to interpret.\n */\n REQUEST_URI_TOO_LONG = 414,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.13\n *\n * The media format of the requested data is not supported by the server, so the server is rejecting the request.\n */\n UNSUPPORTED_MEDIA_TYPE = 415,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7233#section-4.4\n *\n * The range specified by the Range header field in the request can't be fulfilled; it's possible that the range is outside the size of the target URI's data.\n */\n REQUESTED_RANGE_NOT_SATISFIABLE = 416,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.14\n *\n * This response code means the expectation indicated by the Expect request header field can't be met by the server.\n */\n EXPECTATION_FAILED = 417,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2324#section-2.3.2\n *\n * Any attempt to brew coffee with a teapot should result in the error code \"418 I'm a teapot\". The resulting entity body MAY be short and stout.\n */\n IM_A_TEAPOT = 418,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.6\n *\n * The 507 (Insufficient Storage) status code means the method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request. This condition is considered to be temporary. If the request which received this status code was the result of a user action, the request MUST NOT be repeated until it is requested by a separate user action.\n */\n INSUFFICIENT_SPACE_ON_RESOURCE = 419,\n /**\n * @deprecated\n * Official Documentation @ https://tools.ietf.org/rfcdiff?difftype=--hwdiff&url2=draft-ietf-webdav-protocol-06.txt\n *\n * A deprecated response used by the Spring Framework when a method has failed.\n */\n METHOD_FAILURE = 420,\n /**\n * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7540#section-9.1.2\n *\n * Defined in the specification of HTTP/2 to indicate that a server is not able to produce a response for the combination of scheme and authority that are included in the request URI.\n */\n MISDIRECTED_REQUEST = 421,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.3\n *\n * The request was well-formed but was unable to be followed due to semantic errors.\n */\n UNPROCESSABLE_ENTITY = 422,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.4\n *\n * The resource that is being accessed is locked.\n */\n LOCKED = 423,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.5\n *\n * The request failed due to failure of a previous request.\n */\n FAILED_DEPENDENCY = 424,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-3\n *\n * The origin server requires the request to be conditional. Intended to prevent the 'lost update' problem, where a client GETs a resource's state, modifies it, and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict.\n */\n PRECONDITION_REQUIRED = 428,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-4\n *\n * The user has sent too many requests in a given amount of time (\"rate limiting\").\n */\n TOO_MANY_REQUESTS = 429,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-5\n *\n * The server is unwilling to process the request because its header fields are too large. The request MAY be resubmitted after reducing the size of the request header fields.\n */\n REQUEST_HEADER_FIELDS_TOO_LARGE = 431,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7725\n *\n * The user-agent requested a resource that cannot legally be provided, such as a web page censored by a government.\n */\n UNAVAILABLE_FOR_LEGAL_REASONS = 451,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.1\n *\n * The server encountered an unexpected condition that prevented it from fulfilling the request.\n */\n INTERNAL_SERVER_ERROR = 500,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.2\n *\n * The request method is not supported by the server and cannot be handled. The only methods that servers are required to support (and therefore that must not return this code) are GET and HEAD.\n */\n NOT_IMPLEMENTED = 501,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.3\n *\n * This error response means that the server, while working as a gateway to get a response needed to handle the request, got an invalid response.\n */\n BAD_GATEWAY = 502,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.4\n *\n * The server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded. Note that together with this response, a user-friendly page explaining the problem should be sent. This responses should be used for temporary conditions and the Retry-After: HTTP header should, if possible, contain the estimated time before the recovery of the service. The webmaster must also take care about the caching-related headers that are sent along with this response, as these temporary condition responses should usually not be cached.\n */\n SERVICE_UNAVAILABLE = 503,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.5\n *\n * This error response is given when the server is acting as a gateway and cannot get a response in time.\n */\n GATEWAY_TIMEOUT = 504,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.6\n *\n * The HTTP version used in the request is not supported by the server.\n */\n HTTP_VERSION_NOT_SUPPORTED = 505,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.6\n *\n * The server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process.\n */\n INSUFFICIENT_STORAGE = 507,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-6\n *\n * The 511 status code indicates that the client needs to authenticate to gain network access.\n */\n NETWORK_AUTHENTICATION_REQUIRED = 511\n}", "import log from 'lambda-log';\nimport { ApiResponse } from '../../types/api-response';\nimport { axiosHttpService } from '../generic/http-client';\nimport { ShopifyAppInstall, ShopifyAppSubscriptionStatus } from '@adtrackify/at-tracking-event-types';\n//const BASE_API_URL = process.env.BASE_API_URL;\n//const DESTINATIONS_API_KEY = process.env.DESTINATIONS_API_KEY;\n\nexport interface ShopifyAppInstallResponseData {\n shopifyAppInstall: ShopifyAppInstall;\n [ key: string ]: any;\n}\n\nexport interface UpdateShopifyAppInstallRequest {\n appSubscriptionStatus?: ShopifyAppSubscriptionStatus,\n pixelId?: string,\n shopifyAppInstallId: string;\n isAppEnabled?: boolean;\n}\n\nexport class ShopifyAppInstallClient {\n\n public BASE_API_URL: string;\n public SHOPIFY_APP_INSTALL_API_KEY: string;\n\n constructor (baseApiUrl: string, shopifyAppInstallApiKey: string) {\n this.BASE_API_URL = baseApiUrl;\n this.SHOPIFY_APP_INSTALL_API_KEY = shopifyAppInstallApiKey;\n }\n\n getConfig = () => {\n const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/shopify-app-installs`;\n return {\n baseURL: SERVICE_API_ROOT_URL,\n headers: {\n common: {\n 'x-api-key': this.SHOPIFY_APP_INSTALL_API_KEY\n }\n }\n };\n };\n\n getClient = async () => {\n return axiosHttpService(this.getConfig());\n };\n\n updateShopifyAppInstall = async (shopifyAppInstallId: string, updateShopifyAppInstallRequest: UpdateShopifyAppInstallRequest): Promise<ApiResponse<ShopifyAppInstallResponseData>> => {\n const client = await this.getClient();\n const response = await client.put(`/${shopifyAppInstallId}`, updateShopifyAppInstallRequest);\n log.info('updateShopifyAppInstall', { response });\n return response as ApiResponse<ShopifyAppInstallResponseData>;\n };\n\n getShopifyAppInstall = async (shopifyAppInstallId: string): Promise<ApiResponse<ShopifyAppInstallResponseData>> => {\n const client = await this.getClient();\n const response = await client.get(`/${shopifyAppInstallId}`);\n log.info('getShopifyAppInstall', { response });\n return response as ApiResponse<ShopifyAppInstallResponseData>;\n };\n\n getShopifyAppInstallByShop = async (shop: string): Promise<ApiResponse<ShopifyAppInstallResponseData>> => {\n const client = await this.getClient();\n const response = await client.get(`/?shop=${shop}`);\n log.info('getShopifyAppInstallByShop', { response });\n return response as ApiResponse<ShopifyAppInstallResponseData>; \n }\n}\n", "import { axiosHttpService } from '../generic/http-client';\nimport * as log from 'lambda-log';\n\nexport class ShopifyClient {\n static _shopify_api_version = process.env.SHOPIFY_API_VERSION as string;\n static getConfig = (shopifyDomain: string, accessToken: string) => {\n const config = {\n baseURL: `https://${shopifyDomain}/admin/api/${this._shopify_api_version}`,\n headers: {\n common: {\n 'X-Shopify-Access-Token': accessToken,\n },\n },\n };\n return config;\n };\n\n static getClient = (shopifyDomain: string, accessToken: string) => {\n return axiosHttpService(\n this.getConfig(shopifyDomain, accessToken)\n );\n };\n\n static registerApp = async (shop: string, code: string, appKey: string, appSecret: string) => {\n const client = axiosHttpService();\n const url = 'https://' + shop + '/admin/oauth/access_token';\n const payload = {\n client_id: appKey,\n client_secret: appSecret,\n code\n };\n const res = await client.post(url, payload);\n return res;\n };\n\n static registerWebhookTopic = async (shop: string, accessToken: string, eventBridgeArn: string, topic: string) => {\n const client = axiosHttpService();\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/webhooks.json`;\n const payload = {\n webhook: {\n topic,\n address: eventBridgeArn,\n format: 'json'\n }\n };\n const res = await client.post(url, payload, { headers: { 'X-Shopify-Access-Token': accessToken } });\n if (res.status >= 400) {\n log.error('Failed to register Webhook Topic', { shop, accessToken, eventBridgeArn, topic, url, payload });\n }\n log.debug('Shopify Client Webhook Registration Response', { registrationResponse: res });\n return res;\n };\n\n static updateShopifyAppMetafield = async (shop: string, accessToken: string, pixelId: string) => {\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/metafields.json`;\n const payload = {\n metafield: {\n namespace: 'adtr',\n key: 'adtr.config',\n value: pixelId,\n type: 'single_line_text_field'\n }\n };\n const res = await this.genericShopifyPost(url, accessToken, payload);\n\n if (res.status >= 400) {\n log.error('Failed to update Shopify app Metafield ', { shop, accessToken, url, payload });\n }\n return res;\n };\n\n static getShopifyStoreProperties = async (shop: string, accessToken: string) => {\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/shop.json`;\n const res = await this.genericShopifyGet(url, accessToken);\n\n if (res.status >= 400) {\n log.error('Failed to get Shopify Store Properties', { shop, accessToken, url });\n }\n return res;\n };\n\n static createAppSubscription = async (shop: string, accessToken: string,\n planName: string, price: number, returnUrl: string, trialDays: number, test?: boolean) => {\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/recurring_application_charges.json`;\n const recurring_application_charge = {\n name: planName,\n price,\n return_url: returnUrl,\n trial_days: trialDays,\n test\n };\n const res = await this.genericShopifyPost(url, accessToken, { recurring_application_charge });\n if (res.status >= 400) {\n log.error('Failed to create App Subscription', { shop, accessToken, url });\n }\n return res;\n };\n\n static cancelAppSubscription = async (shop: string, accessToken: string, chargeId: string) => {\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/recurring_application_charges/${chargeId}.json`;\n const client = axiosHttpService();\n const res = await client.delete(url, { headers: { 'X-Shopify-Access-Token': accessToken } });\n\n if (res.status !== 200) {\n log.error('Failed to cancel recurring App billing', { shop, accessToken, url });\n }\n return res;\n };\n\n static listAppSubscriptions = async (shop: string, accessToken: string) => {\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/recurring_application_charges.json`;\n const res = await this.genericShopifyGet(url, accessToken);\n if (res.status >= 400) {\n log.error('Failed to get App Subscriptions', { shop, accessToken, url });\n }\n return res;\n };\n\n static genericShopifyPost = async (url: string, accessToken: string, payload: any) => {\n const client = axiosHttpService();\n const res = await client.post(url, payload, { headers: { 'X-Shopify-Access-Token': accessToken, 'Content-Type': 'application/json' } });\n log.debug('Shopify Client Response', { res });\n return res;\n };\n\n static genericShopifyGet = async (url: string, accessToken: string) => {\n const client = axiosHttpService();\n const res = await client.get(url, { headers: { 'X-Shopify-Access-Token': accessToken } });\n log.debug('Shopify Client Response', { res });\n return res;\n };\n\n static genericShopifyPut = async (url: string, accessToken: string, payload: any) => {\n const client = axiosHttpService();\n const res = await client.put(url, payload, { headers: { 'X-Shopify-Access-Token': accessToken } });\n log.debug('Shopify Client Response', { res });\n return res;\n };\n}\n", "import Joi from 'joi';\nimport * as log from 'lambda-log';\nimport { HttpError } from '../libs/http-error';\n\nexport const validateInput = (schema: Joi.ObjectSchema<any>, input: any) => {\n const { error, value } = schema.validate(input);\n if (error) {\n log.info('', { error });\n\n const httperr = HttpError.badRequest('Bad Request', {\n errors: error.details.map(detail => ({\n message: detail?.message,\n key: detail?.context?.key,\n path: detail?.path,\n }))\n });\n\n log.info('', { httperr });\n throw httperr;\n }\n return value;\n};", "import * as log from 'lambda-log';\nconst stage = process?.env?.STAGE;\n\nexport const configureLogger = (event: any, context: any, debug = true) => {\n log.options.meta.stage = stage;\n log.options.meta.source_name = context?.functionName || 'unknown';\n log.options.meta.awsRequestId = context?.awsRequestId || 'unknown';\n log.options.meta.lambdaEvent = event;\n log.options.debug = debug;\n}", "\nexport const success = (body: any) => {\n return buildResponse(200, body);\n}\n\nconst defaultError = {\n message: 'internalServerError'\n}\n\nexport const failure = (error: any, statusCode = 500) => {\n statusCode = error?.statusCode ?? statusCode;\n\n let body = defaultError;\n if (error?.body) {\n body = error.body;\n }\n else if (error?.message) {\n body = { message: error.message };\n } else if (statusCode === 500) {\n body = defaultError;\n }\n return buildResponse(statusCode, body);\n}\n\nexport const buildResponse = (statusCode: number, body: any = {}) => {\n delete body.stack;\n return {\n statusCode: statusCode,\n headers: {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Credentials': true,\n 'cache-control': 'max-age=86400',\n Date: new Date(),\n 'Last-Modified': new Date(),\n 'Access-Control-Allow-Headers':\n 'Content-Type, Content-Encoding'\n },\n body: JSON.stringify(body),\n };\n}\n", "import { Subscription } from './subscription';\n\nexport interface Account {\n id: string,\n accountName: string,\n companyName?: string,\n accountStatus: ACCOUNT_STATUS,\n primaryEmail: string,\n publicApiKey?: string,\n subscriptionId?: string,\n pixels?: Pixel[],\n subscription?: Subscription;\n ownerId?: string,\n createdAt: string,\n updatedAt: string;\n}\n\n\nexport interface Pixel {\n id: string;\n accountId: string;\n name: string;\n createdAt: string,\n updatedAt: string;\n}\n\nexport enum ACCOUNT_STATUS {\n PENDING = 'pending',\n ACTIVE = 'active',\n INACTIVE = 'inactive'\n}", "\r\nexport interface Destination {\r\n id: string,\r\n accountId: string,\r\n pixelId: string,\r\n destination: string;\r\n displayName?: string,\r\n enabled: boolean;\r\n configuration?: UserDestinationConfiguration,\r\n createdAt: string,\r\n updatedAt: string;\r\n}\r\n\r\nexport enum DESTINATIONS {\r\n FACEBOOK = 'facebook',\r\n TIKTOK = 'tiktok',\r\n GOOGLE_ADS = 'googleAds',\r\n GOOGLE_ANALYTICS_4 = 'googleAnalytics4',\r\n HUBSPOT = 'hubspot',\r\n WEBHOOK = 'webhook',\r\n CUSTOM_HTML = 'customHTML',\r\n CUSTOM_JS = 'customJS',\r\n SNAPCHAT = 'snapchat',\r\n TWITTER = 'twitter',\r\n REDDIT = 'reddit'\r\n}\r\n\r\nexport interface UserDestinationConfiguration {\r\n [ key: string ]: any;\r\n eventBlacklist?: string[];\r\n events?: EventConfiguration[];\r\n trigger?: DestinationTriggerConfiguration;\r\n}\r\n\r\nexport interface DestinationTriggerConfiguration {\r\n shopify?: ShopifyTriggerConfiguration;\r\n exludeDomains?: string[];\r\n excludePages?: string[];\r\n domains?: string[];\r\n pages?: string[];\r\n}\r\n\r\nexport interface ShopifyTriggerConfiguration {\r\n enabled: boolean;\r\n collections?: string[];\r\n tags?: string[];\r\n}\r\n\r\n\r\nexport interface EventConfiguration {\r\n sourceEventName: string;\r\n exclude?: boolean;\r\n sample: EventSampleConfiguration;\r\n transformations?: EventTransformation[];\r\n}\r\n\r\nexport interface EventTransformation {\r\n transformationEventName: string;\r\n enabled: boolean;\r\n}\r\n\r\nexport interface EventSampleConfiguration {\r\n enabled: boolean;\r\n rate: number;\r\n}\r\n\r\n", "import { Destination, UserDestinationConfiguration } from './destinations';\r\n\r\nexport interface AdTrackifyFacebookDestination extends Destination {\r\n configuration: FacebookPixelConfiguration;\r\n}\r\n\r\nexport interface AdTrackifyTikTokDestination extends Destination {\r\n configuration: TiktokPixelConfiguration;\r\n}\r\n\r\nexport interface AdTrackifyGoogleAnalytics4Destination extends Destination {\r\n configuration: GoogleAnalytics4Configuration;\r\n}\r\n\r\n// Destination Specific configurations below\r\nexport interface FacebookPixelConfiguration extends UserDestinationConfiguration {\r\n apiAccessToken?: string;\r\n enableConversionAPI: boolean;\r\n pixelId: string;\r\n}\r\n\r\nexport interface TiktokPixelConfiguration extends UserDestinationConfiguration {\r\n apiAccessToken?: string;\r\n enableConversionAPI: boolean;\r\n pixelId: string;\r\n}\r\n\r\nexport interface GoogleAnalytics4Configuration extends UserDestinationConfiguration {\r\n apiSecret: string;\r\n measurementId: string;\r\n}\r\n\r\nexport interface GoogleAdsConfiguration extends UserDestinationConfiguration {\r\n pixelId: string;\r\n conversionID: string;\r\n}\r\n\r\nexport interface HubspotPixelConfiguration extends UserDestinationConfiguration {\r\n hubspotId: string;\r\n}\r\n\r\nexport interface SnapchatPixelConfiguration extends UserDestinationConfiguration {\r\n snapchatPixelId: string;\r\n}\r\n\r\nexport interface TwitterPixelConfiguration extends UserDestinationConfiguration {\r\n twitterPixelId: string;\r\n}\r\n\r\nexport interface WebhookConfiguration extends UserDestinationConfiguration {\r\n webhookUrl: string;\r\n}\r\n\r\nexport interface CustomHTMLConfiguration extends UserDestinationConfiguration {\r\n html: string;\r\n location: CustomHTMLLocation;\r\n}\r\n\r\nexport interface CustomJSConfiguration extends UserDestinationConfiguration {\r\n script: string;\r\n async: boolean;\r\n defer: boolean;\r\n location: CustomHTMLLocation;\r\n}\r\n\r\nexport enum CustomHTMLLocation {\r\n HEADER = 'header',\r\n FOOTER = 'footer',\r\n BODY = 'body'\r\n}\r\n\r\n", "export interface ShopifyAppInstall {\n shopifyAppInstallId: string;\n shop: string;\n accessToken?: string;\n appStatus?: string;\n appSubscriptionStatus?: ShopifyAppSubscriptionStatus;\n code?: string;\n hmac?: string;\n host?: string;\n installRequest?: ShopifyInstallRequest;\n isAppEnabled?: boolean;\n pixelId?: string;\n shopInfo?: any;\n state?: string;\n timestamp?: number;\n createdAt: string;\n updatedAt: string;\n}\n\nexport enum ShopifyAppInstallStatus {\n STARTED = 'started',\n COMPLETED = 'completed',\n UNINSTALLED = 'uninstalled',\n FAILED = 'failed',\n NONE = 'none'\n}\nexport enum ShopifyAppSubscriptionStatus {\n ACTIVE = 'active', // approved and billed to shop\n CANCELLED = 'cancelled', // cancelled, uninstalled or cancellation\n DECLINED = 'declined', // subscription declined by merchant\n EXPIRED = 'expired', //wasn't approved within two days of being created\n FROZEN = 'frozen', //on hold due to not payment\n PENDING = 'pending', // pending approval\n NOT_SUBMITTED = 'na' // billing has not yet been attempted\n}\n\nexport interface ShopifyInstallRequest {\n shop?: string;\n session?: string;\n hmac?: string;\n host?: string;\n nonce?: string;\n timestamp?: string;\n status?: string;\n}\n\nexport interface ShopifyStoreInfo {\n // TBD based on shopify api\n [ key: string ]: any;\n}", "\nexport interface Subscription {\n id: string,\n accountId?: string,\n shopifyAppInstallId?: string,\n shopifyDomain?: string,\n stripeCustomerId?: string,\n stripeSubscriptionId?: string,\n stripeCompletedCheckoutSession?: any;\n shopifyChargeId?: string;\n subscriptionPlan?: SubscriptionPlan,\n status?: SUBSCRIPTION_STATUS,\n paymentStatus?: PAYMENT_STATUS,\n paymentGateway?: PAYMENT_GATEWAY,\n createdAt: string,\n updatedAt: string,\n\n}\nexport interface SubscriptionPlan {\n id: number;\n planName: string;\n displayName: string;\n description: string;\n sku: string;\n price: string;\n displayPrice: string;\n billingFrequency: PLAN_BILLING_FREQUENCY;\n trialLengthDays?: number;\n trialRequiresCreditCard?: boolean;\n planDesc?: string[];\n unitPriceText?: string;\n isHighlighted?: boolean;\n isBanner?: boolean;\n bannerText?: string;\n bannerColor?: string;\n stripePriceId?: string;\n stripeProductId?: string;\n}\n\nexport enum PLAN_BILLING_FREQUENCY {\n MONTHLY = 'monthly',\n YEARLY = 'yearly'\n}\n\nexport enum PAYMENT_STATUS {\n CURRENT = 'current',\n PAST_DUE = 'past_due',\n CANCELLED = 'cancelled',\n FAILED = 'failed'\n}\n\nexport enum SUBSCRIPTION_STATUS {\n ACTIVE = 'active', // approved and billed to shop\n CANCELLED = 'cancelled', // cancelled, uninstalled or cancellation\n DECLINED = 'declined', // subscription declined by merchant\n EXPIRED = 'expired', //wasn't approved within two days of being created\n FROZEN = 'frozen', //on hold due to not payment\n PENDING = 'pending', // pending approval\n NOT_SUBMITTED = 'na' // billing has not yet been attempted\n}\nexport enum PAYMENT_GATEWAY {\n STRIPE = 'stripe',\n PAYPAL = 'paypal',\n SHOPIFY = 'shopify'\n}\n", "export enum ADTRACKIFY_STANDARD_EVENT {\n ADD_PAYMENT_INFO = 'add_payment_info',\n ADD_SHIPPING_INFO = 'add_shipping_info',\n ADD_TO_CART = 'add_to_cart',\n ADD_TO_WISHLIST = 'add_to_wishlist',\n // COMPLETE_REGISTRATION: 'complete_registration',\n // CONTACT: 'contact',\n INITIATE_CHECKOUT = 'initiate_checkout',\n LEAD = 'lead',\n LOGIN = 'login',\n PAGE_VIEW = 'page_view',\n PURCHASE = 'purchase',\n REFUND = 'refund',\n SEARCH = 'search',\n // START_TRIAL: 'start_trial',\n // SUBMIT_APPLICATION: 'submit_application',\n // SUBSCRIBE: 'subscribe',\n SIGN_UP = 'sign_up',\n VIEW_CART = 'view_cart',\n VIEW_CONTENT = 'view_content',\n\n\n //\n SELECT_SHIPPING_METHOD = 'select_shipping_method',\n VIRTUALIZED_VIEWED_PAYMENT_FORM = 'virtualized_viewd_payment_form'\n}", "import { ADTRACKIFY_STANDARD_EVENT } from '../adtrackify-standard-events';\nimport { AddressInfo } from '../common/address';\nimport { TrackingEventContext } from './tracking-event-context';\nimport { TrackingEventIdentity } from './tracking-event-identity';\n\nexport interface TrackingEvent {\n id: string;\n type: string;\n name: ADTRACKIFY_STANDARD_EVENT;\n pixelId: string;\n context?: TrackingEventContext;\n identity?: TrackingEventIdentity;\n data?: TrackingEventData;\n testCode?: string;\n sentAtEpoch?: number;\n collectedAt?: string;\n version: string;\n}\n\nexport interface TrackingEventData {\n [ key: string ]: any;\n firstName?: string;\n lastName?: string;\n email?: string;\n phone?: string;\n addresses?: AddressInfo[];\n cartId?: string;\n transactionId?: string;\n affiliation?: string;\n currency?: string;\n price?: number;\n subtotalPrice?: number;\n value?: number;\n tax?: number;\n shipping?: number;\n coupon?: string;\n paymentType?: string;\n shippingTier?: string;\n creativeName?: string;\n creativeSlot?: string;\n locationId?: string;\n promotionId?: string;\n promotionName?: string;\n items?: GenericContent[];\n}\n\nexport interface GenericContent {\n [ key: string ]: any;\n content_type?: string;\n id?: string;\n name?: string;\n sku?: string;\n brand?: string;\n variant?: string;\n coupon?: string;\n currency?: string;\n discount?: number;\n index?: number;\n value?: number;\n price?: number;\n quantity?: number;\n url?: string;\n locationId?: string;\n imageUrl?: string;\n category?: string;\n category2?: string;\n category3?: string;\n category4?: string;\n category5?: string;\n}\n\n\nexport const Currencies: string[] = [ 'AED', 'ARS', 'AUD', 'BDT', 'BIF', 'BOB', 'BRL', 'CAD', 'CHF', 'CLP', 'CNY', 'COP', 'CRC', 'CZK', 'DKK', 'DZD', 'EGP', 'EUR', 'GBP', 'GTQ', 'HKD', 'HNL', 'HUF', 'IDR', 'ILS', 'INR', 'ISK', 'JPY', 'KES', 'KRW', 'KWD', 'KZT', 'MAD', 'MOP', 'MXN', 'MYR', 'NGN', 'NIO', 'NOK', 'NZD', 'PEN', 'PHP', 'PKR', 'PLN', 'PYG', 'QAR', 'RON', 'RUB', 'SAR', 'SEK', 'SGD', 'THB', 'TRY', 'TWD', 'USD', 'VES', 'VND', 'ZAR' ];\n\n", "import { SubscriptionPlan, PLAN_BILLING_FREQUENCY } from '@adtrackify/at-tracking-event-types';\n\nexport const StripeBillingMap: any = {\n dev2: {\n 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',\n 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',\n 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',\n 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',\n 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'\n },\n qa2: {\n 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',\n 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',\n 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',\n 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',\n 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'\n },\n prod2: {\n 'free': 'price_1KAFsIK7krGh4037RsaAYMEl',\n 'starter_monthly': 'price_1KAFsMK7krGh4037Lz3P0ksU',\n 'starter_yearly': 'price_1KAFsMK7krGh4037Dj1WmSi8',\n 'scale_monthly': 'price_1KAFrxK7krGh4037zWCdaTly',\n 'scale_yearly': 'price_1KAFrxK7krGh40375fhymyWP',\n 'growth_monthly': 'price_1KAFs7K7krGh4037JChjz5Cr',\n 'growth_yearly': 'price_1KAFs7K7krGh4037rZElg12s'\n },\n dev: {\n 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',\n 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',\n 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',\n 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',\n 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'\n },\n qa: {\n 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',\n 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',\n 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',\n 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',\n 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'\n },\n prod: {\n 'free': 'price_1KAFsIK7krGh4037RsaAYMEl',\n 'starter_monthly': 'price_1KAFsMK7krGh4037Lz3P0ksU',\n 'starter_yearly': 'price_1KAFsMK7krGh4037Dj1WmSi8',\n 'scale_monthly': 'price_1KAFrxK7krGh4037zWCdaTly',\n 'scale_yearly': 'price_1KAFrxK7krGh40375fhymyWP',\n 'growth_monthly': 'price_1KAFs7K7krGh4037JChjz5Cr',\n 'growth_yearly': 'price_1KAFs7K7krGh4037rZElg12s'\n }\n};\n\nexport const CommonPlanInfo = [\n //'60-day Risk Free Trial',\n 'Free Server Side Tracking & Conversion API',\n 'MultiPixel Support (Multiple facebook, tiktok, etc)',\n 'Corrects Facebook Conversion Tracking post IOS14',\n 'Increase ROAS & Attribution Data',\n 'Enhanced Fingerprinting & Identity Resolution',\n 'Unlimited Integrations',\n 'Advanced Integrations (Webhooks, Custom JS/HTML, Hubspot)'\n];\n\nexport const SubscriptionPlanSeedItems: {\n items: SubscriptionPlan[];\n} = {\n items: [ {\n id: 1,\n planName: 'free',\n displayName: 'Free',\n sku: 'ADT-001',\n description: 'Free Plan - Monthly',\n price: '0',\n displayPrice: '$0',\n billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,\n trialLengthDays: 0,\n trialRequiresCreditCard: false,\n planDesc: [\n ...CommonPlanInfo,\n 'Free Up to 500 orders/month (50,000 events)*'\n ],\n unitPriceText: 'try now - free forever',\n isHighlighted: false,\n isBanner: false\n },\n // STARTER PLANS\n {\n id: 2,\n planName: 'starter_monthly',\n displayName: 'Starter',\n sku: 'ADT-002',\n description: 'Starter Plan - Monthly',\n price: '79.99',\n displayPrice: '$79.99',\n billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,\n trialLengthDays: 60,\n trialRequiresCreditCard: false,\n planDesc: [\n '60-day Risk Free Trial',\n ...CommonPlanInfo,\n 'Up to 2,000 orders/month (250,000 events)*'\n ],\n isHighlighted: true,\n isBanner: true,\n bannerColor: 'blue',\n bannerText: 'MOST POPULAR'\n }, {\n id: 3,\n planName: 'starter_yearly',\n displayName: 'Starter',\n sku: 'ADT-003',\n description: 'Starter Plan - Yearly',\n price: '767.90',\n displayPrice: '$63.99',\n billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,\n trialLengthDays: 30,\n trialRequiresCreditCard: false,\n planDesc: [\n '60-day Risk Free Trial',\n ...CommonPlanInfo,\n 'Up to 2,000 orders/month (250,000 events)*'\n ],\n unitPriceText: 'billed yearly ($767.90) - 20% savings',\n isHighlighted: true,\n isBanner: true,\n bannerColor: 'blue',\n bannerText: 'MOST POPULAR'\n },\n // SCALE PLANS\n {\n id: 4,\n planName: 'scale_monthly',\n displayName: 'Scale',\n sku: 'ADT-004',\n description: 'Scale Plan - Monthly',\n price: '199.99',\n displayPrice: '$199.99',\n billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,\n trialLengthDays: 60,\n trialRequiresCreditCard: false,\n planDesc: [\n '60-day Risk Free Trial',\n ...CommonPlanInfo,\n 'Up to 7,500 orders/month (750,000 events)*'\n ],\n unitPriceText: '',\n isHighlighted: false,\n isBanner: false\n }, {\n id: 5,\n planName: 'scale_yearly',\n displayName: 'Scale',\n sku: 'ADT-005',\n description: 'Scale Plan - Yearly',\n price: '1823.91',\n displayPrice: '$151.99',\n billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,\n trialLengthDays: 60,\n trialRequiresCreditCard: false,\n planDesc: [\n '60-day Risk Free Trial',\n ...CommonPlanInfo,\n 'Up to 7,500 orders/month (750,000 events)*'\n ],\n unitPriceText: 'billed yearly ($1823.91) - 24% savings',\n isHighlighted: false,\n isBanner: false\n },\n // // GROWTH PLANS\n // {\n // id: 6,\n // planName: 'growth_monthly',\n // displayName: 'Growth',\n // sku: 'ADT-006',\n // description: 'Growth Plan - Monthly',\n // price: '199.99',\n // displayPrice: '$199.99',\n // billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,\n // trialLengthDays: 60,\n // trialRequiresCreditCard: false,\n // planDesc: [\n // '60-day Risk Free Trial',\n // ...CommonPlanInfo,\n // '250,000 tracking events/mo'\n // ],\n // unitPriceText: 'billed yearly ($540) - 25% savings',\n // isHighlighted: false,\n // isBanner: true,\n // bannerColor: 'orange',\n // bannerText: 'BEST VALUE'\n // }, {\n // id: 7,\n // planName: 'growth_yearly',\n // displayName: 'Growth',\n // sku: 'ADT-007',\n // description: 'Growth Plan - Yearly',\n // price: '1799.91',\n // displayPrice: '$149.99',\n // billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,\n // trialLengthDays: 60,\n // trialRequiresCreditCard: false,\n // planDesc: [\n // '30-day Risk Free Trial',\n // 'Fixes IOS14.5 tracking',\n // 'Multi Pixel Support',\n // 'Enhanced Tracking / Attribution',\n // 'Unlimited Facebook Conversion API',\n // 'Unlimited Integrations',\n // 'Easy no code setup',\n // '100,000 tracking events/mo'\n // ],\n // unitPriceText: 'billed yearly ($1799.91) - 25% savings',\n // isHighlighted: false,\n // isBanner: true,\n // bannerColor: 'orange',\n // bannerText: 'BEST VALUE'\n // },\n ]\n};\n\n\nexport const getPlanDetails = (planId: number, stage: string) => {\n const plan = SubscriptionPlanSeedItems.items.filter(x => x.id === planId)[ 0 ] as any;\n plan.stripePriceId = StripeBillingMap[ stage ][ plan.planName ];\n return plan as SubscriptionPlan;\n};\n\nexport const getPlanByStripePriceId = (stripePriceId: string, stage: string) => {\n const stripePriceIds = StripeBillingMap[ stage ];\n const planName = Object.keys(stripePriceIds).find(key => stripePriceIds[ key ] === stripePriceId);\n\n const plan = SubscriptionPlanSeedItems.items.filter(x => x.planName === planName)[ 0 ] as any;\n plan.stripePriceId = stripePriceId;\n\n return plan as SubscriptionPlan;\n};", "export enum ADTRACKIFY_EVENT_TYPES {\n NOTIFY_SHOPIFY_SUBSCRIPTION_CREATED = 'shopifySubscriptionCreated',\n NOTIFY_SUBSCRIPTION_SIGNUP_COMPLETED = 'subscription.signupCompleted',\n REQUEST_SET_ACCOUNT_OWNER = 'setAccountOwner',\n REQUEST_SET_ACCOUNT_SUBSCRIPTION_ID = 'setAccountSubscriptionId',\n}\n\nexport enum ADTRACKIFY_EVENT_SOURCES {\n SUBSCRIPTIONS = 'subscriptions',\n}", "import { EventBridgeClient } from '../clients';\nimport { Message, TemplatedMessage } from 'postmark';\n\nexport const enum PostmarkRequestType {\n SINGLE_EMAIL = 'single_email',\n TEMPLATE_EMAIL = 'template_email'\n}\n\nexport enum ADTRACKIFY_EVENT_BRIDGE_EVENTS {\n SEND_POSTMARK_EMAIL = 'integration.sendPostmarkEmail',\n}\n\nexport class EventBridgeIntegrationService {\n public eventBridgeClient: EventBridgeClient;\n public EVENT_BUS_NAME: string;\n\n constructor (eventBusName: string) {\n this.eventBridgeClient = new EventBridgeClient(eventBusName);\n this.EVENT_BUS_NAME = eventBusName;\n }\n\n public sendPostmarkEmailEvent = async (eventSource: string, postmarkMessage: Message, postmarkServerToken: string) => {\n return await this.eventBridgeClient.buildAndSendEvent(\n eventSource,\n ADTRACKIFY_EVENT_BRIDGE_EVENTS.SEND_POSTMARK_EMAIL,\n {\n postmarkMessage,\n postmarkRequestType: PostmarkRequestType.SINGLE_EMAIL,\n postmarkServerToken\n });\n };\n\n public sendPostmarkTemplatedEmailEvent = async (eventSource: string, postmarkMessage: TemplatedMessage, postmarkServerToken: string) => {\n return await this.eventBridgeClient.buildAndSendEvent(\n eventSource,\n ADTRACKIFY_EVENT_BRIDGE_EVENTS.SEND_POSTMARK_EMAIL,\n {\n postmarkMessage,\n postmarkRequestType: PostmarkRequestType.TEMPLATE_EMAIL,\n postmarkServerToken\n });\n };\n\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;AAAA,SAAS,sBAAmC;A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AAA,wBAAA,+BAA4B;AAC5B,EAAAA,wBAAA,yCAAsC;AAJ5B,SAAAA;AAAA,GAAA;AAOL,IAAK,2BAAL,kBAAKC,8BAAL;AACL,EAAAA,0BAAA,mBAAgB;AADN,SAAAA;AAAA,GAAA;;;ACJL,IAAW,sBAAX,kBAAWC,yBAAX;AACL,EAAAA,qBAAA,kBAAe;AACf,EAAAA,qBAAA,oBAAiB;AAFD,SAAAA;AAAA,GAAA;AAKX,IAAK,iCAAL,kBAAKC,oCAAL;AACL,EAAAA,gCAAA,yBAAsB;AADZ,SAAAA;AAAA,GAAA;AAIL,IAAM,gCAAN,MAAoC;AAAA,EAClC;AAAA,EACA;AAAA,EAEP,YAAa,cAAsB;AACjC,SAAK,oBAAoB,IAAI,kBAAkB,YAAY;AAC3D,SAAK,iBAAiB;AAAA,EACxB;AAAA,EAEO,yBAAyB,OAAO,aAAqB,iBAA0B,wBAAgC;AACpH,WAAO,MAAM,KAAK,kBAAkB;AAAA,MAClC;AAAA,MACA;AAAA,MACA;AAAA,QACE;AAAA,QACA,qBAAqB;AAAA,QACrB;AAAA,MACF;AAAA,IAAC;AAAA,EACL;AAAA,EAEO,kCAAkC,OAAO,aAAqB,iBAAmC,wBAAgC;AACtI,WAAO,MAAM,KAAK,kBAAkB;AAAA,MAClC;AAAA,MACA;AAAA,MACA;AAAA,QACE;AAAA,QACA,qBAAqB;AAAA,QACrB;AAAA,MACF;AAAA,IAAC;AAAA,EACL;AAEF;",
|
|
6
|
-
"names": ["log", "error", "config", "log", "error", "log", "client", "log", "client", "success", "log", "log", "a", "p", "HttpStatusCodes", "client", "log", "client", "log", "log", "client", "log", "error", "log", "debug", "error", "ACCOUNT_STATUS", "DESTINATIONS", "CustomHTMLLocation", "ShopifyAppInstallStatus", "ShopifyAppSubscriptionStatus", "PLAN_BILLING_FREQUENCY", "PAYMENT_STATUS", "SUBSCRIPTION_STATUS", "PAYMENT_GATEWAY", "ADTRACKIFY_STANDARD_EVENT", "stage", "x", "ADTRACKIFY_EVENT_TYPES", "ADTRACKIFY_EVENT_SOURCES", "PostmarkRequestType", "ADTRACKIFY_EVENT_BRIDGE_EVENTS"]
|
|
3
|
+
"sources": ["../src/clients/generic/dynamodb-client.ts", "../src/clients/generic/eventbridge-client.ts", "../src/libs/dates.ts", "../src/clients/generic/http-client.ts", "../src/clients/generic/s3-client.ts", "../src/clients/generic/cognito-client.ts", "../src/clients/internal-api/destinations-client.ts", "../src/clients/internal-api/accounts-client.ts", "../src/clients/internal-api/users-auth-client.ts", "../src/helpers/shopify-helper.ts", "../src/libs/url.ts", "../src/libs/crypto.ts", "../src/libs/http-error.ts", "../src/libs/http-status-codes.ts", "../src/clients/internal-api/shopify-app-install-client.ts", "../src/clients/third-party/shopify-client.ts", "../src/helpers/input-validation-helper.ts", "../src/helpers/logging-helper.ts", "../src/helpers/response-helper.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/api/account.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/api/destinations/destinations.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/api/destinations/third-party-destination-configs.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/api/shopify-app-install.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/api/subscription.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/adtrackify-standard-events.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/tracking-events/tracking-event-type.ts", "../src/helpers/subscription-helper.ts", "../src/types/internal-events/event-detail-types.ts", "../src/services/eventbridge-integration-service.ts"],
|
|
4
|
+
"sourcesContent": ["import { DynamoDBClient, QueryOutput } from '@aws-sdk/client-dynamodb';\nimport { DynamoDBDocument } from '@aws-sdk/lib-dynamodb';\nimport * as log from 'lambda-log';\n\nconst marshallOptions = {\n convertEmptyValues: false,\n removeUndefinedValues: false,\n convertClassInstanceToMap: true\n};\n\nconst unmarshallOptions = {\n wrapNumbers: false,\n};\n\nconst translateConfig = { marshallOptions, unmarshallOptions };\nconst ddbClient = new DynamoDBClient({});\nconst client = DynamoDBDocument.from(ddbClient, translateConfig);\n\nexport class DynamoDbClient {\n static safeGet = async (tableName: string, keyName: string, keyValue: any) => {\n try {\n const params = {\n TableName: tableName,\n Key: {\n [ keyName ]: keyValue\n }\n };\n const res = await client.get(params);\n return res?.Item ?? null;\n } catch (e: any) {\n log.error(e, { message: 'Dynamo Client Get Failed' });\n return null;\n }\n };\n\n static safePut = async (tableName: string, data: any) => {\n try {\n const params = {\n TableName: tableName,\n Item: data\n };\n const res = await client.put(params);\n return res;\n } catch (e: any) {\n log.error(e, { message: 'Dynamo failed simplePut' });\n return null;\n }\n };\n\n static safeDelete = async (tableName: string, keyName: string, keyValue: any) => {\n try {\n const params = {\n TableName: tableName,\n Key: {\n [ keyName ]: keyValue\n }\n };\n const res = await client.delete(params);\n return res;\n } catch (e: any) {\n log.error(e, { message: 'Dynamo failed safeDelete' });\n return null;\n }\n };\n\n static safeQueryByGSI = async (tableName: string, gsiName: string, keyName: string, keyValue: any) => {\n const query = {\n TableName: tableName,\n IndexName: gsiName,\n KeyConditionExpression: `${keyName} = :value`,\n ExpressionAttributeValues: {\n ':value': keyValue\n }\n };\n const results = await DynamoDbClient.queryAll(query);\n return results;\n };\n\n static safeBatchGet = async (tableName: string, keys: any) => {\n try {\n const params: any = {\n RequestItems: {}\n };\n params.RequestItems[ tableName ] = {\n Keys: keys\n };\n const res = await client.batchGet(params);\n log.info('batchget res', { batchGetRes: res });\n if (res?.Responses?.[ tableName ]) {\n return res?.Responses?.[ tableName ];\n }\n return [];\n } catch (e: any) {\n log.error(e, { message: 'Dynamo failed safeBatchGet' });\n return [];\n }\n };\n\n static queryAll = async (params: any) => {\n try {\n log.info('Invoke Query All', { params });\n let currentResult: QueryOutput, exclusiveStartKey;\n let accumulatedResults: any[] = [];\n do {\n params.ExclusiveStartKey = exclusiveStartKey;\n params.Limit = 200;\n currentResult = await client.query(params);\n if (currentResult.Items) {\n exclusiveStartKey = currentResult.LastEvaluatedKey;\n accumulatedResults = [ ...accumulatedResults, ...currentResult.Items ];\n }\n } while (currentResult.Items && currentResult.Items.length > 0 && currentResult.LastEvaluatedKey);\n return accumulatedResults;\n } catch (e: any) {\n log.error(e, { message: 'Dynamo failed queryAll' });\n return null;\n }\n };\n\n static batchGet = (params: any) => client.batchGet(params);\n static get = (params: any) => client.get(params);\n static put = (params: any) => client.put(params);\n static query = (params: any) => client.query(params);\n static scan = (params: any) => client.scan(params);\n static update = (params: any) => client.update(params);\n static delete = (params: any) => client.delete(params);\n}", "import { EventBridgeClient as EventBridge, PutEventsCommand, PutEventsCommandInput } from '@aws-sdk/client-eventbridge';\nimport { v4 as uuidv4 } from 'uuid';\nimport { getCurrentTimestamp } from '../../libs/dates';\nimport * as log from 'lambda-log';\n\nexport class EventBridgeClient {\n public eventBridge: EventBridge;\n public EVENT_BUS_NAME: string;\n\n constructor (eventBusName: string) {\n this.eventBridge = new EventBridge({});\n this.EVENT_BUS_NAME = eventBusName;\n }\n\n public buildAndSendEvent = async (eventSource: string, eventType: string, eventData: any) => {\n const event = this.buildEvent(eventType, eventData);\n return await this.putEvent(eventSource, eventType, event);\n };\n\n public buildEvent = (eventType: string, eventData: any, eventId: string = uuidv4(), eventTime: string = getCurrentTimestamp()) => {\n return {\n eventId,\n eventType,\n eventTime,\n eventData\n };\n };\n\n public putEvent = async (source: string, detailType: string, data: any, headers: any = null) => {\n const params: PutEventsCommandInput = {\n Entries: [ {\n Detail: JSON.stringify({ headers, data }),\n DetailType: detailType,\n EventBusName: this.EVENT_BUS_NAME,\n Source: source,\n Time: new Date(),\n } ],\n };\n const putEventscommand = new PutEventsCommand(params);\n const response = await this.eventBridge.send(putEventscommand);\n log.debug('EventBus Event Published',\n {\n eventBusName: this.EVENT_BUS_NAME,\n eventSource: source,\n eventType: detailType,\n event: data,\n response\n });\n return response;\n };\n\n}\n\n", "\nimport { DateTime } from 'luxon';\n\nexport const getCurrentTimestamp = (): string => {\n return DateTime.utc().toJSDate().toISOString();\n}\n\nexport const getDateFromTimestamp = (timestamp: string) => {\n return timestamp.split('T')[0];\n}\n\nexport const getCurrentDate = (): string => {\n return getDateFromTimestamp(getCurrentTimestamp());\n}", "import axios from 'axios';\nimport axiosRetry from 'axios-retry';\nimport https from 'https';\nimport httpAdapter from 'axios/lib/adapters/http';\n\nconst httpResponse = (res: any = {}) => {\n return {\n headers: res?.header || {},\n data: res?.data || {},\n status: res?.status || 0,\n };\n};\n\nconst handleAxiosError = (error: any) => {\n if (!error?.response && !error?.request) throw error;\n return error.response ? httpResponse(error.response) : httpResponse({ status: 500, data: { error: error.request } });\n};\n\nexport const axiosHttpService = (config: any = {}) => {\n config.adapter = httpAdapter;\n config.httpsAgent = new https.Agent({ keepAlive: true });\n const axiosService = axios.create(config);\n\n axiosRetry(axiosService, { retryDelay: axiosRetry.exponentialDelay, retries: 3 });\n\n return {\n instance: () => axiosService,\n get: (url: string, config?: any) => axiosService.get(url, config).then(httpResponse, handleAxiosError),\n post: (url: string, data?: any, config?: any) => axiosService.post(url, data, config).then(httpResponse, handleAxiosError),\n delete: (url: string, config?: any) => axiosService.delete(url, config).then(httpResponse, handleAxiosError),\n put: (url: string, data?: any, config?: any) => axiosService.put(url, data, config).then(httpResponse, handleAxiosError),\n patch: (url: string, data?: any, config?: any) => axiosService.patch(url, data, config).then(httpResponse, handleAxiosError),\n setBaseUrl: (url: string) => !!(axiosService.defaults.baseURL = url)\n };\n};\n", "import { S3 } from '@aws-sdk/client-s3';\nimport * as log from 'lambda-log';\n\nexport class S3Client {\n s3: S3;\n\n constructor(accessKeyId: string, secretAccessKey: string){\n this.s3 = new S3({\n credentials: {\n accessKeyId,\n secretAccessKey\n }\n })\n }\n\n async uploadJson(path: string, bucket: string, jsonData: any){\n try {\n const res = await this.s3.putObject({\n Bucket: bucket,\n ContentType: 'application/json; charset=utf-8',\n Body: JSON.stringify(jsonData),\n Key: path\n });\n\n return res;\n } catch (error) {\n log.error('Error in s3 upload json', { error });\n return error;\n }\n }\n}", "/* eslint-disable no-useless-escape */\nimport { AdminConfirmSignUpCommandInput, AdminDeleteUserCommandInput, AdminUpdateUserAttributesCommandInput, CognitoIdentityProvider, ConfirmSignUpCommandInput, ForgotPasswordCommandInput, ListUsersCommandInput, ResendConfirmationCodeCommandInput, SignUpCommandInput } from '@aws-sdk/client-cognito-identity-provider';\nimport * as log from 'lambda-log';\nconst cognitoClient = new CognitoIdentityProvider({});\n\nlet USER_POOL_NO_SECRET_CLIENT_ID: string;\nlet USER_POOL_ID: string;\n\nexport function dictToAwsAttributes(input: any) {\n delete input.email;\n delete input.password;\n const output = [];\n for (const att in input) {\n if (Object.prototype.hasOwnProperty.call(input, att)) {\n output.push({ Name: att, Value: input[ att ] });\n }\n }\n return output;\n}\n\nconst buildAttributes = (data: any) => {\n const attributes = {\n name: data.givenName,\n family_name: data.familyName,\n };\n return dictToAwsAttributes(attributes);\n};\n\nexport class CognitoClient {\n static setCredentials = (userPoolId: string, userPoolNoSecretClientId: string) => {\n USER_POOL_ID = userPoolId;\n USER_POOL_NO_SECRET_CLIENT_ID = userPoolNoSecretClientId; \n }\n\n static signupUser = async (data: any) => {\n const params: SignUpCommandInput = {\n ClientId: USER_POOL_NO_SECRET_CLIENT_ID,\n Password: data.password,\n Username: data.email,\n UserAttributes: buildAttributes(data),\n };\n const cognitoResponse = await cognitoClient.signUp(params);\n log.debug('Successfully Registered User', { cognitoResponse });\n return cognitoResponse;\n }\n\n static forgotPassword = async (email: string) => {\n await CognitoClient.adminEmailVerify(email);\n const params: ForgotPasswordCommandInput = {\n ClientId: USER_POOL_NO_SECRET_CLIENT_ID,\n Username: email,\n };\n const cognitoResponse = await cognitoClient.forgotPassword(params);\n log.debug('Sent Forgot Password', { cognitoResponse });\n return cognitoResponse;\n }\n\n static adminEmailVerify = async (email: string) => {\n try {\n const user: any = await CognitoClient.getUserByEmail(email);\n if (user && user?.UserStatus === 'CONFIRMED' && user?.email_verified !== 'true') {\n await CognitoClient.forceValidateEmail(email);\n }\n } catch (error) {\n log.error('Failed admin email verify', { error });\n }\n }\n\n static forceValidateEmail = async (email: string) => {\n try {\n const params: AdminUpdateUserAttributesCommandInput = {\n UserPoolId: USER_POOL_ID,\n Username: email,\n UserAttributes: [\n {\n Name: 'email_verified',\n Value: 'true',\n },\n ],\n };\n await cognitoClient.adminUpdateUserAttributes(params);\n } catch (error) {\n log.error('Failed force validate email', { email, error });\n }\n }\n\n static adminConfirmUser = async (data: any) => {\n const params: AdminConfirmSignUpCommandInput = {\n UserPoolId: USER_POOL_ID,\n Username: data.email,\n };\n const cognitoResponse = await cognitoClient.adminConfirmSignUp(params);\n await CognitoClient.forceValidateEmail(data.email);\n log.debug('Admin Successfully Confirmed User', { cognitoResponse });\n return cognitoResponse;\n }\n\n static confirmUser = async (data: any) => {\n const params: ConfirmSignUpCommandInput = {\n ClientId: USER_POOL_NO_SECRET_CLIENT_ID,\n ConfirmationCode: data.confirmationCode,\n Username: data.email,\n };\n const cognitoResponse = await cognitoClient.confirmSignUp(params);\n log.debug('Successfully Confirmed User', { cognitoResponse });\n return cognitoResponse;\n }\n\n static resendCode = async (email: string) => {\n const params: ResendConfirmationCodeCommandInput = {\n ClientId: USER_POOL_NO_SECRET_CLIENT_ID,\n Username: email,\n };\n await cognitoClient.resendConfirmationCode(params);\n log.debug('Successfully Resend Confirmation Code', { email });\n return;\n }\n\n static adminDeleteUser = async (userId: string) => {\n const params: AdminDeleteUserCommandInput = {\n UserPoolId: USER_POOL_ID,\n Username: userId,\n };\n await cognitoClient.adminDeleteUser(params);\n return true;\n }\n\n static getUserByEmail = async (email: string) => {\n const params: ListUsersCommandInput = {\n UserPoolId: USER_POOL_ID,\n Filter: `email=\\\"${email}\\\"`,\n Limit: 1,\n };\n const cognitoResponse: any = await cognitoClient.listUsers(params);\n log.debug('Get Users by Email', { cognitoResponse });\n\n if (cognitoResponse?.Users && cognitoResponse?.Users.length > 0) {\n const attributes = cognitoResponse.Users[ 0 ].Attributes;\n\n const user = {\n ...cognitoResponse.Users[ 0 ],\n Attributes: undefined,\n id: cognitoResponse.Users[ 0 ].sub,\n };\n\n attributes.forEach((attr: any) => {\n user[ attr.Name ] = attr?.Value;\n });\n return user;\n }\n return null;\n }\n}", "import * as log from 'lambda-log';\n//const log = require('lambda-log');\nimport { ApiResponse } from '../../types/api-response';\nimport { axiosHttpService } from '../generic/http-client';\nimport { Destination } from '@adtrackify/at-tracking-event-types';\n//const BASE_API_URL = process.env.BASE_API_URL;\n//const DESTINATIONS_API_KEY = process.env.DESTINATIONS_API_KEY;\n\nexport interface GetDestinationsResponseData {\n destinations: Destination[];\n [ key: string ]: any;\n}\nexport interface CreateDestinationResponseData {\n destination: Destination;\n [ key: string ]: any;\n}\n\n\nexport class DestinationsClient {\n\n public BASE_API_URL: string;\n public DESTINATIONS_API_KEY: string;\n\n constructor (baseApiUrl: string, destinationsApiKey: string) {\n this.BASE_API_URL = baseApiUrl;\n this.DESTINATIONS_API_KEY = destinationsApiKey;\n }\n\n getConfig = () => {\n const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/destinations`;\n return {\n baseURL: SERVICE_API_ROOT_URL,\n headers: {\n common: {\n 'x-api-key': this.DESTINATIONS_API_KEY\n }\n }\n };\n };\n\n getClient = async () => {\n return axiosHttpService(this.getConfig());\n };\n\n createDestination = async (createDestinationRequest: any): Promise<ApiResponse<CreateDestinationResponseData>> => {\n const client = await this.getClient();\n const response = await client.post('/', createDestinationRequest);\n log.info('createDestinationResponse', { response });\n return response as ApiResponse<CreateDestinationResponseData>;\n };\n\n getPixelDestinations = async (pixelId: string): Promise<ApiResponse<GetDestinationsResponseData>> => {\n const client = await this.getClient();\n const response = await client.get(`/?pixelId=${pixelId}`);\n log.info('getPixelResponse', { response });\n return response as ApiResponse<GetDestinationsResponseData>;\n };\n}\n", "import * as log from 'lambda-log';\nimport { ApiResponse } from '../../types/api-response';\nimport { Account, ACCOUNT_STATUS, Destination } from '@adtrackify/at-tracking-event-types';\nimport { axiosHttpService } from '../generic/http-client';\n\n//const BASE_API_URL = process.env.BASE_API_URL;\n\n//const SERVICE_API_ROOT_URL = `${BASE_API_URL}/accounts`;\n//const ACCOUNTS_API_KEY = process.env.ACCOUNTS_API_KEY;\n\nexport interface AccountResponseData {\n account: Account;\n [ key: string ]: any;\n}\n\nexport interface IsAuthorizedUserResponseData {\n isAccountUser: boolean;\n [ key: string ]: any;\n}\nexport interface PixelConfigResponseData {\n id: string;\n destinations: Destination[];\n [ key: string ]: any;\n}\nexport interface AddUserToAccountResponseData {\n userId: string;\n accountId: string;\n}\n\nexport interface UpdateAccountRequest {\n accountName?: string,\n companyName?: string,\n primaryEmail?: string,\n ownerId?: string,\n subscriptionId?: string,\n accountStatus?: ACCOUNT_STATUS;\n}\n\nexport class AccountsClient {\n public BASE_API_URL: string;\n public ACCOUNTS_API_KEY?: string;\n\n constructor (baseApiUrl: string, accountsApiKey?: string) {\n this.BASE_API_URL = baseApiUrl;\n this.ACCOUNTS_API_KEY = accountsApiKey;\n }\n\n getConfig = () => {\n const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/accounts`;\n const params: any = {\n baseURL: SERVICE_API_ROOT_URL\n };\n if (this.ACCOUNTS_API_KEY) {\n params.headers = {\n common: {\n 'x-api-key': this.ACCOUNTS_API_KEY\n }\n };\n }\n return params;\n };\n\n getClient = async () => {\n return axiosHttpService(this.getConfig());\n };\n\n createAccount = async (createAccountRequest: any) => {\n const client = await this.getClient();\n const createAccountResponse = await client.post('', createAccountRequest);\n log.info('createAccountResponse', { createAccountResponse });\n return createAccountResponse;\n };\n updateAccount = async (accountId: string, body: any): Promise<ApiResponse<AccountResponseData>> => {\n const client = await this.getClient();\n const response = await client.patch(`/${accountId}/`, body);\n log.info('update Account response', { response });\n return response as ApiResponse<AccountResponseData>;\n };\n addOwner = async (accountId: string, userId: string) => {\n const client = await this.getClient();\n const addOwnerResponse = await client.post('/addOwner', { accountId, userId });\n log.info('addOwnerResponse', { addOwnerResponse });\n return addOwnerResponse;\n };\n isAuthorizedUser = async (userId: string, accountId: string, pixelId?: string): Promise<ApiResponse<IsAuthorizedUserResponseData>> => {\n const client = await this.getClient();\n const body = {\n userId, accountId, pixelId\n };\n const response = await client.post('/checkUserAuthorization', body);\n log.info('checkUserAuthorization', { response });\n return response as ApiResponse<IsAuthorizedUserResponseData>;\n };\n adminDeleteAccount = async (accountId: string) => {\n const client = await this.getClient();\n const success = await client.delete(`/${accountId}`);\n log.info('adminDeleteAccount');\n return success;\n };\n getPixelConfigById = async (pixelId: string): Promise<ApiResponse<PixelConfigResponseData>> => {\n const client = await this.getClient();\n const pixelResponse = await client.get(`/px/${pixelId}/config`);\n log.debug('get pixelResponse', { pixelResponse });\n return pixelResponse;\n };\n getAccount = async (accountId: string): Promise<ApiResponse<AccountResponseData>> => {\n const client = await this.getClient();\n const response = await client.get(`/${accountId}/`);\n log.info('get account response', { response });\n return response as ApiResponse<AccountResponseData>;\n };\n addUserToAccount = async (accountId: string, userId: string): Promise<ApiResponse<AddUserToAccountResponseData>> => {\n const client = await this.getClient();\n const response = await client.post('/addUser', { accountId, userId });\n log.info('add user account response', { response });\n return response as ApiResponse<AddUserToAccountResponseData>;\n };\n\n\n // setAccountSubscriptionId = async (accountId: string, subscriptionId: string): Promise<ApiResponse<any>> => {\n // const client = await this.getClient();\n // const pixelResponse = await client.get(`/px/${pixelId}/config`);\n // log.debug('pixelResponse', { pixelResponse });\n // return pixelResponse;\n // };\n}", "import { User } from '@adtrackify/at-tracking-event-types';\nimport * as log from 'lambda-log';\nimport { HttpError, HttpStatusCodes } from '../../libs';\nimport { ApiResponse } from '../../types/api-response';\nimport { axiosHttpService } from '../generic/http-client';\n\nexport interface UserResponseData {\n user: User;\n [ key: string ]: any;\n}\n\nexport interface UserSignupRequest {\n email: string,\n password: string,\n givenName: string,\n familyName: string;\n}\n\nexport class UsersAuthClient {\n\n public SERVICE_API_ROOT_URL: string;\n public BASE_API_URL: string;\n public USERS_AUTH_API_KEY: string;\n constructor (baseApiUrl: string, usersAuthApiKey?: string) {\n this.BASE_API_URL = baseApiUrl;\n this.USERS_AUTH_API_KEY = usersAuthApiKey as string;\n this.SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/auth`;\n }\n\n getConfig = () => {\n return {\n baseURL: this.SERVICE_API_ROOT_URL,\n headers: {\n common: {\n }\n }\n };\n };\n\n getClient = async () => {\n return axiosHttpService(this.getConfig());\n };\n\n signupAndConfirmUser = async (userSignupRequest: any): Promise<any> => {\n const user = await this.signupUser(userSignupRequest);\n await this.adminConfirmUser(user.email);\n // if fail - delete user and throw error\n return user;\n };\n\n signupUser = async (userSignupRequest: UserSignupRequest): Promise<any> => {\n log.info('Attempting to signup user', { email: userSignupRequest.email });\n\n const client = await this.getClient();\n const response = await client.post('/signup', userSignupRequest);\n\n // Check if Successful or throw error\n if (response.status !== 200 || !response?.data?.user) {\n const message = 'User Signup Failed';\n log.error(message, { response });\n throw new HttpError(HttpStatusCodes.INTERNAL_SERVER_ERROR, message);\n }\n\n log.info('User Signup Successful', { response });\n return response.data.user;\n };\n\n //userName is same as user id\n adminConfirmUser = async (email: string) => {\n //confirm user\n //@TODO update user auth service with admin confirm user endpoint\n log.info('Attempting to admin confirm user', { email });\n\n const client = await this.getClient();\n const response = await client.post('/admin/confirm',\n {\n email\n }, {\n headers: {\n 'x-api-key': this.USERS_AUTH_API_KEY\n }\n }\n );\n\n // Check if Successful or throw error\n if (response.status !== 200) {\n const message = 'Admin User Confirmation Failed';\n log.error(message, { response });\n throw new HttpError(HttpStatusCodes.INTERNAL_SERVER_ERROR, message);\n }\n\n log.info('Admin User Confirmation Successful', { response });\n return response;\n };\n\n getUserByEmail = async (email: string): Promise<ApiResponse<UserResponseData>> => {\n const client = await this.getClient();\n const getUserResponse = await client.get('/lookup', {\n headers: {\n 'x-api-key': this.USERS_AUTH_API_KEY\n },\n params: {\n email\n }\n });\n log.info('getUserResponse', { getUserResponse });\n return getUserResponse;\n };\n\n}\n\n", "import { createHmac } from 'crypto';\nimport * as log from 'lambda-log';\nimport { HttpError } from '../libs';\nimport { mapObjectToQueryString } from '../libs/url';\nexport interface ShopifyRequestValidationParameters {\n code: string,\n hmac?: string,\n shop: string,\n state: string,\n timestamp: string;\n}\n\nexport const isShopifyRequestValid = (validationParams: ShopifyRequestValidationParameters, validationHmac: string, shopifyAppApiSecret: string): boolean => {\n // remove hmac if it exists\n // map input to query string\n // generate hash using api secret key and validate it matches hmac\n delete validationParams.hmac;\n const hmacString = mapObjectToQueryString(validationParams);\n\n\n const generatedHash = createHmac('sha256', shopifyAppApiSecret)\n .update(hmacString)\n .digest('hex');\n\n return generatedHash === validationHmac;\n};\n\nexport const validateShopifyRequest = (validationParams: ShopifyRequestValidationParameters, validationHmac: string, shopifyAppApiSecret: string) => {\n log.info('Validating shopify request is authentic', { validationParams });\n const isValid = isShopifyRequestValid(validationParams, validationHmac as string, shopifyAppApiSecret);\n if (!isValid) {\n const message = 'Failed: Shopify Request hmac validation';\n log.error(message);\n throw HttpError.badRequest(message);\n }\n log.info('Sucess: Shopify Request hmac validation');\n return true;\n}\n\n", "// Record<string, string> is any object\nexport const mapObjectToQueryString = (inputObj: any): string => {\n const qsp = Object.entries(inputObj).sort((a, b) => a[ 0 ] < b[ 0 ] ? -1 : 1);\n const urlParams = new URLSearchParams();\n qsp.map(p => {\n urlParams.append(p[ 0 ], p[ 1 ] as string);\n });\n const qs = urlParams.toString();\n return qs;\n};", "import crypto from 'crypto';\n\nexport const generatePublicKey = (): string => {\n const publicKey = crypto.randomBytes(26);\n return publicKey.toString('utf8');\n};", "/* eslint-disable no-dupe-class-members */\nimport { strict as assert } from 'assert';\n\nconst deepClone = (o = {}) => JSON.parse(JSON.stringify(o));\nconst containsStackTrace = (text = '') => /at.+\\.js:\\d+:\\d+/.test(text);\nconst objectContainsStackTrace = (obj: any) =>\n !obj ? false : containsStackTrace(JSON.stringify(obj));\n\n// may only be expanded by governance, never reduced\nconst supportedStatusCodes: any = {\n 400: 'Bad Request',\n 401: 'Unauthorized',\n 403: 'Forbidden',\n 404: 'Not Found',\n 405: 'Method Not Allowed',\n 409: 'Conflict',\n 412: 'Precondition Failed',\n 413: 'Payload Too Large',\n 415: 'Unsupported Media Type',\n 428: 'Precondition Required',\n 429: 'Too Many Requests',\n 500: 'Internal Server Error',\n 501: 'Not Implemented',\n 502: 'Bad Gateway',\n 503: 'Service Unavailable',\n 504: 'Gateway Timeout'\n};\n\nconst supportedStatusCodesMessage = `statusCode must be one of the following: ${JSON.stringify(Object.keys(supportedStatusCodes))}`;\n//const onlyStatusCodeMessage = 'Server errors may not specify any parameter except statusCode';\n\n//const isNullOrUndefined = (value: any) => value === null || value === undefined;\n\nexport class HttpError extends Error {\n body: {\n [ key: string ]: any;\n };\n headers: object[];\n statusCode: number;\n isServerError: boolean;\n\n constructor (statusCode: number,\n message?: string,\n body?: {\n [ key: string ]: any;\n },\n headers?: object[]) {\n assert(statusCode in supportedStatusCodes, supportedStatusCodesMessage);\n\n const isServerError = statusCode > 499;\n\n assert(\n body === undefined || typeof body === 'object',\n 'body must be an object or omitted'\n );\n assert(\n headers === undefined || typeof headers === 'object',\n 'headers must be an object or omitted'\n );\n\n message = message ?? supportedStatusCodes[ statusCode ];\n\n assert(\n !containsStackTrace(message) && !objectContainsStackTrace(body),\n 'the message or data parameters may not contain errors or stack traces'\n );\n\n super(message);\n\n this.body = deepClone(body);\n this.headers = deepClone(headers);\n this.statusCode = statusCode;\n this.isServerError = isServerError;\n if (!this?.body?.message) {\n this.body.message = this.message;\n }\n }\n\n\n static get supportedStatusCodes() { return supportedStatusCodes; }\n static badRequest = (message?: string, body?: object, headers?: object[]) => { return new HttpError(400, message, body, headers); };\n static unauthorized = (message?: string, body?: object, headers?: object[]) => new HttpError(401, message, body, headers);\n static forbidden = (message?: string, body?: object, headers?: object[]) => new HttpError(403, message, body, headers);\n static notFound = (message?: string, body?: object, headers?: object[]) => new HttpError(404, message, body, headers);\n static internal = (message?: string, body?: object, headers?: object[]) => new HttpError(500, message, body, headers);\n static notImplemented = () => new HttpError(501);\n static badGateway = () => new HttpError(502);\n static serviceUnavailable = (headers: object[]) => new HttpError(503, undefined, undefined, headers);\n static gatewayTimeout = () => new HttpError(504);\n}\n", "export enum HttpStatusCodes {\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.1\n *\n * This interim response indicates that everything so far is OK and that the client should continue with the request or ignore it if it is already finished.\n */\n CONTINUE = 100,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.2\n *\n * This code is sent in response to an Upgrade request header by the client, and indicates the protocol the server is switching too.\n */\n SWITCHING_PROTOCOLS = 101,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.1\n *\n * This code indicates that the server has received and is processing the request, but no response is available yet.\n */\n PROCESSING = 102,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.1\n *\n * The request has succeeded. The meaning of a success varies depending on the HTTP method:\n * GET: The resource has been fetched and is transmitted in the message body.\n * HEAD: The entity headers are in the message body.\n * POST: The resource describing the result of the action is transmitted in the message body.\n * TRACE: The message body contains the request message as received by the server\n */\n OK = 200,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.2\n *\n * The request has succeeded and a new resource has been created as a result of it. This is typically the response sent after a PUT request.\n */\n CREATED = 201,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.3\n *\n * The request has been received but not yet acted upon. It is non-committal, meaning that there is no way in HTTP to later send an asynchronous response indicating the outcome of processing the request. It is intended for cases where another process or server handles the request, or for batch processing.\n */\n ACCEPTED = 202,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.4\n *\n * This response code means returned meta-information set is not exact set as available from the origin server, but collected from a local or a third party copy. Except this condition, 200 OK response should be preferred instead of this response.\n */\n NON_AUTHORITATIVE_INFORMATION = 203,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.5\n *\n * There is no content to send for this request, but the headers may be useful. The user-agent may update its cached headers for this resource with the new ones.\n */\n NO_CONTENT = 204,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.6\n *\n * This response code is sent after accomplishing request to tell user agent reset document view which sent this request.\n */\n RESET_CONTENT = 205,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7233#section-4.1\n *\n * This response code is used because of range header sent by the client to separate download into multiple streams.\n */\n PARTIAL_CONTENT = 206,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.2\n *\n * A Multi-Status response conveys information about multiple resources in situations where multiple status codes might be appropriate.\n */\n MULTI_STATUS = 207,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.1\n *\n * The request has more than one possible responses. User-agent or user should choose one of them. There is no standardized way to choose one of the responses.\n */\n MULTIPLE_CHOICES = 300,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.2\n *\n * This response code means that URI of requested resource has been changed. Probably, new URI would be given in the response.\n */\n MOVED_PERMANENTLY = 301,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.3\n *\n * This response code means that URI of requested resource has been changed temporarily. New changes in the URI might be made in the future. Therefore, this same URI should be used by the client in future requests.\n */\n MOVED_TEMPORARILY = 302,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.4\n *\n * Server sent this response to directing client to get requested resource to another URI with an GET request.\n */\n SEE_OTHER = 303,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7232#section-4.1\n *\n * This is used for caching purposes. It is telling to client that response has not been modified. So, client can continue to use same cached version of response.\n */\n NOT_MODIFIED = 304,\n /**\n * @deprecated\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.6\n *\n * Was defined in a previous version of the HTTP specification to indicate that a requested response must be accessed by a proxy. It has been deprecated due to security concerns regarding in-band configuration of a proxy.\n */\n USE_PROXY = 305,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.7\n *\n * Server sent this response to directing client to get requested resource to another URI with same method that used prior request. This has the same semantic than the 302 Found HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request.\n */\n TEMPORARY_REDIRECT = 307,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7538#section-3\n *\n * This means that the resource is now permanently located at another URI, specified by the Location: HTTP Response header. This has the same semantics as the 301 Moved Permanently HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request.\n */\n PERMANENT_REDIRECT = 308,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.1\n *\n * This response means that server could not understand the request due to invalid syntax.\n */\n BAD_REQUEST = 400,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7235#section-3.1\n *\n * Although the HTTP standard specifies \"unauthorized\", semantically this response means \"unauthenticated\". That is, the client must authenticate itself to get the requested response.\n */\n UNAUTHORIZED = 401,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.2\n *\n * This response code is reserved for future use. Initial aim for creating this code was using it for digital payment systems however this is not used currently.\n */\n PAYMENT_REQUIRED = 402,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.3\n *\n * The client does not have access rights to the content, i.e. they are unauthorized, so server is rejecting to give proper response. Unlike 401, the client's identity is known to the server.\n */\n FORBIDDEN = 403,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.4\n *\n * The server can not find requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 to hide the existence of a resource from an unauthorized client. This response code is probably the most famous one due to its frequent occurence on the web.\n */\n NOT_FOUND = 404,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.5\n *\n * The request method is known by the server but has been disabled and cannot be used. For example, an API may forbid DELETE-ing a resource. The two mandatory methods, GET and HEAD, must never be disabled and should not return this error code.\n */\n METHOD_NOT_ALLOWED = 405,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.6\n *\n * This response is sent when the web server, after performing server-driven content negotiation, doesn't find any content following the criteria given by the user agent.\n */\n NOT_ACCEPTABLE = 406,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7235#section-3.2\n *\n * This is similar to 401 but authentication is needed to be done by a proxy.\n */\n PROXY_AUTHENTICATION_REQUIRED = 407,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.7\n *\n * This response is sent on an idle connection by some servers, even without any previous request by the client. It means that the server would like to shut down this unused connection. This response is used much more since some browsers, like Chrome, Firefox 27+, or IE9, use HTTP pre-connection mechanisms to speed up surfing. Also note that some servers merely shut down the connection without sending this message.\n */\n REQUEST_TIMEOUT = 408,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.8\n *\n * This response is sent when a request conflicts with the current state of the server.\n */\n CONFLICT = 409,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.9\n *\n * This response would be sent when the requested content has been permenantly deleted from server, with no forwarding address. Clients are expected to remove their caches and links to the resource. The HTTP specification intends this status code to be used for \"limited-time, promotional services\". APIs should not feel compelled to indicate resources that have been deleted with this status code.\n */\n GONE = 410,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.10\n *\n * The server rejected the request because the Content-Length header field is not defined and the server requires it.\n */\n LENGTH_REQUIRED = 411,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7232#section-4.2\n *\n * The client has indicated preconditions in its headers which the server does not meet.\n */\n PRECONDITION_FAILED = 412,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.11\n *\n * Request entity is larger than limits defined by server; the server might close the connection or return an Retry-After header field.\n */\n REQUEST_TOO_LONG = 413,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.12\n *\n * The URI requested by the client is longer than the server is willing to interpret.\n */\n REQUEST_URI_TOO_LONG = 414,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.13\n *\n * The media format of the requested data is not supported by the server, so the server is rejecting the request.\n */\n UNSUPPORTED_MEDIA_TYPE = 415,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7233#section-4.4\n *\n * The range specified by the Range header field in the request can't be fulfilled; it's possible that the range is outside the size of the target URI's data.\n */\n REQUESTED_RANGE_NOT_SATISFIABLE = 416,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.14\n *\n * This response code means the expectation indicated by the Expect request header field can't be met by the server.\n */\n EXPECTATION_FAILED = 417,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2324#section-2.3.2\n *\n * Any attempt to brew coffee with a teapot should result in the error code \"418 I'm a teapot\". The resulting entity body MAY be short and stout.\n */\n IM_A_TEAPOT = 418,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.6\n *\n * The 507 (Insufficient Storage) status code means the method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request. This condition is considered to be temporary. If the request which received this status code was the result of a user action, the request MUST NOT be repeated until it is requested by a separate user action.\n */\n INSUFFICIENT_SPACE_ON_RESOURCE = 419,\n /**\n * @deprecated\n * Official Documentation @ https://tools.ietf.org/rfcdiff?difftype=--hwdiff&url2=draft-ietf-webdav-protocol-06.txt\n *\n * A deprecated response used by the Spring Framework when a method has failed.\n */\n METHOD_FAILURE = 420,\n /**\n * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7540#section-9.1.2\n *\n * Defined in the specification of HTTP/2 to indicate that a server is not able to produce a response for the combination of scheme and authority that are included in the request URI.\n */\n MISDIRECTED_REQUEST = 421,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.3\n *\n * The request was well-formed but was unable to be followed due to semantic errors.\n */\n UNPROCESSABLE_ENTITY = 422,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.4\n *\n * The resource that is being accessed is locked.\n */\n LOCKED = 423,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.5\n *\n * The request failed due to failure of a previous request.\n */\n FAILED_DEPENDENCY = 424,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-3\n *\n * The origin server requires the request to be conditional. Intended to prevent the 'lost update' problem, where a client GETs a resource's state, modifies it, and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict.\n */\n PRECONDITION_REQUIRED = 428,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-4\n *\n * The user has sent too many requests in a given amount of time (\"rate limiting\").\n */\n TOO_MANY_REQUESTS = 429,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-5\n *\n * The server is unwilling to process the request because its header fields are too large. The request MAY be resubmitted after reducing the size of the request header fields.\n */\n REQUEST_HEADER_FIELDS_TOO_LARGE = 431,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7725\n *\n * The user-agent requested a resource that cannot legally be provided, such as a web page censored by a government.\n */\n UNAVAILABLE_FOR_LEGAL_REASONS = 451,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.1\n *\n * The server encountered an unexpected condition that prevented it from fulfilling the request.\n */\n INTERNAL_SERVER_ERROR = 500,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.2\n *\n * The request method is not supported by the server and cannot be handled. The only methods that servers are required to support (and therefore that must not return this code) are GET and HEAD.\n */\n NOT_IMPLEMENTED = 501,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.3\n *\n * This error response means that the server, while working as a gateway to get a response needed to handle the request, got an invalid response.\n */\n BAD_GATEWAY = 502,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.4\n *\n * The server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded. Note that together with this response, a user-friendly page explaining the problem should be sent. This responses should be used for temporary conditions and the Retry-After: HTTP header should, if possible, contain the estimated time before the recovery of the service. The webmaster must also take care about the caching-related headers that are sent along with this response, as these temporary condition responses should usually not be cached.\n */\n SERVICE_UNAVAILABLE = 503,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.5\n *\n * This error response is given when the server is acting as a gateway and cannot get a response in time.\n */\n GATEWAY_TIMEOUT = 504,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.6\n *\n * The HTTP version used in the request is not supported by the server.\n */\n HTTP_VERSION_NOT_SUPPORTED = 505,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.6\n *\n * The server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process.\n */\n INSUFFICIENT_STORAGE = 507,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-6\n *\n * The 511 status code indicates that the client needs to authenticate to gain network access.\n */\n NETWORK_AUTHENTICATION_REQUIRED = 511\n}", "import log from 'lambda-log';\nimport { ApiResponse } from '../../types/api-response';\nimport { axiosHttpService } from '../generic/http-client';\nimport { ShopifyAppInstall, ShopifyAppSubscriptionStatus } from '@adtrackify/at-tracking-event-types';\n//const BASE_API_URL = process.env.BASE_API_URL;\n//const DESTINATIONS_API_KEY = process.env.DESTINATIONS_API_KEY;\n\nexport interface ShopifyAppInstallResponseData {\n shopifyAppInstall: ShopifyAppInstall;\n [ key: string ]: any;\n}\n\nexport interface UpdateShopifyAppInstallRequest {\n appSubscriptionStatus?: ShopifyAppSubscriptionStatus,\n pixelId?: string,\n shopifyAppInstallId: string;\n isAppEnabled?: boolean;\n}\n\nexport class ShopifyAppInstallClient {\n\n public BASE_API_URL: string;\n public SHOPIFY_APP_INSTALL_API_KEY: string;\n\n constructor (baseApiUrl: string, shopifyAppInstallApiKey: string) {\n this.BASE_API_URL = baseApiUrl;\n this.SHOPIFY_APP_INSTALL_API_KEY = shopifyAppInstallApiKey;\n }\n\n getConfig = () => {\n const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/shopify-app-installs`;\n return {\n baseURL: SERVICE_API_ROOT_URL,\n headers: {\n common: {\n 'x-api-key': this.SHOPIFY_APP_INSTALL_API_KEY\n }\n }\n };\n };\n\n getClient = async () => {\n return axiosHttpService(this.getConfig());\n };\n\n updateShopifyAppInstall = async (shopifyAppInstallId: string, updateShopifyAppInstallRequest: UpdateShopifyAppInstallRequest): Promise<ApiResponse<ShopifyAppInstallResponseData>> => {\n const client = await this.getClient();\n const response = await client.put(`/${shopifyAppInstallId}`, updateShopifyAppInstallRequest);\n log.info('updateShopifyAppInstall', { response });\n return response as ApiResponse<ShopifyAppInstallResponseData>;\n };\n\n getShopifyAppInstall = async (shopifyAppInstallId: string): Promise<ApiResponse<ShopifyAppInstallResponseData>> => {\n const client = await this.getClient();\n const response = await client.get(`/${shopifyAppInstallId}`);\n log.info('getShopifyAppInstall', { response });\n return response as ApiResponse<ShopifyAppInstallResponseData>;\n };\n\n getShopifyAppInstallByShop = async (shop: string): Promise<ApiResponse<ShopifyAppInstallResponseData>> => {\n const client = await this.getClient();\n const response = await client.get(`/?shop=${shop}`);\n log.info('getShopifyAppInstallByShop', { response });\n return response as ApiResponse<ShopifyAppInstallResponseData>; \n }\n}\n", "import { axiosHttpService } from '../generic/http-client';\nimport * as log from 'lambda-log';\n\nexport class ShopifyClient {\n static _shopify_api_version = process.env.SHOPIFY_API_VERSION as string;\n static getConfig = (shopifyDomain: string, accessToken: string) => {\n const config = {\n baseURL: `https://${shopifyDomain}/admin/api/${this._shopify_api_version}`,\n headers: {\n common: {\n 'X-Shopify-Access-Token': accessToken,\n },\n },\n };\n return config;\n };\n\n static getClient = (shopifyDomain: string, accessToken: string) => {\n return axiosHttpService(\n this.getConfig(shopifyDomain, accessToken)\n );\n };\n\n static registerApp = async (shop: string, code: string, appKey: string, appSecret: string) => {\n const client = axiosHttpService();\n const url = 'https://' + shop + '/admin/oauth/access_token';\n const payload = {\n client_id: appKey,\n client_secret: appSecret,\n code\n };\n const res = await client.post(url, payload);\n return res;\n };\n\n static registerWebhookTopic = async (shop: string, accessToken: string, eventBridgeArn: string, topic: string) => {\n const client = axiosHttpService();\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/webhooks.json`;\n const payload = {\n webhook: {\n topic,\n address: eventBridgeArn,\n format: 'json'\n }\n };\n const res = await client.post(url, payload, { headers: { 'X-Shopify-Access-Token': accessToken } });\n if (res.status >= 400) {\n log.error('Failed to register Webhook Topic', { shop, accessToken, eventBridgeArn, topic, url, payload });\n }\n log.debug('Shopify Client Webhook Registration Response', { registrationResponse: res });\n return res;\n };\n\n static updateShopifyAppMetafield = async (shop: string, accessToken: string, pixelId: string) => {\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/metafields.json`;\n const payload = {\n metafield: {\n namespace: 'adtr',\n key: 'adtr.config',\n value: pixelId,\n type: 'single_line_text_field'\n }\n };\n const res = await this.genericShopifyPost(url, accessToken, payload);\n\n if (res.status >= 400) {\n log.error('Failed to update Shopify app Metafield ', { shop, accessToken, url, payload });\n }\n return res;\n };\n\n static getShopifyStoreProperties = async (shop: string, accessToken: string) => {\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/shop.json`;\n const res = await this.genericShopifyGet(url, accessToken);\n\n if (res.status >= 400) {\n log.error('Failed to get Shopify Store Properties', { shop, accessToken, url });\n }\n return res;\n };\n\n static createAppSubscription = async (shop: string, accessToken: string,\n planName: string, price: number, returnUrl: string, trialDays: number, test?: boolean) => {\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/recurring_application_charges.json`;\n const recurring_application_charge = {\n name: planName,\n price,\n return_url: returnUrl,\n trial_days: trialDays,\n test\n };\n const res = await this.genericShopifyPost(url, accessToken, { recurring_application_charge });\n if (res.status >= 400) {\n log.error('Failed to create App Subscription', { shop, accessToken, url });\n }\n return res;\n };\n\n static cancelAppSubscription = async (shop: string, accessToken: string, chargeId: string) => {\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/recurring_application_charges/${chargeId}.json`;\n const client = axiosHttpService();\n const res = await client.delete(url, { headers: { 'X-Shopify-Access-Token': accessToken } });\n\n if (res.status !== 200) {\n log.error('Failed to cancel recurring App billing', { shop, accessToken, url });\n }\n return res;\n };\n\n static listAppSubscriptions = async (shop: string, accessToken: string) => {\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/recurring_application_charges.json`;\n const res = await this.genericShopifyGet(url, accessToken);\n if (res.status >= 400) {\n log.error('Failed to get App Subscriptions', { shop, accessToken, url });\n }\n return res;\n };\n\n static genericShopifyPost = async (url: string, accessToken: string, payload: any) => {\n const client = axiosHttpService();\n const res = await client.post(url, payload, { headers: { 'X-Shopify-Access-Token': accessToken, 'Content-Type': 'application/json' } });\n log.debug('Shopify Client Response', { res });\n return res;\n };\n\n static genericShopifyGet = async (url: string, accessToken: string) => {\n const client = axiosHttpService();\n const res = await client.get(url, { headers: { 'X-Shopify-Access-Token': accessToken } });\n log.debug('Shopify Client Response', { res });\n return res;\n };\n\n static genericShopifyPut = async (url: string, accessToken: string, payload: any) => {\n const client = axiosHttpService();\n const res = await client.put(url, payload, { headers: { 'X-Shopify-Access-Token': accessToken } });\n log.debug('Shopify Client Response', { res });\n return res;\n };\n}\n", "import Joi from 'joi';\nimport * as log from 'lambda-log';\nimport { HttpError } from '../libs/http-error';\n\nexport const validateInput = (schema: Joi.ObjectSchema<any>, input: any) => {\n const { error, value } = schema.validate(input);\n if (error) {\n log.info('', { error });\n\n const httperr = HttpError.badRequest('Bad Request', {\n errors: error.details.map(detail => ({\n message: detail?.message,\n key: detail?.context?.key,\n path: detail?.path,\n }))\n });\n\n log.info('', { httperr });\n throw httperr;\n }\n return value;\n};", "import * as log from 'lambda-log';\nconst stage = process?.env?.STAGE;\n\nexport const configureLogger = (event: any, context: any, debug = true) => {\n log.options.meta.stage = stage;\n log.options.meta.source_name = context?.functionName || 'unknown';\n log.options.meta.awsRequestId = context?.awsRequestId || 'unknown';\n log.options.meta.lambdaEvent = event;\n log.options.debug = debug;\n}", "\nexport const success = (body: any) => {\n return buildResponse(200, body);\n}\n\nconst defaultError = {\n message: 'internalServerError'\n}\n\nexport const failure = (error: any, statusCode = 500) => {\n statusCode = error?.statusCode ?? statusCode;\n\n let body = defaultError;\n if (error?.body) {\n body = error.body;\n }\n else if (error?.message) {\n body = { message: error.message };\n } else if (statusCode === 500) {\n body = defaultError;\n }\n return buildResponse(statusCode, body);\n}\n\nexport const buildResponse = (statusCode: number, body: any = {}) => {\n delete body.stack;\n return {\n statusCode: statusCode,\n headers: {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Credentials': true,\n 'cache-control': 'max-age=86400',\n Date: new Date(),\n 'Last-Modified': new Date(),\n 'Access-Control-Allow-Headers':\n 'Content-Type, Content-Encoding'\n },\n body: JSON.stringify(body),\n };\n}\n", "import { Subscription } from './subscription';\n\nexport interface Account {\n id: string,\n accountName: string,\n companyName?: string,\n accountStatus: ACCOUNT_STATUS,\n primaryEmail: string,\n publicApiKey?: string,\n subscriptionId?: string,\n pixels?: Pixel[],\n subscription?: Subscription;\n ownerId?: string,\n createdAt: string,\n updatedAt: string;\n}\n\n\nexport interface Pixel {\n id: string;\n accountId: string;\n name: string;\n createdAt: string,\n updatedAt: string;\n}\n\nexport enum ACCOUNT_STATUS {\n PENDING = 'pending',\n ACTIVE = 'active',\n INACTIVE = 'inactive'\n}", "\r\nexport interface Destination {\r\n id: string,\r\n accountId: string,\r\n pixelId: string,\r\n destination: string;\r\n displayName?: string,\r\n enabled: boolean;\r\n configuration?: UserDestinationConfiguration,\r\n createdAt: string,\r\n updatedAt: string;\r\n}\r\n\r\nexport enum DESTINATIONS {\r\n FACEBOOK = 'facebook',\r\n TIKTOK = 'tiktok',\r\n GOOGLE_ADS = 'googleAds',\r\n GOOGLE_ANALYTICS_4 = 'googleAnalytics4',\r\n HUBSPOT = 'hubspot',\r\n WEBHOOK = 'webhook',\r\n CUSTOM_HTML = 'customHTML',\r\n CUSTOM_JS = 'customJS',\r\n SNAPCHAT = 'snapchat',\r\n TWITTER = 'twitter',\r\n REDDIT = 'reddit'\r\n}\r\n\r\nexport interface UserDestinationConfiguration {\r\n [ key: string ]: any;\r\n eventBlacklist?: string[];\r\n events?: EventConfiguration[];\r\n trigger?: DestinationTriggerConfiguration;\r\n}\r\n\r\nexport interface DestinationTriggerConfiguration {\r\n shopify?: ShopifyTriggerConfiguration;\r\n exludeDomains?: string[];\r\n excludePages?: string[];\r\n domains?: string[];\r\n pages?: string[];\r\n}\r\n\r\nexport interface ShopifyTriggerConfiguration {\r\n enabled: boolean;\r\n collections?: string[];\r\n tags?: string[];\r\n}\r\n\r\n\r\nexport interface EventConfiguration {\r\n sourceEventName: string;\r\n exclude?: boolean;\r\n sample: EventSampleConfiguration;\r\n transformations?: EventTransformation[];\r\n}\r\n\r\nexport interface EventTransformation {\r\n transformationEventName: string;\r\n enabled: boolean;\r\n}\r\n\r\nexport interface EventSampleConfiguration {\r\n enabled: boolean;\r\n rate: number;\r\n}\r\n\r\n", "import { Destination, UserDestinationConfiguration } from './destinations';\r\n\r\nexport interface AdTrackifyFacebookDestination extends Destination {\r\n configuration: FacebookPixelConfiguration;\r\n}\r\n\r\nexport interface AdTrackifyTikTokDestination extends Destination {\r\n configuration: TiktokPixelConfiguration;\r\n}\r\n\r\nexport interface AdTrackifyGoogleAnalytics4Destination extends Destination {\r\n configuration: GoogleAnalytics4Configuration;\r\n}\r\n\r\n// Destination Specific configurations below\r\nexport interface FacebookPixelConfiguration extends UserDestinationConfiguration {\r\n apiAccessToken?: string;\r\n enableConversionAPI: boolean;\r\n pixelId: string;\r\n}\r\n\r\nexport interface TiktokPixelConfiguration extends UserDestinationConfiguration {\r\n apiAccessToken?: string;\r\n enableConversionAPI: boolean;\r\n pixelId: string;\r\n}\r\n\r\nexport interface GoogleAnalytics4Configuration extends UserDestinationConfiguration {\r\n apiSecret: string;\r\n measurementId: string;\r\n}\r\n\r\nexport interface GoogleAdsConfiguration extends UserDestinationConfiguration {\r\n pixelId: string;\r\n conversionID: string;\r\n}\r\n\r\nexport interface HubspotPixelConfiguration extends UserDestinationConfiguration {\r\n hubspotId: string;\r\n}\r\n\r\nexport interface SnapchatPixelConfiguration extends UserDestinationConfiguration {\r\n snapchatPixelId: string;\r\n}\r\n\r\nexport interface TwitterPixelConfiguration extends UserDestinationConfiguration {\r\n twitterPixelId: string;\r\n}\r\n\r\nexport interface WebhookConfiguration extends UserDestinationConfiguration {\r\n webhookUrl: string;\r\n}\r\n\r\nexport interface CustomHTMLConfiguration extends UserDestinationConfiguration {\r\n html: string;\r\n location: CustomHTMLLocation;\r\n}\r\n\r\nexport interface CustomJSConfiguration extends UserDestinationConfiguration {\r\n script: string;\r\n async: boolean;\r\n defer: boolean;\r\n location: CustomHTMLLocation;\r\n}\r\n\r\nexport enum CustomHTMLLocation {\r\n HEADER = 'header',\r\n FOOTER = 'footer',\r\n BODY = 'body'\r\n}\r\n\r\n", "export interface ShopifyAppInstall {\n shopifyAppInstallId: string;\n shop: string;\n accessToken?: string;\n appStatus?: string;\n appSubscriptionStatus?: ShopifyAppSubscriptionStatus;\n code?: string;\n hmac?: string;\n host?: string;\n installRequest?: ShopifyInstallRequest;\n isAppEnabled?: boolean;\n pixelId?: string;\n shopInfo?: any;\n state?: string;\n timestamp?: number;\n createdAt: string;\n updatedAt: string;\n}\n\nexport enum ShopifyAppInstallStatus {\n STARTED = 'started',\n COMPLETED = 'completed',\n UNINSTALLED = 'uninstalled',\n FAILED = 'failed',\n NONE = 'none'\n}\nexport enum ShopifyAppSubscriptionStatus {\n ACTIVE = 'active', // approved and billed to shop\n CANCELLED = 'cancelled', // cancelled, uninstalled or cancellation\n DECLINED = 'declined', // subscription declined by merchant\n EXPIRED = 'expired', //wasn't approved within two days of being created\n FROZEN = 'frozen', //on hold due to not payment\n PENDING = 'pending', // pending approval\n NOT_SUBMITTED = 'na' // billing has not yet been attempted\n}\n\nexport interface ShopifyInstallRequest {\n shop?: string;\n session?: string;\n hmac?: string;\n host?: string;\n nonce?: string;\n timestamp?: string;\n status?: string;\n}\n\nexport interface ShopifyStoreInfo {\n // TBD based on shopify api\n [ key: string ]: any;\n}", "\nexport interface Subscription {\n id: string,\n accountId?: string,\n shopifyAppInstallId?: string,\n shopifyDomain?: string,\n stripeCustomerId?: string,\n stripeSubscriptionId?: string,\n stripeCompletedCheckoutSession?: any;\n shopifyChargeId?: string;\n subscriptionPlan?: SubscriptionPlan,\n status?: SUBSCRIPTION_STATUS,\n paymentStatus?: PAYMENT_STATUS,\n paymentGateway?: PAYMENT_GATEWAY,\n createdAt: string,\n updatedAt: string,\n\n}\nexport interface SubscriptionPlan {\n id: number;\n planName: string;\n displayName: string;\n description: string;\n sku: string;\n price: string;\n displayPrice: string;\n billingFrequency: PLAN_BILLING_FREQUENCY;\n trialLengthDays?: number;\n trialRequiresCreditCard?: boolean;\n planDesc?: string[];\n unitPriceText?: string;\n isHighlighted?: boolean;\n isBanner?: boolean;\n bannerText?: string;\n bannerColor?: string;\n stripePriceId?: string;\n stripeProductId?: string;\n}\n\nexport enum PLAN_BILLING_FREQUENCY {\n MONTHLY = 'monthly',\n YEARLY = 'yearly'\n}\n\nexport enum PAYMENT_STATUS {\n CURRENT = 'current',\n PAST_DUE = 'past_due',\n CANCELLED = 'cancelled',\n FAILED = 'failed'\n}\n\nexport enum SUBSCRIPTION_STATUS {\n ACTIVE = 'active', // approved and billed to shop\n CANCELLED = 'cancelled', // cancelled, uninstalled or cancellation\n DECLINED = 'declined', // subscription declined by merchant\n EXPIRED = 'expired', //wasn't approved within two days of being created\n FROZEN = 'frozen', //on hold due to not payment\n PENDING = 'pending', // pending approval\n NOT_SUBMITTED = 'na' // billing has not yet been attempted\n}\nexport enum PAYMENT_GATEWAY {\n STRIPE = 'stripe',\n PAYPAL = 'paypal',\n SHOPIFY = 'shopify'\n}\n", "export enum ADTRACKIFY_STANDARD_EVENT {\n ADD_PAYMENT_INFO = 'add_payment_info',\n ADD_SHIPPING_INFO = 'add_shipping_info',\n ADD_TO_CART = 'add_to_cart',\n ADD_TO_WISHLIST = 'add_to_wishlist',\n // COMPLETE_REGISTRATION: 'complete_registration',\n // CONTACT: 'contact',\n INITIATE_CHECKOUT = 'initiate_checkout',\n LEAD = 'lead',\n LOGIN = 'login',\n PAGE_VIEW = 'page_view',\n PURCHASE = 'purchase',\n REFUND = 'refund',\n SEARCH = 'search',\n // START_TRIAL: 'start_trial',\n // SUBMIT_APPLICATION: 'submit_application',\n // SUBSCRIBE: 'subscribe',\n SIGN_UP = 'sign_up',\n VIEW_CART = 'view_cart',\n VIEW_CONTENT = 'view_content',\n\n\n //\n SELECT_SHIPPING_METHOD = 'select_shipping_method',\n VIRTUALIZED_VIEWED_PAYMENT_FORM = 'virtualized_viewd_payment_form'\n}", "import { ADTRACKIFY_STANDARD_EVENT } from '../adtrackify-standard-events';\nimport { AddressInfo } from '../common/address';\nimport { TrackingEventContext } from './tracking-event-context';\nimport { TrackingEventIdentity } from './tracking-event-identity';\n\nexport interface TrackingEvent {\n id: string;\n type: string;\n name: ADTRACKIFY_STANDARD_EVENT;\n pixelId: string;\n context?: TrackingEventContext;\n identity?: TrackingEventIdentity;\n data?: TrackingEventData;\n testCode?: string;\n sentAtEpoch?: number;\n collectedAt?: string;\n version: string;\n}\n\nexport interface TrackingEventData {\n [ key: string ]: any;\n firstName?: string;\n lastName?: string;\n email?: string;\n phone?: string;\n addresses?: AddressInfo[];\n cartId?: string;\n transactionId?: string;\n affiliation?: string;\n currency?: string;\n price?: number;\n subtotalPrice?: number;\n value?: number;\n tax?: number;\n shipping?: number;\n coupon?: string;\n paymentType?: string;\n shippingTier?: string;\n creativeName?: string;\n creativeSlot?: string;\n locationId?: string;\n promotionId?: string;\n promotionName?: string;\n items?: GenericContent[];\n}\n\nexport interface GenericContent {\n [ key: string ]: any;\n content_type?: string;\n id?: string;\n name?: string;\n sku?: string;\n brand?: string;\n variant?: string;\n coupon?: string;\n currency?: string;\n discount?: number;\n index?: number;\n value?: number;\n price?: number;\n quantity?: number;\n url?: string;\n locationId?: string;\n imageUrl?: string;\n category?: string;\n category2?: string;\n category3?: string;\n category4?: string;\n category5?: string;\n}\n\n\nexport const Currencies: string[] = [ 'AED', 'ARS', 'AUD', 'BDT', 'BIF', 'BOB', 'BRL', 'CAD', 'CHF', 'CLP', 'CNY', 'COP', 'CRC', 'CZK', 'DKK', 'DZD', 'EGP', 'EUR', 'GBP', 'GTQ', 'HKD', 'HNL', 'HUF', 'IDR', 'ILS', 'INR', 'ISK', 'JPY', 'KES', 'KRW', 'KWD', 'KZT', 'MAD', 'MOP', 'MXN', 'MYR', 'NGN', 'NIO', 'NOK', 'NZD', 'PEN', 'PHP', 'PKR', 'PLN', 'PYG', 'QAR', 'RON', 'RUB', 'SAR', 'SEK', 'SGD', 'THB', 'TRY', 'TWD', 'USD', 'VES', 'VND', 'ZAR' ];\n\n", "import { SubscriptionPlan, PLAN_BILLING_FREQUENCY } from '@adtrackify/at-tracking-event-types';\n\nexport const StripeBillingMap: any = {\n dev2: {\n 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',\n 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',\n 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',\n 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',\n 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'\n },\n qa2: {\n 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',\n 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',\n 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',\n 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',\n 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'\n },\n prod2: {\n 'free': 'price_1KAFsIK7krGh4037RsaAYMEl',\n 'starter_monthly': 'price_1KAFsMK7krGh4037Lz3P0ksU',\n 'starter_yearly': 'price_1KAFsMK7krGh4037Dj1WmSi8',\n 'scale_monthly': 'price_1KAFrxK7krGh4037zWCdaTly',\n 'scale_yearly': 'price_1KAFrxK7krGh40375fhymyWP',\n 'growth_monthly': 'price_1KAFs7K7krGh4037JChjz5Cr',\n 'growth_yearly': 'price_1KAFs7K7krGh4037rZElg12s'\n },\n dev: {\n 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',\n 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',\n 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',\n 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',\n 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'\n },\n qa: {\n 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',\n 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',\n 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',\n 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',\n 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'\n },\n prod: {\n 'free': 'price_1KAFsIK7krGh4037RsaAYMEl',\n 'starter_monthly': 'price_1KAFsMK7krGh4037Lz3P0ksU',\n 'starter_yearly': 'price_1KAFsMK7krGh4037Dj1WmSi8',\n 'scale_monthly': 'price_1KAFrxK7krGh4037zWCdaTly',\n 'scale_yearly': 'price_1KAFrxK7krGh40375fhymyWP',\n 'growth_monthly': 'price_1KAFs7K7krGh4037JChjz5Cr',\n 'growth_yearly': 'price_1KAFs7K7krGh4037rZElg12s'\n }\n};\n\nexport const CommonPlanInfo = [\n //'60-day Risk Free Trial',\n 'Free Server Side Tracking & Conversion API',\n 'MultiPixel Support (Multiple facebook, tiktok, etc)',\n 'Corrects Facebook Conversion Tracking post IOS14',\n 'Increase ROAS & Attribution Data',\n 'Enhanced Fingerprinting & Identity Resolution',\n 'Unlimited Integrations',\n 'Advanced Integrations (Webhooks, Custom JS/HTML, Hubspot)'\n];\n\nexport const SubscriptionPlanSeedItems: {\n items: SubscriptionPlan[];\n} = {\n items: [ {\n id: 1,\n planName: 'free',\n displayName: 'Free',\n sku: 'ADT-001',\n description: 'Free Plan - Monthly',\n price: '0',\n displayPrice: '$0',\n billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,\n trialLengthDays: 0,\n trialRequiresCreditCard: false,\n planDesc: [\n ...CommonPlanInfo,\n 'Free Up to 500 orders/month (50,000 events)*'\n ],\n unitPriceText: 'try now - free forever',\n isHighlighted: false,\n isBanner: false\n },\n // STARTER PLANS\n {\n id: 2,\n planName: 'starter_monthly',\n displayName: 'Starter',\n sku: 'ADT-002',\n description: 'Starter Plan - Monthly',\n price: '79.99',\n displayPrice: '$79.99',\n billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,\n trialLengthDays: 60,\n trialRequiresCreditCard: false,\n planDesc: [\n '60-day Risk Free Trial',\n ...CommonPlanInfo,\n 'Up to 2,000 orders/month (250,000 events)*'\n ],\n isHighlighted: true,\n isBanner: true,\n bannerColor: 'blue',\n bannerText: 'MOST POPULAR'\n }, {\n id: 3,\n planName: 'starter_yearly',\n displayName: 'Starter',\n sku: 'ADT-003',\n description: 'Starter Plan - Yearly',\n price: '767.90',\n displayPrice: '$63.99',\n billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,\n trialLengthDays: 30,\n trialRequiresCreditCard: false,\n planDesc: [\n '60-day Risk Free Trial',\n ...CommonPlanInfo,\n 'Up to 2,000 orders/month (250,000 events)*'\n ],\n unitPriceText: 'billed yearly ($767.90) - 20% savings',\n isHighlighted: true,\n isBanner: true,\n bannerColor: 'blue',\n bannerText: 'MOST POPULAR'\n },\n // SCALE PLANS\n {\n id: 4,\n planName: 'scale_monthly',\n displayName: 'Scale',\n sku: 'ADT-004',\n description: 'Scale Plan - Monthly',\n price: '199.99',\n displayPrice: '$199.99',\n billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,\n trialLengthDays: 60,\n trialRequiresCreditCard: false,\n planDesc: [\n '60-day Risk Free Trial',\n ...CommonPlanInfo,\n 'Up to 7,500 orders/month (750,000 events)*'\n ],\n unitPriceText: '',\n isHighlighted: false,\n isBanner: false\n }, {\n id: 5,\n planName: 'scale_yearly',\n displayName: 'Scale',\n sku: 'ADT-005',\n description: 'Scale Plan - Yearly',\n price: '1823.91',\n displayPrice: '$151.99',\n billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,\n trialLengthDays: 60,\n trialRequiresCreditCard: false,\n planDesc: [\n '60-day Risk Free Trial',\n ...CommonPlanInfo,\n 'Up to 7,500 orders/month (750,000 events)*'\n ],\n unitPriceText: 'billed yearly ($1823.91) - 24% savings',\n isHighlighted: false,\n isBanner: false\n },\n // // GROWTH PLANS\n // {\n // id: 6,\n // planName: 'growth_monthly',\n // displayName: 'Growth',\n // sku: 'ADT-006',\n // description: 'Growth Plan - Monthly',\n // price: '199.99',\n // displayPrice: '$199.99',\n // billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,\n // trialLengthDays: 60,\n // trialRequiresCreditCard: false,\n // planDesc: [\n // '60-day Risk Free Trial',\n // ...CommonPlanInfo,\n // '250,000 tracking events/mo'\n // ],\n // unitPriceText: 'billed yearly ($540) - 25% savings',\n // isHighlighted: false,\n // isBanner: true,\n // bannerColor: 'orange',\n // bannerText: 'BEST VALUE'\n // }, {\n // id: 7,\n // planName: 'growth_yearly',\n // displayName: 'Growth',\n // sku: 'ADT-007',\n // description: 'Growth Plan - Yearly',\n // price: '1799.91',\n // displayPrice: '$149.99',\n // billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,\n // trialLengthDays: 60,\n // trialRequiresCreditCard: false,\n // planDesc: [\n // '30-day Risk Free Trial',\n // 'Fixes IOS14.5 tracking',\n // 'Multi Pixel Support',\n // 'Enhanced Tracking / Attribution',\n // 'Unlimited Facebook Conversion API',\n // 'Unlimited Integrations',\n // 'Easy no code setup',\n // '100,000 tracking events/mo'\n // ],\n // unitPriceText: 'billed yearly ($1799.91) - 25% savings',\n // isHighlighted: false,\n // isBanner: true,\n // bannerColor: 'orange',\n // bannerText: 'BEST VALUE'\n // },\n ]\n};\n\n\nexport const getPlanDetails = (planId: number, stage: string) => {\n const plan = SubscriptionPlanSeedItems.items.filter(x => x.id === planId)[ 0 ] as any;\n plan.stripePriceId = StripeBillingMap[ stage ][ plan.planName ];\n return plan as SubscriptionPlan;\n};\n\nexport const getPlanByStripePriceId = (stripePriceId: string, stage: string) => {\n const stripePriceIds = StripeBillingMap[ stage ];\n const planName = Object.keys(stripePriceIds).find(key => stripePriceIds[ key ] === stripePriceId);\n\n const plan = SubscriptionPlanSeedItems.items.filter(x => x.planName === planName)[ 0 ] as any;\n plan.stripePriceId = stripePriceId;\n\n return plan as SubscriptionPlan;\n};", "export enum ADTRACKIFY_EVENT_TYPES {\n NOTIFY_SHOPIFY_SUBSCRIPTION_CREATED = 'shopifySubscriptionCreated',\n NOTIFY_SUBSCRIPTION_SIGNUP_COMPLETED = 'subscription.signupCompleted',\n REQUEST_SET_ACCOUNT_OWNER = 'setAccountOwner',\n REQUEST_SET_ACCOUNT_SUBSCRIPTION_ID = 'setAccountSubscriptionId',\n}\n\nexport enum ADTRACKIFY_EVENT_SOURCES {\n SUBSCRIPTIONS = 'subscriptions',\n}", "import { EventBridgeClient } from '../clients';\nimport { Message, TemplatedMessage } from 'postmark';\n\nexport const enum PostmarkRequestType {\n SINGLE_EMAIL = 'single_email',\n TEMPLATE_EMAIL = 'template_email'\n}\n\nexport enum ADTRACKIFY_EVENT_BRIDGE_EVENTS {\n SEND_POSTMARK_EMAIL = 'integration.sendPostmarkEmail',\n}\n\nexport class EventBridgeIntegrationService {\n public eventBridgeClient: EventBridgeClient;\n public EVENT_BUS_NAME: string;\n\n constructor (eventBusName: string) {\n this.eventBridgeClient = new EventBridgeClient(eventBusName);\n this.EVENT_BUS_NAME = eventBusName;\n }\n\n public sendPostmarkEmailEvent = async (eventSource: string, postmarkMessage: Message, postmarkServerToken: string) => {\n return await this.eventBridgeClient.buildAndSendEvent(\n eventSource,\n ADTRACKIFY_EVENT_BRIDGE_EVENTS.SEND_POSTMARK_EMAIL,\n {\n postmarkMessage,\n postmarkRequestType: PostmarkRequestType.SINGLE_EMAIL,\n postmarkServerToken\n });\n };\n\n public sendPostmarkTemplatedEmailEvent = async (eventSource: string, postmarkMessage: TemplatedMessage, postmarkServerToken: string) => {\n return await this.eventBridgeClient.buildAndSendEvent(\n eventSource,\n ADTRACKIFY_EVENT_BRIDGE_EVENTS.SEND_POSTMARK_EMAIL,\n {\n postmarkMessage,\n postmarkRequestType: PostmarkRequestType.TEMPLATE_EMAIL,\n postmarkServerToken\n });\n };\n\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAAA,SAAS,sBAAmC;AAC5C,SAAS,wBAAwB;AACjC,YAAY,SAAS;AAErB,IAAM,kBAAkB;AAAA,EACtB,oBAAoB;AAAA,EACpB,uBAAuB;AAAA,EACvB,2BAA2B;AAC7B;AAEA,IAAM,oBAAoB;AAAA,EACxB,aAAa;AACf;AAEA,IAAM,kBAAkB,EAAE,iBAAiB,kBAAkB;AAC7D,IAAM,YAAY,IAAI,eAAe,CAAC,CAAC;AACvC,IAAM,SAAS,iBAAiB,KAAK,WAAW,eAAe;AAExD,IAAM,kBAAN,MAAqB;AA4G5B;AA5GO,IAAM,iBAAN;AACL,cADW,gBACJ,WAAU,OAAO,WAAmB,SAAiB,aAAkB;AAC5E,MAAI;AACF,UAAM,SAAS;AAAA,MACb,WAAW;AAAA,MACX,KAAK;AAAA,QACH,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error", "log", "error", "log", "client", "log", "client", "success", "log", "log", "a", "p", "HttpStatusCodes", "client", "log", "client", "log", "log", "client", "log", "error", "log", "debug", "error", "ACCOUNT_STATUS", "DESTINATIONS", "CustomHTMLLocation", "ShopifyAppInstallStatus", "ShopifyAppSubscriptionStatus", "PLAN_BILLING_FREQUENCY", "PAYMENT_STATUS", "SUBSCRIPTION_STATUS", "PAYMENT_GATEWAY", "ADTRACKIFY_STANDARD_EVENT", "stage", "x", "ADTRACKIFY_EVENT_TYPES", "ADTRACKIFY_EVENT_SOURCES", "PostmarkRequestType", "ADTRACKIFY_EVENT_BRIDGE_EVENTS"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -26,7 +26,7 @@ const buildAttributes = (data: any) => {
|
|
|
26
26
|
return dictToAwsAttributes(attributes);
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
export class
|
|
29
|
+
export class CognitoClient {
|
|
30
30
|
static setCredentials = (userPoolId: string, userPoolNoSecretClientId: string) => {
|
|
31
31
|
USER_POOL_ID = userPoolId;
|
|
32
32
|
USER_POOL_NO_SECRET_CLIENT_ID = userPoolNoSecretClientId;
|
|
@@ -45,7 +45,7 @@ export class CognitoService {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
static forgotPassword = async (email: string) => {
|
|
48
|
-
await
|
|
48
|
+
await CognitoClient.adminEmailVerify(email);
|
|
49
49
|
const params: ForgotPasswordCommandInput = {
|
|
50
50
|
ClientId: USER_POOL_NO_SECRET_CLIENT_ID,
|
|
51
51
|
Username: email,
|
|
@@ -57,9 +57,9 @@ export class CognitoService {
|
|
|
57
57
|
|
|
58
58
|
static adminEmailVerify = async (email: string) => {
|
|
59
59
|
try {
|
|
60
|
-
const user: any = await
|
|
60
|
+
const user: any = await CognitoClient.getUserByEmail(email);
|
|
61
61
|
if (user && user?.UserStatus === 'CONFIRMED' && user?.email_verified !== 'true') {
|
|
62
|
-
await
|
|
62
|
+
await CognitoClient.forceValidateEmail(email);
|
|
63
63
|
}
|
|
64
64
|
} catch (error) {
|
|
65
65
|
log.error('Failed admin email verify', { error });
|
|
@@ -90,7 +90,7 @@ export class CognitoService {
|
|
|
90
90
|
Username: data.email,
|
|
91
91
|
};
|
|
92
92
|
const cognitoResponse = await cognitoClient.adminConfirmSignUp(params);
|
|
93
|
-
await
|
|
93
|
+
await CognitoClient.forceValidateEmail(data.email);
|
|
94
94
|
log.debug('Admin Successfully Confirmed User', { cognitoResponse });
|
|
95
95
|
return cognitoResponse;
|
|
96
96
|
}
|