dauth-context-react 6.5.0 → 6.6.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.
@@ -7,10 +7,7 @@ import React, {
7
7
  } from 'react';
8
8
  import { createPortal } from 'react-dom';
9
9
  import { useDauth } from './index';
10
- import type {
11
- DauthProfileModalProps,
12
- IPasskeyCredential,
13
- } from './interfaces';
10
+ import type { DauthProfileModalProps, IPasskeyCredential } from './interfaces';
14
11
 
15
12
  export { type DauthProfileModalProps };
16
13
 
@@ -166,14 +163,11 @@ function Spinner() {
166
163
 
167
164
  function useMediaQuery(query: string): boolean {
168
165
  const [matches, setMatches] = useState(
169
- () =>
170
- typeof window !== 'undefined' &&
171
- window.matchMedia(query).matches
166
+ () => typeof window !== 'undefined' && window.matchMedia(query).matches
172
167
  );
173
168
  useEffect(() => {
174
169
  const mq = window.matchMedia(query);
175
- const handler = (e: MediaQueryListEvent) =>
176
- setMatches(e.matches);
170
+ const handler = (e: MediaQueryListEvent) => setMatches(e.matches);
177
171
  mq.addEventListener('change', handler);
178
172
  return () => mq.removeEventListener('change', handler);
179
173
  }, [query]);
@@ -193,10 +187,7 @@ function useModalAnimation(open: boolean): Phase {
193
187
  }
194
188
  if (phase === 'entered' || phase === 'entering') {
195
189
  setPhase('exiting');
196
- const timer = setTimeout(
197
- () => setPhase('exited'),
198
- MOBILE_TRANSITION_MS
199
- );
190
+ const timer = setTimeout(() => setPhase('exited'), MOBILE_TRANSITION_MS);
200
191
  return () => clearTimeout(timer);
201
192
  }
202
193
  return undefined;
@@ -234,20 +225,16 @@ function useFocusTrap(
234
225
  return;
235
226
  }
236
227
  if (e.key !== 'Tab') return;
237
- const focusable =
238
- container.querySelectorAll<HTMLElement>(
239
- 'button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])'
240
- );
228
+ const focusable = container.querySelectorAll<HTMLElement>(
229
+ 'button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])'
230
+ );
241
231
  if (focusable.length === 0) return;
242
232
  const first = focusable[0];
243
233
  const last = focusable[focusable.length - 1];
244
234
  if (e.shiftKey && document.activeElement === first) {
245
235
  e.preventDefault();
246
236
  last.focus();
247
- } else if (
248
- !e.shiftKey &&
249
- document.activeElement === last
250
- ) {
237
+ } else if (!e.shiftKey && document.activeElement === last) {
251
238
  e.preventDefault();
252
239
  first.focus();
253
240
  }
@@ -268,8 +255,7 @@ function useScrollLock(active: boolean) {
268
255
  useEffect(() => {
269
256
  if (!active) return;
270
257
  const scrollbarWidth =
271
- window.innerWidth -
272
- document.documentElement.clientWidth;
258
+ window.innerWidth - document.documentElement.clientWidth;
273
259
  const prevOverflow = document.body.style.overflow;
274
260
  const prevPaddingRight = document.body.style.paddingRight;
275
261
  document.body.style.overflow = 'hidden';
@@ -336,9 +322,7 @@ export function DauthProfileModal({
336
322
  const [deleting, setDeleting] = useState(false);
337
323
 
338
324
  // Passkey state
339
- const [credentials, setCredentials] = useState<
340
- IPasskeyCredential[]
341
- >([]);
325
+ const [credentials, setCredentials] = useState<IPasskeyCredential[]>([]);
342
326
  const [loadingCreds, setLoadingCreds] = useState(false);
343
327
  const [showRegister, setShowRegister] = useState(false);
344
328
  const [passkeyName, setPasskeyName] = useState('');
@@ -349,8 +333,7 @@ export function DauthProfileModal({
349
333
  } | null>(null);
350
334
 
351
335
  // Avatar upload state
352
- const [uploadingAvatar, setUploadingAvatar] =
353
- useState(false);
336
+ const [uploadingAvatar, setUploadingAvatar] = useState(false);
354
337
 
355
338
  // Populate form when modal opens
356
339
  useEffect(() => {
@@ -363,9 +346,7 @@ export function DauthProfileModal({
363
346
  setTelSuffix(user.telSuffix || '');
364
347
  setBirthDate(
365
348
  user.birthDate
366
- ? new Date(user.birthDate)
367
- .toISOString()
368
- .split('T')[0]
349
+ ? new Date(user.birthDate).toISOString().split('T')[0]
369
350
  : ''
370
351
  );
371
352
  const cf: Record<string, string> = {};
@@ -400,19 +381,13 @@ export function DauthProfileModal({
400
381
  // Auto-clear success message
401
382
  useEffect(() => {
402
383
  if (status?.type !== 'success') return;
403
- const timer = setTimeout(
404
- () => setStatus(null),
405
- SUCCESS_TIMEOUT_MS
406
- );
384
+ const timer = setTimeout(() => setStatus(null), SUCCESS_TIMEOUT_MS);
407
385
  return () => clearTimeout(timer);
408
386
  }, [status]);
409
387
 
410
388
  useEffect(() => {
411
389
  if (passkeyStatus?.type !== 'success') return;
412
- const timer = setTimeout(
413
- () => setPasskeyStatus(null),
414
- SUCCESS_TIMEOUT_MS
415
- );
390
+ const timer = setTimeout(() => setPasskeyStatus(null), SUCCESS_TIMEOUT_MS);
416
391
  return () => clearTimeout(timer);
417
392
  }, [passkeyStatus]);
418
393
 
@@ -421,15 +396,13 @@ export function DauthProfileModal({
421
396
 
422
397
  const hasField = useCallback(
423
398
  (field: string) =>
424
- domain.formFields?.some((f) => f.field === field) ??
425
- false,
399
+ domain.formFields?.some((f) => f.field === field) ?? false,
426
400
  [domain.formFields]
427
401
  );
428
402
 
429
403
  const isRequired = useCallback(
430
404
  (field: string) =>
431
- domain.formFields?.find((f) => f.field === field)
432
- ?.required ?? false,
405
+ domain.formFields?.find((f) => f.field === field)?.required ?? false,
433
406
  [domain.formFields]
434
407
  );
435
408
 
@@ -440,8 +413,7 @@ export function DauthProfileModal({
440
413
  : '';
441
414
  const cfChanged = (domain.customFields ?? []).some(
442
415
  (f) =>
443
- (customFieldValues[f.key] ?? '') !==
444
- (user.customFields?.[f.key] ?? '')
416
+ (customFieldValues[f.key] ?? '') !== (user.customFields?.[f.key] ?? '')
445
417
  );
446
418
  return (
447
419
  name !== (user.name || '') ||
@@ -466,8 +438,7 @@ export function DauthProfileModal({
466
438
  domain.customFields,
467
439
  ]);
468
440
 
469
- const canSave =
470
- name.trim().length > 0 && hasChanges && !saving;
441
+ const canSave = name.trim().length > 0 && hasChanges && !saving;
471
442
 
472
443
  const handleSave = useCallback(async () => {
473
444
  setSaving(true);
@@ -476,12 +447,9 @@ export function DauthProfileModal({
476
447
  if (hasField('lastname')) fields.lastname = lastname;
477
448
  if (hasField('nickname')) fields.nickname = nickname;
478
449
  if (hasField('country')) fields.country = country;
479
- if (hasField('tel_prefix'))
480
- fields.telPrefix = telPrefix;
481
- if (hasField('tel_suffix'))
482
- fields.telSuffix = telSuffix;
483
- if (hasField('birth_date') && birthDate)
484
- fields.birthDate = birthDate;
450
+ if (hasField('tel_prefix')) fields.telPrefix = telPrefix;
451
+ if (hasField('tel_suffix')) fields.telSuffix = telSuffix;
452
+ if (hasField('birth_date') && birthDate) fields.birthDate = birthDate;
485
453
  if ((domain.customFields ?? []).length > 0)
486
454
  fields.customFields = customFieldValues;
487
455
  const ok = await updateUser(fields);
@@ -520,8 +488,7 @@ export function DauthProfileModal({
520
488
  } else {
521
489
  setStatus({
522
490
  type: 'error',
523
- message:
524
- 'Could not delete account. Please try again.',
491
+ message: 'Could not delete account. Please try again.',
525
492
  });
526
493
  setShowDelete(false);
527
494
  setDeleteText('');
@@ -538,9 +505,7 @@ export function DauthProfileModal({
538
505
  const handleRegisterPasskey = useCallback(async () => {
539
506
  setRegistering(true);
540
507
  setPasskeyStatus(null);
541
- const cred = await registerPasskey(
542
- passkeyName || undefined
543
- );
508
+ const cred = await registerPasskey(passkeyName || undefined);
544
509
  setRegistering(false);
545
510
  if (cred) {
546
511
  setCredentials((prev) => [...prev, cred]);
@@ -562,9 +527,7 @@ export function DauthProfileModal({
562
527
  async (credentialId: string) => {
563
528
  const ok = await deletePasskeyCredential(credentialId);
564
529
  if (ok) {
565
- setCredentials((prev) =>
566
- prev.filter((c) => c._id !== credentialId)
567
- );
530
+ setCredentials((prev) => prev.filter((c) => c._id !== credentialId));
568
531
  }
569
532
  },
570
533
  [deletePasskeyCredential]
@@ -610,15 +573,11 @@ export function DauthProfileModal({
610
573
  if (!t) return {};
611
574
  const vars: Record<string, string> = {};
612
575
  if (t.accent) vars['--dauth-accent'] = t.accent;
613
- if (t.accentHover)
614
- vars['--dauth-accent-hover'] = t.accentHover;
576
+ if (t.accentHover) vars['--dauth-accent-hover'] = t.accentHover;
615
577
  if (t.surface) vars['--dauth-surface'] = t.surface;
616
- if (t.surfaceHover)
617
- vars['--dauth-surface-hover'] = t.surfaceHover;
618
- if (t.textPrimary)
619
- vars['--dauth-text-primary'] = t.textPrimary;
620
- if (t.textSecondary)
621
- vars['--dauth-text-secondary'] = t.textSecondary;
578
+ if (t.surfaceHover) vars['--dauth-surface-hover'] = t.surfaceHover;
579
+ if (t.textPrimary) vars['--dauth-text-primary'] = t.textPrimary;
580
+ if (t.textSecondary) vars['--dauth-text-secondary'] = t.textSecondary;
622
581
  if (t.border) vars['--dauth-border'] = t.border;
623
582
  return vars;
624
583
  }, [domain.modalTheme]);
@@ -632,8 +591,7 @@ export function DauthProfileModal({
632
591
  position: 'fixed',
633
592
  inset: 0,
634
593
  zIndex: 2147483647,
635
- backgroundColor:
636
- 'var(--dauth-backdrop, rgba(0, 0, 0, 0.6))',
594
+ backgroundColor: 'var(--dauth-backdrop, rgba(0, 0, 0, 0.6))',
637
595
  backdropFilter: 'blur(4px)',
638
596
  WebkitBackdropFilter: 'blur(4px)',
639
597
  display: 'flex',
@@ -651,10 +609,8 @@ export function DauthProfileModal({
651
609
  margin: 16,
652
610
  backgroundColor: 'var(--dauth-surface, #1a1a2e)',
653
611
  borderRadius: 'var(--dauth-radius, 12px)',
654
- boxShadow:
655
- 'var(--dauth-shadow, 0 25px 50px -12px rgba(0, 0, 0, 0.5))',
656
- border:
657
- '1px solid var(--dauth-border, rgba(255, 255, 255, 0.08))',
612
+ boxShadow: 'var(--dauth-shadow, 0 25px 50px -12px rgba(0, 0, 0, 0.5))',
613
+ border: '1px solid var(--dauth-border, rgba(255, 255, 255, 0.08))',
658
614
  display: 'flex',
659
615
  flexDirection: 'column',
660
616
  overflow: 'hidden',
@@ -662,10 +618,7 @@ export function DauthProfileModal({
662
618
  'var(--dauth-font-family, system-ui, -apple-system, sans-serif)',
663
619
  color: 'var(--dauth-text-primary, #e4e4e7)',
664
620
  opacity: phase === 'entered' ? 1 : 0,
665
- transform:
666
- phase === 'entered'
667
- ? 'translateY(0)'
668
- : 'translateY(16px)',
621
+ transform: phase === 'entered' ? 'translateY(0)' : 'translateY(16px)',
669
622
  transition: `opacity ${dur}ms ${easing}, transform ${dur}ms ${easing}`,
670
623
  };
671
624
 
@@ -678,10 +631,7 @@ export function DauthProfileModal({
678
631
  fontFamily:
679
632
  'var(--dauth-font-family, system-ui, -apple-system, sans-serif)',
680
633
  color: 'var(--dauth-text-primary, #e4e4e7)',
681
- transform:
682
- phase === 'entered'
683
- ? 'translateY(0)'
684
- : 'translateY(100%)',
634
+ transform: phase === 'entered' ? 'translateY(0)' : 'translateY(100%)',
685
635
  transition: `transform ${dur}ms ${easing}`,
686
636
  };
687
637
 
@@ -691,9 +641,7 @@ export function DauthProfileModal({
691
641
 
692
642
  const tabs: { key: Tab; label: string }[] = [
693
643
  { key: 'profile', label: 'Profile' },
694
- ...(showSecurity
695
- ? [{ key: 'security' as Tab, label: 'Security' }]
696
- : []),
644
+ ...(showSecurity ? [{ key: 'security' as Tab, label: 'Security' }] : []),
697
645
  { key: 'account', label: 'Account' },
698
646
  ];
699
647
 
@@ -701,8 +649,7 @@ export function DauthProfileModal({
701
649
  <>
702
650
  <style
703
651
  dangerouslySetInnerHTML={{
704
- __html:
705
- '@keyframes dauth-spin{to{transform:rotate(360deg)}}',
652
+ __html: '@keyframes dauth-spin{to{transform:rotate(360deg)}}',
706
653
  }}
707
654
  />
708
655
  <div
@@ -731,8 +678,7 @@ export function DauthProfileModal({
731
678
  'var(--dauth-surface-hover, #232340)')
732
679
  }
733
680
  onMouseLeave={(e) =>
734
- (e.currentTarget.style.backgroundColor =
735
- 'transparent')
681
+ (e.currentTarget.style.backgroundColor = 'transparent')
736
682
  }
737
683
  >
738
684
  {isDesktop ? <IconClose /> : <IconBack />}
@@ -829,19 +775,14 @@ export function DauthProfileModal({
829
775
  {/* Form */}
830
776
  <div>
831
777
  <div style={fieldGroup}>
832
- <label
833
- htmlFor="dauth-name"
834
- style={label}
835
- >
778
+ <label htmlFor="dauth-name" style={label}>
836
779
  Name *
837
780
  </label>
838
781
  <input
839
782
  id="dauth-name"
840
783
  type="text"
841
784
  value={name}
842
- onChange={(e) =>
843
- setName(e.target.value)
844
- }
785
+ onChange={(e) => setName(e.target.value)}
845
786
  placeholder="Your name"
846
787
  disabled={saving}
847
788
  style={input}
@@ -852,10 +793,7 @@ export function DauthProfileModal({
852
793
 
853
794
  {hasField('lastname') && (
854
795
  <div style={fieldGroup}>
855
- <label
856
- htmlFor="dauth-lastname"
857
- style={label}
858
- >
796
+ <label htmlFor="dauth-lastname" style={label}>
859
797
  Last name
860
798
  {isRequired('lastname') ? ' *' : ''}
861
799
  </label>
@@ -863,9 +801,7 @@ export function DauthProfileModal({
863
801
  id="dauth-lastname"
864
802
  type="text"
865
803
  value={lastname}
866
- onChange={(e) =>
867
- setLastname(e.target.value)
868
- }
804
+ onChange={(e) => setLastname(e.target.value)}
869
805
  placeholder="Your last name"
870
806
  disabled={saving}
871
807
  style={input}
@@ -877,10 +813,7 @@ export function DauthProfileModal({
877
813
 
878
814
  {hasField('nickname') && (
879
815
  <div style={fieldGroup}>
880
- <label
881
- htmlFor="dauth-nickname"
882
- style={label}
883
- >
816
+ <label htmlFor="dauth-nickname" style={label}>
884
817
  Nickname
885
818
  {isRequired('nickname') ? ' *' : ''}
886
819
  </label>
@@ -888,9 +821,7 @@ export function DauthProfileModal({
888
821
  id="dauth-nickname"
889
822
  type="text"
890
823
  value={nickname}
891
- onChange={(e) =>
892
- setNickname(e.target.value)
893
- }
824
+ onChange={(e) => setNickname(e.target.value)}
894
825
  placeholder="Choose a nickname"
895
826
  disabled={saving}
896
827
  style={input}
@@ -902,10 +833,7 @@ export function DauthProfileModal({
902
833
 
903
834
  {hasField('country') && (
904
835
  <div style={fieldGroup}>
905
- <label
906
- htmlFor="dauth-country"
907
- style={label}
908
- >
836
+ <label htmlFor="dauth-country" style={label}>
909
837
  Country
910
838
  {isRequired('country') ? ' *' : ''}
911
839
  </label>
@@ -913,9 +841,7 @@ export function DauthProfileModal({
913
841
  id="dauth-country"
914
842
  type="text"
915
843
  value={country}
916
- onChange={(e) =>
917
- setCountry(e.target.value)
918
- }
844
+ onChange={(e) => setCountry(e.target.value)}
919
845
  placeholder="Your country"
920
846
  disabled={saving}
921
847
  style={input}
@@ -925,13 +851,11 @@ export function DauthProfileModal({
925
851
  </div>
926
852
  )}
927
853
 
928
- {(hasField('tel_prefix') ||
929
- hasField('tel_suffix')) && (
854
+ {(hasField('tel_prefix') || hasField('tel_suffix')) && (
930
855
  <div style={fieldGroup}>
931
856
  <div style={label}>
932
857
  Phone
933
- {isRequired('tel_prefix') ||
934
- isRequired('tel_suffix')
858
+ {isRequired('tel_prefix') || isRequired('tel_suffix')
935
859
  ? ' *'
936
860
  : ''}
937
861
  </div>
@@ -946,9 +870,7 @@ export function DauthProfileModal({
946
870
  id="dauth-tel-prefix"
947
871
  type="text"
948
872
  value={telPrefix}
949
- onChange={(e) =>
950
- setTelPrefix(e.target.value)
951
- }
873
+ onChange={(e) => setTelPrefix(e.target.value)}
952
874
  placeholder="+34"
953
875
  disabled={saving}
954
876
  style={{
@@ -966,9 +888,7 @@ export function DauthProfileModal({
966
888
  id="dauth-tel-suffix"
967
889
  type="tel"
968
890
  value={telSuffix}
969
- onChange={(e) =>
970
- setTelSuffix(e.target.value)
971
- }
891
+ onChange={(e) => setTelSuffix(e.target.value)}
972
892
  placeholder="612 345 678"
973
893
  disabled={saving}
974
894
  style={{
@@ -986,22 +906,15 @@ export function DauthProfileModal({
986
906
 
987
907
  {hasField('birth_date') && (
988
908
  <div style={fieldGroup}>
989
- <label
990
- htmlFor="dauth-birthdate"
991
- style={label}
992
- >
909
+ <label htmlFor="dauth-birthdate" style={label}>
993
910
  Birth date
994
- {isRequired('birth_date')
995
- ? ' *'
996
- : ''}
911
+ {isRequired('birth_date') ? ' *' : ''}
997
912
  </label>
998
913
  <input
999
914
  id="dauth-birthdate"
1000
915
  type="date"
1001
916
  value={birthDate}
1002
- onChange={(e) =>
1003
- setBirthDate(e.target.value)
1004
- }
917
+ onChange={(e) => setBirthDate(e.target.value)}
1005
918
  disabled={saving}
1006
919
  style={input}
1007
920
  onFocus={inputFocusHandler}
@@ -1010,37 +923,24 @@ export function DauthProfileModal({
1010
923
  </div>
1011
924
  )}
1012
925
 
1013
- {(domain.customFields ?? []).length >
1014
- 0 && (
926
+ {(domain.customFields ?? []).length > 0 && (
1015
927
  <>
1016
928
  <hr style={separator} />
1017
929
  {domain.customFields!.map((cf) => (
1018
- <div
1019
- key={cf.key}
1020
- style={fieldGroup}
1021
- >
1022
- <label
1023
- htmlFor={`dauth-cf-${cf.key}`}
1024
- style={label}
1025
- >
930
+ <div key={cf.key} style={fieldGroup}>
931
+ <label htmlFor={`dauth-cf-${cf.key}`} style={label}>
1026
932
  {cf.label}
1027
933
  {cf.required ? ' *' : ''}
1028
934
  </label>
1029
935
  <input
1030
936
  id={`dauth-cf-${cf.key}`}
1031
937
  type="text"
1032
- value={
1033
- customFieldValues[cf.key] ??
1034
- ''
1035
- }
938
+ value={customFieldValues[cf.key] ?? ''}
1036
939
  onChange={(e) =>
1037
- setCustomFieldValues(
1038
- (prev) => ({
1039
- ...prev,
1040
- [cf.key]:
1041
- e.target.value,
1042
- })
1043
- )
940
+ setCustomFieldValues((prev) => ({
941
+ ...prev,
942
+ [cf.key]: e.target.value,
943
+ }))
1044
944
  }
1045
945
  disabled={saving}
1046
946
  style={input}
@@ -1075,9 +975,7 @@ export function DauthProfileModal({
1075
975
  }}
1076
976
  onClick={() => handleLanguage(lang)}
1077
977
  >
1078
- {lang === 'es'
1079
- ? 'Espa\u00f1ol'
1080
- : 'English'}
978
+ {lang === 'es' ? 'Espa\u00f1ol' : 'English'}
1081
979
  </button>
1082
980
  ))}
1083
981
  </div>
@@ -1108,16 +1006,13 @@ export function DauthProfileModal({
1108
1006
  <button
1109
1007
  type="button"
1110
1008
  style={outlineBtn}
1111
- onClick={() =>
1112
- setShowRegister(!showRegister)
1113
- }
1009
+ onClick={() => setShowRegister(!showRegister)}
1114
1010
  onMouseEnter={(e) =>
1115
1011
  (e.currentTarget.style.backgroundColor =
1116
1012
  'var(--dauth-surface-hover, #232340)')
1117
1013
  }
1118
1014
  onMouseLeave={(e) =>
1119
- (e.currentTarget.style.backgroundColor =
1120
- 'transparent')
1015
+ (e.currentTarget.style.backgroundColor = 'transparent')
1121
1016
  }
1122
1017
  >
1123
1018
  + Add passkey
@@ -1128,19 +1023,14 @@ export function DauthProfileModal({
1128
1023
  {showRegister && (
1129
1024
  <div style={registerPanel}>
1130
1025
  <div style={fieldGroup}>
1131
- <label
1132
- htmlFor="dauth-passkey-name"
1133
- style={label}
1134
- >
1026
+ <label htmlFor="dauth-passkey-name" style={label}>
1135
1027
  Passkey name (optional)
1136
1028
  </label>
1137
1029
  <input
1138
1030
  id="dauth-passkey-name"
1139
1031
  type="text"
1140
1032
  value={passkeyName}
1141
- onChange={(e) =>
1142
- setPasskeyName(e.target.value)
1143
- }
1033
+ onChange={(e) => setPasskeyName(e.target.value)}
1144
1034
  placeholder="e.g. MacBook Touch ID"
1145
1035
  disabled={registering}
1146
1036
  style={input}
@@ -1163,21 +1053,13 @@ export function DauthProfileModal({
1163
1053
  disabled={registering}
1164
1054
  onClick={handleRegisterPasskey}
1165
1055
  >
1166
- {registering ? (
1167
- <Spinner />
1168
- ) : (
1169
- <IconFingerprint />
1170
- )}
1171
- {registering
1172
- ? 'Registering...'
1173
- : 'Register'}
1056
+ {registering ? <Spinner /> : <IconFingerprint />}
1057
+ {registering ? 'Registering...' : 'Register'}
1174
1058
  </button>
1175
1059
  <button
1176
1060
  type="button"
1177
1061
  style={cancelBtn}
1178
- onClick={() =>
1179
- setShowRegister(false)
1180
- }
1062
+ onClick={() => setShowRegister(false)}
1181
1063
  onMouseEnter={(e) =>
1182
1064
  (e.currentTarget.style.backgroundColor =
1183
1065
  'var(--dauth-surface-hover, #232340)')
@@ -1220,10 +1102,7 @@ export function DauthProfileModal({
1220
1102
  </div>
1221
1103
  ) : credentials.length > 0 ? (
1222
1104
  credentials.map((cred) => (
1223
- <div
1224
- key={cred._id}
1225
- style={credentialRow}
1226
- >
1105
+ <div key={cred._id} style={credentialRow}>
1227
1106
  <div
1228
1107
  style={{
1229
1108
  display: 'flex',
@@ -1235,8 +1114,7 @@ export function DauthProfileModal({
1235
1114
  >
1236
1115
  <span
1237
1116
  style={{
1238
- color:
1239
- 'var(--dauth-accent, #6366f1)',
1117
+ color: 'var(--dauth-accent, #6366f1)',
1240
1118
  flexShrink: 0,
1241
1119
  }}
1242
1120
  >
@@ -1250,29 +1128,23 @@ export function DauthProfileModal({
1250
1128
  >
1251
1129
  <div
1252
1130
  style={{
1253
- fontSize:
1254
- 'var(--dauth-font-size-sm, 0.875rem)',
1131
+ fontSize: 'var(--dauth-font-size-sm, 0.875rem)',
1255
1132
  fontWeight: 500,
1256
- color:
1257
- 'var(--dauth-text-primary, #e4e4e7)',
1133
+ color: 'var(--dauth-text-primary, #e4e4e7)',
1258
1134
  overflow: 'hidden',
1259
1135
  textOverflow: 'ellipsis',
1260
- whiteSpace:
1261
- 'nowrap' as const,
1136
+ whiteSpace: 'nowrap' as const,
1262
1137
  }}
1263
1138
  >
1264
1139
  {cred.name || 'Passkey'}
1265
1140
  </div>
1266
1141
  <div
1267
1142
  style={{
1268
- fontSize:
1269
- 'var(--dauth-font-size-xs, 0.75rem)',
1270
- color:
1271
- 'var(--dauth-text-muted, #71717a)',
1143
+ fontSize: 'var(--dauth-font-size-xs, 0.75rem)',
1144
+ color: 'var(--dauth-text-muted, #71717a)',
1272
1145
  }}
1273
1146
  >
1274
- {cred.deviceType ===
1275
- 'multiDevice'
1147
+ {cred.deviceType === 'multiDevice'
1276
1148
  ? 'Synced'
1277
1149
  : 'Device-bound'}
1278
1150
  {cred.createdAt &&
@@ -1282,9 +1154,7 @@ export function DauthProfileModal({
1282
1154
  </div>
1283
1155
  <button
1284
1156
  type="button"
1285
- onClick={() =>
1286
- handleDeletePasskey(cred._id)
1287
- }
1157
+ onClick={() => handleDeletePasskey(cred._id)}
1288
1158
  style={trashBtn}
1289
1159
  onMouseEnter={(e) =>
1290
1160
  (e.currentTarget.style.color =
@@ -1304,8 +1174,7 @@ export function DauthProfileModal({
1304
1174
  <div style={emptyState}>
1305
1175
  <span
1306
1176
  style={{
1307
- color:
1308
- 'var(--dauth-accent, #6366f1)',
1177
+ color: 'var(--dauth-accent, #6366f1)',
1309
1178
  }}
1310
1179
  >
1311
1180
  <IconShield />
@@ -1313,25 +1182,20 @@ export function DauthProfileModal({
1313
1182
  <div>
1314
1183
  <div
1315
1184
  style={{
1316
- fontSize:
1317
- 'var(--dauth-font-size-sm, 0.875rem)',
1185
+ fontSize: 'var(--dauth-font-size-sm, 0.875rem)',
1318
1186
  fontWeight: 500,
1319
- color:
1320
- 'var(--dauth-text-primary, #e4e4e7)',
1187
+ color: 'var(--dauth-text-primary, #e4e4e7)',
1321
1188
  }}
1322
1189
  >
1323
1190
  No passkeys registered
1324
1191
  </div>
1325
1192
  <div
1326
1193
  style={{
1327
- fontSize:
1328
- 'var(--dauth-font-size-xs, 0.75rem)',
1329
- color:
1330
- 'var(--dauth-text-secondary, #a1a1aa)',
1194
+ fontSize: 'var(--dauth-font-size-xs, 0.75rem)',
1195
+ color: 'var(--dauth-text-secondary, #a1a1aa)',
1331
1196
  }}
1332
1197
  >
1333
- Add a passkey for faster, more
1334
- secure sign-in.
1198
+ Add a passkey for faster, more secure sign-in.
1335
1199
  </div>
1336
1200
  </div>
1337
1201
  </div>
@@ -1356,12 +1220,9 @@ export function DauthProfileModal({
1356
1220
 
1357
1221
  {/* Delete account */}
1358
1222
  <div>
1359
- <div style={dangerTitle}>
1360
- Delete account
1361
- </div>
1223
+ <div style={dangerTitle}>Delete account</div>
1362
1224
  <div style={dangerDesc}>
1363
- Permanently delete your account and all
1364
- associated data.
1225
+ Permanently delete your account and all associated data.
1365
1226
  </div>
1366
1227
  {!showDelete ? (
1367
1228
  <button
@@ -1382,17 +1243,13 @@ export function DauthProfileModal({
1382
1243
  ) : (
1383
1244
  <div style={deletePanel}>
1384
1245
  <div style={deletePanelText}>
1385
- This action is permanent and cannot
1386
- be undone. Type{' '}
1387
- <strong>{CONFIRM_WORD}</strong> to
1388
- confirm.
1246
+ This action is permanent and cannot be undone. Type{' '}
1247
+ <strong>{CONFIRM_WORD}</strong> to confirm.
1389
1248
  </div>
1390
1249
  <input
1391
1250
  type="text"
1392
1251
  value={deleteText}
1393
- onChange={(e) =>
1394
- setDeleteText(e.target.value)
1395
- }
1252
+ onChange={(e) => setDeleteText(e.target.value)}
1396
1253
  placeholder={`Type ${CONFIRM_WORD}`}
1397
1254
  style={input}
1398
1255
  onFocus={inputFocusHandler}
@@ -1429,20 +1286,13 @@ export function DauthProfileModal({
1429
1286
  style={{
1430
1287
  ...deleteConfirmBtn,
1431
1288
  opacity:
1432
- deleteText !== CONFIRM_WORD ||
1433
- deleting
1434
- ? 0.5
1435
- : 1,
1289
+ deleteText !== CONFIRM_WORD || deleting ? 0.5 : 1,
1436
1290
  cursor:
1437
- deleteText !== CONFIRM_WORD ||
1438
- deleting
1291
+ deleteText !== CONFIRM_WORD || deleting
1439
1292
  ? 'not-allowed'
1440
1293
  : 'pointer',
1441
1294
  }}
1442
- disabled={
1443
- deleteText !== CONFIRM_WORD ||
1444
- deleting
1445
- }
1295
+ disabled={deleteText !== CONFIRM_WORD || deleting}
1446
1296
  onClick={handleDelete}
1447
1297
  >
1448
1298
  {deleting && <Spinner />}
@@ -1512,9 +1362,7 @@ export function DauthProfileModal({
1512
1362
 
1513
1363
  // --- Style constants ---
1514
1364
 
1515
- const headerStyle = (
1516
- isDesktop: boolean
1517
- ): React.CSSProperties => ({
1365
+ const headerStyle = (isDesktop: boolean): React.CSSProperties => ({
1518
1366
  display: 'flex',
1519
1367
  alignItems: 'center',
1520
1368
  justifyContent: 'space-between',
@@ -1525,8 +1373,7 @@ const headerStyle = (
1525
1373
  position: 'sticky' as const,
1526
1374
  top: 0,
1527
1375
  zIndex: 1,
1528
- backgroundColor:
1529
- 'var(--dauth-surface, #1a1a2e)',
1376
+ backgroundColor: 'var(--dauth-surface, #1a1a2e)',
1530
1377
  }
1531
1378
  : {}),
1532
1379
  });
@@ -1558,8 +1405,7 @@ const closeBtn: React.CSSProperties = {
1558
1405
  const tabBar: React.CSSProperties = {
1559
1406
  display: 'flex',
1560
1407
  padding: '0 24px',
1561
- borderBottom:
1562
- '1px solid var(--dauth-border, rgba(255, 255, 255, 0.08))',
1408
+ borderBottom: '1px solid var(--dauth-border, rgba(255, 255, 255, 0.08))',
1563
1409
  flexShrink: 0,
1564
1410
  };
1565
1411
 
@@ -1624,9 +1470,7 @@ const emailText: React.CSSProperties = {
1624
1470
  color: 'var(--dauth-text-secondary, #a1a1aa)',
1625
1471
  };
1626
1472
 
1627
- const statusMsg = (
1628
- type: 'success' | 'error'
1629
- ): React.CSSProperties => ({
1473
+ const statusMsg = (type: 'success' | 'error'): React.CSSProperties => ({
1630
1474
  padding: '10px 14px',
1631
1475
  borderRadius: 'var(--dauth-radius-sm, 8px)',
1632
1476
  fontSize: 'var(--dauth-font-size-sm, 0.875rem)',
@@ -1661,10 +1505,8 @@ const input: React.CSSProperties = {
1661
1505
  fontSize: 'var(--dauth-font-size-base, 1rem)',
1662
1506
  lineHeight: 1.5,
1663
1507
  color: 'var(--dauth-text-primary, #e4e4e7)',
1664
- backgroundColor:
1665
- 'var(--dauth-surface-secondary, rgba(255, 255, 255, 0.04))',
1666
- border:
1667
- '1px solid var(--dauth-border, rgba(255, 255, 255, 0.08))',
1508
+ backgroundColor: 'var(--dauth-surface-secondary, rgba(255, 255, 255, 0.04))',
1509
+ border: '1px solid var(--dauth-border, rgba(255, 255, 255, 0.08))',
1668
1510
  borderRadius: 'var(--dauth-radius-input, 8px)',
1669
1511
  outline: 'none',
1670
1512
  transition: 'border-color 150ms, box-shadow 150ms',
@@ -1672,18 +1514,13 @@ const input: React.CSSProperties = {
1672
1514
  fontFamily: 'inherit',
1673
1515
  };
1674
1516
 
1675
- const inputFocusHandler = (
1676
- e: React.FocusEvent<HTMLInputElement>
1677
- ) => {
1517
+ const inputFocusHandler = (e: React.FocusEvent<HTMLInputElement>) => {
1678
1518
  e.currentTarget.style.borderColor =
1679
1519
  'var(--dauth-border-focus, rgba(99, 102, 241, 0.5))';
1680
- e.currentTarget.style.boxShadow =
1681
- '0 0 0 3px rgba(99, 102, 241, 0.15)';
1520
+ e.currentTarget.style.boxShadow = '0 0 0 3px rgba(99, 102, 241, 0.15)';
1682
1521
  };
1683
1522
 
1684
- const inputBlurHandler = (
1685
- e: React.FocusEvent<HTMLInputElement>
1686
- ) => {
1523
+ const inputBlurHandler = (e: React.FocusEvent<HTMLInputElement>) => {
1687
1524
  e.currentTarget.style.borderColor =
1688
1525
  'var(--dauth-border, rgba(255, 255, 255, 0.08))';
1689
1526
  e.currentTarget.style.boxShadow = 'none';
@@ -1702,8 +1539,7 @@ const langBtn: React.CSSProperties = {
1702
1539
 
1703
1540
  const separator: React.CSSProperties = {
1704
1541
  height: 1,
1705
- backgroundColor:
1706
- 'var(--dauth-border, rgba(255, 255, 255, 0.08))',
1542
+ backgroundColor: 'var(--dauth-border, rgba(255, 255, 255, 0.08))',
1707
1543
  margin: '24px 0',
1708
1544
  border: 'none',
1709
1545
  };
@@ -1714,8 +1550,7 @@ const outlineBtn: React.CSSProperties = {
1714
1550
  fontWeight: 500,
1715
1551
  color: 'var(--dauth-text-secondary, #a1a1aa)',
1716
1552
  backgroundColor: 'transparent',
1717
- border:
1718
- '1px solid var(--dauth-border, rgba(255, 255, 255, 0.08))',
1553
+ border: '1px solid var(--dauth-border, rgba(255, 255, 255, 0.08))',
1719
1554
  borderRadius: 'var(--dauth-radius-sm, 8px)',
1720
1555
  cursor: 'pointer',
1721
1556
  transition: 'background-color 150ms',
@@ -1725,10 +1560,8 @@ const outlineBtn: React.CSSProperties = {
1725
1560
  const registerPanel: React.CSSProperties = {
1726
1561
  padding: 16,
1727
1562
  borderRadius: 'var(--dauth-radius-sm, 8px)',
1728
- border:
1729
- '1px solid var(--dauth-border, rgba(255, 255, 255, 0.08))',
1730
- backgroundColor:
1731
- 'var(--dauth-surface-secondary, rgba(255, 255, 255, 0.04))',
1563
+ border: '1px solid var(--dauth-border, rgba(255, 255, 255, 0.08))',
1564
+ backgroundColor: 'var(--dauth-surface-secondary, rgba(255, 255, 255, 0.04))',
1732
1565
  marginBottom: 12,
1733
1566
  };
1734
1567
 
@@ -1754,8 +1587,7 @@ const credentialRow: React.CSSProperties = {
1754
1587
  justifyContent: 'space-between',
1755
1588
  padding: 12,
1756
1589
  borderRadius: 'var(--dauth-radius-sm, 8px)',
1757
- backgroundColor:
1758
- 'var(--dauth-surface-secondary, rgba(255, 255, 255, 0.04))',
1590
+ backgroundColor: 'var(--dauth-surface-secondary, rgba(255, 255, 255, 0.04))',
1759
1591
  marginBottom: 8,
1760
1592
  };
1761
1593
 
@@ -1781,8 +1613,7 @@ const emptyState: React.CSSProperties = {
1781
1613
  gap: 12,
1782
1614
  padding: 16,
1783
1615
  borderRadius: 'var(--dauth-radius-sm, 8px)',
1784
- backgroundColor:
1785
- 'var(--dauth-surface-secondary, rgba(255, 255, 255, 0.04))',
1616
+ backgroundColor: 'var(--dauth-surface-secondary, rgba(255, 255, 255, 0.04))',
1786
1617
  };
1787
1618
 
1788
1619
  const dangerTitle: React.CSSProperties = {
@@ -1804,8 +1635,7 @@ const deleteBtn: React.CSSProperties = {
1804
1635
  fontSize: 'var(--dauth-font-size-sm, 0.875rem)',
1805
1636
  fontWeight: 500,
1806
1637
  color: 'var(--dauth-error, #ef4444)',
1807
- backgroundColor:
1808
- 'var(--dauth-error-bg, rgba(239, 68, 68, 0.1))',
1638
+ backgroundColor: 'var(--dauth-error-bg, rgba(239, 68, 68, 0.1))',
1809
1639
  border: '1px solid rgba(239, 68, 68, 0.2)',
1810
1640
  borderRadius: 'var(--dauth-radius-sm, 8px)',
1811
1641
  cursor: 'pointer',
@@ -1818,8 +1648,7 @@ const deletePanel: React.CSSProperties = {
1818
1648
  padding: 16,
1819
1649
  borderRadius: 'var(--dauth-radius-sm, 8px)',
1820
1650
  border: '1px solid rgba(239, 68, 68, 0.3)',
1821
- backgroundColor:
1822
- 'var(--dauth-error-bg, rgba(239, 68, 68, 0.1))',
1651
+ backgroundColor: 'var(--dauth-error-bg, rgba(239, 68, 68, 0.1))',
1823
1652
  };
1824
1653
 
1825
1654
  const deletePanelText: React.CSSProperties = {
@@ -1835,8 +1664,7 @@ const cancelBtn: React.CSSProperties = {
1835
1664
  fontWeight: 500,
1836
1665
  color: 'var(--dauth-text-secondary, #a1a1aa)',
1837
1666
  backgroundColor: 'transparent',
1838
- border:
1839
- '1px solid var(--dauth-border, rgba(255, 255, 255, 0.08))',
1667
+ border: '1px solid var(--dauth-border, rgba(255, 255, 255, 0.08))',
1840
1668
  borderRadius: 'var(--dauth-radius-sm, 8px)',
1841
1669
  cursor: 'pointer',
1842
1670
  transition: 'background-color 150ms',
@@ -1867,8 +1695,7 @@ const signOutBtn: React.CSSProperties = {
1867
1695
  fontSize: 'var(--dauth-font-size-base, 1rem)',
1868
1696
  fontWeight: 500,
1869
1697
  color: 'var(--dauth-error, #ef4444)',
1870
- backgroundColor:
1871
- 'var(--dauth-error-bg, rgba(239, 68, 68, 0.1))',
1698
+ backgroundColor: 'var(--dauth-error-bg, rgba(239, 68, 68, 0.1))',
1872
1699
  border: '1px solid rgba(239, 68, 68, 0.2)',
1873
1700
  borderRadius: 'var(--dauth-radius-sm, 8px)',
1874
1701
  cursor: 'pointer',
@@ -1880,22 +1707,17 @@ const signOutBtn: React.CSSProperties = {
1880
1707
  gap: 8,
1881
1708
  };
1882
1709
 
1883
- const footerStyle = (
1884
- isDesktop: boolean
1885
- ): React.CSSProperties => ({
1710
+ const footerStyle = (isDesktop: boolean): React.CSSProperties => ({
1886
1711
  padding: '16px 24px',
1887
- borderTop:
1888
- '1px solid var(--dauth-border, rgba(255, 255, 255, 0.08))',
1712
+ borderTop: '1px solid var(--dauth-border, rgba(255, 255, 255, 0.08))',
1889
1713
  flexShrink: 0,
1890
1714
  ...(!isDesktop
1891
1715
  ? {
1892
1716
  position: 'sticky' as const,
1893
1717
  bottom: 0,
1894
1718
  zIndex: 1,
1895
- backgroundColor:
1896
- 'var(--dauth-surface, #1a1a2e)',
1897
- paddingBottom:
1898
- 'max(16px, env(safe-area-inset-bottom))',
1719
+ backgroundColor: 'var(--dauth-surface, #1a1a2e)',
1720
+ paddingBottom: 'max(16px, env(safe-area-inset-bottom))',
1899
1721
  }
1900
1722
  : {}),
1901
1723
  });