@shellui/core 0.6.0-beta.1 → 0.6.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 CHANGED
@@ -6,7 +6,7 @@ React runtime for the Shellui host. `@shellui/cli` depends on this package. Inst
6
6
  npm install @shellui/core
7
7
  ```
8
8
 
9
- The 0.6.0 pre-release is on the `beta` tag: `npm install @shellui/core@beta`.
9
+ Shellui **0.6.0** is the current stable release: `npm install @shellui/core@0.6.0`.
10
10
 
11
11
  ```typescript
12
12
  import type { ShellUIConfig } from '@shellui/core';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shellui/core",
3
- "version": "0.6.0-beta.1",
3
+ "version": "0.6.0",
4
4
  "description": "Shellui Core - Core React application runtime",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
@@ -73,7 +73,7 @@
73
73
  "workbox-routing": "^7.4.0",
74
74
  "workbox-strategies": "^7.4.0",
75
75
  "workbox-window": "^7.4.0",
76
- "@shellui/sdk": "0.6.0-beta.1"
76
+ "@shellui/sdk": "0.6.0"
77
77
  },
78
78
  "peerDependencies": {
79
79
  "react": "^18.0.0 || ^19.0.0",
@@ -18,6 +18,7 @@ import {
18
18
  getPreferredBackendProvider,
19
19
  getProviderVisual,
20
20
  isAccessPendingErrorCode,
21
+ loginErrorMessageKey,
21
22
  normalizeNextPath,
22
23
  redirectToCliCallback,
23
24
  resolveLoginSettings,
@@ -158,7 +159,10 @@ export const LoginView = () => {
158
159
  const path = `${location.pathname}${qs ? `?${qs}` : ''}${location.hash}`;
159
160
  navigate(path, { replace: true });
160
161
  setOauthLoadingProvider(null);
161
- const baseMsg = rawErr.trim() || t('loginPage.signInCouldNotContinue');
162
+ const messageKey = loginErrorMessageKey(code);
163
+ const baseMsg = messageKey
164
+ ? t(messageKey)
165
+ : rawErr.trim() || t('loginPage.signInCouldNotContinue');
162
166
  const hint =
163
167
  code === 'redirect_not_allowed'
164
168
  ? t('loginPage.redirectNotAllowedHint', {
@@ -1,4 +1,5 @@
1
1
  import { useEffect, useMemo, useRef, useState } from 'react';
2
+ import { useTranslation } from 'react-i18next';
2
3
  import { useLocation, useNavigate } from 'react-router';
3
4
  import urls from '../../../constants/urls';
4
5
  import { SHELLUI_AUTH_CODE_PARAM } from '../constants/oauth';
@@ -9,6 +10,7 @@ import {
9
10
  hashHasOAuthTokens,
10
11
  inferAccessPendingErrorCode,
11
12
  isAccessPendingErrorCode,
13
+ loginErrorMessageKey,
12
14
  normalizeNextPath,
13
15
  redirectCliCallbackError,
14
16
  redirectToCliCallback,
@@ -85,6 +87,7 @@ const looksLikeUsedOAuthCode = (message: string | null | undefined) => {
85
87
  export const OAuthCallbackView = () => {
86
88
  const location = useLocation();
87
89
  const navigate = useNavigate();
90
+ const { t } = useTranslation();
88
91
  const {
89
92
  completeOAuthCallback,
90
93
  completeOAuthSessionCallback,
@@ -137,13 +140,15 @@ export const OAuthCallbackView = () => {
137
140
  const bounceError = params.get(SHELLUI_OAUTH_ERROR_PARAM);
138
141
  if (bounceError) {
139
142
  const bounceCode = params.get(SHELLUI_OAUTH_ERROR_CODE_PARAM) || 'oauth_error';
140
- if (redirectCliCallbackError(bounceError, bounceCode)) return;
143
+ const messageKey = loginErrorMessageKey(bounceCode);
144
+ const displayError = messageKey ? t(messageKey) : bounceError;
145
+ if (redirectCliCallbackError(displayError, bounceCode)) return;
141
146
  if (isAccessPendingErrorCode(bounceCode)) {
142
147
  setPendingAccess({ message: bounceError, code: bounceCode });
143
148
  setIsWorking(false);
144
149
  return;
145
150
  }
146
- setLocalError(bounceError);
151
+ setLocalError(displayError);
147
152
  setIsWorking(false);
148
153
  return;
149
154
  }
@@ -189,7 +194,10 @@ export const OAuthCallbackView = () => {
189
194
  return;
190
195
  }
191
196
 
192
- const message = result.error ?? 'Unable to complete OAuth login.';
197
+ const messageKey = loginErrorMessageKey(result.errorCode);
198
+ const message = messageKey
199
+ ? t(messageKey)
200
+ : (result.error ?? 'Unable to complete OAuth login.');
193
201
  if (redirectCliCallbackError(message, result.errorCode)) return;
194
202
  setLocalError(message);
195
203
  setIsWorking(false);
@@ -310,6 +318,7 @@ export const OAuthCallbackView = () => {
310
318
  location.search,
311
319
  navigate,
312
320
  nextPath,
321
+ t,
313
322
  ]);
314
323
 
315
324
  const backToLogin = () => {
@@ -4,6 +4,7 @@ import {
4
4
  getAuthRequestErrorCode,
5
5
  inferAccessPendingErrorCode,
6
6
  isAccessPendingErrorCode,
7
+ loginErrorMessageKey,
7
8
  } from './authRequestError';
8
9
 
9
10
  describe('isAccessPendingErrorCode', () => {
@@ -15,6 +16,16 @@ describe('isAccessPendingErrorCode', () => {
15
16
  });
16
17
  });
17
18
 
19
+ describe('loginErrorMessageKey', () => {
20
+ it('maps staff magic-link refusal to the login copy key', () => {
21
+ expect(loginErrorMessageKey('magic_link_staff_disabled')).toBe(
22
+ 'loginPage.magicLinkStaffDisabled',
23
+ );
24
+ expect(loginErrorMessageKey('redirect_not_allowed')).toBe(null);
25
+ expect(loginErrorMessageKey(null)).toBe(null);
26
+ });
27
+ });
28
+
18
29
  describe('AuthRequestError', () => {
19
30
  it('stores optional error code', () => {
20
31
  const err = new AuthRequestError('Waiting for approval.', 'access_pending');
@@ -16,6 +16,12 @@ export function isAccessPendingErrorCode(code: string | null | undefined): boole
16
16
  return code === 'access_pending' || code === 'access_denied';
17
17
  }
18
18
 
19
+ /** i18n key when the shell replaces a backend sign-in sentence with its own copy. */
20
+ export function loginErrorMessageKey(code: string | null | undefined): string | null {
21
+ if (code === 'magic_link_staff_disabled') return 'loginPage.magicLinkStaffDisabled';
22
+ return null;
23
+ }
24
+
19
25
  /** Duck-type safe: `instanceof` can fail across duplicated bundles. */
20
26
  export function getAuthRequestErrorCode(err: unknown): string | null {
21
27
  if (!err || typeof err !== 'object') return null;
@@ -16,6 +16,7 @@ export {
16
16
  getAuthRequestErrorCode,
17
17
  inferAccessPendingErrorCode,
18
18
  isAccessPendingErrorCode,
19
+ loginErrorMessageKey,
19
20
  } from './authRequestError';
20
21
  export {
21
22
  CLI_CALLBACK_PARAM,
@@ -9,6 +9,7 @@
9
9
  },
10
10
  "navigationError": "Navigation error",
11
11
  "navigationNotAllowed": "This URL is not configured in the app navigation.",
12
+ "modalContent": "Modal content",
12
13
  "sessionLoading": "Restoring your session…",
13
14
  "adminShell": {
14
15
  "djangoAdmin": "Django admin"
@@ -23,7 +24,8 @@
23
24
  "userFallback": "User",
24
25
  "goToLoginAriaLabel": "Go to login",
25
26
  "openAccountMenuAriaLabel": "Open account menu for {{name}}",
26
- "loadingAccount": "Loading account…"
27
+ "loadingAccount": "Loading account…",
28
+ "backToHome": "Back to home"
27
29
  },
28
30
  "loginPage": {
29
31
  "welcomeBack": "Welcome back",
@@ -60,6 +62,7 @@
60
62
  "couldNotVerifyCapabilities": "Could not verify backend login capabilities.",
61
63
  "walletLoginFailed": "Unable to complete Ethereum wallet login.",
62
64
  "signInCouldNotContinue": "Sign-in could not continue.",
65
+ "magicLinkStaffDisabled": "Staff accounts can't sign in with an email link. Sign in with your usual sign-in method instead.",
63
66
  "magicLinkMethod": "magic link",
64
67
  "redirectNotAllowedHint": " Add this origin in shellui-auth (Django admin or shellui-admin → Company → Login redirect URLs), for example: {{origin}}."
65
68
  },
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "title": "Settings",
3
+ "selectCategory": "Select a category from the sidebar to get started.",
3
4
  "categories": {
4
5
  "preferences": "Preferences",
5
6
  "applications": "Applications",
@@ -9,6 +9,7 @@
9
9
  },
10
10
  "navigationError": "Erreur de navigation",
11
11
  "navigationNotAllowed": "Cette URL n'est pas configurée dans la navigation de l'application.",
12
+ "modalContent": "Contenu de la modale",
12
13
  "sessionLoading": "Restauration de votre session…",
13
14
  "adminShell": {
14
15
  "djangoAdmin": "Admin Django"
@@ -23,7 +24,8 @@
23
24
  "userFallback": "Utilisateur",
24
25
  "goToLoginAriaLabel": "Aller à la connexion",
25
26
  "openAccountMenuAriaLabel": "Ouvrir le menu du compte pour {{name}}",
26
- "loadingAccount": "Chargement du compte…"
27
+ "loadingAccount": "Chargement du compte…",
28
+ "backToHome": "Retour à l'accueil"
27
29
  },
28
30
  "loginPage": {
29
31
  "welcomeBack": "Bon retour",
@@ -60,6 +62,7 @@
60
62
  "couldNotVerifyCapabilities": "Impossible de vérifier les capacités de connexion du backend.",
61
63
  "walletLoginFailed": "Impossible de terminer la connexion au portefeuille Ethereum.",
62
64
  "signInCouldNotContinue": "La connexion n'a pas pu se poursuivre.",
65
+ "magicLinkStaffDisabled": "Les comptes staff ne peuvent pas se connecter avec un lien envoyé par e-mail. Connectez-vous avec votre méthode de connexion habituelle.",
63
66
  "magicLinkMethod": "lien magique",
64
67
  "redirectNotAllowedHint": " Ajoutez cette origine dans shellui-auth (admin Django ou shellui-admin → Company → Login redirect URLs), par exemple : {{origin}}."
65
68
  },
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "title": "Paramètres",
3
+ "selectCategory": "Sélectionnez une catégorie dans la barre latérale pour commencer.",
3
4
  "categories": {
4
5
  "preferences": "Préférences",
5
6
  "applications": "Applications",