5 lines
53 KiB
JavaScript
5 lines
53 KiB
JavaScript
|
(self.webpackChunkwebpackWcBlocksJsonp=self.webpackChunkwebpackWcBlocksJsonp||[]).push([[5210],{8184:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(9196),o=n(444);const i=(0,r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(o.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"}))},5202:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(9196),o=n(444);const i=(0,r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(o.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}))},5430:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(9196),o=n(444);const i=(0,r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(o.Path,{d:"M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"}))},5045:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(9196),o=n(444);const i=(0,r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(o.Path,{fillRule:"evenodd",d:"M6.863 13.644L5 13.25h-.5a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5H5L18 6.5h2V16h-2l-3.854-.815.026.008a3.75 3.75 0 01-7.31-1.549zm1.477.313a2.251 2.251 0 004.356.921l-4.356-.921zm-2.84-3.28L18.157 8h.343v6.5h-.343L5.5 11.823v-1.146z",clipRule:"evenodd"}))},4877:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(9196),o=n(9685),i=n(4184),s=n.n(i),a=(n(5482),n(4705));const l=({className:e,showSpinner:t=!1,children:n,variant:i="contained",...l})=>{const c=s()("wc-block-components-button","wp-element-button",e,i,{"wc-block-components-button--loading":t});return(0,r.createElement)(o.Z,{className:c,...l},t&&(0,r.createElement)(a.Z,null),(0,r.createElement)("span",{className:"wc-block-components-button__text"},n))}},4427:(e,t,n)=>{"use strict";n.d(t,{Z:()=>w});var r=n(9196),o=n(4184),i=n.n(o),s=n(5736),a=n(2629),l=n(711),c=n(9307),u=n(5027),p=n(7856),d=n.n(p);const m=["a","b","em","i","strong","p","br"],f=["target","href","rel","name","download"],g=(e,t)=>{const n=(null==t?void 0:t.tags)||m,r=(null==t?void 0:t.attr)||f;return d().sanitize(e,{ALLOWED_TAGS:n,ALLOWED_ATTR:r})};var h=n(9097),b=n(4293),v=n(4617);const y=e=>{const t=(0,v.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.price,10)+parseInt(e.taxes,10):parseInt(e.price,10);return{label:(0,a.decodeEntities)(e.name),value:e.rate_id,description:(0,r.createElement)(r.Fragment,null,Number.isFinite(t)&&(0,r.createElement)(l.FormattedMonetaryAmount,{currency:(0,b.getCurrencyFromPriceResponse)(e),value:t}),Number.isFinite(t)&&e.delivery_time?" — ":null,(0,a.decodeEntities)(e.delivery_time))}},E=({className:e="",noResultsMessage:t,onSelectRate:n,rates:o,renderOption:i=y,selectedRate:s,disabled:a=!1})=>{const u=(null==s?void 0:s.rate_id)||"",p=(0,h.D)(u),[d,m]=(0,c.useState)((()=>{var e;return u||(null===(e=o[0])||void 0===e?void 0:e.rate_id)}));if((0,c.useEffect)((()=>{u&&u!==p&&u!==d&&m(u)}),[u,d,p]),(0,c.useEffect)((()=>{d&&n(d)}),[n,d]),0===o.length)return t;if(o.length>1)return(0,r.createElement)(l.RadioControl,{className:e,onChange:e=>{m(e),n(e)},disabled:a,selected:d,options:o.map(i)});const{label:f,secondaryLabel:g,description:b,secondaryDescription:v}=i(o[0]);return(0,r.createElement)(l.RadioControlOptionLayout,{label:f,secondaryLabel:g,description:b,secondaryDescription:v})};n(6125);const w=({packageId:e,className:t="",noResultsMessage:n,renderOption:o,packageData:p,collapsible:d,showItems:m})=>{const{selectShippingRate:f,isSelectingRate:h}=(0,u.V)(),b=document.querySelectorAll(".wc-block-components-shipping-rates-control__package").length>1,v=null!=m?m:b,y=null!=d?d:b,w=(0,r.createElement)(r.Fragment,null,(y||v)&&(0,r.createElement)("div",{className:"wc-block-components-shipping-rates-control__package-title",dangerouslySetInnerHTML:{__html:g(p.name)}}),v&&(0,r.createElement)("ul",{className:"wc-block-components-shipping-rates-control__package-items"},Object.
|
||
|
(0,s._n)("%1$s (%2$d unit)","%1$s (%2$d units)",n,"woocommerce"),t,n)}))})))),_=(0,c.useCallback)((t=>{f(t,e)}),[e,f]),S={className:t,noResultsMessage:n,rates:p.shipping_rates,onSelectRate:_,selectedRate:p.shipping_rates.find((e=>e.selected)),renderOption:o,disabled:h};return y?(0,r.createElement)(l.Panel,{className:i()("wc-block-components-shipping-rates-control__package",t,{"wc-block-components-shipping-rates-control__package--disabled":h}),initialOpen:!1,title:w},(0,r.createElement)(E,{...S})):(0,r.createElement)("div",{className:i()("wc-block-components-shipping-rates-control__package",t,{"wc-block-components-shipping-rates-control__package--disabled":h})},w,(0,r.createElement)(E,{...S}))}},4017:(e,t,n)=>{"use strict";n.d(t,{Z:()=>b});var r=n(9196),o=n(5736),i=n(9307),s=n(1193),a=n(3554),l=n(602),c=n(4055),u=n(8832),p=n(5027),d=n(6131),m=n(7884),f=n(4427),g=n(5158);const h=({packages:e,showItems:t,collapsible:n,noResultsMessage:o,renderOption:i})=>e.length?(0,r.createElement)(r.Fragment,null,e.map((({package_id:e,...s})=>(0,r.createElement)(f.Z,{key:e,packageId:e,packageData:s,collapsible:n,showItems:t,noResultsMessage:o,renderOption:i})))):null,b=({shippingRates:e,isLoadingRates:t,className:n,collapsible:b,showItems:v,noResultsMessage:y,renderOption:E,context:w})=>{(0,i.useEffect)((()=>{var n,r;t||(n=(0,l.wH)(e),r=(0,l.Q_)(e),1===n?(0,g.speak)((0,o.sprintf)(/* translators: %d number of shipping options found. */
|
||
|
(0,o._n)("%d shipping option was found.","%d shipping options were found.",r,"woocommerce"),r)):(0,g.speak)((0,o.sprintf)(/* translators: %d number of shipping packages packages. */
|
||
|
(0,o._n)("Shipping option searched for %d package.","Shipping options searched for %d packages.",n,"woocommerce"),n)+" "+(0,o.sprintf)(/* translators: %d number of shipping options available. */
|
||
|
(0,o._n)("%d shipping option was found","%d shipping options were found",r,"woocommerce"),r)))}),[t,e]);const{extensions:_,receiveCart:S,...k}=(0,c.b)(),N={className:n,collapsible:b,showItems:v,noResultsMessage:y,renderOption:E,extensions:_,cart:k,components:{ShippingRatesControlPackage:f.Z},context:w},{isEditor:T}=(0,u._)(),{hasSelectedLocalPickup:A,selectedRates:R}=(0,p.V)(),x=(0,m.Kn)(R)?Object.values(R):[],L=x.every((e=>e===x[0]));return(0,r.createElement)(s.Z,{isLoading:t,screenReaderLabel:(0,o.__)("Loading shipping rates…","woocommerce"),showSpinner:!0},A&&"woocommerce/cart"===w&&e.length>1&&!L&&!T&&(0,r.createElement)(d.Z,{className:"wc-block-components-notice",isDismissible:!1,status:"warning"},(0,o.__)("Multiple shipments must have the same pickup location","woocommerce")),(0,r.createElement)(a.ExperimentalOrderShippingPackages.Slot,{...N}),(0,r.createElement)(a.ExperimentalOrderShippingPackages,null,(0,r.createElement)(h,{packages:e,noResultsMessage:y,renderOption:E})))}},1193:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(9196),o=n(5736),i=n(4184),s=n.n(i),a=n(711);n(6575);const l=({children:e,className:t,screenReaderLabel:n,showSpinner:i=!1,isLoading:l=!0})=>(0,r.createElement)("div",{className:s()(t,{"wc-block-components-loading-mask":l})},l&&i&&(0,r.createElement)(a.Spinner,null),(0,r.createElement)("div",{className:s()({"wc-block-components-loading-mask__children":l}),"aria-hidden":l},e),l&&(0,r.createElement)("span",{className:"screen-reader-text"},n||(0,o.__)("Loading…","woocommerce")))},6131:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var r=n(9196),o=n(4184),i=n.n(o),s=n(5736),a=n(1984),l=n(5202),c=(n(1365),n(395)),u=n(4877),p=n(2023);const d=({className:e,status:t="default",children:n,spokenMessage:o=n,onRemove:d=(()=>{}),isDismissible:m=!0,politeness:f=(0,c.x)(t),summary:g})=>((0,p.o)(o,f),(0,r.createElement)("div",{className:i()(e,"wc-block-components-notice-banner","is-"+t,{"is-dismissible":m})},(0,r.createElement)(a.Z,{icon:(0,c.X)(t)}),(0,r.createElement)("div",{className:"wc-block-components-notice-banner__content"},g&&(0,r.createElement)("p",{className:"wc-block-components-notice-banner__summary"},g),n),!!m&&(0,r.createElement)(u.Z,{className:"wc-block-components-notice-banner__dismiss",icon:l.Z,label:(0,s.__)("Dismiss this notice","woocommerce"),onClick:e=>{"function"==typeof(null==e?void 0:e.preventDefault)&&e.preventDefault&&e.preventDefault(),d()},showTooltip:!1})))},395:(e,t,n)=>{"use strict";n.d(t,{X:()=>a,x:()=>s});var r=n(8184),o=n(5430),i=n(5045);const s=e=>{switch(e){case"success":case"warning":case"info":case"default":return"polite";default:return"assertive"}},a=e=>{switch(e){case"success":return r.Z;case"warning":case"info":case"error":return o.Z;default:return i.Z}}},7277:(e,t,n)=>{"use strict";n.d(t,{B:()=>c});var r=n(4617),o=n(9307),i=n(9818),s=n(4801),a=n(7844),l=n(5027);const c=()=>{const{needsShipping:e}=(0,l.V)(),{useShippingAsBilling:t,prefersCollection:n}=(0,i.useSelect)((e=>({useShippingAsBilling:e(s.CHECKOUT_STORE_KEY).getUseShippingAsBilling(),prefersCollection:e(s.CHECKOUT_STORE_KEY).prefersCollection()}))),{__internalSetUseShippingAsBilling:c}=(0,i.useDispatch)(s.CHECKOUT_STORE_KEY),{billingAddress:u,setBillingAddress:p,shippingAddress:d,setShippingAddress:m}=(0,a.L)(),f=(0,o.useCallback)((e=>{p({email:e})}),[p]),g=(0,r.getSetting)("forcedBillingAddress",!1);return{shippingAddress:d,billingAddress:u,setShippingAddress:m,setBillingAddress:p,setEmail:f,defaultAddressFields:r.defaultAddressFields,useShippingAsBilling:t,setUseShippingAsBilling:c,needsShipping:e,showShippingFields:!g&&e&&!n,showShippingMethods:e&&!n,showBillingFields:!e||!t||!!n,forcedBillingAddress:g,useBillingAsShipping:g||!!n}}},7844:(e,t,n)=>{"use strict";n.d(t,{L:()=>i});var r=n(9818),o=n(4801);const i=()=>{const{customerData:e,isInitialized:t}=(0,r.useSelect)((e=>{const t=e(o.CART_STORE_KEY);return{customerData:t.getCustomerData(),isInitialized:t.hasFinishedResolution("getCartData")}})),{setShippingAddress:n,setBillingAddress:i}=(0,r.useDispatch)(o.CART_STORE_KEY);return{isInitialized:t,billingAddres
|