@nocobase/app-template-default 1.0.0-beta.62 → 1.0.0-beta.64
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useAuthenticationErrorResolver } from '@nocobase/app-plugin-authentication/client/actions';
|
|
1
2
|
import { useToaster } from '@nocobase/app-client';
|
|
2
3
|
import { useTranslation } from '@nocobase/i18n/client';
|
|
3
4
|
import { useAuthentication } from '@nocobase/app-plugin-authentication/client';
|
|
@@ -32,6 +33,7 @@ export function UserMenu(): ReactElement {
|
|
|
32
33
|
const [isLoggingOut, setIsLoggingOut] = useState(false);
|
|
33
34
|
const { t } = useTranslation();
|
|
34
35
|
const toaster = useToaster();
|
|
36
|
+
const resolveError = useAuthenticationErrorResolver();
|
|
35
37
|
|
|
36
38
|
const name =
|
|
37
39
|
identity?.fullName ||
|
|
@@ -84,19 +86,23 @@ export function UserMenu(): ReactElement {
|
|
|
84
86
|
if (result.error) {
|
|
85
87
|
toaster.show({
|
|
86
88
|
type: 'error',
|
|
87
|
-
title:
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
title:
|
|
90
|
+
resolveError(result.error)?.message ??
|
|
91
|
+
t('account.signOutFailed', {
|
|
92
|
+
defaultValue: 'Unable to sign out. Please try again.',
|
|
93
|
+
}),
|
|
90
94
|
});
|
|
91
95
|
return;
|
|
92
96
|
}
|
|
93
97
|
await refresh();
|
|
94
|
-
} catch {
|
|
98
|
+
} catch (error) {
|
|
95
99
|
toaster.show({
|
|
96
100
|
type: 'error',
|
|
97
|
-
title:
|
|
98
|
-
|
|
99
|
-
|
|
101
|
+
title:
|
|
102
|
+
resolveError(error)?.message ??
|
|
103
|
+
t('account.signOutFailed', {
|
|
104
|
+
defaultValue: 'Unable to sign out. Please try again.',
|
|
105
|
+
}),
|
|
100
106
|
});
|
|
101
107
|
} finally {
|
|
102
108
|
setIsLoggingOut(false);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/app-template-default",
|
|
3
3
|
"displayName": "Default Template",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.64",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"prettier": "@nocobase/dev-config/prettier",
|
|
7
7
|
"engines": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"nocobase": {
|
|
11
11
|
"templateKind": "app",
|
|
12
|
-
"defaultTemplateVersion": "1.0.0-beta.
|
|
12
|
+
"defaultTemplateVersion": "1.0.0-beta.64"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@ai-sdk/react": "2.0.0",
|
|
@@ -75,15 +75,15 @@
|
|
|
75
75
|
"vite": "^6.3.5",
|
|
76
76
|
"vitest": "^4.1.10",
|
|
77
77
|
"tar": "^7.5.22",
|
|
78
|
-
"@nocobase/app-client": "^3.0.0-beta.
|
|
79
|
-
"@nocobase/app-plugin-template-print": "0.0.2-beta.
|
|
80
|
-
"@nocobase/app-skills": "0.1.0-beta.
|
|
81
|
-
"@nocobase/app-testing": "0.1.0-beta.
|
|
82
|
-
"@nocobase/app-websocket": "^0.0.
|
|
83
|
-
"@nocobase/dev-config": "0.1.0-beta.
|
|
84
|
-
"@nocobase/drive": "^0.1.0-beta.
|
|
85
|
-
"@nocobase/logging": "^0.1.0-beta.
|
|
86
|
-
"@nocobase/session": "^0.1.0-beta.
|
|
78
|
+
"@nocobase/app-client": "^3.0.0-beta.1",
|
|
79
|
+
"@nocobase/app-plugin-template-print": "0.0.2-beta.2",
|
|
80
|
+
"@nocobase/app-skills": "0.1.0-beta.32",
|
|
81
|
+
"@nocobase/app-testing": "0.1.0-beta.3",
|
|
82
|
+
"@nocobase/app-websocket": "^0.0.2-beta.0",
|
|
83
|
+
"@nocobase/dev-config": "0.1.0-beta.22",
|
|
84
|
+
"@nocobase/drive": "^0.1.0-beta.5",
|
|
85
|
+
"@nocobase/logging": "^0.1.0-beta.7",
|
|
86
|
+
"@nocobase/session": "^0.1.0-beta.3"
|
|
87
87
|
},
|
|
88
88
|
"files": [
|
|
89
89
|
".prettierignore",
|
|
@@ -141,35 +141,35 @@
|
|
|
141
141
|
"@oclif/core": "^4.14.0",
|
|
142
142
|
"better-auth": "1.7.5",
|
|
143
143
|
"hono": "^4.13.2",
|
|
144
|
-
"@nocobase/app-plugin-api-keys": "^1.0.0-beta.
|
|
145
|
-
"@nocobase/app-plugin-authentication": "^2.0.0-beta.
|
|
146
|
-
"@nocobase/app-plugin-authorization": "^1.0.0-beta.
|
|
147
|
-
"@nocobase/app-plugin-database-explorer": "^1.0.0-beta.
|
|
148
|
-
"@nocobase/app-plugin-file": "^1.0.0-beta.
|
|
149
|
-
"@nocobase/app-plugin-i18n": "^1.0.0-beta.
|
|
150
|
-
"@nocobase/app-plugin-mail": "^1.0.0-beta.
|
|
151
|
-
"@nocobase/app-plugin-notification": "^1.0.0-beta.
|
|
152
|
-
"@nocobase/app-plugin-notification-in-app": "^1.0.0-beta.
|
|
153
|
-
"@nocobase/app-plugin-notification-providers": "^0.2.0-beta.
|
|
154
|
-
"@nocobase/app-plugin-scheduler": "^1.0.0-beta.
|
|
155
|
-
"@nocobase/app-plugin-users": "^2.0.0-beta.
|
|
156
|
-
"@nocobase/app-server": "^2.0.0-beta.
|
|
157
|
-
"@nocobase/config": "^0.1.0-beta.
|
|
158
|
-
"@nocobase/db": "^1.0.0-beta.
|
|
159
|
-
"@nocobase/db-sqlite": "^0.1.0-beta.
|
|
160
|
-
"@nocobase/service-provider": "^0.0.2-beta.
|
|
161
|
-
"@nocobase/snowflake": "^1.0.0-beta.
|
|
162
|
-
"@nocobase/app-plugin-authz-default-access": "^1.0.0-beta.
|
|
163
|
-
"@nocobase/app-plugin-authz-sharing-rules": "^1.0.0-beta.
|
|
164
|
-
"@nocobase/app-plugin-authz-restriction-rules": "^1.0.0-beta.
|
|
165
|
-
"@nocobase/authorization": "^1.0.0-beta.
|
|
166
|
-
"@nocobase/queue": "^0.1.0-beta.
|
|
167
|
-
"@nocobase/jobs": "^0.1.0-beta.
|
|
168
|
-
"@nocobase/lifecycle": "^0.1.0-beta.
|
|
169
|
-
"@nocobase/i18n": "^1.0.0-beta.
|
|
170
|
-
"@nocobase/caching": "^0.1.0-beta.
|
|
171
|
-
"@nocobase/repository-input": "^0.1.0-beta.
|
|
172
|
-
"@nocobase/app-cli": "^1.0.0-beta.
|
|
144
|
+
"@nocobase/app-plugin-api-keys": "^1.0.0-beta.16",
|
|
145
|
+
"@nocobase/app-plugin-authentication": "^2.0.0-beta.7",
|
|
146
|
+
"@nocobase/app-plugin-authorization": "^1.0.0-beta.27",
|
|
147
|
+
"@nocobase/app-plugin-database-explorer": "^1.0.0-beta.14",
|
|
148
|
+
"@nocobase/app-plugin-file": "^1.0.0-beta.23",
|
|
149
|
+
"@nocobase/app-plugin-i18n": "^1.0.0-beta.16",
|
|
150
|
+
"@nocobase/app-plugin-mail": "^1.0.0-beta.11",
|
|
151
|
+
"@nocobase/app-plugin-notification": "^1.0.0-beta.27",
|
|
152
|
+
"@nocobase/app-plugin-notification-in-app": "^1.0.0-beta.24",
|
|
153
|
+
"@nocobase/app-plugin-notification-providers": "^0.2.0-beta.11",
|
|
154
|
+
"@nocobase/app-plugin-scheduler": "^1.0.0-beta.17",
|
|
155
|
+
"@nocobase/app-plugin-users": "^2.0.0-beta.4",
|
|
156
|
+
"@nocobase/app-server": "^2.0.0-beta.4",
|
|
157
|
+
"@nocobase/config": "^0.1.0-beta.3",
|
|
158
|
+
"@nocobase/db": "^1.0.0-beta.19",
|
|
159
|
+
"@nocobase/db-sqlite": "^0.1.0-beta.5",
|
|
160
|
+
"@nocobase/service-provider": "^0.0.2-beta.2",
|
|
161
|
+
"@nocobase/snowflake": "^1.0.0-beta.4",
|
|
162
|
+
"@nocobase/app-plugin-authz-default-access": "^1.0.0-beta.13",
|
|
163
|
+
"@nocobase/app-plugin-authz-sharing-rules": "^1.0.0-beta.13",
|
|
164
|
+
"@nocobase/app-plugin-authz-restriction-rules": "^1.0.0-beta.12",
|
|
165
|
+
"@nocobase/authorization": "^1.0.0-beta.13",
|
|
166
|
+
"@nocobase/queue": "^0.1.0-beta.9",
|
|
167
|
+
"@nocobase/jobs": "^0.1.0-beta.3",
|
|
168
|
+
"@nocobase/lifecycle": "^0.1.0-beta.1",
|
|
169
|
+
"@nocobase/i18n": "^1.0.0-beta.7",
|
|
170
|
+
"@nocobase/caching": "^0.1.0-beta.3",
|
|
171
|
+
"@nocobase/repository-input": "^0.1.0-beta.3",
|
|
172
|
+
"@nocobase/app-cli": "^1.0.0-beta.20"
|
|
173
173
|
},
|
|
174
174
|
"description": "NocoBase 3 application template with the standard product capabilities.",
|
|
175
175
|
"imports": {
|
|
@@ -23,11 +23,15 @@ function I18n({ children }: { readonly children: ReactNode }) {
|
|
|
23
23
|
return <TestI18nProvider runtime={runtime}>{children}</TestI18nProvider>;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
const { signOut, refresh, showToast } = vi.hoisted(() => ({
|
|
26
|
+
const { signOut, refresh, showToast, resolveError } = vi.hoisted(() => ({
|
|
27
|
+
resolveError: vi.fn(),
|
|
27
28
|
signOut: vi.fn(),
|
|
28
29
|
refresh: vi.fn(),
|
|
29
30
|
showToast: vi.fn(),
|
|
30
31
|
}));
|
|
32
|
+
vi.mock('@nocobase/app-plugin-authentication/client/actions', () => ({
|
|
33
|
+
useAuthenticationErrorResolver: () => resolveError,
|
|
34
|
+
}));
|
|
31
35
|
vi.mock('@nocobase/app-client', () => {
|
|
32
36
|
const toaster = { show: showToast, close: vi.fn() };
|
|
33
37
|
return { useToaster: () => toaster };
|
|
@@ -59,6 +63,7 @@ describe('account menu sign out', () => {
|
|
|
59
63
|
beforeEach(() => {
|
|
60
64
|
vi.resetAllMocks();
|
|
61
65
|
refresh.mockResolvedValue(undefined);
|
|
66
|
+
resolveError.mockReturnValue({ message: 'Localized authentication error' });
|
|
62
67
|
});
|
|
63
68
|
async function signOutFromMenu() {
|
|
64
69
|
render(<UserMenu />, { wrapper: I18n });
|
|
@@ -80,9 +85,13 @@ describe('account menu sign out', () => {
|
|
|
80
85
|
await waitFor(() =>
|
|
81
86
|
expect(showToast).toHaveBeenCalledWith({
|
|
82
87
|
type: 'error',
|
|
83
|
-
title: '
|
|
88
|
+
title: 'Localized authentication error',
|
|
84
89
|
}),
|
|
85
90
|
);
|
|
91
|
+
expect(resolveError).toHaveBeenCalledWith({
|
|
92
|
+
status: 403,
|
|
93
|
+
code: 'INVALID_ORIGIN',
|
|
94
|
+
});
|
|
86
95
|
expect(refresh).not.toHaveBeenCalled();
|
|
87
96
|
await openAccountMenu();
|
|
88
97
|
expect(
|