@adtrackify/at-service-common 1.2.8 → 1.2.9
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/clients/generic/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/clients/generic/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -382,8 +382,43 @@ var CognitoClient = class {
|
|
|
382
382
|
};
|
|
383
383
|
};
|
|
384
384
|
|
|
385
|
-
// src/clients/
|
|
385
|
+
// src/clients/generic/sqs-client.ts
|
|
386
|
+
import { SQS } from "@aws-sdk/client-sqs";
|
|
387
|
+
import { v4 as uuidv42 } from "uuid";
|
|
386
388
|
import * as log5 from "lambda-log";
|
|
389
|
+
var SQSClient = class {
|
|
390
|
+
sqs;
|
|
391
|
+
queueUrl;
|
|
392
|
+
constructor(region, accountId, queueName) {
|
|
393
|
+
this.sqs = new SQS({ region });
|
|
394
|
+
this.queueUrl = `https://sqs.${region}.amazonaws.com/${accountId}/${queueName}`;
|
|
395
|
+
}
|
|
396
|
+
buildAndSendEvent = async (eventType, eventData, deplaySeconds = 0) => {
|
|
397
|
+
const event = this.buildEvent(eventType, eventData);
|
|
398
|
+
return await this.putEvent(event, deplaySeconds);
|
|
399
|
+
};
|
|
400
|
+
buildEvent = (eventType, eventData, eventId = uuidv42(), eventTime = getCurrentTimestamp()) => {
|
|
401
|
+
return {
|
|
402
|
+
eventId,
|
|
403
|
+
eventType,
|
|
404
|
+
eventTime,
|
|
405
|
+
eventData
|
|
406
|
+
};
|
|
407
|
+
};
|
|
408
|
+
putEvent = async (data, delaySeconds = 0) => {
|
|
409
|
+
const params = {
|
|
410
|
+
QueueUrl: this.queueUrl,
|
|
411
|
+
DelaySeconds: delaySeconds,
|
|
412
|
+
MessageBody: JSON.stringify(data)
|
|
413
|
+
};
|
|
414
|
+
const response = await this.sqs.sendMessage(params);
|
|
415
|
+
log5.debug("SQS Event Published", { queueUrl: this.queueUrl, event: data });
|
|
416
|
+
return response;
|
|
417
|
+
};
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
// src/clients/internal-api/destinations-client.ts
|
|
421
|
+
import * as log6 from "lambda-log";
|
|
387
422
|
var DestinationsClient = class {
|
|
388
423
|
BASE_API_URL;
|
|
389
424
|
DESTINATIONS_API_KEY;
|
|
@@ -408,19 +443,19 @@ var DestinationsClient = class {
|
|
|
408
443
|
createDestination = async (createDestinationRequest) => {
|
|
409
444
|
const client2 = await this.getClient();
|
|
410
445
|
const response = await client2.post("/", createDestinationRequest);
|
|
411
|
-
|
|
446
|
+
log6.info("createDestinationResponse", { response });
|
|
412
447
|
return response;
|
|
413
448
|
};
|
|
414
449
|
getPixelDestinations = async (pixelId) => {
|
|
415
450
|
const client2 = await this.getClient();
|
|
416
451
|
const response = await client2.get(`/?pixelId=${pixelId}`);
|
|
417
|
-
|
|
452
|
+
log6.info("getPixelResponse", { response });
|
|
418
453
|
return response;
|
|
419
454
|
};
|
|
420
455
|
};
|
|
421
456
|
|
|
422
457
|
// src/clients/internal-api/accounts-client.ts
|
|
423
|
-
import * as
|
|
458
|
+
import * as log7 from "lambda-log";
|
|
424
459
|
var AccountsClient = class {
|
|
425
460
|
BASE_API_URL;
|
|
426
461
|
ACCOUNTS_API_KEY;
|
|
@@ -448,19 +483,19 @@ var AccountsClient = class {
|
|
|
448
483
|
createAccount = async (createAccountRequest) => {
|
|
449
484
|
const client2 = await this.getClient();
|
|
450
485
|
const createAccountResponse = await client2.post("", createAccountRequest);
|
|
451
|
-
|
|
486
|
+
log7.info("createAccountResponse", { createAccountResponse });
|
|
452
487
|
return createAccountResponse;
|
|
453
488
|
};
|
|
454
489
|
updateAccount = async (accountId, body) => {
|
|
455
490
|
const client2 = await this.getClient();
|
|
456
491
|
const response = await client2.patch(`/${accountId}/`, body);
|
|
457
|
-
|
|
492
|
+
log7.info("update Account response", { response });
|
|
458
493
|
return response;
|
|
459
494
|
};
|
|
460
495
|
addOwner = async (accountId, userId) => {
|
|
461
496
|
const client2 = await this.getClient();
|
|
462
497
|
const addOwnerResponse = await client2.post("/addOwner", { accountId, userId });
|
|
463
|
-
|
|
498
|
+
log7.info("addOwnerResponse", { addOwnerResponse });
|
|
464
499
|
return addOwnerResponse;
|
|
465
500
|
};
|
|
466
501
|
isAuthorizedUser = async (userId, accountId, pixelId) => {
|
|
@@ -471,31 +506,31 @@ var AccountsClient = class {
|
|
|
471
506
|
pixelId
|
|
472
507
|
};
|
|
473
508
|
const response = await client2.post("/checkUserAuthorization", body);
|
|
474
|
-
|
|
509
|
+
log7.info("checkUserAuthorization", { response });
|
|
475
510
|
return response;
|
|
476
511
|
};
|
|
477
512
|
adminDeleteAccount = async (accountId) => {
|
|
478
513
|
const client2 = await this.getClient();
|
|
479
514
|
const success2 = await client2.delete(`/${accountId}`);
|
|
480
|
-
|
|
515
|
+
log7.info("adminDeleteAccount");
|
|
481
516
|
return success2;
|
|
482
517
|
};
|
|
483
518
|
getPixelConfigById = async (pixelId) => {
|
|
484
519
|
const client2 = await this.getClient();
|
|
485
520
|
const pixelResponse = await client2.get(`/px/${pixelId}/config`);
|
|
486
|
-
|
|
521
|
+
log7.debug("get pixelResponse", { pixelResponse });
|
|
487
522
|
return pixelResponse;
|
|
488
523
|
};
|
|
489
524
|
getAccount = async (accountId) => {
|
|
490
525
|
const client2 = await this.getClient();
|
|
491
526
|
const response = await client2.get(`/${accountId}/`);
|
|
492
|
-
|
|
527
|
+
log7.info("get account response", { response });
|
|
493
528
|
return response;
|
|
494
529
|
};
|
|
495
530
|
addUserToAccount = async (accountId, userId) => {
|
|
496
531
|
const client2 = await this.getClient();
|
|
497
532
|
const response = await client2.post("/addUser", { accountId, userId });
|
|
498
|
-
|
|
533
|
+
log7.info("add user account response", { response });
|
|
499
534
|
return response;
|
|
500
535
|
};
|
|
501
536
|
// setAccountSubscriptionId = async (accountId: string, subscriptionId: string): Promise<ApiResponse<any>> => {
|
|
@@ -507,7 +542,7 @@ var AccountsClient = class {
|
|
|
507
542
|
};
|
|
508
543
|
|
|
509
544
|
// src/clients/internal-api/users-auth-client.ts
|
|
510
|
-
import * as
|
|
545
|
+
import * as log8 from "lambda-log";
|
|
511
546
|
|
|
512
547
|
// src/libs/http-error.ts
|
|
513
548
|
import { strict as assert } from "assert";
|
|
@@ -668,20 +703,20 @@ var UsersAuthClient = class {
|
|
|
668
703
|
return user;
|
|
669
704
|
};
|
|
670
705
|
signupUser = async (userSignupRequest) => {
|
|
671
|
-
|
|
706
|
+
log8.info("Attempting to signup user", { email: userSignupRequest.email });
|
|
672
707
|
const client2 = await this.getClient();
|
|
673
708
|
const response = await client2.post("/signup", userSignupRequest);
|
|
674
709
|
if (response.status !== 200 || !response?.data?.user) {
|
|
675
710
|
const message = "User Signup Failed";
|
|
676
|
-
|
|
711
|
+
log8.error(message, { response });
|
|
677
712
|
throw new HttpError(500 /* INTERNAL_SERVER_ERROR */, message);
|
|
678
713
|
}
|
|
679
|
-
|
|
714
|
+
log8.info("User Signup Successful", { response });
|
|
680
715
|
return response.data.user;
|
|
681
716
|
};
|
|
682
717
|
//userName is same as user id
|
|
683
718
|
adminConfirmUser = async (email) => {
|
|
684
|
-
|
|
719
|
+
log8.info("Attempting to admin confirm user", { email });
|
|
685
720
|
const client2 = await this.getClient();
|
|
686
721
|
const response = await client2.post(
|
|
687
722
|
"/admin/confirm",
|
|
@@ -696,10 +731,10 @@ var UsersAuthClient = class {
|
|
|
696
731
|
);
|
|
697
732
|
if (response.status !== 200) {
|
|
698
733
|
const message = "Admin User Confirmation Failed";
|
|
699
|
-
|
|
734
|
+
log8.error(message, { response });
|
|
700
735
|
throw new HttpError(500 /* INTERNAL_SERVER_ERROR */, message);
|
|
701
736
|
}
|
|
702
|
-
|
|
737
|
+
log8.info("Admin User Confirmation Successful", { response });
|
|
703
738
|
return response;
|
|
704
739
|
};
|
|
705
740
|
getUserByEmail = async (email) => {
|
|
@@ -712,13 +747,13 @@ var UsersAuthClient = class {
|
|
|
712
747
|
email
|
|
713
748
|
}
|
|
714
749
|
});
|
|
715
|
-
|
|
750
|
+
log8.info("getUserResponse", { getUserResponse });
|
|
716
751
|
return getUserResponse;
|
|
717
752
|
};
|
|
718
753
|
};
|
|
719
754
|
|
|
720
755
|
// src/clients/internal-api/shopify-app-install-client.ts
|
|
721
|
-
import
|
|
756
|
+
import log9 from "lambda-log";
|
|
722
757
|
var ShopifyAppInstallClient = class {
|
|
723
758
|
BASE_API_URL;
|
|
724
759
|
SHOPIFY_APP_INSTALL_API_KEY;
|
|
@@ -743,25 +778,25 @@ var ShopifyAppInstallClient = class {
|
|
|
743
778
|
updateShopifyAppInstall = async (shopifyAppInstallId, updateShopifyAppInstallRequest) => {
|
|
744
779
|
const client2 = await this.getClient();
|
|
745
780
|
const response = await client2.put(`/${shopifyAppInstallId}`, updateShopifyAppInstallRequest);
|
|
746
|
-
|
|
781
|
+
log9.info("updateShopifyAppInstall", { response });
|
|
747
782
|
return response;
|
|
748
783
|
};
|
|
749
784
|
getShopifyAppInstall = async (shopifyAppInstallId) => {
|
|
750
785
|
const client2 = await this.getClient();
|
|
751
786
|
const response = await client2.get(`/${shopifyAppInstallId}`);
|
|
752
|
-
|
|
787
|
+
log9.info("getShopifyAppInstall", { response });
|
|
753
788
|
return response;
|
|
754
789
|
};
|
|
755
790
|
getShopifyAppInstallByShop = async (shop) => {
|
|
756
791
|
const client2 = await this.getClient();
|
|
757
792
|
const response = await client2.get(`/?shop=${shop}`);
|
|
758
|
-
|
|
793
|
+
log9.info("getShopifyAppInstallByShop", { response });
|
|
759
794
|
return response;
|
|
760
795
|
};
|
|
761
796
|
};
|
|
762
797
|
|
|
763
798
|
// src/clients/third-party/shopify-client.ts
|
|
764
|
-
import * as
|
|
799
|
+
import * as log10 from "lambda-log";
|
|
765
800
|
var _ShopifyClient = class {
|
|
766
801
|
};
|
|
767
802
|
var ShopifyClient = _ShopifyClient;
|
|
@@ -805,9 +840,9 @@ __publicField(ShopifyClient, "registerWebhookTopic", async (shop, accessToken, e
|
|
|
805
840
|
};
|
|
806
841
|
const res = await client2.post(url, payload, { headers: { "X-Shopify-Access-Token": accessToken } });
|
|
807
842
|
if (res.status >= 400) {
|
|
808
|
-
|
|
843
|
+
log10.error("Failed to register Webhook Topic", { shop, accessToken, eventBridgeArn, topic, url, payload });
|
|
809
844
|
}
|
|
810
|
-
|
|
845
|
+
log10.debug("Shopify Client Webhook Registration Response", { registrationResponse: res });
|
|
811
846
|
return res;
|
|
812
847
|
});
|
|
813
848
|
__publicField(ShopifyClient, "updateShopifyAppMetafield", async (shop, accessToken, pixelId) => {
|
|
@@ -822,7 +857,7 @@ __publicField(ShopifyClient, "updateShopifyAppMetafield", async (shop, accessTok
|
|
|
822
857
|
};
|
|
823
858
|
const res = await _ShopifyClient.genericShopifyPost(url, accessToken, payload);
|
|
824
859
|
if (res.status >= 400) {
|
|
825
|
-
|
|
860
|
+
log10.error("Failed to update Shopify app Metafield ", { shop, accessToken, url, payload });
|
|
826
861
|
}
|
|
827
862
|
return res;
|
|
828
863
|
});
|
|
@@ -830,7 +865,7 @@ __publicField(ShopifyClient, "getShopifyStoreProperties", async (shop, accessTok
|
|
|
830
865
|
const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/shop.json`;
|
|
831
866
|
const res = await _ShopifyClient.genericShopifyGet(url, accessToken);
|
|
832
867
|
if (res.status >= 400) {
|
|
833
|
-
|
|
868
|
+
log10.error("Failed to get Shopify Store Properties", { shop, accessToken, url });
|
|
834
869
|
}
|
|
835
870
|
return res;
|
|
836
871
|
});
|
|
@@ -845,7 +880,7 @@ __publicField(ShopifyClient, "createAppSubscription", async (shop, accessToken,
|
|
|
845
880
|
};
|
|
846
881
|
const res = await _ShopifyClient.genericShopifyPost(url, accessToken, { recurring_application_charge });
|
|
847
882
|
if (res.status >= 400) {
|
|
848
|
-
|
|
883
|
+
log10.error("Failed to create App Subscription", { shop, accessToken, url });
|
|
849
884
|
}
|
|
850
885
|
return res;
|
|
851
886
|
});
|
|
@@ -854,7 +889,7 @@ __publicField(ShopifyClient, "cancelAppSubscription", async (shop, accessToken,
|
|
|
854
889
|
const client2 = axiosHttpService();
|
|
855
890
|
const res = await client2.delete(url, { headers: { "X-Shopify-Access-Token": accessToken } });
|
|
856
891
|
if (res.status !== 200) {
|
|
857
|
-
|
|
892
|
+
log10.error("Failed to cancel recurring App billing", { shop, accessToken, url });
|
|
858
893
|
}
|
|
859
894
|
return res;
|
|
860
895
|
});
|
|
@@ -862,35 +897,35 @@ __publicField(ShopifyClient, "listAppSubscriptions", async (shop, accessToken) =
|
|
|
862
897
|
const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/recurring_application_charges.json`;
|
|
863
898
|
const res = await _ShopifyClient.genericShopifyGet(url, accessToken);
|
|
864
899
|
if (res.status >= 400) {
|
|
865
|
-
|
|
900
|
+
log10.error("Failed to get App Subscriptions", { shop, accessToken, url });
|
|
866
901
|
}
|
|
867
902
|
return res;
|
|
868
903
|
});
|
|
869
904
|
__publicField(ShopifyClient, "genericShopifyPost", async (url, accessToken, payload) => {
|
|
870
905
|
const client2 = axiosHttpService();
|
|
871
906
|
const res = await client2.post(url, payload, { headers: { "X-Shopify-Access-Token": accessToken, "Content-Type": "application/json" } });
|
|
872
|
-
|
|
907
|
+
log10.debug("Shopify Client Response", { res });
|
|
873
908
|
return res;
|
|
874
909
|
});
|
|
875
910
|
__publicField(ShopifyClient, "genericShopifyGet", async (url, accessToken) => {
|
|
876
911
|
const client2 = axiosHttpService();
|
|
877
912
|
const res = await client2.get(url, { headers: { "X-Shopify-Access-Token": accessToken } });
|
|
878
|
-
|
|
913
|
+
log10.debug("Shopify Client Response", { res });
|
|
879
914
|
return res;
|
|
880
915
|
});
|
|
881
916
|
__publicField(ShopifyClient, "genericShopifyPut", async (url, accessToken, payload) => {
|
|
882
917
|
const client2 = axiosHttpService();
|
|
883
918
|
const res = await client2.put(url, payload, { headers: { "X-Shopify-Access-Token": accessToken } });
|
|
884
|
-
|
|
919
|
+
log10.debug("Shopify Client Response", { res });
|
|
885
920
|
return res;
|
|
886
921
|
});
|
|
887
922
|
|
|
888
923
|
// src/helpers/input-validation-helper.ts
|
|
889
|
-
import * as
|
|
924
|
+
import * as log11 from "lambda-log";
|
|
890
925
|
var validateInput = (schema, input) => {
|
|
891
926
|
const { error: error7, value } = schema.validate(input);
|
|
892
927
|
if (error7) {
|
|
893
|
-
|
|
928
|
+
log11.info("", { error: error7 });
|
|
894
929
|
const httperr = HttpError.badRequest("Bad Request", {
|
|
895
930
|
errors: error7.details.map((detail) => ({
|
|
896
931
|
message: detail?.message,
|
|
@@ -898,21 +933,21 @@ var validateInput = (schema, input) => {
|
|
|
898
933
|
path: detail?.path
|
|
899
934
|
}))
|
|
900
935
|
});
|
|
901
|
-
|
|
936
|
+
log11.info("", { httperr });
|
|
902
937
|
throw httperr;
|
|
903
938
|
}
|
|
904
939
|
return value;
|
|
905
940
|
};
|
|
906
941
|
|
|
907
942
|
// src/helpers/logging-helper.ts
|
|
908
|
-
import * as
|
|
943
|
+
import * as log12 from "lambda-log";
|
|
909
944
|
var stage = process?.env?.STAGE;
|
|
910
|
-
var configureLogger = (event, context,
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
945
|
+
var configureLogger = (event, context, debug6 = true) => {
|
|
946
|
+
log12.options.meta.stage = stage;
|
|
947
|
+
log12.options.meta.source_name = context?.functionName || "unknown";
|
|
948
|
+
log12.options.meta.awsRequestId = context?.awsRequestId || "unknown";
|
|
949
|
+
log12.options.meta.lambdaEvent = event;
|
|
950
|
+
log12.options.debug = debug6;
|
|
916
951
|
};
|
|
917
952
|
|
|
918
953
|
// src/helpers/response-helper.ts
|
|
@@ -952,7 +987,7 @@ var buildResponse = (statusCode, body = {}) => {
|
|
|
952
987
|
|
|
953
988
|
// src/helpers/shopify-helper.ts
|
|
954
989
|
import { createHmac } from "crypto";
|
|
955
|
-
import * as
|
|
990
|
+
import * as log13 from "lambda-log";
|
|
956
991
|
|
|
957
992
|
// src/libs/url.ts
|
|
958
993
|
var mapObjectToQueryString = (inputObj) => {
|
|
@@ -973,14 +1008,14 @@ var isShopifyRequestValid = (validationParams, validationHmac, shopifyAppApiSecr
|
|
|
973
1008
|
return generatedHash === validationHmac;
|
|
974
1009
|
};
|
|
975
1010
|
var validateShopifyRequest = (validationParams, validationHmac, shopifyAppApiSecret) => {
|
|
976
|
-
|
|
1011
|
+
log13.info("Validating shopify request is authentic", { validationParams });
|
|
977
1012
|
const isValid = isShopifyRequestValid(validationParams, validationHmac, shopifyAppApiSecret);
|
|
978
1013
|
if (!isValid) {
|
|
979
1014
|
const message = "Failed: Shopify Request hmac validation";
|
|
980
|
-
|
|
1015
|
+
log13.error(message);
|
|
981
1016
|
throw HttpError.badRequest(message);
|
|
982
1017
|
}
|
|
983
|
-
|
|
1018
|
+
log13.info("Sucess: Shopify Request hmac validation");
|
|
984
1019
|
return true;
|
|
985
1020
|
};
|
|
986
1021
|
|
|
@@ -1313,6 +1348,7 @@ export {
|
|
|
1313
1348
|
HttpStatusCodes,
|
|
1314
1349
|
PostmarkRequestType,
|
|
1315
1350
|
S3Client,
|
|
1351
|
+
SQSClient,
|
|
1316
1352
|
ShopifyAppInstallClient,
|
|
1317
1353
|
ShopifyClient,
|
|
1318
1354
|
StripeBillingMap,
|
package/dist/index.esm.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/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/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", "../src/helpers/shopify-helper.ts", "../src/libs/url.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", "../node_modules/@adtrackify/at-tracking-event-types/src/types/adtrackify-event-types.ts", "../src/helpers/subscription-helper.ts", "../src/libs/crypto.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.js';\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, { CreateAxiosDefaults } from 'axios';\nimport https from 'https';\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: CreateAxiosDefaults = {}) => {\n config.adapter = 'http';\n config.httpsAgent = new https.Agent({ keepAlive: true });\n const axiosService = axios.create(config);\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 { ObjectCannedACL, S3 } from '@aws-sdk/client-s3';\nimport * as log from 'lambda-log';\n\nexport class S3Client {\n s3: S3;\n\n constructor (region = 'us-west-2') {\n this.s3 = new S3({ region });\n }\n\n async uploadJson(path: string, bucket: string, jsonData: any, ACL: ObjectCannedACL | string = ObjectCannedACL.private) {\n try {\n const res = await this.s3.putObject({\n ACL,\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';\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 public cognitoClient: any\n public USER_POOL_ID: string;\n public USER_POOL_NO_SECRET_CLIENT_ID: string;\n\n constructor(userPoolId: string, userPoolNoSecretClientId: string) {\n this.cognitoClient = new CognitoIdentityProvider({});\n this.USER_POOL_ID = userPoolId;\n this.USER_POOL_NO_SECRET_CLIENT_ID = userPoolNoSecretClientId;\n }\n\n public signupUser = async (data: any) => {\n const params: SignUpCommandInput = {\n ClientId: this.USER_POOL_NO_SECRET_CLIENT_ID,\n Password: data.password,\n Username: data.email,\n UserAttributes: buildAttributes(data),\n };\n const cognitoResponse = await this.cognitoClient.signUp(params);\n log.debug('Successfully Registered User', { cognitoResponse });\n return cognitoResponse;\n }\n\n public forgotPassword = async (email: string) => {\n await this.adminEmailVerify(email);\n const params: ForgotPasswordCommandInput = {\n ClientId: this.USER_POOL_NO_SECRET_CLIENT_ID,\n Username: email,\n };\n const cognitoResponse = await this.cognitoClient.forgotPassword(params);\n log.debug('Sent Forgot Password', { cognitoResponse });\n return cognitoResponse;\n }\n\n public adminEmailVerify = async (email: string) => {\n try {\n const user: any = await this.getUserByEmail(email);\n if (user && user?.UserStatus === 'CONFIRMED' && user?.email_verified !== 'true') {\n await this.forceValidateEmail(email);\n }\n } catch (error) {\n log.error('Failed admin email verify', { error });\n }\n }\n\n public forceValidateEmail = async (email: string) => {\n try {\n const params: AdminUpdateUserAttributesCommandInput = {\n UserPoolId: this.USER_POOL_ID,\n Username: email,\n UserAttributes: [\n {\n Name: 'email_verified',\n Value: 'true',\n },\n ],\n };\n await this.cognitoClient.adminUpdateUserAttributes(params);\n } catch (error) {\n log.error('Failed force validate email', { email, error });\n }\n }\n\n public adminConfirmUser = async (data: any) => {\n const params: AdminConfirmSignUpCommandInput = {\n UserPoolId: this.USER_POOL_ID,\n Username: data.email,\n };\n const cognitoResponse = await this.cognitoClient.adminConfirmSignUp(params);\n await this.forceValidateEmail(data.email);\n log.debug('Admin Successfully Confirmed User', { cognitoResponse });\n return cognitoResponse;\n }\n\n public confirmUser = async (data: any) => {\n const params: ConfirmSignUpCommandInput = {\n ClientId: this.USER_POOL_NO_SECRET_CLIENT_ID,\n ConfirmationCode: data.confirmationCode,\n Username: data.email,\n };\n const cognitoResponse = await this.cognitoClient.confirmSignUp(params);\n log.debug('Successfully Confirmed User', { cognitoResponse });\n return cognitoResponse;\n }\n\n public resendCode = async (email: string) => {\n const params: ResendConfirmationCodeCommandInput = {\n ClientId: this.USER_POOL_NO_SECRET_CLIENT_ID,\n Username: email,\n };\n await this.cognitoClient.resendConfirmationCode(params);\n log.debug('Successfully Resend Confirmation Code', { email });\n return;\n }\n\n public adminDeleteUser = async (userId: string) => {\n const params: AdminDeleteUserCommandInput = {\n UserPoolId: this.USER_POOL_ID,\n Username: userId,\n };\n await this.cognitoClient.adminDeleteUser(params);\n return true;\n }\n\n public getUserByEmail = async (email: string) => {\n const params: ListUsersCommandInput = {\n UserPoolId: this.USER_POOL_ID,\n Filter: `email=\\\"${email}\\\"`,\n Limit: 1,\n };\n const cognitoResponse: any = await this.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.js';\nimport { axiosHttpService } from '../generic/http-client.js';\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.js';\nimport { Account, ACCOUNT_STATUS, Destination } from '@adtrackify/at-tracking-event-types';\nimport { axiosHttpService } from '../generic/http-client.js';\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 } from '../../libs/http-error.js';\nimport { HttpStatusCodes } from '../../libs/http-status-codes.js';\nimport { ApiResponse } from '../../types/api-response.js';\nimport { axiosHttpService } from '../generic/http-client.js';\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", "/* 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.js';\nimport { axiosHttpService } from '../generic/http-client.js';\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.js';\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.js';\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 { createHmac } from 'crypto';\nimport * as log from 'lambda-log';\nimport { HttpError } from '../libs/http-error.js';\nimport { mapObjectToQueryString } from '../libs/url.js';\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 { 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 SELECT_SHIPPING_METHOD = 'select_shipping_method',\n VIRTUALIZED_VIEWED_PAYMENT_FORM = 'virtualized_viewd_payment_form',\n\n METRIC = 'metric',\n WEB_VITAL = 'web_vital',\n}\n", "import { ADTRACKIFY_STANDARD_EVENT } from '../adtrackify-standard-events';\nimport { ADTRACKIFY_EVENT_TYPE } from '../adtrackify-event-types';\nimport { AddressInfo } from '../common/address';\nimport { TrackingEventContext } from './tracking-event-context';\nimport { TrackingEventIdentity } from './tracking-event-identity';\n\nexport interface Event {\n id: string;\n type: ADTRACKIFY_EVENT_TYPE;\n name: ADTRACKIFY_STANDARD_EVENT;\n pixelId: string;\n sentAtEpoch?: number;\n collectedAt?: string;\n version: string;\n context?: TrackingEventContext;\n}\n\nexport interface TrackingEvent extends Event {\n identity?: TrackingEventIdentity;\n data?: TrackingEventData;\n testCode?: string;\n}\n\nexport interface MetricEvent extends Event {\n data: MetricEventData;\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\nexport interface MetricEventData {\n [ key: string ]: any;\n name: string;\n value: number;\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' ];", "export enum ADTRACKIFY_EVENT_TYPE {\n TRACKING = 'tracking',\n METRIC = 'metric',\n IDENTIFY = 'identify',\n LOG = 'log',\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};", "import crypto from 'crypto';\n\nexport const generatePublicKey = (): string => {\n const publicKey = crypto.randomBytes(26);\n return publicKey.toString('utf8');\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}\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 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}", "import { EventBridgeClient } from '../clients/generic/eventbridge-client.js';\nimport { Message, TemplatedMessage } from 'postmark';\nimport { ADTRACKIFY_EVENT_BRIDGE_EVENTS, PostmarkRequestType } from '../types/internal-events/event-detail-types.js';\n\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_BRID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A,MAEA;AAAA,QACE;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IAAC;AAAA,EACL;AAEF;",
|
|
6
|
-
"names": ["log", "error", "config", "log", "error", "log", "error", "log", "client", "log", "client", "success", "log", "HttpStatusCodes", "client", "log", "client", "log", "log", "client", "log", "error", "log", "debug", "error", "log", "p", "ACCOUNT_STATUS", "DESTINATIONS", "CustomHTMLLocation", "ShopifyAppInstallStatus", "ShopifyAppSubscriptionStatus", "PLAN_BILLING_FREQUENCY", "PAYMENT_STATUS", "SUBSCRIPTION_STATUS", "PAYMENT_GATEWAY", "ADTRACKIFY_STANDARD_EVENT", "ADTRACKIFY_EVENT_TYPE", "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/generic/sqs-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/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", "../src/helpers/shopify-helper.ts", "../src/libs/url.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", "../node_modules/@adtrackify/at-tracking-event-types/src/types/adtrackify-event-types.ts", "../src/helpers/subscription-helper.ts", "../src/libs/crypto.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.js';\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, { CreateAxiosDefaults } from 'axios';\nimport https from 'https';\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: CreateAxiosDefaults = {}) => {\n config.adapter = 'http';\n config.httpsAgent = new https.Agent({ keepAlive: true });\n const axiosService = axios.create(config);\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 { ObjectCannedACL, S3 } from '@aws-sdk/client-s3';\nimport * as log from 'lambda-log';\n\nexport class S3Client {\n s3: S3;\n\n constructor (region = 'us-west-2') {\n this.s3 = new S3({ region });\n }\n\n async uploadJson(path: string, bucket: string, jsonData: any, ACL: ObjectCannedACL | string = ObjectCannedACL.private) {\n try {\n const res = await this.s3.putObject({\n ACL,\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';\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 public cognitoClient: any\n public USER_POOL_ID: string;\n public USER_POOL_NO_SECRET_CLIENT_ID: string;\n\n constructor(userPoolId: string, userPoolNoSecretClientId: string) {\n this.cognitoClient = new CognitoIdentityProvider({});\n this.USER_POOL_ID = userPoolId;\n this.USER_POOL_NO_SECRET_CLIENT_ID = userPoolNoSecretClientId;\n }\n\n public signupUser = async (data: any) => {\n const params: SignUpCommandInput = {\n ClientId: this.USER_POOL_NO_SECRET_CLIENT_ID,\n Password: data.password,\n Username: data.email,\n UserAttributes: buildAttributes(data),\n };\n const cognitoResponse = await this.cognitoClient.signUp(params);\n log.debug('Successfully Registered User', { cognitoResponse });\n return cognitoResponse;\n }\n\n public forgotPassword = async (email: string) => {\n await this.adminEmailVerify(email);\n const params: ForgotPasswordCommandInput = {\n ClientId: this.USER_POOL_NO_SECRET_CLIENT_ID,\n Username: email,\n };\n const cognitoResponse = await this.cognitoClient.forgotPassword(params);\n log.debug('Sent Forgot Password', { cognitoResponse });\n return cognitoResponse;\n }\n\n public adminEmailVerify = async (email: string) => {\n try {\n const user: any = await this.getUserByEmail(email);\n if (user && user?.UserStatus === 'CONFIRMED' && user?.email_verified !== 'true') {\n await this.forceValidateEmail(email);\n }\n } catch (error) {\n log.error('Failed admin email verify', { error });\n }\n }\n\n public forceValidateEmail = async (email: string) => {\n try {\n const params: AdminUpdateUserAttributesCommandInput = {\n UserPoolId: this.USER_POOL_ID,\n Username: email,\n UserAttributes: [\n {\n Name: 'email_verified',\n Value: 'true',\n },\n ],\n };\n await this.cognitoClient.adminUpdateUserAttributes(params);\n } catch (error) {\n log.error('Failed force validate email', { email, error });\n }\n }\n\n public adminConfirmUser = async (data: any) => {\n const params: AdminConfirmSignUpCommandInput = {\n UserPoolId: this.USER_POOL_ID,\n Username: data.email,\n };\n const cognitoResponse = await this.cognitoClient.adminConfirmSignUp(params);\n await this.forceValidateEmail(data.email);\n log.debug('Admin Successfully Confirmed User', { cognitoResponse });\n return cognitoResponse;\n }\n\n public confirmUser = async (data: any) => {\n const params: ConfirmSignUpCommandInput = {\n ClientId: this.USER_POOL_NO_SECRET_CLIENT_ID,\n ConfirmationCode: data.confirmationCode,\n Username: data.email,\n };\n const cognitoResponse = await this.cognitoClient.confirmSignUp(params);\n log.debug('Successfully Confirmed User', { cognitoResponse });\n return cognitoResponse;\n }\n\n public resendCode = async (email: string) => {\n const params: ResendConfirmationCodeCommandInput = {\n ClientId: this.USER_POOL_NO_SECRET_CLIENT_ID,\n Username: email,\n };\n await this.cognitoClient.resendConfirmationCode(params);\n log.debug('Successfully Resend Confirmation Code', { email });\n return;\n }\n\n public adminDeleteUser = async (userId: string) => {\n const params: AdminDeleteUserCommandInput = {\n UserPoolId: this.USER_POOL_ID,\n Username: userId,\n };\n await this.cognitoClient.adminDeleteUser(params);\n return true;\n }\n\n public getUserByEmail = async (email: string) => {\n const params: ListUsersCommandInput = {\n UserPoolId: this.USER_POOL_ID,\n Filter: `email=\\\"${email}\\\"`,\n Limit: 1,\n };\n const cognitoResponse: any = await this.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 { SQS, SendMessageCommandInput } from '@aws-sdk/client-sqs';\nimport { v4 as uuidv4 } from 'uuid';\nimport { getCurrentTimestamp } from '../../libs/dates.js';\nimport * as log from 'lambda-log';\n\nexport class SQSClient {\n public sqs: SQS;\n public queueUrl: string;\n\n constructor (region: string, accountId: string, queueName: string) {\n this.sqs = new SQS({ region });\n this.queueUrl = `https://sqs.${region}.amazonaws.com/${accountId}/${queueName}`;\n }\n\n public buildAndSendEvent = async (eventType: string, eventData: any, deplaySeconds = 0) => {\n const event = this.buildEvent(eventType, eventData);\n return await this.putEvent(event, deplaySeconds);\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 (data: any, delaySeconds = 0) => {\n const params: SendMessageCommandInput = {\n QueueUrl: this.queueUrl,\n DelaySeconds: delaySeconds,\n MessageBody: JSON.stringify(data)\n };\n const response = await this.sqs.sendMessage(params)\n \n log.debug('SQS Event Published', { queueUrl: this.queueUrl, event: data });\n \n return response;\n };\n\n}\n\n", "import * as log from 'lambda-log';\n//const log = require('lambda-log');\nimport { ApiResponse } from '../../types/api-response.js';\nimport { axiosHttpService } from '../generic/http-client.js';\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.js';\nimport { Account, ACCOUNT_STATUS, Destination } from '@adtrackify/at-tracking-event-types';\nimport { axiosHttpService } from '../generic/http-client.js';\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 } from '../../libs/http-error.js';\nimport { HttpStatusCodes } from '../../libs/http-status-codes.js';\nimport { ApiResponse } from '../../types/api-response.js';\nimport { axiosHttpService } from '../generic/http-client.js';\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", "/* 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.js';\nimport { axiosHttpService } from '../generic/http-client.js';\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.js';\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.js';\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 { createHmac } from 'crypto';\nimport * as log from 'lambda-log';\nimport { HttpError } from '../libs/http-error.js';\nimport { mapObjectToQueryString } from '../libs/url.js';\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 { 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 SELECT_SHIPPING_METHOD = 'select_shipping_method',\n VIRTUALIZED_VIEWED_PAYMENT_FORM = 'virtualized_viewd_payment_form',\n\n METRIC = 'metric',\n WEB_VITAL = 'web_vital',\n}\n", "import { ADTRACKIFY_STANDARD_EVENT } from '../adtrackify-standard-events';\nimport { ADTRACKIFY_EVENT_TYPE } from '../adtrackify-event-types';\nimport { AddressInfo } from '../common/address';\nimport { TrackingEventContext } from './tracking-event-context';\nimport { TrackingEventIdentity } from './tracking-event-identity';\n\nexport interface Event {\n id: string;\n type: ADTRACKIFY_EVENT_TYPE;\n name: ADTRACKIFY_STANDARD_EVENT;\n pixelId: string;\n sentAtEpoch?: number;\n collectedAt?: string;\n version: string;\n context?: TrackingEventContext;\n}\n\nexport interface TrackingEvent extends Event {\n identity?: TrackingEventIdentity;\n data?: TrackingEventData;\n testCode?: string;\n}\n\nexport interface MetricEvent extends Event {\n data: MetricEventData;\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\nexport interface MetricEventData {\n [ key: string ]: any;\n name: string;\n value: number;\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' ];", "export enum ADTRACKIFY_EVENT_TYPE {\n TRACKING = 'tracking',\n METRIC = 'metric',\n IDENTIFY = 'identify',\n LOG = 'log',\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};", "import crypto from 'crypto';\n\nexport const generatePublicKey = (): string => {\n const publicKey = crypto.randomBytes(26);\n return publicKey.toString('utf8');\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}\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 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}", "import { EventBridgeClient } from '../clients/generic/eventbridge-client.js';\nimport { Message, TemplatedMessage } from 'postmark';\nimport { ADTRACKIFY_EVENT_BRIDGE_EVENTS, PostmarkRequestType } from '../types/internal-events/event-detail-types.js';\n\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 post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AL;AACL,EAAAA,0BAAA,mBAAgB;AADN,SAAAA;AAAA,GAAA;AAIL,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;AACtB,EAAAA,gCAAA,yCAAsC;AACtC,EAAAA,gCAAA,0CAAuC;AACvC,EAAAA,gCAAA,+BAA4B;AAC5B,EAAAA,gCAAA,yCAAsC;AAL5B,SAAAA;AAAA,GAAA;;;ACVL,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;AAAA,MAEA;AAAA,QACE;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IAAC;AAAA,EACL;AAAA,EAEO,kCAAkC,OAAO,aAAqB,iBAAmC,wBAAgC;AACtI,WAAO,MAAM,KAAK,kBAAkB;AAAA,MAClC;AAAA;AAAA,MAEA;AAAA,QACE;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IAAC;AAAA,EACL;AAEF;",
|
|
6
|
+
"names": ["log", "error", "config", "log", "error", "log", "error", "uuidv4", "log", "uuidv4", "log", "client", "log", "client", "success", "log", "HttpStatusCodes", "client", "log", "client", "log", "log", "client", "log", "error", "log", "debug", "error", "log", "p", "ACCOUNT_STATUS", "DESTINATIONS", "CustomHTMLLocation", "ShopifyAppInstallStatus", "ShopifyAppSubscriptionStatus", "PLAN_BILLING_FREQUENCY", "PAYMENT_STATUS", "SUBSCRIPTION_STATUS", "PAYMENT_GATEWAY", "ADTRACKIFY_STANDARD_EVENT", "ADTRACKIFY_EVENT_TYPE", "stage", "x", "ADTRACKIFY_EVENT_TYPES", "ADTRACKIFY_EVENT_SOURCES", "PostmarkRequestType", "ADTRACKIFY_EVENT_BRIDGE_EVENTS"]
|
|
7
7
|
}
|