@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.
Files changed (148) hide show
  1. package/README.md +1 -2
  2. package/dist/destinations/amazon-amc/index.js +10 -2
  3. package/dist/destinations/amazon-amc/index.js.map +1 -1
  4. package/dist/destinations/dynamic-yield-audiences/index.js +24 -29
  5. package/dist/destinations/dynamic-yield-audiences/index.js.map +1 -1
  6. package/dist/destinations/dynamic-yield-audiences/syncAudience/index.js +34 -33
  7. package/dist/destinations/dynamic-yield-audiences/syncAudience/index.js.map +1 -1
  8. package/dist/destinations/mixpanel/incrementProperties/__test__/__snapshots__/snapshot.test.js.snap +18 -0
  9. package/dist/destinations/taboola-actions/syncAudience/index.js +7 -3
  10. package/dist/destinations/taboola-actions/syncAudience/index.js.map +1 -1
  11. package/dist/destinations/yahoo-audiences/index.js +2 -1
  12. package/dist/destinations/yahoo-audiences/index.js.map +1 -1
  13. package/package.json +4 -4
  14. package/dist/destinations/amazon-ads/generated-types.d.ts +0 -12
  15. package/dist/destinations/amazon-ads/generated-types.js +0 -3
  16. package/dist/destinations/amazon-ads/generated-types.js.map +0 -1
  17. package/dist/destinations/amazon-ads/index.d.ts +0 -4
  18. package/dist/destinations/amazon-ads/index.js +0 -237
  19. package/dist/destinations/amazon-ads/index.js.map +0 -1
  20. package/dist/destinations/amazon-ads/syncAudiences/generated-types.d.ts +0 -15
  21. package/dist/destinations/amazon-ads/syncAudiences/generated-types.js +0 -3
  22. package/dist/destinations/amazon-ads/syncAudiences/generated-types.js.map +0 -1
  23. package/dist/destinations/amazon-ads/syncAudiences/index.d.ts +0 -5
  24. package/dist/destinations/amazon-ads/syncAudiences/index.js +0 -182
  25. package/dist/destinations/amazon-ads/syncAudiences/index.js.map +0 -1
  26. package/dist/destinations/amazon-ads/types.d.ts +0 -47
  27. package/dist/destinations/amazon-ads/types.js +0 -11
  28. package/dist/destinations/amazon-ads/types.js.map +0 -1
  29. package/dist/destinations/amazon-ads/utils.d.ts +0 -37
  30. package/dist/destinations/amazon-ads/utils.js +0 -25
  31. package/dist/destinations/amazon-ads/utils.js.map +0 -1
  32. package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.d.ts +0 -1
  33. package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.js +0 -184
  34. package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.js.map +0 -1
  35. package/dist/destinations/contentstack/constants.d.ts +0 -3
  36. package/dist/destinations/contentstack/constants.js +0 -7
  37. package/dist/destinations/contentstack/constants.js.map +0 -1
  38. package/dist/destinations/dynamic-yield-audiences/syncAudience/types.d.ts +0 -22
  39. package/dist/destinations/dynamic-yield-audiences/syncAudience/types.js +0 -3
  40. package/dist/destinations/dynamic-yield-audiences/syncAudience/types.js.map +0 -1
  41. package/dist/destinations/dynamic-yield-audiences/types.d.ts +0 -8
  42. package/dist/destinations/dynamic-yield-audiences/types.js +0 -12
  43. package/dist/destinations/dynamic-yield-audiences/types.js.map +0 -1
  44. package/dist/destinations/engage/sendgrid/Profile.d.ts +0 -6
  45. package/dist/destinations/engage/sendgrid/Profile.js +0 -3
  46. package/dist/destinations/engage/sendgrid/Profile.js.map +0 -1
  47. package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.d.ts +0 -21
  48. package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js +0 -174
  49. package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js.map +0 -1
  50. package/dist/destinations/klaviyo/removeProfileToList/generated-types.d.ts +0 -4
  51. package/dist/destinations/klaviyo/removeProfileToList/generated-types.js +0 -3
  52. package/dist/destinations/klaviyo/removeProfileToList/generated-types.js.map +0 -1
  53. package/dist/destinations/klaviyo/removeProfileToList/index.d.ts +0 -5
  54. package/dist/destinations/klaviyo/removeProfileToList/index.js +0 -43
  55. package/dist/destinations/klaviyo/removeProfileToList/index.js.map +0 -1
  56. package/dist/destinations/mixpanel/utils.d.ts +0 -13
  57. package/dist/destinations/mixpanel/utils.js +0 -117
  58. package/dist/destinations/mixpanel/utils.js.map +0 -1
  59. package/dist/destinations/movable-ink/categoryView/generated-types.d.ts +0 -22
  60. package/dist/destinations/movable-ink/categoryView/generated-types.js +0 -3
  61. package/dist/destinations/movable-ink/categoryView/generated-types.js.map +0 -1
  62. package/dist/destinations/movable-ink/categoryView/index.d.ts +0 -5
  63. package/dist/destinations/movable-ink/categoryView/index.js +0 -43
  64. package/dist/destinations/movable-ink/categoryView/index.js.map +0 -1
  65. package/dist/destinations/movable-ink/conversion/generated-types.d.ts +0 -20
  66. package/dist/destinations/movable-ink/conversion/generated-types.js +0 -3
  67. package/dist/destinations/movable-ink/conversion/generated-types.js.map +0 -1
  68. package/dist/destinations/movable-ink/conversion/index.d.ts +0 -5
  69. package/dist/destinations/movable-ink/conversion/index.js +0 -45
  70. package/dist/destinations/movable-ink/conversion/index.js.map +0 -1
  71. package/dist/destinations/movable-ink/fields.d.ts +0 -21
  72. package/dist/destinations/movable-ink/fields.js +0 -236
  73. package/dist/destinations/movable-ink/fields.js.map +0 -1
  74. package/dist/destinations/movable-ink/identify/generated-types.d.ts +0 -7
  75. package/dist/destinations/movable-ink/identify/generated-types.js +0 -3
  76. package/dist/destinations/movable-ink/identify/generated-types.js.map +0 -1
  77. package/dist/destinations/movable-ink/identify/index.d.ts +0 -5
  78. package/dist/destinations/movable-ink/identify/index.js +0 -32
  79. package/dist/destinations/movable-ink/identify/index.js.map +0 -1
  80. package/dist/destinations/movable-ink/productAdded/generated-types.d.ts +0 -22
  81. package/dist/destinations/movable-ink/productAdded/generated-types.js +0 -3
  82. package/dist/destinations/movable-ink/productAdded/generated-types.js.map +0 -1
  83. package/dist/destinations/movable-ink/productAdded/index.d.ts +0 -5
  84. package/dist/destinations/movable-ink/productAdded/index.js +0 -43
  85. package/dist/destinations/movable-ink/productAdded/index.js.map +0 -1
  86. package/dist/destinations/movable-ink/productViewed/generated-types.d.ts +0 -21
  87. package/dist/destinations/movable-ink/productViewed/generated-types.js +0 -3
  88. package/dist/destinations/movable-ink/productViewed/generated-types.js.map +0 -1
  89. package/dist/destinations/movable-ink/productViewed/index.d.ts +0 -5
  90. package/dist/destinations/movable-ink/productViewed/index.js +0 -43
  91. package/dist/destinations/movable-ink/productViewed/index.js.map +0 -1
  92. package/dist/destinations/movable-ink/search/generated-types.d.ts +0 -12
  93. package/dist/destinations/movable-ink/search/generated-types.js +0 -3
  94. package/dist/destinations/movable-ink/search/generated-types.js.map +0 -1
  95. package/dist/destinations/movable-ink/search/index.d.ts +0 -5
  96. package/dist/destinations/movable-ink/search/index.js +0 -43
  97. package/dist/destinations/movable-ink/search/index.js.map +0 -1
  98. package/dist/destinations/movable-ink/sendCustomEvent/generated-types.d.ts +0 -25
  99. package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js +0 -3
  100. package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js.map +0 -1
  101. package/dist/destinations/movable-ink/sendCustomEvent/index.d.ts +0 -5
  102. package/dist/destinations/movable-ink/sendCustomEvent/index.js +0 -48
  103. package/dist/destinations/movable-ink/sendCustomEvent/index.js.map +0 -1
  104. package/dist/destinations/responsys/asyncMergePetRecords/generated-types.d.ts +0 -14
  105. package/dist/destinations/responsys/asyncMergePetRecords/generated-types.js +0 -3
  106. package/dist/destinations/responsys/asyncMergePetRecords/generated-types.js.map +0 -1
  107. package/dist/destinations/responsys/asyncMergePetRecords/index.d.ts +0 -5
  108. package/dist/destinations/responsys/asyncMergePetRecords/index.js +0 -113
  109. package/dist/destinations/responsys/asyncMergePetRecords/index.js.map +0 -1
  110. package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.d.ts +0 -20
  111. package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.js +0 -3
  112. package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.js.map +0 -1
  113. package/dist/destinations/responsys/asyncMergeProfileListMembers/index.d.ts +0 -5
  114. package/dist/destinations/responsys/asyncMergeProfileListMembers/index.js +0 -174
  115. package/dist/destinations/responsys/asyncMergeProfileListMembers/index.js.map +0 -1
  116. package/dist/destinations/responsys/rsp-operations.d.ts +0 -14
  117. package/dist/destinations/responsys/rsp-operations.js +0 -33
  118. package/dist/destinations/responsys/rsp-operations.js.map +0 -1
  119. package/dist/destinations/responsys/rsp-properties.d.ts +0 -4
  120. package/dist/destinations/responsys/rsp-properties.js +0 -27
  121. package/dist/destinations/responsys/rsp-properties.js.map +0 -1
  122. package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.d.ts +0 -1
  123. package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.js +0 -381
  124. package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.js.map +0 -1
  125. package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.d.ts +0 -1
  126. package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.js +0 -581
  127. package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.js.map +0 -1
  128. package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.d.ts +0 -4
  129. package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.js +0 -97
  130. package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.js.map +0 -1
  131. package/dist/destinations/snap-conversions-api/snap-capi-properties.d.ts +0 -30
  132. package/dist/destinations/snap-conversions-api/snap-capi-properties.js +0 -316
  133. package/dist/destinations/snap-conversions-api/snap-capi-properties.js.map +0 -1
  134. package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.d.ts +0 -3
  135. package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.js +0 -34
  136. package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.js.map +0 -1
  137. package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.d.ts +0 -3
  138. package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.js +0 -43
  139. package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.js.map +0 -1
  140. package/dist/destinations/trackey/group.types.d.ts +0 -11
  141. package/dist/destinations/trackey/group.types.js +0 -3
  142. package/dist/destinations/trackey/group.types.js.map +0 -1
  143. package/dist/destinations/trackey/identify.types.d.ts +0 -11
  144. package/dist/destinations/trackey/identify.types.js +0 -3
  145. package/dist/destinations/trackey/identify.types.js.map +0 -1
  146. package/dist/destinations/trackey/track.types.d.ts +0 -12
  147. package/dist/destinations/trackey/track.types.js +0 -3
  148. package/dist/destinations/trackey/track.types.js.map +0 -1
@@ -1,237 +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 utils_1 = require("./utils");
8
- const syncAudiences_1 = __importDefault(require("./syncAudiences"));
9
- const destination = {
10
- name: 'Amazon Ads',
11
- slug: 'actions-amazon-ads',
12
- mode: 'cloud',
13
- authentication: {
14
- scheme: 'oauth2',
15
- fields: {
16
- region: {
17
- label: 'Region',
18
- description: 'Region for API Endpoint, either NA, EU, FE.',
19
- choices: [
20
- { label: 'North America (NA)', value: 'https://advertising-api.amazon.com' },
21
- { label: 'Europe (EU)', value: 'https://advertising-api-eu.amazon.com' },
22
- { label: 'Far East (FE)', value: 'https://advertising-api-fe.amazon.com' }
23
- ],
24
- default: 'https://advertising-api.amazon.com',
25
- type: 'string',
26
- required: true
27
- }
28
- },
29
- testAuthentication: async (request, { auth, settings }) => {
30
- if (!auth?.accessToken) {
31
- throw new actions_core_1.InvalidAuthenticationError('Please authenticate via Oauth before enabling the destination.');
32
- }
33
- try {
34
- await request(`${settings.region}/v2/profiles`, {
35
- method: 'GET'
36
- });
37
- }
38
- catch (e) {
39
- const error = e;
40
- if (error.message === 'Unauthorized') {
41
- throw new actions_core_1.InvalidAuthenticationError('Invalid Amazon Oauth access token. Please reauthenticate to retrieve a valid access token before enabling the destination.');
42
- }
43
- throw e;
44
- }
45
- },
46
- refreshAccessToken: async (request, { auth, settings }) => {
47
- const endpoint = utils_1.AUTHORIZATION_URL[`${settings.region}`];
48
- let res;
49
- console.log(settings.region, auth, endpoint);
50
- try {
51
- res = await request('https://api.amazon.com/auth/o2/token', {
52
- method: 'POST',
53
- body: new URLSearchParams({
54
- refresh_token: auth.refreshToken,
55
- client_id: auth.clientId,
56
- client_secret: auth.clientSecret,
57
- grant_type: 'refresh_token'
58
- }),
59
- headers: {
60
- authorization: ''
61
- }
62
- });
63
- return { accessToken: res.data.access_token };
64
- }
65
- catch (e) {
66
- console.log(e);
67
- const error = e;
68
- if (error.response?.data?.error === 'invalid_grant') {
69
- throw new actions_core_1.InvalidAuthenticationError(`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);
70
- }
71
- throw new actions_core_1.InvalidAuthenticationError(`Failed to fetch a new access token. Reason: ${error.response?.data?.error}`, actions_core_1.ErrorCodes.OAUTH_REFRESH_FAILED);
72
- }
73
- }
74
- },
75
- extendRequest({ auth }) {
76
- return {
77
- headers: {
78
- authorization: `Bearer ${auth?.accessToken}`,
79
- 'Amazon-Advertising-API-ClientID': process.env.ACTIONS_AMAZON_ADS_CLIENT_ID || ''
80
- }
81
- };
82
- },
83
- audienceFields: {
84
- description: {
85
- type: 'string',
86
- label: 'Description',
87
- required: true,
88
- description: 'The audience description. Must be an alphanumeric, non-null string between 0 to 1000 characters in length.'
89
- },
90
- countryCode: {
91
- type: 'string',
92
- label: 'Country Code',
93
- required: true,
94
- description: 'A String value representing ISO 3166-1 alpha-2 country code for the members in this audience.'
95
- },
96
- externalAudienceId: {
97
- type: 'string',
98
- label: 'External Audience Id',
99
- required: true,
100
- description: 'The user-defined audience identifier.'
101
- },
102
- cpmCents: {
103
- label: 'CPM Cents',
104
- type: 'number',
105
- description: `Cost per thousand impressions (CPM) in cents. For example, $1.00 = 100 cents.`
106
- },
107
- currency: {
108
- label: 'Currency',
109
- type: 'string',
110
- description: `The price paid. Base units depend on the currency. As an example, USD should be reported as Dollars.Cents, whereas JPY should be reported as a whole number of Yen. All provided values will be rounded to two digits with toFixed(2).Refer [Aamzon Ads Documentation](https://advertising.amazon.com/API/docs/en-us/amc-advertiser-audience#tag/Audience-Metadata/operation/CreateAudienceMetadataV2) to view supported Currency`
111
- },
112
- ttl: {
113
- type: 'number',
114
- label: 'Time-to-live',
115
- required: false,
116
- description: 'Time-to-live in seconds. The amount of time the record is associated with the audience.'
117
- },
118
- advertiserId: {
119
- label: 'Advertiser ID',
120
- description: 'Advertiser Id',
121
- type: 'string',
122
- required: true
123
- }
124
- },
125
- audienceConfig: {
126
- mode: {
127
- type: 'synced',
128
- full_audience_sync: false
129
- },
130
- async createAudience(request, createAudienceInput) {
131
- const { audienceName, statsContext, audienceSettings } = createAudienceInput;
132
- const { statsClient, tags: statsTags } = statsContext || {};
133
- const endpoint = createAudienceInput.settings.region;
134
- const description = audienceSettings?.description;
135
- const advertiser_id = audienceSettings?.advertiserId;
136
- const external_audience_id = audienceSettings?.externalAudienceId;
137
- const country_code = audienceSettings?.countryCode;
138
- const ttl = audienceSettings?.ttl;
139
- const currency = audienceSettings?.currency;
140
- const cpm_cents = audienceSettings?.cpmCents;
141
- const statsName = 'createAmazonAudience';
142
- statsTags?.push(`slug:${destination.slug}`);
143
- statsTags?.push(`ttl_type:${typeof ttl}_${ttl}`);
144
- statsTags?.push(`cpmcents_type:${typeof cpm_cents}_${cpm_cents}`);
145
- statsClient?.incr(`${statsName}.intialise`, 1, statsTags);
146
- console.log(ttl, cpm_cents);
147
- if (!advertiser_id) {
148
- throw new actions_core_1.IntegrationError('Missing advertiserId Value', 'MISSING_REQUIRED_FIELD', 400);
149
- }
150
- if (!description) {
151
- throw new actions_core_1.IntegrationError('Missing description Value', 'MISSING_REQUIRED_FIELD', 400);
152
- }
153
- if (!external_audience_id) {
154
- throw new actions_core_1.IntegrationError('Missing externalAudienceId Value', 'MISSING_REQUIRED_FIELD', 400);
155
- }
156
- if (!audienceName) {
157
- throw new actions_core_1.IntegrationError('Missing audienceName Value', 'MISSING_REQUIRED_FIELD', 400);
158
- }
159
- if (!country_code) {
160
- throw new actions_core_1.IntegrationError('Missing countryCode Value', 'MISSING_REQUIRED_FIELD', 400);
161
- }
162
- const payload = {
163
- name: audienceName,
164
- description: description,
165
- targetResource: {
166
- advertiserId: advertiser_id
167
- },
168
- metadata: {
169
- externalAudienceId: external_audience_id
170
- },
171
- countryCode: country_code
172
- };
173
- if (ttl) {
174
- const timeToLive = Number(ttl);
175
- if (!timeToLive) {
176
- throw new actions_core_1.IntegrationError('TTL:-String can not be converted to Number', 'INVALID_TTL_VALUE', 400);
177
- }
178
- payload.metadata.ttl = timeToLive;
179
- }
180
- if (cpm_cents && currency) {
181
- if (!utils_1.CURRENCY.includes(currency)) {
182
- throw new actions_core_1.IntegrationError('Invalid Currency Value', 'INVALID_CURRENCY_VALUE', 400);
183
- }
184
- const cpmCents = Number(cpm_cents);
185
- if (!cpmCents) {
186
- throw new actions_core_1.IntegrationError('CPM_CENTS:-String can not be converted to Number', 'INVALID_CPMCENTS_VALUE', 400);
187
- }
188
- payload.metadata.audienceFees = [];
189
- payload.metadata?.audienceFees.push({
190
- currency,
191
- cpmCents: cpmCents
192
- });
193
- }
194
- statsTags?.push(`slug:${destination.slug}`);
195
- statsClient?.incr(`${statsName}.call`, 1, statsTags);
196
- let payloadString = JSON.stringify(payload);
197
- payloadString = payloadString.replace(utils_1.REGEX_ADVERTISERID, '"advertiserId":$1');
198
- const response = await request(`${endpoint}/amc/audiences/metadata`, {
199
- method: 'POST',
200
- body: payloadString,
201
- headers: {
202
- 'Content-Type': 'application/vnd.amcaudiences.v1+json'
203
- }
204
- });
205
- const res = await response.text();
206
- const resp = utils_1.extractNumberAndSubstituteWithStringValue(res, utils_1.REGEX_AUDIENCEID, '"audienceId":"$1"');
207
- return {
208
- externalId: resp.audienceId
209
- };
210
- },
211
- async getAudience(request, getAudienceInput) {
212
- const { statsContext } = getAudienceInput;
213
- const audience_id = getAudienceInput.externalId;
214
- const endpoint = getAudienceInput.settings.region;
215
- const { statsClient, tags: statsTags } = statsContext || {};
216
- const statsName = 'getAudience';
217
- statsTags?.push(`slug:${destination.slug}`);
218
- statsClient?.incr(`${statsName}.call`, 1, statsTags);
219
- if (!audience_id) {
220
- throw new actions_core_1.IntegrationError('Missing audienceId value', 'MISSING_REQUIRED_FIELD', 400);
221
- }
222
- const response = await request(`${endpoint}/amc/audiences/metadata/${audience_id}`, {
223
- method: 'GET'
224
- });
225
- const res = await response.text();
226
- const resp = utils_1.extractNumberAndSubstituteWithStringValue(res, utils_1.REGEX_AUDIENCEID, '"audienceId":"$1"');
227
- return {
228
- externalId: resp.audienceId
229
- };
230
- }
231
- },
232
- actions: {
233
- syncAudiences: syncAudiences_1.default
234
- }
235
- };
236
- exports.default = destination;
237
- //# 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;AAGhG,mCAOgB;AAEhB,oEAA2C;AAE3C,MAAM,WAAW,GAA8D;IAC7E,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,EAAE;oBACP,EAAE,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,oCAAoC,EAAE;oBAC5E,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,uCAAuC,EAAE;oBACxE,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,uCAAuC,EAAE;iBAC3E;gBACD,OAAO,EAAE,oCAAoC;gBAC7C,IAAI,EA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AAI,CAAC,UAAU;aAC5B,CAAA;QACH,CAAC;QAED,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,gBAAgB;YAEzC,MAAM,EAAE,YAAY,EAAE,GAAG,gBAAgB,CAAA;YACzC,MAAM,WAAW,GAAG,gBAAgB,CAAC,UAAU,CAAA;YAC/C,MAAM,QAAQ,GAAG,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAA;YACjD,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,YAAY,IAAI,EAAE,CAAA;YAE3D,MAAM,SAAS,GAAG,aAAa,CAAA;YAC/B,SAAS,EAAE,IAAI,CAAC,QAAQ,WAAW,CAAC,IAAI,EAAE,CAAC,CAAA;YAC3C,WAAW,EAAE,IAAI,CAAC,GAAG,SAAS,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,CAAA;YAEpD,IAAI,CAAC,WAAW,EAAE;gBAChB,MAAM,IAAI,+BAAgB,CAAC,0BAA0B,EAAE,wBAAwB,EAAE,GAAG,CAAC,CAAA;aACtF;YACD,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,QAAQ,2BAA2B,WAAW,EAAE,EAAE;gBAClF,MAAM,EAAE,KAAK;aACd,CAAC,CAAA;YACF,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YAEjC,MAAM,IAAI,GAAG,iDAAyC,CAAC,GAAG,EAAE,wBAAgB,EAAE,mBAAmB,CAAC,CAAA;YAClG,OAAO;gBACL,UAAU,EAAE,IAAI,CAAC,UAAU;aAC5B,CAAA;QACH,CAAC;KACF;IACD,OAAO,EAAE;QACP,aAAa,EAAb,uBAAa;KACd;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -1,15 +0,0 @@
1
- export interface Payload {
2
- event_name?: string;
3
- externalUserId: string;
4
- email?: string;
5
- firstName?: string;
6
- lastName?: string;
7
- phone?: string;
8
- postal?: string;
9
- state?: string;
10
- city?: string;
11
- address?: string;
12
- audienceId: string;
13
- enable_batching: boolean;
14
- batch_size?: number;
15
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=generated-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/amazon-ads/syncAudiences/generated-types.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- import type { ActionDefinition } from '@segment/actions-core';
2
- import type { Settings } from '../generated-types';
3
- import type { Payload } from './generated-types';
4
- declare const action: ActionDefinition<Settings, Payload>;
5
- export default action;
@@ -1,182 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("../utils");
4
- const crypto_1 = require("crypto");
5
- const action = {
6
- title: 'Sync Audience',
7
- description: 'Sync audiences from Segment to Amazon Ads Audience.',
8
- defaultSubscription: 'event = "Audience Entered" or event = "Audience Exited"',
9
- fields: {
10
- event_name: {
11
- label: 'Event Name',
12
- description: 'The name of the current Segment event.',
13
- type: 'string',
14
- unsafe_hidden: true,
15
- default: {
16
- '@path': '$.event'
17
- }
18
- },
19
- externalUserId: {
20
- label: 'External User ID',
21
- description: 'This is an external user identifier defined by data providers.',
22
- type: 'string',
23
- required: true,
24
- default: { '@path': '$.userId' }
25
- },
26
- email: {
27
- label: 'Email',
28
- description: 'User email address. Vaule will be hashed before sending to Amazon.',
29
- type: 'string',
30
- required: false,
31
- default: { '@path': '$.properties.email' }
32
- },
33
- firstName: {
34
- label: 'First name',
35
- description: 'User first name. Value will be hashed before sending to Amazon.',
36
- type: 'string',
37
- required: false,
38
- default: { '@path': '$.properties.first_name' }
39
- },
40
- lastName: {
41
- label: 'Last name',
42
- description: 'User Last name. Value will be hashed before sending to Amazon.',
43
- type: 'string',
44
- required: false,
45
- default: { '@path': '$.properties.last_name' }
46
- },
47
- phone: {
48
- label: 'Phone',
49
- description: 'Phone Number. Value will be hashed before sending to Amazon.',
50
- type: 'string',
51
- required: false,
52
- default: { '@path': '$.properties.phone' }
53
- },
54
- postal: {
55
- label: 'Postal',
56
- description: 'POstal Code. Value will be hashed before sending to Amazon.',
57
- type: 'string',
58
- required: false,
59
- default: { '@path': '$.properties.postal' }
60
- },
61
- state: {
62
- label: 'Postal',
63
- description: 'State Code. Value will be hashed before sending to Amazon.',
64
- type: 'string',
65
- required: false,
66
- default: { '@path': '$.properties.state' }
67
- },
68
- city: {
69
- label: 'City',
70
- description: 'City name. Value will be hashed before sending to Amazon.',
71
- type: 'string',
72
- required: false,
73
- default: { '@path': '$.properties.city' }
74
- },
75
- address: {
76
- label: 'Address',
77
- description: 'Address Code. Value will be hashed before sending to Amazon.',
78
- type: 'string',
79
- required: false,
80
- default: { '@path': '$.properties.address' }
81
- },
82
- audienceId: {
83
- label: 'Audience ID',
84
- type: 'string',
85
- required: true,
86
- unsafe_hidden: true,
87
- description: 'A number value representing the Amazon audience identifier. This is the identifier that is returned during audience creation.',
88
- default: {
89
- '@path': '$.context.personas.external_audience_id'
90
- }
91
- },
92
- enable_batching: {
93
- label: 'Enable Batching',
94
- description: 'When enabled,segment will send data in batching',
95
- type: 'boolean',
96
- required: true,
97
- default: true
98
- },
99
- batch_size: {
100
- label: 'Batch Size',
101
- description: 'Maximum number of events to include in each batch. Actual batch sizes may be lower.',
102
- type: 'number',
103
- unsafe_hidden: true,
104
- required: false,
105
- default: 10000
106
- }
107
- },
108
- perform: (request, { settings, payload, statsContext, audienceSettings }) => {
109
- return processPayload(request, settings, [payload], statsContext, audienceSettings);
110
- },
111
- performBatch: (request, { settings, payload: payloads, statsContext, audienceSettings }) => {
112
- return processPayload(request, settings, payloads, statsContext, audienceSettings);
113
- }
114
- };
115
- async function processPayload(request, settings, payload, statsContext, audienceSettings) {
116
- const { statsClient, tags: statsTags } = statsContext || {};
117
- const statsName = 'syncAmazonAdsAudience';
118
- statsClient?.incr(`${statsName}.intialise`, 1, statsTags);
119
- const payloadRecord = createPayloadToUploadRecords(payload, audienceSettings);
120
- const payloadString = JSON.stringify(payloadRecord).replace(/"audienceId":"(\d+)"/, '"audienceId":$1');
121
- const response = await request(`${settings.region}/amc/audiences/records`, {
122
- method: 'POST',
123
- body: payloadString,
124
- headers: {
125
- 'Content-Type': 'application/vnd.amcaudiences.v1+json'
126
- }
127
- });
128
- const result = response.data;
129
- return {
130
- result
131
- };
132
- }
133
- function createPayloadToUploadRecords(payloads, audienceSettings) {
134
- const records = [];
135
- const { audienceId } = payloads[0];
136
- payloads.forEach((payload) => {
137
- const hashedPII = {};
138
- if (payload.firstName) {
139
- hashedPII.firstname = normalizeAndHash(payload.firstName);
140
- }
141
- if (payload.lastName) {
142
- hashedPII.lastname = normalizeAndHash(payload.lastName);
143
- }
144
- if (payload.address) {
145
- hashedPII.address = normalizeAndHash(payload.address);
146
- }
147
- if (payload.postal) {
148
- hashedPII.postal = normalizeAndHash(payload.postal);
149
- }
150
- if (payload.phone) {
151
- hashedPII.phone = normalizeAndHash(payload.phone);
152
- }
153
- if (payload.city) {
154
- hashedPII.city = normalizeAndHash(payload.city);
155
- }
156
- if (payload.state) {
157
- hashedPII.state = normalizeAndHash(payload.state);
158
- }
159
- if (payload.email) {
160
- hashedPII.email = normalizeAndHash(payload.email);
161
- }
162
- const payloadRecord = {
163
- externalUserId: payload.externalUserId,
164
- countryCode: audienceSettings.countryCode,
165
- action: payload.event_name == 'Audience Entered' ? utils_1.CONSTANTS.CREATE : utils_1.CONSTANTS.DELETE,
166
- hashedPII: [hashedPII]
167
- };
168
- records.push(payloadRecord);
169
- });
170
- return {
171
- records: records,
172
- audienceId: audienceId
173
- };
174
- }
175
- function normalizeAndHash(data) {
176
- const normalizedData = data.toLowerCase().trim();
177
- const hash = crypto_1.createHash('sha256');
178
- hash.update(normalizedData);
179
- return hash.digest('hex');
180
- }
181
- exports.default = action;
182
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../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gBAAgB,CAAC,WAAW;YACzC,MAAM,EAAE,OAAO,CAAC,UAAU,IAAI,kBAAkB,CAAC,CAAC,CAAC,iBAAS,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAS,CAAC,MAAM;YACtF,SAAS,EAAE,CAAC,SAAS,CAAC;SACvB,CAAA;QACD,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;IAC7B,CAAC,CAAC,CAAA;IAEF,OAAO;QACL,OAAO,EAAE,OAAO;QAChB,UAAU,EAAE,UAAU;KACvB,CAAA;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAY;IAEpC,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAA;IAEhD,MAAM,IAAI,GAAG,mBAAU,CAAC,QAAQ,CAAC,CAAA;IACjC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,CAAA;IAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC3B,CAAC;AAED,kBAAe,MAAM,CAAA"}
@@ -1,47 +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
- }
23
- export interface HashedPIIObject {
24
- firstname?: string;
25
- lastname?: string;
26
- phone?: string;
27
- city?: string;
28
- state?: string;
29
- postal?: string;
30
- email?: string;
31
- address?: string;
32
- }
33
- export interface AudienceRecord {
34
- hashedPII?: HashedPIIObject[];
35
- externalUserId: string;
36
- countryCode: string;
37
- action: string;
38
- }
39
- export interface TargetResourceRecords {
40
- connectionId: string;
41
- targetTypes: string[];
42
- }
43
- export interface AudienceRecordPayload {
44
- records: AudienceRecord[];
45
- targetResource: TargetResourceRecords;
46
- audienceId: number;
47
- }
@@ -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,37 +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
- }
26
- export interface RecordsResponseType {
27
- jobRequestId: string;
28
- }
29
- export declare const AUTHORIZATION_URL: any;
30
- export declare const CONSTANTS: {
31
- CREATE: string;
32
- DELETE: string;
33
- };
34
- export declare const CURRENCY: string[];
35
- export declare const REGEX_AUDIENCEID: RegExp;
36
- export declare const REGEX_ADVERTISERID: RegExp;
37
- export declare function extractNumberAndSubstituteWithStringValue(responseString: string, regex: any, substituteWith: string): any;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extractNumberAndSubstituteWithStringValue = exports.REGEX_ADVERTISERID = exports.REGEX_AUDIENCEID = exports.CURRENCY = exports.CONSTANTS = exports.AUTHORIZATION_URL = 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
- exports.AUTHORIZATION_URL = {
9
- 'https://advertising-api.amazon.com': 'https://api.amazon.com',
10
- 'https://advertising-api-eu.amazon.com': 'https://api.amazon.co.uk',
11
- 'https://advertising-api-fe.amazon.com': 'https://api.amazon.co.jp'
12
- };
13
- exports.CONSTANTS = {
14
- CREATE: 'CREATE',
15
- DELETE: 'DELETE'
16
- };
17
- exports.CURRENCY = ['USD', 'CAD', 'JPY', 'GBP', 'EUR', 'SAR', 'AUD', 'AED', 'CNY', 'MXN', 'INR', 'SEK', 'TRY'];
18
- exports.REGEX_AUDIENCEID = /"audienceId":(\d+)/;
19
- exports.REGEX_ADVERTISERID = /"advertiserId":"(\d+)"/;
20
- function extractNumberAndSubstituteWithStringValue(responseString, regex, substituteWith) {
21
- const resString = responseString.replace(regex, substituteWith);
22
- return JSON.parse(resString);
23
- }
24
- exports.extractNumberAndSubstituteWithStringValue = extractNumberAndSubstituteWithStringValue;
25
- //# 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;AAsBY,QAAA,iBAAiB,GAAQ;IACpC,oCAAoC,EAAE,wBAAwB;IAC9D,uCAAuC,EAAE,0BAA0B;IACnE,uCAAuC,EAAE,0BAA0B;CACpE,CAAA;AACY,QAAA,SAAS,GAAG;IACvB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACjB,CAAA;AACY,QAAA,QAAQ,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;AAEtG,QAAA,gBAAgB,GAAG,oBAAoB,CAAA;AACvC,QAAA,kBAAkB,GAAG,wBAAwB,CAAA;AAE1D,SAAgB,yCAAyC,CAAC,cAAsB,EAAE,KAAU,EAAE,cAAsB;IAClH,MAAM,SAAS,GAAG,cAAc,CAAC,OAAO,CAAC,KAAK,EAAE,cAAc,CAAC,CAAA;IAC/D,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;AAC9B,CAAC;AAHD,8FAGC"}