PageSourceSearch

https://reporting.happy-or-not.com/assets/ForesightsPage-BycDZwNf.js

js happy-or-not.com collected 2026-09-24 17:47:40 UTC 15,201 bytes, 68 lines download raw bytes

1import{r as o,j as e,ac as C,B as $,P as xe,F as pe,K as fe}from"./main-DyjxXpTK.js";import{C as me}from"./ContentPageTemplate-B3zrlMfb.js";import{cy as ie,jm as A,jn as Se,du as oe,jo as je,dN as B,jp as ye,aw as _,cY as j,aD as h,T as k,c_ as ne,j1 as I,cW as Z,aC as ve,gG as Ce,jq as z,jr as S,js as w,jt as Fe,fs as re,ju as Le,jv as Ge,jw as be,jx as Ie,ay as ae,jy as K,jz as ce,jA as Te,jB as ke,jC as we,b1 as Re,bV as Me,jD as Ne,gl as Be,gm as Ee,e8 as Y,cP as u,hw as He,aV as _e,hy as Ae,jd as Pe,eb as qe,h as De,jE as Q,gn as Oe,fG as X,hx as Ue,jF as We,b$ as Ve}from"./App-V_-BsQ0z.js";import{c as P,t as $e,F as Ze,a as q,C as ze}from"./CenteringContainer-CNXgQ9u6.js";import{F as Ke}from"./ForwardChevron-C4bTIGaB.js";import{c as Ye}from"./chunk-6EeNq__x.js";import{a as Qe,T as Xe}from"./ToggleNotificationsButton-4ibjYOhS.js";import{B as Je}from"./BackwardChevron-DH08CylC.js";import{C as J}from"./Check-CvTfBhrf.js";import{M as et,E as tt}from"./EmptySubscriptionsMessage-ur_57d_n.js";import{L as ee}from"./ListItemIcon-SYeKIgu6.js";import"./ListWithExpandableItems-B6MruSM0.js";import"./TableLikeListingContent-sB5XxB2h.js";import"./Table-C66vHri0.js";import"./ChevronDown-yzzOW2OC.js";import"./DisabledItem-BmOWjx3N.js";import"./AlertCircle-DiXl44kc.js";import"./InfoTooltip-DPMzvBJo.js";import"./PatternChart-Dmcm7_ym.js";import"./InfoTooltipContent-BtyGdCP8.js";import"./ResultTooltip-C6eVrlBE.js";import"./generateCategoricalChart-DCzYJ1M3.js";import"./ComposedChart-Di97pvTf.js";import"./YAxis-7z7XdME-.js";import"./feedback-scale-utils-WA0Oxyxj.js";import"./Smileys-_UC-jsL7.js";import"./NpsRange-DGLcVIqn.js";import"./FieldGrid-DHX3ZmDG.js";import"./Calendar-CnausqXL.js";import"./MapPin-DTuFTGgx.js";import"./Survey-zijhN6EB.js";import"./ChevronUp-VlNkODXI.js";import"./BellOff-ChLk2aR_.js";var st="Expected a function";function it(t){if(typeof t!="function")throw new TypeError(st);return function(){var s=arguments;switch(s.length){case 0:return!t.call(this);case 1:return!t.call(this,s[0]);case 2:return!t.call(this,s[0],s[1]);case 3:return!t.call(this,s[0],s[1],s[2])}return!t.apply(this,s)}}const te=ie(t=>({locale:A(t.authenticatedUser.request.data).userUiLocale}),{fetchSideMenuForesightCounts:Se})(ot);function ot(t){const{groupedForesights:s,categoriesWithInactiveSurveys:n}=t,a=s.filter(i=>i.insights.length!==0),[c,l]=o.useState(),d=oe();o.useEffect(()=>{const i=t.groupedForesights.reduce((r,G)=>r.concat(G.insights.map(v=>v.id).filter(je)),[]),g=Ye(i,250);Promise.all(g.map(r=>B.markForesightsAsSeen(r))).finally(()=>t.fetchSideMenuForesightCounts(!1))},[]);const f=(i,p,g,r)=>{i?l(void 0):(l({groupId:p,index:g}),$e(r,w.CardExpanded))},m=(i,p)=>c!==void 0&&c.groupId===se(i)&&c.index===p,x=i=>i.groupBy===S.SurveyGroup?z.ReportSpecification:z.SurveyGroup,F=t.selectedGroup?.insights.filter(i=>!!i.id).map(i=>i.id)||[],y=i=>!!i.id&&F.includes(i.id),L=i=>Ce(i,it(y));return e.jsxs("div",{children:[a.map((i,p)=>e.jsxs(ut,{children:[e.jsx(rt,{honIntl:d,foresightGroup:i,locale:t.locale,onClick:t.groupSelected?()=>t.groupSelected(i):void 0}),e.jsx("div",{"data-testid":"foresight-group-list",children:e.jsx(lt,{children:L(i.insights).map((g,r)=>g.insightType===ye.RecurringEventFeedbackScaleNotSupported?e.jsx(_,{sx:{px:2,py:0,mt:1,mb:2},children:e.jsx(j,{variant:"body1",children:e.jsx(h,{text:{id:k.FiveScaleLimitations.Foresights.info}})})},r):e.jsx(at,{foresight:g,expanded:m(i,r),onClick:()=>f(m(i,r),se(i),r,g),titleMode:x(i),historical:!!t.selectedGroup&&!y(g)},r))})})]},p)),n.length>0&&e.jsx(_,{sx:{mt:2,mb:2,ml:2},children:e.jsx(j,{variant:"body1",children:e.jsx(h,{id:k.ForesightsFeature.noActiveSurveys.cannotShowForesights,values:{locations:e.jsx("b",{children:P(t.categoriesWithInactiveSurveys,d)}),link_to_subscriptions:e.jsx("a",{href:I.SUBSCRIPTIONS,children:e.jsx(h,{id:k.Subscriptions.info.how_to_manage.link_to_subscriptions})}),link_to_foresights_help_center:e.jsx("a",{href:ne.foresights,children:e.jsx(h,{id:k.General.helpCenter.linkText})})}})})})]})}function nt(t){return t.insights.some(s=>!!s.id)}function H(t){return!!t.onClick&&nt(t.foresightGroup)}const rt=C(t=>e.jsxs(dt,{className:t.className,onClick:H(t)?t.onClick:void 0,children:[e.jsx(j,{variant:"h6",className:"groupTitleText",children:t.foresightGroup.surveyGroup?Fe(t.foresightGroup.surveyGroup.question,t.locale):P([t.foresightGroup.reportSpecification],t.honIntl)}),e.jsxs("div",{className:"drillDown",children:[e.jsx(j,{variant:"h6",className:"count",children:t.foresightGroup.insights.length}),H(t)&&e.jsx(Ke,{className:"arrow"})]})]}))`
2  ${t=>`
3  cursor: ${H(t)?"pointer":"default"};
4  `}
5  display: flex;
6  flex-direction: row;
7  justify-content: space-between;
8  .drillDown {
9    display: flex;
10    flex-direction: row;
11    align-items: center;
12    margin-${Z}: 8px;
13    .count {
14      font-weight: bold;
15    }
16    .arrow {
17      margin-${Z}: 10px;
18      margin-${ve}: -5px;
19    }
20  }
21`;function se(t){return t?.surveyGroup?.id||t?.reportSpecification?.id}const at=ie(t=>({userLocale:A(t.authenticatedUser.request.data).userUiLocale}),{})(ct);function ct(t){let[s,n]=o.useState(),[a,c]=o.useState();return o.useEffect(()=>{let l;t.expanded&&!s&&!a&&(l=B.getForesightListItemDetails(t.foresight,t.userLocale),l.promise.then(d=>{n(d)}),c(l))}),o.useEffect(()=>a&&a.cancel,[]),e.jsx(Ze,{foresight:t.foresight,foresightDetails:s,expanded:t.expanded,onClick:t.onClick,titleMode:t.titleMode,historical:t.historical})}const ut=C.div`
22  &:not(:first-child) {
23    margin-top: 8px;
24  }
25`,lt=C.div`
26  border-radius: 3px;
27  overflow: auto;
28  & > * {
29    &:first-child {
30      margin-top: 8px;
31    }
32    &:last-child {
33      margin-bottom: 8px;
34    }
35  }
36`,dt=C.div`
37  padding: 0 16px;
38`;function ht(t){const[s,n]=$.useState(!1),a=$.useRef(null),c=()=>{n(d=>!d)},l=d=>{a.current&&a.current.contains(d.target)||n(!1)};return e.jsxs(e.Fragment,{children:[e.jsx(re,{color:"primary",ref:a,ariaControl
38s:s?"menu-list-grow":void 0,ariaHaspopup:"true",onClick:c,text:t.buttonLabel,icon:t.icon}),e.jsx(Le,{open:s,anchorEl:a.current,role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:d,placement:f})=>e.jsx(Ge,{...d,style:{transformOrigin:f==="bottom"?"center top":"center bottom"},children:e.jsx(xe,{children:e.jsx(be,{onClickAway:l,children:e.jsx(Ie,{autoFocusItem:s,id:"menu-list-grow",onClick:()=>n(!1),children:t.menuItems})})})})})]})}const gt=o.forwardRef((t,s)=>e.jsx(ae,{...t,ref:s,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:e.jsx("path",{d:"M5.4,14 C7.27776815,14 8.8,15.5222319 8.8,17.4 C8.8,19.2777681 7.27776815,20.8 5.4,20.8 C3.52223185,20.8 2,19.2777681 2,17.4 C2,15.5222319 3.52223185,14 5.4,14 Z M5.4,15.8 C4.5163444,15.8 3.8,16.5163444 3.8,17.4 C3.8,18.2836556 4.5163444,19 5.4,19 C6.2836556,19 7,18.2836556 7,17.4 C7,16.5163444 6.2836556,15.8 5.4,15.8 Z M20.9,16.4 C21.4522847,16.4 21.9,16.8477153 21.9,17.4 C21.9,17.9128358 21.5139598,18.3355072 21.0166211,18.3932723 L20.9,18.4 L11.9,18.4 C11.3477153,18.4 10.9,17.9522847 10.9,17.4 C10.9,16.8871642 11.2860402,16.4644928 11.7833789,16.4067277 L11.9,16.4 L20.9,16.4 Z M5.4,4 C7.27776815,4 8.8,5.52223185 8.8,7.4 C8.8,9.27776815 7.27776815,10.8 5.4,10.8 C3.52223185,10.8 2,9.27776815 2,7.4 C2,5.52223185 3.52223185,4 5.4,4 Z M20.9,8.15 C21.4522847,8.15 21.9,8.59771525 21.9,9.15 C21.9,9.66283584 21.5139598,10.0855072 21.0166211,10.1432723 L20.9,10.15 L11.9,10.15 C11.3477153,10.15 10.9,9.70228475 10.9,9.15 C10.9,8.63716416 11.2860402,8.21449284 11.7833789,8.15672773 L11.9,8.15 L20.9,8.15 Z M5.4,5.8 C4.5163444,5.8 3.8,6.5163444 3.8,7.4 C3.8,8.2836556 4.5163444,9 5.4,9 C6.2836556,9 7,8.2836556 7,7.4 C7,6.5163444 6.2836556,5.8 5.4,5.8 Z M20.9,4.65 C21.4522847,4.65 21.9,5.09771525 21.9,5.65 C21.9,6.16283584 21.5139598,6.58550716 21.0166211,6.64327227 L20.9,6.65 L11.9,6.65 C11.3477153,6.65 10.9,6.20228475 10.9,5.65 C10.9,5.13716416 11.2860402,4.71449284 11.7833789,4.65672773 L11.9,4.65 L20.9,4.65 Z"})})),xt=o.forwardRef((t,s)=>e.jsx(ae,{...t,ref:s,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 40 40",children:e.jsx("path",{d:"M25.01 36C24.61 36 24.31 35.8 24.11 35.4L15.01 7.9L10.91 20.3C10.81 20.7 10.41 20.9 10.01 20.9H3.31C2.81 20.9 2.41 20.5 2.41 20C2.41 19.5 2.81 19.1 3.31 19.1H9.31L14.11 4.7C14.21 4.3 14.61 4.1 15.01 4.1C15.41 4.1 15.71 4.3 15.91 4.7L25.01 32.3L29.11 19.9C29.21 19.5 29.61 19.3 30.01 19.3H36.71C37.21 19.3 37.61 19.7 37.61 20.2C37.61 20.7 37.21 21.1 36.71 21.1H30.71L25.91 35.5C25.71 35.8 25.41 36 25.01 36Z"})}));function pt(t,s,n){const[a,c]=o.useState(!0),[l,d]=o.useState(),[f,m]=o.useState(),[x,F]=o.useState(!1),[y,L]=o.useState(!0),[i,p]=o.useState(!1),[g,r]=o.useState([]),[G,v]=o.useState([]);return o.useEffect(()=>{if(!f||t!==l){d(t),c(!0);const R=B.getGroupedForesightListItems(t,s,n);R.promise.then(b=>{switch(b.subscriptionState){case K.NoSubscriptions:{L(!1),c(!1);break}case K.NoActiveSurveys:{c(!1),r(b.categoriesWithInactiveSurveys);break}default:{p(!0),v(b.groupedForesightListItems),r(b.categoriesWithInactiveSurveys),c(!1);break}}}).catch(b=>{b!==ce.Cancel&&(F(!0),c(!1))}),m(R),l&&q(t===S.SurveyGroup?w.GroupBySurveyToggled:w.GroupBySubscriptionToggled)}},[f,t]),{loading:a,existingForesightsRequest:f,requestFailed:x,hasSubscriptions:y,hasActiveSurveys:i,groupedForesightListItems:G,categoriesWithInactiveSurveys:g}}function ft(t,s,n){const[a,c]=o.useState(!1),[l,d]=o.useState(),[f,m]=o.useState(s),[x,F]=o.useState(),[y,L]=o.useState(!1),[i,p]=o.useState(void 0);return o.useEffect(()=>{const g=n!==l,r=s!==f;if(n&&(!x||g||r)){g&&d(n),r&&m(s),c(!0);const G=B.getGroupedForesightListItemsHistory(n,s,t);G.promise.then(v=>{p(v),m(s),c(!1)}).catch(v=>{v!==ce.Cancel&&(L(!0),c(!1))}),F(G),l&&q(w.HistoryAccessed)}},[x,n,s]),{loadingHistory:a,existingHistoryRequest:x,historyRequestFailed:y,historyListItems:i}}function mt(t){return e.jsx(et,{...t,children:e.jsx(_,{sx:{width:"580px",maxWidth:"100%"},children:e.jsx(Te,{})})})}function hs(){const t=ke(),s=we(),n=pe(),a=oe(),c=Re(),l=Me(T=>T.authenticatedUser),d=A(l.request.data).userUiLocale||Ne,f=Be(l.pushNotifications),m=Ee(l.pushNotifications.token),[x,F]=o.use
38State(void 0),[y,L]=o.useState(N()),[i,p]=o.useState(S.SurveyGroup),{loading:g,existingForesightsRequest:r,requestFailed:G,hasSubscriptions:v,hasActiveSurveys:R,groupedForesightListItems:b,categoriesWithInactiveSurveys:E}=pt(i,d,N()),{loadingHistory:D,existingHistoryRequest:O,historyRequestFailed:ue,historyListItems:U}=ft(d,y,x);o.useEffect(()=>(Y(a.formatLocalizedText({id:u.General.ForesightsFeature.title})),He(Ae.Foresights,_e.Reporting),()=>{Y(),r!==void 0&&r.cancel(),O!==void 0&&O.cancel()}),[]),o.useEffect(()=>{!x&&t.search!==""&&s.replace(I.FORESIGHTS)},[t.search]),x&&t.search===""&&(F(void 0),L(N()));function le(){L(N(y)),q(w.HistoryLoadMoreClicked)}function de(){s.replace(I.FORESIGHTS)}function he(T){F(T),s.push(St(T))}function W(){c(Oe(!m))}const ge=f?[e.jsx(Qe,{muted:m,toggleMuting:W},"notifications")]:[],V=Pe(n),M=!!x&&(D||!!U);return e.jsx(qe,{customTopNavigation:T=>e.jsx(Tt,{...T,customElements:ge}),children:e.jsx(me,{headerIcon:xt,header:{id:u.General.ForesightsFeature.title},hideHeader:M,hideHeaderInMobile:!0,actionComponents:V&&!M?jt({showNotificationsToggle:f,notificationsMuted:m,toggleNotificationsMuting:W,groupBy:i,setGroupBy:p}):void 0,children:e.jsxs(e.Fragment,{children:[!V&&v&&!M&&e.jsx(vt,{groupBy:i,setGroupBy:p}),g||D?e.jsx(Ct,{}):G||ue?e.jsx(Ft,{}):M?e.jsxs(e.Fragment,{children:[e.jsx(bt,{onClick:de}),e.jsx(te,{groupedForesights:[U],categoriesWithInactiveSurveys:E,selectedGroup:x}),e.jsx(Mt,{startDate:y,onClick:le})]}):v?R?e.jsx(te,{groupedForesights:b,categoriesWithInactiveSurveys:E,groupSelected:he}):e.jsx(Gt,{categoriesWithInactiveSurveys:E,honIntl:a}):e.jsx(Lt,{})]})})})}function N(t){return De(t||new Date).subtract(3,"month").toDate()}function St(t){return t.surveyGroup?I.FORESIGHTS+`?surveyGroupId=${t.surveyGroup.id}`:t.reportSpecification?I.FORESIGHTS+`?reportSpecificationId=${t.reportSpecification.id}`:I.FORESIGHTS}function jt(t){const{groupBy:s,setGroupBy:n,...a}=t;return[...t.showNotificationsToggle?[e.jsx(Xe,{...a},"toggleNotificationsButton")]:[],e.jsx(yt,{groupBy:s,setGroupBy:n},"selectGroupingButton")]}function yt(t){return e.jsx(ht,{buttonLabel:{id:u.General.DataGrouping.GroupBy},icon:e.jsx(gt,{}),menuItems:[e.jsxs(X,{onClick:()=>t.setGroupBy(S.SurveyGroup),children:[e.jsx(ee,{children:t.groupBy===S.SurveyGroup?e.jsx(J,{}):e.jsx("span",{})}),e.jsx(j,{variant:"button",children:e.jsx(h,{id:u.General.Survey.singular})})]},1),e.jsxs(X,{onClick:()=>t.setGroupBy(S.ReportSpecification),children:[e.jsx(ee,{children:t.groupBy===S.ReportSpecification?e.jsx(J,{}):e.jsx("span",{})}),e.jsx(j,{variant:"button",children:e.jsx(h,{id:u.General.Subscription.singular})})]},2)]})}function vt(t){const{groupBy:s,setGroupBy:n}=t;return e.jsxs(kt,{children:[e.jsx(j,{variant:"h6",align:"center",children:e.jsx(h,{id:u.General.DataGrouping.GroupBy})}),e.jsxs(wt,{children:[e.jsx(Q,{active:s===S.SurveyGroup,onClick:()=>n(S.SurveyGroup),children:e.jsx(h,{id:u.General.Survey.singular})}),e.jsx(Q,{active:s===S.ReportSpecification,onClick:()=>n(S.ReportSpecification),children:e.jsx(h,{id:u.General.Subscription.singular})})]})]})}function Ct(){return e.jsx(ze,{children:e.jsx(fe,{})})}function Ft(){return e.jsx(j,{variant:"h5",children:e.jsx(h,{id:u.Errors.Timeout})})}function Lt(){return e.jsx(tt,{title:{id:u.ForesightsFeature.noSubscription.smileyFaceMessage.title},message:{id:u.Subscriptions.info.how_to_manage.base,values:{link_to_subscriptions:e.jsx("a",{href:I.SUBSCRIPTIONS,children:e.jsx(h,{id:u.Subscriptions.info.how_to_manage.link_to_subscriptions})})}}})}function Gt(t){return e.jsx(mt,{title:{id:u.ForesightsFeature.noActiveSurveys.title},message:{id:u.ForesightsFeature.noActiveSurveys.cannotShowForesights,values:{locations:e.jsx("b",{children:P(t.categoriesWithInactiveSurveys,t.honIntl)}),link_to_subscriptions:e.jsx("a",{href:I.SUBSCRIPTIONS,children:e.jsx(h,{id:u.Subscriptions.info.how_to_manage.link_to_subscriptions})}),link_to_foresights_help_center:e.jsx("a",{href:ne.foresights,children:e.jsx(h,{id:u.General.helpCenter.linkText})})}}})}function bt(t){return e.jsxs(Rt,{variant:"button",color:"primary",className:t.className,onClick:t.onClick,children:[e.jsx(Je,{}),e.jsx(h,{id:k.General.Back})]})}function It(t){return e.jsxs("div",{className:t.className,children:[e.jsx(j,{variant:"body1",color:"textSecondary",className:"dateRange",children:e.jsx(h,{text:{id:u.General.timeFrame.dateUntilToday,values:{date:Ve(t.startDate)}}})}),e.jsx(re,{text:{id:u.Listing.loadMore},onClick:t.onClick,variant:"contained"}),e.jsx(j,{variant:"body1",className:"loadMore",children:e.jsx(h,{id:u.General.loading.loadThreeMOreMonths})})]})}const Tt=C(Ue)`
39  &&& {
40    .topNavTitle {
41      flex-grow: 1;
42      text-align: center;
43    }
44  }
45`,kt=C.div`
46  margin: 24px 0;
47  text-align: center;
48`,wt=C(We)`
49  margin-top: 8px;
50`,Rt=C(j)`
51  && {
52    display: flex;
53    align-items: center;
54    margin-top: 16px;
55    cursor: pointer;
56  }
57`,Mt=C(It)`
58  display: flex;
59  flex-direction: column;
60  align-items: center;
61  .dateRange,
62  .loadMore {
63    padding: 8px;
64  }
65  .dateRange {
66    padding-bottom: 16px;
67  }
68`;export{hs as default};

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.