@leancodepl/kratos 9.6.1 → 9.6.2

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 CHANGED
@@ -283,7 +283,7 @@ function RegisterPage() {
283
283
  ### Settings Flow
284
284
 
285
285
  ```tsx
286
- import { SettingsFlow } from "./kratosService"
286
+ import { SettingsFlow, settingsFlow } from "./kratosService"
287
287
 
288
288
  function SettingsPage() {
289
289
  const { isLoggedIn, isLoading } = sessionManager.useIsLoggedIn()
@@ -298,13 +298,7 @@ function SettingsPage() {
298
298
  passkeysForm={PasskeysForm}
299
299
  totpForm={TotpForm}
300
300
  oidcForm={OidcForm}
301
- settingsForm={({ traitsForm, newPasswordForm, passkeysForm }) => (
302
- <div>
303
- {traitsForm}
304
- {newPasswordForm}
305
- {passkeysForm}
306
- </div>
307
- )}
301
+ settingsForm={SettingsForm}
308
302
  onChangePasswordSuccess={() => {
309
303
  console.log("Password updated")
310
304
  }}
@@ -314,6 +308,20 @@ function SettingsPage() {
314
308
  />
315
309
  )
316
310
  }
311
+
312
+ function SettingsForm({ isLoading, traitsForm, newPasswordForm, passkeysForm }: settingsFlow.SettingsFormProps) {
313
+ if (isLoading) {
314
+ return <div>...loading</div>
315
+ }
316
+
317
+ return (
318
+ <div>
319
+ {traitsForm}
320
+ {newPasswordForm}
321
+ {passkeysForm}
322
+ </div>
323
+ )
324
+ }
317
325
  ```
318
326
 
319
327
  ### Logout Functionality
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leancodepl/kratos",
3
- "version": "9.6.1",
3
+ "version": "9.6.2",
4
4
  "license": "Apache-2.0",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -10,7 +10,7 @@
10
10
  "node": ">=18.0.0"
11
11
  },
12
12
  "dependencies": {
13
- "@leancodepl/utils": "9.6.1",
13
+ "@leancodepl/utils": "9.6.2",
14
14
  "@radix-ui/react-slot": ">=1.0.0",
15
15
  "@tanstack/react-form": ">=1.0.0",
16
16
  "@tanstack/react-query": ">=5.0.0"
@@ -6,6 +6,15 @@ import { PasskeysFormProps } from "./passkeysForm";
6
6
  import { TotpFormProps } from "./totpForm";
7
7
  import { TraitsFormProps } from "./traitsForm";
8
8
  import { OnSettingsFlowError } from "./types";
9
+ export type SettingsFormProps = {
10
+ isLoading?: boolean;
11
+ emailVerificationRequired: boolean;
12
+ newPasswordForm: ReactNode;
13
+ traitsForm?: ReactNode;
14
+ passkeysForm?: ReactNode;
15
+ totpForm?: ReactNode;
16
+ oidcForm?: ReactNode;
17
+ };
9
18
  export type SettingsFlowProps<TTraitsConfig extends TraitsConfig> = {
10
19
  traitsConfig?: TTraitsConfig;
11
20
  traitsForm?: ComponentType<TraitsFormProps<TTraitsConfig>>;
@@ -19,15 +28,7 @@ export type SettingsFlowProps<TTraitsConfig extends TraitsConfig> = {
19
28
  onChangePasswordSuccess?: () => void;
20
29
  onChangeTraitsSuccess?: () => void;
21
30
  onFlowRestart?: () => void;
22
- settingsForm: ComponentType<{
23
- isLoading?: boolean;
24
- emailVerificationRequired: boolean;
25
- newPasswordForm: ReactNode;
26
- traitsForm?: ReactNode;
27
- passkeysForm?: ReactNode;
28
- totpForm?: ReactNode;
29
- oidcForm?: ReactNode;
30
- }>;
31
+ settingsForm: ComponentType<SettingsFormProps>;
31
32
  };
32
33
  /**
33
34
  * Renders a complete settings flow with user account management capabilities.