@abyss-project/commons-front-core 3.3.2 → 4.0.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/dist/{CookieConsentSettings.component-tRVw_4zH.js → CookieConsentSettings.component-B06_BnQP.js} +2703 -2118
- package/dist/auth/client/auth-bridge.d.ts +51 -0
- package/dist/auth/client/auth-client.d.ts +125 -0
- package/dist/auth/client/auth-client.spec.d.ts +1 -0
- package/dist/auth/client/capacitor-bridge.d.ts +16 -0
- package/dist/auth/client/index.d.ts +6 -0
- package/dist/auth/client/native-bridge.d.ts +53 -0
- package/dist/auth/client/native-bridge.spec.d.ts +1 -0
- package/dist/auth/client/token-storage.d.ts +31 -0
- package/dist/auth/client/web-bridge.d.ts +13 -0
- package/dist/auth/client/web-bridge.spec.d.ts +1 -0
- package/dist/auth/components/AuthFlow/AuthFlow.component.d.ts +30 -0
- package/dist/auth/components/AuthFlow/AuthFlow.component.spec.d.ts +1 -0
- package/dist/auth/components/AuthFlow/auth-flow.types.d.ts +62 -0
- package/dist/auth/components/AuthFlow/steps/CodeStep.component.d.ts +17 -0
- package/dist/auth/components/AuthFlow/steps/EmailStep.component.d.ts +22 -0
- package/dist/auth/components/AuthFlow/steps/MfaEnrollmentStep.component.d.ts +13 -0
- package/dist/auth/components/AuthFlow/steps/MfaStep.component.d.ts +20 -0
- package/dist/auth/components/AuthFlow/steps/PasskeyNudgeStep.component.d.ts +11 -0
- package/dist/auth/components/AuthFlow/steps/PasswordStep.component.d.ts +17 -0
- package/dist/auth/components/AuthFlow/steps/SignupStep.component.d.ts +24 -0
- package/dist/auth/components/AuthFlow/steps/steps.autocomplete.spec.d.ts +1 -0
- package/dist/auth/components/AuthProviderButtons/AuthProviderButtons.component.d.ts +30 -0
- package/dist/auth/components/MfaRequirementBanner/MfaRequirementBanner.component.d.ts +12 -0
- package/dist/auth/components/MfaRequirementBanner/MfaRequirementBanner.component.spec.d.ts +1 -0
- package/dist/auth/components/ReauthDialog/AuthReauthHost.component.d.ts +8 -0
- package/dist/auth/components/ReauthDialog/ReauthDialog.component.d.ts +22 -0
- package/dist/auth/components/ReauthDialog/ReauthDialog.component.spec.d.ts +1 -0
- package/dist/auth/components/SecuritySettings/SecuritySettings.component.d.ts +7 -0
- package/dist/auth/components/SecuritySettings/SecuritySettings.component.spec.d.ts +1 -0
- package/dist/auth/components/SecuritySettings/sections/EmailSection.component.d.ts +6 -0
- package/dist/auth/components/SecuritySettings/sections/PasskeysSection.component.d.ts +10 -0
- package/dist/auth/components/SecuritySettings/sections/PasswordSection.component.d.ts +9 -0
- package/dist/auth/components/SecuritySettings/sections/RecoveryCodesSection.component.d.ts +10 -0
- package/dist/auth/components/SecuritySettings/sections/SecuritySection.component.d.ts +26 -0
- package/dist/auth/components/SecuritySettings/sections/SessionsSection.component.d.ts +8 -0
- package/dist/auth/components/SecuritySettings/sections/TotpSection.component.d.ts +11 -0
- package/dist/auth/components/SecuritySettings/sections/use-section-action.hook.d.ts +9 -0
- package/dist/auth/components/index.d.ts +11 -0
- package/dist/auth/components/shared/AuthStepFrame.component.d.ts +19 -0
- package/dist/auth/components/shared/OneTimeCodeField.component.d.ts +17 -0
- package/dist/auth/components/shared/RecoveryCodesPanel.component.d.ts +12 -0
- package/dist/auth/components/shared/TotpSetupPanel.component.d.ts +14 -0
- package/dist/auth/components/shared/auth-errors.d.ts +42 -0
- package/dist/auth/components/shared/mfa-status-events.d.ts +2 -0
- package/dist/auth/components/shared/passkey-ceremonies.d.ts +17 -0
- package/dist/auth/components/shared/use-async-resource.hook.d.ts +18 -0
- package/dist/auth/components/shared/use-offline.hook.d.ts +2 -0
- package/dist/auth/components/shared/use-passkey-name.hook.d.ts +5 -0
- package/dist/auth/components/test-support/auth-sdk.mock.d.ts +57 -0
- package/dist/auth/components/test-support/auth-test-harness.d.ts +48 -0
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/react/AuthProvider.component.d.ts +15 -0
- package/dist/auth/react/AuthProvider.component.spec.d.ts +1 -0
- package/dist/auth/react/use-auth.hook.d.ts +3 -0
- package/dist/auth-client.d.ts +2 -0
- package/dist/auth-client.js +26 -0
- package/dist/auth-native.d.ts +2 -0
- package/dist/auth-native.js +84 -0
- package/dist/components/Layouts/AbyssLayoutProvider/AbyssLayoutProvider.component.d.ts +2 -3
- package/dist/components/Layouts/AbyssLayoutProvider/abyss-layout.store.d.ts +1 -1
- package/dist/components/Support/SupportTicketDetail.mobile-layout.spec.d.ts +1 -0
- package/dist/cookie-consent.js +1 -1
- package/dist/hooks/use-rich-intl.hook.d.ts +654 -4
- package/dist/{index-g_LMIl_j.js → index-B99FVtM1.js} +2 -2
- package/dist/{index-Cy5aV6-7.js → index-BAiia-Dl.js} +4 -4
- package/dist/{index-CSOs_Ccx.js → index-BI56obfe.js} +1 -1
- package/dist/{index-sAQE8yH0.js → index-BLjfAtDQ.js} +2 -2
- package/dist/{index-BHSTpRDB.js → index-BQMgvLh9.js} +4 -4
- package/dist/{index-Bb8UEu0K.js → index-BU5c0hG9.js} +3 -3
- package/dist/{index-CJghyDOF.js → index-B_rGVaUU.js} +2 -2
- package/dist/{index-nT4uFN7k.js → index-BokeagcV.js} +3 -3
- package/dist/{index-N73aWpoj.js → index-C36LEiRs.js} +2 -2
- package/dist/{index-Dn4CNQkV.js → index-C4fkwJmM.js} +2 -2
- package/dist/{index-TbU1rvxC.js → index-COBKSaJ6.js} +2 -2
- package/dist/{index-DUuSQC1S.js → index-CQcl-JnX.js} +2 -2
- package/dist/{index-BDwKynBn.js → index-Cp_oEtd_.js} +33265 -30088
- package/dist/{index-DUxqfZmd.js → index-D1vKJSB3.js} +3 -3
- package/dist/index-D7cgykJH.js +324 -0
- package/dist/{index-C2SpycHF.js → index-DA5MOwJ6.js} +2 -2
- package/dist/{index-DDBCCwMT.js → index-DAEl7d3x.js} +2 -2
- package/dist/{index-D84kdr5l.js → index-DPDhWaXC.js} +2 -2
- package/dist/{index-Hf4VgoUQ.js → index-Dy57KM7a.js} +2 -2
- package/dist/{index-BDI9bSnM.js → index-QsS__hk5.js} +3 -3
- package/dist/{index-D8hjJcQ2.js → index-cHPTPlez.js} +2 -2
- package/dist/{index-DlNShbQC.js → index-pmj-p-Pq.js} +2 -2
- package/dist/{index-DcZU8Tc4.js → index-rgzxHuXo.js} +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +273 -242
- package/dist/token-storage-D3e11ePD.js +38 -0
- package/dist/translations/en.d.ts +289 -0
- package/dist/translations/fr.d.ts +289 -0
- package/dist/translations/translations-parity.spec.d.ts +1 -0
- package/dist/use-auth.hook-B_TU5W3g.js +391 -0
- package/dist/utils/billing.utils.d.ts +2 -2
- package/dist/utils/cookie.utils.d.ts +1 -1
- package/dist/utils/space-display-name.utils.d.ts +2 -2
- package/package.json +32 -10
- package/scripts/check-auth-entry-isolation.cjs +140 -0
- package/vite.config.ts +24 -1
- package/vitest.config.ts +1 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The account's e-mail address (5.3): a new address, a 6-digit code sent to it, then the switch —
|
|
3
|
+
* all behind a recent proof of identity (the re-authentication dialog opens past 5 minutes).
|
|
4
|
+
* Confirming signs out every other session, as a password change does.
|
|
5
|
+
*/
|
|
6
|
+
export declare const EmailSection: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
/** Whether this device can create a passkey (the list is shown either way). */
|
|
3
|
+
passkeySupported: boolean;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* The account's passkeys: add one from this device, rename, remove. Adding and removing need a
|
|
7
|
+
* proof of less than 5 minutes: the re-authentication dialog opens when it is older.
|
|
8
|
+
*/
|
|
9
|
+
export declare const PasskeysSection: ({ passkeySupported }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** The policy as a password manager reads it when it generates one (ADR-0059). */
|
|
2
|
+
export declare const PASSWORD_RULES: string;
|
|
3
|
+
/**
|
|
4
|
+
* Changing the password asks for the current one (ADR-0059) and a recent proof of identity (the
|
|
5
|
+
* re-authentication dialog opens past 5 minutes). An account without password (signed up by code,
|
|
6
|
+
* passkey, Google or Apple) gets one through the reset e-mail: the change needs a current password
|
|
7
|
+
* to compare.
|
|
8
|
+
*/
|
|
9
|
+
export declare const PasswordSection: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IMfaStatus } from '@abyss-project/main';
|
|
2
|
+
type Props = {
|
|
3
|
+
status: IMfaStatus;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* The recovery codes (5.3): how many are left, and a new set of ten — replacing every previous
|
|
7
|
+
* code — shown once. They stand in for a factor, so they exist only once one is enrolled.
|
|
8
|
+
*/
|
|
9
|
+
export declare const RecoveryCodesSection: ({ status }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AuthErrorKind } from '../../shared/auth-errors';
|
|
3
|
+
type SecuritySectionProps = {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
lede?: ReactNode;
|
|
7
|
+
/** The section's main action, at the right of the title (under it on a phone). */
|
|
8
|
+
action?: ReactNode;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
/** One block of the Security page: a titled card. */
|
|
12
|
+
export declare const SecuritySection: ({ id, title, lede, action, children, }: SecuritySectionProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
/** Placeholder lines while a section loads: the card keeps its height. */
|
|
14
|
+
export declare const SectionSkeleton: ({ lines }: {
|
|
15
|
+
lines?: number;
|
|
16
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
/** A section that could not load: the cause and a retry. */
|
|
18
|
+
export declare const SectionError: ({ error, onRetry, }: {
|
|
19
|
+
error?: AuthErrorKind;
|
|
20
|
+
onRetry: () => void;
|
|
21
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
/** A failed action inside a loaded section, announced politely. */
|
|
23
|
+
export declare const ActionError: ({ error }: {
|
|
24
|
+
error: AuthErrorKind | null;
|
|
25
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The open sessions of the account (5.2): device, platform and opening date, how it signed in,
|
|
3
|
+
* last activity, last IP address (masked by abyss-main) — enough to tell two "Chrome · Windows"
|
|
4
|
+
* apart.
|
|
5
|
+
* Revoking one ends it on the server; its device is signed out at the latest when its access
|
|
6
|
+
* token expires (15 min, CA12). The current session is ended by signing out, not from here.
|
|
7
|
+
*/
|
|
8
|
+
export declare const SessionsSection: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IMfaStatus } from '@abyss-project/main';
|
|
2
|
+
type Props = {
|
|
3
|
+
status: IMfaStatus;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* The authenticator app (TOTP, 5.3): set up with a QR code, the key or the `otpauth://` link, then
|
|
7
|
+
* confirmed by a first code; turned off after confirmation. The last factor of an account that
|
|
8
|
+
* requires MFA cannot be turned off (the server says so, the message explains).
|
|
9
|
+
*/
|
|
10
|
+
export declare const TotpSection: ({ status }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AuthErrorKind } from '../../shared/auth-errors';
|
|
2
|
+
export interface SectionAction {
|
|
3
|
+
busy: boolean;
|
|
4
|
+
error: AuthErrorKind | null;
|
|
5
|
+
/** Runs one action of the section; its failure lands in `error`. Resolves `true` on success. */
|
|
6
|
+
run: (action: () => Promise<void>) => Promise<boolean>;
|
|
7
|
+
clearError: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const useSectionAction: () => SectionAction;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { AuthFlow } from './AuthFlow/AuthFlow.component';
|
|
2
|
+
export type { AuthFlowProps } from './AuthFlow/AuthFlow.component';
|
|
3
|
+
export type { AuthFlowContext, AuthFlowLegal, AuthFlowResult, } from './AuthFlow/auth-flow.types';
|
|
4
|
+
export { AuthProviderButtons, AuthProviderKind, } from './AuthProviderButtons/AuthProviderButtons.component';
|
|
5
|
+
export type { AuthFlowProviders, AuthProviderButtonsProps, } from './AuthProviderButtons/AuthProviderButtons.component';
|
|
6
|
+
export { SecuritySettings } from './SecuritySettings/SecuritySettings.component';
|
|
7
|
+
export { ReauthDialog } from './ReauthDialog/ReauthDialog.component';
|
|
8
|
+
export type { ReauthDialogProps } from './ReauthDialog/ReauthDialog.component';
|
|
9
|
+
export { AuthReauthHost } from './ReauthDialog/AuthReauthHost.component';
|
|
10
|
+
export { MfaRequirementBanner } from './MfaRequirementBanner/MfaRequirementBanner.component';
|
|
11
|
+
export type { MfaRequirementBannerProps } from './MfaRequirementBanner/MfaRequirementBanner.component';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AuthErrorKind } from './auth-errors';
|
|
3
|
+
type Props = {
|
|
4
|
+
title: string;
|
|
5
|
+
lede?: ReactNode;
|
|
6
|
+
/** The step's failure, announced politely to assistive technologies. */
|
|
7
|
+
error?: AuthErrorKind | null;
|
|
8
|
+
/** A neutral confirmation (code sent again, e-mail sent…). */
|
|
9
|
+
notice?: ReactNode;
|
|
10
|
+
/** Shown under the error: the way out it calls for (retry, new code…). */
|
|
11
|
+
errorAction?: ReactNode;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The frame every authentication step shares: one title, an optional lede, the step's error or
|
|
16
|
+
* notice in a polite live region, then the step's form.
|
|
17
|
+
*/
|
|
18
|
+
export declare const AuthStepFrame: ({ title, lede, error, notice, errorAction, children, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Length of an e-mail code and of a TOTP code. */
|
|
2
|
+
export declare const ONE_TIME_CODE_LENGTH = 6;
|
|
3
|
+
type Props = {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
onChange: (value: string) => void;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
error?: boolean;
|
|
10
|
+
autoFocus?: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Six-digit code field (e-mail code, TOTP). `one-time-code` lets the platform offer the code it
|
|
14
|
+
* just received; a pasted code keeps working whatever its spacing, since only the digits are kept.
|
|
15
|
+
*/
|
|
16
|
+
export declare const OneTimeCodeField: ({ id, label, value, onChange, disabled, error, autoFocus, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
codes: string[];
|
|
3
|
+
/** The browser can save a file; a native webview cannot, copying is offered alone there. */
|
|
4
|
+
canDownload: boolean;
|
|
5
|
+
onAcknowledge: () => void;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* The ten recovery codes, shown once: abyss-main keeps only their hashes. The user leaves this
|
|
9
|
+
* panel only by confirming they stored them.
|
|
10
|
+
*/
|
|
11
|
+
export declare const RecoveryCodesPanel: ({ codes, canDownload, onAcknowledge, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AuthClient } from '../../client/auth-client';
|
|
2
|
+
type Props = {
|
|
3
|
+
client: AuthClient;
|
|
4
|
+
/** The TOTP is on; `recoveryCodes` when this confirmation generated them (shown once). */
|
|
5
|
+
onEnabled: (recoveryCodes?: string[]) => void;
|
|
6
|
+
onCancel?: () => void;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Sets up an authenticator app: a new pending secret, shown as a QR code (painted inline, not
|
|
10
|
+
* through `QRCodeModal`), as a key to type, and — on a phone — as an `otpauth://` link that opens
|
|
11
|
+
* the app; the first code the app shows turns it on.
|
|
12
|
+
*/
|
|
13
|
+
export declare const TotpSetupPanel: ({ client, onEnabled, onCancel }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { IApiError, IResponse } from '@abyss-project/main';
|
|
2
|
+
import { ExistingTranslationKey } from '../../../hooks/use-rich-intl.hook';
|
|
3
|
+
/** Every failure an authentication screen tells apart, each with its own message. */
|
|
4
|
+
export declare enum AuthErrorKind {
|
|
5
|
+
OFFLINE = "offline",
|
|
6
|
+
NETWORK = "network",
|
|
7
|
+
SERVER = "server",
|
|
8
|
+
CODE_INVALID = "code-invalid",
|
|
9
|
+
CODE_EXPIRED = "code-expired",
|
|
10
|
+
CODE_TOO_MANY = "code-too-many",
|
|
11
|
+
MFA_INVALID = "mfa-invalid",
|
|
12
|
+
TOKEN_EXPIRED = "token-expired",
|
|
13
|
+
CREDENTIALS_INVALID = "credentials-invalid",
|
|
14
|
+
EMAIL_NOT_VERIFIED = "email-not-verified",
|
|
15
|
+
RATE_LIMITED = "rate-limited",
|
|
16
|
+
SIGNUP_EXPIRED = "signup-expired",
|
|
17
|
+
PASSKEY_FAILED = "passkey-failed",
|
|
18
|
+
ID_TOKEN_INVALID = "id-token-invalid",
|
|
19
|
+
LAST_FACTOR = "last-factor",
|
|
20
|
+
CURRENT_PASSWORD = "current-password",
|
|
21
|
+
PASSWORD_POLICY = "password-policy",
|
|
22
|
+
EMAIL_CHANGE_UNAVAILABLE = "email-change-unavailable",
|
|
23
|
+
REAUTH_CANCELLED = "reauth-cancelled",
|
|
24
|
+
SESSION_REVOKED = "session-revoked",
|
|
25
|
+
CEREMONY_CANCELLED = "ceremony-cancelled",
|
|
26
|
+
CEREMONY_UNSUPPORTED = "ceremony-unsupported",
|
|
27
|
+
CEREMONY_NO_CREDENTIAL = "ceremony-no-credential",
|
|
28
|
+
CEREMONY_FAILED = "ceremony-failed",
|
|
29
|
+
UNKNOWN = "unknown"
|
|
30
|
+
}
|
|
31
|
+
/** An SDK answer that carried an `error` instead of throwing. */
|
|
32
|
+
export declare class AuthApiError extends Error {
|
|
33
|
+
readonly apiError: IApiError;
|
|
34
|
+
constructor(apiError: IApiError);
|
|
35
|
+
}
|
|
36
|
+
/** The `data` of an SDK answer; its `error`, if any, thrown as an `AuthApiError`. */
|
|
37
|
+
export declare const unwrap: <T>(response: IResponse<T>) => T;
|
|
38
|
+
export declare const isOffline: () => boolean;
|
|
39
|
+
/** Sorts any failure of an authentication call or ceremony into the kind its screen shows. */
|
|
40
|
+
export declare const readAuthError: (error: unknown) => AuthErrorKind;
|
|
41
|
+
/** The message of an error kind, under `auth.errors`. */
|
|
42
|
+
export declare const authErrorMessageId: (kind: AuthErrorKind) => ExistingTranslationKey;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IRegistrationVerifyPasskeyUserData } from '@abyss-project/main';
|
|
2
|
+
import { AuthClient } from '../../client/auth-client';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a passkey for the signed-in user: options from abyss-main, the platform ceremony, then
|
|
5
|
+
* the verification. Both calls need a proof of less than 5 minutes: `withAuthRetry` opens the
|
|
6
|
+
* re-authentication dialog when it is older. `recoveryCodes` comes back when this passkey is the
|
|
7
|
+
* account's first second factor, to be shown once.
|
|
8
|
+
*/
|
|
9
|
+
export declare const registerPasskey: (client: AuthClient, name: string) => Promise<IRegistrationVerifyPasskeyUserData>;
|
|
10
|
+
/**
|
|
11
|
+
* Re-proves the current session with one of the user's passkeys. The new session (fresh proof,
|
|
12
|
+
* `mfa` from then on, rotated refresh token) goes through `handleResult`.
|
|
13
|
+
*/
|
|
14
|
+
export declare const reauthenticateWithPasskey: (client: AuthClient) => Promise<void>;
|
|
15
|
+
/** Whether this user declined the passkey proposal on this device. */
|
|
16
|
+
export declare const isPasskeyNudgeDismissed: (userId: string) => boolean;
|
|
17
|
+
export declare const dismissPasskeyNudge: (userId: string) => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AuthErrorKind } from './auth-errors';
|
|
2
|
+
export declare enum ResourceStatus {
|
|
3
|
+
LOADING = "loading",
|
|
4
|
+
READY = "ready",
|
|
5
|
+
ERROR = "error"
|
|
6
|
+
}
|
|
7
|
+
export interface AsyncResource<T> {
|
|
8
|
+
status: ResourceStatus;
|
|
9
|
+
data?: T;
|
|
10
|
+
error?: AuthErrorKind;
|
|
11
|
+
/** Loads again; the data already shown stays until the new answer lands. */
|
|
12
|
+
reload: () => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Loads `load()` on mount and on every `reload()`. An answer that a later load overtook is
|
|
16
|
+
* dropped, so a slow first answer never overwrites a fresh one.
|
|
17
|
+
*/
|
|
18
|
+
export declare const useAsyncResource: <T>(load: () => Promise<T>) => AsyncResource<T>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Mock } from 'vitest';
|
|
2
|
+
/**
|
|
3
|
+
* Spec-only stand-in for `AbyssCore.sdk`, the surface the auth screens call. Specs install it with
|
|
4
|
+
* `vi.mock('@abyss-project/main', …)` and drive each call from the test. Imports nothing from
|
|
5
|
+
* `@abyss-project/main` on purpose: the mock factory loads this file while that module is mocked.
|
|
6
|
+
*/
|
|
7
|
+
export declare const sdkMock: {
|
|
8
|
+
auth: {
|
|
9
|
+
refresh: Mock<(...args: any[]) => any>;
|
|
10
|
+
login: Mock<(...args: any[]) => any>;
|
|
11
|
+
logout: Mock<(...args: any[]) => any>;
|
|
12
|
+
completeSignup: Mock<(...args: any[]) => any>;
|
|
13
|
+
reauthPassword: Mock<(...args: any[]) => any>;
|
|
14
|
+
createIdTokenNonce: Mock<(...args: any[]) => any>;
|
|
15
|
+
signInWithIdToken: Mock<(...args: any[]) => any>;
|
|
16
|
+
getConnectUrlDiscordAuth: Mock<(...args: any[]) => any>;
|
|
17
|
+
getConnectUrlSlackAuth: Mock<(...args: any[]) => any>;
|
|
18
|
+
sendEmailResetPassword: Mock<(...args: any[]) => any>;
|
|
19
|
+
emailCode: {
|
|
20
|
+
request: Mock<(...args: any[]) => any>;
|
|
21
|
+
verify: Mock<(...args: any[]) => any>;
|
|
22
|
+
reauthRequest: Mock<(...args: any[]) => any>;
|
|
23
|
+
reauthVerify: Mock<(...args: any[]) => any>;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
passkey: {
|
|
27
|
+
authenticationOptions: Mock<(...args: any[]) => any>;
|
|
28
|
+
authenticationVerify: Mock<(...args: any[]) => any>;
|
|
29
|
+
reauthVerify: Mock<(...args: any[]) => any>;
|
|
30
|
+
registrationOptions: Mock<(...args: any[]) => any>;
|
|
31
|
+
registrationVerify: Mock<(...args: any[]) => any>;
|
|
32
|
+
list: Mock<(...args: any[]) => any>;
|
|
33
|
+
update: Mock<(...args: any[]) => any>;
|
|
34
|
+
remove: Mock<(...args: any[]) => any>;
|
|
35
|
+
};
|
|
36
|
+
mfa: {
|
|
37
|
+
verify: Mock<(...args: any[]) => any>;
|
|
38
|
+
reauth: Mock<(...args: any[]) => any>;
|
|
39
|
+
getStatus: Mock<(...args: any[]) => any>;
|
|
40
|
+
setupTotp: Mock<(...args: any[]) => any>;
|
|
41
|
+
confirmTotp: Mock<(...args: any[]) => any>;
|
|
42
|
+
disableTotp: Mock<(...args: any[]) => any>;
|
|
43
|
+
regenerateRecoveryCodes: Mock<(...args: any[]) => any>;
|
|
44
|
+
};
|
|
45
|
+
session: {
|
|
46
|
+
list: Mock<(...args: any[]) => any>;
|
|
47
|
+
revoke: Mock<(...args: any[]) => any>;
|
|
48
|
+
revokeOthers: Mock<(...args: any[]) => any>;
|
|
49
|
+
};
|
|
50
|
+
user: {
|
|
51
|
+
me: Mock<(...args: any[]) => any>;
|
|
52
|
+
updatePassword: Mock<(...args: any[]) => any>;
|
|
53
|
+
requestEmailChange: Mock<(...args: any[]) => any>;
|
|
54
|
+
confirmEmailChange: Mock<(...args: any[]) => any>;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export declare const resetSdkMock: () => void;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { vi } from 'vitest';
|
|
3
|
+
import { ISessionAuthData, IUser, SessionPlatform, UserLanguage } from '@abyss-project/main';
|
|
4
|
+
import { AuthBridge } from '../../client/auth-bridge';
|
|
5
|
+
import { AuthClient } from '../../client/auth-client';
|
|
6
|
+
export declare const testUser: IUser;
|
|
7
|
+
export declare const sessionOf: (user?: IUser, overrides?: Partial<ISessionAuthData>) => ISessionAuthData;
|
|
8
|
+
/** The rejection axios produces for an HTTP answer carrying an API error. */
|
|
9
|
+
export declare const apiError: (status: number, code: string) => {
|
|
10
|
+
isAxiosError: boolean;
|
|
11
|
+
response: {
|
|
12
|
+
status: number;
|
|
13
|
+
data: {
|
|
14
|
+
error: {
|
|
15
|
+
code: string;
|
|
16
|
+
message: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
/** The rejection axios produces when nothing answered. */
|
|
22
|
+
export declare const networkError: () => {
|
|
23
|
+
isAxiosError: boolean;
|
|
24
|
+
};
|
|
25
|
+
export type MockBridge = AuthBridge & {
|
|
26
|
+
passkeySupported: ReturnType<typeof vi.fn>;
|
|
27
|
+
getPasskey: ReturnType<typeof vi.fn>;
|
|
28
|
+
createPasskey: ReturnType<typeof vi.fn>;
|
|
29
|
+
google: ReturnType<typeof vi.fn>;
|
|
30
|
+
apple: ReturnType<typeof vi.fn>;
|
|
31
|
+
};
|
|
32
|
+
export declare const createBridgeMock: (platform?: SessionPlatform, passkeySupported?: boolean) => MockBridge;
|
|
33
|
+
export interface RenderWithAuthOptions {
|
|
34
|
+
bridge?: MockBridge;
|
|
35
|
+
/** Signed in at launch with this session; signed out (refresh refused) when absent. */
|
|
36
|
+
session?: ISessionAuthData;
|
|
37
|
+
language?: UserLanguage;
|
|
38
|
+
}
|
|
39
|
+
export interface RenderedWithAuth {
|
|
40
|
+
client: AuthClient;
|
|
41
|
+
bridge: MockBridge;
|
|
42
|
+
container: HTMLElement;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Renders inside the providers every host gives the auth screens: intl (commons messages), the
|
|
46
|
+
* Abyss dark theme, and an `AuthProvider` over a real auth client with a mocked bridge.
|
|
47
|
+
*/
|
|
48
|
+
export declare const renderWithAuth: (ui: ReactElement, options?: RenderWithAuthOptions) => RenderedWithAuth;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PropsWithChildren, Context } from 'react';
|
|
2
|
+
import { AuthClient, AuthState } from '../client/auth-client';
|
|
3
|
+
export interface AuthContextValue {
|
|
4
|
+
state: AuthState;
|
|
5
|
+
client: AuthClient;
|
|
6
|
+
}
|
|
7
|
+
export declare const AuthContext: Context<AuthContextValue | null>;
|
|
8
|
+
export type AuthProviderProps = PropsWithChildren<{
|
|
9
|
+
client: AuthClient;
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* Exposes the client and its state to `useAuth()`, and starts `client.bootstrap()` on mount
|
|
13
|
+
* (idempotent: a StrictMode double mount restores the session once).
|
|
14
|
+
*/
|
|
15
|
+
export declare const AuthProvider: ({ client, children }: AuthProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { a as e, A as R, R as _, b as s, c as S, s as r } from "./token-storage-D3e11ePD.js";
|
|
2
|
+
import { g as A, i as T, j as o, A as u, G as L, c as h, L as M, d as O, e as P, a as C, b as I, R as c, U as d, f as H, h as N, u as g } from "./use-auth.hook-B_TU5W3g.js";
|
|
3
|
+
export {
|
|
4
|
+
A as APPLE_ID_SCRIPT_URL,
|
|
5
|
+
e as AuthBridgeError,
|
|
6
|
+
R as AuthBridgeErrorCode,
|
|
7
|
+
T as AuthContext,
|
|
8
|
+
o as AuthProvider,
|
|
9
|
+
u as AuthStatus,
|
|
10
|
+
L as GOOGLE_IDENTITY_SCRIPT_URL,
|
|
11
|
+
h as LOST_RESPONSE_LATE_RETRIES_AT_MS,
|
|
12
|
+
M as LOST_RESPONSE_RETRY_DELAYS_MS,
|
|
13
|
+
O as REFRESH_ATTEMPT_TIMEOUT_MS,
|
|
14
|
+
P as REFRESH_LOCK_NAME,
|
|
15
|
+
C as REFRESH_MARGIN_MS,
|
|
16
|
+
I as REFRESH_REPLAY_GRACE_MS,
|
|
17
|
+
_ as REFRESH_TOKEN_STORAGE_KEY,
|
|
18
|
+
c as ReauthMethod,
|
|
19
|
+
d as UNREACHABLE_RETRY_MS,
|
|
20
|
+
H as createAuthClient,
|
|
21
|
+
s as createSecureTokenStorage,
|
|
22
|
+
N as createWebBridge,
|
|
23
|
+
S as createWebTokenStorage,
|
|
24
|
+
r as sha256Hex,
|
|
25
|
+
g as useAuth
|
|
26
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { C as d } from "./index-D7cgykJH.js";
|
|
2
|
+
import { SessionPlatform as l } from "@abyss-project/main";
|
|
3
|
+
import { A as r, a as i, b as g } from "./token-storage-D3e11ePD.js";
|
|
4
|
+
const p = () => new i(
|
|
5
|
+
r.UNSUPPORTED,
|
|
6
|
+
"Passkeys are not enabled in this app"
|
|
7
|
+
), y = Object.values(r), m = (e) => {
|
|
8
|
+
if (e instanceof i)
|
|
9
|
+
return e;
|
|
10
|
+
const t = e == null ? void 0 : e.code, a = e instanceof Error ? e.message : "Native authentication failed";
|
|
11
|
+
return typeof t == "string" && y.includes(t) ? new i(t, a, e) : new i(r.FAILED, a, e);
|
|
12
|
+
}, n = async (e) => {
|
|
13
|
+
try {
|
|
14
|
+
return await e();
|
|
15
|
+
} catch (t) {
|
|
16
|
+
throw m(t);
|
|
17
|
+
}
|
|
18
|
+
}, f = (e) => ({
|
|
19
|
+
platform: e.platform,
|
|
20
|
+
passkeySupported: () => n(async () => {
|
|
21
|
+
if (!e.passkeys)
|
|
22
|
+
return !1;
|
|
23
|
+
const t = await e.loadPlugin(), { supported: a } = await t.isPasskeySupported();
|
|
24
|
+
return a;
|
|
25
|
+
}),
|
|
26
|
+
getPasskey: (t, a = !1) => n(async () => {
|
|
27
|
+
if (!e.passkeys)
|
|
28
|
+
throw p();
|
|
29
|
+
const s = await e.loadPlugin(), { responseJson: c } = await s.getPasskey({
|
|
30
|
+
optionsJson: JSON.stringify(t),
|
|
31
|
+
preferImmediatelyAvailable: a
|
|
32
|
+
});
|
|
33
|
+
return JSON.parse(c);
|
|
34
|
+
}),
|
|
35
|
+
createPasskey: (t) => n(async () => {
|
|
36
|
+
if (!e.passkeys)
|
|
37
|
+
throw p();
|
|
38
|
+
const a = await e.loadPlugin(), { responseJson: s } = await a.createPasskey({
|
|
39
|
+
optionsJson: JSON.stringify(t)
|
|
40
|
+
});
|
|
41
|
+
return JSON.parse(s);
|
|
42
|
+
}),
|
|
43
|
+
google: (t) => n(async () => {
|
|
44
|
+
const a = await e.loadPlugin(), { idToken: s } = await a.signInWithGoogle({
|
|
45
|
+
serverClientId: e.googleServerClientId,
|
|
46
|
+
nonce: t
|
|
47
|
+
});
|
|
48
|
+
return { idToken: s };
|
|
49
|
+
}),
|
|
50
|
+
// The plugin hands Apple the SHA-256 of the raw nonce itself (README of the plugin).
|
|
51
|
+
apple: (t) => n(async () => {
|
|
52
|
+
const s = await (await e.loadPlugin()).signInWithApple({ nonce: t });
|
|
53
|
+
return {
|
|
54
|
+
idToken: s.idToken,
|
|
55
|
+
...s.givenName ? { givenName: s.givenName } : {},
|
|
56
|
+
...s.familyName ? { familyName: s.familyName } : {}
|
|
57
|
+
};
|
|
58
|
+
})
|
|
59
|
+
}), w = (e) => e;
|
|
60
|
+
let o = null;
|
|
61
|
+
const u = () => (o || (o = import("@abyss-project/capacitor-auth").then(
|
|
62
|
+
(e) => w(e.AbyssAuth),
|
|
63
|
+
(e) => {
|
|
64
|
+
throw o = null, e;
|
|
65
|
+
}
|
|
66
|
+
)), o), k = () => {
|
|
67
|
+
const e = d.getPlatform();
|
|
68
|
+
if (e === "ios")
|
|
69
|
+
return l.IOS;
|
|
70
|
+
if (e === "android")
|
|
71
|
+
return l.ANDROID;
|
|
72
|
+
throw new Error(
|
|
73
|
+
`The Capacitor auth bridge needs iOS or Android, not "${e}"`
|
|
74
|
+
);
|
|
75
|
+
}, N = (e) => f({
|
|
76
|
+
platform: k(),
|
|
77
|
+
googleServerClientId: e.googleServerClientId,
|
|
78
|
+
passkeys: e.nativePasskeys ?? !1,
|
|
79
|
+
loadPlugin: u
|
|
80
|
+
}), v = () => g(u);
|
|
81
|
+
export {
|
|
82
|
+
N as createCapacitorBridge,
|
|
83
|
+
v as createCapacitorTokenStorage
|
|
84
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { AbyssLayoutStore, AbyssLayoutState } from './abyss-layout.store';
|
|
3
|
-
import { UseBoundStore } from 'zustand
|
|
4
|
-
import { StoreApi } from 'zustand';
|
|
3
|
+
import { UseBoundStore, StoreApi } from 'zustand';
|
|
5
4
|
import { PersistOptions } from 'zustand/middleware';
|
|
6
5
|
type Props = {
|
|
7
6
|
store: AbyssLayoutStore;
|
|
@@ -14,7 +13,7 @@ export declare const useAbyssLayoutStore: () => UseBoundStore<Omit< StoreApi<Aby
|
|
|
14
13
|
sidebarCollapsed: boolean;
|
|
15
14
|
}>>) => void;
|
|
16
15
|
clearStorage: () => void;
|
|
17
|
-
rehydrate: () => void |
|
|
16
|
+
rehydrate: () => Promise<void> | void;
|
|
18
17
|
hasHydrated: () => boolean;
|
|
19
18
|
onHydrate: (fn: (state: AbyssLayoutState) => void) => () => void;
|
|
20
19
|
onFinishHydration: (fn: (state: AbyssLayoutState) => void) => () => void;
|
|
@@ -16,7 +16,7 @@ export declare const createAbyssLayoutStore: (persistKey: string) => UseBoundSto
|
|
|
16
16
|
sidebarCollapsed: boolean;
|
|
17
17
|
}>>) => void;
|
|
18
18
|
clearStorage: () => void;
|
|
19
|
-
rehydrate: () => void |
|
|
19
|
+
rehydrate: () => Promise<void> | void;
|
|
20
20
|
hasHydrated: () => boolean;
|
|
21
21
|
onHydrate: (fn: (state: AbyssLayoutState) => void) => () => void;
|
|
22
22
|
onFinishHydration: (fn: (state: AbyssLayoutState) => void) => () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/cookie-consent.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as s, c as a, C as n, a as C, D as i, R as t, V as r, d as A, f as k, r as c, e as l, u as D, b as E, w as I } from "./CookieConsentSettings.component-
|
|
1
|
+
import { A as s, c as a, C as n, a as C, D as i, R as t, V as r, d as A, f as k, r as c, e as l, u as D, b as E, w as I } from "./CookieConsentSettings.component-B06_BnQP.js";
|
|
2
2
|
export {
|
|
3
3
|
s as AbyssCookieConsentProvider,
|
|
4
4
|
a as COOKIE_NAME,
|