toku-form-extensions 0.0.5 → 0.0.6
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/components/CustomForm/CustomForm.d.ts.map +1 -1
- package/dist/index.es.js +772 -770
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -64,5 +64,5 @@ ${p} |
|
|
|
64
64
|
${u.line} | ${v}
|
|
65
65
|
${p} | ${Ps("",s.column-1," ")}${Ps("",y,"^")}`}else t+=`
|
|
66
66
|
at ${c}`}return t},Zn.buildMessage=function(e,t){const n={literal(v){return`"${s(v.text)}"`},class(v){const g=v.parts.map(function(y){return Array.isArray(y)?`${u(y[0])}-${u(y[1])}`:u(y)});return`[${v.inverted?"^":""}${g.join("")}]`},any(){return"any character"},end(){return"end of input"},other(v){return v.description}};function i(v){return v.charCodeAt(0).toString(16).toUpperCase()}function s(v){return v.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(g){return`\\x0${i(g)}`}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(g){return`\\x${i(g)}`})}function u(v){return v.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(g){return`\\x0${i(g)}`}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(g){return`\\x${i(g)}`})}function c(v){return n[v.type](v)}function f(v){const g=v.map(c);let y,P;if(g.sort(),g.length>0){for(y=1,P=1;y<g.length;y++)g[y-1]!==g[y]&&(g[P]=g[y],P++);g.length=P}switch(g.length){case 1:return g[0];case 2:return`${g[0]} or ${g[1]}`;default:return`${g.slice(0,-1).join(", ")}, or ${g[g.length-1]}`}}function p(v){return v?`"${s(v)}"`:"end of input"}return`Expected ${f(e)} but ${p(t)} found.`};function U0(e,t){t=t!==void 0?t:{};const n={},i=t.grammarSource,s={Expression:Ft};let u=Ft;const c="+",f="-",p="*",v="/",g="(",y=")",P=",",H="VAR(",V=".",z=/^[a-zA-Z]/,Q=/^[a-zA-Z_]/,K=/^[0-9]/,re=/^[ \t\n\r]/,ee=qe("+",!1),De=qe("-",!1),U=qe("*",!1),R=qe("/",!1),N=qe("(",!1),_e=qe(")",!1),Oe=ei([["a","z"],["A","Z"]],!1,!1),ft=qe(",",!1),Fs=qe("VAR(",!1),zr=ei([["a","z"],["A","Z"],"_"],!1,!1),Ms=ti("integer"),en=ei([["0","9"]],!1,!1),Ts=ti("decimal"),Is=qe(".",!1),tn=ti("whitespace"),Pt=ei([" "," ",`
|
|
67
|
-
`,"\r"],!1,!1),Bs=function(S,B){return B.reduce(function(O,E){if(E[1]==="+")return O+E[3];if(E[1]==="-")return O-E[3]},S)},Jn=function(S,B){return B.reduce(function(O,E){if(E[1]==="*")return O*E[3];if(E[1]==="/")return O/E[3]},S)},ht=function(S){return S},Os=function(S,B){const O=S.join("");if(O==="ROUND")return Bi(B[0],B[1]);if(O==="POWER")return Oi(B[0],B[1]);throw new Error(`Function ${O} is not defined`)},Es=function(S,B){return[S].concat(B.map(O=>O[3]))},Rs=function(S){if(ni.hasOwnProperty(S.join("")))return ni[S.join("")];throw new Error(`Variable ${S.join("")} is not defined`)},mn=function(){return parseInt(Ge(),10)},Gn=function(){return parseFloat(Ge())};let D=0,Ye=0;const Vt=[{line:1,column:1}];let pt=0,gn=[],ae=0,On;if("startRule"in t){if(!(t.startRule in s))throw new Error(`Can't start parsing from rule "${t.startRule}".`);u=s[t.startRule]}function Ge(){return e.substring(Ye,D)}function qe(S,B){return{type:"literal",text:S,ignoreCase:B}}function ei(S,B,O){return{type:"class",parts:S,inverted:B,ignoreCase:O}}function At(){return{type:"end"}}function ti(S){return{type:"other",description:S}}function Vr(S){let B=Vt[S],O;if(B)return B;for(O=S-1;!Vt[O];)O--;for(B=Vt[O],B={line:B.line,column:B.column};O<S;)e.charCodeAt(O)===10?(B.line++,B.column=1):B.column++,O++;return Vt[S]=B,B}function bn(S,B,O){const E=Vr(S),se=Vr(B),G={source:i,start:{offset:S,line:E.line,column:E.column},end:{offset:B,line:se.line,column:se.column}};return O&&i&&typeof i.offset=="function"&&(G.start=i.offset(G.start),G.end=i.offset(G.end)),G}function te(S){D<pt||(D>pt&&(pt=D,gn=[]),gn.push(S))}function En(S,B,O){return new Zn(Zn.buildMessage(S,B),S,B,O)}function Ft(){let S,B,O,E,se,G,Ne,Ce;if(S=D,B=Mi(),B!==n){for(O=[],E=D,se=Pe(),e.charCodeAt(D)===43?(G=c,D++):(G=n,ae===0&&te(ee)),G===n&&(e.charCodeAt(D)===45?(G=f,D++):(G=n,ae===0&&te(De))),G!==n?(Ne=Pe(),Ce=Mi(),Ce!==n?(se=[se,G,Ne,Ce],E=se):(D=E,E=n)):(D=E,E=n);E!==n;)O.push(E),E=D,se=Pe(),e.charCodeAt(D)===43?(G=c,D++):(G=n,ae===0&&te(ee)),G===n&&(e.charCodeAt(D)===45?(G=f,D++):(G=n,ae===0&&te(De))),G!==n?(Ne=Pe(),Ce=Mi(),Ce!==n?(se=[se,G,Ne,Ce],E=se):(D=E,E=n)):(D=E,E=n);Ye=S,S=Bs(B,O)}else D=S,S=n;return S}function Mi(){let S,B,O,E,se,G,Ne,Ce;if(S=D,B=nn(),B!==n){for(O=[],E=D,se=Pe(),e.charCodeAt(D)===42?(G=p,D++):(G=n,ae===0&&te(U)),G===n&&(e.charCodeAt(D)===47?(G=v,D++):(G=n,ae===0&&te(R))),G!==n?(Ne=Pe(),Ce=nn(),Ce!==n?(se=[se,G,Ne,Ce],E=se):(D=E,E=n)):(D=E,E=n);E!==n;)O.push(E),E=D,se=Pe(),e.charCodeAt(D)===42?(G=p,D++):(G=n,ae===0&&te(U)),G===n&&(e.charCodeAt(D)===47?(G=v,D++):(G=n,ae===0&&te(R))),G!==n?(Ne=Pe(),Ce=nn(),Ce!==n?(se=[se,G,Ne,Ce],E=se):(D=E,E=n)):(D=E,E=n);Ye=S,S=Jn(B,O)}else D=S,S=n;return S}function nn(){let S,B,O,E;return S=D,e.charCodeAt(D)===40?(B=g,D++):(B=n,ae===0&&te(N)),B!==n?(Pe(),O=Ft(),O!==n?(Pe(),e.charCodeAt(D)===41?(E=y,D++):(E=n,ae===0&&te(_e)),E!==n?(Ye=S,S=ht(O)):(D=S,S=n)):(D=S,S=n)):(D=S,S=n),S===n&&(S=yn(),S===n&&(S=Ii(),S===n&&(S=Ti(),S===n&&(S=Ns())))),S}function Ns(){let S,B,O,E,se;if(S=D,B=[],z.test(e.charAt(D))?(O=e.charAt(D),D++):(O=n,ae===0&&te(Oe)),O!==n)for(;O!==n;)B.push(O),z.test(e.charAt(D))?(O=e.charAt(D),D++):(O=n,ae===0&&te(Oe));else B=n;return B!==n?(e.charCodeAt(D)===40?(O=g,D++):(O=n,ae===0&&te(N)),O!==n?(Pe(),E=Rn(),E===n&&(E=null),Pe(),e.charCodeAt(D)===41?(se=y,D++):(se=n,ae===0&&te(_e)),se!==n?(Ye=S,S=Os(B,E)):(D=S,S=n)):(D=S,S=n)):(D=S,S=n),S}function Rn(){let S,B,O,E,se,G,Ne,Ce;if(S=D,B=Ft(),B!==n){for(O=[],E=D,se=Pe(),e.charCodeAt(D)===44?(G=P,D++):(G=n,ae===0&&te(ft)),G!==n?(Ne=Pe(),Ce=Ft(),Ce!==n?(se=[se,G,Ne,Ce],E=se):(D=E,E=n)):(D=E,E=n);E!==n;)O.push(E),E=D,se=Pe(),e.charCodeAt(D)===44?(G=P,D++):(G=n,ae===0&&te(ft)),G!==n?(Ne=Pe(),Ce=Ft(),Ce!==n?(se=[se,G,Ne,Ce],E=se):(D=E,E=n)):(D=E,E=n);Ye=S,S=Es(B,O)}else D=S,S=n;return S}function yn(){let S,B,O,E;if(S=D,e.substr(D,4)===H?(B=H,D+=4):(B=n,ae===0&&te(Fs)),B!==n){if(O=[],Q.test(e.charAt(D))?(E=e.charAt(D),D++):(E=n,ae===0&&te(zr)),E!==n)for(;E!==n;)O.push(E),Q.test(e.charAt(D))?(E=e.charAt(D),D++):(E=n,ae===0&&te(zr));else O=n;O!==n?(e.charCodeAt(D)===41?(E=y,D++):(E=n,ae===0&&te(_e)),E!==n?(Ye=S,S=Rs(O)):(D=S,S=n)):(D=S,S=n)}else D=S,S=n;return S}function Ti(){let S,B,O;if(ae++,S=D,Pe(),B=[],K.test(e.charAt(D))?(O=e.charAt(D),D++):(O=n,ae===0&&te(en)),O!==n)for(;O!==n;)B.push(O),K.test(e.charAt(D))?(O=e.charAt(D),D++):(O=n,ae===0&&te(en));else B=n;return B!==n?(Ye=S,S=mn()):(D=S,S=n),ae--,S===n&&ae===0&&te(Ms),S}function Ii(){let S,B,O,E,se;if(ae++,S=D,Pe(),B=[],K.test(e.charAt(D))?(O=e.charAt(D),D++):(O=n,ae===0&&te(en)),O!==n)for(;O!==n;)B.push(O),K.test(e.charAt(D))?(O=e.charAt(D),D++):(O=n,ae===0&&te(en));else B=n;if(B!==n)if(e.charCodeAt(D)===46?(O=V,D++):(O=n,ae===0&&te(Is)),O!==n){if(E=[],K.test(e.charAt(D))?(se=e.charAt(D),D++):(se=n,ae===0&&te(en)),se!==n)for(;se!==n;)E.push(se),K.test(e.charAt(D))?(se=e.charAt(D),D++):(se=n,ae===0&&te(en));else E=n;E!==n?(Ye=S,S=Gn()):(D=S,S=n)}else D=S,S=n;else D=S,S=n;return ae--,S===n&&ae===0&&te(Ts),S}function Pe(){let S,B;for(ae++,S=[],re.test(e.charAt(D))?(B=e.charAt(D),D++):(B=n,ae===0&&te(Pt));B!==n;)S.push(B),re.test(e.charAt(D))?(B=e.charAt(D),D++):(B=n,ae===0&&te(Pt));return ae--,B=n,ae===0&&te(tn),S}const ni=t.variables||{};function Bi(S,B){const O=Math.pow(10,B);return Math.round(S*O)/O}function Oi(S,B){return Math.pow(S,B)}if(On=u(),On!==n&&D===e.length)return On;throw On!==n&&D<e.length&&te(At()),En(gn,pt<e.length?e.charAt(pt):null,pt<e.length?bn(pt,pt+1):bn(pt,pt))}const K0=U0;function Nc(e,t){try{return K0(e,{variables:t})}catch{return e}}function Lc(e){if(e)T.provide("fields",e);else if(e=T.inject("fields"),!e)throw new Error("Fields were not provided");const t=n=>{if(n.relatedField){const i=e==null?void 0:e.value.find(({name:s,value:u})=>n.relatedField===s&&n.relatedFieldValue===u);return i?t(i):!1}return!0};return{shouldShowField:t}}function As(e){return typeof e=="string"?e.replace(/^0+|[^0-9kK]+/g,"").toUpperCase():""}function X0(e){if(typeof e!="string"||!/^0*(\d{1,3}(\.?\d{3})*)-?([\dkK])$/.test(e))return!1;e=As(e);for(var t=parseInt(e.slice(0,-1),10),n=0,i=1;t>0;)i=(i+t%10*(9-n++%6))%11,t=Math.floor(t/10);var s=i>0?""+(i-1):"K";return s===e.slice(-1)}function Q0(e){e=As(e);for(var t=e.slice(-4,-1)+"-"+e.substr(e.length-1),n=4;n<e.length;n+=3)t=e.slice(-3-n,-n)+"."+t;return t}var Z0={validate:X0,clean:As,format:Q0};const J0={CL:{governmentIdCleaner:Z0.clean},MX:{}};function G0(){return{cleanGovernmentId:(t,n)=>{if(t&&n){const i=J0[n].governmentIdCleaner;return i?i(t):t}return t}}}const ew=e=>typeof e=="string",tw=e=>e instanceof Date,jc=e=>`0${e}`.slice(-2),nw=e=>`${e.getFullYear()}-${jc(e.getMonth()+1)}-${jc(e.getDate())}`,D2="",iw=T.defineComponent({__name:"SignupField",props:{id:null,value:null,label:null,disabled:{type:Boolean},displayInfo:{type:Boolean},type:null,decimals:null,leftIcon:null,rightIcon:null,placeholder:null,helperText:null,errorText:null,required:{type:Boolean},regex:null},emits:["input","right-icon-click"],setup(e,{emit:t}){const n=e;T.use(jl);const i=T.ref(!1),s=T.ref(!1),u=T.computed(()=>{var V;return s.value?"Obligatorio":n.errorText||((V=n.regex)==null?void 0:V.message)}),c=T.computed(()=>n.placeholder||""),f=T.computed(()=>i.value?u.value:n.helperText),p=T.computed(()=>{let V="";return n.leftIcon&&(V+="padding-left"),n.rightIcon&&(V+=" padding-right"),i.value&&(V+=" input-error"),V}),v=T.computed(()=>{let V="t-field__helper-text";return i.value&&(V+=" error"),V}),g=()=>{n.regex&&typeof n.value=="string"?i.value=!RegExp(n.regex.pattern).test(n.value):n.required&&(i.value=!n.value,s.value=!n.value)};return T.watch(()=>n.value,g),{__sfc:!0,props:n,emits:t,isError:i,displayRequired:s,errorText:u,placeholder:c,lowerLabel:f,inputClass:p,lowerLabelClass:v,validate:g,handleInput:V=>{t("input",V.target.value)},handleDatePicker:V=>{t("input",V)},handleRightIconClick:()=>{t("right-icon-click")},Icon:_n}}}),P2="";function jr(e,t,n,i,s,u,c,f){var p=typeof e=="function"?e.options:e;t&&(p.render=t,p.staticRenderFns=n,p._compiled=!0),i&&(p.functional=!0),u&&(p._scopeId="data-v-"+u);var v;if(c?(v=function(P){P=P||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!P&&typeof __VUE_SSR_CONTEXT__<"u"&&(P=__VUE_SSR_CONTEXT__),s&&s.call(this,P),P&&P._registeredComponents&&P._registeredComponents.add(c)},p._ssrRegister=v):s&&(v=f?function(){s.call(this,(p.functional?this.parent:this).$root.$options.shadowRoot)}:s),v)if(p.functional){p._injectStyles=v;var g=p.render;p.render=function(H,V){return v.call(V),g(H,V)}}else{var y=p.beforeCreate;p.beforeCreate=y?[].concat(y,v):[v]}return{exports:e,options:p}}var rw=function(){var t=this,n=t._self._c,i=t._self._setupProxy;return n("div",{staticClass:"t-field"},[n("link",{attrs:{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/@mdi/font@5.8.55/css/materialdesignicons.min.css"}}),t.label?n("label",{staticClass:"t-field__label",attrs:{for:t.id}},[t._v(t._s(t.label))]):t._e(),t.displayInfo?n("div",[n("p",{staticClass:"display-info"},[t._v(" "+t._s(t.value)+" ")])]):n("div",{staticClass:"t-field__input-container"},[n("div",{staticClass:"t-field__icon t-field__icon--right",attrs:{role:"button",tabindex:"0"},on:{click:i.handleRightIconClick,keydown:function(s){return!s.type.indexOf("key")&&t._k(s.keyCode,"enter",13,s.key,"Enter")?null:i.handleRightIconClick.apply(null,arguments)}}},[t.rightIcon?n(i.Icon,{attrs:{icon:t.rightIcon,color:"black"}}):t._e()],1),t.leftIcon?n(i.Icon,{staticClass:"t-field__icon t-field__icon--left",attrs:{icon:t.leftIcon,color:"black"}}):t._e(),t.type==="date"?n("b-datepicker",{staticClass:"date-class",attrs:{value:t.value,locale:"es-ES"},on:{input:i.handleDatePicker}}):n("input",{staticClass:"t-field__input",class:i.inputClass,attrs:{id:t.id,placeholder:i.placeholder,type:t.type,disabled:t.disabled},domProps:{value:t.value},on:{input:i.handleInput}})],1),n("p",{class:i.lowerLabelClass,attrs:{for:t.id}},[t._v(t._s(i.lowerLabel))])])},aw=[],sw=jr(iw,rw,aw,!1,null,"9317989a",null,null);const ow=sw.exports,uw=T.defineComponent({__name:"SignupFields",props:{fieldsType:null,title:null,fields:null,autocomplete:{type:Boolean},accounts:null},emits:["input","search"],setup(e,{emit:t}){const n=e,i=(y,P)=>{t("input",{id:y,value:P})},{shouldShowField:s}=Lc(),u=T.computed(()=>n.fields.filter(s)),c=T.computed(()=>{const y={};return u.value.forEach(P=>{y[P.name]=P.value}),y});return{__sfc:!0,props:n,emit:t,handleInput:i,shouldShowField:s,fieldsToShow:u,variables:c,getFieldValue:y=>y.displayInfo&&ew(y.value)?Nc(y.value,c.value):y.value,isFieldSearchable:y=>y.isExternalId&&n.autocomplete,handleRightIconClick:()=>{t("search")},retrocompatibleIcon:y=>y==="DollarIcon"?"solar:dollar-outline":y,TTypography:Rc,TSelect:Y0,SignupFieldComponent:ow}}}),A2="";var lw=function(){var t=this,n=t._self._c,i=t._self._setupProxy;return n("div",{staticClass:"form"},[n(i.TTypography,{attrs:{variant:"s2","font-weight":"medium"}},[t._v(" "+t._s(t.title)+" ")]),n("div",{staticClass:"form__base"},[t._l(i.fieldsToShow,function(s){var u,c;return[t.fieldsType==="invoice"&&s.isAccount?n(i.TSelect,{key:s.id||s.name,staticClass:"t-select",attrs:{placeholder:s.placeholder,label:s.label,value:(u=s.value)==null?void 0:u.toString(),"helper-text":s.helperText},on:{input:f=>i.handleInput(s.id||s.id||s.name,f)}},t._l(t.accounts,function({id:f,name:p}){return n("option",{key:f,domProps:{value:f}},[t._v(" "+t._s(p)+" ")])}),0):s.defaultOptions!==void 0?n(i.TSelect,{key:s.id||s.name,staticClass:"t-select",attrs:{placeholder:s.placeholder,label:s.label,value:(c=s.value)==null?void 0:c.toString(),"helper-text":s.helperText},on:{input:f=>i.handleInput(s.id||s.name,f)}},t._l(s.defaultOptions,function(f){return n("option",{key:f.toString(),domProps:{value:f.toString()}},[t._v(" "+t._s(f)+" ")])}),0):n(i.SignupFieldComponent,{key:s.name,attrs:{id:s.id||s.name,value:i.getFieldValue(s),type:s.type,label:s.label,placeholder:s.placeholder,decimals:s.decimals,"helper-text":s.helperText,"left-icon":i.retrocompatibleIcon(s.leftIcon),required:s.required,regex:s.regex,"display-info":s.displayInfo,"right-icon":i.isFieldSearchable(s)?"ph:magnifying-glass":void 0},on:{input:f=>i.handleInput(s.id||s.name,f),"right-icon-click":function(f){i.isFieldSearchable(s)&&i.handleRightIconClick()}}})]})],2)],1)},cw=[],dw=jr(uw,lw,cw,!1,null,"78b11c27",null,null);const fw=dw.exports,hw=T.defineComponent({__name:"SignupCompleted",props:{type:{default:"success"},errorMessage:null,errorButtonLabel:null,successMessage:null,successButtonLabel:null},emits:["reset"],setup(e){const t=e,n=T.computed(()=>t.type==="error"?t.errorMessage:t.successMessage),i=T.computed(()=>t.type==="error"?t.errorButtonLabel:t.successButtonLabel);return{__sfc:!0,props:t,message:n,buttonText:i,TButton:Ec,TTypography:Rc}}}),F2="";var pw=function(){var t=this,n=t._self._c,i=t._self._setupProxy;return n("div",{staticClass:"success-form"},[n(i.TTypography,{attrs:{variant:"h1"}},[t._v(" "+t._s(i.message)+" ")]),n(i.TButton,{attrs:{variant:"secondary"},on:{click:function(s){return t.$emit("reset")}}},[t._v(" "+t._s(i.buttonText)+" ")])],1)},_w=[],vw=jr(hw,pw,_w,!1,null,"dd9e3f67",null,null);const mw=vw.exports,gw=T.defineComponent({__name:"CustomForm",props:{customerFields:null,invoiceFields:null,showSendByEmail:{type:Boolean},countryIso:null,disableSubmit:{type:Boolean},isLoading:{type:Boolean},submitFormStatus:null,signupCompleted:{type:Boolean},isAutocompleteEnabled:{type:Boolean},accounts:null,invoiceFieldsTitle:{default:"Plan de pagos"},customerFieldsTitle:{default:"Información Cliente"},buttonLabel:{default:"Registrar"},sendByEmailText:{default:"Enviar información a correo electrónico"},errorMessage:{default:"Error en la creación"},errorButtonLabel:{default:"Intentar nuevamente"},successMessage:{default:"Inscripción exitosa"},successButtonLabel:{default:"Registrar nuevo cliente"},isPaymentPortal:{type:Boolean,default:!1}},emits:["submit-form-data","reset","autocomplete-subscription","autocomplete-external-id"],setup(e,{emit:t}){const n=e;T.use(jl);const i=T.ref(n.customerFields),s=T.ref(n.invoiceFields),u=T.ref(n.isLoading),c=T.ref(n.submitFormStatus),f=T.ref(n.signupCompleted),p=T.ref(n.errorMessage),v=T.ref(n.isAutocompleteEnabled),g=T.ref(!n.showSendByEmail),y=T.computed(()=>[...i.value,...s.value]),{shouldShowField:P}=Lc(y),{cleanGovernmentId:H}=G0();T.watch(n,U=>{i.value=U.customerFields,s.value=U.invoiceFields,u.value=U.isLoading,c.value=U.submitFormStatus,f.value=U.signupCompleted,p.value=U.errorMessage,v.value=U.isAutocompleteEnabled});const V=(U,R)=>U.type==="number"&&U.decimals?(Math.round(Number(R)*10**U.decimals)/10**U.decimals).toString():R,z=()=>{const U=i.value.find(({isExternalId:R})=>R);t("autocomplete-external-id",U==null?void 0:U.value)},Q=(U,{id:R,value:N})=>{const _e=U.findIndex(Oe=>R===Oe.id||R===Oe.name);if(_e!==-1){const Oe=U[_e];T.set(Oe,"value",V(Oe,N)),Oe.name==="product_id"&&v.value&&t("autocomplete-subscription",N)}},K=()=>{const U={};return y.value.forEach(R=>{P(R)&&(U[R.name]=R.value)}),U},re=()=>{const U=K(),R={additional_data:{},customer_metadata:{},subscription_metadata:{},invoice_metadata:{},send_mail:g.value};return y.value.forEach(N=>{if(N.value){if(N.relatedField&&!P(N))return;let{value:_e}=N;N.displayInfo&&(_e=Nc(_e,U)),N.name.includes("customer_metadata")?R.customer_metadata[N.name.replace("customer_metadata_","")]=_e:N.name.includes("subscription_metadata")?R.subscription_metadata[N.name.replace("subscription_metadata_","")]=_e:N.name.includes("invoice_metadata")?R.invoice_metadata[N.name.replace("invoice_metadata_","")]=_e:N.name.includes("additional_data")?R.additional_data[N.name.replace("additional_data_","")]=_e:N.name==="government_id"&&n.countryIso==="CL"?R[N.name]=H(_e,n.countryIso):N.name==="due_date"&&tw(_e)?R[N.name]=nw(_e):N.isAccount?R.id_account=_e:R[N.name]=_e}}),R},ee=()=>{let U=!0;return y.value.forEach(R=>{const N=R.required&&(R.value===void 0||R.value==="")&&(!R.relatedField||P(R)),_e=R.regex&&!RegExp(R.regex.pattern).test(R.value);(N||_e)&&(U=!1)}),U};return{__sfc:!0,props:n,emit:t,customerFields:i,invoiceFields:s,isLoading:u,submitFormStatus:c,signupCompleted:f,errorMessage:p,isAutocompleteEnabled:v,sendEmail:g,allFields:y,shouldShowField:P,cleanGovernmentId:H,formatFieldValue:V,handleSearch:z,handleInput:Q,getVariables:K,buildSignupRequestBody:re,validateFormValues:ee,submitForm:()=>{if(!ee())return;const R=re();t("submit-form-data",R)},TButton:Ec,SignupFields:fw,SignupCompleted:mw}}}),M2="";var bw=function(){var t=this,n=t._self._c,i=t._self._setupProxy;return n("main",[n("transition",{attrs:{name:"slide-fade",mode:"out-in"}},[i.signupCompleted?n(i.SignupCompleted,{attrs:{type:i.submitFormStatus,"error-message":i.errorMessage,"error-button-label":t.errorButtonLabel,"success-message":t.successMessage,"success-button-label":t.successButtonLabel},on:{reset:function(s){return i.emit("reset")}}}):n("div",{staticClass:"custom-form"},[n("div",{class:[t.isPaymentPortal?"portal-payment":"backoffice"]},[n(i.SignupFields,{attrs:{fields:i.customerFields,"fields-type":"customer",title:t.customerFieldsTitle,autocomplete:i.isAutocompleteEnabled,accounts:t.accounts},on:{input:s=>i.handleInput(i.customerFields,s),search:i.handleSearch}}),n(i.SignupFields,{attrs:{fields:i.invoiceFields,"fields-type":"invoice",title:t.invoiceFieldsTitle,accounts:t.accounts},on:{input:s=>i.handleInput(i.invoiceFields,s)}})],1),n("div",[t.showSendByEmail?n("b-checkbox",{attrs:{id:"send_email"},model:{value:i.sendEmail,callback:function(s){i.sendEmail=s},expression:"sendEmail"}},[t._v(" "+t._s(t.sendByEmailText)+" ")]):t._e()],1),n("div",[n(i.TButton,{attrs:{disabled:t.disableSubmit,size:"medium",loading:i.isLoading},on:{click:i.submitForm}},[t._v(" "+t._s(t.buttonLabel)+" ")])],1)])],1)],1)},yw=[],$w=jr(gw,bw,yw,!1,null,"f98c5b78",null,null);const ww=$w.exports;Fn.CustomForm=ww,Object.defineProperty(Fn,Symbol.toStringTag,{value:"Module"})});
|
|
67
|
+
`,"\r"],!1,!1),Bs=function(S,B){return B.reduce(function(O,E){if(E[1]==="+")return O+E[3];if(E[1]==="-")return O-E[3]},S)},Jn=function(S,B){return B.reduce(function(O,E){if(E[1]==="*")return O*E[3];if(E[1]==="/")return O/E[3]},S)},ht=function(S){return S},Os=function(S,B){const O=S.join("");if(O==="ROUND")return Bi(B[0],B[1]);if(O==="POWER")return Oi(B[0],B[1]);throw new Error(`Function ${O} is not defined`)},Es=function(S,B){return[S].concat(B.map(O=>O[3]))},Rs=function(S){if(ni.hasOwnProperty(S.join("")))return ni[S.join("")];throw new Error(`Variable ${S.join("")} is not defined`)},mn=function(){return parseInt(Ge(),10)},Gn=function(){return parseFloat(Ge())};let D=0,Ye=0;const Vt=[{line:1,column:1}];let pt=0,gn=[],ae=0,On;if("startRule"in t){if(!(t.startRule in s))throw new Error(`Can't start parsing from rule "${t.startRule}".`);u=s[t.startRule]}function Ge(){return e.substring(Ye,D)}function qe(S,B){return{type:"literal",text:S,ignoreCase:B}}function ei(S,B,O){return{type:"class",parts:S,inverted:B,ignoreCase:O}}function At(){return{type:"end"}}function ti(S){return{type:"other",description:S}}function Vr(S){let B=Vt[S],O;if(B)return B;for(O=S-1;!Vt[O];)O--;for(B=Vt[O],B={line:B.line,column:B.column};O<S;)e.charCodeAt(O)===10?(B.line++,B.column=1):B.column++,O++;return Vt[S]=B,B}function bn(S,B,O){const E=Vr(S),se=Vr(B),G={source:i,start:{offset:S,line:E.line,column:E.column},end:{offset:B,line:se.line,column:se.column}};return O&&i&&typeof i.offset=="function"&&(G.start=i.offset(G.start),G.end=i.offset(G.end)),G}function te(S){D<pt||(D>pt&&(pt=D,gn=[]),gn.push(S))}function En(S,B,O){return new Zn(Zn.buildMessage(S,B),S,B,O)}function Ft(){let S,B,O,E,se,G,Ne,Ce;if(S=D,B=Mi(),B!==n){for(O=[],E=D,se=Pe(),e.charCodeAt(D)===43?(G=c,D++):(G=n,ae===0&&te(ee)),G===n&&(e.charCodeAt(D)===45?(G=f,D++):(G=n,ae===0&&te(De))),G!==n?(Ne=Pe(),Ce=Mi(),Ce!==n?(se=[se,G,Ne,Ce],E=se):(D=E,E=n)):(D=E,E=n);E!==n;)O.push(E),E=D,se=Pe(),e.charCodeAt(D)===43?(G=c,D++):(G=n,ae===0&&te(ee)),G===n&&(e.charCodeAt(D)===45?(G=f,D++):(G=n,ae===0&&te(De))),G!==n?(Ne=Pe(),Ce=Mi(),Ce!==n?(se=[se,G,Ne,Ce],E=se):(D=E,E=n)):(D=E,E=n);Ye=S,S=Bs(B,O)}else D=S,S=n;return S}function Mi(){let S,B,O,E,se,G,Ne,Ce;if(S=D,B=nn(),B!==n){for(O=[],E=D,se=Pe(),e.charCodeAt(D)===42?(G=p,D++):(G=n,ae===0&&te(U)),G===n&&(e.charCodeAt(D)===47?(G=v,D++):(G=n,ae===0&&te(R))),G!==n?(Ne=Pe(),Ce=nn(),Ce!==n?(se=[se,G,Ne,Ce],E=se):(D=E,E=n)):(D=E,E=n);E!==n;)O.push(E),E=D,se=Pe(),e.charCodeAt(D)===42?(G=p,D++):(G=n,ae===0&&te(U)),G===n&&(e.charCodeAt(D)===47?(G=v,D++):(G=n,ae===0&&te(R))),G!==n?(Ne=Pe(),Ce=nn(),Ce!==n?(se=[se,G,Ne,Ce],E=se):(D=E,E=n)):(D=E,E=n);Ye=S,S=Jn(B,O)}else D=S,S=n;return S}function nn(){let S,B,O,E;return S=D,e.charCodeAt(D)===40?(B=g,D++):(B=n,ae===0&&te(N)),B!==n?(Pe(),O=Ft(),O!==n?(Pe(),e.charCodeAt(D)===41?(E=y,D++):(E=n,ae===0&&te(_e)),E!==n?(Ye=S,S=ht(O)):(D=S,S=n)):(D=S,S=n)):(D=S,S=n),S===n&&(S=yn(),S===n&&(S=Ii(),S===n&&(S=Ti(),S===n&&(S=Ns())))),S}function Ns(){let S,B,O,E,se;if(S=D,B=[],z.test(e.charAt(D))?(O=e.charAt(D),D++):(O=n,ae===0&&te(Oe)),O!==n)for(;O!==n;)B.push(O),z.test(e.charAt(D))?(O=e.charAt(D),D++):(O=n,ae===0&&te(Oe));else B=n;return B!==n?(e.charCodeAt(D)===40?(O=g,D++):(O=n,ae===0&&te(N)),O!==n?(Pe(),E=Rn(),E===n&&(E=null),Pe(),e.charCodeAt(D)===41?(se=y,D++):(se=n,ae===0&&te(_e)),se!==n?(Ye=S,S=Os(B,E)):(D=S,S=n)):(D=S,S=n)):(D=S,S=n),S}function Rn(){let S,B,O,E,se,G,Ne,Ce;if(S=D,B=Ft(),B!==n){for(O=[],E=D,se=Pe(),e.charCodeAt(D)===44?(G=P,D++):(G=n,ae===0&&te(ft)),G!==n?(Ne=Pe(),Ce=Ft(),Ce!==n?(se=[se,G,Ne,Ce],E=se):(D=E,E=n)):(D=E,E=n);E!==n;)O.push(E),E=D,se=Pe(),e.charCodeAt(D)===44?(G=P,D++):(G=n,ae===0&&te(ft)),G!==n?(Ne=Pe(),Ce=Ft(),Ce!==n?(se=[se,G,Ne,Ce],E=se):(D=E,E=n)):(D=E,E=n);Ye=S,S=Es(B,O)}else D=S,S=n;return S}function yn(){let S,B,O,E;if(S=D,e.substr(D,4)===H?(B=H,D+=4):(B=n,ae===0&&te(Fs)),B!==n){if(O=[],Q.test(e.charAt(D))?(E=e.charAt(D),D++):(E=n,ae===0&&te(zr)),E!==n)for(;E!==n;)O.push(E),Q.test(e.charAt(D))?(E=e.charAt(D),D++):(E=n,ae===0&&te(zr));else O=n;O!==n?(e.charCodeAt(D)===41?(E=y,D++):(E=n,ae===0&&te(_e)),E!==n?(Ye=S,S=Rs(O)):(D=S,S=n)):(D=S,S=n)}else D=S,S=n;return S}function Ti(){let S,B,O;if(ae++,S=D,Pe(),B=[],K.test(e.charAt(D))?(O=e.charAt(D),D++):(O=n,ae===0&&te(en)),O!==n)for(;O!==n;)B.push(O),K.test(e.charAt(D))?(O=e.charAt(D),D++):(O=n,ae===0&&te(en));else B=n;return B!==n?(Ye=S,S=mn()):(D=S,S=n),ae--,S===n&&ae===0&&te(Ms),S}function Ii(){let S,B,O,E,se;if(ae++,S=D,Pe(),B=[],K.test(e.charAt(D))?(O=e.charAt(D),D++):(O=n,ae===0&&te(en)),O!==n)for(;O!==n;)B.push(O),K.test(e.charAt(D))?(O=e.charAt(D),D++):(O=n,ae===0&&te(en));else B=n;if(B!==n)if(e.charCodeAt(D)===46?(O=V,D++):(O=n,ae===0&&te(Is)),O!==n){if(E=[],K.test(e.charAt(D))?(se=e.charAt(D),D++):(se=n,ae===0&&te(en)),se!==n)for(;se!==n;)E.push(se),K.test(e.charAt(D))?(se=e.charAt(D),D++):(se=n,ae===0&&te(en));else E=n;E!==n?(Ye=S,S=Gn()):(D=S,S=n)}else D=S,S=n;else D=S,S=n;return ae--,S===n&&ae===0&&te(Ts),S}function Pe(){let S,B;for(ae++,S=[],re.test(e.charAt(D))?(B=e.charAt(D),D++):(B=n,ae===0&&te(Pt));B!==n;)S.push(B),re.test(e.charAt(D))?(B=e.charAt(D),D++):(B=n,ae===0&&te(Pt));return ae--,B=n,ae===0&&te(tn),S}const ni=t.variables||{};function Bi(S,B){const O=Math.pow(10,B);return Math.round(S*O)/O}function Oi(S,B){return Math.pow(S,B)}if(On=u(),On!==n&&D===e.length)return On;throw On!==n&&D<e.length&&te(At()),En(gn,pt<e.length?e.charAt(pt):null,pt<e.length?bn(pt,pt+1):bn(pt,pt))}const K0=U0;function Nc(e,t){try{return K0(e,{variables:t})}catch{return e}}function Lc(e){if(e)T.provide("fields",e);else if(e=T.inject("fields"),!e)throw new Error("Fields were not provided");const t=n=>{if(n.relatedField){const i=e==null?void 0:e.value.find(({name:s,value:u})=>n.relatedField===s&&n.relatedFieldValue===u);return i?t(i):!1}return!0};return{shouldShowField:t}}function As(e){return typeof e=="string"?e.replace(/^0+|[^0-9kK]+/g,"").toUpperCase():""}function X0(e){if(typeof e!="string"||!/^0*(\d{1,3}(\.?\d{3})*)-?([\dkK])$/.test(e))return!1;e=As(e);for(var t=parseInt(e.slice(0,-1),10),n=0,i=1;t>0;)i=(i+t%10*(9-n++%6))%11,t=Math.floor(t/10);var s=i>0?""+(i-1):"K";return s===e.slice(-1)}function Q0(e){e=As(e);for(var t=e.slice(-4,-1)+"-"+e.substr(e.length-1),n=4;n<e.length;n+=3)t=e.slice(-3-n,-n)+"."+t;return t}var Z0={validate:X0,clean:As,format:Q0};const J0={CL:{governmentIdCleaner:Z0.clean},MX:{}};function G0(){return{cleanGovernmentId:(t,n)=>{if(t&&n){const i=J0[n].governmentIdCleaner;return i?i(t):t}return t}}}const ew=e=>typeof e=="string",tw=e=>e instanceof Date,jc=e=>`0${e}`.slice(-2),nw=e=>`${e.getFullYear()}-${jc(e.getMonth()+1)}-${jc(e.getDate())}`,D2="",iw=T.defineComponent({__name:"SignupField",props:{id:null,value:null,label:null,disabled:{type:Boolean},displayInfo:{type:Boolean},type:null,decimals:null,leftIcon:null,rightIcon:null,placeholder:null,helperText:null,errorText:null,required:{type:Boolean},regex:null},emits:["input","right-icon-click"],setup(e,{emit:t}){const n=e;T.use(jl);const i=T.ref(!1),s=T.ref(!1),u=T.computed(()=>{var V;return s.value?"Obligatorio":n.errorText||((V=n.regex)==null?void 0:V.message)}),c=T.computed(()=>n.placeholder||""),f=T.computed(()=>i.value?u.value:n.helperText),p=T.computed(()=>{let V="";return n.leftIcon&&(V+="padding-left"),n.rightIcon&&(V+=" padding-right"),i.value&&(V+=" input-error"),V}),v=T.computed(()=>{let V="t-field__helper-text";return i.value&&(V+=" error"),V}),g=()=>{n.regex&&typeof n.value=="string"?i.value=!RegExp(n.regex.pattern).test(n.value):n.required&&(i.value=!n.value,s.value=!n.value)};return T.watch(()=>n.value,g),{__sfc:!0,props:n,emits:t,isError:i,displayRequired:s,errorText:u,placeholder:c,lowerLabel:f,inputClass:p,lowerLabelClass:v,validate:g,handleInput:V=>{t("input",V.target.value)},handleDatePicker:V=>{t("input",V)},handleRightIconClick:()=>{t("right-icon-click")},Icon:_n}}}),P2="";function jr(e,t,n,i,s,u,c,f){var p=typeof e=="function"?e.options:e;t&&(p.render=t,p.staticRenderFns=n,p._compiled=!0),i&&(p.functional=!0),u&&(p._scopeId="data-v-"+u);var v;if(c?(v=function(P){P=P||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!P&&typeof __VUE_SSR_CONTEXT__<"u"&&(P=__VUE_SSR_CONTEXT__),s&&s.call(this,P),P&&P._registeredComponents&&P._registeredComponents.add(c)},p._ssrRegister=v):s&&(v=f?function(){s.call(this,(p.functional?this.parent:this).$root.$options.shadowRoot)}:s),v)if(p.functional){p._injectStyles=v;var g=p.render;p.render=function(H,V){return v.call(V),g(H,V)}}else{var y=p.beforeCreate;p.beforeCreate=y?[].concat(y,v):[v]}return{exports:e,options:p}}var rw=function(){var t=this,n=t._self._c,i=t._self._setupProxy;return n("div",{staticClass:"t-field"},[n("link",{attrs:{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/@mdi/font@5.8.55/css/materialdesignicons.min.css"}}),t.label?n("label",{staticClass:"t-field__label",attrs:{for:t.id}},[t._v(t._s(t.label))]):t._e(),t.displayInfo?n("div",[n("p",{staticClass:"display-info"},[t._v(" "+t._s(t.value)+" ")])]):n("div",{staticClass:"t-field__input-container"},[n("div",{staticClass:"t-field__icon t-field__icon--right",attrs:{role:"button",tabindex:"0"},on:{click:i.handleRightIconClick,keydown:function(s){return!s.type.indexOf("key")&&t._k(s.keyCode,"enter",13,s.key,"Enter")?null:i.handleRightIconClick.apply(null,arguments)}}},[t.rightIcon?n(i.Icon,{attrs:{icon:t.rightIcon,color:"black"}}):t._e()],1),t.leftIcon?n(i.Icon,{staticClass:"t-field__icon t-field__icon--left",attrs:{icon:t.leftIcon,color:"black"}}):t._e(),t.type==="date"?n("b-datepicker",{staticClass:"date-class",attrs:{value:t.value,locale:"es-ES"},on:{input:i.handleDatePicker}}):n("input",{staticClass:"t-field__input",class:i.inputClass,attrs:{id:t.id,placeholder:i.placeholder,type:t.type,disabled:t.disabled},domProps:{value:t.value},on:{input:i.handleInput}})],1),n("p",{class:i.lowerLabelClass,attrs:{for:t.id}},[t._v(t._s(i.lowerLabel))])])},aw=[],sw=jr(iw,rw,aw,!1,null,"9317989a",null,null);const ow=sw.exports,uw=T.defineComponent({__name:"SignupFields",props:{fieldsType:null,title:null,fields:null,autocomplete:{type:Boolean},accounts:null},emits:["input","search"],setup(e,{emit:t}){const n=e,i=(y,P)=>{t("input",{id:y,value:P})},{shouldShowField:s}=Lc(),u=T.computed(()=>n.fields.filter(s)),c=T.computed(()=>{const y={};return u.value.forEach(P=>{y[P.name]=P.value}),y});return{__sfc:!0,props:n,emit:t,handleInput:i,shouldShowField:s,fieldsToShow:u,variables:c,getFieldValue:y=>y.displayInfo&&ew(y.value)?Nc(y.value,c.value):y.value,isFieldSearchable:y=>y.isExternalId&&n.autocomplete,handleRightIconClick:()=>{t("search")},retrocompatibleIcon:y=>y==="DollarIcon"?"solar:dollar-outline":y,TTypography:Rc,TSelect:Y0,SignupFieldComponent:ow}}}),A2="";var lw=function(){var t=this,n=t._self._c,i=t._self._setupProxy;return n("div",{staticClass:"fields"},[n(i.TTypography,{attrs:{variant:"s2","font-weight":"medium"}},[t._v(" "+t._s(t.title)+" ")]),n("div",{staticClass:"fields__base"},[t._l(i.fieldsToShow,function(s){var u,c;return[t.fieldsType==="invoice"&&s.isAccount?n(i.TSelect,{key:s.id||s.name,staticClass:"t-select",attrs:{placeholder:s.placeholder,label:s.label,value:(u=s.value)==null?void 0:u.toString(),"helper-text":s.helperText},on:{input:f=>i.handleInput(s.id||s.id||s.name,f)}},t._l(t.accounts,function({id:f,name:p}){return n("option",{key:f,domProps:{value:f}},[t._v(" "+t._s(p)+" ")])}),0):s.defaultOptions!==void 0?n(i.TSelect,{key:s.id||s.name,staticClass:"t-select",attrs:{placeholder:s.placeholder,label:s.label,value:(c=s.value)==null?void 0:c.toString(),"helper-text":s.helperText},on:{input:f=>i.handleInput(s.id||s.name,f)}},t._l(s.defaultOptions,function(f){return n("option",{key:f.toString(),domProps:{value:f.toString()}},[t._v(" "+t._s(f)+" ")])}),0):n(i.SignupFieldComponent,{key:s.name,attrs:{id:s.id||s.name,value:i.getFieldValue(s),type:s.type,label:s.label,placeholder:s.placeholder,decimals:s.decimals,"helper-text":s.helperText,"left-icon":i.retrocompatibleIcon(s.leftIcon),required:s.required,regex:s.regex,"display-info":s.displayInfo,"right-icon":i.isFieldSearchable(s)?"ph:magnifying-glass":void 0},on:{input:f=>i.handleInput(s.id||s.name,f),"right-icon-click":function(f){i.isFieldSearchable(s)&&i.handleRightIconClick()}}})]})],2)],1)},cw=[],dw=jr(uw,lw,cw,!1,null,"8766fd95",null,null);const fw=dw.exports,hw=T.defineComponent({__name:"SignupCompleted",props:{type:{default:"success"},errorMessage:null,errorButtonLabel:null,successMessage:null,successButtonLabel:null},emits:["reset"],setup(e){const t=e,n=T.computed(()=>t.type==="error"?t.errorMessage:t.successMessage),i=T.computed(()=>t.type==="error"?t.errorButtonLabel:t.successButtonLabel);return{__sfc:!0,props:t,message:n,buttonText:i,TButton:Ec,TTypography:Rc}}}),F2="";var pw=function(){var t=this,n=t._self._c,i=t._self._setupProxy;return n("div",{staticClass:"success-form"},[n(i.TTypography,{attrs:{variant:"h1"}},[t._v(" "+t._s(i.message)+" ")]),n(i.TButton,{attrs:{variant:"secondary"},on:{click:function(s){return t.$emit("reset")}}},[t._v(" "+t._s(i.buttonText)+" ")])],1)},_w=[],vw=jr(hw,pw,_w,!1,null,"dd9e3f67",null,null);const mw=vw.exports,gw=T.defineComponent({__name:"CustomForm",props:{customerFields:null,invoiceFields:null,showSendByEmail:{type:Boolean},countryIso:null,disableSubmit:{type:Boolean},isLoading:{type:Boolean},submitFormStatus:null,signupCompleted:{type:Boolean},isAutocompleteEnabled:{type:Boolean},accounts:null,invoiceFieldsTitle:{default:"Plan de pagos"},customerFieldsTitle:{default:"Información Cliente"},buttonLabel:{default:"Registrar"},sendByEmailText:{default:"Enviar información a correo electrónico"},errorMessage:{default:"Error en la creación"},errorButtonLabel:{default:"Intentar nuevamente"},successMessage:{default:"Inscripción exitosa"},successButtonLabel:{default:"Registrar nuevo cliente"},isPaymentPortal:{type:Boolean,default:!1}},emits:["submit-form-data","reset","autocomplete-subscription","autocomplete-external-id"],setup(e,{emit:t}){const n=e;T.use(jl);const i=T.ref(n.customerFields),s=T.ref(n.invoiceFields),u=T.ref(n.isLoading),c=T.ref(n.submitFormStatus),f=T.ref(n.signupCompleted),p=T.ref(n.errorMessage),v=T.ref(n.isAutocompleteEnabled),g=T.ref(!n.showSendByEmail),y=T.computed(()=>[...i.value,...s.value]),{shouldShowField:P}=Lc(y),{cleanGovernmentId:H}=G0();T.watch(n,U=>{i.value=U.customerFields,s.value=U.invoiceFields,u.value=U.isLoading,c.value=U.submitFormStatus,f.value=U.signupCompleted,p.value=U.errorMessage,v.value=U.isAutocompleteEnabled});const V=(U,R)=>U.type==="number"&&U.decimals?(Math.round(Number(R)*10**U.decimals)/10**U.decimals).toString():R,z=()=>{const U=i.value.find(({isExternalId:R})=>R);t("autocomplete-external-id",U==null?void 0:U.value)},Q=(U,{id:R,value:N})=>{const _e=U.findIndex(Oe=>R===Oe.id||R===Oe.name);if(_e!==-1){const Oe=U[_e];T.set(Oe,"value",V(Oe,N)),Oe.name==="product_id"&&v.value&&t("autocomplete-subscription",N)}},K=()=>{const U={};return y.value.forEach(R=>{P(R)&&(U[R.name]=R.value)}),U},re=()=>{const U=K(),R={additional_data:{},customer_metadata:{},subscription_metadata:{},invoice_metadata:{},send_mail:g.value};return y.value.forEach(N=>{if(N.value){if(N.relatedField&&!P(N))return;let{value:_e}=N;N.displayInfo&&(_e=Nc(_e,U)),N.name.includes("customer_metadata")?R.customer_metadata[N.name.replace("customer_metadata_","")]=_e:N.name.includes("subscription_metadata")?R.subscription_metadata[N.name.replace("subscription_metadata_","")]=_e:N.name.includes("invoice_metadata")?R.invoice_metadata[N.name.replace("invoice_metadata_","")]=_e:N.name.includes("additional_data")?R.additional_data[N.name.replace("additional_data_","")]=_e:N.name==="government_id"&&n.countryIso==="CL"?R[N.name]=H(_e,n.countryIso):N.name==="due_date"&&tw(_e)?R[N.name]=nw(_e):N.isAccount?R.id_account=_e:R[N.name]=_e}}),R},ee=()=>{let U=!0;return y.value.forEach(R=>{const N=R.required&&(R.value===void 0||R.value==="")&&(!R.relatedField||P(R)),_e=R.regex&&!RegExp(R.regex.pattern).test(R.value);(N||_e)&&(U=!1)}),U};return{__sfc:!0,props:n,emit:t,customerFields:i,invoiceFields:s,isLoading:u,submitFormStatus:c,signupCompleted:f,errorMessage:p,isAutocompleteEnabled:v,sendEmail:g,allFields:y,shouldShowField:P,cleanGovernmentId:H,formatFieldValue:V,handleSearch:z,handleInput:Q,getVariables:K,buildSignupRequestBody:re,validateFormValues:ee,submitForm:()=>{if(!ee())return;const R=re();t("submit-form-data",R)},TButton:Ec,SignupFields:fw,SignupCompleted:mw}}}),M2="";var bw=function(){var t=this,n=t._self._c,i=t._self._setupProxy;return n("main",[n("transition",{attrs:{name:"slide-fade",mode:"out-in"}},[i.signupCompleted?n(i.SignupCompleted,{attrs:{type:i.submitFormStatus,"error-message":i.errorMessage,"error-button-label":t.errorButtonLabel,"success-message":t.successMessage,"success-button-label":t.successButtonLabel},on:{reset:function(s){return i.emit("reset")}}}):n("div",{staticClass:"custom-form"},[n("div",{class:[t.isPaymentPortal?"custom-form--portal-payment":"custom-form--backoffice"]},[n(i.SignupFields,{attrs:{fields:i.customerFields,"fields-type":"customer",title:t.customerFieldsTitle,autocomplete:i.isAutocompleteEnabled,accounts:t.accounts},on:{input:s=>i.handleInput(i.customerFields,s),search:i.handleSearch}}),n(i.SignupFields,{attrs:{fields:i.invoiceFields,"fields-type":"invoice",title:t.invoiceFieldsTitle,accounts:t.accounts},on:{input:s=>i.handleInput(i.invoiceFields,s)}})],1),n("div",{staticClass:"custom-form__checkbox"},[t.showSendByEmail?n("b-checkbox",{attrs:{id:"send_email"},model:{value:i.sendEmail,callback:function(s){i.sendEmail=s},expression:"sendEmail"}},[t._v(" "+t._s(t.sendByEmailText)+" ")]):t._e()],1),n("div",[n(i.TButton,{attrs:{disabled:t.disableSubmit,size:"medium",loading:i.isLoading},on:{click:i.submitForm}},[t._v(" "+t._s(t.buttonLabel)+" ")])],1)])],1)],1)},yw=[],$w=jr(gw,bw,yw,!1,null,"71cbefca",null,null);const ww=$w.exports;Fn.CustomForm=ww,Object.defineProperty(Fn,Symbol.toStringTag,{value:"Module"})});
|
|
68
68
|
//# sourceMappingURL=index.umd.js.map
|