@passflow/react 0.15.1 → 0.16.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.
Files changed (32) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +52 -12
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.es.js +133 -143
  6. package/dist/index.es.js.map +1 -1
  7. package/dist/src/components/flow/index.d.cts +1 -1
  8. package/dist/src/components/flow/index.d.ts +1 -1
  9. package/dist/src/components/flow/index.d.ts.map +1 -1
  10. package/dist/src/components/flow/passflow/flow-router.d.cts +39 -0
  11. package/dist/src/components/flow/passflow/flow-router.d.ts +39 -0
  12. package/dist/src/components/flow/passflow/flow-router.d.ts.map +1 -0
  13. package/dist/src/components/flow/passflow/index.d.cts +25 -3
  14. package/dist/src/components/flow/passflow/index.d.ts +25 -3
  15. package/dist/src/components/flow/passflow/index.d.ts.map +1 -1
  16. package/dist/src/components/flow/two-factor-setup-magic-link/index.d.cts +6 -1
  17. package/dist/src/components/flow/two-factor-setup-magic-link/index.d.ts +6 -1
  18. package/dist/src/components/flow/two-factor-setup-magic-link/index.d.ts.map +1 -1
  19. package/dist/src/components/form/forgot-password/forgot-password.d.ts.map +1 -1
  20. package/dist/src/components/form/invitation-join/index.d.ts.map +1 -1
  21. package/dist/src/components/form/signin/index.d.ts.map +1 -1
  22. package/dist/src/components/form/signup/index.d.ts.map +1 -1
  23. package/dist/src/context/index.d.cts +1 -0
  24. package/dist/src/context/index.d.ts +1 -0
  25. package/dist/src/context/index.d.ts.map +1 -1
  26. package/dist/src/context/search-context.d.cts +20 -0
  27. package/dist/src/context/search-context.d.ts +20 -0
  28. package/dist/src/context/search-context.d.ts.map +1 -0
  29. package/dist/src/utils/url-params.d.cts +2 -4
  30. package/dist/src/utils/url-params.d.ts +2 -4
  31. package/dist/src/utils/url-params.d.ts.map +1 -1
  32. package/package.json +5 -4
@@ -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;AAC9D,OAAO,EAAE,2BAA2B,EAAE,KAAK,gCAAgC,EAAE,MAAM,+BAA+B,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.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,YAAY,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAChE,MAAM,MAAM,mBAAmB,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AACvD,MAAM,MAAM,YAAY,GAAG,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;AAE1F,MAAM,MAAM,WAAW,GAAG;IACxB,gFAAgF;IAChF,IAAI,EAAE,MAAM,YAAY,CAAC;IACzB,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;IAChD,QAAQ,EAAE,YAAY,CAAC;CACxB,CAAC;AAEF,8DAA8D;AAC9D,eAAO,MAAM,YAAY,wNAY4B,CAAC;AAEtD,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,MAAM,MAAM,SAAS,GAAG;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC;AA4B/E,0EAA0E;AAC1E,eAAO,MAAM,eAAe,WAAY,MAAM,GAAG,SAAS,KAAG,MAG5D,CAAC;AAIF,uGAAuG;AACvG,eAAO,MAAM,WAAW,aAAc,MAAM,UAAU,MAAM,KAAG,SAAS,GAAG,IAW1E,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,aAAc,MAAM,KAAG,MAO/C,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,UAAU,WAAY,UAAU,UAAU,MAAM,WAAU,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAQ,MACc,CAAC;AAEpH,eAAO,MAAM,aAAa,aAAc,MAAM,UAAU,MAAM,YACa,CAAC;AAE5E,eAAO,MAAM,gBAAgB,WAAY,MAAM,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
- export type PassflowProps = {
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 router the flow creates for itself. Ignored when the flow is rendered
10
- * inside a host react-router `<Router>`: the flow then uses the host's router.
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
- export type PassflowProps = {
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 router the flow creates for itself. Ignored when the flow is rendered
10
- * inside a host react-router `<Router>`: the flow then uses the host's router.
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":"AAcA,OAAO,oBAAoB,CAAC;AAmB5B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGnD,MAAM,MAAM,aAAa,GAAG;IAC1B,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,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AA6OF,eAAO,MAAM,YAAY,8DAA6C,CAAC"}
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. Extracts token from URL params
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. Extracts token from URL params
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;AAOhC,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,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,CAsH5E,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,CA+L9C,CAAC"}
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;AA2EF,eAAO,MAAM,cAAc,oEAAgD,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,CAwLlC,CAAC;AAEF,eAAO,MAAM,MAAM,wDAAwC,CAAC"}
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,CAsKlC,CAAC;AAEF,eAAO,MAAM,MAAM,wDAAwC,CAAC"}
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"}
@@ -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"}
@@ -1,8 +1,6 @@
1
1
  /**
2
- * Utility for native handling of URL parameters
3
- */
4
- /**
5
- * Get URL parameters
2
+ * Get URL parameters. Inside PassflowFlow they come from the flow's location; outside it, from the
3
+ * address bar.
6
4
  * @param defaultValues Default values
7
5
  * @returns Object with methods getAll, get, set
8
6
  */
@@ -1,8 +1,6 @@
1
1
  /**
2
- * Utility for native handling of URL parameters
3
- */
4
- /**
5
- * Get URL parameters
2
+ * Get URL parameters. Inside PassflowFlow they come from the flow's location; outside it, from the
3
+ * address bar.
6
4
  * @param defaultValues Default values
7
5
  * @returns Object with methods getAll, get, set
8
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"url-params.d.ts","sourceRoot":"","sources":["../../../src/utils/url-params.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,kBAAkB,CAAC;;eAuC5D,MAAM;kBASH,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAoB5C,CAAC"}
1
+ {"version":3,"file":"url-params.d.ts","sourceRoot":"","sources":["../../../src/utils/url-params.ts"],"names":[],"mappings":"AAeA;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,kBAAkB,CAAC;;eAuC5D,MAAM;kBASH,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAmB5C,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@passflow/react",
3
3
  "description": "Passflow React UI Kit",
4
- "version": "0.15.1",
4
+ "version": "0.16.0",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
@@ -46,8 +46,7 @@
46
46
  },
47
47
  "peerDependencies": {
48
48
  "react": "^18.0.0 || ^19.0.0",
49
- "react-dom": "^18.0.0 || ^19.0.0",
50
- "react-router": "^7.0.0 || ^8.0.0"
49
+ "react-dom": "^18.0.0 || ^19.0.0"
51
50
  },
52
51
  "dependencies": {
53
52
  "@passflow/core": "^0.20.1",
@@ -73,6 +72,7 @@
73
72
  "@storybook/addon-docs": "10.6.5",
74
73
  "@storybook/addon-themes": "10.6.5",
75
74
  "@storybook/react-vite": "10.6.5",
75
+ "@tanstack/react-router": "^1.170.46",
76
76
  "@testing-library/jest-dom": "^7.0.1",
77
77
  "@testing-library/react": "^16.3.3",
78
78
  "@testing-library/user-event": "^14.6.8",
@@ -92,7 +92,8 @@
92
92
  "typescript": "7.0.2",
93
93
  "vite": "^8.3.5",
94
94
  "vite-plugin-environment": "^1.1.4",
95
- "vitest": "^5.0.5"
95
+ "vitest": "^5.0.5",
96
+ "wouter": "^3.13.0"
96
97
  },
97
98
  "authors": [
98
99
  {