@everymatrix/user-login 1.99.49 → 1.99.50

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.
@@ -851,6 +851,16 @@ var postUpdateComponent = (hostRef) => {
851
851
  hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
852
852
  }
853
853
  };
854
+ var forceUpdate = (ref) => {
855
+ {
856
+ const hostRef = getHostRef(ref);
857
+ const isConnected = hostRef.$hostElement$.isConnected;
858
+ if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
859
+ scheduleUpdate(hostRef, false);
860
+ }
861
+ return isConnected;
862
+ }
863
+ };
854
864
  var appDidLoad = (who) => {
855
865
  {
856
866
  addHydratedFlag(doc.documentElement);
@@ -1238,6 +1248,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1238
1248
  var setNonce = (nonce) => plt.$nonce$ = nonce;
1239
1249
 
1240
1250
  exports.bootstrapLazy = bootstrapLazy;
1251
+ exports.forceUpdate = forceUpdate;
1241
1252
  exports.getElement = getElement;
1242
1253
  exports.h = h;
1243
1254
  exports.promiseResolve = promiseResolve;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-abb69c35.js');
5
+ const index = require('./index-bbecc5bd.js');
6
6
  const appGlobals = require('./app-globals-3a1e7e63.js');
7
7
 
8
8
  const defineCustomElements = async (win, options) => {
@@ -114,11 +114,11 @@ function Kt(e) {
114
114
  const $ = [], He = [];
115
115
  let G = [];
116
116
  const Ze = [], er = /* @__PURE__ */ Promise.resolve();
117
- let we = !1;
117
+ let Ae = !1;
118
118
  function tr() {
119
- we || (we = !0, er.then(S));
119
+ Ae || (Ae = !0, er.then(S));
120
120
  }
121
- function Ae(e) {
121
+ function we(e) {
122
122
  G.push(e);
123
123
  }
124
124
  const ye = /* @__PURE__ */ new Set();
@@ -146,13 +146,13 @@ function S() {
146
146
  } while ($.length);
147
147
  for (; Ze.length; )
148
148
  Ze.pop()();
149
- we = !1, ye.clear(), Y(e);
149
+ Ae = !1, ye.clear(), Y(e);
150
150
  }
151
151
  function rr(e) {
152
152
  if (e.fragment !== null) {
153
153
  e.update(), re(e.before_update);
154
154
  const t = e.dirty;
155
- e.dirty = [-1], e.fragment && e.fragment.p(e.ctx, t), e.after_update.forEach(Ae);
155
+ e.dirty = [-1], e.fragment && e.fragment.p(e.ctx, t), e.after_update.forEach(we);
156
156
  }
157
157
  }
158
158
  function nr(e) {
@@ -165,10 +165,10 @@ function sr(e, t) {
165
165
  }
166
166
  function or(e, t, r) {
167
167
  const { fragment: n, after_update: i } = e.$$;
168
- n && n.m(t, r), Ae(() => {
168
+ n && n.m(t, r), we(() => {
169
169
  const s = e.$$.on_mount.map(ht).filter($e);
170
170
  e.$$.on_destroy ? e.$$.on_destroy.push(...s) : re(s), e.$$.on_mount = [];
171
- }), i.forEach(Ae);
171
+ }), i.forEach(we);
172
172
  }
173
173
  function ar(e, t) {
174
174
  const r = e.$$;
@@ -573,8 +573,8 @@ k.all = function(t, r) {
573
573
  return k(n, i, r);
574
574
  }, {});
575
575
  };
576
- var wr = k, Ar = wr;
577
- const Nr = /* @__PURE__ */ br(Ar);
576
+ var Ar = k, wr = Ar;
577
+ const Nr = /* @__PURE__ */ br(wr);
578
578
  var Ne = function(e, t) {
579
579
  return Ne = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) {
580
580
  r.__proto__ = n;
@@ -844,14 +844,14 @@ function jr(e) {
844
844
  function Vr(e) {
845
845
  return e.replace(/^(.*?)-/, "");
846
846
  }
847
- var qe = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g, Ht = /^(@+)?(\+|#+)?[rs]?$/g, Xr = /(\*)(0+)|(#+)(0+)|(0+)/g, wt = /^(0+)$/;
847
+ var qe = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g, Ht = /^(@+)?(\+|#+)?[rs]?$/g, Xr = /(\*)(0+)|(#+)(0+)|(0+)/g, At = /^(0+)$/;
848
848
  function Ye(e) {
849
849
  var t = {};
850
850
  return e[e.length - 1] === "r" ? t.roundingPriority = "morePrecision" : e[e.length - 1] === "s" && (t.roundingPriority = "lessPrecision"), e.replace(Ht, function(r, n, i) {
851
851
  return typeof i != "string" ? (t.minimumSignificantDigits = n.length, t.maximumSignificantDigits = n.length) : i === "+" ? t.minimumSignificantDigits = n.length : n[0] === "#" ? t.maximumSignificantDigits = n.length : (t.minimumSignificantDigits = n.length, t.maximumSignificantDigits = n.length + (typeof i == "string" ? i.length : 0)), "";
852
852
  }), t;
853
853
  }
854
- function At(e) {
854
+ function wt(e) {
855
855
  switch (e) {
856
856
  case "sign-auto":
857
857
  return {
@@ -899,14 +899,14 @@ function zr(e) {
899
899
  notation: "scientific"
900
900
  }, e = e.slice(1)), t) {
901
901
  var r = e.slice(0, 2);
902
- if (r === "+!" ? (t.signDisplay = "always", e = e.slice(2)) : r === "+?" && (t.signDisplay = "exceptZero", e = e.slice(2)), !wt.test(e))
902
+ if (r === "+!" ? (t.signDisplay = "always", e = e.slice(2)) : r === "+?" && (t.signDisplay = "exceptZero", e = e.slice(2)), !At.test(e))
903
903
  throw new Error("Malformed concise eng/scientific notation");
904
904
  t.minimumIntegerDigits = e.length;
905
905
  }
906
906
  return t;
907
907
  }
908
908
  function Ke(e) {
909
- var t = {}, r = At(e);
909
+ var t = {}, r = wt(e);
910
910
  return r || t;
911
911
  }
912
912
  function Wr(e) {
@@ -1008,7 +1008,7 @@ function Wr(e) {
1008
1008
  });
1009
1009
  continue;
1010
1010
  }
1011
- if (wt.test(i.stem)) {
1011
+ if (At.test(i.stem)) {
1012
1012
  t.minimumIntegerDigits = i.stem.length;
1013
1013
  continue;
1014
1014
  }
@@ -1026,7 +1026,7 @@ function Wr(e) {
1026
1026
  t = y(y({}, t), Ye(i.stem));
1027
1027
  continue;
1028
1028
  }
1029
- var a = At(i.stem);
1029
+ var a = wt(i.stem);
1030
1030
  a && (t = y(y({}, t), a));
1031
1031
  var o = zr(i.stem);
1032
1032
  o && (t = y(y({}, t), o));
@@ -2809,13 +2809,13 @@ var ln = (
2809
2809
  } else {
2810
2810
  if (_.length === 0)
2811
2811
  return this.error(m.EXPECT_DATE_TIME_SKELETON, x);
2812
- var w = _;
2813
- this.locale && (w = Zr(_, this.locale));
2812
+ var A = _;
2813
+ this.locale && (A = Zr(_, this.locale));
2814
2814
  var f = {
2815
2815
  type: j.dateTime,
2816
- pattern: w,
2816
+ pattern: A,
2817
2817
  location: u.styleLocation,
2818
- parsedOptions: this.shouldParseSkeletons ? Fr(w) : {}
2818
+ parsedOptions: this.shouldParseSkeletons ? Fr(A) : {}
2819
2819
  }, T = o === "date" ? g.date : g.time;
2820
2820
  return {
2821
2821
  val: { type: T, value: n, location: x, style: f },
@@ -3195,7 +3195,7 @@ function ae(e, t, r, n, i, s, a) {
3195
3195
  var E = l.children, x = l.value, _ = i[x];
3196
3196
  if (!En(_))
3197
3197
  throw new dn(x, "function", a);
3198
- var w = ae(E, t, r, n, i, s), T = _(w.map(function(P) {
3198
+ var A = ae(E, t, r, n, i, s), T = _(A.map(function(P) {
3199
3199
  return P.value;
3200
3200
  }));
3201
3201
  Array.isArray(T) || (T = [T]), o.push.apply(o, T.map(function(P) {
@@ -3444,7 +3444,7 @@ function Hn(e, t) {
3444
3444
  const r = Sn(e);
3445
3445
  return Bn(r, t);
3446
3446
  }
3447
- function wn(e) {
3447
+ function An(e) {
3448
3448
  if (e == null)
3449
3449
  return;
3450
3450
  const t = pe(e);
@@ -3463,7 +3463,7 @@ W(
3463
3463
  );
3464
3464
  ie.subscribe((e) => Ge = e);
3465
3465
  const ue = {};
3466
- function An(e, t) {
3466
+ function wn(e, t) {
3467
3467
  ue[e].delete(t), ue[e].size === 0 && delete ue[e];
3468
3468
  }
3469
3469
  function Ct(e) {
@@ -3485,7 +3485,7 @@ function Re(e) {
3485
3485
  }
3486
3486
  function On(e, t) {
3487
3487
  return Promise.all(
3488
- t.map((n) => (An(e, n), n().then((i) => i.default || i)))
3488
+ t.map((n) => (wn(e, n), n().then((i) => i.default || i)))
3489
3489
  ).then((n) => Mt(e, ...n));
3490
3490
  }
3491
3491
  const q = {};
@@ -3568,7 +3568,7 @@ ce.subscribe((e) => {
3568
3568
  De = e ?? void 0, typeof window < "u" && e != null && document.documentElement.setAttribute("lang", e);
3569
3569
  });
3570
3570
  const Fn = (e) => {
3571
- if (e && wn(e) && Re(e)) {
3571
+ if (e && An(e) && Re(e)) {
3572
3572
  const { loadingDelay: t } = X();
3573
3573
  let r;
3574
3574
  return typeof window < "u" && I() != null && t ? r = window.setTimeout(
@@ -3834,8 +3834,14 @@ function hi(e, t) {
3834
3834
  a.includes(s) || (n.adoptedStyleSheets = [...a, s]);
3835
3835
  });
3836
3836
  }
3837
- function li(e, t, r) {
3838
- return window.emMessageBus && (t = window.emMessageBus.subscribe(e, r)), t;
3837
+ function li(e, t, r, n = !1) {
3838
+ if (window.emMessageBus) {
3839
+ const i = n ? (s) => {
3840
+ !s || typeof s != "object" || Array.isArray(s) || Object.keys(s).forEach((a) => r(a, s[a]));
3841
+ } : r;
3842
+ t = window.emMessageBus.subscribe(e, i);
3843
+ }
3844
+ return t;
3839
3845
  }
3840
3846
  function ci(e) {
3841
3847
  Xt(e, "svelte-4r3z7g", '*,*::before,*::after{margin:0;padding:0;list-style:none;text-decoration:none;outline:none;box-sizing:border-box;font-family:inherit}.toggle-content{display:flex;flex-direction:row;align-items:center;justify-content:center;background-color:transparent;border:none;border-radius:20px;cursor:pointer;gap:10px}.toggle-content:disabled{cursor:not-allowed}.toggle-content .skip-switch{display:inline-flex;align-items:center;position:relative;height:20px;vertical-align:middle;transition:opacity 0.2s}.toggle-content .skip-switch.disabled{opacity:0.5;cursor:not-allowed;pointer-events:none}.toggle-content .skip-switch.checked .skip-switch-core{border-color:var(--emw--color-primary, #22b04e);background:var(--emw--color-primary, #22b04e)}.toggle-content .skip-switch.checked .skip-switch-core::after{transform:translateX(14px)}.toggle-content .skip-switch .skip-switch-input{position:absolute;width:0;height:0;opacity:0;margin:0}.toggle-content .skip-switch .skip-switch-core{width:34px;height:20px;border-radius:20px;border:1px solid var(--emw--color-gray-300, #ababab);background:var(--emw--color-gray-300, #ababab);position:relative;cursor:pointer;transition:background-color 0.25s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.25s cubic-bezier(0.22, 1, 0.36, 1)}.toggle-content .skip-switch .skip-switch-core::after{content:"";position:absolute;top:2px;left:2px;width:14px;height:14px;background:#fff;border-radius:50%;transform:translateX(0);transition:transform 0.25s cubic-bezier(0.22, 1, 0.36, 1)}.skip-switch.shake{animation:shake 0.4s ease}@keyframes shake{0%{transform:translateX(0)}20%{transform:translateX(-3px)}40%{transform:translateX(3px)}60%{transform:translateX(-3px)}80%{transform:translateX(3px)}100%{transform:translateX(0)}}.BiometricsToggle{background:var(--emw--pam-color-primary, var(--emw--color-primary, #22b04e));border:1px solid var(--emw--pam-color-primary, var(--emw--color-primary, #22b04e));color:var(--emw--button-typography, var(--emw--color-white, #ffffff));cursor:pointer;border-radius:5px;width:100%;height:50px;display:flex;align-items:center;justify-content:center;font-size:16px;text-transform:uppercase;transition-duration:0.3s;box-sizing:border-box}.BiometricsToggle:disabled{opacity:0.6;cursor:not-allowed}');
@@ -4002,16 +4008,16 @@ function bi(e) {
4002
4008
  function di(e, t, r) {
4003
4009
  let n;
4004
4010
  Vt(e, ti, (p) => r(7, n = p));
4005
- let { lang: i = "en" } = t, { clientstyling: s = "" } = t, { clientstylingurl: a = "" } = t, { mbsource: o } = t, { translationurl: h = "" } = t, { isNativeApp: u = !1 } = t, { mode: l = "button" } = t, { isFromLogin: c = !1 } = t, { isLoading: f = !1 } = t, d, E, x, _ = null, w = !1, T = !1, B = !1;
4011
+ let { lang: i = "en" } = t, { clientstyling: s = "" } = t, { clientstylingurl: a = "" } = t, { mbsource: o } = t, { translationurl: h = "" } = t, { isNativeApp: u = !1 } = t, { mode: l = "button" } = t, { isFromLogin: c = !1 } = t, { isLoading: f = !1 } = t, d, E, x, _ = null, A = !1, T = !1, B = !1;
4006
4012
  const O = (p) => {
4007
- Object.keys(p).forEach((A) => {
4008
- ri(A, p[A]);
4013
+ Object.keys(p).forEach((w) => {
4014
+ ri(w, p[w]);
4009
4015
  });
4010
4016
  }, P = () => {
4011
- fetch(h).then((A) => A.json()).then((A) => {
4012
- O(A);
4013
- }).catch((A) => {
4014
- console.log(A);
4017
+ fetch(h).then((w) => w.json()).then((w) => {
4018
+ O(w);
4019
+ }).catch((w) => {
4020
+ console.log(w);
4015
4021
  });
4016
4022
  };
4017
4023
  O(ii);
@@ -4039,22 +4045,22 @@ function di(e, t, r) {
4039
4045
  }, je = async () => {
4040
4046
  T || (r(5, T = !0), B = !0, window.postMessage({
4041
4047
  type: "ToggleBiometrics",
4042
- data: `${!w}`,
4048
+ data: `${!A}`,
4043
4049
  isFromLogin: c
4044
4050
  }), ke());
4045
4051
  }, Ve = (p) => {
4046
- p.data?.type === "NativeAppReady" && (r(0, u = !0), Xe()), p.data?.type === "BiometricsStatus" && (r(4, w = p.data.status || !1), r(5, T = !1), _ && (clearTimeout(_), _ = null), B && (c || ze("success", n(w ? "successEnableBiometrics" : "successDisableBiometrics"))), B = !1);
4052
+ p.data?.type === "NativeAppReady" && (r(0, u = !0), Xe()), p.data?.type === "BiometricsStatus" && (r(4, A = p.data.status || !1), r(5, T = !1), _ && (clearTimeout(_), _ = null), B && (c || ze("success", n(A ? "successEnableBiometrics" : "successDisableBiometrics"))), B = !1);
4047
4053
  }, Xe = () => {
4048
4054
  r(5, T = !0), window.postMessage({ type: "GetBiometricsStatus" }), ke();
4049
4055
  }, Gt = () => {
4050
4056
  window.postMessage({ type: "CheckNativeApp" });
4051
- }, ze = (p, A) => {
4057
+ }, ze = (p, w) => {
4052
4058
  window.postMessage(
4053
4059
  {
4054
4060
  type: "WidgetNotification",
4055
4061
  data: {
4056
4062
  type: p,
4057
- message: A,
4063
+ message: w,
4058
4064
  config: { clearBefore: !0 }
4059
4065
  }
4060
4066
  },
@@ -4085,7 +4091,7 @@ function di(e, t, r) {
4085
4091
  l,
4086
4092
  f,
4087
4093
  d,
4088
- w,
4094
+ A,
4089
4095
  T,
4090
4096
  Ee,
4091
4097
  n,
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-abb69c35.js');
5
+ const index = require('./index-bbecc5bd.js');
6
6
 
7
7
  const DEFAULT_LANGUAGE = 'en';
8
8
  const TRANSLATIONS = {
@@ -355,19 +355,20 @@ const TRANSLATIONS = {
355
355
  "biometricLogin": "Login with FaceID/Fingerprint",
356
356
  }
357
357
  };
358
+ const setTranslation = (data) => {
359
+ Object.keys(data).forEach((locale) => {
360
+ TRANSLATIONS[locale] = TRANSLATIONS[locale] || {};
361
+ Object.keys(data[locale]).forEach((key) => {
362
+ TRANSLATIONS[locale][key] = data[locale][key];
363
+ });
364
+ });
365
+ };
358
366
  const getTranslations = (url) => {
359
367
  return new Promise((resolve) => {
360
368
  fetch(url)
361
369
  .then((res) => res.json())
362
370
  .then((data) => {
363
- Object.keys(data).forEach((lang) => {
364
- if (!TRANSLATIONS[lang]) {
365
- TRANSLATIONS[lang] = {};
366
- }
367
- for (let key in data[lang]) {
368
- TRANSLATIONS[lang][key] = data[lang][key];
369
- }
370
- });
371
+ setTranslation(data);
371
372
  resolve(true);
372
373
  });
373
374
  });
@@ -384,6 +385,26 @@ const translate = (key, customLang, values) => {
384
385
  return translation;
385
386
  };
386
387
 
388
+ /**
389
+ * Subscribe to translation updates from the message bus.
390
+ *
391
+ * @param {string} domain - Message bus topic, such as `MyWidget.Translation`.
392
+ * @param {object | undefined} subscription - Existing subscription returned if the message bus is unavailable.
393
+ * @param {Function} onChange - Callback receiving the payload or `(locale, messages)` when byLocale is true.
394
+ * @param {boolean} [byLocale=false] - Invoke the callback once per locale, ignoring invalid payloads.
395
+ * @returns {object | undefined} The new or existing subscription.
396
+ */
397
+ function getStreamTranslations(domain, subscription, onChange, byLocale = false) {
398
+ if (window.emMessageBus) {
399
+ const callback = byLocale ? (data) => {
400
+ if (!data || typeof data !== 'object' || Array.isArray(data)) return;
401
+ Object.keys(data).forEach((locale) => onChange(locale, data[locale]));
402
+ } : onChange;
403
+ subscription = window.emMessageBus.subscribe(domain, callback);
404
+ }
405
+ return subscription;
406
+ }
407
+
387
408
  const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
388
409
 
389
410
  /**
@@ -7543,7 +7564,7 @@ const UserLogin = class {
7543
7564
  if (((_a = e.data) === null || _a === void 0 ? void 0 : _a.type) === 'NativeAppReady') {
7544
7565
  this.isNativeApp = true;
7545
7566
  if (!this.biometricsLoaded) {
7546
- await Promise.resolve().then(function () { return require('./player-account-biometrics-action-3305afaf.js'); });
7567
+ await Promise.resolve().then(function () { return require('./player-account-biometrics-action-1bd8be5f.js'); });
7547
7568
  this.biometricsLoaded = true;
7548
7569
  }
7549
7570
  }
@@ -8001,10 +8022,21 @@ const UserLogin = class {
8001
8022
  if (this.clientStylingUrl)
8002
8023
  setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
8003
8024
  }
8025
+ handleClientTranslations() {
8026
+ if (this.mbSource && !this.translationUrl) {
8027
+ this.translationSubscription = getStreamTranslations(`${this.mbSource}.Translation`, this.translationSubscription, (data) => {
8028
+ if (!data || typeof data !== 'object')
8029
+ return;
8030
+ setTranslation(data);
8031
+ index.forceUpdate(this.host);
8032
+ });
8033
+ }
8034
+ }
8004
8035
  /**
8005
8036
  * Lifecycle method: Set up event listeners after the component is rendered
8006
8037
  */
8007
8038
  componentDidLoad() {
8039
+ this.handleClientTranslations();
8008
8040
  this.handleClientStyling();
8009
8041
  window.addEventListener('LoginCredentials', this.autofillCredentialsHandler);
8010
8042
  window.postMessage({ type: 'UserLoginDidLoad' });
@@ -8086,12 +8118,13 @@ const UserLogin = class {
8086
8118
  * Lifecycle method: Clean up event listeners when the component is removed
8087
8119
  */
8088
8120
  disconnectedCallback() {
8089
- var _a, _b;
8121
+ var _a, _b, _c;
8122
+ (_a = this.translationSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
8090
8123
  this.stylingSubscription && this.stylingSubscription.unsubscribe();
8091
8124
  window.removeEventListener('LoginCredentials', this.autofillCredentialsHandler);
8092
8125
  window.removeEventListener('message', this.messageHandler);
8093
8126
  if (this.turnstileSiteKey)
8094
- (_b = (_a = this.captchaInstance) === null || _a === void 0 ? void 0 : _a.cleanup) === null || _b === void 0 ? void 0 : _b.call(_a);
8127
+ (_c = (_b = this.captchaInstance) === null || _b === void 0 ? void 0 : _b.cleanup) === null || _c === void 0 ? void 0 : _c.call(_b);
8095
8128
  }
8096
8129
  /**
8097
8130
  * Send error notification as a post message
@@ -8174,7 +8207,7 @@ const UserLogin = class {
8174
8207
  * Render function
8175
8208
  */
8176
8209
  render() {
8177
- return (index.h("section", { key: '0bacb3e129ac8c4fb9ce07449995ef21e86d213f', ref: el => this.stylingContainer = el }, this.renderUserIdentification(), index.h("slot", { key: '3c5417e4daab9845d38c34412a6ee4aecbc4c70d', name: CAPTCHA_CONTAINER_SLOT })));
8210
+ return (index.h("section", { key: '9c89db60dc60d51a23be372c030f96842cfac9b0', ref: el => this.stylingContainer = el }, this.renderUserIdentification(), index.h("slot", { key: '41cfd006898fd028afb55314051d37954da71bde', name: CAPTCHA_CONTAINER_SLOT })));
8178
8211
  }
8179
8212
  get host() { return index.getElement(this); }
8180
8213
  static get watchers() { return {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-abb69c35.js');
5
+ const index = require('./index-bbecc5bd.js');
6
6
  const appGlobals = require('./app-globals-3a1e7e63.js');
7
7
 
8
8
  /*
@@ -1,5 +1,6 @@
1
- import { h } from "@stencil/core";
2
- import { getTranslations, translate } from "../../utils/locale.utils";
1
+ import { forceUpdate, h } from "@stencil/core";
2
+ import { getTranslations, setTranslation, translate } from "../../utils/locale.utils";
3
+ import { getStreamTranslations } from "../../../../../../../../libs/common/src/i18n/index";
3
4
  import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
4
5
  import { getSlottedElement } from "../../../../../../../../libs/common/src/utils/index";
5
6
  import { dispatchCustomEvent } from "../../../../../../../../libs/custom-events/src/index";
@@ -475,10 +476,21 @@ export class UserLogin {
475
476
  if (this.clientStylingUrl)
476
477
  setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
477
478
  }
479
+ handleClientTranslations() {
480
+ if (this.mbSource && !this.translationUrl) {
481
+ this.translationSubscription = getStreamTranslations(`${this.mbSource}.Translation`, this.translationSubscription, (data) => {
482
+ if (!data || typeof data !== 'object')
483
+ return;
484
+ setTranslation(data);
485
+ forceUpdate(this.host);
486
+ });
487
+ }
488
+ }
478
489
  /**
479
490
  * Lifecycle method: Set up event listeners after the component is rendered
480
491
  */
481
492
  componentDidLoad() {
493
+ this.handleClientTranslations();
482
494
  this.handleClientStyling();
483
495
  window.addEventListener('LoginCredentials', this.autofillCredentialsHandler);
484
496
  window.postMessage({ type: 'UserLoginDidLoad' });
@@ -560,12 +572,13 @@ export class UserLogin {
560
572
  * Lifecycle method: Clean up event listeners when the component is removed
561
573
  */
562
574
  disconnectedCallback() {
563
- var _a, _b;
575
+ var _a, _b, _c;
576
+ (_a = this.translationSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
564
577
  this.stylingSubscription && this.stylingSubscription.unsubscribe();
565
578
  window.removeEventListener('LoginCredentials', this.autofillCredentialsHandler);
566
579
  window.removeEventListener('message', this.messageHandler);
567
580
  if (this.turnstileSiteKey)
568
- (_b = (_a = this.captchaInstance) === null || _a === void 0 ? void 0 : _a.cleanup) === null || _b === void 0 ? void 0 : _b.call(_a);
581
+ (_c = (_b = this.captchaInstance) === null || _b === void 0 ? void 0 : _b.cleanup) === null || _c === void 0 ? void 0 : _c.call(_b);
569
582
  }
570
583
  /**
571
584
  * Send error notification as a post message
@@ -648,7 +661,7 @@ export class UserLogin {
648
661
  * Render function
649
662
  */
650
663
  render() {
651
- return (h("section", { key: '0bacb3e129ac8c4fb9ce07449995ef21e86d213f', ref: el => this.stylingContainer = el }, this.renderUserIdentification(), h("slot", { key: '3c5417e4daab9845d38c34412a6ee4aecbc4c70d', name: CAPTCHA_CONTAINER_SLOT })));
664
+ return (h("section", { key: '9c89db60dc60d51a23be372c030f96842cfac9b0', ref: el => this.stylingContainer = el }, this.renderUserIdentification(), h("slot", { key: '41cfd006898fd028afb55314051d37954da71bde', name: CAPTCHA_CONTAINER_SLOT })));
652
665
  }
653
666
  static get is() { return "user-login"; }
654
667
  static get encapsulation() { return "shadow"; }
@@ -349,19 +349,20 @@ const TRANSLATIONS = {
349
349
  "biometricLogin": "Login with FaceID/Fingerprint",
350
350
  }
351
351
  };
352
+ export const setTranslation = (data) => {
353
+ Object.keys(data).forEach((locale) => {
354
+ TRANSLATIONS[locale] = TRANSLATIONS[locale] || {};
355
+ Object.keys(data[locale]).forEach((key) => {
356
+ TRANSLATIONS[locale][key] = data[locale][key];
357
+ });
358
+ });
359
+ };
352
360
  export const getTranslations = (url) => {
353
361
  return new Promise((resolve) => {
354
362
  fetch(url)
355
363
  .then((res) => res.json())
356
364
  .then((data) => {
357
- Object.keys(data).forEach((lang) => {
358
- if (!TRANSLATIONS[lang]) {
359
- TRANSLATIONS[lang] = {};
360
- }
361
- for (let key in data[lang]) {
362
- TRANSLATIONS[lang][key] = data[lang][key];
363
- }
364
- });
365
+ setTranslation(data);
365
366
  resolve(true);
366
367
  });
367
368
  });
@@ -829,6 +829,16 @@ var postUpdateComponent = (hostRef) => {
829
829
  hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
830
830
  }
831
831
  };
832
+ var forceUpdate = (ref) => {
833
+ {
834
+ const hostRef = getHostRef(ref);
835
+ const isConnected = hostRef.$hostElement$.isConnected;
836
+ if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
837
+ scheduleUpdate(hostRef, false);
838
+ }
839
+ return isConnected;
840
+ }
841
+ };
832
842
  var appDidLoad = (who) => {
833
843
  {
834
844
  addHydratedFlag(doc.documentElement);
@@ -1215,4 +1225,4 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1215
1225
  // src/runtime/nonce.ts
1216
1226
  var setNonce = (nonce) => plt.$nonce$ = nonce;
1217
1227
 
1218
- export { bootstrapLazy as b, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
1228
+ export { bootstrapLazy as b, forceUpdate as f, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
@@ -1,5 +1,5 @@
1
- import { b as bootstrapLazy } from './index-b943f0d9.js';
2
- export { s as setNonce } from './index-b943f0d9.js';
1
+ import { b as bootstrapLazy } from './index-1a58e188.js';
2
+ export { s as setNonce } from './index-1a58e188.js';
3
3
  import { g as globalScripts } from './app-globals-0f993ce5.js';
4
4
 
5
5
  const defineCustomElements = async (win, options) => {