@sanity/assist 1.2.15-lang.7 → 1.2.15-lang.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -3
- package/dist/index.esm.js +166 -66
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +166 -66
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/assistInspector/AssistInspector.tsx +6 -0
- package/src/assistInspector/helpers.ts +3 -3
- package/src/coverage/.tmp/coverage-0.json +1 -0
- package/src/coverage/base.css +224 -0
- package/src/coverage/block-navigation.js +87 -0
- package/src/coverage/clover.xml +8613 -0
- package/src/coverage/coverage-final.json +107 -0
- package/src/coverage/favicon.png +0 -0
- package/src/coverage/index.html +461 -0
- package/src/coverage/lcov-report/base.css +224 -0
- package/src/coverage/lcov-report/block-navigation.js +87 -0
- package/src/coverage/lcov-report/favicon.png +0 -0
- package/src/coverage/lcov-report/index.html +461 -0
- package/src/coverage/lcov-report/prettify.css +1 -0
- package/src/coverage/lcov-report/prettify.js +2 -0
- package/src/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/src/coverage/lcov-report/sorter.js +196 -0
- package/src/coverage/lcov-report/src/_lib/connector/ConnectFromRegion.tsx.html +157 -0
- package/src/coverage/lcov-report/src/_lib/connector/ConnectToRegion.tsx.html +151 -0
- package/src/coverage/lcov-report/src/_lib/connector/ConnectorRegion.tsx.html +154 -0
- package/src/coverage/lcov-report/src/_lib/connector/ConnectorsProvider.tsx.html +142 -0
- package/src/coverage/lcov-report/src/_lib/connector/ConnectorsStore.ts.html +451 -0
- package/src/coverage/lcov-report/src/_lib/connector/ConnectorsStoreContext.ts.html +97 -0
- package/src/coverage/lcov-report/src/_lib/connector/helpers.ts.html +100 -0
- package/src/coverage/lcov-report/src/_lib/connector/index.html +281 -0
- package/src/coverage/lcov-report/src/_lib/connector/index.ts.html +112 -0
- package/src/coverage/lcov-report/src/_lib/connector/mapConnectorToLine.ts.html +334 -0
- package/src/coverage/lcov-report/src/_lib/connector/types.ts.html +253 -0
- package/src/coverage/lcov-report/src/_lib/connector/useConnectorsStore.ts.html +124 -0
- package/src/coverage/lcov-report/src/_lib/connector/useRegionRects.ts.html +508 -0
- package/src/coverage/lcov-report/src/_lib/fixedListenQuery.ts.html +388 -0
- package/src/coverage/lcov-report/src/_lib/form/DocumentForm.tsx.html +676 -0
- package/src/coverage/lcov-report/src/_lib/form/helpers.ts.html +178 -0
- package/src/coverage/lcov-report/src/_lib/form/index.html +146 -0
- package/src/coverage/lcov-report/src/_lib/form/index.ts.html +88 -0
- package/src/coverage/lcov-report/src/_lib/index.html +161 -0
- package/src/coverage/lcov-report/src/_lib/randomKey.ts.html +172 -0
- package/src/coverage/lcov-report/src/_lib/useListeningQuery.ts.html +268 -0
- package/src/coverage/lcov-report/src/_lib/usePrevious.ts.html +112 -0
- package/src/coverage/lcov-report/src/assistConnectors/AssistConnectorsOverlay.tsx.html +481 -0
- package/src/coverage/lcov-report/src/assistConnectors/ConnectorPath.tsx.html +271 -0
- package/src/coverage/lcov-report/src/assistConnectors/draw/arrowPath.ts.html +112 -0
- package/src/coverage/lcov-report/src/assistConnectors/draw/connectorPath.ts.html +511 -0
- package/src/coverage/lcov-report/src/assistConnectors/draw/index.html +131 -0
- package/src/coverage/lcov-report/src/assistConnectors/index.html +146 -0
- package/src/coverage/lcov-report/src/assistConnectors/index.ts.html +88 -0
- package/src/coverage/lcov-report/src/assistDocument/AssistDocumentContext.tsx.html +178 -0
- package/src/coverage/lcov-report/src/assistDocument/AssistDocumentContextProvider.tsx.html +136 -0
- package/src/coverage/lcov-report/src/assistDocument/AssistDocumentInput.tsx.html +280 -0
- package/src/coverage/lcov-report/src/assistDocument/RequestRunInstructionProvider.tsx.html +283 -0
- package/src/coverage/lcov-report/src/assistDocument/components/AssistDocumentForm.tsx.html +775 -0
- package/src/coverage/lcov-report/src/assistDocument/components/FieldRefPreview.tsx.html +166 -0
- package/src/coverage/lcov-report/src/assistDocument/components/InstructionsArrayField.tsx.html +109 -0
- package/src/coverage/lcov-report/src/assistDocument/components/InstructionsArrayInput.tsx.html +163 -0
- package/src/coverage/lcov-report/src/assistDocument/components/SelectedFieldContext.tsx.html +115 -0
- package/src/coverage/lcov-report/src/assistDocument/components/generic/HiddenFieldTitle.tsx.html +100 -0
- package/src/coverage/lcov-report/src/assistDocument/components/generic/index.html +116 -0
- package/src/coverage/lcov-report/src/assistDocument/components/helpers.ts.html +148 -0
- package/src/coverage/lcov-report/src/assistDocument/components/index.html +191 -0
- package/src/coverage/lcov-report/src/assistDocument/components/instruction/BackToInstructionsLink.tsx.html +178 -0
- package/src/coverage/lcov-report/src/assistDocument/components/instruction/FieldRefInput.tsx.html +244 -0
- package/src/coverage/lcov-report/src/assistDocument/components/instruction/InstructionInput.tsx.html +349 -0
- package/src/coverage/lcov-report/src/assistDocument/components/instruction/InstructionOutputField.tsx.html +220 -0
- package/src/coverage/lcov-report/src/assistDocument/components/instruction/InstructionOutputInput.tsx.html +700 -0
- package/src/coverage/lcov-report/src/assistDocument/components/instruction/PromptInput.tsx.html +241 -0
- package/src/coverage/lcov-report/src/assistDocument/components/instruction/appearance/IconInput.tsx.html +223 -0
- package/src/coverage/lcov-report/src/assistDocument/components/instruction/appearance/InstructionVisibility.tsx.html +196 -0
- package/src/coverage/lcov-report/src/assistDocument/components/instruction/appearance/index.html +131 -0
- package/src/coverage/lcov-report/src/assistDocument/components/instruction/index.html +191 -0
- package/src/coverage/lcov-report/src/assistDocument/hooks/index.html +161 -0
- package/src/coverage/lcov-report/src/assistDocument/hooks/useAssistDocumentContextValue.tsx.html +289 -0
- package/src/coverage/lcov-report/src/assistDocument/hooks/useDocumentState.ts.html +103 -0
- package/src/coverage/lcov-report/src/assistDocument/hooks/useInstructionToaster.tsx.html +307 -0
- package/src/coverage/lcov-report/src/assistDocument/hooks/useStudioAssistDocument.ts.html +379 -0
- package/src/coverage/lcov-report/src/assistDocument/index.html +176 -0
- package/src/coverage/lcov-report/src/assistDocument/index.ts.html +88 -0
- package/src/coverage/lcov-report/src/assistFormComponents/AssistField.tsx.html +301 -0
- package/src/coverage/lcov-report/src/assistFormComponents/AssistFormBlock.tsx.html +175 -0
- package/src/coverage/lcov-report/src/assistFormComponents/AssistInlineFormBlock.tsx.html +124 -0
- package/src/coverage/lcov-report/src/assistFormComponents/AssistItem.tsx.html +145 -0
- package/src/coverage/lcov-report/src/assistFormComponents/index.html +161 -0
- package/src/coverage/lcov-report/src/assistFormComponents/validation/index.html +131 -0
- package/src/coverage/lcov-report/src/assistFormComponents/validation/listItem.tsx.html +274 -0
- package/src/coverage/lcov-report/src/assistFormComponents/validation/validationList.tsx.html +352 -0
- package/src/coverage/lcov-report/src/assistInspector/AssistInspector.tsx.html +1318 -0
- package/src/coverage/lcov-report/src/assistInspector/FieldAutocomplete.tsx.html +505 -0
- package/src/coverage/lcov-report/src/assistInspector/InstructionTaskHistoryButton.tsx.html +865 -0
- package/src/coverage/lcov-report/src/assistInspector/constants.ts.html +88 -0
- package/src/coverage/lcov-report/src/assistInspector/helpers.ts.html +724 -0
- package/src/coverage/lcov-report/src/assistInspector/index.html +191 -0
- package/src/coverage/lcov-report/src/assistInspector/index.ts.html +163 -0
- package/src/coverage/lcov-report/src/assistLayout/AiAssistanceConfigContext.tsx.html +331 -0
- package/src/coverage/lcov-report/src/assistLayout/AssistLayout.tsx.html +199 -0
- package/src/coverage/lcov-report/src/assistLayout/RunInstructionProvider.tsx.html +751 -0
- package/src/coverage/lcov-report/src/assistLayout/index.html +146 -0
- package/src/coverage/lcov-report/src/components/AssistFeatureBadge.tsx.html +112 -0
- package/src/coverage/lcov-report/src/components/FadeInContent.tsx.html +205 -0
- package/src/coverage/lcov-report/src/components/HideReferenceChangedBannerInput.tsx.html +160 -0
- package/src/coverage/lcov-report/src/components/ImageContext.tsx.html +229 -0
- package/src/coverage/lcov-report/src/components/SafeValueInput.tsx.html +313 -0
- package/src/coverage/lcov-report/src/components/TimeAgo.tsx.html +139 -0
- package/src/coverage/lcov-report/src/components/index.html +191 -0
- package/src/coverage/lcov-report/src/constants.ts.html +145 -0
- package/src/coverage/lcov-report/src/fieldActions/PrivateIcon.tsx.html +145 -0
- package/src/coverage/lcov-report/src/fieldActions/assistFieldActions.tsx.html +907 -0
- package/src/coverage/lcov-report/src/fieldActions/generateCaptionActions.tsx.html +259 -0
- package/src/coverage/lcov-report/src/fieldActions/generateImageActions.tsx.html +256 -0
- package/src/coverage/lcov-report/src/fieldActions/index.html +161 -0
- package/src/coverage/lcov-report/src/helpers/assistSupported.ts.html +226 -0
- package/src/coverage/lcov-report/src/helpers/conditionalMembers.ts.html +466 -0
- package/src/coverage/lcov-report/src/helpers/ids.ts.html +142 -0
- package/src/coverage/lcov-report/src/helpers/index.html +191 -0
- package/src/coverage/lcov-report/src/helpers/misc.ts.html +133 -0
- package/src/coverage/lcov-report/src/helpers/typeUtils.ts.html +208 -0
- package/src/coverage/lcov-report/src/helpers/useAssistSupported.ts.html +106 -0
- package/src/coverage/lcov-report/src/index.html +176 -0
- package/src/coverage/lcov-report/src/index.ts.html +112 -0
- package/src/coverage/lcov-report/src/onboarding/FieldActionsOnboarding.tsx.html +286 -0
- package/src/coverage/lcov-report/src/onboarding/FirstAssistedPathProvider.tsx.html +172 -0
- package/src/coverage/lcov-report/src/onboarding/InspectorOnboarding.tsx.html +223 -0
- package/src/coverage/lcov-report/src/onboarding/index.html +161 -0
- package/src/coverage/lcov-report/src/onboarding/onboardingStore.ts.html +184 -0
- package/src/coverage/lcov-report/src/plugin.tsx.html +427 -0
- package/src/coverage/lcov-report/src/presence/AiFieldPresence.tsx.html +163 -0
- package/src/coverage/lcov-report/src/presence/AssistAvatar.tsx.html +373 -0
- package/src/coverage/lcov-report/src/presence/AssistDocumentPresence.tsx.html +259 -0
- package/src/coverage/lcov-report/src/presence/index.html +161 -0
- package/src/coverage/lcov-report/src/presence/useAssistPresence.ts.html +268 -0
- package/src/coverage/lcov-report/src/schemas/assistDocumentSchema.tsx.html +1552 -0
- package/src/coverage/lcov-report/src/schemas/contextDocumentSchema.tsx.html +253 -0
- package/src/coverage/lcov-report/src/schemas/index.html +176 -0
- package/src/coverage/lcov-report/src/schemas/index.ts.html +277 -0
- package/src/coverage/lcov-report/src/schemas/serialize/SchemTypeTool.tsx.html +391 -0
- package/src/coverage/lcov-report/src/schemas/serialize/index.html +146 -0
- package/src/coverage/lcov-report/src/schemas/serialize/schemaUtils.ts.html +196 -0
- package/src/coverage/lcov-report/src/schemas/serialize/serializeSchema.ts.html +754 -0
- package/src/coverage/lcov-report/src/schemas/serializedSchemaTypeSchema.ts.html +262 -0
- package/src/coverage/lcov-report/src/schemas/typeDefExtensions.ts.html +397 -0
- package/src/coverage/lcov-report/src/translate/FieldTranslationProvider.tsx.html +1003 -0
- package/src/coverage/lcov-report/src/translate/getLanguageParams.ts.html +163 -0
- package/src/coverage/lcov-report/src/translate/index.html +191 -0
- package/src/coverage/lcov-report/src/translate/languageStore.ts.html +139 -0
- package/src/coverage/lcov-report/src/translate/paths.ts.html +577 -0
- package/src/coverage/lcov-report/src/translate/translateActions.tsx.html +637 -0
- package/src/coverage/lcov-report/src/translate/types.ts.html +565 -0
- package/src/coverage/lcov-report/src/types.ts.html +649 -0
- package/src/coverage/lcov-report/src/useApiClient.ts.html +1015 -0
- package/src/coverage/lcov.info +9519 -0
- package/src/coverage/prettify.css +1 -0
- package/src/coverage/prettify.js +2 -0
- package/src/coverage/sort-arrow-sprite.png +0 -0
- package/src/coverage/sorter.js +196 -0
- package/src/coverage/src/_lib/connector/ConnectFromRegion.tsx.html +157 -0
- package/src/coverage/src/_lib/connector/ConnectToRegion.tsx.html +151 -0
- package/src/coverage/src/_lib/connector/ConnectorRegion.tsx.html +154 -0
- package/src/coverage/src/_lib/connector/ConnectorsProvider.tsx.html +142 -0
- package/src/coverage/src/_lib/connector/ConnectorsStore.ts.html +451 -0
- package/src/coverage/src/_lib/connector/ConnectorsStoreContext.ts.html +97 -0
- package/src/coverage/src/_lib/connector/helpers.ts.html +100 -0
- package/src/coverage/src/_lib/connector/index.html +281 -0
- package/src/coverage/src/_lib/connector/index.ts.html +112 -0
- package/src/coverage/src/_lib/connector/mapConnectorToLine.ts.html +334 -0
- package/src/coverage/src/_lib/connector/types.ts.html +253 -0
- package/src/coverage/src/_lib/connector/useConnectorsStore.ts.html +124 -0
- package/src/coverage/src/_lib/connector/useRegionRects.ts.html +508 -0
- package/src/coverage/src/_lib/fixedListenQuery.ts.html +388 -0
- package/src/coverage/src/_lib/form/DocumentForm.tsx.html +676 -0
- package/src/coverage/src/_lib/form/helpers.ts.html +178 -0
- package/src/coverage/src/_lib/form/index.html +146 -0
- package/src/coverage/src/_lib/form/index.ts.html +88 -0
- package/src/coverage/src/_lib/index.html +161 -0
- package/src/coverage/src/_lib/randomKey.ts.html +172 -0
- package/src/coverage/src/_lib/useListeningQuery.ts.html +268 -0
- package/src/coverage/src/_lib/usePrevious.ts.html +112 -0
- package/src/coverage/src/assistConnectors/AssistConnectorsOverlay.tsx.html +481 -0
- package/src/coverage/src/assistConnectors/ConnectorPath.tsx.html +271 -0
- package/src/coverage/src/assistConnectors/draw/arrowPath.ts.html +112 -0
- package/src/coverage/src/assistConnectors/draw/connectorPath.ts.html +511 -0
- package/src/coverage/src/assistConnectors/draw/index.html +131 -0
- package/src/coverage/src/assistConnectors/index.html +146 -0
- package/src/coverage/src/assistConnectors/index.ts.html +88 -0
- package/src/coverage/src/assistDocument/AssistDocumentContext.tsx.html +178 -0
- package/src/coverage/src/assistDocument/AssistDocumentContextProvider.tsx.html +136 -0
- package/src/coverage/src/assistDocument/AssistDocumentInput.tsx.html +280 -0
- package/src/coverage/src/assistDocument/RequestRunInstructionProvider.tsx.html +283 -0
- package/src/coverage/src/assistDocument/components/AssistDocumentForm.tsx.html +775 -0
- package/src/coverage/src/assistDocument/components/FieldRefPreview.tsx.html +166 -0
- package/src/coverage/src/assistDocument/components/InstructionsArrayField.tsx.html +109 -0
- package/src/coverage/src/assistDocument/components/InstructionsArrayInput.tsx.html +163 -0
- package/src/coverage/src/assistDocument/components/SelectedFieldContext.tsx.html +115 -0
- package/src/coverage/src/assistDocument/components/generic/HiddenFieldTitle.tsx.html +100 -0
- package/src/coverage/src/assistDocument/components/generic/index.html +116 -0
- package/src/coverage/src/assistDocument/components/helpers.ts.html +148 -0
- package/src/coverage/src/assistDocument/components/index.html +191 -0
- package/src/coverage/src/assistDocument/components/instruction/BackToInstructionsLink.tsx.html +178 -0
- package/src/coverage/src/assistDocument/components/instruction/FieldRefInput.tsx.html +244 -0
- package/src/coverage/src/assistDocument/components/instruction/InstructionInput.tsx.html +349 -0
- package/src/coverage/src/assistDocument/components/instruction/InstructionOutputField.tsx.html +220 -0
- package/src/coverage/src/assistDocument/components/instruction/InstructionOutputInput.tsx.html +700 -0
- package/src/coverage/src/assistDocument/components/instruction/PromptInput.tsx.html +241 -0
- package/src/coverage/src/assistDocument/components/instruction/appearance/IconInput.tsx.html +223 -0
- package/src/coverage/src/assistDocument/components/instruction/appearance/InstructionVisibility.tsx.html +196 -0
- package/src/coverage/src/assistDocument/components/instruction/appearance/index.html +131 -0
- package/src/coverage/src/assistDocument/components/instruction/index.html +191 -0
- package/src/coverage/src/assistDocument/hooks/index.html +161 -0
- package/src/coverage/src/assistDocument/hooks/useAssistDocumentContextValue.tsx.html +289 -0
- package/src/coverage/src/assistDocument/hooks/useDocumentState.ts.html +103 -0
- package/src/coverage/src/assistDocument/hooks/useInstructionToaster.tsx.html +307 -0
- package/src/coverage/src/assistDocument/hooks/useStudioAssistDocument.ts.html +379 -0
- package/src/coverage/src/assistDocument/index.html +176 -0
- package/src/coverage/src/assistDocument/index.ts.html +88 -0
- package/src/coverage/src/assistFormComponents/AssistField.tsx.html +301 -0
- package/src/coverage/src/assistFormComponents/AssistFormBlock.tsx.html +175 -0
- package/src/coverage/src/assistFormComponents/AssistInlineFormBlock.tsx.html +124 -0
- package/src/coverage/src/assistFormComponents/AssistItem.tsx.html +145 -0
- package/src/coverage/src/assistFormComponents/index.html +161 -0
- package/src/coverage/src/assistFormComponents/validation/index.html +131 -0
- package/src/coverage/src/assistFormComponents/validation/listItem.tsx.html +274 -0
- package/src/coverage/src/assistFormComponents/validation/validationList.tsx.html +352 -0
- package/src/coverage/src/assistInspector/AssistInspector.tsx.html +1318 -0
- package/src/coverage/src/assistInspector/FieldAutocomplete.tsx.html +505 -0
- package/src/coverage/src/assistInspector/InstructionTaskHistoryButton.tsx.html +865 -0
- package/src/coverage/src/assistInspector/constants.ts.html +88 -0
- package/src/coverage/src/assistInspector/helpers.ts.html +724 -0
- package/src/coverage/src/assistInspector/index.html +191 -0
- package/src/coverage/src/assistInspector/index.ts.html +163 -0
- package/src/coverage/src/assistLayout/AiAssistanceConfigContext.tsx.html +331 -0
- package/src/coverage/src/assistLayout/AssistLayout.tsx.html +199 -0
- package/src/coverage/src/assistLayout/RunInstructionProvider.tsx.html +751 -0
- package/src/coverage/src/assistLayout/index.html +146 -0
- package/src/coverage/src/components/AssistFeatureBadge.tsx.html +112 -0
- package/src/coverage/src/components/FadeInContent.tsx.html +205 -0
- package/src/coverage/src/components/HideReferenceChangedBannerInput.tsx.html +160 -0
- package/src/coverage/src/components/ImageContext.tsx.html +229 -0
- package/src/coverage/src/components/SafeValueInput.tsx.html +313 -0
- package/src/coverage/src/components/TimeAgo.tsx.html +139 -0
- package/src/coverage/src/components/index.html +191 -0
- package/src/coverage/src/constants.ts.html +145 -0
- package/src/coverage/src/fieldActions/PrivateIcon.tsx.html +145 -0
- package/src/coverage/src/fieldActions/assistFieldActions.tsx.html +907 -0
- package/src/coverage/src/fieldActions/generateCaptionActions.tsx.html +259 -0
- package/src/coverage/src/fieldActions/generateImageActions.tsx.html +256 -0
- package/src/coverage/src/fieldActions/index.html +161 -0
- package/src/coverage/src/helpers/assistSupported.ts.html +226 -0
- package/src/coverage/src/helpers/conditionalMembers.ts.html +466 -0
- package/src/coverage/src/helpers/ids.ts.html +142 -0
- package/src/coverage/src/helpers/index.html +191 -0
- package/src/coverage/src/helpers/misc.ts.html +133 -0
- package/src/coverage/src/helpers/typeUtils.ts.html +208 -0
- package/src/coverage/src/helpers/useAssistSupported.ts.html +106 -0
- package/src/coverage/src/index.html +176 -0
- package/src/coverage/src/index.ts.html +112 -0
- package/src/coverage/src/onboarding/FieldActionsOnboarding.tsx.html +286 -0
- package/src/coverage/src/onboarding/FirstAssistedPathProvider.tsx.html +172 -0
- package/src/coverage/src/onboarding/InspectorOnboarding.tsx.html +223 -0
- package/src/coverage/src/onboarding/index.html +161 -0
- package/src/coverage/src/onboarding/onboardingStore.ts.html +184 -0
- package/src/coverage/src/plugin.tsx.html +427 -0
- package/src/coverage/src/presence/AiFieldPresence.tsx.html +163 -0
- package/src/coverage/src/presence/AssistAvatar.tsx.html +373 -0
- package/src/coverage/src/presence/AssistDocumentPresence.tsx.html +259 -0
- package/src/coverage/src/presence/index.html +161 -0
- package/src/coverage/src/presence/useAssistPresence.ts.html +268 -0
- package/src/coverage/src/schemas/assistDocumentSchema.tsx.html +1552 -0
- package/src/coverage/src/schemas/contextDocumentSchema.tsx.html +253 -0
- package/src/coverage/src/schemas/index.html +176 -0
- package/src/coverage/src/schemas/index.ts.html +277 -0
- package/src/coverage/src/schemas/serialize/SchemTypeTool.tsx.html +391 -0
- package/src/coverage/src/schemas/serialize/index.html +146 -0
- package/src/coverage/src/schemas/serialize/schemaUtils.ts.html +196 -0
- package/src/coverage/src/schemas/serialize/serializeSchema.ts.html +754 -0
- package/src/coverage/src/schemas/serializedSchemaTypeSchema.ts.html +262 -0
- package/src/coverage/src/schemas/typeDefExtensions.ts.html +397 -0
- package/src/coverage/src/translate/FieldTranslationProvider.tsx.html +1003 -0
- package/src/coverage/src/translate/getLanguageParams.ts.html +163 -0
- package/src/coverage/src/translate/index.html +191 -0
- package/src/coverage/src/translate/languageStore.ts.html +139 -0
- package/src/coverage/src/translate/paths.ts.html +577 -0
- package/src/coverage/src/translate/translateActions.tsx.html +637 -0
- package/src/coverage/src/translate/types.ts.html +565 -0
- package/src/coverage/src/types.ts.html +649 -0
- package/src/coverage/src/useApiClient.ts.html +1015 -0
- package/src/fieldActions/assistFieldActions.tsx +13 -5
- package/src/helpers/assistSupported.ts +6 -13
- package/src/helpers/conditionalMembers.test.ts +200 -0
- package/src/helpers/conditionalMembers.ts +127 -0
- package/src/node_modules/.vitest/deps/_metadata.json +8 -0
- package/src/node_modules/.vitest/deps/package.json +3 -0
- package/src/node_modules/.vitest/results.json +1 -1
- package/src/schemas/serialize/serializeSchema.test.ts +63 -3
- package/src/schemas/serialize/serializeSchema.ts +29 -5
- package/src/translate/FieldTranslationProvider.tsx +4 -1
- package/src/translate/translateActions.tsx +20 -5
- package/src/types.ts +3 -0
- package/src/useApiClient.ts +11 -1
package/README.md
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
- [Disable for a field](#disable-for-a-field)
|
|
17
17
|
- [Disable for an array type](#disable-for-an-array-type)
|
|
18
18
|
- [Unsupported types](#unsupported-types)
|
|
19
|
+
- [Hidden and readOnly fields](#hidden-and-readonly-fields)
|
|
19
20
|
- [Reference support](#reference-support)
|
|
20
21
|
- [Troubleshooting](#troubleshooting)
|
|
21
22
|
- [Included document types](#included-document-types)
|
|
@@ -186,14 +187,25 @@ The following types are not supported, and behave as excluded types:
|
|
|
186
187
|
* [File](https://www.sanity.io/docs/file-type) (never supported, even when file has custom fields)
|
|
187
188
|
* [Reference](https://www.sanity.io/docs/reference-type) (supported when configured with embeddingsIndex)
|
|
188
189
|
|
|
189
|
-
Types and fields with `hidden` or `readonly` with a truthy value (`true` or `function`) are not supported.
|
|
190
|
-
(Hidden and readOnly fields can be referenced in instructions still)
|
|
191
|
-
|
|
192
190
|
Fields with these types will not be changed by the assistant, do not have AI Assist actions, and cannot be referenced in instructions.
|
|
193
191
|
|
|
194
192
|
Objects where all fields are excluded or unsupported and arrays where all member types are excluded or unsupported
|
|
195
193
|
will also be excluded.
|
|
196
194
|
|
|
195
|
+
### Hidden adn readOnly fields
|
|
196
|
+
|
|
197
|
+
In AI Assist 2.0 and later, conditionally `hidden` and `readOnly` fields can have instructions.
|
|
198
|
+
These fields can be written to by an instruction, as long as the field is non-hidden and writable when the instruction is started.
|
|
199
|
+
|
|
200
|
+
Fields with `hidden` or `readOnly` set to literal `true` will be skipped by AI Assist.
|
|
201
|
+
|
|
202
|
+
*Note*: An instruction will not re-evaluate these states during a run.
|
|
203
|
+
Ie, if an instructions writes to a field that will make another field in the studio readonly or hidden,
|
|
204
|
+
the running instruction will still consider these as if in their original state.
|
|
205
|
+
|
|
206
|
+
If it is essential that AI Assist *never* writes to a conditional field,
|
|
207
|
+
it should be marked with `options.aiWritingAssistance.exclude: true`.
|
|
208
|
+
|
|
197
209
|
### Reference support
|
|
198
210
|
|
|
199
211
|
#### Create an Embeddings-index
|
package/dist/index.esm.js
CHANGED
|
@@ -153,26 +153,24 @@ function isSchemaAssistEnabled(type) {
|
|
|
153
153
|
return !((_b = (_a = type.options) == null ? void 0 : _a.aiWritingAssistance) == null ? void 0 : _b.exclude);
|
|
154
154
|
}
|
|
155
155
|
function isAssistSupported(type) {
|
|
156
|
-
let allowReadonlyHidden = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
157
156
|
if (!isSchemaAssistEnabled(type)) {
|
|
158
157
|
return false;
|
|
159
158
|
}
|
|
160
|
-
if (isDisabled(type
|
|
159
|
+
if (isDisabled(type)) {
|
|
161
160
|
return false;
|
|
162
161
|
}
|
|
163
162
|
if (type.jsonType === "array") {
|
|
164
|
-
const unsupportedArray = type.of.every(t => isDisabled(t
|
|
163
|
+
const unsupportedArray = type.of.every(t => isDisabled(t));
|
|
165
164
|
return !unsupportedArray;
|
|
166
165
|
}
|
|
167
166
|
if (type.jsonType === "object") {
|
|
168
|
-
const unsupportedObject = type.fields.every(field => isDisabled(field.type
|
|
167
|
+
const unsupportedObject = type.fields.every(field => isDisabled(field.type));
|
|
169
168
|
return !unsupportedObject;
|
|
170
169
|
}
|
|
171
170
|
return true;
|
|
172
171
|
}
|
|
173
|
-
function isDisabled(type
|
|
174
|
-
|
|
175
|
-
return !isSchemaAssistEnabled(type) || isUnsupportedType(type) || !allowReadonlyHidden && readonlyHidden;
|
|
172
|
+
function isDisabled(type) {
|
|
173
|
+
return !isSchemaAssistEnabled(type) || isUnsupportedType(type);
|
|
176
174
|
}
|
|
177
175
|
function isUnsupportedType(type) {
|
|
178
176
|
var _a, _b;
|
|
@@ -180,7 +178,7 @@ function isUnsupportedType(type) {
|
|
|
180
178
|
}
|
|
181
179
|
const inlineTypes = ["document", "object", "image", "file"];
|
|
182
180
|
function serializeSchema(schema, options) {
|
|
183
|
-
const list = schema.getTypeNames().filter(t => !(hiddenTypes.includes(t) || t.startsWith("sanity."))).map(t => schema.get(t)).filter(t => !!t).
|
|
181
|
+
const list = schema.getTypeNames().filter(t => !(hiddenTypes.includes(t) || t.startsWith("sanity."))).map(t => schema.get(t)).filter(t => !!t).map(t => getSchemaStub(t, schema, options)).filter(t => {
|
|
184
182
|
if ("to" in t && t.to && !t.to.length) {
|
|
185
183
|
return false;
|
|
186
184
|
}
|
|
@@ -233,14 +231,26 @@ function getBaseFields(schema, type, typeName, options) {
|
|
|
233
231
|
to: "to" in type && typeName === "reference" ? refToTypeNames(type) : void 0,
|
|
234
232
|
fields: "fields" in type && inlineTypes.includes(typeName) ? serializeFields(schema, type, options) : void 0,
|
|
235
233
|
annotations: typeName === "block" && "fields" in type ? serializeAnnotations(type, schema, options) : void 0,
|
|
236
|
-
inlineOf: typeName === "block" && "fields" in type ? serializeInlineOf(type, schema, options) : void 0
|
|
234
|
+
inlineOf: typeName === "block" && "fields" in type ? serializeInlineOf(type, schema, options) : void 0,
|
|
235
|
+
hidden: typeof type.hidden === "function" ? "function" : type.hidden ? true : void 0,
|
|
236
|
+
readOnly: typeof type.readOnly === "function" ? "function" : type.readOnly ? true : void 0
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
239
|
function serializeFields(schema, schemaType, options) {
|
|
240
|
-
|
|
240
|
+
const fields = schemaType.fieldsets ? schemaType.fieldsets.flatMap(fs => fs.single ? fs.field : fs.fields.map(f => ({
|
|
241
|
+
...f,
|
|
242
|
+
type: {
|
|
243
|
+
...f.type,
|
|
244
|
+
// if fieldset is (conditionally) hidden, the field must be considered the same way
|
|
245
|
+
// ie, if the field does not show up in conditionalMembers, it is hidden
|
|
246
|
+
// regardless of weather or not it is the field function or the fieldset function that hides it
|
|
247
|
+
hidden: typeof fs.hidden === "function" ? fs.hidden : fs.hidden ? true : f.type.hidden
|
|
248
|
+
}
|
|
249
|
+
}))) : schemaType.fields;
|
|
250
|
+
return fields.filter(f => {
|
|
241
251
|
var _a, _b;
|
|
242
252
|
return !["sanity.imageHotspot", "sanity.imageCrop"].includes((_b = (_a = f.type) == null ? void 0 : _a.name) != null ? _b : "");
|
|
243
|
-
}).filter(f => isAssistSupported(f.type)).
|
|
253
|
+
}).filter(f => isAssistSupported(f.type)).map(field => serializeMember(schema, field.type, field.name, options));
|
|
244
254
|
}
|
|
245
255
|
function serializeMember(schema, type, name, options) {
|
|
246
256
|
var _a, _b;
|
|
@@ -393,13 +403,13 @@ function SchemaEntry(_ref) {
|
|
|
393
403
|
children: out
|
|
394
404
|
});
|
|
395
405
|
}
|
|
396
|
-
const MAX_DEPTH = 6;
|
|
406
|
+
const MAX_DEPTH$1 = 6;
|
|
397
407
|
function getDocumentMembersFlat(doc, schemaType) {
|
|
398
408
|
if (!isDocumentSchemaType(schemaType)) {
|
|
399
409
|
console.error("Schema type is not a document");
|
|
400
410
|
return [];
|
|
401
411
|
}
|
|
402
|
-
return extractPaths(doc, schemaType, [], MAX_DEPTH);
|
|
412
|
+
return extractPaths(doc, schemaType, [], MAX_DEPTH$1);
|
|
403
413
|
}
|
|
404
414
|
function extractPaths(doc, schemaType, path, maxDepth) {
|
|
405
415
|
if (path.length >= maxDepth) {
|
|
@@ -682,7 +692,7 @@ function getFieldRefs(schemaType, parent) {
|
|
|
682
692
|
};
|
|
683
693
|
const fields = field.type.jsonType === "object" ? getFieldRefs(field.type, fieldRef, depth + 1) : [];
|
|
684
694
|
const syntheticFields = field.type.jsonType === "array" ? getSyntheticFields(field.type, fieldRef, depth + 1) : [];
|
|
685
|
-
if (!isAssistSupported(field.type
|
|
695
|
+
if (!isAssistSupported(field.type)) {
|
|
686
696
|
return [...fields, ...syntheticFields];
|
|
687
697
|
}
|
|
688
698
|
return [fieldRef, ...fields, ...syntheticFields];
|
|
@@ -709,7 +719,7 @@ function getSyntheticFields(schemaType, parent) {
|
|
|
709
719
|
synthetic: true
|
|
710
720
|
};
|
|
711
721
|
const fields = itemType.jsonType === "object" ? getFieldRefs(itemType, fieldRef, depth + 1) : [];
|
|
712
|
-
if (!isAssistSupported(itemType
|
|
722
|
+
if (!isAssistSupported(itemType)) {
|
|
713
723
|
return fields;
|
|
714
724
|
}
|
|
715
725
|
return [fieldRef, ...fields];
|
|
@@ -1099,7 +1109,8 @@ function useTranslate(apiClient) {
|
|
|
1099
1109
|
documentId,
|
|
1100
1110
|
languagePath,
|
|
1101
1111
|
translatePath,
|
|
1102
|
-
fieldLanguageMap
|
|
1112
|
+
fieldLanguageMap,
|
|
1113
|
+
conditionalMembers
|
|
1103
1114
|
} = _ref4;
|
|
1104
1115
|
setLoading(true);
|
|
1105
1116
|
return apiClient.request({
|
|
@@ -1110,6 +1121,7 @@ function useTranslate(apiClient) {
|
|
|
1110
1121
|
types,
|
|
1111
1122
|
languagePath,
|
|
1112
1123
|
fieldLanguageMap,
|
|
1124
|
+
conditionalMembers,
|
|
1113
1125
|
translatePath: translatePath.length === 0 ? documentRootKey : pathToString(translatePath),
|
|
1114
1126
|
userId: user == null ? void 0 : user.id
|
|
1115
1127
|
}
|
|
@@ -1962,6 +1974,78 @@ function FieldTitle(props) {
|
|
|
1962
1974
|
})
|
|
1963
1975
|
});
|
|
1964
1976
|
}
|
|
1977
|
+
const MAX_DEPTH = 8;
|
|
1978
|
+
function getConditionalMembers(docState) {
|
|
1979
|
+
const doc = {
|
|
1980
|
+
path: "",
|
|
1981
|
+
hidden: false,
|
|
1982
|
+
readOnly: !!docState.readOnly,
|
|
1983
|
+
conditional: typeof docState.schemaType.hidden === "function"
|
|
1984
|
+
};
|
|
1985
|
+
return [doc, ...extractConditionalPaths(docState, MAX_DEPTH)].filter(v => v.conditional).map(_ref10 => {
|
|
1986
|
+
let {
|
|
1987
|
+
conditional,
|
|
1988
|
+
...state
|
|
1989
|
+
} = _ref10;
|
|
1990
|
+
return {
|
|
1991
|
+
...state
|
|
1992
|
+
};
|
|
1993
|
+
});
|
|
1994
|
+
}
|
|
1995
|
+
function isConditional(schemaType) {
|
|
1996
|
+
return typeof schemaType.hidden === "function" || typeof schemaType.readOnly === "function";
|
|
1997
|
+
}
|
|
1998
|
+
function conditionalState(memberState) {
|
|
1999
|
+
return {
|
|
2000
|
+
path: pathToString(memberState.path),
|
|
2001
|
+
readOnly: !!memberState.readOnly,
|
|
2002
|
+
hidden: false,
|
|
2003
|
+
// if its in members, its not hidden
|
|
2004
|
+
conditional: isConditional(memberState.schemaType)
|
|
2005
|
+
};
|
|
2006
|
+
}
|
|
2007
|
+
function extractConditionalPaths(node, maxDepth) {
|
|
2008
|
+
if (node.path.length >= maxDepth) {
|
|
2009
|
+
return [];
|
|
2010
|
+
}
|
|
2011
|
+
return node.members.reduce((acc, member) => {
|
|
2012
|
+
var _a, _b;
|
|
2013
|
+
if (member.kind === "error") {
|
|
2014
|
+
return acc;
|
|
2015
|
+
}
|
|
2016
|
+
if (member.kind === "field") {
|
|
2017
|
+
const schemaType = member.field.schemaType;
|
|
2018
|
+
if (schemaType.jsonType === "object") {
|
|
2019
|
+
const innerFields = member.field.readOnly ? [] : extractConditionalPaths(member.field, maxDepth);
|
|
2020
|
+
return [...acc, conditionalState(member.field), ...innerFields];
|
|
2021
|
+
} else if (schemaType.jsonType === "array") {
|
|
2022
|
+
const array = member.field;
|
|
2023
|
+
let arrayPaths = [];
|
|
2024
|
+
const isObjectsArray = array.members.some(m => m.kind === "item" && isObjectSchemaType(m.item.schemaType));
|
|
2025
|
+
if (!array.readOnly) {
|
|
2026
|
+
for (const arrayMember of array.members) {
|
|
2027
|
+
if (arrayMember.kind === "error") {
|
|
2028
|
+
continue;
|
|
2029
|
+
}
|
|
2030
|
+
const innerFields = isObjectsArray && !arrayMember.item.readOnly ? extractConditionalPaths(arrayMember.item, maxDepth) : [];
|
|
2031
|
+
arrayPaths = [...arrayPaths, conditionalState(arrayMember.item), ...innerFields];
|
|
2032
|
+
}
|
|
2033
|
+
}
|
|
2034
|
+
return [...acc, conditionalState(array), ...arrayPaths];
|
|
2035
|
+
}
|
|
2036
|
+
return [...acc, conditionalState(member.field)];
|
|
2037
|
+
} else if (member.kind === "fieldSet") {
|
|
2038
|
+
const conditionalFieldset = !!((_b = (_a = node.schemaType) == null ? void 0 : _a.fieldsets) == null ? void 0 : _b.some(f => !f.single && f.name === member.fieldSet.name && typeof f.hidden === "function"));
|
|
2039
|
+
const innerFields = extractConditionalPaths(member.fieldSet, maxDepth).map(f => ({
|
|
2040
|
+
...f,
|
|
2041
|
+
// if fieldset is conditional, visible fields must also be considered conditional
|
|
2042
|
+
conditional: conditionalFieldset != null ? conditionalFieldset : f.conditional
|
|
2043
|
+
}));
|
|
2044
|
+
return [...acc, ...innerFields];
|
|
2045
|
+
}
|
|
2046
|
+
return acc;
|
|
2047
|
+
}, []);
|
|
2048
|
+
}
|
|
1965
2049
|
var __freeze$4 = Object.freeze;
|
|
1966
2050
|
var __defProp$4 = Object.defineProperty;
|
|
1967
2051
|
var __template$4 = (cooked, raw) => __freeze$4(__defProp$4(cooked, "raw", {
|
|
@@ -2101,12 +2185,15 @@ function AssistInspector(props) {
|
|
|
2101
2185
|
documentType,
|
|
2102
2186
|
value: docValue,
|
|
2103
2187
|
schemaType,
|
|
2104
|
-
onChange: documentOnChange
|
|
2188
|
+
onChange: documentOnChange,
|
|
2189
|
+
formState
|
|
2105
2190
|
} = documentPane;
|
|
2106
2191
|
const {
|
|
2107
2192
|
published,
|
|
2108
2193
|
draft
|
|
2109
2194
|
} = useEditState(documentId, documentType, "low");
|
|
2195
|
+
const formStateRef = useRef(formState);
|
|
2196
|
+
formStateRef.current = formState;
|
|
2110
2197
|
const assistableDocId = getAssistableDocId(schemaType, documentId);
|
|
2111
2198
|
const {
|
|
2112
2199
|
instructionLoading,
|
|
@@ -2160,7 +2247,8 @@ function AssistInspector(props) {
|
|
|
2160
2247
|
path: pathKey,
|
|
2161
2248
|
typePath,
|
|
2162
2249
|
assistDocumentId: assistDocumentId(documentType),
|
|
2163
|
-
instruction
|
|
2250
|
+
instruction,
|
|
2251
|
+
conditionalMembers: formStateRef.current ? getConditionalMembers(formStateRef.current) : []
|
|
2164
2252
|
}), [pathKey, instruction, typePath, documentType, assistableDocId, requestRunInstruction]);
|
|
2165
2253
|
const Region = useCallback(_props => {
|
|
2166
2254
|
return /* @__PURE__ */jsx("div", {
|
|
@@ -2346,10 +2434,10 @@ const assistInspector = {
|
|
|
2346
2434
|
showAsAction: false
|
|
2347
2435
|
}),
|
|
2348
2436
|
component: AssistInspectorWrapper,
|
|
2349
|
-
onClose(
|
|
2437
|
+
onClose(_ref11) {
|
|
2350
2438
|
let {
|
|
2351
2439
|
params
|
|
2352
|
-
} =
|
|
2440
|
+
} = _ref11;
|
|
2353
2441
|
return {
|
|
2354
2442
|
params: typed({
|
|
2355
2443
|
...params,
|
|
@@ -2422,11 +2510,11 @@ var __template$3 = (cooked, raw) => __freeze$3(__defProp$3(cooked, "raw", {
|
|
|
2422
2510
|
var _a$3, _b$1;
|
|
2423
2511
|
const fadeIn = keyframes(_a$3 || (_a$3 = __template$3(["\n 0% {\n opacity: 0;\n transform: scale(0.75);\n }\n 40% {\n opacity: 0;\n transform: scale(0.75);\n }\n 100% {\n opacity: 1;\n transform: scale(1);\n }\n"])));
|
|
2424
2512
|
const FadeInDiv = styled.div(_b$1 || (_b$1 = __template$3(["\n animation-name: ", ";\n animation-timing-function: ease-in-out;\n"])), fadeIn);
|
|
2425
|
-
const FadeInContent = forwardRef(function FadeInContent2(
|
|
2513
|
+
const FadeInContent = forwardRef(function FadeInContent2(_ref12, ref) {
|
|
2426
2514
|
let {
|
|
2427
2515
|
children,
|
|
2428
2516
|
durationMs = 250
|
|
2429
|
-
} =
|
|
2517
|
+
} = _ref12;
|
|
2430
2518
|
return /* @__PURE__ */jsx(FadeInDiv, {
|
|
2431
2519
|
ref,
|
|
2432
2520
|
style: {
|
|
@@ -4509,12 +4597,13 @@ function FieldTranslationProvider(props) {
|
|
|
4509
4597
|
if (fieldLanguageMaps && documentId && translatePath) {
|
|
4510
4598
|
runTranslate({
|
|
4511
4599
|
documentId,
|
|
4512
|
-
translatePath
|
|
4600
|
+
translatePath,
|
|
4513
4601
|
fieldLanguageMap: fieldLanguageMaps.map(map => ({
|
|
4514
4602
|
...map,
|
|
4515
4603
|
// eslint-disable-next-line max-nested-callbacks
|
|
4516
4604
|
outputs: map.outputs.filter(out => !!(toLanguages == null ? void 0 : toLanguages.find(l => l.id === out.id)))
|
|
4517
|
-
}))
|
|
4605
|
+
})),
|
|
4606
|
+
conditionalMembers: fieldTranslationParams == null ? void 0 : fieldTranslationParams.conditionalMembers
|
|
4518
4607
|
});
|
|
4519
4608
|
}
|
|
4520
4609
|
close();
|
|
@@ -4805,11 +4894,11 @@ function InstructionInput(props) {
|
|
|
4805
4894
|
})]
|
|
4806
4895
|
});
|
|
4807
4896
|
}
|
|
4808
|
-
function ObjectMember(
|
|
4897
|
+
function ObjectMember(_ref13) {
|
|
4809
4898
|
let {
|
|
4810
4899
|
fieldName,
|
|
4811
4900
|
...props
|
|
4812
|
-
} =
|
|
4901
|
+
} = _ref13;
|
|
4813
4902
|
const member = findFieldMember(props.members, fieldName);
|
|
4814
4903
|
return member ? /* @__PURE__ */jsx(ObjectInputMember, {
|
|
4815
4904
|
...props,
|
|
@@ -4948,8 +5037,8 @@ function IconInput(props) {
|
|
|
4948
5037
|
onChange
|
|
4949
5038
|
} = props;
|
|
4950
5039
|
const id = useId();
|
|
4951
|
-
const items = useMemo(() => Object.entries(icons).map(
|
|
4952
|
-
let [key, icon] =
|
|
5040
|
+
const items = useMemo(() => Object.entries(icons).map(_ref14 => {
|
|
5041
|
+
let [key, icon] = _ref14;
|
|
4953
5042
|
return /* @__PURE__ */jsx(IconItem, {
|
|
4954
5043
|
iconKey: key,
|
|
4955
5044
|
icon,
|
|
@@ -4977,12 +5066,12 @@ function IconInput(props) {
|
|
|
4977
5066
|
}
|
|
4978
5067
|
});
|
|
4979
5068
|
}
|
|
4980
|
-
function IconItem(
|
|
5069
|
+
function IconItem(_ref15) {
|
|
4981
5070
|
let {
|
|
4982
5071
|
icon,
|
|
4983
5072
|
iconKey: key,
|
|
4984
5073
|
onChange
|
|
4985
|
-
} =
|
|
5074
|
+
} = _ref15;
|
|
4986
5075
|
const onClick = useCallback(() => onChange(set(key)), [onChange, key]);
|
|
4987
5076
|
return /* @__PURE__ */jsx(MenuItem, {
|
|
4988
5077
|
icon,
|
|
@@ -4993,8 +5082,8 @@ function IconItem(_ref14) {
|
|
|
4993
5082
|
}
|
|
4994
5083
|
function getIcon(iconName) {
|
|
4995
5084
|
var _a, _b;
|
|
4996
|
-
return (_b = (_a = Object.entries(icons).find(
|
|
4997
|
-
let [key] =
|
|
5085
|
+
return (_b = (_a = Object.entries(icons).find(_ref16 => {
|
|
5086
|
+
let [key] = _ref16;
|
|
4998
5087
|
return key === iconName;
|
|
4999
5088
|
})) == null ? void 0 : _a[1]) != null ? _b : icons.sparkles;
|
|
5000
5089
|
}
|
|
@@ -5153,11 +5242,11 @@ const contextDocumentSchema = defineType({
|
|
|
5153
5242
|
title: "title",
|
|
5154
5243
|
context: "context"
|
|
5155
5244
|
},
|
|
5156
|
-
prepare(
|
|
5245
|
+
prepare(_ref17) {
|
|
5157
5246
|
let {
|
|
5158
5247
|
title,
|
|
5159
5248
|
context
|
|
5160
|
-
} =
|
|
5249
|
+
} = _ref17;
|
|
5161
5250
|
var _a;
|
|
5162
5251
|
const text = context == null ? void 0 : context.flatMap(block => block == null ? void 0 : block.children).flatMap(child => {
|
|
5163
5252
|
var _a2;
|
|
@@ -5257,11 +5346,11 @@ function InstructionOutputField(props) {
|
|
|
5257
5346
|
children: props.children
|
|
5258
5347
|
});
|
|
5259
5348
|
}
|
|
5260
|
-
function EnabledOutputField(
|
|
5349
|
+
function EnabledOutputField(_ref18) {
|
|
5261
5350
|
let {
|
|
5262
5351
|
fieldSchema,
|
|
5263
5352
|
...props
|
|
5264
|
-
} =
|
|
5353
|
+
} = _ref18;
|
|
5265
5354
|
var _a;
|
|
5266
5355
|
const [open, setOpen] = useState(!!((_a = props.value) == null ? void 0 : _a.length));
|
|
5267
5356
|
const onExpand = useCallback(() => setOpen(true), []);
|
|
@@ -5309,11 +5398,11 @@ function useEmptySelectAllValue(value, allowedValues, onChange) {
|
|
|
5309
5398
|
}
|
|
5310
5399
|
}, [allowedValues, value, onChange]);
|
|
5311
5400
|
}
|
|
5312
|
-
function ObjectOutputInput(
|
|
5401
|
+
function ObjectOutputInput(_ref19) {
|
|
5313
5402
|
let {
|
|
5314
5403
|
fieldSchema,
|
|
5315
5404
|
...props
|
|
5316
|
-
} =
|
|
5405
|
+
} = _ref19;
|
|
5317
5406
|
const {
|
|
5318
5407
|
value,
|
|
5319
5408
|
onChange
|
|
@@ -5360,11 +5449,11 @@ function ObjectOutputInput(_ref18) {
|
|
|
5360
5449
|
})
|
|
5361
5450
|
});
|
|
5362
5451
|
}
|
|
5363
|
-
function ArrayOutputInput(
|
|
5452
|
+
function ArrayOutputInput(_ref20) {
|
|
5364
5453
|
let {
|
|
5365
5454
|
fieldSchema,
|
|
5366
5455
|
...props
|
|
5367
|
-
} =
|
|
5456
|
+
} = _ref20;
|
|
5368
5457
|
const {
|
|
5369
5458
|
value,
|
|
5370
5459
|
onChange
|
|
@@ -5409,13 +5498,13 @@ function ArrayOutputInput(_ref19) {
|
|
|
5409
5498
|
})
|
|
5410
5499
|
});
|
|
5411
5500
|
}
|
|
5412
|
-
function Selectable(
|
|
5501
|
+
function Selectable(_ref21) {
|
|
5413
5502
|
let {
|
|
5414
5503
|
title,
|
|
5415
5504
|
arrayValue,
|
|
5416
5505
|
value,
|
|
5417
5506
|
onChange
|
|
5418
|
-
} =
|
|
5507
|
+
} = _ref21;
|
|
5419
5508
|
const checked = !(arrayValue == null ? void 0 : arrayValue.length) || !!(arrayValue == null ? void 0 : arrayValue.find(v => v._key === value));
|
|
5420
5509
|
const handleChange = useCallback(() => onChange(checked, value), [onChange, checked, value]);
|
|
5421
5510
|
return /* @__PURE__ */jsxs(Flex, {
|
|
@@ -5480,10 +5569,10 @@ const fieldReference = defineType({
|
|
|
5480
5569
|
select: {
|
|
5481
5570
|
path: "path"
|
|
5482
5571
|
},
|
|
5483
|
-
prepare(
|
|
5572
|
+
prepare(_ref22) {
|
|
5484
5573
|
let {
|
|
5485
5574
|
path
|
|
5486
|
-
} =
|
|
5575
|
+
} = _ref22;
|
|
5487
5576
|
return {
|
|
5488
5577
|
title: path,
|
|
5489
5578
|
path,
|
|
@@ -5628,12 +5717,12 @@ const instruction = defineType({
|
|
|
5628
5717
|
title: "title",
|
|
5629
5718
|
userId: "userId"
|
|
5630
5719
|
},
|
|
5631
|
-
prepare:
|
|
5720
|
+
prepare: _ref23 => {
|
|
5632
5721
|
let {
|
|
5633
5722
|
icon,
|
|
5634
5723
|
title,
|
|
5635
5724
|
userId
|
|
5636
|
-
} =
|
|
5725
|
+
} = _ref23;
|
|
5637
5726
|
return {
|
|
5638
5727
|
title,
|
|
5639
5728
|
icon: icon ? icons[icon] : SparklesIcon,
|
|
@@ -6100,6 +6189,7 @@ const translateActions = {
|
|
|
6100
6189
|
documentIsAssistable
|
|
6101
6190
|
} = props;
|
|
6102
6191
|
const isDocumentLevel = path.length === 0;
|
|
6192
|
+
const readOnly = fieldSchemaType.readOnly === true;
|
|
6103
6193
|
const docTransTypes = (_b = (_a = config.translate) == null ? void 0 : _a.document) == null ? void 0 : _b.documentTypes;
|
|
6104
6194
|
const options = fieldSchemaType == null ? void 0 : fieldSchemaType.options;
|
|
6105
6195
|
const addFieldAction = isDocumentLevel || ((_c = options == null ? void 0 : options.aiWritingAssistance) == null ? void 0 : _c.translateAction);
|
|
@@ -6108,16 +6198,19 @@ const translateActions = {
|
|
|
6108
6198
|
if (documentSchemaType && (documentTranslationEnabled || fieldTransEnabled)) {
|
|
6109
6199
|
const {
|
|
6110
6200
|
value: documentValue,
|
|
6111
|
-
onChange: documentOnChange
|
|
6201
|
+
onChange: documentOnChange,
|
|
6202
|
+
formState
|
|
6112
6203
|
} = useDocumentPane();
|
|
6113
6204
|
const docRef = useRef(documentValue);
|
|
6205
|
+
docRef.current = documentValue;
|
|
6206
|
+
const formStateRef = useRef(formState);
|
|
6207
|
+
formStateRef.current = formState;
|
|
6114
6208
|
const translationApi = useTranslate(apiClient);
|
|
6115
6209
|
const translate = useDraftDelayedTask({
|
|
6116
6210
|
documentOnChange,
|
|
6117
6211
|
isDocAssistable: documentIsAssistable != null ? documentIsAssistable : false,
|
|
6118
6212
|
task: translationApi.translate
|
|
6119
6213
|
});
|
|
6120
|
-
docRef.current = documentValue;
|
|
6121
6214
|
const languagePath = (_h = (_g = config.translate) == null ? void 0 : _g.document) == null ? void 0 : _h.languageField;
|
|
6122
6215
|
const translateDocumentAction = useMemo(() => {
|
|
6123
6216
|
if (!languagePath || !documentTranslationEnabled) {
|
|
@@ -6144,13 +6237,14 @@ const translateActions = {
|
|
|
6144
6237
|
translate({
|
|
6145
6238
|
languagePath,
|
|
6146
6239
|
translatePath: path,
|
|
6147
|
-
documentId: documentId != null ? documentId : ""
|
|
6240
|
+
documentId: documentId != null ? documentId : "",
|
|
6241
|
+
conditionalMembers: formStateRef.current ? getConditionalMembers(formStateRef.current) : []
|
|
6148
6242
|
});
|
|
6149
6243
|
},
|
|
6150
6244
|
renderAsButton: true,
|
|
6151
|
-
disabled: translationApi.loading
|
|
6245
|
+
disabled: translationApi.loading || readOnly
|
|
6152
6246
|
});
|
|
6153
|
-
}, [languagePath, translate, documentId, translationApi.loading, documentTranslationEnabled, path]);
|
|
6247
|
+
}, [languagePath, translate, documentId, translationApi.loading, documentTranslationEnabled, path, readOnly]);
|
|
6154
6248
|
const fieldTranslate = useFieldTranslation();
|
|
6155
6249
|
const openFieldTranslation = useDraftDelayedTask({
|
|
6156
6250
|
documentOnChange,
|
|
@@ -6174,15 +6268,19 @@ const translateActions = {
|
|
|
6174
6268
|
if (fieldTranslate.translationLoading || !documentId) {
|
|
6175
6269
|
return;
|
|
6176
6270
|
}
|
|
6271
|
+
if (formStateRef.current) {
|
|
6272
|
+
getConditionalMembers(formStateRef.current);
|
|
6273
|
+
}
|
|
6177
6274
|
openFieldTranslation({
|
|
6178
6275
|
document: docRef.current,
|
|
6179
6276
|
documentSchema: documentSchemaType,
|
|
6180
|
-
translatePath: path
|
|
6277
|
+
translatePath: path,
|
|
6278
|
+
conditionalMembers: formStateRef.current ? getConditionalMembers(formStateRef.current) : []
|
|
6181
6279
|
});
|
|
6182
6280
|
},
|
|
6183
6281
|
renderAsButton: true,
|
|
6184
|
-
disabled: fieldTranslate.translationLoading
|
|
6185
|
-
}) : void 0, [openFieldTranslation, documentSchemaType, documentId, fieldTranslate.translationLoading, fieldTransEnabled, path]);
|
|
6282
|
+
disabled: fieldTranslate.translationLoading || readOnly
|
|
6283
|
+
}) : void 0, [openFieldTranslation, documentSchemaType, documentId, fieldTranslate.translationLoading, fieldTransEnabled, path, readOnly]);
|
|
6186
6284
|
return useMemo(() => {
|
|
6187
6285
|
return node$2({
|
|
6188
6286
|
type: "group",
|
|
@@ -6278,8 +6376,11 @@ const assistFieldActions = {
|
|
|
6278
6376
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
6279
6377
|
useAssistDocumentContext();
|
|
6280
6378
|
const {
|
|
6281
|
-
value: docValue
|
|
6379
|
+
value: docValue,
|
|
6380
|
+
formState
|
|
6282
6381
|
} = useDocumentPane();
|
|
6382
|
+
const formStateRef = useRef(formState);
|
|
6383
|
+
formStateRef.current = formState;
|
|
6283
6384
|
const currentUser = useCurrentUser();
|
|
6284
6385
|
const isHidden = !assistDocument;
|
|
6285
6386
|
const pathKey = usePathKey(props.path);
|
|
@@ -6293,7 +6394,7 @@ const assistFieldActions = {
|
|
|
6293
6394
|
isDocAssistable: documentIsAssistable != null ? documentIsAssistable : false
|
|
6294
6395
|
});
|
|
6295
6396
|
const isSelectable = !!useSelectedField(documentSchemaType, typePath);
|
|
6296
|
-
const assistSupported = useAssistSupported(props.path, schemaType) && isSelectable && isSchemaAssistEnabled(documentSchemaType);
|
|
6397
|
+
const assistSupported = useAssistSupported(props.path, schemaType) && isSelectable && isSchemaAssistEnabled(documentSchemaType) && schemaType.readOnly !== true;
|
|
6297
6398
|
const fieldAssist = useMemo(() => {
|
|
6298
6399
|
var _a;
|
|
6299
6400
|
return ((_a = assistDocument == null ? void 0 : assistDocument.fields) != null ? _a : []).find(f => f.path === typePath || pathKey === documentRootKey && f.path === pathKey);
|
|
@@ -6323,7 +6424,8 @@ const assistFieldActions = {
|
|
|
6323
6424
|
assistDocumentId,
|
|
6324
6425
|
path: pathKey,
|
|
6325
6426
|
typePath,
|
|
6326
|
-
instruction
|
|
6427
|
+
instruction,
|
|
6428
|
+
conditionalMembers: formStateRef.current ? getConditionalMembers(formStateRef.current) : []
|
|
6327
6429
|
});
|
|
6328
6430
|
}, [requestRunInstruction, assistableDocId, pathKey, typePath, assistDocumentId, fieldAssistKey]);
|
|
6329
6431
|
const privateInstructions = useMemo(() => {
|
|
@@ -6399,9 +6501,7 @@ function instructionItem(props) {
|
|
|
6399
6501
|
iconRight: isPrivate ? PrivateIcon : void 0,
|
|
6400
6502
|
title: getInstructionTitle(instruction),
|
|
6401
6503
|
onAction: () => onInstructionAction(instruction),
|
|
6402
|
-
disabled: assistSupported
|
|
6403
|
-
reason: "".concat(pluginTitle, " is not supported for this field")
|
|
6404
|
-
},
|
|
6504
|
+
disabled: !assistSupported,
|
|
6405
6505
|
hidden
|
|
6406
6506
|
});
|
|
6407
6507
|
}
|
|
@@ -6492,11 +6592,11 @@ function AssistDocumentInputWrapper(props) {
|
|
|
6492
6592
|
documentId
|
|
6493
6593
|
});
|
|
6494
6594
|
}
|
|
6495
|
-
function AssistDocumentInput(
|
|
6595
|
+
function AssistDocumentInput(_ref24) {
|
|
6496
6596
|
let {
|
|
6497
6597
|
documentId,
|
|
6498
6598
|
...props
|
|
6499
|
-
} =
|
|
6599
|
+
} = _ref24;
|
|
6500
6600
|
useInstructionToaster(documentId, props.schemaType);
|
|
6501
6601
|
const schemaType = useMemo(() => {
|
|
6502
6602
|
if (props.schemaType.name !== assistDocumentTypeName) {
|
|
@@ -6602,11 +6702,11 @@ const assist = definePlugin(config => {
|
|
|
6602
6702
|
}
|
|
6603
6703
|
return prev;
|
|
6604
6704
|
},
|
|
6605
|
-
unstable_fieldActions: (prev,
|
|
6705
|
+
unstable_fieldActions: (prev, _ref25) => {
|
|
6606
6706
|
let {
|
|
6607
6707
|
documentType,
|
|
6608
6708
|
schema
|
|
6609
|
-
} =
|
|
6709
|
+
} = _ref25;
|
|
6610
6710
|
if (documentType === assistDocumentTypeName) {
|
|
6611
6711
|
return [];
|
|
6612
6712
|
}
|
|
@@ -6616,12 +6716,12 @@ const assist = definePlugin(config => {
|
|
|
6616
6716
|
}
|
|
6617
6717
|
return prev;
|
|
6618
6718
|
},
|
|
6619
|
-
unstable_languageFilter: (prev,
|
|
6719
|
+
unstable_languageFilter: (prev, _ref26) => {
|
|
6620
6720
|
let {
|
|
6621
6721
|
documentId,
|
|
6622
6722
|
schema,
|
|
6623
6723
|
schemaType
|
|
6624
|
-
} =
|
|
6724
|
+
} = _ref26;
|
|
6625
6725
|
if (schemaType === assistDocumentTypeName) {
|
|
6626
6726
|
return [];
|
|
6627
6727
|
}
|