@parhelia/localization 0.1.12808 → 0.1.12836
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/LocalizeItemCommand.d.ts.map +1 -1
- package/dist/LocalizeItemCommand.js +4 -2
- package/dist/LocalizeItemDialog.d.ts.map +1 -1
- package/dist/LocalizeItemDialog.js +7 -4
- package/dist/LocalizeItemUtils.d.ts.map +1 -1
- package/dist/LocalizeItemUtils.js +35 -25
- package/dist/api/discovery.d.ts.map +1 -1
- package/dist/api/discovery.js +20 -3
- package/dist/hooks/useTranslationWizard.d.ts.map +1 -1
- package/dist/hooks/useTranslationWizard.js +3 -3
- package/dist/services/translationService.d.ts +2 -2
- package/dist/services/translationService.d.ts.map +1 -1
- package/dist/services/translationService.js +21 -5
- package/dist/settings/TranslationServicesPanel.d.ts.map +1 -1
- package/dist/settings/TranslationServicesPanel.js +24 -21
- package/dist/setup/LocalizationSetupStep.d.ts.map +1 -1
- package/dist/setup/LocalizationSetupStep.js +29 -18
- package/dist/sidebar/TranslationSidebar.d.ts.map +1 -1
- package/dist/sidebar/TranslationSidebar.js +17 -10
- package/dist/steps/ItemSelectionStep.d.ts.map +1 -1
- package/dist/steps/ItemSelectionStep.js +2 -1
- package/dist/steps/ItemSelectionTree.d.ts.map +1 -1
- package/dist/steps/ItemSelectionTree.js +2 -1
- package/dist/steps/PromptCustomizationStep.d.ts.map +1 -1
- package/dist/steps/PromptCustomizationStep.js +6 -8
- package/dist/steps/ServiceLanguageSelectionStep.d.ts.map +1 -1
- package/dist/steps/ServiceLanguageSelectionStep.js +6 -4
- package/dist/steps/WizardStepShell.d.ts.map +1 -1
- package/dist/steps/types.d.ts.map +1 -1
- package/dist/translation-center/TranslationBatches.d.ts.map +1 -1
- package/dist/translation-center/TranslationBatches.js +187 -115
- package/dist/translation-center/TranslationManagement.js +4 -4
- package/dist/translation-center/TranslationsTitlebar.d.ts.map +1 -1
- package/dist/translation-center/TranslationsTitlebar.js +2 -2
- package/package.json +1 -1
- package/dist/constants.d.ts +0 -15
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -21
- package/dist/steps/MetadataInputStep.d.ts +0 -4
- package/dist/steps/MetadataInputStep.d.ts.map +0 -1
- package/dist/steps/MetadataInputStep.js +0 -48
- package/dist/steps/SubitemDiscoveryStep.d.ts +0 -3
- package/dist/steps/SubitemDiscoveryStep.d.ts.map +0 -1
- package/dist/steps/SubitemDiscoveryStep.js +0 -313
- package/dist/steps/index.d.ts +0 -6
- package/dist/steps/index.d.ts.map +0 -1
- package/dist/steps/index.js +0 -5
- package/dist/utils/createVersions.d.ts +0 -14
- package/dist/utils/createVersions.d.ts.map +0 -1
- package/dist/utils/createVersions.js +0 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalizeItemCommand.d.ts","sourceRoot":"","sources":["../src/LocalizeItemCommand.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAUhF,MAAM,MAAM,uBAAuB,GAAG,WAAW,GAAG;IAClD,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,0BAA0B,
|
|
1
|
+
{"version":3,"file":"LocalizeItemCommand.d.ts","sourceRoot":"","sources":["../src/LocalizeItemCommand.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAUhF,MAAM,MAAM,uBAAuB,GAAG,WAAW,GAAG;IAClD,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GACpC,cAAc,CAAC,uBAAuB,CAAC,CAAC;AAC1C,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAEnE,eAAO,MAAM,mBAAmB,EAAE,mBA0DjC,CAAC"}
|
|
@@ -14,7 +14,8 @@ export const localizeItemCommand = {
|
|
|
14
14
|
return true;
|
|
15
15
|
}
|
|
16
16
|
// Check if multi-item is disabled and multiple items are selected
|
|
17
|
-
const multiItemEnabled = context.editContext?.configuration?.localization?.multiItem !==
|
|
17
|
+
const multiItemEnabled = context.editContext?.configuration?.localization?.multiItem !==
|
|
18
|
+
false;
|
|
18
19
|
if (!multiItemEnabled && context.data.items.length > 1) {
|
|
19
20
|
return true; // Disable command when multiple items selected in single-item mode
|
|
20
21
|
}
|
|
@@ -31,7 +32,8 @@ export const localizeItemCommand = {
|
|
|
31
32
|
});
|
|
32
33
|
// If translation was started (result contains batchId), navigate to the batch view
|
|
33
34
|
if (result?.batchId) {
|
|
34
|
-
const translationManagementEnabled = context.editContext?.configuration?.localization
|
|
35
|
+
const translationManagementEnabled = context.editContext?.configuration?.localization
|
|
36
|
+
?.translationManagement !== false;
|
|
35
37
|
if (translationManagementEnabled) {
|
|
36
38
|
// Synchronous URL update to avoid race with workspace URL sync
|
|
37
39
|
const params = new URLSearchParams(window.location.search);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalizeItemDialog.d.ts","sourceRoot":"","sources":["../src/LocalizeItemDialog.tsx"],"names":[],"mappings":"AA8BA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EAExB,MAAM,eAAe,CAAC;AAqCvB,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,uBAAuB,GAAG,WAAW,CAAC,uBAAuB,CAAC,
|
|
1
|
+
{"version":3,"file":"LocalizeItemDialog.d.ts","sourceRoot":"","sources":["../src/LocalizeItemDialog.tsx"],"names":[],"mappings":"AA8BA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EAExB,MAAM,eAAe,CAAC;AAqCvB,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,uBAAuB,GAAG,WAAW,CAAC,uBAAuB,CAAC,2CAugBtE"}
|
|
@@ -12,7 +12,7 @@ const LARGE_BATCH_WARNING_THRESHOLD = 100;
|
|
|
12
12
|
const getNextButtonLabel = (step) => step?.nextButtonLabel || step?.name || "Next";
|
|
13
13
|
// Note: DialogButtons is an internal component that might need to be added to core exports
|
|
14
14
|
// For now, we'll implement it inline
|
|
15
|
-
const DialogButtons = ({ children, ...props }) => (_jsx("div", { className: "mt-auto flex shrink-0 items-center gap-3 border-t border-
|
|
15
|
+
const DialogButtons = ({ children, ...props }) => (_jsx("div", { className: "mt-auto flex shrink-0 items-center gap-3 border-t border-border-default bg-background px-6 py-4", ...props, children: children }));
|
|
16
16
|
export function LocalizeItemDialog(props) {
|
|
17
17
|
const editContext = props.editContext;
|
|
18
18
|
const configuration = editContext.configuration.translationWizard;
|
|
@@ -163,7 +163,10 @@ export function LocalizeItemDialog(props) {
|
|
|
163
163
|
try {
|
|
164
164
|
const translationResult = await performDefaultTranslation(currentWizardData, editContext);
|
|
165
165
|
// Include batchId in result for navigation to translation management
|
|
166
|
-
const resultWithBatch = {
|
|
166
|
+
const resultWithBatch = {
|
|
167
|
+
...result,
|
|
168
|
+
batchId: translationResult.batchId,
|
|
169
|
+
};
|
|
167
170
|
// Close dialog and let parent component handle navigation to translation management
|
|
168
171
|
props.onClose?.(resultWithBatch);
|
|
169
172
|
}
|
|
@@ -281,7 +284,7 @@ export function LocalizeItemDialog(props) {
|
|
|
281
284
|
height: "min(85vh, 900px)",
|
|
282
285
|
}, children: [_jsx(StyledDialogTitle, { icon: _jsx(GlobeIcon, { strokeWidth: 1.5 }), title: `Translate · ${currentStep?.name ?? ""}`, subtitle: currentStep?.description ||
|
|
283
286
|
"Configure and start translation for your content" }), _jsx("div", { id: "translation-wizard-description", className: "sr-only", children: currentStep?.description ||
|
|
284
|
-
"Configure and start translation for your content." }), _jsxs("div", { className: "flex flex-1 flex-col min-h-0", children: [_jsx("div", { className: "flex-1 overflow-y-auto min-h-0 bg-
|
|
287
|
+
"Configure and start translation for your content." }), _jsxs("div", { className: "flex flex-1 flex-col min-h-0", children: [_jsx("div", { className: "flex-1 overflow-y-auto min-h-0 bg-neutral-grey-5", "data-testid": "translation-wizard-step-content", children: _jsx("div", { className: "h-full relative", children: activeSteps.map((step, index) => {
|
|
285
288
|
const StepComponent = step.component;
|
|
286
289
|
const isActive = index === currentStepIndex;
|
|
287
290
|
if (!StepComponent)
|
|
@@ -292,7 +295,7 @@ export function LocalizeItemDialog(props) {
|
|
|
292
295
|
if (totalTranslations <= 0)
|
|
293
296
|
return "Start Translation";
|
|
294
297
|
return `Start Translation (${totalTranslations}${isStreaming ? "+" : ""})`;
|
|
295
|
-
})()) : (_jsxs(_Fragment, { children: [getNextButtonLabel(activeSteps[currentStepIndex + 1]), _jsx(ArrowRightIcon, { className: "h-4 w-4", strokeWidth: 2 })] })) })] })] })] })] }), _jsx(AlertDialog, { open: showLargeBatchWarning, onOpenChange: setShowLargeBatchWarning, children: _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsxs(AlertDialogTitle, { className: "flex items-center gap-2", children: [_jsx(AlertTriangleIcon, { className: "h-5 w-5 text-
|
|
298
|
+
})()) : (_jsxs(_Fragment, { children: [getNextButtonLabel(activeSteps[currentStepIndex + 1]), _jsx(ArrowRightIcon, { className: "h-4 w-4", strokeWidth: 2 })] })) })] })] })] })] }), _jsx(AlertDialog, { open: showLargeBatchWarning, onOpenChange: setShowLargeBatchWarning, children: _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsxs(AlertDialogTitle, { className: "flex items-center gap-2", children: [_jsx(AlertTriangleIcon, { className: "h-5 w-5 text-feedback-orange" }), "Large Translation Batch"] }), _jsx(AlertDialogDescription, { children: (() => {
|
|
296
299
|
const { itemCount, languageCount, totalTranslations } = calculateTranslationCounts(wizardData);
|
|
297
300
|
return (_jsxs(_Fragment, { children: ["You are about to start", " ", _jsxs("strong", { children: [totalTranslations, " translations"] }), " (", itemCount, " items \u00D7 ", languageCount, " languages). Large batches may take a significant amount of time to process.", _jsx("br", {}), _jsx("br", {}), "Are you sure you want to continue?"] }));
|
|
298
301
|
})() })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { disabled: isSubmitting, children: "Cancel" }), _jsx(AlertDialogAction, { onClick: handleLargeBatchConfirm, disabled: isSubmitting, children: isSubmitting ? "Starting..." : "Continue" })] })] }) })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalizeItemUtils.d.ts","sourceRoot":"","sources":["../src/LocalizeItemUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LocalizeItemUtils.d.ts","sourceRoot":"","sources":["../src/LocalizeItemUtils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAsDjD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAIF,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,qBAAqB,EACjC,WAAW,EAAE,eAAe,GAC3B,OAAO,CAAC,iBAAiB,CAAC,CA0I5B;AAGD,eAAO,MAAM,mBAAmB,GAC9B,eAAe,MAAM,EAAE,EACvB,mBAAmB,iBAAiB,EAAE,EACtC,WAAW,MAAM,EACjB,MAAM,QAAQ,EACd,qBAAqB,MAAM,+BAkC5B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { requestBatchTranslation } from "./services/translationService";
|
|
2
|
-
import { discoverItemsTree, flattenSelectableItemsFromBackendTrees } from "./api/discovery";
|
|
1
|
+
import { requestBatchTranslation, } from "./services/translationService";
|
|
2
|
+
import { discoverItemsTree, flattenSelectableItemsFromBackendTrees, } from "./api/discovery";
|
|
3
3
|
/**
|
|
4
4
|
* Resolve the final list of item IDs to translate, expanding subitems for
|
|
5
5
|
* any selection-tree item whose includeSubitems flag is true.
|
|
@@ -10,7 +10,8 @@ import { discoverItemsTree, flattenSelectableItemsFromBackendTrees } from "./api
|
|
|
10
10
|
* 3. `items` (initial wizard input) - used as-is
|
|
11
11
|
*/
|
|
12
12
|
async function resolveItemIdsToTranslate(wizardData, sessionId) {
|
|
13
|
-
if (wizardData.selectionTreeItems &&
|
|
13
|
+
if (wizardData.selectionTreeItems &&
|
|
14
|
+
wizardData.selectionTreeItems.length > 0) {
|
|
14
15
|
const directIds = [];
|
|
15
16
|
const rootsToExpand = [];
|
|
16
17
|
for (const entry of wizardData.selectionTreeItems) {
|
|
@@ -55,15 +56,15 @@ export async function performDefaultTranslation(wizardData, editContext) {
|
|
|
55
56
|
const itemIds = await resolveItemIdsToTranslate(wizardData, editContext.sessionId);
|
|
56
57
|
// Validate that we have translation requests to process
|
|
57
58
|
if (languageMappings.length === 0 || itemIds.length === 0) {
|
|
58
|
-
const error = new Error(
|
|
59
|
-
error.name =
|
|
59
|
+
const error = new Error("No translations needed. All selected target languages match the source languages of the items.");
|
|
60
|
+
error.name = "NoTranslationsNeededError";
|
|
60
61
|
throw error;
|
|
61
62
|
}
|
|
62
63
|
// Prepare batch metadata including service-specific custom data
|
|
63
64
|
// Start with wizardData.metadata as an object
|
|
64
65
|
let metadataObj = {};
|
|
65
66
|
if (wizardData.metadata) {
|
|
66
|
-
if (typeof wizardData.metadata ===
|
|
67
|
+
if (typeof wizardData.metadata === "string") {
|
|
67
68
|
try {
|
|
68
69
|
metadataObj = JSON.parse(wizardData.metadata);
|
|
69
70
|
}
|
|
@@ -71,7 +72,7 @@ export async function performDefaultTranslation(wizardData, editContext) {
|
|
|
71
72
|
// Invalid JSON, ignore
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
|
-
else if (typeof wizardData.metadata ===
|
|
75
|
+
else if (typeof wizardData.metadata === "object") {
|
|
75
76
|
metadataObj = { ...wizardData.metadata };
|
|
76
77
|
}
|
|
77
78
|
}
|
|
@@ -85,11 +86,13 @@ export async function performDefaultTranslation(wizardData, editContext) {
|
|
|
85
86
|
if (wizardData.serviceCustomData && wizardData.serviceCustomData.size > 0) {
|
|
86
87
|
const serviceData = wizardData.serviceCustomData.get(wizardData.translationProvider);
|
|
87
88
|
if (serviceData && serviceData.enableCustomPrompt) {
|
|
88
|
-
const provider = wizardData.translationProviders.find(p => p.name === wizardData.translationProvider);
|
|
89
|
+
const provider = wizardData.translationProviders.find((p) => p.name === wizardData.translationProvider);
|
|
89
90
|
const defaultPrompt = provider?.defaultPrompt && provider.defaultPrompt.trim()
|
|
90
91
|
? provider.defaultPrompt
|
|
91
92
|
: null;
|
|
92
|
-
const customizationType = serviceData.promptCustomizationType === "replace"
|
|
93
|
+
const customizationType = serviceData.promptCustomizationType === "replace"
|
|
94
|
+
? "replace"
|
|
95
|
+
: "extend";
|
|
93
96
|
const rawCustomPrompt = (serviceData.customPrompt || "").trim();
|
|
94
97
|
let finalCustomPrompt = "";
|
|
95
98
|
if (rawCustomPrompt) {
|
|
@@ -103,13 +106,15 @@ export async function performDefaultTranslation(wizardData, editContext) {
|
|
|
103
106
|
metadataObj.serviceCustomData = {
|
|
104
107
|
[wizardData.translationProvider]: {
|
|
105
108
|
enableCustomPrompt: serviceData.enableCustomPrompt,
|
|
106
|
-
customPrompt: finalCustomPrompt
|
|
107
|
-
}
|
|
109
|
+
customPrompt: finalCustomPrompt,
|
|
110
|
+
},
|
|
108
111
|
};
|
|
109
112
|
}
|
|
110
113
|
}
|
|
111
114
|
// Serialize metadata to JSON string (or undefined if empty)
|
|
112
|
-
const batchMetadata = Object.keys(metadataObj).length > 0
|
|
115
|
+
const batchMetadata = Object.keys(metadataObj).length > 0
|
|
116
|
+
? JSON.stringify(metadataObj)
|
|
117
|
+
: undefined;
|
|
113
118
|
const batchResult = await requestBatchTranslation({
|
|
114
119
|
sessionId: editContext.sessionId,
|
|
115
120
|
provider: wizardData.translationProvider,
|
|
@@ -118,18 +123,20 @@ export async function performDefaultTranslation(wizardData, editContext) {
|
|
|
118
123
|
itemIds,
|
|
119
124
|
});
|
|
120
125
|
if (batchResult.type === "error") {
|
|
121
|
-
console.error(
|
|
126
|
+
console.error("Translation request failed:", batchResult);
|
|
122
127
|
// Throw an error so the caller can handle it (e.g., show a toast)
|
|
123
|
-
const errorMessage = batchResult.details ||
|
|
128
|
+
const errorMessage = batchResult.details ||
|
|
129
|
+
batchResult.summary ||
|
|
130
|
+
"Translation request failed";
|
|
124
131
|
const error = new Error(errorMessage);
|
|
125
|
-
error.name =
|
|
132
|
+
error.name = "TranslationRequestError";
|
|
126
133
|
throw error;
|
|
127
134
|
}
|
|
128
135
|
const batchResponse = batchResult.data;
|
|
129
136
|
if (!batchResponse) {
|
|
130
|
-
console.error(
|
|
131
|
-
const error = new Error(
|
|
132
|
-
error.name =
|
|
137
|
+
console.error("Batch response is undefined");
|
|
138
|
+
const error = new Error("Server returned an empty response");
|
|
139
|
+
error.name = "TranslationRequestError";
|
|
133
140
|
throw error;
|
|
134
141
|
}
|
|
135
142
|
const started = batchResponse.started?.map((result) => ({
|
|
@@ -138,7 +145,7 @@ export async function performDefaultTranslation(wizardData, editContext) {
|
|
|
138
145
|
jobId: result.jobId,
|
|
139
146
|
})) || [];
|
|
140
147
|
if (batchResponse.skipped && batchResponse.skipped.length > 0) {
|
|
141
|
-
console.warn(
|
|
148
|
+
console.warn("Some translations were skipped:", batchResponse.skipped);
|
|
142
149
|
}
|
|
143
150
|
return { started, batchId: batchResponse.id };
|
|
144
151
|
}
|
|
@@ -148,21 +155,24 @@ export const defaultTranslateAll = async (languageCodes, translationStatus, sess
|
|
|
148
155
|
const wizardData = {
|
|
149
156
|
items: [item],
|
|
150
157
|
targetLanguages: languageCodes,
|
|
151
|
-
languageData: new Map(languageCodes.map(lang => {
|
|
152
|
-
const status = translationStatus?.find(x => x.targetLanguage === lang);
|
|
153
|
-
return [
|
|
158
|
+
languageData: new Map(languageCodes.map((lang) => {
|
|
159
|
+
const status = translationStatus?.find((x) => x.targetLanguage === lang);
|
|
160
|
+
return [
|
|
161
|
+
lang,
|
|
162
|
+
{
|
|
154
163
|
name: lang,
|
|
155
164
|
languageCode: lang,
|
|
156
165
|
items: [item.descriptor],
|
|
157
|
-
translationStatus: status
|
|
158
|
-
}
|
|
166
|
+
translationStatus: status,
|
|
167
|
+
},
|
|
168
|
+
];
|
|
159
169
|
})),
|
|
160
170
|
translationProvider,
|
|
161
171
|
includeSubitems: false,
|
|
162
172
|
discoveredItems: [],
|
|
163
173
|
itemMetadata: new Map(),
|
|
164
174
|
metadata: null,
|
|
165
|
-
translationProviders: []
|
|
175
|
+
translationProviders: [],
|
|
166
176
|
};
|
|
167
177
|
const editContext = { sessionId };
|
|
168
178
|
const result = await performDefaultTranslation(wizardData, editContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/api/discovery.ts"],"names":[],"mappings":"AAEA,wBAAsB,gBAAgB,CACpC,GAAG,EAAE;
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/api/discovery.ts"],"names":[],"mappings":"AAEA,wBAAsB,gBAAgB,CACpC,GAAG,EAAE;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,EACD,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CA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,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtE;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,EAC1C,UAAU,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,EAChD,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,GACrD,OAAO,CAAC,MAAM,CAAC,CAsEjB"}
|
package/dist/api/discovery.js
CHANGED
|
@@ -23,7 +23,15 @@ export function convertBackendTreeToTreeNodes(trees) {
|
|
|
23
23
|
const convert = (n) => ({
|
|
24
24
|
key: n.id,
|
|
25
25
|
label: n.name,
|
|
26
|
-
data: {
|
|
26
|
+
data: {
|
|
27
|
+
id: n.id,
|
|
28
|
+
name: n.name,
|
|
29
|
+
path: n.path,
|
|
30
|
+
isFolder: n.isFolder,
|
|
31
|
+
icon: n.icon,
|
|
32
|
+
parentId: undefined,
|
|
33
|
+
hasChildren: (n.children?.length ?? 0) > 0,
|
|
34
|
+
},
|
|
27
35
|
children: n.children?.map(convert) || [],
|
|
28
36
|
});
|
|
29
37
|
return trees.map(convert);
|
|
@@ -31,7 +39,13 @@ export function convertBackendTreeToTreeNodes(trees) {
|
|
|
31
39
|
export function flattenSelectableItemsFromBackendTrees(trees) {
|
|
32
40
|
const out = [];
|
|
33
41
|
const walk = (n) => {
|
|
34
|
-
out.push({
|
|
42
|
+
out.push({
|
|
43
|
+
id: n.id,
|
|
44
|
+
name: n.name,
|
|
45
|
+
path: n.path,
|
|
46
|
+
hasChildren: (n.children?.length ?? 0) > 0,
|
|
47
|
+
parentId: undefined,
|
|
48
|
+
});
|
|
35
49
|
n.children?.forEach(walk);
|
|
36
50
|
};
|
|
37
51
|
trees.forEach(walk);
|
|
@@ -54,7 +68,10 @@ export async function streamSubitemCount(req, onProgress, options) {
|
|
|
54
68
|
method: "POST",
|
|
55
69
|
body: JSON.stringify({ ItemId: req.itemId, Language: req.language }),
|
|
56
70
|
credentials: "include",
|
|
57
|
-
headers: {
|
|
71
|
+
headers: {
|
|
72
|
+
"Content-Type": "application/json",
|
|
73
|
+
Accept: "application/x-ndjson",
|
|
74
|
+
},
|
|
58
75
|
signal: options?.signal,
|
|
59
76
|
});
|
|
60
77
|
if (!response.ok || !response.body) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTranslationWizard.d.ts","sourceRoot":"","sources":["../../src/hooks/useTranslationWizard.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"useTranslationWizard.d.ts","sourceRoot":"","sources":["../../src/hooks/useTranslationWizard.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAUhF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,uBAAuB;;;EAsGlE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState, useEffect } from "react";
|
|
2
2
|
import { getLanguagesAndVersions } from "@parhelia/core";
|
|
3
|
-
import { getTranslationStatus, getTranslationProviders } from "../services/translationService";
|
|
3
|
+
import { getTranslationStatus, getTranslationProviders, } from "../services/translationService";
|
|
4
4
|
import { localStorageService } from "@parhelia/core";
|
|
5
5
|
export function useTranslationWizard(props) {
|
|
6
6
|
const [wizardData, setWizardData] = useState({
|
|
@@ -24,7 +24,7 @@ export function useTranslationWizard(props) {
|
|
|
24
24
|
if (providers.length > 0) {
|
|
25
25
|
const savedProvider = localStorageService.getString("editor.translationProvider");
|
|
26
26
|
// Validate that saved provider exists in current providers by name
|
|
27
|
-
const validProvider = savedProvider && providers.find(p => p.name === savedProvider)
|
|
27
|
+
const validProvider = savedProvider && providers.find((p) => p.name === savedProvider)
|
|
28
28
|
? savedProvider
|
|
29
29
|
: providers[0]?.name || "";
|
|
30
30
|
const defaultProvider = validProvider;
|
|
@@ -56,7 +56,7 @@ export function useTranslationWizard(props) {
|
|
|
56
56
|
languageMap.set(language.languageCode, languageData);
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
|
-
setWizardData(prevData => ({
|
|
59
|
+
setWizardData((prevData) => ({
|
|
60
60
|
...prevData,
|
|
61
61
|
translationProviders: providers,
|
|
62
62
|
translationProvider: defaultProvider,
|
|
@@ -9,7 +9,7 @@ export type TranslationApiResponse<T> = {
|
|
|
9
9
|
export type TranslationRequestResponse = {
|
|
10
10
|
jobId: string;
|
|
11
11
|
};
|
|
12
|
-
export declare function requestTranslation({ itemId, targetLanguage, sourceLanguage, sessionId, provider, metadata, batchId }: {
|
|
12
|
+
export declare function requestTranslation({ itemId, targetLanguage, sourceLanguage, sessionId, provider, metadata, batchId, }: {
|
|
13
13
|
itemId: string;
|
|
14
14
|
targetLanguage: string;
|
|
15
15
|
sourceLanguage: string;
|
|
@@ -142,7 +142,7 @@ export type BatchTranslationResponse = {
|
|
|
142
142
|
started: BatchTranslationResult[];
|
|
143
143
|
skipped: BatchTranslationError[];
|
|
144
144
|
};
|
|
145
|
-
export declare function requestBatchTranslation({ sessionId, provider, batchMetadata, languageMappings, itemIds }: {
|
|
145
|
+
export declare function requestBatchTranslation({ sessionId, provider, batchMetadata, languageMappings, itemIds, }: {
|
|
146
146
|
sessionId: string;
|
|
147
147
|
provider: string;
|
|
148
148
|
batchMetadata?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translationService.d.ts","sourceRoot":"","sources":["../../src/services/translationService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAGzD,MAAM,MAAM,sBAAsB,CAAC,CAAC,IAAI;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3D,wBAAsB,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"translationService.d.ts","sourceRoot":"","sources":["../../src/services/translationService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAGzD,MAAM,MAAM,sBAAsB,CAAC,CAAC,IAAI;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3D,wBAAsB,kBAAkB,CAAC,EACvC,MAAM,EACN,cAAc,EACd,cAAc,EACd,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,OAAO,GACR,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,iFAaA;AAED,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,MAAM,0EAIxD;AAED,wBAAsB,uBAAuB,iFAI5C;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,C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E,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,+BAA+B,EAAE,CAAC;IAC3C,OAAO,EAAE,+BAA+B,EAAE,CAAC;CAC5C,CAAC;AAEF,wBAAsB,qBAAqB,CAAC,EAC1C,SAAS,EACT,aAAa,EACb,QAAQ,EACR,IAAI,GACL,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,+BAA+B,EAAE,CAAC;CACzC,oFAKA"}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { get, post } from "@parhelia/core";
|
|
2
|
-
export async function requestTranslation({ itemId, targetLanguage, sourceLanguage, sessionId, provider, metadata, batchId }) {
|
|
3
|
-
return await post("/parhelia/translation/requestTranslation", {
|
|
2
|
+
export async function requestTranslation({ itemId, targetLanguage, sourceLanguage, sessionId, provider, metadata, batchId, }) {
|
|
3
|
+
return await post("/parhelia/translation/requestTranslation", {
|
|
4
|
+
itemId,
|
|
5
|
+
targetLanguage,
|
|
6
|
+
sourceLanguage,
|
|
7
|
+
sessionId,
|
|
8
|
+
provider,
|
|
9
|
+
metadata,
|
|
10
|
+
batchId,
|
|
11
|
+
});
|
|
4
12
|
}
|
|
5
13
|
export async function getTranslationStatus(itemId) {
|
|
6
14
|
return await get(`/parhelia/translation/getTranslations?itemId=${itemId}`);
|
|
@@ -65,7 +73,9 @@ export async function listBatches(take = 100, skip = 0, filters = {}) {
|
|
|
65
73
|
return await get(`/parhelia/translation/batches?${params.toString()}`);
|
|
66
74
|
}
|
|
67
75
|
export async function deleteBatch(id) {
|
|
68
|
-
return await post("/parhelia/translation/deleteBatch", {
|
|
76
|
+
return await post("/parhelia/translation/deleteBatch", {
|
|
77
|
+
id,
|
|
78
|
+
});
|
|
69
79
|
}
|
|
70
80
|
export async function abortJob(id) {
|
|
71
81
|
return await post("/parhelia/translation/abortJob", { id });
|
|
@@ -79,8 +89,14 @@ export async function subscribeToBatch(batchId, sessionId) {
|
|
|
79
89
|
export async function unsubscribeFromBatch(batchId, sessionId) {
|
|
80
90
|
return await post("/parhelia/translation/unsubscribeFromBatch", { batchId, sessionId });
|
|
81
91
|
}
|
|
82
|
-
export async function requestBatchTranslation({ sessionId, provider, batchMetadata, languageMappings, itemIds }) {
|
|
83
|
-
return await post("/parhelia/translation/requestBatchTranslation", {
|
|
92
|
+
export async function requestBatchTranslation({ sessionId, provider, batchMetadata, languageMappings, itemIds, }) {
|
|
93
|
+
return await post("/parhelia/translation/requestBatchTranslation", {
|
|
94
|
+
sessionId,
|
|
95
|
+
provider,
|
|
96
|
+
batchMetadata: batchMetadata || "",
|
|
97
|
+
languageMappings,
|
|
98
|
+
itemIds,
|
|
99
|
+
});
|
|
84
100
|
}
|
|
85
101
|
export async function retryBatchTranslation({ sessionId, sourceBatchId, provider, jobs, }) {
|
|
86
102
|
return await post("/parhelia/translation/retryBatchTranslation", { sessionId, sourceBatchId, provider, jobs });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranslationServicesPanel.d.ts","sourceRoot":"","sources":["../../src/settings/TranslationServicesPanel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TranslationServicesPanel.d.ts","sourceRoot":"","sources":["../../src/settings/TranslationServicesPanel.tsx"],"names":[],"mappings":"AAkEA;;;GAGG;AACH,wBAAgB,wBAAwB,4CA4pBvC;AAED,eAAe,wBAAwB,CAAC"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useState, useEffect, } from "react";
|
|
3
|
-
import { Button, useEditContext, Splitter, ItemConfigPanel, } from "@parhelia/core";
|
|
4
|
-
import { CheckCircle as LucideCheckCircle, AlertCircle as LucideAlertCircle, RefreshCw as LucideRefreshCw, Plus as LucidePlus, Settings as LucideSettings,
|
|
3
|
+
import { Button, Card, useEditContext, Splitter, ItemConfigPanel, DeleteIcon, } from "@parhelia/core";
|
|
4
|
+
import { CheckCircle as LucideCheckCircle, AlertCircle as LucideAlertCircle, RefreshCw as LucideRefreshCw, Plus as LucidePlus, Settings as LucideSettings, Languages as LucideLanguages, ListChecks as LucideListChecks, } from "lucide-react";
|
|
5
5
|
import { getAvailableTranslationServices, createProviderSettings, getTranslationStructure, ensureTranslationStructure, } from "../services/translationService";
|
|
6
6
|
const CheckCircleIcon = LucideCheckCircle;
|
|
7
7
|
const AlertCircleIcon = LucideAlertCircle;
|
|
8
8
|
const RefreshCwIcon = LucideRefreshCw;
|
|
9
9
|
const PlusIcon = LucidePlus;
|
|
10
10
|
const SettingsIcon = LucideSettings;
|
|
11
|
-
const
|
|
11
|
+
const LanguagesIcon = LucideLanguages;
|
|
12
|
+
const ListChecksIcon = LucideListChecks;
|
|
12
13
|
const DEFAULT_STRUCTURE_SETTINGS = {
|
|
13
14
|
translationFolderPath: "/sitecore/system/Parhelia/Settings/Translation",
|
|
14
15
|
translationFolderTemplateId: "b1e40cfe-6e36-4a0e-a49e-19c10b2127b7",
|
|
@@ -241,23 +242,25 @@ export function TranslationServicesPanel() {
|
|
|
241
242
|
const translationFolderExists = !!structureState?.translationFolder?.exists;
|
|
242
243
|
const providersFolderExists = !!structureState?.translationProvidersFolder?.exists;
|
|
243
244
|
// Build the services list content
|
|
244
|
-
const servicesListContent = (
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
245
|
+
const servicesListContent = (_jsxs("div", { className: "flex h-full flex-col gap-4 p-4", "data-testid": "translation-services-panel", children: [_jsx(Card, { icon: _jsx(ListChecksIcon, { strokeWidth: 1, className: "h-5 w-5" }), title: "Prerequisites", description: "Required Sitecore folders for translation settings.", noPadding: true, className: "shrink-0", headerActions: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "flex items-center gap-1.5 text-xs text-neutral-grey-50", children: translationFolderExists && providersFolderExists ? (_jsxs(_Fragment, { children: [_jsx(CheckCircleIcon, { className: "h-3.5 w-3.5 text-feedback-green", strokeWidth: 1.5 }), "All parent items found"] })) : (_jsxs(_Fragment, { children: [_jsx(AlertCircleIcon, { className: "h-3.5 w-3.5 text-feedback-orange", strokeWidth: 1.5 }), "Parent items missing"] })) }), !providersFolderExists && (_jsxs(Button, { size: "sm", variant: "default", onClick: ensureStructure, disabled: ensuringStructure || structureLoading, children: [ensuringStructure ? (_jsx(RefreshCwIcon, { strokeWidth: 1, className: "mr-1 h-4 w-4 animate-spin" })) : (_jsx(PlusIcon, { strokeWidth: 1.75, className: "mr-1 h-4 w-4" })), "Ensure items"] }))] }), children: _jsxs("div", { className: "divide-y divide-border-default border-t border-border-default", children: [_jsxs("div", { "data-testid": "translation-structure-folder", className: `flex items-center gap-3 px-3 py-3 text-sm transition-colors ${selectedConfigTarget?.key ===
|
|
246
|
+
`structure:${structureState?.translationFolder?.itemId}`
|
|
247
|
+
? "bg-feedback-blue-light"
|
|
248
|
+
: "bg-white"}`, children: [translationFolderExists ? (_jsx(CheckCircleIcon, { className: "h-4 w-4 shrink-0 text-feedback-green", strokeWidth: 1.5 })) : (_jsx(AlertCircleIcon, { className: "h-4 w-4 shrink-0 text-feedback-orange", strokeWidth: 1.5 })), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "font-medium text-neutral-grey-100", children: "Translation folder" }), _jsx("div", { className: "mt-0.5 truncate font-mono text-xs text-neutral-grey-50", children: structureSettings.translationFolderPath })] }), translationFolderExists &&
|
|
249
|
+
structureState?.translationFolder?.itemId && (_jsx(Button, { size: "sm", variant: "ghost", onClick: () => handleOpenStructureConfig(structureState.translationFolder.itemId, "Configure: Translation folder"), title: "Configure", children: _jsx(SettingsIcon, { className: "h-3.5 w-3.5", strokeWidth: 1.5 }) }))] }), _jsxs("div", { "data-testid": "translation-structure-providers-folder", className: `flex items-center gap-3 px-3 py-3 text-sm transition-colors ${selectedConfigTarget?.key ===
|
|
250
|
+
`structure:${structureState?.translationProvidersFolder?.itemId}`
|
|
251
|
+
? "bg-feedback-blue-light"
|
|
252
|
+
: "bg-white"}`, children: [providersFolderExists ? (_jsx(CheckCircleIcon, { className: "h-4 w-4 shrink-0 text-feedback-green", strokeWidth: 1.5 })) : (_jsx(AlertCircleIcon, { className: "h-4 w-4 shrink-0 text-feedback-orange", strokeWidth: 1.5 })), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "font-medium text-neutral-grey-100", children: "Translation providers folder" }), _jsx("div", { className: "mt-0.5 truncate font-mono text-xs text-neutral-grey-50", children: structureSettings.translationProvidersPath })] }), providersFolderExists &&
|
|
253
|
+
structureState?.translationProvidersFolder?.itemId && (_jsx(Button, { size: "sm", variant: "ghost", onClick: () => handleOpenStructureConfig(structureState.translationProvidersFolder.itemId, "Configure: Translation Providers folder"), title: "Configure", children: _jsx(SettingsIcon, { className: "h-3.5 w-3.5", strokeWidth: 1.5 }) }))] })] }) }), _jsxs(Card, { icon: _jsx(LanguagesIcon, { strokeWidth: 1, className: "h-5 w-5" }), title: _jsxs(_Fragment, { children: ["Translation providers", " ", _jsxs("span", { className: "font-normal text-neutral-grey-50", children: ["(", configuredCount, " of ", totalCount, " configured)"] })] }), description: "Translation services registered in Parhelia and their settings.", noPadding: true, className: "flex min-h-0 flex-1 flex-col overflow-hidden", children: [((totalCount === 0 && state === "success") || error) && (_jsxs("div", { className: "border-border-default space-y-2 border-t px-4 py-3", children: [totalCount === 0 && state === "success" && (_jsx("div", { className: "rounded border border-feedback-orange bg-feedback-orange-light p-2 text-xs text-feedback-orange", children: "No translation services are registered in dependency injection. Please check the server configuration." })), error && (_jsx("div", { className: "rounded border border-feedback-red bg-feedback-red-light p-2 text-xs whitespace-pre-wrap text-feedback-red", children: error }))] })), _jsx("div", { className: "min-h-0 flex-1 overflow-y-auto border-t border-border-default", "data-testid": "translation-services-providers", children: services.length > 0 && (_jsx("div", { className: "divide-y divide-border-default", children: services.map((service) => {
|
|
254
|
+
const isSelected = selectedConfigTarget?.key ===
|
|
255
|
+
`service:${service.serviceName}`;
|
|
256
|
+
const isConfigured = service.isConfigured;
|
|
257
|
+
return (_jsxs("div", { className: `group flex items-center gap-3 px-3 py-3 text-sm transition-colors ${isSelected
|
|
258
|
+
? "bg-feedback-blue-light"
|
|
259
|
+
: "bg-white hover:bg-neutral-grey-5"}`, children: [isConfigured ? (_jsx(CheckCircleIcon, { className: "h-4 w-4 shrink-0 text-feedback-green", strokeWidth: 1.5 })) : (_jsx(AlertCircleIcon, { className: "h-4 w-4 shrink-0 text-feedback-orange", strokeWidth: 1.5 })), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-1.5", children: [_jsx("span", { className: "truncate font-medium text-neutral-grey-100", children: service.displayName || service.serviceName }), service.displayName &&
|
|
260
|
+
service.displayName !== service.serviceName && (_jsx("span", { className: "shrink-0 rounded bg-neutral-grey-5 badge-pad-sm text-[10px] font-medium text-neutral-grey-50", children: service.serviceName })), !isConfigured && (_jsx("span", { className: "shrink-0 rounded bg-feedback-orange-light badge-pad-sm text-[10px] font-medium text-feedback-orange", children: "Not configured" }))] }), isConfigured &&
|
|
261
|
+
service.supportedLanguages &&
|
|
262
|
+
service.supportedLanguages.length > 0 && (_jsxs("div", { className: "mt-0.5 truncate text-xs text-neutral-grey-50", children: ["Languages: ", service.supportedLanguages.join(", ")] }))] }), _jsx("div", { className: "flex shrink-0 items-center gap-0.5", children: isConfigured && service.settingsItemId ? (_jsxs("div", { className: "flex items-center gap-0.5 opacity-60 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100", children: [_jsx(Button, { size: "sm", variant: "ghost", onClick: () => handleOpenConfig(service), disabled: service.deleting, title: "Configure", children: _jsx(SettingsIcon, { className: "h-3.5 w-3.5", strokeWidth: 1.5 }) }), _jsx(Button, { size: "sm", variant: "ghost", onClick: () => deleteSettings(service), className: "text-neutral-grey-50 hover:bg-neutral-grey-5 hover:text-neutral-grey-50", disabled: service.deleting, title: `Delete settings for ${service.displayName || service.serviceName}`, children: service.deleting ? (_jsx(RefreshCwIcon, { strokeWidth: 1, className: "h-3.5 w-3.5 animate-spin" })) : (_jsx(DeleteIcon, { size: "md" })) })] })) : (_jsxs(Button, { size: "sm", variant: "default", onClick: () => createSettings(service.serviceName, service.templateId), disabled: service.creating, title: `Create settings using template: ${service.templateName}`, children: [service.creating ? (_jsx(RefreshCwIcon, { strokeWidth: 1, className: "mr-1 h-3.5 w-3.5 animate-spin" })) : (_jsx(PlusIcon, { strokeWidth: 1.75, className: "mr-1 h-3.5 w-3.5" })), "Create"] })) })] }, service.serviceName));
|
|
263
|
+
}) })) })] })] }));
|
|
261
264
|
// Build splitter panels - only show config panel when a service is selected
|
|
262
265
|
const panels = selectedConfigTarget?.itemId
|
|
263
266
|
? [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalizationSetupStep.d.ts","sourceRoot":"","sources":["../../src/setup/LocalizationSetupStep.tsx"],"names":[],"mappings":"AAgCA,wBAAgB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"LocalizationSetupStep.d.ts","sourceRoot":"","sources":["../../src/setup/LocalizationSetupStep.tsx"],"names":[],"mappings":"AAgCA,wBAAgB,qBAAqB,4CA6QpC;AAED,eAAe,qBAAqB,CAAC"}
|