Build 562131stable
Module 631808
8,101 characters · in 2367a0cd7b984c15.jsDependencies
Required by (0)none
Lazily required by (0)none
Requires (45)
Lazily requires (0)none
Source Raw
function(i,t,e){e.d(t,{default:()=>is});var s=e(627968),n=e(64700),l=e(791282),a=e.n(l),o=e(835245),r=e(172218),c=e(331322),d=e(534514),u=e(761508),I=e(224640),h=e(20742),m=e(17928),f=e(192308),g=e(364522),p=e(444927),_=e(775602),S=e(793574),j=e(688810),x=e(197510),C=e(211159),L=e(937008),E=e(532794),N=e(871123),T=e(318254),A=e(262427),k=e(945942),O=e(375708);function b(i){let{location:t}=i,{shouldRender:e,limitedOfferTimeLeft:n}=(0,k.A)({location:t});return e?(0,s.jsx)(A.J,{text:O.intl.format(O.t["/bHQ84"],{numDays:Math.max(n,1),applicationName:O.intl.string(O.t.Uu8hke)}),Icon:T.C}):null}var v=e(975732),w=e(299679),y=e(561794),G=e(862772),R=e(310209),M=e(944841),W=e(734057),P=e(309010),D=e(174459),H=e(427262),F=e(413074),B=e(672525),U=e(226830),Q=e(788868),V=e(652215),X=e(518477),Z=e(699976),J=e(115599),K=e(273944);function $(i){let{onSelectSku:t,priceOptions:e,showPromotionalGiftBanner:n}=i;return(0,s.jsxs)(c.B,{direction:"vertical",gap:16,children:[(0,s.jsxs)("div",{className:K.u6,children:[(0,s.jsx)(B.D3,{onClick:()=>t(Q.pe.TIER_2),isGift:!0,priceOptions:e,showPromotionalGiftBanner:n,wumpusPosition:U.Rf.GIFT_SELECTION_MODAL,className:J.giftSelectionModalContext}),(0,s.jsx)(B.Ls,{onClick:()=>t(Q.pe.TIER_0),isGift:!0,priceOptions:e,className:J.giftSelectionModalContext})]}),(0,s.jsx)(F.A,{})]})}function z(){return(0,s.jsx)(s.Fragment,{children:Array.from({length:12},(i,t)=>(0,s.jsx)(M.O,{spec:Z.Z.SIZE_150},`placeholder-${t}`))})}function Y(i){let{displayItems:t,giftRecipient:e,defaultWishlistId:l,onSeeWishlistClick:a,onWishlistItemClick:o,totalUnownedWishlistItems:r,analyticsLocations:c}=i,d=n.useMemo(()=>new Set(t.map(i=>{let{source:t}=i;return t})),[t]),u=(0,m.bG)([P.A,W.A],()=>W.A.getChannel(P.A.getChannelId())),I=r>t.length?r-t.length+1:void 0,h=n.useCallback(()=>{o?.(),(0,f.closeAllModals)()},[o]);return(0,s.jsx)(s.Fragment,{children:t.map((i,n)=>{let{sku:o,source:r}=i;return null!=o&&(0,s.jsx)(w.dB,{newValue:{positionInSection:n,skuId:o.id,itemSource:r===y.uS.WISHLIST?"organic":"recommendation",productLine:o.productLine},children:(0,s.jsx)(M.A,{numMoreItems:n===t.length-1?I:void 0,sku:o,wishlistId:l,source:r,wishlistOwner:e,hasMultipleSources:d.size>1,onOpenWishlist:a,onClick:h,analyticsLocations:c,spec:Z.Z.SIZE_150,guildId:u?.guild_id,channelId:u?.id})},o.id)})})}function q(i){let{giftRecipient:t,onSeeWishlistClick:e,onWishlistItemClick:l,displayItems:a,defaultWishlistId:c,isLoading:u,totalUnownedWishlistItems:I,analyticsLocations:h}=i,m=(0,H.tx)(t),f=0===I?O.intl.string(O.t.BCi1gT):I>=12?O.intl.formatToPlainString(O.t.Y2RFOQ,{username:m}):O.intl.formatToPlainString(O.t.dIDKgi,{username:m}),{analyticsLocations:g}=(0,j.Ay)(...h??[],S.A.GIFT_SELECTION_MODAL_WISHLIST),_=(0,p.A)(()=>(0,o.A)()),[x,C]=n.useState(!1),L=n.useCallback(i=>{i&&!u&&a.length>0&&(D.default.track(V.HAw.IMPRESSION_GIFT_SELECTION_WISHLIST_SECTION_VIEWED,{gift_recipient_id:t.id,sku_ids:a.map(i=>{let{sku:t}=i;return t.id}),product_lines:Array.from(new Set(a.map(i=>{let{sku:t}=i;return t.productLine}))),location_stack:g}),C(!0))},[u,a,t.id,g]),E=(0,r.K)(L,void 0,!u&&!x),T=n.useMemo(()=>a.some(i=>{let{sku:t}=i;return(0,N.bF)(t)}),[a]);return(0,s.jsxs)("div",{ref:E,className:K.jf,children:[(0,s.jsx)("div",{className:K.nM,children:(0,s.jsx)(d.D,{variant:"heading-lg/semibold",color:"text-strong",className:K.Uf,children:f})}),T&&(0,s.jsx)(b,{location:"gift_selection_modal_wishlist"}),(0,s.jsx)("div",{className:K.KN,children:u?(0,s.jsx)(z,{}):(0,s.jsx)(w.dB,{newValue:{impressionSessionId:_,surface:"gift_selection_modal",wishlistOwnerId:t.id,wishlistId:c,analyticsLocations:g},children:(0,s.jsx)(Y,{displayItems:a,giftRecipient:t,defaultWishlistId:c,onSeeWishlistClick:e,onWishlistItemClick:l,totalUnownedWishlistItems:I,analyticsLocations:g})})})]})}function ii(i){let{giftRecipient:t,onClose:e,nitroSection:l,analyticsLocations:a,displayItems:o,wishlistCount:r,defaultWishlistId:c,isWishlistLoaded:d}=i,I=(0,y.tA)({isGift:!0,giftRecipient:t}),h=(d?r:0)>0?O.intl.string(O.t["7lZ31J"]):O.intl.string(O.t.BCi1gT),[f,p]=n.useState("Nitro"),S=n.useRef(null),j=n.useRef(null),x=(0,m.bG)([_.Ay],()=>_.Ay.useReducedMotion),C=n.useRef(!1),L=n.useCallback(i=>{p(i),C.current=!0;let e=S.current;null!=e&&e.addEventListener("scrollend",()=>{C.current=!1},{once:!0}),"Nitro"===i?e?.scrollTo({top:0,behavior:x?"auto":"smooth"}):j.current?.scrollIntoView({behavior:x?"auto":"smooth",block:"start"}),D.default.track(V.HAw.GIFT_SELECTION_TAB_SELECTED,{gift_recipient_id:t.id,tab_name:i,location_stack:a})},[t.id,a,x]),E=n.useCallback(()=>{D.default.track(V.HAw.GIFT_SELECTION_SEE_WISHLIST_CTA_CLICKED,{gift_recipient_id:t.id,wishlist_item_count:r,location_stack:a}),e(),(0,v.openUserProfileModal)({userId:t.id,tabSection:X.RP.WISHLIST})},[t.id,r,a,e]);return n.useEffect(()=>{let i=j.current,t=S.current;if(null==i||null==t)return;let e=new IntersectionObserver(i=>{let[t]=i;C.current||p(t.isIntersecting?"Wishlist":"Nitro")},{root:t,threshold:.5});return e.observe(i),()=>e.disconnect()},[I]),(0,s.jsxs)(s.Fragment,{children:[I&&(0,s.jsx)("div",{className:K.CE,children:(0,s.jsxs)(u.V,{type:"top",look:"brand",selectedItem:f,onItemSelect:L,children:[(0,s.jsx)(u.V.Item,{id:"Nitro","aria-label":O.intl.string(O.t.Ipxkog),children:O.intl.string(O.t.Ipxkog)}),(0,s.jsx)(u.V.Item,{id:"Wishlist","aria-label":h,children:h})]})}),(0,s.jsx)(g.Ip,{ref:S,className:K.XG,children:(0,s.jsxs)("div",{className:K.Qs,children:[(0,s.jsx)("div",{className:K.XP,children:l}),I&&(0,s.jsx)("div",{ref:j,className:K.XP,children:(0,s.jsx)(q,{giftRecipient:t,onSeeWishlistClick:E,onWishlistItemClick:e,displayItems:o,defaultWishlistId:c,analyticsLocations:a,isLoading:!d,totalUnownedWishlistItems:r})})]})})]})}function it(i){let{giftRecipient:t,onClose:e,nitroSection:l,analyticsLocations:o}=i,{wishlistAndRecommendations:r,totalUnownedWishlistItemCount:c,skusToUserAndReason:d,status:u,defaultWishlistId:I}=(0,G.rg)({userId:t.id,numItems:12,source:y.B5.USER_PROFILE}),h=n.useMemo(()=>a()(r.map(i=>{let e=null!=d[i.id]&&d[i.id][t.id]===R.j.WISHLIST?y.uS.WISHLIST:y.uS.POPULAR;return null!=i?{sku:i,source:e}:null})),[r,t.id,d]);return(0,s.jsx)(ii,{giftRecipient:t,onClose:e,nitroSection:l,analyticsLocations:o,displayItems:h,wishlistCount:c,defaultWishlistId:I,isWishlistLoaded:"loading"!==u})}function ie(i){let{giftRecipient:t,onClose:e,transitionState:l,analyticsLocations:a,analyticsLocation:o,analyticsObject:r,giftMessage:c,giftingOrigin:d=Q.vQ.DM_CHANNEL}=i,u=(0,C.t4)(i=>i.checkoutPriceOptions),{claimableRewards:m}=(0,L.Pv)(),f=null!=m&&m.length>0,p=n.useCallback(i=>{(0,E.A)({isGift:!0,giftRecipient:t,giftingOrigin:d,subscriptionTier:i,analyticsLocations:a??[],analyticsLocation:o??V.ThZ.GIFT_SELECTION_MODAL,analyticsObject:r??{page:null!=t?V.liQ.DM_CHANNEL:V.liQ.GUILD_CHANNEL,section:V.JJy.CHANNEL_TEXT_AREA,object:V.ZSU.BUTTON_ICON,objectType:V.AnalyticsObjectTypes.GIFT},giftMessage:c}),e()},[t,d,a,o,r,c,e]),_=n.useRef(!1);n.useEffect(()=>{_.current||(_.current=!0,D.default.track(V.HAw.GIFT_SELECTION_MODAL_OPENED,{gift_recipient_id:t?.id,location_stack:a}))},[t,a]);let S=(0,s.jsx)($,{onSelectSku:p,priceOptions:u,showPromotionalGiftBanner:f});return(0,s.jsx)(I.d,{transitionState:l,size:"lg",onClose:e,"aria-label":O.intl.string(O.t["wg/30i"]),children:(0,s.jsxs)("div",{className:K.jE,children:[(0,s.jsx)(h.rQ,{title:O.intl.string(O.t["wg/30i"])}),null!=t?(0,s.jsx)(it,{giftRecipient:t,onClose:e,nitroSection:S,analyticsLocations:a}):(0,s.jsx)(g.Ip,{className:K.XG,children:(0,s.jsx)("div",{className:`${K.Qs} ${K.GP}`,children:(0,s.jsx)("div",{className:K.XP,children:S})})})]})})}function is(i){let{giftRecipient:t,onClose:e,transitionState:n,analyticsLocations:l,analyticsLocation:a,analyticsObject:o,giftMessage:r,giftingOrigin:c=Q.vQ.DM_CHANNEL}=i;return(0,s.jsx)(x.CheckoutRootProvider,{activeSubscription:null,stepConfigs:[],skuIDs:Q.T7,isGift:!0,children:(0,s.jsx)(L.dX,{isGift:!0,giftRecipient:t,giftingOrigin:c,children:(0,s.jsx)(ie,{giftRecipient:t,onClose:e,transitionState:n,analyticsLocations:l,analyticsLocation:a,analyticsObject:o,giftMessage:r,giftingOrigin:c})})})}}