@parhelia/localization 0.4.13170 → 0.4.13178

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.
Files changed (50) hide show
  1. package/LICENSE +1 -1
  2. package/dist/LocalizeItemCommand.d.ts.map +1 -1
  3. package/dist/LocalizeItemCommand.js +1 -0
  4. package/dist/LocalizeItemDialog.d.ts.map +1 -1
  5. package/dist/LocalizeItemDialog.js +9 -3
  6. package/dist/LocalizeItemUtils.d.ts +1 -0
  7. package/dist/LocalizeItemUtils.d.ts.map +1 -1
  8. package/dist/LocalizeItemUtils.js +45 -24
  9. package/dist/api/discovery.d.ts +17 -3
  10. package/dist/api/discovery.d.ts.map +1 -1
  11. package/dist/api/discovery.js +35 -14
  12. package/dist/hooks/useTranslationWizard.d.ts.map +1 -1
  13. package/dist/hooks/useTranslationWizard.js +10 -2
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +6 -4
  16. package/dist/services/translationService.d.ts +44 -27
  17. package/dist/services/translationService.d.ts.map +1 -1
  18. package/dist/services/translationService.js +38 -32
  19. package/dist/services/translationSettingsService.d.ts +79 -0
  20. package/dist/services/translationSettingsService.d.ts.map +1 -0
  21. package/dist/services/translationSettingsService.js +68 -0
  22. package/dist/settings/ExcludedContentTypeDialog.d.ts +12 -0
  23. package/dist/settings/ExcludedContentTypeDialog.d.ts.map +1 -0
  24. package/dist/settings/ExcludedContentTypeDialog.js +29 -0
  25. package/dist/settings/TranslationProviderDialog.d.ts +18 -0
  26. package/dist/settings/TranslationProviderDialog.d.ts.map +1 -0
  27. package/dist/settings/TranslationProviderDialog.js +105 -0
  28. package/dist/settings/TranslationServicesPanel.d.ts +14 -4
  29. package/dist/settings/TranslationServicesPanel.d.ts.map +1 -1
  30. package/dist/settings/TranslationServicesPanel.js +186 -263
  31. package/dist/setup/LocalizationSetupStep.d.ts.map +1 -1
  32. package/dist/setup/LocalizationSetupStep.js +14 -33
  33. package/dist/sidebar/TranslationSidebar.d.ts.map +1 -1
  34. package/dist/sidebar/TranslationSidebar.js +35 -14
  35. package/dist/steps/ItemSelectionTree.d.ts +2 -2
  36. package/dist/steps/ItemSelectionTree.d.ts.map +1 -1
  37. package/dist/steps/ItemSelectionTree.js +132 -47
  38. package/dist/steps/ProviderStep.d.ts.map +1 -1
  39. package/dist/steps/ProviderStep.js +55 -42
  40. package/dist/steps/ServiceLanguageSelectionStep.d.ts +1 -1
  41. package/dist/steps/ServiceLanguageSelectionStep.d.ts.map +1 -1
  42. package/dist/steps/ServiceLanguageSelectionStep.js +127 -176
  43. package/dist/steps/types.d.ts +3 -3
  44. package/dist/steps/types.d.ts.map +1 -1
  45. package/dist/translation-center/TranslationBatches.d.ts +37 -0
  46. package/dist/translation-center/TranslationBatches.d.ts.map +1 -1
  47. package/dist/translation-center/TranslationBatches.js +255 -113
  48. package/dist/types.d.ts +1 -0
  49. package/dist/types.d.ts.map +1 -1
  50. package/package.json +14 -15
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Parhelia - AI-Powered Editor for Sitecore
1
+ Parhelia - AI-Powered Content Editor
2
2
 
3
3
  Copyright © 2025 Canvas REPLY GmbH. All rights reserved.
4
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"LocalizeItemCommand.d.ts","sourceRoot":"","sources":["../src/LocalizeItemCommand.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,cAAc,EACd,WAAW,EACX,eAAe,EACf,QAAQ,EACT,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAEL,uBAAuB,EACxB,MAAM,eAAe,CAAC;AAQvB,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,wBAAsB,sBAAsB,CAAC,EAC3C,WAAW,EACX,UAAmC,EACnC,KAAK,GACN,EAAE;IACD,WAAW,EAAE,eAAe,CAAC;IAC7B,UAAU,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IAC3C,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,2CAiCA;AAED,eAAO,MAAM,mBAAmB,EAAE,mBAkCjC,CAAC"}
1
+ {"version":3,"file":"LocalizeItemCommand.d.ts","sourceRoot":"","sources":["../src/LocalizeItemCommand.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,cAAc,EACd,WAAW,EACX,eAAe,EACf,QAAQ,EACT,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAEL,uBAAuB,EACxB,MAAM,eAAe,CAAC;AAQvB,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,wBAAsB,sBAAsB,CAAC,EAC3C,WAAW,EACX,UAAmC,EACnC,KAAK,GACN,EAAE;IACD,WAAW,EAAE,eAAe,CAAC;IAC7B,UAAU,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IAC3C,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,2CAiCA;AAED,eAAO,MAAM,mBAAmB,EAAE,mBAmCjC,CAAC"}
@@ -33,6 +33,7 @@ export async function openLocalizeItemDialog({ editContext, openDialog = editCon
33
33
  }
34
34
  export const localizeItemCommand = {
35
35
  id: "localizeItem",
36
+ right: "parhelia.translate",
36
37
  label: "Translate",
37
38
  icon: _jsx(GlobeIcon, { strokeWidth: 1 }),
38
39
  disabled: (context) => {
@@ -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;AAmEvB,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,uBAAuB,GAAG,WAAW,CAAC,uBAAuB,CAAC,+BA6hBtE"}
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;AAoEvB,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,uBAAuB,GAAG,WAAW,CAAC,uBAAuB,CAAC,+BAqiBtE"}
@@ -3,6 +3,7 @@ import { Dialog, DialogContent, StyledDialogTitle, Button, cn, AlertDialog, Aler
3
3
  import { useCallback, useEffect, useMemo, useRef, useState, } from "react";
4
4
  import { AlertTriangle as LucideAlertTriangle, ArrowRight as LucideArrowRight, Globe as LucideGlobe, } from "lucide-react";
5
5
  import { useTranslationWizard } from "./hooks/useTranslationWizard";
6
+ import { translationDescriptorKey } from "./services/translationService";
6
7
  import { performDefaultTranslation, } from "./LocalizeItemUtils";
7
8
  const AlertTriangleIcon = LucideAlertTriangle;
8
9
  const GlobeIcon = LucideGlobe;
@@ -86,7 +87,7 @@ export function LocalizeItemDialog(props) {
86
87
  useEffect(() => {
87
88
  beforeNextCallbackRef.current = beforeNextCallback;
88
89
  }, [beforeNextCallback]);
89
- // Switch step helper that clears callbacks (similar to page wizard)
90
+ // Switch step helper that clears callbacks
90
91
  const switchStep = useCallback((index) => {
91
92
  beforeNextCallbackRef.current = null; // Clear callback when switching steps
92
93
  setBeforeNextCallback(null);
@@ -136,7 +137,7 @@ export function LocalizeItemDialog(props) {
136
137
  itemCount += 1;
137
138
  if (!entry.includeSubitems)
138
139
  continue;
139
- const c = subitemCounts[entry.descriptor.id];
140
+ const c = subitemCounts[translationDescriptorKey(entry.descriptor)];
140
141
  if (c === undefined || c === "loading") {
141
142
  isStreaming = true;
142
143
  }
@@ -243,10 +244,15 @@ export function LocalizeItemDialog(props) {
243
244
  targetLanguages: [...newData.targetLanguages].sort(),
244
245
  includeSubitems: newData.includeSubitems,
245
246
  discoveredItemIds: (newData.discoveredItems || [])
246
- .map((item) => item?.descriptor?.id || item?.id)
247
+ .map((item) => translationDescriptorKey(item.descriptor))
247
248
  .filter(Boolean)
248
249
  .sort(),
249
250
  itemsCount: newData.items?.length || 0,
251
+ selectionTreeItems: newData.selectionTreeItems?.map((entry) => [
252
+ translationDescriptorKey(entry.descriptor),
253
+ entry.descriptor.language,
254
+ entry.includeSubitems,
255
+ ]),
250
256
  serviceCustomData: serviceCustomDataKey,
251
257
  metadata: metadataKey,
252
258
  // batchName must be part of the key — otherwise the ProviderStep's
@@ -3,6 +3,7 @@ import { FullItem } from "@parhelia/core";
3
3
  import { TranslationWizardData } from "./steps/types";
4
4
  import { EditContextType } from "@parhelia/core";
5
5
  export type StartedTranslation = {
6
+ store: string;
6
7
  itemId: string;
7
8
  targetLanguage: string;
8
9
  jobId?: string;
@@ -1 +1 @@
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,CAkI5B;AAGD,eAAO,MAAM,mBAAmB,kBACf,MAAM,EAAE,qBACJ,iBAAiB,EAAE,aAC3B,MAAM,QACX,QAAQ,uBACO,MAAM,+BAkC5B,CAAC"}
1
+ {"version":3,"file":"LocalizeItemUtils.d.ts","sourceRoot":"","sources":["../src/LocalizeItemUtils.ts"],"names":[],"mappings":"AAOA,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;AA8EjD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,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,CAmI5B;AAGD,eAAO,MAAM,mBAAmB,kBACf,MAAM,EAAE,qBACJ,iBAAiB,EAAE,aAC3B,MAAM,QACX,QAAQ,uBACO,MAAM,+BAqC5B,CAAC"}
@@ -1,4 +1,4 @@
1
- import { requestBatchTranslation, } from "./services/translationService";
1
+ import { requestBatchTranslation, translationItem, translationItemKey, } from "./services/translationService";
2
2
  import { discoverItemsTree, flattenSelectableItemsFromBackendTrees, } from "./api/discovery";
3
3
  /**
4
4
  * Resolve the final list of item IDs to translate, expanding subitems for
@@ -12,40 +12,61 @@ import { discoverItemsTree, flattenSelectableItemsFromBackendTrees, } from "./ap
12
12
  async function resolveItemIdsToTranslate(wizardData, sessionId) {
13
13
  if (wizardData.selectionTreeItems &&
14
14
  wizardData.selectionTreeItems.length > 0) {
15
- const directIds = [];
16
- const rootsToExpand = [];
15
+ const directItems = [];
16
+ const rootsToExpand = new Map();
17
17
  for (const entry of wizardData.selectionTreeItems) {
18
18
  if (entry.includeSubitems) {
19
- rootsToExpand.push(entry.descriptor.id);
19
+ const item = translationItem(entry.descriptor);
20
+ const key = JSON.stringify([item.store, entry.descriptor.language]);
21
+ const group = rootsToExpand.get(key) ?? {
22
+ store: item.store,
23
+ language: entry.descriptor.language,
24
+ rootItemIds: [],
25
+ };
26
+ group.rootItemIds.push(item.itemId);
27
+ rootsToExpand.set(key, group);
20
28
  }
21
29
  else {
22
- directIds.push(entry.descriptor.id);
30
+ directItems.push(translationItem(entry.descriptor));
23
31
  }
24
32
  }
25
- const expandedIds = [];
26
- if (rootsToExpand.length > 0) {
27
- const language = wizardData.selectionTreeItems[0]?.descriptor.language;
28
- const tree = await discoverItemsTree({ rootItemIds: rootsToExpand, language }, sessionId);
29
- expandedIds.push(...flattenSelectableItemsFromBackendTrees(tree.trees).map((n) => n.id));
33
+ const expandedItems = [];
34
+ for (const request of rootsToExpand.values()) {
35
+ const tree = await discoverItemsTree(request, sessionId);
36
+ expandedItems.push(...flattenSelectableItemsFromBackendTrees(tree.trees).map((n) => ({
37
+ store: n.store,
38
+ itemId: n.id,
39
+ })));
30
40
  }
31
- return Array.from(new Set([...directIds, ...expandedIds]));
41
+ return Array.from(new Map([...directItems, ...expandedItems].map((item) => [
42
+ translationItemKey(item),
43
+ item,
44
+ ])).values());
32
45
  }
33
46
  const fallback = wizardData.discoveredItems && wizardData.discoveredItems.length > 0
34
47
  ? wizardData.discoveredItems
35
48
  : wizardData.items;
36
- return fallback.map((item) => item.descriptor.id);
49
+ return Array.from(new Map(fallback.map((item) => {
50
+ const coordinate = translationItem(item.descriptor);
51
+ return [translationItemKey(coordinate), coordinate];
52
+ })).values());
37
53
  }
38
54
  // Unified translation function that handles both single and batch translations
39
55
  // Now always uses batch logic for traceability in recentTranslation view
40
56
  export async function performDefaultTranslation(wizardData, editContext) {
41
57
  // Build language mappings (source -> target) from the wizard data
42
- // The source language is consistent for each target language across all items
58
+ // The source language is consistent for each target language across all items.
59
+ // The source the user chose in the dialog wins; the status endpoint's
60
+ // per-target suggestion is only the fallback for callers without one.
43
61
  const languageMappings = [];
44
62
  for (const language of wizardData.targetLanguages) {
45
63
  const languageInfo = wizardData.languageData.get(language);
46
64
  const sourceLanguage = wizardData.sourceLanguage ||
47
- languageInfo?.translationStatus?.sourceLanguage ||
48
- "en";
65
+ wizardData.selectionTreeItems?.[0]?.descriptor.language ||
66
+ wizardData.items[0]?.descriptor.language ||
67
+ languageInfo?.translationStatus?.sourceLanguage;
68
+ if (!sourceLanguage)
69
+ throw new Error("Select a source language before translating.");
49
70
  // Skip if target language equals source language
50
71
  if (language === sourceLanguage)
51
72
  continue;
@@ -55,9 +76,9 @@ export async function performDefaultTranslation(wizardData, editContext) {
55
76
  });
56
77
  }
57
78
  // Resolve item IDs, expanding subitems per-item-flag where applicable.
58
- const itemIds = await resolveItemIdsToTranslate(wizardData, editContext.sessionId);
79
+ const items = await resolveItemIdsToTranslate(wizardData, editContext.sessionId);
59
80
  // Validate that we have translation requests to process
60
- if (languageMappings.length === 0 || itemIds.length === 0) {
81
+ if (languageMappings.length === 0 || items.length === 0) {
61
82
  const error = new Error("No translations needed. All selected target languages match the source languages of the items.");
62
83
  error.name = "NoTranslationsNeededError";
63
84
  throw error;
@@ -84,11 +105,8 @@ export async function performDefaultTranslation(wizardData, editContext) {
84
105
  if (trimmedName) {
85
106
  metadataObj.name = trimmedName;
86
107
  }
87
- // Per-target suggestions can differ; the batch only records a single source.
88
- const sourceLanguages = new Set(languageMappings.map((mapping) => mapping.sourceLanguage));
89
- if (sourceLanguages.size === 1) {
90
- metadataObj.sourceLanguage = languageMappings[0].sourceLanguage;
91
- }
108
+ // One source per batch; the batch list shows it without loading the jobs.
109
+ metadataObj.sourceLanguage = languageMappings[0].sourceLanguage;
92
110
  // Merge service-specific custom data (e.g., custom prompts for AI providers)
93
111
  if (wizardData.serviceCustomData && wizardData.serviceCustomData.size > 0) {
94
112
  const serviceData = wizardData.serviceCustomData.get(wizardData.translationProvider);
@@ -113,7 +131,7 @@ export async function performDefaultTranslation(wizardData, editContext) {
113
131
  provider: wizardData.translationProvider,
114
132
  batchMetadata,
115
133
  languageMappings,
116
- itemIds,
134
+ items,
117
135
  });
118
136
  if (batchResult.type === "error") {
119
137
  console.error("Translation request failed:", batchResult);
@@ -133,6 +151,7 @@ export async function performDefaultTranslation(wizardData, editContext) {
133
151
  throw error;
134
152
  }
135
153
  const started = batchResponse.started?.map((result) => ({
154
+ store: result.store,
136
155
  itemId: result.itemId,
137
156
  targetLanguage: result.targetLanguage,
138
157
  jobId: result.jobId,
@@ -149,7 +168,9 @@ export const defaultTranslateAll = async (languageCodes, translationStatus, sess
149
168
  items: [item],
150
169
  targetLanguages: languageCodes,
151
170
  languageData: new Map(languageCodes.map((lang) => {
152
- const status = translationStatus?.find((x) => x.targetLanguage === lang);
171
+ const status = translationStatus?.find((x) => x.store === item.descriptor.database &&
172
+ x.itemId === item.descriptor.id &&
173
+ x.targetLanguage === lang);
153
174
  return [
154
175
  lang,
155
176
  {
@@ -1,9 +1,12 @@
1
+ import { type TranslationItem } from "../services/translationService";
1
2
  export declare function suggestBatchName(req: {
2
- itemIds: string[];
3
+ items: TranslationItem[];
4
+ language: string;
3
5
  targetLanguages: string[];
4
6
  includeSubitems?: boolean;
5
7
  }, sessionId?: string): Promise<string | null>;
6
8
  export type DiscoveredItem = {
9
+ store: string;
7
10
  id: string;
8
11
  name: string;
9
12
  path: string;
@@ -17,6 +20,7 @@ export type TreeNode = {
17
20
  children?: TreeNode[];
18
21
  };
19
22
  export type BackendTreeNode = {
23
+ store: string;
20
24
  id: string;
21
25
  name: string;
22
26
  path: string;
@@ -25,8 +29,9 @@ export type BackendTreeNode = {
25
29
  children: BackendTreeNode[];
26
30
  };
27
31
  export type DiscoverItemsTreeRequest = {
32
+ store: string;
28
33
  rootItemIds: string[];
29
- language?: string;
34
+ language: string;
30
35
  };
31
36
  export type DiscoverItemsTreeResponse = {
32
37
  trees: BackendTreeNode[];
@@ -36,10 +41,18 @@ export type DiscoverItemsTreeResponse = {
36
41
  export declare function discoverItemsTree(req: DiscoverItemsTreeRequest, sessionId?: string): Promise<DiscoverItemsTreeResponse>;
37
42
  export declare function convertBackendTreeToTreeNodes(trees: BackendTreeNode[]): TreeNode[];
38
43
  export declare function flattenSelectableItemsFromBackendTrees(trees: BackendTreeNode[]): DiscoveredItem[];
44
+ /**
45
+ * One line of the subitem-count stream. `refusal` (multi-cms cfsmall, A15; cfabove §5): the store refused to list the subtree
46
+ * past its bound — the server's last line names why, the count is what was walked before, and the translation itself would
47
+ * refuse with the same reason.
48
+ */
39
49
  export type SubitemCountUpdate = {
40
50
  count: number;
41
51
  complete: boolean;
52
+ refusal?: string;
42
53
  };
54
+ /** The update a parsed stream line states, or undefined for a line without a count. */
55
+ export declare function subitemCountUpdateOf(line: unknown): SubitemCountUpdate | undefined;
43
56
  /**
44
57
  * Streams the running subitem count for a given root item from the
45
58
  * backend. The endpoint returns newline-delimited JSON; each parsed line
@@ -50,8 +63,9 @@ export type SubitemCountUpdate = {
50
63
  * subitems flag off again).
51
64
  */
52
65
  export declare function streamSubitemCount(req: {
66
+ store: string;
53
67
  itemId: string;
54
- language?: string;
68
+ language: string;
55
69
  }, onProgress: (update: SubitemCountUpdate) => void, options?: {
56
70
  sessionId?: string;
57
71
  signal?: AbortSignal;
@@ -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AAExF,uFAAuF;AACvF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,kBAAkB,GAAG,SAAS,CAOlF;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,EACxD,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,CA0EjB"}
@@ -1,7 +1,9 @@
1
- import { post } from "@parhelia/core";
1
+ import { post, withParheliaRequestHeader } from "@parhelia/core";
2
+ import { translationItemKey, } from "../services/translationService";
2
3
  export async function suggestBatchName(req, sessionId) {
3
4
  const { data, type } = await post("/parhelia/translation/suggestBatchName", {
4
- ItemIds: req.itemIds,
5
+ Items: req.items,
6
+ Language: req.language,
5
7
  TargetLanguages: req.targetLanguages,
6
8
  IncludeSubitems: !!req.includeSubitems,
7
9
  }, sessionId);
@@ -12,6 +14,7 @@ export async function suggestBatchName(req, sessionId) {
12
14
  }
13
15
  export async function discoverItemsTree(req, sessionId) {
14
16
  const { data, type, details } = await post("/parhelia/translation/discoveritemstree", {
17
+ Store: req.store,
15
18
  RootItemIds: req.rootItemIds,
16
19
  Language: req.language,
17
20
  }, sessionId);
@@ -21,9 +24,10 @@ export async function discoverItemsTree(req, sessionId) {
21
24
  }
22
25
  export function convertBackendTreeToTreeNodes(trees) {
23
26
  const convert = (n) => ({
24
- key: n.id,
27
+ key: translationItemKey({ store: n.store, itemId: n.id }),
25
28
  label: n.name,
26
29
  data: {
30
+ store: n.store,
27
31
  id: n.id,
28
32
  name: n.name,
29
33
  path: n.path,
@@ -40,6 +44,7 @@ export function flattenSelectableItemsFromBackendTrees(trees) {
40
44
  const out = [];
41
45
  const walk = (n) => {
42
46
  out.push({
47
+ store: n.store,
43
48
  id: n.id,
44
49
  name: n.name,
45
50
  path: n.path,
@@ -51,6 +56,18 @@ export function flattenSelectableItemsFromBackendTrees(trees) {
51
56
  trees.forEach(walk);
52
57
  return out;
53
58
  }
59
+ /** The update a parsed stream line states, or undefined for a line without a count. */
60
+ export function subitemCountUpdateOf(line) {
61
+ if (!line || typeof line !== "object")
62
+ return undefined;
63
+ const parsed = line;
64
+ if (typeof parsed.count !== "number")
65
+ return undefined;
66
+ const update = { count: parsed.count, complete: !!parsed.complete };
67
+ if (typeof parsed.refusal === "string" && parsed.refusal.trim())
68
+ update.refusal = parsed.refusal;
69
+ return update;
70
+ }
54
71
  /**
55
72
  * Streams the running subitem count for a given root item from the
56
73
  * backend. The endpoint returns newline-delimited JSON; each parsed line
@@ -66,12 +83,16 @@ export async function streamSubitemCount(req, onProgress, options) {
66
83
  url += "?sessionId=" + options.sessionId;
67
84
  const response = await fetch(url, {
68
85
  method: "POST",
69
- body: JSON.stringify({ ItemId: req.itemId, Language: req.language }),
86
+ body: JSON.stringify({
87
+ Store: req.store,
88
+ ItemId: req.itemId,
89
+ Language: req.language,
90
+ }),
70
91
  credentials: "include",
71
- headers: {
92
+ headers: withParheliaRequestHeader({
72
93
  "Content-Type": "application/json",
73
94
  Accept: "application/x-ndjson",
74
- },
95
+ }),
75
96
  signal: options?.signal,
76
97
  });
77
98
  if (!response.ok || !response.body) {
@@ -94,10 +115,10 @@ export async function streamSubitemCount(req, onProgress, options) {
94
115
  if (!line)
95
116
  continue;
96
117
  try {
97
- const parsed = JSON.parse(line);
98
- if (typeof parsed.count === "number") {
99
- lastCount = parsed.count;
100
- onProgress({ count: parsed.count, complete: !!parsed.complete });
118
+ const update = subitemCountUpdateOf(JSON.parse(line));
119
+ if (update) {
120
+ lastCount = update.count;
121
+ onProgress(update);
101
122
  }
102
123
  }
103
124
  catch {
@@ -109,10 +130,10 @@ export async function streamSubitemCount(req, onProgress, options) {
109
130
  const tail = buffer.trim();
110
131
  if (tail) {
111
132
  try {
112
- const parsed = JSON.parse(tail);
113
- if (typeof parsed.count === "number") {
114
- lastCount = parsed.count;
115
- onProgress({ count: parsed.count, complete: !!parsed.complete });
133
+ const update = subitemCountUpdateOf(JSON.parse(tail));
134
+ if (update) {
135
+ lastCount = update.count;
136
+ onProgress(update);
116
137
  }
117
138
  }
118
139
  catch {
@@ -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;AAUhF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,uBAAuB;;;EAuGlE"}
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;;;EA+GlE"}
@@ -16,6 +16,7 @@ export function useTranslationWizard(props) {
16
16
  });
17
17
  // Load initial data
18
18
  useEffect(() => {
19
+ let cancelled = false;
19
20
  const loadInitialData = async () => {
20
21
  const itemDescriptors = props.items.map((x) => x.descriptor);
21
22
  // Load translation providers
@@ -35,7 +36,7 @@ export function useTranslationWizard(props) {
35
36
  }));
36
37
  // Load translation status for each item
37
38
  const translationStatuses = await Promise.all(itemDescriptors.map(async (item) => {
38
- const result = await getTranslationStatus(item.id);
39
+ const result = await getTranslationStatus(item);
39
40
  return result.data || [];
40
41
  }));
41
42
  const languageMap = new Map();
@@ -50,15 +51,19 @@ export function useTranslationWizard(props) {
50
51
  if (language.versions > 0 && itemDescriptors[itemIndex]) {
51
52
  languageData.items.push(itemDescriptors[itemIndex]);
52
53
  }
53
- const status = translationStatuses[itemIndex]?.find((s) => s.targetLanguage === language.languageCode);
54
+ const status = translationStatuses[itemIndex]?.find((s) => s.store === itemDescriptors[itemIndex]?.database &&
55
+ s.targetLanguage === language.languageCode);
54
56
  if (status && !languageData.translationStatus) {
55
57
  languageData.translationStatus = status;
56
58
  }
57
59
  languageMap.set(language.languageCode, languageData);
58
60
  });
59
61
  });
62
+ if (cancelled)
63
+ return;
60
64
  setWizardData((prevData) => ({
61
65
  ...prevData,
66
+ items: props.items,
62
67
  translationProviders: providers,
63
68
  translationProvider: defaultProvider,
64
69
  languageData: languageMap,
@@ -66,6 +71,9 @@ export function useTranslationWizard(props) {
66
71
  }
67
72
  };
68
73
  loadInitialData();
74
+ return () => {
75
+ cancelled = true;
76
+ };
69
77
  }, [props.items]);
70
78
  // Save translation provider to localStorage when it changes
71
79
  useEffect(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AAoBpF,OAAO,EACL,mBAAmB,EAGpB,MAAM,gBAAgB,CAAC;AAWxB,QAAA,MAAM,wCAAwC;;;;;;;;;;;;;;CAwB7C,CAAC;AAEF,QAAA,MAAM,4CAA4C;;;;;;;;CAkBjD,CAAC;AAoDF,OAAO,EACL,wCAAwC,EACxC,4CAA4C,GAC7C,CAAC;AACF,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,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CA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BAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,YAAY,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,GACvB,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,uBAuIpC"}
package/dist/index.js CHANGED
@@ -204,7 +204,7 @@ export function configureLocalization(configuration, options) {
204
204
  const translationServicesPanel = {
205
205
  id: "translation-services",
206
206
  title: "Translation Services",
207
- subtitle: "Configure translation services (OpenAI, Azure, DeepL, etc.)",
207
+ subtitle: "Translation services and how translation runs",
208
208
  icon: _jsx(LanguagesIcon, { strokeWidth: 1 }),
209
209
  content: _jsx(TranslationServicesPanel, {}),
210
210
  requiresAdministrator: true,
@@ -222,14 +222,16 @@ export function configureLocalization(configuration, options) {
222
222
  }
223
223
  else {
224
224
  const groups = configuration.settings.groups;
225
- const aboutIndex = groups.findIndex((g) => g.title === "About");
225
+ // Localization sits above System (or above About when there is no System group).
226
+ const systemIndex = groups.findIndex((g) => g.title === "System");
227
+ const insertIndex = systemIndex >= 0 ? systemIndex : groups.findIndex((g) => g.title === "About");
226
228
  const localizationGroup = {
227
229
  title: "Localization",
228
230
  icon: _jsx(LanguagesIcon, { strokeWidth: 1 }),
229
231
  panels: [translationServicesPanel],
230
232
  };
231
- if (aboutIndex >= 0) {
232
- groups.splice(aboutIndex, 0, localizationGroup);
233
+ if (insertIndex >= 0) {
234
+ groups.splice(insertIndex, 0, localizationGroup);
233
235
  }
234
236
  else {
235
237
  groups.push(localizationGroup);
@@ -6,7 +6,27 @@ export type TranslationApiResponse<T> = {
6
6
  error?: string;
7
7
  message?: string;
8
8
  };
9
- export declare function getTranslationStatus(itemId: string): Promise<import("@parhelia/core").ExecutionResult<TranslationStatus[]>>;
9
+ export type TranslationItem = {
10
+ store: string;
11
+ itemId: string;
12
+ };
13
+ export declare function translationDescriptorKey(descriptor: {
14
+ database?: string;
15
+ id: string;
16
+ }): string;
17
+ export declare function translationItemKey(item: {
18
+ store?: string | null;
19
+ itemId: string;
20
+ }): string;
21
+ export declare function translationItem(descriptor: {
22
+ database?: string;
23
+ id: string;
24
+ }): TranslationItem;
25
+ export declare function getTranslationStatus(item: {
26
+ database?: string;
27
+ id: string;
28
+ language: string;
29
+ }): Promise<import("@parhelia/core").ExecutionResult<TranslationStatus[]>>;
10
30
  export declare function getTranslationProviders(): Promise<import("@parhelia/core").ExecutionResult<TranslationProviderInfo[]>>;
11
31
  export type AvailableTranslationService = {
12
32
  serviceName: string;
@@ -14,33 +34,10 @@ export type AvailableTranslationService = {
14
34
  isConfigured: boolean;
15
35
  supportedLanguages?: string[];
16
36
  settingsItemId?: string;
17
- templateId: string;
18
- templateName: string;
19
37
  };
20
38
  export declare function getAvailableTranslationServices(): Promise<import("@parhelia/core").ExecutionResult<TranslationApiResponse<AvailableTranslationService[]>>>;
21
- export declare function createProviderSettings(serviceName: string, templateId: string, language?: string, structureSettings?: TranslationStructureSettings): Promise<import("@parhelia/core").ExecutionResult<TranslationApiResponse<{
22
- itemId: string;
23
- itemPath: string;
24
- }>>>;
25
- export type TranslationStructureSettings = {
26
- translationFolderPath: string;
27
- translationFolderTemplateId: string;
28
- translationProvidersPath: string;
29
- translationProvidersTemplateId: string;
30
- };
31
- export type TranslationStructureItemInfo = {
32
- exists: boolean;
33
- itemId?: string;
34
- path?: string;
35
- templateId?: string;
36
- };
37
- export type TranslationStructureResponse = {
38
- translationFolder: TranslationStructureItemInfo;
39
- translationProvidersFolder: TranslationStructureItemInfo;
40
- };
41
- export declare function getTranslationStructure(settings: TranslationStructureSettings): Promise<import("@parhelia/core").ExecutionResult<TranslationApiResponse<TranslationStructureResponse>>>;
42
- export declare function ensureTranslationStructure(settings: TranslationStructureSettings): Promise<import("@parhelia/core").ExecutionResult<TranslationApiResponse<TranslationStructureResponse>>>;
43
39
  export type TranslationJobRecord = {
40
+ store?: string | null;
44
41
  id?: string;
45
42
  sequenceId?: number;
46
43
  itemId: string;
@@ -85,6 +82,8 @@ export type TranslationBatchInfo = {
85
82
  startedAtUtc?: string;
86
83
  completedAtUtc?: string;
87
84
  initiatedByUser?: string;
85
+ /** The initiator's account id; the name where names are ids (the classic CM). */
86
+ initiatedBySubjectId?: string;
88
87
  initiatorSessionId?: string;
89
88
  provider?: string;
90
89
  status?: string;
@@ -106,10 +105,13 @@ export type TranslationBatchInfo = {
106
105
  };
107
106
  export declare function getBatchInfo(batchId: string): Promise<import("@parhelia/core").ExecutionResult<TranslationBatchInfo>>;
108
107
  export type ListBatchesFilters = {
108
+ store?: string;
109
+ language?: string;
109
110
  fromUtc?: string;
110
111
  status?: string;
111
112
  user?: string;
112
113
  provider?: string;
114
+ sourceLanguage?: string;
113
115
  targetLanguage?: string;
114
116
  itemIdOrPath?: string;
115
117
  itemIncludeSubitems?: boolean;
@@ -123,6 +125,16 @@ export type AbortTranslationResponse = {
123
125
  };
124
126
  export declare function abortJob(id: string): Promise<import("@parhelia/core").ExecutionResult<AbortTranslationResponse>>;
125
127
  export declare function abortBatch(id: string): Promise<import("@parhelia/core").ExecutionResult<AbortTranslationResponse>>;
128
+ export type DeleteTranslationBatchResponse = {
129
+ success: boolean;
130
+ batchId: string;
131
+ deletedJobs: number;
132
+ };
133
+ /**
134
+ * Deletes a batch that has stopped, with its jobs. A running batch is refused
135
+ * (409): abort it first. Translations already written to content stay.
136
+ */
137
+ export declare function deleteBatch(id: string): Promise<import("@parhelia/core").ExecutionResult<DeleteTranslationBatchResponse>>;
126
138
  export declare function subscribeToBatch(batchId: string, sessionId: string): Promise<import("@parhelia/core").ExecutionResult<{
127
139
  success: boolean;
128
140
  message: string;
@@ -136,11 +148,13 @@ export type LanguageMapping = {
136
148
  targetLanguage: string;
137
149
  };
138
150
  export type BatchTranslationResult = {
151
+ store: string;
139
152
  itemId: string;
140
153
  targetLanguage: string;
141
154
  jobId: string;
142
155
  };
143
156
  export type BatchTranslationError = {
157
+ store: string;
144
158
  itemId: string;
145
159
  targetLanguage: string;
146
160
  error: string;
@@ -150,14 +164,15 @@ export type BatchTranslationResponse = {
150
164
  started: BatchTranslationResult[];
151
165
  skipped: BatchTranslationError[];
152
166
  };
153
- export declare function requestBatchTranslation({ sessionId, provider, batchMetadata, languageMappings, itemIds, }: {
167
+ export declare function requestBatchTranslation({ sessionId, provider, batchMetadata, languageMappings, items, }: {
154
168
  sessionId: string;
155
169
  provider: string;
156
170
  batchMetadata?: string;
157
171
  languageMappings: LanguageMapping[];
158
- itemIds: string[];
172
+ items: TranslationItem[];
159
173
  }): Promise<import("@parhelia/core").ExecutionResult<BatchTranslationResponse>>;
160
174
  export type RetryBatchTranslationJobRequest = {
175
+ store: string;
161
176
  sourceTranslationId?: string;
162
177
  itemId: string;
163
178
  sourceLanguage: string;
@@ -165,6 +180,7 @@ export type RetryBatchTranslationJobRequest = {
165
180
  metadata?: string | null;
166
181
  };
167
182
  export type RetryBatchTranslationStartedJob = {
183
+ store: string;
168
184
  sourceTranslationId?: string;
169
185
  itemId: string;
170
186
  sourceLanguage: string;
@@ -173,6 +189,7 @@ export type RetryBatchTranslationStartedJob = {
173
189
  jobId: string;
174
190
  };
175
191
  export type RetryBatchTranslationSkippedJob = {
192
+ store: string;
176
193
  sourceTranslationId?: string;
177
194
  itemId: string;
178
195
  sourceLanguage: string;