@inzombieland/nuxt-common 1.18.3 → 1.18.5
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 +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/SidebarProvider.vue +1 -1
- package/dist/runtime/api/index.d.ts +0 -2
- package/dist/runtime/api/index.mjs +3 -5
- package/dist/runtime/api/user-actions.d.ts +1 -1
- package/dist/runtime/api/user-actions.mjs +2 -2
- package/dist/runtime/composables/index.d.ts +1 -0
- package/dist/runtime/composables/index.mjs +1 -0
- package/dist/runtime/middleware/auth.mjs +1 -1
- package/dist/runtime/middleware/guest.mjs +1 -1
- package/dist/runtime/middleware/locale.global.mjs +1 -1
- package/dist/runtime/packages/core/api-client.mjs +4 -6
- package/dist/runtime/packages/core/comet-client.mjs +1 -1
- package/dist/runtime/packages/core/composables/index.d.ts +8 -0
- package/dist/runtime/packages/core/composables/index.mjs +8 -0
- package/dist/runtime/packages/core/composables/use-visitor.d.ts +12 -0
- package/dist/runtime/packages/core/composables/use-visitor.mjs +5 -0
- package/dist/runtime/packages/core/get-user.mjs +1 -2
- package/dist/runtime/packages/core/get-visitor.d.ts +1 -3
- package/dist/runtime/packages/core/get-visitor.mjs +5 -9
- package/dist/runtime/packages/core/helpers/api-helper.d.ts +4 -0
- package/dist/runtime/packages/core/helpers/api-helper.mjs +3 -0
- package/dist/runtime/packages/core/helpers/composables.d.ts +5 -0
- package/dist/runtime/packages/core/helpers/composables.mjs +5 -0
- package/dist/runtime/packages/core/helpers/date-helper.d.ts +4 -0
- package/dist/runtime/packages/core/helpers/date-helper.mjs +3 -0
- package/dist/runtime/packages/core/helpers/device-helper.d.ts +1 -0
- package/dist/runtime/packages/core/helpers/device-helper.mjs +3 -0
- package/dist/runtime/packages/core/helpers/index.d.ts +2 -1
- package/dist/runtime/packages/core/helpers/index.mjs +2 -1
- package/dist/runtime/packages/core/helpers/phone-helper.d.ts +5 -0
- package/dist/runtime/packages/core/helpers/phone-helper.mjs +3 -0
- package/dist/runtime/packages/core/helpers/string-helper.d.ts +3 -0
- package/dist/runtime/packages/core/helpers/string-helper.mjs +3 -0
- package/dist/runtime/packages/core/index.d.ts +6 -11
- package/dist/runtime/packages/core/index.mjs +3 -7
- package/dist/runtime/packages/core/init-application.mjs +4 -5
- package/dist/runtime/packages/core/package.json +1 -1
- package/dist/runtime/packages/core/user-actions.mjs +1 -1
- package/dist/runtime/plugins/device.d.ts +1 -76
- package/dist/runtime/plugins/device.mjs +0 -1
- package/package.json +1 -1
- package/dist/runtime/composables/use-active-sessions.d.ts +0 -3
- package/dist/runtime/composables/use-active-sessions.mjs +0 -3
- package/dist/runtime/composables/use-app-locale.d.ts +0 -3
- package/dist/runtime/composables/use-app-locale.mjs +0 -3
- package/dist/runtime/composables/use-device.d.ts +0 -3
- package/dist/runtime/composables/use-device.mjs +0 -5
- package/dist/runtime/composables/use-subscribe.d.ts +0 -3
- package/dist/runtime/composables/use-subscribe.mjs +0 -3
- package/dist/runtime/composables/use-theme-mode.d.ts +0 -3
- package/dist/runtime/composables/use-theme-mode.mjs +0 -3
- package/dist/runtime/composables/use-user.d.ts +0 -3
- package/dist/runtime/composables/use-user.mjs +0 -3
package/dist/module.json
CHANGED
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.18.
|
|
5
|
+
const version = "1.18.5";
|
|
6
6
|
|
|
7
7
|
const module = defineNuxtModule({
|
|
8
8
|
meta: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { useSwipe, type UseSwipeDirection } from "@vueuse/core"
|
|
3
3
|
import { onMounted, ref, watch } from "vue"
|
|
4
|
-
import { useDevice } from "./composables
|
|
4
|
+
import { useDevice } from "./composables"
|
|
5
5
|
import { useToggleSidebar } from "./composables/use-toggle-sidebar"
|
|
6
6
|
|
|
7
7
|
const sidebarRef = ref<HTMLElement | null>(null)
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { type Fetch } from "../packages/core";
|
|
2
|
-
export { type ActiveSession, type Fetch, type User, type Visitor } from "../packages/core";
|
|
3
|
-
export { getVisitor, getVisitorId, useUser } from "../packages/core";
|
|
4
2
|
export declare const config: {
|
|
5
3
|
apiBaseURL: any;
|
|
6
4
|
cometServerURL: any;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { useRequestHeaders, useRequestURL } from "#imports";
|
|
2
|
-
import { useDevice } from "../composables/use-device.mjs";
|
|
1
|
+
import { useNuxtApp, useRequestHeaders, useRequestURL } from "#imports";
|
|
3
2
|
import { initApiFetch } from "../packages/core/index.mjs";
|
|
4
|
-
export { getVisitor, getVisitorId, useUser } from "../packages/core/index.mjs";
|
|
5
3
|
export const config = {
|
|
6
4
|
apiBaseURL: import.meta.env.VITE_API_BASE_URL,
|
|
7
5
|
cometServerURL: import.meta.env.VITE_COMET_SERVER_URL,
|
|
@@ -12,8 +10,8 @@ export const config = {
|
|
|
12
10
|
appName: import.meta.env.VITE_APP_NAME,
|
|
13
11
|
getHostname: () => useRequestURL().hostname,
|
|
14
12
|
getDevice: async () => {
|
|
15
|
-
const device =
|
|
16
|
-
return await device.getInfo();
|
|
13
|
+
const { $device } = useNuxtApp();
|
|
14
|
+
return await $device.getInfo();
|
|
17
15
|
},
|
|
18
16
|
useRequestHeaders: (include = []) => {
|
|
19
17
|
return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCookie, useRequestHeaders } from "#imports";
|
|
2
|
-
import { useAppLocale, useThemeMode } from "../packages/core/index.mjs";
|
|
2
|
+
import { useAppLocale, useThemeMode, useUser } from "../packages/core/index.mjs";
|
|
3
3
|
import { flush, setToken, updateUser } from "../packages/core/api-client.mjs";
|
|
4
|
-
import { fetch, getUser, userActions
|
|
4
|
+
import { fetch, getUser, userActions } from "./index.mjs";
|
|
5
5
|
export const signIn = userActions.signIn;
|
|
6
6
|
export const logout = userActions.logout;
|
|
7
7
|
export const signInByCodeSendCode = async (body) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../packages/core/composables";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../packages/core/composables/index.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineNuxtRouteMiddleware, navigateTo } from "#app";
|
|
2
2
|
import { useLocalePath } from "#i18n";
|
|
3
|
-
import { useUser } from "../
|
|
3
|
+
import { useUser } from "../packages/core/index.mjs";
|
|
4
4
|
export default defineNuxtRouteMiddleware(() => {
|
|
5
5
|
const user = useUser();
|
|
6
6
|
if (!user.value) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineNuxtRouteMiddleware, navigateTo } from "#app";
|
|
2
2
|
import { useLocalePath } from "#i18n";
|
|
3
3
|
import { useRuntimeConfig } from "#imports";
|
|
4
|
-
import { useUser } from "../
|
|
4
|
+
import { useUser } from "../packages/core/index.mjs";
|
|
5
5
|
export default defineNuxtRouteMiddleware(() => {
|
|
6
6
|
const user = useUser();
|
|
7
7
|
if (user.value) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineNuxtRouteMiddleware, navigateTo } from "#app";
|
|
2
2
|
import { useCookie, useRuntimeConfig } from "#imports";
|
|
3
|
-
import { useUser } from "../
|
|
3
|
+
import { useUser } from "../packages/core/index.mjs";
|
|
4
4
|
export default defineNuxtRouteMiddleware((to) => {
|
|
5
5
|
if (import.meta.server) return;
|
|
6
6
|
const user = useUser();
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import bus from "./bus.mjs";
|
|
2
|
-
import { useApiActions } from "./composables/
|
|
3
|
-
import { useUser } from "./composables/use-user.mjs";
|
|
4
|
-
import { getVisitor } from "./get-visitor.mjs";
|
|
2
|
+
import { useApiActions, useUser, useVisitor } from "./composables/index.mjs";
|
|
5
3
|
import { apiHelper, once } from "./helpers/index.mjs";
|
|
6
4
|
let token = null;
|
|
7
5
|
export const setUser = (newUser) => {
|
|
@@ -93,9 +91,9 @@ const optionsHandler = (options = {}, config) => {
|
|
|
93
91
|
visitor.hostname = location.hostname;
|
|
94
92
|
}
|
|
95
93
|
const { platform, hostname } = visitor;
|
|
96
|
-
const visitorIdentifier =
|
|
97
|
-
if (visitorIdentifier) {
|
|
98
|
-
const { id, ip, device, appName } = visitorIdentifier;
|
|
94
|
+
const visitorIdentifier = useVisitor();
|
|
95
|
+
if (visitorIdentifier.value) {
|
|
96
|
+
const { id, ip, device, appName } = visitorIdentifier.value;
|
|
99
97
|
headers.visitor = btoa(`${platform}|:|${hostname}|:|${id}|:|${ip}|:|${device}|:|${appName}`);
|
|
100
98
|
} else {
|
|
101
99
|
headers.visitor = btoa(`${platform}|:|${hostname}`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Centrifuge } from "centrifuge";
|
|
2
2
|
import { getToken } from "./api-client.mjs";
|
|
3
3
|
import bus from "./bus.mjs";
|
|
4
|
-
import { useApiActions } from "./composables/
|
|
4
|
+
import { useApiActions } from "./composables/index.mjs";
|
|
5
5
|
import { apiHelper } from "./helpers/index.mjs";
|
|
6
6
|
if (typeof window !== "undefined" && import.meta.env.MODE !== "production") {
|
|
7
7
|
window.wsPublish = (eventName, data) => {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "../helpers/composables";
|
|
2
|
+
export { useActiveSessions } from "./use-active-sessions";
|
|
3
|
+
export { useApiActions } from "./use-api-actions";
|
|
4
|
+
export { useAppLocale } from "./use-app-locale";
|
|
5
|
+
export { useSubscribe } from "./use-subscribe";
|
|
6
|
+
export { useThemeMode } from "./use-theme-mode";
|
|
7
|
+
export { useUser } from "./use-user";
|
|
8
|
+
export { useVisitor } from "./use-visitor";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "../helpers/composables.mjs";
|
|
2
|
+
export { useActiveSessions } from "./use-active-sessions.mjs";
|
|
3
|
+
export { useApiActions } from "./use-api-actions.mjs";
|
|
4
|
+
export { useAppLocale } from "./use-app-locale.mjs";
|
|
5
|
+
export { useSubscribe } from "./use-subscribe.mjs";
|
|
6
|
+
export { useThemeMode } from "./use-theme-mode.mjs";
|
|
7
|
+
export { useUser } from "./use-user.mjs";
|
|
8
|
+
export { useVisitor } from "./use-visitor.mjs";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Visitor } from "../types";
|
|
2
|
+
export declare function useVisitor(): import("vue").Ref<{
|
|
3
|
+
id?: string | undefined;
|
|
4
|
+
ip?: string | undefined;
|
|
5
|
+
device?: string | undefined;
|
|
6
|
+
appName?: string | undefined;
|
|
7
|
+
} | null | undefined, Visitor | {
|
|
8
|
+
id?: string | undefined;
|
|
9
|
+
ip?: string | undefined;
|
|
10
|
+
device?: string | undefined;
|
|
11
|
+
appName?: string | undefined;
|
|
12
|
+
} | null | undefined>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useLocalStorage } from "@vueuse/core";
|
|
2
2
|
import { flush, getToken, setUser } from "./api-client.mjs";
|
|
3
|
-
import { useApiActions } from "./composables/
|
|
4
|
-
import { useUser } from "./composables/use-user.mjs";
|
|
3
|
+
import { useApiActions, useUser } from "./composables/index.mjs";
|
|
5
4
|
import { createSingletonAsync, once } from "./helpers/index.mjs";
|
|
6
5
|
async function getUserRequest(fetch, config) {
|
|
7
6
|
const token = getToken();
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import type { FetchConfig
|
|
2
|
-
export declare const getVisitorId: () => string | undefined;
|
|
3
|
-
export declare const getVisitor: () => Visitor | null;
|
|
1
|
+
import type { FetchConfig } from "./types";
|
|
4
2
|
export declare const createApiGetVisitorIdentifier: (config: FetchConfig) => () => Promise<void>;
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import { hashComponents, load } from "@fingerprintjs/fingerprintjs";
|
|
2
2
|
import { ofetch } from "ofetch";
|
|
3
|
+
import { useVisitor } from "./composables/index.mjs";
|
|
3
4
|
import { createSingletonAsync, once } from "./helpers/index.mjs";
|
|
4
|
-
let visitor = null;
|
|
5
|
-
export const getVisitorId = () => {
|
|
6
|
-
return visitor?.id;
|
|
7
|
-
};
|
|
8
|
-
export const getVisitor = () => {
|
|
9
|
-
return visitor;
|
|
10
|
-
};
|
|
11
5
|
const setVisitor = (newVisitor) => {
|
|
12
|
-
visitor =
|
|
6
|
+
const visitor = useVisitor();
|
|
7
|
+
visitor.value = !visitor.value ? newVisitor : { ...visitor.value, ...newVisitor };
|
|
13
8
|
};
|
|
14
9
|
const getVisitorRequest = async (config) => {
|
|
15
|
-
|
|
10
|
+
const visitor = useVisitor();
|
|
11
|
+
if (typeof window === "undefined" || visitor.value) {
|
|
16
12
|
return;
|
|
17
13
|
}
|
|
18
14
|
const fp = await load();
|
|
@@ -41,3 +41,4 @@ export type DeviceType = "mobile" | "tablet" | "desktop" | "unknown";
|
|
|
41
41
|
export type DeviceOrientation = "landscape" | "portrait" | "unknown";
|
|
42
42
|
export type DeviceOs = "ios" | "macos" | "iphone" | "ipad" | "ipod" | "android" | "blackberry" | "windows" | "fxos" | "meego" | "television" | "unknown";
|
|
43
43
|
export declare const deviceHelper: () => Device;
|
|
44
|
+
export declare const useDevice: () => Device;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { apiHelper } from "./api-helper";
|
|
2
2
|
export { dateHelper } from "./date-helper";
|
|
3
|
+
export { deviceHelper, type Device } from "./device-helper";
|
|
3
4
|
export { phoneHelper } from "./phone-helper";
|
|
4
5
|
export { stringHelper } from "./string-helper";
|
|
5
|
-
export
|
|
6
|
+
export * from "./composables";
|
|
6
7
|
export declare function once<T extends (...args: any[]) => any>(fn: T): T;
|
|
7
8
|
export declare function createSingletonAsync<T, Args extends unknown[]>(fn: (...args: Args) => Promise<T>): (...args: Args) => Promise<T>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { apiHelper } from "./api-helper.mjs";
|
|
2
2
|
export { dateHelper } from "./date-helper.mjs";
|
|
3
|
+
export { deviceHelper } from "./device-helper.mjs";
|
|
3
4
|
export { phoneHelper } from "./phone-helper.mjs";
|
|
4
5
|
export { stringHelper } from "./string-helper.mjs";
|
|
5
|
-
export
|
|
6
|
+
export * from "./composables.mjs";
|
|
6
7
|
export function once(fn) {
|
|
7
8
|
let executed = false;
|
|
8
9
|
let result;
|
|
@@ -11,3 +11,8 @@ export declare const phoneHelper: {
|
|
|
11
11
|
convertToPhone: typeof convertToPhone;
|
|
12
12
|
maskPhone: typeof maskPhone;
|
|
13
13
|
};
|
|
14
|
+
export declare const usePhoneHelper: () => {
|
|
15
|
+
getPlainPhoneNumber: typeof getPlainPhoneNumber;
|
|
16
|
+
convertToPhone: typeof convertToPhone;
|
|
17
|
+
maskPhone: typeof maskPhone;
|
|
18
|
+
};
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { type Ref } from "vue";
|
|
2
|
-
import type {
|
|
3
|
-
export type { ActiveSession, Fetch, FetchConfig, User, Visitor };
|
|
2
|
+
import type { Fetch, FetchConfig } from "./types";
|
|
4
3
|
export { default as AppProvider } from "./AppProvider.vue";
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export { useActiveSessions } from "./composables/use-active-sessions";
|
|
8
|
-
export { useThemeMode } from "./composables/use-theme-mode";
|
|
9
|
-
export { useAppLocale } from "./composables/use-app-locale";
|
|
10
|
-
export { getVisitor, getVisitorId } from "./get-visitor";
|
|
4
|
+
export * from "./composables";
|
|
5
|
+
export * from "./types";
|
|
11
6
|
export declare function initApiFetch($fetch: Fetch, config: FetchConfig): {
|
|
12
7
|
fetch: Fetch;
|
|
13
8
|
getUser: () => Promise<import("./types").GetUserResponse>;
|
|
@@ -22,7 +17,7 @@ export declare function initApiFetch($fetch: Fetch, config: FetchConfig): {
|
|
|
22
17
|
}>;
|
|
23
18
|
logout: () => Promise<void>;
|
|
24
19
|
fetchActiveSessions: () => Promise<{
|
|
25
|
-
sessions: ActiveSession[];
|
|
20
|
+
sessions: import("./types").ActiveSession[];
|
|
26
21
|
}>;
|
|
27
22
|
};
|
|
28
23
|
};
|
|
@@ -36,7 +31,7 @@ export declare const useUserActions: () => Ref<{
|
|
|
36
31
|
}>;
|
|
37
32
|
logout: () => Promise<void>;
|
|
38
33
|
fetchActiveSessions: () => Promise<{
|
|
39
|
-
sessions: ActiveSession[];
|
|
34
|
+
sessions: import("./types").ActiveSession[];
|
|
40
35
|
}>;
|
|
41
36
|
}, {
|
|
42
37
|
signIn: (body: {
|
|
@@ -48,6 +43,6 @@ export declare const useUserActions: () => Ref<{
|
|
|
48
43
|
}>;
|
|
49
44
|
logout: () => Promise<void>;
|
|
50
45
|
fetchActiveSessions: () => Promise<{
|
|
51
|
-
sessions: ActiveSession[];
|
|
46
|
+
sessions: import("./types").ActiveSession[];
|
|
52
47
|
}>;
|
|
53
48
|
}> | undefined;
|
|
@@ -3,19 +3,15 @@ import { ref } from "vue";
|
|
|
3
3
|
import { createApiFetch } from "./api-client.mjs";
|
|
4
4
|
import bus from "./bus.mjs";
|
|
5
5
|
import { newCometClient } from "./comet-client.mjs";
|
|
6
|
-
import { useApiActions } from "./composables/
|
|
6
|
+
import { useApiActions } from "./composables/index.mjs";
|
|
7
7
|
import { createApiGetUser } from "./get-user.mjs";
|
|
8
8
|
import { createApiGetVisitorIdentifier } from "./get-visitor.mjs";
|
|
9
9
|
import { createInitApplication } from "./init-application.mjs";
|
|
10
10
|
import { createApiRefreshToken } from "./refresh-token.mjs";
|
|
11
11
|
import { createApiUserActions } from "./user-actions.mjs";
|
|
12
12
|
export { default as AppProvider } from "./AppProvider.vue";
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export { useActiveSessions } from "./composables/use-active-sessions.mjs";
|
|
16
|
-
export { useThemeMode } from "./composables/use-theme-mode.mjs";
|
|
17
|
-
export { useAppLocale } from "./composables/use-app-locale.mjs";
|
|
18
|
-
export { getVisitor, getVisitorId } from "./get-visitor.mjs";
|
|
13
|
+
export * from "./composables/index.mjs";
|
|
14
|
+
export * from "./types.mjs";
|
|
19
15
|
const apiActions = useApiActions();
|
|
20
16
|
let userActions;
|
|
21
17
|
export function initApiFetch($fetch, config) {
|
|
@@ -5,11 +5,9 @@ import ruRU from "vant/es/locale/lang/ru-RU";
|
|
|
5
5
|
import { watch } from "vue";
|
|
6
6
|
import { useI18n } from "vue-i18n";
|
|
7
7
|
import { useRouter } from "vue-router";
|
|
8
|
-
import { useActiveSessions } from "./composables/
|
|
9
|
-
import { useSubscribe } from "./composables/use-subscribe.mjs";
|
|
10
|
-
import { useUser } from "./composables/use-user.mjs";
|
|
8
|
+
import { useActiveSessions, useSubscribe, useUser } from "./composables/index.mjs";
|
|
11
9
|
import { once } from "./helpers/index.mjs";
|
|
12
|
-
import {
|
|
10
|
+
import { useAppLocale, useThemeMode, useUserActions, useVisitor } from "./index.mjs";
|
|
13
11
|
function initApplication() {
|
|
14
12
|
const router = useRouter();
|
|
15
13
|
const user = useUser();
|
|
@@ -73,7 +71,8 @@ function initApplication() {
|
|
|
73
71
|
return activeSession;
|
|
74
72
|
});
|
|
75
73
|
}
|
|
76
|
-
|
|
74
|
+
const visitor = useVisitor();
|
|
75
|
+
if (session?.status === "SignedOut" && session?.visitorId === visitor.value?.id) {
|
|
77
76
|
const userActions = useUserActions();
|
|
78
77
|
const data = await userActions?.value.fetchActiveSessions();
|
|
79
78
|
const isCurrentSession = data?.sessions.some((s) => s.isCurrentSession && s.id === session?.sessionId);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { flush, setToken } from "./api-client.mjs";
|
|
2
|
-
import { useUser } from "./composables/
|
|
2
|
+
import { useUser } from "./composables/index.mjs";
|
|
3
3
|
import { once } from "./helpers/index.mjs";
|
|
4
4
|
export const createApiUserActions = once(
|
|
5
5
|
(fetch, config, getUser) => {
|
|
@@ -1,91 +1,16 @@
|
|
|
1
|
-
import { deviceHelper } from "../packages/core/helpers";
|
|
2
1
|
declare const _default: import("#app").Plugin<{
|
|
3
2
|
device: {
|
|
4
3
|
getInfo: () => Promise<string>;
|
|
5
|
-
mobile: () => boolean;
|
|
6
|
-
tablet: () => boolean;
|
|
7
|
-
desktop: () => boolean;
|
|
8
|
-
ios: () => boolean;
|
|
9
|
-
macos: () => boolean;
|
|
10
|
-
ipad: () => boolean;
|
|
11
|
-
iphone: () => boolean;
|
|
12
|
-
ipod: () => boolean;
|
|
13
|
-
android: () => boolean;
|
|
14
|
-
androidPhone: () => boolean;
|
|
15
|
-
androidTablet: () => boolean;
|
|
16
|
-
blackberry: () => boolean;
|
|
17
|
-
blackberryPhone: () => boolean;
|
|
18
|
-
blackberryTablet: () => boolean;
|
|
19
|
-
windows: () => boolean;
|
|
20
|
-
windowsPhone: () => boolean;
|
|
21
|
-
windowsTablet: () => boolean;
|
|
22
|
-
fxos: () => boolean;
|
|
23
|
-
fxosPhone: () => boolean;
|
|
24
|
-
fxosTablet: () => boolean;
|
|
25
|
-
meego: () => boolean;
|
|
26
|
-
television: () => boolean;
|
|
27
|
-
isMobileApp: boolean;
|
|
28
|
-
mobileApp: () => boolean;
|
|
29
|
-
iosMobileApp: () => boolean;
|
|
30
|
-
androidMobileApp: () => boolean;
|
|
31
|
-
tabletApp: () => boolean;
|
|
32
|
-
iosTabletApp: () => boolean;
|
|
33
|
-
androidTabletApp: () => boolean;
|
|
34
|
-
landscape: () => boolean;
|
|
35
|
-
portrait: () => boolean;
|
|
36
|
-
onChangeOrientation: (cb: (newOrientation: import("src/runtime/packages/core/helpers/device-helper").DeviceOrientation) => void) => void;
|
|
37
|
-
noConflict: (currentDevice: import("src/runtime/packages/core/helpers/device-helper").Device) => void;
|
|
38
|
-
type: import("src/runtime/packages/core/helpers/device-helper").DeviceType;
|
|
39
|
-
orientation: import("src/runtime/packages/core/helpers/device-helper").DeviceOrientation;
|
|
40
|
-
os: import("src/runtime/packages/core/helpers/device-helper").DeviceOs;
|
|
41
|
-
osName: () => string;
|
|
42
4
|
};
|
|
43
5
|
}> & import("#app").ObjectPlugin<{
|
|
44
6
|
device: {
|
|
45
7
|
getInfo: () => Promise<string>;
|
|
46
|
-
mobile: () => boolean;
|
|
47
|
-
tablet: () => boolean;
|
|
48
|
-
desktop: () => boolean;
|
|
49
|
-
ios: () => boolean;
|
|
50
|
-
macos: () => boolean;
|
|
51
|
-
ipad: () => boolean;
|
|
52
|
-
iphone: () => boolean;
|
|
53
|
-
ipod: () => boolean;
|
|
54
|
-
android: () => boolean;
|
|
55
|
-
androidPhone: () => boolean;
|
|
56
|
-
androidTablet: () => boolean;
|
|
57
|
-
blackberry: () => boolean;
|
|
58
|
-
blackberryPhone: () => boolean;
|
|
59
|
-
blackberryTablet: () => boolean;
|
|
60
|
-
windows: () => boolean;
|
|
61
|
-
windowsPhone: () => boolean;
|
|
62
|
-
windowsTablet: () => boolean;
|
|
63
|
-
fxos: () => boolean;
|
|
64
|
-
fxosPhone: () => boolean;
|
|
65
|
-
fxosTablet: () => boolean;
|
|
66
|
-
meego: () => boolean;
|
|
67
|
-
television: () => boolean;
|
|
68
|
-
isMobileApp: boolean;
|
|
69
|
-
mobileApp: () => boolean;
|
|
70
|
-
iosMobileApp: () => boolean;
|
|
71
|
-
androidMobileApp: () => boolean;
|
|
72
|
-
tabletApp: () => boolean;
|
|
73
|
-
iosTabletApp: () => boolean;
|
|
74
|
-
androidTabletApp: () => boolean;
|
|
75
|
-
landscape: () => boolean;
|
|
76
|
-
portrait: () => boolean;
|
|
77
|
-
onChangeOrientation: (cb: (newOrientation: import("src/runtime/packages/core/helpers/device-helper").DeviceOrientation) => void) => void;
|
|
78
|
-
noConflict: (currentDevice: import("src/runtime/packages/core/helpers/device-helper").Device) => void;
|
|
79
|
-
type: import("src/runtime/packages/core/helpers/device-helper").DeviceType;
|
|
80
|
-
orientation: import("src/runtime/packages/core/helpers/device-helper").DeviceOrientation;
|
|
81
|
-
os: import("src/runtime/packages/core/helpers/device-helper").DeviceOs;
|
|
82
|
-
osName: () => string;
|
|
83
8
|
};
|
|
84
9
|
}>;
|
|
85
10
|
export default _default;
|
|
86
11
|
declare module "#app" {
|
|
87
12
|
interface NuxtApp {
|
|
88
|
-
$device:
|
|
13
|
+
$device: {
|
|
89
14
|
getInfo: () => Promise<string> | string;
|
|
90
15
|
};
|
|
91
16
|
$mobileApp: {
|
|
@@ -6,7 +6,6 @@ export default defineNuxtPlugin(() => {
|
|
|
6
6
|
return {
|
|
7
7
|
provide: {
|
|
8
8
|
device: {
|
|
9
|
-
...device,
|
|
10
9
|
getInfo: async () => {
|
|
11
10
|
const { $mobileApp } = useNuxtApp();
|
|
12
11
|
if (device.isMobileApp && $mobileApp && "getInfo" in $mobileApp && typeof $mobileApp.getInfo === "function") {
|
package/package.json
CHANGED