sanity-plugin-studio-smartling 1.3.0 → 2.0.0
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/adapter/createTask.d.ts +7 -1
- package/dist/adapter/getTranslationTask.d.ts +6 -0
- package/dist/index.d.ts +10 -13
- package/dist/sanity-plugin-studio-smartling.cjs.development.js +61 -308
- package/dist/sanity-plugin-studio-smartling.cjs.development.js.map +1 -1
- package/dist/sanity-plugin-studio-smartling.cjs.production.min.js +1 -1
- package/dist/sanity-plugin-studio-smartling.cjs.production.min.js.map +1 -1
- package/dist/sanity-plugin-studio-smartling.esm.js +47 -298
- package/dist/sanity-plugin-studio-smartling.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/adapter/createTask.ts +27 -8
- package/src/adapter/getTranslation.ts +10 -1
- package/src/adapter/getTranslationTask.ts +4 -2
- package/src/index.ts +21 -32
- package/dist/helpers.d.ts +0 -5
- package/src/helpers.ts +0 -116
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { BaseDocumentDeserializer, BaseDocumentMerger, BaseDocumentSerializer, customSerializers, defaultStopTypes } from 'sanity-naive-html-serializer';
|
|
4
|
-
import sanityClient from 'part:@sanity/base/client';
|
|
1
|
+
import { baseFieldLevelConfig, baseDocumentLevelConfig } from 'sanity-translations-tab';
|
|
2
|
+
export { BaseDocumentDeserializer, BaseDocumentMerger, BaseDocumentSerializer, TranslationsTab, customSerializers, defaultStopTypes, findLatestDraft } from 'sanity-translations-tab';
|
|
5
3
|
|
|
6
4
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
7
5
|
try {
|
|
@@ -929,7 +927,7 @@ var getLocales = /*#__PURE__*/function () {
|
|
|
929
927
|
|
|
930
928
|
var getTranslationTask = /*#__PURE__*/function () {
|
|
931
929
|
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(documentId, secrets) {
|
|
932
|
-
var accessToken, taskId,
|
|
930
|
+
var accessToken, taskId, projectId, progressUrl, smartlingTask, locales;
|
|
933
931
|
return runtime_1.wrap(function _callee$(_context) {
|
|
934
932
|
while (1) {
|
|
935
933
|
switch (_context.prev = _context.next) {
|
|
@@ -957,18 +955,19 @@ var getTranslationTask = /*#__PURE__*/function () {
|
|
|
957
955
|
});
|
|
958
956
|
|
|
959
957
|
case 8:
|
|
960
|
-
|
|
961
|
-
|
|
958
|
+
projectId = secrets.project;
|
|
959
|
+
progressUrl = "https://api.smartling.com/jobs-api/v3/projects/" + projectId + "/jobs/" + taskId + "/progress";
|
|
960
|
+
_context.next = 12;
|
|
962
961
|
return fetch(smartlingProxy, {
|
|
963
962
|
method: 'POST',
|
|
964
|
-
headers: getHeaders(
|
|
963
|
+
headers: getHeaders(progressUrl, accessToken)
|
|
965
964
|
}).then(function (res) {
|
|
966
965
|
return res.json();
|
|
967
966
|
}).then(function (res) {
|
|
968
967
|
return res.response.data;
|
|
969
968
|
});
|
|
970
969
|
|
|
971
|
-
case
|
|
970
|
+
case 12:
|
|
972
971
|
smartlingTask = _context.sent;
|
|
973
972
|
locales = [];
|
|
974
973
|
|
|
@@ -985,10 +984,11 @@ var getTranslationTask = /*#__PURE__*/function () {
|
|
|
985
984
|
documentId: documentId,
|
|
986
985
|
locales: locales,
|
|
987
986
|
//since our download is tied to document id for smartling, keep track of it as a task
|
|
988
|
-
taskId: documentId
|
|
987
|
+
taskId: documentId,
|
|
988
|
+
linkToVendorTask: "https://dashboard.smartling.com/app/projects/" + projectId + "/account-jobs/" + projectId + ":" + taskId
|
|
989
989
|
});
|
|
990
990
|
|
|
991
|
-
case
|
|
991
|
+
case 16:
|
|
992
992
|
case "end":
|
|
993
993
|
return _context.stop();
|
|
994
994
|
}
|
|
@@ -1044,30 +1044,41 @@ var createJob = /*#__PURE__*/function () {
|
|
|
1044
1044
|
|
|
1045
1045
|
|
|
1046
1046
|
var createJobBatch = /*#__PURE__*/function () {
|
|
1047
|
-
var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(jobId, projectId, documentName, accessToken) {
|
|
1048
|
-
var url;
|
|
1047
|
+
var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(jobId, projectId, documentName, accessToken, localeIds, workflowUid) {
|
|
1048
|
+
var url, reqBody;
|
|
1049
1049
|
return runtime_1.wrap(function _callee2$(_context2) {
|
|
1050
1050
|
while (1) {
|
|
1051
1051
|
switch (_context2.prev = _context2.next) {
|
|
1052
1052
|
case 0:
|
|
1053
1053
|
url = "https://api.smartling.com/job-batches-api/v2/projects/" + projectId + "/batches";
|
|
1054
|
+
reqBody = {
|
|
1055
|
+
authorize: true,
|
|
1056
|
+
translationJobUid: jobId,
|
|
1057
|
+
fileUris: [documentName]
|
|
1058
|
+
};
|
|
1059
|
+
|
|
1060
|
+
if (workflowUid) {
|
|
1061
|
+
reqBody.localeWorkflows = localeIds.map(function (l) {
|
|
1062
|
+
return {
|
|
1063
|
+
targetLocaleId: l,
|
|
1064
|
+
workflowUid: workflowUid
|
|
1065
|
+
};
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1054
1069
|
return _context2.abrupt("return", fetch(smartlingProxy, {
|
|
1055
1070
|
method: 'POST',
|
|
1056
1071
|
headers: _extends({}, getHeaders(url, accessToken), {
|
|
1057
1072
|
'content-type': 'application/json'
|
|
1058
1073
|
}),
|
|
1059
|
-
body: JSON.stringify(
|
|
1060
|
-
authorize: true,
|
|
1061
|
-
translationJobUid: jobId,
|
|
1062
|
-
fileUris: [documentName]
|
|
1063
|
-
})
|
|
1074
|
+
body: JSON.stringify(reqBody)
|
|
1064
1075
|
}).then(function (res) {
|
|
1065
1076
|
return res.json();
|
|
1066
1077
|
}).then(function (res) {
|
|
1067
1078
|
return res.response.data.batchUid;
|
|
1068
1079
|
}));
|
|
1069
1080
|
|
|
1070
|
-
case
|
|
1081
|
+
case 4:
|
|
1071
1082
|
case "end":
|
|
1072
1083
|
return _context2.stop();
|
|
1073
1084
|
}
|
|
@@ -1075,7 +1086,7 @@ var createJobBatch = /*#__PURE__*/function () {
|
|
|
1075
1086
|
}, _callee2);
|
|
1076
1087
|
}));
|
|
1077
1088
|
|
|
1078
|
-
return function createJobBatch(_x5, _x6, _x7, _x8) {
|
|
1089
|
+
return function createJobBatch(_x5, _x6, _x7, _x8, _x9, _x10) {
|
|
1079
1090
|
return _ref2.apply(this, arguments);
|
|
1080
1091
|
};
|
|
1081
1092
|
}();
|
|
@@ -1112,13 +1123,13 @@ var uploadFileToBatch = /*#__PURE__*/function () {
|
|
|
1112
1123
|
}, _callee3);
|
|
1113
1124
|
}));
|
|
1114
1125
|
|
|
1115
|
-
return function uploadFileToBatch(
|
|
1126
|
+
return function uploadFileToBatch(_x11, _x12, _x13, _x14, _x15) {
|
|
1116
1127
|
return _ref3.apply(this, arguments);
|
|
1117
1128
|
};
|
|
1118
1129
|
}();
|
|
1119
1130
|
|
|
1120
1131
|
var createTask = /*#__PURE__*/function () {
|
|
1121
|
-
var _ref4 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(documentId, document, localeIds, secrets) {
|
|
1132
|
+
var _ref4 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(documentId, document, localeIds, secrets, workflowUid) {
|
|
1122
1133
|
var accessToken, taskId, batchUid, uploadFileRes;
|
|
1123
1134
|
return runtime_1.wrap(function _callee4$(_context4) {
|
|
1124
1135
|
while (1) {
|
|
@@ -1148,7 +1159,7 @@ var createTask = /*#__PURE__*/function () {
|
|
|
1148
1159
|
|
|
1149
1160
|
case 10:
|
|
1150
1161
|
_context4.next = 12;
|
|
1151
|
-
return createJobBatch(taskId, secrets.project, document.name, accessToken);
|
|
1162
|
+
return createJobBatch(taskId, secrets.project, document.name, accessToken, localeIds, workflowUid);
|
|
1152
1163
|
|
|
1153
1164
|
case 12:
|
|
1154
1165
|
batchUid = _context4.sent;
|
|
@@ -1168,7 +1179,7 @@ var createTask = /*#__PURE__*/function () {
|
|
|
1168
1179
|
}, _callee4);
|
|
1169
1180
|
}));
|
|
1170
1181
|
|
|
1171
|
-
return function createTask(
|
|
1182
|
+
return function createTask(_x16, _x17, _x18, _x19, _x20) {
|
|
1172
1183
|
return _ref4.apply(this, arguments);
|
|
1173
1184
|
};
|
|
1174
1185
|
}();
|
|
@@ -1193,7 +1204,14 @@ var getTranslation = /*#__PURE__*/function () {
|
|
|
1193
1204
|
}).then(function (res) {
|
|
1194
1205
|
return res.json();
|
|
1195
1206
|
}).then(function (res) {
|
|
1196
|
-
|
|
1207
|
+
if (res.body) {
|
|
1208
|
+
return res.body;
|
|
1209
|
+
} else if (res.response.errors) {
|
|
1210
|
+
var _res$response$errors$;
|
|
1211
|
+
|
|
1212
|
+
var errMsg = ((_res$response$errors$ = res.response.errors[0]) == null ? void 0 : _res$response$errors$.message) || 'Error retrieving translation from Smartling';
|
|
1213
|
+
throw new Error(errMsg);
|
|
1214
|
+
}
|
|
1197
1215
|
});
|
|
1198
1216
|
|
|
1199
1217
|
case 6:
|
|
@@ -1220,282 +1238,13 @@ var SmartlingAdapter = {
|
|
|
1220
1238
|
getTranslation: getTranslation
|
|
1221
1239
|
};
|
|
1222
1240
|
|
|
1223
|
-
var
|
|
1224
|
-
apiVersion: '2021-03-25'
|
|
1225
|
-
}); //document fetch
|
|
1226
|
-
|
|
1227
|
-
var findLatestDraft = function findLatestDraft(documentId, ignoreI18n) {
|
|
1228
|
-
if (ignoreI18n === void 0) {
|
|
1229
|
-
ignoreI18n = true;
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
//eliminates i18n versions
|
|
1233
|
-
var query = "*[_id match $id " + (ignoreI18n ? ' && (_id in path("drafts.*") || _id in path("*"))' : '') + "]";
|
|
1234
|
-
var params = {
|
|
1235
|
-
id: "*" + documentId
|
|
1236
|
-
};
|
|
1237
|
-
return client.fetch(query, params).then(function (docs) {
|
|
1238
|
-
var _docs$find;
|
|
1239
|
-
|
|
1240
|
-
return (_docs$find = docs.find(function (doc) {
|
|
1241
|
-
return doc._id.includes('draft');
|
|
1242
|
-
})) != null ? _docs$find : docs[0];
|
|
1243
|
-
});
|
|
1244
|
-
}; //revision fetch
|
|
1245
|
-
|
|
1246
|
-
var findDocumentAtRevision = /*#__PURE__*/function () {
|
|
1247
|
-
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(documentId, rev) {
|
|
1248
|
-
var dataset, baseUrl, url, revisionDoc;
|
|
1249
|
-
return runtime_1.wrap(function _callee$(_context) {
|
|
1250
|
-
while (1) {
|
|
1251
|
-
switch (_context.prev = _context.next) {
|
|
1252
|
-
case 0:
|
|
1253
|
-
dataset = client.config().dataset;
|
|
1254
|
-
baseUrl = "/data/history/" + dataset + "/documents/" + documentId + "?revision=" + rev;
|
|
1255
|
-
url = client.getUrl(baseUrl);
|
|
1256
|
-
_context.next = 5;
|
|
1257
|
-
return fetch(url, {
|
|
1258
|
-
credentials: 'include'
|
|
1259
|
-
}).then(function (req) {
|
|
1260
|
-
return req.json();
|
|
1261
|
-
}).then(function (req) {
|
|
1262
|
-
return req.documents[0];
|
|
1263
|
-
});
|
|
1264
|
-
|
|
1265
|
-
case 5:
|
|
1266
|
-
revisionDoc = _context.sent;
|
|
1267
|
-
|
|
1268
|
-
if (!(!revisionDoc || revisionDoc._rev !== rev)) {
|
|
1269
|
-
_context.next = 12;
|
|
1270
|
-
break;
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
baseUrl = "/data/history/" + dataset + "/documents/drafts." + documentId + "?revision=" + rev;
|
|
1274
|
-
url = client.getUrl(baseUrl);
|
|
1275
|
-
_context.next = 11;
|
|
1276
|
-
return fetch(url, {
|
|
1277
|
-
credentials: 'include'
|
|
1278
|
-
}).then(function (req) {
|
|
1279
|
-
return req.json();
|
|
1280
|
-
}).then(function (req) {
|
|
1281
|
-
return req.documents[0];
|
|
1282
|
-
});
|
|
1283
|
-
|
|
1284
|
-
case 11:
|
|
1285
|
-
revisionDoc = _context.sent;
|
|
1286
|
-
|
|
1287
|
-
case 12:
|
|
1288
|
-
return _context.abrupt("return", revisionDoc);
|
|
1289
|
-
|
|
1290
|
-
case 13:
|
|
1291
|
-
case "end":
|
|
1292
|
-
return _context.stop();
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
}, _callee);
|
|
1296
|
-
}));
|
|
1297
|
-
|
|
1298
|
-
return function findDocumentAtRevision(_x, _x2) {
|
|
1299
|
-
return _ref.apply(this, arguments);
|
|
1300
|
-
};
|
|
1301
|
-
}(); //document-level patch
|
|
1302
|
-
|
|
1303
|
-
var documentLevelPatch = /*#__PURE__*/function () {
|
|
1304
|
-
var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(documentId, translatedFields, localeId) {
|
|
1305
|
-
var baseDoc, merged, targetId, i18nDoc, cleanedMerge;
|
|
1306
|
-
return runtime_1.wrap(function _callee2$(_context2) {
|
|
1307
|
-
while (1) {
|
|
1308
|
-
switch (_context2.prev = _context2.next) {
|
|
1309
|
-
case 0:
|
|
1310
|
-
if (!translatedFields._rev) {
|
|
1311
|
-
_context2.next = 6;
|
|
1312
|
-
break;
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
_context2.next = 3;
|
|
1316
|
-
return findDocumentAtRevision(documentId, translatedFields._rev);
|
|
1317
|
-
|
|
1318
|
-
case 3:
|
|
1319
|
-
baseDoc = _context2.sent;
|
|
1320
|
-
_context2.next = 9;
|
|
1321
|
-
break;
|
|
1322
|
-
|
|
1323
|
-
case 6:
|
|
1324
|
-
_context2.next = 8;
|
|
1325
|
-
return findLatestDraft(documentId);
|
|
1326
|
-
|
|
1327
|
-
case 8:
|
|
1328
|
-
baseDoc = _context2.sent;
|
|
1329
|
-
|
|
1330
|
-
case 9:
|
|
1331
|
-
merged = BaseDocumentMerger.documentLevelMerge(translatedFields, baseDoc);
|
|
1332
|
-
targetId = "i18n." + documentId + "." + localeId;
|
|
1333
|
-
_context2.next = 13;
|
|
1334
|
-
return findLatestDraft(targetId, false);
|
|
1335
|
-
|
|
1336
|
-
case 13:
|
|
1337
|
-
i18nDoc = _context2.sent;
|
|
1338
|
-
|
|
1339
|
-
if (i18nDoc) {
|
|
1340
|
-
cleanedMerge = {}; //don't overwrite any existing values on the i18n doc
|
|
1341
|
-
|
|
1342
|
-
Object.entries(merged).forEach(function (_ref3) {
|
|
1343
|
-
var key = _ref3[0],
|
|
1344
|
-
value = _ref3[1];
|
|
1345
|
-
|
|
1346
|
-
if (Object.keys(translatedFields).includes(key) && !['_id', '_rev', '_updatedAt'].includes(key)) {
|
|
1347
|
-
cleanedMerge[key] = value;
|
|
1348
|
-
}
|
|
1349
|
-
});
|
|
1350
|
-
client.transaction() //@ts-ignore
|
|
1351
|
-
.patch(i18nDoc._id, function (p) {
|
|
1352
|
-
return p.set(cleanedMerge);
|
|
1353
|
-
}).commit();
|
|
1354
|
-
} else {
|
|
1355
|
-
merged._id = "drafts." + targetId; //account for legacy implementations of i18n plugin lang
|
|
1356
|
-
|
|
1357
|
-
if (baseDoc._lang) {
|
|
1358
|
-
merged._lang = localeId;
|
|
1359
|
-
} else if (baseDoc.__i18n_lang) {
|
|
1360
|
-
merged.__i18n_lang = localeId;
|
|
1361
|
-
}
|
|
1362
|
-
|
|
1363
|
-
client.create(merged);
|
|
1364
|
-
}
|
|
1365
|
-
|
|
1366
|
-
case 15:
|
|
1367
|
-
case "end":
|
|
1368
|
-
return _context2.stop();
|
|
1369
|
-
}
|
|
1370
|
-
}
|
|
1371
|
-
}, _callee2);
|
|
1372
|
-
}));
|
|
1373
|
-
|
|
1374
|
-
return function documentLevelPatch(_x3, _x4, _x5) {
|
|
1375
|
-
return _ref2.apply(this, arguments);
|
|
1376
|
-
};
|
|
1377
|
-
}(); //field level patch
|
|
1378
|
-
|
|
1379
|
-
var fieldLevelPatch = /*#__PURE__*/function () {
|
|
1380
|
-
var _ref4 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(documentId, translatedFields, localeId) {
|
|
1381
|
-
var baseDoc, merged;
|
|
1382
|
-
return runtime_1.wrap(function _callee3$(_context3) {
|
|
1383
|
-
while (1) {
|
|
1384
|
-
switch (_context3.prev = _context3.next) {
|
|
1385
|
-
case 0:
|
|
1386
|
-
if (!translatedFields._rev) {
|
|
1387
|
-
_context3.next = 6;
|
|
1388
|
-
break;
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1391
|
-
_context3.next = 3;
|
|
1392
|
-
return findDocumentAtRevision(documentId, translatedFields._rev);
|
|
1393
|
-
|
|
1394
|
-
case 3:
|
|
1395
|
-
baseDoc = _context3.sent;
|
|
1396
|
-
_context3.next = 9;
|
|
1397
|
-
break;
|
|
1398
|
-
|
|
1399
|
-
case 6:
|
|
1400
|
-
_context3.next = 8;
|
|
1401
|
-
return findLatestDraft(documentId);
|
|
1402
|
-
|
|
1403
|
-
case 8:
|
|
1404
|
-
baseDoc = _context3.sent;
|
|
1405
|
-
|
|
1406
|
-
case 9:
|
|
1407
|
-
merged = BaseDocumentMerger.fieldLevelMerge(translatedFields, baseDoc, localeId, 'en');
|
|
1408
|
-
client.patch(baseDoc._id).set(merged).commit();
|
|
1409
|
-
|
|
1410
|
-
case 11:
|
|
1411
|
-
case "end":
|
|
1412
|
-
return _context3.stop();
|
|
1413
|
-
}
|
|
1414
|
-
}
|
|
1415
|
-
}, _callee3);
|
|
1416
|
-
}));
|
|
1417
|
-
|
|
1418
|
-
return function fieldLevelPatch(_x6, _x7, _x8) {
|
|
1419
|
-
return _ref4.apply(this, arguments);
|
|
1420
|
-
};
|
|
1421
|
-
}();
|
|
1422
|
-
|
|
1423
|
-
var defaultDocumentLevelConfig = {
|
|
1424
|
-
exportForTranslation: /*#__PURE__*/function () {
|
|
1425
|
-
var _exportForTranslation = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(id) {
|
|
1426
|
-
var doc, serialized;
|
|
1427
|
-
return runtime_1.wrap(function _callee$(_context) {
|
|
1428
|
-
while (1) {
|
|
1429
|
-
switch (_context.prev = _context.next) {
|
|
1430
|
-
case 0:
|
|
1431
|
-
_context.next = 2;
|
|
1432
|
-
return findLatestDraft(id);
|
|
1433
|
-
|
|
1434
|
-
case 2:
|
|
1435
|
-
doc = _context.sent;
|
|
1436
|
-
serialized = BaseDocumentSerializer.serializeDocument(doc, 'document'); //needed for lookup by translation tab
|
|
1437
|
-
|
|
1438
|
-
serialized.name = id;
|
|
1439
|
-
return _context.abrupt("return", serialized);
|
|
1440
|
-
|
|
1441
|
-
case 6:
|
|
1442
|
-
case "end":
|
|
1443
|
-
return _context.stop();
|
|
1444
|
-
}
|
|
1445
|
-
}
|
|
1446
|
-
}, _callee);
|
|
1447
|
-
}));
|
|
1448
|
-
|
|
1449
|
-
function exportForTranslation(_x) {
|
|
1450
|
-
return _exportForTranslation.apply(this, arguments);
|
|
1451
|
-
}
|
|
1452
|
-
|
|
1453
|
-
return exportForTranslation;
|
|
1454
|
-
}(),
|
|
1455
|
-
importTranslation: function importTranslation(id, localeId, document) {
|
|
1456
|
-
var deserialized = BaseDocumentDeserializer.deserializeDocument(document);
|
|
1457
|
-
documentLevelPatch(id, deserialized, localeId);
|
|
1458
|
-
},
|
|
1241
|
+
var defaultDocumentLevelConfig = /*#__PURE__*/_extends({}, baseDocumentLevelConfig, {
|
|
1459
1242
|
adapter: SmartlingAdapter
|
|
1460
|
-
};
|
|
1461
|
-
var defaultFieldLevelConfig = {
|
|
1462
|
-
exportForTranslation: /*#__PURE__*/function () {
|
|
1463
|
-
var _exportForTranslation2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(id) {
|
|
1464
|
-
var doc, serialized;
|
|
1465
|
-
return runtime_1.wrap(function _callee2$(_context2) {
|
|
1466
|
-
while (1) {
|
|
1467
|
-
switch (_context2.prev = _context2.next) {
|
|
1468
|
-
case 0:
|
|
1469
|
-
_context2.next = 2;
|
|
1470
|
-
return findLatestDraft(id);
|
|
1471
|
-
|
|
1472
|
-
case 2:
|
|
1473
|
-
doc = _context2.sent;
|
|
1474
|
-
serialized = BaseDocumentSerializer.serializeDocument(doc, 'field'); //needed for lookup by translation tab
|
|
1475
|
-
|
|
1476
|
-
serialized.name = id;
|
|
1477
|
-
return _context2.abrupt("return", serialized);
|
|
1478
|
-
|
|
1479
|
-
case 6:
|
|
1480
|
-
case "end":
|
|
1481
|
-
return _context2.stop();
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
}, _callee2);
|
|
1485
|
-
}));
|
|
1486
|
-
|
|
1487
|
-
function exportForTranslation(_x2) {
|
|
1488
|
-
return _exportForTranslation2.apply(this, arguments);
|
|
1489
|
-
}
|
|
1243
|
+
});
|
|
1490
1244
|
|
|
1491
|
-
|
|
1492
|
-
}(),
|
|
1493
|
-
importTranslation: function importTranslation(id, localeId, document) {
|
|
1494
|
-
var deserialized = BaseDocumentDeserializer.deserializeDocument(document);
|
|
1495
|
-
fieldLevelPatch(id, deserialized, localeId);
|
|
1496
|
-
},
|
|
1245
|
+
var defaultFieldLevelConfig = /*#__PURE__*/_extends({}, baseFieldLevelConfig, {
|
|
1497
1246
|
adapter: SmartlingAdapter
|
|
1498
|
-
};
|
|
1247
|
+
});
|
|
1499
1248
|
|
|
1500
1249
|
export { SmartlingAdapter, defaultDocumentLevelConfig, defaultFieldLevelConfig };
|
|
1501
1250
|
//# sourceMappingURL=sanity-plugin-studio-smartling.esm.js.map
|