@segment/action-destinations 3.64.0 → 3.65.1-alpha.2
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/amplitude/index.js +10 -2
- package/dist/destinations/amplitude/index.js.map +1 -1
- package/dist/destinations/amplitude/logEvent/generated-types.d.ts +0 -8
- package/dist/destinations/amplitude/logEvent/index.d.ts +3 -0
- package/dist/destinations/amplitude/logEvent/index.js +113 -171
- package/dist/destinations/amplitude/logEvent/index.js.map +1 -1
- package/dist/destinations/amplitude/logPurchase/generated-types.d.ts +64 -0
- package/dist/destinations/amplitude/logPurchase/generated-types.js +3 -0
- package/dist/destinations/amplitude/logPurchase/generated-types.js.map +1 -0
- package/dist/destinations/amplitude/logPurchase/index.d.ts +5 -0
- package/dist/destinations/amplitude/logPurchase/index.js +95 -0
- package/dist/destinations/amplitude/logPurchase/index.js.map +1 -0
- package/dist/destinations/talon-one/updateCustomerProfilesAttributes/generated-types.d.ts +6 -4
- package/dist/destinations/talon-one/updateCustomerProfilesAttributes/index.js +17 -9
- package/dist/destinations/talon-one/updateCustomerProfilesAttributes/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -6,16 +6,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const actions_core_1 = require("@segment/actions-core");
|
|
7
7
|
const identifyUser_1 = __importDefault(require("./identifyUser"));
|
|
8
8
|
const logEvent_1 = __importDefault(require("./logEvent"));
|
|
9
|
+
const logPurchase_1 = __importDefault(require("./logPurchase"));
|
|
9
10
|
const mapUser_1 = __importDefault(require("./mapUser"));
|
|
10
11
|
const groupIdentifyUser_1 = __importDefault(require("./groupIdentifyUser"));
|
|
11
12
|
const regional_endpoints_1 = require("./regional-endpoints");
|
|
12
13
|
const presets = [
|
|
13
14
|
{
|
|
14
15
|
name: 'Track Calls',
|
|
15
|
-
subscribe: 'type = "track"',
|
|
16
|
+
subscribe: 'type = "track" and event != "Order Completed"',
|
|
16
17
|
partnerAction: 'logEvent',
|
|
17
18
|
mapping: actions_core_1.defaultValues(logEvent_1.default.fields)
|
|
18
19
|
},
|
|
20
|
+
{
|
|
21
|
+
name: 'Order Completed Calls',
|
|
22
|
+
subscribe: 'type = "track" and event = "Order Completed"',
|
|
23
|
+
partnerAction: 'logPurchase',
|
|
24
|
+
mapping: actions_core_1.defaultValues(logPurchase_1.default.fields)
|
|
25
|
+
},
|
|
19
26
|
{
|
|
20
27
|
name: 'Page Calls',
|
|
21
28
|
subscribe: 'type = "page"',
|
|
@@ -111,7 +118,8 @@ const destination = {
|
|
|
111
118
|
logEvent: logEvent_1.default,
|
|
112
119
|
identifyUser: identifyUser_1.default,
|
|
113
120
|
mapUser: mapUser_1.default,
|
|
114
|
-
groupIdentifyUser: groupIdentifyUser_1.default
|
|
121
|
+
groupIdentifyUser: groupIdentifyUser_1.default,
|
|
122
|
+
logPurchase: logPurchase_1.default
|
|
115
123
|
}
|
|
116
124
|
};
|
|
117
125
|
exports.default = destination;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/amplitude/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAqD;AACrD,kEAAyC;AACzC,0DAAiC;AACjC,wDAA+B;AAC/B,4EAAmD;AAEnD,6DAA0D;AAG1D,MAAM,OAAO,GAAqC;IAChD;QACE,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/amplitude/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAqD;AACrD,kEAAyC;AACzC,0DAAiC;AACjC,gEAAuC;AACvC,wDAA+B;AAC/B,4EAAmD;AAEnD,6DAA0D;AAG1D,MAAM,OAAO,GAAqC;IAChD;QACE,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,+CAA+C;QAC1D,aAAa,EAAE,UAAU;QACzB,OAAO,EAAE,4BAAa,CAAC,kBAAQ,CAAC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"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export interface Payload {
|
|
2
|
-
trackRevenuePerProduct?: boolean;
|
|
3
2
|
user_id?: string | null;
|
|
4
3
|
device_id?: string;
|
|
5
4
|
event_type: string;
|
|
@@ -42,13 +41,6 @@ export interface Payload {
|
|
|
42
41
|
event_id?: number;
|
|
43
42
|
insert_id?: string;
|
|
44
43
|
library?: string;
|
|
45
|
-
products?: {
|
|
46
|
-
price?: number;
|
|
47
|
-
quantity?: number;
|
|
48
|
-
revenue?: number;
|
|
49
|
-
productId?: string;
|
|
50
|
-
revenueType?: string;
|
|
51
|
-
}[];
|
|
52
44
|
use_batch_endpoint?: boolean;
|
|
53
45
|
userAgent?: string;
|
|
54
46
|
userAgentParsing?: boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ActionDefinition } from '@segment/actions-core';
|
|
2
2
|
import type { Settings } from '../generated-types';
|
|
3
3
|
import type { Payload } from './generated-types';
|
|
4
|
+
import { InputField } from '@segment/actions-core';
|
|
4
5
|
export interface AmplitudeEvent extends Omit<Payload, 'products' | 'trackRevenuePerProduct' | 'time' | 'session_id'> {
|
|
5
6
|
library?: string;
|
|
6
7
|
time?: number;
|
|
@@ -9,5 +10,7 @@ export interface AmplitudeEvent extends Omit<Payload, 'products' | 'trackRevenue
|
|
|
9
10
|
min_id_length: number;
|
|
10
11
|
};
|
|
11
12
|
}
|
|
13
|
+
export declare function doPerform(request: Function, payload: Payload, settings: Settings, eventFunction: Function): any;
|
|
14
|
+
export declare const fields: Record<string, InputField>;
|
|
12
15
|
declare const action: ActionDefinition<Settings, Payload>;
|
|
13
16
|
export default action;
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.fields = exports.doPerform = void 0;
|
|
6
7
|
const actions_core_1 = require("@segment/actions-core");
|
|
7
8
|
const dayjs_1 = __importDefault(require("../../../lib/dayjs"));
|
|
8
9
|
const event_schema_1 = require("../event-schema");
|
|
@@ -11,187 +12,128 @@ const referrer_1 = require("../referrer");
|
|
|
11
12
|
const merge_user_properties_1 = require("../merge-user-properties");
|
|
12
13
|
const user_agent_1 = require("../user-agent");
|
|
13
14
|
const regional_endpoints_1 = require("../regional-endpoints");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
function getEvents(payload, properties) {
|
|
16
|
+
const events = [
|
|
17
|
+
{
|
|
18
|
+
...(payload.userAgentParsing && user_agent_1.parseUserAgentProperties(payload.userAgent)),
|
|
19
|
+
...actions_core_1.removeUndefined(properties),
|
|
20
|
+
library: 'segment'
|
|
21
|
+
}
|
|
22
|
+
];
|
|
23
|
+
return events;
|
|
24
|
+
}
|
|
25
|
+
function doPerform(request, payload, settings, eventFunction) {
|
|
26
|
+
const { time, session_id, userAgent, userAgentParsing, utm_properties, referrer, min_id_length, library, ...rest } = payload;
|
|
27
|
+
const properties = rest;
|
|
28
|
+
let options;
|
|
29
|
+
if (properties.platform) {
|
|
30
|
+
properties.platform = properties.platform.replace(/ios/i, 'iOS').replace(/android/i, 'Android');
|
|
31
|
+
}
|
|
32
|
+
if (library) {
|
|
33
|
+
if (library === 'analytics.js')
|
|
34
|
+
properties.platform = 'Web';
|
|
35
|
+
}
|
|
36
|
+
if (time && dayjs_1.default.utc(time).isValid()) {
|
|
37
|
+
properties.time = dayjs_1.default.utc(time).valueOf();
|
|
38
|
+
}
|
|
39
|
+
if (session_id && dayjs_1.default.utc(session_id).isValid()) {
|
|
40
|
+
properties.session_id = dayjs_1.default.utc(session_id).valueOf();
|
|
18
41
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
42
|
+
if (Object.keys(payload.utm_properties ?? {}).length || payload.referrer) {
|
|
43
|
+
properties.user_properties = merge_user_properties_1.mergeUserProperties(utm_1.convertUTMProperties({ utm_properties }), referrer_1.convertReferrerProperty({ referrer }), actions_core_1.omit(properties.user_properties ?? {}, ['utm_properties', 'referrer']));
|
|
44
|
+
}
|
|
45
|
+
if (min_id_length && min_id_length > 0) {
|
|
46
|
+
options = { min_id_length };
|
|
47
|
+
}
|
|
48
|
+
const events = eventFunction(payload, properties);
|
|
49
|
+
const endpoint = regional_endpoints_1.getEndpointByRegion(payload.use_batch_endpoint ? 'batch' : 'httpapi', settings.endpoint);
|
|
50
|
+
return request(endpoint, {
|
|
51
|
+
method: 'post',
|
|
52
|
+
json: {
|
|
53
|
+
api_key: settings.apiKey,
|
|
54
|
+
events,
|
|
55
|
+
options
|
|
56
|
+
}
|
|
57
|
+
});
|
|
26
58
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
description: 'Revenue = price * quantity. If you send all 3 fields of price, quantity, and revenue, then (price * quantity) will be used as the revenue value. You can use negative values to indicate refunds.'
|
|
59
|
-
},
|
|
60
|
-
productId: {
|
|
61
|
-
label: 'Product ID',
|
|
62
|
-
type: 'string',
|
|
63
|
-
description: 'An identifier for the item purchased. You must send a price and quantity or revenue with this field.'
|
|
64
|
-
},
|
|
65
|
-
revenueType: {
|
|
66
|
-
label: 'Revenue Type',
|
|
67
|
-
type: 'string',
|
|
68
|
-
description: 'The type of revenue for the item purchased. You must send a price and quantity or revenue with this field.'
|
|
69
|
-
}
|
|
59
|
+
exports.doPerform = doPerform;
|
|
60
|
+
exports.fields = {
|
|
61
|
+
...event_schema_1.eventSchema,
|
|
62
|
+
use_batch_endpoint: {
|
|
63
|
+
label: 'Use Batch Endpoint',
|
|
64
|
+
description: "If true, events are sent to Amplitude's `batch` endpoint rather than their `httpapi` events endpoint. Enabling this setting may help reduce 429s – or throttling errors – from Amplitude. More information about Amplitude's throttling is available in [their docs](https://developers.amplitude.com/docs/batch-event-upload-api#429s-in-depth).",
|
|
65
|
+
type: 'boolean',
|
|
66
|
+
default: false
|
|
67
|
+
},
|
|
68
|
+
userAgent: {
|
|
69
|
+
label: 'User Agent',
|
|
70
|
+
type: 'string',
|
|
71
|
+
description: 'The user agent of the device sending the event.',
|
|
72
|
+
default: {
|
|
73
|
+
'@path': '$.context.userAgent'
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
userAgentParsing: {
|
|
77
|
+
label: 'User Agent Parsing',
|
|
78
|
+
type: 'boolean',
|
|
79
|
+
description: 'Enabling this setting will set the Device manufacturer, Device Model and OS Name properties based on the user agent string provided in the userAgent field',
|
|
80
|
+
default: true
|
|
81
|
+
},
|
|
82
|
+
utm_properties: {
|
|
83
|
+
label: 'UTM Properties',
|
|
84
|
+
type: 'object',
|
|
85
|
+
description: 'UTM Tracking Properties',
|
|
86
|
+
properties: {
|
|
87
|
+
utm_source: {
|
|
88
|
+
label: 'UTM Source',
|
|
89
|
+
type: 'string'
|
|
70
90
|
},
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
},
|
|
75
|
-
use_batch_endpoint: {
|
|
76
|
-
label: 'Use Batch Endpoint',
|
|
77
|
-
description: "If true, events are sent to Amplitude's `batch` endpoint rather than their `httpapi` events endpoint. Enabling this setting may help reduce 429s – or throttling errors – from Amplitude. More information about Amplitude's throttling is available in [their docs](https://developers.amplitude.com/docs/batch-event-upload-api#429s-in-depth).",
|
|
78
|
-
type: 'boolean',
|
|
79
|
-
default: false
|
|
80
|
-
},
|
|
81
|
-
userAgent: {
|
|
82
|
-
label: 'User Agent',
|
|
83
|
-
type: 'string',
|
|
84
|
-
description: 'The user agent of the device sending the event.',
|
|
85
|
-
default: {
|
|
86
|
-
'@path': '$.context.userAgent'
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
userAgentParsing: {
|
|
90
|
-
label: 'User Agent Parsing',
|
|
91
|
-
type: 'boolean',
|
|
92
|
-
description: 'Enabling this setting will set the Device manufacturer, Device Model and OS Name properties based on the user agent string provided in the userAgent field',
|
|
93
|
-
default: true
|
|
94
|
-
},
|
|
95
|
-
utm_properties: {
|
|
96
|
-
label: 'UTM Properties',
|
|
97
|
-
type: 'object',
|
|
98
|
-
description: 'UTM Tracking Properties',
|
|
99
|
-
properties: {
|
|
100
|
-
utm_source: {
|
|
101
|
-
label: 'UTM Source',
|
|
102
|
-
type: 'string'
|
|
103
|
-
},
|
|
104
|
-
utm_medium: {
|
|
105
|
-
label: 'UTM Medium',
|
|
106
|
-
type: 'string'
|
|
107
|
-
},
|
|
108
|
-
utm_campaign: {
|
|
109
|
-
label: 'UTM Campaign',
|
|
110
|
-
type: 'string'
|
|
111
|
-
},
|
|
112
|
-
utm_term: {
|
|
113
|
-
label: 'UTM Term',
|
|
114
|
-
type: 'string'
|
|
115
|
-
},
|
|
116
|
-
utm_content: {
|
|
117
|
-
label: 'UTM Content',
|
|
118
|
-
type: 'string'
|
|
119
|
-
}
|
|
91
|
+
utm_medium: {
|
|
92
|
+
label: 'UTM Medium',
|
|
93
|
+
type: 'string'
|
|
120
94
|
},
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
description: 'The referrer of the web request. Sent to Amplitude as both last touch “referrer” and first touch “initial_referrer”',
|
|
133
|
-
default: {
|
|
134
|
-
'@path': '$.context.page.referrer'
|
|
95
|
+
utm_campaign: {
|
|
96
|
+
label: 'UTM Campaign',
|
|
97
|
+
type: 'string'
|
|
98
|
+
},
|
|
99
|
+
utm_term: {
|
|
100
|
+
label: 'UTM Term',
|
|
101
|
+
type: 'string'
|
|
102
|
+
},
|
|
103
|
+
utm_content: {
|
|
104
|
+
label: 'UTM Content',
|
|
105
|
+
type: 'string'
|
|
135
106
|
}
|
|
136
107
|
},
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
108
|
+
default: {
|
|
109
|
+
utm_source: { '@path': '$.context.campaign.source' },
|
|
110
|
+
utm_medium: { '@path': '$.context.campaign.medium' },
|
|
111
|
+
utm_campaign: { '@path': '$.context.campaign.name' },
|
|
112
|
+
utm_term: { '@path': '$.context.campaign.term' },
|
|
113
|
+
utm_content: { '@path': '$.context.campaign.content' }
|
|
142
114
|
}
|
|
143
115
|
},
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
if (library) {
|
|
152
|
-
if (library === 'analytics.js')
|
|
153
|
-
properties.platform = 'Web';
|
|
154
|
-
}
|
|
155
|
-
if (time && dayjs_1.default.utc(time).isValid()) {
|
|
156
|
-
properties.time = dayjs_1.default.utc(time).valueOf();
|
|
157
|
-
}
|
|
158
|
-
if (session_id && dayjs_1.default.utc(session_id).isValid()) {
|
|
159
|
-
properties.session_id = dayjs_1.default.utc(session_id).valueOf();
|
|
160
|
-
}
|
|
161
|
-
if (Object.keys(payload.utm_properties ?? {}).length || payload.referrer) {
|
|
162
|
-
properties.user_properties = merge_user_properties_1.mergeUserProperties(utm_1.convertUTMProperties({ utm_properties }), referrer_1.convertReferrerProperty({ referrer }), actions_core_1.omit(properties.user_properties ?? {}, ['utm_properties', 'referrer']));
|
|
116
|
+
referrer: {
|
|
117
|
+
label: 'Referrer',
|
|
118
|
+
type: 'string',
|
|
119
|
+
description: 'The referrer of the web request. Sent to Amplitude as both last touch “referrer” and first touch “initial_referrer”',
|
|
120
|
+
default: {
|
|
121
|
+
'@path': '$.context.page.referrer'
|
|
163
122
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
...actions_core_1.removeUndefined(properties),
|
|
171
|
-
...(products.length && trackRevenuePerProduct ? {} : getRevenueProperties(payload)),
|
|
172
|
-
library: 'segment'
|
|
173
|
-
}
|
|
174
|
-
];
|
|
175
|
-
for (const product of products) {
|
|
176
|
-
events.push({
|
|
177
|
-
...properties,
|
|
178
|
-
...(trackRevenuePerProduct ? getRevenueProperties(product) : {}),
|
|
179
|
-
event_properties: product,
|
|
180
|
-
event_type: 'Product Purchased',
|
|
181
|
-
insert_id: properties.insert_id ? `${properties.insert_id}-${events.length + 1}` : undefined,
|
|
182
|
-
library: 'segment'
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
const endpoint = regional_endpoints_1.getEndpointByRegion(payload.use_batch_endpoint ? 'batch' : 'httpapi', settings.endpoint);
|
|
186
|
-
return request(endpoint, {
|
|
187
|
-
method: 'post',
|
|
188
|
-
json: {
|
|
189
|
-
api_key: settings.apiKey,
|
|
190
|
-
events,
|
|
191
|
-
options
|
|
192
|
-
}
|
|
193
|
-
});
|
|
123
|
+
},
|
|
124
|
+
min_id_length: {
|
|
125
|
+
label: 'Minimum ID Length',
|
|
126
|
+
description: 'Amplitude has a default minimum id lenght of 5 characters for user_id and device_id fields. This field allows the minimum to be overridden to allow shorter id lengths.',
|
|
127
|
+
allowNull: true,
|
|
128
|
+
type: 'integer'
|
|
194
129
|
}
|
|
195
130
|
};
|
|
131
|
+
const action = {
|
|
132
|
+
title: 'Log Event',
|
|
133
|
+
description: 'Send an event to Amplitude.',
|
|
134
|
+
defaultSubscription: 'type = "track" and event != "Order Completed"',
|
|
135
|
+
fields: exports.fields,
|
|
136
|
+
perform: (request, { payload, settings }) => doPerform(request, payload, settings, getEvents)
|
|
137
|
+
};
|
|
196
138
|
exports.default = action;
|
|
197
139
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/amplitude/logEvent/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/amplitude/logEvent/index.ts"],"names":[],"mappings":";;;;;;AAAA,wDAA6D;AAC7D,+DAAsC;AACtC,kDAA6C;AAI7C,gCAA6C;AAC7C,0CAAqD;AACrD,oEAA8D;AAC9D,8CAAwD;AACxD,8DAA2D;AAW3D,SAAS,SAAS,CAAC,OAAgB,EAAE,UAA0B;IAC7D,MAAM,MAAM,GAAqB;QAC/B;YAEE,GAAG,CAAC,OAAO,CAAC,gBAAgB,IAAI,qCAAwB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YAE5E,GAAG,8BAAe,CAAC,UAAU,CAAC;YAC9B,OAAO,EAAE,SAAS;SACnB;KACF,CAAA;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAgB,SAAS,CAAC,OAAiB,EAAE,OAAgB,EAAE,QAAkB,EAAE,aAAuB;IACxG,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAChH,OAAO,CAAA;IACT,MAAM,UAAU,GAAG,IAAsB,CAAA;IACzC,IAAI,OAAO,CAAA;IAEX,IAAI,UAAU,CAAC,QAAQ,EAAE;QACvB,UAAU,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,SAAS,CAAC,CAAA;KAChG;IAED,IAAI,OAAO,EAAE;QACX,IAAI,OAAO,KAAK,cAAc;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IACD,QAAQ,EAAE;QACR,KAAK,EAAE,UAAU;QACjB,IAAI,EAAE,QAAQ;QACd,WAAW,EACT,qHAAqH;QACvH,OAAO,EAAE;YACP,OAAO,EAAE,yBAAyB;SACnC;KACF;IACD,aAAa,EAAE;QACb,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EACT,yKAAyK;QAC3K,SAAS,EAAE,IAAI;QACf,IAAI,EAAE,SAAS;KAChB;CACF,CAAA;AAED,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,WAAW;IAClB,WAAW,EAAE,6BAA6B;IAC1C,mBAAmB,EAAE,+CAA+C;IACpE,MAAM,EAAN,cAAM;IACN,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC;CAC9F,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
user_id?: string | null;
|
|
3
|
+
device_id?: string;
|
|
4
|
+
event_type: string;
|
|
5
|
+
session_id?: string | number;
|
|
6
|
+
time?: string | number;
|
|
7
|
+
event_properties?: {
|
|
8
|
+
[k: string]: unknown;
|
|
9
|
+
};
|
|
10
|
+
user_properties?: {
|
|
11
|
+
[k: string]: unknown;
|
|
12
|
+
};
|
|
13
|
+
groups?: {
|
|
14
|
+
[k: string]: unknown;
|
|
15
|
+
};
|
|
16
|
+
app_version?: string;
|
|
17
|
+
platform?: string;
|
|
18
|
+
os_name?: string;
|
|
19
|
+
os_version?: string;
|
|
20
|
+
device_brand?: string;
|
|
21
|
+
device_manufacturer?: string;
|
|
22
|
+
device_model?: string;
|
|
23
|
+
carrier?: string;
|
|
24
|
+
country?: string;
|
|
25
|
+
region?: string;
|
|
26
|
+
city?: string;
|
|
27
|
+
dma?: string;
|
|
28
|
+
language?: string;
|
|
29
|
+
price?: number;
|
|
30
|
+
quantity?: number;
|
|
31
|
+
revenue?: number;
|
|
32
|
+
productId?: string;
|
|
33
|
+
revenueType?: string;
|
|
34
|
+
location_lat?: number;
|
|
35
|
+
location_lng?: number;
|
|
36
|
+
ip?: string;
|
|
37
|
+
idfa?: string;
|
|
38
|
+
idfv?: string;
|
|
39
|
+
adid?: string;
|
|
40
|
+
android_id?: string;
|
|
41
|
+
event_id?: number;
|
|
42
|
+
insert_id?: string;
|
|
43
|
+
library?: string;
|
|
44
|
+
use_batch_endpoint?: boolean;
|
|
45
|
+
userAgent?: string;
|
|
46
|
+
userAgentParsing?: boolean;
|
|
47
|
+
utm_properties?: {
|
|
48
|
+
utm_source?: string;
|
|
49
|
+
utm_medium?: string;
|
|
50
|
+
utm_campaign?: string;
|
|
51
|
+
utm_term?: string;
|
|
52
|
+
utm_content?: string;
|
|
53
|
+
};
|
|
54
|
+
referrer?: string;
|
|
55
|
+
min_id_length?: number | null;
|
|
56
|
+
trackRevenuePerProduct?: boolean;
|
|
57
|
+
products?: {
|
|
58
|
+
price?: number;
|
|
59
|
+
quantity?: number;
|
|
60
|
+
revenue?: number;
|
|
61
|
+
productId?: string;
|
|
62
|
+
revenueType?: string;
|
|
63
|
+
}[];
|
|
64
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/amplitude/logPurchase/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
4
|
+
const user_agent_1 = require("../user-agent");
|
|
5
|
+
const logEvent_1 = require("../logEvent");
|
|
6
|
+
const logEvent_2 = require("../logEvent");
|
|
7
|
+
const revenueKeys = ['revenue', 'price', 'productId', 'quantity', 'revenueType'];
|
|
8
|
+
function getRevenueProperties(payload) {
|
|
9
|
+
if (typeof payload.revenue !== 'number') {
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
revenue: payload.revenue,
|
|
14
|
+
revenueType: payload.revenueType ?? 'Purchase',
|
|
15
|
+
quantity: typeof payload.quantity === 'number' ? Math.round(payload.quantity) : undefined,
|
|
16
|
+
price: payload.price,
|
|
17
|
+
productId: payload.productId
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function getEvents(payload, properties) {
|
|
21
|
+
const { products = [], userAgent, userAgentParsing, trackRevenuePerProduct } = payload;
|
|
22
|
+
properties = actions_core_1.omit(properties, revenueKeys);
|
|
23
|
+
const events = [
|
|
24
|
+
{
|
|
25
|
+
...(userAgentParsing && user_agent_1.parseUserAgentProperties(userAgent)),
|
|
26
|
+
...actions_core_1.removeUndefined(properties),
|
|
27
|
+
...(products?.length && trackRevenuePerProduct ? {} : getRevenueProperties(payload)),
|
|
28
|
+
library: 'segment'
|
|
29
|
+
}
|
|
30
|
+
];
|
|
31
|
+
for (const product of products) {
|
|
32
|
+
events.push({
|
|
33
|
+
...properties,
|
|
34
|
+
...(trackRevenuePerProduct ? getRevenueProperties(product) : {}),
|
|
35
|
+
event_properties: product,
|
|
36
|
+
event_type: 'Product Purchased',
|
|
37
|
+
insert_id: properties.insert_id ? `${properties.insert_id}-${events.length + 1}` : undefined,
|
|
38
|
+
library: 'segment'
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return events;
|
|
42
|
+
}
|
|
43
|
+
const action = {
|
|
44
|
+
title: 'Log Purchase',
|
|
45
|
+
description: 'Send an event to Amplitude.',
|
|
46
|
+
defaultSubscription: 'type = "track" and event = "Order Completed"',
|
|
47
|
+
fields: {
|
|
48
|
+
...logEvent_2.fields,
|
|
49
|
+
trackRevenuePerProduct: {
|
|
50
|
+
label: 'Track Revenue Per Product',
|
|
51
|
+
description: 'When enabled, track revenue with each product within the event. When disabled, track total revenue once for the event.',
|
|
52
|
+
type: 'boolean',
|
|
53
|
+
default: false
|
|
54
|
+
},
|
|
55
|
+
products: {
|
|
56
|
+
label: 'Products',
|
|
57
|
+
description: 'The list of products purchased.',
|
|
58
|
+
type: 'object',
|
|
59
|
+
multiple: true,
|
|
60
|
+
properties: {
|
|
61
|
+
price: {
|
|
62
|
+
label: 'Price',
|
|
63
|
+
type: 'number',
|
|
64
|
+
description: 'The price of the item purchased. Required for revenue data if the revenue field is not sent. You can use negative values to indicate refunds.'
|
|
65
|
+
},
|
|
66
|
+
quantity: {
|
|
67
|
+
label: 'Quantity',
|
|
68
|
+
type: 'integer',
|
|
69
|
+
description: 'The quantity of the item purchased. Defaults to 1 if not specified.'
|
|
70
|
+
},
|
|
71
|
+
revenue: {
|
|
72
|
+
label: 'Revenue',
|
|
73
|
+
type: 'number',
|
|
74
|
+
description: 'Revenue = price * quantity. If you send all 3 fields of price, quantity, and revenue, then (price * quantity) will be used as the revenue value. You can use negative values to indicate refunds.'
|
|
75
|
+
},
|
|
76
|
+
productId: {
|
|
77
|
+
label: 'Product ID',
|
|
78
|
+
type: 'string',
|
|
79
|
+
description: 'An identifier for the item purchased. You must send a price and quantity or revenue with this field.'
|
|
80
|
+
},
|
|
81
|
+
revenueType: {
|
|
82
|
+
label: 'Revenue Type',
|
|
83
|
+
type: 'string',
|
|
84
|
+
description: 'The type of revenue for the item purchased. You must send a price and quantity or revenue with this field.'
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
default: {
|
|
88
|
+
'@path': '$.properties.products'
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
perform: (request, { payload, settings }) => logEvent_1.doPerform(request, payload, settings, getEvents)
|
|
93
|
+
};
|
|
94
|
+
exports.default = action;
|
|
95
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/amplitude/logPurchase/index.ts"],"names":[],"mappings":";;AAAA,wDAA6D;AAI7D,8CAAwD;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4GAA4G;iBAC/G;aACF;YACD,OAAO,EAAE;gBACP,OAAO,EAAE,uBAAuB;aACjC;SACF;KACF;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,oBAAS,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC;CAC9F,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -5,20 +5,28 @@ const action = {
|
|
|
5
5
|
title: 'Update Multiple Customer Profiles’ Attributes',
|
|
6
6
|
description: 'This updates attributes for multiple customer profiles.',
|
|
7
7
|
fields: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
data: {
|
|
9
|
+
label: 'Data item to change customer profile attributes',
|
|
10
|
+
description: 'An array of JSON objects that contains customer profile identifier and list of attributes and their values. Customer profile ID is required.',
|
|
11
|
+
type: 'object',
|
|
12
|
+
multiple: true,
|
|
13
|
+
properties: {
|
|
14
|
+
customerProfileId: { ...t1_properties_1.customerProfileId },
|
|
15
|
+
attributes: { ...t1_properties_1.attribute }
|
|
16
|
+
},
|
|
17
|
+
required: true
|
|
18
|
+
},
|
|
19
|
+
mutualAttributes: {
|
|
20
|
+
...t1_properties_1.attribute,
|
|
21
|
+
label: 'Mutual Attribute-Value pairs',
|
|
22
|
+
description: 'This may contain mutual list of attributes and their values for every customer profile in the "data" array.'
|
|
23
|
+
}
|
|
11
24
|
},
|
|
12
25
|
perform: (request, { payload }) => {
|
|
13
26
|
return request(`https://integration.talon.one/segment/customer_profiles/attributes`, {
|
|
14
27
|
method: 'put',
|
|
15
28
|
json: {
|
|
16
|
-
data:
|
|
17
|
-
{
|
|
18
|
-
customerProfileId: payload.customerProfileId,
|
|
19
|
-
attributes: payload.attributes
|
|
20
|
-
}
|
|
21
|
-
],
|
|
29
|
+
data: payload.data,
|
|
22
30
|
mutualAttributes: payload.mutualAttributes
|
|
23
31
|
}
|
|
24
32
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/talon-one/updateCustomerProfilesAttributes/index.ts"],"names":[],"mappings":";;AAGA,oDAA+D;AAE/D,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,+CAA+C;IACtD,WAAW,EAAE,yDAAyD;IACtE,MAAM,EAAE;QACN,iBAAiB,EAAE,EAAE,GAAG,iCAAiB,EAAE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/talon-one/updateCustomerProfilesAttributes/index.ts"],"names":[],"mappings":";;AAGA,oDAA+D;AAE/D,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,+CAA+C;IACtD,WAAW,EAAE,yDAAyD;IACtE,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,KAAK,EAAE,iDAAiD;YACxD,WAAW,EACT,8IAA8I;YAChJ,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE;gBACV,iBAAiB,EAAE,EAAE,GAAG,iCAAiB,EAAE;gBAC3C,UAAU,EAAE,EAAE,GAAG,yBAAS,EAAE;aAC7B;YACD,QAAQ,EAAE,IAAI;SACf;QACD,gBAAgB,EAAE;YAChB,GAAG,yBAAS;YACZ,KAAK,EAAE,8BAA8B;YACrC,WAAW,EACT,6GAA6G;SAChH;KACF;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAEhC,OAAO,OAAO,CAAC,oEAAoE,EAAE;YACnF,MAAM,EAAE,KAAK;YACb,IAAI,EAAE;gBACJ,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;aAC3C;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segment/action-destinations",
|
|
3
3
|
"description": "Destination Actions engine and definitions.",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.65.1-alpha.2",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"<rootDir>/test/setup-after-env.ts"
|
|
63
63
|
]
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "74398773721b79c87c155f93f55c3a1382d0d5fc"
|
|
66
66
|
}
|