2 lines
8.5 KiB
JavaScript
2 lines
8.5 KiB
JavaScript
"use strict";(self.webpackChunklite=self.webpackChunklite||[]).push([[7975],{57975:(e,t,n)=>{n.d(t,{W:()=>W});var i=n(64467),a=n(96540),o=n(69733),l=n(74346),r=n(26557),s=n(22213),u=n(69650),d=n(12600),c=n(72541),p=n(11828),m=n(80182),v=n(80074),f=n(27721),b=n(1722),k=n(19228),g=n(43634),h=n(72130),C=n(49287),S=n(56743),y=n(39160),w=n(51771),O=n(46879),E=n(1491),N=n(32318),F=n(80045),P=n(65364),j=n(14281),D=n(1037),I=n(22541),V=n(54654),x=n(45458),L=n(52897),T=n(68037),A={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"PostVotersDialogQuery"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"postId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pagingOptions"}},type:{kind:"NamedType",name:{kind:"Name",value:"PagingOptions"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"post"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"postId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"clapCount"}},{kind:"Field",name:{kind:"Name",value:"voterCount"}},{kind:"Field",name:{kind:"Name",value:"voters"},arguments:[{kind:"Argument",name:{kind:"Name",value:"paging"},value:{kind:"Variable",name:{kind:"Name",value:"pagingOptions"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"items"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"FragmentSpread",name:{kind:"Name",value:"UserFollowButton_user"}},{kind:"FragmentSpread",name:{kind:"Name",value:"UserInListDialog_user"}}]}},{kind:"Field",name:{kind:"Name",value:"clapCount"}}]}},{kind:"Field",name:{kind:"Name",value:"pagingInfo"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"next"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"page"}}]}}]}}]}},{kind:"FragmentSpread",name:{kind:"Name",value:"UserFollowButton_post"}}]}}]}}].concat((0,x.A)(L.l.definitions),(0,x.A)(T.x.definitions),(0,x.A)(L.c.definitions))},H=["__typename"];function _(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function B(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_(Object(n),!0).forEach((function(t){(0,i.A)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var R=10,U=function(e){var t=e.post,n=e.hide,i=e.isVisible,o=e.fetchMore,l=e.loading;if(!t)return null;var r=t.title,s=t.voters,u=t.clapCount,d=t.voterCount;return a.createElement(D.X,{isVisible:i,fetchMore:o,loading:l,hide:n,title:r,clapCount:null!=u?u:0,voterCount:null!=d?d:0,voters:s?s.items.map((function(e,n){var i=e.user,o=e.clapCount;return i&&a.createElement(C.Ne,{source:{name:"post_clappers",postId:t.id,index:n}},a.createElement(j.B,{user:i,key:i.id,followButton:a.createElement(V.P,{buttonSize:"SMALL",post:t,user:i,susiEntry:"follow_list",trackingV2:!0}),badge:a.createElement(I._,{clapCount:o}),trackingV2:!0}))})):null})};function M(e){var t=e.postId,n=e.isVisible,i=e.hide;return n?a.createElement(P.X,{ssr:!1,query:A,variables:{postId:t,pagingOptions:{limit:R}},notifyOnNetworkStatusChange:!0},(function(e){var t,o=e.data,l=(o=void 0===o?{}:o).post,r=e.loading,s=e.error,u=e.fetchMore;if(s||null==l||!l.voters)return null;var d=l.voters.pagingInfo&&l.voters.pagingInfo.next;if(d){d.__typename;var c=(0,F.A)(d,H);t=function(){return u({variables:{pagingOptions:B(B({},c),{},{limit:R})}})}}return a.createElement(U,{hide:i,fetchMore:t,post:l,isVisible:n,loading:r})})):null}var q=n(5600),X=n(85864);function z(e){var t=e.clapCount,n=e.hasLabel,i=void 0!==n&&n,o=e.showFullNumber,l=void 0!==o&&o,r=e.post,s=e.hasDialog,u=void 0!==s&&s,d=e.shouldShowResponsiveLabelText,c=void 0!==d&&d,p=e.shouldHideClapsText,m=void 0!==p&&p,v=e.countColor,f=e.countScale,b=e.isLoading,k=void 0!==b&&b,g=r.id;if(!(t>0||k))return null;var h=function(e){var n=e.showVoters;return a.createElement(N.q,{showVoters:n,hasLabel:i,showFullNumber:l,shouldShowResponsiveLabelText:c,shouldHideClapsText:m,clapCount:t,countColor:v,countScale:f,isLoading:k})};return u&&g&&!k?a.createElement(X.B,null,(function(e){var t=e.isVisible,n=e.show,i=e.hide;return a.createElement(a.Fragment,null,a.createElement(q.G,{tooltipText:"View Claps",targetDistance:15},a.createElement(h,{showVoters:n})),t&&a.createElement(M,{isVisible:!0,hide:i,postId:g}))})):a.createElement(h,null)}var Y=n(11517);function G(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function K(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?G(Object(n),!0).forEach((function(t){(0,i.A)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):G(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Q=function(e){var t,n=e.post,i=e.buttonStyle,N=e.hasDialog,F=e.shouldShowResponsiveLabelText,P=void 0!==F&&F,j=e.shouldHideClapsText,D=void 0!==j&&j,I=e.shouldHideClapsCount,V=void 0!==I&&I,x=e.susiEntry,L=e.verticalClapsText,T=void 0!==L&&L,A=e.buttonColor,H=e.countScale,_=e.testId,B=(0,Y.N)({post:n}),R=B.clapCount,U=B.clapCountLoading,M=K(K({},n),{},{clapCount:R}),q=(0,E.f)(),X=(0,f.R)(),G=X.value,Q=X.loading,W=null!==(t=null==G?void 0:G.id)&&void 0!==t?t:"",$=(0,b.h)(n).viewerEdge,J=(0,y.d4)((function(e){return e.config.authDomain})),Z=(0,y.Dy)((function(e){return e.multiVote.clapsPerPost})),ee=(0,o.wA)(),te=(0,h.$L)(),ne=(0,C.jI)(),ie=(0,w.F)(Z,M,$),ae=ie.clapCount,oe=ie.viewerClapCount,le=ie.viewerHasClappedSinceFetch,re=(0,a.useCallback)((function(){if(oe&&oe>=m.et)return"Viewer exceeded authorized claps limit.";var e;e={postId:n.id,clapCount:ae+1,viewerClapCount:oe+1,viewerHasClappedSinceFetch:!0},ee((0,S.K7)(e))}),[oe,n.id,ae]),se=(0,a.useCallback)((function(e){q(M,W,e,$),te.event("post.clientUpvote",{postId:n.id,postIds:[n.id],voteCount:e,source:ne})}),[n.id,W,$,ne]),ue=(0,v.s)({onIncrementClaps:re,onSubmitClapsAccumulated:se}),de=ue.clappedAt,ce=ue.onFloatEnd,pe=ue.removeBurst,me=ue.clap,ve=ue.isPopping,fe=ue.isShowingViewerClapCount,be=ue.burstOffsets,ke=ue.onPopEnd;(0,a.useEffect)((function(){return function(){var e;e={postId:n.id},ee((0,S.dy)(e))}}),[]);var ge,he=n.collection,Ce=n.creator,Se=n.id,ye=n.isPublished,we=n.isLimitedState,Oe=(ge=!(!Ce||Ce.id!==W),we?"This feature is temporarily disabled":ye?ge?"You cannot applaud your own story":void 0:"You cannot applaud a draft"),Ee=(0,m.vP)(i,P),Ne=Ee.alwaysShowClapsLabel,Fe=Ee.hasClapsLabel,Pe=Ee.buttonScale,je=!!(oe&&oe>0),De=!!(ae&&ae>0),Ie=he&&he.slug?(0,O.jXU)(J,he.slug,Se):(0,O.A4e)(J,Se);return a.createElement(s.R,{verticalClapsText:T},a.createElement(d.O,{buttonStyle:i,hasClaps:De||U},W||Oe?a.createElement(a.Fragment,null,fe&&a.createElement(k.Cq,null,a.createElement(u.u,{count:oe,clappedAt:de,onFloatEnd:ce})),a.createElement(p.s,{isPopping:ve,onPopEnd:ke},a.createElement(r.g,{buttonColor:A,disableReason:Oe,isFilled:je,isLoading:Q||U,onClickAndHold:me,scale:Pe,shouldHideClapsText:D,testId:_})),be.map((function(e){return a.createElement(l.S,{key:e,offset:e,onBurstEnd:pe})}))):a.createElement(g.r,{operation:"register",post:n,user:n.creator||void 0,actionUrl:Ie,susiEntry:x,testId:_},a.createElement(r.g,{scale:Pe,buttonColor:A,shouldHideClapsText:D,testId:_}))),(De||U)&&!V&&(!fe||Ne)&&a.createElement(c.T,{buttonStyle:i},a.createElement(z,{post:n,clapCount:ae,showFullNumber:le,hasLabel:Fe,hasDialog:N,shouldShowResponsiveLabelText:P,shouldHideClapsText:D,countColor:A,countScale:H,isLoading:U})))},W=function(e){var t;return a.createElement(C.Ne,{source:{postId:null===(t=e.post)||void 0===t?void 0:t.id},extendSource:!0},a.createElement(Q,e))}}}]);
|
|
//# sourceMappingURL=https://stats.medium.build/lite/sourcemaps/7975.d195c6f1.chunk.js.map
|