diff --git a/package.json b/package.json index e921794..b52bd4d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sanity-translations-tab", - "version": "4.1.0", + "version": "4.2.0", "description": "This is the base module for implementing common translation vendor tasks from a Studio, such as sending content to be translated in some specific languages, importing content back etc. Not useful on its own, but vendor-specific plugins will use this for its chrome.", "keywords": [ "sanity", diff --git a/src/components/NewTask.tsx b/src/components/NewTask.tsx index 007dffa..7f4dba6 100644 --- a/src/components/NewTask.tsx +++ b/src/components/NewTask.tsx @@ -36,8 +36,6 @@ const LocaleCheckbox = ({locale, toggle, checked}: LocaleCheckboxProps) => { style={{pointerEvents: `none`}} disabled={locale.enabled === false} checked={checked} - //eslint-disable-next-line @typescript-eslint/no-empty-function - onChange={() => {}} // noop /> @@ -91,6 +89,7 @@ export const NewTask = ({locales, refreshTask}: Props) => { selectedLocales as string[], context.secrets, selectedWorkflowUid, + context.callbackUrl, ), ) .then(() => { diff --git a/src/components/TranslationContext.tsx b/src/components/TranslationContext.tsx index d5be905..6fedf64 100644 --- a/src/components/TranslationContext.tsx +++ b/src/components/TranslationContext.tsx @@ -11,6 +11,7 @@ export type ContextProps = { secrets: Secrets workflowOptions?: WorkflowIdentifiers[] localeIdAdapter?: (id: string) => string | Promise + callbackUrl?: string } export const TranslationContext = React.createContext(null) diff --git a/src/components/TranslationsTab.tsx b/src/components/TranslationsTab.tsx index ebdffae..499e230 100644 --- a/src/components/TranslationsTab.tsx +++ b/src/components/TranslationsTab.tsx @@ -142,6 +142,7 @@ const TranslationTab = (props: TranslationTabProps) => { baseLanguage: props.options.baseLanguage, workflowOptions: props.options.workflowOptions, localeIdAdapter: props.options.localeIdAdapter, + callbackUrl: props.options.callbackUrl, }} > diff --git a/src/index.ts b/src/index.ts index b2b02b6..759b8d2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,6 +23,7 @@ import { BaseDocumentMerger, defaultStopTypes, customSerializers, + SerializedDocument, } from 'sanity-naive-html-serializer' export type { @@ -32,6 +33,7 @@ export type { ImportTranslation, TranslationFunctionContext, TranslationsTabConfigOptions, + SerializedDocument, } export { TranslationsTab, diff --git a/src/types.ts b/src/types.ts index 9fedc79..f2b9627 100644 --- a/src/types.ts +++ b/src/types.ts @@ -43,10 +43,11 @@ export interface Adapter { getTranslationTask: (documentId: string, secrets: Secrets | null) => Promise createTask: ( taskName: string, - document: Record, + serializedDocument: SerializedDocument, localeIds: string[], secrets: Secrets | null, workflowUid?: string, + callbackUrl?: string, ) => Promise getTranslation: (taskid: string, localeId: string, secrets: Secrets | null) => Promise } @@ -95,4 +96,5 @@ export type TranslationsTabConfigOptions = { workflowOptions?: WorkflowIdentifiers[] localeIdAdapter?: (id: string) => string languageField?: string + callbackUrl?: string }