@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.
- package/README.md +31 -0
- package/dist/cjs/alias/generated-types.d.ts +4 -0
- package/dist/cjs/alias/generated-types.js +3 -0
- package/dist/cjs/alias/generated-types.js.map +1 -0
- package/dist/cjs/alias/index.d.ts +6 -0
- package/dist/cjs/alias/index.js +32 -0
- package/dist/cjs/alias/index.js.map +1 -0
- package/dist/cjs/constants.d.ts +14 -0
- package/dist/cjs/constants.js +18 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/fields.d.ts +11 -0
- package/dist/cjs/fields.js +162 -0
- package/dist/cjs/fields.js.map +1 -0
- package/dist/cjs/functions.d.ts +7 -0
- package/dist/cjs/functions.js +39 -0
- package/dist/cjs/functions.js.map +1 -0
- package/dist/cjs/generated-types.d.ts +30 -0
- package/dist/cjs/generated-types.js +3 -0
- package/dist/cjs/generated-types.js.map +1 -0
- package/dist/cjs/group/generated-types.d.ts +16 -0
- package/dist/cjs/group/generated-types.js +3 -0
- package/dist/cjs/group/generated-types.js.map +1 -0
- package/dist/cjs/group/index.d.ts +6 -0
- package/dist/cjs/group/index.js +21 -0
- package/dist/cjs/group/index.js.map +1 -0
- package/dist/cjs/identify/generated-types.d.ts +19 -0
- package/dist/cjs/identify/generated-types.js +3 -0
- package/dist/cjs/identify/generated-types.js.map +1 -0
- package/dist/cjs/identify/index.d.ts +6 -0
- package/dist/cjs/identify/index.js +21 -0
- package/dist/cjs/identify/index.js.map +1 -0
- package/dist/cjs/index.d.ts +11 -0
- package/dist/cjs/index.js +76 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/init-script.d.ts +1 -0
- package/dist/cjs/init-script.js +65 -0
- package/dist/cjs/init-script.js.map +1 -0
- package/dist/cjs/setting-fields.d.ts +2 -0
- package/dist/cjs/setting-fields.js +273 -0
- package/dist/cjs/setting-fields.js.map +1 -0
- package/dist/cjs/track/generated-types.d.ts +37 -0
- package/dist/cjs/track/generated-types.js +3 -0
- package/dist/cjs/track/generated-types.js.map +1 -0
- package/dist/cjs/track/index.d.ts +6 -0
- package/dist/cjs/track/index.js +93 -0
- package/dist/cjs/track/index.js.map +1 -0
- package/dist/cjs/trackPageView/generated-types.d.ts +37 -0
- package/dist/cjs/trackPageView/generated-types.js +3 -0
- package/dist/cjs/trackPageView/generated-types.js.map +1 -0
- package/dist/cjs/trackPageView/index.d.ts +6 -0
- package/dist/cjs/trackPageView/index.js +101 -0
- package/dist/cjs/trackPageView/index.js.map +1 -0
- package/dist/cjs/types.d.ts +68 -0
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/alias/generated-types.d.ts +4 -0
- package/dist/esm/alias/generated-types.js +2 -0
- package/dist/esm/alias/generated-types.js.map +1 -0
- package/dist/esm/alias/index.d.ts +6 -0
- package/dist/esm/alias/index.js +30 -0
- package/dist/esm/alias/index.js.map +1 -0
- package/dist/esm/constants.d.ts +14 -0
- package/dist/esm/constants.js +15 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/fields.d.ts +11 -0
- package/dist/esm/fields.js +159 -0
- package/dist/esm/fields.js.map +1 -0
- package/dist/esm/functions.d.ts +7 -0
- package/dist/esm/functions.js +35 -0
- package/dist/esm/functions.js.map +1 -0
- package/dist/esm/generated-types.d.ts +30 -0
- package/dist/esm/generated-types.js +2 -0
- package/dist/esm/generated-types.js.map +1 -0
- package/dist/esm/group/generated-types.d.ts +16 -0
- package/dist/esm/group/generated-types.js +2 -0
- package/dist/esm/group/generated-types.js.map +1 -0
- package/dist/esm/group/index.d.ts +6 -0
- package/dist/esm/group/index.js +19 -0
- package/dist/esm/group/index.js.map +1 -0
- package/dist/esm/identify/generated-types.d.ts +19 -0
- package/dist/esm/identify/generated-types.js +2 -0
- package/dist/esm/identify/generated-types.js.map +1 -0
- package/dist/esm/identify/index.d.ts +6 -0
- package/dist/esm/identify/index.js +19 -0
- package/dist/esm/identify/index.js.map +1 -0
- package/dist/esm/index.d.ts +11 -0
- package/dist/esm/index.js +72 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/init-script.d.ts +1 -0
- package/dist/esm/init-script.js +62 -0
- package/dist/esm/init-script.js.map +1 -0
- package/dist/esm/setting-fields.d.ts +2 -0
- package/dist/esm/setting-fields.js +270 -0
- package/dist/esm/setting-fields.js.map +1 -0
- package/dist/esm/track/generated-types.d.ts +37 -0
- package/dist/esm/track/generated-types.js +2 -0
- package/dist/esm/track/generated-types.js.map +1 -0
- package/dist/esm/track/index.d.ts +6 -0
- package/dist/esm/track/index.js +91 -0
- package/dist/esm/track/index.js.map +1 -0
- package/dist/esm/trackPageView/generated-types.d.ts +37 -0
- package/dist/esm/trackPageView/generated-types.js +2 -0
- package/dist/esm/trackPageView/generated-types.js.map +1 -0
- package/dist/esm/trackPageView/index.d.ts +6 -0
- package/dist/esm/trackPageView/index.js +99 -0
- package/dist/esm/trackPageView/index.js.map +1 -0
- package/dist/esm/types.d.ts +68 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +25 -0
- package/src/alias/__tests__/index.test.ts +95 -0
- package/src/alias/generated-types.ts +12 -0
- package/src/alias/index.ts +35 -0
- package/src/constants.ts +16 -0
- package/src/fields.ts +173 -0
- package/src/functions.ts +57 -0
- package/src/generated-types.ts +116 -0
- package/src/group/__tests__/index.test.ts +126 -0
- package/src/group/generated-types.ts +42 -0
- package/src/group/index.ts +29 -0
- package/src/identify/__tests__/index.test.ts +135 -0
- package/src/identify/generated-types.ts +54 -0
- package/src/identify/index.ts +29 -0
- package/src/index.ts +99 -0
- package/src/init-script.ts +63 -0
- package/src/setting-fields.ts +273 -0
- package/src/track/__tests__/index.test.ts +196 -0
- package/src/track/generated-types.ts +102 -0
- package/src/track/index.ts +109 -0
- package/src/trackPageView/__tests__/index.test.ts +250 -0
- package/src/trackPageView/generated-types.ts +102 -0
- package/src/trackPageView/index.ts +116 -0
- package/src/types.ts +78 -0
- package/tsconfig.json +9 -0
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @segment/analytics-browser-mixpanel-web-actions
|
|
2
|
+
|
|
3
|
+
The Mixpanel Web (actions) browser action destination for use with @segment/analytics-next.
|
|
4
|
+
|
|
5
|
+
## License
|
|
6
|
+
|
|
7
|
+
MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2025 Segment
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
|
|
29
|
+
## Contributing
|
|
30
|
+
|
|
31
|
+
All third party contributors acknowledge that any contributions they provide will be made under the same open source license that the open source project is provided under.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/alias/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,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const action = {
|
|
4
|
+
title: 'Identify',
|
|
5
|
+
description: 'Sync user profile data to Mixpanel.',
|
|
6
|
+
defaultSubscription: 'type = "identify"',
|
|
7
|
+
platform: 'web',
|
|
8
|
+
fields: {
|
|
9
|
+
alias: {
|
|
10
|
+
label: 'Alias ID',
|
|
11
|
+
description: 'The new ID to associate with the user.',
|
|
12
|
+
type: 'string',
|
|
13
|
+
required: true,
|
|
14
|
+
allowNull: false,
|
|
15
|
+
default: { '@path': '$.userId' }
|
|
16
|
+
},
|
|
17
|
+
original: {
|
|
18
|
+
label: 'Original ID',
|
|
19
|
+
description: 'The original ID to associate with the user.',
|
|
20
|
+
type: 'string',
|
|
21
|
+
required: true,
|
|
22
|
+
allowNull: false,
|
|
23
|
+
default: { '@path': '$.previousId' }
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
perform: (mixpanel, { payload }) => {
|
|
27
|
+
const { alias, original } = payload;
|
|
28
|
+
mixpanel.alias(alias, original);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
exports.default = action;
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/alias/index.ts"],"names":[],"mappings":";;AAKA,MAAM,MAAM,GAAyD;IACnE,KAAK,EAAE,UAAU;IACjB,WAAW,EAAE,qCAAqC;IAClD,mBAAmB,EAAE,mBAAmB;IACxC,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE;QACN,KAAK,EAAE;YACL,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,wCAAwC;YACrD,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,SAAS,EAAE,KAAK;YAChB,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;SACjC;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,6CAA6C;YAC1D,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,SAAS,EAAE,KAAK;YAChB,OAAO,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;SACrC;KACF;IACD,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACjC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;QACnC,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IACjC,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const PAGE_VIEW_URL_CONFIG_OPTIONS: {
|
|
2
|
+
readonly FULL_URL: "full-url";
|
|
3
|
+
readonly URL_WITH_PATH_AND_QUERY_STRING: "url-with-path-and-query-string";
|
|
4
|
+
readonly URL_WITH_PATH: "url-with-path";
|
|
5
|
+
};
|
|
6
|
+
export declare const PERSISTENCE_OPTIONS: {
|
|
7
|
+
readonly LOCAL_STORAGE: "localStorage";
|
|
8
|
+
readonly COOKIE: "cookie";
|
|
9
|
+
};
|
|
10
|
+
export declare const AUTOCAPTURE_OPTIONS: {
|
|
11
|
+
readonly ENABLED: "enabled";
|
|
12
|
+
readonly DISABLED: "disabled";
|
|
13
|
+
readonly CUSTOM: "custom";
|
|
14
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AUTOCAPTURE_OPTIONS = exports.PERSISTENCE_OPTIONS = exports.PAGE_VIEW_URL_CONFIG_OPTIONS = void 0;
|
|
4
|
+
exports.PAGE_VIEW_URL_CONFIG_OPTIONS = {
|
|
5
|
+
FULL_URL: 'full-url',
|
|
6
|
+
URL_WITH_PATH_AND_QUERY_STRING: 'url-with-path-and-query-string',
|
|
7
|
+
URL_WITH_PATH: 'url-with-path'
|
|
8
|
+
};
|
|
9
|
+
exports.PERSISTENCE_OPTIONS = {
|
|
10
|
+
LOCAL_STORAGE: 'localStorage',
|
|
11
|
+
COOKIE: 'cookie'
|
|
12
|
+
};
|
|
13
|
+
exports.AUTOCAPTURE_OPTIONS = {
|
|
14
|
+
ENABLED: 'enabled',
|
|
15
|
+
DISABLED: 'disabled',
|
|
16
|
+
CUSTOM: 'custom'
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,4BAA4B,GAAG;IAC1C,QAAQ,EAAE,UAAU;IACpB,8BAA8B,EAAE,gCAAgC;IAChE,aAAa,EAAE,eAAe;CACtB,CAAA;AAEG,QAAA,mBAAmB,GAAG;IACjC,aAAa,EAAE,cAAc;IAC7B,MAAM,EAAE,QAAQ;CACR,CAAA;AAEG,QAAA,mBAAmB,GAAG;IACjC,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;CACR,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { InputField } from '@segment/actions-core';
|
|
2
|
+
export declare const event_name: InputField;
|
|
3
|
+
export declare const properties: InputField;
|
|
4
|
+
export declare const unique_id: InputField;
|
|
5
|
+
export declare const user_profile_properties_to_set: InputField;
|
|
6
|
+
export declare const user_profile_properties_to_set_once: InputField;
|
|
7
|
+
export declare const user_profile_properties_to_increment: InputField;
|
|
8
|
+
export declare const group_details: InputField;
|
|
9
|
+
export declare const group_profile_properties_to_set: InputField;
|
|
10
|
+
export declare const group_profile_properties_to_set_once: InputField;
|
|
11
|
+
export declare const group_profile_properties_to_union: InputField;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.group_profile_properties_to_union = exports.group_profile_properties_to_set_once = exports.group_profile_properties_to_set = exports.group_details = exports.user_profile_properties_to_increment = exports.user_profile_properties_to_set_once = exports.user_profile_properties_to_set = exports.unique_id = exports.properties = exports.event_name = void 0;
|
|
4
|
+
exports.event_name = {
|
|
5
|
+
label: 'Event Name',
|
|
6
|
+
description: 'The name of the event to track in Mixpanel.',
|
|
7
|
+
required: true,
|
|
8
|
+
type: 'string',
|
|
9
|
+
default: { '@path': '$.event' }
|
|
10
|
+
};
|
|
11
|
+
exports.properties = {
|
|
12
|
+
label: 'Event Properties',
|
|
13
|
+
description: 'Properties to associate with the event.',
|
|
14
|
+
required: false,
|
|
15
|
+
type: 'object',
|
|
16
|
+
default: { '@path': '$.properties' }
|
|
17
|
+
};
|
|
18
|
+
exports.unique_id = {
|
|
19
|
+
label: 'Unique ID',
|
|
20
|
+
description: 'The unique ID to associate with the user.',
|
|
21
|
+
required: true,
|
|
22
|
+
type: 'string',
|
|
23
|
+
default: { '@path': '$.userId' }
|
|
24
|
+
};
|
|
25
|
+
exports.user_profile_properties_to_set = {
|
|
26
|
+
label: 'User Profile Properties to Set',
|
|
27
|
+
description: 'User Profile Properties to set on the user profile in Mixpanel.',
|
|
28
|
+
required: false,
|
|
29
|
+
defaultObjectUI: 'keyvalue',
|
|
30
|
+
additionalProperties: true,
|
|
31
|
+
type: 'object',
|
|
32
|
+
properties: {
|
|
33
|
+
name: {
|
|
34
|
+
label: 'Name',
|
|
35
|
+
description: 'The name of the user.',
|
|
36
|
+
type: 'string'
|
|
37
|
+
},
|
|
38
|
+
first_name: {
|
|
39
|
+
label: 'First Name',
|
|
40
|
+
description: 'The first name of the user.',
|
|
41
|
+
type: 'string'
|
|
42
|
+
},
|
|
43
|
+
last_name: {
|
|
44
|
+
label: 'Last Name',
|
|
45
|
+
description: 'The last name of the user.',
|
|
46
|
+
type: 'string'
|
|
47
|
+
},
|
|
48
|
+
email: {
|
|
49
|
+
label: 'Email',
|
|
50
|
+
description: 'The email of the user.',
|
|
51
|
+
type: 'string',
|
|
52
|
+
format: 'email'
|
|
53
|
+
},
|
|
54
|
+
phone: {
|
|
55
|
+
label: 'Phone',
|
|
56
|
+
description: 'The phone number of the user.',
|
|
57
|
+
type: 'string'
|
|
58
|
+
},
|
|
59
|
+
avatar: {
|
|
60
|
+
label: 'Avatar',
|
|
61
|
+
description: 'The avatar URL of the user.',
|
|
62
|
+
type: 'string',
|
|
63
|
+
format: 'uri'
|
|
64
|
+
},
|
|
65
|
+
created: {
|
|
66
|
+
label: 'Created',
|
|
67
|
+
description: 'The creation date of the user profile.',
|
|
68
|
+
type: 'string',
|
|
69
|
+
format: 'date-time'
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
default: {
|
|
73
|
+
name: { '@path': '$.traits.name' },
|
|
74
|
+
first_name: { '@path': '$.traits.first_name' },
|
|
75
|
+
last_name: { '@path': '$.traits.last_name' },
|
|
76
|
+
email: { '@path': '$.traits.email' },
|
|
77
|
+
phone: { '@path': '$.traits.phone' },
|
|
78
|
+
avatar: { '@path': '$.traits.avatar' },
|
|
79
|
+
created: { '@path': '$.traits.created' }
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
exports.user_profile_properties_to_set_once = {
|
|
83
|
+
label: 'User Profile Properties to Set Once',
|
|
84
|
+
description: 'User Profile Properties to set once on the user profile in Mixpanel. Values which get set once cannot be overwritten later.',
|
|
85
|
+
required: false,
|
|
86
|
+
defaultObjectUI: 'keyvalue',
|
|
87
|
+
type: 'object'
|
|
88
|
+
};
|
|
89
|
+
exports.user_profile_properties_to_increment = {
|
|
90
|
+
label: 'User Profile Properties to Increment',
|
|
91
|
+
description: 'User Profile Properties to increment on the user profile in Mixpanel. Values must be numeric.',
|
|
92
|
+
required: false,
|
|
93
|
+
defaultObjectUI: 'keyvalue',
|
|
94
|
+
type: 'object'
|
|
95
|
+
};
|
|
96
|
+
exports.group_details = {
|
|
97
|
+
label: 'Group Details',
|
|
98
|
+
description: 'Details for the group to be created or updated in Mixpanel.',
|
|
99
|
+
type: 'object',
|
|
100
|
+
defaultObjectUI: 'keyvalue:only',
|
|
101
|
+
additionalProperties: false,
|
|
102
|
+
required: true,
|
|
103
|
+
properties: {
|
|
104
|
+
group_key: {
|
|
105
|
+
label: 'Group Key',
|
|
106
|
+
description: 'The Group Key / type of group to associate with the user. This group key should already be defined in your Mixpanel project.',
|
|
107
|
+
required: true,
|
|
108
|
+
type: 'string'
|
|
109
|
+
},
|
|
110
|
+
group_id: {
|
|
111
|
+
label: 'Group ID',
|
|
112
|
+
description: 'The unique ID to associate with the group.',
|
|
113
|
+
required: true,
|
|
114
|
+
type: 'string'
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
default: {
|
|
118
|
+
group_key: { '@path': '$.traits.group_key' },
|
|
119
|
+
group_id: { '@path': '$.groupId' }
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
exports.group_profile_properties_to_set = {
|
|
123
|
+
label: 'Group properties to Set',
|
|
124
|
+
description: 'Group Profile Properties to set on the group in Mixpanel.',
|
|
125
|
+
required: false,
|
|
126
|
+
defaultObjectUI: 'keyvalue',
|
|
127
|
+
type: 'object'
|
|
128
|
+
};
|
|
129
|
+
exports.group_profile_properties_to_set_once = {
|
|
130
|
+
label: 'Group properties to set once',
|
|
131
|
+
description: 'Group Profile Properties to set once on the group profile in Mixpanel. Values which get set once cannot be overwritten later.',
|
|
132
|
+
required: false,
|
|
133
|
+
defaultObjectUI: 'keyvalue',
|
|
134
|
+
type: 'object'
|
|
135
|
+
};
|
|
136
|
+
exports.group_profile_properties_to_union = {
|
|
137
|
+
label: 'Group list properties to union',
|
|
138
|
+
description: 'Merge a list into a list group property. Duplicates will be removed.',
|
|
139
|
+
required: false,
|
|
140
|
+
type: 'object',
|
|
141
|
+
multiple: true,
|
|
142
|
+
defaultObjectUI: 'arrayeditor',
|
|
143
|
+
additionalProperties: false,
|
|
144
|
+
properties: {
|
|
145
|
+
list_name: {
|
|
146
|
+
label: 'List Name',
|
|
147
|
+
description: 'The name of the list property to union values into.',
|
|
148
|
+
type: 'string',
|
|
149
|
+
allowNull: false,
|
|
150
|
+
required: true
|
|
151
|
+
},
|
|
152
|
+
string_values: {
|
|
153
|
+
label: 'Values',
|
|
154
|
+
description: 'An array of string values to merge into the list. Non string lists cannot be updated. Duplicates will be removed.',
|
|
155
|
+
type: 'string',
|
|
156
|
+
required: true,
|
|
157
|
+
allowNull: false,
|
|
158
|
+
multiple: true
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../src/fields.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAe;IACpC,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,6CAA6C;IAC1D,QAAQ,EAAE,IAAI;IACd,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;CAChC,CAAA;AAEY,QAAA,UAAU,GAAe;IACpC,KAAK,EAAE,kBAAkB;IACzB,WAAW,EAAE,yCAAyC;IACtD,QAAQ,EAAE,KAAK;IACf,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,EAAE,OAAO,EAAE,cAAc,EA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GAAe;IACzD,KAAK,EAAE,yBAAyB;IAChC,WAAW,EAAE,2DAA2D;IACxE,QAAQ,EAAE,KAAK;IACf,eAAe,EAAE,UAAU;IAC3B,IAAI,EAAE,QAAQ;CACf,CAAA;AAEY,QAAA,oCAAoC,GAAe;IAC9D,KAAK,EAAE,8BAA8B;IACrC,WAAW,EACT,+HAA+H;IACjI,QAAQ,EAAE,KAAK;IACf,eAAe,EAAE,UAAU;IAC3B,IAAI,EAAE,QAAQ;CACf,CAAA;AAEY,QAAA,iCAAiC,GAAe;IAC3D,KAAK,EAAE,gCAAgC;IACvC,WAAW,EAAE,sEAAsE;IACnF,QAAQ,EAAE,KAAK;IACf,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,IAAI;IACd,eAAe,EAAE,aAAa;IAC9B,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACV,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,qDAAqD;YAClE,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,KAAK;YAChB,QAAQ,EAAE,IAAI;SACf;QACD,aAAa,EAAE;YACb,KAAK,EAAE,QAAQ;YACf,WAAW,EACT,mHAAmH;YACrH,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,SAAS,EAAE,KAAK;YAChB,QAAQ,EAAE,IAAI;SACf;KACF;CACF,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Payload as GroupPayload } from './group/generated-types';
|
|
2
|
+
import { Payload as TrackPayload } from './track/generated-types';
|
|
3
|
+
import { Payload as IdentifyPayload } from './identify/generated-types';
|
|
4
|
+
import { Payload as TrackPageViewPayload } from './trackPageView/generated-types';
|
|
5
|
+
import type { Mixpanel } from './types';
|
|
6
|
+
export declare function sendIdentify(mixpanel: Mixpanel, payload: IdentifyPayload | TrackPayload | TrackPageViewPayload): void;
|
|
7
|
+
export declare function sendGroup(mixpanel: Mixpanel, payload: GroupPayload | TrackPayload | TrackPageViewPayload): void;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendIdentify = sendIdentify;
|
|
4
|
+
exports.sendGroup = sendGroup;
|
|
5
|
+
function sendIdentify(mixpanel, payload) {
|
|
6
|
+
const { unique_id, user_profile_properties_to_set, user_profile_properties_to_set_once, user_profile_properties_to_increment } = payload;
|
|
7
|
+
if (unique_id) {
|
|
8
|
+
mixpanel.identify(unique_id);
|
|
9
|
+
}
|
|
10
|
+
if (user_profile_properties_to_set && Object.keys(user_profile_properties_to_set).length > 0) {
|
|
11
|
+
mixpanel.people.set(user_profile_properties_to_set);
|
|
12
|
+
}
|
|
13
|
+
if (user_profile_properties_to_set_once && Object.keys(user_profile_properties_to_set_once).length > 0) {
|
|
14
|
+
mixpanel.people.set_once(user_profile_properties_to_set_once);
|
|
15
|
+
}
|
|
16
|
+
if (user_profile_properties_to_increment && Object.keys(user_profile_properties_to_increment).length > 0) {
|
|
17
|
+
mixpanel.people.increment(user_profile_properties_to_increment);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function sendGroup(mixpanel, payload) {
|
|
21
|
+
const { group_details: { group_key, group_id } = {}, group_profile_properties_to_set, group_profile_properties_to_set_once, group_profile_properties_to_union } = payload;
|
|
22
|
+
if (group_key && group_id) {
|
|
23
|
+
mixpanel.set_group(group_key, group_id);
|
|
24
|
+
const group = mixpanel.get_group(group_key, group_id);
|
|
25
|
+
if (group_profile_properties_to_set && Object.keys(group_profile_properties_to_set).length > 0) {
|
|
26
|
+
group.set(group_profile_properties_to_set);
|
|
27
|
+
}
|
|
28
|
+
if (group_profile_properties_to_set_once && Object.keys(group_profile_properties_to_set_once).length > 0) {
|
|
29
|
+
group.set_once(group_profile_properties_to_set_once);
|
|
30
|
+
}
|
|
31
|
+
if (group_profile_properties_to_union && group_profile_properties_to_union.length > 0) {
|
|
32
|
+
group_profile_properties_to_union.forEach((item) => {
|
|
33
|
+
const { list_name, string_values } = item;
|
|
34
|
+
group.union(list_name, string_values);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/functions.ts"],"names":[],"mappings":";;AAMA,oCAuBC;AAED,8BAyBC;AAlDD,SAAgB,YAAY,CAAC,QAAkB,EAAE,OAA8D;IAC7G,MAAM,EACJ,SAAS,EACT,8BAA8B,EAC9B,mCAAmC,EACnC,oCAAoC,EACrC,GAAG,OAAO,CAAA;IAEX,IAAI,SAAS,EAAE,CAAC;QACd,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;IAC9B,CAAC;IAED,IAAI,8BAA8B,IAAI,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7F,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAA;IACrD,CAAC;IAED,IAAI,mCAAmC,IAAI,MAAM,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvG,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,mCAAmC,CAAC,CAAA;IAC/D,CAAC;IAED,IAAI,oCAAoC,IAAI,MAAM,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzG,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,oCAAoC,CAAC,CAAA;IACjE,CAAC;AACH,CAAC;AAED,SAAgB,SAAS,CAAC,QAAkB,EAAE,OAA2D;IACvG,MAAM,EACJ,aAAa,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,EAC3C,+BAA+B,EAC/B,oCAAoC,EACpC,iCAAiC,EAClC,GAAG,OAAO,CAAA;IAEX,IAAI,SAAS,IAAI,QAAQ,EAAE,CAAC;QAC1B,QAAQ,CAAC,SAAS,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;QACvC,MAAM,KAAK,GAAG,QAAQ,CAAC,SAAS,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;QAErD,IAAI,+BAA+B,IAAI,MAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/F,KAAK,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAA;QAC5C,CAAC;QACD,IAAI,oCAAoC,IAAI,MAAM,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzG,KAAK,CAAC,QAAQ,CAAC,oCAAoC,CAAC,CAAA;QACtD,CAAC;QACD,IAAI,iCAAiC,IAAI,iCAAiC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtF,iCAAiC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBACjD,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,IAAI,CAAA;gBACzC,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,aAAa,CAAC,CAAA;YACvC,CAAC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface Settings {
|
|
2
|
+
projectToken: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
api_host: string;
|
|
5
|
+
autocapture?: string;
|
|
6
|
+
pageview: string;
|
|
7
|
+
click: boolean;
|
|
8
|
+
dead_click: boolean;
|
|
9
|
+
input: boolean;
|
|
10
|
+
rage_click: boolean;
|
|
11
|
+
scroll: boolean;
|
|
12
|
+
submit?: boolean;
|
|
13
|
+
capture_text_content: boolean;
|
|
14
|
+
cross_subdomain_cookie?: boolean;
|
|
15
|
+
persistence?: string;
|
|
16
|
+
track_marketing?: boolean;
|
|
17
|
+
cookie_expiration?: number;
|
|
18
|
+
disable_persistence?: boolean;
|
|
19
|
+
ip?: boolean;
|
|
20
|
+
record_block_class?: string;
|
|
21
|
+
record_block_selector?: string;
|
|
22
|
+
record_canvas?: boolean;
|
|
23
|
+
record_heatmap_data?: boolean;
|
|
24
|
+
record_idle_timeout_ms?: number;
|
|
25
|
+
record_mask_text_class?: string;
|
|
26
|
+
record_mask_text_selector?: string;
|
|
27
|
+
record_max_ms?: number;
|
|
28
|
+
record_min_ms?: number;
|
|
29
|
+
record_sessions_percent?: number;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../src/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
group_details: {
|
|
3
|
+
group_key: string;
|
|
4
|
+
group_id: string;
|
|
5
|
+
};
|
|
6
|
+
group_profile_properties_to_set?: {
|
|
7
|
+
[k: string]: unknown;
|
|
8
|
+
};
|
|
9
|
+
group_profile_properties_to_set_once?: {
|
|
10
|
+
[k: string]: unknown;
|
|
11
|
+
};
|
|
12
|
+
group_profile_properties_to_union?: {
|
|
13
|
+
list_name: string;
|
|
14
|
+
string_values: string[];
|
|
15
|
+
}[];
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/group/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,21 @@
|
|
|
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: 'Group',
|
|
7
|
+
description: 'Sync Group data to Mixpanel.',
|
|
8
|
+
defaultSubscription: 'type = "group"',
|
|
9
|
+
platform: 'web',
|
|
10
|
+
fields: {
|
|
11
|
+
group_details: fields_1.group_details,
|
|
12
|
+
group_profile_properties_to_set: fields_1.group_profile_properties_to_set,
|
|
13
|
+
group_profile_properties_to_set_once: fields_1.group_profile_properties_to_set_once,
|
|
14
|
+
group_profile_properties_to_union: fields_1.group_profile_properties_to_union
|
|
15
|
+
},
|
|
16
|
+
perform: (mixpanel, { payload }) => {
|
|
17
|
+
(0, functions_1.sendGroup)(mixpanel, payload);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
exports.default = action;
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/group/index.ts"],"names":[],"mappings":";;AAIA,4CAAwC;AACxC,sCAKkB;AAElB,MAAM,MAAM,GAAyD;IACnE,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,8BAA8B;IAC3C,mBAAmB,EAAE,gBAAgB;IACrC,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE;QACN,aAAa,EAAb,sBAAa;QACb,+BAA+B,EAA/B,wCAA+B;QAC/B,oCAAoC,EAApC,6CAAoC;QACpC,iCAAiC,EAAjC,0CAAiC;KAClC;IACD,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACjC,IAAA,qBAAS,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC9B,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
unique_id: string;
|
|
3
|
+
user_profile_properties_to_set?: {
|
|
4
|
+
name?: string;
|
|
5
|
+
first_name?: string;
|
|
6
|
+
last_name?: string;
|
|
7
|
+
email?: string;
|
|
8
|
+
phone?: string;
|
|
9
|
+
avatar?: string;
|
|
10
|
+
created?: string;
|
|
11
|
+
[k: string]: unknown;
|
|
12
|
+
};
|
|
13
|
+
user_profile_properties_to_set_once?: {
|
|
14
|
+
[k: string]: unknown;
|
|
15
|
+
};
|
|
16
|
+
user_profile_properties_to_increment?: {
|
|
17
|
+
[k: string]: unknown;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/identify/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,21 @@
|
|
|
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: 'Identify',
|
|
7
|
+
description: 'Sync user profile data to Mixpanel.',
|
|
8
|
+
defaultSubscription: 'type = "identify"',
|
|
9
|
+
platform: 'web',
|
|
10
|
+
fields: {
|
|
11
|
+
unique_id: fields_1.unique_id,
|
|
12
|
+
user_profile_properties_to_set: fields_1.user_profile_properties_to_set,
|
|
13
|
+
user_profile_properties_to_set_once: fields_1.user_profile_properties_to_set_once,
|
|
14
|
+
user_profile_properties_to_increment: fields_1.user_profile_properties_to_increment
|
|
15
|
+
},
|
|
16
|
+
perform: (mixpanel, { payload }) => {
|
|
17
|
+
(0, functions_1.sendIdentify)(mixpanel, payload);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
exports.default = action;
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/identify/index.ts"],"names":[],"mappings":";;AAIA,4CAA2C;AAC3C,sCAKkB;AAElB,MAAM,MAAM,GAAyD;IACnE,KAAK,EAAE,UAAU;IACjB,WAAW,EAAE,qCAAqC;IAClD,mBAAmB,EAAE,mBAAmB;IACxC,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE;QACN,SAAS,EAAT,kBAAS;QACT,8BAA8B,EAA9B,uCAA8B;QAC9B,mCAAmC,EAAnC,4CAAmC;QACnC,oCAAoC,EAApC,6CAAoC;KACrC;IACD,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACjC,IAAA,wBAAY,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IACjC,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Settings } from './generated-types';
|
|
2
|
+
import type { BrowserDestinationDefinition } from '@segment/browser-destination-runtime/types';
|
|
3
|
+
import type { Mixpanel } from './types';
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
mixpanel: Mixpanel;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export declare const destination: BrowserDestinationDefinition<Settings, Mixpanel>;
|
|
10
|
+
declare const _default: import("@segment/browser-destination-runtime/types").PluginFactory;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.destination = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const shim_1 = require("@segment/browser-destination-runtime/shim");
|
|
6
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
7
|
+
const constants_1 = require("./constants");
|
|
8
|
+
const setting_fields_1 = require("./setting-fields");
|
|
9
|
+
const track_1 = tslib_1.__importDefault(require("./track"));
|
|
10
|
+
const trackPageView_1 = tslib_1.__importDefault(require("./trackPageView"));
|
|
11
|
+
const identify_1 = tslib_1.__importDefault(require("./identify"));
|
|
12
|
+
const group_1 = tslib_1.__importDefault(require("./group"));
|
|
13
|
+
const alias_1 = tslib_1.__importDefault(require("./alias"));
|
|
14
|
+
const init_script_1 = require("./init-script");
|
|
15
|
+
exports.destination = {
|
|
16
|
+
name: 'Mixpanel Web (actions)',
|
|
17
|
+
slug: 'mixpanel-web-actions',
|
|
18
|
+
mode: 'device',
|
|
19
|
+
settings: setting_fields_1.settingFields,
|
|
20
|
+
initialize: async ({ settings }, deps) => {
|
|
21
|
+
await (0, init_script_1.initScript)();
|
|
22
|
+
await deps.resolveWhen(() => window?.mixpanel != null, 100);
|
|
23
|
+
const mixpanel = window.mixpanel;
|
|
24
|
+
const { projectToken, name, autocapture, pageview, click, dead_click, input, rage_click, scroll, submit, capture_text_content, persistence, ...rest } = settings;
|
|
25
|
+
const config = {
|
|
26
|
+
autocapture: autocapture === constants_1.AUTOCAPTURE_OPTIONS.CUSTOM
|
|
27
|
+
? {
|
|
28
|
+
pageview: pageview,
|
|
29
|
+
click,
|
|
30
|
+
dead_click,
|
|
31
|
+
input,
|
|
32
|
+
rage_click,
|
|
33
|
+
scroll,
|
|
34
|
+
submit,
|
|
35
|
+
capture_text_content
|
|
36
|
+
}
|
|
37
|
+
: autocapture === constants_1.AUTOCAPTURE_OPTIONS.ENABLED
|
|
38
|
+
? true
|
|
39
|
+
: false,
|
|
40
|
+
persistence: persistence,
|
|
41
|
+
...rest
|
|
42
|
+
};
|
|
43
|
+
if (name) {
|
|
44
|
+
mixpanel.init(projectToken, config, name);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
mixpanel.init(projectToken, config);
|
|
48
|
+
}
|
|
49
|
+
return mixpanel;
|
|
50
|
+
},
|
|
51
|
+
presets: [
|
|
52
|
+
{
|
|
53
|
+
name: 'Track',
|
|
54
|
+
subscribe: 'type = "track"',
|
|
55
|
+
partnerAction: 'track',
|
|
56
|
+
mapping: (0, actions_core_1.defaultValues)(track_1.default.fields),
|
|
57
|
+
type: 'automatic'
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'Identify',
|
|
61
|
+
subscribe: 'type = "identify"',
|
|
62
|
+
partnerAction: 'identify',
|
|
63
|
+
mapping: (0, actions_core_1.defaultValues)(identify_1.default.fields),
|
|
64
|
+
type: 'automatic'
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
actions: {
|
|
68
|
+
track: track_1.default,
|
|
69
|
+
trackPageView: trackPageView_1.default,
|
|
70
|
+
identify: identify_1.default,
|
|
71
|
+
group: group_1.default,
|
|
72
|
+
alias: alias_1.default
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
exports.default = (0, shim_1.browserDestination)(exports.destination);
|
|
76
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAEA,oEAA8E;AAE9E,wDAAqD;AACrD,2CAAiD;AACjD,qDAAgD;AAChD,4DAA2B;AAC3B,4EAA2C;AAC3C,kEAAiC;AACjC,4DAA2B;AAC3B,4DAA2B;AAC3B,+CAA0C;AAQ7B,QAAA,WAAW,GAAqD;IAC3E,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,8BAAa;IACvB,UAAU,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE;QACvC,MAAM,IAAA,wBAAU,GAAE,CAAA;QAClB,MAAM,IAAI,C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