(self.webpackChunkwebpackWcBlocksCartCheckoutFrontendJsonp=self.webpackChunkwebpackWcBlocksCartCheckoutFrontendJsonp||[]).push([[3398],{9017:(e,t,o)=>{"use strict";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}})},1824:(e,t,o)=>{"use strict";o.r(t),o.d(t,{default:()=>K});var c=o(1609),s=o(851),r=o(1616),a=o(4656),n=o(7143),l=o(7594),i=o(9292),d=o(7723),m=o(5251),u=o(3603),_=o(2379),w=o(5703),p=o(812),h=o(3505),g=o(6087),C=o(9491),E=o(3876),S=o(9095);o(3868);const k=[(0,d.__)("Too weak","woocommerce"),(0,d.__)("Weak","woocommerce"),(0,d.__)("Medium","woocommerce"),(0,d.__)("Strong","woocommerce"),(0,d.__)("Very strong","woocommerce")],b=({password:e="",onChange:t})=>{var o;const r=(0,C.useInstanceId)(b,"woocommerce-password-strength-meter");let a=-1;if(e.length>0)if(void 0===window.zxcvbn){const t=(0,E.Bi)(e);a=t.id}else{const t=window.zxcvbn(e);a=t.score}const n=(0,S.Z)(a);return(0,g.useEffect)((()=>{a!==n&&t&&t(a)}),[a,n,t]),(0,c.createElement)("div",{id:r,className:(0,s.A)("wc-block-components-password-strength",{hidden:-1===a})},(0,c.createElement)("label",{htmlFor:r+"-meter",className:"screen-reader-text"},(0,d.__)("Password strength","woocommerce")),(0,c.createElement)("meter",{id:r+"-meter",className:"wc-block-components-password-strength__meter",min:0,max:4,value:a>-1?a:0},null!==(o=k[a])&&void 0!==o?o:""),(0,c.createElement)("div",{id:r+"-result",className:"wc-block-components-password-strength__result"},!!k[a]&&(0,c.createElement)(c.Fragment,null,(0,c.createElement)("span",{className:"screen-reader-text","aria-live":"polite"},(0,d.sprintf)(/* translators: %s: Password strength */ /* translators: %s: Password strength */
(0,d.__)("Password strength: %1$s (%2$d characters long)","woocommerce"),k[a],e.length))," ",(0,c.createElement)("span",{"aria-hidden":!0},k[a]))))},f=b,T=()=>{const[e,t]=(0,g.useState)(0),{customerPassword:o}=(0,n.useSelect)((e=>({customerPassword:e(l.CHECKOUT_STORE_KEY).getCustomerPassword()}))),{__internalSetCustomerPassword:s}=(0,n.useDispatch)(l.CHECKOUT_STORE_KEY);return(0,c.createElement)(a.ValidatedTextInput,{type:"password",label:(0,d.__)("Create a password","woocommerce"),className:"wc-block-components-address-form__password",value:o,required:!0,errorId:"account-password",customValidityMessage:e=>{if(e.valueMissing||e.badInput||e.typeMismatch)return(0,d.__)("Please enter a valid password","woocommerce")},customValidation:t=>!(e<2&&(t.setCustomValidity((0,d.__)("Please create a stronger password","woocommerce")),1)),onChange:e=>s(e),feedback:(0,c.createElement)(f,{password:o,onChange:e=>t(e)})})},O=()=>{const{shouldCreateAccount:e}=(0,n.useSelect)((e=>({shouldCreateAccount:e(l.CHECKOUT_STORE_KEY).getShouldCreateAccount()}))),{__internalSetShouldCreateAccount:t,__internalSetCustomerPassword:o}=(0,n.useDispatch)(l.CHECKOUT_STORE_KEY),s=(0,w.getSetting)("checkoutAllowsGuest",!1),r=(0,w.getSetting)("checkoutAllowsSignup",!1),i=s&&r,m=!(0,w.getSetting)("generatePassword",!1)&&(i&&e||!s);return s||i||m?(0,c.createElement)(c.Fragment,null,s&&(0,c.createElement)("p",{className:"wc-block-checkout__guest-checkout-notice"},(0,d.__)("You are currently checking out as a guest.","woocommerce")),i&&(0,c.createElement)(a.CheckboxControl,{className:"wc-block-checkout__create-account",label:(0,d.sprintf)(/* translators: Store name */ /* translators: Store name */
(0,d.__)("Create an account with %s","woocommerce"),(0,w.getSetting)("siteTitle","")),checked:e,onChange:e=>{t(e),o("")}}),m&&(0,c.createElement)(T,null)):null},N=()=>{const{additionalFields:e,customerId:t}=(0,n.useSelect)((e=>{const t=e(l.CHECKOUT_STORE_KEY);return{additionalFields:t.getAdditionalFields(),customerId:t.getCustomerId()}})),{setAdditionalFields:o}=(0,n.useDispatch)(l.CHECKOUT_STORE_KEY),{billingAddress:s,setEmail:r}=(0,m.C)(),{dispatchCheckoutEvent:i}=(0,u.y)(),d={email:s.email,...e};return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(a.StoreNoticesContainer,{context:_.tG.CONTACT_INFORMATION}),(0,c.createElement)(h.l,{id:"contact",addressType:"contact",onChange:e=>{const{email:t,...c}=e;r(t),i("set-email-address"),o(c)},values:d,fields:p.fO},!t&&(0,c.createElement)(O,null)))},v={...(0,o(9017).A)({defaultTitle:(0,d.__)("Contact information","woocommerce"),defaultDescription:(0,d.__)("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}}},y=`${p.aW}?redirect_to=${encodeURIComponent(window.location.href)}`,A=()=>{const e=(0,n.useSelect)((e=>e(l.CHECKOUT_STORE_KEY).getCustomerId()));return!(0,w.getSetting)("checkoutShowLoginReminder",!0)||e?null:(0,c.createElement)("a",{className:"wc-block-checkout__login-prompt",href:y},(0,d.__)("Log in","woocommerce"))},K=(0,r.withFilteredAttributes)(v)((({title:e,description:t,children:o,className:r})=>{const d=(0,n.useSelect)((e=>e(l.CHECKOUT_STORE_KEY).isProcessing())),{showFormStepNumbers:m}=(0,i.Oy)();return(0,c.createElement)(a.FormStep,{id:"contact-fields",disabled:d,className:(0,s.A)("wc-block-checkout__contact-fields",r),title:e,description:t,showStepNumber:m,stepHeadingContent:()=>(0,c.createElement)(A,null)},(0,c.createElement)(N,null),o)}))},3868:()=>{}}]);