@leancodepl/kratos 8.5.0 → 8.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/index.cjs.default.js +1 -0
  2. package/index.cjs.js +4681 -0
  3. package/index.cjs.mjs +2 -0
  4. package/index.d.ts +1 -0
  5. package/index.esm.js +4653 -0
  6. package/package.json +1 -6
  7. package/src/index.d.ts +12 -0
  8. package/src/lib/cards/index.d.ts +2 -0
  9. package/src/lib/cards/userAuthCard.d.ts +62 -0
  10. package/src/lib/cards/userSettingsCard.d.ts +36 -0
  11. package/src/lib/createKratosClient.d.ts +19 -0
  12. package/src/lib/defaultComponents/DefaultButtonComponent/index.d.ts +2 -0
  13. package/src/lib/defaultComponents/DefaultCheckboxComponent/index.d.ts +2 -0
  14. package/src/lib/defaultComponents/DefaultImageComponent/index.d.ts +2 -0
  15. package/src/lib/defaultComponents/DefaultInputComponent/index.d.ts +2 -0
  16. package/src/lib/defaultComponents/DefaultLinkComponent/index.d.ts +2 -0
  17. package/src/lib/defaultComponents/DefaultMessageComponent/index.d.ts +2 -0
  18. package/src/lib/defaultComponents/DefaultMessageFormatComponent/index.d.ts +2 -0
  19. package/src/lib/defaultComponents/DefaultTextComponent/index.d.ts +2 -0
  20. package/src/lib/defaultComponents/DefaultUiMessagesComponent/index.d.ts +2 -0
  21. package/src/lib/defaultComponents.d.ts +2 -0
  22. package/src/lib/flows/index.d.ts +7 -0
  23. package/src/lib/flows/useLoginFlow.d.ts +50 -0
  24. package/src/lib/flows/useLogoutFlow.d.ts +33 -0
  25. package/src/lib/flows/useReauthenticationFlow.d.ts +31 -0
  26. package/src/lib/flows/useRecoveryFlow.d.ts +47 -0
  27. package/src/lib/flows/useRegistrationFlow.d.ts +47 -0
  28. package/src/lib/flows/useSettingsFlow.d.ts +47 -0
  29. package/src/lib/flows/useVerificationFlow.d.ts +47 -0
  30. package/src/lib/helpers/errorMessages.d.ts +7 -0
  31. package/src/lib/helpers/filterFlowNodes.d.ts +7 -0
  32. package/src/lib/helpers/formattedMessage.d.ts +4 -0
  33. package/src/lib/helpers/getNodeLabel.d.ts +2 -0
  34. package/src/lib/helpers/node.d.ts +7 -0
  35. package/src/lib/helpers/useScriptNodes.d.ts +5 -0
  36. package/src/lib/helpers/userAuthForm.d.ts +31 -0
  37. package/src/lib/kratosContext.d.ts +29 -0
  38. package/src/lib/kratosContextProvider.d.ts +34 -0
  39. package/src/lib/sections/authCodeSection.d.ts +14 -0
  40. package/src/lib/sections/identifierFirstLoginSection.d.ts +8 -0
  41. package/src/lib/sections/linkSection.d.ts +14 -0
  42. package/src/lib/sections/loginSection.d.ts +8 -0
  43. package/src/lib/sections/lookupSecretSettingsSection.d.ts +8 -0
  44. package/src/lib/sections/oidcSection.d.ts +8 -0
  45. package/src/lib/sections/oidcSettingsSection.d.ts +8 -0
  46. package/src/lib/sections/passkeySettingsSection.d.ts +8 -0
  47. package/src/lib/sections/passwordSettingsSection.d.ts +8 -0
  48. package/src/lib/sections/passwordlessSection.d.ts +8 -0
  49. package/src/lib/sections/profileLoginSection.d.ts +8 -0
  50. package/src/lib/sections/profileRegistrationSection.d.ts +8 -0
  51. package/src/lib/sections/profileSettingsSection.d.ts +8 -0
  52. package/src/lib/sections/registrationSection.d.ts +8 -0
  53. package/src/lib/sections/totpSettingsSection.d.ts +8 -0
  54. package/src/lib/sessionManager/baseSessionManager.d.ts +35 -0
  55. package/src/lib/types/components.d.ts +78 -0
  56. package/src/lib/types/enums/errorId.d.ts +16 -0
  57. package/src/lib/types/enums/errorValidation.d.ts +30 -0
  58. package/src/lib/types/enums/errorValidationLogin.d.ts +9 -0
  59. package/src/lib/types/enums/errorValidationRecovery.d.ts +9 -0
  60. package/src/lib/types/enums/errorValidationRegistration.d.ts +4 -0
  61. package/src/lib/types/enums/errorValidationSettings.d.ts +4 -0
  62. package/src/lib/types/enums/errorValidationVerification.d.ts +9 -0
  63. package/src/lib/types/enums/index.d.ts +14 -0
  64. package/src/lib/types/enums/infoNodeLabel.d.ts +14 -0
  65. package/src/lib/types/enums/infoSelfServiceLogin.d.ts +16 -0
  66. package/src/lib/types/enums/infoSelfServiceRecovery.d.ts +6 -0
  67. package/src/lib/types/enums/infoSelfServiceRegistration.d.ts +7 -0
  68. package/src/lib/types/enums/infoSelfServiceSettings.d.ts +21 -0
  69. package/src/lib/types/enums/infoSelfServiceVerification.d.ts +6 -0
  70. package/src/lib/types/enums/misc.d.ts +10 -0
  71. package/src/lib/types/responseError.d.ts +2 -0
  72. package/src/lib/types/useHandleFlowError.d.ts +13 -0
  73. package/src/lib/utils/filterNodesByGroups.d.ts +22 -0
  74. package/src/lib/utils/getNodeInputType.d.ts +1 -0
  75. package/src/lib/utils/handleCancelError.d.ts +2 -0
  76. package/src/lib/utils/helpers.d.ts +11 -0
  77. package/src/lib/utils/typeGuards.d.ts +24 -0
  78. package/src/lib/utils/variables.d.ts +4 -0
@@ -0,0 +1,34 @@
1
+ import { ReactNode } from "react";
2
+ import type { KratosComponents } from "./types/components";
3
+ import type { UseHandleFlowError } from "./types/useHandleFlowError";
4
+ export type KratosContextProviderProps = {
5
+ components?: Partial<KratosComponents>;
6
+ useHandleFlowError?: UseHandleFlowError;
7
+ excludeScripts?: boolean;
8
+ children?: ReactNode;
9
+ };
10
+ /**
11
+ * Provides Kratos context to child components with customizable configuration.
12
+ *
13
+ * Sets up the React context for Kratos integration, allowing customization of
14
+ * UI components, error handling, and script loading behavior.
15
+ *
16
+ * @param components - Partial override of default Kratos UI components
17
+ * @param useHandleFlowError - Custom error handler for authentication flows
18
+ * @param excludeScripts - Whether to exclude script node execution
19
+ * @param children - Child React components
20
+ * @returns JSX element providing Kratos context
21
+ * @example
22
+ * ```typescript
23
+ * import { KratosContextProvider } from '@leancodepl/kratos';
24
+ *
25
+ * function App() {
26
+ * return (
27
+ * <KratosContextProvider>
28
+ * <LoginPage />
29
+ * </KratosContextProvider>
30
+ * );
31
+ * }
32
+ * ```
33
+ */
34
+ export declare function KratosContextProvider({ components, useHandleFlowError, excludeScripts, children, }: KratosContextProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { ElementType } from "react";
2
+ import { UiNode } from "@ory/client";
3
+ type AuthCodeSectionProps = {
4
+ nodes: UiNode[];
5
+ AuthCodeSectionWrapper: ElementType;
6
+ };
7
+ /**
8
+ * AuthCodeSection renders the fields for login and registration via one-time code.
9
+ * Please see the Ory docs for more information: https://www.ory.sh/docs/kratos/passwordless/one-time-code
10
+ * @param nodes - Ory UiNode[]
11
+ * @see AuthCodeSectionProps
12
+ */
13
+ export declare function AuthCodeSection({ nodes, AuthCodeSectionWrapper }: AuthCodeSectionProps): import("react/jsx-runtime").JSX.Element | null;
14
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ElementType } from "react";
2
+ import { UiNode } from "@ory/client";
3
+ type IdentifierFirstLoginSectionProps = {
4
+ nodes: UiNode[];
5
+ IdentifierFirstLoginSectionWrapper: ElementType;
6
+ };
7
+ export declare function IdentifierFirstLoginSection({ nodes, IdentifierFirstLoginSectionWrapper, }: IdentifierFirstLoginSectionProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,14 @@
1
+ import { ElementType } from "react";
2
+ import { UiNode } from "@ory/client";
3
+ type LinkSectionProps = {
4
+ nodes: UiNode[];
5
+ LinkSectionWrapper: ElementType;
6
+ };
7
+ /**
8
+ * LinkSection renders the fields for recovery and verification
9
+ * Please see the Ory docs for more information:
10
+ * - https://www.ory.sh/docs/kratos/self-service/flows/account-recovery-password-reset
11
+ * - https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation
12
+ */
13
+ export declare function LinkSection({ nodes, LinkSectionWrapper }: LinkSectionProps): import("react/jsx-runtime").JSX.Element;
14
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ElementType } from "react";
2
+ import { UiNode } from "@ory/client";
3
+ type LoginSectionProps = {
4
+ nodes: UiNode[];
5
+ LoginSectionWrapper: ElementType;
6
+ };
7
+ export declare function LoginSection({ nodes, LoginSectionWrapper }: LoginSectionProps): import("react/jsx-runtime").JSX.Element | null;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ElementType } from "react";
2
+ import { SettingsFlow } from "@ory/client";
3
+ type LookupSecretSettingsProps = {
4
+ flow: SettingsFlow;
5
+ LookupSecretSettingsSectionWrapper: ElementType;
6
+ };
7
+ export declare function LookupSecretSettingsSection({ flow, LookupSecretSettingsSectionWrapper }: LookupSecretSettingsProps): import("react/jsx-runtime").JSX.Element | null;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ElementType } from "react";
2
+ import { SelfServiceFlow } from "../helpers/userAuthForm";
3
+ type OidcSectionProps = {
4
+ flow: SelfServiceFlow;
5
+ OidcSectionWrapper: ElementType;
6
+ };
7
+ export declare function OidcSection({ flow, OidcSectionWrapper }: OidcSectionProps): import("react/jsx-runtime").JSX.Element | null;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ElementType } from "react";
2
+ import { SettingsFlow } from "@ory/client";
3
+ type OidcSettingsProps = {
4
+ flow: SettingsFlow;
5
+ OidcSettingsSectionWrapper: ElementType;
6
+ };
7
+ export declare function OidcSettingsSection({ flow, OidcSettingsSectionWrapper }: OidcSettingsProps): import("react/jsx-runtime").JSX.Element | null;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ElementType } from "react";
2
+ import { SettingsFlow } from "@ory/client";
3
+ type WebAuthnSettingsProps = {
4
+ flow: SettingsFlow;
5
+ PasskeySettingsSectionWrapper: ElementType;
6
+ };
7
+ export declare function PasskeySettingsSection({ flow, PasskeySettingsSectionWrapper }: WebAuthnSettingsProps): import("react/jsx-runtime").JSX.Element | null;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ElementType } from "react";
2
+ import { SettingsFlow } from "@ory/client";
3
+ type PasswordSettingsProps = {
4
+ flow: SettingsFlow;
5
+ PasswordSettingsSectionWrapper: ElementType;
6
+ };
7
+ export declare function PasswordSettingsSection({ flow, PasswordSettingsSectionWrapper }: PasswordSettingsProps): import("react/jsx-runtime").JSX.Element | null;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ElementType } from "react";
2
+ import { SelfServiceFlow } from "../helpers/userAuthForm";
3
+ type PasswordlessSectionProps = {
4
+ flow: SelfServiceFlow;
5
+ PasswordlessSectionWrapper: ElementType;
6
+ };
7
+ export declare function PasswordlessSection({ flow, PasswordlessSectionWrapper }: PasswordlessSectionProps): import("react/jsx-runtime").JSX.Element | null;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ElementType } from "react";
2
+ import { UiNode } from "@ory/client";
3
+ type ProfileLoginSectionProps = {
4
+ nodes: UiNode[];
5
+ ProfileLoginSectionWrapper: ElementType;
6
+ };
7
+ export declare function ProfileLoginSection({ nodes, ProfileLoginSectionWrapper }: ProfileLoginSectionProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ElementType } from "react";
2
+ import { UiNode } from "@ory/client";
3
+ type ProfileRegistrationSectionProps = {
4
+ nodes: UiNode[];
5
+ ProfileRegistrationSectionWrapper: ElementType;
6
+ };
7
+ export declare function ProfileRegistrationSection({ nodes, ProfileRegistrationSectionWrapper, }: ProfileRegistrationSectionProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ElementType } from "react";
2
+ import { SettingsFlow } from "@ory/client";
3
+ type ProfileSettingsProps = {
4
+ flow: SettingsFlow;
5
+ ProfileSettingsSectionWrapper: ElementType;
6
+ };
7
+ export declare function ProfileSettingsSection({ flow, ProfileSettingsSectionWrapper }: ProfileSettingsProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ElementType } from "react";
2
+ import { UiNode } from "@ory/client";
3
+ type RegistrationSectionProps = {
4
+ nodes: UiNode[];
5
+ RegistrationSectionWrapper: ElementType;
6
+ };
7
+ export declare function RegistrationSection({ nodes, RegistrationSectionWrapper }: RegistrationSectionProps): import("react/jsx-runtime").JSX.Element | null;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ElementType } from "react";
2
+ import { SettingsFlow } from "@ory/client";
3
+ type TotpSettingsProps = {
4
+ flow: SettingsFlow;
5
+ TotpSettingsSectionWrapper: ElementType;
6
+ };
7
+ export declare function TotpSettingsSection({ flow, TotpSettingsSectionWrapper }: TotpSettingsProps): import("react/jsx-runtime").JSX.Element | null;
8
+ export {};
@@ -0,0 +1,35 @@
1
+ import { Session } from "@ory/client";
2
+ import { Subject } from "rxjs";
3
+ /**
4
+ * Manages Kratos session state with RxJS observables for authentication status.
5
+ *
6
+ * Provides reactive session management with automatic status checking, user identity
7
+ * tracking, and AAL (Authenticator Assurance Level) handling for multi-factor authentication.
8
+ *
9
+ * @param authUrl - Base URL for Kratos authentication endpoints
10
+ * @param loginRoute - Application route for login page
11
+ * @example
12
+ * ```typescript
13
+ * import { BaseSessionManager } from '@leancodepl/kratos';
14
+ *
15
+ * const sessionManager = new BaseSessionManager(
16
+ * 'https://auth.example.com',
17
+ * '/login'
18
+ * );
19
+ *
20
+ * sessionManager.isLoggedIn.subscribe(loggedIn => {
21
+ * console.log('User logged in:', loggedIn);
22
+ * });
23
+ * ```
24
+ */
25
+ export declare class BaseSessionManager {
26
+ authUrl: string;
27
+ loginRoute: string;
28
+ session$: Subject<Session | undefined>;
29
+ isLoggedIn: import("rxjs").Observable<boolean>;
30
+ identity$: import("rxjs").Observable<import("@ory/client").Identity | undefined>;
31
+ userId$: import("rxjs").Observable<string | undefined>;
32
+ setSession(session: Session | undefined): void;
33
+ checkIfLoggedIn: () => void;
34
+ constructor(authUrl: string, loginRoute: string);
35
+ }
@@ -0,0 +1,78 @@
1
+ import { ComponentType, ElementType, ReactNode } from "react";
2
+ import { UiNode, UiNodeTextAttributes, UiText, UiTextTypeEnum } from "@ory/client";
3
+ type Node = {
4
+ node: UiNode;
5
+ };
6
+ export type ImageComponentProps = Node & React.ImgHTMLAttributes<HTMLImageElement> & {
7
+ header?: ReactNode;
8
+ className?: string;
9
+ };
10
+ export type TextComponentProps = Node & {
11
+ label?: ReactNode;
12
+ id: string;
13
+ codes?: UiText[];
14
+ attributes: UiNodeTextAttributes;
15
+ };
16
+ export type LinkComponentProps = Node & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href"> & {
17
+ children?: ReactNode;
18
+ href?: string;
19
+ icon?: string;
20
+ className?: string;
21
+ };
22
+ export type InputComponentProps = Node & React.InputHTMLAttributes<HTMLInputElement> & {
23
+ header: ReactNode;
24
+ helperMessage?: ReactNode;
25
+ isError?: boolean;
26
+ };
27
+ export type MessageComponentProps = {
28
+ message: UiText;
29
+ key: string;
30
+ severity: Severity;
31
+ children?: ReactNode;
32
+ };
33
+ export type Severity = "default" | "disabled" | UiTextTypeEnum;
34
+ export type ButtonComponentProps = Node & React.ButtonHTMLAttributes<HTMLButtonElement> & {
35
+ header?: ReactNode;
36
+ fullWidth?: boolean;
37
+ social?: string;
38
+ };
39
+ export type CheckboxComponentProps = Node & React.InputHTMLAttributes<HTMLInputElement> & {
40
+ label?: ReactNode;
41
+ helperMessage?: ReactNode;
42
+ isError?: boolean;
43
+ };
44
+ export type MessageFormatComponentProps = {
45
+ id: number;
46
+ text: string;
47
+ context?: object;
48
+ };
49
+ export type UiMessagesComponentProps = {
50
+ uiMessages?: UiText[];
51
+ };
52
+ export type KratosComponents = {
53
+ MessageFormat: ComponentType<MessageFormatComponentProps>;
54
+ Image: ComponentType<ImageComponentProps>;
55
+ Text: ComponentType<TextComponentProps>;
56
+ Link: ComponentType<LinkComponentProps>;
57
+ Input: ComponentType<InputComponentProps>;
58
+ Message: ComponentType<MessageComponentProps>;
59
+ Button: ComponentType<ButtonComponentProps>;
60
+ Checkbox: ComponentType<CheckboxComponentProps>;
61
+ UiMessages: ComponentType<UiMessagesComponentProps>;
62
+ OidcSectionWrapper: ElementType;
63
+ PasswordlessSectionWrapper: ElementType;
64
+ AuthCodeSectionWrapper: ElementType;
65
+ LoginSectionWrapper: ElementType;
66
+ RegistrationSectionWrapper: ElementType;
67
+ LinkSectionWrapper: ElementType;
68
+ ProfileSettingsSectionWrapper: ElementType;
69
+ PasswordSettingsSectionWrapper: ElementType;
70
+ WebAuthnSettingsSectionWrapper: ElementType;
71
+ LookupSecretSettingsSectionWrapper: ElementType;
72
+ OidcSettingsSectionWrapper: ElementType;
73
+ TotpSettingsSectionWrapper: ElementType;
74
+ IdentifierFirstLoginSectionWrapper: ElementType;
75
+ ProfileLoginSectionWrapper: ElementType;
76
+ ProfileRegistrationSectionWrapper: ElementType;
77
+ };
78
+ export {};
@@ -0,0 +1,16 @@
1
+ export declare enum ErrorId {
2
+ ErrIDNeedsPrivilegedSession = "session_refresh_required",
3
+ ErrIDSelfServiceFlowExpired = "self_service_flow_expired",
4
+ ErrIDSelfServiceFlowDisabled = "self_service_flow_disabled",
5
+ ErrIDSelfServiceBrowserLocationChangeRequiredError = "browser_location_change_required",
6
+ ErrIDSelfServiceFlowReplaced = "self_service_flow_replaced",
7
+ ErrIDAlreadyLoggedIn = "session_already_available",
8
+ ErrIDAddressNotVerified = "session_verified_address_required",
9
+ ErrIDSessionHasAALAlready = "session_aal_already_fulfilled",
10
+ ErrIDSessionRequiredForHigherAAL = "session_aal1_required",
11
+ ErrIDHigherAALRequired = "session_aal2_required",
12
+ ErrNoActiveSession = "session_inactive",
13
+ ErrIDRedirectURLNotAllowed = "self_service_flow_return_to_forbidden",
14
+ ErrIDInitiatedBySomeoneElse = "security_identity_mismatch",
15
+ ErrIDCSRF = "security_csrf_violation"
16
+ }
@@ -0,0 +1,30 @@
1
+ export declare enum ErrorValidation {
2
+ ErrorValidation = 4000000,
3
+ ErrorValidationGeneric = 4000001,
4
+ ErrorValidationRequired = 4000002,
5
+ ErrorValidationMinLength = 4000003,
6
+ ErrorValidationInvalidFormat = 4000004,
7
+ ErrorValidationPasswordPolicyViolation = 4000005,
8
+ ErrorValidationInvalidCredentials = 4000006,
9
+ ErrorValidationDuplicateCredentials = 4000007,
10
+ ErrorValidationTOTPVerifierWrong = 4000008,
11
+ ErrorValidationIdentifierMissing = 4000009,
12
+ ErrorValidationAddressNotVerified = 4000010,
13
+ ErrorValidationNoTOTPDevice = 4000011,
14
+ ErrorValidationLookupAlreadyUsed = 4000012,
15
+ ErrorValidationNoWebAuthnDevice = 4000013,
16
+ ErrorValidationNoLookup = 4000014,
17
+ ErrorValidationSuchNoWebAuthnUser = 4000015,
18
+ ErrorValidationLookupInvalid = 4000016,
19
+ ErrorValidationMaxLength = 4000017,
20
+ ErrorValidationMinimum = 4000018,
21
+ ErrorValidationExclusiveMinimum = 4000019,
22
+ ErrorValidationMaximum = 4000020,
23
+ ErrorValidationExclusiveMaximum = 4000021,
24
+ ErrorValidationMultipleOf = 4000022,
25
+ ErrorValidationMaxItems = 4000023,
26
+ ErrorValidationMinItems = 4000024,
27
+ ErrorValidationUniqueItems = 4000025,
28
+ ErrorValidationWrongType = 4000026,
29
+ ErrorValidationDuplicateCredentialsOnOIDCLink = 4000027
30
+ }
@@ -0,0 +1,9 @@
1
+ export declare enum ErrorValidationLogin {
2
+ ErrorValidationLogin = 4010000,
3
+ ErrorValidationLoginFlowExpired = 4010001,
4
+ ErrorValidationLoginNoStrategyFound = 4010002,
5
+ ErrorValidationRegistrationNoStrategyFound = 4010003,
6
+ ErrorValidationSettingsNoStrategyFound = 4010004,
7
+ ErrorValidationRecoveryNoStrategyFound = 4010005,
8
+ ErrorValidationVerificationNoStrategyFound = 4010006
9
+ }
@@ -0,0 +1,9 @@
1
+ export declare enum ErrorValidationRecovery {
2
+ ErrorValidationRecovery = 4060000,
3
+ ErrorValidationRecoveryRetrySuccess = 4060001,
4
+ ErrorValidationRecoveryStateFailure = 4060002,
5
+ ErrorValidationRecoveryMissingRecoveryToken = 4060003,
6
+ ErrorValidationRecoveryTokenInvalidOrAlreadyUsed = 4060004,
7
+ ErrorValidationRecoveryFlowExpired = 4060005,
8
+ ErrorValidationRecoveryCodeInvalidOrAlreadyUsed = 4060006
9
+ }
@@ -0,0 +1,4 @@
1
+ export declare enum ErrorValidationRegistration {
2
+ ErrorValidationRegistration = 4040000,
3
+ ErrorValidationRegistrationFlowExpired = 4040001
4
+ }
@@ -0,0 +1,4 @@
1
+ export declare enum ErrorValidationSettings {
2
+ ErrorValidationSettings = 4050000,
3
+ ErrorValidationSettingsFlowExpired = 4050001
4
+ }
@@ -0,0 +1,9 @@
1
+ export declare enum ErrorValidationVerification {
2
+ ErrorValidationVerification = 4070000,
3
+ ErrorValidationVerificationTokenInvalidOrAlreadyUsed = 4070001,
4
+ ErrorValidationVerificationRetrySuccess = 4070002,
5
+ ErrorValidationVerificationStateFailure = 4070003,
6
+ ErrorValidationVerificationMissingVerificationToken = 4070004,
7
+ ErrorValidationVerificationFlowExpired = 4070005,
8
+ ErrorValidationVerificationCodeInvalidOrAlreadyUsed = 4070006
9
+ }
@@ -0,0 +1,14 @@
1
+ export * from "./errorId";
2
+ export * from "./errorValidation";
3
+ export * from "./errorValidationLogin";
4
+ export * from "./errorValidationRecovery";
5
+ export * from "./errorValidationRegistration";
6
+ export * from "./errorValidationSettings";
7
+ export * from "./errorValidationVerification";
8
+ export * from "./infoNodeLabel";
9
+ export * from "./infoSelfServiceLogin";
10
+ export * from "./infoSelfServiceRecovery";
11
+ export * from "./infoSelfServiceRegistration";
12
+ export * from "./infoSelfServiceSettings";
13
+ export * from "./infoSelfServiceVerification";
14
+ export * from "./misc";
@@ -0,0 +1,14 @@
1
+ export declare enum InfoNodeLabel {
2
+ InfoNodeLabel = 1070000,
3
+ InfoNodeLabelInputPassword = 1070001,
4
+ InfoNodeLabelGenerated = 1070002,
5
+ InfoNodeLabelSave = 1070003,
6
+ InfoNodeLabelID = 1070004,
7
+ InfoNodeLabelSubmit = 1070005,
8
+ InfoNodeLabelVerifyOTP = 1070006,
9
+ InfoNodeLabelEmail = 1070007,
10
+ InfoNodeLabelResendOTP = 1070008,
11
+ InfoNodeLabelContinue = 1070009,
12
+ InfoNodeLabelRecoveryCode = 1070010,
13
+ InfoNodeLabelVerificationCode = 1070011
14
+ }
@@ -0,0 +1,16 @@
1
+ export declare enum InfoSelfServiceLogin {
2
+ InfoSelfServiceLoginRoot = 1010000,
3
+ InfoSelfServiceLogin = 1010001,
4
+ InfoSelfServiceLoginWith = 1010002,
5
+ InfoSelfServiceLoginReAuth = 1010003,
6
+ InfoSelfServiceLoginMFA = 1010004,
7
+ InfoSelfServiceLoginVerify = 1010005,
8
+ InfoSelfServiceLoginTOTPLabel = 1010006,
9
+ InfoLoginLookupLabel = 1010007,
10
+ InfoSelfServiceLoginWebAuthn = 1010008,
11
+ InfoLoginTOTP = 1010009,
12
+ InfoLoginLookup = 1010010,
13
+ InfoSelfServiceLoginContinueWebAuthn = 1010011,
14
+ InfoSelfServiceLoginWebAuthnPasswordless = 1010012,
15
+ InfoSelfServiceLoginContinue = 1010013
16
+ }
@@ -0,0 +1,6 @@
1
+ export declare enum InfoSelfServiceRecovery {
2
+ InfoSelfServiceRecovery = 1060000,
3
+ InfoSelfServiceRecoverySuccessful = 1060001,
4
+ InfoSelfServiceRecoveryEmailSent = 1060002,
5
+ InfoSelfServiceRecoveryEmailWithCodeSent = 1060003
6
+ }
@@ -0,0 +1,7 @@
1
+ export declare enum InfoSelfServiceRegistration {
2
+ InfoSelfServiceRegistrationRoot = 1040000,
3
+ InfoSelfServiceRegistration = 1040001,
4
+ InfoSelfServiceRegistrationWith = 1040002,
5
+ InfoSelfServiceRegistrationContinue = 1040003,
6
+ InfoSelfServiceRegistrationRegisterWebAuthn = 1040004
7
+ }
@@ -0,0 +1,21 @@
1
+ export declare enum InfoSelfServiceSettings {
2
+ InfoSelfServiceSettings = 1050000,
3
+ InfoSelfServiceSettingsUpdateSuccess = 1050001,
4
+ InfoSelfServiceSettingsUpdateLinkOidc = 1050002,
5
+ InfoSelfServiceSettingsUpdateUnlinkOidc = 1050003,
6
+ InfoSelfServiceSettingsUpdateUnlinkTOTP = 1050004,
7
+ InfoSelfServiceSettingsTOTPQRCode = 1050005,
8
+ InfoSelfServiceSettingsTOTPSecret = 1050006,
9
+ InfoSelfServiceSettingsRevealLookup = 1050007,
10
+ InfoSelfServiceSettingsRegenerateLookup = 1050008,
11
+ InfoSelfServiceSettingsLookupSecret = 1050009,
12
+ InfoSelfServiceSettingsLookupSecretLabel = 1050010,
13
+ InfoSelfServiceSettingsLookupConfirm = 1050011,
14
+ InfoSelfServiceSettingsRegisterWebAuthn = 1050012,
15
+ InfoSelfServiceSettingsRegisterWebAuthnDisplayName = 1050013,
16
+ InfoSelfServiceSettingsLookupSecretUsed = 1050014,
17
+ InfoSelfServiceSettingsLookupSecretList = 1050015,
18
+ InfoSelfServiceSettingsDisableLookup = 1050016,
19
+ InfoSelfServiceSettingsTOTPSecretLabel = 1050017,
20
+ InfoSelfServiceSettingsRemoveWebAuthn = 1050018
21
+ }
@@ -0,0 +1,6 @@
1
+ export declare enum InfoSelfServiceVerification {
2
+ InfoSelfServiceVerification = 1080000,
3
+ InfoSelfServiceVerificationEmailSent = 1080001,
4
+ InfoSelfServiceVerificationSuccessful = 1080002,
5
+ InfoSelfServiceVerificationEmailWithCodeSent = 1080003
6
+ }
@@ -0,0 +1,10 @@
1
+ export declare enum ErrorSystem {
2
+ ErrorSystem = 5000000,
3
+ ErrorSystemGeneric = 5000001
4
+ }
5
+ export declare enum InfoSelfServiceLogout {
6
+ InfoSelfServiceLogout = 1020000
7
+ }
8
+ export declare enum InfoSelfServiceMFA {
9
+ InfoSelfServiceMFA = 1030000
10
+ }
@@ -0,0 +1,2 @@
1
+ import { AxiosError } from "axios";
2
+ export type ResponseError<T = any> = AxiosError<T>;
@@ -0,0 +1,13 @@
1
+ import { AxiosError } from "axios";
2
+ import { ErrorId } from "./enums/errorId";
3
+ export type FlowErrorResponse = {
4
+ error?: {
5
+ id?: ErrorId;
6
+ };
7
+ redirect_browser_to: string;
8
+ use_flow_id?: string;
9
+ };
10
+ export type UseHandleFlowError = (props: {
11
+ resetFlow: (newFlowId?: string) => void;
12
+ onSessionAlreadyAvailable?: () => void;
13
+ }) => (err: AxiosError<FlowErrorResponse>) => Promise<unknown>;
@@ -0,0 +1,22 @@
1
+ import { UiNode, UiNodeGroupEnum, UiNodeInputAttributesTypeEnum } from "@ory/client";
2
+ export type FilterNodesByGroups = {
3
+ nodes: Array<UiNode>;
4
+ groups?: Array<string | UiNodeGroupEnum> | string | UiNodeGroupEnum;
5
+ withoutDefaultGroup?: boolean;
6
+ attributes?: Array<string | UiNodeInputAttributesTypeEnum> | string | UiNodeInputAttributesTypeEnum;
7
+ withoutDefaultAttributes?: boolean;
8
+ excludeAttributes?: Array<string | UiNodeInputAttributesTypeEnum> | string | UiNodeInputAttributesTypeEnum;
9
+ };
10
+ /**
11
+ * Filters nodes by their groups and attributes.
12
+ * If no filtering options are specified, all nodes are returned.
13
+ * Will always add default nodes unless `withoutDefaultGroup` is true.
14
+ * Will always add default attributes unless `withoutDefaultAttributes` is true.
15
+ * @param {Object} filterNodesByGroups - An object containing the nodes and the filtering options.
16
+ * @param {Array<UiNode>} filterNodesByGroups.nodes - An array of nodes.
17
+ * @param {Array<UiNodeGroupEnum | string> | string} filterNodesByGroups.groups - An array or comma seperated strings of groups to filter by.
18
+ * @param {boolean} filterNodesByGroups.withoutDefaultGroup - If true, will not add default nodes under the 'default' category.
19
+ * @param {Array<UiNodeInputAttributesTypeEnum | string> | string} filterNodesByGroups.attributes - An array or comma seperated strings of attributes to filter by.
20
+ * @param {boolean} filterNodesByGroups.withoutDefaultAttributes - If true, will not add default attributes such as 'hidden' and 'script'.
21
+ */
22
+ export declare const filterNodesByGroups: ({ nodes, groups, withoutDefaultGroup, attributes, withoutDefaultAttributes, excludeAttributes, }: FilterNodesByGroups) => UiNode[];
@@ -0,0 +1 @@
1
+ export declare function getNodeInputType(attr: unknown): string;
@@ -0,0 +1,2 @@
1
+ import { AxiosError } from "axios";
2
+ export declare function handleCancelError(err: AxiosError): Promise<void>;
@@ -0,0 +1,11 @@
1
+ import { UiNode } from "@ory/client";
2
+ export declare function hasOidc(nodes: UiNode[]): boolean;
3
+ export declare function hasPassword(nodes: UiNode[]): boolean;
4
+ export declare function hasDefault(nodes: UiNode[]): boolean;
5
+ export declare function hasProfile(nodes: UiNode[]): boolean;
6
+ export declare function hasPasskey(nodes: UiNode[]): boolean;
7
+ export declare function hasIdentifierFirst(nodes: UiNode[]): boolean;
8
+ export declare function hasLookupSecret(nodes: UiNode[]): boolean;
9
+ export declare function hasTotp(nodes: UiNode[]): boolean;
10
+ export declare function hasCode(nodes: UiNode[]): boolean;
11
+ export declare function hasHiddenIdentifier(nodes: UiNode[]): boolean;
@@ -0,0 +1,24 @@
1
+ import { UiNodeAnchorAttributes, UiNodeAttributes, UiNodeImageAttributes, UiNodeInputAttributes, UiNodeScriptAttributes, UiNodeTextAttributes, UiText } from "@ory/client";
2
+ export declare function isUiNodeAnchorAttributes(attrs: UiNodeAttributes): attrs is UiNodeAnchorAttributes & {
3
+ node_type: "a";
4
+ };
5
+ export declare function isUiNodeImageAttributes(attrs: UiNodeAttributes): attrs is UiNodeImageAttributes & {
6
+ node_type: "img";
7
+ };
8
+ export declare function isUiNodeInputAttributes(attrs: UiNodeAttributes): attrs is UiNodeInputAttributes & {
9
+ node_type: "input";
10
+ };
11
+ export declare function isUiNodeTextAttributes(attrs: UiNodeAttributes): attrs is UiNodeTextAttributes & {
12
+ node_type: "text";
13
+ };
14
+ export declare function isUiNodeScriptAttributes(attrs: UiNodeAttributes): attrs is UiNodeScriptAttributes & {
15
+ node_type: "script";
16
+ };
17
+ export type UiNodeTextSecretsAttributes = Omit<UiNodeTextAttributes, "text"> & {
18
+ text: Omit<UiText, "context"> & {
19
+ context: {
20
+ secrets: UiText[];
21
+ };
22
+ };
23
+ };
24
+ export declare function isUiNodeTextSecretsAttributes(attributes: UiNodeTextAttributes): attributes is UiNodeTextSecretsAttributes;
@@ -0,0 +1,4 @@
1
+ export declare const returnToParameterName = "return_to";
2
+ export declare const aalParameterName = "aal";
3
+ export declare const flowIdParameterName = "flow";
4
+ export declare const refreshParameterName = "refresh";