@segment/action-destinations 3.227.2-staging.8 → 3.227.3-staging.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/destinations/braze/trackEvent/index.js +1 -1
  2. package/dist/destinations/braze/trackEvent/index.js.map +1 -1
  3. package/dist/destinations/braze/trackPurchase/generated-types.d.ts +1 -0
  4. package/dist/destinations/braze/trackPurchase/index.js +9 -0
  5. package/dist/destinations/braze/trackPurchase/index.js.map +1 -1
  6. package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.d.ts +1 -0
  7. package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.js +184 -0
  8. package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.js.map +1 -0
  9. package/dist/destinations/braze/updateUserProfile/generated-types.d.ts +1 -0
  10. package/dist/destinations/braze/updateUserProfile/index.js +11 -88
  11. package/dist/destinations/braze/updateUserProfile/index.js.map +1 -1
  12. package/dist/destinations/braze/utils.d.ts +4 -0
  13. package/dist/destinations/braze/utils.js +171 -1
  14. package/dist/destinations/braze/utils.js.map +1 -1
  15. package/dist/destinations/dynamic-yield-audiences/syncAudience/generated-types.d.ts +1 -0
  16. package/dist/destinations/dynamic-yield-audiences/syncAudience/index.js +12 -0
  17. package/dist/destinations/dynamic-yield-audiences/syncAudience/index.js.map +1 -1
  18. package/dist/destinations/engage/utils/track.d.ts +10 -10
  19. package/dist/destinations/google-enhanced-conversions/functions.d.ts +1 -1
  20. package/dist/destinations/google-enhanced-conversions/functions.js +1 -1
  21. package/dist/destinations/google-enhanced-conversions/functions.js.map +1 -1
  22. package/dist/destinations/google-enhanced-conversions/postConversion/index.js +1 -0
  23. package/dist/destinations/google-enhanced-conversions/postConversion/index.js.map +1 -1
  24. package/dist/destinations/klaviyo/functions.d.ts +3 -3
  25. package/dist/destinations/klaviyo/functions.js +19 -10
  26. package/dist/destinations/klaviyo/functions.js.map +1 -1
  27. package/dist/destinations/klaviyo/types.d.ts +8 -0
  28. package/dist/destinations/klaviyo/upsertProfile/generated-types.d.ts +1 -0
  29. package/dist/destinations/klaviyo/upsertProfile/index.js +21 -1
  30. package/dist/destinations/klaviyo/upsertProfile/index.js.map +1 -1
  31. package/dist/destinations/linkedin-conversions/api/index.d.ts +5 -1
  32. package/dist/destinations/linkedin-conversions/api/index.js +87 -0
  33. package/dist/destinations/linkedin-conversions/api/index.js.map +1 -1
  34. package/dist/destinations/linkedin-conversions/constants.d.ts +1 -0
  35. package/dist/destinations/linkedin-conversions/constants.js +7 -1
  36. package/dist/destinations/linkedin-conversions/constants.js.map +1 -1
  37. package/dist/destinations/linkedin-conversions/streamConversion/generated-types.d.ts +17 -0
  38. package/dist/destinations/linkedin-conversions/streamConversion/index.js +125 -6
  39. package/dist/destinations/linkedin-conversions/streamConversion/index.js.map +1 -1
  40. package/dist/destinations/linkedin-conversions/types.d.ts +37 -0
  41. package/dist/destinations/marketo-static-lists/constants.d.ts +1 -1
  42. package/dist/destinations/marketo-static-lists/index.js +8 -16
  43. package/dist/destinations/marketo-static-lists/index.js.map +1 -1
  44. package/package.json +1 -1
  45. package/dist/destinations/klaviyo/addProfileToList/generated-types.d.ts +0 -5
  46. package/dist/destinations/klaviyo/addProfileToList/generated-types.js +0 -3
  47. package/dist/destinations/klaviyo/addProfileToList/generated-types.js.map +0 -1
  48. package/dist/destinations/klaviyo/addProfileToList/index.d.ts +0 -5
  49. package/dist/destinations/klaviyo/addProfileToList/index.js +0 -61
  50. package/dist/destinations/klaviyo/addProfileToList/index.js.map +0 -1
  51. package/dist/destinations/klaviyo/properties.d.ts +0 -4
  52. package/dist/destinations/klaviyo/properties.js +0 -21
  53. package/dist/destinations/klaviyo/properties.js.map +0 -1
  54. package/dist/destinations/klaviyo/removeProfileToList/generated-types.d.ts +0 -5
  55. package/dist/destinations/klaviyo/removeProfileToList/generated-types.js +0 -3
  56. package/dist/destinations/klaviyo/removeProfileToList/generated-types.js.map +0 -1
  57. package/dist/destinations/klaviyo/removeProfileToList/index.d.ts +0 -5
  58. package/dist/destinations/klaviyo/removeProfileToList/index.js +0 -62
  59. package/dist/destinations/klaviyo/removeProfileToList/index.js.map +0 -1
@@ -1,15 +1,134 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const actions_core_1 = require("@segment/actions-core");
4
+ const api_1 = require("../api");
5
+ const constants_1 = require("../constants");
3
6
  const action = {
4
7
  title: 'Stream Conversion Event',
5
8
  description: 'Directly streams conversion events to a specific conversion rule.',
6
- fields: {},
7
- perform: (request, data) => {
8
- return request('https://example.com', {
9
- method: 'post',
10
- json: data.payload
11
- });
9
+ defaultSubscription: 'type = "track"',
10
+ fields: {
11
+ adAccountId: {
12
+ label: 'Ad Account',
13
+ description: 'A dynamic field dropdown which fetches all adAccounts.',
14
+ type: 'string',
15
+ required: true,
16
+ dynamic: true
17
+ },
18
+ conversionId: {
19
+ label: 'Conversion Rule',
20
+ description: 'Fetches a list of conversion rules given an ad account id.',
21
+ type: 'string',
22
+ required: false,
23
+ dynamic: true
24
+ },
25
+ conversionHappenedAt: {
26
+ label: 'Timestamp',
27
+ description: 'Epoch timestamp in milliseconds at which the conversion event happened. If your source records conversion timestamps in second, insert 000 at the end to transform it to milliseconds.',
28
+ type: 'integer',
29
+ required: true,
30
+ default: {
31
+ '@path': '$.timestamp'
32
+ }
33
+ },
34
+ conversionValue: {
35
+ label: 'Conversion Value',
36
+ description: 'The monetary value for this conversion. Example: [“currencyCode”: “USD”, “amount”: “50.0”].',
37
+ type: 'object',
38
+ required: false,
39
+ properties: {
40
+ currencyCode: {
41
+ label: 'Currency Code',
42
+ type: 'string',
43
+ required: true,
44
+ description: 'ISO format'
45
+ },
46
+ amount: {
47
+ label: 'Amount',
48
+ type: 'string',
49
+ required: true,
50
+ description: 'Value of the conversion in decimal string. Can be dynamically set up or have a fixed value.'
51
+ }
52
+ }
53
+ },
54
+ eventId: {
55
+ label: 'Event ID',
56
+ description: 'Will be used for deduplication in future.',
57
+ type: 'string',
58
+ required: false,
59
+ default: {
60
+ '@path': '$.messageId'
61
+ }
62
+ },
63
+ user: {
64
+ label: 'User',
65
+ description: 'userId or userInfo Combination is REQUIRED.',
66
+ type: 'object',
67
+ required: true,
68
+ properties: {
69
+ userIds: {
70
+ label: 'User Ids',
71
+ type: 'object',
72
+ multiple: true,
73
+ required: true,
74
+ properties: {
75
+ idType: {
76
+ label: 'idType',
77
+ type: 'string',
78
+ required: true
79
+ },
80
+ idValue: {
81
+ label: 'idValue',
82
+ type: 'string',
83
+ required: true
84
+ }
85
+ }
86
+ },
87
+ userInfo: {
88
+ label: 'User Info',
89
+ type: 'object',
90
+ required: false
91
+ }
92
+ }
93
+ }
94
+ },
95
+ dynamicFields: {
96
+ adAccountId: async (request) => {
97
+ const linkedIn = new api_1.LinkedInConversions(request);
98
+ return await linkedIn.getAdAccounts();
99
+ },
100
+ conversionId: async (request, { payload }) => {
101
+ const linkedIn = new api_1.LinkedInConversions(request);
102
+ return await linkedIn.getConversionRulesList(payload.adAccountId);
103
+ }
104
+ },
105
+ perform: async (request, { payload }) => {
106
+ validate(payload);
107
+ const linkedinApiClient = new api_1.LinkedInConversions(request);
108
+ return linkedinApiClient.streamConversionEvent(payload);
12
109
  }
13
110
  };
111
+ function validate(payload) {
112
+ const dateFromTimestamp = new Date(payload.conversionHappenedAt);
113
+ if (isNaN(dateFromTimestamp.getTime())) {
114
+ throw new actions_core_1.PayloadValidationError('Timestamp field should be valid timestamp.');
115
+ }
116
+ const ninetyDaysAgo = Date.now() - 90 * 24 * 60 * 60 * 1000;
117
+ if (payload.conversionHappenedAt < ninetyDaysAgo) {
118
+ throw new actions_core_1.PayloadValidationError('Timestamp should be within the past 90 days.');
119
+ }
120
+ if (payload.user.userIds.length === 0 &&
121
+ (!payload.user.userInfo || !(payload.user.userInfo.firstName && payload.user.userInfo.lastName))) {
122
+ throw new actions_core_1.PayloadValidationError('Either userIds array or userInfo with firstName and lastName should be present.');
123
+ }
124
+ else if (payload.user.userIds.length !== 0) {
125
+ const isValidUserIds = payload.user.userIds.some((obj) => {
126
+ return constants_1.SUPPORTED_ID_TYPE.includes(obj.idType);
127
+ });
128
+ if (!isValidUserIds) {
129
+ throw new actions_core_1.PayloadValidationError('Invalid idType in userIds field.');
130
+ }
131
+ }
132
+ }
14
133
  exports.default = action;
15
134
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/linkedin-conversions/streamConversion/index.ts"],"names":[],"mappings":";;AAIA,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,yBAAyB;IAChC,WAAW,EAAE,mEAAmE;IAChF,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE;QACzB,OAAO,OAAO,CAAC,qBAAqB,EAAE;YACpC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,OAAO;SACnB,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/linkedin-conversions/streamConversion/index.ts"],"names":[],"mappings":";;AACA,wDAA8D;AAG9D,gCAA4C;AAC5C,4CAAgD;AAEhD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,yBAAyB;IAChC,WAAW,EAAE,mEAAmE;IAChF,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,WAAW,EAAE;YACX,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,wDAAwD;YACrE,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,IAAI;SACd;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,4DAA4D;YACzE,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,IAAI;SACd;QAC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ACjF;IAED,IACE,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;QACjC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAChG;QACA,MAAM,IAAI,qCAAsB,CAAC,iFAAiF,CAAC,CAAA;KACpH;SAAM,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;QAC5C,MAAM,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;YACvD,OAAO,6BAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QAC/C,CAAC,CAAC,CAAA;QAEF,IAAI,CAAC,cAAc,EAAE;YACnB,MAAM,IAAI,qCAAsB,CAAC,kCAAkC,CAAC,CAAA;SACrE;KACF;AACH,CAAC;AAED,kBAAe,MAAM,CAAA"}
@@ -23,3 +23,40 @@ export declare class LinkedInRefreshTokenError extends HTTPError {
23
23
  };
24
24
  };
25
25
  }
26
+ export interface GetAdAccountsAPIResponse {
27
+ paging: {
28
+ count: number;
29
+ links: Array<any>;
30
+ start: number;
31
+ total: number;
32
+ };
33
+ elements: [Accounts];
34
+ }
35
+ export interface Accounts {
36
+ account: string;
37
+ changeAuditStamps: object;
38
+ role: string;
39
+ user: string;
40
+ version: object;
41
+ }
42
+ export interface AccountsErrorInfo {
43
+ response: {
44
+ data: {
45
+ message?: string;
46
+ code?: string;
47
+ };
48
+ };
49
+ }
50
+ export interface GetConversionListAPIResponse {
51
+ paging: {
52
+ count: number;
53
+ links: Array<any>;
54
+ start: number;
55
+ total: number;
56
+ };
57
+ elements: [Conversions];
58
+ }
59
+ export interface Conversions {
60
+ name: string;
61
+ id: string;
62
+ }
@@ -14,7 +14,7 @@ export interface MarketoResonse {
14
14
  result: [
15
15
  {
16
16
  name: string;
17
- id: string;
17
+ id: number;
18
18
  }
19
19
  ];
20
20
  }
@@ -62,12 +62,8 @@ const destination = {
62
62
  const endpoint = createAudienceInput.settings.api_endpoint;
63
63
  const statsClient = createAudienceInput?.statsContext?.statsClient;
64
64
  const statsTags = createAudienceInput?.statsContext?.tags;
65
- const access_token = await constants_1.getAccessToken(request, createAudienceInput.settings);
66
65
  const get_folder_response = await request(`${endpoint}/rest/asset/v1/folder/byName.json?name=${encodeURIComponent(folder)}`, {
67
- method: 'GET',
68
- headers: {
69
- authorization: `Bearer ${access_token}`
70
- }
66
+ method: 'GET'
71
67
  });
72
68
  if (!get_folder_response.data.success && get_folder_response.data.errors) {
73
69
  statsClient?.incr('createAudience.error', 1, statsTags);
@@ -79,18 +75,18 @@ const destination = {
79
75
  }
80
76
  const folder_id = get_folder_response.data.result[0].id;
81
77
  const create_list_response = await request(`${endpoint}/rest/asset/v1/staticLists.json?folder=${folder_id}&name=${encodeURIComponent(audience_name)}`, {
82
- method: 'POST',
83
- headers: {
84
- authorization: `Bearer ${access_token}`
85
- }
78
+ method: 'POST'
86
79
  });
87
80
  if (!create_list_response.data.success && create_list_response.data.errors) {
88
81
  statsClient?.incr('createAudience.error', 1, statsTags);
89
82
  throw new actions_core_1.IntegrationError(`${create_list_response.data.errors[0].message}`, 'INVALID_RESPONSE', 400);
90
83
  }
91
- statsClient?.incr('createAudience.success', 1, statsTags);
84
+ const external_id = create_list_response.data.result[0].id.toString();
85
+ if (external_id) {
86
+ statsClient?.incr('createAudience.success', 1, statsTags);
87
+ }
92
88
  return {
93
- externalId: create_list_response.data.result[0].id
89
+ externalId: external_id
94
90
  };
95
91
  },
96
92
  async getAudience(request, getAudienceInput) {
@@ -98,12 +94,8 @@ const destination = {
98
94
  const list_id = getAudienceInput.externalId;
99
95
  const statsClient = getAudienceInput?.statsContext?.statsClient;
100
96
  const statsTags = getAudienceInput?.statsContext?.tags;
101
- const access_token = await constants_1.getAccessToken(request, getAudienceInput.settings);
102
97
  const response = await request(`${endpoint}/rest/asset/v1/staticList/${list_id}.json`, {
103
- method: 'GET',
104
- headers: {
105
- authorization: `Bearer ${access_token}`
106
- }
98
+ method: 'GET'
107
99
  });
108
100
  if (!response.data.success && response.data.errors) {
109
101
  statsClient?.incr('getAudience.error', 1, statsTags);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/marketo-static-lists/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAwD;AAGxD,4DAAmC;AACnC,sEAA6C;AAC7C,2CAA4D;AAE5D,MAAM,WAAW,GAA4C;IAC3D,IAAI,EAAE,gCAAgC;IACtC,IAAI,EAAE,8BAA8B;IACpC,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,SAAS,EAAE;gBACT,KAAK,EAAE,WAAW;gBAClB,WAAW,EAAE,kCAAkC;gBAC/C,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,aAAa,EAAE;gBACb,KAAK,EAAE,eAAe;gBACtB,WAAW,EAAE,sCAAsC;gBACnD,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE,IAAI;aACf;YACD,YAAY,EAAE;gBACZ,KAAK,EAAE,cAAc;gBACrB,WAAW,EAAE,wFAAwF;gBACrG,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,WAAW,EAAE;gBACX,KAAK,EAAE,aAAa;gBACpB,WAAW,EAAE,qDAAqD;gBAClE,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;SACF;QACD,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;YAClD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAA;Q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,SAAS,CAAC,CAAA;YAEtD,OAAO;gBACL,UAAU,EAAE,OAAO;aACpB,CAAA;QACH,CAAC;KACF;IACD,OAAO,EAAE;QACP,SAAS,EAAT,mBAAS;QACT,cAAc,EAAd,wBAAc;KACf;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@segment/action-destinations",
3
3
  "description": "Destination Actions engine and definitions.",
4
- "version": "3.227.2-staging.8",
4
+ "version": "3.227.3-staging.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/segmentio/action-destinations",
@@ -1,5 +0,0 @@
1
- export interface Payload {
2
- profile_id?: string;
3
- list_id?: string;
4
- enable_batching?: boolean;
5
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=generated-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/addProfileToList/generated-types.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- import { ActionDefinition } from '@segment/actions-core';
2
- import type { Settings } from '../generated-types';
3
- import { Payload } from './generated-types';
4
- declare const action: ActionDefinition<Settings, Payload>;
5
- export default action;
@@ -1,61 +0,0 @@
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: 'Add To List',
8
- description: 'Add to list',
9
- fields: {
10
- profile_id: { ...properties_1.profile_id },
11
- list_id: { ...properties_1.list_id },
12
- enable_batching: { ...properties_1.enable_batching }
13
- },
14
- dynamicFields: {
15
- list_id: async (request, { settings }) => {
16
- return functions_1.getListIdDynamicData(request, settings);
17
- }
18
- },
19
- perform: async (request, { payload }) => {
20
- const { profile_id, list_id } = payload;
21
- if (!list_id) {
22
- throw new actions_core_1.IntegrationError("Insert the ID of the default list that you'd like to subscribe users", 'Missing required fields', 400);
23
- }
24
- try {
25
- const listData = {
26
- data: [
27
- {
28
- type: 'profile',
29
- id: profile_id
30
- }
31
- ]
32
- };
33
- const list = await functions_1.executeProfileList(request, 'POST', listData, list_id);
34
- return list;
35
- }
36
- catch (error) {
37
- throw new Error('An error occurred while processing the request');
38
- }
39
- },
40
- performBatch: async (request, { payload }) => {
41
- try {
42
- if (!payload[0].list_id) {
43
- throw new actions_core_1.IntegrationError("Insert the ID of the default list that you'd like to subscribe users", 'Missing required fields', 400);
44
- }
45
- const batch_data = { data: [] };
46
- payload.forEach((data) => {
47
- if (!data.list_id) {
48
- return;
49
- }
50
- batch_data.data.push({ type: 'profile', id: data.profile_id });
51
- });
52
- const list = await functions_1.executeProfileList(request, 'POST', batch_data, payload[0].list_id);
53
- return list;
54
- }
55
- catch (error) {
56
- throw new Error('An error occurred while processing the request');
57
- }
58
- }
59
- };
60
- exports.default = action;
61
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/addProfileToList/index.ts"],"names":[],"mappings":";;AAAA,wDAAgG;AAIhG,4CAAuE;AACvE,8CAAoE;AAEpE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,aAAa;IAC1B,MAAM,EAAE;QACN,UAAU,EAAE,EAAE,GAAG,uBAAU,EAAE;QAC7B,OAAO,EAAE,EAAE,GAAG,oBAAO,EAAE;QACvB,eAAe,EAAE,EAAE,GAAG,4BAAe,EAAE;KACxC;IACD,aAAa,EAAE;QACb,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAiC,EAAE;YACtE,OAAO,gCAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;QAChD,CAAC;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EA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AA;SACZ;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAA;SAClE;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -1,4 +0,0 @@
1
- import { InputField } from '@segment/actions-core/destination-kit/types';
2
- export declare const enable_batching: InputField;
3
- export declare const list_id: InputField;
4
- export declare const profile_id: InputField;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.profile_id = exports.list_id = exports.enable_batching = void 0;
4
- exports.enable_batching = {
5
- label: 'Enable Batching',
6
- description: 'Enable batching of requests to the Klaviyo.',
7
- type: 'boolean',
8
- default: true
9
- };
10
- exports.list_id = {
11
- label: 'List Id',
12
- description: `'Insert the ID of the default list that you'd like to subscribe users to when you call .identify().'`,
13
- type: 'string',
14
- dynamic: true
15
- };
16
- exports.profile_id = {
17
- label: 'Profile Id',
18
- description: 'Profile Id of User',
19
- type: 'string'
20
- };
21
- //# sourceMappingURL=properties.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/properties.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAAe;IACzC,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE,6CAA6C;IAC1D,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,IAAI;CACd,CAAA;AAEY,QAAA,OAAO,GAAe;IACjC,KAAK,EAAE,SAAS;IAChB,WAAW,EAAE,sGAAsG;IACnH,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,IAAI;CACd,CAAA;AAEY,QAAA,UAAU,GAAe;IACpC,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,oBAAoB;IACjC,IAAI,EAAE,QAAQ;CACf,CAAA"}
@@ -1,5 +0,0 @@
1
- export interface Payload {
2
- profile_id?: string;
3
- list_id?: string;
4
- enable_batching?: boolean;
5
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=generated-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/removeProfileToList/generated-types.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- import { ActionDefinition } from '@segment/actions-core';
2
- import type { Settings } from '../generated-types';
3
- import { Payload } from './generated-types';
4
- declare const action: ActionDefinition<Settings, Payload>;
5
- export default action;
@@ -1,62 +0,0 @@
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
- profile_id: { ...properties_1.profile_id },
11
- list_id: { ...properties_1.list_id },
12
- enable_batching: { ...properties_1.enable_batching }
13
- },
14
- dynamicFields: {
15
- list_id: async (request, { settings }) => {
16
- return functions_1.getListIdDynamicData(request, settings);
17
- }
18
- },
19
- perform: async (request, { payload }) => {
20
- const { profile_id, list_id } = payload;
21
- if (!list_id) {
22
- throw new actions_core_1.IntegrationError("Insert the ID of the default list that you'd like to subscribe users", 'Missing required fields', 400);
23
- }
24
- try {
25
- const listData = {
26
- data: [
27
- {
28
- type: 'profile',
29
- id: profile_id
30
- }
31
- ]
32
- };
33
- const list = await functions_1.executeProfileList(request, 'DELETE', listData, list_id);
34
- return list;
35
- }
36
- catch (error) {
37
- console.log(error);
38
- throw new Error('An error occurred while processing the request');
39
- }
40
- },
41
- performBatch: async (request, { payload }) => {
42
- try {
43
- if (!payload[0].list_id) {
44
- throw new actions_core_1.IntegrationError("Insert the ID of the default list that you'd like to subscribe users", 'Missing required fields', 400);
45
- }
46
- const batch_data = { data: [] };
47
- payload.forEach((data) => {
48
- if (!data.list_id) {
49
- return;
50
- }
51
- batch_data.data.push({ type: 'profile', id: data.profile_id });
52
- });
53
- const list = await functions_1.executeProfileList(request, 'DELETE', batch_data, payload[0].list_id);
54
- return list;
55
- }
56
- catch (error) {
57
- throw new Error('An error occurred while processing the request');
58
- }
59
- }
60
- };
61
- exports.default = action;
62
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/removeProfileToList/index.ts"],"names":[],"mappings":";;AAAA,wDAAgG;AAKhG,4CAAuE;AACvE,8CAAoE;AAEpE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,0BAA0B;IACjC,WAAW,EAAE,0BAA0B;IACvC,MAAM,EAAE;QACN,UAAU,EAAE,EAAE,GAAG,uBAAU,EAAE;QAC7B,OAAO,EAAE,EAAE,GAAG,oBAAO,EAAE;QACvB,eAAe,EAAE,EAAE,GAAG,4BAAe,EAAE;KACxC;IACD,aAAa,EAAE;QACb,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAiC,EAAE;YACtE,OAAO,gCAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;QAChD,CAAC;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACtC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,OAAO,CAAA;QAEvC,IAAI,CAAC,OAAO,EAAE;YACZ,MAAM,IAAI,+BAAgB,CACxB,sEAAsE,EACtE,yBAAyB,EACzB,GAAG,CACJ,CAAA;SACF;QACD,IAAI;YACF,MAAM,QAAQ,GAAa;gBACzB,IAAI,EAAE;oBACJ;wBACE,IAAI,EAAE,SAAS;wBACf,EAAE,EAAE,UAAU;qBACf;iBACF;aACF,CAAA;YAED,MAAM,IAAI,GAAG,MAAM,8BAAkB,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;YAC3E,OAAO,IAAI,CAAA;SACZ;QAAC,OAAO,KAA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