@segment/action-destinations 3.285.0 → 3.287.0
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/README.md +1 -2
- package/dist/destinations/amazon-amc/index.js +10 -2
- package/dist/destinations/amazon-amc/index.js.map +1 -1
- package/dist/destinations/dynamic-yield-audiences/index.js +24 -29
- package/dist/destinations/dynamic-yield-audiences/index.js.map +1 -1
- package/dist/destinations/dynamic-yield-audiences/syncAudience/index.js +34 -33
- package/dist/destinations/dynamic-yield-audiences/syncAudience/index.js.map +1 -1
- package/dist/destinations/mixpanel/incrementProperties/__test__/__snapshots__/snapshot.test.js.snap +18 -0
- package/dist/destinations/taboola-actions/syncAudience/index.js +7 -3
- package/dist/destinations/taboola-actions/syncAudience/index.js.map +1 -1
- package/dist/destinations/yahoo-audiences/index.js +2 -1
- package/dist/destinations/yahoo-audiences/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/destinations/amazon-ads/generated-types.d.ts +0 -12
- 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 -237
- package/dist/destinations/amazon-ads/index.js.map +0 -1
- package/dist/destinations/amazon-ads/syncAudiences/generated-types.d.ts +0 -15
- 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 -182
- package/dist/destinations/amazon-ads/syncAudiences/index.js.map +0 -1
- package/dist/destinations/amazon-ads/types.d.ts +0 -47
- 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 -37
- package/dist/destinations/amazon-ads/utils.js +0 -25
- package/dist/destinations/amazon-ads/utils.js.map +0 -1
- package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.d.ts +0 -1
- package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.js +0 -184
- package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.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/removeProfileToList/generated-types.d.ts +0 -4
- package/dist/destinations/klaviyo/removeProfileToList/generated-types.js +0 -3
- package/dist/destinations/klaviyo/removeProfileToList/generated-types.js.map +0 -1
- package/dist/destinations/klaviyo/removeProfileToList/index.d.ts +0 -5
- package/dist/destinations/klaviyo/removeProfileToList/index.js +0 -43
- package/dist/destinations/klaviyo/removeProfileToList/index.js.map +0 -1
- package/dist/destinations/mixpanel/utils.d.ts +0 -13
- package/dist/destinations/mixpanel/utils.js +0 -117
- package/dist/destinations/mixpanel/utils.js.map +0 -1
- package/dist/destinations/movable-ink/categoryView/generated-types.d.ts +0 -22
- package/dist/destinations/movable-ink/categoryView/generated-types.js +0 -3
- package/dist/destinations/movable-ink/categoryView/generated-types.js.map +0 -1
- package/dist/destinations/movable-ink/categoryView/index.d.ts +0 -5
- package/dist/destinations/movable-ink/categoryView/index.js +0 -43
- package/dist/destinations/movable-ink/categoryView/index.js.map +0 -1
- package/dist/destinations/movable-ink/conversion/generated-types.d.ts +0 -20
- package/dist/destinations/movable-ink/conversion/generated-types.js +0 -3
- package/dist/destinations/movable-ink/conversion/generated-types.js.map +0 -1
- package/dist/destinations/movable-ink/conversion/index.d.ts +0 -5
- package/dist/destinations/movable-ink/conversion/index.js +0 -45
- package/dist/destinations/movable-ink/conversion/index.js.map +0 -1
- package/dist/destinations/movable-ink/fields.d.ts +0 -21
- package/dist/destinations/movable-ink/fields.js +0 -236
- package/dist/destinations/movable-ink/fields.js.map +0 -1
- package/dist/destinations/movable-ink/identify/generated-types.d.ts +0 -7
- package/dist/destinations/movable-ink/identify/generated-types.js +0 -3
- package/dist/destinations/movable-ink/identify/generated-types.js.map +0 -1
- package/dist/destinations/movable-ink/identify/index.d.ts +0 -5
- package/dist/destinations/movable-ink/identify/index.js +0 -32
- package/dist/destinations/movable-ink/identify/index.js.map +0 -1
- package/dist/destinations/movable-ink/productAdded/generated-types.d.ts +0 -22
- package/dist/destinations/movable-ink/productAdded/generated-types.js +0 -3
- package/dist/destinations/movable-ink/productAdded/generated-types.js.map +0 -1
- package/dist/destinations/movable-ink/productAdded/index.d.ts +0 -5
- package/dist/destinations/movable-ink/productAdded/index.js +0 -43
- package/dist/destinations/movable-ink/productAdded/index.js.map +0 -1
- package/dist/destinations/movable-ink/productViewed/generated-types.d.ts +0 -21
- package/dist/destinations/movable-ink/productViewed/generated-types.js +0 -3
- package/dist/destinations/movable-ink/productViewed/generated-types.js.map +0 -1
- package/dist/destinations/movable-ink/productViewed/index.d.ts +0 -5
- package/dist/destinations/movable-ink/productViewed/index.js +0 -43
- package/dist/destinations/movable-ink/productViewed/index.js.map +0 -1
- package/dist/destinations/movable-ink/search/generated-types.d.ts +0 -12
- package/dist/destinations/movable-ink/search/generated-types.js +0 -3
- package/dist/destinations/movable-ink/search/generated-types.js.map +0 -1
- package/dist/destinations/movable-ink/search/index.d.ts +0 -5
- package/dist/destinations/movable-ink/search/index.js +0 -43
- package/dist/destinations/movable-ink/search/index.js.map +0 -1
- package/dist/destinations/movable-ink/sendCustomEvent/generated-types.d.ts +0 -25
- package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js +0 -3
- package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js.map +0 -1
- package/dist/destinations/movable-ink/sendCustomEvent/index.d.ts +0 -5
- package/dist/destinations/movable-ink/sendCustomEvent/index.js +0 -48
- package/dist/destinations/movable-ink/sendCustomEvent/index.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/dist/destinations/trackey/group.types.d.ts +0 -11
- package/dist/destinations/trackey/group.types.js +0 -3
- package/dist/destinations/trackey/group.types.js.map +0 -1
- package/dist/destinations/trackey/identify.types.d.ts +0 -11
- package/dist/destinations/trackey/identify.types.js +0 -3
- package/dist/destinations/trackey/identify.types.js.map +0 -1
- package/dist/destinations/trackey/track.types.d.ts +0 -12
- package/dist/destinations/trackey/track.types.js +0 -3
- package/dist/destinations/trackey/track.types.js.map +0 -1
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const rsp_properties_1 = require("../rsp-properties");
|
|
4
|
-
const rsp_operations_1 = require("../rsp-operations");
|
|
5
|
-
const action = {
|
|
6
|
-
title: 'Async Merge Profile List Members',
|
|
7
|
-
description: 'Asynchronous Merge Profile List Members API',
|
|
8
|
-
fields: {
|
|
9
|
-
profileListName: {
|
|
10
|
-
label: 'List Name',
|
|
11
|
-
description: "Name of the profile extension table's parent profile list.",
|
|
12
|
-
type: 'string',
|
|
13
|
-
required: true
|
|
14
|
-
},
|
|
15
|
-
userData: rsp_properties_1.userData,
|
|
16
|
-
mapTemplateName: {
|
|
17
|
-
label: 'Map Template Name',
|
|
18
|
-
description: 'The Map Template in Responsys that can be used to map Field Names of the Profile List to Column Names.',
|
|
19
|
-
type: 'string',
|
|
20
|
-
default: ''
|
|
21
|
-
},
|
|
22
|
-
defaultPermissionStatus: {
|
|
23
|
-
label: 'Default Permission Status',
|
|
24
|
-
description: 'This value must be specified as either OPTIN or OPTOUT and would be applied to all of the records contained in the API call. If this value is not explicitly specified, then it is set to OPTOUT.',
|
|
25
|
-
type: 'string',
|
|
26
|
-
choices: [
|
|
27
|
-
{ label: 'Opt In', value: 'OPTIN' },
|
|
28
|
-
{ label: 'Opt Out', value: 'OPTOUT' }
|
|
29
|
-
],
|
|
30
|
-
default: 'OPTOUT'
|
|
31
|
-
},
|
|
32
|
-
htmlValue: {
|
|
33
|
-
label: 'Preferred Email Format',
|
|
34
|
-
description: "Value of incoming preferred email format data. For example, 'H' may represent a preference for HTML formatted email.",
|
|
35
|
-
type: 'string'
|
|
36
|
-
},
|
|
37
|
-
insertOnNoMatch: {
|
|
38
|
-
label: 'Insert On No Match',
|
|
39
|
-
description: 'Indicates what should be done for records where a match is not found.',
|
|
40
|
-
type: 'boolean',
|
|
41
|
-
default: true
|
|
42
|
-
},
|
|
43
|
-
matchColumnName1: {
|
|
44
|
-
label: 'First Column Match',
|
|
45
|
-
description: 'First match column for determining whether an insert or update should occur.',
|
|
46
|
-
type: 'string',
|
|
47
|
-
choices: [
|
|
48
|
-
{ label: 'RIID_', value: 'RIID_' },
|
|
49
|
-
{ label: 'CUSTOMER_ID_', value: 'CUSTOMER_ID_' },
|
|
50
|
-
{ label: 'EMAIL_ADDRESS_', value: 'EMAIL_ADDRESS_' },
|
|
51
|
-
{ label: 'MOBILE_NUMBER_', value: 'MOBILE_NUMBER_' },
|
|
52
|
-
{ label: 'EMAIL_MD5_HASH_', value: 'EMAIL_MD5_HASH_' },
|
|
53
|
-
{ label: 'EMAIL_SHA256_HASH_', value: 'EMAIL_SHA256_HASH_' }
|
|
54
|
-
]
|
|
55
|
-
},
|
|
56
|
-
matchColumnName2: {
|
|
57
|
-
label: 'Second Column Match',
|
|
58
|
-
description: 'Second match column for determining whether an insert or update should occur.',
|
|
59
|
-
type: 'string',
|
|
60
|
-
choices: [
|
|
61
|
-
{ label: 'RIID_', value: 'RIID_' },
|
|
62
|
-
{ label: 'CUSTOMER_ID_', value: 'CUSTOMER_ID_' },
|
|
63
|
-
{ label: 'EMAIL_ADDRESS_', value: 'EMAIL_ADDRESS_' },
|
|
64
|
-
{ label: 'MOBILE_NUMBER_', value: 'MOBILE_NUMBER_' },
|
|
65
|
-
{ label: 'EMAIL_MD5_HASH_', value: 'EMAIL_MD5_HASH_' },
|
|
66
|
-
{ label: 'EMAIL_SHA256_HASH_', value: 'EMAIL_SHA256_HASH_' }
|
|
67
|
-
]
|
|
68
|
-
},
|
|
69
|
-
matchOperator: {
|
|
70
|
-
label: 'Match Operator',
|
|
71
|
-
description: 'Operator to join match column names.',
|
|
72
|
-
type: 'string',
|
|
73
|
-
choices: [
|
|
74
|
-
{ label: 'None', value: 'NONE' },
|
|
75
|
-
{ label: 'And', value: 'AND' }
|
|
76
|
-
]
|
|
77
|
-
},
|
|
78
|
-
optinValue: {
|
|
79
|
-
label: 'Optin Value',
|
|
80
|
-
description: "Value of incoming opt-in status data that represents an opt-in status. For example, 'I' may represent an opt-in status.",
|
|
81
|
-
type: 'string'
|
|
82
|
-
},
|
|
83
|
-
optoutValue: {
|
|
84
|
-
label: 'Optout Value',
|
|
85
|
-
description: "Value of incoming opt-out status data that represents an optout status. For example, '0' may represent an opt-out status.",
|
|
86
|
-
type: 'string'
|
|
87
|
-
},
|
|
88
|
-
rejectRecordIfChannelEmpty: {
|
|
89
|
-
label: 'Reject Record If Channel Empty',
|
|
90
|
-
description: "String containing comma-separated channel codes that if specified will result in record rejection when the channel address field is null. Channel codes are 'E' (Email), 'M' (Mobile), 'P' (Postal Code). For example 'E,M' would indicate that a record that has a null for Email or Mobile Number value should be rejected. This parameter can also be set to null or to an empty string, which will cause the validation to not be performed for any channel, except if the matchColumnName1 parameter is set to EMAIL_ADDRESS_ or MOBILE_NUMBER_. When matchColumnName1 is set to EMAIL_ADDRESS_ or MOBILE_NUMBER_, then the null or empty string setting is effectively ignored for that channel.",
|
|
91
|
-
type: 'string'
|
|
92
|
-
},
|
|
93
|
-
textValue: {
|
|
94
|
-
label: 'Text Value',
|
|
95
|
-
description: "Value of incoming preferred email format data. For example, 'T' may represent a preference for Text formatted email.",
|
|
96
|
-
type: 'string'
|
|
97
|
-
},
|
|
98
|
-
updateOnMatch: {
|
|
99
|
-
label: 'Update On Match',
|
|
100
|
-
description: 'Controls how the existing record should be updated.',
|
|
101
|
-
type: 'string',
|
|
102
|
-
required: true,
|
|
103
|
-
choices: [
|
|
104
|
-
{ label: 'Replace All', value: 'REPLACE_ALL' },
|
|
105
|
-
{ label: 'No Update', value: 'NO_UPDATE' }
|
|
106
|
-
]
|
|
107
|
-
},
|
|
108
|
-
enable_batching: rsp_properties_1.enable_batching,
|
|
109
|
-
batch_size: rsp_properties_1.batch_size
|
|
110
|
-
},
|
|
111
|
-
perform: async (request, { settings, payload, auth }) => {
|
|
112
|
-
if (payload && payload.profileListName) {
|
|
113
|
-
const { profileListName, defaultPermissionStatus, htmlValue, insertOnNoMatch, matchColumnName1, matchColumnName2, matchOperator, optinValue, optoutValue, rejectRecordIfChannelEmpty, textValue, updateOnMatch, userData, mapTemplateName } = payload;
|
|
114
|
-
const baseUrl = (settings.baseUrl?.startsWith('https://') ? settings.baseUrl : `https://${settings.baseUrl}`)?.replace(/\/$/, '');
|
|
115
|
-
const endpoint = `${baseUrl}/rest/asyncApi/v1.3/lists/${profileListName}/members`;
|
|
116
|
-
const recordData = rsp_operations_1.buildRecordData(userData, mapTemplateName ?? '');
|
|
117
|
-
const requestBody = {
|
|
118
|
-
recordData: recordData,
|
|
119
|
-
mergeRule: {
|
|
120
|
-
defaultPermissionStatus,
|
|
121
|
-
htmlValue,
|
|
122
|
-
insertOnNoMatch,
|
|
123
|
-
matchColumnName1,
|
|
124
|
-
matchColumnName2,
|
|
125
|
-
matchOperator,
|
|
126
|
-
optinValue,
|
|
127
|
-
optoutValue,
|
|
128
|
-
rejectRecordIfChannelEmpty,
|
|
129
|
-
textValue,
|
|
130
|
-
updateOnMatch
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
const token = auth?.accessToken ?? '';
|
|
134
|
-
const response = request(endpoint, {
|
|
135
|
-
method: 'POST',
|
|
136
|
-
headers: {
|
|
137
|
-
Authorization: token,
|
|
138
|
-
'Content-Type': 'application/json'
|
|
139
|
-
},
|
|
140
|
-
body: JSON.stringify(requestBody)
|
|
141
|
-
});
|
|
142
|
-
return response;
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
performBatch: async (request, { settings, payload }) => {
|
|
146
|
-
const { profileListName, defaultPermissionStatus, htmlValue, insertOnNoMatch, matchColumnName1, matchColumnName2, matchOperator, optinValue, optoutValue, rejectRecordIfChannelEmpty, textValue, updateOnMatch, mapTemplateName } = payload[0];
|
|
147
|
-
const payloadData = payload.map((obj) => obj.userData);
|
|
148
|
-
const recordData = rsp_operations_1.buildRecordData(payloadData, mapTemplateName ?? '');
|
|
149
|
-
const requestBody = {
|
|
150
|
-
recordData: recordData,
|
|
151
|
-
mergeRule: {
|
|
152
|
-
defaultPermissionStatus,
|
|
153
|
-
htmlValue,
|
|
154
|
-
insertOnNoMatch,
|
|
155
|
-
matchColumnName1,
|
|
156
|
-
matchColumnName2,
|
|
157
|
-
matchOperator,
|
|
158
|
-
optinValue,
|
|
159
|
-
optoutValue,
|
|
160
|
-
rejectRecordIfChannelEmpty,
|
|
161
|
-
textValue,
|
|
162
|
-
updateOnMatch
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
const baseUrl = (settings.baseUrl?.startsWith('https://') ? settings.baseUrl : `https://${settings.baseUrl}`)?.replace(/\/$/, '');
|
|
166
|
-
const endpoint = `${baseUrl}/rest/asyncApi/v1.3/lists/${profileListName}/members`;
|
|
167
|
-
return await request(endpoint, {
|
|
168
|
-
method: 'POST',
|
|
169
|
-
body: JSON.stringify(requestBody)
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
exports.default = action;
|
|
174
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/responsys/asyncMergeProfileListMembers/index.ts"],"names":[],"mappings":";;AAGA,sDAAyE;AAGzE,sDAAmD;AAEnD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,kCAAkC;IACzC,WAAW,EAAE,6CAA6C;IAC1D,MAAM,EAAE;QACN,eAAe,EAAE;YACf,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,4DAA4D;YACzE,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,QAAQ,EAAE,yBAAQ;QAClB,eAAe,EAAE;YACf,KAAK,EAAE,mBAAmB;YAC1B,WAAW,EACT,wGAAwG;YAC1G,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE;SACZ;QACD,uBAAuB,EAAE;YACvB,KAAK,EAAE,2BAA2B;YAClC,WAAW,EACT,mMAAmM;YACrM,IAAI,EAAE,QAAQ;YACd,OAAO,E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
|
2
|
-
import { DynamicData, RecordData } from './types';
|
|
3
|
-
export declare const buildRecordData: (userData: DynamicData, mapTemplateName: string) => {
|
|
4
|
-
records: unknown[][];
|
|
5
|
-
fieldNames: string[];
|
|
6
|
-
mapTemplateName: string;
|
|
7
|
-
};
|
|
8
|
-
export declare const buildRequestBodyPET: (payload: Payload, recordData: RecordData) => {
|
|
9
|
-
recordData: RecordData;
|
|
10
|
-
insertOnNoMatch: boolean | undefined;
|
|
11
|
-
updateOnMatch: string;
|
|
12
|
-
matchColumnName1: string;
|
|
13
|
-
matchColumnName2: string;
|
|
14
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildRequestBodyPET = exports.buildRecordData = void 0;
|
|
4
|
-
const buildRecordData = (userData, mapTemplateName) => {
|
|
5
|
-
if (Array.isArray(userData)) {
|
|
6
|
-
const keysFromFirstObject = Object.keys(userData[0]);
|
|
7
|
-
return {
|
|
8
|
-
records: userData.map((record) => Object.values(record)),
|
|
9
|
-
fieldNames: keysFromFirstObject,
|
|
10
|
-
mapTemplateName: mapTemplateName || ''
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
const keysFromFirstObject = Object.keys(userData);
|
|
14
|
-
return {
|
|
15
|
-
records: [Object.values(userData)],
|
|
16
|
-
fieldNames: keysFromFirstObject,
|
|
17
|
-
mapTemplateName: mapTemplateName || ''
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
exports.buildRecordData = buildRecordData;
|
|
21
|
-
const buildRequestBodyPET = (payload, recordData) => {
|
|
22
|
-
const matchColumnName1 = payload.matchColumnName1 ? String(payload.matchColumnName1) : '';
|
|
23
|
-
const matchColumnName2 = payload.matchColumnName2 ? String(payload.matchColumnName2) : '';
|
|
24
|
-
return {
|
|
25
|
-
recordData: recordData,
|
|
26
|
-
insertOnNoMatch: payload.insertOnNoMatch,
|
|
27
|
-
updateOnMatch: payload.updateOnMatch,
|
|
28
|
-
matchColumnName1: matchColumnName1.replace(/_+$/, ''),
|
|
29
|
-
matchColumnName2: matchColumnName2.replace(/_+$/, '')
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
exports.buildRequestBodyPET = buildRequestBodyPET;
|
|
33
|
-
//# sourceMappingURL=rsp-operations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rsp-operations.js","sourceRoot":"","sources":["../../../src/destinations/responsys/rsp-operations.ts"],"names":[],"mappings":";;;AAGO,MAAM,eAAe,GAAG,CAAC,QAAqB,EAAE,eAAuB,EAAE,EAAE;IAEhF,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QAC3B,MAAM,mBAAmB,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;QACpD,OAAO;YACL,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACxD,UAAU,EAAE,mBAAmB;YAC/B,eAAe,EAAE,eAAe,IAAI,EAAE;SACvC,CAAA;KACF;IACD,MAAM,mBAAmB,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACjD,OAAO;QACL,OAAO,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAClC,UAAU,EAAE,mBAAmB;QAC/B,eAAe,EAAE,eAAe,IAAI,EAAE;KACvC,CAAA;AACH,CAAC,CAAA;AAhBY,QAAA,eAAe,mBAgB3B;AAUM,MAAM,mBAAmB,GAAG,CAAC,OAAgB,EAAE,UAAsB,EAAkB,EAAE;IAC9F,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IACzF,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IACzF,OAAO;QACL,UAAU,EAAE,UAAU;QACtB,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,gBAAgB,EAAE,gBAAgB,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;QACrD,gBAAgB,EAAE,gBAAgB,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;KACtD,CAAA;AACH,CAAC,CAAA;AAVY,QAAA,mBAAmB,uBAU/B"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.batch_size = exports.enable_batching = exports.userData = void 0;
|
|
4
|
-
exports.userData = {
|
|
5
|
-
label: 'Recepient Data',
|
|
6
|
-
description: 'Record data that represents Field Names and corresponding values for the recipient.',
|
|
7
|
-
type: 'object',
|
|
8
|
-
defaultObjectUI: 'keyvalue:only',
|
|
9
|
-
required: true,
|
|
10
|
-
default: { '@path': '$.' }
|
|
11
|
-
};
|
|
12
|
-
exports.enable_batching = {
|
|
13
|
-
label: 'Use Responsys Async API',
|
|
14
|
-
description: 'Once enabled, Segment will collect events into batches of 200 before sending to Responsys.',
|
|
15
|
-
type: 'boolean',
|
|
16
|
-
default: true,
|
|
17
|
-
unsafe_hidden: true
|
|
18
|
-
};
|
|
19
|
-
exports.batch_size = {
|
|
20
|
-
label: 'Batch Size',
|
|
21
|
-
description: 'Maximum number of events to include in each batch. Actual batch sizes may be lower.',
|
|
22
|
-
type: 'number',
|
|
23
|
-
required: false,
|
|
24
|
-
unsafe_hidden: true,
|
|
25
|
-
default: 200
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=rsp-properties.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rsp-properties.js","sourceRoot":"","sources":["../../../src/destinations/responsys/rsp-properties.ts"],"names":[],"mappings":";;;AAGa,QAAA,QAAQ,GAAe;IAClC,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,qFAAqF;IAClG,IAAI,EAAE,QAAQ;IACd,eAAe,EAAE,eAAe;IAChC,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;CAC3B,CAAA;AAEY,QAAA,eAAe,GAAe;IACzC,KAAK,EAAE,yBAAyB;IAChC,WAAW,EAAE,4FAA4F;IACzG,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,IAAI;IACb,aAAa,EAAE,IAAI;CACpB,CAAA;AAEY,QAAA,UAAU,GAAe;IACpC,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,qFAAqF;IAClG,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,KAAK;IACf,aAAa,EAAE,IAAI;IACnB,OAAO,EAAE,GAAG;CACb,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const capiV2tests: () => void;
|
|
@@ -1,381 +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
|
-
exports.capiV2tests = void 0;
|
|
7
|
-
const nock_1 = __importDefault(require("nock"));
|
|
8
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
9
|
-
const index_1 = __importDefault(require("../index"));
|
|
10
|
-
const testDestination = actions_core_1.createTestIntegration(index_1.default);
|
|
11
|
-
const timestamp = '2022-05-12T15:21:15.449Z';
|
|
12
|
-
const settings = {
|
|
13
|
-
snap_app_id: 'test123',
|
|
14
|
-
pixel_id: 'test123',
|
|
15
|
-
app_id: 'test123'
|
|
16
|
-
};
|
|
17
|
-
const accessToken = 'test123';
|
|
18
|
-
const refreshToken = 'test123';
|
|
19
|
-
const testEvent = actions_core_1.createTestEvent({
|
|
20
|
-
timestamp: timestamp,
|
|
21
|
-
messageId: 'test-message-rv4t40s898k',
|
|
22
|
-
event: 'PURCHASE',
|
|
23
|
-
type: 'track',
|
|
24
|
-
properties: {
|
|
25
|
-
email: 'test123@gmail.com',
|
|
26
|
-
phone: '+44 844 412 4653',
|
|
27
|
-
event_tag: 'back-to-school',
|
|
28
|
-
number_items: 10,
|
|
29
|
-
revenue: '15',
|
|
30
|
-
currency: 'USD',
|
|
31
|
-
level: 3
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
const conversionEventUrl = 'https://tr.snapchat.com/v2/conversion';
|
|
35
|
-
const features = {
|
|
36
|
-
['actions-snap-api-migration-test-capiv3']: false,
|
|
37
|
-
['actions-snap-api-migration-use-capiv3']: false
|
|
38
|
-
};
|
|
39
|
-
const capiV2tests = () => describe('CAPIv2 Implementation', () => {
|
|
40
|
-
it('should use products array over number_items, product_id and category fields', async () => {
|
|
41
|
-
nock_1.default(conversionEventUrl).post('').reply(200, {});
|
|
42
|
-
const event = actions_core_1.createTestEvent({
|
|
43
|
-
...testEvent,
|
|
44
|
-
properties: {
|
|
45
|
-
email: 'test123@gmail.com',
|
|
46
|
-
phone: '+44 844 412 4653',
|
|
47
|
-
event_tag: 'back-to-school',
|
|
48
|
-
number_items: 10,
|
|
49
|
-
price: '15',
|
|
50
|
-
currency: 'USD',
|
|
51
|
-
level: 3,
|
|
52
|
-
products: [
|
|
53
|
-
{ product_id: '123', category: 'games', brand: 'Hasbro' },
|
|
54
|
-
{ product_id: '456', category: 'games', brand: 'Mattel' }
|
|
55
|
-
]
|
|
56
|
-
},
|
|
57
|
-
context: {}
|
|
58
|
-
});
|
|
59
|
-
const responses = await testDestination.testAction('reportConversionEvent', {
|
|
60
|
-
event,
|
|
61
|
-
settings,
|
|
62
|
-
useDefaultMappings: true,
|
|
63
|
-
auth: {
|
|
64
|
-
accessToken,
|
|
65
|
-
refreshToken
|
|
66
|
-
},
|
|
67
|
-
features,
|
|
68
|
-
mapping: {
|
|
69
|
-
event_type: 'PURCHASE',
|
|
70
|
-
event_conversion_type: 'WEB'
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
expect(responses).not.toBeNull();
|
|
74
|
-
expect(responses[0].status).toBe(200);
|
|
75
|
-
expect(responses[0].options.body).toMatchInlineSnapshot(`"{\\"integration\\":\\"segment\\",\\"event_type\\":\\"PURCHASE\\",\\"event_conversion_type\\":\\"WEB\\",\\"timestamp\\":1652368875449,\\"hashed_email\\":\\"cc779c04191c2e736d89e45c11339c8382832bcaf70383f7df94e3d08ba7a6d9\\",\\"hashed_phone_number\\":\\"dc008fda46e2e64002cf2f82a4906236282d431c4f75e5b60bfe79fc48546383\\",\\"item_category\\":\\"games;games\\",\\"brands\\":[\\"Hasbro\\",\\"Mattel\\"],\\"item_ids\\":\\"123;456\\",\\"currency\\":\\"USD\\",\\"pixel_id\\":\\"test123\\"}"`);
|
|
76
|
-
});
|
|
77
|
-
it('should handle a basic event', async () => {
|
|
78
|
-
nock_1.default(conversionEventUrl).post('').reply(200, {});
|
|
79
|
-
const event = actions_core_1.createTestEvent(testEvent);
|
|
80
|
-
const responses = await testDestination.testAction('reportConversionEvent', {
|
|
81
|
-
event,
|
|
82
|
-
settings,
|
|
83
|
-
useDefaultMappings: true,
|
|
84
|
-
auth: {
|
|
85
|
-
accessToken,
|
|
86
|
-
refreshToken
|
|
87
|
-
},
|
|
88
|
-
features,
|
|
89
|
-
mapping: {
|
|
90
|
-
event_type: 'PURCHASE',
|
|
91
|
-
event_conversion_type: 'WEB'
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
expect(responses).not.toBeNull();
|
|
95
|
-
expect(responses[0].status).toBe(200);
|
|
96
|
-
expect(responses[0].options.body).toMatchInlineSnapshot(`"{\\"integration\\":\\"segment\\",\\"event_type\\":\\"PURCHASE\\",\\"event_conversion_type\\":\\"WEB\\",\\"timestamp\\":1652368875449,\\"hashed_email\\":\\"cc779c04191c2e736d89e45c11339c8382832bcaf70383f7df94e3d08ba7a6d9\\",\\"hashed_phone_number\\":\\"dc008fda46e2e64002cf2f82a4906236282d431c4f75e5b60bfe79fc48546383\\",\\"user_agent\\":\\"Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1\\",\\"hashed_ip_address\\":\\"838c4c2573848f58e74332341a7ca6bc5cd86a8aec7d644137d53b4d597f10f5\\",\\"price\\":15,\\"currency\\":\\"USD\\",\\"page_url\\":\\"https://segment.com/academy/\\",\\"pixel_id\\":\\"test123\\"}"`);
|
|
97
|
-
});
|
|
98
|
-
it('should fail web event without pixel_id', async () => {
|
|
99
|
-
nock_1.default(conversionEventUrl).post('').reply(400, {});
|
|
100
|
-
const event = actions_core_1.createTestEvent(testEvent);
|
|
101
|
-
await expect(testDestination.testAction('reportConversionEvent', {
|
|
102
|
-
event,
|
|
103
|
-
settings: {
|
|
104
|
-
app_id: 'test123'
|
|
105
|
-
},
|
|
106
|
-
useDefaultMappings: true,
|
|
107
|
-
auth: {
|
|
108
|
-
accessToken,
|
|
109
|
-
refreshToken
|
|
110
|
-
},
|
|
111
|
-
features,
|
|
112
|
-
mapping: {
|
|
113
|
-
event_type: 'PURCHASE',
|
|
114
|
-
event_conversion_type: 'WEB'
|
|
115
|
-
}
|
|
116
|
-
})).rejects.toThrowError('If event conversion type is "WEB" then Pixel ID must be defined');
|
|
117
|
-
});
|
|
118
|
-
it('should fail web event without snap_app_id', async () => {
|
|
119
|
-
nock_1.default(conversionEventUrl).post('').reply(400, {});
|
|
120
|
-
const event = actions_core_1.createTestEvent(testEvent);
|
|
121
|
-
await expect(testDestination.testAction('reportConversionEvent', {
|
|
122
|
-
event,
|
|
123
|
-
settings: {
|
|
124
|
-
pixel_id: 'test123',
|
|
125
|
-
app_id: 'test123'
|
|
126
|
-
},
|
|
127
|
-
useDefaultMappings: true,
|
|
128
|
-
auth: {
|
|
129
|
-
accessToken,
|
|
130
|
-
refreshToken
|
|
131
|
-
},
|
|
132
|
-
features,
|
|
133
|
-
mapping: {
|
|
134
|
-
event_type: 'PURCHASE',
|
|
135
|
-
event_conversion_type: 'MOBILE_APP'
|
|
136
|
-
}
|
|
137
|
-
})).rejects.toThrowError('If event conversion type is "MOBILE_APP" then Snap App ID and App ID must be defined');
|
|
138
|
-
});
|
|
139
|
-
it('should handle an offline event conversion type', async () => {
|
|
140
|
-
nock_1.default(conversionEventUrl).post('').reply(200, {});
|
|
141
|
-
const event = actions_core_1.createTestEvent(testEvent);
|
|
142
|
-
const responses = await testDestination.testAction('reportConversionEvent', {
|
|
143
|
-
event,
|
|
144
|
-
settings,
|
|
145
|
-
useDefaultMappings: true,
|
|
146
|
-
auth: {
|
|
147
|
-
accessToken,
|
|
148
|
-
refreshToken
|
|
149
|
-
},
|
|
150
|
-
features,
|
|
151
|
-
mapping: {
|
|
152
|
-
event_type: 'SAVE',
|
|
153
|
-
event_conversion_type: 'OFFLINE'
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
expect(responses).not.toBeNull();
|
|
157
|
-
expect(responses[0].status).toBe(200);
|
|
158
|
-
expect(responses[0].options.body).toMatchInlineSnapshot(`"{\\"integration\\":\\"segment\\",\\"event_type\\":\\"SAVE\\",\\"event_conversion_type\\":\\"OFFLINE\\",\\"timestamp\\":1652368875449,\\"hashed_email\\":\\"cc779c04191c2e736d89e45c11339c8382832bcaf70383f7df94e3d08ba7a6d9\\",\\"hashed_phone_number\\":\\"dc008fda46e2e64002cf2f82a4906236282d431c4f75e5b60bfe79fc48546383\\",\\"user_agent\\":\\"Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1\\",\\"hashed_ip_address\\":\\"838c4c2573848f58e74332341a7ca6bc5cd86a8aec7d644137d53b4d597f10f5\\",\\"price\\":15,\\"currency\\":\\"USD\\",\\"page_url\\":\\"https://segment.com/academy/\\",\\"pixel_id\\":\\"test123\\"}"`);
|
|
159
|
-
});
|
|
160
|
-
it('should handle a mobile app event conversion type', async () => {
|
|
161
|
-
nock_1.default(conversionEventUrl).post('').reply(200, {});
|
|
162
|
-
const event = actions_core_1.createTestEvent(testEvent);
|
|
163
|
-
const responses = await testDestination.testAction('reportConversionEvent', {
|
|
164
|
-
event,
|
|
165
|
-
settings: {
|
|
166
|
-
snap_app_id: '123',
|
|
167
|
-
app_id: '123'
|
|
168
|
-
},
|
|
169
|
-
useDefaultMappings: true,
|
|
170
|
-
auth: {
|
|
171
|
-
accessToken,
|
|
172
|
-
refreshToken
|
|
173
|
-
},
|
|
174
|
-
features,
|
|
175
|
-
mapping: {
|
|
176
|
-
event_type: 'SAVE',
|
|
177
|
-
event_conversion_type: 'MOBILE_APP'
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
expect(responses).not.toBeNull();
|
|
181
|
-
expect(responses[0].status).toBe(200);
|
|
182
|
-
expect(responses[0].options.body).toMatchInlineSnapshot(`"{\\"integration\\":\\"segment\\",\\"event_type\\":\\"SAVE\\",\\"event_conversion_type\\":\\"MOBILE_APP\\",\\"timestamp\\":1652368875449,\\"hashed_email\\":\\"cc779c04191c2e736d89e45c11339c8382832bcaf70383f7df94e3d08ba7a6d9\\",\\"hashed_phone_number\\":\\"dc008fda46e2e64002cf2f82a4906236282d431c4f75e5b60bfe79fc48546383\\",\\"user_agent\\":\\"Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1\\",\\"hashed_ip_address\\":\\"838c4c2573848f58e74332341a7ca6bc5cd86a8aec7d644137d53b4d597f10f5\\",\\"price\\":15,\\"currency\\":\\"USD\\",\\"page_url\\":\\"https://segment.com/academy/\\",\\"snap_app_id\\":\\"123\\",\\"app_id\\":\\"123\\"}"`);
|
|
183
|
-
});
|
|
184
|
-
it('should fail invalid currency', async () => {
|
|
185
|
-
nock_1.default(conversionEventUrl).post('').reply(400, {});
|
|
186
|
-
const event = actions_core_1.createTestEvent({
|
|
187
|
-
...testEvent,
|
|
188
|
-
properties: {
|
|
189
|
-
currency: 'Galleon'
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
await expect(testDestination.testAction('reportConversionEvent', {
|
|
193
|
-
event,
|
|
194
|
-
settings,
|
|
195
|
-
useDefaultMappings: true,
|
|
196
|
-
auth: {
|
|
197
|
-
accessToken,
|
|
198
|
-
refreshToken
|
|
199
|
-
},
|
|
200
|
-
features,
|
|
201
|
-
mapping: {
|
|
202
|
-
event_type: 'PURCHASE',
|
|
203
|
-
event_conversion_type: 'WEB'
|
|
204
|
-
}
|
|
205
|
-
})).rejects.toThrowError('Galleon is not a valid currency code.');
|
|
206
|
-
});
|
|
207
|
-
it('should fail missing event conversion type', async () => {
|
|
208
|
-
nock_1.default(conversionEventUrl).post('').reply(400, {});
|
|
209
|
-
const event = actions_core_1.createTestEvent(testEvent);
|
|
210
|
-
await expect(testDestination.testAction('reportConversionEvent', {
|
|
211
|
-
event,
|
|
212
|
-
settings,
|
|
213
|
-
useDefaultMappings: true,
|
|
214
|
-
auth: {
|
|
215
|
-
accessToken,
|
|
216
|
-
refreshToken
|
|
217
|
-
},
|
|
218
|
-
features,
|
|
219
|
-
mapping: {
|
|
220
|
-
event_type: 'PURCHASE'
|
|
221
|
-
}
|
|
222
|
-
})).rejects.toThrowError("The root value is missing the required field 'event_conversion_type'.");
|
|
223
|
-
});
|
|
224
|
-
it('should handle a custom event', async () => {
|
|
225
|
-
nock_1.default(conversionEventUrl).post('').reply(200, {});
|
|
226
|
-
const event = actions_core_1.createTestEvent({
|
|
227
|
-
...testEvent,
|
|
228
|
-
event: 'CUSTOM_EVENT_5'
|
|
229
|
-
});
|
|
230
|
-
const responses = await testDestination.testAction('reportConversionEvent', {
|
|
231
|
-
event,
|
|
232
|
-
settings: {
|
|
233
|
-
snap_app_id: '123',
|
|
234
|
-
app_id: '123'
|
|
235
|
-
},
|
|
236
|
-
useDefaultMappings: true,
|
|
237
|
-
auth: {
|
|
238
|
-
accessToken,
|
|
239
|
-
refreshToken
|
|
240
|
-
},
|
|
241
|
-
features,
|
|
242
|
-
mapping: {
|
|
243
|
-
event_type: { '@path': '$.event' },
|
|
244
|
-
event_conversion_type: 'MOBILE_APP'
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
expect(responses).not.toBeNull();
|
|
248
|
-
expect(responses[0].status).toBe(200);
|
|
249
|
-
expect(responses[0].options.body).toMatchInlineSnapshot(`"{\\"integration\\":\\"segment\\",\\"event_type\\":\\"CUSTOM_EVENT_5\\",\\"event_conversion_type\\":\\"MOBILE_APP\\",\\"timestamp\\":1652368875449,\\"hashed_email\\":\\"cc779c04191c2e736d89e45c11339c8382832bcaf70383f7df94e3d08ba7a6d9\\",\\"hashed_phone_number\\":\\"dc008fda46e2e64002cf2f82a4906236282d431c4f75e5b60bfe79fc48546383\\",\\"user_agent\\":\\"Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1\\",\\"hashed_ip_address\\":\\"838c4c2573848f58e74332341a7ca6bc5cd86a8aec7d644137d53b4d597f10f5\\",\\"price\\":15,\\"currency\\":\\"USD\\",\\"page_url\\":\\"https://segment.com/academy/\\",\\"snap_app_id\\":\\"123\\",\\"app_id\\":\\"123\\"}"`);
|
|
250
|
-
});
|
|
251
|
-
it('should fail event missing all Snap identifiers', async () => {
|
|
252
|
-
const event = actions_core_1.createTestEvent({
|
|
253
|
-
...testEvent,
|
|
254
|
-
properties: {},
|
|
255
|
-
context: {}
|
|
256
|
-
});
|
|
257
|
-
await expect(testDestination.testAction('reportConversionEvent', {
|
|
258
|
-
event,
|
|
259
|
-
settings,
|
|
260
|
-
useDefaultMappings: true,
|
|
261
|
-
auth: {
|
|
262
|
-
accessToken,
|
|
263
|
-
refreshToken
|
|
264
|
-
},
|
|
265
|
-
features,
|
|
266
|
-
mapping: {
|
|
267
|
-
event_type: 'PURCHASE',
|
|
268
|
-
event_conversion_type: 'WEB'
|
|
269
|
-
}
|
|
270
|
-
})).rejects.toThrowError('Payload must contain values for Email or Phone Number or Mobile Ad Identifier or both IP Address and User Agent fields');
|
|
271
|
-
});
|
|
272
|
-
it('should handle event with email as only Snap identifier', async () => {
|
|
273
|
-
nock_1.default(conversionEventUrl).post('').reply(200, {});
|
|
274
|
-
const event = actions_core_1.createTestEvent({
|
|
275
|
-
...testEvent,
|
|
276
|
-
properties: {
|
|
277
|
-
email: 'test123@gmail.com'
|
|
278
|
-
},
|
|
279
|
-
context: {}
|
|
280
|
-
});
|
|
281
|
-
const responses = await testDestination.testAction('reportConversionEvent', {
|
|
282
|
-
event,
|
|
283
|
-
settings,
|
|
284
|
-
useDefaultMappings: true,
|
|
285
|
-
auth: {
|
|
286
|
-
accessToken,
|
|
287
|
-
refreshToken
|
|
288
|
-
},
|
|
289
|
-
features,
|
|
290
|
-
mapping: {
|
|
291
|
-
event_type: 'PURCHASE',
|
|
292
|
-
event_conversion_type: 'WEB'
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
expect(responses).not.toBeNull();
|
|
296
|
-
expect(responses[0].status).toBe(200);
|
|
297
|
-
expect(responses[0].options.body).toMatchInlineSnapshot(`"{\\"integration\\":\\"segment\\",\\"event_type\\":\\"PURCHASE\\",\\"event_conversion_type\\":\\"WEB\\",\\"timestamp\\":1652368875449,\\"hashed_email\\":\\"cc779c04191c2e736d89e45c11339c8382832bcaf70383f7df94e3d08ba7a6d9\\",\\"pixel_id\\":\\"test123\\"}"`);
|
|
298
|
-
});
|
|
299
|
-
it('should handle event with phone as only Snap identifier', async () => {
|
|
300
|
-
nock_1.default(conversionEventUrl).post('').reply(200, {});
|
|
301
|
-
const event = actions_core_1.createTestEvent({
|
|
302
|
-
...testEvent,
|
|
303
|
-
properties: {
|
|
304
|
-
phone: '+44 844 412 4653'
|
|
305
|
-
},
|
|
306
|
-
context: {}
|
|
307
|
-
});
|
|
308
|
-
const responses = await testDestination.testAction('reportConversionEvent', {
|
|
309
|
-
event,
|
|
310
|
-
settings,
|
|
311
|
-
useDefaultMappings: true,
|
|
312
|
-
auth: {
|
|
313
|
-
accessToken,
|
|
314
|
-
refreshToken
|
|
315
|
-
},
|
|
316
|
-
features,
|
|
317
|
-
mapping: {
|
|
318
|
-
event_type: 'PURCHASE',
|
|
319
|
-
event_conversion_type: 'WEB'
|
|
320
|
-
}
|
|
321
|
-
});
|
|
322
|
-
expect(responses).not.toBeNull();
|
|
323
|
-
expect(responses[0].status).toBe(200);
|
|
324
|
-
expect(responses[0].options.body).toMatchInlineSnapshot(`"{\\"integration\\":\\"segment\\",\\"event_type\\":\\"PURCHASE\\",\\"event_conversion_type\\":\\"WEB\\",\\"timestamp\\":1652368875449,\\"hashed_phone_number\\":\\"dc008fda46e2e64002cf2f82a4906236282d431c4f75e5b60bfe79fc48546383\\",\\"pixel_id\\":\\"test123\\"}"`);
|
|
325
|
-
});
|
|
326
|
-
it('should handle event with advertising_id as only Snap identifier', async () => {
|
|
327
|
-
nock_1.default(conversionEventUrl).post('').reply(200, {});
|
|
328
|
-
const event = actions_core_1.createTestEvent({
|
|
329
|
-
...testEvent,
|
|
330
|
-
properties: {},
|
|
331
|
-
context: {
|
|
332
|
-
device: {
|
|
333
|
-
advertisingId: '87a7def4-b6e9-4bf7-91b6-66372842007a'
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
});
|
|
337
|
-
const responses = await testDestination.testAction('reportConversionEvent', {
|
|
338
|
-
event,
|
|
339
|
-
settings,
|
|
340
|
-
useDefaultMappings: true,
|
|
341
|
-
auth: {
|
|
342
|
-
accessToken,
|
|
343
|
-
refreshToken
|
|
344
|
-
},
|
|
345
|
-
features,
|
|
346
|
-
mapping: {
|
|
347
|
-
event_type: 'PURCHASE',
|
|
348
|
-
event_conversion_type: 'WEB'
|
|
349
|
-
}
|
|
350
|
-
});
|
|
351
|
-
expect(responses).not.toBeNull();
|
|
352
|
-
expect(responses[0].status).toBe(200);
|
|
353
|
-
expect(responses[0].options.body).toMatchInlineSnapshot(`"{\\"integration\\":\\"segment\\",\\"event_type\\":\\"PURCHASE\\",\\"event_conversion_type\\":\\"WEB\\",\\"timestamp\\":1652368875449,\\"hashed_mobile_ad_id\\":\\"5af103f270fdc673b5e121ea929d1e47b2cee679e2059226a23c4cba37f8c9a9\\",\\"pixel_id\\":\\"test123\\"}"`);
|
|
354
|
-
});
|
|
355
|
-
it('should handle event with ip and user_agent as only Snap identifiers', async () => {
|
|
356
|
-
nock_1.default(conversionEventUrl).post('').reply(200, {});
|
|
357
|
-
const event = actions_core_1.createTestEvent({
|
|
358
|
-
...testEvent,
|
|
359
|
-
properties: {}
|
|
360
|
-
});
|
|
361
|
-
const responses = await testDestination.testAction('reportConversionEvent', {
|
|
362
|
-
event,
|
|
363
|
-
settings,
|
|
364
|
-
useDefaultMappings: true,
|
|
365
|
-
auth: {
|
|
366
|
-
accessToken,
|
|
367
|
-
refreshToken
|
|
368
|
-
},
|
|
369
|
-
features,
|
|
370
|
-
mapping: {
|
|
371
|
-
event_type: 'PURCHASE',
|
|
372
|
-
event_conversion_type: 'WEB'
|
|
373
|
-
}
|
|
374
|
-
});
|
|
375
|
-
expect(responses).not.toBeNull();
|
|
376
|
-
expect(responses[0].status).toBe(200);
|
|
377
|
-
expect(responses[0].options.body).toMatchInlineSnapshot(`"{\\"integration\\":\\"segment\\",\\"event_type\\":\\"PURCHASE\\",\\"event_conversion_type\\":\\"WEB\\",\\"timestamp\\":1652368875449,\\"user_agent\\":\\"Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1\\",\\"hashed_ip_address\\":\\"838c4c2573848f58e74332341a7ca6bc5cd86a8aec7d644137d53b4d597f10f5\\",\\"page_url\\":\\"https://segment.com/academy/\\",\\"pixel_id\\":\\"test123\\"}"`);
|
|
378
|
-
});
|
|
379
|
-
});
|
|
380
|
-
exports.capiV2tests = capiV2tests;
|
|
381
|
-
//# sourceMappingURL=capiV2tests.js.map
|