ghost 6.19.0 → 6.19.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.19.1.tgz +0 -0
- package/components/{tryghost-parse-email-address-6.19.0.tgz → tryghost-parse-email-address-6.19.1.tgz} +0 -0
- package/core/built/admin/assets/{PolarAngleAxis-CGprvq8M.js → PolarAngleAxis-BzbazaED.js} +1 -1
- package/core/built/admin/assets/{_baseAssignValue-Bwn07Ln5.js → _baseAssignValue-D0bBhNG1.js} +1 -1
- package/core/built/admin/assets/{a-large-small-p58xibEK.js → a-large-small-gBDqOWOy.js} +1 -1
- package/core/built/admin/assets/{at-sign-BZPuAx5m.js → at-sign-V79EBNTJ.js} +1 -1
- package/core/built/admin/assets/{audience-Cy9gLIa9.js → audience-DF--nR_q.js} +1 -1
- package/core/built/admin/assets/{avatar-flipboard-CLmWb5Xn.js → avatar-flipboard-GK39JNWl.js} +1 -1
- package/core/built/admin/assets/{bluesky-sharing-BHt0oiii.js → bluesky-sharing-BKRqTAow.js} +1 -1
- package/core/built/admin/assets/{chart--RFLGIL4.js → chart-0ezwQhyB.js} +1 -1
- package/core/built/admin/assets/{chunk.524.5c5c3f3273a86d1d9913.js → chunk.524.e62f8276cc561fcddb66.js} +6 -6
- package/core/built/admin/assets/{chunk.582.e6c787cdf7e6de7819e0.js → chunk.582.0cdc35e120cf621f18b9.js} +8 -8
- package/core/built/admin/assets/{code-editor-view-BW9y0JXN.js → code-editor-view-xVA7A1IE.js} +1 -1
- package/core/built/admin/assets/{comments-C_lilDBp.js → comments-Tt1iOjcd.js} +1 -1
- package/core/built/admin/assets/{content-helpers-BOnQQADZ.js → content-helpers-TSHyiXwF.js} +1 -1
- package/core/built/admin/assets/{copy-Bi7VpgPR.js → copy-CTHgI4YI.js} +1 -1
- package/core/built/admin/assets/{data-list-Bu3jzs1s.js → data-list-6rXP5AUF.js} +1 -1
- package/core/built/admin/assets/{deleted-feed-item-B-doIIKc.js → deleted-feed-item-CK_4qToF.js} +1 -1
- package/core/built/admin/assets/{edit-profile-ZBdjFfvL.js → edit-profile-B_ViIhsd.js} +1 -1
- package/core/built/admin/assets/{empty-indicator-C6BBh99D.js → empty-indicator-CzTRebSi.js} +1 -1
- package/core/built/admin/assets/{en-C7eSFQRw.js → en-D1H4BpXe.js} +1 -1
- package/core/built/admin/assets/{feed-CAioauwD.js → feed-0iLmr_Xb.js} +1 -1
- package/core/built/admin/assets/{filters-DEKF0tIB.js → filters-6zg35bLL.js} +1 -1
- package/core/built/admin/assets/{gh-chart-D9KI0_sO.js → gh-chart-ldqA2tQU.js} +1 -1
- package/core/built/admin/assets/{ghost-6bff5c535ef015b0ed9421ceb6c699a7.js → ghost-6b109ed708c502afee4ff1d9185ae40c.js} +256 -268
- package/core/built/admin/assets/ghost-b3dff8469d9c9af487866537210234bd.css +1 -0
- package/core/built/admin/assets/ghost-dark-16a7b98c352c1f70016e73af10962179.css +1 -0
- package/core/built/admin/assets/{growth-C6XGchvT.js → growth-BUQvBEMA.js} +1 -1
- package/core/built/admin/assets/{hash-DFhnGHId.js → hash-CRtHv162.js} +1 -1
- package/core/built/admin/assets/{inbox-p-Y5uScT.js → inbox-DWYGFLuU.js} +1 -1
- package/core/built/admin/assets/{index-CIZ_upe2.js → index-1J5JrBgd.js} +1 -1
- package/core/built/admin/assets/{index-CS4XqyC-.js → index-BFT8PQPd.js} +1 -1
- package/core/built/admin/assets/{index-BWnrLoWI.js → index-BeG1PnbN.js} +1 -1
- package/core/built/admin/assets/{index-DCTdAEHx.js → index-Bgo4hw-T.js} +3 -3
- package/core/built/admin/assets/{index-jAidr8jI.js → index-CCmy-hD6.js} +1 -1
- package/core/built/admin/assets/index-CKfif8kf.js +13 -0
- package/core/built/admin/assets/{index-FPf-AERu.js → index-Cc9yKRsT.js} +1 -1
- package/core/built/admin/assets/{index-3uU4zg_6.js → index-CvV71sVO.js} +1 -1
- package/core/built/admin/assets/{index-LyfDjTto.js → index-D0RISNEd.js} +1 -1
- package/core/built/admin/assets/{index-JmqyGBro.js → index-D1AppGlg.js} +1 -1
- package/core/built/admin/assets/{index-D17PEsUB.js → index-EFWmaChO.js} +1 -1
- package/core/built/admin/assets/{index-Wx8_AGZX.js → index-SulwGym9.js} +1 -1
- package/core/built/admin/assets/{index-lPLmWtv0.js → index-_dLVP2u2.js} +1 -1
- package/core/built/admin/assets/{index-BzU2odQq.js → index-nb8rSrz_.js} +1 -1
- package/core/built/admin/assets/{index--VlvGKWi.js → index-zvNmrx86.js} +1 -1
- package/core/built/admin/assets/{koenig-lexical-CWnkYKQt.js → koenig-lexical-D8K6acyr.js} +1 -1
- package/core/built/admin/assets/{kpi-card-B5UaJgOT.js → kpi-card-CaX6eHyr.js} +1 -1
- package/core/built/admin/assets/{kpis-Cc2RxnvZ.js → kpis-BfR_uoFr.js} +1 -1
- package/core/built/admin/assets/{label-CW7Kmp9w.js → label-BQ5mfFHN.js} +1 -1
- package/core/built/admin/assets/{links-wWNc9Uat.js → links-lZnz9cuZ.js} +1 -1
- package/core/built/admin/assets/{list-filter-3EF6cVg-.js → list-filter-CofVbkA4.js} +1 -1
- package/core/built/admin/assets/{lucide-react-DtMIZssr.js → lucide-react-7D_Tsesk.js} +1 -1
- package/core/built/admin/assets/{main-layout-BFYhCrLn.js → main-layout-DBVy-lM5.js} +1 -1
- package/core/built/admin/assets/{message-square-text-BDZtUW-2.js → message-square-text-DzuHB7uU.js} +1 -1
- package/core/built/admin/assets/{minus-CSphShdJ.js → minus-BIdO1CDG.js} +1 -1
- package/core/built/admin/assets/{modals-CDWP04Iy.js → modals-GY5yP0Bl.js} +1 -1
- package/core/built/admin/assets/{moderation-qcng2_lB.js → moderation-CB9TwdgZ.js} +1 -1
- package/core/built/admin/assets/{newsletter-R-IYcV4M.js → newsletter-Bww4nkp5.js} +1 -1
- package/core/built/admin/assets/{newsletters-BB4e24i1.js → newsletters-C8pT7kSQ.js} +1 -1
- package/core/built/admin/assets/{note-B_bpRX66.js → note-BeCIv25U.js} +1 -1
- package/core/built/admin/assets/{overview-Nh-IoP-v.js → overview-BCZDRsR0.js} +1 -1
- package/core/built/admin/assets/{pagemenu-Cd45frnF.js → pagemenu-D3ByoZIR.js} +1 -1
- package/core/built/admin/assets/{post-analytics-jHZOhQ8L.js → post-analytics-B4z47Loe.js} +1 -1
- package/core/built/admin/assets/{post-analytics-context-BST4bzps.js → post-analytics-context-BQ8IcW4n.js} +1 -1
- package/core/built/admin/assets/{post-analytics-header-DAZPp6M8.js → post-analytics-header-CpBVLNat.js} +1 -1
- package/core/built/admin/assets/{post-share-modal-D1JQfuYx.js → post-share-modal-Dz4BNSV-.js} +1 -1
- package/core/built/admin/assets/{posts-DFiJPOft.js → posts-C94RiQ4S.js} +1 -1
- package/core/built/admin/assets/{repeat-Smml9n0k.js → repeat-YTCeIlQZ.js} +1 -1
- package/core/built/admin/assets/{reply-CooY4lmk.js → reply-CUazFbTY.js} +1 -1
- package/core/built/admin/assets/{select-WwMsbBbg.js → select-MVpx-Kfp.js} +1 -1
- package/core/built/admin/assets/{settings-CQEhPDQU.js → settings-CEfmF6wO.js} +4 -4
- package/core/built/admin/assets/{settings-CxWtvcUf.js → settings-Q3y0Zw5o.js} +1 -1
- package/core/built/admin/assets/{sort-button-DFr8vezl.js → sort-button-CEXkgGLb.js} +1 -1
- package/core/built/admin/assets/{source-icon-VpYWpwYb.js → source-icon-BDparw9V.js} +1 -1
- package/core/built/admin/assets/{sprout-DRqlFJSK.js → sprout-CXg43Zav.js} +1 -1
- package/core/built/admin/assets/{square-CwHQ9sJ2.js → square-C8G-1gV_.js} +1 -1
- package/core/built/admin/assets/stats/{audience-Caf7BjaU.mjs → audience-DJv-je5C.mjs} +3 -3
- package/core/built/admin/assets/stats/{content-helpers-MbtAvUJh.mjs → content-helpers-Bq8zgCUT.mjs} +4 -4
- package/core/built/admin/assets/stats/{index-DMkZbbZs.mjs → index-B12PHa64.mjs} +8 -8
- package/core/built/admin/assets/stats/{index-wT0OIw_N.mjs → index-DRN41f8l.mjs} +5 -5
- package/core/built/admin/assets/stats/{index-ChjIxhHy.mjs → index-DwqY9qrn.mjs} +5 -5
- package/core/built/admin/assets/stats/{index-BGqKbF1D.mjs → index-GLg_cfiu.mjs} +464 -461
- package/core/built/admin/assets/stats/{index-BTjfXOi6.mjs → index-gS3EAScL.mjs} +5 -5
- package/core/built/admin/assets/stats/{sort-button-B8n8fYMi.mjs → sort-button-f_Dfri5f.mjs} +8 -8
- package/core/built/admin/assets/stats/{stats-CGH-0JNs.mjs → stats-CTWb7qo1.mjs} +96 -91
- package/core/built/admin/assets/stats/stats.js +1 -1
- package/core/built/admin/assets/stats/{tabs-EQCUj3Y9.mjs → tabs-DVvxZ7wa.mjs} +7 -7
- package/core/built/admin/assets/stats/{use-growth-stats--CIfag21.mjs → use-growth-stats-w7-2bD-r.mjs} +3 -3
- package/core/built/admin/assets/{stats-lnFiOQZx.js → stats-B2vPCVx7.js} +1 -1
- package/core/built/admin/assets/stats-view-BRy4IDHe.js +1 -0
- package/core/built/admin/assets/{step-1-Bx8MiQVF.js → step-1-MLqNxHrJ.js} +1 -1
- package/core/built/admin/assets/{step-2-CLLXppER.js → step-2-DY3jIa6G.js} +1 -1
- package/core/built/admin/assets/{step-3-C5WrQe8u.js → step-3-Dt6w5-MB.js} +1 -1
- package/core/built/admin/assets/{table-2waWpIF5.js → table-BWAnP2ln.js} +1 -1
- package/core/built/admin/assets/{tabs-CBD0hW8V.js → tabs-Bw13eFRh.js} +1 -1
- package/core/built/admin/assets/{tags-CKrBptuC.js → tags-BQz2NtFF.js} +1 -1
- package/core/built/admin/assets/{tags-Bgw5Hrb5.js → tags-Bj9RJW9l.js} +1 -1
- package/core/built/admin/assets/{tiers-CO-pz1FX.js → tiers-jCNws2RK.js} +1 -1
- package/core/built/admin/assets/{toggle-group-BXAZzvJ9.js → toggle-group-B0wGpmLS.js} +1 -1
- package/core/built/admin/assets/{topic-filter-U3qUH2P_.js → topic-filter-BPOZf5IO.js} +1 -1
- package/core/built/admin/assets/{trash-CJY1Wro_.js → trash-BKeiM6WP.js} +1 -1
- package/core/built/admin/assets/{use-growth-stats-BrLZI7da.js → use-growth-stats-C5TiRW1S.js} +1 -1
- package/core/built/admin/assets/{use-infinite-virtual-scroll-CiRn3kpz.js → use-infinite-virtual-scroll-CdNJ5RT5.js} +1 -1
- package/core/built/admin/assets/{use-simple-pagination-CskJ0MDP.js → use-simple-pagination-CCVB_aJH.js} +1 -1
- package/core/built/admin/assets/{user-round-check-zOuzV3OS.js → user-round-check-Df7ko4Tm.js} +1 -1
- package/core/built/admin/assets/{wallet-cards-ddLuIN-b.js → wallet-cards-Cl4bJBBw.js} +1 -1
- package/core/built/admin/assets/{web-CGbkZWn3.js → web-DxLX2yUi.js} +1 -1
- package/core/built/admin/index.html +5 -5
- package/core/frontend/helpers/get.js +51 -3
- package/core/server/api/endpoints/utils/serializers/input/utils/slug-filter-order.js +8 -5
- package/core/server/models/base/plugins/crud.js +6 -1
- package/core/server/services/email-suppression-list/email-suppression-list.js +1 -1
- package/package.json +16 -10
- package/yarn.lock +128 -181
- package/components/tryghost-i18n-6.19.0.tgz +0 -0
- package/core/built/admin/assets/ghost-3c48d37b32f4fcd7eb15cfd739905a03.css +0 -1
- package/core/built/admin/assets/ghost-dark-0100fe3ec7b4c3f6d8d043c904254a63.css +0 -1
- package/core/built/admin/assets/index-S62-c8TV.js +0 -13
- package/core/built/admin/assets/stats-view-BJVawuIv.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,j as s,y as r,an as d,B as n}from"./index-
|
|
1
|
+
import{r as l,j as s,y as r,an as d,B as n}from"./index-Bgo4hw-T.js";const c=l.forwardRef(({className:a,...e},t)=>s.jsx("div",{className:"relative w-full",children:s.jsx("table",{ref:t,className:r("w-full caption-bottom text-sm",a),...e})}));c.displayName="Table";const i=l.forwardRef(({className:a,...e},t)=>s.jsx("thead",{ref:t,className:r("[&_tr:hover:before]:bg-transparent",a),...e}));i.displayName="TableHeader";const b=l.forwardRef(({className:a,...e},t)=>s.jsx("tbody",{ref:t,className:r("",a),...e}));b.displayName="TableBody";const m=l.forwardRef(({className:a,...e},t)=>s.jsx("tfoot",{ref:t,className:r("border-b bg-muted/50 font-medium [&>tr]:last:border-b-0",a),...e}));m.displayName="TableFooter";const x=l.forwardRef(({className:a,...e},t)=>s.jsx("tr",{ref:t,className:r("group relative border-b data-[state=selected]:bg-muted",a),...e}));x.displayName="TableRow";const p=d("relative align-middle",{variants:{variant:{default:"h-10 px-2 text-left text-xs font-medium uppercase tracking-wide text-gray-700 [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",cardhead:"text-base font-normal [&>div]:px-0"}},defaultVariants:{variant:"default"}}),f=l.forwardRef(({className:a,variant:e,...t},o)=>s.jsx("th",{ref:o,className:r(p({variant:e,className:a})),...t}));f.displayName="TableHead";const u=({className:a,children:e,...t})=>{const o=r("text-xs uppercase tracking-wide leading-4 text-right text-gray-700 hover:bg-transparent px-0 [&_svg]:size-4 gap-1",a);return s.jsx(n,{className:o,size:"sm",variant:"ghost",...t,children:e})};u.displayName="TableHeadButton";const g=l.forwardRef(({className:a,...e},t)=>s.jsx("td",{ref:t,className:r("relative p-2.5 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] group-hover:bg-muted/50",a),...e}));g.displayName="TableCell";const N=l.forwardRef(({className:a,...e},t)=>s.jsx("caption",{ref:t,className:r("mt-4 text-sm text-muted-foreground",a),...e}));N.displayName="TableCaption";export{u as T,c as a,i as b,x as c,f as d,b as e,g as f,m as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,j as t,y as d,an as u,ao as N,B as j,ap as T}from"./index-
|
|
1
|
+
import{r as n,j as t,y as d,an as u,ao as N,B as j,ap as T}from"./index-Bgo4hw-T.js";import{R as c,L as p,T as m,C as f}from"./index-D0RISNEd.js";import{L as w}from"./lucide-react-7D_Tsesk.js";import{T as k}from"./wallet-cards-Cl4bJBBw.js";const i=n.createContext("segmented"),C=n.forwardRef(({variant:e="segmented",...a},r)=>t.jsx(i.Provider,{value:e,children:t.jsx(c,{ref:r,...a})}));C.displayName=c.displayName;const R=u("inline-flex items-center text-muted-foreground",{variants:{variant:{segmented:"h-[34px] rounded-lg bg-muted px-[3px]","segmented-sm":"h-8 rounded-lg bg-muted px-[3px]",button:"gap-2","button-sm":"gap-1",underline:"w-full gap-5 border-b border-b-gray-200 dark:border-gray-950",navbar:"h-[52px] items-end gap-6",pill:"-ml-0.5 h-[30px] gap-px",kpis:"border-b ring-0"}},defaultVariants:{variant:"segmented"}}),z=n.forwardRef(({className:e,...a},r)=>{const s=n.useContext(i);return t.jsx(p,{ref:r,className:d(R({variant:s,className:e})),...a})});z.displayName=p.displayName;const b=u("inline-flex items-center justify-center whitespace-nowrap px-3 py-1 ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{segmented:"h-7 rounded-md text-sm font-medium data-[state=active]:shadow-md","segmented-sm":"h-[26px] rounded-md text-xs font-medium data-[state=active]:shadow-md",button:"h-[34px] gap-1.5 rounded-md py-2 text-sm font-normal hover:bg-muted data-[state=active]:bg-muted-foreground/10 data-[state=active]:font-medium","button-sm":"h-6 gap-1.5 rounded-md p-2 text-xs font-normal text-gray-800 hover:bg-muted data-[state=active]:bg-muted-foreground/10 data-[state=active]:font-medium data-[state=active]:text-foreground",underline:'relative h-[36px] px-0 text-md font-semibold text-gray-700 after:absolute after:inset-x-0 after:bottom-[-1px] after:h-0.5 after:bg-foreground after:opacity-0 after:content-[""] hover:after:opacity-10 data-[state=active]:bg-transparent data-[state=active]:text-foreground data-[state=active]:after:!opacity-100',navbar:'relative h-[52px] px-px text-md font-semibold text-muted-foreground after:absolute after:inset-x-0 after:-bottom-px after:h-0.5 after:bg-foreground after:opacity-0 after:content-[""] hover:text-foreground data-[state=active]:bg-transparent data-[state=active]:text-foreground data-[state=active]:after:!opacity-100',pill:"relative h-[30px] rounded-md px-3 text-md font-medium text-gray-800 hover:text-foreground data-[state=active]:bg-muted-foreground/10 data-[state=active]:font-semibold data-[state=active]:text-foreground dark:text-gray-500 dark:data-[state=active]:text-foreground",kpis:'relative !h-full !items-start rounded-none border-border bg-transparent px-6 py-5 text-foreground ring-0 transition-all after:absolute after:inset-x-0 after:-bottom-px after:h-0.5 after:bg-foreground after:opacity-0 after:content-[""] first:rounded-tl-md last:rounded-tr-md hover:bg-accent/50 data-[state=active]:bg-transparent data-[state=active]:after:opacity-100 [&:not(:last-child)]:border-r [&[data-state=active]_[data-type="value"]]:text-foreground'}},defaultVariants:{variant:"segmented"}}),v=n.forwardRef(({className:e,...a},r)=>{const s=n.useContext(i);return t.jsx(m,{ref:r,className:d(b({variant:s,className:e})),...a})});v.displayName=m.displayName;const V=({className:e="",children:a})=>t.jsx("span",{className:`ml-1.5 mt-px flex h-5 items-center justify-center rounded-full bg-gray-200 px-1.5 py-0 text-xs font-semibold leading-[21px] text-gray-800 dark:bg-gray-900 dark:text-gray-300 ${e}`,children:a});V.displayName="TabsTriggerCount";const L=u("ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",{variants:{variant:{segmented:"","segmented-sm":"",button:"","button-sm":"",underline:"",navbar:"",pill:"",kpis:"ring-0"}},defaultVariants:{variant:"segmented"}}),K=n.forwardRef(({className:e,...a},r)=>{const s=n.useContext(i);return t.jsx(f,{ref:r,className:d(L({variant:s,className:e})),...a})});K.displayName=f.displayName;const F=({children:e,...a})=>t.jsx(v,{className:"h-auto",...a,children:e}),M=({color:e,icon:a,label:r,value:s,diffDirection:o,diffValue:l,className:h,"data-testid":g})=>{const x=a?w[a]:null,y=d("flex items-center gap-1 text-xs h-[22px] px-1.5 rounded-sm group/diff cursor-default mt-0.5",o==="up"&&"text-green-600 bg-green/10",o==="down"&&"text-red-600 bg-red/10",o==="same"&&"text-gray-700 bg-muted");return t.jsxs("div",{className:d("group flex w-full flex-col items-start gap-2",h),children:[t.jsxs("div",{className:"flex h-[22px] items-center gap-1.5 text-base font-medium text-muted-foreground transition-all group-hover:text-foreground","data-type":"value",children:[e&&t.jsx("div",{className:"ml-1 size-2 rounded-full opacity-50",style:{backgroundColor:e}}),x&&t.jsx(x,{size:16,strokeWidth:1.5}),r]}),t.jsxs("div",{className:"flex flex-col items-start gap-2 lg:flex-row xl:gap-3",children:[t.jsx("div",{className:"text-[2.3rem] font-semibold leading-none tracking-tighter xl:text-[2.6rem]","data-testid":g,children:s}),o&&o!=="hidden"&&t.jsx(t.Fragment,{children:t.jsxs("div",{className:y,"data-testid":g?`${g}-diff`:void 0,children:[t.jsx("span",{className:"font-medium leading-none",children:l}),o==="up"&&t.jsx(N,{className:"!size-[12px]",size:14,strokeWidth:2}),o==="down"&&t.jsx(k,{className:"!size-[12px]",size:14,strokeWidth:2})]})})]})]})},B=n.forwardRef(({variant:e="dropdown",className:a,...r},s)=>t.jsx(j,{ref:s,className:d("h-auto w-full rounded-none border-x-0 border-t-0 focus-visible:ring-0 bg-transparent py-5",a),variant:e,...r}));B.displayName="KpiDropdownButton";const W=n.forwardRef(({children:e,className:a,...r},s)=>{const o=n.useContext(i);return t.jsxs("div",{className:"relative rounded-md hover:bg-muted",children:[t.jsx(m,{ref:s,className:d(b({variant:o,className:a})),...r,children:t.jsx("div",{className:"flex items-center gap-2",children:e})}),t.jsx(T,{className:"absolute inset-0 size-full cursor-pointer",onClick:l=>{l.preventDefault()}})]})});W.displayName="TabsDropdownTrigger";export{F as K,C as T,z as a,v as b,K as c,M as d,B as e,V as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,y as T,z as j,B as g,r as N,aj as y,ak as P,ck as R,f as I}from"./index-
|
|
1
|
+
import{j as e,y as T,z as j,B as g,r as N,aj as y,ak as P,ck as R,f as I}from"./index-Bgo4hw-T.js";import{T as z,a as b}from"./toggle-group-B0wGpmLS.js";import{H as o,u as C}from"./use-infinite-virtual-scroll-CdNJ5RT5.js";import{M as L}from"./main-layout-DBVy-lM5.js";import{a as k,b as E,c as m,d,e as S,f as c}from"./table-BWAnP2ln.js";import{P as $,T as B}from"./tags-BQz2NtFF.js";import{E as _}from"./empty-indicator-CzTRebSi.js";const A=({children:a,className:s,...t})=>e.jsx("section",{className:T("flex gap-6 flex-col p-4 lg:p-8 size-full grow",s),...t,children:a}),H=({currentTab:a})=>e.jsxs(o,{variant:"inline-nav",children:[e.jsx(o.Title,{children:"Tags"}),e.jsxs(o.Actions,{children:[e.jsx(o.ActionGroup,{children:e.jsxs(z,{"data-testid":"tags-header-tabs",size:"button",type:"single",value:a,children:[e.jsx(b,{"aria-label":"Public tags",value:"public",asChild:!0,children:e.jsx(j,{to:"/tags",children:"Public tags"})}),e.jsx(b,{"aria-label":"Internal tags",value:"internal",asChild:!0,children:e.jsx(j,{to:"/tags?type=internal",children:"Internal tags"})})]})}),e.jsx(o.ActionGroup,{children:e.jsx(g,{asChild:!0,children:e.jsx("a",{className:"font-bold",href:"#/tags/new",children:"New tag"})})})]})]}),G=({children:a})=>e.jsx(L,{children:e.jsx("div",{className:"grid w-full grow",children:e.jsx("div",{className:"flex h-full flex-col","data-testid":"tags-page",children:a})})}),w=({height:a})=>e.jsx("tr",{"aria-hidden":"true",className:"flex lg:table-row",children:e.jsx("td",{className:"flex lg:table-cell",style:{height:a}})}),M=N.forwardRef(function(s,t){return e.jsx(m,{ref:t,...s,"aria-hidden":"true",className:"relative flex flex-col lg:table-row",children:e.jsx(c,{className:"relative z-10 h-24 animate-pulse",children:e.jsx("div",{className:"h-full rounded-md bg-muted","data-testid":"loading-placeholder"})})})});function q({items:a,totalItems:s,hasNextPage:t,isFetchingNextPage:l,fetchNextPage:n}){const i=N.useRef(null),{visibleItems:x,spaceBefore:u,spaceAfter:h}=C({items:a,totalItems:s,hasNextPage:t,isFetchingNextPage:l,fetchNextPage:n,parentRef:i});return e.jsx("div",{ref:i,className:"overflow-hidden",children:e.jsxs(k,{className:"flex table-fixed flex-col lg:table","data-testid":"tags-list",children:[e.jsx(E,{className:"hidden lg:!visible lg:!table-header-group",children:e.jsxs(m,{children:[e.jsx(d,{className:"w-auto px-4",children:"Tag"}),e.jsx(d,{className:"w-1/5 px-4",children:"Slug"}),e.jsx(d,{className:"w-1/5 px-4",children:"No. of posts"}),e.jsx(d,{className:"w-20 px-4"})]})}),e.jsxs(S,{className:"flex flex-col lg:table-row-group",children:[e.jsx(w,{height:u}),x.map(({key:p,virtualItem:v,item:r,props:f})=>v.index>a.length-1?e.jsx(M,{...f},p):e.jsxs(m,{...f,className:"grid w-full grid-cols-[1fr_5rem] items-center gap-x-4 p-2 hover:bg-muted/50 md:grid-cols-[1fr_auto_5rem] lg:table-row lg:p-0 [&.group:hover_td]:bg-transparent","data-testid":"tag-list-row",children:[e.jsxs(c,{className:"static col-start-1 col-end-1 row-start-1 row-end-1 flex min-w-0 flex-col p-0 md:relative lg:table-cell lg:w-1/2 lg:p-4 xl:w-3/5",children:[e.jsx("a",{className:"before:absolute before:left-0 before:top-0 before:z-10 before:h-full before:w-[100vw]",href:`#/tags/${r.slug}`,children:e.jsx("span",{className:"block truncate pb-1 text-lg font-medium",children:r.name})}),e.jsx("span",{className:"block truncate text-muted-foreground",children:r.description})]}),e.jsx(c,{className:"col-start-1 col-end-1 row-start-2 row-end-2 flex p-0 lg:table-cell lg:p-4",children:e.jsx("span",{className:"block truncate",children:r.slug})}),e.jsx(c,{className:"col-start-1 col-end-1 row-start-3 row-end-3 flex p-0 md:col-start-2 md:col-end-2 md:row-start-1 md:row-end-3 lg:table-cell lg:p-4",children:r.count?.posts?e.jsx("a",{className:"relative z-10 -m-4 inline-block p-4 hover:underline",href:`#/posts?tag=${r.slug}`,children:`${y(r.count?.posts)} ${r.count?.posts===1?"post":"posts"}`}):e.jsx("span",{className:"text-muted-foreground",children:"0 posts"})}),e.jsx(c,{className:"col-start-2 col-end-2 row-start-1 row-end-3 p-0 md:col-start-3 md:col-end-3 lg:table-cell lg:p-4",children:e.jsx(g,{"aria-hidden":"true",className:"w-12",size:"icon",tabIndex:-1,variant:"outline",children:e.jsx($,{})})})]},p)),e.jsx(w,{height:h})]})]})})}const Q="TagsResponseType",D=P({dataType:Q,path:"/tags/",defaultNextPageParams:(a,s)=>{var t,l;return(t=a.meta)!=null&&t.pagination.next?{...s,page:(((l=a.meta)==null?void 0:l.pagination.next)||1).toString()}:void 0},returnData:a=>{const{pages:s}=a,t=s.flatMap(n=>n.tags),l=s[s.length-1].meta;return{tags:t,meta:l,isEnd:l?l.pagination.pages===l.pagination.page:!0}}}),F=({filter:a,...s})=>{const t=Object.entries(a).map(([l,n])=>`${l}:${n}`).join(",");return D({...s,searchParams:{limit:"100",order:"name asc",include:"count.posts",filter:t,...s.searchParams}})},Z=()=>{const{search:a}=R(),t=new URLSearchParams(a).get("type")??"public",{data:l,isError:n,isLoading:i,isFetchingNextPage:x,fetchNextPage:u,hasNextPage:h}=F({filter:{visibility:t}});return e.jsxs(G,{children:[e.jsx(H,{currentTab:t}),e.jsx(A,{children:i?e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(I,{size:"lg"})}):n?e.jsxs("div",{className:"mb-16 flex h-full flex-col items-center justify-center",children:[e.jsx("h2",{className:"mb-2 text-xl font-medium",children:"Error loading tags"}),e.jsx("p",{className:"mb-4 text-muted-foreground",children:"Please reload the page to try again"}),e.jsx(g,{onClick:()=>window.location.reload(),children:"Reload page"})]}):l?.tags.length?e.jsx(q,{fetchNextPage:u,hasNextPage:h,isFetchingNextPage:x,items:l?.tags??[],totalItems:l?.meta?.pagination?.total??0}):e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(_,{actions:e.jsx(g,{asChild:!0,children:e.jsx("a",{href:"#/tags/new",children:"Create a new tag"})}),title:"Start organizing your content",children:e.jsx(B,{})})})})]})};export{Z as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ac as i,ak as p,ad as n,am as u}from"./index-
|
|
1
|
+
import{ac as i,ak as p,ad as n,am as u}from"./index-Bgo4hw-T.js";const c="ReferrerHistoryResponseType",T=i({dataType:c,path:"/stats/referrers/"}),y=i({dataType:"TopSourcesGrowthResponseType",path:"/stats/top-sources-growth"}),s="TiersResponseType",g=p({dataType:s,path:"/tiers/",defaultNextPageParams:(e,t)=>{var a;return{...t,page:(((a=e.meta)==null?void 0:a.pagination.next)||1).toString()}},returnData:e=>{const{pages:t}=e,a=t.flatMap(o=>o.tiers),r=t[t.length-1].meta;return{tiers:a,meta:r,isEnd:r?r.pagination.pages===r.pagination.page:!0}}}),f=n({method:"POST",path:()=>"/tiers/",body:e=>({tiers:[e]}),invalidateQueries:{dataType:s}}),h=n({method:"PUT",path:e=>`/tiers/${e.id}/`,body:e=>({tiers:[e]}),updateQueries:{dataType:s,emberUpdateType:"createOrUpdate",update:u("tiers")}});function m(e){return e.filter(t=>t.type==="paid"&&t.active)}function l(e){return e.filter(t=>t.active)}function v(e){return e.filter(t=>!t.active)}export{g as a,h as b,f as c,T as d,l as e,v as f,m as g,y as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as v,ar as G,j as n,au as x,ay as z,e as u,as as F,av as P,ax as $,aq as D,aw as B,an as O,y as b}from"./index-
|
|
1
|
+
import{r as v,ar as G,j as n,au as x,ay as z,e as u,as as F,av as P,ax as $,aq as D,aw as B,an as O,y as b}from"./index-Bgo4hw-T.js";var C="Toggle",T=v.forwardRef((e,o)=>{const{pressed:r,defaultPressed:t,onPressedChange:a,...l}=e,[s,i]=G({prop:r,onChange:a,defaultProp:t??!1,caller:C});return n.jsx(x.button,{type:"button","aria-pressed":s,"data-state":s?"on":"off","data-disabled":e.disabled?"":void 0,...l,ref:o,onClick:z(e.onClick,()=>{e.disabled||i(!s)})})});T.displayName=C;var j=T,c="ToggleGroup",[_]=F(c,[P]),I=P(),h=u.forwardRef((e,o)=>{const{type:r,...t}=e;if(r==="single"){const a=t;return n.jsx(q,{...a,ref:o})}if(r==="multiple"){const a=t;return n.jsx(H,{...a,ref:o})}throw new Error(`Missing prop \`type\` expected on \`${c}\``)});h.displayName=c;var[N,R]=_(c),q=u.forwardRef((e,o)=>{const{value:r,defaultValue:t,onValueChange:a=()=>{},...l}=e,[s,i]=G({prop:r,defaultProp:t??"",onChange:a,caller:c});return n.jsx(N,{scope:e.__scopeToggleGroup,type:"single",value:u.useMemo(()=>s?[s]:[],[s]),onItemActivate:i,onItemDeactivate:u.useCallback(()=>i(""),[i]),children:n.jsx(w,{...l,ref:o})})}),H=u.forwardRef((e,o)=>{const{value:r,defaultValue:t,onValueChange:a=()=>{},...l}=e,[s,i]=G({prop:r,defaultProp:t??[],onChange:a,caller:c}),g=u.useCallback(p=>i((d=[])=>[...d,p]),[i]),m=u.useCallback(p=>i((d=[])=>d.filter(A=>A!==p)),[i]);return n.jsx(N,{scope:e.__scopeToggleGroup,type:"multiple",value:s,onItemActivate:g,onItemDeactivate:m,children:n.jsx(w,{...l,ref:o})})});h.displayName=c;var[L,U]=_(c),w=u.forwardRef((e,o)=>{const{__scopeToggleGroup:r,disabled:t=!1,rovingFocus:a=!0,orientation:l,dir:s,loop:i=!0,...g}=e,m=I(r),p=D(s),d={role:"group",dir:p,...g};return n.jsx(L,{scope:r,rovingFocus:a,disabled:t,children:a?n.jsx(B,{asChild:!0,...m,orientation:l,dir:p,loop:i,children:n.jsx(x.div,{...d,ref:o})}):n.jsx(x.div,{...d,ref:o})})}),f="ToggleGroupItem",k=u.forwardRef((e,o)=>{const r=R(f,e.__scopeToggleGroup),t=U(f,e.__scopeToggleGroup),a=I(e.__scopeToggleGroup),l=r.value.includes(e.value),s=t.disabled||e.disabled,i={...e,pressed:l,disabled:s},g=u.useRef(null);return t.rovingFocus?n.jsx($,{asChild:!0,...a,focusable:!s,active:l,ref:g,children:n.jsx(y,{...i,ref:o})}):n.jsx(y,{...i,ref:o})});k.displayName=f;var y=u.forwardRef((e,o)=>{const{__scopeToggleGroup:r,value:t,...a}=e,l=R(f,r),s={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},i=l.type==="single"?s:void 0;return n.jsx(T,{...i,...a,ref:o,onPressedChange:g=>{g?l.onItemActivate(t):l.onItemDeactivate(t)}})}),V=h,E=k;const M=O("inline-flex items-center justify-center gap-2 rounded-sm text-sm font-medium text-gray-700 transition-colors hover:bg-gray-200 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-background data-[state=on]:text-foreground data-[state=on]:shadow-sm dark:hover:bg-background [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-[1.5px]",{variants:{variant:{default:"bg-transparent"},size:{default:"h-[26px] min-w-[26px] px-2",button:"h-[32px] min-w-[32px] px-3"}},defaultVariants:{variant:"default",size:"default"}}),J=v.forwardRef(({className:e,variant:o,size:r,...t},a)=>n.jsx(j,{ref:a,className:b(M({variant:o,size:r,className:e})),...t}));J.displayName=j.displayName;const S=v.createContext({size:"default",variant:"default"}),K=v.forwardRef(({className:e,variant:o,size:r,children:t,...a},l)=>n.jsx(V,{ref:l,className:b("inline-flex items-center justify-center gap-0.5 bg-gray-100 p-0.5 rounded-md dark:bg-gray-925/70",e),...a,children:n.jsx(S.Provider,{value:{variant:o,size:r},children:t})}));K.displayName=V.displayName;const Q=v.forwardRef(({className:e,children:o,variant:r,size:t,...a},l)=>{const s=v.useContext(S);return n.jsx(E,{ref:l,className:b(M({variant:s.variant||r,size:s.size||t}),e),...a,children:o})});Q.displayName=E.displayName;export{K as T,Q as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as b,r as t,j as o,B as T}from"./index-
|
|
1
|
+
import{p as b,r as t,j as o,B as T}from"./index-Bgo4hw-T.js";const k=({currentTopic:s,onTopicChange:r,excludeTopics:a=[]})=>{const{topicsQuery:c}=b(),{data:i}=c,f={slug:"following",name:"Following"},d=i?.topics||[],p=[f,...d].filter(({slug:e})=>!a.includes(e)),l=t.useRef(null),u=t.useRef(null),[m,h]=t.useState(!0),w=e=>{const{scrollLeft:n,scrollWidth:x,clientWidth:v}=e.currentTarget;h(n+v<x-1)};return t.useEffect(()=>{l.current&&l.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[s]),o.jsxs("div",{className:"relative w-full",children:[o.jsx("div",{ref:u,className:"flex w-full min-w-0 max-w-full snap-x snap-mandatory gap-2 overflow-x-auto [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",onScroll:w,children:p.map(({slug:e,name:n})=>o.jsx(T,{ref:s===e?l:null,className:"h-8 snap-start rounded-full px-3.5 text-sm",variant:s===e?"default":"secondary",onClick:()=>r(e),children:n},e))}),m&&o.jsx("div",{className:"pointer-events-none absolute right-0 top-0 h-full w-12 bg-gradient-to-l from-white to-transparent dark:from-black"})]})};export{k as T};
|
package/core/built/admin/assets/{use-growth-stats-BrLZI7da.js → use-growth-stats-C5TiRW1S.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as C,af as F,ag as H,ah as s,ai as _,aj as j}from"./index-
|
|
1
|
+
import{r as C,af as F,ag as H,ah as s,ai as _,aj as j}from"./index-Bgo4hw-T.js";import{u as k,a as v,b as V}from"./stats-B2vPCVx7.js";import{g as G}from"./currency-fEUUCkj0.js";const K=(r,b,D,i)=>{if(!r.length)return{totalMembers:0,freeMembers:0,paidMembers:0,mrr:0,percentChanges:{total:"0%",free:"0%",paid:"0%",mrr:"0%"},directions:{total:"same",free:"same",paid:"same",mrr:"same"}};const p=i||r[r.length-1],l=r.length>0?r[r.length-1]:{free:0,paid:0,comped:0},P=b.length>0?b[b.length-1]:{mrr:0},d=p.free+p.paid+p.comped,g=P.mrr,M={total:"0%",free:"0%",paid:"0%",mrr:"0%"},y={total:"same",free:"same",paid:"same",mrr:"same"};if(r.length>1){const t=r[0],e=t.free+t.paid+t.comped;if(e>0){const a=(d-e)/e*100;M.total=_(a/100),y.total=a>0?"up":a<0?"down":"same"}if(t.free>0){const a=(l.free-t.free)/t.free*100;M.free=_(a/100),y.free=a>0?"up":a<0?"down":"same"}const f=t.paid+t.comped,c=l.paid+l.comped;if(f>0){const a=(c-f)/f*100;M.paid=_(a/100),y.paid=a>0?"up":a<0?"down":"same"}}if(b.length>1){const t=s(D).format("YYYY-MM-DD"),e=b.find(a=>s(a.date).isSameOrAfter(t)),f=s(D).isSame(s().startOf("year"),"day")||s(D).year()<s().year();let c=0;if(e&&s(e.date).isSame(t,"day")?c=e.mrr:f?c=0:c=g,c>=0){const a=c===0?g>0?100:0:(g-c)/c*100;M.mrr=_(a/100),y.mrr=a>0?"up":a<0?"down":"same"}}return{totalMembers:d,freeMembers:p.free,paidMembers:p.paid+p.comped,mrr:g,percentChanges:M,directions:y}},N=(r,b)=>{const D=[...r].sort((t,e)=>new Date(t.date).getTime()-new Date(e.date).getTime()),i=[...b].sort((t,e)=>new Date(t.date).getTime()-new Date(e.date).getTime()),p=D.map(t=>t.date),l=i.map(t=>t.date),P=[...new Set([...p,...l])].sort((t,e)=>new Date(t).getTime()-new Date(e).getTime());let d=null,g=null;const M=new Map(D.map(t=>[t.date,t])),y=new Map(i.map(t=>[t.date,t]));return P.map(t=>{const e=M.get(t);e&&(d=e);const f=y.get(t);f&&(g=f);const c=d?.free??0,a=d?.paid??0,O=d?.comped??0,A=a+O,L=c+A,o=g?.mrr??0,R=d?.paid_subscribed??0,w=d?.paid_canceled??0;return{date:t,value:L,free:c,paid:A,comped:O,mrr:o,paid_subscribed:R,paid_canceled:w,formattedValue:j(L),label:"Total members"}})},X=r=>{const{startDate:b,endDate:D}=C.useMemo(()=>F(r),[r]),i=H(b),p=r===1?s(i).subtract(1,"day").format("YYYY-MM-DD"):i,{data:l,isLoading:P}=k({searchParams:{date_from:p}}),{data:d,isLoading:g}=v({searchParams:{date_from:p}}),{data:M,isLoading:y}=V(),t=C.useMemo(()=>{let o=[];if(l?.stats?o=l.stats:Array.isArray(l)&&(o=l),r===1&&o.length>=2){const R=o[o.length-2],w=o[o.length-1],S=s(i).format("YYYY-MM-DD"),m=s(i).add(1,"day").format("YYYY-MM-DD"),u={...R,date:S},T={...w,date:m};return[u,T]}return o},[l,r,i]),{mrrData:e,selectedCurrency:f}=C.useMemo(()=>{const o=s(i),R=r===1?s().endOf("day"):s().startOf("day");if(d?.stats&&d?.meta?.totals){const w=d.meta.totals;let S=w[0];if(!S)return{mrrData:[],selectedCurrency:"usd"};for(const n of w)n.mrr>S.mrr&&(S=n);const m=S.currency,u=d.stats.filter(n=>n.currency===m),T=u.filter(n=>s(n.date).isSameOrAfter(o)),E=[...u].sort((n,Y)=>new Date(Y.date).getTime()-new Date(n.date).getTime()),h=[...T];if(!h.some(n=>s(n.date).isSame(o,"day"))){const n=E.find(Y=>s(Y.date).isBefore(o));if(n)h.unshift({...n,date:o.format("YYYY-MM-DD")});else if(h.length>0){const Y=[...h].sort((B,I)=>new Date(B.date).getTime()-new Date(I.date).getTime())[0];h.unshift({...Y,date:o.format("YYYY-MM-DD")})}}const x=r===1?s().startOf("day"):R;if(!h.some(n=>s(n.date).isSame(x,"day"))&&h.length>0){const Y=[...h].sort((B,I)=>new Date(I.date).getTime()-new Date(B.date).getTime())[0];h.push({...Y,date:x.format("YYYY-MM-DD")})}return{mrrData:h.sort((n,Y)=>new Date(n.date).getTime()-new Date(Y.date).getTime()),selectedCurrency:m}}return{mrrData:[],selectedCurrency:"usd"}},[d,i,r]),c=C.useMemo(()=>K(t,e,i,l?.meta?.totals),[t,e,i,l?.meta?.totals]),a=C.useMemo(()=>N(t,e),[t,e]),O=C.useMemo(()=>G(f),[f]),A=C.useMemo(()=>P||g||y,[P,g,y]),L=C.useMemo(()=>{if(!M?.stats)return[];const o=M.stats.reduce((m,u)=>{const T=u.date;return m[T]||(m[T]={date:T,signups:0,cancellations:0}),m[T].signups+=u.signups,m[T].cancellations+=u.cancellations,m},{}),R=Object.values(o).sort((m,u)=>new Date(m.date).getTime()-new Date(u.date).getTime()),w=s(i),S=s(D);return R.filter(m=>{const u=s(m.date);return u.isSameOrAfter(w)&&u.isSameOrBefore(S)})},[M,i,D]);return{isLoading:A,memberData:t,mrrData:e,dateFrom:i,endDate:D,totals:c,chartData:a,subscriptionData:L,selectedCurrency:f,currencySymbol:O}};export{X as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as p,y as v,an as R,bN as T,r as S,aB as F}from"./index-
|
|
1
|
+
import{j as p,y as v,an as R,bN as T,r as S,aB as F}from"./index-Bgo4hw-T.js";function j({className:n,children:l}){return p.jsx("div",{className:v("flex items-center gap-2 [grid-area:above]",n),"data-header":"header-above",children:l})}function D({className:n,children:l}){return p.jsx(T,{className:v("text-2xl leading-[1.2em] lg:text-3xl [grid-area:title]",n),"data-header":"header-title",children:l})}function W({className:n,children:l}){return p.jsx("div",{className:v("flex items-center justify-start text-muted-foreground [grid-area:meta] pb-4 pt-1",n),"data-header":"header-meta",children:l})}function N({className:n,children:l}){return p.jsx("div",{className:v("flex items-center gap-2",n),"data-header":"header-action-group",children:l})}function H({className:n,children:l}){return p.jsx("div",{className:v("flex items-center gap-4 [grid-area:actions] sm:justify-self-end self-start",n),"data-header":"header-actions",children:l})}function V({className:n,children:l}){return p.jsx("div",{className:v("flex items-center gap-2 [grid-area:nav] self-start mt-2 lg:mt-0.5",n),"data-header":"header-nav",children:l})}const L=R("sticky top-0 z-50 -mb-4 grid gap-x-4 bg-gradient-to-b from-background via-background/70 to-background/70 p-4 backdrop-blur-md [grid-template-areas:'above''title''meta''actions''nav'] sm:[grid-template-areas:'above_above''title_actions''meta_actions''nav_nav'] lg:-mb-8 lg:p-8 dark:bg-black",{variants:{variant:{default:"lg:[grid-template-areas:'above_above''title_actions''meta_actions''nav_nav']","inline-nav":"lg:[grid-template-areas:'above_above_above''title_nav_actions''meta_nav_actions'] lg:[grid-template-columns:1fr_auto_auto]"}},defaultVariants:{variant:"default"}});function y({className:n,children:l,variant:e}){return p.jsx("header",{className:v(L({variant:e,className:n})),"data-header":"header",children:l})}y.Above=j;y.Title=D;y.Actions=H;y.ActionGroup=N;y.Nav=V;y.Meta=W;function I(n){const e=n instanceof HTMLElement&&window.getComputedStyle(n).overflowY,t=e!=="visible"&&e!=="hidden";if(n){if(t&&n.scrollHeight>=n.clientHeight)return n}else return null;return I(n.parentNode)||document.body}function x(n,l,e){let t=e.initialDeps??[],s;function i(){var o,r,a,c;let h;e.key&&((o=e.debug)!=null&&o.call(e))&&(h=Date.now());const f=n();if(!(f.length!==t.length||f.some((d,g)=>t[g]!==d)))return s;t=f;let m;if(e.key&&((r=e.debug)!=null&&r.call(e))&&(m=Date.now()),s=l(...f),e.key&&((a=e.debug)!=null&&a.call(e))){const d=Math.round((Date.now()-h)*100)/100,g=Math.round((Date.now()-m)*100)/100,E=g/16,w=(b,A)=>{for(b=String(b);b.length<A;)b=" "+b;return b};console.info(`%c⏱ ${w(g,5)} /${w(d,5)} ms`,`
|
|
2
2
|
font-size: .6rem;
|
|
3
3
|
font-weight: bold;
|
|
4
4
|
color: hsl(${Math.max(0,Math.min(120-120*E,120))}deg 100% 31%);`,e?.key)}return(c=e?.onChange)==null||c.call(e,s),s}return i.updateDeps=o=>{t=o},i}function M(n,l){if(n===void 0)throw new Error("Unexpected undefined");return n}const B=(n,l)=>Math.abs(n-l)<1.01,P=(n,l,e)=>{let t;return function(...s){n.clearTimeout(t),t=n.setTimeout(()=>l.apply(this,s),e)}},z=n=>{const{offsetWidth:l,offsetHeight:e}=n;return{width:l,height:e}},$=n=>n,q=n=>{const l=Math.max(n.startIndex-n.overscan,0),e=Math.min(n.endIndex+n.overscan,n.count-1),t=[];for(let s=l;s<=e;s++)t.push(s);return t},U=(n,l)=>{const e=n.scrollElement;if(!e)return;const t=n.targetWindow;if(!t)return;const s=o=>{const{width:r,height:a}=o;l({width:Math.round(r),height:Math.round(a)})};if(s(z(e)),!t.ResizeObserver)return()=>{};const i=new t.ResizeObserver(o=>{const r=()=>{const a=o[0];if(a?.borderBoxSize){const c=a.borderBoxSize[0];if(c){s({width:c.inlineSize,height:c.blockSize});return}}s(z(e))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return i.observe(e,{box:"border-box"}),()=>{i.unobserve(e)}},O={passive:!0},C=typeof window>"u"?!0:"onscrollend"in window,K=(n,l)=>{const e=n.scrollElement;if(!e)return;const t=n.targetWindow;if(!t)return;let s=0;const i=n.options.useScrollendEvent&&C?()=>{}:P(t,()=>{l(s,!1)},n.options.isScrollingResetDelay),o=h=>()=>{const{horizontal:f,isRtl:u}=n.options;s=f?e.scrollLeft*(u&&-1||1):e.scrollTop,i(),l(s,h)},r=o(!0),a=o(!1);a(),e.addEventListener("scroll",r,O);const c=n.options.useScrollendEvent&&C;return c&&e.addEventListener("scrollend",a,O),()=>{e.removeEventListener("scroll",r),c&&e.removeEventListener("scrollend",a)}},G=(n,l,e)=>{if(l?.borderBoxSize){const t=l.borderBoxSize[0];if(t)return Math.round(t[e.options.horizontal?"inlineSize":"blockSize"])}return n[e.options.horizontal?"offsetWidth":"offsetHeight"]},Y=(n,{adjustments:l=0,behavior:e},t)=>{var s,i;const o=n+l;(i=(s=t.scrollElement)==null?void 0:s.scrollTo)==null||i.call(s,{[t.options.horizontal?"left":"top"]:o,behavior:e})};class J{constructor(l){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let e=null;const t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(s=>{s.forEach(i=>{const o=()=>{this._measureElement(i.target,i)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var s;(s=t())==null||s.disconnect(),e=null},observe:s=>{var i;return(i=t())==null?void 0:i.observe(s,{box:"border-box"})},unobserve:s=>{var i;return(i=t())==null?void 0:i.unobserve(s)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([t,s])=>{typeof s>"u"&&delete e[t]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:$,rangeExtractor:q,onChange:()=>{},measureElement:G,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}},this.notify=e=>{var t,s;(s=(t=this.options).onChange)==null||s.call(t,this,e)},this.maybeNotify=x(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const t=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==t){if(this.cleanup(),!t){this.maybeNotify();return}this.scrollElement=t,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=i,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,t)=>{const s=new Map,i=new Map;for(let o=t-1;o>=0;o--){const r=e[o];if(s.has(r.lane))continue;const a=i.get(r.lane);if(a==null||r.end>a.end?i.set(r.lane,r):r.end<a.end&&s.set(r.lane,!0),s.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((o,r)=>o.end===r.end?o.index-r.index:o.end-r.end)[0]:void 0},this.getMeasurementOptions=x(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(e,t,s,i,o)=>(this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:s,getItemKey:i,enabled:o}),{key:!1}),this.getMeasurements=x(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:t,scrollMargin:s,getItemKey:i,enabled:o},r)=>{if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(h=>{this.itemSizeCache.set(h.key,h.size)}));const a=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const c=this.measurementsCache.slice(0,a);for(let h=a;h<e;h++){const f=i(h),u=this.options.lanes===1?c[h-1]:this.getFurthestMeasurement(c,h),m=u?u.end+this.options.gap:t+s,d=r.get(f),g=typeof d=="number"?d:this.options.estimateSize(h),E=m+g,w=u?u.lane:h%this.options.lanes;c[h]={index:h,start:m,size:g,end:E,key:f,lane:w}}return this.measurementsCache=c,c},{key:!1,debug:()=>this.options.debug}),this.calculateRange=x(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,s,i)=>this.range=e.length>0&&t>0?Q({measurements:e,outerSize:t,scrollOffset:s,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=x(()=>{let e=null,t=null;const s=this.calculateRange();return s&&(e=s.startIndex,t=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,s,i,o)=>i===null||o===null?[]:e({startIndex:i,endIndex:o,overscan:t,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const t=this.options.indexAttribute,s=e.getAttribute(t);return s?parseInt(s,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this._measureElement=(e,t)=>{const s=this.indexFromElement(e),i=this.measurementsCache[s];if(!i)return;const o=i.key,r=this.elementsCache.get(o);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(o,e)),e.isConnected&&this.resizeItem(s,this.options.measureElement(e,t,this))},this.resizeItem=(e,t)=>{const s=this.measurementsCache[e];if(!s)return;const i=this.itemSizeCache.get(s.key)??s.size,o=t-i;o!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,o,this):s.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=o,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(s.index),this.itemSizeCache=new Map(this.itemSizeCache.set(s.key,t)),this.notify(!1))},this.measureElement=e=>{if(!e){this.elementsCache.forEach((t,s)=>{t.isConnected||(this.observer.unobserve(t),this.elementsCache.delete(s))});return}this._measureElement(e,void 0)},this.getVirtualItems=x(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{const s=[];for(let i=0,o=e.length;i<o;i++){const r=e[i],a=t[r];s.push(a)}return s},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const t=this.getMeasurements();if(t.length!==0)return M(t[k(0,t.length-1,s=>M(t[s]).start,e)])},this.getOffsetForAlignment=(e,t,s=0)=>{const i=this.getSize(),o=this.getScrollOffset();t==="auto"&&(t=e>=o+i?"end":"start"),t==="center"?e+=(s-i)/2:t==="end"&&(e-=i);const r=this.getTotalSize()+this.options.scrollMargin-i;return Math.max(Math.min(r,e),0)},this.getOffsetForIndex=(e,t="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const s=this.measurementsCache[e];if(!s)return;const i=this.getSize(),o=this.getScrollOffset();if(t==="auto")if(s.end>=o+i-this.options.scrollPaddingEnd)t="end";else if(s.start<=o+this.options.scrollPaddingStart)t="start";else return[o,t];const r=t==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(r,t,s.size),t]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(e,{align:t="start",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,t),{adjustments:void 0,behavior:s})},this.scrollToIndex=(e,{align:t="auto",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),e=Math.max(0,Math.min(e,this.options.count-1));let i=0;const o=10,r=c=>{if(!this.targetWindow)return;const h=this.getOffsetForIndex(e,c);if(!h){console.warn("Failed to get offset for index:",e);return}const[f,u]=h;this._scrollToOffset(f,{adjustments:void 0,behavior:s}),this.targetWindow.requestAnimationFrame(()=>{const m=this.getScrollOffset(),d=this.getOffsetForIndex(e,u);if(!d){console.warn("Failed to get offset for index:",e);return}B(d[0],m)||a(u)})},a=c=>{this.targetWindow&&(i++,i<o?this.targetWindow.requestAnimationFrame(()=>r(c)):console.warn(`Failed to scroll to index ${e} after ${o} attempts.`))};r(t)},this.scrollBy=(e,{behavior:t}={})=>{t==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:t})},this.getTotalSize=()=>{var e;const t=this.getMeasurements();let s;if(t.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((e=t[t.length-1])==null?void 0:e.end)??0;else{const i=Array(this.options.lanes).fill(null);let o=t.length-1;for(;o>=0&&i.some(r=>r===null);){const r=t[o];i[r.lane]===null&&(i[r.lane]=r.end),o--}s=Math.max(...i.filter(r=>r!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:t,behavior:s})=>{this.options.scrollToFn(e,{behavior:s,adjustments:t},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(l)}}const k=(n,l,e,t)=>{for(;n<=l;){const s=(n+l)/2|0,i=e(s);if(i<t)n=s+1;else if(i>t)l=s-1;else return s}return n>0?n-1:0};function Q({measurements:n,outerSize:l,scrollOffset:e,lanes:t}){const s=n.length-1,i=a=>n[a].start;if(n.length<=t)return{startIndex:0,endIndex:s};let o=k(0,s,i,e),r=o;if(t===1)for(;r<s&&n[r].end<e+l;)r++;else if(t>1){const a=Array(t).fill(0);for(;r<s&&a.some(h=>h<e+l);){const h=n[r];a[h.lane]=h.end,r++}const c=Array(t).fill(e+l);for(;o>=0&&c.some(h=>h>=e);){const h=n[o];c[h.lane]=h.start,o--}o=Math.max(0,o-o%t),r=Math.min(s,r+(t-1-r%t))}return{startIndex:o,endIndex:r}}const _=typeof document<"u"?S.useLayoutEffect:S.useEffect;function X(n){const l=S.useReducer(()=>({}),{})[1],e={...n,onChange:(s,i)=>{var o;i?F.flushSync(l):l(),(o=n.onChange)==null||o.call(n,s,i)}},[t]=S.useState(()=>new J(e));return t.setOptions(e),_(()=>t._didMount(),[]),_(()=>t._willUpdate()),t}function Z(n){return X({observeElementRect:U,observeElementOffset:K,scrollToFn:Y,...n})}function te({items:n,totalItems:l,parentRef:e,hasNextPage:t,isFetchingNextPage:s,fetchNextPage:i,estimateSize:o=()=>100,overscan:r=5}){const a=Z({count:l,getScrollElement:()=>I(e.current),estimateSize:o,overscan:r}),c=a.getVirtualItems(),h=c.length>0?(c.at(0)?.start??0)-a.options.scrollMargin:0,f=c.length>0?a.getTotalSize()-(c.at(-1)?.end??0):0,u=c.map(d=>({virtualItem:d,key:d.key,item:n[d.index],props:{ref:a.measureElement,"data-index":d.index}})),m=u.at(-1)&&!u.at(-1)?.item;return S.useEffect(()=>{t&&m&&!s&&i()},[t,m,s,i]),{visibleItems:u,virtualizer:a,spaceBefore:h,spaceAfter:f}}export{y as H,I as g,te as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as u,j as i,y as l,B as c,aM as h,r as m}from"./index-
|
|
1
|
+
import{e as u,j as i,y as l,B as c,aM as h,r as m}from"./index-Bgo4hw-T.js";import{A as N}from"./lucide-react-7D_Tsesk.js";const j=u.forwardRef(({className:e,children:t,...n},a)=>i.jsx("div",{ref:a,className:l("flex items-center justify-between gap-4 pb-6 text-sm",e),...n,children:t}));j.displayName="SimplePagination";const w=u.forwardRef(({className:e,currentPage:t,totalPages:n,...a},r)=>i.jsxs("span",{ref:r,className:l("text-muted-foreground",e),...a,children:["Pages ",t," of ",n]}));w.displayName="SimplePaginationPages";const v=u.forwardRef(({className:e,children:t,...n},a)=>i.jsx("div",{ref:a,className:l("flex items-center gap-1.5",e),...n,children:t}));v.displayName="SimplePaginationNavigation";const M=u.forwardRef(({variant:e="outline",...t},n)=>i.jsx(c,{ref:n,size:"sm",variant:e,...t,children:i.jsx(h,{})}));M.displayName="SimplePaginationPreviousButton";const y=u.forwardRef(({variant:e="outline",...t},n)=>i.jsx(c,{ref:n,size:"sm",variant:e,...t,children:i.jsx(N,{})}));y.displayName="SimplePaginationNextButton";function b({data:e,itemsPerPage:t,initialPage:n=1}){const[a,r]=m.useState(n);if(t<=0)throw new Error("itemsPerPage must be a positive number");const p=s=>{const S=Math.max(1,Math.min(o,s));r(S)},o=m.useMemo(()=>e?Math.ceil(e.length/t):1,[e,t]);m.useEffect(()=>{a>o&&r(1)},[a,o]);const g=m.useMemo(()=>{if(!e)return null;const s=(a-1)*t;return e.slice(s,s+t)},[e,a,t]),f=()=>{r(s=>Math.min(o,s+1))},x=()=>{r(s=>Math.max(1,s-1))},P=a<o,d=a>1;return{currentPage:a,setCurrentPage:p,totalPages:o,paginatedData:g,nextPage:f,previousPage:x,hasNextPage:P,hasPreviousPage:d}}export{j as S,v as a,M as b,y as c,w as d,b as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,aS as be,aR as xe,bv as Se,bw as je,B as oe,bx as _e,by as Ce,bz as Ne,bA as ve,ch as Le,aj as ye,ai as Te,aU as Ee,r as l,ci as Fe,aT as J,bH as Oe,af as ne,ag as K,cj as ke,bD as De,aP as Ae,u as Ie,aV as Me,aQ as we}from"./index-DCTdAEHx.js";import{S as Pe,a as Ue,b as Ve,c as Re,d as Be,e as ze,f as $e}from"./select-WwMsbBbg.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-BST4bzps.js";import{a as Ke,F as Ge,b as He}from"./message-square-text-BDZtUW-2.js";import{g as We,a as Qe,S as Ye,b as qe}from"./kpis-Cc2RxnvZ.js";import{F as Xe,c as W,e as ce}from"./en-C7eSFQRw.js";import{C as ue,a as Je,b as Ze,f as et,c as de,g as tt,u as $,j as ee}from"./pagemenu-Cd45frnF.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-Bu3jzs1s.js";import{a as dt,U as mt}from"./wallet-cards-ddLuIN-b.js";import{P as pt,a as ht}from"./post-analytics-header-DAZPp6M8.js";import{F as gt,c as ft}from"./filters-DEKF0tIB.js";import{b as bt,c as xt,F as St,d as jt,S as _t,T as Ct}from"./lucide-react-DtMIZssr.js";import{E as Nt}from"./empty-indicator-C6BBh99D.js";import"./posts-DFiJPOft.js";import"./source-icon-VpYWpwYb.js";import"./source-utils-B1S3ZHA2.js";import"./gh-chart-D9KI0_sO.js";import"./chart--RFLGIL4.js";import"./_baseAssignValue-Bwn07Ln5.js";import"./tabs-CBD0hW8V.js";import"./index-LyfDjTto.js";import"./post-share-modal-D1JQfuYx.js";import"./post-helpers-gInwAwEv.js";import"./trash-CJY1Wro_.js";import"./sprout-DRqlFJSK.js";import"./a-large-small-p58xibEK.js";import"./at-sign-BZPuAx5m.js";import"./copy-Bi7VpgPR.js";import"./hash-DFhnGHId.js";import"./inbox-p-Y5uScT.js";import"./list-filter-3EF6cVg-.js";import"./minus-CSphShdJ.js";import"./tags-CKrBptuC.js";import"./square-CwHQ9sJ2.js";import"./user-round-check-zOuzV3OS.js";import"./repeat-Smml9n0k.js";import"./reply-CooY4lmk.js";const se=()=>{const{range:e,setRange:s}=H();return t.jsxs(Pe,{value:`${e}`,onValueChange:a=>{s(Number(a))},children:[t.jsxs(Ue,{className:"w-auto",children:[t.jsx(Ke,{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($e,{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:K(b),date_to:K(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}=$({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:w}=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:w,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,w]),P=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:P?"Add filter":"Filter",allowMultiple:!1,className:`[&>button]:order-last ${P&&"[&>button]:border-none"}`,fields:Q,filters:e,keyboardShortcut:"f",popoverAlign:m||P?"start":"end",showSearchInput:!1,onActiveFieldChange:b,onChange:s||(()=>{}),...a}),P&&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 Ss=()=>{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:K(S),date_to:K(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}=$({endpoint:"api_kpis",statsConfig:a||{id:""},params:F}),{data:D,loading:U}=$({endpoint:"api_top_locations",statsConfig:a||{id:""},params:F}),{data:A,loading:B}=$({endpoint:"api_top_sources",statsConfig:a||{id:""},params:F}),w=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,P=r?.icon,Y=l.useMemo(()=>{const n=D?.map(u=>({location:String(u.location),visits:Number(u.visits),percentage:w>0?Number(u.visits)/w: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,w]),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(we,{})})}):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:P,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{Ss as default};
|
|
1
|
+
import{j as t,aS as be,aR as xe,bv as Se,bw as je,B as oe,bx as _e,by as Ce,bz as Ne,bA as ve,ch as Le,aj as ye,ai as Te,aU as Ee,r as l,ci as Fe,aT as J,bH as Oe,af as ne,ag as K,cj as ke,bD as De,aP as Ae,u as Ie,aV as Me,aQ as we}from"./index-Bgo4hw-T.js";import{S as Pe,a as Ue,b as Ve,c as Re,d as Be,e as ze,f as $e}from"./select-MVpx-Kfp.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-BQ8IcW4n.js";import{a as Ke,F as Ge,b as He}from"./message-square-text-DzuHB7uU.js";import{g as We,a as Qe,S as Ye,b as qe}from"./kpis-BfR_uoFr.js";import{F as Xe,c as W,e as ce}from"./en-D1H4BpXe.js";import{C as ue,a as Je,b as Ze,f as et,c as de,g as tt,u as $,j as ee}from"./pagemenu-D3ByoZIR.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-6rXP5AUF.js";import{a as dt,U as mt}from"./wallet-cards-Cl4bJBBw.js";import{P as pt,a as ht}from"./post-analytics-header-CpBVLNat.js";import{F as gt,c as ft}from"./filters-6zg35bLL.js";import{b as bt,c as xt,F as St,d as jt,S as _t,T as Ct}from"./lucide-react-7D_Tsesk.js";import{E as Nt}from"./empty-indicator-CzTRebSi.js";import"./posts-C94RiQ4S.js";import"./source-icon-BDparw9V.js";import"./source-utils-B1S3ZHA2.js";import"./gh-chart-ldqA2tQU.js";import"./chart-0ezwQhyB.js";import"./_baseAssignValue-D0bBhNG1.js";import"./tabs-Bw13eFRh.js";import"./index-D0RISNEd.js";import"./post-share-modal-Dz4BNSV-.js";import"./post-helpers-gInwAwEv.js";import"./trash-BKeiM6WP.js";import"./sprout-CXg43Zav.js";import"./a-large-small-gBDqOWOy.js";import"./at-sign-V79EBNTJ.js";import"./copy-CTHgI4YI.js";import"./hash-CRtHv162.js";import"./inbox-DWYGFLuU.js";import"./list-filter-CofVbkA4.js";import"./minus-BIdO1CDG.js";import"./tags-BQz2NtFF.js";import"./square-C8G-1gV_.js";import"./user-round-check-Df7ko4Tm.js";import"./repeat-YTCeIlQZ.js";import"./reply-CUazFbTY.js";const se=()=>{const{range:e,setRange:s}=H();return t.jsxs(Pe,{value:`${e}`,onValueChange:a=>{s(Number(a))},children:[t.jsxs(Ue,{className:"w-auto",children:[t.jsx(Ke,{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($e,{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:K(b),date_to:K(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}=$({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:w}=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:w,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,w]),P=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:P?"Add filter":"Filter",allowMultiple:!1,className:`[&>button]:order-last ${P&&"[&>button]:border-none"}`,fields:Q,filters:e,keyboardShortcut:"f",popoverAlign:m||P?"start":"end",showSearchInput:!1,onActiveFieldChange:b,onChange:s||(()=>{}),...a}),P&&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 Ss=()=>{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:K(S),date_to:K(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}=$({endpoint:"api_kpis",statsConfig:a||{id:""},params:F}),{data:D,loading:U}=$({endpoint:"api_top_locations",statsConfig:a||{id:""},params:F}),{data:A,loading:B}=$({endpoint:"api_top_sources",statsConfig:a||{id:""},params:F}),w=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,P=r?.icon,Y=l.useMemo(()=>{const n=D?.map(u=>({location:String(u.location),visits:Number(u.visits),percentage:w>0?Number(u.visits)/w: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,w]),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(we,{})})}):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:P,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{Ss 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.19%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%22e537e614ff%22%2C%22adminXSettingsFilename%22%3A%22admin-x-settings.js%22%2C%22adminXSettingsHash%22%3A%22832391a656%22%2C%22activitypubFilename%22%3A%22activitypub.js%22%2C%22activitypubHash%22%3A%224d76e4db3f%22%2C%22postsFilename%22%3A%22posts.js%22%2C%22postsHash%22%3A%2204f49e00e5%22%2C%22statsFilename%22%3A%22stats.js%22%2C%22statsHash%22%3A%
|
|
5
|
+
<link rel="stylesheet" href="./assets/ghost-b3dff8469d9c9af487866537210234bd.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.19%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%22e537e614ff%22%2C%22adminXSettingsFilename%22%3A%22admin-x-settings.js%22%2C%22adminXSettingsHash%22%3A%22832391a656%22%2C%22activitypubFilename%22%3A%22activitypub.js%22%2C%22activitypubHash%22%3A%224d76e4db3f%22%2C%22postsFilename%22%3A%22posts.js%22%2C%22postsHash%22%3A%2204f49e00e5%22%2C%22statsFilename%22%3A%22stats.js%22%2C%22statsHash%22%3A%220d208721fc%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,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-Bgo4hw-T.js"></script>
|
|
21
21
|
<link rel="stylesheet" crossorigin href="./assets/index-4ZkTY34B.css">
|
|
22
22
|
</head>
|
|
23
23
|
<body class="react-admin">
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
<div id="ember-notifications-wormhole"></div>
|
|
40
40
|
<script src="./assets/vendor-0e6161f8da2ad46cf62cef0a53cfb16a.js"></script>
|
|
41
41
|
<script src="./assets/chunk.397.fc6a300ea45f7b5ebab7.js"></script>
|
|
42
|
-
<script src="./assets/chunk.524.
|
|
43
|
-
<script src="./assets/ghost-
|
|
42
|
+
<script src="./assets/chunk.524.e62f8276cc561fcddb66.js"></script>
|
|
43
|
+
<script src="./assets/ghost-6b109ed708c502afee4ff1d9185ae40c.js"></script>
|
|
44
44
|
</body>
|
|
45
45
|
</html>
|
|
@@ -10,7 +10,6 @@ const errors = require('@tryghost/errors');
|
|
|
10
10
|
const tpl = require('@tryghost/tpl');
|
|
11
11
|
|
|
12
12
|
const _ = require('lodash');
|
|
13
|
-
const jsonpath = require('jsonpath');
|
|
14
13
|
const nqlLang = require('@tryghost/nql-lang');
|
|
15
14
|
|
|
16
15
|
const messages = {
|
|
@@ -47,6 +46,53 @@ const pathAliases = {
|
|
|
47
46
|
'post.author': 'post.author.slug'
|
|
48
47
|
};
|
|
49
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Resolve a simple path like "post.tags[*].slug" against an object.
|
|
51
|
+
* Supports dot-notation, [N] array indexing, and [*] array wildcards.
|
|
52
|
+
* Always returns an array of matched values.
|
|
53
|
+
*/
|
|
54
|
+
const VALID_SEGMENT = /^\w+(\[(\*|\d+)\])?$/;
|
|
55
|
+
|
|
56
|
+
function querySimplePath(obj, pathString) {
|
|
57
|
+
const parts = pathString.split('.');
|
|
58
|
+
let current = [obj];
|
|
59
|
+
|
|
60
|
+
for (const part of parts) {
|
|
61
|
+
if (current.length === 0) {
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (!VALID_SEGMENT.test(part)) {
|
|
66
|
+
throw new errors.IncorrectUsageError({
|
|
67
|
+
message: `{{#get}} helper — unsupported path segment "${part}" in "${pathString}"`
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Match e.g. "tags[*]" or "tags[0]"
|
|
72
|
+
const bracketMatch = part.match(/^(.+?)\[(\*|\d+)\]$/);
|
|
73
|
+
const key = bracketMatch ? bracketMatch[1] : part;
|
|
74
|
+
const bracket = bracketMatch ? bracketMatch[2] : null;
|
|
75
|
+
|
|
76
|
+
const next = [];
|
|
77
|
+
for (const item of current) {
|
|
78
|
+
if (item !== null && item !== undefined && item[key] !== undefined) {
|
|
79
|
+
next.push(item[key]);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (bracket === '*') {
|
|
84
|
+
current = next.flatMap(item => (Array.isArray(item) ? item : []));
|
|
85
|
+
} else if (bracket !== null) {
|
|
86
|
+
const index = parseInt(bracket, 10);
|
|
87
|
+
current = next.flatMap(item => (item !== null && item !== undefined && item[index] !== undefined ? [item[index]] : []));
|
|
88
|
+
} else {
|
|
89
|
+
current = next;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return current;
|
|
94
|
+
}
|
|
95
|
+
|
|
50
96
|
/**
|
|
51
97
|
* ## Is Browse
|
|
52
98
|
* Is this a Browse request or a Read request?
|
|
@@ -83,10 +129,10 @@ function resolvePaths(globals, data, value) {
|
|
|
83
129
|
path = path.replace(/\.\[/g, '[');
|
|
84
130
|
|
|
85
131
|
if (path.charAt(0) === '@') {
|
|
86
|
-
result =
|
|
132
|
+
result = querySimplePath(globals, path.slice(1));
|
|
87
133
|
} else {
|
|
88
134
|
// Do the query, which always returns an array of matches
|
|
89
|
-
result =
|
|
135
|
+
result = querySimplePath(data, path);
|
|
90
136
|
}
|
|
91
137
|
|
|
92
138
|
// Handle the case where the single data property we return is a Date
|
|
@@ -352,3 +398,5 @@ module.exports = async function get(resource, options) {
|
|
|
352
398
|
module.exports.async = true;
|
|
353
399
|
|
|
354
400
|
module.exports.optimiseFilterCacheability = optimiseFilterCacheability;
|
|
401
|
+
|
|
402
|
+
module.exports.querySimplePath = querySimplePath;
|
|
@@ -3,15 +3,18 @@ const slugFilterOrder = (table, filter) => {
|
|
|
3
3
|
|
|
4
4
|
if (orderMatch) {
|
|
5
5
|
let orderSlugs = orderMatch[1].split(',');
|
|
6
|
-
let
|
|
6
|
+
let caseParts = [];
|
|
7
|
+
let bindings = [];
|
|
7
8
|
|
|
8
9
|
orderSlugs.forEach((slug, index) => {
|
|
9
|
-
|
|
10
|
+
caseParts.push(`WHEN \`${table}\`.\`slug\` = ? THEN ?`);
|
|
11
|
+
bindings.push(slug.trim(), index);
|
|
10
12
|
});
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
return {
|
|
15
|
+
sql: `CASE ${caseParts.join(' ')} END ASC`,
|
|
16
|
+
bindings
|
|
17
|
+
};
|
|
15
18
|
}
|
|
16
19
|
};
|
|
17
20
|
|
|
@@ -101,7 +101,12 @@ module.exports = function (Bookshelf) {
|
|
|
101
101
|
options.order = order;
|
|
102
102
|
options.eagerLoad = eagerLoad;
|
|
103
103
|
} else if (options.autoOrder) {
|
|
104
|
-
|
|
104
|
+
if (typeof options.autoOrder === 'object') {
|
|
105
|
+
options.orderRaw = options.autoOrder.sql;
|
|
106
|
+
options.orderRawBindings = options.autoOrder.bindings;
|
|
107
|
+
} else {
|
|
108
|
+
options.orderRaw = options.autoOrder;
|
|
109
|
+
}
|
|
105
110
|
} else if (this.orderDefaultRaw) {
|
|
106
111
|
options.orderRaw = this.orderDefaultRaw(options);
|
|
107
112
|
} else if (this.orderDefaultOptions) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ghost",
|
|
3
|
-
"version": "6.19.
|
|
3
|
+
"version": "6.19.1",
|
|
4
4
|
"description": "The professional publishing platform",
|
|
5
5
|
"author": "Ghost Foundation",
|
|
6
6
|
"homepage": "https://ghost.org",
|
|
@@ -32,8 +32,9 @@
|
|
|
32
32
|
"test:single": "yarn test:base --timeout=60000",
|
|
33
33
|
"test:all": "yarn test:unit && yarn test:integration && yarn test:e2e && yarn lint",
|
|
34
34
|
"test:debug": "DEBUG=ghost:test* yarn test",
|
|
35
|
-
"test:unit": "c8 yarn test:unit
|
|
35
|
+
"test:unit": "c8 yarn test:unit:${GHOST_UNIT_TEST_VARIANT:-base}",
|
|
36
36
|
"test:unit:base": "yarn test:base './test/unit' --timeout=2000",
|
|
37
|
+
"test:unit:ci": "yarn test:unit:base --reporter=min",
|
|
37
38
|
"test:integration": "yarn test:base './test/integration' --timeout=10000",
|
|
38
39
|
"test:e2e": "yarn test:base ./test/e2e-* --timeout=15000",
|
|
39
40
|
"test:legacy": "yarn test:base './test/legacy' --timeout=60000",
|
|
@@ -70,8 +71,8 @@
|
|
|
70
71
|
"@slack/webhook": "7.0.6",
|
|
71
72
|
"@tryghost/adapter-base-cache": "0.1.17",
|
|
72
73
|
"@tryghost/admin-api-schema": "4.5.10",
|
|
73
|
-
"@tryghost/api-framework": "1.0.
|
|
74
|
-
"@tryghost/bookshelf-plugins": "0.6.
|
|
74
|
+
"@tryghost/api-framework": "1.0.3",
|
|
75
|
+
"@tryghost/bookshelf-plugins": "0.6.29",
|
|
75
76
|
"@tryghost/color-utils": "0.2.10",
|
|
76
77
|
"@tryghost/config-url-helpers": "1.0.17",
|
|
77
78
|
"@tryghost/custom-fonts": "1.0.2",
|
|
@@ -83,7 +84,7 @@
|
|
|
83
84
|
"@tryghost/helpers": "1.1.97",
|
|
84
85
|
"@tryghost/html-to-plaintext": "1.0.4",
|
|
85
86
|
"@tryghost/http-cache-utils": "0.1.20",
|
|
86
|
-
"@tryghost/i18n": "file:components/tryghost-i18n-6.19.
|
|
87
|
+
"@tryghost/i18n": "file:components/tryghost-i18n-6.19.1.tgz",
|
|
87
88
|
"@tryghost/image-transform": "1.4.6",
|
|
88
89
|
"@tryghost/job-manager": "1.0.3",
|
|
89
90
|
"@tryghost/kg-card-factory": "5.1.7",
|
|
@@ -105,7 +106,7 @@
|
|
|
105
106
|
"@tryghost/mw-vhost": "1.0.1",
|
|
106
107
|
"@tryghost/nodemailer": "0.3.48",
|
|
107
108
|
"@tryghost/nql": "0.12.8",
|
|
108
|
-
"@tryghost/parse-email-address": "file:components/tryghost-parse-email-address-6.19.
|
|
109
|
+
"@tryghost/parse-email-address": "file:components/tryghost-parse-email-address-6.19.1.tgz",
|
|
109
110
|
"@tryghost/pretty-cli": "1.2.47",
|
|
110
111
|
"@tryghost/prometheus-metrics": "1.0.2",
|
|
111
112
|
"@tryghost/promise": "0.3.15",
|
|
@@ -171,7 +172,6 @@
|
|
|
171
172
|
"intl-messageformat": "5.4.3",
|
|
172
173
|
"js-yaml": "4.1.0",
|
|
173
174
|
"jsonc-parser": "3.3.1",
|
|
174
|
-
"jsonpath": "1.2.1",
|
|
175
175
|
"jsonwebtoken": "8.5.1",
|
|
176
176
|
"juice": "9.1.0",
|
|
177
177
|
"keypair": "1.0.4",
|
|
@@ -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.19.
|
|
275
|
-
"@tryghost/parse-email-address": "file:components/tryghost-parse-email-address-6.19.
|
|
274
|
+
"@tryghost/i18n": "file:components/tryghost-i18n-6.19.1.tgz",
|
|
275
|
+
"@tryghost/parse-email-address": "file:components/tryghost-parse-email-address-6.19.1.tgz"
|
|
276
276
|
},
|
|
277
277
|
"nx": {
|
|
278
278
|
"targets": {
|
|
@@ -320,7 +320,13 @@
|
|
|
320
320
|
},
|
|
321
321
|
"test:unit": {
|
|
322
322
|
"dependsOn": [
|
|
323
|
-
"build:assets"
|
|
323
|
+
"build:assets",
|
|
324
|
+
{
|
|
325
|
+
"projects": [
|
|
326
|
+
"@tryghost/parse-email-address"
|
|
327
|
+
],
|
|
328
|
+
"target": "build"
|
|
329
|
+
}
|
|
324
330
|
]
|
|
325
331
|
},
|
|
326
332
|
"test:browser": {
|