@braze/sanity-plugin-ai-translation 0.2.77 → 0.2.78
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/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3856,10 +3856,14 @@ ${protectedPhrases.join(", ")}`, buildStyleGuideSection = (globalPrompt, localeP
|
|
|
3856
3856
|
] })
|
|
3857
3857
|
] }) });
|
|
3858
3858
|
}, DocumentValidator = ({ documentId, documentType, onResult }) => {
|
|
3859
|
-
const publishedId = getPublishedId(documentId), { isValidating, validation } = useValidationStatus(publishedId, documentType);
|
|
3859
|
+
const publishedId = getPublishedId(documentId), { isValidating, validation } = useValidationStatus(publishedId, documentType), hasReceivedRealResult = useRef(!1);
|
|
3860
3860
|
return useEffect(() => {
|
|
3861
|
-
|
|
3862
|
-
|
|
3861
|
+
(isValidating || validation.length > 0) && (hasReceivedRealResult.current = !0);
|
|
3862
|
+
const stillWaitingForFirstResult = !hasReceivedRealResult.current, errors = validation.filter((v) => v.level === "error");
|
|
3863
|
+
onResult(documentId, {
|
|
3864
|
+
isValidating: isValidating || stillWaitingForFirstResult,
|
|
3865
|
+
errors
|
|
3866
|
+
});
|
|
3863
3867
|
}, [isValidating, validation, documentId, onResult]), null;
|
|
3864
3868
|
}, ValidationPanel = ({ onValidationChange }) => {
|
|
3865
3869
|
const { document, references, selectedReferenceIds, shouldTranslateReferences } = useTranslationContext(), [results, setResults] = useState(/* @__PURE__ */ new Map()), documentsToValidate = useMemo(() => {
|