@segment/analytics-browser-mixpanel-web-actions 1.0.1-staging-294d81392.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.
Files changed (135) hide show
  1. package/README.md +31 -0
  2. package/dist/cjs/alias/generated-types.d.ts +4 -0
  3. package/dist/cjs/alias/generated-types.js +3 -0
  4. package/dist/cjs/alias/generated-types.js.map +1 -0
  5. package/dist/cjs/alias/index.d.ts +6 -0
  6. package/dist/cjs/alias/index.js +32 -0
  7. package/dist/cjs/alias/index.js.map +1 -0
  8. package/dist/cjs/constants.d.ts +14 -0
  9. package/dist/cjs/constants.js +18 -0
  10. package/dist/cjs/constants.js.map +1 -0
  11. package/dist/cjs/fields.d.ts +11 -0
  12. package/dist/cjs/fields.js +162 -0
  13. package/dist/cjs/fields.js.map +1 -0
  14. package/dist/cjs/functions.d.ts +7 -0
  15. package/dist/cjs/functions.js +39 -0
  16. package/dist/cjs/functions.js.map +1 -0
  17. package/dist/cjs/generated-types.d.ts +30 -0
  18. package/dist/cjs/generated-types.js +3 -0
  19. package/dist/cjs/generated-types.js.map +1 -0
  20. package/dist/cjs/group/generated-types.d.ts +16 -0
  21. package/dist/cjs/group/generated-types.js +3 -0
  22. package/dist/cjs/group/generated-types.js.map +1 -0
  23. package/dist/cjs/group/index.d.ts +6 -0
  24. package/dist/cjs/group/index.js +21 -0
  25. package/dist/cjs/group/index.js.map +1 -0
  26. package/dist/cjs/identify/generated-types.d.ts +19 -0
  27. package/dist/cjs/identify/generated-types.js +3 -0
  28. package/dist/cjs/identify/generated-types.js.map +1 -0
  29. package/dist/cjs/identify/index.d.ts +6 -0
  30. package/dist/cjs/identify/index.js +21 -0
  31. package/dist/cjs/identify/index.js.map +1 -0
  32. package/dist/cjs/index.d.ts +11 -0
  33. package/dist/cjs/index.js +76 -0
  34. package/dist/cjs/index.js.map +1 -0
  35. package/dist/cjs/init-script.d.ts +1 -0
  36. package/dist/cjs/init-script.js +65 -0
  37. package/dist/cjs/init-script.js.map +1 -0
  38. package/dist/cjs/setting-fields.d.ts +2 -0
  39. package/dist/cjs/setting-fields.js +273 -0
  40. package/dist/cjs/setting-fields.js.map +1 -0
  41. package/dist/cjs/track/generated-types.d.ts +37 -0
  42. package/dist/cjs/track/generated-types.js +3 -0
  43. package/dist/cjs/track/generated-types.js.map +1 -0
  44. package/dist/cjs/track/index.d.ts +6 -0
  45. package/dist/cjs/track/index.js +93 -0
  46. package/dist/cjs/track/index.js.map +1 -0
  47. package/dist/cjs/trackPageView/generated-types.d.ts +37 -0
  48. package/dist/cjs/trackPageView/generated-types.js +3 -0
  49. package/dist/cjs/trackPageView/generated-types.js.map +1 -0
  50. package/dist/cjs/trackPageView/index.d.ts +6 -0
  51. package/dist/cjs/trackPageView/index.js +101 -0
  52. package/dist/cjs/trackPageView/index.js.map +1 -0
  53. package/dist/cjs/types.d.ts +68 -0
  54. package/dist/cjs/types.js +3 -0
  55. package/dist/cjs/types.js.map +1 -0
  56. package/dist/esm/alias/generated-types.d.ts +4 -0
  57. package/dist/esm/alias/generated-types.js +2 -0
  58. package/dist/esm/alias/generated-types.js.map +1 -0
  59. package/dist/esm/alias/index.d.ts +6 -0
  60. package/dist/esm/alias/index.js +30 -0
  61. package/dist/esm/alias/index.js.map +1 -0
  62. package/dist/esm/constants.d.ts +14 -0
  63. package/dist/esm/constants.js +15 -0
  64. package/dist/esm/constants.js.map +1 -0
  65. package/dist/esm/fields.d.ts +11 -0
  66. package/dist/esm/fields.js +159 -0
  67. package/dist/esm/fields.js.map +1 -0
  68. package/dist/esm/functions.d.ts +7 -0
  69. package/dist/esm/functions.js +35 -0
  70. package/dist/esm/functions.js.map +1 -0
  71. package/dist/esm/generated-types.d.ts +30 -0
  72. package/dist/esm/generated-types.js +2 -0
  73. package/dist/esm/generated-types.js.map +1 -0
  74. package/dist/esm/group/generated-types.d.ts +16 -0
  75. package/dist/esm/group/generated-types.js +2 -0
  76. package/dist/esm/group/generated-types.js.map +1 -0
  77. package/dist/esm/group/index.d.ts +6 -0
  78. package/dist/esm/group/index.js +19 -0
  79. package/dist/esm/group/index.js.map +1 -0
  80. package/dist/esm/identify/generated-types.d.ts +19 -0
  81. package/dist/esm/identify/generated-types.js +2 -0
  82. package/dist/esm/identify/generated-types.js.map +1 -0
  83. package/dist/esm/identify/index.d.ts +6 -0
  84. package/dist/esm/identify/index.js +19 -0
  85. package/dist/esm/identify/index.js.map +1 -0
  86. package/dist/esm/index.d.ts +11 -0
  87. package/dist/esm/index.js +72 -0
  88. package/dist/esm/index.js.map +1 -0
  89. package/dist/esm/init-script.d.ts +1 -0
  90. package/dist/esm/init-script.js +62 -0
  91. package/dist/esm/init-script.js.map +1 -0
  92. package/dist/esm/setting-fields.d.ts +2 -0
  93. package/dist/esm/setting-fields.js +270 -0
  94. package/dist/esm/setting-fields.js.map +1 -0
  95. package/dist/esm/track/generated-types.d.ts +37 -0
  96. package/dist/esm/track/generated-types.js +2 -0
  97. package/dist/esm/track/generated-types.js.map +1 -0
  98. package/dist/esm/track/index.d.ts +6 -0
  99. package/dist/esm/track/index.js +91 -0
  100. package/dist/esm/track/index.js.map +1 -0
  101. package/dist/esm/trackPageView/generated-types.d.ts +37 -0
  102. package/dist/esm/trackPageView/generated-types.js +2 -0
  103. package/dist/esm/trackPageView/generated-types.js.map +1 -0
  104. package/dist/esm/trackPageView/index.d.ts +6 -0
  105. package/dist/esm/trackPageView/index.js +99 -0
  106. package/dist/esm/trackPageView/index.js.map +1 -0
  107. package/dist/esm/types.d.ts +68 -0
  108. package/dist/esm/types.js +2 -0
  109. package/dist/esm/types.js.map +1 -0
  110. package/dist/tsconfig.tsbuildinfo +1 -0
  111. package/package.json +25 -0
  112. package/src/alias/__tests__/index.test.ts +95 -0
  113. package/src/alias/generated-types.ts +12 -0
  114. package/src/alias/index.ts +35 -0
  115. package/src/constants.ts +16 -0
  116. package/src/fields.ts +173 -0
  117. package/src/functions.ts +57 -0
  118. package/src/generated-types.ts +116 -0
  119. package/src/group/__tests__/index.test.ts +126 -0
  120. package/src/group/generated-types.ts +42 -0
  121. package/src/group/index.ts +29 -0
  122. package/src/identify/__tests__/index.test.ts +135 -0
  123. package/src/identify/generated-types.ts +54 -0
  124. package/src/identify/index.ts +29 -0
  125. package/src/index.ts +99 -0
  126. package/src/init-script.ts +63 -0
  127. package/src/setting-fields.ts +273 -0
  128. package/src/track/__tests__/index.test.ts +196 -0
  129. package/src/track/generated-types.ts +102 -0
  130. package/src/track/index.ts +109 -0
  131. package/src/trackPageView/__tests__/index.test.ts +250 -0
  132. package/src/trackPageView/generated-types.ts +102 -0
  133. package/src/trackPageView/index.ts +116 -0
  134. package/src/types.ts +78 -0
  135. package/tsconfig.json +9 -0
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initScript = initScript;
4
+ async function initScript() {
5
+ ;
6
+ (function (f, b) {
7
+ if (!b.__SV) {
8
+ var e, g, i, h;
9
+ window.mixpanel = b;
10
+ b._i = [];
11
+ b.init = function (e, f, c) {
12
+ function g(a, d) {
13
+ var b = d.split('.');
14
+ 2 == b.length && ((a = a[b[0]]), (d = b[1]));
15
+ a[d] = function () {
16
+ a.push([d].concat(Array.prototype.slice.call(arguments, 0)));
17
+ };
18
+ }
19
+ var a = b;
20
+ 'undefined' !== typeof c ? (a = b[c] = []) : (c = 'mixpanel');
21
+ a.people = a.people || [];
22
+ a.toString = function (a) {
23
+ var d = 'mixpanel';
24
+ 'mixpanel' !== c && (d += '.' + c);
25
+ a || (d += ' (stub)');
26
+ return d;
27
+ };
28
+ a.people.toString = function () {
29
+ return a.toString(1) + '.people (stub)';
30
+ };
31
+ i =
32
+ 'disable time_event track track_pageview track_links track_forms track_with_groups add_group set_group remove_group register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking start_batch_senders people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user people.remove'.split(' ');
33
+ for (h = 0; h < i.length; h++)
34
+ g(a, i[h]);
35
+ var j = 'set set_once union unset remove delete'.split(' ');
36
+ a.get_group = function () {
37
+ function b(c) {
38
+ d[c] = function () {
39
+ call2_args = arguments;
40
+ call2 = [c].concat(Array.prototype.slice.call(call2_args, 0));
41
+ a.push([e, call2]);
42
+ };
43
+ }
44
+ for (var d = {}, e = ['get_group'].concat(Array.prototype.slice.call(arguments, 0)), c = 0; c < j.length; c++)
45
+ b(j[c]);
46
+ return d;
47
+ };
48
+ b._i.push([e, f, c]);
49
+ };
50
+ b.__SV = 1.2;
51
+ e = f.createElement('script');
52
+ e.type = 'text/javascript';
53
+ e.async = !0;
54
+ e.src =
55
+ 'undefined' !== typeof MIXPANEL_CUSTOM_LIB_URL
56
+ ? MIXPANEL_CUSTOM_LIB_URL
57
+ : 'file:' === f.location.protocol && '//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js'.match(/^\/\//)
58
+ ? 'https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js'
59
+ : '//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js';
60
+ g = f.getElementsByTagName('script')[0];
61
+ g.parentNode.insertBefore(e, g);
62
+ }
63
+ })(document, window.mixpanel || []);
64
+ }
65
+ //# sourceMappingURL=init-script.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-script.js","sourceRoot":"","sources":["../../src/init-script.ts"],"names":[],"mappings":";;AAEA,gCA4DC;AA5DM,KAAK,UAAU,UAAU;IAC9B,CAAC;IAAA,CAAC,UAAU,CAAC,EAAE,CAAC;QACd,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YACZ,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;YACd,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAA;YACnB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAA;YACT,CAAC,CAAC,IAAI,GAAG,UAAU,CAAC,EAAE,CAAC,EAAE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AC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAA;YACZ,CAAC,CAAC,GAAG;gBACH,WAAW,KAAK,OAAO,uBAAuB;oBAC5C,CAAC,CAAC,uBAAuB;oBACzB,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,IAAI,+CAA+C,CAAC,KAAK,CAAC,OAAO,CAAC;wBACnG,CAAC,CAAC,qDAAqD;wBACvD,CAAC,CAAC,+CAA+C,CAAA;YACrD,CAAC,GAAG,CAAC,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;YACvC,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QACjC,CAAC;IACH,CAAC,CAAC,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAA;AACrC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { GlobalSetting } from '@segment/actions-core';
2
+ export declare const settingFields: Record<string, GlobalSetting>;
@@ -0,0 +1,273 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.settingFields = void 0;
4
+ const constants_1 = require("./constants");
5
+ exports.settingFields = {
6
+ projectToken: {
7
+ description: 'Your Mixpanel project token.',
8
+ label: 'Project Token',
9
+ type: 'string',
10
+ required: true
11
+ },
12
+ name: {
13
+ label: 'Mixpanel Instance Name',
14
+ description: 'The name for the new mixpanel instance that you want created.',
15
+ type: 'string'
16
+ },
17
+ api_host: {
18
+ description: 'The Mixpanel API host to send data to.',
19
+ label: 'API Host',
20
+ type: 'string',
21
+ format: 'uri',
22
+ required: true,
23
+ default: 'https://api-js.mixpanel.com'
24
+ },
25
+ autocapture: {
26
+ description: '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: constants_1.AUTOCAPTURE_OPTIONS.ENABLED },
31
+ { label: 'Disabled', value: constants_1.AUTOCAPTURE_OPTIONS.DISABLED },
32
+ { label: 'Custom', value: constants_1.AUTOCAPTURE_OPTIONS.CUSTOM }
33
+ ],
34
+ default: constants_1.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: constants_1.PAGE_VIEW_URL_CONFIG_OPTIONS.FULL_URL },
42
+ { label: 'URL with Path and Query String', value: constants_1.PAGE_VIEW_URL_CONFIG_OPTIONS.URL_WITH_PATH_AND_QUERY_STRING },
43
+ { label: 'URL with Path', value: constants_1.PAGE_VIEW_URL_CONFIG_OPTIONS.URL_WITH_PATH }
44
+ ],
45
+ default: constants_1.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
+ ]
55
+ }
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
+ ]
71
+ }
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
+ ]
87
+ }
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
+ ]
103
+ }
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
+ ]
119
+ }
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
+ ]
135
+ }
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
+ ]
150
+ }
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
+ ]
166
+ }
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: constants_1.PERSISTENCE_OPTIONS.COOKIE },
180
+ { label: 'Local Storage', value: constants_1.PERSISTENCE_OPTIONS.LOCAL_STORAGE }
181
+ ],
182
+ default: constants_1.PERSISTENCE_OPTIONS.COOKIE
183
+ },
184
+ track_marketing: {
185
+ description: 'Enable or disable tracking of marketing campaigns in Mixpanel. Includes UTM parameters and click identifiers for various ad platforms.',
186
+ label: 'Track Marketing Campaigns',
187
+ type: 'boolean',
188
+ default: true
189
+ },
190
+ cookie_expiration: {
191
+ description: 'Set the cookie expiration time in days for Mixpanel cookies.',
192
+ label: 'Cookie Expiration (days)',
193
+ type: 'number',
194
+ default: 365
195
+ },
196
+ disable_persistence: {
197
+ description: 'Disable all persistence mechanisms for Mixpanel.',
198
+ label: 'Disable Persistence',
199
+ type: 'boolean',
200
+ default: false
201
+ },
202
+ ip: {
203
+ description: 'Enable or disable sending IP address information to Mixpanel.',
204
+ label: 'Send IP Address',
205
+ type: 'boolean',
206
+ default: true
207
+ },
208
+ record_block_class: {
209
+ description: 'CSS class to block elements from being recorded in session recordings.',
210
+ label: 'Record Block Class',
211
+ type: 'string',
212
+ default: 'mp-block'
213
+ },
214
+ record_block_selector: {
215
+ description: 'CSS selector to block elements from being recorded in session recordings.',
216
+ label: 'Record Block Selector',
217
+ type: 'string',
218
+ default: 'img, video, audio'
219
+ },
220
+ record_canvas: {
221
+ description: 'Enable or disable recording of canvas elements in session recordings.',
222
+ label: 'Record Canvas',
223
+ type: 'boolean',
224
+ default: false
225
+ },
226
+ record_heatmap_data: {
227
+ description: 'Enable or disable tracking of heatmap events in session recordings.',
228
+ label: 'Record Heatmap Data',
229
+ type: 'boolean',
230
+ default: false
231
+ },
232
+ record_idle_timeout_ms: {
233
+ description: 'Idle timeout in milliseconds for session recordings.',
234
+ label: 'Record Idle Timeout (ms)',
235
+ type: 'number',
236
+ default: 180000
237
+ },
238
+ record_mask_text_class: {
239
+ description: 'CSS class to mask text elements in session recordings.',
240
+ label: 'Record Mask Text Class',
241
+ type: 'string',
242
+ default: 'mp-mask'
243
+ },
244
+ record_mask_text_selector: {
245
+ description: 'CSS selector to mask text elements in session recordings.',
246
+ label: 'Record Mask Text Selector',
247
+ type: 'string',
248
+ default: '*'
249
+ },
250
+ record_max_ms: {
251
+ description: 'Maximum recording time in milliseconds for session recordings.',
252
+ label: 'Record Max (ms)',
253
+ type: 'number',
254
+ default: 86400000
255
+ },
256
+ record_min_ms: {
257
+ description: 'Minimum recording time in milliseconds for session recordings.',
258
+ label: 'Record Min (ms)',
259
+ type: 'number',
260
+ default: 0,
261
+ minimum: 0,
262
+ maximum: 8000
263
+ },
264
+ record_sessions_percent: {
265
+ description: 'Percentage of sessions to record for session recordings.',
266
+ label: 'Record Sessions Percent',
267
+ type: 'number',
268
+ default: 0,
269
+ minimum: 0,
270
+ maximum: 100
271
+ }
272
+ };
273
+ //# sourceMappingURL=setting-fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setting-fields.js","sourceRoot":"","sources":["../../src/setting-fields.ts"],"names":[],"mappings":";;;AAAA,2CAAoG;AAGvF,QAAA,aAAa,GAAkC;IAC1D,YAAY,EAAE;QACZ,WAAW,EAAE,8BAA8B;QAC3C,KAAK,EAAE,eAAe;QACtB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;KACf;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EAAE,+DAA+D;QAC5E,IAAI,EAAE,QAAQ;KACf;IACD,QAAQ,EAAE;QACR,WAAW,EAAE,wCAAwC;QACrD,KAAK,EAAE,UAAU;QACjB,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,6BAA6B;KACvC;IACD,WAAW,EAAE;QACX,WAAW,EACT,2IAA2I;QAC7I,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE;YACP,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,+BAAmB,CAAC,OAAO,EAAE;YACxD,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,+BAAmB,CAAC,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@@
1
+ export interface Payload {
2
+ event_name: string;
3
+ properties?: {
4
+ [k: string]: unknown;
5
+ };
6
+ unique_id?: string;
7
+ user_profile_properties_to_set?: {
8
+ name?: string;
9
+ first_name?: string;
10
+ last_name?: string;
11
+ email?: string;
12
+ phone?: string;
13
+ avatar?: string;
14
+ created?: string;
15
+ [k: string]: unknown;
16
+ };
17
+ user_profile_properties_to_set_once?: {
18
+ [k: string]: unknown;
19
+ };
20
+ user_profile_properties_to_increment?: {
21
+ [k: string]: unknown;
22
+ };
23
+ group_details?: {
24
+ group_key: string;
25
+ group_id: string;
26
+ };
27
+ group_profile_properties_to_set?: {
28
+ [k: string]: unknown;
29
+ };
30
+ group_profile_properties_to_set_once?: {
31
+ [k: string]: unknown;
32
+ };
33
+ group_profile_properties_to_union?: {
34
+ list_name: string;
35
+ string_values: string[];
36
+ }[];
37
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/track/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import type { BrowserActionDefinition } from '@segment/browser-destination-runtime/types';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ import type { Mixpanel } from '../types';
5
+ declare const action: BrowserActionDefinition<Settings, Mixpanel, Payload>;
6
+ export default action;
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const functions_1 = require("../functions");
4
+ const fields_1 = require("../fields");
5
+ const action = {
6
+ title: 'Track',
7
+ description: 'Sync Segment track events to Mixpanel.',
8
+ platform: 'web',
9
+ fields: {
10
+ event_name: fields_1.event_name,
11
+ properties: fields_1.properties,
12
+ unique_id: {
13
+ ...fields_1.unique_id,
14
+ description: 'The unique ID to associate with the user. Settings this value will trigger a Mixpanel identify call before immediately the track event is sent.',
15
+ default: undefined,
16
+ required: false
17
+ },
18
+ user_profile_properties_to_set: {
19
+ ...fields_1.user_profile_properties_to_set,
20
+ default: {
21
+ name: {
22
+ '@if': {
23
+ exists: { '@path': '$.context.traits.name' },
24
+ then: { '@path': '$.context.traits.name' },
25
+ else: { '@path': '$.properties.name' }
26
+ }
27
+ },
28
+ first_name: {
29
+ '@if': {
30
+ exists: { '@path': '$.context.traits.first_name' },
31
+ then: { '@path': '$.context.traits.first_name' },
32
+ else: { '@path': '$.properties.first_name' }
33
+ }
34
+ },
35
+ last_name: {
36
+ '@if': {
37
+ exists: { '@path': '$.context.traits.last_name' },
38
+ then: { '@path': '$.context.traits.last_name' },
39
+ else: { '@path': '$.properties.last_name' }
40
+ }
41
+ },
42
+ email: {
43
+ '@if': {
44
+ exists: { '@path': '$.context.traits.email' },
45
+ then: { '@path': '$.context.traits.email' },
46
+ else: { '@path': '$.properties.email' }
47
+ }
48
+ },
49
+ phone: {
50
+ '@if': {
51
+ exists: { '@path': '$.context.traits.phone' },
52
+ then: { '@path': '$.context.traits.phone' },
53
+ else: { '@path': '$.properties.phone' }
54
+ }
55
+ },
56
+ avatar: {
57
+ '@if': {
58
+ exists: { '@path': '$.context.traits.avatar' },
59
+ then: { '@path': '$.context.traits.avatar' },
60
+ else: { '@path': '$.properties.avatar' }
61
+ }
62
+ },
63
+ created: {
64
+ '@if': {
65
+ exists: { '@path': '$.context.traits.created_at' },
66
+ then: { '@path': '$.context.traits.created_at' },
67
+ else: { '@path': '$.properties.created_at' }
68
+ }
69
+ }
70
+ }
71
+ },
72
+ user_profile_properties_to_set_once: fields_1.user_profile_properties_to_set_once,
73
+ user_profile_properties_to_increment: fields_1.user_profile_properties_to_increment,
74
+ group_details: {
75
+ ...fields_1.group_details,
76
+ required: false,
77
+ description: 'Details for the group to be created or updated in Mixpanel. Setting this value will trigger a Mixpanel set_group call before the track event is sent.',
78
+ default: undefined
79
+ },
80
+ group_profile_properties_to_set: fields_1.group_profile_properties_to_set,
81
+ group_profile_properties_to_set_once: fields_1.group_profile_properties_to_set_once,
82
+ group_profile_properties_to_union: fields_1.group_profile_properties_to_union
83
+ },
84
+ defaultSubscription: 'type = "track"',
85
+ perform: (mixpanel, { payload }) => {
86
+ (0, functions_1.sendIdentify)(mixpanel, payload);
87
+ (0, functions_1.sendGroup)(mixpanel, payload);
88
+ const { event_name, properties = {} } = payload;
89
+ mixpanel.track(event_name, properties);
90
+ }
91
+ };
92
+ exports.default = action;
93
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/track/index.ts"],"names":[],"mappings":";;AAIA,4CAAsD;AACtD,sCAWkB;AAElB,MAAM,MAAM,GAAyD;IACnE,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,wCAAwC;IACrD,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE;QACN,UAAU,EAAV,mBAAU;QACV,UAAU,EAAV,mBAAU;QACV,SAAS,EAAE;YACT,GAAG,kBAAS;YACZ,WAAW,EACT,iJAAiJ;YACnJ,OAAO,EAAE,SAAS;YAClB,QAAQ,EAAE,KAAK;SAChB;QACD,8BAA8B,EAAE;YAC9B,GAAG,uCAA8B;YACjC,OAAO,EAAE;gBACP,IAAI,EAAE;oBACJ,KAAK,EAAE;wBACL,MAAM,EAAE,EAAE,OAAO,EAAE,uBAAuB,EAAE;wBAC5C,IAAI,EAAE,EAAE,OAAO,EAAE,uBAAuB,EAAE;wBAC1C,IAAI,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE;qBACvC;iBACF;gBACD,UAAU,EAAE;oBACV,KAAK,EAAE;wBACL,MAAM,EAAE,EAAE,OAAO,EAAE,6BAA6B,EAAE;wBAClD,IAAI,EAAE,EAAE,OAAO,EAAE,6BAA6B,EAAE;wBAChD,IAAI,EAAE,EAAE,OAAO,EAAE,yBAAyB,EAAE;qBAC7C;iBACF;gBACD,SAAS,EAAE;oBACT,KAAK,EAAE;wB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;QACpC,iCAAiC,EAAjC,0CAAiC;KAClC;IACD,mBAAmB,EAAE,gBAAgB;IACrC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACjC,IAAA,wBAAY,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QAC/B,IAAA,qBAAS,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QAC5B,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,EAAE,EAAE,GAAG,OAAO,CAAA;QAC/C,QAAQ,CAAC,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;IACxC,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,37 @@
1
+ export interface Payload {
2
+ event_name?: string;
3
+ properties?: {
4
+ [k: string]: unknown;
5
+ };
6
+ unique_id: string;
7
+ user_profile_properties_to_set?: {
8
+ name?: string;
9
+ first_name?: string;
10
+ last_name?: string;
11
+ email?: string;
12
+ phone?: string;
13
+ avatar?: string;
14
+ created?: string;
15
+ [k: string]: unknown;
16
+ };
17
+ user_profile_properties_to_set_once?: {
18
+ [k: string]: unknown;
19
+ };
20
+ user_profile_properties_to_increment?: {
21
+ [k: string]: unknown;
22
+ };
23
+ group_details?: {
24
+ group_key: string;
25
+ group_id: string;
26
+ };
27
+ group_profile_properties_to_set?: {
28
+ [k: string]: unknown;
29
+ };
30
+ group_profile_properties_to_set_once?: {
31
+ [k: string]: unknown;
32
+ };
33
+ group_profile_properties_to_union?: {
34
+ list_name: string;
35
+ string_values: string[];
36
+ }[];
37
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/trackPageView/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import type { BrowserActionDefinition } from '@segment/browser-destination-runtime/types';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ import type { Mixpanel } from '../types';
5
+ declare const action: BrowserActionDefinition<Settings, Mixpanel, Payload>;
6
+ export default action;
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const functions_1 = require("../functions");
4
+ const fields_1 = require("../fields");
5
+ const action = {
6
+ title: 'Track Page View',
7
+ description: 'Sync Segment page events to Mixpanel.',
8
+ defaultSubscription: 'type = "page"',
9
+ platform: 'web',
10
+ fields: {
11
+ event_name: {
12
+ ...fields_1.event_name,
13
+ default: undefined,
14
+ required: false
15
+ },
16
+ properties: fields_1.properties,
17
+ unique_id: {
18
+ ...fields_1.unique_id,
19
+ description: 'The unique ID to associate with the user. Settings this value will trigger a Mixpanel identify call before immediately the page event is sent.',
20
+ default: undefined
21
+ },
22
+ user_profile_properties_to_set: {
23
+ ...fields_1.user_profile_properties_to_set,
24
+ default: {
25
+ name: {
26
+ '@if': {
27
+ exists: { '@path': '$.context.traits.name' },
28
+ then: { '@path': '$.context.traits.name' },
29
+ else: { '@path': '$.properties.name' }
30
+ }
31
+ },
32
+ first_name: {
33
+ '@if': {
34
+ exists: { '@path': '$.context.traits.first_name' },
35
+ then: { '@path': '$.context.traits.first_name' },
36
+ else: { '@path': '$.properties.first_name' }
37
+ }
38
+ },
39
+ last_name: {
40
+ '@if': {
41
+ exists: { '@path': '$.context.traits.last_name' },
42
+ then: { '@path': '$.context.traits.last_name' },
43
+ else: { '@path': '$.properties.last_name' }
44
+ }
45
+ },
46
+ email: {
47
+ '@if': {
48
+ exists: { '@path': '$.context.traits.email' },
49
+ then: { '@path': '$.context.traits.email' },
50
+ else: { '@path': '$.properties.email' }
51
+ }
52
+ },
53
+ phone: {
54
+ '@if': {
55
+ exists: { '@path': '$.context.traits.phone' },
56
+ then: { '@path': '$.context.traits.phone' },
57
+ else: { '@path': '$.properties.phone' }
58
+ }
59
+ },
60
+ avatar: {
61
+ '@if': {
62
+ exists: { '@path': '$.context.traits.avatar' },
63
+ then: { '@path': '$.context.traits.avatar' },
64
+ else: { '@path': '$.properties.avatar' }
65
+ }
66
+ },
67
+ created: {
68
+ '@if': {
69
+ exists: { '@path': '$.context.traits.created_at' },
70
+ then: { '@path': '$.context.traits.created_at' },
71
+ else: { '@path': '$.properties.created_at' }
72
+ }
73
+ }
74
+ }
75
+ },
76
+ user_profile_properties_to_set_once: fields_1.user_profile_properties_to_set_once,
77
+ user_profile_properties_to_increment: fields_1.user_profile_properties_to_increment,
78
+ group_details: {
79
+ ...fields_1.group_details,
80
+ required: false,
81
+ description: 'Details for the group to be created or updated in Mixpanel. Setting this value will trigger a Mixpanel set_group call before the page event is sent.',
82
+ default: undefined
83
+ },
84
+ group_profile_properties_to_set: fields_1.group_profile_properties_to_set,
85
+ group_profile_properties_to_set_once: fields_1.group_profile_properties_to_set_once,
86
+ group_profile_properties_to_union: fields_1.group_profile_properties_to_union
87
+ },
88
+ perform: (mixpanel, { payload }) => {
89
+ (0, functions_1.sendIdentify)(mixpanel, payload);
90
+ (0, functions_1.sendGroup)(mixpanel, payload);
91
+ const { event_name, properties = {} } = payload;
92
+ if (event_name) {
93
+ mixpanel.track_pageview(properties || {}, { event_name });
94
+ }
95
+ else {
96
+ mixpanel.track_pageview(properties || {});
97
+ }
98
+ }
99
+ };
100
+ exports.default = action;
101
+ //# sourceMappingURL=index.js.map