@segment/action-destinations 3.165.0 → 3.165.1-add-new-error.24
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/acoustic/Utility/eventprocessing.js +18 -18
- package/dist/destinations/acoustic/Utility/eventprocessing.js.map +1 -1
- package/dist/destinations/airship/customEvents/generated-types.d.ts +9 -0
- package/dist/destinations/airship/customEvents/generated-types.js +3 -0
- package/dist/destinations/airship/customEvents/generated-types.js.map +1 -0
- package/dist/destinations/airship/customEvents/index.d.ts +5 -0
- package/dist/destinations/airship/customEvents/index.js +59 -0
- package/dist/destinations/airship/customEvents/index.js.map +1 -0
- package/dist/destinations/airship/generated-types.d.ts +5 -0
- package/dist/destinations/airship/generated-types.js +3 -0
- package/dist/destinations/airship/generated-types.js.map +1 -0
- package/dist/destinations/airship/index.d.ts +4 -0
- package/dist/destinations/airship/index.js +97 -0
- package/dist/destinations/airship/index.js.map +1 -0
- package/dist/destinations/airship/manageTags/generated-types.d.ts +7 -0
- package/dist/destinations/airship/manageTags/generated-types.js +3 -0
- package/dist/destinations/airship/manageTags/generated-types.js.map +1 -0
- package/dist/destinations/airship/manageTags/index.d.ts +5 -0
- package/dist/destinations/airship/manageTags/index.js +38 -0
- package/dist/destinations/airship/manageTags/index.js.map +1 -0
- package/dist/destinations/airship/setAttributes/generated-types.d.ts +30 -0
- package/dist/destinations/airship/setAttributes/generated-types.js +3 -0
- package/dist/destinations/airship/setAttributes/generated-types.js.map +1 -0
- package/dist/destinations/airship/setAttributes/index.d.ts +5 -0
- package/dist/destinations/airship/setAttributes/index.js +182 -0
- package/dist/destinations/airship/setAttributes/index.js.map +1 -0
- package/dist/destinations/airship/utilities.d.ts +28 -0
- package/dist/destinations/airship/utilities.js +146 -0
- package/dist/destinations/airship/utilities.js.map +1 -0
- package/dist/destinations/calliper/alias/generated-types.d.ts +5 -0
- package/dist/destinations/calliper/alias/generated-types.js +3 -0
- package/dist/destinations/calliper/alias/generated-types.js.map +1 -0
- package/dist/destinations/calliper/alias/index.d.ts +5 -0
- package/dist/destinations/calliper/alias/index.js +60 -0
- package/dist/destinations/calliper/alias/index.js.map +1 -0
- package/dist/destinations/calliper/generated-types.d.ts +4 -0
- package/dist/destinations/calliper/generated-types.js +3 -0
- package/dist/destinations/calliper/generated-types.js.map +1 -0
- package/dist/destinations/calliper/identifyGroup/generated-types.d.ts +7 -0
- package/dist/destinations/calliper/identifyGroup/generated-types.js +3 -0
- package/dist/destinations/calliper/identifyGroup/generated-types.js.map +1 -0
- package/dist/destinations/calliper/identifyGroup/index.d.ts +5 -0
- package/dist/destinations/calliper/identifyGroup/index.js +53 -0
- package/dist/destinations/calliper/identifyGroup/index.js.map +1 -0
- package/dist/destinations/calliper/identifyUser/generated-types.d.ts +14 -0
- package/dist/destinations/calliper/identifyUser/generated-types.js +3 -0
- package/dist/destinations/calliper/identifyUser/generated-types.js.map +1 -0
- package/dist/destinations/calliper/identifyUser/index.d.ts +5 -0
- package/dist/destinations/calliper/identifyUser/index.js +152 -0
- package/dist/destinations/calliper/identifyUser/index.js.map +1 -0
- package/dist/destinations/calliper/index.d.ts +4 -0
- package/dist/destinations/calliper/index.js +81 -0
- package/dist/destinations/calliper/index.js.map +1 -0
- package/dist/destinations/calliper/trackEvent/eventProperties.d.ts +2 -0
- package/dist/destinations/calliper/trackEvent/eventProperties.js +231 -0
- package/dist/destinations/calliper/trackEvent/eventProperties.js.map +1 -0
- package/dist/destinations/calliper/trackEvent/generated-types.d.ts +32 -0
- package/dist/destinations/calliper/trackEvent/generated-types.js +3 -0
- package/dist/destinations/calliper/trackEvent/generated-types.js.map +1 -0
- package/dist/destinations/calliper/trackEvent/index.d.ts +5 -0
- package/dist/destinations/calliper/trackEvent/index.js +65 -0
- package/dist/destinations/calliper/trackEvent/index.js.map +1 -0
- package/dist/destinations/calliper/utils/constants.d.ts +1 -0
- package/dist/destinations/calliper/utils/constants.js +5 -0
- package/dist/destinations/calliper/utils/constants.js.map +1 -0
- package/dist/destinations/calliper/utils/helpers.d.ts +1 -0
- package/dist/destinations/calliper/utils/helpers.js +8 -0
- package/dist/destinations/calliper/utils/helpers.js.map +1 -0
- package/dist/destinations/facebook-conversions-api/addToCart/generated-types.d.ts +21 -0
- package/dist/destinations/facebook-conversions-api/addToCart/index.js +3 -0
- package/dist/destinations/facebook-conversions-api/addToCart/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/custom/generated-types.d.ts +21 -0
- package/dist/destinations/facebook-conversions-api/custom/index.js +3 -0
- package/dist/destinations/facebook-conversions-api/custom/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/fb-capi-app-data.d.ts +10 -0
- package/dist/destinations/facebook-conversions-api/fb-capi-app-data.js +179 -0
- package/dist/destinations/facebook-conversions-api/fb-capi-app-data.js.map +1 -0
- package/dist/destinations/facebook-conversions-api/index.js +1 -1
- package/dist/destinations/facebook-conversions-api/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/initiateCheckout/generated-types.d.ts +21 -0
- package/dist/destinations/facebook-conversions-api/initiateCheckout/index.js +3 -0
- package/dist/destinations/facebook-conversions-api/initiateCheckout/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/pageView/generated-types.d.ts +21 -0
- package/dist/destinations/facebook-conversions-api/pageView/index.js +3 -0
- package/dist/destinations/facebook-conversions-api/pageView/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/purchase/generated-types.d.ts +21 -0
- package/dist/destinations/facebook-conversions-api/purchase/index.js +3 -0
- package/dist/destinations/facebook-conversions-api/purchase/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/search/generated-types.d.ts +21 -0
- package/dist/destinations/facebook-conversions-api/search/index.js +3 -0
- package/dist/destinations/facebook-conversions-api/search/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/viewContent/generated-types.d.ts +21 -0
- package/dist/destinations/facebook-conversions-api/viewContent/index.js +3 -0
- package/dist/destinations/facebook-conversions-api/viewContent/index.js.map +1 -1
- package/dist/destinations/fullstory/index.js +1 -1
- package/dist/destinations/fullstory/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/functions.d.ts +1 -0
- package/dist/destinations/google-enhanced-conversions/functions.js +3 -1
- package/dist/destinations/google-enhanced-conversions/functions.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion/index.js +3 -1
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.js +3 -1
- package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.js.map +1 -1
- package/dist/destinations/hubspot/sendCustomBehavioralEvent/index.js +4 -0
- package/dist/destinations/hubspot/sendCustomBehavioralEvent/index.js.map +1 -1
- package/dist/destinations/index.js +2 -0
- package/dist/destinations/index.js.map +1 -1
- package/dist/destinations/iterable/index.js +3 -3
- package/dist/destinations/iterable/index.js.map +1 -1
- package/dist/destinations/iterable/shared-fields.d.ts +15 -1
- package/dist/destinations/iterable/shared-fields.js +19 -17
- package/dist/destinations/iterable/shared-fields.js.map +1 -1
- package/dist/destinations/iterable/trackEvent/index.js +4 -1
- package/dist/destinations/iterable/trackEvent/index.js.map +1 -1
- package/dist/destinations/iterable/trackPurchase/generated-types.d.ts +1 -4
- package/dist/destinations/iterable/trackPurchase/index.js +21 -26
- package/dist/destinations/iterable/trackPurchase/index.js.map +1 -1
- package/dist/destinations/iterable/updateCart/generated-types.d.ts +1 -4
- package/dist/destinations/iterable/updateCart/index.js +21 -28
- package/dist/destinations/iterable/updateCart/index.js.map +1 -1
- package/dist/destinations/iterable/updateUser/generated-types.d.ts +1 -1
- package/dist/destinations/iterable/updateUser/index.js +12 -8
- package/dist/destinations/iterable/updateUser/index.js.map +1 -1
- package/dist/destinations/iterable/utils.d.ts +4 -0
- package/dist/destinations/iterable/utils.js +63 -0
- package/dist/destinations/iterable/utils.js.map +1 -0
- package/dist/destinations/liveramp-audiences/audienceEntered/generated-types.d.ts +1 -0
- package/dist/destinations/liveramp-audiences/audienceEntered/index.js +7 -0
- package/dist/destinations/liveramp-audiences/audienceEntered/index.js.map +1 -1
- package/dist/destinations/liveramp-audiences/generated-types.d.ts +2 -0
- package/dist/destinations/liveramp-audiences/index.js +14 -0
- package/dist/destinations/liveramp-audiences/index.js.map +1 -1
- package/dist/destinations/noop/generated-types.d.ts +2 -0
- package/dist/destinations/noop/generated-types.js +3 -0
- package/dist/destinations/noop/generated-types.js.map +1 -0
- package/dist/destinations/noop/index.d.ts +4 -0
- package/dist/destinations/noop/index.js +27 -0
- package/dist/destinations/noop/index.js.map +1 -0
- package/dist/destinations/noop/noop/generated-types.d.ts +3 -0
- package/dist/destinations/noop/noop/generated-types.js +3 -0
- package/dist/destinations/noop/noop/generated-types.js.map +1 -0
- package/dist/destinations/noop/noop/index.d.ts +5 -0
- package/dist/destinations/noop/noop/index.js +19 -0
- package/dist/destinations/noop/noop/index.js.map +1 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/trackEvent/index.js +1 -1
- package/dist/destinations/optimizely-feature-experimentation-actions/trackEvent/index.js.map +1 -1
- package/dist/destinations/snap-conversions-api/snap-capi-properties.js +2 -1
- package/dist/destinations/snap-conversions-api/snap-capi-properties.js.map +1 -1
- package/dist/destinations/usermaven/common-definitions.js +1 -1
- package/dist/destinations/usermaven/common-definitions.js.map +1 -1
- package/dist/destinations/usermaven/generated-types.d.ts +1 -0
- package/dist/destinations/usermaven/group/generated-types.d.ts +1 -1
- package/dist/destinations/usermaven/identify/generated-types.d.ts +1 -1
- package/dist/destinations/usermaven/index.js +10 -1
- package/dist/destinations/usermaven/index.js.map +1 -1
- package/dist/destinations/usermaven/page/generated-types.d.ts +1 -1
- package/dist/destinations/usermaven/request-params.js +4 -3
- package/dist/destinations/usermaven/request-params.js.map +1 -1
- package/dist/destinations/usermaven/track/generated-types.d.ts +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._private = exports.map_endpoint = exports.manageTags = exports.setAttribute = exports.setBatchCustomEvent = exports.setCustomEvent = void 0;
|
|
4
|
+
function setCustomEvent(request, settings, payload) {
|
|
5
|
+
const endpoint = map_endpoint(settings.endpoint);
|
|
6
|
+
const uri = `${endpoint}/api/custom-events`;
|
|
7
|
+
const airship_payload = _build_custom_event_object(payload);
|
|
8
|
+
return do_request(request, uri, [airship_payload]);
|
|
9
|
+
}
|
|
10
|
+
exports.setCustomEvent = setCustomEvent;
|
|
11
|
+
function setBatchCustomEvent(request, settings, payloads) {
|
|
12
|
+
const endpoint = map_endpoint(settings.endpoint);
|
|
13
|
+
const uri = `${endpoint}/api/custom-events`;
|
|
14
|
+
const airship_payload = [];
|
|
15
|
+
for (let i = 0; i < payloads.length; i++) {
|
|
16
|
+
airship_payload.push(_build_custom_event_object(payloads[i]));
|
|
17
|
+
}
|
|
18
|
+
return do_request(request, uri, airship_payload);
|
|
19
|
+
}
|
|
20
|
+
exports.setBatchCustomEvent = setBatchCustomEvent;
|
|
21
|
+
function setAttribute(request, settings, payload) {
|
|
22
|
+
const endpoint = map_endpoint(settings.endpoint);
|
|
23
|
+
const uri = `${endpoint}/api/channels/attributes`;
|
|
24
|
+
const attributes = _build_attributes_object(payload);
|
|
25
|
+
const airship_payload = {
|
|
26
|
+
attributes: attributes,
|
|
27
|
+
audience: {
|
|
28
|
+
named_user_id: `${payload.named_user_id}`
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
return do_request(request, uri, airship_payload);
|
|
32
|
+
}
|
|
33
|
+
exports.setAttribute = setAttribute;
|
|
34
|
+
function manageTags(request, settings, payload) {
|
|
35
|
+
const endpoint = map_endpoint(settings.endpoint);
|
|
36
|
+
const uri = `${endpoint}/api/named_users/tags`;
|
|
37
|
+
const airship_payload = _build_tags_object(payload);
|
|
38
|
+
return do_request(request, uri, airship_payload);
|
|
39
|
+
}
|
|
40
|
+
exports.manageTags = manageTags;
|
|
41
|
+
function do_request(request, uri, payload) {
|
|
42
|
+
return request(uri, {
|
|
43
|
+
method: 'POST',
|
|
44
|
+
json: payload
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function map_endpoint(region) {
|
|
48
|
+
if (region === 'EU') {
|
|
49
|
+
return 'https://go.airship.eu';
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return 'https://go.urbanairship.com';
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.map_endpoint = map_endpoint;
|
|
56
|
+
function _build_custom_event_object(payload) {
|
|
57
|
+
if (payload.properties) {
|
|
58
|
+
payload.properties.source = 'Segment';
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
payload.properties = {
|
|
62
|
+
source: 'Segment'
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const airship_payload = {
|
|
66
|
+
occurred: validate_timestamp(payload.occurred),
|
|
67
|
+
user: {
|
|
68
|
+
named_user_id: payload.named_user_id
|
|
69
|
+
},
|
|
70
|
+
body: {
|
|
71
|
+
name: payload.name.toLowerCase(),
|
|
72
|
+
interaction_type: 'cdp',
|
|
73
|
+
properties: payload.properties
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
return airship_payload;
|
|
77
|
+
}
|
|
78
|
+
function _build_attributes_object(payload) {
|
|
79
|
+
const attributes_list = [];
|
|
80
|
+
const attributes = payload.attributes || {};
|
|
81
|
+
for (const key in attributes) {
|
|
82
|
+
attributes_list.push(_build_attribute(key, attributes[key], payload.occurred));
|
|
83
|
+
}
|
|
84
|
+
return attributes_list;
|
|
85
|
+
}
|
|
86
|
+
function _build_attribute(attribute_key, attribute_value, occurred) {
|
|
87
|
+
const attribute = {
|
|
88
|
+
action: 'set',
|
|
89
|
+
key: attribute_key,
|
|
90
|
+
timestamp: validate_timestamp(occurred)
|
|
91
|
+
};
|
|
92
|
+
if (attribute_value == null || (typeof attribute_value == 'string' && attribute_value.length === 0)) {
|
|
93
|
+
attribute.action = 'remove';
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
attribute.action = 'set';
|
|
97
|
+
attribute.value = attribute_value;
|
|
98
|
+
}
|
|
99
|
+
return attribute;
|
|
100
|
+
}
|
|
101
|
+
function _build_tags_object(payload) {
|
|
102
|
+
const tags_to_add = [];
|
|
103
|
+
const tags_to_remove = [];
|
|
104
|
+
const tag_group = payload.tag_group;
|
|
105
|
+
const properties = payload.tags || {};
|
|
106
|
+
for (const [k, v] of Object.entries(properties)) {
|
|
107
|
+
if (typeof v == 'boolean') {
|
|
108
|
+
if (v) {
|
|
109
|
+
tags_to_add.push(k);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
tags_to_remove.push(k);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const airship_payload = { audience: {} };
|
|
117
|
+
airship_payload.audience = {
|
|
118
|
+
named_user_id: payload.named_user_id
|
|
119
|
+
};
|
|
120
|
+
if (tags_to_add.length > 0) {
|
|
121
|
+
airship_payload.add = { [tag_group]: tags_to_add };
|
|
122
|
+
}
|
|
123
|
+
if (tags_to_remove.length > 0) {
|
|
124
|
+
airship_payload.remove = { [tag_group]: tags_to_remove };
|
|
125
|
+
}
|
|
126
|
+
return airship_payload;
|
|
127
|
+
}
|
|
128
|
+
function validate_timestamp(timestamp) {
|
|
129
|
+
const payload_time_stamp = new Date(timestamp);
|
|
130
|
+
const three_months_ago = new Date();
|
|
131
|
+
three_months_ago.setDate(three_months_ago.getDate() - 90);
|
|
132
|
+
if (three_months_ago > payload_time_stamp) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
return payload_time_stamp.toISOString().split('.')[0];
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
exports._private = {
|
|
140
|
+
_build_custom_event_object,
|
|
141
|
+
_build_attributes_object,
|
|
142
|
+
_build_attribute,
|
|
143
|
+
_build_tags_object,
|
|
144
|
+
validate_timestamp
|
|
145
|
+
};
|
|
146
|
+
//# sourceMappingURL=utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utilities.js","sourceRoot":"","sources":["../../../src/destinations/airship/utilities.ts"],"names":[],"mappings":";;;AAOA,SAAgB,cAAc,CAAC,OAAsB,EAAE,QAAkB,EAAE,OAA4B;IACrG,MAAM,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IAChD,MAAM,GAAG,GAAG,GAAG,QAAQ,oBAAoB,CAAA;IAC3C,MAAM,eAAe,GAAG,0BAA0B,CAAC,OAAO,CAAC,CAAA;IAC3D,OAAO,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,CAAC,CAAA;AACpD,CAAC;AALD,wCAKC;AAGD,SAAgB,mBAAmB,CAAC,OAAsB,EAAE,QAAkB,EAAE,QAA+B;IAC7G,MAAM,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IAChD,MAAM,GAAG,GAAG,GAAG,QAAQ,oBAAoB,CAAA;IAC3C,MAAM,eAAe,GAAG,EAAE,CAAA;IAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACxC,eAAe,CAAC,IAAI,CAAC,0BAA0B,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAC9D;IACD,OAAO,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,CAAC,CAAA;AAClD,CAAC;AARD,kDAQC;AAGD,SAAgB,YAAY,CAAC,OAAsB,EAAE,QAAkB,EAAE,OAA0B;IACjG,MAAM,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IAChD,MAAM,GAAG,GAAG,GAAG,QAAQ,0BAA0B,CAAA;IACjD,MAAM,UAAU,GAAG,w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;IAChB,kBAAkB;IAClB,kBAAkB;CACnB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/calliper/alias/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const constants_1 = require("../utils/constants");
|
|
7
|
+
const dayjs_1 = __importDefault(require("../../../lib/dayjs"));
|
|
8
|
+
const action = {
|
|
9
|
+
title: 'Alias',
|
|
10
|
+
description: 'Create an alias to a user id. Used when a single user has been initially identified as several users.',
|
|
11
|
+
fields: {
|
|
12
|
+
time: {
|
|
13
|
+
label: 'Timestamp',
|
|
14
|
+
type: 'datetime',
|
|
15
|
+
description: 'The timestamp of the event. Could be any date string/number value compatible with JavaScript Date constructor: e.g. milliseconds epoch or an ISO datetime. If time is not sent with the event, it will be set to the request time.',
|
|
16
|
+
default: {
|
|
17
|
+
'@path': '$.timestamp'
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
new_id: {
|
|
21
|
+
label: 'New ID',
|
|
22
|
+
type: 'string',
|
|
23
|
+
allowNull: true,
|
|
24
|
+
description: 'A new user id to be merged with the original distinct id. Each alias can only map to one distinct id.',
|
|
25
|
+
default: {
|
|
26
|
+
'@if': {
|
|
27
|
+
exists: { '@path': '$.userId' },
|
|
28
|
+
then: { '@path': '$.userId' },
|
|
29
|
+
else: { '@path': '$.anonymousId' }
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
previous_id: {
|
|
34
|
+
label: 'Previous ID',
|
|
35
|
+
type: 'string',
|
|
36
|
+
description: 'A previous user id to be merged with the alias.',
|
|
37
|
+
default: {
|
|
38
|
+
'@path': '$.previousId'
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
perform: async (request, { payload, settings }) => {
|
|
43
|
+
const datetime = payload.time;
|
|
44
|
+
const time = datetime && dayjs_1.default.utc(datetime).isValid() ? dayjs_1.default.utc(datetime).valueOf() : Date.now();
|
|
45
|
+
return await request(`${constants_1.API_URL}/user/alias`, {
|
|
46
|
+
method: 'post',
|
|
47
|
+
json: {
|
|
48
|
+
companyId: settings.companyId,
|
|
49
|
+
key: settings.segmentKey,
|
|
50
|
+
alias: {
|
|
51
|
+
time,
|
|
52
|
+
new_id: payload.new_id,
|
|
53
|
+
previous_id: payload.previous_id
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
exports.default = action;
|
|
60
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/calliper/alias/index.ts"],"names":[],"mappings":";;;;;AAGA,kDAA4C;AAC5C,+DAAsC;AAEtC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,uGAAuG;IACpH,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,UAAU;YAChB,WAAW,EACT,oOAAoO;YACtO,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,MAAM,EAAE;YACN,KAAK,EAAE,QAAQ;YACf,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,IAAI;YACf,WAAW,EACT,uGAAuG;YACzG,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;oBAC/B,IAAI,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;oBAC7B,IAAI,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE;iBACnC;aACF;SACF;QACD,WAAW,EAAE;YACX,KAAK,EAAE,aAAa;YACpB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,iDAAiD;YAC9D,OAAO,EAAE;gBACP,OAAO,EAAE,cAAc;aACxB;SACF;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAChD,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAA;QAC7B,MAAM,IAAI,GAAG,QAAQ,IAAI,eAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,eAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAA;QAEnG,OAAO,MAAM,OAAO,CAAC,GAAG,mBAAO,aAAa,EAAE;YAC5C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,SAAS,EAAE,QAAQ,CAAC,SAAS;gBAC7B,GAAG,EAAE,QAAQ,CAAC,UAAU;gBACxB,KAAK,EAAE;oBACL,IAAI;oBACJ,MAAM,EAAE,OAAO,CAAC,MAAM;oBACtB,WAAW,EAAE,OAAO,CAAC,WAAW;iBACjC;aACF;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/calliper/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/calliper/identifyGroup/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const constants_1 = require("../utils/constants");
|
|
7
|
+
const dayjs_1 = __importDefault(require("../../../lib/dayjs"));
|
|
8
|
+
const action = {
|
|
9
|
+
title: 'Identify Group',
|
|
10
|
+
description: 'Updates or adds properties to a group. Group is created if it does not exist.',
|
|
11
|
+
defaultSubscription: 'type = "group"',
|
|
12
|
+
fields: {
|
|
13
|
+
time: {
|
|
14
|
+
label: 'Timestamp',
|
|
15
|
+
type: 'datetime',
|
|
16
|
+
description: 'The timestamp of the event. Could be any date string/number value compatible with JavaScript Date constructor: e.g. milliseconds epoch or an ISO datetime. If time is not sent with the event, it will be set to the request time.',
|
|
17
|
+
default: {
|
|
18
|
+
'@path': '$.timestamp'
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
group_id: {
|
|
22
|
+
label: 'Group ID',
|
|
23
|
+
type: 'string',
|
|
24
|
+
description: 'The unique identifier of the group.',
|
|
25
|
+
required: true,
|
|
26
|
+
default: {
|
|
27
|
+
'@path': '$.groupId'
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
traits: {
|
|
31
|
+
label: 'Group Properties',
|
|
32
|
+
type: 'object',
|
|
33
|
+
description: 'The properties to set on the group profile.',
|
|
34
|
+
default: {
|
|
35
|
+
'@path': '$.traits'
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
perform: async (request, { payload, settings }) => {
|
|
40
|
+
const datetime = payload.time;
|
|
41
|
+
const time = datetime && dayjs_1.default.utc(datetime).isValid() ? dayjs_1.default.utc(datetime).valueOf() : Date.now();
|
|
42
|
+
return await request(`${constants_1.API_URL}/group/identify`, {
|
|
43
|
+
method: 'post',
|
|
44
|
+
json: {
|
|
45
|
+
companyId: settings.companyId,
|
|
46
|
+
key: settings.segmentKey,
|
|
47
|
+
group: { time, group_id: payload.group_id, traits: payload.traits }
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
exports.default = action;
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/calliper/identifyGroup/index.ts"],"names":[],"mappings":";;;;;AAGA,kDAA4C;AAC5C,+DAAsC;AAEtC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,+EAA+E;IAC5F,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,UAAU;YAChB,WAAW,EACT,oOAAoO;YACtO,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,qCAAqC;YAClD,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,WAAW;aACrB;SACF;QACD,MAAM,EAAE;YACN,KAAK,EAAE,kBAAkB;YACzB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,6CAA6C;YAC1D,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAChD,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAA;QAC7B,MAAM,IAAI,GAAG,QAAQ,IAAI,eAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,eAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAA;QAEnG,OAAO,MAAM,OAAO,CAAC,GAAG,mBAAO,iBAAiB,EAAE;YAChD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,SAAS,EAAE,QAAQ,CAAC,SAAS;gBAC7B,GAAG,EAAE,QAAQ,CAAC,UAAU;gBACxB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE;aACpE;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
time?: string | number;
|
|
3
|
+
user_id?: string | null;
|
|
4
|
+
anonymous_id?: string | null;
|
|
5
|
+
first_name?: string;
|
|
6
|
+
last_name?: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
email?: string;
|
|
9
|
+
phone?: string;
|
|
10
|
+
created_at?: string | number;
|
|
11
|
+
traits?: {
|
|
12
|
+
[k: string]: unknown;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/calliper/identifyUser/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,152 @@
|
|
|
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 constants_1 = require("../utils/constants");
|
|
8
|
+
const helpers_1 = require("../utils/helpers");
|
|
9
|
+
const dayjs_1 = __importDefault(require("../../../lib/dayjs"));
|
|
10
|
+
const action = {
|
|
11
|
+
title: 'Identify User',
|
|
12
|
+
description: 'Set the user ID to recognise other evens by the same user',
|
|
13
|
+
defaultSubscription: 'type = "identify"',
|
|
14
|
+
fields: {
|
|
15
|
+
time: {
|
|
16
|
+
label: 'Timestamp',
|
|
17
|
+
type: 'datetime',
|
|
18
|
+
description: 'The timestamp of the event. Could be any date string/number value compatible with JavaScript Date constructor: e.g. milliseconds epoch or an ISO datetime. If time is not sent with the event, it will be set to the request time.',
|
|
19
|
+
default: {
|
|
20
|
+
'@path': '$.timestamp'
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
user_id: {
|
|
24
|
+
label: 'User ID',
|
|
25
|
+
type: 'string',
|
|
26
|
+
allowNull: true,
|
|
27
|
+
description: 'A distinct ID of an identified (logged in) user.',
|
|
28
|
+
default: {
|
|
29
|
+
'@path': '$.userId'
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
anonymous_id: {
|
|
33
|
+
label: 'Anonymous ID',
|
|
34
|
+
type: 'string',
|
|
35
|
+
allowNull: true,
|
|
36
|
+
description: 'A distinct ID of an unidentified (logged out) user. Device id is used if available',
|
|
37
|
+
default: {
|
|
38
|
+
'@path': '$.anonymousId'
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
first_name: {
|
|
42
|
+
description: "User's first name",
|
|
43
|
+
label: 'First Name',
|
|
44
|
+
type: 'string',
|
|
45
|
+
required: false,
|
|
46
|
+
default: {
|
|
47
|
+
'@if': {
|
|
48
|
+
exists: { '@path': '$.traits.first_name' },
|
|
49
|
+
then: { '@path': '$.traits.first_name' },
|
|
50
|
+
else: { '@path': '$.traits.firstName' }
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
last_name: {
|
|
55
|
+
description: "User's last name",
|
|
56
|
+
label: 'Last Name',
|
|
57
|
+
type: 'string',
|
|
58
|
+
required: false,
|
|
59
|
+
default: {
|
|
60
|
+
'@if': {
|
|
61
|
+
exists: { '@path': '$.traits.last_name' },
|
|
62
|
+
then: { '@path': '$.traits.last_name' },
|
|
63
|
+
else: { '@path': '$.traits.lastName' }
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
name: {
|
|
68
|
+
description: "User's full name",
|
|
69
|
+
label: 'Name',
|
|
70
|
+
type: 'string',
|
|
71
|
+
required: false,
|
|
72
|
+
default: {
|
|
73
|
+
'@path': '$.traits.name'
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
email: {
|
|
77
|
+
description: "User's email address",
|
|
78
|
+
label: 'Email',
|
|
79
|
+
type: 'string',
|
|
80
|
+
required: false,
|
|
81
|
+
default: {
|
|
82
|
+
'@path': '$.traits.email'
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
phone: {
|
|
86
|
+
description: "User's phone number",
|
|
87
|
+
label: 'Phone',
|
|
88
|
+
type: 'string',
|
|
89
|
+
required: false,
|
|
90
|
+
default: {
|
|
91
|
+
'@path': '$.traits.phone'
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
created_at: {
|
|
95
|
+
description: 'The timestamp for when the user profile was first created',
|
|
96
|
+
label: 'User Creation Time',
|
|
97
|
+
type: 'datetime',
|
|
98
|
+
required: false,
|
|
99
|
+
default: {
|
|
100
|
+
'@if': {
|
|
101
|
+
exists: { '@path': '$.traits.createdAt' },
|
|
102
|
+
then: { '@path': '$.traits.createdAt' },
|
|
103
|
+
else: { '@path': '$.traits.created_at' }
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
traits: {
|
|
108
|
+
label: 'User Properties',
|
|
109
|
+
type: 'object',
|
|
110
|
+
description: 'Properties to set on the user profile',
|
|
111
|
+
default: {
|
|
112
|
+
'@path': '$.traits'
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
perform: async (request, { payload, settings }) => {
|
|
117
|
+
const datetime = payload.time;
|
|
118
|
+
const time = datetime && dayjs_1.default.utc(datetime).isValid() ? dayjs_1.default.utc(datetime).valueOf() : Date.now();
|
|
119
|
+
const name = helpers_1.formatName(payload.first_name, payload.last_name, payload.name);
|
|
120
|
+
return await request(`${constants_1.API_URL}/user/identify`, {
|
|
121
|
+
method: 'post',
|
|
122
|
+
json: {
|
|
123
|
+
companyId: settings.companyId,
|
|
124
|
+
key: settings.segmentKey,
|
|
125
|
+
user: {
|
|
126
|
+
time,
|
|
127
|
+
user_id: payload.user_id,
|
|
128
|
+
anonymous_id: payload.anonymous_id,
|
|
129
|
+
created_at: payload.created_at,
|
|
130
|
+
email: payload.email,
|
|
131
|
+
first_name: payload.first_name,
|
|
132
|
+
last_name: payload.last_name,
|
|
133
|
+
name,
|
|
134
|
+
phone: payload.phone,
|
|
135
|
+
traits: actions_core_1.omit(payload.traits, [
|
|
136
|
+
'created',
|
|
137
|
+
'email',
|
|
138
|
+
'firstName',
|
|
139
|
+
'first_name',
|
|
140
|
+
'lastName',
|
|
141
|
+
'last_name',
|
|
142
|
+
'name',
|
|
143
|
+
'username',
|
|
144
|
+
'phone'
|
|
145
|
+
])
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
exports.default = action;
|
|
152
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/calliper/identifyUser/index.ts"],"names":[],"mappings":";;;;;AACA,wDAA4C;AAG5C,kDAA4C;AAC5C,8CAA6C;AAC7C,+DAAsC;AAEtC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,2DAA2D;IACxE,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,UAAU;YAChB,WAAW,EACT,oOAAoO;YACtO,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,OAAO,EAAE;YACP,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,IAAI;YACf,WAAW,EAAE,kDA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7B,GAAG,EAAE,QAAQ,CAAC,UAAU;gBACxB,IAAI,EAAE;oBACJ,IAAI;oBACJ,OAAO,EAAE,OAAO,CAAC,OAAO;oBACxB,YAAY,EAAE,OAAO,CAAC,YAAY;oBAClC,UAAU,EAAE,OAAO,CAAC,UAAU;oBAC9B,KAAK,EAAE,OAAO,CAAC,KAAK;oBACpB,UAAU,EAAE,OAAO,CAAC,UAAU;oBAC9B,SAAS,EAAE,OAAO,CAAC,SAAS;oBAC5B,IAAI;oBACJ,KAAK,EAAE,OAAO,CAAC,KAAK;oBACpB,MAAM,EAAE,mBAAI,CAAC,OAAO,CAAC,MAAM,EAAE;wBAC3B,SAAS;wBACT,OAAO;wBACP,WAAW;wBACX,YAAY;wBACZ,UAAU;wBACV,WAAW;wBACX,MAAM;wBACN,UAAU;wBACV,OAAO;qBACR,CAAC;iBACH;aACF;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,81 @@
|
|
|
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 constants_1 = require("./utils/constants");
|
|
8
|
+
const trackEvent_1 = __importDefault(require("./trackEvent"));
|
|
9
|
+
const identifyUser_1 = __importDefault(require("./identifyUser"));
|
|
10
|
+
const identifyGroup_1 = __importDefault(require("./identifyGroup"));
|
|
11
|
+
const alias_1 = __importDefault(require("./alias"));
|
|
12
|
+
const destination = {
|
|
13
|
+
name: 'Calliper Cloud (Actions)',
|
|
14
|
+
slug: 'calliper-cloud-actions',
|
|
15
|
+
mode: 'cloud',
|
|
16
|
+
authentication: {
|
|
17
|
+
scheme: 'custom',
|
|
18
|
+
fields: {
|
|
19
|
+
companyId: {
|
|
20
|
+
label: 'Company id',
|
|
21
|
+
description: 'Your company id in Calliper. During the onboarding you can find it by selecting Segment integration. After onboarding is complete you can find it by opening "Data Sources" in the main menu, pressing "New Data Source" and pressing "Connect" on a Segment card.',
|
|
22
|
+
type: 'string',
|
|
23
|
+
required: true
|
|
24
|
+
},
|
|
25
|
+
segmentKey: {
|
|
26
|
+
label: 'Segment Key',
|
|
27
|
+
description: 'Your Segment Key in Calliper. Please follow the instructions to find the Company id, secret key is located in a field next to it.',
|
|
28
|
+
type: 'string',
|
|
29
|
+
required: true
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
testAuthentication: (request, { settings }) => {
|
|
33
|
+
return request(`${constants_1.API_URL}/validate-credentials`, {
|
|
34
|
+
method: 'post',
|
|
35
|
+
json: {
|
|
36
|
+
companyId: settings.companyId,
|
|
37
|
+
key: settings.segmentKey
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
onDelete: async (request, { settings, payload }) => {
|
|
43
|
+
if (!payload.userId)
|
|
44
|
+
throw new actions_core_1.IntegrationError('User id is required for deletion', 'Missing required field', 400);
|
|
45
|
+
return request(`${constants_1.API_URL}/user/${payload.userId}`, {
|
|
46
|
+
method: 'delete',
|
|
47
|
+
json: {
|
|
48
|
+
companyId: settings.companyId,
|
|
49
|
+
key: settings.segmentKey
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
presets: [
|
|
54
|
+
{
|
|
55
|
+
name: 'Track Event',
|
|
56
|
+
subscribe: 'type = "track"',
|
|
57
|
+
partnerAction: 'trackEvent',
|
|
58
|
+
mapping: actions_core_1.defaultValues(trackEvent_1.default.fields)
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'Identify User',
|
|
62
|
+
subscribe: 'type = "identify"',
|
|
63
|
+
partnerAction: 'identifyUser',
|
|
64
|
+
mapping: actions_core_1.defaultValues(identifyUser_1.default.fields)
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: 'Identify Group',
|
|
68
|
+
subscribe: 'type = "group"',
|
|
69
|
+
partnerAction: 'identifyGroup',
|
|
70
|
+
mapping: actions_core_1.defaultValues(identifyGroup_1.default.fields)
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
actions: {
|
|
74
|
+
trackEvent: trackEvent_1.default,
|
|
75
|
+
identifyUser: identifyUser_1.default,
|
|
76
|
+
identifyGroup: identifyGroup_1.default,
|
|
77
|
+
alias: alias_1.default
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
exports.default = destination;
|
|
81
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/calliper/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAuE;AAGvE,iDAA2C;AAE3C,8DAAqC;AAErC,kEAAyC;AAEzC,oEAA2C;AAE3C,oDAA2B;AAE3B,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,0BAA0B;IAChC,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,SAAS,EAAE;gBACT,KAAK,EAAE,YAAY;gBACnB,WAAW,EACT,oQAAoQ;gBACtQ,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,UAAU,EAAE;gBACV,KAAK,EAAE,aAAa;gBACpB,WAAW,EACT,mIAAmI;gBACrI,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;SACF;QAED,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;YAC5C,OAAO,OAAO,CAAC,GAAG,mBAAO,uBAAuB,EAAE;gBAChD,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE;oBACJ,SAAS,EAAE,QAAQ,CAAC,SAAS;oBA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