@passflow/react 0.15.1 → 0.17.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/CHANGELOG.md +39 -0
- package/README.md +94 -12
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +133 -143
- package/dist/index.es.js.map +1 -1
- package/dist/src/components/flow/index.d.cts +1 -1
- package/dist/src/components/flow/index.d.ts +1 -1
- package/dist/src/components/flow/index.d.ts.map +1 -1
- package/dist/src/components/flow/passflow/flow-router.d.cts +39 -0
- package/dist/src/components/flow/passflow/flow-router.d.ts +39 -0
- package/dist/src/components/flow/passflow/flow-router.d.ts.map +1 -0
- package/dist/src/components/flow/passflow/index.d.cts +25 -3
- package/dist/src/components/flow/passflow/index.d.ts +25 -3
- package/dist/src/components/flow/passflow/index.d.ts.map +1 -1
- package/dist/src/components/flow/two-factor-setup-magic-link/index.d.cts +6 -1
- package/dist/src/components/flow/two-factor-setup-magic-link/index.d.ts +6 -1
- package/dist/src/components/flow/two-factor-setup-magic-link/index.d.ts.map +1 -1
- package/dist/src/components/form/forgot-password/forgot-password.d.ts.map +1 -1
- package/dist/src/components/form/invitation-join/index.d.ts.map +1 -1
- package/dist/src/components/form/signin/index.d.ts.map +1 -1
- package/dist/src/components/form/signup/index.d.ts.map +1 -1
- package/dist/src/components/provider/passflow-provider.d.ts.map +1 -1
- package/dist/src/components/provider/use-dispose-on-replace.d.cts +17 -0
- package/dist/src/components/provider/use-dispose-on-replace.d.ts +17 -0
- package/dist/src/components/provider/use-dispose-on-replace.d.ts.map +1 -0
- package/dist/src/context/auth-context.d.cts +5 -4
- package/dist/src/context/auth-context.d.ts +5 -4
- package/dist/src/context/auth-context.d.ts.map +1 -1
- package/dist/src/context/index.d.cts +1 -0
- package/dist/src/context/index.d.ts +1 -0
- package/dist/src/context/index.d.ts.map +1 -1
- package/dist/src/context/search-context.d.cts +20 -0
- package/dist/src/context/search-context.d.ts +20 -0
- package/dist/src/context/search-context.d.ts.map +1 -0
- package/dist/src/hooks/index.d.cts +2 -1
- package/dist/src/hooks/index.d.ts +2 -1
- package/dist/src/hooks/index.d.ts.map +1 -1
- package/dist/src/hooks/use-refresh-status.d.cts +36 -0
- package/dist/src/hooks/use-refresh-status.d.ts +36 -0
- package/dist/src/hooks/use-refresh-status.d.ts.map +1 -0
- package/dist/src/hooks/use-session-expired.d.cts +8 -4
- package/dist/src/hooks/use-session-expired.d.ts +8 -4
- package/dist/src/hooks/use-session-expired.d.ts.map +1 -1
- package/dist/src/utils/url-params.d.cts +2 -4
- package/dist/src/utils/url-params.d.ts +2 -4
- package/dist/src/utils/url-params.d.ts.map +1 -1
- package/package.json +6 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ConsentFlow } from './consent/index.cjs';
|
|
2
2
|
export { DeviceVerifyFlow } from './device-verify/index.cjs';
|
|
3
|
-
export { PassflowFlow, type PassflowProps } from './passflow/index.cjs';
|
|
3
|
+
export { PassflowFlow, type PassflowFlowLocation, type PassflowFlowNavigate, type PassflowProps } from './passflow/index.cjs';
|
|
4
4
|
export { TwoFactorSetupMagicLinkFlow, type TwoFactorSetupMagicLinkFlowProps } from './two-factor-setup-magic-link/index.cjs';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ConsentFlow } from './consent/index.js';
|
|
2
2
|
export { DeviceVerifyFlow } from './device-verify/index.js';
|
|
3
|
-
export { PassflowFlow, type PassflowProps } from './passflow/index.js';
|
|
3
|
+
export { PassflowFlow, type PassflowFlowLocation, type PassflowFlowNavigate, type PassflowProps } from './passflow/index.js';
|
|
4
4
|
export { TwoFactorSetupMagicLinkFlow, type TwoFactorSetupMagicLinkFlowProps } from './two-factor-setup-magic-link/index.js';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/flow/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/flow/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,KAAK,oBAAoB,EAAE,KAAK,oBAAoB,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AACpH,OAAO,EAAE,2BAA2B,EAAE,KAAK,gCAAgC,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export type FlowLocation = {
|
|
2
|
+
pathname: string;
|
|
3
|
+
search: string;
|
|
4
|
+
};
|
|
5
|
+
export type FlowNavigateOptions = {
|
|
6
|
+
replace: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type FlowNavigate = (location: FlowLocation, options: FlowNavigateOptions) => void;
|
|
9
|
+
export type FlowHistory = {
|
|
10
|
+
/** The current location. Returns the same object until the location changes. */
|
|
11
|
+
read: () => FlowLocation;
|
|
12
|
+
subscribe: (listener: () => void) => () => void;
|
|
13
|
+
navigate: FlowNavigate;
|
|
14
|
+
};
|
|
15
|
+
/** The screens PassflowFlow renders, keyed as in `routes`. */
|
|
16
|
+
export declare const FLOW_SCREENS: readonly ["signin", "signup", "verify_otp", "verify_magic_link", "forgot_password", "forgot_password_success", "reset_password", "invitation", "two_factor_verify", "two_factor_setup", "two_factor_setup_magic_link"];
|
|
17
|
+
export type FlowScreen = (typeof FLOW_SCREENS)[number];
|
|
18
|
+
export type FlowMatch = {
|
|
19
|
+
screen: FlowScreen;
|
|
20
|
+
params: Record<string, string>;
|
|
21
|
+
};
|
|
22
|
+
/** `'/auth/'` → `'/auth'`, `'auth'` → `'/auth'`, `'/'` or `''` → `''`. */
|
|
23
|
+
export declare const normalizePrefix: (prefix: string | undefined) => string;
|
|
24
|
+
/** The screen at `pathname` under `prefix`, or null when the path is not one of the flow's screens. */
|
|
25
|
+
export declare const matchScreen: (pathname: string, prefix: string) => FlowMatch | null;
|
|
26
|
+
/**
|
|
27
|
+
* Where the flow is mounted, worked out from the first URL it sees: the part in
|
|
28
|
+
* front of a screen path (`/auth/signin` → `/auth`), or the whole path when it
|
|
29
|
+
* names no screen (`/auth` → `/auth`, `/` → `''`).
|
|
30
|
+
*/
|
|
31
|
+
export declare const detectPrefix: (pathname: string) => string;
|
|
32
|
+
/** The absolute path of a screen under `prefix`; `params` fill `:name` segments. */
|
|
33
|
+
export declare const screenPath: (screen: FlowScreen, prefix: string, params?: Record<string, string>) => string;
|
|
34
|
+
export declare const isUnderPrefix: (pathname: string, prefix: string) => boolean;
|
|
35
|
+
export declare const withQuestionMark: (search: string) => string;
|
|
36
|
+
export declare const createBrowserHistory: () => FlowHistory;
|
|
37
|
+
export declare const createHashHistory: () => FlowHistory;
|
|
38
|
+
export declare const createMemoryHistory: (initial?: FlowLocation) => FlowHistory;
|
|
39
|
+
//# sourceMappingURL=flow-router.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export type FlowLocation = {
|
|
2
|
+
pathname: string;
|
|
3
|
+
search: string;
|
|
4
|
+
};
|
|
5
|
+
export type FlowNavigateOptions = {
|
|
6
|
+
replace: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type FlowNavigate = (location: FlowLocation, options: FlowNavigateOptions) => void;
|
|
9
|
+
export type FlowHistory = {
|
|
10
|
+
/** The current location. Returns the same object until the location changes. */
|
|
11
|
+
read: () => FlowLocation;
|
|
12
|
+
subscribe: (listener: () => void) => () => void;
|
|
13
|
+
navigate: FlowNavigate;
|
|
14
|
+
};
|
|
15
|
+
/** The screens PassflowFlow renders, keyed as in `routes`. */
|
|
16
|
+
export declare const FLOW_SCREENS: readonly ["signin", "signup", "verify_otp", "verify_magic_link", "forgot_password", "forgot_password_success", "reset_password", "invitation", "two_factor_verify", "two_factor_setup", "two_factor_setup_magic_link"];
|
|
17
|
+
export type FlowScreen = (typeof FLOW_SCREENS)[number];
|
|
18
|
+
export type FlowMatch = {
|
|
19
|
+
screen: FlowScreen;
|
|
20
|
+
params: Record<string, string>;
|
|
21
|
+
};
|
|
22
|
+
/** `'/auth/'` → `'/auth'`, `'auth'` → `'/auth'`, `'/'` or `''` → `''`. */
|
|
23
|
+
export declare const normalizePrefix: (prefix: string | undefined) => string;
|
|
24
|
+
/** The screen at `pathname` under `prefix`, or null when the path is not one of the flow's screens. */
|
|
25
|
+
export declare const matchScreen: (pathname: string, prefix: string) => FlowMatch | null;
|
|
26
|
+
/**
|
|
27
|
+
* Where the flow is mounted, worked out from the first URL it sees: the part in
|
|
28
|
+
* front of a screen path (`/auth/signin` → `/auth`), or the whole path when it
|
|
29
|
+
* names no screen (`/auth` → `/auth`, `/` → `''`).
|
|
30
|
+
*/
|
|
31
|
+
export declare const detectPrefix: (pathname: string) => string;
|
|
32
|
+
/** The absolute path of a screen under `prefix`; `params` fill `:name` segments. */
|
|
33
|
+
export declare const screenPath: (screen: FlowScreen, prefix: string, params?: Record<string, string>) => string;
|
|
34
|
+
export declare const isUnderPrefix: (pathname: string, prefix: string) => boolean;
|
|
35
|
+
export declare const withQuestionMark: (search: string) => string;
|
|
36
|
+
export declare const createBrowserHistory: () => FlowHistory;
|
|
37
|
+
export declare const createHashHistory: () => FlowHistory;
|
|
38
|
+
export declare const createMemoryHistory: (initial?: FlowLocation) => FlowHistory;
|
|
39
|
+
//# sourceMappingURL=flow-router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-router.d.ts","sourceRoot":"","sources":["../../../../../src/components/flow/passflow/flow-router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M,WAAgE,CAAC;AAsBhH,eAAO,MAAM,oBAAoB,QAAO,WAWtC,CAAC;AASH,eAAO,MAAM,iBAAiB,QAAO,WASnC,CAAC;AAEH,eAAO,MAAM,mBAAmB,aAAa,YAAY,KAAmC,WAgB3F,CAAC"}
|
|
@@ -1,16 +1,38 @@
|
|
|
1
1
|
import type { SuccessAuthRedirect } from '../../../types/index.cjs';
|
|
2
|
-
|
|
2
|
+
import { type FlowLocation, type FlowNavigate } from './flow-router.cjs';
|
|
3
|
+
export type { FlowLocation as PassflowFlowLocation, FlowNavigate as PassflowFlowNavigate } from './flow-router.cjs';
|
|
4
|
+
type PassflowBaseProps = {
|
|
3
5
|
successAuthRedirect?: SuccessAuthRedirect;
|
|
4
6
|
federatedDisplayMode?: 'modal' | 'redirect';
|
|
5
7
|
error?: string;
|
|
6
8
|
relyingPartyId?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Where the flow is mounted, such as `/auth`: its screens are then `/auth/signin`,
|
|
11
|
+
* `/auth/signup`, and so on. Leave it out and the flow works it out from the first
|
|
12
|
+
* URL it sees (`/auth/signin` or `/auth` → `/auth`; `/` → none).
|
|
13
|
+
*/
|
|
7
14
|
pathPrefix?: string;
|
|
8
15
|
/**
|
|
9
|
-
* The
|
|
10
|
-
*
|
|
16
|
+
* The history the flow keeps when the app does not pass `location`. `browser`
|
|
17
|
+
* (the default) uses the address bar, on its own or inside the app's router;
|
|
18
|
+
* `hash` keeps the flow's path after `#`; `memory` leaves the URL alone.
|
|
11
19
|
*/
|
|
12
20
|
routerType?: 'browser' | 'hash' | 'memory';
|
|
21
|
+
/** @deprecated Never had an effect. Use `pathPrefix`. */
|
|
13
22
|
basename?: string;
|
|
14
23
|
};
|
|
24
|
+
export type PassflowProps = PassflowBaseProps & ({
|
|
25
|
+
location?: undefined;
|
|
26
|
+
navigate?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
/**
|
|
29
|
+
* Full control: the app's router owns the location. Pass its current
|
|
30
|
+
* `{ pathname, search }` and a `navigate` that moves it; `routerType` is then
|
|
31
|
+
* not used. Not needed for an app router in browser mode, which the default
|
|
32
|
+
* already follows.
|
|
33
|
+
*/
|
|
34
|
+
location: FlowLocation;
|
|
35
|
+
navigate: FlowNavigate;
|
|
36
|
+
});
|
|
15
37
|
export declare const PassflowFlow: (props: PassflowProps) => import("react").JSX.Element | null;
|
|
16
38
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,16 +1,38 @@
|
|
|
1
1
|
import type { SuccessAuthRedirect } from '../../../types/index.js';
|
|
2
|
-
|
|
2
|
+
import { type FlowLocation, type FlowNavigate } from './flow-router.js';
|
|
3
|
+
export type { FlowLocation as PassflowFlowLocation, FlowNavigate as PassflowFlowNavigate } from './flow-router.js';
|
|
4
|
+
type PassflowBaseProps = {
|
|
3
5
|
successAuthRedirect?: SuccessAuthRedirect;
|
|
4
6
|
federatedDisplayMode?: 'modal' | 'redirect';
|
|
5
7
|
error?: string;
|
|
6
8
|
relyingPartyId?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Where the flow is mounted, such as `/auth`: its screens are then `/auth/signin`,
|
|
11
|
+
* `/auth/signup`, and so on. Leave it out and the flow works it out from the first
|
|
12
|
+
* URL it sees (`/auth/signin` or `/auth` → `/auth`; `/` → none).
|
|
13
|
+
*/
|
|
7
14
|
pathPrefix?: string;
|
|
8
15
|
/**
|
|
9
|
-
* The
|
|
10
|
-
*
|
|
16
|
+
* The history the flow keeps when the app does not pass `location`. `browser`
|
|
17
|
+
* (the default) uses the address bar, on its own or inside the app's router;
|
|
18
|
+
* `hash` keeps the flow's path after `#`; `memory` leaves the URL alone.
|
|
11
19
|
*/
|
|
12
20
|
routerType?: 'browser' | 'hash' | 'memory';
|
|
21
|
+
/** @deprecated Never had an effect. Use `pathPrefix`. */
|
|
13
22
|
basename?: string;
|
|
14
23
|
};
|
|
24
|
+
export type PassflowProps = PassflowBaseProps & ({
|
|
25
|
+
location?: undefined;
|
|
26
|
+
navigate?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
/**
|
|
29
|
+
* Full control: the app's router owns the location. Pass its current
|
|
30
|
+
* `{ pathname, search }` and a `navigate` that moves it; `routerType` is then
|
|
31
|
+
* not used. Not needed for an app router in browser mode, which the default
|
|
32
|
+
* already follows.
|
|
33
|
+
*/
|
|
34
|
+
location: FlowLocation;
|
|
35
|
+
navigate: FlowNavigate;
|
|
36
|
+
});
|
|
15
37
|
export declare const PassflowFlow: (props: PassflowProps) => import("react").JSX.Element | null;
|
|
16
38
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/flow/passflow/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/flow/passflow/index.tsx"],"names":[],"mappings":"AAeA,OAAO,oBAAoB,CAAC;AAI5B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,OAAO,EAOL,KAAK,YAAY,EAEjB,KAAK,YAAY,EAOlB,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,YAAY,IAAI,oBAAoB,EAAE,YAAY,IAAI,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAEhH,KAAK,iBAAiB,GAAG;IACvB,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,oBAAoB,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC3C,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAC3C,CACI;IACE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,GACD;IACE;;;;;OAKG;IACH,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,EAAE,YAAY,CAAC;CACxB,CACJ,CAAC;AAuOJ,eAAO,MAAM,YAAY,8DAA6C,CAAC"}
|
|
@@ -8,6 +8,11 @@ type MagicLinkError = NonNullable<UseTwoFactorSetupMagicLinkReturn['error']>;
|
|
|
8
8
|
* Props for TwoFactorSetupMagicLinkFlow component
|
|
9
9
|
*/
|
|
10
10
|
export type TwoFactorSetupMagicLinkFlowProps = {
|
|
11
|
+
/**
|
|
12
|
+
* The magic-link token. Leave it out and it is read from the URL: the path
|
|
13
|
+
* segment after `/two-factor-setup-magic-link/` (or the same after `#`).
|
|
14
|
+
*/
|
|
15
|
+
token?: string;
|
|
11
16
|
/** Callback after successful setup */
|
|
12
17
|
onSuccess?: () => void;
|
|
13
18
|
/** Callback on validation error */
|
|
@@ -21,7 +26,7 @@ export type TwoFactorSetupMagicLinkFlowProps = {
|
|
|
21
26
|
* Flow component for magic link 2FA setup
|
|
22
27
|
*
|
|
23
28
|
* This component:
|
|
24
|
-
* 1.
|
|
29
|
+
* 1. Takes the token from its `token` prop, or from the URL
|
|
25
30
|
* 2. Validates token via useTwoFactorSetupMagicLink hook
|
|
26
31
|
* 3. Shows loading state during validation
|
|
27
32
|
* 4. Shows error UI if validation fails
|
|
@@ -8,6 +8,11 @@ type MagicLinkError = NonNullable<UseTwoFactorSetupMagicLinkReturn['error']>;
|
|
|
8
8
|
* Props for TwoFactorSetupMagicLinkFlow component
|
|
9
9
|
*/
|
|
10
10
|
export type TwoFactorSetupMagicLinkFlowProps = {
|
|
11
|
+
/**
|
|
12
|
+
* The magic-link token. Leave it out and it is read from the URL: the path
|
|
13
|
+
* segment after `/two-factor-setup-magic-link/` (or the same after `#`).
|
|
14
|
+
*/
|
|
15
|
+
token?: string;
|
|
11
16
|
/** Callback after successful setup */
|
|
12
17
|
onSuccess?: () => void;
|
|
13
18
|
/** Callback on validation error */
|
|
@@ -21,7 +26,7 @@ export type TwoFactorSetupMagicLinkFlowProps = {
|
|
|
21
26
|
* Flow component for magic link 2FA setup
|
|
22
27
|
*
|
|
23
28
|
* This component:
|
|
24
|
-
* 1.
|
|
29
|
+
* 1. Takes the token from its `token` prop, or from the URL
|
|
25
30
|
* 2. Validates token via useTwoFactorSetupMagicLink hook
|
|
26
31
|
* 3. Shows loading state during validation
|
|
27
32
|
* 4. Shows error UI if validation fails
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/flow/two-factor-setup-magic-link/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/flow/two-factor-setup-magic-link/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAMhC,OAAO,EAAE,KAAK,gCAAgC,EAA6C,MAAM,SAAS,CAAC;AAE3G,OAAO,oBAAoB,CAAC;AAE5B;;GAEG;AACH,KAAK,cAAc,GAAG,WAAW,CAAC,gCAAgC,CAAC,OAAO,CAAC,CAAC,CAAC;AAE7E;;GAEG;AACH,MAAM,MAAM,gCAAgC,GAAG;IAC7C;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,mCAAmC;IACnC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAC1C,sDAAsD;IACtD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAeF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,2BAA2B,EAAE,EAAE,CAAC,gCAAgC,CAuH5E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgot-password.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/forgot-password/forgot-password.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,EAAE,EAAW,MAAM,OAAO,CAAC;AASzC,OAAO,oBAAoB,CAAC;AAY5B,KAAK,eAAe,GAAG;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"forgot-password.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/forgot-password/forgot-password.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,EAAE,EAAW,MAAM,OAAO,CAAC;AASzC,OAAO,oBAAoB,CAAC;AAY5B,KAAK,eAAe,GAAG;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,eAAe,CAgM9C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/invitation-join/index.tsx"],"names":[],"mappings":"AASA,MAAM,MAAM,mBAAmB,GAAG;IAChC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/invitation-join/index.tsx"],"names":[],"mappings":"AASA,MAAM,MAAM,mBAAmB,GAAG;IAChC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AA4EF,eAAO,MAAM,cAAc,oEAAgD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/signin/index.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAQhC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAkDnD,MAAM,MAAM,OAAO,GAAG;IACpB,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/signin/index.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAQhC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAkDnD,MAAM,MAAM,OAAO,GAAG;IACpB,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,OAAO,CAyLlC,CAAC;AAEF,eAAO,MAAM,MAAM,wDAAwC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/signup/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAQhC,OAAO,KAAK,EAAiB,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAsDlE,MAAM,MAAM,OAAO,GAAG;IACpB,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/signup/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAQhC,OAAO,KAAK,EAAiB,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAsDlE,MAAM,MAAM,OAAO,GAAG;IACpB,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,OAAO,CAuKlC,CAAC;AAEF,eAAO,MAAM,MAAM,wDAAwC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passflow-provider.d.ts","sourceRoot":"","sources":["../../../../src/components/provider/passflow-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,cAAc,EAA2B,MAAM,gBAAgB,CAAC;AAC7G,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,SAAS,EAAiE,MAAM,OAAO,CAAC;AACtH,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"passflow-provider.d.ts","sourceRoot":"","sources":["../../../../src/components/provider/passflow-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,cAAc,EAA2B,MAAM,gBAAgB,CAAC;AAC7G,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,SAAS,EAAiE,MAAM,OAAO,CAAC;AACtH,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAGpG,OAAO,EAIL,KAAK,gBAAgB,EAIrB,KAAK,UAAU,EAEhB,MAAM,WAAW,CAAC;AAEnB,OAAO,oBAAoB,CAAC;AAE5B;;;;;;;GAOG;AACH,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,oBAAoB,EAAE,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC,CAAC;AAEpG,KAAK,qBAAqB,GAAG,cAAc,GAAG;IAC5C,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,MAAM,CAAC,E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,qBAAqB,CA0JtD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Passflow } from '@passflow/core';
|
|
2
|
+
type Disposable = Pick<Passflow, 'dispose'>;
|
|
3
|
+
/**
|
|
4
|
+
* Disposes a Passflow instance once it is replaced (a new `useMemo` value) or the
|
|
5
|
+
* provider unmounts. Each instance owns refresh timers, a BroadcastChannel and Web
|
|
6
|
+
* Locks; one left undisposed keeps acting as an extra tab.
|
|
7
|
+
*
|
|
8
|
+
* Why the dispose is deferred: React StrictMode runs effect cleanup and setup again
|
|
9
|
+
* for the same instance in one commit, while `useMemo` keeps that instance live. An
|
|
10
|
+
* immediate dispose in cleanup would kill the instance the app keeps using, and core
|
|
11
|
+
* forbids using an instance after `dispose()`. So cleanup only schedules the dispose
|
|
12
|
+
* (`setTimeout(0)`); a setup that sees the same instance cancels it. A different
|
|
13
|
+
* instance or a real unmount leaves the timer to fire.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useDisposeOnReplace(instance: Disposable): void;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=use-dispose-on-replace.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Passflow } from '@passflow/core';
|
|
2
|
+
type Disposable = Pick<Passflow, 'dispose'>;
|
|
3
|
+
/**
|
|
4
|
+
* Disposes a Passflow instance once it is replaced (a new `useMemo` value) or the
|
|
5
|
+
* provider unmounts. Each instance owns refresh timers, a BroadcastChannel and Web
|
|
6
|
+
* Locks; one left undisposed keeps acting as an extra tab.
|
|
7
|
+
*
|
|
8
|
+
* Why the dispose is deferred: React StrictMode runs effect cleanup and setup again
|
|
9
|
+
* for the same instance in one commit, while `useMemo` keeps that instance live. An
|
|
10
|
+
* immediate dispose in cleanup would kill the instance the app keeps using, and core
|
|
11
|
+
* forbids using an instance after `dispose()`. So cleanup only schedules the dispose
|
|
12
|
+
* (`setTimeout(0)`); a setup that sees the same instance cancels it. A different
|
|
13
|
+
* instance or a real unmount leaves the timer to fire.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useDisposeOnReplace(instance: Disposable): void;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=use-dispose-on-replace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-dispose-on-replace.d.ts","sourceRoot":"","sources":["../../../../src/components/provider/use-dispose-on-replace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C,KAAK,UAAU,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAO5C;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,UAAU,GAAG,IAAI,CAe9D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type ParsedTokens, type Tokens } from '@passflow/core';
|
|
1
|
+
import { type ParsedTokens, type SessionExpiredReason, type Tokens } from '@passflow/core';
|
|
2
2
|
import { type FC, type PropsWithChildren } from 'react';
|
|
3
|
-
export type SessionExpiredHandler = (reason:
|
|
3
|
+
export type SessionExpiredHandler = (reason: SessionExpiredReason) => void;
|
|
4
4
|
export type AuthContextValue = {
|
|
5
5
|
isAuthenticated: () => boolean;
|
|
6
6
|
logout: () => void;
|
|
@@ -14,8 +14,9 @@ export type AuthContextValue = {
|
|
|
14
14
|
export declare const AuthContext: import("react").Context<AuthContextValue | undefined>;
|
|
15
15
|
export type AuthProviderProps = PropsWithChildren<{
|
|
16
16
|
/**
|
|
17
|
-
* Called when the session
|
|
18
|
-
*
|
|
17
|
+
* Called when the session has really ended: last auth strike, no successor token pair
|
|
18
|
+
* in time, or another user's tokens in storage. A transient refresh failure keeps the
|
|
19
|
+
* session and does not call this. Use this to redirect to your login page.
|
|
19
20
|
*/
|
|
20
21
|
onSessionExpired?: SessionExpiredHandler;
|
|
21
22
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type ParsedTokens, type Tokens } from '@passflow/core';
|
|
1
|
+
import { type ParsedTokens, type SessionExpiredReason, type Tokens } from '@passflow/core';
|
|
2
2
|
import { type FC, type PropsWithChildren } from 'react';
|
|
3
|
-
export type SessionExpiredHandler = (reason:
|
|
3
|
+
export type SessionExpiredHandler = (reason: SessionExpiredReason) => void;
|
|
4
4
|
export type AuthContextValue = {
|
|
5
5
|
isAuthenticated: () => boolean;
|
|
6
6
|
logout: () => void;
|
|
@@ -14,8 +14,9 @@ export type AuthContextValue = {
|
|
|
14
14
|
export declare const AuthContext: import("react").Context<AuthContextValue | undefined>;
|
|
15
15
|
export type AuthProviderProps = PropsWithChildren<{
|
|
16
16
|
/**
|
|
17
|
-
* Called when the session
|
|
18
|
-
*
|
|
17
|
+
* Called when the session has really ended: last auth strike, no successor token pair
|
|
18
|
+
* in time, or another user's tokens in storage. A transient refresh failure keeps the
|
|
19
|
+
* session and does not call this. Use this to redirect to your login page.
|
|
19
20
|
*/
|
|
20
21
|
onSessionExpired?: SessionExpiredHandler;
|
|
21
22
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-context.d.ts","sourceRoot":"","sources":["../../../src/context/auth-context.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"auth-context.d.ts","sourceRoot":"","sources":["../../../src/context/auth-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAGjB,KAAK,oBAAoB,EACzB,KAAK,MAAM,EACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAiB,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAoC,MAAM,OAAO,CAAC;AAGzG,MAAM,MAAM,qBAAqB,GAAG,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;AAE3E,MAAM,MAAM,gBAAgB,GAAG;IAC7B,eAAe,EAAE,MAAM,OAAO,CAAC;IAC/B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,YAAY,EAAE,YAAY,GAAG,SAAS,CAAA;KAAE,CAAC,CAAC;CACpH,CAAC;AAEF,eAAO,MAAM,WAAW,uDAAyD,CAAC;AAElF,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;IAChD;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,qBAAqB,CAAC;CAC1C,CAAC,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAkE9C,CAAC"}
|
|
@@ -2,5 +2,6 @@ export * from './auth-context.cjs';
|
|
|
2
2
|
export * from './navigation-context.cjs';
|
|
3
3
|
export * from './passflow-context.cjs';
|
|
4
4
|
export * from './router-context.cjs';
|
|
5
|
+
export * from './search-context.cjs';
|
|
5
6
|
export * from './upgrade-context.cjs';
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -2,5 +2,6 @@ export * from './auth-context.js';
|
|
|
2
2
|
export * from './navigation-context.js';
|
|
3
3
|
export * from './passflow-context.js';
|
|
4
4
|
export * from './router-context.js';
|
|
5
|
+
export * from './search-context.js';
|
|
5
6
|
export * from './upgrade-context.js';
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/context/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/context/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the forms read and write their search params (`?challenge_id=…`).
|
|
3
|
+
*
|
|
4
|
+
* Outside PassflowFlow it is the address bar, as it always was. Inside, PassflowFlow
|
|
5
|
+
* provides its own location, so the forms see the right params when the flow keeps a
|
|
6
|
+
* memory or hash history, or is driven by an app router that does not use the address
|
|
7
|
+
* bar. In the default browser mode both are the same URL.
|
|
8
|
+
*/
|
|
9
|
+
export type SearchSource = {
|
|
10
|
+
/** The current search string, with its leading `?` or empty. */
|
|
11
|
+
read: () => string;
|
|
12
|
+
/** Moves to the same path with a new search string. */
|
|
13
|
+
write: (search: string, options: {
|
|
14
|
+
replace: boolean;
|
|
15
|
+
}) => void;
|
|
16
|
+
};
|
|
17
|
+
export declare const addressBarSearch: SearchSource;
|
|
18
|
+
export declare const SearchContext: import("react").Context<SearchSource>;
|
|
19
|
+
export declare const useSearchSource: () => SearchSource;
|
|
20
|
+
//# sourceMappingURL=search-context.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the forms read and write their search params (`?challenge_id=…`).
|
|
3
|
+
*
|
|
4
|
+
* Outside PassflowFlow it is the address bar, as it always was. Inside, PassflowFlow
|
|
5
|
+
* provides its own location, so the forms see the right params when the flow keeps a
|
|
6
|
+
* memory or hash history, or is driven by an app router that does not use the address
|
|
7
|
+
* bar. In the default browser mode both are the same URL.
|
|
8
|
+
*/
|
|
9
|
+
export type SearchSource = {
|
|
10
|
+
/** The current search string, with its leading `?` or empty. */
|
|
11
|
+
read: () => string;
|
|
12
|
+
/** Moves to the same path with a new search string. */
|
|
13
|
+
write: (search: string, options: {
|
|
14
|
+
replace: boolean;
|
|
15
|
+
}) => void;
|
|
16
|
+
};
|
|
17
|
+
export declare const addressBarSearch: SearchSource;
|
|
18
|
+
export declare const SearchContext: import("react").Context<SearchSource>;
|
|
19
|
+
export declare const useSearchSource: () => SearchSource;
|
|
20
|
+
//# sourceMappingURL=search-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-context.d.ts","sourceRoot":"","sources":["../../../src/context/search-context.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,gEAAgE;IAChE,IAAI,EAAE,MAAM,MAAM,CAAC;IACnB,uDAAuD;IACvD,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;CAChE,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,YAO9B,CAAC;AAEF,eAAO,MAAM,aAAa,uCAAgD,CAAC;AAE3E,eAAO,MAAM,eAAe,oBAAkC,CAAC"}
|
|
@@ -11,8 +11,9 @@ export { useOutsideClick } from './use-outsideclick.cjs';
|
|
|
11
11
|
export { usePassflow } from './use-passflow.cjs';
|
|
12
12
|
export { type UsePasswordlessCompleteProps, usePasswordlessComplete } from './use-passwordless-complete.cjs';
|
|
13
13
|
export { type UseProviderProps, useProvider } from './use-provider.cjs';
|
|
14
|
+
export { type UseRefreshStatusResult, useRefreshStatus } from './use-refresh-status.cjs';
|
|
14
15
|
export { type UseResetPasswordProps, useResetPassword } from './use-reset-password.cjs';
|
|
15
|
-
export { type
|
|
16
|
+
export { type UseSessionExpiredOptions, type UseSessionExpiredResult, useSessionExpired, } from './use-session-expired.cjs';
|
|
16
17
|
export { type UseSignInProps, useSignIn } from './use-signin.cjs';
|
|
17
18
|
export { type UseSignUpProps, useSignUp } from './use-signup.cjs';
|
|
18
19
|
export { type UseTrustedDevicesProps, useTrustedDevices } from './use-trusted-devices.cjs';
|
|
@@ -11,8 +11,9 @@ export { useOutsideClick } from './use-outsideclick.js';
|
|
|
11
11
|
export { usePassflow } from './use-passflow.js';
|
|
12
12
|
export { type UsePasswordlessCompleteProps, usePasswordlessComplete } from './use-passwordless-complete.js';
|
|
13
13
|
export { type UseProviderProps, useProvider } from './use-provider.js';
|
|
14
|
+
export { type UseRefreshStatusResult, useRefreshStatus } from './use-refresh-status.js';
|
|
14
15
|
export { type UseResetPasswordProps, useResetPassword } from './use-reset-password.js';
|
|
15
|
-
export { type
|
|
16
|
+
export { type UseSessionExpiredOptions, type UseSessionExpiredResult, useSessionExpired, } from './use-session-expired.js';
|
|
16
17
|
export { type UseSignInProps, useSignIn } from './use-signin.js';
|
|
17
18
|
export { type UseSignUpProps, useSignUp } from './use-signup.js';
|
|
18
19
|
export { type UseTrustedDevicesProps, useTrustedDevices } from './use-trusted-devices.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,UAAU,GACX,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,KAAK,cAAc,EAAE,SAAS,EAAE,MAA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AM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface UseRefreshStatusResult {
|
|
2
|
+
/**
|
|
3
|
+
* True inside a transient-failure episode: a token refresh failed for a reason that
|
|
4
|
+
* does not end the session (network, 5xx) and core is retrying. The session is kept.
|
|
5
|
+
*/
|
|
6
|
+
isFailing: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Epoch ms of the episode's first transient failure (`RefreshFailing.since`).
|
|
9
|
+
*/
|
|
10
|
+
since: number | null;
|
|
11
|
+
/**
|
|
12
|
+
* Epoch ms of the pending retry, when core knows it (`RefreshFailing.nextRetryAt`).
|
|
13
|
+
*/
|
|
14
|
+
nextRetryAt: number | null;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Hook to show a "connection trouble" notice while token refresh is failing transiently.
|
|
18
|
+
*
|
|
19
|
+
* Set by `RefreshFailing`; cleared by `RefreshRecovered`, and by `SessionExpired`,
|
|
20
|
+
* `SignOut`, `SignIn` and `Register`, which end or replace the session the episode
|
|
21
|
+
* belonged to. A real end of the session is reported by `useSessionExpired`, not here.
|
|
22
|
+
*
|
|
23
|
+
* Core reports the episode only as events (there is no getter to read on mount), so a
|
|
24
|
+
* component that mounts after `RefreshFailing` starts idle. Call the hook in a component
|
|
25
|
+
* that lives for the whole app, near `PassflowProvider`.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* function ConnectionNotice() {
|
|
30
|
+
* const { isFailing } = useRefreshStatus();
|
|
31
|
+
* return isFailing ? <Banner>Reconnecting...</Banner> : null;
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function useRefreshStatus(): UseRefreshStatusResult;
|
|
36
|
+
//# sourceMappingURL=use-refresh-status.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface UseRefreshStatusResult {
|
|
2
|
+
/**
|
|
3
|
+
* True inside a transient-failure episode: a token refresh failed for a reason that
|
|
4
|
+
* does not end the session (network, 5xx) and core is retrying. The session is kept.
|
|
5
|
+
*/
|
|
6
|
+
isFailing: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Epoch ms of the episode's first transient failure (`RefreshFailing.since`).
|
|
9
|
+
*/
|
|
10
|
+
since: number | null;
|
|
11
|
+
/**
|
|
12
|
+
* Epoch ms of the pending retry, when core knows it (`RefreshFailing.nextRetryAt`).
|
|
13
|
+
*/
|
|
14
|
+
nextRetryAt: number | null;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Hook to show a "connection trouble" notice while token refresh is failing transiently.
|
|
18
|
+
*
|
|
19
|
+
* Set by `RefreshFailing`; cleared by `RefreshRecovered`, and by `SessionExpired`,
|
|
20
|
+
* `SignOut`, `SignIn` and `Register`, which end or replace the session the episode
|
|
21
|
+
* belonged to. A real end of the session is reported by `useSessionExpired`, not here.
|
|
22
|
+
*
|
|
23
|
+
* Core reports the episode only as events (there is no getter to read on mount), so a
|
|
24
|
+
* component that mounts after `RefreshFailing` starts idle. Call the hook in a component
|
|
25
|
+
* that lives for the whole app, near `PassflowProvider`.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* function ConnectionNotice() {
|
|
30
|
+
* const { isFailing } = useRefreshStatus();
|
|
31
|
+
* return isFailing ? <Banner>Reconnecting...</Banner> : null;
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function useRefreshStatus(): UseRefreshStatusResult;
|
|
36
|
+
//# sourceMappingURL=use-refresh-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-refresh-status.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-refresh-status.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAaD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,IAAI,sBAAsB,CA4BzD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { type SessionExpiredReason } from '@passflow/core';
|
|
2
2
|
export interface UseSessionExpiredOptions {
|
|
3
3
|
/**
|
|
4
4
|
* Called when the session expires.
|
|
@@ -23,9 +23,13 @@ export interface UseSessionExpiredResult {
|
|
|
23
23
|
/**
|
|
24
24
|
* Hook to handle session expiration events.
|
|
25
25
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
26
|
+
* Core emits SessionExpired only when the session has really ended: the last
|
|
27
|
+
* auth strike (`'refresh_failed'`), no successor token pair in time
|
|
28
|
+
* (`'successor_timeout'`), or another user's tokens in storage
|
|
29
|
+
* (`'identity_changed'`). A transient refresh failure (network, 5xx) keeps the
|
|
30
|
+
* session and is reported as RefreshFailing / RefreshRecovered instead; see
|
|
31
|
+
* `useRefreshStatus`. This hook lets you react to the real end and redirect
|
|
32
|
+
* users to your login page.
|
|
29
33
|
*
|
|
30
34
|
* @example
|
|
31
35
|
* ```tsx
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { type SessionExpiredReason } from '@passflow/core';
|
|
2
2
|
export interface UseSessionExpiredOptions {
|
|
3
3
|
/**
|
|
4
4
|
* Called when the session expires.
|
|
@@ -23,9 +23,13 @@ export interface UseSessionExpiredResult {
|
|
|
23
23
|
/**
|
|
24
24
|
* Hook to handle session expiration events.
|
|
25
25
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
26
|
+
* Core emits SessionExpired only when the session has really ended: the last
|
|
27
|
+
* auth strike (`'refresh_failed'`), no successor token pair in time
|
|
28
|
+
* (`'successor_timeout'`), or another user's tokens in storage
|
|
29
|
+
* (`'identity_changed'`). A transient refresh failure (network, 5xx) keeps the
|
|
30
|
+
* session and is reported as RefreshFailing / RefreshRecovered instead; see
|
|
31
|
+
* `useRefreshStatus`. This hook lets you react to the real end and redirect
|
|
32
|
+
* users to your login page.
|
|
29
33
|
*
|
|
30
34
|
* @example
|
|
31
35
|
* ```tsx
|