@merkaly/nuxt 0.2.2 → 0.2.4

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.4",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -155,11 +155,13 @@ function toggleDetails(item) {
155
155
 
156
156
  <template v-for="(column, key) in $datagrid.columns" :key="key">
157
157
  <BTh :class="[column.class, column.thClass]">
158
- <span v-text="column.title ?? sentenceCase(key)" />
158
+ <slot :name="`head[${key}]`" v-bind="{ column, key }">
159
+ <span v-text="column.title ?? sentenceCase(key)" />
160
+ </slot>
159
161
  </BTh>
160
162
  </template>
161
163
 
162
- <BTh class="text-end px-3" />
164
+ <BTh v-if="hasActions" class="text-end px-3" />
163
165
  </BTr>
164
166
  </BThead>
165
167
 
@@ -206,9 +208,9 @@ function toggleDetails(item) {
206
208
  </BTd>
207
209
  </template>
208
210
 
209
- <BTd class="text-end px-3">
211
+ <BTd v-if="hasActions" class="text-end px-3">
210
212
  <DropdownIcon toggle-class="border border-secondary-subtle border-dashed text-body">
211
- <slot v-if="hasActions" :index="idx" :item="item" name="actions" />
213
+ <slot :index="idx" :item="item" name="actions" />
212
214
  </DropdownIcon>
213
215
  </BTd>
214
216
  </BTr>
@@ -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.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/merkaly-io/nuxt.git"
@@ -28,7 +28,7 @@
28
28
  "dist"
29
29
  ],
30
30
  "dependencies": {
31
- "@auth0/auth0-spa-js": "^2.12.0",
31
+ "@auth0/auth0-spa-js": "^2.14.0",
32
32
  "@bootstrap-vue-next/nuxt": "^0.42.0",
33
33
  "@nuxt/devtools": "^3.1.0",
34
34
  "@nuxt/eslint": "1.13.0",
@@ -39,10 +39,10 @@
39
39
  "@nuxtjs/plausible": "^2.0.1",
40
40
  "@types/node": "latest",
41
41
  "@types/vue-select": "^3.16.8",
42
- "@vueuse/components": "^14.1.0",
43
- "@vueuse/core": "^14.1.0",
42
+ "@vueuse/components": "^14.2.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",