@segment/analytics-browser-mixpanel-web-actions 1.0.1-staging-b870c2b86.0 → 1.2.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/cjs/fields.js.map +1 -1
- package/dist/cjs/functions.js.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/init-script.js +15 -59
- package/dist/cjs/init-script.js.map +1 -1
- package/dist/cjs/setting-fields.js +1 -1
- package/dist/cjs/setting-fields.js.map +1 -1
- package/dist/cjs/track/index.js.map +1 -1
- package/dist/cjs/trackPageView/index.js.map +1 -1
- package/dist/esm/fields.js.map +1 -1
- package/dist/esm/functions.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/init-script.js +15 -59
- package/dist/esm/init-script.js.map +1 -1
- package/dist/esm/setting-fields.js +1 -1
- package/dist/esm/setting-fields.js.map +1 -1
- package/dist/esm/track/index.js.map +1 -1
- package/dist/esm/trackPageView/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/alias/__tests__/index.test.ts +3 -2
- package/src/constants.ts +1 -1
- package/src/fields.ts +134 -137
- package/src/functions.ts +10 -7
- package/src/group/__tests__/index.test.ts +7 -6
- package/src/group/index.ts +2 -2
- package/src/identify/__tests__/index.test.ts +13 -12
- package/src/identify/index.ts +3 -3
- package/src/index.ts +14 -14
- package/src/init-script.ts +2 -60
- package/src/setting-fields.ts +260 -260
- package/src/track/__tests__/index.test.ts +24 -23
- package/src/track/index.ts +6 -8
- package/src/trackPageView/__tests__/index.test.ts +35 -36
- package/src/trackPageView/index.ts +8 -10
- package/src/types.ts +18 -19
package/src/setting-fields.ts
CHANGED
|
@@ -2,272 +2,272 @@ import { PAGE_VIEW_URL_CONFIG_OPTIONS, PERSISTENCE_OPTIONS, AUTOCAPTURE_OPTIONS
|
|
|
2
2
|
import { GlobalSetting } from '@segment/actions-core'
|
|
3
3
|
|
|
4
4
|
export const settingFields: Record<string, GlobalSetting> = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
5
|
+
projectToken: {
|
|
6
|
+
description: 'Your Mixpanel project token.',
|
|
7
|
+
label: 'Project Token',
|
|
8
|
+
type: 'string',
|
|
9
|
+
required: true,
|
|
10
|
+
},
|
|
11
|
+
name: {
|
|
12
|
+
label: 'Mixpanel Instance Name',
|
|
13
|
+
description: 'The name for the new mixpanel instance that you want created.',
|
|
14
|
+
type: 'string'
|
|
15
|
+
},
|
|
16
|
+
api_host: {
|
|
17
|
+
description: 'The Mixpanel API host to send data to.',
|
|
18
|
+
label: 'API Host',
|
|
19
|
+
type: 'string',
|
|
20
|
+
format: 'uri',
|
|
21
|
+
required: true,
|
|
22
|
+
default: 'https://api-js.mixpanel.com'
|
|
23
|
+
},
|
|
24
|
+
autocapture: {
|
|
25
|
+
description:
|
|
26
|
+
'Enable or disable Mixpanel autocapture functionality. Select "Custom" to specify fine grained control over which events are autocaptured.',
|
|
27
|
+
label: 'Autocapture',
|
|
28
|
+
type: 'string',
|
|
29
|
+
choices: [
|
|
30
|
+
{ label: 'Enabled', value: AUTOCAPTURE_OPTIONS.ENABLED },
|
|
31
|
+
{ label: 'Disabled', value: AUTOCAPTURE_OPTIONS.DISABLED },
|
|
32
|
+
{ label: 'Custom', value: AUTOCAPTURE_OPTIONS.CUSTOM }
|
|
33
|
+
],
|
|
34
|
+
default: AUTOCAPTURE_OPTIONS.ENABLED
|
|
35
|
+
},
|
|
36
|
+
pageview: {
|
|
37
|
+
description: 'Capture pageview events automatically',
|
|
38
|
+
label: 'Autocapture Pageview',
|
|
39
|
+
type: 'string',
|
|
40
|
+
choices: [
|
|
41
|
+
{ label: 'Full URL', value: PAGE_VIEW_URL_CONFIG_OPTIONS.FULL_URL },
|
|
42
|
+
{ label: 'URL with Path and Query String', value: PAGE_VIEW_URL_CONFIG_OPTIONS.URL_WITH_PATH_AND_QUERY_STRING },
|
|
43
|
+
{ label: 'URL with Path', value: PAGE_VIEW_URL_CONFIG_OPTIONS.URL_WITH_PATH }
|
|
44
|
+
],
|
|
45
|
+
default: PAGE_VIEW_URL_CONFIG_OPTIONS.FULL_URL,
|
|
46
|
+
required: true,
|
|
47
|
+
depends_on: {
|
|
48
|
+
conditions: [
|
|
49
|
+
{
|
|
50
|
+
fieldKey: 'autocapture',
|
|
51
|
+
operator: 'is',
|
|
52
|
+
value: 'custom'
|
|
53
|
+
}
|
|
54
|
+
]
|
|
53
55
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
56
|
+
},
|
|
57
|
+
click: {
|
|
58
|
+
description: 'Capture click events automatically',
|
|
59
|
+
label: 'Autocapture Click',
|
|
60
|
+
type: 'boolean',
|
|
61
|
+
default: true,
|
|
62
|
+
required: true,
|
|
63
|
+
depends_on: {
|
|
64
|
+
conditions: [
|
|
65
|
+
{
|
|
66
|
+
fieldKey: 'autocapture',
|
|
67
|
+
operator: 'is',
|
|
68
|
+
value: 'custom'
|
|
69
|
+
}
|
|
70
|
+
]
|
|
69
71
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
72
|
+
},
|
|
73
|
+
dead_click: {
|
|
74
|
+
description: 'Capture dead click events automatically',
|
|
75
|
+
label: 'Autocapture Dead Click',
|
|
76
|
+
type: 'boolean',
|
|
77
|
+
default: true,
|
|
78
|
+
required: true,
|
|
79
|
+
depends_on: {
|
|
80
|
+
conditions: [
|
|
81
|
+
{
|
|
82
|
+
fieldKey: 'autocapture',
|
|
83
|
+
operator: 'is',
|
|
84
|
+
value: 'custom'
|
|
85
|
+
}
|
|
86
|
+
]
|
|
85
87
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
88
|
+
},
|
|
89
|
+
input: {
|
|
90
|
+
description: 'Capture input events automatically',
|
|
91
|
+
label: 'Autocapture Input',
|
|
92
|
+
type: 'boolean',
|
|
93
|
+
default: true,
|
|
94
|
+
required: true,
|
|
95
|
+
depends_on: {
|
|
96
|
+
conditions: [
|
|
97
|
+
{
|
|
98
|
+
fieldKey: 'autocapture',
|
|
99
|
+
operator: 'is',
|
|
100
|
+
value: 'custom'
|
|
101
|
+
}
|
|
102
|
+
]
|
|
101
103
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
104
|
+
},
|
|
105
|
+
rage_click: {
|
|
106
|
+
description: 'Capture rage click events automatically',
|
|
107
|
+
label: 'Autocapture Rage Click',
|
|
108
|
+
type: 'boolean',
|
|
109
|
+
default: true,
|
|
110
|
+
required: true,
|
|
111
|
+
depends_on: {
|
|
112
|
+
conditions: [
|
|
113
|
+
{
|
|
114
|
+
fieldKey: 'autocapture',
|
|
115
|
+
operator: 'is',
|
|
116
|
+
value: 'custom'
|
|
117
|
+
}
|
|
118
|
+
]
|
|
117
119
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
120
|
+
},
|
|
121
|
+
scroll: {
|
|
122
|
+
description: 'Capture scroll events automatically',
|
|
123
|
+
label: 'Autocapture Scroll',
|
|
124
|
+
type: 'boolean',
|
|
125
|
+
default: true,
|
|
126
|
+
required: true,
|
|
127
|
+
depends_on: {
|
|
128
|
+
conditions: [
|
|
129
|
+
{
|
|
130
|
+
fieldKey: 'autocapture',
|
|
131
|
+
operator: 'is',
|
|
132
|
+
value: 'custom'
|
|
133
|
+
}
|
|
134
|
+
]
|
|
133
135
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
136
|
+
},
|
|
137
|
+
submit: {
|
|
138
|
+
description: 'Capture form submit events automatically',
|
|
139
|
+
label: 'Autocapture Submit',
|
|
140
|
+
type: 'boolean',
|
|
141
|
+
default: true,
|
|
142
|
+
depends_on: {
|
|
143
|
+
conditions: [
|
|
144
|
+
{
|
|
145
|
+
fieldKey: 'autocapture',
|
|
146
|
+
operator: 'is',
|
|
147
|
+
value: 'custom'
|
|
148
|
+
}
|
|
149
|
+
]
|
|
148
150
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
151
|
+
},
|
|
152
|
+
capture_text_content: {
|
|
153
|
+
description: 'Capture text content of elements in autocaptured events',
|
|
154
|
+
label: 'Autocapture Capture Text Content',
|
|
155
|
+
type: 'boolean',
|
|
156
|
+
default: false,
|
|
157
|
+
required: true,
|
|
158
|
+
depends_on: {
|
|
159
|
+
conditions: [
|
|
160
|
+
{
|
|
161
|
+
fieldKey: 'autocapture',
|
|
162
|
+
operator: 'is',
|
|
163
|
+
value: 'custom'
|
|
164
|
+
}
|
|
165
|
+
]
|
|
164
166
|
}
|
|
165
|
-
|
|
167
|
+
},
|
|
168
|
+
cross_subdomain_cookie: {
|
|
169
|
+
description: 'Enable or disable cross subdomain cookies for Mixpanel.',
|
|
170
|
+
label: 'Cross Subdomain Cookie',
|
|
171
|
+
type: 'boolean',
|
|
172
|
+
default: true
|
|
173
|
+
},
|
|
174
|
+
persistence: {
|
|
175
|
+
description: 'Set the persistence method for Mixpanel (cookie or localStorage).',
|
|
176
|
+
label: 'Persistence Method',
|
|
177
|
+
type: 'string',
|
|
178
|
+
choices: [
|
|
179
|
+
{ label: 'Cookie', value: PERSISTENCE_OPTIONS.COOKIE },
|
|
180
|
+
{ label: 'Local Storage', value: PERSISTENCE_OPTIONS.LOCAL_STORAGE }
|
|
181
|
+
],
|
|
182
|
+
default: PERSISTENCE_OPTIONS.COOKIE
|
|
183
|
+
},
|
|
184
|
+
track_marketing: {
|
|
185
|
+
description:
|
|
186
|
+
'Enable or disable tracking of marketing campaigns in Mixpanel. Includes UTM parameters and click identifiers for various ad platforms.',
|
|
187
|
+
label: 'Track Marketing Campaigns',
|
|
188
|
+
type: 'boolean',
|
|
189
|
+
default: true
|
|
190
|
+
},
|
|
191
|
+
cookie_expiration: {
|
|
192
|
+
description: 'Set the cookie expiration time in days for Mixpanel cookies.',
|
|
193
|
+
label: 'Cookie Expiration (days)',
|
|
194
|
+
type: 'number',
|
|
195
|
+
default: 365
|
|
196
|
+
},
|
|
197
|
+
disable_persistence: {
|
|
198
|
+
description: 'Disable all persistence mechanisms for Mixpanel.',
|
|
199
|
+
label: 'Disable Persistence',
|
|
200
|
+
type: 'boolean',
|
|
201
|
+
default: false
|
|
202
|
+
},
|
|
203
|
+
ip: {
|
|
204
|
+
description: 'Enable or disable sending IP address information to Mixpanel.',
|
|
205
|
+
label: 'Send IP Address',
|
|
206
|
+
type: 'boolean',
|
|
207
|
+
default: true
|
|
208
|
+
},
|
|
209
|
+
record_block_class: {
|
|
210
|
+
description: 'CSS class to block elements from being recorded in session recordings.',
|
|
211
|
+
label: 'Record Block Class',
|
|
212
|
+
type: 'string',
|
|
213
|
+
default: 'mp-block'
|
|
214
|
+
},
|
|
215
|
+
record_block_selector: {
|
|
216
|
+
description: 'CSS selector to block elements from being recorded in session recordings.',
|
|
217
|
+
label: 'Record Block Selector',
|
|
218
|
+
type: 'string',
|
|
219
|
+
default: 'img, video, audio'
|
|
220
|
+
},
|
|
221
|
+
record_canvas: {
|
|
222
|
+
description: 'Enable or disable recording of canvas elements in session recordings.',
|
|
223
|
+
label: 'Record Canvas',
|
|
224
|
+
type: 'boolean',
|
|
225
|
+
default: false
|
|
226
|
+
},
|
|
227
|
+
record_heatmap_data: {
|
|
228
|
+
description: 'Enable or disable tracking of heatmap events in session recordings.',
|
|
229
|
+
label: 'Record Heatmap Data',
|
|
230
|
+
type: 'boolean',
|
|
231
|
+
default: false
|
|
232
|
+
},
|
|
233
|
+
record_idle_timeout_ms: {
|
|
234
|
+
description: 'Idle timeout in milliseconds for session recordings.',
|
|
235
|
+
label: 'Record Idle Timeout (ms)',
|
|
236
|
+
type: 'number',
|
|
237
|
+
default: 180_000
|
|
238
|
+
},
|
|
239
|
+
record_mask_text_class: {
|
|
240
|
+
description: 'CSS class to mask text elements in session recordings.',
|
|
241
|
+
label: 'Record Mask Text Class',
|
|
242
|
+
type: 'string',
|
|
243
|
+
default: 'mp-mask'
|
|
244
|
+
},
|
|
245
|
+
record_mask_text_selector: {
|
|
246
|
+
description: 'CSS selector to mask text elements in session recordings.',
|
|
247
|
+
label: 'Record Mask Text Selector',
|
|
248
|
+
type: 'string',
|
|
249
|
+
default: '*'
|
|
250
|
+
},
|
|
251
|
+
record_max_ms: {
|
|
252
|
+
description: 'Maximum recording time in milliseconds for session recordings.',
|
|
253
|
+
label: 'Record Max (ms)',
|
|
254
|
+
type: 'number',
|
|
255
|
+
default: 86_400_000
|
|
256
|
+
},
|
|
257
|
+
record_min_ms: {
|
|
258
|
+
description: 'Minimum recording time in milliseconds for session recordings.',
|
|
259
|
+
label: 'Record Min (ms)',
|
|
260
|
+
type: 'number',
|
|
261
|
+
default: 0,
|
|
262
|
+
minimum: 0,
|
|
263
|
+
maximum: 8_000
|
|
264
|
+
},
|
|
265
|
+
record_sessions_percent: {
|
|
266
|
+
description: 'Percentage of sessions to record for session recordings.',
|
|
267
|
+
label: 'Record Sessions Percent',
|
|
268
|
+
type: 'number',
|
|
269
|
+
default: 0,
|
|
270
|
+
minimum: 0,
|
|
271
|
+
maximum: 100
|
|
166
272
|
}
|
|
167
|
-
|
|
168
|
-
cross_subdomain_cookie: {
|
|
169
|
-
description: 'Enable or disable cross subdomain cookies for Mixpanel.',
|
|
170
|
-
label: 'Cross Subdomain Cookie',
|
|
171
|
-
type: 'boolean',
|
|
172
|
-
default: true
|
|
173
|
-
},
|
|
174
|
-
persistence: {
|
|
175
|
-
description: 'Set the persistence method for Mixpanel (cookie or localStorage).',
|
|
176
|
-
label: 'Persistence Method',
|
|
177
|
-
type: 'string',
|
|
178
|
-
choices: [
|
|
179
|
-
{ label: 'Cookie', value: PERSISTENCE_OPTIONS.COOKIE },
|
|
180
|
-
{ label: 'Local Storage', value: PERSISTENCE_OPTIONS.LOCAL_STORAGE }
|
|
181
|
-
],
|
|
182
|
-
default: PERSISTENCE_OPTIONS.COOKIE
|
|
183
|
-
},
|
|
184
|
-
track_marketing: {
|
|
185
|
-
description:
|
|
186
|
-
'Enable or disable tracking of marketing campaigns in Mixpanel. Includes UTM parameters and click identifiers for various ad platforms.',
|
|
187
|
-
label: 'Track Marketing Campaigns',
|
|
188
|
-
type: 'boolean',
|
|
189
|
-
default: true
|
|
190
|
-
},
|
|
191
|
-
cookie_expiration: {
|
|
192
|
-
description: 'Set the cookie expiration time in days for Mixpanel cookies.',
|
|
193
|
-
label: 'Cookie Expiration (days)',
|
|
194
|
-
type: 'number',
|
|
195
|
-
default: 365
|
|
196
|
-
},
|
|
197
|
-
disable_persistence: {
|
|
198
|
-
description: 'Disable all persistence mechanisms for Mixpanel.',
|
|
199
|
-
label: 'Disable Persistence',
|
|
200
|
-
type: 'boolean',
|
|
201
|
-
default: false
|
|
202
|
-
},
|
|
203
|
-
ip: {
|
|
204
|
-
description: 'Enable or disable sending IP address information to Mixpanel.',
|
|
205
|
-
label: 'Send IP Address',
|
|
206
|
-
type: 'boolean',
|
|
207
|
-
default: true
|
|
208
|
-
},
|
|
209
|
-
record_block_class: {
|
|
210
|
-
description: 'CSS class to block elements from being recorded in session recordings.',
|
|
211
|
-
label: 'Record Block Class',
|
|
212
|
-
type: 'string',
|
|
213
|
-
default: 'mp-block'
|
|
214
|
-
},
|
|
215
|
-
record_block_selector: {
|
|
216
|
-
description: 'CSS selector to block elements from being recorded in session recordings.',
|
|
217
|
-
label: 'Record Block Selector',
|
|
218
|
-
type: 'string',
|
|
219
|
-
default: 'img, video, audio'
|
|
220
|
-
},
|
|
221
|
-
record_canvas: {
|
|
222
|
-
description: 'Enable or disable recording of canvas elements in session recordings.',
|
|
223
|
-
label: 'Record Canvas',
|
|
224
|
-
type: 'boolean',
|
|
225
|
-
default: false
|
|
226
|
-
},
|
|
227
|
-
record_heatmap_data: {
|
|
228
|
-
description: 'Enable or disable tracking of heatmap events in session recordings.',
|
|
229
|
-
label: 'Record Heatmap Data',
|
|
230
|
-
type: 'boolean',
|
|
231
|
-
default: false
|
|
232
|
-
},
|
|
233
|
-
record_idle_timeout_ms: {
|
|
234
|
-
description: 'Idle timeout in milliseconds for session recordings.',
|
|
235
|
-
label: 'Record Idle Timeout (ms)',
|
|
236
|
-
type: 'number',
|
|
237
|
-
default: 180_000
|
|
238
|
-
},
|
|
239
|
-
record_mask_text_class: {
|
|
240
|
-
description: 'CSS class to mask text elements in session recordings.',
|
|
241
|
-
label: 'Record Mask Text Class',
|
|
242
|
-
type: 'string',
|
|
243
|
-
default: 'mp-mask'
|
|
244
|
-
},
|
|
245
|
-
record_mask_text_selector: {
|
|
246
|
-
description: 'CSS selector to mask text elements in session recordings.',
|
|
247
|
-
label: 'Record Mask Text Selector',
|
|
248
|
-
type: 'string',
|
|
249
|
-
default: '*'
|
|
250
|
-
},
|
|
251
|
-
record_max_ms: {
|
|
252
|
-
description: 'Maximum recording time in milliseconds for session recordings.',
|
|
253
|
-
label: 'Record Max (ms)',
|
|
254
|
-
type: 'number',
|
|
255
|
-
default: 86_400_000
|
|
256
|
-
},
|
|
257
|
-
record_min_ms: {
|
|
258
|
-
description: 'Minimum recording time in milliseconds for session recordings.',
|
|
259
|
-
label: 'Record Min (ms)',
|
|
260
|
-
type: 'number',
|
|
261
|
-
default: 0,
|
|
262
|
-
minimum: 0,
|
|
263
|
-
maximum: 8_000
|
|
264
|
-
},
|
|
265
|
-
record_sessions_percent: {
|
|
266
|
-
description: 'Percentage of sessions to record for session recordings.',
|
|
267
|
-
label: 'Record Sessions Percent',
|
|
268
|
-
type: 'number',
|
|
269
|
-
default: 0,
|
|
270
|
-
minimum: 0,
|
|
271
|
-
maximum: 100
|
|
272
|
-
}
|
|
273
|
-
}
|
|
273
|
+
}
|
|
@@ -36,6 +36,7 @@ describe('Mixpanel.track', () => {
|
|
|
36
36
|
beforeEach(async () => {
|
|
37
37
|
jest.restoreAllMocks()
|
|
38
38
|
jest.spyOn(destination, 'initialize').mockImplementation(() => {
|
|
39
|
+
|
|
39
40
|
mockGroup = {
|
|
40
41
|
set: jest.fn(),
|
|
41
42
|
set_once: jest.fn(),
|
|
@@ -70,32 +71,32 @@ describe('Mixpanel.track', () => {
|
|
|
70
71
|
mapping: {
|
|
71
72
|
event_name: { '@path': '$.event' },
|
|
72
73
|
properties: { '@path': '$.properties' },
|
|
73
|
-
unique_id:
|
|
74
|
-
user_profile_properties_to_set: {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
unique_id:{ '@path': '$.userId' },
|
|
75
|
+
user_profile_properties_to_set: {
|
|
76
|
+
name: { '@path': '$.context.traits.user.name' },
|
|
77
|
+
first_name: { '@path': '$.context.traits.user.first_name' },
|
|
78
|
+
last_name: { '@path': '$.context.traits.user.last_name' },
|
|
79
|
+
email: { '@path': '$.context.traits.user.email' },
|
|
80
|
+
phone: { '@path': '$.context.traits.user.phone' },
|
|
81
|
+
avatar: { '@path': '$.context.traits.user.avatar' },
|
|
82
|
+
created: { '@path': '$.context.traits.user.created' }
|
|
82
83
|
},
|
|
83
84
|
user_profile_properties_to_set_once: {
|
|
84
|
-
|
|
85
|
+
set_once_trait: { '@path': '$.context.traits.user.set_once_trait_1' },
|
|
85
86
|
},
|
|
86
87
|
user_profile_properties_to_increment: {
|
|
87
|
-
|
|
88
|
+
increment_property: { '@path': '$.context.traits.user.increment_property_1' }
|
|
88
89
|
},
|
|
89
90
|
group_details: {
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
group_key: { '@path': '$.context.traits.company.group_key' },
|
|
92
|
+
group_id: { '@path': '$.context.groupId' }
|
|
92
93
|
},
|
|
93
|
-
group_profile_properties_to_set: {
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
group_profile_properties_to_set: {
|
|
95
|
+
company_name: { '@path': '$.context.traits.company.company_name' },
|
|
96
|
+
number_employees: { '@path': '$.context.traits.company.number_employees' }
|
|
96
97
|
},
|
|
97
98
|
group_profile_properties_to_set_once: {
|
|
98
|
-
|
|
99
|
+
set_once_trait: { '@path': '$.context.traits.company.set_once_trait_1' },
|
|
99
100
|
},
|
|
100
101
|
group_profile_properties_to_union: { '@path': '$.context.traits.company.union_properties' }
|
|
101
102
|
}
|
|
@@ -105,7 +106,7 @@ describe('Mixpanel.track', () => {
|
|
|
105
106
|
const context = new Context({
|
|
106
107
|
messageId: 'ajs-71f386523ee5dfa90c7d0fda28b6b5c6',
|
|
107
108
|
type: 'track',
|
|
108
|
-
event:
|
|
109
|
+
event: "Big Fat Test Event",
|
|
109
110
|
anonymousId: 'anonymousId',
|
|
110
111
|
userId: 'userId1',
|
|
111
112
|
properties: {
|
|
@@ -113,7 +114,7 @@ describe('Mixpanel.track', () => {
|
|
|
113
114
|
prop2: 2,
|
|
114
115
|
prop3: true,
|
|
115
116
|
prop4: [1, 2, 3],
|
|
116
|
-
prop5: { subprop1: 'subvalue1', subprop2: 22
|
|
117
|
+
prop5: { subprop1: 'subvalue1', subprop2: 22}
|
|
117
118
|
},
|
|
118
119
|
context: {
|
|
119
120
|
groupId: 'groupId1',
|
|
@@ -152,8 +153,8 @@ describe('Mixpanel.track', () => {
|
|
|
152
153
|
await event.load(Context.system(), {} as Analytics)
|
|
153
154
|
await event.group?.(context)
|
|
154
155
|
|
|
155
|
-
// Identify related calls
|
|
156
|
-
expect(mockMPP.identify).toHaveBeenCalledWith(
|
|
156
|
+
// Identify related calls
|
|
157
|
+
expect(mockMPP.identify).toHaveBeenCalledWith("userId1")
|
|
157
158
|
expect(mockMPP.people.set).toHaveBeenCalledWith({
|
|
158
159
|
name: 'User Name',
|
|
159
160
|
last_name: 'Last',
|
|
@@ -170,7 +171,7 @@ describe('Mixpanel.track', () => {
|
|
|
170
171
|
increment_property: 5
|
|
171
172
|
})
|
|
172
173
|
|
|
173
|
-
// Group related calls
|
|
174
|
+
// Group related calls
|
|
174
175
|
expect(mockMPP.set_group).toHaveBeenCalledWith('company', 'groupId1')
|
|
175
176
|
expect(mockMPP.get_group).toHaveBeenCalledWith('company', 'groupId1')
|
|
176
177
|
expect(mockGroup.set).toHaveBeenCalledWith({
|
|
@@ -190,7 +191,7 @@ describe('Mixpanel.track', () => {
|
|
|
190
191
|
prop2: 2,
|
|
191
192
|
prop3: true,
|
|
192
193
|
prop4: [1, 2, 3],
|
|
193
|
-
prop5: { subprop1: 'subvalue1', subprop2: 22
|
|
194
|
+
prop5: { subprop1: 'subvalue1', subprop2: 22}
|
|
194
195
|
})
|
|
195
196
|
})
|
|
196
197
|
})
|