@chaibuilder/sdk 4.0.0-beta.4 → 4.0.0-beta.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -50
- package/dist/{2SSKDMRQ-CopJgtZb.cjs → 2SSKDMRQ-D-2rSLsq.cjs} +1 -1
- package/dist/{2SSKDMRQ-Difo_1pg.js → 2SSKDMRQ-DKit4bEt.js} +3 -3
- package/dist/{AP7HFJJL-BPuPBqj4.js → AP7HFJJL-BWruCozs.js} +1 -1
- package/dist/{AP7HFJJL-DYxDgaOs.cjs → AP7HFJJL-CAE2yHEv.cjs} +1 -1
- package/dist/{IconPicker-C0oycHbs.cjs → IconPicker-BCYCPK5M.cjs} +1 -1
- package/dist/{IconPicker-B2-oriq2.js → IconPicker-BOBnjfJc.js} +2 -2
- package/dist/STRINGS-BExFecZW.js +8 -0
- package/dist/STRINGS-FNnfjF5H.cjs +1 -0
- package/dist/{WDYDFRGG-DbejaRPK.cjs → WDYDFRGG-BNve1FlV.cjs} +1 -1
- package/dist/{WDYDFRGG-KK8pkcW1.js → WDYDFRGG-Bv40IVPG.js} +4 -4
- package/dist/{actions-registery-y_ENc8zj.js → actions-registery-CMKfEXxX.js} +3397 -3202
- package/dist/actions-registery-CqhNZFV3.cjs +481 -0
- package/dist/actions.cjs +1 -1
- package/dist/actions.d.ts +0 -158
- package/dist/actions.js +3 -3
- package/dist/{active-in-another-tab-Cu_ASKtx.cjs → active-in-another-tab-BPBvEwmD.cjs} +1 -1
- package/dist/{active-in-another-tab-DkR2HWI4.js → active-in-another-tab-C334yD2g.js} +5 -5
- package/dist/{add-new-language-page-BXuwluuU.cjs → add-new-language-page-BVME8b7v.cjs} +1 -1
- package/dist/{add-new-language-page-CBY0RR6q.js → add-new-language-page-DVL-HkWR.js} +4 -4
- package/dist/{add-new-page-C_PzKby8.cjs → add-new-page-BPysPck8.cjs} +1 -1
- package/dist/add-new-page-BQOsHkVl.js +31 -0
- package/dist/{ai-panel-content-rRmJdH7L.cjs → ai-panel-content-BsElc0Ke.cjs} +1 -1
- package/dist/{ai-panel-content--YM01Aly.js → ai-panel-content-BwX0YBGD.js} +6 -6
- package/dist/ai-panel-default-lang-BqhAu1iN.cjs +3 -0
- package/dist/ai-panel-default-lang-CYZuwSQn.js +317 -0
- package/dist/ai-panel-other-lang-CL83Mwha.js +132 -0
- package/dist/ai-panel-other-lang-CivH2s8Q.cjs +1 -0
- package/dist/{ai-prompt-input-N9PcYCFa.cjs → ai-prompt-input-BuP52voq.cjs} +1 -1
- package/dist/{ai-prompt-input-DueQYNf-.js → ai-prompt-input-C37B_jlE.js} +30 -34
- package/dist/{ai-translation-prompt-IAdWMNZb.cjs → ai-translation-prompt-CgZKlkF_.cjs} +1 -1
- package/dist/{ai-translation-prompt-B36F3d7K.js → ai-translation-prompt-V5PBEZRn.js} +2 -2
- package/dist/apply-binding-BuwI_Uf5.cjs +41 -0
- package/dist/apply-binding-RQRSIe56.js +942 -0
- package/dist/change-password-modal-AQU_GLqq.js +137 -0
- package/dist/change-password-modal-Chufk3yU.cjs +1 -0
- package/dist/{code-display-DloSPyPr.cjs → code-display-BR-gij5j.cjs} +1 -1
- package/dist/{code-display-Ck81Id9K.js → code-display-DdWcOQ_i.js} +1 -1
- package/dist/code-editor-D-fpas30.js +57 -0
- package/dist/code-editor-gqdLU-rU.cjs +1 -0
- package/dist/{continue-editing-in-this-client-DmGFLHXw.cjs → continue-editing-in-this-client-BNEnV0hi.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-Dm9cCj7K.js → continue-editing-in-this-client-Dx3f64SH.js} +3 -3
- package/dist/core-czmLeR0h.cjs +1 -0
- package/dist/core-nSRy3D7z.js +54 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +285 -103
- package/dist/core.js +71 -42
- package/dist/{css-import-modal-Rh1QAVxo.cjs → css-import-modal-B2NoLsdZ.cjs} +1 -1
- package/dist/{css-import-modal-9P_0uNa4.js → css-import-modal-c_6VH1js.js} +8 -8
- package/dist/default-theme-options-DN-3gIjM.cjs +22 -0
- package/dist/default-theme-options-saBIkWGT.js +248 -0
- package/dist/delete-page-B1R1w8O5.js +84 -0
- package/dist/delete-page-DbQDbCyB.cjs +1 -0
- package/dist/{design-token-usage-MNYsFlPG.js → design-token-usage-11kPk5n1.js} +26 -26
- package/dist/{design-token-usage-CXglXgcJ.cjs → design-token-usage-BBLfxzzo.cjs} +1 -1
- package/dist/digital-asset-manager-B0h5rUVQ.cjs +1 -0
- package/dist/{digital-asset-manager-CqCWBO0s.js → digital-asset-manager-BbEQ8cPb.js} +6 -6
- package/dist/{duplicate-page-BknLfqr0.js → duplicate-page-BY_Pcqbb.js} +7 -7
- package/dist/{duplicate-page-DzZByALW.cjs → duplicate-page-BaAzKbiX.cjs} +1 -1
- package/dist/{dynamic-page-selector-WA007Sni.cjs → dynamic-page-selector-DzH_gCQ4.cjs} +1 -1
- package/dist/{dynamic-page-selector-DoW7OyUB.js → dynamic-page-selector-bsaLGZkO.js} +16 -16
- package/dist/fonts/bungee/Bungee-Regular.woff2 +0 -0
- package/dist/fonts/dm_sans/dm-sans-variable.woff2 +0 -0
- package/dist/fonts/geist/Geist-VariableFont_wght.ttf +0 -0
- package/dist/fonts/geist/Geist-VariableFont_wght.woff2 +0 -0
- package/dist/fonts/geist/geist-variable.woff2 +0 -0
- package/dist/fonts/geist-mono/GeistMono-VariableFont_wght.woff2 +0 -0
- package/dist/fonts/inter/inter-latin.woff2 +0 -0
- package/dist/fonts/inter/inter-variable.woff2 +1449 -0
- package/dist/fonts/lato/lato-variable.woff2 +0 -0
- package/dist/fonts/lavishly_yours/lavishly-yours.woff2 +11 -0
- package/dist/fonts/merriweather/merriweather-variable.woff2 +11 -0
- package/dist/fonts/montserrat/montserrat-variable.woff2 +0 -0
- package/dist/fonts/nunito_sans/nunito-sans-variable.woff2 +11 -0
- package/dist/fonts/open_sans/open-sans-variable.woff2 +0 -0
- package/dist/fonts/oswald/oswald-variable.woff2 +0 -0
- package/dist/fonts/playfair_display/playfair-display-variable.woff2 +11 -0
- package/dist/fonts/poppins/poppins-variable.woff2 +0 -0
- package/dist/fonts/raleway/raleway-variable.woff2 +0 -0
- package/dist/fonts/roboto/roboto-variable.woff2 +11 -0
- package/dist/fonts/source_sans_3/source-sans-3-variable.woff2 +11 -0
- package/dist/fonts/ubuntu/ubuntu-variable.woff2 +0 -0
- package/dist/fonts-B3UYxuJI.js +25 -0
- package/dist/fonts-D5fTqvSS.cjs +1 -0
- package/dist/{get-chai-builder-tailwind-config-BFePCEIS.cjs → get-chai-builder-tailwind-config-7CxFxEYL.cjs} +1 -1
- package/dist/{get-chai-builder-tailwind-config-BXf_xLHk.js → get-chai-builder-tailwind-config-DC4sDOYK.js} +5 -5
- package/dist/get-chai-builder-theme-C_qofMh_.cjs +1 -0
- package/dist/{get-chai-builder-theme-DDVRJQ6Z.js → get-chai-builder-theme-CyOkIlte.js} +1 -1
- package/dist/{image-compression-DsZ1oqpb.js → image-compression-DPFITwOL.js} +2 -2
- package/dist/image-compression-UaU7Bwqe.cjs +1 -0
- package/dist/{image-editor-CqwaVxO2.cjs → image-editor-Cfn290vp.cjs} +1 -1
- package/dist/{image-editor-CQnNtak2.js → image-editor-CyGqVNvX.js} +1 -1
- package/dist/index-BpVxZOd-.js +5082 -0
- package/dist/index-CQf0jL1k.cjs +5 -0
- package/dist/{index-rAcNbjk_.js → index-DpeytsiB.js} +6145 -6091
- package/dist/index-P-2SvZA9.cjs +160 -0
- package/dist/{json-diff-viewer-CLuUHiPU.cjs → json-diff-viewer-BBERGXdt.cjs} +7 -7
- package/dist/{json-diff-viewer-CMvGUvJ2.js → json-diff-viewer-C-bpInzt.js} +87 -85
- package/dist/{lang-panel-CnwTb05j.js → lang-panel-4Q_PTmKm.js} +26 -26
- package/dist/lang-panel-uI149Beq.cjs +1 -0
- package/dist/library-blocks/bento/agency-showcase/agency-showcase.html +175 -0
- package/dist/library-blocks/bento/agency-showcase/agency-showcase.webp +0 -0
- package/dist/library-blocks/bento/creative-portfolio/creative-portfolio.html +116 -0
- package/dist/library-blocks/bento/creative-portfolio/creative-portfolio.webp +0 -0
- package/dist/library-blocks/bento/product-features/product-features.html +159 -0
- package/dist/library-blocks/bento/product-features/product-features.webp +0 -0
- package/dist/library-blocks/bento/saas-dashboard/saas-dashboard.html +182 -0
- package/dist/library-blocks/bento/saas-dashboard/saas-dashboard.webp +0 -0
- package/dist/library-blocks/bento/startup-metrics/startup-metrics.html +170 -0
- package/dist/library-blocks/bento/startup-metrics/startup-metrics.webp +0 -0
- package/dist/library-blocks/blocks-list.json +149 -0
- package/dist/library-blocks/feature/agency-services/agency-services.html +194 -0
- package/dist/library-blocks/feature/agency-services/agency-services.webp +0 -0
- package/dist/library-blocks/feature/consulting-firm/consulting-firm.html +219 -0
- package/dist/library-blocks/feature/consulting-firm/consulting-firm.webp +0 -0
- package/dist/library-blocks/feature/design-studio/design-studio.html +190 -0
- package/dist/library-blocks/feature/design-studio/design-studio.webp +0 -0
- package/dist/library-blocks/feature/freelancer-toolkit/freelancer-toolkit.html +195 -0
- package/dist/library-blocks/feature/freelancer-toolkit/freelancer-toolkit.webp +0 -0
- package/dist/library-blocks/feature/marketing-agency/marketing-agency.html +212 -0
- package/dist/library-blocks/feature/marketing-agency/marketing-agency.webp +0 -0
- package/dist/library-blocks/footer/creative-agency/creative-agency.html +64 -0
- package/dist/library-blocks/footer/creative-agency/creative-agency.webp +0 -0
- package/dist/library-blocks/footer/minimal-portfolio/minimal-portfolio.html +106 -0
- package/dist/library-blocks/footer/minimal-portfolio/minimal-portfolio.webp +0 -0
- package/dist/library-blocks/footer/saas-startup/saas-startup.html +117 -0
- package/dist/library-blocks/footer/saas-startup/saas-startup.webp +0 -0
- package/dist/library-blocks/hero/creative-agency/creative-agency.html +117 -0
- package/dist/library-blocks/hero/creative-agency/creative-agency.webp +0 -0
- package/dist/library-blocks/hero/developer-focused/developer-focused.html +124 -0
- package/dist/library-blocks/hero/developer-focused/developer-focused.webp +0 -0
- package/dist/library-blocks/hero/minimal-saas/minimal-saas.html +98 -0
- package/dist/library-blocks/hero/minimal-saas/minimal-saas.webp +0 -0
- package/dist/library-blocks/hero/portfolio-showcase/portfolio-showcase.html +148 -0
- package/dist/library-blocks/hero/portfolio-showcase/portfolio-showcase.webp +0 -0
- package/dist/library-blocks/hero/startup-landing/startup-landing.html +130 -0
- package/dist/library-blocks/hero/startup-landing/startup-landing.webp +0 -0
- package/dist/library-blocks/navbar/creative-agency/creative-agency.html +139 -0
- package/dist/library-blocks/navbar/creative-agency/creative-agency.webp +0 -0
- package/dist/library-blocks/navbar/minimal-portfolio/minimal-portfolio.html +164 -0
- package/dist/library-blocks/navbar/minimal-portfolio/minimal-portfolio.webp +0 -0
- package/dist/library-blocks/navbar/saas-startup/saas-startup.html +129 -0
- package/dist/library-blocks/navbar/saas-startup/saas-startup.webp +0 -0
- package/dist/manage-design-tokens-B_-TrQgu.cjs +1 -0
- package/dist/manage-design-tokens-CHpHE-dx.js +446 -0
- package/dist/manage-design-tokens-modal-Bug5H8PT.cjs +1 -0
- package/dist/manage-design-tokens-modal-DO_tHkgp.js +161 -0
- package/dist/{mark-as-template-CpWEBJGd.cjs → mark-as-template-BEnMYTql.cjs} +1 -1
- package/dist/{mark-as-template-DBLshWb5.js → mark-as-template-Ca3QLzX4.js} +11 -11
- package/dist/{nested-path-selector-content-6OBJ8LG8.js → nested-path-selector-content-5gECLoRV.js} +2 -2
- package/dist/{nested-path-selector-content-C2sD9dkq.cjs → nested-path-selector-content-BHPOfftZ.cjs} +1 -1
- package/dist/{no-language-page-content-CzENgtnu.js → no-language-page-content-Bb3nUSLv.js} +9 -9
- package/dist/{no-language-page-content-BvPDdccK.cjs → no-language-page-content-CKxggLC_.cjs} +1 -1
- package/dist/{no-language-page-dialog-CbYI2cVg.js → no-language-page-dialog-BEVRCAhM.js} +2 -2
- package/dist/{no-language-page-dialog-CgW4yJBC.cjs → no-language-page-dialog-DMb5Z5on.cjs} +1 -1
- package/dist/page-creator-C_95U8kn.cjs +1 -0
- package/dist/{page-creator-Cc83uQqw.js → page-creator-DQRFXhNj.js} +143 -143
- package/dist/{page-lock-BJUkyxdh.js → page-lock-Be5wPHz5.js} +2 -2
- package/dist/{page-lock-CT7SmQqp.cjs → page-lock-DKWt66MX.cjs} +1 -1
- package/dist/page-locked-dialog-CWyZol0i.cjs +1 -0
- package/dist/{page-locked-dialog-DsEbWRed.js → page-locked-dialog-CkXpQUpO.js} +22 -22
- package/dist/page-manager-new-2gYNPR6y.js +408 -0
- package/dist/page-manager-new-Bt7rBO1J.cjs +1 -0
- package/dist/{page-manager-search-and-filter-zq-LfhQ1.js → page-manager-search-and-filter-BotSCoAo.js} +30 -29
- package/dist/{page-manager-search-and-filter-Bfm0j1gg.cjs → page-manager-search-and-filter-Dkwl089C.cjs} +1 -1
- package/dist/{page-revisions-content-D38G2tJM.js → page-revisions-content-OigWteYc.js} +133 -122
- package/dist/page-revisions-content-bQ32feXp.cjs +1 -0
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +330 -96
- package/dist/pages.js +23 -19
- package/dist/{publish-pages-content-CS7f41Ac.js → publish-pages-content-2RcG3Ptp.js} +39 -39
- package/dist/publish-pages-content-Dtkal6ue.cjs +1 -0
- package/dist/{register-chai-top-bar-ESJHs5s-.js → register-chai-top-bar-D6GjnauV.js} +87 -87
- package/dist/register-chai-top-bar-DyW9GPzV.cjs +1 -0
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +20 -18
- package/dist/render.js +133 -132
- package/dist/{rte-widget-modal-BKNx2wln.cjs → rte-widget-modal-CHxO3TQR.cjs} +1 -1
- package/dist/{rte-widget-modal-D6Zik0Ta.js → rte-widget-modal-DmQk0Lfj.js} +10 -10
- package/dist/runtime-client.cjs +1 -0
- package/dist/runtime-client.d.ts +158 -0
- package/dist/runtime-client.js +32 -0
- package/dist/runtime.cjs +11 -1
- package/dist/runtime.d.ts +153 -270
- package/dist/runtime.js +107 -71
- package/dist/save-to-lib-BSsuvkZS.cjs +1 -0
- package/dist/{save-to-lib-WwOzbgiF.js → save-to-lib-CVqlFkRK.js} +153 -147
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-BOgnQRLF.cjs → selected-block-display-Cr7R1ojV.cjs} +1 -1
- package/dist/{selected-block-display-B1SG_UXw.js → selected-block-display-DngI-pF1.js} +12 -12
- package/dist/seo-panel-BMYdzcoJ.cjs +2 -0
- package/dist/{seo-panel-BkOgRoWd.js → seo-panel-CHkFLI5b.js} +27 -27
- package/dist/{shared-json-ld-uka9TOgA.js → shared-json-ld-BzjOUN-P.js} +88 -88
- package/dist/shared-json-ld-ClIZw1aA.cjs +1 -0
- package/dist/{slug-input-DHLmUNrH.js → slug-input-07EKw9U5.js} +8 -8
- package/dist/{slug-input-Cyd6NR6J.cjs → slug-input-DHVDl_Dv.cjs} +1 -1
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.d.ts +45 -0
- package/dist/supabase-actions.js +380 -275
- package/dist/take-over-request-BLdOZhUs.cjs +1 -0
- package/dist/{take-over-request-Ca0X-qyf.js → take-over-request-zqtItFSK.js} +13 -13
- package/dist/{translation-warning-modal-pSZVKcNW.cjs → translation-warning-modal-BxV_8mCE.cjs} +1 -1
- package/dist/{translation-warning-modal-DrpFeI83.js → translation-warning-modal-DnSd7lOJ.js} +9 -9
- package/dist/types.cjs +1 -0
- package/dist/types.d.ts +756 -0
- package/dist/types.js +1 -0
- package/dist/{unmark-as-template-DF1Ms4VN.cjs → unmark-as-template-C4UkGyOP.cjs} +1 -1
- package/dist/{unmark-as-template-BMqgelv-.js → unmark-as-template-DIKZYr01.js} +11 -11
- package/dist/unpublish-page-CK0sAZcB.js +28 -0
- package/dist/{unpublish-page-Bsq2yEqQ.cjs → unpublish-page-DFXLzJbc.cjs} +1 -1
- package/dist/unpublished-partials-modal-BAr1SkEG.cjs +1 -0
- package/dist/unpublished-partials-modal-CDaOvXgp.js +52 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.ts +6 -6
- package/dist/utils.js +2 -2
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +360 -351
- package/dist/{web-preview-D6h1L2nV.js → web-preview-CRSjh2he.js} +2 -2
- package/dist/{web-preview-kres0aG7.cjs → web-preview-DA7_F3vv.cjs} +1 -1
- package/package.json +34 -35
- package/dist/actions-registery-JdxhXhT6.cjs +0 -418
- package/dist/add-new-page-DJLJFLAd.js +0 -31
- package/dist/ai-panel-default-lang-BZl0tPYo.js +0 -341
- package/dist/ai-panel-default-lang-D2zhXvKP.cjs +0 -3
- package/dist/ai-panel-other-lang-Bfjk2CYZ.js +0 -162
- package/dist/ai-panel-other-lang-Y4bEKHoG.cjs +0 -1
- package/dist/apply-binding-BvWfJCSZ.js +0 -841
- package/dist/apply-binding-IsUf6UWJ.cjs +0 -1
- package/dist/code-editor-Bb7JumZy.js +0 -51
- package/dist/code-editor-DQB8lAOk.cjs +0 -1
- package/dist/core-Dr7QYemB.js +0 -56
- package/dist/core-Y0lXLwkq.cjs +0 -1
- package/dist/delete-design-token-BG8yHcS5.cjs +0 -1
- package/dist/delete-design-token-COvR4G1S.js +0 -40
- package/dist/delete-page-CNucxe4P.js +0 -71
- package/dist/delete-page-DAvEjHwF.cjs +0 -1
- package/dist/digital-asset-manager-CB5MRBcW.cjs +0 -1
- package/dist/fonts/GeistMonoVF.woff +0 -0
- package/dist/fonts/GeistVF.woff +0 -0
- package/dist/fonts-B-Xt29pe.cjs +0 -1
- package/dist/fonts-DRly3Wzd.js +0 -78
- package/dist/get-chai-builder-theme-BApShjRz.cjs +0 -1
- package/dist/image-compression-DZ9WMmyn.cjs +0 -1
- package/dist/index-B-rSiAp_.cjs +0 -1
- package/dist/index-C0-pgg_p.cjs +0 -5
- package/dist/index-C99FhuF1.cjs +0 -160
- package/dist/index-Dno42B0a.js +0 -4734
- package/dist/index-Dxfyt4d4.js +0 -39
- package/dist/lang-panel-fDCYm5Jm.cjs +0 -1
- package/dist/manage-design-tokens-BsSZE9Vs.js +0 -241
- package/dist/manage-design-tokens-BvH5KTJX.cjs +0 -1
- package/dist/page-creator-g8GqgcKH.cjs +0 -1
- package/dist/page-locked-dialog-Co5b9XIZ.cjs +0 -1
- package/dist/page-manager-new-5rFP5DyQ.js +0 -395
- package/dist/page-manager-new-BOkJImo2.cjs +0 -1
- package/dist/page-revisions-content-ag-MHBGr.cjs +0 -1
- package/dist/plugin-BGlQf0iy.cjs +0 -22
- package/dist/plugin-C-ht41UZ.js +0 -245
- package/dist/publish-pages-content-BiX-GMLw.cjs +0 -1
- package/dist/register-chai-top-bar-BqwKw4uy.cjs +0 -1
- package/dist/save-to-lib-ffjCZYJ5.cjs +0 -1
- package/dist/seo-panel-FjS1UF_y.cjs +0 -2
- package/dist/shared-json-ld-yJkXjENy.cjs +0 -1
- package/dist/take-over-request-CmpJVe9T.cjs +0 -1
- package/dist/theme-panel-footer-BUXIu252.js +0 -26
- package/dist/theme-panel-footer-CKO9YYwZ.cjs +0 -1
- package/dist/unpublish-page-BJ0Bsvt2.js +0 -28
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { jsxs as a, Fragment as p, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { B as g } from "./register-chai-top-bar-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { useQuery as pe, useQueryClient as O, useMutation as
|
|
6
|
-
import { format as
|
|
2
|
+
import { B as g } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
+
import { d as le, ac as re, ad as ie, a7 as de, ae as v, F as ce, D as V, e as G, f as j, g as L, o as $, q as z, r as oe, s as ue, t as me, v as _, af as he } from "./index-DpeytsiB.js";
|
|
4
|
+
import { ap as C, aq as A, A as y, au as H, ay as fe, an as I, av as E, aw as D } from "./index-BpVxZOd-.js";
|
|
5
|
+
import { useQuery as pe, useQueryClient as O, useMutation as P } from "@tanstack/react-query";
|
|
6
|
+
import { format as S, formatDistanceToNow as xe } from "date-fns";
|
|
7
7
|
import { isEmpty as ge } from "lodash-es";
|
|
8
|
-
import { FileJson as Ne, CloudOff as be, Undo2 as
|
|
9
|
-
import * as
|
|
10
|
-
import { useEffect as F, startTransition as Se, useState as
|
|
8
|
+
import { FileJson as Ne, CloudOff as be, Undo2 as J, Trash as Q, X as ye, Rocket as ve, Save as we, MoreHorizontal as De } from "lucide-react";
|
|
9
|
+
import * as w from "react";
|
|
10
|
+
import { useEffect as F, startTransition as Se, useState as Re, Suspense as Ee, lazy as Ce } from "react";
|
|
11
11
|
function Ae(t) {
|
|
12
|
-
const s =
|
|
12
|
+
const s = C(), n = A();
|
|
13
13
|
return pe({
|
|
14
|
-
queryKey: [
|
|
14
|
+
queryKey: [y.GET_PAGE_REVISIONS, t],
|
|
15
15
|
queryFn: async () => await n(s, {
|
|
16
|
-
action:
|
|
16
|
+
action: y.GET_PAGE_REVISIONS,
|
|
17
17
|
data: { pageId: t }
|
|
18
18
|
}),
|
|
19
19
|
enabled: !!t,
|
|
@@ -21,10 +21,10 @@ function Ae(t) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
const Ie = () => {
|
|
24
|
-
const t =
|
|
25
|
-
return
|
|
24
|
+
const t = C(), s = A(), n = O();
|
|
25
|
+
return P({
|
|
26
26
|
mutationFn: async (i) => await s(t, {
|
|
27
|
-
action:
|
|
27
|
+
action: y.DELETE_PAGE_REVISION,
|
|
28
28
|
data: { revisionId: i }
|
|
29
29
|
}),
|
|
30
30
|
onSuccess: () => {
|
|
@@ -34,11 +34,15 @@ const Ie = () => {
|
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
}, Oe = () => {
|
|
37
|
-
const t =
|
|
38
|
-
return
|
|
39
|
-
mutationFn: async ({
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
const t = C(), s = A(), n = O();
|
|
38
|
+
return P({
|
|
39
|
+
mutationFn: async ({
|
|
40
|
+
revisionId: i,
|
|
41
|
+
discardCurrent: r,
|
|
42
|
+
pageId: d
|
|
43
|
+
}) => await s(t, {
|
|
44
|
+
action: y.RESTORE_PAGE_REVISION,
|
|
45
|
+
data: { revisionId: i, discardCurrent: r, ...d && { pageId: d } }
|
|
42
46
|
}),
|
|
43
47
|
onSuccess: () => {
|
|
44
48
|
n.invalidateQueries({
|
|
@@ -46,7 +50,7 @@ const Ie = () => {
|
|
|
46
50
|
});
|
|
47
51
|
}
|
|
48
52
|
});
|
|
49
|
-
},
|
|
53
|
+
}, Te = Ce(() => import("./json-diff-viewer-C-bpInzt.js")), N = ({ tag: t }) => t === "draft" ? /* @__PURE__ */ a("div", { className: "flex items-center gap-1 rounded-full bg-amber-500/10 px-1.5 py-0.5 text-xs text-amber-600", children: [
|
|
50
54
|
/* @__PURE__ */ a("span", { className: "relative flex h-2 w-2", children: [
|
|
51
55
|
/* @__PURE__ */ e("span", { className: "absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75" }),
|
|
52
56
|
/* @__PURE__ */ e("span", { className: "relative inline-flex h-2 w-2 rounded-full bg-amber-500" })
|
|
@@ -65,23 +69,23 @@ const Ie = () => {
|
|
|
65
69
|
/* @__PURE__ */ e(we, { className: "h-3 w-3" }),
|
|
66
70
|
/* @__PURE__ */ e("span", { className: "text-[11px] leading-tight", children: "Unsaved changes" })
|
|
67
71
|
] }) : /* @__PURE__ */ e("span", { className: "rounded bg-purple-500/10 px-1.5 py-0.5 font-mono text-xs font-bold text-purple-600", children: t });
|
|
68
|
-
function
|
|
69
|
-
const { data: n } =
|
|
72
|
+
function ke({ compare: t, setCompare: s }) {
|
|
73
|
+
const { data: n } = H(), { saveState: i } = ce(), [r] = fe();
|
|
70
74
|
if (!n) return null;
|
|
71
|
-
const d = !!t.find((
|
|
72
|
-
var
|
|
73
|
-
return (
|
|
74
|
-
}),
|
|
75
|
+
const d = !!t.find((u) => {
|
|
76
|
+
var l;
|
|
77
|
+
return (l = u == null ? void 0 : u.uid) == null ? void 0 : l.startsWith("draft:");
|
|
78
|
+
}), o = t.length >= 2 && !d, m = i === "UNSAVED";
|
|
75
79
|
return /* @__PURE__ */ a("div", { className: "relative flex items-start gap-3 rounded-md border bg-primary/5 p-2 hover:bg-accent/50", children: [
|
|
76
80
|
/* @__PURE__ */ a("div", { className: "flex-1 space-y-1", children: [
|
|
77
81
|
/* @__PURE__ */ e("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ a("div", { className: "flex items-center gap-1 text-sm font-medium leading-none", children: [
|
|
78
82
|
/* @__PURE__ */ e(N, { tag: "draft" }),
|
|
79
83
|
/* @__PURE__ */ e("span", { className: "text-xs font-bold", children: "Currently editing" })
|
|
80
84
|
] }) }),
|
|
81
|
-
/* @__PURE__ */ e("div", { className: "flex items-center pl-2 text-[11px] text-muted-foreground", children: !ge(
|
|
85
|
+
/* @__PURE__ */ e("div", { className: "flex items-center pl-2 text-[11px] text-muted-foreground", children: !ge(r.lastSaved) && /* @__PURE__ */ a("span", { children: [
|
|
82
86
|
"Last updated",
|
|
83
87
|
" ",
|
|
84
|
-
xe(new Date(
|
|
88
|
+
xe(new Date(r.lastSaved), {
|
|
85
89
|
addSuffix: !0
|
|
86
90
|
})
|
|
87
91
|
] }) }),
|
|
@@ -91,9 +95,9 @@ function Me({ compare: t, setCompare: s }) {
|
|
|
91
95
|
K,
|
|
92
96
|
{
|
|
93
97
|
checked: d,
|
|
94
|
-
disabled:
|
|
98
|
+
disabled: o,
|
|
95
99
|
onChange: () => {
|
|
96
|
-
s(d ? t.filter((
|
|
100
|
+
s(d ? t.filter((u) => u.uid !== `draft:${n == null ? void 0 : n.id}`) : [
|
|
97
101
|
...t,
|
|
98
102
|
{ uid: `draft:${n == null ? void 0 : n.id}`, label: "draft", item: { createdAt: Date.now() } }
|
|
99
103
|
]);
|
|
@@ -102,56 +106,56 @@ function Me({ compare: t, setCompare: s }) {
|
|
|
102
106
|
)
|
|
103
107
|
] });
|
|
104
108
|
}
|
|
105
|
-
function
|
|
109
|
+
function Me() {
|
|
106
110
|
return /* @__PURE__ */ e("div", { className: "mt-2 space-y-2", children: Array.from({ length: 5 }).map((t, s) => /* @__PURE__ */ a("div", { className: "flex items-start gap-3 rounded-md border p-2", children: [
|
|
107
111
|
/* @__PURE__ */ a("div", { className: "flex-1 space-y-1", children: [
|
|
108
|
-
/* @__PURE__ */ e(
|
|
109
|
-
/* @__PURE__ */ e(
|
|
110
|
-
/* @__PURE__ */ e(
|
|
112
|
+
/* @__PURE__ */ e(v, { className: "h-4 w-3/4" }),
|
|
113
|
+
/* @__PURE__ */ e(v, { className: "h-3 w-1/2" }),
|
|
114
|
+
/* @__PURE__ */ e(v, { className: "mt-1 h-5 w-20" })
|
|
111
115
|
] }),
|
|
112
|
-
/* @__PURE__ */ e(
|
|
116
|
+
/* @__PURE__ */ e(v, { className: "h-8 w-8 rounded-full" })
|
|
113
117
|
] }, s)) });
|
|
114
118
|
}
|
|
115
|
-
function
|
|
119
|
+
function U({
|
|
116
120
|
revision: t,
|
|
117
121
|
isLatest: s,
|
|
118
122
|
onRestore: n,
|
|
119
123
|
onDelete: i,
|
|
120
|
-
revisionNumber:
|
|
124
|
+
revisionNumber: r,
|
|
121
125
|
compare: d,
|
|
122
|
-
setCompare:
|
|
126
|
+
setCompare: o,
|
|
123
127
|
pageId: m
|
|
124
128
|
}) {
|
|
125
|
-
const { data:
|
|
129
|
+
const { data: u } = I(t.currentEditor), l = (u == null ? void 0 : u.name) || "Unknown", f = !!d.find((h) => {
|
|
126
130
|
var x;
|
|
127
131
|
return s ? (x = h == null ? void 0 : h.uid) == null ? void 0 : x.startsWith("live") : (h == null ? void 0 : h.uid) === t.uid;
|
|
128
|
-
}),
|
|
132
|
+
}), R = d.length >= 2 && !f;
|
|
129
133
|
return /* @__PURE__ */ a("div", { className: "relative flex items-start gap-3 rounded-md border p-2 hover:bg-accent/50", children: [
|
|
130
134
|
/* @__PURE__ */ a("div", { className: "flex-1 space-y-3", children: [
|
|
131
135
|
/* @__PURE__ */ e("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ a("p", { className: "flex items-center gap-1 text-xs leading-none", children: [
|
|
132
|
-
/* @__PURE__ */ e(N, { tag: s ? "live" : `#${
|
|
136
|
+
/* @__PURE__ */ e(N, { tag: s ? "live" : `#${r}` }),
|
|
133
137
|
t.type === "published" ? "Published" : "Draft",
|
|
134
138
|
" by ",
|
|
135
|
-
/* @__PURE__ */ e("span", { className: "text-xs font-bold", children:
|
|
139
|
+
/* @__PURE__ */ e("span", { className: "text-xs font-bold", children: l })
|
|
136
140
|
] }) }),
|
|
137
141
|
/* @__PURE__ */ a("div", { className: "flex items-center gap-x-3", children: [
|
|
138
142
|
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: t.type === "published" ? /* @__PURE__ */ e(N, { tag: "published" }) : /* @__PURE__ */ e(N, { tag: "draft" }) }),
|
|
139
|
-
/* @__PURE__ */ e("div", { className: "flex items-center text-[10px] text-muted-foreground", children: /* @__PURE__ */ e("span", { className: "leading-tight", children:
|
|
143
|
+
/* @__PURE__ */ e("div", { className: "flex items-center text-[10px] text-muted-foreground", children: /* @__PURE__ */ e("span", { className: "leading-tight", children: S(t.createdAt, "MMM d, yyyy, h:mm a") }) })
|
|
140
144
|
] })
|
|
141
145
|
] }),
|
|
142
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e(
|
|
146
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e(E, { permissions: [D.RESTORE_REVISION, D.DELETE_REVISION], children: /* @__PURE__ */ e(Fe, { revision: t, onRestore: n, onDelete: i }) }) }),
|
|
143
147
|
/* @__PURE__ */ e(
|
|
144
148
|
K,
|
|
145
149
|
{
|
|
146
150
|
checked: f,
|
|
147
|
-
disabled:
|
|
151
|
+
disabled: R,
|
|
148
152
|
onChange: () => {
|
|
149
|
-
|
|
153
|
+
o(
|
|
150
154
|
f ? d.filter((h) => s ? h.uid !== `live:${m}` : h.uid !== t.uid) : [
|
|
151
155
|
...d,
|
|
152
156
|
{
|
|
153
157
|
uid: s ? `live:${m}` : t.uid,
|
|
154
|
-
label: s ? "live" : `#${
|
|
158
|
+
label: s ? "live" : `#${r}`,
|
|
155
159
|
item: t
|
|
156
160
|
}
|
|
157
161
|
].sort((h, x) => new Date(h.item.createdAt).getTime() - new Date(x.item.createdAt).getTime())
|
|
@@ -161,28 +165,31 @@ function V({
|
|
|
161
165
|
)
|
|
162
166
|
] });
|
|
163
167
|
}
|
|
164
|
-
function
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
const m = ({ tab: o }) => /* @__PURE__ */ a("span", { className: "flex items-center justify-between rounded border border-blue-100 p-1 font-medium", children: [
|
|
168
|
-
/* @__PURE__ */ e(N, { tag: o.label }),
|
|
168
|
+
function q({ tab: t, onRemove: s }) {
|
|
169
|
+
return /* @__PURE__ */ a("span", { className: "flex items-center justify-between rounded border border-blue-100 p-1 font-medium", children: [
|
|
170
|
+
/* @__PURE__ */ e(N, { tag: t.label }),
|
|
169
171
|
/* @__PURE__ */ e(
|
|
170
172
|
"button",
|
|
171
173
|
{
|
|
172
174
|
className: "z-0 flex h-4 w-4 items-center justify-center rounded-full text-gray-400 hover:text-red-500",
|
|
173
175
|
style: { lineHeight: 1 },
|
|
174
|
-
onClick: () => s(t.
|
|
175
|
-
"aria-label": "Remove selection
|
|
176
|
+
onClick: () => s(t.uid),
|
|
177
|
+
"aria-label": "Remove selection",
|
|
176
178
|
children: /* @__PURE__ */ e(ye, { className: "h-3 w-3" })
|
|
177
179
|
}
|
|
178
180
|
)
|
|
179
181
|
] });
|
|
182
|
+
}
|
|
183
|
+
function _e({ compare: t, setCompare: s, pageId: n }) {
|
|
184
|
+
const [i, r] = Re(!1), [d, o] = t;
|
|
185
|
+
if (t.length === 0) return null;
|
|
186
|
+
const m = (u) => s(t.filter((l) => l.uid !== u));
|
|
180
187
|
return /* @__PURE__ */ a("div", { className: "mb-2 flex w-full max-w-md flex-col gap-1 rounded border bg-accent/60 p-2 shadow-sm", children: [
|
|
181
188
|
/* @__PURE__ */ a("div", { className: "flex items-center gap-x-2 text-xs", children: [
|
|
182
189
|
/* @__PURE__ */ e("span", { className: "font-medium leading-tight text-gray-600", children: "Compare" }),
|
|
183
|
-
d && /* @__PURE__ */ e(
|
|
190
|
+
d && /* @__PURE__ */ e(q, { tab: d, onRemove: m }),
|
|
184
191
|
/* @__PURE__ */ e("span", { className: "font-medium leading-tight text-gray-600", children: "with" }),
|
|
185
|
-
|
|
192
|
+
o ? /* @__PURE__ */ e(q, { tab: o, onRemove: m }) : /* @__PURE__ */ e("span", { className: "rounded border px-1 text-xs text-muted-foreground", children: "Choose another" })
|
|
186
193
|
] }),
|
|
187
194
|
/* @__PURE__ */ a("div", { className: "flex items-center justify-end gap-2 pb-0.5 pt-2", children: [
|
|
188
195
|
/* @__PURE__ */ e(
|
|
@@ -201,7 +208,7 @@ function _e({ compare: t, setCompare: s, pageId: n }) {
|
|
|
201
208
|
size: "sm",
|
|
202
209
|
className: "h-6 gap-1 rounded px-2 text-xs leading-none",
|
|
203
210
|
variant: "default",
|
|
204
|
-
onClick: () =>
|
|
211
|
+
onClick: () => r(!0),
|
|
205
212
|
disabled: t.length < 2,
|
|
206
213
|
children: [
|
|
207
214
|
/* @__PURE__ */ e(Ne, { className: "h-2.5 w-2.5" }),
|
|
@@ -211,10 +218,10 @@ function _e({ compare: t, setCompare: s, pageId: n }) {
|
|
|
211
218
|
)
|
|
212
219
|
] }),
|
|
213
220
|
i && (t == null ? void 0 : t.length) > 1 && n && /* @__PURE__ */ e(
|
|
214
|
-
|
|
221
|
+
Ee,
|
|
215
222
|
{
|
|
216
223
|
fallback: /* @__PURE__ */ e("div", { className: "flex items-center justify-center p-4", children: /* @__PURE__ */ e("span", { className: "text-sm", children: "Loading diff viewer..." }) }),
|
|
217
|
-
children: /* @__PURE__ */ e(
|
|
224
|
+
children: /* @__PURE__ */ e(Te, { open: i, onOpenChange: r, compare: t })
|
|
218
225
|
}
|
|
219
226
|
)
|
|
220
227
|
] });
|
|
@@ -234,69 +241,69 @@ function K({ checked: t, disabled: s, onChange: n, label: i = "Compare" }) {
|
|
|
234
241
|
/* @__PURE__ */ e("span", { className: "select-none leading-tight", children: i })
|
|
235
242
|
] }) });
|
|
236
243
|
}
|
|
237
|
-
function
|
|
244
|
+
function Fe({ revision: t, onRestore: s, onDelete: n }) {
|
|
238
245
|
return /* @__PURE__ */ a(oe, { children: [
|
|
239
246
|
/* @__PURE__ */ e(ue, { asChild: !0, children: /* @__PURE__ */ a(g, { variant: "ghost", size: "icon", className: "h-5 w-5", children: [
|
|
240
247
|
/* @__PURE__ */ e(De, { className: "h-4 w-4" }),
|
|
241
248
|
/* @__PURE__ */ e("span", { className: "sr-only", children: "More options" })
|
|
242
249
|
] }) }),
|
|
243
250
|
/* @__PURE__ */ a(me, { align: "end", className: "text-xs", children: [
|
|
244
|
-
/* @__PURE__ */ e(
|
|
245
|
-
/* @__PURE__ */ e(
|
|
251
|
+
/* @__PURE__ */ e(E, { permission: D.RESTORE_REVISION, children: /* @__PURE__ */ a(_, { onClick: s, className: "cursor-pointer text-sm", children: [
|
|
252
|
+
/* @__PURE__ */ e(J, { className: "mr-2 h-4 w-4" }),
|
|
246
253
|
/* @__PURE__ */ e("span", { children: "Restore this version" })
|
|
247
254
|
] }) }),
|
|
248
|
-
/* @__PURE__ */ e(
|
|
255
|
+
/* @__PURE__ */ e(E, { permission: D.DELETE_REVISION, children: t.uid !== "current" && /* @__PURE__ */ a(p, { children: [
|
|
249
256
|
/* @__PURE__ */ e(he, {}),
|
|
250
|
-
/* @__PURE__ */ a(
|
|
251
|
-
/* @__PURE__ */ e(
|
|
257
|
+
/* @__PURE__ */ a(_, { onClick: n, className: "cursor-pointer text-destructive", children: [
|
|
258
|
+
/* @__PURE__ */ e(Q, { className: "mr-2 h-4 w-4" }),
|
|
252
259
|
/* @__PURE__ */ e("span", { children: "Delete this version" })
|
|
253
260
|
] })
|
|
254
261
|
] }) })
|
|
255
262
|
] })
|
|
256
263
|
] });
|
|
257
264
|
}
|
|
258
|
-
function
|
|
265
|
+
function Ue({
|
|
259
266
|
open: t,
|
|
260
267
|
onOpenChange: s,
|
|
261
268
|
revision: n,
|
|
262
269
|
onRestore: i,
|
|
263
|
-
isRestoring:
|
|
270
|
+
isRestoring: r
|
|
264
271
|
}) {
|
|
265
|
-
const { data: d } = I((n == null ? void 0 : n.currentEditor) || ""),
|
|
272
|
+
const { data: d } = I((n == null ? void 0 : n.currentEditor) || ""), o = (d == null ? void 0 : d.name) || "Unknown";
|
|
266
273
|
return n ? /* @__PURE__ */ e(
|
|
267
|
-
|
|
274
|
+
V,
|
|
268
275
|
{
|
|
269
276
|
open: t,
|
|
270
277
|
onOpenChange: (m) => {
|
|
271
|
-
|
|
278
|
+
r || s(m);
|
|
272
279
|
},
|
|
273
280
|
children: /* @__PURE__ */ a(G, { className: "sm:max-w-md", children: [
|
|
274
281
|
/* @__PURE__ */ a(j, { children: [
|
|
275
282
|
/* @__PURE__ */ e(L, { children: "Restore Revision" }),
|
|
276
|
-
/* @__PURE__ */ a(
|
|
283
|
+
/* @__PURE__ */ a($, { children: [
|
|
277
284
|
"You are about to restore to revision ",
|
|
278
285
|
n.uid.substring(0, 8),
|
|
279
286
|
" from",
|
|
280
287
|
" ",
|
|
281
|
-
|
|
288
|
+
S(n.createdAt, "MMM d, yyyy 'at' h:mm a"),
|
|
282
289
|
" by ",
|
|
283
|
-
|
|
290
|
+
o
|
|
284
291
|
] })
|
|
285
292
|
] }),
|
|
286
293
|
/* @__PURE__ */ e("div", { className: "py-2", children: /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "How would you like to handle your current edits?" }) }),
|
|
287
|
-
/* @__PURE__ */ a(
|
|
288
|
-
/* @__PURE__ */ e(g, { variant: "outline", className: "sm:flex-1", onClick: () => i(!1), disabled:
|
|
294
|
+
/* @__PURE__ */ a(z, { className: "flex flex-col gap-2 sm:flex-row", children: [
|
|
295
|
+
/* @__PURE__ */ e(g, { variant: "outline", className: "sm:flex-1", onClick: () => i(!1), disabled: r, children: r ? /* @__PURE__ */ a(p, { children: [
|
|
289
296
|
/* @__PURE__ */ e("span", { className: "mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
|
|
290
297
|
"Saving as draft..."
|
|
291
298
|
] }) : /* @__PURE__ */ a(p, { children: [
|
|
292
299
|
/* @__PURE__ */ e(be, { className: "mr-2 h-4 w-4" }),
|
|
293
300
|
"Save as draft"
|
|
294
301
|
] }) }),
|
|
295
|
-
/* @__PURE__ */ e(g, { variant: "default", className: "sm:flex-1", onClick: () => i(!0), disabled:
|
|
302
|
+
/* @__PURE__ */ e(g, { variant: "default", className: "sm:flex-1", onClick: () => i(!0), disabled: r, children: r ? /* @__PURE__ */ a(p, { children: [
|
|
296
303
|
/* @__PURE__ */ e("span", { className: "mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
|
|
297
304
|
"Discarding current..."
|
|
298
305
|
] }) : /* @__PURE__ */ a(p, { children: [
|
|
299
|
-
/* @__PURE__ */ e(
|
|
306
|
+
/* @__PURE__ */ e(J, { className: "mr-2 h-4 w-4" }),
|
|
300
307
|
"Discard current"
|
|
301
308
|
] }) })
|
|
302
309
|
] })
|
|
@@ -304,42 +311,42 @@ function Fe({
|
|
|
304
311
|
}
|
|
305
312
|
) : null;
|
|
306
313
|
}
|
|
307
|
-
function
|
|
314
|
+
function qe({
|
|
308
315
|
open: t,
|
|
309
316
|
onOpenChange: s,
|
|
310
317
|
revision: n,
|
|
311
318
|
onDelete: i,
|
|
312
|
-
isDeleting:
|
|
319
|
+
isDeleting: r
|
|
313
320
|
}) {
|
|
314
|
-
const { data: d } = I((n == null ? void 0 : n.currentEditor) || ""),
|
|
321
|
+
const { data: d } = I((n == null ? void 0 : n.currentEditor) || ""), o = (d == null ? void 0 : d.name) || "Unknown";
|
|
315
322
|
return n ? /* @__PURE__ */ e(
|
|
316
|
-
|
|
323
|
+
V,
|
|
317
324
|
{
|
|
318
325
|
open: t,
|
|
319
326
|
onOpenChange: (m) => {
|
|
320
|
-
|
|
327
|
+
r || s(m);
|
|
321
328
|
},
|
|
322
329
|
children: /* @__PURE__ */ a(G, { className: "sm:max-w-md", children: [
|
|
323
330
|
/* @__PURE__ */ a(j, { children: [
|
|
324
331
|
/* @__PURE__ */ e(L, { children: "Delete Revision" }),
|
|
325
|
-
/* @__PURE__ */ a(
|
|
332
|
+
/* @__PURE__ */ a($, { children: [
|
|
326
333
|
"You are about to delete revision ",
|
|
327
334
|
n.uid.substring(0, 8),
|
|
328
335
|
" from",
|
|
329
336
|
" ",
|
|
330
|
-
|
|
337
|
+
S(n.createdAt, "MMM d, yyyy 'at' h:mm a"),
|
|
331
338
|
" by ",
|
|
332
|
-
|
|
339
|
+
o
|
|
333
340
|
] })
|
|
334
341
|
] }),
|
|
335
342
|
/* @__PURE__ */ e("div", { className: "py-2", children: /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "This action cannot be undone. Are you sure you want to proceed?" }) }),
|
|
336
|
-
/* @__PURE__ */ a(
|
|
337
|
-
/* @__PURE__ */ e(g, { variant: "outline", className: "sm:flex-1", onClick: () => s(!1), disabled:
|
|
338
|
-
/* @__PURE__ */ e(g, { variant: "destructive", className: "sm:flex-1", onClick: i, disabled:
|
|
343
|
+
/* @__PURE__ */ a(z, { className: "flex flex-col gap-2 sm:flex-row", children: [
|
|
344
|
+
/* @__PURE__ */ e(g, { variant: "outline", className: "sm:flex-1", onClick: () => s(!1), disabled: r, children: "Cancel" }),
|
|
345
|
+
/* @__PURE__ */ e(g, { variant: "destructive", className: "sm:flex-1", onClick: i, disabled: r, children: r ? /* @__PURE__ */ a(p, { children: [
|
|
339
346
|
/* @__PURE__ */ e("span", { className: "mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
|
|
340
347
|
"Deleting..."
|
|
341
348
|
] }) : /* @__PURE__ */ a(p, { children: [
|
|
342
|
-
/* @__PURE__ */ e(
|
|
349
|
+
/* @__PURE__ */ e(Q, { className: "mr-2 h-4 w-4" }),
|
|
343
350
|
"Delete Revision"
|
|
344
351
|
] }) })
|
|
345
352
|
] })
|
|
@@ -347,27 +354,31 @@ function Ve({
|
|
|
347
354
|
}
|
|
348
355
|
) : null;
|
|
349
356
|
}
|
|
350
|
-
function
|
|
351
|
-
var
|
|
352
|
-
const [s, n] =
|
|
357
|
+
function Qe({ isOpen: t }) {
|
|
358
|
+
var M;
|
|
359
|
+
const [s, n] = w.useState([]), [i, r] = w.useState(null), [d, o] = w.useState(!1), [m, u] = w.useState(!1), { data: l } = H(), { data: f, isFetching: R, error: h, refetch: x } = Ae(l == null ? void 0 : l.id), { mutate: B, isPending: W } = Ie(), { mutate: Y, isPending: X } = Oe(), Z = O(), { selectedLang: ee, fallbackLang: te } = le(), ae = ee || te;
|
|
353
360
|
F(() => {
|
|
354
361
|
Se(() => n([]));
|
|
355
|
-
}, [
|
|
362
|
+
}, [l == null ? void 0 : l.id]);
|
|
356
363
|
const ne = (c) => {
|
|
357
364
|
i && Y(
|
|
358
|
-
{
|
|
365
|
+
{
|
|
366
|
+
revisionId: i.uid,
|
|
367
|
+
discardCurrent: c,
|
|
368
|
+
...i.uid === "current" && (l == null ? void 0 : l.id) && { pageId: l.id }
|
|
369
|
+
},
|
|
359
370
|
{
|
|
360
371
|
onSuccess: () => {
|
|
361
|
-
|
|
362
|
-
queryKey: [
|
|
372
|
+
o(!1), r(null), Z.invalidateQueries({
|
|
373
|
+
queryKey: [y.GET_DRAFT_PAGE]
|
|
363
374
|
});
|
|
364
375
|
}
|
|
365
376
|
}
|
|
366
377
|
);
|
|
378
|
+
}, T = (c) => {
|
|
379
|
+
r(c), o(!0);
|
|
367
380
|
}, k = (c) => {
|
|
368
|
-
|
|
369
|
-
}, M = (c) => {
|
|
370
|
-
l(c), o(!0);
|
|
381
|
+
r(c), u(!0);
|
|
371
382
|
}, se = () => {
|
|
372
383
|
i && B(i.uid, {
|
|
373
384
|
/**
|
|
@@ -375,7 +386,7 @@ function Je({ isOpen: t }) {
|
|
|
375
386
|
* delete dialog and resets the selected revision to null.
|
|
376
387
|
*/
|
|
377
388
|
onSuccess: () => {
|
|
378
|
-
|
|
389
|
+
u(!1), r(null);
|
|
379
390
|
}
|
|
380
391
|
});
|
|
381
392
|
};
|
|
@@ -384,37 +395,37 @@ function Je({ isOpen: t }) {
|
|
|
384
395
|
}, [t, x]), /* @__PURE__ */ a(p, { children: [
|
|
385
396
|
/* @__PURE__ */ a(re, { children: [
|
|
386
397
|
/* @__PURE__ */ e(ie, { children: "Revision History" }),
|
|
387
|
-
(
|
|
398
|
+
(l == null ? void 0 : l.createdAt) && /* @__PURE__ */ a("p", { className: "mt-1 text-xs text-muted-foreground", children: [
|
|
388
399
|
"Page created on ",
|
|
389
|
-
|
|
400
|
+
S(new Date(l.createdAt), "MMM d, yyyy 'at' h:mm a")
|
|
390
401
|
] })
|
|
391
402
|
] }),
|
|
392
|
-
|
|
393
|
-
/* @__PURE__ */ e(_e, { lang: ae, compare: s, setCompare: n, pageId:
|
|
394
|
-
/* @__PURE__ */ e(
|
|
395
|
-
(
|
|
396
|
-
|
|
403
|
+
R ? /* @__PURE__ */ e(Me, {}) : h ? /* @__PURE__ */ e("div", { className: "p-4 text-center text-sm text-muted-foreground", children: "Failed to load revisions. Please try again." }) : /* @__PURE__ */ a("div", { className: "mt-2 flex h-full min-h-0 flex-1 flex-col space-y-2", children: [
|
|
404
|
+
/* @__PURE__ */ e(_e, { lang: ae, compare: s, setCompare: n, pageId: l == null ? void 0 : l.id }),
|
|
405
|
+
/* @__PURE__ */ e(ke, { compare: s, setCompare: n }),
|
|
406
|
+
(M = f == null ? void 0 : f.filter((c) => c.uid === "current")) == null ? void 0 : M.map((c, b) => /* @__PURE__ */ e(
|
|
407
|
+
U,
|
|
397
408
|
{
|
|
398
|
-
pageId:
|
|
409
|
+
pageId: l == null ? void 0 : l.id,
|
|
399
410
|
revision: c,
|
|
400
411
|
isLatest: !0,
|
|
401
|
-
onRestore: () =>
|
|
402
|
-
onDelete: () =>
|
|
403
|
-
revisionNumber:
|
|
412
|
+
onRestore: () => T(c),
|
|
413
|
+
onDelete: () => k(c),
|
|
414
|
+
revisionNumber: b,
|
|
404
415
|
compare: s,
|
|
405
416
|
setCompare: n
|
|
406
417
|
},
|
|
407
418
|
c.uid
|
|
408
419
|
)),
|
|
409
|
-
/* @__PURE__ */ e(de, { className: "min-h-0 flex-1", children: /* @__PURE__ */ e("div", { className: "space-y-2", children:
|
|
410
|
-
|
|
420
|
+
/* @__PURE__ */ e(de, { className: "min-h-0 flex-1", children: /* @__PURE__ */ e("div", { className: "space-y-2", children: [...f ?? []].filter((c) => c.uid !== "current").sort((c, b) => new Date(b.createdAt).getTime() - new Date(c.createdAt).getTime()).map((c, b) => /* @__PURE__ */ e(
|
|
421
|
+
U,
|
|
411
422
|
{
|
|
412
|
-
pageId:
|
|
423
|
+
pageId: l == null ? void 0 : l.id,
|
|
413
424
|
revision: c,
|
|
414
425
|
isLatest: c.uid === "current",
|
|
415
|
-
onRestore: () =>
|
|
416
|
-
onDelete: () =>
|
|
417
|
-
revisionNumber:
|
|
426
|
+
onRestore: () => T(c),
|
|
427
|
+
onDelete: () => k(c),
|
|
428
|
+
revisionNumber: b + 1,
|
|
418
429
|
compare: s,
|
|
419
430
|
setCompare: n
|
|
420
431
|
},
|
|
@@ -422,20 +433,20 @@ function Je({ isOpen: t }) {
|
|
|
422
433
|
)) }) })
|
|
423
434
|
] }),
|
|
424
435
|
/* @__PURE__ */ e(
|
|
425
|
-
|
|
436
|
+
Ue,
|
|
426
437
|
{
|
|
427
438
|
open: d,
|
|
428
|
-
onOpenChange:
|
|
439
|
+
onOpenChange: o,
|
|
429
440
|
revision: i,
|
|
430
441
|
onRestore: ne,
|
|
431
442
|
isRestoring: X
|
|
432
443
|
}
|
|
433
444
|
),
|
|
434
445
|
/* @__PURE__ */ e(
|
|
435
|
-
|
|
446
|
+
qe,
|
|
436
447
|
{
|
|
437
448
|
open: m,
|
|
438
|
-
onOpenChange:
|
|
449
|
+
onOpenChange: u,
|
|
439
450
|
revision: i,
|
|
440
451
|
onDelete: se,
|
|
441
452
|
isDeleting: W
|
|
@@ -444,5 +455,5 @@ function Je({ isOpen: t }) {
|
|
|
444
455
|
] });
|
|
445
456
|
}
|
|
446
457
|
export {
|
|
447
|
-
|
|
458
|
+
Qe as default
|
|
448
459
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),N=require("./register-chai-top-bar-DyW9GPzV.cjs"),i=require("./index-P-2SvZA9.cjs"),c=require("./index-CQf0jL1k.cjs"),y=require("@tanstack/react-query"),S=require("date-fns"),B=require("lodash-es"),f=require("lucide-react"),g=require("react");function L(s){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>s[t]})}}return n.default=s,Object.freeze(n)}const w=L(g);function Q(s){const n=c.useApiUrl(),t=c.useFetch();return y.useQuery({queryKey:[c.ACTIONS.GET_PAGE_REVISIONS,s],queryFn:async()=>await t(n,{action:c.ACTIONS.GET_PAGE_REVISIONS,data:{pageId:s}}),enabled:!!s,refetchOnMount:!0})}const z=()=>{const s=c.useApiUrl(),n=c.useFetch(),t=y.useQueryClient();return y.useMutation({mutationFn:async r=>await n(s,{action:c.ACTIONS.DELETE_PAGE_REVISION,data:{revisionId:r}}),onSuccess:()=>{t.invalidateQueries({queryKey:["revisions"]})}})},H=()=>{const s=c.useApiUrl(),n=c.useFetch(),t=y.useQueryClient();return y.useMutation({mutationFn:async({revisionId:r,discardCurrent:l,pageId:d})=>await n(s,{action:c.ACTIONS.RESTORE_PAGE_REVISION,data:{revisionId:r,discardCurrent:l,...d&&{pageId:d}}}),onSuccess:()=>{t.invalidateQueries({queryKey:["revisions"]})}})},$=g.lazy(()=>Promise.resolve().then(()=>require("./json-diff-viewer-BBERGXdt.cjs"))),b=({tag:s})=>s==="draft"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-amber-500/10 px-1.5 py-0.5 text-xs text-amber-600",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-amber-500"})]}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Draft"})]}):s==="live"?e.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-green-500"})]}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Live"})]}):s==="published"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-green-500/10 px-1.5 py-0.5 text-xs text-green-600",children:[e.jsx(f.Rocket,{className:"h-3 w-3"}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Published"})]}):s==="unsaved"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-red-500/10 px-1.5 py-0.5 text-xs text-red-600",children:[e.jsx(f.Save,{className:"h-3 w-3"}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Unsaved changes"})]}):e.jsx("span",{className:"rounded bg-purple-500/10 px-1.5 py-0.5 font-mono text-xs font-bold text-purple-600",children:s});function J({compare:s,setCompare:n}){const{data:t}=c.usePrimaryPage(),{saveState:r}=i.useSavePage(),[l]=c.usePageEditInfo();if(!t)return null;const d=!!s.find(x=>{var a;return(a=x==null?void 0:x.uid)==null?void 0:a.startsWith("draft:")}),u=s.length>=2&&!d,m=r==="UNSAVED";return e.jsxs("div",{className:"relative flex items-start gap-3 rounded-md border bg-primary/5 p-2 hover:bg-accent/50",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-1 text-sm font-medium leading-none",children:[e.jsx(b,{tag:"draft"}),e.jsx("span",{className:"text-xs font-bold",children:"Currently editing"})]})}),e.jsx("div",{className:"flex items-center pl-2 text-[11px] text-muted-foreground",children:!B.isEmpty(l.lastSaved)&&e.jsxs("span",{children:["Last updated"," ",S.formatDistanceToNow(new Date(l.lastSaved),{addSuffix:!0})]})}),e.jsx("div",{className:"flex items-center gap-2 pt-0.5",children:m?e.jsx(b,{tag:"unsaved"}):null})]}),e.jsx(O,{checked:d,disabled:u,onChange:()=>{n(d?s.filter(x=>x.uid!==`draft:${t==null?void 0:t.id}`):[...s,{uid:`draft:${t==null?void 0:t.id}`,label:"draft",item:{createdAt:Date.now()}}])}})]})}function K(){return e.jsx("div",{className:"mt-2 space-y-2",children:Array.from({length:5}).map((s,n)=>e.jsxs("div",{className:"flex items-start gap-3 rounded-md border p-2",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(i.Skeleton,{className:"h-4 w-3/4"}),e.jsx(i.Skeleton,{className:"h-3 w-1/2"}),e.jsx(i.Skeleton,{className:"mt-1 h-5 w-20"})]}),e.jsx(i.Skeleton,{className:"h-8 w-8 rounded-full"})]},n))})}function I({revision:s,isLatest:n,onRestore:t,onDelete:r,revisionNumber:l,compare:d,setCompare:u,pageId:m}){const{data:x}=c.useChaiUserInfo(s.currentEditor),a=(x==null?void 0:x.name)||"Unknown",p=!!d.find(h=>{var j;return n?(j=h==null?void 0:h.uid)==null?void 0:j.startsWith("live"):(h==null?void 0:h.uid)===s.uid}),D=d.length>=2&&!p;return e.jsxs("div",{className:"relative flex items-start gap-3 rounded-md border p-2 hover:bg-accent/50",children:[e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("p",{className:"flex items-center gap-1 text-xs leading-none",children:[e.jsx(b,{tag:n?"live":`#${l}`}),s.type==="published"?"Published":"Draft"," by ",e.jsx("span",{className:"text-xs font-bold",children:a})]})}),e.jsxs("div",{className:"flex items-center gap-x-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:s.type==="published"?e.jsx(b,{tag:"published"}):e.jsx(b,{tag:"draft"})}),e.jsx("div",{className:"flex items-center text-[10px] text-muted-foreground",children:e.jsx("span",{className:"leading-tight",children:S.format(s.createdAt,"MMM d, yyyy, h:mm a")})})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(c.PermissionChecker,{permissions:[c.PAGES_PERMISSIONS.RESTORE_REVISION,c.PAGES_PERMISSIONS.DELETE_REVISION],children:e.jsx(Y,{revision:s,onRestore:t,onDelete:r})})}),e.jsx(O,{checked:p,disabled:D,onChange:()=>{u(p?d.filter(h=>n?h.uid!==`live:${m}`:h.uid!==s.uid):[...d,{uid:n?`live:${m}`:s.uid,label:n?"live":`#${l}`,item:s}].sort((h,j)=>new Date(h.item.createdAt).getTime()-new Date(j.item.createdAt).getTime()))}})]})}function A({tab:s,onRemove:n}){return e.jsxs("span",{className:"flex items-center justify-between rounded border border-blue-100 p-1 font-medium",children:[e.jsx(b,{tag:s.label}),e.jsx("button",{className:"z-0 flex h-4 w-4 items-center justify-center rounded-full text-gray-400 hover:text-red-500",style:{lineHeight:1},onClick:()=>n(s.uid),"aria-label":"Remove selection",children:e.jsx(f.X,{className:"h-3 w-3"})})]})}function W({compare:s,setCompare:n,pageId:t}){const[r,l]=g.useState(!1),[d,u]=s;if(s.length===0)return null;const m=x=>n(s.filter(a=>a.uid!==x));return e.jsxs("div",{className:"mb-2 flex w-full max-w-md flex-col gap-1 rounded border bg-accent/60 p-2 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-x-2 text-xs",children:[e.jsx("span",{className:"font-medium leading-tight text-gray-600",children:"Compare"}),d&&e.jsx(A,{tab:d,onRemove:m}),e.jsx("span",{className:"font-medium leading-tight text-gray-600",children:"with"}),u?e.jsx(A,{tab:u,onRemove:m}):e.jsx("span",{className:"rounded border px-1 text-xs text-muted-foreground",children:"Choose another"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pb-0.5 pt-2",children:[e.jsx(N.Button,{size:"sm",className:"h-6 gap-1 rounded px-2 text-xs leading-none text-gray-500",variant:"outline",onClick:()=>n([]),children:e.jsx("span",{children:" Clear"})}),e.jsxs(N.Button,{size:"sm",className:"h-6 gap-1 rounded px-2 text-xs leading-none",variant:"default",onClick:()=>l(!0),disabled:s.length<2,children:[e.jsx(f.FileJson,{className:"h-2.5 w-2.5"}),e.jsx("span",{className:"pt-0.5",children:"Show JSON Diff"})]})]}),r&&(s==null?void 0:s.length)>1&&t&&e.jsx(g.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center p-4",children:e.jsx("span",{className:"text-sm",children:"Loading diff viewer..."})}),children:e.jsx($,{open:r,onOpenChange:l,compare:s})})]})}function O({checked:s,disabled:n,onChange:t,label:r="Compare"}){return e.jsx("div",{className:"absolute bottom-2 right-2",children:e.jsxs("label",{className:`flex cursor-pointer items-center gap-x-1 text-[11px] ${n?"opacity-50":""}`,children:[e.jsx("input",{type:"checkbox",className:"h-3 w-3 cursor-pointer rounded focus:ring-0 focus:ring-offset-0",checked:s,disabled:n,onChange:t}),e.jsx("span",{className:"select-none leading-tight",children:r})]})})}function Y({revision:s,onRestore:n,onDelete:t}){return e.jsxs(i.DropdownMenu,{children:[e.jsx(i.DropdownMenuTrigger,{asChild:!0,children:e.jsxs(N.Button,{variant:"ghost",size:"icon",className:"h-5 w-5",children:[e.jsx(f.MoreHorizontal,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"More options"})]})}),e.jsxs(i.DropdownMenuContent,{align:"end",className:"text-xs",children:[e.jsx(c.PermissionChecker,{permission:c.PAGES_PERMISSIONS.RESTORE_REVISION,children:e.jsxs(i.DropdownMenuItem,{onClick:n,className:"cursor-pointer text-sm",children:[e.jsx(f.Undo2,{className:"mr-2 h-4 w-4"}),e.jsx("span",{children:"Restore this version"})]})}),e.jsx(c.PermissionChecker,{permission:c.PAGES_PERMISSIONS.DELETE_REVISION,children:s.uid!=="current"&&e.jsxs(e.Fragment,{children:[e.jsx(i.DropdownMenuSeparator,{}),e.jsxs(i.DropdownMenuItem,{onClick:t,className:"cursor-pointer text-destructive",children:[e.jsx(f.Trash,{className:"mr-2 h-4 w-4"}),e.jsx("span",{children:"Delete this version"})]})]})})]})]})}function X({open:s,onOpenChange:n,revision:t,onRestore:r,isRestoring:l}){const{data:d}=c.useChaiUserInfo((t==null?void 0:t.currentEditor)||""),u=(d==null?void 0:d.name)||"Unknown";return t?e.jsx(i.Dialog,{open:s,onOpenChange:m=>{l||n(m)},children:e.jsxs(i.DialogContent,{className:"sm:max-w-md",children:[e.jsxs(i.DialogHeader,{children:[e.jsx(i.DialogTitle,{children:"Restore Revision"}),e.jsxs(i.DialogDescription,{children:["You are about to restore to revision ",t.uid.substring(0,8)," from"," ",S.format(t.createdAt,"MMM d, yyyy 'at' h:mm a")," by ",u]})]}),e.jsx("div",{className:"py-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"How would you like to handle your current edits?"})}),e.jsxs(i.DialogFooter,{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(N.Button,{variant:"outline",className:"sm:flex-1",onClick:()=>r(!1),disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Saving as draft..."]}):e.jsxs(e.Fragment,{children:[e.jsx(f.CloudOff,{className:"mr-2 h-4 w-4"}),"Save as draft"]})}),e.jsx(N.Button,{variant:"default",className:"sm:flex-1",onClick:()=>r(!0),disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Discarding current..."]}):e.jsxs(e.Fragment,{children:[e.jsx(f.Undo2,{className:"mr-2 h-4 w-4"}),"Discard current"]})})]})]})}):null}function Z({open:s,onOpenChange:n,revision:t,onDelete:r,isDeleting:l}){const{data:d}=c.useChaiUserInfo((t==null?void 0:t.currentEditor)||""),u=(d==null?void 0:d.name)||"Unknown";return t?e.jsx(i.Dialog,{open:s,onOpenChange:m=>{l||n(m)},children:e.jsxs(i.DialogContent,{className:"sm:max-w-md",children:[e.jsxs(i.DialogHeader,{children:[e.jsx(i.DialogTitle,{children:"Delete Revision"}),e.jsxs(i.DialogDescription,{children:["You are about to delete revision ",t.uid.substring(0,8)," from"," ",S.format(t.createdAt,"MMM d, yyyy 'at' h:mm a")," by ",u]})]}),e.jsx("div",{className:"py-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"This action cannot be undone. Are you sure you want to proceed?"})}),e.jsxs(i.DialogFooter,{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(N.Button,{variant:"outline",className:"sm:flex-1",onClick:()=>n(!1),disabled:l,children:"Cancel"}),e.jsx(N.Button,{variant:"destructive",className:"sm:flex-1",onClick:r,disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Deleting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(f.Trash,{className:"mr-2 h-4 w-4"}),"Delete Revision"]})})]})]})}):null}function ee({isOpen:s}){var R;const[n,t]=w.useState([]),[r,l]=w.useState(null),[d,u]=w.useState(!1),[m,x]=w.useState(!1),{data:a}=c.usePrimaryPage(),{data:p,isFetching:D,error:h,refetch:j}=Q(a==null?void 0:a.id),{mutate:T,isPending:M}=z(),{mutate:k,isPending:F}=H(),_=y.useQueryClient(),{selectedLang:P,fallbackLang:q}=i.useLanguages(),U=P||q;g.useEffect(()=>{g.startTransition(()=>t([]))},[a==null?void 0:a.id]);const G=o=>{r&&k({revisionId:r.uid,discardCurrent:o,...r.uid==="current"&&(a==null?void 0:a.id)&&{pageId:a.id}},{onSuccess:()=>{u(!1),l(null),_.invalidateQueries({queryKey:[c.ACTIONS.GET_DRAFT_PAGE]})}})},C=o=>{l(o),u(!0)},E=o=>{l(o),x(!0)},V=()=>{r&&T(r.uid,{onSuccess:()=>{x(!1),l(null)}})};return g.useEffect(()=>{s&&j()},[s,j]),e.jsxs(e.Fragment,{children:[e.jsxs(i.SheetHeader,{children:[e.jsx(i.SheetTitle,{children:"Revision History"}),(a==null?void 0:a.createdAt)&&e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Page created on ",S.format(new Date(a.createdAt),"MMM d, yyyy 'at' h:mm a")]})]}),D?e.jsx(K,{}):h?e.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:"Failed to load revisions. Please try again."}):e.jsxs("div",{className:"mt-2 flex h-full min-h-0 flex-1 flex-col space-y-2",children:[e.jsx(W,{lang:U,compare:n,setCompare:t,pageId:a==null?void 0:a.id}),e.jsx(J,{compare:n,setCompare:t}),(R=p==null?void 0:p.filter(o=>o.uid==="current"))==null?void 0:R.map((o,v)=>e.jsx(I,{pageId:a==null?void 0:a.id,revision:o,isLatest:!0,onRestore:()=>C(o),onDelete:()=>E(o),revisionNumber:v,compare:n,setCompare:t},o.uid)),e.jsx(i.ScrollArea,{className:"min-h-0 flex-1",children:e.jsx("div",{className:"space-y-2",children:[...p??[]].filter(o=>o.uid!=="current").sort((o,v)=>new Date(v.createdAt).getTime()-new Date(o.createdAt).getTime()).map((o,v)=>e.jsx(I,{pageId:a==null?void 0:a.id,revision:o,isLatest:o.uid==="current",onRestore:()=>C(o),onDelete:()=>E(o),revisionNumber:v+1,compare:n,setCompare:t},o.uid))})})]}),e.jsx(X,{open:d,onOpenChange:u,revision:r,onRestore:G,isRestoring:F}),e.jsx(Z,{open:m,onOpenChange:x,revision:r,onDelete:V,isDeleting:M})]})}exports.default=ee;
|
package/dist/pages.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CQf0jL1k.cjs");exports.ChaiJsonInput=e.SmartJsonInput;exports.ChaiWebsiteBuilder=e.ChaiWebsiteBuilder;exports.ImagePicker=e.ImagePicker;exports.LanguageSwitcher=e.LanguageSwitcher;exports.NestedPathSelector=e.NestedPathSelector;exports.PermissionChecker=e.PermissionChecker;exports.SupabaseRealtimeAdapter=e.SupabaseRealtimeAdapter;exports.createRealtimeAdapter=e.createRealtimeAdapter;exports.useActivePage=e.useCurrentActivePage;exports.useApiUrl=e.useApiUrl;exports.useBuilderFetch=e.useBuilderFetch;exports.useBuilderPageData=e.useBuilderPageData;exports.useChaiAuth=e.useChaiAuth;exports.useChaiPrimaryPage=e.usePrimaryPage;exports.useChaiUserInfo=e.useChaiUserInfo;exports.useClearAll=e.useClearAll;exports.useFallbackLang=e.useFallbackLang;exports.useFetch=e.useFetch;exports.useGotoPage=e.useGotoPage;exports.useLanguagePages=e.useLanguagePages;exports.usePageAllData=e.usePageAllData;exports.usePageTypes=e.usePageTypes;exports.useRealtimeAdapter=e.useRealtimeAdapter;exports.useReloadPage=e.useReloadPage;exports.useUpdateActivePageMetadata=e.useUpdateActivePageMetadata;exports.useUserPermissions=e.useCheckUserAccess;exports.useWebsitePages=e.useWebsitePrimaryPages;exports.useWebsiteSetting=e.useWebsiteSetting;
|