@frigear-nu/account 0.6.3 → 0.7.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.
Files changed (42) hide show
  1. package/README.md +1 -1
  2. package/dist/module.d.mts +0 -20
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +17 -25
  5. package/dist/runtime/app/components/Account/AccountAvatarField.vue +112 -0
  6. package/dist/runtime/app/components/Account/AccountMenu.d.vue.ts +1 -1
  7. package/dist/runtime/app/components/Account/AccountMenu.vue +8 -10
  8. package/dist/runtime/app/components/Account/AccountMenu.vue.d.ts +1 -1
  9. package/dist/runtime/app/components/Account/AccountSignedInApps.vue +3 -1
  10. package/dist/runtime/app/composables/index.d.ts +2 -0
  11. package/dist/runtime/app/composables/index.js +1 -0
  12. package/dist/runtime/app/composables/useAccount.d.ts +2 -0
  13. package/dist/runtime/app/composables/useAccount.js +15 -1
  14. package/dist/runtime/app/composables/useAccountAreas.d.ts +21 -0
  15. package/dist/runtime/app/composables/useAccountAreas.js +12 -0
  16. package/dist/runtime/app/composables/useAccountNav.js +1 -2
  17. package/dist/runtime/app/middleware/preload.js +6 -0
  18. package/dist/runtime/app/pages/api-tokens.vue +31 -28
  19. package/dist/runtime/app/pages/profile.vue +38 -15
  20. package/dist/runtime/app/pages/security.vue +4 -2
  21. package/dist/runtime/app/plugins/preload.client.js +5 -0
  22. package/dist/runtime/app/utils/avatar-image.d.ts +34 -0
  23. package/dist/runtime/app/utils/avatar-image.js +61 -0
  24. package/dist/runtime/app/utils/mcp-connect.d.ts +27 -0
  25. package/dist/runtime/app/utils/mcp-connect.js +70 -0
  26. package/dist/runtime/app/utils/profile.d.ts +5 -4
  27. package/dist/runtime/app/utils/profile.js +1 -1
  28. package/dist/runtime/i18n/lang/da.json +48 -20
  29. package/dist/runtime/i18n/lang/en.json +47 -19
  30. package/dist/runtime/menus.js +1 -14
  31. package/dist/runtime/utils/areas.d.ts +7 -0
  32. package/dist/runtime/utils/areas.js +4 -0
  33. package/package.json +15 -11
  34. package/dist/runtime/app/middleware/bootstrap.js +0 -6
  35. package/dist/runtime/app/pages/documents.vue +0 -54
  36. package/dist/runtime/app/plugins/bootstrap.client.js +0 -5
  37. package/dist/runtime/app/utils/documents.d.ts +0 -8
  38. package/dist/runtime/app/utils/documents.js +0 -7
  39. /package/dist/runtime/app/{pages/documents.d.vue.ts → components/Account/AccountAvatarField.d.vue.ts} +0 -0
  40. /package/dist/runtime/app/{pages/documents.vue.d.ts → components/Account/AccountAvatarField.vue.d.ts} +0 -0
  41. /package/dist/runtime/app/middleware/{bootstrap.d.ts → preload.d.ts} +0 -0
  42. /package/dist/runtime/app/plugins/{bootstrap.client.d.ts → preload.client.d.ts} +0 -0
@@ -9,7 +9,7 @@ export default defineMenuSource(() => {
9
9
  labelKey: "account.menu.account.label",
10
10
  description: "Your account.",
11
11
  descriptionKey: "account.menu.account.description",
12
- icon: "i-lucide-layout-dashboard",
12
+ icon: "i-lucide-user-round-cog",
13
13
  to: config.pages.index,
14
14
  order: -99
15
15
  });
@@ -36,7 +36,6 @@ export default defineMenuSource(() => {
36
36
  order: 10
37
37
  });
38
38
  extendMenuItem("account", profileItem);
39
- extendMenuItem("account.dropdown", profileItem);
40
39
  }
41
40
  if (config?.pages?.security) {
42
41
  extendMenuItem("account", {
@@ -62,16 +61,4 @@ export default defineMenuSource(() => {
62
61
  order: 25
63
62
  });
64
63
  }
65
- if (config?.pages?.documents) {
66
- extendMenuItem("account", {
67
- id: "documents",
68
- label: "Documents",
69
- labelKey: "account.menu.documents.label",
70
- description: "Handbooks and other files for you.",
71
- descriptionKey: "account.menu.documents.description",
72
- icon: "i-lucide-files",
73
- to: config.pages.documents,
74
- order: 30
75
- });
76
- }
77
64
  });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The area a path belongs to: the area whose path is the path itself or a parent of it, the longest one when several
3
+ * match (`/account/profile` belongs to `/account`, not to `/`). Both sides are expected without a locale prefix.
4
+ */
5
+ export declare function matchArea<T extends {
6
+ to: string;
7
+ }>(areas: T[], path: string): T | undefined;
@@ -0,0 +1,4 @@
1
+ export function matchArea(areas, path) {
2
+ const contains = (to) => path === to || to !== "/" && path.startsWith(`${to.replace(/\/$/, "")}/`);
3
+ return areas.filter((area) => contains(area.to)).sort((a, b) => b.to.length - a.to.length)[0];
4
+ }
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@frigear-nu/account",
3
- "version": "0.6.3",
3
+ "version": "0.7.0",
4
4
  "description": "A module for managing the account area (profile, email, password, security) in the main frigear app.",
5
+ "keywords": [
6
+ "frigear-module",
7
+ "nuxt-module"
8
+ ],
5
9
  "homepage": "https://docs.frigear.dev/modules/identity/account",
6
10
  "repository": {
7
11
  "type": "git",
@@ -24,10 +28,10 @@
24
28
  "playground"
25
29
  ],
26
30
  "dependencies": {
27
- "@frigear-nu/auth": "^0.6.8",
28
- "@frigear-nu/module-kit": "^1.3.12",
29
- "@frigear-nu/ui": "^0.2.11",
30
- "@frigear-nu/users": "^3.1.5",
31
+ "@frigear-nu/auth": "^0.7.0",
32
+ "@frigear-nu/module-kit": "^1.3.13",
33
+ "@frigear-nu/ui": "^0.3.0",
34
+ "@frigear-nu/users": "^3.2.0",
31
35
  "@libsql/client": "^0.18.0",
32
36
  "@nuxt/kit": "^4.6.4",
33
37
  "@vueuse/core": "^15.0.0",
@@ -36,9 +40,9 @@
36
40
  "zod": "^4.6.7"
37
41
  },
38
42
  "peerDependencies": {
39
- "@frigear-nu/authorization": "^0.6.6",
40
- "@frigear-nu/menu": "^0.4.1",
41
- "@frigear-nu/widget": "^0.4.3",
43
+ "@frigear-nu/authorization": "^0.6.8",
44
+ "@frigear-nu/menu": "^0.4.2",
45
+ "@frigear-nu/widget": "^0.4.4",
42
46
  "@nuxt/ui": "^4.12.0",
43
47
  "@nuxthub/core": "^0.10.12"
44
48
  },
@@ -57,9 +61,9 @@
57
61
  }
58
62
  },
59
63
  "devDependencies": {
60
- "@frigear-nu/authorization": "^0.6.6",
61
- "@frigear-nu/menu": "^0.4.1",
62
- "@frigear-nu/widget": "^0.4.3",
64
+ "@frigear-nu/authorization": "^0.6.8",
65
+ "@frigear-nu/menu": "^0.4.2",
66
+ "@frigear-nu/widget": "^0.4.4",
63
67
  "@nuxt/devtools": "^4.2.0",
64
68
  "@nuxt/eslint-config": "^1.17.0",
65
69
  "@nuxt/module-builder": "^1.0.4",
@@ -1,6 +0,0 @@
1
- import { keys } from "#account/bootstrap";
2
- import { defineNuxtRouteMiddleware, loadBootstrap, useUserSession } from "#imports";
3
- export default defineNuxtRouteMiddleware(async () => {
4
- if (!keys.length || !useUserSession().loggedIn.value) return;
5
- await loadBootstrap("account");
6
- });
@@ -1,54 +0,0 @@
1
- <script setup>
2
- import { documentLabel, visibleDocuments } from "../utils/documents";
3
- import { computed, useModuleT, useNuxtApp, useRuntimeConfig } from "#imports";
4
- import { useAuthorization } from "#account/optional";
5
- defineOptions({ name: "AccountDocumentsPage" });
6
- const t = useModuleT("account.documents");
7
- const authorization = typeof useAuthorization === "function" ? useAuthorization() : void 0;
8
- const nuxtApp = useNuxtApp();
9
- const locale = computed(() => nuxtApp.$i18n?.locale?.value ?? "en");
10
- const documents = computed(() => visibleDocuments(useRuntimeConfig().public.account?.documents ?? [], authorization ? (permission) => authorization.can(permission) : void 0));
11
- </script>
12
-
13
- <template>
14
- <div class="flex flex-col gap-4">
15
- <AccountHeader />
16
-
17
- <SectionCard flush>
18
- <ul
19
- v-if="documents.length"
20
- class="divide-y divide-default"
21
- >
22
- <li
23
- v-for="document in documents"
24
- :key="document.id"
25
- class="flex items-center gap-3 px-4 py-3"
26
- >
27
- <UIcon
28
- :name="document.icon ?? 'i-lucide-file'"
29
- class="size-5 shrink-0 text-muted"
30
- />
31
- <p class="min-w-0 flex-1 truncate text-sm font-medium text-highlighted">
32
- {{ documentLabel(document, locale) }}
33
- </p>
34
- <UButton
35
- download
36
- external
37
- :to="document.path"
38
- color="neutral"
39
- variant="outline"
40
- icon="i-lucide-download"
41
- :label="t('download', 'Download')"
42
- :aria-label="t('downloadNamed', 'Download {name}', { name: documentLabel(document, locale) })"
43
- />
44
- </li>
45
- </ul>
46
- <UEmpty
47
- v-else
48
- variant="naked"
49
- icon="i-lucide-files"
50
- :title="t('empty', 'No documents for you yet.')"
51
- />
52
- </SectionCard>
53
- </div>
54
- </template>
@@ -1,5 +0,0 @@
1
- import { defineNuxtPlugin, resetBootstrap, useUserSession, watch } from "#imports";
2
- export default defineNuxtPlugin(() => {
3
- const { user } = useUserSession();
4
- watch(() => user.value?.id ?? null, () => resetBootstrap("account"));
5
- });
@@ -1,8 +0,0 @@
1
- import type { AccountDocument } from '../../../types.js';
2
- /** Label in `locale`, falling back to `en`, then the first available value. */
3
- export declare function documentLabel(document: AccountDocument, locale: string): string;
4
- /**
5
- * The documents the viewer may see: everything without a `permission`, otherwise only those `can` allows. Without a `can`
6
- * (no access layer installed) a document with a permission is hidden.
7
- */
8
- export declare function visibleDocuments(documents: AccountDocument[], can?: (permission: string) => boolean): AccountDocument[];
@@ -1,7 +0,0 @@
1
- export function documentLabel(document, locale) {
2
- if (typeof document.label === "string") return document.label;
3
- return document.label[locale] ?? document.label.en ?? Object.values(document.label)[0] ?? document.id;
4
- }
5
- export function visibleDocuments(documents, can) {
6
- return documents.filter((document) => !document.permission || !!can?.(document.permission));
7
- }