@declarion/react 0.359.0 → 0.365.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.
@@ -1,42 +1,42 @@
1
1
  // src/api/access-expiry.ts
2
- var e = "declarion.auth.access.expiry";
3
- function t(t) {
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 n() {
10
+ function r() {
11
11
  try {
12
12
  window.localStorage.removeItem(e);
13
13
  } catch {
14
14
  return;
15
15
  }
16
16
  }
17
- var r = "declarion.auth.signed_out";
18
- function i() {
17
+ var i = "declarion.auth.signed_out";
18
+ function a() {
19
19
  try {
20
- window.localStorage.setItem(r, "1");
20
+ window.localStorage.setItem(i, "1");
21
21
  } catch {
22
22
  return;
23
23
  }
24
24
  }
25
- function a() {
25
+ function o() {
26
26
  try {
27
- window.localStorage.removeItem(r);
27
+ window.localStorage.removeItem(i);
28
28
  } catch {
29
29
  return;
30
30
  }
31
31
  }
32
- function o() {
32
+ function s() {
33
33
  try {
34
- return window.localStorage.getItem(r) === "1";
34
+ return window.localStorage.getItem(i) === "1";
35
35
  } catch {
36
36
  return !1;
37
37
  }
38
38
  }
39
- function s() {
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 c = "/login/sso-callback";
48
- function l(e, t, n = !1) {
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 u() {
52
- return l(s(), Date.now(), window.location.pathname === c);
51
+ function d() {
52
+ return u(c(), Date.now(), window.location.pathname === l);
53
53
  }
54
- export { c as SSO_RETURN_PATH, n as clearAccessExpiry, a as clearSignOut, t as recordAccessExpiry, i as recordSignOut, o as signedOutExplicitly, l as startOrder, u as startOrderNow };
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 { isEmbedTokenMode as i } from "../embed/token.js";
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 a = 6e4, o = 5e3, s = null, c = null, l = 0, u = !1;
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 || i() || (d(), u = !0, t().catch((t) => {
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() - a, o)));
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 { a as PROACTIVE_REFRESH_MARGIN_MS, h as cancelRenewal, m as scheduleRenewal };
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 ne, paramTenantEditable as d, useParamRefLabels as f } from "../../params/param-editors.js";
10
- import { useResponsiveMode as p } from "../../../hooks/useResponsiveMode.js";
11
- import { PageHeader as m } from "../../chrome/PageHeader.js";
12
- import { PageShell as h } from "../../chrome/PageShell.js";
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 E = "my_tenant", D = [
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
- ], O = [
28
+ ], ae = [
25
29
  "29%",
26
30
  "12%",
27
31
  "11%",
28
32
  "21%",
29
33
  "13%",
30
34
  "14%"
31
- ], k = {
35
+ ], D = {
32
36
  ...g,
33
37
  overflow: "hidden",
34
38
  textOverflow: "ellipsis",
35
39
  whiteSpace: "nowrap"
36
- }, re = {
40
+ }, oe = {
37
41
  ...g,
38
42
  whiteSpace: "nowrap",
39
43
  textAlign: "right"
40
44
  };
41
- function A(e) {
42
- let t = y(), n = x("param_source").valueOf, u = x("field_type").valueOf, d = y("errors"), A = c((e) => e.activeTenant?.id) ?? "", { isPhone: M } = p(), N = ee("tenant"), [P, F] = C(""), [I, L] = C(""), [R, z] = C(""), [B, V] = C(!1), [H, U] = C(null), { overrideByCode: W, missingParams: G, isLoading: K, retry: q, error: J, clearError: Y, save: ae, reset: oe } = s({
43
- carrierEntityCode: E,
44
- rowId: A
45
- }), se = async (e, t) => {
46
- await ae(e, t) && U((t) => t === e ? null : t);
47
- }, X = S(() => N.data?.params ?? [], [N.data]), { data: Z } = b(), Q = S(() => {
48
- let e = new Map((Z?.enums?.parameter_category?.values ?? []).map((e) => [e.code, t(e.name) || e.code]));
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
- }, [Z, t]), ce = S(() => Array.from(new Set(X.map((e) => e.category).filter(Boolean))).map((e) => ({
54
+ }, [X, t]), ue = S(() => Array.from(new Set(Y.map((e) => e.category).filter(Boolean))).map((e) => ({
51
55
  value: e,
52
- label: Q(e)
56
+ label: Z(e)
53
57
  })).sort((e, n) => e.label.localeCompare(n.label, t.language)), [
54
- X,
55
- Q,
58
+ Y,
59
+ Z,
56
60
  t.language
57
- ]), le = S(() => {
58
- let e = P.trim().toLowerCase();
59
- return X.filter((n) => !(I && n.category !== I || R && n.source !== R || B && !W.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));
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
- X,
63
- P,
64
- I,
65
- R,
66
- B,
67
- W
68
- ]), ue = N.isLoading || K, de = f(X, N.data?.refs), $ = le.map((e) => {
69
- let t = W.get(e.code);
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(ie, {
76
+ state: /* @__PURE__ */ w(k, {
73
77
  param: e,
74
78
  override: t
75
79
  }),
76
- value: /* @__PURE__ */ w(ne, {
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: de(e),
85
+ label: fe(e),
82
86
  maxWidth: "100%"
83
87
  }),
84
- actions: /* @__PURE__ */ w(j, {
88
+ actions: /* @__PURE__ */ w(A, {
85
89
  param: e,
86
90
  stored: t !== void 0,
87
91
  onEdit: () => {
88
- Y(), U(e);
92
+ J(), H(e);
89
93
  },
90
- onReset: (e) => void oe(e)
94
+ onReset: (e) => void ce(e)
91
95
  })
92
96
  };
93
97
  });
94
- return /* @__PURE__ */ T(h, {
95
- header: /* @__PURE__ */ w(m, { description: t("params.tenant.subtitle", "Tenant configuration. Editing a value stores a tenant override; Reset restores the platform default.") }),
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
- J && /* @__PURE__ */ w(l, { text: J }),
98
- G && /* @__PURE__ */ w(l, {
99
- text: d("param.overrides_unreadable", "The current parameter overrides could not be read."),
100
- onRetry: q
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: P,
118
- onChange: F,
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: I,
129
+ value: F,
126
130
  options: [{
127
131
  value: "",
128
132
  label: t("params.filter.all_categories", "All categories")
129
- }, ...ce],
130
- onChange: L
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: R,
140
+ value: L,
137
141
  options: [{
138
142
  value: "",
139
143
  label: t("params.filter.all_sources", "All sources")
140
- }, ...D.map((e) => ({
144
+ }, ...ie.map((e) => ({
141
145
  value: e,
142
146
  label: n(e).label
143
147
  }))],
144
- onChange: z
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: B,
156
- onChange: V
159
+ value: z,
160
+ onChange: B
157
161
  }), t("params.filter.overridden_only", "Overridden only")]
158
162
  })
159
163
  ]
160
164
  }),
161
- ue ? /* @__PURE__ */ w("div", {
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
- }) : M ? /* @__PURE__ */ w("div", {
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: [Q(e.category), u(e.type).label].filter(Boolean).join(" · ")
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: O.map((e, t) => /* @__PURE__ */ w("col", { style: { width: e } }, t)) }),
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: k,
306
- title: Q(e.category) || void 0,
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: k,
317
+ style: D,
315
318
  children: r
316
319
  }),
317
320
  /* @__PURE__ */ w("td", {
318
- style: k,
321
+ style: D,
319
322
  children: n
320
323
  }),
321
324
  /* @__PURE__ */ w("td", {
322
- style: re,
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
- H && /* @__PURE__ */ w(te, {
331
- param: H,
332
- current: W.get(H.code)?.value ?? H.value,
333
- error: J,
333
+ V && /* @__PURE__ */ w(te, {
334
+ param: V,
335
+ current: U.get(V.code)?.value ?? V.value,
336
+ error: q,
334
337
  onCancel: () => {
335
- U(null), Y();
338
+ H(null), J();
336
339
  },
337
- onSave: (e) => se(H, e)
340
+ onSave: (e) => le(V, e)
338
341
  })
339
342
  ]
340
343
  });
341
344
  }
342
- function ie({ param: e, override: n }) {
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 j({ param: t, stored: r, onEdit: i, onReset: a }) {
365
+ function A({ param: t, stored: r, onEdit: i, onReset: a }) {
363
366
  let o = y();
364
- return d(t) ? /* @__PURE__ */ T("span", {
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 { A as TenantParamsPage };
400
+ export { O as TenantParamsPage };
@@ -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), a;
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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@declarion/react",
3
- "version": "0.359.0",
3
+ "version": "0.365.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "React SDK for Declarion, the schema-driven business apps platform.",