@acmekit/dashboard 2.13.6 → 2.13.8

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 (64) hide show
  1. package/dist/api-key-management-create-D57V3NN2.mjs +170 -0
  2. package/dist/api-key-management-detail-QURSBB6T.mjs +307 -0
  3. package/dist/api-key-management-edit-GG5V77GY.mjs +106 -0
  4. package/dist/api-key-management-list-PL64LD22.mjs +400 -0
  5. package/dist/app.js +16930 -1004
  6. package/dist/app.mjs +793 -884
  7. package/dist/chunk-22YYMH6M.mjs +382 -0
  8. package/dist/chunk-2U3RK3JG.mjs +474 -0
  9. package/dist/chunk-535OVBXR.mjs +226 -0
  10. package/dist/chunk-6SQCO25J.mjs +65 -0
  11. package/dist/chunk-774WSTCC.mjs +19 -0
  12. package/dist/chunk-7ZHDHEUH.mjs +1837 -0
  13. package/dist/chunk-C76H5USB.mjs +16 -0
  14. package/dist/chunk-DFFLVEZ5.mjs +40 -0
  15. package/dist/chunk-DN3MIYQH.mjs +140 -0
  16. package/dist/chunk-DQCEH3X2.mjs +28 -0
  17. package/dist/chunk-DTY37DDZ.mjs +20 -0
  18. package/dist/chunk-FXYH54JP.mjs +16 -0
  19. package/dist/chunk-G22WWLPG.mjs +44 -0
  20. package/dist/chunk-G2VJOHHV.mjs +32 -0
  21. package/dist/chunk-GBFVWROS.mjs +58 -0
  22. package/dist/chunk-ITNQKZQQ.mjs +142 -0
  23. package/dist/chunk-IUCDCPJU.mjs +0 -0
  24. package/dist/chunk-LKWTBYYC.mjs +35 -0
  25. package/dist/{chunk-4VYJHIB3.mjs → chunk-ND3ODI36.mjs} +0 -72
  26. package/dist/chunk-OAHCJFG3.mjs +17 -0
  27. package/dist/chunk-OHAFITSB.mjs +54 -0
  28. package/dist/chunk-RPAL6FHW.mjs +73 -0
  29. package/dist/{chunk-JSJZMTQG.mjs → chunk-RREPQMYC.mjs} +14 -41
  30. package/dist/chunk-S3REQHPQ.mjs +86 -0
  31. package/dist/chunk-S4DMV3ZT.mjs +35 -0
  32. package/dist/chunk-TCNCAWYD.mjs +9 -0
  33. package/dist/chunk-ULSPL3DR.mjs +126 -0
  34. package/dist/chunk-VBT5YZ4K.mjs +129 -0
  35. package/dist/chunk-WILMJYUB.mjs +35 -0
  36. package/dist/chunk-XIM7X4FB.mjs +83 -0
  37. package/dist/chunk-YB52HEIR.mjs +387 -0
  38. package/dist/chunk-YRWSG3YM.mjs +80 -0
  39. package/dist/{invite-S5USGDOZ.mjs → invite-BAFXQBLJ.mjs} +15 -7
  40. package/dist/{login-BRUR5XXN.mjs → login-YURMNRCS.mjs} +23 -9
  41. package/dist/profile-detail-SJWODS2K.mjs +96 -0
  42. package/dist/profile-edit-HSGF4UXZ.mjs +173 -0
  43. package/dist/{reset-password-UQPRHMB3.mjs → reset-password-RQ5M7HQC.mjs} +8 -4
  44. package/dist/settings-3XWLL5LG.mjs +545 -0
  45. package/dist/store-detail-SQKV5KBD.mjs +109 -0
  46. package/dist/store-edit-WGGIJMYJ.mjs +97 -0
  47. package/dist/store-metadata-CSBUGX6Z.mjs +49 -0
  48. package/dist/translation-list-H5X4DVCC.mjs +587 -0
  49. package/dist/translations-edit-NPAUN2GZ.mjs +5376 -0
  50. package/dist/user-detail-7SUQ35G7.mjs +169 -0
  51. package/dist/user-edit-KUZV37AH.mjs +114 -0
  52. package/dist/user-invite-OREFWWYL.mjs +361 -0
  53. package/dist/user-list-OWUR75OP.mjs +1116 -0
  54. package/dist/user-metadata-QHUX5SHZ.mjs +51 -0
  55. package/dist/workflow-execution-detail-MWNM25TF.mjs +820 -0
  56. package/dist/workflow-execution-list-IGYF44UH.mjs +175 -0
  57. package/package.json +9 -9
  58. package/src/components/layout/settings-layout/settings-layout.tsx +74 -6
  59. package/src/dashboard-app/routes/get-route.map.tsx +225 -0
  60. package/src/routes/login/login.tsx +1 -1
  61. package/dist/chunk-FBTP4AJM.mjs +0 -221
  62. package/dist/chunk-NQEMGMWU.mjs +0 -159
  63. package/dist/chunk-QYOO4QR6.mjs +0 -73
  64. package/dist/login-AIMR26AL.mjs +0 -291
@@ -0,0 +1,587 @@
1
+ import {
2
+ IconAvatar
3
+ } from "./chunk-G2VJOHHV.mjs";
4
+ import "./chunk-6SQCO25J.mjs";
5
+ import {
6
+ useTranslationSettings,
7
+ useTranslationStatistics
8
+ } from "./chunk-ULSPL3DR.mjs";
9
+ import "./chunk-GBFVWROS.mjs";
10
+ import "./chunk-VBT5YZ4K.mjs";
11
+ import "./chunk-LKWTBYYC.mjs";
12
+ import {
13
+ useStore
14
+ } from "./chunk-OHAFITSB.mjs";
15
+ import {
16
+ TwoColumnPage
17
+ } from "./chunk-22YYMH6M.mjs";
18
+ import "./chunk-DN3MIYQH.mjs";
19
+ import "./chunk-YRWSG3YM.mjs";
20
+ import "./chunk-XIM7X4FB.mjs";
21
+ import {
22
+ TwoColumnPageSkeleton
23
+ } from "./chunk-ITNQKZQQ.mjs";
24
+ import "./chunk-FXYH54JP.mjs";
25
+ import "./chunk-774WSTCC.mjs";
26
+ import "./chunk-DTY37DDZ.mjs";
27
+ import "./chunk-QZ7TP4HQ.mjs";
28
+
29
+ // src/routes/translations/translation-list/translation-list.tsx
30
+ import { Alert, Button as Button2, Container as Container4, Heading as Heading3, Text as Text4 } from "@acmekit/ui";
31
+ import { useCallback as useCallback2, useMemo as useMemo2 } from "react";
32
+ import { useTranslation as useTranslation4 } from "react-i18next";
33
+ import { useNavigate } from "react-router-dom";
34
+
35
+ // src/routes/translations/translation-list/components/active-locales-section/active-locales-section.tsx
36
+ import { Language } from "@acmekit/icons";
37
+ import { Container, Heading, Text, Tooltip } from "@acmekit/ui";
38
+ import { useCallback, useState } from "react";
39
+ import { useTranslation } from "react-i18next";
40
+
41
+ // src/components/common/link-button/link-button.tsx
42
+ import { clx } from "@acmekit/ui";
43
+ import { Link } from "react-router-dom";
44
+ import { jsx } from "react/jsx-runtime";
45
+ var LinkButton = ({
46
+ className,
47
+ variant = "interactive",
48
+ ...props
49
+ }) => {
50
+ return /* @__PURE__ */ jsx(
51
+ Link,
52
+ {
53
+ className: clx(
54
+ "transition-fg txt-compact-small-plus rounded-[4px] outline-none",
55
+ "focus-visible:shadow-borders-focus",
56
+ {
57
+ "text-ui-fg-interactive hover:text-ui-fg-interactive-hover": variant === "interactive",
58
+ "text-ui-fg-base hover:text-ui-fg-subtle": variant === "primary"
59
+ },
60
+ className
61
+ ),
62
+ ...props
63
+ }
64
+ );
65
+ };
66
+
67
+ // src/routes/translations/translation-list/components/active-locales-section/active-locales-section.tsx
68
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
69
+ var ActiveLocalesSection = ({
70
+ locales
71
+ }) => {
72
+ const { t } = useTranslation();
73
+ const [isHovered, setIsHovered] = useState(false);
74
+ const renderLocales = useCallback(() => {
75
+ const maxLocalesToDetail = 2;
76
+ if (locales.length <= maxLocalesToDetail) {
77
+ return locales.map((locale) => locale.name).join(", ");
78
+ }
79
+ return `${locales.slice(0, maxLocalesToDetail).map((locale) => locale.name).join(", ")} + ${locales.length - maxLocalesToDetail}`;
80
+ }, [locales]);
81
+ const hasLocales = locales.length > 0;
82
+ return /* @__PURE__ */ jsxs(Container, { className: "flex flex-col p-0", children: [
83
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 py-4", children: [
84
+ /* @__PURE__ */ jsx2(Heading, { level: "h2", children: t("translations.activeLocales.heading") }),
85
+ /* @__PURE__ */ jsx2(
86
+ LinkButton,
87
+ {
88
+ variant: "interactive",
89
+ className: "text-ui-fg-subtle hover:text-ui-fg-subtle-hover",
90
+ to: "/settings/translations/add-locales",
91
+ children: t("translations.activeLocales.noLocalesTipConfigureAction")
92
+ }
93
+ )
94
+ ] }),
95
+ hasLocales && /* @__PURE__ */ jsx2("div", { className: "px-1 pb-1", children: /* @__PURE__ */ jsx2(
96
+ Tooltip,
97
+ {
98
+ open: isHovered,
99
+ content: /* @__PURE__ */ jsx2("div", { className: "flex flex-col gap-y-1 p-1", children: locales.map((locale) => /* @__PURE__ */ jsx2(
100
+ Text,
101
+ {
102
+ size: "base",
103
+ className: "text-ui-fg-subtle",
104
+ children: locale.name
105
+ },
106
+ locale.code
107
+ )) }),
108
+ children: /* @__PURE__ */ jsxs(
109
+ Container,
110
+ {
111
+ className: "bg-ui-bg-component border-r-1 flex items-center gap-x-4 px-[19px] py-2",
112
+ onMouseEnter: () => setIsHovered(true),
113
+ onMouseLeave: () => setIsHovered(false),
114
+ children: [
115
+ /* @__PURE__ */ jsx2(IconAvatar, { className: "border-ui-border-base border", children: /* @__PURE__ */ jsx2(Language, {}) }),
116
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
117
+ /* @__PURE__ */ jsx2(Text, { size: "small", weight: "plus", children: t("translations.activeLocales.subtitle") }),
118
+ /* @__PURE__ */ jsx2(Text, { className: "text-ui-fg-subtle", size: "small", children: renderLocales() })
119
+ ] })
120
+ ]
121
+ }
122
+ )
123
+ }
124
+ ) })
125
+ ] });
126
+ };
127
+
128
+ // src/routes/translations/translation-list/components/translation-list-section/translation-list-section.tsx
129
+ import { Button, Container as Container2, Text as Text2 } from "@acmekit/ui";
130
+ import { Link as Link2 } from "react-router-dom";
131
+ import { useTranslation as useTranslation2 } from "react-i18next";
132
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
133
+ var TranslationListSection = ({
134
+ entities,
135
+ hasLocales = false
136
+ }) => {
137
+ const { t } = useTranslation2();
138
+ return /* @__PURE__ */ jsx3(Container2, { className: "divide-y p-0", children: entities.map((entity) => /* @__PURE__ */ jsxs2(
139
+ "div",
140
+ {
141
+ className: "grid grid-cols-[250px_1fr_auto] items-center gap-x-4 px-6 py-4",
142
+ children: [
143
+ /* @__PURE__ */ jsx3(Text2, { size: "small", weight: "plus", children: entity.label }),
144
+ /* @__PURE__ */ jsx3(Text2, { size: "small", className: "text-ui-fg-subtle", children: t("translations.list.metrics", {
145
+ translated: (entity.translatedCount ?? 0).toLocaleString(),
146
+ total: (entity.totalCount ?? 0).toLocaleString()
147
+ }) }),
148
+ /* @__PURE__ */ jsx3(
149
+ Link2,
150
+ {
151
+ to: `/settings/translations/edit?reference=${entity.reference}`,
152
+ children: /* @__PURE__ */ jsx3(
153
+ Button,
154
+ {
155
+ variant: "secondary",
156
+ size: "small",
157
+ disabled: !hasLocales || !entity.totalCount,
158
+ children: "Edit"
159
+ }
160
+ )
161
+ }
162
+ )
163
+ ]
164
+ },
165
+ entity.reference
166
+ )) });
167
+ };
168
+
169
+ // src/routes/translations/translation-list/components/translations-completion-section/translations-completion-section.tsx
170
+ import { Container as Container3, Divider, Heading as Heading2, Text as Text3, Tooltip as Tooltip2 } from "@acmekit/ui";
171
+ import { useMemo, useState as useState2 } from "react";
172
+ import { useTranslation as useTranslation3 } from "react-i18next";
173
+ import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
174
+ var TranslationsCompletionSection = ({
175
+ statistics,
176
+ locales
177
+ }) => {
178
+ const { t } = useTranslation3();
179
+ const [hoveredLocale, setHoveredLocale] = useState2(null);
180
+ const { translatedCount, totalCount } = Object.values(statistics).reduce(
181
+ (acc, curr) => ({
182
+ translatedCount: acc.translatedCount + curr.translated,
183
+ totalCount: acc.totalCount + curr.expected
184
+ }),
185
+ { totalCount: 0, translatedCount: 0 }
186
+ );
187
+ const percentage = totalCount > 0 ? translatedCount / totalCount * 100 : 0;
188
+ const remaining = Math.max(0, totalCount - translatedCount);
189
+ const localeStats = useMemo(() => {
190
+ const localeMap = /* @__PURE__ */ new Map();
191
+ locales.forEach((locale) => {
192
+ localeMap.set(locale.code, { translated: 0, expected: 0 });
193
+ });
194
+ Object.values(statistics).forEach((entityStats) => {
195
+ if (entityStats.by_locale) {
196
+ Object.entries(entityStats.by_locale).forEach(
197
+ ([localeCode, localeData]) => {
198
+ const existing = localeMap.get(localeCode);
199
+ if (existing) {
200
+ existing.translated += localeData.translated;
201
+ existing.expected += localeData.expected;
202
+ }
203
+ }
204
+ );
205
+ }
206
+ });
207
+ return locales.map((locale) => {
208
+ const stats = localeMap.get(locale.code) || { translated: 0, expected: 0 };
209
+ return {
210
+ code: locale.code,
211
+ name: locale.name,
212
+ translated: stats.translated,
213
+ toTranslate: Math.max(0, stats.expected - stats.translated),
214
+ total: stats.expected
215
+ };
216
+ });
217
+ }, [statistics, locales]);
218
+ const maxTotal = useMemo(
219
+ () => Math.max(...localeStats.map((s) => s.total), 1),
220
+ [localeStats]
221
+ );
222
+ const localeStatsCount = useMemo(() => localeStats.length, [localeStats]);
223
+ return /* @__PURE__ */ jsxs3(Container3, { className: "p-0", children: [
224
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-y-4 px-6 py-4", children: [
225
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between", children: [
226
+ /* @__PURE__ */ jsx4(Heading2, { level: "h2", children: t("translations.completion.heading") }),
227
+ /* @__PURE__ */ jsxs3(Text3, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: [
228
+ translatedCount.toLocaleString(),
229
+ " ",
230
+ t("general.of"),
231
+ " ",
232
+ totalCount.toLocaleString()
233
+ ] })
234
+ ] }),
235
+ /* @__PURE__ */ jsx4("div", { className: "flex h-3 w-full overflow-hidden", children: percentage > 0 ? /* @__PURE__ */ jsxs3(Fragment, { children: [
236
+ /* @__PURE__ */ jsx4(
237
+ "div",
238
+ {
239
+ className: "mr-0.5 h-full rounded-sm transition-all",
240
+ style: {
241
+ width: `${percentage}%`,
242
+ backgroundColor: "var(--tag-blue-icon)",
243
+ boxShadow: "inset 0 0 0 0.5px var(--alpha-250)"
244
+ }
245
+ }
246
+ ),
247
+ /* @__PURE__ */ jsx4(
248
+ "div",
249
+ {
250
+ className: "h-full flex-1 rounded-sm",
251
+ style: {
252
+ backgroundColor: "var(--tag-blue-border)",
253
+ boxShadow: "inset 0 0 0 0.5px var(--alpha-250)"
254
+ }
255
+ }
256
+ )
257
+ ] }) : /* @__PURE__ */ jsx4(
258
+ "div",
259
+ {
260
+ className: "h-full w-full rounded-sm",
261
+ style: {
262
+ backgroundColor: "var(--tag-blue-border)",
263
+ boxShadow: "inset 0 0 0 0.5px var(--alpha-250)"
264
+ }
265
+ }
266
+ ) }),
267
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between", children: [
268
+ /* @__PURE__ */ jsxs3(Text3, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: [
269
+ percentage.toFixed(1),
270
+ "%"
271
+ ] }),
272
+ /* @__PURE__ */ jsxs3(Text3, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: [
273
+ remaining.toLocaleString(),
274
+ " ",
275
+ t("general.remaining").toLowerCase()
276
+ ] })
277
+ ] })
278
+ ] }),
279
+ localeStats.length > 0 && /* @__PURE__ */ jsxs3(Fragment, { children: [
280
+ /* @__PURE__ */ jsx4(Divider, { variant: "dashed" }),
281
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-y-3 px-6 pb-6 pt-4", children: [
282
+ /* @__PURE__ */ jsx4("div", { className: "flex h-32 w-full items-end gap-1", children: localeStats.map((locale) => {
283
+ const heightPercent = locale.total / maxTotal * 100;
284
+ const translatedPercent = locale.total > 0 ? locale.translated / locale.total * 100 : 0;
285
+ return /* @__PURE__ */ jsx4(
286
+ Tooltip2,
287
+ {
288
+ open: hoveredLocale === locale.code,
289
+ content: /* @__PURE__ */ jsxs3("div", { className: "flex min-w-[150px] flex-col gap-y-1 p-1", children: [
290
+ /* @__PURE__ */ jsx4(Text3, { size: "small", weight: "plus", children: locale.name }),
291
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between", children: [
292
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-x-2", children: [
293
+ /* @__PURE__ */ jsx4(
294
+ "div",
295
+ {
296
+ className: "h-2 w-2 rounded-full",
297
+ style: {
298
+ backgroundColor: "var(--tag-blue-icon)",
299
+ boxShadow: "inset 0 0 0 0.5px var(--alpha-250)"
300
+ }
301
+ }
302
+ ),
303
+ /* @__PURE__ */ jsx4(
304
+ Text3,
305
+ {
306
+ size: "small",
307
+ weight: "plus",
308
+ className: "text-ui-fg-base",
309
+ children: t("translations.completion.translated")
310
+ }
311
+ )
312
+ ] }),
313
+ /* @__PURE__ */ jsx4(
314
+ Text3,
315
+ {
316
+ size: "small",
317
+ weight: "plus",
318
+ className: "text-ui-fg-base",
319
+ children: locale.translated
320
+ }
321
+ )
322
+ ] }),
323
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between", children: [
324
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-x-2", children: [
325
+ /* @__PURE__ */ jsx4(
326
+ "div",
327
+ {
328
+ className: "h-2 w-2 rounded-full",
329
+ style: {
330
+ backgroundColor: "var(--tag-blue-border)",
331
+ boxShadow: "inset 0 0 0 0.5px var(--alpha-250)"
332
+ }
333
+ }
334
+ ),
335
+ /* @__PURE__ */ jsx4(
336
+ Text3,
337
+ {
338
+ size: "small",
339
+ weight: "plus",
340
+ className: "text-ui-fg-base",
341
+ children: t("translations.completion.toTranslate")
342
+ }
343
+ )
344
+ ] }),
345
+ /* @__PURE__ */ jsx4(
346
+ Text3,
347
+ {
348
+ size: "small",
349
+ weight: "plus",
350
+ className: "text-ui-fg-base",
351
+ children: locale.toTranslate
352
+ }
353
+ )
354
+ ] })
355
+ ] }),
356
+ children: /* @__PURE__ */ jsx4("div", { className: "flex h-full flex-1 items-end justify-center", children: /* @__PURE__ */ jsx4(
357
+ "div",
358
+ {
359
+ className: "flex w-full min-w-2 max-w-[96px] flex-col justify-end overflow-hidden rounded-t-sm transition-opacity",
360
+ style: { height: `${heightPercent}%` },
361
+ onMouseEnter: () => setHoveredLocale(locale.code),
362
+ onMouseLeave: () => setHoveredLocale(null),
363
+ children: translatedPercent === 0 ? /* @__PURE__ */ jsx4(
364
+ "div",
365
+ {
366
+ className: "w-full rounded-sm",
367
+ style: {
368
+ height: "100%",
369
+ backgroundColor: "var(--tag-neutral-bg)",
370
+ boxShadow: "inset 0 0 0 0.5px var(--alpha-250)"
371
+ }
372
+ }
373
+ ) : /* @__PURE__ */ jsxs3(Fragment, { children: [
374
+ /* @__PURE__ */ jsx4(
375
+ "div",
376
+ {
377
+ className: "w-full rounded-sm",
378
+ style: {
379
+ height: `${100 - translatedPercent}%`,
380
+ backgroundColor: "var(--tag-blue-border)",
381
+ boxShadow: "inset 0 0 0 0.5px var(--alpha-250)",
382
+ minHeight: locale.toTranslate > 0 ? "2px" : "0"
383
+ }
384
+ }
385
+ ),
386
+ translatedPercent > 0 && /* @__PURE__ */ jsx4(
387
+ "div",
388
+ {
389
+ className: "mt-0.5 w-full rounded-sm",
390
+ style: {
391
+ height: `${translatedPercent}%`,
392
+ backgroundColor: "var(--tag-blue-icon)",
393
+ boxShadow: "inset 0 0 0 0.5px var(--alpha-250)",
394
+ minHeight: locale.translated > 0 ? "2px" : "0"
395
+ }
396
+ }
397
+ )
398
+ ] })
399
+ }
400
+ ) })
401
+ },
402
+ locale.code
403
+ );
404
+ }) }),
405
+ localeStatsCount < 9 && /* @__PURE__ */ jsx4("div", { className: "flex w-full gap-1", children: localeStats.map((locale) => /* @__PURE__ */ jsx4(
406
+ "div",
407
+ {
408
+ className: "flex flex-1 items-center justify-center",
409
+ children: /* @__PURE__ */ jsx4(
410
+ Text3,
411
+ {
412
+ size: "xsmall",
413
+ weight: "plus",
414
+ className: "text-ui-fg-subtle min-w-2 whitespace-normal break-words text-center leading-tight",
415
+ children: localeStatsCount < 6 ? locale.name : locale.code
416
+ }
417
+ )
418
+ },
419
+ locale.code
420
+ )) }),
421
+ localeStatsCount > 9 && /* @__PURE__ */ jsx4(
422
+ Text3,
423
+ {
424
+ weight: "plus",
425
+ size: "xsmall",
426
+ className: "text-ui-fg-subtle text-center",
427
+ children: t("translations.completion.footer")
428
+ }
429
+ )
430
+ ] })
431
+ ] })
432
+ ] });
433
+ };
434
+
435
+ // src/routes/translations/translation-list/translation-list.tsx
436
+ import { ListCheckbox } from "@acmekit/icons";
437
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
438
+ var TranslationList = () => {
439
+ const { t } = useTranslation4();
440
+ const navigate = useNavigate();
441
+ const { store, isPending, isError, error } = useStore();
442
+ const {
443
+ translation_settings,
444
+ isPending: isTranslationSettingsPending,
445
+ isError: isTranslationSettingsError,
446
+ error: translationSettingsError
447
+ } = useTranslationSettings({
448
+ is_active: true
449
+ });
450
+ const {
451
+ statistics,
452
+ isPending: isTranslationStatisticsPending,
453
+ isError: isTranslationStatisticsError,
454
+ error: translationStatisticsError
455
+ } = useTranslationStatistics(
456
+ {
457
+ locales: store?.supported_locales?.map(
458
+ (suportedLocale) => suportedLocale.locale_code
459
+ ) ?? [],
460
+ entity_types: Object.keys(translation_settings ?? {})
461
+ },
462
+ {
463
+ enabled: !!translation_settings && !!store && store.supported_locales?.length > 0
464
+ }
465
+ );
466
+ if (isError || isTranslationSettingsError || isTranslationStatisticsError) {
467
+ throw error || translationSettingsError || translationStatisticsError;
468
+ }
469
+ const hasLocales = (store?.supported_locales ?? []).length > 0;
470
+ const translatableEntities = useMemo2(() => {
471
+ if (!translation_settings) {
472
+ return [];
473
+ }
474
+ return Object.entries(translation_settings).filter(
475
+ ([entity]) => !["product_option", "product_option_value"].includes(entity)
476
+ ).map(([entity, setting]) => {
477
+ const entityStatistics = statistics?.[entity] ?? {
478
+ translated: 0,
479
+ expected: 0
480
+ };
481
+ return {
482
+ label: entity.split("_").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" "),
483
+ reference: entity,
484
+ translatableFields: setting.fields,
485
+ translatedCount: entityStatistics.translated,
486
+ totalCount: entityStatistics.expected
487
+ };
488
+ }).sort((a, b) => a.label.localeCompare(b.label));
489
+ }, [translation_settings, statistics]);
490
+ const handleManageLocales = useCallback2(() => {
491
+ navigate("/settings/translations/add-locales");
492
+ }, [navigate]);
493
+ const handleManageEntities = useCallback2(() => {
494
+ navigate("/settings/translations/settings");
495
+ }, [navigate]);
496
+ const isReady = !!store && !isPending && !isTranslationSettingsPending && !!translation_settings && (!!statistics && !isTranslationStatisticsPending || !hasLocales);
497
+ if (!isReady) {
498
+ return /* @__PURE__ */ jsx5(TwoColumnPageSkeleton, { sidebarSections: 2 });
499
+ }
500
+ return /* @__PURE__ */ jsxs4(
501
+ TwoColumnPage,
502
+ {
503
+ widgets: {
504
+ before: [],
505
+ after: [],
506
+ sideBefore: [],
507
+ sideAfter: []
508
+ },
509
+ children: [
510
+ /* @__PURE__ */ jsxs4(TwoColumnPage.Main, { children: [
511
+ /* @__PURE__ */ jsxs4(Container4, { className: "flex items-center justify-between px-6 py-4", children: [
512
+ /* @__PURE__ */ jsxs4("div", { className: "flex flex-col", children: [
513
+ /* @__PURE__ */ jsxs4(Heading3, { children: [
514
+ "Manage ",
515
+ t("translations.domain")
516
+ ] }),
517
+ /* @__PURE__ */ jsx5(Text4, { className: "text-ui-fg-subtle", size: "small", children: t("translations.subtitle") })
518
+ ] }),
519
+ /* @__PURE__ */ jsxs4(
520
+ Button2,
521
+ {
522
+ size: "small",
523
+ variant: "secondary",
524
+ onClick: handleManageEntities,
525
+ children: [
526
+ /* @__PURE__ */ jsx5(ListCheckbox, { className: "text-ui-fg-subtle" }),
527
+ /* @__PURE__ */ jsx5(Text4, { className: "txt-compact-small-plus text-ui-fg-base", children: t("translations.actions.manageEntities") })
528
+ ]
529
+ }
530
+ )
531
+ ] }),
532
+ !hasLocales && /* @__PURE__ */ jsx5(
533
+ Alert,
534
+ {
535
+ variant: "info",
536
+ className: "bg-ui-bg-base flex items-center px-6 py-4",
537
+ children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between gap-x-2", children: [
538
+ /* @__PURE__ */ jsxs4("p", { children: [
539
+ t("translations.activeLocales.noLocalesTip"),
540
+ "."
541
+ ] }),
542
+ /* @__PURE__ */ jsx5(
543
+ Button2,
544
+ {
545
+ onClick: handleManageLocales,
546
+ size: "small",
547
+ variant: "secondary",
548
+ children: t("translations.activeLocales.noLocalesTipConfigureAction")
549
+ }
550
+ )
551
+ ] })
552
+ }
553
+ ),
554
+ /* @__PURE__ */ jsx5(
555
+ TranslationListSection,
556
+ {
557
+ entities: translatableEntities,
558
+ hasLocales
559
+ }
560
+ )
561
+ ] }),
562
+ /* @__PURE__ */ jsxs4(TwoColumnPage.Sidebar, { children: [
563
+ /* @__PURE__ */ jsx5(
564
+ ActiveLocalesSection,
565
+ {
566
+ locales: store?.supported_locales?.map(
567
+ (suportedLocale) => suportedLocale.locale
568
+ ) ?? []
569
+ }
570
+ ),
571
+ /* @__PURE__ */ jsx5(
572
+ TranslationsCompletionSection,
573
+ {
574
+ statistics: statistics ?? {},
575
+ locales: store?.supported_locales?.map(
576
+ (supportedLocale) => supportedLocale.locale
577
+ ) ?? []
578
+ }
579
+ )
580
+ ] })
581
+ ]
582
+ }
583
+ );
584
+ };
585
+ export {
586
+ TranslationList as Component
587
+ };