@segment/action-destinations 3.337.2-staging.3 → 3.337.3
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/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 +41 -0
- package/dist/destinations/customerio/deletePerson/index.js.map +1 -0
- package/dist/destinations/customerio/deleteRelationship/generated-types.d.ts +6 -0
- package/dist/destinations/customerio/deleteRelationship/generated-types.js +3 -0
- package/dist/destinations/customerio/deleteRelationship/generated-types.js.map +1 -0
- package/dist/destinations/customerio/deleteRelationship/index.d.ts +5 -0
- package/dist/destinations/customerio/deleteRelationship/index.js +82 -0
- package/dist/destinations/customerio/deleteRelationship/index.js.map +1 -0
- package/dist/destinations/customerio/index.js +37 -15
- package/dist/destinations/customerio/index.js.map +1 -1
- package/dist/destinations/customerio/reportDeliveryEvent/generated-types.d.ts +10 -0
- package/dist/destinations/customerio/reportDeliveryEvent/generated-types.js +3 -0
- package/dist/destinations/customerio/reportDeliveryEvent/generated-types.js.map +1 -0
- package/dist/destinations/customerio/reportDeliveryEvent/index.d.ts +5 -0
- package/dist/destinations/customerio/reportDeliveryEvent/index.js +121 -0
- package/dist/destinations/customerio/reportDeliveryEvent/index.js.map +1 -0
- package/dist/destinations/customerio/suppressPerson/generated-types.d.ts +3 -0
- package/dist/destinations/customerio/suppressPerson/generated-types.js +3 -0
- package/dist/destinations/customerio/suppressPerson/generated-types.js.map +1 -0
- package/dist/destinations/customerio/suppressPerson/index.d.ts +5 -0
- package/dist/destinations/customerio/suppressPerson/index.js +41 -0
- package/dist/destinations/customerio/suppressPerson/index.js.map +1 -0
- package/dist/destinations/customerio/test-helper.d.ts +6 -0
- package/dist/destinations/customerio/test-helper.js +84 -0
- package/dist/destinations/customerio/test-helper.js.map +1 -0
- package/dist/destinations/customerio/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 +41 -0
- package/dist/destinations/customerio/unsuppressPerson/index.js.map +1 -0
- package/dist/destinations/customerio/utils.d.ts +44 -2
- package/dist/destinations/customerio/utils.js +88 -13
- package/dist/destinations/customerio/utils.js.map +1 -1
- package/dist/destinations/segment/segment-properties.d.ts +1 -0
- package/dist/destinations/segment/segment-properties.js +7 -1
- package/dist/destinations/segment/segment-properties.js.map +1 -1
- package/dist/destinations/segment/sendGroup/generated-types.d.ts +1 -0
- package/dist/destinations/segment/sendGroup/index.js +2 -1
- package/dist/destinations/segment/sendGroup/index.js.map +1 -1
- package/dist/destinations/segment/sendIdentify/generated-types.d.ts +1 -0
- package/dist/destinations/segment/sendIdentify/index.js +2 -1
- package/dist/destinations/segment/sendIdentify/index.js.map +1 -1
- package/dist/destinations/segment/sendPage/generated-types.d.ts +1 -0
- package/dist/destinations/segment/sendPage/index.js +2 -1
- package/dist/destinations/segment/sendPage/index.js.map +1 -1
- package/dist/destinations/segment/sendScreen/generated-types.d.ts +1 -0
- package/dist/destinations/segment/sendScreen/index.js +2 -1
- package/dist/destinations/segment/sendScreen/index.js.map +1 -1
- package/dist/destinations/segment/sendTrack/generated-types.d.ts +1 -0
- package/dist/destinations/segment/sendTrack/index.js +2 -1
- package/dist/destinations/segment/sendTrack/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
4
|
const action = {
|
|
5
5
|
title: 'Create or Update Device',
|
|
6
|
-
description: `
|
|
6
|
+
description: `Create or update a person's device.`,
|
|
7
7
|
defaultSubscription: 'type = "track" and event = "Application Installed"',
|
|
8
8
|
fields: {
|
|
9
9
|
person_id: {
|
|
@@ -49,6 +49,14 @@ const action = {
|
|
|
49
49
|
'@path': '$.timestamp'
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
|
+
attributes: {
|
|
53
|
+
label: 'Event Attributes',
|
|
54
|
+
description: `Optional data that you can reference to segment your audience, like a person's attributes, but specific to a device.`,
|
|
55
|
+
type: 'object',
|
|
56
|
+
default: {
|
|
57
|
+
'@path': '$.properties'
|
|
58
|
+
}
|
|
59
|
+
},
|
|
52
60
|
convert_timestamp: {
|
|
53
61
|
label: 'Convert Timestamps',
|
|
54
62
|
description: 'Convert dates to Unix timestamps (seconds since Epoch).',
|
|
@@ -56,23 +64,27 @@ const action = {
|
|
|
56
64
|
default: true
|
|
57
65
|
}
|
|
58
66
|
},
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
return request(`${utils_1.trackApiEndpoint(settings.accountRegion)}/api/v1/customers/${payload.person_id}/devices`, {
|
|
65
|
-
method: 'put',
|
|
66
|
-
json: {
|
|
67
|
-
device: {
|
|
68
|
-
id: payload.device_id,
|
|
69
|
-
platform: payload.platform,
|
|
70
|
-
last_used: lastUsed,
|
|
71
|
-
...(payload.app_version ? { attributes: { app_version: payload.app_version } } : {})
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
});
|
|
67
|
+
performBatch: (request, { payload: payloads, settings }) => {
|
|
68
|
+
return utils_1.sendBatch(request, payloads.map((payload) => ({ action: 'add_device', payload: mapPayload(payload), settings, type: 'person' })));
|
|
69
|
+
},
|
|
70
|
+
perform: (request, { payload, settings }) => {
|
|
71
|
+
return utils_1.sendSingle(request, { action: 'add_device', payload: mapPayload(payload), settings, type: 'person' });
|
|
75
72
|
}
|
|
76
73
|
};
|
|
74
|
+
function mapPayload(payload) {
|
|
75
|
+
const { app_version, device_id, platform, last_used, attributes, ...rest } = payload;
|
|
76
|
+
return {
|
|
77
|
+
...rest,
|
|
78
|
+
device: {
|
|
79
|
+
token: device_id,
|
|
80
|
+
platform,
|
|
81
|
+
last_used,
|
|
82
|
+
attributes: {
|
|
83
|
+
...attributes,
|
|
84
|
+
...(payload.app_version ? { app_version: payload.app_version } : {})
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
77
89
|
exports.default = action;
|
|
78
90
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/createUpdateDevice/index.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/createUpdateDevice/index.ts"],"names":[],"mappings":";;AAGA,oCAAgD;AAEhD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,yBAAyB;IAChC,WAAW,EAAE,qCAAqC;IAClD,mBAAmB,EAAE,oDAAoD;IACzE,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;QACD,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,iDAAiD;YAC9D,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,wBAAwB;aAClC;SACF;QACD,WAAW,EAAE;YACX,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,wBAAwB;YACrC,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,uBAAuB;aACjC;SACF;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,oDAAoD;YACjE,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,uBAAuB;aACjC;SACF;QACD,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,2FAA2F;YACxG,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,a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AE,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACrE;SACF;KACF,CAAA;AACH,CAAC;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -20,7 +20,11 @@ const action = {
|
|
|
20
20
|
description: 'A timestamp of when the object was created.',
|
|
21
21
|
type: 'string',
|
|
22
22
|
default: {
|
|
23
|
-
'@
|
|
23
|
+
'@if': {
|
|
24
|
+
exists: { '@path': '$.traits.created_at' },
|
|
25
|
+
then: { '@path': '$.traits.created_at' },
|
|
26
|
+
else: { '@path': '$.traits.createdAt' }
|
|
27
|
+
}
|
|
24
28
|
}
|
|
25
29
|
},
|
|
26
30
|
custom_attributes: {
|
|
@@ -28,7 +32,15 @@ const action = {
|
|
|
28
32
|
description: 'Optional attributes for the object. When updating an object, attributes are added or updated, not removed.',
|
|
29
33
|
type: 'object',
|
|
30
34
|
default: {
|
|
31
|
-
'@path': '$.traits'
|
|
35
|
+
'@path': '$.traits.objectAttributes'
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
relationship_attributes: {
|
|
39
|
+
label: 'Relationship Attributes',
|
|
40
|
+
description: 'Optional attributes for the relationship between the object and the user. When updating an relationship, attributes are added or updated, not removed.',
|
|
41
|
+
type: 'object',
|
|
42
|
+
default: {
|
|
43
|
+
'@path': '$.traits.relationshipAttributes'
|
|
32
44
|
}
|
|
33
45
|
},
|
|
34
46
|
user_id: {
|
|
@@ -52,7 +64,11 @@ const action = {
|
|
|
52
64
|
description: 'The ID used to uniquely identify a custom object type in Customer.io. [Learn more](https://customer.io/docs/object-relationships).',
|
|
53
65
|
type: 'string',
|
|
54
66
|
default: {
|
|
55
|
-
'@
|
|
67
|
+
'@if': {
|
|
68
|
+
exists: { '@path': '$.traits.object_type_id' },
|
|
69
|
+
then: { '@path': '$.traits.object_type_id' },
|
|
70
|
+
else: { '@path': '$.traits.objectTypeId' }
|
|
71
|
+
}
|
|
56
72
|
}
|
|
57
73
|
},
|
|
58
74
|
convert_timestamp: {
|
|
@@ -62,46 +78,71 @@ const action = {
|
|
|
62
78
|
default: true
|
|
63
79
|
}
|
|
64
80
|
},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (payload.convert_timestamp !== false) {
|
|
74
|
-
if (createdAt) {
|
|
75
|
-
createdAt = utils_1.convertValidTimestamp(createdAt);
|
|
76
|
-
}
|
|
77
|
-
if (customAttributes) {
|
|
78
|
-
customAttributes = utils_1.convertAttributeTimestamps(customAttributes);
|
|
79
|
-
if (customAttributes.object_type_id) {
|
|
80
|
-
objectTypeIDInTraits = customAttributes.object_type_id;
|
|
81
|
-
delete customAttributes.object_type_id;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
81
|
+
performBatch: (request, { payload: payloads, settings }) => {
|
|
82
|
+
const payloadsByAction = {
|
|
83
|
+
identify: [],
|
|
84
|
+
identify_anonymous: []
|
|
85
|
+
};
|
|
86
|
+
for (const payload of payloads) {
|
|
87
|
+
const { action, body } = mapPayload(payload);
|
|
88
|
+
payloadsByAction[action].push(body);
|
|
84
89
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
return Promise.all([
|
|
91
|
+
utils_1.sendBatch(request, payloadsByAction.identify.map((payload) => ({ action: 'identify', payload, settings, type: 'object' }))),
|
|
92
|
+
utils_1.sendBatch(request, payloadsByAction.identify_anonymous.map((payload) => ({
|
|
93
|
+
action: 'identify_anonymous',
|
|
94
|
+
payload,
|
|
95
|
+
settings,
|
|
96
|
+
type: 'object'
|
|
97
|
+
})))
|
|
98
|
+
]);
|
|
99
|
+
},
|
|
100
|
+
perform: (request, { payload, settings }) => {
|
|
101
|
+
const { action, body } = mapPayload(payload);
|
|
102
|
+
return utils_1.sendSingle(request, { action, payload: body, settings, type: 'object' });
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
function mapPayload(payload) {
|
|
106
|
+
const { id, convert_timestamp, custom_attributes, relationship_attributes, user_id, anonymous_id, object_type_id, ...rest } = payload;
|
|
107
|
+
let body = {
|
|
108
|
+
...rest,
|
|
109
|
+
anonymous_id,
|
|
110
|
+
person_id: user_id,
|
|
111
|
+
attributes: custom_attributes,
|
|
112
|
+
object_type_id: object_type_id ?? '1',
|
|
113
|
+
object_id: id
|
|
114
|
+
};
|
|
115
|
+
let rel_attrs = relationship_attributes;
|
|
116
|
+
if ('convert_timestamp' in payload && convert_timestamp !== false) {
|
|
117
|
+
body = utils_1.convertAttributeTimestamps(body);
|
|
118
|
+
if (relationship_attributes) {
|
|
119
|
+
rel_attrs = utils_1.convertAttributeTimestamps(rel_attrs);
|
|
89
120
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
121
|
+
}
|
|
122
|
+
if ('created_at' in payload && !payload.created_at) {
|
|
123
|
+
delete body.created_at;
|
|
124
|
+
}
|
|
125
|
+
if (body.attributes && 'object_type_id' in body.attributes) {
|
|
126
|
+
delete body.attributes.object_type_id;
|
|
127
|
+
}
|
|
128
|
+
let action = 'identify';
|
|
129
|
+
if (user_id) {
|
|
130
|
+
action = 'identify';
|
|
131
|
+
const relationship = { identifiers: utils_1.resolveIdentifiers({ person_id: user_id }) };
|
|
132
|
+
if (relationship_attributes) {
|
|
133
|
+
relationship.relationship_attributes = rel_attrs;
|
|
95
134
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
135
|
+
body.cio_relationships = [relationship];
|
|
136
|
+
}
|
|
137
|
+
else if (anonymous_id) {
|
|
138
|
+
action = 'identify_anonymous';
|
|
139
|
+
const relationship = { identifiers: { anonymous_id } };
|
|
140
|
+
if (relationship_attributes) {
|
|
141
|
+
relationship.relationship_attributes = rel_attrs;
|
|
99
142
|
}
|
|
100
|
-
|
|
101
|
-
method: 'post',
|
|
102
|
-
json: body
|
|
103
|
-
});
|
|
143
|
+
body.cio_relationships = [relationship];
|
|
104
144
|
}
|
|
105
|
-
};
|
|
145
|
+
return { action, body };
|
|
146
|
+
}
|
|
106
147
|
exports.default = action;
|
|
107
148
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/createUpdateObject/index.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/createUpdateObject/index.ts"],"names":[],"mappings":";;AAGA,oCAAgG;AAIhG,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,yBAAyB;IAChC,WAAW,EAAE,+DAA+D;IAC5E,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,EAAE,EAAE;YACF,KAAK,EAAE,WAAW;YAClB,WAAW,EACT,yHAAyH;YAC3H,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,WAAW;aACrB;SACF;QACD,UAAU,EAAE;YACV,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,6CAA6C;YAC1D,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE;oBAC1C,IAAI,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE;oBACxC,IAAI,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;iBACxC;aACF;SACF;QACD,iBAAiB,EAAE;YACjB,KAAK,EAAE,mBAAmB;YAC1B,WAAW,EACT,4GAA4G;YAC9G,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,2BAA2B;aACrC;SACF;QACD,uBAAuB,EAAE;YACvB,KAAK,EAAE,yBAAyB;YAChC,WAAW,EACT,wJAAwJ;YAC1J,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO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A0B,CAAC,SAAS,CAAC,CAAA;SAClD;KACF;IAED,IAAI,YAAY,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;QAClD,OAAO,IAAI,CAAC,UAAU,CAAA;KACvB;IAED,IAAI,IAAI,CAAC,UAAU,IAAI,gBAAgB,IAAK,IAAI,CAAC,UAAsC,EAAE;QACvF,OAAQ,IAAI,CAAC,UAAsC,CAAC,cAAc,CAAA;KACnE;IAED,IAAI,MAAM,GAAG,UAAU,CAAA;IAEvB,IAAI,OAAO,EAAE;QACX,MAAM,GAAG,UAAU,CAAA;QACnB,MAAM,YAAY,GAA+B,EAAE,WAAW,EAAE,0BAAkB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,CAAA;QAE5G,IAAI,uBAAuB,EAAE;YAC3B,YAAY,CAAC,uBAAuB,GAAG,SAAS,CAAA;SACjD;QACD,IAAI,CAAC,iBAAiB,GAAG,CAAC,YAAY,CAAC,CAAA;KACxC;SAAM,IAAI,YAAY,EAAE;QACvB,MAAM,GAAG,oBAAoB,CAAA;QAC7B,MAAM,YAAY,GAA+B,EAAE,WAAW,EAAE,EAAE,YAAY,EAAE,EAAE,CAAA;QAElF,IAAI,uBAAuB,EAAE;YAC3B,YAAY,CAAC,uBAAuB,GAAG,SAAS,CAAA;SACjD;QACD,IAAI,CAAC,iBAAiB,GAAG,CAAC,YAAY,CAAC,CAAA;KACxC;IAED,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;AACzB,CAAC;AACD,kBAAe,MAAM,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface Payload {
|
|
2
|
-
id
|
|
2
|
+
id?: string;
|
|
3
3
|
anonymous_id?: string;
|
|
4
4
|
email?: string;
|
|
5
5
|
created_at?: string;
|
|
@@ -7,6 +7,9 @@ export interface Payload {
|
|
|
7
7
|
custom_attributes?: {
|
|
8
8
|
[k: string]: unknown;
|
|
9
9
|
};
|
|
10
|
+
relationship_attributes?: {
|
|
11
|
+
[k: string]: unknown;
|
|
12
|
+
};
|
|
10
13
|
convert_timestamp?: boolean;
|
|
11
14
|
object_type_id?: string;
|
|
12
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ActionDefinition } from '@segment/actions-core';
|
|
2
1
|
import type { Settings } from '../generated-types';
|
|
3
2
|
import type { Payload } from './generated-types';
|
|
3
|
+
import { ActionDefinition } from '@segment/actions-core';
|
|
4
4
|
declare const action: ActionDefinition<Settings, Payload>;
|
|
5
5
|
export default action;
|
|
@@ -10,7 +10,6 @@ const action = {
|
|
|
10
10
|
label: 'Person ID',
|
|
11
11
|
description: 'The ID used to uniquely identify a person in Customer.io. [Learn more](https://customer.io/docs/identifying-people/#identifiers).',
|
|
12
12
|
type: 'string',
|
|
13
|
-
required: true,
|
|
14
13
|
default: {
|
|
15
14
|
'@if': {
|
|
16
15
|
exists: { '@path': '$.userId' },
|
|
@@ -21,7 +20,7 @@ const action = {
|
|
|
21
20
|
},
|
|
22
21
|
anonymous_id: {
|
|
23
22
|
label: 'Anonymous ID',
|
|
24
|
-
description: 'An anonymous ID
|
|
23
|
+
description: 'An optional anonymous ID. This is used to tie anonymous events to this person. [Learn more](https://customer.io/docs/anonymous-events/).',
|
|
25
24
|
type: 'string',
|
|
26
25
|
default: {
|
|
27
26
|
'@path': '$.anonymousId'
|
|
@@ -40,7 +39,11 @@ const action = {
|
|
|
40
39
|
description: 'A timestamp of when the person was created.',
|
|
41
40
|
type: 'string',
|
|
42
41
|
default: {
|
|
43
|
-
'@
|
|
42
|
+
'@if': {
|
|
43
|
+
exists: { '@path': '$.traits.created_at' },
|
|
44
|
+
then: { '@path': '$.traits.created_at' },
|
|
45
|
+
else: { '@path': '$.traits.createdAt' }
|
|
46
|
+
}
|
|
44
47
|
}
|
|
45
48
|
},
|
|
46
49
|
group_id: {
|
|
@@ -59,6 +62,14 @@ const action = {
|
|
|
59
62
|
'@path': '$.traits'
|
|
60
63
|
}
|
|
61
64
|
},
|
|
65
|
+
relationship_attributes: {
|
|
66
|
+
label: 'Relationship Attributes',
|
|
67
|
+
description: 'Optional attributes for the relationship between the object and the user. When updating an object, attributes are added or updated, not removed.',
|
|
68
|
+
type: 'object',
|
|
69
|
+
default: {
|
|
70
|
+
'@path': '$.traits.relationshipAttributes'
|
|
71
|
+
}
|
|
72
|
+
},
|
|
62
73
|
convert_timestamp: {
|
|
63
74
|
label: 'Convert Timestamps',
|
|
64
75
|
description: 'Convert dates to Unix timestamps (seconds since Epoch).',
|
|
@@ -70,49 +81,48 @@ const action = {
|
|
|
70
81
|
description: 'The ID used to uniquely identify a custom object type in Customer.io. [Learn more](https://customer.io/docs/object-relationships).',
|
|
71
82
|
type: 'string',
|
|
72
83
|
default: {
|
|
73
|
-
'@
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
perform: (request, { settings, payload }) => {
|
|
78
|
-
let createdAt = payload.created_at;
|
|
79
|
-
let customAttributes = payload.custom_attributes;
|
|
80
|
-
let objectTypeIDInTraits = null;
|
|
81
|
-
const objectId = payload.group_id;
|
|
82
|
-
const objectTypeId = payload.object_type_id;
|
|
83
|
-
if (payload.convert_timestamp !== false) {
|
|
84
|
-
if (createdAt) {
|
|
85
|
-
createdAt = utils_1.convertValidTimestamp(createdAt);
|
|
86
|
-
}
|
|
87
|
-
if (customAttributes) {
|
|
88
|
-
customAttributes = utils_1.convertAttributeTimestamps(customAttributes);
|
|
89
|
-
if (customAttributes.object_type_id && objectId) {
|
|
90
|
-
objectTypeIDInTraits = customAttributes.object_type_id;
|
|
91
|
-
delete customAttributes.object_type_id;
|
|
84
|
+
'@if': {
|
|
85
|
+
exists: { '@path': '$.traits.object_type_id' },
|
|
86
|
+
then: { '@path': '$.traits.object_type_id' },
|
|
87
|
+
else: { '@path': '$.traits.objectTypeId' }
|
|
92
88
|
}
|
|
93
89
|
}
|
|
94
90
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
},
|
|
92
|
+
performBatch: (request, { payload: payloads, settings }) => {
|
|
93
|
+
return utils_1.sendBatch(request, payloads.map((payload) => ({ action: 'identify', payload: mapPayload(payload), settings, type: 'person' })));
|
|
94
|
+
},
|
|
95
|
+
perform: (request, { payload, settings }) => {
|
|
96
|
+
return utils_1.sendSingle(request, { action: 'identify', payload: mapPayload(payload), settings, type: 'person' });
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
function mapPayload(payload) {
|
|
100
|
+
const { id, custom_attributes = {}, relationship_attributes, created_at, group_id, object_type_id, ...rest } = payload;
|
|
101
|
+
delete custom_attributes.createdAt;
|
|
102
|
+
delete custom_attributes.created_at;
|
|
103
|
+
delete custom_attributes?.object_type_id;
|
|
104
|
+
delete custom_attributes?.relationshipAttributes;
|
|
105
|
+
if (created_at) {
|
|
106
|
+
custom_attributes.created_at = created_at;
|
|
107
|
+
}
|
|
108
|
+
if (payload.email) {
|
|
109
|
+
custom_attributes.email = payload.email;
|
|
110
|
+
}
|
|
111
|
+
const body = {
|
|
112
|
+
...rest,
|
|
113
|
+
person_id: id,
|
|
114
|
+
attributes: custom_attributes
|
|
115
|
+
};
|
|
116
|
+
if (group_id) {
|
|
117
|
+
const relationship = {
|
|
118
|
+
identifiers: { object_type_id: object_type_id ?? '1', object_id: group_id }
|
|
99
119
|
};
|
|
100
|
-
if (
|
|
101
|
-
|
|
120
|
+
if (relationship_attributes) {
|
|
121
|
+
relationship.relationship_attributes = relationship_attributes;
|
|
102
122
|
}
|
|
103
|
-
|
|
104
|
-
body.cio_relationships = {
|
|
105
|
-
action: 'add_relationships',
|
|
106
|
-
relationships: [
|
|
107
|
-
{ identifiers: { object_type_id: objectTypeIDInTraits ?? objectTypeId ?? '1', object_id: objectId } }
|
|
108
|
-
]
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
return request(`${utils_1.trackApiEndpoint(settings.accountRegion)}/api/v1/customers/${payload.id}`, {
|
|
112
|
-
method: 'put',
|
|
113
|
-
json: body
|
|
114
|
-
});
|
|
123
|
+
body.cio_relationships = [relationship];
|
|
115
124
|
}
|
|
116
|
-
|
|
125
|
+
return body;
|
|
126
|
+
}
|
|
117
127
|
exports.default = action;
|
|
118
128
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/createUpdatePerson/index.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/createUpdatePerson/index.ts"],"names":[],"mappings":";;AAGA,oCAAgD;AAEhD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,yBAAyB;IAChC,WAAW,EAAE,8DAA8D;IAC3E,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,EAAE,EAAE;YACF,KAAK,EAAE,WAAW;YAClB,WAAW,EACT,mIAAmI;YACrI,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;oBAC/B,IAAI,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;oBAC7B,IAAI,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;iBACpC;aACF;SACF;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,cAAc;YACrB,WAAW,EACT,0IAA0I;YAC5I,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,eAAe;aACzB;SACF;QACD,KAAK,EAAE;YACL,KAAK,EAAE,eAAe;YACtB,WAAW,EAAE,6BAA6B;YAC1C,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,WAAW,EAAE,kBAAkB;aAChC;SACF;QACD,UAAU,EAAE;YACV,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,6CAA6C;YAC1D,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP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,CAAC,uBAAuB,GAAG,uBAAuB,CAAA;SAC/D;QACD,IAAI,CAAC,iBAAiB,GAAG,CAAC,YAAY,CAAC,CAAA;KACxC;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
4
|
const action = {
|
|
5
5
|
title: 'Delete Device',
|
|
6
|
-
description: `
|
|
6
|
+
description: `Delete a person's device.`,
|
|
7
7
|
defaultSubscription: 'event = "Application Uninstalled"',
|
|
8
8
|
fields: {
|
|
9
9
|
person_id: {
|
|
@@ -25,11 +25,21 @@ const action = {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
-
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
performBatch: (request, { payload: payloads, settings }) => {
|
|
29
|
+
return utils_1.sendBatch(request, payloads.map((payload) => ({ action: 'delete_device', payload: mapPayload(payload), settings, type: 'person' })));
|
|
30
|
+
},
|
|
31
|
+
perform: (request, { payload, settings }) => {
|
|
32
|
+
return utils_1.sendSingle(request, { action: 'delete_device', payload: mapPayload(payload), settings, type: 'person' });
|
|
32
33
|
}
|
|
33
34
|
};
|
|
35
|
+
function mapPayload(payload) {
|
|
36
|
+
const { device_id, ...rest } = payload;
|
|
37
|
+
return {
|
|
38
|
+
...rest,
|
|
39
|
+
device: {
|
|
40
|
+
token: device_id
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
34
44
|
exports.default = action;
|
|
35
45
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/deleteDevice/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/deleteDevice/index.ts"],"names":[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N,KAAK,EAAE,SAAS;SACjB;KACF,CAAA;AACH,CAAC;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/deleteObject/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../utils");
|
|
4
|
+
const action = {
|
|
5
|
+
title: 'Delete Object',
|
|
6
|
+
description: 'Delete an object in Customer.io.',
|
|
7
|
+
defaultSubscription: 'event = "Object Deleted"',
|
|
8
|
+
fields: {
|
|
9
|
+
object_id: {
|
|
10
|
+
label: 'Object ID',
|
|
11
|
+
description: 'An object ID used to identify an object.',
|
|
12
|
+
type: 'string',
|
|
13
|
+
default: {
|
|
14
|
+
'@path': '$.context.groupId'
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
object_type_id: {
|
|
18
|
+
label: 'Object Type ID',
|
|
19
|
+
description: 'An object ID type used to identify the type of object.',
|
|
20
|
+
type: 'string',
|
|
21
|
+
default: {
|
|
22
|
+
'@if': {
|
|
23
|
+
exists: { '@path': '$.properties.object_type_id' },
|
|
24
|
+
then: { '@path': '$.properties.object_type_id' },
|
|
25
|
+
else: { '@path': '$.properties.objectTypeId' }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
performBatch: (request, { payload: payloads, settings }) => {
|
|
31
|
+
return utils_1.sendBatch(request, payloads.map((payload) => ({
|
|
32
|
+
action: 'delete',
|
|
33
|
+
payload,
|
|
34
|
+
settings,
|
|
35
|
+
type: 'object'
|
|
36
|
+
})));
|
|
37
|
+
},
|
|
38
|
+
perform: (request, { payload, settings }) => {
|
|
39
|
+
return utils_1.sendSingle(request, {
|
|
40
|
+
action: 'delete',
|
|
41
|
+
payload,
|
|
42
|
+
settings,
|
|
43
|
+
type: 'object'
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
exports.default = action;
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/deleteObject/index.ts"],"names":[],"mappings":";;AAGA,oCAAgD;AAEhD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,kCAAkC;IAC/C,mBAAmB,EAAE,0BAA0B;IAC/C,MAAM,EAAE;QACN,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,0CAA0C;YACvD,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,mBAAmB;aAC7B;SACF;QACD,cAAc,EAAE;YACd,KAAK,EAAE,gBAAgB;YACvB,WAAW,EAAE,wDAAwD;YACrE,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,6BAA6B,EAAE;oBAClD,IAAI,EAAE,EAAE,OAAO,EAAE,6BAA6B,EAAE;oBAChD,IAAI,EAAE,EAAE,OAAO,EAAE,2BAA2B,EAAE;iBAC/C;aACF;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,QAAQ;YAChB,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,QAAQ;YAChB,OAAO;YACP,QAAQ;YACR,IAAI,EAAE,QAAQ;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/customerio/deletePerson/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../utils");
|
|
4
|
+
const action = {
|
|
5
|
+
title: 'Delete Person',
|
|
6
|
+
description: 'Delete a person in Customer.io.',
|
|
7
|
+
defaultSubscription: 'event = "User Deleted"',
|
|
8
|
+
fields: {
|
|
9
|
+
person_id: {
|
|
10
|
+
label: 'Person ID',
|
|
11
|
+
description: 'The ID used to uniquely identify a person in Customer.io. [Learn more](https://customer.io/docs/identifying-people/#identifiers).',
|
|
12
|
+
type: 'string',
|
|
13
|
+
default: {
|
|
14
|
+
'@if': {
|
|
15
|
+
exists: { '@path': '$.userId' },
|
|
16
|
+
then: { '@path': '$.userId' },
|
|
17
|
+
else: { '@path': '$.traits.email' }
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
required: true
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
performBatch: (request, { payload: payloads, settings }) => {
|
|
24
|
+
return utils_1.sendBatch(request, payloads.map((payload) => ({
|
|
25
|
+
action: 'delete',
|
|
26
|
+
payload,
|
|
27
|
+
settings,
|
|
28
|
+
type: 'person'
|
|
29
|
+
})));
|
|
30
|
+
},
|
|
31
|
+
perform: (request, { payload, settings }) => {
|
|
32
|
+
return utils_1.sendSingle(request, {
|
|
33
|
+
action: 'delete',
|
|
34
|
+
payload,
|
|
35
|
+
settings,
|
|
36
|
+
type: 'person'
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
exports.default = action;
|
|
41
|
+
//# sourceMappingURL=index.js.map
|