@leancodepl/kratos 7.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/index.cjs.d.ts +1 -0
- package/index.cjs.js +1750 -0
- package/index.esm.js +1730 -0
- package/package.json +16 -0
- package/src/index.d.ts +9 -0
- package/src/lib/createKratosClient.d.ts +2 -0
- package/src/lib/flowFactory.d.ts +22 -0
- package/src/lib/mkAuth.d.ts +74 -0
- package/src/lib/node/DefaultNodeAnchor/index.d.ts +7 -0
- package/src/lib/node/DefaultNodeImage/index.d.ts +7 -0
- package/src/lib/node/DefaultNodeText/index.d.ts +7 -0
- package/src/lib/node/NodeInput/defaultNodeInputHidden.d.ts +6 -0
- package/src/lib/node/NodeInput/index.d.ts +19 -0
- package/src/lib/node/index.d.ts +43 -0
- package/src/lib/sessionManager/baseSessionManager.d.ts +14 -0
- package/src/lib/types/enums/errorId.d.ts +16 -0
- package/src/lib/types/enums/errorValidation.d.ts +30 -0
- package/src/lib/types/enums/errorValidationLogin.d.ts +9 -0
- package/src/lib/types/enums/errorValidationRecovery.d.ts +9 -0
- package/src/lib/types/enums/errorValidationRegistration.d.ts +4 -0
- package/src/lib/types/enums/errorValidationSettings.d.ts +4 -0
- package/src/lib/types/enums/errorValidationVerification.d.ts +9 -0
- package/src/lib/types/enums/index.d.ts +14 -0
- package/src/lib/types/enums/infoNodeLabel.d.ts +14 -0
- package/src/lib/types/enums/infoSelfServiceLogin.d.ts +16 -0
- package/src/lib/types/enums/infoSelfServiceRecovery.d.ts +6 -0
- package/src/lib/types/enums/infoSelfServiceRegistration.d.ts +7 -0
- package/src/lib/types/enums/infoSelfServiceSettings.d.ts +21 -0
- package/src/lib/types/enums/infoSelfServiceVerification.d.ts +6 -0
- package/src/lib/types/enums/misc.d.ts +10 -0
- package/src/lib/types/responseError.d.ts +2 -0
- package/src/lib/types/uiMessage.d.ts +22 -0
- package/src/lib/types/useHandleFlowError.d.ts +5 -0
- package/src/lib/useReauthenticationFlow.d.ts +13 -0
- package/src/lib/useRecoveryFlow.d.ts +15 -0
- package/src/lib/useSettingsFlow.d.ts +15 -0
- package/src/lib/useSignInFlow.d.ts +15 -0
- package/src/lib/useSignUpFlow.d.ts +15 -0
- package/src/lib/useVerificationFlow.d.ts +15 -0
- package/src/lib/utils/filterNodesByGroups.d.ts +23 -0
- package/src/lib/utils/getMessages.d.ts +18 -0
- package/src/lib/utils/getNodeId.d.ts +2 -0
- package/src/lib/utils/getNodeInputType.d.ts +1 -0
- package/src/lib/utils/parseSearchParams.d.ts +1 -0
- package/src/lib/utils/typeGuards.d.ts +6 -0
- package/src/lib/utils/variables.d.ts +2 -0
package/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@leancodepl/kratos",
|
|
3
|
+
"version": "7.1.3",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"main": "./index.cjs.js",
|
|
6
|
+
"module": "./index.esm.js",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@ory/kratos-client": ">=1.0.0",
|
|
9
|
+
"axios": "^0.21.4",
|
|
10
|
+
"lodash": ">=4.0.0",
|
|
11
|
+
"react-hook-form": ">=7.0.0",
|
|
12
|
+
"react-router": ">=6.0.0",
|
|
13
|
+
"rxjs": ">=7.0.0",
|
|
14
|
+
"yn": ">=5.0.0"
|
|
15
|
+
}
|
|
16
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./lib/createKratosClient";
|
|
2
|
+
export * from "./lib/types/uiMessage";
|
|
3
|
+
export * from "./lib/utils/typeGuards";
|
|
4
|
+
export * from "./lib/utils/variables";
|
|
5
|
+
export * from "./lib/utils/getMessages";
|
|
6
|
+
export * from "./lib/sessionManager/baseSessionManager";
|
|
7
|
+
export * from "./lib/types/enums";
|
|
8
|
+
export * from "./lib/types/responseError";
|
|
9
|
+
export * from "./lib/mkAuth";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from "react";
|
|
2
|
+
import { LoginFlow, RecoveryFlow, RegistrationFlow, SettingsFlow, VerificationFlow, UiNodeGroupEnum, UiText } from "@ory/kratos-client";
|
|
3
|
+
import { FieldValues } from "react-hook-form";
|
|
4
|
+
import { NodeFactoryProps } from "./node";
|
|
5
|
+
import { CustomGetMessageProvider, CustomUiMessage } from "./types/uiMessage";
|
|
6
|
+
export type FlowFactoryProps = {
|
|
7
|
+
displayGlobalMessages: (messages: UiText[], customUiMessage?: CustomUiMessage) => void;
|
|
8
|
+
customGetMessageProvider: CustomGetMessageProvider;
|
|
9
|
+
} & NodeFactoryProps;
|
|
10
|
+
type FlowProps<T> = {
|
|
11
|
+
flow: LoginFlow | RegistrationFlow | SettingsFlow | VerificationFlow | RecoveryFlow;
|
|
12
|
+
only?: UiNodeGroupEnum[];
|
|
13
|
+
except?: string[];
|
|
14
|
+
onSubmit: (values: T) => void;
|
|
15
|
+
hideGlobalMessages?: boolean;
|
|
16
|
+
UiMessage?: CustomUiMessage;
|
|
17
|
+
nodesWrapper?: ComponentType<{
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
export declare function flowFactory({ displayGlobalMessages, nodeComponents, customGetMessageProvider: CustomGetMessageProvider, }: FlowFactoryProps): <T extends FieldValues>({ flow, only, except, onSubmit, UiMessage, hideGlobalMessages, nodesWrapper: NodesWrapper, }: FlowProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { UiText } from "@ory/kratos-client";
|
|
3
|
+
import { NodeFactoryProps } from "./node";
|
|
4
|
+
import { CustomGetMessageProvider, CustomUiMessage } from "./types/uiMessage";
|
|
5
|
+
import { UseHandleFlowError } from "./types/useHandleFlowError";
|
|
6
|
+
export type MkAuthProps = {
|
|
7
|
+
useHandleFlowError: UseHandleFlowError;
|
|
8
|
+
displayGlobalMessages: (messages: UiText[], customUiMessage?: CustomUiMessage) => void;
|
|
9
|
+
customGetMessageProvider: CustomGetMessageProvider;
|
|
10
|
+
} & NodeFactoryProps;
|
|
11
|
+
export declare const mkAuth: ({ useHandleFlowError, displayGlobalMessages, nodeComponents, customGetMessageProvider, }: MkAuthProps) => {
|
|
12
|
+
Flow: <T extends import("react-hook-form").FieldValues>({ flow, only, except, onSubmit, UiMessage, hideGlobalMessages, nodesWrapper: NodesWrapper, }: {
|
|
13
|
+
flow: import("@ory/kratos-client").LoginFlow | import("@ory/kratos-client").RegistrationFlow | import("@ory/kratos-client").SettingsFlow | import("@ory/kratos-client").VerificationFlow | import("@ory/kratos-client").RecoveryFlow;
|
|
14
|
+
only?: import("@ory/kratos-client").UiNodeGroupEnum[] | undefined;
|
|
15
|
+
except?: string[] | undefined;
|
|
16
|
+
onSubmit: (values: T) => void;
|
|
17
|
+
hideGlobalMessages?: boolean | undefined;
|
|
18
|
+
UiMessage?: CustomUiMessage | undefined;
|
|
19
|
+
nodesWrapper?: import("react").ComponentType<{
|
|
20
|
+
children: import("react").ReactNode;
|
|
21
|
+
}> | undefined;
|
|
22
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
useReuthenticateFlow: ({ kratosClient, onReauthenticated, }: {
|
|
24
|
+
kratosClient: import("@ory/kratos-client").FrontendApi;
|
|
25
|
+
onReauthenticated: (session: import("@ory/kratos-client").Session) => void;
|
|
26
|
+
}) => {
|
|
27
|
+
flow: import("@ory/kratos-client").LoginFlow | undefined;
|
|
28
|
+
submit: (values: import("@ory/kratos-client").UpdateLoginFlowBody) => Promise<unknown> | undefined;
|
|
29
|
+
};
|
|
30
|
+
useRecoveryFlow: ({ kratosClient, recoveryRoute, onSessionAlreadyAvailable, }: {
|
|
31
|
+
kratosClient: import("@ory/kratos-client").FrontendApi;
|
|
32
|
+
recoveryRoute: string;
|
|
33
|
+
onSessionAlreadyAvailable: () => void;
|
|
34
|
+
}) => {
|
|
35
|
+
flow: import("@ory/kratos-client").RecoveryFlow | undefined;
|
|
36
|
+
submit: (values: import("@ory/kratos-client").UpdateRecoveryFlowBody) => Promise<unknown> | undefined;
|
|
37
|
+
isRecovering: boolean;
|
|
38
|
+
};
|
|
39
|
+
useSettingsFlow: ({ kratosClient, settingsRoute, params, }: {
|
|
40
|
+
kratosClient: import("@ory/kratos-client").FrontendApi;
|
|
41
|
+
settingsRoute: string;
|
|
42
|
+
params?: any;
|
|
43
|
+
}) => {
|
|
44
|
+
flow: import("@ory/kratos-client").SettingsFlow | undefined;
|
|
45
|
+
submit: (values: import("@ory/kratos-client").UpdateSettingsFlowBody) => Promise<unknown> | undefined;
|
|
46
|
+
};
|
|
47
|
+
useSignInFlow: ({ kratosClient, signInRoute, onSignedIn, onSessionAlreadyAvailable, }: {
|
|
48
|
+
kratosClient: import("@ory/kratos-client").FrontendApi;
|
|
49
|
+
signInRoute: string;
|
|
50
|
+
onSignedIn?: ((session: import("@ory/kratos-client").Session) => void) | undefined;
|
|
51
|
+
onSessionAlreadyAvailable?: (() => void) | undefined;
|
|
52
|
+
}) => {
|
|
53
|
+
flow: import("@ory/kratos-client").LoginFlow | undefined;
|
|
54
|
+
submit: (values: import("@ory/kratos-client").UpdateLoginFlowBody) => Promise<unknown> | undefined;
|
|
55
|
+
};
|
|
56
|
+
useSignUpFlow: ({ kratosClient, signUpRoute, onSessionAlreadyAvailable, }: {
|
|
57
|
+
kratosClient: import("@ory/kratos-client").FrontendApi;
|
|
58
|
+
signUpRoute: string;
|
|
59
|
+
onSessionAlreadyAvailable: () => void;
|
|
60
|
+
}) => {
|
|
61
|
+
flow: import("@ory/kratos-client").RegistrationFlow | undefined;
|
|
62
|
+
submit: (values: import("@ory/kratos-client").UpdateRegistrationFlowBody) => Promise<unknown> | undefined;
|
|
63
|
+
isSignedUp: boolean;
|
|
64
|
+
};
|
|
65
|
+
useVerificationFlow: ({ initialFlowId, kratosClient, onVerified, }: {
|
|
66
|
+
initialFlowId?: string | undefined;
|
|
67
|
+
kratosClient: import("@ory/kratos-client").FrontendApi;
|
|
68
|
+
onVerified: () => void;
|
|
69
|
+
}) => {
|
|
70
|
+
flow: import("@ory/kratos-client").VerificationFlow | undefined;
|
|
71
|
+
submit: (values: import("@ory/kratos-client").UpdateVerificationFlowBody) => Promise<unknown> | undefined;
|
|
72
|
+
reset: () => void;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UiNode, UiNodeAnchorAttributes } from "@ory/kratos-client";
|
|
2
|
+
type DefaultNodeAnchorProps = {
|
|
3
|
+
node: UiNode;
|
|
4
|
+
attributes: UiNodeAnchorAttributes;
|
|
5
|
+
};
|
|
6
|
+
export declare function DefaultNodeAnchor({ attributes, node }: DefaultNodeAnchorProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UiNode, UiNodeImageAttributes } from "@ory/kratos-client";
|
|
2
|
+
type DefaultNodeImageProps = {
|
|
3
|
+
node: UiNode;
|
|
4
|
+
attributes: UiNodeImageAttributes;
|
|
5
|
+
};
|
|
6
|
+
export declare function DefaultNodeImage({ attributes, node }: DefaultNodeImageProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UiNode, UiNodeTextAttributes } from "@ory/kratos-client";
|
|
2
|
+
type DefaultNodeTextProps = {
|
|
3
|
+
node: UiNode;
|
|
4
|
+
attributes: UiNodeTextAttributes;
|
|
5
|
+
};
|
|
6
|
+
export declare function DefaultNodeText({ attributes, node }: DefaultNodeTextProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UiNodeInputAttributes } from "@ory/kratos-client";
|
|
2
|
+
type DefaultNodeInputHiddenProps = {
|
|
3
|
+
attributes: UiNodeInputAttributes;
|
|
4
|
+
};
|
|
5
|
+
export declare function DefaultNodeInputHidden({ attributes }: DefaultNodeInputHiddenProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ComponentType } from "react";
|
|
2
|
+
import { UiNode, UiNodeInputAttributes } from "@ory/kratos-client";
|
|
3
|
+
type NodeInputFactoryProps = {
|
|
4
|
+
nodeInputs: {
|
|
5
|
+
NodeInputHidden?: ComponentType<NodeInputHiddenProps>;
|
|
6
|
+
NodeInputCheckbox: ComponentType<NodeInputProps>;
|
|
7
|
+
NodeInputSubmit: ComponentType<NodeInputProps>;
|
|
8
|
+
NodeInputPassword: ComponentType<NodeInputProps>;
|
|
9
|
+
NodeInputDefault: ComponentType<NodeInputProps>;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
type NodeInputProps = {
|
|
13
|
+
node: UiNode;
|
|
14
|
+
attributes: UiNodeInputAttributes;
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
};
|
|
17
|
+
type NodeInputHiddenProps = Omit<NodeInputProps, "node" | "disabled">;
|
|
18
|
+
export declare function nodeInputFactory({ nodeInputs: { NodeInputHidden, NodeInputCheckbox, NodeInputSubmit, NodeInputPassword, NodeInputDefault, }, }: NodeInputFactoryProps): ({ attributes, node, disabled }: NodeInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ComponentType } from "react";
|
|
2
|
+
import { UiNode, UiNodeAnchorAttributes, UiNodeImageAttributes, UiNodeInputAttributes, UiNodeScriptAttributes, UiNodeTextAttributes } from "@ory/kratos-client";
|
|
3
|
+
type NodeTextProps = {
|
|
4
|
+
node: UiNode;
|
|
5
|
+
attributes: UiNodeTextAttributes;
|
|
6
|
+
};
|
|
7
|
+
type NodeInputProps = {
|
|
8
|
+
node: UiNode;
|
|
9
|
+
attributes: UiNodeInputAttributes;
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
};
|
|
12
|
+
type NodeInputHiddenProps = Omit<NodeInputProps, "node" | "disabled">;
|
|
13
|
+
type NodeImageProps = {
|
|
14
|
+
node: UiNode;
|
|
15
|
+
attributes: UiNodeImageAttributes;
|
|
16
|
+
};
|
|
17
|
+
type NodeScriptProps = {
|
|
18
|
+
node: UiNode;
|
|
19
|
+
attributes: UiNodeScriptAttributes;
|
|
20
|
+
};
|
|
21
|
+
type NodeAnchorProps = {
|
|
22
|
+
node: UiNode;
|
|
23
|
+
attributes: UiNodeAnchorAttributes;
|
|
24
|
+
};
|
|
25
|
+
type NodeProps = {
|
|
26
|
+
node: UiNode;
|
|
27
|
+
disabled: boolean;
|
|
28
|
+
};
|
|
29
|
+
export type NodeFactoryProps = {
|
|
30
|
+
nodeComponents: {
|
|
31
|
+
NodeInputHidden?: ComponentType<NodeInputHiddenProps>;
|
|
32
|
+
NodeInputCheckbox: ComponentType<NodeInputProps>;
|
|
33
|
+
NodeInputSubmit: ComponentType<NodeInputProps>;
|
|
34
|
+
NodeInputPassword: ComponentType<NodeInputProps>;
|
|
35
|
+
NodeInputDefault: ComponentType<NodeInputProps>;
|
|
36
|
+
NodeText?: ComponentType<NodeTextProps>;
|
|
37
|
+
NodeImage?: ComponentType<NodeImageProps>;
|
|
38
|
+
NodeScript?: ComponentType<NodeScriptProps>;
|
|
39
|
+
NodeAnchor?: ComponentType<NodeAnchorProps>;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export declare function nodeFactory({ nodeComponents: { NodeImage, NodeText, NodeAnchor, NodeScript, ...nodeInputs }, }: NodeFactoryProps): ({ node, disabled }: NodeProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Session } from "@ory/kratos-client";
|
|
2
|
+
import { Subject } from "rxjs";
|
|
3
|
+
export declare class BaseSessionManager {
|
|
4
|
+
apiUrl: string;
|
|
5
|
+
signInRoute: string;
|
|
6
|
+
session$: Subject<Session | undefined>;
|
|
7
|
+
isSignedIn$: import("rxjs").Observable<boolean>;
|
|
8
|
+
identity$: import("rxjs").Observable<import("@ory/kratos-client").Identity | undefined>;
|
|
9
|
+
userId$: import("rxjs").Observable<string | undefined>;
|
|
10
|
+
setSession(session: Session | undefined): void;
|
|
11
|
+
checkIfSignedIn: () => void;
|
|
12
|
+
signOut: () => Promise<unknown>;
|
|
13
|
+
constructor(authUrl: string, signInRoute: string);
|
|
14
|
+
}
|
|
@@ -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,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,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,22 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from "react";
|
|
2
|
+
import { UiNodeInputAttributes, UiNodeTextAttributes, UiText } from "@ory/kratos-client";
|
|
3
|
+
export type UiMessageProps = {
|
|
4
|
+
text?: UiText;
|
|
5
|
+
attributes?: UiNodeInputAttributes | UiNodeTextAttributes;
|
|
6
|
+
};
|
|
7
|
+
export type UiMessageRenderer = (props: UiMessageProps & {
|
|
8
|
+
customUiMessage?: CustomUiMessage;
|
|
9
|
+
}) => ReactNode;
|
|
10
|
+
type UiMessageContent = (props: UiMessageProps) => ReactNode;
|
|
11
|
+
export type CustomUiMessageParams = {
|
|
12
|
+
text?: UiText;
|
|
13
|
+
attributes?: UiNodeInputAttributes | UiNodeTextAttributes;
|
|
14
|
+
uiMessage: UiMessageContent;
|
|
15
|
+
};
|
|
16
|
+
export type CustomUiMessage = (params: CustomUiMessageParams) => ReactNode;
|
|
17
|
+
type CustomGetMessageProviderProps = {
|
|
18
|
+
uiMessage?: CustomUiMessage;
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
};
|
|
21
|
+
export type CustomGetMessageProvider = ComponentType<CustomGetMessageProviderProps>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FrontendApi, LoginFlow, Session, UpdateLoginFlowBody } from "@ory/kratos-client";
|
|
2
|
+
import { UseHandleFlowError } from "./types/useHandleFlowError";
|
|
3
|
+
type UseReauthenticationFlowProps = {
|
|
4
|
+
useHandleFlowError: UseHandleFlowError;
|
|
5
|
+
};
|
|
6
|
+
export declare function reauthenticationFlowHookFactory({ useHandleFlowError }: UseReauthenticationFlowProps): ({ kratosClient, onReauthenticated, }: {
|
|
7
|
+
kratosClient: FrontendApi;
|
|
8
|
+
onReauthenticated: (session: Session) => void;
|
|
9
|
+
}) => {
|
|
10
|
+
flow: LoginFlow | undefined;
|
|
11
|
+
submit: (values: UpdateLoginFlowBody) => Promise<unknown> | undefined;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FrontendApi, RecoveryFlow, UpdateRecoveryFlowBody } from "@ory/kratos-client";
|
|
2
|
+
import { UseHandleFlowError } from "./types/useHandleFlowError";
|
|
3
|
+
type UseRecoveryFlowProps = {
|
|
4
|
+
useHandleFlowError: UseHandleFlowError;
|
|
5
|
+
};
|
|
6
|
+
export declare function recoveryFlowHookFactory({ useHandleFlowError }: UseRecoveryFlowProps): ({ kratosClient, recoveryRoute, onSessionAlreadyAvailable, }: {
|
|
7
|
+
kratosClient: FrontendApi;
|
|
8
|
+
recoveryRoute: string;
|
|
9
|
+
onSessionAlreadyAvailable: () => void;
|
|
10
|
+
}) => {
|
|
11
|
+
flow: RecoveryFlow | undefined;
|
|
12
|
+
submit: (values: UpdateRecoveryFlowBody) => Promise<unknown> | undefined;
|
|
13
|
+
isRecovering: boolean;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FrontendApi, SettingsFlow, UpdateSettingsFlowBody } from "@ory/kratos-client";
|
|
2
|
+
import { AxiosRequestConfig } from "axios";
|
|
3
|
+
import { UseHandleFlowError } from "./types/useHandleFlowError";
|
|
4
|
+
type UseSettingsFlowFactoryProps = {
|
|
5
|
+
useHandleFlowError: UseHandleFlowError;
|
|
6
|
+
};
|
|
7
|
+
export declare function settingsFlowHookFactory({ useHandleFlowError }: UseSettingsFlowFactoryProps): ({ kratosClient, settingsRoute, params, }: {
|
|
8
|
+
kratosClient: FrontendApi;
|
|
9
|
+
settingsRoute: string;
|
|
10
|
+
params?: AxiosRequestConfig["params"];
|
|
11
|
+
}) => {
|
|
12
|
+
flow: SettingsFlow | undefined;
|
|
13
|
+
submit: (values: UpdateSettingsFlowBody) => Promise<unknown> | undefined;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FrontendApi, LoginFlow, Session, UpdateLoginFlowBody } from "@ory/kratos-client";
|
|
2
|
+
import { UseHandleFlowError } from "./types/useHandleFlowError";
|
|
3
|
+
type UseSignInFlowFactoryProps = {
|
|
4
|
+
useHandleFlowError: UseHandleFlowError;
|
|
5
|
+
};
|
|
6
|
+
export declare function signInFlowHookFactory({ useHandleFlowError }: UseSignInFlowFactoryProps): ({ kratosClient, signInRoute, onSignedIn, onSessionAlreadyAvailable, }: {
|
|
7
|
+
kratosClient: FrontendApi;
|
|
8
|
+
signInRoute: string;
|
|
9
|
+
onSignedIn?: ((session: Session) => void) | undefined;
|
|
10
|
+
onSessionAlreadyAvailable?: (() => void) | undefined;
|
|
11
|
+
}) => {
|
|
12
|
+
flow: LoginFlow | undefined;
|
|
13
|
+
submit: (values: UpdateLoginFlowBody) => Promise<unknown> | undefined;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FrontendApi, RegistrationFlow, UpdateRegistrationFlowBody } from "@ory/kratos-client";
|
|
2
|
+
import { UseHandleFlowError } from "./types/useHandleFlowError";
|
|
3
|
+
type UseSignUpFlowFactoryProps = {
|
|
4
|
+
useHandleFlowError: UseHandleFlowError;
|
|
5
|
+
};
|
|
6
|
+
export declare function signUpFlowHookFactory({ useHandleFlowError }: UseSignUpFlowFactoryProps): ({ kratosClient, signUpRoute, onSessionAlreadyAvailable, }: {
|
|
7
|
+
kratosClient: FrontendApi;
|
|
8
|
+
signUpRoute: string;
|
|
9
|
+
onSessionAlreadyAvailable: () => void;
|
|
10
|
+
}) => {
|
|
11
|
+
flow: RegistrationFlow | undefined;
|
|
12
|
+
submit: (values: UpdateRegistrationFlowBody) => Promise<unknown> | undefined;
|
|
13
|
+
isSignedUp: boolean;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FrontendApi, UpdateVerificationFlowBody, VerificationFlow } from "@ory/kratos-client";
|
|
2
|
+
import { UseHandleFlowError } from "./types/useHandleFlowError";
|
|
3
|
+
type UseVerificationFlowFactoryProps = {
|
|
4
|
+
useHandleFlowError: UseHandleFlowError;
|
|
5
|
+
};
|
|
6
|
+
export declare function verificationFlowHookFactory({ useHandleFlowError }: UseVerificationFlowFactoryProps): ({ initialFlowId, kratosClient, onVerified, }: {
|
|
7
|
+
initialFlowId?: string | undefined;
|
|
8
|
+
kratosClient: FrontendApi;
|
|
9
|
+
onVerified: () => void;
|
|
10
|
+
}) => {
|
|
11
|
+
flow: VerificationFlow | undefined;
|
|
12
|
+
submit: (values: UpdateVerificationFlowBody) => Promise<unknown> | undefined;
|
|
13
|
+
reset: () => void;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { UiNode, UiNodeGroupEnum, UiNodeInputAttributesTypeEnum } from "@ory/kratos-client";
|
|
2
|
+
type FilterNodesByGroups = {
|
|
3
|
+
nodes: Array<UiNode>;
|
|
4
|
+
groups?: Array<UiNodeGroupEnum | string> | UiNodeGroupEnum | string;
|
|
5
|
+
withoutDefaultGroup?: boolean;
|
|
6
|
+
attributes?: Array<UiNodeInputAttributesTypeEnum | string> | UiNodeInputAttributesTypeEnum | string;
|
|
7
|
+
withoutDefaultAttributes?: boolean;
|
|
8
|
+
excludeAttributes?: Array<UiNodeInputAttributesTypeEnum | string> | UiNodeInputAttributesTypeEnum | string;
|
|
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[];
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from "react";
|
|
2
|
+
import { UiNodeInputAttributes, UiText } from "@ory/kratos-client";
|
|
3
|
+
import { CustomUiMessage, UiMessageProps } from "../types/uiMessage";
|
|
4
|
+
type UiMessageRendererProps = UiMessageProps & {
|
|
5
|
+
customUiMessage?: CustomUiMessage;
|
|
6
|
+
};
|
|
7
|
+
export declare function getMessagesFactory({ textWrapper: TextWrapper, uiMessageRenderer, }: {
|
|
8
|
+
textWrapper?: ComponentType<{
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}>;
|
|
11
|
+
uiMessageRenderer: (props: UiMessageRendererProps) => ReactNode;
|
|
12
|
+
}): ({ messages, attributes, customUiMessage, maxMessagesPerGroup, }: {
|
|
13
|
+
messages: UiText[];
|
|
14
|
+
attributes?: UiNodeInputAttributes | undefined;
|
|
15
|
+
customUiMessage?: CustomUiMessage | undefined;
|
|
16
|
+
maxMessagesPerGroup?: number | undefined;
|
|
17
|
+
}) => Partial<Record<"error" | "info" | "success", ReactNode>>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getNodeInputType(attr: unknown): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function parseSearchParams(search: string): Record<string, string>;
|