@declarion/react 0.244.0 → 0.245.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/params.js +5 -1
- package/dist-lib/components/pages/profile/Profile.impl.js +1 -1
- package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +33 -33
- package/dist-lib/components/params/ParamsBlock.js +2 -2
- package/dist-lib/components/params/param-editors.js +4 -4
- package/package.json +1 -1
package/dist-lib/api/params.js
CHANGED
|
@@ -14,6 +14,10 @@ async function n(t, n = {}) {
|
|
|
14
14
|
return (await e(`/api/params/${encodeURIComponent(t)}`, {}, n)).data;
|
|
15
15
|
}
|
|
16
16
|
async function r(t) {
|
|
17
|
-
|
|
17
|
+
let n = await e(`/api/params${t === "tenant" ? "?resolution=tenant" : ""}`);
|
|
18
|
+
return {
|
|
19
|
+
params: n.data ?? [],
|
|
20
|
+
refs: n.$refs
|
|
21
|
+
};
|
|
18
22
|
}
|
|
19
23
|
export { r as fetchAllParams, n as fetchParam, t as fetchPublicParams };
|
|
@@ -396,7 +396,7 @@ function Z(e) {
|
|
|
396
396
|
return e?.entities.profile?.params_scope ?? "profile";
|
|
397
397
|
}
|
|
398
398
|
function Q() {
|
|
399
|
-
let e = I(), { data: t } = k(), n = F().data?.find((e) => e.code === R);
|
|
399
|
+
let e = I(), { data: t } = k(), n = F().data?.params.find((e) => e.code === R);
|
|
400
400
|
if (n?.scopes?.includes(Z(t))) return null;
|
|
401
401
|
let r = typeof n?.value == "string" ? n.value : e.language, i = t?.languages?.find((e) => e.code === r);
|
|
402
402
|
return /* @__PURE__ */ G(p, {
|
|
@@ -4,35 +4,35 @@ import { Btn as n } from "../../primitives/Btn.js";
|
|
|
4
4
|
import { Spinner as r } from "../../primitives/Spinner.js";
|
|
5
5
|
import { Select as i, TextInput as a } from "../../primitives/Fields.js";
|
|
6
6
|
import { BoolToggle as o } from "../../primitives/BoolToggle.js";
|
|
7
|
-
import { useAllParams as s, useCarrierParamOverrides as
|
|
8
|
-
import { useAuthStore as
|
|
9
|
-
import { EditParamDialog as
|
|
10
|
-
import { useResponsiveMode as
|
|
11
|
-
import { PageHeader as
|
|
12
|
-
import { PageShell as
|
|
7
|
+
import { useAllParams as s, useCarrierParamOverrides as ee } from "../../../hooks/useParams.js";
|
|
8
|
+
import { useAuthStore as te } from "../../../stores/auth.js";
|
|
9
|
+
import { EditParamDialog as c, ErrorLine as l, ResetParamControl as u, ValuePreview as ne, paramSourceName 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 g } from "../../chrome/PageShell.js";
|
|
13
13
|
import { dataTableCellStyle as _, dataTableHeadCellStyle as v, dataTableStyle as y } from "../../primitives/dataTableStyles.js";
|
|
14
14
|
import { useText as b } from "../../../hooks/useText.js";
|
|
15
15
|
import { useSchema as x } from "../../../hooks/useSchema.js";
|
|
16
16
|
import { useMemo as S, useState as C } from "react";
|
|
17
17
|
import { jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
18
18
|
// src/components/pages/tenant-params/TenantParamsPage.impl.tsx
|
|
19
|
-
var E = "my_tenant",
|
|
19
|
+
var E = "my_tenant", re = [
|
|
20
20
|
"yaml",
|
|
21
21
|
"env",
|
|
22
22
|
"tenant"
|
|
23
|
-
],
|
|
23
|
+
], D = [
|
|
24
24
|
"29%",
|
|
25
25
|
"12%",
|
|
26
26
|
"11%",
|
|
27
27
|
"21%",
|
|
28
28
|
"9%",
|
|
29
29
|
"18%"
|
|
30
|
-
],
|
|
30
|
+
], O = {
|
|
31
31
|
..._,
|
|
32
32
|
overflow: "hidden",
|
|
33
33
|
textOverflow: "ellipsis",
|
|
34
34
|
whiteSpace: "nowrap"
|
|
35
|
-
},
|
|
35
|
+
}, k = {
|
|
36
36
|
..._,
|
|
37
37
|
whiteSpace: "nowrap",
|
|
38
38
|
textAlign: "right"
|
|
@@ -41,12 +41,12 @@ function A(e) {
|
|
|
41
41
|
return e === "tenant" ? "violet" : e === "env" ? "amber" : "slate";
|
|
42
42
|
}
|
|
43
43
|
function j(e) {
|
|
44
|
-
let t = b(), n = b("errors"),
|
|
44
|
+
let t = b(), n = b("errors"), u = te((e) => e.activeTenant?.id) ?? "", { isPhone: f } = m(), A = s("tenant"), [j, 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: Y, reset: ie } = ee({
|
|
45
45
|
carrierEntityCode: E,
|
|
46
|
-
rowId:
|
|
46
|
+
rowId: u
|
|
47
47
|
}), ae = async (e, t) => {
|
|
48
48
|
await Y(e, t) && H((t) => t === e ? null : t);
|
|
49
|
-
}, X = S(() => A.data ?? [], [A.data]), { data: Z } = x(), Q = S(() => {
|
|
49
|
+
}, X = S(() => A.data?.params ?? [], [A.data]), { data: Z } = x(), Q = S(() => {
|
|
50
50
|
let e = new Map((Z?.enums?.parameter_category?.values ?? []).map((e) => [e.code, t(e.name) || e.code]));
|
|
51
51
|
return (t) => t ? e.get(t) ?? t : "";
|
|
52
52
|
}, [Z, t]), oe = S(() => Array.from(new Set(X.map((e) => e.category).filter(Boolean))).map((e) => ({
|
|
@@ -67,7 +67,7 @@ function j(e) {
|
|
|
67
67
|
L,
|
|
68
68
|
z,
|
|
69
69
|
U
|
|
70
|
-
]), ce = A.isLoading || G, le =
|
|
70
|
+
]), ce = A.isLoading || G, le = p(X, A.data?.refs), $ = se.map((e) => {
|
|
71
71
|
let t = U.get(e.code);
|
|
72
72
|
return {
|
|
73
73
|
param: e,
|
|
@@ -75,7 +75,7 @@ function j(e) {
|
|
|
75
75
|
param: e,
|
|
76
76
|
override: t
|
|
77
77
|
}),
|
|
78
|
-
value: /* @__PURE__ */ w(
|
|
78
|
+
value: /* @__PURE__ */ w(ne, {
|
|
79
79
|
type: e.type,
|
|
80
80
|
value: e.value,
|
|
81
81
|
values: e.values,
|
|
@@ -93,11 +93,11 @@ function j(e) {
|
|
|
93
93
|
})
|
|
94
94
|
};
|
|
95
95
|
});
|
|
96
|
-
return /* @__PURE__ */ T(
|
|
97
|
-
header: /* @__PURE__ */ w(
|
|
96
|
+
return /* @__PURE__ */ T(g, {
|
|
97
|
+
header: /* @__PURE__ */ w(h, { description: t("params.tenant.subtitle", "Tenant configuration. Editing a value stores a tenant override; Reset restores the platform default.") }),
|
|
98
98
|
children: [
|
|
99
|
-
q && /* @__PURE__ */ w(
|
|
100
|
-
W && /* @__PURE__ */ w(
|
|
99
|
+
q && /* @__PURE__ */ w(l, { text: q }),
|
|
100
|
+
W && /* @__PURE__ */ w(l, {
|
|
101
101
|
text: n("param.overrides_unreadable", "The current parameter overrides could not be read."),
|
|
102
102
|
onRetry: K
|
|
103
103
|
}),
|
|
@@ -139,9 +139,9 @@ function j(e) {
|
|
|
139
139
|
options: [{
|
|
140
140
|
value: "",
|
|
141
141
|
label: t("params.filter.all_sources", "All sources")
|
|
142
|
-
}, ...
|
|
142
|
+
}, ...re.map((e) => ({
|
|
143
143
|
value: e,
|
|
144
|
-
label:
|
|
144
|
+
label: d(t, e)
|
|
145
145
|
}))],
|
|
146
146
|
onChange: R
|
|
147
147
|
})
|
|
@@ -174,7 +174,7 @@ function j(e) {
|
|
|
174
174
|
fontSize: 12.5
|
|
175
175
|
},
|
|
176
176
|
children: t("params.empty", "No parameters match.")
|
|
177
|
-
}) :
|
|
177
|
+
}) : f ? /* @__PURE__ */ w("div", {
|
|
178
178
|
"data-testid": "tenant-params-cards",
|
|
179
179
|
style: {
|
|
180
180
|
display: "flex",
|
|
@@ -258,7 +258,7 @@ function j(e) {
|
|
|
258
258
|
tableLayout: "fixed"
|
|
259
259
|
},
|
|
260
260
|
children: [
|
|
261
|
-
/* @__PURE__ */ w("colgroup", { children:
|
|
261
|
+
/* @__PURE__ */ w("colgroup", { children: D.map((e, t) => /* @__PURE__ */ w("col", { style: { width: e } }, t)) }),
|
|
262
262
|
/* @__PURE__ */ w("thead", { children: /* @__PURE__ */ T("tr", { children: [
|
|
263
263
|
/* @__PURE__ */ w("th", {
|
|
264
264
|
style: v,
|
|
@@ -304,25 +304,25 @@ function j(e) {
|
|
|
304
304
|
})]
|
|
305
305
|
}),
|
|
306
306
|
/* @__PURE__ */ w("td", {
|
|
307
|
-
style:
|
|
307
|
+
style: O,
|
|
308
308
|
title: Q(e.category) || void 0,
|
|
309
309
|
children: Q(e.category) || "—"
|
|
310
310
|
}),
|
|
311
311
|
/* @__PURE__ */ w("td", {
|
|
312
|
-
style:
|
|
312
|
+
style: O,
|
|
313
313
|
title: e.type,
|
|
314
314
|
children: e.type
|
|
315
315
|
}),
|
|
316
316
|
/* @__PURE__ */ w("td", {
|
|
317
|
-
style:
|
|
317
|
+
style: O,
|
|
318
318
|
children: r
|
|
319
319
|
}),
|
|
320
320
|
/* @__PURE__ */ w("td", {
|
|
321
|
-
style:
|
|
321
|
+
style: O,
|
|
322
322
|
children: n
|
|
323
323
|
}),
|
|
324
324
|
/* @__PURE__ */ w("td", {
|
|
325
|
-
style:
|
|
325
|
+
style: k,
|
|
326
326
|
children: i
|
|
327
327
|
})
|
|
328
328
|
]
|
|
@@ -330,7 +330,7 @@ function j(e) {
|
|
|
330
330
|
]
|
|
331
331
|
})
|
|
332
332
|
}),
|
|
333
|
-
V && /* @__PURE__ */ w(
|
|
333
|
+
V && /* @__PURE__ */ w(c, {
|
|
334
334
|
param: V,
|
|
335
335
|
current: U.get(V.code)?.value ?? V.value,
|
|
336
336
|
error: q,
|
|
@@ -348,7 +348,7 @@ function M({ param: e, override: n }) {
|
|
|
348
348
|
"data-testid": `tenant-param-not-applied-${e.code}`,
|
|
349
349
|
title: r("params.tenant.not_applied_hint", "This tenant is set to {value}, and it no longer satisfies the parameter's declaration. Source of the value in effect: {source}. Reset to remove it, or edit it to a value the declaration accepts.", {
|
|
350
350
|
value: JSON.stringify(n.value),
|
|
351
|
-
source:
|
|
351
|
+
source: d(r, e.source)
|
|
352
352
|
}),
|
|
353
353
|
children: /* @__PURE__ */ w(t, {
|
|
354
354
|
tone: "amber",
|
|
@@ -359,12 +359,12 @@ function M({ param: e, override: n }) {
|
|
|
359
359
|
}) : /* @__PURE__ */ w(t, {
|
|
360
360
|
tone: A(e.source),
|
|
361
361
|
size: "xs",
|
|
362
|
-
children:
|
|
362
|
+
children: d(r, e.source)
|
|
363
363
|
});
|
|
364
364
|
}
|
|
365
365
|
function N({ param: t, stored: r, onEdit: i, onReset: a }) {
|
|
366
366
|
let o = b();
|
|
367
|
-
return
|
|
367
|
+
return f(t) ? /* @__PURE__ */ T("span", {
|
|
368
368
|
style: {
|
|
369
369
|
display: "inline-flex",
|
|
370
370
|
flexWrap: "wrap",
|
|
@@ -376,7 +376,7 @@ function N({ param: t, stored: r, onEdit: i, onReset: a }) {
|
|
|
376
376
|
icon: /* @__PURE__ */ w(e.edit, { size: 12 }),
|
|
377
377
|
onClick: i,
|
|
378
378
|
children: o("params.edit", "Edit")
|
|
379
|
-
}), r && /* @__PURE__ */ w(
|
|
379
|
+
}), r && /* @__PURE__ */ w(u, {
|
|
380
380
|
param: t,
|
|
381
381
|
description: o("params.reset_confirm.tenant_description", "The value this tenant set is removed, and the platform default applies again."),
|
|
382
382
|
onReset: a
|
|
@@ -16,7 +16,7 @@ function y(e, t) {
|
|
|
16
16
|
return e ? e.filter((e) => e.scopes?.includes(t)) : [];
|
|
17
17
|
}
|
|
18
18
|
function b({ carrierEntityCode: b, carrierScope: x, rowId: S, title: C, icon: w, writeOneByOne: T }) {
|
|
19
|
-
let E = p(), D = p("errors"), O = a(), k = m(() => y(O.data, x), [O.data, x]), [A, j] = h(null), { overrideByCode: M, missingParams: N, isLoading: P, retry: F, error: I, clearError: L, save: R, reset: z } = o({
|
|
19
|
+
let E = p(), D = p("errors"), O = a(), k = m(() => y(O.data?.params, x), [O.data, x]), [A, j] = h(null), { overrideByCode: M, missingParams: N, isLoading: P, retry: F, error: I, clearError: L, save: R, reset: z } = o({
|
|
20
20
|
carrierEntityCode: b,
|
|
21
21
|
rowId: S,
|
|
22
22
|
enabled: k.length > 0,
|
|
@@ -31,7 +31,7 @@ function b({ carrierEntityCode: b, carrierScope: x, rowId: S, title: C, icon: w,
|
|
|
31
31
|
k,
|
|
32
32
|
B,
|
|
33
33
|
M
|
|
34
|
-
]), H = f(V), U = async (e, t) => {
|
|
34
|
+
]), H = f(V, O.data?.refs), U = async (e, t) => {
|
|
35
35
|
await R(e, t) && j((t) => t === e ? null : t);
|
|
36
36
|
};
|
|
37
37
|
return k.length === 0 ? null : /* @__PURE__ */ _(e, {
|
|
@@ -62,12 +62,12 @@ function x({ text: e, onRetry: n }) {
|
|
|
62
62
|
]
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
-
function S(e) {
|
|
66
|
-
let
|
|
65
|
+
function S(e, t) {
|
|
66
|
+
let n = d(), { data: r } = c(), i = e.flatMap((e) => e.ref?.entity && e.value != null && e.value !== "" ? [{
|
|
67
67
|
ref: e.ref,
|
|
68
68
|
value: e.value
|
|
69
|
-
}] : []), { refs:
|
|
70
|
-
return (e) => e.ref?.entity ? o(
|
|
69
|
+
}] : []), { refs: a } = s(i, t, r?.entities);
|
|
70
|
+
return (e) => e.ref?.entity ? o(n, a, e.ref, e.value, r?.entities) : void 0;
|
|
71
71
|
}
|
|
72
72
|
function C({ type: e, value: t, values: n, structure: r, label: i, maxWidth: a = 180 }) {
|
|
73
73
|
let o = d(), { data: s } = c(), l = (e) => {
|