Skip to content

Commit

Permalink
fix: use updated types from tab
Browse files Browse the repository at this point in the history
  • Loading branch information
cngonzalez committed Nov 6, 2023
1 parent e9ac073 commit 7c11d6a
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 43 deletions.
66 changes: 33 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sanity-plugin-studio-smartling",
"version": "4.3.0-beta",
"version": "4.2.0",
"description": "!smartling gif",
"keywords": [
"sanity",
Expand Down Expand Up @@ -48,7 +48,7 @@
},
"dependencies": {
"@sanity/incompatible-plugin": "^1.0.4",
"sanity-translations-tab": "^4.1.0"
"sanity-translations-tab": "^4.2.0"
},
"devDependencies": {
"@commitlint/cli": "^17.7.1",
Expand Down
15 changes: 7 additions & 8 deletions src/adapter/createTask.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {authenticate, getHeaders, findExistingJob} from './helpers'
import {Adapter, Secrets} from 'sanity-translations-tab'
import {Adapter, Secrets, SerializedDocument} from 'sanity-translations-tab'
import {getTranslationTask} from './getTranslationTask'
import {Buffer} from 'buffer'

Expand Down Expand Up @@ -89,11 +89,11 @@ const createJobBatch = (
const uploadFileToBatch = (
batchUid: string,
documentId: string,
document: Record<string, any>,
document: SerializedDocument,
secrets: Secrets,
localeIds: string[],
accessToken: string,
callbackUrl?: (serializedDocument: Record<string, any>) => string,
callbackUrl?: string,
//eslint-disable-next-line max-params
) => {
const {project, proxy} = secrets
Expand All @@ -109,9 +109,8 @@ const uploadFileToBatch = (
const htmlBuffer = Buffer.from(document.content, 'utf-8')
formData.append('file', new Blob([htmlBuffer]), `${document.name}.html`)
localeIds.forEach((localeId) => formData.append('localeIdsToAuthorize[]', localeId))

if (callbackUrl && typeof callbackUrl === 'function') {
formData.append('callbackUrl', callbackUrl(document))
if (callbackUrl) {
formData.append('callbackUrl', callbackUrl)
}

return fetch(proxy, {
Expand All @@ -123,11 +122,11 @@ const uploadFileToBatch = (

export const createTask: Adapter['createTask'] = async (
documentId: string,
document: Record<string, any>,
document: SerializedDocument,
localeIds: string[],
secrets: Secrets | null,
workflowUid?: string,
callbackUrl?: (serializedDocument: Record<string, any>) => string,
callbackUrl?: string,
// eslint-disable-next-line max-params
) => {
if (!secrets?.project || !secrets?.secret || !secrets?.proxy) {
Expand Down

0 comments on commit 7c11d6a

Please sign in to comment.