@segment/action-destinations 3.131.1-gads-test.2 → 3.131.1-gads-test.19

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 (144) hide show
  1. package/dist/destinations/algolia-insights/algolia-insight-api.d.ts +26 -0
  2. package/dist/destinations/algolia-insights/algolia-insight-api.js +8 -0
  3. package/dist/destinations/algolia-insights/algolia-insight-api.js.map +1 -0
  4. package/dist/destinations/algolia-insights/conversionEvents/generated-types.d.ts +9 -0
  5. package/dist/destinations/algolia-insights/conversionEvents/generated-types.js +3 -0
  6. package/dist/destinations/algolia-insights/conversionEvents/generated-types.js.map +1 -0
  7. package/dist/destinations/algolia-insights/conversionEvents/index.d.ts +6 -0
  8. package/dist/destinations/algolia-insights/conversionEvents/index.js +83 -0
  9. package/dist/destinations/algolia-insights/conversionEvents/index.js.map +1 -0
  10. package/dist/destinations/algolia-insights/generated-types.d.ts +4 -0
  11. package/dist/destinations/algolia-insights/generated-types.js +3 -0
  12. package/dist/destinations/algolia-insights/generated-types.js.map +1 -0
  13. package/dist/destinations/algolia-insights/index.d.ts +5 -0
  14. package/dist/destinations/algolia-insights/index.js +54 -0
  15. package/dist/destinations/algolia-insights/index.js.map +1 -0
  16. package/dist/destinations/algolia-insights/productClickedEvents/generated-types.d.ts +8 -0
  17. package/dist/destinations/algolia-insights/productClickedEvents/generated-types.js +3 -0
  18. package/dist/destinations/algolia-insights/productClickedEvents/generated-types.js.map +1 -0
  19. package/dist/destinations/algolia-insights/productClickedEvents/index.d.ts +6 -0
  20. package/dist/destinations/algolia-insights/productClickedEvents/index.js +91 -0
  21. package/dist/destinations/algolia-insights/productClickedEvents/index.js.map +1 -0
  22. package/dist/destinations/algolia-insights/productViewedEvents/generated-types.d.ts +7 -0
  23. package/dist/destinations/algolia-insights/productViewedEvents/generated-types.js +3 -0
  24. package/dist/destinations/algolia-insights/productViewedEvents/generated-types.js.map +1 -0
  25. package/dist/destinations/algolia-insights/productViewedEvents/index.d.ts +6 -0
  26. package/dist/destinations/algolia-insights/productViewedEvents/index.js +81 -0
  27. package/dist/destinations/algolia-insights/productViewedEvents/index.js.map +1 -0
  28. package/dist/destinations/blackbaud-raisers-edge-nxt/api/index.d.ts +20 -0
  29. package/dist/destinations/blackbaud-raisers-edge-nxt/api/index.js +133 -0
  30. package/dist/destinations/blackbaud-raisers-edge-nxt/api/index.js.map +1 -0
  31. package/dist/destinations/blackbaud-raisers-edge-nxt/constants/index.d.ts +2 -0
  32. package/dist/destinations/blackbaud-raisers-edge-nxt/constants/index.js +6 -0
  33. package/dist/destinations/blackbaud-raisers-edge-nxt/constants/index.js.map +1 -0
  34. package/dist/destinations/blackbaud-raisers-edge-nxt/createOrUpdateIndividualConstituent/fixtures.d.ts +80 -0
  35. package/dist/destinations/blackbaud-raisers-edge-nxt/createOrUpdateIndividualConstituent/fixtures.js +151 -0
  36. package/dist/destinations/blackbaud-raisers-edge-nxt/createOrUpdateIndividualConstituent/fixtures.js.map +1 -0
  37. package/dist/destinations/blackbaud-raisers-edge-nxt/createOrUpdateIndividualConstituent/generated-types.d.ts +35 -0
  38. package/dist/destinations/blackbaud-raisers-edge-nxt/createOrUpdateIndividualConstituent/generated-types.js +3 -0
  39. package/dist/destinations/blackbaud-raisers-edge-nxt/createOrUpdateIndividualConstituent/generated-types.js.map +1 -0
  40. package/dist/destinations/blackbaud-raisers-edge-nxt/createOrUpdateIndividualConstituent/index.d.ts +5 -0
  41. package/dist/destinations/blackbaud-raisers-edge-nxt/createOrUpdateIndividualConstituent/index.js +619 -0
  42. package/dist/destinations/blackbaud-raisers-edge-nxt/createOrUpdateIndividualConstituent/index.js.map +1 -0
  43. package/dist/destinations/blackbaud-raisers-edge-nxt/generated-types.d.ts +3 -0
  44. package/dist/destinations/blackbaud-raisers-edge-nxt/generated-types.js +3 -0
  45. package/dist/destinations/blackbaud-raisers-edge-nxt/generated-types.js.map +1 -0
  46. package/dist/destinations/blackbaud-raisers-edge-nxt/index.d.ts +4 -0
  47. package/dist/destinations/blackbaud-raisers-edge-nxt/index.js +53 -0
  48. package/dist/destinations/blackbaud-raisers-edge-nxt/index.js.map +1 -0
  49. package/dist/destinations/blackbaud-raisers-edge-nxt/types/index.d.ts +67 -0
  50. package/dist/destinations/blackbaud-raisers-edge-nxt/types/index.js +3 -0
  51. package/dist/destinations/blackbaud-raisers-edge-nxt/types/index.js.map +1 -0
  52. package/dist/destinations/blackbaud-raisers-edge-nxt/utils/index.d.ts +8 -0
  53. package/dist/destinations/blackbaud-raisers-edge-nxt/utils/index.js +44 -0
  54. package/dist/destinations/blackbaud-raisers-edge-nxt/utils/index.js.map +1 -0
  55. package/dist/destinations/google-enhanced-conversions/types.js +1 -1
  56. package/dist/destinations/google-enhanced-conversions/types.js.map +1 -1
  57. package/dist/destinations/heap/flat.d.ts +1 -2
  58. package/dist/destinations/heap/flat.js +11 -1
  59. package/dist/destinations/heap/flat.js.map +1 -1
  60. package/dist/destinations/heap/heapUtils.d.ts +8 -0
  61. package/dist/destinations/heap/heapUtils.js +41 -0
  62. package/dist/destinations/heap/heapUtils.js.map +1 -0
  63. package/dist/destinations/heap/trackEvent/generated-types.d.ts +0 -1
  64. package/dist/destinations/heap/trackEvent/index.js +18 -54
  65. package/dist/destinations/heap/trackEvent/index.js.map +1 -1
  66. package/dist/destinations/launchpad/generated-types.d.ts +5 -0
  67. package/dist/destinations/launchpad/generated-types.js +3 -0
  68. package/dist/destinations/launchpad/generated-types.js.map +1 -0
  69. package/dist/destinations/launchpad/groupIdentifyUser/generated-types.d.ts +9 -0
  70. package/dist/destinations/launchpad/groupIdentifyUser/generated-types.js +3 -0
  71. package/dist/destinations/launchpad/groupIdentifyUser/generated-types.js.map +1 -0
  72. package/dist/destinations/launchpad/groupIdentifyUser/index.d.ts +5 -0
  73. package/dist/destinations/launchpad/groupIdentifyUser/index.js +79 -0
  74. package/dist/destinations/launchpad/groupIdentifyUser/index.js.map +1 -0
  75. package/dist/destinations/launchpad/identifyUser/generated-types.d.ts +8 -0
  76. package/dist/destinations/launchpad/identifyUser/generated-types.js +3 -0
  77. package/dist/destinations/launchpad/identifyUser/generated-types.js.map +1 -0
  78. package/dist/destinations/launchpad/identifyUser/index.d.ts +5 -0
  79. package/dist/destinations/launchpad/identifyUser/index.js +79 -0
  80. package/dist/destinations/launchpad/identifyUser/index.js.map +1 -0
  81. package/dist/destinations/launchpad/index.d.ts +4 -0
  82. package/dist/destinations/launchpad/index.js +96 -0
  83. package/dist/destinations/launchpad/index.js.map +1 -0
  84. package/dist/destinations/launchpad/launchpad-types.d.ts +28 -0
  85. package/dist/destinations/launchpad/launchpad-types.js +3 -0
  86. package/dist/destinations/launchpad/launchpad-types.js.map +1 -0
  87. package/dist/destinations/launchpad/trackEvent/generated-types.d.ts +18 -0
  88. package/dist/destinations/launchpad/trackEvent/generated-types.js +3 -0
  89. package/dist/destinations/launchpad/trackEvent/generated-types.js.map +1 -0
  90. package/dist/destinations/launchpad/trackEvent/index.d.ts +5 -0
  91. package/dist/destinations/launchpad/trackEvent/index.js +62 -0
  92. package/dist/destinations/launchpad/trackEvent/index.js.map +1 -0
  93. package/dist/destinations/launchpad/trackEvent/launchpad-properties.d.ts +2 -0
  94. package/dist/destinations/launchpad/trackEvent/launchpad-properties.js +87 -0
  95. package/dist/destinations/launchpad/trackEvent/launchpad-properties.js.map +1 -0
  96. package/dist/destinations/launchpad/utils.d.ts +6 -0
  97. package/dist/destinations/launchpad/utils.js +20 -0
  98. package/dist/destinations/launchpad/utils.js.map +1 -0
  99. package/dist/destinations/livelike-cloud/generated-types.d.ts +4 -0
  100. package/dist/destinations/livelike-cloud/generated-types.js +3 -0
  101. package/dist/destinations/livelike-cloud/generated-types.js.map +1 -0
  102. package/dist/destinations/livelike-cloud/index.d.ts +4 -0
  103. package/dist/destinations/livelike-cloud/index.js +84 -0
  104. package/dist/destinations/livelike-cloud/index.js.map +1 -0
  105. package/dist/destinations/livelike-cloud/properties.d.ts +1 -0
  106. package/dist/destinations/livelike-cloud/properties.js +5 -0
  107. package/dist/destinations/livelike-cloud/properties.js.map +1 -0
  108. package/dist/destinations/livelike-cloud/trackEvent/generated-types.d.ts +11 -0
  109. package/dist/destinations/livelike-cloud/trackEvent/generated-types.js +3 -0
  110. package/dist/destinations/livelike-cloud/trackEvent/generated-types.js.map +1 -0
  111. package/dist/destinations/livelike-cloud/trackEvent/index.d.ts +5 -0
  112. package/dist/destinations/livelike-cloud/trackEvent/index.js +101 -0
  113. package/dist/destinations/livelike-cloud/trackEvent/index.js.map +1 -0
  114. package/dist/destinations/pinterest-conversions/generated-types.d.ts +4 -0
  115. package/dist/destinations/pinterest-conversions/generated-types.js +3 -0
  116. package/dist/destinations/pinterest-conversions/generated-types.js.map +1 -0
  117. package/dist/destinations/pinterest-conversions/index.d.ts +4 -0
  118. package/dist/destinations/pinterest-conversions/index.js +29 -0
  119. package/dist/destinations/pinterest-conversions/index.js.map +1 -0
  120. package/dist/destinations/twilio-studio/generated-types.d.ts +6 -0
  121. package/dist/destinations/twilio-studio/generated-types.js +3 -0
  122. package/dist/destinations/twilio-studio/generated-types.js.map +1 -0
  123. package/dist/destinations/twilio-studio/index.d.ts +4 -0
  124. package/dist/destinations/twilio-studio/index.js +55 -0
  125. package/dist/destinations/twilio-studio/index.js.map +1 -0
  126. package/dist/destinations/twilio-studio/triggerStudioFlow/generated-types.d.ts +8 -0
  127. package/dist/destinations/twilio-studio/triggerStudioFlow/generated-types.js +3 -0
  128. package/dist/destinations/twilio-studio/triggerStudioFlow/generated-types.js.map +1 -0
  129. package/dist/destinations/twilio-studio/triggerStudioFlow/index.d.ts +5 -0
  130. package/dist/destinations/twilio-studio/triggerStudioFlow/index.js +84 -0
  131. package/dist/destinations/twilio-studio/triggerStudioFlow/index.js.map +1 -0
  132. package/dist/destinations/twilio-studio/utils.d.ts +29 -0
  133. package/dist/destinations/twilio-studio/utils.js +43 -0
  134. package/dist/destinations/twilio-studio/utils.js.map +1 -0
  135. package/dist/destinations/vwo/identifyUser/index.js +6 -6
  136. package/dist/destinations/vwo/identifyUser/index.js.map +1 -1
  137. package/dist/destinations/vwo/index.js +1 -1
  138. package/dist/destinations/vwo/index.js.map +1 -1
  139. package/dist/destinations/vwo/pageVisit/index.js +6 -6
  140. package/dist/destinations/vwo/pageVisit/index.js.map +1 -1
  141. package/dist/destinations/vwo/trackEvent/index.js +7 -7
  142. package/dist/destinations/vwo/trackEvent/index.js.map +1 -1
  143. package/dist/destinations/vwo/utility.js +2 -2
  144. package/package.json +2 -2
@@ -0,0 +1,53 @@
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 constants_1 = require("./constants");
7
+ const createOrUpdateIndividualConstituent_1 = __importDefault(require("./createOrUpdateIndividualConstituent"));
8
+ const destination = {
9
+ name: "Blackbaud Raiser's Edge NXT",
10
+ slug: 'actions-blackbaud-raisers-edge-nxt',
11
+ mode: 'cloud',
12
+ authentication: {
13
+ scheme: 'oauth-managed',
14
+ fields: {
15
+ bbApiSubscriptionKey: {
16
+ label: 'Blackbaud API Subscription Key',
17
+ description: 'The access key found on your Blackbaud "My subscriptions" page.',
18
+ type: 'string',
19
+ required: true
20
+ }
21
+ },
22
+ testAuthentication: (request) => {
23
+ return request(`${constants_1.SKY_API_BASE_URL}/emailaddresstypes`);
24
+ },
25
+ refreshAccessToken: async (request, { auth }) => {
26
+ const res = await request(constants_1.SKY_OAUTH2_TOKEN_URL, {
27
+ method: 'POST',
28
+ body: new URLSearchParams({
29
+ grant_type: 'refresh_token',
30
+ refresh_token: auth.refreshToken,
31
+ client_id: auth.clientId,
32
+ client_secret: auth.clientSecret
33
+ })
34
+ });
35
+ return { accessToken: res.data.access_token };
36
+ }
37
+ },
38
+ extendRequest({ auth, settings }) {
39
+ return {
40
+ headers: {
41
+ authorization: `Bearer ${auth?.accessToken}`,
42
+ 'Bb-Api-Subscription-Key': `${settings.bbApiSubscriptionKey}`
43
+ }
44
+ };
45
+ },
46
+ onDelete: async () => {
47
+ },
48
+ actions: {
49
+ createOrUpdateIndividualConstituent: createOrUpdateIndividualConstituent_1.default
50
+ }
51
+ };
52
+ exports.default = destination;
53
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/blackbaud-raisers-edge-nxt/index.ts"],"names":[],"mappings":";;;;;AAEA,2CAAoE;AAEpE,gHAAuF;AAEvF,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,6BAA6B;IACnC,IAAI,EAAE,oCAAoC;IAC1C,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE;YACN,oBAAoB,EAAE;gBACpB,KAAK,EAAE,gCAAgC;gBACvC,WAAW,EAAE,iEAAiE;gBAC9E,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;SACF;QACD,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE;YAC9B,OAAO,OAAO,CAAC,GAAG,4BAAgB,oBAAoB,CAAC,CAAA;QACzD,CAAC;QACD,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YAE9C,MAAM,GAAG,GAAG,MAAM,OAAO,CAAuB,gCAAoB,EAAE;gBACpE,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,IAAI,eAAe,CAAC;oBACxB,UAAU,EAAE,eAAe;oBAC3B,aAAa,EAAE,IAAI,CAAC,YAAY;oBAChC,SAAS,EAAE,IAAI,CAAC,QAAQ;oBACxB,aAAa,EAAE,IAAI,CAAC,YAAY;iBACjC,CAAC;aACH,CAAC,CAAA;YAEF,OAAO,EAAE,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,CAAA;QAC/C,CAAC;KACF;IACD,aAAa,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC9B,OAAO;YACL,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,EAAE,WAAW,EAAE;gBAC5C,yBAAyB,EAAE,GAAG,QAAQ,CAAC,oBAAoB,EAAE;aAC9D;SACF,CAAA;IACH,CAAC;IAGD,QAAQ,EAAE,KAAK,IAAI,EAAE;IAIrB,CAAC;IAED,OAAO,EAAE;QACP,mCAAmC,EAAnC,6CAAmC;KACpC;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -0,0 +1,67 @@
1
+ export interface RefreshTokenResponse {
2
+ access_token: string;
3
+ }
4
+ export interface StringIndexedObject {
5
+ [key: string]: any;
6
+ }
7
+ export interface FuzzyDate {
8
+ d: string;
9
+ m: string;
10
+ y: string;
11
+ }
12
+ export interface Constituent {
13
+ address?: Address;
14
+ birthdate?: FuzzyDate;
15
+ email?: Email;
16
+ first?: string;
17
+ gender?: string;
18
+ income?: string;
19
+ last?: string;
20
+ lookup_id?: string;
21
+ online_presence?: OnlinePresence;
22
+ phone?: Phone;
23
+ type?: string;
24
+ }
25
+ export interface Address {
26
+ address_lines?: string;
27
+ city?: string;
28
+ country?: string;
29
+ do_not_mail?: boolean;
30
+ postal_code?: string;
31
+ primary?: boolean;
32
+ state?: string;
33
+ type?: string;
34
+ inactive?: boolean;
35
+ }
36
+ export interface ExistingAddress extends Address {
37
+ id: string;
38
+ }
39
+ export interface Email {
40
+ address?: string;
41
+ do_not_email?: boolean;
42
+ primary?: boolean;
43
+ type?: string;
44
+ inactive?: boolean;
45
+ }
46
+ export interface ExistingEmail extends Email {
47
+ id: string;
48
+ }
49
+ export interface OnlinePresence {
50
+ address?: string;
51
+ primary?: boolean;
52
+ type?: string;
53
+ inactive?: boolean;
54
+ }
55
+ export interface ExistingOnlinePresence extends OnlinePresence {
56
+ id: string;
57
+ }
58
+ export interface Phone {
59
+ do_not_call?: boolean;
60
+ number?: string;
61
+ primary?: boolean;
62
+ type?: string;
63
+ inactive?: boolean;
64
+ }
65
+ export interface ExistingPhone extends Phone {
66
+ id: string;
67
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/blackbaud-raisers-edge-nxt/types/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import { StringIndexedObject } from '../types';
2
+ export declare const dateStringToFuzzyDate: (dateString: string | number) => false | {
3
+ d: string;
4
+ m: string;
5
+ y: string;
6
+ };
7
+ export declare const filterObjectListByMatchFields: (list: StringIndexedObject[], data: StringIndexedObject, matchFields: string[]) => StringIndexedObject | undefined;
8
+ export declare const isRequestErrorRetryable: (statusCode: number) => boolean;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isRequestErrorRetryable = exports.filterObjectListByMatchFields = exports.dateStringToFuzzyDate = void 0;
4
+ const dateStringToFuzzyDate = (dateString) => {
5
+ const date = new Date(dateString);
6
+ if (isNaN(date.getTime())) {
7
+ return false;
8
+ }
9
+ else {
10
+ return {
11
+ d: date.getDate().toString(),
12
+ m: (date.getMonth() + 1).toString(),
13
+ y: date.getFullYear().toString()
14
+ };
15
+ }
16
+ };
17
+ exports.dateStringToFuzzyDate = dateStringToFuzzyDate;
18
+ const filterObjectListByMatchFields = (list, data, matchFields) => {
19
+ return list.find((item) => {
20
+ let isMatch = undefined;
21
+ matchFields.forEach((field) => {
22
+ if (isMatch !== false) {
23
+ let fieldName = field;
24
+ if (field.startsWith('int:')) {
25
+ fieldName = field.split('int:')[1];
26
+ }
27
+ let itemValue = item[fieldName] ? item[fieldName].toLowerCase() : '';
28
+ let dataValue = data[fieldName] ? data[fieldName].toLowerCase() : '';
29
+ if (field.startsWith('int:')) {
30
+ itemValue = itemValue.replace(/\D/g, '');
31
+ dataValue = dataValue.replace(/\D/g, '');
32
+ }
33
+ isMatch = itemValue === dataValue;
34
+ }
35
+ });
36
+ return isMatch;
37
+ });
38
+ };
39
+ exports.filterObjectListByMatchFields = filterObjectListByMatchFields;
40
+ const isRequestErrorRetryable = (statusCode) => {
41
+ return statusCode === 429 || statusCode >= 500;
42
+ };
43
+ exports.isRequestErrorRetryable = isRequestErrorRetryable;
44
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/blackbaud-raisers-edge-nxt/utils/index.ts"],"names":[],"mappings":";;;AAEO,MAAM,qBAAqB,GAAG,CAAC,UAA2B,EAAE,EAAE;IACnE,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,CAAA;IACjC,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE;QAEzB,OAAO,KAAK,CAAA;KACb;SAAM;QAIL,OAAO;YACL,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;YAC5B,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE;YACnC,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;SACjC,CAAA;KACF;AACH,CAAC,CAAA;AAfY,QAAA,qBAAqB,yBAejC;AAEM,MAAM,6BAA6B,GAAG,CAC3C,IAA2B,EAC3B,IAAyB,EACzB,WAAqB,EACrB,EAAE;IACF,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,IAAyB,EAAE,EAAE;QAC7C,IAAI,OAAO,GAAwB,SAAS,CAAA;QAC5C,WAAW,CAAC,OAAO,CAAC,CAAC,KAAa,EAAE,EAAE;YACpC,IAAI,OAAO,KAAK,KAAK,EAAE;gBACrB,IAAI,SAAS,GAAG,KAAK,CAAA;gBACrB,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;oBAC5B,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;iBACnC;gBACD,IAAI,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;gBACpE,IAAI,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;gBACpE,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;oBAC5B,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;oBACxC,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;iBACzC;gBACD,OAAO,GAAG,SAAS,KAAK,SAAS,CAAA;aAClC;QACH,CAAC,CAAC,CAAA;QACF,OAAO,OAAO,CAAA;IAChB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAxBY,QAAA,6BAA6B,iCAwBzC;AAEM,MAAM,uBAAuB,GAAG,CAAC,UAAkB,EAAE,EAAE;IAC5D,OAAO,UAAU,KAAK,GAAG,IAAI,UAAU,IAAI,GAAG,CAAA;AAChD,CAAC,CAAA;AAFY,QAAA,uBAAuB,2BAEnC"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getUrlByVersion = void 0;
4
4
  function getUrlByVersion(features) {
5
- if (features && features['google-enhanced-conversions-v12']) {
5
+ if (features && features['google-enhanced-v12']) {
6
6
  return 'https://googleads.googleapis.com/v12/customers';
7
7
  }
8
8
  return 'https://googleads.googleapis.com/v11/customers';
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/destinations/google-enhanced-conversions/types.ts"],"names":[],"mappings":";;;AA4BA,SAAgB,eAAe,CAAC,QAA8B;IAC5D,IAAI,QAAQ,IAAI,QAAQ,CAAC,iCAAiC,CAAC,EAAE;QAC3D,OAAO,gDAAgD,CAAA;KACxD;IACD,OAAO,gDAAgD,CAAA;AACzD,CAAC;AALD,0CAKC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/destinations/google-enhanced-conversions/types.ts"],"names":[],"mappings":";;;AA4BA,SAAgB,eAAe,CAAC,QAA8B;IAC5D,IAAI,QAAQ,IAAI,QAAQ,CAAC,qBAAqB,CAAC,EAAE;QAC/C,OAAO,gDAAgD,CAAA;KACxD;IACD,OAAO,gDAAgD,CAAA;AACzD,CAAC;AALD,0CAKC"}
@@ -1,9 +1,8 @@
1
- import { JSONValue } from '@segment/actions-core';
2
1
  export declare type Properties = {
3
2
  [k: string]: unknown;
4
3
  };
5
4
  declare type FlattenProperties = object & {
6
- [k: string]: JSONValue;
5
+ [k: string]: string;
7
6
  };
8
7
  export declare function flat(data: Properties, prefix?: string): FlattenProperties;
9
8
  export {};
@@ -9,10 +9,20 @@ function flat(data, prefix = '') {
9
9
  result = { ...result, ...flatten };
10
10
  }
11
11
  else {
12
- result[(prefix + '.' + key).replace(/^\./, '')] = data[key];
12
+ const stringifiedValue = stringify(data[key]);
13
+ result[(prefix + '.' + key).replace(/^\./, '')] = stringifiedValue;
13
14
  }
14
15
  }
15
16
  return result;
16
17
  }
17
18
  exports.flat = flat;
19
+ function stringify(value) {
20
+ if (typeof value === 'string') {
21
+ return value;
22
+ }
23
+ if (typeof value === 'number' || typeof value === 'boolean') {
24
+ return value.toString();
25
+ }
26
+ return JSON.stringify(value);
27
+ }
18
28
  //# sourceMappingURL=flat.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flat.js","sourceRoot":"","sources":["../../../src/destinations/heap/flat.ts"],"names":[],"mappings":";;;AAUA,SAAgB,IAAI,CAAC,IAAgB,EAAE,MAAM,GAAG,EAAE;IAChD,IAAI,MAAM,GAAsB,EAAE,CAAA;I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B,CAAA;SACnE;KACF;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAZD,oBAYC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,OAAO,KAAK,CAAA;KACb;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE;QAC3D,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAA;KACxB;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Payload } from './trackEvent/generated-types';
2
+ export declare const getUserIdentifier: ({ identity, anonymous_id }: {
3
+ identity?: string | null | undefined;
4
+ anonymous_id?: string | null | undefined;
5
+ }) => {
6
+ [k: string]: string;
7
+ };
8
+ export declare const getEventName: (payload: Payload) => string;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEventName = exports.getUserIdentifier = void 0;
4
+ const actions_core_1 = require("@segment/actions-core");
5
+ const getUserIdentifier = ({ identity, anonymous_id }) => {
6
+ if (identity) {
7
+ return {
8
+ identity
9
+ };
10
+ }
11
+ if (anonymous_id) {
12
+ return {
13
+ anonymous_id
14
+ };
15
+ }
16
+ throw new actions_core_1.IntegrationError('Either identity or anonymous id are required.');
17
+ };
18
+ exports.getUserIdentifier = getUserIdentifier;
19
+ const getEventName = (payload) => {
20
+ let eventName;
21
+ switch (payload.type) {
22
+ case 'track':
23
+ eventName = payload.event;
24
+ break;
25
+ case 'page':
26
+ eventName = payload.name ? `${payload.name} page viewed` : 'Page viewed';
27
+ break;
28
+ case 'screen':
29
+ eventName = payload.name ? `${payload.name} screen viewed` : 'Screen viewed';
30
+ break;
31
+ default:
32
+ eventName = 'track';
33
+ break;
34
+ }
35
+ if (!eventName) {
36
+ return 'track';
37
+ }
38
+ return eventName;
39
+ };
40
+ exports.getEventName = getEventName;
41
+ //# sourceMappingURL=heapUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"heapUtils.js","sourceRoot":"","sources":["../../../src/destinations/heap/heapUtils.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AAGjD,MAAM,iBAAiB,GAAG,CAAC,EAChC,QAAQ,EACR,YAAY,EAIb,EAA2B,EAAE;IAC5B,IAAI,QAAQ,EAAE;QACZ,OAAO;YACL,QAAQ;SACT,CAAA;KACF;IAED,IAAI,YAAY,EAAE;QAChB,OAAO;YACL,YAAY;SACb,CAAA;KACF;IACD,MAAM,IAAI,+BAAgB,CAAC,+CAA+C,CAAC,CAAA;AAC7E,CAAC,CAAA;AAnBY,QAAA,iBAAiB,qBAmB7B;AAEM,MAAM,YAAY,GAAG,CAAC,OAAgB,EAAE,EAAE;IAC/C,IAAI,SAA6B,CAAA;IACjC,QAAQ,OAAO,CAAC,IAAI,EAAE;QACpB,KAAK,OAAO;YACV,SAAS,GAAG,OAAO,CAAC,KAAK,CAAA;YACzB,MAAK;QACP,KAAK,MAAM;YACT,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,aAAa,CAAA;YACxE,MAAK;QACP,KAAK,QAAQ;YACX,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,gBAAgB,CAAC,CAAC,CAAC,eAAe,CAAA;YAC5E,MAAK;QACP;YACE,SAAS,GAAG,OAAO,CAAA;YACnB,MAAK;KACR;IAED,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,OAAO,CAAA;KACf;IACD,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA;AArBY,QAAA,YAAY,gBAqBxB"}
@@ -7,7 +7,6 @@ export interface Payload {
7
7
  [k: string]: unknown;
8
8
  };
9
9
  timestamp?: string | number;
10
- session_id?: string;
11
10
  type?: string;
12
11
  name?: string;
13
12
  }
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const dayjs_1 = __importDefault(require("../../../lib/dayjs"));
7
7
  const constants_1 = require("../constants");
8
- const userIdHash_1 = require("../userIdHash");
9
8
  const flat_1 = require("../flat");
9
+ const heapUtils_1 = require("../heapUtils");
10
10
  const actions_core_1 = require("@segment/actions-core");
11
11
  const action = {
12
12
  title: 'Track Event',
@@ -26,10 +26,7 @@ const action = {
26
26
  label: 'Identity',
27
27
  type: 'string',
28
28
  allowNull: true,
29
- description: 'An identity, typically corresponding to an existing user. If no such identity exists, then a new user will be created with that identity. Case-sensitive string, limited to 255 characters.',
30
- default: {
31
- '@path': '$.userId'
32
- }
29
+ description: 'A unique identity and maintain user histories across sessions and devices under a single profile. If no identity is provided we will add the anonymous_id to the event. More on identify: https://developers.heap.io/docs/using-identify'
33
30
  },
34
31
  anonymous_id: {
35
32
  label: 'Anonymous ID',
@@ -64,14 +61,6 @@ const action = {
64
61
  '@path': '$.timestamp'
65
62
  }
66
63
  },
67
- session_id: {
68
- label: 'Session ID',
69
- type: 'string',
70
- description: 'A Heap session ID. The session ID can be retrived by calling getSessionId() on the heap api. If a session ID is not provided one will be created.',
71
- default: {
72
- '@path': '$.session_id'
73
- }
74
- },
75
64
  type: {
76
65
  label: 'Type',
77
66
  type: 'string',
@@ -94,55 +83,30 @@ const action = {
94
83
  throw new actions_core_1.IntegrationError('Missing app ID');
95
84
  }
96
85
  if (!payload.anonymous_id && !payload.identity) {
97
- throw new actions_core_1.IntegrationError('Either anonymous user id or identity should be specified.');
86
+ throw new actions_core_1.IntegrationError('Either Anonymous id or Identity should be specified.');
98
87
  }
99
- const defaultEventProperties = { segment_library: constants_1.HEAP_SEGMENT_CLOUD_LIBRARY_NAME };
100
- const flatten = flat_1.flat(payload.properties || {});
101
- const eventProperties = Object.assign(defaultEventProperties, flatten);
102
- const heapPayload = {
103
- app_id: settings.appId,
104
- event: getEventName(payload),
105
- properties: eventProperties,
88
+ const standardProperties = { segment_library: constants_1.HEAP_SEGMENT_CLOUD_LIBRARY_NAME };
89
+ const flattenedProperties = flat_1.flat(payload.properties || {});
90
+ const event = {
91
+ event: heapUtils_1.getEventName(payload),
92
+ custom_properties: flattenedProperties,
93
+ properties: standardProperties,
106
94
  idempotency_key: payload.message_id
107
95
  };
108
- if (payload.anonymous_id && !payload.identity) {
109
- heapPayload.user_id = userIdHash_1.getHeapUserId(payload.anonymous_id);
110
- }
111
- if (payload.identity) {
112
- heapPayload.identity = payload.identity;
113
- }
96
+ event.user_identifier = heapUtils_1.getUserIdentifier({ identity: payload.identity, anonymous_id: payload.anonymous_id });
114
97
  if (payload.timestamp && dayjs_1.default.utc(payload.timestamp).isValid()) {
115
- heapPayload.timestamp = dayjs_1.default.utc(payload.timestamp).toISOString();
116
- }
117
- if (payload.session_id) {
118
- heapPayload.session_id = payload.session_id;
98
+ event.timestamp = dayjs_1.default.utc(payload.timestamp).toISOString();
119
99
  }
120
- return request('https://heapanalytics.com/api/track', {
100
+ const payLoad = {
101
+ app_id: settings.appId,
102
+ events: [event],
103
+ library: 'Segment'
104
+ };
105
+ return request('https://heapanalytics.com/api/integrations/track', {
121
106
  method: 'post',
122
- json: heapPayload
107
+ json: payLoad
123
108
  });
124
109
  }
125
110
  };
126
- const getEventName = (payload) => {
127
- let eventName;
128
- switch (payload.type) {
129
- case 'track':
130
- eventName = payload.event;
131
- break;
132
- case 'page':
133
- eventName = payload.name ? payload.name : 'Page Viewed';
134
- break;
135
- case 'screen':
136
- eventName = payload.name ? payload.name : 'Screen Viewed';
137
- break;
138
- default:
139
- eventName = 'track';
140
- break;
141
- }
142
- if (!eventName) {
143
- return 'track';
144
- }
145
- return eventName;
146
- };
147
111
  exports.default = action;
148
112
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/heap/trackEvent/index.ts"],"names":[],"mappings":";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AO,CAAC,QAAQ,EAAE;YACpB,WAAW,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;SACxC;QAED,IAAI,OAAO,CAAC,SAAS,IAAI,eAAK,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,EAAE;YAC/D,WAAW,CAAC,SAAS,GAAG,eAAK,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAA;SACnE;QAED,IAAI,OAAO,CAAC,UAAU,EAAE;YACtB,WAAW,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;SAC5C;QAED,OAAO,OAAO,CAAC,qCAAqC,EAAE;YACpD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,WAAW;SAClB,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,MAAM,YAAY,GAAG,CAAC,OAAgB,EAAE,EAAE;IACxC,IAAI,SAA6B,CAAA;IACjC,QAAQ,OAAO,CAAC,IAAI,EAAE;QACpB,KAAK,OAAO;YACV,SAAS,GAAG,OAAO,CAAC,KAAK,CAAA;YACzB,MAAK;QACP,KAAK,MAAM;YACT,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,CAAA;YACvD,MAAK;QACP,KAAK,QAAQ;YACX,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAA;YACzD,MAAK;QACP;YACE,SAAS,GAAG,OAAO,CAAA;YACnB,MAAK;KACR;IAED,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,OAAO,CAAA;KACf;IACD,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA;AAED,kBAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/heap/trackEvent/index.ts"],"names":[],"mappings":";;;;;AAGA,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K,CAAC;YACf,OAAO,EAAE,SAAS;SACnB,CAAA;QAED,OAAO,OAAO,CAAC,kDAAkD,EAAE;YACjE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,OAAO;SACd,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,5 @@
1
+ export interface Settings {
2
+ apiSecret: string;
3
+ apiRegion?: string;
4
+ sourceName?: string;
5
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/launchpad/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ export interface Payload {
2
+ groupKey?: string;
3
+ groupId: string;
4
+ traits?: {
5
+ [k: string]: unknown;
6
+ };
7
+ userId?: string;
8
+ anonymousId?: string;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/launchpad/groupIdentifyUser/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const groupIdentifyUser: ActionDefinition<Settings, Payload>;
5
+ export default groupIdentifyUser;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../utils");
4
+ const groupIdentifyUser = {
5
+ title: 'Group Identify User',
6
+ description: 'Updates or adds properties to a group profile. The profile is created if it does not exist. [Learn more about Group Analytics.](https://help.Launchpad.pm)',
7
+ defaultSubscription: 'type = "group"',
8
+ fields: {
9
+ groupKey: {
10
+ label: 'Group Key',
11
+ type: 'string',
12
+ required: false,
13
+ description: 'The group key you specified in Launchpad under the company corresponding to the group. If this is not specified, it will be defaulted to "$group_id". This is helpful when you have a group of companies that should be joined together as in when you have a multinational.'
14
+ },
15
+ groupId: {
16
+ label: 'Group ID',
17
+ type: 'string',
18
+ description: 'The unique identifier of the group. If there is a trait that matches the group key, it will override this value.',
19
+ required: true,
20
+ default: {
21
+ '@path': '$.groupId'
22
+ }
23
+ },
24
+ traits: {
25
+ label: 'Group Properties',
26
+ type: 'object',
27
+ description: 'The properties to set on the group profile.',
28
+ required: false,
29
+ default: {
30
+ '@path': '$.traits'
31
+ }
32
+ },
33
+ userId: {
34
+ label: 'User ID',
35
+ type: 'string',
36
+ description: 'A unique ID for a known user. This will be used as the Distinct ID. This field is required if the Anonymous ID field is empty',
37
+ default: {
38
+ '@path': '$.userId'
39
+ }
40
+ },
41
+ anonymousId: {
42
+ label: 'Anonymous ID',
43
+ type: 'string',
44
+ description: 'A unique ID for an anonymous user. This will be used as the Distinct ID if the User ID field is empty. This field is required if the User ID field is empty',
45
+ default: {
46
+ '@path': '$.anonymousId'
47
+ }
48
+ }
49
+ },
50
+ perform: async (request, { payload, settings }) => {
51
+ const groupId = payload.groupId;
52
+ const apiServerUrl = utils_1.getApiServerUrl(settings.apiRegion);
53
+ let transformed_traits;
54
+ if (payload.traits) {
55
+ transformed_traits = {
56
+ ...Object.fromEntries(Object.entries(payload.traits).map(([k, v]) => [`group_${k}`, v]))
57
+ };
58
+ }
59
+ const groupIdentifyEvent = {
60
+ event: '$identify',
61
+ type: 'screen',
62
+ $set: {
63
+ group_id: groupId,
64
+ ...transformed_traits
65
+ },
66
+ distinct_id: payload.userId ? payload.userId : payload.anonymousId,
67
+ user_id: payload.userId,
68
+ anonymoud_id: payload.anonymousId,
69
+ api_key: settings.apiSecret
70
+ };
71
+ const groupIdentifyResponse = await request(`${apiServerUrl}capture`, {
72
+ method: 'post',
73
+ json: groupIdentifyEvent
74
+ });
75
+ return groupIdentifyResponse;
76
+ }
77
+ };
78
+ exports.default = groupIdentifyUser;
79
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/launchpad/groupIdentifyUser/index.ts"],"names":[],"mappings":";;AAEA,oCAA0C;AAG1C,MAAM,iBAAiB,GAAwC;IAC7D,KAAK,EAAE,qBAAqB;IAC5B,WAAW,EACT,4JAA4J;IAC9J,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,QAAQ,EAAE;YACR,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EACT,8QAA8Q;SACjR;QACD,OAAO,EAAE;YACP,KAAK,EAAE,UAAU;YACjB,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,kHAAkH;YACpH,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,WAAW;aACrB;SACF;QACD,MAAM,EAAE;YACN,KAAK,EAAE,kBAAkB;YACzB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;QACD,MAAM,EAAE;YACN,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,+HAA+H;YACjI,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;QACD,WAAW,EAAE;YACX,KAAK,EAAE,cAAc;YACrB,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,6JAA6J;YAC/J,OAAO,EAAE;gBACP,OAAO,EAAE,eAAe;aACzB;SACF;KACF;IAED,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAChD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;QAC/B,MAAM,YAAY,GAAG,uBAAe,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;QACxD,IAAI,kBAAkB,CAAA;QAEtB,IAAI,OAAO,CAAC,MAAM,EAAE;YAClB,kBAAkB,GAAG;gBACnB,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;aACzF,CAAA;SACF;QACD,MAAM,kBAAkB,GAAG;YACzB,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE;gBACJ,QAAQ,EAAE,OAAO;gBACjB,GAAG,kBAAkB;aACtB;YACD,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW;YAClE,OAAO,EAAE,OAAO,CAAC,MAAM;YACvB,YAAY,EAAE,OAAO,CAAC,WAAW;YACjC,OAAO,EAAE,QAAQ,CAAC,SAAS;SAC5B,CAAA;QACD,MAAM,qBAAqB,GAAG,MAAM,OAAO,CAAC,GAAG,YAAY,SAAS,EAAE;YACpE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,kBAAkB;SACzB,CAAC,CAAA;QAEF,OAAO,qBAAqB,CAAA;IAC9B,CAAC;CACF,CAAA;AAED,kBAAe,iBAAiB,CAAA"}
@@ -0,0 +1,8 @@
1
+ export interface Payload {
2
+ ip?: string;
3
+ userId?: string;
4
+ anonymousId?: string;
5
+ traits: {
6
+ [k: string]: unknown;
7
+ };
8
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/launchpad/identifyUser/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const identifyUser: ActionDefinition<Settings, Payload>;
5
+ export default identifyUser;