https://halodish.com/_next/static/chunks/pages/app/account/settings/address-list-8f69e6942e3b28de.js
1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9360,2569,2874,6541],{31060:function(e,a,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/app/account/settings/address-list",function(){return t(42661)}])},42874:function(e,a,t){"use strict";t.r(a);var s=t(52322);t(2784),a.default=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[(0,s.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,s.jsx)("path",{d:"M6 9l6 6l6 -6"})]})},51767:function(e,a,t){"use strict";var s=t(52322);t(2784),a.Z=e=>(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,s.jsxs)("g",{id:"sm_left_icon",clipPath:"url(#clip0_1932_16576)",children:[(0,s.jsx)("path",{id:"Vector",d:"M14.6666 6.99967V7.99967C14.6666 11.1424 14.6666 12.7137 13.6903 13.69C12.714 14.6663 11.1426 14.6663 7.99992 14.6663C4.85722 14.6663 3.28587 14.6663 2.30956 13.69C1.33325 12.7137 1.33325 11.1424 1.33325 7.99967C1.33325 4.85698 1.33325 3.28563 2.30956 2.30932C3.28587 1.33301 4.85722 1.33301 7.99992 1.33301H8.99992",stroke:"#3BAA47",strokeWidth:"1.5",strokeLinecap:"round"}),(0,s.jsx)("path",{id:"Vector_2",d:"M11.1013 2.30305L11.5338 1.8705C12.2505 1.15384 13.4124 1.15384 14.1291 1.8705C14.8458 2.58717 14.8458 3.74911 14.1291 4.46577L13.6965 4.89831M11.1013 2.30305C11.1013 2.30305 11.1554 3.2222 11.9664 4.03322C12.7774 4.84424 13.6965 4.89831 13.6965 4.89831M11.1013 2.30305L7.1247 6.27963C6.85536 6.54897 6.72069 6.68364 6.60487 6.83213C6.46825 7.00729 6.35112 7.19682 6.25554 7.39735C6.17453 7.56735 6.1143 7.74803 5.99385 8.10939L5.6082 9.26634M13.6965 4.89831L9.71997 8.87489C9.45062 9.14423 9.31595 9.2789 9.16746 9.39472C8.9923 9.53134 8.80278 9.64848 8.60224 9.74405C8.43224 9.82507 8.25156 9.88529 7.8902 10.0057L6.73325 10.3914M6.73325 10.3914L5.98464 10.6409C5.80682 10.7002 5.61076 10.6539 5.47821 10.5214C5.34567 10.3888 5.29938 10.1928 5.35866 10.0149L5.6082 9.26634M6.73325 10.3914L5.6082 9.26634",stroke:"#3BAA47",strokeWidth:"1.5"})]}),(0,s.jsx)("defs",{children:(0,s.jsx)("clipPath",{id:"clip0_1932_16576",children:(0,s.jsx)("rect",{width:"16",height:"16",fill:"white"})})})]})},16541:function(e,a,t){"use strict";t.r(a);var s=t(52322);t(2784),a.default=e=>(0,s.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,s.jsx)("g",{id:"filled",children:(0,s.jsx)("path",{id:"vector",d:"M12 1C5.9 1 1 5.9 1 12C1 18.1 5.9 23 12 23C18.1 23 23 18.1 23 12C23 5.9 18.1 1 12 1ZM13.5 19H10.5V11H13.5V19ZM12 9C10.9 9 10 8.1 10 7C10 5.9 10.9 5 12 5C13.1 5 14 5.9 14 7C14 8.1 13.1 9 12 9Z",fill:"#3062D4"})})})},40697:function(e,a,t){"use strict";t.d(a,{v:function(){return l}});var s=t(52322);let l={resetTextFieldChange:e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none",...e,children:[(0,s.jsx)("g",{clipPath:"url(#CloseIcon_svg__a)",children:(0,s.jsx)("path",{fill:"#272E35",d:"M10 .833A9.14 9.14 0 0 0 .833 10 9.14 9.14 0 0 0 10 19.167 9.14 9.14 0 0 0 19.167 10 9.14 9.14 0 0 0 10 .833Zm5 12.5L13.333 15 10 11.667 6.667 15 5 13.334 8.333 10 5 6.667 6.667 5 10 8.334 13.333 5 15 6.667 11.667 10 15 13.334Z"})}),(0,s.jsx)("defs",{children:(0,s.jsx)("clipPath",{id:"CloseIcon_svg__a",children:(0,s.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),setting:e=>(0,s.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,s.jsx)("circle",{cx:"10",cy:"10",r:"2.5",stroke:"#1C274C",strokeWidth:"1.25"}),(0,s.jsx)("path",{d:"M11.4712 1.79352C11.1649 1.66666 10.7766 1.66666 10 1.66666C9.22346 1.66666 8.83518 1.66666 8.52889 1.79352C8.12051 1.96268 7.79605 2.28714 7.6269 2.69552C7.54968 2.88194 7.51946 3.09874 7.50763 3.41498C7.49026 3.87972 7.25192 4.3099 6.84916 4.54243C6.4464 4.77496 5.9547 4.76627 5.54354 4.54896C5.26375 4.40107 5.06088 4.31884 4.86082 4.2925C4.42257 4.23481 3.97936 4.35357 3.62867 4.62266C3.36566 4.82447 3.17152 5.
116074 2.78323 5.83327C2.39495 6.50579 2.20081 6.84206 2.15754 7.17074C2.09984 7.60899 2.2186 8.05221 2.48769 8.40289C2.61051 8.56295 2.78313 8.69751 3.05103 8.86584C3.44487 9.11331 3.69828 9.53487 3.69826 10C3.69823 10.4651 3.44483 10.8866 3.05103 11.134C2.78308 11.3024 2.61044 11.437 2.48761 11.597C2.21852 11.9477 2.09976 12.3909 2.15745 12.8292C2.20073 13.1579 2.39487 13.4941 2.78315 14.1667C3.17144 14.8392 3.36558 15.1754 3.62859 15.3773C3.97928 15.6464 4.42249 15.7651 4.86074 15.7074C5.06079 15.6811 5.26364 15.5989 5.54341 15.451C5.9546 15.2337 6.44634 15.225 6.84912 15.4575C7.25191 15.6901 7.49025 16.1203 7.50764 16.585C7.51946 16.9013 7.54968 17.118 7.6269 17.3045C7.79605 17.7128 8.12051 18.0373 8.52889 18.2065C8.83518 18.3333 9.22346 18.3333 10 18.3333C10.7766 18.3333 11.1649 18.3333 11.4712 18.2065C11.8795 18.0373 12.204 17.7128 12.3732 17.3045C12.4504 17.118 12.4806 16.9012 12.4924 16.585C12.5098 16.1202 12.7481 15.6901 13.1509 15.4575C13.5536 15.2249 14.0454 15.2336 14.4566 15.451C14.7364 15.5988 14.9392 15.681 15.1392 15.7074C15.5775 15.7651 16.0207 15.6463 16.3714 15.3772C16.6344 15.1754 16.8285 14.8391 17.2168 14.1666C17.6051 13.4941 17.7993 13.1578 17.8425 12.8291C17.9002 12.3909 17.7815 11.9477 17.5124 11.597C17.3895 11.4369 17.2169 11.3023 16.949 11.134C16.5552 10.8865 16.3018 10.465 16.3018 9.99991C16.3018 9.53486 16.5552 9.11339 16.949 8.86598C17.217 8.69761 17.3896 8.56304 17.5125 8.40295C17.7815 8.05226 17.9003 7.60905 17.8426 7.1708C17.7993 6.84212 17.6052 6.50585 17.2169 5.83332C16.8286 5.16079 16.6345 4.82453 16.3715 4.62271C16.0208 4.35362 15.5776 4.23486 15.1393 4.29256C14.9393 4.3189 14.7364 4.40112 14.4567 4.54899C14.0455 4.76632 13.5537 4.77501 13.1509 4.54246C12.7482 4.30991 12.5098 3.87971 12.4924 3.41494C12.4806 3.09872 12.4504 2.88193 12.3732 2.69552C12.204 2.28714 11.8795 1.96268 11.4712 1.79352Z",stroke:"#1C274C",strokeWidth:"1.25"})]}),close:e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none",...e,children:(0,s.jsx)("path",{stroke:"#7E8B99",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.907,d:"M3.333 16.667 10 10m0 0 6.667-6.667M10 10 3.333 3.333M10 10l6.667 6.667"})})}},52569:function(e,a,t){"use strict";t.r(a);var s=t(52322),l=t(2784),r=t(12524),n=t.n(r),i=t(40697);let d=(0,l.forwardRef)((e,a)=>{let{label:t,type:r,placeholder:d="",disabled:o=!1,value:c="",paddingBottom:u=!0,required:x=!1,maxLength:h,pattern:m,errorMessage:p,onChange:f}=e,[g,v]=l.useState(!1),[j,b]=l.useState(!1),y=!m||c&&m.test(c),w=j&&!y;return(0,s.jsxs)("div",{className:u?"pb-3":"pb-0",children:[(0,s.jsx)("label",{htmlFor:t,className:"block text-sm text-gray-700",children:t}),(0,s.jsxs)("div",{className:"relative mt-2 flex justify-end",children:[(0,s.jsx)("input",{ref:a,className:n()("w-full appearance-none rounded border px-3 py-2 leading-tight","text-gray-700 focus:border-green-600 focus:outline-none disabled:text-gray-400",w&&"border-red-500"),onFocus:()=>v(!0),onBlur:()=>
1{v(!1),b(!0)},type:r,value:c,id:t,placeholder:d,onChange:e=>{(!h||e.target.value.length<=h)&&f(e)},disabled:o,required:x}),(0,s.jsx)("div",{className:"absolute mr-3 mt-2 h-5 w-5",children:c&&g&&(0,s.jsx)("button",{onClick:()=>{f({target:{value:""}})},onMouseDown:e=>{e.preventDefault()},children:(0,s.jsx)(i.v.resetTextFieldChange,{})})})]}),h&&(0,s.jsxs)("p",{className:"mt-1 text-xs text-gray-500",children:[c.length,"/",h," characters"]}),w&&(0,s.jsx)("p",{className:"mt-1 text-xs text-red-500",children:p})]})});d.displayName="InputField",a.default=d},42661:function(e,a,t){"use strict";t.r(a),t.d(a,{__N_SSP:function(){return Q},default:function(){return B}});var s=t(52322),l=t(2784),r=t(25237),n=t.n(r),i=t(97729),d=t.n(i),o=t(55830),c=t(58943),u=t(89445),x=t(99698),h=t(23848),m=t(55772);function p(){let[e,a]=(0,l.useState)(!1),[t,s]=(0,l.useState)(null);return{isOpen:e,open:e=>{e&&s(e),a(!0)},close:()=>{a(!1),s(null)},data:t}}var f=t(21458),g=t(64216),v=t(12524),j=t.n(v),b=t(63955),y=t(30195);let w=[{label:"Aichi",value:"Aichi"},{label:"Akita",value:"Akita"},{label:"Aomori",value:"Aomori"},{label:"Chiba",value:"Chiba"},{label:"Ehime",value:"Ehime"},{label:"Fukui",value:"Fukui"},{label:"Fukuoka",value:"Fukuoka"},{label:"Fukushima",value:"Fukushima"},{label:"Gifu",value:"Gifu"},{label:"Gunma",value:"Gunma"},{label:"Hiroshima",value:"Hiroshima"},{label:"HokkaidÅ",value:"HokkaidÅ"},{label:"HyÅgo",value:"HyÅgo"},{label:"Ibaraki",value:"Ibaraki"},{label:"Ishikawa",value:"Ishikawa"},{label:"Iwate",value:"Iwate"},{label:"Kagawa",value:"Kagawa"},{label:"Kagoshima",value:"Kagoshima"},{label:"Kanagawa",value:"Kanagawa"},{label:"KyÅto",value:"KyÅto"},{label:"KÅchi",value:"KÅchi"},{label:"Kumamoto",value:"Kumamoto"},{label:"Miyagi",value:"Miyagi"},{label:"Miyazaki",value:"Miyazaki"},{label:"Mie",value:"Mie"},{label:"Nagano",value:"Nagano"},{label:"Nagasaki",value:"Nagasaki"},{label:"Nara",value:"Nara"},{label:"Niigata",value:"Niigata"},{label:"Åita",value:"Åita"},{label:"Okayama",value:"Okayama"},{label:"Okinawa",value:"Okinawa"},{label:"Åsaka",value:"Åsaka"},{label:"Saga",value:"Saga"},{label:"Saitama",value:"Saitama"},{label:"Shiga",value:"Shiga"},{label:"Shimane",value:"Shimane"},{label:"Shizuoka",value:"Shizuoka"},{label:"Tochigi",value:"Tochigi"},{label:"Tokushima",value:"Tokushima"},{label:"Tokyo",value:"Tokyo"},{label:"Tottori",value:"Tottori"},{label:"Toyama",value:"Toyama"},{label:"Wakayama",value:"Wakayama"},{label:"Yamagata",value:"Yamagata"},{label:"Yamaguchi",value:"Yamaguchi"},{label:"Yamanashi",value:"Yamanashi"}];y.z.object({first_name:y.z.string(),last_name:y.z.string(),address1:y.z.string(),address2:y.z.string().optional(),city:y.z.string(),province:y.z.string(),zip:y.z.string(),country:y.z.string(),phone:y.z.string().optional(),default:y.z.boolean().optional()});var C=t(52569),N=t(71012),k=t(42874);let S=(0,l.forwardRef)((e,a)=>{let{label:t,value:r,options:n,placeholder:i="Please select an option",required:d=!1,errorMessage:o="Selection required",disabled:c=!1,paddingBottom:u=!0,onChange:x}=e,[h,m]=(0,l.useState)(!1),[p,g]=(0,l.useState)(!1),v=h&&d&&!r;return(0,s.jsxs)("div",{className:u?"pb-3":"pb-0",children:[(0,s.jsx)("label",{htmlFor:t,className:"block text-sm text-gray-700",children:t}),(0,s.jsx)(N.R,{value:r,onChange:e=>{x(e),m(!0),g(!1)},disabled:c,children:e=>{let{open:a}=e;return(0,s.jsxs)("div",{className:"relative mt-2",children:[(0,s.jsxs)(N.R.Button,{className:"w-full appearance-none rounded border px-3 py-2 text-left leading-tight text-gray-700\n focus:border-green-600 focus:outline-none disabled:text-gray-400 \n ".concat(v?"border-red-500":"","\n "),onClick:()=>g(!p),children:[(0,s.jsx)("span",{children:r||i}),(0,s.jsx)("span",{className:j()("pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2 transition-all",a&&"-translate-x-2 rotate-180"),children:(0,s.jsx)(k.default,{className:"h-5 w-5 shrink-0 text-gray-400 transition-transform duration-200","aria-hidden":"true"})})]}),(0,s.jsx)(f.u,{show:a,as:l.Fragment,enter:"transition duration-100 ease-out",enterFrom:"transform scale-95 opacity-0",enterTo:"transform scale-100 opacity-100",leave:"transition duration-75 ease-out",leaveFrom:"transform scale-100 opacity-100",leaveTo:"transform scale-95 opacity-0",children:(0,s.jsxs)(N.R.Options,{className:"absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm",children:[!r&&(0,s.jsx)(N.R.Option,{value:"",disabled:!0,className:"cursor-default select-none px-3 py-2 text-gray-400",children:i}),n.map(e=>(0,s.jsx)(N.R.Option,{value:e.value,className:e=>{let{active:a}=e;return"relative cursor-pointer select-none py-2 pl-10 pr-4 ".concat(a?"bg-green-100 text-green-900":"text-gray-900")},children:a=>{let{selected:t}=a;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"block truncate ".concat(t?"font-medium":"font-normal"),children:e.label}),t&&(0,s.jsx)("span",{className:"absolute inset-y-0 left-0 flex items-center pl-3 text-green-600",children:"â"})]})}},e.value))]})}),v&&(0,s.jsx)("p",{className:"mt-1 text-xs text-red-500",children:o})]})}})]})});function _(e){let{onClose:a,refetchAddresses:t,customerId:r}
1=e,{control:n,register:i,handleSubmit:d,formState:{errors:o}}=(0,b.cI)(),c=async e=>{try{await m.Z.customer.createAddress(r.toString(),e),t(),a()}catch(e){console.error("Error adding address:",e),alert("Failed to update address.")}};return(0,s.jsx)(f.u,{appear:!0,show:!0,as:l.Fragment,children:(0,s.jsxs)(g.V,{as:"div",className:"relative z-10",onClose:a,children:[(0,s.jsx)("div",{className:"fixed inset-0 bg-black/25"}),(0,s.jsx)("div",{className:"fixed inset-0 overflow-y-auto",children:(0,s.jsx)("div",{className:"flex min-h-full items-center justify-center p-4 text-center",children:(0,s.jsxs)(g.V.Panel,{className:j()("max-h-xs w-full max-w-sm transform overflow-hidden overflow-y-auto rounded-2xl bg-white","px-4 text-left align-middle shadow-xl transition-all"),children:[(0,s.jsx)("div",{className:"sticky top-0 z-10 bg-white pb-3 pt-6",children:(0,s.jsx)(g.V.Title,{as:"h3",className:"sticky top-0 bg-white text-lg font-medium leading-6 text-gray-900",children:"Add Address"})}),(0,s.jsxs)("form",{onSubmit:d(c),children:[(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(b.Qr,{name:"first_name",control:n,render:e=>{let{field:a}=e;return(0,s.jsx)(C.default,{label:"First Name",placeholder:"John",type:"text",maxLength:24,required:!0,...a})}})}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(b.Qr,{name:"last_name",control:n,render:e=>{var a;let{field:t}=e;return(0,s.jsx)(C.default,{label:"Last Name",placeholder:"Doe",type:"text",maxLength:24,required:!0,errorMessage:null===(a=o.last_name)||void 0===a?void 0:a.message,...t})}})}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(b.Qr,{name:"country",control:n,render:e=>{let{field:a}=e;return(0,s.jsx)(S,{label:"Country",options:[{label:"Japan",value:"Japan"}],placeholder:"Select your country",required:!0,errorMessage:"Please select your country",...a})}})}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(b.Qr,{name:"province",control:n,render:e=>{let{field:a}=e;return(0,s.jsx)(S,{label:"Prefecture",options:w,placeholder:"Select your prefecture",required:!0,errorMessage:"Please select your prefecture",...a})}})}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(b.Qr,{name:"city",control:n,render:e=>{var a;let{field:t}=e;return(0,s.jsx)(C.default,{label:"City",placeholder:"Osaka",type:"text",required:!0,errorMessage:null===(a=o.city)||void 0===a?void 0:a.message,...t})}})}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(b.Qr,{name:"address1",control:n,render:e=>{var a;let{field:t}=e;return(0,s.jsx)(C.default,{label:"Address Line 1",placeholder:"Address 1",type:"text",required:!0,errorMessage:null===(a=o.address1)||void 0===a?void 0:a.message,...t})}})}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(b.Qr,{name:"address2",control:n,render:e=>{let{field:a}=e;return(0,s.jsx)(C.default,{label:"Address Line 2 (Optional)",placeholder:"Address 2",type:"text",...a})}})}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(b.Qr,{name:"zip",control:n,render:e=>{let{field:a}=e;return(0,s.jsx)(C.default,{label:"Zip Code",placeholder:"e.g. 123-1234",type:"text",maxLength:8,pattern:/^\d{3}-\d{4}$/,errorMessage:"Zip code must be in the format 123-1234",required:!0,...a})}})}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(b.Qr,{name:"phone",control:n,render:e=>{let{field:a}=e;return(0,s.jsx)(C.default,{label:"Phone (Optional)",placeholder:"e.g. 090-1234-5678",type:"string",maxLength:13,pattern:/^0\d{2}-\d{4}-\d{4}$/,errorMessage:"Phone number must be in the format 090-1234-5678",...a})}})}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsxs)("label",{className:"inline-flex items-center",children:[(0,s.jsx)("input",{type:"checkbox",...i("default")}),(0,s.jsx)("span",{className:"ml-2",children:"Set as default address"})]})}),(0,s.jsxs)("div",{className:"my-6 flex justify-end space-x-4",children:[(0,s.jsx)("button",{type:"button",onClick:a,className:j()("inline-flex justify-center rounded-md border px-4 py-2","border-gray-300 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50"),children:"Cancel"}),(0,s.jsx)("button",{type:"submit",className:j()("inline-flex justify-center rounded-md border border-transparent","bg-black px-4 py-2 text-sm font-medium text-white hover:bg-green-600"),children:"Save"})]})]})]})})})]})})}function A(e){let{handleDelete:a}=e,t=p();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{type:"button",onClick:()=>t.open(),className:j()("my-4 inline-flex w-full justify-center rounded-md border border-transparent","bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-700"),children:"Delete"}),(0,s.jsx)(f.u,{appear:!0,show:t.isOpen,as:l.Fragment,children:(0,s.jsxs)(g.V,{as:"div",className:"relative z-10",onClose:()=>t.close(),children:[(0,s.jsx)("div",{className:"fixed inset-0 bg-black/25"}),(0,s.jsx)("div",{className:"fixed inset-0 overflow-y-auto",children:(0,s.jsx)("div",{className:"flex min-h-full items-center justify-center p-4 text-center",children:(0,s.jsxs)(g.V.Panel,{className:j()("w-full max-w-sm transform overflow-hidden rounded-2xl bg-white","p-6 text-left align-middle shadow-xl transition-all"),children:[(0,s.jsx)(g.V.Title,{as:"h3",className:"text-lg font-medium leading-6 text-gray-900",children:"Confirm Delete"}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this address? This action cannot be undone."})}),(0,s.jsxs)("div",{className:"mt-6 flex justify-end space-x-4",children:[(0,s.jsx)("button",{type:"button",onClick:()=>t.close(),className:j()("inline-flex justify-center rounded-md border px-4 py-2","border-gray-300 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50"),children:"Cancel"}),(0,s.jsx)("button",{type:"button",onClick:()=>{a(),t.close()},className:j()("inline-flex justify-center rounded-md border border-transparent","bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-700"),children:"Delete"})]})]})})})]})})]})}S.displayName="SelectField";var M=function(e){let{address:a,customerId:t,onClose:r,refetchAddresses:n}=e,{control:i,register:d,handleSubmit:o,reset:c,formState:{errors:u}}=(0,b.cI)();(0,l.useEffect)(()=>{c({first_name:a.first_name,last_name:a.last_name,address1:a.address1,address2:a.address2,city:a.city,province:a.province,zip:a.zip,country:a.country,phone:a.phone,default:a.default})},[a,c]);let x=async()=>{try{await m.Z.customer.deleteAddress(t.toString(),a.id.toString()),n(),r()}catch(e){console.error("Error deleting address:",e),alert("Failed to delete address.")}},h=async e=>{try{await m.Z.customer.updateAddress(t.toString(),a.id.toString(),e),n(),r()}catch(e){console.error("Error updating address:",e),alert("Failed to update address.")}};return(0,s.jsx)(f.u,{appear:!0,show:!0,as:l.Fragment,children:(0,s.jsxs)(g.V,{as:"div",className:"relative z-10",onClose:r,children:[(0,s.jsx)("div",{className:"fixed inset-0 bg-black/25"}),(0,s.jsx)("div",{className:"fixed inset-0 overflow-y-auto",children:(0,s.jsx)("div",{className:"flex min-h-full items-center justify-center p-4 text-center",children:(0,s.jsxs)(g.V.Panel,{className:j()("max-h-xs
1w-full max-w-sm transform overflow-hidden overflow-y-auto rounded-2xl bg-white","px-4 text-left align-middle shadow-xl transition-all"),children:[(0,s.jsx)("div",{className:"sticky top-0 z-10 bg-white pb-3 pt-6",children:(0,s.jsx)(g.V.Title,{as:"h3",className:"sticky top-0 bg-white text-lg font-medium leading-6 text-gray-900",children:"Edit Address"})}),(0,s.jsxs)("form",{onSubmit:o(h),children:[(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(b.Qr,{name:"first_name",control:i,render:e=>{var a;let{field:t}=e;return(0,s.jsx)(C.default,{label:"First Name",placeholder:"John",type:"text",maxLength:24,required:!0,errorMessage:null===(a=u.first_name)||void 0===a?void 0:a.message,...t})}})}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(b.Qr,{name:"last_name",control:i,render:e=>{var a;let{field:t}=e;return(0,s.jsx)(C.default,{label:"Last Name",placeholder:"Doe",type:"text",maxLength:24,required:!0,errorMessage:null===(a=u.last_name)||void 0===a?void 0:a.message,...t})}})}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(b.Qr,{name:"country",control:i,render:e=>{let{field:a}=e;return(0,s.jsx)(S,{label:"Country",options:[{label:"Japan",value:"Japan"}],placeholder:"Select your country",required:!0,errorMessage:"Please select your country",...a})}})}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(b.Qr,{name:"province",control:i,render:e=>{let{field:a}=e;return(0,s.jsx)(S,{label:"Prefecture",options:w,placeholder:"Select your prefecture",required:!0,errorMessage:"Please select your prefecture",...a})}})}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(b.Qr,{name:"city",control:i,render:e=>{var a;let{field:t}=e;return(0,s.jsx)(C.default,{label:"City",placeholder:"Osaka",type:"text",required:!0,errorMessage:null===(a=u.city)||void 0===a?void 0:a.message,...t})}})}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(b.Qr,{name:"address1",control:i,render:e=>{var a;let{field:t}=e;return(0,s.jsx)(C.default,{label:"Address Line 1",placeholder:"Address 1",type:"text",required:!0,errorMessage:null===(a=u.address1)||void 0===a?void 0:a.message,...t})}})}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(b.Qr,{name:"address2",control:i,render:e=>{let{field:a}=e;return(0,s.jsx)(C.default,{label:"Address Line 2 (Optional)",placeholder:"Address 2",type:"text",...a})}})}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(b.Qr,{name:"zip",control:i,render:e=>{let{field:a}=e;return(0,s.jsx)(C.default,{label:"Zip Code",placeholder:"e.g. 123-1234",type:"text",maxLength:8,pattern:/^\d{3}-\d{4}$/,errorMessage:"Zip code must be in the format 123-1234",required:!0,...a})}})}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(b.Qr,{name:"phone",control:i,render:e=>{let{field:a}=e;return(0,s.jsx)(C.default,{label:"Phone (Optional)",placeholder:"e.g. 090-1234-5678",type:"string",maxLength:13,pattern:/^0\d{2}-\d{4}-\d{4}$/,errorMessage:"Phone number must be in the format 090-1234-5678",...a})}})}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsxs)("label",{className:"inline-flex items-center",children:[(0,s.jsx)("input",{type:"checkbox",...d("default"),disabled:a.default}),(0,s.jsx)("span",{className:"ml-2",children:"Set as default address"})]})}),(0,s.jsxs)("div",{className:"mt-6 flex justify-end space-x-4",children:[(0,s.jsx)("button",{type:"button",onClick:r,className:j()("inline-flex justify-center rounded-md border px-4 py-2","border-gray-300 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50"),children:"Cancel"}),(0,s.jsx)("button",{type:"submit",className:j()("inline-flex justify-center rounded-md border border-transparent","bg-black px-4 py-2 text-sm font-medium text-white hover:bg-green-600"),children:"Save"})]})]}),(0,s.jsx)(A,{handleDelete:x})]})})})]})})},L=t(51767),F=e=>{let{addresses:a,onAddressClick:t}=e;return(0,s.jsx)("div",{className:"w-full space-y-4",children:a.sort((e,a)=>(a.default?1:0)-(e.default?1:0)).map(e=>(0,s.jsx)("div",{className:"cursor-pointer rounded-xl border border-primary",children:(0,s.jsxs)("div",{className:j()("relative gap-4 rounded-xl p-4",e.default&&"bg-[#C4FBCA]"),onClick:()=>t(e),children:[(0,s.jsx)("span",{className:"absolute right-3 top-5",children:(0,s.jsx)(L.Z,{})}
1),e.default&&(0,s.jsx)("legend",{className:"w-fit rounded-xl border bg-white px-2 text-sm font-bold text-primary",children:"Default Address"}),(0,s.jsxs)("address",{className:"space-y-1.5",children:[(0,s.jsx)("p",{children:(0,s.jsxs)("strong",{children:[e.first_name," ",e.last_name]})}),(0,s.jsxs)("p",{children:[e.country," ã",e.zip]}),(0,s.jsxs)("p",{children:[e.province,", ",e.city," (",e.province_code,")"]}),(0,s.jsxs)("p",{children:[e.address1,e.address2?", ".concat(e.address2):null]})]})]})},e.id))})},T=t(12752),P=t(16541);let z=n()(()=>t.e(9984).then(t.bind(t,59984)),{loadableGenerated:{webpack:()=>[59984]}}),E=n()(()=>Promise.all([t.e(9762),t.e(5522)]).then(t.bind(t,25522)),{loadableGenerated:{webpack:()=>[25522]}}),O=n()(()=>Promise.all([t.e(8643),t.e(3819)]).then(t.bind(t,36926)),{loadableGenerated:{webpack:()=>[36926]}});var Q=!0;function B(){var e,a;let t=(0,h.useSession)(),l=(0,o.NL)(),{data:r,isLoading:n,isError:i,isSuccess:f}=(0,c.a)(["customer-detail",null===(e=t.data)||void 0===e?void 0:e.user.id],()=>m.Z.customer.fetchCustomerDetail(t.data?t.data.user.id_token:"")),g=p(),v=p(),j=()=>{var e;l.invalidateQueries(["customer-detail",null===(e=t.data)||void 0===e?void 0:e.user.id])};return!t.data||i?(0,s.jsx)(O,{activeTab:"Login",children:(0,s.jsx)(E,{})}):(null==r?void 0:r.shopify)===null?(0,s.jsx)(O,{activeTab:"Login",children:(0,s.jsxs)("div",{className:"relative min-h-screen w-full max-w-[430px] bg-white px-4 pb-[100px] text-center",children:[(0,s.jsx)(z,{label:"Address List",isBackButton:!0,rightButtonIcon:(0,s.jsx)(T.j.contributeFilled,{}),rightButtonOnClick:()=>v.open()}),(0,s.jsxs)("div",{className:"mx-auto flex h-screen w-full flex-shrink-0 flex-grow-0 flex-col items-center justify-center gap-4",children:[(0,s.jsx)("h1",{children:"Customer Details Not Found"}),(0,s.jsxs)("span",{className:"text-[#707070]",children:[(0,s.jsx)("p",{children:"We couldn't retrieve your address list. Please ensure you are logged into your Shopify account."}),(0,s.jsx)("p",{children:"If the problem persists, contact our support team for assistance."})]})]})]})}):n?(0,s.jsx)(O,{activeTab:"Login",children:(0,s.jsx)("div",{className:"mx-auto flex h-screen w-full flex-shrink-0 flex-grow-0 items-center justify-center",children:(0,s.jsx)(x.Q,{$color:"#3BAA47"})})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d(),{children:(0,s.jsx)("title",{children:"Address list - HaloDish"})}),(0,s.jsx)(O,{activeTab:"Login",children:"authenticated"===t.status&&f&&(0,s.jsxs)("div",{className:"relative min-h-screen w-full max-w-[430px] bg-white px-4 pb-[100px] text-center",children:[(0,s.jsx)(z,{label:"Address List",isBackButton:!0,rightButtonIcon:(0,s.jsx)(T.j.contributeFilled,{}),rightButtonOnClick:()=>v.open()}),(0,s.jsx)(u.j,{artwork:{icon:()=>(0,s.jsx)(P.default,{})},children:(0,s.jsx)("p",{className:"break-words text-left text-xs font-normal leading-4 text-[#555F6D]",children:"This list shows all the addresses you've added to HaloDish Shop. Here, you can add, edit, or remove addresses as needed. The default address will be used for shipping on HaloDish Shop."})}),(null===(a=r.shopify)||void 0===a?void 0:a.addresses.length)>0?(0,s.jsx)("div",{className:"flex w-full flex-col items-start gap-8 text-start",children:(0,s.jsx)(F,{addresses:r.shopify.addresses,onAddressClick:g.open})}):(0,s.jsx)("p",{children:"You have no saved addresses"}),g.isOpen&&g.data&&(0,s.jsx)(M,{address:g.data,onClose:g.close,customerId:r.shopify.id,refetchAddresses:j}),v.isOpen&&(0,s.jsx)(_,{onClose:v.close,customerId:r.shopify.id,refetchAddresses:j})]})})]})}},34091:function(e,a,t){"use strict";t.d(a,{N8:function(){return s},Pc:function(){return r},ri:function(){return n},vl:function(){return l}});let s={RESTAURANT:"RESTAURANT",PRAYER_SPACE:"PRAYER_SPACE",STORE:"STORE"},l={REVIEWS:"REVIEWS",PLACES:"PLACES"},r="/static/icons/halodish/green-no-text.svg",n=30}},function(e){e.O(0,[4977,4814,7614,6635,4216,1012,2672,5772,2752,2888,9774,179],function(){return e(e.s=31060)}),_N_E=e.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.