@invoice-sdk/widget 1.118.2 → 1.118.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.
@@ -14,7 +14,7 @@ var n = (e, t, r) => new Promise((i, c) => {
14
14
  }, g = (o) => o.done ? i(o.value) : Promise.resolve(o.value).then(s, d);
15
15
  g((r = r.apply(e, t)).next());
16
16
  });
17
- import { k as l, g as w, l as f, C as m, G as y, n as E, I as R, S as v, o as C, a as h, p as I, q as u, r as T, O as b } from "./index-EgycCzHi.js";
17
+ import { k as l, g as w, l as f, C as m, G as y, n as E, I as R, S as v, o as C, a as h, p as I, q as u, r as T, O as b } from "./index-UUNzXMwl.js";
18
18
  function _({
19
19
  title: e,
20
20
  isDisabled: t = !1,
@@ -95,7 +95,7 @@ function $(e, t) {
95
95
  })).data;
96
96
  });
97
97
  }
98
- const A = (e) => new Intl.NumberFormat("vi-VN").format(e), O = "1.118.2";
98
+ const A = (e) => new Intl.NumberFormat("vi-VN").format(e), O = "1.118.4";
99
99
  function U(r) {
100
100
  return n(this, arguments, function* ({ search: e, bank: t }) {
101
101
  return (yield a.get(`${u}`, {
@@ -35,8 +35,8 @@ var qn = (t, n, e) => new Promise((c, h) => {
35
35
  }, o = (A) => A.done ? c(A.value) : Promise.resolve(A.value).then(a, u);
36
36
  o((e = e.apply(t, n)).next());
37
37
  });
38
- import { t as g, g as jh, a as Uh, b as Pt, s as n0, c as Mt, d as rc, e as Tc, f as xc, m as dc, h as wc, i as pc, v as Cc } from "./index-EgycCzHi.js";
39
- import { c as vt, a as _h, g as t0, b as fc, f as Sn, d as Xc, e as a0, h as Bc, i as Nc, j as Ec, k as Hc, l as yc, m as Pc, n as kc } from "./loading-Btbxdqb9.js";
38
+ import { t as g, g as jh, a as Uh, b as Pt, s as n0, c as Mt, d as rc, e as Tc, f as xc, m as dc, h as wc, i as pc, v as Cc } from "./index-UUNzXMwl.js";
39
+ import { c as vt, a as _h, g as t0, b as fc, f as Sn, d as Xc, e as a0, h as Bc, i as Nc, j as Ec, k as Hc, l as yc, m as Pc, n as kc } from "./loading-BLy_vWaj.js";
40
40
  import { g as $h } from "./_commonjsHelpers-bAxELxBV.js";
41
41
  function qh({ steps: t = [], currentStep: n = 1 } = {}) {
42
42
  const e = document.createElement("div");
@@ -3164,53 +3164,59 @@ function x1({
3164
3164
  function d1({
3165
3165
  promotion: t,
3166
3166
  onSelect: n,
3167
- isDisabled: e = !1
3167
+ // isDisabled = false,
3168
+ isHidden: e = !1,
3169
+ isSelectable: c = !0
3168
3170
  }) {
3169
- const c = document.createElement("div");
3170
- c.className = "wgt:w-full wgt:flex wgt:items-center wgt:relative wgt:h-[6.75rem]" + (e ? " wgt:opacity-50" : "");
3171
3171
  const h = document.createElement("div");
3172
- h.className = "wgt:absolute wgt:top-0 wgt:left-0 wgt:z-0", h.innerHTML = `<svg width="177" height="108" viewBox="0 0 177 108" fill="none" xmlns="http://www.w3.org/2000/svg">
3172
+ if (e)
3173
+ return h.style.display = "none", { container: h };
3174
+ const a = c && !t.isSelected;
3175
+ h.className = "wgt:w-full wgt:flex wgt:items-center wgt:relative wgt:h-[6.75rem]" + (a ? " wgt:opacity-50" : "");
3176
+ const u = document.createElement("div");
3177
+ u.className = "wgt:absolute wgt:top-0 wgt:left-0 wgt:z-0", u.innerHTML = `<svg width="177" height="108" viewBox="0 0 177 108" fill="none" xmlns="http://www.w3.org/2000/svg">
3173
3178
  <path fill-rule="evenodd" clip-rule="evenodd" d="M35.0743 3.375H37.1375V0H166.603C172.3 0 176.919 5.65535 176.919 12.6316V95.3684C176.919 102.345 172.3 108 166.603 108H37.1375V104.625H35.0743V108H10.316C4.61862 108 4.15411e-08 102.345 0 95.3684V93.4737C3.41841 93.4737 6.18958 90.0805 6.18958 85.8947C6.18958 81.709 3.41841 78.3158 0 78.3158V72C3.41841 72 6.18958 68.6068 6.18958 64.4211C6.18958 60.2353 3.41841 56.8421 0 56.8421V50.5263C3.41841 50.5263 6.18958 47.1331 6.18958 42.9474C6.18958 38.7616 3.41841 35.3684 0 35.3684V29.0526C3.41841 29.0526 6.18958 25.6594 6.18958 21.4737C6.18958 17.2879 3.41841 13.8947 0 13.8947V12.6316C0 5.65535 4.61862 0 10.316 0H35.0743V3.375ZM35.0743 97.875H37.1375V91.125H35.0743V97.875ZM35.0743 84.375H37.1375V77.625H35.0743V84.375ZM35.0743 70.875H37.1375V64.125H35.0743V70.875ZM35.0743 57.375H37.1375V50.625H35.0743V57.375ZM35.0743 43.875H37.1375V37.125H35.0743V43.875ZM35.0743 30.375H37.1375V23.625H35.0743V30.375ZM35.0743 16.875H37.1375V10.125H35.0743V16.875Z" fill="#C0D5FF"/>
3174
3179
  </svg>
3175
3180
  `;
3176
- const a = document.createElement("div");
3177
- a.className = "wgt:w-full wgt:relative wgt:z-10 wgt:h-full wgt:bg-white wgt:rounded-tr wgt:rounded-br wgt:px-4 wgt:py-3 wgt:ml-9 wgt:flex wgt:flex-col wgt:justify-between";
3178
- const u = document.createElement("div");
3179
- u.className = "wgt:flex wgt:items-start wgt:flex-col wgt:relative";
3180
- const o = document.createElement("h3");
3181
- o.className = [
3181
+ const o = document.createElement("div");
3182
+ o.className = "wgt:w-full wgt:relative wgt:z-10 wgt:h-full wgt:bg-white wgt:rounded-tr wgt:rounded-br wgt:px-4 wgt:py-3 wgt:ml-9 wgt:flex wgt:flex-col wgt:justify-between";
3183
+ const A = document.createElement("div");
3184
+ A.className = "wgt:flex wgt:items-start wgt:flex-col wgt:relative";
3185
+ const i = document.createElement("h3");
3186
+ i.className = [
3182
3187
  "wgt:text-base",
3183
3188
  "wgt:font-semibold",
3184
3189
  "wgt:text-gray-500",
3185
3190
  "wgt:mb-1",
3186
3191
  "wgt:text-primary"
3187
- ].join(" "), o.textContent = t.code, u.appendChild(o);
3188
- const A = document.createElement("p");
3189
- A.className = [
3192
+ ].join(" "), i.textContent = t.code, A.appendChild(i);
3193
+ const s = document.createElement("p");
3194
+ s.className = [
3190
3195
  "wgt:text-sm",
3191
3196
  "wgt:text-text-sub-600",
3192
3197
  "wgt:mb-2"
3193
3198
  ].join(" ");
3194
- const i = zt(Pt());
3195
- A.textContent = t[i], u.appendChild(A);
3196
- const { container: s } = e0({
3199
+ const T = zt(Pt());
3200
+ s.textContent = t[T], A.appendChild(s);
3201
+ const { container: q } = e0({
3197
3202
  checked: t.isSelected,
3198
3203
  onChange: () => {
3199
- let q = !t.isSelected;
3200
- n(t.code, q);
3204
+ let x = !t.isSelected;
3205
+ n(t.code, x);
3201
3206
  },
3202
- isIconCheckbox: !0,
3203
- disabled: e || t.isSelected
3207
+ isIconCheckbox: !0
3204
3208
  });
3205
- s.className = "wgt:absolute wgt:top-0 wgt:right-0", u.appendChild(s), a.appendChild(u);
3206
- const T = document.createElement("p");
3207
- return T.className = [
3209
+ c || (q.style.display = "none"), q.className = "wgt:absolute wgt:top-0 wgt:right-0", A.appendChild(q), o.appendChild(A);
3210
+ const l = document.createElement("p");
3211
+ return l.className = [
3208
3212
  "wgt:text-xs",
3209
3213
  "wgt:font-normal",
3210
3214
  "wgt:text-right",
3211
3215
  "wgt:text-[#335CFF]",
3212
3216
  "wgt:italic"
3213
- ].join(" "), T.textContent = `${g("validityPeriod")}: ${g("expiredDate")} ${t.expiredAt.split("T")[0]}`, a.appendChild(T), c.appendChild(h), c.appendChild(a), { container: c };
3217
+ ].join(" "), l.textContent = `${g("validityPeriod")}: ${g(
3218
+ "expiredDate"
3219
+ )} ${t.expiredAt.split("T")[0]}`, o.appendChild(l), h.appendChild(u), h.appendChild(o), { container: h };
3214
3220
  }
3215
3221
  function w1({
3216
3222
  value: t = "",
@@ -3673,7 +3679,8 @@ function N1(B) {
3673
3679
  isActive: an.isActive,
3674
3680
  type: an.type,
3675
3681
  expiredAt: an.toDate,
3676
- isDisabled: !1,
3682
+ // isDisabled: false,
3683
+ isHidden: !1,
3677
3684
  reward: an.reward
3678
3685
  });
3679
3686
  }), Object.keys(r).length > 0 && (W = l ? [...l] : [], at())) : console.error("Failed to load promotions:", Z.reason), en.status === "fulfilled") {
@@ -3732,9 +3739,11 @@ function N1(B) {
3732
3739
  function it(Y, _, Z) {
3733
3740
  const $ = Object.values(r).find(
3734
3741
  (nn) => nn.bank === T && nn.appliedPackages.includes(Y)
3735
- ), en = $ && !$.isDisabled && !($.expiredAt < (/* @__PURE__ */ new Date()).toISOString()) && $.limit !== $.used, j = Object.values(r).find(
3742
+ ), en = m.includes(Y) || $ && // !currentPackagePromotion.isDisabled &&
3743
+ !$.isHidden && !($.expiredAt < (/* @__PURE__ */ new Date()).toISOString()) && $.limit !== $.used, j = Object.values(r).find(
3736
3744
  (nn) => nn.bank === T && nn.appliedPackages.includes(_)
3737
- ), an = j && !j.isDisabled && !(j.expiredAt < (/* @__PURE__ */ new Date()).toISOString()) && j.limit !== j.used;
3745
+ ), an = m.includes(_) || j && // !newPackagePromotion.isDisabled &&
3746
+ !j.isHidden && !(j.expiredAt < (/* @__PURE__ */ new Date()).toISOString()) && j.limit !== j.used && j.isActive;
3738
3747
  if (en && !an) {
3739
3748
  const { container: nn, open: sn } = Mt({
3740
3749
  message: g("errorDiscountPackage"),
@@ -3842,7 +3851,7 @@ function N1(B) {
3842
3851
  var vn;
3843
3852
  const j = r[en];
3844
3853
  if (j.bank !== T) {
3845
- j.isDisabled = !0, W = W.filter(
3854
+ j.isHidden = !0, W = W.filter(
3846
3855
  (An) => An !== j.code
3847
3856
  );
3848
3857
  return;
@@ -3850,7 +3859,7 @@ function N1(B) {
3850
3859
  const an = j.expiredAt < (/* @__PURE__ */ new Date()).toISOString(), nn = j.limit <= j.used, sn = !j.isActive, xn = ((vn = j.appliedPackages) == null ? void 0 : vn.some(
3851
3860
  (An) => $.includes(An)
3852
3861
  )) && !an && !nn && !sn;
3853
- j.isDisabled = !xn, xn ? xn && !W.includes(j.code) && W.push(j.code) : W = W.filter(
3862
+ j.isHidden = !xn, xn ? W.includes(j.code) || W.push(j.code) : W = W.filter(
3854
3863
  (An) => An !== j.code
3855
3864
  );
3856
3865
  }), at();
@@ -3911,23 +3920,23 @@ function N1(B) {
3911
3920
  Z.appendChild(en), zn.appendChild(Z);
3912
3921
  const j = document.createElement("div");
3913
3922
  j.className = "wgt:w-full wgt:grid wgt:grid-cols-3 wgt:gap-4 wgt:@max-2xl:flex wgt:@max-2xl:flex-col", zn.appendChild(j);
3914
- const an = Object.values(r).filter(
3915
- (nn) => nn.bank === T
3916
- );
3923
+ const an = Object.values(r).filter((nn) => nn.bank === T).filter((nn) => !nn.isHidden);
3917
3924
  if (an.length > 0)
3918
3925
  an.forEach((nn) => {
3919
- const { container: sn } = d1({
3926
+ const sn = W.includes(nn.code), { container: Tn } = d1({
3920
3927
  promotion: Kn(En({}, nn), {
3921
3928
  isSelected: W.includes(nn.code)
3922
3929
  }),
3923
- onSelect: (Tn, xn) => {
3924
- xn ? W.push(Tn) : W = W.filter(
3925
- (vn) => vn !== Tn
3930
+ // onSelect: (promotionCode, isSelected) => {
3931
+ onSelect: (xn, vn) => {
3932
+ vn ? W.includes(xn) || W.push(xn) : W = W.filter(
3933
+ (An) => An !== xn
3926
3934
  ), Rn(), In();
3927
3935
  },
3928
- isDisabled: nn.isDisabled || nn.expiredAt < (/* @__PURE__ */ new Date()).toISOString() || nn.limit === nn.used
3936
+ isHidden: !1,
3937
+ isSelectable: !0
3929
3938
  });
3930
- j.appendChild(sn);
3939
+ sn || Tn.classList.add("wgt:opacity-50"), j.appendChild(Tn);
3931
3940
  });
3932
3941
  else {
3933
3942
  const nn = document.createElement("span");
package/package.json CHANGED
@@ -46,7 +46,7 @@
46
46
  "prepare": "npm run build"
47
47
  },
48
48
  "type": "module",
49
- "version": "1.118.2",
49
+ "version": "1.118.4",
50
50
  "repository": {},
51
51
  "dependencies": {
52
52
  "@invoice-sdk/id_extraction_qr": "^1.8.3",