"use strict";(self.webpackChunkwebpackWcBlocksCartCheckoutFrontendJsonp=self.webpackChunkwebpackWcBlocksCartCheckoutFrontendJsonp||[]).push([[3398],{1342:(e,t,o)=>{o.d(t,{A:()=>s});var c=o(7723);const s=({defaultTitle:e=(0,c.__)("Step","woocommerce"),defaultDescription:t=(0,c.__)("Step description text.","woocommerce"),defaultShowStepNumber:o=!0})=>({title:{type:"string",default:e},description:{type:"string",default:t},showStepNumber:{type:"boolean",default:o}})},3870:(e,t,o)=>{o.r(t),o.d(t,{default:()=>y});var c=o(1609),s=o(851),a=o(1616),r=o(4656),n=o(7143),l=o(7594),u=o(3588),i=o(7723),d=o(1019),m=o(9499),h=o(8755),p=o(5703),w=o(2516),g=o(56),k=o(558),_=o(6087);const S=()=>{const[e,t]=(0,_.useState)(0),{customerPassword:o}=(0,n.useSelect)((e=>({customerPassword:e(l.checkoutStore).getCustomerPassword()})),[]),{__internalSetCustomerPassword:s}=(0,n.useDispatch)(l.checkoutStore),{setValidationErrors:a,clearValidationError:u}=(0,n.useDispatch)(l.validationStore);return(0,c.createElement)(r.ValidatedTextInput,{type:"password",label:(0,i.__)("Create a password","woocommerce"),className:"wc-block-components-address-form__password",value:o,required:!0,errorId:"account-password",onChange:t=>{s(t),t?e<2?a({"account-password":{message:(0,i.__)("Please create a stronger password","woocommerce"),hidden:!0}}):u("account-password"):a({"account-password":{message:(0,i.__)("Please enter a valid password","woocommerce"),hidden:!0}})},feedback:(0,c.createElement)(k.Ay,{password:o,onChange:e=>t(e)})})},C="wc-guest-checkout-notice",b=()=>{const{shouldCreateAccount:e}=(0,n.useSelect)((e=>({shouldCreateAccount:e(l.checkoutStore).getShouldCreateAccount()}))),{__internalSetShouldCreateAccount:t,__internalSetCustomerPassword:o}=(0,n.useDispatch)(l.checkoutStore),s=(0,p.getSetting)("checkoutAllowsGuest",!1),a=(0,p.getSetting)("checkoutAllowsSignup",!1),u=s&&a,d=!(0,p.getSetting)("generatePassword",!1)&&(u&&e||!s);return s||u||d?(0,c.createElement)(c.Fragment,null,s&&(0,c.createElement)("p",{id:C,className:"wc-block-checkout__guest-checkout-notice"},(0,i.__)("You are currently checking out as a guest.","woocommerce")),u&&(0,c.createElement)(r.CheckboxControl,{className:"wc-block-checkout__create-account",label:(0,i.sprintf)(/* translators: Store name */ /* translators: Store name */
(0,i.__)("Create an account with %s","woocommerce"),(0,p.getSetting)("siteTitle","")),checked:e,onChange:e=>{t(e),o("")}}),d&&(0,c.createElement)(S,null)):null},f=()=>{const{additionalFields:e,customerId:t}=(0,n.useSelect)((e=>{const t=e(l.checkoutStore);return{additionalFields:t.getAdditionalFields(),customerId:t.getCustomerId()}})),{setAdditionalFields:o}=(0,n.useDispatch)(l.checkoutStore),{billingAddress:s,setEmail:a}=(0,d.C)(),{dispatchCheckoutEvent:u}=(0,m.y)(),i={email:s.email,...e};return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(r.StoreNoticesContainer,{context:h.tG.CONTACT_INFORMATION}),(0,c.createElement)(g.l,{id:"contact",addressType:"contact",ariaDescribedBy:C,onChange:e=>{const{email:t,...c}=e;a(t),u("set-email-address"),o(c)},values:i,fields:w.fO},!t&&(0,c.createElement)(b,null)))},E={...(0,o(1342).A)({defaultTitle:(0,i.__)("Contact information","woocommerce"),defaultDescription:(0,i.__)("We'll use this email to send you details and updates about your order.","woocommerce")}),className:{type:"string",default:""},lock:{type:"object",default:{remove:!0,move:!0}}},A=`${w.aW}?redirect_to=${encodeURIComponent(window.location.href)}`,N=()=>{const e=(0,n.useSelect)((e=>e(l.checkoutStore).getCustomerId()));return!(0,p.getSetting)("checkoutShowLoginReminder",!0)||e?null:(0,c.createElement)("a",{className:"wc-block-checkout__login-prompt",href:A},(0,i.__)("Log in","woocommerce"))},y=(0,a.withFilteredAttributes)(E)((({title:e,description:t,children:o,className:a})=>{const i=(0,n.useSelect)((e=>e(l.checkoutStore).isProcessing())),{showFormStepNumbers:d}=(0,u.O)();return(0,c.createElement)(r.FormStep,{id:"contact-fields",disabled:i,className:(0,s.A)("wc-block-checkout__contact-fields",a),title:e,description:t,showStepNumber:d,stepHeadingContent:()=>(0,c.createElement)(N,null)},(0,c.createElement)(f,null),o)}))}}]);