import{r as w,j as t}from"./react-WWJ_A68P.js";import{i as N}from"./react-device-detect-BAEcyX2V.js";import{L as b}from"./react-router-dom-B4YB8MrN.js";import{W as k}from"./WithAuth-HyFHhv7d.js";import{j as B,l as H,p as R,m as v,b as M,s as y,n as W,o as Y,q as D,a as C,c as G,P as a,r as h,H as S,t as z,A as F}from"./index-ely993O6.js";import{u as T,a as U}from"./@tanstack-BR86rpua.js";import{u as X}from"./useMyOrderList-DDt7y-JY.js";import"./dayjs-CZ9ViMNG.js";import{b as Q}from"./@fxts-cXD7MMns.js";import{i as q}from"./axios-Da_2YOEl.js";import{C as $}from"./universal-cookie-Cmu-M0pA.js";import{d as m}from"./styled-components-BHeWolSk.js";import{a as K}from"./react-router-BOGNRwMt.js";import"./call-bind-oCmkau44.js";import"./get-intrinsic-BKEvijrG.js";import"./es-errors-DzOT6E3C.js";import"./has-symbols-eVqrYdw7.js";import"./has-proto-JnoBQRdH.js";import"./function-bind-BbkWVFrm.js";import"./hasown-DYqjtFKE.js";import"./set-function-length-B5OANX0j.js";import"./define-data-property-DO9o5wXF.js";import"./es-define-property-tzmkNPou.js";import"./gopd-CEkvUycD.js";import"./has-property-descriptors-DphFXkuo.js";import"./ua-parser-js-BBZA8f28.js";import"./react-dom-CvjNlBjt.js";import"./scheduler-CzFDRTuY.js";import"./@remix-run-DhIrJP8L.js";import"./react-helmet-async-jeYtsOp6.js";import"./react-fast-compare-Dxyd5FYM.js";import"./invariant-Bm-uj-iG.js";import"./shallowequal-F1vAqOm6.js";import"./react-redux-DlpFpBQ0.js";import"./use-sync-external-store-KK8Bpy9o.js";import"./redux-persist-Cbb21slr.js";import"./redux-DITMfSWq.js";import"./usehooks-ts-CCkIaz9n.js";import"./lodash.debounce-CDHjgjOA.js";import"./framer-motion-DbOul5S8.js";import"./crypto-js-C0tVhymU.js";import"./react-error-boundary-DEyRbsfJ.js";import"./dompurify-CqxHTgmJ.js";import"./qs-LNWgR29u.js";import"./side-channel-CpYS7sho.js";import"./object-inspect-CL2AiSqO.js";import"./@reduxjs-DYPsSoVN.js";import"./immer-DqxjFn0G.js";import"./redux-thunk-ClJT1hhx.js";import"./redux-logger-B8JP_rc7.js";import"./qrcode.react-CJWQPexu.js";import"./swiper-DLv7ejQn.js";import"./@hookform-Dc6jS12O.js";import"./react-hook-form-BJXGuiwr.js";import"./@marsidev-F19kFZ1X.js";import"./currency.js-9OAR_aOO.js";import"./react-select-CI241hL_.js";import"./@babel-CabbEptY.js";import"./@emotion-DwO3GsBP.js";import"./hoist-non-react-statics-Buxaj0Kl.js";import"./react-is-8JwjhRSi.js";import"./stylis-YPZU7XtI.js";import"./@floating-ui-NvD4EidW.js";import"./use-isomorphic-layout-effect-MPmsYcaj.js";import"./memoize-one-BdPwpGay.js";import"./styled-reset-B7ZXsPC1.js";/* empty css */import"./ordersKeys-Cl-HfzWV.js";const r={CLAIMS:"CLAIMS",REVIEWS:"REVIEWS",INQUIRY:"INQUIRY",CHANGE_MEMBER_INFO:"CHANGE_MEMBER_INFO",ADDRESS:"ADDRESS",CHATBOT_WEB:"CHATBOT_WEB",CHATBOT_APP:"CHATBOT_APP",EXHIBITION_EMPLOYEE:"EXHIBITION_EMPLOYEE"},s={ALL:"ALL",APP:"APP",WEB:"WEB"},V=({memberNo:n,params:o,options:d})=>T({queryKey:B.summary(n,o),queryFn:async()=>{const{data:l}=await H.getCouponSummary(o);return l},...d,enabled:n!==0}),Z=({memberNo:n,options:o})=>T({queryKey:R.likeCount(n),queryFn:async()=>{const{data:d}=await v.getLikeProductsCount();return d},enabled:n!==0,...o}),J=()=>{const{openDialog:n}=M(),o=y.getAccessToken(),l=new $().get("wHmAut"),E=U();return{logout:async()=>{var g;try{if(!(await W.signOut({ssid:Y((o==null?void 0:o.accessToken)||""),wHmAut:l})).data.success)throw new Error("로그아웃에 실패했습니다.");y.clear(),E.removeQueries({predicate:({queryKey:A})=>Q(A[0],[...D.all])})}catch(u){throw await n(q(u)?(g=u.response)==null?void 0:g.data.message:"로그아웃에 실패했습니다."),u}}}},tt=m.section` padding: 8px 20px 24px; display: flex; flex-direction: column; gap: 28px; background: #fff; margin-bottom: 8px; > h1 { font-size: 2.2rem; ${C.bold}; line-height: 28.6px; color: var(--color-textSecondary); } `,et=m.ul` padding: 16px 15.5px; border: 1px solid #e9eaef; border-radius: 8px; display: flex; justify-content: center; gap: 32px; `,ot=m.li` text-align: center; display: flex; flex-direction: column; flex: 1; position: relative; &:not(&:last-child) { &::after { position: absolute; content: ''; right: -16px; width: 1px; height: 100%; background: #e9eaef; } } > a { display: flex; flex-direction: column; gap: 11px; } `,rt=m.p` color: #b3b4b9; font-size: 1.2rem; line-height: 14.4px; `,it=m.p` color: var(--color-textPrimary); ${C.bold}; font-size: 1.8rem; line-height: 23.4px; `,nt=m.section` > div { width: 100%; background: var(--color-white); height: 94px; display: flex; justify-content: center; align-items: start; gap: 24px; padding-top: 19px; > * { font-size: 1.3rem; color: var(--color-textGray); text-decoration: underline; } } `,st=m.li` width: 100%; height: 60px; border-bottom: 1px solid #f2f3f5; > a, div { padding: 0 20px; width: 100%; height: 100%; display: flex; justify-content: space-between; align-items: center; background: var(--color-white); color: var(--color-textSecondary); font-size: 1.6rem; line-height: 20.8px; cursor: pointer; } `,c={MemberInfoContainer:tt,MemberInfoList:et,MemberInfoItem:ot,TitleText:rt,CountText:it,MenuListContainer:nt,MenuItem:st},P=n=>w.createElement("svg",{width:8,height:14,viewBox:"0 0 8 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n},w.createElement("path",{d:"M0.999999 1L7 7L1 13",stroke:"#84858A",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"})),at=[{key:r.CLAIMS,title:"취소/반품/교환 내역",url:a.MY_PAGE.CLAIMS.LIST,display:s.ALL},{key:r.REVIEWS,title:"리뷰 관리",url:a.MY_PAGE.REVIEWS.LIST,display:s.ALL},{key:r.INQUIRY,title:"상품문의 내역",url:a.MY_PAGE.PRODUCT_INQUIRIES,display:s.ALL},{key:r.CHANGE_MEMBER_INFO,title:"회원정보 수정",url:S.CHANGE_MEMBER_INFO,display:s.WEB},{key:r.ADDRESS,title:"배송지 관리",url:a.MY_PAGE.ADDRESSES.LIST,display:s.ALL},{key:r.CHATBOT_WEB,title:"챗봇상담",url:"https://happybot.happypointcard.com/?channelId=29ccea66-5757-4c05-8606-3317b763c392",display:s.WEB},{key:r.CHATBOT_APP,title:"챗봇상담",url:"https://happybot.happypointcard.com",display:s.APP},{key:r.EXHIBITION_EMPLOYEE,title:"임직원 전용",url:a.EXHIBITIONS.DETAIL.replace(":eventNo","81302"),state:"mypage",display:s.ALL}],be=k(()=>{const n=()=>{if(!h)return null;const i=z()==="IOS"?"DAN-6Yj6bXbPDglzj3I5":"DAN-vpc1UPwZ4cjRj1Ho";return t.jsx("section",{style:{padding:"0 16px 24px",background:"#ffffff"},children:t.jsx(F,{unitId:i,slotId:"kakaoAdMyPage",width:400,height:100,showOnlyWhenLoaded:!0,wrapperStyle:{margin:"12px 0 0"}})})},{data:o}=G(),{data:d}=X({searchParams:{pageNumber:1,pageSize:1,hasTotalCount:!0,startYmd:null,endYmd:null},memberNo:(o==null?void 0:o.memberNo)||0,options:{select:e=>e.totalCount}}),{data:l}=Z({memberNo:(o==null?void 0:o.memberNo)||0}),{data:E}=V({memberNo:(o==null?void 0:o.memberNo)||0,params:{expireDay:999}}),L=[{title:"구매내역",url:a.MY_PAGE.ORDERS.LIST,count:d||0},{title:"보유쿠폰",url:a.MY_PAGE.COUPONS,count:(E==null?void 0:E.usableCouponCnt)||0},{title:"관심상품",url:a.MY_PAGE.WISH,count:(l==null?void 0:l.likedCount)||0}],g=K(),{openDialog:u}=M(),{logout:A}=J(),_=async()=>{try{await u("로그아웃 하시겠습니까?",[{type:"cancel",label:"아니요"},{type:"ok",label:"로그아웃"}])&&(await A(),y.clear(),g(a.MAIN))}catch(e){console.error(e)}},I=y.getAccessToken(),O=e=>{const i=window.innerHeight,p=i*9/16,x=window.screenX+window.outerWidth-p-20,f=window.screenY+window.outerHeight-i*.75-20;window.open(e,"_blank",`width=${p},height=${i*.75},left=${x},top=${f},resizable=no`)};return w.useEffect(()=>{const e=i=>{i.persisted&&N&&sessionStorage.getItem("refresh")==="1"&&(sessionStorage.removeItem("refresh"),window.location.reload())};return window.addEventListener("pageshow",e),()=>{window.removeEventListener("pageshow",e)}},[]),t.jsxs(t.Fragment,{children:[t.jsxs(c.MemberInfoContainer,{children:[t.jsxs("h1",{children:["고객님 ",t.jsx("br",{})," 반갑습니다."]}),t.jsx(c.MemberInfoList,{children:L.map(({title:e,count:i,url:p})=>t.jsx(c.MemberInfoItem,{children:t.jsxs(b,{to:p,children:[t.jsx(c.TitleText,{children:e}),t.jsx(c.CountText,{children:i})]})},e))})]}),t.jsxs(c.MenuListContainer,{children:[t.jsx("ul",{children:at.map(({key:e,title:i,url:p,display:x})=>{const f=e===r.CHATBOT_WEB||e===r.CHATBOT_APP,j=e===r.CHANGE_MEMBER_INFO;return x===s.APP&&!h||x===s.WEB&&h||!(I!=null&&I.isEmployee)&&e===r.EXHIBITION_EMPLOYEE?null:t.jsx(c.MenuItem,{onClick:()=>{f&&sessionStorage.setItem("refresh","1")},children:f&&!h?t.jsxs("div",{onClick:()=>O(p),children:[i,t.jsx(P,{})]}):t.jsxs(b,{to:p,state:e===r.EXHIBITION_EMPLOYEE?{from:"mypage"}:void 0,target:j?"_blank":"_self",children:[i,t.jsx(P,{})]})},e)})}),h?null:t.jsxs("div",{children:[t.jsx("button",{onClick:_,children:"로그아웃"}),t.jsx(b,{to:S.MEMBER_DELETE,target:"_blank",children:"회원탈퇴"})]})]}),h?t.jsx(n,{}):null]})});export{be as default};