Files
medicalalert-web-reloaded/wp/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/checkout-blocks/shipping-method-frontend.js
2023-10-10 17:51:46 -04:00

1 line
8.4 KiB
JavaScript

(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[52],{117:function(e,t,c){"use strict";var o=c(13),i=c.n(o),n=c(0),s=c(150),r=c(5),a=c.n(r);c(222);const l=e=>({thousandSeparator:null==e?void 0:e.thousandSeparator,decimalSeparator:null==e?void 0:e.decimalSeparator,fixedDecimalScale:!0,prefix:null==e?void 0:e.prefix,suffix:null==e?void 0:e.suffix,isNumericString:!0});t.a=e=>{var t;let{className:c,value:o,currency:r,onValueChange:p,displayType:d="text",...u}=e;const h="string"==typeof o?parseInt(o,10):o;if(!Number.isFinite(h))return null;const m=h/10**r.minorUnit;if(!Number.isFinite(m))return null;const b=a()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",c),g=null!==(t=u.decimalScale)&&void 0!==t?t:null==r?void 0:r.minorUnit,k={...u,...l(r),decimalScale:g,value:void 0,currency:void 0,onValueChange:void 0},_=p?e=>{const t=+e.value*10**r.minorUnit;p(t)}:()=>{};return Object(n.createElement)(s.a,i()({className:b,displayType:d},k,{value:m,onValueChange:_}))}},222:function(e,t){},292:function(e,t,c){"use strict";var o=c(13),i=c.n(o),n=c(0),s=c(5),r=c.n(s);c(293),t.a=e=>{let{children:t,className:c,headingLevel:o,...s}=e;const a=r()("wc-block-components-title",c),l="h"+o;return Object(n.createElement)(l,i()({className:a},s),t)}},293:function(e,t){},294:function(e,t){},295:function(e,t,c){"use strict";var o=c(1);t.a=e=>{let{defaultTitle:t=Object(o.__)("Step","woocommerce"),defaultDescription:c=Object(o.__)("Step description text.","woocommerce"),defaultShowStepNumber:i=!0}=e;return{title:{type:"string",default:t},description:{type:"string",default:c},showStepNumber:{type:"boolean",default:i}}}},319:function(e,t,c){"use strict";var o=c(0),i=c(5),n=c.n(i),s=c(292);c(294);const r=e=>{let{title:t,stepHeadingContent:c}=e;return Object(o.createElement)("div",{className:"wc-block-components-checkout-step__heading"},Object(o.createElement)(s.a,{"aria-hidden":"true",className:"wc-block-components-checkout-step__title",headingLevel:"2"},t),!!c&&Object(o.createElement)("span",{className:"wc-block-components-checkout-step__heading-content"},c))};t.a=e=>{let{id:t,className:c,title:i,legend:s,description:a,children:l,disabled:p=!1,showStepNumber:d=!0,stepHeadingContent:u=(()=>{})}=e;const h=s||i?"fieldset":"div";return Object(o.createElement)(h,{className:n()(c,"wc-block-components-checkout-step",{"wc-block-components-checkout-step--with-step-number":d,"wc-block-components-checkout-step--disabled":p}),id:t,disabled:p},!(!s&&!i)&&Object(o.createElement)("legend",{className:"screen-reader-text"},s||i),!!i&&Object(o.createElement)(r,{title:i,stepHeadingContent:u()}),Object(o.createElement)("div",{className:"wc-block-components-checkout-step__container"},!!a&&Object(o.createElement)("p",{className:"wc-block-components-checkout-step__description"},a),Object(o.createElement)("div",{className:"wc-block-components-checkout-step__content"},l)))}},496:function(e,t,c){"use strict";c.r(t);var o=c(0),i=c(5),n=c.n(i),s=c(147),r=c(319),a=c(4),l=c(3),p=c(94),d=c(26),u=c(1),h=c(497),m=c(494),b=c(82),g=c(478),k=c(479),_=c(89),w=c(2),O=c(39),v=c(117);const j=e=>{let{minRate:t,maxRate:c,multiple:i=!1}=e;if(void 0===t||void 0===c)return null;const n=Object(w.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(t.price,10)+parseInt(t.taxes,10):parseInt(t.price,10),s=Object(w.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(c.price,10)+parseInt(c.taxes,10):parseInt(c.price,10),r=0===n?Object(o.createElement)("em",null,Object(u.__)("free","woocommerce")):Object(o.createElement)(v.a,{currency:Object(O.getCurrencyFromPriceResponse)(t),value:n});return Object(o.createElement)("span",{className:"wc-block-checkout__shipping-method-option-price"},n!==s||i?Object(o.createInterpolateElement)(0===n&&0===s?"<price />":Object(u.__)("from <price />","woocommerce"),{price:r}):r)};function f(e){return e?{min:e.reduce((e,t)=>Object(_.c)(t.method_id)?e:void 0===e||parseInt(t.price,10)<parseInt(e.price,10)?t:e,void 0),max:e.reduce((e,t)=>Object(_.c)(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 E(e){return e?{min:e.reduce((e,t)=>Object(_.c)(t.method_id)&&(void 0===e||t.price<e.price)?t:e,void 0),max:e.reduce((e,t)=>Object(_.c)(t.method_id)&&(void 0===e||t.price>e.price)?t:e,void 0)}:{min:void 0,max:void 0}}const x=Object(u.__)("Local Pickup","woocommerce"),N=Object(u.__)("Shipping","woocommerce");c(530);const S={hidden:!0,message:Object(u.__)("Shipping options are not available","woocommerce")},C=e=>{let{checked:t,rate:c,showPrice:i,showIcon:s,toggleText:r,multiple:a}=e;return Object(o.createElement)(h.a,{value:"pickup",className:n()("wc-block-checkout__shipping-method-option",{"wc-block-checkout__shipping-method-option--selected":"pickup"===t})},!0===s&&Object(o.createElement)(b.a,{icon:g.a,size:28,className:"wc-block-checkout__shipping-method-option-icon"}),Object(o.createElement)("span",{className:"wc-block-checkout__shipping-method-option-title"},r),!0===i&&Object(o.createElement)(j,{multiple:a,minRate:c.min,maxRate:c.max}))},y=e=>{let{checked:t,rate:c,showPrice:i,showIcon:s,toggleText:r,shippingCostRequiresAddress:p=!1}=e;const d=Object(a.useSelect)(e=>e(l.CART_STORE_KEY).getShippingRates().some(e=>{let{shipping_rates:t}=e;return!t.every(_.d)})),m=p&&(()=>{const e=Object(a.select)("wc/store/validation"),t=e.getValidationError("shipping_state"),c=e.getValidationError("shipping_address_1"),o=e.getValidationError("shipping_country"),i=e.getValidationError("shipping_postcode");return[e.getValidationError("shipping_city"),t,c,o,i].some(e=>void 0!==e)})()&&!d,g=void 0!==c.min&&void 0!==c.max,{setValidationErrors:w,clearValidationError:O}=Object(a.useDispatch)(l.VALIDATION_STORE_KEY);Object(o.useEffect)(()=>{"shipping"!==t||g?O("shipping-rates-error"):w({"shipping-rates-error":S})},[t,O,g,w]);const v=void 0===c.min||m?Object(o.createElement)("span",{className:"wc-block-checkout__shipping-method-option-price"},Object(u.__)("calculated with an address","woocommerce")):Object(o.createElement)(j,{minRate:c.min,maxRate:c.max});return Object(o.createElement)(h.a,{value:"shipping",className:n()("wc-block-checkout__shipping-method-option",{"wc-block-checkout__shipping-method-option--selected":"shipping"===t})},!0===s&&Object(o.createElement)(b.a,{icon:k.a,size:28,className:"wc-block-checkout__shipping-method-option-icon"}),Object(o.createElement)("span",{className:"wc-block-checkout__shipping-method-option-title"},r),!0===i&&v)};var I=e=>{var t,c;let{checked:i,onChange:n,showPrice:s,showIcon:r,localPickupText:a,shippingText:l,shippingCostRequiresAddress:d=!1}=e;const{shippingRates:u}=Object(p.a)();return Object(o.createElement)(m.a,{id:"shipping-method",className:"wc-block-checkout__shipping-method-container",label:"options",onChange:n,checked:i},Object(o.createElement)(y,{checked:i,rate:f(null===(t=u[0])||void 0===t?void 0:t.shipping_rates),showPrice:s,showIcon:r,shippingCostRequiresAddress:d,toggleText:l||N}),Object(o.createElement)(C,{checked:i,rate:E(null===(c=u[0])||void 0===c?void 0:c.shipping_rates),multiple:u.length>1,showPrice:s,showIcon:r,toggleText:a||x}))},T=c(295),R={...Object(T.a)({defaultTitle:Object(u.__)("Shipping method","woocommerce"),defaultDescription:Object(u.__)("Select how you would like to receive your order.","woocommerce")}),className:{type:"string",default:""},showIcon:{type:"boolean",default:!0},showPrice:{type:"boolean",default:!0},localPickupText:{type:"string",default:x},shippingText:{type:"string",default:N},lock:{type:"object",default:{move:!0,remove:!0}},shippingCostRequiresAddress:{type:"boolean",default:!1}};t.default=Object(s.withFilteredAttributes)(R)(e=>{let{title:t,description:c,showStepNumber:i,children:s,className:u,showPrice:h,showIcon:m,shippingText:b,localPickupText:g,shippingCostRequiresAddress:k}=e;const{checkoutIsProcessing:_,prefersCollection:w}=Object(a.useSelect)(e=>{const t=e(l.CHECKOUT_STORE_KEY);return{checkoutIsProcessing:t.isProcessing(),prefersCollection:t.prefersCollection()}}),{setPrefersCollection:O}=Object(a.useDispatch)(l.CHECKOUT_STORE_KEY),{shippingRates:v,needsShipping:j,hasCalculatedShipping:f,isCollectable:E}=Object(p.a)();return j&&f&&v&&E&&d.f?Object(o.createElement)(r.a,{id:"shipping-method",disabled:_,className:n()("wc-block-checkout__shipping-method",u),title:t,description:c,showStepNumber:i},Object(o.createElement)(I,{checked:w?"pickup":"shipping",onChange:e=>{O("pickup"===e)},showPrice:h,showIcon:m,localPickupText:g,shippingText:b,shippingCostRequiresAddress:k}),s):null})}}]);