ghost 6.54.0 → 6.54.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/ghost-storage-base-3.0.0.tgz +0 -0
- package/components/tryghost-adapter-base-cache-0.2.0.tgz +0 -0
- package/components/tryghost-adapter-base-scheduling-0.2.0.tgz +0 -0
- package/components/tryghost-adapter-base-sso-0.1.1.tgz +0 -0
- package/components/tryghost-kg-default-nodes-2.1.3.tgz +0 -0
- package/core/built/admin/assets/Growth-BTP1LthE.js +3 -0
- package/core/built/admin/assets/Newsletters-CSEX0myc.js +1 -0
- package/core/built/admin/assets/Overview-BjACEsJF.js +1 -0
- package/core/built/admin/assets/Web-CxxxjCcv.js +2 -0
- package/core/built/admin/assets/{account-migration-DLvVA5yq.js → account-migration-BklF2I_I.js} +1 -1
- package/core/built/admin/assets/activitypub/{account-migration-DHbZcxGM.js → account-migration-CNovr6W-.js} +4 -4
- package/core/built/admin/assets/activitypub/activitypub.js +2 -2
- package/core/built/admin/assets/activitypub/{bluesky-sharing-zfxUey_L.js → bluesky-sharing-Ceslb1_M.js} +4 -4
- package/core/built/admin/assets/activitypub/{dist-BqkDUQxJ2.js → dist-ByFmDSNP2.js} +64 -63
- package/core/built/admin/assets/activitypub/{dist-Ba_QxHHl.js → dist-DHAjBcV3.js} +2 -2
- package/core/built/admin/assets/activitypub/{domain-CmwSZLHK.js → domain-C1qQvJ8C.js} +5 -5
- package/core/built/admin/assets/activitypub/{edit-profile-CXdwNmVG.js → edit-profile-BcH-jEfM.js} +3 -3
- package/core/built/admin/assets/activitypub/{explore-DfbjzGM1.js → explore-AxwBh9dI.js} +3 -3
- package/core/built/admin/assets/activitypub/{feed-DSEBJOqf.js → feed-BaOlbh7a.js} +3 -3
- package/core/built/admin/assets/activitypub/{field-CY7XVcx6.js → field-B7mYYQpN.js} +2 -2
- package/core/built/admin/assets/activitypub/{inbox-DtQ0kytT.js → inbox-vXez-5uJ.js} +4 -4
- package/core/built/admin/assets/activitypub/{label-Dw96GQ7u.js → label-Chv5T8bw.js} +2 -2
- package/core/built/admin/assets/activitypub/layout-CziktJXo.js +1 -0
- package/core/built/admin/assets/activitypub/{moderation-Dg_-I-8C.js → moderation-DtSM2i1I.js} +4 -4
- package/core/built/admin/assets/activitypub/{note-Cy1-uKMY.js → note-Dckp4S-2.js} +3 -3
- package/core/built/admin/assets/activitypub/{notifications-B_fvoLIM.js → notifications-CG5T22vg.js} +3 -3
- package/core/built/admin/assets/activitypub/{preferences-ByJseZp6.js → preferences-D_799jdl.js} +6 -6
- package/core/built/admin/assets/activitypub/{profile-BFtbnIjz.js → profile-D2JfXBQl.js} +6 -6
- package/core/built/admin/assets/activitypub/{routes-Dh3xXfce.js → routes-CCHe2dQp.js} +28 -25
- package/core/built/admin/assets/activitypub/{settings-DTgqJPxM.js → settings-kx-9Enkz.js} +3 -3
- package/core/built/admin/assets/activitypub/{site-CdL9ZLqm.js → site-x4_IjVJ0.js} +2 -2
- package/core/built/admin/assets/activitypub/{tabs-ogqwoBlb.js → tabs-CyPRQQ1N.js} +3 -3
- package/core/built/admin/assets/activitypub/{use-reply-chain-data-CxonteFD.js → use-reply-chain-data-BAB6fNGt.js} +2 -2
- package/core/built/admin/assets/{audience-BKRdsFmy.js → audience-X_XsZivI.js} +1 -1
- package/core/built/admin/assets/{automated-emails-Cn87L5Md.js → automated-emails-of1MvVsv.js} +1 -1
- package/core/built/admin/assets/{automations-BP_aHamJ.js → automations-DRFjW5fw.js} +1 -1
- package/core/built/admin/assets/{bluesky-sharing-Bh36XPh4.js → bluesky-sharing-BbbjWdzs.js} +1 -1
- package/core/built/admin/assets/{breadcrumb-D34YWnaw.js → breadcrumb-B-M9Ip_2.js} +1 -1
- package/core/built/admin/assets/{chart-helpers-DbklaJw9.js → chart-helpers-xiSsW8r0.js} +1 -1
- package/core/built/admin/assets/checkbox-EhJKHFdZ.js +1 -0
- package/core/built/admin/assets/{chunk.962.b73442b07be930bb5d85.js → chunk.211.6f7328d63c41536451b3.js} +737 -559
- package/core/built/admin/assets/{chunk.962.b73442b07be930bb5d85.js.LICENSE.txt → chunk.211.6f7328d63c41536451b3.js.LICENSE.txt} +2 -0
- package/core/built/admin/assets/{chunk.589.096f4d0bb775e5229aa9.js → chunk.361.3cdb584b973959e52ccc.js} +3 -3
- package/core/built/admin/assets/chunk.524.8365cd9280405c0f6216.js +25 -0
- package/core/built/admin/assets/chunk.582.61d078937e6102769f2c.js +27 -0
- package/core/built/admin/assets/code-editor-view-CZtJFGhR.js +1 -0
- package/core/built/admin/assets/comments-CvyXxOyN.js +1 -0
- package/core/built/admin/assets/{date-range-select-B5vSsrpx.js → date-range-select-CTlyo8zW.js} +1 -1
- package/core/built/admin/assets/{disabled-sources-indicator-NkOIoMue.js → disabled-sources-indicator-qs2GfLvl.js} +1 -1
- package/core/built/admin/assets/dist-2Tnz2Yfq.js +1 -0
- package/core/built/admin/assets/dist-CjY-f5Z1.js +1 -0
- package/core/built/admin/assets/dist-DIC8yz5C.js +1 -0
- package/core/built/admin/assets/{domain-B7_n5nfx.js → domain-CPNXKVOV.js} +1 -1
- package/core/built/admin/assets/dropzone-BmCXnw6J.js +5 -0
- package/core/built/admin/assets/{edit-profile-rvDGrS8J.js → edit-profile-SGrJve5M.js} +1 -1
- package/core/built/admin/assets/editor-BOG2YPUm.js +8 -0
- package/core/built/admin/assets/{explore-BZAZOg5X.js → explore-CUYLv9G9.js} +1 -1
- package/core/built/admin/assets/{feed-CFV8xDw9.js → feed-CPdJMttL.js} +1 -1
- package/core/built/admin/assets/{field-BW-M2Zwp.js → field-D0XISCK2.js} +1 -1
- package/core/built/admin/assets/{filter-sources-Fx8wiYYw.js → filter-sources-Bieps75g.js} +1 -1
- package/core/built/admin/assets/{filters-CGX_pf2N.js → filters-CuB-A7ma.js} +1 -1
- package/core/built/admin/assets/filters-bXkkWro8.js +1 -0
- package/core/built/admin/assets/{ghost-b1dce91ad3232cc259ee5fbbf9526243.js → ghost-05f9a7182ed56903dba05878a5b8422b.js} +290 -289
- package/core/built/admin/assets/{gift-link-modal-Bk8qpnMw.js → gift-link-modal-su8MsRdg.js} +1 -1
- package/core/built/admin/assets/{growth-Ck2s3JjR.js → growth-Ba6S5FQX.js} +1 -1
- package/core/built/admin/assets/{inbox-BRp1_aaC.js → inbox-Xx1CdnfO.js} +8 -8
- package/core/built/admin/assets/index-D8PbzuT9.css +1 -0
- package/core/built/admin/assets/index-ukW_0Uie.js +67 -0
- package/core/built/admin/assets/input-group-CGOXcy4l.js +1 -0
- package/core/built/admin/assets/input-surface-BpAjZXY5.js +1 -0
- package/core/built/admin/assets/{koenig-lexical-CM7UFNdL.js → koenig-lexical-B61IALf5.js} +1 -1
- package/core/built/admin/assets/{kpi-card-CIGyijjx.js → kpi-card-BlZaG1Lo.js} +1 -1
- package/core/built/admin/assets/{kpi-card-BrGH6FsT.js → kpi-card-DCdlyaSS.js} +1 -1
- package/core/built/admin/assets/{kpi-helpers-_HRRsklE.js → kpi-helpers-DpAuS1Nb.js} +1 -1
- package/core/built/admin/assets/{kpi-tabs-BSvh9eoq.js → kpi-tabs-Dme44bQS.js} +1 -1
- package/core/built/admin/assets/{label-BOR9XdKl.js → label-dSs5aepE.js} +1 -1
- package/core/built/admin/assets/{label-picker-BdNAWuUX.js → label-picker-Uq91atex.js} +1 -1
- package/core/built/admin/assets/layout-WUcz6tu1.js +1 -0
- package/core/built/admin/assets/{member-custom-fields-DvFyamLu.js → member-custom-fields-NCzrMuba.js} +1 -1
- package/core/built/admin/assets/member-detail-DPWDtYnN.js +1 -0
- package/core/built/admin/assets/{members-DsPxYAVm.js → members-B9rO7qr4.js} +2 -2
- package/core/built/admin/assets/modals-CxRaan1J.js +31 -0
- package/core/built/admin/assets/{moderation-Dlp7M5sa.js → moderation-D8zon60E.js} +1 -1
- package/core/built/admin/assets/{multi-select-combobox-CH1o8XXQ.js → multi-select-combobox-1wYm3nle.js} +1 -1
- package/core/built/admin/assets/newsletter-DbYMRxRS.js +1 -0
- package/core/built/admin/assets/{note-BrAZ7Z0o.js → note-PiWPnnrh.js} +1 -1
- package/core/built/admin/assets/{notifications-BnbHLOPC.js → notifications-DEgqqB9G.js} +1 -1
- package/core/built/admin/assets/{onboarding-route-eU146kuA.js → onboarding-route-BzF6HeVn.js} +1 -1
- package/core/built/admin/assets/{overview-BpbaK-xu.js → overview-DixLeIqY.js} +1 -1
- package/core/built/admin/assets/{page-header-C0jVxtS8.js → page-header-op0eN36I.js} +1 -1
- package/core/built/admin/assets/{post-analytics-Iw7dk1mT.js → post-analytics-WwRDEnrV.js} +1 -1
- package/core/built/admin/assets/post-analytics-header-DsMoLx0R.js +1 -0
- package/core/built/admin/assets/{post-analytics-provider-BDqcfBor.js → post-analytics-provider-BJCPLMIb.js} +1 -1
- package/core/built/admin/assets/{post-share-modal-DBfKl2GZ.js → post-share-modal-Dx-MEjhI.js} +1 -1
- package/core/built/admin/assets/preferences-D7-j6A4C.js +5 -0
- package/core/built/admin/assets/profile-Dl69QPp0.js +1 -0
- package/core/built/admin/assets/select-C1qDZnW4.js +1 -0
- package/core/built/admin/assets/settings-BbmC_Iqq.js +4 -0
- package/core/built/admin/assets/{settings-Bz3RZRmE.js → settings-H6HxFgfI.js} +1 -1
- package/core/built/admin/assets/shade-app-B3heOAfz-CGXQwWeO.js +3 -0
- package/core/built/admin/assets/{share-modal-CkdTTMJd.js → share-modal-BJCadJyp.js} +1 -1
- package/core/built/admin/assets/social-urls-BPL1nADp.js +8 -0
- package/core/built/admin/assets/{sort-button-DZp9Y2r1.js → sort-button-DyYlfYp7.js} +1 -1
- package/core/built/admin/assets/{source-icon-CHr9qJ2Y.js → source-icon-_ubRDbg_.js} +1 -1
- package/core/built/admin/assets/{stats-DGoXZxWE.js → stats-BQZMGMvn.js} +1 -1
- package/core/built/admin/assets/{stats-view-D2-1L0ms.js → stats-view-Doei-qCX.js} +1 -1
- package/core/built/admin/assets/{step-1-RdahbwyG.js → step-1-IKiLBPoC.js} +1 -1
- package/core/built/admin/assets/{step-2-D83PeRwd.js → step-2-jJ41PsDN.js} +1 -1
- package/core/built/admin/assets/{step-3-p_Op4wv4.js → step-3-CaqFAEqf.js} +2 -2
- package/core/built/admin/assets/switch-t-WyENU2.js +1 -0
- package/core/built/admin/assets/{table-B8LgTQJZ.js → table-DxUL78jU.js} +1 -1
- package/core/built/admin/assets/{tabs-D3ZOYkM7.js → tabs-BQcJQ1ke.js} +1 -1
- package/core/built/admin/assets/{tags-B4l891z2.js → tags-CNujGwkT.js} +1 -1
- package/core/built/admin/assets/textarea-Bjccvh_E.js +1 -0
- package/core/built/admin/assets/{toggle-group-DNXDkAwf.js → toggle-group-BeEpQ69p.js} +1 -1
- package/core/built/admin/assets/{topic-filter-DZGjEcz3.js → topic-filter-Bb5MOD-1.js} +1 -1
- package/core/built/admin/assets/{use-analytics-data-CaT8RirX.js → use-analytics-data-Cds6XDjg.js} +1 -1
- package/core/built/admin/assets/use-filter-params-DjXkhO54.js +1 -0
- package/core/built/admin/assets/{use-growth-stats-9Db2CuJe.js → use-growth-stats-D8uf98-G.js} +1 -1
- package/core/built/admin/assets/{use-post-referrers-BV54YcQS.js → use-post-referrers-CRtgyuXB.js} +1 -1
- package/core/built/admin/assets/{use-reply-chain-data-DuYZGDan.js → use-reply-chain-data-DbKYX50v.js} +1 -1
- package/core/built/admin/assets/{use-simple-pagination-8fTua9Nt.js → use-simple-pagination-DC01kpo0.js} +1 -1
- package/core/built/admin/assets/{use-tinybird-query-Dz156HvZ.js → use-tinybird-query-C7bQRJWw.js} +1 -1
- package/core/built/admin/assets/{use-tinybird-token-C9RUdL_n.js → use-tinybird-token-Az4tam7_.js} +1 -1
- package/core/built/admin/assets/{virtual-list-BCvP0YF-.js → virtual-list-Dhuh9fGx.js} +1 -1
- package/core/built/admin/assets/web-LtHNiNBV.js +1 -0
- package/core/built/admin/index.html +11 -7
- package/core/frontend/services/proxy.js +11 -1
- package/core/server/adapters/storage/LocalFilesStorage.js +13 -11
- package/core/server/adapters/storage/LocalFilesStorage.ts +24 -0
- package/core/server/adapters/storage/LocalImagesStorage.js +14 -12
- package/core/server/adapters/storage/LocalImagesStorage.ts +24 -0
- package/core/server/adapters/storage/LocalMediaStorage.js +13 -11
- package/core/server/adapters/storage/LocalMediaStorage.ts +24 -0
- package/core/server/adapters/storage/LocalStorageBase.js +107 -167
- package/core/server/adapters/storage/LocalStorageBase.ts +342 -0
- package/core/server/adapters/storage/utils.js +36 -50
- package/core/server/adapters/storage/utils.ts +60 -0
- package/core/server/api/endpoints/db.js +6 -0
- package/core/server/api/endpoints/members.js +25 -28
- package/core/server/api/endpoints/pages.js +6 -1
- package/core/server/api/endpoints/posts.js +11 -2
- package/core/server/api/endpoints/utils/serializers/output/mappers/comments.js +4 -1
- package/core/server/api/endpoints/utils/serializers/output/members.js +18 -87
- package/core/server/data/exporter/export-filename.js +2 -1
- package/core/server/data/importer/importers/data/revue-subscriber-importer.js +6 -10
- package/core/server/data/importer/importers/json-to-html.js +24 -4
- package/core/server/lib/image/image-size.js +3 -17
- package/core/server/lib/image/image-utils.js +15 -1
- package/core/server/lib/request-external.js +1 -1
- package/core/server/models/user.js +46 -70
- package/core/server/services/auth/session/session-service.js +28 -1
- package/core/server/services/automations/automations-api.js +6 -6
- package/core/server/services/automations/automations-api.ts +6 -6
- package/core/server/services/automations/automations-repository.ts +1 -0
- package/core/server/services/automations/database-automations-repository.js +7 -2
- package/core/server/services/automations/database-automations-repository.ts +8 -2
- package/core/server/services/comments/comments-service-emails.js +4 -1
- package/core/server/services/members/{importer → import-export}/config.js +4 -9
- package/core/server/services/members/{importer → import-export}/config.ts +4 -9
- package/core/server/services/members/{csv → import-export/csv}/index.js +3 -3
- package/core/server/services/members/import-export/csv/index.ts +2 -0
- package/core/server/services/members/import-export/csv/parse.js +64 -0
- package/core/server/services/members/import-export/csv/parse.ts +69 -0
- package/core/server/services/members/import-export/csv/serialize.js +13 -0
- package/core/server/services/members/import-export/csv/serialize.ts +18 -0
- package/core/server/services/members/import-export/export/exporter.js +202 -0
- package/core/server/services/members/import-export/export/exporter.ts +325 -0
- package/core/server/services/members/import-export/import/completion-email.js +65 -0
- package/core/server/services/members/import-export/import/completion-email.ts +119 -0
- package/core/server/services/members/import-export/import/importer.js +276 -0
- package/core/server/services/members/import-export/import/importer.ts +430 -0
- package/core/server/services/members/import-export/import/reader.js +32 -0
- package/core/server/services/members/import-export/import/reader.ts +33 -0
- package/core/server/services/members/import-export/import/row.js +33 -0
- package/core/server/services/members/import-export/import/row.ts +52 -0
- package/core/server/services/members/import-export/import/spool.js +30 -0
- package/core/server/services/members/import-export/import/spool.ts +38 -0
- package/core/server/services/members/import-export/index.js +90 -0
- package/core/server/services/members/import-export/index.ts +118 -0
- package/core/server/services/members/members-api/controllers/router-controller.js +7 -0
- package/core/server/services/members/service.js +17 -19
- package/core/server/services/posts/posts-exporter.js +6 -4
- package/core/server/services/posts/posts-service.js +2 -2
- package/core/server/services/themes/storage.js +9 -0
- package/core/server/services/themes/theme-storage.js +1 -1
- package/core/shared/config/defaults.json +2 -1
- package/core/shared/express.js +6 -1
- package/core/shared/labs.js +2 -1
- package/package.json +9 -9
- package/pnpm-lock.yaml +17 -17
- package/pnpm-workspace.yaml +7 -7
- package/components/tryghost-adapter-base-scheduling-0.1.1.tgz +0 -0
- package/core/built/admin/assets/Growth-CSaHoSVD.js +0 -3
- package/core/built/admin/assets/Newsletters-C5cs6FGo.js +0 -1
- package/core/built/admin/assets/Overview-j4NaeUNm.js +0 -1
- package/core/built/admin/assets/Web-_fD935OX.js +0 -2
- package/core/built/admin/assets/activitypub/layout-IdVq3lRy.js +0 -1
- package/core/built/admin/assets/checkbox-DA4-1UiI.js +0 -1
- package/core/built/admin/assets/chunk.524.45e0875f41b71e46e849.js +0 -25
- package/core/built/admin/assets/chunk.582.51defd4b009f0de8d4d5.js +0 -27
- package/core/built/admin/assets/code-editor-view-BKBrkffZ.js +0 -1
- package/core/built/admin/assets/comments-CzVNIT8b.js +0 -1
- package/core/built/admin/assets/dist-CT46_f_J.js +0 -1
- package/core/built/admin/assets/dropzone-DcuJEEUf.js +0 -5
- package/core/built/admin/assets/editor-BCiIyFjm.js +0 -8
- package/core/built/admin/assets/filters-DtcXMZDU.js +0 -1
- package/core/built/admin/assets/index-BBf502Wg.js +0 -69
- package/core/built/admin/assets/index-BCCZKxP2.css +0 -1
- package/core/built/admin/assets/input-group-DjuYnNCd.js +0 -1
- package/core/built/admin/assets/layout-Bw4GnxXp.js +0 -1
- package/core/built/admin/assets/member-detail-Cg2vTqvJ.js +0 -1
- package/core/built/admin/assets/modals-Bf_fyvHZ.js +0 -31
- package/core/built/admin/assets/newsletter-CQ5CAYUI.js +0 -1
- package/core/built/admin/assets/post-analytics-header-D9pJ4iNm.js +0 -1
- package/core/built/admin/assets/preferences-D4EANGoc.js +0 -5
- package/core/built/admin/assets/profile-dJ44Bn_W.js +0 -1
- package/core/built/admin/assets/select--2uVN9_-.js +0 -1
- package/core/built/admin/assets/settings-SD9bxIpt.js +0 -4
- package/core/built/admin/assets/social-urls-BvFZwYcE.js +0 -8
- package/core/built/admin/assets/switch-qp518gFQ.js +0 -1
- package/core/built/admin/assets/textarea-CTlb3Uu6.js +0 -1
- package/core/built/admin/assets/use-filter-params-DeQ8sX4N.js +0 -1
- package/core/built/admin/assets/web-DTZnnUGr.js +0 -1
- package/core/server/services/mail/templates/newsletter.html +0 -876
- package/core/server/services/members/csv/index.ts +0 -3
- package/core/server/services/members/csv/parse.js +0 -94
- package/core/server/services/members/csv/parse.ts +0 -111
- package/core/server/services/members/csv/types.js +0 -2
- package/core/server/services/members/csv/types.ts +0 -39
- package/core/server/services/members/csv/unparse.js +0 -69
- package/core/server/services/members/csv/unparse.ts +0 -79
- package/core/server/services/members/exporter/query.js +0 -233
- package/core/server/services/members/importer/index.js +0 -30
- package/core/server/services/members/importer/labels.js +0 -125
- package/core/server/services/members/importer/members-csv-importer.js +0 -520
- /package/core/server/services/members/{importer → import-export/import}/email-template.js +0 -0
- /package/core/server/services/members/{importer/members-csv-importer-stripe-utils.js → import-export/import/stripe-utils.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./react-Bb3IsNbi.js";import{t as n}from"./jsx-runtime-DX3WBWVO.js";import{n as r}from"./dist-Ndy-PuGN.js";import{i,n as a,r as o,t as s}from"./tabs-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./react-Bb3IsNbi.js";import{t as n}from"./jsx-runtime-DX3WBWVO.js";import{n as r}from"./dist-Ndy-PuGN.js";import{i,n as a,r as o,t as s}from"./tabs-BQcJQ1ke.js";import{Ft as c,It as l,Kt as u,Nr as d,Os as f,Q as p,R as m,Rn as h,V as g,_t as _,bt as v,gs as y,tr as b,tt as x,ut as S,vt as C,yt as w,zn as T}from"./index-ukW_0Uie.js";import"./layout-WUcz6tu1.js";var E=e(t(),1),D=n(),O=()=>{let{data:e,isLoading:t}=w(`index`),{data:n,isLoading:O}=v(`index`),k=t?[,,,,,].fill({apId:``,name:``,handle:``,avatarUrl:``}):e?.pages.flatMap(e=>e.accounts)??[],A=O?[,,,,,].fill({apId:``,name:``}):n?.pages.flatMap(e=>e.domains)??[],j=C(`index`),M=l(`index`),[N,P]=(0,E.useState)(new Set),F=_(`index`),I=c(`index`),[L,R]=(0,E.useState)(new Set),[z,B]=(0,E.useState)(null),V=u(),H=e=>{P(t=>{let n=new Set([...t]);return n.add(e.apId),n}),M.mutate(e),r.success(`User unblocked`)},U=e=>{P(t=>{let n=new Set([...t]);return n.delete(e.apId),n}),j.mutate(e),r.success(`User blocked`)},W=e=>{R(t=>{let n=new Set([...t]);return n.add(e.url),n}),I.mutate({url:e.url}),r.success(`Domain unblocked`)},G=e=>{R(t=>{let n=new Set([...t]);return n.delete(e.url),n}),F.mutate({url:e.url}),r.success(`Domain blocked`)};return(0,D.jsx)(m,{children:(0,D.jsxs)(`div`,{className:`mx-auto max-w-[620px] py-[min(4vh,48px)]`,children:[(0,D.jsx)(`div`,{className:`flex items-center justify-between gap-8`,children:(0,D.jsx)(f,{children:`Moderation`})}),(0,D.jsx)(`div`,{className:`mt-6`,children:(0,D.jsxs)(s,{defaultValue:`blocked_users`,variant:`underline`,children:[(0,D.jsxs)(o,{children:[(0,D.jsx)(i,{value:`blocked_users`,children:`Blocked users`}),(0,D.jsx)(i,{value:`blocked_domains`,children:`Blocked domains`})]}),(0,D.jsx)(a,{className:`mt-2`,value:`blocked_users`,children:!t&&k.length===0?(0,D.jsxs)(h,{children:[(0,D.jsx)(T,{children:(0,D.jsx)(y,{})}),(0,D.jsx)(`div`,{className:`mt-2 flex max-w-[400px] flex-col items-center gap-1 text-center`,children:(0,D.jsx)(`p`,{children:`When you block someone, they won't be able to follow you or interact with your content on the social web.`})})]}):k.map((e,n)=>(0,D.jsx)(x,{actor:e,isCurrentUser:!0,children:(0,D.jsx)(`div`,{children:(0,D.jsxs)(g,{onClick:t?void 0:()=>p(e.handle,V),children:[(0,D.jsx)(S,{author:{icon:{url:e.avatarUrl},name:e.name,handle:e.handle}}),(0,D.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,D.jsx)(`span`,{className:`block truncate font-semibold text-black dark:text-white`,children:t?(0,D.jsx)(b,{className:`w-24`}):e.name}),(0,D.jsx)(`span`,{className:`block truncate text-sm text-gray-600`,children:t?(0,D.jsx)(b,{className:`w-40`}):e.handle})]}),N.has(e.apId)?(0,D.jsx)(d,{className:`ml-auto min-w-[90px] text-red hover:bg-red/5! hover:text-red-400`,variant:`outline`,onClick:t=>{t.stopPropagation(),U(e)},children:`Block`}):t?(0,D.jsx)(`div`,{className:`ml-auto w-16`,children:(0,D.jsx)(b,{})}):(0,D.jsx)(d,{className:`ml-auto min-w-[90px]`,variant:`destructive`,onClick:t=>{t.stopPropagation(),H(e)},onMouseEnter:()=>B(e.apId),onMouseLeave:()=>B(null),children:z===e.apId?`Unblock`:`Blocked`})]})})},e.apId?e.apId:`loading-${n}`))}),(0,D.jsx)(a,{className:`mt-[11px]`,value:`blocked_domains`,children:!O&&A.length===0?(0,D.jsxs)(h,{children:[(0,D.jsx)(T,{children:(0,D.jsx)(y,{})}),(0,D.jsx)(`div`,{className:`mt-2 flex max-w-[400px] flex-col items-center gap-1 text-center`,children:(0,D.jsx)(`p`,{children:`When you block a domain, all users from that domain won't be able to follow you or interact with your content.`})})]}):A.map((e,t)=>(0,D.jsxs)(g,{children:[(0,D.jsx)(`div`,{className:`flex min-w-0 flex-col`,children:(0,D.jsx)(`span`,{className:`block truncate font-semibold text-black dark:text-white`,children:O?(0,D.jsx)(b,{className:`w-48`}):new URL(e.url).hostname})}),L.has(e.url)?(0,D.jsx)(d,{className:`ml-auto min-w-[90px] text-red hover:bg-red/5! hover:text-red-400`,variant:`outline`,onClick:()=>G(e),children:`Block`}):O?(0,D.jsx)(`div`,{className:`ml-auto w-16`,children:(0,D.jsx)(b,{})}):(0,D.jsx)(d,{className:`ml-auto min-w-[90px]`,variant:`destructive`,onClick:()=>W(e),onMouseEnter:()=>B(e.url),onMouseLeave:()=>B(null),children:z===e.url?`Unblock`:`Blocked`})]},e.url?e.url:`loading-${t}`))})]})})]})})};export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./react-Bb3IsNbi.js";import{t as n}from"./jsx-runtime-DX3WBWVO.js";import{c as r}from"./dist-DGzPJ_bO.js";import{a as i,c as a,i as o,l as s,n as c,o as ee,s as l}from"./switch-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./react-Bb3IsNbi.js";import{t as n}from"./jsx-runtime-DX3WBWVO.js";import{c as r}from"./dist-DGzPJ_bO.js";import{a as i,c as a,i as o,l as s,n as c,o as ee,s as l}from"./switch-t-WyENU2.js";import{es as u,io as d}from"./index-ukW_0Uie.js";var f=e(t(),1),p=n(),m={searchPlaceholder:`Search...`,noResultsFound:`No results found.`,loading:`Loading...`,loadMore:`Load more`};function h(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>e.label.toLowerCase().includes(n)||e.detail?.toLowerCase().includes(n)):e}function g(e,t,n,r,i,a,o){if(e)return{...e,shouldClientFilter:o??e.shouldClientFilter};let s=!!t,c=t?.useOptions({query:r,selectedValues:i});return{options:s?c?.options??[]:n??[],isInitialLoad:s?c?.isInitialLoad??!1:a&&(n?.length??0)===0,isSearching:s?c?.isSearching??!1:a&&(n?.length??0)>0,hasMore:s?c?.hasMore??!1:!1,isLoadingMore:s?c?.isLoadingMore??!1:!1,loadMore:s?c?.loadMore??(()=>{}):()=>{},shouldClientFilter:o??!s}}function _({optionSource:e,options:t,values:n,onChange:_,valueSource:v,searchable:y=!0,isLoading:b=!1,maxSelections:x,isMultiSelect:S=!0,onClose:C,autoCloseOnSelect:w=!1,className:T,searchInputClassName:E,shouldFilter:D,onSearchChange:O,i18n:k,renderItem:A,groupBy:j,header:M,footer:N}){let P=(0,f.useMemo)(()=>({...m,...k}),[k]),[F,I]=(0,f.useState)(``),L=(0,f.useCallback)(t=>{I(t),e?.onSearchChange?.(t),O?.(t)},[O,e]),R=g(e,v,t,F,n,b,D),z=R.options,[B,V]=(0,f.useState)([]),H=(0,f.useMemo)(()=>z.filter(e=>n.includes(e.value)),[z,n]);(0,f.useEffect)(()=>{if(n.length===0){V([]);return}H.length>0&&V(e=>{let t=[];for(let r of n){let n=H.find(e=>e.value===r)??e.find(e=>e.value===r);n&&t.push(n)}return t})},[H,n]);let U=(0,f.useMemo)(()=>n.length===0?[]:B.length>0?B:H,[B,n.length,H]),W=(0,f.useMemo)(()=>h(U,F),[F,U]),G=(0,f.useMemo)(()=>z.filter(e=>!n.includes(e.value)),[z,n]),K=(0,f.useMemo)(()=>{let e=new Map;for(let t of G){let n=j?.(t),r=typeof n==`string`?n:n?.key,i=typeof n==`string`?n:n?.label,a=e.get(r);e.set(r,{label:i,options:[...a?.options??[],t]})}return[...e.entries()].map(([e,t])=>({key:e,...t}))},[j,G]),q=(0,f.useCallback)(e=>{_(n.filter(t=>t!==e.value))},[_,n]),J=e=>{_([]),C?.()},Y=e=>{let t=[...n,e.value];x&&t.length>x||(_(t),w&&C?.())},X=e=>{_([e.value]),C?.()},Z=S?q:J,Q=S?Y:X,te=(0,f.useCallback)(()=>L(``),[L]),ne=(e,t)=>{if(t)return;let n=e.detail?` - ${e.detail}`:``;return e.label+n},$=A??(({option:e,isSelected:t,onSelect:n})=>(0,p.jsxs)(l,{className:`group flex items-center gap-2`,value:ne(e,t),onSelect:n,children:[e.icon,(0,p.jsxs)(`div`,{className:`flex flex-col overflow-hidden`,children:[(0,p.jsx)(`span`,{className:`truncate text-accent-foreground`,title:e.label,children:e.label}),e.detail&&(0,p.jsx)(`span`,{className:`truncate text-sm text-muted-foreground`,title:e.detail,children:e.detail})]}),(0,p.jsx)(u,{className:r(`ms-auto text-primary`,!t&&`opacity-0`)})]},String(e.value)));return(0,p.jsx)(`div`,{className:r(`w-full`,T),children:(0,p.jsxs)(c,{shouldFilter:R.shouldClientFilter,children:[M?.({selectedOptions:U,onDeselect:q}),y&&(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(ee,{className:r(`h-(--control-height) pr-8 text-sm`,E),placeholder:P.searchPlaceholder,value:F,onValueChange:L}),R.isSearching&&(0,p.jsx)(d,{className:`pointer-events-none absolute top-1/2 right-3 size-4 -translate-y-1/2 animate-spin text-muted-foreground`})]}),(0,p.jsxs)(a,{className:`outline-hidden`,children:[R.isInitialLoad?(0,p.jsxs)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:[(0,p.jsx)(d,{className:`mr-2 size-4 animate-spin`}),P.loading]}):(0,p.jsx)(o,{children:P.noResultsFound}),W.length>0&&(0,p.jsx)(i,{heading:P.selectedHeading,children:W.map(e=>$({option:e,isSelected:!0,onSelect:()=>Z(e)}))}),G.length>0&&(0,p.jsxs)(p.Fragment,{children:[W.length>0&&(0,p.jsx)(s,{}),K.map(e=>(0,p.jsx)(i,{heading:e.label,children:e.options.map(e=>$({option:e,isSelected:!1,onSelect:()=>Q(e)}))},e.key===void 0?`ungrouped`:`group:${e.key}`))]}),R.hasMore&&(0,p.jsxs)(p.Fragment,{children:[(W.length>0||G.length>0)&&(0,p.jsx)(s,{}),(0,p.jsx)(`div`,{className:`p-1.5`,children:(0,p.jsxs)(`button`,{className:`flex w-full items-center justify-center rounded-xs px-2 py-1.5 text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-50`,disabled:R.isLoadingMore,type:`button`,onClick:R.loadMore,children:[R.isLoadingMore&&(0,p.jsx)(d,{className:`mr-2 size-4 animate-spin`}),R.isLoadingMore?P.loading:P.loadMore]})})]})]}),N?.({searchInput:F,clearSearch:te})]})})}export{_ as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./react-Bb3IsNbi.js";import{t as n}from"./jsx-runtime-DX3WBWVO.js";import{i as r}from"./hooks-BApwwBE0.js";import{i,r as a}from"./stats-BQZMGMvn.js";import{t as o}from"./posts-EWpZIjkr.js";import{o as s}from"./post-helpers-C5OQMBoi.js";import{m as c}from"./chunk-KS7C4IRE-DG9HTHQ3.js";import{a as l}from"./router-provider-C1R4AZ2o.js";import{_ as u,f as d,m as f,p}from"./dist-DGzPJ_bO.js";import{i as m,r as h,t as g}from"./tabs-BQcJQ1ke.js";import{a as _,i as v,n as y,o as b,r as x,t as S}from"./card-DGoDJzrn.js";import{c as C,l as w,n as T,o as E,r as ee,s as te,t as ne,u as re}from"./data-list-16rkJYYi.js";import{i as ie,n as ae,o as oe,r as se,t as D}from"./use-simple-pagination-DC01kpo0.js";import{$n as ce,Br as O,Gn as k,Ji as A,Ma as le,Nr as j,Rr as M,Rs as ue,Xn as N,Yi as P,Zn as F,Zo as I,js as L,na as R,nr as de,rr as fe,ys as pe}from"./index-ukW_0Uie.js";import{t as me}from"./member-route-0Aa52Ntz.js";import{a as z,i as B,n as V,r as H,t as U}from"./kpi-card-BlZaG1Lo.js";import{r as he,t as ge}from"./post-analytics-header-DsMoLx0R.js";import{n as _e}from"./post-analytics-context-D0Mw-Pmv.js";import{a as ve,i as ye,n as W,o as G,r as K}from"./link-helpers-tOlxmuH5.js";var q=r({dataType:`FeedbackResponseType`,path:e=>`/feedback/${e}/`}),J=e(t(),1),Y=(e,t)=>{let{data:n,isLoading:r,error:i}=q(e,{searchParams:{limit:`50`,...t===void 0?{}:{score:t.toString()}}});return{feedback:(0,J.useMemo)(()=>n?.feedback?n.feedback:[],[n]),isLoading:r,error:i}},X=n(),be=({feedbackStats:e})=>{let{postId:t}=c(),n=l(),[r,i]=(0,J.useState)(`positive`),{feedback:a,isLoading:o}=Y(t||``,+(r===`positive`)),{totalPages:s,paginatedData:d,nextPage:C,previousPage:w,hasNextPage:T,hasPreviousPage:E}=D({data:a,itemsPerPage:9}),ee=o;return(0,X.jsxs)(S,{children:[(0,X.jsxs)(_,{className:`pb-5`,children:[(0,X.jsx)(b,{children:`Feedback`}),(0,X.jsx)(x,{children:`What did your readers think?`})]}),e.totalFeedback>0?(0,X.jsxs)(y,{className:`pb-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(g,{className:`pb-3`,defaultValue:`positive`,value:r,variant:`button`,onValueChange:e=>i(e),children:(0,X.jsxs)(h,{className:`gap-1`,children:[(0,X.jsx)(m,{className:`h-7`,value:`positive`,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-1 text-xs`,children:[(0,X.jsx)(A,{size:14,strokeWidth:1.25}),(0,X.jsx)(`span`,{className:`hidden font-medium sm:visible! sm:inline!`,children:`More like this`}),(0,X.jsx)(`span`,{className:`font-semibold tracking-tight`,children:p(e.positiveFeedback/e.totalFeedback)})]})}),(0,X.jsx)(m,{className:`h-7`,value:`negative`,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-1 text-xs`,children:[(0,X.jsx)(P,{size:14,strokeWidth:1.25}),(0,X.jsx)(`span`,{className:`hidden font-medium sm:visible! sm:inline!`,children:`Less like this`}),(0,X.jsx)(`span`,{className:`font-semibold tracking-tight`,children:p(e.negativeFeedback/e.totalFeedback)})]})})]})}),(0,X.jsx)(L,{className:`mr-2 mb-3 lg:hidden xl:visible! xl:block!`,children:`Date`})]}),(0,X.jsx)(k,{}),ee?(0,X.jsx)(de,{className:`mt-3`,lines:3}):d&&d.length>0?(0,X.jsx)(`div`,{className:`flex w-full flex-col py-3`,children:d.map(e=>(0,X.jsxs)(`div`,{className:`flex h-10 w-full items-center justify-between gap-3 rounded-sm border-none px-2 text-sm hover:cursor-pointer hover:bg-accent`,onClick:()=>{n(`/members/${e.member.id}`,{crossApp:!0})},children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[(0,X.jsxs)(N,{className:`size-7`,children:[e.member?.avatar_image&&(0,X.jsx)(`img`,{className:`absolute aspect-square size-full`,src:e.member?.avatar_image}),(0,X.jsx)(F,{className:`text-white`,style:{backgroundColor:`${u(M(e.member),`45`,`55`)}`},children:O(e.member)})]}),M(e.member)]}),(0,X.jsx)(`div`,{className:`whitespace-nowrap text-muted-foreground`,children:f(e.created_at)})]},e.id))}):(0,X.jsx)(`div`,{className:`flex h-full items-center justify-center py-8 text-center text-sm text-muted-foreground`,children:(0,X.jsxs)(`div`,{children:[`No `,r===`positive`?`positive`:`negative`,` feedback yet`]})})]}):(0,X.jsxs)(y,{className:`flex grow flex-col items-center justify-center text-center text-sm text-muted-foreground`,children:[(0,X.jsx)(`div`,{children:`No members have given feedback yet`}),(0,X.jsx)(`div`,{children:`When someone does, you'll see their response here.`})]}),e.totalFeedback>0&&(0,X.jsx)(v,{className:`grow-0`,children:(0,X.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-3`,children:[(0,X.jsxs)(j,{variant:`outline`,onClick:()=>{let e=`(feedback.post_id:'${t}'+feedback.score:1)`,i=`(feedback.post_id:'${t}'+feedback.score:0)`,a=`${encodeURIComponent(e)}&post=${t}`,o=`${encodeURIComponent(i)}&post=${t}`;n(`/members?filter=${r===`positive`?a:o}`,{crossApp:!0})},children:[`View all`,(0,X.jsx)(R,{})]}),s>1&&(0,X.jsx)(ae,{className:`pb-0`,children:(0,X.jsxs)(se,{children:[(0,X.jsx)(oe,{disabled:!E,onClick:w}),(0,X.jsx)(ie,{disabled:!T,onClick:C})]})})]})})]})},xe=()=>{let{mutateAsync:e,isPending:t}=ye();return{editLinks:e,isEditLinksLoading:t}},Se=e=>{let{data:t,isLoading:n}=o(e),{data:r,isLoading:s}=o(e,{searchParams:{include:`count.positive_feedback,count.negative_feedback`}}),c=(0,J.useMemo)(()=>t?.posts[0],[t]),l=(0,J.useMemo)(()=>r?.posts[0],[r]),u=(0,J.useMemo)(()=>c?{sent:c.email?.email_count||0,opened:c.email?.opened_count||0,clicked:c.count?.clicks||0,openedRate:c.email?.opened_count?c.email.opened_count/c.email.email_count:0,clickedRate:c.count?.clicks&&c.email?.email_count?c.count.clicks/c.email.email_count:0}:{sent:0,opened:0,clicked:0,openedRate:0,clickedRate:0},[c]),d=(0,J.useMemo)(()=>{if(!l?.count)return{positiveFeedback:0,negativeFeedback:0,totalFeedback:0};let e=l.count.positive_feedback||0,t=l.count.negative_feedback||0;return{positiveFeedback:e,negativeFeedback:t,totalFeedback:e+t}},[l]),f=(0,J.useMemo)(()=>c?.newsletter?.id,[c]),{data:p,isLoading:m}=a({searchParams:f?{newsletter_id:f}:{},enabled:!!f}),h=(0,J.useMemo)(()=>p?.stats?p.stats.map(e=>e.post_id):[],[p]),{data:g,isLoading:_}=i({searchParams:f&&h.length>0?{newsletter_id:f,post_ids:h.join(`,`)}:{},enabled:!!f&&h.length>0}),v=(0,J.useMemo)(()=>{if(!p?.stats)return;let e=p.stats,t=g?.stats||[],n=new Map;t.forEach(e=>{n.set(e.post_id,e)});let r=e.map(e=>{let t=n.get(e.post_id);return{...e,total_clicks:t?.total_clicks||0,click_rate:t?.click_rate||0}});return{...p,stats:r}},[p,g]),y=m||_,{data:b,isLoading:x,refetch:S}=ve({searchParams:{filter:`post_id:'${e}'`}}),C=(0,J.useMemo)(()=>{if(!v||!v.stats)return{openRate:0,clickRate:0};let e=v.stats;if(e.length===0)return{openRate:0,clickRate:0};let t=e.reduce((e,t)=>e+(t.open_rate||0),0),n=e.reduce((e,t)=>e+(t.click_rate||0),0);return{openRate:Number((t/e.length).toFixed(2)),clickRate:Number((n/e.length).toFixed(2))}},[v]),w=(0,J.useMemo)(()=>K(b),[b]);return{post:c,stats:u,feedbackStats:d,averageStats:(0,J.useMemo)(()=>({openedRate:C.openRate,clickedRate:C.clickRate}),[C]),topLinks:w,refetchTopLinks:S,isLoading:n||s||y||x}},Ce=({breakpoints:e={sm:1080,md:1280,lg:1360}}={})=>{let[t,n]=(0,J.useState)(`md`);return(0,J.useEffect)(()=>{let t=()=>{let t=window.innerWidth;t<e.sm?n(`sm`):t<e.md?n(`md`):n(`lg`)};return t(),window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t)},[e]),{chartSize:t,isSmall:t===`sm`,isMedium:t===`md`,isLarge:t===`lg`}},we=()=>(0,X.jsx)(`div`,{className:`absolute top-1/2 -right-4 z-10 hidden size-8 -translate-y-1/2 items-center justify-center rounded-full border bg-background text-muted-foreground md:visible! md:flex!`,children:(0,X.jsx)(I,{className:`ml-0.5`,size:16,strokeWidth:1.5})}),Te=({dataColor:e,value:t,avgValue:n})=>(0,X.jsxs)(`div`,{className:`absolute top-6 left-1/2 z-50 flex w-[200px] -translate-x-1/2 flex-col items-stretch gap-1.5 rounded-md bg-background px-4 py-2 text-sm opacity-0 shadow-md transition-all group-hover/block:top-3 group-hover/block:opacity-100`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,X.jsx)(`div`,{className:`size-2 rounded-full bg-chart-blue opacity-50`,style:{backgroundColor:e}}),`This newsletter`]}),(0,X.jsx)(`div`,{className:`text-right font-mono`,children:t})]}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,X.jsx)(`div`,{className:`size-2 rounded-full bg-chart-gray opacity-80`}),`Average`]}),(0,X.jsx)(`div`,{className:`text-right font-mono`,children:n})]})]}),Ee=()=>{let e=l(),[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(``),a=(0,J.useRef)(null),o=(0,J.useRef)(null),{chartSize:c}=Ce(),{appSettings:u}=ue(),{emailTrackClicks:f,emailTrackOpens:m}=u?.analytics||{},{post:h,isPostLoading:g,postId:O}=_e(),A=t=>e(me({filter:t}),{crossApp:!0}),M=h,N=s(M);(0,J.useEffect)(()=>{!g&&!N&&e(`/posts/analytics/${O}`)},[e,O,g,N]);let{stats:P,averageStats:F,topLinks:I,isLoading:R,refetchTopLinks:ve}=Se(O),{editLinks:ye}=xe(),K=(0,J.useMemo)(()=>{if(!M?.count)return{positiveFeedback:0,negativeFeedback:0,totalFeedback:0};let e=M.count.positive_feedback||0,t=M.count.negative_feedback||0;return{positiveFeedback:e,negativeFeedback:t,totalFeedback:e+t}},[M]),q=(0,J.useMemo)(()=>M?.newsletter?.feedback_enabled===!0,[M]),Y=(0,J.useMemo)(()=>K.totalFeedback>0?!0:q,[K.totalFeedback,q]),Ee=e=>{let t=W(I,e);t&&(n(e),i(t.link.to))},De=()=>{if(!t)return;let e=W(I,t);if(!e)return;let a=r.trim();if(a===``||a===e.link.to){n(null),i(``);return}ye({originalUrl:e.link.originalTo,editedUrl:r,postId:O},{onSuccess:()=>{n(null),i(``),ve()}})},{totalPages:Oe,paginatedData:ke,nextPage:Ae,previousPage:je,hasNextPage:Me,hasPreviousPage:Ne}=D({data:I,itemsPerPage:10});(0,J.useEffect)(()=>{if(t&&a.current){a.current.focus();let e=W(I,t),s=t=>{o.current&&!o.current.contains(t.target)&&r===e?.link.to&&(n(null),i(``))};return document.addEventListener(`mousedown`,s),()=>{document.removeEventListener(`mousedown`,s)}}},[t,r,I]);let Z=R||g,Pe=[{datatype:`Sent`,value:1,fill:`url(#gradientPurple)`,color:`var(--chart-purple)`}],Fe={percentage:{label:`O`},Average:{label:`Average`},"This newsletter":{label:`This newsletter`}},Ie=[{datatype:`Average`,value:F.openedRate,fill:`url(#gradientGray)`,color:`var(--chart-gray)`},{datatype:`This newsletter`,value:P.openedRate,fill:`url(#gradientBlue)`,color:`var(--chart-blue)`}],Le={percentage:{label:`Opened`},Average:{label:`Average`},"This newsletter":{label:`This newsletter`}},Re=[{datatype:`Average`,value:F.clickedRate,fill:`url(#gradientGray)`,color:`var(--chart-gray)`},{datatype:`This newsletter`,value:P.clickedRate,fill:`url(#gradientTeal)`,color:`var(--chart-teal)`}],ze={percentage:{label:`Clicked`},Average:{label:`Average`},"This newsletter":{label:`This newsletter`}},Q=`grid-cols-3`,$=`aspect-[16/10] w-full max-w-[320px] sm:aspect-[2/1] md:aspect-[10/14] md:max-w-none lg:aspect-square`;return(!f||!m)&&(Q=`grid-cols-2`,$=`aspect-[16/10] w-full max-w-[320px] sm:aspect-[2/1] md:aspect-square md:max-w-none lg:aspect-[15/10]`),!f&&!m&&(Q=`grid-cols-1`,$=`aspect-square w-full sm:aspect-[16/10] md:max-w-[320px] md:max-h-[320px] lg:aspect-[12/10]`),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ge,{currentTab:`Newsletter`}),(0,X.jsx)(he,{children:(0,X.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 ${Y&&f&&`lg:grid-cols-2`}`,children:[(0,X.jsxs)(S,{className:Y&&f?`lg:col-span-2`:``,children:[(0,X.jsxs)(_,{className:`hidden`,children:[(0,X.jsx)(b,{children:`Newsletters`}),(0,X.jsx)(x,{children:`How did this post perform`})]}),Z?(0,X.jsx)(y,{className:`h-[25vw] p-6`,children:(0,X.jsx)(ce,{})}):(0,X.jsxs)(y,{className:`p-0`,children:[(0,X.jsxs)(`div`,{className:`grid ${Q} items-stretch border-b`,children:[(0,X.jsxs)(U,{className:`group relative isolate grow p-3 md:px-6 md:py-5`,children:[(0,X.jsx)(B,{onClick:()=>{A(`emails.post_id:${O}`)},children:`View members →`}),(0,X.jsxs)(H,{onClick:()=>{A(`emails.post_id:${O}`)},children:[(0,X.jsx)(`div`,{className:`ml-0.5 size-[9px] rounded-full bg-chart-purple opacity-50`}),`Sent`]}),(0,X.jsx)(V,{children:(0,X.jsx)(z,{className:`text-xl leading-none sm:text-2xl md:text-[2.6rem]`,children:d(P.sent)})})]}),m&&(0,X.jsxs)(U,{className:`p-3 md:px-6 md:py-5`,children:[(0,X.jsx)(B,{onClick:()=>{A(`opened_emails.post_id:${O}`)},children:`View members →`}),(0,X.jsxs)(H,{onClick:()=>{A(`opened_emails.post_id:${O}`)},children:[(0,X.jsx)(`div`,{className:`ml-0.5 size-[9px] rounded-full bg-chart-blue opacity-50`}),`Opened`]}),(0,X.jsx)(V,{children:(0,X.jsx)(z,{className:`text-xl leading-none sm:text-2xl md:text-[2.6rem]`,children:d(P.opened)})})]}),f&&(0,X.jsxs)(U,{className:`group relative isolate grow p-3 md:px-6 md:py-5`,children:[(0,X.jsx)(B,{onClick:()=>{A(`clicked_links.post_id:${O}`)},children:`View members →`}),(0,X.jsxs)(H,{onClick:()=>{A(`clicked_links.post_id:${O}`)},children:[(0,X.jsx)(`div`,{className:`ml-0.5 size-[9px] rounded-full bg-chart-teal opacity-50`}),`Clicked`]}),(0,X.jsx)(V,{children:(0,X.jsx)(z,{className:`text-xl leading-none sm:text-2xl md:text-[2.6rem]`,children:d(P.clicked)})})]})]}),(0,X.jsxs)(`div`,{className:`$ mx-auto grid grid-cols-1 items-center justify-center gap-4 transition-all md:gap-0 ${Q===`grid-cols-2`&&`md:grid-cols-2`} ${Q===`grid-cols-3`&&`md:grid-cols-3`}`,children:[(0,X.jsxs)(`div`,{className:`relative border-r-0 px-6 ${(m||f)&&`md:border-r`}`,children:[(0,X.jsx)(G,{className:$,config:Fe,data:Pe,percentageLabel:`Sent`,percentageValue:p(1),size:c,tooltip:!1}),(m||f)&&(0,X.jsx)(we,{})]}),m&&(0,X.jsxs)(`div`,{className:`group/block relative border-r-0 px-6 transition-all hover:bg-muted/25 ${f&&`md:border-r`}`,children:[(0,X.jsx)(Te,{avgValue:p(F.openedRate),dataColor:`var(--chart-blue)`,value:p(P.openedRate)}),(0,X.jsx)(G,{className:$,config:Le,data:Ie,percentageLabel:`Open rate`,percentageValue:p(P.openedRate),size:c,tooltip:!1}),f&&(0,X.jsx)(we,{})]}),f&&(0,X.jsxs)(`div`,{className:`group/block relative px-6 transition-all hover:bg-muted/25`,children:[(0,X.jsx)(Te,{avgValue:p(F.clickedRate),dataColor:`var(--chart-teal)`,value:p(P.clickedRate)}),(0,X.jsx)(G,{className:$,config:ze,data:Re,percentageLabel:`Click rate`,percentageValue:p(P.clickedRate),size:c,tooltip:!1})]})]})]})]}),Y&&(0,X.jsx)(be,{feedbackStats:K}),f&&(0,X.jsxs)(S,{className:`group/datalist overflow-hidden`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between p-6`,children:[(0,X.jsxs)(_,{className:`p-0`,children:[(0,X.jsx)(b,{children:`Newsletter clicks`}),(0,X.jsx)(x,{children:`Which links resonated with your readers`})]}),(0,X.jsx)(L,{className:`mr-2`,children:`Members`})]}),Z?(0,X.jsxs)(y,{className:`p-6 pt-0`,children:[(0,X.jsx)(k,{}),(0,X.jsx)(de,{className:`mt-6`})]}):(0,X.jsxs)(y,{className:`pb-0`,children:[(0,X.jsx)(k,{}),I.length>0?(0,X.jsx)(ne,{className:``,children:(0,X.jsx)(ee,{children:ke?.map(e=>{let n=P.clicked>0?e.count/P.clicked:0,s=e.link.link_id,c=e.link.title,l=e.link.to,u=e.link.edited;return(0,X.jsxs)(re,{children:[t!==s&&(0,X.jsx)(T,{style:{width:`${n?Math.round(n*100):0}%`}}),(0,X.jsx)(E,{className:`w-full`,children:t===s?(0,X.jsxs)(`div`,{ref:o,className:`flex w-full items-center gap-2`,children:[(0,X.jsx)(fe,{ref:a,className:`z-50 h-7 w-full border-border bg-background text-sm`,value:r,onChange:e=>i(e.target.value)}),(0,X.jsx)(j,{size:`sm`,onClick:De,children:`Update`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(j,{className:`mr-2 shrink-0 bg-background`,size:`sm`,variant:`outline`,onClick:()=>Ee(s),children:(0,X.jsx)(le,{})}),(0,X.jsx)(`a`,{className:`block truncate font-medium hover:underline`,href:l,rel:`noreferrer`,target:`_blank`,title:c,children:c}),u&&(0,X.jsx)(`span`,{className:`ml-1 text-gray-500`,children:`(edited)`})]})}),(0,X.jsxs)(te,{children:[(0,X.jsx)(C,{children:d(e.count||0)}),(0,X.jsx)(w,{children:p(n)})]})]},s)})})}):(0,X.jsx)(`div`,{className:`py-20 text-center text-sm text-gray-700`,children:`You have no links in your post.`})]}),!Z&&I.length>1&&(0,X.jsx)(v,{children:(0,X.jsxs)(`div`,{className:`flex w-full items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`mt-2 flex items-start gap-2 pl-4 text-sm text-green`,children:[(0,X.jsx)(pe,{size:20,strokeWidth:1.5}),`Sent a broken link? You can update it!`]}),Oe>1&&(0,X.jsx)(ae,{className:`pb-0`,children:(0,X.jsxs)(se,{children:[(0,X.jsx)(oe,{disabled:!Ne,onClick:je}),(0,X.jsx)(ie,{disabled:!Me,onClick:Ae})]})})]})})]})]})})]})};export{Ee as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./react-Bb3IsNbi.js";import{t as n}from"./jsx-runtime-DX3WBWVO.js";import{m as r}from"./chunk-KS7C4IRE-DG9HTHQ3.js";import{s as i}from"./router-provider-C1R4AZ2o.js";import{
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./react-Bb3IsNbi.js";import{t as n}from"./jsx-runtime-DX3WBWVO.js";import{m as r}from"./chunk-KS7C4IRE-DG9HTHQ3.js";import{s as i}from"./router-provider-C1R4AZ2o.js";import{Ht as a,I as o,Kt as s,L as c,Q as l,R as u,Wt as d,Y as f,Z as p,er as m,tr as h,tt as g,ut as _,vo as v}from"./index-ukW_0Uie.js";import{i as y,n as b,r as x,t as S}from"./use-reply-chain-data-DbKYX50v.js";var C=e(t(),1),w=n(),T=()=>(0,w.jsx)(`div`,{className:`h-px w-full bg-gray-200 dark:bg-gray-950`}),E=()=>{let{postId:e}=r(),{canGoBack:t}=i(),[n,E]=(0,C.useState)(new Set),[D,O]=(0,C.useState)(new Set),[k,A]=(0,C.useState)(new Set),[j,M]=(0,C.useState)(!1),N=(0,C.useRef)(null),P=(0,C.useRef)(null),F=(0,C.useRef)(null),I=(0,C.useRef)(null),L=s(),{threadParents:R,post:z,processedReplies:B,isLoading:V,loadMoreChildren:H,loadMoreChildReplies:U,hasMoreChildren:W,hasMoreChildReplies:G}=S(decodeURIComponent(e??``),{includeAncestors:!0}),K=z?.object,q=K?.replyCount??0,[J,Y]=(0,C.useState)(!1);if((0,C.useEffect)(()=>{P.current&&R.length>0&&!J&&(P.current.scrollIntoView({behavior:`instant`,block:`start`}),Y(!0))},[R,J]),(0,C.useEffect)(()=>{F.current&&F.current.disconnect();let e=document.querySelector(`[data-scrollable-container]`);if(e)return F.current=new IntersectionObserver(async e=>{if(e[0].isIntersecting&&W&&!j){M(!0);try{await H()}catch(e){console.error(`Failed to load more top-level replies:`,e)}finally{M(!1)}}},{root:e,rootMargin:`200px`}),I.current&&F.current.observe(I.current),()=>{F.current&&F.current.disconnect()}},[W,j,H]),V)return(0,w.jsx)(u,{children:(0,w.jsxs)(`div`,{className:`mx-auto flex max-w-[620px] flex-col items-center gap-3 pt-9 lg:px-8`,children:[(0,w.jsxs)(`div`,{className:`flex w-full items-center gap-3`,children:[(0,w.jsx)(h,{className:`size-10 rounded-full`}),(0,w.jsxs)(`div`,{className:`grow pt-1`,children:[(0,w.jsx)(h,{className:`w-24`}),(0,w.jsx)(h,{className:`w-3/5`})]})]}),(0,w.jsxs)(`div`,{className:`mb-7 w-full`,children:[(0,w.jsx)(h,{}),(0,w.jsx)(h,{className:`w-4/5`}),(0,w.jsx)(h,{})]}),(0,w.jsx)(T,{}),(0,w.jsxs)(`div`,{className:`flex w-full items-center gap-3 py-3`,children:[(0,w.jsx)(h,{className:`block size-full`,containerClassName:`size-10 rounded-full overflow-hidden`}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(h,{className:`w-52`}),(0,w.jsx)(h,{className:`w-28`})]})]}),(0,w.jsx)(T,{})]})});if(!z)return(0,w.jsx)(u,{children:(0,w.jsx)(`div`,{className:`mx-auto mt-4 flex w-full max-w-[620px] flex-col items-center`,children:(0,w.jsxs)(c,{children:[(0,w.jsx)(o,{children:(0,w.jsx)(v,{})}),(0,w.jsx)(`div`,{children:`Error loading note.`})]})})});function X(){}function Z(e){E(t=>{let n=new Set(t);return n.has(e)?n.delete(e):(n.add(e),O(t=>{let n=new Set(t);return n.add(e),n})),n})}async function Q(e,t){if(!k.has(e)){A(t=>new Set(t).add(e));try{U&&await U(t)}catch(e){console.error(`Failed to load more replies for chain:`,e)}finally{A(t=>{let n=new Set(t);return n.delete(e),n})}}}return(0,w.jsx)(u,{children:(0,w.jsx)(`div`,{className:`mx-auto flex h-full max-w-[620px] flex-col`,children:(0,w.jsx)(`div`,{className:`relative flex-1`,children:(0,w.jsx)(`div`,{className:`grow overflow-y-auto`,children:(0,w.jsxs)(`div`,{className:`mx-auto px-8 pt-5 pb-10 max-lg:px-0`,children:[!R.length&&(0,w.jsx)(g,{actor:z.actor,isCurrentUser:z.object.authored,children:(0,w.jsxs)(`div`,{className:`col-[2/3] mx-auto flex w-full cursor-pointer items-center gap-3 ${t?`pt-10 max-md:pt-5`:`pt-5`}`,children:[(0,w.jsx)(`div`,{className:`relative z-10`,children:(0,w.jsx)(_,{author:z.actor,showFollowButton:!z.object.authored&&!z.actor.followedByMe})}),(0,w.jsxs)(`div`,{className:`relative z-10 flex w-full min-w-0 cursor-pointer flex-col overflow-visible text-[1.5rem]`,onClick:e=>{l(z.actor,L,e)},children:[(0,w.jsx)(`div`,{className:`flex w-full`,children:(0,w.jsx)(`span`,{className:`min-w-0 truncate font-semibold whitespace-nowrap hover:underline`,children:z.actor.name})}),(0,w.jsxs)(`div`,{className:`flex w-full`,children:[(0,w.jsx)(`span`,{className:`truncate text-gray-700 after:mx-1 after:font-normal after:text-gray-700 after:content-["·"]`,children:d(z.actor)}),(0,w.jsx)(`span`,{className:`text-gray-700`,children:p(K,!K.authored)})]})]})]})}),R.map(e=>e.object.type===`Tombstone`?(0,w.jsx)(x,{last:!1}):(0,w.jsx)(f,{actor:e.actor,allowDelete:!1,commentCount:e.object.replyCount??0,last:!1,layout:`reply`,likeCount:e.object.likeCount??0,object:e.object,repostCount:e.object.repostCount??0,type:`Note`,onClick:()=>{L(`/${e.object.type===`Article`?`reader`:`notes`}/${encodeURIComponent(e.object.id)}`)}})),(0,w.jsx)(`div`,{ref:P,className:`${t?`scroll-mt-[12px]`:`scroll-mt-[124px]`}`,children:(0,w.jsxs)(`div`,{className:`${R.length>0&&`min-h-[calc(100vh-52px)]`}`,children:[(0,w.jsx)(f,{actor:z.actor,allowDelete:!1,commentCount:q,last:!0,layout:`modal`,likeCount:K.likeCount??0,object:K,repostCount:K.repostCount,showHeader:R.length>0,showStats:!0,type:`Note`}),(0,w.jsx)(y,{object:K}),(0,w.jsx)(T,{}),(0,w.jsxs)(`div`,{ref:N,children:[B.map((e,t)=>{let r=t===B.length-1,i=e.mainReply.id,o=n.has(i),s=D.has(i),c=k.has(i),l=e.chain.length>0;return(0,w.jsxs)(C.Fragment,{children:[(0,w.jsx)(f,{actor:e.mainReply.actor,allowDelete:e.mainReply.object.authored,commentCount:e.mainReply.object.replyCount??0,isChainParent:l,isPending:a(e.mainReply.id),last:!l,layout:`reply`,likeCount:e.mainReply.object.likeCount??0,object:e.mainReply.object,parentId:K.id,repostCount:e.mainReply.object.repostCount??0,type:`Note`,onClick:()=>{L(`/notes/${encodeURIComponent(e.mainReply.id)}`)},onDelete:X}),l&&e.chain[0]&&(0,w.jsx)(f,{actor:e.chain[0].actor,allowDelete:e.chain[0].object.authored,commentCount:e.chain[0].object.replyCount??0,isChainContinuation:!0,isPending:a(e.chain[0].id),last:e.chain.length===1,layout:`reply`,likeCount:e.chain[0].object.likeCount??0,object:e.chain[0].object,parentId:K.id,repostCount:e.chain[0].object.repostCount??0,type:`Note`,onClick:()=>{L(`/notes/${encodeURIComponent(e.chain[0].id)}`)},onDelete:X},e.chain[0].id),l&&o&&e.chain.slice(1).map((n,r)=>{let i=r===e.chain.slice(1).length-1,o=G&&G(t),s=i&&o;return(0,w.jsx)(f,{actor:n.actor,allowDelete:n.object.authored,commentCount:n.object.replyCount??0,isChainContinuation:!0,isPending:a(n.id),last:i&&!s,layout:`reply`,likeCount:n.object.likeCount??0,object:n.object,parentId:K.id,repostCount:n.object.repostCount??0,type:`Note`,onClick:()=>{L(`/notes/${encodeURIComponent(n.id)}`)},onDelete:X},n.id)}),l&&e.chain.length>1&&!o&&(0,w.jsx)(b,{variant:`expand`,onClick:()=>Z(i)}),l&&o&&s&&G&&G(t)&&(0,w.jsx)(b,{loading:c,variant:`loadMore`,onClick:()=>Q(i,t)}),!r&&(0,w.jsx)(T,{})]},e.mainReply.id)}),j&&(0,w.jsx)(`div`,{className:`flex flex-col items-center justify-center text-center`,children:(0,w.jsx)(m,{size:`md`})})]}),W&&(0,w.jsx)(`div`,{ref:I,className:`h-1`})]})})]})})})})})};export{E as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./react-Bb3IsNbi.js";import{t as n}from"./jsx-runtime-DX3WBWVO.js";import{f as r}from"./dist-DGzPJ_bO.js";import{Cs as i,Da as a,Ds as o,Eo as s,F as c,I as l,Ir as u,Kt as d,L as f,Ot as p,Q as m,R as h,Ui as g,Ut as _,X as v,Z as y,cs as b,ct as x,er as S,et as C,ka as w,lt as T,st as E,tr as D,tt as O,ut as k}from"./index-BBf502Wg.js";import"./layout-Bw4GnxXp.js";var A=e(t(),1),j=n(),M=({notificationType:e,size:t=`lg`,className:n})=>{let r,i=``,c=`white`,l=t===`sm`?13:20,u=t===`sm`?2:1.5;switch(e){case`follow`:r=(0,j.jsx)(g,{className:`-mt-0.5 -mr-0.5 ${t===`sm`&&`size-[11px]`}`,color:c,size:l,strokeWidth:u}),i=`bg-blue-600`;break;case`like`:r=(0,j.jsx)(s,{className:`${t===`sm`?`size-[11px]`:`mt-px size-5`}`,color:c,strokeWidth:u}),i=`bg-pink-600`;break;case`reply`:r=(0,j.jsx)(a,{className:`mr-px mb-px`,color:c,size:l,strokeWidth:u}),i=`bg-purple-600`;break;case`repost`:r=(0,j.jsx)(w,{color:c,size:l,strokeWidth:u}),i=`bg-green-500`;break;case`mention`:r=(0,j.jsx)(o,{className:`${t===`sm`?`size-[12px]`:`size-5`}`,color:c,size:l,strokeWidth:u}),i=`bg-orange-500`;break}return(0,j.jsx)(`div`,{className:`flex ${t===`sm`?`size-5`:`size-9`} items-center justify-center rounded-full ${i} ${n&&n}`,children:r})},N=A.createContext(void 0),P=({isGrouped:e,centerAlign:t,children:n,onClick:r,url:i,className:a})=>(0,j.jsx)(N.Provider,{value:{onClick:r,url:i},children:(0,j.jsx)(`div`,{className:`group relative -mx-4 -my-px ${e?`grid`:`flex`} ${t?`items-center`:`items-start`} break-anywhere cursor-pointer grid-cols-[auto_1fr] gap-x-4 gap-y-2.5 rounded-lg px-4 py-5 text-left hover:bg-gray-100 ${a}`,role:`button`,onClick:r,children:n})});P.Icon=({size:e=`lg`,type:t})=>(0,j.jsx)(`div`,{className:`col-start-1 row-start-1`,children:(0,j.jsx)(M,{notificationType:t,size:e})}),P.Avatars=({children:e})=>(0,j.jsx)(`div`,{className:`col-start-2 row-start-1 flex gap-2`,children:e}),P.Content=({children:e})=>(0,j.jsx)(`div`,{className:`col-start-2 row-start-2 -mt-0.5 grow overflow-hidden`,children:e});var F=()=>(0,j.jsx)(`div`,{className:`h-px w-full bg-gray-200 dark:bg-gray-950`});function I(e){let t=1440*60*1e3,n=new Date(e).getTime();return(Math.floor(n/t)*t).toString()}function L(e){let t={},n=null,r=0;return e.forEach(e=>{e.type!==n&&(r+=1,n=e.type);let i=``,a=`_${I(e.createdAt)}`,o=`_seq${r}`;switch(e.type){case`like`:e.post?.id&&(i=`like_${e.post.id}${a}${o}`);break;case`reply`:i=`reply_${e.id}`;break;case`repost`:e.post?.id&&(i=`repost_${e.post.id}${a}${o}`);break;case`follow`:i=`follow_${a}${o}`;break;case`mention`:i=`mention_${e.id}`;break}t[i]||(t[i]={id:e.id,type:e.type,actors:[],post:e.post,inReplyTo:e.inReplyTo,createdAt:e.createdAt}),t[i].actors.find(t=>t.id===e.actor.id)||t[i].actors.push(e.actor)}),Object.values(t)}var R=({group:e})=>{let[t,...n]=e.actors,i=n.length>0,a=n.length,o=d(),s=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(O,{actor:t,align:`center`,isCurrentUser:!1,children:(0,j.jsx)(`span`,{className:`cursor-pointer font-semibold hover:underline text-black dark:text-white`,onClick:e=>{e?.stopPropagation(),t.handle&&m(t.handle,o)},children:t.name})}),i&&` and ${r(a)} ${a>1?`others`:`other`}`]});switch(e.type){case`follow`:return(0,j.jsxs)(j.Fragment,{children:[s,` followed you`]});case`like`:return(0,j.jsxs)(j.Fragment,{children:[s,` liked your `,e.post?.type===`article`?`post`:`note`]});case`repost`:return(0,j.jsxs)(j.Fragment,{children:[s,` reposted your `,e.post?.type===`article`?`post`:`note`]});case`reply`:if(e.inReplyTo&&typeof e.inReplyTo!=`string`)return s;break;case`mention`:return s}return(0,j.jsx)(j.Fragment,{})},z=({content:e,className:t,stripTags:n=[]})=>{let r=(0,A.useRef)(null),i=d();return(0,A.useEffect)(()=>{let e=r.current;if(!e)return;let t=e=>{let t=e.target.closest(`a[data-profile]`);if(t){let n=t.getAttribute(`data-profile`)?.trim();/^@([\w.-]+)@([\w-]+\.[\w.-]+[a-zA-Z])$/.test(n||``)&&n&&(e.preventDefault(),e.stopPropagation(),m(n,i))}};return e.addEventListener(`click`,t),()=>{e.removeEventListener(`click`,t)}},[i,e]),(0,j.jsx)(`div`,{dangerouslySetInnerHTML:{__html:E(x(e||``,n))},ref:r,className:t})},B=()=>{let[e,t]=A.useState({}),n=d(),a=e=>{t(t=>({...t,[e]:!t[e]}))},o=()=>{},{data:s,error:g,fetchNextPage:w,hasNextPage:O,isFetchingNextPage:N,isLoading:I}=p(`index`),B=s?.pages.flatMap(e=>L(e.notifications))??Array(10).fill({actors:[{}]}),V=(0,A.useRef)(null),H=(0,A.useRef)(null);(0,A.useEffect)(()=>(V.current&&V.current.disconnect(),V.current=new IntersectionObserver(e=>{e[0].isIntersecting&&O&&!N&&w()}),H.current&&V.current.observe(H.current),()=>{V.current&&V.current.disconnect()}),[O,N,w]);let U=(e,t)=>{switch(e.type){case`like`:e.post&&n(`/${e.post.type===`article`?`reader`:`notes`}/${encodeURIComponent(e.post.id)}`);break;case`reply`:e.post&&e.inReplyTo&&n(`/notes/${encodeURIComponent(e.post.id)}`);break;case`repost`:e.post&&n(`/${e.post.type===`article`?`reader`:`notes`}/${encodeURIComponent(e.post.id)}`);break;case`follow`:e.actors.length>1?a(e.id||`${e.type}_${t}`):e.actors[0]?.handle&&m(e.actors[0].handle,n);break;case`mention`:e.post&&n(`/notes/${encodeURIComponent(e.post.id)}`);break}};return g&&_(g)?(0,j.jsx)(c,{errorCode:g.code,statusCode:g.statusCode}):(0,j.jsx)(h,{children:(0,j.jsxs)(`div`,{className:`z-0 flex w-full flex-col items-center`,children:[I===!1&&B.length===0&&(0,j.jsxs)(f,{children:[(0,j.jsx)(l,{children:(0,j.jsx)(i,{})}),`Quiet for now, but not for long! When someone likes, boosts, or replies to you, you'll find it here.`]}),B.length>0&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`my-8 flex w-full max-w-[620px] flex-col max-md:mt-5`,children:B.map((t,i)=>(0,j.jsxs)(A.Fragment,{children:[(0,j.jsxs)(P,{centerAlign:t.actors.length<2&&t.type===`follow`,className:`hover:bg-gray-100 dark:hover:bg-gray-950`,isGrouped:t.actors.length>1,onClick:()=>U(t,i),children:[I?(0,j.jsx)(D,{className:`rounded-full`,containerClassName:`flex h-10 w-10`}):t.actors.length>1?(0,j.jsx)(P.Icon,{type:t.type}):(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(k,{author:{icon:{url:t.actors[0].avatarUrl||``},name:t.actors[0].name,handle:t.actors[0].handle},size:`notification`},t.actors[0].id),(0,j.jsx)(M,{className:`absolute -right-1 -bottom-1 z-10 border-2 border-white dark:border-black`,notificationType:t.type,size:`sm`})]}),t.actors.length>1&&(0,j.jsx)(P.Avatars,{children:(0,j.jsxs)(`div`,{className:`flex w-full flex-col`,children:[(0,j.jsxs)(`div`,{className:`relative flex w-fit items-center pl-2`,children:[!e[t.id||`${t.type}_${i}`]&&t.actors.slice(0,5).map(e=>(0,j.jsx)(k,{author:{icon:{url:e.avatarUrl||``},name:e.name,handle:e.handle},className:`-ml-2 bg-[#F3F3F3]! outline-2 outline-white group-hover:bg-[#EDEEF0]! group-hover:outline-gray-100 dark:outline-black group-hover:dark:outline-gray-950`,size:`notification`},e.id)),t.actors.length>5&&!e[t.id||`${t.type}_${i}`]&&(0,j.jsx)(`div`,{className:`absolute right-[28px] z-10 flex size-9 items-center justify-center rounded-full bg-black/50 text-base font-semibold tracking-tightest text-white`,children:`+${r(t.actors.length-5)}`}),t.actors.length>1&&(0,j.jsxs)(u,{className:`group flex items-center gap-0.5 text-gray-700 hover:bg-transparent hover:text-black dark:text-gray-600 dark:hover:text-white ${e[t.id||`${t.type}_${i}`]?`ml-[-20px]`:`ml-0 w-[28px]`}`,variant:`ghost`,onClick:e=>{e?.stopPropagation(),a(t.id||`${t.type}_${i}`)},children:[(0,j.jsx)(b,{className:`${e[t.id||`${t.type}_${i}`]?`rotate-180`:``}`,size:20,strokeWidth:1.5}),e[t.id||`${t.type}_${i}`]?`Hide`:(0,j.jsx)(`span`,{className:`sr-only`,children:`Show all`})]})]}),(0,j.jsx)(`div`,{className:`overflow-hidden transition-all duration-300 ease-in-out ${e[t.id||`${t.type}_${i}`]?`mb-2 max-h-[1384px] opacity-100`:`max-h-0 opacity-0`}`,children:e[t.id||`${t.type}_${i}`]&&t.actors.length>1&&(0,j.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t.actors.map(e=>(0,j.jsxs)(`div`,{className:`group/item break-anywhere flex items-center justify-between gap-4`,onClick:t=>{t?.stopPropagation(),e.handle&&m(e.handle,n)},children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center`,children:[(0,j.jsx)(k,{author:{icon:{url:e.avatarUrl||``},name:e.name,handle:e.handle},size:`xs`}),(0,j.jsx)(`span`,{className:`ml-2 line-clamp-1 text-base font-semibold group-hover/item:underline dark:text-white`,children:e.name}),(0,j.jsx)(`span`,{className:`ml-1 line-clamp-1 text-base text-gray-700 dark:text-gray-600`,children:e.handle})]}),t.type===`follow`&&!e.followedByMe&&e.handle&&(0,j.jsx)(T,{following:!1,handle:e.handle,variant:`link`})]},e.id))})})]})}),(0,j.jsxs)(P.Content,{children:[(0,j.jsx)(`div`,{children:I?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(D,{}),(0,j.jsx)(D,{className:`w-full max-w-60`})]}):(0,j.jsxs)(`div`,{className:`flex justify-between`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(`span`,{className:`truncate`,children:(0,j.jsx)(R,{group:t})}),t.actors.length<2&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{className:`mt-px text-[8px] text-gray-700 dark:text-gray-600`,children:`•`}),(0,j.jsx)(`span`,{className:`mt-0.5 text-sm text-gray-700 dark:text-gray-600`,children:y(t,!1)})]})]}),t.actors.length===1&&(t.type===`follow`||t.type===`reply`||t.type===`mention`)&&!t.actors[0].followedByMe&&t.actors[0].handle&&(0,j.jsx)(T,{following:!1,handle:t.actors[0].handle,variant:`link`})]})}),(t.type===`reply`&&t.inReplyTo||t.type===`mention`||t.type===`like`&&!t.post?.name&&t.post?.content||t.type===`repost`&&!t.post?.name&&t.post?.content)&&(t.type!==`reply`&&t.type!==`mention`?(0,j.jsxs)(`div`,{className:`ap-note-content mt-0.5 line-clamp-1 text-sm text-pretty text-gray-700 dark:text-gray-600`,children:[t.post?.type===`article`&&t.post?.title&&(0,j.jsxs)(j.Fragment,{children:[t.post.title,` — `]}),(0,j.jsx)(`span`,{dangerouslySetInnerHTML:{__html:E(x(t.post?.content||``))}})]}):(0,j.jsx)(j.Fragment,{children:(0,j.jsxs)(`div`,{className:`mt-2.5 rounded-md bg-gray-100 px-5 py-[14px] group-hover:bg-gray-200 dark:bg-gray-950/30 group-hover:dark:bg-black/40`,children:[(0,j.jsx)(z,{className:`ap-note-content text-pretty`,content:t.post?.content||``,stripTags:[`a`]}),t.post&&t.post.attachments&&t.post.attachments.length>0&&(0,j.jsx)(`div`,{className:`notification-attachments mb-1 [&_.attachment-gallery]:flex [&_.attachment-gallery]:flex-wrap [&_img]:aspect-square [&_img]:max-w-[calc(20%-6.4px)]`,children:v({...t.post,type:`Note`,attachment:t.post.attachments})})]})})),(t.type===`reply`&&t.post||t.type===`mention`)&&(0,j.jsx)(`div`,{className:`mt-1.5`,children:(0,j.jsx)(C,{actor:{...t.actors[0],icon:{url:t.actors[0].avatarUrl||``},id:t.actors[0].url,preferredUsername:t.actors[0].handle?.replace(/^@([^@]+)@.*$/,`$1`)||`unknown`},buttonClassName:`hover:bg-gray-200`,commentCount:t.post.replyCount||0,layout:`notification`,likeCount:t.post.likeCount||0,object:{...t.post,liked:t.post.likedByMe,reposted:t.post.repostedByMe},repostCount:t.post.repostCount||0,onLikeClick:o})})]})]}),i<B.length-1&&(0,j.jsx)(`div`,{className:`pl-[52px]`,children:(0,j.jsx)(F,{})})]},t.id||`${t.type}_${i}`))}),(0,j.jsx)(`div`,{ref:H,className:`h-1`}),N&&(0,j.jsx)(`div`,{className:`-mt-4 mb-8 flex flex-col items-center justify-center gap-4 text-center`,children:(0,j.jsx)(S,{size:`md`})})]})]})})};export{B as default};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./react-Bb3IsNbi.js";import{t as n}from"./jsx-runtime-DX3WBWVO.js";import{f as r}from"./dist-DGzPJ_bO.js";import{$o as i,F as a,I as o,Kt as s,L as c,Nr as l,Ot as u,Pi as d,Q as f,R as p,Ut as m,X as h,Z as g,_o as _,ba as v,ct as y,er as b,et as x,lt as S,ms as C,st as w,tr as T,tt as E,ut as D,va as O,vs as k}from"./index-ukW_0Uie.js";import"./layout-WUcz6tu1.js";var A=e(t(),1),j=n(),M=({notificationType:e,size:t=`lg`,className:n})=>{let r,i=``,a=`white`,o=t===`sm`?13:20,s=t===`sm`?2:1.5;switch(e){case`follow`:r=(0,j.jsx)(d,{className:`-mt-0.5 -mr-0.5 ${t===`sm`&&`size-[11px]`}`,color:a,size:o,strokeWidth:s}),i=`bg-blue-600`;break;case`like`:r=(0,j.jsx)(_,{className:`${t===`sm`?`size-[11px]`:`mt-px size-5`}`,color:a,strokeWidth:s}),i=`bg-pink-600`;break;case`reply`:r=(0,j.jsx)(O,{className:`mr-px mb-px`,color:a,size:o,strokeWidth:s}),i=`bg-purple-600`;break;case`repost`:r=(0,j.jsx)(v,{color:a,size:o,strokeWidth:s}),i=`bg-green-500`;break;case`mention`:r=(0,j.jsx)(k,{className:`${t===`sm`?`size-[12px]`:`size-5`}`,color:a,size:o,strokeWidth:s}),i=`bg-orange-500`;break}return(0,j.jsx)(`div`,{className:`flex ${t===`sm`?`size-5`:`size-9`} items-center justify-center rounded-full ${i} ${n&&n}`,children:r})},N=A.createContext(void 0),P=({isGrouped:e,centerAlign:t,children:n,onClick:r,url:i,className:a})=>(0,j.jsx)(N.Provider,{value:{onClick:r,url:i},children:(0,j.jsx)(`div`,{className:`group relative -mx-4 -my-px ${e?`grid`:`flex`} ${t?`items-center`:`items-start`} break-anywhere cursor-pointer grid-cols-[auto_1fr] gap-x-4 gap-y-2.5 rounded-lg px-4 py-5 text-left hover:bg-gray-100 ${a}`,role:`button`,onClick:r,children:n})});P.Icon=({size:e=`lg`,type:t})=>(0,j.jsx)(`div`,{className:`col-start-1 row-start-1`,children:(0,j.jsx)(M,{notificationType:t,size:e})}),P.Avatars=({children:e})=>(0,j.jsx)(`div`,{className:`col-start-2 row-start-1 flex gap-2`,children:e}),P.Content=({children:e})=>(0,j.jsx)(`div`,{className:`col-start-2 row-start-2 -mt-0.5 grow overflow-hidden`,children:e});var F=()=>(0,j.jsx)(`div`,{className:`h-px w-full bg-gray-200 dark:bg-gray-950`});function I(e){let t=1440*60*1e3,n=new Date(e).getTime();return(Math.floor(n/t)*t).toString()}function L(e){let t={},n=null,r=0;return e.forEach(e=>{e.type!==n&&(r+=1,n=e.type);let i=``,a=`_${I(e.createdAt)}`,o=`_seq${r}`;switch(e.type){case`like`:e.post?.id&&(i=`like_${e.post.id}${a}${o}`);break;case`reply`:i=`reply_${e.id}`;break;case`repost`:e.post?.id&&(i=`repost_${e.post.id}${a}${o}`);break;case`follow`:i=`follow_${a}${o}`;break;case`mention`:i=`mention_${e.id}`;break}t[i]||(t[i]={id:e.id,type:e.type,actors:[],post:e.post,inReplyTo:e.inReplyTo,createdAt:e.createdAt}),t[i].actors.find(t=>t.id===e.actor.id)||t[i].actors.push(e.actor)}),Object.values(t)}var R=({group:e})=>{let[t,...n]=e.actors,i=n.length>0,a=n.length,o=s(),c=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(E,{actor:t,align:`center`,isCurrentUser:!1,children:(0,j.jsx)(`span`,{className:`cursor-pointer font-semibold hover:underline text-black dark:text-white`,onClick:e=>{e?.stopPropagation(),t.handle&&f(t.handle,o)},children:t.name})}),i&&` and ${r(a)} ${a>1?`others`:`other`}`]});switch(e.type){case`follow`:return(0,j.jsxs)(j.Fragment,{children:[c,` followed you`]});case`like`:return(0,j.jsxs)(j.Fragment,{children:[c,` liked your `,e.post?.type===`article`?`post`:`note`]});case`repost`:return(0,j.jsxs)(j.Fragment,{children:[c,` reposted your `,e.post?.type===`article`?`post`:`note`]});case`reply`:if(e.inReplyTo&&typeof e.inReplyTo!=`string`)return c;break;case`mention`:return c}return(0,j.jsx)(j.Fragment,{})},z=({content:e,className:t,stripTags:n=[]})=>{let r=(0,A.useRef)(null),i=s();return(0,A.useEffect)(()=>{let e=r.current;if(!e)return;let t=e=>{let t=e.target.closest(`a[data-profile]`);if(t){let n=t.getAttribute(`data-profile`)?.trim();/^@([\w.-]+)@([\w-]+\.[\w.-]+[a-zA-Z])$/.test(n||``)&&n&&(e.preventDefault(),e.stopPropagation(),f(n,i))}};return e.addEventListener(`click`,t),()=>{e.removeEventListener(`click`,t)}},[i,e]),(0,j.jsx)(`div`,{dangerouslySetInnerHTML:{__html:w(y(e||``,n))},ref:r,className:t})},B=()=>{let[e,t]=A.useState({}),n=s(),d=e=>{t(t=>({...t,[e]:!t[e]}))},_=()=>{},{data:v,error:E,fetchNextPage:O,hasNextPage:k,isFetchingNextPage:N,isLoading:I}=u(`index`),B=v?.pages.flatMap(e=>L(e.notifications))??Array(10).fill({actors:[{}]}),V=(0,A.useRef)(null),H=(0,A.useRef)(null);(0,A.useEffect)(()=>(V.current&&V.current.disconnect(),V.current=new IntersectionObserver(e=>{e[0].isIntersecting&&k&&!N&&O()}),H.current&&V.current.observe(H.current),()=>{V.current&&V.current.disconnect()}),[k,N,O]);let U=(e,t)=>{switch(e.type){case`like`:e.post&&n(`/${e.post.type===`article`?`reader`:`notes`}/${encodeURIComponent(e.post.id)}`);break;case`reply`:e.post&&e.inReplyTo&&n(`/notes/${encodeURIComponent(e.post.id)}`);break;case`repost`:e.post&&n(`/${e.post.type===`article`?`reader`:`notes`}/${encodeURIComponent(e.post.id)}`);break;case`follow`:e.actors.length>1?d(e.id||`${e.type}_${t}`):e.actors[0]?.handle&&f(e.actors[0].handle,n);break;case`mention`:e.post&&n(`/notes/${encodeURIComponent(e.post.id)}`);break}};return E&&m(E)?(0,j.jsx)(a,{errorCode:E.code,statusCode:E.statusCode}):(0,j.jsx)(p,{children:(0,j.jsxs)(`div`,{className:`z-0 flex w-full flex-col items-center`,children:[I===!1&&B.length===0&&(0,j.jsxs)(c,{children:[(0,j.jsx)(o,{children:(0,j.jsx)(C,{})}),`Quiet for now, but not for long! When someone likes, boosts, or replies to you, you'll find it here.`]}),B.length>0&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`my-8 flex w-full max-w-[620px] flex-col max-md:mt-5`,children:B.map((t,a)=>(0,j.jsxs)(A.Fragment,{children:[(0,j.jsxs)(P,{centerAlign:t.actors.length<2&&t.type===`follow`,className:`hover:bg-gray-100 dark:hover:bg-gray-950`,isGrouped:t.actors.length>1,onClick:()=>U(t,a),children:[I?(0,j.jsx)(T,{className:`rounded-full`,containerClassName:`flex h-10 w-10`}):t.actors.length>1?(0,j.jsx)(P.Icon,{type:t.type}):(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(D,{author:{icon:{url:t.actors[0].avatarUrl||``},name:t.actors[0].name,handle:t.actors[0].handle},size:`notification`},t.actors[0].id),(0,j.jsx)(M,{className:`absolute -right-1 -bottom-1 z-10 border-2 border-white dark:border-black`,notificationType:t.type,size:`sm`})]}),t.actors.length>1&&(0,j.jsx)(P.Avatars,{children:(0,j.jsxs)(`div`,{className:`flex w-full flex-col`,children:[(0,j.jsxs)(`div`,{className:`relative flex w-fit items-center pl-2`,children:[!e[t.id||`${t.type}_${a}`]&&t.actors.slice(0,5).map(e=>(0,j.jsx)(D,{author:{icon:{url:e.avatarUrl||``},name:e.name,handle:e.handle},className:`-ml-2 bg-[#F3F3F3]! outline-2 outline-white group-hover:bg-[#EDEEF0]! group-hover:outline-gray-100 dark:outline-black group-hover:dark:outline-gray-950`,size:`notification`},e.id)),t.actors.length>5&&!e[t.id||`${t.type}_${a}`]&&(0,j.jsx)(`div`,{className:`absolute right-[28px] z-10 flex size-9 items-center justify-center rounded-full bg-black/50 text-base font-semibold tracking-tightest text-white`,children:`+${r(t.actors.length-5)}`}),t.actors.length>1&&(0,j.jsxs)(l,{className:`group flex items-center gap-0.5 text-gray-700 hover:bg-transparent hover:text-black dark:text-gray-600 dark:hover:text-white ${e[t.id||`${t.type}_${a}`]?`ml-[-20px]`:`ml-0 w-[28px]`}`,variant:`ghost`,onClick:e=>{e?.stopPropagation(),d(t.id||`${t.type}_${a}`)},children:[(0,j.jsx)(i,{className:`${e[t.id||`${t.type}_${a}`]?`rotate-180`:``}`,size:20,strokeWidth:1.5}),e[t.id||`${t.type}_${a}`]?`Hide`:(0,j.jsx)(`span`,{className:`sr-only`,children:`Show all`})]})]}),(0,j.jsx)(`div`,{className:`overflow-hidden transition-all duration-300 ease-in-out ${e[t.id||`${t.type}_${a}`]?`mb-2 max-h-[1384px] opacity-100`:`max-h-0 opacity-0`}`,children:e[t.id||`${t.type}_${a}`]&&t.actors.length>1&&(0,j.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t.actors.map(e=>(0,j.jsxs)(`div`,{className:`group/item break-anywhere flex items-center justify-between gap-4`,onClick:t=>{t?.stopPropagation(),e.handle&&f(e.handle,n)},children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center`,children:[(0,j.jsx)(D,{author:{icon:{url:e.avatarUrl||``},name:e.name,handle:e.handle},size:`xs`}),(0,j.jsx)(`span`,{className:`ml-2 line-clamp-1 text-base font-semibold group-hover/item:underline dark:text-white`,children:e.name}),(0,j.jsx)(`span`,{className:`ml-1 line-clamp-1 text-base text-gray-700 dark:text-gray-600`,children:e.handle})]}),t.type===`follow`&&!e.followedByMe&&e.handle&&(0,j.jsx)(S,{following:!1,handle:e.handle,variant:`link`})]},e.id))})})]})}),(0,j.jsxs)(P.Content,{children:[(0,j.jsx)(`div`,{children:I?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(T,{}),(0,j.jsx)(T,{className:`w-full max-w-60`})]}):(0,j.jsxs)(`div`,{className:`flex justify-between`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(`span`,{className:`truncate`,children:(0,j.jsx)(R,{group:t})}),t.actors.length<2&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{className:`mt-px text-[8px] text-gray-700 dark:text-gray-600`,children:`•`}),(0,j.jsx)(`span`,{className:`mt-0.5 text-sm text-gray-700 dark:text-gray-600`,children:g(t,!1)})]})]}),t.actors.length===1&&(t.type===`follow`||t.type===`reply`||t.type===`mention`)&&!t.actors[0].followedByMe&&t.actors[0].handle&&(0,j.jsx)(S,{following:!1,handle:t.actors[0].handle,variant:`link`})]})}),(t.type===`reply`&&t.inReplyTo||t.type===`mention`||t.type===`like`&&!t.post?.name&&t.post?.content||t.type===`repost`&&!t.post?.name&&t.post?.content)&&(t.type!==`reply`&&t.type!==`mention`?(0,j.jsxs)(`div`,{className:`ap-note-content mt-0.5 line-clamp-1 text-sm text-pretty text-gray-700 dark:text-gray-600`,children:[t.post?.type===`article`&&t.post?.title&&(0,j.jsxs)(j.Fragment,{children:[t.post.title,` — `]}),(0,j.jsx)(`span`,{dangerouslySetInnerHTML:{__html:w(y(t.post?.content||``))}})]}):(0,j.jsx)(j.Fragment,{children:(0,j.jsxs)(`div`,{className:`mt-2.5 rounded-md bg-gray-100 px-5 py-[14px] group-hover:bg-gray-200 dark:bg-gray-950/30 group-hover:dark:bg-black/40`,children:[(0,j.jsx)(z,{className:`ap-note-content text-pretty`,content:t.post?.content||``,stripTags:[`a`]}),t.post&&t.post.attachments&&t.post.attachments.length>0&&(0,j.jsx)(`div`,{className:`notification-attachments mb-1 [&_.attachment-gallery]:flex [&_.attachment-gallery]:flex-wrap [&_img]:aspect-square [&_img]:max-w-[calc(20%-6.4px)]`,children:h({...t.post,type:`Note`,attachment:t.post.attachments})})]})})),(t.type===`reply`&&t.post||t.type===`mention`)&&(0,j.jsx)(`div`,{className:`mt-1.5`,children:(0,j.jsx)(x,{actor:{...t.actors[0],icon:{url:t.actors[0].avatarUrl||``},id:t.actors[0].url,preferredUsername:t.actors[0].handle?.replace(/^@([^@]+)@.*$/,`$1`)||`unknown`},buttonClassName:`hover:bg-gray-200`,commentCount:t.post.replyCount||0,layout:`notification`,likeCount:t.post.likeCount||0,object:{...t.post,liked:t.post.likedByMe,reposted:t.post.repostedByMe},repostCount:t.post.repostCount||0,onLikeClick:_})})]})]}),a<B.length-1&&(0,j.jsx)(`div`,{className:`pl-[52px]`,children:(0,j.jsx)(F,{})})]},t.id||`${t.type}_${a}`))}),(0,j.jsx)(`div`,{ref:H,className:`h-1`}),N&&(0,j.jsx)(`div`,{className:`-mt-4 mb-8 flex flex-col items-center justify-center gap-4 text-center`,children:(0,j.jsx)(b,{size:`md`})})]})]})})};export{B as default};
|
package/core/built/admin/assets/{onboarding-route-eU146kuA.js → onboarding-route-BzF6HeVn.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./react-Bb3IsNbi.js";import{t as n}from"./jsx-runtime-DX3WBWVO.js";import{g as r}from"./chunk-KS7C4IRE-DG9HTHQ3.js";import{a as i,t as a}from"./router-provider-C1R4AZ2o.js";import{
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./react-Bb3IsNbi.js";import{t as n}from"./jsx-runtime-DX3WBWVO.js";import{g as r}from"./chunk-KS7C4IRE-DG9HTHQ3.js";import{a as i,t as a}from"./router-provider-C1R4AZ2o.js";import{En as o,Nr as s,Sn as c,_a as l,bn as u,es as d,ho as f,n as p,t as m,xs as h}from"./index-ukW_0Uie.js";import{t as g}from"./share-modal-BJCadJyp.js";var _=e(t(),1),v=``+new URL(`logo-loader-dark-CuSPz-zc.mp4`,import.meta.url).href,y=``+new URL(`logo-loader-88VPEpXE.mp4`,import.meta.url).href,b=n();function x(){return(0,b.jsxs)(`div`,{className:`relative mb-6 size-20`,children:[(0,b.jsx)(`video`,{"aria-hidden":`true`,autoPlay:!0,className:`size-20 dark:hidden`,height:80,loop:!0,muted:!0,playsInline:!0,preload:`metadata`,role:`presentation`,tabIndex:-1,width:80,children:(0,b.jsx)(`source`,{src:y,type:`video/mp4`})}),(0,b.jsx)(`video`,{"aria-hidden":`true`,autoPlay:!0,className:`hidden size-20 dark:block`,height:80,loop:!0,muted:!0,playsInline:!0,preload:`metadata`,role:`presentation`,tabIndex:-1,width:80,children:(0,b.jsx)(`source`,{src:v,type:`video/mp4`})}),(0,b.jsx)(`div`,{className:`pointer-events-none absolute inset-0 hidden bg-[hsl(216deg_11%_70%/1%)] dark:block`})]})}function S({complete:e,id:t,isBeforeNext:n,isLast:r,isNext:i,onClick:a,step:o}){let s=o.icon;return(0,b.jsxs)(`button`,{className:`group ${i?`relative z-10 -mx-8 flex w-[calc(100%+64px)] items-center justify-between rounded-md bg-background px-8 py-6 text-left shadow-[0_1px_0_rgba(17,17,26,0.05),0_0_8px_rgba(17,17,26,0.10)] transition-none dark:ring-1 dark:ring-border ${r?`-mb-[18px]`:`mb-1.5`}`:`relative flex w-full items-center justify-between bg-transparent py-6 text-left ${r||n||i?``:`after:absolute after:inset-x-0 after:bottom-0 after:h-px after:bg-border after:content-['']`}`}`,"data-testid":`onboarding-step-${o.id}`,id:t,type:`button`,onClick:a,children:[(0,b.jsxs)(`span`,{className:`flex min-w-0 items-center ${e?`opacity-20 group-hover:opacity-25`:`group-hover:opacity-90`}`,children:[(0,b.jsx)(s,{className:`mr-4 size-5 shrink-0 text-purple`}),(0,b.jsxs)(`span`,{className:`min-w-0 text-left`,children:[(0,b.jsx)(`span`,{className:`block truncate pr-8 text-[16px] leading-[1.3] font-bold text-foreground`,children:o.title}),i&&(0,b.jsx)(`span`,{className:`mt-1 block pr-8 text-[15px] leading-[1.4] text-muted-foreground`,children:o.description})]})]}),(0,b.jsx)(`span`,{className:`flex shrink-0 items-center transition-transform group-hover:translate-x-[5px] ${e?`text-green`:`text-purple`}`,children:e?(0,b.jsx)(d,{className:`size-5`}):(0,b.jsx)(h,{className:`size-3.5`})})]})}function C({allStepsCompleted:e,completedSteps:t,nextStep:n,onComplete:r,onDismiss:i,onStepClick:a,siteTitle:o}){let c=new Set(t);return(0,b.jsx)(`main`,{className:`relative flex min-h-screen flex-col items-center justify-center px-6 py-8`,children:(0,b.jsxs)(`section`,{className:`mt-[-48px] flex w-full flex-col items-center`,"data-test-dashboard":`onboarding-checklist`,"data-testid":`onboarding-checklist`,children:[(0,b.jsxs)(`div`,{className:`mb-8 flex flex-col items-center text-center`,children:[(0,b.jsx)(x,{}),e?(0,b.jsx)(`h1`,{className:`text-[32px] leading-[1.15] font-bold tracking-normal text-foreground max-[480px]:text-[24px]`,children:`You're all set.`}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`h1`,{className:`text-[32px] leading-[1.15] font-bold tracking-normal text-foreground max-[480px]:text-[24px]`,children:`Let's get started!`}),(0,b.jsxs)(`p`,{className:`mt-2 mb-0 text-[15px] text-muted-foreground max-[480px]:m-0 max-[480px]:text-[14px]`,children:[`Welcome! It's time to set up `,o,`.`]})]})]}),(0,b.jsxs)(`div`,{className:`w-full max-w-[540px] rounded-md border border-border bg-background px-6 pt-4 pb-1`,children:[(0,b.jsxs)(`div`,{className:`mt-[-12px] flex items-center justify-between py-6 ${n===`customize-design`?`border-b-0`:`border-b border-border`}`,children:[(0,b.jsxs)(`span`,{className:`flex min-w-0 items-center opacity-20`,children:[(0,b.jsx)(l,{className:`mr-4 size-5 shrink-0 text-purple`}),(0,b.jsx)(`span`,{className:`truncate pr-8 text-[16px] leading-[1.3] font-bold text-foreground`,children:`Start a new Ghost publication`})]}),(0,b.jsx)(`span`,{className:`shrink-0 text-green`,children:(0,b.jsx)(d,{className:`size-5`})})]}),p.map((e,t)=>(0,b.jsx)(S,{complete:c.has(e.id),id:`ob-${e.id}`,isBeforeNext:p[t+1]?.id===n,isLast:t===p.length-1,isNext:n===e.id,step:e,onClick:()=>a(e.id)},e.id))]}),e&&(0,b.jsx)(s,{className:`mt-6 h-auto w-full max-w-[540px] px-3 py-3 text-[16px] max-[480px]:text-[15px]`,"data-testid":`onboarding-complete`,id:`ob-completed`,type:`button`,onClick:r,children:`Explore your dashboard`}),(0,b.jsxs)(`p`,{className:`mt-8 mb-0 text-[15px] text-muted-foreground max-[480px]:text-[14px]`,children:[`More questions? Check out our`,` `,(0,b.jsx)(s,{asChild:!0,className:`h-auto p-0 align-baseline text-[15px] text-green hover:text-green/90 max-[480px]:text-[14px]`,variant:`link`,children:(0,b.jsx)(`a`,{href:`https://ghost.org/help?utm_source=admin&utm_campaign=onboarding`,id:`ob-help-center`,rel:`noreferrer`,target:`_blank`,children:`Help Center`})}),`.`]}),!e&&(0,b.jsx)(s,{className:`mt-6 h-[38px] overflow-hidden px-3.5 py-px text-[15px] font-normal whitespace-nowrap text-muted-foreground hover:border-gray-300 hover:text-foreground`,"data-testid":`onboarding-skip`,id:`ob-skip`,type:`button`,variant:`outline`,onClick:i,children:`Skip onboarding`})]})})}function w({description:e,imageUrl:t,onOpenChange:n,open:r,siteTitle:i,siteUrl:a}){let o=encodeURIComponent(a),c=[{href:`https://twitter.com/intent/tweet?url=${o}`,id:`ob-share-on-x`,label:`Share your publication on X`,service:`x`},{href:`https://threads.net/intent/post?text=${o}`,id:`ob-share-on-threads`,label:`Share your publication on Threads`,service:`threads`},{href:`https://www.facebook.com/sharer/sharer.php?u=${o}`,id:`ob-share-on-fb`,label:`Share your publication on Facebook`,service:`facebook`},{href:`https://www.linkedin.com/feed/?shareActive=true&text=${o}`,id:`ob-share-on-li`,label:`Share your publication on LinkedIn`,service:`linkedin`}];return(0,b.jsx)(g.Root,{open:r,onOpenChange:n,children:(0,b.jsxs)(g.Content,{className:`dark:bg-surface-elevated`,"data-test-modal":`onboarding-share`,"data-testid":`onboarding-share-modal`,children:[(0,b.jsxs)(g.Header,{className:`flex-row items-center justify-between gap-4 space-y-0 text-left`,children:[(0,b.jsx)(g.Title,{className:`text-2xl`,children:`Share your publication`}),(0,b.jsx)(g.CloseButton,{id:`ob-close-share-modal`,onClick:()=>n(!1)})]}),(0,b.jsxs)(g.Preview,{className:`rounded-lg bg-card`,href:a,children:[t?(0,b.jsx)(`div`,{className:`aspect-video bg-cover bg-center`,style:{backgroundImage:`url(${t})`}}):(0,b.jsx)(`div`,{className:`flex aspect-video items-center justify-center bg-muted text-muted-foreground`,children:(0,b.jsx)(f,{className:`size-8`})}),(0,b.jsxs)(`div`,{className:`p-5`,children:[(0,b.jsx)(`div`,{className:`text-lg font-semibold`,children:i}),e&&(0,b.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e})]})]}),(0,b.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Set your publication's cover image and description in`,` `,(0,b.jsx)(s,{asChild:!0,className:`h-auto p-0 align-baseline text-sm text-green hover:text-green/90`,variant:`link`,children:(0,b.jsx)(`a`,{href:`#/settings/design/edit?ref=setup`,id:`ob-share-modal-design-settings`,children:`Design settings`})}),`.`]}),(0,b.jsxs)(g.Footer,{children:[(0,b.jsx)(g.SocialLinks,{links:c}),(0,b.jsx)(g.CopyButton,{className:`ml-0! grow cursor-pointer`,copyURL:a,"data-testid":`onboarding-copy-link`,icon:`link`,id:`ob-copy-publication-link`,label:`Copy link`})]})]})})}function T(e){return e&&/^\/analytics(?:\/|\?|$)/.test(e)?e:`/analytics`}function E(){let e=i(),[t]=r(),n=T(t.get(`returnTo`)),s=m(),l=o(),d=u(),f=(0,_.useRef)(!1),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(!1),x=String(c(l.data?.settings,`title`)||d.data?.site.title||`your publication`),S=String(c(l.data?.settings,`description`)||d.data?.site.description||``),E=String(c(l.data?.settings,`cover_image`)||``),D=d.data?.site.url||`/`,{allStepsCompleted:O,completeChecklist:k,completedSteps:A,dismissChecklist:j,shouldShowChecklist:M,isLoading:N,markStepCompleted:P,nextStep:F}=s;if(N||d.isLoading||h||f.current)return null;if(!M)return(0,b.jsx)(a,{replace:!0,to:n});let I=async t=>{f.current=!0,g(!0);try{await t(),e(n,{replace:!0})}catch(e){f.current=!1,g(!1),console.error(e)}},L=async t=>{if(t===`share-publication`){await P(t),y(!0);return}await P(t);let n=p.find(({id:e})=>e===t);n?.route&&e(n.route)};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(C,{allStepsCompleted:O,completedSteps:A,nextStep:F,siteTitle:x,onComplete:()=>{I(k)},onDismiss:()=>{I(j)},onStepClick:e=>{L(e)}}),(0,b.jsx)(w,{description:S,imageUrl:E,open:v,siteTitle:x,siteUrl:D,onOpenChange:y})]})}export{E as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./react-Bb3IsNbi.js";import{t as n}from"./jsx-runtime-DX3WBWVO.js";import{t as r}from"./use-tinybird-query-Dz156HvZ.js";import{i,o as a}from"./post-helpers-C5OQMBoi.js";import{m as o}from"./chunk-KS7C4IRE-DG9HTHQ3.js";import{a as s}from"./router-provider-C1R4AZ2o.js";import{f as c,p as l}from"./dist-DGzPJ_bO.js";import{a as u,i as d,t as f}from"./chart-helpers-DbklaJw9.js";import{a as p,n as m,o as h,t as g}from"./card-DGoDJzrn.js";import{c as _,l as v,n as y,o as b,r as x,s as ee,t as S,u as C}from"./data-list-16rkJYYi.js";import{t as w}from"./empty-indicator-oX1u1Pkn.js";import{$n as T,Gr as E,Hr as D,Ir as O,Oo as k,Wn as A,Wr as te,Ws as j,Zs as ne,_a as re,ao as ie,c as ae,ho as M,ko as oe,tr as N}from"./index-BBf502Wg.js";import{n as P,r as F,t as I}from"./kpi-card-BrGH6FsT.js";import{t as se}from"./disabled-sources-indicator-NkOIoMue.js";import{t as ce}from"./use-analytics-data-CaT8RirX.js";import{a as L,n as R,r as z,t as B}from"./kpi-card-CIGyijjx.js";import{n as le,r as ue,t as de}from"./post-analytics-header-D9pJ4iNm.js";import{t as fe}from"./gift-links-nBxJjZiQ.js";import{r as pe,t as me}from"./gift-link-modal-Bk8qpnMw.js";import{n as he}from"./post-analytics-context-D0Mw-Pmv.js";import{n as ge,t as _e}from"./use-post-referrers-BV54YcQS.js";import{a as V,o as H,r as U,t as W}from"./link-helpers-tOlxmuH5.js";import{n as ve,r as G}from"./kpi-helpers-_HRRsklE.js";var K=e(t(),1),q=n(),ye=({post:e,isNewsletterStatsLoading:t,isWebShown:n})=>{let{postId:r}=o(),i=s(),a=(0,K.useMemo)(()=>{let t=e.email?.opened_count||0,n=e.email?.email_count||0,r=e.count?.clicks||0;return{opened:t,clicked:r,openedRate:n>0?t/n:0,clickedRate:n>0?r/n:0,sent:n}},[e]),{data:u}=V({searchParams:{filter:`post_id:'${r}'`}}),d=(0,K.useMemo)(()=>U(u),[u]),f=[{datatype:`Clicked`,value:a.clickedRate,fill:`url(#gradientTeal)`,color:`var(--chart-teal)`},{datatype:`Opened`,value:a.openedRate,fill:`url(#gradientBlue)`,color:`var(--chart-blue)`}],w={percentage:{label:`Opened`},Average:{label:`Clicked`},"This newsletter":{label:`Opened`}},E=e.email_only||!n;return(0,q.jsxs)(g,{className:`group/datalist overflow-hidden ${E&&`col-span-2`}`,children:[(0,q.jsxs)(`div`,{className:`relative flex items-center justify-between gap-6`,children:[(0,q.jsx)(p,{children:(0,q.jsxs)(h,{className:`flex items-center gap-1.5 text-lg`,children:[(0,q.jsx)(ie,{size:16,strokeWidth:1.5}),`Newsletter performance`]})}),(0,q.jsx)(O,{className:`absolute right-6 translate-x-10 opacity-0 transition-all duration-300 group-hover/datalist:translate-x-0 group-hover/datalist:opacity-100 focus-visible:translate-x-0 focus-visible:opacity-100`,size:`sm`,variant:`outline`,onClick:()=>{i(`/posts/analytics/${r}/newsletter`)},children:`View more`})]}),t?(0,q.jsx)(m,{children:(0,q.jsx)(`div`,{className:`mx-auto flex min-h-[250px] items-center justify-center xl:size-full`,children:(0,q.jsx)(T,{})})}):(0,q.jsxs)(m,{className:`${E&&`grid grid-cols-2`}`,children:[(0,q.jsxs)(`div`,{className:`${E&&`border-r pr-6`}`,children:[(0,q.jsxs)(`div`,{className:`grid grid-cols-2 gap-6`,children:[(0,q.jsx)(I,{className:`group relative flex grow flex-row items-start justify-between gap-5 border-none px-0 pt-0`,children:(0,q.jsxs)(`div`,{className:`flex grow flex-col gap-1.5 border-none pb-0`,children:[(0,q.jsx)(P,{color:`var(--chart-blue)`,children:`Open rate`}),(0,q.jsx)(F,{value:l(a.openedRate)})]})}),(0,q.jsx)(I,{className:`group relative flex grow flex-row items-start justify-between gap-5 border-none px-0 pt-0`,children:(0,q.jsxs)(`div`,{className:`flex grow flex-col gap-1.5 border-none pb-0`,children:[(0,q.jsx)(P,{color:`var(--chart-teal)`,children:`Click rate`}),(0,q.jsx)(F,{value:l(a.clickedRate)})]})})]}),!E&&(0,q.jsx)(A,{}),(0,q.jsx)(`div`,{className:`mx-auto my-6 h-[240px]`,children:(0,q.jsx)(H,{className:`pointer-events-none aspect-square h-[240px]`,config:w,data:f,tooltip:!1})})]}),(0,q.jsxs)(`div`,{className:`${E&&`pl-6`}`,children:[!E&&(0,q.jsx)(A,{}),(0,q.jsxs)(`div`,{className:E?``:`pt-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 ${E?`pb-3`:`py-3`}`,children:[(0,q.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`Top clicked links in this email`}),(0,q.jsx)(j,{children:`Members`})]}),d.length>0?(0,q.jsx)(S,{className:``,children:(0,q.jsx)(x,{children:d.slice(0,E?10:5).map(e=>{let t=a.clicked>0?e.count/a.clicked:0;return(0,q.jsxs)(C,{children:[(0,q.jsx)(y,{style:{width:`${t?Math.round(t*100):0}%`}}),(0,q.jsx)(b,{children:(0,q.jsxs)(`div`,{className:`flex items-center space-x-2 overflow-hidden`,children:[(0,q.jsx)(M,{className:`shrink-0 text-muted-foreground`,size:16,strokeWidth:1.5}),(0,q.jsx)(`a`,{className:`block truncate font-medium hover:underline`,href:e.link.to,rel:`noreferrer`,target:`_blank`,title:e.link.to,children:W(e.link.to,!0)})]})}),(0,q.jsxs)(ee,{children:[(0,q.jsx)(_,{children:c(e.count||0)}),(0,q.jsx)(v,{children:l(t)})]})]},e.link.link_id)})})}):(0,q.jsx)(`div`,{className:`py-20 text-center text-sm text-gray-700`,children:`You have no links in your post.`})]})]})]})]})},be=({chartData:e,range:t,isLoading:n,visitors:r,sourcesData:i,isNewsletterShown:a=!0})=>{let{postId:l}=o(),d=s(),{site:f}=ce(),_=f.url,v=f.icon,y=(0,K.useMemo)(()=>i?i.reduce((e,t)=>e+Number(t.visits||0),0):0,[i]);return(0,q.jsx)(q.Fragment,{children:(0,q.jsxs)(g,{className:`group/datalist overflow-hidden ${!a&&`col-span-2`}`,"data-testid":`web-performance`,children:[(0,q.jsxs)(`div`,{className:`relative flex items-center justify-between gap-6`,children:[(0,q.jsx)(p,{children:(0,q.jsxs)(h,{className:`flex items-center gap-1.5 text-lg`,children:[(0,q.jsx)(k,{size:16,strokeWidth:1.5}),`Web performance`]})}),(0,q.jsx)(O,{className:`absolute right-6 translate-x-10 opacity-0 transition-all duration-300 group-hover/datalist:translate-x-0 group-hover/datalist:opacity-100 focus-visible:translate-x-0 focus-visible:opacity-100`,size:`sm`,variant:`outline`,onClick:()=>{d(`/posts/analytics/${l}/web`)},children:`View more`})]}),(0,q.jsxs)(m,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(I,{className:`group relative flex grow flex-row items-start justify-between gap-5 border-none px-0 pt-0`,"data-testid":`unique-visitors`,children:(0,q.jsxs)(`div`,{className:`flex grow flex-col gap-1.5 border-none pb-0`,children:[(0,q.jsx)(P,{color:`var(--chart-blue)`,children:`Unique visitors`}),(0,q.jsx)(F,{value:c(r)})]})}),(0,q.jsx)(A,{}),(0,q.jsx)(`div`,{className:`max-h-[288px] py-6 [&_.recharts-cartesian-axis-tick-value]:fill-gray-500`,children:n?(0,q.jsx)(`div`,{className:`flex h-[16vw] min-h-[240px] items-center justify-center`,children:(0,q.jsx)(T,{})}):(0,q.jsx)(u,{className:`aspect-auto h-[240px] w-full`,color:`var(--chart-blue)`,data:e||[],id:`visitors`,range:t,syncId:`overview-charts`})})]}),a&&(0,q.jsxs)(`div`,{className:a?`border-t pt-3`:`-mt-3`,children:[(0,q.jsx)(`div`,{children:(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-3`,children:[(0,q.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`How readers found this post`}),(0,q.jsx)(j,{children:`Visitors`})]})}),i&&i.length>0?(0,q.jsx)(G,{data:i,range:t,siteIcon:v,siteUrl:_,tableOnly:!0,topSourcesLimit:5,totalVisitors:y}):(0,q.jsx)(w,{className:`h-full py-10`,description:`Once someone visits this post, sources will show here`,title:`No visitors since you published this post`,children:(0,q.jsx)(k,{strokeWidth:1.5})})]})]})]})})},J=()=>{let e=s(),{statsConfig:t,isLoading:n}=ce(),{post:o,isPostLoading:l,postId:u}=he(),{totals:_,isLoading:v,currencySymbol:y}=_e(u),{appSettings:b}=ne(),{emailTrackClicks:x,emailTrackOpens:ee}=b?.analytics||{},S=b?.analytics?.webAnalytics===!0,C=le(o),{token:w,isLoading:k,error:A}=fe(u,{enabled:C}),{usage:j,loading:ie,error:M}=pe({postUuid:o?.uuid,token:w,tokenLoading:k,tokenError:A,enabled:C}),[P,F]=(0,K.useState)(!1),I=(0,K.useMemo)(()=>o?.published_at?E(o.published_at):ae.allTime.value,[o?.published_at]),{startDate:V,endDate:H,timezone:U}=te(I),W=(0,K.useMemo)(()=>{let e={site_uuid:t?.id||``,date_from:D(V),date_to:D(H),timezone:U,post_uuid:``};return!l&&o?.uuid?{...e,post_uuid:o.uuid}:e},[l,o,t?.id,V,H,U]),{data:G,loading:J}=r({endpoint:`api_kpis`,statsConfig:t,params:W}),xe=(0,K.useMemo)(()=>G?.length?G.reduce((e,t)=>{let n=Number(t.visits);return e+(isNaN(n)?0:n)},0):0,[G]),Y=ve.visits,Se=f(I,G||[],{fieldName:Y.dataKey}),Ce=d(G||[],I,Y.dataKey,`sum`)?.map(e=>{let t=Number(e[Y.dataKey]);return{date:String(e.date),value:t,formattedValue:Y.formatter(t),label:Y.label}}),{data:we,loading:Te}=r({endpoint:`api_top_sources`,statsConfig:t,params:W}),Ee=n||v||l||J,De=l||n||J,X=a(o)&&ee&&x,Z=!o?.email_only&&S,Q=b?.analytics.membersTrackSources,$=!!(C&&o&&b?.analytics.webAnalytics);return(0,K.useEffect)(()=>{!l&&o&&i(o)&&!S&&Q&&e(`/posts/analytics/${u}/growth`,{replace:!0})},[l,o,S,e,u,Q]),l?(0,q.jsx)(T,{}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(de,{currentTab:`Overview`}),(0,q.jsx)(ue,{children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-6 lg:grid lg:grid-cols-2`,children:[Z&&(0,q.jsx)(be,{chartData:Ce,isLoading:De||Ee||Te,isNewsletterShown:X,range:Se,sourcesData:we,visitors:xe}),X&&(0,q.jsx)(ye,{isNewsletterStatsLoading:l,isWebShown:Z,post:o}),(Q||$)&&(0,q.jsxs)(`div`,{className:`col-span-2 flex flex-col gap-6 lg:grid lg:grid-cols-3`,children:[Q&&(0,q.jsxs)(g,{className:`group overflow-hidden p-0 ${$?`lg:col-span-2`:`lg:col-span-3`}`,"data-testid":`growth`,children:[(0,q.jsxs)(`div`,{className:`relative flex items-center justify-between gap-6`,children:[(0,q.jsx)(p,{children:(0,q.jsxs)(h,{className:`flex items-center gap-1.5 text-lg`,children:[(0,q.jsx)(re,{size:16,strokeWidth:1.5}),`Growth`]})}),(0,q.jsx)(O,{className:`absolute right-6 translate-x-10 opacity-0 transition-all duration-200 group-hover:translate-x-0 group-hover:opacity-100 focus-visible:translate-x-0 focus-visible:opacity-100`,size:`sm`,variant:`outline`,onClick:()=>{e(`/posts/analytics/${u}/growth`)},children:`View more`})]}),(0,q.jsx)(m,{className:`flex flex-col gap-6 px-0 md:grid md:grid-cols-3 md:items-stretch md:gap-0`,children:Ee?Array.from({length:3},(e,t)=>(0,q.jsxs)(`div`,{className:`h-[98px] gap-1 border-r px-6 py-5 last:border-r-0`,children:[(0,q.jsx)(N,{className:`w-2/3`}),(0,q.jsx)(N,{className:`h-7 w-12`})]},t)):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(B,{className:`grow gap-1 py-0`,children:[(0,q.jsx)(z,{children:`Free members`}),(0,q.jsx)(R,{children:(0,q.jsx)(L,{className:`text-[2.2rem]`,children:c(_?.free_members||0)})})]}),b?.paidMembersEnabled&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(B,{className:`grow gap-1 py-0`,children:[(0,q.jsx)(z,{children:`Paid members`}),(0,q.jsx)(R,{children:(0,q.jsx)(L,{className:`text-[2.2rem]`,children:c(_?.paid_members||0)})})]}),(0,q.jsxs)(B,{className:`grow gap-1 py-0`,children:[(0,q.jsx)(z,{children:`MRR impact`}),(0,q.jsx)(R,{children:(0,q.jsxs)(L,{className:`text-[2.2rem]`,children:[y,c(ge(_?.mrr||0))]})})]})]})]})})]}),$&&(0,q.jsxs)(g,{className:`group/datalist overflow-hidden ${Q?`lg:col-span-1`:`lg:col-span-3`}`,"data-testid":`gift-link-card`,children:[(0,q.jsxs)(`div`,{className:`relative flex items-center justify-between gap-6`,children:[(0,q.jsx)(p,{children:(0,q.jsxs)(h,{className:`flex items-center gap-1.5 text-lg`,children:[(0,q.jsx)(oe,{size:16,strokeWidth:1.5}),`Gift link`]})}),(0,q.jsx)(O,{className:`absolute right-6 translate-x-10 opacity-0 transition-all duration-300 group-hover/datalist:translate-x-0 group-hover/datalist:opacity-100 focus-visible:translate-x-0 focus-visible:opacity-100`,size:`sm`,variant:`outline`,onClick:()=>F(!0),children:`Share`})]}),!ie&&!M&&(0,q.jsxs)(m,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Visitors`}),(0,q.jsx)(`span`,{className:`text-[2.2rem] leading-none font-semibold`,"data-testid":`gift-link-card-visitors`,children:c(j?.visits??0)})]})]})]}),!Z&&!X&&!Q&&!$&&(0,q.jsx)(se,{className:`col-span-2 py-20`})]})}),$&&(0,q.jsx)(me,{open:P,postId:u,source:`gift-link-card`,onOpenChange:F},u)]})};export{J as default};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./react-Bb3IsNbi.js";import{t as n}from"./jsx-runtime-DX3WBWVO.js";import{t as r}from"./use-tinybird-query-C7bQRJWw.js";import{i,o as a}from"./post-helpers-C5OQMBoi.js";import{m as o}from"./chunk-KS7C4IRE-DG9HTHQ3.js";import{a as s}from"./router-provider-C1R4AZ2o.js";import{f as c,p as l}from"./dist-DGzPJ_bO.js";import{a as u,i as d,t as f}from"./chart-helpers-xiSsW8r0.js";import{a as p,n as m,o as h,t as g}from"./card-DGoDJzrn.js";import{c as _,l as v,n as y,o as b,r as x,s as ee,t as S,u as C}from"./data-list-16rkJYYi.js";import{t as w}from"./empty-indicator-oX1u1Pkn.js";import{$n as T,Gn as E,Hr as D,Nr as O,Rs as te,Vr as ne,Xa as k,bo as re,c as ie,ca as ae,js as A,oo as oe,tr as j,yo as M,zr as N}from"./index-ukW_0Uie.js";import{n as P,r as F,t as I}from"./kpi-card-DCdlyaSS.js";import{t as se}from"./disabled-sources-indicator-qs2GfLvl.js";import{t as ce}from"./use-analytics-data-Cds6XDjg.js";import{a as L,n as R,r as z,t as B}from"./kpi-card-BlZaG1Lo.js";import{n as le,r as ue,t as de}from"./post-analytics-header-DsMoLx0R.js";import{t as fe}from"./gift-links-nBxJjZiQ.js";import{r as pe,t as me}from"./gift-link-modal-su8MsRdg.js";import{n as he}from"./post-analytics-context-D0Mw-Pmv.js";import{n as ge,t as _e}from"./use-post-referrers-CRtgyuXB.js";import{a as V,o as H,r as U,t as W}from"./link-helpers-tOlxmuH5.js";import{n as ve,r as G}from"./kpi-helpers-DpAuS1Nb.js";var K=e(t(),1),q=n(),ye=({post:e,isNewsletterStatsLoading:t,isWebShown:n})=>{let{postId:r}=o(),i=s(),a=(0,K.useMemo)(()=>{let t=e.email?.opened_count||0,n=e.email?.email_count||0,r=e.count?.clicks||0;return{opened:t,clicked:r,openedRate:n>0?t/n:0,clickedRate:n>0?r/n:0,sent:n}},[e]),{data:u}=V({searchParams:{filter:`post_id:'${r}'`}}),d=(0,K.useMemo)(()=>U(u),[u]),f=[{datatype:`Clicked`,value:a.clickedRate,fill:`url(#gradientTeal)`,color:`var(--chart-teal)`},{datatype:`Opened`,value:a.openedRate,fill:`url(#gradientBlue)`,color:`var(--chart-blue)`}],w={percentage:{label:`Opened`},Average:{label:`Clicked`},"This newsletter":{label:`Opened`}},D=e.email_only||!n;return(0,q.jsxs)(g,{className:`group/datalist overflow-hidden ${D&&`col-span-2`}`,children:[(0,q.jsxs)(`div`,{className:`relative flex items-center justify-between gap-6`,children:[(0,q.jsx)(p,{children:(0,q.jsxs)(h,{className:`flex items-center gap-1.5 text-lg`,children:[(0,q.jsx)(k,{size:16,strokeWidth:1.5}),`Newsletter performance`]})}),(0,q.jsx)(O,{className:`absolute right-6 translate-x-10 opacity-0 transition-all duration-300 group-hover/datalist:translate-x-0 group-hover/datalist:opacity-100 focus-visible:translate-x-0 focus-visible:opacity-100`,size:`sm`,variant:`outline`,onClick:()=>{i(`/posts/analytics/${r}/newsletter`)},children:`View more`})]}),t?(0,q.jsx)(m,{children:(0,q.jsx)(`div`,{className:`mx-auto flex min-h-[250px] items-center justify-center xl:size-full`,children:(0,q.jsx)(T,{})})}):(0,q.jsxs)(m,{className:`${D&&`grid grid-cols-2`}`,children:[(0,q.jsxs)(`div`,{className:`${D&&`border-r pr-6`}`,children:[(0,q.jsxs)(`div`,{className:`grid grid-cols-2 gap-6`,children:[(0,q.jsx)(I,{className:`group relative flex grow flex-row items-start justify-between gap-5 border-none px-0 pt-0`,children:(0,q.jsxs)(`div`,{className:`flex grow flex-col gap-1.5 border-none pb-0`,children:[(0,q.jsx)(P,{color:`var(--chart-blue)`,children:`Open rate`}),(0,q.jsx)(F,{value:l(a.openedRate)})]})}),(0,q.jsx)(I,{className:`group relative flex grow flex-row items-start justify-between gap-5 border-none px-0 pt-0`,children:(0,q.jsxs)(`div`,{className:`flex grow flex-col gap-1.5 border-none pb-0`,children:[(0,q.jsx)(P,{color:`var(--chart-teal)`,children:`Click rate`}),(0,q.jsx)(F,{value:l(a.clickedRate)})]})})]}),!D&&(0,q.jsx)(E,{}),(0,q.jsx)(`div`,{className:`mx-auto my-6 h-[240px]`,children:(0,q.jsx)(H,{className:`pointer-events-none aspect-square h-[240px]`,config:w,data:f,tooltip:!1})})]}),(0,q.jsxs)(`div`,{className:`${D&&`pl-6`}`,children:[!D&&(0,q.jsx)(E,{}),(0,q.jsxs)(`div`,{className:D?``:`pt-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 ${D?`pb-3`:`py-3`}`,children:[(0,q.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`Top clicked links in this email`}),(0,q.jsx)(A,{children:`Members`})]}),d.length>0?(0,q.jsx)(S,{className:``,children:(0,q.jsx)(x,{children:d.slice(0,D?10:5).map(e=>{let t=a.clicked>0?e.count/a.clicked:0;return(0,q.jsxs)(C,{children:[(0,q.jsx)(y,{style:{width:`${t?Math.round(t*100):0}%`}}),(0,q.jsx)(b,{children:(0,q.jsxs)(`div`,{className:`flex items-center space-x-2 overflow-hidden`,children:[(0,q.jsx)(oe,{className:`shrink-0 text-muted-foreground`,size:16,strokeWidth:1.5}),(0,q.jsx)(`a`,{className:`block truncate font-medium hover:underline`,href:e.link.to,rel:`noreferrer`,target:`_blank`,title:e.link.to,children:W(e.link.to,!0)})]})}),(0,q.jsxs)(ee,{children:[(0,q.jsx)(_,{children:c(e.count||0)}),(0,q.jsx)(v,{children:l(t)})]})]},e.link.link_id)})})}):(0,q.jsx)(`div`,{className:`py-20 text-center text-sm text-gray-700`,children:`You have no links in your post.`})]})]})]})]})},be=({chartData:e,range:t,isLoading:n,visitors:r,sourcesData:i,isNewsletterShown:a=!0})=>{let{postId:l}=o(),d=s(),{site:f}=ce(),_=f.url,v=f.icon,y=(0,K.useMemo)(()=>i?i.reduce((e,t)=>e+Number(t.visits||0),0):0,[i]);return(0,q.jsx)(q.Fragment,{children:(0,q.jsxs)(g,{className:`group/datalist overflow-hidden ${!a&&`col-span-2`}`,"data-testid":`web-performance`,children:[(0,q.jsxs)(`div`,{className:`relative flex items-center justify-between gap-6`,children:[(0,q.jsx)(p,{children:(0,q.jsxs)(h,{className:`flex items-center gap-1.5 text-lg`,children:[(0,q.jsx)(M,{size:16,strokeWidth:1.5}),`Web performance`]})}),(0,q.jsx)(O,{className:`absolute right-6 translate-x-10 opacity-0 transition-all duration-300 group-hover/datalist:translate-x-0 group-hover/datalist:opacity-100 focus-visible:translate-x-0 focus-visible:opacity-100`,size:`sm`,variant:`outline`,onClick:()=>{d(`/posts/analytics/${l}/web`)},children:`View more`})]}),(0,q.jsxs)(m,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(I,{className:`group relative flex grow flex-row items-start justify-between gap-5 border-none px-0 pt-0`,"data-testid":`unique-visitors`,children:(0,q.jsxs)(`div`,{className:`flex grow flex-col gap-1.5 border-none pb-0`,children:[(0,q.jsx)(P,{color:`var(--chart-blue)`,children:`Unique visitors`}),(0,q.jsx)(F,{value:c(r)})]})}),(0,q.jsx)(E,{}),(0,q.jsx)(`div`,{className:`max-h-[288px] py-6 [&_.recharts-cartesian-axis-tick-value]:fill-gray-500`,children:n?(0,q.jsx)(`div`,{className:`flex h-[16vw] min-h-[240px] items-center justify-center`,children:(0,q.jsx)(T,{})}):(0,q.jsx)(u,{className:`aspect-auto h-[240px] w-full`,color:`var(--chart-blue)`,data:e||[],id:`visitors`,range:t,syncId:`overview-charts`})})]}),a&&(0,q.jsxs)(`div`,{className:a?`border-t pt-3`:`-mt-3`,children:[(0,q.jsx)(`div`,{children:(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-3`,children:[(0,q.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`How readers found this post`}),(0,q.jsx)(A,{children:`Visitors`})]})}),i&&i.length>0?(0,q.jsx)(G,{data:i,range:t,siteIcon:v,siteUrl:_,tableOnly:!0,topSourcesLimit:5,totalVisitors:y}):(0,q.jsx)(w,{className:`h-full py-10`,description:`Once someone visits this post, sources will show here`,title:`No visitors since you published this post`,children:(0,q.jsx)(M,{strokeWidth:1.5})})]})]})]})})},J=()=>{let e=s(),{statsConfig:t,isLoading:n}=ce(),{post:o,isPostLoading:l,postId:u}=he(),{totals:_,isLoading:v,currencySymbol:y}=_e(u),{appSettings:b}=te(),{emailTrackClicks:x,emailTrackOpens:ee}=b?.analytics||{},S=b?.analytics?.webAnalytics===!0,C=le(o),{token:w,isLoading:E,error:k}=fe(u,{enabled:C}),{usage:A,loading:oe,error:M}=pe({postUuid:o?.uuid,token:w,tokenLoading:E,tokenError:k,enabled:C}),[P,F]=(0,K.useState)(!1),I=(0,K.useMemo)(()=>o?.published_at?D(o.published_at):ie.allTime.value,[o?.published_at]),{startDate:V,endDate:H,timezone:U}=ne(I),W=(0,K.useMemo)(()=>{let e={site_uuid:t?.id||``,date_from:N(V),date_to:N(H),timezone:U,post_uuid:``};return!l&&o?.uuid?{...e,post_uuid:o.uuid}:e},[l,o,t?.id,V,H,U]),{data:G,loading:J}=r({endpoint:`api_kpis`,statsConfig:t,params:W}),xe=(0,K.useMemo)(()=>G?.length?G.reduce((e,t)=>{let n=Number(t.visits);return e+(isNaN(n)?0:n)},0):0,[G]),Y=ve.visits,Se=f(I,G||[],{fieldName:Y.dataKey}),Ce=d(G||[],I,Y.dataKey,`sum`)?.map(e=>{let t=Number(e[Y.dataKey]);return{date:String(e.date),value:t,formattedValue:Y.formatter(t),label:Y.label}}),{data:we,loading:Te}=r({endpoint:`api_top_sources`,statsConfig:t,params:W}),Ee=n||v||l||J,De=l||n||J,X=a(o)&&ee&&x,Z=!o?.email_only&&S,Q=b?.analytics.membersTrackSources,$=!!(C&&o&&b?.analytics.webAnalytics);return(0,K.useEffect)(()=>{!l&&o&&i(o)&&!S&&Q&&e(`/posts/analytics/${u}/growth`,{replace:!0})},[l,o,S,e,u,Q]),l?(0,q.jsx)(T,{}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(de,{currentTab:`Overview`}),(0,q.jsx)(ue,{children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-6 lg:grid lg:grid-cols-2`,children:[Z&&(0,q.jsx)(be,{chartData:Ce,isLoading:De||Ee||Te,isNewsletterShown:X,range:Se,sourcesData:we,visitors:xe}),X&&(0,q.jsx)(ye,{isNewsletterStatsLoading:l,isWebShown:Z,post:o}),(Q||$)&&(0,q.jsxs)(`div`,{className:`col-span-2 flex flex-col gap-6 lg:grid lg:grid-cols-3`,children:[Q&&(0,q.jsxs)(g,{className:`group overflow-hidden p-0 ${$?`lg:col-span-2`:`lg:col-span-3`}`,"data-testid":`growth`,children:[(0,q.jsxs)(`div`,{className:`relative flex items-center justify-between gap-6`,children:[(0,q.jsx)(p,{children:(0,q.jsxs)(h,{className:`flex items-center gap-1.5 text-lg`,children:[(0,q.jsx)(ae,{size:16,strokeWidth:1.5}),`Growth`]})}),(0,q.jsx)(O,{className:`absolute right-6 translate-x-10 opacity-0 transition-all duration-200 group-hover:translate-x-0 group-hover:opacity-100 focus-visible:translate-x-0 focus-visible:opacity-100`,size:`sm`,variant:`outline`,onClick:()=>{e(`/posts/analytics/${u}/growth`)},children:`View more`})]}),(0,q.jsx)(m,{className:`flex flex-col gap-6 px-0 md:grid md:grid-cols-3 md:items-stretch md:gap-0`,children:Ee?Array.from({length:3},(e,t)=>(0,q.jsxs)(`div`,{className:`h-[98px] gap-1 border-r px-6 py-5 last:border-r-0`,children:[(0,q.jsx)(j,{className:`w-2/3`}),(0,q.jsx)(j,{className:`h-7 w-12`})]},t)):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(B,{className:`grow gap-1 py-0`,children:[(0,q.jsx)(z,{children:`Free members`}),(0,q.jsx)(R,{children:(0,q.jsx)(L,{className:`text-[2.2rem]`,children:c(_?.free_members||0)})})]}),b?.paidMembersEnabled&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(B,{className:`grow gap-1 py-0`,children:[(0,q.jsx)(z,{children:`Paid members`}),(0,q.jsx)(R,{children:(0,q.jsx)(L,{className:`text-[2.2rem]`,children:c(_?.paid_members||0)})})]}),(0,q.jsxs)(B,{className:`grow gap-1 py-0`,children:[(0,q.jsx)(z,{children:`MRR impact`}),(0,q.jsx)(R,{children:(0,q.jsxs)(L,{className:`text-[2.2rem]`,children:[y,c(ge(_?.mrr||0))]})})]})]})]})})]}),$&&(0,q.jsxs)(g,{className:`group/datalist overflow-hidden ${Q?`lg:col-span-1`:`lg:col-span-3`}`,"data-testid":`gift-link-card`,children:[(0,q.jsxs)(`div`,{className:`relative flex items-center justify-between gap-6`,children:[(0,q.jsx)(p,{children:(0,q.jsxs)(h,{className:`flex items-center gap-1.5 text-lg`,children:[(0,q.jsx)(re,{size:16,strokeWidth:1.5}),`Gift link`]})}),(0,q.jsx)(O,{className:`absolute right-6 translate-x-10 opacity-0 transition-all duration-300 group-hover/datalist:translate-x-0 group-hover/datalist:opacity-100 focus-visible:translate-x-0 focus-visible:opacity-100`,size:`sm`,variant:`outline`,onClick:()=>F(!0),children:`Share`})]}),!oe&&!M&&(0,q.jsxs)(m,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Visitors`}),(0,q.jsx)(`span`,{className:`text-[2.2rem] leading-none font-semibold`,"data-testid":`gift-link-card-visitors`,children:c(A?.visits??0)})]})]})]}),!Z&&!X&&!Q&&!$&&(0,q.jsx)(se,{className:`col-span-2 py-20`})]})}),$&&(0,q.jsx)(me,{open:P,postId:u,source:`gift-link-card`,onOpenChange:F},u)]})};export{J as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./react-Bb3IsNbi.js";import{t as n}from"./jsx-runtime-DX3WBWVO.js";import{c as r}from"./dist-DGzPJ_bO.js";import{t as i}from"./inline-EMAm3okk.js";import{t as a}from"./stack-xiN0eQ6Z.js";import{t as o}from"./text-DwtjwGkh.js";import{
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./react-Bb3IsNbi.js";import{t as n}from"./jsx-runtime-DX3WBWVO.js";import{c as r}from"./dist-DGzPJ_bO.js";import{t as i}from"./inline-EMAm3okk.js";import{t as a}from"./stack-xiN0eQ6Z.js";import{t as o}from"./text-DwtjwGkh.js";import{Ds as s,Gr as c,qr as l,ti as u}from"./index-ukW_0Uie.js";var d=e(t(),1),f=n();function p({className:e,children:t}){return(0,f.jsx)(i,{align:`center`,className:r(`pt-1 text-sm text-muted-foreground`,e),"data-page-header":`breadcrumb`,gap:`sm`,children:t})}function m({className:e,children:t}){return(0,f.jsx)(o,{as:`span`,className:r(`ml-1 text-base tabular-nums`,e),"data-page-header":`count`,tone:`secondary`,weight:`regular`,children:t})}function h({className:e,children:t}){return(0,f.jsx)(o,{as:`p`,className:e,"data-page-header":`description`,size:`sm`,tone:`secondary`,children:t})}function g({className:e,children:t}){return(0,f.jsx)(o,{as:`p`,className:r(`mt-0.5`,e),"data-page-header":`meta`,size:`sm`,tone:`secondary`,children:t})}function _({className:e,children:t}){let n=[],i=[];d.Children.forEach(t,e=>{if(!d.isValidElement(e)){n.push(e);return}switch(e.type){case h:case g:i.push(e);break;default:n.push(e)}});let o=(0,f.jsx)(s,{className:r(`text-lg font-semibold tracking-[0.1px] whitespace-nowrap`,e),"data-page-header":`title`,children:n});return i.length>0?(0,f.jsxs)(a,{"data-page-header":`title-body`,gap:`none`,children:[o,i]}):o}function v({className:e,children:t}){return(0,f.jsx)(a,{className:r(`h-full min-h-(--control-height) min-w-0`,e),"data-page-header":`left`,gap:`xs`,justify:`center`,children:t})}function y({children:e}){return(0,f.jsx)(f.Fragment,{children:e})}function b({children:e}){return(0,f.jsx)(c,{children:e})}function x({children:e,...t}){return(0,f.jsx)(u,{asChild:!0,...t,children:e})}function S({children:e,...t}){return(0,f.jsx)(l,{align:`end`,sideOffset:8,...t,children:e})}var C=640,w=e=>typeof window>`u`?!1:window.innerWidth<e,T=e=>{let[t,n]=d.useState(()=>w(e));return d.useEffect(()=>{let t=()=>{n(w(e))};return t(),window.addEventListener(`resize`,t),()=>{window.removeEventListener(`resize`,t)}},[e]),t},E=Object.assign(function({className:e,children:t,mobileMenuBreakpoint:n=C}){let r=d.Children.toArray(t),a=[],o=null,s=null,c=T(n);return r.forEach(e=>{if(!d.isValidElement(e)){a.push(e);return}let t=e;if(t.type===b){o=t;return}if(t.type===y){s=t.props.children??null,a.push(t.props.children??null);return}a.push(t)}),o?c?(0,f.jsx)(i,{align:`center`,className:e,"data-page-header":`action-group`,gap:`sm`,justify:`end`,children:(0,f.jsxs)(i,{align:`center`,className:`ml-auto`,"data-page-header":`action-group-mobile`,gap:`sm`,children:[o,s&&(0,f.jsx)(`div`,{"data-page-header":`action-group-mobile-primary`,children:s})]})}):(0,f.jsx)(i,{align:`center`,className:e,"data-page-header":`action-group`,gap:`sm`,justify:`end`,children:(0,f.jsx)(i,{align:`center`,"data-page-header":`action-group-desktop`,gap:`sm`,justify:`end`,children:a})}):(0,f.jsx)(i,{align:`center`,className:e,"data-page-header":`action-group`,gap:`sm`,justify:`end`,children:t})},{Primary:y,MobileMenu:b,MobileMenuTrigger:x,MobileMenuContent:S});function D({className:e,children:t}){return(0,f.jsx)(i,{align:`center`,className:r(`min-h-(--control-height) shrink-0`,e),"data-page-header":`actions`,gap:`lg`,children:t})}var O=Object.assign(function({className:e,children:t,sticky:n=!0,blurredBackground:a=!0}){return(0,f.jsx)(`header`,{className:r(`flex flex-col`,n&&`sticky top-0 z-50`,a&&`bg-gradient-to-b from-background via-background/70 to-background/70 backdrop-blur-md dark:bg-black`,e),"data-page-header":`page-header`,children:(0,f.jsx)(i,{align:`start`,className:`w-full`,"data-page-header":`main`,gap:`lg`,justify:`between`,children:t})})},{Left:v,Breadcrumb:p,Title:_,Count:m,Description:h,Meta:g,Actions:D,ActionGroup:E});export{O as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./react-Bb3IsNbi.js";import{t as n}from"./jsx-runtime-DX3WBWVO.js";import{n as r}from"./posts-EWpZIjkr.js";import{t as i}from"./analytics-53FOa2wq.js";import{r as a}from"./chunk-KS7C4IRE-DG9HTHQ3.js";import{t as o}from"./box-BWbhXh21.js";import{t as s}from"./container-BYz2Ed39.js";import{t as c}from"./use-analytics-data-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./react-Bb3IsNbi.js";import{t as n}from"./jsx-runtime-DX3WBWVO.js";import{n as r}from"./posts-EWpZIjkr.js";import{t as i}from"./analytics-53FOa2wq.js";import{r as a}from"./chunk-KS7C4IRE-DG9HTHQ3.js";import{t as o}from"./box-BWbhXh21.js";import{t as s}from"./container-BYz2Ed39.js";import{t as c}from"./use-analytics-data-Cds6XDjg.js";import{t as l}from"./post-share-modal-Dx-MEjhI.js";var u=e(t(),1),d=n(),f=({children:e})=>(0,d.jsx)(o,{className:`size-full`,children:(0,d.jsx)(s,{className:`relative flex h-full flex-col`,size:`page`,children:(0,d.jsx)(`div`,{className:`grid w-full grow`,children:(0,d.jsx)(`div`,{className:`flex h-full flex-col px-8`,children:e})})})}),p=()=>{let[e,t]=(0,u.useState)(!1),[n,i]=(0,u.useState)(null),[a,o]=(0,u.useState)(null),{site:s}=c(),{data:l}=r({searchParams:n?{filter:`id:${n.id}`,include:`authors,newsletter,email`}:{},enabled:!!n}),{data:d}=r({searchParams:{filter:`status:[published,sent]`,limit:`1`,fields:`id`},enabled:!!n}),f=l?.posts?.[0],p=e=>`${e.toLocaleString()} subscriber${e===1?``:`s`}`,m=e=>new Date(e).toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`,hour12:!1}),h=e=>e?.map(e=>e.name).join(`, `)||``,g=(0,u.useMemo)(()=>{if(!f)return null;let n=!!a,r=()=>{let e=[];if(f.email_only?e.push(`Your email was sent to`):f.email?.email_count?e.push(`Your post was published on your site and sent to`):e.push(`Your post was published on your site`),f.email?.email_count){let t=p(f.email.email_count);e.push(` `),e.push(u.createElement(`strong`,{key:`subscriber-count`},t)),f.newsletter?.name&&(e.push(` of `),e.push(u.createElement(`strong`,{key:`newsletter-name`},f.newsletter.name))),e.push(`,`)}if(f.published_at){let t=new Date(f.published_at);t.toDateString()===new Date().toDateString()?(e.push(` `),e.push(u.createElement(`strong`,{key:`today`},`today`))):(e.push(` on `),e.push(u.createElement(`strong`,{key:`date`},t.toLocaleDateString(`en-US`,{month:`long`,day:`numeric`})))),e.push(` at `),e.push(u.createElement(`strong`,{key:`time`},m(f.published_at)))}return e.push(`.`),u.createElement(`span`,{},...e)},c=()=>{t(!1),i(null),o(null)};return{open:e,onOpenChange:e=>{e||c()},emailOnly:f.email_only,postURL:f.url||``,primaryTitle:`Boom! It's out there.`,secondaryTitle:n&&a?`That's ${a.toLocaleString()} post${a===1?``:`s`} published.`:`Spread the word!`,description:r(),featureImageURL:f.feature_image||``,postTitle:f.title||``,postExcerpt:f.excerpt||``,faviconURL:s?.icon||``,siteTitle:s?.title||``,author:h(f.authors),onClose:c}},[f,e,a,s?.title]);return(0,u.useEffect)(()=>{let e=()=>{try{let e=localStorage.getItem(`ghost-last-published-post`);if(e){let n=JSON.parse(e);i(n),t(!0),localStorage.removeItem(`ghost-last-published-post`)}}catch{}};e();let n=setTimeout(e,100);return()=>clearTimeout(n)},[]),(0,u.useEffect)(()=>{d?.meta?.pagination?.total&&o(d.meta.pagination.total)},[d]),{isModalOpen:e,post:f,postCount:a,showPostCount:!!a,closeModal:()=>{t(!1),i(null),o(null)},modalProps:g}},m=()=>{let{isModalOpen:e,modalProps:t}=p(),n=e&&!!t;return(0,u.useEffect)(()=>{n&&i(`Share Modal Opened`,{giftLinkShown:!1,source:`publish-flow`})},[n]),(0,d.jsxs)(f,{children:[(0,d.jsx)(a,{}),e&&t&&(0,d.jsx)(l,{...t})]})};export{m as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./react-Bb3IsNbi.js";import{t as n}from"./jsx-runtime-DX3WBWVO.js";import{a as r,p as ee}from"./hooks-BApwwBE0.js";import{h as te,m as i,p as ne,v as re}from"./stats-BQZMGMvn.js";import{i as ie}from"./posts-EWpZIjkr.js";import{t as ae}from"./analytics-53FOa2wq.js";import{i as a,n as o,o as s,r as c}from"./post-helpers-C5OQMBoi.js";import{a as oe}from"./router-provider-C1R4AZ2o.js";import{c as l,f as se,l as u,u as d}from"./dist-DGzPJ_bO.js";import{a as ce,i as le,n as f,o as ue,r as de,t as fe}from"./breadcrumb-B-M9Ip_2.js";import{r as p}from"./users-CcSCQFcQ.js";import{$r as pe,Ds as me,Gi as he,Gr as ge,Jr as m,Ma as _e,No as h,Nr as g,Po as _,Rs as v,Yr as y,ar as b,cr as x,dr as S,ir as C,lr as w,or as T,qr as E,sr as D,ti as O,ua as k,ur as A}from"./index-ukW_0Uie.js";import{t as j}from"./use-analytics-data-Cds6XDjg.js";import{t as M}from"./post-share-modal-Dx-MEjhI.js";import{t as N}from"./get-site-timezone-HgL0jI_F.js";import{i as P,t as ve}from"./gift-link-modal-su8MsRdg.js";import{n as F}from"./post-analytics-context-D0Mw-Pmv.js";var I=e(t(),1),L=n(),R=(0,I.forwardRef)(({children:e,className:t,...n},r)=>(0,L.jsx)(`section`,{ref:r,className:l(`flex size-full grow flex-col gap-6 py-8`,t),...n,children:e}));R.displayName=`PostAnalyticsContent`;var z=e=>{let{data:t}=r();return!e||!t?!1:e.status===`published`&&!!e.visibility&&e.visibility!==`public`&&p(t)},B=({currentTab:e,children:t})=>{let n=oe(),{appSettings:r}=v(),{mutateAsync:l}=ie(),p=ee(),[R,B]=(0,I.useState)(!1),[V,H]=(0,I.useState)(!1),[ye,U]=(0,I.useState)(!1),{settings:be,site:W,statsConfig:xe}=j(),{post:G,isPostLoading:K,postId:q}=F(),J=z(G),Y=N(be),X=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(!V){X.current=!1;return}X.current||(X.current=!0,ae(`Share Modal Opened`,{giftLinkShown:J,source:`post-analytics`}))},[V,J]);let{activeVisitors:Z,isLoading:Q}=re({postUuid:G?.uuid,statsConfig:xe,enabled:r?.analytics?.webAnalytics??!1}),$=(0,I.useMemo)(()=>{if(!G)return[];let e=[];return a(G)&&!r?.analytics.webAnalytics||(e.push(`Overview`),!G.email_only&&r?.analytics.webAnalytics&&e.push(`Web`)),s(G)&&e.push(`Newsletter`),r?.analytics.membersTrackSources&&e.push(`Growth`),e},[G,r?.analytics.webAnalytics,r?.analytics.membersTrackSources]),Se=()=>{G&&B(!0)},Ce=async()=>{if(G)try{await l(q),B(!1),n(`/posts/`,{crossApp:!0})}catch(e){p(e)}};return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`header`,{className:`z-50 -mx-8 bg-white/70 backdrop-blur-md dark:bg-background`,children:(0,L.jsx)(`div`,{className:`relative flex min-h-[102px] w-full items-start justify-between gap-5 px-8 pt-8 pb-0`,"data-header":`header`,children:(0,L.jsxs)(`div`,{className:`flex w-full flex-col gap-6`,children:[(0,L.jsxs)(`div`,{className:`flex w-full flex-col justify-between md:flex-row md:items-center`,children:[(0,L.jsx)(fe,{children:(0,L.jsxs)(le,{children:[(0,L.jsx)(f,{children:(0,L.jsx)(de,{asChild:!0,children:(0,L.jsx)(`button`,{className:`cursor-pointer rounded-sm focus-visible:ring-1 focus-visible:ring-focus-ring focus-visible:outline-hidden`,type:`button`,onClick:()=>n(`/analytics/`,{crossApp:!0}),children:`Analytics`})})}),(0,L.jsx)(ue,{}),(0,L.jsx)(f,{children:(0,L.jsx)(ce,{children:`Post analytics`})})]})}),(0,L.jsxs)(`div`,{className:`flex w-full items-center gap-2 md:w-auto`,children:[r?.analytics.webAnalytics&&!G?.email_only&&(0,L.jsx)(`div`,{className:`mr-3 flex grow items-center gap-2 md:grow-0`,children:(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,title:`Active readers in the last 5 minutes · Updates every 60 seconds`,children:[(0,L.jsxs)(`span`,{children:[Q?``:se(Z),` reading now`]}),(0,L.jsx)(`div`,{className:`size-2 rounded-full ${Q?`animate-pulse bg-muted`:Z?`bg-green-500`:`border border-muted-foreground`}`})]})}),!K&&(0,L.jsxs)(L.Fragment,{children:[!G?.email_only&&(0,L.jsx)(M,{author:G?.authors?.[0]?.name||``,canShareAsGift:J,description:``,faviconURL:W?.icon||``,featureImageURL:G?.feature_image,giftAccessLabel:P(G?.visibility),open:V,postExcerpt:G?.excerpt||``,postTitle:G?.title,postURL:G?.url,siteTitle:W?.title||``,onClose:()=>H(!1),onOpenChange:H,onShareAsGift:()=>{H(!1),U(!0)},children:(0,L.jsxs)(g,{variant:`outline`,onClick:()=>H(!0),children:[(0,L.jsx)(k,{}),` Share`]})}),(0,L.jsxs)(ge,{children:[(0,L.jsx)(O,{asChild:!0,children:(0,L.jsx)(g,{variant:`outline`,children:(0,L.jsx)(_,{})})}),(0,L.jsxs)(E,{align:`end`,children:[(0,L.jsxs)(m,{children:[(0,L.jsx)(y,{asChild:!0,children:(0,L.jsxs)(`a`,{href:G?.url,rel:`noopener noreferrer`,target:`_blank`,children:[(0,L.jsx)(h,{}),`View in browser`]})}),(0,L.jsxs)(y,{onClick:()=>{n(`/editor/post/${q}`,{crossApp:!0})},children:[(0,L.jsx)(_e,{}),`Edit post`]})]}),(0,L.jsx)(pe,{}),(0,L.jsx)(m,{children:(0,L.jsxs)(y,{className:`text-destructive focus:text-destructive`,onClick:Se,children:[(0,L.jsx)(he,{}),`Delete post`]})})]})]})]})]})]}),!K&&(0,L.jsxs)(`div`,{className:`flex items-start gap-6 md:items-center`,children:[G?.feature_image&&(0,L.jsx)(`div`,{className:`aspect-[16/10] w-full max-w-[100px] rounded-md bg-cover bg-center md:max-w-[132px]`,style:{backgroundImage:`url(${G.feature_image})`}}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(me,{className:`-ml-px max-w-[920px] indent-0 !text-xl md:leading-[1.2em]`,"data-header":`header-title`,children:G?.title}),G?.published_at&&(0,L.jsxs)(`div`,{className:`mt-0.5 flex items-center justify-start leading-[1.65em] text-muted-foreground`,children:[o(G)&&`Sent on ${u(G.published_at,Y)} at ${d(G.published_at,Y)}`,a(G)&&`Published on your site on ${u(G.published_at,Y)} at ${d(G.published_at,Y)}`,c(G)&&`Published and sent on ${u(G.published_at,Y)} at ${d(G.published_at,Y)}`]})]})]})]})})}),(0,L.jsxs)(te,{className:`sticky top-0 z-50 -mb-8 transform-gpu flex-col items-start gap-y-0 border-none bg-white/70 py-8 backdrop-blur-md lg:flex-row lg:items-center dark:bg-background`,children:[!K&&(0,L.jsxs)(ne,{className:`min-h-[34px]`,defaultValue:e,responsive:!0,children:[$.includes(`Overview`)&&(0,L.jsx)(i,{value:`Overview`,onClick:()=>{n(`/posts/analytics/${q}`)},children:`Overview`}),$.includes(`Web`)&&(0,L.jsx)(i,{value:`Web`,onClick:()=>{n(`/posts/analytics/${q}/web`)},children:`Web traffic`}),$.includes(`Newsletter`)&&(0,L.jsx)(i,{value:`Newsletter`,onClick:()=>{n(`/posts/analytics/${q}/newsletter`)},children:`Newsletter`}),$.includes(`Growth`)&&(0,L.jsx)(i,{value:`Growth`,onClick:()=>{n(`/posts/analytics/${q}/growth`)},children:`Growth`})]}),t]}),J&&q&&(0,L.jsx)(ve,{open:ye,postId:q,source:`share-modal`,onOpenChange:U},q),(0,L.jsx)(C,{open:R,onOpenChange:B,children:(0,L.jsxs)(D,{children:[(0,L.jsxs)(A,{children:[(0,L.jsx)(S,{children:`Are you sure you want to delete this post?`}),(0,L.jsxs)(x,{children:[`You're about to delete "`,(0,L.jsx)(`strong`,{children:G?.title}),`". This is permanent! We warned you, k?`]})]}),(0,L.jsxs)(w,{children:[(0,L.jsx)(T,{children:`Cancel`}),(0,L.jsx)(b,{className:`bg-red-600 text-white hover:bg-red-700`,onClick:()=>void Ce(),children:`Delete`})]})]})})]})};export{z as n,R as r,B as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./react-Bb3IsNbi.js";import{t as n}from"./jsx-runtime-DX3WBWVO.js";import{n as r}from"./posts-EWpZIjkr.js";import{m as i}from"./chunk-KS7C4IRE-DG9HTHQ3.js";import{c as a}from"./index-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./react-Bb3IsNbi.js";import{t as n}from"./jsx-runtime-DX3WBWVO.js";import{n as r}from"./posts-EWpZIjkr.js";import{m as i}from"./chunk-KS7C4IRE-DG9HTHQ3.js";import{c as a}from"./index-ukW_0Uie.js";import{t as o}from"./constants-c-JNF9c2.js";import{t as s}from"./post-analytics-context-D0Mw-Pmv.js";var c=e(t(),1),l=n(),u=({children:e})=>{let{postId:t}=i();if(!t)throw Error(`Post ID is required for PostAnalyticsProvider`);let[n,u]=(0,c.useState)(a.last30Days.value),{data:{posts:[d]}={posts:[]},isLoading:f}=r({searchParams:{filter:`id:${t}`,include:o}});return(0,l.jsx)(s.Provider,{value:{postId:t,post:d,isPostLoading:f,range:n,setRange:u},children:e})};export{u as default};
|
package/core/built/admin/assets/{post-share-modal-DBfKl2GZ.js → post-share-modal-Dx-MEjhI.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-DAXXjFlN.js";import{t as e}from"./react-Bb3IsNbi.js";import{t}from"./jsx-runtime-DX3WBWVO.js";import{
|
|
1
|
+
import"./rolldown-runtime-DAXXjFlN.js";import{t as e}from"./react-Bb3IsNbi.js";import{t}from"./jsx-runtime-DX3WBWVO.js";import{Nr as n,ks as r}from"./index-ukW_0Uie.js";import{t as i}from"./share-modal-BJCadJyp.js";e();var a=t(),o=({author:e=``,canShareAsGift:t=!1,children:o,description:s=``,emailOnly:c=!1,faviconURL:l=``,featureImageURL:u=``,giftAccessLabel:d=``,onClose:f=()=>{},onShareAsGift:p=()=>{},postExcerpt:m=``,postTitle:h=``,postURL:g=``,primaryTitle:_=`Your post is published.`,secondaryTitle:v=`Spread the word!`,siteTitle:y=``,...b})=>{let x=encodeURIComponent(h),S=encodeURIComponent(g),C=encodeURIComponent(`${h} ${g}`),w=c?[]:[{href:`https://twitter.com/intent/tweet?text=${x}%0A${S}`,label:`Share on X`,service:`x`},{href:`https://threads.net/intent/post?text=${C}`,label:`Share on Threads`,service:`threads`},{href:`https://www.facebook.com/sharer/sharer.php?u=${S}`,label:`Share on Facebook`,service:`facebook`},{href:`https://www.linkedin.com/shareArticle?mini=true&title=${x}&url=${S}`,label:`Share on LinkedIn`,service:`linkedin`}];return(0,a.jsxs)(i.Root,{...b,children:[o&&(0,a.jsx)(i.Trigger,{children:o}),(0,a.jsxs)(i.Content,{children:[(0,a.jsx)(`div`,{className:`sticky top-0 ml-auto size-0`,children:(0,a.jsx)(i.CloseButton,{className:`absolute -top-5 -right-5`,onClick:f})}),(0,a.jsxs)(i.Header,{className:`relative -mt-5`,children:[(0,a.jsxs)(i.Title,{className:`text-3xl leading-[1.15em] font-bold`,children:[_&&(0,a.jsx)(`span`,{className:`text-state-success`,children:_}),_&&v&&(0,a.jsx)(`br`,{}),v&&(0,a.jsx)(`span`,{children:v})]}),s&&(0,a.jsx)(i.Description,{className:`mb-0 pt-1 pb-0 text-lg text-foreground`,children:s})]}),(0,a.jsxs)(i.Preview,{className:`rounded-md`,href:g,children:[u&&(0,a.jsx)(`div`,{className:`aspect-video bg-cover bg-center`,style:{backgroundImage:`url(${u})`}}),(0,a.jsxs)(`div`,{className:`p-6 pt-5`,children:[(0,a.jsx)(r,{children:h}),m&&(0,a.jsx)(`p`,{className:`line-clamp-2`,children:m}),(0,a.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,children:[(0,a.jsx)(`div`,{className:`mt-0.5 size-4 bg-cover bg-center`,style:{backgroundImage:`url(${l})`}}),(0,a.jsxs)(`div`,{className:`flex gap-1`,children:[(0,a.jsx)(`strong`,{children:y}),(0,a.jsx)(`span`,{children:`•`}),(0,a.jsx)(`span`,{children:e})]})]})]})]}),(0,a.jsx)(i.Footer,{children:c?(0,a.jsx)(n,{className:`cursor-pointer`,type:`button`,onClick:f,children:`Close`}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.SocialLinks,{links:w}),(0,a.jsx)(i.CopyButton,{className:`ml-0! grow cursor-pointer`,copyURL:g,icon:`link`})]})}),t&&!c&&(0,a.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[`Want to share full access to this `,d,` post?`,` `,(0,a.jsx)(n,{className:`h-auto p-0 align-baseline text-sm`,type:`button`,variant:`link`,onClick:p,children:`Share as a gift`}),`.`]})]})]})};export{o as t};
|