@declarion/react 0.359.0 → 0.366.0
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-lib/api/access-expiry.js +17 -17
- package/dist-lib/api/session-renewal.js +6 -5
- package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +78 -75
- package/dist-lib/components/params/param-editors.js +54 -53
- package/dist-lib/components/shared/LucideIcon.js +5 -1
- package/package.json +1 -1
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
// src/api/access-expiry.ts
|
|
2
|
-
var e = "declarion.auth.access.expiry";
|
|
3
|
-
function
|
|
2
|
+
var e = "declarion.auth.access.expiry", t = 6e4;
|
|
3
|
+
function n(t) {
|
|
4
4
|
if (t && !Number.isNaN(Date.parse(t))) try {
|
|
5
5
|
window.localStorage.setItem(e, t);
|
|
6
6
|
} catch {
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function r() {
|
|
11
11
|
try {
|
|
12
12
|
window.localStorage.removeItem(e);
|
|
13
13
|
} catch {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
var
|
|
18
|
-
function
|
|
17
|
+
var i = "declarion.auth.signed_out";
|
|
18
|
+
function a() {
|
|
19
19
|
try {
|
|
20
|
-
window.localStorage.setItem(
|
|
20
|
+
window.localStorage.setItem(i, "1");
|
|
21
21
|
} catch {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function o() {
|
|
26
26
|
try {
|
|
27
|
-
window.localStorage.removeItem(
|
|
27
|
+
window.localStorage.removeItem(i);
|
|
28
28
|
} catch {
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function s() {
|
|
33
33
|
try {
|
|
34
|
-
return window.localStorage.getItem(
|
|
34
|
+
return window.localStorage.getItem(i) === "1";
|
|
35
35
|
} catch {
|
|
36
36
|
return !1;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function c() {
|
|
40
40
|
try {
|
|
41
41
|
let t = Date.parse(window.localStorage.getItem(e) ?? "");
|
|
42
42
|
return Number.isNaN(t) ? null : t;
|
|
@@ -44,11 +44,11 @@ function s() {
|
|
|
44
44
|
return null;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
var
|
|
48
|
-
function
|
|
49
|
-
return n ? "first-wave" : e === null ? "probe-first" : e > t ? "first-wave" : "refresh-first";
|
|
47
|
+
var l = "/login/sso-callback";
|
|
48
|
+
function u(e, t, n = !1) {
|
|
49
|
+
return n ? "first-wave" : e === null ? "probe-first" : e - 6e4 > t ? "first-wave" : "refresh-first";
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
return
|
|
51
|
+
function d() {
|
|
52
|
+
return u(c(), Date.now(), window.location.pathname === l);
|
|
53
53
|
}
|
|
54
|
-
export {
|
|
54
|
+
export { t as PROACTIVE_REFRESH_MARGIN_MS, l as SSO_RETURN_PATH, r as clearAccessExpiry, o as clearSignOut, n as recordAccessExpiry, a as recordSignOut, s as signedOutExplicitly, u as startOrder, d as startOrderNow };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { RefreshDeadError as e, ensureRefresh as t, getPersistentAuthFailureHandler as n } from "./client.js";
|
|
2
2
|
import { backoffDelayMs as r } from "./request-bounds.js";
|
|
3
|
-
import {
|
|
3
|
+
import { PROACTIVE_REFRESH_MARGIN_MS as i } from "./access-expiry.js";
|
|
4
|
+
import { isEmbedTokenMode as a } from "../embed/token.js";
|
|
4
5
|
// src/api/session-renewal.ts
|
|
5
|
-
var
|
|
6
|
+
var o = 5e3, s = null, c = null, l = 0, u = !1;
|
|
6
7
|
function d() {
|
|
7
8
|
s && clearTimeout(s), s = null;
|
|
8
9
|
}
|
|
@@ -12,7 +13,7 @@ function f(e) {
|
|
|
12
13
|
}, e);
|
|
13
14
|
}
|
|
14
15
|
function p() {
|
|
15
|
-
u ||
|
|
16
|
+
u || a() || (d(), u = !0, t().catch((t) => {
|
|
16
17
|
t instanceof e ? n()() : c !== null && f(r(l++));
|
|
17
18
|
}).finally(() => {
|
|
18
19
|
u = !1;
|
|
@@ -21,7 +22,7 @@ function p() {
|
|
|
21
22
|
function m(e) {
|
|
22
23
|
h();
|
|
23
24
|
let t = e ? Date.parse(e) : NaN;
|
|
24
|
-
Number.isNaN(t) || (c = t, f(Math.max(t - Date.now() -
|
|
25
|
+
Number.isNaN(t) || (c = t, f(Math.max(t - Date.now() - i, o)));
|
|
25
26
|
}
|
|
26
27
|
function h() {
|
|
27
28
|
d(), c = null, l = 0;
|
|
@@ -32,4 +33,4 @@ function g() {
|
|
|
32
33
|
document.addEventListener("visibilitychange", () => {
|
|
33
34
|
document.visibilityState === "visible" && g();
|
|
34
35
|
}), document.addEventListener("resume", g), window.addEventListener("pageshow", g), window.addEventListener("online", g);
|
|
35
|
-
export {
|
|
36
|
+
export { h as cancelRenewal, m as scheduleRenewal };
|
|
@@ -6,10 +6,10 @@ import { Select as i, TextInput as a } from "../../primitives/Fields.js";
|
|
|
6
6
|
import { BoolToggle as o } from "../../primitives/BoolToggle.js";
|
|
7
7
|
import { useAllParams as ee, useCarrierParamOverrides as s } from "../../../hooks/useParams.js";
|
|
8
8
|
import { useAuthStore as c } from "../../../stores/auth.js";
|
|
9
|
-
import { EditParamDialog as te, ErrorLine as l, ResetParamControl as u, ValuePreview as
|
|
10
|
-
import { useResponsiveMode as
|
|
11
|
-
import { PageHeader as
|
|
12
|
-
import { PageShell as
|
|
9
|
+
import { EditParamDialog as te, ErrorLine as l, ResetParamControl as u, ValuePreview as d, paramTenantEditable as f, useParamRefLabels as p } from "../../params/param-editors.js";
|
|
10
|
+
import { useResponsiveMode as m } from "../../../hooks/useResponsiveMode.js";
|
|
11
|
+
import { PageHeader as h } from "../../chrome/PageHeader.js";
|
|
12
|
+
import { PageShell as ne } from "../../chrome/PageShell.js";
|
|
13
13
|
import { dataTableCellStyle as g, dataTableHeadCellStyle as _, dataTableStyle as v } from "../../primitives/dataTableStyles.js";
|
|
14
14
|
import { useText as y } from "../../../hooks/useText.js";
|
|
15
15
|
import { useSchema as b } from "../../../hooks/useSchema.js";
|
|
@@ -17,87 +17,91 @@ import { useDeclaredEnum as x } from "../../../hooks/useDeclaredEnum.js";
|
|
|
17
17
|
import { useMemo as S, useState as C } from "react";
|
|
18
18
|
import { jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
19
19
|
// src/components/pages/tenant-params/TenantParamsPage.impl.tsx
|
|
20
|
-
var
|
|
20
|
+
var re = "my_tenant";
|
|
21
|
+
function E(e) {
|
|
22
|
+
return e.split(/(?<=[_.])/).map((e, t) => t === 0 ? e : /* @__PURE__ */ T("span", { children: [/* @__PURE__ */ w("wbr", {}), e] }, t));
|
|
23
|
+
}
|
|
24
|
+
var ie = [
|
|
21
25
|
"yaml",
|
|
22
26
|
"env",
|
|
23
27
|
"tenant"
|
|
24
|
-
],
|
|
28
|
+
], ae = [
|
|
25
29
|
"29%",
|
|
26
30
|
"12%",
|
|
27
31
|
"11%",
|
|
28
32
|
"21%",
|
|
29
33
|
"13%",
|
|
30
34
|
"14%"
|
|
31
|
-
],
|
|
35
|
+
], D = {
|
|
32
36
|
...g,
|
|
33
37
|
overflow: "hidden",
|
|
34
38
|
textOverflow: "ellipsis",
|
|
35
39
|
whiteSpace: "nowrap"
|
|
36
|
-
},
|
|
40
|
+
}, oe = {
|
|
37
41
|
...g,
|
|
38
42
|
whiteSpace: "nowrap",
|
|
39
43
|
textAlign: "right"
|
|
40
44
|
};
|
|
41
|
-
function
|
|
42
|
-
let t = y(), n = x("param_source").valueOf, u = x("field_type").valueOf,
|
|
43
|
-
carrierEntityCode:
|
|
44
|
-
rowId:
|
|
45
|
-
}),
|
|
46
|
-
await
|
|
47
|
-
},
|
|
48
|
-
let e = new Map((
|
|
45
|
+
function O(e) {
|
|
46
|
+
let t = y(), n = x("param_source").valueOf, u = x("field_type").valueOf, f = y("errors"), O = c((e) => e.activeTenant?.id) ?? "", { isPhone: j } = m(), M = ee("tenant"), [N, P] = C(""), [F, I] = C(""), [L, R] = C(""), [z, B] = C(!1), [V, H] = C(null), { overrideByCode: U, missingParams: W, isLoading: G, retry: K, error: q, clearError: J, save: se, reset: ce } = s({
|
|
47
|
+
carrierEntityCode: re,
|
|
48
|
+
rowId: O
|
|
49
|
+
}), le = async (e, t) => {
|
|
50
|
+
await se(e, t) && H((t) => t === e ? null : t);
|
|
51
|
+
}, Y = S(() => M.data?.params ?? [], [M.data]), { data: X } = b(), Z = S(() => {
|
|
52
|
+
let e = new Map((X?.enums?.parameter_category?.values ?? []).map((e) => [e.code, t(e.name) || e.code]));
|
|
49
53
|
return (t) => t ? e.get(t) ?? t : "";
|
|
50
|
-
}, [
|
|
54
|
+
}, [X, t]), ue = S(() => Array.from(new Set(Y.map((e) => e.category).filter(Boolean))).map((e) => ({
|
|
51
55
|
value: e,
|
|
52
|
-
label:
|
|
56
|
+
label: Z(e)
|
|
53
57
|
})).sort((e, n) => e.label.localeCompare(n.label, t.language)), [
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
Y,
|
|
59
|
+
Z,
|
|
56
60
|
t.language
|
|
57
|
-
]),
|
|
58
|
-
let e =
|
|
59
|
-
return
|
|
61
|
+
]), Q = S(() => {
|
|
62
|
+
let e = N.trim().toLowerCase();
|
|
63
|
+
return Y.filter((n) => !(F && n.category !== F || L && n.source !== L || z && !U.has(n.code) || e && !`${n.code} ${t(n.name)}`.toLowerCase().includes(e))).sort((e, n) => (t(e.name) || e.code).localeCompare(t(n.name) || n.code, t.language) || e.code.localeCompare(n.code));
|
|
60
64
|
}, [
|
|
61
65
|
t,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
]),
|
|
69
|
-
let t =
|
|
66
|
+
Y,
|
|
67
|
+
N,
|
|
68
|
+
F,
|
|
69
|
+
L,
|
|
70
|
+
z,
|
|
71
|
+
U
|
|
72
|
+
]), de = M.isLoading || G, fe = p(Y, M.data?.refs), $ = Q.map((e) => {
|
|
73
|
+
let t = U.get(e.code);
|
|
70
74
|
return {
|
|
71
75
|
param: e,
|
|
72
|
-
state: /* @__PURE__ */ w(
|
|
76
|
+
state: /* @__PURE__ */ w(k, {
|
|
73
77
|
param: e,
|
|
74
78
|
override: t
|
|
75
79
|
}),
|
|
76
|
-
value: /* @__PURE__ */ w(
|
|
80
|
+
value: /* @__PURE__ */ w(d, {
|
|
77
81
|
type: e.type,
|
|
78
82
|
value: e.value,
|
|
79
83
|
values: e.values,
|
|
80
84
|
structure: e.structure,
|
|
81
|
-
label:
|
|
85
|
+
label: fe(e),
|
|
82
86
|
maxWidth: "100%"
|
|
83
87
|
}),
|
|
84
|
-
actions: /* @__PURE__ */ w(
|
|
88
|
+
actions: /* @__PURE__ */ w(A, {
|
|
85
89
|
param: e,
|
|
86
90
|
stored: t !== void 0,
|
|
87
91
|
onEdit: () => {
|
|
88
|
-
|
|
92
|
+
J(), H(e);
|
|
89
93
|
},
|
|
90
|
-
onReset: (e) => void
|
|
94
|
+
onReset: (e) => void ce(e)
|
|
91
95
|
})
|
|
92
96
|
};
|
|
93
97
|
});
|
|
94
|
-
return /* @__PURE__ */ T(
|
|
95
|
-
header: /* @__PURE__ */ w(
|
|
98
|
+
return /* @__PURE__ */ T(ne, {
|
|
99
|
+
header: /* @__PURE__ */ w(h, { description: t("params.tenant.subtitle", "Tenant configuration. Editing a value stores a tenant override; Reset restores the platform default.") }),
|
|
96
100
|
children: [
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
text:
|
|
100
|
-
onRetry:
|
|
101
|
+
q && /* @__PURE__ */ w(l, { text: q }),
|
|
102
|
+
W && /* @__PURE__ */ w(l, {
|
|
103
|
+
text: f("param.overrides_unreadable", "The current parameter overrides could not be read."),
|
|
104
|
+
onRetry: K
|
|
101
105
|
}),
|
|
102
106
|
/* @__PURE__ */ T("div", {
|
|
103
107
|
"data-testid": "tenant-params-filters",
|
|
@@ -114,34 +118,34 @@ function A(e) {
|
|
|
114
118
|
flex: 1
|
|
115
119
|
},
|
|
116
120
|
children: /* @__PURE__ */ w(a, {
|
|
117
|
-
value:
|
|
118
|
-
onChange:
|
|
121
|
+
value: N,
|
|
122
|
+
onChange: P,
|
|
119
123
|
placeholder: t("params.search", "Search name or code…")
|
|
120
124
|
})
|
|
121
125
|
}),
|
|
122
126
|
/* @__PURE__ */ w("div", {
|
|
123
127
|
style: { minWidth: 160 },
|
|
124
128
|
children: /* @__PURE__ */ w(i, {
|
|
125
|
-
value:
|
|
129
|
+
value: F,
|
|
126
130
|
options: [{
|
|
127
131
|
value: "",
|
|
128
132
|
label: t("params.filter.all_categories", "All categories")
|
|
129
|
-
}, ...
|
|
130
|
-
onChange:
|
|
133
|
+
}, ...ue],
|
|
134
|
+
onChange: I
|
|
131
135
|
})
|
|
132
136
|
}),
|
|
133
137
|
/* @__PURE__ */ w("div", {
|
|
134
138
|
style: { minWidth: 140 },
|
|
135
139
|
children: /* @__PURE__ */ w(i, {
|
|
136
|
-
value:
|
|
140
|
+
value: L,
|
|
137
141
|
options: [{
|
|
138
142
|
value: "",
|
|
139
143
|
label: t("params.filter.all_sources", "All sources")
|
|
140
|
-
}, ...
|
|
144
|
+
}, ...ie.map((e) => ({
|
|
141
145
|
value: e,
|
|
142
146
|
label: n(e).label
|
|
143
147
|
}))],
|
|
144
|
-
onChange:
|
|
148
|
+
onChange: R
|
|
145
149
|
})
|
|
146
150
|
}),
|
|
147
151
|
/* @__PURE__ */ T("label", {
|
|
@@ -152,13 +156,13 @@ function A(e) {
|
|
|
152
156
|
fontSize: 12
|
|
153
157
|
},
|
|
154
158
|
children: [/* @__PURE__ */ w(o, {
|
|
155
|
-
value:
|
|
156
|
-
onChange:
|
|
159
|
+
value: z,
|
|
160
|
+
onChange: B
|
|
157
161
|
}), t("params.filter.overridden_only", "Overridden only")]
|
|
158
162
|
})
|
|
159
163
|
]
|
|
160
164
|
}),
|
|
161
|
-
|
|
165
|
+
de ? /* @__PURE__ */ w("div", {
|
|
162
166
|
style: {
|
|
163
167
|
padding: "24px 0",
|
|
164
168
|
textAlign: "center"
|
|
@@ -172,7 +176,7 @@ function A(e) {
|
|
|
172
176
|
fontSize: 12.5
|
|
173
177
|
},
|
|
174
178
|
children: t("params.empty", "No parameters match.")
|
|
175
|
-
}) :
|
|
179
|
+
}) : j ? /* @__PURE__ */ w("div", {
|
|
176
180
|
"data-testid": "tenant-params-cards",
|
|
177
181
|
style: {
|
|
178
182
|
display: "flex",
|
|
@@ -218,7 +222,7 @@ function A(e) {
|
|
|
218
222
|
color: "var(--text-3)",
|
|
219
223
|
overflowWrap: "anywhere"
|
|
220
224
|
},
|
|
221
|
-
children: e.code
|
|
225
|
+
children: E(e.code)
|
|
222
226
|
}),
|
|
223
227
|
/* @__PURE__ */ w("div", {
|
|
224
228
|
style: { minWidth: 0 },
|
|
@@ -237,7 +241,7 @@ function A(e) {
|
|
|
237
241
|
fontSize: 11.5,
|
|
238
242
|
color: "var(--text-3)"
|
|
239
243
|
},
|
|
240
|
-
children: [
|
|
244
|
+
children: [Z(e.category), u(e.type).label].filter(Boolean).join(" · ")
|
|
241
245
|
}), i]
|
|
242
246
|
})
|
|
243
247
|
]
|
|
@@ -256,7 +260,7 @@ function A(e) {
|
|
|
256
260
|
tableLayout: "fixed"
|
|
257
261
|
},
|
|
258
262
|
children: [
|
|
259
|
-
/* @__PURE__ */ w("colgroup", { children:
|
|
263
|
+
/* @__PURE__ */ w("colgroup", { children: ae.map((e, t) => /* @__PURE__ */ w("col", { style: { width: e } }, t)) }),
|
|
260
264
|
/* @__PURE__ */ w("thead", { children: /* @__PURE__ */ T("tr", { children: [
|
|
261
265
|
/* @__PURE__ */ w("th", {
|
|
262
266
|
style: _,
|
|
@@ -298,28 +302,27 @@ function A(e) {
|
|
|
298
302
|
fontSize: 11.5,
|
|
299
303
|
color: "var(--text-3)"
|
|
300
304
|
},
|
|
301
|
-
children: e.code
|
|
305
|
+
children: E(e.code)
|
|
302
306
|
})]
|
|
303
307
|
}),
|
|
304
308
|
/* @__PURE__ */ w("td", {
|
|
305
|
-
style:
|
|
306
|
-
|
|
307
|
-
children: Q(e.category) || "—"
|
|
309
|
+
style: g,
|
|
310
|
+
children: Z(e.category) || "—"
|
|
308
311
|
}),
|
|
309
312
|
/* @__PURE__ */ w("td", {
|
|
310
313
|
style: g,
|
|
311
314
|
children: u(e.type).label
|
|
312
315
|
}),
|
|
313
316
|
/* @__PURE__ */ w("td", {
|
|
314
|
-
style:
|
|
317
|
+
style: D,
|
|
315
318
|
children: r
|
|
316
319
|
}),
|
|
317
320
|
/* @__PURE__ */ w("td", {
|
|
318
|
-
style:
|
|
321
|
+
style: D,
|
|
319
322
|
children: n
|
|
320
323
|
}),
|
|
321
324
|
/* @__PURE__ */ w("td", {
|
|
322
|
-
style:
|
|
325
|
+
style: oe,
|
|
323
326
|
children: i
|
|
324
327
|
})
|
|
325
328
|
]
|
|
@@ -327,19 +330,19 @@ function A(e) {
|
|
|
327
330
|
]
|
|
328
331
|
})
|
|
329
332
|
}),
|
|
330
|
-
|
|
331
|
-
param:
|
|
332
|
-
current:
|
|
333
|
-
error:
|
|
333
|
+
V && /* @__PURE__ */ w(te, {
|
|
334
|
+
param: V,
|
|
335
|
+
current: U.get(V.code)?.value ?? V.value,
|
|
336
|
+
error: q,
|
|
334
337
|
onCancel: () => {
|
|
335
|
-
|
|
338
|
+
H(null), J();
|
|
336
339
|
},
|
|
337
|
-
onSave: (e) =>
|
|
340
|
+
onSave: (e) => le(V, e)
|
|
338
341
|
})
|
|
339
342
|
]
|
|
340
343
|
});
|
|
341
344
|
}
|
|
342
|
-
function
|
|
345
|
+
function k({ param: e, override: n }) {
|
|
343
346
|
let r = y(), i = x("param_source").valueOf(e.source);
|
|
344
347
|
return n !== void 0 && e.source !== "tenant" ? /* @__PURE__ */ w("span", {
|
|
345
348
|
"data-testid": `tenant-param-not-applied-${e.code}`,
|
|
@@ -359,9 +362,9 @@ function ie({ param: e, override: n }) {
|
|
|
359
362
|
children: i.label
|
|
360
363
|
});
|
|
361
364
|
}
|
|
362
|
-
function
|
|
365
|
+
function A({ param: t, stored: r, onEdit: i, onReset: a }) {
|
|
363
366
|
let o = y();
|
|
364
|
-
return
|
|
367
|
+
return f(t) ? /* @__PURE__ */ T("span", {
|
|
365
368
|
style: {
|
|
366
369
|
display: "inline-flex",
|
|
367
370
|
flexWrap: "wrap",
|
|
@@ -394,4 +397,4 @@ function j({ param: t, stored: r, onEdit: i, onReset: a }) {
|
|
|
394
397
|
]
|
|
395
398
|
});
|
|
396
399
|
}
|
|
397
|
-
export {
|
|
400
|
+
export { O as TenantParamsPage };
|
|
@@ -8,20 +8,21 @@ import { refLabel as o, useRefRecords as s } from "../../hooks/useRefRecords.js"
|
|
|
8
8
|
import { useSchema as c } from "../../hooks/useSchema.js";
|
|
9
9
|
import { renderField as l } from "../fields/index.js";
|
|
10
10
|
import { coerceDisplayString as u } from "../../lib/display-value.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
11
|
+
import { formatDecimalText as d } from "../../lib/decimal-text.js";
|
|
12
|
+
import { useText as f } from "../../hooks/useText.js";
|
|
13
|
+
import { RetryButton as p } from "../primitives/RetryButton.js";
|
|
14
|
+
import { useState as m } from "react";
|
|
15
|
+
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
15
16
|
// src/components/params/param-editors.tsx
|
|
16
|
-
var
|
|
17
|
-
function
|
|
18
|
-
let a =
|
|
19
|
-
return /* @__PURE__ */
|
|
17
|
+
var v = t["undo-2"];
|
|
18
|
+
function y({ param: t, description: n, onReset: r }) {
|
|
19
|
+
let a = f(), [o, s] = m(!1);
|
|
20
|
+
return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(e, {
|
|
20
21
|
size: "xs",
|
|
21
|
-
icon: /* @__PURE__ */
|
|
22
|
+
icon: /* @__PURE__ */ g(v, { size: 12 }),
|
|
22
23
|
onClick: () => s(!0),
|
|
23
24
|
children: a("params.reset", "Reset to default")
|
|
24
|
-
}), /* @__PURE__ */
|
|
25
|
+
}), /* @__PURE__ */ g(i, {
|
|
25
26
|
open: o,
|
|
26
27
|
onOpenChange: s,
|
|
27
28
|
title: a("params.reset_confirm.title", "Reset {name} to default?", { name: a(t.name) || t.code }),
|
|
@@ -30,8 +31,8 @@ function v({ param: t, description: n, onReset: r }) {
|
|
|
30
31
|
onConfirm: () => r(t)
|
|
31
32
|
})] });
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
-
return /* @__PURE__ */
|
|
34
|
+
function b({ text: e, onRetry: n }) {
|
|
35
|
+
return /* @__PURE__ */ _("div", {
|
|
35
36
|
style: {
|
|
36
37
|
padding: "8px 10px",
|
|
37
38
|
background: "var(--danger-soft)",
|
|
@@ -43,30 +44,30 @@ function y({ text: e, onRetry: n }) {
|
|
|
43
44
|
alignItems: "center"
|
|
44
45
|
},
|
|
45
46
|
children: [
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
n && /* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ g(t.info, { size: 13 }),
|
|
48
|
+
/* @__PURE__ */ g("span", { children: e }),
|
|
49
|
+
n && /* @__PURE__ */ g(p, { onRetry: n })
|
|
49
50
|
]
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
-
let n =
|
|
53
|
+
function x(e, t) {
|
|
54
|
+
let n = f(), { data: r } = c(), i = e.flatMap((e) => e.ref?.entity && e.value != null && e.value !== "" ? [{
|
|
54
55
|
ref: e.ref,
|
|
55
56
|
value: e.value
|
|
56
57
|
}] : []), { refs: a } = s(i, t, r?.entities);
|
|
57
58
|
return (e) => e.ref?.entity ? o(n, a, e.ref, e.value, r?.entities) : void 0;
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
-
let o =
|
|
60
|
+
function S({ type: e, value: t, values: n, structure: r, label: i, maxWidth: a = 180 }) {
|
|
61
|
+
let o = f(), { data: s } = c(), l = (e) => {
|
|
61
62
|
let t = n?.find((t) => t.code === e);
|
|
62
63
|
return t && o(t.name) || u(e);
|
|
63
|
-
},
|
|
64
|
+
}, p = (e) => {
|
|
64
65
|
let t = r ? s?.structures?.[r]?.fields : void 0;
|
|
65
66
|
return t ? [...t].filter(([t]) => t in e).map(([e, t]) => t.display ? o(t.display.name) : e).join(", ") || "—" : `{${Object.keys(e).join(", ")}}`;
|
|
66
|
-
},
|
|
67
|
-
return
|
|
67
|
+
}, m;
|
|
68
|
+
return m = i === void 0 ? t == null || t === "" ? "—" : n && n.length > 0 ? (Array.isArray(t) ? t.map(l).join(", ") : l(t)) || "—" : (e === "int" || e === "decimal") && (typeof t == "number" || typeof t == "string") ? d(String(t), new Intl.NumberFormat(o.language)) : e === "bool" ? t ? o("params.value.on", "On") : o("params.value.off", "Off") : e === "multilang" || e === "multilang_text" ? o(t) || "—" : e === "multilang_array" && Array.isArray(t) ? t.map((e) => o(e)).join(", ") || "—" : e === "json" || e === "structure" ? Array.isArray(t) ? `[${t.map((e) => e && typeof e == "object" ? "{…}" : u(e)).join(", ")}]` : t && typeof t == "object" ? p(t) : u(t) : u(t) : i, /* @__PURE__ */ g("span", {
|
|
68
69
|
className: "mono",
|
|
69
|
-
title:
|
|
70
|
+
title: m,
|
|
70
71
|
style: {
|
|
71
72
|
display: "inline-block",
|
|
72
73
|
verticalAlign: "middle",
|
|
@@ -77,16 +78,16 @@ function x({ type: e, value: t, values: n, structure: r, label: i, maxWidth: a =
|
|
|
77
78
|
textOverflow: "ellipsis",
|
|
78
79
|
whiteSpace: "nowrap"
|
|
79
80
|
},
|
|
80
|
-
children:
|
|
81
|
+
children: m
|
|
81
82
|
});
|
|
82
83
|
}
|
|
83
|
-
function
|
|
84
|
-
let u =
|
|
84
|
+
function C({ param: i, current: o, error: s, onCancel: c, onSave: l }) {
|
|
85
|
+
let u = f(), [d, p] = m(() => T(i, o)), [h, v] = m(!1), [y, x] = m(null);
|
|
85
86
|
async function S() {
|
|
86
87
|
x(null);
|
|
87
88
|
let e;
|
|
88
89
|
try {
|
|
89
|
-
e =
|
|
90
|
+
e = E(u, d);
|
|
90
91
|
} catch (e) {
|
|
91
92
|
x(String(e instanceof Error ? e.message : e));
|
|
92
93
|
return;
|
|
@@ -98,21 +99,21 @@ function S({ param: i, current: o, error: s, onCancel: c, onSave: l }) {
|
|
|
98
99
|
v(!1);
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
|
-
return /* @__PURE__ */
|
|
102
|
+
return /* @__PURE__ */ _(a, {
|
|
102
103
|
label: u(i.name) || i.code,
|
|
103
104
|
maxWidth: 440,
|
|
104
105
|
onClose: c,
|
|
105
106
|
testId: "param-edit-dialog",
|
|
106
107
|
children: [
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ _("div", {
|
|
108
109
|
style: { padding: "14px 18px 0" },
|
|
109
|
-
children: [/* @__PURE__ */
|
|
110
|
+
children: [/* @__PURE__ */ g("div", {
|
|
110
111
|
style: {
|
|
111
112
|
fontSize: 14,
|
|
112
113
|
fontWeight: 600
|
|
113
114
|
},
|
|
114
115
|
children: u(i.name) || i.code
|
|
115
|
-
}), i.description && /* @__PURE__ */
|
|
116
|
+
}), i.description && /* @__PURE__ */ g("div", {
|
|
116
117
|
style: {
|
|
117
118
|
fontSize: 11.5,
|
|
118
119
|
color: "var(--text-3)",
|
|
@@ -121,7 +122,7 @@ function S({ param: i, current: o, error: s, onCancel: c, onSave: l }) {
|
|
|
121
122
|
children: u(i.description)
|
|
122
123
|
})]
|
|
123
124
|
}),
|
|
124
|
-
/* @__PURE__ */
|
|
125
|
+
/* @__PURE__ */ _("div", {
|
|
125
126
|
style: {
|
|
126
127
|
padding: "12px 18px 16px",
|
|
127
128
|
display: "flex",
|
|
@@ -130,16 +131,16 @@ function S({ param: i, current: o, error: s, onCancel: c, onSave: l }) {
|
|
|
130
131
|
overflowY: "auto"
|
|
131
132
|
},
|
|
132
133
|
children: [
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
/* @__PURE__ */
|
|
134
|
+
/* @__PURE__ */ g(n, { children: u("params.value", "Value") }),
|
|
135
|
+
/* @__PURE__ */ g(w, {
|
|
135
136
|
param: i,
|
|
136
|
-
value:
|
|
137
|
-
onChange:
|
|
137
|
+
value: d,
|
|
138
|
+
onChange: p
|
|
138
139
|
}),
|
|
139
|
-
(
|
|
140
|
+
(y || s) && /* @__PURE__ */ g(b, { text: y || s })
|
|
140
141
|
]
|
|
141
142
|
}),
|
|
142
|
-
/* @__PURE__ */
|
|
143
|
+
/* @__PURE__ */ _("div", {
|
|
143
144
|
style: {
|
|
144
145
|
padding: "10px 16px",
|
|
145
146
|
borderTop: "1px solid var(--divider)",
|
|
@@ -149,32 +150,32 @@ function S({ param: i, current: o, error: s, onCancel: c, onSave: l }) {
|
|
|
149
150
|
flexShrink: 0
|
|
150
151
|
},
|
|
151
152
|
children: [
|
|
152
|
-
/* @__PURE__ */
|
|
153
|
-
/* @__PURE__ */
|
|
153
|
+
/* @__PURE__ */ g("div", { style: { flex: 1 } }),
|
|
154
|
+
/* @__PURE__ */ g(e, {
|
|
154
155
|
onClick: c,
|
|
155
156
|
children: u("dialog.cancel", "Cancel")
|
|
156
157
|
}),
|
|
157
|
-
/* @__PURE__ */
|
|
158
|
+
/* @__PURE__ */ g(e, {
|
|
158
159
|
kind: "primary",
|
|
159
|
-
icon: h
|
|
160
|
+
icon: g(h ? r : t.check, { size: 13 }),
|
|
160
161
|
onClick: S,
|
|
161
|
-
disabled:
|
|
162
|
-
children:
|
|
162
|
+
disabled: h,
|
|
163
|
+
children: h ? u("dialog.saving", "Saving…") : u("dialog.save", "Save")
|
|
163
164
|
})
|
|
164
165
|
]
|
|
165
166
|
})
|
|
166
167
|
]
|
|
167
168
|
});
|
|
168
169
|
}
|
|
169
|
-
function
|
|
170
|
-
let r =
|
|
170
|
+
function w({ param: e, value: t, onChange: n }) {
|
|
171
|
+
let r = f(), i = {
|
|
171
172
|
type: e.type,
|
|
172
173
|
structure: e.structure,
|
|
173
174
|
array: e.array,
|
|
174
175
|
values: e.values,
|
|
175
176
|
ref: e.ref
|
|
176
177
|
};
|
|
177
|
-
return /* @__PURE__ */ h
|
|
178
|
+
return /* @__PURE__ */ g(h, { children: l({
|
|
178
179
|
field: i,
|
|
179
180
|
fieldName: e.code,
|
|
180
181
|
value: t,
|
|
@@ -183,22 +184,22 @@ function C({ param: e, value: t, onChange: n }) {
|
|
|
183
184
|
t: r
|
|
184
185
|
}) });
|
|
185
186
|
}
|
|
186
|
-
function
|
|
187
|
+
function T(e, t) {
|
|
187
188
|
return e.type === "bool" ? t === !0 : e.type === "structure" ? t ?? (e.array ? [] : {}) : t ?? null;
|
|
188
189
|
}
|
|
189
|
-
function
|
|
190
|
+
function E(e, t) {
|
|
190
191
|
if (t == null) throw Error(e("params.value.required", "Enter a value."));
|
|
191
192
|
return t;
|
|
192
193
|
}
|
|
193
|
-
var
|
|
194
|
+
var D = /* @__PURE__ */ new Set([
|
|
194
195
|
"server",
|
|
195
196
|
"database",
|
|
196
197
|
"auth",
|
|
197
198
|
"sso",
|
|
198
199
|
"seeder"
|
|
199
200
|
]);
|
|
200
|
-
function
|
|
201
|
+
function O(e) {
|
|
201
202
|
let t = e.scopes ?? [];
|
|
202
|
-
return t.length === 0 ? !
|
|
203
|
+
return t.length === 0 ? !D.has(e.category ?? "") : t.includes("tenant");
|
|
203
204
|
}
|
|
204
|
-
export {
|
|
205
|
+
export { C as EditParamDialog, b as ErrorLine, y as ResetParamControl, S as ValuePreview, O as paramTenantEditable, x as useParamRefLabels };
|
|
@@ -4,7 +4,9 @@ import { jsx as r } from "react/jsx-runtime";
|
|
|
4
4
|
// src/components/shared/LucideIcon.tsx
|
|
5
5
|
var i = /* @__PURE__ */ new Map(), a = null;
|
|
6
6
|
function o() {
|
|
7
|
-
return a ||= import("lucide-react/dynamic.js").then((e) => e.dynamicIconImports
|
|
7
|
+
return a ||= import("lucide-react/dynamic.js").then((e) => e.dynamicIconImports, (e) => {
|
|
8
|
+
throw a = null, e;
|
|
9
|
+
}), a;
|
|
8
10
|
}
|
|
9
11
|
function s({ name: a, size: s = 14, className: c, style: l }) {
|
|
10
12
|
let [u, d] = n(() => i.get(a)), [f, p] = n(!1);
|
|
@@ -22,6 +24,8 @@ function s({ name: a, size: s = 14, className: c, style: l }) {
|
|
|
22
24
|
else return n().then((e) => {
|
|
23
25
|
i.set(a, e.default), t && (d(() => e.default), p(!1));
|
|
24
26
|
});
|
|
27
|
+
}).catch(() => {
|
|
28
|
+
t && p(!0);
|
|
25
29
|
}), () => {
|
|
26
30
|
t = !1;
|
|
27
31
|
};
|