@merkaly/nuxt 0.2.4 → 0.3.0

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
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.0.0"
6
6
  },
7
- "version": "0.2.4",
7
+ "version": "0.3.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -8,6 +8,7 @@ const code = params.get("code");
8
8
  const error = params.get("error");
9
9
  const invitation = params.get("invitation");
10
10
  const organization = params.get("organization");
11
+ const redirect = params.get("redirect");
11
12
  function handleInvite() {
12
13
  return $auth0.loginWithRedirect({ authorizationParams: { organization, invitation } });
13
14
  }
@@ -32,7 +33,9 @@ callOnce(async () => {
32
33
  if (code) {
33
34
  return handleCode();
34
35
  }
35
- return $auth0.loginWithRedirect();
36
+ return $auth0.loginWithRedirect({
37
+ appState: { target: redirect || "/" }
38
+ });
36
39
  });
37
40
  </script>
38
41
 
@@ -60,10 +60,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
60
60
  code: string;
61
61
  city: string;
62
62
  country: string;
63
- line1: string;
64
- line2: string;
65
63
  locality: string;
66
64
  state: string;
65
+ line1: string;
66
+ line2: string;
67
67
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
68
68
  declare const _default: typeof __VLS_export;
69
69
  export default _default;
@@ -60,10 +60,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
60
60
  code: string;
61
61
  city: string;
62
62
  country: string;
63
- line1: string;
64
- line2: string;
65
63
  locality: string;
66
64
  state: string;
65
+ line1: string;
66
+ line2: string;
67
67
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
68
68
  declare const _default: typeof __VLS_export;
69
69
  export default _default;
@@ -61,10 +61,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
61
61
  mode: keyof Intl.NumberFormatOptionsStyleRegistry;
62
62
  base: number;
63
63
  tag: string;
64
+ value: number;
64
65
  currency: string;
65
66
  hideDecimal: boolean;
66
67
  locale: string;
67
- value: number;
68
68
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
69
69
  declare const _default: typeof __VLS_export;
70
70
  export default _default;
@@ -61,10 +61,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
61
61
  mode: keyof Intl.NumberFormatOptionsStyleRegistry;
62
62
  base: number;
63
63
  tag: string;
64
+ value: number;
64
65
  currency: string;
65
66
  hideDecimal: boolean;
66
67
  locale: string;
67
- value: number;
68
68
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
69
69
  declare const _default: typeof __VLS_export;
70
70
  export default _default;
@@ -81,8 +81,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
81
81
  }>, {
82
82
  mode: PlaceTypes;
83
83
  disabled: boolean;
84
- placeholder: string;
85
84
  countries: string[];
85
+ placeholder: string;
86
86
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
87
87
  declare const _default: typeof __VLS_export;
88
88
  export default _default;
@@ -81,8 +81,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
81
81
  }>, {
82
82
  mode: PlaceTypes;
83
83
  disabled: boolean;
84
- placeholder: string;
85
84
  countries: string[];
85
+ placeholder: string;
86
86
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
87
87
  declare const _default: typeof __VLS_export;
88
88
  export default _default;
@@ -75,10 +75,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
75
75
  "onUpdate:modelValue"?: ((value: Numberish) => any) | undefined;
76
76
  }>, {
77
77
  prefix: string;
78
- decimal: string;
78
+ placeholder: string;
79
79
  max: number;
80
80
  min: number;
81
- placeholder: string;
81
+ decimal: string;
82
82
  precision: number;
83
83
  suffix: string;
84
84
  thousands: string;
@@ -75,10 +75,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
75
75
  "onUpdate:modelValue"?: ((value: Numberish) => any) | undefined;
76
76
  }>, {
77
77
  prefix: string;
78
- decimal: string;
78
+ placeholder: string;
79
79
  max: number;
80
80
  min: number;
81
- placeholder: string;
81
+ decimal: string;
82
82
  precision: number;
83
83
  suffix: string;
84
84
  thousands: string;
@@ -0,0 +1,80 @@
1
+ import type { DataGrid } from '../../composables/useDatagrid.js';
2
+ declare const __VLS_export: <G>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<{
4
+ modelValue: DataGrid<G>;
5
+ } & import("vue").ExtractPublicPropTypes<{
6
+ emptyText: {
7
+ type: StringConstructor;
8
+ default: () => string;
9
+ };
10
+ hideFooter: {
11
+ type: BooleanConstructor;
12
+ default: boolean;
13
+ };
14
+ hidePagination: {
15
+ type: BooleanConstructor;
16
+ default: boolean;
17
+ };
18
+ hideSelect: {
19
+ type: BooleanConstructor;
20
+ default: boolean;
21
+ };
22
+ }> & {
23
+ "onUpdate:modelValue"?: ((value: DataGrid<G>) => any) | undefined;
24
+ onFetch?: ((reason: "sort" | "filter" | "search" | "paginate" | "refresh") => any) | undefined;
25
+ "onToggle:item"?: ((item: G, expanded: boolean) => any) | undefined;
26
+ }> & (typeof globalThis extends {
27
+ __VLS_PROPS_FALLBACK: infer P;
28
+ } ? P : {});
29
+ expose: (exposed: {}) => void;
30
+ attrs: any;
31
+ slots: {
32
+ [x: `head[${string}]`]: ((props: {
33
+ column: import("../../composables/useDatagrid.js").ColumnDefinition<G>;
34
+ key: string;
35
+ }) => any) | undefined;
36
+ } & {
37
+ [x: `row[${string}]`]: ((props: {
38
+ column: import("../../composables/useDatagrid.js").ColumnDefinition<G>;
39
+ idx: number;
40
+ item: G;
41
+ key: string;
42
+ }) => any) | undefined;
43
+ } & {
44
+ search?: (props: {}) => any;
45
+ } & {
46
+ toolbar?: (props: {}) => any;
47
+ } & {
48
+ filters?: (props: {}) => any;
49
+ } & {
50
+ empty?: (props: {}) => any;
51
+ } & {
52
+ actions?: (props: {
53
+ index: number;
54
+ item: G;
55
+ }) => any;
56
+ } & {
57
+ details?: (props: {
58
+ index: number;
59
+ item: G;
60
+ toggleDetails: () => void;
61
+ }) => any;
62
+ } & {
63
+ tfoot?: (props: {}) => any;
64
+ } & {
65
+ footer?: (props: {}) => any;
66
+ };
67
+ emit: {
68
+ (e: "fetch", reason: "sort" | "filter" | "search" | "paginate" | "refresh"): void;
69
+ (e: "toggle:item", item: G, expanded: boolean): void;
70
+ } & ((evt: "update:modelValue", value: DataGrid<G>) => void);
71
+ }>) => import("vue").VNode & {
72
+ __ctx?: Awaited<typeof __VLS_setup>;
73
+ };
74
+ declare const _default: typeof __VLS_export;
75
+ export default _default;
76
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
77
+ [K in keyof T]: T[K];
78
+ } : {
79
+ [K in keyof T as K]: T[K];
80
+ }) & {};
@@ -0,0 +1,80 @@
1
+ import type { DataGrid } from '../../composables/useDatagrid.js';
2
+ declare const __VLS_export: <G>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<{
4
+ modelValue: DataGrid<G>;
5
+ } & import("vue").ExtractPublicPropTypes<{
6
+ emptyText: {
7
+ type: StringConstructor;
8
+ default: () => string;
9
+ };
10
+ hideFooter: {
11
+ type: BooleanConstructor;
12
+ default: boolean;
13
+ };
14
+ hidePagination: {
15
+ type: BooleanConstructor;
16
+ default: boolean;
17
+ };
18
+ hideSelect: {
19
+ type: BooleanConstructor;
20
+ default: boolean;
21
+ };
22
+ }> & {
23
+ "onUpdate:modelValue"?: ((value: DataGrid<G>) => any) | undefined;
24
+ onFetch?: ((reason: "sort" | "filter" | "search" | "paginate" | "refresh") => any) | undefined;
25
+ "onToggle:item"?: ((item: G, expanded: boolean) => any) | undefined;
26
+ }> & (typeof globalThis extends {
27
+ __VLS_PROPS_FALLBACK: infer P;
28
+ } ? P : {});
29
+ expose: (exposed: {}) => void;
30
+ attrs: any;
31
+ slots: {
32
+ [x: `head[${string}]`]: ((props: {
33
+ column: import("../../composables/useDatagrid.js").ColumnDefinition<G>;
34
+ key: string;
35
+ }) => any) | undefined;
36
+ } & {
37
+ [x: `row[${string}]`]: ((props: {
38
+ column: import("../../composables/useDatagrid.js").ColumnDefinition<G>;
39
+ idx: number;
40
+ item: G;
41
+ key: string;
42
+ }) => any) | undefined;
43
+ } & {
44
+ search?: (props: {}) => any;
45
+ } & {
46
+ toolbar?: (props: {}) => any;
47
+ } & {
48
+ filters?: (props: {}) => any;
49
+ } & {
50
+ empty?: (props: {}) => any;
51
+ } & {
52
+ actions?: (props: {
53
+ index: number;
54
+ item: G;
55
+ }) => any;
56
+ } & {
57
+ details?: (props: {
58
+ index: number;
59
+ item: G;
60
+ toggleDetails: () => void;
61
+ }) => any;
62
+ } & {
63
+ tfoot?: (props: {}) => any;
64
+ } & {
65
+ footer?: (props: {}) => any;
66
+ };
67
+ emit: {
68
+ (e: "fetch", reason: "sort" | "filter" | "search" | "paginate" | "refresh"): void;
69
+ (e: "toggle:item", item: G, expanded: boolean): void;
70
+ } & ((evt: "update:modelValue", value: DataGrid<G>) => void);
71
+ }>) => import("vue").VNode & {
72
+ __ctx?: Awaited<typeof __VLS_setup>;
73
+ };
74
+ declare const _default: typeof __VLS_export;
75
+ export default _default;
76
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
77
+ [K in keyof T]: T[K];
78
+ } : {
79
+ [K in keyof T as K]: T[K];
80
+ }) & {};
@@ -1,4 +1,4 @@
1
- interface ColumnDefinition<C = unknown> {
1
+ export interface ColumnDefinition<C = unknown> {
2
2
  class?: string;
3
3
  getter?: (row: C) => any;
4
4
  tdClass?: string;
@@ -16,5 +16,7 @@ export default defineNuxtRouteMiddleware((to) => {
16
16
  if (isAuthenticated.value) {
17
17
  return;
18
18
  }
19
- return navigateTo(merkaly.auth0.callbackUrl);
19
+ const redirect = to.fullPath;
20
+ const callbackUrl = redirect === "/" ? merkaly.auth0.callbackUrl : `${merkaly.auth0.callbackUrl}?redirect=${encodeURIComponent(redirect)}`;
21
+ return navigateTo(callbackUrl);
20
22
  });
@@ -51,6 +51,10 @@ export default defineNuxtPlugin(async ({ callHook, hook }) => {
51
51
  return $api("/identities", { method: "POST", prefix: "/", body });
52
52
  });
53
53
  };
54
- Promise.allSettled([auth0.getUser(), auth0.getTokenSilently()]).then(() => hook("app:created", () => callHook("merkaly:auth", user.value))).catch(() => void 0).finally(() => isLoading.value = false);
54
+ const isAuthCallback = window.location.pathname === $config.merkaly.auth0.callbackUrl;
55
+ if (!isAuthCallback) {
56
+ await Promise.allSettled([auth0.getUser(), auth0.getTokenSilently()]).then(() => hook("app:created", () => callHook("merkaly:auth", user.value))).catch(() => void 0);
57
+ }
58
+ isLoading.value = false;
55
59
  return { provide: { auth0 } };
56
60
  });
@@ -4,8 +4,11 @@ export const withAdapter = (callback) => (args) => {
4
4
  return useApi((executionParams) => {
5
5
  const config = args?.(executionParams) || {};
6
6
  const { params: initialParams = {}, ...hooks } = config;
7
- const mergedParams = defu(executionParams, initialParams);
7
+ const mergedParams = defu(executionParams, { ...initialParams });
8
8
  const adapterResult = callback(mergedParams);
9
+ if (adapterResult.body && typeof adapterResult.body === "object" && !(adapterResult.body instanceof FormData)) {
10
+ adapterResult.body = { ...adapterResult.body };
11
+ }
9
12
  return defu(hooks, adapterResult);
10
13
  });
11
14
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@merkaly/nuxt",
3
- "version": "0.2.4",
3
+ "version": "0.3.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/merkaly-io/nuxt.git"
@@ -27,9 +27,23 @@
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
+ "dev": "pnpm dev:prepare && cd playground && pnpm storybook",
34
+ "dev:build": "nuxi build playground",
35
+ "dev:prepare": "pnpm build:stub && nuxi prepare playground",
36
+ "lint": "eslint .",
37
+ "prepack": "pnpm build",
38
+ "prepare": "nuxt-module-build prepare",
39
+ "release": "pnpm lint && pnpm test && pnpm build && changelogen --release && npm publish --access public && git push --follow-tags",
40
+ "test": "vitest run",
41
+ "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
42
+ "test:watch": "vitest watch"
43
+ },
30
44
  "dependencies": {
31
45
  "@auth0/auth0-spa-js": "^2.14.0",
32
- "@bootstrap-vue-next/nuxt": "^0.42.0",
46
+ "@bootstrap-vue-next/nuxt": "^0.43.0",
33
47
  "@nuxt/devtools": "^3.1.0",
34
48
  "@nuxt/eslint": "1.13.0",
35
49
  "@nuxt/eslint-config": "^1.13.0",
@@ -44,7 +58,7 @@
44
58
  "@vueuse/integrations": "^14.2.0",
45
59
  "@vueuse/nuxt": "^14.2.0",
46
60
  "bootstrap": "^5.3.8",
47
- "bootstrap-vue-next": "^0.42.0",
61
+ "bootstrap-vue-next": "^0.43.0",
48
62
  "change-case": "^5",
49
63
  "eslint": "^9.39.1",
50
64
  "filesize": "^11.0.2",
@@ -72,17 +86,5 @@
72
86
  },
73
87
  "engines": {
74
88
  "node": ">=20.0.0"
75
- },
76
- "scripts": {
77
- "build": "nuxt-module-build build",
78
- "build:stub": "nuxt-module-build build --stub",
79
- "dev": "pnpm dev:prepare && cd playground && pnpm storybook",
80
- "dev:build": "nuxi build playground",
81
- "dev:prepare": "pnpm build:stub && nuxi prepare playground",
82
- "lint": "eslint .",
83
- "release": "pnpm lint && pnpm test && pnpm build && changelogen --release && npm publish --access public && git push --follow-tags",
84
- "test": "vitest run",
85
- "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
86
- "test:watch": "vitest watch"
87
89
  }
88
- }
90
+ }