@xyo-network/xl1-react-client-sdk 1.28.4 → 1.28.6
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/ConnectAccountsStack.d.ts.map +1 -1
- package/dist/browser/client/components/connected/RequestPermissionsButton.d.ts +15 -0
- package/dist/browser/client/components/connected/RequestPermissionsButton.d.ts.map +1 -0
- package/dist/browser/client/components/connected/account/Connected.d.ts.map +1 -1
- package/dist/browser/client/components/connected/index.d.ts +1 -0
- package/dist/browser/client/components/connected/index.d.ts.map +1 -1
- package/dist/browser/client/context/GatewayContext.d.ts +2 -7
- package/dist/browser/client/context/GatewayContext.d.ts.map +1 -1
- package/dist/browser/client/context/in-page/InPageGatewaysContext.d.ts +2 -7
- package/dist/browser/client/context/in-page/InPageGatewaysContext.d.ts.map +1 -1
- package/dist/browser/client/context/in-page/useProvidedInPageGateways.d.ts +2 -3
- package/dist/browser/client/context/in-page/useProvidedInPageGateways.d.ts.map +1 -1
- package/dist/browser/client/context/providers/story/GatewayStatus.d.ts.map +1 -1
- package/dist/browser/client/context/useProvidedGateway.d.ts +2 -3
- package/dist/browser/client/context/useProvidedGateway.d.ts.map +1 -1
- package/dist/browser/client/hooks/client/story/GatewayFromWalletStatus.d.ts.map +1 -1
- package/dist/browser/client/index.mjs +150 -28
- package/dist/browser/client/index.mjs.map +1 -1
- package/dist/browser/client/story/GatewayStats.d.ts.map +1 -1
- package/dist/browser/client/story/GatewayStatus.d.ts.map +1 -1
- package/dist/browser/index.mjs +244 -86
- package/dist/browser/index.mjs.map +1 -1
- package/dist/browser/shared/components/stack/DetailsStack.d.ts.map +1 -1
- package/dist/browser/shared/components/stack/LabelValueStack.d.ts.map +1 -1
- package/dist/browser/shared/index.mjs +74 -38
- package/dist/browser/shared/index.mjs.map +1 -1
- package/package.json +39 -38
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectAccountsStack.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/connected/ConnectAccountsStack.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAQ/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC7D,OAAO,KAAoB,MAAM,OAAO,CAAA;AA4BxC,MAAM,WAAW,+BAAgC,SAAQ,UAAU;IACjE,gBAAgB,CAAC,EAAE,aAAa,CAAC;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACtD,gBAAgB,CAAC,EAAE,aAAa,CAAC;QAAE,OAAO,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAA;KAAE,CAAC,CAAA;IAC9E,0BAA0B,CAAC,EAAE,aAAa,CAAA;IAC1C,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IAC/C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,+BAA+B,
|
|
1
|
+
{"version":3,"file":"ConnectAccountsStack.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/connected/ConnectAccountsStack.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAQ/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC7D,OAAO,KAAoB,MAAM,OAAO,CAAA;AA4BxC,MAAM,WAAW,+BAAgC,SAAQ,UAAU;IACjE,gBAAgB,CAAC,EAAE,aAAa,CAAC;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACtD,gBAAgB,CAAC,EAAE,aAAa,CAAC;QAAE,OAAO,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAA;KAAE,CAAC,CAAA;IAC9E,0BAA0B,CAAC,EAAE,aAAa,CAAA;IAC1C,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IAC/C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,+BAA+B,CAgD1E,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StackProps } from '@mui/material';
|
|
2
|
+
import type { PermissionRequest } from '@xyo-network/xl1-protocol-lib';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export interface RequestPermissionsButtonProps extends StackProps {
|
|
5
|
+
permissions: PermissionRequest[];
|
|
6
|
+
timeout?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Calls `client.permissions.requestPermissions(...)` with a batch of
|
|
10
|
+
* `PermissionRequest` entries and renders the resulting `RequestedPermission[]`
|
|
11
|
+
* acks (or any error). Designed for the Storybook real-wallet story so the
|
|
12
|
+
* full popup-consent round-trip can be exercised against the live extension.
|
|
13
|
+
*/
|
|
14
|
+
export declare const RequestPermissionsButton: React.FC<RequestPermissionsButtonProps>;
|
|
15
|
+
//# sourceMappingURL=RequestPermissionsButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RequestPermissionsButton.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/connected/RequestPermissionsButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAO/C,OAAO,KAAK,EAAE,iBAAiB,EAAuB,MAAM,+BAA+B,CAAA;AAC3F,OAAO,KAAmB,MAAM,OAAO,CAAA;AAIvC,MAAM,WAAW,6BAA8B,SAAQ,UAAU;IAC/D,WAAW,EAAE,iBAAiB,EAAE,CAAA;IAChC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAAC,6BAA6B,CAiF5E,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Connected.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/connected/account/Connected.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"Connected.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/connected/account/Connected.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAuB1D,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/connected/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/connected/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,gCAAgC,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { GatewayStateFields } from './GatewayProviderState.ts';
|
|
1
2
|
/**
|
|
2
3
|
* Shared React context that decouples gateway *sources* from gateway
|
|
3
4
|
* *consumers*. Any provider that can resolve an `XyoGateway` publishes to
|
|
@@ -18,11 +19,5 @@
|
|
|
18
19
|
* to this same context — do not create a parallel context, or consumers
|
|
19
20
|
* will silently stop receiving updates.
|
|
20
21
|
*/
|
|
21
|
-
export declare const GatewayContext: import("react").Context<
|
|
22
|
-
provided: true;
|
|
23
|
-
}) | (import("@xylabs/react-shared").FixedValues<import("@xylabs/react-shared").ProvidedContextExState<import("./GatewayProviderState.ts").GatewayStateFields>, never> & {
|
|
24
|
-
provided: false;
|
|
25
|
-
}) | (import("@xylabs/react-shared").FixedValues<import("@xylabs/react-shared").NotProvidedContextExState<import("./GatewayProviderState.ts").GatewayStateFields>, never> & {
|
|
26
|
-
provided: false;
|
|
27
|
-
})>;
|
|
22
|
+
export declare const GatewayContext: import("react").Context<import("@xylabs/react-shared").ContextExState<GatewayStateFields>>;
|
|
28
23
|
//# sourceMappingURL=GatewayContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GatewayContext.d.ts","sourceRoot":"","sources":["../../../../src/client/context/GatewayContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GatewayContext.d.ts","sourceRoot":"","sources":["../../../../src/client/context/GatewayContext.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAEnE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,cAAc,4FAAwC,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { InPageGatewaysStateFields } from './InPageGatewaysState.ts';
|
|
1
2
|
/**
|
|
2
3
|
* Narrow, provider-internal context that `InPageGatewaysProvider` writes
|
|
3
4
|
* to and `GatewayProvider` reads from. Do not consume this in application
|
|
@@ -6,11 +7,5 @@
|
|
|
6
7
|
* single in-page *builder* from the many single-gateway *adapters* that
|
|
7
8
|
* sit between it and the shared gateway surface.
|
|
8
9
|
*/
|
|
9
|
-
export declare const InPageGatewaysContext: import("react").Context<
|
|
10
|
-
provided: true;
|
|
11
|
-
}) | (import("@xylabs/react-shared").FixedValues<import("@xylabs/react-shared").ProvidedContextExState<import("./InPageGatewaysState.ts").InPageGatewaysStateFields>, never> & {
|
|
12
|
-
provided: false;
|
|
13
|
-
}) | (import("@xylabs/react-shared").FixedValues<import("@xylabs/react-shared").NotProvidedContextExState<import("./InPageGatewaysState.ts").InPageGatewaysStateFields>, never> & {
|
|
14
|
-
provided: false;
|
|
15
|
-
})>;
|
|
10
|
+
export declare const InPageGatewaysContext: import("react").Context<import("@xylabs/react-shared").ContextExState<InPageGatewaysStateFields>>;
|
|
16
11
|
//# sourceMappingURL=InPageGatewaysContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InPageGatewaysContext.d.ts","sourceRoot":"","sources":["../../../../../src/client/context/in-page/InPageGatewaysContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InPageGatewaysContext.d.ts","sourceRoot":"","sources":["../../../../../src/client/context/in-page/InPageGatewaysContext.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAA;AAEzE;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,mGAA+C,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { InPageGatewaysStateFields } from './InPageGatewaysState.ts';
|
|
1
2
|
/**
|
|
2
3
|
* Reads the `InPageGatewaysContext` map of per-network in-page gateways.
|
|
3
4
|
* Intended for internal use by `GatewayProvider` — application code
|
|
@@ -7,7 +8,5 @@
|
|
|
7
8
|
* @param required - When `true` (default), throws if no
|
|
8
9
|
* `InPageGatewaysProvider` is mounted above.
|
|
9
10
|
*/
|
|
10
|
-
export declare const useProvidedInPageGateways: (required?: boolean) => Omit<import("
|
|
11
|
-
provided: true;
|
|
12
|
-
}, "provided"> | Omit<import("@xylabs/react-shared").NotProvidedContextExState<import("./InPageGatewaysState.ts").InPageGatewaysState>, "provided">;
|
|
11
|
+
export declare const useProvidedInPageGateways: (required?: boolean) => Omit<import("@xylabs/react-shared").ProvidedContextExState<InPageGatewaysStateFields>, "provided"> | Omit<import("@xylabs/react-shared").NotProvidedContextExState<InPageGatewaysStateFields>, "provided">;
|
|
13
12
|
//# sourceMappingURL=useProvidedInPageGateways.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProvidedInPageGateways.d.ts","sourceRoot":"","sources":["../../../../../src/client/context/in-page/useProvidedInPageGateways.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useProvidedInPageGateways.d.ts","sourceRoot":"","sources":["../../../../../src/client/context/in-page/useProvidedInPageGateways.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAA;AAEzE;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,GAAI,kBAAe,+MAA+F,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GatewayStatus.d.ts","sourceRoot":"","sources":["../../../../../../src/client/context/providers/story/GatewayStatus.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"GatewayStatus.d.ts","sourceRoot":"","sources":["../../../../../../src/client/context/providers/story/GatewayStatus.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAqDjC,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { GatewayStateFields } from './GatewayProviderState.ts';
|
|
1
2
|
/**
|
|
2
3
|
* The sole consumer entry point for gateway state. Reads the nearest
|
|
3
4
|
* `GatewayContext` in the tree, regardless of which provider published
|
|
@@ -10,7 +11,5 @@
|
|
|
10
11
|
* without a gateway. When `false`, returns default state (all fields
|
|
11
12
|
* undefined) so the component can render a graceful fallback.
|
|
12
13
|
*/
|
|
13
|
-
export declare const useProvidedGateway: (required?: boolean) => Omit<import("
|
|
14
|
-
provided: true;
|
|
15
|
-
}, "provided"> | Omit<import("@xylabs/react-shared").NotProvidedContextExState<import("./GatewayProviderState.ts").GatewayContextState>, "provided">;
|
|
14
|
+
export declare const useProvidedGateway: (required?: boolean) => Omit<import("@xylabs/react-shared").ProvidedContextExState<GatewayStateFields>, "provided"> | Omit<import("@xylabs/react-shared").NotProvidedContextExState<GatewayStateFields>, "provided">;
|
|
16
15
|
//# sourceMappingURL=useProvidedGateway.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProvidedGateway.d.ts","sourceRoot":"","sources":["../../../../src/client/context/useProvidedGateway.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useProvidedGateway.d.ts","sourceRoot":"","sources":["../../../../src/client/context/useProvidedGateway.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAEnE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,GAAI,kBAAe,iMAA0E,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GatewayFromWalletStatus.d.ts","sourceRoot":"","sources":["../../../../../../src/client/hooks/client/story/GatewayFromWalletStatus.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,WAAW,4BAA4B;IAC3C,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B;AAaD,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,4BAA4B,
|
|
1
|
+
{"version":3,"file":"GatewayFromWalletStatus.d.ts","sourceRoot":"","sources":["../../../../../../src/client/hooks/client/story/GatewayFromWalletStatus.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,WAAW,4BAA4B;IAC3C,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B;AAaD,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,4BAA4B,CA2C1E,CAAA"}
|
|
@@ -9,10 +9,28 @@ import { BlockiesAvatarAddress } from "@xyo-network/xl1-blockies";
|
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
var ConnectedAccount = ({ address }) => {
|
|
11
11
|
const shortenedAddress = `${EthAddressWrapper.fromString(address)?.toShortString(4)}`;
|
|
12
|
-
return /* @__PURE__ */ jsxs(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
return /* @__PURE__ */ jsxs(
|
|
13
|
+
Stack,
|
|
14
|
+
{
|
|
15
|
+
direction: "row",
|
|
16
|
+
spacing: 1,
|
|
17
|
+
sx: { alignItems: "center" },
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ jsx(BlockiesAvatarAddress, { address, size: 21 }),
|
|
20
|
+
/* @__PURE__ */ jsx(Tooltip, { title: address, children: /* @__PURE__ */ jsx(
|
|
21
|
+
Typography,
|
|
22
|
+
{
|
|
23
|
+
variant: "caption",
|
|
24
|
+
sx: {
|
|
25
|
+
color: "text.secondary",
|
|
26
|
+
fontFamily: "monospace"
|
|
27
|
+
},
|
|
28
|
+
children: shortenedAddress
|
|
29
|
+
}
|
|
30
|
+
) })
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
);
|
|
16
34
|
};
|
|
17
35
|
|
|
18
36
|
// src/client/components/connected/ConnectAccountsStack.tsx
|
|
@@ -309,12 +327,115 @@ var ConnectAccountsStack = ({
|
|
|
309
327
|
onAccountConnected(address);
|
|
310
328
|
}
|
|
311
329
|
}, [address, onAccountConnected]);
|
|
312
|
-
return /* @__PURE__ */ jsxs2(
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
330
|
+
return /* @__PURE__ */ jsxs2(
|
|
331
|
+
Stack2,
|
|
332
|
+
{
|
|
333
|
+
direction: "row",
|
|
334
|
+
spacing: 2,
|
|
335
|
+
...props,
|
|
336
|
+
sx: { alignItems: "start", ...props.sx },
|
|
337
|
+
children: [
|
|
338
|
+
isDefined3(address) ? /* @__PURE__ */ jsx2(AccountComponent, { address }) : null,
|
|
339
|
+
isUndefined3(address) && !timedout ? /* @__PURE__ */ jsx2(ConnectComponent, { onClick: () => void connectSigner(), children: "Connect" }) : null,
|
|
340
|
+
isUndefined3(address) && timedout ? /* @__PURE__ */ jsx2(NoWalletInstalledComponent, {}) : null,
|
|
341
|
+
/* @__PURE__ */ jsx2(ErrorRender, { error, scope: "ConnectSigner:error" })
|
|
342
|
+
]
|
|
343
|
+
}
|
|
344
|
+
);
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
// src/client/components/connected/RequestPermissionsButton.tsx
|
|
348
|
+
import {
|
|
349
|
+
Alert as Alert2,
|
|
350
|
+
Stack as Stack3,
|
|
351
|
+
Typography as Typography3
|
|
352
|
+
} from "@mui/material";
|
|
353
|
+
import { ButtonEx as ButtonEx2 } from "@xylabs/react-button";
|
|
354
|
+
import { ErrorRender as ErrorRender2 } from "@xylabs/react-error";
|
|
355
|
+
import { isDefined as isDefined4, isDefinedNotNull as isDefinedNotNull2 } from "@xylabs/sdk-js";
|
|
356
|
+
import { useState as useState3 } from "react";
|
|
357
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
358
|
+
var RequestPermissionsButton = ({
|
|
359
|
+
permissions,
|
|
360
|
+
timeout,
|
|
361
|
+
...props
|
|
362
|
+
}) => {
|
|
363
|
+
const {
|
|
364
|
+
client,
|
|
365
|
+
error: clientError,
|
|
366
|
+
isLoading,
|
|
367
|
+
timedout
|
|
368
|
+
} = useClientFromWallet(timeout);
|
|
369
|
+
const [acks, setAcks] = useState3();
|
|
370
|
+
const [requestError, setRequestError] = useState3();
|
|
371
|
+
const [requesting, setRequesting] = useState3(false);
|
|
372
|
+
const handleClick = async () => {
|
|
373
|
+
if (!isDefinedNotNull2(client)) return;
|
|
374
|
+
setRequestError(void 0);
|
|
375
|
+
setAcks(void 0);
|
|
376
|
+
setRequesting(true);
|
|
377
|
+
try {
|
|
378
|
+
const result = await client.permissions.requestPermissions(permissions);
|
|
379
|
+
setAcks(result);
|
|
380
|
+
} catch (e) {
|
|
381
|
+
setRequestError(e);
|
|
382
|
+
} finally {
|
|
383
|
+
setRequesting(false);
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
return /* @__PURE__ */ jsxs3(
|
|
387
|
+
Stack3,
|
|
388
|
+
{
|
|
389
|
+
...props,
|
|
390
|
+
sx: {
|
|
391
|
+
gap: 2,
|
|
392
|
+
alignItems: "start",
|
|
393
|
+
...props.sx
|
|
394
|
+
},
|
|
395
|
+
children: [
|
|
396
|
+
timedout ? /* @__PURE__ */ jsx3(Alert2, { severity: "warning", children: "Wallet not detected." }) : null,
|
|
397
|
+
/* @__PURE__ */ jsxs3(
|
|
398
|
+
ButtonEx2,
|
|
399
|
+
{
|
|
400
|
+
variant: "contained",
|
|
401
|
+
size: "small",
|
|
402
|
+
disabled: !isDefinedNotNull2(client) || requesting,
|
|
403
|
+
busy: isLoading || requesting,
|
|
404
|
+
onClick: () => void handleClick(),
|
|
405
|
+
children: [
|
|
406
|
+
"Request",
|
|
407
|
+
" ",
|
|
408
|
+
permissions.length,
|
|
409
|
+
" ",
|
|
410
|
+
"permission",
|
|
411
|
+
permissions.length === 1 ? "" : "s"
|
|
412
|
+
]
|
|
413
|
+
}
|
|
414
|
+
),
|
|
415
|
+
isDefined4(acks) ? /* @__PURE__ */ jsxs3(Stack3, { sx: { gap: 0.5 }, children: [
|
|
416
|
+
/* @__PURE__ */ jsx3(Typography3, { variant: "subtitle2", children: "Granted:" }),
|
|
417
|
+
acks.map((ack) => /* @__PURE__ */ jsx3(
|
|
418
|
+
Typography3,
|
|
419
|
+
{
|
|
420
|
+
variant: "body2",
|
|
421
|
+
sx: { fontFamily: "monospace" },
|
|
422
|
+
children: ack.parentCapability
|
|
423
|
+
},
|
|
424
|
+
`${ack.parentCapability}`
|
|
425
|
+
)),
|
|
426
|
+
acks.length === 0 ? /* @__PURE__ */ jsx3(
|
|
427
|
+
Typography3,
|
|
428
|
+
{
|
|
429
|
+
variant: "body2",
|
|
430
|
+
sx: { color: "text.secondary" },
|
|
431
|
+
children: "(empty \u2014 wallet returned no acks)"
|
|
432
|
+
}
|
|
433
|
+
) : null
|
|
434
|
+
] }) : null,
|
|
435
|
+
/* @__PURE__ */ jsx3(ErrorRender2, { error: clientError ?? requestError, scope: "RequestPermissionsButton" })
|
|
436
|
+
]
|
|
437
|
+
}
|
|
438
|
+
);
|
|
318
439
|
};
|
|
319
440
|
|
|
320
441
|
// src/client/context/GatewayContext.ts
|
|
@@ -332,11 +453,11 @@ import {
|
|
|
332
453
|
useCallback as useCallback2,
|
|
333
454
|
useEffect as useEffect3,
|
|
334
455
|
useMemo,
|
|
335
|
-
useState as
|
|
456
|
+
useState as useState4
|
|
336
457
|
} from "react";
|
|
337
458
|
|
|
338
459
|
// src/client/context/in-page/lib/buildGateway.ts
|
|
339
|
-
import { assertEx as assertEx2, isDefined as
|
|
460
|
+
import { assertEx as assertEx2, isDefined as isDefined5 } from "@xylabs/sdk-js";
|
|
340
461
|
import {
|
|
341
462
|
basicRemoteRunnerLocator,
|
|
342
463
|
basicRemoteViewerLocator,
|
|
@@ -354,16 +475,16 @@ var buildGateway = async (gatewayName, signerTransport) => {
|
|
|
354
475
|
}
|
|
355
476
|
};
|
|
356
477
|
const dataLakeEndpoint = NetworkDataLakeUrls[gatewayName];
|
|
357
|
-
const locator =
|
|
478
|
+
const locator = isDefined5(signerTransport) ? await basicRemoteRunnerLocator(gatewayName, remoteConfig, signerTransport, dataLakeEndpoint) : await basicRemoteViewerLocator(gatewayName, remoteConfig, dataLakeEndpoint);
|
|
358
479
|
return await locator.getInstance(XyoGatewayMoniker);
|
|
359
480
|
};
|
|
360
481
|
|
|
361
482
|
// src/client/context/in-page/Provider.tsx
|
|
362
|
-
import { jsx as
|
|
483
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
363
484
|
var InPageGatewaysProvider = ({ signerTransport, children }) => {
|
|
364
|
-
const [gateways, setGateways] =
|
|
365
|
-
const [errors, setErrors] =
|
|
366
|
-
const [previousSignerTransport, setPreviousSignerTransport] =
|
|
485
|
+
const [gateways, setGateways] = useState4({});
|
|
486
|
+
const [errors, setErrors] = useState4({});
|
|
487
|
+
const [previousSignerTransport, setPreviousSignerTransport] = useState4(signerTransport);
|
|
367
488
|
const clearAll = useCallback2(() => {
|
|
368
489
|
setGateways({});
|
|
369
490
|
setErrors({});
|
|
@@ -411,7 +532,7 @@ var InPageGatewaysProvider = ({ signerTransport, children }) => {
|
|
|
411
532
|
};
|
|
412
533
|
return value2;
|
|
413
534
|
}, [clearAll, errors, gateways]);
|
|
414
|
-
return /* @__PURE__ */
|
|
535
|
+
return /* @__PURE__ */ jsx4(InPageGatewaysContext, { value, children });
|
|
415
536
|
};
|
|
416
537
|
|
|
417
538
|
// src/client/context/in-page/useProvidedInPageGateways.ts
|
|
@@ -419,10 +540,10 @@ import { useContextEx } from "@xylabs/react-shared";
|
|
|
419
540
|
var useProvidedInPageGateways = (required = true) => useContextEx(InPageGatewaysContext, "InPageGateways", required);
|
|
420
541
|
|
|
421
542
|
// src/client/context/providers/GatewayProvider.tsx
|
|
422
|
-
import { ErrorRender as
|
|
423
|
-
import { isDefinedNotNull as
|
|
543
|
+
import { ErrorRender as ErrorRender3 } from "@xylabs/react-error";
|
|
544
|
+
import { isDefinedNotNull as isDefinedNotNull3, isNull as isNull2 } from "@xylabs/sdk-js";
|
|
424
545
|
import { useMemo as useMemo2 } from "react";
|
|
425
|
-
import { jsx as
|
|
546
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
426
547
|
var GatewayProvider = ({ gatewayName, children }) => {
|
|
427
548
|
const {
|
|
428
549
|
gateway: gatewayFromWallet,
|
|
@@ -444,7 +565,7 @@ var GatewayProvider = ({ gatewayName, children }) => {
|
|
|
444
565
|
walletGateway: null
|
|
445
566
|
}
|
|
446
567
|
};
|
|
447
|
-
} else if (
|
|
568
|
+
} else if (isDefinedNotNull3(gatewayFromWallet)) {
|
|
448
569
|
return {
|
|
449
570
|
defaultGateway: gatewayFromWallet,
|
|
450
571
|
gateways: {
|
|
@@ -477,16 +598,16 @@ var GatewayProvider = ({ gatewayName, children }) => {
|
|
|
477
598
|
gateways,
|
|
478
599
|
clearAll
|
|
479
600
|
]);
|
|
480
|
-
return /* @__PURE__ */
|
|
481
|
-
/* @__PURE__ */
|
|
601
|
+
return /* @__PURE__ */ jsxs4(GatewayContext, { value, children: [
|
|
602
|
+
/* @__PURE__ */ jsx5(ErrorRender3, { error: gatewayFromConfigError }),
|
|
482
603
|
children
|
|
483
604
|
] });
|
|
484
605
|
};
|
|
485
606
|
|
|
486
607
|
// src/client/context/providers/WalletGatewayProvider.tsx
|
|
487
|
-
import { ErrorRender as
|
|
608
|
+
import { ErrorRender as ErrorRender4 } from "@xylabs/react-error";
|
|
488
609
|
import { useMemo as useMemo3 } from "react";
|
|
489
|
-
import { jsx as
|
|
610
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
490
611
|
var WalletGatewayProvider = ({ gatewayName, children }) => {
|
|
491
612
|
const {
|
|
492
613
|
gateway: gatewayFromWallet,
|
|
@@ -514,8 +635,8 @@ var WalletGatewayProvider = ({ gatewayName, children }) => {
|
|
|
514
635
|
gatewayFromWalletError,
|
|
515
636
|
gateways
|
|
516
637
|
]);
|
|
517
|
-
return /* @__PURE__ */
|
|
518
|
-
/* @__PURE__ */
|
|
638
|
+
return /* @__PURE__ */ jsxs5(GatewayContext, { value, children: [
|
|
639
|
+
/* @__PURE__ */ jsx6(ErrorRender4, { error: gatewayFromWalletError }),
|
|
519
640
|
children
|
|
520
641
|
] });
|
|
521
642
|
};
|
|
@@ -530,6 +651,7 @@ export {
|
|
|
530
651
|
GatewayProvider,
|
|
531
652
|
InPageGatewaysContext,
|
|
532
653
|
InPageGatewaysProvider,
|
|
654
|
+
RequestPermissionsButton,
|
|
533
655
|
WalletGatewayProvider,
|
|
534
656
|
findCaveat,
|
|
535
657
|
getXyoClient,
|