@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.
- package/dist/api-key-management-create-D57V3NN2.mjs +170 -0
- package/dist/api-key-management-detail-QURSBB6T.mjs +307 -0
- package/dist/api-key-management-edit-GG5V77GY.mjs +106 -0
- package/dist/api-key-management-list-PL64LD22.mjs +400 -0
- package/dist/app.js +16930 -1004
- package/dist/app.mjs +793 -884
- package/dist/chunk-22YYMH6M.mjs +382 -0
- package/dist/chunk-2U3RK3JG.mjs +474 -0
- package/dist/chunk-535OVBXR.mjs +226 -0
- package/dist/chunk-6SQCO25J.mjs +65 -0
- package/dist/chunk-774WSTCC.mjs +19 -0
- package/dist/chunk-7ZHDHEUH.mjs +1837 -0
- package/dist/chunk-C76H5USB.mjs +16 -0
- package/dist/chunk-DFFLVEZ5.mjs +40 -0
- package/dist/chunk-DN3MIYQH.mjs +140 -0
- package/dist/chunk-DQCEH3X2.mjs +28 -0
- package/dist/chunk-DTY37DDZ.mjs +20 -0
- package/dist/chunk-FXYH54JP.mjs +16 -0
- package/dist/chunk-G22WWLPG.mjs +44 -0
- package/dist/chunk-G2VJOHHV.mjs +32 -0
- package/dist/chunk-GBFVWROS.mjs +58 -0
- package/dist/chunk-ITNQKZQQ.mjs +142 -0
- package/dist/chunk-IUCDCPJU.mjs +0 -0
- package/dist/chunk-LKWTBYYC.mjs +35 -0
- package/dist/{chunk-4VYJHIB3.mjs → chunk-ND3ODI36.mjs} +0 -72
- package/dist/chunk-OAHCJFG3.mjs +17 -0
- package/dist/chunk-OHAFITSB.mjs +54 -0
- package/dist/chunk-RPAL6FHW.mjs +73 -0
- package/dist/{chunk-JSJZMTQG.mjs → chunk-RREPQMYC.mjs} +14 -41
- package/dist/chunk-S3REQHPQ.mjs +86 -0
- package/dist/chunk-S4DMV3ZT.mjs +35 -0
- package/dist/chunk-TCNCAWYD.mjs +9 -0
- package/dist/chunk-ULSPL3DR.mjs +126 -0
- package/dist/chunk-VBT5YZ4K.mjs +129 -0
- package/dist/chunk-WILMJYUB.mjs +35 -0
- package/dist/chunk-XIM7X4FB.mjs +83 -0
- package/dist/chunk-YB52HEIR.mjs +387 -0
- package/dist/chunk-YRWSG3YM.mjs +80 -0
- package/dist/{invite-S5USGDOZ.mjs → invite-BAFXQBLJ.mjs} +15 -7
- package/dist/{login-BRUR5XXN.mjs → login-YURMNRCS.mjs} +23 -9
- package/dist/profile-detail-SJWODS2K.mjs +96 -0
- package/dist/profile-edit-HSGF4UXZ.mjs +173 -0
- package/dist/{reset-password-UQPRHMB3.mjs → reset-password-RQ5M7HQC.mjs} +8 -4
- package/dist/settings-3XWLL5LG.mjs +545 -0
- package/dist/store-detail-SQKV5KBD.mjs +109 -0
- package/dist/store-edit-WGGIJMYJ.mjs +97 -0
- package/dist/store-metadata-CSBUGX6Z.mjs +49 -0
- package/dist/translation-list-H5X4DVCC.mjs +587 -0
- package/dist/translations-edit-NPAUN2GZ.mjs +5376 -0
- package/dist/user-detail-7SUQ35G7.mjs +169 -0
- package/dist/user-edit-KUZV37AH.mjs +114 -0
- package/dist/user-invite-OREFWWYL.mjs +361 -0
- package/dist/user-list-OWUR75OP.mjs +1116 -0
- package/dist/user-metadata-QHUX5SHZ.mjs +51 -0
- package/dist/workflow-execution-detail-MWNM25TF.mjs +820 -0
- package/dist/workflow-execution-list-IGYF44UH.mjs +175 -0
- package/package.json +9 -9
- package/src/components/layout/settings-layout/settings-layout.tsx +74 -6
- package/src/dashboard-app/routes/get-route.map.tsx +225 -0
- package/src/routes/login/login.tsx +1 -1
- package/dist/chunk-FBTP4AJM.mjs +0 -221
- package/dist/chunk-NQEMGMWU.mjs +0 -159
- package/dist/chunk-QYOO4QR6.mjs +0 -73
- package/dist/login-AIMR26AL.mjs +0 -291
|
@@ -0,0 +1,545 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useBatchTranslationSettings,
|
|
3
|
+
useTranslationSettings
|
|
4
|
+
} from "./chunk-ULSPL3DR.mjs";
|
|
5
|
+
import "./chunk-IUCDCPJU.mjs";
|
|
6
|
+
import {
|
|
7
|
+
KeyboundForm,
|
|
8
|
+
RouteDrawer,
|
|
9
|
+
useRouteModal
|
|
10
|
+
} from "./chunk-2U3RK3JG.mjs";
|
|
11
|
+
import "./chunk-ND3ODI36.mjs";
|
|
12
|
+
import "./chunk-FXYH54JP.mjs";
|
|
13
|
+
import "./chunk-774WSTCC.mjs";
|
|
14
|
+
import "./chunk-DTY37DDZ.mjs";
|
|
15
|
+
import "./chunk-QZ7TP4HQ.mjs";
|
|
16
|
+
|
|
17
|
+
// src/routes/translations/settings/settings.tsx
|
|
18
|
+
import { Heading } from "@acmekit/ui";
|
|
19
|
+
import { Spinner } from "@acmekit/icons";
|
|
20
|
+
|
|
21
|
+
// src/routes/translations/settings/components/batch-translation-settings-form/batch-translation-settings-form.tsx
|
|
22
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
23
|
+
import { Button as Button3, Divider as Divider2, toast } from "@acmekit/ui";
|
|
24
|
+
import { useState as useState3, useRef, useMemo as useMemo2 } from "react";
|
|
25
|
+
import { useForm } from "react-hook-form";
|
|
26
|
+
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
27
|
+
import * as zod from "zod";
|
|
28
|
+
|
|
29
|
+
// src/routes/translations/settings/components/entity-selector-tree/entity-selector-tree.tsx
|
|
30
|
+
import { TriangleRightMini } from "@acmekit/icons";
|
|
31
|
+
import { Checkbox, clx, Divider, Text } from "@acmekit/ui";
|
|
32
|
+
import React, { useImperativeHandle, useMemo, useState, useEffect } from "react";
|
|
33
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
34
|
+
var SelectorRow = ({
|
|
35
|
+
leftElement,
|
|
36
|
+
expandButton,
|
|
37
|
+
checked,
|
|
38
|
+
onCheckedChange,
|
|
39
|
+
label,
|
|
40
|
+
className
|
|
41
|
+
}) => {
|
|
42
|
+
const isSelected = checked !== false;
|
|
43
|
+
return /* @__PURE__ */ jsxs("div", { className: clx("flex items-center gap-x-2 px-2 py-1.5", className), children: [
|
|
44
|
+
leftElement,
|
|
45
|
+
/* @__PURE__ */ jsx(Checkbox, { checked, onCheckedChange }),
|
|
46
|
+
expandButton,
|
|
47
|
+
/* @__PURE__ */ jsx(
|
|
48
|
+
Text,
|
|
49
|
+
{
|
|
50
|
+
size: "small",
|
|
51
|
+
weight: isSelected ? "plus" : "regular",
|
|
52
|
+
className: "text-ui-fg-base",
|
|
53
|
+
children: label
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
] });
|
|
57
|
+
};
|
|
58
|
+
var EntitySelectorTree = React.forwardRef(({ entities, onSelectionChange, searchQuery, viewMode, sortOrder }, ref) => {
|
|
59
|
+
const [expandedEntities, setExpandedEntities] = useState(
|
|
60
|
+
/* @__PURE__ */ new Set()
|
|
61
|
+
);
|
|
62
|
+
const [selectedIds, setSelectedIds] = useState(/* @__PURE__ */ new Set());
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
const ids = /* @__PURE__ */ new Set();
|
|
65
|
+
entities.forEach((entity) => {
|
|
66
|
+
entity.fields?.forEach((field) => {
|
|
67
|
+
if (field.selected) {
|
|
68
|
+
ids.add(`${entity.id}.${field.id}`);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
setSelectedIds(ids);
|
|
73
|
+
}, [entities]);
|
|
74
|
+
const toggleExpand = (entityId) => {
|
|
75
|
+
setExpandedEntities((prev) => {
|
|
76
|
+
const next = new Set(prev);
|
|
77
|
+
if (next.has(entityId)) {
|
|
78
|
+
next.delete(entityId);
|
|
79
|
+
} else {
|
|
80
|
+
next.add(entityId);
|
|
81
|
+
}
|
|
82
|
+
return next;
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
const getEntitySelectionState = (entity) => {
|
|
86
|
+
if (!entity.fields?.length) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
const selectedFieldsCount = entity.fields.filter(
|
|
90
|
+
(field) => selectedIds.has(`${entity.id}.${field.id}`)
|
|
91
|
+
).length;
|
|
92
|
+
if (selectedFieldsCount === 0) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
if (selectedFieldsCount === entity.fields.length) {
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
return "indeterminate";
|
|
99
|
+
};
|
|
100
|
+
const toggleEntitySelection = (entity) => {
|
|
101
|
+
setSelectedIds((prev) => {
|
|
102
|
+
const next = new Set(prev);
|
|
103
|
+
const state = getEntitySelectionState(entity);
|
|
104
|
+
const isSelected = state === true;
|
|
105
|
+
entity.fields?.forEach((field) => {
|
|
106
|
+
const fieldKey = `${entity.id}.${field.id}`;
|
|
107
|
+
if (isSelected) {
|
|
108
|
+
next.delete(fieldKey);
|
|
109
|
+
} else {
|
|
110
|
+
next.add(fieldKey);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
onSelectionChange?.(next);
|
|
114
|
+
return next;
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
const toggleFieldSelection = (entityId, fieldId) => {
|
|
118
|
+
setSelectedIds((prev) => {
|
|
119
|
+
const next = new Set(prev);
|
|
120
|
+
const fieldKey = `${entityId}.${fieldId}`;
|
|
121
|
+
if (next.has(fieldKey)) {
|
|
122
|
+
next.delete(fieldKey);
|
|
123
|
+
} else {
|
|
124
|
+
next.add(fieldKey);
|
|
125
|
+
}
|
|
126
|
+
onSelectionChange?.(next);
|
|
127
|
+
return next;
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
const selectAllToggle = (selected) => {
|
|
131
|
+
if (selected) {
|
|
132
|
+
const allIds = /* @__PURE__ */ new Set();
|
|
133
|
+
entities.forEach((entity) => {
|
|
134
|
+
entity.fields?.forEach((field) => {
|
|
135
|
+
allIds.add(`${entity.id}.${field.id}`);
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
setSelectedIds(allIds);
|
|
139
|
+
onSelectionChange?.(allIds);
|
|
140
|
+
} else {
|
|
141
|
+
setSelectedIds(/* @__PURE__ */ new Set());
|
|
142
|
+
onSelectionChange?.(/* @__PURE__ */ new Set());
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
const collapseAll = () => setExpandedEntities(/* @__PURE__ */ new Set());
|
|
146
|
+
useImperativeHandle(ref, () => ({
|
|
147
|
+
selectAllToggle,
|
|
148
|
+
collapseAll
|
|
149
|
+
}));
|
|
150
|
+
const filteredAndSortedEntities = useMemo(() => {
|
|
151
|
+
let filtered = entities;
|
|
152
|
+
if (searchQuery) {
|
|
153
|
+
const query = searchQuery.toLowerCase();
|
|
154
|
+
filtered = entities.filter((entity) => {
|
|
155
|
+
const matchesEntity = entity.name.toLowerCase().includes(query);
|
|
156
|
+
const matchesFields = entity.fields?.some(
|
|
157
|
+
(field) => field.name.toLowerCase().includes(query)
|
|
158
|
+
);
|
|
159
|
+
return matchesEntity || matchesFields;
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
if (viewMode === "selected") {
|
|
163
|
+
filtered = filtered.filter((entity) => {
|
|
164
|
+
const state = getEntitySelectionState(entity);
|
|
165
|
+
if (state === false) {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
return true;
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
const sorted = [...filtered].sort((a, b) => {
|
|
172
|
+
const comparison = a.name.localeCompare(b.name);
|
|
173
|
+
return sortOrder === "asc" ? comparison : -comparison;
|
|
174
|
+
});
|
|
175
|
+
return sorted;
|
|
176
|
+
}, [entities, searchQuery, viewMode, sortOrder, selectedIds]);
|
|
177
|
+
return /* @__PURE__ */ jsx("div", { className: "flex h-full flex-col", children: /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto", children: filteredAndSortedEntities.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle flex items-center justify-center py-12 text-sm", children: "No entities matching filters" }) : /* @__PURE__ */ jsx("div", { children: filteredAndSortedEntities.map((entity) => {
|
|
178
|
+
const isExpanded = expandedEntities.has(entity.id);
|
|
179
|
+
const hasFields = entity.fields && entity.fields.length > 0;
|
|
180
|
+
const selectionState = getEntitySelectionState(entity);
|
|
181
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
182
|
+
/* @__PURE__ */ jsx(
|
|
183
|
+
SelectorRow,
|
|
184
|
+
{
|
|
185
|
+
checked: selectionState,
|
|
186
|
+
onCheckedChange: () => toggleEntitySelection(entity),
|
|
187
|
+
label: entity.name,
|
|
188
|
+
className: "hover:bg-ui-bg-component-hover",
|
|
189
|
+
expandButton: hasFields ? /* @__PURE__ */ jsx(
|
|
190
|
+
"button",
|
|
191
|
+
{
|
|
192
|
+
type: "button",
|
|
193
|
+
onClick: () => toggleExpand(entity.id),
|
|
194
|
+
className: "flex h-5 w-5 items-center justify-center",
|
|
195
|
+
children: /* @__PURE__ */ jsx(
|
|
196
|
+
TriangleRightMini,
|
|
197
|
+
{
|
|
198
|
+
className: clx(
|
|
199
|
+
"text-ui-fg-muted transition-transform",
|
|
200
|
+
isExpanded && "rotate-90"
|
|
201
|
+
)
|
|
202
|
+
}
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
) : null
|
|
206
|
+
}
|
|
207
|
+
),
|
|
208
|
+
hasFields && isExpanded && /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
209
|
+
/* @__PURE__ */ jsx(
|
|
210
|
+
Divider,
|
|
211
|
+
{
|
|
212
|
+
orientation: "vertical",
|
|
213
|
+
className: "absolute bottom-0 left-[2.87rem] top-0 z-10"
|
|
214
|
+
}
|
|
215
|
+
),
|
|
216
|
+
entity.fields.map((field) => {
|
|
217
|
+
const fieldKey = `${entity.id}.${field.id}`;
|
|
218
|
+
const isFieldSelected = selectedIds.has(fieldKey);
|
|
219
|
+
return /* @__PURE__ */ jsx(
|
|
220
|
+
SelectorRow,
|
|
221
|
+
{
|
|
222
|
+
className: "pl-3",
|
|
223
|
+
leftElement: /* @__PURE__ */ jsx("div", { className: "w-11" }),
|
|
224
|
+
checked: isFieldSelected,
|
|
225
|
+
onCheckedChange: () => {
|
|
226
|
+
toggleFieldSelection(entity.id, field.id);
|
|
227
|
+
},
|
|
228
|
+
label: field.name
|
|
229
|
+
},
|
|
230
|
+
field.id
|
|
231
|
+
);
|
|
232
|
+
})
|
|
233
|
+
] })
|
|
234
|
+
] }, entity.id);
|
|
235
|
+
}) }) }) });
|
|
236
|
+
});
|
|
237
|
+
EntitySelectorTree.displayName = "EntitySelectorTree";
|
|
238
|
+
|
|
239
|
+
// src/routes/translations/settings/components/selector-tree-filter/selector-tree-filter.tsx
|
|
240
|
+
import { Collapse, DescendingSorting } from "@acmekit/icons";
|
|
241
|
+
import { Button as Button2, clx as clx3, IconButton, Input, Tooltip } from "@acmekit/ui";
|
|
242
|
+
|
|
243
|
+
// src/components/common/segmented-control/segmented-control.tsx
|
|
244
|
+
import { Button, clx as clx2 } from "@acmekit/ui";
|
|
245
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
246
|
+
var SegmentedControl = ({
|
|
247
|
+
value,
|
|
248
|
+
onValueChange,
|
|
249
|
+
options,
|
|
250
|
+
className
|
|
251
|
+
}) => {
|
|
252
|
+
return /* @__PURE__ */ jsx2(
|
|
253
|
+
"div",
|
|
254
|
+
{
|
|
255
|
+
className: clx2(
|
|
256
|
+
"bg-ui-bg-disabled grid items-center gap-x-[1px] rounded-md p-[1px]",
|
|
257
|
+
className
|
|
258
|
+
),
|
|
259
|
+
style: {
|
|
260
|
+
gridTemplateColumns: `repeat(${options.length}, 1fr)`
|
|
261
|
+
},
|
|
262
|
+
children: options.map((option) => {
|
|
263
|
+
const isSelected = value === option.value;
|
|
264
|
+
return /* @__PURE__ */ jsx2(
|
|
265
|
+
Button,
|
|
266
|
+
{
|
|
267
|
+
size: "small",
|
|
268
|
+
onClick: () => onValueChange(option.value),
|
|
269
|
+
variant: isSelected ? "secondary" : "transparent",
|
|
270
|
+
type: "button",
|
|
271
|
+
className: clx2(
|
|
272
|
+
"w-auto",
|
|
273
|
+
!isSelected && "hover:text-ui-fg-base text-ui-fg-muted"
|
|
274
|
+
),
|
|
275
|
+
children: option.label
|
|
276
|
+
},
|
|
277
|
+
option.value
|
|
278
|
+
);
|
|
279
|
+
})
|
|
280
|
+
}
|
|
281
|
+
);
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
// src/routes/translations/settings/components/selector-tree-filter/selector-tree-filter.tsx
|
|
285
|
+
import { useTranslation } from "react-i18next";
|
|
286
|
+
import { useState as useState2 } from "react";
|
|
287
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
288
|
+
var SelectorTreeFilter = ({
|
|
289
|
+
searchQuery,
|
|
290
|
+
onSearchChange,
|
|
291
|
+
viewMode,
|
|
292
|
+
onViewModeChange,
|
|
293
|
+
onSelectAllToggle,
|
|
294
|
+
initialAllSelected,
|
|
295
|
+
onSortToggle,
|
|
296
|
+
sortOrder,
|
|
297
|
+
onCollapseAll,
|
|
298
|
+
className
|
|
299
|
+
}) => {
|
|
300
|
+
const { t } = useTranslation();
|
|
301
|
+
const [allSelected, setAllSelected] = useState2(initialAllSelected);
|
|
302
|
+
const handleSelectAllToggle = () => {
|
|
303
|
+
setAllSelected((prev) => !prev);
|
|
304
|
+
onSelectAllToggle(!allSelected);
|
|
305
|
+
};
|
|
306
|
+
return /* @__PURE__ */ jsxs2("div", { className: clx3("flex items-center gap-x-2", className), children: [
|
|
307
|
+
/* @__PURE__ */ jsx3("div", { className: "flex-1", children: /* @__PURE__ */ jsx3(
|
|
308
|
+
Input,
|
|
309
|
+
{
|
|
310
|
+
size: "small",
|
|
311
|
+
type: "search",
|
|
312
|
+
placeholder: t("general.search"),
|
|
313
|
+
value: searchQuery,
|
|
314
|
+
onChange: (e) => onSearchChange(e.target.value),
|
|
315
|
+
className: "w-full"
|
|
316
|
+
}
|
|
317
|
+
) }),
|
|
318
|
+
/* @__PURE__ */ jsx3(
|
|
319
|
+
SegmentedControl,
|
|
320
|
+
{
|
|
321
|
+
value: viewMode,
|
|
322
|
+
onValueChange: (value) => onViewModeChange(value),
|
|
323
|
+
options: [
|
|
324
|
+
{ value: "full", label: t("general.fullList") },
|
|
325
|
+
{ value: "selected", label: t("general.selected") }
|
|
326
|
+
]
|
|
327
|
+
}
|
|
328
|
+
),
|
|
329
|
+
/* @__PURE__ */ jsx3(
|
|
330
|
+
Button2,
|
|
331
|
+
{
|
|
332
|
+
onClick: handleSelectAllToggle,
|
|
333
|
+
size: "small",
|
|
334
|
+
variant: "secondary",
|
|
335
|
+
type: "button",
|
|
336
|
+
className: "min-w-[90px] whitespace-nowrap",
|
|
337
|
+
children: allSelected ? t("general.unselectAll") : t("general.selectAll")
|
|
338
|
+
}
|
|
339
|
+
),
|
|
340
|
+
/* @__PURE__ */ jsx3(
|
|
341
|
+
Tooltip,
|
|
342
|
+
{
|
|
343
|
+
content: sortOrder === "desc" ? t("filters.sorting.alphabeticallyAsc") : t("filters.sorting.alphabeticallyDesc"),
|
|
344
|
+
children: /* @__PURE__ */ jsx3(IconButton, { size: "small", onClick: onSortToggle, type: "button", children: /* @__PURE__ */ jsx3(DescendingSorting, {}) })
|
|
345
|
+
}
|
|
346
|
+
),
|
|
347
|
+
/* @__PURE__ */ jsx3(Tooltip, { content: t("filters.collapse.all"), children: /* @__PURE__ */ jsx3(IconButton, { size: "small", onClick: onCollapseAll, type: "button", children: /* @__PURE__ */ jsx3(Collapse, {}) }) })
|
|
348
|
+
] });
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
// src/routes/translations/settings/components/batch-translation-settings-form/batch-translation-settings-form.tsx
|
|
352
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
353
|
+
var BatchTranslationSettingsSchema = zod.object({
|
|
354
|
+
selectedFields: zod.array(zod.string())
|
|
355
|
+
});
|
|
356
|
+
var format = (value) => {
|
|
357
|
+
return value.split("_").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
358
|
+
};
|
|
359
|
+
var transformSettingsToEntities = (translationSettings) => {
|
|
360
|
+
return Object.entries(translationSettings).map(([entityType, settings]) => {
|
|
361
|
+
const allFields = [
|
|
362
|
+
.../* @__PURE__ */ new Set([...settings.fields, ...settings.inactive_fields])
|
|
363
|
+
];
|
|
364
|
+
const fields = allFields.map((fieldName) => ({
|
|
365
|
+
id: fieldName,
|
|
366
|
+
name: format(fieldName),
|
|
367
|
+
selected: settings.fields.includes(fieldName)
|
|
368
|
+
}));
|
|
369
|
+
return {
|
|
370
|
+
id: entityType,
|
|
371
|
+
name: format(entityType),
|
|
372
|
+
fields: fields.length > 0 ? fields : void 0,
|
|
373
|
+
selected: settings.is_active
|
|
374
|
+
};
|
|
375
|
+
});
|
|
376
|
+
};
|
|
377
|
+
var transformSelectedFieldsToBatchRequest = (selectedFields, translationSettings) => {
|
|
378
|
+
const create = [];
|
|
379
|
+
const update = [];
|
|
380
|
+
const entitySelections = /* @__PURE__ */ new Map();
|
|
381
|
+
selectedFields.forEach((field) => {
|
|
382
|
+
const [entityType, fieldName] = field.split(".", 2);
|
|
383
|
+
if (!entitySelections.has(entityType)) {
|
|
384
|
+
entitySelections.set(entityType, /* @__PURE__ */ new Set());
|
|
385
|
+
}
|
|
386
|
+
entitySelections.get(entityType).add(fieldName);
|
|
387
|
+
});
|
|
388
|
+
Object.entries(translationSettings).forEach(([entityType, settings]) => {
|
|
389
|
+
const selectedFields2 = entitySelections.get(entityType) || /* @__PURE__ */ new Set();
|
|
390
|
+
const selectedFieldsArray = Array.from(selectedFields2);
|
|
391
|
+
const hasSelectedFields = selectedFields2.size > 0;
|
|
392
|
+
const exists = !!settings.id;
|
|
393
|
+
if (exists) {
|
|
394
|
+
update.push({
|
|
395
|
+
id: settings.id,
|
|
396
|
+
fields: selectedFieldsArray,
|
|
397
|
+
is_active: hasSelectedFields ? true : false
|
|
398
|
+
});
|
|
399
|
+
} else {
|
|
400
|
+
if (hasSelectedFields) {
|
|
401
|
+
create.push({
|
|
402
|
+
entity_type: entityType,
|
|
403
|
+
fields: selectedFieldsArray
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
return {
|
|
409
|
+
create: create.length > 0 ? create : void 0,
|
|
410
|
+
update: update.length > 0 ? update : void 0
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
var BatchTranslationSettingsForm = ({
|
|
414
|
+
translation_settings
|
|
415
|
+
}) => {
|
|
416
|
+
const { t } = useTranslation2();
|
|
417
|
+
const { handleSuccess } = useRouteModal();
|
|
418
|
+
const [searchQuery, setSearchQuery] = useState3("");
|
|
419
|
+
const [viewMode, setViewMode] = useState3("full");
|
|
420
|
+
const [sortOrder, setSortOrder] = useState3("asc");
|
|
421
|
+
const treeRef = useRef(null);
|
|
422
|
+
const { mutateAsync, isPending: isMutating } = useBatchTranslationSettings();
|
|
423
|
+
const entities = useMemo2(() => {
|
|
424
|
+
if (!translation_settings) {
|
|
425
|
+
return [];
|
|
426
|
+
}
|
|
427
|
+
return transformSettingsToEntities(translation_settings);
|
|
428
|
+
}, [translation_settings]);
|
|
429
|
+
const initialSelectedIds = useMemo2(() => {
|
|
430
|
+
if (!translation_settings) {
|
|
431
|
+
return [];
|
|
432
|
+
}
|
|
433
|
+
const selected = [];
|
|
434
|
+
Object.entries(translation_settings).forEach(([entityType, settings]) => {
|
|
435
|
+
settings.fields.forEach((fieldName) => {
|
|
436
|
+
selected.push(`${entityType}.${fieldName}`);
|
|
437
|
+
});
|
|
438
|
+
});
|
|
439
|
+
return selected;
|
|
440
|
+
}, [translation_settings]);
|
|
441
|
+
const inactiveEntities = useMemo2(() => {
|
|
442
|
+
return entities.filter((entity) => !entity.selected);
|
|
443
|
+
}, [entities]);
|
|
444
|
+
const form = useForm({
|
|
445
|
+
defaultValues: {
|
|
446
|
+
selectedFields: initialSelectedIds
|
|
447
|
+
},
|
|
448
|
+
resolver: zodResolver(BatchTranslationSettingsSchema)
|
|
449
|
+
});
|
|
450
|
+
const handleSelectionChange = (newSelectedIds) => {
|
|
451
|
+
form.setValue("selectedFields", Array.from(newSelectedIds), {
|
|
452
|
+
shouldDirty: true
|
|
453
|
+
});
|
|
454
|
+
};
|
|
455
|
+
const handleSelectAllToggle = (selected) => {
|
|
456
|
+
treeRef.current?.selectAllToggle(selected);
|
|
457
|
+
};
|
|
458
|
+
const handleCollapseAll = () => {
|
|
459
|
+
treeRef.current?.collapseAll();
|
|
460
|
+
};
|
|
461
|
+
const handleSortToggle = () => {
|
|
462
|
+
setSortOrder((prev) => prev === "asc" ? "desc" : "asc");
|
|
463
|
+
};
|
|
464
|
+
const handleSubmit = form.handleSubmit(async (data) => {
|
|
465
|
+
const batchRequest = transformSelectedFieldsToBatchRequest(
|
|
466
|
+
data.selectedFields,
|
|
467
|
+
translation_settings
|
|
468
|
+
);
|
|
469
|
+
if (batchRequest.create || batchRequest.update) {
|
|
470
|
+
await mutateAsync(batchRequest, {
|
|
471
|
+
onSuccess: () => {
|
|
472
|
+
toast.success(t("translations.settings.successToast"));
|
|
473
|
+
handleSuccess();
|
|
474
|
+
},
|
|
475
|
+
onError: (error) => {
|
|
476
|
+
toast.error(error.message);
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
} else {
|
|
480
|
+
handleSuccess();
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
return /* @__PURE__ */ jsx4(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs3(
|
|
484
|
+
KeyboundForm,
|
|
485
|
+
{
|
|
486
|
+
onSubmit: handleSubmit,
|
|
487
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
488
|
+
children: [
|
|
489
|
+
/* @__PURE__ */ jsxs3(RouteDrawer.Body, { className: "p-0", children: [
|
|
490
|
+
/* @__PURE__ */ jsx4("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsx4(
|
|
491
|
+
SelectorTreeFilter,
|
|
492
|
+
{
|
|
493
|
+
sortOrder,
|
|
494
|
+
searchQuery,
|
|
495
|
+
onSearchChange: setSearchQuery,
|
|
496
|
+
viewMode,
|
|
497
|
+
onViewModeChange: setViewMode,
|
|
498
|
+
onSelectAllToggle: handleSelectAllToggle,
|
|
499
|
+
initialAllSelected: inactiveEntities.length === 0,
|
|
500
|
+
onSortToggle: handleSortToggle,
|
|
501
|
+
onCollapseAll: handleCollapseAll
|
|
502
|
+
}
|
|
503
|
+
) }),
|
|
504
|
+
/* @__PURE__ */ jsx4(Divider2, {}),
|
|
505
|
+
/* @__PURE__ */ jsx4("div", { className: "bg-ui-bg-component h-full px-6 pb-6 pt-4", children: /* @__PURE__ */ jsx4(
|
|
506
|
+
EntitySelectorTree,
|
|
507
|
+
{
|
|
508
|
+
ref: treeRef,
|
|
509
|
+
entities,
|
|
510
|
+
onSelectionChange: handleSelectionChange,
|
|
511
|
+
searchQuery,
|
|
512
|
+
viewMode,
|
|
513
|
+
sortOrder
|
|
514
|
+
}
|
|
515
|
+
) })
|
|
516
|
+
] }),
|
|
517
|
+
/* @__PURE__ */ jsx4(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-x-2", children: [
|
|
518
|
+
/* @__PURE__ */ jsx4(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx4(Button3, { variant: "secondary", size: "small", children: t("actions.cancel") }) }),
|
|
519
|
+
/* @__PURE__ */ jsx4(Button3, { size: "small", type: "submit", isLoading: isMutating, children: t("actions.save") })
|
|
520
|
+
] }) })
|
|
521
|
+
]
|
|
522
|
+
}
|
|
523
|
+
) });
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
// src/routes/translations/settings/settings.tsx
|
|
527
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
528
|
+
var Settings = () => {
|
|
529
|
+
const { translation_settings, isPending, isError, error } = useTranslationSettings();
|
|
530
|
+
if (isError) {
|
|
531
|
+
throw error;
|
|
532
|
+
}
|
|
533
|
+
return /* @__PURE__ */ jsxs4(RouteDrawer, { children: [
|
|
534
|
+
/* @__PURE__ */ jsx5(RouteDrawer.Header, { children: /* @__PURE__ */ jsx5(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx5(Heading, { children: "Manage translatable entities" }) }) }),
|
|
535
|
+
isPending ? /* @__PURE__ */ jsx5(RouteDrawer.Body, { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx5(Spinner, { className: "animate-spin" }) }) : translation_settings && /* @__PURE__ */ jsx5(
|
|
536
|
+
BatchTranslationSettingsForm,
|
|
537
|
+
{
|
|
538
|
+
translation_settings
|
|
539
|
+
}
|
|
540
|
+
)
|
|
541
|
+
] });
|
|
542
|
+
};
|
|
543
|
+
export {
|
|
544
|
+
Settings as Component
|
|
545
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import {
|
|
2
|
+
retrieveActiveStore,
|
|
3
|
+
storeQueryKeys,
|
|
4
|
+
useStore
|
|
5
|
+
} from "./chunk-OHAFITSB.mjs";
|
|
6
|
+
import {
|
|
7
|
+
SingleColumnPage
|
|
8
|
+
} from "./chunk-22YYMH6M.mjs";
|
|
9
|
+
import {
|
|
10
|
+
useExtension
|
|
11
|
+
} from "./chunk-C5P5PL3E.mjs";
|
|
12
|
+
import {
|
|
13
|
+
SingleColumnPageSkeleton
|
|
14
|
+
} from "./chunk-ITNQKZQQ.mjs";
|
|
15
|
+
import {
|
|
16
|
+
ActionMenu
|
|
17
|
+
} from "./chunk-S3REQHPQ.mjs";
|
|
18
|
+
import "./chunk-OAHCJFG3.mjs";
|
|
19
|
+
import "./chunk-S4DMV3ZT.mjs";
|
|
20
|
+
import {
|
|
21
|
+
queryClient
|
|
22
|
+
} from "./chunk-FXYH54JP.mjs";
|
|
23
|
+
import "./chunk-774WSTCC.mjs";
|
|
24
|
+
import "./chunk-DTY37DDZ.mjs";
|
|
25
|
+
import "./chunk-QZ7TP4HQ.mjs";
|
|
26
|
+
|
|
27
|
+
// src/routes/store/store-detail/loader.ts
|
|
28
|
+
var storeDetailQuery = () => ({
|
|
29
|
+
queryKey: storeQueryKeys.details(),
|
|
30
|
+
queryFn: async () => retrieveActiveStore()
|
|
31
|
+
});
|
|
32
|
+
var storeLoader = async () => {
|
|
33
|
+
const query = storeDetailQuery();
|
|
34
|
+
return queryClient.getQueryData(query.queryKey) ?? await queryClient.fetchQuery(query);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// src/routes/store/store-detail/store-detail.tsx
|
|
38
|
+
import { useLoaderData } from "react-router-dom";
|
|
39
|
+
|
|
40
|
+
// src/routes/store/store-detail/components/store-general-section/store-general-section.tsx
|
|
41
|
+
import { PencilSquare } from "@acmekit/icons";
|
|
42
|
+
import { Container, Heading, Text } from "@acmekit/ui";
|
|
43
|
+
import { useTranslation } from "react-i18next";
|
|
44
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
45
|
+
var StoreGeneralSection = ({ store }) => {
|
|
46
|
+
const { t } = useTranslation();
|
|
47
|
+
return /* @__PURE__ */ jsxs(Container, { className: "divide-y p-0", children: [
|
|
48
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 py-4", children: [
|
|
49
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
50
|
+
/* @__PURE__ */ jsx(Heading, { children: t("store.domain") }),
|
|
51
|
+
/* @__PURE__ */ jsx(Text, { className: "text-ui-fg-subtle", size: "small", children: t("store.manageYourStoresDetails") })
|
|
52
|
+
] }),
|
|
53
|
+
/* @__PURE__ */ jsx(
|
|
54
|
+
ActionMenu,
|
|
55
|
+
{
|
|
56
|
+
groups: [
|
|
57
|
+
{
|
|
58
|
+
actions: [
|
|
59
|
+
{
|
|
60
|
+
icon: /* @__PURE__ */ jsx(PencilSquare, {}),
|
|
61
|
+
label: t("actions.edit"),
|
|
62
|
+
to: "edit"
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
] }),
|
|
70
|
+
/* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle grid grid-cols-2 px-6 py-4", children: [
|
|
71
|
+
/* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", weight: "plus", children: t("fields.name") }),
|
|
72
|
+
/* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: store.name })
|
|
73
|
+
] })
|
|
74
|
+
] });
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// src/routes/store/store-detail/store-detail.tsx
|
|
78
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
79
|
+
var StoreDetail = () => {
|
|
80
|
+
const initialData = useLoaderData();
|
|
81
|
+
const { store, isPending, isError, error } = useStore(void 0, {
|
|
82
|
+
initialData
|
|
83
|
+
});
|
|
84
|
+
const { getWidgets } = useExtension();
|
|
85
|
+
if (isPending || !store) {
|
|
86
|
+
return /* @__PURE__ */ jsx2(SingleColumnPageSkeleton, { sections: 1, showJSON: true, showMetadata: true });
|
|
87
|
+
}
|
|
88
|
+
if (isError) {
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
return /* @__PURE__ */ jsx2(
|
|
92
|
+
SingleColumnPage,
|
|
93
|
+
{
|
|
94
|
+
widgets: {
|
|
95
|
+
before: getWidgets("store.details.before"),
|
|
96
|
+
after: getWidgets("store.details.after")
|
|
97
|
+
},
|
|
98
|
+
data: store,
|
|
99
|
+
hasOutlet: true,
|
|
100
|
+
showMetadata: true,
|
|
101
|
+
showJSON: true,
|
|
102
|
+
children: /* @__PURE__ */ jsx2(StoreGeneralSection, { store })
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
export {
|
|
107
|
+
StoreDetail as Component,
|
|
108
|
+
storeLoader as loader
|
|
109
|
+
};
|