@xyo-network/xl1-react-client-sdk 1.30.1 → 1.30.3
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.
- package/dist/browser/client/components/connected/ApprovedLakeSelector.d.ts +24 -0
- package/dist/browser/client/components/connected/ApprovedLakeSelector.d.ts.map +1 -0
- package/dist/browser/client/components/connected/DataLakeGetButton.d.ts +18 -0
- package/dist/browser/client/components/connected/DataLakeGetButton.d.ts.map +1 -0
- package/dist/browser/client/components/connected/DataLakeGetPanel.d.ts +15 -0
- package/dist/browser/client/components/connected/DataLakeGetPanel.d.ts.map +1 -0
- package/dist/browser/client/components/connected/DataLakeInsertButton.d.ts +19 -0
- package/dist/browser/client/components/connected/DataLakeInsertButton.d.ts.map +1 -0
- package/dist/browser/client/components/connected/DataLakeInsertPanel.d.ts +16 -0
- package/dist/browser/client/components/connected/DataLakeInsertPanel.d.ts.map +1 -0
- package/dist/browser/client/components/connected/DataLakeListButton.d.ts +13 -0
- package/dist/browser/client/components/connected/DataLakeListButton.d.ts.map +1 -0
- package/dist/browser/client/components/connected/DataLakeOperationsPanel.d.ts +20 -0
- package/dist/browser/client/components/connected/DataLakeOperationsPanel.d.ts.map +1 -0
- package/dist/browser/client/components/connected/DataLakeRequestAccessButton.d.ts +16 -0
- package/dist/browser/client/components/connected/DataLakeRequestAccessButton.d.ts.map +1 -0
- package/dist/browser/client/components/connected/index.d.ts +8 -0
- package/dist/browser/client/components/connected/index.d.ts.map +1 -1
- package/dist/browser/client/context/in-page/lib/buildGateway.d.ts.map +1 -1
- package/dist/browser/client/index.mjs +739 -88
- package/dist/browser/client/index.mjs.map +7 -1
- package/dist/browser/index.mjs +794 -145
- package/dist/browser/index.mjs.map +7 -1
- package/dist/browser/model/index.mjs +1 -1
- package/dist/browser/model/index.mjs.map +7 -1
- package/dist/browser/shared/components/menu-item/ActiveMenuItem.d.ts.map +1 -1
- package/dist/browser/shared/components/stack/DetailsStack.d.ts.map +1 -1
- package/dist/browser/shared/index.mjs +24 -26
- package/dist/browser/shared/index.mjs.map +7 -1
- package/package.json +17 -17
|
@@ -33,24 +33,24 @@ var ConnectedAccount = ({ address }) => {
|
|
|
33
33
|
);
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
// src/client/components/connected/
|
|
36
|
+
// src/client/components/connected/ApprovedLakeSelector.tsx
|
|
37
37
|
import {
|
|
38
38
|
Alert,
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
FormControl,
|
|
40
|
+
InputLabel,
|
|
41
|
+
MenuItem,
|
|
42
|
+
Select,
|
|
41
43
|
Stack as Stack2,
|
|
42
44
|
Typography as Typography2
|
|
43
45
|
} from "@mui/material";
|
|
44
46
|
import { ButtonEx } from "@xylabs/react-button";
|
|
45
47
|
import { ErrorRender } from "@xylabs/react-error";
|
|
46
|
-
import { isDefined as isDefined3,
|
|
47
|
-
import {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
import { MainNetwork } from "@xyo-network/xl1-sdk";
|
|
53
|
-
import { useCallback, useState as useState2 } from "react";
|
|
48
|
+
import { isDefined as isDefined3, isDefinedNotNull as isDefinedNotNull2 } from "@xylabs/sdk-js";
|
|
49
|
+
import {
|
|
50
|
+
useCallback,
|
|
51
|
+
useEffect as useEffect2,
|
|
52
|
+
useState as useState2
|
|
53
|
+
} from "react";
|
|
54
54
|
|
|
55
55
|
// src/client/hooks/client/helpers/findCaveat.ts
|
|
56
56
|
import { isDefined } from "@xylabs/sdk-js";
|
|
@@ -252,17 +252,130 @@ var useGatewayFromWallet = (gatewayName, timeout) => {
|
|
|
252
252
|
};
|
|
253
253
|
var useGateway = useGatewayFromWallet;
|
|
254
254
|
|
|
255
|
+
// src/client/components/connected/ApprovedLakeSelector.tsx
|
|
256
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
257
|
+
var ApprovedLakeSelector = ({
|
|
258
|
+
selectedId,
|
|
259
|
+
onChange,
|
|
260
|
+
capability,
|
|
261
|
+
timeout,
|
|
262
|
+
label = "Approved data lake"
|
|
263
|
+
}) => {
|
|
264
|
+
const {
|
|
265
|
+
client,
|
|
266
|
+
error: clientError,
|
|
267
|
+
isLoading,
|
|
268
|
+
timedout
|
|
269
|
+
} = useClientFromWallet(timeout);
|
|
270
|
+
const [lakes, setLakes] = useState2();
|
|
271
|
+
const [fetchError, setFetchError] = useState2();
|
|
272
|
+
const [refreshing, setRefreshing] = useState2(false);
|
|
273
|
+
const dataLakes = client?.dataLakes;
|
|
274
|
+
const supported = isDefinedNotNull2(dataLakes);
|
|
275
|
+
const refresh = useCallback(async () => {
|
|
276
|
+
if (!isDefinedNotNull2(dataLakes)) return;
|
|
277
|
+
setFetchError(void 0);
|
|
278
|
+
setRefreshing(true);
|
|
279
|
+
try {
|
|
280
|
+
const result = await dataLakes.list();
|
|
281
|
+
setLakes(result);
|
|
282
|
+
} catch (e) {
|
|
283
|
+
setFetchError(e);
|
|
284
|
+
} finally {
|
|
285
|
+
setRefreshing(false);
|
|
286
|
+
}
|
|
287
|
+
}, [dataLakes]);
|
|
288
|
+
useEffect2(() => {
|
|
289
|
+
if (supported && lakes === void 0 && !refreshing) {
|
|
290
|
+
void refresh();
|
|
291
|
+
}
|
|
292
|
+
}, [supported, lakes, refreshing, refresh]);
|
|
293
|
+
const filtered = (lakes ?? []).filter((lake) => lake.capabilities.includes(capability));
|
|
294
|
+
return /* @__PURE__ */ jsxs2(Stack2, { sx: { gap: 1, width: "100%" }, children: [
|
|
295
|
+
timedout ? /* @__PURE__ */ jsx2(Alert, { severity: "warning", children: "Wallet not detected." }) : null,
|
|
296
|
+
isDefinedNotNull2(client) && !supported ? /* @__PURE__ */ jsx2(Alert, { severity: "warning", children: "This wallet does not expose `xyo.client.dataLakes`." }) : null,
|
|
297
|
+
isDefined3(lakes) && filtered.length === 0 ? /* @__PURE__ */ jsxs2(Alert, { severity: "info", children: [
|
|
298
|
+
"No approved lakes with",
|
|
299
|
+
" ",
|
|
300
|
+
/* @__PURE__ */ jsx2("strong", { children: capability }),
|
|
301
|
+
" ",
|
|
302
|
+
"access. Run RequestAccess first."
|
|
303
|
+
] }) : null,
|
|
304
|
+
/* @__PURE__ */ jsxs2(FormControl, { size: "small", fullWidth: true, disabled: !supported || filtered.length === 0, children: [
|
|
305
|
+
/* @__PURE__ */ jsx2(InputLabel, { children: label }),
|
|
306
|
+
/* @__PURE__ */ jsx2(
|
|
307
|
+
Select,
|
|
308
|
+
{
|
|
309
|
+
value: selectedId,
|
|
310
|
+
label,
|
|
311
|
+
onChange: (event) => onChange(event.target.value),
|
|
312
|
+
children: filtered.map((lake) => /* @__PURE__ */ jsx2(MenuItem, { value: lake.id, children: /* @__PURE__ */ jsxs2(Stack2, { sx: { gap: 0.25, py: 0.5 }, children: [
|
|
313
|
+
/* @__PURE__ */ jsx2(Typography2, { variant: "body2", sx: { fontFamily: "monospace", wordBreak: "break-all" }, children: lake.id }),
|
|
314
|
+
/* @__PURE__ */ jsx2(Typography2, { variant: "caption", sx: { color: "text.secondary" }, children: lake.capabilities.join(" + ") })
|
|
315
|
+
] }) }, lake.id))
|
|
316
|
+
}
|
|
317
|
+
)
|
|
318
|
+
] }),
|
|
319
|
+
/* @__PURE__ */ jsxs2(Stack2, { direction: "row", sx: { gap: 1 }, children: [
|
|
320
|
+
/* @__PURE__ */ jsx2(
|
|
321
|
+
ButtonEx,
|
|
322
|
+
{
|
|
323
|
+
variant: "outlined",
|
|
324
|
+
size: "small",
|
|
325
|
+
disabled: !supported || refreshing,
|
|
326
|
+
busy: isLoading || refreshing,
|
|
327
|
+
onClick: () => void refresh(),
|
|
328
|
+
children: "Refresh"
|
|
329
|
+
}
|
|
330
|
+
),
|
|
331
|
+
isDefined3(lakes) ? /* @__PURE__ */ jsxs2(Typography2, { variant: "caption", sx: { color: "text.secondary", alignSelf: "center" }, children: [
|
|
332
|
+
lakes.length,
|
|
333
|
+
" ",
|
|
334
|
+
"approved",
|
|
335
|
+
" ",
|
|
336
|
+
"\xB7",
|
|
337
|
+
" ",
|
|
338
|
+
filtered.length,
|
|
339
|
+
" ",
|
|
340
|
+
"with",
|
|
341
|
+
" ",
|
|
342
|
+
capability,
|
|
343
|
+
" ",
|
|
344
|
+
"access"
|
|
345
|
+
] }) : null
|
|
346
|
+
] }),
|
|
347
|
+
/* @__PURE__ */ jsx2(ErrorRender, { error: clientError ?? fetchError, scope: "ApprovedLakeSelector" })
|
|
348
|
+
] });
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
// src/client/components/connected/ConnectAccountsStack.tsx
|
|
352
|
+
import {
|
|
353
|
+
Alert as Alert2,
|
|
354
|
+
AlertTitle,
|
|
355
|
+
Button,
|
|
356
|
+
Stack as Stack3,
|
|
357
|
+
Typography as Typography3
|
|
358
|
+
} from "@mui/material";
|
|
359
|
+
import { ButtonEx as ButtonEx2 } from "@xylabs/react-button";
|
|
360
|
+
import { ErrorRender as ErrorRender2 } from "@xylabs/react-error";
|
|
361
|
+
import { isDefined as isDefined4, isUndefined as isUndefined3 } from "@xylabs/sdk-js";
|
|
362
|
+
import { useEffect as useEffect3 } from "react";
|
|
363
|
+
|
|
255
364
|
// src/client/components/connected/hooks/useConnectAccount.ts
|
|
365
|
+
import { asAddress } from "@xylabs/sdk-js";
|
|
366
|
+
import { assertEx } from "@xylabs/sdk-js";
|
|
367
|
+
import { MainNetwork } from "@xyo-network/xl1-sdk";
|
|
368
|
+
import { useCallback as useCallback2, useState as useState3 } from "react";
|
|
256
369
|
var useConnectAccount = (gatewayName = MainNetwork.id, timeout) => {
|
|
257
|
-
const [connectError, setConnectError] =
|
|
370
|
+
const [connectError, setConnectError] = useState3();
|
|
258
371
|
const {
|
|
259
372
|
gateway,
|
|
260
373
|
error,
|
|
261
374
|
timedout
|
|
262
375
|
} = useGatewayFromWallet(gatewayName, timeout);
|
|
263
376
|
const [accountPermissions, accountPermissionsError] = useAccountPermissions();
|
|
264
|
-
const [address, setAddress] =
|
|
265
|
-
const connectSigner =
|
|
377
|
+
const [address, setAddress] = useState3();
|
|
378
|
+
const connectSigner = useCallback2(async () => {
|
|
266
379
|
try {
|
|
267
380
|
setConnectError(void 0);
|
|
268
381
|
const assertedGateway = assertEx(gateway, () => `Gateway ${gatewayName} is not available`);
|
|
@@ -284,12 +397,12 @@ var useConnectAccount = (gatewayName = MainNetwork.id, timeout) => {
|
|
|
284
397
|
};
|
|
285
398
|
|
|
286
399
|
// src/client/components/connected/ConnectAccountsStack.tsx
|
|
287
|
-
import { jsx as
|
|
288
|
-
var DefaultConnectComponent = (props) => /* @__PURE__ */
|
|
289
|
-
var DefaultNoWalletInstalledComponent = () => /* @__PURE__ */
|
|
290
|
-
/* @__PURE__ */
|
|
291
|
-
/* @__PURE__ */
|
|
292
|
-
/* @__PURE__ */
|
|
400
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
401
|
+
var DefaultConnectComponent = (props) => /* @__PURE__ */ jsx3(ButtonEx2, { variant: "contained", size: "small", ...props });
|
|
402
|
+
var DefaultNoWalletInstalledComponent = () => /* @__PURE__ */ jsxs3(Alert2, { severity: "warning", children: [
|
|
403
|
+
/* @__PURE__ */ jsx3(AlertTitle, { children: "XL1 Wallet Not Found" }),
|
|
404
|
+
/* @__PURE__ */ jsx3(Typography3, { gutterBottom: true, children: "Please ensure that your XL1 Wallet is installed to connect your account." }),
|
|
405
|
+
/* @__PURE__ */ jsx3(
|
|
293
406
|
Button,
|
|
294
407
|
{
|
|
295
408
|
sx: { display: "flex", justifySelf: "end" },
|
|
@@ -317,28 +430,560 @@ var ConnectAccountsStack = ({
|
|
|
317
430
|
error,
|
|
318
431
|
timedout
|
|
319
432
|
} = useConnectAccount(void 0, timeout);
|
|
320
|
-
|
|
321
|
-
if (
|
|
433
|
+
useEffect3(() => {
|
|
434
|
+
if (isDefined4(error) && isDefined4(onCancel)) {
|
|
322
435
|
onCancel();
|
|
323
436
|
}
|
|
324
437
|
}, [error, onCancel]);
|
|
325
|
-
|
|
326
|
-
if (
|
|
438
|
+
useEffect3(() => {
|
|
439
|
+
if (isDefined4(address) && isDefined4(onAccountConnected)) {
|
|
327
440
|
onAccountConnected(address);
|
|
328
441
|
}
|
|
329
442
|
}, [address, onAccountConnected]);
|
|
330
|
-
return /* @__PURE__ */
|
|
331
|
-
|
|
443
|
+
return /* @__PURE__ */ jsxs3(
|
|
444
|
+
Stack3,
|
|
332
445
|
{
|
|
333
446
|
direction: "row",
|
|
334
447
|
spacing: 2,
|
|
335
448
|
...props,
|
|
336
449
|
sx: { alignItems: "start", ...props.sx },
|
|
337
450
|
children: [
|
|
338
|
-
|
|
339
|
-
isUndefined3(address) && !timedout ? /* @__PURE__ */
|
|
340
|
-
isUndefined3(address) && timedout ? /* @__PURE__ */
|
|
341
|
-
/* @__PURE__ */
|
|
451
|
+
isDefined4(address) ? /* @__PURE__ */ jsx3(AccountComponent, { address }) : null,
|
|
452
|
+
isUndefined3(address) && !timedout ? /* @__PURE__ */ jsx3(ConnectComponent, { onClick: () => void connectSigner(), children: "Connect" }) : null,
|
|
453
|
+
isUndefined3(address) && timedout ? /* @__PURE__ */ jsx3(NoWalletInstalledComponent, {}) : null,
|
|
454
|
+
/* @__PURE__ */ jsx3(ErrorRender2, { error, scope: "ConnectSigner:error" })
|
|
455
|
+
]
|
|
456
|
+
}
|
|
457
|
+
);
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
// src/client/components/connected/DataLakeGetButton.tsx
|
|
461
|
+
import {
|
|
462
|
+
Alert as Alert3,
|
|
463
|
+
Stack as Stack4,
|
|
464
|
+
Typography as Typography4
|
|
465
|
+
} from "@mui/material";
|
|
466
|
+
import { ButtonEx as ButtonEx3 } from "@xylabs/react-button";
|
|
467
|
+
import { ErrorRender as ErrorRender3 } from "@xylabs/react-error";
|
|
468
|
+
import { isDefined as isDefined5, isDefinedNotNull as isDefinedNotNull3 } from "@xylabs/sdk-js";
|
|
469
|
+
import { useState as useState4 } from "react";
|
|
470
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
471
|
+
var DataLakeGetButton = ({
|
|
472
|
+
id,
|
|
473
|
+
hashes,
|
|
474
|
+
timeout,
|
|
475
|
+
...props
|
|
476
|
+
}) => {
|
|
477
|
+
const {
|
|
478
|
+
client,
|
|
479
|
+
error: clientError,
|
|
480
|
+
isLoading,
|
|
481
|
+
timedout
|
|
482
|
+
} = useClientFromWallet(timeout);
|
|
483
|
+
const [result, setResult] = useState4();
|
|
484
|
+
const [requestError, setRequestError] = useState4();
|
|
485
|
+
const [requesting, setRequesting] = useState4(false);
|
|
486
|
+
const dataLakes = client?.dataLakes;
|
|
487
|
+
const supported = isDefinedNotNull3(dataLakes);
|
|
488
|
+
const argsReady = id.length > 0 && hashes.length > 0;
|
|
489
|
+
const handleClick = async () => {
|
|
490
|
+
if (!isDefinedNotNull3(dataLakes)) return;
|
|
491
|
+
setRequestError(void 0);
|
|
492
|
+
setResult(void 0);
|
|
493
|
+
setRequesting(true);
|
|
494
|
+
try {
|
|
495
|
+
const payloads = await dataLakes.get(id, hashes);
|
|
496
|
+
setResult(payloads);
|
|
497
|
+
} catch (e) {
|
|
498
|
+
setRequestError(e);
|
|
499
|
+
} finally {
|
|
500
|
+
setRequesting(false);
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
return /* @__PURE__ */ jsxs4(
|
|
504
|
+
Stack4,
|
|
505
|
+
{
|
|
506
|
+
...props,
|
|
507
|
+
sx: {
|
|
508
|
+
gap: 2,
|
|
509
|
+
alignItems: "start",
|
|
510
|
+
...props.sx
|
|
511
|
+
},
|
|
512
|
+
children: [
|
|
513
|
+
timedout ? /* @__PURE__ */ jsx4(Alert3, { severity: "warning", children: "Wallet not detected." }) : null,
|
|
514
|
+
isDefinedNotNull3(client) && !supported ? /* @__PURE__ */ jsx4(Alert3, { severity: "warning", children: "This wallet does not expose `xyo.client.dataLakes`." }) : null,
|
|
515
|
+
/* @__PURE__ */ jsxs4(
|
|
516
|
+
ButtonEx3,
|
|
517
|
+
{
|
|
518
|
+
variant: "contained",
|
|
519
|
+
size: "small",
|
|
520
|
+
disabled: !supported || !argsReady || requesting,
|
|
521
|
+
busy: isLoading || requesting,
|
|
522
|
+
onClick: () => void handleClick(),
|
|
523
|
+
children: [
|
|
524
|
+
"Get",
|
|
525
|
+
" ",
|
|
526
|
+
hashes.length,
|
|
527
|
+
" ",
|
|
528
|
+
"hash",
|
|
529
|
+
hashes.length === 1 ? "" : "es"
|
|
530
|
+
]
|
|
531
|
+
}
|
|
532
|
+
),
|
|
533
|
+
argsReady ? null : /* @__PURE__ */ jsx4(Typography4, { variant: "caption", sx: { color: "text.secondary" }, children: "Provide a per-origin `id` and at least one hash to enable the button." }),
|
|
534
|
+
isDefined5(result) ? /* @__PURE__ */ jsxs4(Stack4, { sx: { gap: 0.5 }, children: [
|
|
535
|
+
/* @__PURE__ */ jsx4(Typography4, { variant: "subtitle2", children: result.length === 0 ? "No payloads returned" : `Payloads (${result.length})` }),
|
|
536
|
+
/* @__PURE__ */ jsx4(
|
|
537
|
+
Typography4,
|
|
538
|
+
{
|
|
539
|
+
component: "pre",
|
|
540
|
+
variant: "body2",
|
|
541
|
+
sx: {
|
|
542
|
+
fontFamily: "monospace",
|
|
543
|
+
whiteSpace: "pre-wrap",
|
|
544
|
+
wordBreak: "break-all"
|
|
545
|
+
},
|
|
546
|
+
children: JSON.stringify(result, null, 2)
|
|
547
|
+
}
|
|
548
|
+
)
|
|
549
|
+
] }) : null,
|
|
550
|
+
/* @__PURE__ */ jsx4(ErrorRender3, { error: clientError ?? requestError, scope: "DataLakeGetButton" })
|
|
551
|
+
]
|
|
552
|
+
}
|
|
553
|
+
);
|
|
554
|
+
};
|
|
555
|
+
|
|
556
|
+
// src/client/components/connected/DataLakeGetPanel.tsx
|
|
557
|
+
import {
|
|
558
|
+
Stack as Stack5,
|
|
559
|
+
TextField,
|
|
560
|
+
Typography as Typography5
|
|
561
|
+
} from "@mui/material";
|
|
562
|
+
import { useMemo, useState as useState5 } from "react";
|
|
563
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
564
|
+
var DataLakeGetPanel = ({ timeout, ...props }) => {
|
|
565
|
+
const [selectedId, setSelectedId] = useState5("");
|
|
566
|
+
const [hashesText, setHashesText] = useState5("");
|
|
567
|
+
const hashes = useMemo(() => {
|
|
568
|
+
return hashesText.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
569
|
+
}, [hashesText]);
|
|
570
|
+
return /* @__PURE__ */ jsxs5(
|
|
571
|
+
Stack5,
|
|
572
|
+
{
|
|
573
|
+
...props,
|
|
574
|
+
sx: {
|
|
575
|
+
gap: 2,
|
|
576
|
+
alignItems: "stretch",
|
|
577
|
+
...props.sx
|
|
578
|
+
},
|
|
579
|
+
children: [
|
|
580
|
+
/* @__PURE__ */ jsx5(
|
|
581
|
+
ApprovedLakeSelector,
|
|
582
|
+
{
|
|
583
|
+
capability: "viewer",
|
|
584
|
+
selectedId,
|
|
585
|
+
onChange: setSelectedId,
|
|
586
|
+
timeout
|
|
587
|
+
}
|
|
588
|
+
),
|
|
589
|
+
/* @__PURE__ */ jsx5(
|
|
590
|
+
TextField,
|
|
591
|
+
{
|
|
592
|
+
label: "Hashes (one per line)",
|
|
593
|
+
value: hashesText,
|
|
594
|
+
onChange: (e) => setHashesText(e.target.value),
|
|
595
|
+
multiline: true,
|
|
596
|
+
minRows: 3,
|
|
597
|
+
maxRows: 10,
|
|
598
|
+
size: "small",
|
|
599
|
+
slotProps: { input: { sx: { fontFamily: "monospace", fontSize: 12 } } }
|
|
600
|
+
}
|
|
601
|
+
),
|
|
602
|
+
/* @__PURE__ */ jsx5(Typography5, { variant: "caption", sx: { color: "text.secondary" }, children: hashes.length === 0 ? "No hashes parsed." : `${hashes.length} hash${hashes.length === 1 ? "" : "es"} ready.` }),
|
|
603
|
+
/* @__PURE__ */ jsx5(DataLakeGetButton, { id: selectedId, hashes, timeout })
|
|
604
|
+
]
|
|
605
|
+
}
|
|
606
|
+
);
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
// src/client/components/connected/DataLakeInsertButton.tsx
|
|
610
|
+
import {
|
|
611
|
+
Alert as Alert4,
|
|
612
|
+
Stack as Stack6,
|
|
613
|
+
Typography as Typography6
|
|
614
|
+
} from "@mui/material";
|
|
615
|
+
import { ButtonEx as ButtonEx4 } from "@xylabs/react-button";
|
|
616
|
+
import { ErrorRender as ErrorRender4 } from "@xylabs/react-error";
|
|
617
|
+
import { isDefined as isDefined6, isDefinedNotNull as isDefinedNotNull4 } from "@xylabs/sdk-js";
|
|
618
|
+
import { useState as useState6 } from "react";
|
|
619
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
620
|
+
var DataLakeInsertButton = ({
|
|
621
|
+
id,
|
|
622
|
+
payloads,
|
|
623
|
+
timeout,
|
|
624
|
+
...props
|
|
625
|
+
}) => {
|
|
626
|
+
const {
|
|
627
|
+
client,
|
|
628
|
+
error: clientError,
|
|
629
|
+
isLoading,
|
|
630
|
+
timedout
|
|
631
|
+
} = useClientFromWallet(timeout);
|
|
632
|
+
const [result, setResult] = useState6();
|
|
633
|
+
const [requestError, setRequestError] = useState6();
|
|
634
|
+
const [requesting, setRequesting] = useState6(false);
|
|
635
|
+
const dataLakes = client?.dataLakes;
|
|
636
|
+
const supported = isDefinedNotNull4(dataLakes);
|
|
637
|
+
const argsReady = id.length > 0 && payloads.length > 0;
|
|
638
|
+
const handleClick = async () => {
|
|
639
|
+
if (!isDefinedNotNull4(dataLakes)) return;
|
|
640
|
+
setRequestError(void 0);
|
|
641
|
+
setResult(void 0);
|
|
642
|
+
setRequesting(true);
|
|
643
|
+
try {
|
|
644
|
+
const acks = await dataLakes.insert(id, payloads);
|
|
645
|
+
setResult(acks);
|
|
646
|
+
} catch (e) {
|
|
647
|
+
setRequestError(e);
|
|
648
|
+
} finally {
|
|
649
|
+
setRequesting(false);
|
|
650
|
+
}
|
|
651
|
+
};
|
|
652
|
+
return /* @__PURE__ */ jsxs6(
|
|
653
|
+
Stack6,
|
|
654
|
+
{
|
|
655
|
+
...props,
|
|
656
|
+
sx: {
|
|
657
|
+
gap: 2,
|
|
658
|
+
alignItems: "start",
|
|
659
|
+
...props.sx
|
|
660
|
+
},
|
|
661
|
+
children: [
|
|
662
|
+
timedout ? /* @__PURE__ */ jsx6(Alert4, { severity: "warning", children: "Wallet not detected." }) : null,
|
|
663
|
+
isDefinedNotNull4(client) && !supported ? /* @__PURE__ */ jsx6(Alert4, { severity: "warning", children: "This wallet does not expose `xyo.client.dataLakes`." }) : null,
|
|
664
|
+
/* @__PURE__ */ jsxs6(
|
|
665
|
+
ButtonEx4,
|
|
666
|
+
{
|
|
667
|
+
variant: "contained",
|
|
668
|
+
size: "small",
|
|
669
|
+
disabled: !supported || !argsReady || requesting,
|
|
670
|
+
busy: isLoading || requesting,
|
|
671
|
+
onClick: () => void handleClick(),
|
|
672
|
+
children: [
|
|
673
|
+
"Insert",
|
|
674
|
+
" ",
|
|
675
|
+
payloads.length,
|
|
676
|
+
" ",
|
|
677
|
+
"payload",
|
|
678
|
+
payloads.length === 1 ? "" : "s"
|
|
679
|
+
]
|
|
680
|
+
}
|
|
681
|
+
),
|
|
682
|
+
argsReady ? null : /* @__PURE__ */ jsx6(Typography6, { variant: "caption", sx: { color: "text.secondary" }, children: "Provide a per-origin `id` and at least one payload to enable the button." }),
|
|
683
|
+
isDefined6(result) ? /* @__PURE__ */ jsxs6(Stack6, { sx: { gap: 0.5 }, children: [
|
|
684
|
+
/* @__PURE__ */ jsx6(Typography6, { variant: "subtitle2", children: result.length === 0 ? "No payloads written (wallet filtered all)" : `Inserted (${result.length})` }),
|
|
685
|
+
/* @__PURE__ */ jsx6(
|
|
686
|
+
Typography6,
|
|
687
|
+
{
|
|
688
|
+
component: "pre",
|
|
689
|
+
variant: "body2",
|
|
690
|
+
sx: {
|
|
691
|
+
fontFamily: "monospace",
|
|
692
|
+
whiteSpace: "pre-wrap",
|
|
693
|
+
wordBreak: "break-all"
|
|
694
|
+
},
|
|
695
|
+
children: JSON.stringify(result, null, 2)
|
|
696
|
+
}
|
|
697
|
+
)
|
|
698
|
+
] }) : null,
|
|
699
|
+
/* @__PURE__ */ jsx6(ErrorRender4, { error: clientError ?? requestError, scope: "DataLakeInsertButton" })
|
|
700
|
+
]
|
|
701
|
+
}
|
|
702
|
+
);
|
|
703
|
+
};
|
|
704
|
+
|
|
705
|
+
// src/client/components/connected/DataLakeInsertPanel.tsx
|
|
706
|
+
import {
|
|
707
|
+
Alert as Alert5,
|
|
708
|
+
Stack as Stack7,
|
|
709
|
+
TextField as TextField2,
|
|
710
|
+
Typography as Typography7
|
|
711
|
+
} from "@mui/material";
|
|
712
|
+
import { useMemo as useMemo2, useState as useState7 } from "react";
|
|
713
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
714
|
+
function buildDefaultPayload() {
|
|
715
|
+
return JSON.stringify(
|
|
716
|
+
{
|
|
717
|
+
schema: "network.xyo.observation.v2",
|
|
718
|
+
value: 1,
|
|
719
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
720
|
+
},
|
|
721
|
+
null,
|
|
722
|
+
2
|
|
723
|
+
);
|
|
724
|
+
}
|
|
725
|
+
function parsePayload(raw) {
|
|
726
|
+
const trimmed = raw.trim();
|
|
727
|
+
if (trimmed.length === 0) return { ok: false, error: "Payload is empty." };
|
|
728
|
+
try {
|
|
729
|
+
const parsed = JSON.parse(trimmed);
|
|
730
|
+
if (Array.isArray(parsed)) return { ok: true, payloads: parsed };
|
|
731
|
+
if (parsed !== null && typeof parsed === "object") return { ok: true, payloads: [parsed] };
|
|
732
|
+
return { ok: false, error: "Payload must be a JSON object or array of objects." };
|
|
733
|
+
} catch (e) {
|
|
734
|
+
return { ok: false, error: `Invalid JSON: ${e.message}` };
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
var DataLakeInsertPanel = ({ timeout, ...props }) => {
|
|
738
|
+
const [selectedId, setSelectedId] = useState7("");
|
|
739
|
+
const [payloadText, setPayloadText] = useState7(buildDefaultPayload);
|
|
740
|
+
const parse = useMemo2(() => parsePayload(payloadText), [payloadText]);
|
|
741
|
+
return /* @__PURE__ */ jsxs7(
|
|
742
|
+
Stack7,
|
|
743
|
+
{
|
|
744
|
+
...props,
|
|
745
|
+
sx: {
|
|
746
|
+
gap: 2,
|
|
747
|
+
alignItems: "stretch",
|
|
748
|
+
...props.sx
|
|
749
|
+
},
|
|
750
|
+
children: [
|
|
751
|
+
/* @__PURE__ */ jsx7(
|
|
752
|
+
ApprovedLakeSelector,
|
|
753
|
+
{
|
|
754
|
+
capability: "runner",
|
|
755
|
+
selectedId,
|
|
756
|
+
onChange: setSelectedId,
|
|
757
|
+
timeout
|
|
758
|
+
}
|
|
759
|
+
),
|
|
760
|
+
/* @__PURE__ */ jsx7(
|
|
761
|
+
TextField2,
|
|
762
|
+
{
|
|
763
|
+
label: "Payload (JSON object or array)",
|
|
764
|
+
value: payloadText,
|
|
765
|
+
onChange: (e) => setPayloadText(e.target.value),
|
|
766
|
+
multiline: true,
|
|
767
|
+
minRows: 6,
|
|
768
|
+
maxRows: 16,
|
|
769
|
+
size: "small",
|
|
770
|
+
slotProps: { input: { sx: { fontFamily: "monospace", fontSize: 12 } } }
|
|
771
|
+
}
|
|
772
|
+
),
|
|
773
|
+
parse.ok ? /* @__PURE__ */ jsxs7(Typography7, { variant: "caption", sx: { color: "text.secondary" }, children: [
|
|
774
|
+
parse.payloads.length,
|
|
775
|
+
" ",
|
|
776
|
+
"payload",
|
|
777
|
+
parse.payloads.length === 1 ? "" : "s",
|
|
778
|
+
" ",
|
|
779
|
+
"parsed."
|
|
780
|
+
] }) : /* @__PURE__ */ jsx7(Alert5, { severity: "error", variant: "outlined", children: /* @__PURE__ */ jsx7(Typography7, { variant: "body2", children: parse.error }) }),
|
|
781
|
+
/* @__PURE__ */ jsx7(
|
|
782
|
+
DataLakeInsertButton,
|
|
783
|
+
{
|
|
784
|
+
id: selectedId,
|
|
785
|
+
payloads: parse.ok ? parse.payloads : [],
|
|
786
|
+
timeout
|
|
787
|
+
}
|
|
788
|
+
)
|
|
789
|
+
]
|
|
790
|
+
}
|
|
791
|
+
);
|
|
792
|
+
};
|
|
793
|
+
|
|
794
|
+
// src/client/components/connected/DataLakeListButton.tsx
|
|
795
|
+
import {
|
|
796
|
+
Alert as Alert6,
|
|
797
|
+
Stack as Stack8,
|
|
798
|
+
Typography as Typography8
|
|
799
|
+
} from "@mui/material";
|
|
800
|
+
import { ButtonEx as ButtonEx5 } from "@xylabs/react-button";
|
|
801
|
+
import { ErrorRender as ErrorRender5 } from "@xylabs/react-error";
|
|
802
|
+
import { isDefined as isDefined7, isDefinedNotNull as isDefinedNotNull5 } from "@xylabs/sdk-js";
|
|
803
|
+
import { useState as useState8 } from "react";
|
|
804
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
805
|
+
var DataLakeListButton = ({ timeout, ...props }) => {
|
|
806
|
+
const {
|
|
807
|
+
client,
|
|
808
|
+
error: clientError,
|
|
809
|
+
isLoading,
|
|
810
|
+
timedout
|
|
811
|
+
} = useClientFromWallet(timeout);
|
|
812
|
+
const [lakes, setLakes] = useState8();
|
|
813
|
+
const [requestError, setRequestError] = useState8();
|
|
814
|
+
const [requesting, setRequesting] = useState8(false);
|
|
815
|
+
const dataLakes = client?.dataLakes;
|
|
816
|
+
const supported = isDefinedNotNull5(dataLakes);
|
|
817
|
+
const handleClick = async () => {
|
|
818
|
+
if (!isDefinedNotNull5(dataLakes)) return;
|
|
819
|
+
setRequestError(void 0);
|
|
820
|
+
setLakes(void 0);
|
|
821
|
+
setRequesting(true);
|
|
822
|
+
try {
|
|
823
|
+
const result = await dataLakes.list();
|
|
824
|
+
setLakes(result);
|
|
825
|
+
} catch (e) {
|
|
826
|
+
setRequestError(e);
|
|
827
|
+
} finally {
|
|
828
|
+
setRequesting(false);
|
|
829
|
+
}
|
|
830
|
+
};
|
|
831
|
+
return /* @__PURE__ */ jsxs8(
|
|
832
|
+
Stack8,
|
|
833
|
+
{
|
|
834
|
+
...props,
|
|
835
|
+
sx: {
|
|
836
|
+
gap: 2,
|
|
837
|
+
alignItems: "start",
|
|
838
|
+
...props.sx
|
|
839
|
+
},
|
|
840
|
+
children: [
|
|
841
|
+
timedout ? /* @__PURE__ */ jsx8(Alert6, { severity: "warning", children: "Wallet not detected." }) : null,
|
|
842
|
+
isDefinedNotNull5(client) && !supported ? /* @__PURE__ */ jsx8(Alert6, { severity: "warning", children: "This wallet does not expose `xyo.client.dataLakes`." }) : null,
|
|
843
|
+
/* @__PURE__ */ jsx8(
|
|
844
|
+
ButtonEx5,
|
|
845
|
+
{
|
|
846
|
+
variant: "contained",
|
|
847
|
+
size: "small",
|
|
848
|
+
disabled: !supported || requesting,
|
|
849
|
+
busy: isLoading || requesting,
|
|
850
|
+
onClick: () => void handleClick(),
|
|
851
|
+
children: "List approved data lakes"
|
|
852
|
+
}
|
|
853
|
+
),
|
|
854
|
+
isDefined7(lakes) ? /* @__PURE__ */ jsxs8(Stack8, { sx: { gap: 0.5 }, children: [
|
|
855
|
+
/* @__PURE__ */ jsx8(Typography8, { variant: "subtitle2", children: lakes.length === 0 ? "No approved lakes" : `Approved lakes (${lakes.length})` }),
|
|
856
|
+
/* @__PURE__ */ jsx8(
|
|
857
|
+
Typography8,
|
|
858
|
+
{
|
|
859
|
+
component: "pre",
|
|
860
|
+
variant: "body2",
|
|
861
|
+
sx: {
|
|
862
|
+
fontFamily: "monospace",
|
|
863
|
+
whiteSpace: "pre-wrap",
|
|
864
|
+
wordBreak: "break-all"
|
|
865
|
+
},
|
|
866
|
+
children: JSON.stringify(lakes, null, 2)
|
|
867
|
+
}
|
|
868
|
+
)
|
|
869
|
+
] }) : null,
|
|
870
|
+
/* @__PURE__ */ jsx8(ErrorRender5, { error: clientError ?? requestError, scope: "DataLakeListButton" })
|
|
871
|
+
]
|
|
872
|
+
}
|
|
873
|
+
);
|
|
874
|
+
};
|
|
875
|
+
|
|
876
|
+
// src/client/components/connected/DataLakeOperationsPanel.tsx
|
|
877
|
+
import {
|
|
878
|
+
Divider,
|
|
879
|
+
Stack as Stack9,
|
|
880
|
+
Typography as Typography9
|
|
881
|
+
} from "@mui/material";
|
|
882
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
883
|
+
var DataLakeOperationsPanel = ({ timeout, ...props }) => {
|
|
884
|
+
return /* @__PURE__ */ jsxs9(
|
|
885
|
+
Stack9,
|
|
886
|
+
{
|
|
887
|
+
...props,
|
|
888
|
+
sx: {
|
|
889
|
+
gap: 3,
|
|
890
|
+
alignItems: "stretch",
|
|
891
|
+
...props.sx
|
|
892
|
+
},
|
|
893
|
+
children: [
|
|
894
|
+
/* @__PURE__ */ jsxs9(Stack9, { sx: { gap: 1 }, children: [
|
|
895
|
+
/* @__PURE__ */ jsx9(Typography9, { variant: "subtitle2", children: "List approved lakes" }),
|
|
896
|
+
/* @__PURE__ */ jsx9(DataLakeListButton, { timeout })
|
|
897
|
+
] }),
|
|
898
|
+
/* @__PURE__ */ jsx9(Divider, {}),
|
|
899
|
+
/* @__PURE__ */ jsxs9(Stack9, { sx: { gap: 1 }, children: [
|
|
900
|
+
/* @__PURE__ */ jsx9(Typography9, { variant: "subtitle2", children: "Insert payloads" }),
|
|
901
|
+
/* @__PURE__ */ jsx9(DataLakeInsertPanel, { timeout })
|
|
902
|
+
] }),
|
|
903
|
+
/* @__PURE__ */ jsx9(Divider, {}),
|
|
904
|
+
/* @__PURE__ */ jsxs9(Stack9, { sx: { gap: 1 }, children: [
|
|
905
|
+
/* @__PURE__ */ jsx9(Typography9, { variant: "subtitle2", children: "Get payloads by hash" }),
|
|
906
|
+
/* @__PURE__ */ jsx9(DataLakeGetPanel, { timeout })
|
|
907
|
+
] })
|
|
908
|
+
]
|
|
909
|
+
}
|
|
910
|
+
);
|
|
911
|
+
};
|
|
912
|
+
|
|
913
|
+
// src/client/components/connected/DataLakeRequestAccessButton.tsx
|
|
914
|
+
import {
|
|
915
|
+
Alert as Alert7,
|
|
916
|
+
Stack as Stack10,
|
|
917
|
+
Typography as Typography10
|
|
918
|
+
} from "@mui/material";
|
|
919
|
+
import { ButtonEx as ButtonEx6 } from "@xylabs/react-button";
|
|
920
|
+
import { ErrorRender as ErrorRender6 } from "@xylabs/react-error";
|
|
921
|
+
import { isDefined as isDefined8, isDefinedNotNull as isDefinedNotNull6 } from "@xylabs/sdk-js";
|
|
922
|
+
import { useState as useState9 } from "react";
|
|
923
|
+
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
924
|
+
var DataLakeRequestAccessButton = ({
|
|
925
|
+
options,
|
|
926
|
+
timeout,
|
|
927
|
+
...props
|
|
928
|
+
}) => {
|
|
929
|
+
const {
|
|
930
|
+
client,
|
|
931
|
+
error: clientError,
|
|
932
|
+
isLoading,
|
|
933
|
+
timedout
|
|
934
|
+
} = useClientFromWallet(timeout);
|
|
935
|
+
const [granted, setGranted] = useState9();
|
|
936
|
+
const [requestError, setRequestError] = useState9();
|
|
937
|
+
const [requesting, setRequesting] = useState9(false);
|
|
938
|
+
const dataLakes = client?.dataLakes;
|
|
939
|
+
const supported = isDefinedNotNull6(dataLakes);
|
|
940
|
+
const handleClick = async () => {
|
|
941
|
+
if (!isDefinedNotNull6(dataLakes)) return;
|
|
942
|
+
setRequestError(void 0);
|
|
943
|
+
setGranted(void 0);
|
|
944
|
+
setRequesting(true);
|
|
945
|
+
try {
|
|
946
|
+
const result = await dataLakes.requestAccess(options);
|
|
947
|
+
setGranted(result);
|
|
948
|
+
} catch (e) {
|
|
949
|
+
setRequestError(e);
|
|
950
|
+
} finally {
|
|
951
|
+
setRequesting(false);
|
|
952
|
+
}
|
|
953
|
+
};
|
|
954
|
+
return /* @__PURE__ */ jsxs10(
|
|
955
|
+
Stack10,
|
|
956
|
+
{
|
|
957
|
+
...props,
|
|
958
|
+
sx: {
|
|
959
|
+
gap: 2,
|
|
960
|
+
alignItems: "start",
|
|
961
|
+
...props.sx
|
|
962
|
+
},
|
|
963
|
+
children: [
|
|
964
|
+
timedout ? /* @__PURE__ */ jsx10(Alert7, { severity: "warning", children: "Wallet not detected." }) : null,
|
|
965
|
+
isDefinedNotNull6(client) && !supported ? /* @__PURE__ */ jsx10(Alert7, { severity: "warning", children: "This wallet does not expose `xyo.client.dataLakes`." }) : null,
|
|
966
|
+
/* @__PURE__ */ jsx10(
|
|
967
|
+
ButtonEx6,
|
|
968
|
+
{
|
|
969
|
+
variant: "contained",
|
|
970
|
+
size: "small",
|
|
971
|
+
disabled: !supported || requesting,
|
|
972
|
+
busy: isLoading || requesting,
|
|
973
|
+
onClick: () => void handleClick(),
|
|
974
|
+
children: "Request data lake access"
|
|
975
|
+
}
|
|
976
|
+
),
|
|
977
|
+
isDefined8(granted) ? /* @__PURE__ */ jsxs10(Stack10, { sx: { gap: 0.5 }, children: [
|
|
978
|
+
/* @__PURE__ */ jsx10(Typography10, { variant: "subtitle2", children: "Granted:" }),
|
|
979
|
+
/* @__PURE__ */ jsxs10(Typography10, { variant: "body2", sx: { fontFamily: "monospace", wordBreak: "break-all" }, children: [
|
|
980
|
+
"id:",
|
|
981
|
+
" ",
|
|
982
|
+
granted.id
|
|
983
|
+
] }),
|
|
984
|
+
/* @__PURE__ */ jsx10(Typography10, { variant: "body2", sx: { color: "text.secondary" }, children: "If you picked multiple lakes, call `list()` to enumerate all granted ids." })
|
|
985
|
+
] }) : null,
|
|
986
|
+
/* @__PURE__ */ jsx10(ErrorRender6, { error: clientError ?? requestError, scope: "DataLakeRequestAccessButton" })
|
|
342
987
|
]
|
|
343
988
|
}
|
|
344
989
|
);
|
|
@@ -346,15 +991,15 @@ var ConnectAccountsStack = ({
|
|
|
346
991
|
|
|
347
992
|
// src/client/components/connected/RequestPermissionsButton.tsx
|
|
348
993
|
import {
|
|
349
|
-
Alert as
|
|
350
|
-
Stack as
|
|
351
|
-
Typography as
|
|
994
|
+
Alert as Alert8,
|
|
995
|
+
Stack as Stack11,
|
|
996
|
+
Typography as Typography11
|
|
352
997
|
} from "@mui/material";
|
|
353
|
-
import { ButtonEx as
|
|
354
|
-
import { ErrorRender as
|
|
355
|
-
import { isDefined as
|
|
356
|
-
import { useState as
|
|
357
|
-
import { jsx as
|
|
998
|
+
import { ButtonEx as ButtonEx7 } from "@xylabs/react-button";
|
|
999
|
+
import { ErrorRender as ErrorRender7 } from "@xylabs/react-error";
|
|
1000
|
+
import { isDefined as isDefined9, isDefinedNotNull as isDefinedNotNull7 } from "@xylabs/sdk-js";
|
|
1001
|
+
import { useState as useState10 } from "react";
|
|
1002
|
+
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
358
1003
|
var RequestPermissionsButton = ({
|
|
359
1004
|
permissions,
|
|
360
1005
|
timeout,
|
|
@@ -366,11 +1011,11 @@ var RequestPermissionsButton = ({
|
|
|
366
1011
|
isLoading,
|
|
367
1012
|
timedout
|
|
368
1013
|
} = useClientFromWallet(timeout);
|
|
369
|
-
const [acks, setAcks] =
|
|
370
|
-
const [requestError, setRequestError] =
|
|
371
|
-
const [requesting, setRequesting] =
|
|
1014
|
+
const [acks, setAcks] = useState10();
|
|
1015
|
+
const [requestError, setRequestError] = useState10();
|
|
1016
|
+
const [requesting, setRequesting] = useState10(false);
|
|
372
1017
|
const handleClick = async () => {
|
|
373
|
-
if (!
|
|
1018
|
+
if (!isDefinedNotNull7(client)) return;
|
|
374
1019
|
setRequestError(void 0);
|
|
375
1020
|
setAcks(void 0);
|
|
376
1021
|
setRequesting(true);
|
|
@@ -383,8 +1028,8 @@ var RequestPermissionsButton = ({
|
|
|
383
1028
|
setRequesting(false);
|
|
384
1029
|
}
|
|
385
1030
|
};
|
|
386
|
-
return /* @__PURE__ */
|
|
387
|
-
|
|
1031
|
+
return /* @__PURE__ */ jsxs11(
|
|
1032
|
+
Stack11,
|
|
388
1033
|
{
|
|
389
1034
|
...props,
|
|
390
1035
|
sx: {
|
|
@@ -393,13 +1038,13 @@ var RequestPermissionsButton = ({
|
|
|
393
1038
|
...props.sx
|
|
394
1039
|
},
|
|
395
1040
|
children: [
|
|
396
|
-
timedout ? /* @__PURE__ */
|
|
397
|
-
/* @__PURE__ */
|
|
398
|
-
|
|
1041
|
+
timedout ? /* @__PURE__ */ jsx11(Alert8, { severity: "warning", children: "Wallet not detected." }) : null,
|
|
1042
|
+
/* @__PURE__ */ jsxs11(
|
|
1043
|
+
ButtonEx7,
|
|
399
1044
|
{
|
|
400
1045
|
variant: "contained",
|
|
401
1046
|
size: "small",
|
|
402
|
-
disabled: !
|
|
1047
|
+
disabled: !isDefinedNotNull7(client) || requesting,
|
|
403
1048
|
busy: isLoading || requesting,
|
|
404
1049
|
onClick: () => void handleClick(),
|
|
405
1050
|
children: [
|
|
@@ -412,10 +1057,10 @@ var RequestPermissionsButton = ({
|
|
|
412
1057
|
]
|
|
413
1058
|
}
|
|
414
1059
|
),
|
|
415
|
-
|
|
416
|
-
/* @__PURE__ */
|
|
417
|
-
acks.map((ack) => /* @__PURE__ */
|
|
418
|
-
|
|
1060
|
+
isDefined9(acks) ? /* @__PURE__ */ jsxs11(Stack11, { sx: { gap: 0.5 }, children: [
|
|
1061
|
+
/* @__PURE__ */ jsx11(Typography11, { variant: "subtitle2", children: "Granted:" }),
|
|
1062
|
+
acks.map((ack) => /* @__PURE__ */ jsx11(
|
|
1063
|
+
Typography11,
|
|
419
1064
|
{
|
|
420
1065
|
variant: "body2",
|
|
421
1066
|
sx: { fontFamily: "monospace" },
|
|
@@ -423,8 +1068,8 @@ var RequestPermissionsButton = ({
|
|
|
423
1068
|
},
|
|
424
1069
|
`${ack.parentCapability}`
|
|
425
1070
|
)),
|
|
426
|
-
acks.length === 0 ? /* @__PURE__ */
|
|
427
|
-
|
|
1071
|
+
acks.length === 0 ? /* @__PURE__ */ jsx11(
|
|
1072
|
+
Typography11,
|
|
428
1073
|
{
|
|
429
1074
|
variant: "body2",
|
|
430
1075
|
sx: { color: "text.secondary" },
|
|
@@ -432,7 +1077,7 @@ var RequestPermissionsButton = ({
|
|
|
432
1077
|
}
|
|
433
1078
|
) : null
|
|
434
1079
|
] }) : null,
|
|
435
|
-
/* @__PURE__ */
|
|
1080
|
+
/* @__PURE__ */ jsx11(ErrorRender7, { error: clientError ?? requestError, scope: "RequestPermissionsButton" })
|
|
436
1081
|
]
|
|
437
1082
|
}
|
|
438
1083
|
);
|
|
@@ -450,19 +1095,18 @@ var InPageGatewaysContext = createContextEx2();
|
|
|
450
1095
|
import { DefaultNetworks as DefaultNetworks2 } from "@xyo-network/xl1-sdk";
|
|
451
1096
|
import {
|
|
452
1097
|
startTransition,
|
|
453
|
-
useCallback as
|
|
454
|
-
useEffect as
|
|
455
|
-
useMemo,
|
|
456
|
-
useState as
|
|
1098
|
+
useCallback as useCallback3,
|
|
1099
|
+
useEffect as useEffect4,
|
|
1100
|
+
useMemo as useMemo3,
|
|
1101
|
+
useState as useState11
|
|
457
1102
|
} from "react";
|
|
458
1103
|
|
|
459
1104
|
// src/client/context/in-page/lib/buildGateway.ts
|
|
460
|
-
import { assertEx as assertEx2, isDefined as
|
|
1105
|
+
import { assertEx as assertEx2, isDefined as isDefined10 } from "@xylabs/sdk-js";
|
|
461
1106
|
import {
|
|
462
1107
|
basicRemoteRunnerLocator,
|
|
463
1108
|
basicRemoteViewerLocator,
|
|
464
1109
|
DefaultNetworks,
|
|
465
|
-
NetworkDataLakeUrls,
|
|
466
1110
|
XyoGatewayMoniker
|
|
467
1111
|
} from "@xyo-network/xl1-sdk";
|
|
468
1112
|
var buildGateway = async (gatewayName, signerTransport) => {
|
|
@@ -474,18 +1118,17 @@ var buildGateway = async (gatewayName, signerTransport) => {
|
|
|
474
1118
|
url: `${resolvedNetwork.url}/rpc`
|
|
475
1119
|
}
|
|
476
1120
|
};
|
|
477
|
-
const
|
|
478
|
-
const locator = isDefined5(signerTransport) ? await basicRemoteRunnerLocator(gatewayName, remoteConfig, signerTransport, dataLakeEndpoint) : await basicRemoteViewerLocator(gatewayName, remoteConfig, dataLakeEndpoint);
|
|
1121
|
+
const locator = isDefined10(signerTransport) ? await basicRemoteRunnerLocator(gatewayName, remoteConfig, signerTransport) : await basicRemoteViewerLocator(gatewayName, remoteConfig);
|
|
479
1122
|
return await locator.getInstance(XyoGatewayMoniker);
|
|
480
1123
|
};
|
|
481
1124
|
|
|
482
1125
|
// src/client/context/in-page/Provider.tsx
|
|
483
|
-
import { jsx as
|
|
1126
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
484
1127
|
var InPageGatewaysProvider = ({ signerTransport, children }) => {
|
|
485
|
-
const [gateways, setGateways] =
|
|
486
|
-
const [errors, setErrors] =
|
|
487
|
-
const [previousSignerTransport, setPreviousSignerTransport] =
|
|
488
|
-
const clearAll =
|
|
1128
|
+
const [gateways, setGateways] = useState11({});
|
|
1129
|
+
const [errors, setErrors] = useState11({});
|
|
1130
|
+
const [previousSignerTransport, setPreviousSignerTransport] = useState11(signerTransport);
|
|
1131
|
+
const clearAll = useCallback3(() => {
|
|
489
1132
|
setGateways({});
|
|
490
1133
|
setErrors({});
|
|
491
1134
|
}, []);
|
|
@@ -493,7 +1136,7 @@ var InPageGatewaysProvider = ({ signerTransport, children }) => {
|
|
|
493
1136
|
clearAll();
|
|
494
1137
|
setPreviousSignerTransport(signerTransport);
|
|
495
1138
|
}
|
|
496
|
-
|
|
1139
|
+
useEffect4(() => {
|
|
497
1140
|
let cancelled = false;
|
|
498
1141
|
const buildAll = async () => {
|
|
499
1142
|
const results = await Promise.allSettled(
|
|
@@ -523,7 +1166,7 @@ var InPageGatewaysProvider = ({ signerTransport, children }) => {
|
|
|
523
1166
|
cancelled = true;
|
|
524
1167
|
};
|
|
525
1168
|
}, [signerTransport]);
|
|
526
|
-
const value =
|
|
1169
|
+
const value = useMemo3(() => {
|
|
527
1170
|
const value2 = {
|
|
528
1171
|
clearAll,
|
|
529
1172
|
errors,
|
|
@@ -532,7 +1175,7 @@ var InPageGatewaysProvider = ({ signerTransport, children }) => {
|
|
|
532
1175
|
};
|
|
533
1176
|
return value2;
|
|
534
1177
|
}, [clearAll, errors, gateways]);
|
|
535
|
-
return /* @__PURE__ */
|
|
1178
|
+
return /* @__PURE__ */ jsx12(InPageGatewaysContext, { value, children });
|
|
536
1179
|
};
|
|
537
1180
|
|
|
538
1181
|
// src/client/context/in-page/useProvidedInPageGateways.ts
|
|
@@ -540,10 +1183,10 @@ import { useContextEx } from "@xylabs/react-shared";
|
|
|
540
1183
|
var useProvidedInPageGateways = (required = true) => useContextEx(InPageGatewaysContext, "InPageGateways", required);
|
|
541
1184
|
|
|
542
1185
|
// src/client/context/providers/GatewayProvider.tsx
|
|
543
|
-
import { ErrorRender as
|
|
544
|
-
import { isDefinedNotNull as
|
|
545
|
-
import { useMemo as
|
|
546
|
-
import { jsx as
|
|
1186
|
+
import { ErrorRender as ErrorRender8 } from "@xylabs/react-error";
|
|
1187
|
+
import { isDefinedNotNull as isDefinedNotNull8, isNull as isNull2 } from "@xylabs/sdk-js";
|
|
1188
|
+
import { useMemo as useMemo4 } from "react";
|
|
1189
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
547
1190
|
var GatewayProvider = ({ gatewayName, children }) => {
|
|
548
1191
|
const {
|
|
549
1192
|
gateway: gatewayFromWallet,
|
|
@@ -556,7 +1199,7 @@ var GatewayProvider = ({ gatewayName, children }) => {
|
|
|
556
1199
|
} = useProvidedInPageGateways(true);
|
|
557
1200
|
const gatewayFromConfig = gatewayName ? allGateways[gatewayName] : void 0;
|
|
558
1201
|
const gatewayFromConfigError = gatewayName ? allGatewayErrors[gatewayName] : void 0;
|
|
559
|
-
const { defaultGateway, gateways } =
|
|
1202
|
+
const { defaultGateway, gateways } = useMemo4(() => {
|
|
560
1203
|
if (isNull2(gatewayFromWallet)) {
|
|
561
1204
|
return {
|
|
562
1205
|
defaultGateway: gatewayFromConfig,
|
|
@@ -565,7 +1208,7 @@ var GatewayProvider = ({ gatewayName, children }) => {
|
|
|
565
1208
|
walletGateway: null
|
|
566
1209
|
}
|
|
567
1210
|
};
|
|
568
|
-
} else if (
|
|
1211
|
+
} else if (isDefinedNotNull8(gatewayFromWallet)) {
|
|
569
1212
|
return {
|
|
570
1213
|
defaultGateway: gatewayFromWallet,
|
|
571
1214
|
gateways: {
|
|
@@ -582,7 +1225,7 @@ var GatewayProvider = ({ gatewayName, children }) => {
|
|
|
582
1225
|
}
|
|
583
1226
|
};
|
|
584
1227
|
}, [gatewayFromConfig, gatewayFromWallet]);
|
|
585
|
-
const value =
|
|
1228
|
+
const value = useMemo4(() => {
|
|
586
1229
|
const value2 = {
|
|
587
1230
|
defaultGateway,
|
|
588
1231
|
error: gatewayFromWalletError ?? gatewayFromConfigError,
|
|
@@ -598,22 +1241,22 @@ var GatewayProvider = ({ gatewayName, children }) => {
|
|
|
598
1241
|
gateways,
|
|
599
1242
|
clearAll
|
|
600
1243
|
]);
|
|
601
|
-
return /* @__PURE__ */
|
|
602
|
-
/* @__PURE__ */
|
|
1244
|
+
return /* @__PURE__ */ jsxs12(GatewayContext, { value, children: [
|
|
1245
|
+
/* @__PURE__ */ jsx13(ErrorRender8, { error: gatewayFromConfigError }),
|
|
603
1246
|
children
|
|
604
1247
|
] });
|
|
605
1248
|
};
|
|
606
1249
|
|
|
607
1250
|
// src/client/context/providers/WalletGatewayProvider.tsx
|
|
608
|
-
import { ErrorRender as
|
|
609
|
-
import { useMemo as
|
|
610
|
-
import { jsx as
|
|
1251
|
+
import { ErrorRender as ErrorRender9 } from "@xylabs/react-error";
|
|
1252
|
+
import { useMemo as useMemo5 } from "react";
|
|
1253
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
611
1254
|
var WalletGatewayProvider = ({ gatewayName, children }) => {
|
|
612
1255
|
const {
|
|
613
1256
|
gateway: gatewayFromWallet,
|
|
614
1257
|
error: gatewayFromWalletError
|
|
615
1258
|
} = useGatewayFromWallet(gatewayName);
|
|
616
|
-
const { defaultGateway, gateways } =
|
|
1259
|
+
const { defaultGateway, gateways } = useMemo5(() => {
|
|
617
1260
|
return {
|
|
618
1261
|
defaultGateway: gatewayFromWallet,
|
|
619
1262
|
gateways: {
|
|
@@ -622,7 +1265,7 @@ var WalletGatewayProvider = ({ gatewayName, children }) => {
|
|
|
622
1265
|
}
|
|
623
1266
|
};
|
|
624
1267
|
}, [gatewayFromWallet]);
|
|
625
|
-
const value =
|
|
1268
|
+
const value = useMemo5(() => {
|
|
626
1269
|
const value2 = {
|
|
627
1270
|
defaultGateway,
|
|
628
1271
|
error: gatewayFromWalletError,
|
|
@@ -635,8 +1278,8 @@ var WalletGatewayProvider = ({ gatewayName, children }) => {
|
|
|
635
1278
|
gatewayFromWalletError,
|
|
636
1279
|
gateways
|
|
637
1280
|
]);
|
|
638
|
-
return /* @__PURE__ */
|
|
639
|
-
/* @__PURE__ */
|
|
1281
|
+
return /* @__PURE__ */ jsxs13(GatewayContext, { value, children: [
|
|
1282
|
+
/* @__PURE__ */ jsx14(ErrorRender9, { error: gatewayFromWalletError }),
|
|
640
1283
|
children
|
|
641
1284
|
] });
|
|
642
1285
|
};
|
|
@@ -645,8 +1288,16 @@ var WalletGatewayProvider = ({ gatewayName, children }) => {
|
|
|
645
1288
|
import { useContextEx as useContextEx2 } from "@xylabs/react-shared";
|
|
646
1289
|
var useProvidedGateway = (required = true) => useContextEx2(GatewayContext, "Gateway", required);
|
|
647
1290
|
export {
|
|
1291
|
+
ApprovedLakeSelector,
|
|
648
1292
|
ConnectAccountsStack,
|
|
649
1293
|
ConnectedAccount,
|
|
1294
|
+
DataLakeGetButton,
|
|
1295
|
+
DataLakeGetPanel,
|
|
1296
|
+
DataLakeInsertButton,
|
|
1297
|
+
DataLakeInsertPanel,
|
|
1298
|
+
DataLakeListButton,
|
|
1299
|
+
DataLakeOperationsPanel,
|
|
1300
|
+
DataLakeRequestAccessButton,
|
|
650
1301
|
GatewayContext,
|
|
651
1302
|
GatewayProvider,
|
|
652
1303
|
InPageGatewaysContext,
|
|
@@ -665,4 +1316,4 @@ export {
|
|
|
665
1316
|
useProvidedGateway,
|
|
666
1317
|
useProvidedInPageGateways
|
|
667
1318
|
};
|
|
668
|
-
//# sourceMappingURL=index.mjs.map
|
|
1319
|
+
//# sourceMappingURL=index.mjs.map
|