geno/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/checkout-blocks/shipping-method-frontend.js

1 line
5.7 KiB
JavaScript
Raw Permalink Normal View History

2024-02-01 17:24:18 +05:30
"use strict";(self.webpackChunkwebpackWcBlocksJsonp=self.webpackChunkwebpackWcBlocksJsonp||[]).push([[7413],{9490:(e,t,o)=>{o.d(t,{Z:()=>c});var i=o(5736);const c=({defaultTitle:e=(0,i.__)("Step","woocommerce"),defaultDescription:t=(0,i.__)("Step description text.","woocommerce"),defaultShowStepNumber:o=!0})=>({title:{type:"string",default:e},description:{type:"string",default:t},showStepNumber:{type:"boolean",default:o}})},8191:(e,t,o)=>{o.r(t),o.d(t,{default:()=>V});var i=o(9196),c=o(4184),n=o.n(c),s=o(721),r=o(711),p=o(9818),a=o(4801),l=o(5027),d=o(5271),h=o(5736),u=o(1789),g=o(8557),m=o(1984),_=o(1526),k=o(6520),w=o(9307),b=o(602),E=o(4617),v=o(4293);const f=({minRate:e,maxRate:t,multiple:o=!1})=>{if(void 0===e||void 0===t)return null;const c=(0,E.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.price,10)+parseInt(e.taxes,10):parseInt(e.price,10),n=(0,E.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(t.price,10)+parseInt(t.taxes,10):parseInt(t.price,10),s=0===c?(0,i.createElement)("em",null,(0,h.__)("free","woocommerce")):(0,i.createElement)(r.FormattedMonetaryAmount,{currency:(0,v.getCurrencyFromPriceResponse)(e),value:c});return(0,i.createElement)("span",{className:"wc-block-checkout__shipping-method-option-price"},c!==n||o?(0,w.createInterpolateElement)(0===c&&0===n?"<price />":(0,h.__)("from <price />","woocommerce"),{price:s}):s)};function x(e){return e?{min:e.reduce(((e,t)=>(0,b.Ep)(t.method_id)?e:void 0===e||parseInt(t.price,10)<parseInt(e.price,10)?t:e),void 0),max:e.reduce(((e,t)=>(0,b.Ep)(t.method_id)?e:void 0===e||parseInt(t.price,10)>parseInt(e.price,10)?t:e),void 0)}:{min:void 0,max:void 0}}function I(e){return e?{min:e.reduce(((e,t)=>(0,b.Ep)(t.method_id)&&(void 0===e||t.price<e.price)?t:e),void 0),max:e.reduce(((e,t)=>(0,b.Ep)(t.method_id)&&(void 0===e||t.price>e.price)?t:e),void 0)}:{min:void 0,max:void 0}}const S=(0,h.__)("Local Pickup","woocommerce"),T=(0,h.__)("Shipping","woocommerce");o(6483);const C={hidden:!0,message:(0,h.__)("Shipping options are not available","woocommerce")},P=({checked:e,rate:t,showPrice:o,showIcon:c,toggleText:s,multiple:r})=>(0,i.createElement)(u.Z,{value:"pickup",className:n()("wc-block-checkout__shipping-method-option",{"wc-block-checkout__shipping-method-option--selected":"pickup"===e})},!0===c&&(0,i.createElement)(m.Z,{icon:_.Z,size:28,className:"wc-block-checkout__shipping-method-option-icon"}),(0,i.createElement)("span",{className:"wc-block-checkout__shipping-method-option-title"},s),!0===o&&(0,i.createElement)(f,{multiple:r,minRate:t.min,maxRate:t.max})),y=({checked:e,rate:t,showPrice:o,showIcon:c,toggleText:s,shippingCostRequiresAddress:r=!1})=>{const l=(0,p.useSelect)((e=>e(a.CART_STORE_KEY).getShippingRates().some((({shipping_rates:e})=>!e.every(b.J3))))),d=r&&(()=>{const e=(0,p.select)("wc/store/validation"),t=e.getValidationError("shipping_state"),o=e.getValidationError("shipping_address_1"),i=e.getValidationError("shipping_country"),c=e.getValidationError("shipping_postcode");return[e.getValidationError("shipping_city"),t,o,i,c].some((e=>void 0!==e))})()&&!l,g=void 0!==t.min&&void 0!==t.max,{setValidationErrors:_,clearValidationError:E}=(0,p.useDispatch)(a.VALIDATION_STORE_KEY);(0,w.useEffect)((()=>{"shipping"!==e||g?E("shipping-rates-error"):_({"shipping-rates-error":C})}),[e,E,g,_]);const v=void 0===t.min||d?(0,i.createElement)("span",{className:"wc-block-checkout__shipping-method-option-price"},(0,h.__)("calculated with an address","woocommerce")):(0,i.createElement)(f,{minRate:t.min,maxRate:t.max});return(0,i.createElement)(u.Z,{value:"shipping",className:n()("wc-block-checkout__shipping-method-option",{"wc-block-checkout__shipping-method-option--selected":"shipping"===e})},!0===c&&(0,i.createElement)(m.Z,{icon:k.Z,size:28,className:"wc-block-checkout__shipping-method-option-icon"}),(0,i.createElement)("span",{className:"wc-block-checkout__shipping-method-option-title"},s),!0===o&&v)},R=({checked:e,onChange:t,showPrice:o,showIcon:c,localPickupText:n,shippingText:s})=>{var r,p;const{shippingRates:a}=(0,l.V)(),d=(0,E.getSetting)("shipping