@parhelia/localization 0.1.12555 → 0.1.12560
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/LocalizeItemDialog.d.ts.map +1 -1
- package/dist/LocalizeItemDialog.js +13 -17
- package/dist/api/discovery.d.ts +1 -4
- package/dist/api/discovery.d.ts.map +1 -1
- package/dist/api/discovery.js +3 -4
- package/dist/hooks/useTranslationWizard.d.ts.map +1 -1
- package/dist/hooks/useTranslationWizard.js +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -28
- package/dist/services/translationService.d.ts +48 -7
- package/dist/services/translationService.d.ts.map +1 -1
- package/dist/services/translationService.js +3 -0
- package/dist/settings/TranslationServicesPanel.d.ts.map +1 -1
- package/dist/settings/TranslationServicesPanel.js +111 -42
- package/dist/setup/LocalizationSetupStep.d.ts.map +1 -1
- package/dist/setup/LocalizationSetupStep.js +8 -7
- package/dist/steps/ServiceLanguageSelectionStep.d.ts.map +1 -1
- package/dist/steps/ServiceLanguageSelectionStep.js +18 -1
- package/dist/steps/SubitemDiscoveryStep.d.ts.map +1 -1
- package/dist/steps/SubitemDiscoveryStep.js +95 -181
- package/dist/translation-center/BatchTranslationView.d.ts +1 -1
- package/dist/translation-center/BatchTranslationView.d.ts.map +1 -1
- package/dist/translation-center/BatchTranslationView.js +354 -96
- package/dist/translation-center/RecentTranslations.d.ts.map +1 -1
- package/dist/translation-center/RecentTranslations.js +20 -13
- package/dist/translation-center/TranslationManagement.d.ts.map +1 -1
- package/dist/translation-center/TranslationManagement.js +2 -4
- package/package.json +10 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecentTranslations.d.ts","sourceRoot":"","sources":["../../src/translation-center/RecentTranslations.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RecentTranslations.d.ts","sourceRoot":"","sources":["../../src/translation-center/RecentTranslations.tsx"],"names":[],"mappings":"AAwEA,wBAAgB,kBAAkB,4CAyhBjC"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState, useMemo } from "react";
|
|
3
|
-
import
|
|
4
|
-
import { usePathname, useSearchParams } from "
|
|
5
|
-
import { Button, Select, useEditContext } from "@parhelia/core";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Button, Select, useEditContext, usePathname, useRouter, useSearchParams, } from "@parhelia/core";
|
|
6
5
|
import { listBatches, getTranslationProviders, } from "../services/translationService";
|
|
7
6
|
import { useDebouncedCallback } from "use-debounce";
|
|
7
|
+
import { RefreshCw, X, ChevronDown, Languages, Loader2 } from "lucide-react";
|
|
8
|
+
// Wrappers for lucide-react icons to work with React 19
|
|
9
|
+
const RefreshIcon = (props) => React.createElement(RefreshCw, props);
|
|
10
|
+
const XIcon = (props) => React.createElement(X, props);
|
|
11
|
+
const ChevronDownIcon = (props) => React.createElement(ChevronDown, props);
|
|
12
|
+
const LanguagesIcon = (props) => React.createElement(Languages, props);
|
|
13
|
+
const LoaderIcon = (props) => React.createElement(Loader2, props);
|
|
8
14
|
const DATE_RANGE_OPTIONS = [
|
|
9
15
|
{ value: "lastHour", label: "Last Hour" },
|
|
10
16
|
{ value: "last24hours", label: "Last 24 Hours" },
|
|
@@ -253,12 +259,13 @@ export function RecentTranslations() {
|
|
|
253
259
|
return dateGroups;
|
|
254
260
|
}, [filteredBatches]);
|
|
255
261
|
const navigateToBatch = (batchId) => {
|
|
256
|
-
const current = new URLSearchParams(
|
|
262
|
+
const current = new URLSearchParams(searchParams.toString());
|
|
257
263
|
current.set("batchId", batchId);
|
|
258
264
|
router.push(`${pathname}?${current.toString()}`, { scroll: false });
|
|
259
265
|
};
|
|
260
266
|
const totalBatches = groupedBatches.reduce((sum, group) => sum + group.batches.length, 0);
|
|
261
|
-
|
|
267
|
+
const isMobile = editContext?.isMobile ?? false;
|
|
268
|
+
return (_jsxs("div", { className: "flex h-full flex-col min-h-0 bg-gray-5", "data-testid": "recent-translations", children: [_jsxs("div", { className: "shrink-0 border-b border-gray-3 bg-background p-4 md:p-6", children: [_jsxs("div", { className: "flex items-center justify-between mb-4", children: [_jsxs("div", { children: [_jsx("h1", { className: "text-xl font-semibold text-(--color-dark)", children: "Recent Translations" }), _jsx("p", { className: "text-sm text-gray-2 mt-1", children: "View and monitor translation jobs across all items" })] }), _jsx("div", { className: "flex gap-2", children: _jsxs(Button, { size: "sm", variant: "outline", onClick: () => loadRecentBatches(0, false), disabled: isLoading, className: "md:w-auto w-8 h-8 md:h-8 p-0 md:px-3", children: [_jsx(RefreshIcon, { className: `h-4 w-4 ${isLoading ? 'animate-spin' : ''}` }), _jsx("span", { className: "hidden md:inline", children: "Refresh" })] }) })] }), _jsxs("div", { className: "flex flex-wrap gap-4 items-center", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-xs font-medium text-(--color-gray-1)", children: "Date Range:" }), _jsx(Select, { className: "w-40", options: DATE_RANGE_OPTIONS, value: filters.dateRange, onValueChange: (value) => setFilters((prev) => ({ ...prev, dateRange: value })), placeholder: "Select date range" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-xs font-medium text-(--color-gray-1)", children: "Status:" }), _jsx(Select, { className: "w-36", options: STATUS_OPTIONS, value: filters.status, onValueChange: (value) => setFilters((prev) => ({ ...prev, status: value })), placeholder: "Select status" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-xs font-medium text-(--color-gray-1)", children: "User:" }), _jsx(Select, { className: "w-44", options: [
|
|
262
269
|
{ value: "all", label: "All Users" },
|
|
263
270
|
...(currentUserName !== "all"
|
|
264
271
|
? [{ value: currentUserName, label: `${currentUserName} (You)` }]
|
|
@@ -266,21 +273,21 @@ export function RecentTranslations() {
|
|
|
266
273
|
...uniqueUsers
|
|
267
274
|
.filter((u) => u !== currentUserName)
|
|
268
275
|
.map((u) => ({ value: u, label: u })),
|
|
269
|
-
], value: isLimitedPreviewUser ? currentUserName : filters.user, onValueChange: (value) => setFilters((prev) => ({ ...prev, user: value })), disabled: isLimitedPreviewUser, placeholder: "Select user" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-xs font-medium text-
|
|
276
|
+
], value: isLimitedPreviewUser ? currentUserName : filters.user, onValueChange: (value) => setFilters((prev) => ({ ...prev, user: value })), disabled: isLimitedPreviewUser, placeholder: "Select user" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-xs font-medium text-(--color-gray-1)", children: "Provider:" }), _jsx(Select, { className: "w-44", options: [
|
|
270
277
|
{ value: "all", label: "All Providers" },
|
|
271
278
|
...providers.map((p) => ({
|
|
272
279
|
value: p.name,
|
|
273
280
|
label: p.displayName || p.name,
|
|
274
281
|
})),
|
|
275
|
-
], value: filters.provider, onValueChange: (value) => setFilters((prev) => ({ ...prev, provider: value })), placeholder: "Select provider" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-xs font-medium text-
|
|
282
|
+
], value: filters.provider, onValueChange: (value) => setFilters((prev) => ({ ...prev, provider: value })), placeholder: "Select provider" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-xs font-medium text-(--color-gray-1)", children: "Target Language:" }), _jsx(Select, { className: "w-44", options: [
|
|
276
283
|
{ value: "all", label: "All Languages" },
|
|
277
284
|
...uniqueLanguages.map((lang) => ({
|
|
278
285
|
value: lang,
|
|
279
286
|
label: lang,
|
|
280
287
|
})),
|
|
281
|
-
], value: filters.targetLanguage, onValueChange: (value) => setFilters((prev) => ({ ...prev, targetLanguage: value })), placeholder: "Select language" })] }), (filters.dateRange !== "last30days" || filters.status !== "all" || filters.user !== currentUserName || filters.provider !== "all" || filters.targetLanguage !== "all") && (_jsxs(Button, { size: "sm", variant: "ghost", onClick: () => setFilters({ dateRange: "last30days", status: "all", user: currentUserName, provider: "all", targetLanguage: "all" }), children: [_jsx("i", { className: "pi pi-times" }), "Clear Filters"] }))] }), _jsxs("div", { className: "mt-3 text-xs text-
|
|
288
|
+
], value: filters.targetLanguage, onValueChange: (value) => setFilters((prev) => ({ ...prev, targetLanguage: value })), placeholder: "Select language" })] }), (filters.dateRange !== "last30days" || filters.status !== "all" || filters.user !== currentUserName || filters.provider !== "all" || filters.targetLanguage !== "all") && (_jsxs(Button, { size: "sm", variant: "ghost", onClick: () => setFilters({ dateRange: "last30days", status: "all", user: currentUserName, provider: "all", targetLanguage: "all" }), children: [_jsx("i", { className: "pi pi-times" }), "Clear Filters"] }))] }), _jsxs("div", { className: "mt-3 text-xs text-gray-2", children: ["Showing ", totalBatches, " batch", totalBatches !== 1 ? 'es' : '', batches.length !== totalBatches && (_jsxs("span", { children: [" (filtered from ", batches.length, " total batches)"] }))] })] }), _jsx("div", { className: "flex-1 overflow-auto p-4 md:p-6 min-h-0", children: isLoading && batches.length === 0 ? (_jsx("div", { className: "flex items-center justify-center h-32", children: _jsxs("div", { className: "flex items-center gap-2 text-gray-2", children: [_jsx(LoaderIcon, { className: "h-5 w-5 animate-spin text-theme-secondary" }), "Loading recent translations..."] }) })) : groupedBatches.length === 0 ? (_jsx("div", { className: "flex items-center justify-center h-32", children: _jsxs("div", { className: "text-center text-gray-2", children: [_jsx(LanguagesIcon, { className: "h-8 w-8 block mx-auto mb-2 text-gray-3" }), _jsx("p", { className: "font-medium text-(--color-gray-1)", children: "No translations found" }), _jsx("p", { className: "text-sm mt-1", children: filteredBatches.length !== batches.length
|
|
282
289
|
? "Try adjusting your filters or start a translation to see it appear here"
|
|
283
|
-
: "Start a translation to see it appear here" })] }) })) : (_jsxs("div", { className: "space-y-6", children: [groupedBatches.map((dateGroup) => (_jsxs("div", { children: [_jsxs("h2", { className: "text-lg font-semibold text-
|
|
290
|
+
: "Start a translation to see it appear here" })] }) })) : (_jsxs("div", { className: "space-y-6", children: [groupedBatches.map((dateGroup) => (_jsxs("div", { children: [_jsxs("h2", { className: "text-lg font-semibold text-(--color-dark) mb-3 border-b border-gray-3 pb-2", children: [dateGroup.label, _jsxs("span", { className: "ml-2 text-sm font-normal text-gray-2", children: ["(", dateGroup.batches.length, " batch", dateGroup.batches.length !== 1 ? 'es' : '', ")"] })] }), _jsx("div", { className: "space-y-3", children: dateGroup.batches.map((b) => {
|
|
284
291
|
const batchDate = new Date(b.timestamp);
|
|
285
292
|
const now = new Date();
|
|
286
293
|
const isToday = batchDate.toDateString() === now.toDateString();
|
|
@@ -295,8 +302,8 @@ export function RecentTranslations() {
|
|
|
295
302
|
const completedJobs = info?.completedJobs ?? 0;
|
|
296
303
|
const anyError = (info?.errorJobs ?? 0) > 0;
|
|
297
304
|
const anyInProgress = info?.status === "In Progress";
|
|
298
|
-
return (_jsx("div", { className: "border border-
|
|
299
|
-
info.status === 'In Progress' ? 'bg-
|
|
300
|
-
info.status === 'Error' ? 'bg-red-100 text-red-600' : 'bg-
|
|
301
|
-
}) })] }, dateGroup.label))), hasMore && (_jsx("div", { className: "flex justify-center pt-6", children: _jsx(Button, { variant: "outline", size: "sm", onClick: loadMore, disabled: isLoadingMore, children: isLoadingMore ? (_jsxs(_Fragment, { children: [_jsx(
|
|
305
|
+
return (_jsx("div", { className: "border border-gray-3 rounded-lg bg-background shadow-sm overflow-hidden transition-shadow hover:shadow-md", children: _jsx("button", { className: "w-full px-4 py-3 md:px-6 md:py-4 hover:bg-gray-5 transition-colors text-left", onClick: () => navigateToBatch(b.id), title: "View batch details", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "text-left", children: [_jsx("div", { className: "font-medium text-(--color-dark)", children: `Translation Batch - ${timeDisplay}` }), _jsxs("div", { className: "text-sm text-gray-2 mt-1 flex flex-wrap items-center gap-x-2", children: [_jsxs("span", { className: "font-medium text-(--color-gray-1)", children: [totalJobs, " translations"] }), typeof itemsCount === 'number' && (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-gray-3", children: "\u2022" }), _jsxs("span", { children: [itemsCount, " items"] })] })), languages.length ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-gray-3", children: "\u2022" }), _jsx("span", { className: "truncate max-w-[200px]", title: languages.join(", "), children: languages.join(", ") })] })) : null, totalJobs > 0 && (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-gray-3", children: "\u2022" }), _jsxs("span", { className: "text-xs", children: [completedJobs, "/", totalJobs, " completed"] })] }))] }), _jsx("div", { className: "mt-2 block", children: _jsxs("span", { className: "inline-flex text-[10px] bg-gray-4 text-(--color-gray-1) px-2 py-0.5 rounded font-mono whitespace-nowrap overflow-hidden", children: ["ID: ", b.id] }) }), _jsxs("div", { className: "mt-2 flex flex-wrap gap-2 items-center text-xs", children: [info?.status && (_jsx("span", { className: `inline-flex items-center rounded-full px-2.5 py-1 font-medium ${info.status === 'Completed' ? 'bg-green-100 text-green-700' :
|
|
306
|
+
info.status === 'In Progress' ? 'bg-theme-secondary-light text-theme-secondary' :
|
|
307
|
+
info.status === 'Error' ? 'bg-red-100 text-red-600' : 'bg-gray-4 text-(--color-gray-1)'}`, children: info.status })), info?.provider && (_jsxs("span", { className: "text-(--color-gray-1)", children: ["Provider: ", _jsx("span", { className: "font-medium", children: info.provider })] })), info?.initiatedByUser && (_jsxs("span", { className: "text-(--color-gray-1)", children: ["By: ", _jsx("span", { className: "font-medium", children: info.initiatedByUser })] })), info?.lastUpdatedUtc && (_jsxs("span", { className: "text-gray-2", children: ["Updated: ", new Date(info.lastUpdatedUtc).toLocaleString()] }))] })] }), _jsxs("div", { className: "flex gap-2", children: [anyInProgress && (_jsx("span", { className: "rounded-full bg-theme-secondary-light px-3 py-1 text-xs font-medium text-theme-secondary", children: "In Progress" })), anyError && (_jsx("span", { className: "rounded-full bg-red-100 px-3 py-1 text-xs font-medium text-red-600", children: "Error" })), !anyInProgress && !anyError && (_jsx("span", { className: "rounded-full bg-green-100 px-3 py-1 text-xs font-medium text-green-700", children: "Completed" }))] })] }) }) }, b.id));
|
|
308
|
+
}) })] }, dateGroup.label))), hasMore && (_jsx("div", { className: "flex justify-center pt-6", children: _jsx(Button, { variant: "outline", size: "sm", onClick: loadMore, disabled: isLoadingMore, children: isLoadingMore ? (_jsxs(_Fragment, { children: [_jsx(LoaderIcon, { className: "h-4 w-4 animate-spin text-theme-secondary" }), "Loading more..."] })) : (_jsxs(_Fragment, { children: [_jsx(ChevronDownIcon, { className: "h-4 w-4" }), "Load More Batches"] })) }) }))] })) })] }));
|
|
302
309
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranslationManagement.d.ts","sourceRoot":"","sources":["../../src/translation-center/TranslationManagement.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TranslationManagement.d.ts","sourceRoot":"","sources":["../../src/translation-center/TranslationManagement.tsx"],"names":[],"mappings":"AAQA,wBAAgB,qBAAqB,4CA+CpC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useRouter } from "
|
|
3
|
-
import { usePathname, useSearchParams } from "next/navigation";
|
|
4
|
-
import { useEditContext } from "@parhelia/core";
|
|
2
|
+
import { useEditContext, usePathname, useRouter, useSearchParams, } from "@parhelia/core";
|
|
5
3
|
import { BatchTranslationView } from "./BatchTranslationView";
|
|
6
4
|
export function TranslationManagement() {
|
|
7
5
|
const editContext = useEditContext();
|
|
@@ -18,7 +16,7 @@ export function TranslationManagement() {
|
|
|
18
16
|
return (_jsx("div", { className: "flex h-full flex-col items-center justify-center bg-[var(--color-gray-5)]", children: _jsxs("div", { className: "flex items-center gap-2 text-[var(--color-gray-2)]", children: [_jsx("i", { className: "pi pi-spin pi-spinner text-[#9650fb]" }), "Loading..."] }) }));
|
|
19
17
|
}
|
|
20
18
|
return (_jsx("div", { className: "absolute inset-0 flex flex-col bg-[var(--color-gray-5)]", "data-testid": "translation-management", children: batchId ? (_jsx(BatchTranslationView, { batchId: batchId, onBack: () => {
|
|
21
|
-
const current = new URLSearchParams(
|
|
19
|
+
const current = new URLSearchParams(searchParams.toString());
|
|
22
20
|
current.delete("batchId");
|
|
23
21
|
router.push(`${pathname}?${current.toString()}`, { scroll: false });
|
|
24
22
|
} })) : recentTranslationsPanel ? (_jsx("div", { className: "flex-1 min-h-0", children: recentTranslationsPanel.content })) : (_jsxs("div", { className: "flex h-full flex-col items-center justify-center text-[var(--color-gray-2)]", children: [_jsx("i", { className: "pi pi-language mb-4 text-4xl text-[var(--color-gray-3)]" }), _jsx("p", { className: "font-medium text-[var(--color-gray-1)]", children: "Recent translations not available" })] })) }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parhelia/localization",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12560",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -24,18 +24,18 @@
|
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "tsc -p tsconfig.build.json",
|
|
27
|
+
"build:native": "tsgo -p tsconfig.build.json",
|
|
27
28
|
"lint": "eslint . --max-warnings 0",
|
|
28
|
-
"
|
|
29
|
-
"check-types": "
|
|
29
|
+
"check-types": "tsc --noEmit",
|
|
30
|
+
"check-types:native": "tsgo --noEmit"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"@repo/eslint-config": "*",
|
|
33
34
|
"@repo/typescript-config": "*",
|
|
34
35
|
"@tailwindcss/postcss": "^4.1.18",
|
|
35
|
-
"@turbo/gen": "^2.4.4",
|
|
36
36
|
"@types/node": "^22.13.9",
|
|
37
|
-
"@types/react": "19.2.
|
|
38
|
-
"@types/react-dom": "19.2.
|
|
37
|
+
"@types/react": "19.2.14",
|
|
38
|
+
"@types/react-dom": "19.2.3",
|
|
39
39
|
"eslint": "^9.22.0",
|
|
40
40
|
"tailwindcss": "^4.1.18",
|
|
41
41
|
"typescript": "5.8.2"
|
|
@@ -43,13 +43,12 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@parhelia/core": "*",
|
|
45
45
|
"lucide-react": "^0.486.0",
|
|
46
|
-
"next": "16.0.10",
|
|
47
46
|
"postcss": "^8.5.3",
|
|
48
|
-
"react": "19.2.
|
|
49
|
-
"react-dom": "19.2.
|
|
47
|
+
"react": "19.2.4",
|
|
48
|
+
"react-dom": "19.2.4"
|
|
50
49
|
},
|
|
51
50
|
"overrides": {
|
|
52
|
-
"@types/react": "19.2.
|
|
53
|
-
"@types/react-dom": "19.2.
|
|
51
|
+
"@types/react": "19.2.14",
|
|
52
|
+
"@types/react-dom": "19.2.3"
|
|
54
53
|
}
|
|
55
54
|
}
|