ghost 6.17.2 → 6.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/components/{tryghost-i18n-6.17.2.tgz → tryghost-i18n-6.18.1.tgz} +0 -0
  2. package/components/{tryghost-parse-email-address-6.17.2.tgz → tryghost-parse-email-address-6.18.1.tgz} +0 -0
  3. package/core/built/admin/assets/{PolarAngleAxis-B8JrAxf_.js → PolarAngleAxis-Dod0DwfL.js} +1 -1
  4. package/core/built/admin/assets/{_baseAssignValue-Bbalamaq.js → _baseAssignValue-DnkbkowM.js} +1 -1
  5. package/core/built/admin/assets/{a-large-small-CgWPeKpi.js → a-large-small-C5mgFBRg.js} +1 -1
  6. package/core/built/admin/assets/activitypub/activitypub.js +1 -1
  7. package/core/built/admin/assets/activitypub/{at-sign-Fsk3x72r.mjs → at-sign-BR2C2gdz.mjs} +2 -2
  8. package/core/built/admin/assets/activitypub/{avatar-flipboard-C10JfFS_.mjs → avatar-flipboard-CJV3KhLU.mjs} +2 -2
  9. package/core/built/admin/assets/activitypub/{bluesky-sharing-C1xeGSL6.mjs → bluesky-sharing-DY4KCGPZ.mjs} +4 -4
  10. package/core/built/admin/assets/activitypub/{copy-C1fElSkQ.mjs → copy-CBFwbAdE.mjs} +2 -2
  11. package/core/built/admin/assets/activitypub/{deleted-feed-item-Bun4tY2_.mjs → deleted-feed-item-DOm9GxTQ.mjs} +2 -2
  12. package/core/built/admin/assets/activitypub/{edit-profile-CYh00FZ7.mjs → edit-profile-CcbnZWkM.mjs} +3 -3
  13. package/core/built/admin/assets/activitypub/{feed-BxUqmcN9.mjs → feed-BHiZU0Q_.mjs} +4 -4
  14. package/core/built/admin/assets/activitypub/{hash-CNgwAx-U.mjs → hash-Csjloy5t.mjs} +2 -2
  15. package/core/built/admin/assets/activitypub/{inbox-DqNqII4a.mjs → inbox-DGKbBux9.mjs} +2 -2
  16. package/core/built/admin/assets/activitypub/{index-CONoLlDU.mjs → index-Bt_qFJNY.mjs} +2 -2
  17. package/core/built/admin/assets/activitypub/{index--Q6orQkb.mjs → index-CCYuVHjm.mjs} +21 -21
  18. package/core/built/admin/assets/activitypub/{index-jhjmoHwu.mjs → index-CTV39jCH.mjs} +2 -2
  19. package/core/built/admin/assets/activitypub/{index-Dvh9q3jy.mjs → index-ClNx7qzi.mjs} +4 -4
  20. package/core/built/admin/assets/activitypub/{index-C9pnotJK.mjs → index-D6Y6ywyl.mjs} +6 -6
  21. package/core/built/admin/assets/activitypub/{index-BueIufRq.mjs → index-YLvIz6pJ.mjs} +5 -5
  22. package/core/built/admin/assets/activitypub/{index-C3KJXzZE.mjs → index-tWANcGjH.mjs} +7 -7
  23. package/core/built/admin/assets/activitypub/{index-CJJXnqq1.mjs → index-vVqFEPIX.mjs} +3 -3
  24. package/core/built/admin/assets/activitypub/{moderation-CYhwUFi2.mjs → moderation-CUGqRfT1.mjs} +3 -3
  25. package/core/built/admin/assets/activitypub/{note-COVa8CMw.mjs → note-DMy39JHG.mjs} +4 -4
  26. package/core/built/admin/assets/activitypub/{reply-BHpKVBxx.mjs → reply-BboFcDsv.mjs} +2 -2
  27. package/core/built/admin/assets/activitypub/{separator-DP7q5sFH.mjs → separator-DBvIXQnV.mjs} +2 -2
  28. package/core/built/admin/assets/activitypub/{settings-3n7zo_3K.mjs → settings-D4qRhs9E.mjs} +3 -3
  29. package/core/built/admin/assets/activitypub/{step-1-BmUukywZ.mjs → step-1-C-ubwwIT.mjs} +3 -3
  30. package/core/built/admin/assets/activitypub/{step-2-C--I3xxp.mjs → step-2-Dsd2XY1_.mjs} +5 -5
  31. package/core/built/admin/assets/activitypub/{step-3-0Deh5N9c.mjs → step-3-BHz3ow0t.mjs} +7 -7
  32. package/core/built/admin/assets/activitypub/{tabs-D_vmoLBo.mjs → tabs-s_P4XeyF.mjs} +3 -3
  33. package/core/built/admin/assets/activitypub/{topic-filter-DJMrhH-c.mjs → topic-filter-CCf15CR-.mjs} +2 -2
  34. package/core/built/admin/assets/admin-x-settings/admin-x-settings.js +1 -1
  35. package/core/built/admin/assets/admin-x-settings/{code-editor-view-BzvYs1fs.mjs → code-editor-view-BWi3-ftq.mjs} +2 -2
  36. package/core/built/admin/assets/admin-x-settings/{index-DdMo_pvD.mjs → index-B3PtvbUw.mjs} +2 -2
  37. package/core/built/admin/assets/admin-x-settings/{index-DYEF3NiM.mjs → index-Did70N9h.mjs} +2 -2
  38. package/core/built/admin/assets/admin-x-settings/{index-BXChUyr6.mjs → index-JaMlaX9G.mjs} +30 -19
  39. package/core/built/admin/assets/admin-x-settings/{modals-Ck3AHDx3.mjs → modals-Bwrf9ptQ.mjs} +8060 -8067
  40. package/core/built/admin/assets/{at-sign-BottTo2X.js → at-sign-Bz-SU-S_.js} +1 -1
  41. package/core/built/admin/assets/{audience-CcGOt5Fb.js → audience-DmVdEmIe.js} +1 -1
  42. package/core/built/admin/assets/{avatar-flipboard-MxW2k124.js → avatar-flipboard-C7sxDVEM.js} +1 -1
  43. package/core/built/admin/assets/{bluesky-sharing-BBmDBlxr.js → bluesky-sharing-DJniSF6N.js} +1 -1
  44. package/core/built/admin/assets/{chart-pimL5Chk.js → chart-mYz3IJwm.js} +1 -1
  45. package/core/built/admin/assets/{chunk.524.9a8f5123fd3ecf3e4451.js → chunk.524.9d300778a63b42b0de62.js} +7 -7
  46. package/core/built/admin/assets/{chunk.582.41886d06af2895d571bd.js → chunk.582.2e363cd976d9bba998b9.js} +10 -10
  47. package/core/built/admin/assets/{code-editor-view-tCZOpc_h.js → code-editor-view-BIQWFJ01.js} +1 -1
  48. package/core/built/admin/assets/comments-B_-hdjc6.js +1 -0
  49. package/core/built/admin/assets/{copy-aC0WUVtq.js → copy-Bpq3uhnh.js} +1 -1
  50. package/core/built/admin/assets/{data-list-BOdyZGWI.js → data-list-BYNMbRIq.js} +1 -1
  51. package/core/built/admin/assets/{deleted-feed-item-BnUJ8bWP.js → deleted-feed-item-B_AwUKZy.js} +1 -1
  52. package/core/built/admin/assets/{edit-profile-CEgPhWMJ.js → edit-profile-DZo2ZcOu.js} +1 -1
  53. package/core/built/admin/assets/{empty-indicator-CR_9BHAH.js → empty-indicator-Bn5wG9-T.js} +1 -1
  54. package/core/built/admin/assets/{en-ajofhc7o.js → en-D4zIrMLN.js} +1 -1
  55. package/core/built/admin/assets/{feed-Ci-ODCHE.js → feed-Bgq4RarU.js} +1 -1
  56. package/core/built/admin/assets/{filters-CmJJOv3I.js → filters-CpVwu1Gk.js} +1 -1
  57. package/core/built/admin/assets/{gh-chart-hn7wEnik.js → gh-chart-Br7NXn_b.js} +1 -1
  58. package/core/built/admin/assets/{ghost-78b420974adc056bf1c9570275a46535.css → ghost-3c48d37b32f4fcd7eb15cfd739905a03.css} +1 -1
  59. package/core/built/admin/assets/{ghost-a9268074d0a9b02198594a05ecd7a626.js → ghost-98a3c5fd6235ebd344594f491cb6d17b.js} +241 -246
  60. package/core/built/admin/assets/{ghost-dark-12abca67e79c76fe6bfed6cb81ba2a53.css → ghost-dark-0100fe3ec7b4c3f6d8d043c904254a63.css} +1 -1
  61. package/core/built/admin/assets/{growth-CQceZQ1g.js → growth-CiPDnWxJ.js} +1 -1
  62. package/core/built/admin/assets/{hash-BcaWmkw5.js → hash-Bc1e38oH.js} +1 -1
  63. package/core/built/admin/assets/{inbox-D9hID-rO.js → inbox-BcZNBNhk.js} +1 -1
  64. package/core/built/admin/assets/{index-d_UH71zm.js → index-BFEx_ouC.js} +1 -1
  65. package/core/built/admin/assets/{index-kXF42nga.js → index-B_7QsC5T.js} +1 -1
  66. package/core/built/admin/assets/{index-CZ3lARQ2.js → index-Bm5ZeLtt.js} +1 -1
  67. package/core/built/admin/assets/{index-DJDgMk-T.js → index-BpcL7RmI.js} +2 -2
  68. package/core/built/admin/assets/{index-g4BWcHhl.js → index-Brg4tecQ.js} +1 -1
  69. package/core/built/admin/assets/{index-f5Lv9kLb.js → index-CMTzNTew.js} +29 -29
  70. package/core/built/admin/assets/{index-Cl2eSBwg.js → index-CTfJflJ2.js} +1 -1
  71. package/core/built/admin/assets/{index-BJS8H75W.js → index-Cn32t_gv.js} +1 -1
  72. package/core/built/admin/assets/{index-D8syEvSm.js → index-CsidX7Si.js} +1 -1
  73. package/core/built/admin/assets/{index-DO76vL0R.js → index-D212VvOz.js} +1 -1
  74. package/core/built/admin/assets/{index-B1rKIiOr.js → index-D67LJ_H4.js} +1 -1
  75. package/core/built/admin/assets/{index-BmK6ThYl.js → index-DU3bv9jz.js} +1 -1
  76. package/core/built/admin/assets/{index-DYM1MbXR.js → index-Dv13wKfX.js} +1 -1
  77. package/core/built/admin/assets/{index-Do091GLu.js → index-ETsoQLbU.js} +1 -1
  78. package/core/built/admin/assets/{index-rluYcfd-.js → index-ZYDRMgcT.js} +1 -1
  79. package/core/built/admin/assets/{koenig-lexical-D2XHvS2J.js → koenig-lexical-DZUWzN0P.js} +1 -1
  80. package/core/built/admin/assets/{kpi-card-Dga9rFZ5.js → kpi-card-DENsK2xK.js} +1 -1
  81. package/core/built/admin/assets/{kpis-BbnqD1za.js → kpis-CDrs2iS1.js} +1 -1
  82. package/core/built/admin/assets/{label-D8WHEOe0.js → label-BznQtEEo.js} +1 -1
  83. package/core/built/admin/assets/{links-dgwx7ko1.js → links-lpAC3T1p.js} +1 -1
  84. package/core/built/admin/assets/{lucide-react-BARFK2PZ.js → lucide-react-CBigk-fq.js} +1 -1
  85. package/core/built/admin/assets/{main-layout-CcjtCuF_.js → main-layout-_SYQRjIl.js} +1 -1
  86. package/core/built/admin/assets/{message-square-text-BxquqPhA.js → message-square-text-cV8O_qKq.js} +1 -1
  87. package/core/built/admin/assets/{minus-Ziy4LSYD.js → minus-NvnQTlW7.js} +1 -1
  88. package/core/built/admin/assets/{modals-fMQzR7L6.js → modals-XRSkribf.js} +3 -3
  89. package/core/built/admin/assets/{moderation-Ci9UNwiZ.js → moderation-BQp1GEWG.js} +1 -1
  90. package/core/built/admin/assets/{newsletter-DnrS7Fvi.js → newsletter-foM6KNNV.js} +1 -1
  91. package/core/built/admin/assets/{newsletters-D78pgnas.js → newsletters-BexdXUhn.js} +1 -1
  92. package/core/built/admin/assets/{note-BAfNweZN.js → note-DuaUGOeZ.js} +1 -1
  93. package/core/built/admin/assets/{overview-CWQPNOF0.js → overview-DgKBNqyc.js} +1 -1
  94. package/core/built/admin/assets/{pagemenu-DjSqq3Wu.js → pagemenu-CZyroidv.js} +1 -1
  95. package/core/built/admin/assets/{post-analytics-c8kRV0YB.js → post-analytics-DLK2SOSQ.js} +1 -1
  96. package/core/built/admin/assets/{post-analytics-context-CEqWyqgm.js → post-analytics-context-CF7C67-0.js} +1 -1
  97. package/core/built/admin/assets/{post-analytics-header-CpPPBAz4.js → post-analytics-header-7GtJCx0W.js} +1 -1
  98. package/core/built/admin/assets/{post-share-modal-Dln0kZhn.js → post-share-modal-D8R7DUZP.js} +1 -1
  99. package/core/built/admin/assets/posts/{comments-CHEqbZPq.mjs → comments-Bn_vn_sb.mjs} +434 -407
  100. package/core/built/admin/assets/posts/{dialog-VFomJYla.mjs → dialog-CKPcMrj7.mjs} +3 -3
  101. package/core/built/admin/assets/posts/{empty-indicator-CT9qQsMO.mjs → empty-indicator-kkrhP6K_.mjs} +2 -2
  102. package/core/built/admin/assets/posts/{filters-BXCfSKKS.mjs → filters-DHsxxy0F.mjs} +6 -6
  103. package/core/built/admin/assets/posts/{growth-xMitvyvt.mjs → growth-D7ACh-oR.mjs} +12 -12
  104. package/core/built/admin/assets/posts/{heading-DIulQwgD.mjs → heading-BrKVbOxA.mjs} +2 -2
  105. package/core/built/admin/assets/posts/{hooks-BiBMDYOA.mjs → hooks-BBEMuLiW.mjs} +3 -3
  106. package/core/built/admin/assets/posts/{index-uYyMBANY.mjs → index-C0rRguZx.mjs} +9 -9
  107. package/core/built/admin/assets/posts/{kpis-DK6j0CJA.mjs → kpis-1o524OIK.mjs} +10 -10
  108. package/core/built/admin/assets/posts/{links-CBiYZsyk.mjs → links-JpeATx1f.mjs} +4 -4
  109. package/core/built/admin/assets/posts/{loading-indicator-BPPeKpVb.mjs → loading-indicator-BHAmSf8j.mjs} +3 -3
  110. package/core/built/admin/assets/posts/{main-layout-f-PcNn-6.mjs → main-layout-BTItAOQE.mjs} +2 -2
  111. package/core/built/admin/assets/posts/{newsletter-CSOyAfvO.mjs → newsletter-CQdsCEHv.mjs} +13 -13
  112. package/core/built/admin/assets/posts/{overview-Dve3Uxt4.mjs → overview-sYh4JN1D.mjs} +15 -15
  113. package/core/built/admin/assets/posts/{post-analytics-CPKxH7yg.mjs → post-analytics-DtLt2SWx.mjs} +6 -6
  114. package/core/built/admin/assets/posts/{post-analytics-context-B5zQoflZ.mjs → post-analytics-context-CB1yM9fk.mjs} +4 -4
  115. package/core/built/admin/assets/posts/{post-analytics-header-BBxuaptK.mjs → post-analytics-header-BYaWuL9W.mjs} +9 -9
  116. package/core/built/admin/assets/posts/{post-share-modal-D_iMXvnI.mjs → post-share-modal-V0HTOBaf.mjs} +4 -4
  117. package/core/built/admin/assets/posts/{posts-DW6ne0od.mjs → posts-DeQT3knv.mjs} +2 -2
  118. package/core/built/admin/assets/posts/posts.js +1 -1
  119. package/core/built/admin/assets/posts/{search-CVlPqGMA.mjs → search-CLjC37AT.mjs} +2 -2
  120. package/core/built/admin/assets/posts/{separator-YrJkDGVP.mjs → separator-KNoTIaJx.mjs} +5 -5
  121. package/core/built/admin/assets/posts/{sheet-T5GWxxrn.mjs → sheet-DBg_SCDt.mjs} +3 -3
  122. package/core/built/admin/assets/posts/{skeleton-qnvlkDy-.mjs → skeleton-DvsoolWu.mjs} +3 -3
  123. package/core/built/admin/assets/posts/{source-icon-DBU0eZwS.mjs → source-icon-OmRaTU2G.mjs} +3 -3
  124. package/core/built/admin/assets/posts/{stats-udwJVZP8.mjs → stats-BC2DzntY.mjs} +4 -4
  125. package/core/built/admin/assets/posts/{table-Cu0BZfBU.mjs → table-CxX9OKAj.mjs} +2 -2
  126. package/core/built/admin/assets/posts/{tabs-B-RaoD3I.mjs → tabs-B1jw7cBi.mjs} +10 -10
  127. package/core/built/admin/assets/posts/{tags-DSDGzArh.mjs → tags-BBilTo1a.mjs} +11 -11
  128. package/core/built/admin/assets/posts/{tags-DByfrDKO.mjs → tags-BitrLT_j.mjs} +2 -2
  129. package/core/built/admin/assets/posts/{use-infinite-virtual-scroll-B7dD2nWW.mjs → use-infinite-virtual-scroll-DaijA1ao.mjs} +3 -3
  130. package/core/built/admin/assets/posts/{web-B9wvEtJ_.mjs → web-CKmyC4Xj.mjs} +15 -15
  131. package/core/built/admin/assets/{posts-C1Eh5Ypq.js → posts-CL9UDYoW.js} +1 -1
  132. package/core/built/admin/assets/{repeat-CN4fiG5H.js → repeat-DgH39UKE.js} +1 -1
  133. package/core/built/admin/assets/{reply-BfWgvH7y.js → reply-DAaNxiy8.js} +1 -1
  134. package/core/built/admin/assets/{select-B_0NBkLz.js → select-Cor2wFXT.js} +1 -1
  135. package/core/built/admin/assets/{settings-BqaVcJee.js → settings-BeumESEN.js} +5 -5
  136. package/core/built/admin/assets/{settings-Dk9E7Fqv.js → settings-xRx917Gj.js} +1 -1
  137. package/core/built/admin/assets/{sort-button-C2M35dLh.js → sort-button-BNW3i4Lb.js} +1 -1
  138. package/core/built/admin/assets/{source-icon-DkGi13e_.js → source-icon-DvDuzw73.js} +1 -1
  139. package/core/built/admin/assets/{sprout-BKiwQsGn.js → sprout-C3cc0c-K.js} +1 -1
  140. package/core/built/admin/assets/{square-BEpRc_fY.js → square-tZp0_n7e.js} +1 -1
  141. package/core/built/admin/assets/stats/{audience-Dfo7BmNu.mjs → audience-BWqU7WWT.mjs} +3 -3
  142. package/core/built/admin/assets/stats/{index-DUWoiDE_.mjs → index-CUuQaROI.mjs} +5 -5
  143. package/core/built/admin/assets/stats/{index-Yo58temM.mjs → index-CcCyLMxL.mjs} +7 -7
  144. package/core/built/admin/assets/stats/{index-h0rsyxDz.mjs → index-D5mlMG4l.mjs} +8 -8
  145. package/core/built/admin/assets/stats/{index-_vL3Zubi.mjs → index-DXU2rE9t.mjs} +5 -5
  146. package/core/built/admin/assets/stats/{index-Banm1wtA.mjs → index-K7ASx7EG.mjs} +6 -6
  147. package/core/built/admin/assets/stats/{sort-button-i6PS-TUn.mjs → sort-button-CELUx6Zp.mjs} +3 -3
  148. package/core/built/admin/assets/stats/{stats-CjepXEWS.mjs → stats-d_u_in4l.mjs} +2 -2
  149. package/core/built/admin/assets/stats/stats.js +2 -2
  150. package/core/built/admin/assets/stats/{tabs-Q20S1oup.mjs → tabs-3wLZsy0v.mjs} +3 -3
  151. package/core/built/admin/assets/stats/{url-helpers-DrGoeEH1.mjs → url-helpers-Drq3xg0l.mjs} +4 -4
  152. package/core/built/admin/assets/stats/{use-growth-stats-BnffY2W3.mjs → use-growth-stats-28Sr42va.mjs} +3 -3
  153. package/core/built/admin/assets/{stats-CRgy_cWm.js → stats-2Jelnn-Q.js} +1 -1
  154. package/core/built/admin/assets/{stats-view-CTQ4qO3S.js → stats-view-CESy8ELH.js} +1 -1
  155. package/core/built/admin/assets/{step-1-CNbdmB8C.js → step-1-DrqdolAh.js} +1 -1
  156. package/core/built/admin/assets/{step-2-Ddrl2uae.js → step-2-DmEpKck5.js} +1 -1
  157. package/core/built/admin/assets/{step-3-CbqkEtwh.js → step-3-Bus-0o0n.js} +1 -1
  158. package/core/built/admin/assets/{table-Dw9xFlFd.js → table-BQUcKHfm.js} +1 -1
  159. package/core/built/admin/assets/{tabs-DCHagOip.js → tabs-BmdL0X4U.js} +1 -1
  160. package/core/built/admin/assets/{tags-DV2SSdMK.js → tags-CLxXZlOO.js} +1 -1
  161. package/core/built/admin/assets/{tags-BsDlfsPN.js → tags-EchqlZUJ.js} +1 -1
  162. package/core/built/admin/assets/{tiers-tc5tafWV.js → tiers-nCGyTly9.js} +1 -1
  163. package/core/built/admin/assets/{toggle-group-DS-ZVhCr.js → toggle-group-CM5uf7J1.js} +1 -1
  164. package/core/built/admin/assets/{topic-filter-BfoEqHRD.js → topic-filter-LTRvZ8aU.js} +1 -1
  165. package/core/built/admin/assets/{trash-CpnxYen-.js → trash-u5BxolyH.js} +1 -1
  166. package/core/built/admin/assets/{url-helpers-wKPPeCtD.js → url-helpers-D41fEt51.js} +1 -1
  167. package/core/built/admin/assets/{use-growth-stats-CbHIETF_.js → use-growth-stats-BJ0O9ewi.js} +1 -1
  168. package/core/built/admin/assets/{use-infinite-virtual-scroll-DU1EUhyj.js → use-infinite-virtual-scroll-APZWciOk.js} +1 -1
  169. package/core/built/admin/assets/{use-simple-pagination-X6kmRz2u.js → use-simple-pagination-DVRHeaAR.js} +1 -1
  170. package/core/built/admin/assets/{user-round-check-DYkrjHxF.js → user-round-check-B6j98D6d.js} +1 -1
  171. package/core/built/admin/assets/{wallet-cards-CSdWOmJE.js → wallet-cards-KmOh29LP.js} +1 -1
  172. package/core/built/admin/assets/{web-C39IKnvl.js → web-Cclotbnz.js} +1 -1
  173. package/core/built/admin/index.html +5 -5
  174. package/core/frontend/meta/asset-url.js +126 -15
  175. package/core/frontend/services/asset-hash/index.js +73 -0
  176. package/core/frontend/services/theme-engine/active.js +4 -2
  177. package/core/server/api/endpoints/utils/serializers/output/utils/post-gating.js +6 -0
  178. package/core/server/data/migrations/versions/6.17/2026-02-04-10-42-20-offers-nullable-product-id.js +11 -0
  179. package/core/server/data/migrations/versions/6.18/2026-02-04-10-42-20-offers-nullable-product-id.js +4 -0
  180. package/core/server/data/schema/schema.js +1 -1
  181. package/core/server/data/tinybird/datasources/_mv_daily_pages.datasource +13 -0
  182. package/core/server/data/tinybird/endpoints/api_top_pages_v3.pipe +113 -0
  183. package/core/server/data/tinybird/pipes/mv_daily_pages.pipe +23 -0
  184. package/core/server/data/tinybird/scripts/benchmark-top-pages.sh +186 -0
  185. package/core/server/data/tinybird/scripts/compare-top-pages.sh +262 -0
  186. package/core/server/data/tinybird/tests/api_top_pages_v3.yaml +112 -0
  187. package/core/server/models/automated-email.js +34 -0
  188. package/core/server/services/koenig/node-renderers/transistor-renderer.js +3 -8
  189. package/core/server/services/lib/member-signup-contexts.js +23 -0
  190. package/core/server/services/lib/member-signup-contexts.ts +22 -0
  191. package/core/server/services/member-welcome-emails/member-welcome-email-renderer.js +13 -7
  192. package/core/server/services/member-welcome-emails/service.js +84 -15
  193. package/core/server/services/members/members-api/controllers/router-controller.js +14 -0
  194. package/core/server/services/members/members-api/repositories/member-repository.js +1 -1
  195. package/core/server/services/members/members-api/services/payments-service.js +5 -0
  196. package/core/server/services/oembed/oembed-service.js +1 -1
  197. package/core/server/services/offers/application/offer-mapper.js +6 -7
  198. package/core/server/services/offers/application/offers-api.js +3 -3
  199. package/core/server/services/offers/domain/errors/index.js +2 -0
  200. package/core/server/services/offers/domain/models/offer.js +15 -3
  201. package/core/server/services/offers/offer-bookshelf-repository.js +4 -5
  202. package/core/server/services/stats/utils/tinybird.js +5 -3
  203. package/core/server/services/stripe/services/webhook/checkout-session-event-service.js +17 -1
  204. package/core/server/services/stripe/stripe-service.js +8 -0
  205. package/core/shared/config/defaults.json +6 -0
  206. package/core/shared/labs.js +3 -3
  207. package/core/shared/url-utils.js +2 -1
  208. package/package.json +6 -6
  209. package/tsconfig.tsbuildinfo +1 -1
  210. package/yarn.lock +23 -2
  211. package/core/built/admin/assets/comments-OXqhcC0t.js +0 -1
@@ -1 +1 @@
1
- import{G as T,I as F,J as _,K as E,r as d,M as V,N as H,b as R,j as e,L as W,O as $,Q as k,R as b,T as j,P as G,U as v,h as J,A as K,S as o,B as i,V as c}from"./index-f5Lv9kLb.js";import{T as O,a as Q,b as w,c as f}from"./tabs-DCHagOip.js";import"./index-DO76vL0R.js";import"./lucide-react-BARFK2PZ.js";import"./a-large-small-CgWPeKpi.js";import"./wallet-cards-CSdWOmJE.js";import"./at-sign-BottTo2X.js";import"./message-square-text-BxquqPhA.js";import"./copy-aC0WUVtq.js";import"./hash-BcaWmkw5.js";import"./inbox-D9hID-rO.js";import"./minus-Ziy4LSYD.js";import"./tags-DV2SSdMK.js";import"./square-BEpRc_fY.js";import"./user-round-check-DYkrjHxF.js";import"./repeat-CN4fiG5H.js";import"./reply-BfWgvH7y.js";import"./sprout-BKiwQsGn.js";import"./trash-CpnxYen-.js";const he=()=>{const{data:N,isLoading:l}=T("index"),{data:g,isLoading:n}=F("index"),m=l?Array(5).fill({apId:"",name:"",handle:"",avatarUrl:""}):N?.pages.flatMap(s=>s.accounts)??[],u=n?Array(5).fill({apId:"",name:""}):g?.pages.flatMap(s=>s.domains)??[],U=_("index"),I=E("index"),[M,x]=d.useState(new Set),B=V("index"),D=H("index"),[S,h]=d.useState(new Set),[p,r]=d.useState(null),y=R(),A=s=>{x(t=>{const a=new Set([...t]);return a.add(s.apId),a}),I.mutate(s),c.success("User unblocked")},L=s=>{x(t=>{const a=new Set([...t]);return a.delete(s.apId),a}),U.mutate(s),c.success("User blocked")},C=s=>{h(t=>{const a=new Set([...t]);return a.add(s.url),a}),D.mutate({url:s.url}),c.success("Domain unblocked")},P=s=>{h(t=>{const a=new Set([...t]);return a.delete(s.url),a}),B.mutate({url:s.url}),c.success("Domain blocked")};return e.jsx(W,{children:e.jsxs("div",{className:"mx-auto max-w-[620px] py-[min(4vh,48px)]",children:[e.jsx("div",{className:"flex items-center justify-between gap-8",children:e.jsx($,{children:"Moderation"})}),e.jsx("div",{className:"mt-6",children:e.jsxs(O,{defaultValue:"blocked_users",variant:"underline",children:[e.jsxs(Q,{children:[e.jsx(w,{value:"blocked_users",children:"Blocked users"}),e.jsx(w,{value:"blocked_domains",children:"Blocked domains"})]}),e.jsx(f,{className:"mt-2",value:"blocked_users",children:!l&&m.length===0?e.jsxs(k,{children:[e.jsx(b,{children:e.jsx(j,{})}),e.jsx("div",{className:"mt-2 flex max-w-[400px] flex-col items-center gap-1 text-center",children:e.jsx("p",{children:"When you block someone, they won't be able to follow you or interact with your content on the social web."})})]}):m.map((s,t)=>e.jsx(G,{actor:s,isCurrentUser:!0,children:e.jsx("div",{children:e.jsxs(v,{onClick:l?void 0:()=>J(s.handle,y),children:[e.jsx(K,{author:{icon:{url:s.avatarUrl},name:s.name,handle:s.handle}}),e.jsxs("div",{className:"flex min-w-0 flex-col",children:[e.jsx("span",{className:"block truncate font-semibold text-black dark:text-white",children:l?e.jsx(o,{className:"w-24"}):s.name}),e.jsx("span",{className:"block truncate text-sm text-gray-600",children:l?e.jsx(o,{className:"w-40"}):s.handle})]}),M.has(s.apId)?e.jsx(i,{className:"ml-auto min-w-[90px] text-red hover:!bg-red/5 hover:text-red-400",variant:"outline",onClick:a=>{a.stopPropagation(),L(s)},children:"Block"}):l?e.jsx("div",{className:"ml-auto w-16",children:e.jsx(o,{})}):e.jsx(i,{className:"ml-auto min-w-[90px]",variant:"destructive",onClick:a=>{a.stopPropagation(),A(s)},onMouseEnter:()=>r(s.apId),onMouseLeave:()=>r(null),children:p===s.apId?"Unblock":"Blocked"})]})})},s.apId?s.apId:`loading-${t}`))}),e.jsx(f,{className:"mt-[11px]",value:"blocked_domains",children:!n&&u.length===0?e.jsxs(k,{children:[e.jsx(b,{children:e.jsx(j,{})}),e.jsx("div",{className:"mt-2 flex max-w-[400px] flex-col items-center gap-1 text-center",children:e.jsx("p",{children:"When you block a domain, all users from that domain won't be able to follow you or interact with your content."})})]}):u.map((s,t)=>e.jsxs(v,{children:[e.jsx("div",{className:"flex min-w-0 flex-col",children:e.jsx("span",{className:"block truncate font-semibold text-black dark:text-white",children:n?e.jsx(o,{className:"w-48"}):new URL(s.url).hostname})}),S.has(s.url)?e.jsx(i,{className:"ml-auto min-w-[90px] text-red hover:!bg-red/5 hover:text-red-400",variant:"outline",onClick:()=>P(s),children:"Block"}):n?e.jsx("div",{className:"ml-auto w-16",children:e.jsx(o,{})}):e.jsx(i,{className:"ml-auto min-w-[90px]",variant:"destructive",onClick:()=>C(s),onMouseEnter:()=>r(s.url),onMouseLeave:()=>r(null),children:p===s.url?"Unblock":"Blocked"})]},s.url?s.url:`loading-${t}`))})]})})]})})};export{he as default};
1
+ import{G as T,I as F,J as _,K as E,r as d,M as V,N as H,b as R,j as e,L as W,O as $,Q as k,R as b,T as j,P as G,U as v,h as J,A as K,S as o,B as i,V as c}from"./index-CMTzNTew.js";import{T as O,a as Q,b as w,c as f}from"./tabs-BmdL0X4U.js";import"./index-D212VvOz.js";import"./lucide-react-CBigk-fq.js";import"./a-large-small-C5mgFBRg.js";import"./wallet-cards-KmOh29LP.js";import"./at-sign-Bz-SU-S_.js";import"./message-square-text-cV8O_qKq.js";import"./copy-Bpq3uhnh.js";import"./hash-Bc1e38oH.js";import"./inbox-BcZNBNhk.js";import"./minus-NvnQTlW7.js";import"./tags-CLxXZlOO.js";import"./square-tZp0_n7e.js";import"./user-round-check-B6j98D6d.js";import"./repeat-DgH39UKE.js";import"./reply-DAaNxiy8.js";import"./sprout-C3cc0c-K.js";import"./trash-u5BxolyH.js";const he=()=>{const{data:N,isLoading:l}=T("index"),{data:g,isLoading:n}=F("index"),m=l?Array(5).fill({apId:"",name:"",handle:"",avatarUrl:""}):N?.pages.flatMap(s=>s.accounts)??[],u=n?Array(5).fill({apId:"",name:""}):g?.pages.flatMap(s=>s.domains)??[],U=_("index"),I=E("index"),[M,x]=d.useState(new Set),B=V("index"),D=H("index"),[S,h]=d.useState(new Set),[p,r]=d.useState(null),y=R(),A=s=>{x(t=>{const a=new Set([...t]);return a.add(s.apId),a}),I.mutate(s),c.success("User unblocked")},L=s=>{x(t=>{const a=new Set([...t]);return a.delete(s.apId),a}),U.mutate(s),c.success("User blocked")},C=s=>{h(t=>{const a=new Set([...t]);return a.add(s.url),a}),D.mutate({url:s.url}),c.success("Domain unblocked")},P=s=>{h(t=>{const a=new Set([...t]);return a.delete(s.url),a}),B.mutate({url:s.url}),c.success("Domain blocked")};return e.jsx(W,{children:e.jsxs("div",{className:"mx-auto max-w-[620px] py-[min(4vh,48px)]",children:[e.jsx("div",{className:"flex items-center justify-between gap-8",children:e.jsx($,{children:"Moderation"})}),e.jsx("div",{className:"mt-6",children:e.jsxs(O,{defaultValue:"blocked_users",variant:"underline",children:[e.jsxs(Q,{children:[e.jsx(w,{value:"blocked_users",children:"Blocked users"}),e.jsx(w,{value:"blocked_domains",children:"Blocked domains"})]}),e.jsx(f,{className:"mt-2",value:"blocked_users",children:!l&&m.length===0?e.jsxs(k,{children:[e.jsx(b,{children:e.jsx(j,{})}),e.jsx("div",{className:"mt-2 flex max-w-[400px] flex-col items-center gap-1 text-center",children:e.jsx("p",{children:"When you block someone, they won't be able to follow you or interact with your content on the social web."})})]}):m.map((s,t)=>e.jsx(G,{actor:s,isCurrentUser:!0,children:e.jsx("div",{children:e.jsxs(v,{onClick:l?void 0:()=>J(s.handle,y),children:[e.jsx(K,{author:{icon:{url:s.avatarUrl},name:s.name,handle:s.handle}}),e.jsxs("div",{className:"flex min-w-0 flex-col",children:[e.jsx("span",{className:"block truncate font-semibold text-black dark:text-white",children:l?e.jsx(o,{className:"w-24"}):s.name}),e.jsx("span",{className:"block truncate text-sm text-gray-600",children:l?e.jsx(o,{className:"w-40"}):s.handle})]}),M.has(s.apId)?e.jsx(i,{className:"ml-auto min-w-[90px] text-red hover:!bg-red/5 hover:text-red-400",variant:"outline",onClick:a=>{a.stopPropagation(),L(s)},children:"Block"}):l?e.jsx("div",{className:"ml-auto w-16",children:e.jsx(o,{})}):e.jsx(i,{className:"ml-auto min-w-[90px]",variant:"destructive",onClick:a=>{a.stopPropagation(),A(s)},onMouseEnter:()=>r(s.apId),onMouseLeave:()=>r(null),children:p===s.apId?"Unblock":"Blocked"})]})})},s.apId?s.apId:`loading-${t}`))}),e.jsx(f,{className:"mt-[11px]",value:"blocked_domains",children:!n&&u.length===0?e.jsxs(k,{children:[e.jsx(b,{children:e.jsx(j,{})}),e.jsx("div",{className:"mt-2 flex max-w-[400px] flex-col items-center gap-1 text-center",children:e.jsx("p",{children:"When you block a domain, all users from that domain won't be able to follow you or interact with your content."})})]}):u.map((s,t)=>e.jsxs(v,{children:[e.jsx("div",{className:"flex min-w-0 flex-col",children:e.jsx("span",{className:"block truncate font-semibold text-black dark:text-white",children:n?e.jsx(o,{className:"w-48"}):new URL(s.url).hostname})}),S.has(s.url)?e.jsx(i,{className:"ml-auto min-w-[90px] text-red hover:!bg-red/5 hover:text-red-400",variant:"outline",onClick:()=>P(s),children:"Block"}):n?e.jsx("div",{className:"ml-auto w-16",children:e.jsx(o,{})}):e.jsx(i,{className:"ml-auto min-w-[90px]",variant:"destructive",onClick:()=>C(s),onMouseEnter:()=>r(s.url),onMouseLeave:()=>r(null),children:p===s.url?"Unblock":"Blocked"})]},s.url?s.url:`loading-${t}`))})]})})]})})};export{he as default};
@@ -1 +1 @@
1
- import{ae as Re,r,u as Se,aP as re,j as e,ai as N,aS as ne,aR as K,bE as le,cv as ee,bv as _e,bx as Fe,cw as Te,cx as Ae,cy as $e,B as q,aU as ze,aQ as Ee,aj as E,c8 as Me,C as De}from"./index-f5Lv9kLb.js";import{C as Q,a as Y,b as J,f as X,c as _,g as ce}from"./pagemenu-DjSqq3Wu.js";import{u as oe,S as de,a as me,b as pe,c as ue}from"./use-simple-pagination-X6kmRz2u.js";import{T as Ie,a as Ue,b as se}from"./tabs-DCHagOip.js";import{e as Be,f as Ve,g as Oe}from"./lucide-react-BARFK2PZ.js";import{a as We,P as Ge}from"./wallet-cards-CSdWOmJE.js";import{K as U,d as B,a as V,b as O,c as W}from"./kpi-card-Dga9rFZ5.js";import{P as He,a as Ke}from"./post-analytics-header-CpPPBAz4.js";import{D as qe,a as Qe,b as Ye,c as Je,d as Xe,e as Ze,f as es,g as ss}from"./data-list-BOdyZGWI.js";import{a as ts,u as as,p as is,g as G,N as H}from"./links-dgwx7ko1.js";import{u as rs}from"./post-analytics-context-CEqWyqgm.js";import{h as ns}from"./post-helpers-gInwAwEv.js";import{f as ls,g as cs}from"./stats-CRgy_cWm.js";import{g as te}from"./posts-C1Eh5Ypq.js";import"./index-DO76vL0R.js";import"./a-large-small-CgWPeKpi.js";import"./at-sign-BottTo2X.js";import"./message-square-text-BxquqPhA.js";import"./copy-aC0WUVtq.js";import"./hash-BcaWmkw5.js";import"./inbox-D9hID-rO.js";import"./minus-Ziy4LSYD.js";import"./tags-DV2SSdMK.js";import"./square-BEpRc_fY.js";import"./user-round-check-DYkrjHxF.js";import"./repeat-CN4fiG5H.js";import"./reply-BfWgvH7y.js";import"./sprout-BKiwQsGn.js";import"./trash-CpnxYen-.js";import"./post-share-modal-Dln0kZhn.js";import"./chart-pimL5Chk.js";import"./_baseAssignValue-Bbalamaq.js";import"./PolarAngleAxis-B8JrAxf_.js";const os="FeedbackResponseType",ds=Re({dataType:os,path:s=>`/feedback/${s}/`}),ms=(s,a)=>{const{data:c,isLoading:o,error:x}=ds(s,{searchParams:{limit:"50",...a!==void 0?{score:a.toString()}:{}}});return{feedback:r.useMemo(()=>c?.feedback?c.feedback:[],[c]),isLoading:o,error:x}},ps=({feedbackStats:s})=>{const{postId:a}=Se(),c=re(),[o,x]=r.useState("positive"),n=9,f=o==="positive"?1:0,{feedback:F,isLoading:L}=ms(a||"",f),{totalPages:k,paginatedData:i,nextPage:v,previousPage:R,hasNextPage:C,hasPreviousPage:l}=oe({data:F,itemsPerPage:n}),g=L;return e.jsxs(Q,{children:[e.jsxs(Y,{className:"pb-5",children:[e.jsx(J,{children:"Feedback"}),e.jsx(X,{children:"What did your readers think?"})]}),s.totalFeedback>0?e.jsxs(_,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(Ie,{className:"pb-3",defaultValue:"positive",value:o,variant:"button",onValueChange:d=>x(d),children:e.jsxs(Ue,{className:"gap-1",children:[e.jsx(se,{className:"h-7",value:"positive",children:e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx(Be,{size:14,strokeWidth:1.25}),e.jsx("span",{className:"hidden font-medium sm:!visible sm:!inline",children:"More like this"}),e.jsx("span",{className:"font-semibold tracking-tight",children:N(s.positiveFeedback/s.totalFeedback)})]})}),e.jsx(se,{className:"h-7",value:"negative",children:e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx(Ve,{size:14,strokeWidth:1.25}),e.jsx("span",{className:"hidden font-medium sm:!visible sm:!inline",children:"Less like this"}),e.jsx("span",{className:"font-semibold tracking-tight",children:N(s.negativeFeedback/s.totalFeedback)})]})})]})}),e.jsx(ne,{className:"mb-3 mr-2 lg:hidden xl:!visible xl:!block",children:"Date"})]}),e.jsx(K,{}),g?e.jsx(le,{className:"mt-3",lines:3}):i&&i.length>0?e.jsx("div",{className:"flex w-full flex-col py-3",children:i.map(d=>e.jsxs("div",{className:"flex h-10 w-full items-center justify-between gap-3 rounded-sm border-none px-2 text-sm hover:cursor-pointer hover:bg-accent",onClick:()=>{c(`/members/${d.member.id}`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-2 font-medium",children:[e.jsxs(_e,{className:"size-7",children:[d.member?.avatar_image&&e.jsx("img",{className:"absolute aspect-square size-full",src:d.member?.avatar_image}),e.jsx(Fe,{className:"text-white",style:{backgroundColor:`${Ae(ee(d.member),75,55)}`},children:Te(d.member)})]}),ee(d.member)]}),e.jsx("div",{className:"whitespace-nowrap text-muted-foreground",children:$e(d.created_at)})]},d.id))}):e.jsx("div",{className:"flex h-full items-center justify-center py-8 text-center text-sm text-muted-foreground",children:e.jsxs("div",{children:["No ",o==="positive"?"positive":"negative"," feedback yet"]})})]}):e.jsxs(_,{className:"flex grow flex-col items-center justify-center text-center text-sm text-muted-foreground",children:[e.jsx("div",{children:"No members have given feedback yet"}),e.jsx("div",{children:"When someone does, you'll see their response here."})]}),s.totalFeedback>0&&e.jsx(ce,{className:"grow-0",children:e.jsxs("div",{className:"flex w-full items-center justify-between gap-3",children:[e.jsxs(q,{variant:"outline",onClick:()=>{const d=`(feedback.post_id:'${a}'+feedback.score:1)`,m=`(feedback.post_id:'${a}'+feedback.score:0)`,y=`${encodeURIComponent(d)}&post=${a}`,h=`${encodeURIComponent(m)}&post=${a}`;c(`/members?filter=${o==="positive"?y:h}`,{crossApp:!0})},children:["View all",e.jsx(We,{})]}),k>1&&e.jsx(de,{className:"pb-0",children:e.jsxs(me,{children:[e.jsx(pe,{disabled:!l,onClick:R}),e.jsx(ue,{disabled:!C,onClick:v})]})})]})})]})},us=()=>{const{mutateAsync:s,isLoading:a}=ts();return{editLinks:s,isEditLinksLoading:a}},xs=s=>{const{data:a,isLoading:c}=te(s),{data:o,isLoading:x}=te(s,{searchParams:{include:"count.positive_feedback,count.negative_feedback"}}),n=r.useMemo(()=>a?.posts[0],[a]),f=r.useMemo(()=>o?.posts[0],[o]),F=r.useMemo(()=>n?{sent:n.email?.email_count||0,opened:n.email?.opened_count||0,clicked:n.count?.clicks||0,openedRate:n.email?.opened_count?n.email.opened_count/n.email.email_count:0,clickedRate:n.count?.clicks&&n.email?.email_count?n.count.clicks/n.email.email_count:0}:{sent:0,opened:0,clicked:0,openedRate:0,clickedRate:0},[n]),L=r.useMemo(()=>{if(!f?.count)return{positiveFeedback:0,negativeFeedback:0,totalFeedback:0};const p=f.count.positive_feedback||0,w=f.count.negative_feedback||0,j=p+w;return{positiveFeedback:p,negativeFeedback:w,totalFeedback:j}},[f]),k=r.useMemo(()=>n?.newsletter?.id,[n]),{data:i,isLoading:v}=ls({searchParams:k?{newsletter_id:k}:{},enabled:!!k}),R=r.useMemo(()=>i?.stats?i.stats.map(p=>p.post_id):[],[i]),{data:C,isLoading:l}=cs({searchParams:k&&R.length>0?{newsletter_id:k,post_ids:R.join(",")}:{},enabled:!!k&&R.length>0}),g=r.useMemo(()=>{if(!i?.stats)return;const p=i.stats,w=C?.stats||[],j=new Map;w.forEach(b=>{j.set(b.post_id,b)});const S=p.map(b=>{const z=j.get(b.post_id);return{...b,total_clicks:z?.total_clicks||0,click_rate:z?.click_rate||0}});return{...i,stats:S}},[i,C]),d=v||l,{data:m,isLoading:y,refetch:h}=as({searchParams:{filter:`post_id:'${s}'`}}),T=r.useMemo(()=>{if(!g||!g.stats)return{openRate:0,clickRate:0};const p=g.stats;if(p.length===0)return{openRate:0,clickRate:0};const w=p.reduce((S,b)=>S+(b.open_rate||0),0),j=p.reduce((S,b)=>S+(b.click_rate||0),0);return{openRate:Number((w/p.length).toFixed(2)),clickRate:Number((j/p.length).toFixed(2))}},[g]),M=r.useMemo(()=>is(m),[m]),D=r.useMemo(()=>({openedRate:T.openRate,clickedRate:T.clickRate}),[T]);return{post:n,stats:F,feedbackStats:L,averageStats:D,topLinks:M,refetchTopLinks:h,isLoading:c||x||d||y}},gs=({breakpoints:s={sm:1080,md:1280,lg:1360}}={})=>{const[a,c]=r.useState("md");return r.useEffect(()=>{const o=()=>{const x=window.innerWidth;x<s.sm?c("sm"):x<s.md?c("md"):c("lg")};return o(),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[s]),{chartSize:a,isSmall:a==="sm",isMedium:a==="md",isLarge:a==="lg"}},ae=()=>e.jsx("div",{className:"absolute -right-4 top-1/2 z-10 hidden size-8 -translate-y-1/2 items-center justify-center rounded-full border bg-background text-muted-foreground md:!visible md:!flex",children:e.jsx(De,{className:"ml-0.5",size:16,strokeWidth:1.5})}),ie=({dataColor:s,value:a,avgValue:c})=>e.jsxs("div",{className:"absolute left-1/2 top-6 z-50 flex w-[200px] -translate-x-1/2 flex-col items-stretch gap-1.5 rounded-md bg-background px-4 py-2 text-sm opacity-0 shadow-md transition-all group-hover/block:top-3 group-hover/block:opacity-100",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx("div",{className:"size-2 rounded-full bg-chart-blue opacity-50",style:{backgroundColor:s}}),"This newsletter"]}),e.jsx("div",{className:"text-right font-mono",children:a})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx("div",{className:"size-2 rounded-full bg-chart-gray opacity-80"}),"Average"]}),e.jsx("div",{className:"text-right font-mono",children:c})]})]}),Qs=()=>{const s=re(),[a,c]=r.useState(null),[o,x]=r.useState(""),n=r.useRef(null),f=r.useRef(null),F=10,{chartSize:L}=gs(),{appSettings:k}=ze(),{emailTrackClicks:i,emailTrackOpens:v}=k?.analytics||{},{post:R,isPostLoading:C,postId:l}=rs(),g=R,d=ns(g);r.useEffect(()=>{!C&&!d&&s(`/posts/analytics/${l}`)},[s,l,C,d]);const{stats:m,averageStats:y,topLinks:h,isLoading:T,refetchTopLinks:M}=xs(l),{editLinks:D}=us(),p=r.useMemo(()=>{if(!g?.count)return{positiveFeedback:0,negativeFeedback:0,totalFeedback:0};const t=g.count.positive_feedback||0,u=g.count.negative_feedback||0,P=t+u;return{positiveFeedback:t,negativeFeedback:u,totalFeedback:P}},[g]),w=r.useMemo(()=>g?.newsletter?.feedback_enabled===!0,[g]),j=r.useMemo(()=>p.totalFeedback>0?!0:w,[p.totalFeedback,w]),S=t=>{const u=G(h,t);u&&(c(t),x(u.link.to))},b=()=>{if(!a)return;const t=G(h,a);if(!t)return;const u=o.trim();if(u===""||u===t.link.to){c(null),x("");return}D({originalUrl:t.link.originalTo,editedUrl:o,postId:l},{onSuccess:()=>{c(null),x(""),M()}})},{totalPages:z,paginatedData:xe,nextPage:ge,previousPage:he,hasNextPage:be,hasPreviousPage:fe}=oe({data:h,itemsPerPage:F});r.useEffect(()=>{if(a&&n.current){n.current.focus();const t=G(h,a),u=P=>{f.current&&!f.current.contains(P.target)&&o===t?.link.to&&(c(null),x(""))};return document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}}},[a,o,h]);const I=T||C,ke=[{datatype:"Sent",value:1,fill:"url(#gradientPurple)",color:"hsl(var(--chart-purple))"}],ve={percentage:{label:"O"},Average:{label:"Average"},"This newsletter":{label:"This newsletter"}},je=[{datatype:"Average",value:y.openedRate,fill:"url(#gradientGray)",color:"hsl(var(--chart-gray))"},{datatype:"This newsletter",value:m.openedRate,fill:"url(#gradientBlue)",color:"hsl(var(--chart-blue))"}],Ne={percentage:{label:"Opened"},Average:{label:"Average"},"This newsletter":{label:"This newsletter"}},we=[{datatype:"Average",value:y.clickedRate,fill:"url(#gradientGray)",color:"hsl(var(--chart-gray))"},{datatype:"This newsletter",value:m.clickedRate,fill:"url(#gradientTeal)",color:"hsl(var(--chart-teal))"}],Ce={percentage:{label:"Clicked"},Average:{label:"Average"},"This newsletter":{label:"This newsletter"}};let A="grid-cols-3",$="aspect-[16/10] w-full max-w-[320px] sm:aspect-[2/1] md:aspect-[10/14] md:max-w-none lg:aspect-square";return(!i||!v)&&(A="grid-cols-2",$="aspect-[16/10] w-full max-w-[320px] sm:aspect-[2/1] md:aspect-square md:max-w-none lg:aspect-[15/10]"),!i&&!v&&(A="grid-cols-1",$="aspect-square w-full sm:aspect-[16/10] md:max-w-[320px] md:max-h-[320px] lg:aspect-[12/10]"),e.jsxs(e.Fragment,{children:[e.jsx(He,{currentTab:"Newsletter"}),e.jsx(Ke,{children:e.jsxs("div",{className:`grid grid-cols-1 gap-6 ${j&&i&&"lg:grid-cols-2"}`,children:[e.jsxs(Q,{className:j&&i?"lg:col-span-2":"",children:[e.jsxs(Y,{className:"hidden",children:[e.jsx(J,{children:"Newsletters"}),e.jsx(X,{children:"How did this post perform"})]}),I?e.jsx(_,{className:"h-[25vw] p-6",children:e.jsx(Ee,{})}):e.jsxs(_,{className:"p-0",children:[e.jsxs("div",{className:`grid ${A} items-stretch border-b`,children:[e.jsxs(U,{className:"group relative isolate grow p-3 md:px-6 md:py-5",children:[e.jsx(B,{onClick:()=>{const t=new URLSearchParams({filterParam:`emails.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:"View members →"}),e.jsxs(V,{onClick:()=>{const t=new URLSearchParams({filterParam:`emails.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:[e.jsx("div",{className:"ml-0.5 size-[9px] rounded-full bg-chart-purple !text-sm opacity-50 lg:text-base"}),"Sent"]}),e.jsx(O,{children:e.jsx(W,{className:"text-xl leading-none sm:text-2xl md:text-[2.6rem]",children:E(m.sent)})})]}),v&&e.jsxs(U,{className:"p-3 md:px-6 md:py-5",children:[e.jsx(B,{onClick:()=>{const t=new URLSearchParams({filterParam:`opened_emails.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:"View members →"}),e.jsxs(V,{onClick:()=>{const t=new URLSearchParams({filterParam:`opened_emails.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:[e.jsx("div",{className:"ml-0.5 size-[9px] rounded-full bg-chart-blue !text-sm opacity-50 lg:text-base"}),"Opened"]}),e.jsx(O,{children:e.jsx(W,{className:"text-xl leading-none sm:text-2xl md:text-[2.6rem]",children:E(m.opened)})})]}),i&&e.jsxs(U,{className:"group relative isolate grow p-3 md:px-6 md:py-5",children:[e.jsx(B,{onClick:()=>{const t=new URLSearchParams({filterParam:`clicked_links.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:"View members →"}),e.jsxs(V,{onClick:()=>{const t=new URLSearchParams({filterParam:`clicked_links.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:[e.jsx("div",{className:"ml-0.5 size-[9px] rounded-full bg-chart-teal !text-sm opacity-50 lg:text-base"}),"Clicked"]}),e.jsx(O,{children:e.jsx(W,{className:"text-xl leading-none sm:text-2xl md:text-[2.6rem]",children:E(m.clicked)})})]})]}),e.jsxs("div",{className:`$ mx-auto grid grid-cols-1 items-center justify-center gap-4 transition-all md:gap-0 ${A==="grid-cols-2"&&"md:grid-cols-2"} ${A==="grid-cols-3"&&"md:grid-cols-3"}`,children:[e.jsxs("div",{className:`relative border-r-0 px-6 ${(v||i)&&"md:border-r"}`,children:[e.jsx(H,{className:$,config:ve,data:ke,percentageLabel:"Sent",percentageValue:N(1),size:L,tooltip:!1}),(v||i)&&e.jsx(ae,{})]}),v&&e.jsxs("div",{className:`group/block relative border-r-0 px-6 transition-all hover:bg-muted/25 ${i&&"md:border-r"}`,children:[e.jsx(ie,{avgValue:N(y.openedRate),dataColor:"hsl(var(--chart-blue))",value:N(m.openedRate)}),e.jsx(H,{className:$,config:Ne,data:je,percentageLabel:"Open rate",percentageValue:N(m.openedRate),size:L,tooltip:!1}),i&&e.jsx(ae,{})]}),i&&e.jsxs("div",{className:"group/block relative px-6 transition-all hover:bg-muted/25",children:[e.jsx(ie,{avgValue:N(y.clickedRate),dataColor:"hsl(var(--chart-teal))",value:N(m.clickedRate)}),e.jsx(H,{className:$,config:Ce,data:we,percentageLabel:"Click rate",percentageValue:N(m.clickedRate),size:L,tooltip:!1})]})]})]})]}),j&&e.jsx(ps,{feedbackStats:p}),i&&e.jsxs(Q,{className:"group/datalist overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-6",children:[e.jsxs(Y,{className:"p-0",children:[e.jsx(J,{children:"Newsletter clicks"}),e.jsx(X,{children:"Which links resonated with your readers"})]}),e.jsx(ne,{className:"mr-2",children:"Members"})]}),I?e.jsxs(_,{className:"p-6 pt-0",children:[e.jsx(K,{}),e.jsx(le,{className:"mt-6"})]}):e.jsxs(_,{className:"pb-0",children:[e.jsx(K,{}),h.length>0?e.jsx(qe,{className:"",children:e.jsx(Qe,{children:xe?.map(t=>{const u=m.clicked>0?t.count/m.clicked:0,P=t.link.link_id,Z=t.link.title,ye=t.link.to,Pe=t.link.edited;return e.jsxs(Ye,{children:[a!==P&&e.jsx(Je,{style:{width:`${u?Math.round(u*100):0}%`}}),e.jsx(Xe,{className:"w-full",children:a===P?e.jsxs("div",{ref:f,className:"flex w-full items-center gap-2",children:[e.jsx(Me,{ref:n,className:"z-50 h-7 w-full border-border bg-background text-sm",value:o,onChange:Le=>x(Le.target.value)}),e.jsx(q,{size:"sm",onClick:b,children:"Update"})]}):e.jsxs(e.Fragment,{children:[e.jsx(q,{className:"mr-2 shrink-0 bg-background",size:"sm",variant:"outline",onClick:()=>S(P),children:e.jsx(Ge,{})}),e.jsx("a",{className:"block truncate font-medium hover:underline",href:ye,rel:"noreferrer",target:"_blank",title:Z,children:Z}),Pe&&e.jsx("span",{className:"ml-1 text-gray-500",children:"(edited)"})]})}),e.jsxs(Ze,{children:[e.jsx(es,{children:E(t.count||0)}),e.jsx(ss,{children:N(u)})]})]},P)})})}):e.jsx("div",{className:"py-20 text-center text-sm text-gray-700",children:"You have no links in your post."})]}),!I&&h.length>1&&e.jsx(ce,{children:e.jsxs("div",{className:"flex w-full items-start justify-between gap-3",children:[e.jsxs("div",{className:"mt-2 flex items-start gap-2 pl-4 text-sm text-green",children:[e.jsx(Oe,{size:20,strokeWidth:1.5}),"Sent a broken link? You can update it!"]}),z>1&&e.jsx(de,{className:"pb-0",children:e.jsxs(me,{children:[e.jsx(pe,{disabled:!fe,onClick:he}),e.jsx(ue,{disabled:!be,onClick:ge})]})})]})})]})]})})]})};export{Qs as default};
1
+ import{ae as Re,r,u as Se,aP as re,j as e,ai as N,aS as ne,aR as K,bE as le,cv as ee,bv as _e,bx as Fe,cw as Te,cx as Ae,cy as $e,B as q,aU as ze,aQ as Ee,aj as E,c8 as Me,C as De}from"./index-CMTzNTew.js";import{C as Q,a as Y,b as J,f as X,c as _,g as ce}from"./pagemenu-CZyroidv.js";import{u as oe,S as de,a as me,b as pe,c as ue}from"./use-simple-pagination-DVRHeaAR.js";import{T as Ie,a as Ue,b as se}from"./tabs-BmdL0X4U.js";import{e as Be,f as Ve,g as Oe}from"./lucide-react-CBigk-fq.js";import{a as We,P as Ge}from"./wallet-cards-KmOh29LP.js";import{K as U,d as B,a as V,b as O,c as W}from"./kpi-card-DENsK2xK.js";import{P as He,a as Ke}from"./post-analytics-header-7GtJCx0W.js";import{D as qe,a as Qe,b as Ye,c as Je,d as Xe,e as Ze,f as es,g as ss}from"./data-list-BYNMbRIq.js";import{a as ts,u as as,p as is,g as G,N as H}from"./links-lpAC3T1p.js";import{u as rs}from"./post-analytics-context-CF7C67-0.js";import{h as ns}from"./post-helpers-gInwAwEv.js";import{f as ls,g as cs}from"./stats-2Jelnn-Q.js";import{g as te}from"./posts-CL9UDYoW.js";import"./index-D212VvOz.js";import"./a-large-small-C5mgFBRg.js";import"./at-sign-Bz-SU-S_.js";import"./message-square-text-cV8O_qKq.js";import"./copy-Bpq3uhnh.js";import"./hash-Bc1e38oH.js";import"./inbox-BcZNBNhk.js";import"./minus-NvnQTlW7.js";import"./tags-CLxXZlOO.js";import"./square-tZp0_n7e.js";import"./user-round-check-B6j98D6d.js";import"./repeat-DgH39UKE.js";import"./reply-DAaNxiy8.js";import"./sprout-C3cc0c-K.js";import"./trash-u5BxolyH.js";import"./post-share-modal-D8R7DUZP.js";import"./chart-mYz3IJwm.js";import"./_baseAssignValue-DnkbkowM.js";import"./PolarAngleAxis-Dod0DwfL.js";const os="FeedbackResponseType",ds=Re({dataType:os,path:s=>`/feedback/${s}/`}),ms=(s,a)=>{const{data:c,isLoading:o,error:x}=ds(s,{searchParams:{limit:"50",...a!==void 0?{score:a.toString()}:{}}});return{feedback:r.useMemo(()=>c?.feedback?c.feedback:[],[c]),isLoading:o,error:x}},ps=({feedbackStats:s})=>{const{postId:a}=Se(),c=re(),[o,x]=r.useState("positive"),n=9,f=o==="positive"?1:0,{feedback:F,isLoading:L}=ms(a||"",f),{totalPages:k,paginatedData:i,nextPage:v,previousPage:R,hasNextPage:C,hasPreviousPage:l}=oe({data:F,itemsPerPage:n}),g=L;return e.jsxs(Q,{children:[e.jsxs(Y,{className:"pb-5",children:[e.jsx(J,{children:"Feedback"}),e.jsx(X,{children:"What did your readers think?"})]}),s.totalFeedback>0?e.jsxs(_,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(Ie,{className:"pb-3",defaultValue:"positive",value:o,variant:"button",onValueChange:d=>x(d),children:e.jsxs(Ue,{className:"gap-1",children:[e.jsx(se,{className:"h-7",value:"positive",children:e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx(Be,{size:14,strokeWidth:1.25}),e.jsx("span",{className:"hidden font-medium sm:!visible sm:!inline",children:"More like this"}),e.jsx("span",{className:"font-semibold tracking-tight",children:N(s.positiveFeedback/s.totalFeedback)})]})}),e.jsx(se,{className:"h-7",value:"negative",children:e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx(Ve,{size:14,strokeWidth:1.25}),e.jsx("span",{className:"hidden font-medium sm:!visible sm:!inline",children:"Less like this"}),e.jsx("span",{className:"font-semibold tracking-tight",children:N(s.negativeFeedback/s.totalFeedback)})]})})]})}),e.jsx(ne,{className:"mb-3 mr-2 lg:hidden xl:!visible xl:!block",children:"Date"})]}),e.jsx(K,{}),g?e.jsx(le,{className:"mt-3",lines:3}):i&&i.length>0?e.jsx("div",{className:"flex w-full flex-col py-3",children:i.map(d=>e.jsxs("div",{className:"flex h-10 w-full items-center justify-between gap-3 rounded-sm border-none px-2 text-sm hover:cursor-pointer hover:bg-accent",onClick:()=>{c(`/members/${d.member.id}`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-2 font-medium",children:[e.jsxs(_e,{className:"size-7",children:[d.member?.avatar_image&&e.jsx("img",{className:"absolute aspect-square size-full",src:d.member?.avatar_image}),e.jsx(Fe,{className:"text-white",style:{backgroundColor:`${Ae(ee(d.member),75,55)}`},children:Te(d.member)})]}),ee(d.member)]}),e.jsx("div",{className:"whitespace-nowrap text-muted-foreground",children:$e(d.created_at)})]},d.id))}):e.jsx("div",{className:"flex h-full items-center justify-center py-8 text-center text-sm text-muted-foreground",children:e.jsxs("div",{children:["No ",o==="positive"?"positive":"negative"," feedback yet"]})})]}):e.jsxs(_,{className:"flex grow flex-col items-center justify-center text-center text-sm text-muted-foreground",children:[e.jsx("div",{children:"No members have given feedback yet"}),e.jsx("div",{children:"When someone does, you'll see their response here."})]}),s.totalFeedback>0&&e.jsx(ce,{className:"grow-0",children:e.jsxs("div",{className:"flex w-full items-center justify-between gap-3",children:[e.jsxs(q,{variant:"outline",onClick:()=>{const d=`(feedback.post_id:'${a}'+feedback.score:1)`,m=`(feedback.post_id:'${a}'+feedback.score:0)`,y=`${encodeURIComponent(d)}&post=${a}`,h=`${encodeURIComponent(m)}&post=${a}`;c(`/members?filter=${o==="positive"?y:h}`,{crossApp:!0})},children:["View all",e.jsx(We,{})]}),k>1&&e.jsx(de,{className:"pb-0",children:e.jsxs(me,{children:[e.jsx(pe,{disabled:!l,onClick:R}),e.jsx(ue,{disabled:!C,onClick:v})]})})]})})]})},us=()=>{const{mutateAsync:s,isLoading:a}=ts();return{editLinks:s,isEditLinksLoading:a}},xs=s=>{const{data:a,isLoading:c}=te(s),{data:o,isLoading:x}=te(s,{searchParams:{include:"count.positive_feedback,count.negative_feedback"}}),n=r.useMemo(()=>a?.posts[0],[a]),f=r.useMemo(()=>o?.posts[0],[o]),F=r.useMemo(()=>n?{sent:n.email?.email_count||0,opened:n.email?.opened_count||0,clicked:n.count?.clicks||0,openedRate:n.email?.opened_count?n.email.opened_count/n.email.email_count:0,clickedRate:n.count?.clicks&&n.email?.email_count?n.count.clicks/n.email.email_count:0}:{sent:0,opened:0,clicked:0,openedRate:0,clickedRate:0},[n]),L=r.useMemo(()=>{if(!f?.count)return{positiveFeedback:0,negativeFeedback:0,totalFeedback:0};const p=f.count.positive_feedback||0,w=f.count.negative_feedback||0,j=p+w;return{positiveFeedback:p,negativeFeedback:w,totalFeedback:j}},[f]),k=r.useMemo(()=>n?.newsletter?.id,[n]),{data:i,isLoading:v}=ls({searchParams:k?{newsletter_id:k}:{},enabled:!!k}),R=r.useMemo(()=>i?.stats?i.stats.map(p=>p.post_id):[],[i]),{data:C,isLoading:l}=cs({searchParams:k&&R.length>0?{newsletter_id:k,post_ids:R.join(",")}:{},enabled:!!k&&R.length>0}),g=r.useMemo(()=>{if(!i?.stats)return;const p=i.stats,w=C?.stats||[],j=new Map;w.forEach(b=>{j.set(b.post_id,b)});const S=p.map(b=>{const z=j.get(b.post_id);return{...b,total_clicks:z?.total_clicks||0,click_rate:z?.click_rate||0}});return{...i,stats:S}},[i,C]),d=v||l,{data:m,isLoading:y,refetch:h}=as({searchParams:{filter:`post_id:'${s}'`}}),T=r.useMemo(()=>{if(!g||!g.stats)return{openRate:0,clickRate:0};const p=g.stats;if(p.length===0)return{openRate:0,clickRate:0};const w=p.reduce((S,b)=>S+(b.open_rate||0),0),j=p.reduce((S,b)=>S+(b.click_rate||0),0);return{openRate:Number((w/p.length).toFixed(2)),clickRate:Number((j/p.length).toFixed(2))}},[g]),M=r.useMemo(()=>is(m),[m]),D=r.useMemo(()=>({openedRate:T.openRate,clickedRate:T.clickRate}),[T]);return{post:n,stats:F,feedbackStats:L,averageStats:D,topLinks:M,refetchTopLinks:h,isLoading:c||x||d||y}},gs=({breakpoints:s={sm:1080,md:1280,lg:1360}}={})=>{const[a,c]=r.useState("md");return r.useEffect(()=>{const o=()=>{const x=window.innerWidth;x<s.sm?c("sm"):x<s.md?c("md"):c("lg")};return o(),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[s]),{chartSize:a,isSmall:a==="sm",isMedium:a==="md",isLarge:a==="lg"}},ae=()=>e.jsx("div",{className:"absolute -right-4 top-1/2 z-10 hidden size-8 -translate-y-1/2 items-center justify-center rounded-full border bg-background text-muted-foreground md:!visible md:!flex",children:e.jsx(De,{className:"ml-0.5",size:16,strokeWidth:1.5})}),ie=({dataColor:s,value:a,avgValue:c})=>e.jsxs("div",{className:"absolute left-1/2 top-6 z-50 flex w-[200px] -translate-x-1/2 flex-col items-stretch gap-1.5 rounded-md bg-background px-4 py-2 text-sm opacity-0 shadow-md transition-all group-hover/block:top-3 group-hover/block:opacity-100",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx("div",{className:"size-2 rounded-full bg-chart-blue opacity-50",style:{backgroundColor:s}}),"This newsletter"]}),e.jsx("div",{className:"text-right font-mono",children:a})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx("div",{className:"size-2 rounded-full bg-chart-gray opacity-80"}),"Average"]}),e.jsx("div",{className:"text-right font-mono",children:c})]})]}),Qs=()=>{const s=re(),[a,c]=r.useState(null),[o,x]=r.useState(""),n=r.useRef(null),f=r.useRef(null),F=10,{chartSize:L}=gs(),{appSettings:k}=ze(),{emailTrackClicks:i,emailTrackOpens:v}=k?.analytics||{},{post:R,isPostLoading:C,postId:l}=rs(),g=R,d=ns(g);r.useEffect(()=>{!C&&!d&&s(`/posts/analytics/${l}`)},[s,l,C,d]);const{stats:m,averageStats:y,topLinks:h,isLoading:T,refetchTopLinks:M}=xs(l),{editLinks:D}=us(),p=r.useMemo(()=>{if(!g?.count)return{positiveFeedback:0,negativeFeedback:0,totalFeedback:0};const t=g.count.positive_feedback||0,u=g.count.negative_feedback||0,P=t+u;return{positiveFeedback:t,negativeFeedback:u,totalFeedback:P}},[g]),w=r.useMemo(()=>g?.newsletter?.feedback_enabled===!0,[g]),j=r.useMemo(()=>p.totalFeedback>0?!0:w,[p.totalFeedback,w]),S=t=>{const u=G(h,t);u&&(c(t),x(u.link.to))},b=()=>{if(!a)return;const t=G(h,a);if(!t)return;const u=o.trim();if(u===""||u===t.link.to){c(null),x("");return}D({originalUrl:t.link.originalTo,editedUrl:o,postId:l},{onSuccess:()=>{c(null),x(""),M()}})},{totalPages:z,paginatedData:xe,nextPage:ge,previousPage:he,hasNextPage:be,hasPreviousPage:fe}=oe({data:h,itemsPerPage:F});r.useEffect(()=>{if(a&&n.current){n.current.focus();const t=G(h,a),u=P=>{f.current&&!f.current.contains(P.target)&&o===t?.link.to&&(c(null),x(""))};return document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}}},[a,o,h]);const I=T||C,ke=[{datatype:"Sent",value:1,fill:"url(#gradientPurple)",color:"hsl(var(--chart-purple))"}],ve={percentage:{label:"O"},Average:{label:"Average"},"This newsletter":{label:"This newsletter"}},je=[{datatype:"Average",value:y.openedRate,fill:"url(#gradientGray)",color:"hsl(var(--chart-gray))"},{datatype:"This newsletter",value:m.openedRate,fill:"url(#gradientBlue)",color:"hsl(var(--chart-blue))"}],Ne={percentage:{label:"Opened"},Average:{label:"Average"},"This newsletter":{label:"This newsletter"}},we=[{datatype:"Average",value:y.clickedRate,fill:"url(#gradientGray)",color:"hsl(var(--chart-gray))"},{datatype:"This newsletter",value:m.clickedRate,fill:"url(#gradientTeal)",color:"hsl(var(--chart-teal))"}],Ce={percentage:{label:"Clicked"},Average:{label:"Average"},"This newsletter":{label:"This newsletter"}};let A="grid-cols-3",$="aspect-[16/10] w-full max-w-[320px] sm:aspect-[2/1] md:aspect-[10/14] md:max-w-none lg:aspect-square";return(!i||!v)&&(A="grid-cols-2",$="aspect-[16/10] w-full max-w-[320px] sm:aspect-[2/1] md:aspect-square md:max-w-none lg:aspect-[15/10]"),!i&&!v&&(A="grid-cols-1",$="aspect-square w-full sm:aspect-[16/10] md:max-w-[320px] md:max-h-[320px] lg:aspect-[12/10]"),e.jsxs(e.Fragment,{children:[e.jsx(He,{currentTab:"Newsletter"}),e.jsx(Ke,{children:e.jsxs("div",{className:`grid grid-cols-1 gap-6 ${j&&i&&"lg:grid-cols-2"}`,children:[e.jsxs(Q,{className:j&&i?"lg:col-span-2":"",children:[e.jsxs(Y,{className:"hidden",children:[e.jsx(J,{children:"Newsletters"}),e.jsx(X,{children:"How did this post perform"})]}),I?e.jsx(_,{className:"h-[25vw] p-6",children:e.jsx(Ee,{})}):e.jsxs(_,{className:"p-0",children:[e.jsxs("div",{className:`grid ${A} items-stretch border-b`,children:[e.jsxs(U,{className:"group relative isolate grow p-3 md:px-6 md:py-5",children:[e.jsx(B,{onClick:()=>{const t=new URLSearchParams({filterParam:`emails.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:"View members →"}),e.jsxs(V,{onClick:()=>{const t=new URLSearchParams({filterParam:`emails.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:[e.jsx("div",{className:"ml-0.5 size-[9px] rounded-full bg-chart-purple !text-sm opacity-50 lg:text-base"}),"Sent"]}),e.jsx(O,{children:e.jsx(W,{className:"text-xl leading-none sm:text-2xl md:text-[2.6rem]",children:E(m.sent)})})]}),v&&e.jsxs(U,{className:"p-3 md:px-6 md:py-5",children:[e.jsx(B,{onClick:()=>{const t=new URLSearchParams({filterParam:`opened_emails.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:"View members →"}),e.jsxs(V,{onClick:()=>{const t=new URLSearchParams({filterParam:`opened_emails.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:[e.jsx("div",{className:"ml-0.5 size-[9px] rounded-full bg-chart-blue !text-sm opacity-50 lg:text-base"}),"Opened"]}),e.jsx(O,{children:e.jsx(W,{className:"text-xl leading-none sm:text-2xl md:text-[2.6rem]",children:E(m.opened)})})]}),i&&e.jsxs(U,{className:"group relative isolate grow p-3 md:px-6 md:py-5",children:[e.jsx(B,{onClick:()=>{const t=new URLSearchParams({filterParam:`clicked_links.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:"View members →"}),e.jsxs(V,{onClick:()=>{const t=new URLSearchParams({filterParam:`clicked_links.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:[e.jsx("div",{className:"ml-0.5 size-[9px] rounded-full bg-chart-teal !text-sm opacity-50 lg:text-base"}),"Clicked"]}),e.jsx(O,{children:e.jsx(W,{className:"text-xl leading-none sm:text-2xl md:text-[2.6rem]",children:E(m.clicked)})})]})]}),e.jsxs("div",{className:`$ mx-auto grid grid-cols-1 items-center justify-center gap-4 transition-all md:gap-0 ${A==="grid-cols-2"&&"md:grid-cols-2"} ${A==="grid-cols-3"&&"md:grid-cols-3"}`,children:[e.jsxs("div",{className:`relative border-r-0 px-6 ${(v||i)&&"md:border-r"}`,children:[e.jsx(H,{className:$,config:ve,data:ke,percentageLabel:"Sent",percentageValue:N(1),size:L,tooltip:!1}),(v||i)&&e.jsx(ae,{})]}),v&&e.jsxs("div",{className:`group/block relative border-r-0 px-6 transition-all hover:bg-muted/25 ${i&&"md:border-r"}`,children:[e.jsx(ie,{avgValue:N(y.openedRate),dataColor:"hsl(var(--chart-blue))",value:N(m.openedRate)}),e.jsx(H,{className:$,config:Ne,data:je,percentageLabel:"Open rate",percentageValue:N(m.openedRate),size:L,tooltip:!1}),i&&e.jsx(ae,{})]}),i&&e.jsxs("div",{className:"group/block relative px-6 transition-all hover:bg-muted/25",children:[e.jsx(ie,{avgValue:N(y.clickedRate),dataColor:"hsl(var(--chart-teal))",value:N(m.clickedRate)}),e.jsx(H,{className:$,config:Ce,data:we,percentageLabel:"Click rate",percentageValue:N(m.clickedRate),size:L,tooltip:!1})]})]})]})]}),j&&e.jsx(ps,{feedbackStats:p}),i&&e.jsxs(Q,{className:"group/datalist overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-6",children:[e.jsxs(Y,{className:"p-0",children:[e.jsx(J,{children:"Newsletter clicks"}),e.jsx(X,{children:"Which links resonated with your readers"})]}),e.jsx(ne,{className:"mr-2",children:"Members"})]}),I?e.jsxs(_,{className:"p-6 pt-0",children:[e.jsx(K,{}),e.jsx(le,{className:"mt-6"})]}):e.jsxs(_,{className:"pb-0",children:[e.jsx(K,{}),h.length>0?e.jsx(qe,{className:"",children:e.jsx(Qe,{children:xe?.map(t=>{const u=m.clicked>0?t.count/m.clicked:0,P=t.link.link_id,Z=t.link.title,ye=t.link.to,Pe=t.link.edited;return e.jsxs(Ye,{children:[a!==P&&e.jsx(Je,{style:{width:`${u?Math.round(u*100):0}%`}}),e.jsx(Xe,{className:"w-full",children:a===P?e.jsxs("div",{ref:f,className:"flex w-full items-center gap-2",children:[e.jsx(Me,{ref:n,className:"z-50 h-7 w-full border-border bg-background text-sm",value:o,onChange:Le=>x(Le.target.value)}),e.jsx(q,{size:"sm",onClick:b,children:"Update"})]}):e.jsxs(e.Fragment,{children:[e.jsx(q,{className:"mr-2 shrink-0 bg-background",size:"sm",variant:"outline",onClick:()=>S(P),children:e.jsx(Ge,{})}),e.jsx("a",{className:"block truncate font-medium hover:underline",href:ye,rel:"noreferrer",target:"_blank",title:Z,children:Z}),Pe&&e.jsx("span",{className:"ml-1 text-gray-500",children:"(edited)"})]})}),e.jsxs(Ze,{children:[e.jsx(es,{children:E(t.count||0)}),e.jsx(ss,{children:N(u)})]})]},P)})})}):e.jsx("div",{className:"py-20 text-center text-sm text-gray-700",children:"You have no links in your post."})]}),!I&&h.length>1&&e.jsx(ce,{children:e.jsxs("div",{className:"flex w-full items-start justify-between gap-3",children:[e.jsxs("div",{className:"mt-2 flex items-start gap-2 pl-4 text-sm text-green",children:[e.jsx(Oe,{size:20,strokeWidth:1.5}),"Sent a broken link? You can update it!"]}),z>1&&e.jsx(de,{className:"pb-0",children:e.jsxs(me,{children:[e.jsx(pe,{disabled:!fe,onClick:he}),e.jsx(ue,{disabled:!be,onClick:ge})]})})]})})]})]})})]})};export{Qs as default};
@@ -1 +1 @@
1
- import{ak as p,ad as n,al as u,am as i}from"./index-f5Lv9kLb.js";const a="NewslettersResponseType",d=a,l=p({dataType:a,path:"/newsletters/",defaultSearchParams:{include:"count.active_members,count.posts",limit:"50"},defaultNextPageParams:(e,t)=>{var s;return{...t,page:(((s=e.meta)==null?void 0:s.pagination.next)||1).toString()}},returnData:e=>{const{pages:t}=e,s=t.flatMap(o=>o.newsletters),r=t[t.length-1].meta;return{newsletters:s,meta:r,isEnd:r?r.pagination.pages===r.pagination.page:!0}}}),m=n({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:a,emberUpdateType:"createOrUpdate",update:u("newsletters")}}),w=n({method:"PUT",path:e=>`/newsletters/${e.id}/`,body:e=>({newsletters:[e]}),defaultSearchParams:{include:"count.active_members,count.posts"},updateQueries:{dataType:a,emberUpdateType:"createOrUpdate",update:i("newsletters")}}),g=n({method:"PUT",path:()=>"/newsletters/verifications/",body:({token:e})=>({token:e}),defaultSearchParams:{include:"count.active_members,count.posts"},updateQueries:{dataType:a,emberUpdateType:"createOrUpdate",update:i("newsletters")}});export{m as a,w as b,g as c,d as n,l as u};
1
+ import{ak as p,ad as n,al as u,am as i}from"./index-CMTzNTew.js";const a="NewslettersResponseType",d=a,l=p({dataType:a,path:"/newsletters/",defaultSearchParams:{include:"count.active_members,count.posts",limit:"50"},defaultNextPageParams:(e,t)=>{var s;return{...t,page:(((s=e.meta)==null?void 0:s.pagination.next)||1).toString()}},returnData:e=>{const{pages:t}=e,s=t.flatMap(o=>o.newsletters),r=t[t.length-1].meta;return{newsletters:s,meta:r,isEnd:r?r.pagination.pages===r.pagination.page:!0}}}),m=n({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:a,emberUpdateType:"createOrUpdate",update:u("newsletters")}}),w=n({method:"PUT",path:e=>`/newsletters/${e.id}/`,body:e=>({newsletters:[e]}),defaultSearchParams:{include:"count.active_members,count.posts"},updateQueries:{dataType:a,emberUpdateType:"createOrUpdate",update:i("newsletters")}}),g=n({method:"PUT",path:()=>"/newsletters/verifications/",body:({token:e})=>({token:e}),defaultSearchParams:{include:"count.active_members,count.posts"},updateQueries:{dataType:a,emberUpdateType:"createOrUpdate",update:i("newsletters")}});export{m as a,w as b,g as c,d as n,l as u};
@@ -1 +1 @@
1
- import{u as Z,a as _,r as a,b as G,j as e,L as N,S as r,E as ee,c as te,P as se,A as ne,g as ae,d as oe,h as le,F as j,e as ce,i as y,f as ie}from"./index-f5Lv9kLb.js";import{u as re,D as de,A as ue,S as A}from"./deleted-feed-item-BnUJ8bWP.js";import{H as xe}from"./hash-BcaWmkw5.js";import"./trash-CpnxYen-.js";const C=()=>e.jsx("div",{className:"h-px w-full bg-gray-200 dark:bg-gray-950"}),Ce=()=>{const{postId:$}=Z(),{canGoBack:R}=_(),[U,z]=a.useState(new Set),[B,T]=a.useState(new Set),[k,S]=a.useState(new Set),[p,P]=a.useState(!1),H=a.useRef(null),w=a.useRef(null),d=a.useRef(null),v=a.useRef(null),m=G(),{threadParents:u,post:n,processedReplies:E,isLoading:I,loadMoreChildren:D,loadMoreChildReplies:F,hasMoreChildren:b,hasMoreChildReplies:f}=re(decodeURIComponent($??""),{includeAncestors:!0}),o=n?.object,V=o?.replyCount??0,[L,q]=a.useState(!1);if(a.useEffect(()=>{w.current&&u.length>0&&!L&&(w.current.scrollIntoView({behavior:"instant",block:"start"}),q(!0))},[u,L]),a.useEffect(()=>{d.current&&d.current.disconnect();const t=document.querySelector("[data-scrollable-container]");if(t)return d.current=new IntersectionObserver(async l=>{if(l[0].isIntersecting&&b&&!p){P(!0);try{await D()}catch(s){console.error("Failed to load more top-level replies:",s)}finally{P(!1)}}},{root:t,rootMargin:"200px"}),v.current&&d.current.observe(v.current),()=>{d.current&&d.current.disconnect()}},[b,p,D]),I)return e.jsx(N,{children:e.jsxs("div",{className:"mx-auto flex max-w-[620px] flex-col items-center gap-3 pt-9 lg:px-8",children:[e.jsxs("div",{className:"flex w-full items-center gap-3",children:[e.jsx(r,{className:"size-10 rounded-full"}),e.jsxs("div",{className:"grow pt-1",children:[e.jsx(r,{className:"w-24"}),e.jsx(r,{className:"w-3/5"})]})]}),e.jsxs("div",{className:"mb-7 w-full",children:[e.jsx(r,{}),e.jsx(r,{className:"w-4/5"}),e.jsx(r,{})]}),e.jsx(C,{}),e.jsxs("div",{className:"flex w-full items-center gap-3 py-3",children:[e.jsx(r,{className:"block size-full",containerClassName:"size-10 rounded-full overflow-hidden"}),e.jsxs("div",{children:[e.jsx(r,{className:"w-52"}),e.jsx(r,{className:"w-28"})]})]}),e.jsx(C,{})]})});if(!n)return e.jsx(N,{children:e.jsx("div",{className:"mx-auto mt-4 flex w-full max-w-[620px] flex-col items-center",children:e.jsxs(ee,{children:[e.jsx(te,{children:e.jsx(xe,{})}),e.jsx("div",{children:"Error loading note."})]})})});function g(){}function O(t){z(l=>{const s=new Set(l);return s.has(t)?s.delete(t):(s.add(t),T(c=>{const x=new Set(c);return x.add(t),x})),s})}async function W(t,l){if(!k.has(t)){S(s=>new Set(s).add(t));try{F&&await F(l)}catch(s){console.error("Failed to load more replies for chain:",s)}finally{S(s=>{const c=new Set(s);return c.delete(t),c})}}}return e.jsx(N,{children:e.jsx("div",{className:"mx-auto flex h-full max-w-[620px] flex-col",children:e.jsx("div",{className:"relative flex-1",children:e.jsx("div",{className:"grow overflow-y-auto",children:e.jsxs("div",{className:"mx-auto px-8 pb-10 pt-5 max-lg:px-0",children:[!u.length&&e.jsx(se,{actor:n.actor,isCurrentUser:n.object.authored,children:e.jsxs("div",{className:`col-[2/3] mx-auto flex w-full cursor-pointer items-center gap-3 ${R?"pt-10 max-md:pt-5":"pt-5"}`,children:[e.jsx("div",{className:"relative z-10",children:e.jsx(ne,{author:n.actor,showFollowButton:!n.object.authored&&!n.actor.followedByMe})}),e.jsxs("div",{className:"relative z-10 flex w-full min-w-0 cursor-pointer flex-col overflow-visible text-[1.5rem]",onClick:t=>{le(n.actor,m,t)},children:[e.jsx("div",{className:"flex w-full",children:e.jsx("span",{className:"min-w-0 truncate whitespace-nowrap font-semibold hover:underline",children:n.actor.name})}),e.jsxs("div",{className:"flex w-full",children:[e.jsx("span",{className:'truncate text-gray-700 after:mx-1 after:font-normal after:text-gray-700 after:content-["·"]',children:ae(n.actor)}),e.jsx("span",{className:"text-gray-700",children:oe(o,!o.authored)})]})]})]})}),u.map(t=>t.object.type==="Tombstone"?e.jsx(de,{last:!1}):e.jsx(j,{actor:t.actor,allowDelete:!1,commentCount:t.object.replyCount??0,last:!1,layout:"reply",likeCount:t.object.likeCount??0,object:t.object,repostCount:t.object.repostCount??0,type:"Note",onClick:()=>{m(`/${t.object.type==="Article"?"reader":"notes"}/${encodeURIComponent(t.object.id)}`)}})),e.jsx("div",{ref:w,className:`${R?"scroll-mt-[12px]":"scroll-mt-[124px]"}`,children:e.jsxs("div",{className:`${u.length>0&&"min-h-[calc(100vh-52px)]"}`,children:[e.jsx(j,{actor:n.actor,allowDelete:!1,commentCount:V,last:!0,layout:"modal",likeCount:o.likeCount??0,object:o,repostCount:o.repostCount,showHeader:u.length>0,showStats:!0,type:"Note"}),e.jsx(ue,{object:o}),e.jsx(C,{}),e.jsxs("div",{ref:H,children:[E.map((t,l)=>{const s=l===E.length-1,c=t.mainReply.id,x=U.has(c),J=B.has(c),K=k.has(c),h=t.chain.length>0;return e.jsxs(ce.Fragment,{children:[e.jsx(j,{actor:t.mainReply.actor,allowDelete:t.mainReply.object.authored,commentCount:t.mainReply.object.replyCount??0,isChainParent:h,isPending:y(t.mainReply.id),last:!h,layout:"reply",likeCount:t.mainReply.object.likeCount??0,object:t.mainReply.object,parentId:o.id,repostCount:t.mainReply.object.repostCount??0,type:"Note",onClick:()=>{m(`/notes/${encodeURIComponent(t.mainReply.id)}`)},onDelete:g}),h&&t.chain[0]&&e.jsx(j,{actor:t.chain[0].actor,allowDelete:t.chain[0].object.authored,commentCount:t.chain[0].object.replyCount??0,isChainContinuation:!0,isPending:y(t.chain[0].id),last:t.chain.length===1,layout:"reply",likeCount:t.chain[0].object.likeCount??0,object:t.chain[0].object,parentId:o.id,repostCount:t.chain[0].object.repostCount??0,type:"Note",onClick:()=>{m(`/notes/${encodeURIComponent(t.chain[0].id)}`)},onDelete:g},t.chain[0].id),h&&x&&t.chain.slice(1).map((i,Q)=>{const M=Q===t.chain.slice(1).length-1,X=f&&f(l),Y=M&&X;return e.jsx(j,{actor:i.actor,allowDelete:i.object.authored,commentCount:i.object.replyCount??0,isChainContinuation:!0,isPending:y(i.id),last:M&&!Y,layout:"reply",likeCount:i.object.likeCount??0,object:i.object,parentId:o.id,repostCount:i.object.repostCount??0,type:"Note",onClick:()=>{m(`/notes/${encodeURIComponent(i.id)}`)},onDelete:g},i.id)}),h&&t.chain.length>1&&!x&&e.jsx(A,{variant:"expand",onClick:()=>O(c)}),h&&x&&J&&f&&f(l)&&e.jsx(A,{loading:K,variant:"loadMore",onClick:()=>W(c,l)}),!s&&e.jsx(C,{})]},t.mainReply.id)}),p&&e.jsx("div",{className:"flex flex-col items-center justify-center text-center",children:e.jsx(ie,{size:"md"})})]}),b&&e.jsx("div",{ref:v,className:"h-1"})]})})]})})})})})};export{Ce as default};
1
+ import{u as Z,a as _,r as a,b as G,j as e,L as N,S as r,E as ee,c as te,P as se,A as ne,g as ae,d as oe,h as le,F as j,e as ce,i as y,f as ie}from"./index-CMTzNTew.js";import{u as re,D as de,A as ue,S as A}from"./deleted-feed-item-B_AwUKZy.js";import{H as xe}from"./hash-Bc1e38oH.js";import"./trash-u5BxolyH.js";const C=()=>e.jsx("div",{className:"h-px w-full bg-gray-200 dark:bg-gray-950"}),Ce=()=>{const{postId:$}=Z(),{canGoBack:R}=_(),[U,z]=a.useState(new Set),[B,T]=a.useState(new Set),[k,S]=a.useState(new Set),[p,P]=a.useState(!1),H=a.useRef(null),w=a.useRef(null),d=a.useRef(null),v=a.useRef(null),m=G(),{threadParents:u,post:n,processedReplies:E,isLoading:I,loadMoreChildren:D,loadMoreChildReplies:F,hasMoreChildren:b,hasMoreChildReplies:f}=re(decodeURIComponent($??""),{includeAncestors:!0}),o=n?.object,V=o?.replyCount??0,[L,q]=a.useState(!1);if(a.useEffect(()=>{w.current&&u.length>0&&!L&&(w.current.scrollIntoView({behavior:"instant",block:"start"}),q(!0))},[u,L]),a.useEffect(()=>{d.current&&d.current.disconnect();const t=document.querySelector("[data-scrollable-container]");if(t)return d.current=new IntersectionObserver(async l=>{if(l[0].isIntersecting&&b&&!p){P(!0);try{await D()}catch(s){console.error("Failed to load more top-level replies:",s)}finally{P(!1)}}},{root:t,rootMargin:"200px"}),v.current&&d.current.observe(v.current),()=>{d.current&&d.current.disconnect()}},[b,p,D]),I)return e.jsx(N,{children:e.jsxs("div",{className:"mx-auto flex max-w-[620px] flex-col items-center gap-3 pt-9 lg:px-8",children:[e.jsxs("div",{className:"flex w-full items-center gap-3",children:[e.jsx(r,{className:"size-10 rounded-full"}),e.jsxs("div",{className:"grow pt-1",children:[e.jsx(r,{className:"w-24"}),e.jsx(r,{className:"w-3/5"})]})]}),e.jsxs("div",{className:"mb-7 w-full",children:[e.jsx(r,{}),e.jsx(r,{className:"w-4/5"}),e.jsx(r,{})]}),e.jsx(C,{}),e.jsxs("div",{className:"flex w-full items-center gap-3 py-3",children:[e.jsx(r,{className:"block size-full",containerClassName:"size-10 rounded-full overflow-hidden"}),e.jsxs("div",{children:[e.jsx(r,{className:"w-52"}),e.jsx(r,{className:"w-28"})]})]}),e.jsx(C,{})]})});if(!n)return e.jsx(N,{children:e.jsx("div",{className:"mx-auto mt-4 flex w-full max-w-[620px] flex-col items-center",children:e.jsxs(ee,{children:[e.jsx(te,{children:e.jsx(xe,{})}),e.jsx("div",{children:"Error loading note."})]})})});function g(){}function O(t){z(l=>{const s=new Set(l);return s.has(t)?s.delete(t):(s.add(t),T(c=>{const x=new Set(c);return x.add(t),x})),s})}async function W(t,l){if(!k.has(t)){S(s=>new Set(s).add(t));try{F&&await F(l)}catch(s){console.error("Failed to load more replies for chain:",s)}finally{S(s=>{const c=new Set(s);return c.delete(t),c})}}}return e.jsx(N,{children:e.jsx("div",{className:"mx-auto flex h-full max-w-[620px] flex-col",children:e.jsx("div",{className:"relative flex-1",children:e.jsx("div",{className:"grow overflow-y-auto",children:e.jsxs("div",{className:"mx-auto px-8 pb-10 pt-5 max-lg:px-0",children:[!u.length&&e.jsx(se,{actor:n.actor,isCurrentUser:n.object.authored,children:e.jsxs("div",{className:`col-[2/3] mx-auto flex w-full cursor-pointer items-center gap-3 ${R?"pt-10 max-md:pt-5":"pt-5"}`,children:[e.jsx("div",{className:"relative z-10",children:e.jsx(ne,{author:n.actor,showFollowButton:!n.object.authored&&!n.actor.followedByMe})}),e.jsxs("div",{className:"relative z-10 flex w-full min-w-0 cursor-pointer flex-col overflow-visible text-[1.5rem]",onClick:t=>{le(n.actor,m,t)},children:[e.jsx("div",{className:"flex w-full",children:e.jsx("span",{className:"min-w-0 truncate whitespace-nowrap font-semibold hover:underline",children:n.actor.name})}),e.jsxs("div",{className:"flex w-full",children:[e.jsx("span",{className:'truncate text-gray-700 after:mx-1 after:font-normal after:text-gray-700 after:content-["·"]',children:ae(n.actor)}),e.jsx("span",{className:"text-gray-700",children:oe(o,!o.authored)})]})]})]})}),u.map(t=>t.object.type==="Tombstone"?e.jsx(de,{last:!1}):e.jsx(j,{actor:t.actor,allowDelete:!1,commentCount:t.object.replyCount??0,last:!1,layout:"reply",likeCount:t.object.likeCount??0,object:t.object,repostCount:t.object.repostCount??0,type:"Note",onClick:()=>{m(`/${t.object.type==="Article"?"reader":"notes"}/${encodeURIComponent(t.object.id)}`)}})),e.jsx("div",{ref:w,className:`${R?"scroll-mt-[12px]":"scroll-mt-[124px]"}`,children:e.jsxs("div",{className:`${u.length>0&&"min-h-[calc(100vh-52px)]"}`,children:[e.jsx(j,{actor:n.actor,allowDelete:!1,commentCount:V,last:!0,layout:"modal",likeCount:o.likeCount??0,object:o,repostCount:o.repostCount,showHeader:u.length>0,showStats:!0,type:"Note"}),e.jsx(ue,{object:o}),e.jsx(C,{}),e.jsxs("div",{ref:H,children:[E.map((t,l)=>{const s=l===E.length-1,c=t.mainReply.id,x=U.has(c),J=B.has(c),K=k.has(c),h=t.chain.length>0;return e.jsxs(ce.Fragment,{children:[e.jsx(j,{actor:t.mainReply.actor,allowDelete:t.mainReply.object.authored,commentCount:t.mainReply.object.replyCount??0,isChainParent:h,isPending:y(t.mainReply.id),last:!h,layout:"reply",likeCount:t.mainReply.object.likeCount??0,object:t.mainReply.object,parentId:o.id,repostCount:t.mainReply.object.repostCount??0,type:"Note",onClick:()=>{m(`/notes/${encodeURIComponent(t.mainReply.id)}`)},onDelete:g}),h&&t.chain[0]&&e.jsx(j,{actor:t.chain[0].actor,allowDelete:t.chain[0].object.authored,commentCount:t.chain[0].object.replyCount??0,isChainContinuation:!0,isPending:y(t.chain[0].id),last:t.chain.length===1,layout:"reply",likeCount:t.chain[0].object.likeCount??0,object:t.chain[0].object,parentId:o.id,repostCount:t.chain[0].object.repostCount??0,type:"Note",onClick:()=>{m(`/notes/${encodeURIComponent(t.chain[0].id)}`)},onDelete:g},t.chain[0].id),h&&x&&t.chain.slice(1).map((i,Q)=>{const M=Q===t.chain.slice(1).length-1,X=f&&f(l),Y=M&&X;return e.jsx(j,{actor:i.actor,allowDelete:i.object.authored,commentCount:i.object.replyCount??0,isChainContinuation:!0,isPending:y(i.id),last:M&&!Y,layout:"reply",likeCount:i.object.likeCount??0,object:i.object,parentId:o.id,repostCount:i.object.repostCount??0,type:"Note",onClick:()=>{m(`/notes/${encodeURIComponent(i.id)}`)},onDelete:g},i.id)}),h&&t.chain.length>1&&!x&&e.jsx(A,{variant:"expand",onClick:()=>O(c)}),h&&x&&J&&f&&f(l)&&e.jsx(A,{loading:K,variant:"loadMore",onClick:()=>W(c,l)}),!s&&e.jsx(C,{})]},t.mainReply.id)}),p&&e.jsx("div",{className:"flex flex-col items-center justify-center text-center",children:e.jsx(ie,{size:"md"})})]}),b&&e.jsx("div",{ref:v,className:"h-1"})]})})]})})})})})};export{Ce as default};
@@ -1 +1 @@
1
- import{u as Q,aP as D,r as h,j as e,B as I,aQ as M,ai as y,aR as _,aS as Y,ab as te,aj as f,aT as H,aU as re,aV as ie,af as le,ag as F,aW as oe,S as U}from"./index-f5Lv9kLb.js";import{K as w,a as k,b as C,c as L}from"./kpi-card-Dga9rFZ5.js";import{C as A,a as P,b as V,c as N,K as S,d as T,e as R,u as q}from"./pagemenu-DjSqq3Wu.js";import{D as ne,a as ce,b as de,c as me,d as pe,e as he,f as xe,g as ue}from"./data-list-BOdyZGWI.js";import{u as ge,p as je,N as fe,c as ve}from"./links-dgwx7ko1.js";import{M as be}from"./wallet-cards-CSdWOmJE.js";import{P as Ne,a as ye}from"./post-analytics-header-CpPPBAz4.js";import{S as we,K as ke}from"./kpis-BbnqD1za.js";import{E as Ce}from"./empty-indicator-CR_9BHAH.js";import{G as Le}from"./gh-chart-hn7wEnik.js";import{u as J,S as _e}from"./post-analytics-context-CEqWyqgm.js";import{u as Se,c as Te}from"./growth-CQceZQ1g.js";import{h as Re,i as De}from"./post-helpers-gInwAwEv.js";import{S as Ie}from"./sprout-BKiwQsGn.js";import"./chart-pimL5Chk.js";import"./_baseAssignValue-Bbalamaq.js";import"./PolarAngleAxis-B8JrAxf_.js";import"./post-share-modal-Dln0kZhn.js";import"./posts-C1Eh5Ypq.js";import"./trash-CpnxYen-.js";import"./source-icon-DkGi13e_.js";import"./source-utils-B1S3ZHA2.js";import"./lucide-react-BARFK2PZ.js";import"./a-large-small-CgWPeKpi.js";import"./at-sign-BottTo2X.js";import"./message-square-text-BxquqPhA.js";import"./copy-aC0WUVtq.js";import"./hash-BcaWmkw5.js";import"./inbox-D9hID-rO.js";import"./minus-Ziy4LSYD.js";import"./tags-DV2SSdMK.js";import"./square-BEpRc_fY.js";import"./user-round-check-DYkrjHxF.js";import"./repeat-CN4fiG5H.js";import"./reply-BfWgvH7y.js";import"./tabs-DCHagOip.js";import"./index-DO76vL0R.js";import"./table-Dw9xFlFd.js";import"./currency-fEUUCkj0.js";import"./stats-CRgy_cWm.js";const Me=({post:o,isNewsletterStatsLoading:n,isWebShown:x})=>{const{postId:s}=Q(),a=D(),t=h.useMemo(()=>{const l=o.email?.opened_count||0,r=o.email?.email_count||0,p=o.count?.clicks||0;return{opened:l,clicked:p,openedRate:r>0?l/r:0,clickedRate:r>0?p/r:0,sent:r}},[o]),{data:m}=ge({searchParams:{filter:`post_id:'${s}'`}}),u=h.useMemo(()=>je(m),[m]),g=[{datatype:"Clicked",value:t.clickedRate,fill:"url(#gradientTeal)",color:"hsl(var(--chart-teal))"},{datatype:"Opened",value:t.openedRate,fill:"url(#gradientBlue)",color:"hsl(var(--chart-blue))"}],c={percentage:{label:"Opened"},Average:{label:"Clicked"},"This newsletter":{label:"Opened"}},i=o.email_only||!x;return e.jsxs(A,{className:`group/datalist overflow-hidden ${i&&"col-span-2"}`,children:[e.jsxs("div",{className:"relative flex items-center justify-between gap-6",children:[e.jsx(P,{children:e.jsxs(V,{className:"flex items-center gap-1.5 text-lg",children:[e.jsx(be,{size:16,strokeWidth:1.5}),"Newsletter performance"]})}),e.jsx(I,{className:"absolute right-6 translate-x-10 opacity-0 transition-all duration-300 group-hover/datalist:translate-x-0 group-hover/datalist:opacity-100",size:"sm",variant:"outline",onClick:()=>{a(`/posts/analytics/${s}/newsletter`)},children:"View more"})]}),n?e.jsx(N,{children:e.jsx("div",{className:"mx-auto flex min-h-[250px] items-center justify-center xl:size-full",children:e.jsx(M,{})})}):e.jsxs(N,{className:`${i&&"grid grid-cols-2"}`,children:[e.jsxs("div",{className:`${i&&"border-r pr-6"}`,children:[e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsx(S,{className:"group relative flex grow flex-row items-start justify-between gap-5 border-none px-0 pt-0",children:e.jsxs("div",{className:"flex grow flex-col gap-1.5 border-none pb-0",children:[e.jsx(T,{color:"hsl(var(--chart-blue))",children:"Open rate"}),e.jsx(R,{value:y(t.openedRate)})]})}),e.jsx(S,{className:"group relative flex grow flex-row items-start justify-between gap-5 border-none px-0 pt-0",children:e.jsxs("div",{className:"flex grow flex-col gap-1.5 border-none pb-0",children:[e.jsx(T,{color:"hsl(var(--chart-teal))",children:"Click rate"}),e.jsx(R,{value:y(t.clickedRate)})]})})]}),!i&&e.jsx(_,{}),e.jsx("div",{className:"mx-auto my-6 h-[240px]",children:e.jsx(fe,{className:"pointer-events-none aspect-square h-[240px]",config:c,data:g,tooltip:!1})})]}),e.jsxs("div",{className:`${i&&"pl-6"}`,children:[!i&&e.jsx(_,{}),e.jsxs("div",{className:i?"":"pt-3",children:[e.jsxs("div",{className:`flex items-center justify-between gap-3 ${i?"pb-3":"py-3"}`,children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Top clicked links in this email"}),e.jsx(Y,{children:"Members"})]}),u.length>0?e.jsx(ne,{className:"",children:e.jsx(ce,{children:u.slice(0,i?10:5).map(l=>{const r=t.clicked>0?l.count/t.clicked:0;return e.jsxs(de,{children:[e.jsx(me,{style:{width:`${r?Math.round(r*100):0}%`}}),e.jsx(pe,{children:e.jsxs("div",{className:"flex items-center space-x-2 overflow-hidden",children:[e.jsx(te,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),e.jsx("a",{className:"block truncate font-medium hover:underline",href:l.link.to,rel:"noreferrer",target:"_blank",title:l.link.to,children:ve(l.link.to,!0)})]})}),e.jsxs(he,{children:[e.jsx(xe,{children:f(l.count||0)}),e.jsx(ue,{children:y(r)})]})]},l.link.link_id)})})}):e.jsx("div",{className:"py-20 text-center text-sm text-gray-700",children:"You have no links in your post."})]})]})]})]})},Ae=({chartData:o,range:n,isLoading:x,visitors:s,sourcesData:a,isNewsletterShown:t=!0})=>{const{postId:m}=Q(),u=D(),{data:g}=J(),c=g?.url,i=g?.icon,l=h.useMemo(()=>a?a.reduce((r,p)=>r+Number(p.visits||0),0):0,[a]);return e.jsx(e.Fragment,{children:e.jsxs(A,{className:`group/datalist overflow-hidden ${!t&&"col-span-2"}`,"data-testid":"web-performance",children:[e.jsxs("div",{className:"relative flex items-center justify-between gap-6",children:[e.jsx(P,{children:e.jsxs(V,{className:"flex items-center gap-1.5 text-lg",children:[e.jsx(H,{size:16,strokeWidth:1.5}),"Web performance"]})}),e.jsx(I,{className:"absolute right-6 translate-x-10 opacity-0 transition-all duration-300 group-hover/datalist:translate-x-0 group-hover/datalist:opacity-100",size:"sm",variant:"outline",onClick:()=>{u(`/posts/analytics/${m}/web`)},children:"View more"})]}),e.jsxs(N,{children:[e.jsxs("div",{children:[e.jsx(S,{className:"group relative flex grow flex-row items-start justify-between gap-5 border-none px-0 pt-0","data-testid":"unique-visitors",children:e.jsxs("div",{className:"flex grow flex-col gap-1.5 border-none pb-0",children:[e.jsx(T,{color:"hsl(var(--chart-blue))",children:"Unique visitors"}),e.jsx(R,{value:f(s)})]})}),e.jsx(_,{}),e.jsx("div",{className:"max-h-[288px] py-6 [&_.recharts-cartesian-axis-tick-value]:fill-gray-500",children:x?e.jsx("div",{className:"flex h-[16vw] min-h-[240px] items-center justify-center",children:e.jsx(M,{})}):e.jsx(Le,{className:"aspect-auto h-[240px] w-full",color:"hsl(var(--chart-blue))",data:o||[],id:"visitors",range:n,syncId:"overview-charts"})})]}),t&&e.jsxs("div",{className:t?"border-t pt-3":"-mt-3",children:[e.jsx("div",{children:e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"How readers found this post"}),e.jsx(Y,{children:"Visitors"})]})}),a&&a.length>0?e.jsx(we,{data:a,range:n,siteIcon:i,siteUrl:c,tableOnly:!0,topSourcesLimit:5,totalVisitors:l}):e.jsx(Ce,{className:"h-full py-10",description:"Once someone visits this post, sources will show here",title:"No visitors since you published this post",children:e.jsx(H,{strokeWidth:1.5})})]})]})]})})},Ns=()=>{const o=D(),{statsConfig:n,isLoading:x,post:s,isPostLoading:a,postId:t}=J(),{totals:m,isLoading:u,currencySymbol:g}=Se(t),{appSettings:c}=re(),{emailTrackClicks:i,emailTrackOpens:l}=c?.analytics||{},r=h.useMemo(()=>s?.published_at?ie(s.published_at):_e.ALL_TIME.value,[s?.published_at]),{startDate:p,endDate:E,timezone:K}=le(r),O=h.useMemo(()=>{const d={site_uuid:n?.id||"",date_from:F(p),date_to:F(E),timezone:K,post_uuid:""};return!a&&s?.uuid?{...d,post_uuid:s.uuid}:d},[a,s,n?.id,p,E,K]),{data:v,loading:z}=q({endpoint:"api_kpis",statsConfig:n||{id:""},params:O}),X=h.useMemo(()=>v?.length?v.reduce((d,j)=>{const G=Number(j.visits);return d+(isNaN(G)?0:G)},0):0,[v]),b=ke.visits,Z=oe(v||[],r,b.dataKey,"sum")?.map(d=>{const j=Number(d[b.dataKey]);return{date:String(d.date),value:j,formattedValue:b.formatter(j),label:b.label}}),{data:ee,loading:se}=q({endpoint:"api_top_sources",statsConfig:n||{id:""},params:O}),$=x||u||a||z,ae=a||x||z,W=Re(s)&&l&&i,B=!s?.email_only&&c?.analytics.webAnalytics;return h.useEffect(()=>{!a&&s&&De(s)&&!c?.analytics.webAnalytics&&o(`/posts/analytics/${t}/growth`)},[a,s,c?.analytics.webAnalytics,o,t]),a?e.jsx(M,{}):e.jsxs(e.Fragment,{children:[e.jsx(Ne,{currentTab:"Overview"}),e.jsx(ye,{children:e.jsxs("div",{className:"flex flex-col gap-6 lg:grid lg:grid-cols-2",children:[B&&e.jsx(Ae,{chartData:Z,isLoading:ae||$||se,isNewsletterShown:W,range:r,sourcesData:ee,visitors:X}),W&&e.jsx(Me,{isNewsletterStatsLoading:a,isWebShown:B,post:s}),e.jsxs(A,{className:"group col-span-2 overflow-hidden p-0","data-testid":"growth",children:[e.jsxs("div",{className:"relative flex items-center justify-between gap-6",children:[e.jsx(P,{children:e.jsxs(V,{className:"flex items-center gap-1.5 text-lg",children:[e.jsx(Ie,{size:16,strokeWidth:1.5}),"Growth"]})}),e.jsx(I,{className:"absolute right-6 translate-x-10 opacity-0 transition-all duration-200 group-hover:translate-x-0 group-hover:opacity-100",size:"sm",variant:"outline",onClick:()=>{o(`/posts/analytics/${t}/growth`)},children:"View more"})]}),e.jsx(N,{className:"flex flex-col gap-6 px-0 md:grid md:grid-cols-3 md:items-stretch md:gap-0",children:$?Array.from({length:3},(d,j)=>e.jsxs("div",{className:"h-[98px] gap-1 border-r px-6 py-5 last:border-r-0",children:[e.jsx(U,{className:"w-2/3"}),e.jsx(U,{className:"h-7 w-12"})]},j)):e.jsxs(e.Fragment,{children:[e.jsxs(w,{className:"grow gap-1 py-0",children:[e.jsx(k,{children:"Free members"}),e.jsx(C,{children:e.jsx(L,{className:"text-[2.2rem]",children:f(m?.free_members||0)})})]}),c?.paidMembersEnabled&&e.jsxs(e.Fragment,{children:[e.jsxs(w,{className:"grow gap-1 py-0",children:[e.jsx(k,{children:"Paid members"}),e.jsx(C,{children:e.jsx(L,{className:"text-[2.2rem]",children:f(m?.paid_members||0)})})]}),e.jsxs(w,{className:"grow gap-1 py-0",children:[e.jsx(k,{children:"MRR impact"}),e.jsx(C,{children:e.jsxs(L,{className:"text-[2.2rem]",children:[g,f(Te(m?.mrr||0))]})})]})]})]})})]})]})})]})};export{Ns as default};
1
+ import{u as Q,aP as D,r as h,j as e,B as I,aQ as M,ai as y,aR as _,aS as Y,ab as te,aj as f,aT as H,aU as re,aV as ie,af as le,ag as F,aW as oe,S as U}from"./index-CMTzNTew.js";import{K as w,a as k,b as C,c as L}from"./kpi-card-DENsK2xK.js";import{C as A,a as P,b as V,c as N,K as S,d as T,e as R,u as q}from"./pagemenu-CZyroidv.js";import{D as ne,a as ce,b as de,c as me,d as pe,e as he,f as xe,g as ue}from"./data-list-BYNMbRIq.js";import{u as ge,p as je,N as fe,c as ve}from"./links-lpAC3T1p.js";import{M as be}from"./wallet-cards-KmOh29LP.js";import{P as Ne,a as ye}from"./post-analytics-header-7GtJCx0W.js";import{S as we,K as ke}from"./kpis-CDrs2iS1.js";import{E as Ce}from"./empty-indicator-Bn5wG9-T.js";import{G as Le}from"./gh-chart-Br7NXn_b.js";import{u as J,S as _e}from"./post-analytics-context-CF7C67-0.js";import{u as Se,c as Te}from"./growth-CiPDnWxJ.js";import{h as Re,i as De}from"./post-helpers-gInwAwEv.js";import{S as Ie}from"./sprout-C3cc0c-K.js";import"./chart-mYz3IJwm.js";import"./_baseAssignValue-DnkbkowM.js";import"./PolarAngleAxis-Dod0DwfL.js";import"./post-share-modal-D8R7DUZP.js";import"./posts-CL9UDYoW.js";import"./trash-u5BxolyH.js";import"./source-icon-DvDuzw73.js";import"./source-utils-B1S3ZHA2.js";import"./lucide-react-CBigk-fq.js";import"./a-large-small-C5mgFBRg.js";import"./at-sign-Bz-SU-S_.js";import"./message-square-text-cV8O_qKq.js";import"./copy-Bpq3uhnh.js";import"./hash-Bc1e38oH.js";import"./inbox-BcZNBNhk.js";import"./minus-NvnQTlW7.js";import"./tags-CLxXZlOO.js";import"./square-tZp0_n7e.js";import"./user-round-check-B6j98D6d.js";import"./repeat-DgH39UKE.js";import"./reply-DAaNxiy8.js";import"./tabs-BmdL0X4U.js";import"./index-D212VvOz.js";import"./table-BQUcKHfm.js";import"./currency-fEUUCkj0.js";import"./stats-2Jelnn-Q.js";const Me=({post:o,isNewsletterStatsLoading:n,isWebShown:x})=>{const{postId:s}=Q(),a=D(),t=h.useMemo(()=>{const l=o.email?.opened_count||0,r=o.email?.email_count||0,p=o.count?.clicks||0;return{opened:l,clicked:p,openedRate:r>0?l/r:0,clickedRate:r>0?p/r:0,sent:r}},[o]),{data:m}=ge({searchParams:{filter:`post_id:'${s}'`}}),u=h.useMemo(()=>je(m),[m]),g=[{datatype:"Clicked",value:t.clickedRate,fill:"url(#gradientTeal)",color:"hsl(var(--chart-teal))"},{datatype:"Opened",value:t.openedRate,fill:"url(#gradientBlue)",color:"hsl(var(--chart-blue))"}],c={percentage:{label:"Opened"},Average:{label:"Clicked"},"This newsletter":{label:"Opened"}},i=o.email_only||!x;return e.jsxs(A,{className:`group/datalist overflow-hidden ${i&&"col-span-2"}`,children:[e.jsxs("div",{className:"relative flex items-center justify-between gap-6",children:[e.jsx(P,{children:e.jsxs(V,{className:"flex items-center gap-1.5 text-lg",children:[e.jsx(be,{size:16,strokeWidth:1.5}),"Newsletter performance"]})}),e.jsx(I,{className:"absolute right-6 translate-x-10 opacity-0 transition-all duration-300 group-hover/datalist:translate-x-0 group-hover/datalist:opacity-100",size:"sm",variant:"outline",onClick:()=>{a(`/posts/analytics/${s}/newsletter`)},children:"View more"})]}),n?e.jsx(N,{children:e.jsx("div",{className:"mx-auto flex min-h-[250px] items-center justify-center xl:size-full",children:e.jsx(M,{})})}):e.jsxs(N,{className:`${i&&"grid grid-cols-2"}`,children:[e.jsxs("div",{className:`${i&&"border-r pr-6"}`,children:[e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsx(S,{className:"group relative flex grow flex-row items-start justify-between gap-5 border-none px-0 pt-0",children:e.jsxs("div",{className:"flex grow flex-col gap-1.5 border-none pb-0",children:[e.jsx(T,{color:"hsl(var(--chart-blue))",children:"Open rate"}),e.jsx(R,{value:y(t.openedRate)})]})}),e.jsx(S,{className:"group relative flex grow flex-row items-start justify-between gap-5 border-none px-0 pt-0",children:e.jsxs("div",{className:"flex grow flex-col gap-1.5 border-none pb-0",children:[e.jsx(T,{color:"hsl(var(--chart-teal))",children:"Click rate"}),e.jsx(R,{value:y(t.clickedRate)})]})})]}),!i&&e.jsx(_,{}),e.jsx("div",{className:"mx-auto my-6 h-[240px]",children:e.jsx(fe,{className:"pointer-events-none aspect-square h-[240px]",config:c,data:g,tooltip:!1})})]}),e.jsxs("div",{className:`${i&&"pl-6"}`,children:[!i&&e.jsx(_,{}),e.jsxs("div",{className:i?"":"pt-3",children:[e.jsxs("div",{className:`flex items-center justify-between gap-3 ${i?"pb-3":"py-3"}`,children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Top clicked links in this email"}),e.jsx(Y,{children:"Members"})]}),u.length>0?e.jsx(ne,{className:"",children:e.jsx(ce,{children:u.slice(0,i?10:5).map(l=>{const r=t.clicked>0?l.count/t.clicked:0;return e.jsxs(de,{children:[e.jsx(me,{style:{width:`${r?Math.round(r*100):0}%`}}),e.jsx(pe,{children:e.jsxs("div",{className:"flex items-center space-x-2 overflow-hidden",children:[e.jsx(te,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),e.jsx("a",{className:"block truncate font-medium hover:underline",href:l.link.to,rel:"noreferrer",target:"_blank",title:l.link.to,children:ve(l.link.to,!0)})]})}),e.jsxs(he,{children:[e.jsx(xe,{children:f(l.count||0)}),e.jsx(ue,{children:y(r)})]})]},l.link.link_id)})})}):e.jsx("div",{className:"py-20 text-center text-sm text-gray-700",children:"You have no links in your post."})]})]})]})]})},Ae=({chartData:o,range:n,isLoading:x,visitors:s,sourcesData:a,isNewsletterShown:t=!0})=>{const{postId:m}=Q(),u=D(),{data:g}=J(),c=g?.url,i=g?.icon,l=h.useMemo(()=>a?a.reduce((r,p)=>r+Number(p.visits||0),0):0,[a]);return e.jsx(e.Fragment,{children:e.jsxs(A,{className:`group/datalist overflow-hidden ${!t&&"col-span-2"}`,"data-testid":"web-performance",children:[e.jsxs("div",{className:"relative flex items-center justify-between gap-6",children:[e.jsx(P,{children:e.jsxs(V,{className:"flex items-center gap-1.5 text-lg",children:[e.jsx(H,{size:16,strokeWidth:1.5}),"Web performance"]})}),e.jsx(I,{className:"absolute right-6 translate-x-10 opacity-0 transition-all duration-300 group-hover/datalist:translate-x-0 group-hover/datalist:opacity-100",size:"sm",variant:"outline",onClick:()=>{u(`/posts/analytics/${m}/web`)},children:"View more"})]}),e.jsxs(N,{children:[e.jsxs("div",{children:[e.jsx(S,{className:"group relative flex grow flex-row items-start justify-between gap-5 border-none px-0 pt-0","data-testid":"unique-visitors",children:e.jsxs("div",{className:"flex grow flex-col gap-1.5 border-none pb-0",children:[e.jsx(T,{color:"hsl(var(--chart-blue))",children:"Unique visitors"}),e.jsx(R,{value:f(s)})]})}),e.jsx(_,{}),e.jsx("div",{className:"max-h-[288px] py-6 [&_.recharts-cartesian-axis-tick-value]:fill-gray-500",children:x?e.jsx("div",{className:"flex h-[16vw] min-h-[240px] items-center justify-center",children:e.jsx(M,{})}):e.jsx(Le,{className:"aspect-auto h-[240px] w-full",color:"hsl(var(--chart-blue))",data:o||[],id:"visitors",range:n,syncId:"overview-charts"})})]}),t&&e.jsxs("div",{className:t?"border-t pt-3":"-mt-3",children:[e.jsx("div",{children:e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"How readers found this post"}),e.jsx(Y,{children:"Visitors"})]})}),a&&a.length>0?e.jsx(we,{data:a,range:n,siteIcon:i,siteUrl:c,tableOnly:!0,topSourcesLimit:5,totalVisitors:l}):e.jsx(Ce,{className:"h-full py-10",description:"Once someone visits this post, sources will show here",title:"No visitors since you published this post",children:e.jsx(H,{strokeWidth:1.5})})]})]})]})})},Ns=()=>{const o=D(),{statsConfig:n,isLoading:x,post:s,isPostLoading:a,postId:t}=J(),{totals:m,isLoading:u,currencySymbol:g}=Se(t),{appSettings:c}=re(),{emailTrackClicks:i,emailTrackOpens:l}=c?.analytics||{},r=h.useMemo(()=>s?.published_at?ie(s.published_at):_e.ALL_TIME.value,[s?.published_at]),{startDate:p,endDate:E,timezone:K}=le(r),O=h.useMemo(()=>{const d={site_uuid:n?.id||"",date_from:F(p),date_to:F(E),timezone:K,post_uuid:""};return!a&&s?.uuid?{...d,post_uuid:s.uuid}:d},[a,s,n?.id,p,E,K]),{data:v,loading:z}=q({endpoint:"api_kpis",statsConfig:n||{id:""},params:O}),X=h.useMemo(()=>v?.length?v.reduce((d,j)=>{const G=Number(j.visits);return d+(isNaN(G)?0:G)},0):0,[v]),b=ke.visits,Z=oe(v||[],r,b.dataKey,"sum")?.map(d=>{const j=Number(d[b.dataKey]);return{date:String(d.date),value:j,formattedValue:b.formatter(j),label:b.label}}),{data:ee,loading:se}=q({endpoint:"api_top_sources",statsConfig:n||{id:""},params:O}),$=x||u||a||z,ae=a||x||z,W=Re(s)&&l&&i,B=!s?.email_only&&c?.analytics.webAnalytics;return h.useEffect(()=>{!a&&s&&De(s)&&!c?.analytics.webAnalytics&&o(`/posts/analytics/${t}/growth`)},[a,s,c?.analytics.webAnalytics,o,t]),a?e.jsx(M,{}):e.jsxs(e.Fragment,{children:[e.jsx(Ne,{currentTab:"Overview"}),e.jsx(ye,{children:e.jsxs("div",{className:"flex flex-col gap-6 lg:grid lg:grid-cols-2",children:[B&&e.jsx(Ae,{chartData:Z,isLoading:ae||$||se,isNewsletterShown:W,range:r,sourcesData:ee,visitors:X}),W&&e.jsx(Me,{isNewsletterStatsLoading:a,isWebShown:B,post:s}),e.jsxs(A,{className:"group col-span-2 overflow-hidden p-0","data-testid":"growth",children:[e.jsxs("div",{className:"relative flex items-center justify-between gap-6",children:[e.jsx(P,{children:e.jsxs(V,{className:"flex items-center gap-1.5 text-lg",children:[e.jsx(Ie,{size:16,strokeWidth:1.5}),"Growth"]})}),e.jsx(I,{className:"absolute right-6 translate-x-10 opacity-0 transition-all duration-200 group-hover:translate-x-0 group-hover:opacity-100",size:"sm",variant:"outline",onClick:()=>{o(`/posts/analytics/${t}/growth`)},children:"View more"})]}),e.jsx(N,{className:"flex flex-col gap-6 px-0 md:grid md:grid-cols-3 md:items-stretch md:gap-0",children:$?Array.from({length:3},(d,j)=>e.jsxs("div",{className:"h-[98px] gap-1 border-r px-6 py-5 last:border-r-0",children:[e.jsx(U,{className:"w-2/3"}),e.jsx(U,{className:"h-7 w-12"})]},j)):e.jsxs(e.Fragment,{children:[e.jsxs(w,{className:"grow gap-1 py-0",children:[e.jsx(k,{children:"Free members"}),e.jsx(C,{children:e.jsx(L,{className:"text-[2.2rem]",children:f(m?.free_members||0)})})]}),c?.paidMembersEnabled&&e.jsxs(e.Fragment,{children:[e.jsxs(w,{className:"grow gap-1 py-0",children:[e.jsx(k,{children:"Paid members"}),e.jsx(C,{children:e.jsx(L,{className:"text-[2.2rem]",children:f(m?.paid_members||0)})})]}),e.jsxs(w,{className:"grow gap-1 py-0",children:[e.jsx(k,{children:"MRR impact"}),e.jsx(C,{children:e.jsxs(L,{className:"text-[2.2rem]",children:[g,f(Te(m?.mrr||0))]})})]})]})]})})]})]})})]})};export{Ns as default};
@@ -1,4 +1,4 @@
1
- import{r as bt,e as ea,ed as BL,ee as VL,ef as Nm,aL as zL,j as Lt,y as pe,an as lh,ao as GL,bH as FL,ap as HL,B as Xw,bN as WL,bI as UL,bJ as YL}from"./index-f5Lv9kLb.js";import{T as $L}from"./wallet-cards-CSdWOmJE.js";/*! *****************************************************************************
1
+ import{r as bt,e as ea,ed as BL,ee as VL,ef as Nm,aL as zL,j as Lt,y as pe,an as lh,ao as GL,bH as FL,ap as HL,B as Xw,bN as WL,bI as UL,bJ as YL}from"./index-CMTzNTew.js";import{T as $L}from"./wallet-cards-KmOh29LP.js";/*! *****************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -1 +1 @@
1
- import{j as u,r as l,e as i,aO as D}from"./index-f5Lv9kLb.js";import{M as E}from"./main-layout-CcjtCuF_.js";import{P as j}from"./post-share-modal-Dln0kZhn.js";import{u as b}from"./posts-C1Eh5Ypq.js";import{u as M}from"./post-analytics-context-CEqWyqgm.js";const C=({children:a})=>u.jsx(E,{children:u.jsx("div",{className:"grid w-full grow",children:u.jsx("div",{className:"flex h-full flex-col px-8",children:a})})}),_=()=>{const[a,r]=l.useState(!1),[p,d]=l.useState(null),[n,h]=l.useState(null),{site:f}=M(),{data:y}=b({searchParams:p?{filter:`id:${p.id}`,include:"authors,newsletter,email"}:{},enabled:!!p}),{data:g}=b({searchParams:{filter:"status:[published,sent]",limit:"1",fields:"id"},enabled:!!p}),e=y?.posts?.[0],P=s=>`${s.toLocaleString()} subscriber${s!==1?"s":""}`,S=s=>new Date(s).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1}),w=s=>s?.map(o=>o.name).join(", ")||"",x=(s,o)=>s.length<=o?s:s.substring(0,o).trim()+"…",T=l.useMemo(()=>{if(!e)return null;const s=!!n,o=()=>{const t=[];if(e.email_only?t.push("Your email was sent to"):e.email?.email_count?t.push("Your post was published on your site and sent to"):t.push("Your post was published on your site"),e.email?.email_count){const m=P(e.email.email_count);t.push(" "),t.push(i.createElement("strong",{key:"subscriber-count"},m)),e.newsletter?.name&&(t.push(" of "),t.push(i.createElement("strong",{key:"newsletter-name"},e.newsletter.name))),t.push(",")}if(e.published_at){const m=new Date(e.published_at);m.toDateString()===new Date().toDateString()?(t.push(" "),t.push(i.createElement("strong",{key:"today"},"today"))):(t.push(" on "),t.push(i.createElement("strong",{key:"date"},m.toLocaleDateString("en-US",{month:"long",day:"numeric"})))),t.push(" at "),t.push(i.createElement("strong",{key:"time"},S(e.published_at)))}return t.push("."),i.createElement("span",{},...t)},c=()=>{r(!1),d(null),h(null)};return{open:a,onOpenChange:t=>{t||c()},emailOnly:e.email_only,postURL:e.url||"",primaryTitle:"Boom! It's out there.",secondaryTitle:s&&n?`That's ${n.toLocaleString()} post${n!==1?"s":""} published.`:"Spread the word!",description:o(),featureImageURL:e.feature_image||"",postTitle:e.title||"",postExcerpt:x(e.excerpt||"",100),faviconURL:f?.icon||"",siteTitle:f?.title||"",author:w(e.authors),onClose:c}},[e,a,n,f?.title]);return l.useEffect(()=>{const s=()=>{try{const c=localStorage.getItem("ghost-last-published-post");if(c){const t=JSON.parse(c);d(t),r(!0),localStorage.removeItem("ghost-last-published-post")}}catch{}};s();const o=setTimeout(s,100);return()=>clearTimeout(o)},[]),l.useEffect(()=>{g?.meta?.pagination?.total&&h(g.meta.pagination.total)},[g]),{isModalOpen:a,post:e,postCount:n,showPostCount:!!n,closeModal:()=>{r(!1),d(null),h(null)},modalProps:T}},v=()=>{const{isModalOpen:a,modalProps:r}=_();return u.jsxs(C,{children:[u.jsx(D,{}),a&&r&&u.jsx(j,{...r})]})};export{v as default};
1
+ import{j as u,r as l,e as i,aO as D}from"./index-CMTzNTew.js";import{M as E}from"./main-layout-_SYQRjIl.js";import{P as j}from"./post-share-modal-D8R7DUZP.js";import{u as b}from"./posts-CL9UDYoW.js";import{u as M}from"./post-analytics-context-CF7C67-0.js";const C=({children:a})=>u.jsx(E,{children:u.jsx("div",{className:"grid w-full grow",children:u.jsx("div",{className:"flex h-full flex-col px-8",children:a})})}),_=()=>{const[a,r]=l.useState(!1),[p,d]=l.useState(null),[n,h]=l.useState(null),{site:f}=M(),{data:y}=b({searchParams:p?{filter:`id:${p.id}`,include:"authors,newsletter,email"}:{},enabled:!!p}),{data:g}=b({searchParams:{filter:"status:[published,sent]",limit:"1",fields:"id"},enabled:!!p}),e=y?.posts?.[0],P=s=>`${s.toLocaleString()} subscriber${s!==1?"s":""}`,S=s=>new Date(s).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1}),w=s=>s?.map(o=>o.name).join(", ")||"",x=(s,o)=>s.length<=o?s:s.substring(0,o).trim()+"…",T=l.useMemo(()=>{if(!e)return null;const s=!!n,o=()=>{const t=[];if(e.email_only?t.push("Your email was sent to"):e.email?.email_count?t.push("Your post was published on your site and sent to"):t.push("Your post was published on your site"),e.email?.email_count){const m=P(e.email.email_count);t.push(" "),t.push(i.createElement("strong",{key:"subscriber-count"},m)),e.newsletter?.name&&(t.push(" of "),t.push(i.createElement("strong",{key:"newsletter-name"},e.newsletter.name))),t.push(",")}if(e.published_at){const m=new Date(e.published_at);m.toDateString()===new Date().toDateString()?(t.push(" "),t.push(i.createElement("strong",{key:"today"},"today"))):(t.push(" on "),t.push(i.createElement("strong",{key:"date"},m.toLocaleDateString("en-US",{month:"long",day:"numeric"})))),t.push(" at "),t.push(i.createElement("strong",{key:"time"},S(e.published_at)))}return t.push("."),i.createElement("span",{},...t)},c=()=>{r(!1),d(null),h(null)};return{open:a,onOpenChange:t=>{t||c()},emailOnly:e.email_only,postURL:e.url||"",primaryTitle:"Boom! It's out there.",secondaryTitle:s&&n?`That's ${n.toLocaleString()} post${n!==1?"s":""} published.`:"Spread the word!",description:o(),featureImageURL:e.feature_image||"",postTitle:e.title||"",postExcerpt:x(e.excerpt||"",100),faviconURL:f?.icon||"",siteTitle:f?.title||"",author:w(e.authors),onClose:c}},[e,a,n,f?.title]);return l.useEffect(()=>{const s=()=>{try{const c=localStorage.getItem("ghost-last-published-post");if(c){const t=JSON.parse(c);d(t),r(!0),localStorage.removeItem("ghost-last-published-post")}}catch{}};s();const o=setTimeout(s,100);return()=>clearTimeout(o)},[]),l.useEffect(()=>{g?.meta?.pagination?.total&&h(g.meta.pagination.total)},[g]),{isModalOpen:a,post:e,postCount:n,showPostCount:!!n,closeModal:()=>{r(!1),d(null),h(null)},modalProps:T}},v=()=>{const{isModalOpen:a,modalProps:r}=_();return u.jsxs(C,{children:[u.jsx(D,{}),a&&r&&u.jsx(j,{...r})]})};export{v as default};
@@ -1 +1 @@
1
- import{r as c,u as v,aI as p,aJ as y,aK as h,aL as D,j as C}from"./index-f5Lv9kLb.js";import{u as I}from"./posts-C1Eh5Ypq.js";const k={TODAY:{name:"Today",value:1},LAST_7_DAYS:{name:"Last 7 days",value:7},LAST_30_DAYS:{name:"Last 30 days",value:31},LAST_90_DAYS:{name:"Last 90 days",value:91},YEAR_TO_DATE:{name:"Year to date",value:366},LAST_12_MONTHS:{name:"Last 12 months",value:372},ALL_TIME:{name:"All time",value:1e3}},U={US:"United States",TWN:"Taiwan",TW:"Taiwan",CN:"China","mobile-ios":"iOS","mobile-android":"Android",macos:"macOS","google.com":"Google","ghost.org":"Ghost","bing.com":"Bing","bsky.app":"Bluesky","yahoo.com":"Yahoo","duckduckgo.com":"DuckDuckGo"},x=["NULL","ᴺᵁᴸᴸ","","Others","Other"],t={PUBLIC:1,FREE:2,PAID:4},Y=t.PUBLIC|t.FREE|t.PAID,G=[{name:"Public visitors",value:"undefined",bit:t.PUBLIC},{name:"Free members",value:"free",bit:t.FREE},{name:"Paid members",value:"paid",bit:t.PAID}],m=c.createContext(void 0),w=()=>{const o=c.useContext(m);if(!o)throw new Error("useGlobalData must be used within a PostAnalyticsProvider");return o},B=({children:o})=>{const{postId:a}=v();if(!a)throw new Error("Post ID is required for PostAnalyticsProvider");const e=p(),s=y(),[g,A]=c.useState(k.LAST_30_DAYS.value),d=h(),n=!!e.data?.config?.stats,i=D({enabled:n}),{data:{posts:[S]}={posts:[]},isLoading:L}=I({searchParams:{filter:`id:${a}`,include:"email,authors,tags,tiers,count.clicks,count.signups,count.paid_conversions,count.positive_feedback,count.negative_feedback,newsletter"}}),u=[e,s,d],T=u.map(r=>r.error).find(Boolean),_=n?i.error:null,l=T||_,b=u.some(r=>r.isLoading),E=n?i.isLoading:!1,P=b||E;if(l)throw l;const f=s.data?.site?{url:s.data.site.url,icon:s.data.site.icon,title:s.data.site.title}:void 0;return C.jsx(m.Provider,{value:{data:e.data?.config,site:f,statsConfig:e.data?.config?.stats,tinybirdToken:i.token,isLoading:P,range:g,setRange:A,settings:d.data?.settings||[],postId:a,post:S,isPostLoading:L},children:o})},R=Object.freeze(Object.defineProperty({__proto__:null,default:B,useGlobalData:w},Symbol.toStringTag,{value:"Module"}));export{Y as A,k as S,x as U,U as a,G as b,t as c,R as p,w as u};
1
+ import{r as c,u as v,aI as p,aJ as y,aK as h,aL as D,j as C}from"./index-CMTzNTew.js";import{u as I}from"./posts-CL9UDYoW.js";const k={TODAY:{name:"Today",value:1},LAST_7_DAYS:{name:"Last 7 days",value:7},LAST_30_DAYS:{name:"Last 30 days",value:31},LAST_90_DAYS:{name:"Last 90 days",value:91},YEAR_TO_DATE:{name:"Year to date",value:366},LAST_12_MONTHS:{name:"Last 12 months",value:372},ALL_TIME:{name:"All time",value:1e3}},U={US:"United States",TWN:"Taiwan",TW:"Taiwan",CN:"China","mobile-ios":"iOS","mobile-android":"Android",macos:"macOS","google.com":"Google","ghost.org":"Ghost","bing.com":"Bing","bsky.app":"Bluesky","yahoo.com":"Yahoo","duckduckgo.com":"DuckDuckGo"},x=["NULL","ᴺᵁᴸᴸ","","Others","Other"],t={PUBLIC:1,FREE:2,PAID:4},Y=t.PUBLIC|t.FREE|t.PAID,G=[{name:"Public visitors",value:"undefined",bit:t.PUBLIC},{name:"Free members",value:"free",bit:t.FREE},{name:"Paid members",value:"paid",bit:t.PAID}],m=c.createContext(void 0),w=()=>{const o=c.useContext(m);if(!o)throw new Error("useGlobalData must be used within a PostAnalyticsProvider");return o},B=({children:o})=>{const{postId:a}=v();if(!a)throw new Error("Post ID is required for PostAnalyticsProvider");const e=p(),s=y(),[g,A]=c.useState(k.LAST_30_DAYS.value),d=h(),n=!!e.data?.config?.stats,i=D({enabled:n}),{data:{posts:[S]}={posts:[]},isLoading:L}=I({searchParams:{filter:`id:${a}`,include:"email,authors,tags,tiers,count.clicks,count.signups,count.paid_conversions,count.positive_feedback,count.negative_feedback,newsletter"}}),u=[e,s,d],T=u.map(r=>r.error).find(Boolean),_=n?i.error:null,l=T||_,b=u.some(r=>r.isLoading),E=n?i.isLoading:!1,P=b||E;if(l)throw l;const f=s.data?.site?{url:s.data.site.url,icon:s.data.site.icon,title:s.data.site.title}:void 0;return C.jsx(m.Provider,{value:{data:e.data?.config,site:f,statsConfig:e.data?.config?.stats,tinybirdToken:i.token,isLoading:P,range:g,setRange:A,settings:d.data?.settings||[],postId:a,post:S,isPostLoading:L},children:o})},R=Object.freeze(Object.defineProperty({__proto__:null,default:B,useGlobalData:w},Symbol.toStringTag,{value:"Module"}));export{Y as A,k as S,x as U,U as a,G as b,t as c,R as p,w as u};
@@ -1 +1 @@
1
- import{r as i,j as e,y as d,bL as I,C as W,aP as z,aU as U,bM as H,aj as V,B as D,bH as F,ap as J,bN as Q,bI as Y,bO as k,bJ as g,x as q,bP as K,bQ as X,bR as j,bS as w,aT as Z,a0 as ee,a1 as se,a2 as ae,a3 as te,a4 as re,a5 as ie,a6 as le,a7 as ne}from"./index-f5Lv9kLb.js";import{h as oe,N as ce,P as de,i as u}from"./pagemenu-DjSqq3Wu.js";import{P as me}from"./post-share-modal-Dln0kZhn.js";import{u as ue}from"./post-analytics-context-CEqWyqgm.js";import{i as C,h as pe,a as xe,b as he}from"./post-helpers-gInwAwEv.js";import{a as fe}from"./posts-C1Eh5Ypq.js";import{S as be,P as ge,G as je,M as we}from"./wallet-cards-CSdWOmJE.js";import{T as ye}from"./trash-CpnxYen-.js";import{S as ve}from"./sprout-BKiwQsGn.js";const P=i.forwardRef(({...r},t)=>e.jsx("nav",{ref:t,"aria-label":"breadcrumb",...r}));P.displayName="Breadcrumb";const S=i.forwardRef(({className:r,...t},a)=>e.jsx("ol",{ref:a,className:d("flex flex-wrap items-center gap-1.5 break-words text-sm font-medium text-muted-foreground sm:gap-2.5 h-[34px]",r),...t}));S.displayName="BreadcrumbList";const p=i.forwardRef(({className:r,...t},a)=>e.jsx("li",{ref:a,className:d("inline-flex items-center gap-1.5",r),...t}));p.displayName="BreadcrumbItem";const y=i.forwardRef(({asChild:r,className:t,...a},x)=>{const l=r?I:"a";return e.jsx(l,{ref:x,className:d("inline-flex items-center gap-1 transition-colors hover:text-foreground",t),...a})});y.displayName="BreadcrumbLink";const B=i.forwardRef(({className:r,...t},a)=>e.jsx("span",{ref:a,"aria-current":"page","aria-disabled":"true",className:d("font-medium text-foreground",r),role:"link",...t}));B.displayName="BreadcrumbPage";const T=({children:r,className:t,...a})=>e.jsx("li",{"aria-hidden":"true",className:d("[&>svg]:w-3.5 [&>svg]:h-3.5",t),role:"presentation",...a,children:r??e.jsx(W,{})});T.displayName="BreadcrumbSeparator";const Me=({children:r,className:t,...a})=>e.jsx("section",{className:d("flex gap-6 flex-col py-8 size-full grow",t),...a,children:r}),Ne=r=>{for(const t of r)if(t.key==="timezone"){const a=t.value;if(typeof a!="string")throw new TypeError("Site timezone setting is not a string");return a}return"Etc/UTC"},Oe=({currentTab:r,children:t})=>{const a=z(),{fromAnalytics:x,appSettings:l}=U(),{mutateAsync:_}=fe(),E=H(),[M,h]=i.useState(!1),[O,f]=i.useState(!1),{settings:$,site:v,statsConfig:L,post:s,isPostLoading:b,postId:o}=ue(),c=Ne($),{activeVisitors:N,isLoading:A}=oe({postUuid:s?.uuid,statsConfig:L,enabled:l?.analytics?.webAnalytics??!1}),m=i.useMemo(()=>{if(!s)return[];const n=[];return C(s)&&!l?.analytics.webAnalytics||(n.push("Overview"),!s.email_only&&l?.analytics.webAnalytics&&n.push("Web")),pe(s)&&n.push("Newsletter"),n.push("Growth"),n},[s,l?.analytics.webAnalytics]),R=()=>{s&&h(!0)},G=async()=>{if(s)try{await _(o),h(!1),a("/posts/",{crossApp:!0})}catch(n){E(n)}};return e.jsxs(e.Fragment,{children:[e.jsx("header",{className:"z-50 -mx-8 bg-white/70 backdrop-blur-md dark:bg-black",children:e.jsx("div",{className:"relative flex min-h-[102px] w-full items-start justify-between gap-5 px-8 pb-0 pt-8","data-header":"header",children:e.jsxs("div",{className:"flex w-full flex-col gap-5",children:[e.jsxs("div",{className:"flex w-full flex-col justify-between md:flex-row md:items-center",children:[e.jsx(P,{children:e.jsxs(S,{children:[x?e.jsx(p,{children:e.jsx(y,{className:"cursor-pointer leading-[24px]",onClick:()=>a("/analytics/",{crossApp:!0}),children:"Analytics"})}):e.jsx(p,{children:e.jsx(y,{className:"cursor-pointer leading-[24px]",onClick:()=>a("/posts/",{crossApp:!0}),children:"Posts"})}),e.jsx(T,{}),e.jsx(p,{children:e.jsx(B,{className:"leading-[24px]",children:"Post analytics"})})]})}),e.jsxs("div",{className:"flex w-full items-center gap-2 md:w-auto",children:[l?.analytics.webAnalytics&&!s?.email_only&&e.jsx("div",{className:"mr-3 flex grow items-center gap-2 text-sm md:grow-0",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",title:"Active readers in the last 5 minutes · Updates every 60 seconds",children:[e.jsxs("span",{className:"text-sm",children:[A?"":V(N)," reading now"]}),e.jsx("div",{className:`size-2 rounded-full ${A?"animate-pulse bg-muted":N?"bg-green-500":"border border-muted-foreground"}`})]})}),!b&&e.jsxs(e.Fragment,{children:[!s?.email_only&&e.jsx(me,{author:s?.authors?.[0]?.name||"",description:"",faviconURL:v?.icon||"",featureImageURL:s?.feature_image,open:O,postExcerpt:s?.excerpt||"",postTitle:s?.title,postURL:s?.url,siteTitle:v?.title||"",onClose:()=>f(!1),onOpenChange:f,children:e.jsxs(D,{variant:"outline",onClick:()=>f(!0),children:[e.jsx(be,{})," Share"]})}),e.jsxs(F,{children:[e.jsx(J,{asChild:!0,children:e.jsx(D,{variant:"outline",children:e.jsx(Q,{})})}),e.jsxs(Y,{align:"end",children:[e.jsxs(k,{children:[e.jsx(g,{asChild:!0,children:e.jsxs("a",{href:s?.url,rel:"noopener noreferrer",target:"_blank",children:[e.jsx(q,{}),"View in browser"]})}),e.jsxs(g,{onClick:()=>{a(`/editor/post/${o}`,{crossApp:!0})},children:[e.jsx(ge,{}),"Edit post"]})]}),e.jsx(K,{}),e.jsx(k,{children:e.jsxs(g,{className:"text-destructive focus:text-destructive",onClick:R,children:[e.jsx(ye,{}),"Delete post"]})})]})]})]})]})]}),!b&&e.jsxs("div",{className:"flex items-start gap-6 md:items-center",children:[s?.feature_image&&e.jsx("div",{className:"aspect-[16/10] w-full max-w-[100px] rounded-md bg-cover bg-center md:max-w-[132px]",style:{backgroundImage:`url(${s.feature_image})`}}),e.jsxs("div",{children:[e.jsx(X,{className:"-ml-px max-w-[920px] indent-0 text-xl md:min-h-[35px] md:text-3xl md:leading-[1.2em]","data-header":"header-title",children:s?.title}),s?.published_at&&e.jsxs("div",{className:"mt-0.5 flex items-center justify-start text-sm leading-[1.65em] text-muted-foreground",children:[xe(s)&&`Sent on ${j(s.published_at,c)} at ${w(s.published_at,c)}`,C(s)&&`Published on your site on ${j(s.published_at,c)} at ${w(s.published_at,c)}`,he(s)&&`Published and sent on ${j(s.published_at,c)} at ${w(s.published_at,c)}`]})]})]})]})})}),e.jsxs(ce,{className:"sticky top-0 z-50 -mb-8 transform-gpu flex-col items-start gap-y-0 border-none bg-white/70 py-8 backdrop-blur-md lg:flex-row lg:items-center dark:bg-black",children:[!b&&e.jsxs(de,{className:"min-h-[34px]",defaultValue:r,responsive:!0,children:[m.includes("Overview")&&e.jsxs(u,{value:"Overview",onClick:()=>{a(`/posts/analytics/${o}`)},children:[e.jsx(je,{}),"Overview"]}),m.includes("Web")&&e.jsxs(u,{value:"Web",onClick:()=>{a(`/posts/analytics/${o}/web`)},children:[e.jsx(Z,{}),"Web traffic"]}),m.includes("Newsletter")&&e.jsxs(u,{value:"Newsletter",onClick:()=>{a(`/posts/analytics/${o}/newsletter`)},children:[e.jsx(we,{}),"Newsletter"]}),m.includes("Growth")&&e.jsxs(u,{value:"Growth",onClick:()=>{a(`/posts/analytics/${o}/growth`)},children:[e.jsx(ve,{}),"Growth"]})]}),t]}),e.jsx(ee,{open:M,onOpenChange:h,children:e.jsxs(se,{children:[e.jsxs(ae,{children:[e.jsx(te,{children:"Are you sure you want to delete this post?"}),e.jsxs(re,{children:[`You're about to delete "`,e.jsx("strong",{children:s?.title}),'". This is permanent! We warned you, k?']})]}),e.jsxs(ie,{children:[e.jsx(le,{children:"Cancel"}),e.jsx(ne,{className:"hover:bg-red-700 bg-red-600 text-white",onClick:G,children:"Delete"})]})]})})]})};export{Oe as P,Me as a};
1
+ import{r as i,j as e,y as d,bL as I,C as W,aP as z,aU as U,bM as H,aj as V,B as D,bH as F,ap as J,bN as Q,bI as Y,bO as k,bJ as g,x as q,bP as K,bQ as X,bR as j,bS as w,aT as Z,a0 as ee,a1 as se,a2 as ae,a3 as te,a4 as re,a5 as ie,a6 as le,a7 as ne}from"./index-CMTzNTew.js";import{h as oe,N as ce,P as de,i as u}from"./pagemenu-CZyroidv.js";import{P as me}from"./post-share-modal-D8R7DUZP.js";import{u as ue}from"./post-analytics-context-CF7C67-0.js";import{i as C,h as pe,a as xe,b as he}from"./post-helpers-gInwAwEv.js";import{a as fe}from"./posts-CL9UDYoW.js";import{S as be,P as ge,G as je,M as we}from"./wallet-cards-KmOh29LP.js";import{T as ye}from"./trash-u5BxolyH.js";import{S as ve}from"./sprout-C3cc0c-K.js";const P=i.forwardRef(({...r},t)=>e.jsx("nav",{ref:t,"aria-label":"breadcrumb",...r}));P.displayName="Breadcrumb";const S=i.forwardRef(({className:r,...t},a)=>e.jsx("ol",{ref:a,className:d("flex flex-wrap items-center gap-1.5 break-words text-sm font-medium text-muted-foreground sm:gap-2.5 h-[34px]",r),...t}));S.displayName="BreadcrumbList";const p=i.forwardRef(({className:r,...t},a)=>e.jsx("li",{ref:a,className:d("inline-flex items-center gap-1.5",r),...t}));p.displayName="BreadcrumbItem";const y=i.forwardRef(({asChild:r,className:t,...a},x)=>{const l=r?I:"a";return e.jsx(l,{ref:x,className:d("inline-flex items-center gap-1 transition-colors hover:text-foreground",t),...a})});y.displayName="BreadcrumbLink";const B=i.forwardRef(({className:r,...t},a)=>e.jsx("span",{ref:a,"aria-current":"page","aria-disabled":"true",className:d("font-medium text-foreground",r),role:"link",...t}));B.displayName="BreadcrumbPage";const T=({children:r,className:t,...a})=>e.jsx("li",{"aria-hidden":"true",className:d("[&>svg]:w-3.5 [&>svg]:h-3.5",t),role:"presentation",...a,children:r??e.jsx(W,{})});T.displayName="BreadcrumbSeparator";const Me=({children:r,className:t,...a})=>e.jsx("section",{className:d("flex gap-6 flex-col py-8 size-full grow",t),...a,children:r}),Ne=r=>{for(const t of r)if(t.key==="timezone"){const a=t.value;if(typeof a!="string")throw new TypeError("Site timezone setting is not a string");return a}return"Etc/UTC"},Oe=({currentTab:r,children:t})=>{const a=z(),{fromAnalytics:x,appSettings:l}=U(),{mutateAsync:_}=fe(),E=H(),[M,h]=i.useState(!1),[O,f]=i.useState(!1),{settings:$,site:v,statsConfig:L,post:s,isPostLoading:b,postId:o}=ue(),c=Ne($),{activeVisitors:N,isLoading:A}=oe({postUuid:s?.uuid,statsConfig:L,enabled:l?.analytics?.webAnalytics??!1}),m=i.useMemo(()=>{if(!s)return[];const n=[];return C(s)&&!l?.analytics.webAnalytics||(n.push("Overview"),!s.email_only&&l?.analytics.webAnalytics&&n.push("Web")),pe(s)&&n.push("Newsletter"),n.push("Growth"),n},[s,l?.analytics.webAnalytics]),R=()=>{s&&h(!0)},G=async()=>{if(s)try{await _(o),h(!1),a("/posts/",{crossApp:!0})}catch(n){E(n)}};return e.jsxs(e.Fragment,{children:[e.jsx("header",{className:"z-50 -mx-8 bg-white/70 backdrop-blur-md dark:bg-black",children:e.jsx("div",{className:"relative flex min-h-[102px] w-full items-start justify-between gap-5 px-8 pb-0 pt-8","data-header":"header",children:e.jsxs("div",{className:"flex w-full flex-col gap-5",children:[e.jsxs("div",{className:"flex w-full flex-col justify-between md:flex-row md:items-center",children:[e.jsx(P,{children:e.jsxs(S,{children:[x?e.jsx(p,{children:e.jsx(y,{className:"cursor-pointer leading-[24px]",onClick:()=>a("/analytics/",{crossApp:!0}),children:"Analytics"})}):e.jsx(p,{children:e.jsx(y,{className:"cursor-pointer leading-[24px]",onClick:()=>a("/posts/",{crossApp:!0}),children:"Posts"})}),e.jsx(T,{}),e.jsx(p,{children:e.jsx(B,{className:"leading-[24px]",children:"Post analytics"})})]})}),e.jsxs("div",{className:"flex w-full items-center gap-2 md:w-auto",children:[l?.analytics.webAnalytics&&!s?.email_only&&e.jsx("div",{className:"mr-3 flex grow items-center gap-2 text-sm md:grow-0",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",title:"Active readers in the last 5 minutes · Updates every 60 seconds",children:[e.jsxs("span",{className:"text-sm",children:[A?"":V(N)," reading now"]}),e.jsx("div",{className:`size-2 rounded-full ${A?"animate-pulse bg-muted":N?"bg-green-500":"border border-muted-foreground"}`})]})}),!b&&e.jsxs(e.Fragment,{children:[!s?.email_only&&e.jsx(me,{author:s?.authors?.[0]?.name||"",description:"",faviconURL:v?.icon||"",featureImageURL:s?.feature_image,open:O,postExcerpt:s?.excerpt||"",postTitle:s?.title,postURL:s?.url,siteTitle:v?.title||"",onClose:()=>f(!1),onOpenChange:f,children:e.jsxs(D,{variant:"outline",onClick:()=>f(!0),children:[e.jsx(be,{})," Share"]})}),e.jsxs(F,{children:[e.jsx(J,{asChild:!0,children:e.jsx(D,{variant:"outline",children:e.jsx(Q,{})})}),e.jsxs(Y,{align:"end",children:[e.jsxs(k,{children:[e.jsx(g,{asChild:!0,children:e.jsxs("a",{href:s?.url,rel:"noopener noreferrer",target:"_blank",children:[e.jsx(q,{}),"View in browser"]})}),e.jsxs(g,{onClick:()=>{a(`/editor/post/${o}`,{crossApp:!0})},children:[e.jsx(ge,{}),"Edit post"]})]}),e.jsx(K,{}),e.jsx(k,{children:e.jsxs(g,{className:"text-destructive focus:text-destructive",onClick:R,children:[e.jsx(ye,{}),"Delete post"]})})]})]})]})]})]}),!b&&e.jsxs("div",{className:"flex items-start gap-6 md:items-center",children:[s?.feature_image&&e.jsx("div",{className:"aspect-[16/10] w-full max-w-[100px] rounded-md bg-cover bg-center md:max-w-[132px]",style:{backgroundImage:`url(${s.feature_image})`}}),e.jsxs("div",{children:[e.jsx(X,{className:"-ml-px max-w-[920px] indent-0 text-xl md:min-h-[35px] md:text-3xl md:leading-[1.2em]","data-header":"header-title",children:s?.title}),s?.published_at&&e.jsxs("div",{className:"mt-0.5 flex items-center justify-start text-sm leading-[1.65em] text-muted-foreground",children:[xe(s)&&`Sent on ${j(s.published_at,c)} at ${w(s.published_at,c)}`,C(s)&&`Published on your site on ${j(s.published_at,c)} at ${w(s.published_at,c)}`,he(s)&&`Published and sent on ${j(s.published_at,c)} at ${w(s.published_at,c)}`]})]})]})]})})}),e.jsxs(ce,{className:"sticky top-0 z-50 -mb-8 transform-gpu flex-col items-start gap-y-0 border-none bg-white/70 py-8 backdrop-blur-md lg:flex-row lg:items-center dark:bg-black",children:[!b&&e.jsxs(de,{className:"min-h-[34px]",defaultValue:r,responsive:!0,children:[m.includes("Overview")&&e.jsxs(u,{value:"Overview",onClick:()=>{a(`/posts/analytics/${o}`)},children:[e.jsx(je,{}),"Overview"]}),m.includes("Web")&&e.jsxs(u,{value:"Web",onClick:()=>{a(`/posts/analytics/${o}/web`)},children:[e.jsx(Z,{}),"Web traffic"]}),m.includes("Newsletter")&&e.jsxs(u,{value:"Newsletter",onClick:()=>{a(`/posts/analytics/${o}/newsletter`)},children:[e.jsx(we,{}),"Newsletter"]}),m.includes("Growth")&&e.jsxs(u,{value:"Growth",onClick:()=>{a(`/posts/analytics/${o}/growth`)},children:[e.jsx(ve,{}),"Growth"]})]}),t]}),e.jsx(ee,{open:M,onOpenChange:h,children:e.jsxs(se,{children:[e.jsxs(ae,{children:[e.jsx(te,{children:"Are you sure you want to delete this post?"}),e.jsxs(re,{children:[`You're about to delete "`,e.jsx("strong",{children:s?.title}),'". This is permanent! We warned you, k?']})]}),e.jsxs(ie,{children:[e.jsx(le,{children:"Cancel"}),e.jsx(ne,{className:"hover:bg-red-700 bg-red-600 text-white",onClick:G,children:"Delete"})]})]})})]})};export{Oe as P,Me as a};
@@ -1 +1 @@
1
- import{r as k,j as e,D as w,q as N,t as C,B as t,X as z,v as y,w as H,a9 as $,_ as M,aa as D,$ as P,ab as V}from"./index-f5Lv9kLb.js";const I=({emailOnly:x=!1,postURL:s="",primaryTitle:m="Your post is published.",secondaryTitle:p="Spread the word!",description:a="",featureImageURL:i="",postTitle:r="",postExcerpt:n="",faviconURL:f="",siteTitle:g="",author:j="",onClose:c=()=>{},children:u,...v})=>{const[o,d]=k.useState(!1),_=async()=>{try{await navigator.clipboard.writeText(s),d(!0),setTimeout(()=>d(!1),2e3)}catch{}},h=encodeURIComponent(r),l=encodeURIComponent(s),b=encodeURIComponent(`${r} ${s}`);return e.jsxs(w,{...v,children:[e.jsx(N,{className:"cursor-pointer",asChild:!0,children:u}),e.jsxs(C,{className:"max-h-[calc(100vh-16vmin)] max-w-[540px] overflow-y-auto p-8",children:[e.jsx("div",{className:"sticky top-0 ml-auto size-0",children:e.jsx(t,{className:"absolute -right-5 -top-5 cursor-pointer p-2 text-muted-foreground hover:text-foreground [&_svg]:!size-6",size:"lg",variant:"link",onClick:c,children:e.jsx(z,{size:24,strokeWidth:1})})}),e.jsxs(y,{className:"relative -mt-5",children:[e.jsxs(H,{className:"text-3xl font-bold leading-[1.15em]",children:[e.jsx("span",{className:"text-green-500",children:m}),e.jsx("br",{}),e.jsx("span",{children:p})]}),a&&e.jsx($,{className:"mb-0 pb-0 pt-1 text-lg text-foreground",children:a})]}),e.jsxs("a",{className:"flex flex-col items-stretch overflow-hidden rounded-md border transition-all hover:border-muted-foreground/40",href:s,rel:"noopener noreferrer",target:"_blank",children:[i&&e.jsx("div",{className:"aspect-video bg-cover bg-center",style:{backgroundImage:`url(${i})`}}),e.jsxs("div",{className:"p-6 pt-5",children:[e.jsx(M,{children:r}),n&&e.jsx("p",{children:n}),e.jsxs("div",{className:"mt-2 flex items-start gap-2",children:[e.jsx("div",{className:"mt-0.5 size-4 bg-cover bg-center",style:{backgroundImage:`url(${f})`}}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("strong",{children:g}),e.jsx("span",{children:"•"}),e.jsx("span",{children:j})]})]})]})]}),e.jsx(D,{className:"justify-between gap-6",children:x?e.jsx(t,{className:"cursor-pointer",type:"submit",onClick:c,children:"Close"}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("a",{className:"flex h-[34px] w-14 items-center justify-center rounded-sm bg-muted px-3 hover:bg-muted-foreground/20 [&_svg]:h-4",href:`https://twitter.com/intent/tweet?text=${h}%0A${l}`,rel:"noopener noreferrer",target:"_blank",children:e.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",children:e.jsx("path",{className:"social-x_svg__x",d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})})}),e.jsx("a",{className:"flex h-[34px] w-14 items-center justify-center rounded-sm bg-muted px-3 hover:bg-muted-foreground/20 [&_svg]:h-4",href:`https://threads.net/intent/post?text=${b}`,rel:"noopener noreferrer",target:"_blank",children:e.jsxs("svg",{fill:"none",viewBox:"0 0 18 18",children:[e.jsx("g",{clipPath:"url(#social-threads_svg__clip0_351_18008)",children:e.jsx("path",{d:"M13.033 8.38a5.924 5.924 0 00-.223-.102c-.13-2.418-1.452-3.802-3.67-3.816h-.03c-1.327 0-2.43.566-3.11 1.597l1.22.837c.507-.77 1.304-.934 1.89-.934h.02c.73.004 1.282.217 1.639.63.26.302.433.72.519 1.245a9.334 9.334 0 00-2.097-.101c-2.109.121-3.465 1.351-3.374 3.06.047.868.478 1.614 1.216 2.1.624.413 1.428.614 2.263.568 1.103-.06 1.969-.48 2.572-1.25.459-.585.749-1.342.877-2.296.526.317.915.735 1.13 1.236.366.854.387 2.255-.756 3.398-1.003 1.002-2.207 1.435-4.028 1.448-2.02-.015-3.547-.663-4.54-1.925-.93-1.182-1.41-2.89-1.428-5.075.018-2.185.498-3.893 1.428-5.075.993-1.262 2.52-1.91 4.54-1.925 2.034.015 3.588.666 4.62 1.934.505.622.886 1.405 1.137 2.317l1.43-.382c-.305-1.122-.784-2.09-1.436-2.892C13.52 1.35 11.587.517 9.096.5h-.01C6.6.517 4.689 1.354 3.404 2.986 2.262 4.44 1.672 6.46 1.652 8.994v.012c.02 2.534.61 4.555 1.752 6.008C4.69 16.646 6.6 17.483 9.086 17.5h.01c2.21-.015 3.768-.594 5.051-1.876 1.68-1.678 1.629-3.78 1.075-5.07-.397-.927-1.154-1.678-2.189-2.175zm-3.816 3.587c-.924.052-1.884-.363-1.932-1.252-.035-.659.47-1.394 1.99-1.482a8.9 8.9 0 01.512-.014c.552 0 1.068.053 1.538.156-.175 2.187-1.203 2.542-2.108 2.592z",fill:"#000"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"social-threads_svg__clip0_351_18008",children:e.jsx("path",{d:"M0 0h17v17H0z",fill:"#fff",transform:"translate(.5 .5)"})})})]})}),e.jsx("a",{className:"flex h-[34px] w-14 items-center justify-center rounded-sm bg-muted px-3 hover:bg-muted-foreground/20 [&_svg]:h-4",href:`https://www.facebook.com/sharer/sharer.php?u=${l}`,rel:"noopener noreferrer",target:"_blank",children:e.jsxs("svg",{fill:"none",viewBox:"0 0 40 40",children:[e.jsx("title",{children:"social-facebook"}),e.jsx("path",{className:"social-facebook_svg__fb",d:"M20 40.004c11.046 0 20-8.955 20-20 0-11.046-8.954-20-20-20s-20 8.954-20 20c0 11.045 8.954 20 20 20z",fill:"#1977f3"}),e.jsx("path",{d:"M27.785 25.785l.886-5.782h-5.546V16.25c0-1.58.773-3.125 3.26-3.125h2.522V8.204s-2.29-.39-4.477-.39c-4.568 0-7.555 2.767-7.555 7.781v4.408h-5.08v5.782h5.08v13.976a20.08 20.08 0 003.125.242c1.063 0 2.107-.085 3.125-.242V25.785h4.66z",fill:"#fff"})]})}),e.jsx("a",{className:"flex h-[34px] w-14 items-center justify-center rounded-sm bg-muted px-3 hover:bg-muted-foreground/20 [&_svg]:h-4",href:`http://www.linkedin.com/shareArticle?mini=true&title=${h}&url=${l}`,rel:"noopener noreferrer",target:"_blank",children:e.jsxs("svg",{fill:"none",viewBox:"0 0 16 16",children:[e.jsxs("g",{clipPath:"url(#social-linkedin_svg__clip0_537_833)",children:[e.jsx("path",{className:"social-linkedin_svg__linkedin",clipRule:"evenodd",d:"M1.778 16h12.444c.982 0 1.778-.796 1.778-1.778V1.778C16 .796 15.204 0 14.222 0H1.778C.796 0 0 .796 0 1.778v12.444C0 15.204.796 16 1.778 16z",fill:"#007ebb",fillRule:"evenodd"}),e.jsx("path",{clipRule:"evenodd",d:"M13.778 13.778h-2.374V9.734c0-1.109-.421-1.729-1.299-1.729-.955 0-1.453.645-1.453 1.729v4.044H6.363V6.074h2.289v1.038s.688-1.273 2.322-1.273c1.634 0 2.804.997 2.804 3.061v4.878zM3.634 5.065c-.78 0-1.411-.636-1.411-1.421s.631-1.422 1.41-1.422c.78 0 1.411.637 1.411 1.422 0 .785-.631 1.421-1.41 1.421zm-1.182 8.713h2.386V6.074H2.452v7.704z",fill:"#fff",fillRule:"evenodd"})]}),e.jsx("defs",{children:e.jsx("clipPath",{id:"social-linkedin_svg__clip0_537_833",children:e.jsx("path",{d:"M0 0h16v16H0z",fill:"#fff"})})})]})})]}),e.jsxs(t,{className:"!ml-0 grow cursor-pointer",disabled:!s,type:"button",onClick:_,children:[o?e.jsx(P,{}):e.jsx(V,{}),o?"Copied!":"Copy link"]})]})})]})]})};export{I as P};
1
+ import{r as k,j as e,D as w,q as N,t as C,B as t,X as z,v as y,w as H,a9 as $,_ as M,aa as D,$ as P,ab as V}from"./index-CMTzNTew.js";const I=({emailOnly:x=!1,postURL:s="",primaryTitle:m="Your post is published.",secondaryTitle:p="Spread the word!",description:a="",featureImageURL:i="",postTitle:r="",postExcerpt:n="",faviconURL:f="",siteTitle:g="",author:j="",onClose:c=()=>{},children:u,...v})=>{const[o,d]=k.useState(!1),_=async()=>{try{await navigator.clipboard.writeText(s),d(!0),setTimeout(()=>d(!1),2e3)}catch{}},h=encodeURIComponent(r),l=encodeURIComponent(s),b=encodeURIComponent(`${r} ${s}`);return e.jsxs(w,{...v,children:[e.jsx(N,{className:"cursor-pointer",asChild:!0,children:u}),e.jsxs(C,{className:"max-h-[calc(100vh-16vmin)] max-w-[540px] overflow-y-auto p-8",children:[e.jsx("div",{className:"sticky top-0 ml-auto size-0",children:e.jsx(t,{className:"absolute -right-5 -top-5 cursor-pointer p-2 text-muted-foreground hover:text-foreground [&_svg]:!size-6",size:"lg",variant:"link",onClick:c,children:e.jsx(z,{size:24,strokeWidth:1})})}),e.jsxs(y,{className:"relative -mt-5",children:[e.jsxs(H,{className:"text-3xl font-bold leading-[1.15em]",children:[e.jsx("span",{className:"text-green-500",children:m}),e.jsx("br",{}),e.jsx("span",{children:p})]}),a&&e.jsx($,{className:"mb-0 pb-0 pt-1 text-lg text-foreground",children:a})]}),e.jsxs("a",{className:"flex flex-col items-stretch overflow-hidden rounded-md border transition-all hover:border-muted-foreground/40",href:s,rel:"noopener noreferrer",target:"_blank",children:[i&&e.jsx("div",{className:"aspect-video bg-cover bg-center",style:{backgroundImage:`url(${i})`}}),e.jsxs("div",{className:"p-6 pt-5",children:[e.jsx(M,{children:r}),n&&e.jsx("p",{children:n}),e.jsxs("div",{className:"mt-2 flex items-start gap-2",children:[e.jsx("div",{className:"mt-0.5 size-4 bg-cover bg-center",style:{backgroundImage:`url(${f})`}}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("strong",{children:g}),e.jsx("span",{children:"•"}),e.jsx("span",{children:j})]})]})]})]}),e.jsx(D,{className:"justify-between gap-6",children:x?e.jsx(t,{className:"cursor-pointer",type:"submit",onClick:c,children:"Close"}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("a",{className:"flex h-[34px] w-14 items-center justify-center rounded-sm bg-muted px-3 hover:bg-muted-foreground/20 [&_svg]:h-4",href:`https://twitter.com/intent/tweet?text=${h}%0A${l}`,rel:"noopener noreferrer",target:"_blank",children:e.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",children:e.jsx("path",{className:"social-x_svg__x",d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})})}),e.jsx("a",{className:"flex h-[34px] w-14 items-center justify-center rounded-sm bg-muted px-3 hover:bg-muted-foreground/20 [&_svg]:h-4",href:`https://threads.net/intent/post?text=${b}`,rel:"noopener noreferrer",target:"_blank",children:e.jsxs("svg",{fill:"none",viewBox:"0 0 18 18",children:[e.jsx("g",{clipPath:"url(#social-threads_svg__clip0_351_18008)",children:e.jsx("path",{d:"M13.033 8.38a5.924 5.924 0 00-.223-.102c-.13-2.418-1.452-3.802-3.67-3.816h-.03c-1.327 0-2.43.566-3.11 1.597l1.22.837c.507-.77 1.304-.934 1.89-.934h.02c.73.004 1.282.217 1.639.63.26.302.433.72.519 1.245a9.334 9.334 0 00-2.097-.101c-2.109.121-3.465 1.351-3.374 3.06.047.868.478 1.614 1.216 2.1.624.413 1.428.614 2.263.568 1.103-.06 1.969-.48 2.572-1.25.459-.585.749-1.342.877-2.296.526.317.915.735 1.13 1.236.366.854.387 2.255-.756 3.398-1.003 1.002-2.207 1.435-4.028 1.448-2.02-.015-3.547-.663-4.54-1.925-.93-1.182-1.41-2.89-1.428-5.075.018-2.185.498-3.893 1.428-5.075.993-1.262 2.52-1.91 4.54-1.925 2.034.015 3.588.666 4.62 1.934.505.622.886 1.405 1.137 2.317l1.43-.382c-.305-1.122-.784-2.09-1.436-2.892C13.52 1.35 11.587.517 9.096.5h-.01C6.6.517 4.689 1.354 3.404 2.986 2.262 4.44 1.672 6.46 1.652 8.994v.012c.02 2.534.61 4.555 1.752 6.008C4.69 16.646 6.6 17.483 9.086 17.5h.01c2.21-.015 3.768-.594 5.051-1.876 1.68-1.678 1.629-3.78 1.075-5.07-.397-.927-1.154-1.678-2.189-2.175zm-3.816 3.587c-.924.052-1.884-.363-1.932-1.252-.035-.659.47-1.394 1.99-1.482a8.9 8.9 0 01.512-.014c.552 0 1.068.053 1.538.156-.175 2.187-1.203 2.542-2.108 2.592z",fill:"#000"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"social-threads_svg__clip0_351_18008",children:e.jsx("path",{d:"M0 0h17v17H0z",fill:"#fff",transform:"translate(.5 .5)"})})})]})}),e.jsx("a",{className:"flex h-[34px] w-14 items-center justify-center rounded-sm bg-muted px-3 hover:bg-muted-foreground/20 [&_svg]:h-4",href:`https://www.facebook.com/sharer/sharer.php?u=${l}`,rel:"noopener noreferrer",target:"_blank",children:e.jsxs("svg",{fill:"none",viewBox:"0 0 40 40",children:[e.jsx("title",{children:"social-facebook"}),e.jsx("path",{className:"social-facebook_svg__fb",d:"M20 40.004c11.046 0 20-8.955 20-20 0-11.046-8.954-20-20-20s-20 8.954-20 20c0 11.045 8.954 20 20 20z",fill:"#1977f3"}),e.jsx("path",{d:"M27.785 25.785l.886-5.782h-5.546V16.25c0-1.58.773-3.125 3.26-3.125h2.522V8.204s-2.29-.39-4.477-.39c-4.568 0-7.555 2.767-7.555 7.781v4.408h-5.08v5.782h5.08v13.976a20.08 20.08 0 003.125.242c1.063 0 2.107-.085 3.125-.242V25.785h4.66z",fill:"#fff"})]})}),e.jsx("a",{className:"flex h-[34px] w-14 items-center justify-center rounded-sm bg-muted px-3 hover:bg-muted-foreground/20 [&_svg]:h-4",href:`http://www.linkedin.com/shareArticle?mini=true&title=${h}&url=${l}`,rel:"noopener noreferrer",target:"_blank",children:e.jsxs("svg",{fill:"none",viewBox:"0 0 16 16",children:[e.jsxs("g",{clipPath:"url(#social-linkedin_svg__clip0_537_833)",children:[e.jsx("path",{className:"social-linkedin_svg__linkedin",clipRule:"evenodd",d:"M1.778 16h12.444c.982 0 1.778-.796 1.778-1.778V1.778C16 .796 15.204 0 14.222 0H1.778C.796 0 0 .796 0 1.778v12.444C0 15.204.796 16 1.778 16z",fill:"#007ebb",fillRule:"evenodd"}),e.jsx("path",{clipRule:"evenodd",d:"M13.778 13.778h-2.374V9.734c0-1.109-.421-1.729-1.299-1.729-.955 0-1.453.645-1.453 1.729v4.044H6.363V6.074h2.289v1.038s.688-1.273 2.322-1.273c1.634 0 2.804.997 2.804 3.061v4.878zM3.634 5.065c-.78 0-1.411-.636-1.411-1.421s.631-1.422 1.41-1.422c.78 0 1.411.637 1.411 1.422 0 .785-.631 1.421-1.41 1.421zm-1.182 8.713h2.386V6.074H2.452v7.704z",fill:"#fff",fillRule:"evenodd"})]}),e.jsx("defs",{children:e.jsx("clipPath",{id:"social-linkedin_svg__clip0_537_833",children:e.jsx("path",{d:"M0 0h16v16H0z",fill:"#fff"})})})]})})]}),e.jsxs(t,{className:"!ml-0 grow cursor-pointer",disabled:!s,type:"button",onClick:_,children:[o?e.jsx(P,{}):e.jsx(V,{}),o?"Copied!":"Copy link"]})]})})]})]})};export{I as P};