@parhelia/localization 0.1.12447 → 0.1.12451
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.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAatD,OAAO,EACL,mBAAmB,EAGpB,MAAM,gBAAgB,CAAC;AAUxB,QAAA,MAAM,wCAAwC;;;;;;;;;;;;8BAalB,qBAAqB;;CAchD,CAAC;AAEF,QAAA,MAAM,4CAA4C;;;;;;;CAUjD,CAAC;AAkCF,OAAO,EAAE,wCAAwC,EAAE,4CAA4C,EAAE,CAAC;AAClG,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,YAAY,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,yBAAyB,EACzB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,YAAY,EAAE,u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L,mBAAmB,EACnB,eAAe,EACf,yBAAyB,EACzB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,YAAY,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEhF,MAAM,MAAM,yBAAyB,GAAG;IACtC;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,mBAAmB,EAClC,OAAO,CAAC,EAAE,yBAAyB,uBAsHpC"}
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,6 @@ import { localizeItemCommand } from "./LocalizeItemCommand";
|
|
|
6
6
|
import { TranslationSidebar } from "./sidebar/TranslationSidebar";
|
|
7
7
|
import { TranslationManagement } from "./translation-center/TranslationManagement";
|
|
8
8
|
import { RecentTranslations } from "./translation-center/RecentTranslations";
|
|
9
|
-
import { LocalizationSetupStep } from "./setup/LocalizationSetupStep";
|
|
10
9
|
import { TranslationServicesPanel } from "./settings/TranslationServicesPanel";
|
|
11
10
|
import { Languages as LucideLanguages, LayoutGrid as LucideLayoutGrid, Globe as LucideGlobe, } from "lucide-react";
|
|
12
11
|
const LanguagesIcon = LucideLanguages;
|
|
@@ -179,20 +178,10 @@ export function configureLocalization(configuration, options) {
|
|
|
179
178
|
icon: _jsx(LanguagesIcon, { strokeWidth: 1 }),
|
|
180
179
|
content: _jsx(TranslationServicesPanel, {}),
|
|
181
180
|
};
|
|
182
|
-
const localizationSetupPanel = {
|
|
183
|
-
id: "localization-setup",
|
|
184
|
-
title: "Localization Setup",
|
|
185
|
-
subtitle: "Verify translation services and create provider settings items",
|
|
186
|
-
icon: _jsx(LanguagesIcon, { strokeWidth: 1 }),
|
|
187
|
-
content: _jsx(LocalizationSetupStep, {}),
|
|
188
|
-
};
|
|
189
181
|
const ensureLocalizationPanels = (group) => {
|
|
190
182
|
if (!group.panels.some((p) => p.id === "translation-services")) {
|
|
191
183
|
group.panels.push(translationServicesPanel);
|
|
192
184
|
}
|
|
193
|
-
if (!group.panels.some((p) => p.id === "localization-setup")) {
|
|
194
|
-
group.panels.push(localizationSetupPanel);
|
|
195
|
-
}
|
|
196
185
|
};
|
|
197
186
|
if (localizationGroupIndex >= 0) {
|
|
198
187
|
const group = configuration.settings.groups[localizationGroupIndex];
|
|
@@ -206,7 +195,7 @@ export function configureLocalization(configuration, options) {
|
|
|
206
195
|
const localizationGroup = {
|
|
207
196
|
title: "Localization",
|
|
208
197
|
icon: _jsx(LanguagesIcon, { strokeWidth: 1 }),
|
|
209
|
-
panels: [translationServicesPanel
|
|
198
|
+
panels: [translationServicesPanel],
|
|
210
199
|
};
|
|
211
200
|
if (aboutIndex >= 0) {
|
|
212
201
|
groups.splice(aboutIndex, 0, localizationGroup);
|
|
@@ -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":"AAgEA;;;GAGG;AACH,wBAAgB,wBAAwB,4CAktBvC;AAED,eAAe,wBAAwB,CAAC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useState, useEffect, } from "react";
|
|
3
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, } from "lucide-react";
|
|
4
|
+
import { CheckCircle as LucideCheckCircle, AlertCircle as LucideAlertCircle, RefreshCw as LucideRefreshCw, Plus as LucidePlus, Settings as LucideSettings, Trash2 as LucideTrash2, } 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 Trash2Icon = LucideTrash2;
|
|
11
12
|
const DEFAULT_STRUCTURE_SETTINGS = {
|
|
12
13
|
translationFolderPath: "/sitecore/system/Parhelia/Settings/Translation",
|
|
13
14
|
translationFolderTemplateId: "b1e40cfe-6e36-4a0e-a49e-19c10b2127b7",
|
|
@@ -118,6 +119,7 @@ export function TranslationServicesPanel() {
|
|
|
118
119
|
const serviceStates = availableServices.map((svc) => ({
|
|
119
120
|
...svc,
|
|
120
121
|
creating: false,
|
|
122
|
+
deleting: false,
|
|
121
123
|
}));
|
|
122
124
|
setServices(serviceStates);
|
|
123
125
|
setState(availableServices.length === 0 ? "error" : "success");
|
|
@@ -193,6 +195,53 @@ export function TranslationServicesPanel() {
|
|
|
193
195
|
setServices((prev) => prev.map((s) => s.serviceName === serviceName ? { ...s, creating: false } : s));
|
|
194
196
|
}
|
|
195
197
|
}, [editContext, loadData, structureSettings]);
|
|
198
|
+
const deleteSettings = useCallback(async (service) => {
|
|
199
|
+
if (!editContext || !service.settingsItemId)
|
|
200
|
+
return;
|
|
201
|
+
try {
|
|
202
|
+
setServices((prev) => prev.map((s) => s.serviceName === service.serviceName
|
|
203
|
+
? { ...s, deleting: true }
|
|
204
|
+
: s));
|
|
205
|
+
setError(null);
|
|
206
|
+
const language = editContext.item?.language ??
|
|
207
|
+
editContext.currentItemDescriptor?.language ??
|
|
208
|
+
"en";
|
|
209
|
+
const deleted = await editContext.operations.deleteItems([
|
|
210
|
+
{
|
|
211
|
+
id: service.settingsItemId,
|
|
212
|
+
language,
|
|
213
|
+
version: 0,
|
|
214
|
+
},
|
|
215
|
+
]);
|
|
216
|
+
if (deleted) {
|
|
217
|
+
if (selectedConfigTarget?.key === `service:${service.serviceName}` ||
|
|
218
|
+
selectedConfigTarget?.itemId === service.settingsItemId) {
|
|
219
|
+
setSelectedConfigTarget(null);
|
|
220
|
+
}
|
|
221
|
+
setServices((prev) => prev.map((s) => s.serviceName === service.serviceName
|
|
222
|
+
? {
|
|
223
|
+
...s,
|
|
224
|
+
isConfigured: false,
|
|
225
|
+
settingsItemId: undefined,
|
|
226
|
+
deleting: false,
|
|
227
|
+
}
|
|
228
|
+
: s));
|
|
229
|
+
await loadData();
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
setServices((prev) => prev.map((s) => s.serviceName === service.serviceName
|
|
233
|
+
? { ...s, deleting: false }
|
|
234
|
+
: s));
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
catch (e) {
|
|
238
|
+
setError(e?.message ||
|
|
239
|
+
`Failed to delete settings for ${service.displayName || service.serviceName}`);
|
|
240
|
+
setServices((prev) => prev.map((s) => s.serviceName === service.serviceName
|
|
241
|
+
? { ...s, deleting: false }
|
|
242
|
+
: s));
|
|
243
|
+
}
|
|
244
|
+
}, [editContext, loadData, selectedConfigTarget]);
|
|
196
245
|
useEffect(() => {
|
|
197
246
|
loadData();
|
|
198
247
|
}, [loadData]);
|
|
@@ -234,7 +283,7 @@ export function TranslationServicesPanel() {
|
|
|
234
283
|
: "border-gray-200 bg-white"}`, children: [_jsxs("div", { className: "flex items-center gap-3 flex-1 min-w-0", children: [service.isConfigured ? (_jsx(CheckCircleIcon, { className: "h-4 w-4 text-green-600 shrink-0", strokeWidth: 1.5 })) : (_jsx(AlertCircleIcon, { className: "h-4 w-4 text-amber-500 shrink-0", strokeWidth: 1.5 })), _jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("div", { className: "font-medium text-gray-900 truncate", children: service.displayName || service.serviceName }), service.displayName &&
|
|
235
284
|
service.displayName !== service.serviceName && (_jsxs("div", { className: "text-xs text-gray-500 truncate", children: ["Service: ", service.serviceName] })), service.isConfigured &&
|
|
236
285
|
service.supportedLanguages &&
|
|
237
|
-
service.supportedLanguages.length > 0 && (_jsxs("div", { className: "text-xs text-gray-500 mt-1 truncate", children: ["Languages:", " ", service.supportedLanguages.join(", ")] })), !service.isConfigured && (_jsx("div", { className: "text-xs text-amber-600 mt-1", children: "Not configured" }))] })] }), _jsx("div", { className: "flex items-center gap-2 ml-4 shrink-0", children: service.isConfigured && service.settingsItemId ? (_jsxs(Button, { size: "sm", variant: isSelected ? "default" : "ghost", onClick: () => handleOpenConfig(service), className: "shrink-0", children: [_jsx(SettingsIcon, { className: "h-4 w-4", strokeWidth: 1.5 }), editContext?.isMobile ? "" : "Configure"] })) : (_jsxs(Button, { size: "sm", variant: "outline", onClick: () => createSettings(service.serviceName, service.templateId), disabled: service.creating, title: `Create settings using template: ${service.templateName}`, className: "shrink-0", children: [service.creating ? (_jsx(RefreshCwIcon, { strokeWidth: 1, className: "h-4 w-4 animate-spin" })) : (_jsx(PlusIcon, { strokeWidth: 1.5, className: "h-4 w-4" })), "Create Settings"] })) })] }, service.serviceName));
|
|
286
|
+
service.supportedLanguages.length > 0 && (_jsxs("div", { className: "text-xs text-gray-500 mt-1 truncate", children: ["Languages:", " ", service.supportedLanguages.join(", ")] })), !service.isConfigured && (_jsx("div", { className: "text-xs text-amber-600 mt-1", children: "Not configured" }))] })] }), _jsx("div", { className: "flex items-center gap-2 ml-4 shrink-0", children: service.isConfigured && service.settingsItemId ? (_jsxs(_Fragment, { children: [_jsxs(Button, { size: "sm", variant: isSelected ? "default" : "ghost", onClick: () => handleOpenConfig(service), className: "shrink-0", disabled: service.deleting, children: [_jsx(SettingsIcon, { className: "h-4 w-4", strokeWidth: 1.5 }), editContext?.isMobile ? "" : "Configure"] }), _jsxs(Button, { size: "sm", variant: "ghost", onClick: () => deleteSettings(service), className: "shrink-0 text-red-600 hover:text-red-700", disabled: service.deleting, title: `Delete settings for ${service.displayName || service.serviceName}`, children: [service.deleting ? (_jsx(RefreshCwIcon, { strokeWidth: 1, className: "h-4 w-4 animate-spin" })) : (_jsx(Trash2Icon, { className: "h-4 w-4", strokeWidth: 1.5 })), editContext?.isMobile ? "" : "Delete"] })] })) : (_jsxs(Button, { size: "sm", variant: "outline", onClick: () => createSettings(service.serviceName, service.templateId), disabled: service.creating, title: `Create settings using template: ${service.templateName}`, className: "shrink-0", children: [service.creating ? (_jsx(RefreshCwIcon, { strokeWidth: 1, className: "h-4 w-4 animate-spin" })) : (_jsx(PlusIcon, { strokeWidth: 1.5, className: "h-4 w-4" })), "Create Settings"] })) })] }, service.serviceName));
|
|
238
287
|
}) })), error && (_jsx("div", { className: "rounded border border-red-200 bg-red-50 p-3 text-sm text-red-700 whitespace-pre-wrap", children: error }))] }) }) }) }));
|
|
239
288
|
// Build splitter panels - only show config panel when a service is selected
|
|
240
289
|
const panels = selectedConfigTarget?.itemId
|