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