@hotosm/hanko-auth 0.5.1 → 0.5.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/dist/hanko-auth.esm.js +917 -1027
- package/dist/hanko-auth.iife.js +29 -26
- package/dist/hanko-auth.umd.js +29 -26
- package/package.json +1 -1
- package/src/hanko-auth.ts +16 -18
- package/src/hanko-i18n-en.ts +2 -2
- package/src/hanko-i18n-es.ts +2 -2
- package/src/hanko-i18n-fr.ts +2 -2
- package/src/hanko-i18n-pt.ts +2 -2
- package/src/hanko-translations.ts +20 -5
package/package.json
CHANGED
package/src/hanko-auth.ts
CHANGED
|
@@ -921,33 +921,36 @@ export class HankoAuth extends LitElement {
|
|
|
921
921
|
|
|
922
922
|
updated(changedProperties: Map<string, any>) {
|
|
923
923
|
super.updated(changedProperties);
|
|
924
|
-
// Re-attach event listeners when user becomes null (after logout)
|
|
925
|
-
// because a new <hanko-auth> element is created
|
|
926
924
|
if (
|
|
927
|
-
changedProperties.has("user") &&
|
|
928
|
-
|
|
929
|
-
this.showProfile
|
|
925
|
+
(changedProperties.has("user") && this.user === null && this.showProfile) ||
|
|
926
|
+
changedProperties.has("lang")
|
|
930
927
|
) {
|
|
931
|
-
this.log("User logged out, re-attaching event listeners...");
|
|
932
928
|
this._currentHankoAuthElement = null;
|
|
933
929
|
this.setupEventListeners();
|
|
934
930
|
}
|
|
935
931
|
}
|
|
936
932
|
|
|
937
933
|
private setupEventListeners() {
|
|
938
|
-
// Use updateComplete to ensure DOM is ready
|
|
939
934
|
this.updateComplete.then(() => {
|
|
940
935
|
const hankoAuth = this.shadowRoot?.querySelector("hanko-auth");
|
|
941
936
|
|
|
942
|
-
// Skip if already attached to the same element
|
|
943
937
|
if (hankoAuth && hankoAuth === this._currentHankoAuthElement) {
|
|
944
|
-
this.log("Event listeners already attached to this element");
|
|
945
938
|
return;
|
|
946
939
|
}
|
|
947
|
-
|
|
940
|
+
// no exports available for adding css, so injecting it
|
|
948
941
|
if (hankoAuth) {
|
|
949
942
|
this._currentHankoAuthElement = hankoAuth;
|
|
950
|
-
|
|
943
|
+
const hankoShadow = (hankoAuth as HTMLElement & { shadowRoot: ShadowRoot | null }).shadowRoot;
|
|
944
|
+
if (hankoShadow && !hankoShadow.querySelector("#hot-hanko-overrides")) {
|
|
945
|
+
const style = document.createElement("style");
|
|
946
|
+
style.id = "hot-hanko-overrides";
|
|
947
|
+
style.textContent = `
|
|
948
|
+
.hanko_lastUsed { margin-left: 8px; }
|
|
949
|
+
.hanko_form .hanko_li { min-width: 100%; }
|
|
950
|
+
`;
|
|
951
|
+
hankoShadow.appendChild(style);
|
|
952
|
+
}
|
|
953
|
+
|
|
951
954
|
this._setupSignUpSubtitleObserver(hankoAuth);
|
|
952
955
|
|
|
953
956
|
hankoAuth.addEventListener("onSessionCreated", (e: any) => {
|
|
@@ -969,7 +972,7 @@ export class HankoAuth extends LitElement {
|
|
|
969
972
|
}
|
|
970
973
|
});
|
|
971
974
|
}
|
|
972
|
-
|
|
975
|
+
// subtitle handling
|
|
973
976
|
private _setupSignUpSubtitleObserver(hankoAuth: Element) {
|
|
974
977
|
const injectSubtitle = () => {
|
|
975
978
|
const hankoShadow = (hankoAuth as HTMLElement & { shadowRoot: ShadowRoot | null }).shadowRoot;
|
|
@@ -978,13 +981,11 @@ export class HankoAuth extends LitElement {
|
|
|
978
981
|
const h1 = hankoShadow.querySelector<HTMLElement>("h1[part='headline1']");
|
|
979
982
|
const headlineText = h1?.textContent?.trim() ?? "";
|
|
980
983
|
|
|
981
|
-
// Remove any existing subtitle first
|
|
982
984
|
const existing = hankoShadow.querySelector(".hot-subtitle");
|
|
983
985
|
|
|
984
986
|
const isSignUp = this._signUpHeadlines.has(headlineText);
|
|
985
987
|
const isLogin = this._loginHeadlines.has(headlineText);
|
|
986
988
|
|
|
987
|
-
// Only show subtitle on the two initial screens
|
|
988
989
|
if (!isSignUp && !isLogin) {
|
|
989
990
|
if (existing) {
|
|
990
991
|
this._hankoObserver?.disconnect();
|
|
@@ -998,11 +999,9 @@ export class HankoAuth extends LitElement {
|
|
|
998
999
|
? this.t("signUpSubtitle")
|
|
999
1000
|
: this.t("loginSubtitle");
|
|
1000
1001
|
|
|
1001
|
-
// Skip if subtitle already has correct text
|
|
1002
1002
|
if (existing && existing.textContent === subtitleText) return;
|
|
1003
1003
|
if (!h1) return;
|
|
1004
1004
|
|
|
1005
|
-
// Disconnect before modifying DOM to avoid re-triggering the observer
|
|
1006
1005
|
this._hankoObserver?.disconnect();
|
|
1007
1006
|
|
|
1008
1007
|
if (existing) existing.remove();
|
|
@@ -1011,11 +1010,10 @@ export class HankoAuth extends LitElement {
|
|
|
1011
1010
|
subtitle.className = "hot-subtitle";
|
|
1012
1011
|
subtitle.textContent = subtitleText;
|
|
1013
1012
|
subtitle.style.cssText =
|
|
1014
|
-
"margin: -4px 0 16px; text-align: center; font-size: var(--hot-font-size-
|
|
1013
|
+
"margin: -4px 0 16px; text-align: center; font-size: var(--hot-font-size-large); color: var(--hot-color-gray-600, #6b7280); font-weight: normal;";
|
|
1015
1014
|
|
|
1016
1015
|
h1.insertAdjacentElement("afterend", subtitle);
|
|
1017
1016
|
|
|
1018
|
-
// Re-observe after injection
|
|
1019
1017
|
this._hankoObserver?.observe(hankoShadow, { childList: true, subtree: true });
|
|
1020
1018
|
};
|
|
1021
1019
|
|
package/src/hanko-i18n-en.ts
CHANGED
|
@@ -9,9 +9,9 @@ export const enOverrides = {
|
|
|
9
9
|
signUp: "Create an account",
|
|
10
10
|
},
|
|
11
11
|
labels: {
|
|
12
|
-
signUp: "
|
|
12
|
+
signUp: "Sign up here",
|
|
13
13
|
alreadyHaveAnAccount: "Already have a HOT account?",
|
|
14
|
-
|
|
14
|
+
dontHaveAnAccount: "Don't have a HOT account?",
|
|
15
15
|
},
|
|
16
16
|
texts: {
|
|
17
17
|
enterPasscode:
|
package/src/hanko-i18n-es.ts
CHANGED
|
@@ -120,7 +120,7 @@ export const es = {
|
|
|
120
120
|
signInPasskey: "Iniciar sesión con llave de acceso",
|
|
121
121
|
registerAuthenticator: "Crear una llave de acceso",
|
|
122
122
|
signIn: "Iniciar sesión",
|
|
123
|
-
signUp: "
|
|
123
|
+
signUp: "Regístrese aquí",
|
|
124
124
|
sendNewPasscode: "Enviar nuevo código",
|
|
125
125
|
passwordRetryAfter: "Reintentar en {passwordRetryAfter}",
|
|
126
126
|
passcodeResendAfter: "Solicitar nuevo código en {passcodeResendAfter}",
|
|
@@ -142,7 +142,7 @@ export const es = {
|
|
|
142
142
|
emailOrUsername: "Correo o nombre de usuario",
|
|
143
143
|
username: "Nombre de usuario",
|
|
144
144
|
optional: "opcional",
|
|
145
|
-
dontHaveAnAccount: "¿No tiene una cuenta?",
|
|
145
|
+
dontHaveAnAccount: "¿No tiene una cuenta HOT?",
|
|
146
146
|
alreadyHaveAnAccount: "¿Ya tiene una cuenta?",
|
|
147
147
|
changeUsername: "Cambiar nombre de usuario",
|
|
148
148
|
setUsername: "Establecer nombre de usuario",
|
package/src/hanko-i18n-fr.ts
CHANGED
|
@@ -120,7 +120,7 @@ export const fr = {
|
|
|
120
120
|
signInPasskey: "Se connecter avec clé d'accès",
|
|
121
121
|
registerAuthenticator: "Créer une clé d'accès",
|
|
122
122
|
signIn: "Se connecter",
|
|
123
|
-
signUp: "
|
|
123
|
+
signUp: "S'inscrire ici",
|
|
124
124
|
sendNewPasscode: "Envoyer un nouveau code",
|
|
125
125
|
passwordRetryAfter: "Réessayer dans {passwordRetryAfter}",
|
|
126
126
|
passcodeResendAfter: "Demander un nouveau code dans {passcodeResendAfter}",
|
|
@@ -142,7 +142,7 @@ export const fr = {
|
|
|
142
142
|
emailOrUsername: "E-mail ou nom d'utilisateur",
|
|
143
143
|
username: "Nom d'utilisateur",
|
|
144
144
|
optional: "optionnel",
|
|
145
|
-
dontHaveAnAccount: "Vous n'avez pas de compte ?",
|
|
145
|
+
dontHaveAnAccount: "Vous n'avez pas de compte HOT ?",
|
|
146
146
|
alreadyHaveAnAccount: "Vous avez déjà un compte ?",
|
|
147
147
|
changeUsername: "Changer le nom d'utilisateur",
|
|
148
148
|
setUsername: "Définir le nom d'utilisateur",
|
package/src/hanko-i18n-pt.ts
CHANGED
|
@@ -119,7 +119,7 @@ export const pt = {
|
|
|
119
119
|
signInPasskey: "Entrar com chave de acesso",
|
|
120
120
|
registerAuthenticator: "Criar uma chave de acesso",
|
|
121
121
|
signIn: "Entrar",
|
|
122
|
-
signUp: "
|
|
122
|
+
signUp: "Cadastre-se aqui",
|
|
123
123
|
sendNewPasscode: "Enviar novo código",
|
|
124
124
|
passwordRetryAfter: "Tentar novamente em {passwordRetryAfter}",
|
|
125
125
|
passcodeResendAfter: "Solicitar novo código em {passcodeResendAfter}",
|
|
@@ -141,7 +141,7 @@ export const pt = {
|
|
|
141
141
|
emailOrUsername: "E-mail ou nome de usuário",
|
|
142
142
|
username: "Nome de usuário",
|
|
143
143
|
optional: "opcional",
|
|
144
|
-
dontHaveAnAccount: "Não tem uma conta?",
|
|
144
|
+
dontHaveAnAccount: "Não tem uma conta HOT?",
|
|
145
145
|
alreadyHaveAnAccount: "Já tem uma conta?",
|
|
146
146
|
changeUsername: "Alterar nome de usuário",
|
|
147
147
|
setUsername: "Definir nome de usuário",
|
|
@@ -1,15 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// Hanko's UI overwrites
|
|
3
2
|
import { en } from "@teamhanko/hanko-elements/i18n/en";
|
|
3
|
+
import { fr as hankoFr } from "@teamhanko/hanko-elements/i18n/fr";
|
|
4
4
|
import { enOverrides } from "./hanko-i18n-en";
|
|
5
|
-
import { es } from "./hanko-i18n-es";
|
|
6
|
-
import { fr } from "./hanko-i18n-fr";
|
|
7
|
-
import { pt } from "./hanko-i18n-pt";
|
|
5
|
+
import { es as esOverrides } from "./hanko-i18n-es";
|
|
6
|
+
import { fr as frOverrides } from "./hanko-i18n-fr";
|
|
7
|
+
import { pt as ptOverrides } from "./hanko-i18n-pt";
|
|
8
8
|
|
|
9
9
|
Object.assign(en.headlines, enOverrides.headlines);
|
|
10
10
|
Object.assign(en.labels, enOverrides.labels);
|
|
11
11
|
Object.assign(en.texts, enOverrides.texts);
|
|
12
12
|
|
|
13
|
+
const fr = JSON.parse(JSON.stringify(hankoFr));
|
|
14
|
+
Object.assign(fr.headlines, frOverrides.headlines);
|
|
15
|
+
Object.assign(fr.labels, frOverrides.labels);
|
|
16
|
+
Object.assign(fr.texts, frOverrides.texts);
|
|
17
|
+
|
|
18
|
+
const es = JSON.parse(JSON.stringify(en));
|
|
19
|
+
Object.assign(es.headlines, esOverrides.headlines);
|
|
20
|
+
Object.assign(es.labels, esOverrides.labels);
|
|
21
|
+
Object.assign(es.texts, esOverrides.texts);
|
|
22
|
+
|
|
23
|
+
const pt = JSON.parse(JSON.stringify(en));
|
|
24
|
+
Object.assign(pt.headlines, ptOverrides.headlines);
|
|
25
|
+
Object.assign(pt.labels, ptOverrides.labels);
|
|
26
|
+
Object.assign(pt.texts, ptOverrides.texts);
|
|
27
|
+
|
|
13
28
|
export function getTranslations() {
|
|
14
29
|
return { en, es, fr, pt };
|
|
15
30
|
}
|