@invoice-sdk/widget 1.119.0 → 1.120.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.
@@ -5096,7 +5096,7 @@ function ed(e) {
5096
5096
  function Gd(e) {
5097
5097
  return S(this, null, function* () {
5098
5098
  if (pe(e), !ie) {
5099
- const { InvoiceRegisterWidget: i } = yield import("./widget-nsfT51qb.js");
5099
+ const { InvoiceRegisterWidget: i } = yield import("./widget-Ca5n6Fsq.js");
5100
5100
  ie = i;
5101
5101
  }
5102
5102
  const A = me(e.selector), t = yield ie(
@@ -5119,7 +5119,7 @@ function Gd(e) {
5119
5119
  function Od(e) {
5120
5120
  return S(this, null, function* () {
5121
5121
  if (pe(e), !te) {
5122
- const { EContractWidget: t } = yield import("./widget-nsfT51qb.js");
5122
+ const { EContractWidget: t } = yield import("./widget-Ca5n6Fsq.js");
5123
5123
  te = t;
5124
5124
  }
5125
5125
  const A = me(e.selector);
@@ -5170,7 +5170,7 @@ function Nd(e) {
5170
5170
  })
5171
5171
  };
5172
5172
  }
5173
- ne || (ne = (yield import("./index-F-HfnKsx.js")).createInvoiceRequestFlow);
5173
+ ne || (ne = (yield import("./index-s-u_RqX7.js")).createInvoiceRequestFlow);
5174
5174
  const i = ne({
5175
5175
  uuid: t,
5176
5176
  orderInfo: e.orderInfo || { code: "", address: "", total: "" },
@@ -25,8 +25,8 @@ var j = (r, t, e) => new Promise((n, d) => {
25
25
  }, g = (p) => p.done ? n(p.value) : Promise.resolve(p.value).then(s, a);
26
26
  g((e = e.apply(r, t)).next());
27
27
  });
28
- import { c as G, f as te, e as oe, b as de, o as ne, s as le } from "./loading-CpzNkc72.js";
29
- import { t as i, c as J, j as ce } from "./index-DenpejIA.js";
28
+ import { c as G, f as te, e as oe, b as de, o as ne, s as le } from "./loading-CMCk5aav.js";
29
+ import { t as i, c as J, j as ce } from "./index-Dwm5GXG-.js";
30
30
  function z(r) {
31
31
  const t = r.trim();
32
32
  return t ? t.length < 2 || t.length > 250 ? { valid: !1, error: i("length_2_250") } : /[<>:"\/\\|?*@#$%!^]/.test(t) ? { valid: !1, error: i("invalid_characters") } : { valid: !0 } : { valid: !1, error: i("required_name") };
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { B as s, x as e, u as i, w as n, D as o, z as r, y as g, A as c } from "./index-DenpejIA.js";
1
+ import { B as s, x as e, u as i, w as n, D as o, z as r, y as g, A as c } from "./index-Dwm5GXG-.js";
2
2
  export {
3
3
  s as checkContractStatus,
4
4
  e as getSettings,
package/dist/index.umd.js CHANGED
@@ -110,7 +110,7 @@
110
110
  <path d="M8.83184 0.96875H10.3485C10.4833 0.96875 10.5507 1.03316 10.5507 1.16199V18.1668C10.5507 18.2956 10.4833 18.3601 10.3485 18.3601H8.83184C8.69702 18.3601 8.62962 18.2956 8.62962 18.1668V1.16199C8.62962 1.03316 8.69702 0.96875 8.83184 0.96875Z" fill="${r}"/>
111
111
  <path d="M1.09676 8.74653H18.0836C18.2184 8.74653 18.2858 8.81094 18.2858 8.93976V10.389C18.2858 10.5179 18.2184 10.5823 18.0836 10.5823H1.09676C0.961939 10.5823 0.894531 10.5179 0.894531 10.389V8.93976C0.894531 8.81094 0.961939 8.74653 1.09676 8.74653Z" fill="${r}"/>
112
112
  </svg>
113
- `;const u=document.createElement("div");u.className="wgt:text-sm wgt:font-semibold wgt:text-text-sub-600",u.innerText=n,i.append(s,u);const l=document.createElement("div");l.className="wgt:text-sm wgt:font-medium wgt:text-soft-400",l.innerText=A,c.append(l);const g=document.createElement("span");g.className="wgt:text-red-500 wgt:text-sm wgt:mt-1",g.style.display="none",c.append(g);let m=null;function C(w){m=w,w?(g.innerText=w,g.style.display="block",typeof a=="function"&&a(w)):(g.innerText="",g.style.display="none",typeof a=="function"&&a(null))}let E=t||null;function v(w,y=2){if(w===0)return"0 Bytes";const X=1024,f=Math.max(0,y),Q=["Bytes","KB","MB","GB","TB"],M=Math.floor(Math.log(w)/Math.log(X));return parseFloat((w/Math.pow(X,M)).toFixed(f))+" "+Q[M]}function x(w){i.innerHTML="",C(null);const y=document.createElement("img");if(y.alt=n,y.className="wgt:max-w-full wgt:max-h-full wgt:object-contain",p(w)||C(`File không hợp lệ. Chỉ chấp nhận: ${o.accept}`),w.size<=500*1024||C("Dung lượng file vượt quá 500KB."),w.type.startsWith("image/")){const f=new FileReader;f.onload=()=>{y.src=f.result,typeof e=="function"&&e(w)},f.readAsDataURL(w),i.appendChild(y)}else{const f=document.createElement("div");f.className="wgt:flex wgt:items-center wgt:gap-4";const Q=document.createElement("div");Q.className="wgt:flex wgt:flex-col";const M=document.createElement("p");M.className="wgt:text-sm wgt:font-medium wgt:text-gray-800",M.innerText=w.name;const S=document.createElement("p");S.className="wgt:text-sm wgt:text-gray-500",S.innerText=v(w.size),Q.appendChild(M),Q.appendChild(S),f.appendChild(Q),i.appendChild(f),typeof e=="function"&&e(null,w)}}function p(w){const y=w.type.toLowerCase(),X="."+w.name.split(".").pop().toLowerCase();return o.accept.split(",").map(Q=>Q.trim().toLowerCase()).filter(Boolean).some(Q=>Q.startsWith(".")?Q===X:Q.endsWith("/*")?y.startsWith(Q.replace("/*","")):y===Q)}return o.addEventListener("change",()=>{var y;const w=(y=o.files)==null?void 0:y[0];w&&(E=w,x(w))}),i.addEventListener("click",()=>o.click()),t&&x(t),{container:c,getFile:()=>E,getError:()=>m,setError:C}}function Fs({frontFile:t,backFile:n,onFrontChange:A,onBackChange:e,theme:a}){const h=document.createElement("div");h.className="wgt:flex wgt:flex-col wgt:gap-4 wgt:w-full";const c=document.createElement("label");c.className="wgt:font-medium",c.innerText=q("uploadIdentity");const i=document.createElement("span");i.className="wgt:text-red-500 wgt:ml-1",i.innerText="*",c.appendChild(i),h.append(c);const o=document.createElement("div");o.className="wgt:w-full wgt:grid wgt:grid-cols-2 wgt:gap-4",h.append(o);const s=dh({file:t,placeholder:q("uploadFrontId"),caption:q("frontIdCard"),onFileSelected:A,theme:a}),r=dh({file:n,placeholder:q("uploadBackId"),caption:q("backIdCard"),onFileSelected:e,theme:a});return o.append(s.container,r.container),{container:h,getFrontFile:()=>s.getFile(),getBackFile:()=>r.getFile(),getFrontFileError:()=>s.getError(),getBackFileError:()=>r.getError(),setFrontFileError:s.setError,setBackFileError:r.setError}}const Zs=({onChange:t,initialValue:n="",isRenewal:A=!1}={})=>{Array.from({length:26},(b,D)=>String.fromCharCode(65+D));const e=new Date().getFullYear();String(e).slice(-2);const a=typeof n=="string"&&n.length>=4?n.slice(2,4):null;let h=Array.from({length:2},(b,D)=>String(e+D).slice(-2));A&&a&&/^\d{2}$/.test(a)&&(h.includes(a)||(h=[a,...h]));const c=["1","2","3","4","5","6","7","8","9"],i=["C","K"],o=["T","D","L","M","N","B","G","H","X"],s=document.createElement("div");s.className="wgt:w-full wgt:flex wgt:flex-col wgt:items-start wgt:space-y-2";const r=document.createElement("span");r.className="wgt:font-medium wgt:text-text-black wgt:whitespace-nowrap wgt:col-span-2 wgt:@max-2xl:whitespace-normal",r.textContent=q("invoiceTemplate");const u=document.createElement("span");u.className="wgt:text-red-500 wgt:ml-1",u.innerText="*",r.appendChild(u),s.append(r);const l=document.createElement("div");l.className=["wgt:w-full","wgt:flex","wgt:@max-2xl:flex-col","wgt:gap-6","wgt:overflow-x-auto","wgt:scroll-snap-x","wgt:snap-mandatory","wgt:cursor-grab","wgt:select-none","wgt:@max-2xl:p-2","wgt:@max-2xl:grid wgt:@max-2xl:grid-cols-1 wgt:@max-2xl:p-4 wgt:@max-2xl:gap-3 wgt:@max-2xl:space-y-2 wgt:@max-2xl:rounded-xl wgt:@max-2xl:bg-weak-50"].join(" "),l.style.scrollSnapType="x mandatory",l.style.overflowX="auto",l.style.scrollBehavior="smooth",l.style.scrollbarWidth="none",l.style.msOverflowStyle="none",l.style.WebkitOverflowScrolling="touch",l.style.overflowY="hidden",s.append(l);const g="wgt:border wgt:border-gray-300 wgt:bg-white wgt:rounded-lg wgt:px-3 wgt:py-2 wgt:text-start wgt:cursor-pointer wgt:outline-none",m=document.createElement("div");m.className="wgt:w-full wgt:flex wgt:flex-col wgt:items-start wgt:space-y-2";const C=document.createElement("span");C.className="wgt:font-medium wgt:text-text-black wgt:whitespace-nowrap wgt:col-span-2 wgt:@max-2xl:whitespace-normal wgt:@max-2xl:block wgt:hidden",C.textContent=q("sampleNumber");const E=document.createElement("span");E.className="wgt:text-red-500 wgt:ml-1",E.innerText="*",C.appendChild(E),m.appendChild(C);const v=document.createElement("select");v.className=`${g} wgt:@max-2xl:w-full wgt:w-48`,v.title=q("sampleNumberTooltip","Mẫu số hóa đơn (1-9)");const x={1:q("invoiceTemplateTypes.1"),2:q("invoiceTemplateTypes.2"),3:q("invoiceTemplateTypes.3"),4:q("invoiceTemplateTypes.4"),5:q("invoiceTemplateTypes.5"),6:q("invoiceTemplateTypes.6"),7:q("invoiceTemplateTypes.7"),8:q("invoiceTemplateTypes.8"),9:q("invoiceTemplateTypes.9")};c.forEach(b=>{v.append(new Option(x[b],b))}),m.appendChild(v),l.append(m);const p=document.createElement("div");p.className="wgt:w-full wgt:flex wgt:flex-col wgt:items-start wgt:space-y-2";const w=document.createElement("span");w.className="wgt:font-medium wgt:text-text-black wgt:whitespace-nowrap wgt:col-span-2 wgt:@max-2xl:whitespace-normal wgt:@max-2xl:block wgt:hidden",w.textContent=q("codeType");const y=document.createElement("span");y.className="wgt:text-red-500 wgt:ml-1",y.innerText="*",w.appendChild(y),p.appendChild(w);const X=document.createElement("select");X.className=`${g} wgt:@max-2xl:w-full wgt:w-40`,X.title=q("codeTypeTooltip","C: Có mã CQT, K: Không mã"),i.forEach(b=>{const D=b==="C"?q("codeTypeC","C (Có mã CQT)"):q("codeTypeK","K (Không mã)");X.append(new Option(D,b))}),p.appendChild(X),l.append(p);const f=document.createElement("div");f.className="wgt:w-full wgt:flex wgt:flex-col wgt:items-start wgt:space-y-2";const Q=document.createElement("span");Q.className="wgt:font-medium wgt:text-text-black wgt:whitespace-nowrap wgt:col-span-2 wgt:@max-2xl:whitespace-normal wgt:@max-2xl:block wgt:hidden",Q.textContent=q("invoiceIssuanceYear");const M=document.createElement("span");M.className="wgt:text-red-500 wgt:ml-1",M.innerText="*",Q.appendChild(M),f.appendChild(Q);const S=document.createElement("select");S.className=`${g} wgt:@max-2xl:w-full wgt:w-16`,S.title=q("yearTooltip","Năm phát hành (2 chữ số cuối)"),h.forEach(b=>S.append(new Option(b,b))),S.value=String(e).slice(-2),f.appendChild(S),l.append(f);const z=document.createElement("div");z.className="wgt:w-full wgt:flex wgt:flex-col wgt:items-start wgt:space-y-2";const L=document.createElement("span");L.className="wgt:font-medium wgt:text-text-black wgt:whitespace-nowrap wgt:col-span-2 wgt:@max-2xl:whitespace-normal wgt:@max-2xl:block wgt:hidden",L.textContent=q("typeOfEInvoice");const T=document.createElement("span");T.className="wgt:text-red-500 wgt:ml-1",T.innerText="*",L.appendChild(T),z.appendChild(L);const N=document.createElement("select");N.className=`${g} wgt:@max-2xl:w-full wgt:w-40`,N.title=q("invoiceTypeTooltip","Loại hóa đơn");const B={T:q("invoiceTypeT","T (Đăng ký)"),D:q("invoiceTypeD","D (Tài sản)"),L:q("invoiceTypeL","L (CQT)"),M:q("invoiceTypeM","M (Máy tính tiền)"),N:q("invoiceTypeN","N (Nội bộ)"),B:q("invoiceTypeB","B (Đại lý)"),G:q("invoiceTypeG","G (Tem GTGT)"),H:q("invoiceTypeH","H (Tem bán hàng)"),X:q("invoiceTypeX","X (Thương mại)")};o.forEach(b=>{N.append(new Option(B[b],b))}),z.appendChild(N),l.append(z);const k=document.createElement("div");k.className="wgt:w-full wgt:flex wgt:flex-col wgt:items-start wgt:space-y-2";const P=document.createElement("span");P.className="wgt:font-medium wgt:text-text-black wgt:whitespace-nowrap wgt:col-span-2 wgt:@max-2xl:whitespace-normal wgt:@max-2xl:block wgt:hidden",P.textContent=q("formDifferentiationCode");const I=document.createElement("span");I.className="wgt:text-red-500 wgt:ml-1",I.innerText="*",P.appendChild(I),k.appendChild(P);const d=document.createElement("input");d.type="text",d.maxLength=2,d.placeholder="AB",d.defaultValue="YY",d.className=`${g} wgt:@max-2xl:w-full wgt:w-16`,d.title=q("customLettersTooltip"),k.appendChild(d),l.append(k),A&&[v,X,S,N,d].forEach(b=>b.disabled=!0);function H(){return v.value+X.value+S.value+N.value+d.value.toUpperCase()}function J(){d.value=d.value.toUpperCase().replace(/[^A-Z]/g,"").slice(0,2),typeof t=="function"&&t(H())}return[v,X,S,N].forEach(b=>b.addEventListener("change",J)),d.addEventListener("input",J),d.addEventListener("blur",J),/^[1-9][CK]\d{2}[TDLMNBGHX][A-Z]{2}$/.test(n)?(v.value=n[0],X.value=n[1],S.value=n.slice(2,4),N.value=n[4],d.value=n.slice(5,7)):(v.value="1",X.value="C",N.value="T",d.value="YY"),J(),{container:s,getValue:H,setValue:b=>{typeof b!="string"||b.length!==7||/^[1-9][CK]\d{2}[TDLMNBGHX][A-Z]{2}$/.test(b)&&(v.value=b[0],X.value=b[1],S.value=b.slice(2,4),N.value=b[4],d.value=b.slice(5,7),J())}}},At=kn.create({headers:{Accept:"application/json"}});At.interceptors.request.use(function(t){return t.baseURL=_A().invoiceHubBaseUrl,t},function(t){return Promise.reject(t)}),_e(At,{});function Ih(t){return _(this,null,function*(){if(!t)throw new Error("Tax code is required to fetch tax information.");return yield At.get(Zi,{params:{tax:t}})})}function Ie(t,n,A){return _(this,null,function*(){if(!n)throw new Error("Tax code is required to check new customer.");return(yield At.get(Ri,{params:{provider:t,taxCode:n,invoiceType:A}})).data})}function Ee(t,n){return _(this,null,function*(){return(yield At.get(Fi,{params:{provider:t,taxCode:n}})).data})}const Ws=[{value:"VN",label:"Việt Nam"}],Eh=[{value:"female",label:"Nữ"},{value:"male",label:"Nam"}];var pe={exports:{}};/*!
113
+ `;const u=document.createElement("div");u.className="wgt:text-sm wgt:font-semibold wgt:text-text-sub-600",u.innerText=n,i.append(s,u);const l=document.createElement("div");l.className="wgt:text-sm wgt:font-medium wgt:text-soft-400",l.innerText=A,c.append(l);const g=document.createElement("span");g.className="wgt:text-red-500 wgt:text-sm wgt:mt-1",g.style.display="none",c.append(g);let m=null;function C(w){m=w,w?(g.innerText=w,g.style.display="block",typeof a=="function"&&a(w)):(g.innerText="",g.style.display="none",typeof a=="function"&&a(null))}let E=t||null;function v(w,y=2){if(w===0)return"0 Bytes";const X=1024,f=Math.max(0,y),Q=["Bytes","KB","MB","GB","TB"],M=Math.floor(Math.log(w)/Math.log(X));return parseFloat((w/Math.pow(X,M)).toFixed(f))+" "+Q[M]}function x(w){i.innerHTML="",C(null);const y=document.createElement("img");if(y.alt=n,y.className="wgt:max-w-full wgt:max-h-full wgt:object-contain",p(w)||C(`File không hợp lệ. Chỉ chấp nhận: ${o.accept}`),w.size<=500*1024||C("Dung lượng file vượt quá 500KB."),w.type.startsWith("image/")){const f=new FileReader;f.onload=()=>{y.src=f.result,typeof e=="function"&&e(w)},f.readAsDataURL(w),i.appendChild(y)}else{const f=document.createElement("div");f.className="wgt:flex wgt:items-center wgt:gap-4";const Q=document.createElement("div");Q.className="wgt:flex wgt:flex-col";const M=document.createElement("p");M.className="wgt:text-sm wgt:font-medium wgt:text-gray-800",M.innerText=w.name;const S=document.createElement("p");S.className="wgt:text-sm wgt:text-gray-500",S.innerText=v(w.size),Q.appendChild(M),Q.appendChild(S),f.appendChild(Q),i.appendChild(f),typeof e=="function"&&e(null,w)}}function p(w){const y=w.type.toLowerCase(),X="."+w.name.split(".").pop().toLowerCase();return o.accept.split(",").map(Q=>Q.trim().toLowerCase()).filter(Boolean).some(Q=>Q.startsWith(".")?Q===X:Q.endsWith("/*")?y.startsWith(Q.replace("/*","")):y===Q)}return o.addEventListener("change",()=>{var y;const w=(y=o.files)==null?void 0:y[0];w&&(E=w,x(w))}),i.addEventListener("click",()=>o.click()),t&&x(t),{container:c,getFile:()=>E,getError:()=>m,setError:C}}function Fs({frontFile:t,backFile:n,onFrontChange:A,onBackChange:e,theme:a}){const h=document.createElement("div");h.className="wgt:flex wgt:flex-col wgt:gap-4 wgt:w-full";const c=document.createElement("label");c.className="wgt:font-medium",c.innerText=q("uploadIdentity");const i=document.createElement("span");i.className="wgt:text-red-500 wgt:ml-1",i.innerText="*",c.appendChild(i),h.append(c);const o=document.createElement("div");o.className="wgt:w-full wgt:grid wgt:grid-cols-2 wgt:gap-4",h.append(o);const s=dh({file:t,placeholder:q("uploadFrontId"),caption:q("frontIdCard"),onFileSelected:A,theme:a}),r=dh({file:n,placeholder:q("uploadBackId"),caption:q("backIdCard"),onFileSelected:e,theme:a});return o.append(s.container,r.container),{container:h,getFrontFile:()=>s.getFile(),getBackFile:()=>r.getFile(),getFrontFileError:()=>s.getError(),getBackFileError:()=>r.getError(),setFrontFileError:s.setError,setBackFileError:r.setError}}const Zs=({onChange:t,initialValue:n="",isRenewal:A=!1}={})=>{Array.from({length:26},(b,D)=>String.fromCharCode(65+D));const e=new Date().getFullYear();String(e).slice(-2);const a=typeof n=="string"&&n.length>=4?n.slice(2,4):null;let h=Array.from({length:2},(b,D)=>String(e+D).slice(-2));A&&a&&/^\d{2}$/.test(a)&&(h.includes(a)||(h=[a,...h]));const c=["1","2","3","4","5","6","7","8","9"],i=["C","K"],o=["T","D","L","M","N","B","G","H","X"],s=document.createElement("div");s.className="wgt:w-full wgt:flex wgt:flex-col wgt:items-start wgt:space-y-2";const r=document.createElement("span");r.className="wgt:font-medium wgt:text-text-black wgt:whitespace-nowrap wgt:col-span-2 wgt:@max-2xl:whitespace-normal",r.textContent=q("invoiceTemplate");const u=document.createElement("span");u.className="wgt:text-red-500 wgt:ml-1",u.innerText="*",r.appendChild(u),s.append(r);const l=document.createElement("div");l.className=["wgt:w-full","wgt:flex","wgt:@max-2xl:flex-col","wgt:gap-6","wgt:overflow-x-auto","wgt:scroll-snap-x","wgt:snap-mandatory","wgt:cursor-grab","wgt:select-none","wgt:@max-2xl:p-2","wgt:@max-2xl:grid wgt:@max-2xl:grid-cols-1 wgt:@max-2xl:p-4 wgt:@max-2xl:gap-3 wgt:@max-2xl:space-y-2 wgt:@max-2xl:rounded-xl wgt:@max-2xl:bg-weak-50"].join(" "),l.style.scrollSnapType="x mandatory",l.style.overflowX="auto",l.style.scrollBehavior="smooth",l.style.scrollbarWidth="none",l.style.msOverflowStyle="none",l.style.WebkitOverflowScrolling="touch",l.style.overflowY="hidden",s.append(l);const g="wgt:border wgt:border-gray-300 wgt:bg-white wgt:rounded-lg wgt:px-3 wgt:py-2 wgt:text-start wgt:cursor-pointer wgt:outline-none",m=document.createElement("div");m.className="wgt:w-full wgt:flex wgt:flex-col wgt:items-start wgt:space-y-2";const C=document.createElement("span");C.className="wgt:font-medium wgt:text-text-black wgt:whitespace-nowrap wgt:col-span-2 wgt:@max-2xl:whitespace-normal wgt:@max-2xl:block wgt:hidden",C.textContent=q("sampleNumber");const E=document.createElement("span");E.className="wgt:text-red-500 wgt:ml-1",E.innerText="*",C.appendChild(E),m.appendChild(C);const v=document.createElement("select");v.className=`${g} wgt:@max-2xl:w-full wgt:w-48`,v.title=q("sampleNumberTooltip","Mẫu số hóa đơn (1-9)");const x={1:q("invoiceTemplateTypes.1"),2:q("invoiceTemplateTypes.2"),3:q("invoiceTemplateTypes.3"),4:q("invoiceTemplateTypes.4"),5:q("invoiceTemplateTypes.5"),6:q("invoiceTemplateTypes.6"),7:q("invoiceTemplateTypes.7"),8:q("invoiceTemplateTypes.8"),9:q("invoiceTemplateTypes.9")};c.forEach(b=>{v.append(new Option(x[b],b))}),m.appendChild(v),l.append(m);const p=document.createElement("div");p.className="wgt:w-full wgt:flex wgt:flex-col wgt:items-start wgt:space-y-2";const w=document.createElement("span");w.className="wgt:font-medium wgt:text-text-black wgt:whitespace-nowrap wgt:col-span-2 wgt:@max-2xl:whitespace-normal wgt:@max-2xl:block wgt:hidden",w.textContent=q("codeType");const y=document.createElement("span");y.className="wgt:text-red-500 wgt:ml-1",y.innerText="*",w.appendChild(y),p.appendChild(w);const X=document.createElement("select");X.className=`${g} wgt:@max-2xl:w-full wgt:w-40`,X.title=q("codeTypeTooltip","C: Có mã CQT, K: Không mã"),i.forEach(b=>{const D=b==="C"?q("codeTypeC","C (Có mã CQT)"):q("codeTypeK","K (Không mã)");X.append(new Option(D,b))}),p.appendChild(X),l.append(p);const f=document.createElement("div");f.className="wgt:w-full wgt:flex wgt:flex-col wgt:items-start wgt:space-y-2";const Q=document.createElement("span");Q.className="wgt:font-medium wgt:text-text-black wgt:whitespace-nowrap wgt:col-span-2 wgt:@max-2xl:whitespace-normal wgt:@max-2xl:block wgt:hidden",Q.textContent=q("invoiceIssuanceYear");const M=document.createElement("span");M.className="wgt:text-red-500 wgt:ml-1",M.innerText="*",Q.appendChild(M),f.appendChild(Q);const S=document.createElement("select");S.className=`${g} wgt:@max-2xl:w-full wgt:w-16`,S.title=q("yearTooltip","Năm phát hành (2 chữ số cuối)"),h.forEach(b=>S.append(new Option(b,b))),S.value=String(e).slice(-2),f.appendChild(S),l.append(f);const z=document.createElement("div");z.className="wgt:w-full wgt:flex wgt:flex-col wgt:items-start wgt:space-y-2";const L=document.createElement("span");L.className="wgt:font-medium wgt:text-text-black wgt:whitespace-nowrap wgt:col-span-2 wgt:@max-2xl:whitespace-normal wgt:@max-2xl:block wgt:hidden",L.textContent=q("typeOfEInvoice");const T=document.createElement("span");T.className="wgt:text-red-500 wgt:ml-1",T.innerText="*",L.appendChild(T),z.appendChild(L);const N=document.createElement("select");N.className=`${g} wgt:@max-2xl:w-full wgt:w-40`,N.title=q("invoiceTypeTooltip","Loại hóa đơn");const B={T:q("invoiceTypeT","T (Đăng ký)"),D:q("invoiceTypeD","D (Tài sản)"),L:q("invoiceTypeL","L (CQT)"),M:q("invoiceTypeM","M (Máy tính tiền)"),N:q("invoiceTypeN","N (Nội bộ)"),B:q("invoiceTypeB","B (Đại lý)"),G:q("invoiceTypeG","G (Tem GTGT)"),H:q("invoiceTypeH","H (Tem bán hàng)"),X:q("invoiceTypeX","X (Thương mại)")};o.forEach(b=>{N.append(new Option(B[b],b))}),z.appendChild(N),l.append(z);const k=document.createElement("div");k.className="wgt:w-full wgt:flex wgt:flex-col wgt:items-start wgt:space-y-2";const P=document.createElement("span");P.className="wgt:font-medium wgt:text-text-black wgt:whitespace-nowrap wgt:col-span-2 wgt:@max-2xl:whitespace-normal wgt:@max-2xl:block wgt:hidden",P.textContent=q("formDifferentiationCode");const I=document.createElement("span");I.className="wgt:text-red-500 wgt:ml-1",I.innerText="*",P.appendChild(I),k.appendChild(P);const d=document.createElement("input");d.type="text",d.maxLength=2,d.placeholder="AB",d.defaultValue="YY",d.className=`${g} wgt:@max-2xl:w-full wgt:w-16`,d.title=q("customLettersTooltip"),k.appendChild(d),l.append(k),A&&[v,X,S,N,d].forEach(b=>b.disabled=!0);function H(){return v.value+X.value+S.value+N.value+d.value.toUpperCase()}function J(){d.value=d.value.toUpperCase().replace(/[^A-Z]/g,"").slice(0,2),typeof t=="function"&&t(H())}return[v,X,S,N].forEach(b=>b.addEventListener("change",J)),d.addEventListener("input",J),d.addEventListener("blur",J),/^[1-9][CK]\d{2}[TDLMNBGHX][A-Z]{2}$/.test(n)?(v.value=n[0],X.value=n[1],S.value=n.slice(2,4),N.value=n[4],d.value=n.slice(5,7)):(v.value="1",X.value="C",N.value="M",d.value="YY"),J(),{container:s,getValue:H,setValue:b=>{typeof b!="string"||b.length!==7||/^[1-9][CK]\d{2}[TDLMNBGHX][A-Z]{2}$/.test(b)&&(v.value=b[0],X.value=b[1],S.value=b.slice(2,4),N.value=b[4],d.value=b.slice(5,7),J())}}},At=kn.create({headers:{Accept:"application/json"}});At.interceptors.request.use(function(t){return t.baseURL=_A().invoiceHubBaseUrl,t},function(t){return Promise.reject(t)}),_e(At,{});function Ih(t){return _(this,null,function*(){if(!t)throw new Error("Tax code is required to fetch tax information.");return yield At.get(Zi,{params:{tax:t}})})}function Ie(t,n,A){return _(this,null,function*(){if(!n)throw new Error("Tax code is required to check new customer.");return(yield At.get(Ri,{params:{provider:t,taxCode:n,invoiceType:A}})).data})}function Ee(t,n){return _(this,null,function*(){return(yield At.get(Fi,{params:{provider:t,taxCode:n}})).data})}const Ws=[{value:"VN",label:"Việt Nam"}],Eh=[{value:"female",label:"Nữ"},{value:"male",label:"Nam"}];var pe={exports:{}};/*!
114
114
  * Pikaday
115
115
  *
116
116
  * Copyright © 2014 David Bushell | BSD & MIT license | https://github.com/Pikaday/Pikaday
@@ -126,7 +126,7 @@
126
126
  </svg>`:`<svg width="18" height="18" viewBox="0 0 24 24" fill="none">
127
127
  <path d="M9 6L15 12L9 18" stroke="#0E121B" stroke-width="2"
128
128
  stroke-linecap="round" stroke-linejoin="round"/>
129
- </svg>`,B}const m=g("prev"),C=g("next");m.style.left="8px",C.style.right="8px",s.appendChild(m),s.appendChild(C);let E=n,v=A,x=a;const p=()=>window.matchMedia("(max-width: 414px)").matches;function w(){const N=u.getBoundingClientRect(),B=s.getBoundingClientRect(),k=N.top-B.top+N.height/2;m.style.top=`${k}px`,C.style.top=`${k}px`,m.style.transform="translateY(-50%)",C.style.transform="translateY(-50%)"}function y(){const N=u.firstElementChild;return N?N.getBoundingClientRect().width+24:300}function X(N){u.scrollBy({left:N*y(),behavior:"smooth"})}function f(){if(p())return;const N=u.scrollWidth-u.clientWidth;m.disabled=u.scrollLeft<=0,C.disabled=u.scrollLeft>=N-2}m.addEventListener("click",()=>X(-1)),C.addEventListener("click",()=>X(1)),u.addEventListener("scroll",f);function Q(){if(u.innerHTML="",!E||E.length===0){const N=document.createElement("div");N.className="wgt:col-span-full wgt:text-center wgt:py-8 wgt:text-text-sub-600",N.innerText=q("noPackageFound")||"Không tìm thấy gói phù hợp",u.appendChild(N);return}E.forEach(N=>{const B=N._id===x,k=v.includes(N.code),{container:P}=v1({pkg:N,type:t,isDiscounted:k,promotion:e,isSelected:B,isRenew:i,onSelect:()=>{c((h||i)&&B?"":N._id)}});P.classList.add("wgt:snap-start"),u.appendChild(P)}),requestAnimationFrame(()=>{w(),f()})}Q();let M=!1,S=0,z=0;u.addEventListener("mousedown",N=>{M=!0,u.classList.replace("wgt:cursor-grab","wgt:cursor-grabbing"),S=N.pageX,z=u.scrollLeft});const L=()=>{M&&(M=!1,u.classList.replace("wgt:cursor-grabbing","wgt:cursor-grab"))};document.addEventListener("mouseup",L),u.addEventListener("mouseleave",L),u.addEventListener("mousemove",N=>{M&&(N.preventDefault(),u.scrollLeft=z-(N.pageX-S)*1.5)}),u.addEventListener("wheel",N=>{N.preventDefault(),u.scrollLeft+=N.deltaY},{passive:!1});const T=new ResizeObserver(()=>w());return T.observe(u),T.observe(s),{container:o,render:Q,setSelectedPackageId(N){x=N,Q()},updateData(N,B=null,k=null){E=N||E,B!==null&&(v=B),k!==null&&(x=k),Q()},updateDiscountedOnly(N){v=N,Q()}}}const M1="1.119.0";function k1(A){return _(this,arguments,function*({search:t,bank:n}){return(yield At.get(`${$A}`,{params:{isActive:!0,search:t||null,type:"service",bank:n}})).data})}function N1(n){return _(this,arguments,function*({bank:t}){return(yield At.get(`${$A}`,{params:{isActive:!0,type:"initial_fee",bank:t}})).data})}function X1(e){return _(this,arguments,function*({bank:t,hasRenew:n,isCashRegister:A}){return(yield At.get(`${$A}`,{params:{isActive:!0,type:"service",bank:t,hasRenew:n,limit:99,isCashRegister:A}})).data})}function S1(n){return _(this,arguments,function*({bank:t}){return(yield At.get(`${$A}`,{params:{isActive:!0,type:"signature",bank:t,limit:99}})).data})}function H1(t){return _(this,null,function*(){const n=new FormData;return n.append("eInvoiceRegistration",JSON.stringify(t.eInvoiceRegistration)),n.append("provider",t.provider),n.append("bank",t.bank),n.append("packages",JSON.stringify(t.packages)),n.append("promotionCodes",JSON.stringify(t.promotionCodes)),n.append("logo",t.logo),n.append("organizationRegistrationCert",t.organizationRegistrationCert),t.legalRepresentativeIdCard.forEach(e=>{n.append("legalRepresentativeIdCard",e)}),n.append("isRenew",t.isRenew),n.append("isCashRegister",t.isCashRegister),yield At.post(Gi,n,{headers:{"Content-Type":"multipart/form-data","X-Invoice-Widget-Mode":UA(),"X-Invoice-Widget-Version":M1}})})}function L1(t){return _(this,null,function*(){return yield At.get(`${Vi}/${t}/status`)})}function J1(){return _(this,arguments,function*({isRenewable:t}={}){return(yield At.get(Ui,{params:t===!0?{isRenewable:!0}:void 0})).data})}function P1(t){return _(this,null,function*(){return yield At.post(`${_i}/${t}`)})}function kh(t){return _(this,null,function*(){return yield At.get(`${$i}/${encodeURIComponent(t)}`)})}function b1(t,n){return _(this,null,function*(){try{return yield At.post(`${no}/${encodeURIComponent(t)}`,n)}catch(A){throw A}})}function z1({name:t,value:n,feeLabel:A,required:e,description:a,isChecked:h=!0,onChange:c=null}){const i=document.createElement("label");i.className=["wgt:relative","wgt:flex","wgt:items-start","wgt:gap-3","wgt:px-4","wgt:py-3","wgt:-mt-4","wgt:@max-2xl:px-0"].join(" ");const o=Ce({name:t,value:n,checked:h,onChange:g=>{console.log("Checkbox state changed to:",g),c&&c(g)}});i.appendChild(o.container);const s=document.createElement("div");s.className="wgt:flex wgt:flex-col wgt:gap-1";const r=document.createElement("div");r.className="wgt:flex wgt:items-center wgt:gap-2 wgt:@max-2xl:flex-col wgt:@max-2xl:items-start";const u=document.createElement("span");u.className="wgt:text-base wgt:font-semibold wgt:text-text-sub-600",u.textContent=A,r.appendChild(u);{const g=document.createElement("span");g.className=["wgt:bg-soft-200","wgt:text-text-sub-600","wgt:text-xs","wgt:font-semibold","wgt:px-1.5","wgt:py-1","wgt:rounded-sm"].join(" "),g.textContent=q("required"),r.appendChild(g)}s.appendChild(r);const l=document.createElement("p");return l.className="wgt:text-text-soft-400 wgt:text-sm",l.textContent=a,s.appendChild(l),i.appendChild(s),{container:i}}function PA(){const t=document.createElement("div");t.className="wgt:absolute wgt:inset-0 wgt:bg-white/80 wgt:items-center wgt:justify-center wgt:z-50 wgt:w-full wgt:h-full wgt:backdrop-blur-sm",t.style.display="none";const n=document.createElement("div");n.className="wgt:flex wgt:flex-col wgt:items-center wgt:gap-4 wgt:bg-white wgt:rounded-lg wgt:p-6 wgt:shadow-lg";const A=document.createElement("div");return A.className="wgt:h-12 wgt:w-12 wgt:animate-spin wgt:rounded-full wgt:border-4 wgt:border-solid wgt:border-primary wgt:border-t-transparent",n.appendChild(A),t.appendChild(n),{container:t,open:()=>{t.style.display="flex"},close:()=>{t.style.display="none"}}}function K1({promotion:t,onSelect:n,isHidden:A=!1,isSelectable:e=!0}){const a=document.createElement("div");if(A)return a.style.display="none",{container:a};e&&t.isSelected,a.className="wgt:w-full wgt:flex wgt:items-center wgt:relative wgt:h-[6.75rem]";const h=document.createElement("div");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">
129
+ </svg>`,B}const m=g("prev"),C=g("next");m.style.left="8px",C.style.right="8px",s.appendChild(m),s.appendChild(C);let E=n,v=A,x=a;const p=()=>window.matchMedia("(max-width: 414px)").matches;function w(){const N=u.getBoundingClientRect(),B=s.getBoundingClientRect(),k=N.top-B.top+N.height/2;m.style.top=`${k}px`,C.style.top=`${k}px`,m.style.transform="translateY(-50%)",C.style.transform="translateY(-50%)"}function y(){const N=u.firstElementChild;return N?N.getBoundingClientRect().width+24:300}function X(N){u.scrollBy({left:N*y(),behavior:"smooth"})}function f(){if(p())return;const N=u.scrollWidth-u.clientWidth;m.disabled=u.scrollLeft<=0,C.disabled=u.scrollLeft>=N-2}m.addEventListener("click",()=>X(-1)),C.addEventListener("click",()=>X(1)),u.addEventListener("scroll",f);function Q(){if(u.innerHTML="",!E||E.length===0){const N=document.createElement("div");N.className="wgt:col-span-full wgt:text-center wgt:py-8 wgt:text-text-sub-600",N.innerText=q("noPackageFound")||"Không tìm thấy gói phù hợp",u.appendChild(N);return}E.forEach(N=>{const B=N._id===x,k=v.includes(N.code),{container:P}=v1({pkg:N,type:t,isDiscounted:k,promotion:e,isSelected:B,isRenew:i,onSelect:()=>{c((h||i)&&B?"":N._id)}});P.classList.add("wgt:snap-start"),u.appendChild(P)}),requestAnimationFrame(()=>{w(),f()})}Q();let M=!1,S=0,z=0;u.addEventListener("mousedown",N=>{M=!0,u.classList.replace("wgt:cursor-grab","wgt:cursor-grabbing"),S=N.pageX,z=u.scrollLeft});const L=()=>{M&&(M=!1,u.classList.replace("wgt:cursor-grabbing","wgt:cursor-grab"))};document.addEventListener("mouseup",L),u.addEventListener("mouseleave",L),u.addEventListener("mousemove",N=>{M&&(N.preventDefault(),u.scrollLeft=z-(N.pageX-S)*1.5)}),u.addEventListener("wheel",N=>{N.preventDefault(),u.scrollLeft+=N.deltaY},{passive:!1});const T=new ResizeObserver(()=>w());return T.observe(u),T.observe(s),{container:o,render:Q,setSelectedPackageId(N){x=N,Q()},updateData(N,B=null,k=null){E=N||E,B!==null&&(v=B),k!==null&&(x=k),Q()},updateDiscountedOnly(N){v=N,Q()}}}const M1="1.120.0";function k1(A){return _(this,arguments,function*({search:t,bank:n}){return(yield At.get(`${$A}`,{params:{isActive:!0,search:t||null,type:"service",bank:n}})).data})}function N1(n){return _(this,arguments,function*({bank:t}){return(yield At.get(`${$A}`,{params:{isActive:!0,type:"initial_fee",bank:t}})).data})}function X1(e){return _(this,arguments,function*({bank:t,hasRenew:n,isCashRegister:A}){return(yield At.get(`${$A}`,{params:{isActive:!0,type:"service",bank:t,hasRenew:n,limit:99,isCashRegister:A}})).data})}function S1(n){return _(this,arguments,function*({bank:t}){return(yield At.get(`${$A}`,{params:{isActive:!0,type:"signature",bank:t,limit:99}})).data})}function H1(t){return _(this,null,function*(){const n=new FormData;return n.append("eInvoiceRegistration",JSON.stringify(t.eInvoiceRegistration)),n.append("provider",t.provider),n.append("bank",t.bank),n.append("packages",JSON.stringify(t.packages)),n.append("promotionCodes",JSON.stringify(t.promotionCodes)),n.append("logo",t.logo),n.append("organizationRegistrationCert",t.organizationRegistrationCert),t.legalRepresentativeIdCard.forEach(e=>{n.append("legalRepresentativeIdCard",e)}),n.append("isRenew",t.isRenew),n.append("isCashRegister",t.isCashRegister),yield At.post(Gi,n,{headers:{"Content-Type":"multipart/form-data","X-Invoice-Widget-Mode":UA(),"X-Invoice-Widget-Version":M1}})})}function L1(t){return _(this,null,function*(){return yield At.get(`${Vi}/${t}/status`)})}function J1(){return _(this,arguments,function*({isRenewable:t,serialNumber:n}={}){const A={isRenewable:!!t,serialNumber:(n!=null?n:"").trim()};return console.log("PROMO params:",A),(yield At.get(Ui,{params:A})).data})}function P1(t){return _(this,null,function*(){return yield At.post(`${_i}/${t}`)})}function kh(t){return _(this,null,function*(){return yield At.get(`${$i}/${encodeURIComponent(t)}`)})}function b1(t,n){return _(this,null,function*(){try{return yield At.post(`${no}/${encodeURIComponent(t)}`,n)}catch(A){throw A}})}function z1({name:t,value:n,feeLabel:A,required:e,description:a,isChecked:h=!0,onChange:c=null}){const i=document.createElement("label");i.className=["wgt:relative","wgt:flex","wgt:items-start","wgt:gap-3","wgt:px-4","wgt:py-3","wgt:-mt-4","wgt:@max-2xl:px-0"].join(" ");const o=Ce({name:t,value:n,checked:h,onChange:g=>{console.log("Checkbox state changed to:",g),c&&c(g)}});i.appendChild(o.container);const s=document.createElement("div");s.className="wgt:flex wgt:flex-col wgt:gap-1";const r=document.createElement("div");r.className="wgt:flex wgt:items-center wgt:gap-2 wgt:@max-2xl:flex-col wgt:@max-2xl:items-start";const u=document.createElement("span");u.className="wgt:text-base wgt:font-semibold wgt:text-text-sub-600",u.textContent=A,r.appendChild(u);{const g=document.createElement("span");g.className=["wgt:bg-soft-200","wgt:text-text-sub-600","wgt:text-xs","wgt:font-semibold","wgt:px-1.5","wgt:py-1","wgt:rounded-sm"].join(" "),g.textContent=q("required"),r.appendChild(g)}s.appendChild(r);const l=document.createElement("p");return l.className="wgt:text-text-soft-400 wgt:text-sm",l.textContent=a,s.appendChild(l),i.appendChild(s),{container:i}}function PA(){const t=document.createElement("div");t.className="wgt:absolute wgt:inset-0 wgt:bg-white/80 wgt:items-center wgt:justify-center wgt:z-50 wgt:w-full wgt:h-full wgt:backdrop-blur-sm",t.style.display="none";const n=document.createElement("div");n.className="wgt:flex wgt:flex-col wgt:items-center wgt:gap-4 wgt:bg-white wgt:rounded-lg wgt:p-6 wgt:shadow-lg";const A=document.createElement("div");return A.className="wgt:h-12 wgt:w-12 wgt:animate-spin wgt:rounded-full wgt:border-4 wgt:border-solid wgt:border-primary wgt:border-t-transparent",n.appendChild(A),t.appendChild(n),{container:t,open:()=>{t.style.display="flex"},close:()=>{t.style.display="none"}}}function K1({promotion:t,onSelect:n,isHidden:A=!1,isSelectable:e=!0}){const a=document.createElement("div");if(A)return a.style.display="none",{container:a};e&&t.isSelected,a.className="wgt:w-full wgt:flex wgt:items-center wgt:relative wgt:h-[6.75rem]";const h=document.createElement("div");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">
130
130
  <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"/>
131
131
  </svg>
132
132
  `;const c=document.createElement("div");c.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";const i=document.createElement("div");i.className="wgt:flex wgt:items-start wgt:flex-col wgt:relative";const o=document.createElement("h3");o.className=["wgt:text-base","wgt:font-semibold","wgt:text-gray-500","wgt:mb-1","wgt:text-primary"].join(" "),o.textContent=t.code,i.appendChild(o);const s=document.createElement("p");s.className=["wgt:text-sm","wgt:text-text-sub-600","wgt:mb-2"].join(" ");const r=JA(Ut());s.textContent=t[r],i.appendChild(s);const{container:u}=Ce({checked:t.isSelected,onChange:()=>{let g=!t.isSelected;n(t.code,g)},isIconCheckbox:!0});e||(u.style.display="none"),u.className="wgt:absolute wgt:top-0 wgt:right-0",i.appendChild(u),c.appendChild(i);const l=document.createElement("p");return l.className=["wgt:text-xs","wgt:font-normal","wgt:text-right","wgt:text-[#335CFF]","wgt:italic"].join(" "),l.textContent=`${q("validityPeriod")}: ${q("expiredDate")} ${t.expiredAt.split("T")[0]}`,c.appendChild(l),a.appendChild(h),a.appendChild(c),{container:a}}function D1({value:t="",placeholder:n="",onInputChange:A=void 0}){const e=n||q("searchUnits"),a=document.createElement("div");a.className="wgt:flex wgt:flex-col";const h=document.createElement("div");h.className="wgt:flex wgt:rounded-lg wgt:border wgt:border-gray-300 wgt:overflow-hidden",a.appendChild(h);const c=document.createElement("input");return c.type="text",c.inputMode="numeric",c.value=t,c.placeholder=e,c.className="wgt:flex-1 wgt:px-4 wgt:py-2 wgt:text-text-sub-600 wgt:placeholder-gray-400 wgt:bg-white wgt:focus:outline-none",typeof A=="function"&&c.addEventListener("input",A),h.appendChild(c),{container:a}}function O1({theme:t,debounceTimer:n,typedUnits:A,onSearchComplete:e}){let a=[],h=[];const c=document.createElement("div");c.className="wgt:flex wgt:flex-col wgt:gap-3";const i=document.createElement("div");i.className="wgt:flex wgt:flex-col wgt:gap-4",c.appendChild(i);const o=document.createElement("h2");o.className="wgt:text-xl wgt:font-bold wgt:text-text-black",o.innerText=q("selectInvoicePackage");const s=document.createElement("span");s.className="wgt:text-sm wgt:text-red-500 wgt:ml-1",s.innerText="*",o.appendChild(s),i.appendChild(o);function r(){return _(this,null,function*(){n&&clearTimeout(n),A!==""?n=setTimeout(()=>_(null,null,function*(){try{const x=A.trim().toLowerCase().replace(/\B(?=(\d{3})+(?!\d))/g,"."),p=yield k1({search:x,bank:t});p&&(h=p),e&&e()}catch(x){console.error("Error searching packages:",x),Ot.error(q("errorSearchingPackages"),{autoClose:5e3,closeButton:!0,icon:!0})}}),500):(h=a,e&&e())})}const u=D1({value:"",placeholder:q("searchUnits"),onInputChange:x=>{A=x.target.value.replace(/\D/g,""),r()}});i.appendChild(u.container);const l=document.createElement("div");l.className="wgt:flex wgt:flex-col wgt:gap-2",c.appendChild(l);const g=document.createElement("h3");g.className="wgt:text-sm wgt:font-semibold wgt:text-[#525866]",g.innerText=q("mostSuitablePackage"),l.appendChild(g);const m=document.createElement("div");l.appendChild(m);const C=document.createElement("div");C.className="wgt:flex wgt:items-center wgt:justify-center wgt:py-8",C.innerHTML=`
@@ -165,12 +165,12 @@
165
165
  </clipPath>
166
166
  </defs>
167
167
  </svg>
168
- `,A.appendChild(e);const a=document.createElement("span");return a.className="wgt:text-base wgt:font-semibold wgt:leading-5 wgt:text-strong-950",a.innerText=q("qrPayment"),A.appendChild(a),{container:t}}function R1(){const t=document.createElement("div");t.className="wgt:flex wgt:flex-col wgt:gap-2 wgt:-mt-4";const n=document.createElement("h3");n.className="wgt:text-lg wgt:font-bold wgt:text-text-black wgt:@max-2xl:text-xl wgt:@max-2xl:mb-3",n.innerText=q("selectedProducts"),t.appendChild(n);const A=document.createElement("div");A.className="wgt:overflow-x-auto wgt:border wgt:border-soft-200 wgt:rounded-lg wgt:@max-2xl:overflow-x-visible wgt:@max-2xl:border-0 wgt:@max-2xl:bg-transparent",t.appendChild(A);const e=document.createElement("table");e.className="wgt:min-w-full wgt:table-auto wgt:border-separate wgt:@max-2xl:border-collapse wgt:@max-2xl:w-full",A.appendChild(e);const a=document.createElement("thead");a.className="wgt:bg-soft-150 wgt:@max-2xl:hidden";const h=document.createElement("tr");[q("product"),q("unit"),q("quantity"),q("unitPrice"),q("totalPrice")].forEach(i=>{const o=document.createElement("th");o.className="wgt:whitespace-nowrap wgt:px-3 wgt:py-3 wgt:text-left wgt:text-sm wgt:font-semibold wgt:text-text-sub-600",o.innerText=i,h.appendChild(o)}),a.appendChild(h),e.appendChild(a);const c=document.createElement("tbody");return c.className="wgt:divide-y wgt:divide-gray-200 wgt:bg-white wgt:@max-2xl:divide-y-0 wgt:@max-2xl:bg-transparent",e.appendChild(c),{container:t,tbody:c}}const Y1="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAMCAYAAABr5z2BAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFmSURBVHgBjVJLUsJAEH2dTAzu4gmEG+gNYKFxGU9gbqAuLaEqVVDllhuAJyDuQBfEE1CeADiBcaESyWTsJCKfIOXbzPT3db9qAkN5VQvG3iUUVUEoYxcUJlDJC+TcIy8IReY0zA4STKHp15gnYeYTKuCGLiQXrEJnAmK/MHts1Uh5jgXxMab648EaUcv2EUduyrJ1kJb9yvGKgDmzEFMhieoDB7vxBpQsDVEphMYdm/Y402LB0Dxpr9ob7Ff8HKZ/jTw/pNtBBaSeeS93OYLmpAyF4uapw0KmgtfI60/EWjShrftu4IgTH6jxFKSGyEQ0PkdI1BTJzF9SqS4QFRtqwkciezxJCPnVJnV3VkashtTgNf6JrEaqEYt/nItIqrhry+78JSLd9Cf5bxbST/KQH74weQ8Z50Fh8iFJ99dewDAsKO2Cqyp8O04uYrx/Dv3d4wU9LiwvqfQuhL5OnyhuSAFk5KbmN7eYmgg1dFx4AAAAAElFTkSuQmCC";function j1(X){return _(this,arguments,function*({onNext:t,onPrev:n,selectedInitPackage:A,selectedInvoiceOtp:e,selectedSignatureOtp:a,setSelectedInitPackage:h,setSelectedInvoiceOtp:c,setSelectedSignatureOtp:i,setOrderId:o,setTotalAmount:s,setOrderAmount:r,theme:u,selectedProvider:l,selectedPromotions:g,registrationData:m,setSelectedPromotions:C,setPackages:E,setPromotionCodes:v,isNewCustomer:x,savedQuantities:p,setSavedQuantities:w,isRenewal:y}){var wA;const f=((wA=m==null?void 0:m.eInvoiceRegistration)==null?void 0:wA.invoiceSymbol)||"",Q=(f==null?void 0:f[4])==="M";let M=[];function S(F,tn){return Array.isArray(F)?tn==="household"?F.filter(nn=>{var hn;return(hn=nn==null?void 0:nn.code)==null?void 0:hn.includes("HKD")}):F.filter(nn=>{var hn;return!((hn=nn==null?void 0:nn.code)!=null&&hn.includes("HKD"))}):[]}let z="",L={company:e?e._id:null,household:null},T=e?e._id:null,N=a?a._id:null,B=g?g.map(F=>F):[],k=[],P=[],I=[],d=[],H=null,J=(p==null?void 0:p.qtyRegFee)||1,b=(p==null?void 0:p.qtyInvoicePkg)||1,D=(p==null?void 0:p.qtySignaturePkg)||1;function K(){w&&w({qtyRegFee:J,qtyInvoicePkg:b,qtySignaturePkg:D})}function U(F){return F.find(tn=>d.includes(tn.code))}function Y({registrationData:F,onChange:tn}){var Gn;let nn=((Gn=F==null?void 0:F.eInvoiceRegistration)==null?void 0:Gn.businessType)||"company";const hn=document.createElement("div");hn.className="wgt:flex wgt:items-center wgt:gap-4 wgt:flex-wrap";const un=document.createElement("div");un.className="wgt:text-sm wgt:font-medium wgt:text-black",un.innerHTML=`${q("businessRegistrationType")||"Hình thức đăng ký kinh doanh"} <span class="wgt:text-red-500">*</span>`,hn.appendChild(un);const en=document.createElement("div");en.className="wgt:inline-flex wgt:items-center wgt:rounded-xl wgt:bg-white wgt:border wgt:border-soft-200 wgt:p-1 wgt:gap-1",hn.appendChild(en);function gn(Hn,qn){const Rn=document.createElement("button");Rn.type="button",Rn.className="wgt:flex wgt:items-center wgt:gap-2 wgt:px-4 wgt:py-2 wgt:rounded-lg wgt:text-sm wgt:font-medium wgt:transition wgt:hover:bg-weak-50";const zt=document.createElement("span");zt.className="wgt:h-4 wgt:w-4 wgt:rounded-full wgt:border wgt:flex wgt:items-center wgt:justify-center";const wt=document.createElement("span");wt.className="wgt:h-2 wgt:w-2 wgt:rounded-full ",wt.style.backgroundColor="#1e2a7b",wt.style.opacity="0",zt.appendChild(wt);const kt=document.createElement("span");return kt.className="wgt:text-sm wgt:font-semibold",kt.innerText=Hn,Rn.appendChild(zt),Rn.appendChild(kt),Rn.addEventListener("click",()=>{nn=qn,Sn(),F!=null&&F.eInvoiceRegistration&&(F.eInvoiceRegistration.businessType=nn),tn==null||tn(nn)}),{btn:Rn,inner:wt,textSpan:kt,value:qn}}const cn=gn(q("company")||"Doanh nghiệp","company"),In=gn(q("householdBusiness")||"Hộ kinh doanh","household");en.appendChild(cn.btn),en.appendChild(In.btn);function Tn(Hn,qn){Hn.btn.classList.toggle("wgt:bg-weak-50",qn),Hn.inner.style.opacity=qn?"1":"0";const Rn=Hn.inner.parentElement;Rn.classList.toggle("wgt:border-[#1e2a7b]",qn),Rn.classList.toggle("wgt:border-[#D0D5DD]",!qn),Hn.textSpan.style.color=qn?"#1e2a7b":"",Hn.textSpan.classList.toggle("wgt:text-text-sub-600",!qn)}function Sn(){Tn(cn,nn==="company"),Tn(In,nn==="household")}return Sn(),{container:hn,getValue:()=>nn,setValue:Hn=>{nn=Hn,Sn()}}}function $(F){return k.find(tn=>tn._id===F)||null}const sn=document.createElement("div");sn.className="wgt:relative wgt:flex wgt:w-full wgt:h-full wgt:flex-col wgt:gap-4 wgt:py-6";const{container:V,open:An,close:Bn}=PA();sn.appendChild(V);let Jn=null;if(Q){Jn=Y({registrationData:m,onChange:tn=>{var un;const nn=S(M,tn);nt(nn||[]),Mt(nn||[]);const hn=tn==="company"?"household":"company";if(L[hn]=T,L[tn])T=L[tn];else{const en=U(nn);T=en?en._id:((un=nn==null?void 0:nn[0])==null?void 0:un._id)||null,L[tn]=T}B=[],bt(),hA(),dt(),it(),Vn()}});const F=document.createElement("div");F.className="wgt:mx-auto wgt:w-full wgt:max-w-[1072px] wgt:px-6 wgt:@max-2xl:px-3",F.appendChild(Jn.container),sn.appendChild(F)}const dn=document.createElement("div");dn.className="wgt:mx-auto wgt:w-full wgt:max-w-[1072px] wgt:flex wgt:flex-col wgt:gap-8 wgt:rounded-3xl wgt:bg-weak-50 wgt:px-6 wgt:py-4 wgt:@max-2xl:px-3 wgt:@max-2xl:py-3 wgt:@max-2xl:gap-6 wgt:@max-2xl:rounded-none",sn.appendChild(dn);const{container:gt,invoiceSelectorWrapper:ht,setInvoicePackages:nt,getInvoicePackages:vn,getFilteredInvoiceOptions:Ct,setFilteredInvoiceOptions:Mt,findInvoiceById:lt,removeLoading:Xt}=O1({theme:u,debounceTimer:H,typedUnits:z,onSearchComplete:()=>{hA(),Vn()}});dn.appendChild(gt);let tt=null,mt=null;if(!y){const F=V1(y);mt=F.container,tt=F.signatureSelectorWrapper,dn.appendChild(mt)}const ct=document.createElement("div");ct.className="wgt:flex wgt:items-center wgt:justify-center wgt:py-4",ct.innerHTML=`
168
+ `,A.appendChild(e);const a=document.createElement("span");return a.className="wgt:text-base wgt:font-semibold wgt:leading-5 wgt:text-strong-950",a.innerText=q("qrPayment"),A.appendChild(a),{container:t}}function R1(){const t=document.createElement("div");t.className="wgt:flex wgt:flex-col wgt:gap-2 wgt:-mt-4";const n=document.createElement("h3");n.className="wgt:text-lg wgt:font-bold wgt:text-text-black wgt:@max-2xl:text-xl wgt:@max-2xl:mb-3",n.innerText=q("selectedProducts"),t.appendChild(n);const A=document.createElement("div");A.className="wgt:overflow-x-auto wgt:border wgt:border-soft-200 wgt:rounded-lg wgt:@max-2xl:overflow-x-visible wgt:@max-2xl:border-0 wgt:@max-2xl:bg-transparent",t.appendChild(A);const e=document.createElement("table");e.className="wgt:min-w-full wgt:table-auto wgt:border-separate wgt:@max-2xl:border-collapse wgt:@max-2xl:w-full",A.appendChild(e);const a=document.createElement("thead");a.className="wgt:bg-soft-150 wgt:@max-2xl:hidden";const h=document.createElement("tr");[q("product"),q("unit"),q("quantity"),q("unitPrice"),q("totalPrice")].forEach(i=>{const o=document.createElement("th");o.className="wgt:whitespace-nowrap wgt:px-3 wgt:py-3 wgt:text-left wgt:text-sm wgt:font-semibold wgt:text-text-sub-600",o.innerText=i,h.appendChild(o)}),a.appendChild(h),e.appendChild(a);const c=document.createElement("tbody");return c.className="wgt:divide-y wgt:divide-gray-200 wgt:bg-white wgt:@max-2xl:divide-y-0 wgt:@max-2xl:bg-transparent",e.appendChild(c),{container:t,tbody:c}}const Y1="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAMCAYAAABr5z2BAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFmSURBVHgBjVJLUsJAEH2dTAzu4gmEG+gNYKFxGU9gbqAuLaEqVVDllhuAJyDuQBfEE1CeADiBcaESyWTsJCKfIOXbzPT3db9qAkN5VQvG3iUUVUEoYxcUJlDJC+TcIy8IReY0zA4STKHp15gnYeYTKuCGLiQXrEJnAmK/MHts1Uh5jgXxMab648EaUcv2EUduyrJ1kJb9yvGKgDmzEFMhieoDB7vxBpQsDVEphMYdm/Y402LB0Dxpr9ob7Ff8HKZ/jTw/pNtBBaSeeS93OYLmpAyF4uapw0KmgtfI60/EWjShrftu4IgTH6jxFKSGyEQ0PkdI1BTJzF9SqS4QFRtqwkciezxJCPnVJnV3VkashtTgNf6JrEaqEYt/nItIqrhry+78JSLd9Cf5bxbST/KQH74weQ8Z50Fh8iFJ99dewDAsKO2Cqyp8O04uYrx/Dv3d4wU9LiwvqfQuhL5OnyhuSAFk5KbmN7eYmgg1dFx4AAAAAElFTkSuQmCC";function j1(X){return _(this,arguments,function*({onNext:t,onPrev:n,selectedInitPackage:A,selectedInvoiceOtp:e,selectedSignatureOtp:a,setSelectedInitPackage:h,setSelectedInvoiceOtp:c,setSelectedSignatureOtp:i,setOrderId:o,setTotalAmount:s,setOrderAmount:r,theme:u,selectedProvider:l,selectedPromotions:g,registrationData:m,setSelectedPromotions:C,setPackages:E,setPromotionCodes:v,isNewCustomer:x,savedQuantities:p,setSavedQuantities:w,isRenewal:y}){var wA;const f=((wA=m==null?void 0:m.eInvoiceRegistration)==null?void 0:wA.invoiceSymbol)||"";console.log("Invoice Symbol",f);const Q=(f==null?void 0:f[4])==="M";let M=[];function S(F,tn){return Array.isArray(F)?tn==="household"?F.filter(nn=>{var hn;return(hn=nn==null?void 0:nn.code)==null?void 0:hn.includes("HKD")}):F.filter(nn=>{var hn;return!((hn=nn==null?void 0:nn.code)!=null&&hn.includes("HKD"))}):[]}let z="",L={company:e?e._id:null,household:null},T=e?e._id:null,N=a?a._id:null,B=g?g.map(F=>F):[],k=[],P=[],I=[],d=[],H=null,J=(p==null?void 0:p.qtyRegFee)||1,b=(p==null?void 0:p.qtyInvoicePkg)||1,D=(p==null?void 0:p.qtySignaturePkg)||1;function K(){w&&w({qtyRegFee:J,qtyInvoicePkg:b,qtySignaturePkg:D})}function U(F){return F.find(tn=>d.includes(tn.code))}function Y({registrationData:F,onChange:tn}){var Gn;let nn=((Gn=F==null?void 0:F.eInvoiceRegistration)==null?void 0:Gn.businessType)||"company";const hn=document.createElement("div");hn.className="wgt:flex wgt:items-center wgt:gap-4 wgt:flex-wrap";const un=document.createElement("div");un.className="wgt:text-sm wgt:font-medium wgt:text-black",un.innerHTML=`${q("businessRegistrationType")||"Hình thức đăng ký kinh doanh"} <span class="wgt:text-red-500">*</span>`,hn.appendChild(un);const en=document.createElement("div");en.className="wgt:inline-flex wgt:items-center wgt:rounded-xl wgt:bg-white wgt:border wgt:border-soft-200 wgt:p-1 wgt:gap-1",hn.appendChild(en);function gn(Hn,qn){const Rn=document.createElement("button");Rn.type="button",Rn.className="wgt:flex wgt:items-center wgt:gap-2 wgt:px-4 wgt:py-2 wgt:rounded-lg wgt:text-sm wgt:font-medium wgt:transition wgt:hover:bg-weak-50";const zt=document.createElement("span");zt.className="wgt:h-4 wgt:w-4 wgt:rounded-full wgt:border wgt:flex wgt:items-center wgt:justify-center";const wt=document.createElement("span");wt.className="wgt:h-2 wgt:w-2 wgt:rounded-full ",wt.style.backgroundColor="#1e2a7b",wt.style.opacity="0",zt.appendChild(wt);const kt=document.createElement("span");return kt.className="wgt:text-sm wgt:font-semibold",kt.innerText=Hn,Rn.appendChild(zt),Rn.appendChild(kt),Rn.addEventListener("click",()=>{nn=qn,Sn(),F!=null&&F.eInvoiceRegistration&&(F.eInvoiceRegistration.businessType=nn),tn==null||tn(nn)}),{btn:Rn,inner:wt,textSpan:kt,value:qn}}const cn=gn(q("company")||"Doanh nghiệp","company"),In=gn(q("householdBusiness")||"Hộ kinh doanh","household");en.appendChild(cn.btn),en.appendChild(In.btn);function Tn(Hn,qn){Hn.btn.classList.toggle("wgt:bg-weak-50",qn),Hn.inner.style.opacity=qn?"1":"0";const Rn=Hn.inner.parentElement;Rn.classList.toggle("wgt:border-[#1e2a7b]",qn),Rn.classList.toggle("wgt:border-[#D0D5DD]",!qn),Hn.textSpan.style.color=qn?"#1e2a7b":"",Hn.textSpan.classList.toggle("wgt:text-text-sub-600",!qn)}function Sn(){Tn(cn,nn==="company"),Tn(In,nn==="household")}return Sn(),{container:hn,getValue:()=>nn,setValue:Hn=>{nn=Hn,Sn()}}}function $(F){return k.find(tn=>tn._id===F)||null}const sn=document.createElement("div");sn.className="wgt:relative wgt:flex wgt:w-full wgt:h-full wgt:flex-col wgt:gap-4 wgt:py-6";const{container:V,open:An,close:Bn}=PA();sn.appendChild(V);let Jn=null;if(Q){Jn=Y({registrationData:m,onChange:tn=>{var un;const nn=S(M,tn);nt(nn||[]),Mt(nn||[]);const hn=tn==="company"?"household":"company";if(L[hn]=T,L[tn])T=L[tn];else{const en=U(nn);T=en?en._id:((un=nn==null?void 0:nn[0])==null?void 0:un._id)||null,L[tn]=T}B=[],bt(),hA(),dt(),it(),Vn()}});const F=document.createElement("div");F.className="wgt:mx-auto wgt:w-full wgt:max-w-[1072px] wgt:px-6 wgt:@max-2xl:px-3",F.appendChild(Jn.container),sn.appendChild(F)}const dn=document.createElement("div");dn.className="wgt:mx-auto wgt:w-full wgt:max-w-[1072px] wgt:flex wgt:flex-col wgt:gap-8 wgt:rounded-3xl wgt:bg-weak-50 wgt:px-6 wgt:py-4 wgt:@max-2xl:px-3 wgt:@max-2xl:py-3 wgt:@max-2xl:gap-6 wgt:@max-2xl:rounded-none",sn.appendChild(dn);const{container:gt,invoiceSelectorWrapper:ht,setInvoicePackages:nt,getInvoicePackages:vn,getFilteredInvoiceOptions:Ct,setFilteredInvoiceOptions:Mt,findInvoiceById:lt,removeLoading:Xt}=O1({theme:u,debounceTimer:H,typedUnits:z,onSearchComplete:()=>{hA(),Vn()}});dn.appendChild(gt);let tt=null,mt=null;if(!y){const F=V1(y);mt=F.container,tt=F.signatureSelectorWrapper,dn.appendChild(mt)}const ct=document.createElement("div");ct.className="wgt:flex wgt:items-center wgt:justify-center wgt:py-4",ct.innerHTML=`
169
169
  <div class="wgt:flex wgt:flex-col wgt:items-center wgt:gap-2">
170
170
  <div class="wgt:h-6 wgt:w-6 wgt:animate-spin wgt:rounded-full wgt:border-2 wgt:border-solid wgt:border-primary wgt:border-t-transparent"></div>
171
171
  <span class="wgt:text-sm wgt:text-text-sub-600">${q("loading")}...</span>
172
172
  </div>
173
- `,dn.appendChild(ct);const{container:St}=G1(),{container:Ht,tbody:qt}=R1(),Lt=document.createElement("div");Lt.className="wgt:hidden wgt:@max-2xl:flex wgt:items-center wgt:justify-between wgt:w-full wgt:bg-white wgt:border wgt:border-soft-200 wgt:rounded-lg wgt:px-6 wgt:py-5 wgt:shadow-lg";const Gt=document.createElement("span");Gt.className="wgt:text-lg wgt:font-bold wgt:text-strong-950",Gt.innerText=q("total"),Lt.appendChild(Gt);const Rt=document.createElement("span");Rt.className="wgt:text-xl wgt:font-bold wgt:text-primary",Rt.innerText="0 VND",Lt.appendChild(Rt);const Yt=document.createElement("div");Yt.className="wgt:flex wgt:justify-between wgt:gap-2",sn.appendChild(Yt);const Jt=document.createElement("button");Jt.type="button",Jt.innerText=q("back"),Jt.className="wgt:bg-transparent wgt:text-primary wgt:hover:text-primary-dark wgt:hover:bg-transparent wgt:underline",Jt.addEventListener("click",n),Yt.appendChild(Jt);const b0=(F,tn,nn,hn)=>_(null,null,function*(){An();const cn=m.eInvoiceRegistration,{isUsedEInvoiceBefore:un}=cn,en=Dc(cn,["isUsedEInvoiceBefore"]);let gn=[{code:tn.code,quantity:tn.quantity,isCashRegister:Q}];nn&&gn.push({code:nn.code,quantity:nn.quantity,isCashRegister:Q}),F&&gn.push({code:F.code,quantity:F.quantity,isCashRegister:Q}),hn.length>0&&hn.forEach(In=>{const Tn=I[In];Tn.reward.packageCodes.length>0&&Tn.reward.packageCodes.forEach(Sn=>{gn.push({code:Sn,quantity:1,isCashRegister:Q})})}),E(gn),v(hn);try{const In=yield H1({eInvoiceRegistration:Z({},en),bank:m.bank,provider:l.route,logo:m.logo,organizationRegistrationCert:m.license,legalRepresentativeIdCard:[m.idCard,m.idCardBack],packages:gn,promotionCodes:hn,isRenew:y,isCashRegister:Q}),Tn=In.orderId,Sn=In.amount||0;o(Tn),r?r(Sn):console.warn("setOrderAmount is not defined!"),yield new Promise(Gn=>setTimeout(Gn,100)),Bn(),t()}catch(In){ue(q("errorCreatingOrder")||"Failed to create order"),Bn();return}}),ve=Et({type:"button",title:q("next"),className:"wgt:text-text-primary wgt:bg-primary",handleClick:()=>_(null,null,function*(){const F=vn().find(en=>en._id===T),tn=k.find(en=>en._id===N);if(!y&&!tn){Ot.error(q("errorSelectSignature")||"Vui lòng chọn gói chữ ký số");return}let nn=null;!y&&!(F!=null&&F.withoutInitialFee)?(nn=wn(Z({},P[0]),{quantity:J}),h(nn)):h(null);let hn=wn(Z({},F),{quantity:b}),un=tn?wn(Z({},tn),{quantity:D}):null;c(hn),i(un),C(B),K(),w&&w({qtyRegFee:J,qtyInvoicePkg:b,qtySignaturePkg:D}),yield b0(nn,hn,un,B)})});Yt.appendChild(ve);function z0(){return _(this,null,function*(){var F,tn;try{const[nn,hn,un,en]=yield Promise.allSettled([J1({isRenewable:y===!0}),N1({bank:u}),X1({bank:u,hasRenew:y===!0,isCashRegister:Q}),y?Promise.resolve([]):S1({bank:u})]);if(hn.status==="fulfilled"?P=hn.value||[]:(console.error("Failed to load init packages:",hn.reason),Ot.error(q("errorLoadingInitPackages")||"Failed to load registration packages"),P=[]),nn.status==="fulfilled"?(((F=nn==null?void 0:nn.value)==null?void 0:F.length)>0&&nn.value.forEach(gn=>{gn.codes.length>0&&(I[gn.codes[0].code]={id:gn.id,name:gn.name,nameEn:gn.nameEn,appliedPackages:gn.condition.packageCodes,code:gn.codes[0].code,limit:gn.codes[0].limit,used:gn.codes[0].used,bank:gn.campaign.bank,isActive:gn.isActive,type:gn.type,expiredAt:gn.toDate,isHidden:!1,reward:gn.reward})}),Object.keys(I).length>0&&(B=g?[...g]:[],cA())):console.error("Failed to load promotions:",nn.reason),un.status==="fulfilled"){M=(y?un.value.filter(In=>In.renewPrice!==0):un.value)||[];const cn=Q?S(M,Jn.getValue()):M;if(nt(cn||[]),Mt(cn||[]),un.value.length>0){const In=U(cn);if(e?T=e._id:In?T=In._id:T=cn==null?void 0:cn[0]._id,Q){const Tn=Jn.getValue();L[Tn]=T}Mt(cn)}Xt()}else console.error("Failed to load invoice packages:",un.reason),Ot.error(q("errorLoadingInvoicePackages")||"Failed to load invoice packages"),nt([]),M=[],Xt();if(en.status==="fulfilled")if(k=en.value||[],k.length>0){const gn=k.find(cn=>d.includes(cn.code));y?N=a?a._id:null:N=a?a._id:gn?gn._id:y?null:(tn=k==null?void 0:k.filter(cn=>!cn.isBonusPackage)[0])==null?void 0:tn._id}else{if(console.error("Failed to load signature packages:",en.reason),!y){Ot.error(q("errorLoadingSignaturePackages")||"Failed to load signature packages");return}k=[]}EA()}catch(nn){console.error("Unexpected error during data loading:",nn),Ot.error(q("errorLoadingData")||"Failed to load data",{autoClose:5e3,closeButton:!0,icon:!0})}})}function EA(){bt(),hA(),y||pA(),dt(),it(),Vn()}function aA(F,tn,nn){const hn=Object.values(I).find(cn=>cn.bank===u&&cn.appliedPackages.includes(F)),un=d.includes(F)||hn&&!hn.isHidden&&!(hn.expiredAt<new Date().toISOString())&&hn.limit!==hn.used,en=Object.values(I).find(cn=>cn.bank===u&&cn.appliedPackages.includes(tn)),gn=d.includes(tn)||en&&!en.isHidden&&!(en.expiredAt<new Date().toISOString())&&en.limit!==en.used&&en.isActive;if(un&&!gn){const{container:cn,open:In}=xt({message:q("errorDiscountPackage"),description:q("errorDiscountPackageDes"),okLabel:q("ok"),cancelLabel:q("cancel"),onClose:nn,isWarning:!0,isSuccess:!1,theme:u});sn.appendChild(cn),In()}else nn()}let pt=null;function hA(){if(ht.innerHTML="",Ct().length>0)pt=Mh({type:"service",packageOptions:Ct(),disCountedPackages:d,promotion:q("discount"),selectedPackageId:T,isRenew:y,handlePackageSelect:F=>{var hn,un;let tn=(hn=vn().find(en=>en._id===T))==null?void 0:hn.code,nn=(un=vn().find(en=>en._id===F))==null?void 0:un.code;aA(tn,nn,()=>{if(T=F,Q&&Jn){const en=Jn.getValue();L[en]=F}pt.setSelectedPackageId(F),bt(),dt(),it(),Vn()})}}),ht.appendChild(pt.container);else{const F=document.createElement("span");F.className="wgt:text-text-sub-600",F.innerText=q("noPackageFound"),ht.appendChild(F),pt=null}}let Pt=null;function pA(){if(!y&&tt)if(tt.innerHTML="",k.length>0)Pt=Mh({type:"signature",packageOptions:k.filter(F=>!F.isBonusPackage),disCountedPackages:d,promotion:q("gift"),selectedPackageId:N,allowDeselect:y,handlePackageSelect:F=>{var hn,un;let tn=(hn=k.find(en=>en._id===N))==null?void 0:hn.code,nn=(un=k.find(en=>en._id===F))==null?void 0:un.code;if(y&&N===F){N=null,Pt.setSelectedPackageId(null),bt(),dt(),it(),Vn();return}aA(tn,nn,()=>{N=F,Pt.setSelectedPackageId(F),Mt(vn()),bt(),dt(),it(),Vn()})}}),tt.appendChild(Pt.container);else{const F=document.createElement("span");F.className="wgt:text-text-sub-600",F.innerText=q("noPackageFound"),tt.appendChild(F),Pt=null}}const jt=document.createElement("div");jt.className="wgt:w-full",dn.appendChild(jt);function dt(){ct.remove(),jt.innerHTML="";const F=vn().find(tn=>tn._id===T);if(P.length>0){const{container:tn}=z1({name:"registrationFee",value:"standard",feeLabel:`${q("registrationFee")}: ${On(P[0].price)} VND`,required:!0,description:P[0][JA(Ut())],isChecked:!y&&!(F!=null&&F.withoutInitialFee)});jt.appendChild(tn)}}const rt=document.createElement("div");rt.className="promotion-wrapper wgt:w-full wgt:flex wgt:flex-col wgt:gap-4";function bt(){const F=vn().find(un=>un._id===T),tn=k.find(un=>un._id===N),nn=!y&&(P==null?void 0:P.length)>0&&!(F!=null&&F.withoutInitialFee),hn=[];F!=null&&F.code&&hn.push(F.code),tn!=null&&tn.code&&hn.push(tn.code),nn&&hn.push("INITIAL_FEE"),Object.keys(I).forEach(un=>{var Gn;const en=I[un];if(en.bank!==u){en.isHidden=!0,B=B.filter(Hn=>Hn!==en.code);return}const gn=en.expiredAt<new Date().toISOString(),cn=en.limit<=en.used,In=!en.isActive,Sn=((Gn=en.appliedPackages)==null?void 0:Gn.some(Hn=>hn.includes(Hn)))&&!gn&&!cn&&!In;en.isHidden=!Sn,Sn?B.includes(en.code)||B.push(en.code):B=B.filter(Hn=>Hn!==en.code)}),cA()}function cA(){d=[...new Set(Object.values(I).filter(F=>F.bank===u).flatMap(F=>F.appliedPackages.filter(tn=>tn!=="INITIAL_FEE")))]}function it(){if(Object.values(I).filter(cn=>cn.bank===u).length===0){dn.contains(rt)&&dn.removeChild(rt);return}rt.innerHTML="";const tn=document.createElement("h3");tn.className="wgt:text-xl wgt:font-bold wgt:text-strong-950",tn.innerText=q("applyPromotion"),rt.appendChild(tn),dn.appendChild(rt);const nn=document.createElement("div");nn.className="wgt:w-full wgt:flex wgt:items-center wgt:gap-2 wgt:@max-2xl:flex-col wgt:@max-2xl:items-start";const hn=document.createElement("div");hn.className="wgt:flex wgt:min-w-[500px] wgt:h-11 wgt:items-center wgt:gap-3 wgt:px-3 wgt:py-2 wgt:rounded-lg wgt:bg-white wgt:border wgt:border-[#E4E7EC] wgt:@max-2xl:min-w-full wgt:@max-2xl:flex-wrap wgt:@max-2xl:h-fit",nn.appendChild(hn),B&&B.length>0&&B.filter(In=>{const Tn=Object.values(I).find(Sn=>Sn.code===In);return Tn&&Tn.bank===u}).forEach(In=>{const Tn=document.createElement("div");Tn.className="wgt:flex wgt:w-fit wgt:h-fit wgt:items-center wgt:gap-2 wgt:px-2 wgt:py-1.5 wgt:rounded-md wgt:bg-primary/10 wgt:border wgt:border-primary wgt:text-sm wgt:font-medium wgt:text-primary",Tn.innerText=In;const Sn=Et({type:"button",title:"x",handleClick:()=>{B=B.filter(Gn=>Gn!==In),it(),Vn()}});Sn.className="wgt:w-fit wgt:h-fit wgt:p-0 wgt:bg-transparent wgt:cursor-pointer",Sn.innerHTML=`<svg width="8" height="8" viewBox="0 0 8 8" fill="none" xmlns="http://www.w3.org/2000/svg">
173
+ `,dn.appendChild(ct);const{container:St}=G1(),{container:Ht,tbody:qt}=R1(),Lt=document.createElement("div");Lt.className="wgt:hidden wgt:@max-2xl:flex wgt:items-center wgt:justify-between wgt:w-full wgt:bg-white wgt:border wgt:border-soft-200 wgt:rounded-lg wgt:px-6 wgt:py-5 wgt:shadow-lg";const Gt=document.createElement("span");Gt.className="wgt:text-lg wgt:font-bold wgt:text-strong-950",Gt.innerText=q("total"),Lt.appendChild(Gt);const Rt=document.createElement("span");Rt.className="wgt:text-xl wgt:font-bold wgt:text-primary",Rt.innerText="0 VND",Lt.appendChild(Rt);const Yt=document.createElement("div");Yt.className="wgt:flex wgt:justify-between wgt:gap-2",sn.appendChild(Yt);const Jt=document.createElement("button");Jt.type="button",Jt.innerText=q("back"),Jt.className="wgt:bg-transparent wgt:text-primary wgt:hover:text-primary-dark wgt:hover:bg-transparent wgt:underline",Jt.addEventListener("click",n),Yt.appendChild(Jt);const b0=(F,tn,nn,hn)=>_(null,null,function*(){An();const cn=m.eInvoiceRegistration,{isUsedEInvoiceBefore:un}=cn,en=Dc(cn,["isUsedEInvoiceBefore"]);let gn=[{code:tn.code,quantity:tn.quantity,isCashRegister:Q}];nn&&gn.push({code:nn.code,quantity:nn.quantity,isCashRegister:Q}),F&&gn.push({code:F.code,quantity:F.quantity,isCashRegister:Q}),hn.length>0&&hn.forEach(In=>{const Tn=I[In];Tn.reward.packageCodes.length>0&&Tn.reward.packageCodes.forEach(Sn=>{gn.push({code:Sn,quantity:1,isCashRegister:Q})})}),E(gn),v(hn);try{const In=yield H1({eInvoiceRegistration:Z({},en),bank:m.bank,provider:l.route,logo:m.logo,organizationRegistrationCert:m.license,legalRepresentativeIdCard:[m.idCard,m.idCardBack],packages:gn,promotionCodes:hn,isRenew:y,isCashRegister:Q}),Tn=In.orderId,Sn=In.amount||0;o(Tn),r?r(Sn):console.warn("setOrderAmount is not defined!"),yield new Promise(Gn=>setTimeout(Gn,100)),Bn(),t()}catch(In){ue(q("errorCreatingOrder")||"Failed to create order"),Bn();return}}),ve=Et({type:"button",title:q("next"),className:"wgt:text-text-primary wgt:bg-primary",handleClick:()=>_(null,null,function*(){const F=vn().find(en=>en._id===T),tn=k.find(en=>en._id===N);if(!y&&!tn){Ot.error(q("errorSelectSignature")||"Vui lòng chọn gói chữ ký số");return}let nn=null;!y&&!(F!=null&&F.withoutInitialFee)?(nn=wn(Z({},P[0]),{quantity:J}),h(nn)):h(null);let hn=wn(Z({},F),{quantity:b}),un=tn?wn(Z({},tn),{quantity:D}):null;c(hn),i(un),C(B),K(),w&&w({qtyRegFee:J,qtyInvoicePkg:b,qtySignaturePkg:D}),yield b0(nn,hn,un,B)})});Yt.appendChild(ve);function z0(){return _(this,null,function*(){var F,tn;try{const[nn,hn,un,en]=yield Promise.allSettled([J1({isRenewable:y===!0,serialNumber:f}),N1({bank:u}),X1({bank:u,hasRenew:y===!0,isCashRegister:Q}),y?Promise.resolve([]):S1({bank:u})]);if(hn.status==="fulfilled"?P=hn.value||[]:(console.error("Failed to load init packages:",hn.reason),Ot.error(q("errorLoadingInitPackages")||"Failed to load registration packages"),P=[]),nn.status==="fulfilled"?(((F=nn==null?void 0:nn.value)==null?void 0:F.length)>0&&nn.value.forEach(gn=>{gn.codes.length>0&&(I[gn.codes[0].code]={id:gn.id,name:gn.name,nameEn:gn.nameEn,appliedPackages:gn.condition.packageCodes,code:gn.codes[0].code,limit:gn.codes[0].limit,used:gn.codes[0].used,bank:gn.campaign.bank,isActive:gn.isActive,type:gn.type,expiredAt:gn.toDate,isHidden:!1,reward:gn.reward})}),Object.keys(I).length>0&&(B=g?[...g]:[],cA())):console.error("Failed to load promotions:",nn.reason),un.status==="fulfilled"){M=(y?un.value.filter(In=>In.renewPrice!==0):un.value)||[];const cn=Q?S(M,Jn.getValue()):M;if(nt(cn||[]),Mt(cn||[]),un.value.length>0){const In=U(cn);if(e?T=e._id:In?T=In._id:T=cn==null?void 0:cn[0]._id,Q){const Tn=Jn.getValue();L[Tn]=T}Mt(cn)}Xt()}else console.error("Failed to load invoice packages:",un.reason),Ot.error(q("errorLoadingInvoicePackages")||"Failed to load invoice packages"),nt([]),M=[],Xt();if(en.status==="fulfilled")if(k=en.value||[],k.length>0){const gn=k.find(cn=>d.includes(cn.code));y?N=a?a._id:null:N=a?a._id:gn?gn._id:y?null:(tn=k==null?void 0:k.filter(cn=>!cn.isBonusPackage)[0])==null?void 0:tn._id}else{if(console.error("Failed to load signature packages:",en.reason),!y){Ot.error(q("errorLoadingSignaturePackages")||"Failed to load signature packages");return}k=[]}EA()}catch(nn){console.error("Unexpected error during data loading:",nn),Ot.error(q("errorLoadingData")||"Failed to load data",{autoClose:5e3,closeButton:!0,icon:!0})}})}function EA(){bt(),hA(),y||pA(),dt(),it(),Vn()}function aA(F,tn,nn){const hn=Object.values(I).find(cn=>cn.bank===u&&cn.appliedPackages.includes(F)),un=d.includes(F)||hn&&!hn.isHidden&&!(hn.expiredAt<new Date().toISOString())&&hn.limit!==hn.used,en=Object.values(I).find(cn=>cn.bank===u&&cn.appliedPackages.includes(tn)),gn=d.includes(tn)||en&&!en.isHidden&&!(en.expiredAt<new Date().toISOString())&&en.limit!==en.used&&en.isActive;if(un&&!gn){const{container:cn,open:In}=xt({message:q("errorDiscountPackage"),description:q("errorDiscountPackageDes"),okLabel:q("ok"),cancelLabel:q("cancel"),onClose:nn,isWarning:!0,isSuccess:!1,theme:u});sn.appendChild(cn),In()}else nn()}let pt=null;function hA(){if(ht.innerHTML="",Ct().length>0)pt=Mh({type:"service",packageOptions:Ct(),disCountedPackages:d,promotion:q("discount"),selectedPackageId:T,isRenew:y,handlePackageSelect:F=>{var hn,un;let tn=(hn=vn().find(en=>en._id===T))==null?void 0:hn.code,nn=(un=vn().find(en=>en._id===F))==null?void 0:un.code;aA(tn,nn,()=>{if(T=F,Q&&Jn){const en=Jn.getValue();L[en]=F}pt.setSelectedPackageId(F),bt(),dt(),it(),Vn()})}}),ht.appendChild(pt.container);else{const F=document.createElement("span");F.className="wgt:text-text-sub-600",F.innerText=q("noPackageFound"),ht.appendChild(F),pt=null}}let Pt=null;function pA(){if(!y&&tt)if(tt.innerHTML="",k.length>0)Pt=Mh({type:"signature",packageOptions:k.filter(F=>!F.isBonusPackage),disCountedPackages:d,promotion:q("gift"),selectedPackageId:N,allowDeselect:y,handlePackageSelect:F=>{var hn,un;let tn=(hn=k.find(en=>en._id===N))==null?void 0:hn.code,nn=(un=k.find(en=>en._id===F))==null?void 0:un.code;if(y&&N===F){N=null,Pt.setSelectedPackageId(null),bt(),dt(),it(),Vn();return}aA(tn,nn,()=>{N=F,Pt.setSelectedPackageId(F),Mt(vn()),bt(),dt(),it(),Vn()})}}),tt.appendChild(Pt.container);else{const F=document.createElement("span");F.className="wgt:text-text-sub-600",F.innerText=q("noPackageFound"),tt.appendChild(F),Pt=null}}const jt=document.createElement("div");jt.className="wgt:w-full",dn.appendChild(jt);function dt(){ct.remove(),jt.innerHTML="";const F=vn().find(tn=>tn._id===T);if(P.length>0){const{container:tn}=z1({name:"registrationFee",value:"standard",feeLabel:`${q("registrationFee")}: ${On(P[0].price)} VND`,required:!0,description:P[0][JA(Ut())],isChecked:!y&&!(F!=null&&F.withoutInitialFee)});jt.appendChild(tn)}}const rt=document.createElement("div");rt.className="promotion-wrapper wgt:w-full wgt:flex wgt:flex-col wgt:gap-4";function bt(){const F=vn().find(un=>un._id===T),tn=k.find(un=>un._id===N),nn=!y&&(P==null?void 0:P.length)>0&&!(F!=null&&F.withoutInitialFee),hn=[];F!=null&&F.code&&hn.push(F.code),tn!=null&&tn.code&&hn.push(tn.code),nn&&hn.push("INITIAL_FEE"),Object.keys(I).forEach(un=>{var Gn;const en=I[un];if(en.bank!==u){en.isHidden=!0,B=B.filter(Hn=>Hn!==en.code);return}const gn=en.expiredAt<new Date().toISOString(),cn=en.limit<=en.used,In=!en.isActive,Sn=((Gn=en.appliedPackages)==null?void 0:Gn.some(Hn=>hn.includes(Hn)))&&!gn&&!cn&&!In;en.isHidden=!Sn,Sn?B.includes(en.code)||B.push(en.code):B=B.filter(Hn=>Hn!==en.code)}),cA()}function cA(){d=[...new Set(Object.values(I).filter(F=>F.bank===u).flatMap(F=>F.appliedPackages.filter(tn=>tn!=="INITIAL_FEE")))]}function it(){if(Object.values(I).filter(cn=>cn.bank===u).length===0){dn.contains(rt)&&dn.removeChild(rt);return}rt.innerHTML="";const tn=document.createElement("h3");tn.className="wgt:text-xl wgt:font-bold wgt:text-strong-950",tn.innerText=q("applyPromotion"),rt.appendChild(tn),dn.appendChild(rt);const nn=document.createElement("div");nn.className="wgt:w-full wgt:flex wgt:items-center wgt:gap-2 wgt:@max-2xl:flex-col wgt:@max-2xl:items-start";const hn=document.createElement("div");hn.className="wgt:flex wgt:min-w-[500px] wgt:h-11 wgt:items-center wgt:gap-3 wgt:px-3 wgt:py-2 wgt:rounded-lg wgt:bg-white wgt:border wgt:border-[#E4E7EC] wgt:@max-2xl:min-w-full wgt:@max-2xl:flex-wrap wgt:@max-2xl:h-fit",nn.appendChild(hn),B&&B.length>0&&B.filter(In=>{const Tn=Object.values(I).find(Sn=>Sn.code===In);return Tn&&Tn.bank===u}).forEach(In=>{const Tn=document.createElement("div");Tn.className="wgt:flex wgt:w-fit wgt:h-fit wgt:items-center wgt:gap-2 wgt:px-2 wgt:py-1.5 wgt:rounded-md wgt:bg-primary/10 wgt:border wgt:border-primary wgt:text-sm wgt:font-medium wgt:text-primary",Tn.innerText=In;const Sn=Et({type:"button",title:"x",handleClick:()=>{B=B.filter(Gn=>Gn!==In),it(),Vn()}});Sn.className="wgt:w-fit wgt:h-fit wgt:p-0 wgt:bg-transparent wgt:cursor-pointer",Sn.innerHTML=`<svg width="8" height="8" viewBox="0 0 8 8" fill="none" xmlns="http://www.w3.org/2000/svg">
174
174
  <path d="M1.17157 1.17163L6.82842 6.82848" stroke="#0E121B" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
175
175
  <path d="M1.17158 6.82849L6.82843 1.17163" stroke="#0E121B" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
176
176
  </svg>
@@ -470,7 +470,7 @@ Minimum version required to store current data is: `+z+`.
470
470
  font-weight: 500;
471
471
  background-color: white;
472
472
  transition: background-color 0.2s ease, color 0.2s ease;
473
- `,w.addEventListener("mouseenter",()=>{w.style.backgroundColor=`${r}10`}),w.addEventListener("mouseleave",()=>{w.style.backgroundColor="white"}),w.addEventListener("focus",()=>w.style.outline="none"),x.appendChild(w);let y=!1,X=!1;const f=T=>{T.target===l&&!e&&L(!1)},Q=T=>{T.key==="Escape"&&!e&&L(!1)};function M(){l.addEventListener("click",f),window.addEventListener("keydown",Q),p.addEventListener("click",()=>L(!0)),w.addEventListener("click",()=>L(!1))}function S(){l.removeEventListener("click",f),window.removeEventListener("keydown",Q)}function z(){y||(y=!0,document.body.appendChild(l),l.style.display="flex",setTimeout(()=>p.focus(),0),M())}function L(T=!1){if(!(!y||X)){X=!0,y=!1,S();try{l.remove()}catch(N){}T?a?window.location.href=a:typeof t=="function"&&t():!T&&typeof n=="function"&&n()}}return{container:l,open:z,close:L}}function Dr(t,n){return _(this,null,function*(){const[A,e]=yield Promise.all([Ie(t,n,"HDTT"),Ie(t,n,"HDMTT")]);return{isNewCustomer:!!(A!=null&&A.isNewCustomer&&(e!=null&&e.isNewCustomer)),details:{HDTT:!!(A!=null&&A.isNewCustomer),HDMTT:!!(e!=null&&e.isNewCustomer)}}})}function J0(t,n,A,e=!1,a="ocb",h="",c=null){return _(this,null,function*(){var i,o;try{if(a!=="bvb"){A(!0,null);return}let s=null;if(!c)s=yield Dr(t,n);else{const u=yield Ie(t,n,c);s={isNewCustomer:!!(u!=null&&u.isNewCustomer),details:{[c]:!!(u!=null&&u.isNewCustomer)}}}let r=null;if(e){r=yield Ee(t,n),A(s.isNewCustomer,r);return}if(!s.isNewCustomer){r=yield Ee(t,n),yield A(s.isNewCustomer,r),yield new Promise(l=>setTimeout(l,1e3)),(((i=r==null?void 0:r.organization)==null?void 0:i.name)||((o=r==null?void 0:r.organization)==null?void 0:o.taxCode))&&Kr({settingUrl:h,onCancel:()=>{},onConfirm:()=>_(null,null,function*(){const g=yield Ee(t,n);A(!1,g)}),showCloseButton:!0,preventClose:!1}).open();return}A(!0,null)}catch(s){console.error("Error checking new customer:",s),A(!0,null)}})}function Or(t,n,A,e,a,h){return _(this,null,function*(){var b,D;const i=[{name:"M-Invoice",route:"m-invoice",logoUrl:pa},{name:"Misa",route:"misa",logoUrl:Ea},{name:"FPT",route:"fpt",logoUrl:wa},{name:"Viettel",route:"viettel",logoUrl:Ba}].filter(K=>K.route==="m-invoice");function o(){return[q("stepInfo"),q("stepPlan"),q("stepPayment")]}let s=Vs({steps:o(),currentStep:1}),{container:r,setStep:u,setContent:l}=s;t.dataset.theme=a||"default",t.classList.add("wgt:mx-auto","wgt:@container"),t.appendChild(r);let g=1,m=i[0],C={_userHasEditedTaxCode:!1,eInvoiceRegistration:{taxAuthorityCode:"",invoiceSymbol:"",previousEInvoiceProvider:"",organization:{name:"",address:"",taxCode:(e==null?void 0:e.taxCode)||"",taxAuthority:""},contactPerson:{name:"",address:"",email:"",phone:""},legalRepresentative:{name:"",dob:"",gender:"",phone:"",idCard:"",passportNumber:"",nationality:"",permanentAddress:""},hasUsedEInvoice:!1,isUsedEInvoiceBefore:!1},bank:a,provider:m.route,logo:null,license:null,idCard:null,idCardBack:null,packages:[],promotionCodes:[]},E=!0,v=null,x=null,p=null,w=null,y=null,X=0,f=0,Q=null,M=null,S=null,z={qtyRegFee:1,qtyInvoicePkg:1,qtySignaturePkg:1};function L(){m=i[0],C={eInvoiceRegistration:{taxAuthorityCode:"",invoiceSymbol:"",previousEInvoiceProvider:"",organization:{name:"",address:"",taxCode:(e==null?void 0:e.taxCode)||"",taxAuthority:""},contactPerson:{name:"",address:"",email:"",phone:""},legalRepresentative:{name:"",dob:"",gender:"",phone:"",idCard:"",passportNumber:"",nationality:"",permanentAddress:""},hasUsedEInvoice:!1,isUsedEInvoiceBefore:!1},bank:a||"ocb",provider:m.route,logo:null,license:null,idCard:null,idCardBack:null,packages:[],promotionCodes:[]},x=null,p=null,w=null,y=null,X=0,S=null,z={qtyRegFee:1,qtyInvoicePkg:1,qtySignaturePkg:1}}function T(K){K||(K={name:"",address:"",taxCode:(e==null?void 0:e.taxCode)||"",taxAuthority:""}),C=wn(Z({},C),{eInvoiceRegistration:{organization:{name:(K==null?void 0:K.name)||"",address:(K==null?void 0:K.address)||"",taxCode:(K==null?void 0:K.taxCode)||"",taxAuthority:(K==null?void 0:K.taxAuthority)||""},contactPerson:{name:"",address:"",email:"",phone:""},legalRepresentative:{name:"",dob:"",gender:"",phone:"",idCard:"",passportNumber:"",nationality:"",permanentAddress:""},hasUsedEInvoice:!1,isUsedEInvoiceBefore:!1,invoiceSymbol:"",previousEInvoiceProvider:""},logo:null,license:null,idCard:null,idCardBack:null,packages:[],promotionCodes:[]})}function N(){L(),g=1,u(g,o()),P(g)}function B(){typeof window!="undefined"&&window.scrollTo({top:0,behavior:"smooth"})}function k(K,U){return _(this,null,function*(){K?C=wn(Z({},C),{eInvoiceRegistration:{organization:Z({},K.organization),contactPerson:h?Z({},K.contactPerson):C.eInvoiceRegistration.contactPerson,legalRepresentative:h?Z({},K.legalRepresentative):C.eInvoiceRegistration.legalRepresentative,hasUsedEInvoice:K.hasUsedEInvoice,invoiceSymbol:K.invoiceSymbol,previousEInvoiceProvider:K.previousEInvoiceProvider}}):U&&T(U),yield P(g)})}function P(K){return _(this,null,function*(){if(K===1){const{container:U}=yield y1({isNewCustomer:v,isRenewal:h,providerProps:{providers:i,selectedRoute:m.route,onProviderChange:Y=>_(null,null,function*(){var $,sn;m=Y,yield J0(Y.route,(sn=($=C==null?void 0:C.eInvoiceRegistration)==null?void 0:$.organization)==null?void 0:sn.taxCode,(V,An)=>{v=V,k(An)},h,a,(e==null?void 0:e.settingUrl)||"")})},formProps:{isNewCustomer:v,isRenewal:h,handleCheckNewCustomer:J0,updateRegistrationData:k,serial:(e==null?void 0:e.serial)||"",onSubmit:Y=>{C.eInvoiceRegistration=Z(Z({},C.eInvoiceRegistration),Y.eInvoiceRegistration),C.logo=Y.logo||null,C.license=Y.license||null,C.idCard=Y.idCard||null,C.idCardBack=Y.idCardBack||null,C.provider=m.route,g=2,u(g,o()),P(g),B()},registrationData:C,theme:a||"default",onShowPolicy:A||(()=>{}),selectedTaxAuthority:Q,setSelectedTaxAuthority:Y=>{Q=Y},dobPicker:S,setDobPicker:Y=>{S=Y}}});l(U)}else if(K===2){et(at.STEP2_VIEWED,{theme:a,isRenewal:h,provider:m==null?void 0:m.route,isNewCustomer:v});const{container:U}=yield j1({onNext:()=>_(null,null,function*(){et(at.STEP2_COMPLETED,{theme:a,provider:m==null?void 0:m.route,totalAmount:X,orderAmount:f,isFreeOrder:X===0}),g=3,u(g,o()),P(g),B()}),onPrev:()=>{g=1,u(g,o()),P(g),B()},setOrderAmount:Y=>{f=Y},setSelectedInitPackage:Y=>{p=Y},setSelectedInvoiceOtp:Y=>{w=Y},setSelectedSignatureOtp:Y=>{y=Y},setOrderId:Y=>{x=Y},setTotalAmount:Y=>{X=Y},setOrderAmount:Y=>{f=Y},setSelectedPromotions:Y=>{M=Y},setPackages:Y=>{C.packages=Y},setPromotionCodes:Y=>{C.promotionCodes=Y},selectedInitPackage:p,selectedInvoiceOtp:w,selectedSignatureOtp:y,selectedPromotions:M,theme:a,selectedProvider:m,registrationData:C,isNewCustomer:v,savedQuantities:z,isRenewal:h,setSavedQuantities:Y=>{z=Y}});l(U)}else if(K===3){const{container:U}=yield yr({onNext:()=>{g=4,u(g,o()),P(g),B()},onPrev:()=>{g=2,u(g,o()),P(g),B()},step:3,checkoutProps:{logos:a==="ocb"?[Hr]:[Mr,rc,Xr,Nr,kr],logosAbove:a==="ocb"?[rc,Sr]:[],illustrationSrc:Lr},theme:a||"ocb",orderInfoProps:{registrationData:C,orderId:x||"",selectedProvider:m||{name:"",logo:""},selectedInvoiceOtp:w||{unitsPerMonth:0},selectedSignatureOtp:y||{durationYears:0},selectedPromotions:M,totalAmountText:X,totalAmountText:f,isRenewal:h,isNewCustomer:v,onCancel:()=>{g=2,u(g,o()),P(g),B()},onResetToStep1:N},setOrderId:Y=>{x=Y}});l(U)}else if(K===4){const{container:U}=vr({orderId:x||"",onPrev:()=>{g=3,u(g,o()),P(g),B()},onReturnHome:()=>{J(),typeof n=="function"&&n()},theme:a||"ocb",settingUrl:(e==null?void 0:e.settingUrl)||"",serial:(e==null?void 0:e.serial)||"1C25TYY",provider:m.route});l(U)}})}const{container:I,open:d}=PA();E&&(l(I),d()),yield J0(m.route,(D=(b=C==null?void 0:C.eInvoiceRegistration)==null?void 0:b.organization)==null?void 0:D.taxCode,(K,U)=>_(null,null,function*(){E=!1,v=K,k(U),s.updateTitle(q(h?"eInvoiceRenewal":"eInvoiceRegister"))}),h,a,(e==null?void 0:e.settingUrl)||"");const H=gc(()=>{J()},{includeHash:!1});function J(){S&&typeof S.destroy=="function"&&S.destroy(),H(),t&&t.parentNode&&(t.innerHTML="")}})}function Vr(t,n,A,e){return _(this,null,function*(){const{container:a,setContent:h}=Jr(),c=A==null?void 0:A.orderId,i=(A==null?void 0:A.callbackUrl)||`${window.location.origin}/dashboard`,{container:o}=yield uc({orderId:c,callbackUrl:i,onCompleteSignature:(...l)=>_(null,null,function*(){e&&(yield e(...l)),u()})});h(o),t.appendChild(a);const{container:s}=yield uc({orderId:c,callbackUrl:i,onCompleteSignature:e});h(s);const r=gc(()=>{u()},{includeHash:!1});function u(){r(),t&&t.parentNode&&(t.innerHTML="")}return{destroy:u}})}const mc=Object.freeze(Object.defineProperty({__proto__:null,EContractWidget:Vr,InvoiceRegisterWidget:Or},Symbol.toStringTag,{value:"Module"}));function zA(t){const n=t.trim();return n?n.length<2||n.length>250?{valid:!1,error:q("length_2_250")}:/[<>:"\/\\|?*@#$%!^]/.test(n)?{valid:!1,error:q("invalid_characters")}:{valid:!0}:{valid:!1,error:q("required_name")}}function Qe(t,n=!1){const A=String(t!=null?t:"").trim();return A?A.length<2||A.length>250?{valid:!1,error:q("length_2_250")}:/[<>:"\\|?*@#$%!^]/.test(A)?{valid:!1,error:q("invalid_characters")}:{valid:!0}:n?{valid:!1,error:q("required_address")}:{valid:!0}}function xe(t){const n=t.trim();return n?n.length<6||n.length>254?{valid:!1,error:q("email_length")}:/[<>:"\/\\|?*#$%!\s]/.test(n)?{valid:!1,error:q("email_invalid_format")}:/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(n)?n.includes("@@")?{valid:!1,error:q("email_invalid_format")}:{valid:!0}:{valid:!1,error:q("email_invalid_format")}:{valid:!1,error:q("required_email")}}function ye(t,n=!1){const A=t.trim();if(!A)return n?{valid:!1,error:q("required_phone")}:{valid:!0};const e=A.replace(/\s/g,"");if(/[<>:"\/\\|?*@#$%!A-Za-z]/.test(e))return{valid:!1,error:q("phone_invalid")};const h=/^0\d{9}$/,c=/^\+84\d{9}$/;return!h.test(e)&&!c.test(e)?{valid:!1,error:q("phone_invalid_format")}:{valid:!0}}function P0(t){const n=t.trim();if(!n)return{valid:!1,error:q("required_tax_code")};const A=n.replace(/\s/g,"");if(/[<>:"\/\\|?*@#$%!A-Za-z\s]/.test(A))return{valid:!1,error:q("tax_code_invalid")};if((A.match(/-/g)||[]).length>1)return{valid:!1,error:q("tax_code_invalid_format")};const h=/^\d{10}$/,c=/^\d{10}-\d{3}$/;return!h.test(A)&&!c.test(A)?{valid:!1,error:q("tax_code_invalid_format")}:{valid:!0}}function Gr({defaultValues:t={},onChange:n}={}){const A={representativeName:t.representativeName||"",buyerAddress:t.buyerAddress||"",email:t.email||"",phone:t.phone||""},e=document.createElement("div");e.className="wgt:space-y-2";function a(){typeof n=="function"&&n(Z({},A))}function h({label:p,required:w,name:y,type:X="text",placeholder:f}){const Q=document.createElement("div");Q.className="";const M=document.createElement("label");M.className="wgt:text-sm wgt:font-medium wgt:text-strong-950",M.htmlFor=y,M.innerHTML=w?`${p} <span class="wgt:text-semantic-error wgt:text-[#ED1C24]">*</span>`:p;const S=document.createElement("input");S.id=y,S.name=y,S.type=X,S.placeholder=f||"",S.className="wgt:w-full wgt:rounded-lg wgt:border wgt:border-[#E4E7EC] wgt:mt-2 wgt:bg-white wgt:px-3 wgt:py-2.5 wgt:text-sm wgt:text-strong-950 focus:wgt:outline-none focus:wgt:border-primary focus:wgt:ring-1 focus:wgt:ring-primary",S.value=A[y]||"";const z=document.createElement("div");return z.className="wgt:text-xs wgt:text-[#ED1C24] wgt:mt-1 wgt:hidden",z.setAttribute("data-error-for",y),S.addEventListener("input",()=>{A[y]=S.value,S.classList.remove("wgt:border-semantic-error","wgt:bg-semantic-error-50"),z.classList.add("wgt:hidden"),a()}),S.addEventListener("blur",()=>{let L;switch(y){case"representativeName":L=zA(S.value);break;case"buyerAddress":L=Qe(S.value);break;case"email":L=xe(S.value);break;case"phone":L=ye(S.value,!1);break;default:return}!L.valid&&L.error&&(S.classList.add("wgt:border-semantic-error","wgt:bg-semantic-error-50"),z.textContent=L.error,z.classList.remove("wgt:hidden"))}),Q.appendChild(M),Q.appendChild(S),Q.appendChild(z),{field:Q,input:S,errorEl:z}}const{field:c,input:i,errorEl:o}=h({label:q("representativeName"),required:!0,name:"representativeName",placeholder:q("representativeName_input")}),{field:s,errorEl:r}=h({label:q("buyerAddress"),required:!1,name:"buyerAddress",placeholder:q("buyerAddress_input")}),{field:u,input:l,errorEl:g}=h({label:q("email"),required:!0,name:"email",type:"email",placeholder:q("email_input")}),{field:m,input:C,errorEl:E}=h({label:q("phone"),required:!1,name:"phone",type:"tel",placeholder:q("phone_input")});e.appendChild(c),e.appendChild(s),e.appendChild(u),e.appendChild(m);function v(){let p=!0;function w(f,Q,M){f.classList.add("wgt:border-semantic-error","wgt:bg-semantic-error-50"),M&&Q&&(Q.textContent=M,Q.classList.remove("wgt:hidden")),p=!1}const y=zA(A.representativeName);if(y.valid||w(i,o,y.error),A.buyerAddress.trim()){const f=Qe(A.buyerAddress);f.valid||w(document.querySelector('input[name="buyerAddress"]'),r,f.error)}const X=xe(A.email);if(X.valid||w(l,g,X.error),A.phone.trim()){const f=ye(A.phone,!1);f.valid||w(C,E,f.error)}return p}function x(){return Z({},A)}return{container:e,getValues:x,validate:v}}function Rr({defaultValues:t={},onChange:n,onFetchByTaxCode:A}={}){const e={noTaxCode:!!t.noTaxCode,taxCode:t.taxCode||"",businessName:t.businessName||"",representativeName:t.representativeName||"",buyerAddress:t.buyerAddress||"",email:t.email||"",phone:t.phone||""},a=document.createElement("div");a.className="wgt:space-y-2";function h(){typeof n=="function"&&n(Z({},e))}function c({label:P,required:I,name:d,type:H="text",placeholder:J}){const b=document.createElement("div");b.className="";const D=document.createElement("label");D.className="wgt:text-sm wgt:font-medium wgt:text-strong-950",D.htmlFor=d,D.innerHTML=I?`${P} <span class="wgt:text-[#ED1C24]">*</span>`:P;const K=document.createElement("input");K.id=d,K.name=d,K.type=H,K.placeholder=J||"",K.className="wgt:w-full wgt:rounded-lg wgt:border wgt:border-[#E4E7EC] wgt:mt-2 wgt:bg-white wgt:px-3 wgt:py-2.5 wgt:text-sm wgt:text-strong-950 focus:wgt:outline-none focus:wgt:border-primary focus:wgt:ring-1 focus:wgt:ring-primary",K.value=e[d]||"";const U=document.createElement("div");return U.className="wgt:text-xs wgt:text-[#ED1C24] wgt:mt-1 wgt:hidden",U.setAttribute("data-error-for",d),K.addEventListener("input",()=>{e[d]=K.value,K.classList.remove("wgt:border-semantic-error","wgt:bg-semantic-error-50"),U.classList.add("wgt:hidden"),h()}),K.addEventListener("blur",()=>{if(!K.value.trim()&&!I)return;let Y;switch(d){case"businesName":case"representativeName":Y=zA(K.value);break;case"buyerAddress":Y=Qe(K.value);break;case"email":Y=xe(K.value);break;case"phone":Y=ye(K.value,!0);break;default:return}!Y.valid&&Y.error&&(K.classList.add("wgt:border-semantic-error","wgt:bg-semantic-error-50"),U.textContent=Y.error,U.classList.remove("wgt:hidden"))}),b.appendChild(D),b.appendChild(K),b.appendChild(U),{field:b,input:K,errorEl:U}}const i=document.createElement("label");i.className="wgt:flex wgt:items-center wgt:gap-2 wgt:font-medium wgt:text-strong-950 wgt:text-sm";const o=document.createElement("input");o.type="checkbox",o.className="wgt:h-4 wgt:w-4 wgt:rounded wgt:border-[#E4E7EC] focus:wgt:outline-none focus:wgt:ring-primary",o.checked=e.noTaxCode;const s=document.createElement("span");s.textContent=q("business_noTaxCode"),s.className="wgt:italic wgt:font-normal wgt:text-[14px] wgt:leading-[20px] wgt:tracking-[0px] wgt:align-middle wgt:text-[#525866]",s.style.fontFamily="Inter, sans-serif",o.addEventListener("change",()=>{e.noTaxCode=o.checked,g.disabled=e.noTaxCode,C.disabled=e.noTaxCode,g.classList.remove("wgt:border-semantic-error","wgt:bg-semantic-error-50"),m.classList.add("wgt:hidden"),h()}),i.appendChild(o),i.appendChild(s);const r=document.createElement("div");r.className="wgt:space-y-2";const u=document.createElement("label");u.className="wgt:text-sm wgt:font-medium wgt:text-strong-950 ",u.innerHTML=q("confirmation_popup_taxCode")+'<span class="wgt:text-[#ED1C24]">*</span>';const l=document.createElement("div");l.className="wgt:flex wgt:gap-2 wgt:mt-2";const g=document.createElement("input");g.type="text",g.name="taxCode",g.placeholder=q("taxCode_input"),g.value=e.taxCode,g.className="wgt:flex-1 wgt:rounded-lg wgt:border wgt:border-[#E4E7EC] wgt:bg-white wgt:px-3 wgt:py-2.5 wgt:text-sm wgt:text-strong-950 focus:wgt:outline-none focus:wgt:border-primary focus:wgt:ring-1 focus:wgt:ring-primary";const m=document.createElement("div");m.className="wgt:text-xs wgt:text-[#ED1C24] wgt:mt-1 wgt:hidden",g.addEventListener("input",()=>{e.taxCode=g.value,g.classList.remove("wgt:border-semantic-error","wgt:bg-semantic-error-50"),m.classList.add("wgt:hidden"),h()}),g.addEventListener("blur",()=>{if(e.noTaxCode||!g.value.trim())return;const P=P0(g.value);P.valid||(g.classList.add("wgt:border-semantic-error","wgt:bg-semantic-error-50"),m.textContent=P.error,m.classList.remove("wgt:hidden"))});const C=Et({type:"button",title:q("fetch_info"),className:"wgt:px-3 wgt:py-2.5 wgt:text-sm wgt:font-semibold wgt:rounded-lg wgt:flex-shrink-0 wgt:text-primary wgt:bg-white wgt:border wgt:border-primary",handleClick:()=>_(null,null,function*(){if(e.noTaxCode||typeof A!="function")return;const P=String(e.taxCode||"").trim();if(!P){g.classList.add("wgt:border-semantic-error","wgt:bg-semantic-error-50"),m.textContent="Vui lòng nhập MST",m.classList.remove("wgt:hidden");return}const I=P0(P);if(!I.valid){g.classList.add("wgt:border-semantic-error","wgt:bg-semantic-error-50"),m.textContent=I.error,m.classList.remove("wgt:hidden");return}try{C.disabled=!0;const d=yield A(P,Z({},e));if(!d||typeof d!="object")return;d.businessName!=null&&(e.businessName=String(d.businessName||""),v.value=e.businessName),d.representativeName!=null&&(e.representativeName=String(d.representativeName||""),w.value=e.representativeName),d.buyerAddress!=null&&(e.buyerAddress=String(d.buyerAddress||""),f.value=e.buyerAddress),h()}catch(d){g.classList.add("wgt:border-semantic-error","wgt:bg-semantic-error-50"),m.textContent="Không tìm thấy thông tin MST",m.classList.remove("wgt:hidden")}finally{C.disabled=e.noTaxCode}})});l.appendChild(g),l.appendChild(C),r.appendChild(u),r.appendChild(l),r.appendChild(m);const{field:E,input:v,errorEl:x}=c({label:q("businessName"),required:!0,name:"businessName",placeholder:q("businessName_input")}),{field:p,input:w,errorEl:y}=c({label:q("representativeName"),required:!0,name:"representativeName",placeholder:q("representativeName_input")}),{field:X,input:f,errorEl:Q}=c({label:q("buyerAddress"),required:!1,name:"buyerAddress",placeholder:q("buyerAddress_input")}),{field:M,input:S,errorEl:z}=c({label:q("email"),required:!0,name:"email",type:"email",placeholder:q("email_input")}),{field:L,input:T,errorEl:N}=c({label:q("phone"),required:!1,name:"phone",type:"tel",placeholder:q("phone_input")});a.appendChild(i),a.appendChild(r),a.appendChild(E),a.appendChild(p),a.appendChild(X),a.appendChild(M),a.appendChild(L),g.disabled=e.noTaxCode,C.disabled=e.noTaxCode;function B(){let P=!0;function I(b,D,K){b.classList.add("wgt:border-semantic-error","wgt:bg-semantic-error-50","wgt:mt-2"),K&&D&&(D.textContent=K,D.classList.remove("wgt:hidden")),P=!1}if(!e.noTaxCode){const b=P0(e.taxCode);b.valid||I(g,m,b.error)}const d=zA(e.businessName);d.valid||I(v,x,d.error);const H=zA(e.representativeName);if(H.valid||I(w,y,H.error),e.buyerAddress.trim()){const b=Qe(e.buyerAddress);b.valid||I(f,Q,b.error)}const J=xe(e.email);if(J.valid||I(S,z,J.error),e.phone.trim()){const b=ye(e.phone,!0);b.valid||I(T,N,b.error)}return P}function k(){return Z({},e)}return{container:a,getValues:k,validate:B}}function Yr({type:t,data:n,orderInfo:A,theme:e,onClose:a,onConfirm:h}){const c=document.createElement("div");c.className="wgt:fixed wgt:inset-0 wgt:flex wgt:items-center wgt:justify-center wgt:z-50 wgt:p-4",c.style.cssText=`
473
+ `,w.addEventListener("mouseenter",()=>{w.style.backgroundColor=`${r}10`}),w.addEventListener("mouseleave",()=>{w.style.backgroundColor="white"}),w.addEventListener("focus",()=>w.style.outline="none"),x.appendChild(w);let y=!1,X=!1;const f=T=>{T.target===l&&!e&&L(!1)},Q=T=>{T.key==="Escape"&&!e&&L(!1)};function M(){l.addEventListener("click",f),window.addEventListener("keydown",Q),p.addEventListener("click",()=>L(!0)),w.addEventListener("click",()=>L(!1))}function S(){l.removeEventListener("click",f),window.removeEventListener("keydown",Q)}function z(){y||(y=!0,document.body.appendChild(l),l.style.display="flex",setTimeout(()=>p.focus(),0),M())}function L(T=!1){if(!(!y||X)){X=!0,y=!1,S();try{l.remove()}catch(N){}T?a?window.location.href=a:typeof t=="function"&&t():!T&&typeof n=="function"&&n()}}return{container:l,open:z,close:L}}function Dr(t,n){return _(this,null,function*(){const[A,e]=yield Promise.all([Ie(t,n,"HDTT"),Ie(t,n,"HDMTT")]);return{isNewCustomer:!!(A!=null&&A.isNewCustomer&&(e!=null&&e.isNewCustomer)),details:{HDTT:!!(A!=null&&A.isNewCustomer),HDMTT:!!(e!=null&&e.isNewCustomer)}}})}function J0(t,n,A,e=!1,a="ocb",h="",c=null){return _(this,null,function*(){var i,o;try{if(a!=="bvb"){A(!0,null);return}let s=null;if(!c)s=yield Dr(t,n);else{const u=yield Ie(t,n,c);s={isNewCustomer:!!(u!=null&&u.isNewCustomer),details:{[c]:!!(u!=null&&u.isNewCustomer)}}}let r=null;if(e){r=yield Ee(t,n),A(s.isNewCustomer,r);return}if(!s.isNewCustomer){r=yield Ee(t,n),yield A(s.isNewCustomer,r),yield new Promise(l=>setTimeout(l,1e3)),(((i=r==null?void 0:r.organization)==null?void 0:i.name)||((o=r==null?void 0:r.organization)==null?void 0:o.taxCode))&&Kr({settingUrl:h,onCancel:()=>{},onConfirm:()=>_(null,null,function*(){const g=yield Ee(t,n);A(!1,g)}),showCloseButton:!0,preventClose:!1}).open();return}A(!0,null)}catch(s){console.error("Error checking new customer:",s),A(!0,null)}})}function Or(t,n,A,e,a,h){return _(this,null,function*(){var b,D;const i=[{name:"M-Invoice",route:"m-invoice",logoUrl:pa},{name:"Misa",route:"misa",logoUrl:Ea},{name:"FPT",route:"fpt",logoUrl:wa},{name:"Viettel",route:"viettel",logoUrl:Ba}].filter(K=>K.route==="m-invoice");function o(){return[q("stepInfo"),q("stepPlan"),q("stepPayment")]}let s=Vs({steps:o(),currentStep:1}),{container:r,setStep:u,setContent:l}=s;t.dataset.theme=a||"default",t.classList.add("wgt:mx-auto","wgt:@container"),t.appendChild(r);let g=1,m=i[0],C={_userHasEditedTaxCode:!1,eInvoiceRegistration:{taxAuthorityCode:"",invoiceSymbol:"",previousEInvoiceProvider:"",organization:{name:"",address:"",taxCode:(e==null?void 0:e.taxCode)||"",taxAuthority:""},contactPerson:{name:"",address:"",email:"",phone:""},legalRepresentative:{name:"",dob:"",gender:"",phone:"",idCard:"",passportNumber:"",nationality:"",permanentAddress:""},hasUsedEInvoice:!1,isUsedEInvoiceBefore:!1},bank:a,provider:m.route,logo:null,license:null,idCard:null,idCardBack:null,packages:[],promotionCodes:[]},E=!0,v=null,x=null,p=null,w=null,y=null,X=0,f=0,Q=null,M=null,S=null,z={qtyRegFee:1,qtyInvoicePkg:1,qtySignaturePkg:1};function L(){m=i[0],C={eInvoiceRegistration:{taxAuthorityCode:"",invoiceSymbol:"",previousEInvoiceProvider:"",organization:{name:"",address:"",taxCode:(e==null?void 0:e.taxCode)||"",taxAuthority:""},contactPerson:{name:"",address:"",email:"",phone:""},legalRepresentative:{name:"",dob:"",gender:"",phone:"",idCard:"",passportNumber:"",nationality:"",permanentAddress:""},hasUsedEInvoice:!1,isUsedEInvoiceBefore:!1},bank:a||"ocb",provider:m.route,logo:null,license:null,idCard:null,idCardBack:null,packages:[],promotionCodes:[]},x=null,p=null,w=null,y=null,X=0,S=null,z={qtyRegFee:1,qtyInvoicePkg:1,qtySignaturePkg:1}}function T(K){K||(K={name:"",address:"",taxCode:(e==null?void 0:e.taxCode)||"",taxAuthority:""}),C=wn(Z({},C),{eInvoiceRegistration:{organization:{name:(K==null?void 0:K.name)||"",address:(K==null?void 0:K.address)||"",taxCode:(K==null?void 0:K.taxCode)||"",taxAuthority:(K==null?void 0:K.taxAuthority)||""},contactPerson:{name:"",address:"",email:"",phone:""},legalRepresentative:{name:"",dob:"",gender:"",phone:"",idCard:"",passportNumber:"",nationality:"",permanentAddress:""},hasUsedEInvoice:!1,isUsedEInvoiceBefore:!1,invoiceSymbol:"",previousEInvoiceProvider:""},logo:null,license:null,idCard:null,idCardBack:null,packages:[],promotionCodes:[]})}function N(){L(),g=1,u(g,o()),P(g)}function B(){typeof window!="undefined"&&window.scrollTo({top:0,behavior:"smooth"})}function k(K,U){return _(this,null,function*(){K?C=wn(Z({},C),{eInvoiceRegistration:{organization:Z({},K.organization),contactPerson:h?Z({},K.contactPerson):C.eInvoiceRegistration.contactPerson,legalRepresentative:h?Z({},K.legalRepresentative):C.eInvoiceRegistration.legalRepresentative,hasUsedEInvoice:K.hasUsedEInvoice,invoiceSymbol:K.invoiceSymbol,previousEInvoiceProvider:K.previousEInvoiceProvider}}):U&&T(U),yield P(g)})}function P(K){return _(this,null,function*(){if(K===1){const{container:U}=yield y1({isNewCustomer:v,isRenewal:h,providerProps:{providers:i,selectedRoute:m.route,onProviderChange:Y=>_(null,null,function*(){var $,sn;m=Y,yield J0(Y.route,(sn=($=C==null?void 0:C.eInvoiceRegistration)==null?void 0:$.organization)==null?void 0:sn.taxCode,(V,An)=>{v=V,k(An)},h,a,(e==null?void 0:e.settingUrl)||"")})},formProps:{isNewCustomer:v,isRenewal:h,handleCheckNewCustomer:J0,updateRegistrationData:k,serial:(e==null?void 0:e.serial)||"",onSubmit:Y=>{C.eInvoiceRegistration=Z(Z({},C.eInvoiceRegistration),Y.eInvoiceRegistration),C.logo=Y.logo||null,C.license=Y.license||null,C.idCard=Y.idCard||null,C.idCardBack=Y.idCardBack||null,C.provider=m.route,g=2,u(g,o()),P(g),B()},registrationData:C,theme:a||"default",onShowPolicy:A||(()=>{}),selectedTaxAuthority:Q,setSelectedTaxAuthority:Y=>{Q=Y},dobPicker:S,setDobPicker:Y=>{S=Y}}});l(U)}else if(K===2){et(at.STEP2_VIEWED,{theme:a,isRenewal:h,provider:m==null?void 0:m.route,isNewCustomer:v});const{container:U}=yield j1({onNext:()=>_(null,null,function*(){et(at.STEP2_COMPLETED,{theme:a,provider:m==null?void 0:m.route,totalAmount:X,orderAmount:f,isFreeOrder:X===0}),g=3,u(g,o()),P(g),B()}),onPrev:()=>{g=1,u(g,o()),P(g),B()},setOrderAmount:Y=>{f=Y},setSelectedInitPackage:Y=>{p=Y},setSelectedInvoiceOtp:Y=>{w=Y},setSelectedSignatureOtp:Y=>{y=Y},setOrderId:Y=>{x=Y},setTotalAmount:Y=>{X=Y},setOrderAmount:Y=>{f=Y},setSelectedPromotions:Y=>{M=Y},setPackages:Y=>{C.packages=Y},setPromotionCodes:Y=>{C.promotionCodes=Y},selectedInitPackage:p,selectedInvoiceOtp:w,selectedSignatureOtp:y,selectedPromotions:M,theme:a,selectedProvider:m,registrationData:C,isNewCustomer:v,savedQuantities:z,isRenewal:h,setSavedQuantities:Y=>{z=Y}});l(U)}else if(K===3){const{container:U}=yield yr({onNext:()=>{g=4,u(g,o()),P(g),B()},onPrev:()=>{g=2,u(g,o()),P(g),B()},step:3,checkoutProps:{logos:a==="ocb"?[Hr]:[Mr,rc,Xr,Nr,kr],logosAbove:a==="ocb"?[rc,Sr]:[],illustrationSrc:Lr},theme:a||"ocb",orderInfoProps:{registrationData:C,orderId:x||"",selectedProvider:m||{name:"",logo:""},selectedInvoiceOtp:w||{unitsPerMonth:0},selectedSignatureOtp:y||{durationYears:0},selectedPromotions:M,totalAmountText:X,totalAmountText:f,isRenewal:h,isNewCustomer:v,onCancel:()=>{g=2,u(g,o()),P(g),B()},onResetToStep1:N},setOrderId:Y=>{x=Y}});l(U)}else if(K===4){const{container:U}=vr({orderId:x||"",onPrev:()=>{g=3,u(g,o()),P(g),B()},onReturnHome:()=>{J(),typeof n=="function"&&n()},theme:a||"ocb",settingUrl:(e==null?void 0:e.settingUrl)||"",serial:(e==null?void 0:e.serial)||"1C26MYY",provider:m.route});l(U)}})}const{container:I,open:d}=PA();E&&(l(I),d()),yield J0(m.route,(D=(b=C==null?void 0:C.eInvoiceRegistration)==null?void 0:b.organization)==null?void 0:D.taxCode,(K,U)=>_(null,null,function*(){E=!1,v=K,k(U),s.updateTitle(q(h?"eInvoiceRenewal":"eInvoiceRegister"))}),h,a,(e==null?void 0:e.settingUrl)||"");const H=gc(()=>{J()},{includeHash:!1});function J(){S&&typeof S.destroy=="function"&&S.destroy(),H(),t&&t.parentNode&&(t.innerHTML="")}})}function Vr(t,n,A,e){return _(this,null,function*(){const{container:a,setContent:h}=Jr(),c=A==null?void 0:A.orderId,i=(A==null?void 0:A.callbackUrl)||`${window.location.origin}/dashboard`,{container:o}=yield uc({orderId:c,callbackUrl:i,onCompleteSignature:(...l)=>_(null,null,function*(){e&&(yield e(...l)),u()})});h(o),t.appendChild(a);const{container:s}=yield uc({orderId:c,callbackUrl:i,onCompleteSignature:e});h(s);const r=gc(()=>{u()},{includeHash:!1});function u(){r(),t&&t.parentNode&&(t.innerHTML="")}return{destroy:u}})}const mc=Object.freeze(Object.defineProperty({__proto__:null,EContractWidget:Vr,InvoiceRegisterWidget:Or},Symbol.toStringTag,{value:"Module"}));function zA(t){const n=t.trim();return n?n.length<2||n.length>250?{valid:!1,error:q("length_2_250")}:/[<>:"\/\\|?*@#$%!^]/.test(n)?{valid:!1,error:q("invalid_characters")}:{valid:!0}:{valid:!1,error:q("required_name")}}function Qe(t,n=!1){const A=String(t!=null?t:"").trim();return A?A.length<2||A.length>250?{valid:!1,error:q("length_2_250")}:/[<>:"\\|?*@#$%!^]/.test(A)?{valid:!1,error:q("invalid_characters")}:{valid:!0}:n?{valid:!1,error:q("required_address")}:{valid:!0}}function xe(t){const n=t.trim();return n?n.length<6||n.length>254?{valid:!1,error:q("email_length")}:/[<>:"\/\\|?*#$%!\s]/.test(n)?{valid:!1,error:q("email_invalid_format")}:/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(n)?n.includes("@@")?{valid:!1,error:q("email_invalid_format")}:{valid:!0}:{valid:!1,error:q("email_invalid_format")}:{valid:!1,error:q("required_email")}}function ye(t,n=!1){const A=t.trim();if(!A)return n?{valid:!1,error:q("required_phone")}:{valid:!0};const e=A.replace(/\s/g,"");if(/[<>:"\/\\|?*@#$%!A-Za-z]/.test(e))return{valid:!1,error:q("phone_invalid")};const h=/^0\d{9}$/,c=/^\+84\d{9}$/;return!h.test(e)&&!c.test(e)?{valid:!1,error:q("phone_invalid_format")}:{valid:!0}}function P0(t){const n=t.trim();if(!n)return{valid:!1,error:q("required_tax_code")};const A=n.replace(/\s/g,"");if(/[<>:"\/\\|?*@#$%!A-Za-z\s]/.test(A))return{valid:!1,error:q("tax_code_invalid")};if((A.match(/-/g)||[]).length>1)return{valid:!1,error:q("tax_code_invalid_format")};const h=/^\d{10}$/,c=/^\d{10}-\d{3}$/;return!h.test(A)&&!c.test(A)?{valid:!1,error:q("tax_code_invalid_format")}:{valid:!0}}function Gr({defaultValues:t={},onChange:n}={}){const A={representativeName:t.representativeName||"",buyerAddress:t.buyerAddress||"",email:t.email||"",phone:t.phone||""},e=document.createElement("div");e.className="wgt:space-y-2";function a(){typeof n=="function"&&n(Z({},A))}function h({label:p,required:w,name:y,type:X="text",placeholder:f}){const Q=document.createElement("div");Q.className="";const M=document.createElement("label");M.className="wgt:text-sm wgt:font-medium wgt:text-strong-950",M.htmlFor=y,M.innerHTML=w?`${p} <span class="wgt:text-semantic-error wgt:text-[#ED1C24]">*</span>`:p;const S=document.createElement("input");S.id=y,S.name=y,S.type=X,S.placeholder=f||"",S.className="wgt:w-full wgt:rounded-lg wgt:border wgt:border-[#E4E7EC] wgt:mt-2 wgt:bg-white wgt:px-3 wgt:py-2.5 wgt:text-sm wgt:text-strong-950 focus:wgt:outline-none focus:wgt:border-primary focus:wgt:ring-1 focus:wgt:ring-primary",S.value=A[y]||"";const z=document.createElement("div");return z.className="wgt:text-xs wgt:text-[#ED1C24] wgt:mt-1 wgt:hidden",z.setAttribute("data-error-for",y),S.addEventListener("input",()=>{A[y]=S.value,S.classList.remove("wgt:border-semantic-error","wgt:bg-semantic-error-50"),z.classList.add("wgt:hidden"),a()}),S.addEventListener("blur",()=>{let L;switch(y){case"representativeName":L=zA(S.value);break;case"buyerAddress":L=Qe(S.value);break;case"email":L=xe(S.value);break;case"phone":L=ye(S.value,!1);break;default:return}!L.valid&&L.error&&(S.classList.add("wgt:border-semantic-error","wgt:bg-semantic-error-50"),z.textContent=L.error,z.classList.remove("wgt:hidden"))}),Q.appendChild(M),Q.appendChild(S),Q.appendChild(z),{field:Q,input:S,errorEl:z}}const{field:c,input:i,errorEl:o}=h({label:q("representativeName"),required:!0,name:"representativeName",placeholder:q("representativeName_input")}),{field:s,errorEl:r}=h({label:q("buyerAddress"),required:!1,name:"buyerAddress",placeholder:q("buyerAddress_input")}),{field:u,input:l,errorEl:g}=h({label:q("email"),required:!0,name:"email",type:"email",placeholder:q("email_input")}),{field:m,input:C,errorEl:E}=h({label:q("phone"),required:!1,name:"phone",type:"tel",placeholder:q("phone_input")});e.appendChild(c),e.appendChild(s),e.appendChild(u),e.appendChild(m);function v(){let p=!0;function w(f,Q,M){f.classList.add("wgt:border-semantic-error","wgt:bg-semantic-error-50"),M&&Q&&(Q.textContent=M,Q.classList.remove("wgt:hidden")),p=!1}const y=zA(A.representativeName);if(y.valid||w(i,o,y.error),A.buyerAddress.trim()){const f=Qe(A.buyerAddress);f.valid||w(document.querySelector('input[name="buyerAddress"]'),r,f.error)}const X=xe(A.email);if(X.valid||w(l,g,X.error),A.phone.trim()){const f=ye(A.phone,!1);f.valid||w(C,E,f.error)}return p}function x(){return Z({},A)}return{container:e,getValues:x,validate:v}}function Rr({defaultValues:t={},onChange:n,onFetchByTaxCode:A}={}){const e={noTaxCode:!!t.noTaxCode,taxCode:t.taxCode||"",businessName:t.businessName||"",representativeName:t.representativeName||"",buyerAddress:t.buyerAddress||"",email:t.email||"",phone:t.phone||""},a=document.createElement("div");a.className="wgt:space-y-2";function h(){typeof n=="function"&&n(Z({},e))}function c({label:P,required:I,name:d,type:H="text",placeholder:J}){const b=document.createElement("div");b.className="";const D=document.createElement("label");D.className="wgt:text-sm wgt:font-medium wgt:text-strong-950",D.htmlFor=d,D.innerHTML=I?`${P} <span class="wgt:text-[#ED1C24]">*</span>`:P;const K=document.createElement("input");K.id=d,K.name=d,K.type=H,K.placeholder=J||"",K.className="wgt:w-full wgt:rounded-lg wgt:border wgt:border-[#E4E7EC] wgt:mt-2 wgt:bg-white wgt:px-3 wgt:py-2.5 wgt:text-sm wgt:text-strong-950 focus:wgt:outline-none focus:wgt:border-primary focus:wgt:ring-1 focus:wgt:ring-primary",K.value=e[d]||"";const U=document.createElement("div");return U.className="wgt:text-xs wgt:text-[#ED1C24] wgt:mt-1 wgt:hidden",U.setAttribute("data-error-for",d),K.addEventListener("input",()=>{e[d]=K.value,K.classList.remove("wgt:border-semantic-error","wgt:bg-semantic-error-50"),U.classList.add("wgt:hidden"),h()}),K.addEventListener("blur",()=>{if(!K.value.trim()&&!I)return;let Y;switch(d){case"businesName":case"representativeName":Y=zA(K.value);break;case"buyerAddress":Y=Qe(K.value);break;case"email":Y=xe(K.value);break;case"phone":Y=ye(K.value,!0);break;default:return}!Y.valid&&Y.error&&(K.classList.add("wgt:border-semantic-error","wgt:bg-semantic-error-50"),U.textContent=Y.error,U.classList.remove("wgt:hidden"))}),b.appendChild(D),b.appendChild(K),b.appendChild(U),{field:b,input:K,errorEl:U}}const i=document.createElement("label");i.className="wgt:flex wgt:items-center wgt:gap-2 wgt:font-medium wgt:text-strong-950 wgt:text-sm";const o=document.createElement("input");o.type="checkbox",o.className="wgt:h-4 wgt:w-4 wgt:rounded wgt:border-[#E4E7EC] focus:wgt:outline-none focus:wgt:ring-primary",o.checked=e.noTaxCode;const s=document.createElement("span");s.textContent=q("business_noTaxCode"),s.className="wgt:italic wgt:font-normal wgt:text-[14px] wgt:leading-[20px] wgt:tracking-[0px] wgt:align-middle wgt:text-[#525866]",s.style.fontFamily="Inter, sans-serif",o.addEventListener("change",()=>{e.noTaxCode=o.checked,g.disabled=e.noTaxCode,C.disabled=e.noTaxCode,g.classList.remove("wgt:border-semantic-error","wgt:bg-semantic-error-50"),m.classList.add("wgt:hidden"),h()}),i.appendChild(o),i.appendChild(s);const r=document.createElement("div");r.className="wgt:space-y-2";const u=document.createElement("label");u.className="wgt:text-sm wgt:font-medium wgt:text-strong-950 ",u.innerHTML=q("confirmation_popup_taxCode")+'<span class="wgt:text-[#ED1C24]">*</span>';const l=document.createElement("div");l.className="wgt:flex wgt:gap-2 wgt:mt-2";const g=document.createElement("input");g.type="text",g.name="taxCode",g.placeholder=q("taxCode_input"),g.value=e.taxCode,g.className="wgt:flex-1 wgt:rounded-lg wgt:border wgt:border-[#E4E7EC] wgt:bg-white wgt:px-3 wgt:py-2.5 wgt:text-sm wgt:text-strong-950 focus:wgt:outline-none focus:wgt:border-primary focus:wgt:ring-1 focus:wgt:ring-primary";const m=document.createElement("div");m.className="wgt:text-xs wgt:text-[#ED1C24] wgt:mt-1 wgt:hidden",g.addEventListener("input",()=>{e.taxCode=g.value,g.classList.remove("wgt:border-semantic-error","wgt:bg-semantic-error-50"),m.classList.add("wgt:hidden"),h()}),g.addEventListener("blur",()=>{if(e.noTaxCode||!g.value.trim())return;const P=P0(g.value);P.valid||(g.classList.add("wgt:border-semantic-error","wgt:bg-semantic-error-50"),m.textContent=P.error,m.classList.remove("wgt:hidden"))});const C=Et({type:"button",title:q("fetch_info"),className:"wgt:px-3 wgt:py-2.5 wgt:text-sm wgt:font-semibold wgt:rounded-lg wgt:flex-shrink-0 wgt:text-primary wgt:bg-white wgt:border wgt:border-primary",handleClick:()=>_(null,null,function*(){if(e.noTaxCode||typeof A!="function")return;const P=String(e.taxCode||"").trim();if(!P){g.classList.add("wgt:border-semantic-error","wgt:bg-semantic-error-50"),m.textContent="Vui lòng nhập MST",m.classList.remove("wgt:hidden");return}const I=P0(P);if(!I.valid){g.classList.add("wgt:border-semantic-error","wgt:bg-semantic-error-50"),m.textContent=I.error,m.classList.remove("wgt:hidden");return}try{C.disabled=!0;const d=yield A(P,Z({},e));if(!d||typeof d!="object")return;d.businessName!=null&&(e.businessName=String(d.businessName||""),v.value=e.businessName),d.representativeName!=null&&(e.representativeName=String(d.representativeName||""),w.value=e.representativeName),d.buyerAddress!=null&&(e.buyerAddress=String(d.buyerAddress||""),f.value=e.buyerAddress),h()}catch(d){g.classList.add("wgt:border-semantic-error","wgt:bg-semantic-error-50"),m.textContent="Không tìm thấy thông tin MST",m.classList.remove("wgt:hidden")}finally{C.disabled=e.noTaxCode}})});l.appendChild(g),l.appendChild(C),r.appendChild(u),r.appendChild(l),r.appendChild(m);const{field:E,input:v,errorEl:x}=c({label:q("businessName"),required:!0,name:"businessName",placeholder:q("businessName_input")}),{field:p,input:w,errorEl:y}=c({label:q("representativeName"),required:!0,name:"representativeName",placeholder:q("representativeName_input")}),{field:X,input:f,errorEl:Q}=c({label:q("buyerAddress"),required:!1,name:"buyerAddress",placeholder:q("buyerAddress_input")}),{field:M,input:S,errorEl:z}=c({label:q("email"),required:!0,name:"email",type:"email",placeholder:q("email_input")}),{field:L,input:T,errorEl:N}=c({label:q("phone"),required:!1,name:"phone",type:"tel",placeholder:q("phone_input")});a.appendChild(i),a.appendChild(r),a.appendChild(E),a.appendChild(p),a.appendChild(X),a.appendChild(M),a.appendChild(L),g.disabled=e.noTaxCode,C.disabled=e.noTaxCode;function B(){let P=!0;function I(b,D,K){b.classList.add("wgt:border-semantic-error","wgt:bg-semantic-error-50","wgt:mt-2"),K&&D&&(D.textContent=K,D.classList.remove("wgt:hidden")),P=!1}if(!e.noTaxCode){const b=P0(e.taxCode);b.valid||I(g,m,b.error)}const d=zA(e.businessName);d.valid||I(v,x,d.error);const H=zA(e.representativeName);if(H.valid||I(w,y,H.error),e.buyerAddress.trim()){const b=Qe(e.buyerAddress);b.valid||I(f,Q,b.error)}const J=xe(e.email);if(J.valid||I(S,z,J.error),e.phone.trim()){const b=ye(e.phone,!0);b.valid||I(T,N,b.error)}return P}function k(){return Z({},e)}return{container:a,getValues:k,validate:B}}function Yr({type:t,data:n,orderInfo:A,theme:e,onClose:a,onConfirm:h}){const c=document.createElement("div");c.className="wgt:fixed wgt:inset-0 wgt:flex wgt:items-center wgt:justify-center wgt:z-50 wgt:p-4",c.style.cssText=`
474
474
  background-color: rgba(0, 0, 0, 0.5);
475
475
  backdrop-filter: blur(4px);
476
476
  `,e&&c.setAttribute("data-theme",e);const i=document.createElement("div");i.className="wgt:w-full wgt:max-w-md wgt:bg-white wgt:rounded-2xl wgt:shadow-xl wgt:max-h-[90vh] wgt:overflow-y-auto";const o=document.createElement("div");o.className="wgt:px-6 wgt:pt-6 wgt:pb-4 wgt:space-y-2";const s=document.createElement("h3");s.className="wgt:text-xl wgt:font-semibold wgt:text-center wgt:text-strong-950",s.textContent=q("confirmation_popup_title");const r=document.createElement("p");r.className="wgt:text-sm wgt:text-center wgt:text-[#525866]",r.textContent=q("confirmation_popup_subtitle"),o.appendChild(s),o.appendChild(r),i.appendChild(o);const u=document.createElement("div");u.className="wgt:px-6 wgt:pb-4";const l=document.createElement("div");l.className="wgt:space-y-3 wgt:rounded-xl wgt:bg-weak-50 wgt:px-4 wgt:py-3";function g(f,Q,M){const S=document.createElement("div");S.className="wgt:flex wgt:items-start wgt:gap-3";const z=document.createElement("span");z.className="wgt:text-primary wgt:flex-shrink-0",z.innerHTML=f;const L=document.createElement("div");L.className="wgt:flex wgt:items-start wgt:justify-between wgt:flex-1 wgt:gap-2";const T=document.createElement("span");T.className="wgt:text-sm wgt:text-[#525866] wgt:w-1/3",T.textContent=Q;const N=document.createElement("span");return N.className="wgt:text-sm wgt:font-semibold wgt:text-strong-950 wgt:text-right wgt:w-2/3",N.textContent=M||"-",L.appendChild(T),L.appendChild(N),S.appendChild(z),S.appendChild(L),S}const m='<svg class="wgt:w-4 wgt:h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /></svg>',C='<svg class="wgt:w-4 wgt:h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z" /><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z" /></svg>',E='<svg class="wgt:w-4 wgt:h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>';l.appendChild(g(m,q("confirmation_popup_orderCode"),A==null?void 0:A.billNo)),l.appendChild(g(C,q("confirmation_popup_address"),A==null?void 0:A.merchantAddress)),l.appendChild(g(E,q("confirmation_popup_totalAmount"),On(A==null?void 0:A.amount)+" VND")),u.appendChild(l),i.appendChild(u);const v=document.createElement("div");v.className="wgt:px-6 wgt:pb-6";const x=document.createElement("div");x.className="wgt:space-y-3 wgt:rounded-xl wgt:border wgt:border-[#E1E4EA] wgt:px-4 wgt:py-4";function p(f,Q){const M=document.createElement("div");M.className="wgt:flex wgt:items-start wgt:justify-between wgt:gap-4";const S=document.createElement("span");S.className="wgt:text-sm wgt:text-[#0E121B] wgt:w-1/3",S.textContent=f;const z=document.createElement("span");return z.className="wgt:text-sm wgt:font-semibold wgt:text-strong-950 wgt:text-right wgt:w-2/3",z.textContent=Q||"-",M.appendChild(S),M.appendChild(z),M}t==="business"?(x.appendChild(p(q("confirmation_popup_taxCode"),n.taxCode)),x.appendChild(p(q("businessName"),n.businessName)),x.appendChild(p(q("confirmation_popup_representativeName"),n.representativeName)),x.appendChild(p(q("confirmation_popup_buyerAddress"),n.buyerAddress)),x.appendChild(p(q("confirmation_popup_email"),n.email)),x.appendChild(p(q("confirmation_popup_phone"),n.phone))):(x.appendChild(p(q("confirmation_popup_representativeName"),n.representativeName)),x.appendChild(p(q("confirmation_popup_buyerAddress"),n.buyerAddress)),x.appendChild(p(q("confirmation_popup_email"),n.email))),v.appendChild(x),i.appendChild(v);const w=document.createElement("div");w.className="wgt:px-6 wgt:pb-6 wgt:flex wgt:gap-3";const y=Et({type:"button",title:"Đóng",className:"wgt:flex-1 wgt:py-3 wgt:text-sm wgt:font-semibold wgt:rounded-[8px] wgt:bg-white wgt:text-primary wgt:border wgt:border-primary",handleClick:()=>{typeof a=="function"&&a(),c.remove()}}),X=Et({type:"button",title:"Xác nhận",className:"wgt:flex-1 wgt:py-3 wgt:text-sm wgt:font-semibold wgt:rounded-[8px] wgt:bg-primary wgt:text-white",handleClick:()=>{typeof h=="function"&&h({type:t,data:n}),c.remove()}});return w.appendChild(y),w.appendChild(X),i.appendChild(w),c.appendChild(i),c.addEventListener("click",f=>{f.target===c&&(typeof a=="function"&&a(),c.remove())}),{overlay:c}}function jr({orderInfo:t,onPreview:n,theme:A,onSubmit:e,taxCode:a=""}){const h=document.createElement("div");h.className="wgt:flex wgt:flex-col wgt:items-center wgt:justify-between wgt:h-full wgt:shadow wgt:rounded-xl",A&&h.setAttribute("data-theme",A);const c=document.createElement("div");c.className="wgt:w-full wgt:max-w-md wgt:space-y-4 wgt:rounded-xl wgt:bg-white wgt:p-4",h.appendChild(c);const{container:i,open:o,close:s}=PA();h.style.position=h.style.position||"relative",h.appendChild(i);const r=document.createElement("div");r.className="wgt:space-y-1";const u=document.createElement("h3");u.className="wgt:text-2xl wgt:font-semibold wgt:text-text-black wgt:text-center wgt:justify-center",u.textContent=q("invoiceform_title");const l=document.createElement("p");l.className="wgt:text-sm wgt:text-weak-700 wgt:text-center wgt:justify-center",l.textContent=q("invoiceform_subtitle"),r.appendChild(u),r.appendChild(l),c.appendChild(r);const g=document.createElement("div");g.className="wgt:mt-2 wgt:space-y-3 wgt:rounded-xl wgt:bg-weak-50 wgt:px-6 wgt:py-6";function m(L,T){const N=document.createElement("div");N.className="wgt:flex wgt:items-start";const B=document.createElement("div");B.className="wgt:flex wgt:items-center wgt:gap-2 wgt:w-1/3";const k=document.createElement("span");k.className="wgt:inline-flex wgt:items-center wgt:justify-center wgt:w-4 wgt:h-4 wgt:text-icon-primary";let P="";L===q("orderCode")?P=`
@@ -1,29 +1,29 @@
1
- var n = (e, t, r) => new Promise((i, c) => {
2
- var s = (o) => {
1
+ var n = (e, t, r) => new Promise((o, c) => {
2
+ var s = (i) => {
3
3
  try {
4
- g(r.next(o));
5
- } catch (p) {
6
- c(p);
4
+ g(r.next(i));
5
+ } catch (u) {
6
+ c(u);
7
7
  }
8
- }, d = (o) => {
8
+ }, d = (i) => {
9
9
  try {
10
- g(r.throw(o));
11
- } catch (p) {
12
- c(p);
10
+ g(r.throw(i));
11
+ } catch (u) {
12
+ c(u);
13
13
  }
14
- }, g = (o) => o.done ? i(o.value) : Promise.resolve(o.value).then(s, d);
14
+ }, g = (i) => i.done ? o(i.value) : Promise.resolve(i.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-DenpejIA.js";
18
- function _({
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 p, r as O, O as T } from "./index-Dwm5GXG-.js";
18
+ function k({
19
19
  title: e,
20
20
  isDisabled: t = !1,
21
21
  handleClick: r = null,
22
- type: i = "button",
22
+ type: o = "button",
23
23
  className: c = ""
24
24
  } = {}) {
25
25
  const s = document.createElement("button");
26
- return s.type = i, s.disabled = t, s.className = [
26
+ return s.type = o, s.disabled = t, s.className = [
27
27
  "wgt:bg-primary",
28
28
  "wgt:hover:bg-primary-dark",
29
29
  "wgt:px-6",
@@ -61,7 +61,7 @@ a.interceptors.request.use(
61
61
  }
62
62
  );
63
63
  f(a, {});
64
- function k(e) {
64
+ function x(e) {
65
65
  return n(this, null, function* () {
66
66
  if (!e)
67
67
  throw new Error("Tax code is required to fetch tax information.");
@@ -72,7 +72,7 @@ function k(e) {
72
72
  });
73
73
  });
74
74
  }
75
- function x(e, t, r) {
75
+ function N(e, t, r) {
76
76
  return n(this, null, function* () {
77
77
  if (!t)
78
78
  throw new Error("Tax code is required to check new customer.");
@@ -95,10 +95,10 @@ function $(e, t) {
95
95
  })).data;
96
96
  });
97
97
  }
98
- const A = (e) => new Intl.NumberFormat("vi-VN").format(e), O = "1.119.0";
98
+ const A = (e) => new Intl.NumberFormat("vi-VN").format(e), S = "1.120.0";
99
99
  function U(r) {
100
100
  return n(this, arguments, function* ({ search: e, bank: t }) {
101
- return (yield a.get(`${u}`, {
101
+ return (yield a.get(`${p}`, {
102
102
  params: {
103
103
  isActive: !0,
104
104
  search: e || null,
@@ -110,7 +110,7 @@ function U(r) {
110
110
  }
111
111
  function M(t) {
112
112
  return n(this, arguments, function* ({ bank: e }) {
113
- return (yield a.get(`${u}`, {
113
+ return (yield a.get(`${p}`, {
114
114
  params: {
115
115
  isActive: !0,
116
116
  type: "initial_fee",
@@ -119,9 +119,9 @@ function M(t) {
119
119
  })).data;
120
120
  });
121
121
  }
122
- function q(i) {
122
+ function q(o) {
123
123
  return n(this, arguments, function* ({ bank: e, hasRenew: t, isCashRegister: r }) {
124
- return (yield a.get(`${u}`, {
124
+ return (yield a.get(`${p}`, {
125
125
  params: {
126
126
  isActive: !0,
127
127
  type: "service",
@@ -133,9 +133,9 @@ function q(i) {
133
133
  })).data;
134
134
  });
135
135
  }
136
- function F(t) {
136
+ function B(t) {
137
137
  return n(this, arguments, function* ({ bank: e }) {
138
- return (yield a.get(`${u}`, {
138
+ return (yield a.get(`${p}`, {
139
139
  params: {
140
140
  isActive: !0,
141
141
  type: "signature",
@@ -145,7 +145,7 @@ function F(t) {
145
145
  })).data;
146
146
  });
147
147
  }
148
- function G(e) {
148
+ function F(e) {
149
149
  return n(this, null, function* () {
150
150
  const t = new FormData();
151
151
  return t.append(
@@ -154,32 +154,34 @@ function G(e) {
154
154
  ), t.append("provider", e.provider), t.append("bank", e.bank), t.append("packages", JSON.stringify(e.packages)), t.append("promotionCodes", JSON.stringify(e.promotionCodes)), t.append("logo", e.logo), t.append(
155
155
  "organizationRegistrationCert",
156
156
  e.organizationRegistrationCert
157
- ), e.legalRepresentativeIdCard.forEach((i) => {
158
- t.append("legalRepresentativeIdCard", i);
157
+ ), e.legalRepresentativeIdCard.forEach((o) => {
158
+ t.append("legalRepresentativeIdCard", o);
159
159
  }), t.append("isRenew", e.isRenew), t.append("isCashRegister", e.isCashRegister), yield a.post(C, t, {
160
160
  headers: {
161
161
  "Content-Type": "multipart/form-data",
162
162
  "X-Invoice-Widget-Mode": h(),
163
- "X-Invoice-Widget-Version": O
163
+ "X-Invoice-Widget-Version": S
164
164
  }
165
165
  });
166
166
  });
167
167
  }
168
- function j(e) {
168
+ function G(e) {
169
169
  return n(this, null, function* () {
170
- return yield a.get(`${b}/${e}/status`);
170
+ return yield a.get(`${T}/${e}/status`);
171
171
  });
172
172
  }
173
- function B() {
174
- return n(this, arguments, function* ({ isRenewable: e } = {}) {
175
- return (yield a.get(I, {
176
- params: e === !0 ? { isRenewable: !0 } : void 0
177
- })).data;
173
+ function j() {
174
+ return n(this, arguments, function* ({ isRenewable: e, serialNumber: t } = {}) {
175
+ const r = {
176
+ isRenewable: !!e,
177
+ serialNumber: (t != null ? t : "").trim()
178
+ };
179
+ return console.log("PROMO params:", r), (yield a.get(I, { params: r })).data;
178
180
  });
179
181
  }
180
182
  function W(e) {
181
183
  return n(this, null, function* () {
182
- return yield a.post(`${T}/${e}`);
184
+ return yield a.post(`${O}/${e}`);
183
185
  });
184
186
  }
185
187
  function D(e) {
@@ -218,20 +220,20 @@ function V() {
218
220
  };
219
221
  }
220
222
  export {
221
- x as a,
222
- k as b,
223
- _ as c,
223
+ N as a,
224
+ x as b,
225
+ k as c,
224
226
  U as d,
225
227
  V as e,
226
228
  A as f,
227
229
  $ as g,
228
- G as h,
229
- B as i,
230
+ F as h,
231
+ j as i,
230
232
  M as j,
231
233
  q as k,
232
- F as l,
234
+ B as l,
233
235
  W as m,
234
- j as n,
236
+ G as n,
235
237
  D as o,
236
238
  L as s
237
239
  };
@@ -35,8 +35,8 @@ var sn = (t, n, e) => new Promise((c, h) => {
35
35
  }, o = (u) => u.done ? c(u.value) : Promise.resolve(u.value).then(a, A);
36
36
  o((e = e.apply(t, n)).next());
37
37
  });
38
- import { t as g, g as _h, a as $h, b as Pt, s as n0, c as Jt, d as Tc, e as xc, f as dc, m as wc, h as pc, i as Cc, v as fc } from "./index-DenpejIA.js";
39
- import { c as vt, a as c0, g as t0, b as Xc, f as Vn, d as Bc, e as e0, h as Nc, i as Ec, j as Hc, k as yc, l as Pc, m as kc, n as vc } from "./loading-CpzNkc72.js";
38
+ import { t as g, g as _h, a as $h, b as Pt, s as n0, c as Jt, d as Tc, e as xc, f as dc, m as wc, h as pc, i as Cc, v as fc } from "./index-Dwm5GXG-.js";
39
+ import { c as vt, a as c0, g as t0, b as Xc, f as Vn, d as Bc, e as e0, h as Nc, i as Ec, j as Hc, k as yc, l as Pc, m as kc, n as vc } from "./loading-CMCk5aav.js";
40
40
  import { g as nc } from "./_commonjsHelpers-bAxELxBV.js";
41
41
  function lh({ steps: t = [], currentStep: n = 1 } = {}) {
42
42
  const e = document.createElement("div");
@@ -939,7 +939,7 @@ const Mc = ({
939
939
  }
940
940
  return [k, B, v, N].forEach(
941
941
  (L) => L.addEventListener("change", H)
942
- ), m.addEventListener("input", H), m.addEventListener("blur", H), /^[1-9][CK]\d{2}[TDLMNBGHX][A-Z]{2}$/.test(n) ? (k.value = n[0], B.value = n[1], v.value = n.slice(2, 4), N.value = n[4], m.value = n.slice(5, 7)) : (k.value = "1", B.value = "C", N.value = "T", m.value = "YY"), H(), {
942
+ ), m.addEventListener("input", H), m.addEventListener("blur", H), /^[1-9][CK]\d{2}[TDLMNBGHX][A-Z]{2}$/.test(n) ? (k.value = n[0], B.value = n[1], v.value = n.slice(2, 4), N.value = n[4], m.value = n.slice(5, 7)) : (k.value = "1", B.value = "C", N.value = "M", m.value = "YY"), H(), {
943
943
  container: i,
944
944
  getValue: P,
945
945
  setValue: (L) => {
@@ -3425,7 +3425,9 @@ function E1(B) {
3425
3425
  isRenewal: E
3426
3426
  }) {
3427
3427
  var Vt;
3428
- const X = ((Vt = x == null ? void 0 : x.eInvoiceRegistration) == null ? void 0 : Vt.invoiceSymbol) || "", C = (X == null ? void 0 : X[4]) === "M";
3428
+ const X = ((Vt = x == null ? void 0 : x.eInvoiceRegistration) == null ? void 0 : Vt.invoiceSymbol) || "";
3429
+ console.log("Invoice Symbol", X);
3430
+ const C = (X == null ? void 0 : X[4]) === "M";
3429
3431
  let y = [];
3430
3432
  function v(G, U) {
3431
3433
  return Array.isArray(G) ? U === "household" ? G.filter((j) => {
@@ -3657,7 +3659,10 @@ function E1(B) {
3657
3659
  an,
3658
3660
  $
3659
3661
  ] = yield Promise.allSettled([
3660
- Ec({ isRenewable: E === !0 }),
3662
+ Ec({
3663
+ isRenewable: E === !0,
3664
+ serialNumber: X
3665
+ }),
3661
3666
  Hc({ bank: r }),
3662
3667
  yc({
3663
3668
  bank: r,
@@ -7302,7 +7307,7 @@ function Na(t, n, e, c, h, a) {
7302
7307
  },
7303
7308
  theme: h || "ocb",
7304
7309
  settingUrl: (c == null ? void 0 : c.settingUrl) || "",
7305
- serial: (c == null ? void 0 : c.serial) || "1C25TYY",
7310
+ serial: (c == null ? void 0 : c.serial) || "1C26MYY",
7306
7311
  provider: x.route
7307
7312
  });
7308
7313
  s(Z);
package/package.json CHANGED
@@ -46,7 +46,7 @@
46
46
  "prepare": "npm run build"
47
47
  },
48
48
  "type": "module",
49
- "version": "1.119.0",
49
+ "version": "1.120.0",
50
50
  "repository": {},
51
51
  "dependencies": {
52
52
  "@invoice-sdk/id_extraction_qr": "^1.8.3",