@wxt-dev/analytics 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -68,8 +68,7 @@ function createBackgroundAnalytics(config) {
68
68
  userPropertiesStorage.setValue?.(newUserProperties)
69
69
  ]);
70
70
  const event = await getBaseEvent(meta);
71
- if (config?.debug)
72
- console.debug("[@wxt-dev/analytics] identify", event);
71
+ if (config?.debug) console.debug("[@wxt-dev/analytics] identify", event);
73
72
  if (await enabled.getValue()) {
74
73
  await Promise.allSettled(
75
74
  providers.map((provider) => provider.identify(event))
@@ -90,8 +89,7 @@ function createBackgroundAnalytics(config) {
90
89
  title: meta?.title ?? globalThis.document?.title
91
90
  }
92
91
  };
93
- if (config?.debug)
94
- console.debug("[@wxt-dev/analytics] page", event);
92
+ if (config?.debug) console.debug("[@wxt-dev/analytics] page", event);
95
93
  if (await enabled.getValue()) {
96
94
  await Promise.allSettled(
97
95
  providers.map((provider) => provider.page(event))
@@ -108,8 +106,7 @@ function createBackgroundAnalytics(config) {
108
106
  ...baseEvent,
109
107
  event: { name: eventName, properties: eventProperties }
110
108
  };
111
- if (config?.debug)
112
- console.debug("[@wxt-dev/analytics] track", event);
109
+ if (config?.debug) console.debug("[@wxt-dev/analytics] track", event);
113
110
  if (await enabled.getValue()) {
114
111
  await Promise.allSettled(
115
112
  providers.map((provider) => provider.track(event))
package/dist/module.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as wxt from 'wxt';
2
2
  import { AnalyticsConfig } from './types.mjs';
3
3
 
4
- declare module 'wxt/sandbox' {
4
+ declare module 'wxt/utils/define-app-config' {
5
5
  interface WxtAppConfig {
6
6
  analytics: AnalyticsConfig;
7
7
  }
package/dist/module.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as wxt from 'wxt';
2
2
  import { AnalyticsConfig } from './types.js';
3
3
 
4
- declare module 'wxt/sandbox' {
4
+ declare module 'wxt/utils/define-app-config' {
5
5
  interface WxtAppConfig {
6
6
  analytics: AnalyticsConfig;
7
7
  }
package/dist/module.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import 'wxt';
2
- import 'wxt/sandbox';
2
+ import 'wxt/utils/define-app-config';
3
3
  import { defineWxtModule, addAlias, addWxtPlugin, addViteConfig } from 'wxt/modules';
4
4
  import { resolve } from 'node:path';
5
5
 
@@ -12,14 +12,14 @@ const index = defineWxtModule({
12
12
  const clientModuleId = "@wxt-dev/analytics" ;
13
13
  const pluginModuleId = "@wxt-dev/analytics/background-plugin" ;
14
14
  wxt.hook("build:manifestGenerated", (_, manifest) => {
15
- manifest.permissions ?? (manifest.permissions = []);
15
+ manifest.permissions ??= [];
16
16
  if (!manifest.permissions.includes("storage")) {
17
17
  manifest.permissions.push("storage");
18
18
  }
19
19
  });
20
20
  const wxtAnalyticsCode = [
21
21
  `import { createAnalytics } from '${clientModuleId }';`,
22
- `import { useAppConfig } from 'wxt/client';`,
22
+ `import { useAppConfig } from '#imports';`,
23
23
  ``,
24
24
  `export const analytics = createAnalytics(useAppConfig().analytics);`,
25
25
  ``
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wxt-dev/analytics",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Add analytics to your web extension",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,19 +40,19 @@
40
40
  "dist"
41
41
  ],
42
42
  "peerDependencies": {
43
- "wxt": ">=0.19.23"
43
+ "wxt": ">=0.20.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@aklinker1/check": "^1.4.5",
47
- "@types/chrome": "^0.0.268",
47
+ "@types/chrome": "^0.0.280",
48
48
  "@types/ua-parser-js": "^0.7.39",
49
49
  "publint": "^0.2.12",
50
50
  "typescript": "^5.6.3",
51
- "unbuild": "^2.0.0",
52
- "wxt": "0.19.23"
51
+ "unbuild": "^3.5.0",
52
+ "wxt": "0.20.0"
53
53
  },
54
54
  "dependencies": {
55
- "ua-parser-js": "^1.0.38"
55
+ "ua-parser-js": "^1.0.40"
56
56
  },
57
57
  "scripts": {
58
58
  "dev": "buildc --deps-only -- wxt",