@chaibuilder/sdk 4.0.0-beta.3 → 4.0.0-beta.31
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-BnsZi3K3.cjs → 2SSKDMRQ-BksFOLpD.cjs} +1 -1
- package/dist/{2SSKDMRQ-CnSDkQcy.js → 2SSKDMRQ-gmj-yWTy.js} +2 -2
- package/dist/{AP7HFJJL-B31839PG.cjs → AP7HFJJL-CO-deD_p.cjs} +1 -1
- package/dist/{AP7HFJJL-CymCmW14.js → AP7HFJJL-kVgc0R61.js} +1 -1
- package/dist/IconPicker-BJHUCDn4.cjs +1 -0
- package/dist/{IconPicker-B1rWC-Ex.js → IconPicker-D_GRfhwS.js} +8 -7
- package/dist/STRINGS-BExFecZW.js +8 -0
- package/dist/STRINGS-FNnfjF5H.cjs +1 -0
- package/dist/{WDYDFRGG-BUVnbAci.js → WDYDFRGG-C9_E3QW0.js} +2 -2
- package/dist/{WDYDFRGG-BxhOCHc3.cjs → WDYDFRGG-KPpWFul_.cjs} +1 -1
- package/dist/{actions-registery-CZ1w0NKa.js → actions-registery-Bj-j1k5i.js} +2668 -2585
- package/dist/actions-registery-Cy1lqUVI.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-1GoKTVcF.js +35 -0
- package/dist/active-in-another-tab-iEd5fZD0.cjs +1 -0
- package/dist/{add-new-language-page-WmlCnytQ.js → add-new-language-page-B3GUvWdP.js} +54 -53
- package/dist/add-new-language-page-Cq8R42Ro.cjs +1 -0
- package/dist/{add-new-page-VW2wAYZp.js → add-new-page-C5HlQfzy.js} +2 -2
- package/dist/{add-new-page-soZ8GAkN.cjs → add-new-page-DiHnECAR.cjs} +1 -1
- package/dist/ai-panel-content-BPpawv4D.cjs +1 -0
- package/dist/{ai-panel-content-D_o7Q_A-.js → ai-panel-content-tExD3yhH.js} +12 -11
- package/dist/ai-panel-default-lang-C6N4wUUF.cjs +3 -0
- package/dist/ai-panel-default-lang-DnYLHSaS.js +317 -0
- package/dist/ai-panel-other-lang-C65lVVtZ.cjs +1 -0
- package/dist/ai-panel-other-lang-D1pCJluY.js +132 -0
- package/dist/{ai-prompt-input-Bhc0ds7X.js → ai-prompt-input-B2q30bhR.js} +59 -62
- package/dist/ai-prompt-input-Dws5BHhQ.cjs +1 -0
- package/dist/{ai-translation-prompt-CZ55HQmo.js → ai-translation-prompt-Dnn6i_t3.js} +2 -2
- package/dist/ai-translation-prompt-DnwG2BmF.cjs +1 -0
- package/dist/apply-binding-9XSrYzAE.cjs +1 -0
- package/dist/{apply-binding-6iwlED02.js → apply-binding-chfbBKi2.js} +238 -225
- package/dist/change-password-modal-C0MMizgl.js +137 -0
- package/dist/change-password-modal-LKtYY-8V.cjs +1 -0
- package/dist/code-display-BR-gij5j.cjs +1 -0
- package/dist/{code-display-DhD_RBcg.js → code-display-DdWcOQ_i.js} +1 -1
- package/dist/code-editor-CWOmKcUc.js +57 -0
- package/dist/code-editor-Cim6jQVF.cjs +1 -0
- package/dist/continue-editing-in-this-client-Dd6nKIvX.cjs +1 -0
- package/dist/{continue-editing-in-this-client-CS2aQ7yY.js → continue-editing-in-this-client-oxYWGWON.js} +10 -9
- package/dist/core-BWQrViOY.cjs +1 -0
- package/dist/core-QlWEXm1d.js +53 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +275 -105
- package/dist/core.js +59 -28
- package/dist/{css-import-modal-Byg6wV0O.js → css-import-modal-6bMTRlCg.js} +11 -9
- package/dist/css-import-modal-CXulmaB4.cjs +13 -0
- package/dist/delete-page-D0tdn6VW.cjs +1 -0
- package/dist/delete-page-LnzR01A8.js +71 -0
- package/dist/design-token-usage-D-hrcKz1.cjs +1 -0
- package/dist/{design-token-usage-xQs6SlaJ.js → design-token-usage-lf7N_uOk.js} +33 -32
- package/dist/{digital-asset-manager-DbtwzxRz.js → digital-asset-manager-DJhRhLGC.js} +6 -5
- package/dist/digital-asset-manager-eCJHNSjj.cjs +1 -0
- package/dist/{duplicate-page-BR7Dlo9d.js → duplicate-page-CXzYy7vx.js} +20 -19
- package/dist/duplicate-page-ChSp1TYN.cjs +1 -0
- package/dist/dynamic-page-selector-btGtkyyv.cjs +1 -0
- package/dist/{dynamic-page-selector-Cb5r_W8s.js → dynamic-page-selector-r5IR9_7k.js} +12 -11
- 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-7CxFxEYL.cjs +1 -0
- package/dist/{get-chai-builder-tailwind-config-DjoVOuAf.js → get-chai-builder-tailwind-config-DC4sDOYK.js} +8 -8
- package/dist/{get-chai-builder-theme-Dl72X7cz.cjs → get-chai-builder-theme-B5RkBTsB.cjs} +1 -1
- package/dist/{get-chai-builder-theme-BYtp20KD.js → get-chai-builder-theme-BpuwSLeS.js} +1 -1
- package/dist/{image-editor-G-K28aTS.cjs → image-editor-BdW476J8.cjs} +1 -1
- package/dist/{image-editor-DV8kUKhl.js → image-editor-CilPMtAC.js} +1 -1
- package/dist/index-CAhDwfHE.cjs +5 -0
- package/dist/{index-Ct7ElCGK.js → index-DsQXiNA_.js} +5888 -6282
- package/dist/index-DtMksfXx.js +4932 -0
- package/dist/index-mPCp0j2h.cjs +160 -0
- package/dist/json-diff-viewer-BkrnLb3B.cjs +8 -0
- package/dist/{json-diff-viewer-krslPepD.js → json-diff-viewer-D3N3w3Ax.js} +100 -97
- package/dist/{lang-panel-BwIewMyw.js → lang-panel-BAaaP4Qc.js} +15 -14
- package/dist/lang-panel-BjDRrpwN.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-BknGNAKE.cjs +1 -0
- package/dist/manage-design-tokens-Co5677WS.js +428 -0
- package/dist/manage-design-tokens-modal-9qpcb-EC.js +161 -0
- package/dist/manage-design-tokens-modal-BcgdwEXE.cjs +1 -0
- package/dist/{mark-as-template-D295ZQtU.js → mark-as-template-DNHYNjI9.js} +17 -16
- package/dist/mark-as-template-IYRjta97.cjs +1 -0
- package/dist/{nested-path-selector-content-CKYYK-C5.js → nested-path-selector-content-Be-pbnVl.js} +24 -23
- package/dist/nested-path-selector-content-CWmPgU-L.cjs +1 -0
- package/dist/no-language-page-content-8_J6y-cm.cjs +1 -0
- package/dist/{no-language-page-content-BvqRBP6y.js → no-language-page-content-C-ltY7bj.js} +10 -9
- package/dist/{no-language-page-dialog-BcEoqyQB.cjs → no-language-page-dialog-BOZZZzqx.cjs} +1 -1
- package/dist/{no-language-page-dialog-PjNqTUpl.js → no-language-page-dialog-D5NXpDHi.js} +2 -2
- package/dist/{page-creator-DiOITEMw.js → page-creator-BuHHnqiQ.js} +242 -241
- package/dist/page-creator-wtbae2U7.cjs +1 -0
- package/dist/{page-lock-BdYmCks0.cjs → page-lock-DN4iJc-V.cjs} +1 -1
- package/dist/{page-lock-Bfbs6RgL.js → page-lock-pPGlTxj7.js} +2 -2
- package/dist/page-locked-dialog-B_vdgv24.cjs +1 -0
- package/dist/{page-locked-dialog-B6MKTRfY.js → page-locked-dialog-Bl-ojgIW.js} +26 -23
- package/dist/page-manager-new-5W5M9_ue.cjs +1 -0
- package/dist/page-manager-new-Bg8H6yrg.js +418 -0
- package/dist/page-manager-search-and-filter-CDXunXNd.cjs +1 -0
- package/dist/{page-manager-search-and-filter-CM0UMb6U.js → page-manager-search-and-filter-CyfO7O96.js} +20 -19
- package/dist/{page-revisions-content-NH9JK4Ey.js → page-revisions-content-B-egQgoZ.js} +131 -117
- package/dist/page-revisions-content-BKT8S9_g.cjs +1 -0
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +300 -97
- package/dist/pages.js +22 -19
- package/dist/plugin-BSjgGgwo.js +248 -0
- package/dist/plugin-DHpuZZXz.cjs +22 -0
- package/dist/{publish-pages-content-D9aixMN5.js → publish-pages-content-D2B_ScCQ.js} +71 -70
- package/dist/publish-pages-content-WJHTVYnx.cjs +1 -0
- package/dist/register-chai-top-bar-D6GjnauV.js +237 -0
- package/dist/register-chai-top-bar-DyW9GPzV.cjs +1 -0
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +22 -20
- package/dist/render.js +125 -118
- package/dist/rte-widget-modal-CC1KcrAT.cjs +1 -0
- package/dist/{rte-widget-modal-DOJEXLIf.js → rte-widget-modal-c3T09VeO.js} +10 -9
- 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 +159 -114
- package/dist/runtime.js +107 -42
- package/dist/save-to-lib-CiM0wiIr.cjs +1 -0
- package/dist/{save-to-lib-eiOc_SSN.js → save-to-lib-dT1NDd5w.js} +156 -149
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-CBFePS19.js → selected-block-display-BQndDPcY.js} +40 -39
- package/dist/selected-block-display-BgqcPsXI.cjs +16 -0
- package/dist/seo-panel-DXZvGYEM.cjs +2 -0
- package/dist/{seo-panel-C1-iMOR1.js → seo-panel-Z93Zf_bz.js} +23 -22
- package/dist/{shared-json-ld-B4PxAM_0.js → shared-json-ld-Ct68RlWD.js} +100 -99
- package/dist/shared-json-ld-DwvUDGAS.cjs +1 -0
- package/dist/{slug-input-AwNJs9im.js → slug-input-CAqkFZBq.js} +9 -8
- package/dist/slug-input-Curnt2n3.cjs +1 -0
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.d.ts +40 -1
- package/dist/supabase-actions.js +231 -192
- package/dist/{take-over-request-C4FeDtN_.js → take-over-request-C6ngP1QR.js} +15 -14
- package/dist/take-over-request-D6y2HcDr.cjs +1 -0
- package/dist/theme-panel-footer-CGZL2F7R.js +26 -0
- package/dist/theme-panel-footer-IgGj-_OA.cjs +1 -0
- package/dist/translation-warning-modal-B876S5yp.cjs +1 -0
- package/dist/{translation-warning-modal-B64YqlbI.js → translation-warning-modal-kRcfrPgo.js} +11 -10
- package/dist/types.cjs +1 -0
- package/dist/types.d.ts +743 -0
- package/dist/types.js +1 -0
- package/dist/{unmark-as-template-CZ9sQp_P.js → unmark-as-template-DeeWUTco.js} +12 -11
- package/dist/unmark-as-template-f1dl_YTz.cjs +1 -0
- package/dist/unpublish-page-DEPFjGuu.cjs +1 -0
- package/dist/unpublish-page-U_79Pwc0.js +28 -0
- package/dist/unpublished-partials-modal-CEFXp1D1.cjs +1 -0
- package/dist/unpublished-partials-modal-Ts5ZhAK9.js +41 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.ts +8 -5
- package/dist/utils.js +2 -2
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +341 -332
- package/dist/{web-preview-Djy6WIyj.js → web-preview-CoT8r96b.js} +2 -2
- package/dist/web-preview-DTDoIE-c.cjs +1 -0
- package/package.json +36 -31
- package/dist/IconPicker-DREyo007.cjs +0 -1
- package/dist/actions-registery-YnFmU21O.cjs +0 -418
- package/dist/active-in-another-tab-B47YjQGN.cjs +0 -1
- package/dist/active-in-another-tab-CyjngVA6.js +0 -34
- package/dist/add-new-language-page-88xzrUy8.cjs +0 -1
- package/dist/ai-panel-content-7zCil042.cjs +0 -1
- package/dist/ai-panel-default-lang-COYaxNwn.cjs +0 -3
- package/dist/ai-panel-default-lang-DnElspF0.js +0 -341
- package/dist/ai-panel-other-lang-CkynNlAU.cjs +0 -1
- package/dist/ai-panel-other-lang-Dp0E9_Hx.js +0 -162
- package/dist/ai-prompt-input-CThbVp0_.cjs +0 -1
- package/dist/ai-translation-prompt-C2kJQFDX.cjs +0 -1
- package/dist/apply-binding-KKp5PnpZ.cjs +0 -1
- package/dist/code-display-BnqzqzoP.cjs +0 -1
- package/dist/code-editor-DRIAnNbb.js +0 -50
- package/dist/code-editor-o3___nu2.cjs +0 -1
- package/dist/continue-editing-in-this-client-CtMYsk-A.cjs +0 -1
- package/dist/core-BoRDjj4h.cjs +0 -1
- package/dist/core-yvI6kCyw.js +0 -56
- package/dist/css-import-modal-CyqkXWCO.cjs +0 -13
- package/dist/delete-design-token-BRZZiWtQ.js +0 -40
- package/dist/delete-design-token-DkVs1oBf.cjs +0 -1
- package/dist/delete-page-BzyX9TN-.js +0 -70
- package/dist/delete-page-DxX7PFIE.cjs +0 -1
- package/dist/design-token-usage-CAHzEGgJ.cjs +0 -1
- package/dist/digital-asset-manager--uO8Agia.cjs +0 -1
- package/dist/duplicate-page-CaNAbXwV.cjs +0 -1
- package/dist/dynamic-page-selector-Cxk_gjni.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-tailwind-config-B9rCyiQo.cjs +0 -1
- package/dist/index-B-rSiAp_.cjs +0 -1
- package/dist/index-DF5DEvqb.cjs +0 -160
- package/dist/index-Dxfyt4d4.js +0 -39
- package/dist/index-WQwzsC7A.cjs +0 -5
- package/dist/index-ZuacEL1j.js +0 -4732
- package/dist/json-diff-viewer-D7z4zNvv.cjs +0 -8
- package/dist/lang-panel-DT96k1xg.cjs +0 -1
- package/dist/manage-design-tokens-Caz_20VK.js +0 -240
- package/dist/manage-design-tokens-CrmLe7UT.cjs +0 -1
- package/dist/mark-as-template-W3LmpiqN.cjs +0 -1
- package/dist/nested-path-selector-content-CoS_d3dc.cjs +0 -1
- package/dist/no-language-page-content-DkfeMl90.cjs +0 -1
- package/dist/page-creator-C4gc5NSC.cjs +0 -1
- package/dist/page-locked-dialog-B1FAtK92.cjs +0 -1
- package/dist/page-manager-new-CHDueBDk.cjs +0 -1
- package/dist/page-manager-new-CzX22g2n.js +0 -394
- package/dist/page-manager-search-and-filter-DkkRIH86.cjs +0 -1
- package/dist/page-revisions-content-ChY-4f2V.cjs +0 -1
- package/dist/plugin-3ZKK6RXm.js +0 -245
- package/dist/plugin-C6rgJDNQ.cjs +0 -22
- package/dist/publish-pages-content-x-JuSFJ9.cjs +0 -1
- package/dist/rte-widget-modal-BaHIuEjF.cjs +0 -1
- package/dist/save-to-lib-Cgpxw8-g.cjs +0 -1
- package/dist/selected-block-display-BgRY82CT.cjs +0 -16
- package/dist/seo-panel-DfAb8U7W.cjs +0 -2
- package/dist/shared-json-ld-DzG398hr.cjs +0 -1
- package/dist/slug-input-C_ijLQ_X.cjs +0 -1
- package/dist/take-over-request-BNxcjY2j.cjs +0 -1
- package/dist/theme-panel-footer-Cq9pljro.cjs +0 -1
- package/dist/theme-panel-footer-uBQqSJXm.js +0 -25
- package/dist/translation-warning-modal-BZAcwM2_.cjs +0 -1
- package/dist/unmark-as-template-EVvk0vmp.cjs +0 -1
- package/dist/unpublish-page-D4VwOlxc.js +0 -27
- package/dist/unpublish-page-bdSmwAVQ.cjs +0 -1
- package/dist/web-preview-Cio70gk5.cjs +0 -1
package/dist/actions.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./actions-registery-Cy1lqUVI.cjs"),l=s=>async o=>{const{apiKey:t,userId:u}=s;try{const a=o,{action:r,data:e}=a,n=i.getChaiAction(r);return n?n.validate(e)?(n.setContext({appId:t,userId:u}),await n.execute(e)):{error:`Validation failed: ${n.getValidationErrors(e)}`,code:"INVALID_REQUEST_DATA",status:400}:{error:`Action ${r} not found`,code:"ACTION_NOT_FOUND",status:404}}catch(a){return console.log("Error in builderApiHandler:",a),a instanceof i.ActionError?{error:a.message,code:a.code,status:a.status||400}:{error:"Something went wrong.",status:500}}},h={ab:"Abkhazian",aa:"Afar",af:"Afrikaans",ak:"Akan",sq:"Albanian",am:"Amharic",ar:"Arabic",an:"Aragonese",hy:"Armenian",as:"Assamese",av:"Avaric",ae:"Avestan",ay:"Aymara",az:"Azerbaijani",bm:"Bambara",ba:"Bashkir",eu:"Basque",be:"Belarusian",bn:"Bengali",bh:"Bihari",bi:"Bislama",bs:"Bosnian",br:"Breton",bg:"Bulgarian",my:"Burmese",ca:"Catalan",ch:"Chamorro",ce:"Chechen",ny:"Chichewa",zh:"Chinese","zh-Hans":"Chinese (Simplified)","zh-Hant":"Chinese (Traditional)",cv:"Chuvash",kw:"Cornish",co:"Corsican",cr:"Cree",hr:"Croatian",cs:"Czech",da:"Danish",dv:"Maldivian",nl:"Dutch",dz:"Dzongkha",en:"English",eo:"Esperanto",et:"Estonian",ee:"Ewe",fo:"Faroese",fj:"Fijian",fi:"Finnish",fr:"French",ff:"Fula, Pular",gl:"Galician",gd:"Gaelic (Scottish)",gv:"Manx",ka:"Georgian",de:"German",el:"Greek",kl:"Kalaallisut",gn:"Guarani",gu:"Gujarati",ht:"Haitian Creole",ha:"Hausa",he:"Hebrew",hz:"Herero",hi:"Hindi",ho:"Hiri Motu",hu:"Hungarian",is:"Icelandic",io:"Ido",ig:"Igbo",id:"Indonesian",ia:"Interlingua",ie:"Interlingue",iu:"Inuktitut",ik:"Inupiak",ga:"Irish",it:"Italian",ja:"Japanese",jv:"Javanese",kn:"Kannada",kr:"Kanuri",ks:"Kashmiri",kk:"Kazakh",km:"Khmer",ki:"Kikuyu",rw:"Kinyarwanda",rn:"Kirundi",ky:"Kyrgyz",kv:"Komi",kg:"Kongo",ko:"Korean",ku:"Kurdish",kj:"Kwanyama",lo:"Lao",la:"Latin",lv:"Latvian",li:"Limburgish",ln:"Lingala",lt:"Lithuanian",lu:"Luga-Katanga",lg:"Luganda, Ganda",lb:"Luxembourgish",mk:"Macedonian",mg:"Malagasy",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mh:"Marshallese",mo:"Moldavian",mn:"Mongolian",na:"Nauru",nv:"Navajo",ng:"Ndonga",nd:"Northern Ndebele",ne:"Nepali",no:"Norwegian",nb:"Norwegian bokmål",nn:"Norwegian nynorsk",ii:"Sichuan Yi",oc:"Occitan",oj:"Ojibwe",cu:"Old Church Slavonic",or:"Oriya",om:"Oromo",os:"Ossetian",pi:"Pāli",ps:"Pashto, Pushto",fa:"Persian (Farsi)",pl:"Polish",pt:"Portuguese",pa:"Punjabi (Eastern)",qu:"Quechua",rm:"Romansh",ro:"Romanian",ru:"Russian",se:"Sami",sm:"Samoan",sg:"Sango",sa:"Sanskrit",sr:"Serbian",sh:"Serbo-Croatian",st:"Sesotho",tn:"Setswana",sn:"Shona",sd:"Sindhi",si:"Sinhalese",ss:"Swati",sk:"Slovak",sl:"Slovenian",so:"Somali",nr:"Southern Ndebele",es:"Spanish",su:"Sundanese",sw:"Swahili (Kiswahili)",sv:"Swedish",tl:"Tagalog",ty:"Tahitian",tg:"Tajik",ta:"Tamil",tt:"Tatar",te:"Telugu",th:"Thai",bo:"Tibetan",ti:"Tigrinya",to:"Tonga",ts:"Tsonga",tr:"Turkish",tk:"Turkmen",tw:"Twi",ug:"Uyghur",uk:"Ukrainian",ur:"Urdu",uz:"Uzbek",ve:"Venda",vi:"Vietnamese",vo:"Volapük",wa:"Wallon",cy:"Welsh",wo:"Wolof",fy:"Western Frisian",xh:"Xhosa",yi:"Yiddish",yo:"Yoruba",za:"Zhuang, Chuang",zu:"Zulu"};exports.ChaiActionsRegistry=i.actionsRegistery;exports.db=i.db;exports.getAskAiSystemPrompt=i.getAskAiSystemPrompt;exports.safeQuery=i.safeQuery;exports.schema=i.schema;exports.LANGUAGES=h;exports.initChaiBuilderActionHandler=l;
|
package/dist/actions.d.ts
CHANGED
|
@@ -2,15 +2,6 @@ import { PgColumn } from 'drizzle-orm/pg-core';
|
|
|
2
2
|
import { PgSequence } from 'drizzle-orm/pg-core';
|
|
3
3
|
import { PgTableWithColumns } from 'drizzle-orm/pg-core';
|
|
4
4
|
import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
|
|
5
|
-
import { StreamTextResult } from 'ai';
|
|
6
|
-
|
|
7
|
-
export declare type AIChatOptions = {
|
|
8
|
-
messages: any[];
|
|
9
|
-
image?: string;
|
|
10
|
-
systemPrompt?: string;
|
|
11
|
-
initiator?: string | null;
|
|
12
|
-
model?: string;
|
|
13
|
-
};
|
|
14
5
|
|
|
15
6
|
declare const aiLogs: PgTableWithColumns< {
|
|
16
7
|
name: "ai_logs";
|
|
@@ -2072,23 +2063,6 @@ baseColumn: never;
|
|
|
2072
2063
|
identity: undefined;
|
|
2073
2064
|
generated: undefined;
|
|
2074
2065
|
}, {}, {}>;
|
|
2075
|
-
configData: PgColumn< {
|
|
2076
|
-
name: "configData";
|
|
2077
|
-
tableName: "apps";
|
|
2078
|
-
dataType: "json";
|
|
2079
|
-
columnType: "PgJsonb";
|
|
2080
|
-
data: unknown;
|
|
2081
|
-
driverParam: unknown;
|
|
2082
|
-
notNull: false;
|
|
2083
|
-
hasDefault: false;
|
|
2084
|
-
isPrimaryKey: false;
|
|
2085
|
-
isAutoincrement: false;
|
|
2086
|
-
hasRuntimeDefault: false;
|
|
2087
|
-
enumValues: undefined;
|
|
2088
|
-
baseColumn: never;
|
|
2089
|
-
identity: undefined;
|
|
2090
|
-
generated: undefined;
|
|
2091
|
-
}, {}, {}>;
|
|
2092
2066
|
deletedAt: PgColumn< {
|
|
2093
2067
|
name: "deletedAt";
|
|
2094
2068
|
tableName: "apps";
|
|
@@ -2301,23 +2275,6 @@ baseColumn: never;
|
|
|
2301
2275
|
identity: undefined;
|
|
2302
2276
|
generated: undefined;
|
|
2303
2277
|
}, {}, {}>;
|
|
2304
|
-
configData: PgColumn< {
|
|
2305
|
-
name: "configData";
|
|
2306
|
-
tableName: "apps_online";
|
|
2307
|
-
dataType: "json";
|
|
2308
|
-
columnType: "PgJsonb";
|
|
2309
|
-
data: unknown;
|
|
2310
|
-
driverParam: unknown;
|
|
2311
|
-
notNull: false;
|
|
2312
|
-
hasDefault: false;
|
|
2313
|
-
isPrimaryKey: false;
|
|
2314
|
-
isAutoincrement: false;
|
|
2315
|
-
hasRuntimeDefault: false;
|
|
2316
|
-
enumValues: undefined;
|
|
2317
|
-
baseColumn: never;
|
|
2318
|
-
identity: undefined;
|
|
2319
|
-
generated: undefined;
|
|
2320
|
-
}, {}, {}>;
|
|
2321
2278
|
apiKey: PgColumn< {
|
|
2322
2279
|
name: "apiKey";
|
|
2323
2280
|
tableName: "apps_online";
|
|
@@ -2517,12 +2474,6 @@ generated: undefined;
|
|
|
2517
2474
|
dialect: "pg";
|
|
2518
2475
|
}>;
|
|
2519
2476
|
|
|
2520
|
-
export declare type AssetsParams = {
|
|
2521
|
-
search: string;
|
|
2522
|
-
limit: number;
|
|
2523
|
-
page: number;
|
|
2524
|
-
};
|
|
2525
|
-
|
|
2526
2477
|
/**
|
|
2527
2478
|
* ChaiAction Interface
|
|
2528
2479
|
* Defines the contract for all action handlers
|
|
@@ -2571,95 +2522,6 @@ declare class ChaiActionsRegistry_2 {
|
|
|
2571
2522
|
getAllActions(): Record<string, ChaiAction<any, any>>;
|
|
2572
2523
|
}
|
|
2573
2524
|
|
|
2574
|
-
export declare type ChaiAsset = {
|
|
2575
|
-
id: string;
|
|
2576
|
-
name: string;
|
|
2577
|
-
url: string;
|
|
2578
|
-
type: string;
|
|
2579
|
-
createdAt: string;
|
|
2580
|
-
updatedAt?: string;
|
|
2581
|
-
createdBy: string;
|
|
2582
|
-
size?: number;
|
|
2583
|
-
folderId: string | null;
|
|
2584
|
-
thumbnailUrl?: string;
|
|
2585
|
-
description?: string;
|
|
2586
|
-
duration?: number;
|
|
2587
|
-
format?: string;
|
|
2588
|
-
width?: number;
|
|
2589
|
-
height?: number;
|
|
2590
|
-
};
|
|
2591
|
-
|
|
2592
|
-
export declare type ChaiBuilderPage = {
|
|
2593
|
-
id: string;
|
|
2594
|
-
slug: string;
|
|
2595
|
-
name: string;
|
|
2596
|
-
lang: string;
|
|
2597
|
-
online: boolean;
|
|
2598
|
-
seo: Record<string, any>;
|
|
2599
|
-
};
|
|
2600
|
-
|
|
2601
|
-
export declare interface ChaiBuilderPagesAIInterface {
|
|
2602
|
-
handleRequest(options: AIChatOptions, res: any): Promise<StreamTextResult<any, any>>;
|
|
2603
|
-
isConfigured(): boolean;
|
|
2604
|
-
}
|
|
2605
|
-
|
|
2606
|
-
export declare type ChaiBuilderPageType = {
|
|
2607
|
-
key: string;
|
|
2608
|
-
helpText?: string;
|
|
2609
|
-
icon?: string;
|
|
2610
|
-
hasSlug?: boolean;
|
|
2611
|
-
name: string | (() => Promise<string>);
|
|
2612
|
-
dynamicSegments?: string;
|
|
2613
|
-
dynamicSlug?: string;
|
|
2614
|
-
getDynamicPages?: ({ query, uuid }: {
|
|
2615
|
-
query?: string;
|
|
2616
|
-
uuid?: string;
|
|
2617
|
-
}) => Promise<ChaiDynamicPage[]>;
|
|
2618
|
-
search?: (query: string) => Promise<PageTypeSearchResult[] | Error>;
|
|
2619
|
-
resolveLink?: (id: string, draft?: boolean, lang?: string) => Promise<string>;
|
|
2620
|
-
onCreate?: (data: Omit<ChaiBuilderPage, "seo">) => Promise<void>;
|
|
2621
|
-
onUpdate?: (data: ChaiBuilderPage) => Promise<void>;
|
|
2622
|
-
onDelete?: (data: Pick<ChaiBuilderPage, "id">) => Promise<void>;
|
|
2623
|
-
dataProvider?: (args: {
|
|
2624
|
-
lang: string;
|
|
2625
|
-
draft: boolean;
|
|
2626
|
-
inBuilder: boolean;
|
|
2627
|
-
pageProps: ChaiPageProps;
|
|
2628
|
-
}) => Promise<Record<string, any>>;
|
|
2629
|
-
defaultTrackingInfo?: () => Record<string, any>;
|
|
2630
|
-
defaultSeo?: () => Record<string, any>;
|
|
2631
|
-
defaultJSONLD?: () => Record<string, any>;
|
|
2632
|
-
defaultMetaTags?: () => Record<string, string>;
|
|
2633
|
-
};
|
|
2634
|
-
|
|
2635
|
-
export declare type ChaiBuilderUserInfo = {
|
|
2636
|
-
id: string;
|
|
2637
|
-
email: string;
|
|
2638
|
-
name: string;
|
|
2639
|
-
avatar?: string;
|
|
2640
|
-
};
|
|
2641
|
-
|
|
2642
|
-
export declare type ChaiDynamicPage = {
|
|
2643
|
-
id: string;
|
|
2644
|
-
slug: string;
|
|
2645
|
-
name: string;
|
|
2646
|
-
primaryPage?: string;
|
|
2647
|
-
};
|
|
2648
|
-
|
|
2649
|
-
export declare interface ChaiPageProps {
|
|
2650
|
-
slug: string;
|
|
2651
|
-
searchParams?: Record<string, string>;
|
|
2652
|
-
[key: string]: any;
|
|
2653
|
-
}
|
|
2654
|
-
|
|
2655
|
-
export declare type ChaiWebsiteSetting = {
|
|
2656
|
-
appKey: string;
|
|
2657
|
-
fallbackLang: string;
|
|
2658
|
-
languages: string[];
|
|
2659
|
-
theme: Record<"fontFamily" | "borderRadius" | "colors", any>;
|
|
2660
|
-
designTokens: DesignTokens;
|
|
2661
|
-
};
|
|
2662
|
-
|
|
2663
2525
|
export declare const db: PostgresJsDatabase<typeof schema>;
|
|
2664
2526
|
|
|
2665
2527
|
declare type DbResult<T> = {
|
|
@@ -2670,13 +2532,6 @@ declare type DbResult<T> = {
|
|
|
2670
2532
|
error: Error;
|
|
2671
2533
|
};
|
|
2672
2534
|
|
|
2673
|
-
export declare type DesignTokens = {
|
|
2674
|
-
[token: string]: {
|
|
2675
|
-
value: string;
|
|
2676
|
-
name: string;
|
|
2677
|
-
};
|
|
2678
|
-
};
|
|
2679
|
-
|
|
2680
2535
|
/**
|
|
2681
2536
|
*
|
|
2682
2537
|
* @param translation
|
|
@@ -3162,19 +3017,6 @@ generated: undefined;
|
|
|
3162
3017
|
dialect: "pg";
|
|
3163
3018
|
}>;
|
|
3164
3019
|
|
|
3165
|
-
export declare interface LoggedInUser {
|
|
3166
|
-
id: string;
|
|
3167
|
-
email: string;
|
|
3168
|
-
name: string;
|
|
3169
|
-
avatar?: string;
|
|
3170
|
-
}
|
|
3171
|
-
|
|
3172
|
-
export declare type PageTypeSearchResult = {
|
|
3173
|
-
id: string;
|
|
3174
|
-
name: string;
|
|
3175
|
-
slug?: string;
|
|
3176
|
-
};
|
|
3177
|
-
|
|
3178
3020
|
export declare function safeQuery<T>(queryFn: () => Promise<T>): Promise<DbResult<T>>;
|
|
3179
3021
|
|
|
3180
3022
|
declare namespace schema {
|
package/dist/actions.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as u, A as h } from "./actions-registery-
|
|
2
|
-
import { a as b, d as y, b as A, s as S, c as v } from "./actions-registery-
|
|
1
|
+
import { g as u, A as h } from "./actions-registery-Bj-j1k5i.js";
|
|
2
|
+
import { a as b, d as y, b as A, s as S, c as v } from "./actions-registery-Bj-j1k5i.js";
|
|
3
3
|
const c = (r) => async (s) => {
|
|
4
4
|
const { apiKey: o, userId: t } = r;
|
|
5
5
|
try {
|
|
@@ -14,7 +14,7 @@ const c = (r) => async (s) => {
|
|
|
14
14
|
status: 404
|
|
15
15
|
};
|
|
16
16
|
} catch (a) {
|
|
17
|
-
return console.log("Error in builderApiHandler:", a), a instanceof h ? { error: a.message, code: a.code, status: 400 } : { error: "Something went wrong.", status: 500 };
|
|
17
|
+
return console.log("Error in builderApiHandler:", a), a instanceof h ? { error: a.message, code: a.code, status: a.status || 400 } : { error: "Something went wrong.", status: 500 };
|
|
18
18
|
}
|
|
19
19
|
}, d = {
|
|
20
20
|
ab: "Abkhazian",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { B as r } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
+
import { G as i, H as o, I as l, J as c, K as d } from "./index-DsQXiNA_.js";
|
|
4
|
+
import { ao as m, a as h, B as u, E as p, P as N } from "./index-DtMksfXx.js";
|
|
5
|
+
import { TableIcon as f, Edit as T } from "lucide-react";
|
|
6
|
+
import { useTranslation as E } from "react-i18next";
|
|
7
|
+
const b = () => {
|
|
8
|
+
const s = m(), { setPageStatus: n } = h(), { t: a } = E();
|
|
9
|
+
return /* @__PURE__ */ e(u, { children: /* @__PURE__ */ t(i, { className: "mx-auto w-full max-w-md", children: [
|
|
10
|
+
/* @__PURE__ */ e(o, { className: "space-y-1", children: /* @__PURE__ */ t(l, { className: "flex items-center gap-2 text-xl font-medium", children: [
|
|
11
|
+
/* @__PURE__ */ e(f, { className: "h-6 w-6 text-green-500" }),
|
|
12
|
+
/* @__PURE__ */ e("span", { children: a("Active in Another Tab") })
|
|
13
|
+
] }) }),
|
|
14
|
+
/* @__PURE__ */ e(c, { className: "space-y-4", children: /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: a(
|
|
15
|
+
"This page is currently being edited in another tab. You can continue editing here, which will close the editor in the other tab."
|
|
16
|
+
) }) }),
|
|
17
|
+
/* @__PURE__ */ e(d, { className: "flex justify-end gap-2", children: /* @__PURE__ */ t(
|
|
18
|
+
r,
|
|
19
|
+
{
|
|
20
|
+
variant: "default",
|
|
21
|
+
onClick: () => {
|
|
22
|
+
s(p.CONTINUE_EDITING_IN_THIS_TAB_REQUEST), n(N.CHECKING);
|
|
23
|
+
},
|
|
24
|
+
className: "gap-2",
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ e(T, { className: "h-4 w-4" }),
|
|
27
|
+
a("Continue Editing Here")
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
) })
|
|
31
|
+
] }) });
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
b as default
|
|
35
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./register-chai-top-bar-DyW9GPzV.cjs"),t=require("./index-mPCp0j2h.cjs"),s=require("./index-CAhDwfHE.cjs"),n=require("lucide-react"),l=require("react-i18next"),o=()=>{const r=s.useSendRealtimeEvent(),{setPageStatus:i}=s.usePageLockStatus(),{t:a}=l.useTranslation();return e.jsx(s.BlurContainer,{children:e.jsxs(t.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(t.CardHeader,{className:"space-y-1",children:e.jsxs(t.CardTitle,{className:"flex items-center gap-2 text-xl font-medium",children:[e.jsx(n.TableIcon,{className:"h-6 w-6 text-green-500"}),e.jsx("span",{children:a("Active in Another Tab")})]})}),e.jsx(t.CardContent,{className:"space-y-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:a("This page is currently being edited in another tab. You can continue editing here, which will close the editor in the other tab.")})}),e.jsx(t.CardFooter,{className:"flex justify-end gap-2",children:e.jsxs(c.Button,{variant:"default",onClick:()=>{r(s.EVENT.CONTINUE_EDITING_IN_THIS_TAB_REQUEST),i(s.PAGE_STATUS.CHECKING)},className:"gap-2",children:[e.jsx(n.Edit,{className:"h-4 w-4"}),a("Continue Editing Here")]})})]})})};exports.default=o;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as t, jsxs as g, Fragment as hn } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { p as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { z as fn, D as H, B as gn } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
+
import { d as mn, o as xn, D as vn, e as pn, f as Sn, g as Nn, p as Fn, q as I, r as wn } from "./index-DsQXiNA_.js";
|
|
4
|
+
import { p as An, r as Cn, S as Dn } from "./slug-input-CAqkFZBq.js";
|
|
5
|
+
import { g as En, h as $n, i as Ln, j as kn, k as Tn, l as Z, m as Un, c as Bn, L as A } from "./index-DtMksfXx.js";
|
|
6
|
+
import { filter as Rn, find as Wn, startsWith as In } from "lodash-es";
|
|
6
7
|
import { Loader as qn } from "lucide-react";
|
|
7
8
|
import { useMemo as $, useState as L, useEffect as _ } from "react";
|
|
8
9
|
import { useTranslation as k } from "react-i18next";
|
|
@@ -17,7 +18,7 @@ const b = ({
|
|
|
17
18
|
}) => {
|
|
18
19
|
const { t: n } = k();
|
|
19
20
|
return /* @__PURE__ */ g("div", { className: "space-y-1", children: [
|
|
20
|
-
/* @__PURE__ */ t(
|
|
21
|
+
/* @__PURE__ */ t(I, { htmlFor: "lang", children: n("Language") }),
|
|
21
22
|
/* @__PURE__ */ g(
|
|
22
23
|
"select",
|
|
23
24
|
{
|
|
@@ -25,7 +26,7 @@ const b = ({
|
|
|
25
26
|
disabled: c || !a.length,
|
|
26
27
|
onChange: (l) => {
|
|
27
28
|
const f = l.target.value;
|
|
28
|
-
s(f), !c && (
|
|
29
|
+
s(f), !c && (In(i, o == null ? void 0 : o.name) || i.length === 0) && d(`${o == null ? void 0 : o.name} - ${A[f]}`);
|
|
29
30
|
},
|
|
30
31
|
className: "col-span-3 flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
31
32
|
children: [
|
|
@@ -38,9 +39,9 @@ const b = ({
|
|
|
38
39
|
}, y = ({ lang: c, name: h, setName: a, parentHasSelectedLanguagePage: i }) => {
|
|
39
40
|
const { t: s } = k();
|
|
40
41
|
return /* @__PURE__ */ g("div", { className: "space-y-1", children: [
|
|
41
|
-
/* @__PURE__ */ t(
|
|
42
|
+
/* @__PURE__ */ t(I, { htmlFor: "name", children: s("Page Name") }),
|
|
42
43
|
/* @__PURE__ */ t(
|
|
43
|
-
|
|
44
|
+
fn,
|
|
44
45
|
{
|
|
45
46
|
id: "name",
|
|
46
47
|
value: c ? h : "",
|
|
@@ -75,11 +76,11 @@ const b = ({
|
|
|
75
76
|
type: "checkbox",
|
|
76
77
|
id: "useLanguagePrefix",
|
|
77
78
|
checked: s,
|
|
78
|
-
onChange: (
|
|
79
|
+
onChange: (p) => d(p.target.checked),
|
|
79
80
|
className: "rounded border-gray-300"
|
|
80
81
|
}
|
|
81
82
|
),
|
|
82
|
-
/* @__PURE__ */ g(
|
|
83
|
+
/* @__PURE__ */ g(I, { htmlFor: "useLanguagePrefix", className: "text-sm font-normal leading-tight", children: [
|
|
83
84
|
"Add language code (",
|
|
84
85
|
/* @__PURE__ */ g("span", { className: "font-mono text-gray-900", children: [
|
|
85
86
|
"/",
|
|
@@ -88,7 +89,7 @@ const b = ({
|
|
|
88
89
|
") as slug prefix"
|
|
89
90
|
] })
|
|
90
91
|
] }),
|
|
91
|
-
/* @__PURE__ */ t(
|
|
92
|
+
/* @__PURE__ */ t(I, { htmlFor: "slug", children: r("Slug") }),
|
|
92
93
|
c ? /* @__PURE__ */ t(H, { variant: "default", className: "p-2 text-xs font-medium italic text-muted-foreground", children: r("This page will use dynamic slug as defined in primary page") }) : /* @__PURE__ */ t(
|
|
93
94
|
Dn,
|
|
94
95
|
{
|
|
@@ -117,9 +118,9 @@ const b = ({
|
|
|
117
118
|
isSlugValid: x,
|
|
118
119
|
isPending: m
|
|
119
120
|
}) => {
|
|
120
|
-
const { t: r } = k(),
|
|
121
|
-
return /* @__PURE__ */ t(
|
|
122
|
-
/* @__PURE__ */ t(
|
|
121
|
+
const { t: r } = k(), p = m || !h || !a || n.some((v) => (s ? v.id !== d : !0) && v.parent === (o == null ? void 0 : o.id) && v.lang === a) || !l && !(f && u) && (!x || !i);
|
|
122
|
+
return /* @__PURE__ */ t(wn, { children: c ? /* @__PURE__ */ g(hn, { children: [
|
|
123
|
+
/* @__PURE__ */ t(gn, { type: "submit", disabled: p && !o.dynamic, children: m ? /* @__PURE__ */ g("span", { className: "flex items-center gap-2", children: [
|
|
123
124
|
/* @__PURE__ */ t("span", { className: "loader mr-2" }),
|
|
124
125
|
r(s ? "Updating..." : "Adding...")
|
|
125
126
|
] }) : r(s ? "Update" : "Add new language page") }),
|
|
@@ -133,7 +134,7 @@ const b = ({
|
|
|
133
134
|
" ",
|
|
134
135
|
r("page in the parent to add here.")
|
|
135
136
|
] }) }) });
|
|
136
|
-
},
|
|
137
|
+
}, zn = ({
|
|
137
138
|
onSubmit: c,
|
|
138
139
|
edit: h,
|
|
139
140
|
lang: a,
|
|
@@ -148,9 +149,9 @@ const b = ({
|
|
|
148
149
|
isNonSlugPageType: x,
|
|
149
150
|
isHomePage: m,
|
|
150
151
|
useLanguagePrefix: r,
|
|
151
|
-
slug:
|
|
152
|
+
slug: p,
|
|
152
153
|
isSlugValid: v,
|
|
153
|
-
isPending:
|
|
154
|
+
isPending: S
|
|
154
155
|
}) => /* @__PURE__ */ g("form", { onSubmit: c, children: [
|
|
155
156
|
/* @__PURE__ */ g("div", { className: "grid gap-4 py-4", children: [
|
|
156
157
|
/* @__PURE__ */ t(
|
|
@@ -181,7 +182,7 @@ const b = ({
|
|
|
181
182
|
parentHasSelectedLanguagePage: l,
|
|
182
183
|
name: s,
|
|
183
184
|
lang: a,
|
|
184
|
-
slug:
|
|
185
|
+
slug: p,
|
|
185
186
|
edit: h,
|
|
186
187
|
id: f,
|
|
187
188
|
primaryPageObject: n,
|
|
@@ -190,10 +191,10 @@ const b = ({
|
|
|
190
191
|
isHomePage: m,
|
|
191
192
|
useLanguagePrefix: r,
|
|
192
193
|
isSlugValid: v,
|
|
193
|
-
isPending:
|
|
194
|
+
isPending: S
|
|
194
195
|
}
|
|
195
196
|
)
|
|
196
|
-
] }),
|
|
197
|
+
] }), Mn = ({
|
|
197
198
|
loading: c,
|
|
198
199
|
onSubmit: h,
|
|
199
200
|
edit: a,
|
|
@@ -208,9 +209,9 @@ const b = ({
|
|
|
208
209
|
isRootPage: x,
|
|
209
210
|
useLanguagePrefix: m,
|
|
210
211
|
setUseLanguagePrefix: r,
|
|
211
|
-
isHomePage:
|
|
212
|
+
isHomePage: p,
|
|
212
213
|
parentSlug: v,
|
|
213
|
-
slug:
|
|
214
|
+
slug: S,
|
|
214
215
|
setSlug: T,
|
|
215
216
|
isSlugValid: E,
|
|
216
217
|
setIsSlugValid: q,
|
|
@@ -219,7 +220,7 @@ const b = ({
|
|
|
219
220
|
id: B,
|
|
220
221
|
pages: w
|
|
221
222
|
}) => c ? /* @__PURE__ */ t("div", { className: "flex h-80 items-center justify-center", children: /* @__PURE__ */ t(qn, { className: "animate-spin" }) }) : u ? /* @__PURE__ */ t(
|
|
222
|
-
|
|
223
|
+
zn,
|
|
223
224
|
{
|
|
224
225
|
onSubmit: h,
|
|
225
226
|
edit: a,
|
|
@@ -233,9 +234,9 @@ const b = ({
|
|
|
233
234
|
id: B,
|
|
234
235
|
pages: w,
|
|
235
236
|
isNonSlugPageType: u,
|
|
236
|
-
isHomePage:
|
|
237
|
+
isHomePage: p,
|
|
237
238
|
useLanguagePrefix: m,
|
|
238
|
-
slug:
|
|
239
|
+
slug: S,
|
|
239
240
|
isSlugValid: E,
|
|
240
241
|
isPending: U
|
|
241
242
|
}
|
|
@@ -271,10 +272,10 @@ const b = ({
|
|
|
271
272
|
lang: i,
|
|
272
273
|
useLanguagePrefix: m,
|
|
273
274
|
setUseLanguagePrefix: r,
|
|
274
|
-
isHomePage:
|
|
275
|
+
isHomePage: p,
|
|
275
276
|
parentSlug: v,
|
|
276
277
|
parentHasSelectedLanguagePage: f,
|
|
277
|
-
slug:
|
|
278
|
+
slug: S,
|
|
278
279
|
setSlug: T,
|
|
279
280
|
isSlugValid: E,
|
|
280
281
|
setIsSlugValid: q,
|
|
@@ -288,19 +289,19 @@ const b = ({
|
|
|
288
289
|
parentHasSelectedLanguagePage: f,
|
|
289
290
|
name: d,
|
|
290
291
|
lang: i,
|
|
291
|
-
slug:
|
|
292
|
+
slug: S,
|
|
292
293
|
edit: a,
|
|
293
294
|
id: B,
|
|
294
295
|
primaryPageObject: l,
|
|
295
296
|
pages: w,
|
|
296
297
|
isNonSlugPageType: u,
|
|
297
|
-
isHomePage:
|
|
298
|
+
isHomePage: p,
|
|
298
299
|
useLanguagePrefix: m,
|
|
299
300
|
isSlugValid: E,
|
|
300
301
|
isPending: U
|
|
301
302
|
}
|
|
302
303
|
)
|
|
303
|
-
] }),
|
|
304
|
+
] }), bn = ({
|
|
304
305
|
id: c,
|
|
305
306
|
isOpen: h,
|
|
306
307
|
onClose: a,
|
|
@@ -308,19 +309,19 @@ const b = ({
|
|
|
308
309
|
edit: s = !1,
|
|
309
310
|
preselectedLang: d
|
|
310
311
|
}) => {
|
|
311
|
-
const { data: o = [] } = En(), n = $(() => o.find((e) => e.id === i), [o, i]), [l, f] = L(""), [u, x] = L(""), [m, r] = L(""), [
|
|
312
|
+
const { data: o = [] } = En(), n = $(() => o.find((e) => e.id === i), [o, i]), [l, f] = L(""), [u, x] = L(""), [m, r] = L(""), [p, v] = L(!0), [S, T] = L(!0), { mutate: E, isPending: q } = $n(), { mutate: G, isPending: U } = Ln(), B = q || U, { data: w, isFetching: j } = kn(), Y = Tn(), { data: C, isFetching: O } = Z(i), { data: F = [], isFetching: nn } = Z(
|
|
312
313
|
n == null ? void 0 : n.parent
|
|
313
|
-
), { data: J = [], isFetching: en } = Un(), { setSelectedLang: sn } =
|
|
314
|
+
), { data: J = [], isFetching: en } = Un(), { setSelectedLang: sn } = mn(), { t: z } = k(), [, tn] = Bn(), [, on] = xn(), ln = j || O || nn || en, D = $(() => Rn(w == null ? void 0 : w.languages, (e) => !Wn(C, { lang: e })), [w, C]), M = $(
|
|
314
315
|
() => J.find((e) => e.key === (n == null ? void 0 : n.pageType)),
|
|
315
316
|
[J, n == null ? void 0 : n.pageType]
|
|
316
|
-
), K = !(
|
|
317
|
+
), K = !(M != null && M.hasSlug), V = (n == null ? void 0 : n.slug) === "/";
|
|
317
318
|
_(() => {
|
|
318
319
|
if (!s && n && d && (x(d), f(`${n.name} - ${A[d]}`)), !s || !n) return;
|
|
319
320
|
const e = C == null ? void 0 : C.find((rn) => rn.id === c);
|
|
320
321
|
if (!e) return;
|
|
321
322
|
f(e.name), x(e.lang);
|
|
322
|
-
const N = e.slug || "", { initSlug:
|
|
323
|
-
r(
|
|
323
|
+
const N = e.slug || "", { initSlug: W, prefix: cn } = An(N, n);
|
|
324
|
+
r(W), T(cn);
|
|
324
325
|
}, [s, c, C, n, d]), _(() => {
|
|
325
326
|
if (d)
|
|
326
327
|
x(d);
|
|
@@ -330,22 +331,22 @@ const b = ({
|
|
|
330
331
|
x(e), (!l || l === (n == null ? void 0 : n.name)) && f(`${n == null ? void 0 : n.name} - ${A[e]}`);
|
|
331
332
|
}
|
|
332
333
|
}, [d, D, s, l, n]);
|
|
333
|
-
const { parentSlug: Q, isRootPage:
|
|
334
|
-
if (
|
|
334
|
+
const { parentSlug: Q, isRootPage: R } = $(() => {
|
|
335
|
+
if (V || !u)
|
|
335
336
|
return { parentSlug: void 0, isRootPage: !(n != null && n.parent) };
|
|
336
337
|
if (!(n != null && n.parent))
|
|
337
338
|
return {
|
|
338
|
-
parentSlug:
|
|
339
|
+
parentSlug: S ? `/${u}` : void 0,
|
|
339
340
|
isRootPage: !0
|
|
340
341
|
};
|
|
341
342
|
const e = F == null ? void 0 : F.find((N) => N.lang === u);
|
|
342
343
|
return { parentSlug: e == null ? void 0 : e.slug, isRootPage: !1 };
|
|
343
|
-
}, [n == null ? void 0 : n.parent, F,
|
|
344
|
+
}, [n == null ? void 0 : n.parent, F, S, u, V]), an = $(() => R ? !0 : !!(F != null && F.some((e) => (e == null ? void 0 : e.lang) === u)), [u, F, R]), X = () => {
|
|
344
345
|
let e = "";
|
|
345
|
-
return
|
|
346
|
+
return R ? e = `/${S ? [u, m].filter(Boolean).join("/") : m}` : e = `${Cn(Q)}/${m}`, e.replace(/\/{2,}/g, "/").replace(/\/$/, "");
|
|
346
347
|
}, dn = (e) => {
|
|
347
348
|
const N = new URLSearchParams(window.location.search);
|
|
348
|
-
|
|
349
|
+
Y && e === Y ? N.delete("lang") : N.set("lang", e), tn(N), window.dispatchEvent(new PopStateEvent("popstate"));
|
|
349
350
|
}, un = (e) => {
|
|
350
351
|
e.preventDefault();
|
|
351
352
|
const N = {
|
|
@@ -355,18 +356,18 @@ const b = ({
|
|
|
355
356
|
slug: K ? "" : X(),
|
|
356
357
|
pageType: n == null ? void 0 : n.pageType,
|
|
357
358
|
...s && { id: c }
|
|
358
|
-
},
|
|
359
|
+
}, W = () => {
|
|
359
360
|
!s && u && (sn(u), dn(u)), on("outline"), a();
|
|
360
361
|
};
|
|
361
|
-
s ? G(N, { onSuccess:
|
|
362
|
+
s ? G(N, { onSuccess: W }) : E(N, { onSuccess: W });
|
|
362
363
|
};
|
|
363
|
-
return /* @__PURE__ */ t(
|
|
364
|
-
/* @__PURE__ */ g(
|
|
365
|
-
/* @__PURE__ */ t(
|
|
366
|
-
/* @__PURE__ */ t(
|
|
364
|
+
return /* @__PURE__ */ t(vn, { open: h, onOpenChange: a, children: h && /* @__PURE__ */ g(pn, { className: "text-slate-600 sm:max-w-[425px]", children: [
|
|
365
|
+
/* @__PURE__ */ g(Sn, { children: [
|
|
366
|
+
/* @__PURE__ */ t(Nn, { children: z(s ? "Edit language" : "Add new language page") }),
|
|
367
|
+
/* @__PURE__ */ t(Fn, { className: "font-light", children: z("Enter the details for the language") })
|
|
367
368
|
] }),
|
|
368
369
|
/* @__PURE__ */ t(
|
|
369
|
-
|
|
370
|
+
Mn,
|
|
370
371
|
{
|
|
371
372
|
id: c,
|
|
372
373
|
pages: o,
|
|
@@ -381,14 +382,14 @@ const b = ({
|
|
|
381
382
|
primaryPageObject: n,
|
|
382
383
|
parentHasSelectedLanguagePage: an,
|
|
383
384
|
isNonSlugPageType: K,
|
|
384
|
-
isRootPage:
|
|
385
|
-
useLanguagePrefix:
|
|
385
|
+
isRootPage: R,
|
|
386
|
+
useLanguagePrefix: S,
|
|
386
387
|
setUseLanguagePrefix: T,
|
|
387
|
-
isHomePage:
|
|
388
|
+
isHomePage: V,
|
|
388
389
|
parentSlug: Q,
|
|
389
390
|
slug: m,
|
|
390
391
|
setSlug: r,
|
|
391
|
-
isSlugValid:
|
|
392
|
+
isSlugValid: p,
|
|
392
393
|
setIsSlugValid: v,
|
|
393
394
|
getSlug: X,
|
|
394
395
|
isPending: B
|
|
@@ -397,5 +398,5 @@ const b = ({
|
|
|
397
398
|
] }) });
|
|
398
399
|
};
|
|
399
400
|
export {
|
|
400
|
-
|
|
401
|
+
bn as default
|
|
401
402
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),k=require("./register-chai-top-bar-DyW9GPzV.cjs"),N=require("./index-mPCp0j2h.cjs"),Y=require("./slug-input-Curnt2n3.cjs"),g=require("./index-CAhDwfHE.cjs"),j=require("lodash-es"),ds=require("lucide-react"),v=require("react"),U=require("react-i18next"),Z=({edit:c,lang:h,languages:a,name:u,setLang:t,setName:i,primaryPageObject:o})=>{const{t:s}=U.useTranslation();return e.jsxs("div",{className:"space-y-1",children:[e.jsx(N.Label,{htmlFor:"lang",children:s("Language")}),e.jsxs("select",{value:c?"":h,disabled:c||!a.length,onChange:l=>{const x=l.target.value;t(x),!c&&(j.startsWith(u,o==null?void 0:o.name)||u.length===0)&&i(`${o==null?void 0:o.name} - ${g.LANGUAGES[x]}`)},className:"col-span-3 flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx("option",{value:"",disabled:!0,children:c?g.LANGUAGES[h]||h:a.length?s("Choose language"):s("All available language page is created.")}),a.map(l=>e.jsx("option",{value:l,children:g.LANGUAGES[l]||l},l))]})]})},_=({lang:c,name:h,setName:a,parentHasSelectedLanguagePage:u})=>{const{t}=U.useTranslation();return e.jsxs("div",{className:"space-y-1",children:[e.jsx(N.Label,{htmlFor:"name",children:t("Page Name")}),e.jsx(k.Input,{id:"name",value:c?h:"",onChange:i=>a(i.target.value),required:!0,placeholder:t(c?"Enter page name":"Choose language to add slug"),disabled:!u||!c})]})},cs=({dynamic:c,isNonSlugPageType:h,isRootPage:a,lang:u,useLanguagePrefix:t,setUseLanguagePrefix:i,isHomePage:o,parentSlug:s,parentHasSelectedLanguagePage:l,slug:x,setSlug:d,setIsSlugValid:S,getSlug:f})=>{const{t:r}=U.useTranslation();return h?null:e.jsxs("div",{className:"space-y-1",children:[a&&u&&e.jsxs("div",{className:"flex items-center space-x-2 pb-1",children:[e.jsx("input",{type:"checkbox",id:"useLanguagePrefix",checked:t,onChange:A=>i(A.target.checked),className:"rounded border-gray-300"}),e.jsxs(N.Label,{htmlFor:"useLanguagePrefix",className:"text-sm font-normal leading-tight",children:["Add language code (",e.jsxs("span",{className:"font-mono text-gray-900",children:["/",u]}),") as slug prefix"]})]}),e.jsx(N.Label,{htmlFor:"slug",children:r("Slug")}),c?e.jsx(k.Alert,{variant:"default",className:"p-2 text-xs font-medium italic text-muted-foreground",children:r("This page will use dynamic slug as defined in primary page")}):e.jsx(Y.SlugInput,{disabled:!u||!l,value:x,onChange:d,placeholder:r(u?o&&t?"Leave empty for home page":"Enter page slug":"Choose language to add slug"),parentSlug:s,onValidationChange:S,fullSlug:f()})]})},H=({parentHasSelectedLanguagePage:c,name:h,lang:a,slug:u,edit:t,id:i,primaryPageObject:o,pages:s,isNonSlugPageType:l,isHomePage:x,useLanguagePrefix:d,isSlugValid:S,isPending:f})=>{const{t:r}=U.useTranslation(),A=f||!h||!a||s.some(m=>(t?m.id!==i:!0)&&m.parent===(o==null?void 0:o.id)&&m.lang===a)||!l&&!(x&&d)&&(!S||!u);return e.jsx(N.DialogFooter,{children:c?e.jsxs(e.Fragment,{children:[e.jsx(k.Button,{type:"submit",disabled:A&&!o.dynamic,children:f?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"loader mr-2"}),r(t?"Updating...":"Adding...")]}):r(t?"Update":"Add new language page")}),s.some(m=>(t?m.id!==i:!0)&&m.parent===(o==null?void 0:o.id)&&m.lang===a)&&e.jsx("p",{className:"mt-2 text-xs text-red-500",children:r("A page for this language already exists.")})]}):a&&e.jsx(k.Alert,{variant:"destructive",children:e.jsxs("p",{className:"mx-auto w-5/6 text-center",children:[r("You need to create the")," ",e.jsx("span",{className:"font-medium",children:g.LANGUAGES[a]})," ",r("page in the parent to add here.")]})})})},rs=({onSubmit:c,edit:h,lang:a,languages:u,name:t,setLang:i,setName:o,primaryPageObject:s,parentHasSelectedLanguagePage:l,id:x,pages:d,isNonSlugPageType:S,isHomePage:f,useLanguagePrefix:r,slug:A,isSlugValid:m,isPending:p})=>e.jsxs("form",{onSubmit:c,children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(Z,{edit:h,lang:a,languages:u,name:t,setLang:i,setName:o,primaryPageObject:s}),e.jsx(_,{lang:a,name:t,setName:o,parentHasSelectedLanguagePage:l})]}),e.jsx(H,{parentHasSelectedLanguagePage:l,name:t,lang:a,slug:A,edit:h,id:x,primaryPageObject:s,pages:d,isNonSlugPageType:S,isHomePage:f,useLanguagePrefix:r,isSlugValid:m,isPending:p})]}),hs=({loading:c,onSubmit:h,edit:a,lang:u,languages:t,name:i,setLang:o,setName:s,primaryPageObject:l,parentHasSelectedLanguagePage:x,isNonSlugPageType:d,isRootPage:S,useLanguagePrefix:f,setUseLanguagePrefix:r,isHomePage:A,parentSlug:m,slug:p,setSlug:C,isSlugValid:T,setIsSlugValid:I,getSlug:M,isPending:$,id:q,pages:L})=>c?e.jsx("div",{className:"flex h-80 items-center justify-center",children:e.jsx(ds.Loader,{className:"animate-spin"})}):d?e.jsx(rs,{onSubmit:h,edit:a,lang:u,languages:t,name:i,setLang:o,setName:s,primaryPageObject:l,parentHasSelectedLanguagePage:x,id:q,pages:L,isNonSlugPageType:d,isHomePage:A,useLanguagePrefix:f,slug:p,isSlugValid:T,isPending:$}):e.jsxs("form",{onSubmit:h,children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(Z,{edit:a,lang:u,languages:t,name:i,setLang:o,setName:s,primaryPageObject:l}),e.jsx(_,{lang:u,name:i,setName:s,parentHasSelectedLanguagePage:x}),e.jsx(cs,{dynamic:l==null?void 0:l.dynamic,isNonSlugPageType:d,isRootPage:S,lang:u,useLanguagePrefix:f,setUseLanguagePrefix:r,isHomePage:A,parentSlug:m,parentHasSelectedLanguagePage:x,slug:p,setSlug:C,isSlugValid:T,setIsSlugValid:I,getSlug:M})]}),e.jsx(H,{parentHasSelectedLanguagePage:x,name:i,lang:u,slug:p,edit:a,id:q,primaryPageObject:l,pages:L,isNonSlugPageType:d,isHomePage:A,useLanguagePrefix:f,isSlugValid:T,isPending:$})]}),xs=({id:c,isOpen:h,onClose:a,primaryPage:u,edit:t=!1,preselectedLang:i})=>{const{data:o=[]}=g.useWebsitePages(),s=v.useMemo(()=>o.find(n=>n.id===u),[o,u]),[l,x]=v.useState(""),[d,S]=v.useState(""),[f,r]=v.useState(""),[A,m]=v.useState(!0),[p,C]=v.useState(!0),{mutate:T,isPending:I}=g.useCreatePage(),{mutate:M,isPending:$}=g.useUpdatePage(),q=I||$,{data:L,isFetching:b}=g.useWebsiteSetting(),z=g.useFallbackLang(),{data:w,isFetching:y}=g.useLanguagePages(u),{data:F=[],isFetching:P}=g.useLanguagePages(s==null?void 0:s.parent),{data:J=[],isFetching:O}=g.usePageTypes(),{setSelectedLang:ss}=N.useLanguages(),{t:B}=U.useTranslation(),[,es]=g.useSearchParams(),[,ns]=N.useSidebarActivePanel(),ts=b||y||P||O,G=v.useMemo(()=>j.filter(L==null?void 0:L.languages,n=>!j.find(w,{lang:n})),[L,w]),W=v.useMemo(()=>J.find(n=>n.key===(s==null?void 0:s.pageType)),[J,s==null?void 0:s.pageType]),K=!(W!=null&&W.hasSlug),V=(s==null?void 0:s.slug)==="/";v.useEffect(()=>{if(!t&&s&&i&&(S(i),x(`${s.name} - ${g.LANGUAGES[i]}`)),!t||!s)return;const n=w==null?void 0:w.find(is=>is.id===c);if(!n)return;x(n.name),S(n.lang);const E=n.slug||"",{initSlug:R,prefix:us}=Y.parseSlugForEdit(E,s);r(R),C(us)},[t,c,w,s,i]),v.useEffect(()=>{if(i)S(i);else if((G==null?void 0:G.length)===1&&!t){const n=G[0];if(!n||!g.LANGUAGES[n])return;S(n),(!l||l===(s==null?void 0:s.name))&&x(`${s==null?void 0:s.name} - ${g.LANGUAGES[n]}`)}},[i,G,t,l,s]);const{parentSlug:Q,isRootPage:D}=v.useMemo(()=>{if(V||!d)return{parentSlug:void 0,isRootPage:!(s!=null&&s.parent)};if(!(s!=null&&s.parent))return{parentSlug:p?`/${d}`:void 0,isRootPage:!0};const n=F==null?void 0:F.find(E=>E.lang===d);return{parentSlug:n==null?void 0:n.slug,isRootPage:!1}},[s==null?void 0:s.parent,F,p,d,V]),os=v.useMemo(()=>D?!0:!!(F!=null&&F.some(n=>(n==null?void 0:n.lang)===d)),[d,F,D]),X=()=>{let n="";return D?n=`/${p?[d,f].filter(Boolean).join("/"):f}`:n=`${Y.removeSlugExtension(Q)}/${f}`,n.replace(/\/{2,}/g,"/").replace(/\/$/,"")},ls=n=>{const E=new URLSearchParams(window.location.search);z&&n===z?E.delete("lang"):E.set("lang",n),es(E),window.dispatchEvent(new PopStateEvent("popstate"))},as=n=>{n.preventDefault();const E={name:l,lang:d,primaryPage:s==null?void 0:s.id,slug:K?"":X(),pageType:s==null?void 0:s.pageType,...t&&{id:c}},R=()=>{!t&&d&&(ss(d),ls(d)),ns("outline"),a()};t?M(E,{onSuccess:R}):T(E,{onSuccess:R})};return e.jsx(N.Dialog,{open:h,onOpenChange:a,children:h&&e.jsxs(N.DialogContent,{className:"text-slate-600 sm:max-w-[425px]",children:[e.jsxs(N.DialogHeader,{children:[e.jsx(N.DialogTitle,{children:B(t?"Edit language":"Add new language page")}),e.jsx(N.DialogDescription,{className:"font-light",children:B("Enter the details for the language")})]}),e.jsx(hs,{id:c,pages:o,loading:ts,onSubmit:as,edit:t,lang:d,languages:G,name:l,setLang:S,setName:x,primaryPageObject:s,parentHasSelectedLanguagePage:os,isNonSlugPageType:K,isRootPage:D,useLanguagePrefix:p,setUseLanguagePrefix:C,isHomePage:V,parentSlug:Q,slug:f,setSlug:r,isSlugValid:A,setIsSlugValid:m,getSlug:X,isPending:q})]})})};exports.default=xs;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as o, jsxs as r } from "react/jsx-runtime";
|
|
2
|
-
import { D as t,
|
|
2
|
+
import { D as t, e as c, f as p, g as m, p as h } from "./index-DsQXiNA_.js";
|
|
3
3
|
import { Suspense as f, lazy as D } from "react";
|
|
4
4
|
import { useTranslation as u } from "react-i18next";
|
|
5
|
-
const x = D(() => import("./page-creator-
|
|
5
|
+
const x = D(() => import("./page-creator-BuHHnqiQ.js")), C = ({
|
|
6
6
|
addEditPage: e,
|
|
7
7
|
setAddEditPage: s,
|
|
8
8
|
closePanel: l
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-mPCp0j2h.cjs"),c=require("react"),a=require("react-i18next"),u=c.lazy(()=>Promise.resolve().then(()=>require("./page-creator-wtbae2U7.cjs"))),x=({addEditPage:n,setAddEditPage:r,closePanel:l})=>{const{t:o}=a.useTranslation(),t=!!(n!=null&&n.id),i=!!n;return e.jsx(s.Dialog,{open:i,onOpenChange:()=>r(void 0),children:i&&e.jsxs(s.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(s.DialogHeader,{children:[e.jsxs(s.DialogTitle,{children:[o(t?"Edit":"Add New")," "]}),e.jsx(s.DialogDescription,{children:o(t?"Update your page name":"Enter details to create a new page")})]}),e.jsx(c.Suspense,{fallback:e.jsx("div",{className:"min-h-40"}),children:e.jsx(u,{closePanel:l,addEditPage:n,close:()=>r(void 0)})})]})})};exports.default=x;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),L=require("./register-chai-top-bar-DyW9GPzV.cjs"),N=require("./index-mPCp0j2h.cjs"),j=require("./index-CAhDwfHE.cjs"),M=require("lucide-react"),s=require("react"),k=require("react-i18next"),A=require("sonner"),B=require("./models-5gOsRC56.cjs"),R=s.lazy(()=>Promise.resolve().then(()=>require("./ai-panel-default-lang-C6N4wUUF.cjs"))),z=s.lazy(()=>Promise.resolve().then(()=>require("./ai-panel-other-lang-C65lVVtZ.cjs"))),F=()=>{const{t:o}=k.useTranslation(),[m,a]=s.useState(""),[t,l]=s.useState([]),[c,i]=s.useState(!1),[u,d]=s.useState(null),[S,f]=s.useState(null),[p,b]=s.useState(B.getDefaultModel().id),{selectedLang:h,fallbackLang:q}=N.useLanguages(),P=j.useBuilderFetch(),[v]=j.useSearchParams(),w=v.get("page"),C=(t==null?void 0:t.filter(n=>n.role==="user").length)>=4,y=(t==null?void 0:t.filter(n=>n.role==="user").length)>=10;s.useEffect(()=>{l([])},[h,w]);const g=()=>{l([]),a(""),f(null),d(null),i(!1)},x={t:o,fetch:P,input:m,messages:t,setInput:a,isLoading:c,handleStop:()=>{u&&(u.abort(),d(null)),i(!1),a(""),f(null),l(n=>{const r=n[n.length-1];return r&&r.role==="assistant"&&r.isReasoning&&r.isStreaming?n.slice(0,-1):n}),A.toast.info(o("Generation stopped"))},handleReset:g,setMessages:l,setIsLoading:i,currentBlock:S,fallbackLang:q,abortController:u,setCurrentBlock:f,setAbortController:d,forceNewConversation:y,suggestNewConversation:C,selectedModel:p,onModelChange:b};return e.jsxs(e.Fragment,{children:[c&&e.jsx("div",{className:"fixed inset-0 left-0 top-0 z-40 flex h-screen w-screen flex-col items-center justify-center bg-transparent"}),e.jsxs("div",{className:"flex h-full w-full flex-col",children:[e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsx("p",{className:"text-xs text-gray-500",children:o("Your conversation will not be saved")}),(t==null?void 0:t.length)>0&&e.jsx(L.Button,{variant:"outline",size:"icon",onClick:g,className:"h-6 w-6",disabled:c,children:e.jsx(M.Plus,{})})]}),e.jsx(s.Suspense,{fallback:e.jsx("div",{className:"flex h-full w-full items-center justify-center text-xs",children:"Loading AI Panel"}),children:h?e.jsx(z,{...x,selectedLang:h}):e.jsx(R,{...x})})]})]})};exports.default=F;
|