@segment/action-destinations 3.290.0-staging-da759ff07 → 3.290.0-staging-373efa1cf
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/destinations/blackbaud-raisers-edge-nxt/utils/index.d.ts +1 -1
- package/dist/destinations/customerio/utils.d.ts +1 -1
- package/dist/destinations/engage/utils/track.d.ts +10 -10
- package/dist/destinations/google-enhanced-conversions/functions.d.ts +23 -3
- package/dist/destinations/google-enhanced-conversions/functions.js +280 -3
- package/dist/destinations/google-enhanced-conversions/functions.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/generated-types.d.ts +4 -0
- package/dist/destinations/google-enhanced-conversions/index.d.ts +2 -2
- package/dist/destinations/google-enhanced-conversions/index.js +50 -1
- package/dist/destinations/google-enhanced-conversions/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/types.d.ts +31 -0
- package/dist/destinations/google-enhanced-conversions/userList/index.js +13 -4
- package/dist/destinations/google-enhanced-conversions/userList/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/destinations/amazon-ads/generated-types.d.ts +0 -3
- package/dist/destinations/amazon-ads/generated-types.js +0 -3
- package/dist/destinations/amazon-ads/generated-types.js.map +0 -1
- package/dist/destinations/amazon-ads/index.d.ts +0 -4
- package/dist/destinations/amazon-ads/index.js +0 -87
- package/dist/destinations/amazon-ads/index.js.map +0 -1
- package/dist/destinations/amazon-ads/syncAudiences/generated-types.d.ts +0 -2
- package/dist/destinations/amazon-ads/syncAudiences/generated-types.js +0 -3
- package/dist/destinations/amazon-ads/syncAudiences/generated-types.js.map +0 -1
- package/dist/destinations/amazon-ads/syncAudiences/index.d.ts +0 -5
- package/dist/destinations/amazon-ads/syncAudiences/index.js +0 -15
- package/dist/destinations/amazon-ads/syncAudiences/index.js.map +0 -1
- package/dist/destinations/amazon-ads/types.d.ts +0 -22
- package/dist/destinations/amazon-ads/types.js +0 -11
- package/dist/destinations/amazon-ads/types.js.map +0 -1
- package/dist/destinations/amazon-ads/utils.d.ts +0 -25
- package/dist/destinations/amazon-ads/utils.js +0 -8
- package/dist/destinations/amazon-ads/utils.js.map +0 -1
- package/dist/destinations/contentstack/constants.d.ts +0 -3
- package/dist/destinations/contentstack/constants.js +0 -7
- package/dist/destinations/contentstack/constants.js.map +0 -1
- package/dist/destinations/dynamic-yield-audiences/syncAudience/types.d.ts +0 -22
- package/dist/destinations/dynamic-yield-audiences/syncAudience/types.js +0 -3
- package/dist/destinations/dynamic-yield-audiences/syncAudience/types.js.map +0 -1
- package/dist/destinations/dynamic-yield-audiences/types.d.ts +0 -8
- package/dist/destinations/dynamic-yield-audiences/types.js +0 -12
- package/dist/destinations/dynamic-yield-audiences/types.js.map +0 -1
- package/dist/destinations/engage/sendgrid/Profile.d.ts +0 -6
- package/dist/destinations/engage/sendgrid/Profile.js +0 -3
- package/dist/destinations/engage/sendgrid/Profile.js.map +0 -1
- package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.d.ts +0 -21
- package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js +0 -174
- package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js.map +0 -1
- package/dist/destinations/klaviyo/orderCompleted/formatters.d.ts +0 -26
- package/dist/destinations/klaviyo/orderCompleted/formatters.js +0 -62
- package/dist/destinations/klaviyo/orderCompleted/formatters.js.map +0 -1
- package/dist/destinations/klaviyo/orderCompleted/types.d.ts +0 -2
- package/dist/destinations/klaviyo/orderCompleted/types.js +0 -3
- package/dist/destinations/klaviyo/orderCompleted/types.js.map +0 -1
- package/dist/destinations/responsys/asyncMergePetRecords/generated-types.d.ts +0 -14
- package/dist/destinations/responsys/asyncMergePetRecords/generated-types.js +0 -3
- package/dist/destinations/responsys/asyncMergePetRecords/generated-types.js.map +0 -1
- package/dist/destinations/responsys/asyncMergePetRecords/index.d.ts +0 -5
- package/dist/destinations/responsys/asyncMergePetRecords/index.js +0 -113
- package/dist/destinations/responsys/asyncMergePetRecords/index.js.map +0 -1
- package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.d.ts +0 -20
- package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.js +0 -3
- package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.js.map +0 -1
- package/dist/destinations/responsys/asyncMergeProfileListMembers/index.d.ts +0 -5
- package/dist/destinations/responsys/asyncMergeProfileListMembers/index.js +0 -174
- package/dist/destinations/responsys/asyncMergeProfileListMembers/index.js.map +0 -1
- package/dist/destinations/responsys/rsp-operations.d.ts +0 -14
- package/dist/destinations/responsys/rsp-operations.js +0 -33
- package/dist/destinations/responsys/rsp-operations.js.map +0 -1
- package/dist/destinations/responsys/rsp-properties.d.ts +0 -4
- package/dist/destinations/responsys/rsp-properties.js +0 -27
- package/dist/destinations/responsys/rsp-properties.js.map +0 -1
- package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.d.ts +0 -1
- package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.js +0 -381
- package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.js.map +0 -1
- package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.d.ts +0 -1
- package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.js +0 -581
- package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.js.map +0 -1
- package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.d.ts +0 -4
- package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.js +0 -97
- package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.js.map +0 -1
- package/dist/destinations/snap-conversions-api/snap-capi-properties.d.ts +0 -30
- package/dist/destinations/snap-conversions-api/snap-capi-properties.js +0 -316
- package/dist/destinations/snap-conversions-api/snap-capi-properties.js.map +0 -1
- package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.d.ts +0 -3
- package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.js +0 -34
- package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.js.map +0 -1
- package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.d.ts +0 -3
- package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.js +0 -43
- package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segment/action-destinations",
|
|
3
3
|
"description": "Destination Actions engine and definitions.",
|
|
4
|
-
"version": "3.290.0-staging-
|
|
4
|
+
"version": "3.290.0-staging-373efa1cf",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@bufbuild/protobuf": "^1.4.2",
|
|
45
45
|
"@bufbuild/protoc-gen-es": "^1.4.2",
|
|
46
46
|
"@segment/a1-notation": "^2.1.4",
|
|
47
|
-
"@segment/actions-core": "3.122.0-staging-
|
|
47
|
+
"@segment/actions-core": "3.122.0-staging-373efa1cf",
|
|
48
48
|
"@segment/actions-shared": "1.103.0-staging-726544a28",
|
|
49
49
|
"@types/node": "^18.11.15",
|
|
50
50
|
"ajv-formats": "^2.1.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/amazon-ads/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
7
|
-
const syncAudiences_1 = __importDefault(require("./syncAudiences"));
|
|
8
|
-
const destination = {
|
|
9
|
-
name: 'Amazon Ads',
|
|
10
|
-
slug: 'actions-amazon-ads',
|
|
11
|
-
mode: 'cloud',
|
|
12
|
-
authentication: {
|
|
13
|
-
scheme: 'oauth2',
|
|
14
|
-
fields: {
|
|
15
|
-
region: {
|
|
16
|
-
label: 'Region',
|
|
17
|
-
description: 'Region for API Endpoint, either NA, EU, FE.',
|
|
18
|
-
choices: [
|
|
19
|
-
{ label: 'North America (NA)', value: 'https://advertising-api.amazon.com' },
|
|
20
|
-
{ label: 'Europe (EU)', value: 'https://advertising-api-eu.amazon.com' },
|
|
21
|
-
{ label: 'Far East (FE)', value: 'https://advertising-api-fe.amazon.com' }
|
|
22
|
-
],
|
|
23
|
-
default: 'North America (NA)',
|
|
24
|
-
type: 'string',
|
|
25
|
-
required: true
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
testAuthentication: async (request, { auth }) => {
|
|
29
|
-
if (!auth?.accessToken) {
|
|
30
|
-
throw new actions_core_1.InvalidAuthenticationError('Please authenticate via Oauth before enabling the destination.');
|
|
31
|
-
}
|
|
32
|
-
try {
|
|
33
|
-
await request('https://advertising-api.amazon.com/v2/profiles', {
|
|
34
|
-
method: 'GET'
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
catch (e) {
|
|
38
|
-
const error = e;
|
|
39
|
-
if (error.message === 'Unauthorized') {
|
|
40
|
-
throw new Error('Invalid Amazon Oauth access token. Please reauthenticate to retrieve a valid access token before enabling the destination.');
|
|
41
|
-
}
|
|
42
|
-
throw e;
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
refreshAccessToken: async (request, { auth }) => {
|
|
46
|
-
let res;
|
|
47
|
-
try {
|
|
48
|
-
res = await request('https://api.amazon.com/auth/o2/token', {
|
|
49
|
-
method: 'POST',
|
|
50
|
-
body: new URLSearchParams({
|
|
51
|
-
refresh_token: auth.refreshToken,
|
|
52
|
-
client_id: auth.clientId,
|
|
53
|
-
client_secret: auth.clientSecret,
|
|
54
|
-
grant_type: 'refresh_token'
|
|
55
|
-
})
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
catch (e) {
|
|
59
|
-
const error = e;
|
|
60
|
-
if (error.response?.data?.error === 'invalid_grant') {
|
|
61
|
-
throw new actions_core_1.IntegrationError(`Invalid Authentication: Your refresh token is invalid or expired. Please re-authenticate to fetch a new refresh token.`, actions_core_1.ErrorCodes.REFRESH_TOKEN_EXPIRED, 401);
|
|
62
|
-
}
|
|
63
|
-
throw new actions_core_1.IntegrationError(`Failed to fetch a new access token. Reason: ${error.response?.data?.error}`, actions_core_1.ErrorCodes.OAUTH_REFRESH_FAILED, 401);
|
|
64
|
-
}
|
|
65
|
-
return { accessToken: res?.data?.access_token };
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
extendRequest({ auth }) {
|
|
69
|
-
return {
|
|
70
|
-
headers: {
|
|
71
|
-
authorization: `Bearer ${auth?.accessToken}`
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
},
|
|
75
|
-
audienceFields: {},
|
|
76
|
-
audienceConfig: {
|
|
77
|
-
mode: {
|
|
78
|
-
type: 'synced',
|
|
79
|
-
full_audience_sync: false
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
actions: {
|
|
83
|
-
syncAudiences: syncAudiences_1.default
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
exports.default = destination;
|
|
87
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/amazon-ads/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAgG;AAIhG,oEAA2C;AAG3C,MAAM,WAAW,GAA4C;IAC3D,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,6CAA6C;gBAC1D,OAAO,EA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,CAAA;gBAC1C,IAAI,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,KAAK,eAAe,EAAE;oBACnD,MAAM,IAAI,+BAAgB,CACxB,wHAAwH,EACxH,yBAAU,CAAC,qBAAqB,EAChC,GAAG,CACJ,CAAA;iBACF;gBAED,MAAM,IAAI,+BAAgB,CACxB,+CAA+C,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,EAC5E,yBAAU,CAAC,oBAAoB,EAC/B,GAAG,CACJ,CAAA;aACF;YAED,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,CAAA;QACjD,CAAC;KACF;IACD,aAAa,CAAC,EAAE,IAAI,EAAE;QACpB,OAAO;YACL,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,EAAE,WAAW,EAAE;aAC7C;SACF,CAAA;IACH,CAAC;IAED,cAAc,EAAE,EAAE;IAElB,cAAc,EAAE;QACd,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,kBAAkB,EAAE,KAAK;SAC1B;KAWF;IACD,OAAO,EAAE;QACP,aAAa,EAAb,uBAAa;KACd;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/amazon-ads/syncAudiences/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const action = {
|
|
4
|
-
title: 'Sync Audiences',
|
|
5
|
-
description: 'Sync audiences from Segment to Amazon Ads Audience.',
|
|
6
|
-
fields: {},
|
|
7
|
-
perform: (request, data) => {
|
|
8
|
-
return request('https://example.com', {
|
|
9
|
-
method: 'post',
|
|
10
|
-
json: data.payload
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
exports.default = action;
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/amazon-ads/syncAudiences/index.ts"],"names":[],"mappings":";;AAIA,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,qDAAqD;IAClE,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE;QACzB,OAAO,OAAO,CAAC,qBAAqB,EAAE;YACpC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,OAAO;SACnB,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { HTTPError } from '@segment/actions-core';
|
|
2
|
-
export interface RefreshTokenResponse {
|
|
3
|
-
access_token: string;
|
|
4
|
-
scope: string;
|
|
5
|
-
expires_in: number;
|
|
6
|
-
token_type: string;
|
|
7
|
-
}
|
|
8
|
-
export declare class AmazonTestAuthenticationError extends HTTPError {
|
|
9
|
-
response: Response & {
|
|
10
|
-
data: {
|
|
11
|
-
message: string;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export declare class AmazonRefreshTokenError extends HTTPError {
|
|
16
|
-
response: Response & {
|
|
17
|
-
data: {
|
|
18
|
-
error: string;
|
|
19
|
-
error_description: string;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AmazonRefreshTokenError = exports.AmazonTestAuthenticationError = void 0;
|
|
4
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
5
|
-
class AmazonTestAuthenticationError extends actions_core_1.HTTPError {
|
|
6
|
-
}
|
|
7
|
-
exports.AmazonTestAuthenticationError = AmazonTestAuthenticationError;
|
|
8
|
-
class AmazonRefreshTokenError extends actions_core_1.HTTPError {
|
|
9
|
-
}
|
|
10
|
-
exports.AmazonRefreshTokenError = AmazonRefreshTokenError;
|
|
11
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/destinations/amazon-ads/types.ts"],"names":[],"mappings":";;;AAAA,wDAAiD;AAajD,MAAa,6BAA8B,SAAQ,wBAAS;CAM3D;AAND,sEAMC;AAED,MAAa,uBAAwB,SAAQ,wBAAS;CAOrD;AAPD,0DAOC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { HTTPError } from '@segment/actions-core';
|
|
2
|
-
export declare class AmazonAdsError extends HTTPError {
|
|
3
|
-
response: Response & {
|
|
4
|
-
data: {
|
|
5
|
-
status: string;
|
|
6
|
-
message: string;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
export interface AudiencePayload {
|
|
11
|
-
name: string;
|
|
12
|
-
description: string;
|
|
13
|
-
countryCode?: string;
|
|
14
|
-
targetResource: {
|
|
15
|
-
advertiserId: string;
|
|
16
|
-
};
|
|
17
|
-
metadata: {
|
|
18
|
-
externalAudienceId: string;
|
|
19
|
-
ttl?: number;
|
|
20
|
-
audienceFees?: {
|
|
21
|
-
cpmCents: number;
|
|
22
|
-
currency: string;
|
|
23
|
-
}[];
|
|
24
|
-
};
|
|
25
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AmazonAdsError = void 0;
|
|
4
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
5
|
-
class AmazonAdsError extends actions_core_1.HTTPError {
|
|
6
|
-
}
|
|
7
|
-
exports.AmazonAdsError = AmazonAdsError;
|
|
8
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/destinations/amazon-ads/utils.ts"],"names":[],"mappings":";;;AAAA,wDAAiD;AAEjD,MAAa,cAAe,SAAQ,wBAAS;CAO5C;AAPD,wCAOC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const PERSONALIZE_API_BASE_URL = "https://personalization-api.contentstack.com";
|
|
2
|
-
export declare const PERSONALIZE_EDGE_API_URL = "https://personalization-edge.contentstack.com";
|
|
3
|
-
export declare const ACCESS_TOKEN_URL = "https://developerhub-api.contentstack.com/apps/token";
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ACCESS_TOKEN_URL = exports.PERSONALIZE_EDGE_API_URL = exports.PERSONALIZE_API_BASE_URL = void 0;
|
|
4
|
-
exports.PERSONALIZE_API_BASE_URL = 'https://personalization-api.contentstack.com';
|
|
5
|
-
exports.PERSONALIZE_EDGE_API_URL = 'https://personalization-edge.contentstack.com';
|
|
6
|
-
exports.ACCESS_TOKEN_URL = 'https://developerhub-api.contentstack.com/apps/token';
|
|
7
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/destinations/contentstack/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,wBAAwB,GAAG,8CAA8C,CAAA;AACzE,QAAA,wBAAwB,GAAG,+CAA+C,CAAA;AAC1E,QAAA,gBAAgB,GAAG,sDAAsD,CAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Payload } from './generated-types';
|
|
2
|
-
export interface Data {
|
|
3
|
-
payload: Payload & {
|
|
4
|
-
context?: {
|
|
5
|
-
[k: string]: unknown;
|
|
6
|
-
personas?: {
|
|
7
|
-
computation_key?: string;
|
|
8
|
-
computation_class?: string;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
rawData?: {
|
|
13
|
-
context?: {
|
|
14
|
-
personas?: {
|
|
15
|
-
computation_key?: string;
|
|
16
|
-
computation_class?: string;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
properties?: Record<string, boolean>;
|
|
20
|
-
traits?: Record<string, boolean>;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/destinations/dynamic-yield-audiences/syncAudience/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare type AudienceAction = 'ADD' | 'REMOVE';
|
|
2
|
-
export declare enum Priority {
|
|
3
|
-
UserIdThenEmail = "user_id_then_email",
|
|
4
|
-
UserIdThenAnonymousId = "user_id_then_anonymousId",
|
|
5
|
-
UserIdThenEmailThenAnonymousId = "user_id_then_email_then_anonymousId",
|
|
6
|
-
UserIdOnly = "user_id_only",
|
|
7
|
-
EmailOnly = "email_only"
|
|
8
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Priority = void 0;
|
|
4
|
-
var Priority;
|
|
5
|
-
(function (Priority) {
|
|
6
|
-
Priority["UserIdThenEmail"] = "user_id_then_email";
|
|
7
|
-
Priority["UserIdThenAnonymousId"] = "user_id_then_anonymousId";
|
|
8
|
-
Priority["UserIdThenEmailThenAnonymousId"] = "user_id_then_email_then_anonymousId";
|
|
9
|
-
Priority["UserIdOnly"] = "user_id_only";
|
|
10
|
-
Priority["EmailOnly"] = "email_only";
|
|
11
|
-
})(Priority = exports.Priority || (exports.Priority = {}));
|
|
12
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/destinations/dynamic-yield-audiences/types.ts"],"names":[],"mappings":";;;AAEA,IAAY,QAMX;AAND,WAAY,QAAQ;IAClB,kDAAsC,CAAA;IACtC,8DAAkD,CAAA;IAClD,kFAAsE,CAAA;IACtE,uCAA2B,CAAA;IAC3B,oCAAwB,CAAA;AAC1B,CAAC,EANW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAMnB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Profile.js","sourceRoot":"","sources":["../../../../src/destinations/engage/sendgrid/Profile.ts"],"names":[],"mappings":""}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { InputField } from '@segment/actions-core';
|
|
2
|
-
import { RequestClient } from '@segment/actions-core';
|
|
3
|
-
import { Logger, StatsClient, DataFeedCache } from '@segment/actions-core/destination-kit';
|
|
4
|
-
import type { Settings } from '../generated-types';
|
|
5
|
-
import { Profile } from '../Profile';
|
|
6
|
-
export declare type ApiLookupConfig = {
|
|
7
|
-
id?: string | undefined;
|
|
8
|
-
name: string;
|
|
9
|
-
url: string;
|
|
10
|
-
method: string;
|
|
11
|
-
cacheTtl: number;
|
|
12
|
-
body?: string | undefined;
|
|
13
|
-
headers?: object | undefined;
|
|
14
|
-
responseType: string;
|
|
15
|
-
};
|
|
16
|
-
export declare const getRequestId: ({ method, url, body, headers }: ApiLookupConfig) => string;
|
|
17
|
-
export declare const getCachedResponse: ({ responseType }: ApiLookupConfig, requestId: string, dataFeedCache: DataFeedCache, datafeedTags: string[]) => Promise<any>;
|
|
18
|
-
export declare const performApiLookup: (request: RequestClient, apiLookupConfig: ApiLookupConfig, profile: Profile, statsClient: StatsClient | undefined, tags: string[], settings: Settings, logger?: Logger | undefined, dataFeedCache?: DataFeedCache | undefined) => Promise<any>;
|
|
19
|
-
export declare const apiLookupActionFields: Record<string, InputField>;
|
|
20
|
-
export declare const apiLookupLiquidKey = "lookups";
|
|
21
|
-
export declare const FLAGON_NAME_DATA_FEEDS = "is-datafeeds-enabled";
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FLAGON_NAME_DATA_FEEDS = exports.apiLookupLiquidKey = exports.apiLookupActionFields = exports.performApiLookup = exports.getCachedResponse = exports.getRequestId = void 0;
|
|
4
|
-
const crypto_1 = require("crypto");
|
|
5
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
6
|
-
const liquidjs_1 = require("liquidjs");
|
|
7
|
-
const Liquid = new liquidjs_1.Liquid();
|
|
8
|
-
const maxResponseSizeBytes = 1000000;
|
|
9
|
-
const renderLiquidFields = async ({ id, url, body }, profile, datafeedTags, settings, logger) => {
|
|
10
|
-
let renderedUrl;
|
|
11
|
-
let renderedBody;
|
|
12
|
-
try {
|
|
13
|
-
renderedUrl = await Liquid.parseAndRender(url, { profile });
|
|
14
|
-
}
|
|
15
|
-
catch (error) {
|
|
16
|
-
logger?.error(`TE Messaging: Email datafeed url parse failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
|
|
17
|
-
datafeedTags.push('error:true', `error_message:${error?.message}`, 'reason:rendering_failure', 'rendering:url');
|
|
18
|
-
throw new actions_core_1.IntegrationError('Unable to parse email api lookup url', 'api lookup url parse failure', 400);
|
|
19
|
-
}
|
|
20
|
-
try {
|
|
21
|
-
renderedBody = body ? await Liquid.parseAndRender(body, { profile }) : undefined;
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
logger?.error(`TE Messaging: Email datafeed body parse failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
|
|
25
|
-
datafeedTags.push('error:true', `error_message:${error?.message}`, 'reason:rendering_failure', 'rendering:body');
|
|
26
|
-
throw new actions_core_1.IntegrationError('Unable to parse email api lookup body', 'api lookup body parse failure', 400);
|
|
27
|
-
}
|
|
28
|
-
return {
|
|
29
|
-
renderedUrl,
|
|
30
|
-
renderedBody
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
const getRequestId = ({ method, url, body, headers }) => {
|
|
34
|
-
const requestHash = crypto_1.createHash('sha256');
|
|
35
|
-
requestHash.update(`${method}${url}${body}${JSON.stringify(headers)}`);
|
|
36
|
-
const requestId = requestHash.digest('hex');
|
|
37
|
-
return requestId;
|
|
38
|
-
};
|
|
39
|
-
exports.getRequestId = getRequestId;
|
|
40
|
-
const getCachedResponse = async ({ responseType }, requestId, dataFeedCache, datafeedTags) => {
|
|
41
|
-
const cachedResponse = await dataFeedCache?.getRequestResponse(requestId);
|
|
42
|
-
if (!cachedResponse) {
|
|
43
|
-
datafeedTags.push('cache_hit:false');
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
datafeedTags.push('cache_hit:true');
|
|
47
|
-
if (responseType === 'json') {
|
|
48
|
-
return JSON.parse(cachedResponse);
|
|
49
|
-
}
|
|
50
|
-
return cachedResponse;
|
|
51
|
-
};
|
|
52
|
-
exports.getCachedResponse = getCachedResponse;
|
|
53
|
-
const performApiLookup = async (request, apiLookupConfig, profile, statsClient, tags, settings, logger, dataFeedCache) => {
|
|
54
|
-
const { id, method, headers, cacheTtl, name } = apiLookupConfig;
|
|
55
|
-
const datafeedTags = [
|
|
56
|
-
...tags,
|
|
57
|
-
`datafeed_id:${id}`,
|
|
58
|
-
`datafeed_name:${name}`,
|
|
59
|
-
`space_id:${settings.spaceId}`,
|
|
60
|
-
`cache_ttl_greater_than_0:${cacheTtl > 0}`
|
|
61
|
-
];
|
|
62
|
-
try {
|
|
63
|
-
const { renderedUrl, renderedBody } = await renderLiquidFields(apiLookupConfig, profile, datafeedTags, settings, logger);
|
|
64
|
-
const requestId = exports.getRequestId({ ...apiLookupConfig, url: renderedUrl, body: renderedBody });
|
|
65
|
-
if (cacheTtl > 0 && dataFeedCache) {
|
|
66
|
-
const cachedResponse = await exports.getCachedResponse(apiLookupConfig, requestId, dataFeedCache, datafeedTags);
|
|
67
|
-
if (cachedResponse) {
|
|
68
|
-
datafeedTags.push('error:false');
|
|
69
|
-
return cachedResponse;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
let data;
|
|
73
|
-
try {
|
|
74
|
-
const res = await request(renderedUrl, {
|
|
75
|
-
headers: headers ?? undefined,
|
|
76
|
-
timeout: 3000,
|
|
77
|
-
method: method,
|
|
78
|
-
body: renderedBody,
|
|
79
|
-
skipResponseCloning: true
|
|
80
|
-
});
|
|
81
|
-
data = await res.data;
|
|
82
|
-
}
|
|
83
|
-
catch (error) {
|
|
84
|
-
const respError = error.response;
|
|
85
|
-
logger?.error(`TE Messaging: Email api lookup failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
|
|
86
|
-
datafeedTags.push(`error:true`, `error_message:${error.message}`, `error_status:${respError?.status}`, 'reason:api_call_failure');
|
|
87
|
-
throw error;
|
|
88
|
-
}
|
|
89
|
-
const dataString = JSON.stringify(data);
|
|
90
|
-
const size = Buffer.byteLength(dataString, 'utf-8');
|
|
91
|
-
datafeedTags.push(`response_size_greater_than_mb:${size > maxResponseSizeBytes}`);
|
|
92
|
-
if (cacheTtl > 0) {
|
|
93
|
-
if (size <= maxResponseSizeBytes) {
|
|
94
|
-
try {
|
|
95
|
-
await dataFeedCache?.setRequestResponse(requestId, dataString, cacheTtl / 1000);
|
|
96
|
-
datafeedTags.push('cache_set:true');
|
|
97
|
-
}
|
|
98
|
-
catch (err) {
|
|
99
|
-
logger?.error(`TE Messaging: Email api lookup cache set failure - api lookup id: ${id} - ${settings.spaceId} - [${err}]`);
|
|
100
|
-
datafeedTags.push('cache_set:false');
|
|
101
|
-
datafeedTags.push('error:true', 'reason:cache_set_failure', `error_message:${err?.message}`);
|
|
102
|
-
throw err;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
datafeedTags.push('cache_set:false');
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return data;
|
|
110
|
-
}
|
|
111
|
-
catch (error) {
|
|
112
|
-
const isErrorCapturedInTags = datafeedTags.find((str) => str.includes('error:true'));
|
|
113
|
-
if (!isErrorCapturedInTags) {
|
|
114
|
-
datafeedTags.push('error:true', `error_message:${error?.message}`, 'reason:unknown');
|
|
115
|
-
}
|
|
116
|
-
tags.push('reason:datafeed_failure');
|
|
117
|
-
logger?.error(`TE Messaging: Email api lookup failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
|
|
118
|
-
throw error;
|
|
119
|
-
}
|
|
120
|
-
finally {
|
|
121
|
-
statsClient?.incr('datafeed-execution', 1, datafeedTags);
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
exports.performApiLookup = performApiLookup;
|
|
125
|
-
exports.apiLookupActionFields = {
|
|
126
|
-
id: {
|
|
127
|
-
label: 'ID',
|
|
128
|
-
description: 'The id of the API lookup for use in logging & observability',
|
|
129
|
-
type: 'string'
|
|
130
|
-
},
|
|
131
|
-
name: {
|
|
132
|
-
label: 'Name',
|
|
133
|
-
description: 'The name of the API lookup referenced in liquid syntax',
|
|
134
|
-
type: 'string',
|
|
135
|
-
required: true
|
|
136
|
-
},
|
|
137
|
-
url: {
|
|
138
|
-
label: 'URL',
|
|
139
|
-
description: 'The URL endpoint to call',
|
|
140
|
-
type: 'string',
|
|
141
|
-
required: true
|
|
142
|
-
},
|
|
143
|
-
method: {
|
|
144
|
-
label: 'Request Method',
|
|
145
|
-
description: 'The request method, e.g. GET/POST/etc.',
|
|
146
|
-
type: 'string',
|
|
147
|
-
required: true
|
|
148
|
-
},
|
|
149
|
-
cacheTtl: {
|
|
150
|
-
label: 'Cache TTL',
|
|
151
|
-
description: 'The cache TTL in ms',
|
|
152
|
-
type: 'integer',
|
|
153
|
-
required: true
|
|
154
|
-
},
|
|
155
|
-
body: {
|
|
156
|
-
label: 'Request Body',
|
|
157
|
-
description: 'The request body for use with POST/PUT/PATCH requests',
|
|
158
|
-
type: 'string'
|
|
159
|
-
},
|
|
160
|
-
headers: {
|
|
161
|
-
label: 'Request Headers',
|
|
162
|
-
description: 'Headers in JSON to be sent with the request',
|
|
163
|
-
type: 'object'
|
|
164
|
-
},
|
|
165
|
-
responseType: {
|
|
166
|
-
label: 'Response Type',
|
|
167
|
-
description: 'The response type of the request. Currently only supporting JSON.',
|
|
168
|
-
type: 'string',
|
|
169
|
-
required: true
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
exports.apiLookupLiquidKey = 'lookups';
|
|
173
|
-
exports.FLAGON_NAME_DATA_FEEDS = 'is-datafeeds-enabled';
|
|
174
|
-
//# sourceMappingURL=api-lookups.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api-lookups.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/sendgrid/previewApiLookup/api-lookups.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,wDAAwD;AAKxD,uCAA6C;AAI7C,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AAE7B,MAAM,oBAAoB,GAAG,OAAO,CAAA;AAcpC,MAAM,kBAAkB,GAAG,KAAK,EAC9B,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAgD,EAC/D,OAAgB,EAChB,YAAsB,EACtB,QAAkB,EAClB,MAA2B,EAC3B,EAAE;IACF,IAAI,WAAmB,CAAA;IACvB,IAAI,YAAgC,CAAA;IACpC,IAAI;QACF,WAAW,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;KAC5D;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,EAAE,KAAK,CACX,mEAAmE,EAAE,MAAM,QAAQ,CAAC,OAAO,OAAO,KAAK,GAAG,CAC3G,CAAA;QACD,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,iBAAiB,KAAK,EAAE,OAAO,EAAE,EAAE,0BAA0B,EAAE,eAAe,CAAC,CAAA;QAC/G,MAAM,IAAI,+BAAgB,CAAC,sCAAsC,EAAE,8BAA8B,EAAE,GAAG,CAAC,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E;QACN,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,wCAAwC;QACrD,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;KACf;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,qBAAqB;QAClC,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,IAAI;KACf;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,uDAAuD;QACpE,IAAI,EAAE,QAAQ;KACf;IACD,OAAO,EAAE;QACP,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,6CAA6C;QAC1D,IAAI,EAAE,QAAQ;KACf;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,mEAAmE;QAChF,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;KACf;CACF,CAAA;AAEY,QAAA,kBAAkB,GAAG,SAAS,CAAA;AAE9B,QAAA,sBAAsB,GAAG,sBAAsB,CAAA"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Product } from './types';
|
|
2
|
-
export declare function convertKeysToTitleCase(obj: Record<string, unknown>, level?: number): Record<string, unknown>;
|
|
3
|
-
export declare function formatOrderedProduct(product: Product, order_id?: string, unique_event_id?: String): {
|
|
4
|
-
unique_id: string | undefined;
|
|
5
|
-
productProperties: {
|
|
6
|
-
OrderId: string | undefined;
|
|
7
|
-
ProductId: unknown;
|
|
8
|
-
SKU: string | undefined;
|
|
9
|
-
ProductName: string | undefined;
|
|
10
|
-
Quantity: number | undefined;
|
|
11
|
-
Categories: string[];
|
|
12
|
-
ProductURL: string | undefined;
|
|
13
|
-
ImageURL: string | undefined;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export declare function formatProductItems(product: Product): {
|
|
17
|
-
ProductId: unknown;
|
|
18
|
-
SKU: string | undefined;
|
|
19
|
-
ProductName: string | undefined;
|
|
20
|
-
Quantity: number | undefined;
|
|
21
|
-
ItemPrice: number | undefined;
|
|
22
|
-
RowTotal: number | undefined;
|
|
23
|
-
Categories: string[];
|
|
24
|
-
ProductURL: string | undefined;
|
|
25
|
-
ImageURL: string | undefined;
|
|
26
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatProductItems = exports.formatOrderedProduct = exports.convertKeysToTitleCase = void 0;
|
|
4
|
-
function toTitleCase(str) {
|
|
5
|
-
return (str
|
|
6
|
-
.replace(/[^a-zA-Z0-9]/g, ' ')
|
|
7
|
-
.replace(/\s+/g, ' ')
|
|
8
|
-
.trim()
|
|
9
|
-
.split(' ')
|
|
10
|
-
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
11
|
-
.join(''));
|
|
12
|
-
}
|
|
13
|
-
function convertKeysToTitleCase(obj, level = 0) {
|
|
14
|
-
if (level > 1)
|
|
15
|
-
return obj;
|
|
16
|
-
return Object.fromEntries(Object.entries(obj).map(([key, value]) => {
|
|
17
|
-
if (typeof value === 'object' && !Array.isArray(value)) {
|
|
18
|
-
return [toTitleCase(key), convertKeysToTitleCase(value, level + 1)];
|
|
19
|
-
}
|
|
20
|
-
if (Array.isArray(value)) {
|
|
21
|
-
return [toTitleCase(key), value];
|
|
22
|
-
}
|
|
23
|
-
return [toTitleCase(key), value];
|
|
24
|
-
}));
|
|
25
|
-
}
|
|
26
|
-
exports.convertKeysToTitleCase = convertKeysToTitleCase;
|
|
27
|
-
function formatOrderedProduct(product, order_id, unique_event_id) {
|
|
28
|
-
const event_id = unique_event_id ?? order_id;
|
|
29
|
-
const unique_product_id = product.product_id || product.sku || product?.id;
|
|
30
|
-
const unique_id = event_id && unique_product_id ? `${event_id}_${unique_product_id}` : undefined;
|
|
31
|
-
const { name, quantity, sku, price, url, image_url, category, product_id, id, ...otherProperties } = product;
|
|
32
|
-
const productProperties = {
|
|
33
|
-
OrderId: order_id,
|
|
34
|
-
ProductId: product_id ?? id,
|
|
35
|
-
SKU: sku,
|
|
36
|
-
ProductName: name,
|
|
37
|
-
Quantity: quantity,
|
|
38
|
-
Categories: category ? [category] : [],
|
|
39
|
-
ProductURL: url,
|
|
40
|
-
ImageURL: image_url,
|
|
41
|
-
...convertKeysToTitleCase(otherProperties)
|
|
42
|
-
};
|
|
43
|
-
return { unique_id, productProperties };
|
|
44
|
-
}
|
|
45
|
-
exports.formatOrderedProduct = formatOrderedProduct;
|
|
46
|
-
function formatProductItems(product) {
|
|
47
|
-
const { sku, name, quantity, price, category, url, image_url, id, product_id, ...otherProperties } = product;
|
|
48
|
-
return {
|
|
49
|
-
ProductId: product_id ?? id,
|
|
50
|
-
SKU: sku,
|
|
51
|
-
ProductName: name,
|
|
52
|
-
Quantity: quantity,
|
|
53
|
-
ItemPrice: price,
|
|
54
|
-
RowTotal: price,
|
|
55
|
-
Categories: category ? [category] : [],
|
|
56
|
-
ProductURL: url,
|
|
57
|
-
ImageURL: image_url,
|
|
58
|
-
...convertKeysToTitleCase(otherProperties)
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
exports.formatProductItems = formatProductItems;
|
|
62
|
-
//# sourceMappingURL=formatters.js.map
|