@leancodepl/kratos 7.2.4 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +3760 -1453
- package/index.esm.js +3748 -1453
- package/package.json +4 -4
- package/src/index.d.ts +7 -5
- package/src/lib/cards/index.d.ts +2 -0
- package/src/lib/cards/userAuthCard.d.ts +20 -0
- package/src/lib/cards/userSettingsCard.d.ts +10 -0
- package/src/lib/createKratosClient.d.ts +1 -1
- package/src/lib/defaultComponents/DefaultButtonComponent/index.d.ts +2 -0
- package/src/lib/defaultComponents/DefaultCheckboxComponent/index.d.ts +2 -0
- package/src/lib/defaultComponents/DefaultImageComponent/index.d.ts +2 -0
- package/src/lib/defaultComponents/DefaultInputComponent/index.d.ts +2 -0
- package/src/lib/defaultComponents/DefaultLinkComponent/index.d.ts +2 -0
- package/src/lib/defaultComponents/DefaultMessageComponent/index.d.ts +2 -0
- package/src/lib/defaultComponents/DefaultMessageFormatComponent/index.d.ts +2 -0
- package/src/lib/defaultComponents/DefaultTextComponent/index.d.ts +2 -0
- package/src/lib/defaultComponents/DefaultUiMessagesComponent/index.d.ts +2 -0
- package/src/lib/defaultComponents.d.ts +2 -0
- package/src/lib/flows/index.d.ts +7 -0
- package/src/lib/flows/useLoginFlow.d.ts +13 -0
- package/src/lib/flows/useLogoutFlow.d.ts +8 -0
- package/src/lib/flows/useReauthenticationFlow.d.ts +8 -0
- package/src/lib/flows/useRecoveryFlow.d.ts +13 -0
- package/src/lib/flows/useRegistrationFlow.d.ts +13 -0
- package/src/lib/flows/useSettingsFlow.d.ts +13 -0
- package/src/lib/flows/useVerificationFlow.d.ts +12 -0
- package/src/lib/helpers/errorMessages.d.ts +7 -0
- package/src/lib/helpers/filterFlowNodes.d.ts +7 -0
- package/src/lib/helpers/formattedMessage.d.ts +4 -0
- package/src/lib/helpers/getNodeLabel.d.ts +2 -0
- package/src/lib/helpers/node.d.ts +7 -0
- package/src/lib/helpers/useScriptNodes.d.ts +5 -0
- package/src/lib/helpers/userAuthForm.d.ts +31 -0
- package/src/lib/kratosContext.d.ts +12 -0
- package/src/lib/kratosContextProvider.d.ts +10 -0
- package/src/lib/sections/authCodeSection.d.ts +14 -0
- package/src/lib/sections/linkSection.d.ts +14 -0
- package/src/lib/sections/loginSection.d.ts +8 -0
- package/src/lib/sections/lookupSecretSettingsSection.d.ts +8 -0
- package/src/lib/sections/oidcSection.d.ts +8 -0
- package/src/lib/sections/oidcSettingsSection.d.ts +8 -0
- package/src/lib/sections/passwordSettingsSection.d.ts +8 -0
- package/src/lib/sections/passwordlessSection.d.ts +8 -0
- package/src/lib/sections/profileSettingsSection.d.ts +8 -0
- package/src/lib/sections/registrationSection.d.ts +8 -0
- package/src/lib/sections/totpSettingsSection.d.ts +8 -0
- package/src/lib/sections/webAuthnSettingsSection.d.ts +8 -0
- package/src/lib/sessionManager/baseSessionManager.d.ts +6 -7
- package/src/lib/types/components.d.ts +75 -0
- package/src/lib/types/useHandleFlowError.d.ts +9 -1
- package/src/lib/utils/filterNodesByGroups.d.ts +2 -3
- package/src/lib/utils/handleCancelError.d.ts +2 -0
- package/src/lib/utils/helpers.d.ts +8 -0
- package/src/lib/utils/typeGuards.d.ts +24 -6
- package/src/lib/utils/variables.d.ts +1 -0
- package/src/lib/flowFactory.d.ts +0 -22
- package/src/lib/mkAuth.d.ts +0 -74
- package/src/lib/node/DefaultNodeAnchor/index.d.ts +0 -7
- package/src/lib/node/DefaultNodeImage/index.d.ts +0 -7
- package/src/lib/node/DefaultNodeText/index.d.ts +0 -7
- package/src/lib/node/NodeInput/defaultNodeInputHidden.d.ts +0 -6
- package/src/lib/node/NodeInput/index.d.ts +0 -19
- package/src/lib/node/index.d.ts +0 -43
- package/src/lib/types/uiMessage.d.ts +0 -22
- package/src/lib/useReauthenticationFlow.d.ts +0 -13
- package/src/lib/useRecoveryFlow.d.ts +0 -15
- package/src/lib/useSettingsFlow.d.ts +0 -15
- package/src/lib/useSignInFlow.d.ts +0 -15
- package/src/lib/useSignUpFlow.d.ts +0 -15
- package/src/lib/useVerificationFlow.d.ts +0 -15
- package/src/lib/utils/getMessages.d.ts +0 -18
- package/src/lib/utils/getNodeId.d.ts +0 -2
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leancodepl/kratos",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@ory/
|
|
7
|
-
"axios": "^0.
|
|
6
|
+
"@ory/client": ">=1.4.3",
|
|
7
|
+
"axios": "^0.27.2",
|
|
8
8
|
"lodash": ">=4.0.0",
|
|
9
|
-
"react-
|
|
9
|
+
"react-intl": ">=6.0.0",
|
|
10
10
|
"react-router": ">=6.0.0",
|
|
11
11
|
"rxjs": ">=7.0.0",
|
|
12
12
|
"yn": ">=5.0.0"
|
package/src/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export * from "./lib/createKratosClient";
|
|
2
|
-
export * from "./lib/
|
|
3
|
-
export * from "./lib/utils/typeGuards";
|
|
2
|
+
export * from "./lib/kratosContextProvider";
|
|
4
3
|
export * from "./lib/utils/variables";
|
|
5
|
-
export * from "./lib/
|
|
4
|
+
export * from "./lib/types/responseError";
|
|
5
|
+
export * from "./lib/types/useHandleFlowError";
|
|
6
6
|
export * from "./lib/sessionManager/baseSessionManager";
|
|
7
7
|
export * from "./lib/types/enums";
|
|
8
|
-
export * from "./lib/types/
|
|
9
|
-
export * from "./lib/
|
|
8
|
+
export * from "./lib/types/components";
|
|
9
|
+
export * from "./lib/utils/typeGuards";
|
|
10
|
+
export * from "./lib/flows";
|
|
11
|
+
export * from "./lib/cards";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LoginFlow, RecoveryFlow, RegistrationFlow, UpdateLoginFlowBody, UpdateRecoveryFlowBody, UpdateRegistrationFlowBody, UpdateVerificationFlowBody, VerificationFlow } from "@ory/client";
|
|
2
|
+
import { UserAuthFormAdditionalProps } from "../helpers/userAuthForm";
|
|
3
|
+
type UserAuthCardProps<TBody> = {
|
|
4
|
+
className?: string;
|
|
5
|
+
flow: LoginFlow | RegistrationFlow | RecoveryFlow | VerificationFlow;
|
|
6
|
+
flowType: "login" | "registration" | "recovery" | "verification";
|
|
7
|
+
} & UserAuthFormAdditionalProps<TBody>;
|
|
8
|
+
export declare const LoginCard: ({ ...props }: Omit<UserAuthCardProps<UpdateLoginFlowBody>, "flow" | "flowType"> & {
|
|
9
|
+
flow: LoginFlow;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const VerificationCard: ({ ...props }: Omit<UserAuthCardProps<UpdateVerificationFlowBody>, "flow" | "flowType"> & {
|
|
12
|
+
flow: VerificationFlow;
|
|
13
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const RegistrationCard: ({ ...props }: Omit<UserAuthCardProps<UpdateRegistrationFlowBody>, "flow" | "flowType"> & {
|
|
15
|
+
flow: RegistrationFlow;
|
|
16
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const RecoveryCard: ({ ...props }: Omit<UserAuthCardProps<UpdateRecoveryFlowBody>, "flow" | "flowType"> & {
|
|
18
|
+
flow: RecoveryFlow;
|
|
19
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { JSX } from "react";
|
|
2
|
+
import { SettingsFlow, UpdateSettingsFlowBody } from "@ory/client";
|
|
3
|
+
import { UserAuthFormAdditionalProps } from "../helpers/userAuthForm";
|
|
4
|
+
export type UserSettingsFlowType = "profile" | "password" | "totp" | "webauthn" | "oidc" | "lookupSecret";
|
|
5
|
+
export type UserSettingsCardProps = {
|
|
6
|
+
flow: SettingsFlow;
|
|
7
|
+
flowType: UserSettingsFlowType;
|
|
8
|
+
className?: string;
|
|
9
|
+
} & UserAuthFormAdditionalProps<UpdateSettingsFlowBody>;
|
|
10
|
+
export declare function UserSettingsCard({ flow, flowType, onSubmit, className }: UserSettingsCardProps): JSX.Element | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ConfigurationParameters, FrontendApi } from "@ory/
|
|
1
|
+
import { ConfigurationParameters, FrontendApi } from "@ory/client";
|
|
2
2
|
export declare function createKratosClient(configuration: ConfigurationParameters): FrontendApi;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FrontendApi, LoginFlow, Session, UpdateLoginFlowBody } from "@ory/client";
|
|
2
|
+
export declare function useLoginFlow({ kratosClient, loginRoute, returnTo, onLoggedIn, onSessionAlreadyAvailable, }: {
|
|
3
|
+
kratosClient: FrontendApi;
|
|
4
|
+
loginRoute: string;
|
|
5
|
+
returnTo?: string;
|
|
6
|
+
onLoggedIn?: (session: Session) => void;
|
|
7
|
+
onSessionAlreadyAvailable?: () => void;
|
|
8
|
+
}): {
|
|
9
|
+
flow: LoginFlow | undefined;
|
|
10
|
+
submit: ({ body }: {
|
|
11
|
+
body: UpdateLoginFlowBody;
|
|
12
|
+
}) => void;
|
|
13
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FrontendApi, LoginFlow, Session, UpdateLoginFlowBody } from "@ory/client";
|
|
2
|
+
export declare function useReauthenticationFlow({ kratosClient, onReauthenticated, }: {
|
|
3
|
+
kratosClient: FrontendApi;
|
|
4
|
+
onReauthenticated: (session: Session) => void;
|
|
5
|
+
}): {
|
|
6
|
+
flow: LoginFlow | undefined;
|
|
7
|
+
submit: (values: UpdateLoginFlowBody) => Promise<unknown> | undefined;
|
|
8
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ContinueWith, FrontendApi, RecoveryFlow, UpdateRecoveryFlowBody } from "@ory/client";
|
|
2
|
+
export declare function useRecoveryFlow({ kratosClient, recoveryRoute, onSessionAlreadyAvailable, onContinueWith, }: {
|
|
3
|
+
kratosClient: FrontendApi;
|
|
4
|
+
recoveryRoute: string;
|
|
5
|
+
onSessionAlreadyAvailable: () => void;
|
|
6
|
+
onContinueWith?: (continueWith: ContinueWith[]) => void;
|
|
7
|
+
}): {
|
|
8
|
+
flow: RecoveryFlow | undefined;
|
|
9
|
+
submit: ({ body }: {
|
|
10
|
+
body: UpdateRecoveryFlowBody;
|
|
11
|
+
}) => Promise<unknown> | undefined;
|
|
12
|
+
isRecovering: boolean;
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ContinueWith, FrontendApi, RegistrationFlow, UpdateRegistrationFlowBody } from "@ory/client";
|
|
2
|
+
export declare function useRegisterFlow({ kratosClient, registrationRoute, onSessionAlreadyAvailable, onContinueWith, }: {
|
|
3
|
+
kratosClient: FrontendApi;
|
|
4
|
+
registrationRoute: string;
|
|
5
|
+
onSessionAlreadyAvailable: () => void;
|
|
6
|
+
onContinueWith?: (continueWith: ContinueWith[]) => void;
|
|
7
|
+
}): {
|
|
8
|
+
flow: RegistrationFlow | undefined;
|
|
9
|
+
submit: ({ body }: {
|
|
10
|
+
body: UpdateRegistrationFlowBody;
|
|
11
|
+
}) => Promise<unknown> | undefined;
|
|
12
|
+
isRegistered: boolean;
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ContinueWith, FrontendApi, SettingsFlow, UpdateSettingsFlowBody } from "@ory/client";
|
|
2
|
+
import { AxiosRequestConfig } from "axios";
|
|
3
|
+
export declare function useSettingsFlow({ kratosClient, settingsRoute, params, onContinueWith, }: {
|
|
4
|
+
kratosClient: FrontendApi;
|
|
5
|
+
settingsRoute: string;
|
|
6
|
+
params?: AxiosRequestConfig["params"];
|
|
7
|
+
onContinueWith?: (continueWith: ContinueWith[]) => void;
|
|
8
|
+
}): {
|
|
9
|
+
flow: SettingsFlow | undefined;
|
|
10
|
+
submit: ({ body }: {
|
|
11
|
+
body: UpdateSettingsFlowBody;
|
|
12
|
+
}) => Promise<unknown> | undefined;
|
|
13
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FrontendApi, UpdateVerificationFlowBody, VerificationFlow } from "@ory/client";
|
|
2
|
+
export declare function useVerificationFlow({ initialFlowId, kratosClient, onVerified, }: {
|
|
3
|
+
initialFlowId?: string;
|
|
4
|
+
kratosClient: FrontendApi;
|
|
5
|
+
onVerified: () => void;
|
|
6
|
+
}): {
|
|
7
|
+
flow: VerificationFlow | undefined;
|
|
8
|
+
submit: ({ body }: {
|
|
9
|
+
body: UpdateVerificationFlowBody;
|
|
10
|
+
}) => Promise<unknown> | undefined;
|
|
11
|
+
reset: () => void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FilterNodesByGroups } from "../utils/filterNodesByGroups";
|
|
2
|
+
type FilterFlowNodesProps = {
|
|
3
|
+
filter: FilterNodesByGroups;
|
|
4
|
+
includeCSRF?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare function FilterFlowNodes({ filter, includeCSRF, ...overrides }: FilterFlowNodesProps): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { LoginFlow, RecoveryFlow, RegistrationFlow, SettingsFlow, VerificationFlow } from "@ory/client";
|
|
3
|
+
import { FilterNodesByGroups } from "../utils/filterNodesByGroups";
|
|
4
|
+
export type SelfServiceFlow = LoginFlow | RecoveryFlow | RegistrationFlow | SettingsFlow | VerificationFlow;
|
|
5
|
+
/**
|
|
6
|
+
* Additional props that can be passed to the UserAuthForm component
|
|
7
|
+
* @see UserAuthForm
|
|
8
|
+
*
|
|
9
|
+
* @param onSubmit - function that is called when the form is submitted. It automatically maps the form data to the request body and prevents native form submits.
|
|
10
|
+
*/
|
|
11
|
+
export type UserAuthFormAdditionalProps<TBody> = {
|
|
12
|
+
onSubmit?: ({ body, event }: {
|
|
13
|
+
body: TBody;
|
|
14
|
+
event?: React.FormEvent<HTMLFormElement>;
|
|
15
|
+
}) => void;
|
|
16
|
+
};
|
|
17
|
+
export type UserAuthFormProps<TBody> = {
|
|
18
|
+
flow: SelfServiceFlow;
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
formFilterOverride?: FilterNodesByGroups;
|
|
21
|
+
submitOnEnter?: boolean;
|
|
22
|
+
className?: string;
|
|
23
|
+
} & Omit<React.FormHTMLAttributes<HTMLFormElement>, "onSubmit"> & UserAuthFormAdditionalProps<TBody>;
|
|
24
|
+
/**
|
|
25
|
+
* UserAuthForm is a component that renders a form for a given Ory flow.
|
|
26
|
+
* It automatically adds the form action and method and adds csrf tokens to the form.
|
|
27
|
+
* When the `onSubmit` parameter is passed, it also automatically maps the form data to the request body and prevents native form submits.
|
|
28
|
+
* @see UserAuthFormProps
|
|
29
|
+
* @returns JSX.Element
|
|
30
|
+
*/
|
|
31
|
+
export declare function UserAuthForm<TBody>({ flow, children, submitOnEnter, onSubmit, formFilterOverride, ...props }: UserAuthFormProps<TBody>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { KratosComponents } from "./types/components";
|
|
3
|
+
import type { UseHandleFlowError } from "./types/useHandleFlowError";
|
|
4
|
+
export type KratosContextData = {
|
|
5
|
+
components: KratosComponents | undefined;
|
|
6
|
+
useHandleFlowError: UseHandleFlowError;
|
|
7
|
+
excludeScripts: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const kratosContext: import("react").Context<KratosContextData>;
|
|
10
|
+
export declare function useKratosContext(): KratosContextData & {
|
|
11
|
+
components: KratosComponents;
|
|
12
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
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,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 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 { 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,8 @@
|
|
|
1
|
+
import { ElementType } from "react";
|
|
2
|
+
import { SettingsFlow } from "@ory/client";
|
|
3
|
+
type WebAuthnSettingsProps = {
|
|
4
|
+
flow: SettingsFlow;
|
|
5
|
+
WebAuthnSettingsSectionWrapper: ElementType;
|
|
6
|
+
};
|
|
7
|
+
export declare function WebAuthnSettingsSection({ flow, WebAuthnSettingsSectionWrapper }: WebAuthnSettingsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export {};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { Session } from "@ory/
|
|
1
|
+
import { Session } from "@ory/client";
|
|
2
2
|
import { Subject } from "rxjs";
|
|
3
3
|
export declare class BaseSessionManager {
|
|
4
4
|
authUrl: string;
|
|
5
|
-
|
|
5
|
+
loginRoute: string;
|
|
6
6
|
session$: Subject<Session | undefined>;
|
|
7
|
-
|
|
8
|
-
identity$: import("rxjs").Observable<import("@ory/
|
|
7
|
+
isLoggedIn: import("rxjs").Observable<boolean>;
|
|
8
|
+
identity$: import("rxjs").Observable<import("@ory/client").Identity | undefined>;
|
|
9
9
|
userId$: import("rxjs").Observable<string | undefined>;
|
|
10
10
|
setSession(session: Session | undefined): void;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
constructor(authUrl: string, signInRoute: string);
|
|
11
|
+
checkIfLoggedIn: () => void;
|
|
12
|
+
constructor(authUrl: string, loginRoute: string);
|
|
14
13
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
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 = React.ImgHTMLAttributes<HTMLImageElement> & {
|
|
7
|
+
header?: ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
} & Node;
|
|
10
|
+
export type TextComponentProps = {
|
|
11
|
+
label?: ReactNode;
|
|
12
|
+
id: string;
|
|
13
|
+
codes?: UiText[];
|
|
14
|
+
attributes: UiNodeTextAttributes;
|
|
15
|
+
} & Node;
|
|
16
|
+
export type LinkComponentProps = {
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
href?: string;
|
|
19
|
+
icon?: string;
|
|
20
|
+
className?: string;
|
|
21
|
+
} & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href"> & Node;
|
|
22
|
+
export type InputComponentProps = {
|
|
23
|
+
header: ReactNode;
|
|
24
|
+
helperMessage?: ReactNode;
|
|
25
|
+
isError?: boolean;
|
|
26
|
+
} & React.InputHTMLAttributes<HTMLInputElement> & Node;
|
|
27
|
+
export type MessageComponentProps = {
|
|
28
|
+
message: UiText;
|
|
29
|
+
key: string;
|
|
30
|
+
severity: Severity;
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
};
|
|
33
|
+
export type Severity = UiTextTypeEnum | "disabled" | "default";
|
|
34
|
+
export type ButtonComponentProps = {
|
|
35
|
+
header?: ReactNode;
|
|
36
|
+
fullWidth?: boolean;
|
|
37
|
+
social?: string;
|
|
38
|
+
} & React.ButtonHTMLAttributes<HTMLButtonElement> & Node;
|
|
39
|
+
export type CheckboxComponentProps = {
|
|
40
|
+
label?: ReactNode;
|
|
41
|
+
helperMessage?: ReactNode;
|
|
42
|
+
isError?: boolean;
|
|
43
|
+
} & React.InputHTMLAttributes<HTMLInputElement> & Node;
|
|
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
|
+
};
|
|
75
|
+
export {};
|
|
@@ -1,5 +1,13 @@
|
|
|
1
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
|
+
};
|
|
2
10
|
export type UseHandleFlowError = (props: {
|
|
3
11
|
resetFlow: (newFlowId?: string) => void;
|
|
4
12
|
onSessionAlreadyAvailable?: () => void;
|
|
5
|
-
}) => (err: AxiosError) => Promise<unknown>;
|
|
13
|
+
}) => (err: AxiosError<FlowErrorResponse>) => Promise<unknown>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UiNode, UiNodeGroupEnum, UiNodeInputAttributesTypeEnum } from "@ory/
|
|
2
|
-
type FilterNodesByGroups = {
|
|
1
|
+
import { UiNode, UiNodeGroupEnum, UiNodeInputAttributesTypeEnum } from "@ory/client";
|
|
2
|
+
export type FilterNodesByGroups = {
|
|
3
3
|
nodes: Array<UiNode>;
|
|
4
4
|
groups?: Array<UiNodeGroupEnum | string> | UiNodeGroupEnum | string;
|
|
5
5
|
withoutDefaultGroup?: boolean;
|
|
@@ -20,4 +20,3 @@ type FilterNodesByGroups = {
|
|
|
20
20
|
* @param {boolean} filterNodesByGroups.withoutDefaultAttributes - If true, will not add default attributes such as 'hidden' and 'script'.
|
|
21
21
|
*/
|
|
22
22
|
export declare const filterNodesByGroups: ({ nodes, groups, withoutDefaultGroup, attributes, withoutDefaultAttributes, excludeAttributes, }: FilterNodesByGroups) => UiNode[];
|
|
23
|
-
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
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 hasWebauthn(nodes: UiNode[]): boolean;
|
|
5
|
+
export declare function hasLookupSecret(nodes: UiNode[]): boolean;
|
|
6
|
+
export declare function hasTotp(nodes: UiNode[]): boolean;
|
|
7
|
+
export declare function hasCode(nodes: UiNode[]): boolean;
|
|
8
|
+
export declare function hasHiddenIdentifier(nodes: UiNode[]): boolean;
|