corpushub-design-system 0.1.0 → 0.1.2
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/common/AppDropzone/AppDropzoneBody.js +2 -1
- package/dist/common/AppDropzone/UploadedFile.d.ts +2 -0
- package/dist/common/AppDropzone/index.d.ts +2 -0
- package/dist/common/AppDropzone/index.js +1 -0
- package/dist/common/AppDropzone/toMediaDisplayUrl.d.ts +10 -0
- package/dist/common/AppDropzone/toMediaDisplayUrl.js +27 -0
- package/dist/common/AppPicture/AppPicture.js +1 -1
- package/dist/common/AppTable/styles.scss +6 -2
- package/dist/common/index.d.ts +1 -1
- package/dist/common/index.js +1 -1
- package/dist/configs/Localization.js +4 -0
- package/dist/configs/api/applyAuthErrorHandling.js +5 -0
- package/dist/configs/api/index.js +2 -0
- package/dist/configs/auth/authApi.js +6 -0
- package/dist/configs/auth/installAuthRefreshInterceptor.js +5 -0
- package/dist/configs/auth/isPublicAuthRequest.d.ts +6 -0
- package/dist/configs/auth/isPublicAuthRequest.js +28 -0
- package/dist/configs/auth/session.js +8 -6
- package/dist/configs/brand.d.ts +6 -0
- package/dist/configs/brand.js +10 -3
- package/dist/configs/index.d.ts +3 -2
- package/dist/configs/index.js +2 -1
- package/dist/configs/localization/BackupTexts.d.ts +74 -0
- package/dist/configs/localization/BackupTexts.js +74 -0
- package/dist/configs/localization/CommentsTexts.d.ts +145 -145
- package/dist/configs/localization/CommentsTexts.js +145 -145
- package/dist/configs/localization/CommonTexts.d.ts +15 -0
- package/dist/configs/localization/CommonTexts.js +18 -3
- package/dist/configs/localization/HeaderTexts.js +3 -3
- package/dist/configs/localization/HelpTexts.d.ts +44 -2
- package/dist/configs/localization/HelpTexts.js +53 -11
- package/dist/configs/localization/HistoryTexts.d.ts +6 -0
- package/dist/configs/localization/HistoryTexts.js +6 -0
- package/dist/configs/localization/ParserRuleGroupsTexts.d.ts +53 -0
- package/dist/configs/localization/ParserRuleGroupsTexts.js +53 -0
- package/dist/configs/localization/SentenceTexts.js +33 -33
- package/dist/configs/services/ProfileService.js +3 -3
- package/dist/configs/tour/index.d.ts +1 -1
- package/dist/configs/types/CorpusImage.d.ts +3 -0
- package/dist/features/AccessControl/AccessControlService.d.ts +9 -0
- package/dist/features/AccessControl/AccessControlService.js +22 -8
- package/dist/features/AccessControl/AccessGrant/AccessGrant.js +3 -1
- package/dist/features/AccessControl/AccessUser/AccessData.d.ts +2 -2
- package/dist/features/AccessControl/AccessUser/AccessData.js +21 -21
- package/dist/features/AccessControl/AccessUser/AccessUser.js +20 -3
- package/dist/features/AccessControl/AccessUser/AccessUserGroups.d.ts +8 -0
- package/dist/features/AccessControl/AccessUser/AccessUserGroups.js +77 -0
- package/dist/features/AccessControl/AccessUser/style.scss +41 -3
- package/dist/features/AccessControl/AccessUsers/AccessUsers.js +44 -29
- package/dist/features/AccessControl/AccessUsers/styles.scss +5 -0
- package/dist/features/AccessControl/index.d.ts +1 -0
- package/dist/features/AccessControl/types/CorpusGroup.d.ts +10 -0
- package/dist/features/AccessControl/types/CorpusGroup.js +1 -0
- package/dist/features/AccessControl/types/UserAccessResponse.d.ts +4 -0
- package/dist/features/Backup/BackupCreate/BackupCreate.d.ts +11 -0
- package/dist/features/Backup/BackupCreate/BackupCreate.js +89 -0
- package/dist/features/Backup/BackupCreate/index.d.ts +2 -0
- package/dist/features/Backup/BackupCreate/index.js +2 -0
- package/dist/features/Backup/BackupCreate/style.scss +5 -0
- package/dist/features/Backup/BackupInfo/BackupInfo.d.ts +8 -0
- package/dist/features/Backup/BackupInfo/BackupInfo.js +36 -0
- package/dist/features/Backup/BackupInfo/index.d.ts +2 -0
- package/dist/features/Backup/BackupInfo/index.js +2 -0
- package/dist/features/Backup/BackupInfo/style.scss +23 -0
- package/dist/features/Backup/BackupRestore/BackupRestore.d.ts +7 -0
- package/dist/features/Backup/BackupRestore/BackupRestore.js +52 -0
- package/dist/features/Backup/BackupRestore/index.d.ts +3 -0
- package/dist/features/Backup/BackupRestore/index.js +2 -0
- package/dist/features/Backup/BackupRestore/style.scss +17 -0
- package/dist/features/Backup/BackupService.d.ts +20 -0
- package/dist/features/Backup/BackupService.js +43 -0
- package/dist/features/Backup/BackupTable/BackupSearchFilter.d.ts +5 -0
- package/dist/features/Backup/BackupTable/BackupSearchFilter.js +4 -0
- package/dist/features/Backup/BackupTable/BackupTable.d.ts +8 -0
- package/dist/features/Backup/BackupTable/BackupTable.js +121 -0
- package/dist/features/Backup/BackupTable/index.d.ts +4 -0
- package/dist/features/Backup/BackupTable/index.js +3 -0
- package/dist/features/Backup/BackupTable/style.scss +19 -0
- package/dist/features/Backup/index.d.ts +7 -0
- package/dist/features/Backup/index.js +4 -0
- package/dist/features/Backup/types/Backup.d.ts +14 -0
- package/dist/features/Backup/types/Backup.js +1 -0
- package/dist/features/Comments/CommentService.js +2 -1
- package/dist/features/PageRender/PageRenderView.d.ts +1 -1
- package/dist/features/PageRender/PageRenderView.js +67 -9
- package/dist/features/PageRender/style.scss +27 -5
- package/dist/features/PageRender/types.d.ts +5 -1
- package/dist/features/ParserRuleGroups/ParserRuleGroupItem.d.ts +9 -0
- package/dist/features/ParserRuleGroups/ParserRuleGroupItem.js +18 -0
- package/dist/features/ParserRuleGroups/ParserRuleGroupsEditor.d.ts +17 -0
- package/dist/features/ParserRuleGroups/ParserRuleGroupsEditor.js +129 -0
- package/dist/features/ParserRuleGroups/index.d.ts +2 -0
- package/dist/features/ParserRuleGroups/index.js +2 -0
- package/dist/features/ParserRuleGroups/style.scss +81 -0
- package/dist/features/ServerErrorReport/ServerErrorReport.js +9 -48
- package/dist/features/ServerErrorReport/ServerErrorReportForm.d.ts +22 -0
- package/dist/features/ServerErrorReport/ServerErrorReportForm.js +85 -0
- package/dist/features/ServerErrorReport/captureTabScreenshot.d.ts +1 -1
- package/dist/features/ServerErrorReport/captureTabScreenshot.js +5 -20
- package/dist/features/ServerErrorReport/index.d.ts +2 -0
- package/dist/features/ServerErrorReport/index.js +1 -0
- package/dist/features/ServerErrorReport/styles.scss +22 -9
- package/dist/features/index.d.ts +5 -1
- package/dist/features/index.js +2 -0
- package/dist/functions/EditionTierUtils.js +11 -5
- package/dist/primitives/AsyncSelectField/AsyncSelectField.js +2 -2
- package/dist/primitives/AsyncSelectField/styles.scss +31 -31
- package/dist/primitives/Button/Button.d.ts +5 -4
- package/dist/primitives/Button/Button.js +19 -19
- package/dist/primitives/DropdownButton/DropdownButton.d.ts +2 -1
- package/dist/primitives/DropdownButton/DropdownButton.js +2 -2
- package/dist/primitives/DropdownMenu/DropdownMenu.js +7 -1
- package/dist/primitives/Icon/Icon.d.ts +2 -1
- package/dist/primitives/Icon/Icon.js +2 -2
- package/dist/primitives/IconButton/IconButton.d.ts +2 -1
- package/dist/primitives/IconButton/IconButton.js +2 -2
- package/dist/primitives/Tag/Tag.d.ts +2 -1
- package/dist/primitives/Tag/Tag.js +3 -3
- package/dist/primitives/index.js +1 -1
- package/dist/shell/Header/HelpButton/HelpModal.js +3 -69
- package/dist/shell/Header/HelpButton/HelpModalMainColumn.d.ts +5 -0
- package/dist/shell/Header/HelpButton/HelpModalMainColumn.js +76 -0
- package/dist/shell/Header/HelpButton/HelpModalSideColumn.d.ts +7 -0
- package/dist/shell/Header/HelpButton/HelpModalSideColumn.js +18 -0
- package/dist/shell/Header/HelpButton/live-tour.png +0 -0
- package/dist/shell/Header/HelpButton/style.scss +330 -47
- package/dist/styles/base/_typographs.scss +376 -1
- package/dist/styles/main.scss +112 -1
- package/package.json +1 -1
- package/dist/primitives/styles/base/_typographs.scss +0 -376
- package/dist/primitives/styles/font-googleapis.scss +0 -222
- package/dist/primitives/styles/main.scss +0 -112
- /package/dist/{primitives/fonts → fonts}/material-symbols-outlined.woff2 +0 -0
- /package/dist/{primitives/fonts → fonts}/work-sans-latin-ext.woff2 +0 -0
- /package/dist/{primitives/fonts → fonts}/work-sans-latin.woff2 +0 -0
- /package/dist/{primitives/fonts → fonts}/work-sans-vietnamese.woff2 +0 -0
- /package/dist/{primitives/fonts.d.ts → fonts.d.ts} +0 -0
- /package/dist/{primitives/fonts.js → fonts.js} +0 -0
- /package/dist/{primitives/styles → styles}/base/_borders.scss +0 -0
- /package/dist/{primitives/styles → styles}/base/_colors.scss +0 -0
- /package/dist/{primitives/styles → styles}/base/_displays.scss +0 -0
- /package/dist/{primitives/styles → styles}/base/_margins.css +0 -0
- /package/dist/{primitives/styles → styles}/base/_spacing.scss +0 -0
- /package/dist/{primitives/styles → styles}/base/_tokens.scss +0 -0
|
@@ -10,6 +10,7 @@ import { useMessageUtils } from '../../configs/useMessageUtils';
|
|
|
10
10
|
import AppModalConfirm from '../AppModal/AppModalConfirm';
|
|
11
11
|
import { DropzoneShell, useDropzoneMessages, } from '../AppDropzoneShell';
|
|
12
12
|
import UploadService from './UploadService';
|
|
13
|
+
import { withMediaDisplayUrl } from './toMediaDisplayUrl';
|
|
13
14
|
function isFileAlreadyExistsError(err) {
|
|
14
15
|
return (err?.response?.status === 409 &&
|
|
15
16
|
err?.response?.data?.description === 'upload.file.already.exists');
|
|
@@ -56,7 +57,7 @@ function AppDropzoneBodyInner({ folder, onSuccess, onError, accept, messages, on
|
|
|
56
57
|
};
|
|
57
58
|
const executeUpload = async (currentFile, replace) => {
|
|
58
59
|
const response = await UploadService.execute(buildUploadFormData(currentFile, replace));
|
|
59
|
-
onSuccess(response.data);
|
|
60
|
+
onSuccess(withMediaDisplayUrl(response.data));
|
|
60
61
|
};
|
|
61
62
|
const upload = async (replace = false) => {
|
|
62
63
|
const currentFile = fileRef.current;
|
|
@@ -2,3 +2,5 @@ import AppDropzone from './AppDropzone';
|
|
|
2
2
|
import AppDropzoneBody, { type AppDropzoneBodyProps, type AppDropzoneBodyRef } from './AppDropzoneBody';
|
|
3
3
|
export default AppDropzone;
|
|
4
4
|
export { AppDropzoneBody, type AppDropzoneBodyProps, type AppDropzoneBodyRef };
|
|
5
|
+
export { toMediaDisplayUrl, withMediaDisplayUrl } from './toMediaDisplayUrl';
|
|
6
|
+
export type { UploadedFile } from './UploadedFile';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { UploadedFile } from './UploadedFile';
|
|
2
|
+
/**
|
|
3
|
+
* Builds a browser-usable media URL from an upload response.
|
|
4
|
+
* Prefer httpPrefix + path (relative key); fall back to url when prefix is absent.
|
|
5
|
+
*/
|
|
6
|
+
export declare function toMediaDisplayUrl(file: Pick<UploadedFile, 'path' | 'url' | 'httpPrefix'>): string;
|
|
7
|
+
/**
|
|
8
|
+
* Keeps path as the relative persistence key and sets url to the display URL.
|
|
9
|
+
*/
|
|
10
|
+
export declare function withMediaDisplayUrl(file: UploadedFile): UploadedFile;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds a browser-usable media URL from an upload response.
|
|
3
|
+
* Prefer httpPrefix + path (relative key); fall back to url when prefix is absent.
|
|
4
|
+
*/
|
|
5
|
+
export function toMediaDisplayUrl(file) {
|
|
6
|
+
const prefix = file.httpPrefix?.replace(/\/+$/, '');
|
|
7
|
+
const key = file.path || file.url || '';
|
|
8
|
+
if (!prefix) {
|
|
9
|
+
return key;
|
|
10
|
+
}
|
|
11
|
+
if (!key) {
|
|
12
|
+
return prefix;
|
|
13
|
+
}
|
|
14
|
+
const normalizedKey = key.startsWith('/') ? key : `/${key}`;
|
|
15
|
+
return `${prefix}${normalizedKey}`;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Keeps path as the relative persistence key and sets url to the display URL.
|
|
19
|
+
*/
|
|
20
|
+
export function withMediaDisplayUrl(file) {
|
|
21
|
+
return {
|
|
22
|
+
...file,
|
|
23
|
+
path: file.path,
|
|
24
|
+
url: toMediaDisplayUrl(file),
|
|
25
|
+
httpPrefix: file.httpPrefix,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -8,7 +8,7 @@ export default function AppPicture({ src, title, className, person, onClick, })
|
|
|
8
8
|
useEffect(() => {
|
|
9
9
|
setEmpty(!src);
|
|
10
10
|
}, []);
|
|
11
|
-
return (_jsx("div", { className: `app-picture-container ${empty ? 'empty' : ''}`, children: _jsx("img", { className: cx(className, { 'picture-placeholder': !src }), src: ImageUtils.display(src, person), title: title, onClick: () => onClick && onClick(), onError: ({ currentTarget }) => {
|
|
11
|
+
return (_jsx("div", { className: `app-picture-container ${empty ? 'empty' : ''}`, children: _jsx("img", { className: cx(className, { 'picture-placeholder': !src }), src: ImageUtils.display(src, person), title: title, referrerPolicy: "no-referrer", onClick: () => onClick && onClick(), onError: ({ currentTarget }) => {
|
|
12
12
|
setEmpty(true);
|
|
13
13
|
/* eslint-disable no-param-reassign */
|
|
14
14
|
currentTarget.onerror = null; // prevents looping
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
|
|
14
14
|
.MuiTableCell-root {
|
|
15
15
|
height: 42px;
|
|
16
|
+
|
|
17
|
+
&:last-child {
|
|
18
|
+
padding-right: 12px;
|
|
19
|
+
}
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
.MuiTableRow-root {
|
|
@@ -34,14 +38,14 @@
|
|
|
34
38
|
.MuiTableCell-head {
|
|
35
39
|
@include tag-medium-2;
|
|
36
40
|
color: var(--text-primary);
|
|
37
|
-
font-family:
|
|
41
|
+
font-family: 'Lora';
|
|
38
42
|
}
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
.MuiTableCell-body {
|
|
42
46
|
@include label-medium-1;
|
|
43
47
|
color: var(--text-primary);
|
|
44
|
-
font-family:
|
|
48
|
+
font-family: 'Work Sans';
|
|
45
49
|
cursor: pointer;
|
|
46
50
|
}
|
|
47
51
|
}
|
package/dist/common/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { default as AppClarity } from './AppClarity';
|
|
|
3
3
|
export { default as AppCard } from './AppCard/AppCard';
|
|
4
4
|
export { default as AppClipboard } from './AppClipboard';
|
|
5
5
|
export { default as AppColorpicker } from './AppColorpicker';
|
|
6
|
-
export { default as AppDropzone, AppDropzoneBody, type AppDropzoneBodyProps, type AppDropzoneBodyRef, } from './AppDropzone';
|
|
6
|
+
export { default as AppDropzone, AppDropzoneBody, type AppDropzoneBodyProps, type AppDropzoneBodyRef, toMediaDisplayUrl, withMediaDisplayUrl, } from './AppDropzone';
|
|
7
7
|
export type { UploadedFile } from './AppDropzone/UploadedFile';
|
|
8
8
|
export { default as AppDropzoneLocal, AppDropzoneBodyLocal, type AppDropzoneBodyLocalProps, type AppDropzoneBodyLocalRef, type UploadedFileLocal, } from './AppDropzoneLocal';
|
|
9
9
|
export { default as AppEditable } from './AppEditable';
|
package/dist/common/index.js
CHANGED
|
@@ -3,7 +3,7 @@ export { default as AppClarity } from './AppClarity';
|
|
|
3
3
|
export { default as AppCard } from './AppCard/AppCard';
|
|
4
4
|
export { default as AppClipboard } from './AppClipboard';
|
|
5
5
|
export { default as AppColorpicker } from './AppColorpicker';
|
|
6
|
-
export { default as AppDropzone, AppDropzoneBody, } from './AppDropzone';
|
|
6
|
+
export { default as AppDropzone, AppDropzoneBody, toMediaDisplayUrl, withMediaDisplayUrl, } from './AppDropzone';
|
|
7
7
|
export { default as AppDropzoneLocal, AppDropzoneBodyLocal, } from './AppDropzoneLocal';
|
|
8
8
|
export { default as AppEditable } from './AppEditable';
|
|
9
9
|
export { validateFormField } from './AppEditable/FormField';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import i18n from "i18next";
|
|
2
2
|
import languageDetector from "i18next-browser-languagedetector";
|
|
3
3
|
import { initReactI18next } from "react-i18next";
|
|
4
|
+
import { BackupTexts } from "./localization/BackupTexts";
|
|
4
5
|
import { BaseTexts } from "./localization/BaseTexts";
|
|
5
6
|
import { CommentsTexts } from "./localization/CommentsTexts";
|
|
6
7
|
import { CommonTexts } from "./localization/CommonTexts";
|
|
@@ -13,6 +14,7 @@ import { HistoryTexts } from "./localization/HistoryTexts";
|
|
|
13
14
|
import { SentenceTexts } from "./localization/SentenceTexts";
|
|
14
15
|
import { ConlluGraphTexts } from "./localization/ConlluGraphTexts";
|
|
15
16
|
import { ExportTexts } from "./localization/ExportTexts";
|
|
17
|
+
import { ParserRuleGroupsTexts } from "./localization/ParserRuleGroupsTexts";
|
|
16
18
|
import { TreeTexts } from "./localization/TreeTexts";
|
|
17
19
|
import { UploadTexts } from "./localization/UploadTexts";
|
|
18
20
|
function buildResources(namespaces) {
|
|
@@ -32,9 +34,11 @@ const CORE_NAMESPACES = {
|
|
|
32
34
|
consent: ConsentTexts,
|
|
33
35
|
};
|
|
34
36
|
const FEATURE_NAMESPACES = {
|
|
37
|
+
backup: BackupTexts,
|
|
35
38
|
comments: CommentsTexts,
|
|
36
39
|
'conllu-graph': ConlluGraphTexts,
|
|
37
40
|
'corpus-owner': CorpusOwnerTexts,
|
|
41
|
+
'parser-rule-groups': ParserRuleGroupsTexts,
|
|
38
42
|
tree: TreeTexts,
|
|
39
43
|
sentence: SentenceTexts,
|
|
40
44
|
history: HistoryTexts,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isTransientAuthRefreshError, markApiErrorHandled, } from './apiHandledError';
|
|
2
2
|
import { clearSession } from '../auth/session';
|
|
3
|
+
import { isPublicAuthRequest } from '../auth/isPublicAuthRequest';
|
|
3
4
|
import CookieStorage from '../CookieStorage';
|
|
4
5
|
import { dispatchAccessDeniedError } from './dispatchApiError';
|
|
5
6
|
import { logged } from '../store/actions';
|
|
@@ -58,6 +59,10 @@ export function applyAuthErrorHandling(api, options) {
|
|
|
58
59
|
if (status === 401 && isTransientAuthRefreshError(error)) {
|
|
59
60
|
return Promise.reject(error);
|
|
60
61
|
}
|
|
62
|
+
// Bad password / missing refresh cookie — let the page show the error.
|
|
63
|
+
if (isPublicAuthRequest(error.config)) {
|
|
64
|
+
return Promise.reject(error);
|
|
65
|
+
}
|
|
61
66
|
if (authErrorHandling === 'toast') {
|
|
62
67
|
handleToastAuthError(status, clearSessionOn401);
|
|
63
68
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import authApi from '../auth/authApi';
|
|
1
2
|
import { applyAuthErrorHandling } from './applyAuthErrorHandling';
|
|
2
3
|
import { createApiClient } from './createApiClient';
|
|
3
4
|
const platformApiBase = import.meta.env.VITE_APP_PLATFORM_API;
|
|
@@ -13,6 +14,7 @@ export const parserApiBase = import.meta.env.VITE_APP_PARSER_API ||
|
|
|
13
14
|
export const lexiconApiBase = import.meta.env.VITE_APP_LEXICON_API ||
|
|
14
15
|
import.meta.env.VITE_APP_URL_API;
|
|
15
16
|
const api = applyAuthErrorHandling(createApiClient({ baseURL: platformApiBase }), { authErrorHandling: 'redirect' });
|
|
17
|
+
applyAuthErrorHandling(authApi, { authErrorHandling: 'redirect' });
|
|
16
18
|
export { createApiClient } from './createApiClient';
|
|
17
19
|
export { installAuthRefreshInterceptor } from '../auth/installAuthRefreshInterceptor';
|
|
18
20
|
export { applyAuthErrorHandling } from './applyAuthErrorHandling';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
+
import { attachBearerFromSession, installAuthRefreshInterceptor, } from './installAuthRefreshInterceptor';
|
|
2
3
|
import { clearSession, setAccessToken, setRefreshAccessTokenImpl, } from './session';
|
|
3
4
|
const authApi = axios.create({
|
|
4
5
|
withCredentials: true,
|
|
@@ -14,6 +15,11 @@ const authApiBase = import.meta.env.VITE_APP_AUTH_API ?? '';
|
|
|
14
15
|
if (authApiBase) {
|
|
15
16
|
configureAuthApiBaseUrl(authApiBase);
|
|
16
17
|
}
|
|
18
|
+
installAuthRefreshInterceptor(authApi);
|
|
19
|
+
authApi.interceptors.request.use((config) => {
|
|
20
|
+
attachBearerFromSession(config);
|
|
21
|
+
return config;
|
|
22
|
+
});
|
|
17
23
|
/** Gateway: `/api/auth/refresh` → auth service `/auth/refresh` (StripPrefix=1 drops `/api` only). */
|
|
18
24
|
setRefreshAccessTokenImpl(async () => {
|
|
19
25
|
try {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getAccessToken, refreshAccessTokenOutcome, } from './session';
|
|
2
2
|
import { markTransientAuthRefresh } from '../api/apiHandledError';
|
|
3
|
+
import { isPublicAuthRequest } from './isPublicAuthRequest';
|
|
3
4
|
export function installAuthRefreshInterceptor(api) {
|
|
4
5
|
api.interceptors.response.use((response) => response, async (error) => {
|
|
5
6
|
const status = error.response?.status;
|
|
@@ -7,6 +8,10 @@ export function installAuthRefreshInterceptor(api) {
|
|
|
7
8
|
if (status !== 401 || !config || config._retried) {
|
|
8
9
|
return Promise.reject(error);
|
|
9
10
|
}
|
|
11
|
+
// Login/refresh/logout 401s are credential failures — do not retry via /refresh.
|
|
12
|
+
if (isPublicAuthRequest(config)) {
|
|
13
|
+
return Promise.reject(error);
|
|
14
|
+
}
|
|
10
15
|
config._retried = true;
|
|
11
16
|
const outcome = await refreshAccessTokenOutcome();
|
|
12
17
|
if (outcome.kind !== 'success') {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { InternalAxiosRequestConfig } from 'axios';
|
|
2
|
+
/**
|
|
3
|
+
* True when the failed request was itself a public auth call.
|
|
4
|
+
* Used to avoid refresh-retry and session-redirect on login failures.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isPublicAuthRequest(config?: InternalAxiosRequestConfig | null): boolean;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Cookie/password auth endpoints — 401 means bad credentials, not expired access. */
|
|
2
|
+
const PUBLIC_AUTH_PATHS = [
|
|
3
|
+
'/login',
|
|
4
|
+
'/login/google',
|
|
5
|
+
'/refresh',
|
|
6
|
+
'/logout',
|
|
7
|
+
];
|
|
8
|
+
/**
|
|
9
|
+
* True when the failed request was itself a public auth call.
|
|
10
|
+
* Used to avoid refresh-retry and session-redirect on login failures.
|
|
11
|
+
*/
|
|
12
|
+
export function isPublicAuthRequest(config) {
|
|
13
|
+
if (!config) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
const raw = config.url ?? '';
|
|
17
|
+
let path;
|
|
18
|
+
try {
|
|
19
|
+
path = raw.includes('://')
|
|
20
|
+
? new URL(raw).pathname
|
|
21
|
+
: raw.split('?')[0] ?? '';
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
path = raw.split('?')[0] ?? '';
|
|
25
|
+
}
|
|
26
|
+
const normalized = path.replace(/\/+$/, '') || '/';
|
|
27
|
+
return PUBLIC_AUTH_PATHS.some((suffix) => normalized === suffix || normalized.endsWith(suffix));
|
|
28
|
+
}
|
|
@@ -81,6 +81,14 @@ export async function bootstrapAuthSession() {
|
|
|
81
81
|
setAccessToken(fromHash);
|
|
82
82
|
return fromHash;
|
|
83
83
|
}
|
|
84
|
+
// Localhost: restore the handoff JWT before calling remote /refresh.
|
|
85
|
+
// Credentialed cross-origin refresh often fails CORS while the access
|
|
86
|
+
// token handoff cookie is still valid across Vite ports.
|
|
87
|
+
const fromCookie = consumeLegacyJwtCookie();
|
|
88
|
+
if (fromCookie) {
|
|
89
|
+
setAccessToken(fromCookie);
|
|
90
|
+
return fromCookie;
|
|
91
|
+
}
|
|
84
92
|
// Prefer refresh (rotates httpOnly cookie) when a prior session exists.
|
|
85
93
|
if (mayHaveRefreshSession()) {
|
|
86
94
|
const refreshed = await refreshAccessToken();
|
|
@@ -88,11 +96,5 @@ export async function bootstrapAuthSession() {
|
|
|
88
96
|
return refreshed;
|
|
89
97
|
}
|
|
90
98
|
}
|
|
91
|
-
// Localhost fallback: cross-port handoff cookie (e.g. auth:4000 → app:3000).
|
|
92
|
-
const fromCookie = consumeLegacyJwtCookie();
|
|
93
|
-
if (fromCookie) {
|
|
94
|
-
setAccessToken(fromCookie);
|
|
95
|
-
return fromCookie;
|
|
96
|
-
}
|
|
97
99
|
return null;
|
|
98
100
|
}
|
package/dist/configs/brand.d.ts
CHANGED
|
@@ -34,6 +34,12 @@ export declare function resolveBrandLogoShort(options?: {
|
|
|
34
34
|
brandId?: string;
|
|
35
35
|
origin?: string;
|
|
36
36
|
}): string;
|
|
37
|
+
/**
|
|
38
|
+
* Brand YouTube channel URL for shell CTAs (Help modal, etc.).
|
|
39
|
+
*/
|
|
40
|
+
export declare function resolveBrandYoutube(options?: {
|
|
41
|
+
brandId?: string;
|
|
42
|
+
}): string;
|
|
37
43
|
/**
|
|
38
44
|
* Resolve platform branding for a front-end app.
|
|
39
45
|
* Pass `options` from Vite plugins (Node) where `import.meta.env` may be unavailable.
|
package/dist/configs/brand.js
CHANGED
|
@@ -35,11 +35,11 @@ export function brandAssetBase(brandId, originRaw) {
|
|
|
35
35
|
return `${origin}/brands/${brandId}`;
|
|
36
36
|
}
|
|
37
37
|
function resolveBrandId(raw) {
|
|
38
|
-
return raw?.toLowerCase() === '
|
|
38
|
+
return raw?.toLowerCase() === 'tycho' ? 'tycho' : 'corpushub';
|
|
39
39
|
}
|
|
40
40
|
function readEnvBrandId() {
|
|
41
41
|
try {
|
|
42
|
-
return import.meta.env
|
|
42
|
+
return import.meta.env.VITE_APP_BRAND;
|
|
43
43
|
}
|
|
44
44
|
catch {
|
|
45
45
|
return undefined;
|
|
@@ -47,7 +47,7 @@ function readEnvBrandId() {
|
|
|
47
47
|
}
|
|
48
48
|
function readEnvOrigin() {
|
|
49
49
|
try {
|
|
50
|
-
return import.meta.env
|
|
50
|
+
return import.meta.env.VITE_APP_ORIGIN;
|
|
51
51
|
}
|
|
52
52
|
catch {
|
|
53
53
|
return undefined;
|
|
@@ -71,6 +71,13 @@ export function resolveBrandLogoShort(options) {
|
|
|
71
71
|
const origin = options?.origin ?? readEnvOrigin();
|
|
72
72
|
return `${brandAssetBase(id, origin)}/logo-short.png`;
|
|
73
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Brand YouTube channel URL for shell CTAs (Help modal, etc.).
|
|
76
|
+
*/
|
|
77
|
+
export function resolveBrandYoutube(options) {
|
|
78
|
+
const id = resolveBrandId(options?.brandId ?? readEnvBrandId());
|
|
79
|
+
return YOUTUBE_BY_BRAND[id];
|
|
80
|
+
}
|
|
74
81
|
/**
|
|
75
82
|
* Resolve platform branding for a front-end app.
|
|
76
83
|
* Pass `options` from Vite plugins (Node) where `import.meta.env` may be unavailable.
|
package/dist/configs/index.d.ts
CHANGED
|
@@ -5,16 +5,17 @@ export { applyAccessTokenFromApi, loginWithGoogle, loginWithPassword, logout, }
|
|
|
5
5
|
export { bootstrapAuthSession, clearSession, getAccessToken, LEGACY_JWT_COOKIE, mayHaveRefreshSession, REDIRECT_ACCESS_TOKEN_HASH_PARAM, refreshAccessToken, setAccessToken, } from './auth/session';
|
|
6
6
|
export { buildCrossAppRedirectUrl, clearLocalhostJwtHandoff, isLocalDevHost, persistLocalhostJwtHandoff, } from './auth/localDevHandoff';
|
|
7
7
|
export { installAuthRefreshInterceptor } from './auth/installAuthRefreshInterceptor';
|
|
8
|
+
export { default as authApi, configureAuthApiBaseUrl, } from './auth/authApi';
|
|
8
9
|
export type { TokenAuthResponse } from './auth/authApi';
|
|
9
10
|
export { commonLocalization, commonResources, featureResources, mergeResources, } from './Localization';
|
|
10
11
|
export { applyAuthErrorHandling, createApiClient, dispatchAccessDeniedError, dispatchApiError, dispatchClientError, dispatchServerApiError, isAccessDeniedApiError, isHandledApiError, isHandledAuthError, markApiErrorHandled, markAuthErrorHandled, parserApiBase, lexiconApiBase, platformApi, resolveAccessDeniedMessage, } from './api';
|
|
11
12
|
export type { ApiErrorHandled, ApplyAuthErrorHandlingOptions, AuthErrorHandled, AuthErrorHandling, CreateApiClientOptions, ServerErrorHandling, } from './api';
|
|
12
|
-
export { brandAssetBase, brandFromEnv, createBrand, resolveBrandLogo, resolveBrandLogoShort, } from './brand';
|
|
13
|
+
export { brandAssetBase, brandFromEnv, createBrand, resolveBrandLogo, resolveBrandLogoShort, resolveBrandYoutube, } from './brand';
|
|
13
14
|
export type { AppCode, BrandConfig, BrandId } from './brand';
|
|
14
15
|
export { default as ProfileService } from './services/ProfileService';
|
|
15
16
|
export { getCommonDispatch, registerCommonDispatch, } from './store/commonDispatchBridge';
|
|
16
17
|
export { TOUR_FALLBACK_LOCALE, TOUR_LOCALES, buildAnchorMap, buildDriveSteps, createTourDriver, defaultMatchPathnames, flattenWorkflowSteps, getWorkflowsForPath, hasMatchingWorkflow, loadKnowledgeBase, localizeKnowledgeBase, pickLocalizedString, resolveAnchor, resolveAnchorById, resolveTourLocale, useDriverTour, waitForSelector, } from './tour';
|
|
17
|
-
export type { AnchorSelector, Driver, KnowledgeBase, KnowledgeBaseRaw, LocalizedString, PopoverSide, ResolveKnowledgeBaseUrl, TourAnchor, TourButtonLabels, TourStep, TourStepCopy, TourStepStructural, TourWorkflow, TourWorkflowRaw, UseDriverTourOptions, } from './tour';
|
|
18
|
+
export type { AnchorSelector, DriveStep, Driver, KnowledgeBase, KnowledgeBaseRaw, LocalizedString, PopoverSide, ResolveKnowledgeBaseUrl, TourAnchor, TourButtonLabels, TourStep, TourStepCopy, TourStepStructural, TourWorkflow, TourWorkflowRaw, UseDriverTourOptions, } from './tour';
|
|
18
19
|
export { AccessRoleName, AccessStatusName, EMPTY_ACCESS } from './types/Access';
|
|
19
20
|
export type { default as Access, AccessMode, AccessRole, AccessStatus, } from './types/Access';
|
|
20
21
|
export { conlluAttributes } from './types/Conllu';
|
package/dist/configs/index.js
CHANGED
|
@@ -5,9 +5,10 @@ export { applyAccessTokenFromApi, loginWithGoogle, loginWithPassword, logout, }
|
|
|
5
5
|
export { bootstrapAuthSession, clearSession, getAccessToken, LEGACY_JWT_COOKIE, mayHaveRefreshSession, REDIRECT_ACCESS_TOKEN_HASH_PARAM, refreshAccessToken, setAccessToken, } from './auth/session';
|
|
6
6
|
export { buildCrossAppRedirectUrl, clearLocalhostJwtHandoff, isLocalDevHost, persistLocalhostJwtHandoff, } from './auth/localDevHandoff';
|
|
7
7
|
export { installAuthRefreshInterceptor } from './auth/installAuthRefreshInterceptor';
|
|
8
|
+
export { default as authApi, configureAuthApiBaseUrl, } from './auth/authApi';
|
|
8
9
|
export { commonLocalization, commonResources, featureResources, mergeResources, } from './Localization';
|
|
9
10
|
export { applyAuthErrorHandling, createApiClient, dispatchAccessDeniedError, dispatchApiError, dispatchClientError, dispatchServerApiError, isAccessDeniedApiError, isHandledApiError, isHandledAuthError, markApiErrorHandled, markAuthErrorHandled, parserApiBase, lexiconApiBase, platformApi, resolveAccessDeniedMessage, } from './api';
|
|
10
|
-
export { brandAssetBase, brandFromEnv, createBrand, resolveBrandLogo, resolveBrandLogoShort, } from './brand';
|
|
11
|
+
export { brandAssetBase, brandFromEnv, createBrand, resolveBrandLogo, resolveBrandLogoShort, resolveBrandYoutube, } from './brand';
|
|
11
12
|
export { default as ProfileService } from './services/ProfileService';
|
|
12
13
|
export { getCommonDispatch, registerCommonDispatch, } from './store/commonDispatchBridge';
|
|
13
14
|
export { TOUR_FALLBACK_LOCALE, TOUR_LOCALES, buildAnchorMap, buildDriveSteps, createTourDriver, defaultMatchPathnames, flattenWorkflowSteps, getWorkflowsForPath, hasMatchingWorkflow, loadKnowledgeBase, localizeKnowledgeBase, pickLocalizedString, resolveAnchor, resolveAnchorById, resolveTourLocale, useDriverTour, waitForSelector, } from './tour';
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export declare const BackupTexts: {
|
|
2
|
+
en: {
|
|
3
|
+
'label.title': string;
|
|
4
|
+
'button.create': string;
|
|
5
|
+
'placeholder.empty': string;
|
|
6
|
+
'backup.field.filename': string;
|
|
7
|
+
'backup.field.status': string;
|
|
8
|
+
'backup.field.user.name': string;
|
|
9
|
+
'backup.field.log': string;
|
|
10
|
+
'backup.field.id': string;
|
|
11
|
+
'backup.field.download': string;
|
|
12
|
+
'backup.label.log': string;
|
|
13
|
+
'backup.status.error': string;
|
|
14
|
+
'backup.status.processing': string;
|
|
15
|
+
'backup.status.finished': string;
|
|
16
|
+
'modal.title': string;
|
|
17
|
+
'modal.description': string;
|
|
18
|
+
'modal.button.close': string;
|
|
19
|
+
'modal.title.info': string;
|
|
20
|
+
'modal.restore.title': string;
|
|
21
|
+
'modal.restore.message.corpus': string;
|
|
22
|
+
'modal.restore.message.lexicon': string;
|
|
23
|
+
'modal.restore.message.parser': string;
|
|
24
|
+
'modal.restore.confirm': string;
|
|
25
|
+
};
|
|
26
|
+
'pt-BR': {
|
|
27
|
+
'label.title': string;
|
|
28
|
+
'button.create': string;
|
|
29
|
+
'placeholder.empty': string;
|
|
30
|
+
'backup.field.id': string;
|
|
31
|
+
'backup.field.filename': string;
|
|
32
|
+
'backup.field.user.name': string;
|
|
33
|
+
'backup.field.status': string;
|
|
34
|
+
'backup.field.download': string;
|
|
35
|
+
'backup.field.log': string;
|
|
36
|
+
'backup.label.log': string;
|
|
37
|
+
'backup.status.error': string;
|
|
38
|
+
'backup.status.processing': string;
|
|
39
|
+
'backup.status.finished': string;
|
|
40
|
+
'modal.title': string;
|
|
41
|
+
'modal.description': string;
|
|
42
|
+
'modal.button.close': string;
|
|
43
|
+
'modal.title.info': string;
|
|
44
|
+
'modal.restore.title': string;
|
|
45
|
+
'modal.restore.message.corpus': string;
|
|
46
|
+
'modal.restore.message.lexicon': string;
|
|
47
|
+
'modal.restore.message.parser': string;
|
|
48
|
+
'modal.restore.confirm': string;
|
|
49
|
+
};
|
|
50
|
+
it: {
|
|
51
|
+
'label.title': string;
|
|
52
|
+
'button.create': string;
|
|
53
|
+
'placeholder.empty': string;
|
|
54
|
+
'backup.field.filename': string;
|
|
55
|
+
'backup.field.status': string;
|
|
56
|
+
'backup.field.user.name': string;
|
|
57
|
+
'backup.field.log': string;
|
|
58
|
+
'backup.field.id': string;
|
|
59
|
+
'backup.field.download': string;
|
|
60
|
+
'backup.label.log': string;
|
|
61
|
+
'backup.status.error': string;
|
|
62
|
+
'backup.status.processing': string;
|
|
63
|
+
'backup.status.finished': string;
|
|
64
|
+
'modal.title': string;
|
|
65
|
+
'modal.description': string;
|
|
66
|
+
'modal.button.close': string;
|
|
67
|
+
'modal.title.info': string;
|
|
68
|
+
'modal.restore.title': string;
|
|
69
|
+
'modal.restore.message.corpus': string;
|
|
70
|
+
'modal.restore.message.lexicon': string;
|
|
71
|
+
'modal.restore.message.parser': string;
|
|
72
|
+
'modal.restore.confirm': string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export const BackupTexts = {
|
|
2
|
+
en: {
|
|
3
|
+
'label.title': 'Backups',
|
|
4
|
+
'button.create': 'Create new',
|
|
5
|
+
'placeholder.empty': 'No backups available',
|
|
6
|
+
'backup.field.filename': 'File name',
|
|
7
|
+
'backup.field.status': 'Status',
|
|
8
|
+
'backup.field.user.name': 'User',
|
|
9
|
+
'backup.field.log': 'Log',
|
|
10
|
+
'backup.field.id': 'Date',
|
|
11
|
+
'backup.field.download': 'Download',
|
|
12
|
+
'backup.label.log': 'Log',
|
|
13
|
+
'backup.status.error': 'error',
|
|
14
|
+
'backup.status.processing': 'processing',
|
|
15
|
+
'backup.status.finished': 'finished',
|
|
16
|
+
'modal.title': 'Create Backup',
|
|
17
|
+
'modal.description': 'This action will generate a new backup. This process may take some time.',
|
|
18
|
+
'modal.button.close': 'Close',
|
|
19
|
+
'modal.title.info': 'Backup Information',
|
|
20
|
+
'modal.restore.title': 'Confirm Restore',
|
|
21
|
+
'modal.restore.message.corpus': 'This corpus is already present on the platform. All data will be overwritten.',
|
|
22
|
+
'modal.restore.message.lexicon': 'This lexicon is already present on the platform. All data will be overwritten.',
|
|
23
|
+
'modal.restore.message.parser': 'This parser is already present on the platform. All data will be overwritten.',
|
|
24
|
+
'modal.restore.confirm': 'Are you sure you want to continue? This action is irreversible.',
|
|
25
|
+
},
|
|
26
|
+
'pt-BR': {
|
|
27
|
+
'label.title': 'Backups',
|
|
28
|
+
'button.create': 'Criar novo',
|
|
29
|
+
'placeholder.empty': 'Nenhum backup disponível',
|
|
30
|
+
'backup.field.id': 'Data',
|
|
31
|
+
'backup.field.filename': 'Nome do arquivo',
|
|
32
|
+
'backup.field.user.name': 'Usuário',
|
|
33
|
+
'backup.field.status': 'Status',
|
|
34
|
+
'backup.field.download': 'Baixar',
|
|
35
|
+
'backup.field.log': 'Log',
|
|
36
|
+
'backup.label.log': 'Log',
|
|
37
|
+
'backup.status.error': 'erro',
|
|
38
|
+
'backup.status.processing': 'processando',
|
|
39
|
+
'backup.status.finished': 'concluído',
|
|
40
|
+
'modal.title': 'Criar Backup',
|
|
41
|
+
'modal.description': 'Esta ação irá gerar um novo backup. Esse processo pode levar algum tempo.',
|
|
42
|
+
'modal.button.close': 'Fechar',
|
|
43
|
+
'modal.title.info': 'Informações do Backup',
|
|
44
|
+
'modal.restore.title': 'Confirmar Restauração',
|
|
45
|
+
'modal.restore.message.corpus': 'Este corpus já está presente na plataforma. Todos os dados serão sobrescritos.',
|
|
46
|
+
'modal.restore.message.lexicon': 'Este léxico já está presente na plataforma. Todos os dados serão sobrescritos.',
|
|
47
|
+
'modal.restore.message.parser': 'Este parser já está presente na plataforma. Todos os dados serão sobrescritos.',
|
|
48
|
+
'modal.restore.confirm': 'Tem certeza de que deseja continuar? Esta ação é irreversível.',
|
|
49
|
+
},
|
|
50
|
+
it: {
|
|
51
|
+
'label.title': 'Backup',
|
|
52
|
+
'button.create': 'Crea nuovo',
|
|
53
|
+
'placeholder.empty': 'Nessun backup disponibile',
|
|
54
|
+
'backup.field.filename': 'Nome del file',
|
|
55
|
+
'backup.field.status': 'Stato',
|
|
56
|
+
'backup.field.user.name': 'Utente',
|
|
57
|
+
'backup.field.log': 'Log',
|
|
58
|
+
'backup.field.id': 'Data',
|
|
59
|
+
'backup.field.download': 'Scarica',
|
|
60
|
+
'backup.label.log': 'Log',
|
|
61
|
+
'backup.status.error': 'errore',
|
|
62
|
+
'backup.status.processing': 'in elaborazione',
|
|
63
|
+
'backup.status.finished': 'completato',
|
|
64
|
+
'modal.title': 'Crea Backup',
|
|
65
|
+
'modal.description': 'Questa azione genererà un nuovo backup. Questo processo potrebbe richiedere del tempo.',
|
|
66
|
+
'modal.button.close': 'Chiudi',
|
|
67
|
+
'modal.title.info': 'Informazioni sul Backup',
|
|
68
|
+
'modal.restore.title': 'Conferma Ripristino',
|
|
69
|
+
'modal.restore.message.corpus': 'Questo corpus è già presente sulla piattaforma. Tutti i dati verranno sovrascritti.',
|
|
70
|
+
'modal.restore.message.lexicon': 'Questo lessico è già presente sulla piattaforma. Tutti i dati verranno sovrascritti.',
|
|
71
|
+
'modal.restore.message.parser': 'Questo parser è già presente sulla piattaforma. Tutti i dati verranno sovrascritti.',
|
|
72
|
+
'modal.restore.confirm': 'Sei sicuro di voler continuare? Questa azione è irreversibile.',
|
|
73
|
+
},
|
|
74
|
+
};
|