@invoice-sdk/widget 1.16.0 → 1.16.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 +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
package/dist/index.umd.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(A){return A instanceof this?A:new this(A)}static concat(A,...B){const C=new this(A);return B.forEach(Q=>C.set(Q)),C}static accessor(A){const C=(this[Tg]=this[Tg]={accessors:{}}).accessors,Q=this.prototype;function E(I){const D=qA(I);C[D]||(NB(Q,I),C[D]=!0)}return n.isArray(A)?A.forEach(E):E(A),this}};BA.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),n.reduceDescriptors(BA.prototype,({value:g},A)=>{let B=A[0].toUpperCase()+A.slice(1);return{get:()=>g,set(C){this[B]=C}}}),n.freezeMethods(BA);function Rg(g,A){const B=this||SA,C=A||B,Q=BA.from(C.headers);let E=C.data;return n.forEach(g,function(D){E=D.call(B,E,Q.normalize(),A?A.status:void 0)}),Q.normalize(),E}function Zg(g){return!!(g&&g.__CANCEL__)}function KA(g,A,B){O.call(this,g==null?"canceled":g,O.ERR_CANCELED,A,B),this.name="CanceledError"}n.inherits(KA,O,{__CANCEL__:!0});function pg(g,A,B){const C=B.config.validateStatus;!B.status||!C||C(B.status)?g(B):A(new O("Request failed with status code "+B.status,[O.ERR_BAD_REQUEST,O.ERR_BAD_RESPONSE][Math.floor(B.status/100)-4],B.config,B.request,B))}function yB(g){const A=/^([-+\w]{1,25})(:?\/\/|:)/.exec(g);return A&&A[1]||""}function xB(g,A){g=g||10;const B=new Array(g),C=new Array(g);let Q=0,E=0,I;return A=A!==void 0?A:1e3,function(f){const e=Date.now(),w=C[E];I||(I=e),B[Q]=f,C[Q]=e;let i=E,o=0;for(;i!==Q;)o+=B[i++],i=i%g;if(Q=(Q+1)%g,Q===E&&(E=(E+1)%g),e-I<A)return;const s=w&&e-w;return s?Math.round(o*1e3/s):void 0}}function UB(g,A){let B=0,C=1e3/A,Q,E;const I=(e,w=Date.now())=>{B=w,Q=null,E&&(clearTimeout(E),E=null),g.apply(null,e)};return[(...e)=>{const w=Date.now(),i=w-B;i>=C?I(e,w):(Q=e,E||(E=setTimeout(()=>{E=null,I(Q)},C-i)))},()=>Q&&I(Q)]}const Eg=(g,A,B=3)=>{let C=0;const Q=xB(50,250);return UB(E=>{const I=E.loaded,D=E.lengthComputable?E.total:void 0,f=I-C,e=Q(f),w=I<=D;C=I;const i={loaded:I,total:D,progress:D?I/D:void 0,bytes:f,rate:e||void 0,estimated:e&&D&&w?(D-I)/e:void 0,event:E,lengthComputable:D!=null,[A?"download":"upload"]:!0};g(i)},B)},Wg=(g,A)=>{const B=g!=null;return[C=>A[0]({lengthComputable:B,total:g,loaded:C}),A[1]]},Vg=g=>(...A)=>n.asap(()=>g(...A)),SB=$.hasStandardBrowserEnv?((g,A)=>B=>(B=new URL(B,$.origin),g.protocol===B.protocol&&g.host===B.host&&(A||g.port===B.port)))(new URL($.origin),$.navigator&&/(msie|trident)/i.test($.navigator.userAgent)):()=>!0,qB=$.hasStandardBrowserEnv?{write(g,A,B,C,Q,E){const I=[g+"="+encodeURIComponent(A)];n.isNumber(B)&&I.push("expires="+new Date(B).toGMTString()),n.isString(C)&&I.push("path="+C),n.isString(Q)&&I.push("domain="+Q),E===!0&&I.push("secure"),document.cookie=I.join("; ")},read(g){const A=document.cookie.match(new RegExp("(^|;\\s*)("+g+")=([^;]*)"));return A?decodeURIComponent(A[3]):null},remove(g){this.write(g,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function lB(g){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(g)}function TB(g,A){return A?g.replace(/\/?\/$/,"")+"/"+A.replace(/^\/+/,""):g}function _g(g,A,B){let C=!lB(A);return g&&(C||B==!1)?TB(g,A):A}const $g=g=>g instanceof BA?DA({},g):g;function cA(g,A){A=A||{};const B={};function C(e,w,i,o){return n.isPlainObject(e)&&n.isPlainObject(w)?n.merge.call({caseless:o},e,w):n.isPlainObject(w)?n.merge({},w):n.isArray(w)?w.slice():w}function Q(e,w,i,o){if(n.isUndefined(w)){if(!n.isUndefined(e))return C(void 0,e,i,o)}else return C(e,w,i,o)}function E(e,w){if(!n.isUndefined(w))return C(void 0,w)}function I(e,w){if(n.isUndefined(w)){if(!n.isUndefined(e))return C(void 0,e)}else return C(void 0,w)}function D(e,w,i){if(i in A)return C(e,w);if(i in g)return C(void 0,e)}const f={url:E,method:E,data:E,baseURL:I,transformRequest:I,transformResponse:I,paramsSerializer:I,timeout:I,timeoutMessage:I,withCredentials:I,withXSRFToken:I,adapter:I,responseType:I,xsrfCookieName:I,xsrfHeaderName:I,onUploadProgress:I,onDownloadProgress:I,decompress:I,maxContentLength:I,maxBodyLength:I,beforeRedirect:I,transport:I,httpAgent:I,httpsAgent:I,cancelToken:I,socketPath:I,responseEncoding:I,validateStatus:D,headers:(e,w,i)=>Q($g(e),$g(w),i,!0)};return n.forEach(Object.keys(Object.assign({},g,A)),function(w){const i=f[w]||Q,o=i(g[w],A[w],w);n.isUndefined(o)&&i!==D||(B[w]=o)}),B}const AC=g=>{const A=cA({},g);let{data:B,withXSRFToken:C,xsrfHeaderName:Q,xsrfCookieName:E,headers:I,auth:D}=A;A.headers=I=BA.from(I),A.url=Ug(_g(A.baseURL,A.url,A.allowAbsoluteUrls),g.params,g.paramsSerializer),D&&I.set("Authorization","Basic "+btoa((D.username||"")+":"+(D.password?unescape(encodeURIComponent(D.password)):"")));let f;if(n.isFormData(B)){if($.hasStandardBrowserEnv||$.hasStandardBrowserWebWorkerEnv)I.setContentType(void 0);else if((f=I.getContentType())!==!1){const[e,...w]=f?f.split(";").map(i=>i.trim()).filter(Boolean):[];I.setContentType([e||"multipart/form-data",...w].join("; "))}}if($.hasStandardBrowserEnv&&(C&&n.isFunction(C)&&(C=C(A)),C||C!==!1&&SB(A.url))){const e=Q&&E&&qB.read(E);e&&I.set(Q,e)}return A},ZB=typeof XMLHttpRequest!="undefined"&&function(g){return new Promise(function(B,C){const Q=AC(g);let E=Q.data;const I=BA.from(Q.headers).normalize();let{responseType:D,onUploadProgress:f,onDownloadProgress:e}=Q,w,i,o,s,M;function r(){s&&s(),M&&M(),Q.cancelToken&&Q.cancelToken.unsubscribe(w),Q.signal&&Q.signal.removeEventListener("abort",w)}let t=new XMLHttpRequest;t.open(Q.method.toUpperCase(),Q.url,!0),t.timeout=Q.timeout;function J(){if(!t)return;const v=BA.from("getAllResponseHeaders"in t&&t.getAllResponseHeaders()),Y={data:!D||D==="text"||D==="json"?t.responseText:t.response,status:t.status,statusText:t.statusText,headers:v,config:g,request:t};pg(function(j){B(j),r()},function(j){C(j),r()},Y),t=null}"onloadend"in t?t.onloadend=J:t.onreadystatechange=function(){!t||t.readyState!==4||t.status===0&&!(t.responseURL&&t.responseURL.indexOf("file:")===0)||setTimeout(J)},t.onabort=function(){t&&(C(new O("Request aborted",O.ECONNABORTED,g,t)),t=null)},t.onerror=function(){C(new O("Network Error",O.ERR_NETWORK,g,t)),t=null},t.ontimeout=function(){let k=Q.timeout?"timeout of "+Q.timeout+"ms exceeded":"timeout exceeded";const Y=Q.transitional||qg;Q.timeoutErrorMessage&&(k=Q.timeoutErrorMessage),C(new O(k,Y.clarifyTimeoutError?O.ETIMEDOUT:O.ECONNABORTED,g,t)),t=null},E===void 0&&I.setContentType(null),"setRequestHeader"in t&&n.forEach(I.toJSON(),function(k,Y){t.setRequestHeader(Y,k)}),n.isUndefined(Q.withCredentials)||(t.withCredentials=!!Q.withCredentials),D&&D!=="json"&&(t.responseType=Q.responseType),e&&([o,M]=Eg(e,!0),t.addEventListener("progress",o)),f&&t.upload&&([i,s]=Eg(f),t.upload.addEventListener("progress",i),t.upload.addEventListener("loadend",s)),(Q.cancelToken||Q.signal)&&(w=v=>{t&&(C(!v||v.type?new KA(null,g,t):v),t.abort(),t=null)},Q.cancelToken&&Q.cancelToken.subscribe(w),Q.signal&&(Q.signal.aborted?w():Q.signal.addEventListener("abort",w)));const R=yB(Q.url);if(R&&$.protocols.indexOf(R)===-1){C(new O("Unsupported protocol "+R+":",O.ERR_BAD_REQUEST,g));return}t.send(E||null)})},pB=(g,A)=>{const{length:B}=g=g?g.filter(Boolean):[];if(A||B){let C=new AbortController,Q;const E=function(e){if(!Q){Q=!0,D();const w=e instanceof Error?e:this.reason;C.abort(w instanceof O?w:new KA(w instanceof Error?w.message:w))}};let I=A&&setTimeout(()=>{I=null,E(new O(`timeout ${A} of ms exceeded`,O.ETIMEDOUT))},A);const D=()=>{g&&(I&&clearTimeout(I),I=null,g.forEach(e=>{e.unsubscribe?e.unsubscribe(E):e.removeEventListener("abort",E)}),g=null)};g.forEach(e=>e.addEventListener("abort",E));const{signal:f}=C;return f.unsubscribe=()=>n.asap(D),f}},WB=function*(g,A){let B=g.byteLength;if(B<A){yield g;return}let C=0,Q;for(;C<B;)Q=C+A,yield g.slice(C,Q),C=Q},VB=function(g,A){return Hg(this,null,function*(){try{for(var B=XC(_B(g)),C,Q,E;C=!(Q=yield new jA(B.next())).done;C=!1){const I=Q.value;yield*Og(WB(I,A))}}catch(Q){E=[Q]}finally{try{C&&(Q=B.return)&&(yield new jA(Q.call(B)))}finally{if(E)throw E[0]}}})},_B=function(g){return Hg(this,null,function*(){if(g[Symbol.asyncIterator]){yield*Og(g);return}const A=g.getReader();try{for(;;){const{done:B,value:C}=yield new jA(A.read());if(B)break;yield C}}finally{yield new jA(A.cancel())}})},gC=(g,A,B,C)=>{const Q=VB(g,A);let E=0,I,D=e=>{I||(I=!0,C&&C(e))};return new ReadableStream({pull(e){return q(this,null,function*(){try{const{done:w,value:i}=yield Q.next();if(w){D(),e.close();return}let o=i.byteLength;if(B){let s=E+=o;B(s)}e.enqueue(new Uint8Array(i))}catch(w){throw D(w),w}})},cancel(e){return D(e),Q.return()}},{highWaterMark:2})},wg=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",CC=wg&&typeof ReadableStream=="function",$B=wg&&(typeof TextEncoder=="function"?(g=>A=>g.encode(A))(new TextEncoder):g=>q(null,null,function*(){return new Uint8Array(yield new Response(g).arrayBuffer())})),BC=(g,...A)=>{try{return!!g(...A)}catch(B){return!1}},AQ=CC&&BC(()=>{let g=!1;const A=new Request($.origin,{body:new ReadableStream,method:"POST",get duplex(){return g=!0,"half"}}).headers.has("Content-Type");return g&&!A}),QC=64*1024,kg=CC&&BC(()=>n.isReadableStream(new Response("").body)),Dg={stream:kg&&(g=>g.body)};wg&&(g=>{["text","arrayBuffer","blob","formData","stream"].forEach(A=>{!Dg[A]&&(Dg[A]=n.isFunction(g[A])?B=>B[A]():(B,C)=>{throw new O(`Response type '${A}' is not supported`,O.ERR_NOT_SUPPORT,C)})})})(new Response);const gQ=g=>q(null,null,function*(){if(g==null)return 0;if(n.isBlob(g))return g.size;if(n.isSpecCompliantForm(g))return(yield new Request($.origin,{method:"POST",body:g}).arrayBuffer()).byteLength;if(n.isArrayBufferView(g)||n.isArrayBuffer(g))return g.byteLength;if(n.isURLSearchParams(g)&&(g=g+""),n.isString(g))return(yield $B(g)).byteLength}),CQ=(g,A)=>q(null,null,function*(){const B=n.toFiniteNumber(g.getContentLength());return B==null?gQ(A):B}),cg={http:cB,xhr:ZB,fetch:wg&&(g=>q(null,null,function*(){let{url:A,method:B,data:C,signal:Q,cancelToken:E,timeout:I,onDownloadProgress:D,onUploadProgress:f,responseType:e,headers:w,withCredentials:i="same-origin",fetchOptions:o}=AC(g);e=e?(e+"").toLowerCase():"text";let s=pB([Q,E&&E.toAbortSignal()],I),M;const r=s&&s.unsubscribe&&(()=>{s.unsubscribe()});let t;try{if(f&&AQ&&B!=="get"&&B!=="head"&&(t=yield CQ(w,C))!==0){let Y=new Request(A,{method:"POST",body:C,duplex:"half"}),F;if(n.isFormData(C)&&(F=Y.headers.get("content-type"))&&w.setContentType(F),Y.body){const[j,d]=Wg(t,Eg(Vg(f)));C=gC(Y.body,QC,j,d)}}n.isString(i)||(i=i?"include":"omit");const J="credentials"in Request.prototype;M=new Request(A,yA(DA({},o),{signal:s,method:B.toUpperCase(),headers:w.normalize().toJSON(),body:C,duplex:"half",credentials:J?i:void 0}));let R=yield fetch(M);const v=kg&&(e==="stream"||e==="response");if(kg&&(D||v&&r)){const Y={};["status","statusText","headers"].forEach(K=>{Y[K]=R[K]});const F=n.toFiniteNumber(R.headers.get("content-length")),[j,d]=D&&Wg(F,Eg(Vg(D),!0))||[];R=new Response(gC(R.body,QC,j,()=>{d&&d(),r&&r()}),Y)}e=e||"text";let k=yield Dg[n.findKey(Dg,e)||"text"](R,g);return!v&&r&&r(),yield new Promise((Y,F)=>{pg(Y,F,{data:k,headers:BA.from(R.headers),status:R.status,statusText:R.statusText,config:g,request:M})})}catch(J){throw r&&r(),J&&J.name==="TypeError"&&/Load failed|fetch/i.test(J.message)?Object.assign(new O("Network Error",O.ERR_NETWORK,g,M),{cause:J.cause||J}):O.from(J,J&&J.code,g,M)}}))};n.forEach(cg,(g,A)=>{if(g){try{Object.defineProperty(g,"name",{value:A})}catch(B){}Object.defineProperty(g,"adapterName",{value:A})}});const IC=g=>`- ${g}`,BQ=g=>n.isFunction(g)||g===null||g===!1,EC={getAdapter:g=>{g=n.isArray(g)?g:[g];const{length:A}=g;let B,C;const Q={};for(let E=0;E<A;E++){B=g[E];let I;if(C=B,!BQ(B)&&(C=cg[(I=String(B)).toLowerCase()],C===void 0))throw new O(`Unknown adapter '${I}'`);if(C)break;Q[I||"#"+E]=C}if(!C){const E=Object.entries(Q).map(([D,f])=>`adapter ${D} `+(f===!1?"is not supported by the environment":"is not available in the build"));let I=A?E.length>1?`since :
|
|
17
17
|
`+E.map(IC).join(`
|
|
18
18
|
`):" "+IC(E[0]):"as no adapter specified";throw new O("There is no suitable adapter to dispatch the request "+I,"ERR_NOT_SUPPORT")}return C},adapters:cg};function Yg(g){if(g.cancelToken&&g.cancelToken.throwIfRequested(),g.signal&&g.signal.aborted)throw new KA(null,g)}function wC(g){return Yg(g),g.headers=BA.from(g.headers),g.data=Rg.call(g,g.transformRequest),["post","put","patch"].indexOf(g.method)!==-1&&g.headers.setContentType("application/x-www-form-urlencoded",!1),EC.getAdapter(g.adapter||SA.adapter)(g).then(function(C){return Yg(g),C.data=Rg.call(g,g.transformResponse,C),C.headers=BA.from(C.headers),C},function(C){return Zg(C)||(Yg(g),C&&C.response&&(C.response.data=Rg.call(g,g.transformResponse,C.response),C.response.headers=BA.from(C.response.headers))),Promise.reject(C)})}const DC="1.9.0",eg={};["object","boolean","number","function","string","symbol"].forEach((g,A)=>{eg[g]=function(C){return typeof C===g||"a"+(A<1?"n ":" ")+g}});const eC={};eg.transitional=function(A,B,C){function Q(E,I){return"[Axios v"+DC+"] Transitional option '"+E+"'"+I+(C?". "+C:"")}return(E,I,D)=>{if(A===!1)throw new O(Q(I," has been removed"+(B?" in "+B:"")),O.ERR_DEPRECATED);return B&&!eC[I]&&(eC[I]=!0,console.warn(Q(I," has been deprecated since v"+B+" and will be removed in the near future"))),A?A(E,I,D):!0}},eg.spelling=function(A){return(B,C)=>(console.warn(`${C} is likely a misspelling of ${A}`),!0)};function QQ(g,A,B){if(typeof g!="object")throw new O("options must be an object",O.ERR_BAD_OPTION_VALUE);const C=Object.keys(g);let Q=C.length;for(;Q-- >0;){const E=C[Q],I=A[E];if(I){const D=g[E],f=D===void 0||I(D,E,g);if(f!==!0)throw new O("option "+E+" must be "+f,O.ERR_BAD_OPTION_VALUE);continue}if(B!==!0)throw new O("Unknown option "+E,O.ERR_BAD_OPTION)}}const ig={assertOptions:QQ,validators:eg},fA=ig.validators;let YA=class{constructor(A){this.defaults=A||{},this.interceptors={request:new Sg,response:new Sg}}request(A,B){return q(this,null,function*(){try{return yield this._request(A,B)}catch(C){if(C instanceof Error){let Q={};Error.captureStackTrace?Error.captureStackTrace(Q):Q=new Error;const E=Q.stack?Q.stack.replace(/^.+\n/,""):"";try{C.stack?E&&!String(C.stack).endsWith(E.replace(/^.+\n.+\n/,""))&&(C.stack+=`
|
|
19
|
-
`+E):C.stack=E}catch(I){}}throw C}})}_request(A,B){typeof A=="string"?(B=B||{},B.url=A):B=A||{},B=cA(this.defaults,B);const{transitional:C,paramsSerializer:Q,headers:E}=B;C!==void 0&&ig.assertOptions(C,{silentJSONParsing:fA.transitional(fA.boolean),forcedJSONParsing:fA.transitional(fA.boolean),clarifyTimeoutError:fA.transitional(fA.boolean)},!1),Q!=null&&(n.isFunction(Q)?B.paramsSerializer={serialize:Q}:ig.assertOptions(Q,{encode:fA.function,serialize:fA.function},!0)),B.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?B.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:B.allowAbsoluteUrls=!0),ig.assertOptions(B,{baseUrl:fA.spelling("baseURL"),withXsrfToken:fA.spelling("withXSRFToken")},!0),B.method=(B.method||this.defaults.method||"get").toLowerCase();let I=E&&n.merge(E.common,E[B.method]);E&&n.forEach(["delete","get","head","post","put","patch","common"],M=>{delete E[M]}),B.headers=BA.concat(I,E);const D=[];let f=!0;this.interceptors.request.forEach(function(r){typeof r.runWhen=="function"&&r.runWhen(B)===!1||(f=f&&r.synchronous,D.unshift(r.fulfilled,r.rejected))});const e=[];this.interceptors.response.forEach(function(r){e.push(r.fulfilled,r.rejected)});let w,i=0,o;if(!f){const M=[wC.bind(this),void 0];for(M.unshift.apply(M,D),M.push.apply(M,e),o=M.length,w=Promise.resolve(B);i<o;)w=w.then(M[i++],M[i++]);return w}o=D.length;let s=B;for(i=0;i<o;){const M=D[i++],r=D[i++];try{s=M(s)}catch(t){r.call(this,t);break}}try{w=wC.call(this,s)}catch(M){return Promise.reject(M)}for(i=0,o=e.length;i<o;)w=w.then(e[i++],e[i++]);return w}getUri(A){A=cA(this.defaults,A);const B=_g(A.baseURL,A.url,A.allowAbsoluteUrls);return Ug(B,A.params,A.paramsSerializer)}};n.forEach(["delete","get","head","options"],function(A){YA.prototype[A]=function(B,C){return this.request(cA(C||{},{method:A,url:B,data:(C||{}).data}))}}),n.forEach(["post","put","patch"],function(A){function B(C){return function(E,I,D){return this.request(cA(D||{},{method:A,headers:C?{"Content-Type":"multipart/form-data"}:{},url:E,data:I}))}}YA.prototype[A]=B(),YA.prototype[A+"Form"]=B(!0)});let IQ=class bC{constructor(A){if(typeof A!="function")throw new TypeError("executor must be a function.");let B;this.promise=new Promise(function(E){B=E});const C=this;this.promise.then(Q=>{if(!C._listeners)return;let E=C._listeners.length;for(;E-- >0;)C._listeners[E](Q);C._listeners=null}),this.promise.then=Q=>{let E;const I=new Promise(D=>{C.subscribe(D),E=D}).then(Q);return I.cancel=function(){C.unsubscribe(E)},I},A(function(E,I,D){C.reason||(C.reason=new KA(E,I,D),B(C.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(A){if(this.reason){A(this.reason);return}this._listeners?this._listeners.push(A):this._listeners=[A]}unsubscribe(A){if(!this._listeners)return;const B=this._listeners.indexOf(A);B!==-1&&this._listeners.splice(B,1)}toAbortSignal(){const A=new AbortController,B=C=>{A.abort(C)};return this.subscribe(B),A.signal.unsubscribe=()=>this.unsubscribe(B),A.signal}static source(){let A;return{token:new bC(function(Q){A=Q}),cancel:A}}};function EQ(g){return function(B){return g.apply(null,B)}}function wQ(g){return n.isObject(g)&&g.isAxiosError===!0}const dg={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(dg).forEach(([g,A])=>{dg[A]=g});function iC(g){const A=new YA(g),B=eA(YA.prototype.request,A);return n.extend(B,YA.prototype,A,{allOwnKeys:!0}),n.extend(B,A,null,{allOwnKeys:!0}),B.create=function(Q){return iC(cA(g,Q))},B}const x=iC(SA);x.Axios=YA,x.CanceledError=KA,x.CancelToken=IQ,x.isCancel=Zg,x.VERSION=DC,x.toFormData=Qg,x.AxiosError=O,x.Cancel=x.CanceledError,x.all=function(A){return Promise.all(A)},x.spread=EQ,x.isAxiosError=wQ,x.mergeConfig=cA,x.AxiosHeaders=BA,x.formToJSON=g=>lg(n.isHTMLForm(g)?new FormData(g):g),x.getAdapter=EC.getAdapter,x.HttpStatusCode=dg,x.default=x;const{Axios:WQ,AxiosError:VQ,CanceledError:_Q,isCancel:$Q,CancelToken:AI,VERSION:gI,all:CI,Cancel:BI,isAxiosError:QI,spread:II,toFormData:EI,AxiosHeaders:wI,HttpStatusCode:DI,formToJSON:eI,getAdapter:iI,mergeConfig:fI}=x,zg=x.create({baseURL:"",headers:{Accept:"application/json"}});zg.interceptors.request.use(function(g){return g},function(g){return Promise.reject(g)}),zg.interceptors.response.use(function(g){return g.data},function(g){return Promise.reject(g)});function DQ(g){return q(this,null,function*(){if(!g)throw new Error("Tax code is required to fetch tax information.");return yield zg.get(Mg,{params:{tax:g}})})}const eQ=[{value:"VN",label:"Việt Nam"}];function iQ(g,A){let B;return function(...C){clearTimeout(B),B=setTimeout(()=>g.apply(this,C),A)}}function fQ(C){return q(this,arguments,function*({onSubmit:g,registrationData:A,theme:B="default"}){var WA,c,G,U,V,Z,b,h,X,m,QA,sA,nC,MC,tC,oC,vC,sC,rC,JC,PC,RC,kC,cC,YC,dC,zC,HC,OC,GC,FC,uC,aC,jC,LC;const Q=document.createElement("div");Q.className="wgt:flex wgt:flex-col wgt:gap-4 wgt:w-full";const E=document.createElement("form");E.className="wgt:w-full wgt:max-w-[1072px] wgt:mx-auto ",E.addEventListener("submit",z=>{if(z.preventDefault(),!pA())return;const _=aA();typeof g=="function"&&g(_)});const I=document.createElement("div");I.className="wgt:grid wgt:grid-cols-1 wgt:md:grid-cols-2 wgt:gap-8",E.appendChild(I);const D=document.createElement("div");D.className="wgt:space-y-8";const f=document.createElement("div");f.className="wgt:space-y-8",I.appendChild(D),I.appendChild(f);const e=document.createElement("div");e.className="wgt:space-y-2";const w=document.createElement("h3");w.className="wgt:text-lg wgt:font-semibold wgt:mb-2",w.innerText="Thông tin đơn vị",e.appendChild(w),D.appendChild(e);const i=a({name:"taxCode",label:"Mã số thuế",required:!0,placeholder:"",type:"text",value:((c=(WA=A==null?void 0:A.eInvoiceRegistration)==null?void 0:WA.organization)==null?void 0:c.taxCode)||"",readOnly:!1,error:null,onInput:iQ(z=>{const _=z.target.value.trim();_.length>=10?o(_):i.setLoading(!1)},500)});function o(z){return q(this,null,function*(){i.setError(null);try{const _=yield DQ(z);_.error?i.setError(_.error):(M.inputEl.value=_.ten_cty||"",W.inputEl.value=_.nguoi_dai_dien||"",r.inputEl.value=_.dia_chi||"",J.inputEl.value=_.cqthue_ql||"",i.setError(null))}catch(_){i.setError("Lỗi khi lấy thông tin mã số thuế.")}finally{rA()}})}const s=(((U=(G=A==null?void 0:A.eInvoiceRegistration)==null?void 0:G.organization)==null?void 0:U.taxCode)||"").trim();s.length>=10&&o(s),e.appendChild(i.container);const M=a({name:"companyName",label:"Tên công ty",required:!0,error:null,placeholder:"",type:"text",value:((Z=(V=A==null?void 0:A.eInvoiceRegistration)==null?void 0:V.organization)==null?void 0:Z.name)||"",readOnly:!1});e.appendChild(M.container);const r=a({name:"companyAddressDetail",label:"Địa chỉ công ty",required:!0,error:null,placeholder:"",type:"text",value:"",readOnly:!1});e.appendChild(r.container);const t=a({name:"companyTaxAuthorityCode",label:"Mã cơ quan thuế",required:!1,error:null,placeholder:"",type:"text",value:((b=A==null?void 0:A.eInvoiceRegistration)==null?void 0:b.taxAuthorityCode)||"",readOnly:!1});e.appendChild(t.container);const J=a({name:"companyTaxManagement",label:"Cơ quan thuế quản lý",required:!0,error:null,placeholder:"",type:"text",value:((X=(h=A==null?void 0:A.eInvoiceRegistration)==null?void 0:h.organization)==null?void 0:X.taxAuthority)||"",readOnly:!1});e.appendChild(J.container);const R=y({label:"Giấy phép đăng ký kinh doanh",required:!0,file:(A==null?void 0:A.license)||null,onFileChange:z=>{rA()},error:null});e.appendChild(R.container);const v=y({label:"Logo công ty",required:!1,file:(A==null?void 0:A.logo)||null,onFileChange:z=>{},error:null});e.appendChild(v.container);const k=document.createElement("div");k.className="wgt:space-y-2";const Y=document.createElement("h3");Y.className="wgt:text-lg wgt:font-semibold wgt:mb-2",Y.innerText="Thông tin người liên hệ",k.appendChild(Y),D.appendChild(k);const F=a({name:"name",label:"Họ và tên",required:!0,error:null,placeholder:"",type:"text",value:((QA=(m=A==null?void 0:A.eInvoiceRegistration)==null?void 0:m.contactPerson)==null?void 0:QA.name)||""});k.appendChild(F.container);const j=a({name:"email",label:"Email",required:!0,error:null,placeholder:"",type:"email",value:((nC=(sA=A==null?void 0:A.eInvoiceRegistration)==null?void 0:sA.contactPerson)==null?void 0:nC.email)||""});k.appendChild(j.container);const d=a({name:"phone",label:"Số điện thoại",required:!0,error:null,placeholder:"",type:"tel",value:((tC=(MC=A==null?void 0:A.eInvoiceRegistration)==null?void 0:MC.contactPerson)==null?void 0:tC.email)||""});k.appendChild(d.container);const K=a({name:"contactAddressDetail",label:"Địa chỉ thường trú",required:!0,error:null,placeholder:"",type:"text",value:((vC=(oC=A==null?void 0:A.eInvoiceRegistration)==null?void 0:oC.contactPerson)==null?void 0:vC.address)||"",readOnly:!1});k.appendChild(K.container);const P=document.createElement("div");P.className="wgt:space-y-2";const AA=document.createElement("h3");AA.className="wgt:text-lg wgt:font-semibold wgt:mb-2",AA.innerText="Thông tin người đại diện",P.appendChild(AA),f.appendChild(P);const W=a({name:"repName",label:"Họ và tên",required:!0,error:null,placeholder:"",type:"text",value:((rC=(sC=A==null?void 0:A.eInvoiceRegistration)==null?void 0:sC.legalRepresentative)==null?void 0:rC.name)||""}),EA=document.createElement("ul");EA.className="wgt:list-inside wgt:list-disc wgt:-mt-2";const gA=document.createElement("li");gA.className="wgt:text-sm wgt:text-[#8C8C8C]",gA.innerText="Vui lòng kiểm tra và nhập đúng tên người đại diện theo Giấy phép kinh doanh đã tải lên.",EA.appendChild(gA),P.appendChild(W.container),P.appendChild(EA);const nA=a({name:"repDob",label:"Ngày sinh",required:!1,error:null,placeholder:"",type:"date",value:((PC=(JC=A==null?void 0:A.eInvoiceRegistration)==null?void 0:JC.legalRepresentative)==null?void 0:PC.dob)||""});P.appendChild(nA.container);const hA=S({name:"repGender",label:"Giới tính",options:["female","male","other"].map(z=>({value:z,label:z.charAt(0).toUpperCase()+z.slice(1)})),required:!0,value:((kC=(RC=A==null?void 0:A.eInvoiceRegistration)==null?void 0:RC.legalRepresentative)==null?void 0:kC.gender)||"",disabled:!1,error:null,onChange:z=>{z.target.value}});P.appendChild(hA.container);const dA=a({name:"repPhone",label:"Số điện thoại",required:!0,error:null,placeholder:"",type:"tel",value:((YC=(cC=A==null?void 0:A.eInvoiceRegistration)==null?void 0:cC.legalRepresentative)==null?void 0:YC.phone)||""});P.appendChild(dA.container);const XA=a({name:"repIdentity",label:"Số CMND/CCCD",required:!0,error:null,placeholder:"",type:"text",value:((zC=(dC=A==null?void 0:A.eInvoiceRegistration)==null?void 0:dC.legalRepresentative)==null?void 0:zC.identityNumber)||""});P.appendChild(XA.container);const zA=a({name:"repPassport",label:"Số hộ chiếu",required:!1,error:null,placeholder:"",type:"text",value:((OC=(HC=A==null?void 0:A.eInvoiceRegistration)==null?void 0:HC.legalRepresentative)==null?void 0:OC.passportNumber)||""});P.appendChild(zA.container);const bA=S({name:"repNationality",label:"Quốc gia",options:eQ,value:((FC=(GC=A==null?void 0:A.eInvoiceRegistration)==null?void 0:GC.legalRepresentative)==null?void 0:FC.nationality)||"",disabled:!1,error:null,onChange:z=>{z.target.value}});P.appendChild(bA.container);const HA=a({name:"contactAddressDetail",label:"Địa chỉ thường trú",required:!0,error:null,placeholder:"",type:"text",value:((aC=(uC=A==null?void 0:A.eInvoiceRegistration)==null?void 0:uC.legalRepresentative)==null?void 0:aC.permanentAddress)||"",readOnly:!1});P.appendChild(HA.container);const MA=document.createElement("div");MA.className="wgt:space-y-2";const OA=document.createElement("h3");OA.className="wgt:text-lg wgt:font-semibold wgt:mb-2",OA.innerText="Thông tin bổ sung",MA.appendChild(OA),f.appendChild(MA);const ZA=S({name:"hasUsedEInvoice",label:"Đã sử dụng hóa đơn điện tử trước đây?",options:[{value:"yes",label:"Có"},{value:"no",label:"Không"}],required:!0,value:(jC=A==null?void 0:A.eInvoiceRegistration)!=null&&jC.hasUsedEInvoice?"yes":"no",disabled:!1,error:null,onChange:z=>{z.target.value==="yes"?wA.inputEl.removeAttribute("readonly"):(wA.inputEl.value="",wA.inputEl.setAttribute("readonly","true"))}});MA.appendChild(ZA.container);const wA=a({name:"previousEInvoiceProvider",label:"",required:!1,error:null,placeholder:"Nhà cung cấp hóa đơn trước đó (nếu có)",type:"text",value:((LC=A==null?void 0:A.eInvoiceRegistration)==null?void 0:LC.previousEInvoiceProvider)||"",readOnly:!0});MA.appendChild(wA.container);const GA=document.createElement("div");GA.className="wgt:flex wgt:items-center wgt:space-x-2 wgt:mt-4";let FA=!0;const T=document.createElement("div");T.className=["wgt:w-4","wgt:h-4","wgt:mt-1","wgt:border-2","wgt:border-primary","wgt:bg-primary","wgt:rounded","wgt:flex","wgt:items-center","wgt:justify-center","wgt:cursor-pointer","wgt:transition-colors"].join(" ");const uA="http://www.w3.org/2000/svg",tA=document.createElementNS(uA,"svg");tA.setAttribute("viewBox","0 0 24 24"),tA.setAttribute("class","wgt:w-4 wgt:h-4 wgt:text-white");const oA=document.createElementNS(uA,"path");oA.setAttribute("fill-rule","evenodd"),oA.setAttribute("clip-rule","evenodd"),oA.setAttribute("d","M5.23 12.03a.75.75 0 011.06.02L10 15.94l7.71-7.71a.75.75 0 111.06 1.06l-8.24 8.24a.75.75 0 01-1.06 0L5.21 13.09a.75.75 0 01.02-1.06z"),oA.setAttribute("fill","white"),tA.appendChild(oA),T.appendChild(tA);const vA=document.createElement("label");vA.className="wgt:text-sm wgt:text-strong-950 wgt:leading-tight",vA.appendChild(document.createTextNode("Tôi đồng ý với "));const mA=(z,_)=>{const ng=document.createElement("a");return ng.href=_,ng.className="wgt:text-primary wgt:font-semibold wgt:hover:underline",ng.textContent=z,ng};vA.appendChild(mA("Điều khoản","#")),vA.appendChild(document.createTextNode(" và ")),vA.appendChild(mA("Chính sách sử dụng","#")),vA.appendChild(document.createTextNode(` của ${B?B.toUpperCase():"OCB"}.`)),GA.appendChild(T),GA.appendChild(vA),E.appendChild(GA),T.addEventListener("click",()=>{FA=!FA,FA?(T.classList.add("wgt:bg-primary"),tA.classList.remove("wgt:hidden")):(T.classList.remove("wgt:bg-primary"),tA.classList.add("wgt:hidden")),rA()}),Q.appendChild(E);const PA=document.createElement("div");PA.className="wgt:flex wgt:mt-6 wgt:items-center wgt:justify-end wgt:gap-2 ";const RA=document.createElement("button");RA.type="submit",RA.innerText="Tiếp theo",RA.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(" "),PA.appendChild(RA),Q.appendChild(PA);function pA(){const z=aA();return!z.eInvoiceRegistration.organization.name||!z.eInvoiceRegistration.organization.address||!z.eInvoiceRegistration.organization.taxCode||!z.eInvoiceRegistration.organization.taxAuthority||!z.eInvoiceRegistration.contactPerson.name||!z.eInvoiceRegistration.contactPerson.email||!z.eInvoiceRegistration.contactPerson.phone||!z.eInvoiceRegistration.contactPerson.address||!z.eInvoiceRegistration.legalRepresentative.name||!z.eInvoiceRegistration.legalRepresentative.phone||!z.eInvoiceRegistration.legalRepresentative.identityNumber||!z.eInvoiceRegistration.legalRepresentative.permanentAddress||z.eInvoiceRegistration.organization.taxCode.length<10?!1:/^\d{10,11}$/.test(z.eInvoiceRegistration.contactPerson.phone)?/^\d{10,11}$/.test(z.eInvoiceRegistration.legalRepresentative.phone)?/^\d{9,12}$/.test(z.eInvoiceRegistration.legalRepresentative.identityNumber)?/^[\w.-]+@[\w.-]+\.\w{2,}$/.test(z.eInvoiceRegistration.contactPerson.email)?!(!z.license||z.license.length===0):(j.setError("Email không hợp lệ."),!1):(XA.setError("Số CMND/CCCD phải có 9 hoặc 12 chữ số."),!1):(dA.setError("Số điện thoại người đại diện phải có 10 hoặc 11 chữ số."),!1):(d.setError("Số điện thoại liên hệ phải có 10 hoặc 11 chữ số."),!1)}function rA(){RA.disabled=!pA()||!FA}[M,i,r,J,F,j,d,K,W,dA,XA,HA].forEach(z=>{z.inputEl.addEventListener("input",rA)}),[hA].forEach(z=>{z.selectEl.addEventListener("change",rA)}),rA(),RA.addEventListener("click",z=>{if(z.preventDefault(),!pA())return;const _=aA();typeof g=="function"&&g(_)});function aA(){return{eInvoiceRegistration:{taxAuthorityCode:t.getValue(),previousEInvoiceProvider:wA.getValue(),organization:{name:M.getValue(),address:r.getValue(),taxCode:i.getValue(),taxAuthority:J.getValue()},contactPerson:{name:F.getValue(),address:K.getValue(),email:j.getValue(),phone:d.getValue()},legalRepresentative:{name:W.getValue(),dob:nA.getValue(),gender:hA.getValue(),phone:dA.getValue(),identityNumber:XA.getValue(),passportNumber:zA.getValue(),nationality:bA.getValue(),permanentAddress:HA.getValue()},hasUsedEInvoice:ZA.getValue()==="yes"},license:R.getValues(),logo:v.getValues()}}return{container:Q,getValues:aA}})}function nQ(B){return q(this,arguments,function*({providerProps:g,formProps:A}){const C=document.createElement("div");C.className="wgt:flex wgt:flex-col wgt:gap-4 wgt:w-full";const Q=l(g);C.appendChild(Q.container);const{container:E}=yield fQ(A);return C.appendChild(E),{container:C}})}function MQ({value:g="",placeholder:A="Số đơn/tháng",onInputChange:B=void 0}){const C=document.createElement("div");C.className="wgt:flex wgt:flex-col";const Q=document.createElement("div");Q.className="wgt:flex wgt:rounded-lg wgt:border wgt:border-gray-300 wgt:overflow-hidden",C.appendChild(Q);const E=document.createElement("input");E.type="text",E.inputMode="numeric",E.value=g,E.placeholder=A,E.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 B=="function"&&E.addEventListener("input",B),Q.appendChild(E);const I=document.createElement("span");return I.className="wgt:px-4 wgt:py-2 wgt:bg-gray-100 wgt:text-text-sub-600 wgt:flex-shrink-0",I.innerText="đơn/tháng",Q.appendChild(I),{container:C}}function fC({packageOptions:g=[],selectedPackageId:A="",handlePackageSelect:B}={}){const C=document.createElement("div");C.className="wgt:space-y-6";const Q=document.createElement("div");Q.className="wgt:w-full wgt:grid wgt:grid-cols-3 wgt:gap-6",C.appendChild(Q);function E(){Q.innerHTML="",g.forEach(I=>{const D=I.id===A,f=document.createElement("label");f.className=["wgt:relative","wgt:border","wgt:rounded-xl","wgt:p-4","wgt:flex-shrink-0","wgt:cursor-pointer","wgt:bg-white",D?"wgt:border-primary":"wgt:border-grey-6 wgt:hover:border-gray-300"].filter(Boolean).join(" ");const e=document.createElement("div");e.className="wgt:flex wgt:justify-between wgt:items-center";const w=document.createElement("span");w.className=["wgt:text-base","wgt:font-semibold",D?"wgt:text-primary":"wgt:text-"].join(" "),w.innerText=I.name,e.appendChild(w);const{container:i}=p({checked:D,onChange:R=>{R&&(A=I.id,typeof B=="function"&&B(I.id),E())}});e.appendChild(i),f.appendChild(e);const o=document.createElement("div");o.className="wgt:flex wgt:items-center wgt:text-gray-600 wgt:mt-2";const s=document.createElement("div");s.innerHTML=`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
19
|
+
`+E):C.stack=E}catch(I){}}throw C}})}_request(A,B){typeof A=="string"?(B=B||{},B.url=A):B=A||{},B=cA(this.defaults,B);const{transitional:C,paramsSerializer:Q,headers:E}=B;C!==void 0&&ig.assertOptions(C,{silentJSONParsing:fA.transitional(fA.boolean),forcedJSONParsing:fA.transitional(fA.boolean),clarifyTimeoutError:fA.transitional(fA.boolean)},!1),Q!=null&&(n.isFunction(Q)?B.paramsSerializer={serialize:Q}:ig.assertOptions(Q,{encode:fA.function,serialize:fA.function},!0)),B.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?B.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:B.allowAbsoluteUrls=!0),ig.assertOptions(B,{baseUrl:fA.spelling("baseURL"),withXsrfToken:fA.spelling("withXSRFToken")},!0),B.method=(B.method||this.defaults.method||"get").toLowerCase();let I=E&&n.merge(E.common,E[B.method]);E&&n.forEach(["delete","get","head","post","put","patch","common"],M=>{delete E[M]}),B.headers=BA.concat(I,E);const D=[];let f=!0;this.interceptors.request.forEach(function(r){typeof r.runWhen=="function"&&r.runWhen(B)===!1||(f=f&&r.synchronous,D.unshift(r.fulfilled,r.rejected))});const e=[];this.interceptors.response.forEach(function(r){e.push(r.fulfilled,r.rejected)});let w,i=0,o;if(!f){const M=[wC.bind(this),void 0];for(M.unshift.apply(M,D),M.push.apply(M,e),o=M.length,w=Promise.resolve(B);i<o;)w=w.then(M[i++],M[i++]);return w}o=D.length;let s=B;for(i=0;i<o;){const M=D[i++],r=D[i++];try{s=M(s)}catch(t){r.call(this,t);break}}try{w=wC.call(this,s)}catch(M){return Promise.reject(M)}for(i=0,o=e.length;i<o;)w=w.then(e[i++],e[i++]);return w}getUri(A){A=cA(this.defaults,A);const B=_g(A.baseURL,A.url,A.allowAbsoluteUrls);return Ug(B,A.params,A.paramsSerializer)}};n.forEach(["delete","get","head","options"],function(A){YA.prototype[A]=function(B,C){return this.request(cA(C||{},{method:A,url:B,data:(C||{}).data}))}}),n.forEach(["post","put","patch"],function(A){function B(C){return function(E,I,D){return this.request(cA(D||{},{method:A,headers:C?{"Content-Type":"multipart/form-data"}:{},url:E,data:I}))}}YA.prototype[A]=B(),YA.prototype[A+"Form"]=B(!0)});let IQ=class bC{constructor(A){if(typeof A!="function")throw new TypeError("executor must be a function.");let B;this.promise=new Promise(function(E){B=E});const C=this;this.promise.then(Q=>{if(!C._listeners)return;let E=C._listeners.length;for(;E-- >0;)C._listeners[E](Q);C._listeners=null}),this.promise.then=Q=>{let E;const I=new Promise(D=>{C.subscribe(D),E=D}).then(Q);return I.cancel=function(){C.unsubscribe(E)},I},A(function(E,I,D){C.reason||(C.reason=new KA(E,I,D),B(C.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(A){if(this.reason){A(this.reason);return}this._listeners?this._listeners.push(A):this._listeners=[A]}unsubscribe(A){if(!this._listeners)return;const B=this._listeners.indexOf(A);B!==-1&&this._listeners.splice(B,1)}toAbortSignal(){const A=new AbortController,B=C=>{A.abort(C)};return this.subscribe(B),A.signal.unsubscribe=()=>this.unsubscribe(B),A.signal}static source(){let A;return{token:new bC(function(Q){A=Q}),cancel:A}}};function EQ(g){return function(B){return g.apply(null,B)}}function wQ(g){return n.isObject(g)&&g.isAxiosError===!0}const dg={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(dg).forEach(([g,A])=>{dg[A]=g});function iC(g){const A=new YA(g),B=eA(YA.prototype.request,A);return n.extend(B,YA.prototype,A,{allOwnKeys:!0}),n.extend(B,A,null,{allOwnKeys:!0}),B.create=function(Q){return iC(cA(g,Q))},B}const x=iC(SA);x.Axios=YA,x.CanceledError=KA,x.CancelToken=IQ,x.isCancel=Zg,x.VERSION=DC,x.toFormData=Qg,x.AxiosError=O,x.Cancel=x.CanceledError,x.all=function(A){return Promise.all(A)},x.spread=EQ,x.isAxiosError=wQ,x.mergeConfig=cA,x.AxiosHeaders=BA,x.formToJSON=g=>lg(n.isHTMLForm(g)?new FormData(g):g),x.getAdapter=EC.getAdapter,x.HttpStatusCode=dg,x.default=x;const{Axios:WQ,AxiosError:VQ,CanceledError:_Q,isCancel:$Q,CancelToken:AI,VERSION:gI,all:CI,Cancel:BI,isAxiosError:QI,spread:II,toFormData:EI,AxiosHeaders:wI,HttpStatusCode:DI,formToJSON:eI,getAdapter:iI,mergeConfig:fI}=x,zg=x.create({baseURL:"https://stag-invoice-hub.atomsolution.vn",headers:{Accept:"application/json"}});zg.interceptors.request.use(function(g){return g},function(g){return Promise.reject(g)}),zg.interceptors.response.use(function(g){return g.data},function(g){return Promise.reject(g)});function DQ(g){return q(this,null,function*(){if(!g)throw new Error("Tax code is required to fetch tax information.");return yield zg.get(Mg,{params:{tax:g}})})}const eQ=[{value:"VN",label:"Việt Nam"}];function iQ(g,A){let B;return function(...C){clearTimeout(B),B=setTimeout(()=>g.apply(this,C),A)}}function fQ(C){return q(this,arguments,function*({onSubmit:g,registrationData:A,theme:B="default"}){var WA,c,G,U,V,Z,b,h,X,m,QA,sA,nC,MC,tC,oC,vC,sC,rC,JC,PC,RC,kC,cC,YC,dC,zC,HC,OC,GC,FC,uC,aC,jC,LC;const Q=document.createElement("div");Q.className="wgt:flex wgt:flex-col wgt:gap-4 wgt:w-full";const E=document.createElement("form");E.className="wgt:w-full wgt:max-w-[1072px] wgt:mx-auto ",E.addEventListener("submit",z=>{if(z.preventDefault(),!pA())return;const _=aA();typeof g=="function"&&g(_)});const I=document.createElement("div");I.className="wgt:grid wgt:grid-cols-1 wgt:md:grid-cols-2 wgt:gap-8",E.appendChild(I);const D=document.createElement("div");D.className="wgt:space-y-8";const f=document.createElement("div");f.className="wgt:space-y-8",I.appendChild(D),I.appendChild(f);const e=document.createElement("div");e.className="wgt:space-y-2";const w=document.createElement("h3");w.className="wgt:text-lg wgt:font-semibold wgt:mb-2",w.innerText="Thông tin đơn vị",e.appendChild(w),D.appendChild(e);const i=a({name:"taxCode",label:"Mã số thuế",required:!0,placeholder:"",type:"text",value:((c=(WA=A==null?void 0:A.eInvoiceRegistration)==null?void 0:WA.organization)==null?void 0:c.taxCode)||"",readOnly:!1,error:null,onInput:iQ(z=>{const _=z.target.value.trim();_.length>=10?o(_):i.setLoading(!1)},500)});function o(z){return q(this,null,function*(){i.setError(null);try{const _=yield DQ(z);_.error?i.setError(_.error):(M.inputEl.value=_.ten_cty||"",W.inputEl.value=_.nguoi_dai_dien||"",r.inputEl.value=_.dia_chi||"",J.inputEl.value=_.cqthue_ql||"",i.setError(null))}catch(_){i.setError("Lỗi khi lấy thông tin mã số thuế.")}finally{rA()}})}const s=(((U=(G=A==null?void 0:A.eInvoiceRegistration)==null?void 0:G.organization)==null?void 0:U.taxCode)||"").trim();s.length>=10&&o(s),e.appendChild(i.container);const M=a({name:"companyName",label:"Tên công ty",required:!0,error:null,placeholder:"",type:"text",value:((Z=(V=A==null?void 0:A.eInvoiceRegistration)==null?void 0:V.organization)==null?void 0:Z.name)||"",readOnly:!1});e.appendChild(M.container);const r=a({name:"companyAddressDetail",label:"Địa chỉ công ty",required:!0,error:null,placeholder:"",type:"text",value:"",readOnly:!1});e.appendChild(r.container);const t=a({name:"companyTaxAuthorityCode",label:"Mã cơ quan thuế",required:!1,error:null,placeholder:"",type:"text",value:((b=A==null?void 0:A.eInvoiceRegistration)==null?void 0:b.taxAuthorityCode)||"",readOnly:!1});e.appendChild(t.container);const J=a({name:"companyTaxManagement",label:"Cơ quan thuế quản lý",required:!0,error:null,placeholder:"",type:"text",value:((X=(h=A==null?void 0:A.eInvoiceRegistration)==null?void 0:h.organization)==null?void 0:X.taxAuthority)||"",readOnly:!1});e.appendChild(J.container);const R=y({label:"Giấy phép đăng ký kinh doanh",required:!0,file:(A==null?void 0:A.license)||null,onFileChange:z=>{rA()},error:null});e.appendChild(R.container);const v=y({label:"Logo công ty",required:!1,file:(A==null?void 0:A.logo)||null,onFileChange:z=>{},error:null});e.appendChild(v.container);const k=document.createElement("div");k.className="wgt:space-y-2";const Y=document.createElement("h3");Y.className="wgt:text-lg wgt:font-semibold wgt:mb-2",Y.innerText="Thông tin người liên hệ",k.appendChild(Y),D.appendChild(k);const F=a({name:"name",label:"Họ và tên",required:!0,error:null,placeholder:"",type:"text",value:((QA=(m=A==null?void 0:A.eInvoiceRegistration)==null?void 0:m.contactPerson)==null?void 0:QA.name)||""});k.appendChild(F.container);const j=a({name:"email",label:"Email",required:!0,error:null,placeholder:"",type:"email",value:((nC=(sA=A==null?void 0:A.eInvoiceRegistration)==null?void 0:sA.contactPerson)==null?void 0:nC.email)||""});k.appendChild(j.container);const d=a({name:"phone",label:"Số điện thoại",required:!0,error:null,placeholder:"",type:"tel",value:((tC=(MC=A==null?void 0:A.eInvoiceRegistration)==null?void 0:MC.contactPerson)==null?void 0:tC.email)||""});k.appendChild(d.container);const K=a({name:"contactAddressDetail",label:"Địa chỉ thường trú",required:!0,error:null,placeholder:"",type:"text",value:((vC=(oC=A==null?void 0:A.eInvoiceRegistration)==null?void 0:oC.contactPerson)==null?void 0:vC.address)||"",readOnly:!1});k.appendChild(K.container);const P=document.createElement("div");P.className="wgt:space-y-2";const AA=document.createElement("h3");AA.className="wgt:text-lg wgt:font-semibold wgt:mb-2",AA.innerText="Thông tin người đại diện",P.appendChild(AA),f.appendChild(P);const W=a({name:"repName",label:"Họ và tên",required:!0,error:null,placeholder:"",type:"text",value:((rC=(sC=A==null?void 0:A.eInvoiceRegistration)==null?void 0:sC.legalRepresentative)==null?void 0:rC.name)||""}),EA=document.createElement("ul");EA.className="wgt:list-inside wgt:list-disc wgt:-mt-2";const gA=document.createElement("li");gA.className="wgt:text-sm wgt:text-[#8C8C8C]",gA.innerText="Vui lòng kiểm tra và nhập đúng tên người đại diện theo Giấy phép kinh doanh đã tải lên.",EA.appendChild(gA),P.appendChild(W.container),P.appendChild(EA);const nA=a({name:"repDob",label:"Ngày sinh",required:!1,error:null,placeholder:"",type:"date",value:((PC=(JC=A==null?void 0:A.eInvoiceRegistration)==null?void 0:JC.legalRepresentative)==null?void 0:PC.dob)||""});P.appendChild(nA.container);const hA=S({name:"repGender",label:"Giới tính",options:["female","male","other"].map(z=>({value:z,label:z.charAt(0).toUpperCase()+z.slice(1)})),required:!0,value:((kC=(RC=A==null?void 0:A.eInvoiceRegistration)==null?void 0:RC.legalRepresentative)==null?void 0:kC.gender)||"",disabled:!1,error:null,onChange:z=>{z.target.value}});P.appendChild(hA.container);const dA=a({name:"repPhone",label:"Số điện thoại",required:!0,error:null,placeholder:"",type:"tel",value:((YC=(cC=A==null?void 0:A.eInvoiceRegistration)==null?void 0:cC.legalRepresentative)==null?void 0:YC.phone)||""});P.appendChild(dA.container);const XA=a({name:"repIdentity",label:"Số CMND/CCCD",required:!0,error:null,placeholder:"",type:"text",value:((zC=(dC=A==null?void 0:A.eInvoiceRegistration)==null?void 0:dC.legalRepresentative)==null?void 0:zC.identityNumber)||""});P.appendChild(XA.container);const zA=a({name:"repPassport",label:"Số hộ chiếu",required:!1,error:null,placeholder:"",type:"text",value:((OC=(HC=A==null?void 0:A.eInvoiceRegistration)==null?void 0:HC.legalRepresentative)==null?void 0:OC.passportNumber)||""});P.appendChild(zA.container);const bA=S({name:"repNationality",label:"Quốc gia",options:eQ,value:((FC=(GC=A==null?void 0:A.eInvoiceRegistration)==null?void 0:GC.legalRepresentative)==null?void 0:FC.nationality)||"",disabled:!1,error:null,onChange:z=>{z.target.value}});P.appendChild(bA.container);const HA=a({name:"contactAddressDetail",label:"Địa chỉ thường trú",required:!0,error:null,placeholder:"",type:"text",value:((aC=(uC=A==null?void 0:A.eInvoiceRegistration)==null?void 0:uC.legalRepresentative)==null?void 0:aC.permanentAddress)||"",readOnly:!1});P.appendChild(HA.container);const MA=document.createElement("div");MA.className="wgt:space-y-2";const OA=document.createElement("h3");OA.className="wgt:text-lg wgt:font-semibold wgt:mb-2",OA.innerText="Thông tin bổ sung",MA.appendChild(OA),f.appendChild(MA);const ZA=S({name:"hasUsedEInvoice",label:"Đã sử dụng hóa đơn điện tử trước đây?",options:[{value:"yes",label:"Có"},{value:"no",label:"Không"}],required:!0,value:(jC=A==null?void 0:A.eInvoiceRegistration)!=null&&jC.hasUsedEInvoice?"yes":"no",disabled:!1,error:null,onChange:z=>{z.target.value==="yes"?wA.inputEl.removeAttribute("readonly"):(wA.inputEl.value="",wA.inputEl.setAttribute("readonly","true"))}});MA.appendChild(ZA.container);const wA=a({name:"previousEInvoiceProvider",label:"",required:!1,error:null,placeholder:"Nhà cung cấp hóa đơn trước đó (nếu có)",type:"text",value:((LC=A==null?void 0:A.eInvoiceRegistration)==null?void 0:LC.previousEInvoiceProvider)||"",readOnly:!0});MA.appendChild(wA.container);const GA=document.createElement("div");GA.className="wgt:flex wgt:items-center wgt:space-x-2 wgt:mt-4";let FA=!0;const T=document.createElement("div");T.className=["wgt:w-4","wgt:h-4","wgt:mt-1","wgt:border-2","wgt:border-primary","wgt:bg-primary","wgt:rounded","wgt:flex","wgt:items-center","wgt:justify-center","wgt:cursor-pointer","wgt:transition-colors"].join(" ");const uA="http://www.w3.org/2000/svg",tA=document.createElementNS(uA,"svg");tA.setAttribute("viewBox","0 0 24 24"),tA.setAttribute("class","wgt:w-4 wgt:h-4 wgt:text-white");const oA=document.createElementNS(uA,"path");oA.setAttribute("fill-rule","evenodd"),oA.setAttribute("clip-rule","evenodd"),oA.setAttribute("d","M5.23 12.03a.75.75 0 011.06.02L10 15.94l7.71-7.71a.75.75 0 111.06 1.06l-8.24 8.24a.75.75 0 01-1.06 0L5.21 13.09a.75.75 0 01.02-1.06z"),oA.setAttribute("fill","white"),tA.appendChild(oA),T.appendChild(tA);const vA=document.createElement("label");vA.className="wgt:text-sm wgt:text-strong-950 wgt:leading-tight",vA.appendChild(document.createTextNode("Tôi đồng ý với "));const mA=(z,_)=>{const ng=document.createElement("a");return ng.href=_,ng.className="wgt:text-primary wgt:font-semibold wgt:hover:underline",ng.textContent=z,ng};vA.appendChild(mA("Điều khoản","#")),vA.appendChild(document.createTextNode(" và ")),vA.appendChild(mA("Chính sách sử dụng","#")),vA.appendChild(document.createTextNode(` của ${B?B.toUpperCase():"OCB"}.`)),GA.appendChild(T),GA.appendChild(vA),E.appendChild(GA),T.addEventListener("click",()=>{FA=!FA,FA?(T.classList.add("wgt:bg-primary"),tA.classList.remove("wgt:hidden")):(T.classList.remove("wgt:bg-primary"),tA.classList.add("wgt:hidden")),rA()}),Q.appendChild(E);const PA=document.createElement("div");PA.className="wgt:flex wgt:mt-6 wgt:items-center wgt:justify-end wgt:gap-2 ";const RA=document.createElement("button");RA.type="submit",RA.innerText="Tiếp theo",RA.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(" "),PA.appendChild(RA),Q.appendChild(PA);function pA(){const z=aA();return!z.eInvoiceRegistration.organization.name||!z.eInvoiceRegistration.organization.address||!z.eInvoiceRegistration.organization.taxCode||!z.eInvoiceRegistration.organization.taxAuthority||!z.eInvoiceRegistration.contactPerson.name||!z.eInvoiceRegistration.contactPerson.email||!z.eInvoiceRegistration.contactPerson.phone||!z.eInvoiceRegistration.contactPerson.address||!z.eInvoiceRegistration.legalRepresentative.name||!z.eInvoiceRegistration.legalRepresentative.phone||!z.eInvoiceRegistration.legalRepresentative.identityNumber||!z.eInvoiceRegistration.legalRepresentative.permanentAddress||z.eInvoiceRegistration.organization.taxCode.length<10?!1:/^\d{10,11}$/.test(z.eInvoiceRegistration.contactPerson.phone)?/^\d{10,11}$/.test(z.eInvoiceRegistration.legalRepresentative.phone)?/^\d{9,12}$/.test(z.eInvoiceRegistration.legalRepresentative.identityNumber)?/^[\w.-]+@[\w.-]+\.\w{2,}$/.test(z.eInvoiceRegistration.contactPerson.email)?!(!z.license||z.license.length===0):(j.setError("Email không hợp lệ."),!1):(XA.setError("Số CMND/CCCD phải có 9 hoặc 12 chữ số."),!1):(dA.setError("Số điện thoại người đại diện phải có 10 hoặc 11 chữ số."),!1):(d.setError("Số điện thoại liên hệ phải có 10 hoặc 11 chữ số."),!1)}function rA(){RA.disabled=!pA()||!FA}[M,i,r,J,F,j,d,K,W,dA,XA,HA].forEach(z=>{z.inputEl.addEventListener("input",rA)}),[hA].forEach(z=>{z.selectEl.addEventListener("change",rA)}),rA(),RA.addEventListener("click",z=>{if(z.preventDefault(),!pA())return;const _=aA();typeof g=="function"&&g(_)});function aA(){return{eInvoiceRegistration:{taxAuthorityCode:t.getValue(),previousEInvoiceProvider:wA.getValue(),organization:{name:M.getValue(),address:r.getValue(),taxCode:i.getValue(),taxAuthority:J.getValue()},contactPerson:{name:F.getValue(),address:K.getValue(),email:j.getValue(),phone:d.getValue()},legalRepresentative:{name:W.getValue(),dob:nA.getValue(),gender:hA.getValue(),phone:dA.getValue(),identityNumber:XA.getValue(),passportNumber:zA.getValue(),nationality:bA.getValue(),permanentAddress:HA.getValue()},hasUsedEInvoice:ZA.getValue()==="yes"},license:R.getValues(),logo:v.getValues()}}return{container:Q,getValues:aA}})}function nQ(B){return q(this,arguments,function*({providerProps:g,formProps:A}){const C=document.createElement("div");C.className="wgt:flex wgt:flex-col wgt:gap-4 wgt:w-full";const Q=l(g);C.appendChild(Q.container);const{container:E}=yield fQ(A);return C.appendChild(E),{container:C}})}function MQ({value:g="",placeholder:A="Số đơn/tháng",onInputChange:B=void 0}){const C=document.createElement("div");C.className="wgt:flex wgt:flex-col";const Q=document.createElement("div");Q.className="wgt:flex wgt:rounded-lg wgt:border wgt:border-gray-300 wgt:overflow-hidden",C.appendChild(Q);const E=document.createElement("input");E.type="text",E.inputMode="numeric",E.value=g,E.placeholder=A,E.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 B=="function"&&E.addEventListener("input",B),Q.appendChild(E);const I=document.createElement("span");return I.className="wgt:px-4 wgt:py-2 wgt:bg-gray-100 wgt:text-text-sub-600 wgt:flex-shrink-0",I.innerText="đơn/tháng",Q.appendChild(I),{container:C}}function fC({packageOptions:g=[],selectedPackageId:A="",handlePackageSelect:B}={}){const C=document.createElement("div");C.className="wgt:space-y-6";const Q=document.createElement("div");Q.className="wgt:w-full wgt:grid wgt:grid-cols-3 wgt:gap-6",C.appendChild(Q);function E(){Q.innerHTML="",g.forEach(I=>{const D=I.id===A,f=document.createElement("label");f.className=["wgt:relative","wgt:border","wgt:rounded-xl","wgt:p-4","wgt:flex-shrink-0","wgt:cursor-pointer","wgt:bg-white",D?"wgt:border-primary":"wgt:border-grey-6 wgt:hover:border-gray-300"].filter(Boolean).join(" ");const e=document.createElement("div");e.className="wgt:flex wgt:justify-between wgt:items-center";const w=document.createElement("span");w.className=["wgt:text-base","wgt:font-semibold",D?"wgt:text-primary":"wgt:text-"].join(" "),w.innerText=I.name,e.appendChild(w);const{container:i}=p({checked:D,onChange:R=>{R&&(A=I.id,typeof B=="function"&&B(I.id),E())}});e.appendChild(i),f.appendChild(e);const o=document.createElement("div");o.className="wgt:flex wgt:items-center wgt:text-gray-600 wgt:mt-2";const s=document.createElement("div");s.innerHTML=`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
20
20
|
<path d="M15.384 5.76968L6.95352 13.5705C6.6518 13.8497 6.26133 13.9811 5.85312 13.9811C5.46265 13.9811 5.07219 13.8497 4.77047 13.5705L0.546335 9.67832C-0.0571118 9.10352 -0.0571118 8.20026 0.546335 7.64188C1.14978 7.08351 2.1437 7.08351 2.74714 7.64188L5.85312 10.5159L13.1832 3.73324C13.7867 3.17486 14.7806 3.17486 15.384 3.73324C15.9875 4.30804 15.9875 5.2113 15.384 5.76968Z" fill="#008C4F"/>
|
|
21
21
|
</svg>
|
|
22
22
|
`,o.appendChild(s);const M=document.createElement("span");M.className="wgt:ml-2 wgt:text-sm",typeof(I==null?void 0:I.durationYears)=="number"?M.innerText=`Thời hạn: ${I.durationYears} năm`:typeof(I==null?void 0:I.invoiceLimit)=="number"?M.innerText=`${I==null?void 0:I.invoiceLimit.toLocaleString("vi-VN")} hóa đơn điện tử / tháng`:M.innerText="",o.appendChild(M),f.appendChild(o);const r=document.createElement("div");r.className="wgt:mt-4";const t=document.createElement("span");t.className=["wgt:block","wgt:text-2xl","wgt:font-bold",D?"wgt:text-primary":"wgt:text-text-sub-600"].join(" "),t.innerText=JA(I==null?void 0:I.setupFee),r.appendChild(t);const J=document.createElement("span");J.className="wgt:text-sm wgt:text-text-sub-600",J.innerText="VND/Gói",r.appendChild(J),f.appendChild(r),Q.appendChild(f)})}return E(),{container:C,setSelectedPackageId(I){A=I,E()}}}const lA=x.create({baseURL:"https://stag-invoice-api.atomsolution.vn",headers:{Accept:"application/json"}});lA.interceptors.request.use(function(g){return g},function(g){return Promise.reject(g)}),lA.interceptors.response.use(function(g){return g.data},function(g){return Promise.reject(g)});function tQ(A){return q(this,arguments,function*({search:g}){return(yield lA.get(`${IA}`,{params:{isActive:!0,search:g||null}})).data})}function oQ(){return q(this,null,function*(){return lA.get(`${VA}`)})}function vQ(g){return q(this,null,function*(){const A=new FormData;return A.append("eInvoiceRegistration",JSON.stringify(g.eInvoiceRegistration)),A.append("provider",g.provider),A.append("logo",g.logo),yield lA.post(_A,A,{headers:{"Content-Type":"multipart/form-data"}})})}function sQ({name:g,value:A,feeLabel:B,required:C,description:Q}){const E=document.createElement("label");E.className=["wgt:relative","wgt:flex","wgt:items-start","wgt:gap-3","wgt:px-4","wgt:py-3","wgt:-mt-4"].join(" ");const I=document.createElement("input");I.checked=!0,I.type="radio",I.name=g,I.value=A,I.className=["wgt:form-radio","wgt:h-6","wgt:w-6","wgt:border-grey-6","wgt:accent-primary"].join(" "),E.appendChild(I);const D=document.createElement("div");D.className="wgt:flex wgt:flex-col wgt:gap-1";const f=document.createElement("div");f.className="wgt:flex wgt:items-center wgt:gap-2";const e=document.createElement("span");e.className="wgt:text-base wgt:font-semibold wgt:text-text-sub-600 ",e.textContent=B,f.appendChild(e);{const i=document.createElement("span");i.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(" "),i.textContent="Bắt buộc",f.appendChild(i)}D.appendChild(f);const w=document.createElement("p");return w.className="wgt:text-text-soft-400 wgt:text-sm",w.textContent=Q,D.appendChild(w),E.appendChild(D),{container:E}}const TA=[{id:"sig-1y",name:"CKS-1Y",durationYears:1,setupFee:168e4},{id:"sig-2y",name:"CKS-2Y",durationYears:2,setupFee:248e4},{id:"sig-3y",name:"CKS-3Y",durationYears:3,setupFee:28e5}],JA=g=>new Intl.NumberFormat("vi-VN").format(g)+" VND";function fg(g,A,B=3){const C=g.find(I=>I.id===A);if(!C)return g.slice(0,B);const E=g.filter(I=>I.id!==A).slice(0,B-1);return[C,...E]}function rQ(D){return q(this,arguments,function*({onNext:g,onPrev:A,selectedInvoiceOtp:B,selectedSignatureOtp:C,setSelectedInvoiceOtp:Q,setSelectedSignatureOtp:E,setTotalAmount:I}){var rA,aA,WA;const f=yield oQ();let e="",w=B?B.id:f[0].id;const i=f.slice(0,3);let o;i.some(c=>c.id===w)?o=i:o=fg(f,w,3);let s=C?C.id:TA[1].id,M=null,r=1,t=1,J=1;const R=document.createElement("div");R.className="wgt:flex wgt:flex-col wgt:gap-8 wgt:py-8";const v=document.createElement("div");v.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 ",R.appendChild(v);const k=document.createElement("div");k.className="wgt:flex wgt:flex-col wgt:gap-3",v.appendChild(k);const Y=document.createElement("div");Y.className="wgt:flex wgt:flex-col wgt:gap-4",k.appendChild(Y);const F=document.createElement("h2");F.className="wgt:text-xl wgt:font-bold wgt:text-text-black",F.innerText="Chọn gói hóa đơn điện tử",Y.appendChild(F);const j=MQ({value:e,placeholder:((rA=f[0])==null?void 0:rA.invoiceLimit)+" hóa đơn/tháng",onInputChange:c=>{e=c.target.value.replace(/\D/g,""),EA()}});Y.appendChild(j.container);const d=document.createElement("div");d.className="wgt:flex wgt:flex-col wgt:gap-2",k.appendChild(d);const K=document.createElement("h3");K.className="wgt:text-sm wgt:font-semibold wgt:text-[#525866]",K.innerText="Gói phù hợp nhất",d.appendChild(K);const P=document.createElement("div");d.appendChild(P);let AA=null;function W(){if(P.innerHTML="",o.length>0)AA=fC({packageOptions:o,selectedPackageId:w,handlePackageSelect:c=>{w=c;const G=f.slice(0,3);G.some(U=>U.id===w)?o=G:o=fg(f,w,3),W(),T()}}),P.appendChild(AA.container);else{const c=document.createElement("span");c.className="wgt:text-text-sub-600",c.innerText="No package found.",P.appendChild(c),AA=null}}function EA(){return q(this,null,function*(){if(M&&clearTimeout(M),e!=="")M=setTimeout(()=>q(null,null,function*(){const c=e.trim().toLowerCase().replace(/\B(?=(\d{3})+(?!\d))/g,"."),G=yield tQ({search:c});G&&G.length?o=fg(G,w,3):o=[],W(),T()}),500);else{const c=f.slice(0,3);c.some(G=>G.id===w)?o=c:o=fg(f,w,3),W(),T()}})}W();const gA=document.createElement("div");gA.className="wgt:flex wgt:flex-col wgt:gap-4",v.appendChild(gA);const nA=document.createElement("h2");nA.className="wgt:text-xl wgt:font-bold wgt:text-text-black",nA.innerText="Chọn gói chữ ký số",gA.appendChild(nA);const hA=document.createElement("div");gA.appendChild(hA);let dA=fC({packageOptions:TA,selectedPackageId:s,handlePackageSelect:c=>{s=c,dA.setSelectedPackageId(c),T()}});hA.appendChild(dA.container);const{container:XA}=sQ({name:"registrationFee",value:"standard",feeLabel:"Phí đăng ký: 600.000 VND",required:!0,description:"Bản quyền phần mềm hóa đơn điện tử"});v.appendChild(XA);const zA=document.createElement("div");zA.className="wgt:flex wgt:flex-col wgt:gap-2 wgt:-mt-4",v.appendChild(zA);const bA=document.createElement("h3");bA.className="wgt:text-sm wgt:font-semibold wgt:text-text-black",bA.innerText="Sản phẩm đã chọn",zA.appendChild(bA);const HA=document.createElement("div");HA.className="wgt:overflow-x-auto wgt:border wgt:border-soft-200 wgt:rounded-lg",zA.appendChild(HA);const MA=document.createElement("table");MA.className="wgt:min-w-full wgt:table-auto wgt:border-separate",HA.appendChild(MA);const OA=document.createElement("thead");OA.className="wgt:bg-soft-150";const ZA=document.createElement("tr");["Sản phẩm","Đơn vị tính","Số lượng","Đơn giá","Thành tiền"].forEach(c=>{const G=document.createElement("th");G.className="wgt:whitespace-nowrap wgt:px-3 wgt:py-3 wgt:text-left wgt:text-sm wgt:font-semibold wgt:text-text-sub-600",G.innerText=c,ZA.appendChild(G)}),OA.appendChild(ZA),MA.appendChild(OA);const wA=document.createElement("tbody");wA.className="wgt:divide-y wgt:divide-gray-200 wgt:bg-white",MA.appendChild(wA);function GA(c){return f.find(G=>G.id===c)||null}function FA(c){return TA.find(G=>G.id===c)||null}function T(){wA.innerHTML="";{const c=document.createElement("tr"),G=document.createElement("td");G.className="wgt:whitespace-nowrap wgt:px-3 wgt:py-5 wgt:text-sm wgt:text-strong-950 wgt:font-medium",G.innerText="Bản quyền phần mềm Hóa đơn điện tử",c.appendChild(G);const U=document.createElement("td");U.className="wgt:whitespace-nowrap wgt:px-3 wgt:py-5 wgt:text-sm wgt:text-strong-950 wgt:font-medium",U.innerText="Bản",c.appendChild(U);const V=document.createElement("td");V.className="wgt:whitespace-nowrap wgt:px-3 wgt:py-2.5 wgt:text-center";const Z=document.createElement("div");Z.className="wgt:w-full wgt:justify-between wgt:inline-flex wgt:items-center wgt:border wgt:border-soft-200 wgt:p-1.5 wgt:rounded-lg";const b=document.createElement("button");b.type="button",b.ariaLabel="Giảm",b.disabled=!0,b.className="wgt:flex wgt:h-6 wgt:w-6 wgt:items-center wgt:justify-center wgt:rounded-lg wgt:bg-weak-50 wgt:text-strong-950 wgt:cursor-not-allowed wgt:opacity-50",b.innerText="–",b.addEventListener("click",()=>{r>1&&(r-=1,T())}),Z.appendChild(b);const h=document.createElement("input");h.type="text",h.readOnly=!0,h.className="wgt:max-w-10 wgt:text-center wgt:text-sm wgt:font-medium wgt:text-text-black wgt:focus:outline-none",h.value=r,Z.appendChild(h);const X=document.createElement("button");X.type="button",X.ariaLabel="Tăng",X.disabled=!0,X.className="wgt:flex wgt:h-6 wgt:w-6 wgt:items-center wgt:justify-center wgt:rounded-lg wgt:bg-weak-50 wgt:text-strong-950 wgt:cursor-not-allowed wgt:opacity-50",X.innerText="+",X.addEventListener("click",()=>{r+=1,T()}),Z.appendChild(X),V.appendChild(Z),c.appendChild(V);const m=document.createElement("td");m.className="wgt:whitespace-nowrap wgt:px-3 wgt:py-5 wgt:text-left wgt:text-sm wgt:text-strong-950 wgt:font-medium",m.innerText=JA(6e5),c.appendChild(m);const QA=document.createElement("td");QA.className="wgt:whitespace-nowrap wgt:px-3 wgt:py-5 wgt:text-left wgt:text-sm wgt:text-strong-950 wgt:font-medium",QA.innerText=JA(6e5*r),c.appendChild(QA),wA.appendChild(c)}{const c=GA(w);if(c){const G=document.createElement("tr"),U=document.createElement("td");U.className="wgt:whitespace-nowrap wgt:px-3 wgt:py-5 wgt:text-left wgt:text-sm wgt:text-strong-950 wgt:font-medium",U.innerText=c.name,G.appendChild(U);const V=document.createElement("td");V.className="wgt:whitespace-nowrap wgt:px-3 wgt:py-5 wgt:text-left wgt:text-sm wgt:text-strong-950 wgt:font-medium",V.innerText="Gói",G.appendChild(V);const Z=document.createElement("td");Z.className="wgt:whitespace-nowrap wgt:px-4 wgt:py-3 wgt:text-center";const b=document.createElement("div");b.className="wgt:w-full wgt:justify-between wgt:inline-flex wgt:items-center wgt:border wgt:border-soft-200 wgt:p-1.5 wgt:rounded-lg";const h=document.createElement("button");h.type="button",h.ariaLabel="Giảm",h.disabled=t<=1,h.className="wgt:flex wgt:h-6 wgt:w-6 wgt:items-center wgt:justify-center wgt:rounded-lg wgt:bg-weak-50 wgt:text-strong-950"+(t<=1?" wgt:cursor-not-allowed wgt:opacity-50":""),h.innerText="–",h.addEventListener("click",()=>{t>1&&(t-=1,T())}),b.appendChild(h);const X=document.createElement("input");X.type="text",X.readOnly=!0,X.className="wgt:max-w-10 wgt:text-center wgt:text-sm wgt:font-medium wgt:text-text-black wgt:focus:outline-none",X.value=t,b.appendChild(X);const m=document.createElement("button");m.type="button",m.ariaLabel="Tăng",m.className="wgt:flex wgt:h-6 wgt:w-6 wgt:items-center wgt:justify-center wgt:rounded-lg wgt:bg-weak-50 wgt:text-strong-950",m.innerText="+",m.addEventListener("click",()=>{t+=1,T()}),b.appendChild(m),Z.appendChild(b),G.appendChild(Z);const QA=document.createElement("td");QA.className="wgt:whitespace-nowrap wgt:px-3 wgt:py-5 wgt:text-left wgt:text-sm wgt:text-strong-950 wgt:font-medium",QA.innerText=JA(c.setupFee),G.appendChild(QA);const sA=document.createElement("td");sA.className="wgt:whitespace-nowrap wgt:px-3 wgt:py-5 wgt:text-left wgt:text-sm wgt:text-strong-950 wgt:font-medium",sA.innerText=JA(c.setupFee*t),G.appendChild(sA),wA.appendChild(G)}}{const c=FA(s);if(c){const G=document.createElement("tr"),U=document.createElement("td");U.className="wgt:whitespace-nowrap wgt:px-3 wgt:py-5 wgt:text-left wgt:text-sm wgt:text-strong-950 wgt:font-medium",U.innerText=c.name,G.appendChild(U);const V=document.createElement("td");V.className="wgt:whitespace-nowrap wgt:px-3 wgt:py-5 wgt:text-left wgt:text-sm wgt:text-strong-950 wgt:font-medium",V.innerText="Gói",G.appendChild(V);const Z=document.createElement("td");Z.className="wgt:whitespace-nowrap wgt:px-4 wgt:py-3 wgt:text-center";const b=document.createElement("div");b.className="wgt:w-full wgt:justify-between wgt:inline-flex wgt:items-center wgt:border wgt:border-soft-200 wgt:p-1.5 wgt:rounded-lg";const h=document.createElement("button");h.type="button",h.ariaLabel="Giảm",h.disabled=J<=1,h.className="wgt:flex wgt:h-6 wgt:w-6 wgt:items-center wgt:justify-center wgt:rounded-lg wgt:bg-weak-50 wgt:text-strong-950"+(J<=1?" wgt:cursor-not-allowed wgt:opacity-50":""),h.innerText="–",h.addEventListener("click",()=>{J>1&&(J-=1,T())}),b.appendChild(h);const X=document.createElement("input");X.type="text",X.readOnly=!0,X.className="wgt:max-w-10 wgt:text-center wgt:text-sm wgt:font-medium wgt:text-text-black wgt:focus:outline-none",X.value=J,b.appendChild(X);const m=document.createElement("button");m.type="button",m.ariaLabel="Tăng",m.className="wgt:flex wgt:h-6 wgt:w-6 wgt:items-center wgt:justify-center wgt:rounded-lg wgt:bg-weak-50 wgt:text-strong-950",m.innerText="+",m.addEventListener("click",()=>{J+=1,T()}),b.appendChild(m),Z.appendChild(b),G.appendChild(Z);const QA=document.createElement("td");QA.className="wgt:whitespace-nowrap wgt:px-3 wgt:py-5 wgt:text-left wgt:text-sm wgt:text-strong-950 wgt:font-medium",QA.innerText=JA(c.setupFee),G.appendChild(QA);const sA=document.createElement("td");sA.className="wgt:whitespace-nowrap wgt:px-3 wgt:py-5 wgt:text-left wgt:text-sm wgt:text-strong-950 wgt:font-medium",sA.innerText=JA(c.setupFee*J),G.appendChild(sA),wA.appendChild(G)}}{const c=6e5*r,G=GA(w),U=G?G.setupFee*t:0,V=FA(s),Z=V?V.setupFee*J:0,b=c+U+Z;I(b);const h=document.createElement("tr"),X=document.createElement("td");X.colSpan=4,X.className="wgt:whitespace-nowrap wgt:px-3 wgt:py-3 wgt:text-left wgt:text-base wgt:font-semibold wgt:text-strong-950",X.innerText="Tổng cộng",h.appendChild(X);const m=document.createElement("td");m.className="wgt:whitespace-nowrap wgt:px-3 wgt:py-3 wgt:text-left wgt:text-base wgt:font-semibold wgt:text-strong-950",m.innerText=JA(b),h.appendChild(m),wA.appendChild(h)}}T();const uA=document.createElement("div");uA.className="wgt:flex wgt:items-center wgt:gap-4",v.appendChild(uA);const tA=document.createElement("span");tA.className="wgt:text-sm wgt:font-semibold wgt:leading-[18px] wgt:text-text-black",tA.innerText="Hình thức thanh toán:",uA.appendChild(tA);const oA=document.createElement("div");oA.className="wgt:flex wgt:items-center wgt:gap-2 wgt:rounded-[10px] wgt:border wgt:border-soft-200 wgt:bg-transparent wgt:p-2",uA.appendChild(oA);const vA=document.createElement("div");vA.innerHTML=`
|