@entrolytics/vue-sdk 2.2.0 → 3.0.1

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.
@@ -0,0 +1,69 @@
1
+ import type { EventPayload } from '@entrolytics/shared';
2
+ import { type App, type InjectionKey, type Ref } from 'vue';
3
+ export type EventData = NonNullable<EventPayload['properties']>;
4
+ export interface EntrolyticsOptions {
5
+ websiteId: string;
6
+ host?: string;
7
+ autoTrack?: boolean;
8
+ respectDnt?: boolean;
9
+ domains?: string[];
10
+ /** Custom tag for A/B testing */
11
+ tag?: string;
12
+ /** Strip query parameters from URLs */
13
+ excludeSearch?: boolean;
14
+ /** Strip hash from URLs */
15
+ excludeHash?: boolean;
16
+ /** Callback before sending data */
17
+ beforeSend?: (type: string, payload: unknown) => unknown | null;
18
+ }
19
+ export interface EntrolyticsInstance {
20
+ track: (eventName: string, eventData?: EventData) => void;
21
+ trackPageView: (url?: string, referrer?: string) => void;
22
+ trackRevenue: (eventName: string, revenue: number, currency?: string, data?: EventData) => void;
23
+ trackOutboundLink: (url: string, data?: EventData) => void;
24
+ identify: (data: EventData) => void;
25
+ identifyUser: (userId: string, traits?: EventData) => void;
26
+ setTag: (tag: string) => void;
27
+ config: EntrolyticsOptions;
28
+ isLoaded: Ref<boolean>;
29
+ isReady: Ref<boolean>;
30
+ }
31
+ declare global {
32
+ interface Window {
33
+ entrolytics?: {
34
+ track: (eventName?: string | object, eventData?: Record<string, unknown>) => void;
35
+ identify: (data: Record<string, unknown>) => void;
36
+ };
37
+ }
38
+ }
39
+ export declare const EntrolyticsKey: InjectionKey<EntrolyticsInstance>;
40
+ /**
41
+ * Create Entrolytics Vue plugin
42
+ *
43
+ * @example
44
+ * Zero-config (reads from import.meta.env):
45
+ * ```ts
46
+ * import { createApp } from 'vue';
47
+ * import { createEntrolytics } from '@entrolytics/vue';
48
+ *
49
+ * const app = createApp(App);
50
+ * app.use(createEntrolytics());
51
+ * app.mount('#app');
52
+ * ```
53
+ *
54
+ * @example
55
+ * Explicit config:
56
+ * ```ts
57
+ * const app = createApp(App);
58
+ * app.use(createEntrolytics({ websiteId: 'your-website-id' }));
59
+ * app.mount('#app');
60
+ * ```
61
+ */
62
+ export declare function createEntrolytics(options?: Partial<EntrolyticsOptions>): {
63
+ install(app: App): void;
64
+ };
65
+ /**
66
+ * Use Entrolytics instance in composition API
67
+ */
68
+ export declare function useEntrolyticsInstance(): EntrolyticsInstance;
69
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,YAAY,EAAU,KAAK,GAAG,EAAO,MAAM,KAAK,CAAC;AAKzE,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC;AAEhE,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,iCAAiC;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,2BAA2B;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mCAAmC;IACnC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,GAAG,IAAI,CAAC;CACjE;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,SAAS,KAAK,IAAI,CAAC;IAC1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sBAAsB,IAAI,mBAAmB,CAM5D"}
package/package.json CHANGED
@@ -1,27 +1,33 @@
1
1
  {
2
2
  "name": "@entrolytics/vue-sdk",
3
- "version": "2.2.0",
3
+ "version": "3.0.1",
4
4
  "description": "Vue SDK for Entrolytics - First-party growth analytics for the edge",
5
5
  "keywords": [
6
- "entrolytics",
7
6
  "analytics",
7
+ "entrolytics",
8
+ "tracking",
8
9
  "vue",
9
10
  "vue3",
10
- "web-analytics",
11
- "tracking"
11
+ "web-analytics"
12
12
  ],
13
- "author": "Entrolytics <hey@entrolytics.click>",
14
- "license": "MIT",
15
13
  "homepage": "https://entrolytics.click",
14
+ "bugs": {
15
+ "url": "https://github.com/entrolytics/vue-sdk/issues"
16
+ },
17
+ "license": "MIT",
18
+ "author": "Entrolytics <hey@entrolytics.click>",
16
19
  "repository": {
17
20
  "type": "git",
18
21
  "url": "https://github.com/entrolytics/vue-sdk",
19
22
  "directory": "entro-vue"
20
23
  },
21
- "bugs": {
22
- "url": "https://github.com/entrolytics/vue-sdk/issues"
23
- },
24
+ "files": [
25
+ "dist",
26
+ "README.md",
27
+ "LICENSE"
28
+ ],
24
29
  "type": "module",
30
+ "sideEffects": false,
25
31
  "main": "./dist/index.cjs",
26
32
  "module": "./dist/index.js",
27
33
  "types": "./dist/index.d.ts",
@@ -33,40 +39,35 @@
33
39
  "require": "./dist/index.cjs"
34
40
  }
35
41
  },
36
- "files": [
37
- "dist",
38
- "README.md",
39
- "LICENSE"
40
- ],
41
- "sideEffects": false,
42
- "engines": {
43
- "node": ">=22.x"
44
- },
45
42
  "publishConfig": {
46
43
  "access": "public"
47
44
  },
45
+ "dependencies": {
46
+ "@entrolytics/shared": "^3.0.1"
47
+ },
48
48
  "devDependencies": {
49
- "@biomejs/biome": "2.3.13",
50
- "tsup": "^8.5.1",
51
- "typescript": "^5.9.3",
52
- "vue": "^3.5.27"
49
+ "typescript": "next",
50
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.3.1",
51
+ "vite-plus": "0.3.1",
52
+ "vue": "^3.5.42"
53
53
  },
54
54
  "peerDependencies": {
55
- "vue": ">=3.5.27",
56
- "vue-router": ">=4.6.4"
55
+ "vue": ">=3.5.28",
56
+ "vue-router": ">=5.0.2"
57
57
  },
58
58
  "peerDependenciesMeta": {
59
59
  "vue-router": {
60
60
  "optional": true
61
61
  }
62
62
  },
63
- "dependencies": {
64
- "@entrolytics/shared": "^2.2.1"
63
+ "engines": {
64
+ "node": ">=24.20.0"
65
65
  },
66
66
  "scripts": {
67
- "dev": "tsup --watch",
68
- "build": "tsup",
69
- "lint": "biome check --write .",
67
+ "build": "vp pack && tsc --emitDeclarationOnly --noEmit false",
68
+ "check": "vp check",
69
+ "dev": "vp pack --watch",
70
+ "lint": "vp lint --fix . && vp fmt --write .",
70
71
  "typecheck": "tsc --noEmit"
71
72
  }
72
73
  }
package/dist/index.d.cts DELETED
@@ -1,230 +0,0 @@
1
- import { Ref, InjectionKey, App } from 'vue';
2
-
3
- /**
4
- * Event payload type - mirrors @entrolytics/shared EventPayload
5
- * TODO: Import from @entrolytics/shared once published with EventPayload export
6
- */
7
- interface EventPayload {
8
- websiteId: string;
9
- sessionId: string;
10
- visitorId: string;
11
- url: string;
12
- referrer?: string;
13
- eventType: string;
14
- eventName?: string;
15
- properties?: Record<string, unknown>;
16
- screenWidth?: number;
17
- screenHeight?: number;
18
- loadTime?: number;
19
- domInteractive?: number;
20
- domComplete?: number;
21
- utmSource?: string;
22
- utmMedium?: string;
23
- utmCampaign?: string;
24
- utmTerm?: string;
25
- utmContent?: string;
26
- }
27
- type EventData = NonNullable<EventPayload['properties']>;
28
- interface EntrolyticsOptions {
29
- websiteId: string;
30
- host?: string;
31
- autoTrack?: boolean;
32
- respectDnt?: boolean;
33
- domains?: string[];
34
- /** Use edge runtime endpoints for faster response times (default: true) */
35
- useEdgeRuntime?: boolean;
36
- /** Custom tag for A/B testing */
37
- tag?: string;
38
- /** Strip query parameters from URLs */
39
- excludeSearch?: boolean;
40
- /** Strip hash from URLs */
41
- excludeHash?: boolean;
42
- /** Callback before sending data */
43
- beforeSend?: (type: string, payload: unknown) => unknown | null;
44
- }
45
- interface EntrolyticsInstance {
46
- track: (eventName: string, eventData?: EventData) => void;
47
- trackPageView: (url?: string, referrer?: string) => void;
48
- trackRevenue: (eventName: string, revenue: number, currency?: string, data?: EventData) => void;
49
- trackOutboundLink: (url: string, data?: EventData) => void;
50
- identify: (data: EventData) => void;
51
- identifyUser: (userId: string, traits?: EventData) => void;
52
- setTag: (tag: string) => void;
53
- config: EntrolyticsOptions;
54
- isLoaded: Ref<boolean>;
55
- isReady: Ref<boolean>;
56
- }
57
- declare global {
58
- interface Window {
59
- entrolytics?: {
60
- track: (eventName?: string | object, eventData?: Record<string, unknown>) => void;
61
- identify: (data: Record<string, unknown>) => void;
62
- };
63
- }
64
- }
65
- declare const EntrolyticsKey: InjectionKey<EntrolyticsInstance>;
66
- /**
67
- * Create Entrolytics Vue plugin
68
- *
69
- * @example
70
- * Zero-config (reads from import.meta.env):
71
- * ```ts
72
- * import { createApp } from 'vue';
73
- * import { createEntrolytics } from '@entrolytics/vue';
74
- *
75
- * const app = createApp(App);
76
- * app.use(createEntrolytics());
77
- * app.mount('#app');
78
- * ```
79
- *
80
- * @example
81
- * Explicit config:
82
- * ```ts
83
- * const app = createApp(App);
84
- * app.use(createEntrolytics({ websiteId: 'your-website-id' }));
85
- * app.mount('#app');
86
- * ```
87
- */
88
- declare function createEntrolytics(options?: Partial<EntrolyticsOptions>): {
89
- install(app: App): void;
90
- };
91
- /**
92
- * Use Entrolytics instance in composition API
93
- */
94
- declare function useEntrolyticsInstance(): EntrolyticsInstance;
95
-
96
- /**
97
- * Main composable for accessing Entrolytics functionality
98
- *
99
- * @example
100
- * ```vue
101
- * <script setup>
102
- * import { useEntrolytics } from '@entrolytics/vue';
103
- *
104
- * const { track, identify, isLoaded } = useEntrolytics();
105
- *
106
- * function handleClick() {
107
- * track('button_click', { variant: 'primary' });
108
- * }
109
- * </script>
110
- * ```
111
- */
112
- declare function useEntrolytics(): EntrolyticsInstance;
113
-
114
- /**
115
- * Composable for identifying users
116
- *
117
- * @example
118
- * ```vue
119
- * <script setup>
120
- * import { watch } from 'vue';
121
- * import { useIdentify } from '@entrolytics/vue';
122
- *
123
- * const { identify } = useIdentify();
124
- * const user = useUser(); // Your auth composable
125
- *
126
- * watch(user, (newUser) => {
127
- * if (newUser) {
128
- * identify(newUser.id, {
129
- * email: newUser.email,
130
- * plan: newUser.subscription
131
- * });
132
- * }
133
- * });
134
- * </script>
135
- * ```
136
- */
137
- declare function useIdentify(): {
138
- identify: (data: EventData) => void;
139
- };
140
-
141
- /**
142
- * Composable for tracking custom events
143
- *
144
- * @example
145
- * ```vue
146
- * <script setup>
147
- * import { useTrackEvent } from '@entrolytics/vue';
148
- *
149
- * const { track } = useTrackEvent();
150
- *
151
- * function handlePurchase() {
152
- * track('purchase', { revenue: 99.99, currency: 'USD' });
153
- * }
154
- * </script>
155
- * ```
156
- */
157
- declare function useTrackEvent(): {
158
- track: (eventName: string, eventData?: EventData) => void;
159
- };
160
-
161
- /**
162
- * Composable for tracking outbound link clicks
163
- *
164
- * @example
165
- * ```vue
166
- * <script setup>
167
- * import { useTrackOutboundLink } from '@entrolytics/vue';
168
- *
169
- * const trackOutboundLink = useTrackOutboundLink();
170
- *
171
- * const handleExternalClick = (url: string) => {
172
- * trackOutboundLink(url, { placement: 'footer' });
173
- * };
174
- * </script>
175
- * ```
176
- */
177
- declare function useTrackOutboundLink(): (url: string, data?: EventData) => void;
178
-
179
- /**
180
- * Composable for tracking page views with vue-router
181
- *
182
- * @example
183
- * ```vue
184
- * <script setup>
185
- * import { useRoute } from 'vue-router';
186
- * import { useTrackPageView } from '@entrolytics/vue';
187
- *
188
- * const route = useRoute();
189
- * useTrackPageView(() => route.path);
190
- * </script>
191
- * ```
192
- *
193
- * @example
194
- * ```vue
195
- * <script setup>
196
- * import { ref } from 'vue';
197
- * import { useTrackPageView } from '@entrolytics/vue';
198
- *
199
- * const currentPath = ref('/');
200
- * useTrackPageView(currentPath);
201
- * </script>
202
- * ```
203
- */
204
- declare function useTrackPageView(pathSource: Ref<string> | (() => string), options?: {
205
- immediate?: boolean;
206
- }): void;
207
-
208
- /**
209
- * Composable for tracking revenue events
210
- *
211
- * @example
212
- * ```vue
213
- * <script setup>
214
- * import { useTrackRevenue } from '@entrolytics/vue';
215
- *
216
- * const trackRevenue = useTrackRevenue();
217
- *
218
- * const handlePurchase = async (product) => {
219
- * await processPayment();
220
- * trackRevenue('purchase', product.price, 'USD', {
221
- * productId: product.id,
222
- * productName: product.name
223
- * });
224
- * };
225
- * </script>
226
- * ```
227
- */
228
- declare function useTrackRevenue(): (eventName: string, revenue: number, currency?: string, data?: EventData) => void;
229
-
230
- export { type EntrolyticsInstance, EntrolyticsKey, type EntrolyticsOptions, type EventData, createEntrolytics, useEntrolytics, useEntrolyticsInstance, useIdentify, useTrackEvent, useTrackOutboundLink, useTrackPageView, useTrackRevenue };