@merkaly/nuxt 0.6.5 → 0.6.7
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 +125 -79
- package/dist/runtime/adapters/create.auth.session.d.ts +1 -1
- package/dist/runtime/adapters/create.auth.session.js +6 -13
- package/dist/runtime/composables/useAuth.d.ts +1 -2
- package/dist/runtime/composables/useAuth.js +1 -3
- package/dist/runtime/composables/useTenant.d.ts +5 -0
- package/dist/runtime/composables/useTenant.js +12 -0
- package/dist/runtime/middleware/auth.d.ts +1 -1
- package/dist/runtime/plugins/api.global.d.ts +1 -1
- package/dist/runtime/plugins/api.global.js +6 -2
- package/dist/runtime/plugins/auth0.client.d.ts +2 -2
- package/dist/runtime/plugins/auth0.client.js +4 -1
- package/dist/runtime/plugins/sentry.global.d.ts +1 -1
- package/dist/runtime/plugins/sentry.global.js +5 -7
- package/dist/runtime/types/nuxt.d.ts +8 -3
- package/package.json +32 -35
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { defineNuxtModule, useLogger, createResolver, addPlugin, addServerHandler, addRouteMiddleware, addImportsDir, addComponentsDir, addTypeTemplate, addTemplate } from '@nuxt/kit';
|
|
2
|
-
import { defu } from 'defu';
|
|
3
|
-
import { createJiti } from 'jiti';
|
|
4
2
|
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
5
3
|
import { resolve, dirname } from 'node:path';
|
|
4
|
+
import { defu } from 'defu';
|
|
5
|
+
import { createJiti } from 'jiti';
|
|
6
6
|
import svgLoader from 'vite-svg-loader';
|
|
7
7
|
import 'reflect-metadata';
|
|
8
8
|
|
|
9
|
+
const MODULE_NAME = "@merkaly/nuxt";
|
|
10
|
+
const MERKALY_ORG = "merkaly";
|
|
11
|
+
const PLAUSIBLE_API_HOST = "https://analytics.merkaly.io";
|
|
12
|
+
const FONT_AWESOME_KIT_URL = "https://kit.fontawesome.com/55a4b2f4e1.js";
|
|
9
13
|
const defaultOptions = {
|
|
10
14
|
api: {
|
|
11
15
|
url: "/",
|
|
@@ -34,11 +38,48 @@ const defaultOptions = {
|
|
|
34
38
|
token: ""
|
|
35
39
|
}
|
|
36
40
|
};
|
|
41
|
+
function hasI18nConfig(options) {
|
|
42
|
+
return Boolean(
|
|
43
|
+
options.i18n?.defaultLocale && options.i18n.locales.length > 0
|
|
44
|
+
);
|
|
45
|
+
}
|
|
37
46
|
function hasPlausibleConfig(options) {
|
|
38
47
|
return Boolean(options.plausible?.domain);
|
|
39
48
|
}
|
|
49
|
+
function hasSentryBuildConfig(options) {
|
|
50
|
+
return Boolean(options.sentry.project && options.sentry.token);
|
|
51
|
+
}
|
|
52
|
+
function resolveModuleOptions(nuxt) {
|
|
53
|
+
return defu(nuxt.options.merkaly || {}, defaultOptions);
|
|
54
|
+
}
|
|
55
|
+
function buildModuleDependencies(nuxt, options) {
|
|
56
|
+
const dependencies = {
|
|
57
|
+
"@bootstrap-vue-next/nuxt": {},
|
|
58
|
+
"@nuxt/eslint": {},
|
|
59
|
+
"@nuxt/fonts": {},
|
|
60
|
+
"@nuxt/image": {},
|
|
61
|
+
"@sentry/nuxt/module": {},
|
|
62
|
+
"@vueuse/nuxt": {},
|
|
63
|
+
"notivue/nuxt": {}
|
|
64
|
+
};
|
|
65
|
+
if (hasI18nConfig(options)) {
|
|
66
|
+
dependencies["@nuxtjs/i18n"] = {
|
|
67
|
+
overrides: configureI18n(nuxt, options)
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
if (hasPlausibleConfig(options)) {
|
|
71
|
+
dependencies["@nuxtjs/plausible"] = {};
|
|
72
|
+
}
|
|
73
|
+
const logger = useLogger(MODULE_NAME);
|
|
74
|
+
Object.keys(dependencies).forEach((dependency) => {
|
|
75
|
+
logger.info(`Loaded ${dependency} module`);
|
|
76
|
+
});
|
|
77
|
+
return dependencies;
|
|
78
|
+
}
|
|
40
79
|
function configureI18n(nuxt, options) {
|
|
41
|
-
if (!options
|
|
80
|
+
if (!hasI18nConfig(options)) {
|
|
81
|
+
return {};
|
|
82
|
+
}
|
|
42
83
|
const writeTemplate = (filename, contents) => {
|
|
43
84
|
const template = addTemplate({
|
|
44
85
|
filename,
|
|
@@ -49,25 +90,28 @@ function configureI18n(nuxt, options) {
|
|
|
49
90
|
writeFileSync(template.dst, contents);
|
|
50
91
|
return template.dst;
|
|
51
92
|
};
|
|
52
|
-
nuxt.options.alias
|
|
93
|
+
nuxt.options.alias.i18n = resolve(nuxt.options.buildDir, "i18n");
|
|
53
94
|
const vueI18n = writeTemplate(
|
|
54
95
|
"i18n/config.mjs",
|
|
55
96
|
`export default defineI18nConfig(() => (${JSON.stringify({
|
|
56
97
|
fallbackLocale: options.i18n.defaultLocale,
|
|
98
|
+
flatJson: true,
|
|
57
99
|
legacy: false,
|
|
58
100
|
locale: options.i18n.defaultLocale
|
|
59
101
|
}, null, 2)}))
|
|
60
102
|
`
|
|
61
103
|
);
|
|
62
|
-
nuxt.hook("i18n:registerModule", (register) =>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
104
|
+
nuxt.hook("i18n:registerModule", (register) => {
|
|
105
|
+
register({
|
|
106
|
+
langDir: nuxt.options.rootDir,
|
|
107
|
+
locales: options.i18n.locales.map((locale) => ({
|
|
108
|
+
code: locale.code,
|
|
109
|
+
file: locale.file,
|
|
110
|
+
language: locale.language,
|
|
111
|
+
name: locale.name
|
|
112
|
+
}))
|
|
113
|
+
});
|
|
114
|
+
});
|
|
71
115
|
return {
|
|
72
116
|
defaultLocale: options.i18n.defaultLocale,
|
|
73
117
|
detectBrowserLanguage: { useCookie: true },
|
|
@@ -76,51 +120,47 @@ function configureI18n(nuxt, options) {
|
|
|
76
120
|
vueI18n
|
|
77
121
|
};
|
|
78
122
|
}
|
|
79
|
-
function buildModuleDependencies(nuxt, options) {
|
|
80
|
-
const dependencies = {
|
|
81
|
-
"@bootstrap-vue-next/nuxt": {},
|
|
82
|
-
"@nuxt/eslint": {},
|
|
83
|
-
"@nuxt/fonts": {},
|
|
84
|
-
"@nuxt/image": {},
|
|
85
|
-
"@nuxtjs/i18n": { overrides: configureI18n(nuxt, options) },
|
|
86
|
-
"@sentry/nuxt/module": {},
|
|
87
|
-
"@vueuse/nuxt": {},
|
|
88
|
-
"notivue/nuxt": {}
|
|
89
|
-
};
|
|
90
|
-
if (hasPlausibleConfig(options)) {
|
|
91
|
-
dependencies["@nuxtjs/plausible"] = {};
|
|
92
|
-
}
|
|
93
|
-
const logger = useLogger("@merkaly/nuxt");
|
|
94
|
-
Object.keys(dependencies).forEach((it) => logger.info(`Loaded ${it} module`));
|
|
95
|
-
return dependencies;
|
|
96
|
-
}
|
|
97
123
|
function configureRuntimeConfig(nuxt, options) {
|
|
124
|
+
nuxt.options.runtimeConfig.merkaly = defu({
|
|
125
|
+
sentry: {
|
|
126
|
+
token: options.sentry.token
|
|
127
|
+
}
|
|
128
|
+
}, nuxt.options.runtimeConfig.merkaly || {});
|
|
98
129
|
nuxt.options.runtimeConfig.public.merkaly = defu(
|
|
99
|
-
|
|
130
|
+
{
|
|
131
|
+
api: options.api,
|
|
132
|
+
auth0: options.auth0,
|
|
133
|
+
i18n: options.i18n,
|
|
134
|
+
plausible: options.plausible,
|
|
135
|
+
sentry: {
|
|
136
|
+
dsn: options.sentry.dsn,
|
|
137
|
+
project: options.sentry.project
|
|
138
|
+
}
|
|
139
|
+
},
|
|
100
140
|
nuxt.options.runtimeConfig.public.merkaly || {}
|
|
101
141
|
);
|
|
102
142
|
}
|
|
103
143
|
function configurePlausible(nuxt, options) {
|
|
104
|
-
nuxt.options.plausible = defu(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
// @ts-expect-error plausible not defined
|
|
114
|
-
nuxt.options.plausible || {}
|
|
115
|
-
);
|
|
144
|
+
nuxt.options.plausible = defu({
|
|
145
|
+
apiHost: PLAUSIBLE_API_HOST,
|
|
146
|
+
domain: options.plausible?.domain,
|
|
147
|
+
enableAutoOutboundTracking: true,
|
|
148
|
+
enableAutoPageviews: true,
|
|
149
|
+
enabled: process.env.NODE_ENV === "production" && hasPlausibleConfig(options),
|
|
150
|
+
ignoredHostnames: ["localhost", options.plausible?.localhost].filter(Boolean)
|
|
151
|
+
// @ts-expect-error Plausible module options aren't typed in Nuxt options
|
|
152
|
+
}, nuxt.options.plausible || {});
|
|
116
153
|
}
|
|
117
154
|
function configureSentry(nuxt, options) {
|
|
118
155
|
nuxt.options.sentry = defu({
|
|
119
156
|
authToken: options.sentry.token,
|
|
120
|
-
org:
|
|
157
|
+
org: MERKALY_ORG,
|
|
121
158
|
project: options.sentry.project
|
|
122
|
-
});
|
|
123
|
-
nuxt.options.sourcemap = {
|
|
159
|
+
}, nuxt.options.sentry || {});
|
|
160
|
+
nuxt.options.sourcemap = {
|
|
161
|
+
client: "hidden",
|
|
162
|
+
server: true
|
|
163
|
+
};
|
|
124
164
|
}
|
|
125
165
|
function configureBootstrapVueNext(nuxt, components) {
|
|
126
166
|
nuxt.options.bootstrapVueNext = defu(
|
|
@@ -128,7 +168,7 @@ function configureBootstrapVueNext(nuxt, components) {
|
|
|
128
168
|
{ plugin: { components } }
|
|
129
169
|
);
|
|
130
170
|
}
|
|
131
|
-
function
|
|
171
|
+
function configureNotivue(nuxt) {
|
|
132
172
|
nuxt.options.css.push("notivue/notification.css");
|
|
133
173
|
nuxt.options.css.push("notivue/animations.css");
|
|
134
174
|
nuxt.options.css.push("notivue/notification-progress.css");
|
|
@@ -142,21 +182,30 @@ function configureNotiVue(nuxt) {
|
|
|
142
182
|
position: "top-right"
|
|
143
183
|
};
|
|
144
184
|
}
|
|
145
|
-
function
|
|
146
|
-
nuxt.options.app
|
|
185
|
+
function configureFontAwesome(nuxt) {
|
|
186
|
+
nuxt.options.app.head ||= {};
|
|
187
|
+
nuxt.options.app.head.script ||= [];
|
|
188
|
+
nuxt.options.app.head.script.push({
|
|
147
189
|
crossorigin: "anonymous",
|
|
148
|
-
src:
|
|
190
|
+
src: FONT_AWESOME_KIT_URL
|
|
149
191
|
});
|
|
150
192
|
}
|
|
151
193
|
function configureVite(nuxt) {
|
|
152
|
-
nuxt.options.vite = defu(
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
plugins: [svgLoader()]
|
|
156
|
-
}
|
|
157
|
-
);
|
|
194
|
+
nuxt.options.vite = defu(nuxt.options.vite || {}, {
|
|
195
|
+
plugins: [svgLoader()]
|
|
196
|
+
});
|
|
158
197
|
}
|
|
159
|
-
function
|
|
198
|
+
function configureNuxtOptions(nuxt, options) {
|
|
199
|
+
configureNotivue(nuxt);
|
|
200
|
+
configureRuntimeConfig(nuxt, options);
|
|
201
|
+
configurePlausible(nuxt, options);
|
|
202
|
+
if (hasSentryBuildConfig(options)) {
|
|
203
|
+
configureSentry(nuxt, options);
|
|
204
|
+
}
|
|
205
|
+
configureFontAwesome(nuxt);
|
|
206
|
+
configureVite(nuxt);
|
|
207
|
+
}
|
|
208
|
+
function registerRuntimeFeatures(options, resolver) {
|
|
160
209
|
addPlugin({ src: resolver.resolve("./runtime/plugins/api.global") });
|
|
161
210
|
addPlugin({ src: resolver.resolve("./runtime/plugins/auth0.client") });
|
|
162
211
|
addPlugin({ src: resolver.resolve("./runtime/plugins/sentry.global") });
|
|
@@ -191,36 +240,33 @@ async function loadBootstrapConfig(nuxt) {
|
|
|
191
240
|
const imported = await jiti.import(bootstrapConfigPath).catch(() => ({}));
|
|
192
241
|
return imported.default || {};
|
|
193
242
|
}
|
|
194
|
-
|
|
243
|
+
async function configureExternalIntegrations(nuxt, logger) {
|
|
244
|
+
const bootstrapComponentsConfig = await loadBootstrapConfig(nuxt);
|
|
245
|
+
if (Object.keys(bootstrapComponentsConfig).length > 0) {
|
|
246
|
+
logger.success("Loading bootstrap.config.ts");
|
|
247
|
+
}
|
|
248
|
+
configureBootstrapVueNext(nuxt, bootstrapComponentsConfig);
|
|
249
|
+
}
|
|
250
|
+
const module$1 = defineNuxtModule({
|
|
195
251
|
defaults: defaultOptions,
|
|
196
252
|
meta: {
|
|
197
|
-
name:
|
|
253
|
+
name: MODULE_NAME,
|
|
198
254
|
configKey: "merkaly",
|
|
199
|
-
compatibility: {
|
|
255
|
+
compatibility: {
|
|
256
|
+
nuxt: ">=3.14.0"
|
|
257
|
+
}
|
|
200
258
|
},
|
|
201
259
|
moduleDependencies(nuxt) {
|
|
202
|
-
const options =
|
|
203
|
-
nuxt.options.merkaly || {},
|
|
204
|
-
defaultOptions
|
|
205
|
-
);
|
|
260
|
+
const options = resolveModuleOptions(nuxt);
|
|
206
261
|
return buildModuleDependencies(nuxt, options);
|
|
207
262
|
},
|
|
208
263
|
async setup(options, nuxt) {
|
|
209
|
-
const logger = useLogger(
|
|
264
|
+
const logger = useLogger(MODULE_NAME);
|
|
210
265
|
const resolver = createResolver(import.meta.url);
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
configureSentry(nuxt, options);
|
|
215
|
-
const bootstrapComponentsConfig = await loadBootstrapConfig(nuxt);
|
|
216
|
-
if (Object.keys(bootstrapComponentsConfig).length > 0) {
|
|
217
|
-
logger.success("Loading bootstrap.config.ts");
|
|
218
|
-
}
|
|
219
|
-
configureBootstrapVueNext(nuxt, bootstrapComponentsConfig);
|
|
220
|
-
configureAppHead(nuxt);
|
|
221
|
-
registerRuntimeFeatures(nuxt, options, resolver);
|
|
222
|
-
configureVite(nuxt);
|
|
266
|
+
configureNuxtOptions(nuxt, options);
|
|
267
|
+
await configureExternalIntegrations(nuxt, logger);
|
|
268
|
+
registerRuntimeFeatures(options, resolver);
|
|
223
269
|
}
|
|
224
270
|
});
|
|
225
271
|
|
|
226
|
-
export { module as default };
|
|
272
|
+
export { module$1 as default };
|
|
@@ -5,5 +5,5 @@ interface AuthSessionData {
|
|
|
5
5
|
role: string;
|
|
6
6
|
userId: string;
|
|
7
7
|
}
|
|
8
|
-
export declare const createAuthSession: (args?: ((args: object) => import("
|
|
8
|
+
export declare const createAuthSession: (args?: ((args: object) => import("../utils/withAdapter.js").AdapterArgs<AuthSessionData, Record<string, unknown>, object>) | undefined) => import("../composables/useApi.js").UseApiReturn<AuthSessionData, Record<string, unknown>, object>;
|
|
9
9
|
export {};
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import { useAuth } from "#imports";
|
|
2
1
|
import { withAdapter } from "../utils/withAdapter.js";
|
|
3
|
-
export const createAuthSession = withAdapter(() => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
authorization: token.value ? `Bearer ${token.value}` : ""
|
|
10
|
-
},
|
|
11
|
-
method: "POST",
|
|
12
|
-
uri: "/session"
|
|
13
|
-
};
|
|
14
|
-
});
|
|
2
|
+
export const createAuthSession = withAdapter(() => ({
|
|
3
|
+
default: () => ({}),
|
|
4
|
+
global: true,
|
|
5
|
+
method: "POST",
|
|
6
|
+
uri: "/session"
|
|
7
|
+
}));
|
|
@@ -2,7 +2,6 @@ import type { User } from '@auth0/auth0-spa-js';
|
|
|
2
2
|
export declare const useAuth: () => {
|
|
3
3
|
isAuthenticated: import("vue").ComputedRef<boolean>;
|
|
4
4
|
isLoading: import("vue").Ref<boolean, boolean>;
|
|
5
|
-
tenant: import("vue").ComputedRef<any>;
|
|
6
5
|
token: import("vue").Ref<string | null, string | null>;
|
|
7
|
-
user: import("vue").Ref<User |
|
|
6
|
+
user: import("vue").Ref<User | undefined, User | undefined>;
|
|
8
7
|
};
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { computed } from "vue";
|
|
2
2
|
import { useState } from "#imports";
|
|
3
3
|
export const useAuth = () => {
|
|
4
|
-
const user = useState("auth:user", () =>
|
|
4
|
+
const user = useState("auth:user", () => void 0);
|
|
5
5
|
const token = useState("auth:token", () => null);
|
|
6
6
|
const isLoading = useState("auth:loading", () => true);
|
|
7
|
-
const tenant = computed(() => user.value?.org_id);
|
|
8
7
|
const isAuthenticated = computed(() => Boolean(user.value?.sub));
|
|
9
8
|
return {
|
|
10
9
|
isAuthenticated,
|
|
11
10
|
isLoading,
|
|
12
|
-
tenant,
|
|
13
11
|
token,
|
|
14
12
|
user
|
|
15
13
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import { useState } from "#imports";
|
|
3
|
+
export const useTenant = () => {
|
|
4
|
+
const tenant = useState("tenant:id", () => "");
|
|
5
|
+
const isReady = computed(() => Boolean(tenant.value));
|
|
6
|
+
const setTenant = (value) => tenant.value = value;
|
|
7
|
+
return {
|
|
8
|
+
isReady,
|
|
9
|
+
setTenant,
|
|
10
|
+
tenant
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("
|
|
1
|
+
declare const _default: import("nuxt/app").RouteMiddleware;
|
|
2
2
|
export default _default;
|
|
@@ -46,5 +46,5 @@ export interface ParamsOptions {
|
|
|
46
46
|
export type ApiOptions<TData = unknown, TMeta = Record<string, unknown>, TParams = object> = ParamsOptions & HooksOptions<TData, TMeta, TParams> & RefOptions & {
|
|
47
47
|
params?: TParams;
|
|
48
48
|
};
|
|
49
|
-
declare const _default: import("
|
|
49
|
+
declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
|
|
50
50
|
export default _default;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { defineNuxtPlugin } from "#app";
|
|
2
|
-
import { useAuth } from "#imports";
|
|
2
|
+
import { useAuth, useTenant } from "#imports";
|
|
3
3
|
const GLOBAL_API_HEADER = "x-merkaly-global";
|
|
4
4
|
export default defineNuxtPlugin(({ provide }) => provide("api", async (url, options = {}) => {
|
|
5
|
-
const {
|
|
5
|
+
const { token } = useAuth();
|
|
6
|
+
const { tenant } = useTenant();
|
|
7
|
+
if (!tenant.value && !options.global) {
|
|
8
|
+
throw new Error(`Missing tenant context for: ${url}`);
|
|
9
|
+
}
|
|
6
10
|
await $fetch(url, {
|
|
7
11
|
baseURL: "/api",
|
|
8
12
|
body: options?.body,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare const _default: import("
|
|
1
|
+
declare const _default: import("nuxt/app").Plugin<{
|
|
2
2
|
auth0: import("@auth0/auth0-spa-js").Auth0Client;
|
|
3
|
-
}> & import("
|
|
3
|
+
}> & import("nuxt/app").ObjectPlugin<{
|
|
4
4
|
auth0: import("@auth0/auth0-spa-js").Auth0Client;
|
|
5
5
|
}>;
|
|
6
6
|
export default _default;
|
|
@@ -54,7 +54,10 @@ export default defineNuxtPlugin(async ({ callHook, hook }) => {
|
|
|
54
54
|
};
|
|
55
55
|
const isAuthCallback = window.location.pathname === callbackPath;
|
|
56
56
|
if (!isAuthCallback) {
|
|
57
|
-
await Promise.allSettled([auth0.getUser(), auth0.getTokenSilently()]).then(() => hook("app:created",
|
|
57
|
+
await Promise.allSettled([auth0.getUser(), auth0.getTokenSilently()]).then(() => hook("app:created", async () => {
|
|
58
|
+
await callHook("merkaly:tenant", user.value);
|
|
59
|
+
await callHook("merkaly:auth", user.value);
|
|
60
|
+
})).catch(() => void 0);
|
|
58
61
|
}
|
|
59
62
|
isLoading.value = false;
|
|
60
63
|
return { provide: { auth0 } };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("
|
|
1
|
+
declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
|
|
2
2
|
export default _default;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { defineNuxtPlugin } from "#app";
|
|
2
2
|
import { setUser } from "@sentry/nuxt";
|
|
3
3
|
export default defineNuxtPlugin(async ({ hook }) => {
|
|
4
|
-
hook("merkaly:auth", (user) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} : null);
|
|
10
|
-
});
|
|
4
|
+
hook("merkaly:auth", (user) => setUser(user ? {
|
|
5
|
+
id: user.sub,
|
|
6
|
+
email: user.email,
|
|
7
|
+
username: user.name
|
|
8
|
+
} : null));
|
|
11
9
|
});
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
+
import type { HookResult } from '@nuxt/schema';
|
|
1
2
|
import type { Auth0Client, User } from '@auth0/auth0-spa-js';
|
|
2
3
|
import type { ApiOptions } from '../plugins/api.global';
|
|
3
4
|
|
|
4
5
|
declare module '#app' {
|
|
5
6
|
interface NuxtApp {
|
|
6
7
|
$auth0: Auth0Client;
|
|
7
|
-
$api: (url: string, options?: ApiOptions) => Promise<
|
|
8
|
+
$api: <T = unknown>(url: string, options?: ApiOptions) => Promise<T>;
|
|
8
9
|
$gmap: never;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
interface RuntimeNuxtHooks {
|
|
12
|
-
'merkaly:auth': (user
|
|
13
|
+
'merkaly:auth': (user?: User) => HookResult;
|
|
14
|
+
'merkaly:tenant': (user?: User) => HookResult;
|
|
13
15
|
}
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
declare module 'vue' {
|
|
17
19
|
interface ComponentCustomProperties {
|
|
18
20
|
$auth0: Auth0Client;
|
|
19
|
-
$api: (url: string, options?: ApiOptions) => Promise<
|
|
21
|
+
$api: <T = unknown>(url: string, options?: ApiOptions) => Promise<T>;
|
|
22
|
+
$gmap: never;
|
|
20
23
|
}
|
|
21
24
|
}
|
|
25
|
+
|
|
26
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@merkaly/nuxt",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.7",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/merkaly-io/nuxt.git"
|
|
@@ -27,28 +27,18 @@
|
|
|
27
27
|
"files": [
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
|
-
"scripts": {
|
|
31
|
-
"build": "nuxt-module-build build",
|
|
32
|
-
"build:stub": "nuxt-module-build build --stub",
|
|
33
|
-
"lint": "eslint .",
|
|
34
|
-
"prepack": "pnpm build",
|
|
35
|
-
"prepare": "nuxt-module-build prepare",
|
|
36
|
-
"test": "vitest run",
|
|
37
|
-
"test:types": "vue-tsc --noEmit",
|
|
38
|
-
"test:watch": "vitest watch"
|
|
39
|
-
},
|
|
40
30
|
"dependencies": {
|
|
41
|
-
"@auth0/auth0-spa-js": "^2.
|
|
42
|
-
"@bootstrap-vue-next/nuxt": "^0.45.
|
|
43
|
-
"@nuxt/devtools": "^3.2.
|
|
31
|
+
"@auth0/auth0-spa-js": "^2.21.1",
|
|
32
|
+
"@bootstrap-vue-next/nuxt": "^0.45.5",
|
|
33
|
+
"@nuxt/devtools": "^3.2.4",
|
|
44
34
|
"@nuxt/eslint": "1.15.1",
|
|
45
|
-
"@nuxt/eslint-config": "^1.15.
|
|
35
|
+
"@nuxt/eslint-config": "^1.15.2",
|
|
46
36
|
"@nuxt/fonts": "0.14.0",
|
|
47
37
|
"@nuxt/image": "^2.0.0",
|
|
48
|
-
"@nuxt/kit": "^4.4.
|
|
38
|
+
"@nuxt/kit": "^4.4.8",
|
|
49
39
|
"@nuxtjs/i18n": "^10.4.0",
|
|
50
|
-
"@nuxtjs/plausible": "^3.0.
|
|
51
|
-
"@sentry/nuxt": "^10.
|
|
40
|
+
"@nuxtjs/plausible": "^3.0.2",
|
|
41
|
+
"@sentry/nuxt": "^10.57.0",
|
|
52
42
|
"@types/node": "latest",
|
|
53
43
|
"@types/vue-select": "^3.16.8",
|
|
54
44
|
"@vueuse/components": "^14.3.0",
|
|
@@ -56,38 +46,45 @@
|
|
|
56
46
|
"@vueuse/integrations": "^14.3.0",
|
|
57
47
|
"@vueuse/nuxt": "^14.3.0",
|
|
58
48
|
"bootstrap": "^5.3.8",
|
|
59
|
-
"bootstrap-vue-next": "^0.45.
|
|
60
|
-
"change-case": "^5",
|
|
49
|
+
"bootstrap-vue-next": "^0.45.5",
|
|
50
|
+
"change-case": "^5.4.4",
|
|
61
51
|
"class-transformer": "^0.5.1",
|
|
62
52
|
"class-validator": "^0.15.1",
|
|
63
|
-
"eslint": "^9.39.
|
|
64
|
-
"filesize": "^11.0.
|
|
53
|
+
"eslint": "^9.39.4",
|
|
54
|
+
"filesize": "^11.0.17",
|
|
65
55
|
"gsap": "^3.15.0",
|
|
66
56
|
"notivue": "^2.4.5",
|
|
67
|
-
"nuxt": "^4.4.
|
|
57
|
+
"nuxt": "^4.4.8",
|
|
68
58
|
"reflect-metadata": "^0.2.2",
|
|
69
59
|
"sass": "^1.100.0",
|
|
70
60
|
"typescript": "~5.9.3",
|
|
71
|
-
"v-money3": "^3.26.
|
|
72
|
-
"vite-svg-loader": "^5.1.
|
|
73
|
-
"vue": "^3.5.
|
|
74
|
-
"vue-router": "^5.
|
|
61
|
+
"v-money3": "^3.26.1",
|
|
62
|
+
"vite-svg-loader": "^5.1.1",
|
|
63
|
+
"vue": "^3.5.35",
|
|
64
|
+
"vue-router": "^5.1.0",
|
|
75
65
|
"vue-select": "4.0.0-beta.6"
|
|
76
66
|
},
|
|
77
67
|
"devDependencies": {
|
|
78
68
|
"@nuxt/module-builder": "^1.0.2",
|
|
79
|
-
"@nuxt/schema": "^4.4.
|
|
80
|
-
"@nuxt/test-utils": "^4.0.
|
|
69
|
+
"@nuxt/schema": "^4.4.8",
|
|
70
|
+
"@nuxt/test-utils": "^4.0.3",
|
|
81
71
|
"changelogen": "^0.6.2",
|
|
82
|
-
"eslint-plugin-storybook": "^10.
|
|
83
|
-
"vitest": "^4.1.
|
|
84
|
-
"vue-tsc": "^3.3.
|
|
72
|
+
"eslint-plugin-storybook": "^10.4.3",
|
|
73
|
+
"vitest": "^4.1.8",
|
|
74
|
+
"vue-tsc": "^3.3.4"
|
|
85
75
|
},
|
|
86
76
|
"optionalDependencies": {
|
|
87
|
-
"defu": "^6.1.
|
|
77
|
+
"defu": "^6.1.7"
|
|
88
78
|
},
|
|
89
|
-
"packageManager": "pnpm@10.28.2",
|
|
90
79
|
"engines": {
|
|
91
80
|
"node": ">=24"
|
|
81
|
+
},
|
|
82
|
+
"scripts": {
|
|
83
|
+
"build": "nuxt-module-build build",
|
|
84
|
+
"build:stub": "nuxt-module-build build --stub",
|
|
85
|
+
"lint": "eslint .",
|
|
86
|
+
"test": "vitest run",
|
|
87
|
+
"test:types": "vue-tsc --noEmit",
|
|
88
|
+
"test:watch": "vitest watch"
|
|
92
89
|
}
|
|
93
|
-
}
|
|
90
|
+
}
|