1 line
7.7 KiB
JavaScript
1 line
7.7 KiB
JavaScript
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[33],{175:function(e,t,n){"use strict";var c=n(14),i=n.n(c),r=n(23),o=n.n(r),a=n(6),s=n.n(a),l=(n(10),n(248),["children","className","headingLevel"]);t.a=function(e){var t=e.children,n=e.className,c=e.headingLevel,r=o()(e,l),a=s()("wc-block-components-title",n),u="h".concat(c);return React.createElement(u,i()({className:a},r),t)}},248:function(e,t){},345:function(e,t,n){"use strict";var c=n(14),i=n.n(c),r=n(188);t.a=function(e){return function(t){return function(n){var c=Object(r.a)(e,n);return React.createElement(t,i()({},n,c))}}}},346:function(e,t){},349:function(e,t,n){"use strict";var c=n(1);t.a=function(e){var t=e.defaultTitle,n=void 0===t?Object(c.__)("Step",'woocommerce'):t,i=e.defaultDescription,r=void 0===i?Object(c.__)("Step description text.",'woocommerce'):i,o=e.defaultShowStepNumber;return{title:{type:"string",default:n},description:{type:"string",default:r},showStepNumber:{type:"boolean",default:void 0===o||o}}}},350:function(e,t,n){"use strict";var c=n(6),i=n.n(c),r=(n(10),n(175)),o=(n(346),function(e){var t=e.title,n=e.stepHeadingContent;return React.createElement("div",{className:"wc-block-components-checkout-step__heading"},React.createElement(r.a,{"aria-hidden":"true",className:"wc-block-components-checkout-step__title",headingLevel:"2"},t),!!n&&React.createElement("span",{className:"wc-block-components-checkout-step__heading-content"},n))});t.a=function(e){var t=e.id,n=e.className,c=e.title,r=e.legend,a=e.description,s=e.children,l=e.disabled,u=void 0!==l&&l,d=e.showStepNumber,b=void 0===d||d,p=e.stepHeadingContent,f=void 0===p?function(){}:p,h=r||c?"fieldset":"div";return React.createElement(h,{className:i()(n,"wc-block-components-checkout-step",{"wc-block-components-checkout-step--with-step-number":b,"wc-block-components-checkout-step--disabled":u}),id:t,disabled:u},!(!r&&!c)&&React.createElement("legend",{className:"screen-reader-text"},r||c),!!c&&React.createElement(o,{title:c,stepHeadingContent:f()}),React.createElement("div",{className:"wc-block-components-checkout-step__container"},!!a&&React.createElement("p",{className:"wc-block-components-checkout-step__description"},a),React.createElement("div",{className:"wc-block-components-checkout-step__content"},s)))}},352:function(e,t,n){"use strict";n.d(t,"a",(function(){return p}));var c=n(4),i=n.n(c),r=n(23),o=n.n(r),a=n(2),s=n(0),l=n(66),u=n(60),d=["email"];function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);t&&(c=c.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,c)}return n}var p=function(){var e=Object(l.b)().needsShipping,t=Object(u.b)(),n=t.billingData,c=t.setBillingData,r=t.shippingAddress,p=t.setShippingAddress,f=t.shippingAsBilling,h=t.setShippingAsBilling,m=Object(s.useRef)(f),O=Object(s.useRef)(n),g=Object(s.useCallback)((function(e){p(e),f&&c(e)}),[f,p,c]),v=Object(s.useCallback)((function(t){c(t),e||p(t)}),[e,p,c]);Object(s.useEffect)((function(){if(m.current!==f){if(f)O.current=n,c(r);else{var e=O.current,t=(e.email,o()(e,d));c(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?b(Object(n),!0).forEach((function(t){i()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},t))}m.current=f}}),[f,c,r,n]);var j=Object(s.useCallback)((function(e){c({email:e})}),[c]),w=Object(s.useCallback)((function(e){c({phone:e})}),[c]),k=Object(s.useCallback)((function(e){g({phone:e})}),[g]);return{defaultAddressFields:a.defaultAddressFields,shippingFields:r,setShippingFields:g,billingFields:n,setBillingFields:v,setEmail:j,setPhone:w,setShippingPhone:k,shippingAsBilling:f,setShippingAsBilling:h,showShippingFields:e,showBillingFields:!e||!m.current}}},353:function(e,t,n){"use strict";var c=n(1),i=n(276);t.a=function(e){var t=e.id,n=void 0===t?"phone":t,r=e.isRequired,o=void 0!==r&&r,a=e.value,s=void 0===a?"":a,l=e.onChange;return React.createElement(i.a,{id:n,type:"tel",autoComplete:"tel",required:o,label:o?Object(c.__)("Phone",'woocommerce'):Object(c.__)("Phone (optional)",'woocommerce'),value:s,onChange:l})}},372:function(e,t,n){"use strict";var c=n(12),i=n(19),r=n(0),o=n(7),a=n(6),s=n.n(a),l=n(37),u=Object(r.createContext)(!1),d=u.Consumer,b=u.Provider,p=["BUTTON","FIELDSET","INPUT","OPTGROUP","OPTION","SELECT","TEXTAREA"];function f(e){var t=e.className,n=e.children,a=Object(i.a)(e,["className","children"]),u=Object(r.useRef)(),d=function(){l.focus.focusable.find(u.current).forEach((function(e){Object(o.includes)(p,e.nodeName)&&e.setAttribute("disabled",""),"A"===e.nodeName&&e.setAttribute("tabindex",-1);var t=e.getAttribute("tabindex");null!==t&&"-1"!==t&&e.removeAttribute("tabindex"),e.hasAttribute("contenteditable")&&e.setAttribute("contenteditable","false")}))},f=Object(r.useCallback)(Object(o.debounce)(d,{leading:!0}),[]);return Object(r.useLayoutEffect)((function(){d();var e=new window.MutationObserver(f);return e.observe(u.current,{childList:!0,attributes:!0,subtree:!0}),function(){e.disconnect(),f.cancel()}}),[]),Object(r.createElement)(b,{value:!0},Object(r.createElement)("div",Object(c.a)({ref:u,className:s()(t,"components-disabled")},a),n))}f.Consumer=d,t.a=f},411:function(e,t,n){"use strict";n.r(t);var c=n(345),i=n(350),r=n(48),o=n(352),a=n(0),s=n(372),l=n(52),u=n(36),d=n(335),b=n(353),p=function(e){var t=e.showCompanyField,n=void 0!==t&&t,c=e.showApartmentField,i=void 0!==c&&c,r=e.showPhoneField,p=void 0!==r&&r,f=e.requireCompanyField,h=void 0!==f&&f,m=e.requirePhoneField,O=void 0!==m&&m,g=Object(o.a)(),v=g.defaultAddressFields,j=g.billingFields,w=g.setBillingFields,k=g.setPhone,y=Object(l.a)().dispatchCheckoutEvent,E=Object(u.a)().isEditor;Object(a.useEffect)((function(){p||k("")}),[p,k]);var P=Object(a.useMemo)((function(){return{company:{hidden:!n,required:h},address_2:{hidden:!i}}}),[n,h,i]),F=E?s.a:a.Fragment;return React.createElement(F,null,React.createElement(d.a,{id:"billing",type:"billing",onChange:function(e){w(e),y("set-billing-address")},values:j,fields:Object.keys(v),fieldConfig:P}),p&&React.createElement(b.a,{isRequired:O,value:j.phone,onChange:function(e){k(e),y("set-phone-number",{step:"billing"})}}))},f=n(4),h=n.n(f),m=n(1),O=n(349);function g(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);t&&(c=c.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,c)}return n}function v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?g(Object(n),!0).forEach((function(t){h()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var j=v(v({},Object(O.a)({defaultTitle:Object(m.__)("Billing address",'woocommerce'),defaultDescription:Object(m.__)("Enter the address that matches your card or payment method.",'woocommerce')})),{},{lock:{type:"object",default:{move:!0,remove:!0}}}),w=n(219);t.default=Object(c.a)(j)((function(e){var t=e.title,n=e.description,c=e.showStepNumber,a=e.children,s=Object(r.b)().isProcessing,l=Object(o.a)().showBillingFields,u=Object(w.b)(),d=u.requireCompanyField,b=u.requirePhoneField,f=u.showApartmentField,h=u.showCompanyField,m=u.showPhoneField;return l?React.createElement(i.a,{id:"billing-fields",disabled:s,className:"wc-block-checkout__billing-fields",title:t,description:n,showStepNumber:c},React.createElement(p,{requireCompanyField:d,showApartmentField:f,showCompanyField:h,showPhoneField:m,requirePhoneField:b}),a):null}))}}]); |