ghost 6.17.1 → 6.17.2
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.2.tgz +0 -0
- package/components/{tryghost-parse-email-address-6.17.1.tgz → tryghost-parse-email-address-6.17.2.tgz} +0 -0
- package/content/themes/source/package.json +1 -1
- package/core/built/admin/assets/{PolarAngleAxis-DVj7Sw2n.js → PolarAngleAxis-B8JrAxf_.js} +1 -1
- package/core/built/admin/assets/{_baseAssignValue-CrCkbXur.js → _baseAssignValue-Bbalamaq.js} +1 -1
- package/core/built/admin/assets/{a-large-small-BLquRSNr.js → a-large-small-CgWPeKpi.js} +1 -1
- package/core/built/admin/assets/{at-sign-Cj4_ORaa.js → at-sign-BottTo2X.js} +1 -1
- package/core/built/admin/assets/{audience-ACTBvUSt.js → audience-CcGOt5Fb.js} +1 -1
- package/core/built/admin/assets/{avatar-flipboard-BeKL4BEF.js → avatar-flipboard-MxW2k124.js} +1 -1
- package/core/built/admin/assets/{bluesky-sharing-CP7ej5rz.js → bluesky-sharing-BBmDBlxr.js} +1 -1
- package/core/built/admin/assets/{chart-B6jk72FT.js → chart-pimL5Chk.js} +1 -1
- package/core/built/admin/assets/{chunk.524.6c12997c856012ea06f5.js → chunk.524.9a8f5123fd3ecf3e4451.js} +6 -6
- package/core/built/admin/assets/{chunk.582.a0abd5b93eb1bc50335a.js → chunk.582.41886d06af2895d571bd.js} +7 -7
- package/core/built/admin/assets/{code-editor-view-CVRtsOBM.js → code-editor-view-tCZOpc_h.js} +1 -1
- package/core/built/admin/assets/{comments-CxjhZH_T.js → comments-OXqhcC0t.js} +1 -1
- package/core/built/admin/assets/{copy-YhtJexiS.js → copy-aC0WUVtq.js} +1 -1
- package/core/built/admin/assets/{data-list-BPSXm3ej.js → data-list-BOdyZGWI.js} +1 -1
- package/core/built/admin/assets/{deleted-feed-item-D8BHDEHh.js → deleted-feed-item-BnUJ8bWP.js} +1 -1
- package/core/built/admin/assets/{edit-profile-FrkkXMG7.js → edit-profile-CEgPhWMJ.js} +1 -1
- package/core/built/admin/assets/{empty-indicator-SsCyCd50.js → empty-indicator-CR_9BHAH.js} +1 -1
- package/core/built/admin/assets/{en-ZWZBSdFY.js → en-ajofhc7o.js} +1 -1
- package/core/built/admin/assets/{feed-BvVJCTy8.js → feed-Ci-ODCHE.js} +1 -1
- package/core/built/admin/assets/{filters-BupJ4mUj.js → filters-CmJJOv3I.js} +1 -1
- package/core/built/admin/assets/{gh-chart-Dp9VXeON.js → gh-chart-hn7wEnik.js} +1 -1
- package/core/built/admin/assets/{growth-CRDHOGrZ.js → growth-CQceZQ1g.js} +1 -1
- package/core/built/admin/assets/{hash-CPAX2PwN.js → hash-BcaWmkw5.js} +1 -1
- package/core/built/admin/assets/{inbox-DuT2edmx.js → inbox-D9hID-rO.js} +1 -1
- package/core/built/admin/assets/{index-bl5YmBtG.js → index-B1rKIiOr.js} +1 -1
- package/core/built/admin/assets/{index-B2oDZJ9B.js → index-BJS8H75W.js} +1 -1
- package/core/built/admin/assets/{index-BPYePamp.js → index-BmK6ThYl.js} +1 -1
- package/core/built/admin/assets/{index-BX3kQzlo.js → index-CZ3lARQ2.js} +1 -1
- package/core/built/admin/assets/{index-8ECl7z0l.js → index-Cl2eSBwg.js} +1 -1
- package/core/built/admin/assets/{index-BwUQiVrX.js → index-D8syEvSm.js} +1 -1
- package/core/built/admin/assets/{index-Dk-Wh_Fw.js → index-DJDgMk-T.js} +1 -1
- package/core/built/admin/assets/{index-DnY4rls4.js → index-DO76vL0R.js} +1 -1
- package/core/built/admin/assets/{index-CjzFwwKZ.js → index-DYM1MbXR.js} +1 -1
- package/core/built/admin/assets/{index-B1rQYn0h.js → index-Do091GLu.js} +1 -1
- package/core/built/admin/assets/{index-CQP2hNBo.js → index-d_UH71zm.js} +1 -1
- package/core/built/admin/assets/{index-exFCQBCk.js → index-f5Lv9kLb.js} +9 -9
- package/core/built/admin/assets/{index--Nwo3958.js → index-g4BWcHhl.js} +1 -1
- package/core/built/admin/assets/{index-ByYZ5TiM.js → index-kXF42nga.js} +1 -1
- package/core/built/admin/assets/{index-CeFAaI2v.js → index-rluYcfd-.js} +1 -1
- package/core/built/admin/assets/{koenig-lexical-eRS1y7PS.js → koenig-lexical-D2XHvS2J.js} +1 -1
- package/core/built/admin/assets/{kpi-card-DShFKtte.js → kpi-card-Dga9rFZ5.js} +1 -1
- package/core/built/admin/assets/{kpis-Bxyr_zYY.js → kpis-BbnqD1za.js} +1 -1
- package/core/built/admin/assets/{label-hgdYQhmm.js → label-D8WHEOe0.js} +1 -1
- package/core/built/admin/assets/{links-5NNDFN65.js → links-dgwx7ko1.js} +1 -1
- package/core/built/admin/assets/{lucide-react-f58FO8MB.js → lucide-react-BARFK2PZ.js} +1 -1
- package/core/built/admin/assets/{main-layout-BDz_2UZs.js → main-layout-CcjtCuF_.js} +1 -1
- package/core/built/admin/assets/{message-square-text-6dTKbQKA.js → message-square-text-BxquqPhA.js} +1 -1
- package/core/built/admin/assets/{minus-D2C19Fiu.js → minus-Ziy4LSYD.js} +1 -1
- package/core/built/admin/assets/{modals-DzetQgXf.js → modals-fMQzR7L6.js} +1 -1
- package/core/built/admin/assets/{moderation-87QsKbyf.js → moderation-Ci9UNwiZ.js} +1 -1
- package/core/built/admin/assets/{newsletter-BhI9Lgkn.js → newsletter-DnrS7Fvi.js} +1 -1
- package/core/built/admin/assets/{newsletters-adLgF_Re.js → newsletters-D78pgnas.js} +1 -1
- package/core/built/admin/assets/{note-BbPR57Yw.js → note-BAfNweZN.js} +1 -1
- package/core/built/admin/assets/{overview-CqyRlIVM.js → overview-CWQPNOF0.js} +1 -1
- package/core/built/admin/assets/{pagemenu-DlQF5jN4.js → pagemenu-DjSqq3Wu.js} +1 -1
- package/core/built/admin/assets/{post-analytics-BudH7GCA.js → post-analytics-c8kRV0YB.js} +1 -1
- package/core/built/admin/assets/{post-analytics-context-CxuzZluw.js → post-analytics-context-CEqWyqgm.js} +1 -1
- package/core/built/admin/assets/{post-analytics-header-BV_8onIF.js → post-analytics-header-CpPPBAz4.js} +1 -1
- package/core/built/admin/assets/{post-share-modal-CnM21JFK.js → post-share-modal-Dln0kZhn.js} +1 -1
- package/core/built/admin/assets/{posts-C5zAbpdG.js → posts-C1Eh5Ypq.js} +1 -1
- package/core/built/admin/assets/{repeat-BbSnXois.js → repeat-CN4fiG5H.js} +1 -1
- package/core/built/admin/assets/{reply-CuCJJfZj.js → reply-BfWgvH7y.js} +1 -1
- package/core/built/admin/assets/{select-Bv-dkHeU.js → select-B_0NBkLz.js} +1 -1
- package/core/built/admin/assets/{settings-Cit2-dRQ.js → settings-BqaVcJee.js} +4 -4
- package/core/built/admin/assets/{settings-wlK_oNsg.js → settings-Dk9E7Fqv.js} +1 -1
- package/core/built/admin/assets/{sort-button-Dmyldyzm.js → sort-button-C2M35dLh.js} +1 -1
- package/core/built/admin/assets/{source-icon-DjyV6RS6.js → source-icon-DkGi13e_.js} +1 -1
- package/core/built/admin/assets/{sprout-jOQR37se.js → sprout-BKiwQsGn.js} +1 -1
- package/core/built/admin/assets/{square-IrYxuAJL.js → square-BEpRc_fY.js} +1 -1
- package/core/built/admin/assets/{stats-C4LbW8IV.js → stats-CRgy_cWm.js} +1 -1
- package/core/built/admin/assets/{stats-view-BwaLDryw.js → stats-view-CTQ4qO3S.js} +1 -1
- package/core/built/admin/assets/{step-1-C0QApeYD.js → step-1-CNbdmB8C.js} +1 -1
- package/core/built/admin/assets/{step-2-h0b6Njyb.js → step-2-Ddrl2uae.js} +1 -1
- package/core/built/admin/assets/{step-3-CaM-Hz3F.js → step-3-CbqkEtwh.js} +1 -1
- package/core/built/admin/assets/{table-P4FGxGxN.js → table-Dw9xFlFd.js} +1 -1
- package/core/built/admin/assets/{tabs-Cj65mCsJ.js → tabs-DCHagOip.js} +1 -1
- package/core/built/admin/assets/{tags-CDvEkvxr.js → tags-BsDlfsPN.js} +1 -1
- package/core/built/admin/assets/{tags-Dnv6zTag.js → tags-DV2SSdMK.js} +1 -1
- package/core/built/admin/assets/{tiers-Y3OCOT03.js → tiers-tc5tafWV.js} +1 -1
- package/core/built/admin/assets/{toggle-group-kZZo_vdJ.js → toggle-group-DS-ZVhCr.js} +1 -1
- package/core/built/admin/assets/{topic-filter-Cn1_Z9I7.js → topic-filter-BfoEqHRD.js} +1 -1
- package/core/built/admin/assets/{trash-ln90Rlgi.js → trash-CpnxYen-.js} +1 -1
- package/core/built/admin/assets/{url-helpers-B5_oMSPb.js → url-helpers-wKPPeCtD.js} +1 -1
- package/core/built/admin/assets/{use-growth-stats-DQsJauHH.js → use-growth-stats-CbHIETF_.js} +1 -1
- package/core/built/admin/assets/{use-infinite-virtual-scroll-4OIpSNMH.js → use-infinite-virtual-scroll-DU1EUhyj.js} +1 -1
- package/core/built/admin/assets/{use-simple-pagination-BedA-MMT.js → use-simple-pagination-X6kmRz2u.js} +1 -1
- package/core/built/admin/assets/{user-round-check-CYI147XP.js → user-round-check-DYkrjHxF.js} +1 -1
- package/core/built/admin/assets/{wallet-cards-xpilOd6G.js → wallet-cards-CSdWOmJE.js} +1 -1
- package/core/built/admin/assets/{web-VPMnLvnh.js → web-C39IKnvl.js} +1 -1
- package/core/built/admin/index.html +2 -2
- package/core/server/services/email-address/email-address-service-wrapper.js +3 -0
- package/core/server/services/email-address/email-address-service.js +11 -0
- package/core/server/services/email-address/email-address-service.ts +13 -0
- package/core/server/services/members/api.js +3 -1
- package/core/server/services/members/members-api/controllers/router-controller.js +5 -2
- package/core/server/services/members/members-api/members-api.js +4 -2
- package/package.json +5 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/components/tryghost-i18n-6.17.1.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-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};
|
|
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-f5Lv9kLb.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-B_0NBkLz.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-CEqWyqgm.js";import{a as $e,F as Ge,b as He}from"./message-square-text-BxquqPhA.js";import{g as We,a as Qe,S as Ye,b as qe}from"./kpis-BbnqD1za.js";import{F as Xe,c as W,e as ce}from"./en-ajofhc7o.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-DjSqq3Wu.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-BOdyZGWI.js";import{a as dt,U as mt}from"./wallet-cards-CSdWOmJE.js";import{P as pt,a as ht}from"./post-analytics-header-CpPPBAz4.js";import{F as gt,c as ft}from"./filters-CmJJOv3I.js";import{b as bt,c as xt,F as St,d as jt,S as _t,T as Ct}from"./lucide-react-BARFK2PZ.js";import{E as Nt}from"./empty-indicator-CR_9BHAH.js";import"./posts-C1Eh5Ypq.js";import"./source-icon-DkGi13e_.js";import"./source-utils-B1S3ZHA2.js";import"./gh-chart-hn7wEnik.js";import"./chart-pimL5Chk.js";import"./_baseAssignValue-Bbalamaq.js";import"./tabs-DCHagOip.js";import"./index-DO76vL0R.js";import"./post-share-modal-Dln0kZhn.js";import"./post-helpers-gInwAwEv.js";import"./trash-CpnxYen-.js";import"./sprout-BKiwQsGn.js";import"./a-large-small-CgWPeKpi.js";import"./at-sign-BottTo2X.js";import"./copy-aC0WUVtq.js";import"./hash-BcaWmkw5.js";import"./inbox-D9hID-rO.js";import"./minus-Ziy4LSYD.js";import"./tags-DV2SSdMK.js";import"./square-BEpRc_fY.js";import"./user-round-check-DYkrjHxF.js";import"./repeat-CN4fiG5H.js";import"./reply-BfWgvH7y.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};
|
|
@@ -17,7 +17,7 @@
|
|
|
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-
|
|
20
|
+
<script type="module" crossorigin src="./assets/index-f5Lv9kLb.js"></script>
|
|
21
21
|
<link rel="stylesheet" crossorigin href="./assets/index-BBrewxpF.css">
|
|
22
22
|
</head>
|
|
23
23
|
<body class="react-admin">
|
|
@@ -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.
|
|
41
|
+
<script src="./assets/chunk.524.9a8f5123fd3ecf3e4451.js"></script>
|
|
42
42
|
<script src="./assets/ghost-a9268074d0a9b02198594a05ecd7a626.js"></script>
|
|
43
43
|
</body>
|
|
44
44
|
</html>
|
|
@@ -33,6 +33,9 @@ class EmailAddressServiceWrapper {
|
|
|
33
33
|
getFallbackEmail: () => {
|
|
34
34
|
return config.get('hostSettings:managedEmail:fallbackAddress') || null;
|
|
35
35
|
},
|
|
36
|
+
getMembersSupportAddress: () => {
|
|
37
|
+
return settingsHelpers.getMembersSupportAddress();
|
|
38
|
+
},
|
|
36
39
|
isValidEmailAddress: (emailAddress) => {
|
|
37
40
|
return validator.isEmail(emailAddress);
|
|
38
41
|
}
|
|
@@ -12,12 +12,14 @@ class EmailAddressService {
|
|
|
12
12
|
#getDefaultEmail;
|
|
13
13
|
#getFallbackDomain;
|
|
14
14
|
#getFallbackEmail;
|
|
15
|
+
#getMembersSupportAddress;
|
|
15
16
|
#isValidEmailAddress;
|
|
16
17
|
constructor(dependencies) {
|
|
17
18
|
this.#getManagedEmailEnabled = dependencies.getManagedEmailEnabled;
|
|
18
19
|
this.#getSendingDomain = dependencies.getSendingDomain;
|
|
19
20
|
this.#getFallbackDomain = dependencies.getFallbackDomain;
|
|
20
21
|
this.#getDefaultEmail = dependencies.getDefaultEmail;
|
|
22
|
+
this.#getMembersSupportAddress = dependencies.getMembersSupportAddress;
|
|
21
23
|
this.#getFallbackEmail = () => {
|
|
22
24
|
const fallbackAddress = dependencies.getFallbackEmail();
|
|
23
25
|
if (!fallbackAddress) {
|
|
@@ -42,6 +44,15 @@ class EmailAddressService {
|
|
|
42
44
|
get fallbackEmail() {
|
|
43
45
|
return this.#getFallbackEmail();
|
|
44
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Get the actual sender address for member emails after DMARC transformation.
|
|
49
|
+
* On managed platforms, this may differ from the configured support address to ensure DMARC compliance.
|
|
50
|
+
*/
|
|
51
|
+
getMembersSupportAddress() {
|
|
52
|
+
const configuredAddress = this.#getMembersSupportAddress();
|
|
53
|
+
const transformed = this.getAddressFromString(configuredAddress);
|
|
54
|
+
return transformed.from.address;
|
|
55
|
+
}
|
|
45
56
|
getAddressFromString(from, replyTo) {
|
|
46
57
|
const parsedFrom = email_address_parser_js_1.default.parse(from);
|
|
47
58
|
const parsedReplyTo = replyTo ? email_address_parser_js_1.default.parse(replyTo) : undefined;
|
|
@@ -24,6 +24,7 @@ export class EmailAddressService {
|
|
|
24
24
|
#getDefaultEmail: () => EmailAddress;
|
|
25
25
|
#getFallbackDomain: () => string | null;
|
|
26
26
|
#getFallbackEmail: () => EmailAddress | null;
|
|
27
|
+
#getMembersSupportAddress: () => string;
|
|
27
28
|
#isValidEmailAddress: (email: string) => boolean;
|
|
28
29
|
|
|
29
30
|
constructor(dependencies: {
|
|
@@ -32,12 +33,14 @@ export class EmailAddressService {
|
|
|
32
33
|
getFallbackDomain: () => string | null,
|
|
33
34
|
getDefaultEmail: () => EmailAddress,
|
|
34
35
|
getFallbackEmail: () => string | null,
|
|
36
|
+
getMembersSupportAddress: () => string,
|
|
35
37
|
isValidEmailAddress: (email: string) => boolean
|
|
36
38
|
}) {
|
|
37
39
|
this.#getManagedEmailEnabled = dependencies.getManagedEmailEnabled;
|
|
38
40
|
this.#getSendingDomain = dependencies.getSendingDomain;
|
|
39
41
|
this.#getFallbackDomain = dependencies.getFallbackDomain;
|
|
40
42
|
this.#getDefaultEmail = dependencies.getDefaultEmail;
|
|
43
|
+
this.#getMembersSupportAddress = dependencies.getMembersSupportAddress;
|
|
41
44
|
this.#getFallbackEmail = () => {
|
|
42
45
|
const fallbackAddress = dependencies.getFallbackEmail();
|
|
43
46
|
if (!fallbackAddress) {
|
|
@@ -68,6 +71,16 @@ export class EmailAddressService {
|
|
|
68
71
|
return this.#getFallbackEmail();
|
|
69
72
|
}
|
|
70
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Get the actual sender address for member emails after DMARC transformation.
|
|
76
|
+
* On managed platforms, this may differ from the configured support address to ensure DMARC compliance.
|
|
77
|
+
*/
|
|
78
|
+
getMembersSupportAddress(): string {
|
|
79
|
+
const configuredAddress = this.#getMembersSupportAddress();
|
|
80
|
+
const transformed = this.getAddressFromString(configuredAddress);
|
|
81
|
+
return transformed.from.address;
|
|
82
|
+
}
|
|
83
|
+
|
|
71
84
|
getAddressFromString(from: string, replyTo?: string): EmailAddresses {
|
|
72
85
|
const parsedFrom = EmailAddressParser.parse(from);
|
|
73
86
|
const parsedReplyTo = replyTo ? EmailAddressParser.parse(replyTo) : undefined;
|
|
@@ -19,6 +19,7 @@ const newslettersService = require('../newsletters');
|
|
|
19
19
|
const memberAttributionService = require('../member-attribution');
|
|
20
20
|
const emailSuppressionList = require('../email-suppression-list');
|
|
21
21
|
const commentsService = require('../comments');
|
|
22
|
+
const emailAddressService = require('../email-address');
|
|
22
23
|
const {t} = require('../i18n');
|
|
23
24
|
const sentry = require('../../../shared/sentry');
|
|
24
25
|
|
|
@@ -254,7 +255,8 @@ function createApiInstance(config) {
|
|
|
254
255
|
sentry,
|
|
255
256
|
settingsHelpers,
|
|
256
257
|
urlUtils,
|
|
257
|
-
commentsService
|
|
258
|
+
commentsService,
|
|
259
|
+
emailAddressService: emailAddressService.service
|
|
258
260
|
});
|
|
259
261
|
|
|
260
262
|
return membersApiInstance;
|
|
@@ -75,6 +75,7 @@ module.exports = class RouterController {
|
|
|
75
75
|
* @param {any} deps.settingsCache
|
|
76
76
|
* @param {any} deps.settingsHelpers
|
|
77
77
|
* @param {any} deps.urlUtils
|
|
78
|
+
* @param {any} deps.emailAddressService
|
|
78
79
|
*/
|
|
79
80
|
constructor({
|
|
80
81
|
offersAPI,
|
|
@@ -93,7 +94,8 @@ module.exports = class RouterController {
|
|
|
93
94
|
sentry,
|
|
94
95
|
settingsCache,
|
|
95
96
|
settingsHelpers,
|
|
96
|
-
urlUtils
|
|
97
|
+
urlUtils,
|
|
98
|
+
emailAddressService
|
|
97
99
|
}) {
|
|
98
100
|
this._offersAPI = offersAPI;
|
|
99
101
|
this._paymentsService = paymentsService;
|
|
@@ -112,6 +114,7 @@ module.exports = class RouterController {
|
|
|
112
114
|
this._settingsCache = settingsCache;
|
|
113
115
|
this._settingsHelpers = settingsHelpers;
|
|
114
116
|
this._urlUtils = urlUtils;
|
|
117
|
+
this._emailAddressService = emailAddressService;
|
|
115
118
|
}
|
|
116
119
|
|
|
117
120
|
async ensureStripe(_req, res, next) {
|
|
@@ -733,7 +736,7 @@ module.exports = class RouterController {
|
|
|
733
736
|
|
|
734
737
|
const inboxLinks = await getInboxLinks({
|
|
735
738
|
recipient: normalizedEmail,
|
|
736
|
-
sender: this.
|
|
739
|
+
sender: this._emailAddressService.getMembersSupportAddress(),
|
|
737
740
|
dnsResolver: this.#inboxLinksDnsResolver
|
|
738
741
|
});
|
|
739
742
|
if (inboxLinks) {
|
|
@@ -79,7 +79,8 @@ module.exports = function MembersAPI({
|
|
|
79
79
|
sentry,
|
|
80
80
|
settingsHelpers,
|
|
81
81
|
urlUtils,
|
|
82
|
-
commentsService
|
|
82
|
+
commentsService,
|
|
83
|
+
emailAddressService
|
|
83
84
|
}) {
|
|
84
85
|
const tokenService = new TokenService({
|
|
85
86
|
privateKey,
|
|
@@ -213,7 +214,8 @@ module.exports = function MembersAPI({
|
|
|
213
214
|
settingsCache,
|
|
214
215
|
settingsHelpers,
|
|
215
216
|
sentry,
|
|
216
|
-
urlUtils
|
|
217
|
+
urlUtils,
|
|
218
|
+
emailAddressService
|
|
217
219
|
});
|
|
218
220
|
|
|
219
221
|
const wellKnownController = new WellKnownController({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ghost",
|
|
3
|
-
"version": "6.17.
|
|
3
|
+
"version": "6.17.2",
|
|
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.2.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.2.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.2.tgz",
|
|
275
|
+
"@tryghost/parse-email-address": "file:components/tryghost-parse-email-address-6.17.2.tgz"
|
|
276
276
|
},
|
|
277
277
|
"nx": {
|
|
278
278
|
"targets": {
|