@templatical/editor 0.48.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/AiAltTextPopover-BZQ95GXL.js +106 -0
- package/dist/AiAltTextReview-DoBEudnE.js +206 -0
- package/dist/AiChatPanel-Bs6sES3b.js +550 -0
- package/dist/AiHeaderMenu-BEaTazx4.js +36 -0
- package/dist/AiPanels-CfN7A-ZA.js +33 -0
- package/dist/AiRewriteMenu-C3ZfDDYy.js +276 -0
- package/dist/{BlockIssueBadge-BShkuJis.js → BlockIssueBadge-CKwZ1Vgn.js} +11 -11
- package/dist/{BlockPreviewCanvas-tzAtDkXH.js → BlockPreviewCanvas-BXNLLLYi.js} +33 -33
- package/dist/CloudHeaderExtras-CsJMEiyN.js +23 -0
- package/dist/CloudPanels-B4F5m7vy.js +168 -0
- package/dist/CollaborationNotices-CNuDp7Y2.js +76 -0
- package/dist/CollaboratorBar-BtHPiuHq.js +123 -0
- package/dist/{CommentsPanel-DiWzYtnZ.js → CommentsPanel-CyCM-BvT.js} +4 -4
- package/dist/CommentsSidebar-Ca3DyFOX.js +500 -0
- package/dist/{cdn/chunks/CountdownBlock-Dasj191h.js → CountdownBlock-DR4Xm2-T.js} +24 -26
- package/dist/{CountdownToolbar-C4y3Ft7H.js → CountdownToolbar-CEIMPojJ.js} +56 -56
- package/dist/IssuesPanel-C8nMUccy.js +360 -0
- package/dist/{LoadingTrack-6XsqodoY.js → LoadingTrack-B0RKQWq3.js} +2 -2
- package/dist/{LogicTagInsertButton-B1_Wy0AN.js → LogicTagInsertButton-CqfU52CO.js} +272 -267
- package/dist/{cdn/chunks/MediaEditModal-zXfcArr4.js → MediaEditModal-DHtkZ4OU.js} +202 -186
- package/dist/{MediaPanels-9mDBv4aL.js → MediaPanels-CGcOB2pR.js} +4 -4
- package/dist/{MergeTagInput-fOewuF27.js → MergeTagInput-YnEkorTZ.js} +26 -26
- package/dist/{MergeTagModeToggle-BXamLcv7.js → MergeTagModeToggle-Dhb1DAcQ.js} +40 -40
- package/dist/MergeTagTextarea-e4lnwtqZ.js +70 -0
- package/dist/ParagraphEditor-B6NK0ytw.js +799 -0
- package/dist/{RestoreVersionDialog-BEKXx9xk.js → RestoreVersionDialog-Bq_IGOLJ.js} +22 -22
- package/dist/{RichTextEditorContent-D7kp7iig.js → RichTextEditorContent-AOM6fylS.js} +48 -48
- package/dist/{SaveBlockDialog-SJu0lecx.js → SaveBlockDialog-C8GngfQx.js} +88 -88
- package/dist/{cdn/chunks/SavedBlocksBrowserModal-CtnB58p_.js → SavedBlocksBrowserModal-wnkvxpm_.js} +102 -99
- package/dist/{SavedBlocksPanels-Dr5Fxx9Z.js → SavedBlocksPanels-C2s3q0pJ.js} +9 -9
- package/dist/{SavedBlocksPickBar-DnEWBZJy.js → SavedBlocksPickBar-BjcTiV87.js} +14 -14
- package/dist/TemplateSettings-BVBWpiDU.js +237 -0
- package/dist/{TestEmailModal-CbRY8HQx.js → TestEmailModal-SyhO9bn3.js} +57 -57
- package/dist/{TestEmailPanel-NAOmt3xi.js → TestEmailPanel-BDd2Rtav.js} +4 -4
- package/dist/{TitleEditor-Cc3DHbuN.js → TitleEditor-pxD53y_l.js} +75 -75
- package/dist/ToggleSwitch-D51U9cmR.js +37 -0
- package/dist/Toolbar-CZSPZYbj.js +3153 -0
- package/dist/{TplModal-Bz4-IZ9R.js → TplModal-DCzBzicE.js} +19 -19
- package/dist/{VersionHistoryMenu-CjV1d1zk.js → VersionHistoryMenu-BQeWPT85.js} +35 -35
- package/dist/{VersionHistoryPanels-BtwxrKJn.js → VersionHistoryPanels-BBm7YbRQ.js} +5 -5
- package/dist/{VersionPreviewBanner-BLAei1kj.js → VersionPreviewBanner-DUGF0tUJ.js} +10 -10
- package/dist/WrapperBlock-BO619LAb.js +45 -0
- package/dist/aiErrors-D5UOoYOt.js +41 -0
- package/dist/aiImageContext-BH4Ss1h3.js +48 -0
- package/dist/aiRewritePreview-DLGM05Ge.js +44 -0
- package/dist/{blockTypeIcons-CEDZytqP.js → blockTypeIcons-NzaYvAI4.js} +15 -14
- package/dist/bundle-stats.json +8 -8
- package/dist/{cdn/chunks/ca-CbNzJM3I.js → ca-C7mTzW1r.js} +147 -8
- package/dist/cdn/chunks/AiAltTextPopover-CQu0Q_ZX.js +107 -0
- package/dist/cdn/chunks/AiAltTextPopover-CQu0Q_ZX.js.map +1 -0
- package/dist/cdn/chunks/AiAltTextReview-CI2HbWfn.js +207 -0
- package/dist/cdn/chunks/AiAltTextReview-CI2HbWfn.js.map +1 -0
- package/dist/cdn/chunks/AiChatPanel-BYqn1bKu.js +476 -0
- package/dist/cdn/chunks/AiChatPanel-BYqn1bKu.js.map +1 -0
- package/dist/cdn/chunks/AiHeaderMenu-oldAAFyL.js +37 -0
- package/dist/cdn/chunks/AiHeaderMenu-oldAAFyL.js.map +1 -0
- package/dist/cdn/chunks/AiPanels-CIFKQv8Y.js +34 -0
- package/dist/cdn/chunks/AiPanels-CIFKQv8Y.js.map +1 -0
- package/dist/cdn/chunks/AiRewriteMenu-Bhh71zcc.js +208 -0
- package/dist/cdn/chunks/AiRewriteMenu-Bhh71zcc.js.map +1 -0
- package/dist/cdn/chunks/{BlockIssueBadge-C7sdnkrF.js → BlockIssueBadge-DAn2vsMJ.js} +13 -13
- package/dist/cdn/chunks/{BlockIssueBadge-C7sdnkrF.js.map → BlockIssueBadge-DAn2vsMJ.js.map} +1 -1
- package/dist/cdn/chunks/{BlockPreviewCanvas-vK5tBazr.js → BlockPreviewCanvas-D0--EQkP.js} +39 -39
- package/dist/cdn/chunks/{BlockPreviewCanvas-vK5tBazr.js.map → BlockPreviewCanvas-D0--EQkP.js.map} +1 -1
- package/dist/cdn/chunks/CloudHeaderExtras-DaUU8P8R.js +25 -0
- package/dist/cdn/chunks/CloudHeaderExtras-DaUU8P8R.js.map +1 -0
- package/dist/cdn/chunks/{CloudPanels-awqHfJqC.js → CloudPanels-C3jsxo_f.js} +52 -100
- package/dist/cdn/chunks/CloudPanels-C3jsxo_f.js.map +1 -0
- package/dist/cdn/chunks/CollaborationNotices-DjRI8gvs.js +78 -0
- package/dist/cdn/chunks/CollaborationNotices-DjRI8gvs.js.map +1 -0
- package/dist/cdn/chunks/CollaboratorBar-Dfzm6A9A.js +72 -0
- package/dist/cdn/chunks/CollaboratorBar-Dfzm6A9A.js.map +1 -0
- package/dist/cdn/chunks/CommentsPanel-CSO79OeX.js +20 -0
- package/dist/cdn/chunks/{CommentsPanel-CbzxwsyI.js.map → CommentsPanel-CSO79OeX.js.map} +1 -1
- package/dist/cdn/chunks/CommentsSidebar-CCvplq1Z.js +470 -0
- package/dist/cdn/chunks/{CommentsSidebar-DWPHZuQm.js.map → CommentsSidebar-CCvplq1Z.js.map} +1 -1
- package/dist/{CountdownBlock-zx39Dyby.js → cdn/chunks/CountdownBlock-C6USdwk3.js} +19 -17
- package/dist/cdn/chunks/{CountdownBlock-Dasj191h.js.map → CountdownBlock-C6USdwk3.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownToolbar-Cqg8FUH-.js → CountdownToolbar-Cjud2Tos.js} +71 -71
- package/dist/cdn/chunks/{CountdownToolbar-Cqg8FUH-.js.map → CountdownToolbar-Cjud2Tos.js.map} +1 -1
- package/dist/cdn/chunks/IssuesPanel-BaWHPDxZ.js +340 -0
- package/dist/cdn/chunks/IssuesPanel-BaWHPDxZ.js.map +1 -0
- package/dist/cdn/chunks/{LoadingTrack-DbH97JR9.js → LoadingTrack-BIcL4NiY.js} +2 -2
- package/dist/cdn/chunks/{LoadingTrack-DbH97JR9.js.map → LoadingTrack-BIcL4NiY.js.map} +1 -1
- package/dist/cdn/chunks/{LogicTagInsertButton-BMB9vShs.js → LogicTagInsertButton-CsL2JDOG.js} +374 -369
- package/dist/cdn/chunks/LogicTagInsertButton-CsL2JDOG.js.map +1 -0
- package/dist/{MediaEditModal-ByOvznRC.js → cdn/chunks/MediaEditModal-BuHCiyMu.js} +544 -560
- package/dist/cdn/chunks/MediaEditModal-BuHCiyMu.js.map +1 -0
- package/dist/cdn/chunks/MediaPanels-DAgUf_T1.js +45 -0
- package/dist/cdn/chunks/{MediaPanels-Cp4XB_dH.js.map → MediaPanels-DAgUf_T1.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagInput-DLqrA9co.js → MergeTagInput-C8U-7LxL.js} +34 -34
- package/dist/cdn/chunks/{MergeTagInput-DLqrA9co.js.map → MergeTagInput-C8U-7LxL.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagModeToggle-BRiJzzn5.js → MergeTagModeToggle-Mm-p0A52.js} +41 -41
- package/dist/cdn/chunks/{MergeTagModeToggle-BRiJzzn5.js.map → MergeTagModeToggle-Mm-p0A52.js.map} +1 -1
- package/dist/cdn/chunks/MergeTagTextarea-DuLScsWM.js +72 -0
- package/dist/cdn/chunks/MergeTagTextarea-DuLScsWM.js.map +1 -0
- package/dist/cdn/chunks/ParagraphEditor-CqSj6Ayz.js +634 -0
- package/dist/cdn/chunks/ParagraphEditor-CqSj6Ayz.js.map +1 -0
- package/dist/cdn/chunks/{RestoreVersionDialog-BgR6RXSb.js → RestoreVersionDialog-CdA5osuA.js} +26 -26
- package/dist/cdn/chunks/{RestoreVersionDialog-BgR6RXSb.js.map → RestoreVersionDialog-CdA5osuA.js.map} +1 -1
- package/dist/cdn/chunks/{RichTextEditorContent-C4DMAn0g.js → RichTextEditorContent-Q1d2xqBT.js} +46 -46
- package/dist/cdn/chunks/{RichTextEditorContent-C4DMAn0g.js.map → RichTextEditorContent-Q1d2xqBT.js.map} +1 -1
- package/dist/cdn/chunks/{SaveBlockDialog-BaIsQd09.js → SaveBlockDialog-CijargAy.js} +78 -78
- package/dist/cdn/chunks/{SaveBlockDialog-BaIsQd09.js.map → SaveBlockDialog-CijargAy.js.map} +1 -1
- package/dist/cdn/chunks/SavedBlocksBrowserModal-DtOz_X5S.js +357 -0
- package/dist/cdn/chunks/{SavedBlocksBrowserModal-CtnB58p_.js.map → SavedBlocksBrowserModal-DtOz_X5S.js.map} +1 -1
- package/dist/cdn/chunks/SavedBlocksPanels-BowyED5h.js +38 -0
- package/dist/cdn/chunks/{SavedBlocksPanels-BhEOMzEQ.js.map → SavedBlocksPanels-BowyED5h.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksPickBar-CcdqTEIp.js → SavedBlocksPickBar-BPRaJBv3.js} +19 -19
- package/dist/cdn/chunks/{SavedBlocksPickBar-CcdqTEIp.js.map → SavedBlocksPickBar-BPRaJBv3.js.map} +1 -1
- package/dist/cdn/chunks/TemplateSettings-ByZeBO34.js +209 -0
- package/dist/cdn/chunks/{TemplateSettings-BkkWTDHD.js.map → TemplateSettings-ByZeBO34.js.map} +1 -1
- package/dist/cdn/chunks/{TestEmailModal-V5mwHsUV.js → TestEmailModal-BUVTj3Ic.js} +54 -54
- package/dist/cdn/chunks/{TestEmailModal-V5mwHsUV.js.map → TestEmailModal-BUVTj3Ic.js.map} +1 -1
- package/dist/cdn/chunks/TestEmailPanel-BxutYoWg.js +35 -0
- package/dist/cdn/chunks/{TestEmailPanel-DxrKuctP.js.map → TestEmailPanel-BxutYoWg.js.map} +1 -1
- package/dist/cdn/chunks/TitleEditor-Ccv6uoTz.js +199 -0
- package/dist/cdn/chunks/{TitleEditor-CsZiG3TT.js.map → TitleEditor-Ccv6uoTz.js.map} +1 -1
- package/dist/cdn/chunks/ToggleSwitch-Ctdmj621.js +39 -0
- package/dist/cdn/chunks/ToggleSwitch-Ctdmj621.js.map +1 -0
- package/dist/cdn/chunks/{Toolbar-C_x2TfFk.js → Toolbar-DoprRgTn.js} +1097 -1101
- package/dist/cdn/chunks/Toolbar-DoprRgTn.js.map +1 -0
- package/dist/cdn/chunks/{TplModal-DC_eodTV.js → TplModal-BXQzmsJX.js} +21 -21
- package/dist/cdn/chunks/{TplModal-DC_eodTV.js.map → TplModal-BXQzmsJX.js.map} +1 -1
- package/dist/cdn/chunks/{VersionHistoryMenu-DXnM5Df2.js → VersionHistoryMenu-BF2fNCvq.js} +41 -41
- package/dist/cdn/chunks/{VersionHistoryMenu-DXnM5Df2.js.map → VersionHistoryMenu-BF2fNCvq.js.map} +1 -1
- package/dist/cdn/chunks/VersionHistoryPanels-Dal0Uk69.js +48 -0
- package/dist/cdn/chunks/{VersionHistoryPanels-DXSqmaLS.js.map → VersionHistoryPanels-Dal0Uk69.js.map} +1 -1
- package/dist/cdn/chunks/{VersionPreviewBanner-DKyN6BhO.js → VersionPreviewBanner-BaGcn-b1.js} +13 -13
- package/dist/cdn/chunks/{VersionPreviewBanner-DKyN6BhO.js.map → VersionPreviewBanner-BaGcn-b1.js.map} +1 -1
- package/dist/cdn/chunks/WrapperBlock-DkQJtLz0.js +47 -0
- package/dist/cdn/chunks/{WrapperBlock-gG_Bleug.js.map → WrapperBlock-DkQJtLz0.js.map} +1 -1
- package/dist/cdn/chunks/aiErrors-D5UOoYOt.js +43 -0
- package/dist/cdn/chunks/aiErrors-D5UOoYOt.js.map +1 -0
- package/dist/cdn/chunks/aiImageContext-BH4Ss1h3.js +50 -0
- package/dist/cdn/chunks/aiImageContext-BH4Ss1h3.js.map +1 -0
- package/dist/cdn/chunks/aiRewritePreview-DLGM05Ge.js +46 -0
- package/dist/cdn/chunks/aiRewritePreview-DLGM05Ge.js.map +1 -0
- package/dist/cdn/chunks/blockTypeIcons-ikZAmd6U.js +22 -0
- package/dist/cdn/chunks/{blockTypeIcons-HrMJDfVg.js.map → blockTypeIcons-ikZAmd6U.js.map} +1 -1
- package/dist/{ca-CbNzJM3I.js → cdn/chunks/ca-C7mTzW1r.js} +149 -6
- package/dist/cdn/chunks/ca-C7mTzW1r.js.map +1 -0
- package/dist/cdn/chunks/createCloudRuntime-DpBWhrv3.js +1408 -0
- package/dist/cdn/chunks/createCloudRuntime-DpBWhrv3.js.map +1 -0
- package/dist/cdn/chunks/de-DBOTcDj2.js +22 -0
- package/dist/cdn/chunks/de-DBOTcDj2.js.map +1 -0
- package/dist/{de-DMquBpZM.js → cdn/chunks/de-DNuYQTmS.js} +149 -6
- package/dist/cdn/chunks/de-DNuYQTmS.js.map +1 -0
- package/dist/{dist-CUWI-IvA.js → cdn/chunks/dist-Bo8Thh8v.js} +60 -58
- package/dist/cdn/chunks/{dist-CjL6JHML.js.map → dist-Bo8Thh8v.js.map} +1 -1
- package/dist/cdn/chunks/dist-S-rLGqax.js +406 -0
- package/dist/cdn/chunks/{dist-MNQYSEWU.js.map → dist-S-rLGqax.js.map} +1 -1
- package/dist/cdn/chunks/{draggable-DrsNwZuB.js → draggable-DZ0gwUJ6.js} +1359 -1266
- package/dist/cdn/chunks/draggable-DZ0gwUJ6.js.map +1 -0
- package/dist/cdn/chunks/{editor-modal-vEEmZ8Tu.js → editor-modal-CI6EfeMd.js} +881 -881
- package/dist/cdn/chunks/{editor-modal-vEEmZ8Tu.js.map → editor-modal-CI6EfeMd.js.map} +1 -1
- package/dist/cdn/chunks/en-CDhWRrF_.js +22 -0
- package/dist/cdn/chunks/en-CDhWRrF_.js.map +1 -0
- package/dist/{en-C8Mp71sO.js → cdn/chunks/en-CW71OK66.js} +149 -6
- package/dist/cdn/chunks/en-CW71OK66.js.map +1 -0
- package/dist/cdn/chunks/en-ifvu6oPv.js +1 -0
- package/dist/{es-Byq4tthI.js → cdn/chunks/es-DdK7zQfi.js} +149 -6
- package/dist/cdn/chunks/es-DdK7zQfi.js.map +1 -0
- package/dist/cdn/chunks/{extensions-hJ9VqzDc.js → extensions-taJTZlLK.js} +71 -71
- package/dist/cdn/chunks/{extensions-hJ9VqzDc.js.map → extensions-taJTZlLK.js.map} +1 -1
- package/dist/{fr-B3j35HEw.js → cdn/chunks/fr-Dz5Bgb7-.js} +149 -6
- package/dist/cdn/chunks/fr-Dz5Bgb7-.js.map +1 -0
- package/dist/cdn/chunks/{icons-aTYwH5-g.js → icons-DNX6StSs.js} +183 -150
- package/dist/cdn/chunks/icons-DNX6StSs.js.map +1 -0
- package/dist/{ja-D7txAuGS.js → cdn/chunks/ja-Di-zJiT8.js} +149 -6
- package/dist/cdn/chunks/ja-Di-zJiT8.js.map +1 -0
- package/dist/cdn/chunks/keys-BTpmg2Tt.js +12 -0
- package/dist/cdn/chunks/keys-BTpmg2Tt.js.map +1 -0
- package/dist/{logger-BBlvSn6q.js → cdn/chunks/logger-Tj0RPskW.js} +7 -1
- package/dist/cdn/chunks/logger-Tj0RPskW.js.map +1 -0
- package/dist/{nl-ClJ3BY3F.js → cdn/chunks/nl-CvVuHYFL.js} +149 -6
- package/dist/cdn/chunks/nl-CvVuHYFL.js.map +1 -0
- package/dist/cdn/chunks/normalizeMergeTagMarkup-DyePIGqu.js +199 -0
- package/dist/cdn/chunks/normalizeMergeTagMarkup-DyePIGqu.js.map +1 -0
- package/dist/cdn/chunks/{preRenderCustomBlocks-ByfuSjtL.js → preRenderCustomBlocks-Dc-QLntG.js} +4 -4
- package/dist/cdn/chunks/{preRenderCustomBlocks-ByfuSjtL.js.map → preRenderCustomBlocks-Dc-QLntG.js.map} +1 -1
- package/dist/cdn/chunks/pt-BR-CHM-ZKvE.js +22 -0
- package/dist/cdn/chunks/pt-BR-CHM-ZKvE.js.map +1 -0
- package/dist/{pt-BR-DibcXcmv.js → cdn/chunks/pt-BR-ZhO4vgyq.js} +149 -6
- package/dist/cdn/chunks/pt-BR-ZhO4vgyq.js.map +1 -0
- package/dist/cdn/chunks/{pusher-C8DeiO2X.js → pusher-Cs4GGEtd.js} +2 -2
- package/dist/cdn/chunks/pusher-Cs4GGEtd.js.map +1 -0
- package/dist/cdn/chunks/{rolldown-runtime-B0aSnxlc.js → rolldown-runtime-Y_bBpyJl.js} +1 -1
- package/dist/cdn/chunks/sanitizeRichTextHtml-DeISfLFr.js +62 -0
- package/dist/cdn/chunks/sanitizeRichTextHtml-DeISfLFr.js.map +1 -0
- package/dist/cdn/chunks/socialIcons-BBvsTwCV.js +2032 -0
- package/dist/cdn/chunks/socialIcons-BBvsTwCV.js.map +1 -0
- package/dist/cdn/chunks/{src-DYCDeBDM.js → src-BNFnxfrA.js} +694 -329
- package/dist/cdn/chunks/src-BNFnxfrA.js.map +1 -0
- package/dist/cdn/chunks/{src-dZ4D_tuP.js → src-BcTUmgLe.js} +181 -181
- package/dist/cdn/chunks/src-BcTUmgLe.js.map +1 -0
- package/dist/cdn/chunks/src-Bs_yxk3h.js +4392 -0
- package/dist/cdn/chunks/src-Bs_yxk3h.js.map +1 -0
- package/dist/cdn/chunks/{styleConstants-D1Jz-TFU.js → styleConstants-v1dNKgJf.js} +2 -4
- package/dist/cdn/chunks/{styleConstants-D1Jz-TFU.js.map → styleConstants-v1dNKgJf.js.map} +1 -1
- package/dist/cdn/chunks/{tiptap-BPigZk5G.js → tiptap-CtVrAViq.js} +44 -44
- package/dist/cdn/chunks/tiptap-CtVrAViq.js.map +1 -0
- package/dist/cdn/chunks/{useCloudI18n-BBF4waXO.js → useCloudI18n-AVXhzbhQ.js} +4 -4
- package/dist/cdn/chunks/{useCloudI18n-BBF4waXO.js.map → useCloudI18n-AVXhzbhQ.js.map} +1 -1
- package/dist/cdn/chunks/useEditorCore-CCVFi1YZ.js +2586 -0
- package/dist/cdn/chunks/useEditorCore-CCVFi1YZ.js.map +1 -0
- package/dist/cdn/chunks/useEditorRoot-CR5GjJD6.js +10 -0
- package/dist/cdn/chunks/{useEditorRoot-CTc6O8al.js.map → useEditorRoot-CR5GjJD6.js.map} +1 -1
- package/dist/cdn/chunks/{useI18n-DUlyyIJJ.js → useI18n-CbVubQhM.js} +3 -3
- package/dist/cdn/chunks/{useI18n-DUlyyIJJ.js.map → useI18n-CbVubQhM.js.map} +1 -1
- package/dist/cdn/chunks/{useLogicTag-HsyUCQtl.js → useLogicTag-B49Nc53Y.js} +5 -5
- package/dist/cdn/chunks/{useLogicTag-HsyUCQtl.js.map → useLogicTag-B49Nc53Y.js.map} +1 -1
- package/dist/cdn/chunks/{useMergeTag-Dg9pE85U.js → useMergeTag-B0KryMj8.js} +7 -7
- package/dist/cdn/chunks/{useMergeTag-Dg9pE85U.js.map → useMergeTag-B0KryMj8.js.map} +1 -1
- package/dist/cdn/chunks/{usePopoverPosition-IbaW6-Ao.js → usePopoverPosition-C829ps5i.js} +4 -4
- package/dist/cdn/chunks/{usePopoverPosition-IbaW6-Ao.js.map → usePopoverPosition-C829ps5i.js.map} +1 -1
- package/dist/cdn/chunks/useScrollToBlock-CAwvulog.js +51 -0
- package/dist/cdn/chunks/useScrollToBlock-CAwvulog.js.map +1 -0
- package/dist/cdn/chunks/{withCurrentFont-oLcATrQ8.js → withCurrentFont-DFPXeVfG.js} +2 -2
- package/dist/cdn/chunks/{withCurrentFont-oLcATrQ8.js.map → withCurrentFont-DFPXeVfG.js.map} +1 -1
- package/dist/cdn/editor.css +1 -1
- package/dist/cdn/editor.js +2235 -1311
- package/dist/cdn/editor.js.map +1 -1
- package/dist/{check-ClwqRMgv.js → check-yYsp5Xpk.js} +1 -1
- package/dist/{chevron-down-te6qn-zE.js → chevron-down-DTmD06_j.js} +1 -1
- package/dist/{chevron-right-W2hbH1FM.js → chevron-right-BSeYZOxc.js} +1 -1
- package/dist/{chevron-up-Bf5Zo7o4.js → chevron-up-BOApwrxi.js} +1 -1
- package/dist/{circle-alert-CIEGV5DN.js → circle-alert-BMszY8im.js} +1 -1
- package/dist/{clock-Y4cx0gkJ.js → clock-HADxnl6-.js} +1 -1
- package/dist/createCloudRuntime-DVQI_ReU.js +1379 -0
- package/dist/{createLucideIcon-CYHXK9hn.js → createLucideIcon-0lYYH3EW.js} +6 -6
- package/dist/de-DBOTcDj2.js +20 -0
- package/dist/{cdn/chunks/de-DMquBpZM.js → de-DNuYQTmS.js} +147 -8
- package/dist/{cdn/chunks/dist-CjL6JHML.js → dist-C7EtxNCb.js} +49 -51
- package/dist/{dist-DuufrR8O.js → dist-C_dV9QAx.js} +130 -130
- package/dist/{cdn/chunks/dist-MNQYSEWU.js → dist-DI4_YSnG.js} +111 -110
- package/dist/{dist-tsmnQugO.js → dist-DtOF3bDW.js} +648 -294
- package/dist/{editor-modal-AlVLkU91.js → editor-modal-Bzhl-PgI.js} +832 -834
- package/dist/en-CDhWRrF_.js +20 -0
- package/dist/{cdn/chunks/en-C8Mp71sO.js → en-CW71OK66.js} +147 -8
- package/dist/en-DwV15ltA.js +1 -0
- package/dist/{cdn/chunks/es-Byq4tthI.js → es-DdK7zQfi.js} +147 -8
- package/dist/{extensions-pjO8VGkM.js → extensions-CdyweA50.js} +54 -54
- package/dist/{eye-Ddnz8nnm.js → eye-DWkSvYpj.js} +1 -1
- package/dist/{cdn/chunks/fr-B3j35HEw.js → fr-Dz5Bgb7-.js} +147 -8
- package/dist/image-DesWjcZ4.js +28 -0
- package/dist/index.d.ts +640 -48
- package/dist/{info-DXLmzoeY.js → info-ClWJGoZy.js} +1 -1
- package/dist/{cdn/chunks/ja-D7txAuGS.js → ja-Di-zJiT8.js} +147 -8
- package/dist/keys-Zd9KWRD1.js +10 -0
- package/dist/{link-Cel46wgo.js → link-BqRicFTA.js} +1 -1
- package/dist/{list-Cl0GwiV9.js → list-bojQr9bn.js} +1 -1
- package/dist/{loader-circle-uAwpvfys.js → loader-circle-B2B8LbUu.js} +1 -1
- package/dist/{cdn/chunks/logger-ByvdoAwq.js → logger-k9Nbj3Cp.js} +5 -3
- package/dist/{message-circle-DWU1pTM_.js → message-circle-BEuiNsyZ.js} +1 -1
- package/dist/{cdn/chunks/nl-ClJ3BY3F.js → nl-CvVuHYFL.js} +147 -8
- package/dist/normalizeMergeTagMarkup-P6SUBuPv.js +197 -0
- package/dist/{package-CbyG_yU_.js → package-DCROB4aM.js} +1 -1
- package/dist/{pencil-BzoDcwKu.js → pencil-CEotCKbf.js} +1 -1
- package/dist/{preRenderCustomBlocks-DMP5RuHl.js → preRenderCustomBlocks-D8rr61_z.js} +3 -3
- package/dist/pt-BR-CHM-ZKvE.js +20 -0
- package/dist/{cdn/chunks/pt-BR-DibcXcmv.js → pt-BR-ZhO4vgyq.js} +147 -8
- package/dist/{refresh-cw-9WinWixo.js → refresh-cw-C6M2mHNC.js} +12 -2
- package/dist/{runtime-dom.esm-bundler-lFF-QG3j.js → runtime-dom.esm-bundler-B8WCZWUm.js} +134 -134
- package/dist/sanitizeRichTextHtml-DeISfLFr.js +60 -0
- package/dist/{search-CqgGq1gG.js → search-Cy99zPYf.js} +1 -1
- package/dist/{send-Ceo3c9Db.js → send-BDLJFsf3.js} +1 -1
- package/dist/{smartphone-CcLaCpGK.js → smartphone-CVvQaNA4.js} +1 -1
- package/dist/socialIcons-Dd-jRiVe.js +2086 -0
- package/dist/{sparkles-Do9XjAuT.js → sparkles-Ce0Qz0ox.js} +1 -1
- package/dist/square-BWlolnXe.js +15 -0
- package/dist/style.css +1 -1
- package/dist/{styleConstants-D1Jz-TFU.js → styleConstants-v1dNKgJf.js} +1 -3
- package/dist/templatical-editor.js +2272 -1327
- package/dist/{text-align-start-DvzC0HQA.js → text-align-start-D1V5gPTy.js} +1 -1
- package/dist/{trash-vlINTx32.js → trash-CZfiUFmw.js} +1 -1
- package/dist/{triangle-alert-MRYSJ9T2.js → triangle-alert-CFDzyFC7.js} +1 -1
- package/dist/upload-BJfvdIrD.js +36 -0
- package/dist/{useCloudI18n-Nwqo7pI_.js → useCloudI18n-Dcjua65H.js} +5 -5
- package/dist/{useEditorCore-PvErWWsp.js → useEditorCore-BTLeAVlM.js} +1534 -1549
- package/dist/{useEditorRoot-BD3piYtD.js → useEditorRoot-DUy67lJu.js} +2 -2
- package/dist/{useI18n-CxVEpurs.js → useI18n-BdoY7xDE.js} +4 -4
- package/dist/{useLogicTag-BHn67tDd.js → useLogicTag-DKLZ1T9H.js} +3 -3
- package/dist/{useMergeTag-CRkm5Ig6.js → useMergeTag-Bhdx7AKk.js} +5 -5
- package/dist/{usePopoverPosition-CwnH1o5g.js → usePopoverPosition-BZea45XK.js} +2 -2
- package/dist/useScrollToBlock-FmNMALM_.js +74 -0
- package/dist/{vue.runtime.esm-bundler-CAzmrXdD.js → vue.runtime.esm-bundler-DgFJ6GPG.js} +1182 -1087
- package/dist/{withCurrentFont-CxRGeHO3.js → withCurrentFont-BATJHNve.js} +1 -1
- package/dist/{x-Cd6SFw8r.js → x-CZ0Js0hA.js} +1 -1
- package/package.json +17 -15
- package/dist/AiChatSidebar-DxPHFNoT.js +0 -230
- package/dist/AiFeatureMenu-C8GVqu1d.js +0 -57
- package/dist/CloudHeaderExtras-CUSftQdm.js +0 -59
- package/dist/CloudPanels-Dgw7tb4R.js +0 -216
- package/dist/CollaboratorBar-5rfopCPx.js +0 -103
- package/dist/CommentsSidebar-BOqj16Al.js +0 -500
- package/dist/DesignReferenceSidebar-BWAi3eQQ.js +0 -279
- package/dist/IssuesPanel-C-x3I012.js +0 -117
- package/dist/ParagraphEditor-BVjOwwHx.js +0 -797
- package/dist/SavedBlocksBrowserModal-DbmIS5uK.js +0 -360
- package/dist/TemplateScoringPanel-ynbGl-sr.js +0 -273
- package/dist/TemplateSettings-Bi01S3H3.js +0 -246
- package/dist/ToggleSwitch-Ozc7YU38.js +0 -102
- package/dist/Toolbar-B-2lO0I8.js +0 -3156
- package/dist/WrapperBlock-D0qgNqjD.js +0 -45
- package/dist/cdn/chunks/AiChatSidebar-Dk0rJBQN.js +0 -205
- package/dist/cdn/chunks/AiChatSidebar-Dk0rJBQN.js.map +0 -1
- package/dist/cdn/chunks/AiFeatureMenu-B7b0w8ZS.js +0 -57
- package/dist/cdn/chunks/AiFeatureMenu-B7b0w8ZS.js.map +0 -1
- package/dist/cdn/chunks/CloudHeaderExtras-B4fhuwc_.js +0 -60
- package/dist/cdn/chunks/CloudHeaderExtras-B4fhuwc_.js.map +0 -1
- package/dist/cdn/chunks/CloudPanels-awqHfJqC.js.map +0 -1
- package/dist/cdn/chunks/CollaboratorBar-CS0ivqkr.js +0 -52
- package/dist/cdn/chunks/CollaboratorBar-CS0ivqkr.js.map +0 -1
- package/dist/cdn/chunks/CommentsPanel-CbzxwsyI.js +0 -20
- package/dist/cdn/chunks/CommentsSidebar-DWPHZuQm.js +0 -470
- package/dist/cdn/chunks/DesignReferenceSidebar-BW9cHnA9.js +0 -229
- package/dist/cdn/chunks/DesignReferenceSidebar-BW9cHnA9.js.map +0 -1
- package/dist/cdn/chunks/IssuesPanel-cXf9ywA4.js +0 -100
- package/dist/cdn/chunks/IssuesPanel-cXf9ywA4.js.map +0 -1
- package/dist/cdn/chunks/LogicTagInsertButton-BMB9vShs.js.map +0 -1
- package/dist/cdn/chunks/MediaEditModal-zXfcArr4.js.map +0 -1
- package/dist/cdn/chunks/MediaPanels-Cp4XB_dH.js +0 -45
- package/dist/cdn/chunks/ParagraphEditor-D4aq9eeC.js +0 -632
- package/dist/cdn/chunks/ParagraphEditor-D4aq9eeC.js.map +0 -1
- package/dist/cdn/chunks/SavedBlocksPanels-BhEOMzEQ.js +0 -38
- package/dist/cdn/chunks/TemplateScoringPanel-BrWqJCSP.js +0 -237
- package/dist/cdn/chunks/TemplateScoringPanel-BrWqJCSP.js.map +0 -1
- package/dist/cdn/chunks/TemplateSettings-BkkWTDHD.js +0 -208
- package/dist/cdn/chunks/TestEmailPanel-DxrKuctP.js +0 -35
- package/dist/cdn/chunks/TitleEditor-CsZiG3TT.js +0 -199
- package/dist/cdn/chunks/ToggleSwitch-BB-bQADJ.js +0 -104
- package/dist/cdn/chunks/ToggleSwitch-BB-bQADJ.js.map +0 -1
- package/dist/cdn/chunks/Toolbar-C_x2TfFk.js.map +0 -1
- package/dist/cdn/chunks/VersionHistoryPanels-DXSqmaLS.js +0 -48
- package/dist/cdn/chunks/WrapperBlock-gG_Bleug.js +0 -47
- package/dist/cdn/chunks/blockTypeIcons-HrMJDfVg.js +0 -22
- package/dist/cdn/chunks/ca-CbNzJM3I.js.map +0 -1
- package/dist/cdn/chunks/cloud-BHClP3e2.js +0 -1736
- package/dist/cdn/chunks/cloud-BHClP3e2.js.map +0 -1
- package/dist/cdn/chunks/createCloudRuntime-Vd0N4elZ.js +0 -400
- package/dist/cdn/chunks/createCloudRuntime-Vd0N4elZ.js.map +0 -1
- package/dist/cdn/chunks/de-DMquBpZM.js.map +0 -1
- package/dist/cdn/chunks/de-mMY5yQJu.js +0 -93
- package/dist/cdn/chunks/de-mMY5yQJu.js.map +0 -1
- package/dist/cdn/chunks/draggable-DrsNwZuB.js.map +0 -1
- package/dist/cdn/chunks/en-C8Mp71sO.js.map +0 -1
- package/dist/cdn/chunks/en-ChVeGQBY.js +0 -93
- package/dist/cdn/chunks/en-ChVeGQBY.js.map +0 -1
- package/dist/cdn/chunks/en-eWpiXyZu.js +0 -1
- package/dist/cdn/chunks/es-Byq4tthI.js.map +0 -1
- package/dist/cdn/chunks/fr-B3j35HEw.js.map +0 -1
- package/dist/cdn/chunks/icons-aTYwH5-g.js.map +0 -1
- package/dist/cdn/chunks/ja-D7txAuGS.js.map +0 -1
- package/dist/cdn/chunks/keys-HI-INbkz.js +0 -12
- package/dist/cdn/chunks/keys-HI-INbkz.js.map +0 -1
- package/dist/cdn/chunks/logger-ByvdoAwq.js.map +0 -1
- package/dist/cdn/chunks/nl-ClJ3BY3F.js.map +0 -1
- package/dist/cdn/chunks/pt-BR-CoCwRUi0.js +0 -93
- package/dist/cdn/chunks/pt-BR-CoCwRUi0.js.map +0 -1
- package/dist/cdn/chunks/pt-BR-DibcXcmv.js.map +0 -1
- package/dist/cdn/chunks/pusher-C8DeiO2X.js.map +0 -1
- package/dist/cdn/chunks/socialIcons-C_lnkpG6.js +0 -1279
- package/dist/cdn/chunks/socialIcons-C_lnkpG6.js.map +0 -1
- package/dist/cdn/chunks/src-DYCDeBDM.js.map +0 -1
- package/dist/cdn/chunks/src-DlFlC9Tt.js +0 -1272
- package/dist/cdn/chunks/src-DlFlC9Tt.js.map +0 -1
- package/dist/cdn/chunks/src-dZ4D_tuP.js.map +0 -1
- package/dist/cdn/chunks/timeouts-Cv2jvusx.js +0 -6
- package/dist/cdn/chunks/timeouts-Cv2jvusx.js.map +0 -1
- package/dist/cdn/chunks/tiptap-BPigZk5G.js.map +0 -1
- package/dist/cdn/chunks/useAliveFlag-DCB96vzR.js +0 -12
- package/dist/cdn/chunks/useAliveFlag-DCB96vzR.js.map +0 -1
- package/dist/cdn/chunks/useEditorCore-Bb2UcB20.js +0 -2602
- package/dist/cdn/chunks/useEditorCore-Bb2UcB20.js.map +0 -1
- package/dist/cdn/chunks/useEditorRoot-CTc6O8al.js +0 -10
- package/dist/cdn/chunks/useScrollToBlock-uUa601I4.js +0 -21
- package/dist/cdn/chunks/useScrollToBlock-uUa601I4.js.map +0 -1
- package/dist/cloud-B5xwm_4X.js +0 -1689
- package/dist/copy-BEcsAlfB.js +0 -19
- package/dist/createCloudRuntime-zNPkF6T9.js +0 -398
- package/dist/de-mMY5yQJu.js +0 -91
- package/dist/dist-DAAJogrx.js +0 -407
- package/dist/en-B0FUfNwz.js +0 -1
- package/dist/en-ChVeGQBY.js +0 -91
- package/dist/image-up-CM_HC0Dx.js +0 -27
- package/dist/keys-BKFq19a2.js +0 -10
- package/dist/plus-8cDvoCjZ.js +0 -14
- package/dist/pt-BR-CoCwRUi0.js +0 -91
- package/dist/shield-check-uDAwur5D.js +0 -14
- package/dist/socialIcons-PTiwhLoC.js +0 -1359
- package/dist/timeouts-Cv2jvusx.js +0 -4
- package/dist/upload-CtNOI6J2.js +0 -21
- package/dist/useAliveFlag-Dd06mRxe.js +0 -10
- package/dist/useScrollToBlock-CXmcHQQN.js +0 -47
|
@@ -0,0 +1,1379 @@
|
|
|
1
|
+
import { M as e, Q as t, c as n, z as r } from "./vue.runtime.esm-bundler-DgFJ6GPG.js";
|
|
2
|
+
import { p as i } from "./dist-DtOF3bDW.js";
|
|
3
|
+
import { i as a, u as o } from "./keys-Zd9KWRD1.js";
|
|
4
|
+
import { t as s } from "./logger-k9Nbj3Cp.js";
|
|
5
|
+
import { t as c } from "./preRenderCustomBlocks-D8rr61_z.js";
|
|
6
|
+
//#region ../core/dist/cloud/index.js
|
|
7
|
+
function l(e) {
|
|
8
|
+
let t = e instanceof i ? e.statusCode : void 0;
|
|
9
|
+
return t !== void 0 && t >= 400 && t < 500;
|
|
10
|
+
}
|
|
11
|
+
var u = class e {
|
|
12
|
+
static DEFAULT_BASE_URL = "https://templatical.com";
|
|
13
|
+
accessToken = null;
|
|
14
|
+
expiresAt = null;
|
|
15
|
+
_projectId = null;
|
|
16
|
+
_tenantId = null;
|
|
17
|
+
_tenantSlug = null;
|
|
18
|
+
_testEmailConfig = null;
|
|
19
|
+
_userConfig = null;
|
|
20
|
+
url;
|
|
21
|
+
baseUrl;
|
|
22
|
+
requestOptions;
|
|
23
|
+
onError;
|
|
24
|
+
refreshPromise = null;
|
|
25
|
+
static REFRESH_THRESHOLD_MS = 6e4;
|
|
26
|
+
constructor(t) {
|
|
27
|
+
this.url = t.url, this.baseUrl = (t.baseUrl ?? e.DEFAULT_BASE_URL).replace(/\/$/, ""), this.requestOptions = t.requestOptions ?? {}, this.onError = t.onError;
|
|
28
|
+
}
|
|
29
|
+
resolveUrl(e) {
|
|
30
|
+
if (e.startsWith("http://") || e.startsWith("https://")) return e;
|
|
31
|
+
let t = e.startsWith("/") ? e : `/${e}`;
|
|
32
|
+
return `${this.baseUrl}${t}`;
|
|
33
|
+
}
|
|
34
|
+
get projectId() {
|
|
35
|
+
if (!this._projectId) throw Error("Project ID not available. Call initialize() first.");
|
|
36
|
+
return this._projectId;
|
|
37
|
+
}
|
|
38
|
+
get tenantId() {
|
|
39
|
+
if (!this._tenantId) throw Error("Tenant ID not available. Call initialize() first.");
|
|
40
|
+
return this._tenantId;
|
|
41
|
+
}
|
|
42
|
+
get tenantSlug() {
|
|
43
|
+
if (!this._tenantSlug) throw Error("Tenant slug not available. Call initialize() first.");
|
|
44
|
+
return this._tenantSlug;
|
|
45
|
+
}
|
|
46
|
+
get testEmailConfig() {
|
|
47
|
+
return this._testEmailConfig;
|
|
48
|
+
}
|
|
49
|
+
get userConfig() {
|
|
50
|
+
return this._userConfig;
|
|
51
|
+
}
|
|
52
|
+
get accessTokenValue() {
|
|
53
|
+
return this.accessToken;
|
|
54
|
+
}
|
|
55
|
+
async initialize() {
|
|
56
|
+
await this.ensureToken();
|
|
57
|
+
}
|
|
58
|
+
async ensureToken() {
|
|
59
|
+
return this.accessToken && !this.isTokenExpiringSoon() ? this.accessToken : this.refreshToken();
|
|
60
|
+
}
|
|
61
|
+
isTokenExpiringSoon() {
|
|
62
|
+
return !this.expiresAt || this.expiresAt.getTime() - Date.now() < e.REFRESH_THRESHOLD_MS;
|
|
63
|
+
}
|
|
64
|
+
async refreshToken() {
|
|
65
|
+
if (this.refreshPromise) return this.refreshPromise;
|
|
66
|
+
this.refreshPromise = this.performRefresh();
|
|
67
|
+
try {
|
|
68
|
+
return await this.refreshPromise;
|
|
69
|
+
} finally {
|
|
70
|
+
this.refreshPromise = null;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async performRefresh() {
|
|
74
|
+
try {
|
|
75
|
+
let e = this.requestOptions.method ?? "POST", t = {
|
|
76
|
+
Accept: "application/json",
|
|
77
|
+
...this.requestOptions.headers
|
|
78
|
+
}, n = {
|
|
79
|
+
method: e,
|
|
80
|
+
headers: t,
|
|
81
|
+
credentials: this.requestOptions.credentials ?? "include"
|
|
82
|
+
};
|
|
83
|
+
e === "POST" && this.requestOptions.body && (t["Content-Type"] = "application/json", n.body = JSON.stringify(this.requestOptions.body));
|
|
84
|
+
let r = await fetch(this.url, n);
|
|
85
|
+
if (!r.ok) throw new i(`Token refresh failed: ${r.status}`, r.status);
|
|
86
|
+
let a = await r.json();
|
|
87
|
+
if (!a.token || !a.expiresAt || !a.projectId || !a.tenant) throw Error("Invalid token response: missing token, expiresAt, projectId, or tenant");
|
|
88
|
+
return this.accessToken = a.token, this.expiresAt = /* @__PURE__ */ new Date(a.expiresAt * 1e3), this._projectId = a.projectId, this._tenantSlug = a.tenant, this._testEmailConfig = a.testEmail?.allowedEmails && a.testEmail?.signature ? {
|
|
89
|
+
allowedEmails: a.testEmail.allowedEmails,
|
|
90
|
+
signature: a.testEmail.signature
|
|
91
|
+
} : null, this._userConfig = a.user?.id && a.user?.name && a.user?.signature ? {
|
|
92
|
+
id: a.user.id,
|
|
93
|
+
name: a.user.name,
|
|
94
|
+
signature: a.user.signature
|
|
95
|
+
} : null, this.accessToken;
|
|
96
|
+
} catch (e) {
|
|
97
|
+
let t = e instanceof Error ? e : Error("Token refresh failed", { cause: e });
|
|
98
|
+
throw this.onError?.(t), t;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async authenticatedFetch(e, t = {}) {
|
|
102
|
+
let n = await this.ensureToken(), r = this.resolveUrl(e), i = async (e) => fetch(r, {
|
|
103
|
+
...t,
|
|
104
|
+
headers: {
|
|
105
|
+
...t.headers,
|
|
106
|
+
Authorization: `Bearer ${e}`
|
|
107
|
+
}
|
|
108
|
+
}), a = await i(n);
|
|
109
|
+
return a.status === 401 && (a = await i(await this.refreshToken())), a;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
function d(e, t) {
|
|
113
|
+
return e.replace(/\{(\w+)\}/g, (e, n) => encodeURIComponent(t[n] ?? ""));
|
|
114
|
+
}
|
|
115
|
+
var f = "/api/v1/projects/{project}/tenants/{tenant}", p = `${f}/templates/{template}`, m = `${f}/media`, h = `${m}/folders`, g = `${f}/saved-modules`, _ = {
|
|
116
|
+
health: "/api/v1/health",
|
|
117
|
+
"projects.config": `${f}/config`,
|
|
118
|
+
"broadcasting.auth": `${f}/broadcasting/auth`,
|
|
119
|
+
"templates.store": `${f}/templates`,
|
|
120
|
+
"templates.show": `${p}`,
|
|
121
|
+
"templates.update": `${p}`,
|
|
122
|
+
"templates.destroy": `${p}`,
|
|
123
|
+
"templates.export": `${p}/export`,
|
|
124
|
+
"templates.importFromBeefree": `${f}/templates/import/from-beefree`,
|
|
125
|
+
"templates.sendTestEmail": `${p}/send-test-email`,
|
|
126
|
+
"versions.index": `${p}/versions`,
|
|
127
|
+
"versions.store": `${p}/versions`,
|
|
128
|
+
"versions.show": `${p}/versions/{version}`,
|
|
129
|
+
"versions.restore": `${p}/versions/{version}/restore`,
|
|
130
|
+
"comments.index": `${p}/comments`,
|
|
131
|
+
"comments.store": `${p}/comments`,
|
|
132
|
+
"comments.update": `${p}/comments/{comment}`,
|
|
133
|
+
"comments.destroy": `${p}/comments/{comment}`,
|
|
134
|
+
"comments.resolve": `${p}/comments/{comment}/resolve`,
|
|
135
|
+
"media.upload": `${m}/upload`,
|
|
136
|
+
"media.browse": `${m}/browse`,
|
|
137
|
+
"media.delete": `${m}/delete`,
|
|
138
|
+
"media.move": `${m}/move`,
|
|
139
|
+
"media.update": `${m}/{media}`,
|
|
140
|
+
"media.replace": `${m}/{media}/replace`,
|
|
141
|
+
"media.checkUsage": `${m}/check-usage`,
|
|
142
|
+
"media.frequentlyUsed": `${m}/frequently-used`,
|
|
143
|
+
"media.importFromUrl": `${m}/import-from-url`,
|
|
144
|
+
"folders.index": `${h}`,
|
|
145
|
+
"folders.store": `${h}`,
|
|
146
|
+
"folders.update": `${h}/{mediaFolder}`,
|
|
147
|
+
"folders.destroy": `${h}/{mediaFolder}`,
|
|
148
|
+
"savedModules.index": `${g}`,
|
|
149
|
+
"savedModules.store": `${g}`,
|
|
150
|
+
"savedModules.update": `${g}/{savedModule}`,
|
|
151
|
+
"savedModules.destroy": `${g}/{savedModule}`
|
|
152
|
+
}, v = class {
|
|
153
|
+
authManager;
|
|
154
|
+
constructor(e) {
|
|
155
|
+
this.authManager = e;
|
|
156
|
+
}
|
|
157
|
+
get projectId() {
|
|
158
|
+
return this.authManager.projectId;
|
|
159
|
+
}
|
|
160
|
+
get tenantSlug() {
|
|
161
|
+
return this.authManager.tenantSlug;
|
|
162
|
+
}
|
|
163
|
+
get baseParams() {
|
|
164
|
+
return {
|
|
165
|
+
project: this.projectId,
|
|
166
|
+
tenant: this.tenantSlug
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
async request(e, t = {}) {
|
|
170
|
+
let n = await this.authManager.authenticatedFetch(e, {
|
|
171
|
+
...t,
|
|
172
|
+
headers: {
|
|
173
|
+
"Content-Type": "application/json",
|
|
174
|
+
Accept: "application/json",
|
|
175
|
+
...t.headers
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
if (!n.ok) {
|
|
179
|
+
let e = await n.json().catch(() => ({ message: `HTTP error ${n.status}` })), t = this.extractFirstValidationError(e);
|
|
180
|
+
throw new i(t, n.status);
|
|
181
|
+
}
|
|
182
|
+
if (n.status !== 204) return (await n.json()).data;
|
|
183
|
+
}
|
|
184
|
+
extractFirstValidationError(e) {
|
|
185
|
+
if (e.errors) {
|
|
186
|
+
let t = Object.keys(e.errors)[0];
|
|
187
|
+
if (t && e.errors[t]?.length > 0) return e.errors[t][0];
|
|
188
|
+
}
|
|
189
|
+
return e.message;
|
|
190
|
+
}
|
|
191
|
+
async createTemplate(e, t) {
|
|
192
|
+
return this.request(d(_["templates.store"], this.baseParams), {
|
|
193
|
+
method: "POST",
|
|
194
|
+
body: JSON.stringify(t === void 0 ? { content: e } : {
|
|
195
|
+
content: e,
|
|
196
|
+
name: t
|
|
197
|
+
})
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
async getTemplate(e) {
|
|
201
|
+
return this.request(d(_["templates.show"], {
|
|
202
|
+
...this.baseParams,
|
|
203
|
+
template: e
|
|
204
|
+
}));
|
|
205
|
+
}
|
|
206
|
+
async updateTemplate(e, t) {
|
|
207
|
+
return this.request(d(_["templates.update"], {
|
|
208
|
+
...this.baseParams,
|
|
209
|
+
template: e
|
|
210
|
+
}), {
|
|
211
|
+
method: "PUT",
|
|
212
|
+
body: JSON.stringify(t)
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
async createVersion(e, t, n) {
|
|
216
|
+
return this.request(d(_["versions.store"], {
|
|
217
|
+
...this.baseParams,
|
|
218
|
+
template: e
|
|
219
|
+
}), {
|
|
220
|
+
method: "POST",
|
|
221
|
+
body: JSON.stringify(n === void 0 ? { content: t } : {
|
|
222
|
+
content: t,
|
|
223
|
+
label: n
|
|
224
|
+
})
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
async deleteTemplate(e) {
|
|
228
|
+
return this.request(d(_["templates.destroy"], {
|
|
229
|
+
...this.baseParams,
|
|
230
|
+
template: e
|
|
231
|
+
}), { method: "DELETE" });
|
|
232
|
+
}
|
|
233
|
+
async getVersions(e) {
|
|
234
|
+
return this.request(d(_["versions.index"], {
|
|
235
|
+
...this.baseParams,
|
|
236
|
+
template: e
|
|
237
|
+
}));
|
|
238
|
+
}
|
|
239
|
+
async getVersion(e, t) {
|
|
240
|
+
return this.request(d(_["versions.show"], {
|
|
241
|
+
...this.baseParams,
|
|
242
|
+
template: e,
|
|
243
|
+
version: t
|
|
244
|
+
}));
|
|
245
|
+
}
|
|
246
|
+
async restoreVersion(e, t) {
|
|
247
|
+
return this.request(d(_["versions.restore"], {
|
|
248
|
+
...this.baseParams,
|
|
249
|
+
template: e,
|
|
250
|
+
version: t
|
|
251
|
+
}), { method: "POST" });
|
|
252
|
+
}
|
|
253
|
+
async exportTemplate(e, t) {
|
|
254
|
+
let n = t ? JSON.stringify({
|
|
255
|
+
custom_fonts: t.customFonts,
|
|
256
|
+
default_fallback: t.defaultFallback
|
|
257
|
+
}) : void 0;
|
|
258
|
+
return this.request(d(_["templates.export"], {
|
|
259
|
+
...this.baseParams,
|
|
260
|
+
template: e
|
|
261
|
+
}), {
|
|
262
|
+
method: "POST",
|
|
263
|
+
body: n
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
async sendTestEmail(e, t) {
|
|
267
|
+
await this.request(d(_["templates.sendTestEmail"], {
|
|
268
|
+
...this.baseParams,
|
|
269
|
+
template: e
|
|
270
|
+
}), {
|
|
271
|
+
method: "POST",
|
|
272
|
+
body: JSON.stringify(t)
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
commentsUrl(e, t) {
|
|
276
|
+
return t ? d(_["comments.update"], {
|
|
277
|
+
...this.baseParams,
|
|
278
|
+
template: e,
|
|
279
|
+
comment: t
|
|
280
|
+
}) : d(_["comments.index"], {
|
|
281
|
+
...this.baseParams,
|
|
282
|
+
template: e
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
async getComments(e) {
|
|
286
|
+
return this.request(this.commentsUrl(e));
|
|
287
|
+
}
|
|
288
|
+
async createComment(e, t, n) {
|
|
289
|
+
return this.request(this.commentsUrl(e), {
|
|
290
|
+
method: "POST",
|
|
291
|
+
body: JSON.stringify(t),
|
|
292
|
+
headers: n
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
async updateComment(e, t, n, r) {
|
|
296
|
+
return this.request(this.commentsUrl(e, t), {
|
|
297
|
+
method: "PUT",
|
|
298
|
+
body: JSON.stringify(n),
|
|
299
|
+
headers: r
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
async deleteComment(e, t, n, r) {
|
|
303
|
+
return this.request(this.commentsUrl(e, t), {
|
|
304
|
+
method: "DELETE",
|
|
305
|
+
body: JSON.stringify(n),
|
|
306
|
+
headers: r
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
async resolveComment(e, t, n, r) {
|
|
310
|
+
return this.request(d(_["comments.resolve"], {
|
|
311
|
+
...this.baseParams,
|
|
312
|
+
template: e,
|
|
313
|
+
comment: t
|
|
314
|
+
}), {
|
|
315
|
+
method: "POST",
|
|
316
|
+
body: JSON.stringify(n),
|
|
317
|
+
headers: r
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
async fetchConfig() {
|
|
321
|
+
return this.request(d(_["projects.config"], this.baseParams));
|
|
322
|
+
}
|
|
323
|
+
async listModules(e, t) {
|
|
324
|
+
let n = d(_["savedModules.index"], this.baseParams), r = new URLSearchParams();
|
|
325
|
+
e && r.set("search", e), t && r.set("category", t);
|
|
326
|
+
let i = r.size > 0 ? `?${r}` : "";
|
|
327
|
+
return this.request(`${n}${i}`);
|
|
328
|
+
}
|
|
329
|
+
async createModule(e) {
|
|
330
|
+
return this.request(d(_["savedModules.store"], this.baseParams), {
|
|
331
|
+
method: "POST",
|
|
332
|
+
body: JSON.stringify(e)
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
async updateModule(e, t) {
|
|
336
|
+
return this.request(d(_["savedModules.update"], {
|
|
337
|
+
...this.baseParams,
|
|
338
|
+
savedModule: e
|
|
339
|
+
}), {
|
|
340
|
+
method: "PUT",
|
|
341
|
+
body: JSON.stringify(t)
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
async deleteModule(e) {
|
|
345
|
+
return this.request(d(_["savedModules.destroy"], {
|
|
346
|
+
...this.baseParams,
|
|
347
|
+
savedModule: e
|
|
348
|
+
}), { method: "DELETE" });
|
|
349
|
+
}
|
|
350
|
+
}, y = class {
|
|
351
|
+
authManager;
|
|
352
|
+
constructor(e) {
|
|
353
|
+
this.authManager = e;
|
|
354
|
+
}
|
|
355
|
+
get projectId() {
|
|
356
|
+
return this.authManager.projectId;
|
|
357
|
+
}
|
|
358
|
+
get tenantSlug() {
|
|
359
|
+
return this.authManager.tenantSlug;
|
|
360
|
+
}
|
|
361
|
+
get baseParams() {
|
|
362
|
+
return {
|
|
363
|
+
project: this.projectId,
|
|
364
|
+
tenant: this.tenantSlug
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
async request(e, t = {}) {
|
|
368
|
+
let n = await this.authManager.authenticatedFetch(e, {
|
|
369
|
+
...t,
|
|
370
|
+
headers: {
|
|
371
|
+
"Content-Type": "application/json",
|
|
372
|
+
Accept: "application/json",
|
|
373
|
+
...t.headers
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
if (!n.ok) {
|
|
377
|
+
let e = await n.json().catch(() => ({ message: `HTTP error ${n.status}` }));
|
|
378
|
+
throw Error(e.message, { cause: e });
|
|
379
|
+
}
|
|
380
|
+
if (n.status !== 204) return (await n.json()).data;
|
|
381
|
+
}
|
|
382
|
+
async browseMedia(e) {
|
|
383
|
+
let t = new URLSearchParams();
|
|
384
|
+
e.folderId && t.set("folderId", e.folderId), e.search && t.set("search", e.search), e.category && t.set("category", e.category), e.sort && t.set("sort", e.sort), e.cursor && t.set("cursor", e.cursor);
|
|
385
|
+
let n = t.toString(), r = `${d(_["media.browse"], this.baseParams)}${n ? `?${n}` : ""}`, i = await this.authManager.authenticatedFetch(r, { headers: { Accept: "application/json" } });
|
|
386
|
+
if (!i.ok) {
|
|
387
|
+
let e = await i.json().catch(() => ({ message: `HTTP error ${i.status}` }));
|
|
388
|
+
throw Error(e.message, { cause: e });
|
|
389
|
+
}
|
|
390
|
+
return i.json();
|
|
391
|
+
}
|
|
392
|
+
async uploadMedia(e, t) {
|
|
393
|
+
let n = new FormData();
|
|
394
|
+
n.append("file", e), t && n.append("folderId", t);
|
|
395
|
+
let r = d(_["media.upload"], this.baseParams), i = await this.authManager.authenticatedFetch(r, {
|
|
396
|
+
method: "POST",
|
|
397
|
+
headers: { Accept: "application/json" },
|
|
398
|
+
body: n
|
|
399
|
+
});
|
|
400
|
+
if (!i.ok) {
|
|
401
|
+
let e = await i.json().catch(() => ({ message: `HTTP error ${i.status}` }));
|
|
402
|
+
throw Error(e.message, { cause: e });
|
|
403
|
+
}
|
|
404
|
+
return (await i.json()).data;
|
|
405
|
+
}
|
|
406
|
+
async updateMedia(e, t, n) {
|
|
407
|
+
let r = {};
|
|
408
|
+
return t !== void 0 && (r.filename = t), n !== void 0 && (r.alt = n), this.request(d(_["media.update"], {
|
|
409
|
+
...this.baseParams,
|
|
410
|
+
media: e
|
|
411
|
+
}), {
|
|
412
|
+
method: "PUT",
|
|
413
|
+
body: JSON.stringify(r)
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
async deleteMedia(e) {
|
|
417
|
+
return this.request(d(_["media.delete"], this.baseParams), {
|
|
418
|
+
method: "POST",
|
|
419
|
+
body: JSON.stringify({ ids: e })
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
async moveMedia(e, t) {
|
|
423
|
+
return this.request(d(_["media.move"], this.baseParams), {
|
|
424
|
+
method: "POST",
|
|
425
|
+
body: JSON.stringify({
|
|
426
|
+
ids: e,
|
|
427
|
+
folderId: t
|
|
428
|
+
})
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
async getMediaFolders() {
|
|
432
|
+
return this.request(d(_["folders.index"], this.baseParams));
|
|
433
|
+
}
|
|
434
|
+
async createMediaFolder(e, t) {
|
|
435
|
+
return this.request(d(_["folders.store"], this.baseParams), {
|
|
436
|
+
method: "POST",
|
|
437
|
+
body: JSON.stringify({
|
|
438
|
+
name: e,
|
|
439
|
+
parentId: t ?? null
|
|
440
|
+
})
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
async renameMediaFolder(e, t) {
|
|
444
|
+
return this.request(d(_["folders.update"], {
|
|
445
|
+
...this.baseParams,
|
|
446
|
+
mediaFolder: e
|
|
447
|
+
}), {
|
|
448
|
+
method: "PUT",
|
|
449
|
+
body: JSON.stringify({ name: t })
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
async deleteMediaFolder(e) {
|
|
453
|
+
return this.request(d(_["folders.destroy"], {
|
|
454
|
+
...this.baseParams,
|
|
455
|
+
mediaFolder: e
|
|
456
|
+
}), { method: "DELETE" });
|
|
457
|
+
}
|
|
458
|
+
async checkMediaUsage(e) {
|
|
459
|
+
let t = await this.authManager.authenticatedFetch(d(_["media.checkUsage"], this.baseParams), {
|
|
460
|
+
method: "POST",
|
|
461
|
+
headers: {
|
|
462
|
+
"Content-Type": "application/json",
|
|
463
|
+
Accept: "application/json"
|
|
464
|
+
},
|
|
465
|
+
body: JSON.stringify({ ids: e })
|
|
466
|
+
});
|
|
467
|
+
if (!t.ok) {
|
|
468
|
+
let e = await t.json().catch(() => ({ message: `HTTP error ${t.status}` }));
|
|
469
|
+
throw Error(e.message, { cause: e });
|
|
470
|
+
}
|
|
471
|
+
return t.json();
|
|
472
|
+
}
|
|
473
|
+
async getFrequentlyUsed() {
|
|
474
|
+
return this.request(d(_["media.frequentlyUsed"], this.baseParams));
|
|
475
|
+
}
|
|
476
|
+
async importFromUrl(e, t) {
|
|
477
|
+
return this.request(d(_["media.importFromUrl"], this.baseParams), {
|
|
478
|
+
method: "POST",
|
|
479
|
+
body: JSON.stringify({
|
|
480
|
+
url: e,
|
|
481
|
+
folderId: t ?? null
|
|
482
|
+
})
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
async replaceMedia(e, t) {
|
|
486
|
+
let n = new FormData();
|
|
487
|
+
n.append("file", t);
|
|
488
|
+
let r = d(_["media.replace"], {
|
|
489
|
+
...this.baseParams,
|
|
490
|
+
media: e
|
|
491
|
+
}), i = await this.authManager.authenticatedFetch(r, {
|
|
492
|
+
method: "POST",
|
|
493
|
+
headers: { Accept: "application/json" },
|
|
494
|
+
body: n
|
|
495
|
+
});
|
|
496
|
+
if (!i.ok) {
|
|
497
|
+
let e = await i.json().catch(() => ({ message: `HTTP error ${i.status}` }));
|
|
498
|
+
throw Error(e.message, { cause: e });
|
|
499
|
+
}
|
|
500
|
+
return (await i.json()).data;
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
function b(e) {
|
|
504
|
+
return {
|
|
505
|
+
host: e.host,
|
|
506
|
+
port: e.port,
|
|
507
|
+
appKey: e.appKey
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
var x = class {
|
|
511
|
+
pusher = null;
|
|
512
|
+
authManager;
|
|
513
|
+
config;
|
|
514
|
+
onError;
|
|
515
|
+
constructor(e) {
|
|
516
|
+
this.authManager = e.authManager, this.config = e.config, this.onError = e.onError;
|
|
517
|
+
}
|
|
518
|
+
async connect() {
|
|
519
|
+
if (this.pusher) return;
|
|
520
|
+
let e;
|
|
521
|
+
try {
|
|
522
|
+
({default: e} = await import("pusher-js"));
|
|
523
|
+
} catch {
|
|
524
|
+
throw Error("[Templatical] Cloud features require the optional peer dependency 'pusher-js'. Please install it.");
|
|
525
|
+
}
|
|
526
|
+
let { host: t, port: n, appKey: r } = this.config, i = this.authManager.resolveUrl(d(_["broadcasting.auth"], {
|
|
527
|
+
project: this.authManager.projectId,
|
|
528
|
+
tenant: this.authManager.tenantSlug
|
|
529
|
+
}));
|
|
530
|
+
this.pusher = new e(r, {
|
|
531
|
+
wsHost: t,
|
|
532
|
+
wsPort: n,
|
|
533
|
+
wssPort: n,
|
|
534
|
+
forceTLS: !0,
|
|
535
|
+
disableStats: !0,
|
|
536
|
+
enabledTransports: ["ws", "wss"],
|
|
537
|
+
cluster: "",
|
|
538
|
+
channelAuthorization: {
|
|
539
|
+
transport: "ajax",
|
|
540
|
+
endpoint: i,
|
|
541
|
+
headers: {
|
|
542
|
+
Authorization: `Bearer ${this.authManager.accessTokenValue}`,
|
|
543
|
+
Accept: "application/json"
|
|
544
|
+
},
|
|
545
|
+
params: {
|
|
546
|
+
userId: this.authManager.userConfig?.id ?? "",
|
|
547
|
+
userName: this.authManager.userConfig?.name ?? "",
|
|
548
|
+
userSignature: this.authManager.userConfig?.signature ?? ""
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}), this.pusher.connection.bind("error", (e) => {
|
|
552
|
+
this.onError?.(e instanceof Error ? e : /* @__PURE__ */ Error("WebSocket connection error"));
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
subscribePresence(e) {
|
|
556
|
+
if (!this.pusher) throw Error("WebSocketClient not connected. Call connect() first.");
|
|
557
|
+
return this.pusher.subscribe(e);
|
|
558
|
+
}
|
|
559
|
+
unsubscribe(e) {
|
|
560
|
+
this.pusher?.unsubscribe(e);
|
|
561
|
+
}
|
|
562
|
+
getChannel(e) {
|
|
563
|
+
return this.pusher?.channel(e);
|
|
564
|
+
}
|
|
565
|
+
disconnect() {
|
|
566
|
+
this.pusher &&= (this.pusher.disconnect(), null);
|
|
567
|
+
}
|
|
568
|
+
getSocketId() {
|
|
569
|
+
return this.pusher?.connection.socket_id ?? null;
|
|
570
|
+
}
|
|
571
|
+
get isConnected() {
|
|
572
|
+
return this.pusher?.connection.state === "connected";
|
|
573
|
+
}
|
|
574
|
+
}, S = "comment-broadcast";
|
|
575
|
+
function C(e) {
|
|
576
|
+
let t = {
|
|
577
|
+
id: e.id,
|
|
578
|
+
body: e.body,
|
|
579
|
+
author: e.author,
|
|
580
|
+
createdAt: e.createdAt,
|
|
581
|
+
blockId: e.blockId,
|
|
582
|
+
parentId: e.parentId,
|
|
583
|
+
resolvedAt: e.resolvedAt
|
|
584
|
+
};
|
|
585
|
+
return e.updatedAt !== e.createdAt && (t.updatedAt = e.updatedAt), e.resolvedBy && (t.resolvedBy = e.resolvedBy), e.replies?.length && (t.replies = e.replies.map(C)), t;
|
|
586
|
+
}
|
|
587
|
+
function ee(e) {
|
|
588
|
+
let { authManager: t, channel: n, getSocketId: i } = e, a = new v(t);
|
|
589
|
+
function o() {
|
|
590
|
+
let e = t.userConfig;
|
|
591
|
+
if (!e) throw Error("[Templatical] Cloud comments need a signed user in the auth token. The project's token endpoint must include a `user` claim.");
|
|
592
|
+
return {
|
|
593
|
+
userId: e.id,
|
|
594
|
+
userName: e.name,
|
|
595
|
+
userSignature: e.signature
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
function s() {
|
|
599
|
+
let e = i?.();
|
|
600
|
+
return e ? { "X-Socket-ID": e } : void 0;
|
|
601
|
+
}
|
|
602
|
+
return {
|
|
603
|
+
async list(e) {
|
|
604
|
+
return (await a.getComments(e)).map(C);
|
|
605
|
+
},
|
|
606
|
+
async create(e, t) {
|
|
607
|
+
return C(await a.createComment(e, {
|
|
608
|
+
body: t.body,
|
|
609
|
+
blockId: t.blockId,
|
|
610
|
+
parentId: t.parentId,
|
|
611
|
+
...o()
|
|
612
|
+
}, s()));
|
|
613
|
+
},
|
|
614
|
+
async update(e, t, n) {
|
|
615
|
+
if (n.body === void 0) throw Error("[Templatical] Cloud comments: update() needs a `body` in the patch.");
|
|
616
|
+
return C(await a.updateComment(e, t, {
|
|
617
|
+
body: n.body,
|
|
618
|
+
...o()
|
|
619
|
+
}, s()));
|
|
620
|
+
},
|
|
621
|
+
async delete(e, t) {
|
|
622
|
+
await a.deleteComment(e, t, o(), s());
|
|
623
|
+
},
|
|
624
|
+
async setResolved(e, t, n) {
|
|
625
|
+
return C(await a.resolveComment(e, t, o(), s()));
|
|
626
|
+
},
|
|
627
|
+
subscribe(e, t) {
|
|
628
|
+
function i(e) {
|
|
629
|
+
let n = C(e.comment);
|
|
630
|
+
switch (e.action) {
|
|
631
|
+
case "commentCreated":
|
|
632
|
+
t({
|
|
633
|
+
type: "created",
|
|
634
|
+
comment: n
|
|
635
|
+
});
|
|
636
|
+
break;
|
|
637
|
+
case "commentDeleted":
|
|
638
|
+
t({
|
|
639
|
+
type: "deleted",
|
|
640
|
+
commentId: n.id,
|
|
641
|
+
parentId: n.parentId
|
|
642
|
+
});
|
|
643
|
+
break;
|
|
644
|
+
case "commentUpdated":
|
|
645
|
+
case "commentResolved":
|
|
646
|
+
case "commentUnresolved": t({
|
|
647
|
+
type: "updated",
|
|
648
|
+
comment: n
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
let a = r(n, (e, t) => {
|
|
653
|
+
t?.unbind(S, i), e?.bind(S, i);
|
|
654
|
+
}, { immediate: !0 });
|
|
655
|
+
return () => {
|
|
656
|
+
a(), n.value?.unbind(S, i);
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
function te(e) {
|
|
662
|
+
let { authManager: n, onError: r } = e, i = t(null), a = t(!1), o = null, s = null;
|
|
663
|
+
async function c(e, t) {
|
|
664
|
+
if (o) return;
|
|
665
|
+
o = new x({
|
|
666
|
+
authManager: n,
|
|
667
|
+
config: t,
|
|
668
|
+
onError: r
|
|
669
|
+
}), await o.connect(), s = `presence-template.${e}`;
|
|
670
|
+
let c = o.subscribePresence(s);
|
|
671
|
+
c.bind("pusher:subscription_succeeded", () => {
|
|
672
|
+
a.value = !0, i.value = c;
|
|
673
|
+
}), c.bind("pusher:subscription_error", (e) => {
|
|
674
|
+
a.value = !1, i.value = null, r?.(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to subscribe to template channel"));
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
function l() {
|
|
678
|
+
s && o && o.unsubscribe(s), o?.disconnect(), o = null, s = null, i.value = null, a.value = !1;
|
|
679
|
+
}
|
|
680
|
+
function u() {
|
|
681
|
+
return o?.getSocketId() ?? null;
|
|
682
|
+
}
|
|
683
|
+
return {
|
|
684
|
+
channel: i,
|
|
685
|
+
isConnected: a,
|
|
686
|
+
connect: c,
|
|
687
|
+
disconnect: l,
|
|
688
|
+
getSocketId: u
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
function ne(e) {
|
|
692
|
+
let t = new v(e);
|
|
693
|
+
return {
|
|
694
|
+
list(e) {
|
|
695
|
+
return t.listModules(e?.search, e?.category);
|
|
696
|
+
},
|
|
697
|
+
create(e) {
|
|
698
|
+
return t.createModule(e);
|
|
699
|
+
},
|
|
700
|
+
update(e, n) {
|
|
701
|
+
return t.updateModule(e, n);
|
|
702
|
+
},
|
|
703
|
+
delete(e) {
|
|
704
|
+
return t.deleteModule(e);
|
|
705
|
+
}
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
function w(e) {
|
|
709
|
+
let t = {
|
|
710
|
+
id: e.id,
|
|
711
|
+
url: e.url,
|
|
712
|
+
filename: e.filename,
|
|
713
|
+
alt: e.alt,
|
|
714
|
+
mimeType: e.mimeType,
|
|
715
|
+
folderId: e.folderId,
|
|
716
|
+
createdAt: e.createdAt,
|
|
717
|
+
updatedAt: e.updatedAt,
|
|
718
|
+
size: e.size
|
|
719
|
+
};
|
|
720
|
+
return e.width != null && (t.width = e.width), e.height != null && (t.height = e.height), e.thumbnailUrl != null && (t.thumbnailUrl = e.thumbnailUrl), t;
|
|
721
|
+
}
|
|
722
|
+
function T(e, t = null) {
|
|
723
|
+
return {
|
|
724
|
+
id: e.id,
|
|
725
|
+
name: e.name,
|
|
726
|
+
parentId: e.parentId === void 0 ? t : e.parentId
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
function E(e, t = null) {
|
|
730
|
+
let n = [];
|
|
731
|
+
for (let r of e) n.push(T(r, t)), r.children?.length && n.push(...E(r.children, r.id));
|
|
732
|
+
return n;
|
|
733
|
+
}
|
|
734
|
+
function D(e) {
|
|
735
|
+
let t = e?.media?.categories;
|
|
736
|
+
if (!t) return;
|
|
737
|
+
let n = {};
|
|
738
|
+
for (let [e, r] of Object.entries(t)) n[e] = r.mimeTypes;
|
|
739
|
+
return n;
|
|
740
|
+
}
|
|
741
|
+
function O(e, t) {
|
|
742
|
+
let n = new y(e);
|
|
743
|
+
return {
|
|
744
|
+
async list(e) {
|
|
745
|
+
let t = await n.browseMedia({
|
|
746
|
+
search: e?.search,
|
|
747
|
+
cursor: e?.cursor,
|
|
748
|
+
folderId: e?.folderId,
|
|
749
|
+
category: e?.category
|
|
750
|
+
}), r = { items: t.data.map(w) };
|
|
751
|
+
return t.meta.nextCursor && (r.nextCursor = t.meta.nextCursor), r;
|
|
752
|
+
},
|
|
753
|
+
async create(e) {
|
|
754
|
+
return w(await n.uploadMedia(e.file, e.folderId));
|
|
755
|
+
},
|
|
756
|
+
async update(e, t) {
|
|
757
|
+
return w(await n.updateMedia(e, t.filename, t.alt));
|
|
758
|
+
},
|
|
759
|
+
delete(e) {
|
|
760
|
+
return n.deleteMedia(e);
|
|
761
|
+
},
|
|
762
|
+
folders: {
|
|
763
|
+
async list() {
|
|
764
|
+
return E(await n.getMediaFolders());
|
|
765
|
+
},
|
|
766
|
+
async create(e) {
|
|
767
|
+
return T(await n.createMediaFolder(e.name, e.parentId));
|
|
768
|
+
},
|
|
769
|
+
async update(e, t) {
|
|
770
|
+
return T(await n.renameMediaFolder(e, t.name));
|
|
771
|
+
},
|
|
772
|
+
delete(e) {
|
|
773
|
+
return n.deleteMediaFolder(e);
|
|
774
|
+
},
|
|
775
|
+
async move(e, t) {
|
|
776
|
+
return (await n.moveMedia(e, t)).map(w);
|
|
777
|
+
}
|
|
778
|
+
},
|
|
779
|
+
async replace(e, t) {
|
|
780
|
+
return w(await n.replaceMedia(e, t));
|
|
781
|
+
},
|
|
782
|
+
async importFromUrl(e, t) {
|
|
783
|
+
return w(await n.importFromUrl(e, t));
|
|
784
|
+
},
|
|
785
|
+
async checkUsage(e) {
|
|
786
|
+
let t = await n.checkMediaUsage(e), r = {};
|
|
787
|
+
for (let [e, n] of Object.entries(t.data)) r[e] = {
|
|
788
|
+
templateCount: n.templateCount,
|
|
789
|
+
templateNames: n.templateNames
|
|
790
|
+
};
|
|
791
|
+
return r;
|
|
792
|
+
},
|
|
793
|
+
async frequentlyUsed() {
|
|
794
|
+
return (await n.getFrequentlyUsed()).map(w);
|
|
795
|
+
},
|
|
796
|
+
async storage() {
|
|
797
|
+
return t?.()?.storage ?? null;
|
|
798
|
+
},
|
|
799
|
+
get maxFileSize() {
|
|
800
|
+
return t?.()?.media?.maxFileSize;
|
|
801
|
+
},
|
|
802
|
+
get mimeTypes() {
|
|
803
|
+
return D(t?.() ?? null);
|
|
804
|
+
}
|
|
805
|
+
};
|
|
806
|
+
}
|
|
807
|
+
var k = 6e4;
|
|
808
|
+
function re(e) {
|
|
809
|
+
let t = new v(e), n = 0;
|
|
810
|
+
function r(e, r) {
|
|
811
|
+
let i = Date.now();
|
|
812
|
+
i - n < k || (n = i, t.createVersion(e, r).catch((e) => {
|
|
813
|
+
console.warn("[Templatical] Automatic version not recorded — the save itself succeeded:", e);
|
|
814
|
+
}));
|
|
815
|
+
}
|
|
816
|
+
return {
|
|
817
|
+
load(e) {
|
|
818
|
+
return t.getTemplate(e);
|
|
819
|
+
},
|
|
820
|
+
create(e) {
|
|
821
|
+
return t.createTemplate(e.content, e.name);
|
|
822
|
+
},
|
|
823
|
+
async save(e, n) {
|
|
824
|
+
let i = await t.updateTemplate(e, n);
|
|
825
|
+
return n.content && r(e, n.content), i;
|
|
826
|
+
}
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
function ie(e) {
|
|
830
|
+
return {
|
|
831
|
+
customFonts: e?.customFonts ?? [],
|
|
832
|
+
defaultFallback: e?.defaultFallback ?? "Arial, sans-serif"
|
|
833
|
+
};
|
|
834
|
+
}
|
|
835
|
+
function A(e) {
|
|
836
|
+
let t = new v(e.authManager);
|
|
837
|
+
async function n(e, n) {
|
|
838
|
+
let r = await t.exportTemplate(e, n);
|
|
839
|
+
return {
|
|
840
|
+
html: r.html,
|
|
841
|
+
mjml: r.mjml
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
async function r(e, n) {
|
|
845
|
+
return (await t.exportTemplate(e, n)).mjml;
|
|
846
|
+
}
|
|
847
|
+
return {
|
|
848
|
+
exportHtml: n,
|
|
849
|
+
getMjmlSource: r
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
function j(e) {
|
|
853
|
+
let t = A({ authManager: e.authManager });
|
|
854
|
+
function n(e) {
|
|
855
|
+
return {
|
|
856
|
+
customFonts: e.fonts?.customFonts ?? [],
|
|
857
|
+
defaultFallback: e.fonts?.defaultFallback ?? "Arial, sans-serif"
|
|
858
|
+
};
|
|
859
|
+
}
|
|
860
|
+
async function r() {
|
|
861
|
+
if (e.getTemplateId() === null) throw Error("[Templatical] Cloud renders from the saved template, so one must exist first. Call create() or load() before toMjml() / toHtml().");
|
|
862
|
+
return (await e.save()).id;
|
|
863
|
+
}
|
|
864
|
+
return {
|
|
865
|
+
async toMjml(e) {
|
|
866
|
+
let i = n(e), a = await r();
|
|
867
|
+
return t.getMjmlSource(a, i);
|
|
868
|
+
},
|
|
869
|
+
async toHtml(e) {
|
|
870
|
+
let i = n(e), a = await r(), { html: o } = await t.exportHtml(a, i);
|
|
871
|
+
return o;
|
|
872
|
+
}
|
|
873
|
+
};
|
|
874
|
+
}
|
|
875
|
+
function M(e) {
|
|
876
|
+
return {
|
|
877
|
+
id: e.id,
|
|
878
|
+
createdAt: e.createdAt,
|
|
879
|
+
isAutomatic: e.isAutomatic,
|
|
880
|
+
content: e.content
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
function ae(e) {
|
|
884
|
+
let t = new v(e);
|
|
885
|
+
return {
|
|
886
|
+
async list(e) {
|
|
887
|
+
return { versions: (await t.getVersions(e)).map(M) };
|
|
888
|
+
},
|
|
889
|
+
async get(e, n) {
|
|
890
|
+
return (await t.getVersion(e, n)).content;
|
|
891
|
+
},
|
|
892
|
+
async create(e, n, r) {
|
|
893
|
+
return M(await t.createVersion(e, n, r?.label));
|
|
894
|
+
},
|
|
895
|
+
restore(e, n) {
|
|
896
|
+
return t.restoreVersion(e, n);
|
|
897
|
+
}
|
|
898
|
+
};
|
|
899
|
+
}
|
|
900
|
+
function oe(e) {
|
|
901
|
+
let { authManager: i, isAuthReady: a } = e, o = t(null);
|
|
902
|
+
a && r(a, (e) => {
|
|
903
|
+
e && (o.value = i.testEmailConfig);
|
|
904
|
+
}, { immediate: !0 });
|
|
905
|
+
let s = n(() => o.value !== null), c = n(() => o.value?.allowedEmails ?? []);
|
|
906
|
+
function l() {
|
|
907
|
+
return o.value?.signature ?? null;
|
|
908
|
+
}
|
|
909
|
+
return {
|
|
910
|
+
isEnabled: s,
|
|
911
|
+
allowedEmails: c,
|
|
912
|
+
getSignature: l
|
|
913
|
+
};
|
|
914
|
+
}
|
|
915
|
+
function se(e) {
|
|
916
|
+
let t = new v(e.authManager);
|
|
917
|
+
return {
|
|
918
|
+
get allowedRecipients() {
|
|
919
|
+
return e.allowedEmails.value;
|
|
920
|
+
},
|
|
921
|
+
async send({ recipient: n }) {
|
|
922
|
+
let r = e.getSignature();
|
|
923
|
+
if (r === null) throw Error("Test email is not enabled for this project");
|
|
924
|
+
let i = e.getTemplateId();
|
|
925
|
+
if (i === null) throw Error("Template must be saved before sending a test email");
|
|
926
|
+
await e.save();
|
|
927
|
+
let { html: a } = await e.exportHtml(i);
|
|
928
|
+
e.onBeforeTestEmail && (a = await e.onBeforeTestEmail(a)), await t.sendTestEmail(i, {
|
|
929
|
+
recipient: n,
|
|
930
|
+
html: a,
|
|
931
|
+
allowedEmails: e.allowedEmails.value,
|
|
932
|
+
signature: r
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
};
|
|
936
|
+
}
|
|
937
|
+
function ce(e) {
|
|
938
|
+
let { authManager: r, onError: i } = e, a = t(null), o = t(!1), s = new v(r), c = n(() => a.value?.features ?? null);
|
|
939
|
+
function l(e) {
|
|
940
|
+
return a.value?.features[e] ?? !1;
|
|
941
|
+
}
|
|
942
|
+
async function u() {
|
|
943
|
+
if (!o.value) {
|
|
944
|
+
o.value = !0;
|
|
945
|
+
try {
|
|
946
|
+
a.value = await s.fetchConfig();
|
|
947
|
+
} catch (e) {
|
|
948
|
+
i?.(e instanceof Error ? e : Error("Failed to fetch config", { cause: e }));
|
|
949
|
+
} finally {
|
|
950
|
+
o.value = !1;
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
return {
|
|
955
|
+
config: a,
|
|
956
|
+
isLoading: o,
|
|
957
|
+
hasFeature: l,
|
|
958
|
+
features: c,
|
|
959
|
+
fetchConfig: u
|
|
960
|
+
};
|
|
961
|
+
}
|
|
962
|
+
var N = 5e3;
|
|
963
|
+
function P(e) {
|
|
964
|
+
return e.authManager ? e.authManager.resolveUrl(_.health) : `${(e.baseUrl ?? "https://templatical.com").replace(/\/$/, "")}${_.health}`;
|
|
965
|
+
}
|
|
966
|
+
async function F(e, t) {
|
|
967
|
+
let n = performance.now();
|
|
968
|
+
try {
|
|
969
|
+
let r = t ? await t.authenticatedFetch(_.health, {
|
|
970
|
+
method: "GET",
|
|
971
|
+
headers: { Accept: "application/json" }
|
|
972
|
+
}) : await fetch(e, {
|
|
973
|
+
method: "GET",
|
|
974
|
+
headers: { Accept: "application/json" }
|
|
975
|
+
}), i = Math.round(performance.now() - n);
|
|
976
|
+
if (r.status === 401) return {
|
|
977
|
+
api: {
|
|
978
|
+
ok: !0,
|
|
979
|
+
latency: i
|
|
980
|
+
},
|
|
981
|
+
auth: {
|
|
982
|
+
ok: !1,
|
|
983
|
+
error: "HTTP 401"
|
|
984
|
+
}
|
|
985
|
+
};
|
|
986
|
+
if (!r.ok) return {
|
|
987
|
+
api: {
|
|
988
|
+
ok: !1,
|
|
989
|
+
latency: i
|
|
990
|
+
},
|
|
991
|
+
auth: {
|
|
992
|
+
ok: !t,
|
|
993
|
+
error: t ? `HTTP ${r.status}` : void 0
|
|
994
|
+
}
|
|
995
|
+
};
|
|
996
|
+
let a = await r.json();
|
|
997
|
+
return {
|
|
998
|
+
api: {
|
|
999
|
+
ok: a.status === "ok",
|
|
1000
|
+
latency: i
|
|
1001
|
+
},
|
|
1002
|
+
auth: { ok: !0 },
|
|
1003
|
+
wsConfig: a.websocket
|
|
1004
|
+
};
|
|
1005
|
+
} catch (e) {
|
|
1006
|
+
return {
|
|
1007
|
+
api: {
|
|
1008
|
+
ok: !1,
|
|
1009
|
+
latency: Math.round(performance.now() - n)
|
|
1010
|
+
},
|
|
1011
|
+
auth: {
|
|
1012
|
+
ok: !t,
|
|
1013
|
+
error: t ? e instanceof Error ? e.message : "Authentication check failed" : void 0
|
|
1014
|
+
}
|
|
1015
|
+
};
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
async function I(e) {
|
|
1019
|
+
if (!e?.host || !e?.appKey) return {
|
|
1020
|
+
ok: !1,
|
|
1021
|
+
error: "WebSocket configuration not available"
|
|
1022
|
+
};
|
|
1023
|
+
if (typeof WebSocket > "u") return {
|
|
1024
|
+
ok: !1,
|
|
1025
|
+
error: "WebSocket not supported in this environment"
|
|
1026
|
+
};
|
|
1027
|
+
let t = `${e.port === 443 ? "wss" : "ws"}://${e.host}:${e.port}/app/${e.appKey}?protocol=7&client=js&version=8.4.0-rc2&flash=false`;
|
|
1028
|
+
return new Promise((e) => {
|
|
1029
|
+
let n = null, r = setTimeout(() => {
|
|
1030
|
+
n?.close(), e({
|
|
1031
|
+
ok: !1,
|
|
1032
|
+
error: "WebSocket connection timed out"
|
|
1033
|
+
});
|
|
1034
|
+
}, N);
|
|
1035
|
+
try {
|
|
1036
|
+
n = new WebSocket(t);
|
|
1037
|
+
} catch (t) {
|
|
1038
|
+
clearTimeout(r), e({
|
|
1039
|
+
ok: !1,
|
|
1040
|
+
error: t instanceof Error ? t.message : "WebSocket connection failed"
|
|
1041
|
+
});
|
|
1042
|
+
return;
|
|
1043
|
+
}
|
|
1044
|
+
n.onopen = () => {
|
|
1045
|
+
clearTimeout(r), n?.close(), e({ ok: !0 });
|
|
1046
|
+
}, n.onerror = () => {
|
|
1047
|
+
clearTimeout(r), e({
|
|
1048
|
+
ok: !1,
|
|
1049
|
+
error: "WebSocket connection failed"
|
|
1050
|
+
});
|
|
1051
|
+
};
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
async function L(e = {}) {
|
|
1055
|
+
let t = await F(P(e), e.authManager), n = await I(t.wsConfig);
|
|
1056
|
+
return {
|
|
1057
|
+
api: t.api,
|
|
1058
|
+
websocket: n,
|
|
1059
|
+
auth: t.auth,
|
|
1060
|
+
overall: t.api.ok && t.auth.ok
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1063
|
+
//#endregion
|
|
1064
|
+
//#region src/cloud/composables/useCloudFeatureFlags.ts
|
|
1065
|
+
function R(e) {
|
|
1066
|
+
let { planConfigInstance: t, getTemplateId: r } = e;
|
|
1067
|
+
return {
|
|
1068
|
+
canSendTestEmail: n(() => t.hasFeature("testEmail")),
|
|
1069
|
+
hasTemplateSaved: n(() => r() !== null),
|
|
1070
|
+
templateLimit: n(() => t.config.value?.limits.maxTemplates ?? null),
|
|
1071
|
+
templateCount: n(() => t.config.value?.templateCount ?? 0)
|
|
1072
|
+
};
|
|
1073
|
+
}
|
|
1074
|
+
//#endregion
|
|
1075
|
+
//#region src/cloud/composables/useCloudPanelState.ts
|
|
1076
|
+
function z() {
|
|
1077
|
+
let e = t(null);
|
|
1078
|
+
return {
|
|
1079
|
+
activePanel: e,
|
|
1080
|
+
commentsOpen: n({
|
|
1081
|
+
get: () => e.value === "comments",
|
|
1082
|
+
set: (t) => e.value = t ? "comments" : null
|
|
1083
|
+
}),
|
|
1084
|
+
rightPanelOpen: n(() => e.value !== null)
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
//#endregion
|
|
1088
|
+
//#region src/cloud/composables/useCloudSaveGate.ts
|
|
1089
|
+
function B(e) {
|
|
1090
|
+
let r = t(!1), i = null, a = n(() => e.planConfig.value?.accessibility?.blockOnError === !0), o = n(() => a.value ? e.issues.value.filter((e) => e.severity === "error") : []), s = n(() => o.value.length > 0);
|
|
1091
|
+
async function c(e) {
|
|
1092
|
+
return s.value ? (i = e, r.value = !0, !1) : (await e(), !0);
|
|
1093
|
+
}
|
|
1094
|
+
async function l(e) {
|
|
1095
|
+
return !s.value && (await e(), !0);
|
|
1096
|
+
}
|
|
1097
|
+
async function u() {
|
|
1098
|
+
let e = i;
|
|
1099
|
+
i = null, r.value = !1, e && await e();
|
|
1100
|
+
}
|
|
1101
|
+
function d() {
|
|
1102
|
+
i = null, r.value = !1;
|
|
1103
|
+
}
|
|
1104
|
+
return {
|
|
1105
|
+
shouldBlock: s,
|
|
1106
|
+
blockingIssues: o,
|
|
1107
|
+
modalOpen: r,
|
|
1108
|
+
tryRunSave: c,
|
|
1109
|
+
runUnlessBlocked: l,
|
|
1110
|
+
confirmAndSave: u,
|
|
1111
|
+
cancel: d
|
|
1112
|
+
};
|
|
1113
|
+
}
|
|
1114
|
+
//#endregion
|
|
1115
|
+
//#region src/cloud/collectSavedBlockIds.ts
|
|
1116
|
+
function V(e) {
|
|
1117
|
+
let t = /* @__PURE__ */ new Set();
|
|
1118
|
+
return H(e?.content?.blocks, t), t;
|
|
1119
|
+
}
|
|
1120
|
+
function H(e, t) {
|
|
1121
|
+
if (e) {
|
|
1122
|
+
for (let n of e) if (t.add(n.id), n.children) {
|
|
1123
|
+
if (n.type === "section") for (let e of n.children) H(e, t);
|
|
1124
|
+
else n.type === "wrapper" && H(n.children, t);
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
//#endregion
|
|
1129
|
+
//#region src/cloud/createCloudRuntime.ts
|
|
1130
|
+
function U(e) {
|
|
1131
|
+
if (!e) return {};
|
|
1132
|
+
let { onSaved: t, onCreated: n, onLoaded: r } = e;
|
|
1133
|
+
return {
|
|
1134
|
+
...typeof t == "function" ? { onSaved: t } : {},
|
|
1135
|
+
...typeof n == "function" ? { onCreated: n } : {},
|
|
1136
|
+
...typeof r == "function" ? { onLoaded: r } : {}
|
|
1137
|
+
};
|
|
1138
|
+
}
|
|
1139
|
+
function W(e) {
|
|
1140
|
+
if (!e) return {};
|
|
1141
|
+
let { onCreated: t, onUpdated: n, onDeleted: r, onResolved: i, onUnresolved: a } = e;
|
|
1142
|
+
return {
|
|
1143
|
+
...typeof t == "function" ? { onCreated: t } : {},
|
|
1144
|
+
...typeof n == "function" ? { onUpdated: n } : {},
|
|
1145
|
+
...typeof r == "function" ? { onDeleted: r } : {},
|
|
1146
|
+
...typeof i == "function" ? { onResolved: i } : {},
|
|
1147
|
+
...typeof a == "function" ? { onUnresolved: a } : {}
|
|
1148
|
+
};
|
|
1149
|
+
}
|
|
1150
|
+
function le(e) {
|
|
1151
|
+
if (typeof e != "object" || !e) return {};
|
|
1152
|
+
let { onCreated: t, onUpdated: n, onDeleted: r } = e;
|
|
1153
|
+
return {
|
|
1154
|
+
...typeof t == "function" ? { onCreated: t } : {},
|
|
1155
|
+
...typeof n == "function" ? { onUpdated: n } : {},
|
|
1156
|
+
...typeof r == "function" ? { onDeleted: r } : {}
|
|
1157
|
+
};
|
|
1158
|
+
}
|
|
1159
|
+
function ue(e) {
|
|
1160
|
+
if (typeof e != "object" || !e) return {};
|
|
1161
|
+
let { onSent: t, defaultRecipient: n } = e;
|
|
1162
|
+
return {
|
|
1163
|
+
...typeof t == "function" ? { onSent: t } : {},
|
|
1164
|
+
...typeof n == "string" ? { defaultRecipient: n } : {}
|
|
1165
|
+
};
|
|
1166
|
+
}
|
|
1167
|
+
function de(e) {
|
|
1168
|
+
if (typeof e != "object" || !e) return {};
|
|
1169
|
+
let { onCreated: t, onUpdated: n, onDeleted: r } = e;
|
|
1170
|
+
return {
|
|
1171
|
+
...typeof t == "function" ? { onCreated: t } : {},
|
|
1172
|
+
...typeof n == "function" ? { onUpdated: n } : {},
|
|
1173
|
+
...typeof r == "function" ? { onDeleted: r } : {}
|
|
1174
|
+
};
|
|
1175
|
+
}
|
|
1176
|
+
function fe(e) {
|
|
1177
|
+
if (!e) return {};
|
|
1178
|
+
let { onCreated: t, onRestored: n } = e;
|
|
1179
|
+
return {
|
|
1180
|
+
...typeof t == "function" ? { onCreated: t } : {},
|
|
1181
|
+
...typeof n == "function" ? { onRestored: n } : {}
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
function G(e) {
|
|
1185
|
+
return e.length < 2 ? e.join("") : e.length === 2 ? e.join(" and ") : `${e.slice(0, -1).join(", ")} and ${e[e.length - 1]}`;
|
|
1186
|
+
}
|
|
1187
|
+
async function K(n) {
|
|
1188
|
+
let { config: i, cloudTranslations: d } = n, f = null, p = null, m = null, h = null, g = t(null), _ = t(null);
|
|
1189
|
+
function v() {
|
|
1190
|
+
if (!f) throw Error("[Templatical] The Cloud editor is not mounted yet.");
|
|
1191
|
+
return f;
|
|
1192
|
+
}
|
|
1193
|
+
function y() {
|
|
1194
|
+
return f?.state.template?.id ?? null;
|
|
1195
|
+
}
|
|
1196
|
+
let x = new u({
|
|
1197
|
+
...i.auth,
|
|
1198
|
+
onError: (e) => {
|
|
1199
|
+
l(e) && (g.value = e), i.onError?.(e);
|
|
1200
|
+
}
|
|
1201
|
+
}), S = ce({
|
|
1202
|
+
authManager: x,
|
|
1203
|
+
onError: i.onError
|
|
1204
|
+
});
|
|
1205
|
+
await x.initialize();
|
|
1206
|
+
let C = await L({ authManager: x });
|
|
1207
|
+
if (!C.api.ok) throw Error("Health check failed: API is not reachable");
|
|
1208
|
+
if (!C.auth.ok) throw Error(`Health check failed: authentication error${C.auth.error ? ` - ${C.auth.error}` : ""}`);
|
|
1209
|
+
C.websocket.ok || s.warn("WebSocket health check failed:", C.websocket.error ?? "unknown error", "-- real-time features will be disabled."), await S.fetchConfig(), g.value = null;
|
|
1210
|
+
let w = i.templates, T = [
|
|
1211
|
+
"load",
|
|
1212
|
+
"create",
|
|
1213
|
+
"save"
|
|
1214
|
+
].filter((e) => w?.[e] !== void 0);
|
|
1215
|
+
T.length > 0 && s.warn(`initCloud ignores ${G(T.map((e) => `templates.${e}`))} — the template id is the join key for version history, comments and the server-side export, so an id Cloud never issued would break them. Your event handlers were kept. Use init() to bring your own storage.`);
|
|
1216
|
+
let E = i.versionHistory, D = [
|
|
1217
|
+
"list",
|
|
1218
|
+
"get",
|
|
1219
|
+
"create",
|
|
1220
|
+
"restore"
|
|
1221
|
+
].filter((e) => E?.[e] !== void 0);
|
|
1222
|
+
D.length > 0 && s.warn(`initCloud ignores ${G(D.map((e) => `versionHistory.${e}`))} — a version is keyed to a template id Cloud issued, so Cloud owns its history. Your event handlers were kept. Use init() to bring your own storage.`);
|
|
1223
|
+
let k = i.comments, M = [
|
|
1224
|
+
"list",
|
|
1225
|
+
"create",
|
|
1226
|
+
"update",
|
|
1227
|
+
"delete",
|
|
1228
|
+
"setResolved",
|
|
1229
|
+
"subscribe"
|
|
1230
|
+
].filter((e) => k?.[e] !== void 0);
|
|
1231
|
+
M.length > 0 && s.warn(`initCloud ignores ${G(M.map((e) => `comments.${e}`))} — a comment is keyed to a template id Cloud issued, and its author is signed by the auth token, so Cloud owns the conversation. Your event handlers were kept. Use init() to bring your own storage.`), i.render && s.warn("initCloud does not accept a `render` provider — Cloud renders server-side for test email, sends and exports, so a supplied renderer would change only what you preview and export, never what Cloud delivers. The supplied provider is ignored. For your own MJML, call renderToMjml(editor.getContent()) from @templatical/renderer."), i.ai !== void 0 && s.warn("initCloud does not take an `ai` key yet — Cloud's AI arrives as its own provider in a later release. The key is ignored. To bring your own AI backend, use init({ ai }).");
|
|
1232
|
+
function N(e) {
|
|
1233
|
+
let t = S.config.value?.websocket;
|
|
1234
|
+
m && t && m.connect(e.id, b(t));
|
|
1235
|
+
}
|
|
1236
|
+
let P = re(x), F = P.create, I = P.save, H = {
|
|
1237
|
+
...U(i.templates),
|
|
1238
|
+
load: async (e) => {
|
|
1239
|
+
let t = await P.load(e);
|
|
1240
|
+
return N(t), t;
|
|
1241
|
+
},
|
|
1242
|
+
create: typeof F == "function" ? async (e) => {
|
|
1243
|
+
let t = await F(e);
|
|
1244
|
+
return N(t), t;
|
|
1245
|
+
} : !1,
|
|
1246
|
+
save: typeof I == "function" ? async (e, t) => {
|
|
1247
|
+
if (p && f) {
|
|
1248
|
+
let e = p.registry;
|
|
1249
|
+
await c(f.content.value, {
|
|
1250
|
+
renderCustomBlock: e.renderCustomBlock,
|
|
1251
|
+
getCustomBlockStylesheet: (t) => e.getDefinition(t)?.stylesheet
|
|
1252
|
+
});
|
|
1253
|
+
}
|
|
1254
|
+
return I(e, t);
|
|
1255
|
+
} : !1
|
|
1256
|
+
}, K = j({
|
|
1257
|
+
authManager: x,
|
|
1258
|
+
getTemplateId: y,
|
|
1259
|
+
save: () => v().save()
|
|
1260
|
+
}), pe = {
|
|
1261
|
+
...fe(i.versionHistory),
|
|
1262
|
+
...ae(x)
|
|
1263
|
+
}, me = {
|
|
1264
|
+
...W(i.comments),
|
|
1265
|
+
...ee({
|
|
1266
|
+
authManager: x,
|
|
1267
|
+
channel: _,
|
|
1268
|
+
getSocketId: () => m?.getSocketId() ?? null
|
|
1269
|
+
})
|
|
1270
|
+
}, he = x.userConfig ? {
|
|
1271
|
+
id: x.userConfig.id,
|
|
1272
|
+
name: x.userConfig.name
|
|
1273
|
+
} : void 0, q = typeof i.savedBlocks?.list == "function" ? i.savedBlocks : null;
|
|
1274
|
+
if (q === null && typeof i.savedBlocks == "object" && i.savedBlocks !== null) {
|
|
1275
|
+
let e = i.savedBlocks, t = [
|
|
1276
|
+
"list",
|
|
1277
|
+
"create",
|
|
1278
|
+
"update",
|
|
1279
|
+
"delete"
|
|
1280
|
+
].filter((t) => e[t] !== void 0);
|
|
1281
|
+
t.length > 0 && s.warn(`initCloud ignores ${G(t.map((e) => `savedBlocks.${e}`))} — a provider needs a working list to replace Cloud's store, and this value has none, so it configures Cloud's own store instead. Your event handlers were kept. Use init() to bring your own storage.`);
|
|
1282
|
+
}
|
|
1283
|
+
let J = i.savedBlocks === !1 ? void 0 : q ?? {
|
|
1284
|
+
...le(i.savedBlocks),
|
|
1285
|
+
...ne(x)
|
|
1286
|
+
}, Y = oe({
|
|
1287
|
+
authManager: x,
|
|
1288
|
+
isAuthReady: t(!0)
|
|
1289
|
+
}), ge = A({ authManager: x }), X = typeof i.testEmail?.send == "function" ? i.testEmail : null;
|
|
1290
|
+
if (X === null && typeof i.testEmail == "object" && i.testEmail !== null) {
|
|
1291
|
+
let e = i.testEmail, t = [
|
|
1292
|
+
"send",
|
|
1293
|
+
"includeMjml",
|
|
1294
|
+
"allowedRecipients"
|
|
1295
|
+
].filter((t) => e[t] !== void 0);
|
|
1296
|
+
t.length > 0 && s.warn(`initCloud ignores ${G(t.map((e) => `testEmail.${e}`))} — a provider needs a working send to replace Cloud's sender outright, and Cloud renders server-side with the signed allowlist from your project's JWT either way, so none of these apply here. Your event handlers were kept.`);
|
|
1297
|
+
}
|
|
1298
|
+
let _e = X ?? Object.assign(se({
|
|
1299
|
+
authManager: x,
|
|
1300
|
+
getTemplateId: y,
|
|
1301
|
+
save: () => v().save(),
|
|
1302
|
+
exportHtml: (e) => ge.exportHtml(e, ie(i.fonts)),
|
|
1303
|
+
allowedEmails: Y.allowedEmails,
|
|
1304
|
+
getSignature: Y.getSignature,
|
|
1305
|
+
onBeforeTestEmail: i.onBeforeTestEmail
|
|
1306
|
+
}), ue(i.testEmail)), Z = typeof i.media?.list == "function" ? i.media : null;
|
|
1307
|
+
if (Z === null && typeof i.media == "object" && i.media !== null) {
|
|
1308
|
+
let e = i.media, t = [
|
|
1309
|
+
"list",
|
|
1310
|
+
"create",
|
|
1311
|
+
"update",
|
|
1312
|
+
"delete"
|
|
1313
|
+
].filter((t) => e[t] !== void 0);
|
|
1314
|
+
t.length > 0 && s.warn(`initCloud ignores ${G(t.map((e) => `media.${e}`))} — a provider needs a working list to replace Cloud's store, and this value has none, so it configures Cloud's own store instead. Your event handlers were kept. Use init() to bring your own storage.`);
|
|
1315
|
+
let n = ["maxFileSize", "mimeTypes"].filter((t) => e[t] !== void 0);
|
|
1316
|
+
n.length > 0 && s.warn(`initCloud ignores ${G(n.map((e) => `media.${e}`))} — Cloud's plan owns those limits whenever Cloud's store is in play. Your event handlers were kept.`);
|
|
1317
|
+
}
|
|
1318
|
+
let Q = i.media === !1 ? void 0 : Z ?? Object.assign(O(x, () => S.config.value), de(i.media)), $ = R({
|
|
1319
|
+
planConfigInstance: S,
|
|
1320
|
+
getTemplateId: y
|
|
1321
|
+
});
|
|
1322
|
+
function ve(t) {
|
|
1323
|
+
f = t.editor, e(o, d), e(a, x);
|
|
1324
|
+
let n = te({
|
|
1325
|
+
authManager: x,
|
|
1326
|
+
onError: i.onError
|
|
1327
|
+
});
|
|
1328
|
+
return m = n, r(n.channel, (e) => {
|
|
1329
|
+
_.value = e;
|
|
1330
|
+
}, { immediate: !0 }), {
|
|
1331
|
+
websocket: n,
|
|
1332
|
+
panelState: z(),
|
|
1333
|
+
featureFlags: $
|
|
1334
|
+
};
|
|
1335
|
+
}
|
|
1336
|
+
function ye(e) {
|
|
1337
|
+
let { core: n, capabilities: r } = e;
|
|
1338
|
+
return p = n, h = B({
|
|
1339
|
+
issues: n.templateLint ? n.templateLint.issues : t([]),
|
|
1340
|
+
planConfig: S.config
|
|
1341
|
+
}), r.plan = S, i.customBlocks?.length && n.registerCustomBlocks(i.customBlocks), i.theme && (n.themeOverrides.value = i.theme), {
|
|
1342
|
+
saveGate: h,
|
|
1343
|
+
sessionError: g,
|
|
1344
|
+
retry: async () => {
|
|
1345
|
+
try {
|
|
1346
|
+
await x.initialize(), g.value = null;
|
|
1347
|
+
} catch (e) {
|
|
1348
|
+
g.value = e instanceof Error ? e : /* @__PURE__ */ Error("Authentication failed");
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
};
|
|
1352
|
+
}
|
|
1353
|
+
return {
|
|
1354
|
+
runtime: {
|
|
1355
|
+
isSavedBlocksAvailable: q ? () => !0 : () => i.savedBlocks !== !1 && S.hasFeature("savedModules"),
|
|
1356
|
+
isTestEmailAvailable: X ? () => !0 : () => Y.isEnabled.value && $.canSendTestEmail.value && $.hasTemplateSaved.value,
|
|
1357
|
+
isCommentsAvailable: () => i.comments !== !1 && S.hasFeature("commenting") && $.hasTemplateSaved.value,
|
|
1358
|
+
isBlockSaved: (e) => V(f?.state.template ?? null).has(e),
|
|
1359
|
+
getSaveGate: () => h,
|
|
1360
|
+
attach: ve,
|
|
1361
|
+
ready: ye,
|
|
1362
|
+
destroy() {
|
|
1363
|
+
m?.disconnect(), i.onUnmount?.();
|
|
1364
|
+
}
|
|
1365
|
+
},
|
|
1366
|
+
providers: {
|
|
1367
|
+
templates: H,
|
|
1368
|
+
render: K,
|
|
1369
|
+
versionHistory: pe,
|
|
1370
|
+
...J ? { savedBlocks: J } : {},
|
|
1371
|
+
testEmail: _e,
|
|
1372
|
+
comments: me,
|
|
1373
|
+
...Q ? { media: Q } : {}
|
|
1374
|
+
},
|
|
1375
|
+
user: he
|
|
1376
|
+
};
|
|
1377
|
+
}
|
|
1378
|
+
//#endregion
|
|
1379
|
+
export { K as bootstrapCloud };
|