!function(e){var t={};function n(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(i,a,function(t){return e[t]}.bind(null,a));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=5)}([function(e,t){e.exports=React},function(e,t,n){e.exports={cashandinstallments_container:"knownonline-custom-cash-and-installments-0-x-cashandinstallments_container",cashandinstallments_container_list:"knownonline-custom-cash-and-installments-0-x-cashandinstallments_container_list",cashandinstallments_items_container:"knownonline-custom-cash-and-installments-0-x-cashandinstallments_items_container",cashandinstallments_img:"knownonline-custom-cash-and-installments-0-x-cashandinstallments_img",cashandinstallments_text:"knownonline-custom-cash-and-installments-0-x-cashandinstallments_text",cashandinstallments_installments_number:"knownonline-custom-cash-and-installments-0-x-cashandinstallments_installments_number",cashandinstallments_disclaimer_text:"knownonline-custom-cash-and-installments-0-x-cashandinstallments_disclaimer_text"}},function(e,t){e.exports=__RENDER_8_COMPONENTS__["vtex.format-currency@0.x/FormattedCurrency"]},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getPublicPath=t.register=void 0;var i="__RENDER_8_RUNTIME__",a="__RENDER_8_COMPONENTS__",l=!("undefined"==typeof window||!window.document);l&&!window.global&&(window.global=window),window[a]=window[a]||{},t.register=function(e,t,n,l,o){var r="".concat(n,"/").concat(o),s="".concat(l,"/").concat(o),c=function(){return function(e,t){try{var n=e();return n.__esModule?n.default:n.default||n}catch(e){throw new Error("An error happened while requiring the app ".concat(t,", please check your app's code.\\n").concat(e.stack))}}(e,r)};if(window[i]&&window[i].registerComponent){var u=!!window.__RENDER_LAZY__;window[i].registerComponent(t,u?c:c(),n,o,u)}else{var d=c();window[i]&&window[i].withHMR?window[a][r]=window[a][s]=window[i].withHMR(t,d):window[a][r]=window[a][s]=d}return{}},t.getPublicPath=function(e){var t=window.__hostname__,n="/_v/public/assets/v1/published/";return l&&window.__RUNTIME__&&(t=__RUNTIME__.assetServerPublishedHost||window.location.hostname,n=__RUNTIME__.assetServerPublishedPath||"/_v/public/assets/v1/published/"),"https://"+t+n+"".concat(e,"/public/react/")}},function(e,t){e.exports=__RENDER_8_COMPONENTS__["vtex.product-context@0.x/useProduct"]},function(e,t,n){"use strict";n.r(t),function(e){var t=n(3);n.p=Object(t.getPublicPath)("knownonline.custom-cash-and-installments@0.0.4");var i=Object(t.register)((function(){return n(7)}),e,"knownonline.custom-cash-and-installments@0.0.4","knownonline.custom-cash-and-installments@0.x","CashAndInstallments");i.renderHotReload,i.setupHMR}.call(this,n(6)(e))},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t,n){"use strict";function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n0?n:g})}var i=null==e?void 0:e.discountCash,a=g-g*i/100;return Object.assign(Object.assign({},e),{price:(null==e?void 0:e.discountCash)>0?a:g})}));x(e)}}),[g,r]),Object(l.useEffect)((function(){if(c){var e=null==c?void 0:c.map((function(e){if("interest"===(null==e?void 0:e.promotionType)){var t=null==e?void 0:e.interest,n=g+g*t/100;return Object.assign(Object.assign({},e),{price:(null==e?void 0:e.interest)>0?n:g})}var i=null==e?void 0:e.discount,a=g-g*i/100;return Object.assign(Object.assign({},e),{price:(null==e?void 0:e.discount)>0?a:g})}));P(e)}}),[g,c]),o.a.createElement(o.a.Fragment,null,n&&g>0?o.a.createElement("div",{className:m.a.cashandinstallments_container},o.a.createElement("div",{className:m.a.cashandinstallments_container_list},w.map((function(e,t){return(null==e?void 0:e.filterByCollection)?(null==O?void 0:O.some((function(t){return(null==t?void 0:t.id)===(null==e?void 0:e.filterByCollection)})))?o.a.createElement("div",{key:t,className:m.a.cashandinstallments_items_container},o.a.createElement("img",{src:null==e?void 0:e.imageCash,className:m.a.cashandinstallments_img}),o.a.createElement("p",{className:m.a.cashandinstallments_text},null==e?void 0:e.preTextCash," ",o.a.createElement("span",null,o.a.createElement(u.a,{value:null==e?void 0:e.price}))," ",null==e?void 0:e.secondTextCash)):o.a.createElement(o.a.Fragment,null):o.a.createElement("div",{key:t,className:m.a.cashandinstallments_items_container},o.a.createElement("img",{src:null==e?void 0:e.imageCash,className:m.a.cashandinstallments_img}),o.a.createElement("p",{className:m.a.cashandinstallments_text},null==e?void 0:e.preTextCash," ",o.a.createElement("span",null,o.a.createElement(u.a,{value:null==e?void 0:e.price}))," ",null==e?void 0:e.secondTextCash))})),T.map((function(e,t){return(null==e?void 0:e.filterByCollectionInstallments)?(null==O?void 0:O.some((function(t){return(null==t?void 0:t.id)===(null==e?void 0:e.filterByCollectionInstallments)})))?o.a.createElement("div",{key:t,className:m.a.cashandinstallments_items_container},o.a.createElement("img",{src:null==e?void 0:e.image,className:m.a.cashandinstallments_img}),o.a.createElement("p",{className:m.a.cashandinstallments_text},null==e?void 0:e.preText," ",null==e?void 0:e.installments," ",null==e?void 0:e.secondText," ",o.a.createElement("span",null,o.a.createElement(u.a,{value:(null==e?void 0:e.price)/(null==e?void 0:e.installments)}))," ",null==e?void 0:e.thirdText)):o.a.createElement(o.a.Fragment,null):o.a.createElement("div",{key:t,className:m.a.cashandinstallments_items_container},o.a.createElement("img",{src:null==e?void 0:e.image,className:m.a.cashandinstallments_img}),o.a.createElement("p",{className:m.a.cashandinstallments_text},null==e?void 0:e.preText," ",null==e?void 0:e.installments," ",null==e?void 0:e.secondText," ",o.a.createElement("span",null,o.a.createElement(u.a,{value:(null==e?void 0:e.price)/(null==e?void 0:e.installments)}))," ",null==e?void 0:e.thirdText))}))),o.a.createElement("p",{className:m.a.cashandinstallments_disclaimer_text},d)):o.a.createElement(o.a.Fragment,null))};p.schema={title:"Custom Cash and Installments",type:"object",properties:{isActive:{title:"Activar Componente",type:"boolean",default:!0},selectType:{title:"Precio a tomar",description:"Define el precio que tomarán las promociones y las cuotas.",type:"string",default:"sellingPrice",enum:["sellingPrice","listPrice"],enumNames:["Selling Price","List Price"]},isPriceWithTax:{title:"Precio con Impuestos",description:"Define si el precio debe incluir impuestos.",type:"boolean",default:!1},promotionsList:{title:"Listado de Precios al contado o con promociones.",type:"array",items:{title:"Contado/Promociones",type:"object",properties:{imageCash:{title:"Imagen",description:"Imagen a mostrar",type:"string",widget:{"ui:widget":"image-uploader"}},filterByCollection:{title:"Filtrar por Colección",description:"En caso de requerir, ingresar el nombre de la colección a filtrar.",type:"string"},preTextCash:{title:"Texto previo al valor",description:"Texto previo al valor de contado/promoción.",type:"string"},secondTextCash:{title:"Texto posterior al valor",description:"Texto posterior al valor de contado/promoción.",type:"string"},promotionTypeCash:{title:"Tipo de promoción:",description:"Define si se aplicara un descuento o se le sumara un interés al producto.",type:"string",default:"sellingPrice",enum:["discount","interest"],enumNames:["Descuento","Interés"]},discountCash:{title:"Descuento (No obligatorio)",description:"Descuento a aplicar, en % solo números. Si no aplicará descuento dejar vacío.",type:"number"},interestCash:{title:"Interés (No obligatorio)",description:"Interés a aplicar, en % solo números. Si no aplicará interés dejar vacío.",type:"number"}}}},listInstallments:{title:"Listado de Cuotas",type:"array",items:{title:"Forma de Pago",type:"object",properties:{image:{title:"Imagen",description:"Imagen a mostrar",type:"string",widget:{"ui:widget":"image-uploader"}},filterByCollectionInstallments:{title:"Filtrar por Colección",description:"En caso de requerir, ingresar el nombre de la colección a filtrar.",type:"string"},preText:{title:"Texto previo a numero de cuotas",description:"Texto previo a numero de cuotas a mostrar",type:"string"},installments:{title:"Cuotas",description:"Numero de cuotas (solo numeros)",type:"number"},secondText:{title:"Texto posterior a numero de cuotas",description:"Texto posterior a numero de cuotas.",type:"string"},thirdText:{title:"Texto final luego del valor de cuota.",description:"Texto final luego del valor de cuota.",type:"string"},promotionType:{title:"Tipo de promoción:",description:"Define si se aplicara un descuento o se le sumara un interés al producto.",type:"string",default:"sellingPrice",enum:["discount","interest"],enumNames:["Descuento","Interés"]},discount:{title:"Descuento (No obligatorio)",description:"Descuento a aplicar, en % solo números. Si no aplicará descuento dejar vacío.",type:"number"},interest:{title:"Interes (No obligatorio)",description:"Interés a aplicar, en % solo números. Si no aplicará interés dejar vacío.",type:"number"}}}},disclaimerText:{title:"Disclaimer",description:"En caso de requerir, ingresar el texto a mostrar en el disclaimer..",type:"string"}}};t.default=p}]);