PageSourceSearch

https://assets.hojyokin-portal.jp/build/assets/auth-modal-mount-hust7cEd.js

js hojyokin-portal.jp collected 2026-10-03 22:21:31 UTC 12,637 bytes, 1 lines download raw bytes

1import{u as N,r as i,a as x,b as v,j as e,e as f,C as w,c as y,d as g,A as B,s as R,f as A}from"./app-DIwdpFOQ.js";const C="_overlay_1wm2k_1",L="_modal_1wm2k_14",M="_closeButton_1wm2k_25",S="_closeIcon_1wm2k_40",q="_titleWrap_1wm2k_45",E="_title_1wm2k_45",F="_titleBar_1wm2k_58",V="_description_1wm2k_64",G="_formArea_1wm2k_73",P="_formGroup_1wm2k_77",D="_labelRow_1wm2k_81",T="_requiredBadge_1wm2k_87",W="_label_1wm2k_81",I="_input_1wm2k_110",O="_errorMessage_1wm2k_132",z="_forgotPassword_1wm2k_141",U="_submitButton_1wm2k_156",H="_backButton_1wm2k_176 _submitButton_1wm2k_156",J="_footer_1wm2k_182",K="_link_1wm2k_192",Q="_checkboxArea_1wm2k_203",X="_checkboxRow_1wm2k_208",Y="_checkbox_1wm2k_203",Z="_checkboxLabel_1wm2k_251",$="_confirmField_1wm2k_259",ee="_confirmLabel_1wm2k_266",se="_confirmValue_1wm2k_274",s={overlay:C,modal:L,closeButton:M,closeIcon:S,titleWrap:q,title:E,titleBar:F,description:V,formArea:G,formGroup:P,labelRow:D,requiredBadge:T,label:W,input:I,errorMessage:O,forgotPassword:z,submitButton:U,backButton:H,footer:J,link:K,checkboxArea:Q,checkboxRow:X,checkbox:Y,checkboxLabel:Z,confirmField:$,confirmLabel:ee,confirmValue:se};function ae({onLogin:r,onNavigateRegister:n,onNavigatePasswordReset:c}){const a=N(),[o,d]=i.useState(""),[l,u]=i.useState(""),[m,t]=i.useState(!1),p=i.useMemo(()=>({email:[x.required()],password:[x.required()]}),[]),{errors:h,validateAll:b,setFieldErrors:_}=v(p);return e.jsxs("div",{"data-testid":"auth-modal-login",children:[e.jsxs("div",{className:s.titleWrap,children:[e.jsx("span",{className:s.title,children:"ログイン"}),e.jsx("div",{className:s.titleBar})]}),e.jsx("p",{className:s.description,children:"補助金の保存にはログインが必要です。"}),e.jsxs("form",{className:s.formArea,noValidate:!0,onSubmit:async j=>{if(j.preventDefault(),!!b({email:o,password:l})&&a){t(!0);try{const k=await a.login(o,l);k.ok?r():_(f(k))}finally{t(!1)}}},children:[e.jsxs("div",{className:s.formGroup,children:[e.jsxs("div",{className:s.labelRow,children:[e.jsx("span",{className:s.requiredBadge,children:"必須"}),e.jsx("span",{className:s.label,children:"メールアドレス"})]}),e.jsx("input",{className:s.input,type:"email",placeholder:"[email protected]",value:o,onChange:j=>d(j.target.value),"data-testid":"auth-modal-login-email","data-error":!!h.email||void 0}),h.email&&e.jsx("p",{className:s.errorMessage,"data-testid":"validation-error",children:h.email})]}),e.jsxs("div",{className:s.formGroup,children:[e.jsxs("div",{className:s.labelRow,children:[e.jsx("span",{className:s.requiredBadge,children:"必須"}),e.jsx("span",{className:s.label,children:"パスワード(半角英数8文字以上)"})]}),e.jsx("input",{className:s.input,type:"password",placeholder:"*********",value:l,onChange:j=>u(j.target.value),"data-testid":"auth-modal-login-password","data-error":!!h.password||void 0}),h.password&&e.jsx("p",{className:s.errorMessage,"data-testid":"validation-error",children:h.password})]}),e.jsx("div",{className:s.forgotPassword,children:e.jsx("button",{type:"button",className:s.link,onClick:c,"data-testid":"auth-modal-link-password-reset",children:"パスワードをお忘れの方はこちら"})}),e.jsx("button",{type:"submit",className:s.submitButton,"data-testid":"auth-modal-login-submit",children:"ログイン"})]}),e.jsxs("p",{className:s.footer,children:["登録がお済みでない場合は",e.jsx("button",{type:"button",className:s.link,onClick:n,"data-testid":"auth-modal-link-register",children:"会員登録"})]})]})}function te({onNavigateRegister:r}){const n=N(),[c,a]=i.useState(""),[o,d]=i.useState(!1),[l,u]=i.useState(!1),[m,t]=i.useState("");return e.jsxs("div",{"data-testid":"auth-modal-password-reset",children:[e.jsxs("div",{className:s.titleWrap,children:[e.jsx("span",{className:s.title,children:"パスワードをお忘れの方"}),e.jsx("div",{className:s.titleBar})]}),e.jsxs("p",{className:s.description,children:["ご登録のメールアドレスをご入力ください。パスワードリセットURLをメールで送信いたします。メールアドレスをお忘れの方は、",e.jsx("a",{className:s.link,href:"https://hojyokin-portal.jp/contact",children:"こちらからお問い合わせ"}),"ください。"]}),e.jsxs("form",{className:s.formArea,noValidate:!0,onSubmit:async p=>{if(p.preventDefault(),!c.trim()){t("入力してください。");return}if(n){u(!0),t("");try{const h=await n.sendPasswordReset(c);if(h.ok)d(!0);else{const b=f(h);t(b.email??h.message)}}finally{u(!1)}}},children:[e.jsxs("div",{className:s.formGroup,children:[e.jsxs("div",{className:s.labelRow,children:[e.jsx("span",{className:s.requiredBadge,children:"必須"}),e.jsx("span",{className:s.label,children:"メールアドレス"})]}),e.jsx("input",{className:s.input,type:"email",placeholder:"[email protected]",value:c,onChange:p=>{a(p.target.value),t("")},"data-error":!!m||void 0}),m&&e.jsx("p",{className:s.errorMessage,"data-testid":"validation-error",children:m})]}),e.jsx("button",{type:"submit",className:s.submitButton,disabled:l,children:o?"パスワード再設定メールをé€
1ä¿¡ã—ました":"パスワード再設定メールを送信"})]}),e.jsxs("p",{className:s.footer,children:["登録がお済みでない場合は",e.jsx("button",{type:"button",className:s.link,onClick:r,children:"会員登録"})]})]})}function re({data:r,onSubmit:n,onBack:c}){const a=N(),[o,d]=i.useState(!1),[l,u]=i.useState({}),m=Object.keys(l).length>0;return e.jsxs("div",{"data-testid":"auth-modal-register-confirm",children:[e.jsxs("div",{className:s.titleWrap,children:[e.jsx("span",{className:s.title,children:"入力内容確認"}),e.jsx("div",{className:s.titleBar})]}),e.jsx("p",{className:s.description,children:"入力内容をご確認ください。内容に問題なければ送信ボタンを押してください。"}),m&&e.jsx("div",{className:s.formArea,children:Object.entries(l).map(([t,p])=>e.jsx("p",{className:s.errorMessage,"data-testid":"validation-error",children:p},t))}),e.jsxs("div",{children:[r.company&&e.jsxs("div",{className:s.confirmField,children:[e.jsx("div",{className:s.confirmLabel,children:"会社名・屋号"}),e.jsx("div",{className:s.confirmValue,children:r.company})]}),e.jsxs("div",{className:s.confirmField,children:[e.jsx("div",{className:s.confirmLabel,children:"氏名"}),e.jsx("div",{className:s.confirmValue,children:r.name})]}),e.jsxs("div",{className:s.confirmField,children:[e.jsx("div",{className:s.confirmLabel,children:"パスワード"}),e.jsx("div",{className:s.confirmValue,children:"********"})]}),e.jsxs("div",{className:s.confirmField,children:[e.jsx("div",{className:s.confirmLabel,children:"メールアドレス"}),e.jsx("div",{className:s.confirmValue,children:r.email})]}),e.jsxs("div",{className:s.confirmField,children:[e.jsx("div",{className:s.confirmLabel,children:"メール配信"}),e.jsx("div",{className:s.confirmValue,children:r.newsletter?"受け取る":"受け取らない"})]})]}),e.jsx("button",{type:"button",className:s.submitButton,disabled:o,onClick:async()=>{if(a){d(!0);try{const t=await a.register(r);t.ok?n():u(f(t))}finally{d(!1)}}},"data-testid":"auth-modal-register-confirm-submit",children:"この内容で送信する"}),e.jsx("button",{type:"button",className:s.backButton,onClick:c,"data-testid":"auth-modal-register-confirm-back",children:"編集画面に戻る"})]})}const le={name:"",company:"",email:"",password:"",newsletter:!1,agreeTerms:!1};function oe({onSubmit:r,onNavigateLogin:n,initialData:c}){const[a,o]=i.useState(c??le),d=i.useMemo(()=>({name:[x.required()],email:[x.required(),x.email()],password:[x.required(),x.minLength(8)]}),[]),{errors:l,validateAll:u}=v(d),m=(t,p)=>o(h=>({...h,[t]:p}));return e.jsxs("div",{"data-testid":"auth-modal-register",children:[e.jsxs("div",{className:s.titleWrap,children:[e.jsx("span",{className:s.title,children:"会員登録"}),e.jsx("div",{className:s.titleBar})]}),e.jsx("p",{className:s.description,children:"補助金の保存には会員登録(無料)が必要です。"}),e.jsxs("form",{className:s.formArea,noValidate:!0,onSubmit:t=>{t.preventDefault(),u({name:a.name,email:a.email,password:a.password})&&r(a)},children:[e.jsxs("div",{className:s.formGroup,children:[e.jsxs("div",{className:s.labelRow,children:[e.jsx("span",{className:s.requiredBadge,children:"必須"}),e.jsx("span",{className:s.label,children:"氏名"})]}),e.jsx("input",{className:s.input,type:"text",placeholder:"補助金 太郎",value:a.name,onChange:t=>m("name",t.target.value),"data-error":!!l.name||void 0}),l.name&&e.jsx("p",{className:s.errorMessage,"data-testid":"validation-error",children:l.name})]}),e.jsxs("div",{className:s.formGroup,children:[e.jsx("div",{className:s.labelRow,children:e.jsx("span",{className:s.label,children:"会社名・屋号"})}),e.jsx("input",{className:s.input,type:"text",placeholder:"補助金ポータル",value:a.company,onChange:t=>m("company",t.target.value)})]}),e.jsxs("div",{className:s.formGroup,children:[e.jsxs("div",{className:s.labelRow,children:[e.jsx("span",{className:s.requiredBadge,children:"必須"}),e.jsx("span",{className:s.label,children:"メールアドレス"})]}),e.jsx("input",{className:s.input,type:"email",placeholder:"[email protected]",value:a.email,onChange:t=>m("email",t.target.value),"data-error":!!l.email||void 0}),l.email&&e.jsx("p",{className:s.errorMessage,"data-testid":"validation-error",children:l.email})]}),e.jsxs("div",{className:s.formGroup,children:[e.jsxs("div",{className:s.labelRow,children:[e.jsx("span",{className:s.requiredBadge,children:"必須"}),e.jsx("span",{className:s.label,children:"パスワード(半角英数8文字以上)"})]}),e.jsx("input",{className:s.input,type:"password",placeholder:"*********",value:a.password,onChange:t=>m("password",t.target.value),"data-error":!!l.password||void 0}),l.password&&e.jsx("p",{className:s.errorMessage,"data-testid":"validation-error",children:l.password})]}),e.jsxs("div",{className:s.checkboxArea,children:[e.jsxs("label",{className:s.checkboxRow,children:[e.jsx("input",{className:s.checkbox,type:"checkbox",checked:a.newsletter,onChange:t=>m("newsletter",t.target.checked)}),e.jsxs("span",{className:s.checkboxLabel,children:["メール配信を受け取る(",e.jsx("a",{href:"/mail-magazine_rule",target:"_blank",rel:"noopener noreferrer",className:s.link,children:"メルマガ利用規約"}),")"]})]}),e.jsxs("label",{className:s.checkboxRow,children:[e.jsx("input",{className:s.checkbox,type:"checkbox",checked:a.agreeTerms,onChange:t=>m("agreeTerms",t.target.checked)}),e.jsxs("span",{className:s.checkboxLabel,children:[e.jsx("a",{href:"/rule",target:"_blank",rel:"noopener noreferrer",className:s.link,children:"利用規約"}),"・",e.jsx("a",{href:"/privacy",target:"_blank",rel:"noopener noreferrer",className:s.link,children:"個人情報保護方針"}),"に同意する"]})]})]}),e.jsx("button",{type:"submit",className:s.submitButton,disabled:!a.agreeTerms||!a.name.trim()||!a.email.trim()||!a.password.trim(),"data-testid":"auth-modal-register-submit",children:"登録して使用する"})]}),e.jsxs("p",{className:s.footer,children:["アカウントをお持ちの場合は",e.jsx("button",{type:"button",className:s.link,onClick:n,"data-testid":"auth-modal-link-login",children:"ログイン"})]})]})}function ie({onClose:r,onAuthenticated:n,initialView:c="login"}){const[a,o]=i.useState(c),[d,l]=i.useState(null);return e.jsx("div",{className:s.overlay,"data-testid":"auth-modal-overlay",onClick:r,children:e.jsxs("div",{className:s.modal,onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true",children:[e.jsx("button",{type:"button",className:s.closeButton,onClick:r,"data-testid":"auth-modal-close","aria-label":"閉じる",children:e.jsx(w,{className:s.closeIcon})}),a==="login"&&e.jsx(ae,{onLogin:n,onNavigateRegister:()=>o("register"),onNavigatePasswordReset:()=>o("password-reset")}),a==="register"&&e.jsx(oe,{initialData:d,onSubmit:u=>{l(u),o("register-confirm")},onNavigateLogin:()=>o("login")}),a==="register-confirm"&&d&&e.jsx(re,{data:d,onSubmit:n,onBack:()=>o("register")}),a==="password-reset"&&e.jsx(te,{onNavigateRegister:()=>o("register")})]})})}function ne(){const[r,n]=g(R),[c,a]=g(A),o=i.useCallback(()=>{n(!1),a(null)},[a,n]),d=i.useCallback(()=>
1{if(c){window.location.href=c;return}window.location.reload()},[c]);return r?e.jsx(B,{children:e.jsx(ie,{onClose:o,onAuthenticated:d})}):null}function de(){const r=document.createElement("div");r.id="auth-modal-root",document.body.appendChild(r),y.createRoot(r).render(e.jsx(ne,{}))}export{de as setupAuthModal};

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.