@jctrans-materials/nuxt 1.0.37-beta.7 → 1.0.37-beta.8

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/module.cjs CHANGED
@@ -68,6 +68,14 @@ const module$1 = kit.defineNuxtModule({
68
68
  src: resolve("./runtime/plugin"),
69
69
  mode: "all"
70
70
  });
71
+ kit.addPlugin({
72
+ src: resolve("./runtime/gio.client"),
73
+ mode: "client"
74
+ });
75
+ kit.addPlugin({
76
+ src: resolve("./runtime/gio.server"),
77
+ mode: "server"
78
+ });
71
79
  kit.addPlugin({
72
80
  src: resolve("./runtime/plugin.client"),
73
81
  mode: "client"
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "1.0.37-beta.7",
7
+ "version": "1.0.37-beta.8",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -65,6 +65,14 @@ const module$1 = defineNuxtModule({
65
65
  src: resolve("./runtime/plugin"),
66
66
  mode: "all"
67
67
  });
68
+ addPlugin({
69
+ src: resolve("./runtime/gio.client"),
70
+ mode: "client"
71
+ });
72
+ addPlugin({
73
+ src: resolve("./runtime/gio.server"),
74
+ mode: "server"
75
+ });
68
76
  addPlugin({
69
77
  src: resolve("./runtime/plugin.client"),
70
78
  mode: "client"
@@ -0,0 +1,3 @@
1
+ import "gio-webjs-sdk";
2
+ declare const _default: import("#app").Plugin<Record<string, unknown>> & import("#app").ObjectPlugin<Record<string, unknown>>;
3
+ export default _default;
@@ -0,0 +1,15 @@
1
+ import { defineNuxtPlugin } from "#app";
2
+ import "gio-webjs-sdk";
3
+ export default defineNuxtPlugin({
4
+ name: "jctrans-gio-sdk-loader",
5
+ enforce: "pre",
6
+ setup() {
7
+ if (process.dev && typeof window !== "undefined") {
8
+ if (typeof window.gdp !== "function") {
9
+ console.warn(
10
+ "[GIO] SDK \u5DF2\u5F15\u5165\uFF0C\u4F46 window.gdp \u4ECD\u4E0D\u53EF\u7528\uFF0C\u8BF7\u68C0\u67E5\u6253\u5305/\u8FD0\u884C\u73AF\u5883"
11
+ );
12
+ }
13
+ }
14
+ }
15
+ });
@@ -0,0 +1,28 @@
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
+ }>;
28
+ export default _default;
@@ -0,0 +1,42 @@
1
+ import { defineNuxtPlugin, useRuntimeConfig } from "#app";
2
+ const normalizeDirectiveName = (value) => {
3
+ if (typeof value !== "string") return "gio-track";
4
+ const trimmed = value.trim();
5
+ if (!trimmed) return "gio-track";
6
+ return trimmed.replace(/^v-/, "");
7
+ };
8
+ export default defineNuxtPlugin((nuxtApp) => {
9
+ const runtimeConfig = useRuntimeConfig();
10
+ const directiveName = normalizeDirectiveName(
11
+ runtimeConfig.public?.jctrans?.tracking?.directiveName
12
+ );
13
+ nuxtApp.vueApp.directive("gio-track", {});
14
+ if (directiveName !== "gio-track") {
15
+ nuxtApp.vueApp.directive(directiveName, {});
16
+ }
17
+ const mockGio = {
18
+ init: () => {
19
+ },
20
+ track: () => {
21
+ },
22
+ isInitialized: () => false,
23
+ isBrowser: () => false,
24
+ setUserId: () => {
25
+ },
26
+ clearUserId: () => {
27
+ },
28
+ setGeneralProps: () => {
29
+ },
30
+ setPageAttributes: () => {
31
+ },
32
+ sendPage: () => {
33
+ }
34
+ };
35
+ return {
36
+ provide: {
37
+ gio: mockGio,
38
+ trackEvent: () => {
39
+ }
40
+ }
41
+ };
42
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jctrans-materials/nuxt",
3
3
  "type": "module",
4
- "version": "1.0.37-beta.7",
4
+ "version": "1.0.37-beta.8",
5
5
  "description": "Nuxt module for JCtrans UI components",
6
6
  "exports": {
7
7
  ".": {
@@ -22,13 +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.37-beta.7",
26
- "@jctrans-materials/shared": "1.0.37-beta.7"
25
+ "@jctrans-materials/shared": "1.0.37-beta.8",
26
+ "@jctrans-materials/comps-vue3": "1.0.37-beta.8"
27
27
  },
28
28
  "peerDependencies": {
29
+ "gio-webjs-sdk": "^4.0.0",
29
30
  "nuxt": "^3.0.0",
30
- "@jctrans-materials/comps-vue3": "1.0.37-beta.7",
31
- "@jctrans-materials/shared": "1.0.37-beta.7"
31
+ "@jctrans-materials/shared": "1.0.37-beta.8",
32
+ "@jctrans-materials/comps-vue3": "1.0.37-beta.8"
32
33
  },
33
34
  "devDependencies": {
34
35
  "@nuxt/module-builder": "latest",