@invoice-sdk/widget 1.124.3 → 1.124.4

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.
@@ -1,4 +1,4 @@
1
- import { k as u, g as p, l as d, C as l, G as w, n as m, o as f, I as E, p as R, S as y, q as C, e as I, r as v, u as o, w as T, O as h } from "./index-BUF422n9.js";
1
+ import { k as u, g as p, l as d, C as l, G as w, n as m, o as f, I as E, p as R, S as y, q as C, e as I, r as v, u as o, w as T, O as h } from "./index-CNB26P5W.js";
2
2
  function _({
3
3
  title: e,
4
4
  isDisabled: t = !1,
@@ -73,7 +73,7 @@ async function U(e, t) {
73
73
  }
74
74
  })).data;
75
75
  }
76
- const $ = (e) => new Intl.NumberFormat("vi-VN").format(e), O = "1.124.3";
76
+ const $ = (e) => new Intl.NumberFormat("vi-VN").format(e), O = "1.124.4";
77
77
  async function k({ search: e, bank: t }) {
78
78
  return (await n.get(`${o}`, {
79
79
  params: {
@@ -1,5 +1,5 @@
1
- import { t as g, g as ch, a as ot, s as Lt, c as xt, b as wh, d as ph, e as eh, f as Ch, m as fh, h as Xh, i as Bh, v as Nh } from "./index-BUF422n9.js";
2
- import { c as qt, a as Vt, g as It, b as Eh, f as kn, d as Hh, e as Mt, h as Ph, i as kh, j as yh, k as vh, l as Qh, m as Lh, n as Ih } from "./loading-BlIhMRLy.js";
1
+ import { t as g, g as ch, a as ot, s as Lt, c as dt, b as wh, d as ph, e as eh, f as Ch, m as fh, h as Xh, i as Bh, v as Nh } from "./index-CNB26P5W.js";
2
+ import { c as qt, a as Vt, g as It, b as Eh, f as kn, d as Hh, e as Mt, h as Ph, i as kh, j as yh, k as vh, l as Qh, m as Lh, n as Ih } from "./loading-BCCQ18FQ.js";
3
3
  import { g as Ah } from "./_commonjsHelpers-DaMA6jEr.js";
4
4
  function d0({ steps: n = [], currentStep: t = 1 } = {}) {
5
5
  const e = document.createElement("div");
@@ -1519,7 +1519,7 @@ const at = {
1519
1519
  clear: oh,
1520
1520
  destroy: Uh
1521
1521
  };
1522
- var dt = (n, t, e) => new Promise((a, h) => {
1522
+ var wt = (n, t, e) => new Promise((a, h) => {
1523
1523
  var c = (o) => {
1524
1524
  try {
1525
1525
  u(e.next(o));
@@ -1573,7 +1573,7 @@ function _h(n) {
1573
1573
  });
1574
1574
  }
1575
1575
  function $h() {
1576
- return dt(this, null, function* () {
1576
+ return wt(this, null, function* () {
1577
1577
  try {
1578
1578
  jn || (yield _h(
1579
1579
  "https://cdn.jsdelivr.net/npm/onnxruntime-web@1.18.0/dist/ort.min.js"
@@ -1584,7 +1584,7 @@ function $h() {
1584
1584
  });
1585
1585
  }
1586
1586
  function qh(n, t) {
1587
- return dt(this, null, function* () {
1587
+ return wt(this, null, function* () {
1588
1588
  try {
1589
1589
  if (yield $h(), !jn || !jn.InferenceSession)
1590
1590
  throw new Error(
@@ -1716,7 +1716,7 @@ function ma(n, t, e, a) {
1716
1716
  return h;
1717
1717
  }
1718
1718
  function qa(n) {
1719
- return dt(this, null, function* () {
1719
+ return wt(this, null, function* () {
1720
1720
  try {
1721
1721
  let t = aa();
1722
1722
  t || (yield qh());
@@ -1794,7 +1794,7 @@ function la(n) {
1794
1794
  };
1795
1795
  }
1796
1796
  function ga(n) {
1797
- return dt(this, null, function* () {
1797
+ return wt(this, null, function* () {
1798
1798
  let t = null;
1799
1799
  const e = ["original", "grayscale", "threshold"];
1800
1800
  for (const a of e) {
@@ -1810,7 +1810,7 @@ function ga(n) {
1810
1810
  });
1811
1811
  }
1812
1812
  function ra(n) {
1813
- return dt(this, null, function* () {
1813
+ return wt(this, null, function* () {
1814
1814
  let t = ca();
1815
1815
  if (!t) throw new Error("ZXing not initialized");
1816
1816
  try {
@@ -1827,7 +1827,7 @@ function ra(n) {
1827
1827
  });
1828
1828
  }
1829
1829
  function Ta(n, t = "sourceCanvas") {
1830
- return dt(this, null, function* () {
1830
+ return wt(this, null, function* () {
1831
1831
  try {
1832
1832
  let e = ha();
1833
1833
  e || (yield initModel());
@@ -1910,7 +1910,7 @@ const xa = () => typeof window < "u" && typeof window.umami < "u", Qn = (n, t =
1910
1910
  STEP3_PAYMENT_SUCCESS: "einv_payment_success",
1911
1911
  STEP3_PAYMENT_FAILED: "einv_payment_failed",
1912
1912
  STEP3_PAYMENT_WRONG_AMOUNT: "einv_payment_wrong_amount"
1913
- }, Xt = {
1913
+ }, Bt = {
1914
1914
  success(n) {
1915
1915
  Qn(Ln.STEP3_PAYMENT_SUCCESS, {
1916
1916
  orderId: n.orderId,
@@ -2552,13 +2552,13 @@ async function da({
2552
2552
  }, mn = (ln) => {
2553
2553
  if (!ln) return "";
2554
2554
  if (/^\d{8}$/.test(ln)) {
2555
- const ft = ln.slice(0, 2), Kt = ln.slice(2, 4), dh = ln.slice(4, 8);
2556
- return `${ft}/${Kt}/${dh}`;
2555
+ const Xt = ln.slice(0, 2), Kt = ln.slice(2, 4), dh = ln.slice(4, 8);
2556
+ return `${Xt}/${Kt}/${dh}`;
2557
2557
  }
2558
2558
  const [Gn, On, Vn] = ln.split("/"), Rn = new Date(+Vn, +On - 1, +Gn);
2559
2559
  if (isNaN(Rn)) return "";
2560
- const Dt = String(Rn.getDate()).padStart(2, "0"), Ct = String(Rn.getMonth() + 1).padStart(2, "0"), kt = Rn.getFullYear();
2561
- return `${Dt}/${Ct}/${kt}`;
2560
+ const Dt = String(Rn.getDate()).padStart(2, "0"), ft = String(Rn.getMonth() + 1).padStart(2, "0"), kt = Rn.getFullYear();
2561
+ return `${Dt}/${ft}/${kt}`;
2562
2562
  }, Bn = new Image();
2563
2563
  Bn.src = URL.createObjectURL(b), Bn.onload = async () => {
2564
2564
  try {
@@ -2566,18 +2566,18 @@ async function da({
2566
2566
  const ln = await Ta(Bn).then((Gn) => JSON.parse(Gn).status !== "success" ? (fn = !0, bn = !1, F(), Kn(), null) : JSON.parse(Gn).data);
2567
2567
  if (ln || V({ success: !1, reason: "No data detected" }), ln) {
2568
2568
  fn = !1, bn = !0, Kn();
2569
- const On = Object.values(ln).every((ft) => !ft);
2570
- F(), On && (pt(
2569
+ const On = Object.values(ln).every((Xt) => !Xt);
2570
+ F(), On && (Ct(
2571
2571
  g("errorInvalidCard", "Vui lòng tải lên ảnh CMND/CCCD hợp lệ")
2572
2572
  ), F(), V({ success: !1, reason: "Invalid card data" }));
2573
- const { address: Vn, date_of_birth: Rn, full_name: Dt, id_number: Ct, sex: kt } = ln;
2574
- if (!Ct || !/^\d{12}$/.test(Ct) ? (pt(
2573
+ const { address: Vn, date_of_birth: Rn, full_name: Dt, id_number: ft, sex: kt } = ln;
2574
+ if (!ft || !/^\d{12}$/.test(ft) ? (Ct(
2575
2575
  g("errorInvalidCard", "Số CCCD phải có 12 chữ số")
2576
- ), O.inputEl.value = "") : (O.inputEl.value = Ct, O.setError(null)), v.inputEl.value = Dt || "", f.inputEl.value = mn(Rn), q.inputEl.value = Vn || "", kt) {
2577
- const ft = C0.find(
2576
+ ), O.inputEl.value = "") : (O.inputEl.value = ft, O.setError(null)), v.inputEl.value = Dt || "", f.inputEl.value = mn(Rn), q.inputEl.value = Vn || "", kt) {
2577
+ const Xt = C0.find(
2578
2578
  (Kt) => Kt.label.toLowerCase() === kt.toLowerCase()
2579
2579
  );
2580
- N.selectEl.value = ft?.value || "";
2580
+ N.selectEl.value = Xt?.value || "";
2581
2581
  }
2582
2582
  }
2583
2583
  V({ success: !0, data: ln });
@@ -2594,7 +2594,7 @@ async function da({
2594
2594
  mn.src = URL.createObjectURL(b), mn.onload = async () => {
2595
2595
  await window.__sdkInitPromise, await qa(mn).then((Bn) => {
2596
2596
  const ln = JSON.parse(Bn);
2597
- V && !ln?.data?.isFront ? pt(
2597
+ V && !ln?.data?.isFront ? Ct(
2598
2598
  g("errorInvalidCard", "Vui lòng tải lên ảnh CMND/CCCD hợp lệ")
2599
2599
  ) : F && !ln?.data?.isBack && Ht(
2600
2600
  g("errorInvalidCard", "Vui lòng tải lên ảnh CMND/CCCD hợp lệ")
@@ -2605,8 +2605,8 @@ async function da({
2605
2605
  const {
2606
2606
  container: lt,
2607
2607
  getFrontFileError: At,
2608
- getBackFileError: wt,
2609
- setFrontFileError: pt,
2608
+ getBackFileError: pt,
2609
+ setFrontFileError: Ct,
2610
2610
  setBackFileError: Ht,
2611
2611
  getFrontFile: ut,
2612
2612
  getBackFile: Pt
@@ -2614,7 +2614,7 @@ async function da({
2614
2614
  frontFile: t?.idCard,
2615
2615
  backFile: t?.idCardBack,
2616
2616
  onFrontChange: async (b) => {
2617
- if (D = b, zn(b, !0, !1), At() || wt() || !Pt()) {
2617
+ if (D = b, zn(b, !0, !1), At() || pt() || !Pt()) {
2618
2618
  fn = !1, bn = !1, Kn(), en();
2619
2619
  return;
2620
2620
  }
@@ -2625,7 +2625,7 @@ async function da({
2625
2625
  Wn(b);
2626
2626
  },
2627
2627
  onBackChange: async (b) => {
2628
- if (nn = b, zn(b, !1, !0), At() || wt() || !ut()) {
2628
+ if (nn = b, zn(b, !1, !0), At() || pt() || !ut()) {
2629
2629
  fn = !1, bn = !1, Kn(), en();
2630
2630
  return;
2631
2631
  }
@@ -2753,7 +2753,7 @@ async function da({
2753
2753
  }
2754
2754
  function en() {
2755
2755
  const b = e === "bvb" && !s && o === !1 && !t._userHasEditedTaxCode;
2756
- Y.disabled = !dn() || !on || At() || wt() || U.getError() || R.getError() || b;
2756
+ Y.disabled = !dn() || !on || At() || pt() || U.getError() || R.getError() || b;
2757
2757
  }
2758
2758
  function sn() {
2759
2759
  return {
@@ -3541,7 +3541,7 @@ async function ka({
3541
3541
  }
3542
3542
  });
3543
3543
  Wn.appendChild(At);
3544
- async function wt() {
3544
+ async function pt() {
3545
3545
  d?.eInvoiceRegistration?.businessType;
3546
3546
  const W = "ENTERPRISE", an = {
3547
3547
  bank: T,
@@ -3619,7 +3619,7 @@ async function ka({
3619
3619
  }
3620
3620
  f = [];
3621
3621
  }
3622
- pt();
3622
+ Ct();
3623
3623
  } catch (An) {
3624
3624
  console.error("Unexpected error during data loading:", An), at.error(g("errorLoadingData") || "Failed to load data", {
3625
3625
  autoClose: 5e3,
@@ -3628,7 +3628,7 @@ async function ka({
3628
3628
  });
3629
3629
  }
3630
3630
  }
3631
- function pt() {
3631
+ function Ct() {
3632
3632
  nt(), Pt(), E || gt(), tt(), Dn(), En();
3633
3633
  }
3634
3634
  function Ht(W, an, An) {
@@ -3638,7 +3638,7 @@ async function ka({
3638
3638
  (Z) => Z.bank === T && Z.appliedPackages.includes(an)
3639
3639
  ), _ = O.includes(an) || hn && !hn.isHidden && !(hn.expiredAt < (/* @__PURE__ */ new Date()).toISOString()) && hn.limit !== hn.used && hn.isActive;
3640
3640
  if (un && !_) {
3641
- const { container: Z, open: on } = xt({
3641
+ const { container: Z, open: on } = dt({
3642
3642
  message: g("errorDiscountPackage"),
3643
3643
  description: g("errorDiscountPackageDes"),
3644
3644
  okLabel: g("ok"),
@@ -4013,7 +4013,7 @@ async function ka({
4013
4013
  }
4014
4014
  Kn.innerText = kn(Xn) + " VND";
4015
4015
  }
4016
- return wt(), { container: J };
4016
+ return pt(), { container: J };
4017
4017
  }
4018
4018
  function ya({
4019
4019
  qrSrc: n = "",
@@ -4261,7 +4261,7 @@ function Ia({
4261
4261
  /bg-primary|bg-\[\#0066cc\]/g,
4262
4262
  "bg-green-500"
4263
4263
  ), D.textContent = g("confirmed") || "Đã xác nhận";
4264
- const j = xt({
4264
+ const j = dt({
4265
4265
  message: g("freeOrderSuccess") || "Thông tin đăng ký đã được ghi nhận thành công!",
4266
4266
  okLabel: g("next") || "Tiếp tục",
4267
4267
  theme: "bvb",
@@ -4274,7 +4274,7 @@ function Ia({
4274
4274
  i.appendChild(j.container), j.open();
4275
4275
  } catch {
4276
4276
  D.disabled = !1, D.textContent = Y;
4277
- const xn = xt({
4277
+ const xn = dt({
4278
4278
  message: "Xác nhận đơn hàng thất bại. Vui lòng thử lại.",
4279
4279
  okLabel: "OK",
4280
4280
  isSuccess: !1
@@ -4283,7 +4283,7 @@ function Ia({
4283
4283
  }
4284
4284
  } : () => {
4285
4285
  s && clearInterval(s);
4286
- const Y = xt({
4286
+ const Y = dt({
4287
4287
  message: g("transactionCanceled"),
4288
4288
  okLabel: g("ok"),
4289
4289
  onClose: () => {
@@ -4298,7 +4298,7 @@ function Ia({
4298
4298
  className: "wgt:flex-1 wgt:py-4 wgt:rounded-lg wgt:bg-transparent wgt:border wgt:border-primary wgt:text-primary hover:wgt:bg-transparent",
4299
4299
  handleClick: () => {
4300
4300
  s && clearInterval(s);
4301
- const Y = xt({
4301
+ const Y = dt({
4302
4302
  message: g("transactionCanceled"),
4303
4303
  isSuccess: !1,
4304
4304
  okLabel: g("ok"),
@@ -4996,9 +4996,9 @@ function ih() {
4996
4996
  }
4997
4997
  }, Qt;
4998
4998
  }
4999
- var _t = {}, Bt = {}, V0;
4999
+ var _t = {}, Nt = {}, V0;
5000
5000
  function Ka() {
5001
- if (V0) return Bt;
5001
+ if (V0) return Nt;
5002
5002
  V0 = 1;
5003
5003
  const n = new Uint8Array(512), t = new Uint8Array(256);
5004
5004
  return function() {
@@ -5007,14 +5007,14 @@ function Ka() {
5007
5007
  n[h] = a, t[a] = h, a <<= 1, a & 256 && (a ^= 285);
5008
5008
  for (let h = 255; h < 512; h++)
5009
5009
  n[h] = n[h - 255];
5010
- }(), Bt.log = function(a) {
5010
+ }(), Nt.log = function(a) {
5011
5011
  if (a < 1) throw new Error("log(" + a + ")");
5012
5012
  return t[a];
5013
- }, Bt.exp = function(a) {
5013
+ }, Nt.exp = function(a) {
5014
5014
  return n[a];
5015
- }, Bt.mul = function(a, h) {
5015
+ }, Nt.mul = function(a, h) {
5016
5016
  return a === 0 || h === 0 ? 0 : n[t[a] + t[h]];
5017
- }, Bt;
5017
+ }, Nt;
5018
5018
  }
5019
5019
  var S0;
5020
5020
  function Oa() {
@@ -6119,7 +6119,7 @@ async function mc({
6119
6119
  l && (clearInterval(l), l = null), h?.onResetToStep1 && h.onResetToStep1();
6120
6120
  },
6121
6121
  onFreeOrderConfirmed: () => {
6122
- Xt.freeOrderConfirmed({
6122
+ Bt.freeOrderConfirmed({
6123
6123
  orderId: i,
6124
6124
  totalAmount: d,
6125
6125
  orderAmount: d,
@@ -6165,7 +6165,7 @@ async function mc({
6165
6165
  provider: w,
6166
6166
  theme: A,
6167
6167
  isFreeOrder: m
6168
- }), m && Xt.freeOrderDetected({
6168
+ }), m && Bt.freeOrderDetected({
6169
6169
  orderId: i,
6170
6170
  totalAmount: d,
6171
6171
  orderAmount: d,
@@ -6245,7 +6245,7 @@ async function mc({
6245
6245
  const X = await Ih(i);
6246
6246
  if (X.paymentStatus === "pending") return;
6247
6247
  if (X.paymentStatus === "wrong_amount") {
6248
- clearInterval(l), l = null, Xt.wrongAmount({
6248
+ clearInterval(l), l = null, Bt.wrongAmount({
6249
6249
  orderId: i,
6250
6250
  expectedAmount: d,
6251
6251
  receivedAmount: X?.receivedAmount ?? X?.amount ?? null,
@@ -6269,7 +6269,7 @@ async function mc({
6269
6269
  }
6270
6270
  clearInterval(l), l = null;
6271
6271
  const y = L ? Math.round((Date.now() - L) / 1e3) : null;
6272
- X.paymentStatus === "paid" ? Xt.success({
6272
+ X.paymentStatus === "paid" ? Bt.success({
6273
6273
  orderId: i,
6274
6274
  amount: d,
6275
6275
  transactionId: X?.transactionId || X?.transaction_id,
@@ -6277,7 +6277,7 @@ async function mc({
6277
6277
  provider: w,
6278
6278
  theme: A,
6279
6279
  duration: y
6280
- }) : Xt.failed({
6280
+ }) : Bt.failed({
6281
6281
  orderId: i,
6282
6282
  amount: d,
6283
6283
  errorCode: X?.errorCode || X?.error_code,
@@ -6294,7 +6294,7 @@ async function mc({
6294
6294
  provider: w,
6295
6295
  theme: A
6296
6296
  });
6297
- const K = xt({
6297
+ const K = dt({
6298
6298
  message: X.paymentStatus === "paid" ? g("paymentSuccess") : g("paymentFailed"),
6299
6299
  okLabel: "OK",
6300
6300
  theme: A,
@@ -6500,7 +6500,7 @@ function dc() {
6500
6500
  }
6501
6501
  };
6502
6502
  }
6503
- async function hh({
6503
+ async function wc({
6504
6504
  orderId: n,
6505
6505
  callbackUrl: t,
6506
6506
  onCompleteSignature: e
@@ -6531,24 +6531,24 @@ async function hh({
6531
6531
  }
6532
6532
  function xh(n, t) {
6533
6533
  const e = (t && t.includeHash) != null ? t.includeHash : !0, a = t && t.pollMs || 1e3;
6534
- let h = ah(e);
6534
+ let h = hh(e);
6535
6535
  function c() {
6536
- const o = ah(e);
6536
+ const o = hh(e);
6537
6537
  if (o !== h) {
6538
6538
  const l = h;
6539
6539
  h = o, n(o, l);
6540
6540
  }
6541
6541
  }
6542
6542
  window.addEventListener("popstate", c), e && window.addEventListener("hashchange", c);
6543
- const A = wc(c), u = window.setInterval(c, a);
6543
+ const A = pc(c), u = window.setInterval(c, a);
6544
6544
  return Promise.resolve().then(c), function() {
6545
6545
  window.removeEventListener("popstate", c), e && window.removeEventListener("hashchange", c), A(), clearInterval(u);
6546
6546
  };
6547
6547
  }
6548
- function ah(n) {
6548
+ function hh(n) {
6549
6549
  return n ? location.href : location.origin + location.pathname;
6550
6550
  }
6551
- function wc(n) {
6551
+ function pc(n) {
6552
6552
  var t = "__urlWatcherPatched__";
6553
6553
  if (history[t]) {
6554
6554
  var e = function() {
@@ -6578,13 +6578,13 @@ function wc(n) {
6578
6578
  }
6579
6579
  };
6580
6580
  }
6581
- function pc() {
6581
+ function Cc() {
6582
6582
  const n = document.body.getAttribute("data-app-theme");
6583
6583
  if (n) return n;
6584
6584
  const t = document.body.className;
6585
6585
  return t.includes("bvb") ? "bvb" : t.includes("shb") ? "shb" : t.includes("agr") ? "agr" : t.includes("nama") ? "nama" : "bvb";
6586
6586
  }
6587
- function Cc(n) {
6587
+ function fc(n) {
6588
6588
  return {
6589
6589
  ocb: "#008c44",
6590
6590
  bvb: "#1e2a7b",
@@ -6593,7 +6593,7 @@ function Cc(n) {
6593
6593
  nama: "#ffdd00"
6594
6594
  }[n];
6595
6595
  }
6596
- function fc({
6596
+ function Xc({
6597
6597
  onConfirm: n,
6598
6598
  onCancel: t,
6599
6599
  showCloseButton: e = !0,
@@ -6607,7 +6607,7 @@ function fc({
6607
6607
  } catch {
6608
6608
  }
6609
6609
  });
6610
- const l = pc(), i = Cc(l);
6610
+ const l = Cc(), i = fc(l);
6611
6611
  document.documentElement.style.setProperty("--primary", i), l === "nama" && document.documentElement.style.setProperty(
6612
6612
  "--primary-bg",
6613
6613
  "linear-gradient(180deg, #FFEC72 0%, #FD0 100%)"
@@ -6765,16 +6765,16 @@ function fc({
6765
6765
  }
6766
6766
  return { container: s, open: Q, close: v };
6767
6767
  }
6768
- let Nt = null;
6769
- function Xc() {
6770
- return window.__sdkInitPromise && (Nt = window.__sdkInitPromise), Nt || (Nt = qh(
6768
+ let xt = null, ah = !1;
6769
+ function Bc() {
6770
+ return ah ? Promise.resolve(null) : (window.__sdkInitPromise && (xt = window.__sdkInitPromise), xt || (xt = qh(
6771
6771
  eh(),
6772
6772
  ch().invoiceHubBaseUrl
6773
6773
  ).catch((n) => {
6774
- console.error("Model init failed:", n);
6775
- }), window.__sdkInitPromise = Nt), Nt;
6774
+ console.error("Model init failed:", n), ah = !0, xt = null, window.__sdkInitPromise = null;
6775
+ }), window.__sdkInitPromise = xt), xt);
6776
6776
  }
6777
- async function Bc(n, t) {
6777
+ async function Nc(n, t) {
6778
6778
  const [e, a] = await Promise.all([
6779
6779
  Vt(n, t, "HDTT"),
6780
6780
  Vt(n, t, "HDMTT")
@@ -6795,7 +6795,7 @@ async function l0(n, t, e, a = !1, h = "ocb", c = "", A = null) {
6795
6795
  }
6796
6796
  let u = null;
6797
6797
  if (!A)
6798
- u = await Bc(n, t);
6798
+ u = await Nc(n, t);
6799
6799
  else {
6800
6800
  const l = await Vt(n, t, A);
6801
6801
  u = {
@@ -6809,11 +6809,8 @@ async function l0(n, t, e, a = !1, h = "ocb", c = "", A = null) {
6809
6809
  return;
6810
6810
  }
6811
6811
  if (!u.isNewCustomer) {
6812
- o = await It(n, t), await e(u.isNewCustomer, o), await new Promise((i) => setTimeout(i, 1e3)), (o?.organization?.name || o?.organization?.taxCode) && fc({
6812
+ o = await It(n, t), await e(u.isNewCustomer, o), await new Promise((i) => setTimeout(i, 1e3)), (o?.organization?.name || o?.organization?.taxCode) && Xc({
6813
6813
  settingUrl: c,
6814
- // onCancel: () => {
6815
- // updateIsNewCustomer(true, null);
6816
- // },
6817
6814
  onCancel: () => {
6818
6815
  },
6819
6816
  onConfirm: async () => {
@@ -6830,8 +6827,7 @@ async function l0(n, t, e, a = !1, h = "ocb", c = "", A = null) {
6830
6827
  console.error("Error checking new customer:", u), e(!0, null);
6831
6828
  }
6832
6829
  }
6833
- async function Pc(n, t, e, a, h, c) {
6834
- Xc();
6830
+ async function kc(n, t, e, a, h, c) {
6835
6831
  const u = [
6836
6832
  { name: "M-Invoice", route: "m-invoice", logoUrl: fh },
6837
6833
  { name: "Misa", route: "misa", logoUrl: Xh },
@@ -6994,7 +6990,7 @@ async function Pc(n, t, e, a, h, c) {
6994
6990
  });
6995
6991
  }
6996
6992
  async function $(M, J) {
6997
- if (console.log("updateRegistrationData called"), M) {
6993
+ if (M) {
6998
6994
  if (M === P) return;
6999
6995
  P = {
7000
6996
  ...P,
@@ -7052,7 +7048,6 @@ async function Pc(n, t, e, a, h, c) {
7052
7048
  isRenewal: c,
7053
7049
  handleCheckNewCustomer: l0,
7054
7050
  updateRegistrationData: $,
7055
- // serial: data?.serial || '',
7056
7051
  serial: U.test(a?.serial || "") ? a.serial : J,
7057
7052
  onSubmit: (D) => {
7058
7053
  P.eInvoiceRegistration = {
@@ -7071,10 +7066,12 @@ async function Pc(n, t, e, a, h, c) {
7071
7066
  dobPicker: Q,
7072
7067
  setDobPicker: (D) => {
7073
7068
  Q = D;
7074
- }
7069
+ },
7070
+ // FIX 3: Expose ensureModelInit để component con gọi lazy khi cần scan
7071
+ ensureModelInit: Bc
7075
7072
  }
7076
7073
  });
7077
- s(R);
7074
+ s(R), B = 0;
7078
7075
  } else if (M === 2) {
7079
7076
  const { container: R } = await ka({
7080
7077
  onNext: async () => {
@@ -7089,6 +7086,7 @@ async function Pc(n, t, e, a, h, c) {
7089
7086
  onPrev: () => {
7090
7087
  m = 1, T(m, o()), r(m), O();
7091
7088
  },
7089
+ // FIX 5: Bỏ duplicate setOrderAmount key, chỉ giữ một
7092
7090
  setOrderAmount: (D) => {
7093
7091
  B = D;
7094
7092
  },
@@ -7107,9 +7105,6 @@ async function Pc(n, t, e, a, h, c) {
7107
7105
  setTotalAmount: (D) => {
7108
7106
  p = D;
7109
7107
  },
7110
- setOrderAmount: (D) => {
7111
- B = D;
7112
- },
7113
7108
  setSelectedPromotions: (D) => {
7114
7109
  I = D;
7115
7110
  },
@@ -7156,7 +7151,8 @@ async function Pc(n, t, e, a, h, c) {
7156
7151
  selectedInvoiceOtp: E || { unitsPerMonth: 0 },
7157
7152
  selectedSignatureOtp: k || { durationYears: 0 },
7158
7153
  selectedPromotions: I,
7159
- totalAmountText: p,
7154
+ // FIX 6: Bỏ duplicate totalAmountText, đổi tên key đầu thành totalAmount
7155
+ totalAmount: p,
7160
7156
  totalAmountText: B,
7161
7157
  isRenewal: c,
7162
7158
  isNewCustomer: L,
@@ -7176,7 +7172,6 @@ async function Pc(n, t, e, a, h, c) {
7176
7172
  onPrev: () => {
7177
7173
  m = 3, T(m, o()), r(m), O();
7178
7174
  },
7179
- // onReturnHome: close ? close : () => {},
7180
7175
  onReturnHome: () => {
7181
7176
  K(), typeof t == "function" && t();
7182
7177
  },
@@ -7211,34 +7206,27 @@ async function Pc(n, t, e, a, h, c) {
7211
7206
  Q && typeof Q.destroy == "function" && Q.destroy(), y(), n && n.parentNode && (n.innerHTML = "");
7212
7207
  }
7213
7208
  }
7214
- async function kc(n, t, e, a) {
7215
- const { container: h, setContent: c } = dc(), A = e?.orderId, u = e?.callbackUrl || `${window.location.origin}/dashboard`, { container: o } = await hh({
7209
+ async function yc(n, t, e, a) {
7210
+ const { container: h, setContent: c } = dc(), A = e?.orderId, u = e?.callbackUrl || `${window.location.origin}/dashboard`, { container: o } = await wc({
7216
7211
  orderId: A,
7217
7212
  callbackUrl: u,
7218
- // onCompleteSignature,
7219
- onCompleteSignature: async (...s) => {
7220
- a && await a(...s), T();
7213
+ onCompleteSignature: async (...T) => {
7214
+ a && await a(...T), i();
7221
7215
  }
7222
7216
  });
7223
7217
  c(o), n.appendChild(h);
7224
- const { container: l } = await hh({
7225
- orderId: A,
7226
- callbackUrl: u,
7227
- onCompleteSignature: a
7228
- });
7229
- c(l);
7230
- const i = xh(
7218
+ const l = xh(
7231
7219
  () => {
7232
- T();
7220
+ i();
7233
7221
  },
7234
7222
  { includeHash: !1 }
7235
7223
  );
7236
- function T() {
7237
- i(), n && n.parentNode && (n.innerHTML = "");
7224
+ function i() {
7225
+ l(), n && n.parentNode && (n.innerHTML = "");
7238
7226
  }
7239
- return { destroy: T };
7227
+ return { destroy: i };
7240
7228
  }
7241
7229
  export {
7242
- kc as EContractWidget,
7243
- Pc as InvoiceRegisterWidget
7230
+ yc as EContractWidget,
7231
+ kc as InvoiceRegisterWidget
7244
7232
  };
package/package.json CHANGED
@@ -46,7 +46,7 @@
46
46
  "prepare": "npm run build"
47
47
  },
48
48
  "type": "module",
49
- "version": "1.124.3",
49
+ "version": "1.124.4",
50
50
  "repository": {},
51
51
  "dependencies": {
52
52
  "@invoice-sdk/id_extraction_qr": "^1.8.3",