@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,137 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const functions_1 = require("../functions");
4
+ const actions_core_1 = require("@segment/actions-core");
5
+ const functions_2 = require("../functions");
6
+ const config_1 = require("../config");
7
+ const action = {
8
+ title: 'Subscribe Profile',
9
+ description: 'Subscribe Klaviyo profiles to Email marketing, SMS marketing, or both.',
10
+ defaultSubscription: 'type = "track" and event = "User Subscribed"',
11
+ fields: {
12
+ email: {
13
+ label: 'Email',
14
+ description: `The email address to subscribe. If provided, the associated profile will be subscribed to Email marketing.`,
15
+ type: 'string',
16
+ format: 'email',
17
+ default: {
18
+ '@if': {
19
+ exists: { '@path': '$.traits.email' },
20
+ then: { '@path': '$.traits.email' },
21
+ else: { '@path': '$.context.traits.email' }
22
+ }
23
+ }
24
+ },
25
+ phone_number: {
26
+ label: 'Phone Number',
27
+ description: `The phone number to subscribe. This must be in E.164 format. If provided, the associated profile will be subscribed to SMS marketing.`,
28
+ type: 'string',
29
+ default: {
30
+ '@if': {
31
+ exists: { '@path': '$.traits.phone' },
32
+ then: { '@path': '$.traits.phone' },
33
+ else: { '@path': '$.context.traits.phone' }
34
+ }
35
+ }
36
+ },
37
+ list_id: {
38
+ label: 'List Id',
39
+ description: `The Klaviyo list to add the newly subscribed profiles to. If no List Id is present, the opt-in process used to subscribe the profile depends on the account's default opt-in settings.`,
40
+ type: 'string',
41
+ dynamic: true
42
+ },
43
+ custom_source: {
44
+ label: 'Custom Source ($source)',
45
+ description: 'A custom method or source to detail source of consent preferences (e.g., "Marketing Event"). The default is set to -59, as this is [the $source value associated with Segment](https://help.klaviyo.com/hc/en-us/articles/1260804673530#h_01HDKHG9AM4BSSM009BM6XBF1H).',
46
+ type: 'string',
47
+ default: '-59'
48
+ },
49
+ consented_at: {
50
+ label: 'Consented At',
51
+ description: `The timestamp of when the profile's consent was gathered.`,
52
+ type: 'datetime',
53
+ default: {
54
+ '@path': '$.timestamp'
55
+ }
56
+ },
57
+ enable_batching: {
58
+ type: 'boolean',
59
+ label: 'Batch Data to Klaviyo',
60
+ description: 'When enabled, the action will use the Klaviyo batch API.'
61
+ }
62
+ },
63
+ dynamicFields: {
64
+ list_id: async (request) => {
65
+ return functions_1.getListIdDynamicData(request);
66
+ }
67
+ },
68
+ perform: async (request, { payload }) => {
69
+ const { email, phone_number, consented_at, list_id, custom_source } = payload;
70
+ if (!email && !phone_number) {
71
+ throw new actions_core_1.PayloadValidationError('Phone Number or Email is required.');
72
+ }
73
+ const profileToSubscribe = functions_2.formatSubscribeProfile(email, phone_number, consented_at);
74
+ const subData = functions_2.formatSubscribeRequestBody(profileToSubscribe, list_id, custom_source);
75
+ return await request(`${config_1.API_URL}/profile-subscription-bulk-create-jobs/`, {
76
+ method: 'POST',
77
+ headers: {
78
+ revision: '2024-02-15'
79
+ },
80
+ json: subData
81
+ });
82
+ },
83
+ performBatch: async (request, { payload }) => {
84
+ const filteredPayload = payload.filter((profile) => profile.email || profile.phone_number);
85
+ if (filteredPayload.length === 0) {
86
+ throw new actions_core_1.PayloadValidationError('Phone Number or Email is required.');
87
+ }
88
+ const sortedProfilesObject = sortBatches(filteredPayload);
89
+ const batches = Object.keys(sortedProfilesObject);
90
+ if (batches.length > 9) {
91
+ throw new actions_core_1.PayloadValidationError('Exceeded maximum allowed batches due to unique list_id and custom_source pairings');
92
+ }
93
+ const requests = [];
94
+ batches.forEach((key) => {
95
+ const { list_id, custom_source, profiles } = sortedProfilesObject[key];
96
+ for (let i = 0; i < profiles.length; i += 100) {
97
+ const profilesSubset = profiles.slice(i, i + 100);
98
+ const subData = functions_2.formatSubscribeRequestBody(profilesSubset, list_id, custom_source);
99
+ const response = request(`${config_1.API_URL}/profile-subscription-bulk-create-jobs/`, {
100
+ method: 'POST',
101
+ headers: {
102
+ revision: '2024-02-15'
103
+ },
104
+ json: subData
105
+ });
106
+ requests.push(response);
107
+ }
108
+ });
109
+ return await Promise.all(requests);
110
+ }
111
+ };
112
+ exports.default = action;
113
+ function sortBatches(batchPayload) {
114
+ const output = {};
115
+ batchPayload.forEach((payload) => {
116
+ const { email, phone_number, custom_source, consented_at, list_id } = payload;
117
+ const listId = list_id || 'noListId';
118
+ const customSource = custom_source || 'noCustomSource';
119
+ const key = `${listId}${customSource}`;
120
+ if (!output[key]) {
121
+ const batch = {
122
+ profiles: []
123
+ };
124
+ if (list_id !== undefined) {
125
+ batch.list_id = list_id;
126
+ }
127
+ if (custom_source !== undefined) {
128
+ batch.custom_source = custom_source;
129
+ }
130
+ output[key] = batch;
131
+ }
132
+ const profileToSubscribe = functions_2.formatSubscribeProfile(email, phone_number, consented_at);
133
+ output[key].profiles.push(profileToSubscribe);
134
+ });
135
+ return output;
136
+ }
137
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/subscribeProfile/index.ts"],"names":[],"mappings":";;AAGA,4CAAmD;AAEnD,wDAA8D;AAC9D,4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a,IAAI,gBAAgB,CAAA;QAGtD,MAAM,GAAG,GAAG,GAAG,MAAM,GAAG,YAAY,EAAE,CAAA;QAGtC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;YAChB,MAAM,KAAK,GAA+E;gBACxF,QAAQ,EAAE,EAAE;aACb,CAAA;YAED,IAAI,OAAO,KAAK,SAAS,EAAE;gBACzB,KAAK,CAAC,OAAO,GAAG,OAAO,CAAA;aACxB;YAED,IAAI,aAAa,KAAK,SAAS,EAAE;gBAC/B,KAAK,CAAC,aAAa,GAAG,aAAa,CAAA;aACpC;YAED,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;SACpB;QAGD,MAAM,kBAAkB,GAAG,kCAAsB,CAAC,KAAK,EAAE,YAAY,EAAE,YAAY,CAAC,CAAA;QAGpF,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;IAC/C,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -0,0 +1,6 @@
1
+ export interface Payload {
2
+ email?: string;
3
+ phone_number?: string;
4
+ list_id?: string;
5
+ enable_batching?: boolean;
6
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/unsubscribeProfile/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const action: ActionDefinition<Settings, Payload>;
5
+ export default action;
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const functions_1 = require("../functions");
4
+ const actions_core_1 = require("@segment/actions-core");
5
+ const functions_2 = require("../functions");
6
+ const config_1 = require("../config");
7
+ const action = {
8
+ title: 'Unsubscribe Profile',
9
+ defaultSubscription: 'type = "track" and event = "User Unsubscribed"',
10
+ description: 'Unsubscribe Klaviyo profiles from Email marketing, SMS marketing, or both.',
11
+ fields: {
12
+ email: {
13
+ label: 'Email',
14
+ description: `The email address to unsubscribe. If provided, the associated profile will be unsubscribed to Email marketing.`,
15
+ type: 'string',
16
+ format: 'email',
17
+ default: {
18
+ '@if': {
19
+ exists: { '@path': '$.traits.email' },
20
+ then: { '@path': '$.traits.email' },
21
+ else: { '@path': '$.context.traits.email' }
22
+ }
23
+ }
24
+ },
25
+ phone_number: {
26
+ label: 'Phone Number',
27
+ description: `The phone number to unsubscribe. This must be in E.164 format. If provided, the associated profile will be unsubscribed to SMS marketing.`,
28
+ type: 'string',
29
+ default: {
30
+ '@if': {
31
+ exists: { '@path': '$.traits.phone' },
32
+ then: { '@path': '$.traits.phone' },
33
+ else: { '@path': '$.context.traits.phone' }
34
+ }
35
+ }
36
+ },
37
+ list_id: {
38
+ label: 'List Id',
39
+ description: `The Klaviyo list to remove the subscribed profiles from. If no list id is provided, the profile will be unsubscribed from all channels.`,
40
+ type: 'string',
41
+ dynamic: true
42
+ },
43
+ enable_batching: {
44
+ type: 'boolean',
45
+ label: 'Batch Data to Klaviyo',
46
+ description: 'When enabled, the action will use the Klaviyo batch API.'
47
+ }
48
+ },
49
+ dynamicFields: {
50
+ list_id: async (request) => {
51
+ return functions_1.getListIdDynamicData(request);
52
+ }
53
+ },
54
+ perform: async (request, { payload }) => {
55
+ const { email, phone_number, list_id } = payload;
56
+ if (!email && !phone_number) {
57
+ throw new actions_core_1.PayloadValidationError('Phone Number or Email is required.');
58
+ }
59
+ const profileToUnSubscribe = functions_2.formatUnsubscribeProfile(email, phone_number);
60
+ const unSubData = functions_2.formatUnsubscribeRequestBody(profileToUnSubscribe, list_id);
61
+ return await request(`${config_1.API_URL}/profile-subscription-bulk-delete-jobs`, {
62
+ method: 'POST',
63
+ headers: {
64
+ revision: '2024-02-15'
65
+ },
66
+ json: unSubData
67
+ });
68
+ },
69
+ performBatch: async (request, { payload }) => {
70
+ const filteredPayload = payload.filter((profile) => profile.email || profile.phone_number);
71
+ if (payload.length === 0) {
72
+ throw new actions_core_1.PayloadValidationError('Phone Number or Email is required.');
73
+ }
74
+ const sortedProfilesObject = sortBatches(filteredPayload);
75
+ const batches = Object.keys(sortedProfilesObject);
76
+ if (batches.length > 9) {
77
+ throw new actions_core_1.PayloadValidationError('Exceeded maximum allowed batches due to too many unique list_ids');
78
+ }
79
+ const requests = [];
80
+ batches.forEach((key) => {
81
+ const { list_id, profiles } = sortedProfilesObject[key];
82
+ for (let i = 0; i < profiles.length; i += 100) {
83
+ const profilesSubset = profiles.slice(i, i + 100);
84
+ const unSubData = functions_2.formatUnsubscribeRequestBody(profilesSubset, list_id);
85
+ const response = request(`${config_1.API_URL}/profile-subscription-bulk-delete-jobs`, {
86
+ method: 'POST',
87
+ headers: {
88
+ revision: '2024-02-15'
89
+ },
90
+ json: unSubData
91
+ });
92
+ requests.push(response);
93
+ }
94
+ });
95
+ return await Promise.all(requests);
96
+ }
97
+ };
98
+ exports.default = action;
99
+ function sortBatches(batchPayload) {
100
+ const output = {};
101
+ batchPayload.forEach((payload) => {
102
+ const { email, phone_number, list_id } = payload;
103
+ const key = list_id || 'noListId';
104
+ if (!output[key]) {
105
+ const batch = {
106
+ profiles: []
107
+ };
108
+ if (list_id !== undefined) {
109
+ batch.list_id = list_id;
110
+ }
111
+ output[key] = batch;
112
+ }
113
+ const profileToUnSubscribe = functions_2.formatUnsubscribeProfile(email, phone_number);
114
+ output[key].profiles.push(profileToUnSubscribe);
115
+ });
116
+ return output;
117
+ }
118
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/unsubscribeProfile/index.ts"],"names":[],"mappings":";;AAGA,4CAAmD;AACnD,wDAA8D;AAC9D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AoB,CAAC,CAAA;IACjD,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -0,0 +1,11 @@
1
+ export interface Payload {
2
+ quantity: number;
3
+ value: number;
4
+ currency: string;
5
+ productId?: string;
6
+ productName?: string;
7
+ productType?: string;
8
+ productVendor?: string;
9
+ variantId?: string;
10
+ variantName?: string;
11
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/addToCart/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const action: ActionDefinition<Settings, Payload>;
5
+ export default action;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../utils");
4
+ const schema_1 = require("../schema");
5
+ const action = {
6
+ title: 'Add to Cart',
7
+ description: 'This event tracks any time an object is added to the cart.',
8
+ defaultSubscription: 'type = "track" and event = "Product Added"',
9
+ fields: {
10
+ quantity: {
11
+ label: 'Quantity',
12
+ description: 'The number of items added to the cart',
13
+ type: 'number',
14
+ default: { '@path': '$.properties.quantity' },
15
+ required: true
16
+ },
17
+ ...schema_1.productFields
18
+ },
19
+ perform: utils_1.buildPerformer('add_to_cart')
20
+ };
21
+ exports.default = action;
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/addToCart/index.ts"],"names":[],"mappings":";;AAIA,oCAAyC;AACzC,sCAAyC;AAEzC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,4DAA4D;IACzE,mBAAmB,EAAE,4CAA4C;IACjE,MAAM,EAAE;QACN,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,uCAAuC;YACpD,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,uBAAuB,EAAE;YAC7C,QAAQ,EAAE,IAAI;SACf;QACD,GAAG,sBAAa;KACjB;IACD,OAAO,EAAE,sBAAc,CAAC,aAAa,CAAC;CACvC,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,17 @@
1
+ export interface Payload {
2
+ value: number;
3
+ currency: string;
4
+ discountCode?: string;
5
+ id?: string;
6
+ quantity?: number;
7
+ lineItems?: {
8
+ quantity?: number;
9
+ value?: number;
10
+ productId?: string;
11
+ productName?: string;
12
+ productType?: string;
13
+ productVendor?: string;
14
+ variantId?: string;
15
+ variantName?: string;
16
+ }[];
17
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/checkout/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const action: ActionDefinition<Settings, Payload>;
5
+ export default action;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../utils");
4
+ const schema_1 = require("../schema");
5
+ const action = {
6
+ title: 'Checkout',
7
+ description: 'This event tracks when a user goes to check out, regardless of whether they complete the purchase.',
8
+ defaultSubscription: 'type = "track" and event = "Checkout Started"',
9
+ fields: {
10
+ ...schema_1.priceFields(),
11
+ ...schema_1.orderInfoFields
12
+ },
13
+ perform: utils_1.buildPerformer('checkout')
14
+ };
15
+ exports.default = action;
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/checkout/index.ts"],"names":[],"mappings":";;AAIA,oCAAyC;AACzC,sCAAwD;AAExD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,UAAU;IACjB,WAAW,EAAE,oGAAoG;IACjH,mBAAmB,EAAE,+CAA+C;IACpE,MAAM,EAAE;QACN,GAAG,oBAAW,EAAE;QAChB,GAAG,wBAAe;KACnB;IACD,OAAO,EAAE,sBAAc,CAAC,UAAU,CAAC;CACpC,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,4 @@
1
+ export interface Payload {
2
+ code: string;
3
+ type: string;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/code/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const action: ActionDefinition<Settings, Payload>;
5
+ export default action;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../utils");
4
+ const action = {
5
+ title: 'Code',
6
+ description: 'Track when a user enters a discount code at checkout.',
7
+ defaultSubscription: 'type = "track" and event = "Coupon Entered"',
8
+ fields: {
9
+ code: {
10
+ label: 'Code',
11
+ description: 'The coupon or discount code applied',
12
+ type: 'string',
13
+ default: { '@path': '$.properties.coupon_id' },
14
+ required: true
15
+ },
16
+ type: {
17
+ label: 'Type',
18
+ description: 'The type of coupon or discount code used',
19
+ type: 'string',
20
+ default: 'promo',
21
+ required: true
22
+ }
23
+ },
24
+ perform: utils_1.buildPerformer('code')
25
+ };
26
+ exports.default = action;
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/code/index.ts"],"names":[],"mappings":";;AAIA,oCAAyC;AAEzC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,MAAM;IACb,WAAW,EAAE,uDAAuD;IACpE,mBAAmB,EAAE,6CAA6C;IAClE,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,qCAAqC;YAClD,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE;YAC9C,QAAQ,EAAE,IAAI;SACf;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,0CAA0C;YACvD,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,OAAO;YAChB,QAAQ,EAAE,IAAI;SACf;KACF;IACD,OAAO,EAAE,sBAAc,CAAC,MAAM,CAAC;CAChC,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,4 @@
1
+ export interface Settings {
2
+ pixelToken: string;
3
+ apiToken?: string;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/magellan-ai/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export interface Payload {
2
+ userId: string;
3
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/identify/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const action: ActionDefinition<Settings, Payload>;
5
+ export default action;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../utils");
4
+ const action = {
5
+ title: 'Identify',
6
+ description: 'If you have your own identifiers for customers, Magellan AI can accept that identifier and report it back to you with other measurement data.',
7
+ defaultSubscription: 'type = "identify"',
8
+ fields: {
9
+ userId: {
10
+ label: 'User ID',
11
+ description: 'Your internal, unique identifier for the user',
12
+ type: 'string',
13
+ default: { '@path': '$.userId' },
14
+ required: true
15
+ }
16
+ },
17
+ perform: utils_1.buildPerformer('identify')
18
+ };
19
+ exports.default = action;
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/identify/index.ts"],"names":[],"mappings":";;AAIA,oCAAyC;AAEzC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,UAAU;IACjB,WAAW,EACT,+IAA+I;IACjJ,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,MAAM,EAAE;YACN,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,+CAA+C;YAC5D,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;YAChC,QAAQ,EAAE,IAAI;SACf;KACF;IACD,OAAO,EAAE,sBAAc,CAAC,UAAU,CAAC;CACpC,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { DestinationDefinition } from '@segment/actions-core';
2
+ import type { Settings } from './generated-types';
3
+ declare const destination: DestinationDefinition<Settings>;
4
+ export default destination;
@@ -0,0 +1,60 @@
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 identify_1 = __importDefault(require("./identify"));
7
+ const view_1 = __importDefault(require("./view"));
8
+ const lead_1 = __importDefault(require("./lead"));
9
+ const product_1 = __importDefault(require("./product"));
10
+ const addToCart_1 = __importDefault(require("./addToCart"));
11
+ const checkout_1 = __importDefault(require("./checkout"));
12
+ const code_1 = __importDefault(require("./code"));
13
+ const purchase_1 = __importDefault(require("./purchase"));
14
+ const install_1 = __importDefault(require("./install"));
15
+ const thirdPartyEvent_1 = __importDefault(require("./thirdPartyEvent"));
16
+ const destination = {
17
+ name: 'Magellan AI (Actions)',
18
+ slug: 'actions-magellan-ai',
19
+ mode: 'cloud',
20
+ authentication: {
21
+ scheme: 'custom',
22
+ fields: {
23
+ pixelToken: {
24
+ label: 'Pixel token',
25
+ description: 'Unique identifier for the web pixel on whose behalf the event is being sent; 32 hex digits',
26
+ type: 'string',
27
+ required: true
28
+ },
29
+ apiToken: {
30
+ label: 'API token',
31
+ description: 'Required in order to pass GDPR deletion requests to Magellan AI',
32
+ type: 'string',
33
+ required: false
34
+ }
35
+ }
36
+ },
37
+ onDelete: async (request, { payload, settings }) => {
38
+ if (!settings.apiToken)
39
+ return;
40
+ return request('https://api.magellan.ai/v2/gdpr/delete', {
41
+ method: 'post',
42
+ headers: { Authorization: `Bearer ${settings.apiToken}` },
43
+ json: { ...payload, pixelToken: settings.pixelToken }
44
+ });
45
+ },
46
+ actions: {
47
+ identify: identify_1.default,
48
+ view: view_1.default,
49
+ lead: lead_1.default,
50
+ product: product_1.default,
51
+ addToCart: addToCart_1.default,
52
+ checkout: checkout_1.default,
53
+ code: code_1.default,
54
+ purchase: purchase_1.default,
55
+ install: install_1.default,
56
+ thirdPartyEvent: thirdPartyEvent_1.default
57
+ }
58
+ };
59
+ exports.default = destination;
60
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/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AP,iBAAO;QACP,eAAe,EAAf,yBAAe;KAChB;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -0,0 +1,12 @@
1
+ export interface Payload {
2
+ host: string;
3
+ app: string;
4
+ ip: string;
5
+ ua: string;
6
+ ts: string;
7
+ plat: string;
8
+ aifa?: string;
9
+ andi?: string;
10
+ idfa?: string;
11
+ idfv?: string;
12
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/magellan-ai/install/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const action: ActionDefinition<Settings, Payload>;
5
+ export default action;