PageSourceSearch

https://app.opus1.io/releases/20260925T143842Z-e1befdfb692b/async/14994.1725fcef.js

js opus1.io collected 2026-09-25 18:54:15 UTC 37,750 bytes, 2 lines download raw bytes

1!function(){try{var e="u">typeof window?window:"u">typeof global?global:"u">typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="144604b1-9a64-4d1d-9db8-50d10c4ecdaa",e._sentryDebugIdIdentifier="sentry-dbid-144604b1-9a64-4d1d-9db8-50d10c4ecdaa")}catch(e){}}();var _global="u">typeof window?window:"u">typeof global?global:"u">typeof self?self:{};_global.SENTRY_RELEASE={id:"e1befdfb692b28496829f71c2490b06d48ba02c9"};"use strict";(self.webpackChunkopus1io=self.webpackChunkopus1io||[]).push([["14994"],{92952:function(e,n,t){t.d(n,{Ay:function(){return ec},JG:function(){return el}});var i=t(71893),r=t(55456),a=t(84577);t(60726),t(93632),t(38827),t(61874),t(1633),t(9700);var o=t(74848),l=t(96540),s=t(17378),d=t(52956),c=t(56347),u=t(93300),f=t.n(u),p=t(20615),m=t(54713),h=t(50815),v=t(47344),x=t(97163),g=t(41374),b=t(78258),y=t(38566),j=t(60469),C=t(50926),w=t(507),S=t(7926),_=t(48810),A=t(6702);function R(){var e=(0,a._)(["\n    font-family: 'Montserrat', tahoma;\n    font-size: 14px;\n    color: "," !important;\n    cursor: ",";\n    font-weight: bold;\n    border: none;\n    background-color: transparent;\n"]);return R=function(){return e},e}function N(){var e=(0,a._)(["\n        flex: unset;\n        width: 100%;\n    "]);return N=function(){return e},e}function Y(){var e=(0,a._)(["\n    flex: 1;\n    ","\n"]);return Y=function(){return e},e}function O(){var e=(0,a._)(["\n        margin: auto;\n    "]);return O=function(){return e},e}function I(){var e=(0,a._)(["\n    ","\n"]);return I=function(){return e},e}function D(){var e=(0,a._)(["\n        flex: unset;\n    "]);return D=function(){return e},e}function k(){var e=(0,a._)(["\n    flex: 1;\n    ","\n"]);return k=function(){return e},e}function $(){var e=(0,a._)(["\n    mutation createConversation(\n        $business: String!\n        $locationId: ID\n        $phoneNumber: ID!\n    ) {\n        createConversation(\n            business: $business\n            locationId: $locationId\n            clientContactId: $phoneNumber\n        ) {\n            status\n            error\n            info\n            conversation {\n                clientContactId\n                applicationContactId\n                ...conversationListConversation\n            }\n        }\n    }\n    ","\n"]);return $=function(){return e},e}var T=(0,s.Ay)(j.A)(R(),e=>e.disabled?"#c2c2c2":S.pf,e=>!e.disabled&&"pointer"),M=(0,s.Ay)(w.LR)(Y(),p.$_.tablet(N())),E=s.Ay.div(I(),p.$_.tablet(O())),L=(0,s.Ay)(w.x3)(k(),p.$_.tablet(D())),F=(0,b.J1)($(),v.ee),P=t(23166),z=t(6335),G=t(66512),q=t(13990);function U(){var e=(0,a._)(["\n    display: flex;\n    box-shadow: -4px 3px 28px 4px rgb(235 232 235);\n\n    border-radius: 3px;\n    background-color: white;\n    height: 100%;\n\n    & > * {\n        overflow: hidden;\n    }\n"]);return U=function(){return e},e}function V(){var e=(0,a._)(["\n        max-width: 300px;\n    "]);return V=function(){return e},e}function J(){var e=(0,a._)(["\n        padding: 8px;\n        max-width: unset;\n\n        "," \n    "]);return J=function(){return e},e}function W(){var e=(0,a._)(["\n    max-width: 400px;\n    height: 100%;\n    width: 100%;\n\n    display: flex;\n    flex-direction: column;\n    border-right-style: solid;\n    border-right-width: 1px;\n    border-right-color: #dfdede;\n    padding: 15px;\n\n    ","\n\n    ","\n"]);return W=function(){return e},e}function B(){var e=(0,a._)(["\n        padding: 8px;\n\n        "," \n    "]);return B=function(){return e},e}function K(){var e=(0,a._)(["\n    height: 100%;\n    display: flex;\n    flex-direction: column;\n    width: 100%;\n    padding: 15px;\n\n    ","\n"]);return K=function(){return e},e}function H(){var e=(0,a._)(["\n        padding: 8px;\n\n        "," \n    "]);return H=function(){return e},e}function Q(){var e=(0,a._)(["\n    height: 100%;\n    display: flex;\n    flex-direction: column;\n    width: 100%;\n    padding: 15px;\n\n    ","\n"]);return Q=function(){return e},e}function X(){var e=(0,a._)(["\n        padding: 8px;\n\n        "," \n    "]);return X=function(){return e},e}function Z(){var e=(0,a._)(["\n    height: 100%;\n    display: flex;\n    flex-direction: column;
1\n    align-items: center;\n    justify-content: center;\n    width: 100%;\n    padding: 15px;\n\n    ","\n"]);return Z=function(){return e},e}function ee(){var e=(0,a._)(["\n    margin: auto;\n    margin-top: 200px;\n    width: 75%;\n"]);return ee=function(){return e},e}function en(){var e=(0,a._)(["\n    html {\n        height: 100%;\n    }\n\n    #container {\n        height: inherit;\n\n    }\n\n    .main {\n        height: unset;\n        max-height: 100vh;\n    }\n\n    "," {\n        display: none;\n        .widget-main-content {\n            display: none;\n        }\n        .widget-footer {\n            display: none;\n            padding-top: 0px !important;\n        }\n    }\n"]);return en=function(){return e},e}var et=s.Ay.div(U()),ei=(0,s.Ay)(v.Ay)(W(),p.$_.tabletLg(V()),p.$_.tabletMd(J(),e=>"conversation_selection"!==e.mobileStep?"display: none;":"border: none;")),er=(0,s.Ay)(x.Ay)(K(),p.$_.tabletMd(B(),e=>"conversation_selection"===e.mobileStep?"display: none;":"")),ea=(0,s.Ay)(e=>{var{className:n}=e,t=(0,d.useSelector)(e=>e.app.business.name),i=(0,d.useSelector)(e=>e.app.selectedSmsNumbers)[0],r=(0,l.useContext)(h.i),{newConversation:a}=(0,l.useContext)(h.I),[s,c]=(0,l.useState)(""),[u,f]=(0,l.useState)(null),[p,{loading:m}]=(0,y.A)(F,{successMessage:null,failureMessage:"Failed to create conversation",processor:e=>e.data.createConversation}),v=(0,l.useCallback)(()=>(0,g._)(function*(){try{var{info:e,conversation:n}=yield p({variables:{business:t,locationId:(null==i?void 0:i.type)==="location"?i.id:void 0,phoneNumber:a||s||u.primaryPhone},update:(e,n)=>{"ok"!==n.data.createConversation.status||n.data.createConversation.info||(e.evict({id:"ROOT_QUERY",fieldName:"paginatedConversations"}),e.gc())}});e||(0,_.VX)({title:"New conversation started..."}),r({type:"NEW_CONVERSATION",payload:n.clientContactId})}catch(e){(0,C.Fk)(e)}})(),[t,a,r,s,u,p]),x=s&&u||!(s||u);return(0,o.jsxs)("div",{className:n,children:[(0,o.jsx)(w.db,{title:"Start a conversation",subtitle:i?"".concat(i.name," (").concat((0,A.n4)(i.number),")"):void 0,onBack:()=>r({type:"GO_TO_CONVERSATIONS"}),orientation:"row"}),(0,o.jsxs)("div",{className:"d-flex flex-row justify-content-between flex-wrap mb-1",children:[(0,o.jsx)(M,{value:s,placeholder:"Enter a phone number (with international code e.g. +1)",onChange:e=>{f(null),c(e)}}),(0,o.jsx)(E,{className:"p-2",children:"OR"}),(0,o.jsx)(L,{isClearable:!0,placeholder:"Search for client...",value:u,isOptionDisabled:e=>!e.primaryPhone,onChange:e=>{c(null),f(e)}})]}),(0,o.jsx)(T,{className:"p-2 align-self-end",loading:m,onClick:v,disabled:x,disabledReason:"client or phone number is required, not both",children:"Start"})]})})(Q(),p.$_.tabletMd(H(),e=>"new_conversation"!==e.mobileStep?"display: none;":"")),eo=(0,s.Ay)(e=>{var{className:n}=e;return(0,o.jsx)("div",{className:n,children:(0,o.jsx)(z._,{children:"Select a conversation to view message history"})})})(Z(),p.$_.tabletMd(X(),e=>"conversation_selection"===e.mobileStep?"display: none;":"")),el=(0,s.Ay)(P.A)(ee()),es=(0,s.DU)(en(),m.c),ed=(e,n)=>{switch(n.type){case"SELECT_CONVERSATION":return(0,r._)((0,i._)({},e),{mobileStep:n.payload?"conversation_view":"conversation_selection",selectedConversation:n.payload,newConversation:void 0,initialConversation:void 0});case"NEW_CONVERSATION":return(0,r._)((0,i._)({},e),{mobileStep:"new_conversation",selectedConversation:void 0,initialConversation:n.payload});case"CREATE_CONVERSATION":return(0,r._)((0,i._)({},e),{mobileStep:"conversation_view",selectedConversation:n.payload});case"GO_TO_CONVERSATIONS":return(0,r._)((0,i._)({},e),{mobileStep:"conversation_selection"});case"CREATE_CLIENT_FROM_CONVERSATION":return(0,i._)({},e);default:return e}},ec=()=>{var e,n=(0,c.zy)();n.search&&(e=new URLSearchParams(n.search).get("clientContactId"));var t=(0,d.useSelector)(e=>e.app.business.activeConversations),[i,r]=(0,l.useReducer)(ed,{mobileStep:"conversation_selection",initialConversation:e}),a=(0,d.useSelector)(e=>e.app.business.smsFeatureEnabled);return((0,G.A)("Messaging (".concat(t,")")),(0,l.useEffect)(()=>{e&&window.history.replaceState(null,null,"/messaging")},[e]),(0,l.useEffect)(()=>(f().startPooledTimer(),()=>f().clearPooledTimer()),[]),a)?(0,o.jsx)(h.i.Provider,{value:r,children:(0,o.jsx)(h.I.Provider,{value:i,children:(0,o.jsxs)(et,{children:[(0,o.jsx)(es,{}),(0,o.jsx)(ei,{mobileStep:i.mobileStep}),"new_conversation"!==i.mobileStep&&!i.selectedConversation&&(0,o.jsx)(eo,{mobileStep:i.mobileStep}),"new_conversation"!==i.mobileStep&&i.selectedConversation&&(0,o.jsx)(er,{mobileStep:i.mobileStep}),"new_conversation"===i.mobileStep&&(0,o.jsx)(ea,{mobileStep:i.mobileStep})]})})}):(0,o.jsx)(q.O,{})}},51081:function(e,n,t){t.d(n,{Fv:function(){return v},KK:function(){return m},N$:function(){return p},_:function(){return h}});var i=t(71893),r=t(55456);t(45336),t(23446),t(82963),t(84560),t(60726),t(13467),t(76449);var a=t(74848);t(96540);var o=t(84941),l=t(24930),s=t(17535),d=t(8756),c=t(36596),u=t(53894),f=t(61963),p="invalid",m="no_items",h="loading",v="done_loading";n.Ay=e=>{var n,{title:t,reportName:x,isOpen:g,onClosed:b=()=>{},cleanupDataFn:y=e=>e.replace(/\\|\n|\r|,|"|'|  +/g,""),toggle:j,status:C,headers:w,items:S=[],invalidStatusMessage:_,children:A}=e,R=(0,u.A)();return C===v&&(n=S.map(e=>Object.keys(e).reduce((n,t)=>{var a=e[t];if("string"==typeof a){var o=a.replace(/"/g,'""'),l=y&&"function"==typeof y?y(o):o;return(0,r._)((0,i._)({},n),{[t]:l})}return(0,r._)((0,i._)({},n),{[t]:a})},{}))),(0,a.jsxs)(c.A,{centered:!0,isOpen:g,onClosed:b,toggle:j,modalName:"".concat(x,"-csv-export"),wrapClassName:"modal-primary modal-fit-content",size:"lg",children:[(0,a.jsx)(l.A,{toggle:j,children:t}),(0,a.jsxs)(s.A,{children:[C===p&&(0,a.jsx)("p",{className:"text-danger",children:_||"Requested time period must be no more than 12 months, please update your filters and try again"}),C===m&&(0,a.jsx)("p",{className:"text-danger",children:"No items found, please update your filters and try again"}),C===h&&(0,a.jsxs)("p",{className:"d-flex flex-column align-items-center",children:[(0,a.jsx)(f.A,{}),"".concat((S||[]).length," items loaded")]}),C===v&&(0,a.jsx)("p",{children:"Successfully loaded ".concat((S||[]).length," items")}),A]}),C===v&&(0,a.jsx)(d.A,{children:(0,a.jsx)(o.CSVLink,{id:"download-".concat(x,"-csv"),className:"btn btn-primary btn-rounded",filename:"".concat(x,"_report_").concat(R().format("LLL z").replaceAll(" ","_"),".csv"),headers:w,data:n,enclosingCharacter:'"',children:"Download CSV"})})]})}},7321:function(e,n,t){t.r(n),t.d(n,{default:function(){return eG}});var i=t(71893),r=t(55456),a=t(84577);t(93632),t(42273),t(45336),t(23446),t(69861);var o=t(74848),l=t(96540),s=t(52956),d=t(54625),c=t(95093),u=t.n(c),f=t(17378),p=t(76204),m=t(50541),h=t(2404),v=t.n(h),x=t(82847),g=t(65596),b=t(50163),y=t(53199),j=t(60597),C=t(57900),w=t(69530),S=t(59373),_=t(84678),A=t(99294),R=t(60469),N=t(70537),Y=t(50926),O=t(89511),I=t(48810),D=t(42479),k=t(70990),$=t(79493),T=t(59769),M=t(92739),E=t(15257),L=t(27045),F=t(86095),P=t(3104),z=t(92952);t(5409),t(60726);var G=t(5556),q=t.n(G),U=t(51081),V=t(50613);t(79936),t(82963),t(84560),t(5127),t(65857),t(33676),t(97857),t(4810),t(60865),t(3101),t(39112),t(75516),t(2070),t(96030),t(92167),t(47786),t(19808),t(56059),t(78736),t(68121),t(79389),t(75927),t(72859),t(15441),t(16028),t(3182);
1var J=(e,n)=>{var t=e.filter(e=>e.staff.id===n);if(!t.length)return null;var i=[];if(t.forEach(e=>{var n,t,r=(null==(n=e.allClients)?void 0:n.length)||0,a=(null==(t=e.lostClients)?void 0:t.length)||0;r>=1&&i.push(a/r)}),!i.length)return null;var r=i.reduce((e,n)=>e+n,0)/i.length;return r<.0083?null:1/r},W=e=>{var n=[...new Set(e.map(e=>e.staff.id))].map(n=>J(e,n)).filter(e=>null!==e);return n.length?n.reduce((e,n)=>e+n,0)/n.length:null},B=e=>null==e?"N/A":"".concat(e.toFixed(1)," mo"),K=(e,n)=>null===e||null===n?null:e>=n?"Top":e>=.8*n?"Mid":"Low";function H(){var e=(0,a._)(["\n    query clientRetentionReport(\n        $business: ID!\n        $staffIds: [ID]\n        $timezone: String!\n        $fromDate: DateTime!\n        $toDate: DateTime!\n        $includeCancelled: Boolean\n        $sessionOnly: Boolean\n        $appointmentOnly: Boolean\n    ) {\n        clientRetentionReport(\n            business: $business\n            staffIds: $staffIds\n            timezone: $timezone\n            fromDate: $fromDate\n            toDate: $toDate\n            includeCancelled: $includeCancelled\n            sessionOnly: $sessionOnly\n            appointmentOnly: $appointmentOnly\n        ) {\n            status\n            error\n            complete\n            clientRetentionItems {\n                date\n                clientRetentionRate\n                staff {\n                    id\n                    name\n                    profilePhoto\n                    staffSecondaryAttribute\n                }
1\n                allClients {\n                    id\n                    name\n                    profilePhoto\n                    status\n                }\n                gainedClients {\n                    id\n                    name\n                    profilePhoto\n                    status\n                }\n                lostClients {\n                    id\n                    name\n                    profilePhoto\n                    status\n                }\n                gainedSubscriptions {\n                    id\n                    endAt\n                    plan {\n                        name\n                    }\n                }\n                lostSubscriptions {\n                    id\n                    endAt\n                    plan {\n                        name\n                    }\n                }\n            }\n            clientYearOverYearRetentionItems {\n                previousYearCount\n                retainedCount\n                clientYoyRetentionRate\n                staff {\n                    id\n                    name\n                    profilePhoto\n                    staffSecondaryAttribute\n                }\n            }\n        }\n    }\n"]);return H=function(){return e},e}var Q=(0,t(78258).J1)(H()),X=e=>{var n={};return(e||[]).forEach(e=>{n[e.staff.id]=(0,r._)((0,i._)({},n[e.staff.id]),{staff:{id:e.staff.id,name:e.staff.name,profilePhoto:e.staff.profilePhoto,staffSecondaryAttribute:e.staff.staffSecondaryAttribute},[u()(e.date).format("MMMM YYYY")]:(0,i._)({},e)})}),n},Z=e=>{var n={};return(e||[]).forEach(e=>{var t;(null==(t=e.staff)?void 0:t.id)&&(n[e.staff.id]={staff:{id:e.staff.id,name:e.staff.name,profilePhoto:e.staff.profilePhoto,staffSecondaryAttribute:e.staff.staffSecondaryAttribute},previousYearCount:e.previousYearCount,retainedCount:e.retainedCount,clientYoyRetentionRate:e.clientYoyRetentionRate})}),n};function ee(e,n){for(var t=!(arguments.length>2)||void 0===arguments[2]||arguments[2],i=u()(e).startOf("month"),r=t?u()(n).add(1,"month").startOf("month"):u()(n).startOf("month"),a=[];i.isBefore(r);)a.push(i.format("MMMM YYYY")),i.add(1,"month");return a}var en=e=>{var n,t,a,{isOpen:d,toggle:c,selectedStaff:u,startDate:f,endDate:p,includeCancelled:m,sessionOnly:h,appointmentOnly:v}=e,{timezone:x}=(0,l.useContext)(S.$),g=(0,s.useSelector)(e=>e.app.business.name),{data:b,loading:y}=(0,V.A)({query:Q,variables:{business:g,staffIds:u.map(e=>e.id),timezone:x,fromDate:f,toDate:p,includeCancelled:m,sessionOnly:h,appointmentOnly:v},processor:e=>e.clientRetentionReport}),j=ee(f,p,!0),C=null==b?void 0:b.clientRetentionItems,w=null!=(n=null==b?void 0:b.clientYearOverYearRetentionItems)?n:[],_=12===j.length&&w.length>0,A=null==b?void 0:b.complete,R=X(C),N=Z(w),O=Object.values(R).map(e=>{var n={staff:e.staff};return null==j||j.forEach(t=>{n[t]=e[t]}),n}),I=[{label:"Staff Id",key:"staffId"},{label:"Staff",key:"name"},{label:"Avg Client Lifetime (months)",key:"avgLifetime"},{label:"Performance Tier",key:"performanceTier"},..._?[{label:"YoY Retention Rate",key:"yearOverYearRetentionRate"},{label:"YoY Retained Clients",key:"yearOverYearRetainedClients"},{label:"YoY Month-1 Clients",key:"yearOverYearPreviousClients"}]:[],{label:"Month",key:"month"}
1,{label:"Year",key:"year"},{label:"Retention Rate",key:"retentionRate"},{label:"All Clients",key:"allClients"},{label:"Gained Clients",key:"gainedClients"},{label:"Lost Clients",key:"lostClients"},{label:"Net Clients",key:"netClients"},{label:"Gained Subscriptions",key:"gainedSubscriptions"},{label:"Lost Subscriptions",key:"lostSubscriptions"},{label:"Net Subscriptions",key:"netSubscriptions"}],D=[],k=W(C||[]);return(O||[]).forEach(e=>{var n=J(C||[],e.staff.id),t=null===n?"N/A":n.toFixed(1),a=K(n,k),o=N[e.staff.id];null==j||j.forEach(n=>{var l,s,[d,c]=n.split(" "),{clientRetentionRate:u,allClients:f,gainedClients:p,lostClients:m,gainedSubscriptions:h,lostSubscriptions:v}=e[n]||{},x=(0,Y.Tq)(((null==p?void 0:p.length)||0)-((null==m?void 0:m.length)||0)),g=(0,Y.Tq)(((null==h?void 0:h.length)||0)-((null==v?void 0:v.length)||0)),b=(0,r._)((0,i._)({staffId:e.staff.id,name:e.staff.name,avgLifetime:t,performanceTier:a||"-"},_?{yearOverYearRetentionRate:(null==o?void 0:o.clientYoyRetentionRate)!==null&&(null==o?void 0:o.clientYoyRetentionRate)!==void 0?"".concat(o.clientYoyRetentionRate,"%"):"-",yearOverYearRetainedClients:null!=(l=null==o?void 0:o.retainedCount)?l:"",yearOverYearPreviousClients:null!=(s=null==o?void 0:o.previousYearCount)?s:""}:{}),{month:d,year:c,retentionRate:u?"".concat(u,"%"):"-",allClients:(null==f?void 0:f.length)||0,gainedClients:(null==p?void 0:p.length)||0,lostClients:(null==m?void 0:m.length)||0,netClients:x,gainedSubscriptions:(null==h?void 0:h.length)||0,lostSubscriptions:(null==v?void 0:v.length)||0,netSubscriptions:g});D.push(b)})}),0!==(O||[]).length||y?y?t=U._:y||(t=U.Fv):t=U.KK,y||A||(t=U.N$,a="A CSV report will be emailed to you within the next few minutes"),(0,o.jsx)(U.Ay,{isOpen:d,toggle:c,status:t,invalidStatusMessage:a,headers:I,items:D,title:"Export Retention Report as CSV",reportName:"retention-report"})};en.propTypes={isOpen:q().bool.isRequired,toggle:q().func.isRequired,startDate:q().string,endDate:q().string},en.defaultProps={startDate:void 0,endDate:void 0};var et=t(4301),ei=t(16517),er=t(7926);function ea(){var e=(0,a._)(["\n    position: relative;\n    z-index: 20;\n    width: 100%;\n    margin-top: 1rem;\n    margin-bottom: 1rem;\n\n    .react-select__menu {\n        z-index: 30;\n    }\n"]);return ea=function(){return e},e}function eo(){var e=(0,a._)(["\n    font-size: 18px;\n    font-weight 700;\n    color: #616161;\n"]);return eo=function(){return e},e}function el(){var e=(0,a._)(["\n    span {\n        margin-top: 0;\n    }\n"]);return el=function(){return e},e}function es(){var e=(0,a._)(["\n    font-size: 18px;\n    font-weight: 500;\n    color: #616161;\n    margin-bottom: 10px;\n    display: flex;\n    flex-direction: row;\n"]);return es=function(){return e},e}function ed(){var e=(0,a._)(["\n    font-size: 18px;\n    font-weight 700;\n    color: #616161;\n"]);return ed=function(){return e},e}function ec(){var e=(0,a._)(["\n    .IL-icon {\n        margin-bottom: 0;\n    }\n    flex: 1;\n    min-width: 300px;\n"]);return ec=function(){return e},e}function eu(){var e=(0,a._)(["\n    display: flex;\n    flex-direction: row;\n    align-items: center;\n    flex-wrap: wrap;\n    gap: 10px;\n"]);return eu=function(){return e},e}function ef(){var e=(0,a._)(["\n    display: flex;\n    flex-direction: row;\n    justify-content: flex-end;\n    margin-top: 8px;\n    gap: 12px;\n"]);return ef=function(){return e},e}function ep(){var e=(0,a._)(["\n    font-size: 16px;\n    font-weight: 600;\n    color: #8b23b7;\n    text-align: center;\n"]);return ep=function(){return e},e}function em(){var e=(0,a._)(["\n    font-size: 14px;\n    font-weight: 600;\n    color: ",";\n    text-align: center;\n"]);return em=function(){return e},e}function eh(){var e=(0,a._)(["\n    flex: 0 0 280px;\n    max-width: 300px;\n    margin-right: 12px;\n"]);return eh=function(){return e},e}function ev(){var e=(0,a._)(["\n    position: relative;\n    z-index: 0;\n    width: 100%;\n    max-height: calc(100vh - 250px);\n    overflow: auto;\n\n    table {\n        border-collapse: separate;\n        border-spacing: 0;\n    }\n\n    thead th {\n        position: sticky;\n        top: 0;\n        background-color: #fff;\n        z-index: 1;\n        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);\n    }\n"]);return ev=function(){return e},e}var ex={Top:"#4ade80",Mid:er.GN,Low:er.Jg},eg=(0,f.Ay)(_.kS)(ea()),eb=f.Ay.div(eo());(0,f.Ay)(C.Ay)(el());var ey=f.Ay.div(es());f.Ay.div(ed());var ej=(0,f.Ay)(D.sS)(ec()),eC=f.Ay.div(eu()),ew=f.Ay.div(ef()),eS=f.Ay.div(ep()),e_=f.Ay.div(em(),e=>e.color),eA=(0,f.Ay)($.A)(eh()),eR=f.Ay.div(ev()),eN=(e,n)=>{var t=e.name.toUpperCase(),i=n.name.toUpperCase();return t<i?-1:+(t>i)},eY=(e,n,t,i,r,a)=>{var o=e.name.toUpperCase(),l=n.name.toUpperCase();return"asc"===t?o<l?-1:+(o>l):o>l?-1:+(o<l)},eO=e=>{var n,t,i,r,a,l,s,d,c,u,f,p,h,v,x,g,{cell:b,showFullStaff:y}=e;if(!b||0===b.length)return"-";
1var j=[...b.allClients||[]].sort(eN),C=[...b.gainedClients||[]].sort(eN),w=[...b.lostClients||[]].sort(eN);return(0,o.jsx)(m.A,{placement:"bottom",trigger:(null==(n=b.allClients)?void 0:n.length)>0||(null==(t=b.gainedClients)?void 0:t.length)>0||(null==(i=b.lostClients)?void 0:i.length)>0?["hover"]:[],overlay:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"mb-2",children:(null==(r=b.allClients)?void 0:r.length)>0&&(0,o.jsxs)(o.Fragment,{children:["All clients:"," ",j.map(e=>(0,o.jsx)("div",{className:"pl-2",children:e.name},e.id))]})}),(null==(a=b.gainedClients)?void 0:a.length)>0&&(0,o.jsxs)("div",{className:"mb-2",children:["Gained clients:"," ",(null==(l=b.gainedClients)?void 0:l.length)>0&&(0,o.jsx)(o.Fragment,{children:C.map(e=>(0,o.jsx)("div",{className:"pl-2",children:e.name},e.id))})]}),(null==(s=b.lostClients)?void 0:s.length)>0&&(0,o.jsxs)(o.Fragment,{children:["Lost clients:",w.map(e=>(0,o.jsx)("div",{className:"pl-2",children:e.name},e.id))]})]}),children:(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:"mb-2",children:[(0,o.jsx)(ey,{children:(0,Y.JU)(b.clientRetentionRate)}),(0,o.jsx)(eb,{children:"Clients"}),(0,o.jsxs)("div",{children:["All: ",(null==(d=b.allClients)?void 0:d.length)||0]}),(0,o.jsxs)("div",{children:["Gained: ",(null==(c=b.gainedClients)?void 0:c.length)||0]}),(0,o.jsxs)("div",{children:["Lost: ",(null==(u=b.lostClients)?void 0:u.length)||0]}),(0,o.jsxs)("div",{children:["Net:"," ",(0,Y.Tq)(((null==(f=b.gainedClients)?void 0:f.length)||0)-((null==(p=b.lostClients)?void 0:p.length)||0))]})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)(eb,{children:"Subscriptions"}),(0,o.jsxs)("div",{children:["Gained: ",(null==(h=b.gainedSubscriptions)?void 0:h.length)||0]}),(0,o.jsxs)("div",{children:["Lost: ",(null==(v=b.lostSubscriptions)?void 0:v.length)||0]}),(0,o.jsxs)("div",{children:["Net:"," ",(0,Y.Tq)(((null==(x=b.gainedSubscriptions)?void 0:x.length)||0)-((null==(g=b.lostSubscriptions)?void 0:g.length)||0))]})]})]})})},eI=e=>{var{cell:n}=e;return n?(0,o.jsxs)("div",{children:[(0,o.jsx)(ey,{children:"\xa0"}),(0,o.jsxs)("div",{className:"mb-2",children:[(0,o.jsx)(eb,{children:"Clients"}),(0,o.jsx)("div",{children:"\xa0"}),(0,o.jsxs)("div",{children:["Gained: ",n.gainedClients]}),(0,o.jsxs)("div",{children:["Lost: ",n.lostClients]}),(0,o.jsxs)("div",{children:["Net: ",(0,Y.Tq)(n.netClients)]})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)(eb,{children:"Subscriptions"}),(0,o.jsxs)("div",{children:["Gained: ",n.gainedSubscriptions]}),(0,o.jsxs)("div",{children:["Lost: ",n.lostSubscriptions]}),(0,o.jsxs)("div",{children:["Net: ",(0,Y.Tq)(n.netSubscriptions)]})]})]}):"-"},eD=e=>{var{cell:n}=e;return n?(0,o.jsx)(m.A,{placement:"bottom",trigger:["hover"],overlay:(0,o.jsxs)("div",{children:["Clients with subscription-backed appointments or classes in"," ",(0,o.jsx)("br",{}),"the first month of the selected period who also had ",(0,o.jsx)("br",{}),"subscription-backed appointments or classes with the same"," ",(0,o.jsx)("br",{}),"teacher in the final month of that period. ",(0,o.jsx)("br",{}),(0,o.jsx)("br",{}),"Retained: ",n.retainedCount||0," /"," ",n.previousYearCount||0]}),children:(0,o.jsx)(ey,{children:(0,Y.JU)(n.clientYoyRetentionRate)})}):"-"},ek=e=>(0,o.jsx)("div",{className:"d-flex flex-column justify-content-center",children:(0,o.jsxs)(d.N_,{to:(0,O.mw)(e),className:"d-flex flex-row align-items-center",children:[(0,o.jsx)(j.H8,{user:e}),(0,o.jsxs)("div",{children:[(0,o.jsx)("div",{children:(0,M.sy)(e.name,18)}),e.staffSecondaryAttribute&&(0,o.jsx)(E.ZM,{className:"mb-2",children:(0,M.sy)(e.staffSecondaryAttribute,12)})]})]})}),e$=e=>(0,o.jsx)(m.A,{placement:"bottom",trigger:["hover"],overlay:(0,o.jsxs)("div",{children:["Average Client Lifetime based on monthly churn rate.",(0,o.jsx)("br",{}),"Formula: 1 / Average Monthly Churn Rate"]}),children:(0,o.jsx)(eS,{children:B(e)})}),eT=e=>(0,o.jsx)(m.A,{placement:"bottom",trigger:["hover"],overlay:(0,o.jsxs)("div",{children:["Performance tier based on lifetime vs average.",(0,o.jsx)("br",{}),"Top: at or above average",(0,o.jsx)("br",{}),"Mid: 80-99% of average",(0,o.jsx)("br",{}),"Low: below 80% of average"]}),children:(0,o.jsx)(e_,{color:ex[e]||"#757575",children:e||"-"})}),eM=e=>(0,o.jsx)(eD,{cell:e}),eE=e=>(0,o.jsx)(eI,{cell:e}),eL=e=>(0,o.jsx)(eO,{cell:e,showFullStaff:!0}),eF=e=>{var{clientRetentionReport:n,startDate:t,endDate:i}=e,r=ee(t,i,!0),a=r.length,s=(0,l.useMemo)(()=>{var e;return null!=(e=null==n?void 0:n.clientRetentionItems)?e:[]},[null==n?void 0:n.clientRetentionItems]),d=(0,l.useMemo)(()=>{var e;return null!=(e=null==n?void 0:n.clientYearOverYearRetentionItems)?e:[]},[null==n?void 0:n.clientYearOverYearRetentionItems]),c=12===a&&d.length>0,u=(0,l.useMemo)(()=>W(s),[s]),f=[{dataField:"staff",text:"Staff",sort:!0,style:{minWidth:"200px"},sortFunc:eY,formatter:ek},{dataField:"avgLifetime",text:"Avg. Client Lifetime",sort:!0,style:{width:"100px"},formatter:e$},{dataField:"performanceTier",text:"Tier",sort:!0,style:{width:"80px"},formatter:eT},...c?[{dataField:"yearOverYearRetention",text:"YoY Retention",sort:!0,sortFunc:(e,n,t)=>{var i,r,a=null!=(i=null==e?void 0:e.clientYoyRetentionRate)?i:-1,o=null!=(r=null==n?void 0:n.clientYoyRetentionRate)?r:-1;return"asc"===t?a-o:o-a},style:{width:"120px"},formatter:eM}]:[],{dataField:"totals",text:"Totals",sort:!0,sortFunc:(e,n,t)=>{var i=(null==e?void 0:e.netClients)||0,r=(null==n?void 0:n.netClients)||0;return"asc"===t?i-r:r-i},style:{width:"140px",borderRight:"2px solid #dee2e6"},headerStyle:{borderRight:"2px solid #dee2e6"},formatter:eE},...r.map(e=>({dataField:e,text:e,sort:!1,style:{width:"160px"},formatter:eL}))],m=(0,l.useMemo)(()=>{var e=X(s),n=Z(d);return Object.values(e).map(e=>{var t=J(s,e.staff.id),i=0,a=0,o=0,l=0;r.forEach(n=>{var t,r,s,d,c=e[n];c&&(i+=(null==(t=c.gainedClients)?void 0:t.length)||0,a+=(null==(r=c.lostClients)?void 0:r.length)||0,o+=(null==(s=c.gainedSubscriptions)?void 0:s.length)||0,l+=(null==(d=c.lostSubscriptions)?void 0:d.length)||0)});var d={staff:e.staff,avgLifetime:t,performanceTier:K(t,u),yearOverYearRetention:n[e.staff.id],totals:{gainedClients:i,lostClients:a,netClients:i-a,gainedSubscriptions:o,lostSubscriptions:l,netSubscriptions:o-l}};return r.forEach(n=>{d[n]=e[n]}),d})},[s,d,r,u]);return(0,o.jsxs)(b.A,{className:"d-flex p-2 flex-column",children:[a<12&&(0,o.jsx)(F.A,{className:"mb-3",text:"Date range is ".concat(a," month").concat(1!==a?"s":"",". For accurate Client Lifetime calculations, we recommend using 12 months of data to account for seasonal variations.")}),(0,o.jsx)(eR,{children:(0,o.jsx)(p.default,{bootstrap4:!0,keyField:"id",data:m,columns:f,striped:!0,bordered:!1})}),(0,o.jsx)(L.c,{text:"Retention percentage is calculated as percentage of clients with subscriptions, having appointments or classes with the staff as primary staff, retained compared to previous month"}),(0,o.jsx)(L.c,{text:"Client Lifetime is calculated as 1 / Average Monthly Churn Rate. A longer date range provides more accurate results."}),(0,o.jsx)(L.c,{text:"All clients: include all clients who have a subscription and an appointment or class with the staff as primary staff"}),(0,o.jsx)(L.c,{text:"Gained clients: include all clients who were gained compared to previous month"}),(0,o.jsx)(L.c,{text:"Lost clients: include all clients who were lost compared to previous month"}),(0,o.jsx)(L.c,{text:"Gained Subscription: include all subscriptions that were gained for that staff compared to previous month"}),(0,o.jsx)(L.c,{text:"Lost Subscription: include all subscriptions that were lost for that staff compared to previous month"}),(0,o.jsx)(L.c,{text:"YoY Retention is shown only when the selected report range is exactly 12 months and the report completes. Per-staff YoY Retention compares each teacher's first-month clients with that same teacher's final-month clients."})]})},eP=u()().add(1,"month"),ez=u()().subtract(5,"month"),eG=()=>{var e,n,t,a,{localMoment:d}=(0,l.useContext)(S.$),{timezone:c}=(0,l.useContext)(S.$),[f,p]=(0,T.A)(!1),[h,b]=(0,T.A)(),[j,_]=(0,l.useState)(!1),{name:O,uiPrimaryColor:D,advancedReportingEnabled:$}
1=(0,s.useSelector)(e=>e.app.business),[M,E]=(0,w.A)("clientRetention.selectedStaff",[]),[L,F]=(0,w.A)("clientRetention.includeCancelled",!1),[G,q]=(0,w.A)("clientRetention.sessionOnly",!1),[U,V]=(0,w.A)("clientRetention.appointmentOnly",!1),[J,K]=(0,w.A)("clientRetention:dateRange",{startDate:eP,endDate:ez,key:"selection"},!1,e=>e?(0,r._)((0,i._)({},e),{startDate:e.startDate?u()(e.startDate):e.startDate,endDate:e.endDate?u()(e.endDate):e.endDate}):void 0),[H,{data:X,loading:Z,error:er,variables:ea}]=(0,x.A)(Q,{processor:e=>e.clientRetentionReport,fetchPolicy:"no-cache"}),eo=(0,l.useMemo)(()=>u()(J.startDate).tz(c,!0).toISOString(),[c,J.startDate]),el=(0,l.useMemo)(()=>u()(J.endDate).tz(c,!0).toISOString(),[c,J.endDate]),es={business:O,staffIds:M.map(e=>e.id),timezone:c,fromDate:u()(eo).toISOString(),toDate:u()(el).toISOString(),includeCancelled:L,sessionOnly:G,appointmentOnly:U},ed=ee(eo,el,!0).length;return((0,l.useEffect)(()=>{Z||(null==X?void 0:X.error)||(null==X?void 0:X.complete)||!X||(0,I.WS)({title:"Not all months / staff were returned",message:"A CSV report will be emailed to you within the next few minutes",dismissAfter:1e4})},[Z,X]),$)?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(g.A,{title:"Client Retention",description:"".concat(d(eo).format("MM/YYYY")," - ").concat(d(el).format("MM/YYYY")),children:[(0,o.jsx)("div",{className:"d-flex justify-content-end",children:(0,o.jsx)(P.A,{id:"retention-filters",filterCollapsed:j,setFilterCollapsed:_,hideLabel:"Hide filters",showLabel:"Show filters"})}),!j&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"d-flex flex-row align-items-end flex-grow-1",children:(0,o.jsx)(eg,(0,i._)({isClearable:!0,isMulti:!0,withSelectAll:!0,id:"react-select-day",classNamePrefix:"react-select",className:"mr-2",placeholder:"Select staff",value:M,onChange:e=>e?E(e):E([])},C.OM))}),(0,o.jsxs)(eC,{children:[(0,o.jsx)(ej,{id:"due-date-range",materialIcon:"date_range",text:"Client retention from ".concat(d(eo).format("MMM Do YYYY")," to ").concat(d(el).format("MMM Do YYYY")),onClick:p}),(0,o.jsxs)("div",{className:"d-flex flex-row",children:[(0,o.jsxs)("div",{className:"d-flex align-items-center flex-row mr-2",children:[(0,o.jsx)(A.A,{className:"mr-2",checked:L,onChange:()=>F(!L)}),(0,o.jsx)(m.A,{placement:"bottom",trigger:["hover"],overlay:(0,o.jsxs)("div",{children:["Determines if cancelled appointments should",(0,o.jsx)("br",{}),"be taken into account or not.",(0,o.jsx)("br",{}),"For example: if a client has all their lessons",(0,o.jsx)("br",{}),"cancelled in a given a month (Subscription Hold for instance),",(0,o.jsx)("br",{}),"and this toggle is on, they will not be counted as a loss / gain."]}),children:(0,o.jsx)("div",{children:"Include cancelled"})})]}),(0,o.jsxs)("div",{className:"d-flex align-items-center flex-row mr-2",children:[(0,o.jsx)(A.A,{className:"mr-2",checked:G,onChange:()=>{G||V(!1),q(!G)}}),(0,o.jsx)(m.A,{placement:"bottom",trigger:["hover"],overlay:(0,o.jsxs)("div",{children:["Determines if group classes should",(0,o.jsx)("br",{}),"be taken into account or not.",(0,o.jsx)("br",{})]}),children:(0,o.jsx)("div",{children:"Group Class only"})})]}),(0,o.jsxs)("div",{className:"d-flex align-items-center flex-row mr-2",children:[(0,o.jsx)(A.A,{className:"mr-2",checked:U,onChange:()=>{U||q(!1),V(!U)}}),(0,o.jsx)(m.A,{placement:"bottom",trigger:["hover"],overlay:(0,o.jsxs)("div",{children:["Determines if appointments should",(0,o.jsx)("br",{}),"be taken into account or not.",(0,o.jsx)("br",{})]}),children:(0,o.jsx)("div",{children:"Appointments only"})})]})]})]}),(0,o.jsxs)(ew,{children:[(0,o.jsx)(R.A,{className:"btn btn-primary rounded",type:"button",id:"retention-stat-load-report-button",onClick:()=>{H({variables:es})},disabled:Z||v()(es,ea),disabledReason:!Z&&"Report already loaded. Please modify inputs to enable reloading.",children:(0,o.jsxs)("div",{className:"d-flex",children:[(0,o.jsx)(N.A,{falIcon:"refresh mr-2 ".concat(Z&&"fa-spin")}),"load report"]})}),(0,o.jsx)(R.A,{onClick:b,type:"button",className:"btn btn-primary rounded",id:"retention-stat-export-csv-button",children:"export csv"})]})]})]}),!Z&&(null==X||null==(n=X.clientRetentionItems)?void 0:n.length)>0&&(0,o.jsxs)("div",{className:"mt-3 d-flex flex-row flex-wrap",children:[(0,o.jsx)(eA,{bg:"primary",icon:"schedule",text:"Overall Avg Client Lifetime",number:B(W(X.clientRetentionItems)),marginLeft:"0",marginTop:"0",minWidth:"280px",tooltip:"Average client lifetime across all selected staff, calculated as 1 / Average Monthly Churn Rate"}),12===ed&&(null==X||null==(t=X.clientYearOverYearRetentionItems)?void 0:t.length)>0&&(0,o.jsx)(eA,{bg:"primary",icon:"trending_up",text:"Overall Avg Client YoY Retention",number:(0,Y.JU)(null==(a=(e=(X.clientYearOverYearRetentionItems||[]).map(e=>e.clientYoyRetentionRate).filter(e=>null!=e)).length?e.reduce((e,n)=>e+n,0)/e.length:null)?void 0:a.toFixed(1)),marginLeft:"0",marginTop:"0",minWidth:"340px",tooltip:"Average YoY client retention across all selected staff with a valid YoY rate"})]}),Z&&(0,o.jsxs)("div",{className:"d-flex flex-column ",children:[(0,o.jsx)(y.A,{size:65,color:D}),(0,o.jsx)("div",{className:"d-flex flex-row justify-content-center",children:"Loading, this can take a moment - if the report takes too long to generate a complete csv version of the report will be emailed to you within a few minutes..."})]}),!Z&&!er&&(0,o.jsx)(eF,{clientRetentionReport:X,startDate:eo,endDate:el}),(0,o.jsx)(k.Ay,{modalName:"due-date-range",title:"Select Date Range",isOpen:f,toggle:p,selectionRange:J,onChange:e=>{var n=(0,i._)({},e);
1e.endDate.isAfter(u()().add(5,"month"))&&(n.endDate=u()().add(5,"month"),(0,I.WS)({title:"Date range was adjusted",message:"End date cannot be more than 5 month into the future",dismissAfter:6e3})),K(n)},staticRanges:[k.p2,k.Ob,k.nz,k.rq,k.II]}),h&&(0,o.jsx)(en,{isOpen:h,toggle:b,selectedStaff:M,startDate:eo,endDate:el,includeCancelled:L,sessionOnly:G,appointmentOnly:U})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(z.JG,{className:"plus-msg",children:"Client Retention report is a premium feature part of Advanced Reporting currently not enabled on your account."}),(0,o.jsx)("div",{className:"mt-3 d-flex flex-row justify-content-center",children:(0,o.jsx)(et.wl,{onClick:()=>window.open(ei.bv,"_blank"),children:"Learn more about advanced reporting"})})]})}},56554:function(e,n,t){t(93632);var i=t(96540);n.A=(e,n)=>{var[t,r]=(0,i.useState)(e);return(0,i.useEffect)(()=>{var t=setTimeout(()=>{r(e)},n);return()=>{clearTimeout(t)}},[e,n]),t}},82847:function(e,n,t){var i=t(71893),r=t(55456),a=t(18542);t(93632);var o=t(96540),l=t(77969),s=t(62193),d=t.n(s),c=t(48810),u=t(50926);n.A=(e,n)=>{var{processor:t=e=>e,onError:s,errorTitle:f="Error fetching data",doLogError:p=!0,context:m}=n,h=(0,a._)(n,["processor","onError","errorTitle","doLogError","context"]),v=(0,o.useCallback)(e=>{(0,c.UG)({title:f,message:e.message}),p&&(e.message="error fetching data: ".concat(e.message),(0,u.Fk)(e)),s&&s(e)},[s,p,f]),[x,g]=(0,l._)(e,(0,r._)((0,i._)({},h),{context:m,onError:v})),{loading:b,error:y,data:j,previousData:C}=g,w=(0,a._)(g,["loading","error","data","previousData"]),S=j,_=C;try{S&&!d()(S)&&(S=t(S)),_&&!d()(_)&&(_=t(_))}catch(e){v(e),S=null}return[x,(0,i._)({data:S,previousData:_,error:y,loading:b},w)]}},46388:function(e,n,t){t.d(n,{I:function(){return l},N:function(){return s}});var i=t(84577),r=t(78258);function a(){var e=(0,i._)(["\n    query S3SignedUrl(\n        $business: String!\n        $objectType: String!\n        $fileType: String!\n        $path: String\n        $peopleId: ID\n        $fileName: String\n    ) {\n        s3SignedUrl(\n            business: $business\n            objectType: $objectType\n            fileType: $fileType\n            path: $path\n            peopleId: $peopleId\n            fileName: $fileName\n        ) {\n            status\n            error\n            url\n        }\n    }\n"]);return a=function(){return e},e}function o(){var e=(0,i._)(["\n    mutation selfResetPassword($business: String!, $password: String!) {\n        selfResetPassword(business: $business, password: $password) {\n            status\n            error\n        }\n    }\n"]);return o=function(){return e},e}var l=(0,r.J1)(a()),s=(0,r.J1)(o())}}]);
2//# sourceMappingURL=14994.1725fcef.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.