ghost 6.17.0 → 6.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/tryghost-i18n-6.17.1.tgz +0 -0
- package/components/{tryghost-parse-email-address-6.17.0.tgz → tryghost-parse-email-address-6.17.1.tgz} +0 -0
- package/core/built/admin/assets/{PolarAngleAxis-sYvwhg8d.js → PolarAngleAxis-DVj7Sw2n.js} +1 -1
- package/core/built/admin/assets/{_baseAssignValue-DKQ9pw63.js → _baseAssignValue-CrCkbXur.js} +1 -1
- package/core/built/admin/assets/{a-large-small-CCJbivJB.js → a-large-small-BLquRSNr.js} +1 -1
- package/core/built/admin/assets/admin-x-settings/admin-x-settings.js +2 -2
- package/core/built/admin/assets/admin-x-settings/{code-editor-view-CdDTmDO_.mjs → code-editor-view-BzvYs1fs.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/{index-D19Kl7F3.mjs → index-BXChUyr6.mjs} +5703 -5668
- package/core/built/admin/assets/admin-x-settings/{index-NuuHxngw.mjs → index-DYEF3NiM.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/{index-DWAeZxhW.mjs → index-DdMo_pvD.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/{modals-C-PAZhri.mjs → modals-Ck3AHDx3.mjs} +8065 -8057
- package/core/built/admin/assets/{at-sign-BpRvqAQI.js → at-sign-Cj4_ORaa.js} +1 -1
- package/core/built/admin/assets/{audience-DyCuv1si.js → audience-ACTBvUSt.js} +1 -1
- package/core/built/admin/assets/{avatar-flipboard-BfziFfAR.js → avatar-flipboard-BeKL4BEF.js} +1 -1
- package/core/built/admin/assets/{bluesky-sharing-D-LC_G4e.js → bluesky-sharing-CP7ej5rz.js} +1 -1
- package/core/built/admin/assets/{chart-BvckKrZJ.js → chart-B6jk72FT.js} +1 -1
- package/core/built/admin/assets/{chunk.524.c76823170fc310a35d9a.js → chunk.524.6c12997c856012ea06f5.js} +7 -7
- package/core/built/admin/assets/{chunk.582.78cee8a07d88a486d8d3.js → chunk.582.a0abd5b93eb1bc50335a.js} +10 -10
- package/core/built/admin/assets/{code-editor-view-BEwQJYgg.js → code-editor-view-CVRtsOBM.js} +1 -1
- package/core/built/admin/assets/{comments-1fqIGh0f.js → comments-CxjhZH_T.js} +1 -1
- package/core/built/admin/assets/{copy-BywnwlHN.js → copy-YhtJexiS.js} +1 -1
- package/core/built/admin/assets/{data-list--hSCIzLC.js → data-list-BPSXm3ej.js} +1 -1
- package/core/built/admin/assets/{deleted-feed-item-DYKurQBy.js → deleted-feed-item-D8BHDEHh.js} +1 -1
- package/core/built/admin/assets/{edit-profile-yzEMlJ_t.js → edit-profile-FrkkXMG7.js} +1 -1
- package/core/built/admin/assets/{empty-indicator-1p7S45xr.js → empty-indicator-SsCyCd50.js} +1 -1
- package/core/built/admin/assets/{en-DtAty2DP.js → en-ZWZBSdFY.js} +1 -1
- package/core/built/admin/assets/{feed-DB25J9B-.js → feed-BvVJCTy8.js} +1 -1
- package/core/built/admin/assets/{filters-cN8zP798.js → filters-BupJ4mUj.js} +1 -1
- package/core/built/admin/assets/{gh-chart-CVItDGhq.js → gh-chart-Dp9VXeON.js} +1 -1
- package/core/built/admin/assets/{ghost-f424e37f7e8f90122e3a13866d2b1f91.css → ghost-78b420974adc056bf1c9570275a46535.css} +1 -1
- package/core/built/admin/assets/{ghost-10e648bbdbb5f2e55418e88f15d302e2.js → ghost-a9268074d0a9b02198594a05ecd7a626.js} +2 -2
- package/core/built/admin/assets/{growth-Lbkwu9SJ.js → growth-CRDHOGrZ.js} +1 -1
- package/core/built/admin/assets/{hash-BQl75WLf.js → hash-CPAX2PwN.js} +1 -1
- package/core/built/admin/assets/{inbox-BMxFzv7J.js → inbox-DuT2edmx.js} +1 -1
- package/core/built/admin/assets/{index-oARkCq-e.js → index--Nwo3958.js} +1 -1
- package/core/built/admin/assets/{index-SafJnMjy.js → index-8ECl7z0l.js} +1 -1
- package/core/built/admin/assets/{index-CIheyf0S.js → index-B1rQYn0h.js} +1 -1
- package/core/built/admin/assets/{index-BQ6KbriB.js → index-B2oDZJ9B.js} +1 -1
- package/core/built/admin/assets/{index-KqwA5am_.css → index-BBrewxpF.css} +1 -1
- package/core/built/admin/assets/{index-oanahlHO.js → index-BPYePamp.js} +1 -1
- package/core/built/admin/assets/{index-8pnhFllL.js → index-BX3kQzlo.js} +1 -1
- package/core/built/admin/assets/{index-CoyIDbjB.js → index-BwUQiVrX.js} +1 -1
- package/core/built/admin/assets/{index-C5Mf4zlN.js → index-ByYZ5TiM.js} +1 -1
- package/core/built/admin/assets/{index-DG5ENBXM.js → index-CQP2hNBo.js} +1 -1
- package/core/built/admin/assets/{index-voIsrI4j.js → index-CeFAaI2v.js} +1 -1
- package/core/built/admin/assets/{index-DQny1_Ij.js → index-CjzFwwKZ.js} +1 -1
- package/core/built/admin/assets/{index-DR3xU0-B.js → index-Dk-Wh_Fw.js} +1 -1
- package/core/built/admin/assets/{index-C6_sy_zU.js → index-DnY4rls4.js} +1 -1
- package/core/built/admin/assets/{index-BrYABbTV.js → index-bl5YmBtG.js} +1 -1
- package/core/built/admin/assets/{index-BeAhXwae.js → index-exFCQBCk.js} +9 -9
- package/core/built/admin/assets/{koenig-lexical-uhDY2cN7.js → koenig-lexical-eRS1y7PS.js} +1 -1
- package/core/built/admin/assets/{kpi-card-DieTCZ1Z.js → kpi-card-DShFKtte.js} +1 -1
- package/core/built/admin/assets/{kpis-Dg2Sav4t.js → kpis-Bxyr_zYY.js} +1 -1
- package/core/built/admin/assets/{label-Cs4FoZGu.js → label-hgdYQhmm.js} +1 -1
- package/core/built/admin/assets/{links-DwbtAH6y.js → links-5NNDFN65.js} +1 -1
- package/core/built/admin/assets/{lucide-react-CTYGYE5A.js → lucide-react-f58FO8MB.js} +1 -1
- package/core/built/admin/assets/{main-layout-DgFdHzFw.js → main-layout-BDz_2UZs.js} +1 -1
- package/core/built/admin/assets/{message-square-text-42zfcaLO.js → message-square-text-6dTKbQKA.js} +1 -1
- package/core/built/admin/assets/{minus-vbx9q5AE.js → minus-D2C19Fiu.js} +1 -1
- package/core/built/admin/assets/{modals-B1LK0GFs.js → modals-DzetQgXf.js} +2 -2
- package/core/built/admin/assets/{moderation-DBHou9Tg.js → moderation-87QsKbyf.js} +1 -1
- package/core/built/admin/assets/{newsletter-C_C5cbBQ.js → newsletter-BhI9Lgkn.js} +1 -1
- package/core/built/admin/assets/{newsletters-COhRGj2b.js → newsletters-adLgF_Re.js} +1 -1
- package/core/built/admin/assets/{note-Bs7yEUc9.js → note-BbPR57Yw.js} +1 -1
- package/core/built/admin/assets/{overview-DgkHUK_G.js → overview-CqyRlIVM.js} +1 -1
- package/core/built/admin/assets/{pagemenu-aMfaU2cA.js → pagemenu-DlQF5jN4.js} +1 -1
- package/core/built/admin/assets/{post-analytics-BFOeo-LR.js → post-analytics-BudH7GCA.js} +1 -1
- package/core/built/admin/assets/{post-analytics-context-BR5b-9nb.js → post-analytics-context-CxuzZluw.js} +1 -1
- package/core/built/admin/assets/{post-analytics-header-Cj_Vf_UF.js → post-analytics-header-BV_8onIF.js} +1 -1
- package/core/built/admin/assets/{post-share-modal-CP1NDQhS.js → post-share-modal-CnM21JFK.js} +1 -1
- package/core/built/admin/assets/{posts-BQJit53V.js → posts-C5zAbpdG.js} +1 -1
- package/core/built/admin/assets/{repeat-DBbPJ4Vq.js → repeat-BbSnXois.js} +1 -1
- package/core/built/admin/assets/{reply-DlcWrPL1.js → reply-CuCJJfZj.js} +1 -1
- package/core/built/admin/assets/{select-wir-gl-P.js → select-Bv-dkHeU.js} +1 -1
- package/core/built/admin/assets/{settings-CpDtcACU.js → settings-Cit2-dRQ.js} +25 -25
- package/core/built/admin/assets/{settings-CtzZEQJ2.js → settings-wlK_oNsg.js} +1 -1
- package/core/built/admin/assets/{sort-button-CecMSgfo.js → sort-button-Dmyldyzm.js} +1 -1
- package/core/built/admin/assets/{source-icon-CveBuH3b.js → source-icon-DjyV6RS6.js} +1 -1
- package/core/built/admin/assets/{sprout-Beunj00B.js → sprout-jOQR37se.js} +1 -1
- package/core/built/admin/assets/{square-DTB79BvA.js → square-IrYxuAJL.js} +1 -1
- package/core/built/admin/assets/{stats-C2A4PNUn.js → stats-C4LbW8IV.js} +1 -1
- package/core/built/admin/assets/{stats-view-XXduvFiP.js → stats-view-BwaLDryw.js} +1 -1
- package/core/built/admin/assets/{step-1-Dhctc4sb.js → step-1-C0QApeYD.js} +1 -1
- package/core/built/admin/assets/{step-2-CfG-dkZM.js → step-2-h0b6Njyb.js} +1 -1
- package/core/built/admin/assets/{step-3-D_7ttapi.js → step-3-CaM-Hz3F.js} +1 -1
- package/core/built/admin/assets/{table-D-JhwxMn.js → table-P4FGxGxN.js} +1 -1
- package/core/built/admin/assets/{tabs-DvTZ848X.js → tabs-Cj65mCsJ.js} +1 -1
- package/core/built/admin/assets/{tags-Pad-cSDy.js → tags-CDvEkvxr.js} +1 -1
- package/core/built/admin/assets/{tags-dgsPPBjR.js → tags-Dnv6zTag.js} +1 -1
- package/core/built/admin/assets/{tiers-DFi-MWJ-.js → tiers-Y3OCOT03.js} +1 -1
- package/core/built/admin/assets/{toggle-group-DMvy3Ce1.js → toggle-group-kZZo_vdJ.js} +1 -1
- package/core/built/admin/assets/{topic-filter-Is3xj8qt.js → topic-filter-Cn1_Z9I7.js} +1 -1
- package/core/built/admin/assets/{trash-CT37Asdf.js → trash-ln90Rlgi.js} +1 -1
- package/core/built/admin/assets/{url-helpers-Bf57BBzr.js → url-helpers-B5_oMSPb.js} +1 -1
- package/core/built/admin/assets/{use-growth-stats-DXoeaAKq.js → use-growth-stats-DQsJauHH.js} +1 -1
- package/core/built/admin/assets/{use-infinite-virtual-scroll-COKeWLQm.js → use-infinite-virtual-scroll-4OIpSNMH.js} +1 -1
- package/core/built/admin/assets/{use-simple-pagination-BQBxprZe.js → use-simple-pagination-BedA-MMT.js} +1 -1
- package/core/built/admin/assets/{user-round-check-C5Iux98g.js → user-round-check-CYI147XP.js} +1 -1
- package/core/built/admin/assets/{wallet-cards-Hfikexmn.js → wallet-cards-xpilOd6G.js} +1 -1
- package/core/built/admin/assets/{web-B-GYQeG7.js → web-VPMnLvnh.js} +1 -1
- package/core/built/admin/index.html +6 -6
- package/package.json +5 -5
- package/components/tryghost-i18n-6.17.0.tgz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,aS as be,aR as xe,by as Se,bz as je,B as oe,bA as _e,bB as Ce,bC as Ne,bD as ve,ch as Le,aj as ye,ai as Te,aU as Ee,r as l,ci as Fe,aT as J,bK as Oe,af as ne,ag as $,cj as ke,bG as De,aP as Ae,u as Ie,aV as Me,aQ as Pe}from"./index-BeAhXwae.js";import{S as we,a as Ue,b as Ve,c as Re,d as Be,e as ze,f as Ke}from"./select-wir-gl-P.js";import{u as H,S as ie,a as re,A as Z,b as z,c as q,U as le}from"./post-analytics-context-BR5b-9nb.js";import{a as $e,F as Ge,b as He}from"./message-square-text-42zfcaLO.js";import{g as We,a as Qe,S as Ye,b as qe}from"./kpis-Dg2Sav4t.js";import{F as Xe,c as W,e as ce}from"./en-DtAty2DP.js";import{C as ue,a as Je,b as Ze,f as et,c as de,g as tt,u as K,j as ee}from"./pagemenu-aMfaU2cA.js";import{D as st,h as at,i as te,a as ot,b as nt,c as it,d as rt,e as lt,f as ct,g as ut}from"./data-list--hSCIzLC.js";import{a as dt,U as mt}from"./wallet-cards-Hfikexmn.js";import{P as pt,a as ht}from"./post-analytics-header-Cj_Vf_UF.js";import{F as gt,c as ft}from"./filters-cN8zP798.js";import{b as bt,c as xt,F as St,d as jt,S as _t,T as Ct}from"./lucide-react-CTYGYE5A.js";import{E as Nt}from"./empty-indicator-1p7S45xr.js";import"./posts-BQJit53V.js";import"./source-icon-CveBuH3b.js";import"./source-utils-B1S3ZHA2.js";import"./gh-chart-CVItDGhq.js";import"./chart-BvckKrZJ.js";import"./_baseAssignValue-DKQ9pw63.js";import"./tabs-DvTZ848X.js";import"./index-C6_sy_zU.js";import"./post-share-modal-CP1NDQhS.js";import"./post-helpers-gInwAwEv.js";import"./trash-CT37Asdf.js";import"./sprout-Beunj00B.js";import"./a-large-small-CCJbivJB.js";import"./at-sign-BpRvqAQI.js";import"./copy-BywnwlHN.js";import"./hash-BQl75WLf.js";import"./inbox-BMxFzv7J.js";import"./minus-vbx9q5AE.js";import"./tags-dgsPPBjR.js";import"./square-DTB79BvA.js";import"./user-round-check-C5Iux98g.js";import"./repeat-DBbPJ4Vq.js";import"./reply-DlcWrPL1.js";const se=()=>{const{range:e,setRange:s}=H();return t.jsxs(we,{value:`${e}`,onValueChange:a=>{s(Number(a))},children:[t.jsxs(Ue,{className:"w-auto",children:[t.jsx($e,{className:"mr-2",size:16,strokeWidth:1.5}),t.jsx(Ve,{placeholder:"Select a period"})]}),t.jsx(Re,{align:"end",children:t.jsxs(Be,{children:[t.jsx(ze,{children:"Period"}),Object.values(ie).map(a=>t.jsx(Ke,{value:`${a.value}`,children:a.name},a.value))]})})]})};W.registerLocale(ce);const vt=e=>re[e]||W.getName(e,"en")||"Unknown",Lt=e=>{const s={"UNITED STATES":"US","UNITED STATES OF AMERICA":"US",USA:"US","UNITED KINGDOM":"GB",UK:"GB","GREAT BRITAIN":"GB",NETHERLANDS:"NL"},a=e.toUpperCase();return s[a]||(e.length>2?e.substring(0,2):e)},ae=({tableHeader:e,data:s,onLocationClick:a})=>t.jsxs(st,{children:[e&&t.jsxs(at,{children:[t.jsx(te,{children:"Country"}),t.jsx(te,{children:"Visitors"})]}),t.jsx(ot,{children:s.map(i=>{const o=vt(`${i.location}`),r=a&&i.location!=="Unknown",c=i.location?i.location.toLowerCase():"unknown";return t.jsxs(nt,{className:r?"cursor-pointer":"","data-testid":`location-row-${c}`,onClick:r?()=>a(i.location):void 0,children:[t.jsx(it,{style:{width:`${i.percentage?Math.round(i.percentage*100):0}%`}}),t.jsx(rt,{className:"group-hover/data:max-w-[calc(100%-140px)]",children:t.jsxs("div",{className:"flex items-center space-x-3 overflow-hidden",title:o,children:[t.jsx(Xe,{countryCode:`${Lt(i.location)}`,fallback:t.jsx("span",{className:"flex h-[14px] w-[22px] items-center justify-center rounded-[2px] bg-black text-white",children:t.jsx(Le.SkullAndBones,{className:"size-3"})})}),t.jsx("div",{className:"truncate font-medium",children:o})]})}),t.jsxs(lt,{children:[t.jsx(ct,{children:ye(Number(i.visits))}),t.jsx(ut,{children:Te(i.percentage)})]})]},i.location||"unknown")})})]}),yt=({data:e,isLoading:s,onLocationClick:a})=>{const i=e.slice(0,10);return t.jsx(t.Fragment,{children:s?"":t.jsx(t.Fragment,{children:e&&e.length>0&&t.jsxs(ue,{className:"group/datalist","data-testid":"locations-card",children:[t.jsxs("div",{className:"flex items-center justify-between p-6",children:[t.jsxs(Je,{className:"p-0",children:[t.jsx(Ze,{children:"Locations"}),t.jsx(et,{children:"Where are the readers of this post"})]}),t.jsx(be,{className:"mr-2",children:"Visitors"})]}),t.jsxs(de,{className:"overflow-hidden",children:[t.jsx(xe,{}),t.jsx(ae,{data:i,tableHeader:!1,onLocationClick:a})]}),e.length>10&&t.jsx(tt,{children:t.jsxs(Se,{children:[t.jsx(je,{asChild:!0,children:t.jsxs(oe,{variant:"outline",children:["View all ",t.jsx(dt,{})]})}),t.jsxs(_e,{className:"overflow-y-auto pt-0 sm:max-w-[600px]",children:[t.jsxs(Ce,{className:"sticky top-0 z-40 -mx-6 bg-background/60 p-6 backdrop-blur",children:[t.jsx(Ne,{children:"Top locations"}),t.jsx(ve,{children:"Where are the readers of this post"})]}),t.jsx("div",{className:"group/datalist",children:t.jsx(ae,{data:e,tableHeader:!0,onLocationClick:a})})]})]})})]})})})},me=e=>!e||e.length===0?Z:z.filter(s=>e.includes(s.value)).reduce((s,a)=>s|a.bit,0)||Z,pe=e=>{const s=[];return(e&q.PUBLIC)!==0&&s.push(z[0].value),(e&q.FREE)!==0&&s.push(z[1].value),(e&q.PAID)!==0&&s.push(z[2].value),s.join(",")};W.registerLocale(ce);const Tt=e=>re[e]||W.getName(e,"en")||e,Et=({visits:e})=>t.jsx("span",{className:"order-2 font-mono text-xs text-muted-foreground",children:e.toLocaleString()}),Ft={utm_source:{endpoint:"api_top_utm_sources",valueKey:"utm_source",transformValue:e=>({value:e||"(not set)",label:e||"(not set)"})},utm_medium:{endpoint:"api_top_utm_mediums",valueKey:"utm_medium",transformValue:e=>({value:e||"(not set)",label:e||"(not set)"})},utm_campaign:{endpoint:"api_top_utm_campaigns",valueKey:"utm_campaign",transformValue:e=>({value:e||"(not set)",label:e||"(not set)"})},utm_content:{endpoint:"api_top_utm_contents",valueKey:"utm_content",transformValue:e=>({value:e||"(not set)",label:e||"(not set)"})},utm_term:{endpoint:"api_top_utm_terms",valueKey:"utm_term",transformValue:e=>({value:e||"(not set)",label:e||"(not set)"})},source:{endpoint:"api_top_sources",valueKey:"source",transformValue:e=>({value:e||"",label:e||"Direct"})},location:{endpoint:"api_top_locations",valueKey:"location",filterItem(e){const s=String(e.location||"");return s!==""&&!le.includes(s)},transformValue:e=>({value:e,label:Tt(e)})},device:{endpoint:"api_top_devices",valueKey:"device",transformValue:e=>({value:e,label:e==="mobile-ios"?"iOS":e==="mobile-android"?"Android":e==="desktop"?"Desktop":e==="bot"?"Bot":e})}},Ot=(e,s,a)=>{const i={...a};return e.forEach(o=>{if(o.field===s||o.values.length===0)return;const r=o.values[0];o.field!=="audience"&&(o.field==="source"||o.field==="device"||o.field==="location"||o.field.startsWith("utm_"))&&(i[o.field]=r)}),i},O=(e,s=[],a,i={})=>{const{enabled:o=!0}=i,{statsConfig:r,range:c}=H(),{startDate:b,endDate:m,timezone:x}=ne(c),p=Ft[e],d=l.useMemo(()=>{const j=s.find(h=>h.field==="audience");return me(j?.values)},[s]),S=l.useMemo(()=>{const j={site_uuid:r?.id||"",date_from:$(b),date_to:$(m),timezone:x,member_status:pe(d),limit:"50"};return a&&(j.post_uuid=a),Ot(s,e,j)},[r?.id,b,m,x,d,s,e,a]),{data:v,loading:k}=K({endpoint:p?.endpoint||"",statsConfig:r,params:S,enabled:o&&!!p});return{options:l.useMemo(()=>p?(v||[]).filter(h=>p.filterItem?p.filterItem(h):!0).map(h=>{const E=String(h[p.valueKey]??""),M=Number(h.visits)||0,{value:F,label:y}=p.transformValue?p.transformValue(E):{value:E,label:E};return{label:y,value:F,icon:t.jsx(Et,{visits:M})}}):[],[v,p]),loading:k}};function kt({filters:e,onChange:s,...a}){const{appSettings:i}=Ee(),{post:o}=H(),r=o?.uuid,[c,b]=l.useState(null),[m,x]=l.useState(!1);l.useEffect(()=>{const g=window.matchMedia("(max-width: 1024px)"),C=T=>{x(T.matches)};return C(g),g.addEventListener("change",C),()=>g.removeEventListener("change",C)},[]);const p=l.useMemo(()=>{const g=[{value:"undefined",label:"Public visitors",icon:t.jsx(J,{className:"text-gray-700"})},{value:"free",label:"Free members",icon:t.jsx(Oe,{className:"text-green"})},{value:"paid",label:"Paid members",icon:t.jsx(mt,{className:"text-orange"})}];return i?.paidMembersEnabled?g:g.filter(C=>C.value!=="paid")},[i?.paidMembersEnabled]),d=l.useCallback(g=>{const C=c===g,T=e.some(n=>n.field===g);return C||T},[c,e]),{options:S,loading:v}=O("utm_source",e,r,{enabled:d("utm_source")}),{options:k,loading:I}=O("utm_medium",e,r,{enabled:d("utm_medium")}),{options:j,loading:h}=O("utm_campaign",e,r,{enabled:d("utm_campaign")}),{options:E,loading:M}=O("utm_content",e,r,{enabled:d("utm_content")}),{options:F,loading:y}=O("utm_term",e,r,{enabled:d("utm_term")}),{options:R,loading:D}=O("source",e,r,{enabled:d("source")}),{options:U,loading:A}=O("device",e,r,{enabled:d("device")}),{options:B,loading:P}=O("location",e,r,{enabled:d("location")}),_=l.useMemo(()=>[{value:"is",label:"is"}],[]),Q=l.useMemo(()=>{const g=[{key:"utm_source",label:"UTM Source",type:"select",icon:t.jsx(jt,{className:"size-4"}),placeholder:"Select source",operators:_,defaultOperator:"is",hideOperatorSelect:!0,options:S,isLoading:v,searchable:!0,selectedOptionsClassName:"hidden"},{key:"utm_medium",label:"UTM Medium",type:"select",icon:t.jsx(_t,{className:"size-4"}),placeholder:"Select medium",operators:_,defaultOperator:"is",hideOperatorSelect:!0,options:k,isLoading:I,className:"w-60",popoverContentClassName:"w-60",searchable:!0,selectedOptionsClassName:"hidden"},{key:"utm_campaign",label:"UTM Campaign",type:"select",icon:t.jsx(He,{className:"size-4"}),placeholder:"Select campaign",operators:_,defaultOperator:"is",hideOperatorSelect:!0,options:j,isLoading:h,className:"w-60",popoverContentClassName:"w-60",searchable:!0,selectedOptionsClassName:"hidden"},{key:"utm_content",label:"UTM Content",type:"select",icon:t.jsx(Ct,{className:"size-4"}),placeholder:"Select content",operators:_,defaultOperator:"is",hideOperatorSelect:!0,options:E,isLoading:M,className:"w-60",popoverContentClassName:"w-60",searchable:!0,selectedOptionsClassName:"hidden"},{key:"utm_term",label:"UTM Term",type:"select",icon:t.jsx(ke,{className:"size-4"}),placeholder:"Select term",operators:_,defaultOperator:"is",hideOperatorSelect:!0,options:F,isLoading:y,className:"w-60",popoverContentClassName:"w-60",searchable:!0,selectedOptionsClassName:"hidden"}];return[{group:"Basic",fields:[{key:"audience",label:"Audience",type:"multiselect",icon:t.jsx(Fe,{}),options:p.map(({value:C,label:T,icon:n})=>({value:C,label:T,icon:n})),defaultOperator:"is any of",hideOperatorSelect:!0,autoCloseOnSelect:!0},{key:"source",label:"Source",type:"select",icon:t.jsx(J,{className:"size-4"}),placeholder:"Select source",operators:_,defaultOperator:"is",hideOperatorSelect:!0,options:R,isLoading:D,className:"w-60",popoverContentClassName:"w-60",searchable:!0,selectedOptionsClassName:"hidden"},{key:"device",label:"Device",type:"select",icon:t.jsx(bt,{className:"size-4"}),placeholder:"Select device",operators:_,defaultOperator:"is",hideOperatorSelect:!0,options:U,isLoading:A,selectedOptionsClassName:"hidden"},{key:"location",label:"Location",type:"select",icon:t.jsx(xt,{className:"size-4"}),placeholder:"Select location",operators:_,defaultOperator:"is",hideOperatorSelect:!0,options:B,isLoading:P,searchable:!0,selectedOptionsClassName:"hidden"}]},{group:"UTM parameters",fields:g}]},[S,v,k,I,j,h,E,M,F,y,_,p,R,D,U,A,B,P]),w=e.length>0,Y=l.useCallback(()=>{s&&s([])},[s]);return t.jsxs("div",{className:"mt-3 flex w-full justify-between gap-2 lg:mt-0","data-testid":"stats-filter-container",children:[t.jsx(gt,{addButtonIcon:t.jsx(Ge,{}),addButtonText:w?"Add filter":"Filter",allowMultiple:!1,className:`[&>button]:order-last ${w&&"[&>button]:border-none"}`,fields:Q,filters:e,keyboardShortcut:"f",popoverAlign:m||w?"start":"end",showSearchInput:!1,onActiveFieldChange:b,onChange:s||(()=>{}),...a}),w&&t.jsxs(oe,{className:"hidden font-normal text-muted-foreground lg:flex","data-testid":"stats-filter-clear-button",variant:"ghost",onClick:Y,children:[t.jsx(St,{}),"Clear"]})]})}const G=["audience","source","device","location","utm_source","utm_medium","utm_campaign","utm_content","utm_term"],he="__empty__",ge="%2C";function Dt(e){const s=new URLSearchParams;return e.forEach(a=>{if(G.includes(a.field)&&a.values.length>0){const i=a.values.map(o=>o===""?he:String(o).replace(/,/g,ge)).join(",");s.set(a.field,i)}}),s}const X=new Map;function At(e){return X.has(e)||X.set(e,`url-${e}-${Date.now()}-${Math.random().toString(36).substring(2,11)}`),X.get(e)}function It(e){const s=[],a=new Set(G);return e.forEach((i,o)=>{if(!a.has(o))return;const r=i.split(",").map(c=>c===he?"":c.replace(new RegExp(ge,"g"),","));if(r.length>0){const c=o==="audience"?"is any of":"is";s.push({id:At(o),field:o,operator:c,values:r})}}),s}function Mt(e={}){const[s,a]=De(),{onFiltersChange:i}=e,o=l.useRef(!1),r=l.useMemo(()=>It(s),[s]);l.useEffect(()=>{!o.current&&i&&i(r)},[r,i]);const c=l.useCallback(m=>{o.current=!0;const x=typeof m=="function"?m(r):m,p=Dt(x),d=new URLSearchParams(s);G.forEach(S=>{d.delete(S)}),p.forEach((S,v)=>{d.set(v,S)}),a(d,{replace:!0}),setTimeout(()=>{o.current=!1},0)},[r,s,a]),b=l.useCallback(()=>{o.current=!0;const m=new URLSearchParams(s);G.forEach(x=>{m.delete(x)}),a(m,{replace:!0}),setTimeout(()=>{o.current=!1},0)},[s,a]);return{filters:r,setFilters:c,clearFilters:b}}const xs=()=>{const e=Ae(),{postId:s}=Ie(),{statsConfig:a,isLoading:i,range:o,data:r,post:c,isPostLoading:b}=H(),{filters:m,setFilters:x}=Mt(),p=l.useMemo(()=>{const n=m.find(f=>f.field==="audience");return me(n?.values)},[m]);l.useEffect(()=>{!b&&c?.email_only&&e(`/posts/analytics/${s}`)},[b,c?.email_only,e,s]);const d=l.useMemo(()=>{if(!c?.published_at)return ie.ALL_TIME.value;const n=Me(c.published_at);return o>n?n:o},[c?.published_at,o]),{startDate:S,endDate:v,timezone:k}=ne(d),I=l.useCallback(()=>{const n=document.querySelector(".overflow-y-scroll");n&&n.scrollTo({top:0,behavior:"smooth"})},[]),j=l.useMemo(()=>{const n={};return m.forEach(f=>{const N=f.field,L=f.values;if(N==="audience")return;const u=L&&L.length>0&&L[0]!==null&&L[0]!==void 0,V=N==="source"&&L?.[0]==="";if(u&&(L[0]!==""||V)){const fe=String(L[0]);n[N]=fe}}),n},[m]),h=l.useCallback((n,f)=>{x(N=>N.find(u=>u.field===n)?N.map(u=>u.field===n?{...u,values:[f]}:u):[...N,ft(n,"is",[f])]),I()},[x,I]),E=l.useCallback(n=>h("location",n),[h]),M=l.useCallback(n=>h("source",n),[h]),F=l.useMemo(()=>{const n={site_uuid:a?.id||"",date_from:$(S),date_to:$(v),timezone:k,member_status:pe(p),post_uuid:"",...j};return!b&&c?.uuid?{...n,post_uuid:c.uuid}:n},[b,c,a?.id,S,v,k,p,j]),{data:y,loading:R}=K({endpoint:"api_kpis",statsConfig:a||{id:""},params:F}),{data:D,loading:U}=K({endpoint:"api_top_locations",statsConfig:a||{id:""},params:F}),{data:A,loading:B}=K({endpoint:"api_top_sources",statsConfig:a||{id:""},params:F}),P=l.useMemo(()=>D?.reduce((n,f)=>n+Number(f.visits),0)||0,[D]),_=l.useMemo(()=>A?A.reduce((n,f)=>n+Number(f.visits||0),0):0,[A]),Q=r?.url,w=r?.icon,Y=l.useMemo(()=>{const n=D?.map(u=>({location:String(u.location),visits:Number(u.visits),percentage:P>0?Number(u.visits)/P:0,isUnknown:le.includes(String(u.location))}))||[],f=n.filter(u=>!u.isUnknown),N=n.filter(u=>u.isUnknown),L=N.length>0?[{location:"Unknown",visits:N.reduce((u,V)=>u+V.visits,0),percentage:N.reduce((u,V)=>u+V.percentage,0)}]:[];return[...f,...L]},[D,P]),g=i||b||R||U||B,C=We(y),T=m.length>0;return t.jsxs(t.Fragment,{children:[t.jsxs(pt,{currentTab:"Web",children:[T&&t.jsx(ee,{children:t.jsx(se,{})}),t.jsxs(ee,{className:`${T?"!mt-0 [grid-area:subactions] lg:!mt-[25px]":"[grid-area:actions]"}`,children:[t.jsx(kt,{filters:m,onChange:x}),!T&&t.jsx(se,{})]})]}),t.jsx(ht,{children:g?t.jsx(ue,{className:"size-full",variant:"plain",children:t.jsx(de,{className:"size-full items-center justify-center",children:t.jsx(Pe,{})})}):y&&y.length!==0&&C.visits!=="0"?t.jsxs(t.Fragment,{children:[t.jsx(Qe,{data:y,range:d}),t.jsxs("div",{className:"flex flex-col gap-6 lg:grid lg:grid-cols-2",children:[t.jsx(yt,{data:Y,isLoading:U,onLocationClick:E}),t.jsx(Ye,{data:A,range:d,siteIcon:w,siteUrl:Q,totalVisitors:_,onSourceClick:M})]})]}):t.jsx("div",{className:"grow",children:t.jsx(Nt,{className:"h-full",description:"Try adjusting filters to see more data.",title:`No visitors ${qe(o)}`,children:t.jsx(J,{strokeWidth:1.5})})})})]})};export{xs as default};
|
|
1
|
+
import{j as t,aS as be,aR as xe,by as Se,bz as je,B as oe,bA as _e,bB as Ce,bC as Ne,bD as ve,ch as Le,aj as ye,ai as Te,aU as Ee,r as l,ci as Fe,aT as J,bK as Oe,af as ne,ag as $,cj as ke,bG as De,aP as Ae,u as Ie,aV as Me,aQ as Pe}from"./index-exFCQBCk.js";import{S as we,a as Ue,b as Ve,c as Re,d as Be,e as ze,f as Ke}from"./select-Bv-dkHeU.js";import{u as H,S as ie,a as re,A as Z,b as z,c as q,U as le}from"./post-analytics-context-CxuzZluw.js";import{a as $e,F as Ge,b as He}from"./message-square-text-6dTKbQKA.js";import{g as We,a as Qe,S as Ye,b as qe}from"./kpis-Bxyr_zYY.js";import{F as Xe,c as W,e as ce}from"./en-ZWZBSdFY.js";import{C as ue,a as Je,b as Ze,f as et,c as de,g as tt,u as K,j as ee}from"./pagemenu-DlQF5jN4.js";import{D as st,h as at,i as te,a as ot,b as nt,c as it,d as rt,e as lt,f as ct,g as ut}from"./data-list-BPSXm3ej.js";import{a as dt,U as mt}from"./wallet-cards-xpilOd6G.js";import{P as pt,a as ht}from"./post-analytics-header-BV_8onIF.js";import{F as gt,c as ft}from"./filters-BupJ4mUj.js";import{b as bt,c as xt,F as St,d as jt,S as _t,T as Ct}from"./lucide-react-f58FO8MB.js";import{E as Nt}from"./empty-indicator-SsCyCd50.js";import"./posts-C5zAbpdG.js";import"./source-icon-DjyV6RS6.js";import"./source-utils-B1S3ZHA2.js";import"./gh-chart-Dp9VXeON.js";import"./chart-B6jk72FT.js";import"./_baseAssignValue-CrCkbXur.js";import"./tabs-Cj65mCsJ.js";import"./index-DnY4rls4.js";import"./post-share-modal-CnM21JFK.js";import"./post-helpers-gInwAwEv.js";import"./trash-ln90Rlgi.js";import"./sprout-jOQR37se.js";import"./a-large-small-BLquRSNr.js";import"./at-sign-Cj4_ORaa.js";import"./copy-YhtJexiS.js";import"./hash-CPAX2PwN.js";import"./inbox-DuT2edmx.js";import"./minus-D2C19Fiu.js";import"./tags-Dnv6zTag.js";import"./square-IrYxuAJL.js";import"./user-round-check-CYI147XP.js";import"./repeat-BbSnXois.js";import"./reply-CuCJJfZj.js";const se=()=>{const{range:e,setRange:s}=H();return t.jsxs(we,{value:`${e}`,onValueChange:a=>{s(Number(a))},children:[t.jsxs(Ue,{className:"w-auto",children:[t.jsx($e,{className:"mr-2",size:16,strokeWidth:1.5}),t.jsx(Ve,{placeholder:"Select a period"})]}),t.jsx(Re,{align:"end",children:t.jsxs(Be,{children:[t.jsx(ze,{children:"Period"}),Object.values(ie).map(a=>t.jsx(Ke,{value:`${a.value}`,children:a.name},a.value))]})})]})};W.registerLocale(ce);const vt=e=>re[e]||W.getName(e,"en")||"Unknown",Lt=e=>{const s={"UNITED STATES":"US","UNITED STATES OF AMERICA":"US",USA:"US","UNITED KINGDOM":"GB",UK:"GB","GREAT BRITAIN":"GB",NETHERLANDS:"NL"},a=e.toUpperCase();return s[a]||(e.length>2?e.substring(0,2):e)},ae=({tableHeader:e,data:s,onLocationClick:a})=>t.jsxs(st,{children:[e&&t.jsxs(at,{children:[t.jsx(te,{children:"Country"}),t.jsx(te,{children:"Visitors"})]}),t.jsx(ot,{children:s.map(i=>{const o=vt(`${i.location}`),r=a&&i.location!=="Unknown",c=i.location?i.location.toLowerCase():"unknown";return t.jsxs(nt,{className:r?"cursor-pointer":"","data-testid":`location-row-${c}`,onClick:r?()=>a(i.location):void 0,children:[t.jsx(it,{style:{width:`${i.percentage?Math.round(i.percentage*100):0}%`}}),t.jsx(rt,{className:"group-hover/data:max-w-[calc(100%-140px)]",children:t.jsxs("div",{className:"flex items-center space-x-3 overflow-hidden",title:o,children:[t.jsx(Xe,{countryCode:`${Lt(i.location)}`,fallback:t.jsx("span",{className:"flex h-[14px] w-[22px] items-center justify-center rounded-[2px] bg-black text-white",children:t.jsx(Le.SkullAndBones,{className:"size-3"})})}),t.jsx("div",{className:"truncate font-medium",children:o})]})}),t.jsxs(lt,{children:[t.jsx(ct,{children:ye(Number(i.visits))}),t.jsx(ut,{children:Te(i.percentage)})]})]},i.location||"unknown")})})]}),yt=({data:e,isLoading:s,onLocationClick:a})=>{const i=e.slice(0,10);return t.jsx(t.Fragment,{children:s?"":t.jsx(t.Fragment,{children:e&&e.length>0&&t.jsxs(ue,{className:"group/datalist","data-testid":"locations-card",children:[t.jsxs("div",{className:"flex items-center justify-between p-6",children:[t.jsxs(Je,{className:"p-0",children:[t.jsx(Ze,{children:"Locations"}),t.jsx(et,{children:"Where are the readers of this post"})]}),t.jsx(be,{className:"mr-2",children:"Visitors"})]}),t.jsxs(de,{className:"overflow-hidden",children:[t.jsx(xe,{}),t.jsx(ae,{data:i,tableHeader:!1,onLocationClick:a})]}),e.length>10&&t.jsx(tt,{children:t.jsxs(Se,{children:[t.jsx(je,{asChild:!0,children:t.jsxs(oe,{variant:"outline",children:["View all ",t.jsx(dt,{})]})}),t.jsxs(_e,{className:"overflow-y-auto pt-0 sm:max-w-[600px]",children:[t.jsxs(Ce,{className:"sticky top-0 z-40 -mx-6 bg-background/60 p-6 backdrop-blur",children:[t.jsx(Ne,{children:"Top locations"}),t.jsx(ve,{children:"Where are the readers of this post"})]}),t.jsx("div",{className:"group/datalist",children:t.jsx(ae,{data:e,tableHeader:!0,onLocationClick:a})})]})]})})]})})})},me=e=>!e||e.length===0?Z:z.filter(s=>e.includes(s.value)).reduce((s,a)=>s|a.bit,0)||Z,pe=e=>{const s=[];return(e&q.PUBLIC)!==0&&s.push(z[0].value),(e&q.FREE)!==0&&s.push(z[1].value),(e&q.PAID)!==0&&s.push(z[2].value),s.join(",")};W.registerLocale(ce);const Tt=e=>re[e]||W.getName(e,"en")||e,Et=({visits:e})=>t.jsx("span",{className:"order-2 font-mono text-xs text-muted-foreground",children:e.toLocaleString()}),Ft={utm_source:{endpoint:"api_top_utm_sources",valueKey:"utm_source",transformValue:e=>({value:e||"(not set)",label:e||"(not set)"})},utm_medium:{endpoint:"api_top_utm_mediums",valueKey:"utm_medium",transformValue:e=>({value:e||"(not set)",label:e||"(not set)"})},utm_campaign:{endpoint:"api_top_utm_campaigns",valueKey:"utm_campaign",transformValue:e=>({value:e||"(not set)",label:e||"(not set)"})},utm_content:{endpoint:"api_top_utm_contents",valueKey:"utm_content",transformValue:e=>({value:e||"(not set)",label:e||"(not set)"})},utm_term:{endpoint:"api_top_utm_terms",valueKey:"utm_term",transformValue:e=>({value:e||"(not set)",label:e||"(not set)"})},source:{endpoint:"api_top_sources",valueKey:"source",transformValue:e=>({value:e||"",label:e||"Direct"})},location:{endpoint:"api_top_locations",valueKey:"location",filterItem(e){const s=String(e.location||"");return s!==""&&!le.includes(s)},transformValue:e=>({value:e,label:Tt(e)})},device:{endpoint:"api_top_devices",valueKey:"device",transformValue:e=>({value:e,label:e==="mobile-ios"?"iOS":e==="mobile-android"?"Android":e==="desktop"?"Desktop":e==="bot"?"Bot":e})}},Ot=(e,s,a)=>{const i={...a};return e.forEach(o=>{if(o.field===s||o.values.length===0)return;const r=o.values[0];o.field!=="audience"&&(o.field==="source"||o.field==="device"||o.field==="location"||o.field.startsWith("utm_"))&&(i[o.field]=r)}),i},O=(e,s=[],a,i={})=>{const{enabled:o=!0}=i,{statsConfig:r,range:c}=H(),{startDate:b,endDate:m,timezone:x}=ne(c),p=Ft[e],d=l.useMemo(()=>{const j=s.find(h=>h.field==="audience");return me(j?.values)},[s]),S=l.useMemo(()=>{const j={site_uuid:r?.id||"",date_from:$(b),date_to:$(m),timezone:x,member_status:pe(d),limit:"50"};return a&&(j.post_uuid=a),Ot(s,e,j)},[r?.id,b,m,x,d,s,e,a]),{data:v,loading:k}=K({endpoint:p?.endpoint||"",statsConfig:r,params:S,enabled:o&&!!p});return{options:l.useMemo(()=>p?(v||[]).filter(h=>p.filterItem?p.filterItem(h):!0).map(h=>{const E=String(h[p.valueKey]??""),M=Number(h.visits)||0,{value:F,label:y}=p.transformValue?p.transformValue(E):{value:E,label:E};return{label:y,value:F,icon:t.jsx(Et,{visits:M})}}):[],[v,p]),loading:k}};function kt({filters:e,onChange:s,...a}){const{appSettings:i}=Ee(),{post:o}=H(),r=o?.uuid,[c,b]=l.useState(null),[m,x]=l.useState(!1);l.useEffect(()=>{const g=window.matchMedia("(max-width: 1024px)"),C=T=>{x(T.matches)};return C(g),g.addEventListener("change",C),()=>g.removeEventListener("change",C)},[]);const p=l.useMemo(()=>{const g=[{value:"undefined",label:"Public visitors",icon:t.jsx(J,{className:"text-gray-700"})},{value:"free",label:"Free members",icon:t.jsx(Oe,{className:"text-green"})},{value:"paid",label:"Paid members",icon:t.jsx(mt,{className:"text-orange"})}];return i?.paidMembersEnabled?g:g.filter(C=>C.value!=="paid")},[i?.paidMembersEnabled]),d=l.useCallback(g=>{const C=c===g,T=e.some(n=>n.field===g);return C||T},[c,e]),{options:S,loading:v}=O("utm_source",e,r,{enabled:d("utm_source")}),{options:k,loading:I}=O("utm_medium",e,r,{enabled:d("utm_medium")}),{options:j,loading:h}=O("utm_campaign",e,r,{enabled:d("utm_campaign")}),{options:E,loading:M}=O("utm_content",e,r,{enabled:d("utm_content")}),{options:F,loading:y}=O("utm_term",e,r,{enabled:d("utm_term")}),{options:R,loading:D}=O("source",e,r,{enabled:d("source")}),{options:U,loading:A}=O("device",e,r,{enabled:d("device")}),{options:B,loading:P}=O("location",e,r,{enabled:d("location")}),_=l.useMemo(()=>[{value:"is",label:"is"}],[]),Q=l.useMemo(()=>{const g=[{key:"utm_source",label:"UTM Source",type:"select",icon:t.jsx(jt,{className:"size-4"}),placeholder:"Select source",operators:_,defaultOperator:"is",hideOperatorSelect:!0,options:S,isLoading:v,searchable:!0,selectedOptionsClassName:"hidden"},{key:"utm_medium",label:"UTM Medium",type:"select",icon:t.jsx(_t,{className:"size-4"}),placeholder:"Select medium",operators:_,defaultOperator:"is",hideOperatorSelect:!0,options:k,isLoading:I,className:"w-60",popoverContentClassName:"w-60",searchable:!0,selectedOptionsClassName:"hidden"},{key:"utm_campaign",label:"UTM Campaign",type:"select",icon:t.jsx(He,{className:"size-4"}),placeholder:"Select campaign",operators:_,defaultOperator:"is",hideOperatorSelect:!0,options:j,isLoading:h,className:"w-60",popoverContentClassName:"w-60",searchable:!0,selectedOptionsClassName:"hidden"},{key:"utm_content",label:"UTM Content",type:"select",icon:t.jsx(Ct,{className:"size-4"}),placeholder:"Select content",operators:_,defaultOperator:"is",hideOperatorSelect:!0,options:E,isLoading:M,className:"w-60",popoverContentClassName:"w-60",searchable:!0,selectedOptionsClassName:"hidden"},{key:"utm_term",label:"UTM Term",type:"select",icon:t.jsx(ke,{className:"size-4"}),placeholder:"Select term",operators:_,defaultOperator:"is",hideOperatorSelect:!0,options:F,isLoading:y,className:"w-60",popoverContentClassName:"w-60",searchable:!0,selectedOptionsClassName:"hidden"}];return[{group:"Basic",fields:[{key:"audience",label:"Audience",type:"multiselect",icon:t.jsx(Fe,{}),options:p.map(({value:C,label:T,icon:n})=>({value:C,label:T,icon:n})),defaultOperator:"is any of",hideOperatorSelect:!0,autoCloseOnSelect:!0},{key:"source",label:"Source",type:"select",icon:t.jsx(J,{className:"size-4"}),placeholder:"Select source",operators:_,defaultOperator:"is",hideOperatorSelect:!0,options:R,isLoading:D,className:"w-60",popoverContentClassName:"w-60",searchable:!0,selectedOptionsClassName:"hidden"},{key:"device",label:"Device",type:"select",icon:t.jsx(bt,{className:"size-4"}),placeholder:"Select device",operators:_,defaultOperator:"is",hideOperatorSelect:!0,options:U,isLoading:A,selectedOptionsClassName:"hidden"},{key:"location",label:"Location",type:"select",icon:t.jsx(xt,{className:"size-4"}),placeholder:"Select location",operators:_,defaultOperator:"is",hideOperatorSelect:!0,options:B,isLoading:P,searchable:!0,selectedOptionsClassName:"hidden"}]},{group:"UTM parameters",fields:g}]},[S,v,k,I,j,h,E,M,F,y,_,p,R,D,U,A,B,P]),w=e.length>0,Y=l.useCallback(()=>{s&&s([])},[s]);return t.jsxs("div",{className:"mt-3 flex w-full justify-between gap-2 lg:mt-0","data-testid":"stats-filter-container",children:[t.jsx(gt,{addButtonIcon:t.jsx(Ge,{}),addButtonText:w?"Add filter":"Filter",allowMultiple:!1,className:`[&>button]:order-last ${w&&"[&>button]:border-none"}`,fields:Q,filters:e,keyboardShortcut:"f",popoverAlign:m||w?"start":"end",showSearchInput:!1,onActiveFieldChange:b,onChange:s||(()=>{}),...a}),w&&t.jsxs(oe,{className:"hidden font-normal text-muted-foreground lg:flex","data-testid":"stats-filter-clear-button",variant:"ghost",onClick:Y,children:[t.jsx(St,{}),"Clear"]})]})}const G=["audience","source","device","location","utm_source","utm_medium","utm_campaign","utm_content","utm_term"],he="__empty__",ge="%2C";function Dt(e){const s=new URLSearchParams;return e.forEach(a=>{if(G.includes(a.field)&&a.values.length>0){const i=a.values.map(o=>o===""?he:String(o).replace(/,/g,ge)).join(",");s.set(a.field,i)}}),s}const X=new Map;function At(e){return X.has(e)||X.set(e,`url-${e}-${Date.now()}-${Math.random().toString(36).substring(2,11)}`),X.get(e)}function It(e){const s=[],a=new Set(G);return e.forEach((i,o)=>{if(!a.has(o))return;const r=i.split(",").map(c=>c===he?"":c.replace(new RegExp(ge,"g"),","));if(r.length>0){const c=o==="audience"?"is any of":"is";s.push({id:At(o),field:o,operator:c,values:r})}}),s}function Mt(e={}){const[s,a]=De(),{onFiltersChange:i}=e,o=l.useRef(!1),r=l.useMemo(()=>It(s),[s]);l.useEffect(()=>{!o.current&&i&&i(r)},[r,i]);const c=l.useCallback(m=>{o.current=!0;const x=typeof m=="function"?m(r):m,p=Dt(x),d=new URLSearchParams(s);G.forEach(S=>{d.delete(S)}),p.forEach((S,v)=>{d.set(v,S)}),a(d,{replace:!0}),setTimeout(()=>{o.current=!1},0)},[r,s,a]),b=l.useCallback(()=>{o.current=!0;const m=new URLSearchParams(s);G.forEach(x=>{m.delete(x)}),a(m,{replace:!0}),setTimeout(()=>{o.current=!1},0)},[s,a]);return{filters:r,setFilters:c,clearFilters:b}}const xs=()=>{const e=Ae(),{postId:s}=Ie(),{statsConfig:a,isLoading:i,range:o,data:r,post:c,isPostLoading:b}=H(),{filters:m,setFilters:x}=Mt(),p=l.useMemo(()=>{const n=m.find(f=>f.field==="audience");return me(n?.values)},[m]);l.useEffect(()=>{!b&&c?.email_only&&e(`/posts/analytics/${s}`)},[b,c?.email_only,e,s]);const d=l.useMemo(()=>{if(!c?.published_at)return ie.ALL_TIME.value;const n=Me(c.published_at);return o>n?n:o},[c?.published_at,o]),{startDate:S,endDate:v,timezone:k}=ne(d),I=l.useCallback(()=>{const n=document.querySelector(".overflow-y-scroll");n&&n.scrollTo({top:0,behavior:"smooth"})},[]),j=l.useMemo(()=>{const n={};return m.forEach(f=>{const N=f.field,L=f.values;if(N==="audience")return;const u=L&&L.length>0&&L[0]!==null&&L[0]!==void 0,V=N==="source"&&L?.[0]==="";if(u&&(L[0]!==""||V)){const fe=String(L[0]);n[N]=fe}}),n},[m]),h=l.useCallback((n,f)=>{x(N=>N.find(u=>u.field===n)?N.map(u=>u.field===n?{...u,values:[f]}:u):[...N,ft(n,"is",[f])]),I()},[x,I]),E=l.useCallback(n=>h("location",n),[h]),M=l.useCallback(n=>h("source",n),[h]),F=l.useMemo(()=>{const n={site_uuid:a?.id||"",date_from:$(S),date_to:$(v),timezone:k,member_status:pe(p),post_uuid:"",...j};return!b&&c?.uuid?{...n,post_uuid:c.uuid}:n},[b,c,a?.id,S,v,k,p,j]),{data:y,loading:R}=K({endpoint:"api_kpis",statsConfig:a||{id:""},params:F}),{data:D,loading:U}=K({endpoint:"api_top_locations",statsConfig:a||{id:""},params:F}),{data:A,loading:B}=K({endpoint:"api_top_sources",statsConfig:a||{id:""},params:F}),P=l.useMemo(()=>D?.reduce((n,f)=>n+Number(f.visits),0)||0,[D]),_=l.useMemo(()=>A?A.reduce((n,f)=>n+Number(f.visits||0),0):0,[A]),Q=r?.url,w=r?.icon,Y=l.useMemo(()=>{const n=D?.map(u=>({location:String(u.location),visits:Number(u.visits),percentage:P>0?Number(u.visits)/P:0,isUnknown:le.includes(String(u.location))}))||[],f=n.filter(u=>!u.isUnknown),N=n.filter(u=>u.isUnknown),L=N.length>0?[{location:"Unknown",visits:N.reduce((u,V)=>u+V.visits,0),percentage:N.reduce((u,V)=>u+V.percentage,0)}]:[];return[...f,...L]},[D,P]),g=i||b||R||U||B,C=We(y),T=m.length>0;return t.jsxs(t.Fragment,{children:[t.jsxs(pt,{currentTab:"Web",children:[T&&t.jsx(ee,{children:t.jsx(se,{})}),t.jsxs(ee,{className:`${T?"!mt-0 [grid-area:subactions] lg:!mt-[25px]":"[grid-area:actions]"}`,children:[t.jsx(kt,{filters:m,onChange:x}),!T&&t.jsx(se,{})]})]}),t.jsx(ht,{children:g?t.jsx(ue,{className:"size-full",variant:"plain",children:t.jsx(de,{className:"size-full items-center justify-center",children:t.jsx(Pe,{})})}):y&&y.length!==0&&C.visits!=="0"?t.jsxs(t.Fragment,{children:[t.jsx(Qe,{data:y,range:d}),t.jsxs("div",{className:"flex flex-col gap-6 lg:grid lg:grid-cols-2",children:[t.jsx(yt,{data:Y,isLoading:U,onLocationClick:E}),t.jsx(Ye,{data:A,range:d,siteIcon:w,siteUrl:Q,totalVisitors:_,onSourceClick:M})]})]}):t.jsx("div",{className:"grow",children:t.jsx(Nt,{className:"h-full",description:"Try adjusting filters to see more data.",title:`No visitors ${qe(o)}`,children:t.jsx(J,{strokeWidth:1.5})})})})]})};export{xs as default};
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<link rel="stylesheet" href="./assets/vendor-0ede59da8efb5e28fa929557f7ff7154.css">
|
|
5
|
-
<link rel="stylesheet" href="./assets/ghost-
|
|
6
|
-
<meta name="ghost-admin/config/environment" content="%7B%22modulePrefix%22%3A%22ghost-admin%22%2C%22environment%22%3A%22production%22%2C%22cdnUrl%22%3A%22%22%2C%22editorUrl%22%3A%22%22%2C%22rootURL%22%3A%22%22%2C%22locationType%22%3A%22trailing-hash%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%2C%22Array%22%3Atrue%2C%22String%22%3Atrue%2C%22Function%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_JQUERY_INTEGRATION%22%3Atrue%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22version%22%3A%226.17%22%2C%22name%22%3A%22ghost-admin%22%7D%2C%22ember-simple-auth%22%3A%7B%7D%2C%22%40sentry%2Fember%22%3A%7B%22disablePerformance%22%3Atrue%2C%22sentry%22%3A%7B%7D%7D%2C%22ember-cli-mirage%22%3A%7B%22usingProxy%22%3Afalse%2C%22useDefaultPassthroughs%22%3Atrue%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22ember-load%22%3A%7B%22loadingIndicatorClass%22%3A%22ember-load-indicator%22%7D%2C%22editorFilename%22%3A%22koenig-lexical.umd.js%22%2C%22editorHash%22%3A%22e3b2a7ff32%22%2C%22adminXSettingsFilename%22%3A%22admin-x-settings.js%22%2C%22adminXSettingsHash%22%3A%
|
|
5
|
+
<link rel="stylesheet" href="./assets/ghost-78b420974adc056bf1c9570275a46535.css">
|
|
6
|
+
<meta name="ghost-admin/config/environment" content="%7B%22modulePrefix%22%3A%22ghost-admin%22%2C%22environment%22%3A%22production%22%2C%22cdnUrl%22%3A%22%22%2C%22editorUrl%22%3A%22%22%2C%22rootURL%22%3A%22%22%2C%22locationType%22%3A%22trailing-hash%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%2C%22Array%22%3Atrue%2C%22String%22%3Atrue%2C%22Function%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_JQUERY_INTEGRATION%22%3Atrue%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22version%22%3A%226.17%22%2C%22name%22%3A%22ghost-admin%22%7D%2C%22ember-simple-auth%22%3A%7B%7D%2C%22%40sentry%2Fember%22%3A%7B%22disablePerformance%22%3Atrue%2C%22sentry%22%3A%7B%7D%7D%2C%22ember-cli-mirage%22%3A%7B%22usingProxy%22%3Afalse%2C%22useDefaultPassthroughs%22%3Atrue%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22ember-load%22%3A%7B%22loadingIndicatorClass%22%3A%22ember-load-indicator%22%7D%2C%22editorFilename%22%3A%22koenig-lexical.umd.js%22%2C%22editorHash%22%3A%22e3b2a7ff32%22%2C%22adminXSettingsFilename%22%3A%22admin-x-settings.js%22%2C%22adminXSettingsHash%22%3A%220fccdf8704%22%2C%22activitypubFilename%22%3A%22activitypub.js%22%2C%22activitypubHash%22%3A%2296ba714cd1%22%2C%22postsFilename%22%3A%22posts.js%22%2C%22postsHash%22%3A%22f16dcbd51e%22%2C%22statsFilename%22%3A%22stats.js%22%2C%22statsHash%22%3A%224556c3f52a%22%2C%22activitypubRemoteConfigUrl%22%3A%22%2F.ghost%2Factivitypub%2Fstable%2Fclient-config%22%7D">
|
|
7
7
|
|
|
8
8
|
<meta charset="UTF-8" />
|
|
9
9
|
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
<meta name="apple-mobile-web-app-title" content="Ghost" />
|
|
18
18
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
19
19
|
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
|
20
|
-
<script type="module" crossorigin src="./assets/index-
|
|
21
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
20
|
+
<script type="module" crossorigin src="./assets/index-exFCQBCk.js"></script>
|
|
21
|
+
<link rel="stylesheet" crossorigin href="./assets/index-BBrewxpF.css">
|
|
22
22
|
</head>
|
|
23
23
|
<body class="react-admin">
|
|
24
24
|
<div id="ember-alerts-wormhole"></div>
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
<div id="ember-liquid-wormhole"></div>
|
|
39
39
|
<script src="./assets/vendor-0e6161f8da2ad46cf62cef0a53cfb16a.js"></script>
|
|
40
40
|
<script src="./assets/chunk.397.fc6a300ea45f7b5ebab7.js"></script>
|
|
41
|
-
<script src="./assets/chunk.524.
|
|
42
|
-
<script src="./assets/ghost-
|
|
41
|
+
<script src="./assets/chunk.524.6c12997c856012ea06f5.js"></script>
|
|
42
|
+
<script src="./assets/ghost-a9268074d0a9b02198594a05ecd7a626.js"></script>
|
|
43
43
|
</body>
|
|
44
44
|
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ghost",
|
|
3
|
-
"version": "6.17.
|
|
3
|
+
"version": "6.17.1",
|
|
4
4
|
"description": "The professional publishing platform",
|
|
5
5
|
"author": "Ghost Foundation",
|
|
6
6
|
"homepage": "https://ghost.org",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"@tryghost/helpers": "1.1.97",
|
|
84
84
|
"@tryghost/html-to-plaintext": "1.0.4",
|
|
85
85
|
"@tryghost/http-cache-utils": "0.1.20",
|
|
86
|
-
"@tryghost/i18n": "file:components/tryghost-i18n-6.17.
|
|
86
|
+
"@tryghost/i18n": "file:components/tryghost-i18n-6.17.1.tgz",
|
|
87
87
|
"@tryghost/image-transform": "1.4.6",
|
|
88
88
|
"@tryghost/job-manager": "1.0.3",
|
|
89
89
|
"@tryghost/kg-card-factory": "5.1.7",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"@tryghost/mw-vhost": "1.0.1",
|
|
106
106
|
"@tryghost/nodemailer": "0.3.48",
|
|
107
107
|
"@tryghost/nql": "0.12.8",
|
|
108
|
-
"@tryghost/parse-email-address": "file:components/tryghost-parse-email-address-6.17.
|
|
108
|
+
"@tryghost/parse-email-address": "file:components/tryghost-parse-email-address-6.17.1.tgz",
|
|
109
109
|
"@tryghost/pretty-cli": "1.2.47",
|
|
110
110
|
"@tryghost/prometheus-metrics": "1.0.2",
|
|
111
111
|
"@tryghost/promise": "0.3.15",
|
|
@@ -271,8 +271,8 @@
|
|
|
271
271
|
"jackspeak": "2.3.6",
|
|
272
272
|
"moment": "2.24.0",
|
|
273
273
|
"moment-timezone": "0.5.45",
|
|
274
|
-
"@tryghost/i18n": "file:components/tryghost-i18n-6.17.
|
|
275
|
-
"@tryghost/parse-email-address": "file:components/tryghost-parse-email-address-6.17.
|
|
274
|
+
"@tryghost/i18n": "file:components/tryghost-i18n-6.17.1.tgz",
|
|
275
|
+
"@tryghost/parse-email-address": "file:components/tryghost-parse-email-address-6.17.1.tgz"
|
|
276
276
|
},
|
|
277
277
|
"nx": {
|
|
278
278
|
"targets": {
|
|
Binary file
|