geno/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/checkout-blocks/express-payment-frontend.js

3 lines
18 KiB
JavaScript
Raw Permalink Normal View History

2024-02-01 17:24:18 +05:30
(self.webpackChunkwebpackWcBlocksJsonp=self.webpackChunkwebpackWcBlocksJsonp||[]).push([[1370],{5032:(e,t,s)=>{"use strict";s.d(t,{Z:()=>a});var n=s(9196),o=s(444);const a=(0,n.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,n.createElement)(o.Path,{d:"M3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zm-1.338 4.877c-.314.22-.412.452-.412.623 0 .171.098.403.412.623.312.218.783.377 1.338.377.825 0 1.605.233 2.198.648.59.414 1.052 1.057 1.052 1.852 0 .795-.461 1.438-1.052 1.852-.41.286-.907.486-1.448.582v.316a.75.75 0 01-1.5 0v-.316a3.64 3.64 0 01-1.448-.582c-.59-.414-1.052-1.057-1.052-1.852a.75.75 0 011.5 0c0 .171.098.403.412.623.312.218.783.377 1.338.377s1.026-.159 1.338-.377c.314-.22.412-.452.412-.623 0-.171-.098-.403-.412-.623-.312-.218-.783-.377-1.338-.377-.825 0-1.605-.233-2.198-.648-.59-.414-1.052-1.057-1.052-1.852 0-.795.461-1.438 1.052-1.852a3.64 3.64 0 011.448-.582V7.5a.75.75 0 011.5 0v.316c.54.096 1.039.296 1.448.582.59.414 1.052 1.057 1.052 1.852a.75.75 0 01-1.5 0c0-.171-.098-.403-.412-.623-.312-.218-.783-.377-1.338-.377s-1.026.159-1.338.377z"}))},9109:(e,t,s)=>{"use strict";s.d(t,{Z:()=>a});var n=s(9196),o=s(444);const a=(0,n.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,n.createElement)(o.Path,{fillRule:"evenodd",d:"M18.646 9H20V8l-1-.5L12 4 5 7.5 4 8v1h14.646zm-3-1.5L12 5.677 8.354 7.5h7.292zm-7.897 9.44v-6.5h-1.5v6.5h1.5zm5-6.5v6.5h-1.5v-6.5h1.5zm5 0v6.5h-1.5v-6.5h1.5zm2.252 8.81c0 .414-.334.75-.748.75H4.752a.75.75 0 010-1.5h14.5a.75.75 0 01.749.75z",clipRule:"evenodd"}))},8214:(e,t,s)=>{"use strict";s.d(t,{Z:()=>a});var n=s(9196),o=s(444);const a=(0,n.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,n.createElement)(o.Path,{fillRule:"evenodd",d:"M5.5 9.5v-2h13v2h-13zm0 3v4h13v-4h-13zM4 7a1 1 0 011-1h14a1 1 0 011 1v10a1 1 0 01-1 1H5a1 1 0 01-1-1V7z",clipRule:"evenodd"}))},1333:(e,t,s)=>{"use strict";s.d(t,{C:()=>a});var n=s(5271);const o=[{id:"alipay",alt:"Alipay",src:n.td+"payment-methods/alipay.svg"},{id:"amex",alt:"American Express",src:n.td+"payment-methods/amex.svg"},{id:"bancontact",alt:"Bancontact",src:n.td+"payment-methods/bancontact.svg"},{id:"diners",alt:"Diners Club",src:n.td+"payment-methods/diners.svg"},{id:"discover",alt:"Discover",src:n.td+"payment-methods/discover.svg"},{id:"eps",alt:"EPS",src:n.td+"payment-methods/eps.svg"},{id:"giropay",alt:"Giropay",src:n.td+"payment-methods/giropay.svg"},{id:"ideal",alt:"iDeal",src:n.td+"payment-methods/ideal.svg"},{id:"jcb",alt:"JCB",src:n.td+"payment-methods/jcb.svg"},{id:"laser",alt:"Laser",src:n.td+"payment-methods/laser.svg"},{id:"maestro",alt:"Maestro",src:n.td+"payment-methods/maestro.svg"},{id:"mastercard",alt:"Mastercard",src:n.td+"payment-methods/mastercard.svg"},{id:"multibanco",alt:"Multibanco",src:n.td+"payment-methods/multibanco.svg"},{id:"p24",alt:"Przelewy24",src:n.td+"payment-methods/p24.svg"},{id:"sepa",alt:"Sepa",src:n.td+"payment-methods/sepa.svg"},{id:"sofort",alt:"Sofort",src:n.td+"payment-methods/sofort.svg"},{id:"unionpay",alt:"Union Pay",src:n.td+"payment-methods/unionpay.svg"},{id:"visa",alt:"Visa",src:n.td+"payment-methods/visa.svg"},{id:"wechat",alt:"WeChat",src:n.td+"payment-methods/wechat.svg"}],a=e=>o.find((t=>t.id===e))||{}},7445:(e,t,s)=>{"use strict";s.d(t,{Z:()=>l});var n=s(9196),o=s(4184),a=s.n(o),r=s(2114),c=s(1333),i=s(8718);s(9086);const l=({icons:e=[],align:t="center",className:s})=>{const o=(0,i.L)(e);if(0===o.length)return null;const l=a()("wc-block-components-payment-method-icons",{"wc-block-components-payment-method-icons--align-left":"left"===t,"wc-block-components-payment-method-icons--align-right":"right"===t},s);return(0,n.createElement)("div",{className:l},o.map((e=>{const t={...e,...(0,c.C)(e.id)};return(0,n.createElement)(r.Z,{key:"payment-method-icon-"+e.id,...t})})))}},2114:(e,t,s)=>{"use strict";s.d(t,{Z:()=>a});var n=s(9196);const o=e=>`wc-block-components-payment-method-icon wc-block-components-payment-method-icon--${e}`,a=({id:e,src:t=null,alt:s=""
(0,n.__)('Coupon code "%s" has been applied to your cart.',"woocommerce"),t),{id:"coupon-form",type:"snackbar",context:e}),Promise.resolve(!0)))).catch((e=>(p({coupon:{message:(0,r.decodeEntities)(e.message),hidden:!1}}),Promise.resolve(!1)))),removeCoupon:t=>g(t).then((()=>((0,c.applyCheckoutFilter)({filterName:"showRemoveCouponNotice",defaultValue:!0,arg:{couponCode:t,context:e}})&&m("info",(0,n.sprintf)(/* translators: %s coupon code. */
(0,n.__)('Coupon code "%s" has been removed from your cart.',"woocommerce"),t),{id:"coupon-form",type:"snackbar",context:e}),Promise.resolve(!0)))).catch((t=>(l(t.message,{id:"coupon-form",context:e}),Promise.resolve(!1)))),isApplyingCoupon:d,isRemovingCoupon:u}}},4570:(e,t,s)=>{"use strict";s.d(t,{z:()=>_});var n=s(5736),o=s(4293),a=s(9307),r=s(2092),c=s(7445),i=s(4617),l=s(7180),m=s.n(l),p=s(1193),d=s(9818),u=s(4801),h=s(711),g=s(4055),y=s(1137),v=s(6423),E=s(5999),b=s(9727),P=s(5810),S=s(3523),k=s(5027);const _=()=>{const{onCheckoutBeforeProcessing:e,onCheckoutValidationBeforeProcessing:t,onCheckoutAfterProcessingWithSuccess:s,onCheckoutAfterProcessingWithError:l,onSubmit:_,onCheckoutSuccess:C,onCheckoutFail:w,onCheckoutValidation:x}=(0,E.U)(),{isCalculating:M,isComplete:R,isIdle:f,isProcessing:A,customerId:I}=(0,d.useSelect)((e=>{const t=e(u.CHECKOUT_STORE_KEY);return{isComplete:t.isComplete(),isIdle:t.isIdle(),isProcessing:t.isProcessing(),customerId:t.getCustomerId(),isCalculating:t.isCalculating()}})),{paymentStatus:T,activePaymentMethod:N,shouldSavePayment:z}=(0,d.useSelect)((e=>{const t=e(u.PAYMENT_STORE_KEY);return{paymentStatus:{get isPristine(){return m()("isPristine",{since:"9.6.0",alternative:"isIdle",plugin:"WooCommerce Blocks",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8110"}),t.isPaymentIdle()},isIdle:t.isPaymentIdle(),isStarted:t.isExpressPaymentStarted(),isProcessing:t.isPaymentProcessing(),get isFinished(){return m()("isFinished",{since:"9.6.0",plugin:"WooCommerce Blocks",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8110"}),t.hasPaymentError()||t.isPaymentReady()},hasError:t.hasPaymentError(),get hasFailed(){return m()("hasFailed",{since:"9.6.0",plugin:"WooCommerce Blocks",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8110"}),t.hasPaymentError()},get isSuccessful(){return m()("isSuccessful",{since:"9.6.0",plugin:"WooCommerce Blocks",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8110"}),t.isPaymentReady()},isReady:t.isPaymentReady(),isDoingExpressPayment:t.isExpressPaymentMethodActive()},activePaymentMethod:t.getActivePaymentMethod(),shouldSavePayment:t.getShouldSavePaymentMethod()}})),{__internalSetExpressPaymentError:D}=(0,d.useDispatch)(u.PAYMENT_STORE_KEY),{onPaymentProcessing:V,onPaymentSetup:O}=(0,b.P)(),{shippingErrorStatus:L,shippingErrorTypes:Z,onShippingRateSuccess:B,onShippingRateFail:F,onShippingRateSelectSuccess:Y,onShippingRateSelectFail:H}=(0,P.d)(),{shippingRates:K,isLoadingRates:W,selectedRates:j,isSelectingRate:U,selectShippingRate:G,needsShipping:$}=(0,k.V)(),{billingAddress:X,shippingAddress:J}=(0,d.useSelect)((e=>e(u.CART_STORE_KEY).getCustomerData())),{setShippingAddress:q}=(0,d.useDispatch)(u.CART_STORE_KEY),{cartItems:Q,cartFees:ee,cartTotals:te,extensions:se}=(0,g.b)(),{appliedCoupons:ne}=(0,y.K)(),oe=(0,a.useRef)((0,S.a)(te,$)),ae=(0,a.useRef)({label:(0,n.__)("Total","woocommerce"),value:parseInt(te.total_price,10)});(0,a.useEffect)((()=>{oe.current=(0,S.a)(te,$),ae.current={label:(0,n.__)("Total","woocommerce"),value:parseInt(te.total_price,10)}}),[te,$]);const re=(0,a.useCallback)(((e="")=>{m()("setExpressPaymentError should only be used by Express Payment Methods (using the provided onError handler).",{alternative:"",plugin:"woocommerce-gutenberg-products-block",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4228"}),D(e)}),[D]);return{activePaymentMethod:N,billing:{appliedCoupons:ne,billingAddress:X,billingData:X,cartTotal:ae.current,cartTotalItems:oe.current,currency:(0,o.getCurrencyFromPriceResponse)(te),customerId:I,displayPricesIncludingTax:(0,i.getSetting)("displayCartPricesIncludingTax",!1)},cartData:{cartItems:Q,cartFees:ee,extensions:se},checkoutStatus:{isCalculating:M,isComplete:R,isIdle:f,isProcessing:A},components:{LoadingMask:p.Z,PaymentMethodIcons:c.Z,PaymentMethodLabel:r.Z,ValidationInputError:h.ValidationInputError},emitResponse:{noticeContexts:v.n7,responseTypes:v.dO},eventRegistration:{onCheckoutAfterProcessingWithError:l,onCheckoutAfterProcessingWithSuccess:s,o