@segment/action-destinations 3.148.1-add-synchronization-support.4 → 3.148.1-optimizely-lrucache.13
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/customerio/createUpdateObject/index.js +6 -1
- package/dist/destinations/customerio/createUpdateObject/index.js.map +1 -1
- package/dist/destinations/customerio/createUpdatePerson/index.js +8 -1
- package/dist/destinations/customerio/createUpdatePerson/index.js.map +1 -1
- package/dist/destinations/hubspot/index.js +0 -1
- package/dist/destinations/hubspot/index.js.map +1 -1
- package/dist/destinations/index.js +1 -0
- package/dist/destinations/index.js.map +1 -1
- package/dist/destinations/insider/cartViewedEvent/generated-types.d.ts +44 -0
- package/dist/destinations/insider/cartViewedEvent/generated-types.js +3 -0
- package/dist/destinations/insider/cartViewedEvent/generated-types.js.map +1 -0
- package/dist/destinations/insider/cartViewedEvent/index.d.ts +5 -0
- package/dist/destinations/insider/cartViewedEvent/index.js +27 -0
- package/dist/destinations/insider/cartViewedEvent/index.js.map +1 -0
- package/dist/destinations/insider/checkoutEvent/generated-types.d.ts +44 -0
- package/dist/destinations/insider/checkoutEvent/generated-types.js +3 -0
- package/dist/destinations/insider/checkoutEvent/generated-types.js.map +1 -0
- package/dist/destinations/insider/checkoutEvent/index.d.ts +5 -0
- package/dist/destinations/insider/checkoutEvent/index.js +27 -0
- package/dist/destinations/insider/checkoutEvent/index.js.map +1 -0
- package/dist/destinations/insider/generated-types.d.ts +4 -0
- package/dist/destinations/insider/generated-types.js +3 -0
- package/dist/destinations/insider/generated-types.js.map +1 -0
- package/dist/destinations/insider/index.d.ts +4 -0
- package/dist/destinations/insider/index.js +66 -0
- package/dist/destinations/insider/index.js.map +1 -0
- package/dist/destinations/insider/insider-helpers.d.ts +57 -0
- package/dist/destinations/insider/insider-helpers.js +153 -0
- package/dist/destinations/insider/insider-helpers.js.map +1 -0
- package/dist/destinations/insider/insider-properties.d.ts +13 -0
- package/dist/destinations/insider/insider-properties.js +456 -0
- package/dist/destinations/insider/insider-properties.js.map +1 -0
- package/dist/destinations/insider/orderCompletedEvent/generated-types.d.ts +44 -0
- package/dist/destinations/insider/orderCompletedEvent/generated-types.js +3 -0
- package/dist/destinations/insider/orderCompletedEvent/generated-types.js.map +1 -0
- package/dist/destinations/insider/orderCompletedEvent/index.d.ts +5 -0
- package/dist/destinations/insider/orderCompletedEvent/index.js +27 -0
- package/dist/destinations/insider/orderCompletedEvent/index.js.map +1 -0
- package/dist/destinations/insider/productAddedEvent/generated-types.d.ts +41 -0
- package/dist/destinations/insider/productAddedEvent/generated-types.js +3 -0
- package/dist/destinations/insider/productAddedEvent/generated-types.js.map +1 -0
- package/dist/destinations/insider/productAddedEvent/index.d.ts +5 -0
- package/dist/destinations/insider/productAddedEvent/index.js +39 -0
- package/dist/destinations/insider/productAddedEvent/index.js.map +1 -0
- package/dist/destinations/insider/productListViewedEvent/generated-types.d.ts +34 -0
- package/dist/destinations/insider/productListViewedEvent/generated-types.js +3 -0
- package/dist/destinations/insider/productListViewedEvent/generated-types.js.map +1 -0
- package/dist/destinations/insider/productListViewedEvent/index.d.ts +5 -0
- package/dist/destinations/insider/productListViewedEvent/index.js +26 -0
- package/dist/destinations/insider/productListViewedEvent/index.js.map +1 -0
- package/dist/destinations/insider/productRemovedEvent/generated-types.d.ts +41 -0
- package/dist/destinations/insider/productRemovedEvent/generated-types.js +3 -0
- package/dist/destinations/insider/productRemovedEvent/generated-types.js.map +1 -0
- package/dist/destinations/insider/productRemovedEvent/index.d.ts +5 -0
- package/dist/destinations/insider/productRemovedEvent/index.js +39 -0
- package/dist/destinations/insider/productRemovedEvent/index.js.map +1 -0
- package/dist/destinations/insider/productViewedEvent/generated-types.d.ts +41 -0
- package/dist/destinations/insider/productViewedEvent/generated-types.js +3 -0
- package/dist/destinations/insider/productViewedEvent/generated-types.js.map +1 -0
- package/dist/destinations/insider/productViewedEvent/index.d.ts +5 -0
- package/dist/destinations/insider/productViewedEvent/index.js +39 -0
- package/dist/destinations/insider/productViewedEvent/index.js.map +1 -0
- package/dist/destinations/insider/trackEvent/generated-types.d.ts +56 -0
- package/dist/destinations/insider/trackEvent/generated-types.js +3 -0
- package/dist/destinations/insider/trackEvent/generated-types.js.map +1 -0
- package/dist/destinations/insider/trackEvent/index.d.ts +5 -0
- package/dist/destinations/insider/trackEvent/index.js +28 -0
- package/dist/destinations/insider/trackEvent/index.js.map +1 -0
- package/dist/destinations/insider/updateUserProfile/generated-types.d.ts +19 -0
- package/dist/destinations/insider/updateUserProfile/generated-types.js +3 -0
- package/dist/destinations/insider/updateUserProfile/generated-types.js.map +1 -0
- package/dist/destinations/insider/updateUserProfile/index.d.ts +5 -0
- package/dist/destinations/insider/updateUserProfile/index.js +141 -0
- package/dist/destinations/insider/updateUserProfile/index.js.map +1 -0
- package/dist/destinations/insider/userRegisteredEvent/generated-types.d.ts +28 -0
- package/dist/destinations/insider/userRegisteredEvent/generated-types.js +3 -0
- package/dist/destinations/insider/userRegisteredEvent/generated-types.js.map +1 -0
- package/dist/destinations/insider/userRegisteredEvent/index.d.ts +5 -0
- package/dist/destinations/insider/userRegisteredEvent/index.js +25 -0
- package/dist/destinations/insider/userRegisteredEvent/index.js.map +1 -0
- package/dist/destinations/insider-audiences/generated-types.d.ts +4 -0
- package/dist/destinations/insider-audiences/generated-types.js +3 -0
- package/dist/destinations/insider-audiences/generated-types.js.map +1 -0
- package/dist/destinations/insider-audiences/index.d.ts +4 -0
- package/dist/destinations/insider-audiences/index.js +47 -0
- package/dist/destinations/insider-audiences/index.js.map +1 -0
- package/dist/destinations/insider-audiences/insider-helpers.d.ts +6 -0
- package/dist/destinations/insider-audiences/insider-helpers.js +179 -0
- package/dist/destinations/insider-audiences/insider-helpers.js.map +1 -0
- package/dist/destinations/insider-audiences/insiderAudiences/generated-types.d.ts +14 -0
- package/dist/destinations/insider-audiences/insiderAudiences/generated-types.js +3 -0
- package/dist/destinations/insider-audiences/insiderAudiences/generated-types.js.map +1 -0
- package/dist/destinations/insider-audiences/insiderAudiences/index.d.ts +5 -0
- package/dist/destinations/insider-audiences/insiderAudiences/index.js +123 -0
- package/dist/destinations/insider-audiences/insiderAudiences/index.js.map +1 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/generated-types.d.ts +6 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/generated-types.js +3 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/generated-types.js.map +1 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/index.d.ts +4 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/index.js +67 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/index.js.map +1 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/trackEvent/dataFile.d.ts +81 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/trackEvent/dataFile.js +126 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/trackEvent/dataFile.js.map +1 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/trackEvent/functions.d.ts +19 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/trackEvent/functions.js +115 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/trackEvent/functions.js.map +1 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/trackEvent/generated-types.d.ts +14 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/trackEvent/generated-types.js +3 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/trackEvent/generated-types.js.map +1 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/trackEvent/index.d.ts +5 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/trackEvent/index.js +150 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/trackEvent/index.js.map +1 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/types.d.ts +44 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/types.js +3 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/types.js.map +1 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/utils.d.ts +5 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/utils.js +10 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/utils.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/insider/userRegisteredEvent/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const insider_properties_1 = require("../insider-properties");
|
|
4
|
+
const insider_helpers_1 = require("../insider-helpers");
|
|
5
|
+
const action = {
|
|
6
|
+
title: 'User Registered Event',
|
|
7
|
+
description: 'Record User Registered Event to Insider',
|
|
8
|
+
defaultSubscription: 'type = "track" and event = "User Registered"',
|
|
9
|
+
fields: {
|
|
10
|
+
email_as_identifier: { ...insider_properties_1.email_as_identifier },
|
|
11
|
+
phone_number_as_identifier: { ...insider_properties_1.phone_number_as_identifier },
|
|
12
|
+
uuid: { ...insider_properties_1.uuid },
|
|
13
|
+
segment_anonymous_id: { ...insider_properties_1.segment_anonymous_id },
|
|
14
|
+
timestamp: { ...insider_properties_1.timestamp },
|
|
15
|
+
attributes: { ...insider_properties_1.user_attributes }
|
|
16
|
+
},
|
|
17
|
+
perform: (request, data) => {
|
|
18
|
+
return request(`${insider_helpers_1.API_BASE}${insider_helpers_1.UPSERT_ENDPOINT}`, {
|
|
19
|
+
method: 'post',
|
|
20
|
+
json: insider_helpers_1.sendTrackEvent(data.payload, 'sign_up_confirmation')
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.default = action;
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/insider/userRegisteredEvent/index.ts"],"names":[],"mappings":";;AAGA,8DAO8B;AAC9B,wDAA8E;AAE9E,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,uBAAuB;IAC9B,WAAW,EAAE,yCAAyC;IACtD,mBAAmB,EAAE,8CAA8C;IACnE,MAAM,EAAE;QACN,mBAAmB,EAAE,EAAE,GAAG,wCAAmB,EAAE;QAC/C,0BAA0B,EAAE,EAAE,GAAG,+CAA0B,EAAE;QAC7D,IAAI,EAAE,EAAE,GAAG,yBAAI,EAAE;QACjB,oBAAoB,EAAE,EAAE,GAAG,yCAAoB,EAAE;QACjD,SAAS,EAAE,EAAE,GAAG,8BAAS,EAAE;QAC3B,UAAU,EAAE,EAAE,GAAG,oCAAe,EAAE;KACnC;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE;QACzB,OAAO,OAAO,CAAC,GAAG,0BAAQ,GAAG,iCAAe,EAAE,EAAE;YAC9C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,gCAAc,CAAC,IAAI,CAAC,OAAO,EAAE,sBAAsB,CAAC;SAC3D,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/insider-audiences/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
7
|
+
const insiderAudiences_1 = __importDefault(require("./insiderAudiences"));
|
|
8
|
+
const destination = {
|
|
9
|
+
name: 'Insider Audiences',
|
|
10
|
+
slug: 'actions-insider-audiences',
|
|
11
|
+
mode: 'cloud',
|
|
12
|
+
authentication: {
|
|
13
|
+
scheme: 'custom',
|
|
14
|
+
fields: {
|
|
15
|
+
account_name: {
|
|
16
|
+
label: 'Account Name',
|
|
17
|
+
description: 'You can get your Account Name via Insider Inone Panel > Settings > Inone Settings > Account Preferences.',
|
|
18
|
+
type: 'string',
|
|
19
|
+
required: true
|
|
20
|
+
},
|
|
21
|
+
ucd_key: {
|
|
22
|
+
label: 'API Key',
|
|
23
|
+
description: 'You can get your API Key via Insider Inone Panel > Settings > Preferences > Integration Settings',
|
|
24
|
+
type: 'password',
|
|
25
|
+
required: true
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
extendRequest: ({ settings }) => {
|
|
30
|
+
return {
|
|
31
|
+
headers: { 'X-PARTNER-NAME': settings.account_name, 'X-REQUEST-TOKEN': settings.ucd_key }
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
actions: {
|
|
35
|
+
insiderAudiences: insiderAudiences_1.default
|
|
36
|
+
},
|
|
37
|
+
presets: [
|
|
38
|
+
{
|
|
39
|
+
name: 'Sync Engage Audience to Insider',
|
|
40
|
+
subscribe: 'type = "track" or type = "identify"',
|
|
41
|
+
partnerAction: 'insiderAudiences',
|
|
42
|
+
mapping: actions_core_1.defaultValues(insiderAudiences_1.default.fields)
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
};
|
|
46
|
+
exports.default = destination;
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/insider-audiences/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA4E;AAG5E,0EAAiD;AAEjD,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,2BAA2B;IACjC,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,YAAY,EAAE;gBACZ,KAAK,EAAE,cAAc;gBACrB,WAAW,EACT,0GAA0G;gBAC5G,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,OAAO,EAAE;gBACP,KAAK,EAAE,SAAS;gBAChB,WAAW,EAAE,kGAAkG;gBAC/G,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE,IAAI;aACf;SACF;KACF;IACD,aAAa,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC9B,OAAO;YACL,OAAO,EAAE,EAAE,gBAAgB,EAAE,QAAQ,CAAC,YAAY,EAAE,iBAAiB,EAAE,QAAQ,CAAC,OAAO,EAAE;SAC1F,CAAA;IACH,CAAC;IAED,OAAO,EAAE;QACP,gBAAgB,EAAhB,0BAAgB;KACjB;IACD,OAAO,EAAE;QACP;YACE,IAAI,EAAE,iCAAiC;YACvC,SAAS,EAAE,qCAAqC;YAChD,aAAa,EAAE,kBAAkB;YACjC,OAAO,EAAE,4BAAa,CAAC,0BAAgB,CAAC,MAAM,CAAC;SAChD;KACF;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ModifiedResponse, RequestOptions } from '@segment/actions-core';
|
|
2
|
+
import { Payload } from './insiderAudiences/generated-types';
|
|
3
|
+
export declare const API_BASE = "https://unification.useinsider.com/api/";
|
|
4
|
+
export declare const UPSERT_ENDPOINT = "user/v1/upsert";
|
|
5
|
+
export declare const DELETE_ATTRIBUTE_ENDPOINT = "user/v1/attribute/delete";
|
|
6
|
+
export declare const processPayload: (request: <Data = unknown>(url: string, options?: RequestOptions | undefined) => Promise<ModifiedResponse<Data>>, payload: Payload[]) => Promise<ModifiedResponse<unknown>[]>;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processPayload = exports.DELETE_ATTRIBUTE_ENDPOINT = exports.UPSERT_ENDPOINT = exports.API_BASE = void 0;
|
|
4
|
+
exports.API_BASE = 'https://unification.useinsider.com/api/';
|
|
5
|
+
exports.UPSERT_ENDPOINT = 'user/v1/upsert';
|
|
6
|
+
exports.DELETE_ATTRIBUTE_ENDPOINT = 'user/v1/attribute/delete';
|
|
7
|
+
const AUDIENCE_TYPE = 'audience';
|
|
8
|
+
const IDENTIFY = 'identify';
|
|
9
|
+
const TRACK = 'track';
|
|
10
|
+
const COMPUTED_TRAIT_TYPE = 'trait';
|
|
11
|
+
class PayloadValidationError extends Error {
|
|
12
|
+
constructor(message) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = 'PayloadValidationError';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const computedTraitsPayloadForIdentifyCall = function (data, request) {
|
|
18
|
+
const identifiers = getIdentifiers(data);
|
|
19
|
+
const attributes = getTraitAttributes(data);
|
|
20
|
+
const payload = {
|
|
21
|
+
users: [
|
|
22
|
+
{
|
|
23
|
+
identifiers,
|
|
24
|
+
attributes
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
};
|
|
28
|
+
return request(exports.API_BASE + exports.UPSERT_ENDPOINT, {
|
|
29
|
+
method: 'POST',
|
|
30
|
+
json: payload
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
const computedTraitsPayloadForTrackCall = function (data, request) {
|
|
34
|
+
const identifiers = getIdentifiers(data);
|
|
35
|
+
const events = getEvents(data);
|
|
36
|
+
const payload = {
|
|
37
|
+
users: [
|
|
38
|
+
{
|
|
39
|
+
identifiers,
|
|
40
|
+
events
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
};
|
|
44
|
+
return request(exports.API_BASE + exports.UPSERT_ENDPOINT, {
|
|
45
|
+
method: 'POST',
|
|
46
|
+
json: payload
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
const computedAudiencesPayloadForIdentifyCall = function (data, request) {
|
|
50
|
+
if (data.traits_or_props[data.custom_audience_name] === false) {
|
|
51
|
+
return request(exports.API_BASE + exports.DELETE_ATTRIBUTE_ENDPOINT, {
|
|
52
|
+
method: 'POST',
|
|
53
|
+
json: deleteAttributePartial(data)
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
const identifiers = getIdentifiers(data);
|
|
57
|
+
const attributes = getAttributes(data);
|
|
58
|
+
const payload = {
|
|
59
|
+
users: [
|
|
60
|
+
{
|
|
61
|
+
identifiers,
|
|
62
|
+
attributes
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
};
|
|
66
|
+
return request(exports.API_BASE + exports.UPSERT_ENDPOINT, {
|
|
67
|
+
method: 'POST',
|
|
68
|
+
json: payload
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
const computedAudiencePayloadForTrackCall = function (data, request) {
|
|
72
|
+
const identifiers = getIdentifiers(data);
|
|
73
|
+
const events = getEvents(data);
|
|
74
|
+
const payload = {
|
|
75
|
+
users: [
|
|
76
|
+
{
|
|
77
|
+
identifiers,
|
|
78
|
+
events
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
};
|
|
82
|
+
return request(exports.API_BASE + exports.UPSERT_ENDPOINT, {
|
|
83
|
+
method: 'POST',
|
|
84
|
+
json: payload
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
const deleteAttributePartial = function (data) {
|
|
88
|
+
const identifiers = getIdentifiers(data);
|
|
89
|
+
const computationKey = data.custom_audience_name;
|
|
90
|
+
return {
|
|
91
|
+
users: [
|
|
92
|
+
{
|
|
93
|
+
identifiers,
|
|
94
|
+
custom: {
|
|
95
|
+
partial: {
|
|
96
|
+
segment_audience_name: [computationKey]
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
const getIdentifiers = function (data) {
|
|
104
|
+
const identifiers = {
|
|
105
|
+
email: data.email
|
|
106
|
+
};
|
|
107
|
+
if (data.user_id) {
|
|
108
|
+
identifiers['uuid'] = data.user_id;
|
|
109
|
+
}
|
|
110
|
+
if (data.anonymous_id) {
|
|
111
|
+
identifiers['custom'] = {
|
|
112
|
+
segment_anonymous_id: data.anonymous_id
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
if (data.phone) {
|
|
116
|
+
identifiers['phone_number'] = data.phone;
|
|
117
|
+
}
|
|
118
|
+
return identifiers;
|
|
119
|
+
};
|
|
120
|
+
const getAttributes = function (data) {
|
|
121
|
+
const computationKey = data.custom_audience_name;
|
|
122
|
+
const attributes = {
|
|
123
|
+
custom: {
|
|
124
|
+
segment_audience_name: [computationKey]
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
return attributes;
|
|
128
|
+
};
|
|
129
|
+
const getTraitAttributes = function (data) {
|
|
130
|
+
const computationKey = 'segment_io_' + data.custom_audience_name;
|
|
131
|
+
const attributes = { custom: {} };
|
|
132
|
+
attributes.custom[computationKey] = data.traits_or_props[data.custom_audience_name];
|
|
133
|
+
return attributes;
|
|
134
|
+
};
|
|
135
|
+
const getEvents = function (data) {
|
|
136
|
+
return [
|
|
137
|
+
{
|
|
138
|
+
event_name: data.event_name?.toLowerCase().replace(/ /g, '_'),
|
|
139
|
+
timestamp: data.timestamp,
|
|
140
|
+
event_params: {
|
|
141
|
+
custom: {
|
|
142
|
+
segment_engage_name: data.custom_audience_name
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
];
|
|
147
|
+
};
|
|
148
|
+
const handleAudienceData = async function (data, request) {
|
|
149
|
+
if (data.event_type === IDENTIFY) {
|
|
150
|
+
return computedAudiencesPayloadForIdentifyCall(data, request);
|
|
151
|
+
}
|
|
152
|
+
if (data.event_type === TRACK) {
|
|
153
|
+
return computedAudiencePayloadForTrackCall(data, request);
|
|
154
|
+
}
|
|
155
|
+
throw new PayloadValidationError('API call must be a track() or identify() call');
|
|
156
|
+
};
|
|
157
|
+
const handleComputationData = async function (data, request) {
|
|
158
|
+
if (data.event_type === IDENTIFY) {
|
|
159
|
+
return computedTraitsPayloadForIdentifyCall(data, request);
|
|
160
|
+
}
|
|
161
|
+
if (data.event_type === TRACK) {
|
|
162
|
+
return computedTraitsPayloadForTrackCall(data, request);
|
|
163
|
+
}
|
|
164
|
+
throw new PayloadValidationError('API call must be a track() or identify() call');
|
|
165
|
+
};
|
|
166
|
+
const processPayload = async function (request, payload) {
|
|
167
|
+
const promises = payload.map((data) => {
|
|
168
|
+
if (data.segment_computation_action === AUDIENCE_TYPE) {
|
|
169
|
+
return handleAudienceData(data, request);
|
|
170
|
+
}
|
|
171
|
+
if (data.segment_computation_action === COMPUTED_TRAIT_TYPE) {
|
|
172
|
+
return handleComputationData(data, request);
|
|
173
|
+
}
|
|
174
|
+
throw new PayloadValidationError('API call must be an Audience or Computed Trait track() or identify() call');
|
|
175
|
+
});
|
|
176
|
+
return Promise.all(promises);
|
|
177
|
+
};
|
|
178
|
+
exports.processPayload = processPayload;
|
|
179
|
+
//# sourceMappingURL=insider-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insider-helpers.js","sourceRoot":"","sources":["../../../src/destinations/insider-audiences/insider-helpers.ts"],"names":[],"mappings":";;;AAGa,QAAA,QAAQ,GAAG,yCAAyC,CAAA;AACpD,QAAA,eAAe,GAAG,gBAAgB,CAAA;AAClC,QAAA,yBAAyB,GAAG,0BAA0B,CAAA;AACnE,MAAM,aAAa,GAAG,UAAU,CAAA;AAChC,MAAM,QAAQ,GAAG,UAAU,CAAA;AAC3B,MAAM,KAAK,GAAG,OAAO,CAAA;AACrB,MAAM,mBAAmB,GAAG,OAAO,CAAA;AAEnC,MAAM,sBAAuB,SAAQ,KAAK;IACxC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAA;IACtC,CAAC;CACF;AAGD,MAAM,oCAAoC,GAAG,UAC3C,IAAa,EACb,OAA+G;IAE/G,MAAM,WAAW,GAAG,cAAc,CAAC,IAAI,CAAC,CAAA;IACxC,MAAM,UAAU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/G,IAAI,IAAI,CAAC,UAAU,KAAK,QAAQ,EAAE;QAChC,OAAO,oCAAoC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;KAC3D;IAED,IAAI,IAAI,CAAC,UAAU,KAAK,KAAK,EAAE;QAC7B,OAAO,iCAAiC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;KACxD;IAED,MAAM,IAAI,sBAAsB,CAAC,+CAA+C,CAAC,CAAA;AACnF,CAAC,CAAA;AAGM,MAAM,cAAc,GAAG,KAAK,WACjC,OAA+G,EAC/G,OAAkB;IAElB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACpC,IAAI,IAAI,CAAC,0BAA0B,KAAK,aAAa,EAAE;YACrD,OAAO,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;SACzC;QAED,IAAI,IAAI,CAAC,0BAA0B,KAAK,mBAAmB,EAAE;YAC3D,OAAO,qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;SAC5C;QAED,MAAM,IAAI,sBAAsB,CAAC,2EAA2E,CAAC,CAAA;IAC/G,CAAC,CAAC,CAAA;IAEF,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;AAC9B,CAAC,CAAA;AAjBY,QAAA,cAAc,kBAiB1B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
custom_audience_name: string;
|
|
3
|
+
segment_computation_action: string;
|
|
4
|
+
email: string;
|
|
5
|
+
phone?: string;
|
|
6
|
+
traits_or_props: {
|
|
7
|
+
[k: string]: unknown;
|
|
8
|
+
};
|
|
9
|
+
user_id?: string;
|
|
10
|
+
anonymous_id?: string;
|
|
11
|
+
event_type: string;
|
|
12
|
+
event_name?: string;
|
|
13
|
+
timestamp: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/insider-audiences/insiderAudiences/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const insider_helpers_1 = require("../insider-helpers");
|
|
4
|
+
const action = {
|
|
5
|
+
title: 'Insider Audiences',
|
|
6
|
+
description: 'Sync Audiences and Computed Traits from Segment to Insider InOne',
|
|
7
|
+
defaultSubscription: 'type = "track" or type = "identify"',
|
|
8
|
+
fields: {
|
|
9
|
+
custom_audience_name: {
|
|
10
|
+
label: 'Custom Audience Name',
|
|
11
|
+
description: 'Name of custom audience list to which emails should added/removed',
|
|
12
|
+
type: 'string',
|
|
13
|
+
required: true,
|
|
14
|
+
default: {
|
|
15
|
+
'@path': '$.context.personas.computation_key'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
segment_computation_action: {
|
|
19
|
+
label: 'Segment Computation Action',
|
|
20
|
+
description: "Segment computation class used to determine if action is an 'Engage-Audience'",
|
|
21
|
+
type: 'string',
|
|
22
|
+
required: true,
|
|
23
|
+
default: {
|
|
24
|
+
'@path': '$.context.personas.computation_class'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
email: {
|
|
28
|
+
label: 'Email',
|
|
29
|
+
description: "User's email address for including/excluding from custom audience",
|
|
30
|
+
type: 'string',
|
|
31
|
+
format: 'email',
|
|
32
|
+
required: true,
|
|
33
|
+
default: {
|
|
34
|
+
'@if': {
|
|
35
|
+
exists: { '@path': '$.context.traits.email' },
|
|
36
|
+
then: { '@path': '$.context.traits.email' },
|
|
37
|
+
else: { '@path': '$.traits.email' }
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
phone: {
|
|
42
|
+
label: 'Phone',
|
|
43
|
+
description: "User's phone number for including/excluding from custom audience",
|
|
44
|
+
type: 'string',
|
|
45
|
+
format: 'text',
|
|
46
|
+
required: false,
|
|
47
|
+
default: {
|
|
48
|
+
'@if': {
|
|
49
|
+
exists: { '@path': '$.context.traits.phone' },
|
|
50
|
+
then: { '@path': '$.context.traits.phone' },
|
|
51
|
+
else: { '@path': '$.traits.phone' }
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
traits_or_props: {
|
|
56
|
+
label: 'traits or properties object',
|
|
57
|
+
description: 'Object which will be computed differently for track and identify events',
|
|
58
|
+
type: 'object',
|
|
59
|
+
required: true,
|
|
60
|
+
default: {
|
|
61
|
+
'@if': {
|
|
62
|
+
exists: { '@path': '$.properties' },
|
|
63
|
+
then: { '@path': '$.properties' },
|
|
64
|
+
else: { '@path': '$.traits' }
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
user_id: {
|
|
69
|
+
label: 'User ID',
|
|
70
|
+
description: 'Known user identifier for the user',
|
|
71
|
+
type: 'string',
|
|
72
|
+
required: false,
|
|
73
|
+
default: {
|
|
74
|
+
'@path': '$.userId'
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
anonymous_id: {
|
|
78
|
+
label: 'Anonymous ID',
|
|
79
|
+
description: 'Anonymous user identifier for the user',
|
|
80
|
+
type: 'string',
|
|
81
|
+
required: false,
|
|
82
|
+
default: {
|
|
83
|
+
'@path': '$.anonymousId'
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
event_type: {
|
|
87
|
+
label: 'Event Type',
|
|
88
|
+
description: 'Type of event',
|
|
89
|
+
type: 'string',
|
|
90
|
+
required: true,
|
|
91
|
+
default: {
|
|
92
|
+
'@path': '$.type'
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
event_name: {
|
|
96
|
+
label: 'Event Name',
|
|
97
|
+
description: 'Name of event',
|
|
98
|
+
type: 'string',
|
|
99
|
+
required: false,
|
|
100
|
+
default: {
|
|
101
|
+
'@if': {
|
|
102
|
+
exists: { '@path': '$.event' },
|
|
103
|
+
then: { '@path': '$.event' },
|
|
104
|
+
else: { '@path': '$.name' }
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
timestamp: {
|
|
109
|
+
label: 'Timestamp',
|
|
110
|
+
description: 'Timestamp of event',
|
|
111
|
+
type: 'string',
|
|
112
|
+
required: true,
|
|
113
|
+
default: {
|
|
114
|
+
'@path': '$.timestamp'
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
perform: (request, { payload }) => {
|
|
119
|
+
return insider_helpers_1.processPayload(request, [payload]);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
exports.default = action;
|
|
123
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/insider-audiences/insiderAudiences/index.ts"],"names":[],"mappings":";;AAGA,wDAAmD;AAEnD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,mBAAmB;IAC1B,WAAW,EAAE,kEAAkE;IAC/E,mBAAmB,EAAE,qCAAqC;IAC1D,MAAM,EAAE;QACN,oBAAoB,EAAE;YACpB,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EAAE,mEAAmE;YAChF,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,oCAAoC;aAC9C;SACF;QACD,0BAA0B,EAAE;YAC1B,KAAK,EAAE,4BAA4B;YACnC,WAAW,EAAE,+EAA+E;YAC5F,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,sCAAsC;aAChD;SACF;QACD,KAAK,EAAE;YACL,KAAK,EAAE,OAAO;YACd,WAAW,EAAE,mEAAmE;YAChF,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO;YACf,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,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QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,QAAQ;aAClB;SACF;QACD,UAAU,EAAE;YACV,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,eAAe;YAC5B,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;oBAC9B,IAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;oBAC5B,IAAI,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;iBAC5B;aACF;SACF;QACD,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,oBAAoB;YACjC,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;KACF;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,OAAO,gCAAc,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IAC3C,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/optimizely-feature-experimentation-actions/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
7
|
+
const trackEvent_1 = __importDefault(require("./trackEvent"));
|
|
8
|
+
const destination = {
|
|
9
|
+
name: 'Optimizely Feature Experimentation (Actions)',
|
|
10
|
+
slug: 'actions-optimizely-feature-experimentation-cloud',
|
|
11
|
+
mode: 'cloud',
|
|
12
|
+
authentication: {
|
|
13
|
+
scheme: 'custom',
|
|
14
|
+
fields: {
|
|
15
|
+
accessToken: {
|
|
16
|
+
label: 'Personal Access Token',
|
|
17
|
+
description: 'Personal Access Token which client generated manually.',
|
|
18
|
+
type: 'password',
|
|
19
|
+
required: false
|
|
20
|
+
},
|
|
21
|
+
accountId: {
|
|
22
|
+
label: 'Optimizely Account Id',
|
|
23
|
+
type: 'string',
|
|
24
|
+
required: true,
|
|
25
|
+
description: 'In order to use Optimizely Feature Experimentation (Actions) via server side, you must enter your Account ID from your Optimizely account. You can find this ID by visiting https://app.optimizely.com/v2/accountsettings/account/plan'
|
|
26
|
+
},
|
|
27
|
+
dataFileUrl: {
|
|
28
|
+
label: 'Datafile URL',
|
|
29
|
+
type: 'string',
|
|
30
|
+
required: true,
|
|
31
|
+
format: 'uri',
|
|
32
|
+
description: 'In order to use Optimizely Feature Experimentation (Actions) server side, you must enter the entire URL for your datafile. It should look something like https://cdn.optimizely.com/json/9218021209.json'
|
|
33
|
+
},
|
|
34
|
+
cacheExp: {
|
|
35
|
+
label: 'Cach Exp',
|
|
36
|
+
type: 'number',
|
|
37
|
+
required: false,
|
|
38
|
+
default: 300,
|
|
39
|
+
description: 'To optimize the server side integration, we will cache the fetched Datafile that you have provided for this amount of time (in seconds) in Redis. Since the datafile should not change unless you modified the conditions or variation rules of your experiments, it is advised to have a minimum floor of 300 seconds (5 minutes).'
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
testAuthentication: (request, { settings }) => {
|
|
43
|
+
const { dataFileUrl } = settings;
|
|
44
|
+
return request(dataFileUrl);
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
onDelete: async (request, { settings }) => {
|
|
48
|
+
if (!settings.accessToken) {
|
|
49
|
+
throw new actions_core_1.IntegrationError('Access Token is required for user deletion.', 'REQUIRED_ACCESS_TOKEN', 400);
|
|
50
|
+
}
|
|
51
|
+
return request('https://api.optimizely.com/v2/subject-access-requests', {
|
|
52
|
+
method: 'post',
|
|
53
|
+
headers: { Authorization: `Bearer ${settings?.accessToken}` },
|
|
54
|
+
json: {
|
|
55
|
+
data_type: 'visitor',
|
|
56
|
+
identifier: settings.accountId,
|
|
57
|
+
identifier_type: 'dcp_id',
|
|
58
|
+
request_type: 'delete'
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
actions: {
|
|
63
|
+
trackEvent: trackEvent_1.default
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
exports.default = destination;
|
|
67
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/optimizely-feature-experimentation-actions/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAwD;AAGxD,8DAAqC;AAErC,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,8CAA8C;IACpD,IAAI,EAAE,kDAAkD;IACxD,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,WAAW,EAAE;gBACX,KAAK,EAAE,uBAAuB;gBAC9B,WAAW,EAAE,wDAAwD;gBACrE,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE,KAAK;aAChB;YACD,SAAS,EAAE;gBACT,KAAK,EAAE,uBAAuB;gBAC9B,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;gBACd,WAAW,EACT,wOAAwO;aAC3O;YACD,WAAW,EAAE;gBACX,KAAK,EAAE,cAAc;gBACrB,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE,KAAK;gBACb,WAAW,EACT,0MAA0M;aAC7M;YACD,QAAQ,EAAE;gBACR,KAAK,EAAE,UAAU;gBACjB,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,GAAG;gBACZ,WAAW,EACT,qUAAqU;aACxU;SACF;QACD,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;YAC5C,MAAM,EAAE,WAAW,EAAE,GAAG,QAAQ,CAAA;YAChC,OAAO,OAAO,CAAC,WAAW,CAAC,CAAA;QAC7B,CAAC;KACF;IACD,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;QACxC,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE;YACzB,MAAM,IAAI,+BAAgB,CAAC,6CAA6C,EAAE,uBAAuB,EAAE,GAAG,CAAC,CAAA;SACxG;QAED,OAAO,OAAO,CAAC,uDAAuD,EAAE;YACtE,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,QAAQ,EAAE,WAAW,EAAE,EAAE;YAC7D,IAAI,EAAE;gBACJ,SAAS,EAAE,SAAS;gBACpB,UAAU,EAAE,QAAQ,CAAC,SAAS;gBAC9B,eAAe,EAAE,QAAQ;gBACzB,YAAY,EAAE,QAAQ;aACvB;SACF,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,EAAE;QACP,UAAU,EAAV,oBAAU;KACX;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export declare const dataFile: {
|
|
2
|
+
groups: never[];
|
|
3
|
+
environmentKey: string;
|
|
4
|
+
rollouts: {
|
|
5
|
+
experiments: {
|
|
6
|
+
status: string;
|
|
7
|
+
audienceIds: never[];
|
|
8
|
+
variations: {
|
|
9
|
+
variables: {
|
|
10
|
+
id: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}[];
|
|
13
|
+
id: string;
|
|
14
|
+
key: string;
|
|
15
|
+
featureEnabled: boolean;
|
|
16
|
+
}[];
|
|
17
|
+
id: string;
|
|
18
|
+
key: string;
|
|
19
|
+
layerId: string;
|
|
20
|
+
trafficAllocation: never[];
|
|
21
|
+
forcedVariations: {};
|
|
22
|
+
}[];
|
|
23
|
+
id: string;
|
|
24
|
+
}[];
|
|
25
|
+
typedAudiences: never[];
|
|
26
|
+
projectId: string;
|
|
27
|
+
variables: never[];
|
|
28
|
+
featureFlags: {
|
|
29
|
+
experimentIds: string[];
|
|
30
|
+
rolloutId: string;
|
|
31
|
+
variables: {
|
|
32
|
+
defaultValue: string;
|
|
33
|
+
type: string;
|
|
34
|
+
id: string;
|
|
35
|
+
key: string;
|
|
36
|
+
}[];
|
|
37
|
+
id: string;
|
|
38
|
+
key: string;
|
|
39
|
+
}[];
|
|
40
|
+
experiments: {
|
|
41
|
+
status: string;
|
|
42
|
+
audienceIds: never[];
|
|
43
|
+
variations: {
|
|
44
|
+
variables: {
|
|
45
|
+
id: string;
|
|
46
|
+
value: string;
|
|
47
|
+
}[];
|
|
48
|
+
id: string;
|
|
49
|
+
key: string;
|
|
50
|
+
featureEnabled: boolean;
|
|
51
|
+
}[];
|
|
52
|
+
id: string;
|
|
53
|
+
key: string;
|
|
54
|
+
layerId: string;
|
|
55
|
+
trafficAllocation: {
|
|
56
|
+
entityId: string;
|
|
57
|
+
endOfRange: number;
|
|
58
|
+
}[];
|
|
59
|
+
forcedVariations: {};
|
|
60
|
+
}[];
|
|
61
|
+
version: string;
|
|
62
|
+
audiences: {
|
|
63
|
+
conditions: string;
|
|
64
|
+
id: string;
|
|
65
|
+
name: string;
|
|
66
|
+
}[];
|
|
67
|
+
anonymizeIP: boolean;
|
|
68
|
+
sdkKey: string;
|
|
69
|
+
attributes: {
|
|
70
|
+
id: string;
|
|
71
|
+
key: string;
|
|
72
|
+
}[];
|
|
73
|
+
botFiltering: boolean;
|
|
74
|
+
accountId: string;
|
|
75
|
+
events: {
|
|
76
|
+
experimentIds: string[];
|
|
77
|
+
id: string;
|
|
78
|
+
key: string;
|
|
79
|
+
}[];
|
|
80
|
+
revision: string;
|
|
81
|
+
};
|