@invoice-sdk/widget 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -543,7 +543,7 @@ function W({ onSubmit: R, registrationData: A }) {
543
543
  error: null,
544
544
  placeholder: "",
545
545
  type: "text",
546
- value: (A == null ? void 0 : A.taxCode) ?? ""
546
+ value: (A == null ? void 0 : A.taxCode) || ""
547
547
  });
548
548
  E.appendChild(f.container);
549
549
  const B = j({
@@ -553,7 +553,7 @@ function W({ onSubmit: R, registrationData: A }) {
553
553
  error: null,
554
554
  placeholder: "",
555
555
  type: "text",
556
- value: (A == null ? void 0 : A.representative) ?? ""
556
+ value: (A == null ? void 0 : A.representative) || ""
557
557
  });
558
558
  E.appendChild(B.container);
559
559
  const v = j({
@@ -563,7 +563,7 @@ function W({ onSubmit: R, registrationData: A }) {
563
563
  error: null,
564
564
  placeholder: "",
565
565
  type: "email",
566
- value: (A == null ? void 0 : A.email) ?? ""
566
+ value: (A == null ? void 0 : A.email) || ""
567
567
  });
568
568
  E.appendChild(v.container);
569
569
  const C = j({
@@ -573,13 +573,13 @@ function W({ onSubmit: R, registrationData: A }) {
573
573
  error: null,
574
574
  placeholder: "",
575
575
  type: "tel",
576
- value: (A == null ? void 0 : A.phone) ?? ""
576
+ value: (A == null ? void 0 : A.phone) || ""
577
577
  });
578
578
  E.appendChild(C.container);
579
579
  const Q = Z({
580
580
  label: "Giấy phép đăng ký kinh doanh",
581
581
  required: !0,
582
- file: (A == null ? void 0 : A.license) ?? null,
582
+ file: (A == null ? void 0 : A.license) || null,
583
583
  onFileChange: (r) => {
584
584
  },
585
585
  error: null
@@ -592,7 +592,7 @@ function W({ onSubmit: R, registrationData: A }) {
592
592
  error: null,
593
593
  placeholder: "",
594
594
  type: "text",
595
- value: (A == null ? void 0 : A.companyName) ?? ""
595
+ value: (A == null ? void 0 : A.companyName) || ""
596
596
  });
597
597
  g.appendChild(P.container);
598
598
  const D = j({
@@ -602,7 +602,7 @@ function W({ onSubmit: R, registrationData: A }) {
602
602
  error: null,
603
603
  placeholder: "",
604
604
  type: "text",
605
- value: (A == null ? void 0 : A.position) ?? ""
605
+ value: (A == null ? void 0 : A.position) || ""
606
606
  });
607
607
  g.appendChild(D.container);
608
608
  const M = document.createElement("div");
@@ -667,7 +667,7 @@ function W({ onSubmit: R, registrationData: A }) {
667
667
  error: null,
668
668
  placeholder: "",
669
669
  type: "text",
670
- value: ((z = A == null ? void 0 : A.address) == null ? void 0 : z.detail) ?? ""
670
+ value: ((z = A == null ? void 0 : A.address) == null ? void 0 : z.detail) || ""
671
671
  });
672
672
  M.appendChild(J.container);
673
673
  const Y = document.createElement("div");
@@ -878,7 +878,7 @@ function _({
878
878
  f.className = "wgt:w-full wgt:max-w-[1070px] wgt:mx-auto wgt:flex wgt:flex-col wgt:gap-6", g.appendChild(f);
879
879
  const B = document.createElement("div");
880
880
  B.className = "wgt:w-full wgt:px-6 wgt:pb-6 wgt:pt-4 wgt:rounded-3xl wgt:bg-weak-50 wgt:flex wgt:flex-col wgt:gap-6", f.appendChild(B);
881
- let v = "", C = [...E], Q = (w == null ? void 0 : w.id) ?? E[1].id;
881
+ let v = "", C = [...E], Q = (w == null ? void 0 : w.id) || E[1].id;
882
882
  const P = q({
883
883
  value: v,
884
884
  onInputChange: (o) => {
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(b,u){typeof exports=="object"&&typeof module<"u"?u(exports):typeof define=="function"&&define.amd?define(["exports"],u):(b=typeof globalThis<"u"?globalThis:b||self,u(b.InvoiceRegisterWidget={}))})(this,function(b){"use strict";function u({steps:R=[],currentStep:A=1}={}){const I=document.createElement("div");I.className=["wgt:relative","wgt:flex","wgt:bg-weak-50","wgt:rounded-[10px]","wgt:overflow-hidden","wgt:shadow-sm","wgt:justify-between"].join(" ");const w=document.createElement("div");w.className=["wgt:absolute","wgt:inset-0","wgt:h-full","wgt:bg-primary/16","wgt:transition-all","wgt:duration-250"].join(" ");const E=document.createElement("div");E.className="wgt:relative wgt:flex wgt:w-full wgt:z-10";const g=[];R.forEach((B,v)=>{const C=v+1,Q=document.createElement("div");Q.setAttribute("role","listitem"),Q.setAttribute("aria-label",`Step ${C} of ${R.length}: ${B.label}${A===C?" (current)":""}`),Q.className=["wgt:relative","wgt:flex-1","wgt:flex","wgt:items-center","wgt:justify-center","wgt:py-5","wgt:pr-9","wgt:px-4"].join(" ");const P=document.createElement("div");P.className=["wgt:flex","wgt:items-center","wgt:justify-center","wgt:w-8","wgt:h-8","wgt:rounded-full","wgt:flex-shrink-0","wgt:mr-4"].join(" ");const D=document.createElement("span");D.innerText=String(C),D.className="wgt:text-white wgt:font-medium",P.appendChild(D);const M=document.createElement("span");M.innerText=B.label,M.className="wgt:font-medium wgt:whitespace-nowrap",Q.appendChild(P),Q.appendChild(M),E.appendChild(Q),g.push({wrapper:Q,circle:P,textSpan:M})}),I.appendChild(w),I.appendChild(E);function f(B){const v=I.getBoundingClientRect(),C=v.width||0;let Q=0;if(B>0&&B<=g.length){const M=g[B-1].wrapper.getBoundingClientRect(),n=v.left;Q=M.left-n+M.width}const P=C>0?Math.min(Q/C*100,100):0;w.style.width=`${P}%`,g.forEach((D,M)=>{const n=M+1,t=n<B,i=n===B;t||i?(D.textSpan.classList.add("wgt:text-primary-dark"),D.textSpan.classList.remove("wgt:text-soft-400")):(D.textSpan.classList.add("wgt:text-soft-400"),D.textSpan.classList.remove("wgt:text-primary-dark")),t||i?(D.circle.classList.add("wgt:bg-icon-primary"),D.circle.classList.remove("wgt:bg-icon-soft-400")):(D.circle.classList.add("wgt:bg-icon-soft-400"),D.circle.classList.remove("wgt:bg-icon-primary"))})}return setTimeout(()=>f(A),0),{container:I,update(B){f(B)}}}function a({steps:R=[],currentStep:A=1}={}){const I=document.createElement("div");I.className=["wgt:flex","wgt:bg-white","wgt:flex-col","wgt:h-fit","wgt:gap-6","wgt:items-center","wgt:justify-start","wgt:fixed","wgt:w-full","wgt:h-screen","wgt:inset-0","wgt:py-8","wgt:overflow-auto"].join(" ");const w=document.createElement("h1");w.className=["wgt:text-[28px]","wgt:font-bold","wgt:leading-[30px]","wgt:text-strong-950"].join(" "),w.innerText="Đăng ký hóa đơn điện tử";const E=document.createElement("div");E.className=["wgt:w-[1320px]","wgt:flex-1","wgt:mx-auto","wgt:p-6","wgt:flex","wgt:flex-col","wgt:border","wgt:border-[#E1E4EA]","wgt:rounded-3xl","wgt:gap-6","wgt:shadow-[0px_1px_8px_0px_rgba(82,88,102,0.06)]"].join(" ");const g=u({steps:R.map(B=>({label:B})),currentStep:A});E.appendChild(g.container);const f=document.createElement("div");return f.className="wgt:flex-1",E.appendChild(f),I.appendChild(w),I.appendChild(E),{container:I,setStep(B){g.update(B)},setContent(B){f.replaceChildren(B)}}}function m({checked:R=!1,onChange:A}){const I=document.createElement("label");I.className="wgt:relative wgt:inline-flex wgt:cursor-pointer wgt:items-center";const w=document.createElement("input");w.type="checkbox",w.checked=R,w.className="wgt:peer wgt:sr-only",w.addEventListener("change",B=>{const v=B.target.checked;typeof A=="function"&&A(v),w.checked=v,g(v)});const E=document.createElement("div");E.className=["wgt:border-grey-6","wgt:relative","wgt:h-5","wgt:w-5","wgt:rounded-full","wgt:border-2"].join(" ");function g(B){B?(E.classList.add("wgt:border-primary"),f.style.display="block"):(E.classList.remove("wgt:border-primary"),f.style.display="none")}const f=document.createElement("div");return f.className=["wgt:absolute","wgt:left-1/2","wgt:top-1/2","wgt:h-2.5","wgt:w-2.5","wgt:-translate-x-1/2","wgt:-translate-y-1/2","wgt:rounded-full","wgt:bg-primary"].join(" "),f.style.display=R?"block":"none",E.appendChild(f),I.appendChild(w),I.appendChild(E),{container:I,setChecked(B){w.checked=B,g(B),typeof A=="function"&&A(B)}}}function Z({providers:R=[],selectedRoute:A=null,onProviderChange:I}){const w=document.createElement("div");w.className="wgt:w-full wgt:flex wgt:flex-col wgt:gap-4";const E=document.createElement("h2");E.className="heading",E.innerText="Nhà cung cấp",w.appendChild(E);const g=document.createElement("div");g.className="wgt:grid wgt:grid-cols-3 wgt:gap-4",w.appendChild(g);function f(){g.innerHTML="",R.forEach(B=>{const v=B.route===A,C=document.createElement("div");C.dataset.checked=v?"true":"false",C.className=["wgt:flex","wgt:items-center","wgt:justify-between","wgt:gap-2","wgt:p-4","wgt:border","wgt:border-border-light","wgt:rounded-xl","wgt:hover:bg-gray-100","wgt:cursor-pointer","wgt:transition-colors","wgt:duration-200",v?"wgt:border-primary":""].filter(Boolean).join(" "),C.addEventListener("click",()=>{A=B.route,typeof I=="function"&&I(B),f()});const Q=document.createElement("div");Q.className="wgt:flex wgt:items-center wgt:gap-3";const P=document.createElement("img");P.src=B.logoUrl,P.alt=B.name,P.className="wgt:h-8 wgt:object-contain";const D=document.createElement("div");D.className="wgt:w-[1px] wgt:h-8 wgt:bg-border-light";const M=document.createElement("label");M.className="wgt:text-base wgt:font-semibold wgt:leading-5 wgt:text-black wgt:uppercase",M.innerText=B.name,Q.appendChild(P),Q.appendChild(D),Q.appendChild(M);const{container:n}=m({checked:v,onChange:t=>{t&&(A=B.route,typeof I=="function"&&I(B),f())}});C.appendChild(Q),C.appendChild(n),g.appendChild(C)})}return f(),{container:w,setSelectedRoute(B){A=B,f()}}}function j({name:R,value:A="",type:I="text",placeholder:w="",label:E,required:g=!1,error:f=null,onInput:B=null}){const v=document.createElement("div");v.className="wgt:flex wgt:flex-col";const C=document.createElement("label");if(C.htmlFor=R,C.className="wgt:font-medium wgt:mb-2 wgt:text-text-black",C.innerText=E,g){const D=document.createElement("span");D.className="wgt:text-red-500 wgt:ml-1",D.innerText="*",C.appendChild(D)}const Q=document.createElement("input");Q.type=I,Q.name=R,Q.id=R,Q.value=A,Q.placeholder=w,Q.className=["wgt:border","wgt:rounded","wgt:px-3","wgt:py-2","wgt:focus:outline-none","wgt:focus:ring-2","wgt:focus:ring-blue-500",f?"wgt:border-red-500":"wgt:border-gray-300"].join(" "),g&&Q.setAttribute("required","true"),typeof B=="function"&&Q.addEventListener("input",B);const P=document.createElement("span");return P.className="wgt:text-red-500 wgt:text-sm mt-1",P.innerText=f||"",f||(P.style.display="none"),v.appendChild(C),v.appendChild(Q),v.appendChild(P),{container:v,inputEl:Q,setError(D){D?(P.innerText=D,P.style.display="block",Q.classList.remove("wgt:border-gray-300"),Q.classList.add("wgt:border-red-500")):(P.innerText="",P.style.display="none",Q.classList.remove("wgt:border-red-500"),Q.classList.add("wgt:border-gray-300"))},getValue(){return Q.value}}}function K({name:R,value:A="",options:I=[],label:w,disabled:E=!1,error:g=null,onChange:f=null}){const B=document.createElement("div");B.className="wgt:flex wgt:flex-col";const v=document.createElement("label");v.htmlFor=R,v.className="wgt:font-medium wgt:mb-1 wgt:text-gray-700",v.innerText=w;const C=document.createElement("select");C.id=R,C.name=R,C.disabled=E,C.className=["wgt:border","wgt:rounded","wgt:px-3","wgt:py-2","wgt:bg-white","wgt:focus:outline-none","wgt:focus:ring-2","wgt:focus:ring-blue-500",g?"wgt:border-red-500":"wgt:border-gray-300"].join(" ");const Q=document.createElement("option");Q.value="",Q.disabled=!0,Q.selected=A===""||A==null,Q.innerText=`-- Chọn ${w.toLowerCase()} --`,C.appendChild(Q),I.forEach(D=>{const M=document.createElement("option");M.value=D.value,M.innerText=D.label,D.value===A&&(M.selected=!0),C.appendChild(M)}),typeof f=="function"&&C.addEventListener("change",f);const P=document.createElement("span");return P.className="wgt:text-red-500 wgt:text-sm wgt:mt-1",P.innerText=g||"",g||(P.style.display="none"),B.appendChild(C),B.appendChild(P),{container:B,selectEl:C,setError(D){D?(P.innerText=D,P.style.display="block",C.classList.remove("wgt:border-gray-300"),C.classList.add("wgt:border-red-500")):(P.innerText="",P.style.display="none",C.classList.remove("wgt:border-red-500"),C.classList.add("wgt:border-gray-300"))},getValue(){return C.value},setOptions(D){for(;C.options.length>1;)C.remove(1);D.forEach(M=>{const n=document.createElement("option");n.value=M.value,n.innerText=M.label,C.appendChild(n)})},setDisabled(D){C.disabled=!!D}}}function l({label:R,required:A=!1,file:I=null,onFileChange:w,error:E=null}){console.log("🚀 ~ file:",I);const g=document.createElement("form");g.className="wgt:flex wgt:flex-col";const f=document.createElement("label");if(f.htmlFor="upload",f.className="wgt:font-medium wgt:mb-1 wgt:text-gray-700",f.innerText=R,A){const J=document.createElement("span");J.className="wgt:text-red-500 wgt:ml-1",J.innerText="*",f.appendChild(J)}g.appendChild(f);const B=document.createElement("div");B.className=["wgt:h-fit","wgt:py-4","wgt:w-full","wgt:rounded","wgt:overflow-hidden","wgt:flex","wgt:items-center","wgt:cursor-pointer","wgt:justify-center","wgt:border","wgt:border-dashed","wgt:border-grey-6","wgt:flex-col","wgt:gap-2"].join(" ");const v=document.createElement("input");v.id="upload",v.type="file",v.accept="image/*,.pdf",v.className="wgt:hidden",v.addEventListener("change",J=>{const Y=J.target.files&&J.target.files[0]?J.target.files[0]:null;k(Y),I=Y});const C=document.createElement("div");C.className="wgt:w-full wgt:flex wgt:flex-col wgt:gap-2 wgt:items-center wgt:justify-center";const Q=document.createElement("span");Q.className="wgt:text-red-500 wgt:text-sm wgt:mt-1",Q.innerText=E||"",E||(Q.style.display="none");let P=null;function D(){if(!I||P)return;P=document.createElement("div"),P.className=["wgt:fixed","wgt:inset-0","wgt:bg-black","wgt:bg-opacity-75","wgt:z-50","wgt:flex","wgt:items-center","wgt:justify-center"].join(" "),P.addEventListener("click",()=>M());const J=document.createElement("div");J.className="wgt:relative wgt:w-full wgt:h-screen wgt:bg-white wgt:overflow-auto";const Y=document.createElement("button");Y.innerHTML="&times;",Y.className="wgt:absolute wgt:w-8 wgt:h-8 wgt:top-2 wgt:right-2 wgt:text-gray-600 wgt:text-2xl wgt:cursor-pointer wgt:rounded-full wgt:bg-white wgt:shadow",Y.setAttribute("aria-label","Close preview"),Y.addEventListener("click",z=>{z.stopPropagation(),M()}),J.appendChild(Y);const H=document.createElement("div");H.className="wgt:px-10 wgt:w-full wgt:h-full wgt:flex wgt:flex-col wgt:items-center wgt:justify-center";const e=document.createElement("img");e.src=i,e.alt="Full Preview",e.className="wgt:max-h-screen wgt:object-contain",H.appendChild(e),J.appendChild(H),P.appendChild(J),document.body.appendChild(P)}function M(){P&&(document.body.removeChild(P),P=null)}const n=document.createElement("button");n.type="button",n.className="wgt:bg-primary wgt:hover:bg-primary-dark wgt:text-white wgt:px-4 wgt:py-1 wgt:rounded-md wgt:cursor-pointer",n.innerText="Upload file",n.addEventListener("click",J=>{J.stopPropagation(),v.click()});function t(J,Y=2){if(J===0)return"0 Bytes";const H=1024,e=Math.max(0,Y),z=["Bytes","KB","MB","GB","TB"],O=Math.floor(Math.log(J)/Math.log(H));return parseFloat((J/Math.pow(H,O)).toFixed(e))+" "+z[O]}let i=null;function s(J){i&&(URL.revokeObjectURL(i),i=null),J&&(i=URL.createObjectURL(J))}function k(J){if(s(J),C.innerHTML="",J){const Y=document.createElement("div");Y.className="wgt:flex wgt:w-full wgt:items-center wgt:justify-between";const H=document.createElement("div");if(H.className="wgt:flex wgt:space-x-4 wgt:w-full wgt:justify-start wgt:items-center wgt:px-4",H.addEventListener("click",()=>{v.click()}),J.type==="application/pdf"){const F=document.createElement("div");F.className="wgt:flex-shrink-0 wgt:flex wgt:items-center wgt:justify-center wgt:rounded",F.innerHTML=`
1
+ (function(b,u){typeof exports=="object"&&typeof module!="undefined"?u(exports):typeof define=="function"&&define.amd?define(["exports"],u):(b=typeof globalThis!="undefined"?globalThis:b||self,u(b.InvoiceRegisterWidget={}))})(this,function(b){"use strict";function u({steps:R=[],currentStep:A=1}={}){const I=document.createElement("div");I.className=["wgt:relative","wgt:flex","wgt:bg-weak-50","wgt:rounded-[10px]","wgt:overflow-hidden","wgt:shadow-sm","wgt:justify-between"].join(" ");const w=document.createElement("div");w.className=["wgt:absolute","wgt:inset-0","wgt:h-full","wgt:bg-primary/16","wgt:transition-all","wgt:duration-250"].join(" ");const E=document.createElement("div");E.className="wgt:relative wgt:flex wgt:w-full wgt:z-10";const g=[];R.forEach((B,v)=>{const C=v+1,Q=document.createElement("div");Q.setAttribute("role","listitem"),Q.setAttribute("aria-label",`Step ${C} of ${R.length}: ${B.label}${A===C?" (current)":""}`),Q.className=["wgt:relative","wgt:flex-1","wgt:flex","wgt:items-center","wgt:justify-center","wgt:py-5","wgt:pr-9","wgt:px-4"].join(" ");const P=document.createElement("div");P.className=["wgt:flex","wgt:items-center","wgt:justify-center","wgt:w-8","wgt:h-8","wgt:rounded-full","wgt:flex-shrink-0","wgt:mr-4"].join(" ");const D=document.createElement("span");D.innerText=String(C),D.className="wgt:text-white wgt:font-medium",P.appendChild(D);const M=document.createElement("span");M.innerText=B.label,M.className="wgt:font-medium wgt:whitespace-nowrap",Q.appendChild(P),Q.appendChild(M),E.appendChild(Q),g.push({wrapper:Q,circle:P,textSpan:M})}),I.appendChild(w),I.appendChild(E);function f(B){const v=I.getBoundingClientRect(),C=v.width||0;let Q=0;if(B>0&&B<=g.length){const M=g[B-1].wrapper.getBoundingClientRect(),n=v.left;Q=M.left-n+M.width}const P=C>0?Math.min(Q/C*100,100):0;w.style.width=`${P}%`,g.forEach((D,M)=>{const n=M+1,t=n<B,i=n===B;t||i?(D.textSpan.classList.add("wgt:text-primary-dark"),D.textSpan.classList.remove("wgt:text-soft-400")):(D.textSpan.classList.add("wgt:text-soft-400"),D.textSpan.classList.remove("wgt:text-primary-dark")),t||i?(D.circle.classList.add("wgt:bg-icon-primary"),D.circle.classList.remove("wgt:bg-icon-soft-400")):(D.circle.classList.add("wgt:bg-icon-soft-400"),D.circle.classList.remove("wgt:bg-icon-primary"))})}return setTimeout(()=>f(A),0),{container:I,update(B){f(B)}}}function a({steps:R=[],currentStep:A=1}={}){const I=document.createElement("div");I.className=["wgt:flex","wgt:bg-white","wgt:flex-col","wgt:h-fit","wgt:gap-6","wgt:items-center","wgt:justify-start","wgt:fixed","wgt:w-full","wgt:h-screen","wgt:inset-0","wgt:py-8","wgt:overflow-auto"].join(" ");const w=document.createElement("h1");w.className=["wgt:text-[28px]","wgt:font-bold","wgt:leading-[30px]","wgt:text-strong-950"].join(" "),w.innerText="Đăng ký hóa đơn điện tử";const E=document.createElement("div");E.className=["wgt:w-[1320px]","wgt:flex-1","wgt:mx-auto","wgt:p-6","wgt:flex","wgt:flex-col","wgt:border","wgt:border-[#E1E4EA]","wgt:rounded-3xl","wgt:gap-6","wgt:shadow-[0px_1px_8px_0px_rgba(82,88,102,0.06)]"].join(" ");const g=u({steps:R.map(B=>({label:B})),currentStep:A});E.appendChild(g.container);const f=document.createElement("div");return f.className="wgt:flex-1",E.appendChild(f),I.appendChild(w),I.appendChild(E),{container:I,setStep(B){g.update(B)},setContent(B){f.replaceChildren(B)}}}function m({checked:R=!1,onChange:A}){const I=document.createElement("label");I.className="wgt:relative wgt:inline-flex wgt:cursor-pointer wgt:items-center";const w=document.createElement("input");w.type="checkbox",w.checked=R,w.className="wgt:peer wgt:sr-only",w.addEventListener("change",B=>{const v=B.target.checked;typeof A=="function"&&A(v),w.checked=v,g(v)});const E=document.createElement("div");E.className=["wgt:border-grey-6","wgt:relative","wgt:h-5","wgt:w-5","wgt:rounded-full","wgt:border-2"].join(" ");function g(B){B?(E.classList.add("wgt:border-primary"),f.style.display="block"):(E.classList.remove("wgt:border-primary"),f.style.display="none")}const f=document.createElement("div");return f.className=["wgt:absolute","wgt:left-1/2","wgt:top-1/2","wgt:h-2.5","wgt:w-2.5","wgt:-translate-x-1/2","wgt:-translate-y-1/2","wgt:rounded-full","wgt:bg-primary"].join(" "),f.style.display=R?"block":"none",E.appendChild(f),I.appendChild(w),I.appendChild(E),{container:I,setChecked(B){w.checked=B,g(B),typeof A=="function"&&A(B)}}}function Z({providers:R=[],selectedRoute:A=null,onProviderChange:I}){const w=document.createElement("div");w.className="wgt:w-full wgt:flex wgt:flex-col wgt:gap-4";const E=document.createElement("h2");E.className="heading",E.innerText="Nhà cung cấp",w.appendChild(E);const g=document.createElement("div");g.className="wgt:grid wgt:grid-cols-3 wgt:gap-4",w.appendChild(g);function f(){g.innerHTML="",R.forEach(B=>{const v=B.route===A,C=document.createElement("div");C.dataset.checked=v?"true":"false",C.className=["wgt:flex","wgt:items-center","wgt:justify-between","wgt:gap-2","wgt:p-4","wgt:border","wgt:border-border-light","wgt:rounded-xl","wgt:hover:bg-gray-100","wgt:cursor-pointer","wgt:transition-colors","wgt:duration-200",v?"wgt:border-primary":""].filter(Boolean).join(" "),C.addEventListener("click",()=>{A=B.route,typeof I=="function"&&I(B),f()});const Q=document.createElement("div");Q.className="wgt:flex wgt:items-center wgt:gap-3";const P=document.createElement("img");P.src=B.logoUrl,P.alt=B.name,P.className="wgt:h-8 wgt:object-contain";const D=document.createElement("div");D.className="wgt:w-[1px] wgt:h-8 wgt:bg-border-light";const M=document.createElement("label");M.className="wgt:text-base wgt:font-semibold wgt:leading-5 wgt:text-black wgt:uppercase",M.innerText=B.name,Q.appendChild(P),Q.appendChild(D),Q.appendChild(M);const{container:n}=m({checked:v,onChange:t=>{t&&(A=B.route,typeof I=="function"&&I(B),f())}});C.appendChild(Q),C.appendChild(n),g.appendChild(C)})}return f(),{container:w,setSelectedRoute(B){A=B,f()}}}function j({name:R,value:A="",type:I="text",placeholder:w="",label:E,required:g=!1,error:f=null,onInput:B=null}){const v=document.createElement("div");v.className="wgt:flex wgt:flex-col";const C=document.createElement("label");if(C.htmlFor=R,C.className="wgt:font-medium wgt:mb-2 wgt:text-text-black",C.innerText=E,g){const D=document.createElement("span");D.className="wgt:text-red-500 wgt:ml-1",D.innerText="*",C.appendChild(D)}const Q=document.createElement("input");Q.type=I,Q.name=R,Q.id=R,Q.value=A,Q.placeholder=w,Q.className=["wgt:border","wgt:rounded","wgt:px-3","wgt:py-2","wgt:focus:outline-none","wgt:focus:ring-2","wgt:focus:ring-blue-500",f?"wgt:border-red-500":"wgt:border-gray-300"].join(" "),g&&Q.setAttribute("required","true"),typeof B=="function"&&Q.addEventListener("input",B);const P=document.createElement("span");return P.className="wgt:text-red-500 wgt:text-sm mt-1",P.innerText=f||"",f||(P.style.display="none"),v.appendChild(C),v.appendChild(Q),v.appendChild(P),{container:v,inputEl:Q,setError(D){D?(P.innerText=D,P.style.display="block",Q.classList.remove("wgt:border-gray-300"),Q.classList.add("wgt:border-red-500")):(P.innerText="",P.style.display="none",Q.classList.remove("wgt:border-red-500"),Q.classList.add("wgt:border-gray-300"))},getValue(){return Q.value}}}function K({name:R,value:A="",options:I=[],label:w,disabled:E=!1,error:g=null,onChange:f=null}){const B=document.createElement("div");B.className="wgt:flex wgt:flex-col";const v=document.createElement("label");v.htmlFor=R,v.className="wgt:font-medium wgt:mb-1 wgt:text-gray-700",v.innerText=w;const C=document.createElement("select");C.id=R,C.name=R,C.disabled=E,C.className=["wgt:border","wgt:rounded","wgt:px-3","wgt:py-2","wgt:bg-white","wgt:focus:outline-none","wgt:focus:ring-2","wgt:focus:ring-blue-500",g?"wgt:border-red-500":"wgt:border-gray-300"].join(" ");const Q=document.createElement("option");Q.value="",Q.disabled=!0,Q.selected=A===""||A==null,Q.innerText=`-- Chọn ${w.toLowerCase()} --`,C.appendChild(Q),I.forEach(D=>{const M=document.createElement("option");M.value=D.value,M.innerText=D.label,D.value===A&&(M.selected=!0),C.appendChild(M)}),typeof f=="function"&&C.addEventListener("change",f);const P=document.createElement("span");return P.className="wgt:text-red-500 wgt:text-sm wgt:mt-1",P.innerText=g||"",g||(P.style.display="none"),B.appendChild(C),B.appendChild(P),{container:B,selectEl:C,setError(D){D?(P.innerText=D,P.style.display="block",C.classList.remove("wgt:border-gray-300"),C.classList.add("wgt:border-red-500")):(P.innerText="",P.style.display="none",C.classList.remove("wgt:border-red-500"),C.classList.add("wgt:border-gray-300"))},getValue(){return C.value},setOptions(D){for(;C.options.length>1;)C.remove(1);D.forEach(M=>{const n=document.createElement("option");n.value=M.value,n.innerText=M.label,C.appendChild(n)})},setDisabled(D){C.disabled=!!D}}}function l({label:R,required:A=!1,file:I=null,onFileChange:w,error:E=null}){console.log("🚀 ~ file:",I);const g=document.createElement("form");g.className="wgt:flex wgt:flex-col";const f=document.createElement("label");if(f.htmlFor="upload",f.className="wgt:font-medium wgt:mb-1 wgt:text-gray-700",f.innerText=R,A){const J=document.createElement("span");J.className="wgt:text-red-500 wgt:ml-1",J.innerText="*",f.appendChild(J)}g.appendChild(f);const B=document.createElement("div");B.className=["wgt:h-fit","wgt:py-4","wgt:w-full","wgt:rounded","wgt:overflow-hidden","wgt:flex","wgt:items-center","wgt:cursor-pointer","wgt:justify-center","wgt:border","wgt:border-dashed","wgt:border-grey-6","wgt:flex-col","wgt:gap-2"].join(" ");const v=document.createElement("input");v.id="upload",v.type="file",v.accept="image/*,.pdf",v.className="wgt:hidden",v.addEventListener("change",J=>{const Y=J.target.files&&J.target.files[0]?J.target.files[0]:null;k(Y),I=Y});const C=document.createElement("div");C.className="wgt:w-full wgt:flex wgt:flex-col wgt:gap-2 wgt:items-center wgt:justify-center";const Q=document.createElement("span");Q.className="wgt:text-red-500 wgt:text-sm wgt:mt-1",Q.innerText=E||"",E||(Q.style.display="none");let P=null;function D(){if(!I||P)return;P=document.createElement("div"),P.className=["wgt:fixed","wgt:inset-0","wgt:bg-black","wgt:bg-opacity-75","wgt:z-50","wgt:flex","wgt:items-center","wgt:justify-center"].join(" "),P.addEventListener("click",()=>M());const J=document.createElement("div");J.className="wgt:relative wgt:w-full wgt:h-screen wgt:bg-white wgt:overflow-auto";const Y=document.createElement("button");Y.innerHTML="&times;",Y.className="wgt:absolute wgt:w-8 wgt:h-8 wgt:top-2 wgt:right-2 wgt:text-gray-600 wgt:text-2xl wgt:cursor-pointer wgt:rounded-full wgt:bg-white wgt:shadow",Y.setAttribute("aria-label","Close preview"),Y.addEventListener("click",z=>{z.stopPropagation(),M()}),J.appendChild(Y);const H=document.createElement("div");H.className="wgt:px-10 wgt:w-full wgt:h-full wgt:flex wgt:flex-col wgt:items-center wgt:justify-center";const e=document.createElement("img");e.src=i,e.alt="Full Preview",e.className="wgt:max-h-screen wgt:object-contain",H.appendChild(e),J.appendChild(H),P.appendChild(J),document.body.appendChild(P)}function M(){P&&(document.body.removeChild(P),P=null)}const n=document.createElement("button");n.type="button",n.className="wgt:bg-primary wgt:hover:bg-primary-dark wgt:text-white wgt:px-4 wgt:py-1 wgt:rounded-md wgt:cursor-pointer",n.innerText="Upload file",n.addEventListener("click",J=>{J.stopPropagation(),v.click()});function t(J,Y=2){if(J===0)return"0 Bytes";const H=1024,e=Math.max(0,Y),z=["Bytes","KB","MB","GB","TB"],O=Math.floor(Math.log(J)/Math.log(H));return parseFloat((J/Math.pow(H,O)).toFixed(e))+" "+z[O]}let i=null;function s(J){i&&(URL.revokeObjectURL(i),i=null),J&&(i=URL.createObjectURL(J))}function k(J){if(s(J),C.innerHTML="",J){const Y=document.createElement("div");Y.className="wgt:flex wgt:w-full wgt:items-center wgt:justify-between";const H=document.createElement("div");if(H.className="wgt:flex wgt:space-x-4 wgt:w-full wgt:justify-start wgt:items-center wgt:px-4",H.addEventListener("click",()=>{v.click()}),J.type==="application/pdf"){const F=document.createElement("div");F.className="wgt:flex-shrink-0 wgt:flex wgt:items-center wgt:justify-center wgt:rounded",F.innerHTML=`
2
2
  <svg xmlns="http://www.w3.org/2000/svg" class="w-8 h-8 text-gray-500" fill="currentColor" viewBox="0 0 24 24">
3
3
  <path d="M6 2h9l5 5v15a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"/>
4
4
  <path d="M14 2v5h5"/>
@@ -11,9 +11,9 @@
11
11
  </svg>
12
12
  <span class="text-sm font-semibold leading-4 text-grey-8">Tải tệp lên</span>
13
13
  <span class="text-xs font-normal leading-3 text-grey-7">(Tối thiểu 400x400px, PNG hoặc JPEG)</span>
14
- `;const Y=document.createElement("div");Y.className="wgt:flex wgt:items-center",Y.appendChild(n),C.appendChild(Y)}}return k(I),B.appendChild(C),B.appendChild(v),g.appendChild(B),g.appendChild(Q),{container:g,getValues(){return I},setFile(J){I=J,k(J)},clearFile(){I=null,k(null)},setError(J){J?(Q.innerText=J,Q.style.display="block"):(Q.innerText="",Q.style.display="none")}}}const W=[{value:"VN",label:"Việt Nam"}],y={VN:[{value:"HN",label:"Hà Nội"},{value:"HCM",label:"TP. Hồ Chí Minh"},{value:"DN",label:"Đà Nẵng"}]},x={HN:[{value:"QL",label:"Quận Ba Đình"},{value:"TL",label:"Quận Tây Hồ"}],HCM:[{value:"PN",label:"Quận Phú Nhuận"},{value:"1",label:"Quận 1"}],DN:[{value:"HP",label:"Hải Châu"},{value:"S0",label:"Sơn Trà"}]},U={QL:[{value:"PD",label:"Phường Điện Biên"},{value:"NT",label:"Phường Ngọc Hà"}],TL:[{value:"TD",label:"Phường Tứ Liên"},{value:"TT",label:"Phường Thụy Khuê"}],PN:[{value:"PP",label:"Phường Phú Nhuận"},{value:"TN",label:"Phường Tân Định"}],1:[{value:"BD",label:"Phường Bến Nghé"},{value:"BT",label:"Phường Bến Thành"}],HP:[{value:"TH",label:"Phường Thạch Thang"},{value:"KT",label:"Phường Khuê Trung"}],S0:[{value:"ST",label:"Phường Sơn Trà"},{value:"NB",label:"Phường Nại Hiên Đông"}]};function V({onSubmit:R,registrationData:A}){var z,O,o,F,G,d,X;const I=document.createElement("form");I.className="wgt:w-full",I.addEventListener("submit",r=>{r.preventDefault();const c=e();typeof R=="function"&&R(c)});const w=document.createElement("div");w.className="wgt:grid wgt:grid-cols-1 wgt:md:grid-cols-2 wgt:gap-8",I.appendChild(w);const E=document.createElement("div");E.className="wgt:space-y-4";const g=document.createElement("div");g.className="wgt:space-y-4",w.appendChild(E),w.appendChild(g);const f=j({name:"taxCode",label:"Mã số thuế",required:!0,error:null,placeholder:"",type:"text",value:(A==null?void 0:A.taxCode)??""});E.appendChild(f.container);const B=j({name:"representative",label:"Người đại diện",required:!0,error:null,placeholder:"",type:"text",value:(A==null?void 0:A.representative)??""});E.appendChild(B.container);const v=j({name:"email",label:"Email",required:!0,error:null,placeholder:"",type:"email",value:(A==null?void 0:A.email)??""});E.appendChild(v.container);const C=j({name:"phone",label:"Số điện thoại",required:!0,error:null,placeholder:"",type:"tel",value:(A==null?void 0:A.phone)??""});E.appendChild(C.container);const Q=l({label:"Giấy phép đăng ký kinh doanh",required:!0,file:(A==null?void 0:A.license)??null,onFileChange:r=>{},error:null});E.appendChild(Q.container);const P=j({name:"companyName",label:"Tên công ty",required:!1,error:null,placeholder:"",type:"text",value:(A==null?void 0:A.companyName)??""});g.appendChild(P.container);const D=j({name:"position",label:"Chức vụ",required:!1,error:null,placeholder:"",type:"text",value:(A==null?void 0:A.position)??""});g.appendChild(D.container);const M=document.createElement("div");M.className="wgt:w-full wgt:flex wgt:flex-col wgt:gap-2",g.appendChild(M);const n=document.createElement("span");n.className="wgt:font-medium wgt:text-text-black",n.innerText="Địa chỉ",M.appendChild(n);const t=K({name:"country",label:"Quốc gia",options:W,value:"",disabled:!1,error:null,onChange:r=>{const c=r.target.value;y[c]?(i.setOptions(y[c]),i.setDisabled(!1)):(i.setOptions([]),i.setDisabled(!0)),i.selectEl.value="",s.setOptions([]),s.selectEl.value="",s.setDisabled(!0),k.setOptions([]),k.selectEl.value="",k.setDisabled(!0)}});M.appendChild(t.container);const i=K({name:"province",label:"Tỉnh/Thành phố",options:[],value:"",disabled:!0,error:null,onChange:r=>{const c=r.target.value;x[c]?(s.setOptions(x[c]),s.setDisabled(!1)):(s.setOptions([]),s.setDisabled(!0)),k.setOptions([]),k.selectEl.value="",k.setDisabled(!0)}});M.appendChild(i.container);const s=K({name:"district",label:"Quận/Huyện",options:[],value:"",disabled:!0,error:null,onChange:r=>{const c=r.target.value;U[c]?(k.setOptions(U[c]),k.setDisabled(!1)):(k.setOptions([]),k.setDisabled(!0))}});M.appendChild(s.container);const k=K({name:"ward",label:"Phường/Xã",options:[],value:"",disabled:!0,error:null,onChange:()=>{}});M.appendChild(k.container);const J=j({name:"detail",label:"Địa chỉ cụ thể",required:!1,error:null,placeholder:"",type:"text",value:((z=A==null?void 0:A.address)==null?void 0:z.detail)??""});M.appendChild(J.container);const Y=document.createElement("div");Y.className="wgt:flex wgt:mt-4 wgt:items-center wgt:justify-end wgt:gap-2 ";const H=document.createElement("button");if(H.type="submit",H.innerText="Tiếp theo",H.className=["wgt:bg-primary","wgt:hover:bg-primary-dark","wgt:text-white","wgt:px-6","wgt:py-2","wgt:rounded","wgt:disabled:opacity-50","wgt:disabled:cursor-not-allowed","wgt:cursor-pointer"].join(" "),Y.appendChild(H),I.appendChild(Y),(O=A==null?void 0:A.address)!=null&&O.country){const r=A==null?void 0:A.address.country;t.selectEl.value=r;const c=y[r]||[];if(c.length>0){i.setOptions(c),i.setDisabled(!1);const L=(o=A==null?void 0:A.address)==null?void 0:o.province;L&&(i.selectEl.value=L)}const T=(F=A==null?void 0:A.address)==null?void 0:F.province;if(T&&x[T]){const L=x[T];s.setOptions(L),s.setDisabled(!1);const N=(G=A==null?void 0:A.address)==null?void 0:G.district;N&&(s.selectEl.value=N)}const S=(d=A==null?void 0:A.address)==null?void 0:d.district;if(S&&U[S]){const L=U[S];k.setOptions(L),k.setDisabled(!1);const N=(X=A==null?void 0:A.address)==null?void 0:X.ward;N&&(k.selectEl.value=N)}}function e(){return{taxCode:f.getValue().trim(),representative:B.getValue().trim(),email:v.getValue().trim(),phone:C.getValue().trim(),license:Q.getValues(),companyName:P.getValue().trim(),position:D.getValue().trim(),address:{country:t.getValue(),province:i.getValue(),district:s.getValue(),ward:k.getValue(),detail:J.getValue().trim()}}}return{container:I,getValues:e}}function q({providerProps:R,formProps:A}){const I=document.createElement("div");I.className="wgt:flex wgt:flex-col wgt:gap-4 wgt:w-full wgt:max-w-[1072px] wgt:mx-auto";const w=Z(R);I.appendChild(w.container);const E=V(A);return I.appendChild(E.container),{container:I}}function p({value:R="",onInputChange:A}={}){const I=document.createElement("div");I.className="wgt:flex wgt:flex-col";const w=document.createElement("label");w.className="wgt:font-medium wgt:mb-1 wgt:text-gray-700",w.innerHTML='Chọn gói đăng ký <span class="wgt:text-red-500">*</span>',I.appendChild(w);const E=document.createElement("div");E.className="wgt:flex wgt:rounded-lg wgt:border wgt:border-gray-300 wgt:overflow-hidden";const g=document.createElement("input");g.type="text",g.inputMode="numeric",g.value=R,g.placeholder="Số đơn/tháng",g.className=["wgt:flex-1","wgt:px-4","wgt:py-2","wgt:text-gray-700","wgt:placeholder-gray-400","wgt:bg-white","wgt:focus:outline-none"].join(" "),typeof A=="function"&&g.addEventListener("input",A);const f=document.createElement("span");return f.className="wgt:px-4 wgt:py-2 wgt:bg-gray-100 wgt:text-gray-600 wgt:flex-shrink-0",f.innerText="đơn/tháng",E.appendChild(g),E.appendChild(f),I.appendChild(E),{container:I,inputEl:g,getValue(){return g.value},setValue(B){g.value=B}}}function _({packageOptions:R=[],selectedPackageId:A="",handlePackageSelect:I}={}){const w=document.createElement("div");w.className="space-y-6";const E=document.createElement("h3");E.className="wgt:text-lg wgt:font-medium wgt:text-gray-800 wgt:mb-2",E.innerText="Gói phù hợp nhất",w.appendChild(E);const g=document.createElement("div");g.className="wgt:w-full wgt:grid wgt:grid-cols-3 wgt:gap-6",w.appendChild(g);function f(){g.innerHTML="",R.forEach(B=>{const v=B.id===A,C=document.createElement("label");C.className=["wgt:relative","wgt:border","wgt:rounded-xl","wgt:p-4","wgt:flex-shrink-0","wgt:cursor-pointer","wgt:bg-white",v?"wgt:border-primary":"wgt:border-grey-6 wgt:hover:border-gray-300"].filter(Boolean).join(" ");const Q=document.createElement("div");Q.className="wgt:flex wgt:justify-between wgt:items-center";const P=document.createElement("span");P.className=["wgt:text-base","wgt:font-semibold",v?"wgt:text-green-700":"wgt:text-gray-800"].join(" "),P.innerText=B.code,Q.appendChild(P);const{container:D}=m({checked:v,onChange:J=>{J&&(A=B.id,typeof I=="function"&&I(B.id),f())}});Q.appendChild(D),C.appendChild(Q);const M=document.createElement("div");M.className="wgt:flex wgt:items-center wgt:text-gray-600 wgt:mt-2";const n=document.createElement("svg");n.setAttribute("xmlns","http://www.w3.org/2000/svg"),n.setAttribute("class","w-5 h-5 text-green-500 flex-shrink-0"),n.setAttribute("fill","none"),n.setAttribute("viewBox","0 0 24 24"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width","3"),n.innerHTML=`
14
+ `;const Y=document.createElement("div");Y.className="wgt:flex wgt:items-center",Y.appendChild(n),C.appendChild(Y)}}return k(I),B.appendChild(C),B.appendChild(v),g.appendChild(B),g.appendChild(Q),{container:g,getValues(){return I},setFile(J){I=J,k(J)},clearFile(){I=null,k(null)},setError(J){J?(Q.innerText=J,Q.style.display="block"):(Q.innerText="",Q.style.display="none")}}}const W=[{value:"VN",label:"Việt Nam"}],y={VN:[{value:"HN",label:"Hà Nội"},{value:"HCM",label:"TP. Hồ Chí Minh"},{value:"DN",label:"Đà Nẵng"}]},x={HN:[{value:"QL",label:"Quận Ba Đình"},{value:"TL",label:"Quận Tây Hồ"}],HCM:[{value:"PN",label:"Quận Phú Nhuận"},{value:"1",label:"Quận 1"}],DN:[{value:"HP",label:"Hải Châu"},{value:"S0",label:"Sơn Trà"}]},U={QL:[{value:"PD",label:"Phường Điện Biên"},{value:"NT",label:"Phường Ngọc Hà"}],TL:[{value:"TD",label:"Phường Tứ Liên"},{value:"TT",label:"Phường Thụy Khuê"}],PN:[{value:"PP",label:"Phường Phú Nhuận"},{value:"TN",label:"Phường Tân Định"}],1:[{value:"BD",label:"Phường Bến Nghé"},{value:"BT",label:"Phường Bến Thành"}],HP:[{value:"TH",label:"Phường Thạch Thang"},{value:"KT",label:"Phường Khuê Trung"}],S0:[{value:"ST",label:"Phường Sơn Trà"},{value:"NB",label:"Phường Nại Hiên Đông"}]};function V({onSubmit:R,registrationData:A}){var z,O,o,F,G,d,X;const I=document.createElement("form");I.className="wgt:w-full",I.addEventListener("submit",r=>{r.preventDefault();const c=e();typeof R=="function"&&R(c)});const w=document.createElement("div");w.className="wgt:grid wgt:grid-cols-1 wgt:md:grid-cols-2 wgt:gap-8",I.appendChild(w);const E=document.createElement("div");E.className="wgt:space-y-4";const g=document.createElement("div");g.className="wgt:space-y-4",w.appendChild(E),w.appendChild(g);const f=j({name:"taxCode",label:"Mã số thuế",required:!0,error:null,placeholder:"",type:"text",value:(A==null?void 0:A.taxCode)||""});E.appendChild(f.container);const B=j({name:"representative",label:"Người đại diện",required:!0,error:null,placeholder:"",type:"text",value:(A==null?void 0:A.representative)||""});E.appendChild(B.container);const v=j({name:"email",label:"Email",required:!0,error:null,placeholder:"",type:"email",value:(A==null?void 0:A.email)||""});E.appendChild(v.container);const C=j({name:"phone",label:"Số điện thoại",required:!0,error:null,placeholder:"",type:"tel",value:(A==null?void 0:A.phone)||""});E.appendChild(C.container);const Q=l({label:"Giấy phép đăng ký kinh doanh",required:!0,file:(A==null?void 0:A.license)||null,onFileChange:r=>{},error:null});E.appendChild(Q.container);const P=j({name:"companyName",label:"Tên công ty",required:!1,error:null,placeholder:"",type:"text",value:(A==null?void 0:A.companyName)||""});g.appendChild(P.container);const D=j({name:"position",label:"Chức vụ",required:!1,error:null,placeholder:"",type:"text",value:(A==null?void 0:A.position)||""});g.appendChild(D.container);const M=document.createElement("div");M.className="wgt:w-full wgt:flex wgt:flex-col wgt:gap-2",g.appendChild(M);const n=document.createElement("span");n.className="wgt:font-medium wgt:text-text-black",n.innerText="Địa chỉ",M.appendChild(n);const t=K({name:"country",label:"Quốc gia",options:W,value:"",disabled:!1,error:null,onChange:r=>{const c=r.target.value;y[c]?(i.setOptions(y[c]),i.setDisabled(!1)):(i.setOptions([]),i.setDisabled(!0)),i.selectEl.value="",s.setOptions([]),s.selectEl.value="",s.setDisabled(!0),k.setOptions([]),k.selectEl.value="",k.setDisabled(!0)}});M.appendChild(t.container);const i=K({name:"province",label:"Tỉnh/Thành phố",options:[],value:"",disabled:!0,error:null,onChange:r=>{const c=r.target.value;x[c]?(s.setOptions(x[c]),s.setDisabled(!1)):(s.setOptions([]),s.setDisabled(!0)),k.setOptions([]),k.selectEl.value="",k.setDisabled(!0)}});M.appendChild(i.container);const s=K({name:"district",label:"Quận/Huyện",options:[],value:"",disabled:!0,error:null,onChange:r=>{const c=r.target.value;U[c]?(k.setOptions(U[c]),k.setDisabled(!1)):(k.setOptions([]),k.setDisabled(!0))}});M.appendChild(s.container);const k=K({name:"ward",label:"Phường/Xã",options:[],value:"",disabled:!0,error:null,onChange:()=>{}});M.appendChild(k.container);const J=j({name:"detail",label:"Địa chỉ cụ thể",required:!1,error:null,placeholder:"",type:"text",value:((z=A==null?void 0:A.address)==null?void 0:z.detail)||""});M.appendChild(J.container);const Y=document.createElement("div");Y.className="wgt:flex wgt:mt-4 wgt:items-center wgt:justify-end wgt:gap-2 ";const H=document.createElement("button");if(H.type="submit",H.innerText="Tiếp theo",H.className=["wgt:bg-primary","wgt:hover:bg-primary-dark","wgt:text-white","wgt:px-6","wgt:py-2","wgt:rounded","wgt:disabled:opacity-50","wgt:disabled:cursor-not-allowed","wgt:cursor-pointer"].join(" "),Y.appendChild(H),I.appendChild(Y),(O=A==null?void 0:A.address)!=null&&O.country){const r=A==null?void 0:A.address.country;t.selectEl.value=r;const c=y[r]||[];if(c.length>0){i.setOptions(c),i.setDisabled(!1);const L=(o=A==null?void 0:A.address)==null?void 0:o.province;L&&(i.selectEl.value=L)}const T=(F=A==null?void 0:A.address)==null?void 0:F.province;if(T&&x[T]){const L=x[T];s.setOptions(L),s.setDisabled(!1);const N=(G=A==null?void 0:A.address)==null?void 0:G.district;N&&(s.selectEl.value=N)}const S=(d=A==null?void 0:A.address)==null?void 0:d.district;if(S&&U[S]){const L=U[S];k.setOptions(L),k.setDisabled(!1);const N=(X=A==null?void 0:A.address)==null?void 0:X.ward;N&&(k.selectEl.value=N)}}function e(){return{taxCode:f.getValue().trim(),representative:B.getValue().trim(),email:v.getValue().trim(),phone:C.getValue().trim(),license:Q.getValues(),companyName:P.getValue().trim(),position:D.getValue().trim(),address:{country:t.getValue(),province:i.getValue(),district:s.getValue(),ward:k.getValue(),detail:J.getValue().trim()}}}return{container:I,getValues:e}}function q({providerProps:R,formProps:A}){const I=document.createElement("div");I.className="wgt:flex wgt:flex-col wgt:gap-4 wgt:w-full wgt:max-w-[1072px] wgt:mx-auto";const w=Z(R);I.appendChild(w.container);const E=V(A);return I.appendChild(E.container),{container:I}}function p({value:R="",onInputChange:A}={}){const I=document.createElement("div");I.className="wgt:flex wgt:flex-col";const w=document.createElement("label");w.className="wgt:font-medium wgt:mb-1 wgt:text-gray-700",w.innerHTML='Chọn gói đăng ký <span class="wgt:text-red-500">*</span>',I.appendChild(w);const E=document.createElement("div");E.className="wgt:flex wgt:rounded-lg wgt:border wgt:border-gray-300 wgt:overflow-hidden";const g=document.createElement("input");g.type="text",g.inputMode="numeric",g.value=R,g.placeholder="Số đơn/tháng",g.className=["wgt:flex-1","wgt:px-4","wgt:py-2","wgt:text-gray-700","wgt:placeholder-gray-400","wgt:bg-white","wgt:focus:outline-none"].join(" "),typeof A=="function"&&g.addEventListener("input",A);const f=document.createElement("span");return f.className="wgt:px-4 wgt:py-2 wgt:bg-gray-100 wgt:text-gray-600 wgt:flex-shrink-0",f.innerText="đơn/tháng",E.appendChild(g),E.appendChild(f),I.appendChild(E),{container:I,inputEl:g,getValue(){return g.value},setValue(B){g.value=B}}}function _({packageOptions:R=[],selectedPackageId:A="",handlePackageSelect:I}={}){const w=document.createElement("div");w.className="space-y-6";const E=document.createElement("h3");E.className="wgt:text-lg wgt:font-medium wgt:text-gray-800 wgt:mb-2",E.innerText="Gói phù hợp nhất",w.appendChild(E);const g=document.createElement("div");g.className="wgt:w-full wgt:grid wgt:grid-cols-3 wgt:gap-6",w.appendChild(g);function f(){g.innerHTML="",R.forEach(B=>{const v=B.id===A,C=document.createElement("label");C.className=["wgt:relative","wgt:border","wgt:rounded-xl","wgt:p-4","wgt:flex-shrink-0","wgt:cursor-pointer","wgt:bg-white",v?"wgt:border-primary":"wgt:border-grey-6 wgt:hover:border-gray-300"].filter(Boolean).join(" ");const Q=document.createElement("div");Q.className="wgt:flex wgt:justify-between wgt:items-center";const P=document.createElement("span");P.className=["wgt:text-base","wgt:font-semibold",v?"wgt:text-green-700":"wgt:text-gray-800"].join(" "),P.innerText=B.code,Q.appendChild(P);const{container:D}=m({checked:v,onChange:J=>{J&&(A=B.id,typeof I=="function"&&I(B.id),f())}});Q.appendChild(D),C.appendChild(Q);const M=document.createElement("div");M.className="wgt:flex wgt:items-center wgt:text-gray-600 wgt:mt-2";const n=document.createElement("svg");n.setAttribute("xmlns","http://www.w3.org/2000/svg"),n.setAttribute("class","w-5 h-5 text-green-500 flex-shrink-0"),n.setAttribute("fill","none"),n.setAttribute("viewBox","0 0 24 24"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width","3"),n.innerHTML=`
15
15
  <path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7" />
16
- `,M.appendChild(n);const t=document.createElement("span");t.className="wgt:ml-2 wgt:text-sm",t.innerText=`${B.unitsPerMonth.toLocaleString("vi-VN")} hóa đơn điện tử / tháng`,M.appendChild(t),C.appendChild(M);const i=document.createElement("div");i.className="wgt:mt-4";const s=document.createElement("span");s.className=["wgt:block","wgt:text-2xl","wgt:font-bold",v?"wgt:text-green-700":"wgt:text-gray-900"].join(" "),s.innerText=B.priceVND.toLocaleString("vi-VN"),i.appendChild(s);const k=document.createElement("span");k.className="wgt:text-sm wgt:text-gray-600",k.innerText="VND/Gói",i.appendChild(k),C.appendChild(i),g.appendChild(C)})}return f(),{container:w,setSelectedPackageId(B){A=B,f()}}}function h({title:R,isDisabled:A=!1,handleClick:I=null,type:w="button",className:E=""}={}){const g=document.createElement("button");return g.type=w,g.disabled=A,g.className=["wgt:bg-primary","wgt:hover:bg-primary-dark","wgt:px-6","wgt:py-2","wgt:rounded","wgt:disabled:opacity-50","wgt:disabled:cursor-not-allowed","wgt:cursor-pointer",E].filter(Boolean).join(" "),g.innerText=R,typeof I=="function"&&g.addEventListener("click",f=>{g.disabled||I(f)}),g}function $({onNext:R,onPrev:A,setSelectedOption:I,selectedOption:w}){const E=[{id:"pkg-300-a",code:"DT-300",unitsPerMonth:300,priceVND:45e4},{id:"pkg-500",code:"DT-500",unitsPerMonth:500,priceVND:75e4},{id:"pkg-1000-b",code:"DT-1000",unitsPerMonth:1e3,priceVND:105e4}],g=document.createElement("div");g.className="wgt:flex wgt:flex-col wgt:gap-6 wgt:h-full wgt:justify-between";const f=document.createElement("div");f.className="wgt:w-full wgt:max-w-[1070px] wgt:mx-auto wgt:flex wgt:flex-col wgt:gap-6",g.appendChild(f);const B=document.createElement("div");B.className="wgt:w-full wgt:px-6 wgt:pb-6 wgt:pt-4 wgt:rounded-3xl wgt:bg-weak-50 wgt:flex wgt:flex-col wgt:gap-6",f.appendChild(B);let v="",C=[...E],Q=(w==null?void 0:w.id)??E[1].id;const P=p({value:v,onInputChange:o=>{v=o.target.value.replace(/\D/g,""),i()}});B.appendChild(P.container);const D=document.createElement("div");B.appendChild(D);let M=null;function n(){if(D.innerHTML="",C.length>0)M=_({packageOptions:C,selectedPackageId:Q,handlePackageSelect:o=>{Q=o,n()}}),D.appendChild(M.container);else{const o=document.createElement("span");o.className="wgt:text-gray-500",o.innerText="No package found.",D.appendChild(o),M=null}}let t=null;function i(){t&&clearTimeout(t),v!==""?t=setTimeout(()=>{const o=E.find(F=>F.code.endsWith(v));o?(Q=o.id,C=[o]):C=[],n()},500):(C=[...E],n())}n();const s=document.createElement("div");s.className="wgt:flex wgt:items-center wgt:gap-4";const k=document.createElement("span");k.className="wgt:text-sm wgt:font-semibold wgt:leading-[18px] wgt:text-text-black",k.innerText="Hình thức thanh toán:",s.appendChild(k);const J=document.createElement("div");J.className="wgt:p-2 wgt:w-fit wgt:rounded-[10px] wgt:border wgt:border-soft-200 wgt:flex wgt:items-center wgt:gap-2";const Y=document.createElement("div");Y.innerHTML=`
16
+ `,M.appendChild(n);const t=document.createElement("span");t.className="wgt:ml-2 wgt:text-sm",t.innerText=`${B.unitsPerMonth.toLocaleString("vi-VN")} hóa đơn điện tử / tháng`,M.appendChild(t),C.appendChild(M);const i=document.createElement("div");i.className="wgt:mt-4";const s=document.createElement("span");s.className=["wgt:block","wgt:text-2xl","wgt:font-bold",v?"wgt:text-green-700":"wgt:text-gray-900"].join(" "),s.innerText=B.priceVND.toLocaleString("vi-VN"),i.appendChild(s);const k=document.createElement("span");k.className="wgt:text-sm wgt:text-gray-600",k.innerText="VND/Gói",i.appendChild(k),C.appendChild(i),g.appendChild(C)})}return f(),{container:w,setSelectedPackageId(B){A=B,f()}}}function h({title:R,isDisabled:A=!1,handleClick:I=null,type:w="button",className:E=""}={}){const g=document.createElement("button");return g.type=w,g.disabled=A,g.className=["wgt:bg-primary","wgt:hover:bg-primary-dark","wgt:px-6","wgt:py-2","wgt:rounded","wgt:disabled:opacity-50","wgt:disabled:cursor-not-allowed","wgt:cursor-pointer",E].filter(Boolean).join(" "),g.innerText=R,typeof I=="function"&&g.addEventListener("click",f=>{g.disabled||I(f)}),g}function $({onNext:R,onPrev:A,setSelectedOption:I,selectedOption:w}){const E=[{id:"pkg-300-a",code:"DT-300",unitsPerMonth:300,priceVND:45e4},{id:"pkg-500",code:"DT-500",unitsPerMonth:500,priceVND:75e4},{id:"pkg-1000-b",code:"DT-1000",unitsPerMonth:1e3,priceVND:105e4}],g=document.createElement("div");g.className="wgt:flex wgt:flex-col wgt:gap-6 wgt:h-full wgt:justify-between";const f=document.createElement("div");f.className="wgt:w-full wgt:max-w-[1070px] wgt:mx-auto wgt:flex wgt:flex-col wgt:gap-6",g.appendChild(f);const B=document.createElement("div");B.className="wgt:w-full wgt:px-6 wgt:pb-6 wgt:pt-4 wgt:rounded-3xl wgt:bg-weak-50 wgt:flex wgt:flex-col wgt:gap-6",f.appendChild(B);let v="",C=[...E],Q=(w==null?void 0:w.id)||E[1].id;const P=p({value:v,onInputChange:o=>{v=o.target.value.replace(/\D/g,""),i()}});B.appendChild(P.container);const D=document.createElement("div");B.appendChild(D);let M=null;function n(){if(D.innerHTML="",C.length>0)M=_({packageOptions:C,selectedPackageId:Q,handlePackageSelect:o=>{Q=o,n()}}),D.appendChild(M.container);else{const o=document.createElement("span");o.className="wgt:text-gray-500",o.innerText="No package found.",D.appendChild(o),M=null}}let t=null;function i(){t&&clearTimeout(t),v!==""?t=setTimeout(()=>{const o=E.find(F=>F.code.endsWith(v));o?(Q=o.id,C=[o]):C=[],n()},500):(C=[...E],n())}n();const s=document.createElement("div");s.className="wgt:flex wgt:items-center wgt:gap-4";const k=document.createElement("span");k.className="wgt:text-sm wgt:font-semibold wgt:leading-[18px] wgt:text-text-black",k.innerText="Hình thức thanh toán:",s.appendChild(k);const J=document.createElement("div");J.className="wgt:p-2 wgt:w-fit wgt:rounded-[10px] wgt:border wgt:border-soft-200 wgt:flex wgt:items-center wgt:gap-2";const Y=document.createElement("div");Y.innerHTML=`
17
17
  <svg width="24" height="24" viewBox="0 0 24 24" fill="none"
18
18
  xmlns="http://www.w3.org/2000/svg">
19
19
  <rect width="24" height="24" rx="8" fill="#379DF1" />
package/package.json CHANGED
@@ -45,5 +45,5 @@
45
45
  "prepare": "npm run build"
46
46
  },
47
47
  "type": "module",
48
- "version": "1.6.0"
48
+ "version": "1.6.1"
49
49
  }