Build 555975stable
Module 336618
3,270 characters · in 9435c5e9ec49f2a3.jsDependencies
Source Raw
function(e,t,n){n.d(t,{A:()=>U});var l=n(627968),i=n(64700),a=n(503698),r=n.n(a),o=n(877624),s=n(17928),c=n(554146),u=n(533781),d=n(604121),C=n(597770),A=n(793574),g=n(688810),f=n(131607),N=n(380619),m=n(751188),T=n(40493),p=n(374200),_=n(186111),I=n(287809),h=n(927813),b=n(935208),R=n(240248),O=n(427262),M=n(743477),E=n(767089),v=n(652215),k=n(49999),j=n(375708),x=n(849353),y=n(266599);function G(e){let t=i.useCallback(()=>Promise.resolve({default:e.boxAnimationUrl}),[e.boxAnimationUrl]);return(0,l.jsx)(E.A,{className:y.x6,"aria-label":j.intl.string(j.t.Z1RnTk),isActive:!1,noHover:!0,onClick:e.onClick,children:(0,l.jsx)("div",{className:x.zc,children:e.hovered?(0,l.jsx)(d.a,{className:x.Hl,importData:t}):(0,l.jsx)(C.o,{})})})}function L(e){let{Component:t,events:n,play:i}=(0,u.T)();return(0,l.jsxs)(E.A,{className:y.x6,"aria-label":j.intl.string(j.t.Z1RnTk),isActive:!1,noHover:!0,onClick:()=>{i(),e.onClick?.()},...n,children:[(0,l.jsx)("div",{className:x.zc,children:(0,l.jsx)(t,{className:x.is,color:"currentColor"})}),e.hovered&&(0,l.jsx)("img",{className:x.rY,src:e.trinketAnimationUrl,alt:""})]})}let P=h.A.Millis.DAYS_30,U=i.memo(function(e){let{disabled:t,channel:n}=e,{analyticsLocations:a}=(0,g.Ay)(A.A.GIFT_BUTTON),[u,d]=i.useState(!1),C=(0,s.bG)([_.A],()=>!_.A?.hasLayers()),h=(0,s.bG)([I.default],()=>I.default.getCurrentUser()),E=null!=h?b.default.age(h.id):0,j=(0,s.bG)([p.A],()=>{let e=p.A.getMarketingComponentByType(o.C.GIFT_ICON);return null==e||"giftIcon"!==e.properties.properties.oneofKind?null:e.properties.properties.giftIcon}),y=(0,s.bG)([p.A],()=>{let e=p.A.getMarketingComponentByType(o.C.GIFT_ICON_COACHMARK);return null==e||"giftIconCoachmark"!==e.properties.properties.oneofKind?null:e.properties.properties.giftIconCoachmark}),U=j?.gradient,B=null!=U&&null!=U.colors&&U.colors.length>=2?(0,N.K5)({gradient:U.colors,angle:U.angle??void 0},{defaultAngle:180}):void 0,D=i.useMemo(()=>{if(B?.background!=null)return{"--custom-promotion-gradient":B.background}},[B]),S=!(0,R.uJ)(j?.boxAnimationUrl),F=!(0,R.uJ)(j?.trinketAnimationUrl)&&!S,w=(0,s.bG)([p.A],()=>p.A.getGiftPromotion()?.id),H=null!=y&&!t&&C&&E>=P&&null!=w,[K,Z]=(0,f.Cc)(H?c.M.GIFTING_PROMOTION_DESKTOP_FIRST_TIME_COACHMARK:null,w??""),$=null!=K,z=u||$,J=(0,O.R1)(n),{openGiftModal:V}=(0,m.$)({giftRecipient:J,analyticsLocations:a,analyticsObject:{page:n.isPrivate()?v.liQ.DM_CHANNEL:v.liQ.GUILD_CHANNEL,section:v.JJy.CHANNEL_TEXT_AREA,object:v.ZSU.GIFTING_PROMOTION_BUTTON,objectType:v.AnalyticsObjectTypes.GIFT},wishlistAnalyticsObject:{page:n.isPrivate()?v.liQ.DM_CHANNEL:v.liQ.GUILD_CHANNEL,section:v.JJy.CHANNEL_TEXT_AREA,object:v.ZSU.BUTTON_ICON,objectType:v.AnalyticsObjectTypes.GIFT},location:"gift-promotion-button"});if(t)return null;let Q=()=>{d(!1),Z(k.i.TAKE_ACTION),V()},W=S&&j?.boxAnimationUrl!=null?(0,l.jsx)(G,{boxAnimationUrl:j.boxAnimationUrl,hovered:z,onClick:Q}):F&&j?.trinketAnimationUrl!=null?(0,l.jsx)(L,{trinketAnimationUrl:j.trinketAnimationUrl,hovered:z,onClick:Q}):(0,l.jsx)(M.A,{disabled:t,channel:n});return(0,l.jsx)("div",{className:r()(x.kL,{[x.DM]:z}),style:D,onMouseEnter:()=>{u||d(!0)},onMouseLeave:()=>{d(!1)},children:$?(0,l.jsx)(T.A,{onComplete:()=>d(!1),onCheckItOutClick:V,markAsDismissed:Z,coachmarkConfig:y,children:W}):W})})}