@parhelia/localization 0.1.12453 → 0.1.12470

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.
@@ -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,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,eAA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B,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,uBAiIpC"}
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ 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";
9
10
  import { TranslationServicesPanel } from "./settings/TranslationServicesPanel";
10
11
  import { Languages as LucideLanguages, LayoutGrid as LucideLayoutGrid, Globe as LucideGlobe, } from "lucide-react";
11
12
  const LanguagesIcon = LucideLanguages;
@@ -178,10 +179,20 @@ export function configureLocalization(configuration, options) {
178
179
  icon: _jsx(LanguagesIcon, { strokeWidth: 1 }),
179
180
  content: _jsx(TranslationServicesPanel, {}),
180
181
  };
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
+ };
181
189
  const ensureLocalizationPanels = (group) => {
182
190
  if (!group.panels.some((p) => p.id === "translation-services")) {
183
191
  group.panels.push(translationServicesPanel);
184
192
  }
193
+ if (!group.panels.some((p) => p.id === "localization-setup")) {
194
+ group.panels.push(localizationSetupPanel);
195
+ }
185
196
  };
186
197
  if (localizationGroupIndex >= 0) {
187
198
  const group = configuration.settings.groups[localizationGroupIndex];
@@ -195,7 +206,7 @@ export function configureLocalization(configuration, options) {
195
206
  const localizationGroup = {
196
207
  title: "Localization",
197
208
  icon: _jsx(LanguagesIcon, { strokeWidth: 1 }),
198
- panels: [translationServicesPanel],
209
+ panels: [translationServicesPanel, localizationSetupPanel],
199
210
  };
200
211
  if (aboutIndex >= 0) {
201
212
  groups.splice(aboutIndex, 0, localizationGroup);
@@ -1 +1 @@
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
+ {"version":3,"file":"TranslationServicesPanel.d.ts","sourceRoot":"","sources":["../../src/settings/TranslationServicesPanel.tsx"],"names":[],"mappings":"AA6DA;;;GAGG;AACH,wBAAgB,wBAAwB,4CA+mBvC;AAED,eAAe,wBAAwB,CAAC"}
@@ -1,14 +1,13 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } 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, Trash2 as LucideTrash2, } from "lucide-react";
4
+ import { CheckCircle as LucideCheckCircle, AlertCircle as LucideAlertCircle, RefreshCw as LucideRefreshCw, Plus as LucidePlus, Settings as LucideSettings, } 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;
12
11
  const DEFAULT_STRUCTURE_SETTINGS = {
13
12
  translationFolderPath: "/sitecore/system/Parhelia/Settings/Translation",
14
13
  translationFolderTemplateId: "b1e40cfe-6e36-4a0e-a49e-19c10b2127b7",
@@ -119,7 +118,6 @@ export function TranslationServicesPanel() {
119
118
  const serviceStates = availableServices.map((svc) => ({
120
119
  ...svc,
121
120
  creating: false,
122
- deleting: false,
123
121
  }));
124
122
  setServices(serviceStates);
125
123
  setState(availableServices.length === 0 ? "error" : "success");
@@ -195,53 +193,6 @@ export function TranslationServicesPanel() {
195
193
  setServices((prev) => prev.map((s) => s.serviceName === serviceName ? { ...s, creating: false } : s));
196
194
  }
197
195
  }, [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]);
245
196
  useEffect(() => {
246
197
  loadData();
247
198
  }, [loadData]);
@@ -283,7 +234,7 @@ export function TranslationServicesPanel() {
283
234
  : "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 &&
284
235
  service.displayName !== service.serviceName && (_jsxs("div", { className: "text-xs text-gray-500 truncate", children: ["Service: ", service.serviceName] })), service.isConfigured &&
285
236
  service.supportedLanguages &&
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));
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));
287
238
  }) })), error && (_jsx("div", { className: "rounded border border-red-200 bg-red-50 p-3 text-sm text-red-700 whitespace-pre-wrap", children: error }))] }) }) }) }));
288
239
  // Build splitter panels - only show config panel when a service is selected
289
240
  const panels = selectedConfigTarget?.itemId
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parhelia/localization",
3
- "version": "0.1.12453",
3
+ "version": "0.1.12470",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"