@adtrackify/at-service-common 2.0.15 → 2.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/__tests__/helpers/subscription-helper.spec.d.ts +1 -1
- package/dist/cjs/__tests__/helpers/subscription-helper.spec.js +52 -52
- package/dist/cjs/__tests__/s3-client/s3-client.spec.d.ts +1 -1
- package/dist/cjs/__tests__/s3-client/s3-client.spec.js +26 -26
- package/dist/cjs/clients/generic/cognito-client.d.ts +19 -19
- package/dist/cjs/clients/generic/cognito-client.js +144 -144
- package/dist/cjs/clients/generic/dynamodb-client.d.ts +15 -15
- package/dist/cjs/clients/generic/dynamodb-client.js +124 -124
- package/dist/cjs/clients/generic/eventbridge-client.d.ts +14 -14
- package/dist/cjs/clients/generic/eventbridge-client.js +49 -49
- package/dist/cjs/clients/generic/http-client.d.ts +30 -30
- package/dist/cjs/clients/generic/http-client.js +35 -35
- package/dist/cjs/clients/generic/http-client.js.map +1 -1
- package/dist/cjs/clients/generic/index.d.ts +6 -6
- package/dist/cjs/clients/generic/index.js +22 -22
- package/dist/cjs/clients/generic/s3-client.d.ts +14 -14
- package/dist/cjs/clients/generic/s3-client.js +82 -82
- package/dist/cjs/clients/generic/sqs-client.d.ts +14 -14
- package/dist/cjs/clients/generic/sqs-client.js +38 -38
- package/dist/cjs/clients/index.d.ts +3 -3
- package/dist/cjs/clients/index.js +19 -19
- package/dist/cjs/clients/internal-api/accounts-client.d.ts +82 -82
- package/dist/cjs/clients/internal-api/accounts-client.js +82 -82
- package/dist/cjs/clients/internal-api/db-management-client.d.ts +48 -0
- package/dist/cjs/clients/internal-api/db-management-client.js +38 -0
- package/dist/cjs/clients/internal-api/db-management-client.js.map +1 -0
- package/dist/cjs/clients/internal-api/destinations-client.d.ts +54 -54
- package/dist/cjs/clients/internal-api/destinations-client.js +40 -40
- package/dist/cjs/clients/internal-api/event-collector-client.d.ts +47 -0
- package/dist/cjs/clients/internal-api/event-collector-client.js +38 -0
- package/dist/cjs/clients/internal-api/event-collector-client.js.map +1 -0
- package/dist/cjs/clients/internal-api/identity-client.d.ts +7 -7
- package/dist/cjs/clients/internal-api/identity-client.js +41 -41
- package/dist/cjs/clients/internal-api/index.d.ts +7 -5
- package/dist/cjs/clients/internal-api/index.js +23 -21
- package/dist/cjs/clients/internal-api/index.js.map +1 -1
- package/dist/cjs/clients/internal-api/shopify-app-install-client.d.ts +57 -57
- package/dist/cjs/clients/internal-api/shopify-app-install-client.js +49 -49
- package/dist/cjs/clients/internal-api/users-auth-client.d.ts +61 -61
- package/dist/cjs/clients/internal-api/users-auth-client.js +77 -77
- package/dist/cjs/clients/third-party/index.d.ts +1 -1
- package/dist/cjs/clients/third-party/index.js +17 -17
- package/dist/cjs/clients/third-party/shopify-client.d.ts +90 -90
- package/dist/cjs/clients/third-party/shopify-client.js +125 -125
- package/dist/cjs/helpers/index.d.ts +5 -5
- package/dist/cjs/helpers/index.js +21 -21
- package/dist/cjs/helpers/input-validation-helper.d.ts +2 -2
- package/dist/cjs/helpers/input-validation-helper.js +22 -22
- package/dist/cjs/helpers/logging-helper.d.ts +15 -15
- package/dist/cjs/helpers/logging-helper.js +80 -80
- package/dist/cjs/helpers/response-helper.d.ts +36 -36
- package/dist/cjs/helpers/response-helper.js +41 -41
- package/dist/cjs/helpers/shopify-helper.d.ts +9 -9
- package/dist/cjs/helpers/shopify-helper.js +28 -28
- package/dist/cjs/helpers/subscription-helper.d.ts +8 -8
- package/dist/cjs/helpers/subscription-helper.js +104 -104
- package/dist/cjs/index.d.ts +5 -5
- package/dist/cjs/index.js +21 -21
- package/dist/cjs/libs/clickId-parser.d.ts +23 -23
- package/dist/cjs/libs/clickId-parser.js +49 -49
- package/dist/cjs/libs/crypto.d.ts +1 -1
- package/dist/cjs/libs/crypto.js +12 -12
- package/dist/cjs/libs/dates.d.ts +3 -3
- package/dist/cjs/libs/dates.js +16 -16
- package/dist/cjs/libs/http-error.d.ts +21 -21
- package/dist/cjs/libs/http-error.js +59 -59
- package/dist/cjs/libs/http-status-codes.d.ts +58 -58
- package/dist/cjs/libs/http-status-codes.js +62 -62
- package/dist/cjs/libs/index.d.ts +8 -8
- package/dist/cjs/libs/index.js +24 -24
- package/dist/cjs/libs/referrer-parser/index.d.ts +2 -2
- package/dist/cjs/libs/referrer-parser/index.js +18 -18
- package/dist/cjs/libs/referrer-parser/referrer-data.d.ts +9 -9
- package/dist/cjs/libs/referrer-parser/referrer-data.js +4712 -4712
- package/dist/cjs/libs/referrer-parser/referrer-parser-util.d.ts +20 -20
- package/dist/cjs/libs/referrer-parser/referrer-parser-util.js +128 -128
- package/dist/cjs/libs/url.d.ts +1 -1
- package/dist/cjs/libs/url.js +13 -13
- package/dist/cjs/services/eventbridge-integration-service.d.ts +9 -9
- package/dist/cjs/services/eventbridge-integration-service.js +28 -28
- package/dist/cjs/services/index.d.ts +4 -4
- package/dist/cjs/services/index.js +20 -20
- package/dist/cjs/services/ipdata-lookup-service.d.ts +8 -8
- package/dist/cjs/services/ipdata-lookup-service.js +59 -59
- package/dist/cjs/services/log-event-service.d.ts +9 -9
- package/dist/cjs/services/log-event-service.js +50 -50
- package/dist/cjs/services/metric-event-service.d.ts +9 -9
- package/dist/cjs/services/metric-event-service.js +49 -49
- package/dist/cjs/types/api-response.d.ts +6 -6
- package/dist/cjs/types/api-response.js +2 -2
- package/dist/cjs/types/index.d.ts +1 -1
- package/dist/cjs/types/index.js +17 -17
- package/dist/cjs/types/internal-events/event-detail-types.d.ts +20 -20
- package/dist/cjs/types/internal-events/event-detail-types.js +27 -27
- package/dist/cjs/types/internal-events/index.d.ts +1 -1
- package/dist/cjs/types/internal-events/index.js +17 -17
- package/dist/esm/__tests__/helpers/subscription-helper.spec.d.ts +1 -1
- package/dist/esm/__tests__/helpers/subscription-helper.spec.js +27 -27
- package/dist/esm/__tests__/s3-client/s3-client.spec.d.ts +1 -1
- package/dist/esm/__tests__/s3-client/s3-client.spec.js +24 -24
- package/dist/esm/clients/generic/cognito-client.d.ts +19 -19
- package/dist/esm/clients/generic/cognito-client.js +139 -139
- package/dist/esm/clients/generic/dynamodb-client.d.ts +15 -15
- package/dist/esm/clients/generic/dynamodb-client.js +120 -120
- package/dist/esm/clients/generic/eventbridge-client.d.ts +14 -14
- package/dist/esm/clients/generic/eventbridge-client.js +45 -45
- package/dist/esm/clients/generic/http-client.d.ts +30 -30
- package/dist/esm/clients/generic/http-client.js +28 -28
- package/dist/esm/clients/generic/http-client.js.map +1 -1
- package/dist/esm/clients/generic/index.d.ts +6 -6
- package/dist/esm/clients/generic/index.js +6 -6
- package/dist/esm/clients/generic/s3-client.d.ts +14 -14
- package/dist/esm/clients/generic/s3-client.js +78 -78
- package/dist/esm/clients/generic/sqs-client.d.ts +14 -14
- package/dist/esm/clients/generic/sqs-client.js +34 -34
- package/dist/esm/clients/index.d.ts +3 -3
- package/dist/esm/clients/index.js +3 -3
- package/dist/esm/clients/internal-api/accounts-client.d.ts +82 -82
- package/dist/esm/clients/internal-api/accounts-client.js +78 -78
- package/dist/esm/clients/internal-api/db-management-client.d.ts +48 -0
- package/dist/esm/clients/internal-api/db-management-client.js +31 -0
- package/dist/esm/clients/internal-api/db-management-client.js.map +1 -0
- package/dist/esm/clients/internal-api/destinations-client.d.ts +54 -54
- package/dist/esm/clients/internal-api/destinations-client.js +36 -36
- package/dist/esm/clients/internal-api/event-collector-client.d.ts +47 -0
- package/dist/esm/clients/internal-api/event-collector-client.js +31 -0
- package/dist/esm/clients/internal-api/event-collector-client.js.map +1 -0
- package/dist/esm/clients/internal-api/identity-client.d.ts +7 -7
- package/dist/esm/clients/internal-api/identity-client.js +37 -37
- package/dist/esm/clients/internal-api/index.d.ts +7 -5
- package/dist/esm/clients/internal-api/index.js +7 -5
- package/dist/esm/clients/internal-api/index.js.map +1 -1
- package/dist/esm/clients/internal-api/shopify-app-install-client.d.ts +57 -57
- package/dist/esm/clients/internal-api/shopify-app-install-client.js +42 -42
- package/dist/esm/clients/internal-api/users-auth-client.d.ts +61 -61
- package/dist/esm/clients/internal-api/users-auth-client.js +73 -73
- package/dist/esm/clients/third-party/index.d.ts +1 -1
- package/dist/esm/clients/third-party/index.js +1 -1
- package/dist/esm/clients/third-party/shopify-client.d.ts +90 -90
- package/dist/esm/clients/third-party/shopify-client.js +121 -121
- package/dist/esm/helpers/index.d.ts +5 -5
- package/dist/esm/helpers/index.js +5 -5
- package/dist/esm/helpers/input-validation-helper.d.ts +2 -2
- package/dist/esm/helpers/input-validation-helper.js +18 -18
- package/dist/esm/helpers/logging-helper.d.ts +15 -15
- package/dist/esm/helpers/logging-helper.js +53 -53
- package/dist/esm/helpers/response-helper.d.ts +36 -36
- package/dist/esm/helpers/response-helper.js +35 -35
- package/dist/esm/helpers/shopify-helper.d.ts +9 -9
- package/dist/esm/helpers/shopify-helper.js +23 -23
- package/dist/esm/helpers/subscription-helper.d.ts +8 -8
- package/dist/esm/helpers/subscription-helper.js +99 -99
- package/dist/esm/index.d.ts +5 -5
- package/dist/esm/index.js +5 -5
- package/dist/esm/libs/clickId-parser.d.ts +23 -23
- package/dist/esm/libs/clickId-parser.js +45 -45
- package/dist/esm/libs/crypto.d.ts +1 -1
- package/dist/esm/libs/crypto.js +5 -5
- package/dist/esm/libs/dates.d.ts +3 -3
- package/dist/esm/libs/dates.js +10 -10
- package/dist/esm/libs/http-error.d.ts +21 -21
- package/dist/esm/libs/http-error.js +55 -55
- package/dist/esm/libs/http-status-codes.d.ts +58 -58
- package/dist/esm/libs/http-status-codes.js +59 -59
- package/dist/esm/libs/index.d.ts +8 -8
- package/dist/esm/libs/index.js +8 -8
- package/dist/esm/libs/referrer-parser/index.d.ts +2 -2
- package/dist/esm/libs/referrer-parser/index.js +2 -2
- package/dist/esm/libs/referrer-parser/referrer-data.d.ts +9 -9
- package/dist/esm/libs/referrer-parser/referrer-data.js +4709 -4709
- package/dist/esm/libs/referrer-parser/referrer-parser-util.d.ts +20 -20
- package/dist/esm/libs/referrer-parser/referrer-parser-util.js +121 -121
- package/dist/esm/libs/url.d.ts +1 -1
- package/dist/esm/libs/url.js +9 -9
- package/dist/esm/services/eventbridge-integration-service.d.ts +9 -9
- package/dist/esm/services/eventbridge-integration-service.js +24 -24
- package/dist/esm/services/index.d.ts +4 -4
- package/dist/esm/services/index.js +4 -4
- package/dist/esm/services/ipdata-lookup-service.d.ts +8 -8
- package/dist/esm/services/ipdata-lookup-service.js +55 -55
- package/dist/esm/services/log-event-service.d.ts +9 -9
- package/dist/esm/services/log-event-service.js +46 -46
- package/dist/esm/services/metric-event-service.d.ts +9 -9
- package/dist/esm/services/metric-event-service.js +45 -45
- package/dist/esm/types/api-response.d.ts +6 -6
- package/dist/esm/types/api-response.js +1 -1
- package/dist/esm/types/index.d.ts +1 -1
- package/dist/esm/types/index.js +1 -1
- package/dist/esm/types/internal-events/event-detail-types.d.ts +20 -20
- package/dist/esm/types/internal-events/event-detail-types.js +24 -24
- package/dist/esm/types/internal-events/index.d.ts +1 -1
- package/dist/esm/types/internal-events/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
export declare const success: (body: any) => {
|
|
2
|
-
statusCode: number;
|
|
3
|
-
headers: {
|
|
4
|
-
'Access-Control-Allow-Origin': string;
|
|
5
|
-
'Access-Control-Allow-Credentials': boolean;
|
|
6
|
-
'cache-control': string;
|
|
7
|
-
Date: Date;
|
|
8
|
-
'Last-Modified': Date;
|
|
9
|
-
'Access-Control-Allow-Headers': string;
|
|
10
|
-
};
|
|
11
|
-
body: string;
|
|
12
|
-
};
|
|
13
|
-
export declare const failure: (error: any, statusCode?: number) => {
|
|
14
|
-
statusCode: number;
|
|
15
|
-
headers: {
|
|
16
|
-
'Access-Control-Allow-Origin': string;
|
|
17
|
-
'Access-Control-Allow-Credentials': boolean;
|
|
18
|
-
'cache-control': string;
|
|
19
|
-
Date: Date;
|
|
20
|
-
'Last-Modified': Date;
|
|
21
|
-
'Access-Control-Allow-Headers': string;
|
|
22
|
-
};
|
|
23
|
-
body: string;
|
|
24
|
-
};
|
|
25
|
-
export declare const buildResponse: (statusCode: number, body?: any) => {
|
|
26
|
-
statusCode: number;
|
|
27
|
-
headers: {
|
|
28
|
-
'Access-Control-Allow-Origin': string;
|
|
29
|
-
'Access-Control-Allow-Credentials': boolean;
|
|
30
|
-
'cache-control': string;
|
|
31
|
-
Date: Date;
|
|
32
|
-
'Last-Modified': Date;
|
|
33
|
-
'Access-Control-Allow-Headers': string;
|
|
34
|
-
};
|
|
35
|
-
body: string;
|
|
36
|
-
};
|
|
1
|
+
export declare const success: (body: any) => {
|
|
2
|
+
statusCode: number;
|
|
3
|
+
headers: {
|
|
4
|
+
'Access-Control-Allow-Origin': string;
|
|
5
|
+
'Access-Control-Allow-Credentials': boolean;
|
|
6
|
+
'cache-control': string;
|
|
7
|
+
Date: Date;
|
|
8
|
+
'Last-Modified': Date;
|
|
9
|
+
'Access-Control-Allow-Headers': string;
|
|
10
|
+
};
|
|
11
|
+
body: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const failure: (error: any, statusCode?: number) => {
|
|
14
|
+
statusCode: number;
|
|
15
|
+
headers: {
|
|
16
|
+
'Access-Control-Allow-Origin': string;
|
|
17
|
+
'Access-Control-Allow-Credentials': boolean;
|
|
18
|
+
'cache-control': string;
|
|
19
|
+
Date: Date;
|
|
20
|
+
'Last-Modified': Date;
|
|
21
|
+
'Access-Control-Allow-Headers': string;
|
|
22
|
+
};
|
|
23
|
+
body: string;
|
|
24
|
+
};
|
|
25
|
+
export declare const buildResponse: (statusCode: number, body?: any) => {
|
|
26
|
+
statusCode: number;
|
|
27
|
+
headers: {
|
|
28
|
+
'Access-Control-Allow-Origin': string;
|
|
29
|
+
'Access-Control-Allow-Credentials': boolean;
|
|
30
|
+
'cache-control': string;
|
|
31
|
+
Date: Date;
|
|
32
|
+
'Last-Modified': Date;
|
|
33
|
+
'Access-Control-Allow-Headers': string;
|
|
34
|
+
};
|
|
35
|
+
body: string;
|
|
36
|
+
};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
export const success = (body) => {
|
|
2
|
-
return buildResponse(200, body);
|
|
3
|
-
};
|
|
4
|
-
const defaultError = {
|
|
5
|
-
message: 'internalServerError'
|
|
6
|
-
};
|
|
7
|
-
export const failure = (error, statusCode = 500) => {
|
|
8
|
-
statusCode = error?.statusCode ?? statusCode;
|
|
9
|
-
let body = defaultError;
|
|
10
|
-
if (error?.body) {
|
|
11
|
-
body = error.body;
|
|
12
|
-
}
|
|
13
|
-
else if (error?.message) {
|
|
14
|
-
body = { message: error.message };
|
|
15
|
-
}
|
|
16
|
-
else if (statusCode === 500) {
|
|
17
|
-
body = defaultError;
|
|
18
|
-
}
|
|
19
|
-
return buildResponse(statusCode, body);
|
|
20
|
-
};
|
|
21
|
-
export const buildResponse = (statusCode, body = {}) => {
|
|
22
|
-
delete body.stack;
|
|
23
|
-
return {
|
|
24
|
-
statusCode: statusCode,
|
|
25
|
-
headers: {
|
|
26
|
-
'Access-Control-Allow-Origin': '*',
|
|
27
|
-
'Access-Control-Allow-Credentials': true,
|
|
28
|
-
'cache-control': 'max-age=86400',
|
|
29
|
-
Date: new Date(),
|
|
30
|
-
'Last-Modified': new Date(),
|
|
31
|
-
'Access-Control-Allow-Headers': 'Content-Type, Content-Encoding'
|
|
32
|
-
},
|
|
33
|
-
body: JSON.stringify(body),
|
|
34
|
-
};
|
|
35
|
-
};
|
|
1
|
+
export const success = (body) => {
|
|
2
|
+
return buildResponse(200, body);
|
|
3
|
+
};
|
|
4
|
+
const defaultError = {
|
|
5
|
+
message: 'internalServerError'
|
|
6
|
+
};
|
|
7
|
+
export const failure = (error, statusCode = 500) => {
|
|
8
|
+
statusCode = error?.statusCode ?? statusCode;
|
|
9
|
+
let body = defaultError;
|
|
10
|
+
if (error?.body) {
|
|
11
|
+
body = error.body;
|
|
12
|
+
}
|
|
13
|
+
else if (error?.message) {
|
|
14
|
+
body = { message: error.message };
|
|
15
|
+
}
|
|
16
|
+
else if (statusCode === 500) {
|
|
17
|
+
body = defaultError;
|
|
18
|
+
}
|
|
19
|
+
return buildResponse(statusCode, body);
|
|
20
|
+
};
|
|
21
|
+
export const buildResponse = (statusCode, body = {}) => {
|
|
22
|
+
delete body.stack;
|
|
23
|
+
return {
|
|
24
|
+
statusCode: statusCode,
|
|
25
|
+
headers: {
|
|
26
|
+
'Access-Control-Allow-Origin': '*',
|
|
27
|
+
'Access-Control-Allow-Credentials': true,
|
|
28
|
+
'cache-control': 'max-age=86400',
|
|
29
|
+
Date: new Date(),
|
|
30
|
+
'Last-Modified': new Date(),
|
|
31
|
+
'Access-Control-Allow-Headers': 'Content-Type, Content-Encoding'
|
|
32
|
+
},
|
|
33
|
+
body: JSON.stringify(body),
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
36
|
//# sourceMappingURL=response-helper.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export interface ShopifyRequestValidationParameters {
|
|
2
|
-
code: string;
|
|
3
|
-
hmac?: string;
|
|
4
|
-
shop: string;
|
|
5
|
-
state: string;
|
|
6
|
-
timestamp: string;
|
|
7
|
-
}
|
|
8
|
-
export declare const isShopifyRequestValid: (validationParams: ShopifyRequestValidationParameters, validationHmac: string, shopifyAppApiSecret: string) => boolean;
|
|
9
|
-
export declare const validateShopifyRequest: (validationParams: ShopifyRequestValidationParameters, validationHmac: string, shopifyAppApiSecret: string) => boolean;
|
|
1
|
+
export interface ShopifyRequestValidationParameters {
|
|
2
|
+
code: string;
|
|
3
|
+
hmac?: string;
|
|
4
|
+
shop: string;
|
|
5
|
+
state: string;
|
|
6
|
+
timestamp: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const isShopifyRequestValid: (validationParams: ShopifyRequestValidationParameters, validationHmac: string, shopifyAppApiSecret: string) => boolean;
|
|
9
|
+
export declare const validateShopifyRequest: (validationParams: ShopifyRequestValidationParameters, validationHmac: string, shopifyAppApiSecret: string) => boolean;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { createHmac } from 'crypto';
|
|
2
|
-
import { Logger } from './logging-helper.js';
|
|
3
|
-
import { HttpError } from '../libs/http-error.js';
|
|
4
|
-
import { mapObjectToQueryString } from '../libs/url.js';
|
|
5
|
-
export const isShopifyRequestValid = (validationParams, validationHmac, shopifyAppApiSecret) => {
|
|
6
|
-
delete validationParams.hmac;
|
|
7
|
-
const hmacString = mapObjectToQueryString(validationParams);
|
|
8
|
-
const generatedHash = createHmac('sha256', shopifyAppApiSecret)
|
|
9
|
-
.update(hmacString)
|
|
10
|
-
.digest('hex');
|
|
11
|
-
return generatedHash === validationHmac;
|
|
12
|
-
};
|
|
13
|
-
export const validateShopifyRequest = (validationParams, validationHmac, shopifyAppApiSecret) => {
|
|
14
|
-
Logger.info('Validating shopify request is authentic', { validationParams });
|
|
15
|
-
const isValid = isShopifyRequestValid(validationParams, validationHmac, shopifyAppApiSecret);
|
|
16
|
-
if (!isValid) {
|
|
17
|
-
const message = 'Failed: Shopify Request hmac validation';
|
|
18
|
-
Logger.error(message);
|
|
19
|
-
throw HttpError.badRequest(message);
|
|
20
|
-
}
|
|
21
|
-
Logger.info('Sucess: Shopify Request hmac validation');
|
|
22
|
-
return true;
|
|
23
|
-
};
|
|
1
|
+
import { createHmac } from 'crypto';
|
|
2
|
+
import { Logger } from './logging-helper.js';
|
|
3
|
+
import { HttpError } from '../libs/http-error.js';
|
|
4
|
+
import { mapObjectToQueryString } from '../libs/url.js';
|
|
5
|
+
export const isShopifyRequestValid = (validationParams, validationHmac, shopifyAppApiSecret) => {
|
|
6
|
+
delete validationParams.hmac;
|
|
7
|
+
const hmacString = mapObjectToQueryString(validationParams);
|
|
8
|
+
const generatedHash = createHmac('sha256', shopifyAppApiSecret)
|
|
9
|
+
.update(hmacString)
|
|
10
|
+
.digest('hex');
|
|
11
|
+
return generatedHash === validationHmac;
|
|
12
|
+
};
|
|
13
|
+
export const validateShopifyRequest = (validationParams, validationHmac, shopifyAppApiSecret) => {
|
|
14
|
+
Logger.info('Validating shopify request is authentic', { validationParams });
|
|
15
|
+
const isValid = isShopifyRequestValid(validationParams, validationHmac, shopifyAppApiSecret);
|
|
16
|
+
if (!isValid) {
|
|
17
|
+
const message = 'Failed: Shopify Request hmac validation';
|
|
18
|
+
Logger.error(message);
|
|
19
|
+
throw HttpError.badRequest(message);
|
|
20
|
+
}
|
|
21
|
+
Logger.info('Sucess: Shopify Request hmac validation');
|
|
22
|
+
return true;
|
|
23
|
+
};
|
|
24
24
|
//# sourceMappingURL=shopify-helper.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { SubscriptionPlan } from '@adtrackify/at-tracking-event-types';
|
|
2
|
-
export declare const StripeBillingMap: any;
|
|
3
|
-
export declare const CommonPlanInfo: string[];
|
|
4
|
-
export declare const SubscriptionPlanSeedItems: {
|
|
5
|
-
items: SubscriptionPlan[];
|
|
6
|
-
};
|
|
7
|
-
export declare const getPlanDetails: (planId: number, stage: string) => SubscriptionPlan;
|
|
8
|
-
export declare const getPlanByStripePriceId: (stripePriceId: string, stage: string) => SubscriptionPlan;
|
|
1
|
+
import { SubscriptionPlan } from '@adtrackify/at-tracking-event-types';
|
|
2
|
+
export declare const StripeBillingMap: any;
|
|
3
|
+
export declare const CommonPlanInfo: string[];
|
|
4
|
+
export declare const SubscriptionPlanSeedItems: {
|
|
5
|
+
items: SubscriptionPlan[];
|
|
6
|
+
};
|
|
7
|
+
export declare const getPlanDetails: (planId: number, stage: string) => SubscriptionPlan;
|
|
8
|
+
export declare const getPlanByStripePriceId: (stripePriceId: string, stage: string) => SubscriptionPlan;
|
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
import { PLAN_BILLING_FREQUENCY } from '@adtrackify/at-tracking-event-types';
|
|
2
|
-
export const StripeBillingMap = {
|
|
3
|
-
dev2: {
|
|
4
|
-
'free': 'price_1JzjbKK7krGh4037ezNbGJEm',
|
|
5
|
-
'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
|
|
6
|
-
'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
|
|
7
|
-
'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',
|
|
8
|
-
'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',
|
|
9
|
-
'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',
|
|
10
|
-
'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'
|
|
11
|
-
},
|
|
12
|
-
qa2: {
|
|
13
|
-
'free': 'price_1JzjbKK7krGh4037ezNbGJEm',
|
|
14
|
-
'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
|
|
15
|
-
'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
|
|
16
|
-
'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',
|
|
17
|
-
'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',
|
|
18
|
-
'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',
|
|
19
|
-
'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'
|
|
20
|
-
},
|
|
21
|
-
prod2: {
|
|
22
|
-
'free': 'price_1KAFsIK7krGh4037RsaAYMEl',
|
|
23
|
-
'starter_monthly': 'price_1KAFsMK7krGh4037Lz3P0ksU',
|
|
24
|
-
'starter_yearly': 'price_1KAFsMK7krGh4037Dj1WmSi8',
|
|
25
|
-
'scale_monthly': 'price_1KAFrxK7krGh4037zWCdaTly',
|
|
26
|
-
'scale_yearly': 'price_1KAFrxK7krGh40375fhymyWP',
|
|
27
|
-
'growth_monthly': 'price_1KAFs7K7krGh4037JChjz5Cr',
|
|
28
|
-
'growth_yearly': 'price_1KAFs7K7krGh4037rZElg12s'
|
|
29
|
-
},
|
|
30
|
-
dev: {
|
|
31
|
-
'free': 'price_1JzjbKK7krGh4037ezNbGJEm',
|
|
32
|
-
'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
|
|
33
|
-
'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
|
|
34
|
-
'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',
|
|
35
|
-
'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',
|
|
36
|
-
'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',
|
|
37
|
-
'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'
|
|
38
|
-
},
|
|
39
|
-
qa: {
|
|
40
|
-
'free': 'price_1JzjbKK7krGh4037ezNbGJEm',
|
|
41
|
-
'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
|
|
42
|
-
'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
|
|
43
|
-
'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',
|
|
44
|
-
'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',
|
|
45
|
-
'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',
|
|
46
|
-
'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'
|
|
47
|
-
},
|
|
48
|
-
prod: {
|
|
49
|
-
'free': 'price_1KAFsIK7krGh4037RsaAYMEl',
|
|
50
|
-
'starter_monthly': 'price_1KAFsMK7krGh4037Lz3P0ksU',
|
|
51
|
-
'starter_yearly': 'price_1KAFsMK7krGh4037Dj1WmSi8',
|
|
52
|
-
'scale_monthly': 'price_1KAFrxK7krGh4037zWCdaTly',
|
|
53
|
-
'scale_yearly': 'price_1KAFrxK7krGh40375fhymyWP',
|
|
54
|
-
'growth_monthly': 'price_1KAFs7K7krGh4037JChjz5Cr',
|
|
55
|
-
'growth_yearly': 'price_1KAFs7K7krGh4037rZElg12s'
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
export const CommonPlanInfo = [
|
|
59
|
-
'Free Server Side Tracking & Conversion API',
|
|
60
|
-
'MultiPixel Support (Multiple facebook, tiktok, etc)',
|
|
61
|
-
'Corrects Facebook Conversion Tracking post IOS14',
|
|
62
|
-
'Increase ROAS & Attribution Data',
|
|
63
|
-
'Enhanced Fingerprinting & Identity Resolution',
|
|
64
|
-
'Unlimited Integrations',
|
|
65
|
-
'Advanced Integrations (Webhooks, Custom JS/HTML, Hubspot)'
|
|
66
|
-
];
|
|
67
|
-
export const SubscriptionPlanSeedItems = {
|
|
68
|
-
items: [{
|
|
69
|
-
id: 1,
|
|
70
|
-
planName: 'free',
|
|
71
|
-
displayName: 'Free',
|
|
72
|
-
sku: 'ADT-001',
|
|
73
|
-
description: 'Free Plan - Monthly',
|
|
74
|
-
price: '0',
|
|
75
|
-
displayPrice: '$0',
|
|
76
|
-
billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,
|
|
77
|
-
trialLengthDays: 0,
|
|
78
|
-
trialRequiresCreditCard: false,
|
|
79
|
-
planDesc: [
|
|
80
|
-
...CommonPlanInfo,
|
|
81
|
-
],
|
|
82
|
-
unitPriceText: 'try now - free plan',
|
|
83
|
-
isHighlighted: false,
|
|
84
|
-
isBanner: false
|
|
85
|
-
},
|
|
86
|
-
]
|
|
87
|
-
};
|
|
88
|
-
export const getPlanDetails = (planId, stage) => {
|
|
89
|
-
const plan = SubscriptionPlanSeedItems.items.filter(x => x.id === planId)[0];
|
|
90
|
-
plan.stripePriceId = StripeBillingMap[stage][plan.planName];
|
|
91
|
-
return plan;
|
|
92
|
-
};
|
|
93
|
-
export const getPlanByStripePriceId = (stripePriceId, stage) => {
|
|
94
|
-
const stripePriceIds = StripeBillingMap[stage];
|
|
95
|
-
const planName = Object.keys(stripePriceIds).find(key => stripePriceIds[key] === stripePriceId);
|
|
96
|
-
const plan = SubscriptionPlanSeedItems.items.filter(x => x.planName === planName)[0];
|
|
97
|
-
plan.stripePriceId = stripePriceId;
|
|
98
|
-
return plan;
|
|
99
|
-
};
|
|
1
|
+
import { PLAN_BILLING_FREQUENCY } from '@adtrackify/at-tracking-event-types';
|
|
2
|
+
export const StripeBillingMap = {
|
|
3
|
+
dev2: {
|
|
4
|
+
'free': 'price_1JzjbKK7krGh4037ezNbGJEm',
|
|
5
|
+
'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
|
|
6
|
+
'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
|
|
7
|
+
'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',
|
|
8
|
+
'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',
|
|
9
|
+
'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',
|
|
10
|
+
'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'
|
|
11
|
+
},
|
|
12
|
+
qa2: {
|
|
13
|
+
'free': 'price_1JzjbKK7krGh4037ezNbGJEm',
|
|
14
|
+
'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
|
|
15
|
+
'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
|
|
16
|
+
'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',
|
|
17
|
+
'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',
|
|
18
|
+
'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',
|
|
19
|
+
'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'
|
|
20
|
+
},
|
|
21
|
+
prod2: {
|
|
22
|
+
'free': 'price_1KAFsIK7krGh4037RsaAYMEl',
|
|
23
|
+
'starter_monthly': 'price_1KAFsMK7krGh4037Lz3P0ksU',
|
|
24
|
+
'starter_yearly': 'price_1KAFsMK7krGh4037Dj1WmSi8',
|
|
25
|
+
'scale_monthly': 'price_1KAFrxK7krGh4037zWCdaTly',
|
|
26
|
+
'scale_yearly': 'price_1KAFrxK7krGh40375fhymyWP',
|
|
27
|
+
'growth_monthly': 'price_1KAFs7K7krGh4037JChjz5Cr',
|
|
28
|
+
'growth_yearly': 'price_1KAFs7K7krGh4037rZElg12s'
|
|
29
|
+
},
|
|
30
|
+
dev: {
|
|
31
|
+
'free': 'price_1JzjbKK7krGh4037ezNbGJEm',
|
|
32
|
+
'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
|
|
33
|
+
'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
|
|
34
|
+
'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',
|
|
35
|
+
'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',
|
|
36
|
+
'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',
|
|
37
|
+
'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'
|
|
38
|
+
},
|
|
39
|
+
qa: {
|
|
40
|
+
'free': 'price_1JzjbKK7krGh4037ezNbGJEm',
|
|
41
|
+
'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
|
|
42
|
+
'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
|
|
43
|
+
'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',
|
|
44
|
+
'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',
|
|
45
|
+
'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',
|
|
46
|
+
'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'
|
|
47
|
+
},
|
|
48
|
+
prod: {
|
|
49
|
+
'free': 'price_1KAFsIK7krGh4037RsaAYMEl',
|
|
50
|
+
'starter_monthly': 'price_1KAFsMK7krGh4037Lz3P0ksU',
|
|
51
|
+
'starter_yearly': 'price_1KAFsMK7krGh4037Dj1WmSi8',
|
|
52
|
+
'scale_monthly': 'price_1KAFrxK7krGh4037zWCdaTly',
|
|
53
|
+
'scale_yearly': 'price_1KAFrxK7krGh40375fhymyWP',
|
|
54
|
+
'growth_monthly': 'price_1KAFs7K7krGh4037JChjz5Cr',
|
|
55
|
+
'growth_yearly': 'price_1KAFs7K7krGh4037rZElg12s'
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
export const CommonPlanInfo = [
|
|
59
|
+
'Free Server Side Tracking & Conversion API',
|
|
60
|
+
'MultiPixel Support (Multiple facebook, tiktok, etc)',
|
|
61
|
+
'Corrects Facebook Conversion Tracking post IOS14',
|
|
62
|
+
'Increase ROAS & Attribution Data',
|
|
63
|
+
'Enhanced Fingerprinting & Identity Resolution',
|
|
64
|
+
'Unlimited Integrations',
|
|
65
|
+
'Advanced Integrations (Webhooks, Custom JS/HTML, Hubspot)'
|
|
66
|
+
];
|
|
67
|
+
export const SubscriptionPlanSeedItems = {
|
|
68
|
+
items: [{
|
|
69
|
+
id: 1,
|
|
70
|
+
planName: 'free',
|
|
71
|
+
displayName: 'Free',
|
|
72
|
+
sku: 'ADT-001',
|
|
73
|
+
description: 'Free Plan - Monthly',
|
|
74
|
+
price: '0',
|
|
75
|
+
displayPrice: '$0',
|
|
76
|
+
billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,
|
|
77
|
+
trialLengthDays: 0,
|
|
78
|
+
trialRequiresCreditCard: false,
|
|
79
|
+
planDesc: [
|
|
80
|
+
...CommonPlanInfo,
|
|
81
|
+
],
|
|
82
|
+
unitPriceText: 'try now - free plan',
|
|
83
|
+
isHighlighted: false,
|
|
84
|
+
isBanner: false
|
|
85
|
+
},
|
|
86
|
+
]
|
|
87
|
+
};
|
|
88
|
+
export const getPlanDetails = (planId, stage) => {
|
|
89
|
+
const plan = SubscriptionPlanSeedItems.items.filter(x => x.id === planId)[0];
|
|
90
|
+
plan.stripePriceId = StripeBillingMap[stage][plan.planName];
|
|
91
|
+
return plan;
|
|
92
|
+
};
|
|
93
|
+
export const getPlanByStripePriceId = (stripePriceId, stage) => {
|
|
94
|
+
const stripePriceIds = StripeBillingMap[stage];
|
|
95
|
+
const planName = Object.keys(stripePriceIds).find(key => stripePriceIds[key] === stripePriceId);
|
|
96
|
+
const plan = SubscriptionPlanSeedItems.items.filter(x => x.planName === planName)[0];
|
|
97
|
+
plan.stripePriceId = stripePriceId;
|
|
98
|
+
return plan;
|
|
99
|
+
};
|
|
100
100
|
//# sourceMappingURL=subscription-helper.js.map
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './clients/index.js';
|
|
2
|
-
export * from './helpers/index.js';
|
|
3
|
-
export * from './libs/index.js';
|
|
4
|
-
export * from './types/index.js';
|
|
5
|
-
export * from './services/index.js';
|
|
1
|
+
export * from './clients/index.js';
|
|
2
|
+
export * from './helpers/index.js';
|
|
3
|
+
export * from './libs/index.js';
|
|
4
|
+
export * from './types/index.js';
|
|
5
|
+
export * from './services/index.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './clients/index.js';
|
|
2
|
-
export * from './helpers/index.js';
|
|
3
|
-
export * from './libs/index.js';
|
|
4
|
-
export * from './types/index.js';
|
|
5
|
-
export * from './services/index.js';
|
|
1
|
+
export * from './clients/index.js';
|
|
2
|
+
export * from './helpers/index.js';
|
|
3
|
+
export * from './libs/index.js';
|
|
4
|
+
export * from './types/index.js';
|
|
5
|
+
export * from './services/index.js';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export declare enum CLICK_NETWORK {
|
|
2
|
-
GOOGLE = "Google",
|
|
3
|
-
FACEBOOK = "Facebook",
|
|
4
|
-
TIKTOK = "TikTok",
|
|
5
|
-
TWITTER = "Twitter",
|
|
6
|
-
SNAPCHAT = "Snapchat",
|
|
7
|
-
TABOOLA = "Taboola",
|
|
8
|
-
OUTBRAIN = "Outbrain",
|
|
9
|
-
MICROSOFT = "Microsoft"
|
|
10
|
-
}
|
|
11
|
-
export declare const ClickIdDictionary: {
|
|
12
|
-
[key: string]: CLICK_NETWORK;
|
|
13
|
-
};
|
|
14
|
-
export interface ParsedClickId {
|
|
15
|
-
mktClickParam?: string;
|
|
16
|
-
mktClickId?: string;
|
|
17
|
-
mkyClickNetwork?: CLICK_NETWORK;
|
|
18
|
-
}
|
|
19
|
-
export declare const parseClickId: (qsp: URLSearchParams) => {
|
|
20
|
-
mktClickParam: string;
|
|
21
|
-
mktClickId: string | null;
|
|
22
|
-
mktClickNetwork: CLICK_NETWORK;
|
|
23
|
-
} | undefined;
|
|
1
|
+
export declare enum CLICK_NETWORK {
|
|
2
|
+
GOOGLE = "Google",
|
|
3
|
+
FACEBOOK = "Facebook",
|
|
4
|
+
TIKTOK = "TikTok",
|
|
5
|
+
TWITTER = "Twitter",
|
|
6
|
+
SNAPCHAT = "Snapchat",
|
|
7
|
+
TABOOLA = "Taboola",
|
|
8
|
+
OUTBRAIN = "Outbrain",
|
|
9
|
+
MICROSOFT = "Microsoft"
|
|
10
|
+
}
|
|
11
|
+
export declare const ClickIdDictionary: {
|
|
12
|
+
[key: string]: CLICK_NETWORK;
|
|
13
|
+
};
|
|
14
|
+
export interface ParsedClickId {
|
|
15
|
+
mktClickParam?: string;
|
|
16
|
+
mktClickId?: string;
|
|
17
|
+
mkyClickNetwork?: CLICK_NETWORK;
|
|
18
|
+
}
|
|
19
|
+
export declare const parseClickId: (qsp: URLSearchParams) => {
|
|
20
|
+
mktClickParam: string;
|
|
21
|
+
mktClickId: string | null;
|
|
22
|
+
mktClickNetwork: CLICK_NETWORK;
|
|
23
|
+
} | undefined;
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { isEmpty } from '@adtrackify/at-shared-utils';
|
|
2
|
-
import { Logger } from '../helpers';
|
|
3
|
-
export var CLICK_NETWORK;
|
|
4
|
-
(function (CLICK_NETWORK) {
|
|
5
|
-
CLICK_NETWORK["GOOGLE"] = "Google";
|
|
6
|
-
CLICK_NETWORK["FACEBOOK"] = "Facebook";
|
|
7
|
-
CLICK_NETWORK["TIKTOK"] = "TikTok";
|
|
8
|
-
CLICK_NETWORK["TWITTER"] = "Twitter";
|
|
9
|
-
CLICK_NETWORK["SNAPCHAT"] = "Snapchat";
|
|
10
|
-
CLICK_NETWORK["TABOOLA"] = "Taboola";
|
|
11
|
-
CLICK_NETWORK["OUTBRAIN"] = "Outbrain";
|
|
12
|
-
CLICK_NETWORK["MICROSOFT"] = "Microsoft";
|
|
13
|
-
})(CLICK_NETWORK || (CLICK_NETWORK = {}));
|
|
14
|
-
export const ClickIdDictionary = {
|
|
15
|
-
'gclid': CLICK_NETWORK.GOOGLE,
|
|
16
|
-
'dclid': CLICK_NETWORK.GOOGLE,
|
|
17
|
-
'gbraid': CLICK_NETWORK.GOOGLE,
|
|
18
|
-
'wbraid': CLICK_NETWORK.GOOGLE,
|
|
19
|
-
'fbclid': CLICK_NETWORK.FACEBOOK,
|
|
20
|
-
'ttclid': CLICK_NETWORK.TIKTOK,
|
|
21
|
-
'twclid': CLICK_NETWORK.TWITTER,
|
|
22
|
-
'sccid': CLICK_NETWORK.SNAPCHAT,
|
|
23
|
-
'taboola_click_id': CLICK_NETWORK.TABOOLA,
|
|
24
|
-
'ob_click_id': CLICK_NETWORK.OUTBRAIN,
|
|
25
|
-
'microsoftclickid': CLICK_NETWORK.MICROSOFT,
|
|
26
|
-
};
|
|
27
|
-
export const parseClickId = (qsp) => {
|
|
28
|
-
try {
|
|
29
|
-
if (!isEmpty(qsp)) {
|
|
30
|
-
for (const item of Object.entries(ClickIdDictionary)) {
|
|
31
|
-
if (qsp.has(item?.[0])) {
|
|
32
|
-
return {
|
|
33
|
-
mktClickParam: item[0],
|
|
34
|
-
mktClickId: qsp.get(item[0]),
|
|
35
|
-
mktClickNetwork: item[1]
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
Logger.warn('Unable to parse click ID', { error });
|
|
43
|
-
return undefined;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
1
|
+
import { isEmpty } from '@adtrackify/at-shared-utils';
|
|
2
|
+
import { Logger } from '../helpers';
|
|
3
|
+
export var CLICK_NETWORK;
|
|
4
|
+
(function (CLICK_NETWORK) {
|
|
5
|
+
CLICK_NETWORK["GOOGLE"] = "Google";
|
|
6
|
+
CLICK_NETWORK["FACEBOOK"] = "Facebook";
|
|
7
|
+
CLICK_NETWORK["TIKTOK"] = "TikTok";
|
|
8
|
+
CLICK_NETWORK["TWITTER"] = "Twitter";
|
|
9
|
+
CLICK_NETWORK["SNAPCHAT"] = "Snapchat";
|
|
10
|
+
CLICK_NETWORK["TABOOLA"] = "Taboola";
|
|
11
|
+
CLICK_NETWORK["OUTBRAIN"] = "Outbrain";
|
|
12
|
+
CLICK_NETWORK["MICROSOFT"] = "Microsoft";
|
|
13
|
+
})(CLICK_NETWORK || (CLICK_NETWORK = {}));
|
|
14
|
+
export const ClickIdDictionary = {
|
|
15
|
+
'gclid': CLICK_NETWORK.GOOGLE,
|
|
16
|
+
'dclid': CLICK_NETWORK.GOOGLE,
|
|
17
|
+
'gbraid': CLICK_NETWORK.GOOGLE,
|
|
18
|
+
'wbraid': CLICK_NETWORK.GOOGLE,
|
|
19
|
+
'fbclid': CLICK_NETWORK.FACEBOOK,
|
|
20
|
+
'ttclid': CLICK_NETWORK.TIKTOK,
|
|
21
|
+
'twclid': CLICK_NETWORK.TWITTER,
|
|
22
|
+
'sccid': CLICK_NETWORK.SNAPCHAT,
|
|
23
|
+
'taboola_click_id': CLICK_NETWORK.TABOOLA,
|
|
24
|
+
'ob_click_id': CLICK_NETWORK.OUTBRAIN,
|
|
25
|
+
'microsoftclickid': CLICK_NETWORK.MICROSOFT,
|
|
26
|
+
};
|
|
27
|
+
export const parseClickId = (qsp) => {
|
|
28
|
+
try {
|
|
29
|
+
if (!isEmpty(qsp)) {
|
|
30
|
+
for (const item of Object.entries(ClickIdDictionary)) {
|
|
31
|
+
if (qsp.has(item?.[0])) {
|
|
32
|
+
return {
|
|
33
|
+
mktClickParam: item[0],
|
|
34
|
+
mktClickId: qsp.get(item[0]),
|
|
35
|
+
mktClickNetwork: item[1]
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
Logger.warn('Unable to parse click ID', { error });
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
46
|
//# sourceMappingURL=clickId-parser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const generatePublicKey: () => string;
|
|
1
|
+
export declare const generatePublicKey: () => string;
|
package/dist/esm/libs/crypto.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import crypto from 'crypto';
|
|
2
|
-
export const generatePublicKey = () => {
|
|
3
|
-
const publicKey = crypto.randomBytes(26);
|
|
4
|
-
return publicKey.toString('utf8');
|
|
5
|
-
};
|
|
1
|
+
import crypto from 'crypto';
|
|
2
|
+
export const generatePublicKey = () => {
|
|
3
|
+
const publicKey = crypto.randomBytes(26);
|
|
4
|
+
return publicKey.toString('utf8');
|
|
5
|
+
};
|
|
6
6
|
//# sourceMappingURL=crypto.js.map
|
package/dist/esm/libs/dates.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const getCurrentTimestamp: () => string;
|
|
2
|
-
export declare const getDateFromTimestamp: (timestamp: string) => string;
|
|
3
|
-
export declare const getCurrentDate: () => string;
|
|
1
|
+
export declare const getCurrentTimestamp: () => string;
|
|
2
|
+
export declare const getDateFromTimestamp: (timestamp: string) => string;
|
|
3
|
+
export declare const getCurrentDate: () => string;
|
package/dist/esm/libs/dates.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { DateTime } from 'luxon';
|
|
2
|
-
export const getCurrentTimestamp = () => {
|
|
3
|
-
return DateTime.utc().toJSDate().toISOString();
|
|
4
|
-
};
|
|
5
|
-
export const getDateFromTimestamp = (timestamp) => {
|
|
6
|
-
return timestamp.split('T')[0];
|
|
7
|
-
};
|
|
8
|
-
export const getCurrentDate = () => {
|
|
9
|
-
return getDateFromTimestamp(getCurrentTimestamp());
|
|
10
|
-
};
|
|
1
|
+
import { DateTime } from 'luxon';
|
|
2
|
+
export const getCurrentTimestamp = () => {
|
|
3
|
+
return DateTime.utc().toJSDate().toISOString();
|
|
4
|
+
};
|
|
5
|
+
export const getDateFromTimestamp = (timestamp) => {
|
|
6
|
+
return timestamp.split('T')[0];
|
|
7
|
+
};
|
|
8
|
+
export const getCurrentDate = () => {
|
|
9
|
+
return getDateFromTimestamp(getCurrentTimestamp());
|
|
10
|
+
};
|
|
11
11
|
//# sourceMappingURL=dates.js.map
|