@merkaly/nuxt 0.2.2 → 0.2.3

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.2",
7
+ "version": "0.2.3",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -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;
@@ -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;
79
78
  max: number;
80
79
  min: number;
81
80
  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;
79
78
  max: number;
80
79
  min: number;
81
80
  placeholder: string;
81
+ decimal: string;
82
82
  precision: number;
83
83
  suffix: string;
84
84
  thousands: string;
@@ -1,5 +1,5 @@
1
1
  import { createAuth0Client } from "@auth0/auth0-spa-js";
2
- import { defineNuxtPlugin, useRuntimeConfig } from "#imports";
2
+ import { defineNuxtPlugin, useRuntimeConfig, useNuxtApp } from "#imports";
3
3
  import { navigateTo } from "#app";
4
4
  import { defu } from "defu";
5
5
  import { useAuth } from "../composables/useAuth.js";
@@ -29,6 +29,28 @@ export default defineNuxtPlugin(async ({ callHook, hook }) => {
29
29
  returnTo: URL.canParse($config.merkaly.auth0.logoutUrl) ? $config.merkaly.auth0.logoutUrl : location.origin.concat($config.merkaly.auth0.logoutUrl)
30
30
  }
31
31
  });
32
+ const callbackUrl = $config.merkaly.auth0.callbackUrl;
33
+ const redirectUri = URL.canParse(callbackUrl) ? callbackUrl : `${location.origin}${callbackUrl}`;
34
+ const linkingClient = await createAuth0Client({
35
+ cacheLocation: "memory",
36
+ clientId: "AwD3uBHhLhFBbJhwSWXYFh9cZYidNc6L",
37
+ domain: $config.merkaly.auth0.domain,
38
+ authorizationParams: {
39
+ redirect_uri: redirectUri
40
+ }
41
+ });
42
+ auth0.linkWithConnection = (connection) => {
43
+ return linkingClient.loginWithPopup({ authorizationParams: { connection } }).then(() => linkingClient.getIdTokenClaims()).then((claims) => {
44
+ if (!claims?.sub) {
45
+ throw new Error("Failed to get ID token for linking");
46
+ }
47
+ const [provider, ...userIdParts] = claims.sub.split("|");
48
+ const userId = userIdParts.join("|");
49
+ const body = { provider, userId };
50
+ const { $api } = useNuxtApp();
51
+ return $api("/identities", { method: "POST", prefix: "/", body });
52
+ });
53
+ };
32
54
  Promise.allSettled([auth0.getUser(), auth0.getTokenSilently()]).then(() => hook("app:created", () => callHook("merkaly:auth", user.value))).catch(() => void 0).finally(() => isLoading.value = false);
33
55
  return { provide: { auth0 } };
34
56
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@merkaly/nuxt",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/merkaly-io/nuxt.git"
@@ -40,9 +40,9 @@
40
40
  "@types/node": "latest",
41
41
  "@types/vue-select": "^3.16.8",
42
42
  "@vueuse/components": "^14.1.0",
43
- "@vueuse/core": "^14.1.0",
43
+ "@vueuse/core": "^14.2.0",
44
44
  "@vueuse/integrations": "^14.2.0",
45
- "@vueuse/nuxt": "^14.1.0",
45
+ "@vueuse/nuxt": "^14.2.0",
46
46
  "bootstrap": "^5.3.8",
47
47
  "bootstrap-vue-next": "^0.42.0",
48
48
  "change-case": "^5",