3 lines
29 KiB
JavaScript
3 lines
29 KiB
JavaScript
|
(self.webpackChunkwebpackWcBlocksJsonp=self.webpackChunkwebpackWcBlocksJsonp||[]).push([[724],{4427:(e,t,n)=>{"use strict";n.d(t,{Z:()=>k});var r=n(9196),o=n(4184),a=n.n(o),i=n(5736),c=n(2629),l=n(711),s=n(9307),u=n(5027),p=n(7856),m=n.n(p);const d=["a","b","em","i","strong","p","br"],f=["target","href","rel","name","download"],g=(e,t)=>{const n=(null==t?void 0:t.tags)||d,r=(null==t?void 0:t.attr)||f;return m().sanitize(e,{ALLOWED_TAGS:n,ALLOWED_ATTR:r})};var h=n(9097),y=n(4293),b=n(4617);const v=e=>{const t=(0,b.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.price,10)+parseInt(e.taxes,10):parseInt(e.price,10);return{label:(0,c.decodeEntities)(e.name),value:e.rate_id,description:(0,r.createElement)(r.Fragment,null,Number.isFinite(t)&&(0,r.createElement)(l.FormattedMonetaryAmount,{currency:(0,y.getCurrencyFromPriceResponse)(e),value:t}),Number.isFinite(t)&&e.delivery_time?" — ":null,(0,c.decodeEntities)(e.delivery_time))}},E=({className:e="",noResultsMessage:t,onSelectRate:n,rates:o,renderOption:a=v,selectedRate:i,disabled:c=!1})=>{const u=(null==i?void 0:i.rate_id)||"",p=(0,h.D)(u),[m,d]=(0,s.useState)((()=>{var e;return u||(null===(e=o[0])||void 0===e?void 0:e.rate_id)}));if((0,s.useEffect)((()=>{u&&u!==p&&u!==m&&d(u)}),[u,m,p]),(0,s.useEffect)((()=>{m&&n(m)}),[n,m]),0===o.length)return t;if(o.length>1)return(0,r.createElement)(l.RadioControl,{className:e,onChange:e=>{d(e),n(e)},disabled:c,selected:m,options:o.map(a)});const{label:f,secondaryLabel:g,description:y,secondaryDescription:b}=a(o[0]);return(0,r.createElement)(l.RadioControlOptionLayout,{label:f,secondaryLabel:g,description:y,secondaryDescription:b})};n(6125);const k=({packageId:e,className:t="",noResultsMessage:n,renderOption:o,packageData:p,collapsible:m,showItems:d})=>{const{selectShippingRate:f,isSelectingRate:h}=(0,u.V)(),y=document.querySelectorAll(".wc-block-components-shipping-rates-control__package").length>1,b=null!=d?d:y,v=null!=m?m:y,k=(0,r.createElement)(r.Fragment,null,(v||b)&&(0,r.createElement)("div",{className:"wc-block-components-shipping-rates-control__package-title",dangerouslySetInnerHTML:{__html:g(p.name)}}),b&&(0,r.createElement)("ul",{className:"wc-block-components-shipping-rates-control__package-items"},Object.values(p.items).map((e=>{const t=(0,c.decodeEntities)(e.name),n=e.quantity;return(0,r.createElement)("li",{key:e.key,className:"wc-block-components-shipping-rates-control__package-item"},(0,r.createElement)(l.Label,{label:n>1?`${t} × ${n}`:`${t}`,screenReaderLabel:(0,i.sprintf)(/* translators: %1$s name of the product (ie: Sunglasses), %2$d number of units in the current cart package */
|
|||
|
(0,i._n)("%1$s (%2$d unit)","%1$s (%2$d units)",n,"woocommerce"),t,n)}))})))),_=(0,s.useCallback)((t=>{f(t,e)}),[e,f]),N={className:t,noResultsMessage:n,rates:p.shipping_rates,onSelectRate:_,selectedRate:p.shipping_rates.find((e=>e.selected)),renderOption:o,disabled:h};return v?(0,r.createElement)(l.Panel,{className:a()("wc-block-components-shipping-rates-control__package",t,{"wc-block-components-shipping-rates-control__package--disabled":h}),initialOpen:!1,title:k},(0,r.createElement)(E,{...N})):(0,r.createElement)("div",{className:a()("wc-block-components-shipping-rates-control__package",t,{"wc-block-components-shipping-rates-control__package--disabled":h})},k,(0,r.createElement)(E,{...N}))}},9490:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(5736);const o=({defaultTitle:e=(0,r.__)("Step","woocommerce"),defaultDescription:t=(0,r.__)("Step description text.","woocommerce"),defaultShowStepNumber:n=!0})=>({title:{type:"string",default:e},description:{type:"string",default:t},showStepNumber:{type:"boolean",default:n}})},4711:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>C});var r=n(9196),o=n(4184),a=n.n(o),i=n(721),c=n(711),l=n(9818),s=n(4801),u=n(5271),p=n(5736),m=n(9307),d=n(5027),f=n(4055),g=n(4293),h=n(2629),y=n(4617),b=n(1984),v=n(444);const E=(0,r.createElement)(v.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(v.Path,{d:"M12 9c-.8 0-1.5.7-1.5 1.5S11.2 12 12 12s1.5-.7 1.5-1.5S12.8 9 12 9zm0-5c-3.6 0-6.5 2.8-6.5 6.2 0 .8.3 1.8.9 3.1.5 1.1 1.2 2.3 2 3.6.7 1 3 3.8 3.2 3.9l.4.5.4-.5c.2-.2 2.6-2.9 3.2-3.9.8-1.2 1.5-2.5 2-3.6.6-1.3.9-2.3.9-3.1C18.5 6.8 15.6 4 12 4zm4.3 8.7c-.5 1-1.1 2.2-1.9 3.4-.5.7-1.7 2.2-2.4 3-.7-.8-1.9-2.3-2.4-3-.8-1.2-1.4-2.3-1.9-3.3-.6-1.4-.7-2.2-.7-2.5 0-2.6 2.2-4.7 5-4.7s5 2.1 5 4.7c0 .2-.1 1-.7 2.4z"}));var k=n(602),_=n(3554);const N=({title:e,setSelectedOption:t,selectedOption:n,pickupLocations:o,onSelectRate:a,renderPickupLocation:i,packageCount:l})=>{const s=document.querySelectorAll(".wc-block-components-local-pickup-select .wc-block-components-radio-control").length>1;return(0,r.createElement)("div",{className:"wc-block-components-local-pickup-select"},!(!s||!e)&&(0,r.createElement)("div",null,e),(0,r.createElement)(c.RadioControl,{onChange:e=>{t(e),a(e)},selected:n,options:o.map((e=>i(e,l)))}))};var T=n(4427);const w=(e,t)=>{const n=(0,y.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.price,10)+parseInt(e.taxes,10):e.price,o=(e=>{if(null!=e&&e.meta_data){const t=e.meta_data.find((e=>"pickup_location"===e.key));return t?t.value:""}return""})(e),a=(e=>{if(null!=e&&e.meta_data){const t=e.meta_data.find((e=>"pickup_address"===e.key));return t?t.value:""}return""})(e),i=(e=>{if(null!=e&&e.meta_data){const t=e.meta_data.find((e=>"pickup_details"===e.key));return t?t.value:""}return""})(e);let l=(0,r.createElement)("em",null,(0,p.__)("free","woocommerce"));return parseInt(n,10)>0&&(l=1===t?(0,r.createElement)(c.FormattedMonetaryAmount,{currency:(0,g.getCurrencyFromPriceResponse)(e),value:n}):(0,m.createInterpolateElement)(/* translators: <price/> is the price of the package, <packageCount/> is the number of packages. These must appear in the translated string. */
|
|||
|
(0,p._n)("<price/> x <packageCount/> package","<price/> x <packageCount/> packages",t,"woocommerce"),{price:(0,r.createElement)(c.FormattedMonetaryAmount,{currency:(0,g.getCurrencyFromPriceResponse)(e),value:n}),packageCount:(0,r.createElement)(r.Fragment,null,t)})),{value:e.rate_id,label:o?(0,h.decodeEntities)(o):(0,h.decodeEntities)(e.name),secondaryLabel:l,description:(0,h.decodeEntities)(i),secondaryDescription:a?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(b.Z,{icon:E,className:"wc-block-editor-components-block-icon"}),(0,h.decodeEntities)(a)):void 0}},S=()=>{var e;const{shippingRates:t,selectShippingRate:n}=(0,d.V)(),o=((null===(e=t[0])||void 0===e?void 0:e.shipping_rates)||[]).filter(k.J3),[a,i]=(0,m.useState)((()=>{var e;return(null===(e=o.find((e=>e.selected)))||void 0===e?void 0:e.rate_id)||""})),c=(0,m.useCallback)((e=>{n(e)}),[n]),{extensions:l,receiveCart:s,...u}=(0,f.b)(),p={extensions:l,cart:u,components:{ShippingRatesControlPackage:T.Z,LocalPickupSelect:N},renderPickupLocation:w};(0,m.useEffect)((()=>{!a&&o[0]&&(i(o[0].rate_id),c(o[0].rate_id))}),[c,o,a]);const g=(0,k.wH)(t);return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(_.ExperimentalOrderLocalPickupPackages.Slot,{...p}),(0,r.createElement)(_.ExperimentalOrderLocalPickupPackages,null,(0,r.createElement)(N,{title:t[0].name,setSelectedOption:i,onSelectRate:c,selectedOption:a,renderPickupLocation:w,pickupLocations:o,packageCount:g})))},A={...(0,n(9490).Z)({defaultTitle:(0,p.__)("Pickup options","woocommerce"),defaultDescription:""}),className:{type:"string",default:""},lock:{type:"object",default:{move:!0,remove:!0}}},C=(0,i.withFilteredAttributes)(A)((({title:e,description:t,showStepNumber:n,children:o,className:i})=>{const{checkoutIsProcessing:p,prefersCollection:m}=(0,l.useSelect)((e=>{const t=e(s.CHECKOUT_STORE_KEY);return{checkoutIsProcessing:t.isProcessing(),prefersCollection:t.prefersCollection()}}));return m&&u.oC?(0,r.createElement)(c.FormStep,{id:"pickup-options",disabled:p,className:a()("wc-block-checkout__pickup-options",i),title:e,description:t,showStepNumber:n},(0,r.createElement)(S,null),o):null}))},7856:function(e){e.exports=function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,n){return t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(e,n)}function n(e,r,o){return n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct:function(e,n,r){var o=[null];o.push.apply(o,n);var a=new(Function.bind.apply(e,o));return r&&t(a,r.prototype),a},n.apply(null,arguments)}function r(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var a=Object.hasOwnProperty,i=Object.setPrototypeOf,c=Object.isFrozen,l=Object.getPrototypeOf,s=Object.getOwnPropertyDescriptor,u=Object.freeze,p=Object.seal,m=Object.create,d="undefined"!=typeof Reflect&&Reflect,f=d.apply,g=d.construct;f||(f=function(e,t,n){return e.apply(t,n)}),u||(u=function(e){return e}),p||(p=function(e){return e}),g||(g=function(e,t){return n(e,r(t))});var h,y=C(Ar
|