@segment/action-destinations 3.263.0-staging-93f856412 → 3.263.0-staging-f4d09d0fe

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 (153) hide show
  1. package/dist/destinations/amazon-ads/index.js +6 -4
  2. package/dist/destinations/amazon-ads/index.js.map +1 -1
  3. package/dist/destinations/amazon-ads/syncAudiences/generated-types.d.ts +14 -19
  4. package/dist/destinations/amazon-ads/syncAudiences/index.js +133 -107
  5. package/dist/destinations/amazon-ads/syncAudiences/index.js.map +1 -1
  6. package/dist/destinations/braze/trackEvent/index.js +10 -1
  7. package/dist/destinations/braze/trackEvent/index.js.map +1 -1
  8. package/dist/destinations/braze/trackPurchase/index.js +10 -1
  9. package/dist/destinations/braze/trackPurchase/index.js.map +1 -1
  10. package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.d.ts +1 -0
  11. package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.js +184 -0
  12. package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.js.map +1 -0
  13. package/dist/destinations/braze/updateUserProfile/index.js +10 -1
  14. package/dist/destinations/braze/updateUserProfile/index.js.map +1 -1
  15. package/dist/destinations/customerio/utils.d.ts +1 -1
  16. package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.d.ts +2 -5
  17. package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js +18 -98
  18. package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js.map +1 -1
  19. package/dist/destinations/engage/utils/track.d.ts +10 -10
  20. package/dist/destinations/klaviyo/removeProfileToList/generated-types.d.ts +4 -0
  21. package/dist/destinations/klaviyo/removeProfileToList/generated-types.js.map +1 -0
  22. package/dist/destinations/{responsys/asyncMergeProfileListMembers → klaviyo/removeProfileToList}/index.d.ts +1 -1
  23. package/dist/destinations/klaviyo/removeProfileToList/index.js +42 -0
  24. package/dist/destinations/klaviyo/removeProfileToList/index.js.map +1 -0
  25. package/dist/destinations/klaviyo/subscribeProfile/generated-types.d.ts +8 -0
  26. package/dist/destinations/klaviyo/subscribeProfile/generated-types.js.map +1 -0
  27. package/dist/destinations/{responsys/asyncMergePetRecords → klaviyo/subscribeProfile}/index.d.ts +1 -1
  28. package/dist/destinations/klaviyo/subscribeProfile/index.js +137 -0
  29. package/dist/destinations/klaviyo/subscribeProfile/index.js.map +1 -0
  30. package/dist/destinations/klaviyo/unsubscribeProfile/generated-types.d.ts +6 -0
  31. package/dist/destinations/klaviyo/unsubscribeProfile/generated-types.js +3 -0
  32. package/dist/destinations/klaviyo/unsubscribeProfile/generated-types.js.map +1 -0
  33. package/dist/destinations/klaviyo/unsubscribeProfile/index.d.ts +5 -0
  34. package/dist/destinations/klaviyo/unsubscribeProfile/index.js +118 -0
  35. package/dist/destinations/klaviyo/unsubscribeProfile/index.js.map +1 -0
  36. package/dist/destinations/magellan-ai/addToCart/generated-types.d.ts +11 -0
  37. package/dist/destinations/magellan-ai/addToCart/generated-types.js +3 -0
  38. package/dist/destinations/magellan-ai/addToCart/generated-types.js.map +1 -0
  39. package/dist/destinations/magellan-ai/addToCart/index.d.ts +5 -0
  40. package/dist/destinations/magellan-ai/addToCart/index.js +22 -0
  41. package/dist/destinations/magellan-ai/addToCart/index.js.map +1 -0
  42. package/dist/destinations/magellan-ai/checkout/generated-types.d.ts +17 -0
  43. package/dist/destinations/magellan-ai/checkout/generated-types.js +3 -0
  44. package/dist/destinations/magellan-ai/checkout/generated-types.js.map +1 -0
  45. package/dist/destinations/magellan-ai/checkout/index.d.ts +5 -0
  46. package/dist/destinations/magellan-ai/checkout/index.js +16 -0
  47. package/dist/destinations/magellan-ai/checkout/index.js.map +1 -0
  48. package/dist/destinations/magellan-ai/code/generated-types.d.ts +4 -0
  49. package/dist/destinations/magellan-ai/code/generated-types.js +3 -0
  50. package/dist/destinations/magellan-ai/code/generated-types.js.map +1 -0
  51. package/dist/destinations/magellan-ai/code/index.d.ts +5 -0
  52. package/dist/destinations/magellan-ai/code/index.js +27 -0
  53. package/dist/destinations/magellan-ai/code/index.js.map +1 -0
  54. package/dist/destinations/magellan-ai/generated-types.d.ts +4 -0
  55. package/dist/destinations/magellan-ai/generated-types.js +3 -0
  56. package/dist/destinations/magellan-ai/generated-types.js.map +1 -0
  57. package/dist/destinations/magellan-ai/identify/generated-types.d.ts +3 -0
  58. package/dist/destinations/magellan-ai/identify/generated-types.js +3 -0
  59. package/dist/destinations/magellan-ai/identify/generated-types.js.map +1 -0
  60. package/dist/destinations/magellan-ai/identify/index.d.ts +5 -0
  61. package/dist/destinations/magellan-ai/identify/index.js +20 -0
  62. package/dist/destinations/magellan-ai/identify/index.js.map +1 -0
  63. package/dist/destinations/magellan-ai/index.d.ts +4 -0
  64. package/dist/destinations/magellan-ai/index.js +60 -0
  65. package/dist/destinations/magellan-ai/index.js.map +1 -0
  66. package/dist/destinations/magellan-ai/install/generated-types.d.ts +12 -0
  67. package/dist/destinations/magellan-ai/install/generated-types.js +3 -0
  68. package/dist/destinations/magellan-ai/install/generated-types.js.map +1 -0
  69. package/dist/destinations/magellan-ai/install/index.d.ts +5 -0
  70. package/dist/destinations/magellan-ai/install/index.js +13 -0
  71. package/dist/destinations/magellan-ai/install/index.js.map +1 -0
  72. package/dist/destinations/magellan-ai/lead/generated-types.d.ts +9 -0
  73. package/dist/destinations/magellan-ai/lead/generated-types.js +3 -0
  74. package/dist/destinations/magellan-ai/lead/generated-types.js.map +1 -0
  75. package/dist/destinations/magellan-ai/lead/index.d.ts +5 -0
  76. package/dist/destinations/magellan-ai/lead/index.js +49 -0
  77. package/dist/destinations/magellan-ai/lead/index.js.map +1 -0
  78. package/dist/destinations/magellan-ai/product/generated-types.d.ts +10 -0
  79. package/dist/destinations/magellan-ai/product/generated-types.js +3 -0
  80. package/dist/destinations/magellan-ai/product/generated-types.js.map +1 -0
  81. package/dist/destinations/magellan-ai/product/index.d.ts +5 -0
  82. package/dist/destinations/magellan-ai/product/index.js +13 -0
  83. package/dist/destinations/magellan-ai/product/index.js.map +1 -0
  84. package/dist/destinations/magellan-ai/purchase/generated-types.d.ts +18 -0
  85. package/dist/destinations/magellan-ai/purchase/generated-types.js +3 -0
  86. package/dist/destinations/magellan-ai/purchase/generated-types.js.map +1 -0
  87. package/dist/destinations/magellan-ai/purchase/index.d.ts +5 -0
  88. package/dist/destinations/magellan-ai/purchase/index.js +22 -0
  89. package/dist/destinations/magellan-ai/purchase/index.js.map +1 -0
  90. package/dist/destinations/magellan-ai/schema.d.ts +6 -0
  91. package/dist/destinations/magellan-ai/schema.js +244 -0
  92. package/dist/destinations/magellan-ai/schema.js.map +1 -0
  93. package/dist/destinations/magellan-ai/thirdPartyEvent/generated-types.d.ts +16 -0
  94. package/dist/destinations/magellan-ai/thirdPartyEvent/generated-types.js +3 -0
  95. package/dist/destinations/magellan-ai/thirdPartyEvent/generated-types.js.map +1 -0
  96. package/dist/destinations/magellan-ai/thirdPartyEvent/index.d.ts +5 -0
  97. package/dist/destinations/magellan-ai/thirdPartyEvent/index.js +28 -0
  98. package/dist/destinations/magellan-ai/thirdPartyEvent/index.js.map +1 -0
  99. package/dist/destinations/magellan-ai/utils.d.ts +5 -0
  100. package/dist/destinations/magellan-ai/utils.js +16 -0
  101. package/dist/destinations/magellan-ai/utils.js.map +1 -0
  102. package/dist/destinations/magellan-ai/view/generated-types.d.ts +3 -0
  103. package/dist/destinations/magellan-ai/view/generated-types.js +3 -0
  104. package/dist/destinations/magellan-ai/view/generated-types.js.map +1 -0
  105. package/dist/destinations/magellan-ai/view/index.d.ts +5 -0
  106. package/dist/destinations/magellan-ai/view/index.js +21 -0
  107. package/dist/destinations/magellan-ai/view/index.js.map +1 -0
  108. package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.js +5 -82
  109. package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.js.map +1 -1
  110. package/dist/destinations/trackey/group.types.d.ts +11 -0
  111. package/dist/destinations/trackey/group.types.js +3 -0
  112. package/dist/destinations/trackey/group.types.js.map +1 -0
  113. package/dist/destinations/trackey/identify.types.d.ts +11 -0
  114. package/dist/destinations/trackey/identify.types.js +3 -0
  115. package/dist/destinations/trackey/identify.types.js.map +1 -0
  116. package/dist/destinations/trackey/track.types.d.ts +12 -0
  117. package/dist/destinations/trackey/track.types.js +3 -0
  118. package/dist/destinations/trackey/track.types.js.map +1 -0
  119. package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.d.ts +4 -0
  120. package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.js +3 -0
  121. package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.js.map +1 -0
  122. package/dist/destinations/yahoo-audiences/createCustomerNode/index.d.ts +5 -0
  123. package/dist/destinations/yahoo-audiences/createCustomerNode/index.js +26 -0
  124. package/dist/destinations/yahoo-audiences/createCustomerNode/index.js.map +1 -0
  125. package/dist/destinations/yahoo-audiences/createSegment/generated-types.d.ts +6 -0
  126. package/dist/destinations/yahoo-audiences/createSegment/generated-types.js +3 -0
  127. package/dist/destinations/yahoo-audiences/createSegment/generated-types.js.map +1 -0
  128. package/dist/destinations/yahoo-audiences/createSegment/index.d.ts +5 -0
  129. package/dist/destinations/yahoo-audiences/createSegment/index.js +38 -0
  130. package/dist/destinations/yahoo-audiences/createSegment/index.js.map +1 -0
  131. package/dist/destinations/yahoo-audiences/utils.d.ts +4 -0
  132. package/dist/destinations/yahoo-audiences/utils.js +30 -0
  133. package/dist/destinations/yahoo-audiences/utils.js.map +1 -0
  134. package/package.json +2 -2
  135. package/dist/destinations/responsys/asyncMergePetRecords/generated-types.d.ts +0 -14
  136. package/dist/destinations/responsys/asyncMergePetRecords/generated-types.js.map +0 -1
  137. package/dist/destinations/responsys/asyncMergePetRecords/index.js +0 -113
  138. package/dist/destinations/responsys/asyncMergePetRecords/index.js.map +0 -1
  139. package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.d.ts +0 -20
  140. package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.js.map +0 -1
  141. package/dist/destinations/responsys/asyncMergeProfileListMembers/index.js +0 -174
  142. package/dist/destinations/responsys/asyncMergeProfileListMembers/index.js.map +0 -1
  143. package/dist/destinations/responsys/rsp-operations.d.ts +0 -14
  144. package/dist/destinations/responsys/rsp-operations.js +0 -33
  145. package/dist/destinations/responsys/rsp-operations.js.map +0 -1
  146. package/dist/destinations/responsys/rsp-properties.d.ts +0 -4
  147. package/dist/destinations/responsys/rsp-properties.js +0 -27
  148. package/dist/destinations/responsys/rsp-properties.js.map +0 -1
  149. package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.d.ts +0 -3
  150. package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.js +0 -43
  151. package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.js.map +0 -1
  152. /package/dist/destinations/{responsys/asyncMergePetRecords → klaviyo/removeProfileToList}/generated-types.js +0 -0
  153. /package/dist/destinations/{responsys/asyncMergeProfileListMembers → klaviyo/subscribeProfile}/generated-types.js +0 -0
@@ -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,GAAG,EAAE;IAC3F,EAAE,CAAC,iBAAiB,EAAE,KAAK,IAAI,EAAE;QAC/B,MAAM,MAAM,GAAG,eAAW,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;QAC9C,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,4BAAgB,CAAC,QAAQ,EAAE,eAAW,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;QAEvF,cAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACzC,cAAI,CAAC,IAAI,CAAC,C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AAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAA;IACrD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -269,7 +269,16 @@ const action = {
269
269
  label: 'Update Existing Only',
270
270
  description: 'Setting this flag to true will put the API in "Update Only" mode. When using a "user_alias", "Update Only" mode is always true.',
271
271
  type: 'boolean',
272
- default: false
272
+ default: false,
273
+ depends_on: {
274
+ conditions: [
275
+ {
276
+ fieldKey: 'user_alias',
277
+ operator: 'is',
278
+ value: {}
279
+ }
280
+ ]
281
+ }
273
282
  },
274
283
  enable_batching: {
275
284
  type: 'boolean',
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/braze/updateUserProfile/index.ts"],"names":[],"mappings":";;AAGA,oCAAsE;AAEtE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,qBAAqB;IAC5B,WAAW,EAAE,6CAA6C;IAC1D,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,WAAW,EAAE;YACX,KAAK,EAAE,kBAAkB;YACzB,WAAW,EAAE,4BAA4B;YACzC,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;QACD,UAAU,EAAE;YACV,KAAK,EAAE,mBAAmB;YAC1B,WAAW,EACT,yGAAyG;YAC3G,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,UAAU,EAAE;oBACV,KAAK,EAAE,YAAY;oBACnB,IAAI,EAAE,QAAQ;iBACf;gBACD,WAAW,EAAE;oBACX,KAAK,EAAE,aAAa;oBACpB,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,uBAAuB;YAC9B,WAAW,EAAE,4BAA4B;YACzC,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,IAAI;YACf,OAAO,EAAE;gBACP,OAAO,EA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O,EAAE,EAAE,EAAE;QAC/C,OAAO,gCAAwB,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC7D,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/braze/updateUserProfile/index.ts"],"names":[],"mappings":";;AAGA,oCAAsE;AAEtE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,qBAAqB;IAC5B,WAAW,EAAE,6CAA6C;IAC1D,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,WAAW,EAAE;YACX,KAAK,EAAE,kBAAkB;YACzB,WAAW,EAAE,4BAA4B;YACzC,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;QACD,UAAU,EAAE;YACV,KAAK,EAAE,mBAAmB;YAC1B,WAAW,EACT,yGAAyG;YAC3G,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,UAAU,EAAE;oBACV,KAAK,EAAE,YAAY;oBACnB,IAAI,EAAE,QAAQ;iBACf;gBACD,WAAW,EAAE;oBACX,KAAK,EAAE,aAAa;oBACpB,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,uBAAuB;YAC9B,WAAW,EAAE,4BAA4B;YACzC,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,IAAI;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,uBAAuB;aACjC;SACF;QACD,OAAO,EAAE;YACP,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,8BAA8B;YAC3C,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,IAAI;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,4BAA4B;aACtC;SACF;QACD,gBAAgB,EAAE;YAChB,KAAK,EAAE,kBAAkB;YACzB,WAAW,EAAE,wCAAwC;YACrD,IAAI,EAAE,QAAQ;YACd,S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
1
  export declare const trackApiEndpoint: ({ accountRegion }: {
2
2
  accountRegion?: string | undefined;
3
- }) => "https://track-eu.customer.io" | "https://track.customer.io";
3
+ }) => "https://track.customer.io" | "https://track-eu.customer.io";
4
4
  export declare enum AccountRegion {
5
5
  US = "US \uD83C\uDDFA\uD83C\uDDF8",
6
6
  EU = "EU \uD83C\uDDEA\uD83C\uDDFA"
@@ -1,6 +1,6 @@
1
1
  import { InputField } from '@segment/actions-core';
2
2
  import { RequestClient } from '@segment/actions-core';
3
- import { Logger, StatsClient, DataFeedCache } from '@segment/actions-core/destination-kit';
3
+ import { Logger, StatsClient } from '@segment/actions-core/destination-kit';
4
4
  import type { Settings } from '../generated-types';
5
5
  import { Profile } from '../Profile';
6
6
  export declare type ApiLookupConfig = {
@@ -13,9 +13,6 @@ export declare type ApiLookupConfig = {
13
13
  headers?: object | undefined;
14
14
  responseType: string;
15
15
  };
16
- export declare const getRequestId: ({ method, url, body, headers }: ApiLookupConfig) => string;
17
- export declare const getCachedResponse: ({ responseType }: ApiLookupConfig, requestId: string, dataFeedCache: DataFeedCache, datafeedTags: string[]) => Promise<any>;
18
- export declare const performApiLookup: (request: RequestClient, apiLookupConfig: ApiLookupConfig, profile: Profile, statsClient: StatsClient | undefined, tags: string[], settings: Settings, logger?: Logger | undefined, dataFeedCache?: DataFeedCache | undefined) => Promise<any>;
16
+ export declare const performApiLookup: (request: RequestClient, { id, url, method, body, headers }: ApiLookupConfig, profile: Profile, statsClient: StatsClient | undefined, tags: string[], settings: Settings, logger?: Logger | undefined) => Promise<unknown>;
19
17
  export declare const apiLookupActionFields: Record<string, InputField>;
20
18
  export declare const apiLookupLiquidKey = "lookups";
21
- export declare const FLAGON_NAME_DATA_FEEDS = "is-datafeeds-enabled";
@@ -1,125 +1,46 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FLAGON_NAME_DATA_FEEDS = exports.apiLookupLiquidKey = exports.apiLookupActionFields = exports.performApiLookup = exports.getCachedResponse = exports.getRequestId = void 0;
4
- const crypto_1 = require("crypto");
3
+ exports.apiLookupLiquidKey = exports.apiLookupActionFields = exports.performApiLookup = void 0;
5
4
  const actions_core_1 = require("@segment/actions-core");
6
5
  const liquidjs_1 = require("liquidjs");
7
6
  const Liquid = new liquidjs_1.Liquid();
8
- const maxResponseSizeBytes = 1000000;
9
- const renderLiquidFields = async ({ id, url, body }, profile, datafeedTags, settings, logger) => {
7
+ const performApiLookup = async (request, { id, url, method, body, headers }, profile, statsClient, tags, settings, logger) => {
10
8
  let renderedUrl;
11
9
  let renderedBody;
12
10
  try {
13
11
  renderedUrl = await Liquid.parseAndRender(url, { profile });
14
12
  }
15
13
  catch (error) {
16
- logger?.error(`TE Messaging: Email datafeed url parse failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
17
- datafeedTags.push('error:true', `error_message:${error?.message}`, 'reason:rendering_failure', 'rendering:url');
14
+ logger?.error(`TE Messaging: Email api lookup url parse failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
15
+ tags.push('reason:parse_apilookup_url');
16
+ statsClient?.incr('actions-personas-messaging-sendgrid-error', 1, tags);
18
17
  throw new actions_core_1.IntegrationError('Unable to parse email api lookup url', 'api lookup url parse failure', 400);
19
18
  }
20
19
  try {
21
20
  renderedBody = body ? await Liquid.parseAndRender(body, { profile }) : undefined;
22
21
  }
23
22
  catch (error) {
24
- logger?.error(`TE Messaging: Email datafeed body parse failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
25
- datafeedTags.push('error:true', `error_message:${error?.message}`, 'reason:rendering_failure', 'rendering:body');
23
+ logger?.error(`TE Messaging: Email api lookup body parse failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
24
+ tags.push('reason:parse_apilookup_body');
25
+ statsClient?.incr('actions-personas-messaging-sendgrid-error', 1, tags);
26
26
  throw new actions_core_1.IntegrationError('Unable to parse email api lookup body', 'api lookup body parse failure', 400);
27
27
  }
28
- return {
29
- renderedUrl,
30
- renderedBody
31
- };
32
- };
33
- const getRequestId = ({ method, url, body, headers }) => {
34
- const requestHash = crypto_1.createHash('sha256');
35
- requestHash.update(`${method}${url}${body}${JSON.stringify(headers)}`);
36
- const requestId = requestHash.digest('hex');
37
- return requestId;
38
- };
39
- exports.getRequestId = getRequestId;
40
- const getCachedResponse = async ({ responseType }, requestId, dataFeedCache, datafeedTags) => {
41
- const cachedResponse = await dataFeedCache?.getRequestResponse(requestId);
42
- if (!cachedResponse) {
43
- datafeedTags.push('cache_hit:false');
44
- return;
45
- }
46
- datafeedTags.push('cache_hit:true');
47
- if (responseType === 'json') {
48
- return JSON.parse(cachedResponse);
49
- }
50
- return cachedResponse;
51
- };
52
- exports.getCachedResponse = getCachedResponse;
53
- const performApiLookup = async (request, apiLookupConfig, profile, statsClient, tags, settings, logger, dataFeedCache) => {
54
- const { id, method, headers, cacheTtl, name } = apiLookupConfig;
55
- const datafeedTags = [
56
- ...tags,
57
- `datafeed_id:${id}`,
58
- `datafeed_name:${name}`,
59
- `space_id:${settings.spaceId}`,
60
- `cache_ttl_greater_than_0:${cacheTtl > 0}`
61
- ];
62
28
  try {
63
- const { renderedUrl, renderedBody } = await renderLiquidFields(apiLookupConfig, profile, datafeedTags, settings, logger);
64
- const requestId = exports.getRequestId({ ...apiLookupConfig, url: renderedUrl, body: renderedBody });
65
- if (cacheTtl > 0 && dataFeedCache) {
66
- const cachedResponse = await exports.getCachedResponse(apiLookupConfig, requestId, dataFeedCache, datafeedTags);
67
- if (cachedResponse) {
68
- datafeedTags.push('error:false');
69
- return cachedResponse;
70
- }
71
- }
72
- let data;
73
- try {
74
- const res = await request(renderedUrl, {
75
- headers: headers ?? undefined,
76
- timeout: 3000,
77
- method: method,
78
- body: renderedBody,
79
- skipResponseCloning: true
80
- });
81
- data = await res.data;
82
- }
83
- catch (error) {
84
- const respError = error.response;
85
- logger?.error(`TE Messaging: Email api lookup failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
86
- datafeedTags.push(`error:true`, `error_message:${error.message}`, `error_status:${respError?.status}`, 'reason:api_call_failure');
87
- throw error;
88
- }
89
- const dataString = JSON.stringify(data);
90
- const size = Buffer.byteLength(dataString, 'utf-8');
91
- datafeedTags.push(`response_size_greater_than_mb:${size > maxResponseSizeBytes}`);
92
- if (cacheTtl > 0) {
93
- if (size <= maxResponseSizeBytes) {
94
- try {
95
- await dataFeedCache?.setRequestResponse(requestId, dataString, cacheTtl / 1000);
96
- datafeedTags.push('cache_set:true');
97
- }
98
- catch (err) {
99
- logger?.error(`TE Messaging: Email api lookup cache set failure - api lookup id: ${id} - ${settings.spaceId} - [${err}]`);
100
- datafeedTags.push('cache_set:false');
101
- datafeedTags.push('error:true', 'reason:cache_set_failure', `error_message:${err?.message}`);
102
- throw err;
103
- }
104
- }
105
- else {
106
- datafeedTags.push('cache_set:false');
107
- }
108
- }
109
- return data;
29
+ const res = await request(renderedUrl, {
30
+ headers: headers ?? undefined,
31
+ timeout: 10000,
32
+ method: method,
33
+ body: renderedBody,
34
+ skipResponseCloning: true
35
+ });
36
+ return res.data;
110
37
  }
111
38
  catch (error) {
112
- const isErrorCapturedInTags = datafeedTags.find((str) => str.includes('error:true'));
113
- if (!isErrorCapturedInTags) {
114
- datafeedTags.push('error:true', `error_message:${error?.message}`, 'reason:unknown');
115
- }
116
- tags.push('reason:datafeed_failure');
117
39
  logger?.error(`TE Messaging: Email api lookup failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
40
+ tags.push('reason:apilookup_failure');
41
+ statsClient?.incr('actions-personas-messaging-sendgrid-error', 1, tags);
118
42
  throw error;
119
43
  }
120
- finally {
121
- statsClient?.incr('datafeed-execution', 1, datafeedTags);
122
- }
123
44
  };
124
45
  exports.performApiLookup = performApiLookup;
125
46
  exports.apiLookupActionFields = {
@@ -170,5 +91,4 @@ exports.apiLookupActionFields = {
170
91
  }
171
92
  };
172
93
  exports.apiLookupLiquidKey = 'lookups';
173
- exports.FLAGON_NAME_DATA_FEEDS = 'is-datafeeds-enabled';
174
94
  //# sourceMappingURL=api-lookups.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-lookups.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/sendgrid/previewApiLookup/api-lookups.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,wDAAwD;AAKxD,uCAA6C;AAI7C,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AAE7B,MAAM,oBAAoB,GAAG,OAAO,CAAA;AAcpC,MAAM,kBAAkB,GAAG,KAAK,EAC9B,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAgD,EAC/D,OAAgB,EAChB,YAAsB,EACtB,QAAkB,EAClB,MAA2B,EAC3B,EAAE;IACF,IAAI,WAAmB,CAAA;IACvB,IAAI,YAAgC,CAAA;IACpC,IAAI;QACF,WAAW,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;KAC5D;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,EAAE,KAAK,CACX,mEAAmE,EAAE,MAAM,QAAQ,CAAC,OAAO,OAAO,KAAK,GAAG,CAC3G,CAAA;QACD,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,iBAAiB,KAAK,EAAE,OAAO,EAAE,EAAE,0BAA0B,EAAE,eAAe,CAAC,CAAA;QAC/G,MAAM,IAAI,+BAAgB,CAAC,sCAAsC,EAAE,8BAA8B,EAAE,GAAG,CAAC,CAAA;KACxG;IACD,IAAI;QACF,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;KACjF;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,EAAE,KAAK,CACX,oEAAoE,EAAE,MAAM,QAAQ,CAAC,OAAO,OAAO,KAAK,GAAG,CAC5G,CAAA;QACD,YAAY,CAAC,IAAI,CAA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AAQ;KACf;IACD,OAAO,EAAE;QACP,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,6CAA6C;QAC1D,IAAI,EAAE,QAAQ;KACf;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,mEAAmE;QAChF,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;KACf;CACF,CAAA;AAEY,QAAA,kBAAkB,GAAG,SAAS,CAAA;AAE9B,QAAA,sBAAsB,GAAG,sBAAsB,CAAA"}
1
+ {"version":3,"file":"api-lookups.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/sendgrid/previewApiLookup/api-lookups.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AAKxD,uCAA6C;AAG7C,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AActB,MAAM,gBAAgB,GAAG,KAAK,EACnC,OAAsB,EACtB,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAmB,EACnD,OAAgB,EAChB,WAAoC,EACpC,IAAc,EACd,QAAkB,EAClB,MAA2B,EAC3B,EAAE;IACF,IAAI,WAAmB,CAAA;IACvB,IAAI,YAAgC,CAAA;IACpC,IAAI;QACF,WAAW,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;KAC5D;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,EAAE,KAAK,CACX,qEAAqE,EAAE,MAAM,QAAQ,CAAC,OAAO,OAAO,KAAK,GAAG,CAC7G,CAAA;QACD,IAAI,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAA;QACvC,WAAW,EAAE,IAAI,CAAC,2CAA2C,EAAE,CAAC,EAAE,IAAI,CAAC,CAAA;QACvE,MAAM,IAAI,+BAAgB,CAAC,sCAAsC,EAAE,8BAA8B,EAAE,GAAG,CAAC,CAAA;KACxG;IACD,IAAI;QACF,YAAY,GAAG,IAAI,CA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QACrE,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;KACf;IACD,GAAG,EAAE;QACH,KAAK,EAAE,KAAK;QACZ,WAAW,EAAE,0BAA0B;QACvC,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;KACf;IACD,MAAM,EAAE;QACN,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,wCAAwC;QACrD,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;KACf;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,qBAAqB;QAClC,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,IAAI;KACf;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,uDAAuD;QACpE,IAAI,EAAE,QAAQ;KACf;IACD,OAAO,EAAE;QACP,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,6CAA6C;QAC1D,IAAI,EAAE,QAAQ;KACf;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,mEAAmE;QAChF,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;KACf;CACF,CAAA;AAEY,QAAA,kBAAkB,GAAG,SAAS,CAAA"}
@@ -1,12 +1,12 @@
1
1
  import { ContextFromDecorator } from './operationTracking';
2
2
  export declare const track: ((decoratorArgs?: ({
3
- shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
4
- } & {
5
3
  onError?: ((ctx: import("./operationTracking").OperationErrorHandlerContext<import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>>) => void) | undefined;
6
4
  } & {
7
5
  onTry?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
8
6
  onFinally?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
9
7
  } & import("./operationTracking").OperationLoggerDecoratorArgs & {
8
+ shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
9
+ } & {
10
10
  wrapIntegrationError?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => import("@segment/actions-core/*").IntegrationError | [message: string, code: string, status: number]) | undefined;
11
11
  }) | undefined) => import("./operationTracking").GenericMethodDecorator<(this: any, ...args: any[]) => any>) & {
12
12
  getCurrentOperation(classInstance: any): (import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & {
@@ -15,14 +15,6 @@ export declare const track: ((decoratorArgs?: ({
15
15
  }) | undefined;
16
16
  } & {
17
17
  _contextType: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & {
18
- tags: string[];
19
- sharedContext: {
20
- tags: string[];
21
- };
22
- decoratorArgs?: {
23
- shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
24
- } | undefined;
25
- } & {
26
18
  decoratorArgs?: {
27
19
  onError?: ((ctx: import("./operationTracking").OperationErrorHandlerContext<import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>>) => void) | undefined;
28
20
  } | undefined;
@@ -43,6 +35,14 @@ export declare const track: ((decoratorArgs?: ({
43
35
  logMetadata?: Record<string, unknown> | undefined;
44
36
  decoratorArgs?: import("./operationTracking").OperationLoggerDecoratorArgs | undefined;
45
37
  sharedContext: import("./operationTracking").OperationLoggerSharedContext;
38
+ } & {
39
+ tags: string[];
40
+ sharedContext: {
41
+ tags: string[];
42
+ };
43
+ decoratorArgs?: {
44
+ shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
45
+ } | undefined;
46
46
  } & {
47
47
  decoratorArgs?: {
48
48
  wrapIntegrationError?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => import("@segment/actions-core/*").IntegrationError | [message: string, code: string, status: number]) | undefined;
@@ -0,0 +1,4 @@
1
+ export interface Payload {
2
+ email?: string;
3
+ external_id?: string;
4
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/removeProfileToList/generated-types.ts"],"names":[],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  import { ActionDefinition } from '@segment/actions-core';
2
2
  import type { Settings } from '../generated-types';
3
- import type { Payload } from './generated-types';
3
+ import { Payload } from './generated-types';
4
4
  declare const action: ActionDefinition<Settings, Payload>;
5
5
  export default action;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const actions_core_1 = require("@segment/actions-core");
4
+ const functions_1 = require("../functions");
5
+ const properties_1 = require("../properties");
6
+ const action = {
7
+ title: 'Remove profile from list',
8
+ description: 'Remove profile from list',
9
+ fields: {
10
+ email: { ...properties_1.email },
11
+ external_id: { ...properties_1.external_id }
12
+ },
13
+ perform: async (request, { payload }) => {
14
+ const { email, external_id } = payload;
15
+ if (!email || !external_id) {
16
+ throw new actions_core_1.IntegrationError("Insert the ID of the default list that you'd like to subscribe users", 'Missing required fields', 400);
17
+ }
18
+ try {
19
+ const profileData = await functions_1.getProfile(request, email);
20
+ const v = JSON.parse(profileData.content);
21
+ if (Object.keys(v).length !== 0) {
22
+ const listData = {
23
+ data: [
24
+ {
25
+ type: 'profile',
26
+ id: v.data[0].id
27
+ }
28
+ ]
29
+ };
30
+ const list = await functions_1.executeProfileList(request, 'DELETE', listData, external_id);
31
+ return list;
32
+ }
33
+ return;
34
+ }
35
+ catch (error) {
36
+ console.log(error);
37
+ throw new Error('An error occurred while processing the request');
38
+ }
39
+ }
40
+ };
41
+ exports.default = action;
42
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/removeProfileToList/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAK1E,4CAA6D;AAC7D,8CAAkD;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;
3
+ phone_number?: string;
4
+ list_id?: string;
5
+ custom_source?: string;
6
+ consented_at?: string | number;
7
+ enable_batching?: boolean;
8
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/subscribeProfile/generated-types.ts"],"names":[],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { ActionDefinition } from '@segment/actions-core';
1
+ import type { ActionDefinition } from '@segment/actions-core';
2
2
  import type { Settings } from '../generated-types';
3
3
  import type { Payload } from './generated-types';
4
4
  declare const action: ActionDefinition<Settings, Payload>;