(()=>{"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.wc.blocksCheckout,r=window.wp.htmlEntities,i=window.wc.wcSettings,c="mercadopago_blocks_update_cart";var a=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 p=({title:e,description:t,linkText:s,linkSrc:n})=>(0,a.jsx)("div",{className:"mp-test-mode-container",children:(0,a.jsx)("test-mode",{title:e,description:t,"link-text":s,"link-src":n})}),l=({title:e,subtitle:t,alt:s,linkSrc:n})=>(0,a.jsx)("pix-template",{title:e,subtitle:t,alt:s,src:n}),d=({description:e,linkText:t,linkSrc:s,checkoutClass:n="pro"})=>(0,a.jsx)("div",{className:`mp-checkout-${n}-terms-and-conditions`,children:(0,a.jsx)("terms-and-conditions",{description:e,"link-text":t,"link-src":s})}),m=({text:e,imgSrc:t,id:s})=>(0,a.jsxs)("div",{id:s,className:"row-image-select",children:[(0,a.jsx)("img",{src:t}),(0,a.jsx)("span",{children:e})]});var u;const _="mp_checkout_blocks",x="woo-mercado-pago-pix",k=(0,i.getSetting)("woo-mercado-pago-pix_data",{}),h=(0,r.decodeEntities)(k.title)||"Checkout Pix",w=()=>{const e=(0,r.decodeEntities)(k?.params?.fee_title||""),t=`${h} ${e}`;return(0,a.jsx)(m,{text:t,imgSrc:k.params.icon})},S=e=>{(e=>{const{eventRegistration:t,emitResponse:n}=e,{onPaymentSetup:r,onCheckoutSuccess:i,onCheckoutFail:a}=t;(0,s.useEffect)((()=>{((e,t)=>{e({namespace:c,data:{action:"add",gateway:t}})})(o.extensionCartUpdate,x);const e=r((()=>({type:n.responseTypes.SUCCESS,meta:{paymentMethodData:{...window.mpHiddenInputDataFromBlocksCheckout}}})));return()=>(((e,t)=>{e({namespace:c,data:{action:"remove",gateway:t}})})(o.extensionCartUpdate,x),e())}),[r]),(0,s.useEffect)((()=>{const e=i((async e=>{e.processingResponse.message=x;const t=e.processingResponse;return sendMetric("MP_PIX_BLOCKS_SUCCESS",t.paymentStatus,_),{type:n.responseTypes.SUCCESS}}));return()=>e()}),[i]),(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,_),{type:n.responseTypes.FAIL,messageContext:n.noticeContexts.PAYMENTS,message:t.paymentDetails.message}}));return()=>e()}),[a])})(e);const{test_mode_title:t,test_mode_description:n,pix_template_title:r,pix_template_subtitle:i,pix_template_src:m,pix_template_alt:u,terms_and_conditions_description:h,terms_and_conditions_link_text:w,terms_and_conditions_link_src:S,test_mode:y,amount:f,message_error_amount:g}=k.params;return null==f?(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("p",{className:"alert-message",children:g})}):(0,a.jsx)("div",{className:"mp-checkout-container",children:(0,a.jsxs)("div",{id:"mp-checkout-pix-root",className:"mp-checkout-pix-container",children:[(0,a.jsxs)("div",{className:"mp-checkout-pix-content",children:[y?(0,a.jsx)(p,{title:t,description:n}):null,(0,a.jsx)(l,{title:r,subtitle:i,alt:u,linkSrc:m})]}),(0,a.jsx)(d,{description:h,linkText:w,linkSrc:S,checkoutClass:"pix"})]})})},y={name:x,label:(0,a.jsx)(w,{}),content:(0,a.jsx)(S,{}),edit:(0,a.jsx)(S,{}),canMakePayment:()=>!0,ariaLabel:h,supports:{features:null!==(u=k?.supports)&&void 0!==u?u:[]}};(0,n.registerPaymentMethod)(y)})();