(()=>{"use strict";var e={20:(e,t,s)=>{var n=s(609),o=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,c=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function p(e,t,s){var n,r={},p=null,l=null;for(n in void 0!==s&&(p=""+s),void 0!==t.key&&(p=""+t.key),void 0!==t.ref&&(l=t.ref),t)i.call(t,n)&&!a.hasOwnProperty(n)&&(r[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===r[n]&&(r[n]=t[n]);return{$$typeof:o,type:e,key:p,ref:l,props:r,_owner:c.current}}t.Fragment=r,t.jsx=p,t.jsxs=p},609:e=>{e.exports=window.React},848:(e,t,s)=>{e.exports=s(20)}},t={};const s=window.wp.element,n=window.wc.wcBlocksRegistry,o=window.wp.htmlEntities,r=window.wc.wcSettings,i="mercadopago_blocks_update_cart";var c=function s(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,s),r.exports}(848);const a=({title:e,description:t,linkText:s,linkSrc:n})=>(0,c.jsx)("div",{className:"mp-test-mode-container",children:(0,c.jsx)("test-mode",{title:e,description:t,"link-text":s,"link-src":n})}),p=({title:e,subtitle:t,alt:s,linkSrc:n})=>(0,c.jsx)("pix-template",{title:e,subtitle:t,alt:s,src:n}),l=({description:e,linkText:t,linkSrc:s,checkoutClass:n="pro"})=>(0,c.jsx)("div",{className:`mp-checkout-${n}-terms-and-conditions`,children:(0,c.jsx)("terms-and-conditions",{description:e,"link-text":t,"link-src":s})}),d=({text:e,imgSrc:t,id:s})=>(0,c.jsxs)("div",{id:s,className:"row-image-select",children:[(0,c.jsx)("img",{src:t}),(0,c.jsx)("span",{children:e})]});var m;const u="mp_checkout_blocks",_="woo-mercado-pago-pix",x=(0,r.getSetting)("woo-mercado-pago-pix_data",{}),k=(0,o.decodeEntities)(x.title)||"Checkout Pix",h=()=>{const e=(0,o.decodeEntities)(x?.params?.fee_title||""),t=`${k} ${e}`;return(0,c.jsx)(d,{text:t,imgSrc:x.params.icon})},S=e=>{(e=>{const{extensionCartUpdate:t}=wc.blocksCheckout,{eventRegistration:n,emitResponse:o}=e,{onPaymentSetup:r,onCheckoutSuccess:c,onCheckoutFail:a}=n;(0,s.useEffect)((()=>{((e,t)=>{e({namespace:i,data:{action:"add",gateway:t}})})(t,_);const e=r((()=>({type:o.responseTypes.SUCCESS,meta:{paymentMethodData:{...window.mpHiddenInputDataFromBlocksCheckout}}})));return()=>(((e,t)=>{e({namespace:i,data:{action:"remove",gateway:t}})})(t,_),e())}),[r]),(0,s.useEffect)((()=>{const e=c((async e=>{e.processingResponse.message=_;const t=e.processingResponse;return sendMetric("MP_PIX_BLOCKS_SUCCESS",t.paymentStatus,u),{type:o.responseTypes.SUCCESS}}));return()=>e()}),[c]),(0,s.useEffect)((()=>{const e=a((e=>{"undefined"!=typeof MPCheckoutErrorDispatcher&&MPCheckoutErrorDispatcher.dispatchEventWhenBlocksCheckoutErrorOccurred(e);const t=e.processingResponse;return sendMetric("MP_PIX_BLOCKS_ERROR",t.paymentStatus,u),{type:o.responseTypes.FAIL,messageContext:o.noticeContexts.PAYMENTS,message:t.paymentDetails.message}}));return()=>e()}),[a])})(e);const{test_mode_title:t,test_mode_description:n,pix_template_title:o,pix_template_subtitle:r,pix_template_src:d,pix_template_alt:m,terms_and_conditions_description:k,terms_and_conditions_link_text:h,terms_and_conditions_link_src:S,test_mode:y,amount:w,message_error_amount:f}=x.params;return null==w?(0,c.jsx)(c.Fragment,{children:(0,c.jsx)("p",{className:"alert-message",children:f})}):(0,c.jsx)("div",{className:"mp-checkout-container",children:(0,c.jsxs)("div",{id:"mp-checkout-pix-root",className:"mp-checkout-pix-container",children:[(0,c.jsxs)("div",{className:"mp-checkout-pix-content",children:[y?(0,c.jsx)(a,{title:t,description:n}):null,(0,c.jsx)(p,{title:o,subtitle:r,alt:m,linkSrc:d})]}),(0,c.jsx)(l,{description:k,linkText:h,linkSrc:S,checkoutClass:"pix"})]})})},y={name:_,label:(0,c.jsx)(h,{}),content:(0,c.jsx)(S,{}),edit:(0,c.jsx)(S,{}),canMakePayment:()=>!0,ariaLabel:k,supports:{features:null!==(m=x?.supports)&&void 0!==m?m:[]}};(0,n.registerPaymentMethod)(y)})();