@passflow/react 0.17.0 → 0.19.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 (101) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.es.js +154 -133
  5. package/dist/index.es.js.map +1 -1
  6. package/dist/src/components/flow/passflow/index.d.cts +7 -1
  7. package/dist/src/components/flow/passflow/index.d.ts +7 -1
  8. package/dist/src/components/flow/passflow/index.d.ts.map +1 -1
  9. package/dist/src/components/form/reset-password/index.d.cts +2 -0
  10. package/dist/src/components/form/reset-password/index.d.ts +2 -0
  11. package/dist/src/components/form/reset-password/index.d.ts.map +1 -1
  12. package/dist/src/components/form/signin/index.d.cts +2 -1
  13. package/dist/src/components/form/signin/index.d.ts +2 -1
  14. package/dist/src/components/form/signin/index.d.ts.map +1 -1
  15. package/dist/src/components/form/signup/index.d.cts +2 -1
  16. package/dist/src/components/form/signup/index.d.ts +2 -1
  17. package/dist/src/components/form/signup/index.d.ts.map +1 -1
  18. package/dist/src/components/form/verify-challenge/verify-challenge-approval.d.cts +13 -0
  19. package/dist/src/components/form/verify-challenge/verify-challenge-approval.d.ts +13 -0
  20. package/dist/src/components/form/verify-challenge/verify-challenge-approval.d.ts.map +1 -0
  21. package/dist/src/components/form/verify-challenge/verify-challenge-magic-link.d.cts +6 -1
  22. package/dist/src/components/form/verify-challenge/verify-challenge-magic-link.d.ts +6 -1
  23. package/dist/src/components/form/verify-challenge/verify-challenge-magic-link.d.ts.map +1 -1
  24. package/dist/src/components/form/verify-challenge/verify-challenge-otp.d.ts.map +1 -1
  25. package/dist/src/components/provider/passflow-provider.d.cts +5 -14
  26. package/dist/src/components/provider/passflow-provider.d.ts +5 -14
  27. package/dist/src/components/provider/passflow-provider.d.ts.map +1 -1
  28. package/dist/src/components/ui/button/index.d.ts.map +1 -1
  29. package/dist/src/components/ui/fields/field-otp.d.cts +3 -1
  30. package/dist/src/components/ui/fields/field-otp.d.ts +3 -1
  31. package/dist/src/components/ui/fields/field-otp.d.ts.map +1 -1
  32. package/dist/src/components/ui/login-screen/credentials.d.ts.map +1 -1
  33. package/dist/src/components/ui/login-screen/email-code.d.cts +25 -0
  34. package/dist/src/components/ui/login-screen/email-code.d.ts +25 -0
  35. package/dist/src/components/ui/login-screen/email-code.d.ts.map +1 -0
  36. package/dist/src/components/ui/login-screen/index.d.cts +1 -1
  37. package/dist/src/components/ui/login-screen/index.d.ts +1 -1
  38. package/dist/src/components/ui/login-screen/index.d.ts.map +1 -1
  39. package/dist/src/components/ui/login-screen/login-screen.d.ts.map +1 -1
  40. package/dist/src/components/ui/login-screen/new-password.d.cts +10 -0
  41. package/dist/src/components/ui/login-screen/new-password.d.ts +10 -0
  42. package/dist/src/components/ui/login-screen/new-password.d.ts.map +1 -0
  43. package/dist/src/components/ui/login-screen/passwordless-approval.d.cts +4 -0
  44. package/dist/src/components/ui/login-screen/passwordless-approval.d.ts +4 -0
  45. package/dist/src/components/ui/login-screen/passwordless-approval.d.ts.map +1 -0
  46. package/dist/src/components/ui/login-screen/passwordless-waiting.d.cts +4 -0
  47. package/dist/src/components/ui/login-screen/passwordless-waiting.d.ts +4 -0
  48. package/dist/src/components/ui/login-screen/passwordless-waiting.d.ts.map +1 -0
  49. package/dist/src/components/ui/login-screen/status.d.ts.map +1 -1
  50. package/dist/src/components/ui/login-screen/types.d.cts +107 -3
  51. package/dist/src/components/ui/login-screen/types.d.ts +107 -3
  52. package/dist/src/components/ui/login-screen/types.d.ts.map +1 -1
  53. package/dist/src/context/navigation-context.d.cts +3 -0
  54. package/dist/src/context/navigation-context.d.ts +3 -0
  55. package/dist/src/context/navigation-context.d.ts.map +1 -1
  56. package/dist/src/hooks/index.d.cts +1 -0
  57. package/dist/src/hooks/index.d.ts +1 -0
  58. package/dist/src/hooks/index.d.ts.map +1 -1
  59. package/dist/src/hooks/use-email-code-step.d.cts +39 -0
  60. package/dist/src/hooks/use-email-code-step.d.ts +39 -0
  61. package/dist/src/hooks/use-email-code-step.d.ts.map +1 -0
  62. package/dist/src/hooks/use-join-invite.d.ts.map +1 -1
  63. package/dist/src/hooks/use-provider.d.cts +2 -1
  64. package/dist/src/hooks/use-provider.d.ts +2 -1
  65. package/dist/src/hooks/use-provider.d.ts.map +1 -1
  66. package/dist/src/hooks/use-reset-password.d.cts +14 -1
  67. package/dist/src/hooks/use-reset-password.d.ts +14 -1
  68. package/dist/src/hooks/use-reset-password.d.ts.map +1 -1
  69. package/dist/src/hooks/use-signin.d.cts +6 -0
  70. package/dist/src/hooks/use-signin.d.ts +6 -0
  71. package/dist/src/hooks/use-signin.d.ts.map +1 -1
  72. package/dist/src/hooks/use-signup.d.cts +6 -0
  73. package/dist/src/hooks/use-signup.d.ts +6 -0
  74. package/dist/src/hooks/use-signup.d.ts.map +1 -1
  75. package/dist/src/index.d.cts +1 -0
  76. package/dist/src/index.d.ts +1 -0
  77. package/dist/src/index.d.ts.map +1 -1
  78. package/dist/src/types/auth-errors.d.cts +2 -0
  79. package/dist/src/types/auth-errors.d.ts +2 -0
  80. package/dist/src/types/auth-errors.d.ts.map +1 -1
  81. package/dist/src/types/email-verification.d.cts +18 -0
  82. package/dist/src/types/email-verification.d.ts +18 -0
  83. package/dist/src/types/email-verification.d.ts.map +1 -0
  84. package/dist/src/types/index.d.cts +2 -0
  85. package/dist/src/types/index.d.ts +2 -0
  86. package/dist/src/types/index.d.ts.map +1 -1
  87. package/dist/src/utils/auth-error.d.cts +77 -0
  88. package/dist/src/utils/auth-error.d.ts +77 -0
  89. package/dist/src/utils/auth-error.d.ts.map +1 -1
  90. package/dist/src/utils/email-verification.d.cts +44 -0
  91. package/dist/src/utils/email-verification.d.ts +44 -0
  92. package/dist/src/utils/email-verification.d.ts.map +1 -0
  93. package/dist/src/utils/get-url-errors.d.ts.map +1 -1
  94. package/dist/src/utils/index.d.cts +3 -2
  95. package/dist/src/utils/index.d.ts +3 -2
  96. package/dist/src/utils/index.d.ts.map +1 -1
  97. package/dist/src/utils/url-params.d.cts +17 -0
  98. package/dist/src/utils/url-params.d.ts +17 -0
  99. package/dist/src/utils/url-params.d.ts.map +1 -1
  100. package/dist/style.css +1 -1
  101. package/package.json +6 -3
@@ -1,11 +1,17 @@
1
1
  import type { PassflowPasskeyRegisterStartPayload, PassflowPasswordlessResponse, PassflowPasswordlessSignInPayload, PassflowSignUpPayload } from '@passflow/core';
2
2
  import type { AuthOperation, AuthUiError } from '../types/index.js';
3
+ import { type UseEmailCodeStep } from './use-email-code-step.js';
3
4
  export type UseSignUpProps = () => {
4
5
  fetch: (payload: PassflowPasskeyRegisterStartPayload | PassflowSignUpPayload | PassflowPasswordlessSignInPayload, type: AuthOperation) => Promise<boolean | string | PassflowPasswordlessResponse>;
5
6
  isLoading: boolean;
6
7
  isError: boolean;
7
8
  error: AuthUiError | null;
8
9
  reset: () => void;
10
+ /**
11
+ * The emailed-code step. A password request the server answers with a code (or a link) enters it, and `fetch`
12
+ * resolves `false`: there is no session yet.
13
+ */
14
+ emailCode: UseEmailCodeStep;
9
15
  };
10
16
  export declare const useSignUp: UseSignUpProps;
11
17
  //# sourceMappingURL=use-signup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-signup.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-signup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mCAAmC,EACnC,4BAA4B,EAC5B,iCAAiC,EACjC,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAI1D,MAAM,MAAM,cAAc,GAAG,MAAM;IACjC,KAAK,EAAE,CACL,OAAO,EAAE,mCAAmC,GAAG,qBAAqB,GAAG,iCAAiC,EACxG,IAAI,EAAE,aAAa,KAChB,OAAO,CAAC,OAAO,GAAG,MAAM,GAAG,4BAA4B,CAAC,CAAC;IAC9D,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;IAC1B,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,cA+CvB,CAAC"}
1
+ {"version":3,"file":"use-signup.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-signup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mCAAmC,EACnC,4BAA4B,EAC5B,iCAAiC,EACjC,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE1D,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,uBAAuB,CAAC;AAGhF,MAAM,MAAM,cAAc,GAAG,MAAM;IACjC,KAAK,EAAE,CACL,OAAO,EAAE,mCAAmC,GAAG,qBAAqB,GAAG,iCAAiC,EACxG,IAAI,EAAE,aAAa,KAChB,OAAO,CAAC,OAAO,GAAG,MAAM,GAAG,4BAA4B,CAAC,CAAC;IAC9D,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;IAC1B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB;;;OAGG;IACH,SAAS,EAAE,gBAAgB,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,cAwEvB,CAAC"}
@@ -6,5 +6,6 @@ export { PassflowProvider, UpgradeProvider } from './components/provider/index.c
6
6
  export * from './components/ui/index.cjs';
7
7
  export { INERT_UPGRADE_CONTEXT, UpgradeContext, type UpgradeContextValue, type UpgradeElevateOptions, type UpgradeErrorStatusKind, type UpgradeHookState, type UpgradePromptView, type UpgradeSettledState, } from './context/upgrade-context.cjs';
8
8
  export * from './hooks/index.cjs';
9
+ export type { EmailCodeStep, EmailVerificationStep } from './types/index.cjs';
9
10
  export { attachAuth, withAuth } from './utils/upgrade-auth.cjs';
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -6,5 +6,6 @@ export { PassflowProvider, UpgradeProvider } from './components/provider/index.j
6
6
  export * from './components/ui/index.js';
7
7
  export { INERT_UPGRADE_CONTEXT, UpgradeContext, type UpgradeContextValue, type UpgradeElevateOptions, type UpgradeErrorStatusKind, type UpgradeHookState, type UpgradePromptView, type UpgradeSettledState, } from './context/upgrade-context.js';
8
8
  export * from './hooks/index.js';
9
+ export type { EmailCodeStep, EmailVerificationStep } from './types/index.js';
9
10
  export { attachAuth, withAuth } from './utils/upgrade-auth.js';
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAC5B,OAAO,yBAAyB,CAAC;AAEjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,YAAY,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC1E,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,GACzB,MAAM,2BAA2B,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAC5B,OAAO,yBAAyB,CAAC;AAEjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,YAAY,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC1E,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,GACzB,MAAM,2BAA2B,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC"}
@@ -2,6 +2,8 @@ export type AuthErrorScope = 'form' | 'identity' | 'password' | 'credentials';
2
2
  export type AuthUiError = {
3
3
  message: string;
4
4
  scope: AuthErrorScope;
5
+ /** The request behind this form is gone, so the screen offers a full reload without its parent challenge. */
6
+ startAgain?: boolean;
5
7
  };
6
8
  export type AuthOperation = 'password' | 'passwordless' | 'passkey';
7
9
  export type AuthFlow = 'sign-in' | 'sign-up';
@@ -2,6 +2,8 @@ export type AuthErrorScope = 'form' | 'identity' | 'password' | 'credentials';
2
2
  export type AuthUiError = {
3
3
  message: string;
4
4
  scope: AuthErrorScope;
5
+ /** The request behind this form is gone, so the screen offers a full reload without its parent challenge. */
6
+ startAgain?: boolean;
5
7
  };
6
8
  export type AuthOperation = 'password' | 'passwordless' | 'passkey';
7
9
  export type AuthFlow = 'sign-in' | 'sign-up';
@@ -1 +1 @@
1
- {"version":3,"file":"auth-errors.d.ts","sourceRoot":"","sources":["../../../src/types/auth-errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,aAAa,CAAC;AAE9E,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,cAAc,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,cAAc,GAAG,SAAS,CAAC;AACpE,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC"}
1
+ {"version":3,"file":"auth-errors.d.ts","sourceRoot":"","sources":["../../../src/types/auth-errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,aAAa,CAAC;AAE9E,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,cAAc,CAAC;IACtB,6GAA6G;IAC7G,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,cAAc,GAAG,SAAS,CAAC;AACpE,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * What a sign-up, sign-in or password change answered instead of a session: `code` when a code was emailed
3
+ * (finish it with `verifyEmailCode`), `link` when a link was emailed instead (the sign-in finishes on that page).
4
+ * `message` is the server's text, or fixed copy when the server sent none.
5
+ */
6
+ export type EmailVerificationStep = {
7
+ kind: 'code';
8
+ challengeId: string;
9
+ message: string;
10
+ } | {
11
+ kind: 'link';
12
+ message: string;
13
+ };
14
+ /** The emailed-code step of a screen: `none` while the screen shows its own form. */
15
+ export type EmailCodeStep = {
16
+ kind: 'none';
17
+ } | EmailVerificationStep;
18
+ //# sourceMappingURL=email-verification.d.ts.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * What a sign-up, sign-in or password change answered instead of a session: `code` when a code was emailed
3
+ * (finish it with `verifyEmailCode`), `link` when a link was emailed instead (the sign-in finishes on that page).
4
+ * `message` is the server's text, or fixed copy when the server sent none.
5
+ */
6
+ export type EmailVerificationStep = {
7
+ kind: 'code';
8
+ challengeId: string;
9
+ message: string;
10
+ } | {
11
+ kind: 'link';
12
+ message: string;
13
+ };
14
+ /** The emailed-code step of a screen: `none` while the screen shows its own form. */
15
+ export type EmailCodeStep = {
16
+ kind: 'none';
17
+ } | EmailVerificationStep;
18
+ //# sourceMappingURL=email-verification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email-verification.d.ts","sourceRoot":"","sources":["../../../src/types/email-verification.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/H,qFAAqF;AACrF,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,qBAAqB,CAAC"}
@@ -2,9 +2,11 @@ export type PreferIdentity = 'identity' | 'phone' | 'none';
2
2
  export type DefaultMethod = 'email_or_username' | 'phone';
3
3
  export type PreferChallenge = 'passkey' | 'password' | 'otp' | 'magic_link';
4
4
  export type SuccessAuthRedirect = string;
5
+ export type FederatedLanding = 'app' | 'login-page';
5
6
  export type { RegisteredTwoFactorMethod, TwoFactorChallengeResponse, TwoFactorMethod, TwoFactorVerifyRequestV2, TwoFactorVerifyResponseV2, } from '@passflow/core';
6
7
  export type { AuthErrorScope, AuthFlow, AuthOperation, AuthUiError } from './auth-errors.cjs';
7
8
  export type { DeviceError, DeviceErrorType } from './device-errors.cjs';
9
+ export type { EmailCodeStep, EmailVerificationStep } from './email-verification.cjs';
8
10
  export type { TwoFactorError, TwoFactorErrorType } from './two-factor-errors.cjs';
9
11
  export interface UseTwoFactorChallengeReturn {
10
12
  challenge: import('@passflow/core').TwoFactorChallengeResponse | null;
@@ -2,9 +2,11 @@ export type PreferIdentity = 'identity' | 'phone' | 'none';
2
2
  export type DefaultMethod = 'email_or_username' | 'phone';
3
3
  export type PreferChallenge = 'passkey' | 'password' | 'otp' | 'magic_link';
4
4
  export type SuccessAuthRedirect = string;
5
+ export type FederatedLanding = 'app' | 'login-page';
5
6
  export type { RegisteredTwoFactorMethod, TwoFactorChallengeResponse, TwoFactorMethod, TwoFactorVerifyRequestV2, TwoFactorVerifyResponseV2, } from '@passflow/core';
6
7
  export type { AuthErrorScope, AuthFlow, AuthOperation, AuthUiError } from './auth-errors.js';
7
8
  export type { DeviceError, DeviceErrorType } from './device-errors.js';
9
+ export type { EmailCodeStep, EmailVerificationStep } from './email-verification.js';
8
10
  export type { TwoFactorError, TwoFactorErrorType } from './two-factor-errors.js';
9
11
  export interface UseTwoFactorChallengeReturn {
10
12
  challenge: import('@passflow/core').TwoFactorChallengeResponse | null;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;AAE3D,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,OAAO,CAAC;AAE1D,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,UAAU,GAAG,KAAK,GAAG,YAAY,CAAC;AAE5E,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAGzC,YAAY,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,eAAe,EACf,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1F,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACpE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG9E,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YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD"}
@@ -4,4 +4,81 @@ export declare const verificationLinkErrorMessage = "This verification link is i
4
4
  export declare const invitationLinkErrorMessage = "This invitation link is invalid or has expired.";
5
5
  export declare const verificationRequestErrorMessage = "This verification request is no longer available. Start again to request a new link or code.";
6
6
  export declare const authErrorFor: (flow: AuthFlow, operation: AuthOperation) => AuthUiError;
7
+ /**
8
+ * Server error ids whose `message` is written for the end user (localized, no operator detail) and may be shown as
9
+ * is. Every other id keeps the SDK's fixed copy, so server text that was not meant for a sign-in screen never reaches
10
+ * one. `error.not.found` is deliberately absent: it is a generic id across the API (its text can name a missing user).
11
+ */
12
+ export declare const SERVER_MESSAGE_ERROR_IDS: ReadonlySet<string>;
13
+ /**
14
+ * The server's own message for an allow-listed error id, trimmed; `null` for anything else. Duck-typed on
15
+ * `{ id, message }`, so it reads a `PassflowError`, a raw axios rejection's body, or a plain object such as a
16
+ * redirect's query.
17
+ */
18
+ export declare const serverMessageFor: (error: unknown) => string | null;
19
+ /** A hook's display error: a refused parent's copy, the server's message for an allow-listed id, else the operation's fixed copy. */
20
+ export declare const authErrorFrom: (error: unknown, flow: AuthFlow, operation: AuthOperation) => AuthUiError;
21
+ /**
22
+ * The message for a federated redirect that came back as `?error=<id>&message=<text>`: the server's text when the id
23
+ * is allow-listed, else the generic redirect copy.
24
+ */
25
+ export declare const authRedirectErrorFrom: (error: string, message: string | null) => string;
26
+ export declare const invitationJoinErrorMessage = "We couldn't accept this invitation. Try again.";
27
+ /** Invitation join error: the server's message for an allow-listed id, else the fixed copy. */
28
+ export declare const invitationJoinErrorFrom: (error: unknown) => string;
29
+ export declare const emailCodeInvalidMessage = "This code is no longer valid. Request a new code.";
30
+ export declare const emailCodeUnavailableMessage = "We couldn't check the code. Try again.";
31
+ export declare const emailCodeRestartMessage = "We couldn't verify the code. Go back and start again.";
32
+ /**
33
+ * Error copy for the emailed-code step (`/auth/validate`, resend): allow-listed ids (wrong, expired or spent code,
34
+ * rate limit, ...) show the server message; `error.not.found` (unknown or spent challenge) asks for a new code; a
35
+ * request that got no answer at all (offline, CORS, timeout) asks to retry; every other server answer (401, a missing
36
+ * PKCE verifier, an unlisted 4xx or a 5xx) asks to start again, and the screen keeps its way back to the form.
37
+ */
38
+ export declare const emailCodeErrorMessage: (error: unknown) => string;
39
+ export declare const passwordlessWaitDeniedMessage = "This sign-in was denied. Start again.";
40
+ export declare const passwordlessLinkExpiredMessage = "This link expired. Start again.";
41
+ export declare const passwordlessWaitCompletedMessage = "This sign-in was already used. Start again.";
42
+ export declare const passwordlessSignInFailedMessage = "Sign-in failed. Start again.";
43
+ export declare const approvalInvalidMessage = "This link is not valid. Start again from the page where you signed in.";
44
+ export declare const approvalUnavailableMessage = "This sign-in cannot be approved here. Start again.";
45
+ export declare const approvalAlreadyDecidedMessage = "This sign-in was already decided.";
46
+ export declare const approvalAttemptsMessage = "Too many wrong codes. This sign-in was denied. Start again.";
47
+ export declare const approvalConnectionMessage = "Check your connection and try again.";
48
+ export declare const approvalUnknownErrorMessage = "Something went wrong. Try again later.";
49
+ export declare const approvalApprovedMessage = "Approved. Return to the tab that started sign-in. You can close this tab.";
50
+ export declare const approvalDeniedMessage = "Denied. No one was signed in. You can close this tab.";
51
+ export type ApprovalError = {
52
+ message: string;
53
+ /** Nothing more can be done on this screen: the form goes away. */
54
+ terminal: boolean;
55
+ };
56
+ /** A wrong code on the approve screen: the tries left must be read again before showing the message. */
57
+ export declare const isApprovalMatchError: (error: unknown) => boolean;
58
+ /**
59
+ * Error copy for the approve screen. `attemptsLeft` is the count re-read after the rejection. A plain core error with
60
+ * no response body arrives as id `error.passwordless.approval`, status 0: nothing was decided, so the screen stays.
61
+ */
62
+ export declare const approvalErrorFrom: (error: unknown, attemptsLeft?: number) => ApprovalError;
63
+ /**
64
+ * A failed passwordless completion. A row that only another device can approve has its own copy. A failed exchange comes
65
+ * after the row was spent, so retrying cannot work, even with no response (id `error.pkce.exchange`, status 0). Core
66
+ * rejects a network failure or raw 429 on the completion itself as id `error.passwordless.complete`: the code was not
67
+ * refused, so the user can try again.
68
+ */
69
+ export declare const passwordlessCompleteErrorMessage: (error: unknown) => string;
70
+ export declare const resetLinkInvalidMessage = "This link is invalid or has expired. Request a new one.";
71
+ export declare const newPasswordUnavailableMessage = "We couldn't save your password. Try again.";
72
+ export declare const passwordSavedRateLimitedMessage = "Your password was saved, but we cannot send a verification code right now. Wait a few minutes, then sign in with your new password.";
73
+ /**
74
+ * A 429 from `/auth/password/change`: the password was already changed, only the emailed code that should follow
75
+ * was refused, so the screen must not ask for the password again.
76
+ */
77
+ export declare const isPasswordSavedRateLimit: (error: unknown) => boolean;
78
+ /**
79
+ * Error copy for the new-password screen (reset link or registration continuation): allow-listed ids show the server
80
+ * message; a refused or spent link (any other 4xx, an `error.token.*` id) asks for a new one; a server or network
81
+ * failure asks to retry. The raw message of anything else is never shown.
82
+ */
83
+ export declare const newPasswordErrorMessage: (error: unknown) => string;
7
84
  //# sourceMappingURL=auth-error.d.ts.map
@@ -4,4 +4,81 @@ export declare const verificationLinkErrorMessage = "This verification link is i
4
4
  export declare const invitationLinkErrorMessage = "This invitation link is invalid or has expired.";
5
5
  export declare const verificationRequestErrorMessage = "This verification request is no longer available. Start again to request a new link or code.";
6
6
  export declare const authErrorFor: (flow: AuthFlow, operation: AuthOperation) => AuthUiError;
7
+ /**
8
+ * Server error ids whose `message` is written for the end user (localized, no operator detail) and may be shown as
9
+ * is. Every other id keeps the SDK's fixed copy, so server text that was not meant for a sign-in screen never reaches
10
+ * one. `error.not.found` is deliberately absent: it is a generic id across the API (its text can name a missing user).
11
+ */
12
+ export declare const SERVER_MESSAGE_ERROR_IDS: ReadonlySet<string>;
13
+ /**
14
+ * The server's own message for an allow-listed error id, trimmed; `null` for anything else. Duck-typed on
15
+ * `{ id, message }`, so it reads a `PassflowError`, a raw axios rejection's body, or a plain object such as a
16
+ * redirect's query.
17
+ */
18
+ export declare const serverMessageFor: (error: unknown) => string | null;
19
+ /** A hook's display error: a refused parent's copy, the server's message for an allow-listed id, else the operation's fixed copy. */
20
+ export declare const authErrorFrom: (error: unknown, flow: AuthFlow, operation: AuthOperation) => AuthUiError;
21
+ /**
22
+ * The message for a federated redirect that came back as `?error=<id>&message=<text>`: the server's text when the id
23
+ * is allow-listed, else the generic redirect copy.
24
+ */
25
+ export declare const authRedirectErrorFrom: (error: string, message: string | null) => string;
26
+ export declare const invitationJoinErrorMessage = "We couldn't accept this invitation. Try again.";
27
+ /** Invitation join error: the server's message for an allow-listed id, else the fixed copy. */
28
+ export declare const invitationJoinErrorFrom: (error: unknown) => string;
29
+ export declare const emailCodeInvalidMessage = "This code is no longer valid. Request a new code.";
30
+ export declare const emailCodeUnavailableMessage = "We couldn't check the code. Try again.";
31
+ export declare const emailCodeRestartMessage = "We couldn't verify the code. Go back and start again.";
32
+ /**
33
+ * Error copy for the emailed-code step (`/auth/validate`, resend): allow-listed ids (wrong, expired or spent code,
34
+ * rate limit, ...) show the server message; `error.not.found` (unknown or spent challenge) asks for a new code; a
35
+ * request that got no answer at all (offline, CORS, timeout) asks to retry; every other server answer (401, a missing
36
+ * PKCE verifier, an unlisted 4xx or a 5xx) asks to start again, and the screen keeps its way back to the form.
37
+ */
38
+ export declare const emailCodeErrorMessage: (error: unknown) => string;
39
+ export declare const passwordlessWaitDeniedMessage = "This sign-in was denied. Start again.";
40
+ export declare const passwordlessLinkExpiredMessage = "This link expired. Start again.";
41
+ export declare const passwordlessWaitCompletedMessage = "This sign-in was already used. Start again.";
42
+ export declare const passwordlessSignInFailedMessage = "Sign-in failed. Start again.";
43
+ export declare const approvalInvalidMessage = "This link is not valid. Start again from the page where you signed in.";
44
+ export declare const approvalUnavailableMessage = "This sign-in cannot be approved here. Start again.";
45
+ export declare const approvalAlreadyDecidedMessage = "This sign-in was already decided.";
46
+ export declare const approvalAttemptsMessage = "Too many wrong codes. This sign-in was denied. Start again.";
47
+ export declare const approvalConnectionMessage = "Check your connection and try again.";
48
+ export declare const approvalUnknownErrorMessage = "Something went wrong. Try again later.";
49
+ export declare const approvalApprovedMessage = "Approved. Return to the tab that started sign-in. You can close this tab.";
50
+ export declare const approvalDeniedMessage = "Denied. No one was signed in. You can close this tab.";
51
+ export type ApprovalError = {
52
+ message: string;
53
+ /** Nothing more can be done on this screen: the form goes away. */
54
+ terminal: boolean;
55
+ };
56
+ /** A wrong code on the approve screen: the tries left must be read again before showing the message. */
57
+ export declare const isApprovalMatchError: (error: unknown) => boolean;
58
+ /**
59
+ * Error copy for the approve screen. `attemptsLeft` is the count re-read after the rejection. A plain core error with
60
+ * no response body arrives as id `error.passwordless.approval`, status 0: nothing was decided, so the screen stays.
61
+ */
62
+ export declare const approvalErrorFrom: (error: unknown, attemptsLeft?: number) => ApprovalError;
63
+ /**
64
+ * A failed passwordless completion. A row that only another device can approve has its own copy. A failed exchange comes
65
+ * after the row was spent, so retrying cannot work, even with no response (id `error.pkce.exchange`, status 0). Core
66
+ * rejects a network failure or raw 429 on the completion itself as id `error.passwordless.complete`: the code was not
67
+ * refused, so the user can try again.
68
+ */
69
+ export declare const passwordlessCompleteErrorMessage: (error: unknown) => string;
70
+ export declare const resetLinkInvalidMessage = "This link is invalid or has expired. Request a new one.";
71
+ export declare const newPasswordUnavailableMessage = "We couldn't save your password. Try again.";
72
+ export declare const passwordSavedRateLimitedMessage = "Your password was saved, but we cannot send a verification code right now. Wait a few minutes, then sign in with your new password.";
73
+ /**
74
+ * A 429 from `/auth/password/change`: the password was already changed, only the emailed code that should follow
75
+ * was refused, so the screen must not ask for the password again.
76
+ */
77
+ export declare const isPasswordSavedRateLimit: (error: unknown) => boolean;
78
+ /**
79
+ * Error copy for the new-password screen (reset link or registration continuation): allow-listed ids show the server
80
+ * message; a refused or spent link (any other 4xx, an `error.token.*` id) asks for a new one; a server or network
81
+ * failure asks to retry. The raw message of anything else is never shown.
82
+ */
83
+ export declare const newPasswordErrorMessage: (error: unknown) => string;
7
84
  //# sourceMappingURL=auth-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth-error.d.ts","sourceRoot":"","sources":["../../../src/utils/auth-error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAiCpE,eAAO,MAAM,wBAAwB,uFAAuF,CAAC;AAE7H,eAAO,MAAM,4BAA4B,+FACqD,CAAC;AAE/F,eAAO,MAAM,0BAA0B,oDAAoD,CAAC;AAE5F,eAAO,MAAM,+BAA+B,iGACoD,CAAC;AAEjG,eAAO,MAAM,YAAY,SAAU,QAAQ,aAAa,aAAa,KAAG,WAA+C,CAAC"}
1
+ {"version":3,"file":"auth-error.d.ts","sourceRoot":"","sources":["../../../src/utils/auth-error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAiCpE,eAAO,MAAM,wBAAwB,uFAAuF,CAAC;AAE7H,eAAO,MAAM,4BAA4B,+FACqD,CAAC;AAE/F,eAAO,MAAM,0BAA0B,oDAAoD,CAAC;AAE5F,eAAO,MAAM,+BAA+B,iGACoD,CAAC;AAEjG,eAAO,MAAM,YAAY,SAAU,QAAQ,aAAa,aAAa,KAAG,WAA+C,CAAC;AAExH;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,WAAW,CAAC,MAAM,CAavD,CAAC;AAkBH;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,UAAW,OAAO,KAAG,MAAM,GAAG,IAQ1D,CAAC;AASF,qIAAqI;AACrI,eAAO,MAAM,aAAa,UAAW,OAAO,QAAQ,QAAQ,aAAa,aAAa,KAAG,WAMxF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,UAAW,MAAM,WAAW,MAAM,GAAG,IAAI,KAAG,MACR,CAAC;AAEvE,eAAO,MAAM,0BAA0B,mDAAmD,CAA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B,wIAC2F,CAAC;AAExI;;;GAGG;AACH,eAAO,MAAM,wBAAwB,UAAW,OAAO,KAAG,OAGzD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,UAAW,OAAO,KAAG,MAWxD,CAAC"}
@@ -0,0 +1,44 @@
1
+ import type { EmailCodeStep, EmailVerificationStep } from '../types/index.cjs';
2
+ export declare const emailCodeSentFallbackMessage = "We sent a code to your email.";
3
+ export declare const emailLinkSentFallbackMessage = "Check your email for a link to finish signing up.";
4
+ /**
5
+ * Reads an auth answer as an email verification step: `code` when the server emailed a code (a non-empty
6
+ * `challenge_id`), `link` when it emailed a link instead. `null` for anything else (tokens, a 2FA token, no answer).
7
+ */
8
+ export declare const readEmailVerificationStep: (answer: unknown) => EmailVerificationStep | null;
9
+ export type EmailCodeStepState = {
10
+ step: EmailCodeStep;
11
+ /** The display message of the last failed verify or resend; cleared by the next attempt or a new code. */
12
+ error: string | null;
13
+ };
14
+ export type EmailCodeStepEvent = {
15
+ type: 'ENTER';
16
+ step: EmailVerificationStep;
17
+ } | {
18
+ type: 'VERIFY_STARTED';
19
+ } | {
20
+ type: 'VERIFY_OK';
21
+ } | {
22
+ type: 'VERIFY_FAILED';
23
+ message: string;
24
+ } | {
25
+ type: 'RESENT';
26
+ challengeId: string;
27
+ message: string;
28
+ } | {
29
+ type: 'LINK_SENT';
30
+ message: string;
31
+ } | {
32
+ type: 'RESEND_FAILED';
33
+ message: string;
34
+ } | {
35
+ type: 'CANCEL';
36
+ };
37
+ export declare const initialEmailCodeStepState: EmailCodeStepState;
38
+ /**
39
+ * The emailed-code step as a transition table. Only `ENTER` leaves `none`: a verify or resend answer that lands
40
+ * after the user went back is a real race, not a bug, so it is ignored rather than resurrecting the step. Verify and
41
+ * resend events only change a `code` step; in `link` there is nothing left to verify or resend.
42
+ */
43
+ export declare const emailCodeStepReducer: (state: EmailCodeStepState, event: EmailCodeStepEvent) => EmailCodeStepState;
44
+ //# sourceMappingURL=email-verification.d.ts.map
@@ -0,0 +1,44 @@
1
+ import type { EmailCodeStep, EmailVerificationStep } from '../types/index.js';
2
+ export declare const emailCodeSentFallbackMessage = "We sent a code to your email.";
3
+ export declare const emailLinkSentFallbackMessage = "Check your email for a link to finish signing up.";
4
+ /**
5
+ * Reads an auth answer as an email verification step: `code` when the server emailed a code (a non-empty
6
+ * `challenge_id`), `link` when it emailed a link instead. `null` for anything else (tokens, a 2FA token, no answer).
7
+ */
8
+ export declare const readEmailVerificationStep: (answer: unknown) => EmailVerificationStep | null;
9
+ export type EmailCodeStepState = {
10
+ step: EmailCodeStep;
11
+ /** The display message of the last failed verify or resend; cleared by the next attempt or a new code. */
12
+ error: string | null;
13
+ };
14
+ export type EmailCodeStepEvent = {
15
+ type: 'ENTER';
16
+ step: EmailVerificationStep;
17
+ } | {
18
+ type: 'VERIFY_STARTED';
19
+ } | {
20
+ type: 'VERIFY_OK';
21
+ } | {
22
+ type: 'VERIFY_FAILED';
23
+ message: string;
24
+ } | {
25
+ type: 'RESENT';
26
+ challengeId: string;
27
+ message: string;
28
+ } | {
29
+ type: 'LINK_SENT';
30
+ message: string;
31
+ } | {
32
+ type: 'RESEND_FAILED';
33
+ message: string;
34
+ } | {
35
+ type: 'CANCEL';
36
+ };
37
+ export declare const initialEmailCodeStepState: EmailCodeStepState;
38
+ /**
39
+ * The emailed-code step as a transition table. Only `ENTER` leaves `none`: a verify or resend answer that lands
40
+ * after the user went back is a real race, not a bug, so it is ignored rather than resurrecting the step. Verify and
41
+ * resend events only change a `code` step; in `link` there is nothing left to verify or resend.
42
+ */
43
+ export declare const emailCodeStepReducer: (state: EmailCodeStepState, event: EmailCodeStepEvent) => EmailCodeStepState;
44
+ //# sourceMappingURL=email-verification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email-verification.d.ts","sourceRoot":"","sources":["../../../src/utils/email-verification.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEpE,eAAO,MAAM,4BAA4B,kCAAkC,CAAC;AAC5E,eAAO,MAAM,4BAA4B,sDAAsD,CAAC;AAKhG;;;GAGG;AACH,eAAO,MAAM,yBAAyB,WAAY,OAAO,KAAG,qBAAqB,GAAG,IAOnF,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,aAAa,CAAC;IACpB,0GAA0G;IAC1G,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,qBAAqB,CAAA;CAAE,GAC9C;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GAC1B;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACxD;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEvB,eAAO,MAAM,yBAAyB,EAAE,kBAA4D,CAAC;AAErG;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,UAAW,kBAAkB,SAAS,kBAAkB,KAAG,kBAuB3F,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-url-errors.d.ts","sourceRoot":"","sources":["../../../src/utils/get-url-errors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,YAAa,MAAM;;;CAM3C,CAAC"}
1
+ {"version":3,"file":"get-url-errors.d.ts","sourceRoot":"","sources":["../../../src/utils/get-url-errors.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,YAAY,YAAa,MAAM;;;CAM3C,CAAC"}
@@ -1,8 +1,9 @@
1
- export { authErrorFor, authRedirectErrorMessage, invitationLinkErrorMessage, verificationLinkErrorMessage, verificationRequestErrorMessage, } from './auth-error.cjs';
1
+ export { type ApprovalError, approvalAlreadyDecidedMessage, approvalApprovedMessage, approvalAttemptsMessage, approvalConnectionMessage, approvalDeniedMessage, approvalErrorFrom, approvalInvalidMessage, approvalUnavailableMessage, approvalUnknownErrorMessage, authErrorFor, authErrorFrom, authRedirectErrorFrom, authRedirectErrorMessage, emailCodeErrorMessage, invitationJoinErrorFrom, invitationLinkErrorMessage, isApprovalMatchError, isPasswordSavedRateLimit, newPasswordErrorMessage, passwordlessCompleteErrorMessage, passwordlessLinkExpiredMessage, passwordlessSignInFailedMessage, passwordlessWaitCompletedMessage, passwordlessWaitDeniedMessage, serverMessageFor, verificationLinkErrorMessage, verificationRequestErrorMessage, } from './auth-error.cjs';
2
2
  export { classifyDeviceError, DeviceApiError, deviceErrorOfType } from './classify-device-error.cjs';
3
3
  export { classifyTwoFactorError, getUserFriendlyErrorMessage } from './classify-two-factor-error.cjs';
4
4
  export { cn } from './cn.cjs';
5
5
  export * from './dayjs/index.cjs';
6
+ export { type EmailCodeStepEvent, type EmailCodeStepState, emailCodeStepReducer, initialEmailCodeStepState, readEmailVerificationStep, } from './email-verification.cjs';
6
7
  export { type AuthMethods, getAuthMethods } from './get-auth-methods.cjs';
7
8
  export { getIdentityLabel, getPasswordlessData, getValidationErrorsLabel } from './get-form-labels.cjs';
8
9
  export { getUrlErrors } from './get-url-errors.cjs';
@@ -12,7 +13,7 @@ export { routeToSecondFactor, urlCarriesTwoFactorToken } from './second-factor.c
12
13
  export { TwoFactorLoopPrevention } from './two-factor-loop-prevention.cjs';
13
14
  export { undefinedOnCatch } from './undefined-on-catch.cjs';
14
15
  export { attachAuth, registerUpgradeAuthInstance, releaseUpgradeAuthInstance, upgradeAuthInstance, withAuth, } from './upgrade-auth.cjs';
15
- export { useUrlParams } from './url-params.cjs';
16
+ export { readParentChallengeIdFromURL, urlWithoutParentChallenge, useUrlParams } from './url-params.cjs';
16
17
  export { isValidUrl } from './validate-url.cjs';
17
18
  export * from './validation-schemas/index.cjs';
18
19
  //# sourceMappingURL=index.d.ts.map
@@ -1,8 +1,9 @@
1
- export { authErrorFor, authRedirectErrorMessage, invitationLinkErrorMessage, verificationLinkErrorMessage, verificationRequestErrorMessage, } from './auth-error.js';
1
+ export { type ApprovalError, approvalAlreadyDecidedMessage, approvalApprovedMessage, approvalAttemptsMessage, approvalConnectionMessage, approvalDeniedMessage, approvalErrorFrom, approvalInvalidMessage, approvalUnavailableMessage, approvalUnknownErrorMessage, authErrorFor, authErrorFrom, authRedirectErrorFrom, authRedirectErrorMessage, emailCodeErrorMessage, invitationJoinErrorFrom, invitationLinkErrorMessage, isApprovalMatchError, isPasswordSavedRateLimit, newPasswordErrorMessage, passwordlessCompleteErrorMessage, passwordlessLinkExpiredMessage, passwordlessSignInFailedMessage, passwordlessWaitCompletedMessage, passwordlessWaitDeniedMessage, serverMessageFor, verificationLinkErrorMessage, verificationRequestErrorMessage, } from './auth-error.js';
2
2
  export { classifyDeviceError, DeviceApiError, deviceErrorOfType } from './classify-device-error.js';
3
3
  export { classifyTwoFactorError, getUserFriendlyErrorMessage } from './classify-two-factor-error.js';
4
4
  export { cn } from './cn.js';
5
5
  export * from './dayjs/index.js';
6
+ export { type EmailCodeStepEvent, type EmailCodeStepState, emailCodeStepReducer, initialEmailCodeStepState, readEmailVerificationStep, } from './email-verification.js';
6
7
  export { type AuthMethods, getAuthMethods } from './get-auth-methods.js';
7
8
  export { getIdentityLabel, getPasswordlessData, getValidationErrorsLabel } from './get-form-labels.js';
8
9
  export { getUrlErrors } from './get-url-errors.js';
@@ -12,7 +13,7 @@ export { routeToSecondFactor, urlCarriesTwoFactorToken } from './second-factor.j
12
13
  export { TwoFactorLoopPrevention } from './two-factor-loop-prevention.js';
13
14
  export { undefinedOnCatch } from './undefined-on-catch.js';
14
15
  export { attachAuth, registerUpgradeAuthInstance, releaseUpgradeAuthInstance, upgradeAuthInstance, withAuth, } from './upgrade-auth.js';
15
- export { useUrlParams } from './url-params.js';
16
+ export { readParentChallengeIdFromURL, urlWithoutParentChallenge, useUrlParams } from './url-params.js';
16
17
  export { isValidUrl } from './validate-url.js';
17
18
  export * from './validation-schemas/index.js';
18
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,wBAAwB,EACxB,0BAA0B,EAC1B,4BAA4B,EAC5B,+BAA+B,GAChC,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAClG,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,KAAK,WAAW,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AACpG,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,KAAK,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC9F,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,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mB,CAAC;AACpG,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,KAAK,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC9F,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,UAAU,EACV,2BAA2B,EAC3B,0BAA0B,EAC1B,mBAAmB,EACnB,QAAQ,GACT,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,4BAA4B,EAAE,yBAAyB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACrG,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,cAAc,sBAAsB,CAAC"}
@@ -1,3 +1,20 @@
1
+ /**
2
+ * Read `parent_challenge_id` from the current URL's query string.
3
+ * Returns `undefined` when not present so callers can short-circuit
4
+ * the OIDC interceptor on non-OIDC mounts.
5
+ *
6
+ * Lowercases only the parameter KEYS (not values) so the
7
+ * KSUID-shaped value isn't corrupted on the way through. (URL params
8
+ * are case-sensitive per RFC 3986; some Passflow URLs use mixed
9
+ * case like `appId=...`. The lowercase-keys treatment mirrors what
10
+ * the bundled login-app was doing pre-SDK-migration.)
11
+ */
12
+ export declare const readParentChallengeIdFromURL: () => string | undefined;
13
+ /**
14
+ * The URL without `parent_challenge_id`, in any key case. Works on the raw query, so every other param keeps its
15
+ * exact encoding.
16
+ */
17
+ export declare const urlWithoutParentChallenge: (url: string) => string;
1
18
  /**
2
19
  * Get URL parameters. Inside PassflowFlow they come from the flow's location; outside it, from the
3
20
  * address bar.
@@ -1,3 +1,20 @@
1
+ /**
2
+ * Read `parent_challenge_id` from the current URL's query string.
3
+ * Returns `undefined` when not present so callers can short-circuit
4
+ * the OIDC interceptor on non-OIDC mounts.
5
+ *
6
+ * Lowercases only the parameter KEYS (not values) so the
7
+ * KSUID-shaped value isn't corrupted on the way through. (URL params
8
+ * are case-sensitive per RFC 3986; some Passflow URLs use mixed
9
+ * case like `appId=...`. The lowercase-keys treatment mirrors what
10
+ * the bundled login-app was doing pre-SDK-migration.)
11
+ */
12
+ export declare const readParentChallengeIdFromURL: () => string | undefined;
13
+ /**
14
+ * The URL without `parent_challenge_id`, in any key case. Works on the raw query, so every other param keeps its
15
+ * exact encoding.
16
+ */
17
+ export declare const urlWithoutParentChallenge: (url: string) => string;
1
18
  /**
2
19
  * Get URL parameters. Inside PassflowFlow they come from the flow's location; outside it, from the
3
20
  * address bar.
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"url-params.d.ts","sourceRoot":"","sources":["../../../src/utils/url-params.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B,QAAO,MAAM,GAAG,SAQxD,CAAC;AAKF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,QAAS,MAAM,KAAG,MAYvD,CAAC;AAEF;;;;;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"}