1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8547],{85881:function(e,t,n){n.d(t,{m:function(){return r}});var l=n(71100),o=n(72430);function r(e){let{enabled:t=!0,limit:n=18}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{start:r,end:a,setDateRange:i}=(0,o.w_)(),u=(0,l.useRef)(!1);(0,l.useEffect)(()=>{if(u.current||!t||r||a||e.length<=n)return;let l=e[e.length-n],o=e[e.length-1];l&&o&&(u.current=!0,i(l,o))},[t,n,r,a,e,i])}},9302:function(e,t,n){n.d(t,{q:function(){return o}});var l=n(62498);function o(e){if(null==e)return"";let t=e.toString();return t.includes("Q")?(0,l.pg)(t)||t:(0,l.cX)(t)||t}},72464:function(e,t,n){n.d(t,{E7:function(){return o},lj:function(){return l}});let l=10;function o(e){let{isDarkMode:t,isMobile:n,valueFormatter:l,xLabelFormatter:o,skipSeriesIndices:r=[],headerSeriesIndex:a,headerLabel:i,headerFormatter:u,mobileOnlySeriesNames:s,mobileShowLastSeries:c}=e,d=s?new Set(s):null;return e=>{var s,f,m,h,g;let p,{series:v,seriesIndex:x,dataPointIndex:b,w:y}=e,M=function(e,t,n){var l,o,r,a,i,u,s;let c=null!==(a=null===(l=e.config)||void 0===l?void 0:l.series)&&void 0!==a?a:[],d=null!==(i=e.globals.seriesX)&&void 0!==i?i:[],f=[..."number"==typeof n?[n]:[],...Array.from({length:Math.max(c.length,d.length)},(e,t)=>t)].filter((e,t,n)=>n.indexOf(e)===t).map(e=>(function(e,t,n,l){var o,r,a;let i=null===(r=e[n])||void 0===r?void 0:null===(o=r.data)||void 0===o?void 0:o[l];if(i&&"object"==typeof i&&null!=i.x)return i.x;let u=null===(a=t[n])||void 0===a?void 0:a[l];return null!=u?u:null})(c,d,e,t)).find(e=>null!=e);if(null!=f)return function(e){if("number"==typeof e&&Number.isFinite(e)){let t=Math.round(e);return 1e-6>Math.abs(e-t)?String(t):String(e)}return String(e)}(f);let m=null!==(s=null!==(u=null===(o=e.globals.categoryLabels)||void 0===o?void 0:o[t])&&void 0!==u?u:null===(r=e.globals.labels)||void 0===r?void 0:r[t])&&void 0!==s?s:"";return null==m?"":String(m)}(y,b,x),A=o?o(M):M,S=null!==(s=y.globals.colors)&&void 0!==s?s:[],w=null!==(f=y.globals.seriesNames)&&void 0!==f?f:[],R=new Set(r);void 0!==a&&R.add(a);let k=null;if(void 0!==a&&i){let e=null===(m=v[a])||void 0===m?void 0:m[b];null==e||Number.isNaN(e)||(k={label:i,value:(null!=u?u:l)(e),color:null!==(h=S[a])&&void 0!==h?h:"#888"})}if(n&&c){for(let e=v.length-1;e>=0;e-=1)if(!R.has(e)){let t=null===(g=v[e])||void 0===g?void 0:g[b];if(null!=t&&!Number.isNaN(t)){p=e;break}}}return function(e){let{title:t,items:n,isDarkMode:l,isMobile:o,valueFormatter:r,headerRow:a}=e,i=l?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.1)",u=1;!o&&(n.length>20?u=3:n.length>8&&(u=2));let s=a?'<div style="display:flex;align-items:center;gap:6px;padding-bottom:4px;border-bottom:1px solid '.concat(i,';margin-bottom:4px;">\n <span style="width:8px;height:8px;border-radius:2px;background:').concat(a.color,';flex-shrink:0;"></span>\n <span>').concat(a.label,'</span>\n <span style="font-weight:600;margin-left:auto;">').concat(a.value,"</span>\n </div>"):"",c=n.map(e=>'<div style="display:flex;align-items:center;gap:6px;white-space:nowrap;">\n <span style="width:8px;height:8px;border-radius:2px;background:'.concat(e.color,';flex-shrink:0;"></span>\n <span>').concat(e.name,':</span>\n <span style="font-weight:600;margin-left:auto;">').concat(r(e.value),"</span>\n </div>")).join("");return'<div style="padding:8px 12px;background:'.concat(l?"#1a1a2e":"#ffffff",";border-radius:6px;color:").concat(l?"#e5e5e5":"#1a1a2e",";font-family:Geist,sans-serif;font-size:12px;line-height:1.6;box-shadow:").concat(l?"none":"0 2px 8px rgba(0,0,0,0.15)",";max-height:").concat(o?"200px":"400px",';overflow-y:auto;">\n <div style="font-weight:600;padding-bottom:4px;border-bottom:1px solid ').concat(i,';margin-bottom:4px;">').concat(t,"</div>\n ").concat(s,'\n <div style="display:grid;grid-template-columns:repeat(').concat(u,',auto);gap:2px 16px;">\n ').concat(c,"\n </div>\n </div>")}({title:A,items:v.reduce((e,t,l)=>{var o;if(R.has(l))return e;let r=null!==(o=w[l])&&void 0!==o?o:"";if(n&&d&&!d.has(r)||n&&c&&l!==p)return e;let a=null==t?void 0:t[b];return null==a||Number.isNaN(a)||e.push({name:r,value:a,color:S.length>0?S[l%S.length]:"#888"}),e},[]),isDarkMode:t,isMobile:n,valueFormatter:l,headerRow:k})}}},48547:function(e,t,n){n.r(t),n.d(t,{default:function(){return b}});var l=n(44825),o=n(87961),r=n(20785),a=n(7195),i=n(97148),u=n(46138),s=n(32900),c=n(24917),d=n(79477),f=n(71100),m=n(91630),h=n(72430),g=n(94439),p=n(79634),v=n(51701),x=n(72464);function b(e){let{metric:t,userType:n,freq:b,showAverage:y=!0,hideTitle:M=!1}=e,{isDarkMode:A}=(0,i._)(),{start:S,end:w}=(0,h.w_)(),{isMobile:R}=(0,u.Sj)(),[k,N]=(0,f.useState)(0),{cohorts:j,isLoading:C,metricAvailable:D,effectiveUserType:P,effectiveFreq:E,allCohortDates:F,groupedAmount:L,groupedLogoRetention:O,hasAmountRetentionData:_}=(0,v.h)({metric:t,userType:n,freq:b}),q=(0,f.useMemo)(()=>F.filter(e=>(0,g.ZQ)(e,S,w)),[F,S,w]),Q=(0,f.useMemo)(()=>{let e=new Set;return q.forEach(t=>{[L,O].forEach(n=>{var l;Object.entries(null!==(l=n[t])&&void 0!==l?l:{}
1).forEach(t=>{let[n,l]=t;"number"==typeof l&&e.add(Number(n))})})}),Array.from(e).sort((e,t)=>e-t)},[q,L,O]),{logoSeries:Z,revenueSeries:T}=(0,f.useMemo)(()=>{if(!q.length)return{logoSeries:[],revenueSeries:[]};let e=e=>{let t=q.map((t,n)=>{var l;let o=null!==(l=e[t])&&void 0!==l?l:{};return{name:(0,m.q9)(t),data:Q.map(e=>{var t;return{x:e,y:null!==(t=o[e])&&void 0!==t?t:null}}),color:c.lO[n%c.lO.length]}});if(y){let n=Q.map(t=>{let n=q.map(n=>{var l;return null===(l=e[n])||void 0===l?void 0:l[t]}).filter(e=>"number"==typeof e);return{x:t,y:n.length>0?n.reduce((e,t)=>e+t,0)/n.length:null}});t.push({name:"Average",data:n,color:A?a.CO[12]:a.jK[12],dashStyle:o.g6.DASH})}return t};return{logoSeries:e(O),revenueSeries:e(L)}},[q,Q,O,L,y,A]),X=(0,f.useMemo)(()=>(0,m.q$)(Z),[Z]),$=(0,f.useMemo)(()=>(0,m.q$)(T),[T]),z=(0,f.useCallback)(e=>{let t="string"==typeof e?parseFloat(e):e;return"".concat(t.toFixed(0))},[]),B=(0,f.useMemo)(()=>(0,m.DM)(Q),[Q]),H=1===k?T:Z,U=!(H.length>x.lj)&&(!R||H.length<20),G=(0,s._N)(P,!0),K=(0,f.useCallback)(e=>"".concat((100*e).toFixed(1),"%"),[]),Y=(0,f.useMemo)(()=>(0,x.E7)({isDarkMode:A,isMobile:R,valueFormatter:K,xLabelFormatter:e=>"Period ".concat(e),mobileOnlySeriesNames:["Average"]}),[A,R,K]);if(!D)return(0,l.jsx)(d.Z,{title:"Retention data is not available for this user type."});if(!C&&!(null==j?void 0:j.length))return(0,l.jsx)(d.Z,{compact:!0});let I=e=>{var t,n;return(0,l.jsx)(o.ZP,{width:"100%",height:p.d4,series:e.series,title:M?void 0:e.title,isLoading:C,xAxis:{title:"Q"===E?"Age (quarters)":"Age (months)",formatter:z,titleOffsetY:8,min:B.min,max:B.max,tickAmount:B.tickAmount},yAxis:{title:"Retention (%)",formatter:m.aR,min:null!==(t=e.yMin)&&void 0!==t?t:0,max:null!==(n=e.yMax)&&void 0!==n?n:1,tickAmount:5},tooltip:{enabled:!0,shared:!0,custom:Y,yFormatter:m.aR},legend:{enabled:U,horizontalAlign:"center"},style:{stacked:!1,animated:!1}})};return _?(0,l.jsxs)(r.mQ,{value:k,onTabChange:N,children:[(0,l.jsxs)(r.dr,{isMobile:R,children:[(0,l.jsx)(r.SP,{value:0,label:"Logo retention"}),(0,l.jsx)(r.SP,{value:1,label:"Amount retention",disabled:!_})]}),(0,l.jsx)(r.nU,{value:0,children:I({series:Z,title:"".concat(G," Logo Retention Plot"),yMin:X.min})}),(0,l.jsx)(r.nU,{value:1,children:I({series:T,title:"".concat(G," Revenue Retention Plot"),yMin:$.min,yMax:$.max})})]}):I({series:Z,title:"".concat(G," Logo Retention Plot"),yMin:X.min})}},91630:function(e,t,n){n.d(t,{DM:function(){return c},aR:function(){return u},q$:function(){return s},q9:function(){return a.q},tP:function(){return i}});var l=n(87961),o=n(22877),r=n.n(o),a=n(9302);function i(e,t,n){return Object.entries(r()(e,"cohort")).sort((e,t)=>{let[n]=e,[l]=t;return l.localeCompare(n)}).map(e=>{let[o,r]=e,a=r.filter(e=>null!=e[t]).map(e=>{var n,l;return{x:null!==(n=e.period)&&void 0!==n?n:0,y:null!==(l=e[t])&&void 0!==l?l:null}});return a.length?{name:o,type:l.oX.HEATMAP,color:n,data:a}:null}).filter(e=>null!==e)}function u(e){return"".concat((100*e).toFixed(0),"%")}function s(e){let t=e.flatMap(e=>e.data.filter(e=>"number"!=typeof e).map(e=>e.y).filter(e=>"number"==typeof e));if(0===t.length)return{min:0,max:1};let n=Math.max(...t);return{min:Math.max(0,Math.floor((Math.min(...t)-.05)*10)/10),max:n<=1?1:Math.ceil(10*n+1)/10}}function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12,n=e.length?Math.max(...e):0;if(n<=0)return{min:0,max:6,tickAmount:6};let l=6*Math.ceil(n/6);return{min:0,max:l,tickAmount:Math.max(1,Math.round(l/Math.max(1,Math.ceil(l/t))))}}},51701:function(e,t,n){n.d(t,{h:function(){return m}});var l=n(47126),o=n(7439),r=n(58943),a=n(72952),i=n(78324),u=n(71100),s=n(52799),c=n(72430),d=n(85881);let f={allCohortDates:[],allPeriods:[],groupedAmount:{},groupedLogoRetention:{},hasAmountRetentionData:!1,hasLogoRetentionData:!1};function m(e){var t;let{metric:n,userType:m,freq:h}=e,{teamId:g,dealId:p}=(0,o.l)(),v=(0,r.v9)(i.Z5),x=(0,r.v9)(i.kA),b=null!==(t=null!=m?m:x)&&void 0!==t?t:s.F.Business,y=null!=n?n:"revenue",M="Q"===h?"Q":"M",[A,S]=(0,u.useState)(null),[w,R]=(0,u.useState)(!0),k=(0,u.useMemo)(()=>(null!=v?v:[]).some(e=>e.userType===b&&e.metric===y),[v,b,y]);(0,u.useEffect)(()=>
1{if(!k||!g||!p){S(null),R(!1);return}let e=new AbortController;return R(!0),l.P.getProductCohortRevenueDataByDeal(Number(g),Number(p),b,y,M,(0,a.Q_)()).then(t=>{e.signal.aborted||(S(null!=t?t:null),R(!1))}).catch(()=>{e.signal.aborted||(S(null),R(!1))}),()=>e.abort()},[g,p,b,y,M,k]);let N=(0,u.useMemo)(()=>{if(!(null==A?void 0:A.length))return f;let e=new Set,t=new Set,n={},l={},o=!1,r=!1;return A.forEach(a=>{e.add(a.cohort),t.add(a.period),n[a.cohort]||(n[a.cohort]={}),l[a.cohort]||(l[a.cohort]={}),"number"==typeof a.amountRetention?(n[a.cohort][a.period]=a.amountRetention,o=!0):n[a.cohort][a.period]=null,"number"==typeof a.logoRetention?(l[a.cohort][a.period]=a.logoRetention,r=!0):l[a.cohort][a.period]=null}),{allCohortDates:Array.from(e).sort((e,t)=>e.localeCompare(t)),allPeriods:Array.from(t).sort((e,t)=>e-t),groupedAmount:n,groupedLogoRetention:l,hasAmountRetentionData:o,hasLogoRetentionData:r}},[A]);return(0,c.xO)(N.allCohortDates),(0,d.m)(N.allCohortDates,{enabled:!w&&N.allCohortDates.length>0}),{cohorts:A,isLoading:w,metricAvailable:k,effectiveUserType:b,effectiveMetric:y,effectiveFreq:M,...N}}}}]); 2//# sourceMappingURL=8547.8bba10fd5a21dd37.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.