@frigear-nu/account 0.6.4 → 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.
- package/README.md +1 -1
- package/dist/module.d.mts +0 -20
- package/dist/module.json +1 -1
- package/dist/module.mjs +5 -15
- package/dist/runtime/app/composables/useAccountNav.js +1 -2
- package/dist/runtime/app/pages/profile.vue +2 -1
- package/dist/runtime/app/pages/security.vue +2 -1
- package/dist/runtime/i18n/lang/da.json +0 -11
- package/dist/runtime/i18n/lang/en.json +0 -11
- package/dist/runtime/menus.js +0 -12
- package/package.json +6 -6
- package/dist/runtime/app/pages/documents.d.vue.ts +0 -3
- package/dist/runtime/app/pages/documents.vue +0 -54
- package/dist/runtime/app/pages/documents.vue.d.ts +0 -3
- package/dist/runtime/app/utils/documents.d.ts +0 -8
- package/dist/runtime/app/utils/documents.js +0 -7
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @frigear-nu/account
|
|
2
2
|
|
|
3
|
-
A module for the account area (profile, security,
|
|
3
|
+
A module for the account area (profile, security, API tokens pages) in the main frigear app. Migrated from
|
|
4
4
|
[`nuxt-frigear-nu`](https://github.com/Frigear-nu/nuxt-frigear-nu)'s `app/pages/account/**`.
|
|
5
5
|
|
|
6
6
|
## Features
|
package/dist/module.d.mts
CHANGED
|
@@ -1,30 +1,12 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import { Permission } from '@frigear-nu/auth/access';
|
|
3
2
|
|
|
4
|
-
/** A downloadable file listed on the documents page. */
|
|
5
|
-
type AccountDocument = {
|
|
6
|
-
id: string;
|
|
7
|
-
/** A string, or a map of locale -> string (falls back to `en`, then the first value). */
|
|
8
|
-
label: string | Record<string, string>;
|
|
9
|
-
/** Where the file is served from, e.g. `/assets/files/handbook.pdf`. */
|
|
10
|
-
path: string;
|
|
11
|
-
icon?: string;
|
|
12
|
-
/**
|
|
13
|
-
* The permission (`resource:action`) a user must hold to see the document listed. Omit to show it to every
|
|
14
|
-
* signed-in user. Needs `@frigear-nu/authorization`; without it a document with a permission is never listed. This only
|
|
15
|
-
* decides what is *listed*: a file in `public/` can still be fetched by anyone who knows its URL.
|
|
16
|
-
*/
|
|
17
|
-
permission?: Permission;
|
|
18
|
-
};
|
|
19
3
|
type PublicModuleOptions = {
|
|
20
4
|
pages: {
|
|
21
5
|
index?: string;
|
|
22
6
|
profile?: string;
|
|
23
7
|
security?: string;
|
|
24
|
-
documents?: string;
|
|
25
8
|
apiTokens?: string;
|
|
26
9
|
};
|
|
27
|
-
documents: AccountDocument[];
|
|
28
10
|
/** `@frigear-nu/oauth-server` is installed: the Security page lists the applications the user is signed in to. */
|
|
29
11
|
signedInApps?: boolean;
|
|
30
12
|
};
|
|
@@ -41,10 +23,8 @@ type ModuleOptions = {
|
|
|
41
23
|
index?: string | boolean;
|
|
42
24
|
profile?: string | boolean;
|
|
43
25
|
security?: string | boolean;
|
|
44
|
-
documents?: string | boolean;
|
|
45
26
|
apiTokens?: string | boolean;
|
|
46
27
|
};
|
|
47
|
-
documents?: AccountDocument[];
|
|
48
28
|
};
|
|
49
29
|
};
|
|
50
30
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -47,17 +47,10 @@ const module$1 = defineNuxtModule({
|
|
|
47
47
|
available: () => hasNuxtModule("@frigear-nu/menu", nuxt),
|
|
48
48
|
fallback: "undefined",
|
|
49
49
|
fallbackType: "undefined"
|
|
50
|
-
}, {
|
|
51
|
-
// `@frigear-nu/authorization` is optional: without it nothing can be checked, so permission-gated documents are hidden.
|
|
52
|
-
name: "useAuthorization",
|
|
53
|
-
available: () => hasNuxtModule("@frigear-nu/authorization", nuxt),
|
|
54
|
-
fallback: "undefined",
|
|
55
|
-
fallbackType: "undefined"
|
|
56
50
|
}]);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
51
|
+
const removed = settings;
|
|
52
|
+
if (removed.documents !== void 0 || removed.pages?.documents !== void 0) {
|
|
53
|
+
throw new Error("[@frigear-nu/account] `account.settings.documents` and `account.settings.pages.documents` were removed: install `@frigear-nu/documents` and upload the files through `/admin/documents`. `frigear-nu upgrade` removes the options.");
|
|
61
54
|
}
|
|
62
55
|
addImports([
|
|
63
56
|
{ name: "useAccount", from: resolver.resolve("./runtime/app/composables/useAccount") },
|
|
@@ -66,7 +59,6 @@ const module$1 = defineNuxtModule({
|
|
|
66
59
|
]);
|
|
67
60
|
const profilePath = resolvePagePath(settings.pages?.profile, "/account/profile");
|
|
68
61
|
const securityPath = resolvePagePath(settings.pages?.security, "/account/security");
|
|
69
|
-
const documentsPath = resolvePagePath(settings.pages?.documents, "/account/documents");
|
|
70
62
|
const withApiTokens = nuxt.options.authentication?.apiTokens !== false;
|
|
71
63
|
const apiTokensPath = withApiTokens ? resolvePagePath(settings.pages?.apiTokens, "/account/api-tokens") : void 0;
|
|
72
64
|
const indexPath = withMenus ? resolvePagePath(settings.pages?.index, "/account") : void 0;
|
|
@@ -77,8 +69,7 @@ const module$1 = defineNuxtModule({
|
|
|
77
69
|
console.warn("[@frigear-nu/account] `settings.pages.index` was set, but `@frigear-nu/menu` is not installed - skipping the dashboard page.");
|
|
78
70
|
}
|
|
79
71
|
nuxt.options.runtimeConfig.public.account = {
|
|
80
|
-
pages: { index: indexPath, profile: profilePath, security: securityPath,
|
|
81
|
-
documents: settings.documents ?? [],
|
|
72
|
+
pages: { index: indexPath, profile: profilePath, security: securityPath, apiTokens: apiTokensPath },
|
|
82
73
|
signedInApps: false
|
|
83
74
|
};
|
|
84
75
|
nuxt.hook("modules:done", () => {
|
|
@@ -87,11 +78,10 @@ const module$1 = defineNuxtModule({
|
|
|
87
78
|
addModulePages("@frigear-nu/account", resolver, [
|
|
88
79
|
{ name: "account-index", path: indexPath, file: "./runtime/app/pages/index.vue" },
|
|
89
80
|
{ name: "account-profile", path: profilePath, file: "./runtime/app/pages/profile.vue" },
|
|
90
|
-
{ name: "account-documents", path: documentsPath, file: "./runtime/app/pages/documents.vue" },
|
|
91
81
|
{ name: "account-security", path: securityPath, file: "./runtime/app/pages/security.vue" },
|
|
92
82
|
{ name: "account-api-tokens", path: apiTokensPath, file: "./runtime/app/pages/api-tokens.vue" }
|
|
93
83
|
]);
|
|
94
|
-
const outside = [indexPath, profilePath, securityPath,
|
|
84
|
+
const outside = [indexPath, profilePath, securityPath, apiTokensPath].filter((path) => !!path && path !== "/account" && !path.startsWith("/account/"));
|
|
95
85
|
const areaBase = ["/account", "/account/**", ...outside];
|
|
96
86
|
const areaPatterns = localizedRoutePatterns(nuxt, areaBase);
|
|
97
87
|
if (settings.layout !== false) {
|
|
@@ -9,8 +9,7 @@ export async function useAccountNav() {
|
|
|
9
9
|
{ id: "account-overview", to: pages?.index, label: t("menu.overview.label", "Overview"), description: t("menu.overview.description", "A summary of your account."), icon: "i-lucide-layout-dashboard" },
|
|
10
10
|
{ id: "profile", to: pages?.profile, label: t("menu.profile.label", "Profile"), description: t("menu.profile.description", "Manage your profile details and email address."), icon: "i-lucide-user-round-pen" },
|
|
11
11
|
{ id: "security", to: pages?.security, label: t("menu.security.label", "Security"), description: t("menu.security.description", "Change your password and manage passkeys."), icon: "i-lucide-shield-user" },
|
|
12
|
-
{ id: "api-tokens", to: pages?.apiTokens, label: t("menu.apiTokens.label", "API tokens"), description: t("menu.apiTokens.description", "Create tokens for scripts and tools."), icon: "i-lucide-key-round" }
|
|
13
|
-
{ id: "documents", to: pages?.documents, label: t("menu.documents.label", "Documents"), description: t("menu.documents.description", "Handbooks and other files for you."), icon: "i-lucide-files" }
|
|
12
|
+
{ id: "api-tokens", to: pages?.apiTokens, label: t("menu.apiTokens.label", "API tokens"), description: t("menu.apiTokens.description", "Create tokens for scripts and tools."), icon: "i-lucide-key-round" }
|
|
14
13
|
].filter((item) => !!item.to);
|
|
15
14
|
const items = computed(() => menu ? (menu.data.value ?? []).filter((item) => !!item.to).map((item) => ({ id: item.id ?? item.to, label: item.label, description: item.description, icon: item.icon, to: item.to, external: item.external })) : fallback());
|
|
16
15
|
const links = useNavLinks(items, { exact: pages?.index ? [pages.index] : [] });
|
|
@@ -227,9 +227,10 @@ async function onChangeEmail() {
|
|
|
227
227
|
</UForm>
|
|
228
228
|
<template #footer>
|
|
229
229
|
<div class="flex justify-end gap-2">
|
|
230
|
-
<
|
|
230
|
+
<TooltipButton
|
|
231
231
|
type="submit"
|
|
232
232
|
form="account-profile"
|
|
233
|
+
:kbds="['meta', 'enter']"
|
|
233
234
|
:loading="profileAction.busy.value"
|
|
234
235
|
:disabled="!dirty"
|
|
235
236
|
:label="t('save', 'Save profile')"
|
|
@@ -134,9 +134,10 @@ const passkeyMenu = (passkey) => [[
|
|
|
134
134
|
</UForm>
|
|
135
135
|
<template #footer>
|
|
136
136
|
<div class="flex justify-end gap-2">
|
|
137
|
-
<
|
|
137
|
+
<TooltipButton
|
|
138
138
|
type="submit"
|
|
139
139
|
form="account-change-password"
|
|
140
|
+
:kbds="['meta', 'enter']"
|
|
140
141
|
:loading="passwordAction.busy.value"
|
|
141
142
|
:label="t('changePassword.submit', 'Change password')"
|
|
142
143
|
/>
|
|
@@ -19,10 +19,6 @@
|
|
|
19
19
|
"label": "Sikkerhed",
|
|
20
20
|
"description": "Skift din adgangskode og administrer adgangsnøgler."
|
|
21
21
|
},
|
|
22
|
-
"documents": {
|
|
23
|
-
"label": "Dokumenter",
|
|
24
|
-
"description": "Håndbøger og andre filer til dig."
|
|
25
|
-
},
|
|
26
22
|
"apiTokens": {
|
|
27
23
|
"label": "API-nøgler",
|
|
28
24
|
"description": "Opret nøgler til scripts og værktøjer."
|
|
@@ -130,13 +126,6 @@
|
|
|
130
126
|
"saveFailed": "Kunne ikke gemme dine fotovalg."
|
|
131
127
|
}
|
|
132
128
|
},
|
|
133
|
-
"documents": {
|
|
134
|
-
"title": "Dokumenter",
|
|
135
|
-
"description": "Dine dokumenter.",
|
|
136
|
-
"download": "Download",
|
|
137
|
-
"downloadNamed": "Download {name}",
|
|
138
|
-
"empty": "Ingen dokumenter til dig endnu."
|
|
139
|
-
},
|
|
140
129
|
"security": {
|
|
141
130
|
"title": "Sikkerhed",
|
|
142
131
|
"description": "Skift password, Social login etc.",
|
|
@@ -19,10 +19,6 @@
|
|
|
19
19
|
"label": "Security",
|
|
20
20
|
"description": "Change your password and manage passkeys."
|
|
21
21
|
},
|
|
22
|
-
"documents": {
|
|
23
|
-
"label": "Documents",
|
|
24
|
-
"description": "Handbooks and other files for you."
|
|
25
|
-
},
|
|
26
22
|
"apiTokens": {
|
|
27
23
|
"label": "API tokens",
|
|
28
24
|
"description": "Create tokens for scripts and tools."
|
|
@@ -130,13 +126,6 @@
|
|
|
130
126
|
"saveFailed": "Could not save your photo choices."
|
|
131
127
|
}
|
|
132
128
|
},
|
|
133
|
-
"documents": {
|
|
134
|
-
"title": "Documents",
|
|
135
|
-
"description": "Your documents.",
|
|
136
|
-
"download": "Download",
|
|
137
|
-
"downloadNamed": "Download {name}",
|
|
138
|
-
"empty": "No documents for you yet."
|
|
139
|
-
},
|
|
140
129
|
"security": {
|
|
141
130
|
"title": "Security",
|
|
142
131
|
"description": "Change password, Social login etc.",
|
package/dist/runtime/menus.js
CHANGED
|
@@ -61,16 +61,4 @@ export default defineMenuSource(() => {
|
|
|
61
61
|
order: 25
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
if (config?.pages?.documents) {
|
|
65
|
-
extendMenuItem("account", {
|
|
66
|
-
id: "documents",
|
|
67
|
-
label: "Documents",
|
|
68
|
-
labelKey: "account.menu.documents.label",
|
|
69
|
-
description: "Handbooks and other files for you.",
|
|
70
|
-
descriptionKey: "account.menu.documents.description",
|
|
71
|
-
icon: "i-lucide-files",
|
|
72
|
-
to: config.pages.documents,
|
|
73
|
-
order: 30
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
64
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frigear-nu/account",
|
|
3
|
-
"version": "0.
|
|
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
5
|
"keywords": [
|
|
6
6
|
"frigear-module",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"playground"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@frigear-nu/auth": "^0.
|
|
31
|
+
"@frigear-nu/auth": "^0.7.0",
|
|
32
32
|
"@frigear-nu/module-kit": "^1.3.13",
|
|
33
|
-
"@frigear-nu/ui": "^0.
|
|
34
|
-
"@frigear-nu/users": "^3.
|
|
33
|
+
"@frigear-nu/ui": "^0.3.0",
|
|
34
|
+
"@frigear-nu/users": "^3.2.0",
|
|
35
35
|
"@libsql/client": "^0.18.0",
|
|
36
36
|
"@nuxt/kit": "^4.6.4",
|
|
37
37
|
"@vueuse/core": "^15.0.0",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"zod": "^4.6.7"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@frigear-nu/authorization": "^0.6.
|
|
43
|
+
"@frigear-nu/authorization": "^0.6.8",
|
|
44
44
|
"@frigear-nu/menu": "^0.4.2",
|
|
45
45
|
"@frigear-nu/widget": "^0.4.4",
|
|
46
46
|
"@nuxt/ui": "^4.12.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@frigear-nu/authorization": "^0.6.
|
|
64
|
+
"@frigear-nu/authorization": "^0.6.8",
|
|
65
65
|
"@frigear-nu/menu": "^0.4.2",
|
|
66
66
|
"@frigear-nu/widget": "^0.4.4",
|
|
67
67
|
"@nuxt/devtools": "^4.2.0",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
-
declare const _default: typeof __VLS_export;
|
|
3
|
-
export default _default;
|
|
@@ -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,3 +0,0 @@
|
|
|
1
|
-
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
-
declare const _default: typeof __VLS_export;
|
|
3
|
-
export default _default;
|
|
@@ -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
|
-
}
|