@authon/js 0.5.0 → 0.7.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/dist/index.d.cts CHANGED
@@ -32,6 +32,7 @@ declare class Authon {
32
32
  private config;
33
33
  private session;
34
34
  private modal;
35
+ private profile;
35
36
  private listeners;
36
37
  private branding;
37
38
  private providers;
@@ -43,6 +44,8 @@ declare class Authon {
43
44
  getProviders(): Promise<OAuthProviderType[]>;
44
45
  openSignIn(): Promise<void>;
45
46
  openSignUp(): Promise<void>;
47
+ openProfile(): Promise<void>;
48
+ closeProfile(): void;
46
49
  /** Update theme at runtime without destroying form state */
47
50
  setTheme(theme: 'light' | 'dark' | 'auto'): void;
48
51
  signInWithOAuth(provider: OAuthProviderType, options?: OAuthSignInOptions): Promise<void>;
@@ -50,7 +53,12 @@ declare class Authon {
50
53
  signUpWithEmail(email: string, password: string, meta?: {
51
54
  displayName?: string;
52
55
  turnstileToken?: string;
53
- }): Promise<AuthonUser>;
56
+ }): Promise<AuthonUser | {
57
+ needsVerification: true;
58
+ email: string;
59
+ }>;
60
+ verifyEmail(email: string, code: string): Promise<AuthonUser>;
61
+ resendVerificationCode(email: string): Promise<void>;
54
62
  signOut(): Promise<void>;
55
63
  getUser(): AuthonUser | null;
56
64
  getToken(): string | null;
@@ -176,6 +184,12 @@ declare const translations: {
176
184
  readonly passkey: "Sign in with Passkey";
177
185
  readonly securedBy: "Secured by";
178
186
  readonly backToSignIn: "Back to sign in";
187
+ readonly profile: "Profile";
188
+ readonly editProfile: "Edit Profile";
189
+ readonly displayName: "Display Name";
190
+ readonly save: "Save";
191
+ readonly signOut: "Sign Out";
192
+ readonly sessions: "Active Sessions";
179
193
  };
180
194
  readonly ko: {
181
195
  readonly welcomeBack: "다시 오신 걸 환영합니다";
@@ -194,6 +208,12 @@ declare const translations: {
194
208
  readonly passkey: "패스키로 로그인";
195
209
  readonly securedBy: "보안 제공";
196
210
  readonly backToSignIn: "로그인으로 돌아가기";
211
+ readonly profile: "프로필";
212
+ readonly editProfile: "프로필 편집";
213
+ readonly displayName: "표시 이름";
214
+ readonly save: "저장";
215
+ readonly signOut: "로그아웃";
216
+ readonly sessions: "활성 세션";
197
217
  };
198
218
  readonly ja: {
199
219
  readonly welcomeBack: "おかえりなさい";
@@ -212,6 +232,12 @@ declare const translations: {
212
232
  readonly passkey: "パスキーでログイン";
213
233
  readonly securedBy: "セキュリティ提供";
214
234
  readonly backToSignIn: "ログインに戻る";
235
+ readonly profile: "プロフィール";
236
+ readonly editProfile: "プロフィール編集";
237
+ readonly displayName: "表示名";
238
+ readonly save: "保存";
239
+ readonly signOut: "サインアウト";
240
+ readonly sessions: "アクティブセッション";
215
241
  };
216
242
  readonly 'zh-CN': {
217
243
  readonly welcomeBack: "欢迎回来";
@@ -230,6 +256,12 @@ declare const translations: {
230
256
  readonly passkey: "使用通行密钥登录";
231
257
  readonly securedBy: "安全保障";
232
258
  readonly backToSignIn: "返回登录";
259
+ readonly profile: "个人资料";
260
+ readonly editProfile: "编辑资料";
261
+ readonly displayName: "显示名称";
262
+ readonly save: "保存";
263
+ readonly signOut: "退出登录";
264
+ readonly sessions: "活跃会话";
233
265
  };
234
266
  readonly 'zh-TW': {
235
267
  readonly welcomeBack: "歡迎回來";
@@ -248,6 +280,12 @@ declare const translations: {
248
280
  readonly passkey: "使用通行金鑰登入";
249
281
  readonly securedBy: "安全保障";
250
282
  readonly backToSignIn: "返回登入";
283
+ readonly profile: "個人資料";
284
+ readonly editProfile: "編輯資料";
285
+ readonly displayName: "顯示名稱";
286
+ readonly save: "儲存";
287
+ readonly signOut: "登出";
288
+ readonly sessions: "活躍工作階段";
251
289
  };
252
290
  readonly 'pt-BR': {
253
291
  readonly welcomeBack: "Bem-vindo de volta";
@@ -266,6 +304,12 @@ declare const translations: {
266
304
  readonly passkey: "Entrar com Passkey";
267
305
  readonly securedBy: "Protegido por";
268
306
  readonly backToSignIn: "Voltar ao login";
307
+ readonly profile: "Perfil";
308
+ readonly editProfile: "Editar perfil";
309
+ readonly displayName: "Nome de exibicao";
310
+ readonly save: "Salvar";
311
+ readonly signOut: "Sair";
312
+ readonly sessions: "Sessoes ativas";
269
313
  };
270
314
  readonly es: {
271
315
  readonly welcomeBack: "Bienvenido de nuevo";
@@ -284,6 +328,12 @@ declare const translations: {
284
328
  readonly passkey: "Iniciar con Passkey";
285
329
  readonly securedBy: "Protegido por";
286
330
  readonly backToSignIn: "Volver al inicio de sesion";
331
+ readonly profile: "Perfil";
332
+ readonly editProfile: "Editar perfil";
333
+ readonly displayName: "Nombre de visualizacion";
334
+ readonly save: "Guardar";
335
+ readonly signOut: "Cerrar sesion";
336
+ readonly sessions: "Sesiones activas";
287
337
  };
288
338
  readonly de: {
289
339
  readonly welcomeBack: "Willkommen zuruck";
@@ -302,6 +352,12 @@ declare const translations: {
302
352
  readonly passkey: "Mit Passkey anmelden";
303
353
  readonly securedBy: "Gesichert durch";
304
354
  readonly backToSignIn: "Zuruck zur Anmeldung";
355
+ readonly profile: "Profil";
356
+ readonly editProfile: "Profil bearbeiten";
357
+ readonly displayName: "Anzeigename";
358
+ readonly save: "Speichern";
359
+ readonly signOut: "Abmelden";
360
+ readonly sessions: "Aktive Sitzungen";
305
361
  };
306
362
  readonly fr: {
307
363
  readonly welcomeBack: "Bon retour";
@@ -320,6 +376,12 @@ declare const translations: {
320
376
  readonly passkey: "Se connecter avec Passkey";
321
377
  readonly securedBy: "Securise par";
322
378
  readonly backToSignIn: "Retour a la connexion";
379
+ readonly profile: "Profil";
380
+ readonly editProfile: "Modifier le profil";
381
+ readonly displayName: "Nom d'affichage";
382
+ readonly save: "Enregistrer";
383
+ readonly signOut: "Se deconnecter";
384
+ readonly sessions: "Sessions actives";
323
385
  };
324
386
  readonly hi: {
325
387
  readonly welcomeBack: "वापसी पर स्वागत है";
@@ -338,6 +400,12 @@ declare const translations: {
338
400
  readonly passkey: "पासकी से साइन इन";
339
401
  readonly securedBy: "सुरक्षा प्रदाता";
340
402
  readonly backToSignIn: "साइन इन पर वापस जाएं";
403
+ readonly profile: "प्रोफ़ाइल";
404
+ readonly editProfile: "प्रोफ़ाइल संपादित करें";
405
+ readonly displayName: "प्रदर्शन नाम";
406
+ readonly save: "सहेजें";
407
+ readonly signOut: "साइन आउट";
408
+ readonly sessions: "सक्रिय सत्र";
341
409
  };
342
410
  readonly tr: {
343
411
  readonly welcomeBack: "Tekrar hos geldiniz";
@@ -356,6 +424,12 @@ declare const translations: {
356
424
  readonly passkey: "Passkey ile giris yap";
357
425
  readonly securedBy: "Guvenlik saglayici";
358
426
  readonly backToSignIn: "Girise don";
427
+ readonly profile: "Profil";
428
+ readonly editProfile: "Profili duzenle";
429
+ readonly displayName: "Goruntu adi";
430
+ readonly save: "Kaydet";
431
+ readonly signOut: "Cikis yap";
432
+ readonly sessions: "Aktif oturumlar";
359
433
  };
360
434
  readonly id: {
361
435
  readonly welcomeBack: "Selamat datang kembali";
@@ -374,6 +448,12 @@ declare const translations: {
374
448
  readonly passkey: "Masuk dengan Passkey";
375
449
  readonly securedBy: "Diamankan oleh";
376
450
  readonly backToSignIn: "Kembali ke login";
451
+ readonly profile: "Profil";
452
+ readonly editProfile: "Edit profil";
453
+ readonly displayName: "Nama tampilan";
454
+ readonly save: "Simpan";
455
+ readonly signOut: "Keluar";
456
+ readonly sessions: "Sesi aktif";
377
457
  };
378
458
  readonly vi: {
379
459
  readonly welcomeBack: "Chao mung tro lai";
@@ -392,6 +472,12 @@ declare const translations: {
392
472
  readonly passkey: "Dang nhap voi Passkey";
393
473
  readonly securedBy: "Bao mat boi";
394
474
  readonly backToSignIn: "Quay lai dang nhap";
475
+ readonly profile: "Ho so";
476
+ readonly editProfile: "Chinh sua ho so";
477
+ readonly displayName: "Ten hien thi";
478
+ readonly save: "Luu";
479
+ readonly signOut: "Dang xuat";
480
+ readonly sessions: "Phien dang nhap hoat dong";
395
481
  };
396
482
  readonly th: {
397
483
  readonly welcomeBack: "ยินดีต้อนรับกลับ";
@@ -410,6 +496,12 @@ declare const translations: {
410
496
  readonly passkey: "เข้าสู่ระบบด้วย Passkey";
411
497
  readonly securedBy: "รักษาความปลอดภัยโดย";
412
498
  readonly backToSignIn: "กลับไปเข้าสู่ระบบ";
499
+ readonly profile: "โปรไฟล์";
500
+ readonly editProfile: "แก้ไขโปรไฟล์";
501
+ readonly displayName: "ชื่อที่แสดง";
502
+ readonly save: "บันทึก";
503
+ readonly signOut: "ออกจากระบบ";
504
+ readonly sessions: "เซสชันที่ใช้งานอยู่";
413
505
  };
414
506
  readonly ru: {
415
507
  readonly welcomeBack: "С возвращением";
@@ -428,6 +520,12 @@ declare const translations: {
428
520
  readonly passkey: "Войти с Passkey";
429
521
  readonly securedBy: "Защищено";
430
522
  readonly backToSignIn: "Вернуться к входу";
523
+ readonly profile: "Профиль";
524
+ readonly editProfile: "Редактировать профиль";
525
+ readonly displayName: "Отображаемое имя";
526
+ readonly save: "Сохранить";
527
+ readonly signOut: "Выйти";
528
+ readonly sessions: "Активные сеансы";
431
529
  };
432
530
  readonly it: {
433
531
  readonly welcomeBack: "Bentornato";
@@ -446,6 +544,12 @@ declare const translations: {
446
544
  readonly passkey: "Accedi con Passkey";
447
545
  readonly securedBy: "Protetto da";
448
546
  readonly backToSignIn: "Torna all'accesso";
547
+ readonly profile: "Profilo";
548
+ readonly editProfile: "Modifica profilo";
549
+ readonly displayName: "Nome visualizzato";
550
+ readonly save: "Salva";
551
+ readonly signOut: "Esci";
552
+ readonly sessions: "Sessioni attive";
449
553
  };
450
554
  readonly pl: {
451
555
  readonly welcomeBack: "Witaj ponownie";
@@ -464,6 +568,12 @@ declare const translations: {
464
568
  readonly passkey: "Zaloguj sie z Passkey";
465
569
  readonly securedBy: "Zabezpieczone przez";
466
570
  readonly backToSignIn: "Powrot do logowania";
571
+ readonly profile: "Profil";
572
+ readonly editProfile: "Edytuj profil";
573
+ readonly displayName: "Nazwa wyswietlana";
574
+ readonly save: "Zapisz";
575
+ readonly signOut: "Wyloguj sie";
576
+ readonly sessions: "Aktywne sesje";
467
577
  };
468
578
  readonly nl: {
469
579
  readonly welcomeBack: "Welkom terug";
@@ -482,6 +592,12 @@ declare const translations: {
482
592
  readonly passkey: "Inloggen met Passkey";
483
593
  readonly securedBy: "Beveiligd door";
484
594
  readonly backToSignIn: "Terug naar inloggen";
595
+ readonly profile: "Profiel";
596
+ readonly editProfile: "Profiel bewerken";
597
+ readonly displayName: "Weergavenaam";
598
+ readonly save: "Opslaan";
599
+ readonly signOut: "Uitloggen";
600
+ readonly sessions: "Actieve sessies";
485
601
  };
486
602
  readonly ar: {
487
603
  readonly welcomeBack: "مرحبًا بعودتك";
@@ -500,6 +616,12 @@ declare const translations: {
500
616
  readonly passkey: "تسجيل الدخول باستخدام Passkey";
501
617
  readonly securedBy: "محمي بواسطة";
502
618
  readonly backToSignIn: "العودة لتسجيل الدخول";
619
+ readonly profile: "الملف الشخصي";
620
+ readonly editProfile: "تعديل الملف الشخصي";
621
+ readonly displayName: "الاسم المعروض";
622
+ readonly save: "حفظ";
623
+ readonly signOut: "تسجيل الخروج";
624
+ readonly sessions: "الجلسات النشطة";
503
625
  };
504
626
  readonly sv: {
505
627
  readonly welcomeBack: "Valkommen tillbaka";
@@ -518,6 +640,12 @@ declare const translations: {
518
640
  readonly passkey: "Logga in med Passkey";
519
641
  readonly securedBy: "Sakrad av";
520
642
  readonly backToSignIn: "Tillbaka till inloggning";
643
+ readonly profile: "Profil";
644
+ readonly editProfile: "Redigera profil";
645
+ readonly displayName: "Visningsnamn";
646
+ readonly save: "Spara";
647
+ readonly signOut: "Logga ut";
648
+ readonly sessions: "Aktiva sessioner";
521
649
  };
522
650
  readonly uk: {
523
651
  readonly welcomeBack: "З поверненням";
@@ -536,6 +664,12 @@ declare const translations: {
536
664
  readonly passkey: "Увійти з Passkey";
537
665
  readonly securedBy: "Захищено";
538
666
  readonly backToSignIn: "Повернутися до входу";
667
+ readonly profile: "Профіль";
668
+ readonly editProfile: "Редагувати профіль";
669
+ readonly displayName: "Відображуване ім'я";
670
+ readonly save: "Зберегти";
671
+ readonly signOut: "Вийти";
672
+ readonly sessions: "Активні сеанси";
539
673
  };
540
674
  };
541
675
  interface TranslationStrings {
@@ -555,7 +689,73 @@ interface TranslationStrings {
555
689
  passkey: string;
556
690
  securedBy: string;
557
691
  backToSignIn: string;
692
+ profile: string;
693
+ editProfile: string;
694
+ displayName: string;
695
+ save: string;
696
+ signOut: string;
697
+ sessions: string;
558
698
  }
559
699
  declare function getStrings(locale: string): TranslationStrings;
560
700
 
561
- export { Authon, type AuthonConfig, type AuthonEventType, type AuthonEvents, type AuthonLocale, AuthonMfaRequiredError, type OAuthFlowMode, type OAuthSignInOptions, type ProviderButtonConfig, generateQrSvg, getProviderButtonConfig, getStrings, translations };
701
+ declare class ProfileRenderer {
702
+ private shadowRoot;
703
+ private hostElement;
704
+ private containerElement;
705
+ private containerId;
706
+ private mode;
707
+ private theme;
708
+ private branding;
709
+ private themeObserver;
710
+ private mediaQueryListener;
711
+ private t;
712
+ private user;
713
+ private sessions;
714
+ private isEditMode;
715
+ private onSave;
716
+ private onSignOut;
717
+ private onRevokeSession;
718
+ private onClose;
719
+ private escHandler;
720
+ constructor(options: {
721
+ mode: 'popup' | 'embedded';
722
+ theme?: 'light' | 'dark' | 'auto';
723
+ containerId?: string;
724
+ branding?: BrandingConfig;
725
+ locale?: string;
726
+ user: AuthonUser;
727
+ sessions?: SessionInfo[];
728
+ onSave: (data: {
729
+ displayName?: string;
730
+ avatarUrl?: string;
731
+ }) => Promise<void>;
732
+ onSignOut: () => Promise<void>;
733
+ onRevokeSession: (sessionId: string) => Promise<void>;
734
+ onClose: () => void;
735
+ });
736
+ private resolveContainerElement;
737
+ open(): void;
738
+ close(): void;
739
+ updateUser(user: AuthonUser): void;
740
+ updateSessions(sessions: SessionInfo[]): void;
741
+ setTheme(theme: 'light' | 'dark' | 'auto'): void;
742
+ showSaving(): void;
743
+ showSaveError(message: string): void;
744
+ private showInlineError;
745
+ private updateThemeCSS;
746
+ private startThemeObserver;
747
+ private stopThemeObserver;
748
+ private isDark;
749
+ private render;
750
+ private rerender;
751
+ private buildShell;
752
+ private buildInnerContent;
753
+ private buildViewContent;
754
+ private buildEditContent;
755
+ private buildCSS;
756
+ private attachEvents;
757
+ private attachBackdropEvent;
758
+ private attachInnerEvents;
759
+ }
760
+
761
+ export { Authon, type AuthonConfig, type AuthonEventType, type AuthonEvents, type AuthonLocale, AuthonMfaRequiredError, type OAuthFlowMode, type OAuthSignInOptions, ProfileRenderer, type ProviderButtonConfig, type TranslationStrings, generateQrSvg, getProviderButtonConfig, getStrings, translations };