@canton-network/core-wallet-ui-components 1.17.0 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/README.md +11 -0
  2. package/dist/components/api-key-card.d.ts +1 -1
  3. package/dist/components/api-key-card.d.ts.map +1 -1
  4. package/dist/components/api-key-form.d.ts +1 -1
  5. package/dist/components/api-key-form.d.ts.map +1 -1
  6. package/dist/components/app-header.d.ts +9 -6
  7. package/dist/components/app-header.d.ts.map +1 -1
  8. package/dist/components/app-layout.d.ts +8 -6
  9. package/dist/components/app-layout.d.ts.map +1 -1
  10. package/dist/components/auth-editor.d.ts +5 -3
  11. package/dist/components/auth-editor.d.ts.map +1 -1
  12. package/dist/components/back-link.d.ts +2 -2
  13. package/dist/components/back-link.d.ts.map +1 -1
  14. package/dist/components/copy-button.d.ts +3 -3
  15. package/dist/components/copy-button.d.ts.map +1 -1
  16. package/dist/components/custom-toast.d.ts +5 -5
  17. package/dist/components/custom-toast.d.ts.map +1 -1
  18. package/dist/components/error-page.d.ts +5 -5
  19. package/dist/components/error-page.d.ts.map +1 -1
  20. package/dist/components/form-input.d.ts +6 -6
  21. package/dist/components/form-input.d.ts.map +1 -1
  22. package/dist/components/idp-card.d.ts +2 -2
  23. package/dist/components/idp-card.d.ts.map +1 -1
  24. package/dist/components/idp-form.d.ts +3 -3
  25. package/dist/components/idp-form.d.ts.map +1 -1
  26. package/dist/components/loading-state.d.ts +1 -1
  27. package/dist/components/loading-state.d.ts.map +1 -1
  28. package/dist/components/login-form.d.ts +5 -5
  29. package/dist/components/login-form.d.ts.map +1 -1
  30. package/dist/components/message-detail.d.ts +10 -10
  31. package/dist/components/message-detail.d.ts.map +1 -1
  32. package/dist/components/network-card.d.ts +4 -4
  33. package/dist/components/network-card.d.ts.map +1 -1
  34. package/dist/components/network-form.d.ts +1 -1
  35. package/dist/components/network-form.d.ts.map +1 -1
  36. package/dist/components/not-found.d.ts +1 -1
  37. package/dist/components/not-found.d.ts.map +1 -1
  38. package/dist/components/page-header.d.ts +14 -0
  39. package/dist/components/page-header.d.ts.map +1 -0
  40. package/dist/components/pagination.d.ts +4 -3
  41. package/dist/components/pagination.d.ts.map +1 -1
  42. package/dist/components/transaction-card.d.ts +9 -9
  43. package/dist/components/transaction-card.d.ts.map +1 -1
  44. package/dist/components/transaction-detail.d.ts +16 -16
  45. package/dist/components/transaction-detail.d.ts.map +1 -1
  46. package/dist/components/wallet-card.d.ts +6 -5
  47. package/dist/components/wallet-card.d.ts.map +1 -1
  48. package/dist/components/wallet-create-form.d.ts +2 -2
  49. package/dist/components/wallet-create-form.d.ts.map +1 -1
  50. package/dist/components/wallet-edit-form.d.ts +3 -2
  51. package/dist/components/wallet-edit-form.d.ts.map +1 -1
  52. package/dist/components/wallet-form.d.ts +7 -7
  53. package/dist/components/wallet-form.d.ts.map +1 -1
  54. package/dist/components/wallet-list.d.ts +18 -0
  55. package/dist/components/wallet-list.d.ts.map +1 -0
  56. package/dist/components/wallet-picker.d.ts +14 -2
  57. package/dist/components/wallet-picker.d.ts.map +1 -1
  58. package/dist/components/wallets-sync.d.ts +14 -7
  59. package/dist/components/wallets-sync.d.ts.map +1 -1
  60. package/dist/date-time.d.ts +14 -0
  61. package/dist/date-time.d.ts.map +1 -0
  62. package/dist/error-toast-By8cEMjq.cjs +4002 -0
  63. package/dist/error-toast-By8cEMjq.cjs.map +1 -0
  64. package/dist/error-toast-DQZ4SB72.js +17335 -0
  65. package/dist/error-toast-DQZ4SB72.js.map +1 -0
  66. package/dist/index.cjs +714 -4548
  67. package/dist/index.cjs.map +1 -1
  68. package/dist/index.css +2 -1
  69. package/dist/index.d.ts +3 -0
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +2210 -12941
  72. package/dist/index.js.map +1 -1
  73. package/dist/internal/activity-render.d.ts +6 -1
  74. package/dist/internal/activity-render.d.ts.map +1 -1
  75. package/dist/internal/activity-utils.d.ts +0 -1
  76. package/dist/internal/activity-utils.d.ts.map +1 -1
  77. package/dist/internal/base-element.d.ts.map +1 -1
  78. package/dist/logic/index.cjs +1 -0
  79. package/dist/logic/index.d.ts +2 -0
  80. package/dist/logic/index.d.ts.map +1 -0
  81. package/dist/logic/index.js +1 -0
  82. package/dist/logic/parties.d.ts +59 -0
  83. package/dist/logic/parties.d.ts.map +1 -0
  84. package/dist/parties-B5mhMShF.js +111 -0
  85. package/dist/parties-B5mhMShF.js.map +1 -0
  86. package/dist/parties-DTtG9UJI.cjs +2 -0
  87. package/dist/parties-DTtG9UJI.cjs.map +1 -0
  88. package/dist/react/components/ApiKeyCard.d.ts +5 -7
  89. package/dist/react/components/ApiKeyCard.d.ts.map +1 -1
  90. package/dist/react/components/ApiKeyForm.d.ts +5 -7
  91. package/dist/react/components/ApiKeyForm.d.ts.map +1 -1
  92. package/dist/react/components/AppHeader.d.ts +6 -29
  93. package/dist/react/components/AppHeader.d.ts.map +1 -1
  94. package/dist/react/components/CardDetailRow.d.ts +1 -1
  95. package/dist/react/components/CardDetailRow.d.ts.map +1 -1
  96. package/dist/react/components/ErrorPage.d.ts +6 -9
  97. package/dist/react/components/ErrorPage.d.ts.map +1 -1
  98. package/dist/react/components/IdpCard.d.ts +7 -8
  99. package/dist/react/components/IdpCard.d.ts.map +1 -1
  100. package/dist/react/components/IdpForm.d.ts +8 -18
  101. package/dist/react/components/IdpForm.d.ts.map +1 -1
  102. package/dist/react/components/LoginForm.d.ts +6 -29
  103. package/dist/react/components/LoginForm.d.ts.map +1 -1
  104. package/dist/react/components/MessageDetail.d.ts +6 -26
  105. package/dist/react/components/MessageDetail.d.ts.map +1 -1
  106. package/dist/react/components/NetworkCard.d.ts +7 -12
  107. package/dist/react/components/NetworkCard.d.ts.map +1 -1
  108. package/dist/react/components/NetworkForm.d.ts +7 -16
  109. package/dist/react/components/NetworkForm.d.ts.map +1 -1
  110. package/dist/react/components/NotFound.d.ts +3 -0
  111. package/dist/react/components/NotFound.d.ts.map +1 -0
  112. package/dist/react/components/PageHeader.d.ts +3 -0
  113. package/dist/react/components/PageHeader.d.ts.map +1 -0
  114. package/dist/react/components/Pagination.d.ts +5 -12
  115. package/dist/react/components/Pagination.d.ts.map +1 -1
  116. package/dist/react/components/TransactionCard.d.ts +5 -16
  117. package/dist/react/components/TransactionCard.d.ts.map +1 -1
  118. package/dist/react/components/TransactionDetail.d.ts +6 -28
  119. package/dist/react/components/TransactionDetail.d.ts.map +1 -1
  120. package/dist/react/components/WalletCard.d.ts +8 -20
  121. package/dist/react/components/WalletCard.d.ts.map +1 -1
  122. package/dist/react/components/WalletCreateForm.d.ts +7 -34
  123. package/dist/react/components/WalletCreateForm.d.ts.map +1 -1
  124. package/dist/react/components/WalletEditForm.d.ts +7 -34
  125. package/dist/react/components/WalletEditForm.d.ts.map +1 -1
  126. package/dist/react/components/WalletList.d.ts +9 -0
  127. package/dist/react/components/WalletList.d.ts.map +1 -0
  128. package/dist/react/components/WalletsSync.d.ts +5 -12
  129. package/dist/react/components/WalletsSync.d.ts.map +1 -1
  130. package/dist/react/index.cjs +3 -11
  131. package/dist/react/index.cjs.map +1 -1
  132. package/dist/react/index.d.ts +3 -1
  133. package/dist/react/index.d.ts.map +1 -1
  134. package/dist/react/index.js +422 -2479
  135. package/dist/react/index.js.map +1 -1
  136. package/dist/routing.d.ts +1 -1
  137. package/dist/routing.d.ts.map +1 -1
  138. package/package.json +18 -14
  139. package/themes/default.css +125 -74
  140. package/dist/activity-utils-CsiZsTG2.cjs +0 -4
  141. package/dist/activity-utils-CsiZsTG2.cjs.map +0 -1
  142. package/dist/activity-utils-glrdQSNU.js +0 -1944
  143. package/dist/activity-utils-glrdQSNU.js.map +0 -1
  144. package/dist/react/components/AuthEditor.d.ts +0 -21
  145. package/dist/react/components/AuthEditor.d.ts.map +0 -1
@@ -1,965 +1,156 @@
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, At as t, C as n, E as r, Mt as i, T as a, Z as o, ct as s, f as c, ft as ee, g as te, i as l, j as u, l as d, lt as f, m as p, nt as m, ot as h, s as g, t as _, v, vt as y } from "../error-toast-DQZ4SB72.js";
2
+ import b, { createContext as ne, useCallback as x, useContext as re, useEffect as S, useMemo as C, useRef as w, useState as T } from "react";
3
+ import { createComponent as E } from "@lit/react";
4
+ import { Alert as D, AlertTitle as O, Box as k, Button as A, CircularProgress as j, IconButton as M, Snackbar as N, Stack as P, TextField as F, Tooltip as I, Typography as L } from "@mui/material";
5
+ import { jsx as R, jsxs as z } from "react/jsx-runtime";
6
+ import B from "@mui/icons-material/ChevronLeft";
7
+ import V from "@mui/icons-material/ContentCopy";
8
+ import { keyframes as H } from "@mui/material/styles";
9
+ // src/react/components/ApiKeyCard.tsx
10
+ var U = E({
11
+ tagName: "api-key-card",
12
+ elementClass: i,
13
+ react: b,
14
+ events: { onRevoke: "revoke" }
15
+ }), W = () => /* @__PURE__ */ R(j, {
16
+ size: 16,
17
+ color: "inherit",
18
+ "aria-hidden": "true"
19
+ }), G = ({ onApprove: e, onReject: t, approveLabel: n = "Approve", approving: r = !1, rejecting: i = !1, signing: a = !1, disabled: o = !1 }) => /* @__PURE__ */ z(P, {
20
+ direction: "row",
21
+ spacing: 2,
22
+ children: [t && /* @__PURE__ */ R(A, {
23
+ variant: "outlined",
24
+ color: "error",
25
+ fullWidth: !0,
26
+ disabled: o || r || i,
27
+ startIcon: i ? /* @__PURE__ */ R(W, {}) : void 0,
28
+ onClick: t,
29
+ children: "Reject"
30
+ }), /* @__PURE__ */ R(A, {
31
+ variant: "contained",
32
+ fullWidth: !0,
33
+ disabled: o || r || i || a,
34
+ startIcon: r || a ? /* @__PURE__ */ R(W, {}) : void 0,
35
+ onClick: e,
36
+ children: n
37
+ })]
38
+ }), K = E({
39
+ tagName: "api-key-form",
40
+ elementClass: t,
41
+ react: b,
42
+ events: { onApiKeyGenerate: "api-key-generate" }
43
+ }), q = E({
44
+ tagName: "app-header",
45
+ elementClass: y,
46
+ react: b,
47
+ events: {
48
+ onLogout: "logout",
49
+ onCopyDappApiUrl: "copy-dapp-api-url"
50
+ }
51
+ }), J = ({ label: e = "Back", href: t, onClick: n }) => /* @__PURE__ */ R(A, {
52
+ color: "inherit",
53
+ size: "small",
54
+ startIcon: /* @__PURE__ */ R(B, {}),
55
+ ...t === void 0 ? { onClick: n } : { href: t },
56
+ children: e
57
+ }), Y = ({ label: e, value: t, title: n = typeof t == "string" ? t : void 0, muted: r = !1, action: i }) => {
58
+ let a = typeof t == "string";
59
+ return /* @__PURE__ */ z(k, {
60
+ sx: {
61
+ display: "flex",
62
+ alignItems: "center",
63
+ gap: 2,
64
+ minWidth: 0,
65
+ minHeight: 40
66
+ },
67
+ children: [
68
+ /* @__PURE__ */ R(L, {
69
+ variant: "body2",
70
+ noWrap: !0,
71
+ sx: {
72
+ fontWeight: "bold",
73
+ flexShrink: 0,
74
+ minWidth: "8rem"
75
+ },
76
+ children: e
77
+ }),
78
+ /* @__PURE__ */ R(L, {
79
+ variant: "body2",
80
+ component: "div",
81
+ noWrap: a,
82
+ title: a ? n : void 0,
83
+ color: r ? "text.secondary" : "text.primary",
84
+ sx: {
85
+ flex: 1,
86
+ minWidth: 0,
87
+ textAlign: "right",
88
+ ...!a && {
89
+ display: "flex",
90
+ flexWrap: "wrap",
91
+ alignItems: "center",
92
+ justifyContent: "flex-end",
93
+ gap: .5
94
+ }
95
+ },
96
+ children: t
97
+ }),
98
+ i && /* @__PURE__ */ R(k, {
99
+ sx: {
100
+ position: "relative",
101
+ zIndex: 1,
102
+ flexShrink: 0
103
+ },
104
+ children: i
105
+ })
106
+ ]
107
+ });
108
+ }, ie = u(["core", "wallet-ui-components/react"]), ae = ({ onCopy: e, value: t, label: n = "Copy to clipboard" }) => {
109
+ let [r, i] = T(!1), a = w(void 0);
110
+ return S(() => () => clearTimeout(a.current), []), /* @__PURE__ */ R(I, {
111
+ title: r ? "Copied" : n,
112
+ children: /* @__PURE__ */ R(M, {
113
+ "aria-label": n,
114
+ onClick: async (n) => {
115
+ if (n.stopPropagation(), t) try {
116
+ if (navigator.clipboard?.writeText) await navigator.clipboard.writeText(t);
117
+ else throw Error("Browser does not support clipboard functionality.");
118
+ e !== void 0 && e(t), clearTimeout(a.current), a.current = setTimeout(() => i(!1), 1200), i(!0);
119
+ } catch (e) {
120
+ ie.getChild("CopyButton").error("Unable to copy value", { error: e });
121
+ }
122
+ },
123
+ children: /* @__PURE__ */ R(V, { color: r ? "success" : "inherit" })
124
+ })
125
+ });
126
+ }, oe = E({
127
+ tagName: "wg-error-page",
128
+ elementClass: ee,
129
+ react: b,
130
+ events: {
131
+ onErrorBack: "error-back",
132
+ onErrorRefresh: "error-refresh"
133
+ }
134
+ }), se = E({
135
+ tagName: "idp-card",
136
+ elementClass: h,
137
+ react: b,
138
+ events: {
139
+ onIdpReview: "idp-review",
140
+ onDelete: "delete",
141
+ onUpdate: "update"
142
+ }
143
+ }), ce = E({
144
+ tagName: "idp-form",
145
+ elementClass: m,
146
+ react: b,
147
+ events: {
148
+ onIdpFormSave: "idp-form-save",
149
+ onIdpFormDelete: "idp-form-delete",
150
+ onIdpFormCancel: "idp-form-cancel",
151
+ onIdpFormBack: "idp-form-back"
152
+ }
153
+ }), le = H`
963
154
  0%, 80%, 100% {
964
155
  transform: scale(0.7);
965
156
  opacity: 0.4;
@@ -968,1521 +159,273 @@ const C = ({
968
159
  transform: scale(1);
969
160
  opacity: 1;
970
161
  }
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`
2367
- from {
2368
- transform: rotate(0deg);
2369
- }
2370
- to {
2371
- transform: rotate(360deg);
2372
- }
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
162
+ `, ue = ({ text: e = "Loading" }) => /* @__PURE__ */ z(P, {
163
+ role: "status",
164
+ "aria-live": "polite",
165
+ spacing: 2,
166
+ sx: {
167
+ minHeight: 180,
168
+ justifyContent: "center",
169
+ alignItems: "center",
170
+ p: 3
171
+ },
172
+ children: [/* @__PURE__ */ R(P, {
173
+ direction: "row",
174
+ spacing: 1,
175
+ "aria-hidden": "true",
176
+ children: [
177
+ 0,
178
+ 1,
179
+ 2
180
+ ].map((e) => /* @__PURE__ */ R(k, { sx: {
181
+ width: 8,
182
+ height: 8,
183
+ borderRadius: "50%",
184
+ bgcolor: "primary.main",
185
+ animation: `${le} 1s infinite ease-in-out`,
186
+ animationDelay: `${e * .15}s`,
187
+ "@media (prefers-reduced-motion: reduce)": { animation: "none" }
188
+ } }, e))
189
+ }), /* @__PURE__ */ R(L, {
190
+ variant: "body1",
191
+ color: "text.secondary",
192
+ children: e
193
+ })]
194
+ }), de = E({
195
+ tagName: "wg-login-form",
196
+ elementClass: c,
197
+ react: b,
198
+ events: {
199
+ onLoginConnect: "login-connect",
200
+ onLoginBack: "login-back"
201
+ }
202
+ }), fe = E({
203
+ tagName: "wg-message-detail",
204
+ elementClass: l,
205
+ react: b,
206
+ events: {
207
+ onMessageApprove: "message-approve",
208
+ onMessageDelete: "message-delete"
209
+ }
210
+ }), pe = E({
211
+ tagName: "network-card",
212
+ elementClass: o,
213
+ react: b,
214
+ events: {
215
+ onNetworkReview: "network-review",
216
+ onDelete: "delete",
217
+ onUpdate: "update"
218
+ }
219
+ }), me = E({
220
+ tagName: "network-form",
221
+ elementClass: e,
222
+ react: b,
223
+ events: {
224
+ onNetworkEditCancel: "network-edit-cancel",
225
+ onNetworkEditSave: "network-edit-save",
226
+ onNetworkDelete: "network-delete"
227
+ }
228
+ }), he = E({
229
+ tagName: "not-found",
230
+ elementClass: r,
231
+ react: b
232
+ }), ge = E({
233
+ tagName: "wg-page-header",
234
+ elementClass: f,
235
+ react: b
236
+ }), _e = E({
237
+ tagName: "wg-pagination",
238
+ elementClass: s,
239
+ react: b,
240
+ events: { onPageChange: "page-change" }
241
+ }), ve = ({ signingProviders: e, value: t, onChange: n, disabled: r = !1, disabledProviders: i = [] }) => {
242
+ let a = e === void 0, o = e?.length === 0;
243
+ return /* @__PURE__ */ z(F, {
244
+ id: "signing-provider-id",
245
+ select: !0,
246
+ label: "Signing Provider",
247
+ required: !0,
248
+ fullWidth: !0,
249
+ value: t,
250
+ disabled: r || a || o,
251
+ onChange: (e) => n(e.target.value),
252
+ slotProps: {
253
+ select: { native: !0 },
254
+ inputLabel: { shrink: !0 }
255
+ },
256
+ children: [/* @__PURE__ */ R("option", {
257
+ value: "",
258
+ disabled: !0,
259
+ children: a ? "Loading signing providers..." : o ? "No signing providers available" : "Select signing provider"
260
+ }), e?.map((e) => /* @__PURE__ */ R("option", {
261
+ value: e,
262
+ disabled: i.includes(e),
263
+ children: e
264
+ }, e))]
265
+ });
266
+ }, X = ({ title: e, message: t, type: n = "error", buttonText: r = "Dismiss notification", autoHideDuration: i, onExited: a }) => {
267
+ let [o, s] = T(!0);
268
+ return /* @__PURE__ */ R(N, {
269
+ open: o,
270
+ autoHideDuration: i,
271
+ onClose: (e, t) => {
272
+ t !== "clickaway" && s(!1);
273
+ },
274
+ slotProps: { transition: { onExited: () => a?.() } },
275
+ sx: {
276
+ position: "static",
277
+ pointerEvents: "auto"
278
+ },
279
+ children: /* @__PURE__ */ z(D, {
280
+ role: n === "error" ? "alert" : "status",
281
+ severity: n,
282
+ closeText: r,
283
+ onClose: () => s(!1),
284
+ sx: { width: "100%" },
285
+ children: [/* @__PURE__ */ R(O, { children: e }), t]
286
+ })
287
+ });
288
+ }, ye = E({
289
+ tagName: "wg-transaction-card",
290
+ elementClass: d,
291
+ react: b,
292
+ events: { onTransactionReview: "transaction-review" }
293
+ }), be = E({
294
+ tagName: "wg-transaction-detail",
295
+ elementClass: g,
296
+ react: b,
297
+ events: {
298
+ onTransactionApprove: "transaction-approve",
299
+ onTransactionDelete: "transaction-delete"
300
+ }
301
+ }), xe = E({
302
+ tagName: "wg-wallet-card",
303
+ elementClass: n,
304
+ react: b,
305
+ events: {
306
+ onWalletSetPrimary: "wallet-set-primary",
307
+ onWalletEdit: "wallet-edit",
308
+ onWalletAllocate: "wallet-allocate",
309
+ onWalletSelect: "wallet-select"
310
+ }
311
+ }), Se = E({
312
+ tagName: "wg-wallet-create-form",
313
+ elementClass: te,
314
+ react: b,
315
+ events: {
316
+ onWalletCreate: "wallet-create",
317
+ onSigningProviderChange: "signing-provider-change"
318
+ }
319
+ }), Z = E({
320
+ tagName: "wg-wallet-edit-form",
321
+ elementClass: p,
322
+ react: b,
323
+ events: {
324
+ onWalletEdit: "wallet-edit",
325
+ onSigningProviderChange: "signing-provider-change"
326
+ }
327
+ }), Ce = ({ children: e, onSubmit: t, submitLabel: n, submittingLabel: r, submittingMessage: i, submitting: a = !1, loading: o = !1, submitDisabled: s = !1 }) => {
328
+ let c = a || o || s;
329
+ return /* @__PURE__ */ z(k, {
330
+ component: "form",
331
+ onSubmit: (e) => {
332
+ e.preventDefault(), c || t();
333
+ },
334
+ sx: {
335
+ display: "flex",
336
+ flexDirection: "column",
337
+ height: "100%"
338
+ },
339
+ children: [/* @__PURE__ */ R(P, {
340
+ spacing: 2,
341
+ children: e
342
+ }), /* @__PURE__ */ z(P, {
343
+ spacing: 1,
344
+ sx: {
345
+ mt: "auto",
346
+ pt: 3
347
+ },
348
+ children: [/* @__PURE__ */ R(A, {
349
+ type: "submit",
350
+ variant: "contained",
351
+ fullWidth: !0,
352
+ disabled: c,
353
+ startIcon: a ? /* @__PURE__ */ R(j, {
354
+ size: 16,
355
+ color: "inherit",
356
+ "aria-hidden": "true"
357
+ }) : void 0,
358
+ children: a ? r : n
359
+ }), a && /* @__PURE__ */ R(L, {
360
+ variant: "body2",
361
+ color: "text.secondary",
362
+ role: "status",
363
+ "aria-live": "polite",
364
+ children: i
365
+ })]
366
+ })]
367
+ });
368
+ }, we = E({
369
+ tagName: "wg-wallet-list",
370
+ elementClass: v,
371
+ react: b,
372
+ events: {
373
+ onWalletAllocate: "wallet-allocate",
374
+ onWalletEdit: "wallet-edit",
375
+ onWalletSetPrimary: "wallet-set-primary"
376
+ }
377
+ }), Te = E({
378
+ tagName: "wg-wallets-sync",
379
+ elementClass: a,
380
+ react: b,
381
+ events: { onWalletsSync: "wallets-sync" }
382
+ }), Q = ne(null), Ee = ({ children: e, autoHideDuration: t = 5e3 }) => {
383
+ let [n, r] = T([]), i = w(0), a = x((e) => {
384
+ r((t) => [...t, {
385
+ ...e,
386
+ id: i.current++
387
+ }]);
388
+ }, []), o = C(() => ({ showToast: a }), [a]);
389
+ return /* @__PURE__ */ z(Q.Provider, {
390
+ value: o,
391
+ children: [e, n.length > 0 && /* @__PURE__ */ R(P, {
392
+ spacing: 1,
393
+ sx: {
394
+ position: "fixed",
395
+ right: {
396
+ xs: 16,
397
+ sm: 20
398
+ },
399
+ bottom: {
400
+ xs: 16,
401
+ sm: 20
402
+ },
403
+ zIndex: (e) => e.zIndex.snackbar,
404
+ width: {
405
+ xs: "calc(100vw - 32px)",
406
+ sm: 380
407
+ },
408
+ maxWidth: "calc(100vw - 32px)",
409
+ pointerEvents: "none"
410
+ },
411
+ children: n.map(({ id: e, ...n }) => /* @__PURE__ */ R(X, {
412
+ ...n,
413
+ autoHideDuration: t,
414
+ onExited: () => r((t) => t.filter((t) => t.id !== e))
415
+ }, e))
416
+ })]
417
+ });
418
+ }, $ = () => {
419
+ let e = re(Q);
420
+ if (!e) throw Error("useToast must be used within a ToastProvider");
421
+ return e;
422
+ }, De = () => {
423
+ let { showToast: e } = $();
424
+ return x((t, n) => e({
425
+ ..._(t, n),
426
+ type: "error"
427
+ }), [e]);
2487
428
  };
2488
- //# sourceMappingURL=index.js.map
429
+ export { U as ApiKeyCard, K as ApiKeyForm, q as AppHeader, G as ApprovalActions, J as BackLink, Y as CardDetailRow, ae as CopyButton, oe as ErrorPage, se as IdpCard, ce as IdpForm, ue as LoadingState, de as LoginForm, fe as MessageDetail, pe as NetworkCard, me as NetworkForm, he as NotFound, ge as PageHeader, _e as Pagination, ve as SigningProviderSelect, X as Toast, Ee as ToastProvider, ye as TransactionCard, be as TransactionDetail, xe as WalletCard, Se as WalletCreateForm, Z as WalletEditForm, Ce as WalletForm, we as WalletList, Te as WalletsSync, De as useErrorToast, $ as useToast };
430
+
431
+ //# sourceMappingURL=index.js.map