PageSourceSearch

https://academybrand.com/cdn/shop/t/397/assets/AccountResetForm-DqZ-WinK.min.js

js academybrand.com collected 2026-10-07 07:31:52 UTC 3,986 bytes, 25 lines download raw bytes

1import{r as i,j as e}from"./ui-BJRZd8Uu.min.js";import{a as _}from"./findinstore-B3UwSl21.min.js";import{u as k}from"./useCustomerAccessToken-D6xhXpMX.min.js";import{u as C}from"./useCustomerLogin-w7dw3s_4.min.js";import{Paragraph as P}from"./Paragraph-DAmSL5S1.min.js";import{b as v}from"./modules-components-1LXUDLmt.min.js";import"./vendor-CjZsb-BP.min.js";import"./helpers-Dz9cM9xs.min.js";import"./utils-MBwvR6NJ.min.js";import"./ecommerce-CD-8Lu3e.min.js";import"./modules-alpine-CLdT42KN.min.js";import"./alpine-a3s0p2Qf.min.js";import"./modules-animations-BIEAaoM1.min.js";import"./modules-globals-DmFaxSa6.min.js";import"./modules-prodify-8pwSMkc2.min.js";function N(){const[f,a]=i.useState(""),[h,l]=i.useState(!1),[g,s]=i.useState(!1),{updateAccessToken:w}=k(),{loginCustomer:m}=C();return{error:f,success:h,loading:g,resetPassword:async(t,u,x,b)=>{s(!0),a(""),l(!1);const y=`
2      mutation customerReset($id: ID!, $input: CustomerResetInput!) {
3        customerReset(id: $id, input: $input) {
4          customer {
5            id
6            email
7          }
8          customerAccessToken {
9            accessToken
10            expiresAt
11          }
12          customerUserErrors {
13            code
14            field
15            message
16          }
17          userErrors {
18            field
19            message
20          }
21        }
22      }
23    `,r={id:`gid://shopify/Customer/${x}`,input:{password:t,resetToken:b}};if(!t||!u){a("Password and Password confirmation are required"),s(!1);return}if(t!==u){a("Password and Password confirmation must match"),s(!1);return}try{const n=await fetch("/api/2024-07/graphql.json",{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":_.getStorefrontToken()},body:JSON.stringify({query:y,variables:r})});if(!n.ok)throw new Error("Failed to reset password. Please try another time.");const{data:o,errors:d}=await n.json();if(d)throw new Error(d[0].message);const{userErrors:p}=o.customerReset;if(p.length>0){let c="";throw p.forEach(S=>{c+=`${S.message}
24`}),new Error(c)}const{customerUserErrors:E}=o.customerReset;if(E.length>0){let c="";throw E.forEach(S=>{c+=`${S.message}
25`}),new Error(c)}const R=o.customerReset.customerAccessToken.accessToken;w(R),l(!0);const T=o.customerReset.customer.email;m(T,t)}catch(n){return a(n.message),{success:!1}}finally{s(!1)}}}}const H=({section:f})=>{const{new_password_label:a,confirm_password_label:h,button_label:l,button_style:g}=f,[s,w]=i.useState(""),[m,j]=i.useState(""),{error:t,success:u,loading:x,resetPassword:b}=N(),y=async r=>{r.preventDefault();const o=window.location.pathname.split("/"),d=o[3],p=o[4];b(s,m,d,p)};return e.jsx("form",{"data-shopify-captcha":"true",id:"resetForm",onSubmit:y,className:"account-page__form",children:e.jsxs("div",{className:"flex flex-col items-center mt-4 gap-y-4 lg:mt-6 lg:gap-y-6",children:[e.jsxs("div",{className:"w-full",children:[e.jsx("label",{htmlFor:"password",className:"block text-base font-body lg:mb-2 ",children:a}),e.jsx("input",{type:"password",id:"passwordReset",name:"passwordReset",placeholder:" ",className:"!border account-page__input form-field h-10 font-body lg:h-12",value:s,onChange:r=>w(r.target.value),required:!0})]}),e.jsxs("div",{className:"w-full",children:[e.jsx("label",{htmlFor:"password",className:"block text-base font-body lg:mb-2 ",children:h}),e.jsx("input",{type:"password",id:"confirmPasswordReset",name:"confirmPasswordReset",placeholder:" ",className:"!border account-page__input form-field h-10 font-body lg:h-12",value:m,onChange:r=>j(r.target.value),required:!0})]}),t&&e.jsx(P,{text:t,classes:"errors !bg-transparent text-xs font-body text-error-1 text-center !m-0 !p-0 lg:text-sm"}),u&&e.jsx(P,{text:"Successfully reset your password",classes:"success text-center font-body text-xs !m-0 !p-0 lg:text-sm"}),e.jsx(v,{isLoading:x,classes:`${g} !w-full button hover:text-primary`,ariaLabel:"Submit reset password form",children:l})]})})};export{H as AccountResetForm};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.