ghost 6.68.0 → 6.69.0
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.1.tgz +0 -0
- package/components/tryghost-adapter-base-cache-0.2.1.tgz +0 -0
- package/components/tryghost-adapter-base-scheduling-0.2.5.tgz +0 -0
- package/components/tryghost-adapter-base-sso-0.1.4.tgz +0 -0
- package/components/tryghost-app-contracts-0.0.0.tgz +0 -0
- package/components/tryghost-checkout-0.0.0.tgz +0 -0
- package/components/tryghost-i18n-0.0.0.tgz +0 -0
- package/components/tryghost-kg-card-factory-5.2.6.tgz +0 -0
- package/components/tryghost-kg-clean-basic-html-4.3.6.tgz +0 -0
- package/components/tryghost-kg-converters-1.2.6.tgz +0 -0
- package/components/tryghost-kg-default-cards-10.3.7.tgz +0 -0
- package/components/tryghost-kg-default-nodes-2.2.3.tgz +0 -0
- package/components/tryghost-kg-default-transforms-1.3.6.tgz +0 -0
- package/components/tryghost-kg-html-to-lexical-1.4.1.tgz +0 -0
- package/components/tryghost-kg-lexical-html-renderer-1.5.1.tgz +0 -0
- package/components/tryghost-kg-markdown-html-renderer-7.2.7.tgz +0 -0
- package/components/tryghost-kg-utils-1.1.6.tgz +0 -0
- package/components/tryghost-metafield-csv-0.0.0.tgz +0 -0
- package/components/tryghost-metafield-types-0.1.1.tgz +0 -0
- package/core/boot.js +6 -0
- package/core/built/admin/assets/{about-D_nwtf7X.js → about-Dxp30cNg.js} +1 -1
- package/core/built/admin/assets/{account-migration-BaecWw1T.js → account-migration-D05akW4q.js} +1 -1
- package/core/built/admin/assets/activitypub/{account-migration-4saTEZ6p.js → account-migration-BmiwuzXI.js} +6 -6
- package/core/built/admin/assets/activitypub/activitypub.js +2 -2
- package/core/built/admin/assets/activitypub/{bluesky-sharing-BHBNuZQH.js → bluesky-sharing-B1fzMdFb.js} +6 -6
- package/core/built/admin/assets/activitypub/{content-formatters-DVx9YktY.js → content-formatters-G0qBT5QE.js} +3 -3
- package/core/built/admin/assets/activitypub/{domain-rAmlMXBC.js → domain-B3UtdA1m.js} +7 -7
- package/core/built/admin/assets/activitypub/{edit-profile-CXYL4ZrS.js → edit-profile-9EodzviR.js} +4 -4
- package/core/built/admin/assets/activitypub/{explore-dqpEx3GA.js → explore-DmwPdxHI.js} +8 -8
- package/core/built/admin/assets/activitypub/{feed-Cb-wYNw9.js → feed-yauqnu7A.js} +5 -5
- package/core/built/admin/assets/activitypub/{field-JxegcPt6.js → field-CsrMjbg2.js} +2 -2
- package/core/built/admin/assets/activitypub/{inbox-2hXDJBn5.js → inbox-DV3RrpFH.js} +7 -7
- package/core/built/admin/assets/activitypub/{label-DRQzZ7lb.js → label-DPs40NLn.js} +2 -2
- package/core/built/admin/assets/activitypub/layout-CvOhndCA.js +1 -0
- package/core/built/admin/assets/activitypub/{moderation-BnYKcTXY.js → moderation-DGa6hVNH.js} +7 -7
- package/core/built/admin/assets/activitypub/{note-C6ucS3Wu.js → note-BVL6LVHF.js} +5 -5
- package/core/built/admin/assets/activitypub/{notifications-DgBW9wEC.js → notifications-CRUu_uMC.js} +5 -5
- package/core/built/admin/assets/activitypub/{onboarding-DGu6yG4L.js → onboarding-Dpm-nLkQ.js} +2 -2
- package/core/built/admin/assets/activitypub/{onboarding-Bq3fNf_a.js → onboarding-KtpJA-xb.js} +2 -2
- package/core/built/admin/assets/activitypub/{preferences-C3jI1eVN.js → preferences-CdFuVqIt.js} +7 -7
- package/core/built/admin/assets/activitypub/{profile-Cn3vRb5Z.js → profile-KnNAoHYu.js} +8 -8
- package/core/built/admin/assets/activitypub/{routes-DbrwlS9h.js → routes-BRndai50.js} +26 -26
- package/core/built/admin/assets/activitypub/{settings-D0BALDQu.js → settings-DU7ftJ8w.js} +4 -4
- package/core/built/admin/assets/activitypub/{site-BFGj8HuQ.js → site-D1ZYV3AT.js} +2 -2
- package/core/built/admin/assets/activitypub/{step-1-CaoPg0a5.js → step-1-9IHheE78.js} +4 -4
- package/core/built/admin/assets/activitypub/{step-3-5k0TkyC9.js → step-3-DBERnfa-.js} +3 -3
- package/core/built/admin/assets/activitypub/{tabs-BV4JU7Vg.js → tabs-CvkwStij.js} +4 -4
- package/core/built/admin/assets/activitypub/{topic-filter-71sX5nfN.js → topic-filter-CS0Jsf_4.js} +2 -2
- package/core/built/admin/assets/activitypub/{use-activity-pub-queries-B3srUuKt.js → use-activity-pub-queries-CGgtQrxL.js} +2 -2
- package/core/built/admin/assets/activitypub/{use-reply-chain-data-Cl6bGNy7.js → use-reply-chain-data-CLdUpx1t.js} +4 -4
- package/core/built/admin/assets/activitypub/{users-EcSPpds5.js → users-CyoMXlwX.js} +11 -3
- package/core/built/admin/assets/{add-integration-modal-DBFzeAUT.js → add-integration-modal-BVg-ec8i.js} +1 -1
- package/core/built/admin/assets/{add-newsletter-modal-CYJe-dTC.js → add-newsletter-modal-Du6th521.js} +1 -1
- package/core/built/admin/assets/{add-recommendation-modal-CgwGKH-_.js → add-recommendation-modal-BiCJ0-q5.js} +1 -1
- package/core/built/admin/assets/{analytics-CcXT_WqF.js → analytics-CQJzDDdJ.js} +1 -1
- package/core/built/admin/assets/{announcement-bar-modal-Ldcg-PB-.js → announcement-bar-modal-CskyZLzT.js} +1 -1
- package/core/built/admin/assets/{api-BLteQZ7W.js → api-BFocMbDg.js} +2 -2
- package/core/built/admin/assets/{api-keys-CoeerpwI.js → api-keys-CqKJHuAV.js} +1 -1
- package/core/built/admin/assets/{audience-Deg9lzfk.js → audience-Dn7LuH-r.js} +1 -1
- package/core/built/admin/assets/{auth-layout-CRaMX7g6.js → auth-layout-VLhXgXn5.js} +1 -1
- package/core/built/admin/assets/{automated-emails-WcjjRkRV.js → automated-emails-D5cFl1wr.js} +1 -1
- package/core/built/admin/assets/{automations-CbIdX0rd.js → automations-BpweKEcq.js} +1 -1
- package/core/built/admin/assets/automations-DBTYwNTJ.js +1 -0
- package/core/built/admin/assets/{bluesky-sharing-BJMNRwnU.js → bluesky-sharing-CrfpFHQ9.js} +1 -1
- package/core/built/admin/assets/{chart-helpers-D-3N170i.js → chart-helpers-BSuFLd6-.js} +1 -1
- package/core/built/admin/assets/{chunk.524.94ab17e1199b4c3f4615.js → chunk.524.e24d68bc6253b274b726.js} +4 -4
- package/core/built/admin/assets/{chunk.582.6f09b19a007e2805824e.js → chunk.582.47834285406dfa1abb29.js} +6 -6
- package/core/built/admin/assets/{chunk.476.53b5794a67d68111e0bf.js → chunk.837.e1454abc054e1fba1fe5.js} +5 -5
- package/core/built/admin/assets/{code-editor-view-DhTwpxxv.js → code-editor-view-BrGe3eS4.js} +1 -1
- package/core/built/admin/assets/{code-editor-view-C7wXGiuv.js → code-editor-view-CY6JCXNv.js} +1 -1
- package/core/built/admin/assets/{color-picker-field-Cjz2zY11.js → color-picker-field-DGe9HH6W.js} +1 -1
- package/core/built/admin/assets/{comments-DY-VLVxh.js → comments-iRbF6XiJ.js} +1 -1
- package/core/built/admin/assets/{config-B3HuCo0y.js → config-CRAZ4Civ.js} +1 -1
- package/core/built/admin/assets/{content-api-modal-2jt-jWiM.js → content-api-modal-B-XRbzeW.js} +1 -1
- package/core/built/admin/assets/{content-formatters-VqvNA7Pv.js → content-formatters-C08JJbUJ.js} +2 -2
- package/core/built/admin/assets/{context-menu-BWbk9nd5.js → context-menu-BxGXsgQO.js} +1 -1
- package/core/built/admin/assets/{custom-field-type-option-CIatEwIN.js → custom-field-type-option-C8Nt4X6x.js} +1 -1
- package/core/built/admin/assets/{custom-integration-modal-Cw0w2Tb3.js → custom-integration-modal-DzI16qjN.js} +1 -1
- package/core/built/admin/assets/{date-range-select-O-uA-BRV.js → date-range-select-BZqsYsGx.js} +1 -1
- package/core/built/admin/assets/{design-and-theme-modal-BLjNHRYN.js → design-and-theme-modal-1ty_KEkM.js} +2 -2
- package/core/built/admin/assets/{dist-DJhCsld6.js → dist-B4jqKAG5.js} +1 -1
- package/core/built/admin/assets/{dist-5Ol0DC_t.js → dist-Bmo2j_KH.js} +1 -1
- package/core/built/admin/assets/{dist-p52UDdoR.js → dist-C-_aTlvJ.js} +1 -1
- package/core/built/admin/assets/{dist-CcN1a5SB.js → dist-CWHIoxYn.js} +1 -1
- package/core/built/admin/assets/{dist-BcfsaiCV.js → dist-Cp2M5TzT.js} +1 -1
- package/core/built/admin/assets/{dist-kjTYGivb.js → dist-DQAAPbtg.js} +1 -1
- package/core/built/admin/assets/{dist-IMek6Acg.js → dist-DyO279y5.js} +1 -1
- package/core/built/admin/assets/{domain-DaPAeOFF.js → domain-DiFl_Z1A.js} +1 -1
- package/core/built/admin/assets/{edit-profile-BKO5qonH.js → edit-profile-PrLbJV3P.js} +1 -1
- package/core/built/admin/assets/editor-BBJDJL8U.js +8 -0
- package/core/built/admin/assets/{editor-screen-l4BUPE2o.js → editor-screen-nblrp808.js} +3 -3
- package/core/built/admin/assets/{email-previews-B1Ska3CF.js → email-previews-BKJxrW29.js} +1 -1
- package/core/built/admin/assets/{email-sending-status-provider-Bjn5KTy2.js → email-sending-status-provider-DB9ylBWk.js} +1 -1
- package/core/built/admin/assets/{emails-qxNbhO6X.js → emails-8YiSmC2X.js} +1 -1
- package/core/built/admin/assets/{embed-signup-form-modal-DSgds6Js.js → embed-signup-form-modal-CZmbYKfd.js} +1 -1
- package/core/built/admin/assets/{error-boundary-CJODV8Rg.js → error-boundary-DrxPFFO-.js} +1 -1
- package/core/built/admin/assets/{esm-CNLDtBMc.js → esm-_iCUCvbN.js} +1 -1
- package/core/built/admin/assets/{explore-C6V_JpUZ.js → explore-C69LSRVg.js} +1 -1
- package/core/built/admin/assets/{feed-B_TyFn9E.js → feed-B_0m7WhZ.js} +1 -1
- package/core/built/admin/assets/{feedback-gKOzmiGt.js → feedback-DW1DXdzT.js} +1 -1
- package/core/built/admin/assets/{filters-Bf6E1qAP.js → filters-Dr3vMnjZ.js} +1 -1
- package/core/built/admin/assets/{filters-DhsiEotO.js → filters-M2sRWPoF.js} +1 -1
- package/core/built/admin/assets/{first-promoter-modal-LmTXHr-z.js → first-promoter-modal-D43R2zhI.js} +1 -1
- package/core/built/admin/assets/{focus-koenig-editor-on-bottom-click-BAcLNJti.js → focus-koenig-editor-on-bottom-click-BzS8jiJf.js} +1 -1
- package/core/built/admin/assets/fullscreen-close-button-CWSp-MsK.js +1 -0
- package/core/built/admin/assets/{ghost-63bc7da4336844000c523a5a0819531e.js → ghost-ffde29676517b768b1aef5ec8d492418.js} +93 -96
- package/core/built/admin/assets/{gift-link-modal-uZtwRHzl.js → gift-link-modal-CNE7dfPD.js} +1 -1
- package/core/built/admin/assets/{gift-links-HVqaXear.js → gift-links-lQ7H_D8Z.js} +1 -1
- package/core/built/admin/assets/global-search-modal-DzRM3aON.js +1 -0
- package/core/built/admin/assets/{growth-BlPW4DHj.js → growth-CAi_5HIf.js} +1 -1
- package/core/built/admin/assets/{growth-CflU3vR0.js → growth-CMHbTWKE.js} +1 -1
- package/core/built/admin/assets/history-modal-BIz13vhr.js +1 -0
- package/core/built/admin/assets/{hooks-C-BDQ6Hs.js → hooks-0r7qxGEo.js} +2 -2
- package/core/built/admin/assets/{html-field-D6G0G1d_.js → html-field-vTe2q1be.js} +1 -1
- package/core/built/admin/assets/{iframe-buffering-DW-Axhvc.js → iframe-buffering-cu-yK7NA.js} +1 -1
- package/core/built/admin/assets/{images-BSUWxquu.js → images-DTZtaIAr.js} +1 -1
- package/core/built/admin/assets/{inbox-BkU3sg13.js → inbox-BHfpmmzn.js} +1 -1
- package/core/built/admin/assets/{index-z8-nEVdb.css → index-B02LJqc8.css} +1 -1
- package/core/built/admin/assets/{index-CuDhPtkB.js → index-RuRs_qGS.js} +3 -3
- package/core/built/admin/assets/{index.es-H6HOI4DG.js → index.es-rdb1skp_.js} +1 -1
- package/core/built/admin/assets/{integrations-BRo5DwA5.js → integrations-Deg9-u8X.js} +1 -1
- package/core/built/admin/assets/{invite-user-modal-CydBOG99.js → invite-user-modal-C4DeNcoO.js} +1 -1
- package/core/built/admin/assets/koenig-lexical/koenig-lexical.js +10483 -10455
- package/core/built/admin/assets/koenig-lexical/koenig-lexical.umd.js +131 -131
- package/core/built/admin/assets/{koenig-lexical-CG_eb4dw.js → koenig-lexical-BhXu1__-.js} +96 -96
- package/core/built/admin/assets/{kpi-helpers-CyRx_yD6.js → kpi-helpers-H-Hl6h7h.js} +1 -1
- package/core/built/admin/assets/{kpi-tabs-V1_Nu9sh.js → kpi-tabs-k4A9-imn.js} +1 -1
- package/core/built/admin/assets/{label-picker-GTIIlBQ6.js → label-picker-DaivLdMw.js} +1 -1
- package/core/built/admin/assets/{labels-BVGLgdAj.js → labels-BCj6D_nl.js} +1 -1
- package/core/built/admin/assets/{layout-CG58T6P7.js → layout-_g2xhB0L.js} +1 -1
- package/core/built/admin/assets/{lib-Dkic19kH.js → lib-Bre6UXdJ.js} +2 -2
- package/core/built/admin/assets/{links-jD8AkkIu.js → links-C8RnEJVJ.js} +1 -1
- package/core/built/admin/assets/{member-activity-JggQ0VNQ.js → member-activity-DNJPUW5X.js} +1 -1
- package/core/built/admin/assets/{member-activity-feed-BBeCZmLM.js → member-activity-feed-CvKEetHS.js} +1 -1
- package/core/built/admin/assets/{member-custom-fields-DPsyP1Hq.js → member-custom-fields-CBdiwPD9.js} +1 -1
- package/core/built/admin/assets/{member-detail-D7qugPN7.js → member-detail-BIoyIIsl.js} +1 -1
- package/core/built/admin/assets/{members-Cj_BUZUL.js → members-CH6KeXQc.js} +1 -1
- package/core/built/admin/assets/{members-alDWPKDd.js → members-Dd9RczFK.js} +1 -1
- package/core/built/admin/assets/{migrate-2uKKakld.js → migrate-CVQIWsXO.js} +1 -1
- package/core/built/admin/assets/{moderation-pCUKsxbF.js → moderation-OtjZoNOc.js} +1 -1
- package/core/built/admin/assets/{navigation-modal-D0FBI5-m.js → navigation-modal-Bl02NjtO.js} +1 -1
- package/core/built/admin/assets/{newsletter-4urgCSR_.js → newsletter-BXyT7o69.js} +1 -1
- package/core/built/admin/assets/{newsletter-detail-modal-Chh1jvjH.js → newsletter-detail-modal-DxuKNu_1.js} +1 -1
- package/core/built/admin/assets/{newsletter-emails-CzVCiC2K.js → newsletter-emails-DicgmnMU.js} +1 -1
- package/core/built/admin/assets/{newsletters-eRQTtOBH.js → newsletters-By25FmUs.js} +1 -1
- package/core/built/admin/assets/{newsletters-BMEgeL2l.js → newsletters-CACa0VCx.js} +1 -1
- package/core/built/admin/assets/{note-dqog4Bua.js → note-CF4LrSmR.js} +1 -1
- package/core/built/admin/assets/{notifications-rcEVv-gx.js → notifications-BmHJmqIJ.js} +1 -1
- package/core/built/admin/assets/{offers-hV7zBtsI.js → offers-Df9Jzay5.js} +1 -1
- package/core/built/admin/assets/{offers-container-modal-DgZgkMsA.js → offers-container-modal-R0HRwugm.js} +1 -1
- package/core/built/admin/assets/{onboarding-4TxbZb90.js → onboarding-Bpo1yTzA.js} +1 -1
- package/core/built/admin/assets/{onboarding-SGscZLIc.js → onboarding-bMq3R8jB.js} +1 -1
- package/core/built/admin/assets/{onboarding-route-B3mN9l7E.js → onboarding-route-flf5YWti.js} +1 -1
- package/core/built/admin/assets/{overview-D4EanvDG.js → overview-C9WvmmOC.js} +1 -1
- package/core/built/admin/assets/{overview-CCwbHet8.js → overview-CDkHdIJM.js} +1 -1
- package/core/built/admin/assets/{page-header-Baymg6VR.js → page-header-CxTb0je5.js} +1 -1
- package/core/built/admin/assets/{pagemenu--UL0gW1x.js → pagemenu-DXr_U43J.js} +1 -1
- package/core/built/admin/assets/{pages-Cbq1M2kG.js → pages-Bm-zFXyP.js} +1 -1
- package/core/built/admin/assets/pages-route-LCw94aIO.js +1 -0
- package/core/built/admin/assets/{pintura-modal-D6HGlnJa.js → pintura-modal-B5sIPWcj.js} +1 -1
- package/core/built/admin/assets/{portal-modal-Bhqsevn_.js → portal-modal-DjOO3Unv.js} +1 -1
- package/core/built/admin/assets/{post-analytics-header-DX9fETdi.js → post-analytics-header-D2anehCj.js} +1 -1
- package/core/built/admin/assets/{post-analytics-provider-U7RtOle1.js → post-analytics-provider-BLQvV5C0.js} +1 -1
- package/core/built/admin/assets/{post-analytics-BJWDtC3a.js → post-analytics-wdu9gq8u.js} +1 -1
- package/core/built/admin/assets/{post-debug-D1b8Amju.js → post-debug-BnABXMfD.js} +1 -1
- package/core/built/admin/assets/{posts-Lg-p_ZHg.js → posts-CftunZgV.js} +1 -1
- package/core/built/admin/assets/{posts-list-screen-CmsW18e_.js → posts-list-screen-CwXmvY68.js} +2 -2
- package/core/built/admin/assets/posts-route-J74fMhCe.js +1 -0
- package/core/built/admin/assets/{preferences-CMlDfHfa.js → preferences-DFhf_pJF.js} +1 -1
- package/core/built/admin/assets/{preview-modal-D8om_cQv.js → preview-modal-BrZza3R_.js} +1 -1
- package/core/built/admin/assets/{profile-yFsIoZom.js → profile-CS4fP60N.js} +1 -1
- package/core/built/admin/assets/{radio-group-DwgLjwWB.js → radio-group-Xfp-frJz.js} +1 -1
- package/core/built/admin/assets/{referrers-DzP5QoXL.js → referrers-C8LJlrBm.js} +1 -1
- package/core/built/admin/assets/{reload-CZ-KP3IQ.js → reload-D0fnKoCm.js} +1 -1
- package/core/built/admin/assets/{reset-CCAa8v35.js → reset-CB-ATcLE.js} +1 -1
- package/core/built/admin/assets/{restore-screen-Ba0i2Y1K.js → restore-screen-EaZf4V8j.js} +1 -1
- package/core/built/admin/assets/{routes-DrnhmKTT.js → routes-DKfpFMfF.js} +2 -2
- package/core/built/admin/assets/search-index-sM3OjEUl.js +1 -0
- package/core/built/admin/assets/settings-BWzod-5X.js +4 -0
- package/core/built/admin/assets/{settings-lqWkfSmT.js → settings-DvgngbFt.js} +1 -1
- package/core/built/admin/assets/{setup-BopRPuaM.js → setup-CdHAchG5.js} +1 -1
- package/core/built/admin/assets/{signin-e8NgsU9M.js → signin-CUEEme88.js} +1 -1
- package/core/built/admin/assets/{signin-verify-CHkFJevb.js → signin-verify-CYRphSrj.js} +1 -1
- package/core/built/admin/assets/{signout-DRvQZuWa.js → signout-kLCJau9G.js} +1 -1
- package/core/built/admin/assets/{signup-DQHi7jZz.js → signup-J2Vjq7Gt.js} +1 -1
- package/core/built/admin/assets/{slack-modal-BuGESzgn.js → slack-modal-DKamr_94.js} +1 -1
- package/core/built/admin/assets/source-icon-DqBCPDIK.js +1 -0
- package/core/built/admin/assets/{stats-CHOikfoP.js → stats-BL_FJ7Ns.js} +1 -1
- package/core/built/admin/assets/{stats-view-DQZzKeEz.js → stats-view-BwbdkdOQ.js} +1 -1
- package/core/built/admin/assets/{step-1-C8XwHcKt.js → step-1-CLYhNmG9.js} +1 -1
- package/core/built/admin/assets/{step-2-BXaXAdwY.js → step-2-B2ujMlpa.js} +1 -1
- package/core/built/admin/assets/{step-3-DytbqpJi.js → step-3-DoaTWqqj.js} +1 -1
- package/core/built/admin/assets/{stripe-connect-modal-BhudjSeO.js → stripe-connect-modal-DytxH9DJ.js} +1 -1
- package/core/built/admin/assets/{tabs-CDb_TceL.js → tabs-fHs3A8WC.js} +1 -1
- package/core/built/admin/assets/{tag-detail-V72Zlro8.js → tag-detail-BcO46Ids.js} +2 -2
- package/core/built/admin/assets/{tag-picker-M3fC-yOF.js → tag-picker-Ct6NeqWK.js} +1 -1
- package/core/built/admin/assets/{tags-CXqE2A2T.js → tags-C1h3wCpW.js} +1 -1
- package/core/built/admin/assets/{tags-ZhqbPPc6.js → tags-OlmRJ6Ps.js} +1 -1
- package/core/built/admin/assets/{testimonials-modal-Cn8gvIFA.js → testimonials-modal-DMsQzSCB.js} +1 -1
- package/core/built/admin/assets/{themes-pOHHvnkt.js → themes-CPJSMo_W.js} +1 -1
- package/core/built/admin/assets/{tier-detail-modal-CeDla1OO.js → tier-detail-modal-DssSmhkF.js} +1 -1
- package/core/built/admin/assets/{tiers-D7aGzwZ-.js → tiers-DlvS8D6_.js} +1 -1
- package/core/built/admin/assets/{toggle-group-D7ly9OGa.js → toggle-group-BFWCtH3p.js} +1 -1
- package/core/built/admin/assets/{topic-filter-DQ3pr6AB.js → topic-filter-DAJ-DFPb.js} +1 -1
- package/core/built/admin/assets/{transistor-modal-4_Yx2vRo.js → transistor-modal-CtyFRsD0.js} +1 -1
- package/core/built/admin/assets/{unsplash-modal-Dm7R4k4k.js → unsplash-modal-DHnnTPmZ.js} +1 -1
- package/core/built/admin/assets/{use-activity-pub-queries-Gy9_locM.js → use-activity-pub-queries-BgR1USeY.js} +1 -1
- package/core/built/admin/assets/{use-analytics-data-oJ2o0pSS.js → use-analytics-data-Byf83QE-.js} +1 -1
- package/core/built/admin/assets/{use-availability-BqL7Dvn_.js → use-availability-CgZC6L_V.js} +1 -1
- package/core/built/admin/assets/{use-check-theme-limit-error-CxC9uKJz.js → use-check-theme-limit-error-DjprzKAN.js} +1 -1
- package/core/built/admin/assets/use-definitions-CJuXLSob.js +1 -0
- package/core/built/admin/assets/{use-email-sending-status-BFAg5TIb.js → use-email-sending-status-7kopNcza.js} +1 -1
- package/core/built/admin/assets/{use-filter-params-BOo9yZ5j.js → use-filter-params-DQ7uX-Zp.js} +1 -1
- package/core/built/admin/assets/{use-filterable-api-BnNLaS_r.js → use-filterable-api-CDrrxoGD.js} +1 -1
- package/core/built/admin/assets/{use-growth-stats-BS62uyyn.js → use-growth-stats-CCpnBgqS.js} +1 -1
- package/core/built/admin/assets/{use-host-limits-CNh4AAEs.js → use-host-limits-BZx7rzRI.js} +1 -1
- package/core/built/admin/assets/{use-limiter-DPKxoO1_.js → use-limiter-gF219BEg.js} +1 -1
- package/core/built/admin/assets/{use-pintura-config-CyVO62ZV.js → use-pintura-config-D-pmGkn2.js} +1 -1
- package/core/built/admin/assets/{use-pintura-editor-B5VBPbiO.js → use-pintura-editor-D_4zhlGE.js} +1 -1
- package/core/built/admin/assets/{use-post-referrers-nUPolSk7.js → use-post-referrers-Bc8eq4uy.js} +1 -1
- package/core/built/admin/assets/{use-post-top-links-DCH4eO11.js → use-post-top-links-DjltnQuI.js} +1 -1
- package/core/built/admin/assets/{use-reply-chain-data-UMzFbDvh.js → use-reply-chain-data-BiV3Cl0B.js} +1 -1
- package/core/built/admin/assets/use-sending-eta-gE-2B0Zw.js +1 -0
- package/core/built/admin/assets/{use-setting-group-Bf3vY8br.js → use-setting-group-YP84CqrJ.js} +1 -1
- package/core/built/admin/assets/{use-staff-users-CcQzTHqH.js → use-staff-users-CnwfdSx1.js} +1 -1
- package/core/built/admin/assets/{use-tinybird-query-CPy5ipAP.js → use-tinybird-query-BYbl5gKY.js} +1 -1
- package/core/built/admin/assets/{use-tinybird-token-DVNHuhu_.js → use-tinybird-token-Dz37zvb7.js} +1 -1
- package/core/built/admin/assets/{use-unsaved-changes-guard-Bvcp_Rny.js → use-unsaved-changes-guard-BkCuSlvU.js} +1 -1
- package/core/built/admin/assets/{use-upgrade-route-Bsxw9ZLN.js → use-upgrade-route-C-V-Xfak.js} +1 -1
- package/core/built/admin/assets/{use-url-input-DPJ592FB.js → use-url-input-BeYKYMGh.js} +1 -1
- package/core/built/admin/assets/{user-detail-modal-6UY6GdNy.js → user-detail-modal-CSoj7vOC.js} +1 -1
- package/core/built/admin/assets/{users-CzgQKbfO.js → users-CKJaAxEJ.js} +1 -1
- package/core/built/admin/assets/{view-site-DA_-zfGq.js → view-site-SpMx4P7G.js} +1 -1
- package/core/built/admin/assets/{web-Cq5YiD2r.js → web-CZf-k4F0.js} +1 -1
- package/core/built/admin/assets/{web-DqFIrOxt.js → web-uAqgYPK9.js} +1 -1
- package/core/built/admin/assets/{zapier-modal-DgqU-OBB.js → zapier-modal-DENbgTyE.js} +1 -1
- package/core/built/admin/index.html +24 -24
- package/core/frontend/helpers/color_to_rgba.js +15 -13
- package/core/frontend/helpers/facebook_url.js +27 -15
- package/core/frontend/services/assets-minification/card-assets.js +1 -1
- package/core/frontend/services/helpers/register-ghost-helpers.js +2 -2
- package/core/server/api/endpoints/app-installations.js +36 -0
- package/core/server/api/endpoints/automations.js +1 -1
- package/core/server/api/endpoints/index.js +4 -0
- package/core/server/data/exporter/table-lists.js +2 -0
- package/core/server/data/migrations/versions/6.69/2026-10-07-06-20-43-add-app-installation-permissions.js +40 -0
- package/core/server/data/schema/fixtures/fixtures.json +21 -0
- package/core/server/data/schema/in-development.js +1 -1
- package/core/server/data/schema/schema.js +53 -0
- package/core/server/lib/after-commit.js +20 -0
- package/core/server/models/action.js +6 -0
- package/core/server/services/app-installations/actions.js +44 -0
- package/core/server/services/app-installations/codec.js +20 -0
- package/core/server/services/app-installations/index.js +42 -0
- package/core/server/services/app-installations/schema.js +52 -0
- package/core/server/services/app-installations/service.js +160 -0
- package/core/server/services/automations/README.md +3 -3
- package/core/server/services/automations/automations-api.js +1 -1
- package/core/server/services/comments/comments-service-emails.js +8 -6
- package/core/server/services/email-service/README.md +16 -0
- package/core/server/services/email-service/email-service-wrapper.js +1 -0
- package/core/server/services/email-service/email-service.js +94 -53
- package/core/server/services/email-service/sending-status-serializers.js +4 -1
- package/core/server/services/email-service/sending-status-service.js +13 -0
- package/core/server/services/email-service/sending-status.js +12 -1
- package/core/server/services/members/members-api/repositories/member-repository.js +5 -23
- package/core/server/services/posts/post-email-handler.js +61 -28
- package/core/server/services/posts/posts-service.js +27 -2
- package/core/server/services/service-inventory.yaml +93 -7
- package/core/server/services/stats/stats-service.js +1 -5
- package/core/server/services/tinybird-sync/index.js +0 -3
- package/core/server/services/tinybird-sync/tinybird-sync-service.js +2 -6
- package/core/server/web/api/endpoints/admin/routes.js +25 -12
- package/core/shared/labs.js +4 -6
- package/package.json +11 -10
- package/pnpm-lock.yaml +112 -100
- package/pnpm-workspace.yaml +14 -12
- 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-checkout-0.0.1.tgz +0 -0
- package/components/tryghost-kg-card-factory-5.2.4.tgz +0 -0
- package/components/tryghost-kg-clean-basic-html-4.3.4.tgz +0 -0
- package/components/tryghost-kg-converters-1.2.5.tgz +0 -0
- package/components/tryghost-kg-default-transforms-1.3.4.tgz +0 -0
- package/components/tryghost-kg-html-to-lexical-1.4.0.tgz +0 -0
- package/components/tryghost-kg-markdown-html-renderer-7.2.6.tgz +0 -0
- package/components/tryghost-kg-utils-1.1.4.tgz +0 -0
- package/components/tryghost-metafield-csv-0.0.1.tgz +0 -0
- package/core/built/admin/assets/activitypub/layout-QTbY0t8e.js +0 -1
- package/core/built/admin/assets/automations-DVToctfJ.js +0 -1
- package/core/built/admin/assets/editor-CMXR0YvR.js +0 -8
- package/core/built/admin/assets/fullscreen-close-button-DXssPeDB.js +0 -1
- package/core/built/admin/assets/global-search-modal-C8LVJmiz.js +0 -1
- package/core/built/admin/assets/history-modal-parBtjpz.js +0 -1
- package/core/built/admin/assets/pages-route-CDk3V9rq.js +0 -1
- package/core/built/admin/assets/posts-route-CexHhklY.js +0 -1
- package/core/built/admin/assets/settings-xqakrAWa.js +0 -4
- package/core/built/admin/assets/source-icon-BjVangBd.js +0 -1
- package/core/built/admin/assets/use-definitions-DMVU3mTG.js +0 -1
- package/core/built/admin/assets/use-sending-eta-BsnKdQhv.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`fc2e3c1f-10cb-4a46-95f9-28da11b86ea9`,e._sentryDebugIdIdentifier=`sentry-dbid-fc2e3c1f-10cb-4a46-95f9-28da11b86ea9`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{g as n,y as r}from"./hooks-C-BDQ6Hs.js";import{t as i}from"./jsx-runtime-Bm2_KH-0.js";import{n as a}from"./dist-pogVoW2G.js";import{t as o}from"./use-form-ElCUnbKi.js";import{a as s,i as c,r as l}from"./config-B3HuCo0y.js";import{h as u}from"./chunk-OB3PAWPO-D3muQBsq.js";import{Z as d,a as f,i as p,s as m}from"./shade-provider-DvrXKKQZ.js";import{t as h}from"./inline-Qoyy4r2g.js";import{t as g}from"./stack-C3OmgpUv.js";import{A as _,Cr as v,N as y,P as b,Rt as x,S,U as C,W as w,Z as T,gn as E,k as D,qn as ee,t as te,x as ne}from"./button-CTHYSI-d.js";import{t as O}from"./use-limiter-DPKxoO1_.js";import{a as k,c as A,i as j,n as M,o as N,r as P,s as F,t as I}from"./field-DCPPrQDr.js";import{t as L}from"./input-BHb2A_DU.js";import{i as R,n as z,o as B,s as V,t as H}from"./select-DeloOYCg.js";import{t as U}from"./switch-BppWscjz.js";import{i as re,n as ie,r as ae,t as oe}from"./tabs-CDb_TceL.js";import{t as se}from"./textarea-B_rfKtjs.js";import{n as W,t as G}from"./toggle-group-D7ly9OGa.js";import{a as ce,i as le,r as ue,t as K}from"./newsletter-emails-CzVCiC2K.js";import{i as de,r as fe}from"./newsletters-BMEgeL2l.js";import{B as pe,Ht as me,Ut as q,i as J,st as he}from"./index-CuDhPtkB.js";import{t as ge}from"./validator-DgUCXsE8.js";import{t as _e}from"./use-settings-navigation-CO2nUqDW.js";import{n as ve}from"./confirmation-context-By_jX_cA.js";import{n as Y}from"./global-data-context-ogIy0FUG.js";import{t as ye}from"./use-upgrade-route-Bsxw9ZLN.js";import{t as be}from"./use-setting-group-Bf3vY8br.js";import{t as X}from"./color-picker-field-Cjz2zY11.js";import{t as xe}from"./html-field-D6G0G1d_.js";import{t as Se}from"./preview-modal-D8om_cQv.js";``+new URL(`user-cover-yM4cP_Mo.jpg`,import.meta.url).href,``+new URL(`latest-posts-1-D7-ilqhR.jpg`,import.meta.url).href,``+new URL(`latest-posts-2-BPfbGB8B.jpg`,import.meta.url).href,``+new URL(`latest-posts-3-D72O3dn8.jpg`,import.meta.url).href;var Z=i(),Ce=({senderName:e,senderEmail:t,senderReplyTo:n,headerImage:r,headerIcon:i,headerTitle:a,headerSubtitle:o,showPostTitleSection:s,showExcerpt:l,titleAlignment:u,titleFontCategory:f,titleFontWeight:p,bodyFontCategory:m,authorPlaceholder:h,showCommentCta:g,showFeatureImage:v,showFeedback:y,showShareButton:b,showLatestPosts:S,showSubscriptionDetails:C,siteTitle:w,footerContent:E,showBadge:ee,backgroundColor:te,headerBackgroundColor:ne,accentColor:O,textColor:k,secondaryTextColor:A,headerTextColor:j,secondaryHeaderTextColor:M,postTitleColor:N,sectionTitleColor:P,dividerColor:F,buttonColor:I,buttonTextColor:L,linkColor:R,buttonCorners:z,buttonStyle:B,imageCorners:V,linkStyle:H,dividerStyle:U})=>{let re=i||a,{config:ie}=Y(),ae=new Date().toLocaleDateString(`default`,{year:`numeric`,month:`short`,day:`numeric`}),oe=new Date().getFullYear(),se=E?E.replace(/<a/g,`<a target="_blank" rel="noopener noreferrer"`):``,W;W=c(ie)?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`leading-normal`,children:[(0,Z.jsx)(`span`,{className:`font-semibold text-gray-900`,children:`From: `}),(0,Z.jsxs)(`span`,{children:[e,` (`,t,`)`]})]}),(0,Z.jsxs)(`p`,{className:`leading-normal`,children:[(0,Z.jsx)(`span`,{className:`font-semibold text-gray-900`,children:`Reply-to: `}),n||t]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`leading-normal`,children:[(0,Z.jsx)(`span`,{className:`font-semibold text-gray-900`,children:e}),(0,Z.jsxs)(`span`,{children:[` `,t]})]}),(0,Z.jsxs)(`p`,{className:`leading-normal`,children:[(0,Z.jsx)(`span`,{className:`font-semibold text-gray-900`,children:`To:`}),` Jamie Larson jamie@example.com`]})]});let G=`mb-5 text-pretty leading-[1.7] text-black`;return G=f===`serif`&&m===`serif`?d(G,`mb-8 font-serif text-[2.0rem] leading-tight`):f!==`serif`&&m===`serif`?d(G,`mb-8 text-[1.7rem] leading-tight tracking-tight`):f===`serif`&&m!==`serif`?d(G,`mb-8 font-serif text-[2.0rem] leading-tight`):d(G,`mb-8 text-[1.9rem] leading-tight tracking-tight`),u===`center`&&(G=d(G,`text-center`)),(0,Z.jsx)(`div`,{className:`relative flex grow flex-col`,children:(0,Z.jsx)(`div`,{className:`absolute inset-0 m-5 flex items-center justify-center`,children:(0,Z.jsxs)(`div`,{className:`mx-auto my-0 flex max-h-full w-full max-w-[700px] flex-col overflow-hidden rounded-[4px] text-black shadow-sm`,children:[(0,Z.jsx)(`div`,{className:`flex min-h-[77px] flex-col justify-center gap-1 rounded-t-sm border-b border-gray-200 bg-white px-6 text-gray-700`,children:W}),(0,Z.jsxs)(`div`,{className:`overflow-y-auto`,style:{backgroundColor:te},children:[(0,Z.jsxs)(`div`,{className:`px-[7rem]`,style:{backgroundColor:ne},children:[r&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(`img`,{alt:``,className:`mb-4 block pt-6`,src:r})}),re&&(0,Z.jsxs)(`div`,{className:`py-3`,children:[i&&(0,Z.jsx)(`img`,{alt:``,className:`mx-auto mb-2 size-10`,role:`presentation`,src:i}),a&&(0,Z.jsx)(`h4`,{className:`mb-1 text-center text-[1.6rem] leading-tight font-bold tracking-tight text-gray-900 uppercase`,style:{color:j},children:a}),o&&(0,Z.jsx)(`h5`,{className:`mb-1 text-center text-[1.3rem] font-normal text-gray-700`,style:{color:M},children:o})]}),s&&(0,Z.jsxs)(`div`,{className:d(`flex flex-col py-8`,u===`center`?`items-center`:`items-start`),children:[(0,Z.jsx)(`h2`,{className:d(`text-4xl leading-supertight font-bold text-black`,f===`serif`&&`font-serif`,p===`normal`&&`font-normal`,p===`medium`&&`font-medium`,p===`semibold`&&`font-semibold`,p===`bold`&&`font-bold`,u===`center`?`text-center`:`text-left`,l?`mb-2`:`mb-8`),style:{color:N},children:`Your email newsletter`}),l&&(0,Z.jsx)(`p`,{className:G,style:{color:j},children:`A subtitle to highlight key points and engage your readers.`}),(0,Z.jsxs)(`div`,{className:d(`flex w-full justify-between text-center text-md leading-none text-gray-700`,u===`center`?`flex-col gap-1`:`flex-row`),children:[(0,Z.jsxs)(`p`,{className:`pb-1 text-[1.3rem]`,style:{color:M},children:[`By `,h,(0,Z.jsx)(`span`,{className:`before:pr-1 before:pl-0.5 before:content-['•']`,children:ae})]}),(0,Z.jsx)(`p`,{className:`pb-1 text-[1.3rem] underline`,style:{color:M},children:(0,Z.jsx)(`span`,{children:`View in browser`})})]})]}),v&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:d(`h-[unset] w-full max-w-[600px] bg-cover bg-no-repeat`,s?``:`pt-6`),children:(0,Z.jsx)(`img`,{alt:`Feature`,className:d(`min-h-full min-w-full shrink-0`,V===`square`&&`rounded-none`,V===`rounded`&&`rounded-md`),src:``+new URL(`user-cover-yM4cP_Mo.jpg`,import.meta.url).href})}),(0,Z.jsx)(`div`,{className:`mt-1 w-full max-w-[600px] pb-8 text-center text-[1.3rem] text-gray-700`,style:{color:M},children:`Feature image caption`})]})]}),(0,Z.jsxs)(`div`,{className:d(`px-[7rem]`,ne!==`transparent`&&`pt-10`),children:[(0,Z.jsxs)(`div`,{className:d(`max-w-[600px] border-b border-gray-200 pb-[52px] leading-[27.2px] text-black`,U===`dashed`&&`border-dashed`,U===`dotted`&&`border-b-2 border-dotted`,m===`serif`?`font-serif text-[1.8rem]`:`text-[1.7rem] tracking-tight`,v||s?``:`pt-8`),style:{borderColor:F},children:[(0,Z.jsx)(`p`,{className:`mb-6`,style:{color:k},children:`This is what your content will look like when you send one of your posts as an email newsletter to your subscribers.`}),(0,Z.jsx)(`p`,{className:`mb-6`,style:{color:k},children:`Over there on the right you'll see some settings that allow you to customize the look and feel of this template – from colors and typography to layout and buttons – to make it perfectly suited to your brand.`}),(0,Z.jsx)(`p`,{className:`mb-[52px]`,style:{color:k},children:`Email templates are exceptionally finnicky to make, but we've spent a long time optimising this one to make it work beautifully across devices, email clients and content types. So, you can trust that every email you send with Ghost will look great and work well. Just like the rest of your site.`}),(0,Z.jsx)(`hr`,{className:d(`my-[52px] border-[#e0e7eb]`,U===`dashed`&&`border-dashed`,U===`dotted`&&`border-t-0 border-b-2 border-dotted`),style:{borderColor:F}}),(0,Z.jsx)(`h3`,{className:d(`mb-[13px] text-[2.6rem] leading-supertight`,f===`serif`&&`font-serif`,f===`sans_serif`&&`font-sans`,p===`normal`&&`font-normal`,p===`medium`&&`font-medium`,p===`semibold`&&`font-semibold`,p===`bold`&&`font-bold`),style:{color:P},children:`Need inspiration?`}),(0,Z.jsxs)(`p`,{className:`mb-[27px]`,style:{color:k},children:[`We've put together a`,` `,(0,Z.jsx)(`a`,{className:d(H===`underline`&&`underline`,H===`bold`&&`font-bold`),href:`https://ghost.org/help/email-design/`,rel:`noopener noreferrer`,style:{color:R||O},target:`_blank`,children:`quick guide`}),` `,`that walks through all of the available settings, along with a few examples of what's possible.`]}),(0,Z.jsx)(`a`,{className:d(`inline-block border px-[18px] py-2 font-sans text-[15px]`,z===`rounded`&&`rounded-[6px]`,z===`pill`&&`rounded-full`,z===`square`&&`rounded-none`,B===`outline`?`bg-transparent`:`border-transparent text-white`,H===`bold`?`font-bold`:`font-semibold`),href:`https://ghost.org/help/email-design/`,rel:`noopener noreferrer`,style:B===`outline`?{borderColor:I||O,color:I||O}:{backgroundColor:I||O,color:L},target:`_blank`,children:`Learn more`})]}),(y||g||b)&&(0,Z.jsx)(`div`,{className:d(`grid gap-5 border-b border-gray-200 px-6 py-5`,U===`dashed`&&`border-dashed`,U===`dotted`&&`border-b-2 border-dotted`),style:{borderColor:F},children:(0,Z.jsxs)(`div`,{className:`grid auto-cols-fr grid-flow-col gap-4`,children:[y&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`pointer-events-none flex min-w-[120px] cursor-default flex-col items-center gap-[11px] text-center`,children:[(0,Z.jsx)(`span`,{className:`inline-flex size-[54px] items-center justify-center rounded-full border`,style:{borderColor:F,color:k},children:(0,Z.jsx)(D,{className:`size-5`})}),(0,Z.jsx)(`span`,{className:`font-sans text-[1.3rem] leading-[1.4] font-medium`,style:{color:k},children:`More like this`})]}),(0,Z.jsxs)(`div`,{className:`pointer-events-none flex min-w-[120px] cursor-default flex-col items-center gap-[11px] text-center`,children:[(0,Z.jsx)(`span`,{className:`inline-flex size-[54px] items-center justify-center rounded-full border`,style:{borderColor:F,color:k},children:(0,Z.jsx)(_,{className:`size-5`})}),(0,Z.jsx)(`span`,{className:`font-sans text-[1.3rem] leading-[1.4] font-medium`,style:{color:k},children:`Less like this`})]})]}),g&&(0,Z.jsxs)(`div`,{className:`pointer-events-none flex min-w-[120px] cursor-default flex-col items-center gap-[11px] text-center`,children:[(0,Z.jsx)(`span`,{className:`inline-flex size-[54px] items-center justify-center rounded-full border`,style:{borderColor:F,color:k},children:(0,Z.jsx)(x,{className:`size-5`})}),(0,Z.jsx)(`span`,{className:`font-sans text-[1.3rem] leading-[1.4] font-medium`,style:{color:k},children:`Comment`})]}),b&&(0,Z.jsxs)(`div`,{className:`pointer-events-none flex min-w-[120px] cursor-default flex-col items-center gap-[11px] text-center`,children:[(0,Z.jsx)(`span`,{className:`inline-flex size-[54px] items-center justify-center rounded-full border`,style:{borderColor:F,color:k},children:(0,Z.jsx)(T,{className:`size-5`})}),(0,Z.jsx)(`span`,{className:`font-sans text-[1.3rem] leading-[1.4] font-medium`,style:{color:k},children:`Share`})]})]})}),S&&(0,Z.jsxs)(`div`,{className:d(`border-b border-gray-200 py-6`,U===`dashed`&&`border-dashed`,U===`dotted`&&`border-b-2 border-dotted`),style:{borderColor:F},children:[(0,Z.jsx)(`h3`,{className:`mt-2 mb-4 pb-1 text-[1.2rem] font-semibold tracking-wide text-black uppercase`,style:{color:k},children:`Keep reading`}),(0,Z.jsxs)(`div`,{className:`flex justify-between gap-4 py-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:d(`mt-0.5 text-[1.9rem] text-black`,f===`serif`&&`font-serif`,p===`normal`&&`font-normal`,p===`medium`&&`font-medium`,p===`semibold`&&`font-semibold`,p===`bold`&&`font-bold`),style:{color:P},children:`The three latest posts published on your site`}),(0,Z.jsx)(`p`,{className:`m-0 text-base text-gray-700`,style:{color:A},children:`Posts sent as an email only will never be shown here.`})]}),(0,Z.jsx)(`div`,{className:`aspect-square h-auto w-full max-w-[100px] bg-cover bg-no-repeat`,children:(0,Z.jsx)(`img`,{alt:`Latest post`,className:d(V===`square`&&`rounded-none`,V===`rounded`&&`rounded-md`),src:``+new URL(`latest-posts-1-D7-ilqhR.jpg`,import.meta.url).href})})]}),(0,Z.jsxs)(`div`,{className:`flex justify-between gap-4 py-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:d(`mt-0.5 text-[1.9rem] text-black`,f===`serif`&&`font-serif`,p===`normal`&&`font-normal`,p===`medium`&&`font-medium`,p===`semibold`&&`font-semibold`,p===`bold`&&`font-bold`),style:{color:P},children:`Displayed at the bottom of each newsletter`}),(0,Z.jsx)(`p`,{className:`m-0 text-base text-gray-700`,style:{color:A},children:`Giving your readers one more place to discover your stories.`})]}),(0,Z.jsx)(`div`,{className:`aspect-square h-auto w-full max-w-[100px] bg-cover bg-no-repeat`,children:(0,Z.jsx)(`img`,{alt:`Latest post`,className:d(V===`square`&&`rounded-none`,V===`rounded`&&`rounded-md`),src:``+new URL(`latest-posts-2-BPfbGB8B.jpg`,import.meta.url).href})})]}),(0,Z.jsxs)(`div`,{className:`flex justify-between gap-4 py-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:d(`mt-0.5 text-[1.9rem] text-black`,f===`serif`&&`font-serif`,p===`normal`&&`font-normal`,p===`medium`&&`font-medium`,p===`semibold`&&`font-semibold`,p===`bold`&&`font-bold`),style:{color:P},children:`To keep your work front and center`}),(0,Z.jsx)(`p`,{className:`m-0 text-base text-gray-700`,style:{color:A},children:`Making sure that your audience stays engaged.`})]}),(0,Z.jsx)(`div`,{className:`aspect-square h-auto w-full max-w-[100px] bg-cover bg-no-repeat`,children:(0,Z.jsx)(`img`,{alt:`Latest post`,className:d(V===`square`&&`rounded-none`,V===`rounded`&&`rounded-md`),src:``+new URL(`latest-posts-3-D72O3dn8.jpg`,import.meta.url).href})})]})]}),C&&(0,Z.jsxs)(`div`,{className:d(`border-b border-gray-200 py-8`,U===`dashed`&&`border-dashed`,U===`dotted`&&`border-b-2 border-dotted`),style:{borderColor:F},children:[(0,Z.jsx)(`h4`,{className:`mb-3 text-[1.2rem] tracking-wide text-black uppercase`,style:{color:k},children:`Subscription details`}),(0,Z.jsxs)(`p`,{className:`m-0 mb-4 text-base`,style:{color:k},children:[`You are receiving this because you are a paid subscriber to `,w,`. Your subscription will renew on 17 Jul 2024.`]}),(0,Z.jsxs)(`div`,{className:`flex`,children:[(0,Z.jsxs)(`div`,{className:`shrink-0 text-base`,children:[(0,Z.jsx)(`p`,{style:{color:k},children:`Name: Jamie Larson`}),(0,Z.jsx)(`p`,{style:{color:k},children:`Email: jamie@example.com`}),(0,Z.jsx)(`p`,{style:{color:k},children:`Member since: 17 July 2023`})]}),(0,Z.jsx)(`span`,{className:d(`w-full self-end text-right text-base whitespace-nowrap`,H===`underline`&&`underline`,H===`bold`&&`font-bold`),style:{color:R||O},children:`Manage subscription`})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col items-center pt-10`,children:[(0,Z.jsx)(`div`,{dangerouslySetInnerHTML:{__html:se||``},className:`text px-8 py-3 text-center text-[1.3rem] leading-base break-words text-gray-700 [&_a]:underline`,style:{color:A}}),(0,Z.jsxs)(`div`,{className:`px-8 pt-3 pb-14 text-center text-[1.3rem] text-gray-700`,children:[(0,Z.jsxs)(`span`,{style:{color:A},children:[w,` © `,oe,` —`,` `]}),(0,Z.jsx)(`span`,{className:`pointer-events-none cursor-auto underline`,style:{color:A},children:`Unsubscribe`})]}),ee&&(0,Z.jsx)(`div`,{className:`flex flex-col items-center pt-[10px] pb-[40px]`,children:(0,Z.jsxs)(`a`,{className:`pointer-events-none inline-flex cursor-auto items-center px-2 py-1 text-[1.25rem] font-semibold tracking-tight text-gray-900`,href:`https://ghost.org`,style:{color:k},children:[(0,Z.jsx)(ce,{className:`mr-[6px] size-4`}),(0,Z.jsx)(`span`,{children:`Powered by Ghost`})]})})]})]})]})]})})})},Q=e(t(),1),we=({newsletter:e})=>{let{currentUser:t,settings:n,siteData:r,config:i}=Y(),[a,o,s,c,l]=q(n,[`title`,`icon`,`comments_enabled`,`support_email_address`,`default_email_address`]),u=null;e.show_header_title?u=a||null:e.show_header_name&&(u=e.name);let d=e.show_header_title&&e.show_header_name?e.name:void 0,f=e.show_comment_cta&&s!==`off`,p=e.feedback_enabled,m=e.show_share_button,h=()=>{let t=e.background_color;return/#([0-9a-f]{3}){1,2}$/i.test(t)?t:`#ffffff`},g=()=>{let t=e.header_background_color;return!t||t===`transparent`?`transparent`:/#([0-9a-f]{3}){1,2}$/i.test(t)?t:`transparent`},_=()=>{let t=e.button_color;return/#([0-9a-f]{3}){1,2}$/i.test(t||``)?t:t===null?J(h()).hex():r.accent_color},v=()=>{let t=e.button_style,n=_();if(n&&t===`fill`)return J(n).hex()},y=()=>{let t=e.link_color===void 0?`accent`:e.link_color;return t===`accent`?r.accent_color:/#([0-9a-f]{3}){1,2}$/i.test(t||``)?t:J(h()).hex()},b=()=>{let t=e.post_title_color;if(/#([0-9a-f]{3}){1,2}$/i.test(t||``))return t;if(t===`accent`)return r.accent_color;let n=g();return J(n===`transparent`?h():n).hex()},x=()=>{let t=e.section_title_color;return/#([0-9a-f]{3}){1,2}$/i.test(t||``)?t:t===`accent`?r.accent_color:J(h()).hex()},S=()=>{let t=e.divider_color;return/#([0-9a-f]{3}){1,2}$/i.test(t||``)?t:t===`accent`?r.accent_color:`#e0e7eb`},C=J(h()).hex(),w=J(h()).alpha(.5).toString(),T=g()===`transparent`?C:J(g()).hex(),E=g()===`transparent`?w:J(g()).alpha(.5).toString(),D={backgroundColor:h(),headerBackgroundColor:g(),postTitleColor:b()||void 0,sectionTitleColor:x()||void 0,buttonColor:_()||void 0,buttonTextColor:v()||void 0,linkColor:y()||void 0,dividerColor:S()||void 0,textColor:C,secondaryTextColor:w,headerTextColor:T,secondaryHeaderTextColor:E};return(0,Z.jsx)(Ce,{accentColor:r.accent_color,authorPlaceholder:t.name||t.email,backgroundColor:D.backgroundColor||`#ffffff`,bodyFontCategory:e.body_font_category,buttonCorners:e.button_corners||`rounded`,buttonStyle:e.button_style||`fill`,dividerStyle:e.divider_style||`solid`,footerContent:e.footer_content,headerBackgroundColor:D.headerBackgroundColor||`transparent`,headerIcon:e.show_header_icon?o:void 0,headerImage:e.header_image,headerSubtitle:d,headerTitle:u,imageCorners:e.image_corners||`square`,linkStyle:e.link_style||`underline`,senderEmail:ue(e,i,l),senderName:e.sender_name||a,senderReplyTo:K(e,i,c,l),showBadge:e.show_badge,showCommentCta:f,showExcerpt:e.show_excerpt,showFeatureImage:e.show_feature_image,showFeedback:p,showLatestPosts:e.show_latest_posts,showPostTitleSection:e.show_post_title_section,showShareButton:m,showSubscriptionDetails:e.show_subscription_details,siteTitle:a,titleAlignment:e.title_alignment,titleFontCategory:e.title_font_category,titleFontWeight:e.title_font_weight||`bold`,...D})},Te=e(ge(),1),$=({label:e,value:t,options:n,onValueChange:r})=>(0,Z.jsx)(G,{"aria-label":e,type:`single`,value:t,onValueChange:e=>e&&r(e),children:n.map(e=>(0,Z.jsxs)(p,{children:[(0,Z.jsx)(m,{asChild:!0,children:(0,Z.jsx)(W,{"aria-label":e.label,disabled:e.disabled,value:e.value,children:e.icon})}),(0,Z.jsx)(f,{children:e.label})]},e.value))}),Ee=({newsletter:e,updateNewsletter:t,errors:n,clearError:r})=>{let{settings:i,config:a}=Y(),[o,s]=q(i,[`default_email_address`,`support_email_address`]),[c,l]=(0,Q.useState)(K(e,a,s,o)||``),u=ue(e,a,o),d=(0,Q.useCallback)(e=>{l(e.target.value),t({sender_reply_to:e.target.value||`newsletter`})},[t,l]);return(0,Z.jsxs)(I,{"data-invalid":!!n.sender_reply_to||void 0,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-reply-to`,children:`Reply-to email`}),(0,Z.jsx)(L,{"aria-invalid":!!n.sender_reply_to||void 0,id:`newsletter-reply-to`,maxLength:191,placeholder:u||``,value:c,onBlur:()=>{let t=K(e,a,s,o)||``;l(t)},onChange:d,onKeyDown:()=>r(`sender_reply_to`)}),n.sender_reply_to&&(0,Z.jsx)(j,{children:n.sender_reply_to})]})},De=({newsletter:e,onlyOne:t,updateNewsletter:i,validate:o,errors:s,clearError:u})=>{let{updateRoute:d}=_e(),f=ye(),{mutateAsync:p}=de(),m=O(),{settings:_,config:x,siteData:T}=Y(),[D,W]=q(_,[`icon`,`default_email_address`]),[G,ce]=(0,Q.useState)(`generalSettings`),{localSettings:K}=be(),[pe]=q(K,[`title`]),ge=n(),{confirm:Se,showLimit:Ce}=ve(),{data:{newsletters:we}={}}=fe(),Te=[`all`,`paid`].includes(me(_,`comments_enabled`)||``),De=ue(e,x,W),[Oe,ke]=(0,Q.useState)(we||[]),Ae=Oe.filter(e=>e.status===`active`);(0,Q.useEffect)(()=>{ke(we||[])},[we]);let je=[{value:`serif`,label:`Elegant serif`,className:`font-serif`},{value:`sans_serif`,label:`Clean sans-serif`}],Me={sans_serif:{options:[{value:`normal`,label:`Regular`,className:`font-normal`},{value:`medium`,label:`Medium`,className:`font-medium`},{value:`semibold`,label:`Semi-bold`,className:`font-semibold`},{value:`bold`,label:`Bold`,className:`font-bold`}]},serif:{options:[{value:`normal`,label:`Regular`,className:`font-normal`},{value:`bold`,label:`Bold`,className:`font-bold`}],map:{medium:`normal`,semibold:`bold`}}},Ne=()=>e.background_color===`light`?!1:J(e.background_color).hex().toLowerCase()===`#ffffff`,Pe=async()=>{if(e.status===`active`)Se({title:`Archive newsletter`,prompt:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`mb-6`,children:[`Your newsletter `,(0,Z.jsx)(`strong`,{children:e.name}),` will no longer be visible to members or available as an option when publishing new posts.`]}),(0,Z.jsx)(`div`,{children:`Existing posts previously sent as this newsletter will remain unchanged.`})]}),okLabel:`Archive`,okVariant:`destructive`,onOk:async t=>{try{await p({...e,status:`archived`}),t?.remove(),a.success(`Newsletter archived`)}catch(e){ge(e)}}});else{try{await m?.errorIfWouldGoOverLimit(`newsletters`)}catch(e){if(e instanceof r){Ce({prompt:e.message||`Your current plan doesn't support more newsletters.`,onOk:()=>d({route:f,isExternal:!0})});return}else throw e}Se({title:`Reactivate newsletter`,prompt:(0,Z.jsxs)(Z.Fragment,{children:[`Reactivating `,(0,Z.jsx)(`strong`,{children:e.name}),` will immediately make it visible to members and re-enable it as an option when publishing new posts.`]}),okLabel:`Reactivate`,onOk:async t=>{await p({...e,status:`active`}),t?.remove(),a.success(`Newsletter reactivated`)}})}},Fe=()=>{if(!c(x))return(0,Z.jsxs)(I,{"data-invalid":!!s.sender_email||void 0,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-sender-email`,children:`Sender email address`}),(0,Z.jsx)(L,{"aria-invalid":!!s.sender_email||void 0,id:`newsletter-sender-email`,placeholder:De||``,value:e.sender_email||``,onChange:e=>i({sender_email:e.target.value}),onKeyDown:()=>u(`sender_email`)}),s.sender_email&&(0,Z.jsx)(j,{children:s.sender_email})]});if(l(x))return(0,Z.jsxs)(I,{"data-invalid":!!s.sender_email||void 0,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-sender-email`,children:`Sender email address`}),(0,Z.jsx)(L,{"aria-invalid":!!s.sender_email||void 0,id:`newsletter-sender-email`,maxLength:191,placeholder:W,value:e.sender_email||``,onChange:e=>{i({sender_email:e.target.value})},onKeyDown:()=>u(`sender_email`)}),s.sender_email&&(0,Z.jsx)(j,{children:s.sender_email})]})},Ie=Me[e.title_font_category||`sans_serif`].options,Le=[{id:`generalSettings`,title:`General`,contents:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(A,{className:`mt-8`,children:[(0,Z.jsx)(F,{className:`text-lg! font-semibold`,children:`Name and description`}),(0,Z.jsxs)(k,{children:[(0,Z.jsxs)(I,{"data-invalid":!!s.name||void 0,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-detail-name`,children:`Name`}),(0,Z.jsx)(L,{"aria-invalid":!!s.name||void 0,id:`newsletter-detail-name`,maxLength:191,placeholder:`Weekly Roundup`,value:e.name||``,onChange:e=>i({name:e.target.value}),onKeyDown:()=>u(`name`)}),s.name&&(0,Z.jsx)(j,{children:s.name})]}),(0,Z.jsxs)(I,{children:[(0,Z.jsx)(N,{htmlFor:`newsletter-description`,children:`Description`}),(0,Z.jsx)(se,{id:`newsletter-description`,maxLength:2e3,rows:2,value:e.description||``,onChange:e=>i({description:e.target.value})})]})]})]}),(0,Z.jsxs)(A,{className:`mt-8`,children:[(0,Z.jsx)(F,{className:`text-lg! font-semibold`,children:`Email info`}),(0,Z.jsxs)(k,{children:[(0,Z.jsxs)(I,{children:[(0,Z.jsx)(N,{htmlFor:`newsletter-sender-name`,children:`Sender name`}),(0,Z.jsx)(L,{id:`newsletter-sender-name`,maxLength:191,placeholder:pe,value:e.sender_name||``,onChange:e=>i({sender_name:e.target.value})})]}),Fe(),(0,Z.jsx)(Ee,{clearError:u,errors:s,newsletter:e,updateNewsletter:i,validate:o})]})]}),(0,Z.jsxs)(A,{className:`mt-8`,children:[(0,Z.jsx)(F,{className:`text-lg! font-semibold`,children:`Member settings`}),(0,Z.jsx)(k,{children:(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-subscribe-on-signup`,children:`Subscribe new members on signup`}),(0,Z.jsx)(U,{checked:!!e.subscribe_on_signup,id:`newsletter-subscribe-on-signup`,onCheckedChange:e=>i({subscribe_on_signup:e})})]})})]}),(0,Z.jsx)(`div`,{className:`mt-10 mb-5`,children:e.status===`active`?!t&&(0,Z.jsx)(te,{disabled:Ae.length===1,type:`button`,variant:`destructive-ghost`,onClick:()=>void Pe(),children:`Archive newsletter`}):(0,Z.jsx)(te,{className:`text-green hover:text-green`,type:`button`,variant:`ghost`,onClick:()=>void Pe(),children:`Reactivate newsletter`})})]})},{id:`content`,title:`Content`,contents:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(A,{className:`mt-8`,children:[(0,Z.jsx)(F,{className:`text-lg! font-semibold`,children:`Header`}),(0,Z.jsxs)(k,{children:[(0,Z.jsx)(le,{inputId:`newsletter-header-image`,value:e.header_image||``,onChange:e=>i({header_image:e||null}),onUploadError:ge}),(0,Z.jsxs)(g,{gap:`md`,children:[D&&(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-show-header-icon`,children:`Publication icon`}),(0,Z.jsx)(U,{checked:!!e.show_header_icon,id:`newsletter-show-header-icon`,onCheckedChange:e=>i({show_header_icon:e})})]}),(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-show-header-title`,children:`Publication title`}),(0,Z.jsx)(U,{checked:!!e.show_header_title,id:`newsletter-show-header-title`,onCheckedChange:e=>i({show_header_title:e})})]}),(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-show-header-name`,children:`Newsletter name`}),(0,Z.jsx)(U,{checked:!!e.show_header_name,id:`newsletter-show-header-name`,onCheckedChange:e=>i({show_header_name:e})})]})]})]})]}),(0,Z.jsxs)(A,{className:`mt-8`,children:[(0,Z.jsx)(F,{className:`text-lg! font-semibold`,children:`Title section`}),(0,Z.jsxs)(k,{children:[(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-show-post-title`,children:`Post title`}),(0,Z.jsx)(U,{checked:!!e.show_post_title_section,id:`newsletter-show-post-title`,onCheckedChange:e=>i({show_post_title_section:e})})]}),e.show_post_title_section&&(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-show-excerpt`,children:`Post excerpt`}),(0,Z.jsx)(U,{checked:!!e.show_excerpt,id:`newsletter-show-excerpt`,onCheckedChange:e=>i({show_excerpt:e})})]}),(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-show-feature-image`,children:`Feature image`}),(0,Z.jsx)(U,{checked:!!e.show_feature_image,id:`newsletter-show-feature-image`,onCheckedChange:e=>i({show_feature_image:e})})]})]})]}),(0,Z.jsxs)(A,{className:`mt-8`,children:[(0,Z.jsx)(F,{className:`text-lg! font-semibold`,children:`Footer`}),(0,Z.jsxs)(k,{children:[(0,Z.jsxs)(g,{gap:`lg`,children:[(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-feedback-enabled`,children:`Ask your readers for feedback`}),(0,Z.jsx)(U,{checked:!!e.feedback_enabled,id:`newsletter-feedback-enabled`,onCheckedChange:e=>i({feedback_enabled:e})})]}),Te&&(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-show-comment-cta`,children:`Add a link to your comments`}),(0,Z.jsx)(U,{checked:!!e.show_comment_cta,id:`newsletter-show-comment-cta`,onCheckedChange:e=>i({show_comment_cta:e})})]}),(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-show-share-button`,children:`Show share button`}),(0,Z.jsx)(U,{checked:!!e.show_share_button,id:`newsletter-show-share-button`,onCheckedChange:e=>i({show_share_button:e})})]}),(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-show-latest-posts`,children:`Share your latest posts`}),(0,Z.jsx)(U,{checked:!!e.show_latest_posts,id:`newsletter-show-latest-posts`,onCheckedChange:e=>i({show_latest_posts:e})})]}),(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-show-subscription-details`,children:`Show subscription details`}),(0,Z.jsx)(U,{checked:!!e.show_subscription_details,id:`newsletter-show-subscription-details`,onCheckedChange:e=>i({show_subscription_details:e})})]})]}),(0,Z.jsx)(xe,{hint:`Any extra information or legal text`,nodes:`MINIMAL_NODES`,placeholder:` `,title:`Email footer`,value:e.footer_content||``,onChange:e=>i({footer_content:e})})]})]}),(0,Z.jsx)(he,{className:`mt-8`}),(0,Z.jsxs)(`div`,{className:`my-5 flex w-full items-start`,children:[(0,Z.jsx)(`span`,{children:(0,Z.jsx)(E,{className:`mt-[-1px] mr-2 size-5 text-red`})}),(0,Z.jsx)(k,{className:`gap-8`,children:(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsxs)(M,{children:[(0,Z.jsx)(N,{htmlFor:`newsletter-show-badge`,children:`Promote independent publishing`}),(0,Z.jsx)(P,{children:`Show you're a part of the indie publishing movement with a small badge in the footer`})]}),(0,Z.jsx)(U,{checked:!!e.show_badge,id:`newsletter-show-badge`,onCheckedChange:e=>i({show_badge:e})})]})})]})]})},{id:`design`,title:`Design`,contents:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(A,{className:`mt-8`,children:[(0,Z.jsx)(F,{className:`text-lg! font-semibold`,children:`Global`}),(0,Z.jsxs)(k,{children:[(0,Z.jsx)(`div`,{className:`mb-1`,children:(0,Z.jsx)(X,{direction:`rtl`,eyedropper:!0,swatches:[{hex:`#ffffff`,value:`light`,title:`White`}],title:`Background color`,value:e.background_color||`light`,onChange:e=>i({background_color:e})})}),(0,Z.jsxs)(h,{className:`w-full`,gap:`sm`,justify:`between`,children:[(0,Z.jsx)(`div`,{className:`shrink-0`,children:`Heading font`}),(0,Z.jsxs)(I,{className:`max-w-[200px]`,children:[(0,Z.jsx)(N,{className:`sr-only`,children:`Heading font`}),(0,Z.jsxs)(H,{value:e.title_font_category,onValueChange:t=>{let n=e.title_font_weight,r=n;return Me[t].options.find(e=>e.value===n)||(r=Me[t].map?.[n]||`bold`),i({title_font_category:t,title_font_weight:r})},children:[(0,Z.jsx)(B,{"aria-label":`Heading font`,children:(0,Z.jsx)(V,{})}),(0,Z.jsx)(z,{children:je.map(e=>(0,Z.jsx)(R,{value:e.value,children:(0,Z.jsx)(`span`,{className:e.className,children:e.label})},e.value))})]})]})]}),(0,Z.jsxs)(h,{className:`w-full`,gap:`sm`,justify:`between`,children:[(0,Z.jsx)(`div`,{className:`shrink-0`,children:`Heading weight`}),(0,Z.jsxs)(I,{className:`max-w-[200px]`,children:[(0,Z.jsx)(N,{className:`sr-only`,children:`Heading weight`}),(0,Z.jsxs)(H,{value:(()=>{let t=e.title_font_category||`sans_serif`,n=e.title_font_weight,r=Me[t].map,i=r&&r[n]||n;return Ie.find(e=>e.value===i)||Ie[0]})().value,onValueChange:e=>i({title_font_weight:e}),children:[(0,Z.jsx)(B,{"aria-label":`Heading weight`,children:(0,Z.jsx)(V,{})}),(0,Z.jsx)(z,{children:Ie.map(e=>(0,Z.jsx)(R,{value:e.value,children:(0,Z.jsx)(`span`,{className:e.className,children:e.label})},e.value))})]})]})]}),(0,Z.jsxs)(h,{className:`w-full`,gap:`sm`,justify:`between`,children:[(0,Z.jsx)(`div`,{className:`shrink-0`,children:`Body font`}),(0,Z.jsxs)(I,{className:`max-w-[200px]`,children:[(0,Z.jsx)(N,{className:`sr-only`,children:`Body font`}),(0,Z.jsxs)(H,{value:e.body_font_category,onValueChange:e=>i({body_font_category:e}),children:[(0,Z.jsx)(B,{"aria-label":`Body font`,"data-testid":`body-font-select`,children:(0,Z.jsx)(V,{})}),(0,Z.jsx)(z,{children:je.map(e=>(0,Z.jsx)(R,{value:e.value,children:(0,Z.jsx)(`span`,{className:e.className,children:e.label})},e.value))})]})]})]})]})]}),(0,Z.jsxs)(A,{className:`mt-8`,children:[(0,Z.jsx)(F,{className:`text-lg! font-semibold`,children:`Header`}),(0,Z.jsxs)(k,{children:[(0,Z.jsx)(`div`,{className:`mb-1`,children:(0,Z.jsx)(X,{direction:`rtl`,eyedropper:!0,swatches:[{value:`transparent`,title:`Transparent`,hex:`#00000000`}],title:`Header background color`,value:e.header_background_color||`transparent`,onChange:e=>i({header_background_color:e})})}),(0,Z.jsx)(`div`,{className:`mb-1`,children:(0,Z.jsx)(X,{direction:`rtl`,eyedropper:!0,swatches:[{value:null,title:`Auto`,hex:Ne()?`#ffffff`:`#000000`},{value:`accent`,title:`Accent`,hex:T.accent_color}],title:`Post title color`,value:e.post_title_color,onChange:e=>i({post_title_color:e})})}),(0,Z.jsxs)(h,{className:`w-full`,gap:`sm`,justify:`between`,children:[(0,Z.jsx)(`div`,{children:`Title alignment`}),(0,Z.jsx)($,{label:`Title alignment`,options:[{value:`left`,label:`Left`,icon:(0,Z.jsx)(y,{className:`size-3.5!`}),disabled:!e.show_post_title_section},{value:`center`,label:`Center`,icon:(0,Z.jsx)(b,{className:`size-3.5!`}),disabled:!e.show_post_title_section}],value:e.title_alignment,onValueChange:e=>i({title_alignment:e})})]})]})]}),(0,Z.jsxs)(A,{className:`mt-8`,children:[(0,Z.jsx)(F,{className:`text-lg! font-semibold`,children:`Body`}),(0,Z.jsxs)(k,{children:[(0,Z.jsx)(`div`,{className:`mb-1`,children:(0,Z.jsx)(X,{direction:`rtl`,eyedropper:!0,swatches:[{value:null,title:`Auto`,hex:Ne()?`#ffffff`:`#000000`},{value:`accent`,title:`Accent`,hex:T.accent_color}],title:`Section title color`,value:e.section_title_color,onChange:e=>i({section_title_color:e})})}),(0,Z.jsx)(`div`,{className:`mb-1`,children:(0,Z.jsx)(X,{direction:`rtl`,eyedropper:!0,swatches:[{value:`accent`,title:`Accent`,hex:T.accent_color},{value:null,title:`Auto`,hex:Ne()?`#ffffff`:`#000000`}],title:`Button color`,value:e.button_color,onChange:e=>i({button_color:e})})}),(0,Z.jsxs)(h,{className:`w-full`,gap:`sm`,justify:`between`,children:[(0,Z.jsx)(`div`,{children:`Button style`}),(0,Z.jsx)($,{label:`Button style`,options:[{value:`fill`,label:`Fill`,icon:(0,Z.jsx)(C,{className:`size-3.5!`,fill:`currentColor`})},{value:`outline`,label:`Outline`,icon:(0,Z.jsx)(C,{className:`size-3.5!`})}],value:e.button_style||`fill`,onValueChange:e=>i({button_style:e})})]}),(0,Z.jsxs)(h,{className:`w-full`,gap:`sm`,justify:`between`,children:[(0,Z.jsx)(`div`,{children:`Button corners`}),(0,Z.jsx)($,{label:`Button corners`,options:[{value:`square`,label:`Squared`,icon:(0,Z.jsx)(w,{className:`size-3.5!`})},{value:`rounded`,label:`Rounded`,icon:(0,Z.jsx)(C,{className:`size-3.5!`})},{value:`pill`,label:`Pill`,icon:(0,Z.jsx)(ee,{className:`size-3.5!`})}],value:e.button_corners||`rounded`,onValueChange:e=>i({button_corners:e})})]}),(0,Z.jsx)(`div`,{className:`mb-1`,children:(0,Z.jsx)(X,{direction:`rtl`,eyedropper:!0,swatches:[{value:`accent`,title:`Accent`,hex:T.accent_color},{value:null,title:`Auto`,hex:Ne()?`#ffffff`:`#000000`}],title:`Link color`,value:e.link_color,onChange:e=>i({link_color:e})})}),(0,Z.jsxs)(h,{className:`w-full`,gap:`sm`,justify:`between`,children:[(0,Z.jsx)(`div`,{children:`Link style`}),(0,Z.jsx)($,{label:`Link style`,options:[{value:`underline`,label:`Underline`,icon:(0,Z.jsx)(ne,{className:`size-3.5!`})},{value:`regular`,label:`Regular`,icon:(0,Z.jsx)(S,{className:`size-3.5!`})},{value:`bold`,label:`Bold`,icon:(0,Z.jsx)(v,{className:`size-3.5!`})}],value:e.link_style||`underline`,onValueChange:e=>i({link_style:e})})]}),(0,Z.jsxs)(h,{className:`w-full`,gap:`sm`,justify:`between`,children:[(0,Z.jsx)(`div`,{children:`Image corners`}),(0,Z.jsx)($,{label:`Image corners`,options:[{value:`square`,label:`Squared`,icon:(0,Z.jsx)(w,{className:`size-3.5!`})},{value:`rounded`,label:`Rounded`,icon:(0,Z.jsx)(C,{className:`size-3.5!`})}],value:e.image_corners||`square`,onValueChange:e=>i({image_corners:e})})]}),(0,Z.jsx)(`div`,{className:`mb-1`,children:(0,Z.jsx)(X,{direction:`rtl`,eyedropper:!0,swatches:[{value:`light`,title:`Light`,hex:`#e0e7eb`},{value:`accent`,title:`Accent`,hex:T.accent_color}],title:`Divider color`,value:e.divider_color||`light`,onChange:e=>i({divider_color:e})})})]})]})]})}];return(0,Z.jsx)(`div`,{className:`flex flex-col`,children:(0,Z.jsx)(`div`,{className:`px-7 pt-0 pb-7`,children:(0,Z.jsxs)(oe,{value:G,variant:`underline`,onValueChange:e=>{ce(e)},children:[(0,Z.jsx)(ae,{className:`sticky top-0 z-50 bg-surface-elevated-2`,children:Le.map(e=>(0,Z.jsx)(re,{value:e.id,children:e.title},e.id))}),Le.map(e=>(0,Z.jsx)(ie,{value:e.id,children:e.contents},e.id))]})})})},Oe=({newsletter:e,onlyOne:t})=>{let{config:r}=Y(),{mutateAsync:i}=de(),{updateRoute:c}=_e(),u=pe(`automations`)?`emails`:`newsletters`,{formState:d,saveState:f,updateForm:p,setFormState:m,handleSave:h,validate:g,errors:_,clearError:v,okProps:y}=o({initialState:e,savingDelay:500,onSave:async()=>{let{meta:{sent_email_verification:[e]=[]}={}}=await i(d),t;(e&&e===`sender_email`||e&&e===`sender_reply_to`)&&(t=(0,Z.jsx)(`div`,{children:`We‘ve sent a confirmation email to the new address.`})),t&&a.info(t)},onSaveError:n(),onValidate:()=>{let e={};return d.name||(e.name=`A name is required for your newsletter`),d.sender_email&&!Te.default.isEmail(d.sender_email)?e.sender_email=`Enter a valid email address`:d.sender_email&&l(r)&&d.sender_email.split(`@`)[1]!==s(r)&&(e.sender_email=`Email address must end with @${s(r)}`),d.sender_reply_to&&!Te.default.isEmail(d.sender_reply_to)&&![`newsletter`,`support`].includes(d.sender_reply_to)&&(e.sender_reply_to=`Enter a valid email address`),e}}),b=e=>{p(t=>({...t,...e}))};(0,Q.useEffect)(()=>{m(()=>e)},[m,e]);let x=(0,Z.jsx)(we,{newsletter:d}),S=(0,Z.jsx)(De,{clearError:v,errors:_,newsletter:d,onlyOne:t,updateNewsletter:b,validate:g});return(0,Z.jsx)(Se,{buttonsDisabled:y.disabled,cancelLabel:`Close`,dirty:f===`unsaved`,okLabel:y.label||`Save`,okVariant:y.variant,preview:x,previewBgColor:`grey`,previewToolbar:!1,sidebar:S,sidebarPadding:!1,testId:`newsletter-modal`,title:`Newsletter`,onClose:()=>c(u),onOk:async()=>{await h({fakeWhenUnchanged:!0})}})},ke=()=>{let{newsletterId:e}=u(),{data:{newsletters:t,isEnd:n}={},fetchNextPage:r}=fe(),i=t?.find(({id:t})=>t===e);return(0,Q.useEffect)(()=>{!i&&!n&&r()},[r,n,i]),i?(0,Z.jsx)(Oe,{newsletter:i,onlyOne:t.length===1}):null};export{ke as default};
|
|
1
|
+
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`5402b3ff-d02f-49e0-9352-f0d3a0aa9a6d`,e._sentryDebugIdIdentifier=`sentry-dbid-5402b3ff-d02f-49e0-9352-f0d3a0aa9a6d`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{g as n,y as r}from"./hooks-0r7qxGEo.js";import{t as i}from"./jsx-runtime-Bm2_KH-0.js";import{n as a}from"./dist-pogVoW2G.js";import{t as o}from"./use-form-ElCUnbKi.js";import{a as s,i as c,r as l}from"./config-CRAZ4Civ.js";import{h as u}from"./chunk-OB3PAWPO-D3muQBsq.js";import{Z as d,a as f,i as p,s as m}from"./shade-provider-DvrXKKQZ.js";import{t as h}from"./inline-Qoyy4r2g.js";import{t as g}from"./stack-C3OmgpUv.js";import{A as _,Cr as v,N as y,P as b,Rt as x,S,U as C,W as w,Z as T,gn as E,k as D,qn as ee,t as te,x as ne}from"./button-CTHYSI-d.js";import{t as O}from"./use-limiter-gF219BEg.js";import{a as k,c as A,i as j,n as M,o as N,r as P,s as F,t as I}from"./field-DCPPrQDr.js";import{t as L}from"./input-BHb2A_DU.js";import{i as R,n as z,o as B,s as V,t as H}from"./select-DeloOYCg.js";import{t as U}from"./switch-BppWscjz.js";import{i as re,n as ie,r as ae,t as oe}from"./tabs-fHs3A8WC.js";import{t as se}from"./textarea-B_rfKtjs.js";import{n as W,t as G}from"./toggle-group-BFWCtH3p.js";import{a as ce,i as le,r as ue,t as K}from"./newsletter-emails-DicgmnMU.js";import{i as de,r as fe}from"./newsletters-CACa0VCx.js";import{B as pe,Ht as me,Ut as q,i as J,st as he}from"./index-RuRs_qGS.js";import{t as ge}from"./validator-DgUCXsE8.js";import{t as _e}from"./use-settings-navigation-CO2nUqDW.js";import{n as ve}from"./confirmation-context-By_jX_cA.js";import{n as Y}from"./global-data-context-ogIy0FUG.js";import{t as ye}from"./use-upgrade-route-C-V-Xfak.js";import{t as be}from"./use-setting-group-YP84CqrJ.js";import{t as X}from"./color-picker-field-DGe9HH6W.js";import{t as xe}from"./html-field-vTe2q1be.js";import{t as Se}from"./preview-modal-BrZza3R_.js";``+new URL(`user-cover-yM4cP_Mo.jpg`,import.meta.url).href,``+new URL(`latest-posts-1-D7-ilqhR.jpg`,import.meta.url).href,``+new URL(`latest-posts-2-BPfbGB8B.jpg`,import.meta.url).href,``+new URL(`latest-posts-3-D72O3dn8.jpg`,import.meta.url).href;var Z=i(),Ce=({senderName:e,senderEmail:t,senderReplyTo:n,headerImage:r,headerIcon:i,headerTitle:a,headerSubtitle:o,showPostTitleSection:s,showExcerpt:l,titleAlignment:u,titleFontCategory:f,titleFontWeight:p,bodyFontCategory:m,authorPlaceholder:h,showCommentCta:g,showFeatureImage:v,showFeedback:y,showShareButton:b,showLatestPosts:S,showSubscriptionDetails:C,siteTitle:w,footerContent:E,showBadge:ee,backgroundColor:te,headerBackgroundColor:ne,accentColor:O,textColor:k,secondaryTextColor:A,headerTextColor:j,secondaryHeaderTextColor:M,postTitleColor:N,sectionTitleColor:P,dividerColor:F,buttonColor:I,buttonTextColor:L,linkColor:R,buttonCorners:z,buttonStyle:B,imageCorners:V,linkStyle:H,dividerStyle:U})=>{let re=i||a,{config:ie}=Y(),ae=new Date().toLocaleDateString(`default`,{year:`numeric`,month:`short`,day:`numeric`}),oe=new Date().getFullYear(),se=E?E.replace(/<a/g,`<a target="_blank" rel="noopener noreferrer"`):``,W;W=c(ie)?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`leading-normal`,children:[(0,Z.jsx)(`span`,{className:`font-semibold text-gray-900`,children:`From: `}),(0,Z.jsxs)(`span`,{children:[e,` (`,t,`)`]})]}),(0,Z.jsxs)(`p`,{className:`leading-normal`,children:[(0,Z.jsx)(`span`,{className:`font-semibold text-gray-900`,children:`Reply-to: `}),n||t]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`leading-normal`,children:[(0,Z.jsx)(`span`,{className:`font-semibold text-gray-900`,children:e}),(0,Z.jsxs)(`span`,{children:[` `,t]})]}),(0,Z.jsxs)(`p`,{className:`leading-normal`,children:[(0,Z.jsx)(`span`,{className:`font-semibold text-gray-900`,children:`To:`}),` Jamie Larson jamie@example.com`]})]});let G=`mb-5 text-pretty leading-[1.7] text-black`;return G=f===`serif`&&m===`serif`?d(G,`mb-8 font-serif text-[2.0rem] leading-tight`):f!==`serif`&&m===`serif`?d(G,`mb-8 text-[1.7rem] leading-tight tracking-tight`):f===`serif`&&m!==`serif`?d(G,`mb-8 font-serif text-[2.0rem] leading-tight`):d(G,`mb-8 text-[1.9rem] leading-tight tracking-tight`),u===`center`&&(G=d(G,`text-center`)),(0,Z.jsx)(`div`,{className:`relative flex grow flex-col`,children:(0,Z.jsx)(`div`,{className:`absolute inset-0 m-5 flex items-center justify-center`,children:(0,Z.jsxs)(`div`,{className:`mx-auto my-0 flex max-h-full w-full max-w-[700px] flex-col overflow-hidden rounded-[4px] text-black shadow-sm`,children:[(0,Z.jsx)(`div`,{className:`flex min-h-[77px] flex-col justify-center gap-1 rounded-t-sm border-b border-gray-200 bg-white px-6 text-gray-700`,children:W}),(0,Z.jsxs)(`div`,{className:`overflow-y-auto`,style:{backgroundColor:te},children:[(0,Z.jsxs)(`div`,{className:`px-[7rem]`,style:{backgroundColor:ne},children:[r&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(`img`,{alt:``,className:`mb-4 block pt-6`,src:r})}),re&&(0,Z.jsxs)(`div`,{className:`py-3`,children:[i&&(0,Z.jsx)(`img`,{alt:``,className:`mx-auto mb-2 size-10`,role:`presentation`,src:i}),a&&(0,Z.jsx)(`h4`,{className:`mb-1 text-center text-[1.6rem] leading-tight font-bold tracking-tight text-gray-900 uppercase`,style:{color:j},children:a}),o&&(0,Z.jsx)(`h5`,{className:`mb-1 text-center text-[1.3rem] font-normal text-gray-700`,style:{color:M},children:o})]}),s&&(0,Z.jsxs)(`div`,{className:d(`flex flex-col py-8`,u===`center`?`items-center`:`items-start`),children:[(0,Z.jsx)(`h2`,{className:d(`text-4xl leading-supertight font-bold text-black`,f===`serif`&&`font-serif`,p===`normal`&&`font-normal`,p===`medium`&&`font-medium`,p===`semibold`&&`font-semibold`,p===`bold`&&`font-bold`,u===`center`?`text-center`:`text-left`,l?`mb-2`:`mb-8`),style:{color:N},children:`Your email newsletter`}),l&&(0,Z.jsx)(`p`,{className:G,style:{color:j},children:`A subtitle to highlight key points and engage your readers.`}),(0,Z.jsxs)(`div`,{className:d(`flex w-full justify-between text-center text-md leading-none text-gray-700`,u===`center`?`flex-col gap-1`:`flex-row`),children:[(0,Z.jsxs)(`p`,{className:`pb-1 text-[1.3rem]`,style:{color:M},children:[`By `,h,(0,Z.jsx)(`span`,{className:`before:pr-1 before:pl-0.5 before:content-['•']`,children:ae})]}),(0,Z.jsx)(`p`,{className:`pb-1 text-[1.3rem] underline`,style:{color:M},children:(0,Z.jsx)(`span`,{children:`View in browser`})})]})]}),v&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:d(`h-[unset] w-full max-w-[600px] bg-cover bg-no-repeat`,s?``:`pt-6`),children:(0,Z.jsx)(`img`,{alt:`Feature`,className:d(`min-h-full min-w-full shrink-0`,V===`square`&&`rounded-none`,V===`rounded`&&`rounded-md`),src:``+new URL(`user-cover-yM4cP_Mo.jpg`,import.meta.url).href})}),(0,Z.jsx)(`div`,{className:`mt-1 w-full max-w-[600px] pb-8 text-center text-[1.3rem] text-gray-700`,style:{color:M},children:`Feature image caption`})]})]}),(0,Z.jsxs)(`div`,{className:d(`px-[7rem]`,ne!==`transparent`&&`pt-10`),children:[(0,Z.jsxs)(`div`,{className:d(`max-w-[600px] border-b border-gray-200 pb-[52px] leading-[27.2px] text-black`,U===`dashed`&&`border-dashed`,U===`dotted`&&`border-b-2 border-dotted`,m===`serif`?`font-serif text-[1.8rem]`:`text-[1.7rem] tracking-tight`,v||s?``:`pt-8`),style:{borderColor:F},children:[(0,Z.jsx)(`p`,{className:`mb-6`,style:{color:k},children:`This is what your content will look like when you send one of your posts as an email newsletter to your subscribers.`}),(0,Z.jsx)(`p`,{className:`mb-6`,style:{color:k},children:`Over there on the right you'll see some settings that allow you to customize the look and feel of this template – from colors and typography to layout and buttons – to make it perfectly suited to your brand.`}),(0,Z.jsx)(`p`,{className:`mb-[52px]`,style:{color:k},children:`Email templates are exceptionally finnicky to make, but we've spent a long time optimising this one to make it work beautifully across devices, email clients and content types. So, you can trust that every email you send with Ghost will look great and work well. Just like the rest of your site.`}),(0,Z.jsx)(`hr`,{className:d(`my-[52px] border-[#e0e7eb]`,U===`dashed`&&`border-dashed`,U===`dotted`&&`border-t-0 border-b-2 border-dotted`),style:{borderColor:F}}),(0,Z.jsx)(`h3`,{className:d(`mb-[13px] text-[2.6rem] leading-supertight`,f===`serif`&&`font-serif`,f===`sans_serif`&&`font-sans`,p===`normal`&&`font-normal`,p===`medium`&&`font-medium`,p===`semibold`&&`font-semibold`,p===`bold`&&`font-bold`),style:{color:P},children:`Need inspiration?`}),(0,Z.jsxs)(`p`,{className:`mb-[27px]`,style:{color:k},children:[`We've put together a`,` `,(0,Z.jsx)(`a`,{className:d(H===`underline`&&`underline`,H===`bold`&&`font-bold`),href:`https://ghost.org/help/email-design/`,rel:`noopener noreferrer`,style:{color:R||O},target:`_blank`,children:`quick guide`}),` `,`that walks through all of the available settings, along with a few examples of what's possible.`]}),(0,Z.jsx)(`a`,{className:d(`inline-block border px-[18px] py-2 font-sans text-[15px]`,z===`rounded`&&`rounded-[6px]`,z===`pill`&&`rounded-full`,z===`square`&&`rounded-none`,B===`outline`?`bg-transparent`:`border-transparent text-white`,H===`bold`?`font-bold`:`font-semibold`),href:`https://ghost.org/help/email-design/`,rel:`noopener noreferrer`,style:B===`outline`?{borderColor:I||O,color:I||O}:{backgroundColor:I||O,color:L},target:`_blank`,children:`Learn more`})]}),(y||g||b)&&(0,Z.jsx)(`div`,{className:d(`grid gap-5 border-b border-gray-200 px-6 py-5`,U===`dashed`&&`border-dashed`,U===`dotted`&&`border-b-2 border-dotted`),style:{borderColor:F},children:(0,Z.jsxs)(`div`,{className:`grid auto-cols-fr grid-flow-col gap-4`,children:[y&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`pointer-events-none flex min-w-[120px] cursor-default flex-col items-center gap-[11px] text-center`,children:[(0,Z.jsx)(`span`,{className:`inline-flex size-[54px] items-center justify-center rounded-full border`,style:{borderColor:F,color:k},children:(0,Z.jsx)(D,{className:`size-5`})}),(0,Z.jsx)(`span`,{className:`font-sans text-[1.3rem] leading-[1.4] font-medium`,style:{color:k},children:`More like this`})]}),(0,Z.jsxs)(`div`,{className:`pointer-events-none flex min-w-[120px] cursor-default flex-col items-center gap-[11px] text-center`,children:[(0,Z.jsx)(`span`,{className:`inline-flex size-[54px] items-center justify-center rounded-full border`,style:{borderColor:F,color:k},children:(0,Z.jsx)(_,{className:`size-5`})}),(0,Z.jsx)(`span`,{className:`font-sans text-[1.3rem] leading-[1.4] font-medium`,style:{color:k},children:`Less like this`})]})]}),g&&(0,Z.jsxs)(`div`,{className:`pointer-events-none flex min-w-[120px] cursor-default flex-col items-center gap-[11px] text-center`,children:[(0,Z.jsx)(`span`,{className:`inline-flex size-[54px] items-center justify-center rounded-full border`,style:{borderColor:F,color:k},children:(0,Z.jsx)(x,{className:`size-5`})}),(0,Z.jsx)(`span`,{className:`font-sans text-[1.3rem] leading-[1.4] font-medium`,style:{color:k},children:`Comment`})]}),b&&(0,Z.jsxs)(`div`,{className:`pointer-events-none flex min-w-[120px] cursor-default flex-col items-center gap-[11px] text-center`,children:[(0,Z.jsx)(`span`,{className:`inline-flex size-[54px] items-center justify-center rounded-full border`,style:{borderColor:F,color:k},children:(0,Z.jsx)(T,{className:`size-5`})}),(0,Z.jsx)(`span`,{className:`font-sans text-[1.3rem] leading-[1.4] font-medium`,style:{color:k},children:`Share`})]})]})}),S&&(0,Z.jsxs)(`div`,{className:d(`border-b border-gray-200 py-6`,U===`dashed`&&`border-dashed`,U===`dotted`&&`border-b-2 border-dotted`),style:{borderColor:F},children:[(0,Z.jsx)(`h3`,{className:`mt-2 mb-4 pb-1 text-[1.2rem] font-semibold tracking-wide text-black uppercase`,style:{color:k},children:`Keep reading`}),(0,Z.jsxs)(`div`,{className:`flex justify-between gap-4 py-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:d(`mt-0.5 text-[1.9rem] text-black`,f===`serif`&&`font-serif`,p===`normal`&&`font-normal`,p===`medium`&&`font-medium`,p===`semibold`&&`font-semibold`,p===`bold`&&`font-bold`),style:{color:P},children:`The three latest posts published on your site`}),(0,Z.jsx)(`p`,{className:`m-0 text-base text-gray-700`,style:{color:A},children:`Posts sent as an email only will never be shown here.`})]}),(0,Z.jsx)(`div`,{className:`aspect-square h-auto w-full max-w-[100px] bg-cover bg-no-repeat`,children:(0,Z.jsx)(`img`,{alt:`Latest post`,className:d(V===`square`&&`rounded-none`,V===`rounded`&&`rounded-md`),src:``+new URL(`latest-posts-1-D7-ilqhR.jpg`,import.meta.url).href})})]}),(0,Z.jsxs)(`div`,{className:`flex justify-between gap-4 py-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:d(`mt-0.5 text-[1.9rem] text-black`,f===`serif`&&`font-serif`,p===`normal`&&`font-normal`,p===`medium`&&`font-medium`,p===`semibold`&&`font-semibold`,p===`bold`&&`font-bold`),style:{color:P},children:`Displayed at the bottom of each newsletter`}),(0,Z.jsx)(`p`,{className:`m-0 text-base text-gray-700`,style:{color:A},children:`Giving your readers one more place to discover your stories.`})]}),(0,Z.jsx)(`div`,{className:`aspect-square h-auto w-full max-w-[100px] bg-cover bg-no-repeat`,children:(0,Z.jsx)(`img`,{alt:`Latest post`,className:d(V===`square`&&`rounded-none`,V===`rounded`&&`rounded-md`),src:``+new URL(`latest-posts-2-BPfbGB8B.jpg`,import.meta.url).href})})]}),(0,Z.jsxs)(`div`,{className:`flex justify-between gap-4 py-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:d(`mt-0.5 text-[1.9rem] text-black`,f===`serif`&&`font-serif`,p===`normal`&&`font-normal`,p===`medium`&&`font-medium`,p===`semibold`&&`font-semibold`,p===`bold`&&`font-bold`),style:{color:P},children:`To keep your work front and center`}),(0,Z.jsx)(`p`,{className:`m-0 text-base text-gray-700`,style:{color:A},children:`Making sure that your audience stays engaged.`})]}),(0,Z.jsx)(`div`,{className:`aspect-square h-auto w-full max-w-[100px] bg-cover bg-no-repeat`,children:(0,Z.jsx)(`img`,{alt:`Latest post`,className:d(V===`square`&&`rounded-none`,V===`rounded`&&`rounded-md`),src:``+new URL(`latest-posts-3-D72O3dn8.jpg`,import.meta.url).href})})]})]}),C&&(0,Z.jsxs)(`div`,{className:d(`border-b border-gray-200 py-8`,U===`dashed`&&`border-dashed`,U===`dotted`&&`border-b-2 border-dotted`),style:{borderColor:F},children:[(0,Z.jsx)(`h4`,{className:`mb-3 text-[1.2rem] tracking-wide text-black uppercase`,style:{color:k},children:`Subscription details`}),(0,Z.jsxs)(`p`,{className:`m-0 mb-4 text-base`,style:{color:k},children:[`You are receiving this because you are a paid subscriber to `,w,`. Your subscription will renew on 17 Jul 2024.`]}),(0,Z.jsxs)(`div`,{className:`flex`,children:[(0,Z.jsxs)(`div`,{className:`shrink-0 text-base`,children:[(0,Z.jsx)(`p`,{style:{color:k},children:`Name: Jamie Larson`}),(0,Z.jsx)(`p`,{style:{color:k},children:`Email: jamie@example.com`}),(0,Z.jsx)(`p`,{style:{color:k},children:`Member since: 17 July 2023`})]}),(0,Z.jsx)(`span`,{className:d(`w-full self-end text-right text-base whitespace-nowrap`,H===`underline`&&`underline`,H===`bold`&&`font-bold`),style:{color:R||O},children:`Manage subscription`})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col items-center pt-10`,children:[(0,Z.jsx)(`div`,{dangerouslySetInnerHTML:{__html:se||``},className:`text px-8 py-3 text-center text-[1.3rem] leading-base break-words text-gray-700 [&_a]:underline`,style:{color:A}}),(0,Z.jsxs)(`div`,{className:`px-8 pt-3 pb-14 text-center text-[1.3rem] text-gray-700`,children:[(0,Z.jsxs)(`span`,{style:{color:A},children:[w,` © `,oe,` —`,` `]}),(0,Z.jsx)(`span`,{className:`pointer-events-none cursor-auto underline`,style:{color:A},children:`Unsubscribe`})]}),ee&&(0,Z.jsx)(`div`,{className:`flex flex-col items-center pt-[10px] pb-[40px]`,children:(0,Z.jsxs)(`a`,{className:`pointer-events-none inline-flex cursor-auto items-center px-2 py-1 text-[1.25rem] font-semibold tracking-tight text-gray-900`,href:`https://ghost.org`,style:{color:k},children:[(0,Z.jsx)(ce,{className:`mr-[6px] size-4`}),(0,Z.jsx)(`span`,{children:`Powered by Ghost`})]})})]})]})]})]})})})},Q=e(t(),1),we=({newsletter:e})=>{let{currentUser:t,settings:n,siteData:r,config:i}=Y(),[a,o,s,c,l]=q(n,[`title`,`icon`,`comments_enabled`,`support_email_address`,`default_email_address`]),u=null;e.show_header_title?u=a||null:e.show_header_name&&(u=e.name);let d=e.show_header_title&&e.show_header_name?e.name:void 0,f=e.show_comment_cta&&s!==`off`,p=e.feedback_enabled,m=e.show_share_button,h=()=>{let t=e.background_color;return/#([0-9a-f]{3}){1,2}$/i.test(t)?t:`#ffffff`},g=()=>{let t=e.header_background_color;return!t||t===`transparent`?`transparent`:/#([0-9a-f]{3}){1,2}$/i.test(t)?t:`transparent`},_=()=>{let t=e.button_color;return/#([0-9a-f]{3}){1,2}$/i.test(t||``)?t:t===null?J(h()).hex():r.accent_color},v=()=>{let t=e.button_style,n=_();if(n&&t===`fill`)return J(n).hex()},y=()=>{let t=e.link_color===void 0?`accent`:e.link_color;return t===`accent`?r.accent_color:/#([0-9a-f]{3}){1,2}$/i.test(t||``)?t:J(h()).hex()},b=()=>{let t=e.post_title_color;if(/#([0-9a-f]{3}){1,2}$/i.test(t||``))return t;if(t===`accent`)return r.accent_color;let n=g();return J(n===`transparent`?h():n).hex()},x=()=>{let t=e.section_title_color;return/#([0-9a-f]{3}){1,2}$/i.test(t||``)?t:t===`accent`?r.accent_color:J(h()).hex()},S=()=>{let t=e.divider_color;return/#([0-9a-f]{3}){1,2}$/i.test(t||``)?t:t===`accent`?r.accent_color:`#e0e7eb`},C=J(h()).hex(),w=J(h()).alpha(.5).toString(),T=g()===`transparent`?C:J(g()).hex(),E=g()===`transparent`?w:J(g()).alpha(.5).toString(),D={backgroundColor:h(),headerBackgroundColor:g(),postTitleColor:b()||void 0,sectionTitleColor:x()||void 0,buttonColor:_()||void 0,buttonTextColor:v()||void 0,linkColor:y()||void 0,dividerColor:S()||void 0,textColor:C,secondaryTextColor:w,headerTextColor:T,secondaryHeaderTextColor:E};return(0,Z.jsx)(Ce,{accentColor:r.accent_color,authorPlaceholder:t.name||t.email,backgroundColor:D.backgroundColor||`#ffffff`,bodyFontCategory:e.body_font_category,buttonCorners:e.button_corners||`rounded`,buttonStyle:e.button_style||`fill`,dividerStyle:e.divider_style||`solid`,footerContent:e.footer_content,headerBackgroundColor:D.headerBackgroundColor||`transparent`,headerIcon:e.show_header_icon?o:void 0,headerImage:e.header_image,headerSubtitle:d,headerTitle:u,imageCorners:e.image_corners||`square`,linkStyle:e.link_style||`underline`,senderEmail:ue(e,i,l),senderName:e.sender_name||a,senderReplyTo:K(e,i,c,l),showBadge:e.show_badge,showCommentCta:f,showExcerpt:e.show_excerpt,showFeatureImage:e.show_feature_image,showFeedback:p,showLatestPosts:e.show_latest_posts,showPostTitleSection:e.show_post_title_section,showShareButton:m,showSubscriptionDetails:e.show_subscription_details,siteTitle:a,titleAlignment:e.title_alignment,titleFontCategory:e.title_font_category,titleFontWeight:e.title_font_weight||`bold`,...D})},Te=e(ge(),1),$=({label:e,value:t,options:n,onValueChange:r})=>(0,Z.jsx)(G,{"aria-label":e,type:`single`,value:t,onValueChange:e=>e&&r(e),children:n.map(e=>(0,Z.jsxs)(p,{children:[(0,Z.jsx)(m,{asChild:!0,children:(0,Z.jsx)(W,{"aria-label":e.label,disabled:e.disabled,value:e.value,children:e.icon})}),(0,Z.jsx)(f,{children:e.label})]},e.value))}),Ee=({newsletter:e,updateNewsletter:t,errors:n,clearError:r})=>{let{settings:i,config:a}=Y(),[o,s]=q(i,[`default_email_address`,`support_email_address`]),[c,l]=(0,Q.useState)(K(e,a,s,o)||``),u=ue(e,a,o),d=(0,Q.useCallback)(e=>{l(e.target.value),t({sender_reply_to:e.target.value||`newsletter`})},[t,l]);return(0,Z.jsxs)(I,{"data-invalid":!!n.sender_reply_to||void 0,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-reply-to`,children:`Reply-to email`}),(0,Z.jsx)(L,{"aria-invalid":!!n.sender_reply_to||void 0,id:`newsletter-reply-to`,maxLength:191,placeholder:u||``,value:c,onBlur:()=>{let t=K(e,a,s,o)||``;l(t)},onChange:d,onKeyDown:()=>r(`sender_reply_to`)}),n.sender_reply_to&&(0,Z.jsx)(j,{children:n.sender_reply_to})]})},De=({newsletter:e,onlyOne:t,updateNewsletter:i,validate:o,errors:s,clearError:u})=>{let{updateRoute:d}=_e(),f=ye(),{mutateAsync:p}=de(),m=O(),{settings:_,config:x,siteData:T}=Y(),[D,W]=q(_,[`icon`,`default_email_address`]),[G,ce]=(0,Q.useState)(`generalSettings`),{localSettings:K}=be(),[pe]=q(K,[`title`]),ge=n(),{confirm:Se,showLimit:Ce}=ve(),{data:{newsletters:we}={}}=fe(),Te=[`all`,`paid`].includes(me(_,`comments_enabled`)||``),De=ue(e,x,W),[Oe,ke]=(0,Q.useState)(we||[]),Ae=Oe.filter(e=>e.status===`active`);(0,Q.useEffect)(()=>{ke(we||[])},[we]);let je=[{value:`serif`,label:`Elegant serif`,className:`font-serif`},{value:`sans_serif`,label:`Clean sans-serif`}],Me={sans_serif:{options:[{value:`normal`,label:`Regular`,className:`font-normal`},{value:`medium`,label:`Medium`,className:`font-medium`},{value:`semibold`,label:`Semi-bold`,className:`font-semibold`},{value:`bold`,label:`Bold`,className:`font-bold`}]},serif:{options:[{value:`normal`,label:`Regular`,className:`font-normal`},{value:`bold`,label:`Bold`,className:`font-bold`}],map:{medium:`normal`,semibold:`bold`}}},Ne=()=>e.background_color===`light`?!1:J(e.background_color).hex().toLowerCase()===`#ffffff`,Pe=async()=>{if(e.status===`active`)Se({title:`Archive newsletter`,prompt:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`mb-6`,children:[`Your newsletter `,(0,Z.jsx)(`strong`,{children:e.name}),` will no longer be visible to members or available as an option when publishing new posts.`]}),(0,Z.jsx)(`div`,{children:`Existing posts previously sent as this newsletter will remain unchanged.`})]}),okLabel:`Archive`,okVariant:`destructive`,onOk:async t=>{try{await p({...e,status:`archived`}),t?.remove(),a.success(`Newsletter archived`)}catch(e){ge(e)}}});else{try{await m?.errorIfWouldGoOverLimit(`newsletters`)}catch(e){if(e instanceof r){Ce({prompt:e.message||`Your current plan doesn't support more newsletters.`,onOk:()=>d({route:f,isExternal:!0})});return}else throw e}Se({title:`Reactivate newsletter`,prompt:(0,Z.jsxs)(Z.Fragment,{children:[`Reactivating `,(0,Z.jsx)(`strong`,{children:e.name}),` will immediately make it visible to members and re-enable it as an option when publishing new posts.`]}),okLabel:`Reactivate`,onOk:async t=>{await p({...e,status:`active`}),t?.remove(),a.success(`Newsletter reactivated`)}})}},Fe=()=>{if(!c(x))return(0,Z.jsxs)(I,{"data-invalid":!!s.sender_email||void 0,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-sender-email`,children:`Sender email address`}),(0,Z.jsx)(L,{"aria-invalid":!!s.sender_email||void 0,id:`newsletter-sender-email`,placeholder:De||``,value:e.sender_email||``,onChange:e=>i({sender_email:e.target.value}),onKeyDown:()=>u(`sender_email`)}),s.sender_email&&(0,Z.jsx)(j,{children:s.sender_email})]});if(l(x))return(0,Z.jsxs)(I,{"data-invalid":!!s.sender_email||void 0,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-sender-email`,children:`Sender email address`}),(0,Z.jsx)(L,{"aria-invalid":!!s.sender_email||void 0,id:`newsletter-sender-email`,maxLength:191,placeholder:W,value:e.sender_email||``,onChange:e=>{i({sender_email:e.target.value})},onKeyDown:()=>u(`sender_email`)}),s.sender_email&&(0,Z.jsx)(j,{children:s.sender_email})]})},Ie=Me[e.title_font_category||`sans_serif`].options,Le=[{id:`generalSettings`,title:`General`,contents:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(A,{className:`mt-8`,children:[(0,Z.jsx)(F,{className:`text-lg! font-semibold`,children:`Name and description`}),(0,Z.jsxs)(k,{children:[(0,Z.jsxs)(I,{"data-invalid":!!s.name||void 0,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-detail-name`,children:`Name`}),(0,Z.jsx)(L,{"aria-invalid":!!s.name||void 0,id:`newsletter-detail-name`,maxLength:191,placeholder:`Weekly Roundup`,value:e.name||``,onChange:e=>i({name:e.target.value}),onKeyDown:()=>u(`name`)}),s.name&&(0,Z.jsx)(j,{children:s.name})]}),(0,Z.jsxs)(I,{children:[(0,Z.jsx)(N,{htmlFor:`newsletter-description`,children:`Description`}),(0,Z.jsx)(se,{id:`newsletter-description`,maxLength:2e3,rows:2,value:e.description||``,onChange:e=>i({description:e.target.value})})]})]})]}),(0,Z.jsxs)(A,{className:`mt-8`,children:[(0,Z.jsx)(F,{className:`text-lg! font-semibold`,children:`Email info`}),(0,Z.jsxs)(k,{children:[(0,Z.jsxs)(I,{children:[(0,Z.jsx)(N,{htmlFor:`newsletter-sender-name`,children:`Sender name`}),(0,Z.jsx)(L,{id:`newsletter-sender-name`,maxLength:191,placeholder:pe,value:e.sender_name||``,onChange:e=>i({sender_name:e.target.value})})]}),Fe(),(0,Z.jsx)(Ee,{clearError:u,errors:s,newsletter:e,updateNewsletter:i,validate:o})]})]}),(0,Z.jsxs)(A,{className:`mt-8`,children:[(0,Z.jsx)(F,{className:`text-lg! font-semibold`,children:`Member settings`}),(0,Z.jsx)(k,{children:(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-subscribe-on-signup`,children:`Subscribe new members on signup`}),(0,Z.jsx)(U,{checked:!!e.subscribe_on_signup,id:`newsletter-subscribe-on-signup`,onCheckedChange:e=>i({subscribe_on_signup:e})})]})})]}),(0,Z.jsx)(`div`,{className:`mt-10 mb-5`,children:e.status===`active`?!t&&(0,Z.jsx)(te,{disabled:Ae.length===1,type:`button`,variant:`destructive-ghost`,onClick:()=>void Pe(),children:`Archive newsletter`}):(0,Z.jsx)(te,{className:`text-green hover:text-green`,type:`button`,variant:`ghost`,onClick:()=>void Pe(),children:`Reactivate newsletter`})})]})},{id:`content`,title:`Content`,contents:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(A,{className:`mt-8`,children:[(0,Z.jsx)(F,{className:`text-lg! font-semibold`,children:`Header`}),(0,Z.jsxs)(k,{children:[(0,Z.jsx)(le,{inputId:`newsletter-header-image`,value:e.header_image||``,onChange:e=>i({header_image:e||null}),onUploadError:ge}),(0,Z.jsxs)(g,{gap:`md`,children:[D&&(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-show-header-icon`,children:`Publication icon`}),(0,Z.jsx)(U,{checked:!!e.show_header_icon,id:`newsletter-show-header-icon`,onCheckedChange:e=>i({show_header_icon:e})})]}),(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-show-header-title`,children:`Publication title`}),(0,Z.jsx)(U,{checked:!!e.show_header_title,id:`newsletter-show-header-title`,onCheckedChange:e=>i({show_header_title:e})})]}),(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-show-header-name`,children:`Newsletter name`}),(0,Z.jsx)(U,{checked:!!e.show_header_name,id:`newsletter-show-header-name`,onCheckedChange:e=>i({show_header_name:e})})]})]})]})]}),(0,Z.jsxs)(A,{className:`mt-8`,children:[(0,Z.jsx)(F,{className:`text-lg! font-semibold`,children:`Title section`}),(0,Z.jsxs)(k,{children:[(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-show-post-title`,children:`Post title`}),(0,Z.jsx)(U,{checked:!!e.show_post_title_section,id:`newsletter-show-post-title`,onCheckedChange:e=>i({show_post_title_section:e})})]}),e.show_post_title_section&&(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-show-excerpt`,children:`Post excerpt`}),(0,Z.jsx)(U,{checked:!!e.show_excerpt,id:`newsletter-show-excerpt`,onCheckedChange:e=>i({show_excerpt:e})})]}),(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-show-feature-image`,children:`Feature image`}),(0,Z.jsx)(U,{checked:!!e.show_feature_image,id:`newsletter-show-feature-image`,onCheckedChange:e=>i({show_feature_image:e})})]})]})]}),(0,Z.jsxs)(A,{className:`mt-8`,children:[(0,Z.jsx)(F,{className:`text-lg! font-semibold`,children:`Footer`}),(0,Z.jsxs)(k,{children:[(0,Z.jsxs)(g,{gap:`lg`,children:[(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-feedback-enabled`,children:`Ask your readers for feedback`}),(0,Z.jsx)(U,{checked:!!e.feedback_enabled,id:`newsletter-feedback-enabled`,onCheckedChange:e=>i({feedback_enabled:e})})]}),Te&&(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-show-comment-cta`,children:`Add a link to your comments`}),(0,Z.jsx)(U,{checked:!!e.show_comment_cta,id:`newsletter-show-comment-cta`,onCheckedChange:e=>i({show_comment_cta:e})})]}),(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-show-share-button`,children:`Show share button`}),(0,Z.jsx)(U,{checked:!!e.show_share_button,id:`newsletter-show-share-button`,onCheckedChange:e=>i({show_share_button:e})})]}),(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-show-latest-posts`,children:`Share your latest posts`}),(0,Z.jsx)(U,{checked:!!e.show_latest_posts,id:`newsletter-show-latest-posts`,onCheckedChange:e=>i({show_latest_posts:e})})]}),(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsx)(N,{htmlFor:`newsletter-show-subscription-details`,children:`Show subscription details`}),(0,Z.jsx)(U,{checked:!!e.show_subscription_details,id:`newsletter-show-subscription-details`,onCheckedChange:e=>i({show_subscription_details:e})})]})]}),(0,Z.jsx)(xe,{hint:`Any extra information or legal text`,nodes:`MINIMAL_NODES`,placeholder:` `,title:`Email footer`,value:e.footer_content||``,onChange:e=>i({footer_content:e})})]})]}),(0,Z.jsx)(he,{className:`mt-8`}),(0,Z.jsxs)(`div`,{className:`my-5 flex w-full items-start`,children:[(0,Z.jsx)(`span`,{children:(0,Z.jsx)(E,{className:`mt-[-1px] mr-2 size-5 text-red`})}),(0,Z.jsx)(k,{className:`gap-8`,children:(0,Z.jsxs)(I,{orientation:`horizontal`,children:[(0,Z.jsxs)(M,{children:[(0,Z.jsx)(N,{htmlFor:`newsletter-show-badge`,children:`Promote independent publishing`}),(0,Z.jsx)(P,{children:`Show you're a part of the indie publishing movement with a small badge in the footer`})]}),(0,Z.jsx)(U,{checked:!!e.show_badge,id:`newsletter-show-badge`,onCheckedChange:e=>i({show_badge:e})})]})})]})]})},{id:`design`,title:`Design`,contents:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(A,{className:`mt-8`,children:[(0,Z.jsx)(F,{className:`text-lg! font-semibold`,children:`Global`}),(0,Z.jsxs)(k,{children:[(0,Z.jsx)(`div`,{className:`mb-1`,children:(0,Z.jsx)(X,{direction:`rtl`,eyedropper:!0,swatches:[{hex:`#ffffff`,value:`light`,title:`White`}],title:`Background color`,value:e.background_color||`light`,onChange:e=>i({background_color:e})})}),(0,Z.jsxs)(h,{className:`w-full`,gap:`sm`,justify:`between`,children:[(0,Z.jsx)(`div`,{className:`shrink-0`,children:`Heading font`}),(0,Z.jsxs)(I,{className:`max-w-[200px]`,children:[(0,Z.jsx)(N,{className:`sr-only`,children:`Heading font`}),(0,Z.jsxs)(H,{value:e.title_font_category,onValueChange:t=>{let n=e.title_font_weight,r=n;return Me[t].options.find(e=>e.value===n)||(r=Me[t].map?.[n]||`bold`),i({title_font_category:t,title_font_weight:r})},children:[(0,Z.jsx)(B,{"aria-label":`Heading font`,children:(0,Z.jsx)(V,{})}),(0,Z.jsx)(z,{children:je.map(e=>(0,Z.jsx)(R,{value:e.value,children:(0,Z.jsx)(`span`,{className:e.className,children:e.label})},e.value))})]})]})]}),(0,Z.jsxs)(h,{className:`w-full`,gap:`sm`,justify:`between`,children:[(0,Z.jsx)(`div`,{className:`shrink-0`,children:`Heading weight`}),(0,Z.jsxs)(I,{className:`max-w-[200px]`,children:[(0,Z.jsx)(N,{className:`sr-only`,children:`Heading weight`}),(0,Z.jsxs)(H,{value:(()=>{let t=e.title_font_category||`sans_serif`,n=e.title_font_weight,r=Me[t].map,i=r&&r[n]||n;return Ie.find(e=>e.value===i)||Ie[0]})().value,onValueChange:e=>i({title_font_weight:e}),children:[(0,Z.jsx)(B,{"aria-label":`Heading weight`,children:(0,Z.jsx)(V,{})}),(0,Z.jsx)(z,{children:Ie.map(e=>(0,Z.jsx)(R,{value:e.value,children:(0,Z.jsx)(`span`,{className:e.className,children:e.label})},e.value))})]})]})]}),(0,Z.jsxs)(h,{className:`w-full`,gap:`sm`,justify:`between`,children:[(0,Z.jsx)(`div`,{className:`shrink-0`,children:`Body font`}),(0,Z.jsxs)(I,{className:`max-w-[200px]`,children:[(0,Z.jsx)(N,{className:`sr-only`,children:`Body font`}),(0,Z.jsxs)(H,{value:e.body_font_category,onValueChange:e=>i({body_font_category:e}),children:[(0,Z.jsx)(B,{"aria-label":`Body font`,"data-testid":`body-font-select`,children:(0,Z.jsx)(V,{})}),(0,Z.jsx)(z,{children:je.map(e=>(0,Z.jsx)(R,{value:e.value,children:(0,Z.jsx)(`span`,{className:e.className,children:e.label})},e.value))})]})]})]})]})]}),(0,Z.jsxs)(A,{className:`mt-8`,children:[(0,Z.jsx)(F,{className:`text-lg! font-semibold`,children:`Header`}),(0,Z.jsxs)(k,{children:[(0,Z.jsx)(`div`,{className:`mb-1`,children:(0,Z.jsx)(X,{direction:`rtl`,eyedropper:!0,swatches:[{value:`transparent`,title:`Transparent`,hex:`#00000000`}],title:`Header background color`,value:e.header_background_color||`transparent`,onChange:e=>i({header_background_color:e})})}),(0,Z.jsx)(`div`,{className:`mb-1`,children:(0,Z.jsx)(X,{direction:`rtl`,eyedropper:!0,swatches:[{value:null,title:`Auto`,hex:Ne()?`#ffffff`:`#000000`},{value:`accent`,title:`Accent`,hex:T.accent_color}],title:`Post title color`,value:e.post_title_color,onChange:e=>i({post_title_color:e})})}),(0,Z.jsxs)(h,{className:`w-full`,gap:`sm`,justify:`between`,children:[(0,Z.jsx)(`div`,{children:`Title alignment`}),(0,Z.jsx)($,{label:`Title alignment`,options:[{value:`left`,label:`Left`,icon:(0,Z.jsx)(y,{className:`size-3.5!`}),disabled:!e.show_post_title_section},{value:`center`,label:`Center`,icon:(0,Z.jsx)(b,{className:`size-3.5!`}),disabled:!e.show_post_title_section}],value:e.title_alignment,onValueChange:e=>i({title_alignment:e})})]})]})]}),(0,Z.jsxs)(A,{className:`mt-8`,children:[(0,Z.jsx)(F,{className:`text-lg! font-semibold`,children:`Body`}),(0,Z.jsxs)(k,{children:[(0,Z.jsx)(`div`,{className:`mb-1`,children:(0,Z.jsx)(X,{direction:`rtl`,eyedropper:!0,swatches:[{value:null,title:`Auto`,hex:Ne()?`#ffffff`:`#000000`},{value:`accent`,title:`Accent`,hex:T.accent_color}],title:`Section title color`,value:e.section_title_color,onChange:e=>i({section_title_color:e})})}),(0,Z.jsx)(`div`,{className:`mb-1`,children:(0,Z.jsx)(X,{direction:`rtl`,eyedropper:!0,swatches:[{value:`accent`,title:`Accent`,hex:T.accent_color},{value:null,title:`Auto`,hex:Ne()?`#ffffff`:`#000000`}],title:`Button color`,value:e.button_color,onChange:e=>i({button_color:e})})}),(0,Z.jsxs)(h,{className:`w-full`,gap:`sm`,justify:`between`,children:[(0,Z.jsx)(`div`,{children:`Button style`}),(0,Z.jsx)($,{label:`Button style`,options:[{value:`fill`,label:`Fill`,icon:(0,Z.jsx)(C,{className:`size-3.5!`,fill:`currentColor`})},{value:`outline`,label:`Outline`,icon:(0,Z.jsx)(C,{className:`size-3.5!`})}],value:e.button_style||`fill`,onValueChange:e=>i({button_style:e})})]}),(0,Z.jsxs)(h,{className:`w-full`,gap:`sm`,justify:`between`,children:[(0,Z.jsx)(`div`,{children:`Button corners`}),(0,Z.jsx)($,{label:`Button corners`,options:[{value:`square`,label:`Squared`,icon:(0,Z.jsx)(w,{className:`size-3.5!`})},{value:`rounded`,label:`Rounded`,icon:(0,Z.jsx)(C,{className:`size-3.5!`})},{value:`pill`,label:`Pill`,icon:(0,Z.jsx)(ee,{className:`size-3.5!`})}],value:e.button_corners||`rounded`,onValueChange:e=>i({button_corners:e})})]}),(0,Z.jsx)(`div`,{className:`mb-1`,children:(0,Z.jsx)(X,{direction:`rtl`,eyedropper:!0,swatches:[{value:`accent`,title:`Accent`,hex:T.accent_color},{value:null,title:`Auto`,hex:Ne()?`#ffffff`:`#000000`}],title:`Link color`,value:e.link_color,onChange:e=>i({link_color:e})})}),(0,Z.jsxs)(h,{className:`w-full`,gap:`sm`,justify:`between`,children:[(0,Z.jsx)(`div`,{children:`Link style`}),(0,Z.jsx)($,{label:`Link style`,options:[{value:`underline`,label:`Underline`,icon:(0,Z.jsx)(ne,{className:`size-3.5!`})},{value:`regular`,label:`Regular`,icon:(0,Z.jsx)(S,{className:`size-3.5!`})},{value:`bold`,label:`Bold`,icon:(0,Z.jsx)(v,{className:`size-3.5!`})}],value:e.link_style||`underline`,onValueChange:e=>i({link_style:e})})]}),(0,Z.jsxs)(h,{className:`w-full`,gap:`sm`,justify:`between`,children:[(0,Z.jsx)(`div`,{children:`Image corners`}),(0,Z.jsx)($,{label:`Image corners`,options:[{value:`square`,label:`Squared`,icon:(0,Z.jsx)(w,{className:`size-3.5!`})},{value:`rounded`,label:`Rounded`,icon:(0,Z.jsx)(C,{className:`size-3.5!`})}],value:e.image_corners||`square`,onValueChange:e=>i({image_corners:e})})]}),(0,Z.jsx)(`div`,{className:`mb-1`,children:(0,Z.jsx)(X,{direction:`rtl`,eyedropper:!0,swatches:[{value:`light`,title:`Light`,hex:`#e0e7eb`},{value:`accent`,title:`Accent`,hex:T.accent_color}],title:`Divider color`,value:e.divider_color||`light`,onChange:e=>i({divider_color:e})})})]})]})]})}];return(0,Z.jsx)(`div`,{className:`flex flex-col`,children:(0,Z.jsx)(`div`,{className:`px-7 pt-0 pb-7`,children:(0,Z.jsxs)(oe,{value:G,variant:`underline`,onValueChange:e=>{ce(e)},children:[(0,Z.jsx)(ae,{className:`sticky top-0 z-50 bg-surface-elevated-2`,children:Le.map(e=>(0,Z.jsx)(re,{value:e.id,children:e.title},e.id))}),Le.map(e=>(0,Z.jsx)(ie,{value:e.id,children:e.contents},e.id))]})})})},Oe=({newsletter:e,onlyOne:t})=>{let{config:r}=Y(),{mutateAsync:i}=de(),{updateRoute:c}=_e(),u=pe(`automations`)?`emails`:`newsletters`,{formState:d,saveState:f,updateForm:p,setFormState:m,handleSave:h,validate:g,errors:_,clearError:v,okProps:y}=o({initialState:e,savingDelay:500,onSave:async()=>{let{meta:{sent_email_verification:[e]=[]}={}}=await i(d),t;(e&&e===`sender_email`||e&&e===`sender_reply_to`)&&(t=(0,Z.jsx)(`div`,{children:`We‘ve sent a confirmation email to the new address.`})),t&&a.info(t)},onSaveError:n(),onValidate:()=>{let e={};return d.name||(e.name=`A name is required for your newsletter`),d.sender_email&&!Te.default.isEmail(d.sender_email)?e.sender_email=`Enter a valid email address`:d.sender_email&&l(r)&&d.sender_email.split(`@`)[1]!==s(r)&&(e.sender_email=`Email address must end with @${s(r)}`),d.sender_reply_to&&!Te.default.isEmail(d.sender_reply_to)&&![`newsletter`,`support`].includes(d.sender_reply_to)&&(e.sender_reply_to=`Enter a valid email address`),e}}),b=e=>{p(t=>({...t,...e}))};(0,Q.useEffect)(()=>{m(()=>e)},[m,e]);let x=(0,Z.jsx)(we,{newsletter:d}),S=(0,Z.jsx)(De,{clearError:v,errors:_,newsletter:d,onlyOne:t,updateNewsletter:b,validate:g});return(0,Z.jsx)(Se,{buttonsDisabled:y.disabled,cancelLabel:`Close`,dirty:f===`unsaved`,okLabel:y.label||`Save`,okVariant:y.variant,preview:x,previewBgColor:`grey`,previewToolbar:!1,sidebar:S,sidebarPadding:!1,testId:`newsletter-modal`,title:`Newsletter`,onClose:()=>c(u),onOk:async()=>{await h({fakeWhenUnchanged:!0})}})},ke=()=>{let{newsletterId:e}=u(),{data:{newsletters:t,isEnd:n}={},fetchNextPage:r}=fe(),i=t?.find(({id:t})=>t===e);return(0,Q.useEffect)(()=>{!i&&!n&&r()},[r,n,i]),i?(0,Z.jsx)(Oe,{newsletter:i,onlyOne:t.length===1}):null};export{ke as default};
|
package/core/built/admin/assets/{newsletter-emails-CzVCiC2K.js → newsletter-emails-DicgmnMU.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`0378f20c-a582-439c-963f-d36f0fd425e4`,e._sentryDebugIdIdentifier=`sentry-dbid-0378f20c-a582-439c-963f-d36f0fd425e4`)}catch{}})();import{t as e}from"./react-C9lG_SsT.js";import{t}from"./jsx-runtime-Bm2_KH-0.js";import{i as n,r}from"./config-
|
|
1
|
+
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`0378f20c-a582-439c-963f-d36f0fd425e4`,e._sentryDebugIdIdentifier=`sentry-dbid-0378f20c-a582-439c-963f-d36f0fd425e4`)}catch{}})();import{t as e}from"./react-C9lG_SsT.js";import{t}from"./jsx-runtime-Bm2_KH-0.js";import{i as n,r}from"./config-CRAZ4Civ.js";import{H as i}from"./shade-provider-DvrXKKQZ.js";import{D as a}from"./button-CTHYSI-d.js";import{o,r as s,t as c}from"./field-DCPPrQDr.js";import{a as l,c as u,i as d,n as f,o as p,r as m,s as h,t as g}from"./images-DTZtaIAr.js";e();var _=t(),v=e=>(0,_.jsx)(`svg`,{fill:`none`,height:24,viewBox:`0 0 24 24`,width:24,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,_.jsx)(`path`,{clipRule:`evenodd`,d:`M24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12C0 5.37258 5.37258 0 12 0C18.6274 0 24 5.37258 24 12ZM11.8326 2.33879C6.37785 2.95189 3.95901 5.20797 3.41126 9.74699C3.34896 10.2632 3.22642 10.7805 3.10443 11.2954C2.93277 12.02 2.76221 12.74 2.76221 13.4458C2.76221 17.9885 6.5856 21.556 11.1283 21.556C12.8959 21.556 14.4433 20.8144 15.8756 20.048C19.0536 18.3478 22.0328 16.2597 22.0328 12.5411C22.0328 9.91512 20.1051 7.56932 18.466 5.5747C18.3834 5.47416 18.3015 5.37451 18.2206 5.27577C17.3866 4.25742 14.4333 2.04643 11.8326 2.33879Z`,fill:`currentColor`,fillRule:`evenodd`})}),y=({inputId:e=`welcome-email-header-image`,onUploadError:t,value:n,onChange:r})=>{let{mutateAsync:v}=f(),y=async e=>{try{r(g(await v({file:e})))}catch(e){if(t){t(e);return}throw e}};return(0,_.jsxs)(c,{"data-testid":`header-image-field`,children:[(0,_.jsx)(o,{htmlFor:e,children:`Header image`}),(0,_.jsx)(m,{className:`aspect-[2/1] w-full`,children:n?(0,_.jsxs)(u,{children:[(0,_.jsx)(h,{alt:`Header`,src:n}),(0,_.jsx)(l,{children:(0,_.jsx)(d,{"aria-label":`Remove header image`,type:`button`,onClick:()=>r(``),children:(0,_.jsx)(a,{})})})]}):(0,_.jsx)(p,{accept:{"image/*":[`.jpg`,`.jpeg`,`.png`,`.gif`,`.webp`,`.svg`]},inputId:e,onDropAccepted:e=>e[0]&&void y(e[0]),children:(0,_.jsx)(`span`,{className:`text-control font-medium`,children:`Upload header image`})})}),(0,_.jsxs)(s,{children:[i(1200),`×`,i(600),` recommended. Use a transparent PNG for best results on any background.`]})]})},b=(e,t,i)=>n(t)&&!r(t)&&i?i:e.sender_email||i||``,x=(e,t,r,i)=>e.sender_reply_to===`newsletter`?n(t)?``:b(e,t,i):e.sender_reply_to===`support`?r||i||``:e.sender_reply_to,S=(e,t,n,r)=>x(e,t,n,r)||(e.sender_reply_to===`newsletter`?b(e,t,r)||n||r||``:n||r||``);export{v as a,y as i,S as n,b as r,x as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`ab8ce960-1c36-4a04-ad79-90e3d30e3846`,e._sentryDebugIdIdentifier=`sentry-dbid-ab8ce960-1c36-4a04-ad79-90e3d30e3846`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{t as n}from"./jsx-runtime-Bm2_KH-0.js";import{i as r}from"./pagemenu--UL0gW1x.js";import{_ as i}from"./chunk-OB3PAWPO-D3muQBsq.js";import{a,t as o}from"./router-provider-Cf-bcYZr.js";import{H as s,I as c,R as l,U as u}from"./shade-provider-DvrXKKQZ.js";import{Ut as d,Wt as f,t as p}from"./button-CTHYSI-d.js";import{a as m,n as h,o as g,r as _,t as v}from"./card-Cd6xB_Ok.js";import{g as y,n as b,o as x,r as S}from"./chart-DnWIZbyZ.js";import{i as ee,n as te,r as ne,t as re}from"./gh-chart-Boqv6SC0.js";import{n as ie,t as C}from"./sort-button-ZZ-vJtEB.js";import{t as w}from"./empty-indicator-BhVwqSVH.js";import{n as T}from"./skeleton-C1s6yr9e.js";import{t as E}from"./loading-indicator-DaRyGrxv.js";import{t as D}from"./page-header-Baymg6VR.js";import{a as O,i as k,n as A,r as j,s as M,t as N}from"./select-DeloOYCg.js";import{a as P,c as F,n as I,r as L,s as R,t as z}from"./table-DQ63Yu4a.js";import{r as ae,t as oe}from"./tabs-CDb_TceL.js";import{r as B}from"./newsletters-BMEgeL2l.js";import{n as V,r as H,t as se}from"./kpi-tabs-V1_Nu9sh.js";import{Qt as ce,X as U,Xt as W,Yt as G,ct as le,ft as K,ut as ue,vt as de}from"./index-CuDhPtkB.js";import{i as fe,n as pe,r as me,t as he}from"./stats-view-DQZzKeEz.js";import{a as ge,f as _e,o as ve}from"./stats-CHOikfoP.js";import{a as q,c as ye,i as J,n as Y,r as be}from"./chart-helpers-D-3N170i.js";import{t as xe}from"./use-analytics-data-oJ2o0pSS.js";import{t as Se}from"./get-site-timezone-BnQQpb6P.js";var X=e(t(),1),Z=n(),Ce=({active:e,payload:t})=>{if(!e||!t?.length)return null;let n=t[0].payload,r=typeof n.send_date==`string`?n.send_date:n.send_date.toISOString().split(`T`)[0];return(0,Z.jsxs)(`div`,{className:`max-w-[240px] min-w-[220px] rounded-lg border bg-background px-3 py-2 shadow-lg`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex w-full flex-col border-b pb-2`,children:[(0,Z.jsx)(`span`,{className:`text-sm leading-tight font-semibold`,children:n.post_title}),(0,Z.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[`Sent on `,l(r)]})]}),(0,Z.jsxs)(`div`,{className:`mb-1 flex w-full justify-between`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`Sent`}),(0,Z.jsx)(`div`,{className:`ml-2 w-full text-right font-mono`,children:s(n.sent_to)})]}),(0,Z.jsxs)(`div`,{className:`mb-1 flex w-full justify-between`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`Opens`}),(0,Z.jsxs)(`div`,{className:`ml-2 w-full text-right font-mono`,children:[(0,Z.jsxs)(`span`,{className:`text-muted-foreground`,children:[s(n.total_opens),` / `]}),u(n.open_rate)]})]}),(0,Z.jsxs)(`div`,{className:`mb-1 flex w-full justify-between`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`Clicks`}),(0,Z.jsxs)(`div`,{className:`ml-2 w-full text-right font-mono`,children:[(0,Z.jsxs)(`span`,{className:`text-muted-foreground`,children:[s(n.total_clicks),` / `]}),u(n.click_rate)]})]})]})},we=({subscribersData:e,avgsData:t,totals:n,isLoading:r,isAvgsLoading:o,initialTab:l=`total-subscribers`})=>{let[d,p]=(0,X.useState)(l),[m,h]=(0,X.useState)(!1),{range:g}=U(),_=a(),[v]=i(),C=G(),T=W(),{totalSubscribers:D,avgOpenRate:O,avgClickRate:k}=n,A=(0,X.useMemo)(()=>{if(!e||e.length===0)return[];let t=[];return t=ye(e,g,`value`,`exact`),t.map(e=>({...e,formattedValue:s(e.value),label:`Total Subscribers`}))},[e,g]),j=(0,X.useMemo)(()=>be(g,e||[]),[e,g]),M=(0,X.useMemo)(()=>{if(!A||A.length<=1)return{direction:`same`,value:`0%`};let e=A[0]?.value??0,t=A[A.length-1]?.value??0,n=`same`;t>e?n=`up`:t<e&&(n=`down`);let r;if(e===0)r=t===0?`0%`:`+100%`;else{let n=(t-e)/e*100,i=Math.round(n*10)/10;r=`${n>=0?`+`:``}${i}%`}return{direction:n,value:r}},[A]);(0,X.useEffect)(()=>{p(l)},[l]);let N=e=>{p(e);let t=new URLSearchParams(v);t.set(`tab`,e),_(`?${t.toString()}`,{replace:!0})},P={open_rate:{label:`Open rate`}},F=(0,X.useMemo)(()=>({"total-subscribers":{color:`var(--chart-darkblue)`,datakey:`value`},"avg-open-rate":{color:`var(--chart-blue)`,datakey:`open_rate`},"avg-click-rate":{color:`var(--chart-teal)`,datakey:`click_rate`}}),[]),{barDomain:I,barTicks:L}=(0,X.useMemo)(()=>{if(!t||t.length===0||d===`total-subscribers`)return{barDomain:[0,1],barTicks:[0,1]};let e=F[d]?.datakey;if(!e)return{barDomain:[0,1],barTicks:[0,1]};let n=t.map(t=>t[e]).filter(e=>typeof e==`number`);if(n.length===0)return{barDomain:[0,1],barTicks:[0,1]};let r=d===`avg-open-rate`?O:k,i=Math.max(Math.max(...n),r),a;return a=i<.01?.01:i<.1?(Math.floor(i*100)+1)/100:(Math.floor(i*10)+1)/10,{barDomain:[0,a],barTicks:[0,a]}},[t,d,F,O,k]);if(r)return(0,Z.jsx)(`div`,{className:`-mb-6 flex h-[calc(16vw+132px)] w-full items-start justify-center`,children:(0,Z.jsx)(E,{})});let R=`grid-cols-3`;(!C||!T)&&(R=`grid-cols-2`),!C&&!T&&(R=`grid-cols-1`);let z=d===`avg-open-rate`&&O>I[0]&&O<I[1]||d===`avg-click-rate`&&k>I[0]&&k<I[1],B=d===`avg-open-rate`?O:k;return(0,Z.jsxs)(oe,{defaultValue:l,variant:`kpis`,children:[(0,Z.jsxs)(ae,{className:`-mx-6 hidden grid-cols-3 md:visible! md:grid! ${R}`,children:[(0,Z.jsx)(V,{className:`${!T&&!C&&`cursor-auto after:hidden`}`,value:`total-subscribers`,onClick:()=>{N(`total-subscribers`)},children:(0,Z.jsx)(H,{color:F[`total-subscribers`].color,"data-testid":`total-subscribers-value`,diffDirection:M.direction,diffValue:M.value,label:`Total subscribers`,value:s(D)})}),T&&(0,Z.jsx)(V,{value:`avg-open-rate`,onClick:()=>{N(`avg-open-rate`)},children:(0,Z.jsx)(H,{className:o?`opacity-50`:``,color:F[`avg-open-rate`].color,label:`Avg. open rate`,value:u(O)})}),C&&(0,Z.jsx)(V,{value:`avg-click-rate`,onClick:()=>{N(`avg-click-rate`)},children:(0,Z.jsx)(H,{className:o?`opacity-50`:``,color:F[`avg-click-rate`].color,label:`Avg. click rate`,value:u(k)})})]}),(0,Z.jsxs)(le,{children:[(0,Z.jsx)(de,{className:`md:hidden`,asChild:!0,children:(0,Z.jsxs)(se,{children:[d===`total-subscribers`&&(0,Z.jsx)(H,{color:F[`total-subscribers`].color,label:`Total subscribers`,value:s(D)}),d===`avg-open-rate`&&T&&(0,Z.jsx)(H,{className:o?`opacity-50`:``,color:F[`avg-open-rate`].color,label:`Avg. open rate`,value:u(O)}),d===`avg-click-rate`&&C&&(0,Z.jsx)(H,{className:o?`opacity-50`:``,color:F[`avg-click-rate`].color,label:`Avg. click rate`,value:u(k)})]})}),(0,Z.jsxs)(ue,{align:`end`,className:`w-56`,children:[(0,Z.jsx)(K,{onClick:()=>N(`total-subscribers`),children:`Total subscribers`}),T&&(0,Z.jsx)(K,{onClick:()=>N(`avg-open-rate`),children:`Avg. open rate`}),C&&(0,Z.jsx)(K,{onClick:()=>N(`avg-click-rate`),children:`Avg. click rate`})]})]}),(0,Z.jsxs)(`div`,{className:`my-4 [&_.recharts-cartesian-axis-tick-value]:fill-gray-500`,children:[d===`total-subscribers`&&(0,Z.jsx)(re,{className:`-mb-3 h-[16vw] max-h-[320px] min-h-[180px] w-full`,color:F[`total-subscribers`].color,data:A,id:`mrr`,range:j}),(d===`avg-open-rate`&&T||d===`avg-click-rate`&&C)&&(0,Z.jsx)(Z.Fragment,{children:o?(0,Z.jsx)(`div`,{className:`h-[320px] w-full items-center justify-center`,children:(0,Z.jsx)(E,{})}):t&&t.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(b,{className:`aspect-auto h-[200px] w-full md:h-[220px] xl:h-[320px]`,config:P,children:(0,Z.jsxs)(ie,{className:m?`cursor-pointer!`:``,data:t,margin:{top:20},onClick:e=>{let t=(e.activePayload?.[0])?.payload?.post_id;t&&_(`/posts/analytics/${t}`)},onMouseLeave:()=>h(!1),onMouseMove:e=>{let t=(e.activePayload?.[0])?.payload?.post_id;h(!!t)},children:[(0,Z.jsx)(`defs`,{children:(0,Z.jsxs)(`linearGradient`,{id:`barGradient`,x1:`0`,x2:`0`,y1:`0`,y2:`1`,children:[(0,Z.jsx)(`stop`,{offset:`0%`,stopColor:F[d].color,stopOpacity:.8}),(0,Z.jsx)(`stop`,{offset:`100%`,stopColor:F[d].color,stopOpacity:.6})]})}),(0,Z.jsx)(ee,{horizontal:!0,stroke:`var(--border)`,vertical:!1}),(0,Z.jsx)(ne,{axisLine:{stroke:`var(--border)`,strokeWidth:1},dataKey:`post_id`,interval:0,stroke:`var(--border)`,tickFormatter:()=>``,tickLine:!1,tickMargin:10}),(0,Z.jsx)(te,{axisLine:!1,domain:I,tickFormatter:e=>u(e),tickLine:!1,ticks:L,width:c(L,e=>u(e))}),(0,Z.jsx)(S,{content:(0,Z.jsx)(Ce,{}),cursor:!1,isAnimationActive:!1,position:{y:10}}),z&&(0,Z.jsx)(x,{label:{value:`${u(B)}`,position:`left`,offset:8,fill:`var(--muted-foreground)`},opacity:.5,stroke:`var(--muted-foreground)`,strokeDasharray:`4 4`,y:B}),(0,Z.jsx)(y,{activeBar:{fillOpacity:1},dataKey:F[d].datakey,fill:`url(#barGradient)`,fillOpacity:.6,isAnimationActive:!1,maxBarSize:32,minPointSize:3,radius:4})]})}),(0,Z.jsxs)(`div`,{className:`-mt-4 text-center text-sm text-muted-foreground`,children:[`Newsletters `,d===`avg-open-rate`?`opens`:`clicks`,` in this period`]})]}):(0,Z.jsx)(w,{className:`size-full py-20`,title:`No newsletters ${J(g)}`,children:(0,Z.jsx)(f,{strokeWidth:1.5})})})]})]})},Te=({newsletters:e})=>{let{selectedNewsletterId:t,setSelectedNewsletterId:n}=U(),r=(0,X.useMemo)(()=>e?.filter(e=>e.status===`active`)||[],[e]);return(0,X.useEffect)(()=>{if(r.length>0&&!t){let e=r.find(e=>e.sort_order===0);n(e?e.id:r[0].id)}},[r,t,n]),r.length<=1?null:(0,Z.jsxs)(N,{value:t||``,onValueChange:e=>{n(e)},children:[(0,Z.jsxs)(D.SelectTrigger,{label:`Newsletter`,children:[(0,Z.jsx)(d,{className:`mr-2`,size:16,strokeWidth:1.5}),(0,Z.jsx)(M,{placeholder:`Select a newsletter`})]}),(0,Z.jsx)(A,{align:`end`,children:(0,Z.jsxs)(j,{children:[(0,Z.jsx)(O,{children:`Newsletters`}),r.map(e=>(0,Z.jsx)(k,{value:e.id,children:e.name},e.id))]})})]})},Ee=(e,t,n=!0)=>{let r=e??30,{startDate:i,endDate:a}=(0,X.useMemo)(()=>q(r),[r]),o=_e({searchParams:(0,X.useMemo)(()=>{let e={date_from:Y(i),date_to:Y(a)};return t&&(e.newsletter_id=t),e},[i,a,t]),enabled:n});return n?o:{data:void 0,isLoading:!1,error:null,isError:!1,refetch:o.refetch}},De=(e,t,n,r=!0)=>{let i=e??30,a=t??`date desc`,{startDate:o,endDate:s}=(0,X.useMemo)(()=>q(i),[i]),c=ge({searchParams:(0,X.useMemo)(()=>{let e={date_from:Y(o),date_to:Y(s),order:a};return n&&(e.newsletter_id=n),e},[o,s,a,n]),enabled:r});return r?c:{data:void 0,isLoading:!1,error:null,isError:!1,refetch:c.refetch}},Oe=(e,t=[],n=!0)=>{let r=ve({searchParams:(0,X.useMemo)(()=>{let n={};return e&&(n.newsletter_id=e),t.length>0&&(n.post_ids=t.join(`,`)),n},[e,t]),enabled:n});return n?r:{data:void 0,isLoading:!1,error:null,isError:!1,refetch:r.refetch}},Q=(e,t,n,r=!0)=>{let i=De(e,t,n,r),a=(0,X.useMemo)(()=>i.data?.stats?i.data.stats.map(e=>e.post_id):[],[i.data]),o=Oe(n,a,r&&a.length>0);return{data:(0,X.useMemo)(()=>{if(!i.data?.stats)return;let e=i.data.stats,t=o.data?.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{...i.data,stats:r}},[i.data,o.data]),isLoading:i.isLoading,isClicksLoading:o.isLoading,error:i.error||o.error,isError:i.isError||o.isError,refetch:()=>{i.refetch(),o.refetch()}}},$=X.memo(({range:e,selectedNewsletterId:t,shouldFetchStats:n,sortBy:r})=>{let i=a(),{settings:o}=xe(),c=Se(o),{data:d,isLoading:m,isClicksLoading:h}=Q(e,r,t||void 0,!!n),g=G(),_=W(),v=(0,X.useMemo)(()=>d?.stats||[],[d]),y=_&&g?5:_||g?4:3,b=(0,X.useMemo)(()=>(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(F,{className:`last:border-none [&>td]:py-2.5`,children:(0,Z.jsx)(L,{className:`font-medium`,colSpan:y,children:(0,Z.jsx)(T,{className:`mt-5`})})})}),[y]),x=(0,X.useMemo)(()=>v.length>0?(0,Z.jsx)(Z.Fragment,{children:v.map(e=>(0,Z.jsxs)(F,{className:`last:border-none [&>td]:py-2.5`,children:[(0,Z.jsx)(L,{className:`font-medium`,children:(0,Z.jsx)(`div`,{className:`group/link inline-flex items-center gap-2`,children:e.post_id?(0,Z.jsx)(p,{className:`h-auto p-0 text-left whitespace-normal hover:underline!`,title:`View post analytics`,variant:`link`,onClick:()=>{i(`/posts/analytics/${e.post_id}/`)},children:e.post_title}):(0,Z.jsx)(Z.Fragment,{children:e.post_title})})}),(0,Z.jsx)(L,{className:`text-sm whitespace-nowrap`,children:l(e.send_date,c)}),(0,Z.jsx)(L,{className:`text-right font-mono text-sm`,children:s(e.sent_to)}),_&&(0,Z.jsxs)(L,{className:`text-right font-mono text-sm`,children:[(0,Z.jsx)(`span`,{className:`group-hover:hidden`,children:u(e.open_rate)}),(0,Z.jsx)(`span`,{className:`hidden group-hover:visible! group-hover:block!`,children:s(e.total_opens)})]}),g&&(0,Z.jsx)(L,{className:`text-right font-mono text-sm`,children:h?(0,Z.jsx)(`span`,{className:`inline-block h-4 w-8 animate-pulse rounded bg-gray-200`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`group-hover:hidden`,children:u(e.click_rate)}),(0,Z.jsx)(`span`,{className:`hidden group-hover:visible! group-hover:block!`,children:s(e.total_clicks)})]})})]},e.post_id))}):(0,Z.jsx)(F,{className:`border-none hover:bg-transparent`,children:(0,Z.jsx)(L,{className:`text-center group-hover:bg-transparent!`,colSpan:y,children:(0,Z.jsx)(w,{className:`size-full py-20`,title:`No newsletters ${J(e)}`,children:(0,Z.jsx)(f,{strokeWidth:1.5})})})}),[v,h,i,g,_,e,c]);return m||!d?b:x});$.displayName=`NewsletterTableRows`;var ke=X.memo(({sortBy:e,setSortBy:t,range:n})=>{let r=(0,X.useMemo)(()=>(0,Z.jsxs)(m,{children:[(0,Z.jsx)(g,{children:`Top newsletters`}),(0,Z.jsxs)(_,{children:[` Your best performing newsletters `,J(n)]})]}),[n]),i=G(),a=W();return(0,Z.jsx)(R,{children:(0,Z.jsxs)(F,{children:[(0,Z.jsx)(P,{className:`min-w-[320px]`,variant:`cardhead`,children:r}),(0,Z.jsx)(P,{className:`w-[65px]`,children:(0,Z.jsx)(C,{activeSortBy:e,setSortBy:t,sortBy:`date desc`,children:`Date`})}),(0,Z.jsx)(P,{className:`w-[90px] text-right`,children:(0,Z.jsx)(C,{activeSortBy:e,setSortBy:t,sortBy:`sent_to desc`,children:`Sent`})}),a&&(0,Z.jsx)(P,{className:`w-[90px] text-right`,children:(0,Z.jsx)(C,{activeSortBy:e,setSortBy:t,sortBy:`open_rate desc`,children:`Opens`})}),i&&(0,Z.jsx)(P,{className:`w-[90px] text-right`,children:(0,Z.jsx)(C,{activeSortBy:e,setSortBy:t,sortBy:`click_rate desc`,children:`Clicks`})})]})})});ke.displayName=`NewsletterTableHeader`;var Ae=X.memo(({range:e,selectedNewsletterId:t,shouldFetchStats:n})=>{let[r,i]=(0,X.useState)(`open_rate desc`);return(0,Z.jsx)(v,{className:`w-full max-w-full overflow-x-auto`,"data-testid":`top-newsletters-card`,children:(0,Z.jsx)(h,{children:(0,Z.jsxs)(z,{children:[(0,Z.jsx)(ke,{range:e,setSortBy:i,sortBy:r}),(0,Z.jsx)(I,{children:(0,Z.jsx)($,{range:e,selectedNewsletterId:t,shouldFetchStats:n,sortBy:r})})]})})})});Ae.displayName=`TopNewslettersTable`;var je=()=>{let{range:e,selectedNewsletterId:t}=U(),[n]=i(),a=ce(),s=n.get(`tab`)||`total-subscribers`,{data:c,isLoading:l}=B({searchParams:{limit:`50`}}),u=!l&&c&&c.newsletters.length>0&&!!t,{data:d,isLoading:f}=Ee(e,t||void 0,u||!1),{data:p,isLoading:m,isClicksLoading:g}=Q(e,`date asc`,t||void 0,u||!1),_=(0,X.useMemo)(()=>!c?.newsletters||!t?null:c.newsletters.find(e=>e.id===t)||null,[c,t]),y=(0,X.useMemo)(()=>{let e=_?.count?.active_members||d?.stats?.[0]?.total||0,t=0,n=0;if(p?.stats&&p.stats.length>0){let e=p.stats,r=e.reduce((e,t)=>e+(t.open_rate||0),0),i=e.reduce((e,t)=>e+(t.click_rate||0),0);t=r/e.length,n=i/e.length}return{totalSubscribers:e,avgOpenRate:t,avgClickRate:n}},[_,d,p]),b=(0,X.useMemo)(()=>{if(!d?.stats?.[0]?.values||d.stats[0].values.length===0){let{startDate:t,endDate:n}=q(e),r=[],i=t.clone().toDate(),a=n.toDate();for(;i<=a;)r.push({date:i.toISOString().split(`T`)[0],value:0}),i.setDate(i.getDate()+1);return r}let t=d.stats[0].values;if(t.length===1){let n=t[0],r=new Date,i=e,a=new Date(r.getTime()-i*24*60*60*1e3);return[{...n,date:a.toISOString().split(`T`)[0]},{...n,date:r.toISOString().split(`T`)[0]}]}return t},[d,e]),x=(0,X.useMemo)(()=>p?.stats?p.stats.map(e=>({post_id:e.post_id,post_title:e.post_title,send_date:e.send_date,sent_to:e.sent_to,total_opens:e.total_opens,open_rate:e.open_rate,total_clicks:e.total_clicks||0,click_rate:e.click_rate||0})):[],[p]),S=f||g||m;return a===!1?(0,Z.jsx)(o,{to:`/analytics`}):(0,Z.jsxs)(pe,{children:[(0,Z.jsx)(me,{children:(0,Z.jsxs)(r,{children:[(0,Z.jsx)(Te,{newsletters:c?.newsletters}),(0,Z.jsx)(fe,{})]})}),(0,Z.jsx)(he,{isLoading:!1,loadingComponent:(0,Z.jsx)(Z.Fragment,{}),children:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(v,{"data-testid":`newsletters-card`,children:(0,Z.jsx)(h,{children:(0,Z.jsx)(we,{avgsData:x,initialTab:s,isAvgsLoading:!1,isLoading:S,subscribersData:b,totals:y})})}),(0,Z.jsx)(Ae,{range:e,selectedNewsletterId:t,shouldFetchStats:!!u})]})})]})};export{je as default};
|
|
1
|
+
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`ab8ce960-1c36-4a04-ad79-90e3d30e3846`,e._sentryDebugIdIdentifier=`sentry-dbid-ab8ce960-1c36-4a04-ad79-90e3d30e3846`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{t as n}from"./jsx-runtime-Bm2_KH-0.js";import{i as r}from"./pagemenu-DXr_U43J.js";import{_ as i}from"./chunk-OB3PAWPO-D3muQBsq.js";import{a,t as o}from"./router-provider-Cf-bcYZr.js";import{H as s,I as c,R as l,U as u}from"./shade-provider-DvrXKKQZ.js";import{Ut as d,Wt as f,t as p}from"./button-CTHYSI-d.js";import{a as m,n as h,o as g,r as _,t as v}from"./card-Cd6xB_Ok.js";import{g as y,n as b,o as x,r as S}from"./chart-DnWIZbyZ.js";import{i as ee,n as te,r as ne,t as re}from"./gh-chart-Boqv6SC0.js";import{n as ie,t as C}from"./sort-button-ZZ-vJtEB.js";import{t as w}from"./empty-indicator-BhVwqSVH.js";import{n as T}from"./skeleton-C1s6yr9e.js";import{t as E}from"./loading-indicator-DaRyGrxv.js";import{t as D}from"./page-header-CxTb0je5.js";import{a as O,i as k,n as A,r as j,s as M,t as N}from"./select-DeloOYCg.js";import{a as P,c as F,n as I,r as L,s as R,t as z}from"./table-DQ63Yu4a.js";import{r as ae,t as oe}from"./tabs-fHs3A8WC.js";import{r as B}from"./newsletters-CACa0VCx.js";import{n as V,r as H,t as se}from"./kpi-tabs-k4A9-imn.js";import{Qt as ce,X as U,Xt as W,Yt as G,ct as le,ft as K,ut as ue,vt as de}from"./index-RuRs_qGS.js";import{i as fe,n as pe,r as me,t as he}from"./stats-view-BwbdkdOQ.js";import{a as ge,f as _e,o as ve}from"./stats-BL_FJ7Ns.js";import{a as q,c as ye,i as J,n as Y,r as be}from"./chart-helpers-BSuFLd6-.js";import{t as xe}from"./use-analytics-data-Byf83QE-.js";import{t as Se}from"./get-site-timezone-BnQQpb6P.js";var X=e(t(),1),Z=n(),Ce=({active:e,payload:t})=>{if(!e||!t?.length)return null;let n=t[0].payload,r=typeof n.send_date==`string`?n.send_date:n.send_date.toISOString().split(`T`)[0];return(0,Z.jsxs)(`div`,{className:`max-w-[240px] min-w-[220px] rounded-lg border bg-background px-3 py-2 shadow-lg`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex w-full flex-col border-b pb-2`,children:[(0,Z.jsx)(`span`,{className:`text-sm leading-tight font-semibold`,children:n.post_title}),(0,Z.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[`Sent on `,l(r)]})]}),(0,Z.jsxs)(`div`,{className:`mb-1 flex w-full justify-between`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`Sent`}),(0,Z.jsx)(`div`,{className:`ml-2 w-full text-right font-mono`,children:s(n.sent_to)})]}),(0,Z.jsxs)(`div`,{className:`mb-1 flex w-full justify-between`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`Opens`}),(0,Z.jsxs)(`div`,{className:`ml-2 w-full text-right font-mono`,children:[(0,Z.jsxs)(`span`,{className:`text-muted-foreground`,children:[s(n.total_opens),` / `]}),u(n.open_rate)]})]}),(0,Z.jsxs)(`div`,{className:`mb-1 flex w-full justify-between`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`Clicks`}),(0,Z.jsxs)(`div`,{className:`ml-2 w-full text-right font-mono`,children:[(0,Z.jsxs)(`span`,{className:`text-muted-foreground`,children:[s(n.total_clicks),` / `]}),u(n.click_rate)]})]})]})},we=({subscribersData:e,avgsData:t,totals:n,isLoading:r,isAvgsLoading:o,initialTab:l=`total-subscribers`})=>{let[d,p]=(0,X.useState)(l),[m,h]=(0,X.useState)(!1),{range:g}=U(),_=a(),[v]=i(),C=G(),T=W(),{totalSubscribers:D,avgOpenRate:O,avgClickRate:k}=n,A=(0,X.useMemo)(()=>{if(!e||e.length===0)return[];let t=[];return t=ye(e,g,`value`,`exact`),t.map(e=>({...e,formattedValue:s(e.value),label:`Total Subscribers`}))},[e,g]),j=(0,X.useMemo)(()=>be(g,e||[]),[e,g]),M=(0,X.useMemo)(()=>{if(!A||A.length<=1)return{direction:`same`,value:`0%`};let e=A[0]?.value??0,t=A[A.length-1]?.value??0,n=`same`;t>e?n=`up`:t<e&&(n=`down`);let r;if(e===0)r=t===0?`0%`:`+100%`;else{let n=(t-e)/e*100,i=Math.round(n*10)/10;r=`${n>=0?`+`:``}${i}%`}return{direction:n,value:r}},[A]);(0,X.useEffect)(()=>{p(l)},[l]);let N=e=>{p(e);let t=new URLSearchParams(v);t.set(`tab`,e),_(`?${t.toString()}`,{replace:!0})},P={open_rate:{label:`Open rate`}},F=(0,X.useMemo)(()=>({"total-subscribers":{color:`var(--chart-darkblue)`,datakey:`value`},"avg-open-rate":{color:`var(--chart-blue)`,datakey:`open_rate`},"avg-click-rate":{color:`var(--chart-teal)`,datakey:`click_rate`}}),[]),{barDomain:I,barTicks:L}=(0,X.useMemo)(()=>{if(!t||t.length===0||d===`total-subscribers`)return{barDomain:[0,1],barTicks:[0,1]};let e=F[d]?.datakey;if(!e)return{barDomain:[0,1],barTicks:[0,1]};let n=t.map(t=>t[e]).filter(e=>typeof e==`number`);if(n.length===0)return{barDomain:[0,1],barTicks:[0,1]};let r=d===`avg-open-rate`?O:k,i=Math.max(Math.max(...n),r),a;return a=i<.01?.01:i<.1?(Math.floor(i*100)+1)/100:(Math.floor(i*10)+1)/10,{barDomain:[0,a],barTicks:[0,a]}},[t,d,F,O,k]);if(r)return(0,Z.jsx)(`div`,{className:`-mb-6 flex h-[calc(16vw+132px)] w-full items-start justify-center`,children:(0,Z.jsx)(E,{})});let R=`grid-cols-3`;(!C||!T)&&(R=`grid-cols-2`),!C&&!T&&(R=`grid-cols-1`);let z=d===`avg-open-rate`&&O>I[0]&&O<I[1]||d===`avg-click-rate`&&k>I[0]&&k<I[1],B=d===`avg-open-rate`?O:k;return(0,Z.jsxs)(oe,{defaultValue:l,variant:`kpis`,children:[(0,Z.jsxs)(ae,{className:`-mx-6 hidden grid-cols-3 md:visible! md:grid! ${R}`,children:[(0,Z.jsx)(V,{className:`${!T&&!C&&`cursor-auto after:hidden`}`,value:`total-subscribers`,onClick:()=>{N(`total-subscribers`)},children:(0,Z.jsx)(H,{color:F[`total-subscribers`].color,"data-testid":`total-subscribers-value`,diffDirection:M.direction,diffValue:M.value,label:`Total subscribers`,value:s(D)})}),T&&(0,Z.jsx)(V,{value:`avg-open-rate`,onClick:()=>{N(`avg-open-rate`)},children:(0,Z.jsx)(H,{className:o?`opacity-50`:``,color:F[`avg-open-rate`].color,label:`Avg. open rate`,value:u(O)})}),C&&(0,Z.jsx)(V,{value:`avg-click-rate`,onClick:()=>{N(`avg-click-rate`)},children:(0,Z.jsx)(H,{className:o?`opacity-50`:``,color:F[`avg-click-rate`].color,label:`Avg. click rate`,value:u(k)})})]}),(0,Z.jsxs)(le,{children:[(0,Z.jsx)(de,{className:`md:hidden`,asChild:!0,children:(0,Z.jsxs)(se,{children:[d===`total-subscribers`&&(0,Z.jsx)(H,{color:F[`total-subscribers`].color,label:`Total subscribers`,value:s(D)}),d===`avg-open-rate`&&T&&(0,Z.jsx)(H,{className:o?`opacity-50`:``,color:F[`avg-open-rate`].color,label:`Avg. open rate`,value:u(O)}),d===`avg-click-rate`&&C&&(0,Z.jsx)(H,{className:o?`opacity-50`:``,color:F[`avg-click-rate`].color,label:`Avg. click rate`,value:u(k)})]})}),(0,Z.jsxs)(ue,{align:`end`,className:`w-56`,children:[(0,Z.jsx)(K,{onClick:()=>N(`total-subscribers`),children:`Total subscribers`}),T&&(0,Z.jsx)(K,{onClick:()=>N(`avg-open-rate`),children:`Avg. open rate`}),C&&(0,Z.jsx)(K,{onClick:()=>N(`avg-click-rate`),children:`Avg. click rate`})]})]}),(0,Z.jsxs)(`div`,{className:`my-4 [&_.recharts-cartesian-axis-tick-value]:fill-gray-500`,children:[d===`total-subscribers`&&(0,Z.jsx)(re,{className:`-mb-3 h-[16vw] max-h-[320px] min-h-[180px] w-full`,color:F[`total-subscribers`].color,data:A,id:`mrr`,range:j}),(d===`avg-open-rate`&&T||d===`avg-click-rate`&&C)&&(0,Z.jsx)(Z.Fragment,{children:o?(0,Z.jsx)(`div`,{className:`h-[320px] w-full items-center justify-center`,children:(0,Z.jsx)(E,{})}):t&&t.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(b,{className:`aspect-auto h-[200px] w-full md:h-[220px] xl:h-[320px]`,config:P,children:(0,Z.jsxs)(ie,{className:m?`cursor-pointer!`:``,data:t,margin:{top:20},onClick:e=>{let t=(e.activePayload?.[0])?.payload?.post_id;t&&_(`/posts/analytics/${t}`)},onMouseLeave:()=>h(!1),onMouseMove:e=>{let t=(e.activePayload?.[0])?.payload?.post_id;h(!!t)},children:[(0,Z.jsx)(`defs`,{children:(0,Z.jsxs)(`linearGradient`,{id:`barGradient`,x1:`0`,x2:`0`,y1:`0`,y2:`1`,children:[(0,Z.jsx)(`stop`,{offset:`0%`,stopColor:F[d].color,stopOpacity:.8}),(0,Z.jsx)(`stop`,{offset:`100%`,stopColor:F[d].color,stopOpacity:.6})]})}),(0,Z.jsx)(ee,{horizontal:!0,stroke:`var(--border)`,vertical:!1}),(0,Z.jsx)(ne,{axisLine:{stroke:`var(--border)`,strokeWidth:1},dataKey:`post_id`,interval:0,stroke:`var(--border)`,tickFormatter:()=>``,tickLine:!1,tickMargin:10}),(0,Z.jsx)(te,{axisLine:!1,domain:I,tickFormatter:e=>u(e),tickLine:!1,ticks:L,width:c(L,e=>u(e))}),(0,Z.jsx)(S,{content:(0,Z.jsx)(Ce,{}),cursor:!1,isAnimationActive:!1,position:{y:10}}),z&&(0,Z.jsx)(x,{label:{value:`${u(B)}`,position:`left`,offset:8,fill:`var(--muted-foreground)`},opacity:.5,stroke:`var(--muted-foreground)`,strokeDasharray:`4 4`,y:B}),(0,Z.jsx)(y,{activeBar:{fillOpacity:1},dataKey:F[d].datakey,fill:`url(#barGradient)`,fillOpacity:.6,isAnimationActive:!1,maxBarSize:32,minPointSize:3,radius:4})]})}),(0,Z.jsxs)(`div`,{className:`-mt-4 text-center text-sm text-muted-foreground`,children:[`Newsletters `,d===`avg-open-rate`?`opens`:`clicks`,` in this period`]})]}):(0,Z.jsx)(w,{className:`size-full py-20`,title:`No newsletters ${J(g)}`,children:(0,Z.jsx)(f,{strokeWidth:1.5})})})]})]})},Te=({newsletters:e})=>{let{selectedNewsletterId:t,setSelectedNewsletterId:n}=U(),r=(0,X.useMemo)(()=>e?.filter(e=>e.status===`active`)||[],[e]);return(0,X.useEffect)(()=>{if(r.length>0&&!t){let e=r.find(e=>e.sort_order===0);n(e?e.id:r[0].id)}},[r,t,n]),r.length<=1?null:(0,Z.jsxs)(N,{value:t||``,onValueChange:e=>{n(e)},children:[(0,Z.jsxs)(D.SelectTrigger,{label:`Newsletter`,children:[(0,Z.jsx)(d,{className:`mr-2`,size:16,strokeWidth:1.5}),(0,Z.jsx)(M,{placeholder:`Select a newsletter`})]}),(0,Z.jsx)(A,{align:`end`,children:(0,Z.jsxs)(j,{children:[(0,Z.jsx)(O,{children:`Newsletters`}),r.map(e=>(0,Z.jsx)(k,{value:e.id,children:e.name},e.id))]})})]})},Ee=(e,t,n=!0)=>{let r=e??30,{startDate:i,endDate:a}=(0,X.useMemo)(()=>q(r),[r]),o=_e({searchParams:(0,X.useMemo)(()=>{let e={date_from:Y(i),date_to:Y(a)};return t&&(e.newsletter_id=t),e},[i,a,t]),enabled:n});return n?o:{data:void 0,isLoading:!1,error:null,isError:!1,refetch:o.refetch}},De=(e,t,n,r=!0)=>{let i=e??30,a=t??`date desc`,{startDate:o,endDate:s}=(0,X.useMemo)(()=>q(i),[i]),c=ge({searchParams:(0,X.useMemo)(()=>{let e={date_from:Y(o),date_to:Y(s),order:a};return n&&(e.newsletter_id=n),e},[o,s,a,n]),enabled:r});return r?c:{data:void 0,isLoading:!1,error:null,isError:!1,refetch:c.refetch}},Oe=(e,t=[],n=!0)=>{let r=ve({searchParams:(0,X.useMemo)(()=>{let n={};return e&&(n.newsletter_id=e),t.length>0&&(n.post_ids=t.join(`,`)),n},[e,t]),enabled:n});return n?r:{data:void 0,isLoading:!1,error:null,isError:!1,refetch:r.refetch}},Q=(e,t,n,r=!0)=>{let i=De(e,t,n,r),a=(0,X.useMemo)(()=>i.data?.stats?i.data.stats.map(e=>e.post_id):[],[i.data]),o=Oe(n,a,r&&a.length>0);return{data:(0,X.useMemo)(()=>{if(!i.data?.stats)return;let e=i.data.stats,t=o.data?.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{...i.data,stats:r}},[i.data,o.data]),isLoading:i.isLoading,isClicksLoading:o.isLoading,error:i.error||o.error,isError:i.isError||o.isError,refetch:()=>{i.refetch(),o.refetch()}}},$=X.memo(({range:e,selectedNewsletterId:t,shouldFetchStats:n,sortBy:r})=>{let i=a(),{settings:o}=xe(),c=Se(o),{data:d,isLoading:m,isClicksLoading:h}=Q(e,r,t||void 0,!!n),g=G(),_=W(),v=(0,X.useMemo)(()=>d?.stats||[],[d]),y=_&&g?5:_||g?4:3,b=(0,X.useMemo)(()=>(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(F,{className:`last:border-none [&>td]:py-2.5`,children:(0,Z.jsx)(L,{className:`font-medium`,colSpan:y,children:(0,Z.jsx)(T,{className:`mt-5`})})})}),[y]),x=(0,X.useMemo)(()=>v.length>0?(0,Z.jsx)(Z.Fragment,{children:v.map(e=>(0,Z.jsxs)(F,{className:`last:border-none [&>td]:py-2.5`,children:[(0,Z.jsx)(L,{className:`font-medium`,children:(0,Z.jsx)(`div`,{className:`group/link inline-flex items-center gap-2`,children:e.post_id?(0,Z.jsx)(p,{className:`h-auto p-0 text-left whitespace-normal hover:underline!`,title:`View post analytics`,variant:`link`,onClick:()=>{i(`/posts/analytics/${e.post_id}/`)},children:e.post_title}):(0,Z.jsx)(Z.Fragment,{children:e.post_title})})}),(0,Z.jsx)(L,{className:`text-sm whitespace-nowrap`,children:l(e.send_date,c)}),(0,Z.jsx)(L,{className:`text-right font-mono text-sm`,children:s(e.sent_to)}),_&&(0,Z.jsxs)(L,{className:`text-right font-mono text-sm`,children:[(0,Z.jsx)(`span`,{className:`group-hover:hidden`,children:u(e.open_rate)}),(0,Z.jsx)(`span`,{className:`hidden group-hover:visible! group-hover:block!`,children:s(e.total_opens)})]}),g&&(0,Z.jsx)(L,{className:`text-right font-mono text-sm`,children:h?(0,Z.jsx)(`span`,{className:`inline-block h-4 w-8 animate-pulse rounded bg-gray-200`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`group-hover:hidden`,children:u(e.click_rate)}),(0,Z.jsx)(`span`,{className:`hidden group-hover:visible! group-hover:block!`,children:s(e.total_clicks)})]})})]},e.post_id))}):(0,Z.jsx)(F,{className:`border-none hover:bg-transparent`,children:(0,Z.jsx)(L,{className:`text-center group-hover:bg-transparent!`,colSpan:y,children:(0,Z.jsx)(w,{className:`size-full py-20`,title:`No newsletters ${J(e)}`,children:(0,Z.jsx)(f,{strokeWidth:1.5})})})}),[v,h,i,g,_,e,c]);return m||!d?b:x});$.displayName=`NewsletterTableRows`;var ke=X.memo(({sortBy:e,setSortBy:t,range:n})=>{let r=(0,X.useMemo)(()=>(0,Z.jsxs)(m,{children:[(0,Z.jsx)(g,{children:`Top newsletters`}),(0,Z.jsxs)(_,{children:[` Your best performing newsletters `,J(n)]})]}),[n]),i=G(),a=W();return(0,Z.jsx)(R,{children:(0,Z.jsxs)(F,{children:[(0,Z.jsx)(P,{className:`min-w-[320px]`,variant:`cardhead`,children:r}),(0,Z.jsx)(P,{className:`w-[65px]`,children:(0,Z.jsx)(C,{activeSortBy:e,setSortBy:t,sortBy:`date desc`,children:`Date`})}),(0,Z.jsx)(P,{className:`w-[90px] text-right`,children:(0,Z.jsx)(C,{activeSortBy:e,setSortBy:t,sortBy:`sent_to desc`,children:`Sent`})}),a&&(0,Z.jsx)(P,{className:`w-[90px] text-right`,children:(0,Z.jsx)(C,{activeSortBy:e,setSortBy:t,sortBy:`open_rate desc`,children:`Opens`})}),i&&(0,Z.jsx)(P,{className:`w-[90px] text-right`,children:(0,Z.jsx)(C,{activeSortBy:e,setSortBy:t,sortBy:`click_rate desc`,children:`Clicks`})})]})})});ke.displayName=`NewsletterTableHeader`;var Ae=X.memo(({range:e,selectedNewsletterId:t,shouldFetchStats:n})=>{let[r,i]=(0,X.useState)(`open_rate desc`);return(0,Z.jsx)(v,{className:`w-full max-w-full overflow-x-auto`,"data-testid":`top-newsletters-card`,children:(0,Z.jsx)(h,{children:(0,Z.jsxs)(z,{children:[(0,Z.jsx)(ke,{range:e,setSortBy:i,sortBy:r}),(0,Z.jsx)(I,{children:(0,Z.jsx)($,{range:e,selectedNewsletterId:t,shouldFetchStats:n,sortBy:r})})]})})})});Ae.displayName=`TopNewslettersTable`;var je=()=>{let{range:e,selectedNewsletterId:t}=U(),[n]=i(),a=ce(),s=n.get(`tab`)||`total-subscribers`,{data:c,isLoading:l}=B({searchParams:{limit:`50`}}),u=!l&&c&&c.newsletters.length>0&&!!t,{data:d,isLoading:f}=Ee(e,t||void 0,u||!1),{data:p,isLoading:m,isClicksLoading:g}=Q(e,`date asc`,t||void 0,u||!1),_=(0,X.useMemo)(()=>!c?.newsletters||!t?null:c.newsletters.find(e=>e.id===t)||null,[c,t]),y=(0,X.useMemo)(()=>{let e=_?.count?.active_members||d?.stats?.[0]?.total||0,t=0,n=0;if(p?.stats&&p.stats.length>0){let e=p.stats,r=e.reduce((e,t)=>e+(t.open_rate||0),0),i=e.reduce((e,t)=>e+(t.click_rate||0),0);t=r/e.length,n=i/e.length}return{totalSubscribers:e,avgOpenRate:t,avgClickRate:n}},[_,d,p]),b=(0,X.useMemo)(()=>{if(!d?.stats?.[0]?.values||d.stats[0].values.length===0){let{startDate:t,endDate:n}=q(e),r=[],i=t.clone().toDate(),a=n.toDate();for(;i<=a;)r.push({date:i.toISOString().split(`T`)[0],value:0}),i.setDate(i.getDate()+1);return r}let t=d.stats[0].values;if(t.length===1){let n=t[0],r=new Date,i=e,a=new Date(r.getTime()-i*24*60*60*1e3);return[{...n,date:a.toISOString().split(`T`)[0]},{...n,date:r.toISOString().split(`T`)[0]}]}return t},[d,e]),x=(0,X.useMemo)(()=>p?.stats?p.stats.map(e=>({post_id:e.post_id,post_title:e.post_title,send_date:e.send_date,sent_to:e.sent_to,total_opens:e.total_opens,open_rate:e.open_rate,total_clicks:e.total_clicks||0,click_rate:e.click_rate||0})):[],[p]),S=f||g||m;return a===!1?(0,Z.jsx)(o,{to:`/analytics`}):(0,Z.jsxs)(pe,{children:[(0,Z.jsx)(me,{children:(0,Z.jsxs)(r,{children:[(0,Z.jsx)(Te,{newsletters:c?.newsletters}),(0,Z.jsx)(fe,{})]})}),(0,Z.jsx)(he,{isLoading:!1,loadingComponent:(0,Z.jsx)(Z.Fragment,{}),children:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(v,{"data-testid":`newsletters-card`,children:(0,Z.jsx)(h,{children:(0,Z.jsx)(we,{avgsData:x,initialTab:s,isAvgsLoading:!1,isLoading:S,subscribersData:b,totals:y})})}),(0,Z.jsx)(Ae,{range:e,selectedNewsletterId:t,shouldFetchStats:!!u})]})})]})};export{je as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`695e983a-530c-4e1c-8be3-51048d29ec6e`,e._sentryDebugIdIdentifier=`sentry-dbid-695e983a-530c-4e1c-8be3-51048d29ec6e`)}catch{}})();import{n as e,t}from"./hooks-
|
|
1
|
+
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`695e983a-530c-4e1c-8be3-51048d29ec6e`,e._sentryDebugIdIdentifier=`sentry-dbid-695e983a-530c-4e1c-8be3-51048d29ec6e`)}catch{}})();import{n as e,t}from"./hooks-0r7qxGEo.js";import{n,r}from"./update-queries-sbOKc6_E.js";import{a as i,f as a,g as o,o as s,p as c,u as l,v as u}from"./schemas-21VB7GGY.js";var d=c({id:o(),uuid:o(),name:o(),description:o().nullable(),feedback_enabled:s(),slug:o(),sender_name:o().nullable(),sender_email:o().nullable(),sender_reply_to:o(),status:o(),visibility:o(),subscribe_on_signup:s(),sort_order:a(),header_image:o().nullable(),show_header_icon:s(),show_header_title:s(),title_font_category:o(),title_font_weight:o(),title_alignment:o(),show_excerpt:s(),show_feature_image:s(),body_font_category:o(),footer_content:o().nullable(),show_badge:s(),show_header_name:s(),show_post_title_section:s(),show_comment_cta:s(),show_share_button:s(),show_subscription_details:s(),show_latest_posts:s(),background_color:o(),header_background_color:o(),button_color:o().nullable(),link_color:o().nullable(),post_title_color:o().nullable(),section_title_color:o().nullable(),divider_color:o().nullable(),button_corners:o().nullable(),button_style:o().nullable(),image_corners:o().nullable(),link_style:o().nullable(),divider_style:o().nullish(),created_at:o(),updated_at:o().nullable(),count:c({posts:a().optional(),active_members:a().optional()}).optional()}),f=c({meta:c({capabilities:c({dislikes:s().optional()}).optional(),pagination:c({page:a(),limit:u([a(),l(`all`)]),pages:a(),total:a(),next:a().nullable(),prev:a().nullable()})}).optional(),newsletters:i(d)}),p=`NewslettersResponseType`,m=p,h=t({dataType:p,path:`/newsletters/`,parseResponse:e=>f.parse(e),defaultSearchParams:{include:`count.active_members,count.posts`,limit:`50`},defaultNextPageParams:(e,t)=>{let n=e.meta?.pagination.next;if(n)return{...t,page:n.toString()}},returnData:e=>{let{pages:t}=e,n=t.flatMap(e=>e.newsletters),r=t[t.length-1].meta;return{newsletters:n,meta:r,isEnd:r?r.pagination.pages===r.pagination.page:!0}}}),g=e({method:`POST`,path:()=>`/newsletters/`,body:({opt_in_existing:e,...t})=>({newsletters:[t]}),searchParams:e=>({opt_in_existing:e.opt_in_existing.toString(),include:`count.active_members,count.posts`}),updateQueries:{dataType:p,emberUpdateType:`createOrUpdate`,update:n(`newsletters`)}}),_=e({method:`PUT`,path:e=>`/newsletters/${e.id}/`,body:e=>({newsletters:[e]}),defaultSearchParams:{include:`count.active_members,count.posts`},updateQueries:{dataType:p,emberUpdateType:`createOrUpdate`,update:r(`newsletters`)}}),v=e({method:`PUT`,path:()=>`/newsletters/verifications/`,body:({token:e})=>({token:e}),defaultSearchParams:{include:`count.active_members,count.posts`},updateQueries:{dataType:p,emberUpdateType:`createOrUpdate`,update:r(`newsletters`)}});export{v as a,_ as i,g as n,h as r,m as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`c24eea5c-23b5-42fe-8f17-816d386bd63a`,e._sentryDebugIdIdentifier=`sentry-dbid-c24eea5c-23b5-42fe-8f17-816d386bd63a`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{t as n}from"./jsx-runtime-Bm2_KH-0.js";import{h as r}from"./chunk-OB3PAWPO-D3muQBsq.js";import{s as i}from"./router-provider-Cf-bcYZr.js";import{_n as a}from"./button-CTHYSI-d.js";import{S as o,T as s,a as c,h as l,i as u,r as d,x as f}from"./routes-
|
|
1
|
+
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`c24eea5c-23b5-42fe-8f17-816d386bd63a`,e._sentryDebugIdIdentifier=`sentry-dbid-c24eea5c-23b5-42fe-8f17-816d386bd63a`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{t as n}from"./jsx-runtime-Bm2_KH-0.js";import{h as r}from"./chunk-OB3PAWPO-D3muQBsq.js";import{s as i}from"./router-provider-Cf-bcYZr.js";import{_n as a}from"./button-CTHYSI-d.js";import{S as o,T as s,a as c,h as l,i as u,r as d,x as f}from"./routes-DKfpFMfF.js";import{t as p}from"./skeleton-C1s6yr9e.js";import{n as m}from"./loading-indicator-DaRyGrxv.js";import{t as h}from"./use-navigate-with-base-path-pweMCFf6.js";import{l as g,u as _}from"./content-formatters-C08JJbUJ.js";import{K as v}from"./use-activity-pub-queries-BgR1USeY.js";import{i as y,n as b,r as x,t as S}from"./use-reply-chain-data-BiV3Cl0B.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=h(),{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)(c,{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)(p,{className:`size-10 rounded-full`}),(0,w.jsxs)(`div`,{className:`grow pt-1`,children:[(0,w.jsx)(p,{className:`w-24`}),(0,w.jsx)(p,{className:`w-3/5`})]})]}),(0,w.jsxs)(`div`,{className:`mb-7 w-full`,children:[(0,w.jsx)(p,{}),(0,w.jsx)(p,{className:`w-4/5`}),(0,w.jsx)(p,{})]}),(0,w.jsx)(T,{}),(0,w.jsxs)(`div`,{className:`flex w-full items-center gap-3 py-3`,children:[(0,w.jsx)(p,{className:`block size-full`,containerClassName:`size-10 rounded-full overflow-hidden`}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(p,{className:`w-52`}),(0,w.jsx)(p,{className:`w-28`})]})]}),(0,w.jsx)(T,{})]})});if(!z)return(0,w.jsx)(c,{children:(0,w.jsx)(`div`,{className:`mx-auto mt-4 flex w-full max-w-[620px] flex-col items-center`,children:(0,w.jsxs)(u,{children:[(0,w.jsx)(d,{children:(0,w.jsx)(a,{})}),(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)(c,{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)(s,{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)(g,{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=>{o(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:_(z.actor)}),(0,w.jsx)(`span`,{className:`text-gray-700`,children:f(K,!K.authored)})]})]})]})}),R.map(e=>e.object.type===`Tombstone`?(0,w.jsx)(x,{last:!1}):(0,w.jsx)(l,{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)(l,{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,a=n.has(i),o=D.has(i),s=k.has(i),c=e.chain.length>0;return(0,w.jsxs)(C.Fragment,{children:[(0,w.jsx)(l,{actor:e.mainReply.actor,allowDelete:e.mainReply.object.authored,commentCount:e.mainReply.object.replyCount??0,isChainParent:c,isPending:v(e.mainReply.id),last:!c,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}),c&&e.chain[0]&&(0,w.jsx)(l,{actor:e.chain[0].actor,allowDelete:e.chain[0].object.authored,commentCount:e.chain[0].object.replyCount??0,isChainContinuation:!0,isPending:v(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),c&&a&&e.chain.slice(1).map((n,r)=>{let i=r===e.chain.slice(1).length-1,a=G&&G(t),o=i&&a;return(0,w.jsx)(l,{actor:n.actor,allowDelete:n.object.authored,commentCount:n.object.replyCount??0,isChainContinuation:!0,isPending:v(n.id),last:i&&!o,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)}),c&&e.chain.length>1&&!a&&(0,w.jsx)(b,{variant:`expand`,onClick:()=>Z(i)}),c&&a&&o&&G&&G(t)&&(0,w.jsx)(b,{loading:s,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
|
-
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`4526fd21-ad76-4c19-a7cc-1e91b1bbdd1c`,e._sentryDebugIdIdentifier=`sentry-dbid-4526fd21-ad76-4c19-a7cc-1e91b1bbdd1c`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{t as n}from"./jsx-runtime-Bm2_KH-0.js";import{H as r}from"./shade-provider-DvrXKKQZ.js";import{Tr as i,ar as a,ct as o,gn as s,h as c,kr as l,ot as u,t as d}from"./button-CTHYSI-d.js";import{E as f,S as p,T as m,_ as h,a as g,b as _,i as v,m as y,n as b,r as x,w as S,x as C,y as w}from"./routes-DrnhmKTT.js";import{t as T}from"./skeleton-C1s6yr9e.js";import{n as E}from"./loading-indicator-DaRyGrxv.js";import{t as D}from"./use-navigate-with-base-path-pweMCFf6.js";import{l as O,o as k,s as A}from"./content-formatters-VqvNA7Pv.js";import{q as j,w as M}from"./use-activity-pub-queries-Gy9_locM.js";import"./layout-CG58T6P7.js";var N=e(t(),1),P=n(),F=({notificationType:e,size:t=`lg`,className:n})=>{let r,i=``,a=`white`,d=t===`sm`?13:20,f=t===`sm`?2:1.5;switch(e){case`follow`:r=(0,P.jsx)(c,{className:`-mt-0.5 -mr-0.5 ${t===`sm`&&`size-[11px]`}`,color:a,size:d,strokeWidth:f}),i=`bg-blue-600`;break;case`like`:r=(0,P.jsx)(s,{className:`${t===`sm`?`size-[11px]`:`mt-px size-5`}`,color:a,strokeWidth:f}),i=`bg-pink-600`;break;case`reply`:r=(0,P.jsx)(u,{className:`mr-px mb-px`,color:a,size:d,strokeWidth:f}),i=`bg-purple-600`;break;case`repost`:r=(0,P.jsx)(o,{color:a,size:d,strokeWidth:f}),i=`bg-green-500`;break;case`mention`:r=(0,P.jsx)(l,{className:`${t===`sm`?`size-[12px]`:`size-5`}`,color:a,size:d,strokeWidth:f}),i=`bg-orange-500`;break}return(0,P.jsx)(`div`,{className:`flex ${t===`sm`?`size-5`:`size-9`} items-center justify-center rounded-full ${i} ${n&&n}`,children:r})},I=N.createContext(void 0),L=({isGrouped:e,centerAlign:t,children:n,onClick:r,url:i,className:a})=>(0,P.jsx)(I.Provider,{value:{onClick:r,url:i},children:(0,P.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})});L.Icon=({size:e=`lg`,type:t})=>(0,P.jsx)(`div`,{className:`col-start-1 row-start-1`,children:(0,P.jsx)(F,{notificationType:t,size:e})}),L.Avatars=({children:e})=>(0,P.jsx)(`div`,{className:`col-start-2 row-start-1 flex gap-2`,children:e}),L.Content=({children:e})=>(0,P.jsx)(`div`,{className:`col-start-2 row-start-2 -mt-0.5 grow overflow-hidden`,children:e});var R=()=>(0,P.jsx)(`div`,{className:`h-px w-full bg-gray-200 dark:bg-gray-950`});function z(e){let t=1440*60*1e3,n=new Date(e).getTime();return(Math.floor(n/t)*t).toString()}function B(e){let t={},n=null,r=0;return e.forEach(e=>{e.type!==n&&(r+=1,n=e.type);let i=``,a=`_${z(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 V=({group:e})=>{let[t,...n]=e.actors,i=n.length>0,a=n.length,o=D(),s=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(m,{actor:t,align:`center`,isCurrentUser:!1,children:(0,P.jsx)(`span`,{className:`cursor-pointer font-semibold hover:underline text-black dark:text-white`,onClick:e=>{e?.stopPropagation(),t.handle&&p(t.handle,o)},children:t.name})}),i&&` and ${r(a)} ${a>1?`others`:`other`}`]});switch(e.type){case`follow`:return(0,P.jsxs)(P.Fragment,{children:[s,` followed you`]});case`like`:return(0,P.jsxs)(P.Fragment,{children:[s,` liked your `,e.post?.type===`article`?`post`:`note`]});case`repost`:return(0,P.jsxs)(P.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,P.jsx)(P.Fragment,{})},H=({content:e,className:t,stripTags:n=[]})=>{let r=(0,N.useRef)(null),i=D();return(0,N.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(),p(n,i))}};return e.addEventListener(`click`,t),()=>{e.removeEventListener(`click`,t)}},[i,e]),(0,P.jsx)(`div`,{dangerouslySetInnerHTML:{__html:k(A(e||``,n))},ref:r,className:t})},U=({post:e,variant:t})=>{let n=e?.attachments??[],r=n.length>0,{contentWarning:i,shouldHideContentWarning:a,shouldHideSensitiveMedia:o,revealSensitiveMedia:s,revealContentWarning:c}=_({contentWarning:e?.contentWarning,sensitive:e?.sensitive,hasMedia:r,resetKey:e?.id});return e?a&&i?t===`inline`?(0,P.jsxs)(`button`,{className:`mt-0.5 block max-w-full truncate text-left text-sm text-gray-700 hover:text-black dark:text-gray-600 dark:hover:text-white`,type:`button`,onClick:c,children:[(0,P.jsx)(`span`,{className:`font-semibold`,children:`Content warning:`}),` `,i,` `,(0,P.jsx)(`span`,{className:`font-semibold`,children:`Show`})]}):(0,P.jsx)(y,{className:`mt-2.5`,label:i,size:`compact`,onReveal:c}):t===`inline`?(0,P.jsxs)(`div`,{className:`ap-note-content mt-0.5 line-clamp-1 text-sm text-pretty text-gray-700 dark:text-gray-600`,children:[e.type===`article`&&e.title&&(0,P.jsxs)(P.Fragment,{children:[e.title,` — `]}),(0,P.jsx)(`span`,{dangerouslySetInnerHTML:{__html:k(A(e.content||``))}})]}):(0,P.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,P.jsx)(H,{className:`ap-note-content text-pretty`,content:e.content||``,stripTags:[`a`]}),r&&(0,P.jsxs)(`div`,{className:`relative mt-2.5 aspect-square w-[calc(20%-6.4px)] min-w-[96px] overflow-hidden rounded-md [&_img]:absolute [&_img]:inset-0 [&_img]:mt-0 [&_img]:size-full [&_img]:max-h-none [&_img]:max-w-none [&_img]:object-cover [&>.attachment-gallery]:absolute [&>.attachment-gallery]:inset-0 [&>.attachment-gallery]:mt-0 [&>.attachment-gallery]:grid [&>.attachment-gallery]:size-full`,children:[w({type:`Note`,attachment:n}),o&&(0,P.jsx)(h,{showLabel:!1,size:`compact`,isLayered:!0,onReveal:s})]})]}):null},W=()=>{let[e,t]=N.useState({}),n=D(),o=e=>{t(t=>({...t,[e]:!t[e]}))},s=()=>{},{data:c,error:l,fetchNextPage:u,hasNextPage:m,isFetchingNextPage:h,isLoading:_}=M(`index`),y=c?.pages.flatMap(e=>B(e.notifications))??Array(10).fill({actors:[{}]}),w=(0,N.useRef)(null),k=(0,N.useRef)(null);(0,N.useEffect)(()=>(w.current&&w.current.disconnect(),w.current=new IntersectionObserver(e=>{e[0].isIntersecting&&m&&!h&&u()}),k.current&&w.current.observe(k.current),()=>{w.current&&w.current.disconnect()}),[m,h,u]);let A=(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?o(e.id||`${e.type}_${t}`):e.actors[0]?.handle&&p(e.actors[0].handle,n);break;case`mention`:e.post&&n(`/notes/${encodeURIComponent(e.post.id)}`);break}};return l&&j(l)?(0,P.jsx)(b,{errorCode:l.code,statusCode:l.statusCode}):(0,P.jsx)(g,{children:(0,P.jsxs)(`div`,{className:`z-0 flex w-full flex-col items-center`,children:[_===!1&&y.length===0&&(0,P.jsxs)(v,{children:[(0,P.jsx)(x,{children:(0,P.jsx)(i,{})}),`Quiet for now, but not for long! When someone likes, boosts, or replies to you, you'll find it here.`]}),y.length>0&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{className:`my-8 flex w-full max-w-[620px] flex-col max-md:mt-5`,children:y.map((t,i)=>(0,P.jsxs)(N.Fragment,{children:[(0,P.jsxs)(L,{centerAlign:t.actors.length<2&&t.type===`follow`,className:`hover:bg-gray-100 dark:hover:bg-gray-950`,isGrouped:t.actors.length>1,onClick:()=>A(t,i),children:[_?(0,P.jsx)(T,{className:`rounded-full`,containerClassName:`flex h-10 w-10`}):t.actors.length>1?(0,P.jsx)(L.Icon,{type:t.type}):(0,P.jsxs)(`div`,{className:`relative`,children:[(0,P.jsx)(O,{author:{icon:{url:t.actors[0].avatarUrl||``},name:t.actors[0].name,handle:t.actors[0].handle},size:`notification`},t.actors[0].id),(0,P.jsx)(F,{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,P.jsx)(L.Avatars,{children:(0,P.jsxs)(`div`,{className:`flex w-full flex-col`,children:[(0,P.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,P.jsx)(O,{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,P.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,P.jsxs)(d,{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(),o(t.id||`${t.type}_${i}`)},children:[(0,P.jsx)(a,{className:`${e[t.id||`${t.type}_${i}`]?`rotate-180`:``}`,size:20,strokeWidth:1.5}),e[t.id||`${t.type}_${i}`]?`Hide`:(0,P.jsx)(`span`,{className:`sr-only`,children:`Show all`})]})]}),(0,P.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,P.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t.actors.map(e=>(0,P.jsxs)(`div`,{className:`group/item break-anywhere flex items-center justify-between gap-4`,onClick:t=>{t?.stopPropagation(),e.handle&&p(e.handle,n)},children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center`,children:[(0,P.jsx)(O,{author:{icon:{url:e.avatarUrl||``},name:e.name,handle:e.handle},size:`xs`}),(0,P.jsx)(`span`,{className:`ml-2 line-clamp-1 text-base font-semibold group-hover/item:underline dark:text-white`,children:e.name}),(0,P.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,P.jsx)(f,{following:!1,handle:e.handle,variant:`link`})]},e.id))})})]})}),(0,P.jsxs)(L.Content,{children:[(0,P.jsx)(`div`,{children:_?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(T,{}),(0,P.jsx)(T,{className:`w-full max-w-60`})]}):(0,P.jsxs)(`div`,{className:`flex justify-between`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,P.jsx)(`span`,{className:`truncate`,children:(0,P.jsx)(V,{group:t})}),t.actors.length<2&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{className:`mt-px text-[8px] text-gray-700 dark:text-gray-600`,children:`•`}),(0,P.jsx)(`span`,{className:`mt-0.5 text-sm text-gray-700 dark:text-gray-600`,children:C(t,!1)})]})]}),t.actors.length===1&&(t.type===`follow`||t.type===`reply`||t.type===`mention`)&&!t.actors[0].followedByMe&&t.actors[0].handle&&(0,P.jsx)(f,{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)&&(0,P.jsx)(U,{post:t.post,variant:t.type!==`reply`&&t.type!==`mention`?`inline`:`quoted`}),(t.type===`reply`&&t.post||t.type===`mention`)&&(0,P.jsx)(`div`,{className:`mt-1.5`,children:(0,P.jsx)(S,{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:s})})]})]}),i<y.length-1&&(0,P.jsx)(`div`,{className:`pl-[52px]`,children:(0,P.jsx)(R,{})})]},t.id||`${t.type}_${i}`))}),(0,P.jsx)(`div`,{ref:k,className:`h-1`}),h&&(0,P.jsx)(`div`,{className:`-mt-4 mb-8 flex flex-col items-center justify-center gap-4 text-center`,children:(0,P.jsx)(E,{size:`md`})})]})]})})};export{W as default};
|
|
1
|
+
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`4526fd21-ad76-4c19-a7cc-1e91b1bbdd1c`,e._sentryDebugIdIdentifier=`sentry-dbid-4526fd21-ad76-4c19-a7cc-1e91b1bbdd1c`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{t as n}from"./jsx-runtime-Bm2_KH-0.js";import{H as r}from"./shade-provider-DvrXKKQZ.js";import{Tr as i,ar as a,ct as o,gn as s,h as c,kr as l,ot as u,t as d}from"./button-CTHYSI-d.js";import{E as f,S as p,T as m,_ as h,a as g,b as _,i as v,m as y,n as b,r as x,w as S,x as C,y as w}from"./routes-DKfpFMfF.js";import{t as T}from"./skeleton-C1s6yr9e.js";import{n as E}from"./loading-indicator-DaRyGrxv.js";import{t as D}from"./use-navigate-with-base-path-pweMCFf6.js";import{l as O,o as k,s as A}from"./content-formatters-C08JJbUJ.js";import{q as j,w as M}from"./use-activity-pub-queries-BgR1USeY.js";import"./layout-_g2xhB0L.js";var N=e(t(),1),P=n(),F=({notificationType:e,size:t=`lg`,className:n})=>{let r,i=``,a=`white`,d=t===`sm`?13:20,f=t===`sm`?2:1.5;switch(e){case`follow`:r=(0,P.jsx)(c,{className:`-mt-0.5 -mr-0.5 ${t===`sm`&&`size-[11px]`}`,color:a,size:d,strokeWidth:f}),i=`bg-blue-600`;break;case`like`:r=(0,P.jsx)(s,{className:`${t===`sm`?`size-[11px]`:`mt-px size-5`}`,color:a,strokeWidth:f}),i=`bg-pink-600`;break;case`reply`:r=(0,P.jsx)(u,{className:`mr-px mb-px`,color:a,size:d,strokeWidth:f}),i=`bg-purple-600`;break;case`repost`:r=(0,P.jsx)(o,{color:a,size:d,strokeWidth:f}),i=`bg-green-500`;break;case`mention`:r=(0,P.jsx)(l,{className:`${t===`sm`?`size-[12px]`:`size-5`}`,color:a,size:d,strokeWidth:f}),i=`bg-orange-500`;break}return(0,P.jsx)(`div`,{className:`flex ${t===`sm`?`size-5`:`size-9`} items-center justify-center rounded-full ${i} ${n&&n}`,children:r})},I=N.createContext(void 0),L=({isGrouped:e,centerAlign:t,children:n,onClick:r,url:i,className:a})=>(0,P.jsx)(I.Provider,{value:{onClick:r,url:i},children:(0,P.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})});L.Icon=({size:e=`lg`,type:t})=>(0,P.jsx)(`div`,{className:`col-start-1 row-start-1`,children:(0,P.jsx)(F,{notificationType:t,size:e})}),L.Avatars=({children:e})=>(0,P.jsx)(`div`,{className:`col-start-2 row-start-1 flex gap-2`,children:e}),L.Content=({children:e})=>(0,P.jsx)(`div`,{className:`col-start-2 row-start-2 -mt-0.5 grow overflow-hidden`,children:e});var R=()=>(0,P.jsx)(`div`,{className:`h-px w-full bg-gray-200 dark:bg-gray-950`});function z(e){let t=1440*60*1e3,n=new Date(e).getTime();return(Math.floor(n/t)*t).toString()}function B(e){let t={},n=null,r=0;return e.forEach(e=>{e.type!==n&&(r+=1,n=e.type);let i=``,a=`_${z(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 V=({group:e})=>{let[t,...n]=e.actors,i=n.length>0,a=n.length,o=D(),s=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(m,{actor:t,align:`center`,isCurrentUser:!1,children:(0,P.jsx)(`span`,{className:`cursor-pointer font-semibold hover:underline text-black dark:text-white`,onClick:e=>{e?.stopPropagation(),t.handle&&p(t.handle,o)},children:t.name})}),i&&` and ${r(a)} ${a>1?`others`:`other`}`]});switch(e.type){case`follow`:return(0,P.jsxs)(P.Fragment,{children:[s,` followed you`]});case`like`:return(0,P.jsxs)(P.Fragment,{children:[s,` liked your `,e.post?.type===`article`?`post`:`note`]});case`repost`:return(0,P.jsxs)(P.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,P.jsx)(P.Fragment,{})},H=({content:e,className:t,stripTags:n=[]})=>{let r=(0,N.useRef)(null),i=D();return(0,N.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(),p(n,i))}};return e.addEventListener(`click`,t),()=>{e.removeEventListener(`click`,t)}},[i,e]),(0,P.jsx)(`div`,{dangerouslySetInnerHTML:{__html:k(A(e||``,n))},ref:r,className:t})},U=({post:e,variant:t})=>{let n=e?.attachments??[],r=n.length>0,{contentWarning:i,shouldHideContentWarning:a,shouldHideSensitiveMedia:o,revealSensitiveMedia:s,revealContentWarning:c}=_({contentWarning:e?.contentWarning,sensitive:e?.sensitive,hasMedia:r,resetKey:e?.id});return e?a&&i?t===`inline`?(0,P.jsxs)(`button`,{className:`mt-0.5 block max-w-full truncate text-left text-sm text-gray-700 hover:text-black dark:text-gray-600 dark:hover:text-white`,type:`button`,onClick:c,children:[(0,P.jsx)(`span`,{className:`font-semibold`,children:`Content warning:`}),` `,i,` `,(0,P.jsx)(`span`,{className:`font-semibold`,children:`Show`})]}):(0,P.jsx)(y,{className:`mt-2.5`,label:i,size:`compact`,onReveal:c}):t===`inline`?(0,P.jsxs)(`div`,{className:`ap-note-content mt-0.5 line-clamp-1 text-sm text-pretty text-gray-700 dark:text-gray-600`,children:[e.type===`article`&&e.title&&(0,P.jsxs)(P.Fragment,{children:[e.title,` — `]}),(0,P.jsx)(`span`,{dangerouslySetInnerHTML:{__html:k(A(e.content||``))}})]}):(0,P.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,P.jsx)(H,{className:`ap-note-content text-pretty`,content:e.content||``,stripTags:[`a`]}),r&&(0,P.jsxs)(`div`,{className:`relative mt-2.5 aspect-square w-[calc(20%-6.4px)] min-w-[96px] overflow-hidden rounded-md [&_img]:absolute [&_img]:inset-0 [&_img]:mt-0 [&_img]:size-full [&_img]:max-h-none [&_img]:max-w-none [&_img]:object-cover [&>.attachment-gallery]:absolute [&>.attachment-gallery]:inset-0 [&>.attachment-gallery]:mt-0 [&>.attachment-gallery]:grid [&>.attachment-gallery]:size-full`,children:[w({type:`Note`,attachment:n}),o&&(0,P.jsx)(h,{showLabel:!1,size:`compact`,isLayered:!0,onReveal:s})]})]}):null},W=()=>{let[e,t]=N.useState({}),n=D(),o=e=>{t(t=>({...t,[e]:!t[e]}))},s=()=>{},{data:c,error:l,fetchNextPage:u,hasNextPage:m,isFetchingNextPage:h,isLoading:_}=M(`index`),y=c?.pages.flatMap(e=>B(e.notifications))??Array(10).fill({actors:[{}]}),w=(0,N.useRef)(null),k=(0,N.useRef)(null);(0,N.useEffect)(()=>(w.current&&w.current.disconnect(),w.current=new IntersectionObserver(e=>{e[0].isIntersecting&&m&&!h&&u()}),k.current&&w.current.observe(k.current),()=>{w.current&&w.current.disconnect()}),[m,h,u]);let A=(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?o(e.id||`${e.type}_${t}`):e.actors[0]?.handle&&p(e.actors[0].handle,n);break;case`mention`:e.post&&n(`/notes/${encodeURIComponent(e.post.id)}`);break}};return l&&j(l)?(0,P.jsx)(b,{errorCode:l.code,statusCode:l.statusCode}):(0,P.jsx)(g,{children:(0,P.jsxs)(`div`,{className:`z-0 flex w-full flex-col items-center`,children:[_===!1&&y.length===0&&(0,P.jsxs)(v,{children:[(0,P.jsx)(x,{children:(0,P.jsx)(i,{})}),`Quiet for now, but not for long! When someone likes, boosts, or replies to you, you'll find it here.`]}),y.length>0&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{className:`my-8 flex w-full max-w-[620px] flex-col max-md:mt-5`,children:y.map((t,i)=>(0,P.jsxs)(N.Fragment,{children:[(0,P.jsxs)(L,{centerAlign:t.actors.length<2&&t.type===`follow`,className:`hover:bg-gray-100 dark:hover:bg-gray-950`,isGrouped:t.actors.length>1,onClick:()=>A(t,i),children:[_?(0,P.jsx)(T,{className:`rounded-full`,containerClassName:`flex h-10 w-10`}):t.actors.length>1?(0,P.jsx)(L.Icon,{type:t.type}):(0,P.jsxs)(`div`,{className:`relative`,children:[(0,P.jsx)(O,{author:{icon:{url:t.actors[0].avatarUrl||``},name:t.actors[0].name,handle:t.actors[0].handle},size:`notification`},t.actors[0].id),(0,P.jsx)(F,{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,P.jsx)(L.Avatars,{children:(0,P.jsxs)(`div`,{className:`flex w-full flex-col`,children:[(0,P.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,P.jsx)(O,{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,P.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,P.jsxs)(d,{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(),o(t.id||`${t.type}_${i}`)},children:[(0,P.jsx)(a,{className:`${e[t.id||`${t.type}_${i}`]?`rotate-180`:``}`,size:20,strokeWidth:1.5}),e[t.id||`${t.type}_${i}`]?`Hide`:(0,P.jsx)(`span`,{className:`sr-only`,children:`Show all`})]})]}),(0,P.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,P.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t.actors.map(e=>(0,P.jsxs)(`div`,{className:`group/item break-anywhere flex items-center justify-between gap-4`,onClick:t=>{t?.stopPropagation(),e.handle&&p(e.handle,n)},children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center`,children:[(0,P.jsx)(O,{author:{icon:{url:e.avatarUrl||``},name:e.name,handle:e.handle},size:`xs`}),(0,P.jsx)(`span`,{className:`ml-2 line-clamp-1 text-base font-semibold group-hover/item:underline dark:text-white`,children:e.name}),(0,P.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,P.jsx)(f,{following:!1,handle:e.handle,variant:`link`})]},e.id))})})]})}),(0,P.jsxs)(L.Content,{children:[(0,P.jsx)(`div`,{children:_?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(T,{}),(0,P.jsx)(T,{className:`w-full max-w-60`})]}):(0,P.jsxs)(`div`,{className:`flex justify-between`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,P.jsx)(`span`,{className:`truncate`,children:(0,P.jsx)(V,{group:t})}),t.actors.length<2&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{className:`mt-px text-[8px] text-gray-700 dark:text-gray-600`,children:`•`}),(0,P.jsx)(`span`,{className:`mt-0.5 text-sm text-gray-700 dark:text-gray-600`,children:C(t,!1)})]})]}),t.actors.length===1&&(t.type===`follow`||t.type===`reply`||t.type===`mention`)&&!t.actors[0].followedByMe&&t.actors[0].handle&&(0,P.jsx)(f,{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)&&(0,P.jsx)(U,{post:t.post,variant:t.type!==`reply`&&t.type!==`mention`?`inline`:`quoted`}),(t.type===`reply`&&t.post||t.type===`mention`)&&(0,P.jsx)(`div`,{className:`mt-1.5`,children:(0,P.jsx)(S,{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:s})})]})]}),i<y.length-1&&(0,P.jsx)(`div`,{className:`pl-[52px]`,children:(0,P.jsx)(R,{})})]},t.id||`${t.type}_${i}`))}),(0,P.jsx)(`div`,{ref:k,className:`h-1`}),h&&(0,P.jsx)(`div`,{className:`-mt-4 mb-8 flex flex-col items-center justify-center gap-4 text-center`,children:(0,P.jsx)(E,{size:`md`})})]})]})})};export{W as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`3fc2dee8-71d4-431b-a1cb-175a57858010`,e._sentryDebugIdIdentifier=`sentry-dbid-3fc2dee8-71d4-431b-a1cb-175a57858010`)}catch{}})();import{i as e}from"./framework-provider-CIvHFnik.js";import{i as t,n,r}from"./hooks-
|
|
1
|
+
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`3fc2dee8-71d4-431b-a1cb-175a57858010`,e._sentryDebugIdIdentifier=`sentry-dbid-3fc2dee8-71d4-431b-a1cb-175a57858010`)}catch{}})();import{i as e}from"./framework-provider-CIvHFnik.js";import{i as t,n,r}from"./hooks-0r7qxGEo.js";import{n as i,r as a}from"./update-queries-sbOKc6_E.js";var o=`OffersResponseType`,s=()=>{let t=e();return()=>t.invalidateQueries({queryKey:[o]})},c=r({dataType:o,path:`/offers/`,defaultSearchParams:{}}),l=t({dataType:o,path:e=>`/offers/${e}/`}),u=n({method:`PUT`,path:e=>`/offers/${e.id}/`,body:e=>({offers:[e]}),updateQueries:{dataType:o,emberUpdateType:`createOrUpdate`,update:a(`offers`)}}),d=n({method:`POST`,path:()=>`/offers/`,body:e=>({offers:[e]}),updateQueries:{dataType:o,emberUpdateType:`createOrUpdate`,update:i(`offers`)}});export{s as a,u as i,c as n,l as r,d as t};
|