PageSourceSearch

https://levieuxchateau.be/wp-content/plugins/revolut-gateway-for-w…/dist/client/blocks.index.js?ver=4.20.9

js levieuxchateau.be collected 2026-09-26 11:22:59 UTC 28,490 bytes, 1 lines download raw bytes

1(()=>{"use strict";var e={20:(e,t,r)=>{var n=r(609),a=Symbol.for("react.element"),s=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,c=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function u(e,t,r){var n,s={},u=null,l=null;for(n in void 0!==r&&(u=""+r),void 0!==t.key&&(u=""+t.key),void 0!==t.ref&&(l=t.ref),t)o.call(t,n)&&!i.hasOwnProperty(n)&&(s[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===s[n]&&(s[n]=t[n]);return{$$typeof:a,type:e,key:u,ref:l,props:s,_owner:c.current}}t.Fragment=s,t.jsx=u,t.jsxs=u},848:(e,t,r)=>{e.exports=r(20)},609:e=>{e.exports=window.React}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,r),s.exports}(()=>{const e=window.wc.blocksCheckout,t=window.wc.wcBlocksRegistry,n=window.wp.element,a=window.wc.wcSettings,s=window.wp.i18n,o=window.wp.data,c=(0,a.getSetting)("revolut_data"),i=(0,a.getSetting)("revolut_data").revolut_pay_data,u=(0,a.getSetting)("revolut_data").revolut_pay_by_bank_data,l=(0,a.getSetting)("revolut_data").revolut_cc_data,d=(0,a.getSetting)("revolut_data").revolut_payment_request_data,p=e=>(0,s.__)(e,"revolut-gateway-for-woocommerce"),m=({endpoint:e,controller:t="revolut_payment_request_"})=>c.fast_checkout_params.ajax_url.toString().replace("%%wc_revolut_gateway_ajax_endpoint%%",`${t}${e}`);function _(e,t,r){const n=e;if(t&&"object"==typeof t)Object.keys(t).forEach((e=>{_(n,t[e],r?`${r}[${e}]`:e)}));else{const e=null==t?"":t;n.append(r,e)}return n}const y=async({data:e,endpoint:t})=>{const r=_(new FormData,e),n=await fetch(t,{method:"POST",body:r});if(!n.ok)throw new Error("Failed to process your request due to network issue");return await n.json()},h=e=>({countryCode:e.country,region:e.state,city:e.city,streetLine1:e.address_1,streetLine2:e.address_2,postcode:e.postcode}),v=e=>({address_1:e.address||e.addressLine.at(0),address_2:e.address_2||e.addressLine.at(1)||"",city:e.city,state:e.state||e.region,postcode:e.postcode||e.postalCode,country:e.country,phone:e.phone}),g=async()=>{const e=await y({endpoint:m({endpoint:N.GET_EXPRESS_CHECKOUT_PARAMS}),data:{security:c.fast_checkout_params.nonce.get_express_checkout_params}});return e?.success?e.revolut_public_id:Promise.reject(new Error("Something went wrong while creating the payment."))},f=async(e=!1)=>{const t=e?c.route.create_revolut_pbb_order:c.route.create_revolut_order,r=e?c.nonce.create_revolut_pbb_order:c.nonce.create_revolut_order,n=await y({endpoint:t,data:{security:r}});if(n?.success)return n;throw new Error("An unexpected error occurred")},w=async e=>(await y({data:{revolut_public_id:e,security:c.fast_checkout_params.nonce.cancel_order},endpoint:m({endpoint:N.CANCEL_ORDER})})).success,b=async e=>{try{if(await w(e))return{type:"error",message:p("Something went wrong, your order has been cancelled.")};throw new Error("Couldn`t cancel the order")}catch(e){return{type:"failure",message:p("Your order has been completed, but we couldn't redirect you to the confirmation page. Please contact us for assistance.")}}};function E({publicId:e,hasError:t="",captured:r=!0}){return new Promise(((n,a)=>{t&&n();let s=0;const o=setInterval((async()=>{s>10&&(clearInterval(o),n());const t=await y({data:{revolut_public_id:e,is_captured:r?1:0,security:c.nonce.check_payment},endpoint:c.route.check_payment});t&&t.payment_completed&&(clearInterval(o),n()),s++}),3e3)}))}function R(e,{totalRetry:t=2,delay:r=1e3}={}){const n=async t=>{try{const r=await y({data:{revolut_public_id:e,security:c.nonce.capture_payment},endpoint:c.route.capture_payment});return!(!r||!r.is_captured)||await a(t)}catch(e){return await a(t)}},a=async e=>{return e>0&&(await(t=r,new Promise((e=>setTimeout(e,t)))),n(e-1));var t};return n(t)}const S=async({response:e,paymentMethod:t,shouldSavePayment:r,paymentToken:n=0})=>{try{const{processingResponse:a}=e,{wc_order_id:s,revolut_public_id:o,process_payment_result:i}=a.paymentDetails;if(!await R(o))throw new Error("Can not capture payment result");await E({publicId:o});
1const u=await(async({revolut_public_id:e,shouldSavePayment:t,wc_order_id:r,paymentMethod:n,process_payment_result:a,used_payment_token:s})=>{try{const o={revolut_gateway:n,security:a,revolut_public_id:e,revolut_payment_error:"",wc_order_id:r,reload_checkout:0,revolut_save_payment_method:Number(n===O.REVOLUT_CARD)&&(Number(t)||Number(l.is_save_payment_method_mandatory)),"wc-revolut_cc-payment-token":s},i=await y({data:o,endpoint:c.route.process_order});if("fail"===i?.result)throw new Error(i?.messages||"Something went wrong while trying to charge your card, please try again");if("success"===i?.result)return i;throw new Error("Failed to process your order due to server issue")}catch(e){throw new Error(e.message||"An unexpected error occurred")}})({wc_order_id:s,revolut_public_id:o,shouldSavePayment:r,paymentMethod:t,process_payment_result:i,used_payment_token:n});if(u.redirect)return window.location.href=decodeURI(u.redirect),{success:!0,type:"success"};throw new Error("Could not redirect you to the confirmation page due to an unexpected error. Please contact the merchant")}catch(e){return{type:"error",message:p(e?.message),retry:!0,messageContext:"wc/checkout/payments"}}},k=async({onSubmit:e,address:t,publicId:r})=>{if(!await R(r))throw new Error("Can not capture payment result");await E({publicId:r});const{billingAddress:n,shippingAddress:a}=t;let s=n.recipient.indexOf(" "),c=n.recipient.substring(0,s),i=n.recipient.substring(s+1);(0,o.dispatch)(j).setBillingAddress({first_name:c,last_name:i,email:t.email,...v(n)}),(0,o.dispatch)(j).setShippingAddress({first_name:c,last_name:i,...v(a)}),e()},x={channel:"woocommerce-blocks"};let P=null;const C=()=>P||("undefined"!=typeof RevolutUpsell&&(P=RevolutUpsell({locale:c.locale,publicToken:c.merchant_public_key})),P),T=()=>{const e=C();if(!e)return;const t=document.getElementById(M);t&&i.banner.points_banner_enabled&&e.promotionalBanner.mount(t,{amount:c.order.amount,variant:"banner",currency:c.order.currency,__metadata:x})},{CART_STORE_KEY:j,PAYMENT_STORE_KEY:A}=window.wc.wcBlocksData,O={REVOLUT_CARD:"revolut_cc",REVOLUT_PAY:"revolut_pay",REVOLUT_PAY_BY_BANK:"revolut_pay_by_bank",REVOLUT_PRB:"revolut_payment_request"},L="wc/checkout/payments",M="revolut-pay-informational-banner",N={GET_EXPRESS_CHECKOUT_PARAMS:"get_express_checkout_params",UPDATE_SHIPPING_METHOD:"update_shipping_method",GET_SHIPPING_OPTIONS:"get_shipping_options",LOAD_ORDER_DATA:"load_order_data",CANCEL_ORDER:"cancel_order",PROCESS_ORDER:"process_payment_result",UPDATE_PAYMENT_TOTAL:"update_payment_total"},I=["error.3ds-failed","error.email-is-not-specified","error.invalid-postcode","error.invalid-email","error.incorrect-cvv-code","error.expired-card","error.do-not-honour","error.insufficient-funds"],D=({paymentOptions:e,onSuccess:t,onError:r},a)=>{const s=(0,n.useRef)(null),o=(0,n.useRef)();return(0,n.useEffect)((()=>((async()=>{const{paymentRequest:n,destroy:a}=await RevolutCheckout.payments({publicToken:c.merchant_public_key,locale:c.locale});if(o.current=a,s.current){const a=n.mount(s.current,{...e,buttonStyle:{action:d.styles.payment_request_button_type,height:d.styles.payment_request_button_height,variant:d.styles.payment_request_button_theme,radius:d.styles.payment_request_button_radius},currency:c.order.currency,shippingOptions:c.fast_checkout_params.free_shipping_option,onSuccess(){t()},onError(e){r(e.message)},onCancel(){r("Payment cancelled!")}});a.canMakePayment().then((e=>{e?a.render():a.destroy()}))}})(),()=>o.current())),a),{revolutPrbRef:s,destroyRef:o}},U=()=>{(0,n.useEffect)((()=>{const e=document.querySelector(".wp-element-button.wc-block-components-checkout-place-order-button");return e&&(e.disabled=!0,e.style.display="none"),()=>{e&&(e.disabled=!1,e.style.display="block")}}),[])},B=({paymentOptions:e,onSuccess:t,onError:r,onCancel:a},s)=>{const o=(0,n.useRef)(null),u=(0,n.useRef)();return(0,n.useEffect)((()=>((async()=>{const{revolutPay:n,destroy:s}=await RevolutCheckout.payments({publicToken:c.merchant_public_key,locale:c.locale});u.current=s,o.current&&n.mount(o.current,{currency:c.order.currency,totalAmount:0,mobileRedirectUrls:{success:i.mobile_redirect_url,failure:i.mobile_redirect_url,cancel:i.mobile_redirect_url},buttonStyle:{cashbackCurrency:c.order.currency,variant:i.styles.revolut_pay_button_theme,height:i.styles.revolut_pay_button_height,radius:i.styles.revolut_pay_button_radius},...e}),n.on("payment",(e=>{switch(e.type){case"cancel":a();break;case"success":t(e.orderId);break;case"error":r(e.error.message)}}))})(),()=>{u.current()})),s),{revolutPayRef:o,destroyRef:u}};var Y=r(848);const F=({settings:e})=>(0,Y.jsxs)("div",{className:"revolut-payment-method-label-container",children:[(0,Y.jsx)("strong",{children:e.title}),(0,Y.jsx)(G,{})]}),q=({settings:e})=>{const{institutions:t,popular_institution_ids:r}=e.pay_by_bank_brands;if(!t||!r)return(0,Y.jsx)("div",{className:"revolut-payment-method-label-container",children:(0,Y.jsx)("strong",{children:e.title})});const n=[...r.map((e=>t.find((t=>
1Object.values(t.details)[0].institution_id===e)))).filter(Boolean),...t.filter((e=>!r.includes(Object.values(e.details)[0].institution_id)))],a={firstFive:n.slice(0,5),remainingCount:Math.max(0,n.length-5)};return(0,Y.jsxs)("div",{className:"revolut-payment-method-label-container",children:[(0,Y.jsx)("strong",{children:e.title}),(0,Y.jsxs)("div",{className:"revolut-payment-method-label-scheme-icons",children:[a.firstFive&&a.firstFive.map((e=>(0,Y.jsx)("img",{src:e.logo.value,alt:e.name},e.name))),(0,Y.jsxs)("strong",{children:["+",a.remainingCount]})]})]})},V=()=>((0,n.useEffect)((()=>{(()=>{const e=C();if(!e)return;const t=document.getElementById("revolut-pay-label-informational-icon");t&&i.banner.label_icon_variant&&e.promotionalBanner.mount(t,{amount:c.order.amount,variant:"cashback"===i.banner.label_icon_variant?"link":i.banner.label_icon_variant,currency:c.order.currency,style:{text:"cashback"===i.banner.label_icon_variant?"cashback":null,color:"blue"},__metadata:x})})()}),[]),(0,Y.jsxs)("div",{className:"revolut-payment-method-label-container",children:[(0,Y.jsxs)("div",{className:"revolut-pay-label-title-wrapper",children:[(0,Y.jsx)("strong",{style:{whiteSpace:"nowrap"},children:i.title}),(0,Y.jsx)("div",{style:{marginLeft:"5px",display:"flex"},id:"revolut-pay-label-informational-icon"})]}),(0,Y.jsx)("img",{src:`${c.wc_plugin_url}/assets/images/revolut.svg`,style:{marginLeft:2},alt:"Revolut Pay"},"Revolut Pay"),(0,Y.jsx)(G,{})]})),G=()=>{const{available_card_brands:e,wc_plugin_url:t}=c;return(0,Y.jsx)("div",{className:"revolut-payment-method-label-scheme-icons",children:e&&e.filter((e=>"maestro"!==e)).map((e=>(0,Y.jsx)("img",{src:`${t}/assets/images/${e}.svg`,style:{marginLeft:2},alt:e},e)))})},$=({inputRef:e})=>{const[t,r]=(0,n.useState)([]),a=(0,n.useRef)(!1),s=()=>{const t=e.current.value.trim().split(/\s+/).length>1;return!t&&a.current?(e.current.classList.add("wc-revolut-cardholder-name-error"),r([{message:"Please provide your full name"}])):(e.current.classList.remove("wc-revolut-cardholder-name-error"),r([])),t};return e.current&&(e.current.isComplete=()=>(a.current=!0,s())),(0,Y.jsxs)("div",{className:"form-row validate-required",id:"cardholder-name","data-priority":"10",style:{display:"block",width:"100%",marginBottom:15},children:[(0,Y.jsx)("input",{ref:e,type:"text",onChange:s,className:"input-text",name:"wc-revolut-cardholder-name",id:"wc-revolut-cardholder-name",placeholder:"Cardholder name",autoComplete:"cardholder",required:!0}),(0,Y.jsx)("div",{style:{marginBottom:10,marginTop:10},children:(0,Y.jsx)(K,{errorList:t})})]})},K=({errorList:e})=>(0,Y.jsx)("div",{children:e.map(((e,t)=>(0,Y.jsx)("li",{className:"card-field-error",children:e.message},t)))}),H=({orderToken:e})=>((0,n.useEffect)((()=>{(e=>{const t=C();if(!t)return;const r=document.getElementById("revolut-upsell-banner");r&&l.banner.upsell_banner_enabled&&t.cardGatewayBanner.mount(r,{orderToken:e})})(e)}),[e]),(0,Y.jsx)("div",{id:"revolut-upsell-banner"})),X=({token:e,eventRegistration:t,billing:r,settings:a})=>{const[s,o]=(0,n.useState)(""),{onCheckoutSuccess:i}=t;(0,n.useEffect)((()=>{const e=i(u);return()=>{e()}}),[i,s]),(0,n.useEffect)((()=>{(async()=>{r?.cartTotal?.value&&f().then((e=>{o(e.revolut_order_public_id)})).catch((e=>createErrorNotice(p(e.message||"An unexpected error occurred"),{id:"create_order_failed",context:emitResponse.noticeContexts.PAYMENTS})))})()}),[r.cartTotal.value]);const u=async t=>(await function(e,t,{totalRetry:r=3,delay:n=300}={}){return new Promise(((a,s)=>{const o=async r=>{try{const n=await y({data:{revolut_public_id:e,payment_token:t,security:c.nonce.pay_with_token},endpoint:c.route.pay_with_token});n&&n.success?a():i(new Error("failed to pay with saved method"),r)}catch(e){i(new Error("failed to pay with saved method"),r)}},i=(e,t)=>{if(!(t>0))throw s(),new Error(e.message);setTimeout((()=>o(t-1)),n)};o(r)}))}(s,e),await E({publicId:s,hasError:"",captured:!1}),await S({response:t,paymentMethod:O.REVOLUT_CARD,shouldSavePayment:!1,paymentToken:e}))},W=({eventRegistration:e,billing:t,shippingData:r,shouldSavePayment:a,emitResponse:s,components:i,checkoutStatus:u,settings:l})=>{const{onPaymentSetup:d,onCheckoutSuccess:m}
1=e,_=(0,n.useRef)(),y=(0,n.useRef)(),[v,g]=(0,n.useState)(!1),[w,b]=(0,n.useState)([]),[E,R]=(0,n.useState)(!1),[k,x]=(0,n.useState)(""),[P,C]=(0,n.useState)(0),{createErrorNotice:T,removeAllNotices:j}=(0,o.dispatch)("core/notices");(0,n.useEffect)((()=>{const e=d(L),t=m(M);return()=>{e(),t()}}),[m,d,w,v,a,t.billingAddress,r.shippingAddress]),(0,n.useEffect)((()=>{(async()=>{t?.cartTotal?.value&&(R(!0),f().then((e=>{x(e.revolut_order_public_id),C(e.revolut_order_amount),R(!1)})).catch((e=>T(p(e.message||"An unexpected error occurred"),{id:"create_order_failed",context:s.noticeContexts.PAYMENTS}))))})()}),[t.cartTotal.value]);const A=(({onMsg:e,publicId:t},r)=>{const a=(0,n.useRef)(e),s=(0,n.useRef)(null),o=(0,n.useRef)(null);return(0,n.useEffect)((()=>{let e=!1;return o.current&&(o.current.destroy(),a.current({type:"instance_destroyed"})),RevolutCheckout(t).then((t=>{!e&&s.current&&(o.current=t.createCardField({locale:c.locale,target:s.current,hidePostcodeField:!0,onSuccess(){a.current({type:"payment_successful"})},onError(e){I.includes(e.type)?a.current({type:"fields_errors_changed",errors:[e]}):a.current({type:"payment_failed",error:e})},onValidation:e=>a.current({type:"fields_errors_changed",errors:e}),onStatusChange:e=>{a.current({type:"fields_status_changed",status:e})},onCancel(){a.current({type:"payment_cancelled"})}}),a.current({type:"instance_mounted",instance:o.current}))})),()=>{e=!0,o.current&&(o.current.destroy(),o.current=null,a.current({type:"instance_destroyed"}))}}),[t,a,...r]),s})({publicId:k,onMsg:e=>{switch(e.type){case"payment_successful":document.dispatchEvent(new Event("payment_successful"));break;case"payment_failed":document.dispatchEvent(new CustomEvent("payment_failed",{detail:e.error.toString()}));break;case"instance_destroyed":_.current=null;break;case"instance_mounted":_.current=e.instance;break;case"fields_errors_changed":b(e.errors);break;case"fields_status_changed":g(e.status)}}},[P]),L=async()=>{j();let e=null;return t?.billingAddress||(e="Please check your billing address, and retry again."),(!v.completed||w.length>0)&&(e="The payment form is not ready for submission.",_.current&&(_.current.validate(),e="The payment form is not ready for submission. please fix the errors below and retry again.")),l.card_holder_name_field_enabled&&(y.current.isComplete()||(e="The payment form is not ready for submission. please fix the errors below and retry again.")),e?{type:s.responseTypes.ERROR,message:p(e),retry:!0,messageContext:s.noticeContexts.PAYMENTS}:{type:s.responseTypes.SUCCESS}},M=async e=>{R(!0);const{billingAddress:n}=t,{shippingAddress:o}=r,c={name:l.card_holder_name_field_enabled&&y.current.value.length>0?y.current.value:`${n.first_name} ${n.last_name}`,email:n.email,phone:n.phone,savePaymentMethodFor:a||l.is_save_payment_method_mandatory?"merchant":""};void 0!==n.country&&void 0!==n.postcode&&(c.billingAddress=h(n),c.shippingAddress=h(n)),o&&void 0!==o.country&&void 0!==o.postcode&&(c.shippingAddress=h(o));const i=await N({paymentData:c});if(i.success){const t=await S({response:e,paymentMethod:O.REVOLUT_CARD,shouldSavePayment:a});return t&&t.success||R(!1),t}if(i.error)return R(!1),{type:s.responseTypes.ERROR,message:p(i.error||"Unexpected error occurred, please try again later"),retry:!0,messageContext:s.noticeContexts.PAYMENTS};R(!1)},N=async({paymentData:e})=>(_.current.submit(e),new Promise(((e,t)=>{document.addEventListener("payment_successful",(()=>{e({success:!0})})),document.addEventListener("payment_failed",(t=>{e({success:!1,error:t.detail})}))})));return(0,n.useEffect)((()=>{A.current&&(w.length>0?A.current.classList.add("woocommerce-revolut-card-element-error"):A.current.classList.remove("woocommerce-revolut-card-element-error"))}),[w]),(0,Y.jsx)(Y.Fragment,{children:(0,Y.jsx)(i.LoadingMask,{showSpinner:!0,isLoading:u.isProcessing||u.isComplete||E,children:k&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)("div",{children:[(0,Y.jsx)("div",{id:"woocommerce-revolut-card-element",ref:A}),w.length>0&&(0,Y.jsx)(K,{errorList:w})]}),l.card_holder_name_field_enabled&&(0,Y.jsx)("div",{style:{marginTop:10},children:(0,Y.jsx)($,{inputRef:y})}),l.banner.upsell_banner_enabled&&(0,Y.jsx)("div",{children:(0,Y.jsx)(H,{orderToken:k})})]})})})},z={name:O.REVOLUT_CARD,label:(0,Y.jsx)(F,{settings:l}),savedTokenComponent:(0,Y.jsx)(X,{settings:l}),content:(0,Y.jsx)(W,{settings:l}),edit:(0,Y.jsx)("p",{children:p("Revolut Gateway is not available in editor mode")}
1),ariaLabel:p("Revolut Card`s Gateway"),canMakePayment:()=>l.can_make_payment,supports:{features:["products","subscriptions"],showSavedCards:!0,showSaveOption:!l.is_save_payment_method_mandatory}},J=()=>((0,n.useEffect)((()=>{T()}),[]),(0,Y.jsx)("div",{id:M})),Q=i.can_make_payment&&i.banner.points_banner_enabled,Z={metadata:{name:"revolut-gateway-for-woocommerce/revolut-banner",category:"woocommerce",parent:[e.innerBlockAreas.CHECKOUT_ORDER_SUMMARY],attributes:{lock:{type:"object",default:{remove:!0,move:!0}}}},force:!0,component:()=>Q?(0,Y.jsx)(J,{}):""},ee=({billing:e,components:t,checkoutStatus:r,eventRegistration:a,emitResponse:s,onSubmit:c,order:i})=>{const{onCheckoutSuccess:u,onCheckoutFail:l}=a,{VALIDATION_STORE_KEY:d}=window.wc.wcBlocksData,[p,m]=(0,n.useState)(!1),_=((0,n.useRef)(null),(0,n.useRef)(null)),y=(0,n.useRef)(null),h=e=>({type:s.responseTypes.ERROR,message:e,retry:!0,messageContext:s.noticeContexts.PAYMENTS}),{revolutPrbRef:v}=D({paymentOptions:{amount:i.revolut_order_amount,requestPayerInfo:{billingAddress:!1},validate:()=>new Promise(((e,t)=>{m(!0),(0,o.select)(d).hasValidationErrors()&&(m(!1),t("Checkout form is incomplete")),c(),document.addEventListener("checkout_success",(()=>{e(!0)})),document.addEventListener("checkout_fail",(()=>{m(!1),t("Something went wrong")}))})),createOrder:()=>({publicId:i.revolut_order_public_id})},onSuccess:async()=>{m(!0);const e=await S({response:_.current,paymentMethod:O.REVOLUT_PRB,shouldSavePayment:0});e&&e.success||(m(!1),y.current.resolve(h(e.message?e.message:"Something went wrong")))},onError:e=>{m(!1),y.current&&y.current.resolve(h(e))}},[i]);return(0,n.useEffect)((()=>{const e=u((async e=>new Promise((t=>{m(!1),_.current=e,document.dispatchEvent(new CustomEvent("checkout_success")),y.current={resolve:t}})))),t=l((e=>{e&&e.paymentDetails&&e.paymentDetails.wc_order_id||document.dispatchEvent(new CustomEvent("checkout_fail"))}));return()=>{e(),t()}}),[u,l]),U(),(0,Y.jsxs)(Y.Fragment,{children:[" ",(0,Y.jsx)(t.LoadingMask,{showSpinner:!0,isLoading:p||r.isProcessing||r.isComplete,children:(0,Y.jsx)("div",{ref:v})})]})},te=e=>{const[t,r]=(0,n.useState)();if((0,n.useEffect)((()=>{f().then((e=>r(e)))}),[e.billing.cartTotal.value]),t)return(0,Y.jsx)(ee,{...e,order:t})},re={name:"revolut_payment_request",label:(0,Y.jsx)(F,{settings:d}),content:(0,Y.jsx)(te,{}),edit:(0,Y.jsx)("p",{children:p("Google/Apple Pay block is not available in editor mode")}),ariaLabel:"Google Pay/Apple Pay",canMakePayment:()=>d.can_make_payment,paymentMethodId:"revolut_payment_request",supports:{features:["products"]}},ne=({billing:e,setExpressPaymentError:t,eventRegistration:r,onSubmit:a,onClick:s,onClose:o,emitResponse:i})=>{const{onPaymentSetup:u,onCheckoutFail:l}=r,d=(0,n.useRef)(),p=(0,n.useRef)(),{revolutPrbRef:_,destroyRef:h}=D({paymentOptions:{amount:0,requestShipping:!0,validate:()=>(s(),!0),onShippingOptionChange:e=>function(e){let t={security:c.fast_checkout_params.nonce.update_shipping,shipping_method:[e.id],is_product_page:c.fast_checkout_params.is_product_page};return new Promise(((e,r)=>{y({data:t,endpoint:m({endpoint:N.UPDATE_SHIPPING_METHOD})}).then((t=>{e(t)})).catch((e=>{r(e)}))}))}(e),onShippingAddressChange:e=>function(e){let t={security:c.fast_checkout_params.nonce.shipping,country:e.country,state:e.region,postcode:e.postalCode,city:e.city,address:"",address_2:"",is_product_page:c.fast_checkout_params.is_product_page,require_shipping:c.fast_checkout_params.shipping_required};return new Promise(((e,r)=>{y({data:t,endpoint:m({endpoint:N.GET_SHIPPING_OPTIONS})}).then((t=>{e(t)})).catch((e=>{r(e)}))}))}(e),createOrder:()=>new Promise(((e,t)=>{g().then((t=>{p.current=t,e({publicId:t})})).catch((e=>{t(e)}))})),validate(e){d.current=e}},onSuccess:()=>k({onSubmit:a,address:d.current,publicId:p.current}).catch((e=>{h.current(),w(p.current),t(e)})),onError:e=>{t(e||"Something went wrong while completing your payment"),o()},onCancel:e=>{t(e),o()}},[e.cartTotal.value]);return(0,n.useEffect)((()=>{const e=u((()=>({type:i.responseTypes.SUCCESS,meta:{paymentMethodData:{is_express_checkout:1}}}))),r=l((()=>{b(p.current).then((e=>{t(e.message),"failure"===e.type&&h.current()}))}));return()=>{e(),r()}}),[u,l]),(0,Y.jsxs)(Y.Fragment,{children:[" ",(0,Y.jsx)("div",{ref:_})]})},ae={name:"revolut_payment_request_express_checkout",paymentMethodId:"revolut_payment_request",content:(0,Y.jsx)(ne,{}),edit:(0,Y.jsx)("p",{children:p("Google/Apple Pay block is not available in editor mode")}),ariaLabel:"Google Pay/Apple Pay",canMakePayment:()=>d.can_make_payment&&d.is_cart,supports:{features:["products"]}},se=({billing:e,components:t,eventRegistration:r,onSubmit:a,emitResponse:s,order:c})=>{const{onCheckoutSuccess:i,onCheckoutFail:u}
1=r,{VALIDATION_STORE_KEY:l}=window.wc.wcBlocksData,[d,p]=(0,n.useState)(!1),[m,_]=(0,n.useState)(!1),y=(0,n.useRef)(null),h=(0,n.useRef)(null),v=e=>({type:s.responseTypes.ERROR,message:e,retry:!0,messageContext:s.noticeContexts.PAYMENTS}),g={totalAmount:c.revolut_order_amount,validate:()=>(_(!1),new Promise((e=>{p(!0),(0,o.select)(l).hasValidationErrors()&&(p(!1),e(!1)),a(),document.addEventListener("checkout_success",(()=>{e(!0)})),document.addEventListener("checkout_fail",(()=>{p(!1),e(!1)}))}))),createOrder:()=>({publicId:c.revolut_order_public_id})},{revolutPayRef:f}=B({paymentOptions:g,onSuccess:async()=>{p(!0);const e=await S({response:y.current,paymentMethod:O.REVOLUT_PAY,shouldSavePayment:0});e&&e.success||(p(!1),h.current.resolve(v(e.message?e.message:"Something went wrong")))},onError:e=>{p(!1),h.current&&h.current.resolve(v(e))},onCancel:()=>{_(!0),h.current&&h.current.resolve(v("Payment cancelled!"))}},[c]);return(0,n.useEffect)((()=>{const e=i((async e=>new Promise((t=>{if(m)return p(!1),t(v("Payment cancelled!"));p(!1),y.current=e,document.dispatchEvent(new CustomEvent("checkout_success")),h.current={resolve:t}})))),t=u((e=>{e&&e.paymentDetails&&e.paymentDetails.wc_order_id||document.dispatchEvent(new CustomEvent("checkout_fail"))}));return()=>{e(),t()}}),[i,u,m]),U(),(0,Y.jsxs)(Y.Fragment,{children:[" ",(0,Y.jsx)(t.LoadingMask,{showSpinner:!0,isLoading:d,children:(0,Y.jsx)("div",{ref:f})})]})},oe=new URLSearchParams(window.location.search),ce=oe.get("_rp_fr"),ie=oe.get("_rp_oid"),ue=oe.get("_rp_s");(ce||!ue&&ie)&&((0,o.dispatch)("core/notices").createErrorNotice(p(ce||"Payment Rejected"),{id:"rp-fr",context:L}),(0,o.dispatch)(A).__internalSetActivePaymentMethod(O.REVOLUT_PAY));const le=e=>{const[t,r]=(0,n.useState)();if((0,n.useEffect)((()=>{f().then((e=>r(e)))}),[e.billing.cartTotal.value]),t)return(0,Y.jsx)(se,{...e,order:t})},de={name:"revolut_pay",label:(0,Y.jsx)(V,{}),content:(0,Y.jsx)(le,{}),edit:(0,Y.jsx)("p",{children:p("Revolut Pay is not available in editor mode")}),ariaLabel:"Revolut Pay",canMakePayment:()=>i.can_make_payment,paymentMethodId:"revolut_pay",supports:{features:["products"]}},pe=({billing:e,setExpressPaymentError:t,eventRegistration:r,onSubmit:a,onClick:s,onClose:o,emitResponse:i})=>{const{onPaymentSetup:u,onCheckoutFail:l}=r,d=(0,n.useRef)(),p={requestShipping:!0,validate:()=>(s(),!0),createOrder:()=>g().then((e=>(d.current=e,(e=>y({data:{revolut_public_id:e,security:c.fast_checkout_params.nonce.update_order_total},endpoint:m({endpoint:N.UPDATE_PAYMENT_TOTAL})}))(e).then((()=>({publicId:e}))))))},{revolutPayRef:_,destroyRef:h}=B({paymentOptions:p,onSuccess:e=>(async e=>{try{const t=await y({data:{security:c.fast_checkout_params.nonce.load_order_data,revolut_public_id:e},endpoint:m({endpoint:N.LOAD_ORDER_DATA})});if(t)return t;throw new Error("Something went wrong while retrieving the billing address. your payment will be cancelled")}catch(e){throw new Error(e.message||"An unexpected error occurred.")}})(e).then((r=>{k({onSubmit:a,address:r.address_info,publicId:d.current}).catch((r=>{h.current(),w(e),t(r)}))})).catch((r=>{w(e),t(r)})),onError:e=>{t(e||"Something went wrong while completing your payment"),o()},onCancel:e=>{t(e||"Payment cancelled!"),o()}},[e.cartTotal.value]);return(0,n.useEffect)((()=>{const e=u((()=>({type:i.responseTypes.SUCCESS,meta:{paymentMethodData:{is_express_checkout:1}}}))),r=l((()=>{b(d.current).then((e=>{t(e.message),"failure"===e.type&&h.current()}))}));return()=>{e(),r()}}),[u,l]),(0,n.useEffect)((()=>{T()}),[]),(0,Y.jsxs)(Y.Fragment,{children:[" ",(0,Y.jsx)("div",{id:M}),(0,Y.jsx)("div",{ref:_})]})},me=new URLSearchParams(window.location.search),_e=me.get("_rp_fr"),ye=me.get("_rp_oid"),he=me.get("_rp_s");(_e||!he&&ye)&&(0,o.dispatch)("core/notices").createErrorNotice(p(_e||"Payment Rejected"),{id:"rp-fr",context:L});const ve={name:"revolut_pay_express_checkout",edit:(0,Y.jsx)("p",{children:p("Revolut Pay is not available in editor mode")}),ariaLabel:"Revolut Pay",paymentMethodId:"revolut_pay",content:(0,Y.jsx)(pe,{settings:i}),canMakePayment:()=>i.can_make_payment&&i.is_cart,supports:{features:["products"]}},ge=({eventRegistration:e,billing:t,emitResponse:r})=>{const{onPaymentSetup:a,onCheckoutSuccess:s}=e,i=(0,n.useRef)(null),{removeAllNotices:u}=(0,o.dispatch)("core/notices"),l=async()=>{u();try{return await f(!0),{type:r.responseTypes.SUCCESS}}catch(e){return{type:r.responseTypes.ERROR,message:p(e),retry:!0,messageContext:r.noticeContexts.PAYMENTS}}};return(0,n.useEffect)((()=>{const e=a(l),t=s((async e=>new Promise((async(t,n)=>{const{payByBank:a}=await RevolutCheckout.payments({publicToken:c.merchant_public_key,locale:c.locale});i.current=a({createOrder:()=>({publicId:e.processingResponse.paymentDetails.revolut_public_id}),onError:e=>{t({type:r.responseTypes.ERROR,message:p(e||"Unexpected error occurred, please try again later"),retry:!0,messageContext:r.noticeContexts.PAYMENTS})},onSuccess:async()=>{const n=await S({response:e,paymentMethod:O.REVOLUT_PAY_BY_BANK,shouldSavePayment:0}
1);n&&n.success||t({type:r.responseTypes.ERROR,message:n.message?n.message:p("Something went wrong"),retry:!0,messageContext:r.noticeContexts.PAYMENTS})},onCancel:()=>{t({type:r.responseTypes.ERROR,message:p("Payment cancelled!"),retry:!0,messageContext:r.noticeContexts.PAYMENTS})}}),i.current.show()}))));return()=>{i.current&&i.current.destroy(),t(),e()}}),[s]),(0,Y.jsx)(Y.Fragment,{})},fe={name:O.REVOLUT_PAY_BY_BANK,label:(0,Y.jsx)(q,{settings:u}),content:(0,Y.jsx)(ge,{settings:u}),edit:(0,Y.jsx)("p",{children:p("Revolut Pay By Bank Gateway is not available in editor mode")}),ariaLabel:p("Revolut Pay By Bank Gateway"),canMakePayment:()=>u.can_make_payment};(0,t.registerPaymentMethod)(z),(0,t.registerPaymentMethod)(fe),(0,t.registerExpressPaymentMethod)(ve),(0,t.registerPaymentMethod)(de),(0,e.registerCheckoutBlock)(Z),(0,t.registerExpressPaymentMethod)(ae),(0,t.registerPaymentMethod)(re)})()})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.