@alauda/doom 1.14.3 → 1.15.1
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/assets/login-bg.dark.svg +1 -0
- package/assets/login-bg.svg +1 -0
- package/lib/global/AuthCheck/index.d.ts +2 -0
- package/lib/global/AuthCheck/index.js +62 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/index.js +5 -3
- package/lib/global/Intelligence/AIAssistant/index.js +3 -3
- package/lib/global/Intelligence/index.js +2 -3
- package/lib/login/LoginForm/index.d.ts +5 -0
- package/lib/login/LoginForm/index.js +67 -0
- package/lib/login/constants.d.ts +1 -0
- package/lib/login/constants.js +1 -0
- package/lib/login/index.d.ts +2 -0
- package/lib/login/index.js +25 -0
- package/lib/login/store.d.ts +6 -0
- package/lib/login/store.js +37 -0
- package/lib/{global/Intelligence → login}/types.d.ts +12 -3
- package/lib/login/utils.d.ts +8 -0
- package/lib/{global/Intelligence → login}/utils.js +5 -0
- package/lib/plugins/global/index.js +17 -1
- package/lib/runtime/hooks/useIsPrint.js +3 -4
- package/lib/runtime/hooks/useTranslation.d.ts +1 -1
- package/lib/runtime/translation.d.ts +8 -12
- package/lib/runtime/translation.js +6 -9
- package/package.json +11 -11
- package/styles/login.module.scss +57 -0
- package/styles/preamble.module.scss +1 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/LoginForm/index.d.ts +0 -3
- package/lib/global/Intelligence/AIAssistant/Preamble/LoginForm/index.js +0 -88
- package/lib/global/Intelligence/AIAssistant/Preamble/Radio/Radio.d.ts +0 -7
- package/lib/global/Intelligence/AIAssistant/Preamble/Radio/Radio.js +0 -11
- package/lib/global/Intelligence/AIAssistant/Preamble/Radio/RadioGroup.d.ts +0 -11
- package/lib/global/Intelligence/AIAssistant/Preamble/Radio/RadioGroup.js +0 -21
- package/lib/global/Intelligence/AIAssistant/Preamble/Radio/context.d.ts +0 -7
- package/lib/global/Intelligence/AIAssistant/Preamble/Radio/context.js +0 -2
- package/lib/global/Intelligence/AIAssistant/Preamble/Radio/index.d.ts +0 -2
- package/lib/global/Intelligence/AIAssistant/Preamble/Radio/index.js +0 -2
- package/lib/global/Intelligence/AIAssistant/Preamble/types.d.ts +0 -9
- package/lib/global/Intelligence/AIAssistant/Preamble/types.js +0 -1
- package/lib/global/Intelligence/constants.d.ts +0 -6
- package/lib/global/Intelligence/constants.js +0 -14
- package/lib/global/Intelligence/context.d.ts +0 -20
- package/lib/global/Intelligence/context.js +0 -31
- package/lib/global/Intelligence/utils.d.ts +0 -3
- /package/lib/{global/Intelligence/AIAssistant/Preamble → login}/ApiErrorAlert/index.d.ts +0 -0
- /package/lib/{global/Intelligence/AIAssistant/Preamble → login}/ApiErrorAlert/index.js +0 -0
- /package/lib/{global/Intelligence/AIAssistant/Preamble → login}/Button/index.d.ts +0 -0
- /package/lib/{global/Intelligence/AIAssistant/Preamble → login}/Button/index.js +0 -0
- /package/lib/{global/Intelligence/AIAssistant/Preamble → login}/CaptchaInput/index.d.ts +0 -0
- /package/lib/{global/Intelligence/AIAssistant/Preamble → login}/CaptchaInput/index.js +0 -0
- /package/lib/{global/Intelligence/AIAssistant/Preamble → login}/FocusInput/index.d.ts +0 -0
- /package/lib/{global/Intelligence/AIAssistant/Preamble → login}/FocusInput/index.js +0 -0
- /package/lib/{global/Intelligence/AIAssistant/Preamble → login}/FormItem/index.d.ts +0 -0
- /package/lib/{global/Intelligence/AIAssistant/Preamble → login}/FormItem/index.js +0 -0
- /package/lib/{global/Intelligence/AIAssistant/Preamble → login}/Input/index.d.ts +0 -0
- /package/lib/{global/Intelligence/AIAssistant/Preamble → login}/Input/index.js +0 -0
- /package/lib/{global/Intelligence/AIAssistant/Preamble → login}/LoginForm/types.d.ts +0 -0
- /package/lib/{global/Intelligence/AIAssistant/Preamble → login}/LoginForm/types.js +0 -0
- /package/lib/{global/Intelligence/AIAssistant/Preamble → login}/LoginForm/utils.d.ts +0 -0
- /package/lib/{global/Intelligence/AIAssistant/Preamble → login}/LoginForm/utils.js +0 -0
- /package/lib/{global/Intelligence → login}/types.js +0 -0
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, use } from 'react';
|
|
3
|
-
import { RadioGroupContext } from "./context.js";
|
|
4
|
-
export const Radio = ({ label, value, onChange }) => {
|
|
5
|
-
const { name, value: groupValue, onChange: onGroupChange, } = use(RadioGroupContext);
|
|
6
|
-
const handleChange = useCallback((ev) => {
|
|
7
|
-
onChange?.(ev);
|
|
8
|
-
onGroupChange?.(ev);
|
|
9
|
-
}, [onChange, onGroupChange]);
|
|
10
|
-
return (_jsxs("label", { className: "radio", children: [_jsx("input", { name: name, type: "radio", value: value, onChange: handleChange, checked: value === groupValue }), _jsx("span", { className: "radio__label", children: label })] }));
|
|
11
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type ChangeEvent, type ReactNode } from 'react';
|
|
2
|
-
export interface RadioGroupProps {
|
|
3
|
-
id?: string;
|
|
4
|
-
name?: string;
|
|
5
|
-
value?: string;
|
|
6
|
-
onChange?: (value: ChangeEvent<HTMLInputElement>) => void;
|
|
7
|
-
children?: ReactNode;
|
|
8
|
-
prefix?: ReactNode;
|
|
9
|
-
suffix?: ReactNode;
|
|
10
|
-
}
|
|
11
|
-
export declare const RadioGroup: ({ id: id_, name, value, onChange, children, prefix, suffix, }: RadioGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useId, useMemo, useState, } from 'react';
|
|
3
|
-
import { RadioGroupContext } from "./context.js";
|
|
4
|
-
export const RadioGroup = ({ id: id_, name, value, onChange, children, prefix, suffix, }) => {
|
|
5
|
-
const innerId = useId();
|
|
6
|
-
const id = id_ || innerId;
|
|
7
|
-
name ??= id;
|
|
8
|
-
const [innerValue, setInnerValue] = useState(value ?? '');
|
|
9
|
-
if (value != null && innerValue !== value) {
|
|
10
|
-
setInnerValue(value);
|
|
11
|
-
}
|
|
12
|
-
const handleChange = useCallback((ev) => {
|
|
13
|
-
onChange?.(ev);
|
|
14
|
-
setInnerValue(ev.target.value);
|
|
15
|
-
}, [onChange]);
|
|
16
|
-
return (_jsx("div", { id: id, className: "radio-group", children: _jsxs(RadioGroupContext, { value: useMemo(() => ({
|
|
17
|
-
name,
|
|
18
|
-
value: innerValue,
|
|
19
|
-
onChange: handleChange,
|
|
20
|
-
}), [name, innerValue, handleChange]), children: [!!prefix && _jsx("span", { className: "radio-group__prefix", children: prefix }), children, !!suffix && _jsx("span", { className: "radio-group__suffix", children: suffix })] }) }));
|
|
21
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type ChangeEvent } from 'react';
|
|
2
|
-
export interface RadioGroupContext<T = unknown> {
|
|
3
|
-
name: string;
|
|
4
|
-
value: T;
|
|
5
|
-
onChange?: (value: ChangeEvent<HTMLInputElement>) => void;
|
|
6
|
-
}
|
|
7
|
-
export declare const RadioGroupContext: import("react").Context<RadioGroupContext<unknown>>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ResponseError } from 'x-fetch';
|
|
2
|
-
export interface ApiErrorOptions<R extends string = string, E extends object = object, T = unknown> {
|
|
3
|
-
code: number;
|
|
4
|
-
reason: R;
|
|
5
|
-
message: string;
|
|
6
|
-
extra?: E;
|
|
7
|
-
details?: T[];
|
|
8
|
-
}
|
|
9
|
-
export type ApiError<T extends string = string, E extends object = object> = ResponseError<ApiErrorOptions<T, E>>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { CloudAuthRegion } from './types.js';
|
|
2
|
-
export declare const CLOUD_AUTH_ORIGIN_KEY = "__CLOUD_AUTH_ORIGIN__";
|
|
3
|
-
export declare const CLOUD_AUTH_TOKEN_KEY = "__CLOUD_AUTH_TOKEN__";
|
|
4
|
-
declare const CLOUD_AUTH_ORIGINS: CloudAuthRegion[];
|
|
5
|
-
export declare const CLOUD_AUTH_ORIGIN_VALUES: string[];
|
|
6
|
-
export { CLOUD_AUTH_ORIGINS };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export const CLOUD_AUTH_ORIGIN_KEY = '__CLOUD_AUTH_ORIGIN__';
|
|
2
|
-
export const CLOUD_AUTH_TOKEN_KEY = '__CLOUD_AUTH_TOKEN__';
|
|
3
|
-
const CLOUD_AUTH_ORIGINS = [
|
|
4
|
-
{
|
|
5
|
-
name: 'global',
|
|
6
|
-
value: 'https://cloud.alauda.io',
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
name: 'china',
|
|
10
|
-
value: 'https://cloud.alauda.cn',
|
|
11
|
-
},
|
|
12
|
-
];
|
|
13
|
-
export const CLOUD_AUTH_ORIGIN_VALUES = CLOUD_AUTH_ORIGINS.map(({ value }) => value);
|
|
14
|
-
export { CLOUD_AUTH_ORIGINS };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
2
|
-
import type { AuthInfo } from './types.js';
|
|
3
|
-
export interface CloudAuth {
|
|
4
|
-
origin: string;
|
|
5
|
-
token?: string;
|
|
6
|
-
detail?: AuthInfo;
|
|
7
|
-
}
|
|
8
|
-
export interface CloudAuthContext {
|
|
9
|
-
authInfo: CloudAuth | null;
|
|
10
|
-
setAuthBasic: (authBasic?: {
|
|
11
|
-
origin: string;
|
|
12
|
-
token: string;
|
|
13
|
-
} | null) => void;
|
|
14
|
-
}
|
|
15
|
-
export declare const CloudAuthContext: import("react").Context<CloudAuthContext>;
|
|
16
|
-
export declare const useCloudAuth: () => CloudAuthContext;
|
|
17
|
-
export declare const getCloudAuth: () => CloudAuth | null;
|
|
18
|
-
export declare const CloudAuthProvider: ({ children }: {
|
|
19
|
-
children: ReactNode;
|
|
20
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, use, useMemo, useState } from 'react';
|
|
3
|
-
import { CLOUD_AUTH_ORIGIN_KEY, CLOUD_AUTH_TOKEN_KEY } from './constants.js';
|
|
4
|
-
import { getAuthInfoFromToken, setLocalStorage } from './utils.js';
|
|
5
|
-
export const CloudAuthContext = createContext(null);
|
|
6
|
-
export const useCloudAuth = () => use(CloudAuthContext);
|
|
7
|
-
export const getCloudAuth = () => {
|
|
8
|
-
const origin = localStorage.getItem(CLOUD_AUTH_ORIGIN_KEY);
|
|
9
|
-
const token = localStorage.getItem(CLOUD_AUTH_TOKEN_KEY);
|
|
10
|
-
if (origin == null) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
if (token == null) {
|
|
14
|
-
return { origin };
|
|
15
|
-
}
|
|
16
|
-
return { origin, token, detail: getAuthInfoFromToken(token) };
|
|
17
|
-
};
|
|
18
|
-
export const CloudAuthProvider = ({ children }) => {
|
|
19
|
-
const [authInfo, setAuthInfo] = useState(getCloudAuth);
|
|
20
|
-
return (_jsx(CloudAuthContext, { value: useMemo(() => ({
|
|
21
|
-
authInfo,
|
|
22
|
-
setAuthBasic(authBasic) {
|
|
23
|
-
// keep origin in localStorage for next login
|
|
24
|
-
if (authBasic?.origin != null) {
|
|
25
|
-
setLocalStorage(CLOUD_AUTH_ORIGIN_KEY, authBasic.origin);
|
|
26
|
-
}
|
|
27
|
-
setLocalStorage(CLOUD_AUTH_TOKEN_KEY, authBasic?.token);
|
|
28
|
-
setAuthInfo(getCloudAuth);
|
|
29
|
-
},
|
|
30
|
-
}), [authInfo]), children: children }));
|
|
31
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|