1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3459],{73700:function(t,e,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/login",function(){return s(22551)}])},22551:function(t,e,s){"use strict";s.r(e),s.d(e,{__N_SSP:function(){return v}});var n=s(85893),r=s(67294),i=s(87536),o=s(11163),a=s(90512),c=s(60839),l=s(14640),u=s(126),d=s(98936),h=s.n(d),p=s(24742),m=s(98029),x=s(15104),y=s(49362),b=s(73109),f=s(46871),g=s(34874);let C=()=>{let t=(0,o.useRouter)(),e=(0,l.useTranslations)("LoginPage"),{register:s,handleSubmit:u,watch:d,setValue:C}=(0,i.cI)(),v=d("phoneNumber","").replace(/\D/g,"").length>=10,{setOtpResponse:N}=(0,y.z)(),{setProfile:w,updateProfile:j}=(0,b.x)(),[_,k]=(0,r.useState)(!1),{mutate:O,isPending:M}=(0,m.D)({mutationFn:t=>p.Z.otp(t),onError:()=>{},onSuccess:e=>{N(e),k(!0),t.push("/login/verify")}}),{mutate:R}=(0,m.D)({mutationFn:t=>p.Z.loginPhoneNumber(t),onError:t=>{(0,f.Aw)(t)===g.j.RECORD_NOT_FOUND&&j({isUserProfile:!1})},onSuccess:t=>{w(t)}});return(0,n.jsxs)("div",{className:"flex w-full h-screen",children:[(0,n.jsx)("div",{className:"w-[40%] bg-primary flex flex-col items-center justify-center md:hidden",children:(0,n.jsxs)("div",{className:"flex flex-col items-start",children:[(0,n.jsx)(h(),{className:"text-white square-14"}),(0,n.jsx)("div",{className:"text-header-4 font-bold text-white",children:"Smile Migraine"}),(0,n.jsxs)("p",{className:"mt-4 text-white text-body-16 leading-relaxed",children:[e("tagline1"),(0,n.jsx)("br",{}),e("tagline2")]})]})}),(0,n.jsxs)("div",{className:"w-[60%] md:w-full flex flex-col",children:[(0,n.jsxs)("div",{className:"hidden md:flex bg-primary items-center h-14 px-4 gap-3 shrink-0",children:[(0,n.jsx)("button",{type:"button",onClick:()=>
1t.back(),className:"text-white p-1","aria-label":e("back"),children:(0,n.jsx)(c.YFh,{size:22})}),(0,n.jsx)("span",{className:"flex-1 text-center text-white text-body-16 font-medium pr-8",children:e("headerTitle")})]}),(0,n.jsx)("div",{className:"px-10 pt-8 md:hidden",children:(0,n.jsxs)(x.A,{type:"button",variant:"light",onClick:()=>t.back(),className:"flex items-center gap-1 text-gray-400 hover:text-gray-600 transition-colors",children:[(0,n.jsx)(c.YFh,{size:16}),(0,n.jsx)("span",{className:"text-body-14",children:e("back")})]})}),(0,n.jsx)("div",{className:"flex-1 flex items-center justify-center px-10 md:items-start md:px-5 md:pt-8 overflow-y-auto",children:(0,n.jsxs)("div",{className:"w-full max-w-[480px]",children:[(0,n.jsx)("h1",{className:"text-header-3 font-bold text-black-500 mb-2",children:e("title")}),(0,n.jsx)("p",{className:"text-body-14 text-gray-400 mb-8",children:e("subtitle")}),(0,n.jsxs)("form",{onSubmit:u(t=>{null==O||O({...t,countryCode:"+66"}),null==R||R({...t,countryCode:"+66"})}),noValidate:!0,children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("label",{className:"block text-body-14 font-medium text-black-500 mb-2",children:e("phoneLabel")}),(0,n.jsx)("input",{...s("phoneNumber",{onChange:t=>{let e=t.target.value.replace(/\D/g,"");t.target.value=e,C("phoneNumber",e)}}),type:"tel",maxLength:10,inputMode:"numeric",placeholder:e("phonePlaceholder"),className:"w-full border border-gray-200 rounded-xl px-4 py-3 text-body-16 placeholder:text-gray-300 focus:outline-none focus:border-primary transition-colors"})]}),(0,n.jsx)(x.A,{type:"submit",disabled:!v,isLoading:M||_,className:(0,a.Z)("w-full py-3 rounded-xl text-body-16 font-medium transition-colors mt-1",v&&!_?"bg-primary text-white hover:bg-primary-300 cursor-pointer":"bg-gray-200 text-white cursor-not-allowed"),children:e("submit")})]})]})}),(0,n.jsxs)("div",{className:"px-10 pb-8 text-center shrink-0",children:[(0,n.jsx)("p",{className:"text-body-12 text-gray-400",children:e("helpText")}),(0,n.jsxs)("p",{className:"text-body-12 text-gray-400 mt-1",children:["LINE Official:"," ",(0,n.jsx)("a",{href:"https://line.me/R/ti/p/@sm-clinic?from=page&accountId=sm-clinic",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-primary transition-colors",children:"SM Clinic"})," ","| Facebook:"," ",(0,n.jsx)("a",{href:"https://www.facebook.com/SmileMigraine/?locale=th_TH",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-primary transition-colors",children:"Smile Migraine"})]}),(0,n.jsx)("p",{className:"text-body-12 text-gray-400 mt-1",children:e("footerNote")})]})]})]})};C.getLayout=t=>(0,u.Vs)({page:t});var v=!0;e.default=C},24742:function(t,e,s){"use strict";s.d(e,{Z:function(){return i}});var n=s(59970),r=s(84349);class i extends n.Z{static async otp(t){return this._post("/otp/send",t)}static async verifyOtp(t){return this._post("/otp/verify",t)}static async loginPhoneNumber(t){return this._post("/users/login/phone-number",t)}static async acceptPolicy(t){return this._patch("/v2/user/consent",t,{baseURL:r.Vi.API_ENDPOINT})}static async getLatestConsent(t){return this._get("/user/consent/latest",t)}static async getTermAndConditions(t,e){let s=t.key?"&key=".concat(t.key):"",n=t.platform?"&platform=".concat(t.platform):"";return this._get("/user/term-and-conditions/ask?groupKey=".concat(t.groupKey).concat(s).concat(n),e)}static async getTermAndConditionsFull(t){let e=t.key?"&key=".concat(t.key):"";return this._get("/user/term-and-conditions/full?groupKey=".concat(t.groupKey).concat(e))}static async getTermAndConditionsGroup(t){let e=t.platform?"&platform=".concat(t.platform):"";return this._get("/user/term-and-conditions?groupKey=".concat(t.groupKey).concat(e))}static async getTermAndConditionsFullPublic(t,e){let s=t.key?"&key=".concat(t.key):"";return this._get("/users/term-and-conditions/full?groupKey=".concat(t.groupKey).concat(s),e)}static async agreeTermAndConditions(t){return this._post("/user/term-and-conditions/agree",t)}static async agreeWithdrawTermAndConditions(t){return this._patch("/user/term-and-conditions",t)}static async seenTermAndConditions(t){return this._post("/user/term-and-conditions/seen",t)}static async refresh(t){return this._post("/users/refresh",t)}}},49362:function(t,e,s){"use strict";s.d(e,{z:function(){return i}});var n=s(64529),r=s(782);let i=(0,n.Ue)()((0,r.tJ)(t=>({otpResponse:null,setOtpResponse:e=>{t({otpResponse:e})},clearOtpResponse:()=>{t({otpResponse:null})}}),{name:"otp-response"}))},98936:function(t,e,s){let n=s(67294),r=s(87854),i=s(95348),o=new r({id:"smile-shop-b5fdc634--sprite",use:"smile-shop-b5fdc634--sprite-usage",viewBox:"0 0 40 40",content:'<symbol viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg" id="smile-shop-b5fdc634--sprite">\n<path d="M29.001 21.1836H31.4326C31.6726 21.1838 31.8672 21.3777 31.8672 21.6162L31.8223 21.9736C30.8917 27.7014 25.8788 31.9677 19.9951 31.9678C18.8846 31.9678 17.7888 31.8188 16.7383 31.5205C16.4681 31.4459 16.3172 31.162 16.4072 30.8936L17.1436 28.6865C17.2186 28.4479 17.4884 28.2987 17.7285 28.3584C18.464 28.5523 19.2297 28.6562 19.9951 28.6562C20.3102 28.6562 20.6106 28.6412 20.9258 28.6113C21.2259 28.5815 21.5261 28.5374 21.8262 28.4629C22.1263 28.4032 22.4112 28.3131 22.6963 28.2236C22.9815 28.1341 23.2519 28.0298 23.5371 27.8955C23.8073 27.7762 24.0779 27.6423 24.333 27.4932C24.5881 27.344 24.8429 27.1796 25.083 27.0156C25.3231 26.8367 25.5483 26.6577 25.7734 26.4639C25.9986 26.27 26.2092 26.0614 26.4043 25.8525C26.5994 25.6288 26.7945 25.4047 26.9746 25.166C27.1546 24.9275 27.3197 24.689 27.4697 24.4355C27.6198 24.182 27.7546 23.913 27.8896 23.6445C28.0097 23.3761 28.1297 23.0929 28.2197 22.8096C28.3097 22.5263 28.3999 22.2279 28.46 21.9297C28.47
15 21.8253 28.5052 21.7205 28.5352 21.6162C28.5651 21.5268 28.5652 21.4222 28.625 21.3477C28.7 21.2432 28.8356 21.1689 28.9707 21.1689L29.001 21.1836ZM10.8545 21.2129H11.0342C11.1241 21.2129 11.2141 21.2432 11.2891 21.3027C11.3791 21.3624 11.4391 21.4669 11.4541 21.5713C11.5141 22.0187 11.6498 22.466 11.7998 22.8984C11.9649 23.3607 12.175 23.8234 12.415 24.2559C12.6552 24.6884 12.9251 25.0917 13.2402 25.4795C13.5554 25.8673 13.9011 26.2256 14.2764 26.5537C14.6515 26.8818 15.057 27.1801 15.4922 27.4336C15.6871 27.5529 15.7621 27.7913 15.6572 28L14.4717 30.1631C14.3516 30.3719 14.0959 30.4465 13.8857 30.3271C10.824 28.5223 8.70777 25.4199 8.15234 21.9297L8.10742 21.6162C8.10742 21.3776 8.30282 21.1836 8.54297 21.1836H10.8545V21.2129ZM25.9834 7.98242C29.2992 7.98242 31.9873 10.654 31.9873 13.9492C31.9872 17.2443 29.2991 19.915 25.9834 19.915C22.7713 19.9149 20.148 17.4084 19.9873 14.2559C19.8266 17.4084 17.2034 19.915 13.9912 19.915C10.6755 19.915 7.98745 17.2443 7.9873 13.9492C7.9873 10.654 10.6754 7.98242 13.9912 7.98242C17.2033 7.98247 19.8264 10.4892 19.9873 13.6416C20.1482 10.4893 22.7714 7.98259 25.9834 7.98242Z" fill="white" />\n</symbol>'});i.add(o);let a=({...t})=>n.createElement("svg",Object.assign({viewBox:o.viewBox},{...t}),n.createElement("use",{xlinkHref:"#"+o.id}));a.viewBox=o.viewBox,a.id=o.id,a.content=o.content,a.url=o.url,a.toString=o.toString,t.exports=a,t.exports.default=a},98029:function(t,e,s){"use strict";s.d(e,{D:function(){return d}});var n=s(67294),r=s(59289),i=s(27037),o=s(7506),a=s(24139),c=class extends o.l{#t;#e=void 0;#s;#n;constructor(t,e){super(),this.#t=t,this.setOptions(e),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){let e=this.options;this.options=this.#t.defaultMutationOptions(t),(0,a.VS)(this.options,e)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#s,observer:this}),e?.mutationKey&&this.options.mutationKey&&(0,a.Ym)(e.mutationKey)!==(0,a.Ym)(this.options.mutationKey)?this.reset():this.#s?.state.status==="pending"&&this.#s.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#s?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#i(t)}getCurrentResult(){return this.#e}reset(){this.#s?.removeObserver(this),this.#s=void 0,this.#r(),this.#i()}mutate(t,e){return this.#n=e,this.#s?.removeObserver(this),this.#s=this.#t.getMutationCache().build(this.#t,this.options),this.#s.addObserver(this),this.#s.execute(t)}#r(){let t=this.#s?.state??(0,r.R)();this.#e={...t,isPending:"pending"===t.status,isSuccess:"success"===t.status,isError:"error"===t.status,isIdle:"idle"===t.status,mutate:this.mutate,reset:this.reset}}#i(t){i.V.batch(()=>{if(this.#n&&this.hasListeners()){let e=this.#e.variables,s=this.#e.context;t?.type==="success"?(this.#n.onSuccess?.(t.data,e,s),this.#n.onSettled?.(t.data,null,e,s)):t?.type==="error"&&(this.#n.onError?.(t.error,e,s),this.#n.onSettled?.(void 0,t.error,e,s))}this.listeners.forEach(t=>{t(this.#e)})})}},l=s(30202),u=s(86290);function d(t,e){let s=(0,l.NL)(e),[r]=n.useState(()=>new c(s,t));n.useEffect(()=>{r.setOptions(t)},[r,t]);let o=n.useSyncExternalStore(n.useCallback(t=>r.subscribe(i.V.batchCalls(t)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=n.useCallback((t,e)=>{r.mutate(t,e).catch(u.Z)},[r]);if(o.error&&(0,u.L)(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:a,mutateAsync:o.mutate}}}},function(t){t.O(0,[7627,1228,260,6152,6436,7536,8983,2888,9774,179],function(){return t(t.s=73700)}),_N_E=t.O()}]);
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.