@segment/action-destinations 3.244.0-staging-7136444b → 3.244.1

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 (143) hide show
  1. package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.d.ts +1 -0
  2. package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.js +184 -0
  3. package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.js.map +1 -0
  4. package/dist/destinations/customerio/deleteObject/generated-types.d.ts +4 -0
  5. package/dist/destinations/customerio/deleteObject/generated-types.js +3 -0
  6. package/dist/destinations/customerio/deleteObject/generated-types.js.map +1 -0
  7. package/dist/destinations/customerio/deleteObject/index.d.ts +5 -0
  8. package/dist/destinations/customerio/deleteObject/index.js +48 -0
  9. package/dist/destinations/customerio/deleteObject/index.js.map +1 -0
  10. package/dist/destinations/customerio/deletePerson/generated-types.d.ts +3 -0
  11. package/dist/destinations/customerio/deletePerson/generated-types.js +3 -0
  12. package/dist/destinations/customerio/deletePerson/generated-types.js.map +1 -0
  13. package/dist/destinations/customerio/deletePerson/index.d.ts +5 -0
  14. package/dist/destinations/customerio/deletePerson/index.js +41 -0
  15. package/dist/destinations/customerio/deletePerson/index.js.map +1 -0
  16. package/dist/destinations/customerio/deleteRelationship/generated-types.d.ts +6 -0
  17. package/dist/destinations/customerio/deleteRelationship/generated-types.js +3 -0
  18. package/dist/destinations/customerio/deleteRelationship/generated-types.js.map +1 -0
  19. package/dist/destinations/customerio/deleteRelationship/index.d.ts +5 -0
  20. package/dist/destinations/customerio/deleteRelationship/index.js +82 -0
  21. package/dist/destinations/customerio/deleteRelationship/index.js.map +1 -0
  22. package/dist/destinations/customerio/reportDeliveryEvent/generated-types.d.ts +10 -0
  23. package/dist/destinations/customerio/reportDeliveryEvent/generated-types.js +3 -0
  24. package/dist/destinations/customerio/reportDeliveryEvent/generated-types.js.map +1 -0
  25. package/dist/destinations/customerio/reportDeliveryEvent/index.d.ts +5 -0
  26. package/dist/destinations/customerio/reportDeliveryEvent/index.js +121 -0
  27. package/dist/destinations/customerio/reportDeliveryEvent/index.js.map +1 -0
  28. package/dist/destinations/customerio/suppressPerson/generated-types.d.ts +3 -0
  29. package/dist/destinations/customerio/suppressPerson/generated-types.js +3 -0
  30. package/dist/destinations/customerio/suppressPerson/generated-types.js.map +1 -0
  31. package/dist/destinations/customerio/suppressPerson/index.d.ts +5 -0
  32. package/dist/destinations/customerio/suppressPerson/index.js +41 -0
  33. package/dist/destinations/customerio/suppressPerson/index.js.map +1 -0
  34. package/dist/destinations/customerio/test-helper.d.ts +6 -0
  35. package/dist/destinations/customerio/test-helper.js +84 -0
  36. package/dist/destinations/customerio/test-helper.js.map +1 -0
  37. package/dist/destinations/customerio/unsuppressPerson/generated-types.d.ts +3 -0
  38. package/dist/destinations/customerio/unsuppressPerson/generated-types.js +3 -0
  39. package/dist/destinations/customerio/unsuppressPerson/generated-types.js.map +1 -0
  40. package/dist/destinations/customerio/unsuppressPerson/index.d.ts +5 -0
  41. package/dist/destinations/customerio/unsuppressPerson/index.js +41 -0
  42. package/dist/destinations/customerio/unsuppressPerson/index.js.map +1 -0
  43. package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.d.ts +2 -5
  44. package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js +18 -98
  45. package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js.map +1 -1
  46. package/dist/destinations/engage/utils/track.d.ts +10 -10
  47. package/dist/destinations/klaviyo/removeProfileToList/generated-types.d.ts +4 -0
  48. package/dist/destinations/klaviyo/removeProfileToList/generated-types.js +3 -0
  49. package/dist/destinations/klaviyo/removeProfileToList/generated-types.js.map +1 -0
  50. package/dist/destinations/klaviyo/removeProfileToList/index.d.ts +5 -0
  51. package/dist/destinations/klaviyo/removeProfileToList/index.js +43 -0
  52. package/dist/destinations/klaviyo/removeProfileToList/index.js.map +1 -0
  53. package/dist/destinations/mixpanel/utils.d.ts +13 -0
  54. package/dist/destinations/mixpanel/utils.js +117 -0
  55. package/dist/destinations/mixpanel/utils.js.map +1 -0
  56. package/dist/destinations/movable-ink/categoryView/generated-types.d.ts +22 -0
  57. package/dist/destinations/movable-ink/categoryView/generated-types.js +3 -0
  58. package/dist/destinations/movable-ink/categoryView/generated-types.js.map +1 -0
  59. package/dist/destinations/movable-ink/categoryView/index.d.ts +5 -0
  60. package/dist/destinations/movable-ink/categoryView/index.js +43 -0
  61. package/dist/destinations/movable-ink/categoryView/index.js.map +1 -0
  62. package/dist/destinations/movable-ink/conversion/generated-types.d.ts +20 -0
  63. package/dist/destinations/movable-ink/conversion/generated-types.js +3 -0
  64. package/dist/destinations/movable-ink/conversion/generated-types.js.map +1 -0
  65. package/dist/destinations/movable-ink/conversion/index.d.ts +5 -0
  66. package/dist/destinations/movable-ink/conversion/index.js +45 -0
  67. package/dist/destinations/movable-ink/conversion/index.js.map +1 -0
  68. package/dist/destinations/movable-ink/fields.d.ts +21 -0
  69. package/dist/destinations/movable-ink/fields.js +236 -0
  70. package/dist/destinations/movable-ink/fields.js.map +1 -0
  71. package/dist/destinations/movable-ink/identify/generated-types.d.ts +7 -0
  72. package/dist/destinations/movable-ink/identify/generated-types.js +3 -0
  73. package/dist/destinations/movable-ink/identify/generated-types.js.map +1 -0
  74. package/dist/destinations/movable-ink/identify/index.d.ts +5 -0
  75. package/dist/destinations/movable-ink/identify/index.js +32 -0
  76. package/dist/destinations/movable-ink/identify/index.js.map +1 -0
  77. package/dist/destinations/movable-ink/productAdded/generated-types.d.ts +22 -0
  78. package/dist/destinations/movable-ink/productAdded/generated-types.js +3 -0
  79. package/dist/destinations/movable-ink/productAdded/generated-types.js.map +1 -0
  80. package/dist/destinations/movable-ink/productAdded/index.d.ts +5 -0
  81. package/dist/destinations/movable-ink/productAdded/index.js +43 -0
  82. package/dist/destinations/movable-ink/productAdded/index.js.map +1 -0
  83. package/dist/destinations/movable-ink/productViewed/generated-types.d.ts +21 -0
  84. package/dist/destinations/movable-ink/productViewed/generated-types.js +3 -0
  85. package/dist/destinations/movable-ink/productViewed/generated-types.js.map +1 -0
  86. package/dist/destinations/movable-ink/productViewed/index.d.ts +5 -0
  87. package/dist/destinations/movable-ink/productViewed/index.js +43 -0
  88. package/dist/destinations/movable-ink/productViewed/index.js.map +1 -0
  89. package/dist/destinations/movable-ink/search/generated-types.d.ts +12 -0
  90. package/dist/destinations/movable-ink/search/generated-types.js +3 -0
  91. package/dist/destinations/movable-ink/search/generated-types.js.map +1 -0
  92. package/dist/destinations/movable-ink/search/index.d.ts +5 -0
  93. package/dist/destinations/movable-ink/search/index.js +43 -0
  94. package/dist/destinations/movable-ink/search/index.js.map +1 -0
  95. package/dist/destinations/movable-ink/sendCustomEvent/generated-types.d.ts +25 -0
  96. package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js +3 -0
  97. package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js.map +1 -0
  98. package/dist/destinations/movable-ink/sendCustomEvent/index.d.ts +5 -0
  99. package/dist/destinations/movable-ink/sendCustomEvent/index.js +48 -0
  100. package/dist/destinations/movable-ink/sendCustomEvent/index.js.map +1 -0
  101. package/dist/destinations/segment/segment-properties.d.ts +1 -0
  102. package/dist/destinations/segment/segment-properties.js +7 -1
  103. package/dist/destinations/segment/segment-properties.js.map +1 -1
  104. package/dist/destinations/segment/sendGroup/generated-types.d.ts +1 -0
  105. package/dist/destinations/segment/sendGroup/index.js +39 -25
  106. package/dist/destinations/segment/sendGroup/index.js.map +1 -1
  107. package/dist/destinations/segment/sendIdentify/generated-types.d.ts +1 -0
  108. package/dist/destinations/segment/sendIdentify/index.js +39 -25
  109. package/dist/destinations/segment/sendIdentify/index.js.map +1 -1
  110. package/dist/destinations/segment/sendPage/generated-types.d.ts +1 -0
  111. package/dist/destinations/segment/sendPage/index.js +47 -33
  112. package/dist/destinations/segment/sendPage/index.js.map +1 -1
  113. package/dist/destinations/segment/sendScreen/generated-types.d.ts +1 -0
  114. package/dist/destinations/segment/sendScreen/index.js +40 -26
  115. package/dist/destinations/segment/sendScreen/index.js.map +1 -1
  116. package/dist/destinations/segment/sendTrack/generated-types.d.ts +1 -0
  117. package/dist/destinations/segment/sendTrack/index.js +43 -29
  118. package/dist/destinations/segment/sendTrack/index.js.map +1 -1
  119. package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.d.ts +1 -0
  120. package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.js +381 -0
  121. package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.js.map +1 -0
  122. package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.d.ts +1 -0
  123. package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.js +499 -0
  124. package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.js.map +1 -0
  125. package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.d.ts +4 -0
  126. package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.js +97 -0
  127. package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.js.map +1 -0
  128. package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v3.d.ts +8 -0
  129. package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v3.js +126 -0
  130. package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v3.js.map +1 -0
  131. package/dist/destinations/snap-conversions-api/reportConversionEvent/utils.d.ts +13 -0
  132. package/dist/destinations/snap-conversions-api/reportConversionEvent/utils.js +40 -0
  133. package/dist/destinations/snap-conversions-api/reportConversionEvent/utils.js.map +1 -0
  134. package/dist/destinations/trackey/group.types.d.ts +11 -0
  135. package/dist/destinations/trackey/group.types.js +3 -0
  136. package/dist/destinations/trackey/group.types.js.map +1 -0
  137. package/dist/destinations/trackey/identify.types.d.ts +11 -0
  138. package/dist/destinations/trackey/identify.types.js +3 -0
  139. package/dist/destinations/trackey/identify.types.js.map +1 -0
  140. package/dist/destinations/trackey/track.types.d.ts +12 -0
  141. package/dist/destinations/trackey/track.types.js +3 -0
  142. package/dist/destinations/trackey/track.types.js.map +1 -0
  143. package/package.json +1 -1
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../utils");
4
+ const action = {
5
+ title: 'Suppress Person',
6
+ description: `Suppress a person in Customer.io. This will prevent the person from receiving any messages.`,
7
+ defaultSubscription: 'event = "User Suppressed"',
8
+ fields: {
9
+ person_id: {
10
+ label: 'Person ID',
11
+ description: 'The ID used to uniquely identify a person in Customer.io. Any valid identifier is supported, such as ID, cio_id, email, etc. Anonymous users cannot be suppressed. [Learn more](https://customer.io/docs/identifying-people/#identifiers).',
12
+ type: 'string',
13
+ default: {
14
+ '@if': {
15
+ exists: { '@path': '$.userId' },
16
+ then: { '@path': '$.userId' },
17
+ else: { '@path': '$.traits.email' }
18
+ }
19
+ },
20
+ required: true
21
+ }
22
+ },
23
+ performBatch: (request, { payload: payloads, settings }) => {
24
+ return utils_1.sendBatch(request, payloads.map((payload) => ({
25
+ action: 'suppress',
26
+ payload,
27
+ settings,
28
+ type: 'person'
29
+ })));
30
+ },
31
+ perform: (request, { payload, settings }) => {
32
+ return utils_1.sendSingle(request, {
33
+ action: 'suppress',
34
+ payload,
35
+ settings,
36
+ type: 'person'
37
+ });
38
+ }
39
+ };
40
+ exports.default = action;
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/suppressPerson/index.ts"],"names":[],"mappings":";;AAGA,oCAAgD;AAEhD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE,6FAA6F;IAC1G,mBAAmB,EAAE,2BAA2B;IAChD,MAAM,EAAE;QACN,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,WAAW,EACT,4OAA4O;YAC9O,IAAI,EAAE,QAAQ;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,gBAAgB,EAAE;iBACpC;aACF;YACD,QAAQ,EAAE,IAAI;SACf;KACF;IAED,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE;QACzD,OAAO,iBAAS,CACd,OAAO,EACP,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACzB,MAAM,EAAE,UAAU;YAClB,OAAO;YACP,QAAQ;YACR,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC,CACJ,CAAA;IACH,CAAC;IAED,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC1C,OAAO,kBAAU,CAAC,OAAO,EAAE;YACzB,MAAM,EAAE,UAAU;YAClB,OAAO;YACP,QAAQ;YACR,IAAI,EAAE,QAAQ;SACf,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,6 @@
1
+ /// <reference types="lodash" />
2
+ import nock from 'nock';
3
+ import { AccountRegion } from './utils';
4
+ export declare const nockTrackInternalEndpoint: (region: AccountRegion) => nock.Scope;
5
+ export declare function getDefaultMappings(action: string): import("lodash").Dictionary<import("@segment/actions-core/src/destination-kit/types").FieldValue | undefined>;
6
+ export declare function testRunner(fn: Function): void;
@@ -0,0 +1,84 @@
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
+ exports.testRunner = exports.getDefaultMappings = exports.nockTrackInternalEndpoint = void 0;
7
+ const nock_1 = __importDefault(require("nock"));
8
+ const mapValues_1 = __importDefault(require("lodash/mapValues"));
9
+ const actions_core_1 = require("@segment/actions-core");
10
+ const index_1 = __importDefault(require("./index"));
11
+ const utils_1 = require("./utils");
12
+ const testDestination = actions_core_1.createTestIntegration(index_1.default);
13
+ var EndpointType;
14
+ (function (EndpointType) {
15
+ EndpointType["BATCH"] = "batch";
16
+ EndpointType["SINGLE"] = "entity";
17
+ })(EndpointType || (EndpointType = {}));
18
+ const endpointByType = {
19
+ [EndpointType.BATCH]: 'batch',
20
+ [EndpointType.SINGLE]: 'entity'
21
+ };
22
+ const trackServiceByRegion = {
23
+ [utils_1.AccountRegion.US]: nock_1.default('https://track.customer.io'),
24
+ [utils_1.AccountRegion.EU]: nock_1.default('https://track-eu.customer.io')
25
+ };
26
+ function wrapFn(fn, type, region) {
27
+ return () => {
28
+ const settings = {
29
+ siteId: '12345',
30
+ apiKey: 'abcde',
31
+ accountRegion: region
32
+ };
33
+ const action = async (name, args) => {
34
+ const actionFn = {
35
+ [EndpointType.BATCH]: testDestination.testBatchAction,
36
+ [EndpointType.SINGLE]: testDestination.testAction
37
+ }[type];
38
+ if (type === EndpointType.BATCH) {
39
+ args.events = [args.event];
40
+ }
41
+ const responses = (await actionFn?.call(testDestination, name, args));
42
+ if (!responses.length) {
43
+ if (type === EndpointType.BATCH) {
44
+ await testDestination.testAction(name, args);
45
+ }
46
+ throw new Error(`No responses received.`);
47
+ }
48
+ expect(responses.length).toBe(1);
49
+ expect(responses[0].status).toBe(200);
50
+ expect(responses[0].headers.toJSON()).toMatchObject({
51
+ 'content-type': 'application/json'
52
+ });
53
+ expect(responses[0].data).toMatchObject({});
54
+ if (type === EndpointType.BATCH) {
55
+ return responses[0].options.json.batch[0];
56
+ }
57
+ return responses[0].options.json;
58
+ };
59
+ return fn(settings, action);
60
+ };
61
+ }
62
+ const nockTrackInternalEndpoint = (region) => trackServiceByRegion[region];
63
+ exports.nockTrackInternalEndpoint = nockTrackInternalEndpoint;
64
+ function getDefaultMappings(action) {
65
+ const fields = testDestination.definition.actions[action].fields;
66
+ const defaultMappings = mapValues_1.default(fields, 'default');
67
+ return defaultMappings;
68
+ }
69
+ exports.getDefaultMappings = getDefaultMappings;
70
+ function testRunner(fn) {
71
+ describe.each(Object.values(endpointByType))(`when using %s requests`, (type) => {
72
+ describe.each(Object.values(utils_1.AccountRegion))(`when using the %s region`, (region) => {
73
+ beforeEach(() => {
74
+ trackServiceByRegion[region].post(`/api/v2/${type}`).reply(200, {});
75
+ });
76
+ afterEach(() => {
77
+ nock_1.default.cleanAll();
78
+ });
79
+ return wrapFn(fn, type, region)();
80
+ });
81
+ });
82
+ }
83
+ exports.testRunner = testRunner;
84
+ //# sourceMappingURL=test-helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-helper.js","sourceRoot":"","sources":["../../../src/destinations/customerio/test-helper.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,iEAAwC;AACxC,wDAAgF;AAChF,oDAAgC;AAEhC,mCAAuC;AAEvC,MAAM,eAAe,GAAG,oCAAqB,CAAC,eAAU,CAAC,CAAA;AAEzD,IAAK,YAGJ;AAHD,WAAK,YAAY;IACf,+BAAe,CAAA;IACf,iCAAiB,CAAA;AACnB,CAAC,EAHI,YAAY,KAAZ,YAAY,QAGhB;AACD,MAAM,cAAc,GAAG;IACrB,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,OAAO;IAC7B,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,QAAQ;CAChC,CAAA;AACD,MAAM,oBAAoB,GAAG;IAC3B,CAAC,qBAAa,CAAC,EAAE,CAAC,EAAE,cAAI,CAAC,2BAA2B,CAAC;IACrD,CAAC,qBAAa,CAAC,EAAE,CAAC,EAAE,cAAI,CAAC,8BAA8B,CAAC;CACzD,CAAA;AAED,SAAS,MAAM,CAAC,EAAY,EAAE,IAAY,EAAE,MAAqB;IAC/D,OAAO,GAAG,EAAE;QACV,MAAM,QAAQ,GAAa;YACzB,MAAM,EAAE,OAAO;YACf,MAAM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,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC;AAdD,gCAcC"}
@@ -0,0 +1,3 @@
1
+ export interface Payload {
2
+ person_id: string;
3
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/unsuppressPerson/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,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../utils");
4
+ const action = {
5
+ title: 'Unsuppress Person',
6
+ description: `Unsuppress a person in Customer.io. This will allow the person to receive messages again.`,
7
+ defaultSubscription: 'event = "User Unsuppressed"',
8
+ fields: {
9
+ person_id: {
10
+ label: 'Person ID',
11
+ description: 'The ID used to uniquely identify a person in Customer.io. Any valid identifier is supported, such as ID, cio_id, email, etc. Anonymous users cannot be unsuppressed. [Learn more](https://customer.io/docs/identifying-people/#identifiers).',
12
+ type: 'string',
13
+ default: {
14
+ '@if': {
15
+ exists: { '@path': '$.userId' },
16
+ then: { '@path': '$.userId' },
17
+ else: { '@path': '$.traits.email' }
18
+ }
19
+ },
20
+ required: true
21
+ }
22
+ },
23
+ performBatch: (request, { payload: payloads, settings }) => {
24
+ return utils_1.sendBatch(request, payloads.map((payload) => ({
25
+ action: 'unsuppress',
26
+ payload,
27
+ settings,
28
+ type: 'person'
29
+ })));
30
+ },
31
+ perform: (request, { payload, settings }) => {
32
+ return utils_1.sendSingle(request, {
33
+ action: 'unsuppress',
34
+ payload,
35
+ settings,
36
+ type: 'person'
37
+ });
38
+ }
39
+ };
40
+ exports.default = action;
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/unsuppressPerson/index.ts"],"names":[],"mappings":";;AAGA,oCAAgD;AAEhD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,mBAAmB;IAC1B,WAAW,EAAE,2FAA2F;IACxG,mBAAmB,EAAE,6BAA6B;IAClD,MAAM,EAAE;QACN,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,WAAW,EACT,8OAA8O;YAChP,IAAI,EAAE,QAAQ;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,gBAAgB,EAAE;iBACpC;aACF;YACD,QAAQ,EAAE,IAAI;SACf;KACF;IAED,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE;QACzD,OAAO,iBAAS,CACd,OAAO,EACP,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACzB,MAAM,EAAE,YAAY;YACpB,OAAO;YACP,QAAQ;YACR,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC,CACJ,CAAA;IACH,CAAC;IAED,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC1C,OAAO,kBAAU,CAAC,OAAO,EAAE;YACzB,MAAM,EAAE,YAAY;YACpB,OAAO;YACP,QAAQ;YACR,IAAI,EAAE,QAAQ;SACf,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { InputField } from '@segment/actions-core';
2
2
  import { RequestClient } from '@segment/actions-core';
3
- import { Logger, StatsClient, DataFeedCache } from '@segment/actions-core/destination-kit';
3
+ import { Logger, StatsClient } from '@segment/actions-core/destination-kit';
4
4
  import type { Settings } from '../generated-types';
5
5
  import { Profile } from '../Profile';
6
6
  export declare type ApiLookupConfig = {
@@ -13,9 +13,6 @@ export declare type ApiLookupConfig = {
13
13
  headers?: object | undefined;
14
14
  responseType: string;
15
15
  };
16
- export declare const getRequestId: ({ method, url, body, headers }: ApiLookupConfig) => string;
17
- export declare const getCachedResponse: ({ responseType }: ApiLookupConfig, requestId: string, dataFeedCache: DataFeedCache, datafeedTags: string[]) => Promise<any>;
18
- export declare const performApiLookup: (request: RequestClient, apiLookupConfig: ApiLookupConfig, profile: Profile, statsClient: StatsClient | undefined, tags: string[], settings: Settings, logger?: Logger | undefined, dataFeedCache?: DataFeedCache | undefined) => Promise<any>;
16
+ export declare const performApiLookup: (request: RequestClient, { id, url, method, body, headers }: ApiLookupConfig, profile: Profile, statsClient: StatsClient | undefined, tags: string[], settings: Settings, logger?: Logger | undefined) => Promise<unknown>;
19
17
  export declare const apiLookupActionFields: Record<string, InputField>;
20
18
  export declare const apiLookupLiquidKey = "lookups";
21
- export declare const FLAGON_NAME_DATA_FEEDS = "is-datafeeds-enabled";
@@ -1,125 +1,46 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FLAGON_NAME_DATA_FEEDS = exports.apiLookupLiquidKey = exports.apiLookupActionFields = exports.performApiLookup = exports.getCachedResponse = exports.getRequestId = void 0;
4
- const crypto_1 = require("crypto");
3
+ exports.apiLookupLiquidKey = exports.apiLookupActionFields = exports.performApiLookup = void 0;
5
4
  const actions_core_1 = require("@segment/actions-core");
6
5
  const liquidjs_1 = require("liquidjs");
7
6
  const Liquid = new liquidjs_1.Liquid();
8
- const maxResponseSizeBytes = 1000000;
9
- const renderLiquidFields = async ({ id, url, body }, profile, datafeedTags, settings, logger) => {
7
+ const performApiLookup = async (request, { id, url, method, body, headers }, profile, statsClient, tags, settings, logger) => {
10
8
  let renderedUrl;
11
9
  let renderedBody;
12
10
  try {
13
11
  renderedUrl = await Liquid.parseAndRender(url, { profile });
14
12
  }
15
13
  catch (error) {
16
- logger?.error(`TE Messaging: Email datafeed url parse failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
17
- datafeedTags.push('error:true', `error_message:${error?.message}`, 'reason:rendering_failure', 'rendering:url');
14
+ logger?.error(`TE Messaging: Email api lookup url parse failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
15
+ tags.push('reason:parse_apilookup_url');
16
+ statsClient?.incr('actions-personas-messaging-sendgrid-error', 1, tags);
18
17
  throw new actions_core_1.IntegrationError('Unable to parse email api lookup url', 'api lookup url parse failure', 400);
19
18
  }
20
19
  try {
21
20
  renderedBody = body ? await Liquid.parseAndRender(body, { profile }) : undefined;
22
21
  }
23
22
  catch (error) {
24
- logger?.error(`TE Messaging: Email datafeed body parse failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
25
- datafeedTags.push('error:true', `error_message:${error?.message}`, 'reason:rendering_failure', 'rendering:body');
23
+ logger?.error(`TE Messaging: Email api lookup body parse failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
24
+ tags.push('reason:parse_apilookup_body');
25
+ statsClient?.incr('actions-personas-messaging-sendgrid-error', 1, tags);
26
26
  throw new actions_core_1.IntegrationError('Unable to parse email api lookup body', 'api lookup body parse failure', 400);
27
27
  }
28
- return {
29
- renderedUrl,
30
- renderedBody
31
- };
32
- };
33
- const getRequestId = ({ method, url, body, headers }) => {
34
- const requestHash = crypto_1.createHash('sha256');
35
- requestHash.update(`${method}${url}${body}${JSON.stringify(headers)}`);
36
- const requestId = requestHash.digest('hex');
37
- return requestId;
38
- };
39
- exports.getRequestId = getRequestId;
40
- const getCachedResponse = async ({ responseType }, requestId, dataFeedCache, datafeedTags) => {
41
- const cachedResponse = await dataFeedCache?.getRequestResponse(requestId);
42
- if (!cachedResponse) {
43
- datafeedTags.push('cache_hit:false');
44
- return;
45
- }
46
- datafeedTags.push('cache_hit:true');
47
- if (responseType === 'json') {
48
- return JSON.parse(cachedResponse);
49
- }
50
- return cachedResponse;
51
- };
52
- exports.getCachedResponse = getCachedResponse;
53
- const performApiLookup = async (request, apiLookupConfig, profile, statsClient, tags, settings, logger, dataFeedCache) => {
54
- const { id, method, headers, cacheTtl, name } = apiLookupConfig;
55
- const datafeedTags = [
56
- ...tags,
57
- `datafeed_id:${id}`,
58
- `datafeed_name:${name}`,
59
- `space_id:${settings.spaceId}`,
60
- `cache_ttl_greater_than_0:${cacheTtl > 0}`
61
- ];
62
28
  try {
63
- const { renderedUrl, renderedBody } = await renderLiquidFields(apiLookupConfig, profile, datafeedTags, settings, logger);
64
- const requestId = exports.getRequestId({ ...apiLookupConfig, url: renderedUrl, body: renderedBody });
65
- if (cacheTtl > 0 && dataFeedCache) {
66
- const cachedResponse = await exports.getCachedResponse(apiLookupConfig, requestId, dataFeedCache, datafeedTags);
67
- if (cachedResponse) {
68
- datafeedTags.push('error:false');
69
- return cachedResponse;
70
- }
71
- }
72
- let data;
73
- try {
74
- const res = await request(renderedUrl, {
75
- headers: headers ?? undefined,
76
- timeout: 3000,
77
- method: method,
78
- body: renderedBody,
79
- skipResponseCloning: true
80
- });
81
- data = await res.data;
82
- }
83
- catch (error) {
84
- const respError = error.response;
85
- logger?.error(`TE Messaging: Email api lookup failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
86
- datafeedTags.push(`error:true`, `error_message:${error.message}`, `error_status:${respError?.status}`, 'reason:api_call_failure');
87
- throw error;
88
- }
89
- const dataString = JSON.stringify(data);
90
- const size = Buffer.byteLength(dataString, 'utf-8');
91
- datafeedTags.push(`response_size_greater_than_mb:${size > maxResponseSizeBytes}`);
92
- if (cacheTtl > 0) {
93
- if (size <= maxResponseSizeBytes) {
94
- try {
95
- await dataFeedCache?.setRequestResponse(requestId, dataString, cacheTtl / 1000);
96
- datafeedTags.push('cache_set:true');
97
- }
98
- catch (err) {
99
- logger?.error(`TE Messaging: Email api lookup cache set failure - api lookup id: ${id} - ${settings.spaceId} - [${err}]`);
100
- datafeedTags.push('cache_set:false');
101
- datafeedTags.push('error:true', 'reason:cache_set_failure', `error_message:${err?.message}`);
102
- throw err;
103
- }
104
- }
105
- else {
106
- datafeedTags.push('cache_set:false');
107
- }
108
- }
109
- return data;
29
+ const res = await request(renderedUrl, {
30
+ headers: headers ?? undefined,
31
+ timeout: 10000,
32
+ method: method,
33
+ body: renderedBody,
34
+ skipResponseCloning: true
35
+ });
36
+ return res.data;
110
37
  }
111
38
  catch (error) {
112
- const isErrorCapturedInTags = datafeedTags.find((str) => str.includes('error:true'));
113
- if (!isErrorCapturedInTags) {
114
- datafeedTags.push('error:true', `error_message:${error?.message}`, 'reason:unknown');
115
- }
116
- tags.push('reason:datafeed_failure');
117
39
  logger?.error(`TE Messaging: Email api lookup failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
40
+ tags.push('reason:apilookup_failure');
41
+ statsClient?.incr('actions-personas-messaging-sendgrid-error', 1, tags);
118
42
  throw error;
119
43
  }
120
- finally {
121
- statsClient?.incr('datafeed-execution', 1, datafeedTags);
122
- }
123
44
  };
124
45
  exports.performApiLookup = performApiLookup;
125
46
  exports.apiLookupActionFields = {
@@ -170,5 +91,4 @@ exports.apiLookupActionFields = {
170
91
  }
171
92
  };
172
93
  exports.apiLookupLiquidKey = 'lookups';
173
- exports.FLAGON_NAME_DATA_FEEDS = 'is-datafeeds-enabled';
174
94
  //# sourceMappingURL=api-lookups.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-lookups.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/sendgrid/previewApiLookup/api-lookups.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,wDAAwD;AAKxD,uCAA6C;AAI7C,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AAE7B,MAAM,oBAAoB,GAAG,OAAO,CAAA;AAcpC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AAG,sBAAsB,CAAA"}
1
+ {"version":3,"file":"api-lookups.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/sendgrid/previewApiLookup/api-lookups.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AAKxD,uCAA6C;AAG7C,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AActB,MAAM,gBAAgB,GAAG,KAAK,EACnC,OAAsB,EACtB,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAmB,EACnD,OAAgB,EAChB,WAAoC,EACpC,IAAc,EACd,QAAkB,EAClB,MAA2B,EAC3B,EAAE;IACF,IAAI,WAAmB,CAAA;IACvB,IAAI,YAAgC,CAAA;IACpC,IAAI;QACF,WAAW,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;KAC5D;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,EAAE,KAAK,CACX,qEAAqE,EAAE,MAAM,QAAQ,CAAC,OAAO,OAAO,KAAK,GAAG,CAC7G,CAAA;QACD,IAAI,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAA;QACvC,WAAW,EAAE,IAAI,CAAC,2CAA2C,EAAE,CAAC,EAAE,IAAI,CAAC,CAAA;QACvE,MAAM,IAAI,+BAAgB,CAAC,sCAAsC,EAAE,8BAA8B,EAAE,GAAG,CAAC,CAAA;KACxG;IACD,IAAI;QACF,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;KACjF;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,EAAE,KAAK,CACX,sEAAsE,EAAE,MAAM,QAAQ,CAAC,OAAO,OAAO,KAAK,GAAG,CAC9G,CAAA;QACD,IAAI,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAA;QACxC,WAAW,EA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AQ,EAAE;QACR,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,qBAAqB;QAClC,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,IAAI;KACf;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,uDAAuD;QACpE,IAAI,EAAE,QAAQ;KACf;IACD,OAAO,EAAE;QACP,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,6CAA6C;QAC1D,IAAI,EAAE,QAAQ;KACf;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,mEAAmE;QAChF,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;KACf;CACF,CAAA;AAEY,QAAA,kBAAkB,GAAG,SAAS,CAAA"}
@@ -1,12 +1,12 @@
1
1
  import { ContextFromDecorator } from './operationTracking';
2
2
  export declare const track: ((decoratorArgs?: ({
3
+ shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
4
+ } & {
3
5
  onError?: ((ctx: import("./operationTracking").OperationErrorHandlerContext<import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>>) => void) | undefined;
4
6
  } & {
5
7
  onTry?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
6
8
  onFinally?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
7
9
  } & import("./operationTracking").OperationLoggerDecoratorArgs & {
8
- shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
9
- } & {
10
10
  wrapIntegrationError?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => import("@segment/actions-core/*").IntegrationError | [message: string, code: string, status: number]) | undefined;
11
11
  }) | undefined) => import("./operationTracking").GenericMethodDecorator<(this: any, ...args: any[]) => any>) & {
12
12
  getCurrentOperation(classInstance: any): (import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & {
@@ -15,6 +15,14 @@ export declare const track: ((decoratorArgs?: ({
15
15
  }) | undefined;
16
16
  } & {
17
17
  _contextType: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & {
18
+ tags: string[];
19
+ sharedContext: {
20
+ tags: string[];
21
+ };
22
+ decoratorArgs?: {
23
+ shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
24
+ } | undefined;
25
+ } & {
18
26
  decoratorArgs?: {
19
27
  onError?: ((ctx: import("./operationTracking").OperationErrorHandlerContext<import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>>) => void) | undefined;
20
28
  } | undefined;
@@ -35,14 +43,6 @@ export declare const track: ((decoratorArgs?: ({
35
43
  logMetadata?: Record<string, unknown> | undefined;
36
44
  decoratorArgs?: import("./operationTracking").OperationLoggerDecoratorArgs | undefined;
37
45
  sharedContext: import("./operationTracking").OperationLoggerSharedContext;
38
- } & {
39
- tags: string[];
40
- sharedContext: {
41
- tags: string[];
42
- };
43
- decoratorArgs?: {
44
- shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
45
- } | undefined;
46
46
  } & {
47
47
  decoratorArgs?: {
48
48
  wrapIntegrationError?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => import("@segment/actions-core/*").IntegrationError | [message: string, code: string, status: number]) | undefined;
@@ -0,0 +1,4 @@
1
+ export interface Payload {
2
+ email?: string;
3
+ list_id?: string;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/removeProfileToList/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 { Payload } from './generated-types';
4
+ declare const action: ActionDefinition<Settings, Payload>;
5
+ export default action;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const actions_core_1 = require("@segment/actions-core");
4
+ const functions_1 = require("../functions");
5
+ const properties_1 = require("../properties");
6
+ const action = {
7
+ title: 'Remove profile from list',
8
+ description: 'Remove profile from list',
9
+ fields: {
10
+ email: { ...properties_1.email },
11
+ list_id: { ...properties_1.external_id }
12
+ },
13
+ perform: async (request, { payload }) => {
14
+ const { email, list_id } = payload;
15
+ if (!email || !list_id) {
16
+ throw new actions_core_1.IntegrationError("Insert the ID of the default list that you'd like to subscribe users", 'Missing required fields', 400);
17
+ }
18
+ try {
19
+ const profileData = await functions_1.getProfile(request, email);
20
+ const v = JSON.parse(profileData.content);
21
+ if (Object.keys(v).length !== 0) {
22
+ console.log(v);
23
+ const listData = {
24
+ data: [
25
+ {
26
+ type: 'profile',
27
+ id: v.data[0].id
28
+ }
29
+ ]
30
+ };
31
+ const list = await functions_1.executeProfileList(request, 'DELETE', listData, list_id);
32
+ return list;
33
+ }
34
+ return;
35
+ }
36
+ catch (error) {
37
+ console.log(error);
38
+ throw new Error('An error occurred while processing the request');
39
+ }
40
+ }
41
+ };
42
+ exports.default = action;
43
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/removeProfileToList/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAK1E,4CAA6D;AAC7D,8CAAkD;AAElD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,0BAA0B;IACjC,WAAW,EAAE,0BAA0B;IACvC,MAAM,EAAE;QACN,KAAK,EAAE,EAAE,GAAG,kBAAK,EAAE;QACnB,OAAO,EAAE,EAAE,GAAG,wBAAW,EAAE;KAC5B;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACtC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAA;QAClC,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,EAAE;YACtB,MAAM,IAAI,+BAAgB,CACxB,sEAAsE,EACtE,yBAAyB,EACzB,GAAG,CACJ,CAAA;SACF;QACD,IAAI;YACF,MAAM,WAAW,GAA2B,MAAM,sBAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;YAC5E,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;YACzC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC/B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;gBACd,MAAM,QAAQ,GAAa;oBACzB,IAAI,EAAE;wBACJ;4BACE,IAAI,EAAE,SAAS;4BACf,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;yBACjB;qBACF;iBACF,CAAA;gBAED,MAAM,IAAI,GAAG,MAAM,8BAAkB,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;gBAC3E,OAAO,IAAI,CAAA;aACZ;YACD,OAAM;SACP;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;YAClB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAA;SAClE;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,13 @@
1
+ export declare enum ApiRegions {
2
+ US = "US \uD83C\uDDFA\uD83C\uDDF8",
3
+ EU = "EU \uD83C\uDDEA\uD83C\uDDFA"
4
+ }
5
+ export declare enum StrictMode {
6
+ ON = "1",
7
+ OFF = "0"
8
+ }
9
+ export declare function getConcatenatedName(firstName: unknown, lastName: unknown, name: unknown): unknown;
10
+ export declare function getApiServerUrl(apiRegion: string | undefined): "https://api-eu.mixpanel.com" | "https://api.mixpanel.com";
11
+ export declare function getBrowser(userAgent: string): string;
12
+ export declare function getBrowserVersion(userAgent: string): string | undefined;
13
+ export declare function cheapGuid(maxlen?: number): string;