@segment/action-destinations 3.267.1-staging.5 → 3.268.0-staging-04ac1fc1b

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 (273) hide show
  1. package/dist/destinations/amazon-ads/generated-types.d.ts +0 -9
  2. package/dist/destinations/amazon-ads/index.d.ts +2 -2
  3. package/dist/destinations/amazon-ads/index.js +6 -164
  4. package/dist/destinations/amazon-ads/index.js.map +1 -1
  5. package/dist/destinations/amazon-ads/syncAudiences/generated-types.d.ts +0 -13
  6. package/dist/destinations/amazon-ads/syncAudiences/index.js +7 -201
  7. package/dist/destinations/amazon-ads/syncAudiences/index.js.map +1 -1
  8. package/dist/destinations/amazon-ads/types.d.ts +0 -25
  9. package/dist/destinations/amplitude/user-agent.d.ts +1 -0
  10. package/dist/destinations/amplitude/user-agent.js +2 -1
  11. package/dist/destinations/amplitude/user-agent.js.map +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/contentstack/constants.d.ts +3 -0
  16. package/dist/destinations/contentstack/constants.js +7 -0
  17. package/dist/destinations/contentstack/constants.js.map +1 -0
  18. package/dist/destinations/contentstack/customAttributesSync/generated-types.d.ts +6 -0
  19. package/dist/destinations/contentstack/customAttributesSync/generated-types.js +3 -0
  20. package/dist/destinations/contentstack/customAttributesSync/generated-types.js.map +1 -0
  21. package/dist/destinations/contentstack/customAttributesSync/index.d.ts +5 -0
  22. package/dist/destinations/contentstack/customAttributesSync/index.js +45 -0
  23. package/dist/destinations/contentstack/customAttributesSync/index.js.map +1 -0
  24. package/dist/destinations/contentstack/customAttributesSync/types.d.ts +14 -0
  25. package/dist/destinations/contentstack/customAttributesSync/types.js +3 -0
  26. package/dist/destinations/contentstack/customAttributesSync/types.js.map +1 -0
  27. package/dist/destinations/contentstack/customAttributesSync/utils.d.ts +4 -0
  28. package/dist/destinations/contentstack/customAttributesSync/utils.js +21 -0
  29. package/dist/destinations/contentstack/customAttributesSync/utils.js.map +1 -0
  30. package/dist/destinations/contentstack/generated-types.d.ts +4 -0
  31. package/dist/destinations/contentstack/generated-types.js +3 -0
  32. package/dist/destinations/contentstack/generated-types.js.map +1 -0
  33. package/dist/destinations/contentstack/index.d.ts +4 -0
  34. package/dist/destinations/contentstack/index.js +58 -0
  35. package/dist/destinations/contentstack/index.js.map +1 -0
  36. package/dist/destinations/contentstack/types.d.ts +12 -0
  37. package/dist/destinations/contentstack/types.js +3 -0
  38. package/dist/destinations/contentstack/types.js.map +1 -0
  39. package/dist/destinations/dynamic-yield-audiences/syncAudience/types.d.ts +22 -0
  40. package/dist/destinations/dynamic-yield-audiences/syncAudience/types.js +3 -0
  41. package/dist/destinations/dynamic-yield-audiences/syncAudience/types.js.map +1 -0
  42. package/dist/destinations/dynamic-yield-audiences/types.d.ts +8 -0
  43. package/dist/destinations/dynamic-yield-audiences/types.js +12 -0
  44. package/dist/destinations/dynamic-yield-audiences/types.js.map +1 -0
  45. package/dist/destinations/engage/sendgrid/Profile.d.ts +6 -0
  46. package/dist/destinations/engage/sendgrid/Profile.js +3 -0
  47. package/dist/destinations/engage/sendgrid/Profile.js.map +1 -0
  48. package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.d.ts +21 -0
  49. package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js +174 -0
  50. package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js.map +1 -0
  51. package/dist/destinations/engage/utils/track.d.ts +17 -17
  52. package/dist/destinations/facebook-conversions-api/fb-capi-properties.js +3 -1
  53. package/dist/destinations/facebook-conversions-api/fb-capi-properties.js.map +1 -1
  54. package/dist/destinations/index.js +2 -0
  55. package/dist/destinations/index.js.map +1 -1
  56. package/dist/destinations/insider/index.js +5 -1
  57. package/dist/destinations/insider/index.js.map +1 -1
  58. package/dist/destinations/klaviyo/functions.d.ts +15 -0
  59. package/dist/destinations/klaviyo/functions.js +53 -1
  60. package/dist/destinations/klaviyo/functions.js.map +1 -1
  61. package/dist/destinations/klaviyo/removeProfileToList/generated-types.d.ts +4 -0
  62. package/dist/destinations/klaviyo/removeProfileToList/generated-types.js +3 -0
  63. package/dist/destinations/klaviyo/removeProfileToList/generated-types.js.map +1 -0
  64. package/dist/destinations/klaviyo/removeProfileToList/index.d.ts +5 -0
  65. package/dist/destinations/klaviyo/removeProfileToList/index.js +43 -0
  66. package/dist/destinations/klaviyo/removeProfileToList/index.js.map +1 -0
  67. package/dist/destinations/klaviyo/upsertProfile/generated-types.d.ts +12 -0
  68. package/dist/destinations/klaviyo/upsertProfile/index.js +80 -4
  69. package/dist/destinations/klaviyo/upsertProfile/index.js.map +1 -1
  70. package/dist/destinations/mixpanel/mixpanel-properties.js +1 -0
  71. package/dist/destinations/mixpanel/mixpanel-properties.js.map +1 -1
  72. package/dist/destinations/mixpanel/utils.d.ts +13 -0
  73. package/dist/destinations/mixpanel/utils.js +117 -0
  74. package/dist/destinations/mixpanel/utils.js.map +1 -0
  75. package/dist/destinations/moloco-rmp/common/convert.js +17 -29
  76. package/dist/destinations/moloco-rmp/common/convert.js.map +1 -1
  77. package/dist/destinations/movable-ink/categoryView/generated-types.d.ts +22 -0
  78. package/dist/destinations/movable-ink/categoryView/generated-types.js +3 -0
  79. package/dist/destinations/movable-ink/categoryView/generated-types.js.map +1 -0
  80. package/dist/destinations/movable-ink/categoryView/index.d.ts +5 -0
  81. package/dist/destinations/movable-ink/categoryView/index.js +43 -0
  82. package/dist/destinations/movable-ink/categoryView/index.js.map +1 -0
  83. package/dist/destinations/movable-ink/conversion/generated-types.d.ts +20 -0
  84. package/dist/destinations/movable-ink/conversion/generated-types.js +3 -0
  85. package/dist/destinations/movable-ink/conversion/generated-types.js.map +1 -0
  86. package/dist/destinations/movable-ink/conversion/index.d.ts +5 -0
  87. package/dist/destinations/movable-ink/conversion/index.js +45 -0
  88. package/dist/destinations/movable-ink/conversion/index.js.map +1 -0
  89. package/dist/destinations/movable-ink/fields.d.ts +21 -0
  90. package/dist/destinations/movable-ink/fields.js +236 -0
  91. package/dist/destinations/movable-ink/fields.js.map +1 -0
  92. package/dist/destinations/movable-ink/identify/generated-types.d.ts +7 -0
  93. package/dist/destinations/movable-ink/identify/generated-types.js +3 -0
  94. package/dist/destinations/movable-ink/identify/generated-types.js.map +1 -0
  95. package/dist/destinations/movable-ink/identify/index.d.ts +5 -0
  96. package/dist/destinations/movable-ink/identify/index.js +32 -0
  97. package/dist/destinations/movable-ink/identify/index.js.map +1 -0
  98. package/dist/destinations/movable-ink/productAdded/generated-types.d.ts +22 -0
  99. package/dist/destinations/movable-ink/productAdded/generated-types.js +3 -0
  100. package/dist/destinations/movable-ink/productAdded/generated-types.js.map +1 -0
  101. package/dist/destinations/movable-ink/productAdded/index.d.ts +5 -0
  102. package/dist/destinations/movable-ink/productAdded/index.js +43 -0
  103. package/dist/destinations/movable-ink/productAdded/index.js.map +1 -0
  104. package/dist/destinations/movable-ink/productViewed/generated-types.d.ts +21 -0
  105. package/dist/destinations/movable-ink/productViewed/generated-types.js +3 -0
  106. package/dist/destinations/movable-ink/productViewed/generated-types.js.map +1 -0
  107. package/dist/destinations/movable-ink/productViewed/index.d.ts +5 -0
  108. package/dist/destinations/movable-ink/productViewed/index.js +43 -0
  109. package/dist/destinations/movable-ink/productViewed/index.js.map +1 -0
  110. package/dist/destinations/movable-ink/search/generated-types.d.ts +12 -0
  111. package/dist/destinations/movable-ink/search/generated-types.js +3 -0
  112. package/dist/destinations/movable-ink/search/generated-types.js.map +1 -0
  113. package/dist/destinations/movable-ink/search/index.d.ts +5 -0
  114. package/dist/destinations/movable-ink/search/index.js +43 -0
  115. package/dist/destinations/movable-ink/search/index.js.map +1 -0
  116. package/dist/destinations/movable-ink/sendCustomEvent/generated-types.d.ts +25 -0
  117. package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js +3 -0
  118. package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js.map +1 -0
  119. package/dist/destinations/movable-ink/sendCustomEvent/index.d.ts +5 -0
  120. package/dist/destinations/movable-ink/sendCustomEvent/index.js +48 -0
  121. package/dist/destinations/movable-ink/sendCustomEvent/index.js.map +1 -0
  122. package/dist/destinations/responsys/asyncMergePetRecords/generated-types.d.ts +14 -0
  123. package/dist/destinations/responsys/asyncMergePetRecords/generated-types.js +3 -0
  124. package/dist/destinations/responsys/asyncMergePetRecords/generated-types.js.map +1 -0
  125. package/dist/destinations/responsys/asyncMergePetRecords/index.d.ts +5 -0
  126. package/dist/destinations/responsys/asyncMergePetRecords/index.js +113 -0
  127. package/dist/destinations/responsys/asyncMergePetRecords/index.js.map +1 -0
  128. package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.d.ts +20 -0
  129. package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.js +3 -0
  130. package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.js.map +1 -0
  131. package/dist/destinations/responsys/asyncMergeProfileListMembers/index.d.ts +5 -0
  132. package/dist/destinations/responsys/asyncMergeProfileListMembers/index.js +174 -0
  133. package/dist/destinations/responsys/asyncMergeProfileListMembers/index.js.map +1 -0
  134. package/dist/destinations/responsys/rsp-operations.d.ts +14 -0
  135. package/dist/destinations/responsys/rsp-operations.js +33 -0
  136. package/dist/destinations/responsys/rsp-operations.js.map +1 -0
  137. package/dist/destinations/responsys/rsp-properties.d.ts +4 -0
  138. package/dist/destinations/responsys/rsp-properties.js +27 -0
  139. package/dist/destinations/responsys/rsp-properties.js.map +1 -0
  140. package/dist/destinations/responsys-cloud/generated-types.d.ts +20 -0
  141. package/dist/destinations/responsys-cloud/generated-types.js +3 -0
  142. package/dist/destinations/responsys-cloud/generated-types.js.map +1 -0
  143. package/dist/destinations/responsys-cloud/index.d.ts +4 -0
  144. package/dist/destinations/responsys-cloud/index.js +207 -0
  145. package/dist/destinations/responsys-cloud/index.js.map +1 -0
  146. package/dist/destinations/responsys-cloud/sendAudience/generated-types.d.ts +16 -0
  147. package/dist/destinations/responsys-cloud/sendAudience/generated-types.js +3 -0
  148. package/dist/destinations/responsys-cloud/sendAudience/generated-types.js.map +1 -0
  149. package/dist/destinations/responsys-cloud/sendAudience/index.d.ts +5 -0
  150. package/dist/destinations/responsys-cloud/sendAudience/index.js +109 -0
  151. package/dist/destinations/responsys-cloud/sendAudience/index.js.map +1 -0
  152. package/dist/destinations/responsys-cloud/sendCustomTraits/generated-types.d.ts +11 -0
  153. package/dist/destinations/responsys-cloud/sendCustomTraits/generated-types.js +3 -0
  154. package/dist/destinations/responsys-cloud/sendCustomTraits/generated-types.js.map +1 -0
  155. package/dist/destinations/responsys-cloud/sendCustomTraits/index.d.ts +5 -0
  156. package/dist/destinations/responsys-cloud/sendCustomTraits/index.js +72 -0
  157. package/dist/destinations/responsys-cloud/sendCustomTraits/index.js.map +1 -0
  158. package/dist/destinations/responsys-cloud/shared_properties.d.ts +3 -0
  159. package/dist/destinations/responsys-cloud/shared_properties.js +19 -0
  160. package/dist/destinations/responsys-cloud/shared_properties.js.map +1 -0
  161. package/dist/destinations/responsys-cloud/types.d.ts +38 -0
  162. package/dist/destinations/responsys-cloud/types.js +3 -0
  163. package/dist/destinations/responsys-cloud/types.js.map +1 -0
  164. package/dist/destinations/responsys-cloud/upsertListMember/generated-types.d.ts +14 -0
  165. package/dist/destinations/responsys-cloud/upsertListMember/generated-types.js +3 -0
  166. package/dist/destinations/responsys-cloud/upsertListMember/generated-types.js.map +1 -0
  167. package/dist/destinations/responsys-cloud/upsertListMember/index.d.ts +5 -0
  168. package/dist/destinations/responsys-cloud/upsertListMember/index.js +85 -0
  169. package/dist/destinations/responsys-cloud/upsertListMember/index.js.map +1 -0
  170. package/dist/destinations/responsys-cloud/utils.d.ts +20 -0
  171. package/dist/destinations/responsys-cloud/utils.js +179 -0
  172. package/dist/destinations/responsys-cloud/utils.js.map +1 -0
  173. package/dist/destinations/ripe/group/generated-types.d.ts +3 -0
  174. package/dist/destinations/ripe/group/index.js +9 -1
  175. package/dist/destinations/ripe/group/index.js.map +1 -1
  176. package/dist/destinations/ripe/identify/generated-types.d.ts +3 -1
  177. package/dist/destinations/ripe/identify/index.js +7 -9
  178. package/dist/destinations/ripe/identify/index.js.map +1 -1
  179. package/dist/destinations/ripe/page/generated-types.d.ts +3 -1
  180. package/dist/destinations/ripe/page/index.js +7 -7
  181. package/dist/destinations/ripe/page/index.js.map +1 -1
  182. package/dist/destinations/ripe/track/generated-types.d.ts +3 -1
  183. package/dist/destinations/ripe/track/index.js +8 -10
  184. package/dist/destinations/ripe/track/index.js.map +1 -1
  185. package/dist/destinations/salesforce/account/index.js +21 -5
  186. package/dist/destinations/salesforce/account/index.js.map +1 -1
  187. package/dist/destinations/salesforce/cases/index.js +21 -5
  188. package/dist/destinations/salesforce/cases/index.js.map +1 -1
  189. package/dist/destinations/salesforce/contact/index.js +21 -5
  190. package/dist/destinations/salesforce/contact/index.js.map +1 -1
  191. package/dist/destinations/salesforce/customObject/index.js +22 -6
  192. package/dist/destinations/salesforce/customObject/index.js.map +1 -1
  193. package/dist/destinations/salesforce/generated-types.d.ts +3 -0
  194. package/dist/destinations/salesforce/index.d.ts +1 -1
  195. package/dist/destinations/salesforce/index.js +20 -0
  196. package/dist/destinations/salesforce/index.js.map +1 -1
  197. package/dist/destinations/salesforce/lead/index.js +21 -5
  198. package/dist/destinations/salesforce/lead/index.js.map +1 -1
  199. package/dist/destinations/salesforce/opportunity/index.js +21 -5
  200. package/dist/destinations/salesforce/opportunity/index.js.map +1 -1
  201. package/dist/destinations/salesforce/sf-operations.d.ts +4 -1
  202. package/dist/destinations/salesforce/sf-operations.js +47 -1
  203. package/dist/destinations/salesforce/sf-operations.js.map +1 -1
  204. package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.d.ts +1 -0
  205. package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.js +381 -0
  206. package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.js.map +1 -0
  207. package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.d.ts +1 -0
  208. package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.js +581 -0
  209. package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.js.map +1 -0
  210. package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.d.ts +4 -0
  211. package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.js +97 -0
  212. package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.js.map +1 -0
  213. package/dist/destinations/snap-conversions-api/snap-capi-properties.d.ts +30 -0
  214. package/dist/destinations/snap-conversions-api/snap-capi-properties.js +316 -0
  215. package/dist/destinations/snap-conversions-api/snap-capi-properties.js.map +1 -0
  216. package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.d.ts +3 -0
  217. package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.js +34 -0
  218. package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.js.map +1 -0
  219. package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.d.ts +3 -0
  220. package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.js +43 -0
  221. package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.js.map +1 -0
  222. package/dist/destinations/trackey/group.types.d.ts +11 -0
  223. package/dist/destinations/trackey/group.types.js +3 -0
  224. package/dist/destinations/trackey/group.types.js.map +1 -0
  225. package/dist/destinations/trackey/identify.types.d.ts +11 -0
  226. package/dist/destinations/trackey/identify.types.js +3 -0
  227. package/dist/destinations/trackey/identify.types.js.map +1 -0
  228. package/dist/destinations/trackey/track.types.d.ts +12 -0
  229. package/dist/destinations/trackey/track.types.js +3 -0
  230. package/dist/destinations/trackey/track.types.js.map +1 -0
  231. package/dist/destinations/trubrics/generated-types.d.ts +4 -0
  232. package/dist/destinations/trubrics/generated-types.js +3 -0
  233. package/dist/destinations/trubrics/generated-types.js.map +1 -0
  234. package/dist/destinations/trubrics/index.d.ts +4 -0
  235. package/dist/destinations/trubrics/index.js +34 -0
  236. package/dist/destinations/trubrics/index.js.map +1 -0
  237. package/dist/destinations/trubrics/track/generated-types.d.ts +15 -0
  238. package/dist/destinations/trubrics/track/generated-types.js +3 -0
  239. package/dist/destinations/trubrics/track/generated-types.js.map +1 -0
  240. package/dist/destinations/trubrics/track/index.d.ts +5 -0
  241. package/dist/destinations/trubrics/track/index.js +83 -0
  242. package/dist/destinations/trubrics/track/index.js.map +1 -0
  243. package/dist/destinations/usermotion/group/generated-types.d.ts +2 -1
  244. package/dist/destinations/usermotion/group/index.js +17 -14
  245. package/dist/destinations/usermotion/group/index.js.map +1 -1
  246. package/dist/destinations/usermotion/identify/index.js +2 -2
  247. package/dist/destinations/usermotion/identify/index.js.map +1 -1
  248. package/dist/destinations/usermotion/index.js +5 -1
  249. package/dist/destinations/usermotion/index.js.map +1 -1
  250. package/dist/destinations/usermotion/track/generated-types.d.ts +4 -2
  251. package/dist/destinations/usermotion/track/index.js +12 -16
  252. package/dist/destinations/usermotion/track/index.js.map +1 -1
  253. package/dist/destinations/xtremepush/identify/index.js +2 -2
  254. package/dist/destinations/xtremepush/identify/index.js.map +1 -1
  255. package/dist/destinations/xtremepush/index.js.map +1 -1
  256. package/dist/destinations/xtremepush/track/index.js +2 -2
  257. package/dist/destinations/xtremepush/track/index.js.map +1 -1
  258. package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.d.ts +4 -0
  259. package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.js +3 -0
  260. package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.js.map +1 -0
  261. package/dist/destinations/yahoo-audiences/createCustomerNode/index.d.ts +5 -0
  262. package/dist/destinations/yahoo-audiences/createCustomerNode/index.js +33 -0
  263. package/dist/destinations/yahoo-audiences/createCustomerNode/index.js.map +1 -0
  264. package/dist/destinations/yahoo-audiences/createSegment/generated-types.d.ts +6 -0
  265. package/dist/destinations/yahoo-audiences/createSegment/generated-types.js +3 -0
  266. package/dist/destinations/yahoo-audiences/createSegment/generated-types.js.map +1 -0
  267. package/dist/destinations/yahoo-audiences/createSegment/index.d.ts +5 -0
  268. package/dist/destinations/yahoo-audiences/createSegment/index.js +45 -0
  269. package/dist/destinations/yahoo-audiences/createSegment/index.js.map +1 -0
  270. package/dist/destinations/yahoo-audiences/utils.d.ts +4 -0
  271. package/dist/destinations/yahoo-audiences/utils.js +30 -0
  272. package/dist/destinations/yahoo-audiences/utils.js.map +1 -0
  273. package/package.json +4 -4
@@ -1,12 +1,3 @@
1
1
  export interface Settings {
2
2
  region: string;
3
3
  }
4
- export interface AudienceSettings {
5
- description: string;
6
- countryCode: string;
7
- externalAudienceId: string;
8
- cpmCents?: number;
9
- currency?: string;
10
- ttl?: number;
11
- advertiserId: string;
12
- }
@@ -1,4 +1,4 @@
1
1
  import type { AudienceDestinationDefinition } from '@segment/actions-core';
2
- import type { Settings, AudienceSettings } from './generated-types';
3
- declare const destination: AudienceDestinationDefinition<Settings, AudienceSettings>;
2
+ import type { Settings } from './generated-types';
3
+ declare const destination: AudienceDestinationDefinition<Settings>;
4
4
  export default destination;
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const actions_core_1 = require("@segment/actions-core");
7
- const utils_1 = require("./utils");
8
7
  const syncAudiences_1 = __importDefault(require("./syncAudiences"));
9
8
  const destination = {
10
9
  name: 'Amazon Ads',
@@ -21,17 +20,17 @@ const destination = {
21
20
  { label: 'Europe (EU)', value: 'https://advertising-api-eu.amazon.com' },
22
21
  { label: 'Far East (FE)', value: 'https://advertising-api-fe.amazon.com' }
23
22
  ],
24
- default: 'https://advertising-api.amazon.com',
23
+ default: 'North America (NA)',
25
24
  type: 'string',
26
25
  required: true
27
26
  }
28
27
  },
29
- testAuthentication: async (request, { auth, settings }) => {
28
+ testAuthentication: async (request, { auth }) => {
30
29
  if (!auth?.accessToken) {
31
30
  throw new actions_core_1.InvalidAuthenticationError('Please authenticate via Oauth before enabling the destination.');
32
31
  }
33
32
  try {
34
- await request(`${settings.region}/v2/profiles`, {
33
+ await request('https://advertising-api.amazon.com/v2/profiles', {
35
34
  method: 'GET'
36
35
  });
37
36
  }
@@ -43,16 +42,11 @@ const destination = {
43
42
  throw e;
44
43
  }
45
44
  },
46
- refreshAccessToken: async (request, { auth, settings }) => {
47
- const endpoint = utils_1.AUTHORIZATION_URL[`${settings.region}`];
45
+ refreshAccessToken: async (request, { auth }) => {
48
46
  let res;
49
- console.log(settings.region, auth, endpoint);
50
47
  try {
51
48
  res = await request('https://api.amazon.com/auth/o2/token', {
52
49
  method: 'POST',
53
- headers: {
54
- 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
55
- },
56
50
  body: new URLSearchParams({
57
51
  refresh_token: auth.refreshToken,
58
52
  client_id: auth.clientId,
@@ -62,7 +56,6 @@ const destination = {
62
56
  });
63
57
  }
64
58
  catch (e) {
65
- console.log(e);
66
59
  const error = e;
67
60
  if (error.response?.data?.error === 'invalid_grant') {
68
61
  throw new actions_core_1.IntegrationError(`Invalid Authentication: Your refresh token is invalid or expired. Please re-authenticate to fetch a new refresh token.`, actions_core_1.ErrorCodes.REFRESH_TOKEN_EXPIRED, 401);
@@ -75,166 +68,15 @@ const destination = {
75
68
  extendRequest({ auth }) {
76
69
  return {
77
70
  headers: {
78
- authorization: `Bearer ${auth?.accessToken}`,
79
- 'Amazon-Advertising-API-ClientID': process.env.ACTIONS_AMAZON_ADS_CLIENT_ID || ''
71
+ authorization: `Bearer ${auth?.accessToken}`
80
72
  }
81
73
  };
82
74
  },
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
- },
75
+ audienceFields: {},
125
76
  audienceConfig: {
126
77
  mode: {
127
78
  type: 'synced',
128
79
  full_audience_sync: false
129
- },
130
- async createAudience(request, createAudienceInput) {
131
- const { audienceName, statsContext, audienceSettings } = createAudienceInput;
132
- const { statsClient, tags: statsTags } = statsContext || {};
133
- const statsName = 'createAmazonAudience';
134
- statsTags?.push(`slug:${destination.slug}`);
135
- statsClient?.incr(`${statsName}.intialise`, 1, statsTags);
136
- const endpoint = createAudienceInput.settings.region;
137
- const description = audienceSettings?.description;
138
- const advertiser_id = audienceSettings?.advertiserId;
139
- const external_audience_id = audienceSettings?.externalAudienceId;
140
- const country_code = audienceSettings?.countryCode;
141
- const ttl = audienceSettings?.ttl;
142
- const currency = audienceSettings?.currency;
143
- const cpm_cents = audienceSettings?.cpmCents;
144
- if (!advertiser_id) {
145
- throw new actions_core_1.IntegrationError('Missing advertiserId Value', 'MISSING_REQUIRED_FIELD', 400);
146
- }
147
- if (!description) {
148
- throw new actions_core_1.IntegrationError('Missing description Value', 'MISSING_REQUIRED_FIELD', 400);
149
- }
150
- if (!external_audience_id) {
151
- throw new actions_core_1.IntegrationError('Missing externalAudienceId Value', 'MISSING_REQUIRED_FIELD', 400);
152
- }
153
- if (!audienceName) {
154
- throw new actions_core_1.IntegrationError('Missing audienceName Value', 'MISSING_REQUIRED_FIELD', 400);
155
- }
156
- if (!country_code) {
157
- throw new actions_core_1.IntegrationError('Missing countryCode Value', 'MISSING_REQUIRED_FIELD', 400);
158
- }
159
- const payload = {
160
- name: audienceName,
161
- description: description,
162
- targetResource: {
163
- advertiserId: advertiser_id
164
- },
165
- metadata: {
166
- externalAudienceId: external_audience_id
167
- },
168
- countryCode: country_code
169
- };
170
- if (ttl) {
171
- payload.metadata.ttl = ttl;
172
- }
173
- if (cpm_cents && currency) {
174
- if (!utils_1.CURRENCY.includes(currency)) {
175
- throw new actions_core_1.IntegrationError('Invalid Currency Value', 'INVALID_CURRENCY_VALUE', 400);
176
- }
177
- payload.metadata.audienceFees = [];
178
- payload.metadata?.audienceFees.push({
179
- currency,
180
- cpmCents: cpm_cents
181
- });
182
- }
183
- statsTags?.push(`slug:${destination.slug}`);
184
- statsClient?.incr(`${statsName}.call`, 1, statsTags);
185
- try {
186
- let payloadString = JSON.stringify(payload);
187
- const regex = /"advertiserId":"(\d+)"/;
188
- payloadString = payloadString.replace(regex, '"advertiserId":$1');
189
- const response = await request(`${endpoint}/amc/audiences/metadata`, {
190
- method: 'POST',
191
- body: payloadString,
192
- headers: {
193
- 'Content-Type': 'application/vnd.amcaudiences.v1+json'
194
- }
195
- });
196
- const res = await response.text();
197
- const resString = res.replace(/"audienceId":(\d+)/, '"audienceId":"$1"');
198
- const externalId = JSON.parse(resString)['audienceId'];
199
- statsClient?.incr(`${statsName}.success`, 1, statsTags);
200
- return {
201
- externalId
202
- };
203
- }
204
- catch (e) {
205
- statsTags?.push(`error:${e}`);
206
- statsClient?.incr(`${statsName}.error`, 1, statsTags);
207
- throw e;
208
- }
209
- },
210
- async getAudience(request, getAudienceInput) {
211
- const { statsContext } = getAudienceInput;
212
- const audience_id = getAudienceInput.externalId;
213
- const endpoint = getAudienceInput.settings.region;
214
- const { statsClient, tags: statsTags } = statsContext || {};
215
- const statsName = 'getAudience';
216
- statsTags?.push(`slug:${destination.slug}`);
217
- statsClient?.incr(`${statsName}.call`, 1, statsTags);
218
- if (!audience_id) {
219
- throw new actions_core_1.IntegrationError('Missing audienceId value', 'MISSING_REQUIRED_FIELD', 400);
220
- }
221
- try {
222
- const response = await request(`${endpoint}/amc/audiences/metadata/${audience_id}`, {
223
- method: 'GET'
224
- });
225
- const res = await response.text();
226
- const resString = res.replace(/"audienceId":(\d+)/, '"audienceId":"$1"');
227
- const externalId = JSON.parse(resString)['audienceId'];
228
- statsClient?.incr(`${statsName}.success`, 1, statsTags);
229
- return {
230
- externalId
231
- };
232
- }
233
- catch (e) {
234
- statsTags?.push(`error:${e}`);
235
- statsClient?.incr(`${statsName}.error`, 1, statsTags);
236
- throw e;
237
- }
238
80
  }
239
81
  },
240
82
  actions: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/amazon-ads/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAgG;AAGhG,mCAAsE;AAEtE,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,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;QACP,aAAa,EAAb,uBAAa;KACd;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -1,15 +1,2 @@
1
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
2
  }
@@ -1,209 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const actions_core_1 = require("@segment/actions-core");
4
- const utils_1 = require("../utils");
5
- const crypto_1 = require("crypto");
6
3
  const action = {
7
- title: 'Sync Audience',
4
+ title: 'Sync Audiences',
8
5
  description: 'Sync audiences from Segment to Amazon Ads Audience.',
9
- defaultSubscription: 'event = "Audience Entered" or event = "Audience Exited"',
10
- fields: {
11
- event_name: {
12
- label: 'Event Name',
13
- description: 'The name of the current Segment event.',
14
- type: 'string',
15
- unsafe_hidden: true,
16
- default: {
17
- '@path': '$.event'
18
- }
19
- },
20
- externalUserId: {
21
- label: 'External User ID',
22
- description: 'This is an external user identifier defined by data providers.',
23
- type: 'string',
24
- required: true,
25
- default: { '@path': '$.userId' }
26
- },
27
- email: {
28
- label: 'Email',
29
- description: 'User email address. Vaule will be hashed before sending to Amazon.',
30
- type: 'string',
31
- required: false,
32
- default: { '@path': '$.properties.email' }
33
- },
34
- firstName: {
35
- label: 'First name',
36
- description: 'User first name. Vaue will be hashed before sending to Amazon.',
37
- type: 'string',
38
- required: false,
39
- default: { '@path': '$.properties.first_name' }
40
- },
41
- lastName: {
42
- label: 'Last name',
43
- description: 'User Last name. Vaue will be hashed before sending to Amazon.',
44
- type: 'string',
45
- required: false,
46
- default: { '@path': '$.properties.last_name' }
47
- },
48
- phone: {
49
- label: 'Phone',
50
- description: 'Phone Number. Vaue will be hashed before sending to Amazon.',
51
- type: 'string',
52
- required: false,
53
- default: { '@path': '$.properties.phone' }
54
- },
55
- postal: {
56
- label: 'Postal',
57
- description: 'POstal Code. Vaue will be hashed before sending to Amazon.',
58
- type: 'string',
59
- required: false,
60
- default: { '@path': '$.properties.postal' }
61
- },
62
- state: {
63
- label: 'Postal',
64
- description: 'State Code. Vaue will be hashed before sending to Amazon.',
65
- type: 'string',
66
- required: false,
67
- default: { '@path': '$.properties.state' }
68
- },
69
- city: {
70
- label: 'City',
71
- description: 'City name. Vaue will be hashed before sending to Amazon.',
72
- type: 'string',
73
- required: false,
74
- default: { '@path': '$.properties.city' }
75
- },
76
- address: {
77
- label: 'Address',
78
- description: 'Address Code. Value will be hashed before sending to Amazon.',
79
- type: 'string',
80
- required: false,
81
- default: { '@path': '$.properties.address' }
82
- },
83
- audienceId: {
84
- label: 'Audience ID',
85
- type: 'string',
86
- required: true,
87
- unsafe_hidden: true,
88
- description: 'An number value representing the Amazon audience identifier. This is the identifier that is returned during audience creation.',
89
- default: {
90
- '@path': '$.context.personas.external_audience_id'
91
- }
92
- },
93
- enable_batching: {
94
- label: 'Enable Batching',
95
- description: 'When enabled,segment will send data in batching',
96
- type: 'boolean',
97
- required: true,
98
- default: true
99
- },
100
- batch_size: {
101
- label: 'Batch Size',
102
- description: 'Maximum number of events to include in each batch. Actual batch sizes may be lower.',
103
- type: 'number',
104
- unsafe_hidden: true,
105
- required: false,
106
- default: 10000
107
- }
108
- },
109
- perform: (request, { settings, payload, statsContext, audienceSettings }) => {
110
- return processPayload(request, settings, [payload], statsContext, audienceSettings);
111
- },
112
- performBatch: (request, { settings, payload: payloads, statsContext, audienceSettings }) => {
113
- return processPayload(request, settings, payloads, statsContext, audienceSettings);
114
- }
115
- };
116
- async function processPayload(request, settings, payload, statsContext, audienceSettings) {
117
- const { statsClient, tags: statsTags } = statsContext || {};
118
- const statsName = 'syncAmazonAdsAudience';
119
- statsClient?.incr(`${statsName}.intialise`, 1, statsTags);
120
- try {
121
- const payloadRecord = createPayloadToUploadRecords(payload, audienceSettings);
122
- const payloadString = JSON.stringify(payloadRecord).replace(/"audienceId":"(\d+)"/, '"audienceId":$1');
123
- const response = await request(`${settings.region}/amc/audiences/records`, {
124
- method: 'POST',
125
- body: payloadString,
126
- headers: {
127
- 'Content-Type': 'application/vnd.amcaudiences.v1+json'
128
- }
6
+ fields: {},
7
+ perform: (request, data) => {
8
+ return request('https://example.com', {
9
+ method: 'post',
10
+ json: data.payload
129
11
  });
130
- const result = await response.json();
131
- const jobRequestId = result?.jobRequestId;
132
- statsTags?.push(`jobRequestId:${jobRequestId}`);
133
- statsClient?.incr(`${statsName}.success`, 1, statsTags);
134
- if (!jobRequestId) {
135
- throw new actions_core_1.IntegrationError('Invalid response from upload audinece record call', 'INVALID_RESPONSE', 400);
136
- }
137
- return {
138
- result
139
- };
140
12
  }
141
- catch (e) {
142
- if (e instanceof utils_1.AmazonAdsError) {
143
- const message = JSON.parse(e.response?.data?.message || '');
144
- statsTags?.push(`error:${message}`);
145
- statsClient?.incr(`${statsName}.error`, 1, statsTags);
146
- throw new actions_core_1.APIError(message, e.response?.status);
147
- }
148
- else if (e instanceof actions_core_1.IntegrationError) {
149
- statsTags?.push(`error:${e.message}`);
150
- statsClient?.incr(`${statsName}.error`, 1, statsTags);
151
- throw new actions_core_1.APIError(e.message, 400);
152
- }
153
- else {
154
- statsTags?.push(`error:${e}`);
155
- statsClient?.incr(`${statsName}.error`, 1, statsTags);
156
- throw e;
157
- }
158
- }
159
- }
160
- function createPayloadToUploadRecords(payloads, audienceSettings) {
161
- const records = [];
162
- const { audienceId } = payloads[0];
163
- payloads.forEach((payload) => {
164
- const hashedPII = {};
165
- if (payload.firstName) {
166
- hashedPII.firstname = normalizeAndHash(payload.firstName);
167
- }
168
- if (payload.lastName) {
169
- hashedPII.lastname = normalizeAndHash(payload.lastName);
170
- }
171
- if (payload.address) {
172
- hashedPII.address = normalizeAndHash(payload.address);
173
- }
174
- if (payload.postal) {
175
- hashedPII.postal = normalizeAndHash(payload.postal);
176
- }
177
- if (payload.phone) {
178
- hashedPII.phone = normalizeAndHash(payload.phone);
179
- }
180
- if (payload.city) {
181
- hashedPII.city = normalizeAndHash(payload.city);
182
- }
183
- if (payload.state) {
184
- hashedPII.state = normalizeAndHash(payload.state);
185
- }
186
- if (payload.email) {
187
- hashedPII.email = normalizeAndHash(payload.email);
188
- }
189
- const payloadRecord = {
190
- externalUserId: payload.externalUserId,
191
- countryCode: audienceSettings.countryCode,
192
- action: payload.event_name == 'Audience Entered' ? utils_1.CONSTANTS.CREATE : utils_1.CONSTANTS.DELETE,
193
- hashedPII: [hashedPII]
194
- };
195
- records.push(payloadRecord);
196
- });
197
- return {
198
- records: records,
199
- audienceId: audienceId
200
- };
201
- }
202
- function normalizeAndHash(data) {
203
- const normalizedData = data.toLowerCase().trim();
204
- const hash = crypto_1.createHash('sha256');
205
- hash.update(normalizedData);
206
- return hash.digest('hex');
207
- }
13
+ };
208
14
  exports.default = action;
209
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/amazon-ads/syncAudiences/index.ts"],"names":[],"mappings":";;AACA,wDAAkE;AAGlE,oCAAoD;AACpD,mCAAmC;AAGnC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,qDAAqD;IAClE,mBAAmB,EAAE,yDAAyD;IAC9E,MAAM,EAAE;QACN,UAAU,EAAE;YACV,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,wCAAwC;YACrD,IAAI,EAAE,QAAQ;YACd,aAAa,EAAE,IAAI;YACnB,OAAO,EAAE;gBACP,OAAO,EAAE,SAAS;aACnB;SACF;QACD,cAAc,EAAE;YACd,KAAK,EAAE,kBAAkB;YACzB,WAAW,EAAE,gEAAgE;YAC7E,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;SACjC;QACD,KAAK,EAAE;YACL,KAAK,EAAE,OAA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KAAK,CAAC,CAAA;AAC3B,CAAC;AAED,kBAAe,MAAM,CAAA"}
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"}
@@ -20,28 +20,3 @@ export declare class AmazonRefreshTokenError extends HTTPError {
20
20
  };
21
21
  };
22
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
- }
@@ -3,6 +3,7 @@ interface ParsedUA {
3
3
  os_version?: string;
4
4
  device_model?: string;
5
5
  device_type?: string;
6
+ device_manufacturer?: string;
6
7
  }
7
8
  interface UserAgentData {
8
9
  model?: string;
@@ -16,7 +16,8 @@ function parseUserAgentProperties(userAgent, userAgentData) {
16
16
  return {
17
17
  os_name: os.name ?? browser.name,
18
18
  os_version: userAgentData?.platformVersion ?? browser.major,
19
- device_model: userAgentData?.model ?? os.name,
19
+ device_manufacturer: device.vendor,
20
+ device_model: userAgentData?.model ?? device.model ?? os.name,
20
21
  device_type: device.type
21
22
  };
22
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"user-agent.js","sourceRoot":"","sources":["../../../src/destinations/amplitude/user-agent.ts"],"names":[],"mappings":";;;;;;AAAA,2EAA8C;AAc9C,SAAgB,wBAAwB,CAAC,SAAkB,EAAE,aAA6B;IACxF,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,EAAE,CAAA;KACV;IAGD,MAAM,MAAM,GAAG,IAAI,sBAAQ,CAAC,SAAS,CAAC,CAAA;IAEtC,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,CAAA;IAEjC,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,CAAA;IAEzB,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,EAAE,CAAA;IAEnC,OAAO;QACL,OAAO,EAAE,EAAE,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI;QAChC,UAAU,EAAE,aAAa,EAAE,eAAe,IAAI,OAAO,CAAC,KAAK;QAC3D,YAAY,EAAE,aAAa,EAAE,KAAK,IAAI,EAAE,CAAC,IAAI;QAC7C,WAAW,EAAE,MAAM,CAAC,IAAI;KACzB,CAAA;AACH,CAAC;AApBD,4DAoBC"}
1
+ {"version":3,"file":"user-agent.js","sourceRoot":"","sources":["../../../src/destinations/amplitude/user-agent.ts"],"names":[],"mappings":";;;;;;AAAA,2EAA8C;AAe9C,SAAgB,wBAAwB,CAAC,SAAkB,EAAE,aAA6B;IACxF,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,EAAE,CAAA;KACV;IAGD,MAAM,MAAM,GAAG,IAAI,sBAAQ,CAAC,SAAS,CAAC,CAAA;IAEtC,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,CAAA;IAEjC,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,CAAA;IAEzB,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,EAAE,CAAA;IAEnC,OAAO;QACL,OAAO,EAAE,EAAE,CAAC,IA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