@inzombieland/nuxt-common 1.16.18 → 1.16.20

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.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inzombieland/nuxt-common",
3
- "version": "1.16.18",
3
+ "version": "1.16.20",
4
4
  "configKey": "nuxt-common",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.6.0",
package/dist/module.mjs CHANGED
@@ -2,7 +2,7 @@ import { fileURLToPath } from 'node:url';
2
2
  import { defineNuxtModule, createResolver, addServerHandler, addImportsDir, addPlugin, addComponent } from '@nuxt/kit';
3
3
 
4
4
  const name = "@inzombieland/nuxt-common";
5
- const version = "1.16.18";
5
+ const version = "1.16.20";
6
6
 
7
7
  const module = defineNuxtModule({
8
8
  meta: {
@@ -5,10 +5,11 @@ import { useI18n, useLocalePath } from "#i18n"
5
5
  import { useNuxtApp } from "#imports"
6
6
  import { onMounted, ref, watch } from "vue"
7
7
  import { useRouter } from "vue-router"
8
- import { getVisitorId, getVisitorIdentifier } from "./api"
8
+ import { getVisitorId } from "./api"
9
9
  import { useActiveSessions } from "./composables/use-active-sessions"
10
10
  import { useUserActions } from "./composables/use-user-actions"
11
11
  import { useSubscribe, useUser } from "./packages/api"
12
+ import bus from "./packages/api/bus"
12
13
  import type { ConfigProviderTheme } from "vant"
13
14
  import "@vant/touch-emulator"
14
15
 
@@ -82,7 +83,7 @@ onMounted(() => {
82
83
  })
83
84
 
84
85
  if (typeof window !== "undefined") {
85
- getVisitorIdentifier()
86
+ bus.publish("app:beforeMount", true)
86
87
  }
87
88
  </script>
88
89
 
@@ -18,7 +18,7 @@ export declare const config: {
18
18
  };
19
19
  };
20
20
  };
21
- declare const fetch: Fetch, getUser: () => Promise<import("src/runtime/packages/api/types").GetUserResponse>, getVisitorIdentifier: () => Promise<void>, useApiFetch: () => Fetch, userActions: {
21
+ declare const fetch: Fetch, getUser: () => Promise<import("src/runtime/packages/api/types").GetUserResponse>, useApiFetch: () => Fetch, userActions: {
22
22
  signIn: (body: {
23
23
  username: string;
24
24
  password: string;
@@ -28,4 +28,4 @@ declare const fetch: Fetch, getUser: () => Promise<import("src/runtime/packages/
28
28
  }>;
29
29
  logout: () => Promise<void>;
30
30
  };
31
- export { fetch, getUser, getVisitorIdentifier, useApiFetch, userActions };
31
+ export { fetch, getUser, useApiFetch, userActions };
@@ -22,5 +22,5 @@ export const config = {
22
22
  };
23
23
  }
24
24
  };
25
- const { fetch, getUser, getVisitorIdentifier, useApiFetch, userActions } = initApiFetch($fetch, config);
26
- export { fetch, getUser, getVisitorIdentifier, useApiFetch, userActions };
25
+ const { fetch, getUser, useApiFetch, userActions } = initApiFetch($fetch, config);
26
+ export { fetch, getUser, useApiFetch, userActions };
@@ -6,7 +6,6 @@ export { getVisitor, getVisitorId, type Visitor } from "./get-visitor";
6
6
  export declare function initApiFetch($fetch: Fetch, config: FetchConfig): {
7
7
  fetch: Fetch;
8
8
  getUser: () => Promise<import("./types").GetUserResponse>;
9
- getVisitorIdentifier: () => Promise<void>;
10
9
  useApiFetch: () => Fetch;
11
10
  userActions: {
12
11
  signIn: (body: {
@@ -29,6 +29,7 @@ export function initApiFetch($fetch, config) {
29
29
  refreshToken
30
30
  };
31
31
  if (typeof window !== "undefined") {
32
+ const loggedIn = useLocalStorage("lin", "no");
32
33
  const theme = useLocalStorage("theme", "");
33
34
  const locale = useLocalStorage("locale", "en");
34
35
  const cometServerURL = config.cometServerURL;
@@ -44,6 +45,7 @@ export function initApiFetch($fetch, config) {
44
45
  cometClient.stop();
45
46
  cometClient.isStarted = false;
46
47
  }
48
+ loggedIn.value = user ? "yes" : "no";
47
49
  if (user && user.theme !== theme.value) {
48
50
  theme.value = user.theme;
49
51
  }
@@ -65,6 +67,9 @@ export function initApiFetch($fetch, config) {
65
67
  { immediate: true }
66
68
  );
67
69
  setNotifyDefaultOptions({ position: "bottom" });
70
+ bus.subscribe("app:beforeMount", () => {
71
+ getVisitorIdentifier();
72
+ });
68
73
  }
69
- return { fetch, getUser, getVisitorIdentifier, useApiFetch, userActions };
74
+ return { fetch, getUser, useApiFetch, userActions };
70
75
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inzombieland/api",
3
- "version": "1.16.18",
3
+ "version": "1.16.20",
4
4
  "type": "module",
5
5
  "license": "ISC",
6
6
  "main": "./index.mjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inzombieland/nuxt-common",
3
- "version": "1.16.18",
3
+ "version": "1.16.20",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "exports": {