@segment/action-destinations 3.221.0-staging.0 → 3.221.1-080fa7b.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 (138) hide show
  1. package/dist/destinations/ambee/subscribeUserToCampaign/index.js +4 -2
  2. package/dist/destinations/ambee/subscribeUserToCampaign/index.js.map +1 -1
  3. package/dist/destinations/braze-cohorts/syncAudiences/index.js +6 -3
  4. package/dist/destinations/braze-cohorts/syncAudiences/index.js.map +1 -1
  5. package/dist/destinations/cordial/identities-fields.d.ts +1 -1
  6. package/dist/destinations/cordial/identities-fields.js +5 -3
  7. package/dist/destinations/cordial/identities-fields.js.map +1 -1
  8. package/dist/destinations/dynamic-yield-audiences/syncAudience/index.js +10 -5
  9. package/dist/destinations/dynamic-yield-audiences/syncAudience/index.js.map +1 -1
  10. package/dist/destinations/engage/twilio/utils/PhoneMessageSender.js +0 -1
  11. package/dist/destinations/engage/twilio/utils/PhoneMessageSender.js.map +1 -1
  12. package/dist/destinations/google-sheets/postSheet/index.js +2 -1
  13. package/dist/destinations/google-sheets/postSheet/index.js.map +1 -1
  14. package/dist/destinations/hubspot/upsertContact/index.d.ts +1 -1
  15. package/dist/destinations/hubspot/upsertContact/index.js +28 -8
  16. package/dist/destinations/hubspot/upsertContact/index.js.map +1 -1
  17. package/dist/destinations/index.js +2 -2
  18. package/dist/destinations/index.js.map +1 -1
  19. package/dist/destinations/klaviyo/index.js +5 -9
  20. package/dist/destinations/klaviyo/index.js.map +1 -1
  21. package/dist/destinations/klaviyo/upsertProfile/generated-types.d.ts +1 -21
  22. package/dist/destinations/klaviyo/upsertProfile/index.js +5 -150
  23. package/dist/destinations/klaviyo/upsertProfile/index.js.map +1 -1
  24. package/dist/destinations/launchdarkly-audiences/syncAudience/index.js +12 -6
  25. package/dist/destinations/launchdarkly-audiences/syncAudience/index.js.map +1 -1
  26. package/dist/destinations/linkedin-audiences/updateAudience/index.js +8 -4
  27. package/dist/destinations/linkedin-audiences/updateAudience/index.js.map +1 -1
  28. package/dist/destinations/livelike-cloud/trackEvent/index.js +2 -1
  29. package/dist/destinations/livelike-cloud/trackEvent/index.js.map +1 -1
  30. package/dist/destinations/liveramp-audiences/audienceEnteredSFTP.types.d.ts +16 -0
  31. package/dist/destinations/liveramp-audiences/audienceEnteredSFTP.types.js +3 -0
  32. package/dist/destinations/liveramp-audiences/audienceEnteredSFTP.types.js.map +1 -0
  33. package/dist/destinations/loops/createOrUpdateContact/generated-types.d.ts +1 -1
  34. package/dist/destinations/loops/createOrUpdateContact/index.js +2 -2
  35. package/dist/destinations/loops/createOrUpdateContact/index.js.map +1 -1
  36. package/dist/destinations/optimizely-advanced-audience-targeting/syncAudience/index.js +8 -4
  37. package/dist/destinations/optimizely-advanced-audience-targeting/syncAudience/index.js.map +1 -1
  38. package/dist/destinations/optimizely-feature-experimentation-actions/trackEvent/index.js +2 -1
  39. package/dist/destinations/optimizely-feature-experimentation-actions/trackEvent/index.js.map +1 -1
  40. package/dist/destinations/outfunnel/forwardGroupEvent/index.js +10 -5
  41. package/dist/destinations/outfunnel/forwardGroupEvent/index.js.map +1 -1
  42. package/dist/destinations/outfunnel/forwardIdentifyEvent/index.js +8 -4
  43. package/dist/destinations/outfunnel/forwardIdentifyEvent/index.js.map +1 -1
  44. package/dist/destinations/outfunnel/forwardTrackEvent/index.js +8 -4
  45. package/dist/destinations/outfunnel/forwardTrackEvent/index.js.map +1 -1
  46. package/dist/destinations/segment-profiles/segment-properties.d.ts +1 -0
  47. package/dist/destinations/segment-profiles/segment-properties.js +9 -1
  48. package/dist/destinations/segment-profiles/segment-properties.js.map +1 -1
  49. package/dist/destinations/segment-profiles/sendGroup/generated-types.d.ts +1 -0
  50. package/dist/destinations/segment-profiles/sendGroup/index.js +3 -1
  51. package/dist/destinations/segment-profiles/sendGroup/index.js.map +1 -1
  52. package/dist/destinations/segment-profiles/sendIdentify/generated-types.d.ts +1 -0
  53. package/dist/destinations/segment-profiles/sendIdentify/index.js +3 -1
  54. package/dist/destinations/segment-profiles/sendIdentify/index.js.map +1 -1
  55. package/dist/destinations/segment-profiles/sendSubscription/generated-types.d.ts +1 -0
  56. package/dist/destinations/segment-profiles/sendSubscription/index.js +4 -1
  57. package/dist/destinations/segment-profiles/sendSubscription/index.js.map +1 -1
  58. package/dist/destinations/the-trade-desk-crm/functions.js +7 -1
  59. package/dist/destinations/the-trade-desk-crm/functions.js.map +1 -1
  60. package/dist/destinations/the-trade-desk-crm/index.js +1 -1
  61. package/dist/destinations/tiktok-audiences/properties.js +8 -4
  62. package/dist/destinations/tiktok-audiences/properties.js.map +1 -1
  63. package/dist/destinations/trackey/generated-types.d.ts +3 -0
  64. package/dist/destinations/trackey/generated-types.js.map +1 -0
  65. package/dist/destinations/trackey/group.types.d.ts +11 -0
  66. package/dist/destinations/{klaviyo/trackEvent/generated-types.js → trackey/group.types.js} +1 -1
  67. package/dist/destinations/trackey/group.types.js.map +1 -0
  68. package/dist/destinations/trackey/identify.types.d.ts +11 -0
  69. package/dist/destinations/{klaviyo/orderCompleted/generated-types.js → trackey/identify.types.js} +1 -1
  70. package/dist/destinations/trackey/identify.types.js.map +1 -0
  71. package/dist/destinations/trackey/index.d.ts +4 -0
  72. package/dist/destinations/trackey/index.js +206 -0
  73. package/dist/destinations/trackey/index.js.map +1 -0
  74. package/dist/destinations/trackey/track.types.d.ts +12 -0
  75. package/dist/destinations/{klaviyo/removeProfileToList/generated-types.js → trackey/track.types.js} +1 -1
  76. package/dist/destinations/trackey/track.types.js.map +1 -0
  77. package/dist/destinations/twilio-studio/triggerStudioFlow/index.js +6 -3
  78. package/dist/destinations/twilio-studio/triggerStudioFlow/index.js.map +1 -1
  79. package/dist/destinations/yahoo-audiences/generated-types.d.ts +2 -4
  80. package/dist/destinations/yahoo-audiences/index.js +47 -42
  81. package/dist/destinations/yahoo-audiences/index.js.map +1 -1
  82. package/dist/destinations/yahoo-audiences/types.d.ts +6 -0
  83. package/dist/destinations/yahoo-audiences/updateSegment/generated-types.d.ts +4 -5
  84. package/dist/destinations/yahoo-audiences/updateSegment/index.d.ts +2 -2
  85. package/dist/destinations/yahoo-audiences/updateSegment/index.js +66 -65
  86. package/dist/destinations/yahoo-audiences/updateSegment/index.js.map +1 -1
  87. package/dist/destinations/yahoo-audiences/utils-rt.d.ts +3 -3
  88. package/dist/destinations/yahoo-audiences/utils-rt.js +28 -20
  89. package/dist/destinations/yahoo-audiences/utils-rt.js.map +1 -1
  90. package/dist/destinations/yahoo-audiences/utils-tax.d.ts +3 -5
  91. package/dist/destinations/yahoo-audiences/utils-tax.js +28 -17
  92. package/dist/destinations/yahoo-audiences/utils-tax.js.map +1 -1
  93. package/package.json +5 -5
  94. package/dist/destinations/klaviyo/addProfileToList/generated-types.d.ts +0 -4
  95. package/dist/destinations/klaviyo/addProfileToList/generated-types.js.map +0 -1
  96. package/dist/destinations/klaviyo/addProfileToList/index.d.ts +0 -5
  97. package/dist/destinations/klaviyo/addProfileToList/index.js +0 -53
  98. package/dist/destinations/klaviyo/addProfileToList/index.js.map +0 -1
  99. package/dist/destinations/klaviyo/config.d.ts +0 -1
  100. package/dist/destinations/klaviyo/config.js +0 -5
  101. package/dist/destinations/klaviyo/config.js.map +0 -1
  102. package/dist/destinations/klaviyo/functions.d.ts +0 -2
  103. package/dist/destinations/klaviyo/functions.js +0 -35
  104. package/dist/destinations/klaviyo/functions.js.map +0 -1
  105. package/dist/destinations/klaviyo/orderCompleted/generated-types.d.ts +0 -22
  106. package/dist/destinations/klaviyo/orderCompleted/generated-types.js.map +0 -1
  107. package/dist/destinations/klaviyo/orderCompleted/index.d.ts +0 -5
  108. package/dist/destinations/klaviyo/orderCompleted/index.js +0 -152
  109. package/dist/destinations/klaviyo/orderCompleted/index.js.map +0 -1
  110. package/dist/destinations/klaviyo/removeProfileToList/generated-types.d.ts +0 -4
  111. package/dist/destinations/klaviyo/removeProfileToList/generated-types.js.map +0 -1
  112. package/dist/destinations/klaviyo/removeProfileToList/index.d.ts +0 -5
  113. package/dist/destinations/klaviyo/removeProfileToList/index.js +0 -53
  114. package/dist/destinations/klaviyo/removeProfileToList/index.js.map +0 -1
  115. package/dist/destinations/klaviyo/trackEvent/generated-types.d.ts +0 -16
  116. package/dist/destinations/klaviyo/trackEvent/generated-types.js.map +0 -1
  117. package/dist/destinations/klaviyo/trackEvent/index.d.ts +0 -5
  118. package/dist/destinations/klaviyo/trackEvent/index.js +0 -118
  119. package/dist/destinations/klaviyo/trackEvent/index.js.map +0 -1
  120. package/dist/destinations/klaviyo/types.d.ts +0 -69
  121. package/dist/destinations/klaviyo/types.js +0 -8
  122. package/dist/destinations/klaviyo/types.js.map +0 -1
  123. package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.d.ts +0 -4
  124. package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.js +0 -3
  125. package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.js.map +0 -1
  126. package/dist/destinations/yahoo-audiences/createCustomerNode/index.d.ts +0 -5
  127. package/dist/destinations/yahoo-audiences/createCustomerNode/index.js +0 -33
  128. package/dist/destinations/yahoo-audiences/createCustomerNode/index.js.map +0 -1
  129. package/dist/destinations/yahoo-audiences/createSegment/generated-types.d.ts +0 -6
  130. package/dist/destinations/yahoo-audiences/createSegment/generated-types.js +0 -3
  131. package/dist/destinations/yahoo-audiences/createSegment/generated-types.js.map +0 -1
  132. package/dist/destinations/yahoo-audiences/createSegment/index.d.ts +0 -5
  133. package/dist/destinations/yahoo-audiences/createSegment/index.js +0 -45
  134. package/dist/destinations/yahoo-audiences/createSegment/index.js.map +0 -1
  135. package/dist/destinations/yahoo-audiences/utils.d.ts +0 -4
  136. package/dist/destinations/yahoo-audiences/utils.js +0 -30
  137. package/dist/destinations/yahoo-audiences/utils.js.map +0 -1
  138. /package/dist/destinations/{klaviyo/addProfileToList → trackey}/generated-types.js +0 -0
@@ -2,16 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.update_taxonomy = exports.gen_oauth1_signature = exports.gen_random_id = exports.gen_segment_subtaxonomy_payload = exports.gen_customer_taxonomy_payload = void 0;
4
4
  const crypto_1 = require("crypto");
5
- function gen_customer_taxonomy_payload(settings, payload) {
5
+ const actions_core_1 = require("@segment/actions-core");
6
+ function gen_customer_taxonomy_payload(settings) {
6
7
  const data = {
7
- id: payload.engage_space_id,
8
- name: payload.engage_space_id,
9
- description: payload.customer_desc,
8
+ id: settings.engage_space_id,
9
+ name: settings.engage_space_id,
10
+ description: settings.customer_desc,
10
11
  users: {
11
12
  include: [settings.mdm_id]
12
13
  }
13
14
  };
14
- const req_body_form = `--SEGMENT-DATA\r\nContent-Disposition: form-data; name="metadata"\r\nContent-Type: application/json;charset=UTF-8\r\n\r\n{ "description" : "${payload.customer_desc}" }\r\n--SEGMENT-DATA\r\nContent-Disposition: form-data; name="data"\r\nContent-Type: application/json;charset=UTF-8\r\n\r\n${JSON.stringify(data)}\r\n--SEGMENT-DATA--`;
15
+ const req_body_form = `--SEGMENT-DATA\r\nContent-Disposition: form-data; name="metadata"\r\nContent-Type: application/json;charset=UTF-8\r\n\r\n{ "description" : "${settings.customer_desc}" }\r\n--SEGMENT-DATA\r\nContent-Disposition: form-data; name="data"\r\nContent-Type: application/json;charset=UTF-8\r\n\r\n${JSON.stringify(data)}\r\n--SEGMENT-DATA--`;
15
16
  return req_body_form;
16
17
  }
17
18
  exports.gen_customer_taxonomy_payload = gen_customer_taxonomy_payload;
@@ -21,7 +22,7 @@ function gen_segment_subtaxonomy_payload(payload) {
21
22
  name: payload.segment_audience_key,
22
23
  type: 'SEGMENT'
23
24
  };
24
- const req_body_form = `--SEGMENT-DATA\r\nContent-Disposition: form-data; name="metadata"\r\nContent-Type: application/json;charset=UTF-8\r\n\r\n{ "description" : "${payload.customer_desc}" }\r\n--SEGMENT-DATA\r\nContent-Disposition: form-data; name="data"\r\nContent-Type: application/json;charset=UTF-8\r\n\r\n${JSON.stringify(data)}\r\n--SEGMENT-DATA--`;
25
+ const req_body_form = `--SEGMENT-DATA\r\nContent-Disposition: form-data; name="metadata"\r\nContent-Type: application/json;charset=UTF-8\r\n\r\n{ "description" : "Create segment ${data.id}" }\r\n--SEGMENT-DATA\r\nContent-Disposition: form-data; name="data"\r\nContent-Type: application/json;charset=UTF-8\r\n\r\n${JSON.stringify(data)}\r\n--SEGMENT-DATA--`;
25
26
  return req_body_form;
26
27
  }
27
28
  exports.gen_segment_subtaxonomy_payload = gen_segment_subtaxonomy_payload;
@@ -48,20 +49,30 @@ function gen_oauth1_signature(client_key, client_secret, method, url) {
48
49
  }
49
50
  exports.gen_oauth1_signature = gen_oauth1_signature;
50
51
  async function update_taxonomy(engage_space_id, tx_creds, request, body_form_data) {
51
- const tx_client_secret = tx_creds.tx_client_key;
52
- const tx_client_key = tx_creds.tx_client_secret;
52
+ const tx_client_secret = tx_creds.tx_client_secret;
53
+ const tx_client_key = tx_creds.tx_client_key;
53
54
  const url = `https://datax.yahooapis.com/v1/taxonomy/append${engage_space_id.length > 0 ? '/' + engage_space_id : ''}`;
54
55
  const oauth1_auth_string = gen_oauth1_signature(tx_client_key, tx_client_secret, 'PUT', url);
55
- const add_segment_node = await request(url, {
56
- method: 'PUT',
57
- body: body_form_data,
58
- headers: {
59
- Authorization: oauth1_auth_string,
60
- 'Content-Type': 'multipart/form-data; boundary=SEGMENT-DATA'
56
+ try {
57
+ const add_segment_node = await request(url, {
58
+ method: 'PUT',
59
+ body: body_form_data,
60
+ headers: {
61
+ Authorization: oauth1_auth_string,
62
+ 'Content-Type': 'multipart/form-data; boundary=SEGMENT-DATA'
63
+ }
64
+ });
65
+ return await add_segment_node.json();
66
+ }
67
+ catch (error) {
68
+ const _error = error;
69
+ if (parseInt(_error.response.status) == 401) {
70
+ throw new actions_core_1.IntegrationError(`Error while updating taxonomy: ${JSON.stringify(_error.response.data)} ${_error.response.status}. Validate Yahoo credentials`, 'YAHOO_TAXONOMY_API_AUTH_ERR', 400);
71
+ }
72
+ else {
73
+ throw error;
61
74
  }
62
- });
63
- console.log('upd tax status:', add_segment_node.status);
64
- return await add_segment_node.json();
75
+ }
65
76
  }
66
77
  exports.update_taxonomy = update_taxonomy;
67
78
  //# sourceMappingURL=utils-tax.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils-tax.js","sourceRoot":"","sources":["../../../src/destinations/yahoo-audiences/utils-tax.ts"],"names":[],"mappings":";;;AAGA,mCAAmC;AAInC,SAAgB,6BAA6B,CAAC,QAAkB,EAAE,OAA4B;IAC5F,MAAM,IAAI,GAAG;QACX,EAAE,EAAE,OAAO,CAAC,eAAe;QAC3B,IAAI,EAAE,OAAO,CAAC,eAAe;QAC7B,WAAW,EAAE,OAAO,CAAC,aAAa;QAClC,KAAK,EAAE;YACL,OAAO,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC;SAC3B;KACF,CAAA;IAED,MAAM,aAAa,GAAG,+IACpB,OAAO,CAAC,aACV,+HAA+H,IAAI,CAAC,SAAS,CAC3I,IAAI,CACL,sBAAsB,CAAA;IACvB,OAAO,aAAa,CAAA;AACtB,CAAC;AAhBD,sEAgBC;AAED,SAAgB,+BAA+B,CAAC,OAA2B;IACzE,MAAM,IAAI,GAAG;QACX,EAAE,EAAE,OAAO,CAAC,mBAAmB;QAC/B,IAAI,EAAE,OAAO,CAAC,oBAAoB;QAClC,IAAI,EAAE,SAAS;KAChB,CAAA;IACD,MAAM,aAAa,GAAG,+IACpB,OAAO,CAAC,aACV,+HAA+H,IAAI,CAAC,SAAS,CAC3I,IAAI,CACL,sBAAsB,CAAA;IACvB,OAAO,aAAa,CAAA;AACtB,CAAC;AAZD,0EAYC;AAED,SAAgB,aAAa,CAAC,MAAc;IAC1C,MAAM,OAAO,GAAG,qCAAqC,CAAA;IACrD,MAAM,SAAS,GAAa,EAAE,CAAA;IAC9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QAC/B,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC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AAQ,CAAC,MAAM,CAAC,IAAI,GAAG,EAAE;YAC3C,MAAM,IAAI,+BAAgB,CACxB,kCAAkC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IACpE,MAAM,CAAC,QAAQ,CAAC,MAClB,8BAA8B,EAC9B,6BAA6B,EAC7B,GAAG,CACJ,CAAA;SACF;aAAM;YACL,MAAM,KAAK,CAAA;SACZ;KACF;AACH,CAAC;AApCD,0CAoCC"}
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.221.0-staging.0",
4
+ "version": "3.221.1-080fa7b.0+080fa7b",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/segmentio/action-destinations",
@@ -23,7 +23,7 @@
23
23
  "registry": "https://registry.npmjs.org"
24
24
  },
25
25
  "scripts": {
26
- "build": "yarn clean && yarn tsc -b tsconfig.build.json",
26
+ "build": "yarn tsc -b tsconfig.build.json",
27
27
  "clean": "tsc -b tsconfig.build.json --clean",
28
28
  "postclean": "rm -rf dist",
29
29
  "prepublishOnly": "yarn build",
@@ -40,8 +40,8 @@
40
40
  "dependencies": {
41
41
  "@amplitude/ua-parser-js": "^0.7.25",
42
42
  "@segment/a1-notation": "^2.1.4",
43
- "@segment/actions-core": "^3.83.0",
44
- "@segment/actions-shared": "^1.65.0",
43
+ "@segment/actions-core": "^3.83.1-080fa7b.0+080fa7b",
44
+ "@segment/actions-shared": "^1.65.1-080fa7b.0+080fa7b",
45
45
  "@types/node": "^18.11.15",
46
46
  "ajv-formats": "^2.1.1",
47
47
  "aws4": "^1.12.0",
@@ -77,5 +77,5 @@
77
77
  "__tests__/__helpers__/"
78
78
  ]
79
79
  },
80
- "gitHead": "9c04e12c4a0e81f6b68dca0a297fb2c0209d2431"
80
+ "gitHead": "080fa7b99761cbe62306e0dcd32ec2054da9ce48"
81
81
  }
@@ -1,4 +0,0 @@
1
- export interface Payload {
2
- profile_id?: string;
3
- list_id?: string;
4
- }
@@ -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,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const actions_core_1 = require("@segment/actions-core");
4
- const config_1 = require("../config");
5
- const functions_1 = require("../functions");
6
- const action = {
7
- title: 'Add To List',
8
- description: 'Add to list',
9
- fields: {
10
- profile_id: {
11
- label: 'Profile Id',
12
- description: 'Profile Id of User',
13
- type: 'string'
14
- },
15
- list_id: {
16
- label: 'List Id',
17
- description: `'Insert the ID of the default list that you'd like to subscribe users to when you call .identify().'`,
18
- type: 'string',
19
- dynamic: true
20
- }
21
- },
22
- dynamicFields: {
23
- list_id: async (request, { settings }) => {
24
- return functions_1.getListIdDynamicData(request, settings);
25
- }
26
- },
27
- perform: async (request, { payload }) => {
28
- try {
29
- const { profile_id, list_id } = payload;
30
- if (!list_id) {
31
- throw new actions_core_1.IntegrationError("Insert the ID of the default list that you'd like to subscribe users", 'Missing required fields', 400);
32
- }
33
- const listData = {
34
- data: [
35
- {
36
- type: 'profile',
37
- id: profile_id
38
- }
39
- ]
40
- };
41
- const list = await request(`${config_1.API_URL}/lists/${list_id}/relationships/profiles/`, {
42
- method: 'POST',
43
- json: listData
44
- });
45
- return list;
46
- }
47
- catch (error) {
48
- throw new Error('An error occurred while processing the request');
49
- }
50
- }
51
- };
52
- exports.default = action;
53
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/addProfileToList/index.ts"],"names":[],"mappings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export declare const API_URL = "https://a.klaviyo.com/api";
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.API_URL = void 0;
4
- exports.API_URL = 'https://a.klaviyo.com/api';
5
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/config.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,2BAA2B,CAAA"}
@@ -1,2 +0,0 @@
1
- import { RequestClient, DynamicFieldResponse } from '@segment/actions-core';
2
- export declare function getListIdDynamicData(request: RequestClient, settings: any): Promise<DynamicFieldResponse>;
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getListIdDynamicData = void 0;
4
- const config_1 = require("./config");
5
- async function getListIdDynamicData(request, settings) {
6
- try {
7
- const result = await request(`${config_1.API_URL}/lists/`, {
8
- method: 'get',
9
- headers: {
10
- Authorization: `Klaviyo-API-Key ${settings.api_key}`,
11
- Accept: 'application/json',
12
- revision: new Date().toISOString().slice(0, 10)
13
- },
14
- skipResponseCloning: true
15
- });
16
- const choices = JSON.parse(result.content).data.map((list) => {
17
- return { value: list.id, label: list.attributes.name };
18
- });
19
- return {
20
- choices
21
- };
22
- }
23
- catch (err) {
24
- return {
25
- choices: [],
26
- nextPage: '',
27
- error: {
28
- message: err.message ?? 'Unknown error',
29
- code: err.status + '' ?? 'Unknown error'
30
- }
31
- };
32
- }
33
- }
34
- exports.getListIdDynamicData = getListIdDynamicData;
35
- //# sourceMappingURL=functions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/functions.ts"],"names":[],"mappings":";;;AACA,qCAAkC;AAE3B,KAAK,UAAU,oBAAoB,CAAC,OAAsB,EAAE,QAAa;IAC9E,IAAI;QACF,MAAM,MAAM,GAAQ,MAAM,OAAO,CAAC,GAAG,gBAAO,SAAS,EAAE;YACrD,MAAM,EAAE,KAAK;YACb,OAAO,EAAE;gBACP,aAAa,EAAE,mBAAmB,QAAQ,CAAC,OAAO,EAAE;gBACpD,MAAM,EAAE,kBAAkB;gBAC1B,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;aAChD;YACD,mBAAmB,EAAE,IAAI;SAC1B,CAAC,CAAA;QACF,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAkD,EAAE,EAAE;YACzG,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAA;QACxD,CAAC,CAAC,CAAA;QACF,OAAO;YACL,OAAO;SACR,CAAA;KACF;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO;YACL,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,EAAE;YACZ,KAAK,EAAE;gBACL,OAAO,EAAG,GAAgB,CAAC,OAAO,IAAI,eAAe;gBACrD,IAAI,EAAG,GAAgB,CAAC,MAAM,GAAG,EAAE,IAAI,eAAe;aACvD;SACF,CAAA;KACF;AACH,CAAC;AA3BD,oDA2BC"}
@@ -1,22 +0,0 @@
1
- export interface Payload {
2
- profile: {
3
- email?: string;
4
- phone_number?: string;
5
- other_properties?: {
6
- [k: string]: unknown;
7
- };
8
- };
9
- metric_name: string;
10
- properties: {
11
- [k: string]: unknown;
12
- };
13
- time?: string | number;
14
- value?: number;
15
- unique_id?: string;
16
- products?: {
17
- value?: number;
18
- properties?: {
19
- [k: string]: unknown;
20
- };
21
- }[];
22
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/orderCompleted/generated-types.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
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;
@@ -1,152 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const actions_core_1 = require("@segment/actions-core");
4
- const config_1 = require("../config");
5
- const createEventData = (payload) => ({
6
- data: {
7
- type: 'event',
8
- attributes: {
9
- properties: { ...payload.properties },
10
- time: payload.time,
11
- value: payload.value,
12
- metric: {
13
- data: {
14
- type: 'metric',
15
- attributes: {
16
- name: 'Order Completed'
17
- }
18
- }
19
- },
20
- profile: {
21
- data: {
22
- type: 'profile',
23
- attributes: {
24
- ...payload.profile
25
- }
26
- }
27
- }
28
- }
29
- }
30
- });
31
- const sendProductRequests = async (payload, eventData, request) => {
32
- if (payload.products && Array.isArray(payload.products)) {
33
- const productPromises = payload?.products?.map((product) => {
34
- eventData.data.attributes.properties = product.properties;
35
- eventData.data.attributes.value = product.value;
36
- eventData.data.attributes.metric.data.attributes.name = 'Ordered Product';
37
- return request(`${config_1.API_URL}/events/`, {
38
- method: 'POST',
39
- json: eventData
40
- });
41
- });
42
- await Promise.all(productPromises);
43
- }
44
- };
45
- const action = {
46
- title: 'Order Completed',
47
- description: 'Order Completed Event action tracks users Order Completed events and associate it with their profile.',
48
- defaultSubscription: 'type = "track"',
49
- fields: {
50
- profile: {
51
- label: 'Profile',
52
- description: `Properties of the profile that triggered this event.`,
53
- type: 'object',
54
- properties: {
55
- email: {
56
- label: 'Email',
57
- type: 'string'
58
- },
59
- phone_number: {
60
- label: 'Phone Number',
61
- type: 'string'
62
- },
63
- other_properties: {
64
- label: 'Other Properties',
65
- type: 'object'
66
- }
67
- },
68
- required: true
69
- },
70
- metric_name: {
71
- label: 'Metric Name',
72
- description: 'Name of the event. Must be less than 128 characters.',
73
- type: 'string',
74
- default: {
75
- '@path': '$.event'
76
- },
77
- required: true
78
- },
79
- properties: {
80
- description: `Properties of this event.`,
81
- label: 'Properties',
82
- type: 'object',
83
- default: {
84
- '@path': '$.properties'
85
- },
86
- required: true
87
- },
88
- time: {
89
- label: 'Time',
90
- description: `When this event occurred. By default, the time the request was received will be used.
91
- The time is truncated to the second. The time must be after the year 2000 and can only
92
- be up to 1 year in the future.
93
- `,
94
- type: 'datetime',
95
- default: {
96
- '@path': '$.timestamp'
97
- }
98
- },
99
- value: {
100
- label: 'Value',
101
- description: 'A numeric value to associate with this event. For example, the dollar amount of a purchase.',
102
- type: 'number'
103
- },
104
- unique_id: {
105
- label: 'Unique ID',
106
- description: `A unique identifier for an event. If the unique_id is repeated for the same
107
- profile and metric, only the first processed event will be recorded. If this is not
108
- present, this will use the time to the second. Using the default, this limits only one
109
- event per profile per second.
110
- `,
111
- type: 'string',
112
- default: {
113
- '@path': '$.event'
114
- }
115
- },
116
- products: {
117
- label: 'Products',
118
- description: 'List of products purchased in the order.',
119
- multiple: true,
120
- type: 'object',
121
- properties: {
122
- value: {
123
- label: 'Value',
124
- description: 'A numeric value to associate with this event. For example, the dollar amount of a purchase.',
125
- type: 'number'
126
- },
127
- properties: {
128
- description: `Properties of this event.`,
129
- label: 'Properties',
130
- type: 'object'
131
- }
132
- }
133
- }
134
- },
135
- perform: async (request, { payload }) => {
136
- const { email, phone_number } = payload.profile;
137
- if (!email && !phone_number) {
138
- throw new actions_core_1.IntegrationError('One of Phone Number or Email is required.', 'Missing required fields', 400);
139
- }
140
- const eventData = createEventData(payload);
141
- const event = await request(`${config_1.API_URL}/events/`, {
142
- method: 'POST',
143
- json: eventData
144
- });
145
- if (event.status == 202 && Array.isArray(payload.products)) {
146
- await sendProductRequests(payload, eventData, request);
147
- }
148
- return event;
149
- }
150
- };
151
- exports.default = action;
152
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/orderCompleted/index.ts"],"names":[],"mappings":";;AAGA,wDAAuE;AAC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P,OAAO,EAAE,SAAS;aACnB;SACF;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,0CAA0C;YACvD,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,KAAK,EAAE,OAAO;oBACd,WAAW,EAAE,6FAA6F;oBAC1G,IAAI,EAAE,QAAQ;iBACf;gBACD,UAAU,EAAE;oBACV,WAAW,EAAE,2BAA2B;oBACxC,KAAK,EAAE,YAAY;oBACnB,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;KACF;IAED,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACtC,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,OAAO,CAAA;QAE/C,IAAI,CAAC,KAAK,IAAI,CAAC,YAAY,EAAE;YAC3B,MAAM,IAAI,+BAAgB,CAAC,2CAA2C,EAAE,yBAAyB,EAAE,GAAG,CAAC,CAAA;SACxG;QAED,MAAM,SAAS,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;QAE1C,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,GAAG,gBAAO,UAAU,EAAE;YAChD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,SAAS;SAChB,CAAC,CAAA;QAEF,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC1D,MAAM,mBAAmB,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;SACvD;QACD,OAAO,KAAK,CAAA;IACd,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -1,4 +0,0 @@
1
- export interface Payload {
2
- profile_id?: string;
3
- list_id?: string;
4
- }
@@ -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,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const actions_core_1 = require("@segment/actions-core");
4
- const config_1 = require("../config");
5
- const functions_1 = require("../functions");
6
- const action = {
7
- title: 'Remove profile from list',
8
- description: 'Remove profile from list',
9
- fields: {
10
- profile_id: {
11
- label: 'Profile Id',
12
- description: 'Profile Id of User',
13
- type: 'string'
14
- },
15
- list_id: {
16
- label: 'List Id',
17
- description: `'Insert the ID of the default list that you'd like to subscribe users to when you call .identify().'`,
18
- type: 'string',
19
- dynamic: true
20
- }
21
- },
22
- dynamicFields: {
23
- list_id: async (request, { settings }) => {
24
- return functions_1.getListIdDynamicData(request, settings);
25
- }
26
- },
27
- perform: async (request, { payload }) => {
28
- const { profile_id, list_id } = payload;
29
- if (!list_id) {
30
- throw new actions_core_1.IntegrationError("Insert the ID of the default list that you'd like to subscribe users", 'Missing required fields', 400);
31
- }
32
- try {
33
- const listData = {
34
- data: [
35
- {
36
- type: 'profile',
37
- id: profile_id
38
- }
39
- ]
40
- };
41
- const list = await request(`${config_1.API_URL}/lists/${list_id}/relationships/profiles/`, {
42
- method: 'DELETE',
43
- json: listData
44
- });
45
- return list;
46
- }
47
- catch (error) {
48
- throw new Error('An error occurred while processing the request');
49
- }
50
- }
51
- };
52
- exports.default = action;
53
- //# 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;AAIhG,sCAAmC;AAEnC,4CAAmD;AAEnD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,0BAA0B;IACjC,WAAW,EAAE,0BAA0B;IACvC,MAAM,EAAE;QACN,UAAU,EAAE;YACV,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,oBAAoB;YACjC,IAAI,EAAE,QAAQ;SACf;QACD,OAAO,EAAE;YACP,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,sGAAsG;YACnH,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,IAAI;SACd;KACF;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;YACD,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,GAAG,gBAAO,UAAU,OAAO,0BAA0B,EAAE;gBAChF,MAAM,EAAE,QAAQ;gBAChB,IAAI,EAAE,QAAQ;aACf,CAAC,CAAA;YACF,OAAO,IAAI,CAAA;SACZ;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAA;SAClE;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -1,16 +0,0 @@
1
- export interface Payload {
2
- profile: {
3
- email?: string | null;
4
- phone_number?: string | null;
5
- other_properties?: {
6
- [k: string]: unknown;
7
- } | null;
8
- };
9
- metric_name: string;
10
- properties: {
11
- [k: string]: unknown;
12
- };
13
- time?: string | number;
14
- value?: number;
15
- unique_id?: string;
16
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/trackEvent/generated-types.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
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;