ghost 6.25.0 → 6.25.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.25.1.tgz +0 -0
- package/components/{tryghost-parse-email-address-6.25.0.tgz → tryghost-parse-email-address-6.25.1.tgz} +0 -0
- package/core/built/admin/assets/{PolarAngleAxis-BNo3yZOE.js → PolarAngleAxis-C6ZeSpZB.js} +1 -1
- package/core/built/admin/assets/{_baseAssignValue-DwWJd_kU.js → _baseAssignValue-BKAl5FrV.js} +1 -1
- package/core/built/admin/assets/{a-large-small-DzN0AB7t.js → a-large-small-B_ulQCIs.js} +1 -1
- package/core/built/admin/assets/admin-x-settings/admin-x-settings.js +1 -1
- package/core/built/admin/assets/admin-x-settings/{code-editor-view-De3K_osj.mjs → code-editor-view-CBYT1gA1.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/{index-bGxDzD13.mjs → index-CN5CixaU.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/{index-5D8KqsFU.mjs → index-CPQODntW.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/{index-BIUDn7ot.mjs → index-CgTfOd7g.mjs} +9 -9
- package/core/built/admin/assets/admin-x-settings/{modals-DuokUyAH.mjs → modals-_y-6HROx.mjs} +2 -2
- package/core/built/admin/assets/{at-sign-vqoOA4VZ.js → at-sign-B8xWKM0y.js} +1 -1
- package/core/built/admin/assets/{audience-CFjVlFTu.js → audience-CBOR--z9.js} +1 -1
- package/core/built/admin/assets/{avatar-flipboard-DuTJ0ty5.js → avatar-flipboard-IipGb_wZ.js} +1 -1
- package/core/built/admin/assets/{bluesky-sharing-C1WkXrRJ.js → bluesky-sharing-CkI1QuAm.js} +1 -1
- package/core/built/admin/assets/{chart-Bs2L1q8g.js → chart-_slUcr-K.js} +1 -1
- package/core/built/admin/assets/{chunk.524.ed5714f505e821e549f3.js → chunk.524.5b9b463506a16221fc91.js} +6 -6
- package/core/built/admin/assets/{chunk.582.639cecaca9e77bd7dd4f.js → chunk.582.d8eae1661d753befaefd.js} +7 -7
- package/core/built/admin/assets/{chunk.603.5cb992da88800a9388f3.js → chunk.630.3dbb0231a2d871126a80.js} +4 -4
- package/core/built/admin/assets/{code-editor-view-DIH4grxv.js → code-editor-view-BWMqr2JV.js} +1 -1
- package/core/built/admin/assets/comments-BeoA0nfK.js +1 -0
- package/core/built/admin/assets/{content-helpers-Cr_DHEOl.js → content-helpers-CmTGdEmL.js} +1 -1
- package/core/built/admin/assets/{copy-w3c9zkaZ.js → copy-CDHcAPJw.js} +1 -1
- package/core/built/admin/assets/{data-list-D-K_XfF3.js → data-list-Crb1ffbp.js} +1 -1
- package/core/built/admin/assets/{deleted-feed-item-DK47iaMV.js → deleted-feed-item-DBW0zJQg.js} +1 -1
- package/core/built/admin/assets/{dropzone-BHWXAN0m.js → dropzone-B9JUsQlW.js} +3 -3
- package/core/built/admin/assets/{edit-profile-DCyHhZgx.js → edit-profile-Dz-IhetN.js} +1 -1
- package/core/built/admin/assets/{empty-indicator-DjmACVr2.js → empty-indicator-2QGnEbtY.js} +1 -1
- package/core/built/admin/assets/{en-Cl0b7CNW.js → en-BRQS1Z8j.js} +1 -1
- package/core/built/admin/assets/{feed-C5AauoXf.js → feed-T3kW9UJA.js} +1 -1
- package/core/built/admin/assets/filters-ChOMQQZW.js +1 -0
- package/core/built/admin/assets/{gh-chart-xjwu2HZo.js → gh-chart-fuWw60Ka.js} +1 -1
- package/core/built/admin/assets/{growth-DDyypj0q.js → growth-D9sCnmon.js} +1 -1
- package/core/built/admin/assets/{hash-Bowe71Lt.js → hash-CI1pQ1UC.js} +1 -1
- package/core/built/admin/assets/header-OevT95FI.js +1 -0
- package/core/built/admin/assets/{inbox-DS4qMjUb.js → inbox-DYY8-M1K.js} +1 -1
- package/core/built/admin/assets/{index-A6WmqYr6.js → index-8CZdLQzu.js} +1 -1
- package/core/built/admin/assets/{index-6Ag8SK_E.js → index-BDAOs7pI.js} +1 -1
- package/core/built/admin/assets/{index-B_XhekWb.js → index-BEEgMX-_.js} +1 -1
- package/core/built/admin/assets/index-BbveDn8H.css +1 -0
- package/core/built/admin/assets/{index-CfpTfwls.js → index-C-Cpbee5.js} +1 -1
- package/core/built/admin/assets/{index-4xuWCs9h.js → index-CCF2RKxR.js} +12 -12
- package/core/built/admin/assets/{index-JMWMnGGt.js → index-CEnfjH5h.js} +3 -3
- package/core/built/admin/assets/{index-N61Xkr32.js → index-CcFVbffG.js} +1 -1
- package/core/built/admin/assets/{index-CZK1A375.js → index-CyMlhfZJ.js} +1 -1
- package/core/built/admin/assets/{index-CFY2MOp4.js → index-DBZYUfjO.js} +1 -1
- package/core/built/admin/assets/{index-C8ssgmjI.js → index-DJa3pLmx.js} +1 -1
- package/core/built/admin/assets/{index-SDMWxO5r.js → index-DVqmhe-L.js} +1 -1
- package/core/built/admin/assets/{index-BCvRITTU.js → index-DW5aEj6O.js} +2 -2
- package/core/built/admin/assets/{index-CVvW6Q-y.js → index-DcFgRUSN.js} +1 -1
- package/core/built/admin/assets/{index-DX6vaEVx.js → index-DjgsxHeB.js} +1 -1
- package/core/built/admin/assets/{index-B8XuCPIT.js → index-mqQc8MVd.js} +1 -1
- package/core/built/admin/assets/{index-DqlHFtZD.js → index-qQZsxgFE.js} +1 -1
- package/core/built/admin/assets/{koenig-lexical-DL3I-AcK.js → koenig-lexical-CsbE6fpi.js} +1 -1
- package/core/built/admin/assets/kpis-Dw04ruBN.js +1 -0
- package/core/built/admin/assets/{label-DBwnwMrX.js → label-tBvn89sm.js} +1 -1
- package/core/built/admin/assets/{links-CnjcW0lg.js → links-Do4jcjIh.js} +1 -1
- package/core/built/admin/assets/{loader-circle-CGDGFypO.js → loader-circle-C8exRUku.js} +4 -4
- package/core/built/admin/assets/{lucide-react-BfVLf4Hw.js → lucide-react-4VO5Dwow.js} +1 -1
- package/core/built/admin/assets/{main-layout-C_UH037j.js → main-layout-BAqXRgAx.js} +1 -1
- package/core/built/admin/assets/{member-route-CKuE9uDU.js → member-route-D4n-RbQd.js} +1 -1
- package/core/built/admin/assets/members-DRLgwCgJ.js +15 -0
- package/core/built/admin/assets/{message-square-text-BDJyLbG2.js → message-square-text-CC_1bY-Q.js} +5 -5
- package/core/built/admin/assets/{minus-BM0xhFIQ.js → minus-DSyx9DCe.js} +1 -1
- package/core/built/admin/assets/{modals-B6ZySU0x.js → modals-AryZr_DA.js} +1 -1
- package/core/built/admin/assets/{moderation-CQMIGpv1.js → moderation-DwKm9LO-.js} +1 -1
- package/core/built/admin/assets/{newsletter-Dexg7vU8.js → newsletter-C0rydPGS.js} +1 -1
- package/core/built/admin/assets/{newsletters-CT4k07rm.js → newsletters-DKdmxfDG.js} +1 -1
- package/core/built/admin/assets/{note-CiemurXq.js → note-996Zos9G.js} +1 -1
- package/core/built/admin/assets/{overview-9TwqfzGq.js → overview-r17hlWAB.js} +1 -1
- package/core/built/admin/assets/{pagemenu-Dq744OgH.js → pagemenu-DzpB1AkZ.js} +17 -17
- package/core/built/admin/assets/{post-analytics-CcRhLDKA.js → post-analytics-AwufPVFE.js} +1 -1
- package/core/built/admin/assets/{post-analytics-context-COgn3d86.js → post-analytics-context-GFe0lMc-.js} +1 -1
- package/core/built/admin/assets/{post-analytics-header-DtBp2QSX.js → post-analytics-header-DmGyNvP9.js} +1 -1
- package/core/built/admin/assets/{post-share-modal-BlOEKX3-.js → post-share-modal-CTpdCS2X.js} +1 -1
- package/core/built/admin/assets/posts/{comments-C4rwkXWy.mjs → comments-Cvt31uBs.mjs} +32 -31
- package/core/built/admin/assets/posts/{dialog-Chkt119L.mjs → dialog-DaViJlnd.mjs} +3 -3
- package/core/built/admin/assets/posts/{dropdown-menu-CvSs_ay2.mjs → dropdown-menu-B4KGMiRI.mjs} +5 -5
- package/core/built/admin/assets/posts/{empty-indicator-GyeO28CG.mjs → empty-indicator-BaD6pCXM.mjs} +2 -2
- package/core/built/admin/assets/posts/{filters-BD3A2GlB.mjs → filters-BsCI4RJg.mjs} +11 -7
- package/core/built/admin/assets/posts/{get-site-timezone-Baeue4hE.mjs → get-site-timezone-Bo-iI2bI.mjs} +2 -2
- package/core/built/admin/assets/posts/{growth-kmVbKjBt.mjs → growth-BJxIDp2o.mjs} +14 -14
- package/core/built/admin/assets/posts/header-7zhnErbb.mjs +100 -0
- package/core/built/admin/assets/posts/{heading-DV_WQJh4.mjs → heading-BCDx_eVF.mjs} +2 -2
- package/core/built/admin/assets/posts/{hooks-DQhsid0U.mjs → hooks-DQL2O_El.mjs} +2 -2
- package/core/built/admin/assets/posts/{index-CVum5OE6.mjs → index-0mEgtljt.mjs} +3 -3
- package/core/built/admin/assets/posts/{index-Bl1ReYmV.mjs → index-BTzJVQ6S.mjs} +10 -10
- package/core/built/admin/assets/posts/{input-C7qFEkmt.mjs → input-DaHXv92f.mjs} +2 -2
- package/core/built/admin/assets/posts/{kpis-DteuJY-D.mjs → kpis-GRsx6fPV.mjs} +10 -10
- package/core/built/admin/assets/posts/{links-eoZr0T0x.mjs → links-B1q_pqE9.mjs} +4 -4
- package/core/built/admin/assets/posts/{loading-indicator-Dj1SCL40.mjs → loading-indicator-DiYqXomj.mjs} +3 -3
- package/core/built/admin/assets/posts/{main-layout-Ct-TA0TH.mjs → main-layout-DeqPTJTe.mjs} +2 -2
- package/core/built/admin/assets/posts/{members-BY9oPKo4.mjs → members-LABk5yI5.mjs} +3055 -2831
- package/core/built/admin/assets/posts/{newsletter-BR1tln6E.mjs → newsletter-C_nbHBaP.mjs} +15 -15
- package/core/built/admin/assets/posts/{overview-j1ANMAQ2.mjs → overview-AJnKv4Ze.mjs} +16 -16
- package/core/built/admin/assets/posts/{post-analytics-DnG-Rolr.mjs → post-analytics-b_CKsePp.mjs} +6 -6
- package/core/built/admin/assets/posts/{post-analytics-context-hiKFF4yE.mjs → post-analytics-context-D6jtpxxm.mjs} +5 -5
- package/core/built/admin/assets/posts/{post-analytics-header-OqAJ8SUL.mjs → post-analytics-header-R5UF_tF0.mjs} +11 -11
- package/core/built/admin/assets/posts/{post-share-modal-BWfujDu2.mjs → post-share-modal-y4BEOajk.mjs} +4 -4
- package/core/built/admin/assets/posts/{posts-CS9tqSJC.mjs → posts-C2hNrf1c.mjs} +2 -2
- package/core/built/admin/assets/posts/posts.js +1 -1
- package/core/built/admin/assets/posts/{reply-CX_EQh9X.mjs → reply-2Uvi3Kxb.mjs} +2 -2
- package/core/built/admin/assets/posts/{search-BqzdnPQb.mjs → search-se7meOnL.mjs} +2 -2
- package/core/built/admin/assets/posts/{select-CD5WLIrZ.mjs → select-DpUpauFg.mjs} +8 -8
- package/core/built/admin/assets/posts/{separator-DFPLsWCc.mjs → separator-CdBM46dw.mjs} +3 -3
- package/core/built/admin/assets/posts/{settings-lnEt3Kb-.mjs → settings-Chhj9xKP.mjs} +2 -2
- package/core/built/admin/assets/posts/{sheet-CkLfUqdH.mjs → sheet--k3SiDko.mjs} +3 -3
- package/core/built/admin/assets/posts/{skeleton-BZCi-IYy.mjs → skeleton-CUSLSLoY.mjs} +3 -3
- package/core/built/admin/assets/posts/{source-icon-C0k2hDC_.mjs → source-icon-BjYUIoXN.mjs} +3 -3
- package/core/built/admin/assets/posts/{stats-AHbSTqzG.mjs → stats-BRdXKaxM.mjs} +4 -4
- package/core/built/admin/assets/posts/{table-DMrf6wp5.mjs → table-Bgi_UcfL.mjs} +2 -2
- package/core/built/admin/assets/posts/{tabs-BH8GNJCe.mjs → tabs-DT8Bh72E.mjs} +14 -14
- package/core/built/admin/assets/posts/{tags-C5VV8Gd0.mjs → tags-BCFLnZYl.mjs} +61 -60
- package/core/built/admin/assets/posts/{tags-DucujdYI.mjs → tags-Kv2q0o3p.mjs} +2 -2
- package/core/built/admin/assets/posts/{use-scroll-restoration-C7A3TpAz.mjs → use-scroll-restoration-CLAUAal3.mjs} +6 -6
- package/core/built/admin/assets/posts/{virtual-list-window-BIGoc0th.mjs → virtual-list-window-CQDEqNBL.mjs} +180 -274
- package/core/built/admin/assets/posts/{web-DczNailO.mjs → web-CqN0MQU6.mjs} +18 -18
- package/core/built/admin/assets/{posts-Dr3u9yOp.js → posts-GvXDuhVG.js} +1 -1
- package/core/built/admin/assets/{referrers-6As_USul.js → referrers-Bd9pW-WX.js} +1 -1
- package/core/built/admin/assets/{repeat-D-Ki-Cg5.js → repeat-y6HlMgGO.js} +2 -2
- package/core/built/admin/assets/{reply-C4V0xZ2U.js → reply-Cc8ryI5v.js} +2 -2
- package/core/built/admin/assets/{select-Dt579MbD.js → select-CGr_5qad.js} +1 -1
- package/core/built/admin/assets/{settings-BMsoTszq.js → settings-BPsfSgg3.js} +1 -1
- package/core/built/admin/assets/{settings-Ck1Hqs1x.js → settings-BTd0Adha.js} +4 -4
- package/core/built/admin/assets/{sort-button-Bn325H3y.js → sort-button-k76_5HR2.js} +1 -1
- package/core/built/admin/assets/{source-icon-CNqsYZeA.js → source-icon-DMt0UskC.js} +1 -1
- package/core/built/admin/assets/{sprout-C9DbfYGe.js → sprout-Td9eaOoY.js} +2 -2
- package/core/built/admin/assets/{square-CWrI0H4v.js → square-Df8vEYlG.js} +1 -1
- package/core/built/admin/assets/stats/{audience-DBW5Xu1c.mjs → audience-DMTObpL8.mjs} +3 -3
- package/core/built/admin/assets/stats/{content-helpers-BR6DcWwH.mjs → content-helpers-ReMp9KJN.mjs} +4 -4
- package/core/built/admin/assets/stats/{index-CFvGHbAV.mjs → index-6L-yLKFX.mjs} +8 -8
- package/core/built/admin/assets/stats/{index-BuS4r1cs.mjs → index-CIUyjeP-.mjs} +5 -5
- package/core/built/admin/assets/stats/{index-DKS4mzS-.mjs → index-CMSDpQm3.mjs} +11 -7
- package/core/built/admin/assets/stats/{index-ZjicrvMA.mjs → index-Ca-_KJzy.mjs} +5 -5
- package/core/built/admin/assets/stats/{index-TeAxlGlY.mjs → index-CfO5yPSP.mjs} +5 -5
- package/core/built/admin/assets/stats/{sort-button-DbwzvVKL.mjs → sort-button-BB_M2CdZ.mjs} +3 -3
- package/core/built/admin/assets/stats/{stats-BatzfgdA.mjs → stats-B2nnuLeU.mjs} +2 -2
- package/core/built/admin/assets/stats/stats.js +1 -1
- package/core/built/admin/assets/stats/{tabs-B32ptD5t.mjs → tabs-DjJG-d3O.mjs} +3 -3
- package/core/built/admin/assets/stats/{use-growth-stats-DmTT2gKd.mjs → use-growth-stats-BMT5M7l6.mjs} +3 -3
- package/core/built/admin/assets/{stats-G4Ge9ETb.js → stats-Bs9ZbmXX.js} +1 -1
- package/core/built/admin/assets/{stats-view-Bx3oDAIW.js → stats-view-BWoPuaLz.js} +1 -1
- package/core/built/admin/assets/{step-1-y3anLU0g.js → step-1-BUvsuCs0.js} +1 -1
- package/core/built/admin/assets/{step-2-Dr1lGnHU.js → step-2-DI9ekXls.js} +1 -1
- package/core/built/admin/assets/{step-3-C_d2hvMs.js → step-3-DzT_XhaS.js} +2 -2
- package/core/built/admin/assets/{table-CbN_vbUx.js → table-BKqaEGAm.js} +1 -1
- package/core/built/admin/assets/{tabs-DFJzY5np.js → tabs-G6Ql8vbf.js} +1 -1
- package/core/built/admin/assets/tags-BHm-dlBs.js +1 -0
- package/core/built/admin/assets/{tags-Ddg8oG2Y.js → tags-_taMP0sJ.js} +1 -1
- package/core/built/admin/assets/{textarea-DikWsYMt.js → textarea-DcVuGYYq.js} +1 -1
- package/core/built/admin/assets/{tiers-B7qV_8mO.js → tiers-kv-xBoqQ.js} +1 -1
- package/core/built/admin/assets/{toggle-group-tXaaTD7P.js → toggle-group-DsatLdt7.js} +1 -1
- package/core/built/admin/assets/{topic-filter-bQtscKE6.js → topic-filter-DkJyIuAf.js} +1 -1
- package/core/built/admin/assets/{trash--VS50LgS.js → trash-BeZZgbn-.js} +1 -1
- package/core/built/admin/assets/{upload-Dz-DI9rQ.js → upload-BG7KNIn7.js} +4 -4
- package/core/built/admin/assets/{use-growth-stats-DNVioFUq.js → use-growth-stats-CNGdl44N.js} +1 -1
- package/core/built/admin/assets/{use-scroll-restoration-CxWEiCuS.js → use-scroll-restoration-CQ3w0W98.js} +1 -1
- package/core/built/admin/assets/{use-simple-pagination-BA6xsVQO.js → use-simple-pagination-BeIJ_5Vv.js} +1 -1
- package/core/built/admin/assets/{user-plus-B0tpOnLM.js → user-plus-CMxR50-Y.js} +1 -1
- package/core/built/admin/assets/{user-round-check-caJYm0bB.js → user-round-check-2nhPmqP3.js} +1 -1
- package/core/built/admin/assets/virtual-list-window-Uq8oKYVG.js +4 -0
- package/core/built/admin/assets/{wallet-cards-DBM65lA_.js → wallet-cards-CJcVzH0D.js} +1 -1
- package/core/built/admin/assets/{web-CSXixG1S.js → web-BPwTFKrc.js} +1 -1
- package/core/built/admin/index.html +5 -5
- package/core/server/services/members/service.js +0 -22
- package/core/server/services/verification/verification-webhook-service.js +2 -2
- package/core/server/services/verification/verification-webhook-service.ts +2 -2
- package/core/server/services/verification-trigger.js +34 -69
- package/core/shared/labs.js +2 -2
- package/package.json +5 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/components/tryghost-i18n-6.25.0.tgz +0 -0
- package/core/built/admin/assets/comments-gAnA10dK.js +0 -1
- package/core/built/admin/assets/filters-DzSJ1ez3.js +0 -1
- package/core/built/admin/assets/index-Chp0ODAU.css +0 -1
- package/core/built/admin/assets/kpis-Bm-hIEkf.js +0 -1
- package/core/built/admin/assets/members-CzztojNk.js +0 -15
- package/core/built/admin/assets/tags-D5g9tXZU.js +0 -1
- package/core/built/admin/assets/virtual-list-window-JdKgHS9L.js +0 -4
- package/core/shared/config/env/config.testing-browser.json +0 -98
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,
|
|
1
|
+
import{r as o,aK as $,az as K,j as t,aw as D,aL as B,ay as b,aM as j,aN as G,aO as W,aB as h,ax as O,z as f,aa as y,aP as q,B as H,aQ as Q}from"./index-CEnfjH5h.js";import{L as U}from"./lucide-react-4VO5Dwow.js";import{T as J}from"./wallet-cards-CJcVzH0D.js";var v="Tabs",[X]=D(v,[j]),C=j(),[Y,T]=X(v),w=o.forwardRef((e,a)=>{const{__scopeTabs:s,value:r,onValueChange:n,defaultValue:d,orientation:i="horizontal",dir:l,activationMode:g="automatic",...m}=e,u=$(l),[c,x]=K({prop:r,onChange:n,defaultProp:d??"",caller:v});return t.jsx(Y,{scope:s,baseId:B(),value:c,onValueChange:x,orientation:i,dir:u,activationMode:g,children:t.jsx(b.div,{dir:u,"data-orientation":i,...m,ref:a})})});w.displayName=v;var k="TabsList",R=o.forwardRef((e,a)=>{const{__scopeTabs:s,loop:r=!0,...n}=e,d=T(k,s),i=C(s);return t.jsx(G,{asChild:!0,...i,orientation:d.orientation,dir:d.dir,loop:r,children:t.jsx(b.div,{role:"tablist","aria-orientation":d.orientation,...n,ref:a})})});R.displayName=k;var I="TabsTrigger",_=o.forwardRef((e,a)=>{const{__scopeTabs:s,value:r,disabled:n=!1,...d}=e,i=T(I,s),l=C(s),g=M(i.baseId,r),m=P(i.baseId,r),u=r===i.value;return t.jsx(W,{asChild:!0,...l,focusable:!n,active:u,children:t.jsx(b.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":m,"data-state":u?"active":"inactive","data-disabled":n?"":void 0,disabled:n,id:g,...d,ref:a,onMouseDown:h(e.onMouseDown,c=>{!n&&c.button===0&&c.ctrlKey===!1?i.onValueChange(r):c.preventDefault()}),onKeyDown:h(e.onKeyDown,c=>{[" ","Enter"].includes(c.key)&&i.onValueChange(r)}),onFocus:h(e.onFocus,()=>{const c=i.activationMode!=="manual";!u&&!n&&c&&i.onValueChange(r)})})})});_.displayName=I;var V="TabsContent",A=o.forwardRef((e,a)=>{const{__scopeTabs:s,value:r,forceMount:n,children:d,...i}=e,l=T(V,s),g=M(l.baseId,r),m=P(l.baseId,r),u=r===l.value,c=o.useRef(u);return o.useEffect(()=>{const x=requestAnimationFrame(()=>c.current=!1);return()=>cancelAnimationFrame(x)},[]),t.jsx(O,{present:n||u,children:({present:x})=>t.jsx(b.div,{"data-state":u?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":g,hidden:!x,id:m,tabIndex:0,...i,ref:a,style:{...e.style,animationDuration:c.current?"0s":void 0},children:x&&d})})});A.displayName=V;function M(e,a){return`${e}-trigger-${a}`}function P(e,a){return`${e}-content-${a}`}var z=w,E=R,N=_,F=A;const p=o.createContext("segmented"),Z=o.forwardRef(({variant:e="segmented",...a},s)=>t.jsx(p.Provider,{value:e,children:t.jsx(z,{ref:s,...a})}));Z.displayName=z.displayName;const ee=y("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"}}),te=o.forwardRef(({className:e,...a},s)=>{const r=o.useContext(p);return t.jsx(E,{ref:s,className:f(ee({variant:r,className:e})),...a})});te.displayName=E.displayName;const L=y("inline-flex items-center justify-center px-3 py-1 whitespace-nowrap ring-offset-background transition-all focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-hidden 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"}}),S=o.forwardRef(({className:e,...a},s)=>{const r=o.useContext(p);return t.jsx(N,{ref:s,className:f(L({variant:r,className:e})),...a})});S.displayName=N.displayName;const ae=({className:e="",children:a})=>t.jsx("span",{className:`mt-px ml-1.5 flex h-5 items-center justify-center rounded-full bg-gray-200 px-1.5 py-0 text-xs leading-[21px] font-semibold text-gray-800 dark:bg-gray-900 dark:text-gray-300 ${e}`,children:a});ae.displayName="TabsTriggerCount";const re=y("ring-offset-background focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-hidden",{variants:{variant:{segmented:"","segmented-sm":"",button:"","button-sm":"",underline:"",navbar:"",pill:"",kpis:"ring-0"}},defaultVariants:{variant:"segmented"}}),se=o.forwardRef(({className:e,...a},s)=>{const r=o.useContext(p);return t.jsx(F,{ref:s,className:f(re({variant:r,className:e})),...a})});se.displayName=F.displayName;const ce=({children:e,...a})=>t.jsx(S,{className:"h-auto",...a,children:e}),ue=({color:e,icon:a,label:s,value:r,diffDirection:n,diffValue:d,className:i,"data-testid":l})=>{const g=a?U[a]:null,m=f("flex items-center gap-1 text-xs h-[22px] px-1.5 rounded-xs group/diff cursor-default mt-0.5",n==="up"&&"text-green-600 bg-green/10",n==="down"&&"text-red-600 bg-red/10",n==="same"&&"text-gray-700 bg-muted");return t.jsxs("div",{className:f("group flex w-full flex-col items-start gap-2",i),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}}),g&&t.jsx(g,{size:16,strokeWidth:1.5}),s]}),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] leading-none font-semibold tracking-tighter xl:text-[2.6rem]","data-testid":l,children:r}),n&&n!=="hidden"&&t.jsx(t.Fragment,{children:t.jsxs("div",{className:m,"data-testid":l?`${l}-diff`:void 0,children:[t.jsx("span",{className:"leading-none font-medium",children:d}),n==="up"&&t.jsx(q,{className:"size-[12px]!",size:14,strokeWidth:2}),n==="down"&&t.jsx(J,{className:"size-[12px]!",size:14,strokeWidth:2})]})})]})]})},ne=o.forwardRef(({variant:e="dropdown",className:a,...s},r)=>t.jsx(H,{ref:r,className:f("h-auto w-full rounded-none border-x-0 border-t-0 focus-visible:ring-0 bg-transparent py-5",a),variant:e,...s}));ne.displayName="KpiDropdownButton";const oe=o.forwardRef(({children:e,className:a,...s},r)=>{const n=o.useContext(p);return t.jsxs("div",{className:"relative rounded-md hover:bg-muted",children:[t.jsx(N,{ref:r,className:f(L({variant:n,className:a})),...s,children:t.jsx("div",{className:"flex items-center gap-2",children:e})}),t.jsx(Q,{className:"absolute inset-0 size-full cursor-pointer",onClick:d=>{d.preventDefault()}})]})});oe.displayName="TabsDropdownTrigger";export{F as C,ce as K,E as L,z as R,Z as T,te as a,S as b,se as c,ue as d,ne as e,ae as f,N as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,z as L,G as j,B as g,r as N,ao as R,ai as I,cn as C,e as z}from"./index-CEnfjH5h.js";import{T as B,a as b}from"./toggle-group-DsatLdt7.js";import{H as o}from"./header-OevT95FI.js";import{M as E}from"./main-layout-BAqXRgAx.js";import{u as S,a as $,L as k}from"./virtual-list-window-Uq8oKYVG.js";import{a as M,b as _,c as m,d,e as A,f as i}from"./table-BKqaEGAm.js";import{P as G,T as H}from"./tags-_taMP0sJ.js";import{E as q}from"./empty-indicator-2QGnEbtY.js";const Q=({children:a,className:t,...l})=>e.jsx("section",{className:L("flex gap-6 flex-col p-4 lg:p-8 size-full grow",t),...l,children:a}),V=({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(B,{"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"})})})]})]}),D=({children:a})=>e.jsx(E,{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}})}),O=N.forwardRef(function(t,l){return e.jsx(m,{ref:l,...t,"aria-hidden":"true",className:"relative flex flex-col lg:table-row",children:e.jsx(i,{className:"relative z-10 h-24 animate-pulse",children:e.jsx("div",{className:"h-full rounded-md bg-muted","data-testid":"loading-placeholder"})})})});function U({items:a,totalItems:t,hasNextPage:l,isFetchingNextPage:s,fetchNextPage:n}){const c=N.useRef(null),{visibleItemCount:x,canLoadMore:u,loadMore:h}=S(t),{visibleItems:v,spaceBefore:T,spaceAfter:y}=$({items:a,totalItems:x,hasNextPage:l,isFetchingNextPage:s,fetchNextPage:n,parentRef:c});return e.jsxs("div",{ref:c,className:"overflow-hidden",children:[e.jsxs(M,{className:"flex table-fixed flex-col lg:table","data-testid":"tags-list",children:[e.jsx(_,{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(A,{className:"flex flex-col lg:table-row-group",children:[e.jsx(w,{height:T}),v.map(({key:p,virtualItem:P,item:r,props:f})=>P.index>a.length-1?e.jsx(O,{...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(i,{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:top-0 before:left-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(i,{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(i,{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:`${R(r.count?.posts)} ${r.count?.posts===1?"post":"posts"}`}):e.jsx("span",{className:"text-muted-foreground",children:"0 posts"})}),e.jsx(i,{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(G,{})})})]},p)),e.jsx(w,{height:y})]})]}),u&&e.jsx(k,{isLoading:s,onClick:h})]})}const W="TagsResponseType",F=I({dataType:W,path:"/tags/",defaultNextPageParams:(a,t)=>{var l,s;return(l=a.meta)!=null&&l.pagination.next?{...t,page:(((s=a.meta)==null?void 0:s.pagination.next)||1).toString()}:void 0},returnData:a=>{const{pages:t}=a,l=t.flatMap(n=>n.tags),s=t[t.length-1].meta;return{tags:l,meta:s,isEnd:s?s.pagination.pages===s.pagination.page:!0}}}),J=({filter:a,...t})=>{const l=Object.entries(a).map(([s,n])=>`${s}:${n}`).join(",");return F({...t,searchParams:{limit:"100",order:"name asc",include:"count.posts",filter:l,...t.searchParams}})},re=()=>{const{search:a}=C(),l=new URLSearchParams(a).get("type")??"public",{data:s,isError:n,isLoading:c,isFetchingNextPage:x,fetchNextPage:u,hasNextPage:h}=J({filter:{visibility:l}});return e.jsxs(D,{children:[e.jsx(V,{currentTab:l}),e.jsx(Q,{children:c?e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(z,{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"})]}):s?.tags.length?e.jsx(U,{fetchNextPage:u,hasNextPage:h,isFetchingNextPage:x,items:s?.tags??[],totalItems:s?.meta?.pagination?.total??0}):e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(q,{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(H,{})})})})]})};export{re as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,j as o,z as t}from"./index-
|
|
1
|
+
import{r as s,j as o,z as t}from"./index-CEnfjH5h.js";const d=s.forwardRef(({className:e,...r},a)=>o.jsx("textarea",{ref:a,className:t("flex min-h-[80px] w-full rounded-md border border-transparent bg-gray-150 dark:bg-gray-900 px-3 py-2 text-base placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:bg-transparent focus-visible:border-green focus-visible:shadow-[0_0_0_2px_rgba(48,207,67,.25)] disabled:cursor-not-allowed disabled:opacity-50",e),...r}));d.displayName="Textarea";export{d as T};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ai as u,ag as s,aj as o}from"./index-CEnfjH5h.js";const i="TiersResponseType",d=u({dataType:i,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(n=>n.tiers),r=t[t.length-1].meta;return{tiers:a,meta:r,isEnd:r?r.pagination.pages===r.pagination.page:!0}}}),c=s({method:"POST",path:()=>"/tiers/",body:e=>({tiers:[e]}),invalidateQueries:{dataType:i}}),g=s({method:"PUT",path:e=>`/tiers/${e.id}/`,body:e=>({tiers:[e]}),updateQueries:{dataType:i,emberUpdateType:"createOrUpdate",update:o("tiers")}});function T(e){return e.filter(t=>t.type==="paid"&&t.active)}function f(e){return e.filter(t=>t.active)}function l(e){return e.filter(t=>!t.active)}export{g as a,c as b,f as c,l as d,T as g,d as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as v,
|
|
1
|
+
import{r as v,az as G,j as n,ay as x,aB as A,t as u,aw as F,aM as y,aO as $,aK as D,aN as B,aa as O,z as b}from"./index-CEnfjH5h.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:A(e.onClick,()=>{e.disabled||i(!s)})})});T.displayName=C;var j=T,c="ToggleGroup",[_]=F(c,[y]),I=y(),h=u.forwardRef((e,o)=>{const{type:r,...t}=e;if(r==="single"){const a=t;return n.jsx(H,{...a,ref:o})}if(r==="multiple"){const a=t;return n.jsx(K,{...a,ref:o})}throw new Error(`Missing prop \`type\` expected on \`${c}\``)});h.displayName=c;var[N,R]=_(c),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});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})})}),K=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(S=>S!==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(P,{...i,ref:o})}):n.jsx(P,{...i,ref:o})});k.displayName=f;var P=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-xs text-sm font-medium text-gray-700 transition-colors hover:bg-gray-200 hover:text-foreground focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden 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"}}),q=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}));q.displayName=j.displayName;const z=v.createContext({size:"default",variant:"default"}),J=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(z.Provider,{value:{variant:o,size:r},children:t})}));J.displayName=V.displayName;const Q=v.forwardRef(({className:e,children:o,variant:r,size:t,...a},l)=>{const s=v.useContext(z);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{J 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-CEnfjH5h.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 max-w-full min-w-0 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 top-0 right-0 h-full w-12 bg-gradient-to-l from-white to-transparent dark:from-black"})]})};export{k as T};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{aq as a}from"./index-CEnfjH5h.js";/**
|
|
2
2
|
* @license lucide-react v0.553.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -58,14 +58,14 @@ import{ap as a}from"./index-JMWMnGGt.js";/**
|
|
|
58
58
|
*
|
|
59
59
|
* This source code is licensed under the ISC license.
|
|
60
60
|
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
-
*/const r=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],
|
|
61
|
+
*/const r=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],q=a("send",r);/**
|
|
62
62
|
* @license lucide-react v0.553.0 - ISC
|
|
63
63
|
*
|
|
64
64
|
* This source code is licensed under the ISC license.
|
|
65
65
|
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
-
*/const i=[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]],
|
|
66
|
+
*/const i=[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]],u=a("ticket",i);/**
|
|
67
67
|
* @license lucide-react v0.553.0 - ISC
|
|
68
68
|
*
|
|
69
69
|
* This source code is licensed under the ISC license.
|
|
70
70
|
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
-
*/const l=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],
|
|
71
|
+
*/const l=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],b=a("upload",l);export{m as A,v as C,N as D,f as M,H as N,V as P,q as S,u as T,b as U,g as a,$ as b,x as c,_ as d,w as e};
|
package/core/built/admin/assets/{use-growth-stats-DNVioFUq.js → use-growth-stats-CNGdl44N.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as C,
|
|
1
|
+
import{r as C,ak as E,al as F,am as s,an as _,ao as H}from"./index-CEnfjH5h.js";import{u as v,a as V,b as j}from"./stats-Bs9ZbmXX.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:H(L),label:"Total members"}})},X=r=>{const{startDate:b,endDate:D}=C.useMemo(()=>E(r),[r]),i=F(b),p=r===1?s(i).subtract(1,"day").format("YYYY-MM-DD"):i,{data:l,isLoading:P}=v({searchParams:{date_from:p}}),{data:d,isLoading:g}=V({searchParams:{date_from:p}}),{data:M,isLoading:y}=j(),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)),x=[...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=x.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 k=r===1?s().startOf("day"):R;if(!h.some(n=>s(n.date).isSame(k,"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:k.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 +1 @@
|
|
|
1
|
-
import{cQ as V,r as l,
|
|
1
|
+
import{cQ as V,r as l,ai as z,cz as $,cA as Q,cy as k,j as M,z as Y,bS as q,cn as G}from"./index-CEnfjH5h.js";import{b as U}from"./posts-GvXDuhVG.js";import{g as X}from"./virtual-list-window-Uq8oKYVG.js";function j(e){return`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function J(e,t){if(t.length!==0)return`${e}:[${t.map(o=>j(o)).join(",")}]`}function he(e,t){const o=t.trim().toLowerCase();return o?e.filter(n=>n.label.toLowerCase().includes(o)||n.detail?.toLowerCase().includes(o)):e}function B(...e){const t=new Map;for(const o of e)if(o)for(const n of o)t.has(n.value)||t.set(n.value,n);return[...t.values()]}const H=()=>{};function W(e){return function(o={}){const{enabled:n=!0}=o,s=()=>{const u=e.useBrowse("",{enabled:!0}),a=l.useMemo(()=>(u.data||[]).map(e.toOption),[u.data]);return{items:u.data,options:a,isLoading:u.isLoading,pagination:u.pagination}},d=({query:u,selectedValues:a})=>{const[c]=V(u,e.debounceMs??200),i=e.useBrowse(c,{enabled:n}),r=e.useHydrate?.(a,{enabled:n}),h=l.useMemo(()=>(i.data||[]).map(e.toOption),[i.data]),f=l.useMemo(()=>(r?.data||[]).map(e.toOption),[r?.data]),p=l.useMemo(()=>B(f,h),[f,h]);return n?{options:p,isInitialLoad:i.isLoading&&p.length===0,isSearching:!i.isLoading&&i.isRefreshing&&!i.isLoadingMore,isLoadingMore:i.isLoadingMore,hasMore:i.hasMore,loadMore:i.loadMore??H}:{options:[],isInitialLoad:!1,isSearching:!1,isLoadingMore:!1,hasMore:!1,loadMore:H}};return{id:e.id,useInitialBrowse:s,useOptions:d}}}function Z(e){return{filter:e}}function ee(e){return J("id",e)}function C(e){return{limit:"100",...e}}function D({id:e,buildBrowseSearchParams:t,buildHydrateSearchParams:o=Z,buildHydrateFilter:n=ee,debounceMs:s,selectItems:d,toOption:u,useQuery:a}){return W({id:e,useBrowse:(c,i)=>{const r=a({enabled:i.enabled??!0,searchParams:C(t(c))});return{data:d(r.data),isLoading:r.isLoading,isRefreshing:r.isFetching,isLoadingMore:r.isFetchingNextPage,hasMore:!!r.hasNextPage,loadMore:r.fetchNextPage,pagination:r.data?.meta?.pagination}},useHydrate:(c,i)=>{const r=n(c),h={};typeof r=="string"&&Object.assign(h,C(o(r)));const p=a({enabled:(i.enabled??!0)&&c.length>0,searchParams:h});return{data:d(p.data),isLoading:p.isLoading}},toOption:u,debounceMs:s})}const te="PagesResponseType",oe=z({dataType:te,path:"/pages/",defaultNextPageParams:(e,t)=>{var o;if((o=e.meta)!=null&&o.pagination.next)return{...t,page:e.meta.pagination.next.toString()}},returnData:e=>{const{pages:t}=e,o=t.flatMap(s=>s.pages),n=t[t.length-1].meta;return{pages:o,meta:n,isEnd:n?n.pagination.pages===n.pagination.page:!0}}});function ne(e,t){return function(n){const s=e(n),d=t(n),u=l.useCallback(({query:a,selectedValues:c})=>{const i=s.useOptions({query:a,selectedValues:c}),r=d.useOptions({query:a,selectedValues:c});return{options:B(i.options,r.options),isInitialLoad:i.options.length===0&&r.options.length===0&&(i.isInitialLoad||r.isInitialLoad),isSearching:i.isSearching||r.isSearching,isLoadingMore:i.isLoadingMore||r.isLoadingMore,hasMore:i.hasMore||r.hasMore,loadMore:()=>{i.hasMore&&i.loadMore(),r.hasMore&&r.loadMore()}}},[s,d]);return l.useMemo(()=>({id:`${s.id}+${d.id}`,useOptions:u}),[s.id,d.id,u])}}function re(e){return e?`status:published+title:~${j(e)}`:"status:published"}function se(e){return{value:e.id,label:e.title}}function ie(e){return{value:e.id,label:e.title,detail:"Page"}}const K=e=>({filter:re(e),limit:"25",fields:"id,title",order:"published_at DESC"}),A=e=>({fields:"id,title",filter:e}),ae=D({id:"posts.published.remote",buildBrowseSearchParams:K,buildHydrateSearchParams:A,selectItems:e=>e?.posts,useQuery:({enabled:e,searchParams:t})=>U({enabled:e,keepPreviousData:!0,searchParams:t}),toOption:se}),ue=D({id:"pages.published.remote",buildBrowseSearchParams:K,buildHydrateSearchParams:A,selectItems:e=>e?.pages,useQuery:({enabled:e,searchParams:t})=>oe({enabled:e,keepPreviousData:!0,searchParams:t}),toOption:ie}),ce=ne(ae,ue);function Se(){return ce()}function Pe({avatarImage:e,memberId:t,memberName:o,memberEmail:n,isHidden:s,className:d}){const u={name:o||void 0,email:n||void 0},a=!!(o||n),c=a?$(u):null,i=a?Q(k(u),"75","55"):void 0;return M.jsxs("div",{className:Y("relative flex size-6 min-w-6 items-center justify-center overflow-hidden rounded-full md:size-8 md:min-w-8",!a&&"bg-accent",s&&"opacity-50",d),style:a?{backgroundColor:i}:void 0,children:[c?M.jsx("span",{className:"text-xs font-semibold text-white md:text-sm",children:c}):M.jsx(q,{className:"size-3! text-muted-foreground md:size-4!",size:12}),t&&e&&M.jsx("div",{className:"absolute inset-0",children:M.jsx("img",{alt:"Member avatar",src:e})})]})}const x=new Map,I="ghostVirtualListScrollPosition",N=150,le=500;function T(){if(!(typeof window>"u"))return window.history.state}function E(e){const t=e?.key;if(typeof t=="string"||typeof t=="number")return String(t);const o=e?.idx;if(typeof o=="number")return String(o)}function _(e,t){const o=E(e);if(o)return`${o}::${t}`}function de(e,t){const o=e?.[I];if(!o||typeof o!="object")return;const n=o[t];if(typeof n=="number")return n}function fe(e,t,o){if(typeof window>"u")return;const n=e?.[I],s={...e??{},[I]:{...n&&typeof n=="object"?n:{},[t]:o}};window.history.replaceState(s,"")}function ye({parentRef:e,enabled:t=!0,isLoading:o=!1}){const n=G(),[s,d]=l.useState(null),u=l.useRef(null),a=l.useRef(0),c=l.useRef(0),i=l.useRef(0),r=l.useRef(null),h=l.useRef(new Set),f=n.pathname+n.search;l.useEffect(()=>{if(!t||!e.current)return;const p=X(e.current);d(p)},[t,e]),l.useEffect(()=>{if(!t||!s)return;const p=T(),L=E(p),S=_(p,f),y=()=>{r.current!==null&&(window.clearTimeout(r.current),r.current=null)},b=g=>{S&&x.set(S,g);const m=T();E(m)===L&&fe(m,f,g),c.current=Date.now(),i.current=g},v=({persistToHistory:g=!0}={})=>{if(y(),!g){const m=a.current;S&&x.set(S,m),c.current=Date.now(),i.current=m;return}b(a.current)},O=()=>{const g=Date.now();if(Math.abs(a.current-i.current)>=le||g-c.current>=N){y(),b(a.current);return}r.current===null&&(r.current=window.setTimeout(()=>{r.current=null,b(a.current)},N))},w=()=>{a.current=s.scrollTop,O()},P=()=>{v()};return a.current=s.scrollTop,s.addEventListener("scroll",w),window.addEventListener("pagehide",P),()=>{v({persistToHistory:!1}),s.removeEventListener("scroll",w),window.removeEventListener("pagehide",P)}},[t,f,s]),l.useEffect(()=>{const p=T(),L=_(p,f),S=(L?x.get(L):void 0)??de(p,f);if(!(!t||!s||o)){if(S!==void 0&&u.current!==f){u.current=f;let y=0;const b=20,v=()=>{for(const P of h.current)window.clearTimeout(P);h.current.clear()},O=(P,g)=>{const m=window.setTimeout(()=>{h.current.delete(m),P()},g);h.current.add(m)},w=()=>{if(y+=1,!s)return;const P=s.scrollTop,g=s.scrollHeight,m=s.clientHeight,R=g-m;if(S>R&&y<b){O(w,100);return}if(Math.abs(S-P)>5){const F=Math.min(S,R);s.scrollTop=F}};return O(w,150),()=>v()}u.current=f}},[t,f,s,o])}export{Pe as M,ye as a,J as b,D as c,j as e,he as f,B as m,Se as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as u,j as i,z as l,B as c,
|
|
1
|
+
import{t as u,j as i,z as l,B as c,aJ as h,r as m}from"./index-CEnfjH5h.js";import{A as N}from"./lucide-react-4VO5Dwow.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 R=u.forwardRef(({variant:e="outline",...t},n)=>i.jsx(c,{ref:n,size:"sm",variant:e,...t,children:i.jsx(N,{})}));R.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,R as c,w as d,b as u};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{j as E,B as A,r as g,as as F,cn as L}from"./index-CEnfjH5h.js";const ee=({isLoading:n,onClick:l})=>{const e=!!n;return E.jsx("div",{className:"flex justify-center px-4 py-6",children:E.jsx(A,{disabled:e,variant:"outline",onClick:l,children:e?"Loading more...":"Load more"})})};function _(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 _(n.parentNode)||document.body}function b(n,l,e){let t=e.initialDeps??[],s;function o(){var i,r,a,c;let h;e.key&&((i=e.debug)!=null&&i.call(e))&&(h=Date.now());const d=n();if(!(d.length!==t.length||d.some((f,p)=>t[p]!==f)))return s;t=d;let m;if(e.key&&((r=e.debug)!=null&&r.call(e))&&(m=Date.now()),s=l(...d),e.key&&((a=e.debug)!=null&&a.call(e))){const f=Math.round((Date.now()-h)*100)/100,p=Math.round((Date.now()-m)*100)/100,w=p/16,y=(v,W)=>{for(v=String(v);v.length<W;)v=" "+v;return v};console.info(`%c⏱ ${y(p,5)} /${y(f,5)} ms`,`
|
|
2
|
+
font-size: .6rem;
|
|
3
|
+
font-weight: bold;
|
|
4
|
+
color: hsl(${Math.max(0,Math.min(120-120*w,120))}deg 100% 31%);`,e?.key)}return(c=e?.onChange)==null||c.call(e,s),s}return o.updateDeps=i=>{t=i},o}function M(n,l){if(n===void 0)throw new Error("Unexpected undefined");return n}const D=(n,l)=>Math.abs(n-l)<1.01,j=(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}},V=n=>n,B=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},N=(n,l)=>{const e=n.scrollElement;if(!e)return;const t=n.targetWindow;if(!t)return;const s=i=>{const{width:r,height:a}=i;l({width:Math.round(r),height:Math.round(a)})};if(s(z(e)),!t.ResizeObserver)return()=>{};const o=new t.ResizeObserver(i=>{const r=()=>{const a=i[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 o.observe(e,{box:"border-box"}),()=>{o.unobserve(e)}},O={passive:!0},I=typeof window>"u"?!0:"onscrollend"in window,H=(n,l)=>{const e=n.scrollElement;if(!e)return;const t=n.targetWindow;if(!t)return;let s=0;const o=n.options.useScrollendEvent&&I?()=>{}:j(t,()=>{l(s,!1)},n.options.isScrollingResetDelay),i=h=>()=>{const{horizontal:d,isRtl:u}=n.options;s=d?e.scrollLeft*(u&&-1||1):e.scrollTop,o(),l(s,h)},r=i(!0),a=i(!1);a(),e.addEventListener("scroll",r,O);const c=n.options.useScrollendEvent&&I;return c&&e.addEventListener("scrollend",a,O),()=>{e.removeEventListener("scroll",r),c&&e.removeEventListener("scrollend",a)}},K=(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"]},P=(n,{adjustments:l=0,behavior:e},t)=>{var s,o;const i=n+l;(o=(s=t.scrollElement)==null?void 0:s.scrollTo)==null||o.call(s,{[t.options.horizontal?"left":"top"]:i,behavior:e})};class U{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(o=>{const i=()=>{this._measureElement(o.target,o)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var s;(s=t())==null||s.disconnect(),e=null},observe:s=>{var o;return(o=t())==null?void 0:o.observe(s,{box:"border-box"})},unobserve:s=>{var o;return(o=t())==null?void 0:o.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:V,rangeExtractor:B,onChange:()=>{},measureElement:K,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=b(()=>(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,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=o,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,o=new Map;for(let i=t-1;i>=0;i--){const r=e[i];if(s.has(r.lane))continue;const a=o.get(r.lane);if(a==null||r.end>a.end?o.set(r.lane,r):r.end<a.end&&s.set(r.lane,!0),s.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((i,r)=>i.end===r.end?i.index-r.index:i.end-r.end)[0]:void 0},this.getMeasurementOptions=b(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(e,t,s,o,i)=>(this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:s,getItemKey:o,enabled:i}),{key:!1}),this.getMeasurements=b(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:t,scrollMargin:s,getItemKey:o,enabled:i},r)=>{if(!i)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 d=o(h),u=this.options.lanes===1?c[h-1]:this.getFurthestMeasurement(c,h),m=u?u.end+this.options.gap:t+s,f=r.get(d),p=typeof f=="number"?f:this.options.estimateSize(h),w=m+p,y=u?u.lane:h%this.options.lanes;c[h]={index:h,start:m,size:p,end:w,key:d,lane:y}}return this.measurementsCache=c,c},{key:!1,debug:()=>this.options.debug}),this.calculateRange=b(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,s,o)=>this.range=e.length>0&&t>0?$({measurements:e,outerSize:t,scrollOffset:s,lanes:o}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=b(()=>{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,o,i)=>o===null||i===null?[]:e({startIndex:o,endIndex:i,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),o=this.measurementsCache[s];if(!o)return;const i=o.key,r=this.elementsCache.get(i);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(i,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 o=this.itemSizeCache.get(s.key)??s.size,i=t-o;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,i,this):s.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,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=b(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{const s=[];for(let o=0,i=e.length;o<i;o++){const r=e[o],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[T(0,t.length-1,s=>M(t[s]).start,e)])},this.getOffsetForAlignment=(e,t,s=0)=>{const o=this.getSize(),i=this.getScrollOffset();t==="auto"&&(t=e>=i+o?"end":"start"),t==="center"?e+=(s-o)/2:t==="end"&&(e-=o);const r=this.getTotalSize()+this.options.scrollMargin-o;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 o=this.getSize(),i=this.getScrollOffset();if(t==="auto")if(s.end>=i+o-this.options.scrollPaddingEnd)t="end";else if(s.start<=i+this.options.scrollPaddingStart)t="start";else return[i,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 o=0;const i=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[d,u]=h;this._scrollToOffset(d,{adjustments:void 0,behavior:s}),this.targetWindow.requestAnimationFrame(()=>{const m=this.getScrollOffset(),f=this.getOffsetForIndex(e,u);if(!f){console.warn("Failed to get offset for index:",e);return}D(f[0],m)||a(u)})},a=c=>{this.targetWindow&&(o++,o<i?this.targetWindow.requestAnimationFrame(()=>r(c)):console.warn(`Failed to scroll to index ${e} after ${i} 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 o=Array(this.options.lanes).fill(null);let i=t.length-1;for(;i>=0&&o.some(r=>r===null);){const r=t[i];o[r.lane]===null&&(o[r.lane]=r.end),i--}s=Math.max(...o.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 T=(n,l,e,t)=>{for(;n<=l;){const s=(n+l)/2|0,o=e(s);if(o<t)n=s+1;else if(o>t)l=s-1;else return s}return n>0?n-1:0};function $({measurements:n,outerSize:l,scrollOffset:e,lanes:t}){const s=n.length-1,o=a=>n[a].start;if(n.length<=t)return{startIndex:0,endIndex:s};let i=T(0,s,o,e),r=i;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(;i>=0&&c.some(h=>h>=e);){const h=n[i];c[h.lane]=h.start,i--}i=Math.max(0,i-i%t),r=Math.min(s,r+(t-1-r%t))}return{startIndex:i,endIndex:r}}const C=typeof document<"u"?g.useLayoutEffect:g.useEffect;function q(n){const l=g.useReducer(()=>({}),{})[1],e={...n,onChange:(s,o)=>{var i;o?F.flushSync(l):l(),(i=n.onChange)==null||i.call(n,s,o)}},[t]=g.useState(()=>new U(e));return t.setOptions(e),C(()=>t._didMount(),[]),C(()=>t._willUpdate()),t}function Y(n){return q({observeElementRect:N,observeElementOffset:H,scrollToFn:P,...n})}function te({items:n,totalItems:l,parentRef:e,hasNextPage:t,isFetchingNextPage:s,fetchNextPage:o,estimateSize:i=()=>100,overscan:r=5}){const a=Y({count:l,getScrollElement:()=>_(e.current),estimateSize:i,overscan:r}),c=a.getVirtualItems(),h=c.length>0?(c.at(0)?.start??0)-a.options.scrollMargin:0,d=c.length>0?a.getTotalSize()-(c.at(-1)?.end??0):0,u=c.map(f=>({virtualItem:f,key:f.key,item:n[f.index],props:{ref:a.measureElement,"data-index":f.index}})),m=u.at(-1)&&!u.at(-1)?.item;return g.useEffect(()=>{t&&m&&!s&&o()},[t,m,s,o]),{visibleItems:u,virtualizer:a,spaceBefore:h,spaceAfter:d}}const k=1e3,x="ghostVirtualListWindow";function Z({totalItems:n,unlockedItemCount:l}){const e=Math.min(n,l);return{visibleItemCount:e,canLoadMore:n>e}}function G(n){return n+k}function J(n,l){return`${n}::${l}`}function R(n,l,e=k){const t=n?.[x];if(!t||typeof t!="object")return e;const s=t[l];return typeof s!="number"||!Number.isFinite(s)?e:Math.max(1,Math.floor(s))}function Q(n,l,e){if(typeof window>"u")return;const t=n?.[x],s={...n??{},[x]:{...t&&typeof t=="object"?t:{},[l]:e}};window.history.replaceState(s,"")}function S(){if(!(typeof window>"u"))return window.history.state}function se(n,{resetKey:l}={}){const{key:e,pathname:t,search:s}=L(),i=J(t,l??s),[r,a]=g.useState(()=>R(S(),i)),c=g.useRef(i);g.useEffect(()=>{if(c.current!==i){c.current=i,a(R(S(),i));return}Q(S(),i,r)},[i,e,r]);const{visibleItemCount:h,canLoadMore:d}=Z({totalItems:n,unlockedItemCount:r});return{visibleItemCount:h,canLoadMore:d,loadMore:()=>a(u=>G(u))}}export{ee as L,te as a,_ as g,se as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,aV as be,aU as xe,bJ as Se,bK as je,B as oe,bL as _e,bM as Ne,bN as Ce,bO as ve,ck as Le,am as ye,al as Te,aX as Fe,r as l,cl as Ee,aW as J,bS as Oe,ai as ne,aj as $,cm as ke,bR as De,aS as Me,u as Ie,aY as Ae,aT as we}from"./index-JMWMnGGt.js";import{S as Pe,a as Ue,b as Ve,c as Re,d as Be,e as ze,f as Ke}from"./select-Dt579MbD.js";import{u as W,S as ie,a as re,A as Z,b as z,c as X,U as le}from"./post-analytics-context-COgn3d86.js";import{a as $e,F as Ge}from"./loader-circle-CGDGFypO.js";import{g as We,a as He,S as Qe,b as Ye}from"./kpis-Bm-hIEkf.js";import{F as Xe,c as H,e as ce}from"./en-Cl0b7CNW.js";import{C as ue,a as qe,b as Je,h as Ze,c as de,i as et,u as K,j as ee}from"./pagemenu-Dq744OgH.js";import{D as tt,h as st,i as te,a as at,b as ot,c as nt,d as it,e as rt,f as lt,g as ct}from"./data-list-D-K_XfF3.js";import{a as ut}from"./wallet-cards-DBM65lA_.js";import{P as dt,a as mt}from"./post-analytics-header-DtBp2QSX.js";import{F as pt,c as ht}from"./filters-DzSJ1ez3.js";import{b as gt,c as ft,F as bt,S as xt,T as St}from"./lucide-react-BfVLf4Hw.js";import{U as jt}from"./user-plus-B0tpOnLM.js";import{M as _t}from"./upload-Dz-DI9rQ.js";import{F as Nt}from"./message-square-text-BDJyLbG2.js";import{E as Ct}from"./empty-indicator-DjmACVr2.js";import"./posts-Dr3u9yOp.js";import"./source-icon-CNqsYZeA.js";import"./source-utils-B1S3ZHA2.js";import"./gh-chart-xjwu2HZo.js";import"./chart-Bs2L1q8g.js";import"./_baseAssignValue-DwWJd_kU.js";import"./index-6Ag8SK_E.js";import"./tabs-DFJzY5np.js";import"./post-share-modal-BlOEKX3-.js";import"./get-site-timezone-BDBAcjmq.js";import"./post-helpers-gInwAwEv.js";import"./trash--VS50LgS.js";import"./sprout-C9DbfYGe.js";import"./a-large-small-DzN0AB7t.js";import"./at-sign-vqoOA4VZ.js";import"./copy-w3c9zkaZ.js";import"./hash-Bowe71Lt.js";import"./inbox-DS4qMjUb.js";import"./minus-BM0xhFIQ.js";import"./tags-Ddg8oG2Y.js";import"./square-CWrI0H4v.js";import"./user-round-check-caJYm0bB.js";import"./repeat-D-Ki-Cg5.js";import"./reply-C4V0xZ2U.js";const se=()=>{const{range:e,setRange:s}=W();return t.jsxs(Pe,{value:`${e}`,onValueChange:a=>{s(Number(a))},children:[t.jsxs(Ue,{className:"w-auto",children:[t.jsx($e,{className:"mr-2",size:16,strokeWidth:1.5}),t.jsx(Ve,{placeholder:"Select a period"})]}),t.jsx(Re,{align:"end",children:t.jsxs(Be,{children:[t.jsx(ze,{children:"Period"}),Object.values(ie).map(a=>t.jsx(Ke,{value:`${a.value}`,children:a.name},a.value))]})})]})};H.registerLocale(ce);const vt=e=>re[e]||H.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(tt,{children:[e&&t.jsxs(st,{children:[t.jsx(te,{children:"Country"}),t.jsx(te,{children:"Visitors"})]}),t.jsx(at,{children:s.map(i=>{const o=vt(`${i.location}`),r=a&&i.location!=="Unknown",c=i.location?i.location.toLowerCase():"unknown";return t.jsxs(ot,{className:r?"cursor-pointer":"","data-testid":`location-row-${c}`,onClick:r?()=>a(i.location):void 0,children:[t.jsx(nt,{style:{width:`${i.percentage?Math.round(i.percentage*100):0}%`}}),t.jsx(it,{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(rt,{children:[t.jsx(lt,{children:ye(Number(i.visits))}),t.jsx(ct,{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(qe,{className:"p-0",children:[t.jsx(Je,{children:"Locations"}),t.jsx(Ze,{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(et,{children:t.jsxs(Se,{children:[t.jsx(je,{asChild:!0,children:t.jsxs(oe,{variant:"outline",children:["View all ",t.jsx(ut,{})]})}),t.jsxs(_e,{className:"overflow-y-auto pt-0 sm:max-w-[600px]",children:[t.jsxs(Ne,{className:"sticky top-0 z-40 -mx-6 bg-background/60 p-6 backdrop-blur",children:[t.jsx(Ce,{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&X.PUBLIC)!==0&&s.push(z[0].value),(e&X.FREE)!==0&&s.push(z[1].value),(e&X.PAID)!==0&&s.push(z[2].value),s.join(",")};H.registerLocale(ce);const Tt=e=>re[e]||H.getName(e,"en")||e,Ft=({visits:e})=>t.jsx("span",{className:"order-2 font-mono text-xs text-muted-foreground",children:e.toLocaleString()}),Et={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}=W(),{startDate:b,endDate:m,timezone:x}=ne(c),p=Et[e],d=l.useMemo(()=>{const j=s.find(h=>h.field==="audience");return me(j?.values)},[s]),S=l.useMemo(()=>{const j={site_uuid:r?.id||"",date_from:$(b),date_to:$(m),timezone:x,member_status:pe(d),limit:"50"};return a&&(j.post_uuid=a),Ot(s,e,j)},[r?.id,b,m,x,d,s,e,a]),{data:v,loading:k}=K({endpoint:p?.endpoint||"",statsConfig:r,params:S,enabled:o&&!!p});return{options:l.useMemo(()=>p?(v||[]).filter(h=>p.filterItem?p.filterItem(h):!0).map(h=>{const F=String(h[p.valueKey]??""),A=Number(h.visits)||0,{value:E,label:y}=p.transformValue?p.transformValue(F):{value:F,label:F};return{label:y,value:E,icon:t.jsx(Ft,{visits:A})}}):[],[v,p]),loading:k}};function kt({filters:e,onChange:s,...a}){const{appSettings:i}=Fe(),{post:o}=W(),r=o?.uuid,[c,b]=l.useState(null),[m,x]=l.useState(!1);l.useEffect(()=>{const g=window.matchMedia("(max-width: 1024px)"),N=T=>{x(T.matches)};return N(g),g.addEventListener("change",N),()=>g.removeEventListener("change",N)},[]);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(jt,{className:"text-orange"})}];return i?.paidMembersEnabled?g:g.filter(N=>N.value!=="paid")},[i?.paidMembersEnabled]),d=l.useCallback(g=>{const N=c===g,T=e.some(n=>n.field===g);return N||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:F,loading:A}=O("utm_content",e,r,{enabled:d("utm_content")}),{options:E,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:M}=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(_t,{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(xt,{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(Nt,{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(St,{className:"size-4"}),placeholder:"Select content",operators:_,defaultOperator:"is",hideOperatorSelect:!0,options:F,isLoading:A,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:E,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(Ee,{}),options:p.map(({value:N,label:T,icon:n})=>({value:N,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(gt,{className:"size-4"}),placeholder:"Select device",operators:_,defaultOperator:"is",hideOperatorSelect:!0,options:U,isLoading:M,selectedOptionsClassName:"hidden"},{key:"location",label:"Location",type:"select",icon:t.jsx(ft,{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,F,A,E,y,_,p,R,D,U,M,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(pt,{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(bt,{}),"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 q=new Map;function Mt(e){return q.has(e)||q.set(e,`url-${e}-${Date.now()}-${Math.random().toString(36).substring(2,11)}`),q.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:Mt(o),field:o,operator:c,values:r})}}),s}function At(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 Ns=()=>{const e=Me(),{postId:s}=Ie(),{statsConfig:a,isLoading:i,range:o,data:r,post:c,isPostLoading:b}=W(),{filters:m,setFilters:x}=At(),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=Ae(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 C=f.field,L=f.values;if(C==="audience")return;const u=L&&L.length>0&&L[0]!==null&&L[0]!==void 0,V=C==="source"&&L?.[0]==="";if(u&&(L[0]!==""||V)){const fe=String(L[0]);n[C]=fe}}),n},[m]),h=l.useCallback((n,f)=>{x(C=>C.find(u=>u.field===n)?C.map(u=>u.field===n?{...u,values:[f]}:u):[...C,ht(n,"is",[f])]),I()},[x,I]),F=l.useCallback(n=>h("location",n),[h]),A=l.useCallback(n=>h("source",n),[h]),E=l.useMemo(()=>{const n={site_uuid:a?.id||"",date_from:$(S),date_to:$(v),timezone:k,member_status:pe(p),post_uuid:"",...j};return!b&&c?.uuid?{...n,post_uuid:c.uuid}:n},[b,c,a?.id,S,v,k,p,j]),{data:y,loading:R}=K({endpoint:"api_kpis",statsConfig:a||{id:""},params:E}),{data:D,loading:U}=K({endpoint:"api_top_locations",statsConfig:a||{id:""},params:E}),{data:M,loading:B}=K({endpoint:"api_top_sources",statsConfig:a||{id:""},params:E}),w=l.useMemo(()=>D?.reduce((n,f)=>n+Number(f.visits),0)||0,[D]),_=l.useMemo(()=>M?M.reduce((n,f)=>n+Number(f.visits||0),0):0,[M]),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),C=n.filter(u=>u.isUnknown),L=C.length>0?[{location:"Unknown",visits:C.reduce((u,V)=>u+V.visits,0),percentage:C.reduce((u,V)=>u+V.percentage,0)}]:[];return[...f,...L]},[D,w]),g=i||b||R||U||B,N=We(y),T=m.length>0;return t.jsxs(t.Fragment,{children:[t.jsxs(dt,{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(mt,{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&&N.visits!=="0"?t.jsxs(t.Fragment,{children:[t.jsx(He,{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:F}),t.jsx(Qe,{data:M,range:d,siteIcon:P,siteUrl:Q,totalVisitors:_,onSourceClick:A})]})]}):t.jsx("div",{className:"grow",children:t.jsx(Ct,{className:"h-full",description:"Try adjusting filters to see more data.",title:`No visitors ${Ye(o)}`,children:t.jsx(J,{strokeWidth:1.5})})})})]})};export{Ns as default};
|
|
1
|
+
import{j as t,aW as be,aV as xe,bJ as Se,bK as je,B as oe,bL as _e,bM as Ne,bN as Ce,bO as ve,ck as Le,ao as ye,an as Te,aY as Fe,r as l,cl as Ee,aX as J,bS as Oe,ak as ne,al as $,cm as ke,bR as De,aT as Me,u as Ie,aZ as Ae,aU as we}from"./index-CEnfjH5h.js";import{S as Pe,a as Ue,b as Ve,c as Re,d as Be,e as ze,f as Ke}from"./select-CGr_5qad.js";import{u as W,S as ie,a as re,A as Z,b as z,c as X,U as le}from"./post-analytics-context-GFe0lMc-.js";import{a as $e,F as Ge}from"./loader-circle-C8exRUku.js";import{g as We,a as He,S as Qe,b as Ye}from"./kpis-Dw04ruBN.js";import{F as Xe,c as H,e as ce}from"./en-BRQS1Z8j.js";import{C as ue,a as qe,b as Je,h as Ze,c as de,i as et,u as K,j as ee}from"./pagemenu-DzpB1AkZ.js";import{D as tt,h as st,i as te,a as at,b as ot,c as nt,d as it,e as rt,f as lt,g as ct}from"./data-list-Crb1ffbp.js";import{a as ut}from"./wallet-cards-CJcVzH0D.js";import{P as dt,a as mt}from"./post-analytics-header-DmGyNvP9.js";import{F as pt,c as ht}from"./filters-ChOMQQZW.js";import{b as gt,c as ft,F as bt,S as xt,T as St}from"./lucide-react-4VO5Dwow.js";import{U as jt}from"./user-plus-CMxR50-Y.js";import{M as _t}from"./upload-BG7KNIn7.js";import{F as Nt}from"./message-square-text-CC_1bY-Q.js";import{E as Ct}from"./empty-indicator-2QGnEbtY.js";import"./posts-GvXDuhVG.js";import"./source-icon-DMt0UskC.js";import"./source-utils-B1S3ZHA2.js";import"./gh-chart-fuWw60Ka.js";import"./chart-_slUcr-K.js";import"./_baseAssignValue-BKAl5FrV.js";import"./index-BDAOs7pI.js";import"./tabs-G6Ql8vbf.js";import"./post-share-modal-CTpdCS2X.js";import"./get-site-timezone-BDBAcjmq.js";import"./post-helpers-gInwAwEv.js";import"./trash-BeZZgbn-.js";import"./sprout-Td9eaOoY.js";import"./a-large-small-B_ulQCIs.js";import"./at-sign-B8xWKM0y.js";import"./copy-CDHcAPJw.js";import"./hash-CI1pQ1UC.js";import"./inbox-DYY8-M1K.js";import"./minus-DSyx9DCe.js";import"./tags-_taMP0sJ.js";import"./square-Df8vEYlG.js";import"./user-round-check-2nhPmqP3.js";import"./repeat-y6HlMgGO.js";import"./reply-Cc8ryI5v.js";const se=()=>{const{range:e,setRange:s}=W();return t.jsxs(Pe,{value:`${e}`,onValueChange:a=>{s(Number(a))},children:[t.jsxs(Ue,{className:"w-auto",children:[t.jsx($e,{className:"mr-2",size:16,strokeWidth:1.5}),t.jsx(Ve,{placeholder:"Select a period"})]}),t.jsx(Re,{align:"end",children:t.jsxs(Be,{children:[t.jsx(ze,{children:"Period"}),Object.values(ie).map(a=>t.jsx(Ke,{value:`${a.value}`,children:a.name},a.value))]})})]})};H.registerLocale(ce);const vt=e=>re[e]||H.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(tt,{children:[e&&t.jsxs(st,{children:[t.jsx(te,{children:"Country"}),t.jsx(te,{children:"Visitors"})]}),t.jsx(at,{children:s.map(i=>{const o=vt(`${i.location}`),r=a&&i.location!=="Unknown",c=i.location?i.location.toLowerCase():"unknown";return t.jsxs(ot,{className:r?"cursor-pointer":"","data-testid":`location-row-${c}`,onClick:r?()=>a(i.location):void 0,children:[t.jsx(nt,{style:{width:`${i.percentage?Math.round(i.percentage*100):0}%`}}),t.jsx(it,{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(rt,{children:[t.jsx(lt,{children:ye(Number(i.visits))}),t.jsx(ct,{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(qe,{className:"p-0",children:[t.jsx(Je,{children:"Locations"}),t.jsx(Ze,{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(et,{children:t.jsxs(Se,{children:[t.jsx(je,{asChild:!0,children:t.jsxs(oe,{variant:"outline",children:["View all ",t.jsx(ut,{})]})}),t.jsxs(_e,{className:"overflow-y-auto pt-0 sm:max-w-[600px]",children:[t.jsxs(Ne,{className:"sticky top-0 z-40 -mx-6 bg-background/60 p-6 backdrop-blur",children:[t.jsx(Ce,{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&X.PUBLIC)!==0&&s.push(z[0].value),(e&X.FREE)!==0&&s.push(z[1].value),(e&X.PAID)!==0&&s.push(z[2].value),s.join(",")};H.registerLocale(ce);const Tt=e=>re[e]||H.getName(e,"en")||e,Ft=({visits:e})=>t.jsx("span",{className:"order-2 font-mono text-xs text-muted-foreground",children:e.toLocaleString()}),Et={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}=W(),{startDate:b,endDate:m,timezone:x}=ne(c),p=Et[e],d=l.useMemo(()=>{const j=s.find(h=>h.field==="audience");return me(j?.values)},[s]),S=l.useMemo(()=>{const j={site_uuid:r?.id||"",date_from:$(b),date_to:$(m),timezone:x,member_status:pe(d),limit:"50"};return a&&(j.post_uuid=a),Ot(s,e,j)},[r?.id,b,m,x,d,s,e,a]),{data:v,loading:k}=K({endpoint:p?.endpoint||"",statsConfig:r,params:S,enabled:o&&!!p});return{options:l.useMemo(()=>p?(v||[]).filter(h=>p.filterItem?p.filterItem(h):!0).map(h=>{const F=String(h[p.valueKey]??""),A=Number(h.visits)||0,{value:E,label:y}=p.transformValue?p.transformValue(F):{value:F,label:F};return{label:y,value:E,icon:t.jsx(Ft,{visits:A})}}):[],[v,p]),loading:k}};function kt({filters:e,onChange:s,...a}){const{appSettings:i}=Fe(),{post:o}=W(),r=o?.uuid,[c,b]=l.useState(null),[m,x]=l.useState(!1);l.useEffect(()=>{const g=window.matchMedia("(max-width: 1024px)"),N=T=>{x(T.matches)};return N(g),g.addEventListener("change",N),()=>g.removeEventListener("change",N)},[]);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(jt,{className:"text-orange"})}];return i?.paidMembersEnabled?g:g.filter(N=>N.value!=="paid")},[i?.paidMembersEnabled]),d=l.useCallback(g=>{const N=c===g,T=e.some(n=>n.field===g);return N||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:F,loading:A}=O("utm_content",e,r,{enabled:d("utm_content")}),{options:E,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:M}=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(_t,{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(xt,{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(Nt,{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(St,{className:"size-4"}),placeholder:"Select content",operators:_,defaultOperator:"is",hideOperatorSelect:!0,options:F,isLoading:A,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:E,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(Ee,{}),options:p.map(({value:N,label:T,icon:n})=>({value:N,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(gt,{className:"size-4"}),placeholder:"Select device",operators:_,defaultOperator:"is",hideOperatorSelect:!0,options:U,isLoading:M,selectedOptionsClassName:"hidden"},{key:"location",label:"Location",type:"select",icon:t.jsx(ft,{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,F,A,E,y,_,p,R,D,U,M,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(pt,{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(bt,{}),"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 q=new Map;function Mt(e){return q.has(e)||q.set(e,`url-${e}-${Date.now()}-${Math.random().toString(36).substring(2,11)}`),q.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:Mt(o),field:o,operator:c,values:r})}}),s}function At(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 Ns=()=>{const e=Me(),{postId:s}=Ie(),{statsConfig:a,isLoading:i,range:o,data:r,post:c,isPostLoading:b}=W(),{filters:m,setFilters:x}=At(),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=Ae(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 C=f.field,L=f.values;if(C==="audience")return;const u=L&&L.length>0&&L[0]!==null&&L[0]!==void 0,V=C==="source"&&L?.[0]==="";if(u&&(L[0]!==""||V)){const fe=String(L[0]);n[C]=fe}}),n},[m]),h=l.useCallback((n,f)=>{x(C=>C.find(u=>u.field===n)?C.map(u=>u.field===n?{...u,values:[f]}:u):[...C,ht(n,"is",[f])]),I()},[x,I]),F=l.useCallback(n=>h("location",n),[h]),A=l.useCallback(n=>h("source",n),[h]),E=l.useMemo(()=>{const n={site_uuid:a?.id||"",date_from:$(S),date_to:$(v),timezone:k,member_status:pe(p),post_uuid:"",...j};return!b&&c?.uuid?{...n,post_uuid:c.uuid}:n},[b,c,a?.id,S,v,k,p,j]),{data:y,loading:R}=K({endpoint:"api_kpis",statsConfig:a||{id:""},params:E}),{data:D,loading:U}=K({endpoint:"api_top_locations",statsConfig:a||{id:""},params:E}),{data:M,loading:B}=K({endpoint:"api_top_sources",statsConfig:a||{id:""},params:E}),w=l.useMemo(()=>D?.reduce((n,f)=>n+Number(f.visits),0)||0,[D]),_=l.useMemo(()=>M?M.reduce((n,f)=>n+Number(f.visits||0),0):0,[M]),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),C=n.filter(u=>u.isUnknown),L=C.length>0?[{location:"Unknown",visits:C.reduce((u,V)=>u+V.visits,0),percentage:C.reduce((u,V)=>u+V.percentage,0)}]:[];return[...f,...L]},[D,w]),g=i||b||R||U||B,N=We(y),T=m.length>0;return t.jsxs(t.Fragment,{children:[t.jsxs(dt,{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(mt,{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&&N.visits!=="0"?t.jsxs(t.Fragment,{children:[t.jsx(He,{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:F}),t.jsx(Qe,{data:M,range:d,siteIcon:P,siteUrl:Q,totalVisitors:_,onSourceClick:A})]})]}):t.jsx("div",{className:"grow",children:t.jsx(Ct,{className:"h-full",description:"Try adjusting filters to see more data.",title:`No visitors ${Ye(o)}`,children:t.jsx(J,{strokeWidth:1.5})})})})]})};export{Ns as default};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<link rel="stylesheet" href="./assets/vendor-0ede59da8efb5e28fa929557f7ff7154.css">
|
|
5
5
|
<link rel="stylesheet" href="./assets/ghost-1627c2071621864e79a845529769ff19.css">
|
|
6
|
-
<meta name="ghost-admin/config/environment" content="%7B%22modulePrefix%22%3A%22ghost-admin%22%2C%22environment%22%3A%22production%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.25%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%22602b9df7f2%22%2C%22adminXSettingsFilename%22%3A%22admin-x-settings.js%22%2C%22adminXSettingsHash%22%3A%
|
|
6
|
+
<meta name="ghost-admin/config/environment" content="%7B%22modulePrefix%22%3A%22ghost-admin%22%2C%22environment%22%3A%22production%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.25%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%22602b9df7f2%22%2C%22adminXSettingsFilename%22%3A%22admin-x-settings.js%22%2C%22adminXSettingsHash%22%3A%22137a664063%22%2C%22activitypubFilename%22%3A%22activitypub.js%22%2C%22activitypubHash%22%3A%22a90e835dda%22%2C%22postsFilename%22%3A%22posts.js%22%2C%22postsHash%22%3A%222962cc8c0a%22%2C%22statsFilename%22%3A%22stats.js%22%2C%22statsHash%22%3A%22c6bb98ee14%22%2C%22activitypubRemoteConfigUrl%22%3A%22%2F.ghost%2Factivitypub%2Fstable%2Fclient-config%22%7D">
|
|
7
7
|
|
|
8
8
|
<meta charset="UTF-8" />
|
|
9
9
|
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
<meta name="apple-mobile-web-app-title" content="Ghost" />
|
|
18
18
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
19
19
|
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
|
20
|
-
<script type="module" crossorigin src="./assets/index-
|
|
21
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
20
|
+
<script type="module" crossorigin src="./assets/index-CEnfjH5h.js"></script>
|
|
21
|
+
<link rel="stylesheet" crossorigin href="./assets/index-BbveDn8H.css">
|
|
22
22
|
</head>
|
|
23
23
|
<body class="react-admin">
|
|
24
24
|
<div id="ember-alerts-wormhole"></div>
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
<div id="ember-notifications-wormhole"></div>
|
|
40
40
|
<script src="./assets/vendor-0e6161f8da2ad46cf62cef0a53cfb16a.js"></script>
|
|
41
41
|
<script src="./assets/chunk.434.de8a15730373eccfeefe.js"></script>
|
|
42
|
-
<script src="./assets/chunk.
|
|
43
|
-
<script src="./assets/chunk.524.
|
|
42
|
+
<script src="./assets/chunk.630.3dbb0231a2d871126a80.js"></script>
|
|
43
|
+
<script src="./assets/chunk.524.5b9b463506a16221fc91.js"></script>
|
|
44
44
|
<script src="./assets/ghost-78b4a517ac907213ab47708eef33bc6f.js"></script>
|
|
45
45
|
</body>
|
|
46
46
|
</html>
|
|
@@ -45,26 +45,6 @@ const membersStats = new MembersStats({
|
|
|
45
45
|
let membersApi;
|
|
46
46
|
let verificationTrigger;
|
|
47
47
|
|
|
48
|
-
const sendVerificationEmail = async ({subject, message, amountTriggered}) => {
|
|
49
|
-
const escalationAddress = config.get('hostSettings:emailVerification:escalationAddress');
|
|
50
|
-
const replyTo = config.get('user_email');
|
|
51
|
-
const fromAddress = settingsHelpers.getDefaultEmailAddress();
|
|
52
|
-
|
|
53
|
-
if (escalationAddress) {
|
|
54
|
-
await ghostMailer.send({
|
|
55
|
-
subject,
|
|
56
|
-
html: tpl(message, {
|
|
57
|
-
amountTriggered: amountTriggered,
|
|
58
|
-
siteUrl: urlUtils.getSiteUrl()
|
|
59
|
-
}),
|
|
60
|
-
forceTextContent: true,
|
|
61
|
-
from: fromAddress,
|
|
62
|
-
replyTo,
|
|
63
|
-
to: escalationAddress
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
48
|
const initMembersCSVImporter = ({stripeAPIService}) => {
|
|
69
49
|
return makeMembersCSVImporter({
|
|
70
50
|
storagePath: config.getContentPath('data'),
|
|
@@ -113,8 +93,6 @@ const initVerificationTrigger = () => {
|
|
|
113
93
|
isVerified: () => config.get('hostSettings:emailVerification:verified') === true,
|
|
114
94
|
isVerificationRequired: () => settingsCache.get('email_verification_required') === true,
|
|
115
95
|
setVerificationRequired: value => settingsCache.set('email_verification_required', {value}),
|
|
116
|
-
isVerificationFlowEnabled: () => labsService.isSet('verificationFlow'),
|
|
117
|
-
sendVerificationEmail,
|
|
118
96
|
sendVerificationWebhook: verificationWebhookService.sendVerificationWebhook.bind(verificationWebhookService),
|
|
119
97
|
membersStats,
|
|
120
98
|
Settings: models.Settings,
|
|
@@ -47,11 +47,11 @@ class VerificationWebhookService {
|
|
|
47
47
|
async sendVerificationWebhook({ amountTriggered, threshold, method }) {
|
|
48
48
|
const { webhookType, webhookUrl, webhookSecret, siteId } = this.#readWebhookConfig();
|
|
49
49
|
if (typeof webhookUrl !== 'string' || webhookUrl.length === 0) {
|
|
50
|
-
this.#logging.warn('Verification webhook
|
|
50
|
+
this.#logging.warn('Verification webhook is not configured because webhookUrl is missing.');
|
|
51
51
|
return false;
|
|
52
52
|
}
|
|
53
53
|
if (typeof webhookType !== 'string' || webhookType.length === 0) {
|
|
54
|
-
this.#logging.warn('Verification webhook
|
|
54
|
+
this.#logging.warn('Verification webhook is not configured because webhookType is missing.');
|
|
55
55
|
return false;
|
|
56
56
|
}
|
|
57
57
|
const payload = {
|
|
@@ -78,12 +78,12 @@ export class VerificationWebhookService {
|
|
|
78
78
|
const {webhookType, webhookUrl, webhookSecret, siteId} = this.#readWebhookConfig();
|
|
79
79
|
|
|
80
80
|
if (typeof webhookUrl !== 'string' || webhookUrl.length === 0) {
|
|
81
|
-
this.#logging.warn('Verification webhook
|
|
81
|
+
this.#logging.warn('Verification webhook is not configured because webhookUrl is missing.');
|
|
82
82
|
return false;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
if (typeof webhookType !== 'string' || webhookType.length === 0) {
|
|
86
|
-
this.#logging.warn('Verification webhook
|
|
86
|
+
this.#logging.warn('Verification webhook is not configured because webhookType is missing.');
|
|
87
87
|
return false;
|
|
88
88
|
}
|
|
89
89
|
|