(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2343],{59650:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/display/promotions/event/[promotionId]",function(){return n(37254)}])},37254:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSP:function(){return U},default:function(){return _promotionId_}});var o=n(52322),i=n(2784),a=n(49839),r=n(22094),s=n(56159),l=n(77932),c=n(23004),d=n(67929),p=n(79357),m=n(86870),u=n(56406),f=n(14852),h=n(76530),v=n(96577),x=n.n(v),g=n(49293),I=n(71705),w={src:"/_next/static/media/event-copy-link-icon.e8fa1ab6.svg",height:24,width:25,blurWidth:0,blurHeight:0},C=n(47517),b=n(66541),E=n(5612),T=n(12447),j=n(88744),Z=n(26613);function AttendanceEvent(e){let t=(0,E.l)(),{pcContent:n,mobileContent:a,isMobile:r}=e,[s,l]=(0,i.useState)(!1),c=(0,i.useRef)(null),d=(0,i.useRef)(null),p=(0,i.useRef)(!1),handleOnIframeLoadComplete=()=>{window.scrollTo({top:0})};async function fetchEventAttendanceInfo(){try{let t=await b.ZP.get("/promotions/".concat(e.promotionId,"/event-attendance"));c.current=t;let n=document.getElementById("attendance-event-iframe");n.contentWindow.postMessage({isLogIn:!Z.Z.getIsGuest()},"*"),n.contentWindow.postMessage({attendanceInfo:t},"*")}catch(e){showErrMessage(e)}}let m=(0,j.Z)(async function(){if(Z.Z.getIsGuest()){t.show({message:"로그인 후 이벤트에\n참여하실 수 있습니다.",dismissButtonTitle:"취소",confirmButtonTitle:"확인",onConfirm:()=>{l(!0)}});return}if(null!==c.current&&!p.current){p.current=!0;try{await b.ZP.post("/promotions/".concat(e.promotionId,"/event-attendance"));let n=c.current.attendances.length+1,o=c.current.vouchers[n-1].point;o>0&&t.show({message:"출석이 체크되었습니다.\n".concat(o,"포인트가 지급되었습니다.")}),await fetchEventAttendanceInfo()}catch(e){showErrMessage(e)}finally{p.current=!1}}},500);async function handleOnClickVoucherDownload(n){let o=n.data.voucherPromotionNo;if(null==o){alert("voucherPromotionNo is invalid");return}if(!p.current){p.current=!0;try{await b.ZP.post("/promotions/".concat(e.promotionId,"/event-attendance/").concat(o)),await fetchEventAttendanceInfo(),t.show({message:"쿠폰이 발행되었습니다."})}catch(e){showErrMessage(e)}finally{p.current=!1}}}function showErrMessage(e){t.show({message:e.message,confirmButtonTitle:r?"확인":"취소"})}return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(T.Z,{iframeId:"attendance-event-iframe",iframeRef:d,onLoadIframe:()=>fetchEventAttendanceInfo(),onLoadComplete:()=>handleOnIframeLoadComplete(),promotionId:e.promotionId,isMobile:r,mobileContent:a,pcContent:n,eventHandlers:[{event:"onClickVoucherDownload",callback:e=>handleOnClickVoucherDownload(e)},{event:"onClickChulcheck",callback:()=>m()},{event:"onRequestEventAttendanceInfo",callback:()=>fetchEventAttendanceInfo()}]}),(0,o.jsx)(g.Z,{open:s,onClose:()=>l(!1),callbackAction:()=>{l(!1),fetchEventAttendanceInfo()}})]})}var y=n(5632);function ReviewEvent(e){let t=(0,E.l)(),n=(0,y.useRouter)(),{pcContent:a,mobileContent:r,isMobile:s,promotionId:l}=e,[c,d]=(0,i.useState)(!1),p=(0,i.useRef)(null),handleOnIframeLoadComplete=()=>{window.scrollTo({top:0})};async function handleOnClickChallenge(){if(Z.Z.getIsGuest()){d(!0);return}try{let e=await b.ZP.post("/promotions/".concat(l,"/event/review/participate")),t=e.point,n=document.getElementById("review-event-iframe");n.contentWindow.postMessage({onParticipate:{point:t}},"*"),fetchEventInfo()}catch(e){alert(e.message)}}async function fetchEventInfo(){if(Z.Z.getIsGuest()){sendPageStateToIframe(!1,0);return}try{let e=await b.ZP.get("/promotions/".concat(l,"/event/review/count"));sendPageStateToIframe(!0,e.count)}catch(e){alert(e.message)}}function sendPageStateToIframe(e,t){let n=document.getElementById("review-event-iframe");n.contentWindow.postMessage({pageState:{participationCount:t,isLogIn:e}},"*")}return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(T.Z,{iframeRef:p,iframeId:"review-event-iframe",onLoadIframe:()=>fetchEventInfo(),onLoadComplete:()=>handleOnIframeLoadComplete(),promotionId:e.promotionId,isMobile:s,mobileContent:r,pcContent:a,eventHandlers:[{event:"onClickChallenge",callback:handleOnClickChallenge},{event:"onClickWriteReview",callback:function(){if(Z.Z.getIsGuest()){t.show({message:"로그인 후 작성하실 수 있습니다.",dismissButtonTitle:"취소",confirmButtonTitle:"확인",onConfirm:()=>d(!0)});return}n.push("/mypage/review")}}]}),(0,o.jsx)(g.Z,{open:c,onClose:()=>d(!1),callbackAction:()=>{d(!1),fetchEventInfo()}})]})}function EtcEvent(e){let{pcContent:t,mobileContent:n,isMobile:a}=e,r=(0,i.useRef)(null),handleOnIframeLoadComplete=()=>{window.scrollTo({top:0})};return(0,o.jsx)(T.Z,{iframeRef:r,onLoadComplete:()=>handleOnIframeLoadComplete(),promotionId:e.promotionId,isMobile:a,mobileContent:n,pcContent:t})}function ParticipationEvent(e){let t=(0,E.l)(),{pcContent:n,mobileContent:a,isMobile:r,promotionId:s}=e,l=(0,i.useRef)(null),c=(0,i.useRef)(null),[d,p]=(0,i.useState)(!1),[m,u]=(0,i.useState)(!1),handleOnIframeLoadComplete=()=>{window.scrollTo({top:0})};async function fetchEventParticipationInfo(){if(!Z.Z.getIsGuest())try{let e=await b.ZP.get("/promotions/".concat(s,"/event-participation"));l.current=e;let t=document.getElementById("participation-event-iframe");sendMessageToIframe(t,e),t.onload=()=>{sendMessageToIframe(t,e)}}catch(i){var e,n;let o=(null===(n=i.response)||void 0===n?void 0:null===(e=n.data)||void 0===e?void 0:e.message)||i.message||"Unknown error occurred";t.show({message:o})}}function sendMessageToIframe(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3;e.contentWindow?e.contentWindow.postMessage({participationInfo:t},"*"):n>0&&setTimeout(()=>sendMessageToIframe(e,t,n-1),500)}async function handleOnPaticipationCommon(){if(Z.Z.getIsGuest()){t.show({message:"로그인 후 이벤트에\n참여하실 수 있습니다.",dismissButtonTitle:"취소",confirmButtonTitle:"확인",onConfirm:()=>{p(!0)}});return}try{if(await b.ZP.post("/promotions/".concat(s,"/event-participation"),{},{errorHandlingOptions:{shouldReturnRawError:!0}}),1091===s){let e=new Date,n="".concat(e.getMonth()+1,"/").concat(e.getDate()),o="";switch(n){case"11/20":o="커브 패딩";break;case"11/21":o="여성 크롭 커브 패딩";break;case"11/22":o="커브 패딩 호보백";break;case"11/23":case"11/24":o="커브 롱패딩";break;case"11/25":o="커브 러너";break;case"11/26":o="여성 크롭 유광 커브 패딩";break;case"11/27":o="유광 커브 패딩";break;case"11/28":o="커브 패딩 힙색";break;case"11/29":o="여성 커브 롱 패딩";break;case"11/30":o="[KIDS] 커브 러너";break;default:o="이벤트"}let i="".concat(n," BLACK CURVE DAY [ ").concat(o," ]에 응모 완료 되었습니다.");t.show({message:i})}else t.show({message:"응모가 완료되었습니다."});await fetchEventParticipationInfo()}catch(r){var e,n,o,i;let a="";(null===(n=r.response)||void 0===n?void 0:null===(e=n.data)||void 0===e?void 0:e.code)==="ALREADY_ENTERED"?a="이미 응모가 완료되었습니다.\n(ID당 1회만 응모 가능)":(null===(i=r.response)||void 0===i?void 0:null===(o=i.data)||void 0===o?void 0:o.code)==="NOT_FOUND_PROMOTION"&&(a="응모 기간이 종료되었습니다."),t.show({message:a||r.message||"예기치 못한 오류가 발생했습니다."})}}async function handleOnPaticipationQuiz(e){let n=e.data.userAnswer;if(Z.Z.getIsGuest()){t.show({message:"로그인 후 응모가 가능합니다.",dismissButtonTitle:"취소",confirmButtonTitle:"확인",onConfirm:()=>{p(!0),u(!0)}});return}try{let e=await b.ZP.post("/promotions/".concat(s,"/event-participation-quiz"),{userAnswer:n},{errorHandlingOptions:{shouldReturnRawError:!0}}),{remainCount:o}=l.current||{},i="".concat(e.message).concat(o&&o>1?"\n고객님의 잔여 응모 횟수는 ".concat(o-1,"회입니다."):"");t.show({message:i}),await fetchEventParticipationInfo()}catch(n){var o,i;let e=(null===(i=n.response)||void 0===i?void 0:null===(o=i.data)||void 0===o?void 0:o.message)||n.message||"Unknown error occurred";t.show({message:e})}}return(0,i.useEffect)(()=>{fetchEventParticipationInfo()},[Z.Z.getIsGuest()]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(T.Z,{iframeRef:c,iframeId:"participation-event-iframe",onLoadComplete:()=>handleOnIframeLoadComplete(),promotionId:e.promotionId,isMobile:r,mobileContent:a,pcContent:n,eventHandlers:[{event:"onPaticipationQuiz",callback:handleOnPaticipationQuiz},{event:"onPaticipationCommon",callback:handleOnPaticipationCommon}]}),(0,o.jsx)(g.Z,{open:d,onClose:()=>p(!1),callbackAction:()=>{p(!1),function(){if(m){let e=document.getElementById("participation-event-iframe");e&&e.contentWindow&&e.contentWindow.postMessage({focusScroll:!0},"*")}}()}})]})}var k=n(41263),R=n(66314),O=n(65125),P=n(39297);function AlternativeIframeTopFixedContainer(){let{scrollDir:e}=(0,P.v)();return(0,o.jsx)(l.Z,{id:"alternative-iframe-top-fixed-container",sx:[{position:"fixed",left:0,zIndex:1,width:"100%",height:"auto",top:e===O.Nm.Up?139:84,"@media (max-width: 1365px)":{top:e===O.Nm.Up?139:75},"@media (max-width: 1189px)":{top:e===O.Nm.Up?176:112},"@media (max-width: 768px)":{top:e===O.Nm.Up?56:0}}]})}function AlternativeIframeBottomFixedContainer(){return(0,o.jsx)(l.Z,{id:"alternative-iframe-bottom-fixed-container",sx:{position:"fixed",bottom:0,left:0,zIndex:1,width:"100%",height:"auto"}})}var A=n(28222),M=n(43001),B=n(43833),L=n(6690);let N="B"===M.ZP.design.type.default;function EventDetail(e){var t,n,c;let{eventDetailInfo:d}=e,{isMobile:p,isTablet:m}=(0,h.Z)("promotions-detail"),[u,v]=(0,i.useState)(null),[x,I]=(0,i.useState)(!1),w=(0,i.useRef)(null),b=(0,R.uT)(d.pcContent),E=(0,i.useRef)([]),{isMobile:T}=(0,h.Z)(),{scrollDir:j}=(0,P.v)(),[Z,y]=(0,i.useState)(0),[k,O]=(0,i.useState)(!1);(0,i.useRef)(null);let[M,S]=(0,i.useState)(0);return(0,o.jsxs)(o.Fragment,{children:[(!N||"DEFAULT"===d.titleLocationOptionType)&&(0,o.jsx)(r.N,{title:d.title,description:d.description,target:"event",onShareClick:()=>{var e;let t=(0,A.Rz)(d.title);v({url:window.location.href,title:t,imageUrl:null!==(e=null==d?void 0:d.pcListImageUrl)&&void 0!==e?e:""})}}),b&&(0,o.jsx)(ToBeEvent,{eventType:null!==(c=null===(t=d.eventType)||void 0===t?void 0:t.code)&&void 0!==c?c:a.l.GENERAL,promotionId:d.id,pcContent:d.pcContent,mobileContent:d.mobileContent,isMobile:p}),!b&&(0,o.jsx)(s.Z,{promotionId:d.id,pcContent:d.pcContent,mobileContent:d.mobileContent,isMobile:p}),"BOTTOM"===d.titleLocationOptionType&&(0,o.jsx)(r.N,{title:d.title,description:d.description,target:"event",onShareClick:()=>{var e;let t=(0,A.Rz)(d.title);v({url:window.location.href,title:t,imageUrl:null!==(e=null==d?void 0:d.pcListImageUrl)&&void 0!==e?e:""})}}),(0,o.jsxs)(B.N,{mobileFull:!0,contentBox:!1,children:[d.id&&(0,o.jsx)(L.BF,{collectionId:d.id,groupRefs:E,titleLocationOptionType:d.titleLocationOptionType}),(null===(n=d.eventType)||void 0===n?void 0:n.code)===a.l.COMMENT&&(0,o.jsx)(CommentEvent,{commentListRef:w,eventId:d.id,onTriedToInputOrReportCommentByGuestAuth:()=>I(!0)}),(0,o.jsx)(C.Z,{title:N?"VIEW MORE PROMOTION":"더 많은 이벤트",promotionId:d.id,promotionType:a.q.EVENT})]}),(0,o.jsx)(l.Z,{height:p&&!m?"80px":"136px"}),(0,o.jsx)(f.Z,{open:!!u,onClose:()=>v(null),shareInfo:u,isMobile:p,isTablet:m,shouldIssuePoints:!0}),(0,o.jsx)(g.Z,{open:x,onClose:()=>I(!1),callbackAction:()=>{var e;null===(e=w.current)||void 0===e||e.reload(),I(!1)}})]})}function ToBeEvent(e){let{eventType:t,pcContent:n,mobileContent:r,isMobile:s,promotionId:l}=e,[c,d]=(0,i.useState)(!1);if((0,i.useEffect)(()=>{d(!1),setTimeout(()=>{d(!0)},20)},[l,s]),!1===c)return(0,o.jsx)(o.Fragment,{});switch(t){case a.l.ATTENDANCE:return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(AlternativeIframeTopFixedContainer,{}),(0,o.jsx)(AttendanceEvent,{promotionId:e.promotionId,pcContent:n,mobileContent:r,isMobile:s}),(0,o.jsx)(AlternativeIframeBottomFixedContainer,{})]});case a.l.REVIEW:return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(AlternativeIframeTopFixedContainer,{}),(0,o.jsx)(ReviewEvent,{promotionId:e.promotionId,pcContent:n,mobileContent:r,isMobile:s}),(0,o.jsx)(AlternativeIframeBottomFixedContainer,{})]});case a.l.PARTICIPATION:return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(AlternativeIframeTopFixedContainer,{}),(0,o.jsx)(ParticipationEvent,{promotionId:e.promotionId,pcContent:n,mobileContent:r,isMobile:s}),(0,o.jsx)(AlternativeIframeBottomFixedContainer,{})]});default:return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(AlternativeIframeTopFixedContainer,{}),(0,o.jsx)(EtcEvent,{promotionId:e.promotionId,pcContent:n,mobileContent:r,isMobile:s}),(0,o.jsx)(AlternativeIframeBottomFixedContainer,{})]})}}function CommentEvent(e){let{isMobile:t,isTablet:n,isDesktop:a,isOverMaxViewport:r}=(0,h.Z)("promotions-detail"),[s,f]=(0,i.useState)(!1);return(0,o.jsxs)(c.Z,{alignItems:"center",justifyContent:"center",mt:t&&!n?"32px":"80px",width:"100%",children:[(!t||n)&&(0,o.jsx)(l.Z,{sx:{width:"100%",borderTop:"1px solid ".concat(M.ZP.colors.grayScale.gray3)}}),!N&&(0,o.jsx)(d.Z,{disableRipple:!0,onClick:()=>{"undefined"!=typeof navigator&&(navigator.clipboard.writeText(window.location.href),f(!0))},sx:{width:t&&!n?"calc(100% - 40px)":"171px",mt:t&&!n?"32px":"80px"},children:(0,o.jsxs)(c.Z,{direction:"row",alignItems:"center",justifyContent:"center",border:"1px solid #E8E8E8",borderRadius:M.ZP.border.shape.radius,py:"12px",width:"100%",height:"48px",gap:"4px",children:[(0,o.jsx)(p.Z,{fontSize:t&&!n?"14px":"16px",fontWeight:500,children:"링크 복사하기"}),(0,o.jsx)(x(),{src:w,alt:"copy-link-btn",style:{width:t&&!n?"25px":"27px",height:t&&!n?"24px":"26px"}})]})}),(0,o.jsx)(l.Z,{width:"100%",height:"8px",bgcolor:"#f8f8f8",mt:"24px",display:t&&!n?"block":"none"}),(0,o.jsx)(l.Z,{width:" 100%",maxWidth:n?"100%":"1168px",px:t&&!n?"20px":"0px",mt:t&&!n?"24px":N?"40px":"120px",children:(0,o.jsx)(I.Z,{ref:e.commentListRef,apiPrefix:"EVENT",contentId:e.eventId,isMobile:t&&!n,isDesktop:n||a,isOverMaxViewport:r,onTriedToInputOrReportCommentByGuestAuth:e.onTriedToInputOrReportCommentByGuestAuth})}),!N&&t&&!n&&(0,o.jsx)(m.Z,{sx:{width:"100%",border:"4px solid ".concat(M.ZP.colors.divider.gray1)}}),(0,o.jsx)(u.Z,{anchorOrigin:{vertical:"bottom",horizontal:"center"},open:s,onClose:()=>f(!1),message:"복사되었습니다",autoHideDuration:2e3,TransitionComponent:k.Z,TransitionProps:{timeout:300},sx:{position:"fixed",bottom:{xs:30,sm:50},width:"auto",left:"50%",right:"auto",transform:"translate(-50%, 0)",zIndex:e=>e.zIndex.snackbar,".MuiSnackbarContent-root":{minWidth:"140px",width:"100%",height:"34px",borderRadius:"0px"===M.ZP.border.shape.radius?"0":"50px",fontSize:"12px",lineHeight:"18px",padding:"0 33px 10px",boxSizing:"border-box"}}})]})}var S=n(77071),F=n(39964),_=n(80071),D=n(13649),W=n(97729),z=n.n(W),U=!0,_promotionId_=e=>{var t,n,i;let{eventDetailInfo:a}=e,r=null!==(t=null==a?void 0:a.id)&&void 0!==t?t:"",s=null!==(n=null==a?void 0:a.pcListImageUrl)&&void 0!==n?n:"",l=null!==(i=null==a?void 0:a.title)&&void 0!==i?i:"";return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(z(),{children:(0,o.jsx)("link",{rel:"canonical",href:"".concat(D.$g,"/display/promotions/event/").concat(r)})}),(0,o.jsx)(_.Z,{categoryId:"promotion_main",url:"".concat(D.$g,"/display/promotions/event/").concat(r),imageurl:s,title:l?"".concat(D.Ai," - ")+l:""}),(0,o.jsxs)(S.Z,{children:[(0,o.jsx)(EventDetail,{...e}),(0,o.jsx)(F.Z,{})]})]})}}},function(e){e.O(0,[3278,8863,1705,4093,9774,2888,179],function(){return e(e.s=59650)}),_N_E=e.O()}]);