(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8711],{9446:function(e,r,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/_sites/[site]/auth/forgot-password",function(){return t(65276)}])},65276:function(e,r,t){"use strict";t.r(r),t.d(r,{__N_SSP:function(){return h},default:function(){return f}});var s=t(97458),a=t(4829),n=t(37141),l=t(76454),i=t(91845),o=t(54598),c=t(23073),d=t(10208);let ForgotPasswordForm=()=>{let{t:e}=(0,c.$G)("platform"),{form:r,sendPasswordResetEmail:t,isLoading:a}=(0,d.p)();return(0,s.jsxs)(i.l0,{...r,children:[(0,s.jsx)(o.xu,{mb:"5",children:(0,s.jsx)(o.X6,{as:"h3",size:"5",mt:"-1",children:e("auth.resetPassword")})}),(0,s.jsxs)("form",{onSubmit:r.handleSubmit(t),className:"space-y-4",children:[(0,s.jsx)(l.n,{control:r.control,label:e("auth.form.email"),name:"email",placeholder:e("auth.form.emailPlaceholder"),type:"email"}),(0,s.jsx)(o.kC,{pt:"2",children:(0,s.jsx)(n.z,{size:"3",block:!0,loading:a,children:e("auth.form.reset")})}),(0,s.jsx)(o.kC,{gap:"2",direction:"column",children:(0,s.jsx)(o.xv,{size:"3",children:(0,s.jsx)(o.rU,{href:"/login",children:e("auth.cta.loginWithPassword")})})})]})]})};var u=t(86330),m=t(45987);let ForgotPasswordPage=e=>{let{authorId:r}=e;return r?(0,s.jsx)(u.Z,{className:"px-6 py-12 sm:px-12",children:(0,s.jsx)(ForgotPasswordForm,{})}):(0,s.jsx)(m.Z,{})};ForgotPasswordPage.getLayout=function(e){return(0,s.jsx)(a.M,{...e.props,children:e})};var h=!0,f=ForgotPasswordPage},37141:function(e,r,t){"use strict";t.d(r,{z:function(){return c}});var s=t(97458),a=t(31023),n=t(96812),l=t(72317),i=t(54598),o=t(52983);let c=o.forwardRef((e,r)=>{let{children:t,className:o,loading:c,block:d,...u}=e,m=(0,l.h)().radixVariant;return(0,s.jsxs)(i.zx,{className:(0,n.cn)("flex flex-nowrap whitespace-nowrap",d&&"w-full",o),variant:m,...u,ref:r,disabled:c||u.disabled,children:[c&&(0,s.jsx)(a.Z,{size:"s"}),(0,s.jsx)("span",{className:"flex gap-2 items-center",children:t})]})})},86330:function(e,r,t){"use strict";t.d(r,{Z:function(){return Card}});var s=t(97458),a=t(72317),n=t(54598);let Card=e=>{let{children:r,className:t,...l}=e,i=(0,a.h)().radixVariant;return(0,s.jsx)(n.Zb,{className:t,...l,variant:l.variant||i,children:r})}},76454:function(e,r,t){"use strict";t.d(r,{n:function(){return TextField}});var s=t(97458),a=t(72317);t(52983);var n=t(54598),l=t(91845);function TextField(e){let{className:r,control:t,placeholder:i,helpText:o,label:c,inputClassName:d,name:u,inputRef:m,icon:h,suffix:f,suffixSide:x,size:j="3",...g}=e,p=(0,a.h)().radixVariant;return(0,s.jsx)(l.Wi,{control:t,name:u,render:e=>{let{field:t,fieldState:a}=e;return(0,s.jsxs)(l.xJ,{className:r,children:[(0,s.jsx)(l.lX,{children:c}),(0,s.jsx)(l.NI,{children:(0,s.jsx)(n.nv.f,{size:j,color:a.invalid?"red":void 0,placeholder:i,variant:a.invalid?"soft":p,...g,...t,children:f&&(0,s.jsx)(n.nv.g,{side:x,children:f})})}),(0,s.jsx)(l.zG,{}),o&&(0,s.jsx)(l.pf,{children:o})]})}})}},91845:function(e,r,t){"use strict";t.d(r,{NI:function(){return x},Wi:function(){return FormField},l0:function(){return d},lX:function(){return f},pf:function(){return j},xJ:function(){return h},zG:function(){return g}});var s=t(97458),a=t(96812),n=t(52983),l=t(10746),i=t(41591),o=t(54598),c=t(82531);let d=i.RV,u=n.createContext({}),FormField=e=>{let{...r}=e;return(0,s.jsx)(u.Provider,{value:{name:r.name},children:(0,s.jsx)(i.Qr,{...r})})},useFormField=()=>{let e=n.useContext(u),r=n.useContext(m),{getFieldState:t,formState:s}=(0,i.Gc)(),a=t(e.name,s);if(!e)throw Error("useFormField should be used within <FormField>");let{id:l}=r;return{id:l,name:e.name,formItemId:"".concat(l,"-form-item"),formDescriptionId:"".concat(l,"-form-item-description"),formMessageId:"".concat(l,"-form-item-message"),...a}},m=n.createContext({}),h=n.forwardRef((e,r)=>{let{className:t,...l}=e,i=n.useId();return(0,s.jsx)(m.Provider,{value:{id:i},children:(0,s.jsx)("div",{ref:r,className:(0,a.cn)("space-y-2",t),...l})})});h.displayName="FormItem";let f=n.forwardRef((e,r)=>{let{className:t,...n}=e,{error:l,formItemId:i}=useFormField();return(0,s.jsx)(c._,{ref:r,className:(0,a.cn)(l&&"text-destructive",t),htmlFor:i,...n})});f.displayName="FormLabel";let x=n.forwardRef((e,r)=>{let{...t}=e,{error:a,formItemId:n,formDescriptionId:i,formMessageId:o}=useFormField();return(0,s.jsx)(l.g7,{ref:r,id:n,"aria-describedby":a?"".concat(i," ").concat(o):"".concat(i),"aria-invalid":!!a,...t})});x.displayName="FormControl";let j=n.forwardRef((e,r)=>{let{className:t,...n}=e,{formDescriptionId:l}=useFormField();return(0,s.jsx)("p",{ref:r,id:l,className:(0,a.cn)("text-sm text-gray-500",t),...n})});j.displayName="FormDescription";let g=n.forwardRef((e,r)=>{let{className:t,children:n,...l}=e,{error:i,formMessageId:c}=useFormField(),d=i?String(null==i?void 0:i.message):n;return d?(0,s.jsx)(o.xv,{ref:r,id:c,className:(0,a.cn)("text-sm font-medium",t),color:"red",...l,children:d}):null});g.displayName="FormMessage"},82531:function(e,r,t){"use strict";t.d(r,{_:function(){return i}});var s=t(97458),a=t(96812),n=t(52983),l=t(17556);let i=n.forwardRef((e,r)=>{let{className:t,...n}=e;return(0,s.jsx)(l.f,{ref:r,className:(0,a.cn)("text-base font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...n})});i.displayName=l.f.displayName},4829:function(e,r,t){"use strict";t.d(r,{M:function(){return PlatformAuthLayout}});var s=t(97458),a=t(23073),n=t(42176);t(52983);var l=t(54598);function LanguageSwitcher(){let{i18n:e}=(0,a.$G)(),r=(0,n.useRouter)(),{pathname:t,query:i}=r;return(0,s.jsxs)(l.h_.fC,{children:[(0,s.jsx)(l.h_.xz,{children:(0,s.jsxs)(l.hU,{variant:"ghost",children:["pl"===e.language?(0,s.jsx)("span",{className:"font-medium",children:"PL"}):(0,s.jsx)("span",{className:"font-medium",children:"EN"}),(0,s.jsx)("span",{className:"sr-only",children:"Toggle language"})]})}),(0,s.jsxs)(l.h_.VY,{children:[(0,s.jsxs)(l.h_.ck,{onClick:()=>e.changeLanguage("en",()=>r.push({pathname:t,query:i},r.asPath,{locale:"en"})),children:[(0,s.jsx)("span",{children:"\uD83C\uDDFA\uD83C\uDDF8"}),(0,s.jsx)("span",{className:"ml-2",children:"EN"})]}),(0,s.jsxs)(l.h_.ck,{onClick:()=>e.changeLanguage("pl",()=>r.push({pathname:t,query:i},r.asPath,{locale:"pl"})),children:[(0,s.jsx)("span",{children:"\uD83C\uDDF5\uD83C\uDDF1"}),(0,s.jsx)("span",{className:"ml-2",children:"PL"})]})]})]})}var i=t(96290),o=t(72317);let LoginCta=()=>{let{theme:e}=(0,o.h)(),{t:r}=(0,a.$G)("platform");return(0,s.jsx)("div",{className:"mt-10 text-center",children:(0,s.jsxs)(l.xv,{weight:"medium",color:"gray",size:"2",children:[r("auth.cta.dontHaveAccount")," ",(0,s.jsx)(l.rU,{href:"/",color:e,children:r("auth.cta.checkProducts")})]})})};var c=t(75712);let PageHeader=()=>{let{metadata:e,showPageTitle:r}=(0,o.h)();return(0,s.jsxs)("div",{className:"mx-auto w-full",children:[(0,s.jsx)(c.f,{}),r&&(0,s.jsx)(l.X6,{as:"h2",size:"7",className:"text-center",children:e.pageTitle})]})};var d=t(62781),u=t(8663),m=t(97064),h=t(12232);let f=(0,h.withUser)({whenUnauthedBeforeInit:h.AuthAction.RENDER,whenUnauthedAfterInit:h.AuthAction.RENDER,whenAuthed:h.AuthAction.RENDER,whenAuthedBeforeRedirect:h.AuthAction.RENDER})(()=>{let e=(0,h.useUser)();return e.id?(0,s.jsx)(m.B9,{userId:e.id,children:(0,s.jsx)(u.Z,{})}):null}),PlatformAuthLayout=e=>{let{children:r,withUserMenu:t,pageTitle:a,pageDescription:n,authorId:l,mainPage:c,...u}=e;return(0,s.jsx)(o.W,{platformTheme:u,pageTitle:a,pageDescription:n,authorId:l,children:(0,s.jsxs)("div",{className:"flex px-4 md:px-0 min-h-dvh flex-col max-w-7xl mx-auto",children:[(0,s.jsxs)("div",{className:"flex w-full justify-end p-6 gap-x-6 self-start items-center",children:[(0,s.jsx)(LanguageSwitcher,{}),(0,s.jsx)(i.O,{}),t&&(0,s.jsx)(f,{})]}),(0,s.jsxs)("div",{className:"flex h-auto flex-1 flex-col w-full max-w-md justify-center mb-12 sm:mb-24 self-center",children:[(0,s.jsx)(PageHeader,{}),(0,s.jsx)("div",{className:"mt-10",children:r}),c===d.ZO.Sales&&(0,s.jsx)(LoginCta,{})]})]})})}},10208:function(e,r,t){"use strict";t.d(r,{p:function(){return useForgotPassword}});var s=t(23169),a=t(79122),n=t(91653),l=t(60276),i=t(52983),o=t(41591),c=t(60696),d=t(23073),u=t(5394),m=t(72317);let h=u.Ry({email:u.Z_().trim().email({message:null===d.ag||void 0===d.ag?void 0:d.ag.t("validationErrors.wrongEmail")})}),useForgotPassword=e=>{let[r,t]=(0,i.useState)(!1),{authorId:u}=(0,m.h)(),{t:f,i18n:x}=(0,d.$G)("platform"),j=(0,o.cI)({resolver:(0,a.F)(h),defaultValues:{email:""}});return(0,i.useEffect)(()=>{e?j.setValue("email",String(e)):j.setFocus("email")},[]),{form:j,sendPasswordResetEmail:async function(e){let{email:r}=e;t(!0);try{await (0,l.V1)(s.wk,"users-sendResetPasswordEmail")({email:r,authorId:u,lang:x.language,continueUrl:"".concat(window.location.origin)}),c.Am.success(f("auth.resetPasswordEmailSent")),j.reset()}catch(r){var a;let e=null===(a=(0,n.by5)(r))||void 0===a?void 0:a.message.toLowerCase();c.Am.error(e),e.includes("email")&&j.setError("email",{type:"custom",message:e})}finally{t(!1)}},isLoading:r}}}},function(e){e.O(0,[2908,2200,8365,8397,7844,1591,4488,1653,4598,9774,2888,179],function(){return e(e.s=9446)}),_N_E=e.O()}]);