@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.
- package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.d.ts +1 -0
- package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.js +184 -0
- package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.js.map +1 -0
- package/dist/destinations/customerio/deleteObject/generated-types.d.ts +4 -0
- package/dist/destinations/customerio/deleteObject/generated-types.js +3 -0
- package/dist/destinations/customerio/deleteObject/generated-types.js.map +1 -0
- package/dist/destinations/customerio/deleteObject/index.d.ts +5 -0
- package/dist/destinations/customerio/deleteObject/index.js +48 -0
- package/dist/destinations/customerio/deleteObject/index.js.map +1 -0
- package/dist/destinations/customerio/deletePerson/generated-types.d.ts +3 -0
- package/dist/destinations/customerio/deletePerson/generated-types.js +3 -0
- package/dist/destinations/customerio/deletePerson/generated-types.js.map +1 -0
- package/dist/destinations/customerio/deletePerson/index.d.ts +5 -0
- package/dist/destinations/customerio/deletePerson/index.js +41 -0
- package/dist/destinations/customerio/deletePerson/index.js.map +1 -0
- package/dist/destinations/customerio/deleteRelationship/generated-types.d.ts +6 -0
- package/dist/destinations/customerio/deleteRelationship/generated-types.js +3 -0
- package/dist/destinations/customerio/deleteRelationship/generated-types.js.map +1 -0
- package/dist/destinations/customerio/deleteRelationship/index.d.ts +5 -0
- package/dist/destinations/customerio/deleteRelationship/index.js +82 -0
- package/dist/destinations/customerio/deleteRelationship/index.js.map +1 -0
- package/dist/destinations/customerio/reportDeliveryEvent/generated-types.d.ts +10 -0
- package/dist/destinations/customerio/reportDeliveryEvent/generated-types.js +3 -0
- package/dist/destinations/customerio/reportDeliveryEvent/generated-types.js.map +1 -0
- package/dist/destinations/customerio/reportDeliveryEvent/index.d.ts +5 -0
- package/dist/destinations/customerio/reportDeliveryEvent/index.js +121 -0
- package/dist/destinations/customerio/reportDeliveryEvent/index.js.map +1 -0
- package/dist/destinations/customerio/suppressPerson/generated-types.d.ts +3 -0
- package/dist/destinations/customerio/suppressPerson/generated-types.js +3 -0
- package/dist/destinations/customerio/suppressPerson/generated-types.js.map +1 -0
- package/dist/destinations/customerio/suppressPerson/index.d.ts +5 -0
- package/dist/destinations/customerio/suppressPerson/index.js +41 -0
- package/dist/destinations/customerio/suppressPerson/index.js.map +1 -0
- package/dist/destinations/customerio/test-helper.d.ts +6 -0
- package/dist/destinations/customerio/test-helper.js +84 -0
- package/dist/destinations/customerio/test-helper.js.map +1 -0
- package/dist/destinations/customerio/unsuppressPerson/generated-types.d.ts +3 -0
- package/dist/destinations/customerio/unsuppressPerson/generated-types.js +3 -0
- package/dist/destinations/customerio/unsuppressPerson/generated-types.js.map +1 -0
- package/dist/destinations/customerio/unsuppressPerson/index.d.ts +5 -0
- package/dist/destinations/customerio/unsuppressPerson/index.js +41 -0
- package/dist/destinations/customerio/unsuppressPerson/index.js.map +1 -0
- package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.d.ts +2 -5
- package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js +18 -98
- package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js.map +1 -1
- package/dist/destinations/engage/utils/track.d.ts +10 -10
- package/dist/destinations/klaviyo/removeProfileToList/generated-types.d.ts +4 -0
- package/dist/destinations/klaviyo/removeProfileToList/generated-types.js +3 -0
- package/dist/destinations/klaviyo/removeProfileToList/generated-types.js.map +1 -0
- package/dist/destinations/klaviyo/removeProfileToList/index.d.ts +5 -0
- package/dist/destinations/klaviyo/removeProfileToList/index.js +43 -0
- package/dist/destinations/klaviyo/removeProfileToList/index.js.map +1 -0
- package/dist/destinations/mixpanel/utils.d.ts +13 -0
- package/dist/destinations/mixpanel/utils.js +117 -0
- package/dist/destinations/mixpanel/utils.js.map +1 -0
- package/dist/destinations/movable-ink/categoryView/generated-types.d.ts +22 -0
- package/dist/destinations/movable-ink/categoryView/generated-types.js +3 -0
- package/dist/destinations/movable-ink/categoryView/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/categoryView/index.d.ts +5 -0
- package/dist/destinations/movable-ink/categoryView/index.js +43 -0
- package/dist/destinations/movable-ink/categoryView/index.js.map +1 -0
- package/dist/destinations/movable-ink/conversion/generated-types.d.ts +20 -0
- package/dist/destinations/movable-ink/conversion/generated-types.js +3 -0
- package/dist/destinations/movable-ink/conversion/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/conversion/index.d.ts +5 -0
- package/dist/destinations/movable-ink/conversion/index.js +45 -0
- package/dist/destinations/movable-ink/conversion/index.js.map +1 -0
- package/dist/destinations/movable-ink/fields.d.ts +21 -0
- package/dist/destinations/movable-ink/fields.js +236 -0
- package/dist/destinations/movable-ink/fields.js.map +1 -0
- package/dist/destinations/movable-ink/identify/generated-types.d.ts +7 -0
- package/dist/destinations/movable-ink/identify/generated-types.js +3 -0
- package/dist/destinations/movable-ink/identify/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/identify/index.d.ts +5 -0
- package/dist/destinations/movable-ink/identify/index.js +32 -0
- package/dist/destinations/movable-ink/identify/index.js.map +1 -0
- package/dist/destinations/movable-ink/productAdded/generated-types.d.ts +22 -0
- package/dist/destinations/movable-ink/productAdded/generated-types.js +3 -0
- package/dist/destinations/movable-ink/productAdded/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/productAdded/index.d.ts +5 -0
- package/dist/destinations/movable-ink/productAdded/index.js +43 -0
- package/dist/destinations/movable-ink/productAdded/index.js.map +1 -0
- package/dist/destinations/movable-ink/productViewed/generated-types.d.ts +21 -0
- package/dist/destinations/movable-ink/productViewed/generated-types.js +3 -0
- package/dist/destinations/movable-ink/productViewed/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/productViewed/index.d.ts +5 -0
- package/dist/destinations/movable-ink/productViewed/index.js +43 -0
- package/dist/destinations/movable-ink/productViewed/index.js.map +1 -0
- package/dist/destinations/movable-ink/search/generated-types.d.ts +12 -0
- package/dist/destinations/movable-ink/search/generated-types.js +3 -0
- package/dist/destinations/movable-ink/search/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/search/index.d.ts +5 -0
- package/dist/destinations/movable-ink/search/index.js +43 -0
- package/dist/destinations/movable-ink/search/index.js.map +1 -0
- package/dist/destinations/movable-ink/sendCustomEvent/generated-types.d.ts +25 -0
- package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js +3 -0
- package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/sendCustomEvent/index.d.ts +5 -0
- package/dist/destinations/movable-ink/sendCustomEvent/index.js +48 -0
- package/dist/destinations/movable-ink/sendCustomEvent/index.js.map +1 -0
- package/dist/destinations/segment/segment-properties.d.ts +1 -0
- package/dist/destinations/segment/segment-properties.js +7 -1
- package/dist/destinations/segment/segment-properties.js.map +1 -1
- package/dist/destinations/segment/sendGroup/generated-types.d.ts +1 -0
- package/dist/destinations/segment/sendGroup/index.js +39 -25
- package/dist/destinations/segment/sendGroup/index.js.map +1 -1
- package/dist/destinations/segment/sendIdentify/generated-types.d.ts +1 -0
- package/dist/destinations/segment/sendIdentify/index.js +39 -25
- package/dist/destinations/segment/sendIdentify/index.js.map +1 -1
- package/dist/destinations/segment/sendPage/generated-types.d.ts +1 -0
- package/dist/destinations/segment/sendPage/index.js +47 -33
- package/dist/destinations/segment/sendPage/index.js.map +1 -1
- package/dist/destinations/segment/sendScreen/generated-types.d.ts +1 -0
- package/dist/destinations/segment/sendScreen/index.js +40 -26
- package/dist/destinations/segment/sendScreen/index.js.map +1 -1
- package/dist/destinations/segment/sendTrack/generated-types.d.ts +1 -0
- package/dist/destinations/segment/sendTrack/index.js +43 -29
- package/dist/destinations/segment/sendTrack/index.js.map +1 -1
- package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.d.ts +1 -0
- package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.js +381 -0
- package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.js.map +1 -0
- package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.d.ts +1 -0
- package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.js +499 -0
- package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.js.map +1 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.d.ts +4 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.js +97 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.js.map +1 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v3.d.ts +8 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v3.js +126 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v3.js.map +1 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/utils.d.ts +13 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/utils.js +40 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/utils.js.map +1 -0
- package/dist/destinations/trackey/group.types.d.ts +11 -0
- package/dist/destinations/trackey/group.types.js +3 -0
- package/dist/destinations/trackey/group.types.js.map +1 -0
- package/dist/destinations/trackey/identify.types.d.ts +11 -0
- package/dist/destinations/trackey/identify.types.js +3 -0
- package/dist/destinations/trackey/identify.types.js.map +1 -0
- package/dist/destinations/trackey/track.types.d.ts +12 -0
- package/dist/destinations/trackey/track.types.js +3 -0
- package/dist/destinations/trackey/track.types.js.map +1 -0
- 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,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xB,CAAC;AALD,gDAKC;AAED,SAAgB,UAAU,CAAC,EAAY;IACrC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,wBAAwB,EAAE,CAAC,IAAI,EAAE,EAAE;QAC9E,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,qBAAa,CAAC,CAAC,CAAC,0BAA0B,EAAE,CAAC,MAAM,EAAE,EAAE;YACjF,UAAU,CAAC,GAAG,EAAE;gBACd,oBAAoB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;YACrE,CAAC,CAAC,CAAA;YAEF,SAAS,CAAC,GAAG,EAAE;gBACb,cAAI,CAAC,QAAQ,EAAE,CAAA;YACjB,CAAC,CAAC,CAAA;YAEF,OAAO,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,CAAA;QACnC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC;AAdD,gCAcC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/unsuppressPerson/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -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
|
|
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
|
|
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.
|
|
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
|
|
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
|
|
17
|
-
|
|
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
|
|
25
|
-
|
|
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
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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,
|
|
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,EAAE,IAAI,CAAC,2CAA2C,EAAE,CAAC,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ClB,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 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/removeProfileToList/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -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":["../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,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;
|