@canton-network/core-wallet-ui-components 1.18.0 → 1.19.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.
Files changed (123) hide show
  1. package/README.md +11 -0
  2. package/dist/components/api-key-card.d.ts.map +1 -1
  3. package/dist/components/api-key-form.d.ts.map +1 -1
  4. package/dist/components/app-header.d.ts +3 -0
  5. package/dist/components/app-header.d.ts.map +1 -1
  6. package/dist/components/app-layout.d.ts +2 -0
  7. package/dist/components/app-layout.d.ts.map +1 -1
  8. package/dist/components/auth-editor.d.ts +2 -0
  9. package/dist/components/auth-editor.d.ts.map +1 -1
  10. package/dist/components/back-link.d.ts.map +1 -1
  11. package/dist/components/copy-button.d.ts.map +1 -1
  12. package/dist/components/custom-toast.d.ts.map +1 -1
  13. package/dist/components/error-page.d.ts.map +1 -1
  14. package/dist/components/form-input.d.ts.map +1 -1
  15. package/dist/components/idp-card.d.ts.map +1 -1
  16. package/dist/components/idp-form.d.ts.map +1 -1
  17. package/dist/components/loading-state.d.ts.map +1 -1
  18. package/dist/components/login-form.d.ts.map +1 -1
  19. package/dist/components/message-detail.d.ts.map +1 -1
  20. package/dist/components/network-card.d.ts.map +1 -1
  21. package/dist/components/network-form.d.ts.map +1 -1
  22. package/dist/components/not-found.d.ts.map +1 -1
  23. package/dist/components/page-header.d.ts +14 -0
  24. package/dist/components/page-header.d.ts.map +1 -0
  25. package/dist/components/pagination.d.ts +1 -0
  26. package/dist/components/pagination.d.ts.map +1 -1
  27. package/dist/components/transaction-card.d.ts.map +1 -1
  28. package/dist/components/transaction-detail.d.ts.map +1 -1
  29. package/dist/components/wallet-card.d.ts +1 -0
  30. package/dist/components/wallet-card.d.ts.map +1 -1
  31. package/dist/components/wallet-create-form.d.ts.map +1 -1
  32. package/dist/components/wallet-edit-form.d.ts +1 -0
  33. package/dist/components/wallet-edit-form.d.ts.map +1 -1
  34. package/dist/components/wallet-list.d.ts +18 -0
  35. package/dist/components/wallet-list.d.ts.map +1 -0
  36. package/dist/components/wallets-sync.d.ts +14 -7
  37. package/dist/components/wallets-sync.d.ts.map +1 -1
  38. package/dist/date-time.d.ts +14 -0
  39. package/dist/date-time.d.ts.map +1 -0
  40. package/dist/error-toast-By8cEMjq.cjs +4002 -0
  41. package/dist/error-toast-By8cEMjq.cjs.map +1 -0
  42. package/dist/error-toast-DQZ4SB72.js +17335 -0
  43. package/dist/error-toast-DQZ4SB72.js.map +1 -0
  44. package/dist/index.cjs +709 -4616
  45. package/dist/index.cjs.map +1 -1
  46. package/dist/index.css +1 -1
  47. package/dist/index.d.ts +3 -0
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +1528 -16563
  50. package/dist/index.js.map +1 -1
  51. package/dist/internal/activity-render.d.ts +6 -1
  52. package/dist/internal/activity-render.d.ts.map +1 -1
  53. package/dist/internal/activity-utils.d.ts +0 -1
  54. package/dist/internal/activity-utils.d.ts.map +1 -1
  55. package/dist/internal/base-element.d.ts.map +1 -1
  56. package/dist/logic/index.cjs +1 -0
  57. package/dist/logic/index.d.ts +2 -0
  58. package/dist/logic/index.d.ts.map +1 -0
  59. package/dist/logic/index.js +1 -0
  60. package/dist/logic/parties.d.ts +59 -0
  61. package/dist/logic/parties.d.ts.map +1 -0
  62. package/dist/parties-B5mhMShF.js +111 -0
  63. package/dist/parties-B5mhMShF.js.map +1 -0
  64. package/dist/parties-DTtG9UJI.cjs +2 -0
  65. package/dist/parties-DTtG9UJI.cjs.map +1 -0
  66. package/dist/react/components/ApiKeyCard.d.ts +5 -7
  67. package/dist/react/components/ApiKeyCard.d.ts.map +1 -1
  68. package/dist/react/components/ApiKeyForm.d.ts +5 -7
  69. package/dist/react/components/ApiKeyForm.d.ts.map +1 -1
  70. package/dist/react/components/AppHeader.d.ts +6 -29
  71. package/dist/react/components/AppHeader.d.ts.map +1 -1
  72. package/dist/react/components/CardDetailRow.d.ts +1 -1
  73. package/dist/react/components/CardDetailRow.d.ts.map +1 -1
  74. package/dist/react/components/ErrorPage.d.ts +6 -9
  75. package/dist/react/components/ErrorPage.d.ts.map +1 -1
  76. package/dist/react/components/IdpCard.d.ts +7 -8
  77. package/dist/react/components/IdpCard.d.ts.map +1 -1
  78. package/dist/react/components/IdpForm.d.ts +8 -18
  79. package/dist/react/components/IdpForm.d.ts.map +1 -1
  80. package/dist/react/components/LoginForm.d.ts +6 -29
  81. package/dist/react/components/LoginForm.d.ts.map +1 -1
  82. package/dist/react/components/MessageDetail.d.ts +6 -26
  83. package/dist/react/components/MessageDetail.d.ts.map +1 -1
  84. package/dist/react/components/NetworkCard.d.ts +7 -12
  85. package/dist/react/components/NetworkCard.d.ts.map +1 -1
  86. package/dist/react/components/NetworkForm.d.ts +7 -16
  87. package/dist/react/components/NetworkForm.d.ts.map +1 -1
  88. package/dist/react/components/NotFound.d.ts +3 -0
  89. package/dist/react/components/NotFound.d.ts.map +1 -0
  90. package/dist/react/components/PageHeader.d.ts +3 -0
  91. package/dist/react/components/PageHeader.d.ts.map +1 -0
  92. package/dist/react/components/Pagination.d.ts +5 -12
  93. package/dist/react/components/Pagination.d.ts.map +1 -1
  94. package/dist/react/components/TransactionCard.d.ts +5 -16
  95. package/dist/react/components/TransactionCard.d.ts.map +1 -1
  96. package/dist/react/components/TransactionDetail.d.ts +6 -28
  97. package/dist/react/components/TransactionDetail.d.ts.map +1 -1
  98. package/dist/react/components/WalletCard.d.ts +8 -20
  99. package/dist/react/components/WalletCard.d.ts.map +1 -1
  100. package/dist/react/components/WalletCreateForm.d.ts +7 -34
  101. package/dist/react/components/WalletCreateForm.d.ts.map +1 -1
  102. package/dist/react/components/WalletEditForm.d.ts +7 -34
  103. package/dist/react/components/WalletEditForm.d.ts.map +1 -1
  104. package/dist/react/components/WalletList.d.ts +9 -0
  105. package/dist/react/components/WalletList.d.ts.map +1 -0
  106. package/dist/react/components/WalletsSync.d.ts +5 -12
  107. package/dist/react/components/WalletsSync.d.ts.map +1 -1
  108. package/dist/react/index.cjs +2 -10
  109. package/dist/react/index.cjs.map +1 -1
  110. package/dist/react/index.d.ts +3 -1
  111. package/dist/react/index.d.ts.map +1 -1
  112. package/dist/react/index.js +228 -1808
  113. package/dist/react/index.js.map +1 -1
  114. package/dist/routing.d.ts +1 -1
  115. package/dist/routing.d.ts.map +1 -1
  116. package/package.json +17 -10
  117. package/themes/default.css +125 -74
  118. package/dist/activity-utils-CmKMEsoq.cjs +0 -4
  119. package/dist/activity-utils-CmKMEsoq.cjs.map +0 -1
  120. package/dist/activity-utils-DI0OIiL2.js +0 -1744
  121. package/dist/activity-utils-DI0OIiL2.js.map +0 -1
  122. package/dist/react/components/AuthEditor.d.ts +0 -21
  123. package/dist/react/components/AuthEditor.d.ts.map +0 -1
@@ -1,20 +1,62 @@
1
- import { a as e, c as t, i as n, l as r, n as i, o as a, s as o, t as s } from "../activity-utils-DI0OIiL2.js";
2
- import { Alert as c, AlertTitle as l, AppBar as u, Box as d, Button as f, Card as p, CardActionArea as m, CardActions as h, CardContent as g, Checkbox as _, Chip as v, CircularProgress as y, Collapse as b, Divider as x, FormControlLabel as S, IconButton as C, InputAdornment as w, Link as T, ListItemIcon as E, ListItemText as D, Menu as O, MenuItem as k, Paper as A, Snackbar as j, Stack as M, TextField as N, Toolbar as ee, Tooltip as te, Typography as P, useTheme as ne } from "@mui/material";
3
- import { Fragment as F, jsx as I, jsxs as L } from "react/jsx-runtime";
4
- import { createContext as re, memo as ie, useCallback as R, useContext as ae, useEffect as oe, useId as se, useMemo as ce, useRef as le, useState as z } from "react";
5
- import ue from "@mui/icons-material/Menu";
6
- import de from "@mui/icons-material/ContentCopy";
7
- import fe from "@mui/icons-material/ChevronLeft";
8
- import pe from "@mui/icons-material/WarningAmber";
9
- import B from "@mui/icons-material/ArrowBack";
10
- import me from "@mui/icons-material/Refresh";
11
- import { keyframes as he } from "@mui/material/styles";
12
- import ge from "@mui/icons-material/ArrowForward";
13
- import _e from "@mui/icons-material/ExpandMore";
14
- // src/react/components/CardDetailRow.tsx
15
- var V = ({ label: e, value: t, title: n = typeof t == "string" ? t : void 0, muted: r = !1, action: i }) => {
1
+ import { A as e, At as t, C as n, E as r, Mt as i, T as a, Z as o, ct as s, f as c, ft as ee, g as te, i as l, j as u, l as d, lt as f, m as p, nt as m, ot as h, s as g, t as _, v, vt as y } from "../error-toast-DQZ4SB72.js";
2
+ import b, { createContext as ne, useCallback as x, useContext as re, useEffect as S, useMemo as C, useRef as w, useState as T } from "react";
3
+ import { createComponent as E } from "@lit/react";
4
+ import { Alert as D, AlertTitle as O, Box as k, Button as A, CircularProgress as j, IconButton as M, Snackbar as N, Stack as P, TextField as F, Tooltip as I, Typography as L } from "@mui/material";
5
+ import { jsx as R, jsxs as z } from "react/jsx-runtime";
6
+ import B from "@mui/icons-material/ChevronLeft";
7
+ import V from "@mui/icons-material/ContentCopy";
8
+ import { keyframes as H } from "@mui/material/styles";
9
+ // src/react/components/ApiKeyCard.tsx
10
+ var U = E({
11
+ tagName: "api-key-card",
12
+ elementClass: i,
13
+ react: b,
14
+ events: { onRevoke: "revoke" }
15
+ }), W = () => /* @__PURE__ */ R(j, {
16
+ size: 16,
17
+ color: "inherit",
18
+ "aria-hidden": "true"
19
+ }), G = ({ onApprove: e, onReject: t, approveLabel: n = "Approve", approving: r = !1, rejecting: i = !1, signing: a = !1, disabled: o = !1 }) => /* @__PURE__ */ z(P, {
20
+ direction: "row",
21
+ spacing: 2,
22
+ children: [t && /* @__PURE__ */ R(A, {
23
+ variant: "outlined",
24
+ color: "error",
25
+ fullWidth: !0,
26
+ disabled: o || r || i,
27
+ startIcon: i ? /* @__PURE__ */ R(W, {}) : void 0,
28
+ onClick: t,
29
+ children: "Reject"
30
+ }), /* @__PURE__ */ R(A, {
31
+ variant: "contained",
32
+ fullWidth: !0,
33
+ disabled: o || r || i || a,
34
+ startIcon: r || a ? /* @__PURE__ */ R(W, {}) : void 0,
35
+ onClick: e,
36
+ children: n
37
+ })]
38
+ }), K = E({
39
+ tagName: "api-key-form",
40
+ elementClass: t,
41
+ react: b,
42
+ events: { onApiKeyGenerate: "api-key-generate" }
43
+ }), q = E({
44
+ tagName: "app-header",
45
+ elementClass: y,
46
+ react: b,
47
+ events: {
48
+ onLogout: "logout",
49
+ onCopyDappApiUrl: "copy-dapp-api-url"
50
+ }
51
+ }), J = ({ label: e = "Back", href: t, onClick: n }) => /* @__PURE__ */ R(A, {
52
+ color: "inherit",
53
+ size: "small",
54
+ startIcon: /* @__PURE__ */ R(B, {}),
55
+ ...t === void 0 ? { onClick: n } : { href: t },
56
+ children: e
57
+ }), Y = ({ label: e, value: t, title: n = typeof t == "string" ? t : void 0, muted: r = !1, action: i }) => {
16
58
  let a = typeof t == "string";
17
- return /* @__PURE__ */ L(d, {
59
+ return /* @__PURE__ */ z(k, {
18
60
  sx: {
19
61
  display: "flex",
20
62
  alignItems: "center",
@@ -23,7 +65,7 @@ var V = ({ label: e, value: t, title: n = typeof t == "string" ? t : void 0, mut
23
65
  minHeight: 40
24
66
  },
25
67
  children: [
26
- /* @__PURE__ */ I(P, {
68
+ /* @__PURE__ */ R(L, {
27
69
  variant: "body2",
28
70
  noWrap: !0,
29
71
  sx: {
@@ -33,7 +75,7 @@ var V = ({ label: e, value: t, title: n = typeof t == "string" ? t : void 0, mut
33
75
  },
34
76
  children: e
35
77
  }),
36
- /* @__PURE__ */ I(P, {
78
+ /* @__PURE__ */ R(L, {
37
79
  variant: "body2",
38
80
  component: "div",
39
81
  noWrap: a,
@@ -53,7 +95,7 @@ var V = ({ label: e, value: t, title: n = typeof t == "string" ? t : void 0, mut
53
95
  },
54
96
  children: t
55
97
  }),
56
- i && /* @__PURE__ */ I(d, {
98
+ i && /* @__PURE__ */ R(k, {
57
99
  sx: {
58
100
  position: "relative",
59
101
  zIndex: 1,
@@ -63,531 +105,11 @@ var V = ({ label: e, value: t, title: n = typeof t == "string" ? t : void 0, mut
63
105
  })
64
106
  ]
65
107
  });
66
- }, ve = ({ apiKey: e, onRevoke: t }) => /* @__PURE__ */ L(p, { children: [
67
- /* @__PURE__ */ L(g, { children: [/* @__PURE__ */ I(P, {
68
- variant: "body1",
69
- sx: {
70
- mb: 2,
71
- fontWeight: "bold"
72
- },
73
- children: e.name
74
- }), /* @__PURE__ */ L(M, {
75
- spacing: 1,
76
- children: [/* @__PURE__ */ I(V, {
77
- label: "ID",
78
- value: e.id
79
- }), /* @__PURE__ */ I(V, {
80
- label: "Created At",
81
- value: e.createdAt
82
- })]
83
- })] }),
84
- /* @__PURE__ */ I(x, {}),
85
- /* @__PURE__ */ I(h, { children: /* @__PURE__ */ I(f, {
86
- color: "error",
87
- onClick: () => t(e),
88
- children: "Revoke"
89
- }) })
90
- ] }), ye = () => /* @__PURE__ */ I(y, {
91
- size: 16,
92
- color: "inherit",
93
- "aria-hidden": "true"
94
- }), H = ({ onApprove: e, onReject: t, approveLabel: n = "Approve", approving: r = !1, rejecting: i = !1, signing: a = !1, disabled: o = !1 }) => /* @__PURE__ */ L(M, {
95
- direction: "row",
96
- spacing: 2,
97
- children: [t && /* @__PURE__ */ I(f, {
98
- variant: "outlined",
99
- color: "error",
100
- fullWidth: !0,
101
- disabled: o || r || i,
102
- startIcon: i ? /* @__PURE__ */ I(ye, {}) : void 0,
103
- onClick: t,
104
- children: "Reject"
105
- }), /* @__PURE__ */ I(f, {
106
- variant: "contained",
107
- fullWidth: !0,
108
- disabled: o || r || i || a,
109
- startIcon: r || a ? /* @__PURE__ */ I(ye, {}) : void 0,
110
- onClick: e,
111
- children: n
112
- })]
113
- }), be = ({ onGenerate: e }) => {
114
- let [t, n] = z("");
115
- return /* @__PURE__ */ L(d, {
116
- component: "form",
117
- onSubmit: (n) => {
118
- n.preventDefault(), e({ name: t });
119
- },
120
- sx: {
121
- display: "flex",
122
- flexDirection: "column",
123
- height: "100%"
124
- },
125
- children: [/* @__PURE__ */ I(M, {
126
- spacing: 2,
127
- children: /* @__PURE__ */ I(N, {
128
- label: "Name",
129
- required: !0,
130
- fullWidth: !0,
131
- value: t,
132
- onChange: (e) => n(e.target.value)
133
- })
134
- }), /* @__PURE__ */ I(d, {
135
- sx: {
136
- mt: "auto",
137
- pt: 3
138
- },
139
- children: /* @__PURE__ */ I(f, {
140
- type: "submit",
141
- variant: "contained",
142
- fullWidth: !0,
143
- children: "Generate"
144
- })
145
- })]
146
- });
147
- }, xe = ({ online: e }) => /* @__PURE__ */ I(d, { sx: {
148
- display: "inline-block",
149
- flexShrink: 0,
150
- width: "10px",
151
- height: "10px",
152
- borderRadius: "50%",
153
- bgcolor: e ? "success.main" : "text.disabled"
154
- } }), Se = [
155
- {
156
- label: "Parties",
157
- href: "/parties/"
158
- },
159
- {
160
- label: "Activities",
161
- href: "/activities/"
162
- },
163
- {
164
- label: "Networks",
165
- href: "/networks/"
166
- },
167
- {
168
- label: "API Keys",
169
- href: "/api-keys/"
170
- },
171
- {
172
- label: "Identity Providers",
173
- href: "/identity-providers/"
174
- }
175
- ], Ce = ({ iconSrc: e = r, networkName: t = "No network connected", networkConnected: n = !1, dappApiUrl: i, homeHref: a = "/", navItems: o, onLogout: s, onDappApiUrlCopy: c }) => {
176
- let [l, f] = z(null), p = !!l, m = se(), h = () => f(null), g = ne().components?.MuiButtonBase?.defaultProps?.LinkComponent ?? "a";
177
- return /* @__PURE__ */ L(u, {
178
- position: "sticky",
179
- color: "default",
180
- children: [/* @__PURE__ */ L(ee, {
181
- sx: {
182
- display: "grid",
183
- gridTemplateColumns: "minmax(max-content, 1fr) minmax(0, auto) minmax(max-content, 1fr)",
184
- alignItems: "center",
185
- gap: 1
186
- },
187
- children: [
188
- /* @__PURE__ */ I(C, {
189
- href: a,
190
- "aria-label": "Go to home",
191
- sx: {
192
- justifySelf: "start",
193
- p: .5
194
- },
195
- children: /* @__PURE__ */ I(d, {
196
- component: "img",
197
- src: e,
198
- alt: "",
199
- sx: {
200
- height: 30,
201
- display: "block"
202
- }
203
- })
204
- }),
205
- /* @__PURE__ */ L(d, {
206
- title: t,
207
- "data-testid": `network-status-${n ? "connected" : "disconnected"}`,
208
- sx: {
209
- display: "flex",
210
- alignItems: "center",
211
- gap: 1,
212
- minWidth: 0,
213
- maxWidth: "min(52vw, 420px)"
214
- },
215
- children: [/* @__PURE__ */ I(xe, { online: n }), /* @__PURE__ */ I(P, {
216
- variant: "subtitle1",
217
- noWrap: !0,
218
- children: t
219
- })]
220
- }),
221
- /* @__PURE__ */ I(C, {
222
- "aria-label": "menu",
223
- "aria-controls": p ? m : void 0,
224
- "aria-haspopup": "true",
225
- "aria-expanded": p ? "true" : void 0,
226
- onClick: (e) => f(e.currentTarget),
227
- sx: { justifySelf: "end" },
228
- children: /* @__PURE__ */ I(ue, {})
229
- })
230
- ]
231
- }), /* @__PURE__ */ L(O, {
232
- id: m,
233
- anchorEl: l,
234
- open: p,
235
- onClose: h,
236
- children: [
237
- o.map(({ label: e, href: t }) => /* @__PURE__ */ I(k, {
238
- component: g,
239
- href: t,
240
- onClick: h,
241
- children: e
242
- }, t)),
243
- c && /* @__PURE__ */ L(k, {
244
- title: i || "Copy dApp API URL",
245
- "aria-label": i ? `Copy dApp API URL: ${i}` : "Copy dApp API URL",
246
- onClick: () => {
247
- h(), c();
248
- },
249
- children: [/* @__PURE__ */ I(D, { children: "Dapp API URL" }), /* @__PURE__ */ I(E, {
250
- sx: { justifyContent: "flex-end" },
251
- children: /* @__PURE__ */ I(de, { fontSize: "small" })
252
- })]
253
- }),
254
- /* @__PURE__ */ I(x, {}),
255
- /* @__PURE__ */ I(k, {
256
- onClick: () => {
257
- h(), s();
258
- },
259
- children: "Logout"
260
- })
261
- ]
262
- })]
263
- });
264
- }, we = [
265
- "authorization_code",
266
- "client_credentials",
267
- "self_signed",
268
- "self_issued"
269
- ], U = (e) => typeof e?.method == "string", Te = (e) => {
270
- switch (e) {
271
- case "authorization_code": return {
272
- method: e,
273
- clientId: "",
274
- audience: "",
275
- scope: ""
276
- };
277
- case "client_credentials": return {
278
- method: e,
279
- clientId: "",
280
- audience: "",
281
- scope: "",
282
- clientSecret: ""
283
- };
284
- case "self_issued": return {
285
- method: e,
286
- audience: "",
287
- scope: ""
288
- };
289
- case "self_signed": return {
290
- method: e,
291
- clientId: "",
292
- audience: "",
293
- scope: "",
294
- issuer: "",
295
- clientSecret: ""
296
- };
297
- }
298
- }, Ee = (e) => e ? "********" : "(not set)", De = (e) => {
299
- let t = [
300
- {
301
- key: "Method",
302
- value: e.method
303
- },
304
- {
305
- key: "Audience",
306
- value: e.audience ?? ""
307
- },
308
- {
309
- key: "Scope",
310
- value: e.scope ?? ""
311
- }
312
- ];
313
- return "clientId" in e && t.splice(1, 0, {
314
- key: "Client Id",
315
- value: e.clientId ?? ""
316
- }), "issuer" in e && t.push({
317
- key: "Issuer",
318
- value: e.issuer ?? ""
319
- }), "clientSecret" in e && t.push({
320
- key: "Client Secret",
321
- value: Ee(e.clientSecret)
322
- }), e.method === "client_credentials" && e.identityProviderId && t.push({
323
- key: "Identity Provider Id",
324
- value: e.identityProviderId
325
- }), t;
326
- }, Oe = (e, t) => {
327
- let n = "clientId" in e ? e.clientId : "", r = e.audience ?? "", i = e.scope ?? "";
328
- switch (t) {
329
- case "authorization_code": return {
330
- method: t,
331
- clientId: n,
332
- audience: r,
333
- scope: i
334
- };
335
- case "self_signed": return {
336
- method: t,
337
- clientId: n,
338
- audience: r,
339
- scope: i,
340
- issuer: e.issuer ?? "",
341
- clientSecret: e.clientSecret ?? ""
342
- };
343
- case "self_issued": return {
344
- method: t,
345
- audience: r,
346
- scope: i
347
- };
348
- case "client_credentials": return {
349
- method: t,
350
- ...e.method === "client_credentials" && e.identityProviderId ? { identityProviderId: e.identityProviderId } : {},
351
- clientId: n,
352
- audience: r,
353
- scope: i,
354
- clientSecret: e.clientSecret ?? ""
355
- };
356
- default: throw Error(`Unsupported auth method: ${String(t)}`);
357
- }
358
- }, W = ({ label: e, testId: t, value: n, onChange: r, required: i = !1, placeholder: a, helperText: o }) => /* @__PURE__ */ I(N, {
359
- label: e,
360
- required: i,
361
- fullWidth: !0,
362
- value: n,
363
- placeholder: a,
364
- helperText: o,
365
- onChange: (e) => r(e.target.value),
366
- slotProps: { htmlInput: { "data-test-id": t } }
367
- }), ke = ({ auth: e, onChange: t, allowedMethods: n = we, optional: r = !1, label: i = "auth" }) => {
368
- let a = `No ${i} configured.`, o = `${i.charAt(0).toUpperCase()}${i.slice(1)} will be removed after submitting this form.`, [s, l] = z(() => r ? U(e) ? "view" : "none" : "edit"), [u, p] = z(), [m, h] = z(""), g = () => {
369
- h(""), l("add");
370
- }, _ = () => {
371
- e && p(structuredClone(e)), h(""), l("edit");
372
- }, v = () => {
373
- e && p(structuredClone(e)), t(void 0), l("pending-remove");
374
- }, y = () => {
375
- u ? (t(structuredClone(u)), l("view")) : l(r ? "none" : "edit");
376
- }, b = () => {
377
- u ? (t(structuredClone(u)), l("view")) : (t(void 0), l(r ? "none" : "edit")), h("");
378
- }, x = /* @__PURE__ */ L(M, {
379
- spacing: 1,
380
- "data-test-id": "auth-editor-empty-state",
381
- children: [/* @__PURE__ */ I(P, {
382
- variant: "body2",
383
- color: "text.secondary",
384
- "data-test-id": "auth-editor-empty-text",
385
- children: a
386
- }), /* @__PURE__ */ I(d, { children: /* @__PURE__ */ I(f, {
387
- size: "small",
388
- "data-test-id": "auth-editor-add-button",
389
- onClick: g,
390
- children: "Add"
391
- }) })]
392
- });
393
- if (s === "none") return x;
394
- if (s === "pending-remove") return /* @__PURE__ */ L(M, {
395
- spacing: 1,
396
- "data-test-id": "auth-editor-pending-remove-state",
397
- children: [/* @__PURE__ */ I(c, {
398
- severity: "warning",
399
- "data-test-id": "auth-editor-pending-remove-text",
400
- children: o
401
- }), /* @__PURE__ */ I(d, { children: /* @__PURE__ */ I(f, {
402
- size: "small",
403
- "data-test-id": "auth-editor-cancel-remove-button",
404
- onClick: y,
405
- children: "Cancel"
406
- }) })]
407
- });
408
- if (s === "view" && U(e)) return /* @__PURE__ */ L(M, {
409
- spacing: 1,
410
- "data-test-id": "auth-editor-view-state",
411
- children: [/* @__PURE__ */ I(d, {
412
- component: "dl",
413
- "data-test-id": "auth-editor-summary-list",
414
- sx: { m: 0 },
415
- children: De(e).map((e) => /* @__PURE__ */ L(d, {
416
- "data-test-id": "auth-editor-summary-row",
417
- sx: {
418
- display: "flex",
419
- gap: 2,
420
- minHeight: 32,
421
- alignItems: "center"
422
- },
423
- children: [/* @__PURE__ */ I(P, {
424
- component: "dt",
425
- variant: "body2",
426
- noWrap: !0,
427
- sx: {
428
- fontWeight: "bold",
429
- flexShrink: 0,
430
- minWidth: "8rem"
431
- },
432
- children: e.key
433
- }), /* @__PURE__ */ I(P, {
434
- component: "dd",
435
- variant: "body2",
436
- noWrap: !0,
437
- title: e.value,
438
- sx: {
439
- m: 0,
440
- flex: 1,
441
- minWidth: 0,
442
- textAlign: "right"
443
- },
444
- children: e.value
445
- })]
446
- }, e.key))
447
- }), /* @__PURE__ */ L(M, {
448
- direction: "row",
449
- spacing: 1,
450
- children: [/* @__PURE__ */ I(f, {
451
- size: "small",
452
- "data-test-id": "auth-editor-edit-button",
453
- onClick: _,
454
- children: "Edit"
455
- }), /* @__PURE__ */ I(f, {
456
- size: "small",
457
- color: "error",
458
- "data-test-id": "auth-editor-remove-button",
459
- onClick: v,
460
- children: "Remove"
461
- })]
462
- })]
463
- });
464
- let S = U(e) ? e : Te(n[0] ?? "authorization_code"), C = S.method, w = (e) => t({
465
- ...S,
466
- ...e
467
- }), T = u && "clientSecret" in u ? u.clientSecret : void 0, E = "clientSecret" in S ? S.clientSecret : void 0, D = m.trim() === "" && s !== "add" && (typeof E == "string" && E !== "" || typeof T == "string" && T.length > 0), O = (e) => {
468
- h(e);
469
- let t;
470
- t = e.trim() === "" ? s === "add" ? "" : typeof T == "string" ? T : E ?? "" : e, w({ clientSecret: t });
471
- }, k = (e) => {
472
- let n = e.trim(), { identityProviderId: r, ...i } = S;
473
- t(n ? {
474
- ...i,
475
- identityProviderId: n
476
- } : i);
477
- }, A = "clientId" in S && /* @__PURE__ */ I(W, {
478
- label: "Client Id",
479
- testId: "auth-editor-client-id-input",
480
- required: !0,
481
- value: S.clientId ?? "",
482
- onChange: (e) => w({ clientId: e })
483
- }), j = /* @__PURE__ */ I(W, {
484
- label: "Client Secret",
485
- testId: "auth-editor-client-secret-input",
486
- required: !D,
487
- value: m,
488
- placeholder: D ? "********" : "",
489
- helperText: D ? /* @__PURE__ */ I("span", {
490
- "data-test-id": "auth-editor-secret-help",
491
- children: "Current secret is hidden. Enter a new value to replace it."
492
- }) : void 0,
493
- onChange: O
494
- });
495
- return /* @__PURE__ */ L(F, { children: [/* @__PURE__ */ L(M, {
496
- spacing: 2,
497
- "data-test-id": "auth-editor-edit-state",
498
- children: [
499
- /* @__PURE__ */ L(N, {
500
- select: !0,
501
- label: "Method",
502
- required: !0,
503
- fullWidth: !0,
504
- value: C,
505
- onChange: (e) => t(Oe(S, e.target.value)),
506
- slotProps: {
507
- select: { native: !0 },
508
- htmlInput: { "data-test-id": "auth-editor-method-select" }
509
- },
510
- children: [!n.includes(C) && /* @__PURE__ */ I("option", {
511
- value: C,
512
- disabled: !0,
513
- children: C
514
- }), n.map((e) => /* @__PURE__ */ I("option", {
515
- value: e,
516
- children: e
517
- }, e))]
518
- }),
519
- /* @__PURE__ */ I(W, {
520
- label: "Audience",
521
- testId: "auth-editor-audience-input",
522
- required: !0,
523
- value: S.audience ?? "",
524
- onChange: (e) => w({ audience: e })
525
- }),
526
- /* @__PURE__ */ I(W, {
527
- label: "Scope",
528
- testId: "auth-editor-scope-input",
529
- required: !0,
530
- value: S.scope ?? "",
531
- onChange: (e) => w({ scope: e })
532
- }),
533
- C === "authorization_code" && A,
534
- C === "client_credentials" && /* @__PURE__ */ L(F, { children: [
535
- A,
536
- /* @__PURE__ */ I(W, {
537
- label: "Identity Provider Id Override",
538
- testId: "auth-editor-identity-provider-id-input",
539
- value: S.identityProviderId ?? "",
540
- helperText: "Optional. Uses the network identity provider when empty.",
541
- onChange: k
542
- }),
543
- j
544
- ] }),
545
- C === "self_signed" && /* @__PURE__ */ L(F, { children: [
546
- A,
547
- /* @__PURE__ */ I(W, {
548
- label: "Issuer",
549
- testId: "auth-editor-issuer-input",
550
- required: !0,
551
- value: S.issuer ?? "",
552
- onChange: (e) => w({ issuer: e })
553
- }),
554
- j
555
- ] }),
556
- ![
557
- "authorization_code",
558
- "client_credentials",
559
- "self_signed",
560
- "self_issued"
561
- ].includes(C) && /* @__PURE__ */ L(c, {
562
- severity: "warning",
563
- "data-test-id": "auth-editor-unsupported-method-warning",
564
- children: [
565
- "Unsupported auth method \"",
566
- C,
567
- "\". Select a supported method to continue."
568
- ]
569
- })
570
- ]
571
- }), r && /* @__PURE__ */ I(d, {
572
- sx: { mt: 1 },
573
- children: /* @__PURE__ */ I(f, {
574
- size: "small",
575
- "data-test-id": "auth-editor-cancel-edit-button",
576
- onClick: b,
577
- children: "Cancel"
578
- })
579
- })] });
580
- }, G = ({ label: e = "Back", href: t, onClick: n }) => /* @__PURE__ */ I(f, {
581
- color: "inherit",
582
- size: "small",
583
- startIcon: /* @__PURE__ */ I(fe, {}),
584
- ...t === void 0 ? { onClick: n } : { href: t },
585
- children: e
586
- }), Ae = t(["core", "wallet-ui-components/react"]), K = ({ onCopy: e, value: t, label: n = "Copy to clipboard" }) => {
587
- let [r, i] = z(!1), a = le(void 0);
588
- return oe(() => () => clearTimeout(a.current), []), /* @__PURE__ */ I(te, {
108
+ }, ie = u(["core", "wallet-ui-components/react"]), ae = ({ onCopy: e, value: t, label: n = "Copy to clipboard" }) => {
109
+ let [r, i] = T(!1), a = w(void 0);
110
+ return S(() => () => clearTimeout(a.current), []), /* @__PURE__ */ R(I, {
589
111
  title: r ? "Copied" : n,
590
- children: /* @__PURE__ */ I(C, {
112
+ children: /* @__PURE__ */ R(M, {
591
113
  "aria-label": n,
592
114
  onClick: async (n) => {
593
115
  if (n.stopPropagation(), t) try {
@@ -595,268 +117,40 @@ var V = ({ label: e, value: t, title: n = typeof t == "string" ? t : void 0, mut
595
117
  else throw Error("Browser does not support clipboard functionality.");
596
118
  e !== void 0 && e(t), clearTimeout(a.current), a.current = setTimeout(() => i(!1), 1200), i(!0);
597
119
  } catch (e) {
598
- Ae.getChild("CopyButton").error("Unable to copy value", { error: e });
120
+ ie.getChild("CopyButton").error("Unable to copy value", { error: e });
599
121
  }
600
122
  },
601
- children: /* @__PURE__ */ I(de, { color: r ? "success" : "inherit" })
602
- })
603
- });
604
- }, je = ({ mode: e, title: t = "Something went wrong", message: n = "An unexpected error occurred while loading this page.", onAction: r }) => /* @__PURE__ */ I(A, { children: /* @__PURE__ */ L(M, {
605
- sx: {
606
- justifyContent: "center",
607
- alignItems: "center",
608
- p: 4
609
- },
610
- children: [
611
- /* @__PURE__ */ I(d, { children: /* @__PURE__ */ I(pe, { color: "error" }) }),
612
- /* @__PURE__ */ L(d, { children: [/* @__PURE__ */ I(P, {
613
- variant: "h5",
614
- component: "h1",
615
- children: t
616
- }), /* @__PURE__ */ I(P, {
617
- variant: "body1",
618
- children: n
619
- })] }),
620
- /* @__PURE__ */ I(d, {
621
- sx: { mt: 4 },
622
- children: /* @__PURE__ */ I(f, {
623
- variant: "contained",
624
- color: "primary",
625
- startIcon: I(e === "back" ? B : me, {}),
626
- onClick: r,
627
- children: e === "back" ? "Back" : "Refresh"
628
- })
123
+ children: /* @__PURE__ */ R(V, { color: r ? "success" : "inherit" })
629
124
  })
630
- ]
631
- }) }), Me = ({ idp: e, onReview: t }) => {
632
- let n = "configUrl" in e ? e.configUrl : "";
633
- return /* @__PURE__ */ I(p, {
634
- component: "article",
635
- "data-testid": "idp-card",
636
- variant: "outlined",
637
- sx: {
638
- position: "relative",
639
- ...t && { "&:hover": {
640
- borderColor: "primary.main",
641
- boxShadow: 2
642
- } }
643
- },
644
- children: /* @__PURE__ */ L(g, { children: [/* @__PURE__ */ I(d, {
645
- sx: { mb: 1 },
646
- children: t ? /* @__PURE__ */ I(T, {
647
- component: "button",
648
- type: "button",
649
- variant: "body1",
650
- color: "inherit",
651
- underline: "none",
652
- onClick: () => t(e),
653
- sx: {
654
- fontWeight: "bold",
655
- textAlign: "left",
656
- position: "static",
657
- "&::after": {
658
- content: "\"\"",
659
- position: "absolute",
660
- inset: 0,
661
- cursor: "pointer"
662
- }
663
- },
664
- children: e.id
665
- }) : /* @__PURE__ */ I(P, {
666
- variant: "body1",
667
- sx: { fontWeight: "bold" },
668
- children: e.id
669
- })
670
- }), /* @__PURE__ */ L(M, {
671
- spacing: .5,
672
- children: [
673
- /* @__PURE__ */ I(V, {
674
- label: "Type",
675
- value: e.type
676
- }),
677
- "issuer" in e && /* @__PURE__ */ I(V, {
678
- label: "Issuer",
679
- value: e.issuer,
680
- action: /* @__PURE__ */ I(K, {
681
- value: e.issuer,
682
- label: "Copy issuer URL"
683
- })
684
- }),
685
- n && /* @__PURE__ */ I(V, {
686
- label: "Config URL",
687
- value: n,
688
- action: /* @__PURE__ */ I(K, {
689
- value: n,
690
- label: "Copy config URL"
691
- })
692
- })
693
- ]
694
- })] })
695
125
  });
696
- }, Ne = {
697
- id: "",
698
- type: "oauth",
699
- issuer: "",
700
- configUrl: ""
701
- }, Pe = (e) => "issuer" in e ? e.issuer : "", Fe = (e) => "configUrl" in e ? e.configUrl : "", Ie = ({ idp: e, loading: t = !1, onSave: n, onDelete: r, onCancel: i }) => {
702
- let a = e ?? Ne, [o, s] = z(a.id), [l, u] = z(a.type), [p, m] = z(Pe(a)), [h, g] = z(Fe(a)), [_, v] = z(""), [y, b] = z(e);
703
- return e !== y && (b(e), s(a.id), u(a.type), m(Pe(a)), g(Fe(a)), v("")), /* @__PURE__ */ L(d, {
704
- component: "form",
705
- onSubmit: (e) => {
706
- if (e.preventDefault(), !o || l !== "self_issued" && !p || l === "oauth" && !h) v("Please fill in all required fields");
707
- else switch (v(""), l) {
708
- case "oauth":
709
- n({
710
- id: o,
711
- type: l,
712
- issuer: p,
713
- configUrl: h
714
- });
715
- break;
716
- case "self_signed":
717
- n({
718
- id: o,
719
- type: l,
720
- issuer: p
721
- });
722
- break;
723
- case "self_issued": n({
724
- id: o,
725
- type: l
726
- });
727
- }
728
- },
729
- sx: {
730
- display: "flex",
731
- flexDirection: "column",
732
- height: "100%"
733
- },
734
- children: [
735
- /* @__PURE__ */ L(M, {
736
- spacing: 2,
737
- children: [
738
- /* @__PURE__ */ I(N, {
739
- id: "idp-id",
740
- label: "ID",
741
- required: !0,
742
- fullWidth: !0,
743
- placeholder: "Enter the identity provider ID",
744
- helperText: "A unique identifier for the identity provider",
745
- disabled: t,
746
- value: o,
747
- onChange: (e) => s(e.target.value)
748
- }),
749
- /* @__PURE__ */ L(N, {
750
- id: "idp-type",
751
- select: !0,
752
- label: "Type",
753
- required: !0,
754
- fullWidth: !0,
755
- disabled: t,
756
- value: l,
757
- onChange: (e) => u(e.target.value),
758
- slotProps: { select: { native: !0 } },
759
- children: [
760
- /* @__PURE__ */ I("option", {
761
- value: "oauth",
762
- children: "oauth"
763
- }),
764
- /* @__PURE__ */ I("option", {
765
- value: "self_signed",
766
- children: "self_signed"
767
- }),
768
- /* @__PURE__ */ I("option", {
769
- value: "self_issued",
770
- children: "self_issued"
771
- })
772
- ]
773
- }),
774
- l !== "self_issued" && /* @__PURE__ */ I(N, {
775
- id: "idp-issuer",
776
- label: "Issuer URL",
777
- required: !0,
778
- fullWidth: !0,
779
- placeholder: "Enter the issuer URL",
780
- disabled: t,
781
- value: p,
782
- onChange: (e) => m(e.target.value)
783
- }),
784
- l === "oauth" && /* @__PURE__ */ I(N, {
785
- id: "idp-config-url",
786
- label: "Config URL",
787
- required: !0,
788
- fullWidth: !0,
789
- placeholder: "Enter the configuration URL",
790
- disabled: t,
791
- value: h,
792
- onChange: (e) => g(e.target.value)
793
- })
794
- ]
795
- }),
796
- _ && /* @__PURE__ */ I(c, {
797
- severity: "error",
798
- sx: { mt: 2 },
799
- children: _
800
- }),
801
- e ? /* @__PURE__ */ L(F, { children: [r && /* @__PURE__ */ L(d, {
802
- sx: { mt: 4 },
803
- children: [
804
- /* @__PURE__ */ I(x, { sx: { mb: 3 } }),
805
- /* @__PURE__ */ I(P, {
806
- variant: "subtitle1",
807
- component: "h2",
808
- sx: {
809
- fontWeight: "bold",
810
- mb: 1
811
- },
812
- children: "Delete identity provider"
813
- }),
814
- /* @__PURE__ */ I(P, {
815
- variant: "body2",
816
- color: "text.secondary",
817
- sx: { mb: 2 },
818
- children: "You will not be able to undo the change once you delete this Identity Provider."
819
- }),
820
- /* @__PURE__ */ I(f, {
821
- variant: "outlined",
822
- color: "error",
823
- onClick: () => r(e),
824
- children: "Delete identity provider"
825
- })
826
- ]
827
- }), /* @__PURE__ */ L(M, {
828
- direction: "row",
829
- spacing: 2,
830
- sx: { mt: 3 },
831
- children: [i && /* @__PURE__ */ I(f, {
832
- variant: "outlined",
833
- color: "inherit",
834
- fullWidth: !0,
835
- onClick: i,
836
- children: "Cancel"
837
- }), /* @__PURE__ */ I(f, {
838
- type: "submit",
839
- variant: "contained",
840
- fullWidth: !0,
841
- disabled: t,
842
- children: "Update"
843
- })]
844
- })] }) : /* @__PURE__ */ I(d, {
845
- sx: {
846
- mt: "auto",
847
- pt: 3
848
- },
849
- children: /* @__PURE__ */ I(f, {
850
- type: "submit",
851
- variant: "contained",
852
- fullWidth: !0,
853
- disabled: t,
854
- children: "Add"
855
- })
856
- })
857
- ]
858
- });
859
- }, Le = he`
126
+ }, oe = E({
127
+ tagName: "wg-error-page",
128
+ elementClass: ee,
129
+ react: b,
130
+ events: {
131
+ onErrorBack: "error-back",
132
+ onErrorRefresh: "error-refresh"
133
+ }
134
+ }), se = E({
135
+ tagName: "idp-card",
136
+ elementClass: h,
137
+ react: b,
138
+ events: {
139
+ onIdpReview: "idp-review",
140
+ onDelete: "delete",
141
+ onUpdate: "update"
142
+ }
143
+ }), ce = E({
144
+ tagName: "idp-form",
145
+ elementClass: m,
146
+ react: b,
147
+ events: {
148
+ onIdpFormSave: "idp-form-save",
149
+ onIdpFormDelete: "idp-form-delete",
150
+ onIdpFormCancel: "idp-form-cancel",
151
+ onIdpFormBack: "idp-form-back"
152
+ }
153
+ }), le = H`
860
154
  0%, 80%, 100% {
861
155
  transform: scale(0.7);
862
156
  opacity: 0.4;
@@ -865,7 +159,7 @@ var V = ({ label: e, value: t, title: n = typeof t == "string" ? t : void 0, mut
865
159
  transform: scale(1);
866
160
  opacity: 1;
867
161
  }
868
- `, Re = ({ text: e = "Loading" }) => /* @__PURE__ */ L(M, {
162
+ `, ue = ({ text: e = "Loading" }) => /* @__PURE__ */ z(P, {
869
163
  role: "status",
870
164
  "aria-live": "polite",
871
165
  spacing: 2,
@@ -875,7 +169,7 @@ var V = ({ label: e, value: t, title: n = typeof t == "string" ? t : void 0, mut
875
169
  alignItems: "center",
876
170
  p: 3
877
171
  },
878
- children: [/* @__PURE__ */ I(M, {
172
+ children: [/* @__PURE__ */ R(P, {
879
173
  direction: "row",
880
174
  spacing: 1,
881
175
  "aria-hidden": "true",
@@ -883,545 +177,70 @@ var V = ({ label: e, value: t, title: n = typeof t == "string" ? t : void 0, mut
883
177
  0,
884
178
  1,
885
179
  2
886
- ].map((e) => /* @__PURE__ */ I(d, { sx: {
180
+ ].map((e) => /* @__PURE__ */ R(k, { sx: {
887
181
  width: 8,
888
182
  height: 8,
889
183
  borderRadius: "50%",
890
184
  bgcolor: "primary.main",
891
- animation: `${Le} 1s infinite ease-in-out`,
185
+ animation: `${le} 1s infinite ease-in-out`,
892
186
  animationDelay: `${e * .15}s`,
893
187
  "@media (prefers-reduced-motion: reduce)": { animation: "none" }
894
188
  } }, e))
895
- }), /* @__PURE__ */ I(P, {
189
+ }), /* @__PURE__ */ R(L, {
896
190
  variant: "body1",
897
191
  color: "text.secondary",
898
192
  children: e
899
193
  })]
900
- }), q = (e) => e.authMethod !== "client_credentials", ze = ({ networks: e, idps: t, loading: n = !1, connecting: i = !1, message: a = null, onConnect: o }) => {
901
- let [s, l] = z(), [u, p] = z(null), [m, h] = z(""), [g, _] = z(""), [v, y] = z(null), [b, x] = z(null), S = e.find((e) => e.id === s), C = s === null ? null : S && q(S) ? S : e.find(q) ?? null, w = t.find((e) => e.id === C?.identityProviderId) ?? null, T = w?.type === "self_issued" || C?.authMethod === "self_issued", E = !T && w?.type === "self_signed", D = v ? {
902
- type: "error",
903
- text: v
904
- } : a && a !== b ? a : null, O = (e) => {
905
- l(e === "" ? null : e), p(null), y(null), x(a);
906
- };
907
- return /* @__PURE__ */ L(d, {
908
- component: "form",
909
- onSubmit: (e) => {
910
- e.preventDefault(), y(null), x(a), C ? w ? w.type === "self_signed" ? o(C, w, u || C.clientId, m) : w.type === "self_issued" ? o(C, w, void 0, void 0, g.trim()) : o(C, w) : y("Identity provider misconfigured for this network.") : y("Please select a network before connecting.");
911
- },
912
- sx: {
913
- minHeight: "100dvh",
914
- display: "flex",
915
- flexDirection: "column"
916
- },
917
- children: [
918
- /* @__PURE__ */ I(d, {
919
- sx: {
920
- height: 44,
921
- display: "flex",
922
- alignItems: "center",
923
- px: 2,
924
- borderBottom: 1,
925
- borderColor: "divider"
926
- },
927
- children: /* @__PURE__ */ I("img", {
928
- src: r,
929
- alt: "Canton logo",
930
- width: 24,
931
- height: 24,
932
- style: { objectFit: "contain" }
933
- })
934
- }),
935
- /* @__PURE__ */ L(M, {
936
- spacing: 2,
937
- sx: {
938
- flex: 1,
939
- px: 2,
940
- pt: 2
941
- },
942
- children: [
943
- /* @__PURE__ */ I(P, {
944
- variant: "h5",
945
- component: "h1",
946
- sx: { fontWeight: "bold" },
947
- children: "Wallet Gateway"
948
- }),
949
- /* @__PURE__ */ L(N, {
950
- select: !0,
951
- fullWidth: !0,
952
- label: "Select a network",
953
- value: C?.id ?? "",
954
- disabled: n || i,
955
- onChange: (e) => O(e.target.value),
956
- slotProps: {
957
- select: { native: !0 },
958
- inputLabel: { shrink: !0 }
959
- },
960
- children: [/* @__PURE__ */ I("option", {
961
- value: "",
962
- children: "Select network"
963
- }), e.map((e) => /* @__PURE__ */ I("option", {
964
- value: e.id,
965
- disabled: !q(e),
966
- children: e.name
967
- }, e.id))]
968
- }),
969
- T && /* @__PURE__ */ I(N, {
970
- fullWidth: !0,
971
- required: !0,
972
- label: "Username",
973
- autoComplete: "username",
974
- value: g,
975
- disabled: i,
976
- onChange: (e) => _(e.target.value)
977
- }),
978
- E && /* @__PURE__ */ L(F, { children: [/* @__PURE__ */ I(N, {
979
- fullWidth: !0,
980
- label: "Client ID",
981
- autoComplete: "username",
982
- value: u ?? C?.clientId ?? "",
983
- disabled: i,
984
- onChange: (e) => p(e.target.value)
985
- }), /* @__PURE__ */ I(N, {
986
- fullWidth: !0,
987
- label: "Client Secret",
988
- type: "password",
989
- autoComplete: "current-password",
990
- value: m,
991
- disabled: i,
992
- onChange: (e) => h(e.target.value)
993
- })] }),
994
- D ? /* @__PURE__ */ I(c, {
995
- severity: D.type,
996
- children: D.text
997
- }) : /* @__PURE__ */ I(P, {
998
- variant: "body2",
999
- color: "text.secondary",
1000
- children: n ? "Loading networks..." : C ? `Selected: ${C.name}` : "Choose a network to continue."
1001
- })
1002
- ]
1003
- }),
1004
- /* @__PURE__ */ I(d, {
1005
- sx: { p: 2 },
1006
- children: /* @__PURE__ */ I(f, {
1007
- type: "submit",
1008
- variant: "contained",
1009
- size: "large",
1010
- fullWidth: !0,
1011
- disabled: n || i || !C,
1012
- children: i ? "Connecting…" : "Connect"
1013
- })
1014
- })
1015
- ]
1016
- });
1017
- }, Be = ({ messageId: t, message: r, status: i, origin: a = null, externalTxId: o = null, backHref: s, approving: c = !1, rejecting: l = !1, signing: u = !1, disabled: f = !1, onApprove: p, onReject: m }) => /* @__PURE__ */ L(M, {
1018
- spacing: 2,
1019
- children: [
1020
- /* @__PURE__ */ L(M, {
1021
- direction: "row",
1022
- sx: {
1023
- alignItems: "center",
1024
- justifyContent: "space-between"
1025
- },
1026
- children: [/* @__PURE__ */ I(P, {
1027
- variant: "h5",
1028
- component: "h1",
1029
- children: "Message Details"
1030
- }), s && /* @__PURE__ */ I(G, { href: s })]
1031
- }),
1032
- /* @__PURE__ */ L(M, {
1033
- spacing: .5,
1034
- children: [
1035
- /* @__PURE__ */ I(V, {
1036
- label: "Status",
1037
- value: /* @__PURE__ */ I(v, {
1038
- "data-testid": "activity-status",
1039
- label: e(i),
1040
- color: n(i),
1041
- size: "small"
1042
- })
1043
- }),
1044
- a && /* @__PURE__ */ I(V, {
1045
- label: "Requested by",
1046
- value: a
1047
- }),
1048
- o && /* @__PURE__ */ I(V, {
1049
- label: "External transaction ID",
1050
- value: o,
1051
- action: /* @__PURE__ */ I(K, {
1052
- value: o,
1053
- label: "Copy external transaction ID"
1054
- })
1055
- }),
1056
- /* @__PURE__ */ L(d, { children: [/* @__PURE__ */ I(P, {
1057
- variant: "body2",
1058
- component: "h2",
1059
- sx: {
1060
- fontWeight: "bold",
1061
- py: 1
1062
- },
1063
- children: "Message"
1064
- }), /* @__PURE__ */ I(d, {
1065
- component: "pre",
1066
- sx: {
1067
- m: 0,
1068
- p: 1.5,
1069
- overflow: "auto",
1070
- whiteSpace: "pre-wrap",
1071
- bgcolor: "action.hover",
1072
- borderRadius: 1,
1073
- fontSize: "0.8125rem"
1074
- },
1075
- children: r
1076
- })] })
1077
- ]
1078
- }),
1079
- i === "pending" && /* @__PURE__ */ I(H, {
1080
- approving: c,
1081
- rejecting: l,
1082
- signing: u,
1083
- disabled: f,
1084
- onApprove: () => p(t),
1085
- onReject: m && (() => m(t))
1086
- })
1087
- ]
1088
- }), Ve = ({ network: e, activeSession: t = !1, accessToken: n = "", onReview: r }) => {
1089
- let i = e.synchronizerId ?? "";
1090
- return /* @__PURE__ */ I(p, {
1091
- component: "article",
1092
- "data-testid": "network-card",
1093
- variant: "outlined",
1094
- sx: {
1095
- position: "relative",
1096
- ...r && { "&:hover": {
1097
- borderColor: "primary.main",
1098
- boxShadow: 2
1099
- } }
1100
- },
1101
- children: /* @__PURE__ */ L(g, { children: [/* @__PURE__ */ L(M, {
1102
- direction: "row",
1103
- spacing: 1,
1104
- sx: {
1105
- alignItems: "center",
1106
- mb: 1
1107
- },
1108
- children: [r ? /* @__PURE__ */ I(T, {
1109
- component: "button",
1110
- type: "button",
1111
- variant: "body1",
1112
- color: "inherit",
1113
- underline: "none",
1114
- onClick: () => r(e),
1115
- sx: {
1116
- fontWeight: "bold",
1117
- textAlign: "left",
1118
- position: "static",
1119
- "&::after": {
1120
- content: "\"\"",
1121
- position: "absolute",
1122
- inset: 0,
1123
- cursor: "pointer"
1124
- }
1125
- },
1126
- children: e.name
1127
- }) : /* @__PURE__ */ I(P, {
1128
- variant: "body1",
1129
- sx: { fontWeight: "bold" },
1130
- children: e.name
1131
- }), t && /* @__PURE__ */ I(v, {
1132
- label: "CONNECTED",
1133
- color: "success",
1134
- size: "small"
1135
- })]
1136
- }), /* @__PURE__ */ L(M, {
1137
- spacing: .5,
1138
- children: [
1139
- /* @__PURE__ */ I(V, {
1140
- label: "ID",
1141
- value: e.id
1142
- }),
1143
- t && /* @__PURE__ */ I(V, {
1144
- label: "Access Token",
1145
- value: "[private]",
1146
- muted: !0,
1147
- action: /* @__PURE__ */ I(K, {
1148
- value: n,
1149
- label: "Copy access token"
1150
- })
1151
- }),
1152
- /* @__PURE__ */ I(V, {
1153
- label: "Auth",
1154
- value: e.authMethod
1155
- }),
1156
- i && /* @__PURE__ */ I(V, {
1157
- label: "Synchronizer",
1158
- value: i,
1159
- action: /* @__PURE__ */ I(K, {
1160
- value: i,
1161
- label: "Copy synchronizer ID"
1162
- })
1163
- }),
1164
- e.identityProviderId && /* @__PURE__ */ I(V, {
1165
- label: "Identity provider",
1166
- value: e.identityProviderId
1167
- })
1168
- ]
1169
- })] })
1170
- });
1171
- }, J = ie(ke), He = ["client_credentials"], Ue = {
1172
- id: "",
1173
- name: "",
1174
- description: "",
1175
- identityProviderId: "",
1176
- ledgerApi: "",
1177
- auth: {
1178
- method: "authorization_code",
1179
- audience: "",
1180
- scope: "",
1181
- clientId: ""
194
+ }), de = E({
195
+ tagName: "wg-login-form",
196
+ elementClass: c,
197
+ react: b,
198
+ events: {
199
+ onLoginConnect: "login-connect",
200
+ onLoginBack: "login-back"
1182
201
  }
1183
- }, We = (e) => {
1184
- try {
1185
- return new URL(e), !0;
1186
- } catch {
1187
- return !1;
202
+ }), fe = E({
203
+ tagName: "wg-message-detail",
204
+ elementClass: l,
205
+ react: b,
206
+ events: {
207
+ onMessageApprove: "message-approve",
208
+ onMessageDelete: "message-delete"
1188
209
  }
1189
- }, Ge = (e) => ({
1190
- synchronizerId: !e.synchronizerId || e.synchronizerId.includes("::") && e.synchronizerId.length >= 10 ? void 0 : "Must contain \"::\" and be at least 10 characters",
1191
- ledgerApi: We(e.ledgerApi) ? void 0 : "Must be a valid URL"
1192
- }), Y = ({ title: e, children: t }) => {
1193
- let n = se();
1194
- return /* @__PURE__ */ L(d, {
1195
- component: "section",
1196
- "aria-labelledby": n,
1197
- children: [/* @__PURE__ */ I(P, {
1198
- id: n,
1199
- variant: "subtitle1",
1200
- component: "h3",
1201
- sx: {
1202
- fontWeight: "bold",
1203
- mb: 1
1204
- },
1205
- children: e
1206
- }), t]
1207
- });
1208
- }, Ke = ({ network: e, onSave: t, onDelete: n, onCancel: r }) => {
1209
- let i = e ?? Ue, [a, o] = z(i), [s, l] = z(e), [u, p] = z(0), [m, h] = z(!1);
1210
- e !== s && (l(e), o(i), p((e) => e + 1), h(!1));
1211
- let g = m ? Ge(a) : {
1212
- synchronizerId: void 0,
1213
- ledgerApi: void 0
1214
- }, _ = Object.values(g).some(Boolean), v = (e) => o((t) => ({
1215
- ...t,
1216
- ...e
1217
- })), y = R((e) => {
1218
- e && o((t) => ({
1219
- ...t,
1220
- auth: e
1221
- }));
1222
- }, []), b = R((e, t) => o((n) => {
1223
- let r = { ...n };
1224
- return delete r[e], t ? {
1225
- ...r,
1226
- [e]: t
1227
- } : r;
1228
- }), []), S = R((e) => b("adminAuth", e), [b]), C = R((e) => b("serviceAccountAuth", e), [b]);
1229
- return /* @__PURE__ */ L(d, {
1230
- component: "form",
1231
- onSubmit: (e) => {
1232
- e.preventDefault(), h(!0), !Object.values(Ge(a)).some(Boolean) && t(a);
1233
- },
1234
- sx: {
1235
- display: "flex",
1236
- flexDirection: "column",
1237
- height: "100%"
1238
- },
1239
- children: [
1240
- /* @__PURE__ */ L(M, {
1241
- spacing: 2,
1242
- children: [
1243
- /* @__PURE__ */ I(N, {
1244
- label: "Network Id",
1245
- required: !0,
1246
- fullWidth: !0,
1247
- helperText: "A unique identifier for the network",
1248
- value: a.id,
1249
- onChange: (e) => v({ id: e.target.value })
1250
- }),
1251
- /* @__PURE__ */ I(N, {
1252
- label: "Name",
1253
- required: !0,
1254
- fullWidth: !0,
1255
- value: a.name,
1256
- onChange: (e) => v({ name: e.target.value })
1257
- }),
1258
- /* @__PURE__ */ I(N, {
1259
- label: "Description",
1260
- required: !0,
1261
- fullWidth: !0,
1262
- value: a.description,
1263
- onChange: (e) => v({ description: e.target.value })
1264
- }),
1265
- /* @__PURE__ */ I(N, {
1266
- label: "Synchronizer Id",
1267
- fullWidth: !0,
1268
- error: !!g.synchronizerId,
1269
- helperText: g.synchronizerId,
1270
- value: a.synchronizerId ?? "",
1271
- onChange: (e) => {
1272
- let t = { ...a };
1273
- e.target.value ? t.synchronizerId = e.target.value : delete t.synchronizerId, o(t);
1274
- }
1275
- }),
1276
- /* @__PURE__ */ I(N, {
1277
- label: "Identity Provider Id",
1278
- required: !0,
1279
- fullWidth: !0,
1280
- value: a.identityProviderId,
1281
- onChange: (e) => v({ identityProviderId: e.target.value })
1282
- }),
1283
- /* @__PURE__ */ I(N, {
1284
- label: "Ledger API Base Url",
1285
- required: !0,
1286
- fullWidth: !0,
1287
- error: !!g.ledgerApi,
1288
- helperText: g.ledgerApi,
1289
- value: a.ledgerApi,
1290
- onChange: (e) => v({ ledgerApi: e.target.value })
1291
- }),
1292
- /* @__PURE__ */ I(Y, {
1293
- title: "Configure user auth",
1294
- children: /* @__PURE__ */ I(J, {
1295
- auth: a.auth,
1296
- onChange: y
1297
- }, u)
1298
- }),
1299
- /* @__PURE__ */ I(Y, {
1300
- title: "Configure admin auth",
1301
- children: /* @__PURE__ */ I(J, {
1302
- auth: a.adminAuth,
1303
- optional: !0,
1304
- label: "admin auth",
1305
- onChange: S
1306
- }, u)
1307
- }),
1308
- /* @__PURE__ */ I(Y, {
1309
- title: "Configure service account auth",
1310
- children: /* @__PURE__ */ I(J, {
1311
- auth: a.serviceAccountAuth,
1312
- allowedMethods: He,
1313
- optional: !0,
1314
- label: "service account auth",
1315
- onChange: C
1316
- }, u)
1317
- })
1318
- ]
1319
- }),
1320
- _ && /* @__PURE__ */ I(c, {
1321
- severity: "error",
1322
- sx: { mt: 2 },
1323
- children: "Invalid network data, please ensure all fields are set correctly"
1324
- }),
1325
- e ? /* @__PURE__ */ L(F, { children: [n && /* @__PURE__ */ L(d, {
1326
- sx: { mt: 4 },
1327
- children: [
1328
- /* @__PURE__ */ I(x, { sx: { mb: 3 } }),
1329
- /* @__PURE__ */ I(P, {
1330
- variant: "subtitle1",
1331
- component: "h2",
1332
- sx: {
1333
- fontWeight: "bold",
1334
- mb: 1
1335
- },
1336
- children: "Delete network"
1337
- }),
1338
- /* @__PURE__ */ I(P, {
1339
- variant: "body2",
1340
- color: "text.secondary",
1341
- sx: { mb: 2 },
1342
- children: "You will not be able to undo the change once you delete this network."
1343
- }),
1344
- /* @__PURE__ */ I(f, {
1345
- variant: "outlined",
1346
- color: "error",
1347
- onClick: () => n(e),
1348
- children: "Delete Network"
1349
- })
1350
- ]
1351
- }), /* @__PURE__ */ L(M, {
1352
- direction: "row",
1353
- spacing: 2,
1354
- sx: { mt: 3 },
1355
- children: [r && /* @__PURE__ */ I(f, {
1356
- variant: "outlined",
1357
- color: "inherit",
1358
- fullWidth: !0,
1359
- onClick: r,
1360
- children: "Cancel"
1361
- }), /* @__PURE__ */ I(f, {
1362
- type: "submit",
1363
- variant: "contained",
1364
- fullWidth: !0,
1365
- "data-test-id": "update-network-button",
1366
- children: "Update"
1367
- })]
1368
- })] }) : /* @__PURE__ */ I(d, {
1369
- sx: {
1370
- mt: "auto",
1371
- pt: 3
1372
- },
1373
- children: /* @__PURE__ */ I(f, {
1374
- type: "submit",
1375
- variant: "contained",
1376
- fullWidth: !0,
1377
- "data-test-id": "add-network-button",
1378
- children: "Add"
1379
- })
1380
- })
1381
- ]
1382
- });
1383
- }, qe = ({ total: e, pageSize: t = 5, page: n = 1, onPageChange: r }) => {
1384
- let i = Math.max(t, 1), a = Math.max(1, Math.ceil(e / i)), o = Math.min(Math.max(n, 1), a), s = e > 0 ? (o - 1) * i + 1 : 0, c = e > 0 ? Math.min(s + i - 1, e) : 0;
1385
- return /* @__PURE__ */ L(M, {
1386
- component: "nav",
1387
- "aria-label": "Pagination",
1388
- direction: "row",
1389
- spacing: 1,
1390
- sx: {
1391
- alignItems: "center",
1392
- display: "inline-flex"
1393
- },
1394
- children: [
1395
- /* @__PURE__ */ I(C, {
1396
- size: "small",
1397
- "aria-label": "Previous page",
1398
- disabled: o <= 1,
1399
- onClick: () => r(o - 1),
1400
- children: /* @__PURE__ */ I(B, { fontSize: "small" })
1401
- }),
1402
- /* @__PURE__ */ L(P, {
1403
- variant: "body2",
1404
- component: "span",
1405
- children: [
1406
- s,
1407
- "-",
1408
- c,
1409
- " of ",
1410
- e
1411
- ]
1412
- }),
1413
- /* @__PURE__ */ I(C, {
1414
- size: "small",
1415
- "aria-label": "Next page",
1416
- disabled: o >= a,
1417
- onClick: () => r(o + 1),
1418
- children: /* @__PURE__ */ I(ge, { fontSize: "small" })
1419
- })
1420
- ]
1421
- });
1422
- }, X = ({ signingProviders: e, value: t, onChange: n, disabled: r = !1, disabledProviders: i = [] }) => {
210
+ }), pe = E({
211
+ tagName: "network-card",
212
+ elementClass: o,
213
+ react: b,
214
+ events: {
215
+ onNetworkReview: "network-review",
216
+ onDelete: "delete",
217
+ onUpdate: "update"
218
+ }
219
+ }), me = E({
220
+ tagName: "network-form",
221
+ elementClass: e,
222
+ react: b,
223
+ events: {
224
+ onNetworkEditCancel: "network-edit-cancel",
225
+ onNetworkEditSave: "network-edit-save",
226
+ onNetworkDelete: "network-delete"
227
+ }
228
+ }), he = E({
229
+ tagName: "not-found",
230
+ elementClass: r,
231
+ react: b
232
+ }), ge = E({
233
+ tagName: "wg-page-header",
234
+ elementClass: f,
235
+ react: b
236
+ }), _e = E({
237
+ tagName: "wg-pagination",
238
+ elementClass: s,
239
+ react: b,
240
+ events: { onPageChange: "page-change" }
241
+ }), ve = ({ signingProviders: e, value: t, onChange: n, disabled: r = !1, disabledProviders: i = [] }) => {
1423
242
  let a = e === void 0, o = e?.length === 0;
1424
- return /* @__PURE__ */ L(N, {
243
+ return /* @__PURE__ */ z(F, {
1425
244
  id: "signing-provider-id",
1426
245
  select: !0,
1427
246
  label: "Signing Provider",
@@ -1434,19 +253,19 @@ var V = ({ label: e, value: t, title: n = typeof t == "string" ? t : void 0, mut
1434
253
  select: { native: !0 },
1435
254
  inputLabel: { shrink: !0 }
1436
255
  },
1437
- children: [/* @__PURE__ */ I("option", {
256
+ children: [/* @__PURE__ */ R("option", {
1438
257
  value: "",
1439
258
  disabled: !0,
1440
259
  children: a ? "Loading signing providers..." : o ? "No signing providers available" : "Select signing provider"
1441
- }), e?.map((e) => /* @__PURE__ */ I("option", {
260
+ }), e?.map((e) => /* @__PURE__ */ R("option", {
1442
261
  value: e,
1443
262
  disabled: i.includes(e),
1444
263
  children: e
1445
264
  }, e))]
1446
265
  });
1447
- }, Z = ({ title: e, message: t, type: n = "error", buttonText: r = "Dismiss notification", autoHideDuration: i, onExited: a }) => {
1448
- let [o, s] = z(!0);
1449
- return /* @__PURE__ */ I(j, {
266
+ }, X = ({ title: e, message: t, type: n = "error", buttonText: r = "Dismiss notification", autoHideDuration: i, onExited: a }) => {
267
+ let [o, s] = T(!0);
268
+ return /* @__PURE__ */ R(N, {
1450
269
  open: o,
1451
270
  autoHideDuration: i,
1452
271
  onClose: (e, t) => {
@@ -1457,335 +276,87 @@ var V = ({ label: e, value: t, title: n = typeof t == "string" ? t : void 0, mut
1457
276
  position: "static",
1458
277
  pointerEvents: "auto"
1459
278
  },
1460
- children: /* @__PURE__ */ L(c, {
279
+ children: /* @__PURE__ */ z(D, {
1461
280
  role: n === "error" ? "alert" : "status",
1462
281
  severity: n,
1463
282
  closeText: r,
1464
283
  onClose: () => s(!1),
1465
284
  sx: { width: "100%" },
1466
- children: [/* @__PURE__ */ I(l, { children: e }), t]
1467
- })
1468
- });
1469
- }, Je = ({ transactionId: t, commandId: r, externalTxId: o = null, status: c, parsed: l = null, createdAt: u = null, loading: d = !1, onReview: f }) => {
1470
- let h = a(l), _ = i(l), y = s(u);
1471
- return /* @__PURE__ */ I(p, {
1472
- variant: "outlined",
1473
- "data-testid": "transaction-card",
1474
- children: /* @__PURE__ */ I(m, {
1475
- disabled: d,
1476
- "aria-label": `Open activity ${r}`,
1477
- onClick: () => f(t, r),
1478
- children: /* @__PURE__ */ I(g, { children: /* @__PURE__ */ L(M, {
1479
- spacing: .5,
1480
- children: [
1481
- /* @__PURE__ */ I(V, {
1482
- label: "Command ID",
1483
- value: r
1484
- }),
1485
- o && /* @__PURE__ */ I(V, {
1486
- label: "External transaction ID",
1487
- value: o
1488
- }),
1489
- /* @__PURE__ */ I(V, {
1490
- label: "Status",
1491
- value: /* @__PURE__ */ I(v, {
1492
- "data-testid": "activity-status",
1493
- label: e(c),
1494
- color: n(c),
1495
- size: "small"
1496
- })
1497
- }),
1498
- /* @__PURE__ */ I(V, {
1499
- label: "Action type",
1500
- value: h
1501
- }),
1502
- /* @__PURE__ */ I(V, {
1503
- label: "Created at",
1504
- value: y
1505
- }),
1506
- /* @__PURE__ */ I(V, {
1507
- label: "Amount",
1508
- value: _
1509
- })
1510
- ]
1511
- }) })
285
+ children: [/* @__PURE__ */ R(O, { children: e }), t]
1512
286
  })
1513
287
  });
1514
- }, Q = ({ label: e, value: t, copyLabel: n }) => /* @__PURE__ */ I(V, {
1515
- label: e,
1516
- value: t || "N/A",
1517
- action: t ? /* @__PURE__ */ I(K, {
1518
- value: t,
1519
- label: n
1520
- }) : void 0
1521
- }), Ye = ({ commandId: t, externalTxId: r = null, status: i, txHash: o, parsed: c = null, createdAt: l = null, backHref: u, approving: p = !1, rejecting: m = !1, signing: h = !1, submitFailed: g = !1, disabled: _ = !1, onApprove: y, onReject: x }) => {
1522
- let [S, C] = z(!1), w = c?.signatories ?? [], T = c?.jsonString, E = i === "pending" || i === "signed";
1523
- return /* @__PURE__ */ L(M, {
1524
- spacing: 2,
1525
- children: [
1526
- /* @__PURE__ */ L(M, {
1527
- direction: "row",
1528
- sx: {
1529
- alignItems: "center",
1530
- justifyContent: "space-between"
1531
- },
1532
- children: [/* @__PURE__ */ I(P, {
1533
- variant: "h5",
1534
- component: "h1",
1535
- children: "Activity Details"
1536
- }), u && /* @__PURE__ */ I(G, { href: u })]
1537
- }),
1538
- /* @__PURE__ */ L(M, {
1539
- spacing: .5,
1540
- children: [
1541
- /* @__PURE__ */ I(V, {
1542
- label: "Status",
1543
- value: /* @__PURE__ */ I(v, {
1544
- "data-testid": "activity-status",
1545
- label: e(i),
1546
- color: n(i),
1547
- size: "small"
1548
- })
1549
- }),
1550
- /* @__PURE__ */ I(V, {
1551
- label: "Action type",
1552
- value: a(c)
1553
- }),
1554
- /* @__PURE__ */ I(V, {
1555
- label: "Created at",
1556
- value: s(l)
1557
- }),
1558
- /* @__PURE__ */ I(V, {
1559
- label: "Signatories",
1560
- value: w.length ? /* @__PURE__ */ I(M, {
1561
- spacing: .5,
1562
- sx: { alignItems: "flex-end" },
1563
- children: w.map((e) => /* @__PURE__ */ L(M, {
1564
- direction: "row",
1565
- sx: { alignItems: "center" },
1566
- children: [/* @__PURE__ */ I(P, {
1567
- variant: "body2",
1568
- noWrap: !0,
1569
- title: e,
1570
- children: e
1571
- }), /* @__PURE__ */ I(K, {
1572
- value: e,
1573
- label: "Copy signatory"
1574
- })]
1575
- }, e))
1576
- }) : "N/A"
1577
- }),
1578
- /* @__PURE__ */ I(Q, {
1579
- label: "Template",
1580
- value: c?.templateId,
1581
- copyLabel: "Copy template"
1582
- }),
1583
- /* @__PURE__ */ I(Q, {
1584
- label: "Command ID",
1585
- value: t,
1586
- copyLabel: "Copy command ID"
1587
- }),
1588
- r && /* @__PURE__ */ I(Q, {
1589
- label: "External transaction ID",
1590
- value: r,
1591
- copyLabel: "Copy external transaction ID"
1592
- }),
1593
- /* @__PURE__ */ I(Q, {
1594
- label: "Transaction hash",
1595
- value: o,
1596
- copyLabel: "Copy transaction hash"
1597
- }),
1598
- /* @__PURE__ */ L(d, { children: [/* @__PURE__ */ L(M, {
1599
- direction: "row",
1600
- sx: {
1601
- alignItems: "center",
1602
- justifyContent: "space-between"
1603
- },
1604
- children: [/* @__PURE__ */ I(f, {
1605
- color: "inherit",
1606
- "aria-expanded": S,
1607
- endIcon: /* @__PURE__ */ I(_e, { sx: { transform: S ? "rotate(180deg)" : "none" } }),
1608
- onClick: () => C((e) => !e),
1609
- children: "Transaction JSON Object"
1610
- }), T && /* @__PURE__ */ I(K, {
1611
- value: T,
1612
- label: "Copy transaction json object"
1613
- })]
1614
- }), /* @__PURE__ */ I(b, {
1615
- in: S,
1616
- unmountOnExit: !0,
1617
- children: /* @__PURE__ */ I(d, {
1618
- component: "pre",
1619
- sx: {
1620
- m: 0,
1621
- p: 1.5,
1622
- overflow: "auto",
1623
- bgcolor: "action.hover",
1624
- borderRadius: 1,
1625
- fontSize: "0.8125rem"
1626
- },
1627
- children: T || "N/A"
1628
- })
1629
- })] })
1630
- ]
1631
- }),
1632
- E && /* @__PURE__ */ I(H, {
1633
- approveLabel: i === "signed" && g ? "Retry submit" : "Approve",
1634
- approving: p,
1635
- rejecting: m,
1636
- signing: h,
1637
- disabled: _,
1638
- onApprove: () => y(t),
1639
- onReject: i === "pending" && x ? () => x(t) : void 0
1640
- })
1641
- ]
1642
- });
1643
- }, Xe = [
1644
- "CanActAs",
1645
- "CanReadAs",
1646
- "CanExecuteAs"
1647
- ], Ze = 72, Qe = 24, $e = (e) => e.length > Qe ? `${e.slice(0, 10)}...${e.slice(-10)}` : e, et = ({ children: e }) => /* @__PURE__ */ I(P, {
1648
- variant: "body2",
1649
- noWrap: !0,
1650
- sx: {
1651
- fontWeight: "bold",
1652
- flexShrink: 0,
1653
- width: "8rem"
1654
- },
1655
- children: e
1656
- }), tt = ({ wallet: e, verified: t = !1, loading: n = !1, onAllocate: r, onSetPrimary: i, onEdit: a, onSelect: o, selectLabel: s = "Select" }) => {
1657
- let c = new Set(e.rights), l = Xe.filter((e) => c.has(e)), u = !!(e.reason && (e.reason.length > Ze || e.reason.includes("\n"))), m = e.primary ? /* @__PURE__ */ I(v, {
1658
- label: "PRIMARY",
1659
- color: "success",
1660
- size: "small"
1661
- }, "badge") : e.disabled ? /* @__PURE__ */ I(v, {
1662
- label: "Disabled",
1663
- color: "error",
1664
- size: "small"
1665
- }, "badge") : null, _ = [];
1666
- o ? _.push(/* @__PURE__ */ I(f, {
1667
- size: "small",
1668
- disabled: n,
1669
- onClick: () => o(e),
1670
- children: s
1671
- }, "select")) : (_.push(m), t ? (!e.primary && !e.disabled && i && _.push(/* @__PURE__ */ I(f, {
1672
- size: "small",
1673
- disabled: n,
1674
- onClick: () => i(e),
1675
- children: "Set as primary"
1676
- }, "set-primary")), a && _.push(/* @__PURE__ */ I(f, {
1677
- size: "small",
1678
- disabled: n,
1679
- onClick: () => a(e),
1680
- children: "Edit"
1681
- }, "edit"))) : r && _.push(/* @__PURE__ */ I(f, {
1682
- size: "small",
1683
- variant: "outlined",
1684
- color: "inherit",
1685
- disabled: n || e.disabled === !0,
1686
- onClick: () => r(e),
1687
- children: "Allocate party"
1688
- }, "allocate")));
1689
- let y = _.some(Boolean);
1690
- return /* @__PURE__ */ L(p, {
1691
- component: "article",
1692
- variant: "outlined",
1693
- "data-testid": "wallet-card",
1694
- "party-id": e.partyId,
1695
- sx: {
1696
- display: "flex",
1697
- flexDirection: "column",
1698
- height: "100%"
1699
- },
1700
- children: [/* @__PURE__ */ I(g, {
1701
- sx: { flexGrow: 1 },
1702
- children: /* @__PURE__ */ L(M, {
1703
- spacing: .5,
1704
- "data-test-external-tx-id": e.externalTxId ?? "",
1705
- children: [
1706
- /* @__PURE__ */ I(V, {
1707
- label: "Party hint",
1708
- value: e.hint || "-",
1709
- action: e.hint ? /* @__PURE__ */ I(K, {
1710
- value: e.hint,
1711
- label: "Copy party hint"
1712
- }) : void 0
1713
- }),
1714
- /* @__PURE__ */ I(V, {
1715
- label: "Party ID",
1716
- value: $e(e.partyId),
1717
- title: e.partyId,
1718
- action: /* @__PURE__ */ I(K, {
1719
- value: e.partyId,
1720
- label: "Copy party ID"
1721
- })
1722
- }),
1723
- /* @__PURE__ */ I(V, {
1724
- label: "Signing provider",
1725
- value: e.signingProviderId
1726
- }),
1727
- e.reason && (u ? /* @__PURE__ */ L(d, {
1728
- sx: {
1729
- minHeight: 40,
1730
- py: .5
1731
- },
1732
- children: [/* @__PURE__ */ I(et, { children: "Reason" }), /* @__PURE__ */ I(P, {
1733
- variant: "body2",
1734
- title: e.reason,
1735
- sx: { whiteSpace: "pre-wrap" },
1736
- children: e.reason
1737
- })]
1738
- }) : /* @__PURE__ */ I(V, {
1739
- label: "Reason",
1740
- value: e.reason
1741
- })),
1742
- l.length > 0 && /* @__PURE__ */ I(V, {
1743
- label: "Permissions",
1744
- value: l.map((e) => /* @__PURE__ */ I(v, {
1745
- label: e,
1746
- size: "small"
1747
- }, e))
1748
- })
1749
- ]
1750
- })
1751
- }), y && /* @__PURE__ */ I(h, {
1752
- sx: { justifyContent: "space-between" },
1753
- children: _
1754
- })]
1755
- });
1756
- }, $ = ({ children: e, onSubmit: t, submitLabel: n, submittingLabel: r, submittingMessage: i, submitting: a = !1, loading: o = !1, submitDisabled: s = !1 }) => {
288
+ }, ye = E({
289
+ tagName: "wg-transaction-card",
290
+ elementClass: d,
291
+ react: b,
292
+ events: { onTransactionReview: "transaction-review" }
293
+ }), be = E({
294
+ tagName: "wg-transaction-detail",
295
+ elementClass: g,
296
+ react: b,
297
+ events: {
298
+ onTransactionApprove: "transaction-approve",
299
+ onTransactionDelete: "transaction-delete"
300
+ }
301
+ }), xe = E({
302
+ tagName: "wg-wallet-card",
303
+ elementClass: n,
304
+ react: b,
305
+ events: {
306
+ onWalletSetPrimary: "wallet-set-primary",
307
+ onWalletEdit: "wallet-edit",
308
+ onWalletAllocate: "wallet-allocate",
309
+ onWalletSelect: "wallet-select"
310
+ }
311
+ }), Se = E({
312
+ tagName: "wg-wallet-create-form",
313
+ elementClass: te,
314
+ react: b,
315
+ events: {
316
+ onWalletCreate: "wallet-create",
317
+ onSigningProviderChange: "signing-provider-change"
318
+ }
319
+ }), Z = E({
320
+ tagName: "wg-wallet-edit-form",
321
+ elementClass: p,
322
+ react: b,
323
+ events: {
324
+ onWalletEdit: "wallet-edit",
325
+ onSigningProviderChange: "signing-provider-change"
326
+ }
327
+ }), Ce = ({ children: e, onSubmit: t, submitLabel: n, submittingLabel: r, submittingMessage: i, submitting: a = !1, loading: o = !1, submitDisabled: s = !1 }) => {
1757
328
  let c = a || o || s;
1758
- return /* @__PURE__ */ L(d, {
329
+ return /* @__PURE__ */ z(k, {
1759
330
  component: "form",
1760
331
  onSubmit: (e) => {
1761
- e.preventDefault(), !c && t();
332
+ e.preventDefault(), c || t();
1762
333
  },
1763
334
  sx: {
1764
335
  display: "flex",
1765
336
  flexDirection: "column",
1766
337
  height: "100%"
1767
338
  },
1768
- children: [/* @__PURE__ */ I(M, {
339
+ children: [/* @__PURE__ */ R(P, {
1769
340
  spacing: 2,
1770
341
  children: e
1771
- }), /* @__PURE__ */ L(M, {
342
+ }), /* @__PURE__ */ z(P, {
1772
343
  spacing: 1,
1773
344
  sx: {
1774
345
  mt: "auto",
1775
346
  pt: 3
1776
347
  },
1777
- children: [/* @__PURE__ */ I(f, {
348
+ children: [/* @__PURE__ */ R(A, {
1778
349
  type: "submit",
1779
350
  variant: "contained",
1780
351
  fullWidth: !0,
1781
352
  disabled: c,
1782
- startIcon: a ? /* @__PURE__ */ I(y, {
353
+ startIcon: a ? /* @__PURE__ */ R(j, {
1783
354
  size: 16,
1784
355
  color: "inherit",
1785
356
  "aria-hidden": "true"
1786
357
  }) : void 0,
1787
358
  children: a ? r : n
1788
- }), a && /* @__PURE__ */ I(P, {
359
+ }), a && /* @__PURE__ */ R(L, {
1789
360
  variant: "body2",
1790
361
  color: "text.secondary",
1791
362
  role: "status",
@@ -1794,181 +365,30 @@ var V = ({ label: e, value: t, title: n = typeof t == "string" ? t : void 0, mut
1794
365
  })]
1795
366
  })]
1796
367
  });
1797
- }, nt = ({ signingProviders: e, keySigningProviders: t = [], publicKeys: n, selectedSigningProvider: r, showPrimary: i = !0, submitting: a = !1, submitLabel: o = "Add", submittingLabel: s = "Adding...", submittingMessage: c = "Creating party, please wait...", onCreate: l, onSigningProviderChange: u }) => {
1798
- let [f, p] = z(""), [m, h] = z(""), [g, v] = z(!1), [y, b] = z(""), x = r ?? m, C = !!x && t.includes(x), w = e?.length === 0, T = a || e === void 0 || C && n === void 0;
1799
- return /* @__PURE__ */ I(d, {
1800
- "data-testid": "wallet-create-form",
1801
- sx: { height: "100%" },
1802
- children: /* @__PURE__ */ L($, {
1803
- submitLabel: o,
1804
- submittingLabel: s,
1805
- submittingMessage: c,
1806
- submitting: a,
1807
- loading: T,
1808
- submitDisabled: w,
1809
- onSubmit: () => {
1810
- if (T || w) return;
1811
- let e = n?.find((e) => e.id === y)?.name;
1812
- e ? l(f, x, g, e) : l(f, x, g);
1813
- },
1814
- children: [
1815
- /* @__PURE__ */ I(N, {
1816
- id: "party-id-hint",
1817
- label: "Party ID Hint",
1818
- required: !0,
1819
- fullWidth: !0,
1820
- placeholder: "Enter the name of your wallet?",
1821
- disabled: a,
1822
- value: f,
1823
- onChange: (e) => p(e.target.value)
1824
- }),
1825
- /* @__PURE__ */ I(X, {
1826
- signingProviders: e,
1827
- value: x,
1828
- onChange: (e) => {
1829
- h(e), b(""), u?.(e);
1830
- },
1831
- disabled: a
1832
- }),
1833
- C && /* @__PURE__ */ L(N, {
1834
- id: "vault-name",
1835
- select: !0,
1836
- label: "Vault name",
1837
- required: !0,
1838
- fullWidth: !0,
1839
- disabled: T,
1840
- value: y,
1841
- onChange: (e) => b(e.target.value),
1842
- slotProps: {
1843
- select: { native: !0 },
1844
- inputLabel: { shrink: !0 }
1845
- },
1846
- children: [/* @__PURE__ */ I("option", {
1847
- value: "",
1848
- disabled: !0,
1849
- children: T ? "Loading vaults..." : "Select vault name"
1850
- }), n?.map((e) => /* @__PURE__ */ I("option", {
1851
- value: e.id,
1852
- children: e.name
1853
- }, e.id))]
1854
- }),
1855
- i && /* @__PURE__ */ I(S, {
1856
- label: "Set as primary wallet",
1857
- control: /* @__PURE__ */ I(_, {
1858
- id: "primary",
1859
- checked: g,
1860
- disabled: a,
1861
- onChange: (e) => v(e.target.checked)
1862
- })
1863
- })
1864
- ]
1865
- })
1866
- });
1867
- }, rt = ({ partyId: e, signingProviders: t, disabledSigningProviders: n = [], publicKeys: r, selectedSigningProvider: i, selectedPublicKey: a, submitting: o = !1, submitLabel: s = "Edit", submittingLabel: c = "Editing...", submittingMessage: l = "Editing party, please wait...", onEdit: u, onSigningProviderChange: d }) => {
1868
- let [f, p] = z(i ?? ""), [m, h] = z(a ?? ""), [g, _] = z(i), [v, b] = z(a);
1869
- i !== g && (_(i), p(i ?? "")), a !== v && (b(a), h(a ?? ""));
1870
- let x = t?.length === 0, S = r === void 0, C = n.includes(f), T = o || t === void 0;
1871
- return /* @__PURE__ */ L($, {
1872
- submitLabel: s,
1873
- submittingLabel: c,
1874
- submittingMessage: l,
1875
- submitting: o,
1876
- loading: T,
1877
- submitDisabled: x || !f || C || S,
1878
- onSubmit: () => {
1879
- !T && m && f && u(e, f, m);
1880
- },
1881
- children: [
1882
- /* @__PURE__ */ I(N, {
1883
- id: "party-id",
1884
- label: "Party ID",
1885
- fullWidth: !0,
1886
- disabled: !0,
1887
- value: e,
1888
- slotProps: { htmlInput: { readOnly: !0 } }
1889
- }),
1890
- /* @__PURE__ */ I(X, {
1891
- signingProviders: t,
1892
- value: f,
1893
- onChange: (e) => {
1894
- p(e), h(""), d?.(e);
1895
- },
1896
- disabled: o,
1897
- disabledProviders: n
1898
- }),
1899
- /* @__PURE__ */ L(N, {
1900
- id: "public-key-id",
1901
- select: !0,
1902
- label: "Public Key",
1903
- required: !0,
1904
- fullWidth: !0,
1905
- disabled: o,
1906
- value: C ? "" : m,
1907
- onChange: (e) => h(e.target.value),
1908
- slotProps: {
1909
- select: { native: !0 },
1910
- inputLabel: { shrink: !0 },
1911
- ...S && { input: { startAdornment: /* @__PURE__ */ I(w, {
1912
- position: "start",
1913
- children: /* @__PURE__ */ I(y, {
1914
- size: 16,
1915
- "aria-label": "Loading public keys"
1916
- })
1917
- }) } }
1918
- },
1919
- children: [/* @__PURE__ */ I("option", {
1920
- value: "",
1921
- disabled: !0,
1922
- children: S ? "" : C ? "Select different signing provider" : "Select public key"
1923
- }), r?.map((e) => /* @__PURE__ */ L("option", {
1924
- value: e.publicKey,
1925
- children: [
1926
- e.name,
1927
- " (",
1928
- e.publicKey,
1929
- ")"
1930
- ]
1931
- }, e.publicKey))]
1932
- })
1933
- ]
1934
- });
1935
- }, it = he`
1936
- from {
1937
- transform: rotate(0deg);
1938
- }
1939
- to {
1940
- transform: rotate(360deg);
1941
- }
1942
- `, at = ({ syncNeeded: e = !1, syncing: t = !1, disabled: n = !1, onSync: r }) => {
1943
- let i = t ? "Syncing parties..." : e ? "Refresh parties (changes available)" : "Refresh parties";
1944
- return /* @__PURE__ */ I(te, {
1945
- title: i,
1946
- describeChild: !0,
1947
- children: /* @__PURE__ */ I("span", { children: /* @__PURE__ */ I(C, {
1948
- size: "small",
1949
- "aria-label": i,
1950
- color: e ? "primary" : "default",
1951
- disabled: n || t,
1952
- onClick: r,
1953
- children: /* @__PURE__ */ I(me, {
1954
- fontSize: "small",
1955
- sx: t ? {
1956
- animation: `${it} 1s linear infinite`,
1957
- "@media (prefers-reduced-motion: reduce)": { animation: "none" }
1958
- } : void 0
1959
- })
1960
- }) })
1961
- });
1962
- }, ot = re(null), st = ({ children: e, autoHideDuration: t = 5e3 }) => {
1963
- let [n, r] = z([]), i = le(0), a = R((e) => {
368
+ }, we = E({
369
+ tagName: "wg-wallet-list",
370
+ elementClass: v,
371
+ react: b,
372
+ events: {
373
+ onWalletAllocate: "wallet-allocate",
374
+ onWalletEdit: "wallet-edit",
375
+ onWalletSetPrimary: "wallet-set-primary"
376
+ }
377
+ }), Te = E({
378
+ tagName: "wg-wallets-sync",
379
+ elementClass: a,
380
+ react: b,
381
+ events: { onWalletsSync: "wallets-sync" }
382
+ }), Q = ne(null), Ee = ({ children: e, autoHideDuration: t = 5e3 }) => {
383
+ let [n, r] = T([]), i = w(0), a = x((e) => {
1964
384
  r((t) => [...t, {
1965
385
  ...e,
1966
386
  id: i.current++
1967
387
  }]);
1968
- }, []), o = ce(() => ({ showToast: a }), [a]);
1969
- return /* @__PURE__ */ L(ot.Provider, {
388
+ }, []), o = C(() => ({ showToast: a }), [a]);
389
+ return /* @__PURE__ */ z(Q.Provider, {
1970
390
  value: o,
1971
- children: [e, n.length > 0 && /* @__PURE__ */ I(M, {
391
+ children: [e, n.length > 0 && /* @__PURE__ */ R(P, {
1972
392
  spacing: 1,
1973
393
  sx: {
1974
394
  position: "fixed",
@@ -1988,24 +408,24 @@ var V = ({ label: e, value: t, title: n = typeof t == "string" ? t : void 0, mut
1988
408
  maxWidth: "calc(100vw - 32px)",
1989
409
  pointerEvents: "none"
1990
410
  },
1991
- children: n.map(({ id: e, ...n }) => /* @__PURE__ */ I(Z, {
411
+ children: n.map(({ id: e, ...n }) => /* @__PURE__ */ R(X, {
1992
412
  ...n,
1993
413
  autoHideDuration: t,
1994
414
  onExited: () => r((t) => t.filter((t) => t.id !== e))
1995
415
  }, e))
1996
416
  })]
1997
417
  });
1998
- }, ct = () => {
1999
- let e = ae(ot);
418
+ }, $ = () => {
419
+ let e = re(Q);
2000
420
  if (!e) throw Error("useToast must be used within a ToastProvider");
2001
421
  return e;
2002
- }, lt = () => {
2003
- let { showToast: e } = ct();
2004
- return R((t, n) => e({
2005
- ...o(t, n),
422
+ }, De = () => {
423
+ let { showToast: e } = $();
424
+ return x((t, n) => e({
425
+ ..._(t, n),
2006
426
  type: "error"
2007
427
  }), [e]);
2008
428
  };
2009
- export { ve as ApiKeyCard, be as ApiKeyForm, Ce as AppHeader, H as ApprovalActions, ke as AuthEditor, G as BackLink, V as CardDetailRow, K as CopyButton, je as ErrorPage, Me as IdpCard, Ie as IdpForm, Re as LoadingState, ze as LoginForm, Be as MessageDetail, Ve as NetworkCard, Ke as NetworkForm, qe as Pagination, X as SigningProviderSelect, xe as StatusDot, Z as Toast, st as ToastProvider, Je as TransactionCard, Ye as TransactionDetail, tt as WalletCard, nt as WalletCreateForm, rt as WalletEditForm, $ as WalletForm, at as WalletsSync, Se as defaultNavItems, lt as useErrorToast, ct as useToast };
429
+ export { U as ApiKeyCard, K as ApiKeyForm, q as AppHeader, G as ApprovalActions, J as BackLink, Y as CardDetailRow, ae as CopyButton, oe as ErrorPage, se as IdpCard, ce as IdpForm, ue as LoadingState, de as LoginForm, fe as MessageDetail, pe as NetworkCard, me as NetworkForm, he as NotFound, ge as PageHeader, _e as Pagination, ve as SigningProviderSelect, X as Toast, Ee as ToastProvider, ye as TransactionCard, be as TransactionDetail, xe as WalletCard, Se as WalletCreateForm, Z as WalletEditForm, Ce as WalletForm, we as WalletList, Te as WalletsSync, De as useErrorToast, $ as useToast };
2010
430
 
2011
431
  //# sourceMappingURL=index.js.map