@plumile/backoffice-react 0.1.61 → 0.1.63

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 (104) hide show
  1. package/lib/esm/components/backoffice/actions/BackofficeEntityActionFormDialog.js +67 -68
  2. package/lib/esm/components/backoffice/actions/BackofficeEntityActionFormDialog.js.map +1 -1
  3. package/lib/esm/components/backoffice/columns/buildDataTableColumns.js +1 -1
  4. package/lib/esm/components/backoffice/columns/buildDataTableColumns.js.map +1 -1
  5. package/lib/esm/components/backoffice/detail/BackofficeDetailBadgeRow.js +1 -1
  6. package/lib/esm/components/backoffice/detail/BackofficeDetailBadgeRow.js.map +1 -1
  7. package/lib/esm/components/backoffice/detail/BackofficeDetailField.js +1 -1
  8. package/lib/esm/components/backoffice/detail/BackofficeDetailField.js.map +1 -1
  9. package/lib/esm/components/backoffice/detail/BackofficeDetailFlagTag.js +1 -1
  10. package/lib/esm/components/backoffice/detail/BackofficeDetailFlagTag.js.map +1 -1
  11. package/lib/esm/components/backoffice/detail/BackofficeDetailRelationListBlock.js +21 -21
  12. package/lib/esm/components/backoffice/detail/BackofficeDetailRelationListBlock.js.map +1 -1
  13. package/lib/esm/components/backoffice/detail/BackofficeDetailTaggedValue.js +1 -1
  14. package/lib/esm/components/backoffice/detail/BackofficeDetailTaggedValue.js.map +1 -1
  15. package/lib/esm/components/backoffice/filters/EntityFilterValue.js +12 -12
  16. package/lib/esm/components/backoffice/filters/EntityFilterValue.js.map +1 -1
  17. package/lib/esm/components/backoffice/layout/buildSidebarSections.js.map +1 -1
  18. package/lib/esm/components/backoffice/layout/mapViewerToSidebarProfileView.js.map +1 -1
  19. package/lib/esm/components/backoffice/pickers/EntityIdPickerDialog.js +19 -19
  20. package/lib/esm/components/backoffice/pickers/EntityIdPickerDialog.js.map +1 -1
  21. package/lib/esm/components/backoffice/pickers/shared/EntityPickerList.js +1 -1
  22. package/lib/esm/components/backoffice/pickers/shared/EntityPickerList.js.map +1 -1
  23. package/lib/esm/components/backoffice/routing/BackofficeContentError.js +1 -1
  24. package/lib/esm/components/backoffice/routing/BackofficeContentError.js.map +1 -1
  25. package/lib/esm/components/backoffice/routing/BackofficeContentFallback.js +1 -1
  26. package/lib/esm/components/backoffice/routing/BackofficeContentFallback.js.map +1 -1
  27. package/lib/esm/components/backoffice/routing/BackofficeRouteFallback.js +1 -1
  28. package/lib/esm/components/backoffice/routing/BackofficeRouteFallback.js.map +1 -1
  29. package/lib/esm/components/backoffice/scaffolds/BackofficeEntityListScaffold.js +30 -31
  30. package/lib/esm/components/backoffice/scaffolds/BackofficeEntityListScaffold.js.map +1 -1
  31. package/lib/esm/components/backoffice/scaffolds/BackofficeTabbedDetailShell.js +2 -2
  32. package/lib/esm/components/backoffice/scaffolds/BackofficeTabbedDetailShell.js.map +1 -1
  33. package/lib/esm/components/backoffice/tools/BackofficeToolsQueryBoundary.js +1 -1
  34. package/lib/esm/components/backoffice/tools/BackofficeToolsQueryBoundary.js.map +1 -1
  35. package/lib/esm/hooks/useBackofficeAuth.js +13 -13
  36. package/lib/esm/hooks/useBackofficeAuth.js.map +1 -1
  37. package/lib/esm/hooks/useBackofficeSessionAuth.js +8 -8
  38. package/lib/esm/hooks/useBackofficeSessionAuth.js.map +1 -1
  39. package/lib/esm/index.js +18 -2
  40. package/lib/esm/pages/BackofficeDashboardPage.js +24 -24
  41. package/lib/esm/pages/BackofficeDashboardPage.js.map +1 -1
  42. package/lib/esm/pages/BackofficeEntityDetailLayoutPage.js +8 -8
  43. package/lib/esm/pages/BackofficeEntityDetailLayoutPage.js.map +1 -1
  44. package/lib/esm/pages/BackofficeEntityDetailPage.js +86 -87
  45. package/lib/esm/pages/BackofficeEntityDetailPage.js.map +1 -1
  46. package/lib/esm/pages/BackofficeEntityDetailUnknownPageRedirect.js +3 -3
  47. package/lib/esm/pages/BackofficeLayoutPage.js +4 -4
  48. package/lib/esm/pages/BackofficeLayoutPage.js.map +1 -1
  49. package/lib/esm/pages/BackofficeLoginPage.js +4 -4
  50. package/lib/esm/pages/BackofficeLoginPage.js.map +1 -1
  51. package/lib/esm/pages/BackofficePasswordResetCompletePage.js +6 -6
  52. package/lib/esm/pages/BackofficePasswordResetCompletePage.js.map +1 -1
  53. package/lib/esm/pages/BackofficePasswordResetRequestPage.js +4 -4
  54. package/lib/esm/pages/BackofficePasswordResetRequestPage.js.map +1 -1
  55. package/lib/esm/pages/BackofficeToolsOperationPage.js +53 -53
  56. package/lib/esm/pages/BackofficeToolsOperationPage.js.map +1 -1
  57. package/lib/esm/pages/BackofficeVerifyEmailPage.js +6 -6
  58. package/lib/esm/pages/BackofficeVerifyEmailPage.js.map +1 -1
  59. package/lib/esm/pages/detail/buildTabsItems.js.map +1 -1
  60. package/lib/esm/provider/BackofficeProvider.js +0 -2
  61. package/lib/esm/provider/BackofficeProvider.js.map +1 -1
  62. package/lib/esm/relay/RelayProvider.js +4 -4
  63. package/lib/esm/relay/RelayProvider.js.map +1 -1
  64. package/lib/esm/relay/createInlineReader.js +1 -1
  65. package/lib/esm/relay/createInlineReader.js.map +1 -1
  66. package/lib/esm/relay/useRelayEnvironment.js +7 -2
  67. package/lib/esm/relay/useRelayEnvironment.js.map +1 -0
  68. package/lib/esm/router/createBackofficeRoutes.js +81 -81
  69. package/lib/esm/router/createBackofficeRoutes.js.map +1 -1
  70. package/lib/types/components/backoffice/actions/BackofficeEntityActionFormDialog.d.ts.map +1 -1
  71. package/lib/types/components/backoffice/detail/BackofficeDetailFlagTag.d.ts +1 -1
  72. package/lib/types/components/backoffice/detail/BackofficeDetailFlagTag.d.ts.map +1 -1
  73. package/lib/types/components/backoffice/detail/BackofficeDetailRelationListBlock.d.ts.map +1 -1
  74. package/lib/types/components/backoffice/filters/EntityFilterValue.d.ts.map +1 -1
  75. package/lib/types/components/backoffice/layout/buildSidebarSections.d.ts +1 -1
  76. package/lib/types/components/backoffice/layout/buildSidebarSections.d.ts.map +1 -1
  77. package/lib/types/components/backoffice/layout/mapViewerToSidebarProfileView.d.ts +1 -1
  78. package/lib/types/components/backoffice/layout/mapViewerToSidebarProfileView.d.ts.map +1 -1
  79. package/lib/types/components/backoffice/pickers/EntityIdPickerDialog.d.ts.map +1 -1
  80. package/lib/types/components/backoffice/scaffolds/BackofficeEntityListScaffold.d.ts.map +1 -1
  81. package/lib/types/components/backoffice/scaffolds/BackofficeTabbedDetailShell.d.ts +1 -1
  82. package/lib/types/components/backoffice/scaffolds/BackofficeTabbedDetailShell.d.ts.map +1 -1
  83. package/lib/types/hooks/useBackofficeAuth.d.ts.map +1 -1
  84. package/lib/types/hooks/useBackofficeSessionAuth.d.ts.map +1 -1
  85. package/lib/types/index.d.ts +18 -0
  86. package/lib/types/index.d.ts.map +1 -1
  87. package/lib/types/pages/BackofficeDashboardPage.d.ts.map +1 -1
  88. package/lib/types/pages/BackofficeEntityDetailLayoutPage.d.ts.map +1 -1
  89. package/lib/types/pages/BackofficeEntityDetailPage.d.ts.map +1 -1
  90. package/lib/types/pages/BackofficeLoginPage.d.ts +1 -1
  91. package/lib/types/pages/BackofficeLoginPage.d.ts.map +1 -1
  92. package/lib/types/pages/BackofficePasswordResetCompletePage.d.ts.map +1 -1
  93. package/lib/types/pages/BackofficePasswordResetRequestPage.d.ts.map +1 -1
  94. package/lib/types/pages/BackofficeToolsOperationPage.d.ts.map +1 -1
  95. package/lib/types/pages/BackofficeVerifyEmailPage.d.ts.map +1 -1
  96. package/lib/types/pages/detail/buildTabsItems.d.ts +1 -1
  97. package/lib/types/pages/detail/buildTabsItems.d.ts.map +1 -1
  98. package/lib/types/provider/BackofficeProvider.d.ts +0 -2
  99. package/lib/types/provider/BackofficeProvider.d.ts.map +1 -1
  100. package/lib/types/relay/RelayProvider.d.ts.map +1 -1
  101. package/lib/types/relay/useRelayEnvironment.d.ts +2 -1
  102. package/lib/types/relay/useRelayEnvironment.d.ts.map +1 -1
  103. package/lib/types/router/createBackofficeRoutes.d.ts.map +1 -1
  104. package/package.json +6 -6
@@ -20,24 +20,24 @@ import { actions as v, form as y, inputHeader as b, keyValueGrid as x, outputSta
20
20
  import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
21
21
  import { useTranslation as E } from "react-i18next";
22
22
  import { Button as D, DataTable as O, SimpleSelect as k } from "@plumile/ui";
23
- import { useCallback as A, useEffect as j, useMemo as M, useRef as ee, useState as N } from "react";
24
- import { useLazyLoadQuery as P } from "react-relay";
25
- import { Label as F } from "@plumile/ui/atomic/atoms/label/Label.js";
26
- import { Textarea as I } from "@plumile/ui/atomic/atoms/textarea/Textarea.js";
27
- import { CheckboxField as L } from "@plumile/ui/atomic/molecules/checkbox_field/CheckboxField.js";
28
- import { Form as R } from "@plumile/ui/atomic/molecules/form/Form.js";
29
- import { FormErrorBanner as z } from "@plumile/ui/atomic/molecules/form/FormErrorBanner.js";
30
- import { FormGroup as B } from "@plumile/ui/atomic/molecules/form/FormGroup.js";
31
- import { HighlightCode as V } from "@plumile/ui/atomic/molecules/highlight/HighlightCode.js";
32
- import { LazyBackofficeJsonViewer as H } from "@plumile/ui-backoffice/backoffice/molecules/backoffice_json_viewer/LazyBackofficeJsonViewer.js";
33
- import { BackofficeToolValidationError as U } from "@plumile/backoffice-core/types.js";
23
+ import { useCallback as ee, useEffect as A, useMemo as j, useRef as te, useState as M } from "react";
24
+ import * as N from "react-relay";
25
+ import { Label as P } from "@plumile/ui/atomic/atoms/label/Label.js";
26
+ import { Textarea as F } from "@plumile/ui/atomic/atoms/textarea/Textarea.js";
27
+ import { CheckboxField as I } from "@plumile/ui/atomic/molecules/checkbox_field/CheckboxField.js";
28
+ import { Form as L } from "@plumile/ui/atomic/molecules/form/Form.js";
29
+ import { FormErrorBanner as R } from "@plumile/ui/atomic/molecules/form/FormErrorBanner.js";
30
+ import { FormGroup as z } from "@plumile/ui/atomic/molecules/form/FormGroup.js";
31
+ import { HighlightCode as B } from "@plumile/ui/atomic/molecules/highlight/HighlightCode.js";
32
+ import { LazyBackofficeJsonViewer as V } from "@plumile/ui/backoffice/molecules/backoffice_json_viewer/LazyBackofficeJsonViewer.js";
33
+ import { BackofficeToolValidationError as H } from "@plumile/backoffice-core/types.js";
34
34
  //#region src/pages/BackofficeToolsOperationPage.tsx
35
- var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null, te = (e) => {
35
+ var { useLazyLoadQuery: U } = N, W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null, K = (e) => {
36
36
  let t = {};
37
37
  return e?.forEach((e) => {
38
38
  e.kind === "boolean" ? t[e.id] = e.defaultValue ?? !1 : t[e.id] = e.defaultValue ?? "";
39
39
  }), t;
40
- }, K = (e) => {
40
+ }, q = (e) => {
41
41
  let t = {};
42
42
  return Object.entries(e).forEach(([e, n]) => {
43
43
  if (n != null) {
@@ -51,7 +51,7 @@ var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null,
51
51
  }
52
52
  }), t;
53
53
  }, ne = ({ operation: e, inputValues: t, initiativeId: n, projectId: r, run: i }) => {
54
- let a = K(t), o = Object.prototype.hasOwnProperty.call(t, "projectId"), s = e.inputs?.some((e) => e.kind === "entityId" && e.entity === "projects") ?? !1;
54
+ let a = q(t), o = Object.prototype.hasOwnProperty.call(t, "projectId"), s = e.inputs?.some((e) => e.kind === "entityId" && e.entity === "projects") ?? !1;
55
55
  if ((o || s) && r != null && r.trim() !== "") {
56
56
  let e = a.projectId;
57
57
  (e == null || String(e).trim() === "") && (a.projectId = r);
@@ -73,11 +73,11 @@ var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null,
73
73
  ...c,
74
74
  ...l
75
75
  };
76
- }, q = (e) => {
76
+ }, J = (e) => {
77
77
  if (e.showProjectPicker != null) return e.showProjectPicker;
78
78
  let { inputs: t } = e;
79
79
  return t == null ? !1 : t.some((e) => e.kind === "entityId" && e.entity === "projects" ? !0 : e.id === "projectId");
80
- }, J = (e) => {
80
+ }, Y = (e) => {
81
81
  try {
82
82
  let t = JSON.parse(e);
83
83
  return typeof t != "object" || !t || Array.isArray(t) ? null : t;
@@ -85,7 +85,7 @@ var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null,
85
85
  return null;
86
86
  }
87
87
  }, re = (e, t) => {
88
- let n = J(e);
88
+ let n = Y(e);
89
89
  if (n == null) return null;
90
90
  let r = n;
91
91
  Object.entries(t).forEach(([e, t]) => {
@@ -93,7 +93,7 @@ var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null,
93
93
  });
94
94
  let i = JSON.stringify(r, null, 2);
95
95
  return i === e ? null : i;
96
- }, Y = (e, t) => {
96
+ }, X = (e, t) => {
97
97
  if (typeof e == "object" && e) {
98
98
  let t = e, n = t.id;
99
99
  if (typeof n == "string" && n.trim() !== "") return n;
@@ -101,7 +101,7 @@ var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null,
101
101
  if (typeof r == "string" && r.trim() !== "") return r;
102
102
  }
103
103
  return String(t);
104
- }, X = ({ outputs: n, data: r, wrapDefault: i = !1 }) => {
104
+ }, Z = ({ outputs: n, data: r, wrapDefault: i = !1 }) => {
105
105
  let { t: l } = E(), { t: u } = e(), { entities: d } = t(), f = u("tools.output");
106
106
  return /* @__PURE__ */ w("div", {
107
107
  className: S,
@@ -117,7 +117,7 @@ var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null,
117
117
  }), p = e.rows(r), m = /* @__PURE__ */ w(O, {
118
118
  columns: c,
119
119
  rows: Array.isArray(p) ? p : [],
120
- getRowId: Y
120
+ getRowId: X
121
121
  }, `table-${t}`);
122
122
  return i ? m : /* @__PURE__ */ w(s, {
123
123
  title: n,
@@ -126,7 +126,7 @@ var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null,
126
126
  }, `table-${t}`);
127
127
  }
128
128
  if (e.kind === "code") {
129
- let n = e.label == null ? f : W(e.label, l), a = e.description == null ? void 0 : W(e.description, l), o = e.value(r), c = /* @__PURE__ */ w(V, {
129
+ let n = e.label == null ? f : W(e.label, l), a = e.description == null ? void 0 : W(e.description, l), o = e.value(r), c = /* @__PURE__ */ w(B, {
130
130
  badgeLabel: n,
131
131
  copyCode: o,
132
132
  fallbackCodeText: o
@@ -138,7 +138,7 @@ var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null,
138
138
  }, `code-${t}`);
139
139
  }
140
140
  if (e.kind === "json") {
141
- let n = e.label == null ? f : W(e.label, l), a = e.description == null ? void 0 : W(e.description, l), o = /* @__PURE__ */ w(H, {
141
+ let n = e.label == null ? f : W(e.label, l), a = e.description == null ? void 0 : W(e.description, l), o = /* @__PURE__ */ w(V, {
142
142
  value: e.value(r),
143
143
  title: n
144
144
  }, `json-${t}`);
@@ -186,7 +186,7 @@ var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null,
186
186
  })
187
187
  });
188
188
  }, ie = ({ operation: t, variables: n, fetchKey: r }) => {
189
- let { t: i } = e(), a = P(t.query, n, {
189
+ let { t: i } = e(), a = U(t.query, n, {
190
190
  fetchKey: r,
191
191
  fetchPolicy: "store-or-network"
192
192
  });
@@ -196,24 +196,24 @@ var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null,
196
196
  return e.label == null && !t;
197
197
  }) ? /* @__PURE__ */ w(s, {
198
198
  title: i("tools.output"),
199
- children: /* @__PURE__ */ w(X, {
199
+ children: /* @__PURE__ */ w(Z, {
200
200
  outputs: t.outputs,
201
201
  data: a,
202
202
  wrapDefault: !0
203
203
  })
204
- }) : /* @__PURE__ */ w(X, {
204
+ }) : /* @__PURE__ */ w(Z, {
205
205
  outputs: t.outputs,
206
206
  data: a
207
207
  }) : null : /* @__PURE__ */ w(C, { children: t.render(a) });
208
- }, Z = ({ operation: t }) => {
209
- let { t: r } = E(), { t: a } = e(), { initiativeId: o, projectId: c } = h(), [u, d] = N(M(() => te(t.inputs), [t.inputs])), [f, p] = N(null), [m, g] = N(0), [x, S] = N(null), [O, P] = N(!1), [V, H] = N(null), G = ee({
208
+ }, Q = ({ operation: t }) => {
209
+ let { t: r } = E(), { t: a } = e(), { initiativeId: o, projectId: c } = h(), [u, d] = M(j(() => K(t.inputs), [t.inputs])), [f, p] = M(null), [m, g] = M(0), [x, S] = M(null), [O, N] = M(!1), [B, V] = M(null), U = te({
210
210
  initiativeId: o,
211
211
  projectId: c
212
- }), K = M(() => ({
212
+ }), G = j(() => ({
213
213
  initiativeId: o,
214
214
  projectId: c
215
215
  }), [o, c]);
216
- j(() => {
216
+ A(() => {
217
217
  if (t.inputs == null) return;
218
218
  let e = t.inputs.some((e) => e.id === "initiativeId"), n = t.inputs.some((e) => e.id === "projectId");
219
219
  !e && !n || d((t) => {
@@ -238,9 +238,9 @@ var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null,
238
238
  o,
239
239
  t.inputs,
240
240
  c
241
- ]), j(() => {
242
- let e = G.current, t = {};
243
- e.initiativeId !== o && (t.initiativeId = o ?? ""), e.projectId !== c && (t.projectId = c ?? ""), G.current = {
241
+ ]), A(() => {
242
+ let e = U.current, t = {};
243
+ e.initiativeId !== o && (t.initiativeId = o ?? ""), e.projectId !== c && (t.projectId = c ?? ""), U.current = {
244
244
  initiativeId: o,
245
245
  projectId: c
246
246
  }, Object.keys(t).length !== 0 && d((e) => {
@@ -253,7 +253,7 @@ var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null,
253
253
  };
254
254
  });
255
255
  }, [o, c]);
256
- let q = A(() => {
256
+ let q = ee(() => {
257
257
  if (p(null), o == null || o.trim() === "") {
258
258
  p(a("tools.errors.missingScope"));
259
259
  return;
@@ -268,14 +268,14 @@ var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null,
268
268
  run: !0
269
269
  });
270
270
  } catch (e) {
271
- if (e instanceof U) {
271
+ if (e instanceof H) {
272
272
  p(W(e.label, r));
273
273
  return;
274
274
  }
275
275
  e instanceof Error ? p(e.message) : p(a("tools.errors.unknown"));
276
276
  return;
277
277
  }
278
- S(e), P(!0), g((e) => e + 1);
278
+ S(e), N(!0), g((e) => e + 1);
279
279
  }, [
280
280
  o,
281
281
  u,
@@ -283,11 +283,11 @@ var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null,
283
283
  c,
284
284
  a,
285
285
  r
286
- ]), J = M(() => V == null || t.inputs == null ? null : t.inputs.find((e) => e.id === V && e.kind === "entityId") ?? null, [V, t.inputs]), Y = (e) => {
286
+ ]), J = j(() => B == null || t.inputs == null ? null : t.inputs.find((e) => e.id === B && e.kind === "entityId") ?? null, [B, t.inputs]), Y = (e) => {
287
287
  let t = W(e.label, r), i = u[e.id];
288
288
  if (e.kind === "text") {
289
289
  let n = typeof i == "string" ? i : "", a = e.placeholder == null ? void 0 : W(e.placeholder, r);
290
- return /* @__PURE__ */ T(B, { children: [/* @__PURE__ */ w(F, { children: t }), /* @__PURE__ */ w(I, {
290
+ return /* @__PURE__ */ T(z, { children: [/* @__PURE__ */ w(P, { children: t }), /* @__PURE__ */ w(F, {
291
291
  value: n,
292
292
  placeholder: a,
293
293
  onChange: (t) => {
@@ -302,9 +302,9 @@ var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null,
302
302
  }
303
303
  if (e.kind === "json") {
304
304
  let n = typeof i == "string" ? i : "", o = e.placeholder == null ? void 0 : W(e.placeholder, r), s = typeof e.defaultValue == "string" ? e.defaultValue : "", c = s.trim() !== "", l = a("tools.forms.actions.insertExample");
305
- return /* @__PURE__ */ T(B, { children: [/* @__PURE__ */ T("div", {
305
+ return /* @__PURE__ */ T(z, { children: [/* @__PURE__ */ T("div", {
306
306
  className: b,
307
- children: [/* @__PURE__ */ w(F, { children: t }), c && /* @__PURE__ */ w(D, {
307
+ children: [/* @__PURE__ */ w(P, { children: t }), c && /* @__PURE__ */ w(D, {
308
308
  type: "button",
309
309
  variant: "text",
310
310
  size: "small",
@@ -316,7 +316,7 @@ var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null,
316
316
  },
317
317
  children: l
318
318
  })]
319
- }), /* @__PURE__ */ w(I, {
319
+ }), /* @__PURE__ */ w(F, {
320
320
  value: n,
321
321
  placeholder: o,
322
322
  onChange: (t) => {
@@ -335,7 +335,7 @@ var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null,
335
335
  value: e.value,
336
336
  label: W(e.label, r)
337
337
  }));
338
- return /* @__PURE__ */ T(B, { children: [/* @__PURE__ */ w(F, { children: t }), /* @__PURE__ */ w(k, {
338
+ return /* @__PURE__ */ T(z, { children: [/* @__PURE__ */ w(P, { children: t }), /* @__PURE__ */ w(k, {
339
339
  options: a,
340
340
  value: n,
341
341
  onChange: (t) => {
@@ -347,7 +347,7 @@ var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null,
347
347
  placeholder: t
348
348
  })] }, e.id);
349
349
  }
350
- if (e.kind === "boolean") return /* @__PURE__ */ w(B, { children: /* @__PURE__ */ w(L, {
350
+ if (e.kind === "boolean") return /* @__PURE__ */ w(z, { children: /* @__PURE__ */ w(I, {
351
351
  label: t,
352
352
  checked: typeof i == "boolean" ? i : !1,
353
353
  onChange: (t) => {
@@ -363,7 +363,7 @@ var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null,
363
363
  value: r,
364
364
  displayValue: i?.trim() ?? "",
365
365
  onPick: () => {
366
- H(e.id);
366
+ V(e.id);
367
367
  },
368
368
  onClear: () => {
369
369
  p(null), d((t) => ({
@@ -372,7 +372,7 @@ var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null,
372
372
  }));
373
373
  }
374
374
  });
375
- return /* @__PURE__ */ T(B, { children: [/* @__PURE__ */ w(F, { children: t }), r.trim() === "" ? a() : /* @__PURE__ */ w(l, {
375
+ return /* @__PURE__ */ T(z, { children: [/* @__PURE__ */ w(P, { children: t }), r.trim() === "" ? a() : /* @__PURE__ */ w(l, {
376
376
  entityId: e.entity,
377
377
  id: r,
378
378
  children: (e) => a(e)
@@ -389,11 +389,11 @@ var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null,
389
389
  }) })), /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ T(s, {
390
390
  title: W(t.title, r),
391
391
  description: t.subtitle == null ? void 0 : W(t.subtitle, r),
392
- children: [/* @__PURE__ */ T(R, {
392
+ children: [/* @__PURE__ */ T(L, {
393
393
  onSubmit: X,
394
394
  className: y,
395
395
  children: [
396
- /* @__PURE__ */ w(z, { message: f }),
396
+ /* @__PURE__ */ w(R, { message: f }),
397
397
  Z,
398
398
  /* @__PURE__ */ w("div", {
399
399
  className: v,
@@ -410,20 +410,20 @@ var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null,
410
410
  isOpen: !0,
411
411
  entity: J.entity,
412
412
  title: W(J.label, r),
413
- scope: K,
413
+ scope: G,
414
414
  onClose: () => {
415
- H(null);
415
+ V(null);
416
416
  },
417
417
  onSelectId: (e) => {
418
418
  p(null), d((t) => ({
419
419
  ...t,
420
420
  [J.id]: e
421
- })), H(null);
421
+ })), V(null);
422
422
  }
423
423
  })]
424
424
  }), $] });
425
- }, Q = ({ operation: t, toolId: n }) => {
426
- let { t: i } = E(), { t: a } = e(), o = W(t.title, i), s = t.subtitle == null ? void 0 : W(t.subtitle, i), c = d({ title: o }), l = q(t), h = a("tools.meta.idLabel"), _ = a("tools.docs.inputTypeTitle"), v = a("tools.docs.inputExampleTitle"), y = typeof t.inputTypeSDL == "string" ? t.inputTypeSDL.trim() : "", b = (() => {
425
+ }, $ = ({ operation: t, toolId: n }) => {
426
+ let { t: i } = E(), { t: a } = e(), o = W(t.title, i), s = t.subtitle == null ? void 0 : W(t.subtitle, i), c = d({ title: o }), l = J(t), h = a("tools.meta.idLabel"), _ = a("tools.docs.inputTypeTitle"), v = a("tools.docs.inputExampleTitle"), y = typeof t.inputTypeSDL == "string" ? t.inputTypeSDL.trim() : "", b = (() => {
427
427
  if (t.inputs == null) return null;
428
428
  let e = t.inputs.find((e) => e.kind === "json");
429
429
  return e == null || typeof e.defaultValue != "string" || e.defaultValue.trim() === "" ? null : e.defaultValue;
@@ -454,12 +454,12 @@ var W = (e, t) => e(t), G = (e, t) => typeof e == "function" ? e(t) : e ?? null,
454
454
  error: e,
455
455
  onRetry: t
456
456
  }),
457
- children: /* @__PURE__ */ w(Z, { operation: t })
457
+ children: /* @__PURE__ */ w(Q, { operation: t })
458
458
  })
459
459
  })
460
460
  });
461
461
  };
462
462
  //#endregion
463
- export { Q as BackofficeToolsOperationPage, Q as default };
463
+ export { $ as BackofficeToolsOperationPage, $ as default };
464
464
 
465
465
  //# sourceMappingURL=BackofficeToolsOperationPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BackofficeToolsOperationPage.js","names":[],"sources":["../../../src/pages/BackofficeToolsOperationPage.tsx"],"sourcesContent":["/* eslint-disable no-ternary */\n/* eslint-disable @typescript-eslint/no-base-to-string */\nimport {\n type JSX,\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport type { TFunction } from 'i18next';\nimport { useTranslation } from 'react-i18next';\nimport { useLazyLoadQuery } from 'react-relay';\nimport type { OperationType } from 'relay-runtime';\nimport {\n type BackofficeToolInputSpec,\n type BackofficeToolOperation,\n type BackofficeToolOutputSpec,\n type BackofficeValueLabel,\n type I18nLabel,\n BackofficeToolValidationError,\n} from '@plumile/backoffice-core/types.js';\nimport { Textarea } from '@plumile/ui/atomic/atoms/textarea/Textarea.js';\nimport { Label } from '@plumile/ui/atomic/atoms/label/Label.js';\nimport { CheckboxField } from '@plumile/ui/atomic/molecules/checkbox_field/CheckboxField.js';\nimport { Form } from '@plumile/ui/atomic/molecules/form/Form.js';\nimport { FormGroup } from '@plumile/ui/atomic/molecules/form/FormGroup.js';\nimport { FormErrorBanner } from '@plumile/ui/atomic/molecules/form/FormErrorBanner.js';\nimport { Button, SimpleSelect, DataTable } from '@plumile/ui';\nimport { HighlightCode } from '@plumile/ui/atomic/molecules/highlight/HighlightCode.js';\nimport { LazyBackofficeJsonViewer } from '@plumile/ui-backoffice/backoffice/molecules/backoffice_json_viewer/LazyBackofficeJsonViewer.js';\n\nimport { BackofficeDetailField } from '../components/backoffice/detail/BackofficeDetailField.js';\nimport { BackofficeDetailPayload } from '../components/backoffice/detail/BackofficeDetailPayload.js';\nimport { BackofficeDetailSection } from '../components/backoffice/detail/BackofficeDetailSection.js';\nimport { buildDataTableColumns } from '../components/backoffice/columns/buildDataTableColumns.js';\nimport { BackofficeErrorBoundary } from '../components/backoffice/errors/BackofficeErrorBoundary.js';\nimport { EntityFilterValueText } from '../components/backoffice/filters/EntityFilterValue.js';\nimport { EntityIdFilterField } from '../components/backoffice/filters/EntityIdFilterField.js';\nimport { EntityIdPickerDialog } from '../components/backoffice/pickers/EntityIdPickerDialog.js';\nimport { BackofficeToolsErrorFallback } from '../components/backoffice/tools/BackofficeToolsErrorFallback.js';\nimport { BackofficeToolsDocPanel } from '../components/backoffice/tools/BackofficeToolsDocPanel.js';\nimport { BackofficeToolsQueryBoundary } from '../components/backoffice/tools/BackofficeToolsQueryBoundary.js';\nimport { BackofficeToolsPageLayout } from '../components/backoffice/tools/BackofficeToolsPageLayout.js';\nimport { useBackofficeToolsParams } from '../components/backoffice/tools/BackofficeToolsParamsContext.js';\nimport { useBackofficeReactTranslation } from '../i18n/useBackofficeReactTranslation.js';\nimport { useBackofficeConfig } from '../provider/BackofficeConfigContext.js';\nimport { BackofficeRightPageLayout } from '../components/backoffice/layout/breadcrumb/BackofficeRightPageLayout.js';\nimport { buildToolBreadcrumb } from '../components/backoffice/layout/breadcrumb/buildBreadcrumbs.js';\n\nimport * as styles from '../components/backoffice/tools/backofficeToolsForm.css.js';\nimport * as docPanelStyles from '../components/backoffice/tools/backofficeToolsDocPanel.css.js';\n\nconst resolveLabel = (label: I18nLabel, tApp: TFunction): string => {\n return label(tApp);\n};\n\nconst resolveValueLabel = (\n value: BackofficeValueLabel | null | undefined,\n tApp: TFunction,\n): string | number | null => {\n if (typeof value === 'function') {\n return value(tApp);\n }\n if (value == null) {\n return null;\n }\n return value;\n};\n\ntype ToolInputValues = Record<string, unknown>;\ntype EntityIdInputSpec = Extract<BackofficeToolInputSpec, { kind: 'entityId' }>;\n\ntype BuildToolVariablesInput = {\n operation: BackofficeToolOperation;\n inputValues: ToolInputValues;\n initiativeId: string | null;\n projectId: string | null;\n run: boolean;\n};\n\nconst buildInitialInputValues = (\n inputs?: readonly BackofficeToolInputSpec[],\n): ToolInputValues => {\n const output: ToolInputValues = {};\n inputs?.forEach((input) => {\n if (input.kind === 'boolean') {\n output[input.id] = input.defaultValue ?? false;\n } else {\n output[input.id] = input.defaultValue ?? '';\n }\n });\n return output;\n};\n\nconst cleanInputValues = (values: ToolInputValues): ToolInputValues => {\n const output: ToolInputValues = {};\n Object.entries(values).forEach(([key, value]) => {\n if (value == null) {\n return;\n }\n if (typeof value === 'string') {\n const trimmed = value.trim();\n if (trimmed === '') {\n return;\n }\n output[key] = trimmed;\n return;\n }\n output[key] = value;\n });\n return output;\n};\n\nconst buildToolVariables = ({\n operation,\n inputValues,\n initiativeId,\n projectId,\n run,\n}: BuildToolVariablesInput): Record<string, unknown> => {\n const cleanedInput = cleanInputValues(inputValues);\n\n const hasProjectField = Object.prototype.hasOwnProperty.call(\n inputValues,\n 'projectId',\n );\n const hasProjectEntity =\n operation.inputs?.some((input) => {\n return input.kind === 'entityId' && input.entity === 'projects';\n }) ?? false;\n if (\n (hasProjectField || hasProjectEntity) &&\n projectId != null &&\n projectId.trim() !== ''\n ) {\n const existing = cleanedInput.projectId;\n if (existing == null || String(existing).trim() === '') {\n cleanedInput.projectId = projectId;\n }\n }\n\n const defaultVariables = {\n scope: {\n initiativeId: initiativeId ?? '',\n },\n input: cleanedInput,\n run,\n };\n\n if (operation.buildVariables == null) {\n return defaultVariables;\n }\n\n const custom = operation.buildVariables(cleanedInput, {\n scope: {\n initiativeId,\n projectId,\n },\n run,\n });\n return {\n ...defaultVariables,\n ...custom,\n };\n};\n\nconst shouldShowProjectPicker = (\n operation: BackofficeToolOperation,\n): boolean => {\n if (operation.showProjectPicker != null) {\n return operation.showProjectPicker;\n }\n const { inputs } = operation;\n if (inputs == null) {\n return false;\n }\n return inputs.some((input) => {\n if (input.kind === 'entityId' && input.entity === 'projects') {\n return true;\n }\n return input.id === 'projectId';\n });\n};\n\nconst parseInputJson = (value: string): Record<string, unknown> | null => {\n try {\n const parsed: unknown = JSON.parse(value);\n if (parsed == null || typeof parsed !== 'object' || Array.isArray(parsed)) {\n return null;\n }\n return parsed as Record<string, unknown>;\n } catch {\n return null;\n }\n};\n\nconst applyPickerUpdatesToJson = (\n currentValue: string,\n updates: Record<string, string>,\n): string | null => {\n const parsed = parseInputJson(currentValue);\n if (parsed == null) {\n return null;\n }\n\n let next = parsed;\n\n Object.entries(updates).forEach(([key, nextValue]) => {\n if (!Object.prototype.hasOwnProperty.call(parsed, key)) {\n return;\n }\n if (parsed[key] === nextValue) {\n return;\n }\n if (next === parsed) {\n next = { ...parsed };\n }\n next[key] = nextValue;\n });\n\n const nextJson = JSON.stringify(next, null, 2);\n if (nextJson === currentValue) {\n return null;\n }\n\n return nextJson;\n};\n\ntype OutputRendererProps = {\n outputs: readonly BackofficeToolOutputSpec[];\n data: unknown;\n wrapDefault?: boolean;\n};\n\nconst resolveRowId = (row: unknown, index: number): string => {\n if (row != null && typeof row === 'object') {\n const record = row as Record<string, unknown>;\n const maybeId = record.id;\n if (typeof maybeId === 'string' && maybeId.trim() !== '') {\n return maybeId;\n }\n const maybeKey = record.key;\n if (typeof maybeKey === 'string' && maybeKey.trim() !== '') {\n return maybeKey;\n }\n }\n return String(index);\n};\n\nconst OutputRenderer = ({\n outputs,\n data,\n wrapDefault = false,\n}: OutputRendererProps): JSX.Element => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const { entities } = useBackofficeConfig();\n const defaultTitle = t('tools.output');\n\n const nodes = outputs.map((output, index) => {\n if (output.kind === 'table') {\n const title =\n output.label != null ? resolveLabel(output.label, tApp) : defaultTitle;\n const description =\n output.description != null\n ? resolveLabel(output.description, tApp)\n : undefined;\n const columns = buildDataTableColumns(output.columns, {\n tApp,\n t,\n resolveEntityHref: (entityId, refId) => {\n const entity = entities[entityId];\n if (entity == null) {\n return null;\n }\n return entity.routes.detail(refId);\n },\n });\n const resolvedRows = output.rows(data);\n const rows = Array.isArray(resolvedRows) ? resolvedRows : [];\n const tableNode = (\n <DataTable\n key={`table-${index}`}\n columns={columns}\n rows={rows}\n getRowId={resolveRowId}\n />\n );\n if (wrapDefault) {\n return tableNode;\n }\n return (\n <BackofficeDetailSection\n key={`table-${index}`}\n title={title}\n description={description}\n >\n {tableNode}\n </BackofficeDetailSection>\n );\n }\n\n if (output.kind === 'code') {\n const title =\n output.label != null ? resolveLabel(output.label, tApp) : defaultTitle;\n const description =\n output.description != null\n ? resolveLabel(output.description, tApp)\n : undefined;\n const value = output.value(data);\n const codeNode = (\n <HighlightCode\n key={`code-${index}`}\n badgeLabel={title}\n copyCode={value}\n fallbackCodeText={value}\n />\n );\n if (wrapDefault) {\n return codeNode;\n }\n return (\n <BackofficeDetailSection\n key={`code-${index}`}\n title={title}\n description={description}\n >\n {codeNode}\n </BackofficeDetailSection>\n );\n }\n\n if (output.kind === 'json') {\n const title =\n output.label != null ? resolveLabel(output.label, tApp) : defaultTitle;\n const description =\n output.description != null\n ? resolveLabel(output.description, tApp)\n : undefined;\n const value = output.value(data);\n const jsonNode = (\n <LazyBackofficeJsonViewer\n key={`json-${index}`}\n value={value}\n title={title}\n />\n );\n if (wrapDefault || description == null) {\n return jsonNode;\n }\n return (\n <BackofficeDetailSection\n key={`json-${index}`}\n title={title}\n description={description}\n >\n {jsonNode}\n </BackofficeDetailSection>\n );\n }\n\n if (output.kind === 'keyValue') {\n const title =\n output.label != null ? resolveLabel(output.label, tApp) : defaultTitle;\n const description =\n output.description != null\n ? resolveLabel(output.description, tApp)\n : undefined;\n const items = output.items.map((item) => {\n const label = resolveLabel(item.label, tApp);\n const value = resolveValueLabel(item.value(data), tApp);\n return {\n id: label,\n label,\n size: 'm' as const,\n value,\n };\n });\n const gridNode = (\n <div key={`kv-${index}`} className={styles.keyValueGrid}>\n {items.map((item) => {\n return (\n <BackofficeDetailField\n key={item.id}\n id={item.id}\n label={item.label}\n size={item.size}\n value={item.value}\n />\n );\n })}\n </div>\n );\n if (wrapDefault) {\n return gridNode;\n }\n return (\n <BackofficeDetailSection\n key={`kv-${index}`}\n title={title}\n description={description}\n >\n {gridNode}\n </BackofficeDetailSection>\n );\n }\n\n if (output.kind === 'payload') {\n const title = resolveLabel(output.label, tApp);\n const description =\n output.description != null\n ? resolveLabel(output.description, tApp)\n : undefined;\n return (\n <BackofficeDetailPayload\n key={`payload-${index}`}\n title={title}\n description={description}\n content={output.value(data)}\n format={output.format}\n />\n );\n }\n\n const customNode = output.render(data) as ReactNode;\n if (wrapDefault) {\n return <div key={`custom-${index}`}>{customNode}</div>;\n }\n if (output.label != null) {\n const title = resolveLabel(output.label, tApp);\n return (\n <BackofficeDetailSection key={`custom-${index}`} title={title}>\n {customNode}\n </BackofficeDetailSection>\n );\n }\n return <div key={`custom-${index}`}>{customNode}</div>;\n });\n\n return <div className={styles.outputStack}>{nodes}</div>;\n};\n\ntype OperationOutputProps = {\n operation: BackofficeToolOperation;\n variables: Record<string, unknown>;\n fetchKey: number;\n};\n\nconst OperationOutput = ({\n operation,\n variables,\n fetchKey,\n}: OperationOutputProps): JSX.Element | null => {\n const { t } = useBackofficeReactTranslation();\n\n const data = useLazyLoadQuery<OperationType>(\n operation.query,\n variables as never,\n {\n fetchKey,\n fetchPolicy: 'store-or-network',\n },\n );\n\n if (operation.render != null) {\n const content = operation.render(data) as ReactNode;\n return <>{content}</>;\n }\n\n if (operation.outputs != null && operation.outputs.length > 0) {\n const shouldWrapDefault = operation.outputs.every((output) => {\n if (output.kind === 'payload') {\n return false;\n }\n const hasDescription =\n 'description' in output && output.description != null;\n return output.label == null && !hasDescription;\n });\n\n if (shouldWrapDefault) {\n return (\n <BackofficeDetailSection title={t('tools.output')}>\n <OutputRenderer outputs={operation.outputs} data={data} wrapDefault />\n </BackofficeDetailSection>\n );\n }\n\n return <OutputRenderer outputs={operation.outputs} data={data} />;\n }\n\n return null;\n};\n\ntype OperationContentProps = {\n operation: BackofficeToolOperation;\n};\n\nconst OperationContent = ({\n operation,\n}: OperationContentProps): JSX.Element => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const { initiativeId, projectId } = useBackofficeToolsParams();\n\n const initialInputs = useMemo(() => {\n return buildInitialInputValues(operation.inputs);\n }, [operation.inputs]);\n\n const [inputValues, setInputValues] =\n useState<ToolInputValues>(initialInputs);\n const [formError, setFormError] = useState<string | null>(null);\n const [fetchKey, setFetchKey] = useState(0);\n const [submittedVariables, setSubmittedVariables] = useState<Record<\n string,\n unknown\n > | null>(null);\n const [hasRun, setHasRun] = useState(false);\n const [activePickerId, setActivePickerId] = useState<string | null>(null);\n const previousPickerValuesRef = useRef({\n initiativeId,\n projectId,\n });\n\n const pickerScope = useMemo(() => {\n return {\n initiativeId,\n projectId,\n };\n }, [initiativeId, projectId]);\n\n useEffect(() => {\n if (operation.inputs == null) {\n return;\n }\n const hasInitiativeInput = operation.inputs.some((input) => {\n return input.id === 'initiativeId';\n });\n const hasProjectInput = operation.inputs.some((input) => {\n return input.id === 'projectId';\n });\n if (!hasInitiativeInput && !hasProjectInput) {\n return;\n }\n\n setInputValues((current) => {\n let updated = current;\n if (\n hasInitiativeInput &&\n initiativeId != null &&\n initiativeId.trim() !== ''\n ) {\n const existing = current.initiativeId;\n if (typeof existing !== 'string' || existing.trim() === '') {\n updated = { ...updated, initiativeId };\n }\n }\n\n if (hasProjectInput && projectId != null && projectId.trim() !== '') {\n const existing = current.projectId;\n if (typeof existing !== 'string' || existing.trim() === '') {\n updated = { ...updated, projectId };\n }\n }\n\n return updated;\n });\n }, [initiativeId, operation.inputs, projectId]);\n\n useEffect(() => {\n const previous = previousPickerValuesRef.current;\n const updates: Record<string, string> = {};\n\n if (previous.initiativeId !== initiativeId) {\n updates.initiativeId = initiativeId ?? '';\n }\n if (previous.projectId !== projectId) {\n updates.projectId = projectId ?? '';\n }\n\n previousPickerValuesRef.current = { initiativeId, projectId };\n\n if (Object.keys(updates).length === 0) {\n return;\n }\n\n setInputValues((current) => {\n const raw = current.inputJson;\n if (typeof raw !== 'string' || raw.trim() === '') {\n return current;\n }\n const nextJson = applyPickerUpdatesToJson(raw, updates);\n if (nextJson == null) {\n return current;\n }\n return { ...current, inputJson: nextJson };\n });\n }, [initiativeId, projectId]);\n\n const handleSubmit = useCallback(() => {\n setFormError(null);\n\n if (initiativeId == null || initiativeId.trim() === '') {\n setFormError(t('tools.errors.missingScope'));\n return;\n }\n\n let nextVariables: Record<string, unknown>;\n try {\n nextVariables = buildToolVariables({\n operation,\n inputValues,\n initiativeId,\n projectId,\n run: true,\n });\n } catch (error) {\n if (error instanceof BackofficeToolValidationError) {\n setFormError(resolveLabel(error.label, tApp));\n return;\n }\n if (error instanceof Error) {\n setFormError(error.message);\n } else {\n setFormError(t('tools.errors.unknown'));\n }\n return;\n }\n\n setSubmittedVariables(nextVariables);\n setHasRun(true);\n setFetchKey((value) => {\n return value + 1;\n });\n }, [initiativeId, inputValues, operation, projectId, t, tApp]);\n\n const activePicker = useMemo(() => {\n if (activePickerId == null || operation.inputs == null) {\n return null;\n }\n const input = operation.inputs.find((item): item is EntityIdInputSpec => {\n return item.id === activePickerId && item.kind === 'entityId';\n });\n return input ?? null;\n }, [activePickerId, operation.inputs]);\n\n const renderInputField = (input: BackofficeToolInputSpec): JSX.Element => {\n const label = resolveLabel(input.label, tApp);\n const value = inputValues[input.id];\n\n if (input.kind === 'text') {\n const resolvedValue = typeof value === 'string' ? value : '';\n const placeholder =\n input.placeholder != null\n ? resolveLabel(input.placeholder, tApp)\n : undefined;\n return (\n <FormGroup key={input.id}>\n <Label>{label}</Label>\n <Textarea\n value={resolvedValue}\n placeholder={placeholder}\n onChange={(event) => {\n setFormError(null);\n setInputValues((current) => {\n return { ...current, [input.id]: event.target.value };\n });\n }}\n rows={4}\n fullWidth\n />\n </FormGroup>\n );\n }\n\n if (input.kind === 'json') {\n const resolvedValue = typeof value === 'string' ? value : '';\n const placeholder =\n input.placeholder != null\n ? resolveLabel(input.placeholder, tApp)\n : undefined;\n const exampleValue =\n typeof input.defaultValue === 'string' ? input.defaultValue : '';\n const canInsertExample = exampleValue.trim() !== '';\n const insertLabel = t('tools.forms.actions.insertExample');\n\n return (\n <FormGroup key={input.id}>\n <div className={styles.inputHeader}>\n <Label>{label}</Label>\n {canInsertExample && (\n <Button\n type=\"button\"\n variant=\"text\"\n size=\"small\"\n onClick={() => {\n setFormError(null);\n setInputValues((current) => {\n return { ...current, [input.id]: exampleValue };\n });\n }}\n >\n {insertLabel}\n </Button>\n )}\n </div>\n <Textarea\n value={resolvedValue}\n placeholder={placeholder}\n onChange={(event) => {\n setFormError(null);\n setInputValues((current) => {\n return { ...current, [input.id]: event.target.value };\n });\n }}\n rows={6}\n fullWidth\n />\n </FormGroup>\n );\n }\n\n if (input.kind === 'enum') {\n const resolvedValue = typeof value === 'string' ? value : '';\n const options = input.options.map((option) => {\n return {\n id: option.value,\n value: option.value,\n label: resolveLabel(option.label, tApp),\n };\n });\n return (\n <FormGroup key={input.id}>\n <Label>{label}</Label>\n <SimpleSelect\n options={options}\n value={resolvedValue}\n onChange={(nextValue) => {\n setFormError(null);\n setInputValues((current) => {\n return { ...current, [input.id]: nextValue };\n });\n }}\n placeholder={label}\n />\n </FormGroup>\n );\n }\n\n if (input.kind === 'boolean') {\n const resolvedValue = typeof value === 'boolean' ? value : false;\n return (\n <FormGroup key={input.id}>\n <CheckboxField\n label={label}\n checked={resolvedValue}\n onChange={(event) => {\n setFormError(null);\n setInputValues((current) => {\n return { ...current, [input.id]: event.target.checked };\n });\n }}\n />\n </FormGroup>\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (input.kind === 'entityId') {\n const resolvedValue = typeof value === 'string' ? value : '';\n const renderField = (displayValue: string | null = null) => {\n const normalizedDisplayValue = displayValue?.trim() ?? '';\n return (\n <EntityIdFilterField\n label={label}\n value={resolvedValue}\n displayValue={normalizedDisplayValue}\n onPick={() => {\n setActivePickerId(input.id);\n }}\n onClear={() => {\n setFormError(null);\n setInputValues((current) => {\n return { ...current, [input.id]: '' };\n });\n }}\n />\n );\n };\n\n return (\n <FormGroup key={input.id}>\n <Label>{label}</Label>\n {resolvedValue.trim() === '' ? (\n renderField()\n ) : (\n <EntityFilterValueText entityId={input.entity} id={resolvedValue}>\n {(resolvedLabel) => {\n return renderField(resolvedLabel);\n }}\n </EntityFilterValueText>\n )}\n </FormGroup>\n );\n }\n\n return <></>;\n };\n\n const handleSubmitEvent = (event: React.FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n handleSubmit();\n };\n\n const formInputs = operation.inputs?.map((input) => {\n return renderInputField(input);\n });\n const isRunDisabled = initiativeId == null || initiativeId.trim() === '';\n let outputNode: ReactNode = null;\n if (hasRun && submittedVariables != null) {\n outputNode = (\n <BackofficeToolsQueryBoundary>\n <OperationOutput\n operation={operation}\n variables={submittedVariables}\n fetchKey={fetchKey}\n />\n </BackofficeToolsQueryBoundary>\n );\n }\n\n return (\n <>\n <BackofficeDetailSection\n title={resolveLabel(operation.title, tApp)}\n description={\n operation.subtitle != null\n ? resolveLabel(operation.subtitle, tApp)\n : undefined\n }\n >\n <Form onSubmit={handleSubmitEvent} className={styles.form}>\n <FormErrorBanner message={formError} />\n {formInputs}\n <div className={styles.actions}>\n <Button\n type=\"submit\"\n variant=\"primary\"\n size=\"small\"\n disabled={isRunDisabled}\n >\n {t('tools.forms.actions.run')}\n </Button>\n </div>\n </Form>\n {activePicker != null && (\n <EntityIdPickerDialog\n isOpen\n entity={activePicker.entity}\n title={resolveLabel(activePicker.label, tApp)}\n scope={pickerScope}\n onClose={() => {\n setActivePickerId(null);\n }}\n onSelectId={(id) => {\n setFormError(null);\n setInputValues((current) => {\n return { ...current, [activePicker.id]: id };\n });\n setActivePickerId(null);\n }}\n />\n )}\n </BackofficeDetailSection>\n {outputNode}\n </>\n );\n};\n\nexport type BackofficeToolsOperationPageProps = {\n operation: BackofficeToolOperation;\n toolId?: string;\n};\n\nexport const BackofficeToolsOperationPage = ({\n operation,\n toolId,\n}: BackofficeToolsOperationPageProps): JSX.Element => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n\n const title = resolveLabel(operation.title, tApp);\n const subtitle =\n operation.subtitle != null\n ? resolveLabel(operation.subtitle, tApp)\n : undefined;\n const breadcrumb = buildToolBreadcrumb({ title });\n const showProjectPicker = shouldShowProjectPicker(operation);\n const toolIdLabel = t('tools.meta.idLabel');\n const inputTypeTitle = t('tools.docs.inputTypeTitle');\n const inputExampleTitle = t('tools.docs.inputExampleTitle');\n\n const inputTypeSDL =\n typeof operation.inputTypeSDL === 'string'\n ? operation.inputTypeSDL.trim()\n : '';\n const jsonExample = (() => {\n if (operation.inputs == null) {\n return null;\n }\n const jsonInput = operation.inputs.find((input) => {\n return input.kind === 'json';\n });\n if (jsonInput == null || typeof jsonInput.defaultValue !== 'string') {\n return null;\n }\n const trimmed = jsonInput.defaultValue.trim();\n if (trimmed === '') {\n return null;\n }\n return jsonInput.defaultValue;\n })();\n\n const docPanels: ReactNode[] = [];\n if (inputTypeSDL !== '') {\n docPanels.push(\n <BackofficeToolsDocPanel\n key=\"input-type\"\n title={inputTypeTitle}\n content={inputTypeSDL}\n language=\"graphql\"\n defaultOpen\n />,\n );\n }\n if (jsonExample != null) {\n docPanels.push(\n <BackofficeToolsDocPanel\n key=\"input-example\"\n title={inputExampleTitle}\n content={jsonExample}\n language=\"json\"\n />,\n );\n }\n\n const docPanel =\n docPanels.length > 0 ? (\n <div className={docPanelStyles.panelGroup}>{docPanels}</div>\n ) : undefined;\n\n return (\n <BackofficeRightPageLayout breadcrumb={breadcrumb}>\n <BackofficeToolsPageLayout\n title={title}\n subtitle={subtitle}\n toolId={toolId}\n toolIdLabel={toolIdLabel}\n showProjectPicker={showProjectPicker}\n docPanel={docPanel}\n >\n <BackofficeErrorBoundary\n fallback={({ error, reset }) => {\n return (\n <BackofficeToolsErrorFallback error={error} onRetry={reset} />\n );\n }}\n >\n <OperationContent operation={operation} />\n </BackofficeErrorBoundary>\n </BackofficeToolsPageLayout>\n </BackofficeRightPageLayout>\n );\n};\n\nexport default BackofficeToolsOperationPage;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,IAAM,KAAgB,GAAkB,MAC/B,EAAM,EAAK,EAGd,KACJ,GACA,MAEI,OAAO,KAAU,aACZ,EAAM,EAAK,GAEhB,KACK,MAgBL,MACJ,MACoB;CACpB,IAAM,IAA0B,EAAE;AAQlC,QAPA,GAAQ,SAAS,MAAU;AACzB,EAAI,EAAM,SAAS,YACjB,EAAO,EAAM,MAAM,EAAM,gBAAgB,KAEzC,EAAO,EAAM,MAAM,EAAM,gBAAgB;GAE3C,EACK;GAGH,KAAoB,MAA6C;CACrE,IAAM,IAA0B,EAAE;AAelC,QAdA,OAAO,QAAQ,EAAO,CAAC,SAAS,CAAC,GAAK,OAAW;AAC3C,WAAS,MAGb;OAAI,OAAO,KAAU,UAAU;IAC7B,IAAM,IAAU,EAAM,MAAM;AAC5B,QAAI,MAAY,GACd;AAEF,MAAO,KAAO;AACd;;AAEF,KAAO,KAAO;;GACd,EACK;GAGH,MAAsB,EAC1B,cACA,gBACA,iBACA,cACA,aACsD;CACtD,IAAM,IAAe,EAAiB,EAAY,EAE5C,IAAkB,OAAO,UAAU,eAAe,KACtD,GACA,YACD,EACK,IACJ,EAAU,QAAQ,MAAM,MACf,EAAM,SAAS,cAAc,EAAM,WAAW,WACrD,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;KACf,EAEE,IAAyB,EAAE;AA4BjC,QA3BI,MAAiB,MACnB,EAAU,KACR,kBAAC,GAAD;EAEE,OAAO;EACP,SAAS;EACT,UAAS;EACT,aAAA;EACA,EALI,aAKJ,CACH,EAEC,KAAe,QACjB,EAAU,KACR,kBAAC,GAAD;EAEE,OAAO;EACP,SAAS;EACT,UAAS;EACT,EAJI,gBAIJ,CACH,EASD,kBAAC,GAAD;EAAuC;YACrC,kBAAC,GAAD;GACS;GACG;GACF;GACK;GACM;GACT,UAZd,EAAU,SAAS,IACjB,kBAAC,OAAD;IAAK,WAAW;cAA4B;IAAgB,CAAA,GAC1D,KAAA;aAYA,kBAAC,GAAD;IACE,WAAW,EAAE,UAAO,eAEhB,kBAAC,GAAD;KAAqC;KAAO,SAAS;KAAS,CAAA;cAIlE,kBAAC,GAAD,EAA6B,cAAa,CAAA;IAClB,CAAA;GACA,CAAA;EACF,CAAA"}
1
+ {"version":3,"file":"BackofficeToolsOperationPage.js","names":[],"sources":["../../../src/pages/BackofficeToolsOperationPage.tsx"],"sourcesContent":["/* eslint-disable no-ternary */\n/* eslint-disable @typescript-eslint/no-base-to-string */\nimport {\n type JSX,\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport type { TFunction } from 'i18next';\nimport { useTranslation } from 'react-i18next';\nimport * as ReactRelay from 'react-relay';\nimport type { OperationType } from 'relay-runtime';\nimport {\n type BackofficeToolInputSpec,\n type BackofficeToolOperation,\n type BackofficeToolOutputSpec,\n type BackofficeValueLabel,\n type I18nLabel,\n BackofficeToolValidationError,\n} from '@plumile/backoffice-core/types.js';\nimport { Textarea } from '@plumile/ui/atomic/atoms/textarea/Textarea.js';\nimport { Label } from '@plumile/ui/atomic/atoms/label/Label.js';\nimport { CheckboxField } from '@plumile/ui/atomic/molecules/checkbox_field/CheckboxField.js';\nimport { Form } from '@plumile/ui/atomic/molecules/form/Form.js';\nimport { FormGroup } from '@plumile/ui/atomic/molecules/form/FormGroup.js';\nimport { FormErrorBanner } from '@plumile/ui/atomic/molecules/form/FormErrorBanner.js';\nimport { Button, SimpleSelect, DataTable } from '@plumile/ui';\nimport { HighlightCode } from '@plumile/ui/atomic/molecules/highlight/HighlightCode.js';\nimport { LazyBackofficeJsonViewer } from '@plumile/ui/backoffice/molecules/backoffice_json_viewer/LazyBackofficeJsonViewer.js';\n\nimport { BackofficeDetailField } from '../components/backoffice/detail/BackofficeDetailField.js';\nimport { BackofficeDetailPayload } from '../components/backoffice/detail/BackofficeDetailPayload.js';\nimport { BackofficeDetailSection } from '../components/backoffice/detail/BackofficeDetailSection.js';\nimport { buildDataTableColumns } from '../components/backoffice/columns/buildDataTableColumns.js';\nimport { BackofficeErrorBoundary } from '../components/backoffice/errors/BackofficeErrorBoundary.js';\nimport { EntityFilterValueText } from '../components/backoffice/filters/EntityFilterValue.js';\nimport { EntityIdFilterField } from '../components/backoffice/filters/EntityIdFilterField.js';\nimport { EntityIdPickerDialog } from '../components/backoffice/pickers/EntityIdPickerDialog.js';\nimport { BackofficeToolsErrorFallback } from '../components/backoffice/tools/BackofficeToolsErrorFallback.js';\nimport { BackofficeToolsDocPanel } from '../components/backoffice/tools/BackofficeToolsDocPanel.js';\nimport { BackofficeToolsQueryBoundary } from '../components/backoffice/tools/BackofficeToolsQueryBoundary.js';\nimport { BackofficeToolsPageLayout } from '../components/backoffice/tools/BackofficeToolsPageLayout.js';\nimport { useBackofficeToolsParams } from '../components/backoffice/tools/BackofficeToolsParamsContext.js';\nimport { useBackofficeReactTranslation } from '../i18n/useBackofficeReactTranslation.js';\nimport { useBackofficeConfig } from '../provider/BackofficeConfigContext.js';\nimport { BackofficeRightPageLayout } from '../components/backoffice/layout/breadcrumb/BackofficeRightPageLayout.js';\nimport { buildToolBreadcrumb } from '../components/backoffice/layout/breadcrumb/buildBreadcrumbs.js';\n\nimport * as styles from '../components/backoffice/tools/backofficeToolsForm.css.js';\nimport * as docPanelStyles from '../components/backoffice/tools/backofficeToolsDocPanel.css.js';\n\nconst { useLazyLoadQuery } = ReactRelay;\n\nconst resolveLabel = (label: I18nLabel, tApp: TFunction): string => {\n return label(tApp);\n};\n\nconst resolveValueLabel = (\n value: BackofficeValueLabel | null | undefined,\n tApp: TFunction,\n): string | number | null => {\n if (typeof value === 'function') {\n return value(tApp);\n }\n if (value == null) {\n return null;\n }\n return value;\n};\n\ntype ToolInputValues = Record<string, unknown>;\ntype EntityIdInputSpec = Extract<BackofficeToolInputSpec, { kind: 'entityId' }>;\n\ntype BuildToolVariablesInput = {\n operation: BackofficeToolOperation;\n inputValues: ToolInputValues;\n initiativeId: string | null;\n projectId: string | null;\n run: boolean;\n};\n\nconst buildInitialInputValues = (\n inputs?: readonly BackofficeToolInputSpec[],\n): ToolInputValues => {\n const output: ToolInputValues = {};\n inputs?.forEach((input) => {\n if (input.kind === 'boolean') {\n output[input.id] = input.defaultValue ?? false;\n } else {\n output[input.id] = input.defaultValue ?? '';\n }\n });\n return output;\n};\n\nconst cleanInputValues = (values: ToolInputValues): ToolInputValues => {\n const output: ToolInputValues = {};\n Object.entries(values).forEach(([key, value]) => {\n if (value == null) {\n return;\n }\n if (typeof value === 'string') {\n const trimmed = value.trim();\n if (trimmed === '') {\n return;\n }\n output[key] = trimmed;\n return;\n }\n output[key] = value;\n });\n return output;\n};\n\nconst buildToolVariables = ({\n operation,\n inputValues,\n initiativeId,\n projectId,\n run,\n}: BuildToolVariablesInput): Record<string, unknown> => {\n const cleanedInput = cleanInputValues(inputValues);\n\n const hasProjectField = Object.prototype.hasOwnProperty.call(\n inputValues,\n 'projectId',\n );\n const hasProjectEntity =\n operation.inputs?.some((input) => {\n return input.kind === 'entityId' && input.entity === 'projects';\n }) ?? false;\n if (\n (hasProjectField || hasProjectEntity) &&\n projectId != null &&\n projectId.trim() !== ''\n ) {\n const existing = cleanedInput.projectId;\n if (existing == null || String(existing).trim() === '') {\n cleanedInput.projectId = projectId;\n }\n }\n\n const defaultVariables = {\n scope: {\n initiativeId: initiativeId ?? '',\n },\n input: cleanedInput,\n run,\n };\n\n if (operation.buildVariables == null) {\n return defaultVariables;\n }\n\n const custom = operation.buildVariables(cleanedInput, {\n scope: {\n initiativeId,\n projectId,\n },\n run,\n });\n return {\n ...defaultVariables,\n ...custom,\n };\n};\n\nconst shouldShowProjectPicker = (\n operation: BackofficeToolOperation,\n): boolean => {\n if (operation.showProjectPicker != null) {\n return operation.showProjectPicker;\n }\n const { inputs } = operation;\n if (inputs == null) {\n return false;\n }\n return inputs.some((input) => {\n if (input.kind === 'entityId' && input.entity === 'projects') {\n return true;\n }\n return input.id === 'projectId';\n });\n};\n\nconst parseInputJson = (value: string): Record<string, unknown> | null => {\n try {\n const parsed: unknown = JSON.parse(value);\n if (parsed == null || typeof parsed !== 'object' || Array.isArray(parsed)) {\n return null;\n }\n return parsed as Record<string, unknown>;\n } catch {\n return null;\n }\n};\n\nconst applyPickerUpdatesToJson = (\n currentValue: string,\n updates: Record<string, string>,\n): string | null => {\n const parsed = parseInputJson(currentValue);\n if (parsed == null) {\n return null;\n }\n\n let next = parsed;\n\n Object.entries(updates).forEach(([key, nextValue]) => {\n if (!Object.prototype.hasOwnProperty.call(parsed, key)) {\n return;\n }\n if (parsed[key] === nextValue) {\n return;\n }\n if (next === parsed) {\n next = { ...parsed };\n }\n next[key] = nextValue;\n });\n\n const nextJson = JSON.stringify(next, null, 2);\n if (nextJson === currentValue) {\n return null;\n }\n\n return nextJson;\n};\n\ntype OutputRendererProps = {\n outputs: readonly BackofficeToolOutputSpec[];\n data: unknown;\n wrapDefault?: boolean;\n};\n\nconst resolveRowId = (row: unknown, index: number): string => {\n if (row != null && typeof row === 'object') {\n const record = row as Record<string, unknown>;\n const maybeId = record.id;\n if (typeof maybeId === 'string' && maybeId.trim() !== '') {\n return maybeId;\n }\n const maybeKey = record.key;\n if (typeof maybeKey === 'string' && maybeKey.trim() !== '') {\n return maybeKey;\n }\n }\n return String(index);\n};\n\nconst OutputRenderer = ({\n outputs,\n data,\n wrapDefault = false,\n}: OutputRendererProps): JSX.Element => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const { entities } = useBackofficeConfig();\n const defaultTitle = t('tools.output');\n\n const nodes = outputs.map((output, index) => {\n if (output.kind === 'table') {\n const title =\n output.label != null ? resolveLabel(output.label, tApp) : defaultTitle;\n const description =\n output.description != null\n ? resolveLabel(output.description, tApp)\n : undefined;\n const columns = buildDataTableColumns(output.columns, {\n tApp,\n t,\n resolveEntityHref: (entityId, refId) => {\n const entity = entities[entityId];\n if (entity == null) {\n return null;\n }\n return entity.routes.detail(refId);\n },\n });\n const resolvedRows = output.rows(data);\n const rows = Array.isArray(resolvedRows) ? resolvedRows : [];\n const tableNode = (\n <DataTable\n key={`table-${index}`}\n columns={columns}\n rows={rows}\n getRowId={resolveRowId}\n />\n );\n if (wrapDefault) {\n return tableNode;\n }\n return (\n <BackofficeDetailSection\n key={`table-${index}`}\n title={title}\n description={description}\n >\n {tableNode}\n </BackofficeDetailSection>\n );\n }\n\n if (output.kind === 'code') {\n const title =\n output.label != null ? resolveLabel(output.label, tApp) : defaultTitle;\n const description =\n output.description != null\n ? resolveLabel(output.description, tApp)\n : undefined;\n const value = output.value(data);\n const codeNode = (\n <HighlightCode\n key={`code-${index}`}\n badgeLabel={title}\n copyCode={value}\n fallbackCodeText={value}\n />\n );\n if (wrapDefault) {\n return codeNode;\n }\n return (\n <BackofficeDetailSection\n key={`code-${index}`}\n title={title}\n description={description}\n >\n {codeNode}\n </BackofficeDetailSection>\n );\n }\n\n if (output.kind === 'json') {\n const title =\n output.label != null ? resolveLabel(output.label, tApp) : defaultTitle;\n const description =\n output.description != null\n ? resolveLabel(output.description, tApp)\n : undefined;\n const value = output.value(data);\n const jsonNode = (\n <LazyBackofficeJsonViewer\n key={`json-${index}`}\n value={value}\n title={title}\n />\n );\n if (wrapDefault || description == null) {\n return jsonNode;\n }\n return (\n <BackofficeDetailSection\n key={`json-${index}`}\n title={title}\n description={description}\n >\n {jsonNode}\n </BackofficeDetailSection>\n );\n }\n\n if (output.kind === 'keyValue') {\n const title =\n output.label != null ? resolveLabel(output.label, tApp) : defaultTitle;\n const description =\n output.description != null\n ? resolveLabel(output.description, tApp)\n : undefined;\n const items = output.items.map((item) => {\n const label = resolveLabel(item.label, tApp);\n const value = resolveValueLabel(item.value(data), tApp);\n return {\n id: label,\n label,\n size: 'm' as const,\n value,\n };\n });\n const gridNode = (\n <div key={`kv-${index}`} className={styles.keyValueGrid}>\n {items.map((item) => {\n return (\n <BackofficeDetailField\n key={item.id}\n id={item.id}\n label={item.label}\n size={item.size}\n value={item.value}\n />\n );\n })}\n </div>\n );\n if (wrapDefault) {\n return gridNode;\n }\n return (\n <BackofficeDetailSection\n key={`kv-${index}`}\n title={title}\n description={description}\n >\n {gridNode}\n </BackofficeDetailSection>\n );\n }\n\n if (output.kind === 'payload') {\n const title = resolveLabel(output.label, tApp);\n const description =\n output.description != null\n ? resolveLabel(output.description, tApp)\n : undefined;\n return (\n <BackofficeDetailPayload\n key={`payload-${index}`}\n title={title}\n description={description}\n content={output.value(data)}\n format={output.format}\n />\n );\n }\n\n const customNode = output.render(data) as ReactNode;\n if (wrapDefault) {\n return <div key={`custom-${index}`}>{customNode}</div>;\n }\n if (output.label != null) {\n const title = resolveLabel(output.label, tApp);\n return (\n <BackofficeDetailSection key={`custom-${index}`} title={title}>\n {customNode}\n </BackofficeDetailSection>\n );\n }\n return <div key={`custom-${index}`}>{customNode}</div>;\n });\n\n return <div className={styles.outputStack}>{nodes}</div>;\n};\n\ntype OperationOutputProps = {\n operation: BackofficeToolOperation;\n variables: Record<string, unknown>;\n fetchKey: number;\n};\n\nconst OperationOutput = ({\n operation,\n variables,\n fetchKey,\n}: OperationOutputProps): JSX.Element | null => {\n const { t } = useBackofficeReactTranslation();\n\n const data = useLazyLoadQuery<OperationType>(\n operation.query,\n variables as never,\n {\n fetchKey,\n fetchPolicy: 'store-or-network',\n },\n );\n\n if (operation.render != null) {\n const content = operation.render(data) as ReactNode;\n return <>{content}</>;\n }\n\n if (operation.outputs != null && operation.outputs.length > 0) {\n const shouldWrapDefault = operation.outputs.every((output) => {\n if (output.kind === 'payload') {\n return false;\n }\n const hasDescription =\n 'description' in output && output.description != null;\n return output.label == null && !hasDescription;\n });\n\n if (shouldWrapDefault) {\n return (\n <BackofficeDetailSection title={t('tools.output')}>\n <OutputRenderer outputs={operation.outputs} data={data} wrapDefault />\n </BackofficeDetailSection>\n );\n }\n\n return <OutputRenderer outputs={operation.outputs} data={data} />;\n }\n\n return null;\n};\n\ntype OperationContentProps = {\n operation: BackofficeToolOperation;\n};\n\nconst OperationContent = ({\n operation,\n}: OperationContentProps): JSX.Element => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const { initiativeId, projectId } = useBackofficeToolsParams();\n\n const initialInputs = useMemo(() => {\n return buildInitialInputValues(operation.inputs);\n }, [operation.inputs]);\n\n const [inputValues, setInputValues] =\n useState<ToolInputValues>(initialInputs);\n const [formError, setFormError] = useState<string | null>(null);\n const [fetchKey, setFetchKey] = useState(0);\n const [submittedVariables, setSubmittedVariables] = useState<Record<\n string,\n unknown\n > | null>(null);\n const [hasRun, setHasRun] = useState(false);\n const [activePickerId, setActivePickerId] = useState<string | null>(null);\n const previousPickerValuesRef = useRef({\n initiativeId,\n projectId,\n });\n\n const pickerScope = useMemo(() => {\n return {\n initiativeId,\n projectId,\n };\n }, [initiativeId, projectId]);\n\n useEffect(() => {\n if (operation.inputs == null) {\n return;\n }\n const hasInitiativeInput = operation.inputs.some((input) => {\n return input.id === 'initiativeId';\n });\n const hasProjectInput = operation.inputs.some((input) => {\n return input.id === 'projectId';\n });\n if (!hasInitiativeInput && !hasProjectInput) {\n return;\n }\n\n setInputValues((current) => {\n let updated = current;\n if (\n hasInitiativeInput &&\n initiativeId != null &&\n initiativeId.trim() !== ''\n ) {\n const existing = current.initiativeId;\n if (typeof existing !== 'string' || existing.trim() === '') {\n updated = { ...updated, initiativeId };\n }\n }\n\n if (hasProjectInput && projectId != null && projectId.trim() !== '') {\n const existing = current.projectId;\n if (typeof existing !== 'string' || existing.trim() === '') {\n updated = { ...updated, projectId };\n }\n }\n\n return updated;\n });\n }, [initiativeId, operation.inputs, projectId]);\n\n useEffect(() => {\n const previous = previousPickerValuesRef.current;\n const updates: Record<string, string> = {};\n\n if (previous.initiativeId !== initiativeId) {\n updates.initiativeId = initiativeId ?? '';\n }\n if (previous.projectId !== projectId) {\n updates.projectId = projectId ?? '';\n }\n\n previousPickerValuesRef.current = { initiativeId, projectId };\n\n if (Object.keys(updates).length === 0) {\n return;\n }\n\n setInputValues((current) => {\n const raw = current.inputJson;\n if (typeof raw !== 'string' || raw.trim() === '') {\n return current;\n }\n const nextJson = applyPickerUpdatesToJson(raw, updates);\n if (nextJson == null) {\n return current;\n }\n return { ...current, inputJson: nextJson };\n });\n }, [initiativeId, projectId]);\n\n const handleSubmit = useCallback(() => {\n setFormError(null);\n\n if (initiativeId == null || initiativeId.trim() === '') {\n setFormError(t('tools.errors.missingScope'));\n return;\n }\n\n let nextVariables: Record<string, unknown>;\n try {\n nextVariables = buildToolVariables({\n operation,\n inputValues,\n initiativeId,\n projectId,\n run: true,\n });\n } catch (error) {\n if (error instanceof BackofficeToolValidationError) {\n setFormError(resolveLabel(error.label, tApp));\n return;\n }\n if (error instanceof Error) {\n setFormError(error.message);\n } else {\n setFormError(t('tools.errors.unknown'));\n }\n return;\n }\n\n setSubmittedVariables(nextVariables);\n setHasRun(true);\n setFetchKey((value) => {\n return value + 1;\n });\n }, [initiativeId, inputValues, operation, projectId, t, tApp]);\n\n const activePicker = useMemo(() => {\n if (activePickerId == null || operation.inputs == null) {\n return null;\n }\n const input = operation.inputs.find((item): item is EntityIdInputSpec => {\n return item.id === activePickerId && item.kind === 'entityId';\n });\n return input ?? null;\n }, [activePickerId, operation.inputs]);\n\n const renderInputField = (input: BackofficeToolInputSpec): JSX.Element => {\n const label = resolveLabel(input.label, tApp);\n const value = inputValues[input.id];\n\n if (input.kind === 'text') {\n const resolvedValue = typeof value === 'string' ? value : '';\n const placeholder =\n input.placeholder != null\n ? resolveLabel(input.placeholder, tApp)\n : undefined;\n return (\n <FormGroup key={input.id}>\n <Label>{label}</Label>\n <Textarea\n value={resolvedValue}\n placeholder={placeholder}\n onChange={(event) => {\n setFormError(null);\n setInputValues((current) => {\n return { ...current, [input.id]: event.target.value };\n });\n }}\n rows={4}\n fullWidth\n />\n </FormGroup>\n );\n }\n\n if (input.kind === 'json') {\n const resolvedValue = typeof value === 'string' ? value : '';\n const placeholder =\n input.placeholder != null\n ? resolveLabel(input.placeholder, tApp)\n : undefined;\n const exampleValue =\n typeof input.defaultValue === 'string' ? input.defaultValue : '';\n const canInsertExample = exampleValue.trim() !== '';\n const insertLabel = t('tools.forms.actions.insertExample');\n\n return (\n <FormGroup key={input.id}>\n <div className={styles.inputHeader}>\n <Label>{label}</Label>\n {canInsertExample && (\n <Button\n type=\"button\"\n variant=\"text\"\n size=\"small\"\n onClick={() => {\n setFormError(null);\n setInputValues((current) => {\n return { ...current, [input.id]: exampleValue };\n });\n }}\n >\n {insertLabel}\n </Button>\n )}\n </div>\n <Textarea\n value={resolvedValue}\n placeholder={placeholder}\n onChange={(event) => {\n setFormError(null);\n setInputValues((current) => {\n return { ...current, [input.id]: event.target.value };\n });\n }}\n rows={6}\n fullWidth\n />\n </FormGroup>\n );\n }\n\n if (input.kind === 'enum') {\n const resolvedValue = typeof value === 'string' ? value : '';\n const options = input.options.map((option) => {\n return {\n id: option.value,\n value: option.value,\n label: resolveLabel(option.label, tApp),\n };\n });\n return (\n <FormGroup key={input.id}>\n <Label>{label}</Label>\n <SimpleSelect\n options={options}\n value={resolvedValue}\n onChange={(nextValue) => {\n setFormError(null);\n setInputValues((current) => {\n return { ...current, [input.id]: nextValue };\n });\n }}\n placeholder={label}\n />\n </FormGroup>\n );\n }\n\n if (input.kind === 'boolean') {\n const resolvedValue = typeof value === 'boolean' ? value : false;\n return (\n <FormGroup key={input.id}>\n <CheckboxField\n label={label}\n checked={resolvedValue}\n onChange={(event) => {\n setFormError(null);\n setInputValues((current) => {\n return { ...current, [input.id]: event.target.checked };\n });\n }}\n />\n </FormGroup>\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (input.kind === 'entityId') {\n const resolvedValue = typeof value === 'string' ? value : '';\n const renderField = (displayValue: string | null = null) => {\n const normalizedDisplayValue = displayValue?.trim() ?? '';\n return (\n <EntityIdFilterField\n label={label}\n value={resolvedValue}\n displayValue={normalizedDisplayValue}\n onPick={() => {\n setActivePickerId(input.id);\n }}\n onClear={() => {\n setFormError(null);\n setInputValues((current) => {\n return { ...current, [input.id]: '' };\n });\n }}\n />\n );\n };\n\n return (\n <FormGroup key={input.id}>\n <Label>{label}</Label>\n {resolvedValue.trim() === '' ? (\n renderField()\n ) : (\n <EntityFilterValueText entityId={input.entity} id={resolvedValue}>\n {(resolvedLabel) => {\n return renderField(resolvedLabel);\n }}\n </EntityFilterValueText>\n )}\n </FormGroup>\n );\n }\n\n return <></>;\n };\n\n const handleSubmitEvent = (event: React.FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n handleSubmit();\n };\n\n const formInputs = operation.inputs?.map((input) => {\n return renderInputField(input);\n });\n const isRunDisabled = initiativeId == null || initiativeId.trim() === '';\n let outputNode: ReactNode = null;\n if (hasRun && submittedVariables != null) {\n outputNode = (\n <BackofficeToolsQueryBoundary>\n <OperationOutput\n operation={operation}\n variables={submittedVariables}\n fetchKey={fetchKey}\n />\n </BackofficeToolsQueryBoundary>\n );\n }\n\n return (\n <>\n <BackofficeDetailSection\n title={resolveLabel(operation.title, tApp)}\n description={\n operation.subtitle != null\n ? resolveLabel(operation.subtitle, tApp)\n : undefined\n }\n >\n <Form onSubmit={handleSubmitEvent} className={styles.form}>\n <FormErrorBanner message={formError} />\n {formInputs}\n <div className={styles.actions}>\n <Button\n type=\"submit\"\n variant=\"primary\"\n size=\"small\"\n disabled={isRunDisabled}\n >\n {t('tools.forms.actions.run')}\n </Button>\n </div>\n </Form>\n {activePicker != null && (\n <EntityIdPickerDialog\n isOpen\n entity={activePicker.entity}\n title={resolveLabel(activePicker.label, tApp)}\n scope={pickerScope}\n onClose={() => {\n setActivePickerId(null);\n }}\n onSelectId={(id) => {\n setFormError(null);\n setInputValues((current) => {\n return { ...current, [activePicker.id]: id };\n });\n setActivePickerId(null);\n }}\n />\n )}\n </BackofficeDetailSection>\n {outputNode}\n </>\n );\n};\n\nexport type BackofficeToolsOperationPageProps = {\n operation: BackofficeToolOperation;\n toolId?: string;\n};\n\nexport const BackofficeToolsOperationPage = ({\n operation,\n toolId,\n}: BackofficeToolsOperationPageProps): JSX.Element => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n\n const title = resolveLabel(operation.title, tApp);\n const subtitle =\n operation.subtitle != null\n ? resolveLabel(operation.subtitle, tApp)\n : undefined;\n const breadcrumb = buildToolBreadcrumb({ title });\n const showProjectPicker = shouldShowProjectPicker(operation);\n const toolIdLabel = t('tools.meta.idLabel');\n const inputTypeTitle = t('tools.docs.inputTypeTitle');\n const inputExampleTitle = t('tools.docs.inputExampleTitle');\n\n const inputTypeSDL =\n typeof operation.inputTypeSDL === 'string'\n ? operation.inputTypeSDL.trim()\n : '';\n const jsonExample = (() => {\n if (operation.inputs == null) {\n return null;\n }\n const jsonInput = operation.inputs.find((input) => {\n return input.kind === 'json';\n });\n if (jsonInput == null || typeof jsonInput.defaultValue !== 'string') {\n return null;\n }\n const trimmed = jsonInput.defaultValue.trim();\n if (trimmed === '') {\n return null;\n }\n return jsonInput.defaultValue;\n })();\n\n const docPanels: ReactNode[] = [];\n if (inputTypeSDL !== '') {\n docPanels.push(\n <BackofficeToolsDocPanel\n key=\"input-type\"\n title={inputTypeTitle}\n content={inputTypeSDL}\n language=\"graphql\"\n defaultOpen\n />,\n );\n }\n if (jsonExample != null) {\n docPanels.push(\n <BackofficeToolsDocPanel\n key=\"input-example\"\n title={inputExampleTitle}\n content={jsonExample}\n language=\"json\"\n />,\n );\n }\n\n const docPanel =\n docPanels.length > 0 ? (\n <div className={docPanelStyles.panelGroup}>{docPanels}</div>\n ) : undefined;\n\n return (\n <BackofficeRightPageLayout breadcrumb={breadcrumb}>\n <BackofficeToolsPageLayout\n title={title}\n subtitle={subtitle}\n toolId={toolId}\n toolIdLabel={toolIdLabel}\n showProjectPicker={showProjectPicker}\n docPanel={docPanel}\n >\n <BackofficeErrorBoundary\n fallback={({ error, reset }) => {\n return (\n <BackofficeToolsErrorFallback error={error} onRetry={reset} />\n );\n }}\n >\n <OperationContent operation={operation} />\n </BackofficeErrorBoundary>\n </BackofficeToolsPageLayout>\n </BackofficeRightPageLayout>\n );\n};\n\nexport default BackofficeToolsOperationPage;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,IAAM,EAAE,wBAAqB,GAEvB,KAAgB,GAAkB,MAC/B,EAAM,EAAK,EAGd,KACJ,GACA,MAEI,OAAO,KAAU,aACZ,EAAM,EAAK,GAEhB,KACK,MAgBL,KACJ,MACoB;CACpB,IAAM,IAA0B,EAAE;AAQlC,QAPA,GAAQ,SAAS,MAAU;AACzB,EAAI,EAAM,SAAS,YACjB,EAAO,EAAM,MAAM,EAAM,gBAAgB,KAEzC,EAAO,EAAM,MAAM,EAAM,gBAAgB;GAE3C,EACK;GAGH,KAAoB,MAA6C;CACrE,IAAM,IAA0B,EAAE;AAelC,QAdA,OAAO,QAAQ,EAAO,CAAC,SAAS,CAAC,GAAK,OAAW;AAC3C,WAAS,MAGb;OAAI,OAAO,KAAU,UAAU;IAC7B,IAAM,IAAU,EAAM,MAAM;AAC5B,QAAI,MAAY,GACd;AAEF,MAAO,KAAO;AACd;;AAEF,KAAO,KAAO;;GACd,EACK;GAGH,MAAsB,EAC1B,cACA,gBACA,iBACA,cACA,aACsD;CACtD,IAAM,IAAe,EAAiB,EAAY,EAE5C,IAAkB,OAAO,UAAU,eAAe,KACtD,GACA,YACD,EACK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AAO,EAAU,gBAAiB,YAG3C,EAAU,aAAa,MAAM,KAC7B,KACP,OAEF,EAAU;KACf,EAEE,IAAyB,EAAE;AA4BjC,QA3BI,MAAiB,MACnB,EAAU,KACR,kBAAC,GAAD;EAEE,OAAO;EACP,SAAS;EACT,UAAS;EACT,aAAA;EACA,EALI,aAKJ,CACH,EAEC,KAAe,QACjB,EAAU,KACR,kBAAC,GAAD;EAEE,OAAO;EACP,SAAS;EACT,UAAS;EACT,EAJI,gBAIJ,CACH,EASD,kBAAC,GAAD;EAAuC;YACrC,kBAAC,GAAD;GACS;GACG;GACF;GACK;GACM;GACT,UAZd,EAAU,SAAS,IACjB,kBAAC,OAAD;IAAK,WAAW;cAA4B;IAAgB,CAAA,GAC1D,KAAA;aAYA,kBAAC,GAAD;IACE,WAAW,EAAE,UAAO,eAEhB,kBAAC,GAAD;KAAqC;KAAO,SAAS;KAAS,CAAA;cAIlE,kBAAC,GAAD,EAA6B,cAAa,CAAA;IAClB,CAAA;GACA,CAAA;EACF,CAAA"}
@@ -6,15 +6,15 @@ import { useBackofficeAuthVerifyEmailConfig as a } from "../provider/useBackoffi
6
6
  import { getBackofficeLoginPath as o } from "../router/backofficeAuthPaths.js";
7
7
  import { jsx as s } from "react/jsx-runtime";
8
8
  import { useCallback as c, useContext as l } from "react";
9
- import { useMutation as u } from "react-relay";
9
+ import * as u from "react-relay";
10
10
  import { RoutingContext as d } from "@plumile/router";
11
11
  //#region src/pages/BackofficeVerifyEmailPage.tsx
12
- var f = () => {
13
- let f = l(d), { basePath: p } = i(), m = a(), { t: h } = e(), [g] = u(m.verifyEmailMutation);
12
+ var { useMutation: f } = u, p = () => {
13
+ let u = l(d), { basePath: p } = i(), m = a(), { t: h } = e(), [g] = f(m.verifyEmailMutation);
14
14
  return /* @__PURE__ */ s(t, {
15
15
  onBackToLogin: c(() => {
16
- f?.history.push({ pathname: o(p) });
17
- }, [p, f?.history]),
16
+ u?.history.push({ pathname: o(p) });
17
+ }, [p, u?.history]),
18
18
  onVerifyEmail: c(async (e) => {
19
19
  let t = h("auth.verifyEmail.errors.invalid"), i = t;
20
20
  return new Promise((a, o) => {
@@ -54,6 +54,6 @@ var f = () => {
54
54
  });
55
55
  };
56
56
  //#endregion
57
- export { f as BackofficeVerifyEmailPage, f as default };
57
+ export { p as BackofficeVerifyEmailPage, p as default };
58
58
 
59
59
  //# sourceMappingURL=BackofficeVerifyEmailPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BackofficeVerifyEmailPage.js","names":[],"sources":["../../../src/pages/BackofficeVerifyEmailPage.tsx"],"sourcesContent":["import { useCallback, useContext, type JSX } from 'react';\nimport { useMutation } from 'react-relay';\nimport type { MutationParameters } from 'relay-runtime';\nimport { RoutingContext } from '@plumile/router';\n\nimport { VerifyEmailScreen } from '../auth/pages/VerifyEmailScreen.js';\nimport {\n type MutationPayloadBase,\n requireField,\n resolveMutationOutcome,\n} from '../relay/mutationResult.js';\nimport { useSharedTranslation } from '../i18n/useSharedTranslation.js';\nimport { useBackofficeConfig } from '../provider/BackofficeConfigContext.js';\nimport { useBackofficeAuthVerifyEmailConfig } from '../provider/useBackofficeLazyValue.js';\nimport { getBackofficeLoginPath } from '../router/backofficeAuthPaths.js';\n\ntype VerifyEmailErrorReason =\n | 'INVALID_TOKEN'\n | 'TOKEN_EXPIRED'\n | 'ALREADY_VERIFIED'\n | 'INTERNAL_ERROR';\n\ntype VerifyEmailMutationPayload =\n MutationPayloadBase<VerifyEmailErrorReason> & {\n success?: boolean | null;\n };\n\nexport const BackofficeVerifyEmailPage = (): JSX.Element => {\n const routerContext = useContext(RoutingContext);\n const { basePath } = useBackofficeConfig();\n const auth = useBackofficeAuthVerifyEmailConfig();\n const { t } = useSharedTranslation();\n type VerifyEmailMutation = MutationParameters & {\n response: { verifyEmail?: VerifyEmailMutationPayload | null };\n variables: { input: { token: string } };\n };\n const [commitVerify] = useMutation<VerifyEmailMutation>(\n auth.verifyEmailMutation,\n );\n\n const handleBackToLogin = useCallback(() => {\n routerContext?.history.push({ pathname: getBackofficeLoginPath(basePath) });\n }, [basePath, routerContext?.history]);\n\n const handleVerifyEmail = useCallback(\n async (input: { token: string }): Promise<boolean> => {\n const invalidMessage = t('auth.verifyEmail.errors.invalid');\n const defaultErrorMessage = invalidMessage;\n\n return new Promise((resolve, reject) => {\n commitVerify({\n variables: {\n input,\n },\n onCompleted: (response) => {\n const outcome = resolveMutationOutcome(\n response.verifyEmail ?? null,\n {\n defaultErrorMessage,\n mapReason: (reason) => {\n switch (reason) {\n case 'INVALID_TOKEN':\n return invalidMessage;\n case 'TOKEN_EXPIRED':\n return t('auth.verifyEmail.errors.expired');\n case 'ALREADY_VERIFIED':\n return t('auth.verifyEmail.errors.alreadyVerified');\n case 'INTERNAL_ERROR':\n return invalidMessage;\n default:\n return null;\n }\n },\n },\n );\n if (!outcome.ok) {\n reject(new Error(outcome.message));\n return;\n }\n\n const successResult = requireField(\n outcome.payload.success ?? null,\n defaultErrorMessage,\n );\n if (!successResult.ok) {\n reject(new Error(successResult.message));\n return;\n }\n resolve(successResult.value);\n },\n onError: (mutationError) => {\n let error = new Error(defaultErrorMessage);\n if (mutationError instanceof Error) {\n error = mutationError;\n }\n reject(error);\n },\n });\n });\n },\n [commitVerify, t],\n );\n\n return (\n <VerifyEmailScreen\n onBackToLogin={handleBackToLogin}\n onVerifyEmail={handleVerifyEmail}\n />\n );\n};\n\nexport default BackofficeVerifyEmailPage;\n"],"mappings":";;;;;;;;;;;AA2BA,IAAa,UAA+C;CAC1D,IAAM,IAAgB,EAAW,EAAe,EAC1C,EAAE,gBAAa,GAAqB,EACpC,IAAO,GAAoC,EAC3C,EAAE,SAAM,GAAsB,EAK9B,CAAC,KAAgB,EACrB,EAAK,oBACN;AAiED,QACE,kBAAC,GAAD;EACE,eAjEsB,QAAkB;AAC1C,MAAe,QAAQ,KAAK,EAAE,UAAU,EAAuB,EAAS,EAAE,CAAC;KAC1E,CAAC,GAAU,GAAe,QAAQ,CAAC;EAgElC,eA9DsB,EACxB,OAAO,MAA+C;GACpD,IAAM,IAAiB,EAAE,kCAAkC,EACrD,IAAsB;AAE5B,UAAO,IAAI,SAAS,GAAS,MAAW;AACtC,MAAa;KACX,WAAW,EACT,UACD;KACD,cAAc,MAAa;MACzB,IAAM,IAAU,EACd,EAAS,eAAe,MACxB;OACE;OACA,YAAY,MAAW;AACrB,gBAAQ,GAAR;SACE,KAAK,gBACH,QAAO;SACT,KAAK,gBACH,QAAO,EAAE,kCAAkC;SAC7C,KAAK,mBACH,QAAO,EAAE,0CAA0C;SACrD,KAAK,iBACH,QAAO;SACT,QACE,QAAO;;;OAGd,CACF;AACD,UAAI,CAAC,EAAQ,IAAI;AACf,SAAW,MAAM,EAAQ,QAAQ,CAAC;AAClC;;MAGF,IAAM,IAAgB,EACpB,EAAQ,QAAQ,WAAW,MAC3B,EACD;AACD,UAAI,CAAC,EAAc,IAAI;AACrB,SAAW,MAAM,EAAc,QAAQ,CAAC;AACxC;;AAEF,QAAQ,EAAc,MAAM;;KAE9B,UAAU,MAAkB;MAC1B,IAAI,IAAY,MAAM,EAAoB;AAI1C,MAHI,aAAyB,UAC3B,IAAQ,IAEV,EAAO,EAAM;;KAEhB,CAAC;KACF;KAEJ,CAAC,GAAc,EAAE,CAClB;EAMG,CAAA"}
1
+ {"version":3,"file":"BackofficeVerifyEmailPage.js","names":[],"sources":["../../../src/pages/BackofficeVerifyEmailPage.tsx"],"sourcesContent":["import { useCallback, useContext, type JSX } from 'react';\nimport * as ReactRelay from 'react-relay';\nimport type { MutationParameters } from 'relay-runtime';\nimport { RoutingContext } from '@plumile/router';\n\nimport { VerifyEmailScreen } from '../auth/pages/VerifyEmailScreen.js';\nimport {\n type MutationPayloadBase,\n requireField,\n resolveMutationOutcome,\n} from '../relay/mutationResult.js';\nimport { useSharedTranslation } from '../i18n/useSharedTranslation.js';\nimport { useBackofficeConfig } from '../provider/BackofficeConfigContext.js';\nimport { useBackofficeAuthVerifyEmailConfig } from '../provider/useBackofficeLazyValue.js';\nimport { getBackofficeLoginPath } from '../router/backofficeAuthPaths.js';\n\nconst { useMutation } = ReactRelay;\n\ntype VerifyEmailErrorReason =\n | 'INVALID_TOKEN'\n | 'TOKEN_EXPIRED'\n | 'ALREADY_VERIFIED'\n | 'INTERNAL_ERROR';\n\ntype VerifyEmailMutationPayload =\n MutationPayloadBase<VerifyEmailErrorReason> & {\n success?: boolean | null;\n };\n\nexport const BackofficeVerifyEmailPage = (): JSX.Element => {\n const routerContext = useContext(RoutingContext);\n const { basePath } = useBackofficeConfig();\n const auth = useBackofficeAuthVerifyEmailConfig();\n const { t } = useSharedTranslation();\n type VerifyEmailMutation = MutationParameters & {\n response: { verifyEmail?: VerifyEmailMutationPayload | null };\n variables: { input: { token: string } };\n };\n const [commitVerify] = useMutation<VerifyEmailMutation>(\n auth.verifyEmailMutation,\n );\n\n const handleBackToLogin = useCallback(() => {\n routerContext?.history.push({ pathname: getBackofficeLoginPath(basePath) });\n }, [basePath, routerContext?.history]);\n\n const handleVerifyEmail = useCallback(\n async (input: { token: string }): Promise<boolean> => {\n const invalidMessage = t('auth.verifyEmail.errors.invalid');\n const defaultErrorMessage = invalidMessage;\n\n return new Promise((resolve, reject) => {\n commitVerify({\n variables: {\n input,\n },\n onCompleted: (response) => {\n const outcome = resolveMutationOutcome(\n response.verifyEmail ?? null,\n {\n defaultErrorMessage,\n mapReason: (reason) => {\n switch (reason) {\n case 'INVALID_TOKEN':\n return invalidMessage;\n case 'TOKEN_EXPIRED':\n return t('auth.verifyEmail.errors.expired');\n case 'ALREADY_VERIFIED':\n return t('auth.verifyEmail.errors.alreadyVerified');\n case 'INTERNAL_ERROR':\n return invalidMessage;\n default:\n return null;\n }\n },\n },\n );\n if (!outcome.ok) {\n reject(new Error(outcome.message));\n return;\n }\n\n const successResult = requireField(\n outcome.payload.success ?? null,\n defaultErrorMessage,\n );\n if (!successResult.ok) {\n reject(new Error(successResult.message));\n return;\n }\n resolve(successResult.value);\n },\n onError: (mutationError) => {\n let error = new Error(defaultErrorMessage);\n if (mutationError instanceof Error) {\n error = mutationError;\n }\n reject(error);\n },\n });\n });\n },\n [commitVerify, t],\n );\n\n return (\n <VerifyEmailScreen\n onBackToLogin={handleBackToLogin}\n onVerifyEmail={handleVerifyEmail}\n />\n );\n};\n\nexport default BackofficeVerifyEmailPage;\n"],"mappings":";;;;;;;;;;;AAgBA,IAAM,EAAE,mBAAgB,GAaX,UAA+C;CAC1D,IAAM,IAAgB,EAAW,EAAe,EAC1C,EAAE,gBAAa,GAAqB,EACpC,IAAO,GAAoC,EAC3C,EAAE,SAAM,GAAsB,EAK9B,CAAC,KAAgB,EACrB,EAAK,oBACN;AAiED,QACE,kBAAC,GAAD;EACE,eAjEsB,QAAkB;AAC1C,MAAe,QAAQ,KAAK,EAAE,UAAU,EAAuB,EAAS,EAAE,CAAC;KAC1E,CAAC,GAAU,GAAe,QAAQ,CAAC;EAgElC,eA9DsB,EACxB,OAAO,MAA+C;GACpD,IAAM,IAAiB,EAAE,kCAAkC,EACrD,IAAsB;AAE5B,UAAO,IAAI,SAAS,GAAS,MAAW;AACtC,MAAa;KACX,WAAW,EACT,UACD;KACD,cAAc,MAAa;MACzB,IAAM,IAAU,EACd,EAAS,eAAe,MACxB;OACE;OACA,YAAY,MAAW;AACrB,gBAAQ,GAAR;SACE,KAAK,gBACH,QAAO;SACT,KAAK,gBACH,QAAO,EAAE,kCAAkC;SAC7C,KAAK,mBACH,QAAO,EAAE,0CAA0C;SACrD,KAAK,iBACH,QAAO;SACT,QACE,QAAO;;;OAGd,CACF;AACD,UAAI,CAAC,EAAQ,IAAI;AACf,SAAW,MAAM,EAAQ,QAAQ,CAAC;AAClC;;MAGF,IAAM,IAAgB,EACpB,EAAQ,QAAQ,WAAW,MAC3B,EACD;AACD,UAAI,CAAC,EAAc,IAAI;AACrB,SAAW,MAAM,EAAc,QAAQ,CAAC;AACxC;;AAEF,QAAQ,EAAc,MAAM;;KAE9B,UAAU,MAAkB;MAC1B,IAAI,IAAY,MAAM,EAAoB;AAI1C,MAHI,aAAyB,UAC3B,IAAQ,IAEV,EAAO,EAAM;;KAEhB,CAAC;KACF;KAEJ,CAAC,GAAc,EAAE,CAClB;EAMG,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"buildTabsItems.js","names":[],"sources":["../../../../src/pages/detail/buildTabsItems.ts"],"sourcesContent":["import type { BackofficeDetailPageRouteSpec } from '@plumile/backoffice-core/types.js';\nimport type { BackofficeTabItem } from '@plumile/ui-backoffice/backoffice/molecules/backoffice_tabs/BackofficeTabs.js';\nimport type { TFunction } from 'i18next';\n\ntype DetailPage<Node> = BackofficeDetailPageRouteSpec<Node>;\n\nexport const buildTabsItems = <Node>(input: {\n pages: readonly DetailPage<Node>[];\n id: string;\n tApp: TFunction;\n detailPageHref: (id: string, pageId: string) => string;\n}): readonly BackofficeTabItem[] => {\n return input.pages.map((page) => {\n return {\n id: page.id,\n label: page.label(input.tApp),\n to: input.detailPageHref(input.id, page.id),\n };\n });\n};\n"],"mappings":";AAMA,IAAa,KAAwB,MAM5B,EAAM,MAAM,KAAK,OACf;CACL,IAAI,EAAK;CACT,OAAO,EAAK,MAAM,EAAM,KAAK;CAC7B,IAAI,EAAM,eAAe,EAAM,IAAI,EAAK,GAAG;CAC5C,EACD"}
1
+ {"version":3,"file":"buildTabsItems.js","names":[],"sources":["../../../../src/pages/detail/buildTabsItems.ts"],"sourcesContent":["import type { BackofficeDetailPageRouteSpec } from '@plumile/backoffice-core/types.js';\nimport type { BackofficeTabItem } from '@plumile/ui/backoffice/molecules/backoffice_tabs/BackofficeTabs.js';\nimport type { TFunction } from 'i18next';\n\ntype DetailPage<Node> = BackofficeDetailPageRouteSpec<Node>;\n\nexport const buildTabsItems = <Node>(input: {\n pages: readonly DetailPage<Node>[];\n id: string;\n tApp: TFunction;\n detailPageHref: (id: string, pageId: string) => string;\n}): readonly BackofficeTabItem[] => {\n return input.pages.map((page) => {\n return {\n id: page.id,\n label: page.label(input.tApp),\n to: input.detailPageHref(input.id, page.id),\n };\n });\n};\n"],"mappings":";AAMA,IAAa,KAAwB,MAM5B,EAAM,MAAM,KAAK,OACf;CACL,IAAI,EAAK;CACT,OAAO,EAAK,MAAM,EAAM,KAAK;CAC7B,IAAI,EAAM,eAAe,EAAM,IAAI,EAAK,GAAG;CAC5C,EACD"}
@@ -15,8 +15,6 @@ import { StrictMode as p, useEffect as m, useMemo as h } from "react";
15
15
  import { RouterRenderer as g, RoutingContext as _, createRouter as v } from "@plumile/router";
16
16
  import { createInstance as y } from "i18next";
17
17
  import { ThemeProvider as b } from "@plumile/ui/theme/ThemeProvider";
18
- import "@plumile/ui/style.css";
19
- import "@plumile/ui-backoffice/style.css";
20
18
  //#region src/provider/BackofficeProvider.tsx
21
19
  var x = (e) => e.trim() === "" || e === "/" ? "/" : e.startsWith("/") ? e.endsWith("/") ? e.slice(0, -1) : e : `/${e}`, S = (e, t) => {
22
20
  let n = x(t), r = x(e);