@uniformdev/tms-sdk 19.165.1-alpha.0 → 19.165.2-alpha.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/index.esm.js +12 -27
- package/dist/index.js +12 -27
- package/dist/index.mjs +12 -27
- package/package.json +5 -5
package/dist/index.esm.js
CHANGED
|
@@ -290,52 +290,40 @@ var processParameterTranslation = ({
|
|
|
290
290
|
originalParameter,
|
|
291
291
|
parameter
|
|
292
292
|
}) => {
|
|
293
|
-
var _a, _b, _c
|
|
294
|
-
if (originalParameter.
|
|
293
|
+
var _a, _b, _c;
|
|
294
|
+
if (!originalParameter.locales) {
|
|
295
295
|
return { updated: false };
|
|
296
296
|
}
|
|
297
|
-
if (
|
|
297
|
+
if (originalParameter.type !== parameter.type) {
|
|
298
298
|
return { updated: false };
|
|
299
299
|
}
|
|
300
300
|
const sourceValue = (_a = parameter.locales) == null ? void 0 : _a[TRANSLATION_PAYLOAD_SOURCE_KEY];
|
|
301
301
|
const targetValue = (_b = parameter.locales) == null ? void 0 : _b[TRANSLATION_PAYLOAD_TARGET_KEY];
|
|
302
302
|
const originalTargetValue = (_c = parameter.locales) == null ? void 0 : _c[TRANSLATION_PAYLOAD_ORIGINAL_TARGET_KEY];
|
|
303
|
-
const originalParameterSource = originalParameter.locales ? originalParameter.locales[uniformSourceLocale] : originalParameter.value;
|
|
304
303
|
const isSourceValueUntouched = isSameParameterValue({
|
|
305
304
|
parameterType: originalParameter.type,
|
|
306
|
-
left:
|
|
305
|
+
left: originalParameter.locales[uniformSourceLocale],
|
|
307
306
|
right: sourceValue
|
|
308
307
|
});
|
|
309
308
|
const isTargetValueUntouched = isSameParameterValue({
|
|
310
309
|
parameterType: originalParameter.type,
|
|
311
|
-
left:
|
|
310
|
+
left: originalParameter.locales[uniformTargetLocale],
|
|
312
311
|
right: originalTargetValue
|
|
313
312
|
});
|
|
314
313
|
if (targetValue !== void 0 && isSourceValueUntouched && isTargetValueUntouched) {
|
|
315
314
|
if (parameter.type == SUPPORTED_PARAM_TYPES.richText && isTranslatableRichTextValue(targetValue)) {
|
|
316
315
|
try {
|
|
317
316
|
const richTextValue = parseTranslatableXml(targetValue);
|
|
318
|
-
|
|
317
|
+
originalParameter.locales[uniformTargetLocale] = richTextValue;
|
|
319
318
|
return { updated: true };
|
|
320
319
|
} catch (e) {
|
|
321
320
|
return { updated: false };
|
|
322
321
|
}
|
|
323
322
|
} else if (parameter.type == SUPPORTED_PARAM_TYPES.text) {
|
|
324
|
-
|
|
323
|
+
originalParameter.locales[uniformTargetLocale] = targetValue;
|
|
325
324
|
return { updated: true };
|
|
326
325
|
}
|
|
327
326
|
}
|
|
328
|
-
function updateOriginalParameterValue(value) {
|
|
329
|
-
if (originalParameter.locales) {
|
|
330
|
-
originalParameter.locales[uniformTargetLocale] = value;
|
|
331
|
-
} else if (originalParameter.value !== void 0) {
|
|
332
|
-
originalParameter.locales = {
|
|
333
|
-
[uniformSourceLocale]: originalParameter.value,
|
|
334
|
-
[uniformTargetLocale]: value
|
|
335
|
-
};
|
|
336
|
-
originalParameter.value = void 0;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
327
|
return { updated: false };
|
|
340
328
|
};
|
|
341
329
|
var processOverrideTranslation = ({
|
|
@@ -728,21 +716,18 @@ var translateComposition = ({
|
|
|
728
716
|
if (composition.composition._id !== translationPayload.metadata.entity.id) {
|
|
729
717
|
return createErrorResult("entity-id-mismatch");
|
|
730
718
|
}
|
|
719
|
+
const compositionLocales = (_a = composition.composition._locales) != null ? _a : [];
|
|
731
720
|
const uniformSourceLocale = translationPayload.metadata.uniformSourceLocale;
|
|
732
721
|
const uniformTargetLocale = translationPayload.metadata.uniformTargetLocale;
|
|
733
|
-
|
|
734
|
-
if (compositionLocales.length > 0 && !compositionLocales.includes(uniformSourceLocale)) {
|
|
722
|
+
if (!compositionLocales.includes(uniformSourceLocale)) {
|
|
735
723
|
return createErrorResult("entity-locales-mismatch");
|
|
736
724
|
}
|
|
737
725
|
let updated = false;
|
|
738
726
|
const translatedComposition = produce(composition, (draft) => {
|
|
739
|
-
var _a2, _b
|
|
727
|
+
var _a2, _b;
|
|
740
728
|
draft.state = CANVAS_DRAFT_STATE3;
|
|
741
|
-
if (!(
|
|
742
|
-
(
|
|
743
|
-
draft.composition._locales.push(uniformSourceLocale);
|
|
744
|
-
}
|
|
745
|
-
if (!draft.composition._locales.includes(uniformTargetLocale)) {
|
|
729
|
+
if (!compositionLocales.includes(uniformTargetLocale)) {
|
|
730
|
+
(_b = (_a2 = draft.composition)._locales) != null ? _b : _a2._locales = [];
|
|
746
731
|
draft.composition._locales.push(uniformTargetLocale);
|
|
747
732
|
}
|
|
748
733
|
walkNodeTree3(draft.composition, ({ node: component, type, actions }) => {
|
package/dist/index.js
CHANGED
|
@@ -318,52 +318,40 @@ var processParameterTranslation = ({
|
|
|
318
318
|
originalParameter,
|
|
319
319
|
parameter
|
|
320
320
|
}) => {
|
|
321
|
-
var _a, _b, _c
|
|
322
|
-
if (originalParameter.
|
|
321
|
+
var _a, _b, _c;
|
|
322
|
+
if (!originalParameter.locales) {
|
|
323
323
|
return { updated: false };
|
|
324
324
|
}
|
|
325
|
-
if (
|
|
325
|
+
if (originalParameter.type !== parameter.type) {
|
|
326
326
|
return { updated: false };
|
|
327
327
|
}
|
|
328
328
|
const sourceValue = (_a = parameter.locales) == null ? void 0 : _a[TRANSLATION_PAYLOAD_SOURCE_KEY];
|
|
329
329
|
const targetValue = (_b = parameter.locales) == null ? void 0 : _b[TRANSLATION_PAYLOAD_TARGET_KEY];
|
|
330
330
|
const originalTargetValue = (_c = parameter.locales) == null ? void 0 : _c[TRANSLATION_PAYLOAD_ORIGINAL_TARGET_KEY];
|
|
331
|
-
const originalParameterSource = originalParameter.locales ? originalParameter.locales[uniformSourceLocale] : originalParameter.value;
|
|
332
331
|
const isSourceValueUntouched = isSameParameterValue({
|
|
333
332
|
parameterType: originalParameter.type,
|
|
334
|
-
left:
|
|
333
|
+
left: originalParameter.locales[uniformSourceLocale],
|
|
335
334
|
right: sourceValue
|
|
336
335
|
});
|
|
337
336
|
const isTargetValueUntouched = isSameParameterValue({
|
|
338
337
|
parameterType: originalParameter.type,
|
|
339
|
-
left:
|
|
338
|
+
left: originalParameter.locales[uniformTargetLocale],
|
|
340
339
|
right: originalTargetValue
|
|
341
340
|
});
|
|
342
341
|
if (targetValue !== void 0 && isSourceValueUntouched && isTargetValueUntouched) {
|
|
343
342
|
if (parameter.type == SUPPORTED_PARAM_TYPES.richText && isTranslatableRichTextValue(targetValue)) {
|
|
344
343
|
try {
|
|
345
344
|
const richTextValue = parseTranslatableXml(targetValue);
|
|
346
|
-
|
|
345
|
+
originalParameter.locales[uniformTargetLocale] = richTextValue;
|
|
347
346
|
return { updated: true };
|
|
348
347
|
} catch (e) {
|
|
349
348
|
return { updated: false };
|
|
350
349
|
}
|
|
351
350
|
} else if (parameter.type == SUPPORTED_PARAM_TYPES.text) {
|
|
352
|
-
|
|
351
|
+
originalParameter.locales[uniformTargetLocale] = targetValue;
|
|
353
352
|
return { updated: true };
|
|
354
353
|
}
|
|
355
354
|
}
|
|
356
|
-
function updateOriginalParameterValue(value) {
|
|
357
|
-
if (originalParameter.locales) {
|
|
358
|
-
originalParameter.locales[uniformTargetLocale] = value;
|
|
359
|
-
} else if (originalParameter.value !== void 0) {
|
|
360
|
-
originalParameter.locales = {
|
|
361
|
-
[uniformSourceLocale]: originalParameter.value,
|
|
362
|
-
[uniformTargetLocale]: value
|
|
363
|
-
};
|
|
364
|
-
originalParameter.value = void 0;
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
355
|
return { updated: false };
|
|
368
356
|
};
|
|
369
357
|
var processOverrideTranslation = ({
|
|
@@ -756,21 +744,18 @@ var translateComposition = ({
|
|
|
756
744
|
if (composition.composition._id !== translationPayload.metadata.entity.id) {
|
|
757
745
|
return createErrorResult("entity-id-mismatch");
|
|
758
746
|
}
|
|
747
|
+
const compositionLocales = (_a = composition.composition._locales) != null ? _a : [];
|
|
759
748
|
const uniformSourceLocale = translationPayload.metadata.uniformSourceLocale;
|
|
760
749
|
const uniformTargetLocale = translationPayload.metadata.uniformTargetLocale;
|
|
761
|
-
|
|
762
|
-
if (compositionLocales.length > 0 && !compositionLocales.includes(uniformSourceLocale)) {
|
|
750
|
+
if (!compositionLocales.includes(uniformSourceLocale)) {
|
|
763
751
|
return createErrorResult("entity-locales-mismatch");
|
|
764
752
|
}
|
|
765
753
|
let updated = false;
|
|
766
754
|
const translatedComposition = (0, import_immer.produce)(composition, (draft) => {
|
|
767
|
-
var _a2, _b
|
|
755
|
+
var _a2, _b;
|
|
768
756
|
draft.state = import_canvas5.CANVAS_DRAFT_STATE;
|
|
769
|
-
if (!(
|
|
770
|
-
(
|
|
771
|
-
draft.composition._locales.push(uniformSourceLocale);
|
|
772
|
-
}
|
|
773
|
-
if (!draft.composition._locales.includes(uniformTargetLocale)) {
|
|
757
|
+
if (!compositionLocales.includes(uniformTargetLocale)) {
|
|
758
|
+
(_b = (_a2 = draft.composition)._locales) != null ? _b : _a2._locales = [];
|
|
774
759
|
draft.composition._locales.push(uniformTargetLocale);
|
|
775
760
|
}
|
|
776
761
|
(0, import_canvas5.walkNodeTree)(draft.composition, ({ node: component, type, actions }) => {
|
package/dist/index.mjs
CHANGED
|
@@ -290,52 +290,40 @@ var processParameterTranslation = ({
|
|
|
290
290
|
originalParameter,
|
|
291
291
|
parameter
|
|
292
292
|
}) => {
|
|
293
|
-
var _a, _b, _c
|
|
294
|
-
if (originalParameter.
|
|
293
|
+
var _a, _b, _c;
|
|
294
|
+
if (!originalParameter.locales) {
|
|
295
295
|
return { updated: false };
|
|
296
296
|
}
|
|
297
|
-
if (
|
|
297
|
+
if (originalParameter.type !== parameter.type) {
|
|
298
298
|
return { updated: false };
|
|
299
299
|
}
|
|
300
300
|
const sourceValue = (_a = parameter.locales) == null ? void 0 : _a[TRANSLATION_PAYLOAD_SOURCE_KEY];
|
|
301
301
|
const targetValue = (_b = parameter.locales) == null ? void 0 : _b[TRANSLATION_PAYLOAD_TARGET_KEY];
|
|
302
302
|
const originalTargetValue = (_c = parameter.locales) == null ? void 0 : _c[TRANSLATION_PAYLOAD_ORIGINAL_TARGET_KEY];
|
|
303
|
-
const originalParameterSource = originalParameter.locales ? originalParameter.locales[uniformSourceLocale] : originalParameter.value;
|
|
304
303
|
const isSourceValueUntouched = isSameParameterValue({
|
|
305
304
|
parameterType: originalParameter.type,
|
|
306
|
-
left:
|
|
305
|
+
left: originalParameter.locales[uniformSourceLocale],
|
|
307
306
|
right: sourceValue
|
|
308
307
|
});
|
|
309
308
|
const isTargetValueUntouched = isSameParameterValue({
|
|
310
309
|
parameterType: originalParameter.type,
|
|
311
|
-
left:
|
|
310
|
+
left: originalParameter.locales[uniformTargetLocale],
|
|
312
311
|
right: originalTargetValue
|
|
313
312
|
});
|
|
314
313
|
if (targetValue !== void 0 && isSourceValueUntouched && isTargetValueUntouched) {
|
|
315
314
|
if (parameter.type == SUPPORTED_PARAM_TYPES.richText && isTranslatableRichTextValue(targetValue)) {
|
|
316
315
|
try {
|
|
317
316
|
const richTextValue = parseTranslatableXml(targetValue);
|
|
318
|
-
|
|
317
|
+
originalParameter.locales[uniformTargetLocale] = richTextValue;
|
|
319
318
|
return { updated: true };
|
|
320
319
|
} catch (e) {
|
|
321
320
|
return { updated: false };
|
|
322
321
|
}
|
|
323
322
|
} else if (parameter.type == SUPPORTED_PARAM_TYPES.text) {
|
|
324
|
-
|
|
323
|
+
originalParameter.locales[uniformTargetLocale] = targetValue;
|
|
325
324
|
return { updated: true };
|
|
326
325
|
}
|
|
327
326
|
}
|
|
328
|
-
function updateOriginalParameterValue(value) {
|
|
329
|
-
if (originalParameter.locales) {
|
|
330
|
-
originalParameter.locales[uniformTargetLocale] = value;
|
|
331
|
-
} else if (originalParameter.value !== void 0) {
|
|
332
|
-
originalParameter.locales = {
|
|
333
|
-
[uniformSourceLocale]: originalParameter.value,
|
|
334
|
-
[uniformTargetLocale]: value
|
|
335
|
-
};
|
|
336
|
-
originalParameter.value = void 0;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
327
|
return { updated: false };
|
|
340
328
|
};
|
|
341
329
|
var processOverrideTranslation = ({
|
|
@@ -728,21 +716,18 @@ var translateComposition = ({
|
|
|
728
716
|
if (composition.composition._id !== translationPayload.metadata.entity.id) {
|
|
729
717
|
return createErrorResult("entity-id-mismatch");
|
|
730
718
|
}
|
|
719
|
+
const compositionLocales = (_a = composition.composition._locales) != null ? _a : [];
|
|
731
720
|
const uniformSourceLocale = translationPayload.metadata.uniformSourceLocale;
|
|
732
721
|
const uniformTargetLocale = translationPayload.metadata.uniformTargetLocale;
|
|
733
|
-
|
|
734
|
-
if (compositionLocales.length > 0 && !compositionLocales.includes(uniformSourceLocale)) {
|
|
722
|
+
if (!compositionLocales.includes(uniformSourceLocale)) {
|
|
735
723
|
return createErrorResult("entity-locales-mismatch");
|
|
736
724
|
}
|
|
737
725
|
let updated = false;
|
|
738
726
|
const translatedComposition = produce(composition, (draft) => {
|
|
739
|
-
var _a2, _b
|
|
727
|
+
var _a2, _b;
|
|
740
728
|
draft.state = CANVAS_DRAFT_STATE3;
|
|
741
|
-
if (!(
|
|
742
|
-
(
|
|
743
|
-
draft.composition._locales.push(uniformSourceLocale);
|
|
744
|
-
}
|
|
745
|
-
if (!draft.composition._locales.includes(uniformTargetLocale)) {
|
|
729
|
+
if (!compositionLocales.includes(uniformTargetLocale)) {
|
|
730
|
+
(_b = (_a2 = draft.composition)._locales) != null ? _b : _a2._locales = [];
|
|
746
731
|
draft.composition._locales.push(uniformTargetLocale);
|
|
747
732
|
}
|
|
748
733
|
walkNodeTree3(draft.composition, ({ node: component, type, actions }) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/tms-sdk",
|
|
3
|
-
"version": "19.165.
|
|
3
|
+
"version": "19.165.2-alpha.0+323887559d",
|
|
4
4
|
"description": "Uniform Translation Management System SDK",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@uniformdev/canvas": "19.165.
|
|
37
|
-
"@uniformdev/mesh-sdk": "19.165.
|
|
38
|
-
"@uniformdev/richtext": "19.165.
|
|
36
|
+
"@uniformdev/canvas": "19.165.2-alpha.0+323887559d",
|
|
37
|
+
"@uniformdev/mesh-sdk": "19.165.2-alpha.0+323887559d",
|
|
38
|
+
"@uniformdev/richtext": "19.165.2-alpha.0+323887559d",
|
|
39
39
|
"dequal": "2.0.3",
|
|
40
40
|
"fast-xml-parser": "4.4.0",
|
|
41
41
|
"immer": "10.0.4"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "323887559d1bdc7432f91d305afaec90b98f660f"
|
|
44
44
|
}
|