@segment/action-destinations 3.244.0 → 3.245.0
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-s3tc/index.js +3 -3
- package/dist/destinations/acoustic-s3tc/index.js.map +1 -1
- package/dist/destinations/acoustic-s3tc/receiveEvents/eventprocessing.d.ts +6 -1
- package/dist/destinations/acoustic-s3tc/receiveEvents/eventprocessing.js +26 -25
- package/dist/destinations/acoustic-s3tc/receiveEvents/eventprocessing.js.map +1 -1
- package/dist/destinations/acoustic-s3tc/receiveEvents/generated-types.d.ts +1 -1
- package/dist/destinations/acoustic-s3tc/receiveEvents/index.js +12 -10
- package/dist/destinations/acoustic-s3tc/receiveEvents/index.js.map +1 -1
- package/dist/destinations/avo/index.js +4 -4
- package/dist/destinations/avo/index.js.map +1 -1
- package/dist/destinations/customerio/createUpdateDevice/generated-types.d.ts +3 -0
- package/dist/destinations/customerio/createUpdateDevice/index.js +29 -17
- package/dist/destinations/customerio/createUpdateDevice/index.js.map +1 -1
- package/dist/destinations/customerio/createUpdateObject/generated-types.d.ts +3 -0
- package/dist/destinations/customerio/createUpdateObject/index.js +80 -39
- package/dist/destinations/customerio/createUpdateObject/index.js.map +1 -1
- package/dist/destinations/customerio/createUpdatePerson/generated-types.d.ts +4 -1
- package/dist/destinations/customerio/createUpdatePerson/index.d.ts +1 -1
- package/dist/destinations/customerio/createUpdatePerson/index.js +51 -41
- package/dist/destinations/customerio/createUpdatePerson/index.js.map +1 -1
- package/dist/destinations/customerio/deleteDevice/index.js +15 -5
- package/dist/destinations/customerio/deleteDevice/index.js.map +1 -1
- 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 +37 -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 +78 -0
- package/dist/destinations/customerio/deleteRelationship/index.js.map +1 -0
- package/dist/destinations/customerio/index.js +39 -15
- package/dist/destinations/customerio/index.js.map +1 -1
- package/dist/destinations/customerio/mergePeople/generated-types.d.ts +4 -0
- package/dist/destinations/customerio/mergePeople/generated-types.js +3 -0
- package/dist/destinations/customerio/mergePeople/generated-types.js.map +1 -0
- package/dist/destinations/customerio/mergePeople/index.d.ts +5 -0
- package/dist/destinations/customerio/mergePeople/index.js +52 -0
- package/dist/destinations/customerio/mergePeople/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 +37 -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/trackEvent/index.js +26 -32
- package/dist/destinations/customerio/trackEvent/index.js.map +1 -1
- package/dist/destinations/customerio/trackPageView/generated-types.d.ts +1 -0
- package/dist/destinations/customerio/trackPageView/index.js +26 -29
- package/dist/destinations/customerio/trackPageView/index.js.map +1 -1
- package/dist/destinations/customerio/trackScreenView/generated-types.d.ts +1 -0
- package/dist/destinations/customerio/trackScreenView/index.js +25 -29
- package/dist/destinations/customerio/trackScreenView/index.js.map +1 -1
- 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 +37 -0
- package/dist/destinations/customerio/unsuppressPerson/index.js.map +1 -0
- package/dist/destinations/customerio/utils.d.ts +46 -2
- package/dist/destinations/customerio/utils.js +88 -13
- package/dist/destinations/customerio/utils.js.map +1 -1
- package/dist/destinations/klaviyo/orderCompleted/index.js +29 -12
- package/dist/destinations/klaviyo/orderCompleted/index.js.map +1 -1
- package/dist/destinations/responsys/sendAudience/index.js +0 -1
- package/dist/destinations/responsys/sendAudience/index.js.map +1 -1
- package/dist/destinations/responsys/sendCustomTraits/index.js +0 -1
- package/dist/destinations/responsys/sendCustomTraits/index.js.map +1 -1
- package/dist/destinations/responsys/upsertListMember/index.js +2 -5
- package/dist/destinations/responsys/upsertListMember/index.js.map +1 -1
- package/dist/destinations/responsys/utils.d.ts +0 -1
- package/dist/destinations/responsys/utils.js +4 -14
- package/dist/destinations/responsys/utils.js.map +1 -1
- package/dist/destinations/schematic/trackEvent/generated-types.d.ts +1 -0
- package/dist/destinations/schematic/trackEvent/index.js +19 -3
- package/dist/destinations/schematic/trackEvent/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/_tests_/index.test.js +4 -352
- package/dist/destinations/snap-conversions-api/_tests_/index.test.js.map +1 -1
- package/dist/destinations/snap-conversions-api/reportConversionEvent/index.js +24 -20
- package/dist/destinations/snap-conversions-api/reportConversionEvent/index.js.map +1 -1
- 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 +125 -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 +19 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/utils.js +62 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/utils.js.map +1 -0
- package/dist/destinations/snap-conversions-api/snap-capi-properties.d.ts +0 -5
- package/dist/destinations/snap-conversions-api/snap-capi-properties.js +1 -86
- package/dist/destinations/snap-conversions-api/snap-capi-properties.js.map +1 -1
- package/dist/destinations/tiktok-conversions-sandbox/index.js +2 -2
- package/dist/destinations/tiktok-conversions-sandbox/index.js.map +1 -1
- package/dist/destinations/tiktok-offline-conversions-sandbox/index.js +2 -2
- package/dist/destinations/tiktok-offline-conversions-sandbox/index.js.map +1 -1
- package/dist/destinations/tiktok-offline-conversions-sandbox/reportOfflineEvent/index.js +1 -1
- package/dist/destinations/tiktok-offline-conversions-sandbox/reportOfflineEvent/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../utils");
|
|
4
|
+
const action = {
|
|
5
|
+
title: 'Merge People',
|
|
6
|
+
description: 'Merge two customer profiles together.',
|
|
7
|
+
defaultSubscription: 'type = "alias"',
|
|
8
|
+
fields: {
|
|
9
|
+
primary: {
|
|
10
|
+
label: 'Primary User',
|
|
11
|
+
description: `The person that you want to remain after the merge, identified by id, email or cio_id. This person receives information from the secondary person in the merge.`,
|
|
12
|
+
type: 'string',
|
|
13
|
+
required: true,
|
|
14
|
+
default: {
|
|
15
|
+
'@path': '$.userId'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
secondary: {
|
|
19
|
+
label: 'Secondary User',
|
|
20
|
+
description: `The person that you want to delete after the merge, identified by id, email or cio_id. This person's information is merged into the primary person's profile and then it is deleted.`,
|
|
21
|
+
type: 'string',
|
|
22
|
+
required: true,
|
|
23
|
+
default: {
|
|
24
|
+
'@path': '$.previousId'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
performBatch: (request, { payload: payloads, settings }) => {
|
|
29
|
+
return utils_1.sendBatch(request, payloads.map((payload) => ({
|
|
30
|
+
action: 'merge',
|
|
31
|
+
payload: mapPayload(payload),
|
|
32
|
+
settings,
|
|
33
|
+
type: 'person'
|
|
34
|
+
})));
|
|
35
|
+
},
|
|
36
|
+
perform: (request, { payload, settings }) => {
|
|
37
|
+
return utils_1.sendSingle(request, {
|
|
38
|
+
action: 'merge',
|
|
39
|
+
payload: mapPayload(payload),
|
|
40
|
+
settings,
|
|
41
|
+
type: 'person'
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
function mapPayload(payload) {
|
|
46
|
+
return {
|
|
47
|
+
primary: utils_1.resolveIdentifiers({ person_id: payload.primary }),
|
|
48
|
+
secondary: utils_1.resolveIdentifiers({ person_id: payload.secondary })
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
exports.default = action;
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/mergePeople/index.ts"],"names":[],"mappings":";;AAGA,oCAAoE;AAEpE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,cAAc;IACrB,WAAW,EAAE,uCAAuC;IACpD,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,OAAO,EAAE;YACP,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,iKAAiK;YAC9K,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;QACD,SAAS,EAAE;YACT,KAAK,EAAE,gBAAgB;YACvB,WAAW,EAAE,sLAAsL;YACnM,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,cAAc;aACxB;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,OAAO;YACf,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC;YAC5B,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,OAAO;YACf,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC;YAC5B,QAAQ;YACR,IAAI,EAAE,QAAQ;SACf,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,SAAS,UAAU,CAAC,OAAgB;IAClC,OAAO;QACL,OAAO,EAAE,0BAAkB,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3D,SAAS,EAAE,0BAAkB,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC;KAChE,CAAA;AACH,CAAC;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/reportDeliveryEvent/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../utils");
|
|
4
|
+
const action = {
|
|
5
|
+
title: 'Report Delivery Event',
|
|
6
|
+
description: 'Report delivery metrics for a message sent from the Customer.io Journeys product.',
|
|
7
|
+
defaultSubscription: 'event = "Report Delivery Event"',
|
|
8
|
+
fields: {
|
|
9
|
+
delivery_id: {
|
|
10
|
+
label: 'Delivery ID',
|
|
11
|
+
description: 'The CIO-Delivery-ID from the message that you want to associate the metric with.',
|
|
12
|
+
type: 'string',
|
|
13
|
+
default: {
|
|
14
|
+
'@path': '$.properties.deliveryId'
|
|
15
|
+
},
|
|
16
|
+
required: true
|
|
17
|
+
},
|
|
18
|
+
metric: {
|
|
19
|
+
label: 'Metric',
|
|
20
|
+
description: `The metric you want to report back to Customer.io. Not all metrics are available for all channels. Please refer to the [documentation](https://customer.io/docs/api/track/#operation/metrics) for more information.`,
|
|
21
|
+
type: 'string',
|
|
22
|
+
default: {
|
|
23
|
+
'@path': '$.properties.metric'
|
|
24
|
+
},
|
|
25
|
+
required: true,
|
|
26
|
+
choices: [
|
|
27
|
+
{ label: 'Delivered', value: 'delivered' },
|
|
28
|
+
{ label: 'Opened', value: 'opened' },
|
|
29
|
+
{ label: 'Clicked', value: 'clicked' },
|
|
30
|
+
{ label: 'Converted', value: 'converted' },
|
|
31
|
+
{ label: 'Marked as Spam', value: 'spammed' },
|
|
32
|
+
{ label: 'Bounced', value: 'bounced' },
|
|
33
|
+
{ label: 'Suppressed', value: 'dropped' },
|
|
34
|
+
{ label: 'Deferred', value: 'deferred' }
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
recipient: {
|
|
38
|
+
label: 'Recipient',
|
|
39
|
+
description: `Information about who the message was delivered to. For email, SMS and mobile push this is the email address, phone number and device token, respectively.`,
|
|
40
|
+
type: 'string',
|
|
41
|
+
default: {
|
|
42
|
+
'@path': '$.properties.recipient'
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
reason: {
|
|
46
|
+
label: 'Reason',
|
|
47
|
+
description: 'For metrics indicating a failure, this field provides information for the failure.',
|
|
48
|
+
type: 'string',
|
|
49
|
+
default: {
|
|
50
|
+
'@path': '$.properties.reason'
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
href: {
|
|
54
|
+
label: 'Href',
|
|
55
|
+
description: 'For click metrics, this is the link that was clicked.',
|
|
56
|
+
type: 'string',
|
|
57
|
+
default: {
|
|
58
|
+
'@path': '$.properties.href'
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
action_name: {
|
|
62
|
+
label: 'Action Name',
|
|
63
|
+
description: 'For In-App messages, this is the name of the action that was clicked.',
|
|
64
|
+
type: 'string',
|
|
65
|
+
default: {
|
|
66
|
+
'@path': '$.properties.actionName'
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
action_value: {
|
|
70
|
+
label: 'Action Value',
|
|
71
|
+
description: 'For In-App messages, this is the value of the action that was clicked.',
|
|
72
|
+
type: 'string',
|
|
73
|
+
default: {
|
|
74
|
+
'@path': '$.properties.actionValue'
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
timestamp: {
|
|
78
|
+
label: 'Timestamp',
|
|
79
|
+
description: 'A timestamp of when the metric event took place. Default is when the event was triggered.',
|
|
80
|
+
type: 'datetime',
|
|
81
|
+
format: 'date-time',
|
|
82
|
+
default: {
|
|
83
|
+
'@path': '$.timestamp'
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
perform: (request, { payload, settings }) => {
|
|
88
|
+
const metricsRequest = {
|
|
89
|
+
delivery_id: payload.delivery_id,
|
|
90
|
+
metric: payload.metric,
|
|
91
|
+
timestamp: Math.floor(Date.now() / 1000)
|
|
92
|
+
};
|
|
93
|
+
const unix_timestamp = Number(utils_1.convertValidTimestamp(payload.timestamp));
|
|
94
|
+
if (!isNaN(unix_timestamp)) {
|
|
95
|
+
metricsRequest.timestamp = unix_timestamp;
|
|
96
|
+
}
|
|
97
|
+
if (payload.recipient) {
|
|
98
|
+
metricsRequest.recipient = payload.recipient;
|
|
99
|
+
}
|
|
100
|
+
if (payload.reason) {
|
|
101
|
+
metricsRequest.reason = payload.reason;
|
|
102
|
+
}
|
|
103
|
+
if (payload.href) {
|
|
104
|
+
metricsRequest.href = payload.href;
|
|
105
|
+
}
|
|
106
|
+
if (payload.action_name) {
|
|
107
|
+
metricsRequest.metadata = metricsRequest.metadata || {};
|
|
108
|
+
metricsRequest.metadata.action_name = payload.action_name;
|
|
109
|
+
}
|
|
110
|
+
if (payload.action_value) {
|
|
111
|
+
metricsRequest.metadata = metricsRequest.metadata || {};
|
|
112
|
+
metricsRequest.metadata.action_value = payload.action_value;
|
|
113
|
+
}
|
|
114
|
+
return request(utils_1.trackApiEndpoint(settings) + '/api/v1/metrics', {
|
|
115
|
+
json: metricsRequest,
|
|
116
|
+
method: 'post'
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
exports.default = action;
|
|
121
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/reportDeliveryEvent/index.ts"],"names":[],"mappings":";;AAGA,oCAAkE;AAElE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,uBAAuB;IAC9B,WAAW,EAAE,mFAAmF;IAChG,mBAAmB,EAAE,iCAAiC;IACtD,MAAM,EAAE;QACN,WAAW,EAAE;YACX,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,kFAAkF;YAC/F,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,yBAAyB;aACnC;YACD,QAAQ,EAAE,IAAI;SACf;QACD,MAAM,EAAE;YACN,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,qNAAqN;YAClO,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,qBAAqB;aAC/B;YACD,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;gBAC1C,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;gBACpC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;gBACtC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;gBAC1C,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,EAAE;gBAC7C,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;gBACtC,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE;gBACzC,EAAE,KAAK,EAAE,UAAU,E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,GAAG,MAAM,CAAC,6BAAqB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAA;QACvE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE;YAC1B,cAAc,CAAC,SAAS,GAAG,cAAc,CAAA;SAC1C;QAED,IAAI,OAAO,CAAC,SAAS,EAAE;YACrB,cAAc,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;SAC7C;QAED,IAAI,OAAO,CAAC,MAAM,EAAE;YAClB,cAAc,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;SACvC;QAED,IAAI,OAAO,CAAC,IAAI,EAAE;YAChB,cAAc,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;SACnC;QAED,IAAI,OAAO,CAAC,WAAW,EAAE;YACvB,cAAc,CAAC,QAAQ,GAAG,cAAc,CAAC,QAAQ,IAAI,EAAE,CAAA;YACvD,cAAc,CAAC,QAAQ,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAA;SAC1D;QACD,IAAI,OAAO,CAAC,YAAY,EAAE;YACxB,cAAc,CAAC,QAAQ,GAAG,cAAc,CAAC,QAAQ,IAAI,EAAE,CAAA;YACvD,cAAc,CAAC,QAAQ,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAA;SAC5D;QAED,OAAO,OAAO,CAAC,wBAAgB,CAAC,QAAQ,CAAC,GAAG,iBAAiB,EAAE;YAC7D,IAAI,EAAE,cAAc;YACpB,MAAM,EAAE,MAAM;SACf,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAoBD,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/suppressPerson/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 of the person that this mobile device belongs to.',
|
|
12
|
+
type: 'string',
|
|
13
|
+
required: true,
|
|
14
|
+
default: {
|
|
15
|
+
'@path': '$.userId'
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
performBatch: (request, { payload: payloads, settings }) => {
|
|
20
|
+
return utils_1.sendBatch(request, payloads.map((payload) => ({
|
|
21
|
+
action: 'suppress',
|
|
22
|
+
payload,
|
|
23
|
+
settings,
|
|
24
|
+
type: 'person'
|
|
25
|
+
})));
|
|
26
|
+
},
|
|
27
|
+
perform: (request, { payload, settings }) => {
|
|
28
|
+
return utils_1.sendSingle(request, {
|
|
29
|
+
action: 'suppress',
|
|
30
|
+
payload,
|
|
31
|
+
settings,
|
|
32
|
+
type: 'person'
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
exports.default = action;
|
|
37
|
+
//# 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,EAAE,0DAA0D;YACvE,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;KACF;IAED,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE;QACzD,OAAO,iBAAS,CACd,OAAO,EACP,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACzB,MAAM,EAAE,UAAU;YAClB,OAAO;YACP,QAAQ;YACR,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC,CACJ,CAAA;IACH,CAAC;IAED,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC1C,OAAO,kBAAU,CAAC,OAAO,EAAE;YACzB,MAAM,EAAE,UAAU;YAClB,OAAO;YACP,QAAQ;YACR,IAAI,EAAE,QAAQ;SACf,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="lodash" />
|
|
2
|
+
import nock from 'nock';
|
|
3
|
+
import { AccountRegion } from './utils';
|
|
4
|
+
export declare const nockTrackInternalEndpoint: (region: AccountRegion) => nock.Scope;
|
|
5
|
+
export declare function getDefaultMappings(action: string): import("lodash").Dictionary<import("@segment/actions-core/src/destination-kit/types").FieldValue | undefined>;
|
|
6
|
+
export declare function testRunner(fn: Function): void;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.testRunner = exports.getDefaultMappings = exports.nockTrackInternalEndpoint = void 0;
|
|
7
|
+
const nock_1 = __importDefault(require("nock"));
|
|
8
|
+
const mapValues_1 = __importDefault(require("lodash/mapValues"));
|
|
9
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
10
|
+
const index_1 = __importDefault(require("./index"));
|
|
11
|
+
const utils_1 = require("./utils");
|
|
12
|
+
const testDestination = actions_core_1.createTestIntegration(index_1.default);
|
|
13
|
+
var EndpointType;
|
|
14
|
+
(function (EndpointType) {
|
|
15
|
+
EndpointType["BATCH"] = "batch";
|
|
16
|
+
EndpointType["SINGLE"] = "entity";
|
|
17
|
+
})(EndpointType || (EndpointType = {}));
|
|
18
|
+
const endpointByType = {
|
|
19
|
+
[EndpointType.BATCH]: 'batch',
|
|
20
|
+
[EndpointType.SINGLE]: 'entity'
|
|
21
|
+
};
|
|
22
|
+
const trackServiceByRegion = {
|
|
23
|
+
[utils_1.AccountRegion.US]: nock_1.default('https://track.customer.io'),
|
|
24
|
+
[utils_1.AccountRegion.EU]: nock_1.default('https://track-eu.customer.io')
|
|
25
|
+
};
|
|
26
|
+
function wrapFn(fn, type, region) {
|
|
27
|
+
return () => {
|
|
28
|
+
const settings = {
|
|
29
|
+
siteId: '12345',
|
|
30
|
+
apiKey: 'abcde',
|
|
31
|
+
accountRegion: region
|
|
32
|
+
};
|
|
33
|
+
const action = async (name, args) => {
|
|
34
|
+
const actionFn = {
|
|
35
|
+
[EndpointType.BATCH]: testDestination.testBatchAction,
|
|
36
|
+
[EndpointType.SINGLE]: testDestination.testAction
|
|
37
|
+
}[type];
|
|
38
|
+
if (type === EndpointType.BATCH) {
|
|
39
|
+
args.events = [args.event];
|
|
40
|
+
}
|
|
41
|
+
const responses = (await actionFn?.call(testDestination, name, args));
|
|
42
|
+
if (!responses.length) {
|
|
43
|
+
if (type === EndpointType.BATCH) {
|
|
44
|
+
await testDestination.testAction(name, args);
|
|
45
|
+
}
|
|
46
|
+
throw new Error(`No responses received.`);
|
|
47
|
+
}
|
|
48
|
+
expect(responses.length).toBe(1);
|
|
49
|
+
expect(responses[0].status).toBe(200);
|
|
50
|
+
expect(responses[0].headers.toJSON()).toMatchObject({
|
|
51
|
+
'content-type': 'application/json'
|
|
52
|
+
});
|
|
53
|
+
expect(responses[0].data).toMatchObject({});
|
|
54
|
+
if (type === EndpointType.BATCH) {
|
|
55
|
+
return responses[0].options.json.batch[0];
|
|
56
|
+
}
|
|
57
|
+
return responses[0].options.json;
|
|
58
|
+
};
|
|
59
|
+
return fn(settings, action);
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const nockTrackInternalEndpoint = (region) => trackServiceByRegion[region];
|
|
63
|
+
exports.nockTrackInternalEndpoint = nockTrackInternalEndpoint;
|
|
64
|
+
function getDefaultMappings(action) {
|
|
65
|
+
const fields = testDestination.definition.actions[action].fields;
|
|
66
|
+
const defaultMappings = mapValues_1.default(fields, 'default');
|
|
67
|
+
return defaultMappings;
|
|
68
|
+
}
|
|
69
|
+
exports.getDefaultMappings = getDefaultMappings;
|
|
70
|
+
function testRunner(fn) {
|
|
71
|
+
describe.each(Object.values(endpointByType))(`when using %s requests`, (type) => {
|
|
72
|
+
describe.each(Object.values(utils_1.AccountRegion))(`when using the %s region`, (region) => {
|
|
73
|
+
beforeEach(() => {
|
|
74
|
+
trackServiceByRegion[region].post(`/api/v2/${type}`).reply(200, {});
|
|
75
|
+
});
|
|
76
|
+
afterEach(() => {
|
|
77
|
+
nock_1.default.cleanAll();
|
|
78
|
+
});
|
|
79
|
+
return wrapFn(fn, type, region)();
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
exports.testRunner = testRunner;
|
|
84
|
+
//# sourceMappingURL=test-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-helper.js","sourceRoot":"","sources":["../../../src/destinations/customerio/test-helper.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,iEAAwC;AACxC,wDAAgF;AAChF,oDAAgC;AAEhC,mCAAuC;AAEvC,MAAM,eAAe,GAAG,oCAAqB,CAAC,eAAU,CAAC,CAAA;AAEzD,IAAK,YAGJ;AAHD,WAAK,YAAY;IACf,+BAAe,CAAA;IACf,iCAAiB,CAAA;AACnB,CAAC,EAHI,Y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E,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"}
|
|
@@ -4,7 +4,18 @@ const utils_1 = require("../utils");
|
|
|
4
4
|
const action = {
|
|
5
5
|
title: 'Track Event',
|
|
6
6
|
description: 'Track an event for a known or anonymous person.',
|
|
7
|
-
defaultSubscription:
|
|
7
|
+
defaultSubscription: `
|
|
8
|
+
type = "track"
|
|
9
|
+
and event != "Application Installed"
|
|
10
|
+
and event != "Application Opened"
|
|
11
|
+
and event != "Application Uninstalled"
|
|
12
|
+
and event != "Relationship Deleted"
|
|
13
|
+
and event != "User Deleted"
|
|
14
|
+
and event != "User Suppressed"
|
|
15
|
+
and event != "User Unsuppressed"
|
|
16
|
+
and event != "Group Deleted"
|
|
17
|
+
and event != "Report Delivery Event"
|
|
18
|
+
`,
|
|
8
19
|
fields: {
|
|
9
20
|
id: {
|
|
10
21
|
label: 'Person ID',
|
|
@@ -62,38 +73,21 @@ const action = {
|
|
|
62
73
|
default: true
|
|
63
74
|
}
|
|
64
75
|
},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
timestamp = utils_1.convertValidTimestamp(timestamp);
|
|
71
|
-
}
|
|
72
|
-
if (data) {
|
|
73
|
-
data = utils_1.convertAttributeTimestamps(data);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
const body = {
|
|
77
|
-
name: payload.name,
|
|
78
|
-
data,
|
|
79
|
-
timestamp
|
|
80
|
-
};
|
|
81
|
-
if (payload.event_id) {
|
|
82
|
-
body.id = payload.event_id;
|
|
83
|
-
}
|
|
84
|
-
let url;
|
|
85
|
-
if (payload.id) {
|
|
86
|
-
url = `${utils_1.trackApiEndpoint(settings.accountRegion)}/api/v1/customers/${payload.id}/events`;
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
url = `${utils_1.trackApiEndpoint(settings.accountRegion)}/api/v1/events`;
|
|
90
|
-
body.anonymous_id = payload.anonymous_id;
|
|
91
|
-
}
|
|
92
|
-
return request(url, {
|
|
93
|
-
method: 'post',
|
|
94
|
-
json: body
|
|
95
|
-
});
|
|
76
|
+
performBatch: (request, { payload: payloads, settings }) => {
|
|
77
|
+
return utils_1.sendBatch(request, payloads.map((payload) => ({ action: 'event', payload: mapPayload(payload), settings, type: 'person' })));
|
|
78
|
+
},
|
|
79
|
+
perform: (request, { payload, settings }) => {
|
|
80
|
+
return utils_1.sendSingle(request, { action: 'event', payload: mapPayload(payload), settings, type: 'person' });
|
|
96
81
|
}
|
|
97
82
|
};
|
|
83
|
+
function mapPayload(payload) {
|
|
84
|
+
const { id, event_id, data, ...rest } = payload;
|
|
85
|
+
return {
|
|
86
|
+
...rest,
|
|
87
|
+
person_id: id,
|
|
88
|
+
id: event_id,
|
|
89
|
+
attributes: data
|
|
90
|
+
};
|
|
91
|
+
}
|
|
98
92
|
exports.default = action;
|
|
99
93
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/trackEvent/index.ts"],"names":[],"mappings":";;AAEA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/trackEvent/index.ts"],"names":[],"mappings":";;AAEA,oCAAgD;AAGhD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,iDAAiD;IAC9D,mBAAmB,EAAE;;;;;;;;;;;GAWpB;IACD,MAAM,EAAE;QACN,EAAE,EAAE;YACF,KAAK,EAAE,WAAW;YAClB,WAAW,EACT,mIAAmI;YACrI,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,cAAc;YACrB,WAAW,EACT,yGAAyG;YAC3G,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,eAAe;aACzB;SACF;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,wBAAwB;YACrC,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,SAAS;aACnB;SACF;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,WAAW,EACT,iHAAiH;YACnH,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,6EAA6E;YAC1F,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,kBAAkB;YACzB,WAAW,EAAE,0CAA0C;YACvD,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,cAAc;aACxB;SACF;QACD,iBAAiB,EAAE;YACjB,KAAK,EAAE,oBAAoB;YAC3B,WAAW,EAAE,yDAAyD;YACtE,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,IAAI;SACd;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,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CACzG,CAAA;IACH,CAAC;IAED,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC1C,OAAO,kBAAU,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;IACzG,CAAC;CACF,CAAA;AAED,SAAS,UAAU,CAAC,OAAgB;IAClC,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAA;IAE/C,OAAO;QACL,GAAG,IAAI;QACP,SAAS,EAAE,EAAE;QACb,EAAE,EAAE,QAAQ;QACZ,UAAU,EAAE,IAAI;KACjB,CAAA;AACH,CAAC;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -22,6 +22,14 @@ const action = {
|
|
|
22
22
|
'@path': '$.anonymousId'
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
|
+
event_id: {
|
|
26
|
+
label: 'Event ID',
|
|
27
|
+
description: 'An optional identifier used to deduplicate events. [Learn more](https://customer.io/docs/api/#operation/track).',
|
|
28
|
+
type: 'string',
|
|
29
|
+
default: {
|
|
30
|
+
'@path': '$.messageId'
|
|
31
|
+
}
|
|
32
|
+
},
|
|
25
33
|
url: {
|
|
26
34
|
label: 'Page URL',
|
|
27
35
|
description: 'The URL of the page visited.',
|
|
@@ -54,36 +62,25 @@ const action = {
|
|
|
54
62
|
default: true
|
|
55
63
|
}
|
|
56
64
|
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
timestamp = utils_1.convertValidTimestamp(timestamp);
|
|
63
|
-
}
|
|
64
|
-
if (data) {
|
|
65
|
-
data = utils_1.convertAttributeTimestamps(data);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
const body = {
|
|
69
|
-
name: payload.url,
|
|
70
|
-
type: 'page',
|
|
71
|
-
data,
|
|
72
|
-
timestamp
|
|
73
|
-
};
|
|
74
|
-
let url;
|
|
75
|
-
if (payload.id) {
|
|
76
|
-
url = `${utils_1.trackApiEndpoint(settings.accountRegion)}/api/v1/customers/${payload.id}/events`;
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
url = `${utils_1.trackApiEndpoint(settings.accountRegion)}/api/v1/events`;
|
|
80
|
-
body.anonymous_id = payload.anonymous_id;
|
|
81
|
-
}
|
|
82
|
-
return request(url, {
|
|
83
|
-
method: 'post',
|
|
84
|
-
json: body
|
|
85
|
-
});
|
|
65
|
+
performBatch: (request, { payload: payloads, settings }) => {
|
|
66
|
+
return utils_1.sendBatch(request, payloads.map((payload) => ({ action: 'page', payload: mapPayload(payload), settings, type: 'person' })));
|
|
67
|
+
},
|
|
68
|
+
perform: (request, { payload, settings }) => {
|
|
69
|
+
return utils_1.sendSingle(request, { action: 'page', payload: mapPayload(payload), settings, type: 'person' });
|
|
86
70
|
}
|
|
87
71
|
};
|
|
72
|
+
function mapPayload(payload) {
|
|
73
|
+
const { id, event_id, url, data, ...rest } = payload;
|
|
74
|
+
const result = {
|
|
75
|
+
...rest,
|
|
76
|
+
person_id: id,
|
|
77
|
+
name: url,
|
|
78
|
+
attributes: data
|
|
79
|
+
};
|
|
80
|
+
if (event_id) {
|
|
81
|
+
result.id = event_id;
|
|
82
|
+
}
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
88
85
|
exports.default = action;
|
|
89
86
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/trackPageView/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/trackPageView/index.ts"],"names":[],"mappings":";;AAGA,oCAAgD;AAEhD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE,oDAAoD;IACjE,mBAAmB,EAAE,eAAe;IACpC,MAAM,EAAE;QACN,EAAE,EAAE;YACF,KAAK,EAAE,WAAW;YAClB,WAAW,EACT,mIAAmI;YACrI,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,cAAc;YACrB,WAAW,EACT,yGAAyG;YAC3G,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,eAAe;aACzB;SACF;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,WAAW,EACT,iHAAiH;YACnH,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,GAAG,EAAE;YACH,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,8BAA8B;YAC3C,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,kBAAkB;aAC5B;SACF;QACD,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,6EAA6E;YAC1F,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,kBAAkB;YACzB,WAAW,EAAE,0CAA0C;YACvD,IAAI,EAAE,QAAQ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|
23
23
|
}
|
|
24
24
|
},
|
|
25
|
+
event_id: {
|
|
26
|
+
label: 'Event ID',
|
|
27
|
+
description: 'An optional identifier used to deduplicate events. [Learn more](https://customer.io/docs/api/#operation/track).',
|
|
28
|
+
type: 'string',
|
|
29
|
+
default: {
|
|
30
|
+
'@path': '$.messageId'
|
|
31
|
+
}
|
|
32
|
+
},
|
|
25
33
|
name: {
|
|
26
34
|
label: 'Screen name',
|
|
27
35
|
description: 'The name of the screen visited.',
|
|
@@ -54,36 +62,24 @@ const action = {
|
|
|
54
62
|
default: true
|
|
55
63
|
}
|
|
56
64
|
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
timestamp = utils_1.convertValidTimestamp(timestamp);
|
|
63
|
-
}
|
|
64
|
-
if (data) {
|
|
65
|
-
data = utils_1.convertAttributeTimestamps(data);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
const body = {
|
|
69
|
-
name: payload.name,
|
|
70
|
-
type: 'screen',
|
|
71
|
-
data,
|
|
72
|
-
timestamp
|
|
73
|
-
};
|
|
74
|
-
let url;
|
|
75
|
-
if (payload.id) {
|
|
76
|
-
url = `${utils_1.trackApiEndpoint(settings.accountRegion)}/api/v1/customers/${payload.id}/events`;
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
url = `${utils_1.trackApiEndpoint(settings.accountRegion)}/api/v1/events`;
|
|
80
|
-
body.anonymous_id = payload.anonymous_id;
|
|
81
|
-
}
|
|
82
|
-
return request(url, {
|
|
83
|
-
method: 'post',
|
|
84
|
-
json: body
|
|
85
|
-
});
|
|
65
|
+
performBatch: (request, { payload: payloads, settings }) => {
|
|
66
|
+
return utils_1.sendBatch(request, payloads.map((payload) => ({ action: 'screen', payload: mapPayload(payload), settings, type: 'person' })));
|
|
67
|
+
},
|
|
68
|
+
perform: (request, { payload, settings }) => {
|
|
69
|
+
return utils_1.sendSingle(request, { action: 'screen', payload: mapPayload(payload), settings, type: 'person' });
|
|
86
70
|
}
|
|
87
71
|
};
|
|
72
|
+
function mapPayload(payload) {
|
|
73
|
+
const { id, event_id, data, ...rest } = payload;
|
|
74
|
+
const result = {
|
|
75
|
+
...rest,
|
|
76
|
+
person_id: id,
|
|
77
|
+
attributes: data
|
|
78
|
+
};
|
|
79
|
+
if (event_id) {
|
|
80
|
+
result.id = event_id;
|
|
81
|
+
}
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
88
84
|
exports.default = action;
|
|
89
85
|
//# sourceMappingURL=index.js.map
|