@jctrans-materials/nuxt 1.0.40-beta.0 → 1.0.40-beta.10

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 CHANGED
@@ -8,6 +8,16 @@ Nuxt 3 模块,自动注册 `@jctrans-materials/comps-vue3` 组件,并内置
8
8
  pnpm add @jctrans-materials/nuxt @jctrans-materials/comps-vue3 @jctrans-materials/shared gio-webjs-sdk
9
9
  ```
10
10
 
11
+ ## 版本兼容要求
12
+
13
+ - 宿主项目需自行安装并锁定 Nuxt 与 Vue 版本。
14
+ - 推荐使用 `pnpm install --frozen-lockfile`,避免 CI 环境重解依赖导致构建漂移。
15
+ - 当前模块要求:
16
+ - `nuxt >=3.12.1 <4`
17
+ - `vue >=3.5.18 <4`
18
+
19
+ 说明:`@jctrans-materials/nuxt` 不再在依赖中强行拉起独立 Nuxt/Vue 版本,避免在接入方项目中出现双份框架版本导致的构建失败。
20
+
11
21
  ## Nuxt 配置
12
22
 
13
23
  ```ts
package/dist/module.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import * as _nuxt_schema from '@nuxt/schema';
1
+ import * as nuxt_schema from 'nuxt/schema';
2
2
  import { SharedConfig } from '@jctrans-materials/comps-vue3';
3
3
 
4
4
  interface TrackingInitOptions {
@@ -25,7 +25,7 @@ interface ModuleOptions {
25
25
  sharedConfig?: Partial<SharedConfig>;
26
26
  tracking?: TrackingOptions;
27
27
  }
28
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
28
+ declare const _default: nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
29
29
 
30
30
  declare module "@nuxt/schema" {
31
31
  interface PublicRuntimeConfig {
package/dist/module.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import * as _nuxt_schema from '@nuxt/schema';
1
+ import * as nuxt_schema from 'nuxt/schema';
2
2
  import { SharedConfig } from '@jctrans-materials/comps-vue3';
3
3
 
4
4
  interface TrackingInitOptions {
@@ -25,7 +25,7 @@ interface ModuleOptions {
25
25
  sharedConfig?: Partial<SharedConfig>;
26
26
  tracking?: TrackingOptions;
27
27
  }
28
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
28
+ declare const _default: nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
29
29
 
30
30
  declare module "@nuxt/schema" {
31
31
  interface PublicRuntimeConfig {
package/dist/module.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as _nuxt_schema from '@nuxt/schema';
1
+ import * as nuxt_schema from 'nuxt/schema';
2
2
  import { SharedConfig } from '@jctrans-materials/comps-vue3';
3
3
 
4
4
  interface TrackingInitOptions {
@@ -25,7 +25,7 @@ interface ModuleOptions {
25
25
  sharedConfig?: Partial<SharedConfig>;
26
26
  tracking?: TrackingOptions;
27
27
  }
28
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
28
+ declare const _default: nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
29
29
 
30
30
  declare module "@nuxt/schema" {
31
31
  interface PublicRuntimeConfig {
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "1.0.40-beta.0",
7
+ "version": "1.0.40-beta.10",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -1,3 +1,3 @@
1
1
  import "gio-webjs-sdk";
2
- declare const _default: import("#app").Plugin<Record<string, unknown>> & import("#app").ObjectPlugin<Record<string, unknown>>;
2
+ declare const _default: any;
3
3
  export default _default;
@@ -1,28 +1,2 @@
1
- declare const _default: import("#app").Plugin<{
2
- gio: {
3
- init: () => void;
4
- track: () => void;
5
- isInitialized: () => boolean;
6
- isBrowser: () => boolean;
7
- setUserId: () => void;
8
- clearUserId: () => void;
9
- setGeneralProps: () => void;
10
- setPageAttributes: () => void;
11
- sendPage: () => void;
12
- };
13
- trackEvent: () => void;
14
- }> & import("#app").ObjectPlugin<{
15
- gio: {
16
- init: () => void;
17
- track: () => void;
18
- isInitialized: () => boolean;
19
- isBrowser: () => boolean;
20
- setUserId: () => void;
21
- clearUserId: () => void;
22
- setGeneralProps: () => void;
23
- setPageAttributes: () => void;
24
- sendPage: () => void;
25
- };
26
- trackEvent: () => void;
27
- }>;
1
+ declare const _default: any;
28
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: import("#app").RouteMiddleware;
1
+ declare const _default: any;
2
2
  export default _default;
@@ -1,18 +1,2 @@
1
- type TrackAttrs = Record<string, string | number | Array<string | number>>;
2
- type GioPublicApi = {
3
- isInitialized: () => boolean;
4
- isBrowser: () => boolean;
5
- init: (...args: any[]) => void;
6
- track: (eventName: string, attrs?: TrackAttrs, callback?: () => void) => void;
7
- setGeneralProps: (props: Record<string, any>) => void;
8
- setPageAttributes: (props: Record<string, any>) => void;
9
- sendPage: () => void;
10
- };
11
- declare const _default: import("#app").Plugin<{
12
- gio: GioPublicApi;
13
- trackEvent: (eventName: string, attrs?: TrackAttrs) => void;
14
- }> & import("#app").ObjectPlugin<{
15
- gio: GioPublicApi;
16
- trackEvent: (eventName: string, attrs?: TrackAttrs) => void;
17
- }>;
1
+ declare const _default: any;
18
2
  export default _default;
@@ -1,5 +1,9 @@
1
1
  import { callOnce, defineNuxtPlugin, useRuntimeConfig, useRouter } from "#app";
2
- import { getOrCreateClientId, tracker } from "@jctrans-materials/shared";
2
+ import {
3
+ getOrCreateClientId,
4
+ normalizeClickPageAttrs,
5
+ tracker
6
+ } from "@jctrans-materials/shared";
3
7
  import { nextTick } from "vue";
4
8
  const pickString = (...values) => {
5
9
  for (const value of values) {
@@ -91,11 +95,15 @@ const bindTrackHandler = (element, binding, gio) => {
91
95
  if (normalized.stop && "stopPropagation" in event) {
92
96
  event.stopPropagation();
93
97
  }
94
- gio.track(normalized.eventName, normalized.attrs, () => {
98
+ const normalizedAttrs = normalizeClickPageAttrs(
99
+ normalized.eventName,
100
+ normalized.attrs
101
+ );
102
+ gio.track(normalized.eventName, normalizedAttrs, () => {
95
103
  normalized.callback?.({
96
104
  event,
97
105
  eventName: normalized.eventName,
98
- attrs: normalized.attrs,
106
+ attrs: normalizedAttrs,
99
107
  trigger: normalized.trigger
100
108
  });
101
109
  });
@@ -201,7 +209,7 @@ export default defineNuxtPlugin((nuxtApp) => {
201
209
  const trackEvent = (eventName, attrs) => {
202
210
  const normalizedEvent = pickString(eventName);
203
211
  if (!normalizedEvent) return;
204
- gio.track(normalizedEvent, attrs || {});
212
+ gio.track(normalizedEvent, normalizeClickPageAttrs(normalizedEvent, attrs));
205
213
  };
206
214
  const directiveName = normalizeDirectiveName(
207
215
  globalTracking.directiveName || runtimeTracking.directiveName
@@ -1,6 +1,2 @@
1
- declare const _default: import("#app").Plugin<{
2
- initAuthSharedConfig: (newConfig: Partial<import("@jctrans-materials/shared").SharedConfig>) => void;
3
- }> & import("#app").ObjectPlugin<{
4
- initAuthSharedConfig: (newConfig: Partial<import("@jctrans-materials/shared").SharedConfig>) => void;
5
- }>;
1
+ declare const _default: any;
6
2
  export default _default;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jctrans-materials/nuxt",
3
3
  "type": "module",
4
- "version": "1.0.40-beta.0",
4
+ "version": "1.0.40-beta.10",
5
5
  "description": "Nuxt module for JCtrans UI components",
6
6
  "exports": {
7
7
  ".": {
@@ -22,14 +22,14 @@
22
22
  "nuxt": "^3.0.0",
23
23
  "vue": "^3.5.26",
24
24
  "vue-router": "^4.6.4",
25
- "@jctrans-materials/comps-vue3": "1.0.40-beta.0",
26
- "@jctrans-materials/shared": "1.0.40-beta.0"
25
+ "@jctrans-materials/shared": "1.0.40-beta.10",
26
+ "@jctrans-materials/comps-vue3": "1.0.40-beta.10"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "gio-webjs-sdk": "^4.0.0",
30
30
  "nuxt": "^3.0.0",
31
- "@jctrans-materials/shared": "1.0.40-beta.0",
32
- "@jctrans-materials/comps-vue3": "1.0.40-beta.0"
31
+ "@jctrans-materials/comps-vue3": "1.0.40-beta.10",
32
+ "@jctrans-materials/shared": "1.0.40-beta.10"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@nuxt/module-builder": "latest",
@@ -39,7 +39,6 @@
39
39
  "build": "nuxt-module-build",
40
40
  "dev": "nuxt dev",
41
41
  "generate": "nuxt generate",
42
- "preview": "nuxt preview",
43
- "postinstall": "nuxt prepare"
42
+ "preview": "nuxt preview"
44
43
  }
45
44
  }