@segment/action-destinations 3.170.0 → 3.172.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 (156) hide show
  1. package/dist/destinations/adobe-target/adobeTarget_operations.js +3 -3
  2. package/dist/destinations/adobe-target/adobeTarget_operations.js.map +1 -1
  3. package/dist/destinations/ambee/generated-types.d.ts +7 -0
  4. package/dist/destinations/ambee/generated-types.js +3 -0
  5. package/dist/destinations/ambee/generated-types.js.map +1 -0
  6. package/dist/destinations/ambee/index.d.ts +4 -0
  7. package/dist/destinations/ambee/index.js +62 -0
  8. package/dist/destinations/ambee/index.js.map +1 -0
  9. package/dist/destinations/ambee/subscribeUserToCampaign/generated-types.d.ts +9 -0
  10. package/dist/destinations/ambee/subscribeUserToCampaign/generated-types.js +3 -0
  11. package/dist/destinations/ambee/subscribeUserToCampaign/generated-types.js.map +1 -0
  12. package/dist/destinations/ambee/subscribeUserToCampaign/index.d.ts +5 -0
  13. package/dist/destinations/ambee/subscribeUserToCampaign/index.js +88 -0
  14. package/dist/destinations/ambee/subscribeUserToCampaign/index.js.map +1 -0
  15. package/dist/destinations/criteo-audiences/criteo-audiences.js.map +1 -1
  16. package/dist/destinations/emarsys/addToContactList/index.d.ts +1 -1
  17. package/dist/destinations/emarsys/addToContactList/index.js +4 -8
  18. package/dist/destinations/emarsys/addToContactList/index.js.map +1 -1
  19. package/dist/destinations/emarsys/emarsys-helper.js +0 -4
  20. package/dist/destinations/emarsys/emarsys-helper.js.map +1 -1
  21. package/dist/destinations/emarsys/removeFromContactList/index.d.ts +1 -1
  22. package/dist/destinations/emarsys/removeFromContactList/index.js +4 -8
  23. package/dist/destinations/emarsys/removeFromContactList/index.js.map +1 -1
  24. package/dist/destinations/emarsys/triggerEvent/index.d.ts +1 -1
  25. package/dist/destinations/emarsys/triggerEvent/index.js +7 -12
  26. package/dist/destinations/emarsys/triggerEvent/index.js.map +1 -1
  27. package/dist/destinations/emarsys/upsertContact/index.d.ts +1 -1
  28. package/dist/destinations/emarsys/upsertContact/index.js +6 -11
  29. package/dist/destinations/emarsys/upsertContact/index.js.map +1 -1
  30. package/dist/destinations/encharge/createUpdateObject/index.js +2 -2
  31. package/dist/destinations/encharge/createUpdateObject/index.js.map +1 -1
  32. package/dist/destinations/encharge/index.js +1 -1
  33. package/dist/destinations/encharge/index.js.map +1 -1
  34. package/dist/destinations/engage-messaging-twilio/index.js +3 -1
  35. package/dist/destinations/engage-messaging-twilio/index.js.map +1 -1
  36. package/dist/destinations/engage-messaging-twilio/sendMobilePush/generated-types.d.ts +31 -0
  37. package/dist/destinations/engage-messaging-twilio/sendMobilePush/generated-types.js +3 -0
  38. package/dist/destinations/engage-messaging-twilio/sendMobilePush/generated-types.js.map +1 -0
  39. package/dist/destinations/engage-messaging-twilio/sendMobilePush/index.d.ts +5 -0
  40. package/dist/destinations/engage-messaging-twilio/sendMobilePush/index.js +202 -0
  41. package/dist/destinations/engage-messaging-twilio/sendMobilePush/index.js.map +1 -0
  42. package/dist/destinations/engage-messaging-twilio/sendMobilePush/push-sender.d.ts +17 -0
  43. package/dist/destinations/engage-messaging-twilio/sendMobilePush/push-sender.js +173 -0
  44. package/dist/destinations/engage-messaging-twilio/sendMobilePush/push-sender.js.map +1 -0
  45. package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.d.ts +3 -5
  46. package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.js +27 -74
  47. package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.js.map +1 -1
  48. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.d.ts +2 -2
  49. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.js +4 -4
  50. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.js.map +1 -1
  51. package/dist/destinations/engage-messaging-twilio/utils/message-sender.d.ts +13 -11
  52. package/dist/destinations/engage-messaging-twilio/utils/message-sender.js +125 -126
  53. package/dist/destinations/engage-messaging-twilio/utils/message-sender.js.map +1 -1
  54. package/dist/destinations/engage-messaging-twilio/utils/phone-message.d.ts +12 -0
  55. package/dist/destinations/engage-messaging-twilio/utils/phone-message.js +100 -0
  56. package/dist/destinations/engage-messaging-twilio/utils/phone-message.js.map +1 -0
  57. package/dist/destinations/engage-messaging-twilio/utils/test-utils.d.ts +34 -0
  58. package/dist/destinations/engage-messaging-twilio/utils/test-utils.js +35 -0
  59. package/dist/destinations/engage-messaging-twilio/utils/test-utils.js.map +1 -0
  60. package/dist/destinations/engage-messaging-twilio/utils/types.d.ts +39 -0
  61. package/dist/destinations/engage-messaging-twilio/utils/types.js +3 -0
  62. package/dist/destinations/engage-messaging-twilio/utils/types.js.map +1 -0
  63. package/dist/destinations/facebook-custom-audiences/generated-types.d.ts +3 -0
  64. package/dist/destinations/facebook-custom-audiences/generated-types.js +3 -0
  65. package/dist/destinations/facebook-custom-audiences/generated-types.js.map +1 -0
  66. package/dist/destinations/facebook-custom-audiences/index.d.ts +4 -0
  67. package/dist/destinations/facebook-custom-audiences/index.js +32 -0
  68. package/dist/destinations/facebook-custom-audiences/index.js.map +1 -0
  69. package/dist/destinations/facebook-custom-audiences/syncEngage/generated-types.d.ts +3 -0
  70. package/dist/destinations/facebook-custom-audiences/syncEngage/generated-types.js +3 -0
  71. package/dist/destinations/facebook-custom-audiences/syncEngage/generated-types.js.map +1 -0
  72. package/dist/destinations/facebook-custom-audiences/syncEngage/index.d.ts +5 -0
  73. package/dist/destinations/facebook-custom-audiences/syncEngage/index.js +18 -0
  74. package/dist/destinations/facebook-custom-audiences/syncEngage/index.js.map +1 -0
  75. package/dist/destinations/facebook-custom-audiences/syncRetl/generated-types.d.ts +3 -0
  76. package/dist/destinations/facebook-custom-audiences/syncRetl/generated-types.js +3 -0
  77. package/dist/destinations/facebook-custom-audiences/syncRetl/generated-types.js.map +1 -0
  78. package/dist/destinations/facebook-custom-audiences/syncRetl/index.d.ts +5 -0
  79. package/dist/destinations/facebook-custom-audiences/syncRetl/index.js +18 -0
  80. package/dist/destinations/facebook-custom-audiences/syncRetl/index.js.map +1 -0
  81. package/dist/destinations/fullstory/vars.d.ts +1 -1
  82. package/dist/destinations/fullstory/vars.js +17 -5
  83. package/dist/destinations/fullstory/vars.js.map +1 -1
  84. package/dist/destinations/index.js +3 -0
  85. package/dist/destinations/index.js.map +1 -1
  86. package/dist/destinations/pinterest-conversions/reportConversionEvent/index.js.map +1 -1
  87. package/dist/destinations/podscribe/page/generated-types.d.ts +3 -0
  88. package/dist/destinations/podscribe/page/index.js +10 -1
  89. package/dist/destinations/podscribe/page/index.js.map +1 -1
  90. package/dist/destinations/podscribe/track/generated-types.d.ts +3 -0
  91. package/dist/destinations/podscribe/track/index.js +10 -1
  92. package/dist/destinations/podscribe/track/index.js.map +1 -1
  93. package/dist/destinations/the-trade-desk-crm/generated-types.d.ts +2 -0
  94. package/dist/destinations/the-trade-desk-crm/index.js +15 -1
  95. package/dist/destinations/the-trade-desk-crm/index.js.map +1 -1
  96. package/dist/destinations/tiktok-audiences/api/index.d.ts +3 -1
  97. package/dist/destinations/tiktok-audiences/api/index.js +11 -0
  98. package/dist/destinations/tiktok-audiences/api/index.js.map +1 -1
  99. package/dist/destinations/tiktok-audiences/createAudience/generated-types.d.ts +5 -0
  100. package/dist/destinations/tiktok-audiences/createAudience/generated-types.js +3 -0
  101. package/dist/destinations/tiktok-audiences/createAudience/generated-types.js.map +1 -0
  102. package/dist/destinations/tiktok-audiences/createAudience/index.d.ts +5 -0
  103. package/dist/destinations/tiktok-audiences/createAudience/index.js +37 -0
  104. package/dist/destinations/tiktok-audiences/createAudience/index.js.map +1 -0
  105. package/dist/destinations/tiktok-audiences/functions.d.ts +5 -2
  106. package/dist/destinations/tiktok-audiences/functions.js +9 -1
  107. package/dist/destinations/tiktok-audiences/functions.js.map +1 -1
  108. package/dist/destinations/tiktok-audiences/index.js +3 -1
  109. package/dist/destinations/tiktok-audiences/index.js.map +1 -1
  110. package/dist/destinations/tiktok-audiences/properties.d.ts +1 -0
  111. package/dist/destinations/tiktok-audiences/properties.js +7 -1
  112. package/dist/destinations/tiktok-audiences/properties.js.map +1 -1
  113. package/dist/destinations/tiktok-audiences/types.d.ts +5 -0
  114. package/dist/destinations/tiktok-conversions/reportWebEvent/index.js +1 -1
  115. package/dist/destinations/tiktok-conversions/reportWebEvent/index.js.map +1 -1
  116. package/dist/destinations/tiktok-offline-conversions/index.js +2 -2
  117. package/dist/destinations/tiktok-offline-conversions/index.js.map +1 -1
  118. package/dist/destinations/tiktok-offline-conversions/trackNonPaymentOfflineConversion/index.d.ts +1 -1
  119. package/dist/destinations/tiktok-offline-conversions/trackNonPaymentOfflineConversion/index.js +8 -3
  120. package/dist/destinations/tiktok-offline-conversions/trackNonPaymentOfflineConversion/index.js.map +1 -1
  121. package/dist/destinations/tiktok-offline-conversions/trackPaymentOfflineConversion/index.d.ts +1 -1
  122. package/dist/destinations/tiktok-offline-conversions/trackPaymentOfflineConversion/index.js +7 -2
  123. package/dist/destinations/tiktok-offline-conversions/trackPaymentOfflineConversion/index.js.map +1 -1
  124. package/dist/destinations/userpilot/generated-types.d.ts +4 -0
  125. package/dist/destinations/userpilot/generated-types.js +3 -0
  126. package/dist/destinations/userpilot/generated-types.js.map +1 -0
  127. package/dist/destinations/userpilot/identifyUser/generated-types.d.ts +7 -0
  128. package/dist/destinations/userpilot/identifyUser/generated-types.js +3 -0
  129. package/dist/destinations/userpilot/identifyUser/generated-types.js.map +1 -0
  130. package/dist/destinations/userpilot/identifyUser/index.d.ts +5 -0
  131. package/dist/destinations/userpilot/identifyUser/index.js +52 -0
  132. package/dist/destinations/userpilot/identifyUser/index.js.map +1 -0
  133. package/dist/destinations/userpilot/index.d.ts +4 -0
  134. package/dist/destinations/userpilot/index.js +70 -0
  135. package/dist/destinations/userpilot/index.js.map +1 -0
  136. package/dist/destinations/userpilot/request-utils.d.ts +13 -0
  137. package/dist/destinations/userpilot/request-utils.js +62 -0
  138. package/dist/destinations/userpilot/request-utils.js.map +1 -0
  139. package/dist/destinations/userpilot/trackEvent/generated-types.d.ts +7 -0
  140. package/dist/destinations/userpilot/trackEvent/generated-types.js +3 -0
  141. package/dist/destinations/userpilot/trackEvent/generated-types.js.map +1 -0
  142. package/dist/destinations/userpilot/trackEvent/index.d.ts +5 -0
  143. package/dist/destinations/userpilot/trackEvent/index.js +48 -0
  144. package/dist/destinations/userpilot/trackEvent/index.js.map +1 -0
  145. package/dist/destinations/voucherify/addCustomEvent/generated-types.d.ts +12 -3
  146. package/dist/destinations/voucherify/addCustomEvent/index.js +62 -25
  147. package/dist/destinations/voucherify/addCustomEvent/index.js.map +1 -1
  148. package/dist/destinations/voucherify/assignCustomerToGroup/generated-types.d.ts +4 -2
  149. package/dist/destinations/voucherify/assignCustomerToGroup/index.js +21 -19
  150. package/dist/destinations/voucherify/assignCustomerToGroup/index.js.map +1 -1
  151. package/dist/destinations/voucherify/index.js +1 -1
  152. package/dist/destinations/voucherify/index.js.map +1 -1
  153. package/dist/destinations/voucherify/upsertCustomer/generated-types.d.ts +14 -13
  154. package/dist/destinations/voucherify/upsertCustomer/index.js +75 -42
  155. package/dist/destinations/voucherify/upsertCustomer/index.js.map +1 -1
  156. package/package.json +4 -4
@@ -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,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const request_utils_1 = require("../request-utils");
4
+ const action = {
5
+ title: 'Identify User',
6
+ description: 'Defines a user in Userpilot, you can visit [Userpilot docs](https://docs.userpilot.com/article/23-identify-users-track-custom-events) for more information.',
7
+ defaultSubscription: 'type = "identify"',
8
+ fields: {
9
+ userId: {
10
+ type: 'string',
11
+ required: true,
12
+ description: 'The ID of the logged-in user.',
13
+ label: 'User ID',
14
+ default: {
15
+ '@if': {
16
+ exists: { '@path': '$.userId' },
17
+ then: { '@path': '$.userId' },
18
+ else: { '@path': '$.anonymousId' }
19
+ }
20
+ }
21
+ },
22
+ createdAt: {
23
+ type: 'datetime',
24
+ required: false,
25
+ description: 'The date the user profile was created at',
26
+ label: 'User Created At Date',
27
+ default: {
28
+ '@path': '$.traits.createdAt'
29
+ }
30
+ },
31
+ traits: {
32
+ type: 'object',
33
+ required: false,
34
+ description: 'Segment traits',
35
+ label: 'Traits',
36
+ default: {
37
+ '@path': '$.traits'
38
+ }
39
+ }
40
+ },
41
+ perform: (request, { settings, payload }) => {
42
+ const { traits, userId, createdAt } = payload;
43
+ traits?.createdAt && delete traits.createdAt;
44
+ const { url, options } = request_utils_1.getIdentifyRequestParams(settings, {
45
+ traits: { ...traits, created_at: createdAt || traits?.created_at },
46
+ userId
47
+ });
48
+ return request(url, options);
49
+ }
50
+ };
51
+ exports.default = action;
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/userpilot/identifyUser/index.ts"],"names":[],"mappings":";;AAIA,oDAA2D;AAE3D,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EACT,6JAA6J;IAC/J,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,+BAA+B;YAC5C,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;oBAC/B,IAAI,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;oBAC7B,IAAI,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE;iBACnC;aACF;SACF;QACD,SAAS,EAAE;YACT,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,0CAA0C;YACvD,KAAK,EAAE,sBAAsB;YAC7B,OAAO,EAAE;gBACP,OAAO,EAAE,oBAAoB;aAC9B;SACF;QACD,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,gBAAgB;YAC7B,KAAK,EAAE,QAAQ;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;KACF;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAC1C,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAA;QAE7C,MAAM,EAAE,SAAS,IAAI,OAAO,MAAM,CAAC,SAAS,CAAA;QAE5C,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,wCAAwB,CAAC,QAAQ,EAAE;YAC1D,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,UAAU,EAAE,SAAS,IAAI,MAAM,EAAE,UAAU,EAAE;YAClE,MAAM;SACP,CAAC,CAAA;QAEF,OAAO,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IAC9B,CAAC;CACF,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,70 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const actions_core_1 = require("@segment/actions-core");
7
+ const request_utils_1 = require("./request-utils");
8
+ const identifyUser_1 = __importDefault(require("./identifyUser"));
9
+ const trackEvent_1 = __importDefault(require("./trackEvent"));
10
+ const destination = {
11
+ name: 'Userpilot Cloud (Actions)',
12
+ slug: 'actions-userpilot-cloud',
13
+ mode: 'cloud',
14
+ presets: [
15
+ {
16
+ name: 'Identify User',
17
+ subscribe: 'type = "identify"',
18
+ partnerAction: 'identifyUser',
19
+ mapping: actions_core_1.defaultValues(identifyUser_1.default.fields)
20
+ },
21
+ {
22
+ name: 'Track Event',
23
+ subscribe: 'type = "track"',
24
+ partnerAction: 'trackEvent',
25
+ mapping: actions_core_1.defaultValues(trackEvent_1.default.fields)
26
+ }
27
+ ],
28
+ authentication: {
29
+ scheme: 'custom',
30
+ fields: {
31
+ apiKey: {
32
+ label: 'API Key',
33
+ description: 'Your Userpilot API key can be found in the [Userpilot environment](https://run.userpilot.io/environment) dashboard.',
34
+ type: 'string',
35
+ required: true
36
+ },
37
+ endpoint: {
38
+ label: 'API Endpoint',
39
+ description: 'Your Userpilot API endpoint can be found in the [Userpilot environment](https://run.userpilot.io/environment) dashboard.',
40
+ type: 'string',
41
+ required: true,
42
+ default: 'https://analytex.userpilot.io/'
43
+ }
44
+ },
45
+ testAuthentication: (request, { settings }) => {
46
+ const { url, options } = request_utils_1.getValidationParams(settings);
47
+ return request(url, options);
48
+ }
49
+ },
50
+ extendRequest({ settings }) {
51
+ return {
52
+ headers: {
53
+ 'Content-Type': 'application/json',
54
+ Authorization: `Token ${settings.apiKey}`,
55
+ 'X-API-Version': '2020-09-22'
56
+ }
57
+ };
58
+ },
59
+ onDelete: async (request, { settings, payload }) => {
60
+ const { userId } = payload;
61
+ const { url, options } = request_utils_1.getDeleteRequestParams(settings, userId ?? '');
62
+ return request(url, options);
63
+ },
64
+ actions: {
65
+ identifyUser: identifyUser_1.default,
66
+ trackEvent: trackEvent_1.default
67
+ }
68
+ };
69
+ exports.default = destination;
70
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/userpilot/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAqD;AAIrD,mDAA6E;AAE7E,kEAAyC;AAEzC,8DAAqC;AAErC,MA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AAO,EAAE,EAAE,EAAE;QACjD,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;QAC1B,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,sCAAsB,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,CAAC,CAAA;QAEvE,OAAO,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IAC9B,CAAC;IAED,OAAO,EAAE;QACP,YAAY,EAAZ,sBAAY;QACZ,UAAU,EAAV,oBAAU;KACX;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -0,0 +1,13 @@
1
+ import type { Settings } from './generated-types';
2
+ import type { Payload as IdentifyPayload } from './identifyUser/generated-types';
3
+ import type { Payload as TrackPayload } from './trackEvent/generated-types';
4
+ import { RequestOptions } from '@segment/actions-core';
5
+ interface RequestParams {
6
+ url: string;
7
+ options: RequestOptions;
8
+ }
9
+ export declare const getDeleteRequestParams: (settings: Settings, userId: string) => RequestParams;
10
+ export declare const getValidationParams: (settings: Settings) => RequestParams;
11
+ export declare const getIdentifyRequestParams: (settings: Settings, payload: IdentifyPayload) => RequestParams;
12
+ export declare const getTrackEventParams: (settings: Settings, payload: TrackPayload) => RequestParams;
13
+ export {};
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTrackEventParams = exports.getIdentifyRequestParams = exports.getValidationParams = exports.getDeleteRequestParams = void 0;
4
+ const baseURL = 'https://analytex.userpilot.io/';
5
+ const getDeleteRequestParams = (settings, userId) => {
6
+ return {
7
+ url: `${validateEndpoint(settings.endpoint)}v1/users`,
8
+ options: {
9
+ method: 'DELETE',
10
+ json: { users: [userId] }
11
+ }
12
+ };
13
+ };
14
+ exports.getDeleteRequestParams = getDeleteRequestParams;
15
+ const getValidationParams = (settings) => {
16
+ return {
17
+ url: `${validateEndpoint(settings.endpoint)}v1/validate`,
18
+ options: {
19
+ method: 'GET'
20
+ }
21
+ };
22
+ };
23
+ exports.getValidationParams = getValidationParams;
24
+ const getIdentifyRequestParams = (settings, payload) => {
25
+ const { traits, userId } = payload;
26
+ return {
27
+ url: `${validateEndpoint(settings.endpoint)}v1/identify`,
28
+ options: {
29
+ method: 'POST',
30
+ json: {
31
+ user_id: userId,
32
+ metadata: traits
33
+ }
34
+ }
35
+ };
36
+ };
37
+ exports.getIdentifyRequestParams = getIdentifyRequestParams;
38
+ const getTrackEventParams = (settings, payload) => {
39
+ const { userId, name, properties } = payload;
40
+ return {
41
+ url: `${validateEndpoint(settings.endpoint)}v1/track`,
42
+ options: {
43
+ method: 'POST',
44
+ json: {
45
+ user_id: userId,
46
+ event_name: name,
47
+ metadata: properties
48
+ }
49
+ }
50
+ };
51
+ };
52
+ exports.getTrackEventParams = getTrackEventParams;
53
+ const validateEndpoint = (url) => {
54
+ try {
55
+ new URL(url);
56
+ return url;
57
+ }
58
+ catch (e) {
59
+ return baseURL;
60
+ }
61
+ };
62
+ //# sourceMappingURL=request-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-utils.js","sourceRoot":"","sources":["../../../src/destinations/userpilot/request-utils.ts"],"names":[],"mappings":";;;AAMA,MAAM,OAAO,GAAG,gCAAgC,CAAA;AAOzC,MAAM,sBAAsB,GAAG,CAAC,QAAkB,EAAE,MAAc,EAAiB,EAAE;IAC1F,OAAO;QACL,GAAG,EAAE,GAAG,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU;QACrD,OAAO,EAAE;YACP,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE;SAC1B;KACF,CAAA;AACH,CAAC,CAAA;AARY,QAAA,sBAAsB,0BAQlC;AAEM,MAAM,mBAAmB,GAAG,CAAC,QAAkB,EAAiB,EAAE;IACvE,OAAO;QACL,GAAG,EAAE,GAAG,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa;QACxD,OAAO,EAAE;YACP,MA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Property(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/userpilot/trackEvent/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,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const request_utils_1 = require("../request-utils");
4
+ const action = {
5
+ title: 'Track Event',
6
+ description: 'Send an event to Userpilot, you can visit [Userpilot docs](https://docs.userpilot.com/article/23-identify-users-track-custom-events) for more information',
7
+ defaultSubscription: 'type = "track"',
8
+ fields: {
9
+ userId: {
10
+ type: 'string',
11
+ required: false,
12
+ description: 'The ID of the logged-in user.',
13
+ label: 'User ID',
14
+ default: {
15
+ '@if': {
16
+ exists: { '@path': '$.userId' },
17
+ then: { '@path': '$.userId' },
18
+ else: { '@path': '$.anonymousId' }
19
+ }
20
+ }
21
+ },
22
+ name: {
23
+ type: 'string',
24
+ required: true,
25
+ description: 'Event name',
26
+ label: 'Name',
27
+ default: {
28
+ '@path': '$.event'
29
+ }
30
+ },
31
+ properties: {
32
+ type: 'object',
33
+ required: false,
34
+ description: 'Event properties',
35
+ label: 'Properties',
36
+ default: {
37
+ '@path': '$.properties'
38
+ }
39
+ }
40
+ },
41
+ perform: (request, { settings, payload }) => {
42
+ const { userId, name, properties } = payload;
43
+ const { url, options } = request_utils_1.getTrackEventParams(settings, { userId, name, properties });
44
+ return request(url, options);
45
+ }
46
+ };
47
+ exports.default = action;
48
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/userpilot/trackEvent/index.ts"],"names":[],"mappings":";;AAIA,oDAAsD;A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string;
2
+ customer: {
3
+ source_id: string;
4
+ email?: string;
5
+ };
6
+ referral?: {
7
+ code?: string;
8
+ referrer_id?: string;
9
+ };
10
+ loyalty?: {
11
+ code?: string;
12
+ };
5
13
  metadata?: {
6
14
  [k: string]: unknown;
7
15
  };
16
+ event?: string;
8
17
  type: string;
9
18
  }
@@ -6,29 +6,74 @@ const action = {
6
6
  description: 'Send the Track, Page or Screen event that will be saved as a [custom event](https://docs.voucherify.io/reference/the-custom-event-object) in Voucherify.',
7
7
  defaultSubscription: 'type = "track" or type = "page" or type = "screen"',
8
8
  fields: {
9
- source_id: {
10
- label: 'Source ID',
11
- description: 'The source_id which identifies the [customer](https://docs.voucherify.io/reference/the-customer-object) in Voucherify.',
12
- type: 'string',
9
+ customer: {
10
+ label: 'Customer Object',
13
11
  required: true,
12
+ description: 'This is an object containing information about the [customer](https://docs.voucherify.io/reference/the-customer-object).',
13
+ type: 'object',
14
+ properties: {
15
+ source_id: {
16
+ label: 'Source ID',
17
+ type: 'string',
18
+ required: true,
19
+ description: 'The `source_id` which identifies the [customer](https://docs.voucherify.io/reference/the-customer-object) in Voucherify.'
20
+ },
21
+ email: {
22
+ label: 'Email',
23
+ type: 'string',
24
+ description: 'The email that identifies the [customer](https://docs.voucherify.io/reference/the-customer-object) in Voucherify.'
25
+ }
26
+ },
14
27
  default: {
15
- '@if': {
16
- exists: { '@path': '$.userId' },
17
- then: { '@path': '$.userId' },
18
- else: { '@path': '$.anonymousId' }
28
+ source_id: { '@path': '$.userId' },
29
+ email: {
30
+ '@if': {
31
+ exists: { '@path': '$.properties.email' },
32
+ then: { '@path': '$.properties.email' },
33
+ else: { '@path': '$.context.traits.email' }
34
+ }
19
35
  }
20
36
  }
21
37
  },
22
- email: {
23
- label: 'Email Address',
24
- description: 'The email that identifies the [customer](https://docs.voucherify.io/reference/the-customer-object) in Voucherify.',
25
- type: 'string',
38
+ referral: {
39
+ label: 'Referral Object',
40
+ description: 'If a conversion event for a referral program is set to a [custom event](https://docs.voucherify.io/reference/custom-event-object), then you need to send the referral code in the payload to make a record of the conversion event.',
41
+ type: 'object',
42
+ properties: {
43
+ code: {
44
+ label: 'code',
45
+ type: 'string'
46
+ },
47
+ referrer_id: {
48
+ label: 'referrer_id',
49
+ type: 'string'
50
+ }
51
+ },
26
52
  default: {
27
- '@if': {
28
- exists: { '@path': '$.properties.email' },
29
- then: { '@path': '$.properties.email' },
30
- else: { '@path': '$.context.traits' }
53
+ code: { '@path': '$.properties.referral.code' },
54
+ referrer_id: { '@path': '$.properties.referral.referrer_id' }
55
+ }
56
+ },
57
+ loyalty: {
58
+ label: 'Loyalty Object',
59
+ description: 'If an earning rule in a loyalty program is based on a [custom event](https://docs.voucherify.io/reference/custom-event-object). This objects allows you specify the loyalty card to which the custom event should be attributed to.',
60
+ type: 'object',
61
+ properties: {
62
+ code: {
63
+ label: 'code',
64
+ type: 'string'
31
65
  }
66
+ },
67
+ default: {
68
+ code: { '@path': '$.properties.loyalty.code' }
69
+ }
70
+ },
71
+ metadata: {
72
+ label: 'Track Event Metadata',
73
+ description: 'The metadata object stores all custom attributes assigned to the [custom event](https://docs.voucherify.io/reference/custom-event-object). A set of key/value pairs that you can attach to an event object. It can be useful for storing additional information about the event in a structured format. Event metadata schema is defined in the Dashboard > Project Settings > Event Schema > Edit particular event > Metadata property definition.',
74
+ type: 'object',
75
+ default: {
76
+ '@path': '$.properties.metadata'
32
77
  }
33
78
  },
34
79
  event: {
@@ -43,17 +88,9 @@ const action = {
43
88
  }
44
89
  }
45
90
  },
46
- metadata: {
47
- label: 'Track Event Metadata',
48
- description: 'Additional data that will be stored in the [custom event](https://docs.voucherify.io/reference/the-custom-event-object) metadata in Voucherify.',
49
- type: 'object',
50
- default: {
51
- '@path': '$.properties'
52
- }
53
- },
54
91
  type: {
55
92
  label: 'Event Type',
56
- description: 'Type of the event. It can be track, page or screen.',
93
+ description: 'Type of the [event](https://segment.com/docs/connections/spec/). For example: identify, track, page, screen or group',
57
94
  type: 'string',
58
95
  required: true,
59
96
  default: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/voucherify/addCustomEvent/index.ts"],"names":[],"mappings":";;AAEA,kDAA0D;AAG1D,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,kBAAkB;IACzB,WAAW,EACT,0JAA0J;IAC5J,mBAAmB,EAAE,oDAAoD;IACzE,MAAM,EAAE;QACN,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,WAAW,EACT,wHAAwH;YAC1H,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;oBAC/B,IAAI,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;oBAC7B,IAAI,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE;iBACnC;aACF;SACF;QACD,KAAK,EAAE;YACL,KAAK,EAAE,eAAe;YACtB,WAAW,EACT,mHAAmH;YACrH,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;oBACzC,IAAI,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;oBACvC,IAAI,EAAE,EAAE,OAAO,EAAE,kBAAkB,EAAE;iBACtC;aACF;SACF;QACD,KAAK,EAAE;YACL,KAAK,EAAE,YAAY;YACnB,WAAW,EACT,2IAA2I;YAC7I,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;oBAC9B,IAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;oBAC5B,IAAI,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;iBAC5B;aACF;SACF;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EACT,iJAAiJ;YACnJ,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,cAAc;aACxB;SACF;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,qDAAqD;YAClE,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,QAAQ;aAClB;SACF;KACF;IAED,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAC1C,MAAM,oBAAoB,GAAG,uCAAwB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QACxE,OAAO,OAAO,CAAC,oBAAoB,EAAE;YACnC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,OAAO;SACd,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/voucherify/addCustomEvent/index.ts"],"names":[],"mappings":";;AAEA,kDAA0D;AAG1D,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,kBAAkB;IACzB,WAAW,EACT,0JAA0J;IAC5J,mBAAmB,EAAE,oDAAoD;IACzE,MAAM,EAAE;QACN,QAAQ,EAAE;YACR,KAAK,EAAE,iBAAiB;YACxB,QAAQ,EAAE,IAAI;YACd,WAAW,EACT,0HAA0H;YAC5H,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,SAAS,EAAE;oBACT,KAAK,EAAE,WAAW;oBAClB,IAAI,EAAE,QAAQ;oBACd,QAAQ,EAAE,IAAI;oBACd,WAAW,EACT,0HAA0H;iBAC7H;gBACD,KAAK,EAAE;oBACL,KAAK,EAAE,OAAO;oBACd,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,mHAAmH;iBACtH;aACF;YACD,OAAO,EAAE;gBACP,SAAS,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;gBAClC,KAA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SAAS,EAAE;oBAC5B,IAAI,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;iBAC5B;aACF;SACF;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,YAAY;YACnB,WAAW,EACT,sHAAsH;YACxH,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,QAAQ;aAClB;SACF;KACF;IAED,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAC1C,MAAM,oBAAoB,GAAG,uCAAwB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QACxE,OAAO,OAAO,CAAC,oBAAoB,EAAE;YACnC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,OAAO;SACd,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -1,6 +1,8 @@
1
1
  export interface Payload {
2
- source_id: string;
3
- email?: string;
2
+ customer: {
3
+ source_id: string;
4
+ email?: string;
5
+ };
4
6
  group_id: string;
5
7
  traits?: {
6
8
  [k: string]: unknown;
@@ -6,30 +6,32 @@ const action = {
6
6
  description: 'Assign a specific group and its traits to the customer.',
7
7
  defaultSubscription: 'type = "group"',
8
8
  fields: {
9
- source_id: {
10
- label: 'Source ID',
11
- description: 'The source_id which identifies the [customer](https://docs.voucherify.io/reference/the-customer-object) in Voucherify.',
12
- type: 'string',
9
+ customer: {
10
+ label: 'Customer Object',
13
11
  required: true,
14
- default: {
15
- '@if': {
16
- exists: { '@path': '$.userId' },
17
- then: { '@path': '$.userId' },
18
- else: { '@path': '$.anonymousId' }
12
+ description: 'Object containing information about the [customer](https://docs.voucherify.io/reference/the-customer-object).',
13
+ type: 'object',
14
+ properties: {
15
+ source_id: {
16
+ label: 'Source ID',
17
+ type: 'string',
18
+ required: true,
19
+ description: 'The `source_id` which identifies the [customer](https://docs.voucherify.io/reference/the-customer-object) in Voucherify.'
20
+ },
21
+ email: {
22
+ label: 'Email',
23
+ type: 'string',
24
+ description: 'The email that identifies the [customer](https://docs.voucherify.io/reference/the-customer-object) in Voucherify.'
19
25
  }
20
- }
21
- },
22
- email: {
23
- label: 'Email Address',
24
- description: 'The email that identifies the [customer](https://docs.voucherify.io/reference/the-customer-object) in Voucherify.',
25
- type: 'string',
26
+ },
26
27
  default: {
27
- '@path': '$.email'
28
+ source_id: { '@path': '$.userId' },
29
+ email: { '@path': '$.email' }
28
30
  }
29
31
  },
30
32
  group_id: {
31
33
  label: 'Group ID',
32
- description: 'The ID used to uniquely identify a group to which customer belongs.',
34
+ description: 'The ID used to uniquely identify a group to which [customer](https://docs.voucherify.io/reference/the-customer-object) belongs.',
33
35
  type: 'string',
34
36
  required: true,
35
37
  default: {
@@ -37,7 +39,7 @@ const action = {
37
39
  }
38
40
  },
39
41
  traits: {
40
- label: 'Group traits',
42
+ label: 'Group Traits',
41
43
  description: 'Traits of the group that will be created in customer [metadata](https://www.voucherify.io/glossary/metadata-custom-attributes).',
42
44
  type: 'object',
43
45
  default: {
@@ -46,7 +48,7 @@ const action = {
46
48
  },
47
49
  type: {
48
50
  label: 'Event Type',
49
- description: 'Type of the event [The Segment Spec](https://segment.com/docs/connections/spec/).',
51
+ description: 'Type of the [event](https://segment.com/docs/connections/spec/). For example: identify, track, page, screen or group.',
50
52
  type: 'string',
51
53
  required: true,
52
54
  default: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/voucherify/assignCustomerToGroup/index.ts"],"names":[],"mappings":";;AAGA,kDAA0D;AAE1D,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,0BAA0B;IACjC,WAAW,EAAE,yDAAyD;IACtE,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,WAAW,EACT,wHAAwH;YAC1H,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;oBAC/B,IAAI,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;oBAC7B,IAAI,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE;iBACnC;aACF;SACF;QACD,KAAK,EAAE;YACL,KAAK,EAAE,eAAe;YACtB,WAAW,EACT,mHAAmH;YACrH,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,SAAS;aACnB;SACF;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,qEAAqE;YAClF,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,WAAW;aACrB;SACF;QAED,MAAM,EAAE;YACN,KAAK,EAAE,cAAc;YACrB,WAAW,EACT,iIAAiI;YACnI,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,mFAAmF;YAChG,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,QAAQ;aAClB;SACF;KACF;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAC1C,MAAM,oBAAoB,GAAG,uCAAwB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QACxE,OAAO,OAAO,CAAC,oBAAoB,EAAE;YACnC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,OAAO;SACd,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/voucherify/assignCustomerToGroup/index.ts"],"names":[],"mappings":";;AAGA,kDAA0D;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AE,OAAO,CAAC,CAAA;QACxE,OAAO,OAAO,CAAC,oBAAoB,EAAE;YACnC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,OAAO;SACd,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -29,7 +29,7 @@ const destination = {
29
29
  },
30
30
  customURL: {
31
31
  label: 'Custom Voucherify URL',
32
- description: 'Check your API region in [Voucherify dashboard](https://app.voucherify.io/#/login) -> Project settings -> API endpoint. For example: `https://us1.api.voucherify.io` -> `https://us1.segmentio.voucherify.io`. It also works for dedicated URLs.',
32
+ description: 'Check your API region in [Voucherify dashboard](https://app.voucherify.io/#/login) -> Project settings -> API endpoint. For example, if you are using a project with a URL: `https://us1.api.voucherify.io`, your Custom URL will be: `https://us1.segmentio.voucherify.io`. It also works for dedicated URLs.',
33
33
  type: 'string',
34
34
  required: true
35
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/voucherify/index.ts"],"names":[],"mappings":";;;;;AAGA,sEAA6C;AAC7C,wDAAqD;AACrD,sEAA6C;AAC7C,oFAA2D;AAC3D,mDAA6C;AAE7C,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,OAAO;QACf,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,KAAK,EAAE,gBAAgB;gBACvB,WAAW,EACT,wGAAwG;gBAC1G,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,SAAS,EAAE;gBACT,KAAK,EAAE,YAAY;gBACnB,WAAW,EACT,oGAAoG;gBACtG,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE,IAAI;aACf;YACD,SAAS,EAAE;gBACT,KAAK,EAAE,uBAAuB;gBAC9B,WAAW,EACT,kPAAkP;gBACpP,IAAI,EAAE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,+BAAqB;KACtB;IACD,OAAO,EAAE;QACP;YACE,IAAI,EAAE,gCAAgC;YACtC,SAAS,EAAE,gBAAgB;YAC3B,aAAa,EAAE,gBAAgB;YAC/B,OAAO,EAAE,4BAAa,CAAC,wBAAc,CAAC,MAAM,CAAC;SAC9C;QACD;YACE,IAAI,EAAE,+BAA+B;YACrC,SAAS,EAAE,eAAe;YAC1B,aAAa,EAAE,gBAAgB;YAC/B,OAAO,EAAE;gBACP,GAAG,4BAAa,CAAC,wBAAc,CAAC,MAAM,CAAC;gBACvC,KAAK,EAAE;oBACL,WAAW,EAAE,sBAAsB;iBACpC;aACF;SACF;QACD;YACE,IAAI,EAAE,iCAAiC;YACvC,SAAS,EAAE,iBAAiB;YAC5B,aAAa,EAAE,gBAAgB;YAC/B,OAAO,EAAE;gBACP,GAAG,4BAAa,CAAC,wBAAc,CAAC,MAAM,CAAC;gBACvC,KAAK,EAAE;oBACL,WAAW,EAAE,wBAAwB;iBACtC;aACF;SACF;QACD;YACE,IAAI,EAAE,2BAA2B;YACjC,SAAS,EAAE,mBAAmB;YAC9B,aAAa,EAAE,gBAAgB;YAC/B,OAAO,EAAE,4BAAa,CAAC,wBAAc,CAAC,MAAM,CAAC;SAC9C;QACD;YACE,IAAI,EAAE,0BAA0B;YAChC,SAAS,EAAE,gBAAgB;YAC3B,aAAa,EAAE,uBAAuB;YACtC,OAAO,EAAE,4BAAa,CAAC,+BAAqB,CAAC,MAAM,CAAC;SACrD;KACF;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/voucherify/index.ts"],"names":[],"mappings":";;;;;AAGA,sEAA6C;AAC7C,wDAAqD;AACrD,sEAA6C;AAC7C,oFAA2D;AAC3D,mDAA6C;AAE7C,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;Q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AAO,EAAE,4BAAa,CAAC,+BAAqB,CAAC,MAAM,CAAC;SACrD;KACF;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -1,19 +1,20 @@
1
1
  export interface Payload {
2
2
  source_id: string;
3
+ name?: string;
4
+ first_name?: string;
5
+ last_name?: string;
6
+ description?: string;
3
7
  email?: string;
4
- traits?: {
5
- firstName?: string;
6
- lastName?: string;
7
- name?: string;
8
- description?: string;
9
- address?: {
10
- [k: string]: unknown;
11
- };
12
- phone?: string;
13
- birthdate?: string;
14
- metadata?: {
15
- [k: string]: unknown;
16
- };
8
+ phone?: string;
9
+ birthdate?: string;
10
+ address?: {
11
+ city?: string;
12
+ state?: string;
13
+ postal_code?: string;
14
+ street?: string;
15
+ country?: string;
16
+ };
17
+ metadata?: {
17
18
  [k: string]: unknown;
18
19
  };
19
20
  type: string;