@segment/action-destinations 3.259.0-staging-aa8f36ba1 → 3.259.0-staging-bbeebc18f

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 (156) hide show
  1. package/dist/destinations/amazon-ads/generated-types.d.ts +9 -0
  2. package/dist/destinations/amazon-ads/index.d.ts +2 -2
  3. package/dist/destinations/amazon-ads/index.js +128 -3
  4. package/dist/destinations/amazon-ads/index.js.map +1 -1
  5. package/dist/destinations/amazon-ads/syncAudiences/generated-types.d.ts +17 -0
  6. package/dist/destinations/amazon-ads/syncAudiences/index.js +114 -7
  7. package/dist/destinations/amazon-ads/syncAudiences/index.js.map +1 -1
  8. package/dist/destinations/amazon-ads/utils.d.ts +6 -0
  9. package/dist/destinations/amazon-ads/utils.js +8 -0
  10. package/dist/destinations/amazon-ads/utils.js.map +1 -0
  11. package/dist/destinations/blackbaud-raisers-edge-nxt/utils/index.d.ts +1 -1
  12. package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.d.ts +1 -0
  13. package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.js +184 -0
  14. package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.js.map +1 -0
  15. package/dist/destinations/customerio/utils.d.ts +1 -1
  16. package/dist/destinations/engage/utils/EngageActionPerformer.d.ts +1 -1
  17. package/dist/destinations/engage/utils/EngageActionPerformer.js +3 -18
  18. package/dist/destinations/engage/utils/EngageActionPerformer.js.map +1 -1
  19. package/dist/destinations/engage/utils/operationTracking/OperationFinallyHooks.d.ts +0 -3
  20. package/dist/destinations/engage/utils/operationTracking/OperationFinallyHooks.js +0 -15
  21. package/dist/destinations/engage/utils/operationTracking/OperationFinallyHooks.js.map +1 -1
  22. package/dist/destinations/engage/utils/track.d.ts +0 -3
  23. package/dist/destinations/klaviyo/removeProfileToList/generated-types.d.ts +4 -0
  24. package/dist/destinations/klaviyo/removeProfileToList/generated-types.js.map +1 -0
  25. package/dist/destinations/klaviyo/removeProfileToList/index.d.ts +5 -0
  26. package/dist/destinations/klaviyo/removeProfileToList/index.js +43 -0
  27. package/dist/destinations/klaviyo/removeProfileToList/index.js.map +1 -0
  28. package/dist/destinations/movable-ink/categoryView/generated-types.d.ts +22 -0
  29. package/dist/destinations/movable-ink/categoryView/generated-types.js +3 -0
  30. package/dist/destinations/movable-ink/categoryView/generated-types.js.map +1 -0
  31. package/dist/destinations/movable-ink/categoryView/index.js +43 -0
  32. package/dist/destinations/movable-ink/categoryView/index.js.map +1 -0
  33. package/dist/destinations/movable-ink/conversion/generated-types.d.ts +20 -0
  34. package/dist/destinations/movable-ink/conversion/generated-types.js +3 -0
  35. package/dist/destinations/movable-ink/conversion/generated-types.js.map +1 -0
  36. package/dist/destinations/movable-ink/conversion/index.d.ts +5 -0
  37. package/dist/destinations/movable-ink/conversion/index.js +45 -0
  38. package/dist/destinations/movable-ink/conversion/index.js.map +1 -0
  39. package/dist/destinations/movable-ink/fields.d.ts +21 -0
  40. package/dist/destinations/movable-ink/fields.js +236 -0
  41. package/dist/destinations/movable-ink/fields.js.map +1 -0
  42. package/dist/destinations/movable-ink/identify/generated-types.d.ts +7 -0
  43. package/dist/destinations/movable-ink/identify/generated-types.js +3 -0
  44. package/dist/destinations/movable-ink/identify/generated-types.js.map +1 -0
  45. package/dist/destinations/movable-ink/identify/index.d.ts +5 -0
  46. package/dist/destinations/movable-ink/identify/index.js +32 -0
  47. package/dist/destinations/movable-ink/identify/index.js.map +1 -0
  48. package/dist/destinations/movable-ink/productAdded/generated-types.d.ts +22 -0
  49. package/dist/destinations/movable-ink/productAdded/generated-types.js +3 -0
  50. package/dist/destinations/movable-ink/productAdded/generated-types.js.map +1 -0
  51. package/dist/destinations/movable-ink/productAdded/index.d.ts +5 -0
  52. package/dist/destinations/movable-ink/productAdded/index.js +43 -0
  53. package/dist/destinations/movable-ink/productAdded/index.js.map +1 -0
  54. package/dist/destinations/movable-ink/productViewed/generated-types.d.ts +21 -0
  55. package/dist/destinations/movable-ink/productViewed/generated-types.js +3 -0
  56. package/dist/destinations/movable-ink/productViewed/generated-types.js.map +1 -0
  57. package/dist/destinations/movable-ink/productViewed/index.d.ts +5 -0
  58. package/dist/destinations/movable-ink/productViewed/index.js +43 -0
  59. package/dist/destinations/movable-ink/productViewed/index.js.map +1 -0
  60. package/dist/destinations/movable-ink/search/generated-types.d.ts +12 -0
  61. package/dist/destinations/movable-ink/search/generated-types.js +3 -0
  62. package/dist/destinations/movable-ink/search/generated-types.js.map +1 -0
  63. package/dist/destinations/movable-ink/search/index.d.ts +5 -0
  64. package/dist/destinations/movable-ink/search/index.js +43 -0
  65. package/dist/destinations/movable-ink/search/index.js.map +1 -0
  66. package/dist/destinations/movable-ink/sendCustomEvent/generated-types.d.ts +25 -0
  67. package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js +3 -0
  68. package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js.map +1 -0
  69. package/dist/destinations/movable-ink/sendCustomEvent/index.d.ts +5 -0
  70. package/dist/destinations/movable-ink/sendCustomEvent/index.js +48 -0
  71. package/dist/destinations/movable-ink/sendCustomEvent/index.js.map +1 -0
  72. package/dist/destinations/responsys/asyncMergePetRecords/generated-types.d.ts +14 -0
  73. package/dist/destinations/responsys/asyncMergePetRecords/generated-types.js +3 -0
  74. package/dist/destinations/responsys/asyncMergePetRecords/generated-types.js.map +1 -0
  75. package/dist/destinations/responsys/asyncMergePetRecords/index.d.ts +5 -0
  76. package/dist/destinations/responsys/asyncMergePetRecords/index.js +113 -0
  77. package/dist/destinations/responsys/asyncMergePetRecords/index.js.map +1 -0
  78. package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.d.ts +20 -0
  79. package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.js +3 -0
  80. package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.js.map +1 -0
  81. package/dist/destinations/responsys/asyncMergeProfileListMembers/index.d.ts +5 -0
  82. package/dist/destinations/responsys/asyncMergeProfileListMembers/index.js +174 -0
  83. package/dist/destinations/responsys/asyncMergeProfileListMembers/index.js.map +1 -0
  84. package/dist/destinations/responsys/rsp-operations.d.ts +14 -0
  85. package/dist/destinations/responsys/rsp-operations.js +33 -0
  86. package/dist/destinations/responsys/rsp-operations.js.map +1 -0
  87. package/dist/destinations/responsys/rsp-properties.d.ts +4 -0
  88. package/dist/destinations/responsys/rsp-properties.js +27 -0
  89. package/dist/destinations/responsys/rsp-properties.js.map +1 -0
  90. package/dist/destinations/responsys-cloud/generated-types.d.ts +20 -0
  91. package/dist/destinations/responsys-cloud/generated-types.js +3 -0
  92. package/dist/destinations/responsys-cloud/generated-types.js.map +1 -0
  93. package/dist/destinations/responsys-cloud/index.d.ts +4 -0
  94. package/dist/destinations/responsys-cloud/index.js +207 -0
  95. package/dist/destinations/responsys-cloud/index.js.map +1 -0
  96. package/dist/destinations/responsys-cloud/sendAudience/generated-types.d.ts +16 -0
  97. package/dist/destinations/responsys-cloud/sendAudience/generated-types.js +3 -0
  98. package/dist/destinations/responsys-cloud/sendAudience/generated-types.js.map +1 -0
  99. package/dist/destinations/responsys-cloud/sendAudience/index.d.ts +5 -0
  100. package/dist/destinations/responsys-cloud/sendAudience/index.js +109 -0
  101. package/dist/destinations/responsys-cloud/sendAudience/index.js.map +1 -0
  102. package/dist/destinations/responsys-cloud/sendCustomTraits/generated-types.d.ts +11 -0
  103. package/dist/destinations/responsys-cloud/sendCustomTraits/generated-types.js +3 -0
  104. package/dist/destinations/responsys-cloud/sendCustomTraits/generated-types.js.map +1 -0
  105. package/dist/destinations/responsys-cloud/sendCustomTraits/index.d.ts +5 -0
  106. package/dist/destinations/responsys-cloud/sendCustomTraits/index.js +72 -0
  107. package/dist/destinations/responsys-cloud/sendCustomTraits/index.js.map +1 -0
  108. package/dist/destinations/responsys-cloud/shared_properties.d.ts +3 -0
  109. package/dist/destinations/responsys-cloud/shared_properties.js +19 -0
  110. package/dist/destinations/responsys-cloud/shared_properties.js.map +1 -0
  111. package/dist/destinations/responsys-cloud/types.d.ts +38 -0
  112. package/dist/destinations/responsys-cloud/types.js +3 -0
  113. package/dist/destinations/responsys-cloud/types.js.map +1 -0
  114. package/dist/destinations/responsys-cloud/upsertListMember/generated-types.d.ts +14 -0
  115. package/dist/destinations/responsys-cloud/upsertListMember/generated-types.js +3 -0
  116. package/dist/destinations/responsys-cloud/upsertListMember/generated-types.js.map +1 -0
  117. package/dist/destinations/responsys-cloud/upsertListMember/index.d.ts +5 -0
  118. package/dist/destinations/responsys-cloud/upsertListMember/index.js +85 -0
  119. package/dist/destinations/responsys-cloud/upsertListMember/index.js.map +1 -0
  120. package/dist/destinations/responsys-cloud/utils.d.ts +20 -0
  121. package/dist/destinations/responsys-cloud/utils.js +179 -0
  122. package/dist/destinations/responsys-cloud/utils.js.map +1 -0
  123. package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.d.ts +1 -0
  124. package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.js +381 -0
  125. package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.js.map +1 -0
  126. package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.d.ts +1 -0
  127. package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.js +581 -0
  128. package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.js.map +1 -0
  129. package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.d.ts +4 -0
  130. package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.js +97 -0
  131. package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.js.map +1 -0
  132. package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.d.ts +3 -0
  133. package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.js +43 -0
  134. package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.js.map +1 -0
  135. package/dist/destinations/trackey/group.types.d.ts +11 -0
  136. package/dist/destinations/trackey/group.types.js +3 -0
  137. package/dist/destinations/trackey/group.types.js.map +1 -0
  138. package/dist/destinations/trackey/identify.types.d.ts +11 -0
  139. package/dist/destinations/trackey/identify.types.js +3 -0
  140. package/dist/destinations/trackey/identify.types.js.map +1 -0
  141. package/dist/destinations/trackey/track.types.d.ts +12 -0
  142. package/dist/destinations/trackey/track.types.js +3 -0
  143. package/dist/destinations/trackey/track.types.js.map +1 -0
  144. package/package.json +2 -2
  145. package/dist/destinations/liveramp-audiences/audienceEntered/generated-types.d.ts +0 -13
  146. package/dist/destinations/liveramp-audiences/audienceEntered/generated-types.js.map +0 -1
  147. package/dist/destinations/liveramp-audiences/audienceEntered/index.js +0 -95
  148. package/dist/destinations/liveramp-audiences/audienceEntered/index.js.map +0 -1
  149. package/dist/destinations/liveramp-audiences/audienceEntered/s3.d.ts +0 -6
  150. package/dist/destinations/liveramp-audiences/audienceEntered/s3.js +0 -37
  151. package/dist/destinations/liveramp-audiences/audienceEntered/s3.js.map +0 -1
  152. package/dist/destinations/liveramp-audiences/audienceEntered/sftp.d.ts +0 -7
  153. package/dist/destinations/liveramp-audiences/audienceEntered/sftp.js +0 -52
  154. package/dist/destinations/liveramp-audiences/audienceEntered/sftp.js.map +0 -1
  155. /package/dist/destinations/{liveramp-audiences/audienceEntered → klaviyo/removeProfileToList}/generated-types.js +0 -0
  156. /package/dist/destinations/{liveramp-audiences/audienceEntered → movable-ink/categoryView}/index.d.ts +0 -0
@@ -1,3 +1,12 @@
1
1
  export interface Settings {
2
2
  region: string;
3
+ advertiserId: number;
4
+ }
5
+ export interface AudienceSettings {
6
+ description: string;
7
+ countryCode?: string;
8
+ externalAudienceId: string;
9
+ cpmCents?: number;
10
+ currency?: string;
11
+ ttl?: number;
3
12
  }
@@ -1,4 +1,4 @@
1
1
  import type { AudienceDestinationDefinition } from '@segment/actions-core';
2
- import type { Settings } from './generated-types';
3
- declare const destination: AudienceDestinationDefinition<Settings>;
2
+ import type { Settings, AudienceSettings } from './generated-types';
3
+ declare const destination: AudienceDestinationDefinition<Settings, AudienceSettings>;
4
4
  export default destination;
@@ -20,12 +20,21 @@ const destination = {
20
20
  { label: 'Europe (EU)', value: 'https://advertising-api-eu.amazon.com' },
21
21
  { label: 'Far East (FE)', value: 'https://advertising-api-fe.amazon.com' }
22
22
  ],
23
- default: 'North America (NA)',
23
+ default: 'https://advertising-api.amazon.com',
24
24
  type: 'string',
25
25
  required: true
26
+ },
27
+ advertiserId: {
28
+ label: 'Advertiser ID',
29
+ description: 'Advertiser Id',
30
+ type: 'number',
31
+ required: true
26
32
  }
27
33
  },
28
34
  testAuthentication: async (request, { auth }) => {
35
+ if (!process.env.ACTIONS_AMAZON_ADS_CLIENT_ID) {
36
+ throw new actions_core_1.IntegrationError('Missing amazon API client ID', 'MISSING_REQUIRED_FIELD', 400);
37
+ }
29
38
  if (!auth?.accessToken) {
30
39
  throw new actions_core_1.InvalidAuthenticationError('Please authenticate via Oauth before enabling the destination.');
31
40
  }
@@ -68,15 +77,131 @@ const destination = {
68
77
  extendRequest({ auth }) {
69
78
  return {
70
79
  headers: {
71
- authorization: `Bearer ${auth?.accessToken}`
80
+ 'Content-Type': 'application/vnd.amcaudiences.v1+json',
81
+ authorization: `Bearer ${auth?.accessToken}`,
82
+ 'Amazon-Advertising-API-ClientID': process.env.ACTIONS_AMAZON_ADS_CLIENT_ID || ''
72
83
  }
73
84
  };
74
85
  },
75
- audienceFields: {},
86
+ audienceFields: {
87
+ description: {
88
+ type: 'string',
89
+ label: 'Description',
90
+ required: true,
91
+ description: 'The audience description. Must be an alphanumeric, non-null string between 0 to 1000 characters in length.'
92
+ },
93
+ countryCode: {
94
+ type: 'string',
95
+ label: 'Country Code',
96
+ required: false,
97
+ description: 'A String value representing ISO 3166-1 alpha-2 country code for the members in this audience.'
98
+ },
99
+ externalAudienceId: {
100
+ type: 'string',
101
+ label: 'External Audience Id.',
102
+ required: true,
103
+ description: 'The user-defined audience identifier.'
104
+ },
105
+ cpmCents: {
106
+ label: 'CPM Cents',
107
+ type: 'number',
108
+ description: `Cost per thousand impressions (CPM) in cents. For example, $1.00 = 100 cents.`
109
+ },
110
+ currency: {
111
+ label: 'Currency',
112
+ type: 'string',
113
+ 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)`
114
+ },
115
+ ttl: {
116
+ type: 'number',
117
+ label: 'Time-to-live',
118
+ required: false,
119
+ description: 'Time-to-live in seconds. The amount of time the record is associated with the audience.'
120
+ }
121
+ },
76
122
  audienceConfig: {
77
123
  mode: {
78
124
  type: 'synced',
79
125
  full_audience_sync: false
126
+ },
127
+ async createAudience(request, createAudienceInput) {
128
+ const { audienceName, statsContext } = createAudienceInput;
129
+ const { statsClient, tags: statsTags } = statsContext || {};
130
+ const endpoint = createAudienceInput.settings.region;
131
+ const payload = {
132
+ name: audienceName,
133
+ description: createAudienceInput.audienceSettings?.description,
134
+ countryCode: createAudienceInput.audienceSettings?.countryCode || '',
135
+ targetResource: {
136
+ advertiserId: createAudienceInput.settings.advertiserId
137
+ },
138
+ metadata: {
139
+ externalAudienceId: createAudienceInput.audienceSettings?.externalAudienceId,
140
+ ttl: createAudienceInput.audienceSettings?.ttl || '',
141
+ audienceFees: [
142
+ {
143
+ cpmCents: createAudienceInput.audienceSettings?.cpmCents || '',
144
+ currency: createAudienceInput.audienceSettings?.currency || ''
145
+ }
146
+ ]
147
+ }
148
+ };
149
+ const statsName = 'createAudience';
150
+ statsTags?.push(`slug:${destination.slug}`);
151
+ statsClient?.incr(`${statsName}.call`, 1, statsTags);
152
+ try {
153
+ const response = await request(`${endpoint}/amc/audiences/metadata`, {
154
+ method: 'POST',
155
+ json: payload
156
+ });
157
+ const r = await response.json();
158
+ const externalId = r.data.audienceId;
159
+ if (!externalId) {
160
+ statsClient?.incr(`${statsName}.error`, 1, statsTags);
161
+ throw new actions_core_1.IntegrationError('Invalid response from create audience request', 'INVALID_RESPONSE', 400);
162
+ }
163
+ statsClient?.incr(`${statsName}.success`, 1, statsTags);
164
+ return {
165
+ externalId
166
+ };
167
+ }
168
+ catch (e) {
169
+ const error = e;
170
+ const { message } = JSON.parse(error.response.data);
171
+ throw new actions_core_1.APIError(message, error.response.status);
172
+ }
173
+ },
174
+ async getAudience(request, getAudienceInput) {
175
+ const { statsContext } = getAudienceInput;
176
+ const audience_id = getAudienceInput.externalId;
177
+ const endpoint = getAudienceInput.settings.region;
178
+ const { statsClient, tags: statsTags } = statsContext || {};
179
+ const statsName = 'getAudience';
180
+ statsTags?.push(`slug:${destination.slug}`);
181
+ statsClient?.incr(`${statsName}.call`, 1, statsTags);
182
+ if (!audience_id) {
183
+ throw new actions_core_1.IntegrationError('Missing audience_id value', 'MISSING_REQUIRED_FIELD', 400);
184
+ }
185
+ try {
186
+ const response = await request(`${endpoint}/amc/audiences/metadata/${audience_id}`, {
187
+ method: 'GET'
188
+ });
189
+ const r = await response.json();
190
+ const externalId = r.data.audienceId;
191
+ if (externalId !== getAudienceInput.externalId) {
192
+ statsClient?.incr(`${statsName}.error`, 1, statsTags);
193
+ throw new actions_core_1.IntegrationError("Unable to verify ownership over audience. Segment Audience ID doesn't match Amazon Ads ID.", 'INVALID_REQUEST_DATA', 400);
194
+ }
195
+ statsClient?.incr(`${statsName}.success`, 1, statsTags);
196
+ return {
197
+ externalId
198
+ };
199
+ }
200
+ catch (e) {
201
+ const error = e;
202
+ const { message } = JSON.parse(error.response.data);
203
+ throw new actions_core_1.APIError(message, error.response.status);
204
+ }
80
205
  }
81
206
  },
82
207
  actions: {
@@ -1 +1 @@
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;YAC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CAAC;iBACH,CAAC,CAAA;aACH;YAAC,OAAO,CAAM,EAAE;gBACf,MAAM,KAAK,GAAG,CAA4B,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
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/amazon-ads/index.ts"],"names":[],"mappings":";;;;;AACA,wDAA0G;AAK1G,oEAA2C;AAG3C,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,EA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C,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;gBACnD,MAAM,IAAI,uBAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;aACnD;QACH,CAAC;KACF;IACD,OAAO,EAAE;QACP,aAAa,EAAb,uBAAa;KACd;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -1,2 +1,19 @@
1
1
  export interface Payload {
2
+ records: {
3
+ external_user_id: string;
4
+ user_action: string;
5
+ country_code?: string;
6
+ measurements?: string;
7
+ hashedPII: {
8
+ firstname?: string;
9
+ address?: string;
10
+ phone?: string;
11
+ city?: string;
12
+ state?: string;
13
+ email?: string;
14
+ lastname?: string;
15
+ postal?: string;
16
+ }[];
17
+ }[];
18
+ audienceId: number;
2
19
  }
@@ -1,15 +1,122 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const actions_core_1 = require("@segment/actions-core");
3
4
  const action = {
4
- title: 'Sync Audiences',
5
+ title: 'Sync Audience',
5
6
  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
- });
7
+ defaultSubscription: 'event = "Audience Entered" or event = "Audience Exited"',
8
+ fields: {
9
+ records: {
10
+ label: 'Records',
11
+ description: 'Records to create and upload audiences to Amazon DSP.',
12
+ type: 'object',
13
+ multiple: true,
14
+ required: true,
15
+ properties: {
16
+ external_user_id: {
17
+ label: 'External User ID',
18
+ description: 'This is an external user identifier defined by data providers.',
19
+ type: 'string',
20
+ required: true
21
+ },
22
+ user_action: {
23
+ label: 'User Action',
24
+ description: 'A specific key used to define action type.',
25
+ type: 'string',
26
+ required: true,
27
+ choices: [
28
+ { label: `Auto Detect`, value: 'AUTO' },
29
+ { label: `Create`, value: 'CREATE' },
30
+ { label: 'Delete', value: 'DELETE' }
31
+ ],
32
+ default: 'AUTO'
33
+ },
34
+ country_code: {
35
+ label: 'Country Code',
36
+ description: 'A String value representing ISO 3166-1 alpha-2 country code for the members in this audience.',
37
+ type: 'string'
38
+ },
39
+ measurements: {
40
+ label: 'Measurements',
41
+ type: 'string'
42
+ },
43
+ hashedPII: {
44
+ label: `hashed PII`,
45
+ description: 'List of hashed personally-identifiable information records to be matched with Amazon identities for future use. All inputs must be properly normalized and SHA-256 hashed.',
46
+ type: 'object',
47
+ required: true,
48
+ multiple: true,
49
+ properties: {
50
+ firstname: {
51
+ label: 'Measurements',
52
+ type: 'string'
53
+ },
54
+ address: {
55
+ label: 'Measurements',
56
+ type: 'string'
57
+ },
58
+ phone: {
59
+ label: 'Measurements',
60
+ type: 'string'
61
+ },
62
+ city: {
63
+ label: 'Measurements',
64
+ type: 'string'
65
+ },
66
+ state: {
67
+ label: 'Measurements',
68
+ type: 'string'
69
+ },
70
+ email: {
71
+ label: 'Measurements',
72
+ type: 'string'
73
+ },
74
+ lastname: {
75
+ label: 'Measurements',
76
+ type: 'string'
77
+ },
78
+ postal: {
79
+ label: 'Measurements',
80
+ type: 'string'
81
+ }
82
+ }
83
+ }
84
+ }
85
+ },
86
+ audienceId: {
87
+ label: 'Audience ID',
88
+ type: 'number',
89
+ required: true,
90
+ description: 'An number value representing the Amazon audience identifier. This is the identifier that is returned during audience creation.'
91
+ }
92
+ },
93
+ perform: (request, { settings, payload }) => {
94
+ return processPayload(request, settings, payload);
12
95
  }
13
96
  };
97
+ async function processPayload(request, settings, payload) {
98
+ if (payload.audienceId) {
99
+ throw new actions_core_1.PayloadValidationError('Audience ID is required.');
100
+ }
101
+ try {
102
+ const response = await request(`${settings.region}/amc/audiences/records`, {
103
+ method: 'POST',
104
+ json: payload
105
+ });
106
+ const r = await response.json();
107
+ const jobRequestId = r.data.jobRequestId;
108
+ if (!jobRequestId) {
109
+ throw new actions_core_1.IntegrationError('Invalid response from upload audinece record call', 'INVALID_RESPONSE', 400);
110
+ }
111
+ return {
112
+ jobRequestId
113
+ };
114
+ }
115
+ catch (e) {
116
+ const error = e;
117
+ const { message } = JSON.parse(error.response.data);
118
+ throw new actions_core_1.APIError(message, error.response.status);
119
+ }
120
+ }
14
121
  exports.default = action;
15
122
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
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
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/amazon-ads/syncAudiences/index.ts"],"names":[],"mappings":";;AACA,wDAA0F;AAK1F,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,qDAAqD;IAClE,mBAAmB,EAAE,yDAAyD;IAC9E,MAAM,EAAE;QACN,OAAO,EAAE;YACP,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,uDAAuD;YACpE,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE;gBACV,gBAAgB,EAAE;oBAChB,KAAK,EAAE,kBAAkB;oBACzB,WAAW,EAAE,gEAAgE;oBAC7E,IAAI,EAAE,QAAQ;oBACd,QAAQ,EAAE,IAAI;iBACf;gBACD,WAAW,EAAE;oBACX,KAAK,EAAE,aAAa;oBACpB,WAAW,EAAE,4CAA4C;oBACzD,IAAI,EAAE,QAAQ;oB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 export declare class AmazonAdsError extends HTTPError {
3
+ response: Response & {
4
+ data: string;
5
+ };
6
+ }
@@ -0,0 +1,8 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/destinations/amazon-ads/utils.ts"],"names":[],"mappings":";;;AAAA,wDAAiD;AAEjD,MAAa,cAAe,SAAQ,wBAAS;CAI5C;AAJD,wCAIC"}
@@ -9,7 +9,7 @@ export declare const dateStringToFuzzyDate: (dateString: string | number) => fal
9
9
  y: string;
10
10
  };
11
11
  export declare const augmentFieldsWithConstituentFields: (fields: Record<string, InputField>) => Record<string, InputField>;
12
- export declare const splitConstituentPayload: (payload: CreateOrUpdateIndividualConstituentPayload) => (Partial<Phone> | Partial<Constituent> | Partial<Address> | Partial<OnlinePresence>)[];
12
+ export declare const splitConstituentPayload: (payload: CreateOrUpdateIndividualConstituentPayload) => (Partial<Address> | Partial<OnlinePresence> | Partial<Phone> | Partial<Constituent>)[];
13
13
  export declare const buildConstituentPayloadFromPayload: (payload: StringIndexedObject) => Partial<CreateOrUpdateIndividualConstituentPayload>;
14
14
  export declare const buildGiftDataFromPayload: (constituentId: string, payload: CreateGiftPayload) => Partial<Gift>;
15
15
  export declare const buildConstituentActionDataFromPayload: (constituentId: string, payload: CreateConstituentAction) => Partial<ConstituentAction>;
@@ -0,0 +1,184 @@
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 test_data_1 = require("../../../../lib/test-data");
8
+ const index_1 = __importDefault(require("../../index"));
9
+ const nock_1 = __importDefault(require("nock"));
10
+ const testDestination = actions_core_1.createTestIntegration(index_1.default);
11
+ const actionSlug = 'updateUserProfile';
12
+ const destinationSlug = 'Braze';
13
+ const seedName = `${destinationSlug}#${actionSlug}`;
14
+ const receivedAt = '2021-08-03T17:40:04.055Z';
15
+ const settings = {
16
+ app_id: 'my-app-id',
17
+ api_key: 'my-api-key',
18
+ endpoint: 'https://rest.iad-01.braze.com'
19
+ };
20
+ describe(`Testing snapshot for ${destinationSlug}'s ${actionSlug} destination action:`, () => {
21
+ it('required fields', async () => {
22
+ const action = index_1.default.actions[actionSlug];
23
+ const [eventData, settingsData] = test_data_1.generateTestData(seedName, index_1.default, action, true);
24
+ nock_1.default(/.*/).persist().get(/.*/).reply(200);
25
+ nock_1.default(/.*/).persist().post(/.*/).reply(200);
26
+ nock_1.default(/.*/).persist().put(/.*/).reply(200);
27
+ const event = actions_core_1.createTestEvent({
28
+ properties: eventData
29
+ });
30
+ const responses = await testDestination.testAction(actionSlug, {
31
+ event: event,
32
+ mapping: event.properties,
33
+ settings: settingsData,
34
+ auth: undefined
35
+ });
36
+ const request = responses[0].request;
37
+ const rawBody = await request.text();
38
+ try {
39
+ const json = JSON.parse(rawBody);
40
+ expect(json).toMatchSnapshot();
41
+ return;
42
+ }
43
+ catch (err) {
44
+ expect(rawBody).toMatchSnapshot();
45
+ }
46
+ expect(request.headers).toMatchSnapshot();
47
+ });
48
+ it('all fields', async () => {
49
+ const action = index_1.default.actions[actionSlug];
50
+ const [eventData, settingsData] = test_data_1.generateTestData(seedName, index_1.default, action, false);
51
+ nock_1.default(/.*/).persist().get(/.*/).reply(200);
52
+ nock_1.default(/.*/).persist().post(/.*/).reply(200);
53
+ nock_1.default(/.*/).persist().put(/.*/).reply(200);
54
+ const event = actions_core_1.createTestEvent({
55
+ properties: eventData
56
+ });
57
+ const responses = await testDestination.testAction(actionSlug, {
58
+ event: event,
59
+ mapping: event.properties,
60
+ settings: settingsData,
61
+ auth: undefined
62
+ });
63
+ const request = responses[0].request;
64
+ const rawBody = await request.text();
65
+ try {
66
+ const json = JSON.parse(rawBody);
67
+ expect(json).toMatchSnapshot();
68
+ return;
69
+ }
70
+ catch (err) {
71
+ expect(rawBody).toMatchSnapshot();
72
+ }
73
+ });
74
+ it('it should work with batched events', async () => {
75
+ nock_1.default('https://rest.iad-01.braze.com').post('/users/track').reply(200, {});
76
+ const events = [
77
+ actions_core_1.createTestEvent({
78
+ event: 'Test Event 1',
79
+ type: 'track',
80
+ receivedAt,
81
+ properties: {}
82
+ }),
83
+ actions_core_1.createTestEvent({
84
+ event: 'Test Event 2',
85
+ type: 'track',
86
+ receivedAt,
87
+ properties: {}
88
+ })
89
+ ];
90
+ const responses = await testDestination.testBatchAction(actionSlug, {
91
+ events,
92
+ useDefaultMappings: true,
93
+ mapping: {
94
+ external_id: {
95
+ '@path': '$.userId'
96
+ },
97
+ user_alias: {},
98
+ braze_id: {
99
+ '@path': '$.properties.braze_id'
100
+ },
101
+ name: {
102
+ '@path': '$.event'
103
+ },
104
+ time: {
105
+ '@path': '$.receivedAt'
106
+ },
107
+ properties: {
108
+ '@path': '$.properties'
109
+ },
110
+ products: {
111
+ '@path': '$.properties.products'
112
+ },
113
+ enable_batching: true,
114
+ _update_existing_only: true
115
+ },
116
+ settings: {
117
+ ...settings
118
+ }
119
+ });
120
+ expect(responses.length).toBe(1);
121
+ expect(responses[0].status).toBe(200);
122
+ expect(responses[0].options.headers).toMatchSnapshot();
123
+ expect(responses[0].options.json).toMatchSnapshot();
124
+ });
125
+ it('it should work with a single batched events', async () => {
126
+ nock_1.default('https://rest.iad-01.braze.com').post('/users/track').reply(200, {});
127
+ const events = [
128
+ actions_core_1.createTestEvent({
129
+ event: 'Test Event 1',
130
+ type: 'track',
131
+ receivedAt,
132
+ properties: {
133
+ products: [
134
+ {
135
+ quantity: 1,
136
+ product_id: 'Bowflex Treadmill 10',
137
+ price: 100
138
+ },
139
+ {
140
+ quantity: 2,
141
+ product_id: 'Bowflex Treadmill 20',
142
+ price: 200
143
+ }
144
+ ]
145
+ }
146
+ })
147
+ ];
148
+ const responses = await testDestination.testBatchAction(actionSlug, {
149
+ events,
150
+ useDefaultMappings: true,
151
+ mapping: {
152
+ external_id: {
153
+ '@path': '$.userId'
154
+ },
155
+ user_alias: {},
156
+ braze_id: {
157
+ '@path': '$.properties.braze_id'
158
+ },
159
+ name: {
160
+ '@path': '$.event'
161
+ },
162
+ time: {
163
+ '@path': '$.receivedAt'
164
+ },
165
+ properties: {
166
+ '@path': '$.properties'
167
+ },
168
+ products: {
169
+ '@path': '$.properties.products'
170
+ },
171
+ enable_batching: true,
172
+ _update_existing_only: true
173
+ },
174
+ settings: {
175
+ ...settings
176
+ }
177
+ });
178
+ expect(responses.length).toBe(1);
179
+ expect(responses[0].status).toBe(200);
180
+ expect(responses[0].options.headers).toMatchSnapshot();
181
+ expect(responses[0].options.json).toMatchSnapshot();
182
+ });
183
+ });
184
+ //# sourceMappingURL=snapshot.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.test.js","sourceRoot":"","sources":["../../../../../src/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.ts"],"names":[],"mappings":";;;;;AAAA,wDAA4F;AAC5F,yDAA4D;AAC5D,wDAAqC;AACrC,gDAAuB;AAEvB,MAAM,eAAe,GAAG,oCAAqB,CAAC,eAAW,CAAC,CAAA;AAC1D,MAAM,UAAU,GAAG,mBAAmB,CAAA;AACtC,MAAM,eAAe,GAAG,OAAO,CAAA;AAC/B,MAAM,QAAQ,GAAG,GAAG,eAAe,IAAI,UAAU,EAAE,CAAA;AACnD,MAAM,UAAU,GAAG,0BAA0B,CAAA;AAC7C,MAAM,QAAQ,GAAG;IACf,MAAM,EAAE,WAAW;IACnB,OAAO,EAAE,YAAY;IACrB,QAAQ,EAAE,+BAAwC;CACnD,CAAA;AAED,QAAQ,CAAC,wBAAwB,eAAe,MAAM,UAAU,sBAAsB,EAAE,G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AAe,EAAE,IAAI;gBACrB,qBAAqB,EAAE,IAAI;aAC5B;YACD,QAAQ,EAAE;gBACR,GAAG,QAAQ;aACZ;SACF,CAAC,CAAA;QAEF,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAChC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACrC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,CAAA;QACtD,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAA;IACrD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  export declare const trackApiEndpoint: ({ accountRegion }: {
2
2
  accountRegion?: string | undefined;
3
- }) => "https://track.customer.io" | "https://track-eu.customer.io";
3
+ }) => "https://track-eu.customer.io" | "https://track.customer.io";
4
4
  export declare enum AccountRegion {
5
5
  US = "US \uD83C\uDDFA\uD83C\uDDF8",
6
6
  EU = "EU \uD83C\uDDEA\uD83C\uDDFA"
@@ -18,7 +18,7 @@ export declare abstract class EngageActionPerformer<TSettings = any, TPayload =
18
18
  readonly settings: TSettings;
19
19
  constructor(requestClient: RequestClient, executeInput: ExecuteInput<TSettings, TPayload>);
20
20
  beforePerform?(): void | Promise<void>;
21
- perform(): Promise<void>;
21
+ perform(): Promise<TReturn>;
22
22
  abstract doPerform(): MaybePromise<TReturn>;
23
23
  abstract getIntegrationStatsName(): string;
24
24
  abstract getChannelType(): string;
@@ -17,7 +17,6 @@ const isDestinationActionService_1 = require("./isDestinationActionService");
17
17
  const ResponseError_1 = require("./ResponseError");
18
18
  const IntegrationErrorWrapper_1 = require("./IntegrationErrorWrapper");
19
19
  const truncate_1 = __importDefault(require("lodash/truncate"));
20
- const actions_core_1 = require("@segment/actions-core");
21
20
  class EngageActionPerformer {
22
21
  constructor(requestClient, executeInput) {
23
22
  this.requestClient = requestClient;
@@ -29,7 +28,8 @@ class EngageActionPerformer {
29
28
  this.settings = executeInput.settings;
30
29
  }
31
30
  async perform() {
32
- throw new actions_core_1.RetryableError('Timeout error in engage action performer, retrying...', 408);
31
+ await this.beforePerform?.();
32
+ return this.doPerform();
33
33
  }
34
34
  async request(url, options) {
35
35
  const op = this.currentOperation;
@@ -75,20 +75,6 @@ class EngageActionPerformer {
75
75
  }
76
76
  }
77
77
  });
78
- op?.onCatch.push(() => {
79
- const respError = op?.error;
80
- if (respError) {
81
- const errorDetails = ResponseError_1.getErrorDetails(respError);
82
- const msgLowercare = errorDetails?.message?.toLowerCase();
83
- const isTimeoutErrorInOnCatch = msgLowercare?.includes('timeout') ||
84
- msgLowercare?.includes('timedout') ||
85
- msgLowercare?.includes('exceeded the deadline') ||
86
- errorDetails.code?.toLowerCase().includes('etimedout');
87
- if (isTimeoutErrorInOnCatch) {
88
- op.error = new actions_core_1.RetryableError('Timeout error in on Catch, retrying...', 408);
89
- }
90
- }
91
- });
92
78
  return await this.requestClient(url, options);
93
79
  }
94
80
  redactPii(pii) {
@@ -147,8 +133,7 @@ __decorate([
147
133
  __decorate([
148
134
  track_1.track({
149
135
  onTry: addUrlToLog,
150
- onFinally: addUrlToLog,
151
- onCatch: addUrlToLog
136
+ onFinally: addUrlToLog
152
137
  })
153
138
  ], EngageActionPerformer.prototype, "request", null);
154
139
  exports.EngageActionPerformer = EngageActionPerformer;