@leancodepl/kratos 9.2.1 → 9.4.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/README.md CHANGED
@@ -234,6 +234,7 @@ import { LoginFlow } from "./kratosService"
234
234
  function LoginPage() {
235
235
  return (
236
236
  <LoginFlow
237
+ loaderComponent={Loader}
237
238
  chooseMethodForm={ChooseMethodForm}
238
239
  secondFactorForm={SecondFactorForm}
239
240
  secondFactorEmailForm={SecondFactorEmailForm}
@@ -437,28 +438,30 @@ function LoginPage() {
437
438
  }
438
439
 
439
440
  function ChooseMethodForm(props: loginFlow.ChooseMethodFormProps) {
440
- if (props.isLoading) {
441
- return <p>Loading login methods...</p>
442
- }
443
-
444
- const { Password, Google, Passkey, Apple, Facebook, errors, isSubmitting, isValidating } = props
441
+ const { errors, isSubmitting, isValidating } = props
445
442
 
446
443
  if (props.isRefresh) {
447
- const { identifier } = props
444
+ const { passwordFields, Google, Passkey, Apple, Facebook, identifier } = props
448
445
 
449
446
  return (
450
447
  <div>
451
- <h2>
452
- Complete login process as <strong>{identifier}</strong>
453
- </h2>
454
-
455
- {Password && (
456
- <Password>
457
- <input placeholder="Password" />
458
- </Password>
448
+ {identifier && (
449
+ <h2>
450
+ Complete login process as <strong>{identifier}</strong>
451
+ </h2>
459
452
  )}
460
453
 
461
- <button type="submit">Login</button>
454
+ {passwordFields && (
455
+ <>
456
+ <passwordFields.Password>
457
+ <input placeholder="Password" />
458
+ </passwordFields.Password>
459
+
460
+ <passwordFields.Submit>
461
+ <button>Login</button>
462
+ </passwordFields.Submit>
463
+ </>
464
+ )}
462
465
 
463
466
  {Google && (
464
467
  <Google>
@@ -495,47 +498,43 @@ function ChooseMethodForm(props: loginFlow.ChooseMethodFormProps) {
495
498
  )
496
499
  }
497
500
 
498
- const { Identifier } = props
501
+ const {
502
+ passwordFields: { Identifier, Password, Submit },
503
+ Google,
504
+ Passkey,
505
+ Apple,
506
+ Facebook,
507
+ } = props
499
508
 
500
509
  return (
501
510
  <div>
502
- {Identifier && (
503
- <Identifier>
504
- <input placeholder="Identifier" />
505
- </Identifier>
506
- )}
511
+ <Identifier>
512
+ <input placeholder="Identifier" />
513
+ </Identifier>
507
514
 
508
- {Password && (
509
- <Password>
510
- <input placeholder="Password" />
511
- </Password>
512
- )}
515
+ <Password>
516
+ <input placeholder="Password" />
517
+ </Password>
513
518
 
514
- <button type="submit">Login</button>
519
+ <Submit>
520
+ <button>Login</button>
521
+ </Submit>
515
522
 
516
- {Google && (
517
- <Google>
518
- <button>Sign in with Google</button>
519
- </Google>
520
- )}
523
+ <Google>
524
+ <button>Sign in with Google</button>
525
+ </Google>
521
526
 
522
- {Apple && (
523
- <Apple>
524
- <button>Sign in with Apple</button>
525
- </Apple>
526
- )}
527
+ <Apple>
528
+ <button>Sign in with Apple</button>
529
+ </Apple>
527
530
 
528
- {Facebook && (
529
- <Facebook>
530
- <button>Sign in with Facebook</button>
531
- </Facebook>
532
- )}
531
+ <Facebook>
532
+ <button>Sign in with Facebook</button>
533
+ </Facebook>
533
534
 
534
- {Passkey && (
535
- <Passkey>
536
- <button>Sign in with Passkey</button>
537
- </Passkey>
538
- )}
535
+ <Passkey>
536
+ <button>Sign in with Passkey</button>
537
+ </Passkey>
539
538
 
540
539
  {errors && errors.length > 0 && (
541
540
  <div>