@molecule/app-analytics-mixpanel 1.0.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/LICENSE +115 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/provider.d.ts +29 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +100 -0
- package/dist/provider.js.map +1 -0
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work.
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
+
represent, as a whole, an original work of authorship.
|
|
43
|
+
|
|
44
|
+
"Contribution" shall mean any work of authorship, including the
|
|
45
|
+
original version of the Work and any modifications or additions
|
|
46
|
+
to that Work, that is intentionally submitted to the Licensor for
|
|
47
|
+
inclusion in the Work by the copyright owner or by an individual or
|
|
48
|
+
Legal Entity authorized to submit on behalf of the copyright owner.
|
|
49
|
+
|
|
50
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
51
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
52
|
+
subsequently incorporated within the Work.
|
|
53
|
+
|
|
54
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
55
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
56
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
57
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
58
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
59
|
+
Work and such Derivative Works in Source or Object form.
|
|
60
|
+
|
|
61
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
62
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
63
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
64
|
+
patent license to make, have made, use, offer to sell, sell, import,
|
|
65
|
+
and otherwise transfer the Work.
|
|
66
|
+
|
|
67
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
68
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
69
|
+
modifications, and in Source or Object form, provided that You
|
|
70
|
+
meet the following conditions:
|
|
71
|
+
|
|
72
|
+
(a) You must give any other recipients of the Work or
|
|
73
|
+
Derivative Works a copy of this License; and
|
|
74
|
+
|
|
75
|
+
(b) You must cause any modified files to carry prominent notices
|
|
76
|
+
stating that You changed the files; and
|
|
77
|
+
|
|
78
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
79
|
+
that You distribute, all copyright, patent, trademark, and
|
|
80
|
+
attribution notices from the Source form of the Work,
|
|
81
|
+
excluding those notices that do not pertain to any part of
|
|
82
|
+
the Derivative Works; and
|
|
83
|
+
|
|
84
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
85
|
+
distribution, then any Derivative Works that You distribute must
|
|
86
|
+
include a readable copy of the attribution notices contained
|
|
87
|
+
within such NOTICE file.
|
|
88
|
+
|
|
89
|
+
5. Submission of Contributions.
|
|
90
|
+
|
|
91
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
92
|
+
names, trademarks, service marks, or product names of the Licensor.
|
|
93
|
+
|
|
94
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
95
|
+
agreed to in writing, Licensor provides the Work on an "AS IS" BASIS,
|
|
96
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.
|
|
97
|
+
|
|
98
|
+
8. Limitation of Liability. In no event and under no legal theory shall
|
|
99
|
+
any Contributor be liable to You for damages.
|
|
100
|
+
|
|
101
|
+
9. Accepting Warranty or Additional Liability.
|
|
102
|
+
|
|
103
|
+
Copyright 2026 Molecule Dev, Inc.
|
|
104
|
+
|
|
105
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
106
|
+
you may not use this file except in compliance with the License.
|
|
107
|
+
You may obtain a copy of the License at
|
|
108
|
+
|
|
109
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
110
|
+
|
|
111
|
+
Unless required by applicable law or agreed to in writing, software
|
|
112
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
113
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
114
|
+
See the License for the specific language governing permissions and
|
|
115
|
+
limitations under the License.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mixpanel analytics provider for molecule.dev frontend.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* import { setProvider } from '@molecule/app-analytics'
|
|
7
|
+
* import { createProvider } from '@molecule/app-analytics-mixpanel'
|
|
8
|
+
*
|
|
9
|
+
* // Canonical wiring: read the browser-side token from Vite env and pass it
|
|
10
|
+
* // through options. Without a token, skip bonding — analytics calls no-op.
|
|
11
|
+
* // VITE_MIXPANEL_TOKEN below stands for `import.meta.env.VITE_MIXPANEL_TOKEN`
|
|
12
|
+
* // (write the `import.meta.env` read in your app's bond-setup file).
|
|
13
|
+
* const token = VITE_MIXPANEL_TOKEN as string | undefined
|
|
14
|
+
* if (token) {
|
|
15
|
+
* setProvider(createProvider({ token }))
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* The provider does NOT read env itself — configuration flows in through
|
|
21
|
+
* `createProvider(options)`. The canonical env name is `VITE_MIXPANEL_TOKEN`
|
|
22
|
+
* (the `VITE_` prefix is required: Vite only embeds `VITE_`-prefixed vars
|
|
23
|
+
* into the client bundle, and molecule's scaffolded app `.env` only includes
|
|
24
|
+
* `VITE_*` secrets). Do NOT use the API-side twin name (`MIXPANEL_TOKEN`) in
|
|
25
|
+
* frontend code — that belongs to `@molecule/api-analytics-mixpanel` and
|
|
26
|
+
* never reaches the browser. The Mixpanel project token is a public
|
|
27
|
+
* browser-side credential, safe to embed client-side.
|
|
28
|
+
*
|
|
29
|
+
* Bonding without a token is failure-safe: `createProvider()` (and the lazy
|
|
30
|
+
* `provider` export, which cannot receive options) logs ONE console warning
|
|
31
|
+
* naming VITE_MIXPANEL_TOKEN and returns a no-op provider — the raw SDK would
|
|
32
|
+
* otherwise accept an empty token in total silence and every event would
|
|
33
|
+
* vanish with no breadcrumb. If events never appear in Mixpanel, check the
|
|
34
|
+
* browser console for that warning FIRST.
|
|
35
|
+
*
|
|
36
|
+
* `AnalyticsEvent.timestamp` is NOT honored: the Mixpanel browser SDK has no
|
|
37
|
+
* supported client-set timestamp and always stamps the time of capture. For
|
|
38
|
+
* historical timestamps use `@molecule/api-analytics-mixpanel` server-side.
|
|
39
|
+
*
|
|
40
|
+
* @module
|
|
41
|
+
*/
|
|
42
|
+
export * from './provider.js';
|
|
43
|
+
export * from './types.js';
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mixpanel analytics provider for molecule.dev frontend.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* import { setProvider } from '@molecule/app-analytics'
|
|
7
|
+
* import { createProvider } from '@molecule/app-analytics-mixpanel'
|
|
8
|
+
*
|
|
9
|
+
* // Canonical wiring: read the browser-side token from Vite env and pass it
|
|
10
|
+
* // through options. Without a token, skip bonding — analytics calls no-op.
|
|
11
|
+
* // VITE_MIXPANEL_TOKEN below stands for `import.meta.env.VITE_MIXPANEL_TOKEN`
|
|
12
|
+
* // (write the `import.meta.env` read in your app's bond-setup file).
|
|
13
|
+
* const token = VITE_MIXPANEL_TOKEN as string | undefined
|
|
14
|
+
* if (token) {
|
|
15
|
+
* setProvider(createProvider({ token }))
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* The provider does NOT read env itself — configuration flows in through
|
|
21
|
+
* `createProvider(options)`. The canonical env name is `VITE_MIXPANEL_TOKEN`
|
|
22
|
+
* (the `VITE_` prefix is required: Vite only embeds `VITE_`-prefixed vars
|
|
23
|
+
* into the client bundle, and molecule's scaffolded app `.env` only includes
|
|
24
|
+
* `VITE_*` secrets). Do NOT use the API-side twin name (`MIXPANEL_TOKEN`) in
|
|
25
|
+
* frontend code — that belongs to `@molecule/api-analytics-mixpanel` and
|
|
26
|
+
* never reaches the browser. The Mixpanel project token is a public
|
|
27
|
+
* browser-side credential, safe to embed client-side.
|
|
28
|
+
*
|
|
29
|
+
* Bonding without a token is failure-safe: `createProvider()` (and the lazy
|
|
30
|
+
* `provider` export, which cannot receive options) logs ONE console warning
|
|
31
|
+
* naming VITE_MIXPANEL_TOKEN and returns a no-op provider — the raw SDK would
|
|
32
|
+
* otherwise accept an empty token in total silence and every event would
|
|
33
|
+
* vanish with no breadcrumb. If events never appear in Mixpanel, check the
|
|
34
|
+
* browser console for that warning FIRST.
|
|
35
|
+
*
|
|
36
|
+
* `AnalyticsEvent.timestamp` is NOT honored: the Mixpanel browser SDK has no
|
|
37
|
+
* supported client-set timestamp and always stamps the time of capture. For
|
|
38
|
+
* historical timestamps use `@molecule/api-analytics-mixpanel` server-side.
|
|
39
|
+
*
|
|
40
|
+
* @module
|
|
41
|
+
*/
|
|
42
|
+
export * from './provider.js';
|
|
43
|
+
export * from './types.js';
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mixpanel analytics provider for molecule.dev frontend.
|
|
3
|
+
*
|
|
4
|
+
* Uses the `mixpanel-browser` SDK.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import type { AnalyticsProvider } from '@molecule/app-analytics';
|
|
9
|
+
import type { MixpanelOptions } from './types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Creates a Mixpanel analytics provider using `mixpanel-browser`. Initializes the SDK
|
|
12
|
+
* with the provided token and returns an `AnalyticsProvider` that maps molecule events to
|
|
13
|
+
* Mixpanel's `track`, `identify`, `people.set`, and `set_group` APIs.
|
|
14
|
+
*
|
|
15
|
+
* When no token is provided, this does NOT initialize the SDK (mixpanel-browser
|
|
16
|
+
* accepts `init('')` in TOTAL silence and then sends every event to
|
|
17
|
+
* api.mixpanel.com with an empty token, where it is dropped server-side with no
|
|
18
|
+
* client-side breadcrumb): it logs one actionable warning naming
|
|
19
|
+
* VITE_MIXPANEL_TOKEN and returns a no-op provider, so bonding the lazy
|
|
20
|
+
* `provider` export without configuration degrades gracefully instead of
|
|
21
|
+
* becoming a silent event black hole.
|
|
22
|
+
*
|
|
23
|
+
* @param options - Mixpanel configuration including `token` and optional `debug` flag.
|
|
24
|
+
* @returns An `AnalyticsProvider` backed by the Mixpanel browser SDK.
|
|
25
|
+
*/
|
|
26
|
+
export declare const createProvider: (options?: MixpanelOptions) => AnalyticsProvider;
|
|
27
|
+
/** Lazy-initialized Mixpanel analytics provider singleton. */
|
|
28
|
+
export declare const provider: AnalyticsProvider;
|
|
29
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAGV,iBAAiB,EAElB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU,eAAe,KAAG,iBAmE1D,CAAA;AAID,8DAA8D;AAC9D,eAAO,MAAM,QAAQ,EAAE,iBAUrB,CAAA"}
|
package/dist/provider.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mixpanel analytics provider for molecule.dev frontend.
|
|
3
|
+
*
|
|
4
|
+
* Uses the `mixpanel-browser` SDK.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import mixpanel from 'mixpanel-browser';
|
|
9
|
+
/**
|
|
10
|
+
* Creates a Mixpanel analytics provider using `mixpanel-browser`. Initializes the SDK
|
|
11
|
+
* with the provided token and returns an `AnalyticsProvider` that maps molecule events to
|
|
12
|
+
* Mixpanel's `track`, `identify`, `people.set`, and `set_group` APIs.
|
|
13
|
+
*
|
|
14
|
+
* When no token is provided, this does NOT initialize the SDK (mixpanel-browser
|
|
15
|
+
* accepts `init('')` in TOTAL silence and then sends every event to
|
|
16
|
+
* api.mixpanel.com with an empty token, where it is dropped server-side with no
|
|
17
|
+
* client-side breadcrumb): it logs one actionable warning naming
|
|
18
|
+
* VITE_MIXPANEL_TOKEN and returns a no-op provider, so bonding the lazy
|
|
19
|
+
* `provider` export without configuration degrades gracefully instead of
|
|
20
|
+
* becoming a silent event black hole.
|
|
21
|
+
*
|
|
22
|
+
* @param options - Mixpanel configuration including `token` and optional `debug` flag.
|
|
23
|
+
* @returns An `AnalyticsProvider` backed by the Mixpanel browser SDK.
|
|
24
|
+
*/
|
|
25
|
+
export const createProvider = (options) => {
|
|
26
|
+
const token = options?.token ?? '';
|
|
27
|
+
if (!token) {
|
|
28
|
+
// Graceful degradation with a breadcrumb: without this warning a missing
|
|
29
|
+
// token means events silently vanish (the SDK never complains), which is
|
|
30
|
+
// indistinguishable from a broken tracking call.
|
|
31
|
+
console.warn('[analytics] Mixpanel token not configured — analytics events will NOT be delivered. ' +
|
|
32
|
+
'Pass createProvider({ token }) (canonical source: import.meta.env.VITE_MIXPANEL_TOKEN) ' +
|
|
33
|
+
'or skip bonding the provider entirely.');
|
|
34
|
+
const noop = async () => { };
|
|
35
|
+
return {
|
|
36
|
+
identify: noop,
|
|
37
|
+
track: noop,
|
|
38
|
+
page: noop,
|
|
39
|
+
group: noop,
|
|
40
|
+
reset: noop,
|
|
41
|
+
flush: noop,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
mixpanel.init(token, {
|
|
45
|
+
debug: options?.debug ?? false,
|
|
46
|
+
track_pageview: false, // We handle page views manually via auto-tracking
|
|
47
|
+
});
|
|
48
|
+
return {
|
|
49
|
+
async identify(user) {
|
|
50
|
+
mixpanel.identify(user.userId);
|
|
51
|
+
mixpanel.people.set({
|
|
52
|
+
$email: user.email,
|
|
53
|
+
$name: user.name,
|
|
54
|
+
...user.traits,
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
async track(event) {
|
|
58
|
+
mixpanel.track(event.name, event.properties);
|
|
59
|
+
},
|
|
60
|
+
async page(pageView) {
|
|
61
|
+
mixpanel.track('Page View', {
|
|
62
|
+
page_name: pageView.name,
|
|
63
|
+
page_category: pageView.category,
|
|
64
|
+
page_url: pageView.url,
|
|
65
|
+
page_path: pageView.path,
|
|
66
|
+
page_referrer: pageView.referrer,
|
|
67
|
+
...pageView.properties,
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
async group(groupId, traits) {
|
|
71
|
+
mixpanel.set_group('company', groupId);
|
|
72
|
+
if (traits) {
|
|
73
|
+
mixpanel.get_group('company', groupId).set(traits);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
async reset() {
|
|
77
|
+
mixpanel.reset();
|
|
78
|
+
},
|
|
79
|
+
async flush() {
|
|
80
|
+
// mixpanel-browser sends events immediately, no explicit flush needed
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
/** Default Mixpanel provider instance (lazy-initialized via Proxy on first method call). */
|
|
85
|
+
let _provider = null;
|
|
86
|
+
/** Lazy-initialized Mixpanel analytics provider singleton. */
|
|
87
|
+
export const provider = new Proxy({}, {
|
|
88
|
+
get(_, prop, receiver) {
|
|
89
|
+
if (!_provider)
|
|
90
|
+
_provider = createProvider();
|
|
91
|
+
return Reflect.get(_provider, prop, receiver);
|
|
92
|
+
},
|
|
93
|
+
// set trap: methods run with `this` bound to the proxy — without it, instance-state writes land on the dummy target and are lost (see api-push-notifications-web-push)
|
|
94
|
+
set(_, prop, value) {
|
|
95
|
+
if (!_provider)
|
|
96
|
+
_provider = createProvider();
|
|
97
|
+
return Reflect.set(_provider, prop, value);
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"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"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mixpanel app analytics types for molecule.dev.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
export type { AnalyticsEvent, AnalyticsPageView, AnalyticsProvider, AnalyticsUserProps, } from '@molecule/app-analytics';
|
|
7
|
+
/**
|
|
8
|
+
* Options for creating a Mixpanel provider.
|
|
9
|
+
*/
|
|
10
|
+
export interface MixpanelOptions {
|
|
11
|
+
token?: string;
|
|
12
|
+
debug?: boolean;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EACV,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,yBAAyB,CAAA;AAEhC;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@molecule/app-analytics-mixpanel",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Mixpanel analytics provider for molecule.dev frontend",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"test": "vitest run",
|
|
11
|
+
"test:watch": "vitest"
|
|
12
|
+
},
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"keywords": [
|
|
23
|
+
"molecule",
|
|
24
|
+
"analytics",
|
|
25
|
+
"mixpanel"
|
|
26
|
+
],
|
|
27
|
+
"license": "Apache-2.0",
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"mixpanel-browser": "2.81.0"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@molecule/app-analytics": "^1.0.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@molecule/app-analytics": "1.0.0",
|
|
36
|
+
"@types/node": "26.1.2",
|
|
37
|
+
"typescript": "6.0.3",
|
|
38
|
+
"vitest": "4.1.10"
|
|
39
|
+
},
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "https://github.com/molecule-dev/molecule.git",
|
|
43
|
+
"directory": "packages/app/bonds/analytics/mixpanel"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/molecule-dev/molecule/tree/main/packages/app/bonds/analytics/mixpanel",
|
|
46
|
+
"bugs": "https://github.com/molecule-dev/molecule/issues",
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
}
|
|
50
|
+
}
|