ghost 6.40.0 → 6.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/core/boot.js +8 -8
  2. package/core/built/admin/assets/{PolarAngleAxis-D7m1zwVk.js → PolarAngleAxis-Bh28wbPV.js} +1 -1
  3. package/core/built/admin/assets/{_baseAssignValue-BDsvYKNK.js → _baseAssignValue-hdDG700N.js} +1 -1
  4. package/core/built/admin/assets/{a-large-small-DxRNdz0F.js → a-large-small-BiK5_5LV.js} +1 -1
  5. package/core/built/admin/assets/{account-migration-SYnE1jBW.js → account-migration-DsSHanIB.js} +1 -1
  6. package/core/built/admin/assets/admin-x-settings/admin-x-settings.js +1 -1
  7. package/core/built/admin/assets/admin-x-settings/{code-editor-view-Bj9rgbLw.mjs → code-editor-view-BEIdFhw3.mjs} +2 -2
  8. package/core/built/admin/assets/admin-x-settings/{index-BrZ9YAzd.mjs → index-BEh3nFEy.mjs} +3 -3
  9. package/core/built/admin/assets/admin-x-settings/{index-DRndIh9T.mjs → index-BLF2n6YB.mjs} +2 -2
  10. package/core/built/admin/assets/admin-x-settings/{index-CIl25Teq.mjs → index-BmPIWs5F.mjs} +3 -3
  11. package/core/built/admin/assets/admin-x-settings/{index-CNyNY3Wh.mjs → index-CP9YnNzc.mjs} +3 -3
  12. package/core/built/admin/assets/admin-x-settings/{index-SGr5sE2h.mjs → index-Cd2Ns-D2.mjs} +2 -2
  13. package/core/built/admin/assets/admin-x-settings/{index-PGoLP2kh.mjs → index-CjqAcKpK.mjs} +5 -5
  14. package/core/built/admin/assets/admin-x-settings/{index-pCIv_7bB.mjs → index-CnMcD9aj.mjs} +6212 -6158
  15. package/core/built/admin/assets/admin-x-settings/{index-CPCcgad-.mjs → index-LzsrZC40.mjs} +3 -3
  16. package/core/built/admin/assets/admin-x-settings/{index-DPqY4h5h.mjs → index-ZYW0UW7I.mjs} +3 -3
  17. package/core/built/admin/assets/admin-x-settings/{modals-lo32WZLi.mjs → modals-C48Tq1rW.mjs} +9 -9
  18. package/core/built/admin/assets/{arrow-right-BixoEua4.js → arrow-right-Bk43nMGd.js} +1 -1
  19. package/core/built/admin/assets/{at-sign-BsHNViA_.js → at-sign-DWOf36uj.js} +1 -1
  20. package/core/built/admin/assets/{audience-0RCWjbIK.js → audience-CvP78Gug.js} +1 -1
  21. package/core/built/admin/assets/{automations-DTUfYvf6.js → automations-BBWZhrha.js} +1 -1
  22. package/core/built/admin/assets/{automations-DiGkcVt-.js → automations-CmulGWwu.js} +1 -1
  23. package/core/built/admin/assets/{avatar-flipboard-BgoH-wIq.js → avatar-flipboard-CVf-N6wp.js} +1 -1
  24. package/core/built/admin/assets/{bluesky-sharing-C2xwSoS-.js → bluesky-sharing-DVC3I9Um.js} +1 -1
  25. package/core/built/admin/assets/{chart-X5cLIH1X.js → chart-CUKSNmKY.js} +1 -1
  26. package/core/built/admin/assets/{checkbox-DMamS4oG.js → checkbox-B_yDSM8z.js} +1 -1
  27. package/core/built/admin/assets/{chevron-up-CVgBkTk5.js → chevron-up-DuaKtE_M.js} +1 -1
  28. package/core/built/admin/assets/{chunk.941.f47098cbbce89a049e03.js → chunk.331.2ec2e2702eda02de96cd.js} +3 -3
  29. package/core/built/admin/assets/{chunk.524.a1d668dcc84709a5d702.js → chunk.524.49cc01002e1a5dba8ef9.js} +4 -4
  30. package/core/built/admin/assets/{chunk.582.180bf2525cf552f5ac5f.js → chunk.582.4bbc54c5f7d3dfb93288.js} +6 -6
  31. package/core/built/admin/assets/{circle-alert-Dg3UkvRP.js → circle-alert-bcK_Yqap.js} +1 -1
  32. package/core/built/admin/assets/{code-editor-view-CAICoZJe.js → code-editor-view-Bl4Jzjhk.js} +1 -1
  33. package/core/built/admin/assets/{comments-BHru9ZQ8.js → comments-DMea0nul.js} +1 -1
  34. package/core/built/admin/assets/{content-helpers-BByMp-Y5.js → content-helpers-B2yRzdvJ.js} +1 -1
  35. package/core/built/admin/assets/{copy-D7jqplrv.js → copy-DVtQi_VJ.js} +1 -1
  36. package/core/built/admin/assets/{data-list-DUaY9nlT.js → data-list-BF4GeUmt.js} +1 -1
  37. package/core/built/admin/assets/{deleted-feed-item-jLcSKuul.js → deleted-feed-item-DO2u3qmi.js} +1 -1
  38. package/core/built/admin/assets/{dropzone-DSPf3N_o.js → dropzone-Cs4DrURS.js} +1 -1
  39. package/core/built/admin/assets/{edit-profile-BvU2-lW5.js → edit-profile-CnuBNQhO.js} +1 -1
  40. package/core/built/admin/assets/{editor-D3fcjt_F.js → editor-CTO9FIUW.js} +1 -1
  41. package/core/built/admin/assets/{empty-indicator-2Pjmce3n.js → empty-indicator-BvyaMcmw.js} +1 -1
  42. package/core/built/admin/assets/{en-Bu-6PYn5.js → en-CjPXRj8j.js} +1 -1
  43. package/core/built/admin/assets/{feed-CygLK1Ad.js → feed-D2wk4cCS.js} +1 -1
  44. package/core/built/admin/assets/{filter-query-core-a0PNU2EO.js → filter-query-core-VEnwTCyO.js} +1 -1
  45. package/core/built/admin/assets/{filters-jiyRsLMH.js → filters-DtIsuqv5.js} +1 -1
  46. package/core/built/admin/assets/{gh-chart-CEhBBu3F.js → gh-chart-JxzKqaoO.js} +1 -1
  47. package/core/built/admin/assets/{ghost-0ab96884815339963364804ab266c99f.js → ghost-30c3dedbe1cca943b92efa7efd2710e4.js} +36 -21
  48. package/core/built/admin/assets/{growth-Fz3Oatml.js → growth-CPNrBpHK.js} +1 -1
  49. package/core/built/admin/assets/{hash-CeFrjo3C.js → hash-CJzbTA5k.js} +1 -1
  50. package/core/built/admin/assets/{inbox-CCirPaG2.js → inbox-CVVAkCmd.js} +1 -1
  51. package/core/built/admin/assets/{index-Dd2BJRZH.js → index-AkQJUr1z.js} +1 -1
  52. package/core/built/admin/assets/{index-CYPN5csJ.js → index-BLWOUf31.js} +1 -1
  53. package/core/built/admin/assets/{index-D7Ui3Fih.js → index-BRBRkRqa.js} +1 -1
  54. package/core/built/admin/assets/{index-CFEzD2_M.js → index-BkbhBpVC.js} +3 -3
  55. package/core/built/admin/assets/{index-BYwL7gFN.js → index-BxFFWYdP.js} +1 -1
  56. package/core/built/admin/assets/{index-D3LfHeBl.js → index-C5_ZKpC1.js} +1 -1
  57. package/core/built/admin/assets/{index-Bjw2qAph.js → index-Cdbufdfy.js} +1 -1
  58. package/core/built/admin/assets/{index-BTf6YUBb.js → index-Cq5vsvxE.js} +1 -1
  59. package/core/built/admin/assets/{index-DPbi4ie_.js → index-CuGoX8Ub.js} +1 -1
  60. package/core/built/admin/assets/{index-CsaU9dfl.js → index-CuH5raTz.js} +1 -1
  61. package/core/built/admin/assets/{index-Bf83suMc.js → index-D3A8RTi0.js} +1 -1
  62. package/core/built/admin/assets/{index-Dskrbhv3.js → index-DIyK69JM.js} +1 -1
  63. package/core/built/admin/assets/{index-GExKMpy_.js → index-DLFVpwt3.js} +1 -1
  64. package/core/built/admin/assets/{index-BOMdiHRG.js → index-DQZp_NsL.js} +1 -1
  65. package/core/built/admin/assets/{index-2qcjFCQs.js → index-DR74ulj2.js} +1 -1
  66. package/core/built/admin/assets/{index-WKMARia9.js → index-DYE2untj.js} +1 -1
  67. package/core/built/admin/assets/{index-DNZUJQ8v.js → index-DssW7xhk.js} +1 -1
  68. package/core/built/admin/assets/{index-Cq4mS7QK.js → index-DvyNqFct.js} +1 -1
  69. package/core/built/admin/assets/{index-C7xLyJVb.js → index-DxB7NHpG.js} +1 -1
  70. package/core/built/admin/assets/{index-Bw4DM4Pr.js → index-IDaHqjnu.js} +1 -1
  71. package/core/built/admin/assets/{index-ClOB5u8L.js → index-TtBMzSeP.js} +1 -1
  72. package/core/built/admin/assets/{index-takfwHSn.js → index-UMWVIyz7.js} +1 -1
  73. package/core/built/admin/assets/{koenig-lexical-BJM9wAwQ.js → koenig-lexical-DVAmevhl.js} +1 -1
  74. package/core/built/admin/assets/{kpi-card-BP-2yicn.js → kpi-card-D3CzvsrI.js} +1 -1
  75. package/core/built/admin/assets/{kpi-card-DOplXdDT.js → kpi-card-DV-nN7xT.js} +1 -1
  76. package/core/built/admin/assets/{kpi-tabs-Rq5jJW2Z.js → kpi-tabs-B3NkaTwb.js} +1 -1
  77. package/core/built/admin/assets/{kpis-yHgME_iy.js → kpis-CVwF08QL.js} +1 -1
  78. package/core/built/admin/assets/{label-fijjy1Mb.js → label-BiPpMny2.js} +1 -1
  79. package/core/built/admin/assets/{links-s3IeAkbo.js → links-BY0Uo6O5.js} +1 -1
  80. package/core/built/admin/assets/{list-page-CUcB5ebB.js → list-page-COHNMpOi.js} +1 -1
  81. package/core/built/admin/assets/{loader-circle-C7mWzo52.js → loader-circle-B1uEfpbZ.js} +1 -1
  82. package/core/built/admin/assets/{mail-9TFkAaAh.js → mail-ccQhEr7k.js} +1 -1
  83. package/core/built/admin/assets/{main-layout-XtviVkg1.js → main-layout-BYKdA6Z1.js} +1 -1
  84. package/core/built/admin/assets/{members-XkHao5Yf.js → members-DkpEnvG5.js} +1 -1
  85. package/core/built/admin/assets/minus-C68D81nx.js +1 -0
  86. package/core/built/admin/assets/{modals-B6R7oqvb.js → modals-X6RSWn5Y.js} +3 -3
  87. package/core/built/admin/assets/{moderation-B2Tixfce.js → moderation-BFrrwfvx.js} +1 -1
  88. package/core/built/admin/assets/{newsletter-CbESXhxf.js → newsletter-n7kc6cxR.js} +1 -1
  89. package/core/built/admin/assets/{newsletters-DOIL_cOY.js → newsletters-CSCa3QdE.js} +1 -1
  90. package/core/built/admin/assets/{note-mUikaB-p.js → note-CMZjeK8e.js} +1 -1
  91. package/core/built/admin/assets/{onboarding-route-Dqv2nP7b.js → onboarding-route-BaX0a-pu.js} +1 -1
  92. package/core/built/admin/assets/{overview-yZ-7KJdx.js → overview-CS9dmE_6.js} +1 -1
  93. package/core/built/admin/assets/{pagemenu-TxGvHwRO.js → pagemenu-O_y8Jm4v.js} +1 -1
  94. package/core/built/admin/assets/{pencil-CKTgzafp.js → pencil-BcymGPnE.js} +1 -1
  95. package/core/built/admin/assets/{pin-BU_u-xRX.js → pin-Bl3nSr7I.js} +1 -1
  96. package/core/built/admin/assets/{post-analytics-CWA8invj.js → post-analytics-DW-TKu-t.js} +1 -1
  97. package/core/built/admin/assets/{post-analytics-context-BWDhMRq_.js → post-analytics-context-D7PgEMo8.js} +1 -1
  98. package/core/built/admin/assets/{post-analytics-header-Bm0mcxjK.js → post-analytics-header-B8C0vA5Y.js} +1 -1
  99. package/core/built/admin/assets/{post-share-modal-D8BtRD2u.js → post-share-modal-D0OlASBQ.js} +1 -1
  100. package/core/built/admin/assets/{posts-u-CAKddc.js → posts-BZaw4-dc.js} +1 -1
  101. package/core/built/admin/assets/{power-DR9gpiQR.js → power-DWm6pts5.js} +1 -1
  102. package/core/built/admin/assets/{referrers-DV_Ihg9y.js → referrers-BsZ85Z0a.js} +1 -1
  103. package/core/built/admin/assets/{repeat-uXmOJ6y8.js → repeat-DQay9e22.js} +1 -1
  104. package/core/built/admin/assets/{reply-9ZyqaxI-.js → reply-CoNqmExw.js} +1 -1
  105. package/core/built/admin/assets/{rocket-DMOr1OCt.js → rocket-Dne6P_8f.js} +1 -1
  106. package/core/built/admin/assets/{select-CPSy44ld.js → select-BfWJkrKc.js} +1 -1
  107. package/core/built/admin/assets/{settings-krk0432u.js → settings-BoXzKMhL.js} +1 -1
  108. package/core/built/admin/assets/{settings-66Zv8QvL.js → settings-rRY210wx.js} +25 -25
  109. package/core/built/admin/assets/{share-modal-BRmGllZq.js → share-modal-CtdLQbnQ.js} +1 -1
  110. package/core/built/admin/assets/{sort-button-5fyeViQL.js → sort-button-7pVgpa0d.js} +1 -1
  111. package/core/built/admin/assets/{source-icon-DeeHyZRn.js → source-icon-Dtua85oN.js} +1 -1
  112. package/core/built/admin/assets/{sprout-956Q4On2.js → sprout-CpwUJAPT.js} +1 -1
  113. package/core/built/admin/assets/{square-BaCvbKJY.js → square-CDrQjv8R.js} +1 -1
  114. package/core/built/admin/assets/{stats-BVKNZJO6.js → stats-Yo9Gco0_.js} +1 -1
  115. package/core/built/admin/assets/{stats-view-gtyaqudG.js → stats-view-DubukX9V.js} +1 -1
  116. package/core/built/admin/assets/{step-1-09wdjzdX.js → step-1-CH8jWKi7.js} +1 -1
  117. package/core/built/admin/assets/{step-2-8iaQ0efq.js → step-2-CWy7Qi0Q.js} +1 -1
  118. package/core/built/admin/assets/{step-3-BuHAZbdD.js → step-3-CNiDFH17.js} +1 -1
  119. package/core/built/admin/assets/{table-DTofVyjA.js → table-qQi9EXB1.js} +1 -1
  120. package/core/built/admin/assets/{tabs-CL5eaCGL.js → tabs-M6kFEqPE.js} +1 -1
  121. package/core/built/admin/assets/{tags-DJrbEw5-.js → tags-74U6lgwY.js} +1 -1
  122. package/core/built/admin/assets/{tags-U3lciBmd.js → tags-DuMshkTz.js} +1 -1
  123. package/core/built/admin/assets/{textarea-DdDuNixZ.js → textarea-CGBp9nOo.js} +1 -1
  124. package/core/built/admin/assets/{tiers-DXKbghdk.js → tiers-D2DYHaeO.js} +1 -1
  125. package/core/built/admin/assets/{toggle-group-DaZKTYDS.js → toggle-group-GYp_w6Po.js} +1 -1
  126. package/core/built/admin/assets/{topic-filter-BzqiVOAU.js → topic-filter-N3CzJ01P.js} +1 -1
  127. package/core/built/admin/assets/{trash-CKK_p9G5.js → trash-CUqAK3SQ.js} +1 -1
  128. package/core/built/admin/assets/{underline-Bq0P-5Zy.js → underline-CwuJG-Ql.js} +1 -1
  129. package/core/built/admin/assets/{undo-2-CcBtw-tW.js → undo-2-D6ZRqONE.js} +1 -1
  130. package/core/built/admin/assets/{upload-BcylHEMw.js → upload-BLiT66bJ.js} +1 -1
  131. package/core/built/admin/assets/{use-growth-stats-Ci0gymWp.js → use-growth-stats-u18So4Gq.js} +1 -1
  132. package/core/built/admin/assets/{use-simple-pagination-ByaFwxfZ.js → use-simple-pagination-Dp2sTt2S.js} +1 -1
  133. package/core/built/admin/assets/{user-round-check-D0I7NO1g.js → user-round-check-BDomHaso.js} +1 -1
  134. package/core/built/admin/assets/{user-round-x-DeGVH29o.js → user-round-x-Cc0RL-V9.js} +1 -1
  135. package/core/built/admin/assets/{virtual-list-window-S0xZxQAf.js → virtual-list-window-BnjCoNIr.js} +1 -1
  136. package/core/built/admin/assets/{wallet-cards-B9TQg4x3.js → wallet-cards-CVZ99Nm3.js} +1 -1
  137. package/core/built/admin/assets/{web-BRN2mUpo.js → web-B_MLxGxZ.js} +1 -1
  138. package/core/built/admin/index.html +5 -5
  139. package/core/server/{services/custom-redirects/file-store.js → adapters/redirects/FileStore.js} +6 -5
  140. package/core/server/{services/custom-redirects/file-store.ts → adapters/redirects/FileStore.ts} +6 -4
  141. package/core/server/adapters/redirects/RedirectsStoreBase.d.ts +9 -0
  142. package/core/server/adapters/redirects/RedirectsStoreBase.js +8 -0
  143. package/core/server/{services/custom-redirects/gcs-store.js → adapters/redirects/S3RedirectsStore.js} +50 -18
  144. package/core/server/adapters/redirects/S3RedirectsStore.ts +163 -0
  145. package/core/server/adapters/scheduling/scheduling-base.js +41 -0
  146. package/core/server/adapters/scheduling/types.js +2 -0
  147. package/core/server/adapters/scheduling/types.ts +36 -0
  148. package/core/server/api/endpoints/authentication.js +26 -5
  149. package/core/server/api/endpoints/schedules.js +0 -30
  150. package/core/server/api/endpoints/utils/serializers/output/authentication.js +10 -0
  151. package/core/server/data/migrations/versions/6.41/2026-05-13-12-00-00-rename-reset-all-passwords-permission.js +21 -0
  152. package/core/server/data/schema/fixtures/fixtures.json +3 -3
  153. package/core/server/models/api-key.js +18 -0
  154. package/core/server/models/user.js +18 -0
  155. package/core/server/services/adapter-manager/config.js +6 -0
  156. package/core/server/services/adapter-manager/index.js +1 -0
  157. package/core/server/services/auth/index.js +4 -0
  158. package/core/server/services/auth/reset-authentication.js +50 -0
  159. package/core/server/services/auth/reset-authentication.ts +75 -0
  160. package/core/server/services/automations/index.js +21 -15
  161. package/core/server/services/custom-redirects/index.js +2 -4
  162. package/core/server/services/gifts/gift-bookshelf-repository.js +7 -0
  163. package/core/server/services/gifts/gift-bookshelf-repository.ts +10 -0
  164. package/core/server/services/gifts/gift-reminder-scheduler.js +94 -0
  165. package/core/server/services/gifts/gift-reminder-scheduler.ts +109 -0
  166. package/core/server/services/gifts/gift-repository.ts +1 -0
  167. package/core/server/services/gifts/gift-service-wrapper.js +10 -7
  168. package/core/server/services/gifts/gift-service.js +1 -32
  169. package/core/server/services/gifts/gift-service.ts +3 -59
  170. package/core/server/services/internal-keys/index.js +1 -3
  171. package/core/server/services/internal-keys/index.ts +11 -3
  172. package/core/server/services/post-scheduling/index.js +16 -28
  173. package/core/server/services/post-scheduling/index.ts +14 -0
  174. package/core/server/services/post-scheduling/post-scheduling.js +115 -0
  175. package/core/server/services/post-scheduling/post-scheduling.ts +138 -0
  176. package/core/server/services/users.js +29 -16
  177. package/core/server/web/api/endpoints/admin/middleware.js +8 -4
  178. package/core/server/web/api/endpoints/admin/routes.js +1 -1
  179. package/core/shared/config/defaults.json +5 -0
  180. package/core/shared/labs.js +2 -1
  181. package/package.json +1 -1
  182. package/core/built/admin/assets/minus-DPrXh11r.js +0 -1
  183. package/core/server/services/custom-redirects/gcs-store.ts +0 -117
  184. package/core/server/services/post-scheduling/post-scheduler-service.js +0 -126
@@ -375,14 +375,19 @@ e.default=Ember._setComponentTemplate(a,s)}),define("ghost-admin/components/gh-b
375
375
  function j(e,t,i,r){i&&Object.defineProperty(e,t,{enumerable:i.enumerable,configurable:i.configurable,writable:i.writable,value:i.initializer?i.initializer.call(r):void 0})}function O(e,t,i,r,n){var a={}
376
376
  return Object.keys(r).forEach(function(e){a[e]=r[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=i.slice().reverse().reduce(function(i,r){return r(e,t,i)||i},a),n&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(n):void 0,a.initializer=void 0),void 0===a.initializer?(Object.defineProperty(e,t,a),null):a}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
377
377
  const T=Ember.HTMLBars.template({id:"ErYely0X",block:'{"symbols":["&attrs"],"statements":[[11,"iframe"],[24,1,"billing-frame"],[24,0,"billing-frame"],[24,"frameborder","0"],[24,"title","Billing"],[24,"allow","clipboard-write"],[17,1],[4,[38,0],[[32,0,["setup"]]],null],[12],[13]],"hasEval":false,"upvars":["did-insert"]}',moduleName:"ghost-admin/components/gh-billing-iframe.hbs"})
378
- let z=e.default=(r=Ember.inject.service,n=Ember.inject.service,a=Ember.inject.service,s=Ember.inject.service,o=Ember.inject.service,l=Ember.inject.service,u=Ember.inject.service,c=Ember.inject.service,d=Ember._tracked,p=Ember._action,m=Ember._action,h=class extends t.default{constructor(...e){super(...e),j(this,"ajax",b,this),j(this,"billing",f,this),j(this,"configManager",g,this),j(this,"ghostPaths",v,this),j(this,"limit",y,this),j(this,"notifications",w,this),j(this,"session",E,this),j(this,"stateBridge",k,this),j(this,"config",P,this),j(this,"isOwner",_,this)}willDestroy(){super.willDestroy(...arguments),window.removeEventListener("message",this.handleIframeMessage)}setup(){this.billing.setBillingIframeSrc(),this.billing.startBillingAppLoadMonitor(),window.addEventListener("message",this.handleIframeMessage)}async handleIframeMessage(e){this.isDestroyed||this.isDestroying||e?.data&&this.billing.getIframeURL().includes(e?.origin)&&(this.billing.markBillingAppLoaded(),"token"===e.data?.request&&this._handleTokenRequest(),"forceUpgradeInfo"===e.data?.request&&this._handleForceUpgradeRequest(),e.data?.subscription&&await this._handleSubscriptionUpdate(e.data))}_handleTokenRequest(){const e=()=>{this.isOwner=!1,this.billing.getBillingIframe().contentWindow.postMessage({request:"token",response:null},"*")}
378
+ let z=e.default=(r=Ember.inject.service,n=Ember.inject.service,a=Ember.inject.service,s=Ember.inject.service,o=Ember.inject.service,l=Ember.inject.service,u=Ember.inject.service,c=Ember.inject.service,d=Ember._tracked,p=Ember._action,m=Ember._action,h=class extends t.default{constructor(...e){super(...e),j(this,"ajax",b,this),j(this,"billing",f,this),j(this,"configManager",g,this),j(this,"ghostPaths",v,this),j(this,"limit",y,this),j(this,"notifications",w,this),j(this,"session",E,this),j(this,"stateBridge",k,this),j(this,"config",P,this),j(this,"isOwner",_,this)}willDestroy(){super.willDestroy(...arguments),window.removeEventListener("message",this.handleIframeMessage)}setup(){this.billing.setBillingIframeSrc(),this.billing.startBillingAppLoadMonitor(),window.addEventListener("message",this.handleIframeMessage)}async handleIframeMessage(e){if(this.isDestroyed||this.isDestroying)return
379
+ if(!this.billing.isValidBillingIframeMessage(e))return
380
+ const t=e.data
381
+ if("billingAppReady"===t?.request)return this.billing.markBillingAppLoaded(t),void(t?.route&&this.billing.handleRouteChangeInIframe(t.route))
382
+ this.billing.recordBillingAppPreReadyMessage(t),t?.route&&this.billing.handleRouteChangeInIframe(t.route),"token"===t?.request&&this._handleTokenRequest(),"forceUpgradeInfo"===t?.request&&this._handleForceUpgradeRequest(),t?.subscription&&await this._handleSubscriptionUpdate(t)}_postMessageToBillingIframe(e){const t=this.billing.getBillingIframe()?.contentWindow,i=this.billing.getBillingAppOrigin()
383
+ t&&i&&t.postMessage(e,i)}_handleTokenRequest(){const e=()=>{this.isOwner=!1,this._postMessageToBillingIframe({request:"token",response:null})}
379
384
  if(!this.session.user?.isOwnerOnly)return void e()
380
385
  const t=this.ghostPaths.url.api("identities")
381
386
  this.ajax.request(t).then(e=>{const t=e?.identities?.[0]?.token
382
- this.billing.getBillingIframe().contentWindow.postMessage({request:"token",response:t},"*"),this.isOwner=!0}).catch(t=>{if("NoPermissionError"!==t.payload?.errors?.[0]?.type)throw t
387
+ this._postMessageToBillingIframe({request:"token",response:t}),this.isOwner=!0}).catch(t=>{if("NoPermissionError"!==t.payload?.errors?.[0]?.type)throw t
383
388
  e()})}_handleForceUpgradeRequest(){let e=null
384
389
  const t=this.billing.ownerUser
385
- t&&(e={name:t?.name,email:t?.email}),this.billing.getBillingIframe().contentWindow.postMessage({request:"forceUpgradeInfo",response:{forceUpgrade:this.config.hostSettings?.forceUpgrade,isOwner:this.isOwner,ownerUser:e}},"*")}async _handleSubscriptionUpdate(e){try{await this.configManager.fetch()}catch(t){}if(this.limit.reload(),this.stateBridge.triggerSubscriptionChange(e),window?.adminXQueryClient?.invalidateQueries&&"function"==typeof window.adminXQueryClient.invalidateQueries)try{window.adminXQueryClient.refetchQueries({queryKey:["ConfigResponseType"]}).catch(()=>{}),window.adminXQueryClient.refetchQueries({queryKey:["SettingsResponseType"]}).catch(()=>{})}catch(i){window.adminXQueryClient.refetchQueries(["ConfigResponseType"]).catch(()=>{}),window.adminXQueryClient.refetchQueries(["SettingsResponseType"]).catch(()=>{})}if(this.billing.subscription=e.subscription,this.billing.checkoutRoute=e?.checkoutRoute??"/plans","active"===e.subscription.status&&this.config.hostSettings?.forceUpgrade&&(this.config.hostSettings.forceUpgrade=!1),"past_due"===e.subscription.status||"unpaid"===e.subscription.status?this.notifications.showAlert(Ember.String.htmlSafe(`Your billing details need updating. The site owner must <a href="${this.billing.billingRouteRoot}">update payment information</a> to avoid suspension.`),{type:"error",key:"billing.overdue"}):this.notifications.closeAlerts("billing.overdue"),e?.exceededLimits&&e?.exceededLimits.length&&e?.exceededLimits.indexOf("members")>=0&&e?.checkoutRoute){const e=this.billing.billingRouteRoot+"?action=checkout"
390
+ t&&(e={name:t?.name,email:t?.email}),this._postMessageToBillingIframe({request:"forceUpgradeInfo",response:{forceUpgrade:this.config.hostSettings?.forceUpgrade,isOwner:this.isOwner,ownerUser:e}})}async _handleSubscriptionUpdate(e){try{await this.configManager.fetch()}catch(t){}if(this.limit.reload(),this.stateBridge.triggerSubscriptionChange(e),window?.adminXQueryClient?.invalidateQueries&&"function"==typeof window.adminXQueryClient.invalidateQueries)try{window.adminXQueryClient.refetchQueries({queryKey:["ConfigResponseType"]}).catch(()=>{}),window.adminXQueryClient.refetchQueries({queryKey:["SettingsResponseType"]}).catch(()=>{})}catch(i){window.adminXQueryClient.refetchQueries(["ConfigResponseType"]).catch(()=>{}),window.adminXQueryClient.refetchQueries(["SettingsResponseType"]).catch(()=>{})}if(this.billing.subscription=e.subscription,this.billing.checkoutRoute=e?.checkoutRoute??"/plans","active"===e.subscription.status&&this.config.hostSettings?.forceUpgrade&&(this.config.hostSettings.forceUpgrade=!1),"past_due"===e.subscription.status||"unpaid"===e.subscription.status?this.notifications.showAlert(Ember.String.htmlSafe(`Your billing details need updating. The site owner must <a href="${this.billing.billingRouteRoot}">update payment information</a> to avoid suspension.`),{type:"error",key:"billing.overdue"}):this.notifications.closeAlerts("billing.overdue"),e?.exceededLimits&&e?.exceededLimits.length&&e?.exceededLimits.indexOf("members")>=0&&e?.checkoutRoute){const e=this.billing.billingRouteRoot+"?action=checkout"
386
391
  this.notifications.showAlert(Ember.String.htmlSafe(`Your audience has grown! To continue publishing, the site owner must <a href="${e}">confirm pricing for this number of members</a>.`),{type:"warn",key:"billing.exceeded"})}else this.notifications.closeAlerts("billing.exceeded")}},b=O(h.prototype,"ajax",[r],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),f=O(h.prototype,"billing",[n],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),g=O(h.prototype,"configManager",[a],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),v=O(h.prototype,"ghostPaths",[s],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),y=O(h.prototype,"limit",[o],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),w=O(h.prototype,"notifications",[l],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),E=O(h.prototype,"session",[u],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),k=O(h.prototype,"stateBridge",[c],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),P=O(h.prototype,"config",[i.inject],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),_=O(h.prototype,"isOwner",[d],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),O(h.prototype,"setup",[p],Object.getOwnPropertyDescriptor(h.prototype,"setup"),h.prototype),O(h.prototype,"handleIframeMessage",[m],Object.getOwnPropertyDescriptor(h.prototype,"handleIframeMessage"),h.prototype),h)
387
392
  Ember._setComponentTemplate(T,z)}),define("ghost-admin/components/gh-billing-modal",["exports","@glimmer/component"],function(e,t){var i,r,n
388
393
  Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
@@ -3057,33 +3062,43 @@ let s=y.test(n.url),o=this.get("session.isAuthenticated"),l=this.isUnauthorizedE
3057
3062
  return s&&(this._responseServer=i.server),o&&s&&(l||u&&"Authorization failed"===r.errors?.[0].message)&&(this.skipSessionDeletion=!0,this.session.invalidate()),super.handleResponse(...arguments)}normalizeErrorResponse(e,t,i){if(i&&"object"==typeof i){let e=i.error||i.errors||i.message||void 0
3058
3063
  e&&(Ember.isArray(e)||(e=[e]),i.errors=e.map(function(e){return"string"==typeof e?{message:e}:e}))}return super.normalizeErrorResponse(e,t,i)}isTwoFactorTokenRequiredError(e,t,i){return B(e,i)}isVersionMismatchError(e,t,i){return k(e,i)}isServerUnreachableError(e){return O(e)}isRequestEntityTooLargeError(e){return z(e)}isUnsupportedMediaTypeError(e){return S(e)}isDataImportError(e){return _(e)}isMaintenanceError(e,t,i){return D(e)}isThemeValidationError(e,t,i){return I(e,i)}isHostLimitError(e,t,i){return R(e,i)}isEmailError(e,t,i){return U(e,i)}isAcceptedResponse(e){return V(e)}},p=v(d.prototype,"feature",[l],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),m=v(d.prototype,"session",[u],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),h=v(d.prototype,"upgradeStatus",[c],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),b=v(d.prototype,"config",[s.inject],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),d)
3059
3064
  q.reopen({contentType:"application/json; charset=UTF-8"})
3060
- e.default=q}),define("ghost-admin/services/billing",["exports","@sentry/ember","ghost-admin/decorators/inject"],function(e,t,i){var r,n,a,s,o,l,u,c,d,p,m,h,b,f,g,v,y,w,E,k,P,_
3061
- function j(e,t,i,r){i&&Object.defineProperty(e,t,{enumerable:i.enumerable,configurable:i.configurable,writable:i.writable,value:i.initializer?i.initializer.call(r):void 0})}function O(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e
3065
+ e.default=q}),define("ghost-admin/services/billing",["exports","@sentry/ember","ghost-admin/decorators/inject"],function(e,t,i){var r,n,a,s,o,l,u,c,d,p,m,h,b,f,g,v,y,w,E,k,P,_,j,O,T,z,x,S,C,M,D,A
3066
+ function I(e,t,i,r){i&&Object.defineProperty(e,t,{enumerable:i.enumerable,configurable:i.configurable,writable:i.writable,value:i.initializer?i.initializer.call(r):void 0})}function L(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e
3062
3067
  var i=e[Symbol.toPrimitive]
3063
3068
  if(void 0!==i){var r=i.call(e,t||"default")
3064
3069
  if("object"!=typeof r)return r
3065
3070
  throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string")
3066
- return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function T(e,t,i,r,n){var a={}
3071
+ return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function R(e,t,i,r,n){var a={}
3067
3072
  return Object.keys(r).forEach(function(e){a[e]=r[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=i.slice().reverse().reduce(function(i,r){return r(e,t,i)||i},a),n&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(n):void 0,a.initializer=void 0),void 0===a.initializer?(Object.defineProperty(e,t,a),null):a}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
3068
- const z=[1e3]
3069
- e.default=(r=Ember.inject.service,n=Ember.inject.service,a=Ember.inject.service,s=Ember._tracked,o=Ember._tracked,l=Ember._tracked,u=Ember._tracked,c=Ember._tracked,d=Ember._tracked,p=Ember._tracked,m=class extends Ember.Service{constructor(){super(...arguments),j(this,"ghostPaths",h,this),j(this,"router",b,this),j(this,"store",f,this),j(this,"config",g,this),O(this,"billingRouteRoot","#/pro"),j(this,"billingWindowOpen",v,this),j(this,"subscription",y,this),j(this,"previousRoute",w,this),j(this,"action",E,this),j(this,"ownerUser",k,this),j(this,"billingAppLoaded",P,this),j(this,"billingAppLoadFailureReported",_,this),O(this,"billingAppLoadTimeout",null),O(this,"billingAppRetryTimeout",null),O(this,"billingAppLoadAttempts",0),O(this,"billingAppLoadTimeoutMs",1e4),O(this,"billingAppLoadRetryDelaysMs",z),O(this,"billingAppIframeSrcSetAt",null),O(this,"billingAppIframeLoadFired",!1),O(this,"_loadListenerAttachedTo",null),this.config.hostSettings?.billing?.url&&window.addEventListener("message",e=>{e&&e.data&&e.data.route&&this.handleRouteChangeInIframe(e.data.route)})}willDestroy(){super.willDestroy(...arguments),this.clearBillingAppLoadMonitor()}handleRouteChangeInIframe(e){if(this.billingWindowOpen){let t=this.billingRouteRoot
3070
- "/"!==e&&(t+=e),window.location.hash!==t&&window.history.replaceState(window.history.state,"",t)}}_isBillingIframeLoaded(){return null!==this.getBillingIframe()&&this.getBillingIframe().contentWindow}startBillingAppLoadMonitor(){this.billingAppLoadTimeout||this.billingAppRetryTimeout||((this.billingAppLoaded||this.billingAppLoadFailureReported)&&(this.billingAppLoaded=!1,this.billingAppLoadAttempts=0,this.billingAppLoadFailureReported=!1),this.billingAppLoadAttempts+=1,this.billingAppLoadTimeout=setTimeout(()=>{this.billingAppLoadTimeout=null,this.handleBillingAppLoadTimeout()},this.billingAppLoadTimeoutMs))}handleBillingAppLoadTimeout(){const e=this.billingAppLoadRetryDelaysMs[this.billingAppLoadAttempts-1]
3073
+ const N=[1e3]
3074
+ e.default=(r=Ember.inject.service,n=Ember.inject.service,a=Ember.inject.service,s=Ember._tracked,o=Ember._tracked,l=Ember._tracked,u=Ember._tracked,c=Ember._tracked,d=Ember._tracked,p=Ember._tracked,m=Ember._tracked,h=Ember._tracked,b=Ember._tracked,f=Ember._tracked,g=Ember._tracked,v=class extends Ember.Service{constructor(...e){super(...e),I(this,"ghostPaths",y,this),I(this,"router",w,this),I(this,"store",E,this),I(this,"config",k,this),L(this,"billingRouteRoot","#/pro"),I(this,"billingWindowOpen",P,this),I(this,"subscription",_,this),I(this,"previousRoute",j,this),I(this,"action",O,this),I(this,"ownerUser",T,this),I(this,"billingAppLoaded",z,this),I(this,"billingAppLoadFailureReported",x,this),I(this,"billingAppPreReadyMessageCount",S,this),I(this,"billingAppPreReadyMessageTypes",C,this),I(this,"billingAppLastPreReadyMessageType",M,this),I(this,"billingAppReadyReceivedAt",D,this),I(this,"billingAppReadyPayload",A,this),L(this,"billingAppLoadTimeout",null),L(this,"billingAppRetryTimeout",null),L(this,"billingAppLoadAttempts",0),L(this,"billingAppLoadTimeoutMs",1e4),L(this,"billingAppLoadRetryDelaysMs",N),L(this,"billingAppIframeSrcSetAt",null),L(this,"billingAppIframeLoadFired",!1),L(this,"_loadListenerAttachedTo",null)}willDestroy(){super.willDestroy(...arguments),this.clearBillingAppLoadMonitor()}handleRouteChangeInIframe(e){if(this.billingWindowOpen){let t=this.billingRouteRoot
3075
+ "/"!==e&&(t+=e),window.location.hash!==t&&window.history.replaceState(window.history.state,"",t)}}_isBillingIframeLoaded(){return null!==this.getBillingIframe()&&this.getBillingIframe().contentWindow}startBillingAppLoadMonitor(){this.billingAppLoadTimeout||this.billingAppRetryTimeout||((this.billingAppLoaded||this.billingAppLoadFailureReported)&&(this.billingAppLoaded=!1,this.billingAppLoadAttempts=0,this.billingAppLoadFailureReported=!1,this.resetBillingAppLoadDiagnostics()),this.billingAppLoadAttempts+=1,this.billingAppLoadTimeout=setTimeout(()=>{this.billingAppLoadTimeout=null,this.handleBillingAppLoadTimeout()},this.billingAppLoadTimeoutMs))}handleBillingAppLoadTimeout(){const e=this.billingAppLoadRetryDelaysMs[this.billingAppLoadAttempts-1]
3071
3076
  void 0===e?this.reportBillingAppLoadFailure():this.billingAppRetryTimeout=setTimeout(()=>{this.billingAppRetryTimeout=null,this.reloadBillingIframe(),this.startBillingAppLoadMonitor()},e)}setBillingIframeSrc(){const e=this.getBillingIframe()
3072
- e&&(this._loadListenerAttachedTo!==e&&"function"==typeof e.addEventListener&&(e.addEventListener("load",()=>{this.billingAppIframeLoadFired=!0}),this._loadListenerAttachedTo=e),this.billingAppIframeLoadFired=!1,this.billingAppIframeSrcSetAt=Date.now(),e.src=this.getIframeURL())}reloadBillingIframe(){this.getBillingIframe()&&!this.billingAppLoaded&&this.setBillingIframeSrc()}markBillingAppLoaded(){this.billingAppLoaded=!0,this.clearBillingAppLoadMonitor()}clearBillingAppLoadMonitor(){this.billingAppLoadTimeout&&(clearTimeout(this.billingAppLoadTimeout),this.billingAppLoadTimeout=null),this.billingAppRetryTimeout&&(clearTimeout(this.billingAppRetryTimeout),this.billingAppRetryTimeout=null)}reportBillingAppLoadFailure(){if(this.billingAppLoadFailureReported)return
3077
+ e&&(this._loadListenerAttachedTo!==e&&"function"==typeof e.addEventListener&&(e.addEventListener("load",()=>{this.billingAppIframeLoadFired=!0}),this._loadListenerAttachedTo=e),this.billingAppIframeLoadFired=!1,this.billingAppIframeSrcSetAt=Date.now(),this.resetBillingAppLoadDiagnostics(),e.src=this.getIframeURL())}reloadBillingIframe(){this.getBillingIframe()&&!this.billingAppLoaded&&this.setBillingIframeSrc()}markBillingAppLoaded(e=null){this.billingAppLoaded=!0,this.billingAppLoadFailureReported=!1,this.billingAppReadyReceivedAt=Date.now(),this.billingAppReadyPayload=e,this.clearBillingAppLoadMonitor()}resetBillingAppLoadDiagnostics(){this.billingAppPreReadyMessageCount=0,this.billingAppPreReadyMessageTypes=[],this.billingAppLastPreReadyMessageType=null,this.billingAppReadyReceivedAt=null,this.billingAppReadyPayload=null}recordBillingAppPreReadyMessage(e){if(this.billingAppLoaded||this.billingAppReadyReceivedAt||this.billingAppLoadFailureReported)return
3078
+ if(!this.billingAppLoadTimeout&&!this.billingAppRetryTimeout)return
3079
+ const t=this.getBillingAppMessageType(e)
3080
+ this.billingAppPreReadyMessageCount+=1,this.billingAppLastPreReadyMessageType=t,this.billingAppPreReadyMessageTypes.includes(t)||(this.billingAppPreReadyMessageTypes=[...this.billingAppPreReadyMessageTypes,t])}getBillingAppMessageType(e){return e?.request?e.request:e?.route?"route":e?.subscription?"subscription":e?.query?e.query:"unknown"}getBillingAppOrigin(){const e=this.getIframeURL({fetchOwner:!1})
3081
+ if(!e)return null
3082
+ try{return new URL(e).origin}catch(t){return null}}isValidBillingIframeMessage(e){if(!e?.data)return!1
3083
+ const t=this.getBillingAppOrigin()
3084
+ if(!t||e.origin!==t)return!1
3085
+ const i=this.getBillingIframe()?.contentWindow
3086
+ return!!i&&e.source===i}clearBillingAppLoadMonitor(){this.billingAppLoadTimeout&&(clearTimeout(this.billingAppLoadTimeout),this.billingAppLoadTimeout=null),this.billingAppRetryTimeout&&(clearTimeout(this.billingAppRetryTimeout),this.billingAppRetryTimeout=null)}reportBillingAppLoadFailure(){if(this.billingAppLoadFailureReported)return
3073
3087
  if(this.billingAppLoadFailureReported=!0,!this.config.sentry_dsn)return
3074
- const e=this.getBillingIframe(),i=document.visibilityState
3075
- let r=!1,n=!1,a=!1
3088
+ const e=this.getBillingIframe(),i=document.visibilityState,r=e?.src||null,n=this.getBillingAppOrigin()
3089
+ let a=!1,s=!1,o=!1
3076
3090
  try{const t=e?.contentWindow?.__bmaBoot
3077
- r=null!=t,n="function"==typeof t?.markReady}catch(c){a=!0}let s=null,o=null,l=null,u=null
3091
+ a=null!=t,s="function"==typeof t?.markReady}catch(p){o=!0}let l=null,u=null,c=null,d=null
3078
3092
  if(e)try{const t=window.getComputedStyle(e)
3079
- s=t.display,o=t.visibility
3093
+ l=t.display,u=t.visibility
3080
3094
  const i=e.getBoundingClientRect()
3081
- l=i.width,u=i.height}catch(c){}t.captureException("Billing app failed to become ready",{level:"warning",fingerprint:["billing-app-load-failure",i,String(this.billingAppLoadAttempts)],contexts:{ghost:{billing_monitor:{attempts:this.billingAppLoadAttempts,has_billing_url:!!this.config.hostSettings?.billing?.url,is_force_upgrade:!!this.config.hostSettings?.forceUpgrade,location_hash:window.location.hash,retry_delays_ms:this.billingAppLoadRetryDelaysMs,document_visibility_state:i,iframe_offset_parent_visible:e?null!==e.offsetParent:null,iframe_computed_display:s,iframe_computed_visibility:o,iframe_rect_width:l,iframe_rect_height:u,iframe_load_fired:this.billingAppIframeLoadFired,ms_since_src_set:this.billingAppIframeSrcSetAt?Date.now()-this.billingAppIframeSrcSetAt:null,navigator_online:navigator.onLine,connection_effective_type:navigator.connection?.effectiveType??null,bma_boot_accessible:r,bma_boot_has_mark_ready:n,bma_boot_threw:a,billing_window_open:this.billingWindowOpen}}},tags:{source:"billing-app-load-monitor",route:this.router.currentRouteName,path:window.location.hash}})}getIframeURL(){this.getOwnerUser()
3082
- let e=this.config.hostSettings?.billing?.url
3083
- if(window.location.hash&&window.location.hash.includes(this.billingRouteRoot)){let t=window.location.hash.replace(this.billingRouteRoot,"")
3084
- t&&(e+=t)}return e}async getOwnerUser(){if(!this.ownerUser){let e=this.store.peekAll("user").findBy("isOwnerOnly",!0)
3095
+ c=i.width,d=i.height}catch(p){}t.captureException("Billing app failed to become ready",{level:"warning",fingerprint:["billing-app-load-failure",i,String(this.billingAppLoadAttempts)],contexts:{ghost:{billing_monitor:{attempts:this.billingAppLoadAttempts,has_billing_url:!!this.config.hostSettings?.billing?.url,is_force_upgrade:!!this.config.hostSettings?.forceUpgrade,location_hash:window.location.hash,retry_delays_ms:this.billingAppLoadRetryDelaysMs,iframe_src:r,configured_billing_origin:n,document_visibility_state:i,iframe_offset_parent_visible:e?null!==e.offsetParent:null,iframe_computed_display:l,iframe_computed_visibility:u,iframe_rect_width:c,iframe_rect_height:d,iframe_load_fired:this.billingAppIframeLoadFired,ms_since_src_set:this.billingAppIframeSrcSetAt?Date.now()-this.billingAppIframeSrcSetAt:null,non_ready_message_count:this.billingAppPreReadyMessageCount,non_ready_message_types:this.billingAppPreReadyMessageTypes.join(","),last_non_ready_message_type:this.billingAppLastPreReadyMessageType,ready_received:!1,navigator_online:navigator.onLine,connection_effective_type:navigator.connection?.effectiveType??null,bma_boot_accessible:a,bma_boot_has_mark_ready:s,bma_boot_threw:o,billing_window_open:this.billingWindowOpen}}},tags:{source:"billing-app-load-monitor",route:this.router.currentRouteName,path:window.location.hash}})}getIframeURL(e={}){const{fetchOwner:t=!0}=e
3096
+ t&&this.getOwnerUser()
3097
+ let i=this.config.hostSettings?.billing?.url
3098
+ if(window.location.hash&&window.location.hash.includes(this.billingRouteRoot)){let e=window.location.hash.replace(this.billingRouteRoot,"")
3099
+ e&&(i+=e)}return i}async getOwnerUser(){if(!this.ownerUser){let e=this.store.peekAll("user").findBy("isOwnerOnly",!0)
3085
3100
  e||(await this.store.findAll("user",{reload:!0}),e=this.store.peekAll("user").findBy("isOwnerOnly",!0)),this.ownerUser=e}return this.ownerUser}sendRouteUpdate(){const e=this.action
3086
- e&&("checkout"===e&&this._isBillingIframeLoaded()&&this.getBillingIframe().contentWindow.postMessage({query:"routeUpdate",response:this.checkoutRoute},"*"),this.action=null)}sendUpdateLimits(){this._isBillingIframeLoaded()&&this.getBillingIframe().contentWindow.postMessage({query:"limitUpdate"},"*")}toggleProWindow(e){this.billingWindowOpen&&e&&!this.action||(this.sendRouteUpdate(),this.billingWindowOpen=e)}openBillingWindow(e,t){this.getOwnerUser(),this.billingWindowOpen||(this.previousRoute=e,window.location.hash=t||"/pro",this.sendRouteUpdate(),this.sendUpdateLimits(),this.router.transitionTo(t||"/pro"))}getBillingIframe(){return document.getElementById("billing-frame")}},h=T(m.prototype,"ghostPaths",[r],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),b=T(m.prototype,"router",[n],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),f=T(m.prototype,"store",[a],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),g=T(m.prototype,"config",[i.inject],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),v=T(m.prototype,"billingWindowOpen",[s],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),y=T(m.prototype,"subscription",[o],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),w=T(m.prototype,"previousRoute",[l],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),E=T(m.prototype,"action",[u],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),k=T(m.prototype,"ownerUser",[c],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),P=T(m.prototype,"billingAppLoaded",[d],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),_=T(m.prototype,"billingAppLoadFailureReported",[p],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),m)}),define("ghost-admin/services/clock",["exports","ghost-admin/config/environment","moment-timezone"],function(e,t,i){function r(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e
3101
+ e&&("checkout"===e&&this._isBillingIframeLoaded()&&this.getBillingIframe().contentWindow.postMessage({query:"routeUpdate",response:this.checkoutRoute},"*"),this.action=null)}sendUpdateLimits(){this._isBillingIframeLoaded()&&this.getBillingIframe().contentWindow.postMessage({query:"limitUpdate"},"*")}toggleProWindow(e){this.billingWindowOpen&&e&&!this.action||(this.sendRouteUpdate(),this.billingWindowOpen=e)}openBillingWindow(e,t){this.getOwnerUser(),this.billingWindowOpen||(this.previousRoute=e,window.location.hash=t||"/pro",this.sendRouteUpdate(),this.sendUpdateLimits(),this.router.transitionTo(t||"/pro"))}getBillingIframe(){return document.getElementById("billing-frame")}},y=R(v.prototype,"ghostPaths",[r],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),w=R(v.prototype,"router",[n],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),E=R(v.prototype,"store",[a],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),k=R(v.prototype,"config",[i.inject],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),P=R(v.prototype,"billingWindowOpen",[s],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),_=R(v.prototype,"subscription",[o],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),j=R(v.prototype,"previousRoute",[l],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),O=R(v.prototype,"action",[u],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),T=R(v.prototype,"ownerUser",[c],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),z=R(v.prototype,"billingAppLoaded",[d],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),x=R(v.prototype,"billingAppLoadFailureReported",[p],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),S=R(v.prototype,"billingAppPreReadyMessageCount",[m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),C=R(v.prototype,"billingAppPreReadyMessageTypes",[h],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),M=R(v.prototype,"billingAppLastPreReadyMessageType",[b],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),D=R(v.prototype,"billingAppReadyReceivedAt",[f],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),A=R(v.prototype,"billingAppReadyPayload",[g],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),v)}),define("ghost-admin/services/clock",["exports","ghost-admin/config/environment","moment-timezone"],function(e,t,i){function r(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e
3087
3102
  var i=e[Symbol.toPrimitive]
3088
3103
  if(void 0!==i){var r=i.call(e,t||"default")
3089
3104
  if("object"!=typeof r)return r
@@ -3857,6 +3872,6 @@ this.passwordChange(e),e.hasValidated.addObject("password"),Ember.isBlank(t)&&(e
3857
3872
  e.default=n.create()}),define("ghost-admin/validators/webhook",["exports","ghost-admin/validators/base","validator"],function(e,t,i){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
3858
3873
  e.default=t.default.create({properties:["name","event","targetUrl","secret"],name(e){Ember.isBlank(e.name)?(e.errors.add("name","Please enter a name"),e.hasValidated.pushObject("name"),this.invalidate()):i.default.isLength(e.name,{max:191})||(e.errors.add("name","Name is too long, max 191 chars"),e.hasValidated.pushObject("name"),this.invalidate())},event(e){Ember.isBlank(e.event)&&(e.errors.add("event","Please select an event"),e.hasValidated.pushObject("event"),this.invalidate())},targetUrl(e){Ember.isBlank(e.targetUrl)?e.errors.add("targetUrl","Please enter a target URL"):i.default.isURL(e.targetUrl||"",{require_protocol:!1})?i.default.isLength(e.targetUrl,{max:2e3})||e.errors.add("targetUrl","Target URL is too long, max 2000 chars"):e.errors.add("targetUrl","Please enter a valid URL"),e.hasValidated.pushObject("targetUrl"),e.errors.has("targetUrl")&&this.invalidate()},secret(e){Ember.isBlank(e.secret)||i.default.isLength(e.secret,{max:191})||(e.errors.add("secret","Secret is too long, max 191 chars"),e.hasValidated.pushObject("secret"),this.invalidate())}})}),define("ghost-admin/views/application",["exports"],function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
3859
3874
  e.default=Ember.Component.extend({})}),define("ghost-admin/config/environment",[],function(){try{var e="ghost-admin/config/environment",t=document.querySelector('meta[name="'+e+'"]').getAttribute("content"),i={default:JSON.parse(decodeURIComponent(t))}
3860
- return Object.defineProperty(i,"__esModule",{value:!0}),i}catch(r){throw new Error('Could not read config from meta tag with name "'+e+'".')}}),runningTests||require("ghost-admin/app").default.create({version:"6.40",name:"ghost-admin"})
3875
+ return Object.defineProperty(i,"__esModule",{value:!0}),i}catch(r){throw new Error('Could not read config from meta tag with name "'+e+'".')}}),runningTests||require("ghost-admin/app").default.create({version:"6.41",name:"ghost-admin"})
3861
3876
 
3862
- //# sourceMappingURL=ghost-e98e961273da0ea7999a194fbc151b85.map
3877
+ //# sourceMappingURL=ghost-89bbc366aa0848082773de4a119a8b09.map
@@ -1 +1 @@
1
- import{aZ as G,j as s,B as O,b2 as _,t as D,c0 as z,bU as Z,bV as X,bW as Y,bX as q,bY as I,bZ as J,G as Q,ao as b,r as g,u as ss,S as E,a$ as L,b_ as es,c1 as rs}from"./index-CFEzD2_M.js";import{E as P}from"./empty-indicator-2Pjmce3n.js";import{A as as,W as ts,C as ns}from"./wallet-cards-B9TQg4x3.js";import{S as W}from"./source-icon-DeeHyZRn.js";import{p as os,e as cs}from"./source-utils-B1S3ZHA2.js";import{C as N,a as S,b as C,g as v,c as w,h as is,T as ls}from"./pagemenu-TxGvHwRO.js";import{T as ds,a as ms,b as H,c as f,d as hs,e as y}from"./table-DTofVyjA.js";import{K as M,d as A,a as k,b as T,c as $}from"./kpi-card-BP-2yicn.js";import{P as xs,a as ps}from"./post-analytics-header-Bm0mcxjK.js";import{b as us}from"./member-route-ZLy3opLv.js";import{u as js}from"./post-analytics-context-BWDhMRq_.js";import{g as R}from"./currency-fEUUCkj0.js";import{c as bs,d as gs,a as fs}from"./stats-BVKNZJO6.js";const ys=({className:n})=>{const t=G();return s.jsx(P,{actions:s.jsx(O,{variant:"outline",onClick:()=>t("/settings/analytics",{crossApp:!0}),children:"Open settings"}),className:n,description:"Enable member source tracking in settings to see which content drives member growth.",title:"Member sources have been disabled",children:s.jsx(as,{})})},K="https://www.google.com/s2/favicons?domain=ghost.org&sz=64",F=({headerStyle:n="table",children:t="Source",data:m,mode:r,defaultSourceIconUrl:a=K})=>{const{appSettings:c}=_();if(r==="growth")return s.jsxs(ds,{children:[s.jsx(ms,{children:s.jsxs(H,{children:[s.jsx(f,{className:"min-w-[320px]",variant:n==="table"?"default":"cardhead",children:t}),s.jsx(f,{className:"w-[110px] text-right",children:"Free members"}),c?.paidMembersEnabled&&s.jsxs(s.Fragment,{children:[s.jsx(f,{className:"w-[110px] text-right",children:"Paid members"}),s.jsx(f,{className:"w-[100px] text-right",children:"MRR impact"})]})]})}),s.jsx(hs,{children:m?.map(e=>{const h=o=>Math.round(o/100);return s.jsxs(H,{className:"last:border-none",children:[s.jsx(y,{children:e.linkUrl?s.jsxs("a",{className:"group flex items-center gap-2",href:e.linkUrl,rel:"noreferrer",target:"_blank",children:[s.jsx(W,{defaultSourceIconUrl:a,displayName:e.displayName,iconSrc:e.iconSrc}),s.jsx("span",{className:"group-hover:underline",children:e.displayName})]}):s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(W,{defaultSourceIconUrl:a,displayName:e.displayName,iconSrc:e.iconSrc}),s.jsx("span",{children:e.displayName})]})}),s.jsxs(y,{className:"text-right font-mono text-sm",children:["+",b(e.free_members||0)]}),c?.paidMembersEnabled&&s.jsxs(s.Fragment,{children:[s.jsxs(y,{className:"text-right font-mono text-sm",children:["+",b(e.paid_members||0)]}),s.jsxs(y,{className:"text-right font-mono text-sm",children:["+$",b(h(e.mrr||0))]})]})]},e.source)})})]})},Ns=({title:n="Top sources",description:t,data:m,mode:r="visits",range:a=30,totalVisitors:c=0,siteUrl:e,siteIcon:h,defaultSourceIconUrl:o=K,getPeriodText:i,className:u})=>{const{appSettings:p}=_(),l=D.useMemo(()=>os({data:m,mode:r,siteUrl:e,siteIcon:h,defaultSourceIconUrl:o}),[m,e,h,r,o]),d=D.useMemo(()=>cs({processedData:l,totalVisitors:c,mode:r}),[l,c,r]),x=d.slice(0,10),j=t||(r==="growth"?"Where did your growth come from?":`How readers found your ${a?"site":"post"}${a&&i?` ${i(a)}`:""}`),B=r==="growth"?"Sources":"Top sources",V=r==="growth"?"Where did your growth come from?":`How readers found your ${a?"site":"post"}${a&&i?` ${i(a)}`:""}`;return s.jsxs(N,{className:Q("group/datalist w-full max-w-[calc(100vw-64px)] overflow-x-auto sidebar:max-w-[calc(100vw-64px-280px)]",u),"data-testid":"top-sources-card",children:[x.length<=0&&s.jsxs(S,{children:[s.jsx(C,{children:n}),s.jsx(v,{children:j})]}),s.jsx(w,{children:r==="growth"&&!p?.analytics.membersTrackSources?s.jsx(ys,{className:"py-10"}):x.length>0?s.jsx(F,{data:x,defaultSourceIconUrl:o,getPeriodText:i,headerStyle:"card",mode:r,range:a,children:s.jsxs(S,{children:[s.jsx(C,{children:n}),s.jsx(v,{children:j})]})}):s.jsx("div",{className:"py-20 text-center text-sm text-gray-700",children:s.jsx(P,{className:"h-full",description:r==="growth"&&"Once someone signs up on this post, sources will show here",title:`No sources data available ${i?i(a):""}`,children:s.jsx(z,{strokeWidth:1.5})})})}),d.length>10&&s.jsx(is,{children:s.jsxs(Z,{children:[s.jsx(X,{asChild:!0,children:s.jsxs(O,{variant:"outline",children:["View all ",s.jsx(ls,{})]})}),s.jsxs(Y,{className:"overflow-y-auto pt-0 sm:max-w-[600px]",children:[s.jsxs(q,{className:"sticky top-0 z-40 -mx-6 bg-background/60 p-6 backdrop-blur",children:[s.jsx(I,{children:B}),s.jsx(J,{children:V})]}),s.jsx("div",{className:"group/datalist",children:s.jsx(F,{data:d,defaultSourceIconUrl:o,getPeriodText:i,mode:r,range:a})})]})]})})]})},ws=n=>{const{data:t,isLoading:m}=bs(n),{data:r,isLoading:a}=gs(n),{data:c,isLoading:e}=fs(),h=g.useMemo(()=>t?.stats||[],[t]),o=g.useMemo(()=>r?.stats.length===0?{free_members:0,paid_members:0,mrr:0}:r?.stats[0],[r]),{selectedCurrency:i,currencySymbol:u}=g.useMemo(()=>{if(c?.stats&&c?.meta?.totals){const l=c.meta.totals;let d=l[0];if(!d)return{selectedCurrency:"usd",currencySymbol:R("usd")};for(const j of l)j.mrr>d.mrr&&(d=j);const x=d.currency;return{selectedCurrency:x,currencySymbol:R(x)}}return{selectedCurrency:"usd",currencySymbol:R("usd")}},[c]);return{isLoading:g.useMemo(()=>m||a||e,[m,a,e]),stats:h,totals:o,selectedCurrency:i,currencySymbol:u}},U=n=>Math.round(n/100),Ss=()=>{const{data:n}=js(),{postId:t}=ss(),{stats:m,totals:r,isLoading:a,currencySymbol:c}=ws(t||""),{appSettings:e}=_(),h=G(),o=d=>h(us({filter:d}),{crossApp:!0}),i=n?.url,u=n?.icon;let p="flex flex-col items-stretch gap-6",l="";return e?.paidMembersEnabled||(p="grid grid-cols-1 border rounded-md",l="border-none hover:shadow-none"),s.jsxs(s.Fragment,{children:[s.jsx(xs,{currentTab:"Growth"}),s.jsx(ps,{children:a?s.jsxs("div",{className:p,children:[s.jsx(N,{className:l,children:s.jsx(w,{className:"grid grid-cols-3 p-0",children:Array.from({length:3},(d,x)=>s.jsxs("div",{className:"h-[98px] gap-1 border-r px-6 py-5 last:border-r-0",children:[s.jsx(E,{className:"w-2/3"}),s.jsx(E,{className:"h-7 w-12"})]},x))})}),s.jsxs(N,{className:l,children:[s.jsxs(S,{children:[s.jsx(C,{children:"Top sources"}),s.jsx(v,{children:"Where did your growth come from?"})]}),s.jsxs(w,{children:[s.jsx(L,{}),s.jsx(es,{className:"pt-6"})]})]})]}):s.jsxs("div",{className:p,children:[s.jsxs(N,{className:l,"data-testid":"members-card",children:[s.jsxs(S,{className:"hidden",children:[s.jsx(C,{children:"Newsletters"}),s.jsx(v,{children:"How did this post perform"})]}),s.jsx(w,{className:"p-0",children:s.jsxs("div",{className:`flex flex-col md:grid md:items-stretch ${e?.paidMembersEnabled?"md:grid-cols-3":"md:grid-cols-1"}`,children:[s.jsxs(M,{className:"grow",children:[s.jsx(A,{onClick:()=>{o(`signup:'${t}'+conversion:-'${t}'`)},children:"View members →"}),s.jsxs(k,{onClick:()=>{o(`signup:'${t}'+conversion:-'${t}'`)},children:[s.jsx(rs,{strokeWidth:1.5}),"Free members"]}),s.jsx(T,{children:s.jsx($,{children:b(r?.free_members||0)})})]}),e?.paidMembersEnabled&&s.jsxs(s.Fragment,{children:[s.jsxs(M,{className:"grow",children:[s.jsx(A,{onClick:()=>{o(`conversion:'${t}'`)},children:"View members →"}),s.jsxs(k,{onClick:()=>{o(`conversion:'${t}'`)},children:[s.jsx(ts,{strokeWidth:1.5}),"Paid members"]}),s.jsx(T,{children:s.jsx($,{children:b(r?.paid_members||0)})})]}),s.jsxs(M,{className:"grow",children:[s.jsxs(k,{children:[s.jsx(ns,{strokeWidth:1.5}),"MRR"]}),s.jsx(T,{children:s.jsxs($,{children:["+",c,U(r?.mrr||0)]})})]})]})]})})]}),!e?.paidMembersEnabled&&s.jsx(L,{}),s.jsx(Ns,{className:l,data:m,mode:"growth",siteIcon:u,siteUrl:i})]})})]})},As=Object.freeze(Object.defineProperty({__proto__:null,centsToDollars:U,default:Ss},Symbol.toStringTag,{value:"Module"}));export{ys as D,U as c,As as g,ws as u};
1
+ import{aZ as G,j as s,B as O,b2 as _,t as D,c0 as z,bU as Z,bV as X,bW as Y,bX as q,bY as I,bZ as J,G as Q,ao as b,r as g,u as ss,S as E,a$ as L,b_ as es,c1 as rs}from"./index-BkbhBpVC.js";import{E as P}from"./empty-indicator-BvyaMcmw.js";import{A as as,W as ts,C as ns}from"./wallet-cards-CVZ99Nm3.js";import{S as W}from"./source-icon-Dtua85oN.js";import{p as os,e as cs}from"./source-utils-B1S3ZHA2.js";import{C as N,a as S,b as C,g as v,c as w,h as is,T as ls}from"./pagemenu-O_y8Jm4v.js";import{T as ds,a as ms,b as H,c as f,d as hs,e as y}from"./table-qQi9EXB1.js";import{K as M,d as A,a as k,b as T,c as $}from"./kpi-card-D3CzvsrI.js";import{P as xs,a as ps}from"./post-analytics-header-B8C0vA5Y.js";import{b as us}from"./member-route-ZLy3opLv.js";import{u as js}from"./post-analytics-context-D7PgEMo8.js";import{g as R}from"./currency-fEUUCkj0.js";import{c as bs,d as gs,a as fs}from"./stats-Yo9Gco0_.js";const ys=({className:n})=>{const t=G();return s.jsx(P,{actions:s.jsx(O,{variant:"outline",onClick:()=>t("/settings/analytics",{crossApp:!0}),children:"Open settings"}),className:n,description:"Enable member source tracking in settings to see which content drives member growth.",title:"Member sources have been disabled",children:s.jsx(as,{})})},K="https://www.google.com/s2/favicons?domain=ghost.org&sz=64",F=({headerStyle:n="table",children:t="Source",data:m,mode:r,defaultSourceIconUrl:a=K})=>{const{appSettings:c}=_();if(r==="growth")return s.jsxs(ds,{children:[s.jsx(ms,{children:s.jsxs(H,{children:[s.jsx(f,{className:"min-w-[320px]",variant:n==="table"?"default":"cardhead",children:t}),s.jsx(f,{className:"w-[110px] text-right",children:"Free members"}),c?.paidMembersEnabled&&s.jsxs(s.Fragment,{children:[s.jsx(f,{className:"w-[110px] text-right",children:"Paid members"}),s.jsx(f,{className:"w-[100px] text-right",children:"MRR impact"})]})]})}),s.jsx(hs,{children:m?.map(e=>{const h=o=>Math.round(o/100);return s.jsxs(H,{className:"last:border-none",children:[s.jsx(y,{children:e.linkUrl?s.jsxs("a",{className:"group flex items-center gap-2",href:e.linkUrl,rel:"noreferrer",target:"_blank",children:[s.jsx(W,{defaultSourceIconUrl:a,displayName:e.displayName,iconSrc:e.iconSrc}),s.jsx("span",{className:"group-hover:underline",children:e.displayName})]}):s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(W,{defaultSourceIconUrl:a,displayName:e.displayName,iconSrc:e.iconSrc}),s.jsx("span",{children:e.displayName})]})}),s.jsxs(y,{className:"text-right font-mono text-sm",children:["+",b(e.free_members||0)]}),c?.paidMembersEnabled&&s.jsxs(s.Fragment,{children:[s.jsxs(y,{className:"text-right font-mono text-sm",children:["+",b(e.paid_members||0)]}),s.jsxs(y,{className:"text-right font-mono text-sm",children:["+$",b(h(e.mrr||0))]})]})]},e.source)})})]})},Ns=({title:n="Top sources",description:t,data:m,mode:r="visits",range:a=30,totalVisitors:c=0,siteUrl:e,siteIcon:h,defaultSourceIconUrl:o=K,getPeriodText:i,className:u})=>{const{appSettings:p}=_(),l=D.useMemo(()=>os({data:m,mode:r,siteUrl:e,siteIcon:h,defaultSourceIconUrl:o}),[m,e,h,r,o]),d=D.useMemo(()=>cs({processedData:l,totalVisitors:c,mode:r}),[l,c,r]),x=d.slice(0,10),j=t||(r==="growth"?"Where did your growth come from?":`How readers found your ${a?"site":"post"}${a&&i?` ${i(a)}`:""}`),B=r==="growth"?"Sources":"Top sources",V=r==="growth"?"Where did your growth come from?":`How readers found your ${a?"site":"post"}${a&&i?` ${i(a)}`:""}`;return s.jsxs(N,{className:Q("group/datalist w-full max-w-[calc(100vw-64px)] overflow-x-auto sidebar:max-w-[calc(100vw-64px-280px)]",u),"data-testid":"top-sources-card",children:[x.length<=0&&s.jsxs(S,{children:[s.jsx(C,{children:n}),s.jsx(v,{children:j})]}),s.jsx(w,{children:r==="growth"&&!p?.analytics.membersTrackSources?s.jsx(ys,{className:"py-10"}):x.length>0?s.jsx(F,{data:x,defaultSourceIconUrl:o,getPeriodText:i,headerStyle:"card",mode:r,range:a,children:s.jsxs(S,{children:[s.jsx(C,{children:n}),s.jsx(v,{children:j})]})}):s.jsx("div",{className:"py-20 text-center text-sm text-gray-700",children:s.jsx(P,{className:"h-full",description:r==="growth"&&"Once someone signs up on this post, sources will show here",title:`No sources data available ${i?i(a):""}`,children:s.jsx(z,{strokeWidth:1.5})})})}),d.length>10&&s.jsx(is,{children:s.jsxs(Z,{children:[s.jsx(X,{asChild:!0,children:s.jsxs(O,{variant:"outline",children:["View all ",s.jsx(ls,{})]})}),s.jsxs(Y,{className:"overflow-y-auto pt-0 sm:max-w-[600px]",children:[s.jsxs(q,{className:"sticky top-0 z-40 -mx-6 bg-background/60 p-6 backdrop-blur",children:[s.jsx(I,{children:B}),s.jsx(J,{children:V})]}),s.jsx("div",{className:"group/datalist",children:s.jsx(F,{data:d,defaultSourceIconUrl:o,getPeriodText:i,mode:r,range:a})})]})]})})]})},ws=n=>{const{data:t,isLoading:m}=bs(n),{data:r,isLoading:a}=gs(n),{data:c,isLoading:e}=fs(),h=g.useMemo(()=>t?.stats||[],[t]),o=g.useMemo(()=>r?.stats.length===0?{free_members:0,paid_members:0,mrr:0}:r?.stats[0],[r]),{selectedCurrency:i,currencySymbol:u}=g.useMemo(()=>{if(c?.stats&&c?.meta?.totals){const l=c.meta.totals;let d=l[0];if(!d)return{selectedCurrency:"usd",currencySymbol:R("usd")};for(const j of l)j.mrr>d.mrr&&(d=j);const x=d.currency;return{selectedCurrency:x,currencySymbol:R(x)}}return{selectedCurrency:"usd",currencySymbol:R("usd")}},[c]);return{isLoading:g.useMemo(()=>m||a||e,[m,a,e]),stats:h,totals:o,selectedCurrency:i,currencySymbol:u}},U=n=>Math.round(n/100),Ss=()=>{const{data:n}=js(),{postId:t}=ss(),{stats:m,totals:r,isLoading:a,currencySymbol:c}=ws(t||""),{appSettings:e}=_(),h=G(),o=d=>h(us({filter:d}),{crossApp:!0}),i=n?.url,u=n?.icon;let p="flex flex-col items-stretch gap-6",l="";return e?.paidMembersEnabled||(p="grid grid-cols-1 border rounded-md",l="border-none hover:shadow-none"),s.jsxs(s.Fragment,{children:[s.jsx(xs,{currentTab:"Growth"}),s.jsx(ps,{children:a?s.jsxs("div",{className:p,children:[s.jsx(N,{className:l,children:s.jsx(w,{className:"grid grid-cols-3 p-0",children:Array.from({length:3},(d,x)=>s.jsxs("div",{className:"h-[98px] gap-1 border-r px-6 py-5 last:border-r-0",children:[s.jsx(E,{className:"w-2/3"}),s.jsx(E,{className:"h-7 w-12"})]},x))})}),s.jsxs(N,{className:l,children:[s.jsxs(S,{children:[s.jsx(C,{children:"Top sources"}),s.jsx(v,{children:"Where did your growth come from?"})]}),s.jsxs(w,{children:[s.jsx(L,{}),s.jsx(es,{className:"pt-6"})]})]})]}):s.jsxs("div",{className:p,children:[s.jsxs(N,{className:l,"data-testid":"members-card",children:[s.jsxs(S,{className:"hidden",children:[s.jsx(C,{children:"Newsletters"}),s.jsx(v,{children:"How did this post perform"})]}),s.jsx(w,{className:"p-0",children:s.jsxs("div",{className:`flex flex-col md:grid md:items-stretch ${e?.paidMembersEnabled?"md:grid-cols-3":"md:grid-cols-1"}`,children:[s.jsxs(M,{className:"grow",children:[s.jsx(A,{onClick:()=>{o(`signup:'${t}'+conversion:-'${t}'`)},children:"View members →"}),s.jsxs(k,{onClick:()=>{o(`signup:'${t}'+conversion:-'${t}'`)},children:[s.jsx(rs,{strokeWidth:1.5}),"Free members"]}),s.jsx(T,{children:s.jsx($,{children:b(r?.free_members||0)})})]}),e?.paidMembersEnabled&&s.jsxs(s.Fragment,{children:[s.jsxs(M,{className:"grow",children:[s.jsx(A,{onClick:()=>{o(`conversion:'${t}'`)},children:"View members →"}),s.jsxs(k,{onClick:()=>{o(`conversion:'${t}'`)},children:[s.jsx(ts,{strokeWidth:1.5}),"Paid members"]}),s.jsx(T,{children:s.jsx($,{children:b(r?.paid_members||0)})})]}),s.jsxs(M,{className:"grow",children:[s.jsxs(k,{children:[s.jsx(ns,{strokeWidth:1.5}),"MRR"]}),s.jsx(T,{children:s.jsxs($,{children:["+",c,U(r?.mrr||0)]})})]})]})]})})]}),!e?.paidMembersEnabled&&s.jsx(L,{}),s.jsx(Ns,{className:l,data:m,mode:"growth",siteIcon:u,siteUrl:i})]})})]})},As=Object.freeze(Object.defineProperty({__proto__:null,centsToDollars:U,default:Ss},Symbol.toStringTag,{value:"Module"}));export{ys as D,U as c,As as g,ws as u};
@@ -1 +1 @@
1
- import{aq as e}from"./index-CFEzD2_M.js";const y=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],x=e("hash",y);export{x as H};
1
+ import{aq as e}from"./index-BkbhBpVC.js";const y=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],x=e("hash",y);export{x as H};
@@ -1 +1 @@
1
- import{aq as o}from"./index-CFEzD2_M.js";const t=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],e=o("inbox",t);export{e as I};
1
+ import{aq as o}from"./index-BkbhBpVC.js";const t=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],e=o("inbox",t);export{e as I};
@@ -1 +1 @@
1
- import{aZ as P,r as A,c6 as L,c7 as W,j as e,S as N,be as se,B as T,b1 as M,ao as m,c0 as te,G as D,an as Q,cF as re,a_ as le,cG as O,t as ce,cH as q,cx as de,b_ as me,cI as J,c1 as ue,cJ as pe,ak as xe,al as z,b4 as G,a0 as he,c3 as ge}from"./index-CFEzD2_M.js";import{g as S,S as fe,a as be,D as je,b as ve}from"./stats-view-gtyaqudG.js";import{C as $,a as E,b as F,g as I,c as R,S as Ne,P as we,E as ke,u as ye,i as _e}from"./pagemenu-TxGvHwRO.js";import{E as Y}from"./empty-indicator-2Pjmce3n.js";import{P as Ce}from"./post-share-modal-D8BtRD2u.js";import{g as Ae,c as Le}from"./post-helpers-DR3PcyZg.js";import{g as ae,a as Te}from"./audience-0RCWjbIK.js";import{e as ze,G as U,f as Me,L as We,g as Z,h as De}from"./gh-chart-CEhBBu3F.js";import{a as K,M as $e,S as X}from"./upload-BcylHEMw.js";import{K as Ee,a as Fe,b as Ie}from"./kpi-card-DOplXdDT.js";import{u as Re}from"./use-growth-stats-Ci0gymWp.js";import{u as Ve}from"./posts-u-CAKddc.js";import{h as Ge,i as Ue}from"./stats-BVKNZJO6.js";import"./select-CPSy44ld.js";import"./chevron-up-CVgBkTk5.js";import"./loader-circle-C7mWzo52.js";import"./mail-9TFkAaAh.js";import"./sprout-956Q4On2.js";import"./share-modal-BRmGllZq.js";import"./copy-D7jqplrv.js";import"./a-large-small-DxRNdz0F.js";import"./wallet-cards-B9TQg4x3.js";import"./undo-2-CcBtw-tW.js";import"./arrow-right-BixoEua4.js";import"./chart-X5cLIH1X.js";import"./_baseAssignValue-BDsvYKNK.js";import"./index-WKMARia9.js";import"./value-BGBiTkF3.js";import"./at-sign-BsHNViA_.js";import"./underline-Bq0P-5Zy.js";import"./circle-alert-Dg3UkvRP.js";import"./power-DR9gpiQR.js";import"./pin-BU_u-xRX.js";import"./hash-CeFrjo3C.js";import"./inbox-CCirPaG2.js";import"./minus-DPrXh11r.js";import"./pencil-CKTgzafp.js";import"./square-BaCvbKJY.js";import"./user-round-check-D0I7NO1g.js";import"./repeat-uXmOJ6y8.js";import"./reply-9ZyqaxI-.js";import"./rocket-DMOr1OCt.js";import"./tags-U3lciBmd.js";import"./trash-CKK_p9G5.js";import"./user-round-x-DeGVH29o.js";import"./currency-fEUUCkj0.js";const Be=s=>s.email_only?"Sent":s.email?"Published and sent":"Published",He=({latestPostStats:s,isLoading:n})=>{const t=P(),[a,i]=A.useState(!1),{site:c,settings:p}=L(),{appSettings:l}=W(),{emailTrackClicks:o,emailTrackOpens:h,webAnalytics:d=!1,membersTrackSources:v=!1}=l?.analytics||{},r=c.title||String(p.find(j=>j.key==="title")?.value||"Ghost Site"),x=String(p.find(j=>j.key==="timezone")?.value||"Etc/UTC"),f=s?Ae(s,{membersTrackSources:v}):null,b="group mr-2 flex flex-col gap-1.5 hover:cursor-pointer",k=!!s?.email,_=ae({postId:s?.id,hasEmailData:k,analytics:{webAnalytics:d,membersTrackSources:v}}),w=_.startsWith("/editor/");return e.jsxs($,{className:"group/card bg-gradient-to-tr from-muted/40 to-muted/0 to-50%","data-testid":"latest-post",children:[e.jsxs(E,{children:[e.jsx(F,{className:"flex items-baseline justify-between leading-snug font-medium text-muted-foreground",children:"Latest post performance"}),e.jsx(I,{className:"hidden",children:"How your last post did"})]}),e.jsxs(R,{className:"flex flex-col gap-6 px-0 lg:flex-row xl:grid xl:grid-cols-3",children:[n&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex w-full items-center gap-6 px-6 xl:col-span-2",children:[e.jsx("div",{className:"w-full max-w-[232px] grow",children:e.jsx(N,{className:"aspect-[16/10] rounded-md"})}),e.jsxs("div",{className:"w-full grow",children:[e.jsx(N,{className:"w-full max-w-[420px]"}),e.jsx(N,{className:"w-1/2"})]})]}),e.jsx("div",{className:"flex flex-col items-stretch gap-2 px-6 text-sm",children:e.jsxs("div",{className:"grid grid-cols-2 gap-5",children:[e.jsxs("div",{children:[e.jsx(N,{className:"w-3/4"}),e.jsx(N,{className:"h-10 w-1/3"})]}),e.jsxs("div",{children:[e.jsx(N,{className:"w-3/4"}),e.jsx(N,{className:"h-10 w-1/3"})]}),e.jsxs("div",{children:[e.jsx(N,{className:"w-3/4"}),e.jsx(N,{className:"h-10 w-1/3"})]}),e.jsxs("div",{children:[e.jsx(N,{className:"w-3/4"}),e.jsx(N,{className:"h-10 w-1/3"})]})]})})]}),!n&&s&&f?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-6 px-6 transition-all md:flex-row md:items-start xl:col-span-2",children:[s.feature_image&&e.jsx("div",{className:"aspect-[16/10] w-full min-w-[100px] rounded-sm bg-cover bg-center sm:max-w-[170px] lg:max-w-[170px] xl:max-w-[232px]",style:{backgroundImage:`url(${s.feature_image})`}}),e.jsxs("div",{className:"flex grow flex-col items-start justify-center self-stretch",children:[e.jsx("div",{className:"text-lg leading-tighter font-semibold tracking-tight hover:cursor-pointer hover:opacity-75",onClick:()=>{!n&&s&&t(_,{crossApp:!0})},children:s.title}),e.jsxs("div",{className:"mt-0.5 text-sm text-muted-foreground",children:[s.authors&&s.authors.length>0&&e.jsxs("div",{children:["By ",s.authors.map(j=>j.name).join(", ")," – ",se(s.published_at,x)]}),e.jsx("div",{className:"mt-0.5",children:Be(s)})]}),e.jsxs("div",{className:"mt-6 flex items-center gap-2",children:[!s.email_only&&e.jsx(Ce,{author:s.authors?.map(j=>j.name).join(", ")||"",description:"",faviconURL:c.icon||"",featureImageURL:s.feature_image||"",open:a,postExcerpt:s.excerpt||"",postTitle:s.title,postURL:s.url||"",siteTitle:r,onClose:()=>i(!1),onOpenChange:i,children:e.jsxs(T,{onClick:()=>i(!0),children:[e.jsx(Ne,{})," Share post"]})}),e.jsx(T,{className:s.email_only?"w-full":"",variant:"outline",onClick:()=>{t(_,{crossApp:!0})},children:w?e.jsxs(e.Fragment,{children:[e.jsx(we,{}),e.jsx("span",{className:"hidden md:visible! md:block!",children:"Edit post"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ze,{}),e.jsx("span",{className:"hidden md:visible! md:block!",children:s.email_only?"Post analytics":"Analytics"})]})})]})]})]}),e.jsx("div",{className:"-ml-4 flex w-full flex-col items-stretch gap-2 pr-6 text-sm xl:h-full xl:max-w-none",children:e.jsxs("div",{className:"grid grid-cols-2 gap-6 pl-10 lg:border-l xl:h-full",children:[f.showWebMetrics&&d&&e.jsxs("div",{className:b,"data-testid":"latest-post-visitors",onClick:()=>{t(`/posts/analytics/${s.id}/web`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx(M,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden md:visible! md:block!",children:"Visitors"})]}),e.jsx("span",{className:"text-[2.2rem] leading-none font-semibold tracking-tighter",children:m(s.visitors)})]}),f.showMemberGrowth&&e.jsxs("div",{className:D(b,f.showEmailMetrics&&(!f.showWebMetrics||!d)&&"row-[2/3] col-[1/2]"),"data-testid":"latest-post-members",onClick:()=>{t(`/posts/analytics/${s.id}/growth`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx(te,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden md:visible! md:block!",children:"Members"})]}),e.jsx("span",{className:"text-[2.2rem] leading-none font-semibold tracking-tighter",children:s.member_delta?e.jsxs(e.Fragment,{children:["+",m(s.member_delta)]}):0})]}),f.showEmailMetrics&&s.email&&e.jsxs(e.Fragment,{children:[h&&e.jsxs("div",{className:b,onClick:()=>{t(`/posts/analytics/${s.id}/newsletter`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx(K,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden whitespace-nowrap md:visible! md:block!",children:"Opens"})]}),e.jsx("span",{className:"text-[2.2rem] leading-none font-semibold tracking-tighter",children:s.email.email_count?Q((s.email.opened_count||0)/s.email.email_count):"0%"})]}),o&&e.jsxs("div",{className:b,onClick:()=>{t(`/posts/analytics/${s.id}/newsletter`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx($e,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden whitespace-nowrap md:visible! md:block!",children:"Clicks"})]}),e.jsx("span",{className:"text-[2.2rem] leading-none font-semibold tracking-tighter",children:s.email.email_count&&s.count?.clicks?Q((s.count.clicks||0)/s.email.email_count):"0%"})]})]})]})})]}):!n&&e.jsx(Y,{actions:e.jsx(T,{variant:"secondary",onClick:()=>{t("/editor/post",{crossApp:!0})},children:"New post"}),className:"w-full pb-10 xl:col-span-3",description:"Once it's live, you can track performance here",title:"Publish your first post",children:e.jsx(re,{strokeWidth:1.5})})]})]})},Oe=()=>{const{data:s}=L();return{isLimited:t=>{const a=s?.config;return a?.hostSettings?.limits&&t==="limitAnalytics"?a.hostSettings.limits.limitAnalytics?.disabled===!0:!1}}},B=({title:s,iconName:n,description:t,color:a,diffDirection:i,diffValue:c,formattedValue:p,trendingFromValue:l,children:o,onClick:h})=>{const{range:d}=L(),v=n&&We[n],r=ce.useMemo(()=>{if(!i||i==="empty"||d===q.allTime.value||!c)return"";const x=i==="up"?"up":i==="down"?"down":"at",b=S(d).replace("in the ","").replace(/^\(|\)$/g,"");return i==="same"?e.jsxs("span",{children:["You're trending at the same level as ",e.jsx("span",{className:"font-semibold",children:p})," compared to the ",e.jsx("span",{className:"font-semibold",children:b})]}):e.jsxs("span",{children:["You're trending ",e.jsxs("span",{className:"font-semibold",children:[x," ",c]})," from ",e.jsx("span",{className:"font-semibold",children:l})," compared to the ",b]})},[i,c,l,p,d]);return e.jsxs($,{className:"group","data-testid":s,children:[e.jsxs(E,{className:"hidden",children:[e.jsx(F,{children:s}),e.jsx(I,{children:t})]}),e.jsxs(Ee,{className:"relative flex grow flex-row items-start justify-between gap-5 border-none pb-2 xl:pb-4",children:[e.jsxs("div",{className:"flex grow flex-col gap-1.5 border-none pb-0",children:[e.jsxs(Fe,{className:h&&"transition-all group-hover:text-foreground",children:[a&&e.jsx("span",{className:"inline-block size-2 rounded-full opacity-50",style:{backgroundColor:a}}),v&&e.jsx(v,{size:16,strokeWidth:1.5}),s]}),e.jsx(Ie,{diffDirection:d===q.allTime.value?"hidden":i,diffTooltip:r,diffValue:c,value:p})]}),h&&e.jsx(T,{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:h,children:"View more"})]}),e.jsx(R,{children:o})]})},Se=({kpiValues:s,visitorsChartData:n,visitorsYRange:t,growthTotals:a,membersChartData:i,mrrChartData:c,currencySymbol:p,isLoading:l})=>{const o=P(),{range:h}=L(),{appSettings:d}=W(),r=Oe().isLimited("limitAnalytics"),x="-mb-3 h-[10vw] max-h-[200px] min-h-[100px] hover:cursor-pointer!";if(l)return e.jsx(ke,{className:"flex h-[calc(10vw+116px)] max-h-[416px] min-h-20 items-center justify-center hover:cursor-pointer!",children:e.jsx(le,{})});const f=d?.analytics.webAnalytics,b=r&&!f,k=!0,_=d?.paidMembersEnabled,w=[f,b,k,_].filter(Boolean).length;let j="lg:grid-cols-3";w===2?j="lg:grid-cols-2":w===1&&(j="lg:grid-cols-1");const V=`flex flex-col lg:grid ${j} gap-6`;return e.jsxs("div",{className:V,children:[f&&!b&&e.jsx(B,{description:"Number of individual people who visited your website",diffDirection:"empty",formattedValue:s.visits,iconName:"Globe",linkto:"/analytics/web/",title:"Unique visitors",onClick:()=>{o("/analytics/web/")},children:e.jsx(U,{className:x,color:"var(--chart-blue)",data:n,id:"visitors",range:h,showHorizontalLines:!0,showYAxisValues:!1,syncId:"overview-charts",yAxisRange:t})}),b&&e.jsxs($,{children:[e.jsxs(E,{className:"hidden",children:[e.jsx(F,{children:"Unlock web analytics"}),e.jsx(I,{children:"Get the full picture of what's working with detailed, cookie-free traffic analytics."})]}),e.jsx(R,{className:"flex h-full items-center justify-center p-6",children:e.jsx(Y,{actions:e.jsx(T,{variant:"outline",onClick:()=>o("/pro",{crossApp:!0}),children:"Upgrade now"}),className:"py-10",description:"Get the full picture of what's working with detailed, cookie-free traffic analytics.",title:"Unlock web analytics",children:e.jsx(Me,{})})})]}),e.jsx(B,{description:"How number of members of your publication changed over time",diffDirection:a.directions.total,diffValue:a.percentChanges.total,formattedValue:m(a.totalMembers),iconName:"User",linkto:"/analytics/growth/",title:"Members",trendingFromValue:`${m(i[0].value)}`,onClick:()=>{o("/analytics/growth/?tab=total-members")},children:e.jsx(U,{className:x,color:"var(--chart-darkblue)",data:i,id:"members",range:h,showHorizontalLines:!0,showYAxisValues:!1,syncId:"overview-charts"})}),_&&e.jsx(B,{description:"Monthly recurring revenue changes over time",diffDirection:a.directions.mrr,diffValue:a.percentChanges.mrr,formattedValue:`${p}${m(O(a.mrr))}`,iconName:"Coins",linkto:"/analytics/growth/",title:"MRR",trendingFromValue:`${p}${m(c[0].value)}`,onClick:()=>{o("/analytics/growth/?tab=mrr")},children:e.jsx(U,{className:x,color:"var(--chart-teal)",data:c,id:"mrr",range:h,showHorizontalLines:!0,showYAxisValues:!1,syncId:"overview-charts"})})]})},Ke=({className:s})=>e.jsx("div",{className:D("rounded-sm bg-muted dark:bg-[#36373a] flex flex-col items-center justify-center gap-1 p-6",s),children:e.jsx(de,{className:"text-muted-foreground/50",size:18,strokeWidth:1.5})}),H=({className:s,metrics:n,title:t})=>e.jsx(e.Fragment,{children:e.jsxs("div",{className:D("pointer-events-none absolute bottom-[calc(100%+2px)] left-1/2 z-50 min-w-[160px] -translate-x-1/2 rounded-md bg-background p-3 text-sm opacity-0 shadow-md transition-all group-hover/tooltip:bottom-[calc(100%+12px)] group-hover/tooltip:opacity-100",s),children:[e.jsx("div",{className:"mb-1.5 border-b pr-10 pb-1.5 font-medium whitespace-nowrap text-muted-foreground",children:t}),e.jsx("div",{className:"flex flex-col gap-1.5",children:n?.map(a=>e.jsxs("div",{className:"flex items-center justify-between gap-5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 whitespace-nowrap",children:[a.icon,a.label]}),e.jsx("span",{className:"font-mono",children:a.metric})]},a.label))})]})}),Pe=({topPostsData:s,isLoading:n})=>{const t=P(),{range:a,settings:i}=L(),{appSettings:c}=W(),p=String(i.find(r=>r.key==="timezone")?.value||"Etc/UTC"),{webAnalytics:l=!1,membersTrackSources:o=!1,emailTrackClicks:h=!1,emailTrackOpens:d=!1}=c?.analytics||{},v="flex items-center justify-end gap-1 rounded-md px-2 py-1 font-mono text-gray-800 hover:bg-muted-foreground/10 group-hover:text-foreground";return e.jsxs($,{className:"group/card w-full lg:col-span-2","data-testid":"top-posts-card",children:[e.jsxs(E,{children:[e.jsxs(F,{className:"flex items-baseline justify-between leading-snug font-medium text-muted-foreground",children:["Top posts ",S(a)]}),e.jsx(I,{className:"hidden",children:"Most viewed posts in this period"})]}),e.jsx(R,{children:n?e.jsx(me,{className:"mt-6"}):e.jsxs(e.Fragment,{children:[s?.stats?.map(r=>e.jsxs("div",{className:'group relative flex w-full items-start justify-between gap-5 border-t border-border/50 py-4 before:absolute before:-inset-x-4 before:inset-y-0 before:z-0 before:hidden before:rounded-md before:bg-accent before:opacity-80 before:content-[""] first:border-border! hover:cursor-pointer hover:border-transparent hover:before:block md:items-center dark:before:bg-accent/50 [&+div]:hover:border-transparent',children:[e.jsxs("div",{className:"z-10 flex min-w-[160px] grow items-start gap-4 md:items-center lg:min-w-[320px]",onClick:()=>{t(ae({postId:r.post_id,hasEmailData:r.sent_count!==null,analytics:{webAnalytics:l,membersTrackSources:o}}),{crossApp:!0})},children:[r.feature_image?e.jsx("div",{className:"hidden aspect-[16/10] w-[80px] shrink-0 rounded-sm bg-cover bg-center sm:visible! sm:block! lg:w-[100px]",style:{backgroundImage:`url(${r.feature_image})`}}):e.jsx(Ke,{className:"hidden aspect-[16/10] w-[80px] shrink-0 group-hover:bg-muted-foreground/10 sm:visible! sm:flex! lg:w-[100px]"}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"line-clamp-2 text-lg leading-[1.35em] font-semibold",children:r.title}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["By ",r.authors," – ",se(r.published_at,p)]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:Le(r)})]})]}),e.jsxs("div",{className:"z-10 flex flex-col items-end justify-center gap-0.5 text-sm md:flex-row md:items-center md:justify-end md:gap-3",children:[l&&e.jsxs("div",{className:"group/tooltip relative flex w-[66px] lg:w-[92px]","data-testid":"statistics-visitors",onClick:x=>{x.stopPropagation(),t(`/posts/analytics/${r.post_id}/web`,{crossApp:!0})},children:[e.jsx(H,{metrics:[{icon:e.jsx(M,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Unique visitors",metric:m(r.views)}],title:"Web traffic"}),e.jsxs("div",{className:v,children:[e.jsx(M,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),J(r.views)]})]}),r.sent_count!==null&&e.jsxs("div",{className:"group/tooltip relative flex w-[66px] lg:w-[92px]",onClick:x=>{x.stopPropagation(),t(`/posts/analytics/${r.post_id}/newsletter`,{crossApp:!0})},children:[e.jsx(H,{className:`${o?"":"right-0 left-auto translate-x-0"}`,metrics:[{icon:e.jsx(X,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Sent",metric:m(r.sent_count||0)},...d?[{icon:e.jsx(K,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Opens",metric:m(r.opened_count||0)}]:[],...h?[{icon:e.jsx(Z,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Clicks",metric:m(r.clicked_count||0)}]:[]],title:"Newsletter performance"}),e.jsx("div",{className:v,children:d?e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),r.open_rate?`${Math.round(r.open_rate)}%`:"0%"]}):h?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),r.click_rate?`${Math.round(r.click_rate)}%`:"0%"]}):e.jsxs(e.Fragment,{children:[e.jsx(X,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),J(r.sent_count||0)]})})]}),o&&e.jsxs("div",{className:"group/tooltip relative flex w-[66px] lg:w-[92px]","data-testid":"statistics-members",onClick:x=>{x.stopPropagation(),t(`/posts/analytics/${r.post_id}/growth`,{crossApp:!0})},children:[e.jsx(H,{className:"right-0 left-auto translate-x-0",metrics:[{icon:e.jsx(ue,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Free",metric:r.free_members>0?`+${m(r.free_members)}`:"0"},...c?.paidMembersEnabled?[{icon:e.jsx(pe,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Paid",metric:r.paid_members>0?`+${m(r.paid_members)}`:"0"}]:[]],title:"New members"}),e.jsxs("div",{className:v,children:[e.jsx(te,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),r.members>0?`+${m(r.members)}`:"0"]})]})]})]},r.post_id)),(!s?.stats||s.stats.length===0)&&e.jsx(Y,{className:"w-full pb-10",title:`No posts ${S(a)}`,children:e.jsx(re,{strokeWidth:1.5})})]})})]})},Ye=()=>{const{data:{posts:[s]}={posts:[]},isLoading:n}=Ve({searchParams:{filter:"status:[published,sent]",order:"published_at DESC",limit:"1",include:"authors,email,count.clicks"}}),t=s,a=Ge(t?.id||"",{enabled:!!t?.id}),{data:i,isLoading:c}=a;return{data:A.useMemo(()=>{if(!t)return null;const l=i?.stats?.[0]||{id:t.id,recipient_count:null,opened_count:null,open_rate:null,member_delta:0,free_members:0,paid_members:0,visitors:0};return{id:t.id,uuid:t.uuid,title:t.title||"",slug:t.slug||"",feature_image:t.feature_image||null,published_at:t.published_at||"",url:t.url||"",excerpt:t.excerpt||"",email_only:t.email_only||!1,status:t.status,email:t.email,count:t.count,authors:t.authors||[],recipient_count:l.recipient_count,opened_count:l.opened_count,open_rate:l.open_rate,member_delta:l.member_delta,free_members:l.free_members,paid_members:l.paid_members,visitors:l.visitors,click_rate:null}},[t,i]),isLoading:n||!!t?.id&&c}},ee=({className:s,title:n,description:t,url:a,children:i})=>e.jsx("a",{className:D("block rounded-xl border bg-card p-6 transition-all hover:shadow-xs hover:bg-accent/50 group/card",s),href:a,rel:"noreferrer",target:"_blank",children:e.jsxs("div",{className:"flex items-center gap-6",children:[i,e.jsxs("div",{className:"flex flex-col gap-0.5 leading-tight",children:[e.jsx("span",{className:"text-base font-semibold",children:n}),e.jsx("span",{className:"text-sm font-normal text-gray-700",children:t})]})]})}),Us=()=>{const{appSettings:s}=W(),{statsConfig:n,isLoading:t,range:a}=L(),{startDate:i,endDate:c,timezone:p}=xe(a),{isLoading:l,chartData:o,totals:h,currencySymbol:d}=Re(a),{data:v,isLoading:r}=Ye(),{data:x,isLoading:f}=Ue({searchParams:{date_from:z(i),date_to:z(c),limit:"5",timezone:p}}),b={site_uuid:n?.id||"",date_from:z(i),date_to:z(c),timezone:p,member_status:Te(ge)},{data:k,loading:_}=ye({endpoint:"api_kpis",statsConfig:n,params:b}),w=A.useMemo(()=>G(k||[],a,"visits","sum")?.map(g=>{const y=Number(g.visits),C=isNaN(y)?0:y;return{date:String(g.date),value:C,formattedValue:m(C),label:"Visitors"}}),[k,a]),j=A.useMemo(()=>{const g=[0,1];if(!w||w.length===0)return g;const y=w.map(u=>u.value).filter(u=>u>=0);return y.length===0?g:[0,Math.max(...y)||g[1]]},[w]),V=A.useMemo(()=>{if(!o||o.length===0)return[];let g=[];return g=G(o,a,"value","exact"),g.map(u=>({date:u.date,value:u.free+u.paid,formattedValue:m(u.free+u.paid),label:"Members"}))},[o,a]),ie=A.useMemo(()=>{if(!s?.paidMembersEnabled||!o||o.length===0)return[];let g=[];return g=G(o,a,"mrr","exact"),g.map(u=>({date:u.date,value:O(u.mrr),formattedValue:`${d}${m(O(u.mrr))}`,label:"MRR"}))},[o,a,d,s]),ne=A.useMemo(()=>{if(!k?.length)return{visits:"0"};const g=k.reduce((y,C)=>{const u=Number(C.visits);return y+(isNaN(u)?0:u)},0);return{visits:m(g)}},[k]),oe=t;return e.jsxs(fe,{children:[e.jsx(be,{children:e.jsx(_e,{children:e.jsx(je,{excludeRanges:["today"]})})}),e.jsxs(ve,{isLoading:oe,loadingComponent:e.jsx(e.Fragment,{}),children:[e.jsx(Se,{currencySymbol:d,growthTotals:h,isLoading:_||l,kpiValues:ne,membersChartData:V,mrrChartData:ie,visitorsChartData:w,visitorsYRange:j}),e.jsx(He,{isLoading:r,latestPostStats:v}),e.jsx(Pe,{isLoading:f,topPostsData:x}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsx(he,{className:"mt-4 -mb-4 lg:col-span-2",children:"Grow your audience"}),e.jsx(ee,{description:"Find out how to review the performance of your content and get the most out of post analytics in Ghost.",title:"Understanding analytics in Ghost",url:"https://ghost.org/help/native-analytics",children:e.jsx("div",{className:"flex h-18 w-[100px] min-w-[100px] items-center justify-center rounded-md bg-gradient-to-tr from-[#14B8FF]/20 to-[#00BBA7]/20 p-4 opacity-80 transition-all group-hover/card:opacity-100",children:e.jsx(De,{className:"text-[#00BBA7]",size:20,strokeWidth:1.5})})}),e.jsx(ee,{description:"Use these content distribution tactics to get more people to discover your work and increase engagement.",title:"How to get your content seen online",url:"https://ghost.org/resources/content-distribution/",children:e.jsx("div",{className:"flex h-18 w-[100px] min-w-[100px] items-center justify-center rounded-md bg-gradient-to-tl from-[#FDC700]/20 to-[#FF2056]/20 p-4 opacity-80 transition-all group-hover/card:opacity-100",children:e.jsx(M,{className:"text-[#FE9A00]",size:20,strokeWidth:1.5})})})]})]})]})};export{Us as default};
1
+ import{aZ as P,r as A,c6 as L,c7 as W,j as e,S as N,be as se,B as T,b1 as M,ao as m,c0 as te,G as D,an as Q,cF as re,a_ as le,cG as O,t as ce,cH as q,cx as de,b_ as me,cI as J,c1 as ue,cJ as pe,ak as xe,al as z,b4 as G,a0 as he,c3 as ge}from"./index-BkbhBpVC.js";import{g as S,S as fe,a as be,D as je,b as ve}from"./stats-view-DubukX9V.js";import{C as $,a as E,b as F,g as I,c as R,S as Ne,P as we,E as ke,u as ye,i as _e}from"./pagemenu-O_y8Jm4v.js";import{E as Y}from"./empty-indicator-BvyaMcmw.js";import{P as Ce}from"./post-share-modal-D0OlASBQ.js";import{g as Ae,c as Le}from"./post-helpers-DR3PcyZg.js";import{g as ae,a as Te}from"./audience-CvP78Gug.js";import{e as ze,G as U,f as Me,L as We,g as Z,h as De}from"./gh-chart-JxzKqaoO.js";import{a as K,M as $e,S as X}from"./upload-BLiT66bJ.js";import{K as Ee,a as Fe,b as Ie}from"./kpi-card-DV-nN7xT.js";import{u as Re}from"./use-growth-stats-u18So4Gq.js";import{u as Ve}from"./posts-BZaw4-dc.js";import{h as Ge,i as Ue}from"./stats-Yo9Gco0_.js";import"./select-BfWJkrKc.js";import"./chevron-up-DuaKtE_M.js";import"./loader-circle-B1uEfpbZ.js";import"./mail-ccQhEr7k.js";import"./sprout-CpwUJAPT.js";import"./share-modal-CtdLQbnQ.js";import"./copy-DVtQi_VJ.js";import"./a-large-small-BiK5_5LV.js";import"./wallet-cards-CVZ99Nm3.js";import"./undo-2-D6ZRqONE.js";import"./arrow-right-Bk43nMGd.js";import"./chart-CUKSNmKY.js";import"./_baseAssignValue-hdDG700N.js";import"./index-DYE2untj.js";import"./value-BGBiTkF3.js";import"./at-sign-DWOf36uj.js";import"./underline-CwuJG-Ql.js";import"./circle-alert-bcK_Yqap.js";import"./power-DWm6pts5.js";import"./pin-Bl3nSr7I.js";import"./hash-CJzbTA5k.js";import"./inbox-CVVAkCmd.js";import"./minus-C68D81nx.js";import"./pencil-BcymGPnE.js";import"./square-CDrQjv8R.js";import"./user-round-check-BDomHaso.js";import"./repeat-DQay9e22.js";import"./reply-CoNqmExw.js";import"./rocket-Dne6P_8f.js";import"./tags-DuMshkTz.js";import"./trash-CUqAK3SQ.js";import"./user-round-x-Cc0RL-V9.js";import"./currency-fEUUCkj0.js";const Be=s=>s.email_only?"Sent":s.email?"Published and sent":"Published",He=({latestPostStats:s,isLoading:n})=>{const t=P(),[a,i]=A.useState(!1),{site:c,settings:p}=L(),{appSettings:l}=W(),{emailTrackClicks:o,emailTrackOpens:h,webAnalytics:d=!1,membersTrackSources:v=!1}=l?.analytics||{},r=c.title||String(p.find(j=>j.key==="title")?.value||"Ghost Site"),x=String(p.find(j=>j.key==="timezone")?.value||"Etc/UTC"),f=s?Ae(s,{membersTrackSources:v}):null,b="group mr-2 flex flex-col gap-1.5 hover:cursor-pointer",k=!!s?.email,_=ae({postId:s?.id,hasEmailData:k,analytics:{webAnalytics:d,membersTrackSources:v}}),w=_.startsWith("/editor/");return e.jsxs($,{className:"group/card bg-gradient-to-tr from-muted/40 to-muted/0 to-50%","data-testid":"latest-post",children:[e.jsxs(E,{children:[e.jsx(F,{className:"flex items-baseline justify-between leading-snug font-medium text-muted-foreground",children:"Latest post performance"}),e.jsx(I,{className:"hidden",children:"How your last post did"})]}),e.jsxs(R,{className:"flex flex-col gap-6 px-0 lg:flex-row xl:grid xl:grid-cols-3",children:[n&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex w-full items-center gap-6 px-6 xl:col-span-2",children:[e.jsx("div",{className:"w-full max-w-[232px] grow",children:e.jsx(N,{className:"aspect-[16/10] rounded-md"})}),e.jsxs("div",{className:"w-full grow",children:[e.jsx(N,{className:"w-full max-w-[420px]"}),e.jsx(N,{className:"w-1/2"})]})]}),e.jsx("div",{className:"flex flex-col items-stretch gap-2 px-6 text-sm",children:e.jsxs("div",{className:"grid grid-cols-2 gap-5",children:[e.jsxs("div",{children:[e.jsx(N,{className:"w-3/4"}),e.jsx(N,{className:"h-10 w-1/3"})]}),e.jsxs("div",{children:[e.jsx(N,{className:"w-3/4"}),e.jsx(N,{className:"h-10 w-1/3"})]}),e.jsxs("div",{children:[e.jsx(N,{className:"w-3/4"}),e.jsx(N,{className:"h-10 w-1/3"})]}),e.jsxs("div",{children:[e.jsx(N,{className:"w-3/4"}),e.jsx(N,{className:"h-10 w-1/3"})]})]})})]}),!n&&s&&f?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-6 px-6 transition-all md:flex-row md:items-start xl:col-span-2",children:[s.feature_image&&e.jsx("div",{className:"aspect-[16/10] w-full min-w-[100px] rounded-sm bg-cover bg-center sm:max-w-[170px] lg:max-w-[170px] xl:max-w-[232px]",style:{backgroundImage:`url(${s.feature_image})`}}),e.jsxs("div",{className:"flex grow flex-col items-start justify-center self-stretch",children:[e.jsx("div",{className:"text-lg leading-tighter font-semibold tracking-tight hover:cursor-pointer hover:opacity-75",onClick:()=>{!n&&s&&t(_,{crossApp:!0})},children:s.title}),e.jsxs("div",{className:"mt-0.5 text-sm text-muted-foreground",children:[s.authors&&s.authors.length>0&&e.jsxs("div",{children:["By ",s.authors.map(j=>j.name).join(", ")," – ",se(s.published_at,x)]}),e.jsx("div",{className:"mt-0.5",children:Be(s)})]}),e.jsxs("div",{className:"mt-6 flex items-center gap-2",children:[!s.email_only&&e.jsx(Ce,{author:s.authors?.map(j=>j.name).join(", ")||"",description:"",faviconURL:c.icon||"",featureImageURL:s.feature_image||"",open:a,postExcerpt:s.excerpt||"",postTitle:s.title,postURL:s.url||"",siteTitle:r,onClose:()=>i(!1),onOpenChange:i,children:e.jsxs(T,{onClick:()=>i(!0),children:[e.jsx(Ne,{})," Share post"]})}),e.jsx(T,{className:s.email_only?"w-full":"",variant:"outline",onClick:()=>{t(_,{crossApp:!0})},children:w?e.jsxs(e.Fragment,{children:[e.jsx(we,{}),e.jsx("span",{className:"hidden md:visible! md:block!",children:"Edit post"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ze,{}),e.jsx("span",{className:"hidden md:visible! md:block!",children:s.email_only?"Post analytics":"Analytics"})]})})]})]})]}),e.jsx("div",{className:"-ml-4 flex w-full flex-col items-stretch gap-2 pr-6 text-sm xl:h-full xl:max-w-none",children:e.jsxs("div",{className:"grid grid-cols-2 gap-6 pl-10 lg:border-l xl:h-full",children:[f.showWebMetrics&&d&&e.jsxs("div",{className:b,"data-testid":"latest-post-visitors",onClick:()=>{t(`/posts/analytics/${s.id}/web`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx(M,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden md:visible! md:block!",children:"Visitors"})]}),e.jsx("span",{className:"text-[2.2rem] leading-none font-semibold tracking-tighter",children:m(s.visitors)})]}),f.showMemberGrowth&&e.jsxs("div",{className:D(b,f.showEmailMetrics&&(!f.showWebMetrics||!d)&&"row-[2/3] col-[1/2]"),"data-testid":"latest-post-members",onClick:()=>{t(`/posts/analytics/${s.id}/growth`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx(te,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden md:visible! md:block!",children:"Members"})]}),e.jsx("span",{className:"text-[2.2rem] leading-none font-semibold tracking-tighter",children:s.member_delta?e.jsxs(e.Fragment,{children:["+",m(s.member_delta)]}):0})]}),f.showEmailMetrics&&s.email&&e.jsxs(e.Fragment,{children:[h&&e.jsxs("div",{className:b,onClick:()=>{t(`/posts/analytics/${s.id}/newsletter`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx(K,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden whitespace-nowrap md:visible! md:block!",children:"Opens"})]}),e.jsx("span",{className:"text-[2.2rem] leading-none font-semibold tracking-tighter",children:s.email.email_count?Q((s.email.opened_count||0)/s.email.email_count):"0%"})]}),o&&e.jsxs("div",{className:b,onClick:()=>{t(`/posts/analytics/${s.id}/newsletter`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx($e,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden whitespace-nowrap md:visible! md:block!",children:"Clicks"})]}),e.jsx("span",{className:"text-[2.2rem] leading-none font-semibold tracking-tighter",children:s.email.email_count&&s.count?.clicks?Q((s.count.clicks||0)/s.email.email_count):"0%"})]})]})]})})]}):!n&&e.jsx(Y,{actions:e.jsx(T,{variant:"secondary",onClick:()=>{t("/editor/post",{crossApp:!0})},children:"New post"}),className:"w-full pb-10 xl:col-span-3",description:"Once it's live, you can track performance here",title:"Publish your first post",children:e.jsx(re,{strokeWidth:1.5})})]})]})},Oe=()=>{const{data:s}=L();return{isLimited:t=>{const a=s?.config;return a?.hostSettings?.limits&&t==="limitAnalytics"?a.hostSettings.limits.limitAnalytics?.disabled===!0:!1}}},B=({title:s,iconName:n,description:t,color:a,diffDirection:i,diffValue:c,formattedValue:p,trendingFromValue:l,children:o,onClick:h})=>{const{range:d}=L(),v=n&&We[n],r=ce.useMemo(()=>{if(!i||i==="empty"||d===q.allTime.value||!c)return"";const x=i==="up"?"up":i==="down"?"down":"at",b=S(d).replace("in the ","").replace(/^\(|\)$/g,"");return i==="same"?e.jsxs("span",{children:["You're trending at the same level as ",e.jsx("span",{className:"font-semibold",children:p})," compared to the ",e.jsx("span",{className:"font-semibold",children:b})]}):e.jsxs("span",{children:["You're trending ",e.jsxs("span",{className:"font-semibold",children:[x," ",c]})," from ",e.jsx("span",{className:"font-semibold",children:l})," compared to the ",b]})},[i,c,l,p,d]);return e.jsxs($,{className:"group","data-testid":s,children:[e.jsxs(E,{className:"hidden",children:[e.jsx(F,{children:s}),e.jsx(I,{children:t})]}),e.jsxs(Ee,{className:"relative flex grow flex-row items-start justify-between gap-5 border-none pb-2 xl:pb-4",children:[e.jsxs("div",{className:"flex grow flex-col gap-1.5 border-none pb-0",children:[e.jsxs(Fe,{className:h&&"transition-all group-hover:text-foreground",children:[a&&e.jsx("span",{className:"inline-block size-2 rounded-full opacity-50",style:{backgroundColor:a}}),v&&e.jsx(v,{size:16,strokeWidth:1.5}),s]}),e.jsx(Ie,{diffDirection:d===q.allTime.value?"hidden":i,diffTooltip:r,diffValue:c,value:p})]}),h&&e.jsx(T,{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:h,children:"View more"})]}),e.jsx(R,{children:o})]})},Se=({kpiValues:s,visitorsChartData:n,visitorsYRange:t,growthTotals:a,membersChartData:i,mrrChartData:c,currencySymbol:p,isLoading:l})=>{const o=P(),{range:h}=L(),{appSettings:d}=W(),r=Oe().isLimited("limitAnalytics"),x="-mb-3 h-[10vw] max-h-[200px] min-h-[100px] hover:cursor-pointer!";if(l)return e.jsx(ke,{className:"flex h-[calc(10vw+116px)] max-h-[416px] min-h-20 items-center justify-center hover:cursor-pointer!",children:e.jsx(le,{})});const f=d?.analytics.webAnalytics,b=r&&!f,k=!0,_=d?.paidMembersEnabled,w=[f,b,k,_].filter(Boolean).length;let j="lg:grid-cols-3";w===2?j="lg:grid-cols-2":w===1&&(j="lg:grid-cols-1");const V=`flex flex-col lg:grid ${j} gap-6`;return e.jsxs("div",{className:V,children:[f&&!b&&e.jsx(B,{description:"Number of individual people who visited your website",diffDirection:"empty",formattedValue:s.visits,iconName:"Globe",linkto:"/analytics/web/",title:"Unique visitors",onClick:()=>{o("/analytics/web/")},children:e.jsx(U,{className:x,color:"var(--chart-blue)",data:n,id:"visitors",range:h,showHorizontalLines:!0,showYAxisValues:!1,syncId:"overview-charts",yAxisRange:t})}),b&&e.jsxs($,{children:[e.jsxs(E,{className:"hidden",children:[e.jsx(F,{children:"Unlock web analytics"}),e.jsx(I,{children:"Get the full picture of what's working with detailed, cookie-free traffic analytics."})]}),e.jsx(R,{className:"flex h-full items-center justify-center p-6",children:e.jsx(Y,{actions:e.jsx(T,{variant:"outline",onClick:()=>o("/pro",{crossApp:!0}),children:"Upgrade now"}),className:"py-10",description:"Get the full picture of what's working with detailed, cookie-free traffic analytics.",title:"Unlock web analytics",children:e.jsx(Me,{})})})]}),e.jsx(B,{description:"How number of members of your publication changed over time",diffDirection:a.directions.total,diffValue:a.percentChanges.total,formattedValue:m(a.totalMembers),iconName:"User",linkto:"/analytics/growth/",title:"Members",trendingFromValue:`${m(i[0].value)}`,onClick:()=>{o("/analytics/growth/?tab=total-members")},children:e.jsx(U,{className:x,color:"var(--chart-darkblue)",data:i,id:"members",range:h,showHorizontalLines:!0,showYAxisValues:!1,syncId:"overview-charts"})}),_&&e.jsx(B,{description:"Monthly recurring revenue changes over time",diffDirection:a.directions.mrr,diffValue:a.percentChanges.mrr,formattedValue:`${p}${m(O(a.mrr))}`,iconName:"Coins",linkto:"/analytics/growth/",title:"MRR",trendingFromValue:`${p}${m(c[0].value)}`,onClick:()=>{o("/analytics/growth/?tab=mrr")},children:e.jsx(U,{className:x,color:"var(--chart-teal)",data:c,id:"mrr",range:h,showHorizontalLines:!0,showYAxisValues:!1,syncId:"overview-charts"})})]})},Ke=({className:s})=>e.jsx("div",{className:D("rounded-sm bg-muted dark:bg-[#36373a] flex flex-col items-center justify-center gap-1 p-6",s),children:e.jsx(de,{className:"text-muted-foreground/50",size:18,strokeWidth:1.5})}),H=({className:s,metrics:n,title:t})=>e.jsx(e.Fragment,{children:e.jsxs("div",{className:D("pointer-events-none absolute bottom-[calc(100%+2px)] left-1/2 z-50 min-w-[160px] -translate-x-1/2 rounded-md bg-background p-3 text-sm opacity-0 shadow-md transition-all group-hover/tooltip:bottom-[calc(100%+12px)] group-hover/tooltip:opacity-100",s),children:[e.jsx("div",{className:"mb-1.5 border-b pr-10 pb-1.5 font-medium whitespace-nowrap text-muted-foreground",children:t}),e.jsx("div",{className:"flex flex-col gap-1.5",children:n?.map(a=>e.jsxs("div",{className:"flex items-center justify-between gap-5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 whitespace-nowrap",children:[a.icon,a.label]}),e.jsx("span",{className:"font-mono",children:a.metric})]},a.label))})]})}),Pe=({topPostsData:s,isLoading:n})=>{const t=P(),{range:a,settings:i}=L(),{appSettings:c}=W(),p=String(i.find(r=>r.key==="timezone")?.value||"Etc/UTC"),{webAnalytics:l=!1,membersTrackSources:o=!1,emailTrackClicks:h=!1,emailTrackOpens:d=!1}=c?.analytics||{},v="flex items-center justify-end gap-1 rounded-md px-2 py-1 font-mono text-gray-800 hover:bg-muted-foreground/10 group-hover:text-foreground";return e.jsxs($,{className:"group/card w-full lg:col-span-2","data-testid":"top-posts-card",children:[e.jsxs(E,{children:[e.jsxs(F,{className:"flex items-baseline justify-between leading-snug font-medium text-muted-foreground",children:["Top posts ",S(a)]}),e.jsx(I,{className:"hidden",children:"Most viewed posts in this period"})]}),e.jsx(R,{children:n?e.jsx(me,{className:"mt-6"}):e.jsxs(e.Fragment,{children:[s?.stats?.map(r=>e.jsxs("div",{className:'group relative flex w-full items-start justify-between gap-5 border-t border-border/50 py-4 before:absolute before:-inset-x-4 before:inset-y-0 before:z-0 before:hidden before:rounded-md before:bg-accent before:opacity-80 before:content-[""] first:border-border! hover:cursor-pointer hover:border-transparent hover:before:block md:items-center dark:before:bg-accent/50 [&+div]:hover:border-transparent',children:[e.jsxs("div",{className:"z-10 flex min-w-[160px] grow items-start gap-4 md:items-center lg:min-w-[320px]",onClick:()=>{t(ae({postId:r.post_id,hasEmailData:r.sent_count!==null,analytics:{webAnalytics:l,membersTrackSources:o}}),{crossApp:!0})},children:[r.feature_image?e.jsx("div",{className:"hidden aspect-[16/10] w-[80px] shrink-0 rounded-sm bg-cover bg-center sm:visible! sm:block! lg:w-[100px]",style:{backgroundImage:`url(${r.feature_image})`}}):e.jsx(Ke,{className:"hidden aspect-[16/10] w-[80px] shrink-0 group-hover:bg-muted-foreground/10 sm:visible! sm:flex! lg:w-[100px]"}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"line-clamp-2 text-lg leading-[1.35em] font-semibold",children:r.title}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["By ",r.authors," – ",se(r.published_at,p)]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:Le(r)})]})]}),e.jsxs("div",{className:"z-10 flex flex-col items-end justify-center gap-0.5 text-sm md:flex-row md:items-center md:justify-end md:gap-3",children:[l&&e.jsxs("div",{className:"group/tooltip relative flex w-[66px] lg:w-[92px]","data-testid":"statistics-visitors",onClick:x=>{x.stopPropagation(),t(`/posts/analytics/${r.post_id}/web`,{crossApp:!0})},children:[e.jsx(H,{metrics:[{icon:e.jsx(M,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Unique visitors",metric:m(r.views)}],title:"Web traffic"}),e.jsxs("div",{className:v,children:[e.jsx(M,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),J(r.views)]})]}),r.sent_count!==null&&e.jsxs("div",{className:"group/tooltip relative flex w-[66px] lg:w-[92px]",onClick:x=>{x.stopPropagation(),t(`/posts/analytics/${r.post_id}/newsletter`,{crossApp:!0})},children:[e.jsx(H,{className:`${o?"":"right-0 left-auto translate-x-0"}`,metrics:[{icon:e.jsx(X,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Sent",metric:m(r.sent_count||0)},...d?[{icon:e.jsx(K,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Opens",metric:m(r.opened_count||0)}]:[],...h?[{icon:e.jsx(Z,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Clicks",metric:m(r.clicked_count||0)}]:[]],title:"Newsletter performance"}),e.jsx("div",{className:v,children:d?e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),r.open_rate?`${Math.round(r.open_rate)}%`:"0%"]}):h?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),r.click_rate?`${Math.round(r.click_rate)}%`:"0%"]}):e.jsxs(e.Fragment,{children:[e.jsx(X,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),J(r.sent_count||0)]})})]}),o&&e.jsxs("div",{className:"group/tooltip relative flex w-[66px] lg:w-[92px]","data-testid":"statistics-members",onClick:x=>{x.stopPropagation(),t(`/posts/analytics/${r.post_id}/growth`,{crossApp:!0})},children:[e.jsx(H,{className:"right-0 left-auto translate-x-0",metrics:[{icon:e.jsx(ue,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Free",metric:r.free_members>0?`+${m(r.free_members)}`:"0"},...c?.paidMembersEnabled?[{icon:e.jsx(pe,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Paid",metric:r.paid_members>0?`+${m(r.paid_members)}`:"0"}]:[]],title:"New members"}),e.jsxs("div",{className:v,children:[e.jsx(te,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),r.members>0?`+${m(r.members)}`:"0"]})]})]})]},r.post_id)),(!s?.stats||s.stats.length===0)&&e.jsx(Y,{className:"w-full pb-10",title:`No posts ${S(a)}`,children:e.jsx(re,{strokeWidth:1.5})})]})})]})},Ye=()=>{const{data:{posts:[s]}={posts:[]},isLoading:n}=Ve({searchParams:{filter:"status:[published,sent]",order:"published_at DESC",limit:"1",include:"authors,email,count.clicks"}}),t=s,a=Ge(t?.id||"",{enabled:!!t?.id}),{data:i,isLoading:c}=a;return{data:A.useMemo(()=>{if(!t)return null;const l=i?.stats?.[0]||{id:t.id,recipient_count:null,opened_count:null,open_rate:null,member_delta:0,free_members:0,paid_members:0,visitors:0};return{id:t.id,uuid:t.uuid,title:t.title||"",slug:t.slug||"",feature_image:t.feature_image||null,published_at:t.published_at||"",url:t.url||"",excerpt:t.excerpt||"",email_only:t.email_only||!1,status:t.status,email:t.email,count:t.count,authors:t.authors||[],recipient_count:l.recipient_count,opened_count:l.opened_count,open_rate:l.open_rate,member_delta:l.member_delta,free_members:l.free_members,paid_members:l.paid_members,visitors:l.visitors,click_rate:null}},[t,i]),isLoading:n||!!t?.id&&c}},ee=({className:s,title:n,description:t,url:a,children:i})=>e.jsx("a",{className:D("block rounded-xl border bg-card p-6 transition-all hover:shadow-xs hover:bg-accent/50 group/card",s),href:a,rel:"noreferrer",target:"_blank",children:e.jsxs("div",{className:"flex items-center gap-6",children:[i,e.jsxs("div",{className:"flex flex-col gap-0.5 leading-tight",children:[e.jsx("span",{className:"text-base font-semibold",children:n}),e.jsx("span",{className:"text-sm font-normal text-gray-700",children:t})]})]})}),Us=()=>{const{appSettings:s}=W(),{statsConfig:n,isLoading:t,range:a}=L(),{startDate:i,endDate:c,timezone:p}=xe(a),{isLoading:l,chartData:o,totals:h,currencySymbol:d}=Re(a),{data:v,isLoading:r}=Ye(),{data:x,isLoading:f}=Ue({searchParams:{date_from:z(i),date_to:z(c),limit:"5",timezone:p}}),b={site_uuid:n?.id||"",date_from:z(i),date_to:z(c),timezone:p,member_status:Te(ge)},{data:k,loading:_}=ye({endpoint:"api_kpis",statsConfig:n,params:b}),w=A.useMemo(()=>G(k||[],a,"visits","sum")?.map(g=>{const y=Number(g.visits),C=isNaN(y)?0:y;return{date:String(g.date),value:C,formattedValue:m(C),label:"Visitors"}}),[k,a]),j=A.useMemo(()=>{const g=[0,1];if(!w||w.length===0)return g;const y=w.map(u=>u.value).filter(u=>u>=0);return y.length===0?g:[0,Math.max(...y)||g[1]]},[w]),V=A.useMemo(()=>{if(!o||o.length===0)return[];let g=[];return g=G(o,a,"value","exact"),g.map(u=>({date:u.date,value:u.free+u.paid,formattedValue:m(u.free+u.paid),label:"Members"}))},[o,a]),ie=A.useMemo(()=>{if(!s?.paidMembersEnabled||!o||o.length===0)return[];let g=[];return g=G(o,a,"mrr","exact"),g.map(u=>({date:u.date,value:O(u.mrr),formattedValue:`${d}${m(O(u.mrr))}`,label:"MRR"}))},[o,a,d,s]),ne=A.useMemo(()=>{if(!k?.length)return{visits:"0"};const g=k.reduce((y,C)=>{const u=Number(C.visits);return y+(isNaN(u)?0:u)},0);return{visits:m(g)}},[k]),oe=t;return e.jsxs(fe,{children:[e.jsx(be,{children:e.jsx(_e,{children:e.jsx(je,{excludeRanges:["today"]})})}),e.jsxs(ve,{isLoading:oe,loadingComponent:e.jsx(e.Fragment,{}),children:[e.jsx(Se,{currencySymbol:d,growthTotals:h,isLoading:_||l,kpiValues:ne,membersChartData:V,mrrChartData:ie,visitorsChartData:w,visitorsYRange:j}),e.jsx(He,{isLoading:r,latestPostStats:v}),e.jsx(Pe,{isLoading:f,topPostsData:x}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsx(he,{className:"mt-4 -mb-4 lg:col-span-2",children:"Grow your audience"}),e.jsx(ee,{description:"Find out how to review the performance of your content and get the most out of post analytics in Ghost.",title:"Understanding analytics in Ghost",url:"https://ghost.org/help/native-analytics",children:e.jsx("div",{className:"flex h-18 w-[100px] min-w-[100px] items-center justify-center rounded-md bg-gradient-to-tr from-[#14B8FF]/20 to-[#00BBA7]/20 p-4 opacity-80 transition-all group-hover/card:opacity-100",children:e.jsx(De,{className:"text-[#00BBA7]",size:20,strokeWidth:1.5})})}),e.jsx(ee,{description:"Use these content distribution tactics to get more people to discover your work and increase engagement.",title:"How to get your content seen online",url:"https://ghost.org/resources/content-distribution/",children:e.jsx("div",{className:"flex h-18 w-[100px] min-w-[100px] items-center justify-center rounded-md bg-gradient-to-tl from-[#FDC700]/20 to-[#FF2056]/20 p-4 opacity-80 transition-all group-hover/card:opacity-100",children:e.jsx(M,{className:"text-[#FE9A00]",size:20,strokeWidth:1.5})})})]})]})]})};export{Us as default};
@@ -1 +1 @@
1
- import{f as v,u as b,b as j,k as y,r as k,j as e,L as F,H as P,B,X as E,t as C,e as T,l as H,P as S,A as U,S as x,m as A,s as L,o as M,n as z}from"./index-CFEzD2_M.js";import{T as I}from"./topic-filter-BzqiVOAU.js";import{S as _}from"./sprout-956Q4On2.js";const f=({profile:s,update:l,isLoading:t,onOpenChange:r})=>{const o=H("index","me"),{data:m}=o,n=s.handle===m?.handle,p=()=>{l(s.id,{followedByMe:!0})},i=()=>{l(s.id,{followedByMe:!1})},c=j();return e.jsx("div",{className:"flex w-full cursor-pointer items-start gap-3 pt-4 [&:last-of-type>:nth-child(2)]:border-none",onClick:()=>{c(`/profile/${s.handle}`)},children:e.jsxs("div",{className:"flex w-full flex-col gap-1 border-b border-gray-200 pb-4 dark:border-gray-950",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(S,{actor:s,isCurrentUser:n,children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(U,{author:{icon:{url:s.avatarUrl},name:s.name,handle:s.handle},onClick:()=>r?.(!1)}),e.jsxs("div",{className:"break-anywhere -mt-0.5 flex grow flex-col",children:[e.jsx("span",{className:"line-clamp-1 font-semibold text-black dark:text-white",children:t?e.jsx(x,{className:"w-full max-w-48"}):s.name}),e.jsx("span",{className:"line-clamp-1 text-md text-gray-700 dark:text-gray-600",children:t?e.jsx(x,{className:"w-32"}):s.handle})]})]})}),t?e.jsx("div",{className:"inline-flex items-center",children:e.jsx(x,{className:"w-24"})}):n?null:e.jsx(A,{className:"ml-auto",following:s.followedByMe,handle:s.handle,type:"primary",onFollow:p,onUnfollow:i})]}),e.jsx("div",{className:"pl-[52px]",children:t?e.jsx(x,{className:"w-full max-w-96"}):s.bio&&e.jsx("div",{dangerouslySetInnerHTML:{__html:L(M(z(s.bio,["a","br"])))},className:"ap-profile-content break-anywhere pointer-events-none mt-0 line-clamp-2 max-w-[460px]"})})]})})},W=()=>{const{isExplainerClosed:s,setExplainerClosed:l}=v(),t=b(),r=j(),o=t.topic||"top",{exploreProfilesQuery:m,updateExploreProfile:n}=y("index",o),{data:p,isLoading:i,fetchNextPage:c,hasNextPage:h,isFetchingNextPage:u}=m,g=Array(10).fill(null).map((a,d)=>({id:`skeleton-${d}`,name:"",handle:"",avatarUrl:"",bio:"",url:"",followedByMe:!1})),w=p?.pages.flatMap(a=>a.accounts)||[];return k.useEffect(()=>{const a=document.querySelector(".load-more-trigger");if(!a)return;const d=new IntersectionObserver(N=>{N[0].isIntersecting&&h&&!u&&c()},{threshold:.1});return d.observe(a),()=>d.disconnect()},[h,u,c]),e.jsxs(F,{children:[!s&&e.jsxs("div",{className:"relative mb-6 flex items-start gap-1 rounded-md bg-gradient-to-r from-[#CFB0FF66] to-[#B6E8FF66] p-4 pr-10 dark:from-[#CFB0FF20] dark:to-[#B6E8FF20]",children:[e.jsx("div",{className:"min-w-[46px]",children:e.jsx(_,{className:"text-purple",size:46,strokeWidth:.75})}),e.jsxs("div",{className:"mt-1 flex flex-col gap-[2px]",children:[e.jsx(P,{className:"text-pretty",children:"The fastest way to grow your followers, is to follow others!"}),e.jsx("p",{className:"text-sm text-balance text-black/60 2xl:text-pretty dark:text-white/60",children:"Here are some recommendations to get you started, from Ghost publishers and other great accounts from around the social web."})]}),e.jsx(B,{className:"absolute top-[17px] right-4 size-6 opacity-40",variant:"link",onClick:()=>l(!0),children:e.jsx(E,{size:20})})]}),e.jsx(I,{currentTopic:o,excludeTopics:["following"],onTopicChange:a=>{a==="top"?r("/explore",{replace:!0}):r(`/explore/${a}`,{replace:!0})}}),e.jsx("div",{className:"mt-12 flex flex-col gap-12 pb-20 max-md:mt-5",children:i?e.jsx("div",{children:g.map(a=>e.jsx("div",{className:"mx-auto w-full max-w-[640px]",children:e.jsx(f,{isLoading:i,profile:a,update:()=>{}})},a.id))}):e.jsxs("div",{className:"mx-auto flex w-full max-w-[640px] flex-col items-center",children:[e.jsx("div",{className:"w-full",children:w.map(a=>e.jsx(C.Fragment,{children:e.jsx(f,{isLoading:!1,profile:a,update:n})},a.id))}),e.jsx("div",{className:"load-more-trigger h-4 w-full"}),u&&e.jsx("div",{className:"mt-2 flex w-full justify-center",children:e.jsx(T,{size:"sm"})})]})})]})};export{W as default};
1
+ import{f as v,u as b,b as j,k as y,r as k,j as e,L as F,H as P,B,X as E,t as C,e as T,l as H,P as S,A as U,S as x,m as A,s as L,o as M,n as z}from"./index-BkbhBpVC.js";import{T as I}from"./topic-filter-N3CzJ01P.js";import{S as _}from"./sprout-CpwUJAPT.js";const f=({profile:s,update:l,isLoading:t,onOpenChange:r})=>{const o=H("index","me"),{data:m}=o,n=s.handle===m?.handle,p=()=>{l(s.id,{followedByMe:!0})},i=()=>{l(s.id,{followedByMe:!1})},c=j();return e.jsx("div",{className:"flex w-full cursor-pointer items-start gap-3 pt-4 [&:last-of-type>:nth-child(2)]:border-none",onClick:()=>{c(`/profile/${s.handle}`)},children:e.jsxs("div",{className:"flex w-full flex-col gap-1 border-b border-gray-200 pb-4 dark:border-gray-950",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(S,{actor:s,isCurrentUser:n,children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(U,{author:{icon:{url:s.avatarUrl},name:s.name,handle:s.handle},onClick:()=>r?.(!1)}),e.jsxs("div",{className:"break-anywhere -mt-0.5 flex grow flex-col",children:[e.jsx("span",{className:"line-clamp-1 font-semibold text-black dark:text-white",children:t?e.jsx(x,{className:"w-full max-w-48"}):s.name}),e.jsx("span",{className:"line-clamp-1 text-md text-gray-700 dark:text-gray-600",children:t?e.jsx(x,{className:"w-32"}):s.handle})]})]})}),t?e.jsx("div",{className:"inline-flex items-center",children:e.jsx(x,{className:"w-24"})}):n?null:e.jsx(A,{className:"ml-auto",following:s.followedByMe,handle:s.handle,type:"primary",onFollow:p,onUnfollow:i})]}),e.jsx("div",{className:"pl-[52px]",children:t?e.jsx(x,{className:"w-full max-w-96"}):s.bio&&e.jsx("div",{dangerouslySetInnerHTML:{__html:L(M(z(s.bio,["a","br"])))},className:"ap-profile-content break-anywhere pointer-events-none mt-0 line-clamp-2 max-w-[460px]"})})]})})},W=()=>{const{isExplainerClosed:s,setExplainerClosed:l}=v(),t=b(),r=j(),o=t.topic||"top",{exploreProfilesQuery:m,updateExploreProfile:n}=y("index",o),{data:p,isLoading:i,fetchNextPage:c,hasNextPage:h,isFetchingNextPage:u}=m,g=Array(10).fill(null).map((a,d)=>({id:`skeleton-${d}`,name:"",handle:"",avatarUrl:"",bio:"",url:"",followedByMe:!1})),w=p?.pages.flatMap(a=>a.accounts)||[];return k.useEffect(()=>{const a=document.querySelector(".load-more-trigger");if(!a)return;const d=new IntersectionObserver(N=>{N[0].isIntersecting&&h&&!u&&c()},{threshold:.1});return d.observe(a),()=>d.disconnect()},[h,u,c]),e.jsxs(F,{children:[!s&&e.jsxs("div",{className:"relative mb-6 flex items-start gap-1 rounded-md bg-gradient-to-r from-[#CFB0FF66] to-[#B6E8FF66] p-4 pr-10 dark:from-[#CFB0FF20] dark:to-[#B6E8FF20]",children:[e.jsx("div",{className:"min-w-[46px]",children:e.jsx(_,{className:"text-purple",size:46,strokeWidth:.75})}),e.jsxs("div",{className:"mt-1 flex flex-col gap-[2px]",children:[e.jsx(P,{className:"text-pretty",children:"The fastest way to grow your followers, is to follow others!"}),e.jsx("p",{className:"text-sm text-balance text-black/60 2xl:text-pretty dark:text-white/60",children:"Here are some recommendations to get you started, from Ghost publishers and other great accounts from around the social web."})]}),e.jsx(B,{className:"absolute top-[17px] right-4 size-6 opacity-40",variant:"link",onClick:()=>l(!0),children:e.jsx(E,{size:20})})]}),e.jsx(I,{currentTopic:o,excludeTopics:["following"],onTopicChange:a=>{a==="top"?r("/explore",{replace:!0}):r(`/explore/${a}`,{replace:!0})}}),e.jsx("div",{className:"mt-12 flex flex-col gap-12 pb-20 max-md:mt-5",children:i?e.jsx("div",{children:g.map(a=>e.jsx("div",{className:"mx-auto w-full max-w-[640px]",children:e.jsx(f,{isLoading:i,profile:a,update:()=>{}})},a.id))}):e.jsxs("div",{className:"mx-auto flex w-full max-w-[640px] flex-col items-center",children:[e.jsx("div",{className:"w-full",children:w.map(a=>e.jsx(C.Fragment,{children:e.jsx(f,{isLoading:!1,profile:a,update:n})},a.id))}),e.jsx("div",{className:"load-more-trigger h-4 w-full"}),u&&e.jsx("div",{className:"mt-2 flex w-full justify-center",children:e.jsx(T,{size:"sm"})})]})})]})};export{W as default};