@velocity-astro/cms-admin 0.0.0-stage → 0.1.0-beta.2
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/LICENSE +21 -0
- package/README.md +12 -2
- package/app-directory.d.mts +2 -0
- package/app-directory.mjs +8 -0
- package/app-dist/assets/RichTextEditor-Ci93Tlgw.js +135 -0
- package/app-dist/assets/index-CczBKhBz.css +2 -0
- package/app-dist/assets/index-DOIcFJow.js +80 -0
- package/app-dist/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/app-dist/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/app-dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/app-dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/app-dist/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/app-dist/assets/manrope-cyrillic-wght-normal-Dvxsihut.woff2 +0 -0
- package/app-dist/assets/manrope-greek-wght-normal-DL7QRZyv.woff2 +0 -0
- package/app-dist/assets/manrope-latin-ext-wght-normal-Ch3YOpNY.woff2 +0 -0
- package/app-dist/assets/manrope-latin-wght-normal-DHIcAJRg.woff2 +0 -0
- package/app-dist/assets/manrope-vietnamese-wght-normal-usUDDRr7.woff2 +0 -0
- package/app-dist/assets/outfit-latin-ext-wght-normal-DdQaqQDo.woff2 +0 -0
- package/app-dist/assets/outfit-latin-wght-normal-Bc-8i84L.woff2 +0 -0
- package/app-dist/index.html +15 -0
- package/dist/app/AdminApp.d.ts +34 -0
- package/dist/app/AdminApp.d.ts.map +1 -0
- package/dist/app/AdminApp.js +26 -0
- package/dist/app/AdminApp.js.map +1 -0
- package/dist/app/AdminLayout.d.ts +7 -0
- package/dist/app/AdminLayout.d.ts.map +1 -0
- package/dist/app/AdminLayout.js +128 -0
- package/dist/app/AdminLayout.js.map +1 -0
- package/dist/app/NavigationBridge.d.ts +6 -0
- package/dist/app/NavigationBridge.d.ts.map +1 -0
- package/dist/app/NavigationBridge.js +15 -0
- package/dist/app/NavigationBridge.js.map +1 -0
- package/dist/app/PasskeysDialog.d.ts +5 -0
- package/dist/app/PasskeysDialog.d.ts.map +1 -0
- package/dist/app/PasskeysDialog.js +51 -0
- package/dist/app/PasskeysDialog.js.map +1 -0
- package/dist/app/RequestState.d.ts +20 -0
- package/dist/app/RequestState.d.ts.map +1 -0
- package/dist/app/RequestState.js +33 -0
- package/dist/app/RequestState.js.map +1 -0
- package/dist/app/paths.d.ts +29 -0
- package/dist/app/paths.d.ts.map +1 -0
- package/dist/app/paths.js +29 -0
- package/dist/app/paths.js.map +1 -0
- package/dist/app/routes.d.ts +4 -0
- package/dist/app/routes.d.ts.map +1 -0
- package/dist/app/routes.js +53 -0
- package/dist/app/routes.js.map +1 -0
- package/dist/app/use-go.d.ts +7 -0
- package/dist/app/use-go.d.ts.map +1 -0
- package/dist/app/use-go.js +11 -0
- package/dist/app/use-go.js.map +1 -0
- package/dist/client/admin-client.d.ts +317 -0
- package/dist/client/admin-client.d.ts.map +1 -0
- package/dist/client/admin-client.js +2 -0
- package/dist/client/admin-client.js.map +1 -0
- package/dist/client/client-context.d.ts +10 -0
- package/dist/client/client-context.d.ts.map +1 -0
- package/dist/client/client-context.js +14 -0
- package/dist/client/client-context.js.map +1 -0
- package/dist/client/errors.d.ts +22 -0
- package/dist/client/errors.d.ts.map +1 -0
- package/dist/client/errors.js +17 -0
- package/dist/client/errors.js.map +1 -0
- package/dist/client/http-client.d.ts +122 -0
- package/dist/client/http-client.d.ts.map +1 -0
- package/dist/client/http-client.js +366 -0
- package/dist/client/http-client.js.map +1 -0
- package/dist/client/queries.d.ts +213 -0
- package/dist/client/queries.d.ts.map +1 -0
- package/dist/client/queries.js +672 -0
- package/dist/client/queries.js.map +1 -0
- package/dist/fields/BlocksControl.d.ts +8 -0
- package/dist/fields/BlocksControl.d.ts.map +1 -0
- package/dist/fields/BlocksControl.js +154 -0
- package/dist/fields/BlocksControl.js.map +1 -0
- package/dist/fields/CustomFieldsDialog.d.ts +7 -0
- package/dist/fields/CustomFieldsDialog.d.ts.map +1 -0
- package/dist/fields/CustomFieldsDialog.js +29 -0
- package/dist/fields/CustomFieldsDialog.js.map +1 -0
- package/dist/fields/FieldEditor.d.ts +17 -0
- package/dist/fields/FieldEditor.d.ts.map +1 -0
- package/dist/fields/FieldEditor.js +25 -0
- package/dist/fields/FieldEditor.js.map +1 -0
- package/dist/fields/FieldGrid.d.ts +19 -0
- package/dist/fields/FieldGrid.d.ts.map +1 -0
- package/dist/fields/FieldGrid.js +36 -0
- package/dist/fields/FieldGrid.js.map +1 -0
- package/dist/fields/FieldSetDialog.d.ts +11 -0
- package/dist/fields/FieldSetDialog.d.ts.map +1 -0
- package/dist/fields/FieldSetDialog.js +73 -0
- package/dist/fields/FieldSetDialog.js.map +1 -0
- package/dist/fields/FieldSetEditor.d.ts +9 -0
- package/dist/fields/FieldSetEditor.d.ts.map +1 -0
- package/dist/fields/FieldSetEditor.js +49 -0
- package/dist/fields/FieldSetEditor.js.map +1 -0
- package/dist/fields/FieldSummary.d.ts +9 -0
- package/dist/fields/FieldSummary.d.ts.map +1 -0
- package/dist/fields/FieldSummary.js +28 -0
- package/dist/fields/FieldSummary.js.map +1 -0
- package/dist/fields/LinkControl.d.ts +8 -0
- package/dist/fields/LinkControl.d.ts.map +1 -0
- package/dist/fields/LinkControl.js +54 -0
- package/dist/fields/LinkControl.js.map +1 -0
- package/dist/fields/block-icons.d.ts +4 -0
- package/dist/fields/block-icons.d.ts.map +1 -0
- package/dist/fields/block-icons.js +51 -0
- package/dist/fields/block-icons.js.map +1 -0
- package/dist/fields/controls.d.ts +4 -0
- package/dist/fields/controls.d.ts.map +1 -0
- package/dist/fields/controls.js +292 -0
- package/dist/fields/controls.js.map +1 -0
- package/dist/fields/custom-values.d.ts +23 -0
- package/dist/fields/custom-values.d.ts.map +1 -0
- package/dist/fields/custom-values.js +30 -0
- package/dist/fields/custom-values.js.map +1 -0
- package/dist/fields/field-control.d.ts +72 -0
- package/dist/fields/field-control.d.ts.map +1 -0
- package/dist/fields/field-control.js +19 -0
- package/dist/fields/field-control.js.map +1 -0
- package/dist/fields/field-set.d.ts +39 -0
- package/dist/fields/field-set.d.ts.map +1 -0
- package/dist/fields/field-set.js +24 -0
- package/dist/fields/field-set.js.map +1 -0
- package/dist/fields/index.d.ts +7 -0
- package/dist/fields/index.d.ts.map +1 -0
- package/dist/fields/index.js +7 -0
- package/dist/fields/index.js.map +1 -0
- package/dist/fields/page-focus.d.ts +23 -0
- package/dist/fields/page-focus.d.ts.map +1 -0
- package/dist/fields/page-focus.js +14 -0
- package/dist/fields/page-focus.js.map +1 -0
- package/dist/fields/settings.d.ts +40 -0
- package/dist/fields/settings.d.ts.map +1 -0
- package/dist/fields/settings.js +92 -0
- package/dist/fields/settings.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/arrangement.d.ts +20 -0
- package/dist/lib/arrangement.d.ts.map +1 -0
- package/dist/lib/arrangement.js +52 -0
- package/dist/lib/arrangement.js.map +1 -0
- package/dist/lib/content.d.ts +45 -0
- package/dist/lib/content.d.ts.map +1 -0
- package/dist/lib/content.js +99 -0
- package/dist/lib/content.js.map +1 -0
- package/dist/lib/csv.d.ts +10 -0
- package/dist/lib/csv.d.ts.map +1 -0
- package/dist/lib/csv.js +54 -0
- package/dist/lib/csv.js.map +1 -0
- package/dist/lib/day-part.d.ts +5 -0
- package/dist/lib/day-part.d.ts.map +1 -0
- package/dist/lib/day-part.js +10 -0
- package/dist/lib/day-part.js.map +1 -0
- package/dist/lib/download.d.ts +6 -0
- package/dist/lib/download.d.ts.map +1 -0
- package/dist/lib/download.js +13 -0
- package/dist/lib/download.js.map +1 -0
- package/dist/lib/keys.d.ts +5 -0
- package/dist/lib/keys.d.ts.map +1 -0
- package/dist/lib/keys.js +26 -0
- package/dist/lib/keys.js.map +1 -0
- package/dist/lib/prepare-image.d.ts +11 -0
- package/dist/lib/prepare-image.d.ts.map +1 -0
- package/dist/lib/prepare-image.js +52 -0
- package/dist/lib/prepare-image.js.map +1 -0
- package/dist/lib/preview-tab.d.ts +14 -0
- package/dist/lib/preview-tab.d.ts.map +1 -0
- package/dist/lib/preview-tab.js +24 -0
- package/dist/lib/preview-tab.js.map +1 -0
- package/dist/lib/relative-time.d.ts +3 -0
- package/dist/lib/relative-time.d.ts.map +1 -0
- package/dist/lib/relative-time.js +18 -0
- package/dist/lib/relative-time.js.map +1 -0
- package/dist/lib/slug.d.ts +3 -0
- package/dist/lib/slug.d.ts.map +1 -0
- package/dist/lib/slug.js +10 -0
- package/dist/lib/slug.js.map +1 -0
- package/dist/lib/type-icon.d.ts +3 -0
- package/dist/lib/type-icon.d.ts.map +1 -0
- package/dist/lib/type-icon.js +27 -0
- package/dist/lib/type-icon.js.map +1 -0
- package/dist/lib/use-closing.d.ts +19 -0
- package/dist/lib/use-closing.d.ts.map +1 -0
- package/dist/lib/use-closing.js +24 -0
- package/dist/lib/use-closing.js.map +1 -0
- package/dist/lib/use-leave-guard.d.ts +16 -0
- package/dist/lib/use-leave-guard.d.ts.map +1 -0
- package/dist/lib/use-leave-guard.js +29 -0
- package/dist/lib/use-leave-guard.js.map +1 -0
- package/dist/messages/en.d.ts +1068 -0
- package/dist/messages/en.d.ts.map +1 -0
- package/dist/messages/en.js +1041 -0
- package/dist/messages/en.js.map +1 -0
- package/dist/messages/messages-context.d.ts +17 -0
- package/dist/messages/messages-context.d.ts.map +1 -0
- package/dist/messages/messages-context.js +16 -0
- package/dist/messages/messages-context.js.map +1 -0
- package/dist/plugins/PluginBoundary.d.ts +21 -0
- package/dist/plugins/PluginBoundary.d.ts.map +1 -0
- package/dist/plugins/PluginBoundary.js +20 -0
- package/dist/plugins/PluginBoundary.js.map +1 -0
- package/dist/plugins/plugin-editor.d.ts +112 -0
- package/dist/plugins/plugin-editor.d.ts.map +1 -0
- package/dist/plugins/plugin-editor.js +142 -0
- package/dist/plugins/plugin-editor.js.map +1 -0
- package/dist/plugins/plugin-ui.d.ts +45 -0
- package/dist/plugins/plugin-ui.d.ts.map +1 -0
- package/dist/plugins/plugin-ui.js +44 -0
- package/dist/plugins/plugin-ui.js.map +1 -0
- package/dist/screens/Contact/ContactDeals.d.ts +6 -0
- package/dist/screens/Contact/ContactDeals.d.ts.map +1 -0
- package/dist/screens/Contact/ContactDeals.js +41 -0
- package/dist/screens/Contact/ContactDeals.js.map +1 -0
- package/dist/screens/Contact/ContactScreen.d.ts +3 -0
- package/dist/screens/Contact/ContactScreen.d.ts.map +1 -0
- package/dist/screens/Contact/ContactScreen.js +153 -0
- package/dist/screens/Contact/ContactScreen.js.map +1 -0
- package/dist/screens/Contact/ContactWork.d.ts +6 -0
- package/dist/screens/Contact/ContactWork.d.ts.map +1 -0
- package/dist/screens/Contact/ContactWork.js +50 -0
- package/dist/screens/Contact/ContactWork.js.map +1 -0
- package/dist/screens/Contacts/ContactsScreen.d.ts +3 -0
- package/dist/screens/Contacts/ContactsScreen.d.ts.map +1 -0
- package/dist/screens/Contacts/ContactsScreen.js +127 -0
- package/dist/screens/Contacts/ContactsScreen.js.map +1 -0
- package/dist/screens/Contacts/ImportDialog.d.ts +5 -0
- package/dist/screens/Contacts/ImportDialog.d.ts.map +1 -0
- package/dist/screens/Contacts/ImportDialog.js +90 -0
- package/dist/screens/Contacts/ImportDialog.js.map +1 -0
- package/dist/screens/Contacts/PipelineBoard.d.ts +11 -0
- package/dist/screens/Contacts/PipelineBoard.d.ts.map +1 -0
- package/dist/screens/Contacts/PipelineBoard.js +74 -0
- package/dist/screens/Contacts/PipelineBoard.js.map +1 -0
- package/dist/screens/Contacts/StagesDialog.d.ts +8 -0
- package/dist/screens/Contacts/StagesDialog.d.ts.map +1 -0
- package/dist/screens/Contacts/StagesDialog.js +58 -0
- package/dist/screens/Contacts/StagesDialog.js.map +1 -0
- package/dist/screens/Contacts/contact-source.d.ts +4 -0
- package/dist/screens/Contacts/contact-source.d.ts.map +1 -0
- package/dist/screens/Contacts/contact-source.js +18 -0
- package/dist/screens/Contacts/contact-source.js.map +1 -0
- package/dist/screens/Contacts/pipeline.d.ts +23 -0
- package/dist/screens/Contacts/pipeline.d.ts.map +1 -0
- package/dist/screens/Contacts/pipeline.js +57 -0
- package/dist/screens/Contacts/pipeline.js.map +1 -0
- package/dist/screens/ContentList/ContentListScreen.d.ts +3 -0
- package/dist/screens/ContentList/ContentListScreen.d.ts.map +1 -0
- package/dist/screens/ContentList/ContentListScreen.js +105 -0
- package/dist/screens/ContentList/ContentListScreen.js.map +1 -0
- package/dist/screens/ContentType/ContentTypeScreen.d.ts +3 -0
- package/dist/screens/ContentType/ContentTypeScreen.d.ts.map +1 -0
- package/dist/screens/ContentType/ContentTypeScreen.js +133 -0
- package/dist/screens/ContentType/ContentTypeScreen.js.map +1 -0
- package/dist/screens/ContentType/FieldDialog.d.ts +12 -0
- package/dist/screens/ContentType/FieldDialog.d.ts.map +1 -0
- package/dist/screens/ContentType/FieldDialog.js +110 -0
- package/dist/screens/ContentType/FieldDialog.js.map +1 -0
- package/dist/screens/ContentType/SectionsDialog.d.ts +7 -0
- package/dist/screens/ContentType/SectionsDialog.d.ts.map +1 -0
- package/dist/screens/ContentType/SectionsDialog.js +67 -0
- package/dist/screens/ContentType/SectionsDialog.js.map +1 -0
- package/dist/screens/ContentType/SettingsDialog.d.ts +7 -0
- package/dist/screens/ContentType/SettingsDialog.d.ts.map +1 -0
- package/dist/screens/ContentType/SettingsDialog.js +75 -0
- package/dist/screens/ContentType/SettingsDialog.js.map +1 -0
- package/dist/screens/ContentTypes/ContentTypesScreen.d.ts +3 -0
- package/dist/screens/ContentTypes/ContentTypesScreen.d.ts.map +1 -0
- package/dist/screens/ContentTypes/ContentTypesScreen.js +103 -0
- package/dist/screens/ContentTypes/ContentTypesScreen.js.map +1 -0
- package/dist/screens/Deals/DealDialog.d.ts +16 -0
- package/dist/screens/Deals/DealDialog.d.ts.map +1 -0
- package/dist/screens/Deals/DealDialog.js +84 -0
- package/dist/screens/Deals/DealDialog.js.map +1 -0
- package/dist/screens/Deals/DealsScreen.d.ts +3 -0
- package/dist/screens/Deals/DealsScreen.d.ts.map +1 -0
- package/dist/screens/Deals/DealsScreen.js +93 -0
- package/dist/screens/Deals/DealsScreen.js.map +1 -0
- package/dist/screens/Deals/deal-subject.d.ts +30 -0
- package/dist/screens/Deals/deal-subject.d.ts.map +1 -0
- package/dist/screens/Deals/deal-subject.js +57 -0
- package/dist/screens/Deals/deal-subject.js.map +1 -0
- package/dist/screens/EntryEditor/EntryDeals.d.ts +11 -0
- package/dist/screens/EntryEditor/EntryDeals.d.ts.map +1 -0
- package/dist/screens/EntryEditor/EntryDeals.js +45 -0
- package/dist/screens/EntryEditor/EntryDeals.js.map +1 -0
- package/dist/screens/EntryEditor/EntryEditorScreen.d.ts +3 -0
- package/dist/screens/EntryEditor/EntryEditorScreen.d.ts.map +1 -0
- package/dist/screens/EntryEditor/EntryEditorScreen.js +65 -0
- package/dist/screens/EntryEditor/EntryEditorScreen.js.map +1 -0
- package/dist/screens/EntryEditor/EntryForm.d.ts +22 -0
- package/dist/screens/EntryEditor/EntryForm.d.ts.map +1 -0
- package/dist/screens/EntryEditor/EntryForm.js +279 -0
- package/dist/screens/EntryEditor/EntryForm.js.map +1 -0
- package/dist/screens/EntryEditor/HistoryDialog.d.ts +16 -0
- package/dist/screens/EntryEditor/HistoryDialog.d.ts.map +1 -0
- package/dist/screens/EntryEditor/HistoryDialog.js +52 -0
- package/dist/screens/EntryEditor/HistoryDialog.js.map +1 -0
- package/dist/screens/EntryEditor/PagePane.d.ts +15 -0
- package/dist/screens/EntryEditor/PagePane.d.ts.map +1 -0
- package/dist/screens/EntryEditor/PagePane.js +25 -0
- package/dist/screens/EntryEditor/PagePane.js.map +1 -0
- package/dist/screens/EntryEditor/ScheduleDialog.d.ts +15 -0
- package/dist/screens/EntryEditor/ScheduleDialog.d.ts.map +1 -0
- package/dist/screens/EntryEditor/ScheduleDialog.js +70 -0
- package/dist/screens/EntryEditor/ScheduleDialog.js.map +1 -0
- package/dist/screens/Form/FormFields.d.ts +9 -0
- package/dist/screens/Form/FormFields.d.ts.map +1 -0
- package/dist/screens/Form/FormFields.js +26 -0
- package/dist/screens/Form/FormFields.js.map +1 -0
- package/dist/screens/Form/FormScreen.d.ts +3 -0
- package/dist/screens/Form/FormScreen.d.ts.map +1 -0
- package/dist/screens/Form/FormScreen.js +58 -0
- package/dist/screens/Form/FormScreen.js.map +1 -0
- package/dist/screens/Form/FormSettingsDialog.d.ts +8 -0
- package/dist/screens/Form/FormSettingsDialog.d.ts.map +1 -0
- package/dist/screens/Form/FormSettingsDialog.js +78 -0
- package/dist/screens/Form/FormSettingsDialog.js.map +1 -0
- package/dist/screens/Form/Submissions.d.ts +6 -0
- package/dist/screens/Form/Submissions.d.ts.map +1 -0
- package/dist/screens/Form/Submissions.js +98 -0
- package/dist/screens/Form/Submissions.js.map +1 -0
- package/dist/screens/Form/form-fields.d.ts +3 -0
- package/dist/screens/Form/form-fields.d.ts.map +1 -0
- package/dist/screens/Form/form-fields.js +9 -0
- package/dist/screens/Form/form-fields.js.map +1 -0
- package/dist/screens/Forms/FormsScreen.d.ts +3 -0
- package/dist/screens/Forms/FormsScreen.d.ts.map +1 -0
- package/dist/screens/Forms/FormsScreen.js +139 -0
- package/dist/screens/Forms/FormsScreen.js.map +1 -0
- package/dist/screens/Home/FollowUps.d.ts +8 -0
- package/dist/screens/Home/FollowUps.d.ts.map +1 -0
- package/dist/screens/Home/FollowUps.js +43 -0
- package/dist/screens/Home/FollowUps.js.map +1 -0
- package/dist/screens/Home/HomeScreen.d.ts +6 -0
- package/dist/screens/Home/HomeScreen.d.ts.map +1 -0
- package/dist/screens/Home/HomeScreen.js +67 -0
- package/dist/screens/Home/HomeScreen.js.map +1 -0
- package/dist/screens/Media/MediaScreen.d.ts +3 -0
- package/dist/screens/Media/MediaScreen.d.ts.map +1 -0
- package/dist/screens/Media/MediaScreen.js +71 -0
- package/dist/screens/Media/MediaScreen.js.map +1 -0
- package/dist/screens/People/PeopleScreen.d.ts +3 -0
- package/dist/screens/People/PeopleScreen.d.ts.map +1 -0
- package/dist/screens/People/PeopleScreen.js +78 -0
- package/dist/screens/People/PeopleScreen.js.map +1 -0
- package/dist/screens/PluginScreen/PluginScreenScreen.d.ts +3 -0
- package/dist/screens/PluginScreen/PluginScreenScreen.d.ts.map +1 -0
- package/dist/screens/PluginScreen/PluginScreenScreen.js +16 -0
- package/dist/screens/PluginScreen/PluginScreenScreen.js.map +1 -0
- package/dist/screens/Plugins/PluginActivityDialog.d.ts +7 -0
- package/dist/screens/Plugins/PluginActivityDialog.d.ts.map +1 -0
- package/dist/screens/Plugins/PluginActivityDialog.js +49 -0
- package/dist/screens/Plugins/PluginActivityDialog.js.map +1 -0
- package/dist/screens/Plugins/PluginSecrets.d.ts +7 -0
- package/dist/screens/Plugins/PluginSecrets.d.ts.map +1 -0
- package/dist/screens/Plugins/PluginSecrets.js +44 -0
- package/dist/screens/Plugins/PluginSecrets.js.map +1 -0
- package/dist/screens/Plugins/PluginSettingsDialog.d.ts +7 -0
- package/dist/screens/Plugins/PluginSettingsDialog.d.ts.map +1 -0
- package/dist/screens/Plugins/PluginSettingsDialog.js +46 -0
- package/dist/screens/Plugins/PluginSettingsDialog.js.map +1 -0
- package/dist/screens/Plugins/PluginsScreen.d.ts +3 -0
- package/dist/screens/Plugins/PluginsScreen.d.ts.map +1 -0
- package/dist/screens/Plugins/PluginsScreen.js +68 -0
- package/dist/screens/Plugins/PluginsScreen.js.map +1 -0
- package/dist/screens/SignIn/SignInScreen.d.ts +6 -0
- package/dist/screens/SignIn/SignInScreen.d.ts.map +1 -0
- package/dist/screens/SignIn/SignInScreen.js +52 -0
- package/dist/screens/SignIn/SignInScreen.js.map +1 -0
- package/dist/screens/Trash/TrashScreen.d.ts +3 -0
- package/dist/screens/Trash/TrashScreen.d.ts.map +1 -0
- package/dist/screens/Trash/TrashScreen.js +73 -0
- package/dist/screens/Trash/TrashScreen.js.map +1 -0
- package/dist/standalone/config.d.ts +19 -0
- package/dist/standalone/config.d.ts.map +1 -0
- package/dist/standalone/config.js +20 -0
- package/dist/standalone/config.js.map +1 -0
- package/dist/standalone/main.d.ts +7 -0
- package/dist/standalone/main.d.ts.map +1 -0
- package/dist/standalone/main.js +26 -0
- package/dist/standalone/main.js.map +1 -0
- package/dist/testing/admin-client-contract.d.ts +24 -0
- package/dist/testing/admin-client-contract.d.ts.map +1 -0
- package/dist/testing/admin-client-contract.js +571 -0
- package/dist/testing/admin-client-contract.js.map +1 -0
- package/dist/testing/http-server.d.ts +18 -0
- package/dist/testing/http-server.d.ts.map +1 -0
- package/dist/testing/http-server.js +51 -0
- package/dist/testing/http-server.js.map +1 -0
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +3 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/memory-client.d.ts +142 -0
- package/dist/testing/memory-client.d.ts.map +1 -0
- package/dist/testing/memory-client.js +401 -0
- package/dist/testing/memory-client.js.map +1 -0
- package/dist/testing/memory-people.d.ts +18 -0
- package/dist/testing/memory-people.d.ts.map +1 -0
- package/dist/testing/memory-people.js +70 -0
- package/dist/testing/memory-people.js.map +1 -0
- package/dist/testing/render-app.d.ts +8 -0
- package/dist/testing/render-app.d.ts.map +1 -0
- package/dist/testing/render-app.js +10 -0
- package/dist/testing/render-app.js.map +1 -0
- package/dist/testing/sample-content.d.ts +23 -0
- package/dist/testing/sample-content.d.ts.map +1 -0
- package/dist/testing/sample-content.js +225 -0
- package/dist/testing/sample-content.js.map +1 -0
- package/package.json +70 -3
|
@@ -0,0 +1,672 @@
|
|
|
1
|
+
import { MutationCache, QueryCache, QueryClient, useMutation, useQueries, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { AdminRequestError } from './errors.js';
|
|
3
|
+
import { useClient } from './client-context.js';
|
|
4
|
+
/**
|
|
5
|
+
* Every request the screens make, in one place, so each has one cache key and screens never
|
|
6
|
+
* call the client directly.
|
|
7
|
+
*/
|
|
8
|
+
const keys = {
|
|
9
|
+
session: ['session'],
|
|
10
|
+
contentTypes: ['content-types'],
|
|
11
|
+
archivedContentTypes: ['archived-content-types'],
|
|
12
|
+
fieldTypes: ['field-types'],
|
|
13
|
+
images: ['images'],
|
|
14
|
+
people: ['people'],
|
|
15
|
+
passkeys: ['passkeys'],
|
|
16
|
+
plugins: ['plugins'],
|
|
17
|
+
pluginEditors: ['plugin-editors'],
|
|
18
|
+
pluginSettings: (name) => ['plugins', name, 'settings'],
|
|
19
|
+
pluginTasks: (name) => ['plugins', name, 'tasks'],
|
|
20
|
+
/** Every list of entries starts with this, so one call marks them all out of date. */
|
|
21
|
+
entryLists: ['entries'],
|
|
22
|
+
trash: ['entries', 'trash'],
|
|
23
|
+
entries: (query) => ['entries', query],
|
|
24
|
+
entry: (id) => ['entry', id],
|
|
25
|
+
forms: ['forms'],
|
|
26
|
+
trashedForms: ['forms', 'trash'],
|
|
27
|
+
/** Everything about what forms were sent starts with this, so one call marks it all out of date. */
|
|
28
|
+
submissions: ['submissions'],
|
|
29
|
+
submissionList: (query) => ['submissions', 'list', query],
|
|
30
|
+
submissionCounts: (formId) => ['submissions', 'counts', formId],
|
|
31
|
+
/** Everything about contacts starts with this, so one call marks it all out of date. */
|
|
32
|
+
contacts: ['contacts'],
|
|
33
|
+
contactList: (query) => ['contacts', 'list', query],
|
|
34
|
+
contact: (id) => ['contacts', 'one', id],
|
|
35
|
+
contactTimeline: (id) => ['contacts', 'timeline', id],
|
|
36
|
+
pipeline: ['contacts', 'pipeline'],
|
|
37
|
+
customFields: ['contacts', 'custom-fields'],
|
|
38
|
+
/** Everything about deals starts with this. A change to contacts or the pipeline marks it out of date too. */
|
|
39
|
+
deals: ['contacts', 'deals'],
|
|
40
|
+
dealList: (query) => ['contacts', 'deals', 'list', query],
|
|
41
|
+
forecast: ['contacts', 'deals', 'forecast'],
|
|
42
|
+
team: ['team'],
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* The cache every request goes through, one per app. When the server answers any request with
|
|
46
|
+
* "sign in first" (the session ended, or was ended elsewhere), the app learns that nobody is
|
|
47
|
+
* signed in, and the frame shows the sign-in screen.
|
|
48
|
+
*/
|
|
49
|
+
export function createQueryCache() {
|
|
50
|
+
const signedOut = (error) => {
|
|
51
|
+
if (error instanceof AdminRequestError && error.code === 'unauthenticated')
|
|
52
|
+
client.setQueryData(keys.session, null);
|
|
53
|
+
};
|
|
54
|
+
const client = new QueryClient({
|
|
55
|
+
queryCache: new QueryCache({ onError: signedOut }),
|
|
56
|
+
mutationCache: new MutationCache({ onError: signedOut }),
|
|
57
|
+
defaultOptions: { queries: { retry: false, staleTime: 30_000 } },
|
|
58
|
+
});
|
|
59
|
+
return client;
|
|
60
|
+
}
|
|
61
|
+
export function useSession() {
|
|
62
|
+
const client = useClient();
|
|
63
|
+
return useQuery({ queryKey: keys.session, queryFn: () => client.getSession() });
|
|
64
|
+
}
|
|
65
|
+
export function useContentTypes() {
|
|
66
|
+
const client = useClient();
|
|
67
|
+
return useQuery({ queryKey: keys.contentTypes, queryFn: () => client.listContentTypes() });
|
|
68
|
+
}
|
|
69
|
+
/** What every change to a content type does afterwards: show the new version everywhere, without asking again. */
|
|
70
|
+
function useTypeChanged() {
|
|
71
|
+
const cache = useQueryClient();
|
|
72
|
+
return (type) => {
|
|
73
|
+
cache.setQueryData(keys.contentTypes, (types) => types ? [...types.filter((existing) => existing.id !== type.id), type].sort((a, b) => a.key.localeCompare(b.key)) : types);
|
|
74
|
+
// A list of entries shows a type's fields as columns.
|
|
75
|
+
void cache.invalidateQueries({ queryKey: keys.entryLists });
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export function useCreateContentType() {
|
|
79
|
+
const client = useClient();
|
|
80
|
+
return useMutation({ mutationFn: (type) => client.createContentType(type), onSuccess: useTypeChanged() });
|
|
81
|
+
}
|
|
82
|
+
/** The archived content types. Asked for only where they are shown. */
|
|
83
|
+
export function useArchivedContentTypes() {
|
|
84
|
+
const client = useClient();
|
|
85
|
+
return useQuery({ queryKey: keys.archivedContentTypes, queryFn: () => client.listArchivedContentTypes() });
|
|
86
|
+
}
|
|
87
|
+
/** What archiving and restoring do afterwards: the type moves between the two lists, and its entries with it. */
|
|
88
|
+
function useTypeMoved() {
|
|
89
|
+
const cache = useQueryClient();
|
|
90
|
+
return () => {
|
|
91
|
+
void cache.invalidateQueries({ queryKey: keys.contentTypes });
|
|
92
|
+
void cache.invalidateQueries({ queryKey: keys.archivedContentTypes });
|
|
93
|
+
void cache.invalidateQueries({ queryKey: keys.entryLists });
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export function useArchiveContentType() {
|
|
97
|
+
const client = useClient();
|
|
98
|
+
return useMutation({ mutationFn: (id) => client.archiveContentType(id), onSuccess: useTypeMoved() });
|
|
99
|
+
}
|
|
100
|
+
export function useRestoreContentType() {
|
|
101
|
+
const client = useClient();
|
|
102
|
+
return useMutation({ mutationFn: (id) => client.restoreContentType(id), onSuccess: useTypeMoved() });
|
|
103
|
+
}
|
|
104
|
+
export function useUpdateContentType() {
|
|
105
|
+
const client = useClient();
|
|
106
|
+
return useMutation({
|
|
107
|
+
mutationFn: ({ id, changes }) => client.updateContentType(id, changes),
|
|
108
|
+
onSuccess: useTypeChanged(),
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
export function useAddField() {
|
|
112
|
+
const client = useClient();
|
|
113
|
+
return useMutation({
|
|
114
|
+
mutationFn: ({ typeId, field, within }) => client.addField(typeId, field, within),
|
|
115
|
+
onSuccess: useTypeChanged(),
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/** Changes a field and, when `arrangement` says so, where it is shown: one action to the person. */
|
|
119
|
+
export function useChangeField() {
|
|
120
|
+
const client = useClient();
|
|
121
|
+
return useMutation({
|
|
122
|
+
mutationFn: async ({ typeId, fieldId, changes, arrangement, within }) => {
|
|
123
|
+
const changed = await client.changeField(typeId, fieldId, changes, within);
|
|
124
|
+
return arrangement ? client.arrangeFields(typeId, arrangement) : changed;
|
|
125
|
+
},
|
|
126
|
+
onSuccess: useTypeChanged(),
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
export function useRemoveField() {
|
|
130
|
+
const client = useClient();
|
|
131
|
+
return useMutation({
|
|
132
|
+
mutationFn: ({ typeId, fieldId, within }) => client.removeField(typeId, fieldId, within),
|
|
133
|
+
onSuccess: useTypeChanged(),
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
export function useRestoreField() {
|
|
137
|
+
const client = useClient();
|
|
138
|
+
return useMutation({
|
|
139
|
+
mutationFn: ({ typeId, fieldId, within }) => client.restoreField(typeId, fieldId, within),
|
|
140
|
+
onSuccess: useTypeChanged(),
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
export function useSetSections() {
|
|
144
|
+
const client = useClient();
|
|
145
|
+
return useMutation({
|
|
146
|
+
mutationFn: ({ typeId, sections }) => client.setSections(typeId, sections),
|
|
147
|
+
onSuccess: useTypeChanged(),
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
export function useArrangeFields() {
|
|
151
|
+
const client = useClient();
|
|
152
|
+
return useMutation({
|
|
153
|
+
mutationFn: ({ typeId, arrangement }) => client.arrangeFields(typeId, arrangement),
|
|
154
|
+
onSuccess: useTypeChanged(),
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
export function useEntries(query) {
|
|
158
|
+
const client = useClient();
|
|
159
|
+
return useQuery({ queryKey: keys.entries(query), queryFn: () => client.listEntries(query) });
|
|
160
|
+
}
|
|
161
|
+
/** The entries of several content types at once, one request each, sharing the lists' cache. */
|
|
162
|
+
export function useEntriesOfTypes(queries) {
|
|
163
|
+
const client = useClient();
|
|
164
|
+
return useQueries({
|
|
165
|
+
queries: queries.map((query) => ({ queryKey: keys.entries(query), queryFn: () => client.listEntries(query) })),
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
/** Field types change only when the site is redeployed, so they are fetched once. */
|
|
169
|
+
export function useFieldTypes() {
|
|
170
|
+
const client = useClient();
|
|
171
|
+
return useQuery({ queryKey: keys.fieldTypes, queryFn: () => client.listFieldTypes(), staleTime: Infinity });
|
|
172
|
+
}
|
|
173
|
+
/** The site's images change only when someone here uploads one, so they are fetched once. */
|
|
174
|
+
export function useImages() {
|
|
175
|
+
const client = useClient();
|
|
176
|
+
return useQuery({ queryKey: keys.images, queryFn: () => client.listImages(), staleTime: Infinity, select: (list) => list.items });
|
|
177
|
+
}
|
|
178
|
+
/** Whether the site takes uploads, and how large one may be. `null` when it takes none. */
|
|
179
|
+
export function useUploadRules() {
|
|
180
|
+
const client = useClient();
|
|
181
|
+
return useQuery({ queryKey: keys.images, queryFn: () => client.listImages(), staleTime: Infinity, select: (list) => list.upload });
|
|
182
|
+
}
|
|
183
|
+
/** Adds an image, which then shows among the others without asking the server again. */
|
|
184
|
+
export function useRemoveImage() {
|
|
185
|
+
const client = useClient();
|
|
186
|
+
const cache = useQueryClient();
|
|
187
|
+
return useMutation({
|
|
188
|
+
mutationFn: (name) => client.removeImage(name),
|
|
189
|
+
onSuccess: (_nothing, name) => {
|
|
190
|
+
cache.setQueryData(keys.images, (list) => (list ? { ...list, items: list.items.filter((image) => image.name !== name) } : list));
|
|
191
|
+
},
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
export function useUploadImage() {
|
|
195
|
+
const client = useClient();
|
|
196
|
+
const cache = useQueryClient();
|
|
197
|
+
return useMutation({
|
|
198
|
+
mutationFn: (upload) => client.uploadImage(upload),
|
|
199
|
+
onSuccess: (image) => {
|
|
200
|
+
cache.setQueryData(keys.images, (list) => list ? { ...list, items: [...list.items, image].sort((a, b) => a.name.localeCompare(b.name)) } : list);
|
|
201
|
+
},
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
/** One entry. Not fetched while `id` is `null`, which is how a new entry's screen asks. */
|
|
205
|
+
export function useEntry(id) {
|
|
206
|
+
const client = useClient();
|
|
207
|
+
return useQuery({
|
|
208
|
+
queryKey: keys.entry(id ?? ''),
|
|
209
|
+
queryFn: () => client.getEntry(id ?? ''),
|
|
210
|
+
enabled: id !== null,
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
/** What every change to an entry does afterwards: show the new version and refresh the lists. */
|
|
214
|
+
function useEntryChanged() {
|
|
215
|
+
const cache = useQueryClient();
|
|
216
|
+
return (entry) => {
|
|
217
|
+
cache.setQueryData(keys.entry(entry.id), entry);
|
|
218
|
+
void cache.invalidateQueries({ queryKey: keys.entryLists });
|
|
219
|
+
// Every change is a new line in the entry's history.
|
|
220
|
+
void cache.invalidateQueries({ queryKey: [...keys.entry(entry.id), 'history'] });
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
export function useCreateEntry() {
|
|
224
|
+
const client = useClient();
|
|
225
|
+
return useMutation({ mutationFn: (entry) => client.createEntry(entry), onSuccess: useEntryChanged() });
|
|
226
|
+
}
|
|
227
|
+
export function useUpdateEntry() {
|
|
228
|
+
const client = useClient();
|
|
229
|
+
return useMutation({
|
|
230
|
+
mutationFn: ({ id, changes }) => client.updateEntry(id, changes),
|
|
231
|
+
onSuccess: useEntryChanged(),
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
export function usePublishEntry() {
|
|
235
|
+
const client = useClient();
|
|
236
|
+
return useMutation({
|
|
237
|
+
mutationFn: ({ id, expectedRevision }) => client.publishEntry(id, expectedRevision),
|
|
238
|
+
onSuccess: useEntryChanged(),
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
export function useUnpublishEntry() {
|
|
242
|
+
const client = useClient();
|
|
243
|
+
return useMutation({ mutationFn: (id) => client.unpublishEntry(id), onSuccess: useEntryChanged() });
|
|
244
|
+
}
|
|
245
|
+
/** Asks for a link each time: a link runs out, so it is never kept. */
|
|
246
|
+
/** The entries in the trash. Kept with the lists, so whatever changes an entry refreshes it. */
|
|
247
|
+
export function useTrash() {
|
|
248
|
+
const client = useClient();
|
|
249
|
+
return useQuery({ queryKey: keys.trash, queryFn: () => client.listTrash({ limit: 200 }) });
|
|
250
|
+
}
|
|
251
|
+
export function useDuplicateEntry() {
|
|
252
|
+
const client = useClient();
|
|
253
|
+
return useMutation({ mutationFn: (id) => client.duplicateEntry(id), onSuccess: useEntryChanged() });
|
|
254
|
+
}
|
|
255
|
+
export function useScheduleEntry() {
|
|
256
|
+
const client = useClient();
|
|
257
|
+
return useMutation({
|
|
258
|
+
mutationFn: ({ id, ...input }) => client.scheduleEntry(id, input),
|
|
259
|
+
onSuccess: useEntryChanged(),
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
export function useUnscheduleEntry() {
|
|
263
|
+
const client = useClient();
|
|
264
|
+
return useMutation({ mutationFn: (id) => client.unscheduleEntry(id), onSuccess: useEntryChanged() });
|
|
265
|
+
}
|
|
266
|
+
/** Every save of an entry, the latest first. Asked for only once someone opens its history. */
|
|
267
|
+
export function useEntryHistory(id, isAsked = true) {
|
|
268
|
+
const client = useClient();
|
|
269
|
+
return useQuery({ queryKey: [...keys.entry(id), 'history'], queryFn: () => client.entryHistory(id), enabled: isAsked });
|
|
270
|
+
}
|
|
271
|
+
export function useRevertEntry() {
|
|
272
|
+
const client = useClient();
|
|
273
|
+
return useMutation({
|
|
274
|
+
mutationFn: ({ id, ...input }) => client.revertEntry(id, input),
|
|
275
|
+
onSuccess: useEntryChanged(),
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
export function useTrashEntry() {
|
|
279
|
+
const client = useClient();
|
|
280
|
+
return useMutation({ mutationFn: (id) => client.trashEntry(id), onSuccess: useEntryChanged() });
|
|
281
|
+
}
|
|
282
|
+
export function useRestoreEntry() {
|
|
283
|
+
const client = useClient();
|
|
284
|
+
return useMutation({ mutationFn: (id) => client.restoreEntry(id), onSuccess: useEntryChanged() });
|
|
285
|
+
}
|
|
286
|
+
export function useDeleteEntry() {
|
|
287
|
+
const client = useClient();
|
|
288
|
+
const cache = useQueryClient();
|
|
289
|
+
return useMutation({
|
|
290
|
+
mutationFn: (id) => client.deleteEntry(id),
|
|
291
|
+
onSuccess: (_, id) => {
|
|
292
|
+
cache.removeQueries({ queryKey: keys.entry(id) });
|
|
293
|
+
void cache.invalidateQueries({ queryKey: keys.entryLists });
|
|
294
|
+
},
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
export function useForms() {
|
|
298
|
+
const client = useClient();
|
|
299
|
+
return useQuery({ queryKey: keys.forms, queryFn: () => client.listForms() });
|
|
300
|
+
}
|
|
301
|
+
/** The forms in the trash. Asked for only where they are shown. */
|
|
302
|
+
export function useTrashedForms(isAsked = true) {
|
|
303
|
+
const client = useClient();
|
|
304
|
+
return useQuery({ queryKey: keys.trashedForms, queryFn: () => client.listTrashedForms(), enabled: isAsked });
|
|
305
|
+
}
|
|
306
|
+
/** What every change to a form does afterwards: show the new version everywhere, without asking again. */
|
|
307
|
+
function useFormChanged() {
|
|
308
|
+
const cache = useQueryClient();
|
|
309
|
+
return (form) => {
|
|
310
|
+
cache.setQueryData(keys.forms, (forms) => forms ? [...forms.filter((existing) => existing.id !== form.id), form].sort((a, b) => a.key.localeCompare(b.key)) : forms);
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
/** What moving a form to the trash, out of it or away for good does afterwards. */
|
|
314
|
+
function useFormMoved() {
|
|
315
|
+
const cache = useQueryClient();
|
|
316
|
+
return () => {
|
|
317
|
+
void cache.invalidateQueries({ queryKey: keys.forms });
|
|
318
|
+
void cache.invalidateQueries({ queryKey: keys.submissions });
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
export function useCreateForm() {
|
|
322
|
+
const client = useClient();
|
|
323
|
+
return useMutation({ mutationFn: (form) => client.createForm(form), onSuccess: useFormChanged() });
|
|
324
|
+
}
|
|
325
|
+
export function useUpdateForm() {
|
|
326
|
+
const client = useClient();
|
|
327
|
+
return useMutation({ mutationFn: ({ id, changes }) => client.updateForm(id, changes), onSuccess: useFormChanged() });
|
|
328
|
+
}
|
|
329
|
+
export function useTrashForm() {
|
|
330
|
+
const client = useClient();
|
|
331
|
+
return useMutation({ mutationFn: (id) => client.trashForm(id), onSuccess: useFormMoved() });
|
|
332
|
+
}
|
|
333
|
+
export function useRestoreForm() {
|
|
334
|
+
const client = useClient();
|
|
335
|
+
return useMutation({ mutationFn: (id) => client.restoreForm(id), onSuccess: useFormMoved() });
|
|
336
|
+
}
|
|
337
|
+
export function useDeleteForm() {
|
|
338
|
+
const client = useClient();
|
|
339
|
+
return useMutation({ mutationFn: (id) => client.deleteForm(id), onSuccess: useFormMoved() });
|
|
340
|
+
}
|
|
341
|
+
/** What a form was sent. `isAsked` is false for someone who may not read submissions. */
|
|
342
|
+
export function useSubmissions(query, isAsked = true) {
|
|
343
|
+
const client = useClient();
|
|
344
|
+
return useQuery({ queryKey: keys.submissionList(query), queryFn: () => client.listSubmissions(query), enabled: isAsked });
|
|
345
|
+
}
|
|
346
|
+
export function useSubmissionCounts(formId, isAsked = true) {
|
|
347
|
+
const client = useClient();
|
|
348
|
+
return useQuery({ queryKey: keys.submissionCounts(formId), queryFn: () => client.countSubmissions(formId), enabled: isAsked });
|
|
349
|
+
}
|
|
350
|
+
/** The counts of several forms at once, in the order asked, for a list of forms. */
|
|
351
|
+
export function useSubmissionCountsOf(formIds, isAsked = true) {
|
|
352
|
+
const client = useClient();
|
|
353
|
+
return useQueries({ queries: formIds.map((formId) => ({ queryKey: keys.submissionCounts(formId), queryFn: () => client.countSubmissions(formId), enabled: isAsked })) });
|
|
354
|
+
}
|
|
355
|
+
/** What every change to a submission does afterwards: the lists and the counts are asked for again. */
|
|
356
|
+
function useSubmissionsChanged() {
|
|
357
|
+
const cache = useQueryClient();
|
|
358
|
+
return () => void cache.invalidateQueries({ queryKey: keys.submissions });
|
|
359
|
+
}
|
|
360
|
+
export function useMarkSubmission() {
|
|
361
|
+
const client = useClient();
|
|
362
|
+
return useMutation({ mutationFn: ({ id, status }) => client.markSubmission(id, status), onSuccess: useSubmissionsChanged() });
|
|
363
|
+
}
|
|
364
|
+
export function useDeleteSubmission() {
|
|
365
|
+
const client = useClient();
|
|
366
|
+
return useMutation({ mutationFn: (id) => client.deleteSubmission(id), onSuccess: useSubmissionsChanged() });
|
|
367
|
+
}
|
|
368
|
+
/** Asks for the file each time it is wanted: it is never kept. */
|
|
369
|
+
export function useExportSubmissions() {
|
|
370
|
+
const client = useClient();
|
|
371
|
+
return useMutation({ mutationFn: (formId) => client.exportSubmissions(formId) });
|
|
372
|
+
}
|
|
373
|
+
export function useForgetSender() {
|
|
374
|
+
const client = useClient();
|
|
375
|
+
const cache = useQueryClient();
|
|
376
|
+
const changed = useSubmissionsChanged();
|
|
377
|
+
return useMutation({
|
|
378
|
+
mutationFn: (email) => client.forgetSender(email),
|
|
379
|
+
onSuccess: () => {
|
|
380
|
+
changed();
|
|
381
|
+
// Their contact went with what they sent.
|
|
382
|
+
void cache.invalidateQueries({ queryKey: keys.contacts });
|
|
383
|
+
},
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
/** The people who wrote to the site. What was on screen stays while the next search is on its way. */
|
|
387
|
+
export function useContacts(query = {}) {
|
|
388
|
+
const client = useClient();
|
|
389
|
+
return useQuery({ queryKey: keys.contactList(query), queryFn: () => client.listContacts(query), placeholderData: (previous) => previous });
|
|
390
|
+
}
|
|
391
|
+
/** One list of contacts per query, asked for together: the columns of the board. */
|
|
392
|
+
export function useContactLists(queries) {
|
|
393
|
+
const client = useClient();
|
|
394
|
+
return useQueries({
|
|
395
|
+
queries: queries.map((query) => ({ queryKey: keys.contactList(query), queryFn: () => client.listContacts(query), placeholderData: (previous) => previous })),
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Puts a contact in another stage. It stays pending until the lists have been asked for again,
|
|
400
|
+
* so the board can show the card where it was put for as long as the lists still say otherwise.
|
|
401
|
+
*/
|
|
402
|
+
export function useMoveContact() {
|
|
403
|
+
const client = useClient();
|
|
404
|
+
const cache = useQueryClient();
|
|
405
|
+
return useMutation({
|
|
406
|
+
mutationFn: ({ contact, stage }) => client.updateContact(contact.id, { stage, expectedRevision: contact.revision }),
|
|
407
|
+
onSettled: () => cache.invalidateQueries({ queryKey: keys.contacts }),
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
export function useDeals(query = {}) {
|
|
411
|
+
const client = useClient();
|
|
412
|
+
return useQuery({ queryKey: keys.dealList(query), queryFn: () => client.listDeals(query), placeholderData: (previous) => previous });
|
|
413
|
+
}
|
|
414
|
+
/** One list of deals per query, asked for together: the columns of the board. */
|
|
415
|
+
export function useDealLists(queries) {
|
|
416
|
+
const client = useClient();
|
|
417
|
+
return useQueries({ queries: queries.map((query) => ({ queryKey: keys.dealList(query), queryFn: () => client.listDeals(query) })) });
|
|
418
|
+
}
|
|
419
|
+
export function useForecast() {
|
|
420
|
+
const client = useClient();
|
|
421
|
+
return useQuery({ queryKey: keys.forecast, queryFn: () => client.getForecast() });
|
|
422
|
+
}
|
|
423
|
+
/** What every change to a deal does afterwards. It is awaited, so a change stays pending until the lists are fresh. */
|
|
424
|
+
function useDealsChanged() {
|
|
425
|
+
const cache = useQueryClient();
|
|
426
|
+
return () => cache.invalidateQueries({ queryKey: keys.deals });
|
|
427
|
+
}
|
|
428
|
+
export function useCreateDeal() {
|
|
429
|
+
const client = useClient();
|
|
430
|
+
return useMutation({ mutationFn: (input) => client.createDeal(input), onSettled: useDealsChanged() });
|
|
431
|
+
}
|
|
432
|
+
export function useUpdateDeal() {
|
|
433
|
+
const client = useClient();
|
|
434
|
+
return useMutation({ mutationFn: ({ id, changes }) => client.updateDeal(id, changes), onSettled: useDealsChanged() });
|
|
435
|
+
}
|
|
436
|
+
export function useDeleteDeal() {
|
|
437
|
+
const client = useClient();
|
|
438
|
+
return useMutation({ mutationFn: (id) => client.deleteDeal(id), onSettled: useDealsChanged() });
|
|
439
|
+
}
|
|
440
|
+
/** The stages a contact moves through. */
|
|
441
|
+
export function usePipeline() {
|
|
442
|
+
const client = useClient();
|
|
443
|
+
return useQuery({ queryKey: keys.pipeline, queryFn: () => client.getPipeline() });
|
|
444
|
+
}
|
|
445
|
+
export function useSavePipeline() {
|
|
446
|
+
const client = useClient();
|
|
447
|
+
return useMutation({ mutationFn: (changes) => client.savePipeline(changes), onSuccess: useContactsChanged() });
|
|
448
|
+
}
|
|
449
|
+
/** The fields this site adds to its contacts and deals. */
|
|
450
|
+
export function useCustomFields() {
|
|
451
|
+
const client = useClient();
|
|
452
|
+
return useQuery({ queryKey: keys.customFields, queryFn: () => client.getCustomFields() });
|
|
453
|
+
}
|
|
454
|
+
export function useSaveCustomFields() {
|
|
455
|
+
const client = useClient();
|
|
456
|
+
const cache = useQueryClient();
|
|
457
|
+
return useMutation({ mutationFn: (changes) => client.saveCustomFields(changes), onSuccess: (saved) => cache.setQueryData(keys.customFields, saved) });
|
|
458
|
+
}
|
|
459
|
+
/** Who a contact can be given to. */
|
|
460
|
+
export function useTeam() {
|
|
461
|
+
const client = useClient();
|
|
462
|
+
return useQuery({ queryKey: keys.team, queryFn: () => client.listTeam() });
|
|
463
|
+
}
|
|
464
|
+
export function useContact(id) {
|
|
465
|
+
const client = useClient();
|
|
466
|
+
return useQuery({ queryKey: keys.contact(id), queryFn: () => client.getContact(id) });
|
|
467
|
+
}
|
|
468
|
+
export function useContactTimeline(id) {
|
|
469
|
+
const client = useClient();
|
|
470
|
+
return useQuery({ queryKey: keys.contactTimeline(id), queryFn: () => client.contactTimeline(id) });
|
|
471
|
+
}
|
|
472
|
+
/** What every change to a contact does afterwards: the lists, the contact and its timeline are asked for again. */
|
|
473
|
+
function useContactsChanged() {
|
|
474
|
+
const cache = useQueryClient();
|
|
475
|
+
return () => void cache.invalidateQueries({ queryKey: keys.contacts });
|
|
476
|
+
}
|
|
477
|
+
export function useCreateContact() {
|
|
478
|
+
const client = useClient();
|
|
479
|
+
return useMutation({ mutationFn: (input) => client.createContact(input), onSuccess: useContactsChanged() });
|
|
480
|
+
}
|
|
481
|
+
/** How many rows of a file go in one request: few enough that each is answered soon. */
|
|
482
|
+
const IMPORT_PART = 50;
|
|
483
|
+
/**
|
|
484
|
+
* Adds the contacts of a file, a part at a time, and answers with what became of all its rows.
|
|
485
|
+
* A problem is given by the row's place in the whole file. If a part fails, the parts before it
|
|
486
|
+
* are in, and the lists are read again all the same.
|
|
487
|
+
*/
|
|
488
|
+
export function useImportContacts() {
|
|
489
|
+
const client = useClient();
|
|
490
|
+
const changed = useContactsChanged();
|
|
491
|
+
return useMutation({
|
|
492
|
+
mutationFn: async (rows) => {
|
|
493
|
+
const whole = { added: 0, filled: 0, unchanged: 0, problems: [] };
|
|
494
|
+
for (let start = 0; start < rows.length; start += IMPORT_PART) {
|
|
495
|
+
const part = await client.importContacts(rows.slice(start, start + IMPORT_PART));
|
|
496
|
+
whole.added += part.added;
|
|
497
|
+
whole.filled += part.filled;
|
|
498
|
+
whole.unchanged += part.unchanged;
|
|
499
|
+
whole.problems.push(...part.problems.map((problem) => ({ ...problem, row: problem.row + start })));
|
|
500
|
+
}
|
|
501
|
+
return whole;
|
|
502
|
+
},
|
|
503
|
+
onSettled: changed,
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
export function useUpdateContact() {
|
|
507
|
+
const client = useClient();
|
|
508
|
+
return useMutation({ mutationFn: ({ id, changes }) => client.updateContact(id, changes), onSuccess: useContactsChanged() });
|
|
509
|
+
}
|
|
510
|
+
export function useEraseContact() {
|
|
511
|
+
const client = useClient();
|
|
512
|
+
const cache = useQueryClient();
|
|
513
|
+
return useMutation({
|
|
514
|
+
mutationFn: (id) => client.eraseContact(id),
|
|
515
|
+
onSuccess: (_, id) => {
|
|
516
|
+
cache.removeQueries({ queryKey: keys.contact(id) });
|
|
517
|
+
cache.removeQueries({ queryKey: keys.contactTimeline(id) });
|
|
518
|
+
void cache.invalidateQueries({ queryKey: keys.contactList({}).slice(0, 2) });
|
|
519
|
+
// What they sent went with them.
|
|
520
|
+
void cache.invalidateQueries({ queryKey: keys.submissions });
|
|
521
|
+
},
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
export function useAddContactNote() {
|
|
525
|
+
const client = useClient();
|
|
526
|
+
return useMutation({ mutationFn: ({ id, text }) => client.addContactNote(id, text), onSuccess: useContactsChanged() });
|
|
527
|
+
}
|
|
528
|
+
export function useDeleteContactNote() {
|
|
529
|
+
const client = useClient();
|
|
530
|
+
return useMutation({ mutationFn: ({ id, noteId }) => client.deleteContactNote(id, noteId), onSuccess: useContactsChanged() });
|
|
531
|
+
}
|
|
532
|
+
/** Asks for the file each time it is wanted: it is never kept. */
|
|
533
|
+
export function useExportContact() {
|
|
534
|
+
const client = useClient();
|
|
535
|
+
return useMutation({ mutationFn: (id) => client.exportContact(id) });
|
|
536
|
+
}
|
|
537
|
+
export function usePreviewEntry() {
|
|
538
|
+
const client = useClient();
|
|
539
|
+
return useMutation({ mutationFn: (id) => client.previewEntry(id) });
|
|
540
|
+
}
|
|
541
|
+
/** How long a link for the page beside the form is used before a new one is asked for. A link lasts an hour. */
|
|
542
|
+
const PREVIEW_REFRESH = 30 * 60_000;
|
|
543
|
+
/**
|
|
544
|
+
* A link to the entry's page for the frame beside its form, asked for again well before it runs
|
|
545
|
+
* out. `saved` is the entry's revision: a save may have changed the page's address.
|
|
546
|
+
*/
|
|
547
|
+
export function usePagePreview(id, saved) {
|
|
548
|
+
const client = useClient();
|
|
549
|
+
return useQuery({
|
|
550
|
+
queryKey: ['page-preview', id, saved],
|
|
551
|
+
queryFn: () => client.previewEntry(id ?? ''),
|
|
552
|
+
enabled: id !== undefined,
|
|
553
|
+
staleTime: PREVIEW_REFRESH,
|
|
554
|
+
refetchInterval: PREVIEW_REFRESH,
|
|
555
|
+
retry: false,
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
export function usePeople() {
|
|
559
|
+
const client = useClient();
|
|
560
|
+
return useQuery({ queryKey: keys.people, queryFn: () => client.listPeople() });
|
|
561
|
+
}
|
|
562
|
+
/** What every change to who can sign in does afterwards: read the list again. */
|
|
563
|
+
function usePeopleChanged() {
|
|
564
|
+
const cache = useQueryClient();
|
|
565
|
+
return () => void cache.invalidateQueries({ queryKey: keys.people });
|
|
566
|
+
}
|
|
567
|
+
export function useInvitePerson() {
|
|
568
|
+
const client = useClient();
|
|
569
|
+
return useMutation({ mutationFn: (person) => client.invitePerson(person), onSuccess: usePeopleChanged() });
|
|
570
|
+
}
|
|
571
|
+
export function useChangePersonRole() {
|
|
572
|
+
const client = useClient();
|
|
573
|
+
return useMutation({ mutationFn: ({ id, role }) => client.changePersonRole(id, role), onSuccess: usePeopleChanged() });
|
|
574
|
+
}
|
|
575
|
+
export function useRemovePerson() {
|
|
576
|
+
const client = useClient();
|
|
577
|
+
return useMutation({ mutationFn: (id) => client.removePerson(id), onSuccess: usePeopleChanged() });
|
|
578
|
+
}
|
|
579
|
+
export function usePlugins() {
|
|
580
|
+
const client = useClient();
|
|
581
|
+
return useQuery({ queryKey: keys.plugins, queryFn: () => client.listPlugins() });
|
|
582
|
+
}
|
|
583
|
+
/** The running plugins that add to the editor. Asked once someone is signed in. */
|
|
584
|
+
export function usePluginEditorList(isSignedIn) {
|
|
585
|
+
const client = useClient();
|
|
586
|
+
return useQuery({ queryKey: keys.pluginEditors, queryFn: () => client.listPluginEditors(), enabled: isSignedIn });
|
|
587
|
+
}
|
|
588
|
+
export function useSetPluginEnabled() {
|
|
589
|
+
const client = useClient();
|
|
590
|
+
const cache = useQueryClient();
|
|
591
|
+
return useMutation({
|
|
592
|
+
mutationFn: ({ name, enabled }) => client.setPluginEnabled(name, enabled),
|
|
593
|
+
// A plugin switched on can bring field types and checks with it, so what was read before may be out of date.
|
|
594
|
+
onSuccess: () => void cache.invalidateQueries(),
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
export function usePluginSettings(name) {
|
|
598
|
+
const client = useClient();
|
|
599
|
+
return useQuery({ queryKey: keys.pluginSettings(name), queryFn: () => client.getPluginSettings(name) });
|
|
600
|
+
}
|
|
601
|
+
export function useSavePluginSettings(name) {
|
|
602
|
+
const client = useClient();
|
|
603
|
+
const cache = useQueryClient();
|
|
604
|
+
return useMutation({
|
|
605
|
+
mutationFn: (values) => client.savePluginSettings(name, values),
|
|
606
|
+
onSuccess: (saved) => cache.setQueryData(keys.pluginSettings(name), saved),
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
/** Saves or removes one of a plugin's keys or passwords. */
|
|
610
|
+
export function useSetPluginSecret(name) {
|
|
611
|
+
const client = useClient();
|
|
612
|
+
const cache = useQueryClient();
|
|
613
|
+
return useMutation({
|
|
614
|
+
mutationFn: ({ key, value }) => client.setPluginSecret(name, key, value),
|
|
615
|
+
onSuccess: (saved) => cache.setQueryData(keys.pluginSettings(name), saved),
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
/** What a plugin was asked to do, newest first. Asked for each time it is looked at: it changes by itself. */
|
|
619
|
+
export function usePluginTasks(name, enabled) {
|
|
620
|
+
const client = useClient();
|
|
621
|
+
return useQuery({ queryKey: keys.pluginTasks(name), queryFn: () => client.listPluginTasks(name), enabled, refetchOnMount: 'always' });
|
|
622
|
+
}
|
|
623
|
+
export function useRetryPluginTask(name) {
|
|
624
|
+
const client = useClient();
|
|
625
|
+
const cache = useQueryClient();
|
|
626
|
+
return useMutation({
|
|
627
|
+
mutationFn: (id) => client.retryPluginTask(name, id),
|
|
628
|
+
onSettled: () => cache.invalidateQueries({ queryKey: keys.pluginTasks(name) }),
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
/** The signed-in person's own passkeys. Asked for only while their window is open. */
|
|
632
|
+
export function usePasskeys() {
|
|
633
|
+
const client = useClient();
|
|
634
|
+
return useQuery({ queryKey: keys.passkeys, queryFn: () => client.listPasskeys() });
|
|
635
|
+
}
|
|
636
|
+
function usePasskeysChanged() {
|
|
637
|
+
const cache = useQueryClient();
|
|
638
|
+
return () => void cache.invalidateQueries({ queryKey: keys.passkeys });
|
|
639
|
+
}
|
|
640
|
+
export function useAddPasskey() {
|
|
641
|
+
const client = useClient();
|
|
642
|
+
return useMutation({ mutationFn: (name) => client.addPasskey(name), onSuccess: usePasskeysChanged() });
|
|
643
|
+
}
|
|
644
|
+
export function useRemovePasskey() {
|
|
645
|
+
const client = useClient();
|
|
646
|
+
return useMutation({ mutationFn: (id) => client.removePasskey(id), onSuccess: usePasskeysChanged() });
|
|
647
|
+
}
|
|
648
|
+
export function useRequestSignInLink() {
|
|
649
|
+
const client = useClient();
|
|
650
|
+
return useMutation({ mutationFn: (email) => client.requestSignInLink(email) });
|
|
651
|
+
}
|
|
652
|
+
export function useSignInWithPasskey() {
|
|
653
|
+
const client = useClient();
|
|
654
|
+
const cache = useQueryClient();
|
|
655
|
+
return useMutation({
|
|
656
|
+
mutationFn: () => client.signInWithPasskey(),
|
|
657
|
+
onSuccess: (user) => cache.setQueryData(keys.session, user),
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
export function useSignOut() {
|
|
661
|
+
const client = useClient();
|
|
662
|
+
const cache = useQueryClient();
|
|
663
|
+
return useMutation({
|
|
664
|
+
mutationFn: () => client.signOut(),
|
|
665
|
+
// Nothing the last person loaded may be shown to the next.
|
|
666
|
+
onSuccess: () => {
|
|
667
|
+
cache.clear();
|
|
668
|
+
cache.setQueryData(keys.session, null);
|
|
669
|
+
},
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
//# sourceMappingURL=queries.js.map
|