(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9883],{31647:function(o,e,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/display/promotions/collection/[promotionId]",function(){return n(16832)}])},20189:function(o,e,n){"use strict";var t,i;n.d(e,{F:function(){return t}}),(i=t||(t={})).DUPLICATE_ISSUED="DUPLICATE_ISSUE_COUPON_NOT_ALLOW",i.QUANTITY_EXHAUSTED="POSSIBLE_ISSUE_COUPON_EXHAUSTED",i.INVALID="INVALID_COUPON"},16832:function(o,e,n){"use strict";n.r(e),n.d(e,{__N_SSP:function(){return P},default:function(){return _promotionId_}});var t=n(52322),i=n(49839),l=n(77932),r=n(76530),a=n(2784),s=n(70784),c=n(43001),m=n(22094),d=n(56159),p=n(12447),u=n(47517),C=n(84217),I=n(66314),f=n(5226),_=n(28222),h=n(5612),T=n(66541),g=n(20189),E=n(49293),O=n(26613),S=n(6690),w=n(43833);let N="B"===c.ZP.design.type.default;var collection_PromotionCollectionDetail=o=>{let{collection:e}=o,n=(0,a.useRef)(null),{isMobile:c,isTablet:k}=(0,r.Z)("promotions-detail"),[A,L]=(0,a.useState)(null),v=(0,a.useMemo)(()=>(0,I.uT)(e.pcContent),[e.pcContent]),x=(0,a.useRef)([]),{isMobile:b}=(0,r.Z)(),[P,U]=(0,a.useState)(0),[j,F]=(0,a.useState)(!1),y=(0,a.useRef)(null),Z=(0,h.l)(),[D,M]=(0,a.useState)(!1);(0,a.useEffect)(()=>{(0,f.S)({event:"view_promotion",ecommerce:{page_area:"기획전",items:[{promotion_id:String(e.id),promotion_name:e.title,creative_name:void 0}]}})},[e.id]);let handleShareClick=()=>{var o;let n=window.location.href,t=(0,_.Rz)(e.title);L({url:n,title:t,imageUrl:null!==(o=e.pcImageUrl)&&void 0!==o?o:""})},handleOnIframeLoadComplete=()=>{let o=(0,C.dw)(e.id,c);o?(window.scrollTo({top:o}),(0,C.sP)(e.id,c)):window.scrollTo({top:0})},onClickTabFromIframe=o=>{(0,S.zM)(o,x,P,U,F,y,S.m5,b)},onClickCouponFromIframe=async o=>{if(O.Z.getIsGuest()){Z.show({message:"로그인 후 쿠폰 다운로드가 가능합니다.",dismissButtonTitle:"취소",confirmButtonTitle:"확인",onConfirm:()=>{M(!0)}});return}try{await T.ZP.post("/coupons/event",{promotionNo:o},{errorHandlingOptions:{shouldReturnRawError:!0}}),Z.show({message:"해당 쿠폰이 발행되었습니다."})}catch(o){if(o)switch(o.response.data.code){case g.F.DUPLICATE_ISSUED:Z.show({message:"기존에 등록된 쿠폰 번호입니다.\n확인 후 다시 입력해 주세요."});break;case g.F.QUANTITY_EXHAUSTED:Z.show({message:"발급가능한 전체 쿠폰 수량이 소진되었습니다."});break;default:var e,n;(null===(n=o.response)||void 0===n?void 0:null===(e=n.data)||void 0===e?void 0:e.message)?Z.show({message:o.response.data.message}):o.message&&Z.show({message:o.message})}}};return(0,t.jsxs)(t.Fragment,{children:[(!N||"DEFAULT"===e.titleLocationOptionType)&&(0,t.jsx)(m.N,{title:e.title,description:e.description,target:"promotion",onShareClick:handleShareClick}),v&&(0,t.jsx)(p.Z,{iframeRef:n,promotionId:e.id,mobileContent:e.mobileContent,pcContent:e.pcContent,isMobile:c,onLoadComplete:handleOnIframeLoadComplete,onClickTabFromIframe:onClickTabFromIframe,onClickCouponFromIframe:onClickCouponFromIframe}),!v&&(0,t.jsx)(d.Z,{promotionId:e.id,mobileContent:e.mobileContent,pcContent:e.pcContent,isMobile:c,onLoadComplete:handleOnIframeLoadComplete,onClickTabFromIframe:onClickTabFromIframe,onClickCouponFromIframe:onClickCouponFromIframe}),"BOTTOM"===e.titleLocationOptionType&&(0,t.jsx)(m.N,{title:e.title,description:e.description,target:"promotion",onShareClick:handleShareClick}),(0,t.jsxs)(w.N,{mobileFull:!0,contentBox:!1,children:[e.id&&(0,t.jsx)(S.BF,{collectionId:e.id,groupRefs:x,titleLocationOptionType:e.titleLocationOptionType}),(0,t.jsx)(u.Z,{title:N?"CAMPAIGN"===e.promotionType?"VIEW MORE CAMPAIGN":"VIEW MORE COLLECTION":"더 많은 기획전",promotionType:"CAMPAIGN"===e.promotionType?i.q.CAMPAIGN:i.q.COLLECTION,promotionId:e.id})]}),(0,t.jsx)(l.Z,{width:"100%",height:c&&!k?"80px":"136px"}),(0,t.jsx)(s.Z,{open:!!A,onClose:()=>L(null),shareInfo:A,isMobile:c,isTablet:k,shouldIssuePoints:!0}),(0,t.jsx)(E.Z,{open:D,onClose:()=>M(!1),callbackAction:async()=>{M(!1)}})]})},k=n(77071),A=n(39964),L=n(80071),v=n(13649),x=n(97729),b=n.n(x),P=!0,_promotionId_=o=>{var e,n;let{collection:i}=o,l=null!==(e=null==i?void 0:i.id)&&void 0!==e?e:"",r=(null==i?void 0:i.title)?(0,_.Rz)(i.title):"",a=null!==(n=null==i?void 0:i.pcImageUrl)&&void 0!==n?n:"";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(b(),{children:(0,t.jsx)("link",{rel:"canonical",href:"".concat(v.$g,"/display/promotions/collection/").concat(l)})}),(0,t.jsx)(L.Z,{categoryId:"promotion_main",url:"".concat(v.$g,"/display/promotions/collection/").concat(l),title:r?"".concat(v.Ai," - ")+r:"",imageurl:a}),(0,t.jsxs)(k.Z,{children:[(0,t.jsx)(collection_PromotionCollectionDetail,{...o}),(0,t.jsx)(A.Z,{})]})]})}}},function(o){o.O(0,[3278,8863,7673,9774,2888,179],function(){return o(o.s=31647)}),_N_E=o.O()}]);