@jini-ai/admin 0.4.2 → 0.4.4
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/CHANGELOG.md +15 -0
- package/README.md +7 -0
- package/dist/agent-plugins/react/components/AgentPluginListPanel.d.ts +1 -1
- package/dist/agent-plugins/react/hooks/AgentPluginInspector.hooks.js +1 -1
- package/dist/agent-plugins/react/hooks/AgentPluginPanel.hooks.d.ts +1 -1
- package/dist/agent-plugins/react/hooks/AgentPluginsPage.hooks.d.ts +1 -1
- package/dist/agent-plugins/react/hooks/AgentPluginsPage.hooks.js +1 -1
- package/dist/agent-plugins/react/hooks/MarketplaceTab.hooks.d.ts +1 -1
- package/dist/agent-plugins/react/index.js +1 -1
- package/dist/agent-plugins/react/pages/AgentPluginsPage.d.ts +1 -1
- package/dist/agent-plugins/react/tabs/DownloadedTab.d.ts +1 -1
- package/dist/agent-plugins/react/tabs/InstalledTab.d.ts +1 -1
- package/dist/agent-plugins/react/tabs/MarketplaceTab.d.ts +1 -1
- package/dist/comments/adapters/http.d.ts +29 -0
- package/dist/comments/adapters/http.js +50 -0
- package/dist/comments/adapters/memory.d.ts +17 -0
- package/dist/comments/adapters/memory.js +61 -0
- package/dist/comments/comments.module.d.ts +73 -0
- package/dist/comments/comments.module.js +16 -0
- package/dist/comments/conformance/comments-api.conformance.d.ts +9 -0
- package/dist/comments/conformance/comments-api.conformance.js +63 -0
- package/dist/comments/controllers/comment-queue.controller.d.ts +48 -0
- package/dist/comments/controllers/comment-queue.controller.js +164 -0
- package/dist/comments/controllers/comment-settings.controller.d.ts +32 -0
- package/dist/comments/controllers/comment-settings.controller.js +77 -0
- package/dist/comments/controllers/comments.controller.d.ts +16 -0
- package/dist/comments/controllers/comments.controller.js +16 -0
- package/dist/comments/index.d.ts +13 -0
- package/dist/comments/index.js +8 -0
- package/dist/comments/messages.en.d.ts +54 -0
- package/dist/comments/messages.en.js +56 -0
- package/dist/comments/models.d.ts +22 -0
- package/dist/comments/models.js +2 -0
- package/dist/comments/ports.d.ts +14 -0
- package/dist/comments/ports.js +5 -0
- package/dist/comments/react/components/QueueSection.d.ts +30 -0
- package/dist/comments/react/components/QueueSection.js +57 -0
- package/dist/comments/react/components/SettingsSection.d.ts +14 -0
- package/dist/comments/react/components/SettingsSection.js +23 -0
- package/dist/comments/react/hooks/CommentsPage.hooks.d.ts +9 -0
- package/dist/comments/react/hooks/CommentsPage.hooks.js +10 -0
- package/dist/comments/react/hooks/CommentsPorts.hooks.d.ts +13 -0
- package/dist/comments/react/hooks/CommentsPorts.hooks.js +15 -0
- package/dist/comments/react/hooks/QueueSection.hooks.d.ts +62 -0
- package/dist/comments/react/hooks/QueueSection.hooks.js +57 -0
- package/dist/comments/react/hooks/SettingsSection.hooks.d.ts +12 -0
- package/dist/comments/react/hooks/SettingsSection.hooks.js +21 -0
- package/dist/comments/react/hooks/use-comment-queue.hooks.d.ts +34 -0
- package/dist/comments/react/hooks/use-comment-queue.hooks.js +47 -0
- package/dist/comments/react/hooks/use-comment-settings.hooks.d.ts +22 -0
- package/dist/comments/react/hooks/use-comment-settings.hooks.js +30 -0
- package/dist/comments/react/hooks/use-comments.hooks.d.ts +15 -0
- package/dist/comments/react/hooks/use-comments.hooks.js +20 -0
- package/dist/comments/react/index.d.ts +316 -0
- package/dist/comments/react/index.js +35 -0
- package/dist/comments/react/pages/CommentsPage.d.ts +12 -0
- package/dist/comments/react/pages/CommentsPage.js +15 -0
- package/dist/comments/rules.d.ts +140 -0
- package/dist/comments/rules.js +199 -0
- package/dist/core/index.d.ts +3 -1
- package/dist/core/index.js +1 -0
- package/dist/core/ledger-slice.d.ts +90 -0
- package/dist/core/ledger-slice.js +81 -0
- package/dist/core/ports/comments.d.ts +2 -0
- package/dist/core/ports/forms.d.ts +19 -7
- package/dist/core/ports/forms.js +4 -4
- package/dist/core/ports/index.d.ts +1 -1
- package/dist/core/ports/seo.d.ts +33 -6
- package/dist/core/react/bind-react.d.ts +46 -0
- package/dist/core/react/bind-react.js +28 -0
- package/dist/core/react/index.d.ts +3 -0
- package/dist/core/react/index.js +3 -0
- package/dist/core/react/use-controller.d.ts +16 -0
- package/dist/core/react/use-controller.js +18 -0
- package/dist/forms/adapters/http.d.ts +26 -0
- package/dist/forms/adapters/http.js +43 -0
- package/dist/forms/adapters/memory.d.ts +14 -0
- package/dist/forms/adapters/memory.js +77 -0
- package/dist/forms/conformance/forms-api.conformance.d.ts +17 -0
- package/dist/forms/conformance/forms-api.conformance.js +71 -0
- package/dist/forms/controllers/draft-store.d.ts +18 -0
- package/dist/forms/controllers/draft-store.js +17 -0
- package/dist/forms/controllers/field-attributes-dialog.controller.d.ts +37 -0
- package/dist/forms/controllers/field-attributes-dialog.controller.js +27 -0
- package/dist/forms/controllers/form-editor.controller.d.ts +36 -0
- package/dist/forms/controllers/form-editor.controller.js +22 -0
- package/dist/forms/controllers/form-fields-editor.controller.d.ts +20 -0
- package/dist/forms/controllers/form-fields-editor.controller.js +10 -0
- package/dist/forms/controllers/form-submission-detail.controller.d.ts +20 -0
- package/dist/forms/controllers/form-submission-detail.controller.js +10 -0
- package/dist/forms/controllers/form-submissions.controller.d.ts +25 -0
- package/dist/forms/controllers/form-submissions.controller.js +10 -0
- package/dist/forms/controllers/forms-list.controller.d.ts +22 -0
- package/dist/forms/controllers/forms-list.controller.js +10 -0
- package/dist/forms/forms.module.d.ts +138 -0
- package/dist/forms/forms.module.js +17 -0
- package/dist/forms/html-rules.d.ts +34 -0
- package/dist/forms/html-rules.js +34 -0
- package/dist/forms/index.d.ts +14 -0
- package/dist/forms/index.js +12 -0
- package/dist/forms/messages.en.d.ts +101 -0
- package/dist/forms/messages.en.js +105 -0
- package/dist/forms/models.d.ts +29 -0
- package/dist/forms/models.js +8 -0
- package/dist/forms/ports.d.ts +26 -0
- package/dist/forms/ports.js +6 -0
- package/dist/forms/react/components/FieldAttributesDialog.d.ts +14 -0
- package/dist/forms/react/components/FieldAttributesDialog.js +47 -0
- package/dist/forms/react/components/FormEditorFieldsBody.d.ts +28 -0
- package/dist/forms/react/components/FormEditorFieldsBody.js +24 -0
- package/dist/forms/react/components/FormEditorHeaderText.d.ts +7 -0
- package/dist/forms/react/components/FormEditorHeaderText.js +8 -0
- package/dist/forms/react/components/FormEditorMainPanel.d.ts +12 -0
- package/dist/forms/react/components/FormEditorMainPanel.js +13 -0
- package/dist/forms/react/components/FormEditorTabStrip.d.ts +13 -0
- package/dist/forms/react/components/FormEditorTabStrip.js +14 -0
- package/dist/forms/react/components/FormFieldsEditor.d.ts +13 -0
- package/dist/forms/react/components/FormFieldsEditor.js +39 -0
- package/dist/forms/react/components/FormSubmissionDate.d.ts +8 -0
- package/dist/forms/react/components/FormSubmissionDate.js +5 -0
- package/dist/forms/react/components/FormSubmissionDetail.d.ts +15 -0
- package/dist/forms/react/components/FormSubmissionDetail.js +30 -0
- package/dist/forms/react/components/FormSubmissions.d.ts +12 -0
- package/dist/forms/react/components/FormSubmissions.js +46 -0
- package/dist/forms/react/hooks/FormsPorts.hooks.d.ts +41 -0
- package/dist/forms/react/hooks/FormsPorts.hooks.js +16 -0
- package/dist/forms/react/hooks/forms-view.hooks.d.ts +117 -0
- package/dist/forms/react/hooks/forms-view.hooks.js +78 -0
- package/dist/forms/react/hooks/use-field-attributes-dialog.hooks.d.ts +31 -0
- package/dist/forms/react/hooks/use-field-attributes-dialog.hooks.js +22 -0
- package/dist/forms/react/hooks/use-form-editor.hooks.d.ts +118 -0
- package/dist/forms/react/hooks/use-form-editor.hooks.js +208 -0
- package/dist/forms/react/hooks/use-form-fields-editor.hooks.d.ts +34 -0
- package/dist/forms/react/hooks/use-form-fields-editor.hooks.js +36 -0
- package/dist/forms/react/hooks/use-form-submission-date.hooks.d.ts +12 -0
- package/dist/forms/react/hooks/use-form-submission-date.hooks.js +9 -0
- package/dist/forms/react/hooks/use-form-submission-detail.hooks.d.ts +68 -0
- package/dist/forms/react/hooks/use-form-submission-detail.hooks.js +81 -0
- package/dist/forms/react/hooks/use-form-submissions.hooks.d.ts +67 -0
- package/dist/forms/react/hooks/use-form-submissions.hooks.js +110 -0
- package/dist/forms/react/hooks/use-forms-list.hooks.d.ts +78 -0
- package/dist/forms/react/hooks/use-forms-list.hooks.js +103 -0
- package/dist/forms/react/index.d.ts +452 -0
- package/dist/forms/react/index.js +35 -0
- package/dist/forms/react/pages/FormEditor.d.ts +19 -0
- package/dist/forms/react/pages/FormEditor.js +40 -0
- package/dist/forms/react/pages/FormsList.d.ts +39 -0
- package/dist/forms/react/pages/FormsList.js +50 -0
- package/dist/forms/rules.d.ts +291 -0
- package/dist/forms/rules.js +338 -0
- package/dist/media/react/hooks/EditMediaPanel.hooks.js +1 -1
- package/dist/media/react/hooks/LibraryTab.hooks.d.ts +1 -1
- package/dist/media/react/hooks/LibraryTab.hooks.js +1 -1
- package/dist/media/react/hooks/MediaCard.hooks.js +6 -20
- package/dist/media/react/hooks/MediaGrid.hooks.d.ts +2 -2
- package/dist/media/react/hooks/MediaPage.hooks.d.ts +1 -1
- package/dist/media/react/hooks/MediaPage.hooks.js +1 -1
- package/dist/media/react/hooks/MediaPicker.hooks.js +1 -1
- package/dist/media/react/index.js +1 -1
- package/dist/media/react/tabs/LibraryTab.d.ts +1 -1
- package/dist/media/react/tabs/ProvidersTab.d.ts +1 -1
- package/dist/playground/react/components/Canvas.d.ts +1 -1
- package/dist/playground/react/hooks/Canvas.hooks.d.ts +1 -1
- package/dist/playground/react/hooks/Canvas.hooks.js +1 -1
- package/dist/playground/react/hooks/PlaygroundPage.hooks.d.ts +1 -1
- package/dist/playground/react/index.js +1 -1
- package/dist/playground/react/pages/PlaygroundPage.d.ts +1 -1
- package/dist/playground/react/tabs/CanvasTab.d.ts +1 -1
- package/dist/react/bind-react.d.ts +1 -45
- package/dist/react/bind-react.js +2 -27
- package/dist/react/components/ConfirmDialog/ConfirmDialog.d.ts +22 -5
- package/dist/react/components/ConfirmDialog/ConfirmDialog.hooks.d.ts +2 -2
- package/dist/react/components/ConfirmDialog/ConfirmDialog.hooks.js +17 -55
- package/dist/react/components/ConfirmDialog/ConfirmDialog.js +33 -70
- package/dist/react/components/RowMenu/RowMenu.hooks.js +14 -3
- package/dist/react/use-controller.d.ts +1 -15
- package/dist/react/use-controller.js +2 -17
- package/dist/redirects/adapters/http.d.ts +20 -0
- package/dist/redirects/adapters/http.js +31 -0
- package/dist/redirects/adapters/memory.d.ts +13 -0
- package/dist/redirects/adapters/memory.js +83 -0
- package/dist/redirects/conformance/redirects-api.conformance.d.ts +12 -0
- package/dist/redirects/conformance/redirects-api.conformance.js +66 -0
- package/dist/redirects/controllers/hit-count.controller.d.ts +14 -0
- package/dist/redirects/controllers/hit-count.controller.js +10 -0
- package/dist/redirects/controllers/import-redirects.controller.d.ts +28 -0
- package/dist/redirects/controllers/import-redirects.controller.js +29 -0
- package/dist/redirects/controllers/redirects.controller.d.ts +37 -0
- package/dist/redirects/controllers/redirects.controller.js +38 -0
- package/dist/redirects/index.d.ts +11 -0
- package/dist/redirects/index.js +10 -0
- package/dist/redirects/messages.en.d.ts +58 -0
- package/dist/redirects/messages.en.js +60 -0
- package/dist/redirects/models.d.ts +14 -0
- package/dist/redirects/models.js +2 -0
- package/dist/redirects/ports.d.ts +9 -0
- package/dist/redirects/ports.js +4 -0
- package/dist/redirects/react/components/HitCountCell.d.ts +19 -0
- package/dist/redirects/react/components/HitCountCell.js +19 -0
- package/dist/redirects/react/components/ImportRedirectsForm.d.ts +17 -0
- package/dist/redirects/react/components/ImportRedirectsForm.js +12 -0
- package/dist/redirects/react/hooks/RedirectsOptions.hooks.d.ts +27 -0
- package/dist/redirects/react/hooks/RedirectsOptions.hooks.js +15 -0
- package/dist/redirects/react/hooks/RedirectsPage.hooks.d.ts +50 -0
- package/dist/redirects/react/hooks/RedirectsPage.hooks.js +30 -0
- package/dist/redirects/react/hooks/RedirectsPorts.hooks.d.ts +10 -0
- package/dist/redirects/react/hooks/RedirectsPorts.hooks.js +11 -0
- package/dist/redirects/react/hooks/use-hit-count-cell.hooks.d.ts +19 -0
- package/dist/redirects/react/hooks/use-hit-count-cell.hooks.js +15 -0
- package/dist/redirects/react/hooks/use-import-redirects-form.hooks.d.ts +21 -0
- package/dist/redirects/react/hooks/use-import-redirects-form.hooks.js +25 -0
- package/dist/redirects/react/hooks/use-redirects.hooks.d.ts +34 -0
- package/dist/redirects/react/hooks/use-redirects.hooks.js +63 -0
- package/dist/redirects/react/hooks/wired.hooks.d.ts +55 -0
- package/dist/redirects/react/hooks/wired.hooks.js +31 -0
- package/dist/redirects/react/index.d.ts +324 -0
- package/dist/redirects/react/index.js +28 -0
- package/dist/redirects/react/pages/RedirectsPage.d.ts +15 -0
- package/dist/redirects/react/pages/RedirectsPage.js +20 -0
- package/dist/redirects/redirects.module.d.ts +77 -0
- package/dist/redirects/redirects.module.js +13 -0
- package/dist/redirects/rules.d.ts +131 -0
- package/dist/redirects/rules.js +134 -0
- package/dist/security/react/hooks/AccessTokensTab.hooks.d.ts +1 -1
- package/dist/security/react/hooks/AccessTokensTab.hooks.js +1 -1
- package/dist/security/react/hooks/RootKeyTab.hooks.d.ts +1 -1
- package/dist/security/react/hooks/RootKeyTab.hooks.js +1 -1
- package/dist/security/react/hooks/SecurityPage.hooks.d.ts +1 -1
- package/dist/security/react/index.js +1 -1
- package/dist/security/react/pages/SecurityPage.d.ts +1 -1
- package/dist/security/react/tabs/AccessTokensTab.d.ts +1 -1
- package/dist/security/react/tabs/RootKeyTab.d.ts +1 -1
- package/dist/seo/adapters/http.d.ts +31 -0
- package/dist/seo/adapters/http.js +37 -0
- package/dist/seo/adapters/memory.d.ts +28 -0
- package/dist/seo/adapters/memory.js +129 -0
- package/dist/seo/conformance/seo-api.conformance.d.ts +8 -0
- package/dist/seo/conformance/seo-api.conformance.js +44 -0
- package/dist/seo/controllers/entry-picker.controller.d.ts +21 -0
- package/dist/seo/controllers/entry-picker.controller.js +17 -0
- package/dist/seo/controllers/entry-section.controller.d.ts +20 -0
- package/dist/seo/controllers/entry-section.controller.js +7 -0
- package/dist/seo/controllers/media-ref.controller.d.ts +26 -0
- package/dist/seo/controllers/media-ref.controller.js +14 -0
- package/dist/seo/controllers/seo-entry.controller.d.ts +31 -0
- package/dist/seo/controllers/seo-entry.controller.js +52 -0
- package/dist/seo/controllers/seo.controller.d.ts +29 -0
- package/dist/seo/controllers/seo.controller.js +50 -0
- package/dist/seo/controllers/sitemap.controller.d.ts +25 -0
- package/dist/seo/controllers/sitemap.controller.js +27 -0
- package/dist/seo/index.d.ts +14 -0
- package/dist/seo/index.js +12 -0
- package/dist/seo/messages.en.d.ts +79 -0
- package/dist/seo/messages.en.js +79 -0
- package/dist/seo/models.d.ts +179 -0
- package/dist/seo/models.js +8 -0
- package/dist/seo/ports.d.ts +11 -0
- package/dist/seo/ports.js +4 -0
- package/dist/seo/react/components/MediaPickerBridge.d.ts +4 -0
- package/dist/seo/react/components/MediaPickerBridge.js +8 -0
- package/dist/seo/react/components/MediaRefField.d.ts +40 -0
- package/dist/seo/react/components/MediaRefField.js +12 -0
- package/dist/seo/react/components/SeoIcons.d.ts +13 -0
- package/dist/seo/react/components/SeoIcons.js +32 -0
- package/dist/seo/react/components/SitemapModal.d.ts +48 -0
- package/dist/seo/react/components/SitemapModal.js +72 -0
- package/dist/seo/react/hooks/MediaPickerBridge.hooks.d.ts +6 -0
- package/dist/seo/react/hooks/MediaPickerBridge.hooks.js +27 -0
- package/dist/seo/react/hooks/MediaRefField.hooks.d.ts +25 -0
- package/dist/seo/react/hooks/MediaRefField.hooks.js +30 -0
- package/dist/seo/react/hooks/SeoModuleTabs.d.ts +14 -0
- package/dist/seo/react/hooks/SeoModuleTabs.js +18 -0
- package/dist/seo/react/hooks/SeoPage.hooks.d.ts +69 -0
- package/dist/seo/react/hooks/SeoPage.hooks.js +37 -0
- package/dist/seo/react/hooks/SeoPorts.hooks.d.ts +19 -0
- package/dist/seo/react/hooks/SeoPorts.hooks.js +22 -0
- package/dist/seo/react/hooks/SitemapModal.hooks.d.ts +26 -0
- package/dist/seo/react/hooks/SitemapModal.hooks.js +20 -0
- package/dist/seo/react/hooks/use-entry-picker.hooks.d.ts +11 -0
- package/dist/seo/react/hooks/use-entry-picker.hooks.js +20 -0
- package/dist/seo/react/hooks/use-seo-entry-panel.hooks.d.ts +14 -0
- package/dist/seo/react/hooks/use-seo-entry-panel.hooks.js +26 -0
- package/dist/seo/react/hooks/use-seo-entry-section.hooks.d.ts +4 -0
- package/dist/seo/react/hooks/use-seo-entry-section.hooks.js +7 -0
- package/dist/seo/react/hooks/use-seo.hooks.d.ts +11 -0
- package/dist/seo/react/hooks/use-seo.hooks.js +29 -0
- package/dist/seo/react/hooks/use-sitemap-modal.hooks.d.ts +10 -0
- package/dist/seo/react/hooks/use-sitemap-modal.hooks.js +18 -0
- package/dist/seo/react/index.d.ts +369 -0
- package/dist/seo/react/index.js +30 -0
- package/dist/seo/react/options.d.ts +26 -0
- package/dist/seo/react/options.js +2 -0
- package/dist/seo/react/pages/SeoPage.d.ts +161 -0
- package/dist/seo/react/pages/SeoPage.js +215 -0
- package/dist/seo/rules.d.ts +142 -0
- package/dist/seo/rules.js +220 -0
- package/dist/seo/seo.module.d.ts +115 -0
- package/dist/seo/seo.module.js +14 -0
- package/dist/source-control/react/hooks/ProvidersTab.hooks.d.ts +1 -1
- package/dist/source-control/react/hooks/ProvidersTab.hooks.js +1 -1
- package/dist/source-control/react/hooks/SourceControlPage.hooks.d.ts +1 -1
- package/dist/source-control/react/index.js +1 -1
- package/dist/source-control/react/pages/SourceControlPage.d.ts +1 -1
- package/dist/source-control/react/tabs/ProvidersTab.d.ts +1 -1
- package/dist/widgets/adapters/http.d.ts +19 -0
- package/dist/widgets/adapters/http.js +33 -0
- package/dist/widgets/adapters/memory.d.ts +22 -0
- package/dist/widgets/adapters/memory.js +93 -0
- package/dist/widgets/conformance/widgets-api.conformance.d.ts +6 -0
- package/dist/widgets/conformance/widgets-api.conformance.js +55 -0
- package/dist/widgets/controllers/instance-editor.controller.d.ts +49 -0
- package/dist/widgets/controllers/instance-editor.controller.js +87 -0
- package/dist/widgets/controllers/library.controller.d.ts +33 -0
- package/dist/widgets/controllers/library.controller.js +53 -0
- package/dist/widgets/controllers/region-editor.controller.d.ts +42 -0
- package/dist/widgets/controllers/region-editor.controller.js +69 -0
- package/dist/widgets/controllers/regions.controller.d.ts +27 -0
- package/dist/widgets/controllers/regions.controller.js +44 -0
- package/dist/widgets/index.d.ts +11 -0
- package/dist/widgets/index.js +9 -0
- package/dist/widgets/messages.en.d.ts +78 -0
- package/dist/widgets/messages.en.js +83 -0
- package/dist/widgets/models.d.ts +62 -0
- package/dist/widgets/models.js +2 -0
- package/dist/widgets/ports.d.ts +79 -0
- package/dist/widgets/ports.js +5 -0
- package/dist/widgets/react/components/WidgetInstanceNotices.d.ts +14 -0
- package/dist/widgets/react/components/WidgetInstanceNotices.js +25 -0
- package/dist/widgets/react/components/WidgetRegionEditorHeaderActions.d.ts +22 -0
- package/dist/widgets/react/components/WidgetRegionEditorHeaderActions.js +18 -0
- package/dist/widgets/react/components/WidgetsLibraryNotices.d.ts +13 -0
- package/dist/widgets/react/components/WidgetsLibraryNotices.js +10 -0
- package/dist/widgets/react/hooks/WidgetsPorts.hooks.d.ts +270 -0
- package/dist/widgets/react/hooks/WidgetsPorts.hooks.js +17 -0
- package/dist/widgets/react/hooks/navigation.hooks.d.ts +9 -0
- package/dist/widgets/react/hooks/navigation.hooks.js +6 -0
- package/dist/widgets/react/hooks/page-views.hooks.d.ts +87 -0
- package/dist/widgets/react/hooks/page-views.hooks.js +30 -0
- package/dist/widgets/react/hooks/use-widget-instance-editor.hooks.d.ts +56 -0
- package/dist/widgets/react/hooks/use-widget-instance-editor.hooks.js +38 -0
- package/dist/widgets/react/hooks/use-widget-region-editor.hooks.d.ts +32 -0
- package/dist/widgets/react/hooks/use-widget-region-editor.hooks.js +22 -0
- package/dist/widgets/react/hooks/use-widget-regions.hooks.d.ts +23 -0
- package/dist/widgets/react/hooks/use-widget-regions.hooks.js +22 -0
- package/dist/widgets/react/hooks/use-widgets-library.hooks.d.ts +37 -0
- package/dist/widgets/react/hooks/use-widgets-library.hooks.js +23 -0
- package/dist/widgets/react/index.d.ts +391 -0
- package/dist/widgets/react/index.js +31 -0
- package/dist/widgets/react/pages/WidgetInstanceEditor.d.ts +23 -0
- package/dist/widgets/react/pages/WidgetInstanceEditor.js +37 -0
- package/dist/widgets/react/pages/WidgetRegionEditor.d.ts +22 -0
- package/dist/widgets/react/pages/WidgetRegionEditor.js +25 -0
- package/dist/widgets/react/pages/WidgetRegions.d.ts +21 -0
- package/dist/widgets/react/pages/WidgetRegions.js +31 -0
- package/dist/widgets/react/pages/WidgetsLibrary.d.ts +24 -0
- package/dist/widgets/react/pages/WidgetsLibrary.js +61 -0
- package/dist/widgets/rules.d.ts +94 -0
- package/dist/widgets/rules.js +83 -0
- package/dist/widgets/widgets.module.d.ts +122 -0
- package/dist/widgets/widgets.module.js +21 -0
- package/package.json +206 -9
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CommentsProps } from '../pages/CommentsPage.js';
|
|
2
|
+
export declare function useCommentsPage(props: CommentsProps, _optional?: Record<string, never>): {
|
|
3
|
+
canRead: boolean;
|
|
4
|
+
canConfigure: boolean;
|
|
5
|
+
permissions: readonly string[] | null;
|
|
6
|
+
error: string | null;
|
|
7
|
+
t: import("../../messages.en.js").CommentsTranslator;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=CommentsPage.hooks.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { hasPermission } from '../../../core/permissions/rules.js';
|
|
2
|
+
import { useWiredComments } from './use-comments.hooks.js';
|
|
3
|
+
export function useCommentsPage(props, _optional = {}) {
|
|
4
|
+
const usePage = props.useCommentsHook ?? useWiredComments;
|
|
5
|
+
const state = usePage({});
|
|
6
|
+
return { ...state,
|
|
7
|
+
canRead: hasPermission({ permissions: state.permissions ?? [], permission: 'comments.read' }),
|
|
8
|
+
canConfigure: hasPermission({ permissions: state.permissions ?? [], permission: 'comments.configure' }) };
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=CommentsPage.hooks.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AdminCommentsPort } from '../../../core/ports/comments.js';
|
|
2
|
+
import type { CommentsEventsPort, CommentsSessionPort } from '../../ports.js';
|
|
3
|
+
import { type CommentsTranslator } from '../../messages.en.js';
|
|
4
|
+
export interface CommentsPorts {
|
|
5
|
+
readonly commentsApi: AdminCommentsPort;
|
|
6
|
+
readonly commentsSession: CommentsSessionPort;
|
|
7
|
+
readonly commentsEvents?: CommentsEventsPort;
|
|
8
|
+
}
|
|
9
|
+
export declare const CommentsPortsContext: import("react").Context<CommentsPorts | null>;
|
|
10
|
+
export declare const CommentsTranslationContext: import("react").Context<CommentsTranslator>;
|
|
11
|
+
export declare function useCommentsPorts(_required?: Record<string, never>, _optional?: Record<string, never>): CommentsPorts;
|
|
12
|
+
export declare function useCommentsTranslation(_required?: Record<string, never>, _optional?: Record<string, never>): CommentsTranslator;
|
|
13
|
+
//# sourceMappingURL=CommentsPorts.hooks.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
import { AdminConfigError } from '../../../core/module/create-admin.js';
|
|
3
|
+
import { englishComments } from '../../messages.en.js';
|
|
4
|
+
export const CommentsPortsContext = createContext(null);
|
|
5
|
+
export const CommentsTranslationContext = createContext(englishComments);
|
|
6
|
+
export function useCommentsPorts(_required = {}, _optional = {}) {
|
|
7
|
+
const ports = useContext(CommentsPortsContext);
|
|
8
|
+
if (!ports)
|
|
9
|
+
throw new AdminConfigError({ issues: ['React scope unavailable: comments'] });
|
|
10
|
+
return ports;
|
|
11
|
+
}
|
|
12
|
+
export function useCommentsTranslation(_required = {}, _optional = {}) {
|
|
13
|
+
return useContext(CommentsTranslationContext);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=CommentsPorts.hooks.js.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type ChangeEvent } from 'react';
|
|
2
|
+
import type { DataTableColumn } from '../../../react/components/DataTable.js';
|
|
3
|
+
import type { AdminComment, CommentModerationAction, CommentStatus } from '../../../core/ports/comments.js';
|
|
4
|
+
import { type RowActionState } from '../../rules.js';
|
|
5
|
+
import type { CommentsTranslator } from '../../messages.en.js';
|
|
6
|
+
import { type QueueSectionProps } from '../components/QueueSection.js';
|
|
7
|
+
export declare function useQueueSection(props: QueueSectionProps, _optional?: Record<string, never>): {
|
|
8
|
+
t: CommentsTranslator;
|
|
9
|
+
purgeBusy: boolean;
|
|
10
|
+
onCancelPurge: () => void;
|
|
11
|
+
status: CommentStatus;
|
|
12
|
+
setStatus: import("react").Dispatch<import("react").SetStateAction<CommentStatus>>;
|
|
13
|
+
items: readonly AdminComment[] | null;
|
|
14
|
+
nextCursor: string | null;
|
|
15
|
+
error: string | null;
|
|
16
|
+
loadingMore: boolean;
|
|
17
|
+
loadMore: () => void;
|
|
18
|
+
stateFor: (id: string) => RowActionState;
|
|
19
|
+
onModerate: (comment: AdminComment, action: CommentModerationAction) => Promise<void>;
|
|
20
|
+
pendingPurge: AdminComment | null;
|
|
21
|
+
setPendingPurge: import("react").Dispatch<import("react").SetStateAction<AdminComment | null>>;
|
|
22
|
+
onPurge: () => Promise<void>;
|
|
23
|
+
};
|
|
24
|
+
export declare function useQueueToolbar({ onStatusChange }: {
|
|
25
|
+
onStatusChange: (status: CommentStatus) => void;
|
|
26
|
+
}, _optional?: Record<string, never>): {
|
|
27
|
+
onChange: (event: ChangeEvent<HTMLSelectElement>) => void;
|
|
28
|
+
};
|
|
29
|
+
export declare function useQueueActionsCell(props: {
|
|
30
|
+
comment: AdminComment;
|
|
31
|
+
permissions: readonly string[];
|
|
32
|
+
status: CommentStatus;
|
|
33
|
+
t: CommentsTranslator;
|
|
34
|
+
onModerate: (comment: AdminComment, action: CommentModerationAction) => void;
|
|
35
|
+
onRequestPurge: (comment: AdminComment) => void;
|
|
36
|
+
}, _optional?: Record<string, never>): {
|
|
37
|
+
menuItems: import("../../../react/index.js").RowMenuItem[];
|
|
38
|
+
};
|
|
39
|
+
/** Builds the `DataTable` column descriptors. A plain function rather than a closure declared
|
|
40
|
+
* inside `QueueTable`'s body — it doesn't need to be a hook-scoped closure, only the values
|
|
41
|
+
* already threaded through its parameters. */
|
|
42
|
+
export declare function queueColumns(props: {
|
|
43
|
+
permissions: readonly string[];
|
|
44
|
+
status: CommentStatus;
|
|
45
|
+
stateFor: (id: string) => RowActionState;
|
|
46
|
+
t: CommentsTranslator;
|
|
47
|
+
onModerate: (comment: AdminComment, action: CommentModerationAction) => void;
|
|
48
|
+
onRequestPurge: (comment: AdminComment) => void;
|
|
49
|
+
handleForRow: (commentId: string) => string;
|
|
50
|
+
}, _optional?: Record<string, never>): DataTableColumn<AdminComment>[];
|
|
51
|
+
export declare function useQueueTable(props: {
|
|
52
|
+
items: readonly AdminComment[];
|
|
53
|
+
permissions: readonly string[];
|
|
54
|
+
status: CommentStatus;
|
|
55
|
+
stateFor: (id: string) => RowActionState;
|
|
56
|
+
t: CommentsTranslator;
|
|
57
|
+
onModerate: (comment: AdminComment, action: CommentModerationAction) => void;
|
|
58
|
+
onRequestPurge: (comment: AdminComment) => void;
|
|
59
|
+
}, _optional?: Record<string, never>): {
|
|
60
|
+
columns: DataTableColumn<AdminComment>[];
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=QueueSection.hooks.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { createElement } from 'react';
|
|
2
|
+
import { buildAgentListHandles } from '@jini-ai/agentic';
|
|
3
|
+
import { formatTimestamp } from '@jini-ai/ui/panel-kit';
|
|
4
|
+
import { commentRowMenuItems, truncate } from '../../rules.js';
|
|
5
|
+
import { QueueActionsCell } from '../components/QueueSection.js';
|
|
6
|
+
import { useWiredCommentQueue } from './use-comment-queue.hooks.js';
|
|
7
|
+
import { useCommentsTranslation } from './CommentsPorts.hooks.js';
|
|
8
|
+
export function useQueueSection(props, _optional = {}) {
|
|
9
|
+
const contextT = useCommentsTranslation();
|
|
10
|
+
const useQueue = props.useCommentQueueHook ?? useWiredCommentQueue;
|
|
11
|
+
const queue = useQueue({ permissions: props.permissions });
|
|
12
|
+
return { ...queue, t: props.t ?? contextT,
|
|
13
|
+
purgeBusy: queue.pendingPurge !== null && queue.stateFor(queue.pendingPurge.id).busy,
|
|
14
|
+
onCancelPurge: () => queue.setPendingPurge(null) };
|
|
15
|
+
}
|
|
16
|
+
export function useQueueToolbar({ onStatusChange }, _optional = {}) {
|
|
17
|
+
return { onChange: (event) => onStatusChange(event.target.value) };
|
|
18
|
+
}
|
|
19
|
+
export function useQueueActionsCell(props, _optional = {}) {
|
|
20
|
+
return { menuItems: commentRowMenuItems({ comment: props.comment,
|
|
21
|
+
context: { permissions: props.permissions, currentFilterStatus: props.status },
|
|
22
|
+
handlers: { onModerate: props.onModerate, onRequestPurge: props.onRequestPurge } }, { t: props.t }) };
|
|
23
|
+
}
|
|
24
|
+
/** Builds the `DataTable` column descriptors. A plain function rather than a closure declared
|
|
25
|
+
* inside `QueueTable`'s body — it doesn't need to be a hook-scoped closure, only the values
|
|
26
|
+
* already threaded through its parameters. */
|
|
27
|
+
export function queueColumns(props, _optional = {}) {
|
|
28
|
+
return [
|
|
29
|
+
{ key: "author", header: props.t("Author"), cell: (comment) => comment.authorName },
|
|
30
|
+
{ key: "comment", header: props.t("Comment"), cell: (comment) => truncate({ text: comment.bodyText, max: 120 }) },
|
|
31
|
+
{
|
|
32
|
+
key: "status",
|
|
33
|
+
header: props.t("Status"),
|
|
34
|
+
cell: (comment) => createElement('span', { className: `status status-${comment.status}` }, props.t(comment.status)),
|
|
35
|
+
},
|
|
36
|
+
{ key: "depth", header: props.t("Depth"), cell: (comment) => comment.depth },
|
|
37
|
+
{ key: "created", header: props.t("Created"), cell: (comment) => formatTimestamp({ iso: comment.createdAt }, { timeZone: "local" }) },
|
|
38
|
+
{
|
|
39
|
+
key: "actions",
|
|
40
|
+
header: props.t("More"),
|
|
41
|
+
cell: (comment) => createElement(QueueActionsCell, {
|
|
42
|
+
comment, agentHandleBase: props.handleForRow(comment.id), permissions: props.permissions,
|
|
43
|
+
status: props.status, rowState: props.stateFor(comment.id), t: props.t,
|
|
44
|
+
onModerate: props.onModerate, onRequestPurge: props.onRequestPurge,
|
|
45
|
+
}),
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
export function useQueueTable(props, _optional = {}) {
|
|
50
|
+
// Rows page in over "Load more", so handles are derived fresh each render from whichever rows
|
|
51
|
+
// are currently on screen — same per-row-id lookup `Database.tsx`'s `TimelineBody` uses, needed
|
|
52
|
+
// because `DataTable`'s `cell` callback only receives the row, not its index.
|
|
53
|
+
const rowHandles = buildAgentListHandles({ prefix: "comments-row", ids: props.items.map((comment) => comment.id) });
|
|
54
|
+
const handleById = new Map(props.items.map((comment, index) => [comment.id, rowHandles[index]]));
|
|
55
|
+
return { columns: queueColumns({ ...props, handleForRow: commentId => handleById.get(commentId) }) };
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=QueueSection.hooks.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FormEvent } from 'react';
|
|
2
|
+
import type { SettingsSectionProps } from '../components/SettingsSection.js';
|
|
3
|
+
export declare function useSettingsSection(props: SettingsSectionProps, _optional?: Record<string, never>): {
|
|
4
|
+
t: import("../../messages.en.js").CommentsTranslator;
|
|
5
|
+
onSubmit: (event: FormEvent<HTMLFormElement>) => void;
|
|
6
|
+
settings: import("../../index.js").CommentsSettings | null;
|
|
7
|
+
error: string | null;
|
|
8
|
+
saving: boolean;
|
|
9
|
+
notice: string | null;
|
|
10
|
+
save: (form: FormData) => Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=SettingsSection.hooks.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useWiredCommentSettings } from './use-comment-settings.hooks.js';
|
|
2
|
+
import { useCommentsTranslation } from './CommentsPorts.hooks.js';
|
|
3
|
+
/**
|
|
4
|
+
* Resolves the injected hook prop to the real wired hook when a caller passes none. Pulled into its
|
|
5
|
+
* own function, the same `??`-avoidance idiom `MenuEditor.tsx`'s `orEmpty`/`CollectionEntryEditor
|
|
6
|
+
* .tsx`'s `resolveCollectionEntryEditorHook` use: `SettingsSection` was already sitting at the 9/9
|
|
7
|
+
* complexity ceiling, and ESLint's cyclomatic-complexity rule counts a default value or `??` inside
|
|
8
|
+
* a function's OWN body as one of that function's own branches — a call out to a separately-scoped
|
|
9
|
+
* resolver does not.
|
|
10
|
+
*/
|
|
11
|
+
function resolveCommentSettingsHook(override) {
|
|
12
|
+
return override ?? useWiredCommentSettings;
|
|
13
|
+
}
|
|
14
|
+
export function useSettingsSection(props, _optional = {}) {
|
|
15
|
+
const contextT = useCommentsTranslation();
|
|
16
|
+
const useSettings = resolveCommentSettingsHook(props.useCommentSettingsHook);
|
|
17
|
+
const settings = useSettings({ canConfigure: props.canConfigure });
|
|
18
|
+
return { ...settings, t: props.t ?? contextT,
|
|
19
|
+
onSubmit: (event) => { event.preventDefault(); void settings.save(new FormData(event.currentTarget)); } };
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=SettingsSection.hooks.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type Dispatch, type SetStateAction } from 'react';
|
|
2
|
+
import type { AdminComment, AdminCommentsPort, CommentModerationAction, CommentStatus } from '../../../core/ports/comments.js';
|
|
3
|
+
import { type RowActionState } from '../../rules.js';
|
|
4
|
+
import type { CommentsEventsPort } from '../../ports.js';
|
|
5
|
+
import { type CommentsTranslator } from '../../messages.en.js';
|
|
6
|
+
export interface CommentQueueController {
|
|
7
|
+
status: CommentStatus;
|
|
8
|
+
setStatus: Dispatch<SetStateAction<CommentStatus>>;
|
|
9
|
+
items: readonly AdminComment[] | null;
|
|
10
|
+
nextCursor: string | null;
|
|
11
|
+
error: string | null;
|
|
12
|
+
loadingMore: boolean;
|
|
13
|
+
loadMore: () => void;
|
|
14
|
+
stateFor: (id: string) => RowActionState;
|
|
15
|
+
onModerate: (comment: AdminComment, action: CommentModerationAction) => Promise<void>;
|
|
16
|
+
pendingPurge: AdminComment | null;
|
|
17
|
+
setPendingPurge: Dispatch<SetStateAction<AdminComment | null>>;
|
|
18
|
+
onPurge: () => Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
/** Effects attach to injected ports; cursor/row state belongs to the headless controller.
|
|
21
|
+
* The shared cache guards stale page-one keys. Cursor settlement is guarded separately because
|
|
22
|
+
* one fixed query key cannot represent an accumulated list of appended pages.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useCommentQueue({ api, permissions }: {
|
|
25
|
+
api: AdminCommentsPort;
|
|
26
|
+
permissions?: readonly string[];
|
|
27
|
+
}, { t, events }?: {
|
|
28
|
+
t?: CommentsTranslator;
|
|
29
|
+
events?: CommentsEventsPort;
|
|
30
|
+
}): CommentQueueController;
|
|
31
|
+
export declare function useWiredCommentQueue({ permissions }: {
|
|
32
|
+
permissions: readonly string[];
|
|
33
|
+
}, _optional?: Record<string, never>): CommentQueueController;
|
|
34
|
+
//# sourceMappingURL=use-comment-queue.hooks.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useCallback, useEffect } from 'react';
|
|
2
|
+
import { useFetchQuery, useInvalidate } from '@jini-ai/ui/fetch-query';
|
|
3
|
+
import { useController } from '../../../core/react/use-controller.js';
|
|
4
|
+
import { createCommentQueueController } from '../../controllers/comment-queue.controller.js';
|
|
5
|
+
import { KEYS, emptyRowState } from '../../rules.js';
|
|
6
|
+
import { englishComments } from '../../messages.en.js';
|
|
7
|
+
import { useCommentsPorts, useCommentsTranslation } from './CommentsPorts.hooks.js';
|
|
8
|
+
const NO_GRANTS = [];
|
|
9
|
+
/** Effects attach to injected ports; cursor/row state belongs to the headless controller.
|
|
10
|
+
* The shared cache guards stale page-one keys. Cursor settlement is guarded separately because
|
|
11
|
+
* one fixed query key cannot represent an accumulated list of appended pages.
|
|
12
|
+
*/
|
|
13
|
+
export function useCommentQueue({ api, permissions = NO_GRANTS }, { t = englishComments, events } = {}) {
|
|
14
|
+
const invalidate = useInvalidate();
|
|
15
|
+
const invalidateQueue = useCallback(() => invalidate({ key: KEYS.queueRoot }), [invalidate]);
|
|
16
|
+
const { controller, snapshot } = useController({
|
|
17
|
+
create: () => createCommentQueueController({ api, permissions }, { t, onInvalidate: invalidateQueue }),
|
|
18
|
+
dependencies: [api, invalidateQueue],
|
|
19
|
+
});
|
|
20
|
+
useEffect(() => { controller?.configure({ permissions, t }); }, [controller, permissions, t]);
|
|
21
|
+
const status = snapshot?.status ?? 'pending';
|
|
22
|
+
const firstPage = useFetchQuery({ key: KEYS.queue(status), fetch: () => api.listCommentsQueue({}, { status }) });
|
|
23
|
+
useEffect(() => { controller?.settleFirstPage({ page: firstPage.data ?? null, error: firstPage.error, status }); }, [controller, firstPage.data, firstPage.error, status]);
|
|
24
|
+
// Stable identity avoids resubscribing on every render. The host filters out unrelated
|
|
25
|
+
// resources. Unmount removes the subscription even if another cache observer remains active.
|
|
26
|
+
useEffect(() => events?.subscribe({ onRefresh: invalidateQueue }), [events, invalidateQueue]);
|
|
27
|
+
return {
|
|
28
|
+
status,
|
|
29
|
+
setStatus: value => { if (controller)
|
|
30
|
+
controller.setStatus({ status: typeof value === 'function' ? value(controller.getSnapshot().status) : value }); },
|
|
31
|
+
items: snapshot?.items ?? null, nextCursor: snapshot?.nextCursor ?? null,
|
|
32
|
+
error: snapshot?.error ?? null, loadingMore: snapshot?.loadingMore ?? false,
|
|
33
|
+
loadMore: () => controller?.loadMore({}),
|
|
34
|
+
stateFor: id => controller?.stateFor({ id }) ?? emptyRowState(),
|
|
35
|
+
onModerate: async (comment, action) => { await controller?.onModerate({ comment, action }); },
|
|
36
|
+
pendingPurge: snapshot?.pendingPurge ?? null,
|
|
37
|
+
setPendingPurge: value => { if (controller)
|
|
38
|
+
controller.setPendingPurge({ comment: typeof value === 'function' ? value(controller.getSnapshot().pendingPurge) : value }); },
|
|
39
|
+
onPurge: async () => { await controller?.onPurge({}); },
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export function useWiredCommentQueue({ permissions }, _optional = {}) {
|
|
43
|
+
const { commentsApi, commentsEvents } = useCommentsPorts();
|
|
44
|
+
const t = useCommentsTranslation();
|
|
45
|
+
return useCommentQueue({ api: commentsApi, permissions }, { t, ...(commentsEvents ? { events: commentsEvents } : {}) });
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=use-comment-queue.hooks.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AdminCommentsPort, CommentsSettings } from '../../../core/ports/comments.js';
|
|
2
|
+
import { type CommentsTranslator } from '../../messages.en.js';
|
|
3
|
+
export interface CommentSettingsController {
|
|
4
|
+
settings: CommentsSettings | null;
|
|
5
|
+
error: string | null;
|
|
6
|
+
saving: boolean;
|
|
7
|
+
notice: string | null;
|
|
8
|
+
save: (form: FormData) => Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
/** No refresh-event subscription: background settings reads cannot re-seed an uncontrolled form.
|
|
11
|
+
* The cache envelope is retained for observers of the existing KEYS.settings resource.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useCommentSettings({ api, canConfigure }: {
|
|
14
|
+
api: AdminCommentsPort;
|
|
15
|
+
canConfigure: boolean;
|
|
16
|
+
}, { t }?: {
|
|
17
|
+
t?: CommentsTranslator;
|
|
18
|
+
}): CommentSettingsController;
|
|
19
|
+
export declare function useWiredCommentSettings({ canConfigure }: {
|
|
20
|
+
canConfigure: boolean;
|
|
21
|
+
}, _optional?: Record<string, never>): CommentSettingsController;
|
|
22
|
+
//# sourceMappingURL=use-comment-settings.hooks.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useFetchQuery, useInvalidate } from '@jini-ai/ui/fetch-query';
|
|
3
|
+
import { useController } from '../../../core/react/use-controller.js';
|
|
4
|
+
import { createCommentSettingsController } from '../../controllers/comment-settings.controller.js';
|
|
5
|
+
import { KEYS } from '../../rules.js';
|
|
6
|
+
import { englishComments } from '../../messages.en.js';
|
|
7
|
+
import { useCommentsPorts, useCommentsTranslation } from './CommentsPorts.hooks.js';
|
|
8
|
+
/** No refresh-event subscription: background settings reads cannot re-seed an uncontrolled form.
|
|
9
|
+
* The cache envelope is retained for observers of the existing KEYS.settings resource.
|
|
10
|
+
*/
|
|
11
|
+
export function useCommentSettings({ api, canConfigure }, { t = englishComments } = {}) {
|
|
12
|
+
// AC-10: even GET is comments.configure-gated. Skip the doomed read for a denied principal.
|
|
13
|
+
const list = useFetchQuery({ key: KEYS.settings, fetch: async () => ({ data: await api.getCommentsSettings({}) }) }, { enabled: canConfigure });
|
|
14
|
+
const invalidate = useInvalidate();
|
|
15
|
+
const { controller, snapshot } = useController({
|
|
16
|
+
create: () => createCommentSettingsController({ api, permissions: canConfigure ? ['comments.configure'] : [] }, { t, onInvalidate: () => invalidate({ key: KEYS.settings }) }),
|
|
17
|
+
dependencies: [api, invalidate],
|
|
18
|
+
});
|
|
19
|
+
useEffect(() => { controller?.configure({ permissions: canConfigure ? ['comments.configure'] : [], t }); }, [controller, canConfigure, t]);
|
|
20
|
+
useEffect(() => { controller?.settleRead({ settings: list.data?.data ?? null, error: list.error }); }, [controller, list.data, list.error]);
|
|
21
|
+
return { settings: snapshot?.settings ?? null, error: snapshot?.error ?? null,
|
|
22
|
+
saving: snapshot?.saving ?? false, notice: snapshot?.notice ?? null,
|
|
23
|
+
save: async (form) => { await controller?.save({ form }); } };
|
|
24
|
+
}
|
|
25
|
+
export function useWiredCommentSettings({ canConfigure }, _optional = {}) {
|
|
26
|
+
const { commentsApi } = useCommentsPorts();
|
|
27
|
+
const t = useCommentsTranslation();
|
|
28
|
+
return useCommentSettings({ api: commentsApi, canConfigure }, { t });
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=use-comment-settings.hooks.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CommentsSessionPort } from '../../ports.js';
|
|
2
|
+
import { type CommentsTranslator } from '../../messages.en.js';
|
|
3
|
+
export interface CommentsController {
|
|
4
|
+
permissions: readonly string[] | null;
|
|
5
|
+
error: string | null;
|
|
6
|
+
t: CommentsTranslator;
|
|
7
|
+
}
|
|
8
|
+
/** Shared query cache owns permission I/O; the headless controller owns its visible state. */
|
|
9
|
+
export declare function useComments({ session }: {
|
|
10
|
+
session: CommentsSessionPort;
|
|
11
|
+
}, { t }?: {
|
|
12
|
+
t?: CommentsTranslator;
|
|
13
|
+
}): CommentsController;
|
|
14
|
+
export declare function useWiredComments(_required?: Record<string, never>, _optional?: Record<string, never>): CommentsController;
|
|
15
|
+
//# sourceMappingURL=use-comments.hooks.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useFetchQuery } from '@jini-ai/ui/fetch-query';
|
|
3
|
+
import { useController } from '../../../core/react/use-controller.js';
|
|
4
|
+
import { createCommentsController } from '../../controllers/comments.controller.js';
|
|
5
|
+
import { KEYS } from '../../rules.js';
|
|
6
|
+
import { useCommentsPorts, useCommentsTranslation } from './CommentsPorts.hooks.js';
|
|
7
|
+
import { englishComments } from '../../messages.en.js';
|
|
8
|
+
/** Shared query cache owns permission I/O; the headless controller owns its visible state. */
|
|
9
|
+
export function useComments({ session }, { t = englishComments } = {}) {
|
|
10
|
+
const list = useFetchQuery({ key: KEYS.permissions, fetch: () => session.me({}) });
|
|
11
|
+
const { controller, snapshot } = useController({ create: () => createCommentsController({}), dependencies: [session] });
|
|
12
|
+
useEffect(() => { controller?.settle({ data: list.data ?? null, error: list.error }); }, [controller, list.data, list.error]);
|
|
13
|
+
return { permissions: snapshot?.permissions ?? null, error: snapshot?.error ?? null, t };
|
|
14
|
+
}
|
|
15
|
+
export function useWiredComments(_required = {}, _optional = {}) {
|
|
16
|
+
const { commentsSession } = useCommentsPorts();
|
|
17
|
+
const t = useCommentsTranslation();
|
|
18
|
+
return useComments({ session: commentsSession }, { t });
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=use-comments.hooks.js.map
|