oont-contents/plugins/woocommerce/assets/client/blocks/checkout-blocks/shipping-methods-frontend.js
2025-02-08 15:10:23 +01:00

1 line
No EOL
2.9 KiB
JavaScript

"use strict";(self.webpackChunkwebpackWcBlocksCartCheckoutFrontendJsonp=self.webpackChunkwebpackWcBlocksCartCheckoutFrontendJsonp||[]).push([[5806],{9017:(e,t,i)=>{i.d(t,{A:()=>s});var n=i(7723);const s=({defaultTitle:e=(0,n.__)("Step","woocommerce"),defaultDescription:t=(0,n.__)("Step description text.","woocommerce"),defaultShowStepNumber:i=!0})=>({title:{type:"string",default:e},description:{type:"string",default:t},showStepNumber:{type:"boolean",default:i}})},3701:(e,t,i)=>{i.r(t),i.d(t,{default:()=>F});var n=i(1609),s=i(851),o=i(1616),r=i(4656),c=i(5251),a=i(7143),l=i(7594),p=i(9292),d=i(7723),m=i(4958),u=i(4107),h=i(8460),g=i(8531),_=i(5683),w=i(910),b=i(2663),S=i(2379),f=i(8537),k=i(5703),E=i(2566);const y=e=>{const t=(0,k.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.price,10)+parseInt(e.taxes,10):parseInt(e.price,10),i=0===t?(0,n.createElement)("span",{className:"wc-block-checkout__shipping-option--free"},(0,d.__)("Free","woocommerce")):(0,n.createElement)(r.FormattedMonetaryAmount,{currency:(0,w.getCurrencyFromPriceResponse)(e),value:t});return{label:(0,f.decodeEntities)(e.name),value:e.rate_id,description:(0,f.decodeEntities)(e.description),secondaryLabel:i,secondaryDescription:(0,f.decodeEntities)(e.delivery_time)}},C=({noShippingPlaceholder:e=null})=>{const{isEditor:t}=(0,b.m)(),{shippingRates:i,needsShipping:s,isLoadingRates:o,hasCalculatedShipping:c,isCollectable:a}=(0,m.m)(),{shippingAddress:l}=(0,u.q)(),p=a?i.map((e=>({...e,shipping_rates:e.shipping_rates.filter((e=>!(0,g.jV)(e.method_id)))}))):i;if(!s)return null;const w=(0,g.T4)(i);if(!c&&!w)return(0,n.createElement)("p",null,(0,d.__)("Shipping options will be displayed here after entering your full shipping address.","woocommerce"));const f=(0,_.KY)(l);return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(r.StoreNoticesContainer,{context:S.tG.SHIPPING_METHODS}),t&&!w?e:(0,n.createElement)(h.A,{noResultsMessage:(0,n.createElement)(n.Fragment,null,f?(0,n.createElement)(E.A,{isDismissible:!1,className:"wc-block-components-shipping-rates-control__no-results-notice",status:"warning"},(0,d.__)("There are no shipping options available. Please check your shipping address.","woocommerce")):(0,d.__)("Add a shipping address to view shipping options.","woocommerce")),renderOption:y,collapsible:!1,shippingRates:p,isLoadingRates:o,context:"woocommerce/checkout"}))},N={...(0,i(9017).A)({defaultTitle:(0,d.__)("Shipping options","woocommerce"),defaultDescription:""}),className:{type:"string",default:""},lock:{type:"object",default:{move:!0,remove:!0}}},F=(0,o.withFilteredAttributes)(N)((({title:e,description:t,children:i,className:o})=>{const{showFormStepNumbers:d}=(0,p.Oy)(),m=(0,a.useSelect)((e=>e(l.CHECKOUT_STORE_KEY).isProcessing())),{showShippingMethods:u}=(0,c.C)();return u?(0,n.createElement)(r.FormStep,{id:"shipping-option",disabled:m,className:(0,s.A)("wc-block-checkout__shipping-option",o),title:e,description:t,showStepNumber:d},(0,n.createElement)(C,null),i):null}))}}]);