@uniformdev/tms-sdk 19.154.1-alpha.24 → 19.154.1-alpha.27
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.d.mts +8 -13
- package/dist/index.d.ts +8 -13
- package/dist/index.esm.js +10 -30
- package/dist/index.js +10 -30
- package/dist/index.mjs +10 -30
- package/package.json +5 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ComponentInstance, RootComponentInstance, EntryData, CanvasClient, CompositionGetResponse, ContentClient, Entry } from '@uniformdev/canvas';
|
|
2
|
+
import { CanvasEditorEntityType } from '@uniformdev/mesh-sdk';
|
|
2
3
|
|
|
3
4
|
type ComponentTranslationPayload = Pick<ComponentInstance, '_id' | 'type' | 'parameters' | 'slots' | '_overrides'>;
|
|
5
|
+
type EntityType = CanvasEditorEntityType;
|
|
4
6
|
type TranslationPayload = {
|
|
5
7
|
schemaVersion: number;
|
|
6
8
|
metadata: {
|
|
@@ -9,12 +11,11 @@ type TranslationPayload = {
|
|
|
9
11
|
uniformTargetLocale: string;
|
|
10
12
|
uniformReleaseId?: string;
|
|
11
13
|
targetLang: string;
|
|
12
|
-
entityType:
|
|
14
|
+
entityType: EntityType;
|
|
13
15
|
entity: {
|
|
14
16
|
id: string;
|
|
15
17
|
slug: string | null | undefined;
|
|
16
18
|
};
|
|
17
|
-
overrideModifiedTargetLocale: boolean;
|
|
18
19
|
};
|
|
19
20
|
components: {
|
|
20
21
|
[componentId: string]: ComponentTranslationPayload | undefined;
|
|
@@ -34,18 +35,14 @@ type CollectTranslationPayloadResult = {
|
|
|
34
35
|
errorKind?: 'unknown' | 'invalid-args' | 'entity-source-locale-missing';
|
|
35
36
|
errorText?: string;
|
|
36
37
|
};
|
|
37
|
-
declare const collectTranslationPayload: ({ uniformProjectId, uniformSourceLocale, uniformTargetLocale, uniformReleaseId, targetLang, entity, entityType,
|
|
38
|
+
declare const collectTranslationPayload: ({ uniformProjectId, uniformSourceLocale, uniformTargetLocale, uniformReleaseId, targetLang, entity, entityType, }: {
|
|
38
39
|
uniformProjectId: string;
|
|
39
40
|
uniformSourceLocale: string;
|
|
40
41
|
uniformTargetLocale: string;
|
|
41
42
|
uniformReleaseId: string | undefined;
|
|
42
43
|
targetLang: string;
|
|
43
44
|
entity: RootComponentInstance | EntryData;
|
|
44
|
-
entityType:
|
|
45
|
-
/**
|
|
46
|
-
* Ignore modified content in target locales and collect all supported parameters for translation
|
|
47
|
-
*/
|
|
48
|
-
overrideModifiedTargetLocale: boolean;
|
|
45
|
+
entityType: EntityType;
|
|
49
46
|
}) => CollectTranslationPayloadResult;
|
|
50
47
|
|
|
51
48
|
declare const getCompositionForTranslation: ({ canvasClient, compositionId, releaseId, state, }: {
|
|
@@ -111,16 +108,14 @@ declare const mergeTranslationToUniform: ({ canvasClient, contentClient, transla
|
|
|
111
108
|
entityId?: string | undefined;
|
|
112
109
|
}>;
|
|
113
110
|
|
|
114
|
-
declare const translateComposition: ({ composition, translationPayload,
|
|
111
|
+
declare const translateComposition: ({ composition, translationPayload, }: {
|
|
115
112
|
composition: CompositionGetResponse;
|
|
116
113
|
translationPayload: TranslationPayload;
|
|
117
|
-
overrideModifiedTargetLocale: boolean;
|
|
118
114
|
}) => EntityTranslationResult<CompositionGetResponse>;
|
|
119
115
|
|
|
120
|
-
declare const translateEntry: ({ entry, translationPayload,
|
|
116
|
+
declare const translateEntry: ({ entry, translationPayload, }: {
|
|
121
117
|
entry: Entry;
|
|
122
118
|
translationPayload: TranslationPayload;
|
|
123
|
-
overrideModifiedTargetLocale: boolean;
|
|
124
119
|
}) => EntityTranslationResult<Entry>;
|
|
125
120
|
|
|
126
|
-
export { type CollectTranslationPayloadResult, type ComponentTranslationPayload, type EntityTranslationResult, type MaybePromise, type MergeCompositionTranslationToUniformOptions, type MergeEntryTranslationToUniformOptions, type MergeTranslationToUniformOptions, type TranslationPayload, collectTranslationPayload, getCompositionForTranslation, getEntryForTranslation, mergeCompositionTranslationToUniform, mergeEntryTranslationToUniform, mergeTranslationToUniform, translateComposition, translateEntry };
|
|
121
|
+
export { type CollectTranslationPayloadResult, type ComponentTranslationPayload, type EntityTranslationResult, type EntityType, type MaybePromise, type MergeCompositionTranslationToUniformOptions, type MergeEntryTranslationToUniformOptions, type MergeTranslationToUniformOptions, type TranslationPayload, collectTranslationPayload, getCompositionForTranslation, getEntryForTranslation, mergeCompositionTranslationToUniform, mergeEntryTranslationToUniform, mergeTranslationToUniform, translateComposition, translateEntry };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ComponentInstance, RootComponentInstance, EntryData, CanvasClient, CompositionGetResponse, ContentClient, Entry } from '@uniformdev/canvas';
|
|
2
|
+
import { CanvasEditorEntityType } from '@uniformdev/mesh-sdk';
|
|
2
3
|
|
|
3
4
|
type ComponentTranslationPayload = Pick<ComponentInstance, '_id' | 'type' | 'parameters' | 'slots' | '_overrides'>;
|
|
5
|
+
type EntityType = CanvasEditorEntityType;
|
|
4
6
|
type TranslationPayload = {
|
|
5
7
|
schemaVersion: number;
|
|
6
8
|
metadata: {
|
|
@@ -9,12 +11,11 @@ type TranslationPayload = {
|
|
|
9
11
|
uniformTargetLocale: string;
|
|
10
12
|
uniformReleaseId?: string;
|
|
11
13
|
targetLang: string;
|
|
12
|
-
entityType:
|
|
14
|
+
entityType: EntityType;
|
|
13
15
|
entity: {
|
|
14
16
|
id: string;
|
|
15
17
|
slug: string | null | undefined;
|
|
16
18
|
};
|
|
17
|
-
overrideModifiedTargetLocale: boolean;
|
|
18
19
|
};
|
|
19
20
|
components: {
|
|
20
21
|
[componentId: string]: ComponentTranslationPayload | undefined;
|
|
@@ -34,18 +35,14 @@ type CollectTranslationPayloadResult = {
|
|
|
34
35
|
errorKind?: 'unknown' | 'invalid-args' | 'entity-source-locale-missing';
|
|
35
36
|
errorText?: string;
|
|
36
37
|
};
|
|
37
|
-
declare const collectTranslationPayload: ({ uniformProjectId, uniformSourceLocale, uniformTargetLocale, uniformReleaseId, targetLang, entity, entityType,
|
|
38
|
+
declare const collectTranslationPayload: ({ uniformProjectId, uniformSourceLocale, uniformTargetLocale, uniformReleaseId, targetLang, entity, entityType, }: {
|
|
38
39
|
uniformProjectId: string;
|
|
39
40
|
uniformSourceLocale: string;
|
|
40
41
|
uniformTargetLocale: string;
|
|
41
42
|
uniformReleaseId: string | undefined;
|
|
42
43
|
targetLang: string;
|
|
43
44
|
entity: RootComponentInstance | EntryData;
|
|
44
|
-
entityType:
|
|
45
|
-
/**
|
|
46
|
-
* Ignore modified content in target locales and collect all supported parameters for translation
|
|
47
|
-
*/
|
|
48
|
-
overrideModifiedTargetLocale: boolean;
|
|
45
|
+
entityType: EntityType;
|
|
49
46
|
}) => CollectTranslationPayloadResult;
|
|
50
47
|
|
|
51
48
|
declare const getCompositionForTranslation: ({ canvasClient, compositionId, releaseId, state, }: {
|
|
@@ -111,16 +108,14 @@ declare const mergeTranslationToUniform: ({ canvasClient, contentClient, transla
|
|
|
111
108
|
entityId?: string | undefined;
|
|
112
109
|
}>;
|
|
113
110
|
|
|
114
|
-
declare const translateComposition: ({ composition, translationPayload,
|
|
111
|
+
declare const translateComposition: ({ composition, translationPayload, }: {
|
|
115
112
|
composition: CompositionGetResponse;
|
|
116
113
|
translationPayload: TranslationPayload;
|
|
117
|
-
overrideModifiedTargetLocale: boolean;
|
|
118
114
|
}) => EntityTranslationResult<CompositionGetResponse>;
|
|
119
115
|
|
|
120
|
-
declare const translateEntry: ({ entry, translationPayload,
|
|
116
|
+
declare const translateEntry: ({ entry, translationPayload, }: {
|
|
121
117
|
entry: Entry;
|
|
122
118
|
translationPayload: TranslationPayload;
|
|
123
|
-
overrideModifiedTargetLocale: boolean;
|
|
124
119
|
}) => EntityTranslationResult<Entry>;
|
|
125
120
|
|
|
126
|
-
export { type CollectTranslationPayloadResult, type ComponentTranslationPayload, type EntityTranslationResult, type MaybePromise, type MergeCompositionTranslationToUniformOptions, type MergeEntryTranslationToUniformOptions, type MergeTranslationToUniformOptions, type TranslationPayload, collectTranslationPayload, getCompositionForTranslation, getEntryForTranslation, mergeCompositionTranslationToUniform, mergeEntryTranslationToUniform, mergeTranslationToUniform, translateComposition, translateEntry };
|
|
121
|
+
export { type CollectTranslationPayloadResult, type ComponentTranslationPayload, type EntityTranslationResult, type EntityType, type MaybePromise, type MergeCompositionTranslationToUniformOptions, type MergeEntryTranslationToUniformOptions, type MergeTranslationToUniformOptions, type TranslationPayload, collectTranslationPayload, getCompositionForTranslation, getEntryForTranslation, mergeCompositionTranslationToUniform, mergeEntryTranslationToUniform, mergeTranslationToUniform, translateComposition, translateEntry };
|
package/dist/index.esm.js
CHANGED
|
@@ -33,7 +33,6 @@ var createErrorResult = (errorKind) => {
|
|
|
33
33
|
var processComponentTranslation = ({
|
|
34
34
|
uniformSourceLocale,
|
|
35
35
|
uniformTargetLocale,
|
|
36
|
-
overrideModifiedTargetLocale,
|
|
37
36
|
originalNode,
|
|
38
37
|
translatedComponent
|
|
39
38
|
}) => {
|
|
@@ -53,7 +52,6 @@ var processComponentTranslation = ({
|
|
|
53
52
|
const result = processParameterTranslation({
|
|
54
53
|
uniformSourceLocale,
|
|
55
54
|
uniformTargetLocale,
|
|
56
|
-
overrideModifiedTargetLocale,
|
|
57
55
|
originalParameter,
|
|
58
56
|
parameter
|
|
59
57
|
});
|
|
@@ -70,7 +68,6 @@ var processComponentTranslation = ({
|
|
|
70
68
|
const result = processOverrideTranslation({
|
|
71
69
|
uniformSourceLocale,
|
|
72
70
|
uniformTargetLocale,
|
|
73
|
-
overrideModifiedTargetLocale,
|
|
74
71
|
originalOverride,
|
|
75
72
|
override
|
|
76
73
|
});
|
|
@@ -83,7 +80,6 @@ var processComponentTranslation = ({
|
|
|
83
80
|
var processParameterTranslation = ({
|
|
84
81
|
uniformSourceLocale,
|
|
85
82
|
uniformTargetLocale,
|
|
86
|
-
overrideModifiedTargetLocale,
|
|
87
83
|
originalParameter,
|
|
88
84
|
parameter
|
|
89
85
|
}) => {
|
|
@@ -102,7 +98,7 @@ var processParameterTranslation = ({
|
|
|
102
98
|
left: originalParameter.locales[uniformSourceLocale],
|
|
103
99
|
right: sourceValue
|
|
104
100
|
});
|
|
105
|
-
const isTargetValueUntouched =
|
|
101
|
+
const isTargetValueUntouched = isSameParameterValue({
|
|
106
102
|
parameterType: originalParameter.type,
|
|
107
103
|
left: originalParameter.locales[uniformTargetLocale],
|
|
108
104
|
right: originalTargetValue
|
|
@@ -116,7 +112,6 @@ var processParameterTranslation = ({
|
|
|
116
112
|
var processOverrideTranslation = ({
|
|
117
113
|
uniformSourceLocale,
|
|
118
114
|
uniformTargetLocale,
|
|
119
|
-
overrideModifiedTargetLocale,
|
|
120
115
|
originalOverride,
|
|
121
116
|
override
|
|
122
117
|
}) => {
|
|
@@ -139,7 +134,7 @@ var processOverrideTranslation = ({
|
|
|
139
134
|
left: originalParameter.locales[uniformSourceLocale],
|
|
140
135
|
right: sourceValue
|
|
141
136
|
});
|
|
142
|
-
const isTargetValueUntouched =
|
|
137
|
+
const isTargetValueUntouched = isSameParameterValue({
|
|
143
138
|
parameterType: originalParameter.type,
|
|
144
139
|
left: originalParameter.locales[uniformTargetLocale],
|
|
145
140
|
right: originalTargetValue
|
|
@@ -178,7 +173,6 @@ var processOverrideTranslation = ({
|
|
|
178
173
|
const { updated: isComponentUpdated } = processComponentTranslation({
|
|
179
174
|
uniformSourceLocale,
|
|
180
175
|
uniformTargetLocale,
|
|
181
|
-
overrideModifiedTargetLocale,
|
|
182
176
|
originalNode: originalComponent,
|
|
183
177
|
translatedComponent: component
|
|
184
178
|
});
|
|
@@ -236,8 +230,7 @@ var collectTranslationPayload = ({
|
|
|
236
230
|
uniformReleaseId,
|
|
237
231
|
targetLang,
|
|
238
232
|
entity,
|
|
239
|
-
entityType
|
|
240
|
-
overrideModifiedTargetLocale
|
|
233
|
+
entityType
|
|
241
234
|
}) => {
|
|
242
235
|
if (!uniformSourceLocale || !uniformTargetLocale || !targetLang || !entity) {
|
|
243
236
|
return createErrorResult2("invalid-args");
|
|
@@ -257,8 +250,7 @@ var collectTranslationPayload = ({
|
|
|
257
250
|
entity: {
|
|
258
251
|
id: entity._id,
|
|
259
252
|
slug: entity._slug || ""
|
|
260
|
-
}
|
|
261
|
-
overrideModifiedTargetLocale
|
|
253
|
+
}
|
|
262
254
|
},
|
|
263
255
|
components: {}
|
|
264
256
|
};
|
|
@@ -270,7 +262,6 @@ var collectTranslationPayload = ({
|
|
|
270
262
|
const { _id, type, parameters, _overrides } = collectFromNode({
|
|
271
263
|
uniformSourceLocale,
|
|
272
264
|
uniformTargetLocale,
|
|
273
|
-
overrideModifiedTargetLocale,
|
|
274
265
|
node,
|
|
275
266
|
deep: false
|
|
276
267
|
});
|
|
@@ -288,7 +279,6 @@ var collectTranslationPayload = ({
|
|
|
288
279
|
var collectFromNode = ({
|
|
289
280
|
uniformSourceLocale,
|
|
290
281
|
uniformTargetLocale,
|
|
291
|
-
overrideModifiedTargetLocale,
|
|
292
282
|
node,
|
|
293
283
|
deep
|
|
294
284
|
}) => {
|
|
@@ -305,7 +295,7 @@ var collectFromNode = ({
|
|
|
305
295
|
if (!canTranslateParameterValue(param, sourceLocaleValue)) {
|
|
306
296
|
return;
|
|
307
297
|
}
|
|
308
|
-
if (!
|
|
298
|
+
if (!isTargetLocaleUntouched(param.type, sourceLocaleValue, targetLocaleValue)) {
|
|
309
299
|
return;
|
|
310
300
|
}
|
|
311
301
|
collectedParameters[paramKey] = {
|
|
@@ -327,7 +317,6 @@ var collectFromNode = ({
|
|
|
327
317
|
const collectedNode = collectFromNode({
|
|
328
318
|
uniformSourceLocale,
|
|
329
319
|
uniformTargetLocale,
|
|
330
|
-
overrideModifiedTargetLocale,
|
|
331
320
|
node: slotComponent,
|
|
332
321
|
deep: true
|
|
333
322
|
});
|
|
@@ -348,7 +337,7 @@ var collectFromNode = ({
|
|
|
348
337
|
if (!canTranslateParameterValue(param, sourceLocaleValue)) {
|
|
349
338
|
return;
|
|
350
339
|
}
|
|
351
|
-
if (!
|
|
340
|
+
if (!isTargetLocaleUntouched(param.type, sourceLocaleValue, targetLocaleValue)) {
|
|
352
341
|
return;
|
|
353
342
|
}
|
|
354
343
|
(_c2 = collectedOverrides[overrideKey]) != null ? _c2 : collectedOverrides[overrideKey] = {};
|
|
@@ -371,7 +360,6 @@ var collectFromNode = ({
|
|
|
371
360
|
const collectedNode = collectFromNode({
|
|
372
361
|
uniformSourceLocale,
|
|
373
362
|
uniformTargetLocale,
|
|
374
|
-
overrideModifiedTargetLocale,
|
|
375
363
|
node: slotComponent,
|
|
376
364
|
// keep tree structure for `Slot Sections`
|
|
377
365
|
// to store whole `override` content in scope of current component
|
|
@@ -496,8 +484,7 @@ import { CANVAS_DRAFT_STATE as CANVAS_DRAFT_STATE3, walkNodeTree as walkNodeTree
|
|
|
496
484
|
import { produce } from "immer";
|
|
497
485
|
var translateComposition = ({
|
|
498
486
|
composition,
|
|
499
|
-
translationPayload
|
|
500
|
-
overrideModifiedTargetLocale
|
|
487
|
+
translationPayload
|
|
501
488
|
}) => {
|
|
502
489
|
var _a;
|
|
503
490
|
if (!composition || !composition.composition || !translationPayload) {
|
|
@@ -539,7 +526,6 @@ var translateComposition = ({
|
|
|
539
526
|
const { updated: isComponentUpdated } = processComponentTranslation({
|
|
540
527
|
uniformSourceLocale,
|
|
541
528
|
uniformTargetLocale,
|
|
542
|
-
overrideModifiedTargetLocale,
|
|
543
529
|
originalNode: component,
|
|
544
530
|
translatedComponent
|
|
545
531
|
});
|
|
@@ -564,7 +550,6 @@ var mergeCompositionTranslationToUniform = async ({
|
|
|
564
550
|
}
|
|
565
551
|
const entityType = translationPayload.metadata.entityType;
|
|
566
552
|
const entityId = translationPayload.metadata.entity.id;
|
|
567
|
-
const overrideModifiedTargetLocale = translationPayload.metadata.overrideModifiedTargetLocale;
|
|
568
553
|
if (entityType !== "composition" && entityType !== "componentPattern") {
|
|
569
554
|
return { translationMerged: false, entityId };
|
|
570
555
|
}
|
|
@@ -580,8 +565,7 @@ var mergeCompositionTranslationToUniform = async ({
|
|
|
580
565
|
}
|
|
581
566
|
const translationResult = translateComposition({
|
|
582
567
|
composition,
|
|
583
|
-
translationPayload
|
|
584
|
-
overrideModifiedTargetLocale
|
|
568
|
+
translationPayload
|
|
585
569
|
});
|
|
586
570
|
const { updated, errorKind, errorText, result: translatedComposition } = translationResult;
|
|
587
571
|
if (translatedComposition && updated && !errorKind) {
|
|
@@ -626,8 +610,7 @@ import { CANVAS_DRAFT_STATE as CANVAS_DRAFT_STATE5, walkNodeTree as walkNodeTree
|
|
|
626
610
|
import { produce as produce2 } from "immer";
|
|
627
611
|
var translateEntry = ({
|
|
628
612
|
entry,
|
|
629
|
-
translationPayload
|
|
630
|
-
overrideModifiedTargetLocale
|
|
613
|
+
translationPayload
|
|
631
614
|
}) => {
|
|
632
615
|
var _a;
|
|
633
616
|
if (!entry || !translationPayload) {
|
|
@@ -669,7 +652,6 @@ var translateEntry = ({
|
|
|
669
652
|
const { updated: isComponentUpdated } = processComponentTranslation({
|
|
670
653
|
uniformSourceLocale,
|
|
671
654
|
uniformTargetLocale,
|
|
672
|
-
overrideModifiedTargetLocale,
|
|
673
655
|
originalNode: component,
|
|
674
656
|
translatedComponent
|
|
675
657
|
});
|
|
@@ -694,7 +676,6 @@ var mergeEntryTranslationToUniform = async ({
|
|
|
694
676
|
}
|
|
695
677
|
const entityType = translationPayload.metadata.entityType;
|
|
696
678
|
const entityId = translationPayload.metadata.entity.id;
|
|
697
|
-
const overrideModifiedTargetLocale = translationPayload.metadata.overrideModifiedTargetLocale;
|
|
698
679
|
if (entityType !== "entry" && entityType !== "entryPattern") {
|
|
699
680
|
return { translationMerged: false, entityId };
|
|
700
681
|
}
|
|
@@ -710,8 +691,7 @@ var mergeEntryTranslationToUniform = async ({
|
|
|
710
691
|
}
|
|
711
692
|
const translationResult = translateEntry({
|
|
712
693
|
entry,
|
|
713
|
-
translationPayload
|
|
714
|
-
overrideModifiedTargetLocale
|
|
694
|
+
translationPayload
|
|
715
695
|
});
|
|
716
696
|
const { updated, errorKind, errorText, result: translatedEntry } = translationResult;
|
|
717
697
|
if (translatedEntry && updated && !errorKind) {
|
package/dist/index.js
CHANGED
|
@@ -61,7 +61,6 @@ var createErrorResult = (errorKind) => {
|
|
|
61
61
|
var processComponentTranslation = ({
|
|
62
62
|
uniformSourceLocale,
|
|
63
63
|
uniformTargetLocale,
|
|
64
|
-
overrideModifiedTargetLocale,
|
|
65
64
|
originalNode,
|
|
66
65
|
translatedComponent
|
|
67
66
|
}) => {
|
|
@@ -81,7 +80,6 @@ var processComponentTranslation = ({
|
|
|
81
80
|
const result = processParameterTranslation({
|
|
82
81
|
uniformSourceLocale,
|
|
83
82
|
uniformTargetLocale,
|
|
84
|
-
overrideModifiedTargetLocale,
|
|
85
83
|
originalParameter,
|
|
86
84
|
parameter
|
|
87
85
|
});
|
|
@@ -98,7 +96,6 @@ var processComponentTranslation = ({
|
|
|
98
96
|
const result = processOverrideTranslation({
|
|
99
97
|
uniformSourceLocale,
|
|
100
98
|
uniformTargetLocale,
|
|
101
|
-
overrideModifiedTargetLocale,
|
|
102
99
|
originalOverride,
|
|
103
100
|
override
|
|
104
101
|
});
|
|
@@ -111,7 +108,6 @@ var processComponentTranslation = ({
|
|
|
111
108
|
var processParameterTranslation = ({
|
|
112
109
|
uniformSourceLocale,
|
|
113
110
|
uniformTargetLocale,
|
|
114
|
-
overrideModifiedTargetLocale,
|
|
115
111
|
originalParameter,
|
|
116
112
|
parameter
|
|
117
113
|
}) => {
|
|
@@ -130,7 +126,7 @@ var processParameterTranslation = ({
|
|
|
130
126
|
left: originalParameter.locales[uniformSourceLocale],
|
|
131
127
|
right: sourceValue
|
|
132
128
|
});
|
|
133
|
-
const isTargetValueUntouched =
|
|
129
|
+
const isTargetValueUntouched = isSameParameterValue({
|
|
134
130
|
parameterType: originalParameter.type,
|
|
135
131
|
left: originalParameter.locales[uniformTargetLocale],
|
|
136
132
|
right: originalTargetValue
|
|
@@ -144,7 +140,6 @@ var processParameterTranslation = ({
|
|
|
144
140
|
var processOverrideTranslation = ({
|
|
145
141
|
uniformSourceLocale,
|
|
146
142
|
uniformTargetLocale,
|
|
147
|
-
overrideModifiedTargetLocale,
|
|
148
143
|
originalOverride,
|
|
149
144
|
override
|
|
150
145
|
}) => {
|
|
@@ -167,7 +162,7 @@ var processOverrideTranslation = ({
|
|
|
167
162
|
left: originalParameter.locales[uniformSourceLocale],
|
|
168
163
|
right: sourceValue
|
|
169
164
|
});
|
|
170
|
-
const isTargetValueUntouched =
|
|
165
|
+
const isTargetValueUntouched = isSameParameterValue({
|
|
171
166
|
parameterType: originalParameter.type,
|
|
172
167
|
left: originalParameter.locales[uniformTargetLocale],
|
|
173
168
|
right: originalTargetValue
|
|
@@ -206,7 +201,6 @@ var processOverrideTranslation = ({
|
|
|
206
201
|
const { updated: isComponentUpdated } = processComponentTranslation({
|
|
207
202
|
uniformSourceLocale,
|
|
208
203
|
uniformTargetLocale,
|
|
209
|
-
overrideModifiedTargetLocale,
|
|
210
204
|
originalNode: originalComponent,
|
|
211
205
|
translatedComponent: component
|
|
212
206
|
});
|
|
@@ -264,8 +258,7 @@ var collectTranslationPayload = ({
|
|
|
264
258
|
uniformReleaseId,
|
|
265
259
|
targetLang,
|
|
266
260
|
entity,
|
|
267
|
-
entityType
|
|
268
|
-
overrideModifiedTargetLocale
|
|
261
|
+
entityType
|
|
269
262
|
}) => {
|
|
270
263
|
if (!uniformSourceLocale || !uniformTargetLocale || !targetLang || !entity) {
|
|
271
264
|
return createErrorResult2("invalid-args");
|
|
@@ -285,8 +278,7 @@ var collectTranslationPayload = ({
|
|
|
285
278
|
entity: {
|
|
286
279
|
id: entity._id,
|
|
287
280
|
slug: entity._slug || ""
|
|
288
|
-
}
|
|
289
|
-
overrideModifiedTargetLocale
|
|
281
|
+
}
|
|
290
282
|
},
|
|
291
283
|
components: {}
|
|
292
284
|
};
|
|
@@ -298,7 +290,6 @@ var collectTranslationPayload = ({
|
|
|
298
290
|
const { _id, type, parameters, _overrides } = collectFromNode({
|
|
299
291
|
uniformSourceLocale,
|
|
300
292
|
uniformTargetLocale,
|
|
301
|
-
overrideModifiedTargetLocale,
|
|
302
293
|
node,
|
|
303
294
|
deep: false
|
|
304
295
|
});
|
|
@@ -316,7 +307,6 @@ var collectTranslationPayload = ({
|
|
|
316
307
|
var collectFromNode = ({
|
|
317
308
|
uniformSourceLocale,
|
|
318
309
|
uniformTargetLocale,
|
|
319
|
-
overrideModifiedTargetLocale,
|
|
320
310
|
node,
|
|
321
311
|
deep
|
|
322
312
|
}) => {
|
|
@@ -333,7 +323,7 @@ var collectFromNode = ({
|
|
|
333
323
|
if (!canTranslateParameterValue(param, sourceLocaleValue)) {
|
|
334
324
|
return;
|
|
335
325
|
}
|
|
336
|
-
if (!
|
|
326
|
+
if (!isTargetLocaleUntouched(param.type, sourceLocaleValue, targetLocaleValue)) {
|
|
337
327
|
return;
|
|
338
328
|
}
|
|
339
329
|
collectedParameters[paramKey] = {
|
|
@@ -355,7 +345,6 @@ var collectFromNode = ({
|
|
|
355
345
|
const collectedNode = collectFromNode({
|
|
356
346
|
uniformSourceLocale,
|
|
357
347
|
uniformTargetLocale,
|
|
358
|
-
overrideModifiedTargetLocale,
|
|
359
348
|
node: slotComponent,
|
|
360
349
|
deep: true
|
|
361
350
|
});
|
|
@@ -376,7 +365,7 @@ var collectFromNode = ({
|
|
|
376
365
|
if (!canTranslateParameterValue(param, sourceLocaleValue)) {
|
|
377
366
|
return;
|
|
378
367
|
}
|
|
379
|
-
if (!
|
|
368
|
+
if (!isTargetLocaleUntouched(param.type, sourceLocaleValue, targetLocaleValue)) {
|
|
380
369
|
return;
|
|
381
370
|
}
|
|
382
371
|
(_c2 = collectedOverrides[overrideKey]) != null ? _c2 : collectedOverrides[overrideKey] = {};
|
|
@@ -399,7 +388,6 @@ var collectFromNode = ({
|
|
|
399
388
|
const collectedNode = collectFromNode({
|
|
400
389
|
uniformSourceLocale,
|
|
401
390
|
uniformTargetLocale,
|
|
402
|
-
overrideModifiedTargetLocale,
|
|
403
391
|
node: slotComponent,
|
|
404
392
|
// keep tree structure for `Slot Sections`
|
|
405
393
|
// to store whole `override` content in scope of current component
|
|
@@ -524,8 +512,7 @@ var import_canvas5 = require("@uniformdev/canvas");
|
|
|
524
512
|
var import_immer = require("immer");
|
|
525
513
|
var translateComposition = ({
|
|
526
514
|
composition,
|
|
527
|
-
translationPayload
|
|
528
|
-
overrideModifiedTargetLocale
|
|
515
|
+
translationPayload
|
|
529
516
|
}) => {
|
|
530
517
|
var _a;
|
|
531
518
|
if (!composition || !composition.composition || !translationPayload) {
|
|
@@ -567,7 +554,6 @@ var translateComposition = ({
|
|
|
567
554
|
const { updated: isComponentUpdated } = processComponentTranslation({
|
|
568
555
|
uniformSourceLocale,
|
|
569
556
|
uniformTargetLocale,
|
|
570
|
-
overrideModifiedTargetLocale,
|
|
571
557
|
originalNode: component,
|
|
572
558
|
translatedComponent
|
|
573
559
|
});
|
|
@@ -592,7 +578,6 @@ var mergeCompositionTranslationToUniform = async ({
|
|
|
592
578
|
}
|
|
593
579
|
const entityType = translationPayload.metadata.entityType;
|
|
594
580
|
const entityId = translationPayload.metadata.entity.id;
|
|
595
|
-
const overrideModifiedTargetLocale = translationPayload.metadata.overrideModifiedTargetLocale;
|
|
596
581
|
if (entityType !== "composition" && entityType !== "componentPattern") {
|
|
597
582
|
return { translationMerged: false, entityId };
|
|
598
583
|
}
|
|
@@ -608,8 +593,7 @@ var mergeCompositionTranslationToUniform = async ({
|
|
|
608
593
|
}
|
|
609
594
|
const translationResult = translateComposition({
|
|
610
595
|
composition,
|
|
611
|
-
translationPayload
|
|
612
|
-
overrideModifiedTargetLocale
|
|
596
|
+
translationPayload
|
|
613
597
|
});
|
|
614
598
|
const { updated, errorKind, errorText, result: translatedComposition } = translationResult;
|
|
615
599
|
if (translatedComposition && updated && !errorKind) {
|
|
@@ -654,8 +638,7 @@ var import_canvas7 = require("@uniformdev/canvas");
|
|
|
654
638
|
var import_immer2 = require("immer");
|
|
655
639
|
var translateEntry = ({
|
|
656
640
|
entry,
|
|
657
|
-
translationPayload
|
|
658
|
-
overrideModifiedTargetLocale
|
|
641
|
+
translationPayload
|
|
659
642
|
}) => {
|
|
660
643
|
var _a;
|
|
661
644
|
if (!entry || !translationPayload) {
|
|
@@ -697,7 +680,6 @@ var translateEntry = ({
|
|
|
697
680
|
const { updated: isComponentUpdated } = processComponentTranslation({
|
|
698
681
|
uniformSourceLocale,
|
|
699
682
|
uniformTargetLocale,
|
|
700
|
-
overrideModifiedTargetLocale,
|
|
701
683
|
originalNode: component,
|
|
702
684
|
translatedComponent
|
|
703
685
|
});
|
|
@@ -722,7 +704,6 @@ var mergeEntryTranslationToUniform = async ({
|
|
|
722
704
|
}
|
|
723
705
|
const entityType = translationPayload.metadata.entityType;
|
|
724
706
|
const entityId = translationPayload.metadata.entity.id;
|
|
725
|
-
const overrideModifiedTargetLocale = translationPayload.metadata.overrideModifiedTargetLocale;
|
|
726
707
|
if (entityType !== "entry" && entityType !== "entryPattern") {
|
|
727
708
|
return { translationMerged: false, entityId };
|
|
728
709
|
}
|
|
@@ -738,8 +719,7 @@ var mergeEntryTranslationToUniform = async ({
|
|
|
738
719
|
}
|
|
739
720
|
const translationResult = translateEntry({
|
|
740
721
|
entry,
|
|
741
|
-
translationPayload
|
|
742
|
-
overrideModifiedTargetLocale
|
|
722
|
+
translationPayload
|
|
743
723
|
});
|
|
744
724
|
const { updated, errorKind, errorText, result: translatedEntry } = translationResult;
|
|
745
725
|
if (translatedEntry && updated && !errorKind) {
|
package/dist/index.mjs
CHANGED
|
@@ -33,7 +33,6 @@ var createErrorResult = (errorKind) => {
|
|
|
33
33
|
var processComponentTranslation = ({
|
|
34
34
|
uniformSourceLocale,
|
|
35
35
|
uniformTargetLocale,
|
|
36
|
-
overrideModifiedTargetLocale,
|
|
37
36
|
originalNode,
|
|
38
37
|
translatedComponent
|
|
39
38
|
}) => {
|
|
@@ -53,7 +52,6 @@ var processComponentTranslation = ({
|
|
|
53
52
|
const result = processParameterTranslation({
|
|
54
53
|
uniformSourceLocale,
|
|
55
54
|
uniformTargetLocale,
|
|
56
|
-
overrideModifiedTargetLocale,
|
|
57
55
|
originalParameter,
|
|
58
56
|
parameter
|
|
59
57
|
});
|
|
@@ -70,7 +68,6 @@ var processComponentTranslation = ({
|
|
|
70
68
|
const result = processOverrideTranslation({
|
|
71
69
|
uniformSourceLocale,
|
|
72
70
|
uniformTargetLocale,
|
|
73
|
-
overrideModifiedTargetLocale,
|
|
74
71
|
originalOverride,
|
|
75
72
|
override
|
|
76
73
|
});
|
|
@@ -83,7 +80,6 @@ var processComponentTranslation = ({
|
|
|
83
80
|
var processParameterTranslation = ({
|
|
84
81
|
uniformSourceLocale,
|
|
85
82
|
uniformTargetLocale,
|
|
86
|
-
overrideModifiedTargetLocale,
|
|
87
83
|
originalParameter,
|
|
88
84
|
parameter
|
|
89
85
|
}) => {
|
|
@@ -102,7 +98,7 @@ var processParameterTranslation = ({
|
|
|
102
98
|
left: originalParameter.locales[uniformSourceLocale],
|
|
103
99
|
right: sourceValue
|
|
104
100
|
});
|
|
105
|
-
const isTargetValueUntouched =
|
|
101
|
+
const isTargetValueUntouched = isSameParameterValue({
|
|
106
102
|
parameterType: originalParameter.type,
|
|
107
103
|
left: originalParameter.locales[uniformTargetLocale],
|
|
108
104
|
right: originalTargetValue
|
|
@@ -116,7 +112,6 @@ var processParameterTranslation = ({
|
|
|
116
112
|
var processOverrideTranslation = ({
|
|
117
113
|
uniformSourceLocale,
|
|
118
114
|
uniformTargetLocale,
|
|
119
|
-
overrideModifiedTargetLocale,
|
|
120
115
|
originalOverride,
|
|
121
116
|
override
|
|
122
117
|
}) => {
|
|
@@ -139,7 +134,7 @@ var processOverrideTranslation = ({
|
|
|
139
134
|
left: originalParameter.locales[uniformSourceLocale],
|
|
140
135
|
right: sourceValue
|
|
141
136
|
});
|
|
142
|
-
const isTargetValueUntouched =
|
|
137
|
+
const isTargetValueUntouched = isSameParameterValue({
|
|
143
138
|
parameterType: originalParameter.type,
|
|
144
139
|
left: originalParameter.locales[uniformTargetLocale],
|
|
145
140
|
right: originalTargetValue
|
|
@@ -178,7 +173,6 @@ var processOverrideTranslation = ({
|
|
|
178
173
|
const { updated: isComponentUpdated } = processComponentTranslation({
|
|
179
174
|
uniformSourceLocale,
|
|
180
175
|
uniformTargetLocale,
|
|
181
|
-
overrideModifiedTargetLocale,
|
|
182
176
|
originalNode: originalComponent,
|
|
183
177
|
translatedComponent: component
|
|
184
178
|
});
|
|
@@ -236,8 +230,7 @@ var collectTranslationPayload = ({
|
|
|
236
230
|
uniformReleaseId,
|
|
237
231
|
targetLang,
|
|
238
232
|
entity,
|
|
239
|
-
entityType
|
|
240
|
-
overrideModifiedTargetLocale
|
|
233
|
+
entityType
|
|
241
234
|
}) => {
|
|
242
235
|
if (!uniformSourceLocale || !uniformTargetLocale || !targetLang || !entity) {
|
|
243
236
|
return createErrorResult2("invalid-args");
|
|
@@ -257,8 +250,7 @@ var collectTranslationPayload = ({
|
|
|
257
250
|
entity: {
|
|
258
251
|
id: entity._id,
|
|
259
252
|
slug: entity._slug || ""
|
|
260
|
-
}
|
|
261
|
-
overrideModifiedTargetLocale
|
|
253
|
+
}
|
|
262
254
|
},
|
|
263
255
|
components: {}
|
|
264
256
|
};
|
|
@@ -270,7 +262,6 @@ var collectTranslationPayload = ({
|
|
|
270
262
|
const { _id, type, parameters, _overrides } = collectFromNode({
|
|
271
263
|
uniformSourceLocale,
|
|
272
264
|
uniformTargetLocale,
|
|
273
|
-
overrideModifiedTargetLocale,
|
|
274
265
|
node,
|
|
275
266
|
deep: false
|
|
276
267
|
});
|
|
@@ -288,7 +279,6 @@ var collectTranslationPayload = ({
|
|
|
288
279
|
var collectFromNode = ({
|
|
289
280
|
uniformSourceLocale,
|
|
290
281
|
uniformTargetLocale,
|
|
291
|
-
overrideModifiedTargetLocale,
|
|
292
282
|
node,
|
|
293
283
|
deep
|
|
294
284
|
}) => {
|
|
@@ -305,7 +295,7 @@ var collectFromNode = ({
|
|
|
305
295
|
if (!canTranslateParameterValue(param, sourceLocaleValue)) {
|
|
306
296
|
return;
|
|
307
297
|
}
|
|
308
|
-
if (!
|
|
298
|
+
if (!isTargetLocaleUntouched(param.type, sourceLocaleValue, targetLocaleValue)) {
|
|
309
299
|
return;
|
|
310
300
|
}
|
|
311
301
|
collectedParameters[paramKey] = {
|
|
@@ -327,7 +317,6 @@ var collectFromNode = ({
|
|
|
327
317
|
const collectedNode = collectFromNode({
|
|
328
318
|
uniformSourceLocale,
|
|
329
319
|
uniformTargetLocale,
|
|
330
|
-
overrideModifiedTargetLocale,
|
|
331
320
|
node: slotComponent,
|
|
332
321
|
deep: true
|
|
333
322
|
});
|
|
@@ -348,7 +337,7 @@ var collectFromNode = ({
|
|
|
348
337
|
if (!canTranslateParameterValue(param, sourceLocaleValue)) {
|
|
349
338
|
return;
|
|
350
339
|
}
|
|
351
|
-
if (!
|
|
340
|
+
if (!isTargetLocaleUntouched(param.type, sourceLocaleValue, targetLocaleValue)) {
|
|
352
341
|
return;
|
|
353
342
|
}
|
|
354
343
|
(_c2 = collectedOverrides[overrideKey]) != null ? _c2 : collectedOverrides[overrideKey] = {};
|
|
@@ -371,7 +360,6 @@ var collectFromNode = ({
|
|
|
371
360
|
const collectedNode = collectFromNode({
|
|
372
361
|
uniformSourceLocale,
|
|
373
362
|
uniformTargetLocale,
|
|
374
|
-
overrideModifiedTargetLocale,
|
|
375
363
|
node: slotComponent,
|
|
376
364
|
// keep tree structure for `Slot Sections`
|
|
377
365
|
// to store whole `override` content in scope of current component
|
|
@@ -496,8 +484,7 @@ import { CANVAS_DRAFT_STATE as CANVAS_DRAFT_STATE3, walkNodeTree as walkNodeTree
|
|
|
496
484
|
import { produce } from "immer";
|
|
497
485
|
var translateComposition = ({
|
|
498
486
|
composition,
|
|
499
|
-
translationPayload
|
|
500
|
-
overrideModifiedTargetLocale
|
|
487
|
+
translationPayload
|
|
501
488
|
}) => {
|
|
502
489
|
var _a;
|
|
503
490
|
if (!composition || !composition.composition || !translationPayload) {
|
|
@@ -539,7 +526,6 @@ var translateComposition = ({
|
|
|
539
526
|
const { updated: isComponentUpdated } = processComponentTranslation({
|
|
540
527
|
uniformSourceLocale,
|
|
541
528
|
uniformTargetLocale,
|
|
542
|
-
overrideModifiedTargetLocale,
|
|
543
529
|
originalNode: component,
|
|
544
530
|
translatedComponent
|
|
545
531
|
});
|
|
@@ -564,7 +550,6 @@ var mergeCompositionTranslationToUniform = async ({
|
|
|
564
550
|
}
|
|
565
551
|
const entityType = translationPayload.metadata.entityType;
|
|
566
552
|
const entityId = translationPayload.metadata.entity.id;
|
|
567
|
-
const overrideModifiedTargetLocale = translationPayload.metadata.overrideModifiedTargetLocale;
|
|
568
553
|
if (entityType !== "composition" && entityType !== "componentPattern") {
|
|
569
554
|
return { translationMerged: false, entityId };
|
|
570
555
|
}
|
|
@@ -580,8 +565,7 @@ var mergeCompositionTranslationToUniform = async ({
|
|
|
580
565
|
}
|
|
581
566
|
const translationResult = translateComposition({
|
|
582
567
|
composition,
|
|
583
|
-
translationPayload
|
|
584
|
-
overrideModifiedTargetLocale
|
|
568
|
+
translationPayload
|
|
585
569
|
});
|
|
586
570
|
const { updated, errorKind, errorText, result: translatedComposition } = translationResult;
|
|
587
571
|
if (translatedComposition && updated && !errorKind) {
|
|
@@ -626,8 +610,7 @@ import { CANVAS_DRAFT_STATE as CANVAS_DRAFT_STATE5, walkNodeTree as walkNodeTree
|
|
|
626
610
|
import { produce as produce2 } from "immer";
|
|
627
611
|
var translateEntry = ({
|
|
628
612
|
entry,
|
|
629
|
-
translationPayload
|
|
630
|
-
overrideModifiedTargetLocale
|
|
613
|
+
translationPayload
|
|
631
614
|
}) => {
|
|
632
615
|
var _a;
|
|
633
616
|
if (!entry || !translationPayload) {
|
|
@@ -669,7 +652,6 @@ var translateEntry = ({
|
|
|
669
652
|
const { updated: isComponentUpdated } = processComponentTranslation({
|
|
670
653
|
uniformSourceLocale,
|
|
671
654
|
uniformTargetLocale,
|
|
672
|
-
overrideModifiedTargetLocale,
|
|
673
655
|
originalNode: component,
|
|
674
656
|
translatedComponent
|
|
675
657
|
});
|
|
@@ -694,7 +676,6 @@ var mergeEntryTranslationToUniform = async ({
|
|
|
694
676
|
}
|
|
695
677
|
const entityType = translationPayload.metadata.entityType;
|
|
696
678
|
const entityId = translationPayload.metadata.entity.id;
|
|
697
|
-
const overrideModifiedTargetLocale = translationPayload.metadata.overrideModifiedTargetLocale;
|
|
698
679
|
if (entityType !== "entry" && entityType !== "entryPattern") {
|
|
699
680
|
return { translationMerged: false, entityId };
|
|
700
681
|
}
|
|
@@ -710,8 +691,7 @@ var mergeEntryTranslationToUniform = async ({
|
|
|
710
691
|
}
|
|
711
692
|
const translationResult = translateEntry({
|
|
712
693
|
entry,
|
|
713
|
-
translationPayload
|
|
714
|
-
overrideModifiedTargetLocale
|
|
694
|
+
translationPayload
|
|
715
695
|
});
|
|
716
696
|
const { updated, errorKind, errorText, result: translatedEntry } = translationResult;
|
|
717
697
|
if (translatedEntry && updated && !errorKind) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/tms-sdk",
|
|
3
|
-
"version": "19.154.1-alpha.
|
|
3
|
+
"version": "19.154.1-alpha.27+38c3908d9d",
|
|
4
4
|
"description": "Uniform Translation Management System SDK",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,10 +33,11 @@
|
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@uniformdev/canvas": "19.154.1-alpha.
|
|
37
|
-
"@uniformdev/
|
|
36
|
+
"@uniformdev/canvas": "19.154.1-alpha.27+38c3908d9d",
|
|
37
|
+
"@uniformdev/mesh-sdk": "19.154.1-alpha.27+38c3908d9d",
|
|
38
|
+
"@uniformdev/richtext": "19.154.1-alpha.27+38c3908d9d",
|
|
38
39
|
"dequal": "2.0.3",
|
|
39
40
|
"immer": "10.0.4"
|
|
40
41
|
},
|
|
41
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "38c3908d9d966e4b12cf7ecdc5831ff03c529917"
|
|
42
43
|
}
|