@canton-network/core-wallet-ui-components 1.16.0 → 1.17.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.
- package/dist/activity-utils-CsiZsTG2.cjs +4 -0
- package/dist/activity-utils-CsiZsTG2.cjs.map +1 -0
- package/dist/activity-utils-glrdQSNU.js +1944 -0
- package/dist/activity-utils-glrdQSNU.js.map +1 -0
- package/dist/components/auth-editor.d.ts.map +1 -1
- package/dist/components/idp-form.d.ts.map +1 -1
- package/dist/components/message-detail.d.ts +30 -0
- package/dist/components/message-detail.d.ts.map +1 -0
- package/dist/components/transaction-detail.d.ts +1 -1
- package/dist/components/transaction-detail.d.ts.map +1 -1
- package/dist/components/wallet-create-form.d.ts +1 -1
- package/dist/components/wallet-create-form.d.ts.map +1 -1
- package/dist/components/wallet-edit-form.d.ts.map +1 -1
- package/dist/components/wallet-form.d.ts +4 -0
- package/dist/components/wallet-form.d.ts.map +1 -1
- package/dist/handle-errors.d.ts +2 -7
- package/dist/handle-errors.d.ts.map +1 -1
- package/dist/index.cjs +514 -590
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4065 -4186
- package/dist/index.js.map +1 -1
- package/dist/internal/activity-render.d.ts +2 -0
- package/dist/internal/activity-render.d.ts.map +1 -0
- package/dist/internal/activity-utils.d.ts +2 -0
- package/dist/internal/activity-utils.d.ts.map +1 -1
- package/dist/internal/error-toast.d.ts +12 -0
- package/dist/internal/error-toast.d.ts.map +1 -0
- package/dist/react/components/ApiKeyCard.d.ts +8 -0
- package/dist/react/components/ApiKeyCard.d.ts.map +1 -0
- package/dist/react/components/ApiKeyForm.d.ts +8 -0
- package/dist/react/components/ApiKeyForm.d.ts.map +1 -0
- package/dist/react/components/AppHeader.d.ts +30 -0
- package/dist/react/components/AppHeader.d.ts.map +1 -0
- package/dist/react/components/ApprovalActions.d.ts +20 -0
- package/dist/react/components/ApprovalActions.d.ts.map +1 -0
- package/dist/react/components/AuthEditor.d.ts +21 -0
- package/dist/react/components/AuthEditor.d.ts.map +1 -0
- package/dist/react/components/BackLink.d.ts +18 -0
- package/dist/react/components/BackLink.d.ts.map +1 -0
- package/dist/react/components/CardDetailRow.d.ts +15 -0
- package/dist/react/components/CardDetailRow.d.ts.map +1 -0
- package/dist/react/components/CopyButton.d.ts +8 -0
- package/dist/react/components/CopyButton.d.ts.map +1 -0
- package/dist/react/components/ErrorPage.d.ts +10 -0
- package/dist/react/components/ErrorPage.d.ts.map +1 -0
- package/dist/react/components/IdpCard.d.ts +9 -0
- package/dist/react/components/IdpCard.d.ts.map +1 -0
- package/dist/react/components/IdpForm.d.ts +19 -0
- package/dist/react/components/IdpForm.d.ts.map +1 -0
- package/dist/react/components/LoadingState.d.ts +7 -0
- package/dist/react/components/LoadingState.d.ts.map +1 -0
- package/dist/react/components/LoginForm.d.ts +30 -0
- package/dist/react/components/LoginForm.d.ts.map +1 -0
- package/dist/react/components/MessageDetail.d.ts +27 -0
- package/dist/react/components/MessageDetail.d.ts.map +1 -0
- package/dist/react/components/NetworkCard.d.ts +13 -0
- package/dist/react/components/NetworkCard.d.ts.map +1 -0
- package/dist/react/components/NetworkForm.d.ts +17 -0
- package/dist/react/components/NetworkForm.d.ts.map +1 -0
- package/dist/react/components/Pagination.d.ts +13 -0
- package/dist/react/components/Pagination.d.ts.map +1 -0
- package/dist/react/components/SigningProviderSelect.d.ts +15 -0
- package/dist/react/components/SigningProviderSelect.d.ts.map +1 -0
- package/dist/react/components/Toast.d.ts +20 -0
- package/dist/react/components/Toast.d.ts.map +1 -0
- package/dist/react/components/TransactionCard.d.ts +17 -0
- package/dist/react/components/TransactionCard.d.ts.map +1 -0
- package/dist/react/components/TransactionDetail.d.ts +29 -0
- package/dist/react/components/TransactionDetail.d.ts.map +1 -0
- package/dist/react/components/WalletCard.d.ts +21 -0
- package/dist/react/components/WalletCard.d.ts.map +1 -0
- package/dist/react/components/WalletCreateForm.d.ts +35 -0
- package/dist/react/components/WalletCreateForm.d.ts.map +1 -0
- package/dist/react/components/WalletEditForm.d.ts +35 -0
- package/dist/react/components/WalletEditForm.d.ts.map +1 -0
- package/dist/react/components/WalletForm.d.ts +25 -0
- package/dist/react/components/WalletForm.d.ts.map +1 -0
- package/dist/react/components/WalletsSync.d.ts +13 -0
- package/dist/react/components/WalletsSync.d.ts.map +1 -0
- package/dist/react/contexts/ToastContext.d.ts +14 -0
- package/dist/react/contexts/ToastContext.d.ts.map +1 -0
- package/dist/react/contexts/ToastProvider.d.ts +10 -0
- package/dist/react/contexts/ToastProvider.d.ts.map +1 -0
- package/dist/react/hooks/useErrorToast.d.ts +8 -0
- package/dist/react/hooks/useErrorToast.d.ts.map +1 -0
- package/dist/react/hooks/useToast.d.ts +4 -0
- package/dist/react/hooks/useToast.d.ts.map +1 -0
- package/dist/react/index.cjs +19 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.ts +31 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +2488 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/logger.d.ts +2 -0
- package/dist/react/logger.d.ts.map +1 -0
- package/dist/routing.d.ts +1 -1
- package/dist/routing.d.ts.map +1 -1
- package/dist/windows/popup.d.ts.map +1 -1
- package/dist/windows/wallet-picker.d.ts.map +1 -1
- package/package.json +58 -24
- package/dist/components/api-key-card.test.d.ts +0 -1
- package/dist/components/api-key-card.test.d.ts.map +0 -1
- package/dist/components/api-key-form.test.d.ts +0 -1
- package/dist/components/api-key-form.test.d.ts.map +0 -1
- package/dist/components/app-header.test.d.ts +0 -1
- package/dist/components/app-header.test.d.ts.map +0 -1
- package/dist/components/app-layout.test.d.ts +0 -2
- package/dist/components/app-layout.test.d.ts.map +0 -1
- package/dist/components/auth-editor.test.d.ts +0 -1
- package/dist/components/auth-editor.test.d.ts.map +0 -1
- package/dist/components/back-link.test.d.ts +0 -2
- package/dist/components/back-link.test.d.ts.map +0 -1
- package/dist/components/copy-button.test.d.ts +0 -1
- package/dist/components/copy-button.test.d.ts.map +0 -1
- package/dist/components/custom-toast.test.d.ts +0 -1
- package/dist/components/custom-toast.test.d.ts.map +0 -1
- package/dist/components/error-page.test.d.ts +0 -2
- package/dist/components/error-page.test.d.ts.map +0 -1
- package/dist/components/fixtures.d.ts +0 -15
- package/dist/components/fixtures.d.ts.map +0 -1
- package/dist/components/form-input.test.d.ts +0 -1
- package/dist/components/form-input.test.d.ts.map +0 -1
- package/dist/components/idp-card.test.d.ts +0 -1
- package/dist/components/idp-card.test.d.ts.map +0 -1
- package/dist/components/idp-form.test.d.ts +0 -2
- package/dist/components/idp-form.test.d.ts.map +0 -1
- package/dist/components/loading-state.test.d.ts +0 -2
- package/dist/components/loading-state.test.d.ts.map +0 -1
- package/dist/components/login-form.test.d.ts +0 -2
- package/dist/components/login-form.test.d.ts.map +0 -1
- package/dist/components/network-card.test.d.ts +0 -1
- package/dist/components/network-card.test.d.ts.map +0 -1
- package/dist/components/network-form.test.d.ts +0 -1
- package/dist/components/network-form.test.d.ts.map +0 -1
- package/dist/components/network-table.d.ts +0 -10
- package/dist/components/network-table.d.ts.map +0 -1
- package/dist/components/network-table.test.d.ts +0 -1
- package/dist/components/network-table.test.d.ts.map +0 -1
- package/dist/components/networks.d.ts +0 -16
- package/dist/components/networks.d.ts.map +0 -1
- package/dist/components/networks.test.d.ts +0 -2
- package/dist/components/networks.test.d.ts.map +0 -1
- package/dist/components/not-found.test.d.ts +0 -2
- package/dist/components/not-found.test.d.ts.map +0 -1
- package/dist/components/pagination.test.d.ts +0 -1
- package/dist/components/pagination.test.d.ts.map +0 -1
- package/dist/components/sessions.d.ts +0 -8
- package/dist/components/sessions.d.ts.map +0 -1
- package/dist/components/sessions.test.d.ts +0 -1
- package/dist/components/sessions.test.d.ts.map +0 -1
- package/dist/components/transaction-card.test.d.ts +0 -1
- package/dist/components/transaction-card.test.d.ts.map +0 -1
- package/dist/components/transaction-detail.test.d.ts +0 -1
- package/dist/components/transaction-detail.test.d.ts.map +0 -1
- package/dist/components/wallet-card.test.d.ts +0 -1
- package/dist/components/wallet-card.test.d.ts.map +0 -1
- package/dist/components/wallet-create-form.test.d.ts +0 -1
- package/dist/components/wallet-create-form.test.d.ts.map +0 -1
- package/dist/components/wallet-edit-form.test.d.ts +0 -1
- package/dist/components/wallet-edit-form.test.d.ts.map +0 -1
- package/dist/components/wallet-picker.test.d.ts +0 -1
- package/dist/components/wallet-picker.test.d.ts.map +0 -1
- package/dist/components/wallets-sync.test.d.ts +0 -1
- package/dist/components/wallets-sync.test.d.ts.map +0 -1
- package/dist/handle-errors.test.d.ts +0 -1
- package/dist/handle-errors.test.d.ts.map +0 -1
- package/dist/routing.test.d.ts +0 -2
- package/dist/routing.test.d.ts.map +0 -1
- package/dist/utils.test.d.ts +0 -2
- package/dist/utils.test.d.ts.map +0 -1
- package/dist/windows/popup.test.d.ts +0 -2
- package/dist/windows/popup.test.d.ts.map +0 -1
- package/dist/windows/wallet-picker.test.d.ts +0 -2
- package/dist/windows/wallet-picker.test.d.ts.map +0 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Key, SigningProviderId } from '@canton-network/core-wallet-user-rpc-client';
|
|
2
|
+
interface WalletEditFormProps {
|
|
3
|
+
/** The party being edited, shown read-only */
|
|
4
|
+
partyId: string;
|
|
5
|
+
/** The signing provider ids to choose from. `undefined` while they are loading, which disables the form */
|
|
6
|
+
signingProviders?: string[] | undefined;
|
|
7
|
+
/** Signing providers that are listed but can't be switched to @default [] */
|
|
8
|
+
disabledSigningProviders?: string[];
|
|
9
|
+
/**
|
|
10
|
+
* The keys of the selected signing provider: load them when
|
|
11
|
+
* `onSigningProviderChange` reports a provider. `undefined` while they are
|
|
12
|
+
* loading, which shows progress and disables submitting. Pass `[]` when
|
|
13
|
+
* the provider has none
|
|
14
|
+
*/
|
|
15
|
+
publicKeys?: Key[] | undefined;
|
|
16
|
+
/** The selected signing provider. The form follows it whenever it changes, and keeps its own choice in between */
|
|
17
|
+
selectedSigningProvider?: string;
|
|
18
|
+
/** The selected public key. The form follows it whenever it changes, and keeps its own choice in between */
|
|
19
|
+
selectedPublicKey?: string;
|
|
20
|
+
/** Disables the form and shows `submittingLabel` and `submittingMessage` @default false */
|
|
21
|
+
submitting?: boolean;
|
|
22
|
+
/** @default 'Edit' */
|
|
23
|
+
submitLabel?: string;
|
|
24
|
+
/** @default 'Editing...' */
|
|
25
|
+
submittingLabel?: string;
|
|
26
|
+
/** @default 'Editing party, please wait...' */
|
|
27
|
+
submittingMessage?: string;
|
|
28
|
+
/** Called when the form is submitted with a signing provider and one of its public keys */
|
|
29
|
+
onEdit: (partyId: string, signingProviderId: SigningProviderId, publicKey: Key['publicKey']) => void;
|
|
30
|
+
/** Called when another signing provider is chosen */
|
|
31
|
+
onSigningProviderChange?: (signingProviderId: SigningProviderId) => void;
|
|
32
|
+
}
|
|
33
|
+
export declare const WalletEditForm: ({ partyId, signingProviders, disabledSigningProviders, publicKeys, selectedSigningProvider, selectedPublicKey, submitting, submitLabel, submittingLabel, submittingMessage, onEdit, onSigningProviderChange, }: WalletEditFormProps) => import('react').JSX.Element;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=WalletEditForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalletEditForm.d.ts","sourceRoot":"","sources":["../../../src/react/components/WalletEditForm.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACR,GAAG,EACH,iBAAiB,EACpB,MAAM,6CAA6C,CAAA;AAKpD,UAAU,mBAAmB;IACzB,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAA;IACf,2GAA2G;IAC3G,gBAAgB,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IACvC,6EAA6E;IAC7E,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAA;IACnC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,GAAG,EAAE,GAAG,SAAS,CAAA;IAC9B,kHAAkH;IAClH,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,4GAA4G;IAC5G,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,2FAA2F;IAC3F,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,sBAAsB;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,4BAA4B;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,+CAA+C;IAC/C,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,2FAA2F;IAC3F,MAAM,EAAE,CACJ,OAAO,EAAE,MAAM,EACf,iBAAiB,EAAE,iBAAiB,EACpC,SAAS,EAAE,GAAG,CAAC,WAAW,CAAC,KAC1B,IAAI,CAAA;IACT,qDAAqD;IACrD,uBAAuB,CAAC,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,KAAK,IAAI,CAAA;CAC3E;AAED,eAAO,MAAM,cAAc,GAAI,gNAa5B,mBAAmB,gCA+GrB,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface WalletFormProps {
|
|
3
|
+
/** The form's fields */
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** Called when the form is submitted, unless it is disabled or submitting */
|
|
6
|
+
onSubmit: () => void | Promise<void>;
|
|
7
|
+
submitLabel: string;
|
|
8
|
+
/** Shown on the button while `submitting` */
|
|
9
|
+
submittingLabel: string;
|
|
10
|
+
/** Announced below the button while `submitting` */
|
|
11
|
+
submittingMessage: string;
|
|
12
|
+
/** Shows a spinner and the submitting texts, and disables the form @default false */
|
|
13
|
+
submitting?: boolean;
|
|
14
|
+
/** Disables the submit button, e.g. while options are still loading @default false */
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
/** Disables the submit button, e.g. when the fields can't be submitted yet @default false */
|
|
17
|
+
submitDisabled?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The shell of the wallet forms: the fields, and a submit button that shows
|
|
21
|
+
* progress. The create and edit forms put their own fields inside it
|
|
22
|
+
*/
|
|
23
|
+
export declare const WalletForm: ({ children, onSubmit, submitLabel, submittingLabel, submittingMessage, submitting, loading, submitDisabled, }: WalletFormProps) => import('react').JSX.Element;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=WalletForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalletForm.d.ts","sourceRoot":"","sources":["../../../src/react/components/WalletForm.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,OAAO,CAAA;AAGnD,UAAU,eAAe;IACrB,wBAAwB;IACxB,QAAQ,EAAE,SAAS,CAAA;IACnB,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACpC,WAAW,EAAE,MAAM,CAAA;IACnB,6CAA6C;IAC7C,eAAe,EAAE,MAAM,CAAA;IACvB,oDAAoD;IACpD,iBAAiB,EAAE,MAAM,CAAA;IACzB,qFAAqF;IACrF,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,sFAAsF;IACtF,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,6FAA6F;IAC7F,cAAc,CAAC,EAAE,OAAO,CAAA;CAC3B;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,+GASxB,eAAe,gCAgDjB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface WalletsSyncProps {
|
|
2
|
+
/** Highlights the button to show that there are changes to sync */
|
|
3
|
+
syncNeeded?: boolean;
|
|
4
|
+
/** Shows a spinner and disables the button while a sync is in progress */
|
|
5
|
+
syncing?: boolean;
|
|
6
|
+
/** Disables the button, e.g. while there is no API client yet */
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
/** Called when the button is clicked; the caller does the sync, shows its result and refreshes the wallets */
|
|
9
|
+
onSync: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const WalletsSync: ({ syncNeeded, syncing, disabled, onSync, }: WalletsSyncProps) => import('react').JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=WalletsSync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalletsSync.d.ts","sourceRoot":"","sources":["../../../src/react/components/WalletsSync.tsx"],"names":[],"mappings":"AAgBA,UAAU,gBAAgB;IACtB,mEAAmE;IACnE,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,8GAA8G;IAC9G,MAAM,EAAE,MAAM,IAAI,CAAA;CACrB;AAED,eAAO,MAAM,WAAW,GAAI,4CAKzB,gBAAgB,gCAmClB,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ToastMessageType } from '../components/Toast';
|
|
2
|
+
export interface ToastOptions {
|
|
3
|
+
title: string;
|
|
4
|
+
message: string;
|
|
5
|
+
/** @default 'error' */
|
|
6
|
+
type?: ToastMessageType;
|
|
7
|
+
/** Accessible name of the dismiss button @default 'Dismiss notification' */
|
|
8
|
+
buttonText?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ToastContextValue {
|
|
11
|
+
showToast: (options: ToastOptions) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const ToastContext: import('react').Context<ToastContextValue | null>;
|
|
14
|
+
//# sourceMappingURL=ToastContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastContext.d.ts","sourceRoot":"","sources":["../../../src/react/contexts/ToastContext.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAE3D,MAAM,WAAW,YAAY;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,uBAAuB;IACvB,IAAI,CAAC,EAAE,gBAAgB,CAAA;IACvB,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,iBAAiB;IAC9B,SAAS,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAA;CAC7C;AAED,eAAO,MAAM,YAAY,mDAAgD,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface ToastProviderProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
/** How long a toast stays before dismissing itself, in ms @default 5000 */
|
|
5
|
+
autoHideDuration?: number;
|
|
6
|
+
}
|
|
7
|
+
/** Renders the toasts raised through `useToast()` and `useErrorToast()`. Mount it once, near the app root */
|
|
8
|
+
export declare const ToastProvider: ({ children, autoHideDuration, }: ToastProviderProps) => import('react').JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=ToastProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../../../src/react/contexts/ToastProvider.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA0C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAS9E,UAAU,kBAAkB;IACxB,QAAQ,EAAE,SAAS,CAAA;IACnB,2EAA2E;IAC3E,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED,6GAA6G;AAC7G,eAAO,MAAM,aAAa,GAAI,iCAG3B,kBAAkB,gCA8CpB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ErrorToastFallback } from '../../internal/error-toast';
|
|
2
|
+
export type { ErrorToastFallback };
|
|
3
|
+
/**
|
|
4
|
+
* Returns a function that shows an error toast for any thrown value, the
|
|
5
|
+
* replacement for `handleErrorToast`. JSON-RPC errors get a readable title
|
|
6
|
+
*/
|
|
7
|
+
export declare const useErrorToast: () => ((e: unknown, fallback?: ErrorToastFallback) => void);
|
|
8
|
+
//# sourceMappingURL=useErrorToast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useErrorToast.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useErrorToast.ts"],"names":[],"mappings":"AAIA,OAAO,EAEH,KAAK,kBAAkB,EAC1B,MAAM,4BAA4B,CAAA;AAGnC,YAAY,EAAE,kBAAkB,EAAE,CAAA;AAElC;;;GAGG;AACH,eAAO,MAAM,aAAa,QAAO,CAAC,CAC9B,CAAC,EAAE,OAAO,EACV,QAAQ,CAAC,EAAE,kBAAkB,KAC5B,IAAI,CAQR,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToast.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useToast.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE/E,2DAA2D;AAC3D,eAAO,MAAM,QAAQ,QAAO,iBAM3B,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("@mui/material"),u=require("react"),oe=require("@mui/icons-material/Menu"),Q=require("@mui/icons-material/ContentCopy"),P=require("../activity-utils-CsiZsTG2.cjs"),le=require("@mui/icons-material/ChevronLeft"),ce=require("@mui/icons-material/WarningAmber"),Z=require("@mui/icons-material/ArrowBack"),ee=require("@mui/icons-material/Refresh"),te=require("@mui/material/styles"),de=require("@mui/icons-material/ArrowForward"),ue=require("@mui/icons-material/ExpandMore"),y=({label:i,value:n,title:s=typeof n=="string"?n:void 0,muted:o=!1,action:a})=>{const r=typeof n=="string";return e.jsxs(t.Box,{sx:{display:"flex",alignItems:"center",gap:2,minWidth:0,minHeight:40},children:[e.jsx(t.Typography,{variant:"body2",noWrap:!0,sx:{fontWeight:"bold",flexShrink:0,minWidth:"8rem"},children:i}),e.jsx(t.Typography,{variant:"body2",component:"div",noWrap:r,title:r?s:void 0,color:o?"text.secondary":"text.primary",sx:{flex:1,minWidth:0,textAlign:"right",...!r&&{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"flex-end",gap:.5}},children:n}),a&&e.jsx(t.Box,{sx:{position:"relative",zIndex:1,flexShrink:0},children:a})]})},he=({apiKey:i,onRevoke:n})=>e.jsxs(t.Card,{children:[e.jsxs(t.CardContent,{children:[e.jsx(t.Typography,{variant:"body1",sx:{mb:2,fontWeight:"bold"},children:i.name}),e.jsxs(t.Stack,{spacing:1,children:[e.jsx(y,{label:"ID",value:i.id}),e.jsx(y,{label:"Created At",value:i.createdAt})]})]}),e.jsx(t.Divider,{}),e.jsx(t.CardActions,{children:e.jsx(t.Button,{color:"error",onClick:()=>n(i),children:"Revoke"})})]}),Y=()=>e.jsx(t.CircularProgress,{size:16,color:"inherit","aria-hidden":"true"}),N=({onApprove:i,onReject:n,approveLabel:s="Approve",approving:o=!1,rejecting:a=!1,signing:r=!1,disabled:l=!1})=>e.jsxs(t.Stack,{direction:"row",spacing:2,children:[n&&e.jsx(t.Button,{variant:"outlined",color:"error",fullWidth:!0,disabled:l||o||a,startIcon:a?e.jsx(Y,{}):void 0,onClick:n,children:"Reject"}),e.jsx(t.Button,{variant:"contained",fullWidth:!0,disabled:l||o||a||r,startIcon:o||r?e.jsx(Y,{}):void 0,onClick:i,children:s})]}),xe=({onGenerate:i})=>{const[n,s]=u.useState(""),o=a=>{a.preventDefault(),i({name:n})};return e.jsxs(t.Box,{component:"form",onSubmit:o,sx:{display:"flex",flexDirection:"column",height:"100%"},children:[e.jsx(t.Stack,{spacing:2,children:e.jsx(t.TextField,{label:"Name",required:!0,fullWidth:!0,value:n,onChange:a=>s(a.target.value)})}),e.jsx(t.Box,{sx:{mt:"auto",pt:3},children:e.jsx(t.Button,{type:"submit",variant:"contained",fullWidth:!0,children:"Generate"})})]})},ie=({online:i})=>e.jsx(t.Box,{sx:{display:"inline-block",flexShrink:0,width:"10px",height:"10px",borderRadius:"50%",bgcolor:i?"success.main":"text.disabled"}}),pe=[{label:"Parties",href:"/parties/"},{label:"Activities",href:"/activities/"},{label:"Networks",href:"/networks/"},{label:"API Keys",href:"/api-keys/"},{label:"Identity Providers",href:"/identity-providers/"}],me=({iconSrc:i=P.cantonLogo,networkName:n="No network connected",networkConnected:s=!1,dappApiUrl:o,homeHref:a="/",navItems:r,onLogout:l,onDappApiUrlCopy:c})=>{const[h,p]=u.useState(null),j=!!h,S=u.useId(),m=()=>p(null),k=t.useTheme().components?.MuiButtonBase?.defaultProps?.LinkComponent??"a";return e.jsxs(t.AppBar,{position:"sticky",color:"default",children:[e.jsxs(t.Toolbar,{sx:{display:"grid",gridTemplateColumns:"minmax(max-content, 1fr) minmax(0, auto) minmax(max-content, 1fr)",alignItems:"center",gap:1},children:[e.jsx(t.IconButton,{href:a,"aria-label":"Go to home",sx:{justifySelf:"start",p:.5},children:e.jsx(t.Box,{component:"img",src:i,alt:"",sx:{height:30,display:"block"}})}),e.jsxs(t.Box,{title:n,"data-testid":`network-status-${s?"connected":"disconnected"}`,sx:{display:"flex",alignItems:"center",gap:1,minWidth:0,maxWidth:"min(52vw, 420px)"},children:[e.jsx(ie,{online:s}),e.jsx(t.Typography,{variant:"subtitle1",noWrap:!0,children:n})]}),e.jsx(t.IconButton,{"aria-label":"menu","aria-controls":j?S:void 0,"aria-haspopup":"true","aria-expanded":j?"true":void 0,onClick:f=>p(f.currentTarget),sx:{justifySelf:"end"},children:e.jsx(oe,{})})]}),e.jsxs(t.Menu,{id:S,anchorEl:h,open:j,onClose:m,children:[r.map(({label:f,href:g})=>e.jsx(t.MenuItem,{component:k,href:g,onClick:m,children:f},g)),c&&e.jsxs(t.MenuItem,{title:o||"Copy dApp API URL","aria-label":o?`Copy dApp API URL: ${o}`:"Copy dApp API URL",onClick:()=>{m(),c()},children:[e.jsx(t.ListItemText,{children:"Dapp API URL"}),e.jsx(t.ListItemIcon,{sx:{justifyContent:"flex-end"},children:e.jsx(Q,{fontSize:"small"})})]}),e.jsx(t.Divider,{}),e.jsx(t.MenuItem,{onClick:()=>{m(),l()},children:"Logout"})]})]})},ve=["authorization_code","client_credentials","self_signed","self_issued"],R=i=>typeof i?.method=="string",je=i=>{switch(i){case"authorization_code":return{method:i,clientId:"",audience:"",scope:""};case"client_credentials":return{method:i,clientId:"",audience:"",scope:"",clientSecret:""};case"self_issued":return{method:i,audience:"",scope:""};case"self_signed":return{method:i,clientId:"",audience:"",scope:"",issuer:"",clientSecret:""}}},ye=i=>i?"********":"(not set)",ge=i=>{const n=[{key:"Method",value:i.method},{key:"Audience",value:i.audience??""},{key:"Scope",value:i.scope??""}];return"clientId"in i&&n.splice(1,0,{key:"Client Id",value:i.clientId??""}),"issuer"in i&&n.push({key:"Issuer",value:i.issuer??""}),"clientSecret"in i&&n.push({key:"Client Secret",value:ye(i.clientSecret)}),i.method==="client_credentials"&&i.identityProviderId&&n.push({key:"Identity Provider Id",value:i.identityProviderId}),n},fe=(i,n)=>{const s="clientId"in i?i.clientId:"",o=i.audience??"",a=i.scope??"";switch(n){case"authorization_code":return{method:n,clientId:s,audience:o,scope:a};case"self_signed":return{method:n,clientId:s,audience:o,scope:a,issuer:i.issuer??"",clientSecret:i.clientSecret??""};case"self_issued":return{method:n,audience:o,scope:a};case"client_credentials":return{method:n,...i.method==="client_credentials"&&i.identityProviderId?{identityProviderId:i.identityProviderId}:{},clientId:s,audience:o,scope:a,clientSecret:i.clientSecret??""};default:throw new Error(`Unsupported auth method: ${String(n)}`)}},L=({label:i,testId:n,value:s,onChange:o,required:a=!1,placeholder:r,helperText:l})=>e.jsx(t.TextField,{label:i,required:a,fullWidth:!0,value:s,placeholder:r,helperText:l,onChange:c=>o(c.target.value),slotProps:{htmlInput:{"data-test-id":n}}}),ne=({auth:i,onChange:n,allowedMethods:s=ve,optional:o=!1,label:a="auth"})=>{const r=`No ${a} configured.`,l=`${a.charAt(0).toUpperCase()}${a.slice(1)} will be removed after submitting this form.`,[c,h]=u.useState(()=>o?R(i)?"view":"none":"edit"),[p,j]=u.useState(),[S,m]=u.useState(""),k=()=>{m(""),h("add")},f=()=>{i&&j(structuredClone(i)),m(""),h("edit")},g=()=>{i&&j(structuredClone(i)),n(void 0),h("pending-remove")},W=()=>{p?(n(structuredClone(p)),h("view")):h(o?"none":"edit")},T=()=>{p?(n(structuredClone(p)),h("view")):(n(void 0),h(o?"none":"edit")),m("")},B=e.jsxs(t.Stack,{spacing:1,"data-test-id":"auth-editor-empty-state",children:[e.jsx(t.Typography,{variant:"body2",color:"text.secondary","data-test-id":"auth-editor-empty-text",children:r}),e.jsx(t.Box,{children:e.jsx(t.Button,{size:"small","data-test-id":"auth-editor-add-button",onClick:k,children:"Add"})})]});if(c==="none")return B;if(c==="pending-remove")return e.jsxs(t.Stack,{spacing:1,"data-test-id":"auth-editor-pending-remove-state",children:[e.jsx(t.Alert,{severity:"warning","data-test-id":"auth-editor-pending-remove-text",children:l}),e.jsx(t.Box,{children:e.jsx(t.Button,{size:"small","data-test-id":"auth-editor-cancel-remove-button",onClick:W,children:"Cancel"})})]});if(c==="view"&&R(i))return e.jsxs(t.Stack,{spacing:1,"data-test-id":"auth-editor-view-state",children:[e.jsx(t.Box,{component:"dl","data-test-id":"auth-editor-summary-list",sx:{m:0},children:ge(i).map(C=>e.jsxs(t.Box,{"data-test-id":"auth-editor-summary-row",sx:{display:"flex",gap:2,minHeight:32,alignItems:"center"},children:[e.jsx(t.Typography,{component:"dt",variant:"body2",noWrap:!0,sx:{fontWeight:"bold",flexShrink:0,minWidth:"8rem"},children:C.key}),e.jsx(t.Typography,{component:"dd",variant:"body2",noWrap:!0,title:C.value,sx:{m:0,flex:1,minWidth:0,textAlign:"right"},children:C.value})]},C.key))}),e.jsxs(t.Stack,{direction:"row",spacing:1,children:[e.jsx(t.Button,{size:"small","data-test-id":"auth-editor-edit-button",onClick:f,children:"Edit"}),e.jsx(t.Button,{size:"small",color:"error","data-test-id":"auth-editor-remove-button",onClick:g,children:"Remove"})]})]});const d=R(i)?i:je(s[0]??"authorization_code"),I=d.method,x=C=>n({...d,...C}),b=p&&"clientSecret"in p?p.clientSecret:void 0,w="clientSecret"in d?d.clientSecret:void 0,D=S.trim()===""&&c!=="add"&&(typeof w=="string"&&w!==""||typeof b=="string"&&b.length>0),A=C=>{m(C);let z;C.trim()!==""?z=C:c==="add"?z="":typeof b=="string"?z=b:z=w??"",x({clientSecret:z})},v=C=>{const z=C.trim(),{identityProviderId:Ve,...G}=d;n(z?{...G,identityProviderId:z}:G)},_="clientId"in d&&e.jsx(L,{label:"Client Id",testId:"auth-editor-client-id-input",required:!0,value:d.clientId??"",onChange:C=>x({clientId:C})}),K=e.jsx(L,{label:"Client Secret",testId:"auth-editor-client-secret-input",required:!D,value:S,placeholder:D?"********":"",helperText:D?e.jsx("span",{"data-test-id":"auth-editor-secret-help",children:"Current secret is hidden. Enter a new value to replace it."}):void 0,onChange:A});return e.jsxs(e.Fragment,{children:[e.jsxs(t.Stack,{spacing:2,"data-test-id":"auth-editor-edit-state",children:[e.jsxs(t.TextField,{select:!0,label:"Method",required:!0,fullWidth:!0,value:I,onChange:C=>n(fe(d,C.target.value)),slotProps:{select:{native:!0},htmlInput:{"data-test-id":"auth-editor-method-select"}},children:[!s.includes(I)&&e.jsx("option",{value:I,disabled:!0,children:I}),s.map(C=>e.jsx("option",{value:C,children:C},C))]}),e.jsx(L,{label:"Audience",testId:"auth-editor-audience-input",required:!0,value:d.audience??"",onChange:C=>x({audience:C})}),e.jsx(L,{label:"Scope",testId:"auth-editor-scope-input",required:!0,value:d.scope??"",onChange:C=>x({scope:C})}),I==="authorization_code"&&_,I==="client_credentials"&&e.jsxs(e.Fragment,{children:[_,e.jsx(L,{label:"Identity Provider Id Override",testId:"auth-editor-identity-provider-id-input",value:d.identityProviderId??"",helperText:"Optional. Uses the network identity provider when empty.",onChange:v}),K]}),I==="self_signed"&&e.jsxs(e.Fragment,{children:[_,e.jsx(L,{label:"Issuer",testId:"auth-editor-issuer-input",required:!0,value:d.issuer??"",onChange:C=>x({issuer:C})}),K]}),!["authorization_code","client_credentials","self_signed","self_issued"].includes(I)&&e.jsxs(t.Alert,{severity:"warning","data-test-id":"auth-editor-unsupported-method-warning",children:['Unsupported auth method "',I,'". Select a supported method to continue.']})]}),o&&e.jsx(t.Box,{sx:{mt:1},children:e.jsx(t.Button,{size:"small","data-test-id":"auth-editor-cancel-edit-button",onClick:T,children:"Cancel"})})]})},O=({label:i="Back",href:n,onClick:s})=>e.jsx(t.Button,{color:"inherit",size:"small",startIcon:e.jsx(le,{}),...n!==void 0?{href:n}:{onClick:s},children:i}),be=P.getLogger(["core","wallet-ui-components/react"]),E=({onCopy:i,value:n,label:s="Copy to clipboard"})=>{const[o,a]=u.useState(!1),r=u.useRef(void 0);return u.useEffect(()=>()=>clearTimeout(r.current),[]),e.jsx(t.Tooltip,{title:o?"Copied":s,children:e.jsx(t.IconButton,{"aria-label":s,onClick:async l=>{if(l.stopPropagation(),!!n)try{if(navigator.clipboard?.writeText)await navigator.clipboard.writeText(n);else throw new Error("Browser does not support clipboard functionality.");i!==void 0&&i(n),clearTimeout(r.current),r.current=setTimeout(()=>a(!1),1200),a(!0)}catch(c){be.getChild("CopyButton").error("Unable to copy value",{error:c})}},children:e.jsx(Q,{color:o?"success":"inherit"})})})},Ce=({mode:i,title:n="Something went wrong",message:s="An unexpected error occurred while loading this page.",onAction:o})=>e.jsx(t.Paper,{children:e.jsxs(t.Stack,{sx:{justifyContent:"center",alignItems:"center",p:4},children:[e.jsx(t.Box,{children:e.jsx(ce,{color:"error"})}),e.jsxs(t.Box,{children:[e.jsx(t.Typography,{variant:"h5",component:"h1",children:n}),e.jsx(t.Typography,{variant:"body1",children:s})]}),e.jsx(t.Box,{sx:{mt:4},children:e.jsx(t.Button,{variant:"contained",color:"primary",startIcon:i==="back"?e.jsx(Z,{}):e.jsx(ee,{}),onClick:o,children:i==="back"?"Back":"Refresh"})})]})}),Se=({idp:i,onReview:n})=>{const s="configUrl"in i?i.configUrl:"";return e.jsx(t.Card,{component:"article","data-testid":"idp-card",variant:"outlined",sx:{position:"relative",...n&&{"&:hover":{borderColor:"primary.main",boxShadow:2}}},children:e.jsxs(t.CardContent,{children:[e.jsx(t.Box,{sx:{mb:1},children:n?e.jsx(t.Link,{component:"button",type:"button",variant:"body1",color:"inherit",underline:"none",onClick:()=>n(i),sx:{fontWeight:"bold",textAlign:"left",position:"static","&::after":{content:'""',position:"absolute",inset:0,cursor:"pointer"}},children:i.id}):e.jsx(t.Typography,{variant:"body1",sx:{fontWeight:"bold"},children:i.id})}),e.jsxs(t.Stack,{spacing:.5,children:[e.jsx(y,{label:"Type",value:i.type}),"issuer"in i&&e.jsx(y,{label:"Issuer",value:i.issuer,action:e.jsx(E,{value:i.issuer,label:"Copy issuer URL"})}),s&&e.jsx(y,{label:"Config URL",value:s,action:e.jsx(E,{value:s,label:"Copy config URL"})})]})]})})},Ie={id:"",type:"oauth",issuer:"",configUrl:""},J=i=>"issuer"in i?i.issuer:"",V=i=>"configUrl"in i?i.configUrl:"",ke=({idp:i,loading:n=!1,onSave:s,onDelete:o,onCancel:a})=>{const r=i??Ie,[l,c]=u.useState(r.id),[h,p]=u.useState(r.type),[j,S]=u.useState(J(r)),[m,k]=u.useState(V(r)),[f,g]=u.useState(""),[W,T]=u.useState(i);i!==W&&(T(i),c(r.id),p(r.type),S(J(r)),k(V(r)),g(""));const B=d=>{if(d.preventDefault(),!l||h!=="self_issued"&&!j||h==="oauth"&&!m){g("Please fill in all required fields");return}switch(g(""),h){case"oauth":s({id:l,type:h,issuer:j,configUrl:m});break;case"self_signed":s({id:l,type:h,issuer:j});break;case"self_issued":s({id:l,type:h});break}};return e.jsxs(t.Box,{component:"form",onSubmit:B,sx:{display:"flex",flexDirection:"column",height:"100%"},children:[e.jsxs(t.Stack,{spacing:2,children:[e.jsx(t.TextField,{id:"idp-id",label:"ID",required:!0,fullWidth:!0,placeholder:"Enter the identity provider ID",helperText:"A unique identifier for the identity provider",disabled:n,value:l,onChange:d=>c(d.target.value)}),e.jsxs(t.TextField,{id:"idp-type",select:!0,label:"Type",required:!0,fullWidth:!0,disabled:n,value:h,onChange:d=>p(d.target.value),slotProps:{select:{native:!0}},children:[e.jsx("option",{value:"oauth",children:"oauth"}),e.jsx("option",{value:"self_signed",children:"self_signed"}),e.jsx("option",{value:"self_issued",children:"self_issued"})]}),h!=="self_issued"&&e.jsx(t.TextField,{id:"idp-issuer",label:"Issuer URL",required:!0,fullWidth:!0,placeholder:"Enter the issuer URL",disabled:n,value:j,onChange:d=>S(d.target.value)}),h==="oauth"&&e.jsx(t.TextField,{id:"idp-config-url",label:"Config URL",required:!0,fullWidth:!0,placeholder:"Enter the configuration URL",disabled:n,value:m,onChange:d=>k(d.target.value)})]}),f&&e.jsx(t.Alert,{severity:"error",sx:{mt:2},children:f}),i?e.jsxs(e.Fragment,{children:[o&&e.jsxs(t.Box,{sx:{mt:4},children:[e.jsx(t.Divider,{sx:{mb:3}}),e.jsx(t.Typography,{variant:"subtitle1",component:"h2",sx:{fontWeight:"bold",mb:1},children:"Delete identity provider"}),e.jsx(t.Typography,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"You will not be able to undo the change once you delete this Identity Provider."}),e.jsx(t.Button,{variant:"outlined",color:"error",onClick:()=>o(i),children:"Delete identity provider"})]}),e.jsxs(t.Stack,{direction:"row",spacing:2,sx:{mt:3},children:[a&&e.jsx(t.Button,{variant:"outlined",color:"inherit",fullWidth:!0,onClick:a,children:"Cancel"}),e.jsx(t.Button,{type:"submit",variant:"contained",fullWidth:!0,disabled:n,children:"Update"})]})]}):e.jsx(t.Box,{sx:{mt:"auto",pt:3},children:e.jsx(t.Button,{type:"submit",variant:"contained",fullWidth:!0,disabled:n,children:"Add"})})]})},Ae=te.keyframes`
|
|
2
|
+
0%, 80%, 100% {
|
|
3
|
+
transform: scale(0.7);
|
|
4
|
+
opacity: 0.4;
|
|
5
|
+
}
|
|
6
|
+
40% {
|
|
7
|
+
transform: scale(1);
|
|
8
|
+
opacity: 1;
|
|
9
|
+
}
|
|
10
|
+
`,Te=({text:i="Loading"})=>e.jsxs(t.Stack,{role:"status","aria-live":"polite",spacing:2,sx:{minHeight:180,justifyContent:"center",alignItems:"center",p:3},children:[e.jsx(t.Stack,{direction:"row",spacing:1,"aria-hidden":"true",children:[0,1,2].map(n=>e.jsx(t.Box,{sx:{width:8,height:8,borderRadius:"50%",bgcolor:"primary.main",animation:`${Ae} 1s infinite ease-in-out`,animationDelay:`${n*.15}s`,"@media (prefers-reduced-motion: reduce)":{animation:"none"}}},n))}),e.jsx(t.Typography,{variant:"body1",color:"text.secondary",children:i})]}),q=i=>i.authMethod!=="client_credentials",Be=({networks:i,idps:n,loading:s=!1,connecting:o=!1,message:a=null,onConnect:r})=>{const[l,c]=u.useState(),[h,p]=u.useState(null),[j,S]=u.useState(""),[m,k]=u.useState(""),[f,g]=u.useState(null),[W,T]=u.useState(null),B=i.find(v=>v.id===l),d=l===null?null:B&&q(B)?B:i.find(q)??null,I=n.find(v=>v.id===d?.identityProviderId)??null,x=I?.type==="self_issued"||d?.authMethod==="self_issued",b=!x&&I?.type==="self_signed",w=f?{type:"error",text:f}:a&&a!==W?a:null,D=v=>{c(v===""?null:v),p(null),g(null),T(a)},A=v=>{if(v.preventDefault(),g(null),T(a),!d){g("Please select a network before connecting.");return}if(!I){g("Identity provider misconfigured for this network.");return}I.type==="self_signed"?r(d,I,h||d.clientId,j):I.type==="self_issued"?r(d,I,void 0,void 0,m.trim()):r(d,I)};return e.jsxs(t.Box,{component:"form",onSubmit:A,sx:{minHeight:"100dvh",display:"flex",flexDirection:"column"},children:[e.jsx(t.Box,{sx:{height:44,display:"flex",alignItems:"center",px:2,borderBottom:1,borderColor:"divider"},children:e.jsx("img",{src:P.cantonLogo,alt:"Canton logo",width:24,height:24,style:{objectFit:"contain"}})}),e.jsxs(t.Stack,{spacing:2,sx:{flex:1,px:2,pt:2},children:[e.jsx(t.Typography,{variant:"h5",component:"h1",sx:{fontWeight:"bold"},children:"Wallet Gateway"}),e.jsxs(t.TextField,{select:!0,fullWidth:!0,label:"Select a network",value:d?.id??"",disabled:s||o,onChange:v=>D(v.target.value),slotProps:{select:{native:!0},inputLabel:{shrink:!0}},children:[e.jsx("option",{value:"",children:"Select network"}),i.map(v=>e.jsx("option",{value:v.id,disabled:!q(v),children:v.name},v.id))]}),x&&e.jsx(t.TextField,{fullWidth:!0,required:!0,label:"Username",autoComplete:"username",value:m,disabled:o,onChange:v=>k(v.target.value)}),b&&e.jsxs(e.Fragment,{children:[e.jsx(t.TextField,{fullWidth:!0,label:"Client ID",autoComplete:"username",value:h??d?.clientId??"",disabled:o,onChange:v=>p(v.target.value)}),e.jsx(t.TextField,{fullWidth:!0,label:"Client Secret",type:"password",autoComplete:"current-password",value:j,disabled:o,onChange:v=>S(v.target.value)})]}),w?e.jsx(t.Alert,{severity:w.type,children:w.text}):e.jsx(t.Typography,{variant:"body2",color:"text.secondary",children:s?"Loading networks...":d?`Selected: ${d.name}`:"Choose a network to continue."})]}),e.jsx(t.Box,{sx:{p:2},children:e.jsx(t.Button,{type:"submit",variant:"contained",size:"large",fullWidth:!0,disabled:s||o||!d,children:o?"Connecting…":"Connect"})})]})},Pe=({messageId:i,message:n,status:s,origin:o=null,externalTxId:a=null,backHref:r,approving:l=!1,rejecting:c=!1,signing:h=!1,disabled:p=!1,onApprove:j,onReject:S})=>e.jsxs(t.Stack,{spacing:2,children:[e.jsxs(t.Stack,{direction:"row",sx:{alignItems:"center",justifyContent:"space-between"},children:[e.jsx(t.Typography,{variant:"h5",component:"h1",children:"Message Details"}),r&&e.jsx(O,{href:r})]}),e.jsxs(t.Stack,{spacing:.5,children:[e.jsx(y,{label:"Status",value:e.jsx(t.Chip,{"data-testid":"activity-status",label:P.getActivityStatusLabel(s),color:P.getActivityStatusColor(s),size:"small"})}),o&&e.jsx(y,{label:"Requested by",value:o}),a&&e.jsx(y,{label:"External transaction ID",value:a,action:e.jsx(E,{value:a,label:"Copy external transaction ID"})}),e.jsxs(t.Box,{children:[e.jsx(t.Typography,{variant:"body2",component:"h2",sx:{fontWeight:"bold",py:1},children:"Message"}),e.jsx(t.Box,{component:"pre",sx:{m:0,p:1.5,overflow:"auto",whiteSpace:"pre-wrap",bgcolor:"action.hover",borderRadius:1,fontSize:"0.8125rem"},children:n})]})]}),s==="pending"&&e.jsx(N,{approving:l,rejecting:c,signing:h,disabled:p,onApprove:()=>j(i),onReject:S&&(()=>S(i))})]}),We=({network:i,activeSession:n=!1,accessToken:s="",onReview:o})=>{const a=i.synchronizerId??"";return e.jsx(t.Card,{component:"article","data-testid":"network-card",variant:"outlined",sx:{position:"relative",...o&&{"&:hover":{borderColor:"primary.main",boxShadow:2}}},children:e.jsxs(t.CardContent,{children:[e.jsxs(t.Stack,{direction:"row",spacing:1,sx:{alignItems:"center",mb:1},children:[o?e.jsx(t.Link,{component:"button",type:"button",variant:"body1",color:"inherit",underline:"none",onClick:()=>o(i),sx:{fontWeight:"bold",textAlign:"left",position:"static","&::after":{content:'""',position:"absolute",inset:0,cursor:"pointer"}},children:i.name}):e.jsx(t.Typography,{variant:"body1",sx:{fontWeight:"bold"},children:i.name}),n&&e.jsx(t.Chip,{label:"CONNECTED",color:"success",size:"small"})]}),e.jsxs(t.Stack,{spacing:.5,children:[e.jsx(y,{label:"ID",value:i.id}),n&&e.jsx(y,{label:"Access Token",value:"[private]",muted:!0,action:e.jsx(E,{value:s,label:"Copy access token"})}),e.jsx(y,{label:"Auth",value:i.authMethod}),a&&e.jsx(y,{label:"Synchronizer",value:a,action:e.jsx(E,{value:a,label:"Copy synchronizer ID"})}),i.identityProviderId&&e.jsx(y,{label:"Identity provider",value:i.identityProviderId})]})]})})},M=u.memo(ne),we=["client_credentials"],De={id:"",name:"",description:"",identityProviderId:"",ledgerApi:"",auth:{method:"authorization_code",audience:"",scope:"",clientId:""}},Ee=i=>{try{return new URL(i),!0}catch{return!1}},X=i=>({synchronizerId:!i.synchronizerId||i.synchronizerId.includes("::")&&i.synchronizerId.length>=10?void 0:'Must contain "::" and be at least 10 characters',ledgerApi:Ee(i.ledgerApi)?void 0:"Must be a valid URL"}),U=({title:i,children:n})=>{const s=u.useId();return e.jsxs(t.Box,{component:"section","aria-labelledby":s,children:[e.jsx(t.Typography,{id:s,variant:"subtitle1",component:"h3",sx:{fontWeight:"bold",mb:1},children:i}),n]})},ze=({network:i,onSave:n,onDelete:s,onCancel:o})=>{const a=i??De,[r,l]=u.useState(a),[c,h]=u.useState(i),[p,j]=u.useState(0),[S,m]=u.useState(!1);i!==c&&(h(i),l(a),j(x=>x+1),m(!1));const k=S?X(r):{synchronizerId:void 0,ledgerApi:void 0},f=Object.values(k).some(Boolean),g=x=>l(b=>({...b,...x})),W=u.useCallback(x=>{x&&l(b=>({...b,auth:x}))},[]),T=u.useCallback((x,b)=>l(w=>{const D={...w};return delete D[x],b?{...D,[x]:b}:D}),[]),B=u.useCallback(x=>T("adminAuth",x),[T]),d=u.useCallback(x=>T("serviceAccountAuth",x),[T]),I=x=>{x.preventDefault(),m(!0),!Object.values(X(r)).some(Boolean)&&n(r)};return e.jsxs(t.Box,{component:"form",onSubmit:I,sx:{display:"flex",flexDirection:"column",height:"100%"},children:[e.jsxs(t.Stack,{spacing:2,children:[e.jsx(t.TextField,{label:"Network Id",required:!0,fullWidth:!0,helperText:"A unique identifier for the network",value:r.id,onChange:x=>g({id:x.target.value})}),e.jsx(t.TextField,{label:"Name",required:!0,fullWidth:!0,value:r.name,onChange:x=>g({name:x.target.value})}),e.jsx(t.TextField,{label:"Description",required:!0,fullWidth:!0,value:r.description,onChange:x=>g({description:x.target.value})}),e.jsx(t.TextField,{label:"Synchronizer Id",fullWidth:!0,error:!!k.synchronizerId,helperText:k.synchronizerId,value:r.synchronizerId??"",onChange:x=>{const b={...r};x.target.value?b.synchronizerId=x.target.value:delete b.synchronizerId,l(b)}}),e.jsx(t.TextField,{label:"Identity Provider Id",required:!0,fullWidth:!0,value:r.identityProviderId,onChange:x=>g({identityProviderId:x.target.value})}),e.jsx(t.TextField,{label:"Ledger API Base Url",required:!0,fullWidth:!0,error:!!k.ledgerApi,helperText:k.ledgerApi,value:r.ledgerApi,onChange:x=>g({ledgerApi:x.target.value})}),e.jsx(U,{title:"Configure user auth",children:e.jsx(M,{auth:r.auth,onChange:W},p)}),e.jsx(U,{title:"Configure admin auth",children:e.jsx(M,{auth:r.adminAuth,optional:!0,label:"admin auth",onChange:B},p)}),e.jsx(U,{title:"Configure service account auth",children:e.jsx(M,{auth:r.serviceAccountAuth,allowedMethods:we,optional:!0,label:"service account auth",onChange:d},p)})]}),f&&e.jsx(t.Alert,{severity:"error",sx:{mt:2},children:"Invalid network data, please ensure all fields are set correctly"}),i?e.jsxs(e.Fragment,{children:[s&&e.jsxs(t.Box,{sx:{mt:4},children:[e.jsx(t.Divider,{sx:{mb:3}}),e.jsx(t.Typography,{variant:"subtitle1",component:"h2",sx:{fontWeight:"bold",mb:1},children:"Delete network"}),e.jsx(t.Typography,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"You will not be able to undo the change once you delete this network."}),e.jsx(t.Button,{variant:"outlined",color:"error",onClick:()=>s(i),children:"Delete Network"})]}),e.jsxs(t.Stack,{direction:"row",spacing:2,sx:{mt:3},children:[o&&e.jsx(t.Button,{variant:"outlined",color:"inherit",fullWidth:!0,onClick:o,children:"Cancel"}),e.jsx(t.Button,{type:"submit",variant:"contained",fullWidth:!0,"data-test-id":"update-network-button",children:"Update"})]})]}):e.jsx(t.Box,{sx:{mt:"auto",pt:3},children:e.jsx(t.Button,{type:"submit",variant:"contained",fullWidth:!0,"data-test-id":"add-network-button",children:"Add"})})]})},Le=({total:i,pageSize:n=5,page:s=1,onPageChange:o})=>{const a=Math.max(n,1),r=Math.max(1,Math.ceil(i/a)),l=Math.min(Math.max(s,1),r),c=i>0?(l-1)*a+1:0,h=i>0?Math.min(c+a-1,i):0;return e.jsxs(t.Stack,{component:"nav","aria-label":"Pagination",direction:"row",spacing:1,sx:{alignItems:"center",display:"inline-flex"},children:[e.jsx(t.IconButton,{size:"small","aria-label":"Previous page",disabled:l<=1,onClick:()=>o(l-1),children:e.jsx(Z,{fontSize:"small"})}),e.jsxs(t.Typography,{variant:"body2",component:"span",children:[c,"-",h," of ",i]}),e.jsx(t.IconButton,{size:"small","aria-label":"Next page",disabled:l>=r,onClick:()=>o(l+1),children:e.jsx(de,{fontSize:"small"})})]})},H=({signingProviders:i,value:n,onChange:s,disabled:o=!1,disabledProviders:a=[]})=>{const r=i===void 0,l=i?.length===0;return e.jsxs(t.TextField,{id:"signing-provider-id",select:!0,label:"Signing Provider",required:!0,fullWidth:!0,value:n,disabled:o||r||l,onChange:c=>s(c.target.value),slotProps:{select:{native:!0},inputLabel:{shrink:!0}},children:[e.jsx("option",{value:"",disabled:!0,children:r?"Loading signing providers...":l?"No signing providers available":"Select signing provider"}),i?.map(c=>e.jsx("option",{value:c,disabled:a.includes(c),children:c},c))]})},se=({title:i,message:n,type:s="error",buttonText:o="Dismiss notification",autoHideDuration:a,onExited:r})=>{const[l,c]=u.useState(!0);return e.jsx(t.Snackbar,{open:l,autoHideDuration:a,onClose:(h,p)=>{p!=="clickaway"&&c(!1)},slotProps:{transition:{onExited:()=>r?.()}},sx:{position:"static",pointerEvents:"auto"},children:e.jsxs(t.Alert,{role:s==="error"?"alert":"status",severity:s,closeText:o,onClose:()=>c(!1),sx:{width:"100%"},children:[e.jsx(t.AlertTitle,{children:i}),n]})})},Fe=({transactionId:i,commandId:n,externalTxId:s=null,status:o,parsed:a=null,createdAt:r=null,loading:l=!1,onReview:c})=>{const h=P.getActivityType(a),p=P.getActivityAmount(a),j=P.formatActivityDate(r);return e.jsx(t.Card,{variant:"outlined","data-testid":"transaction-card",children:e.jsx(t.CardActionArea,{disabled:l,"aria-label":`Open activity ${n}`,onClick:()=>c(i,n),children:e.jsx(t.CardContent,{children:e.jsxs(t.Stack,{spacing:.5,children:[e.jsx(y,{label:"Command ID",value:n}),s&&e.jsx(y,{label:"External transaction ID",value:s}),e.jsx(y,{label:"Status",value:e.jsx(t.Chip,{"data-testid":"activity-status",label:P.getActivityStatusLabel(o),color:P.getActivityStatusColor(o),size:"small"})}),e.jsx(y,{label:"Action type",value:h}),e.jsx(y,{label:"Created at",value:j}),e.jsx(y,{label:"Amount",value:p})]})})})})},F=({label:i,value:n,copyLabel:s})=>e.jsx(y,{label:i,value:n||"N/A",action:n?e.jsx(E,{value:n,label:s}):void 0}),_e=({commandId:i,externalTxId:n=null,status:s,txHash:o,parsed:a=null,createdAt:r=null,backHref:l,approving:c=!1,rejecting:h=!1,signing:p=!1,submitFailed:j=!1,disabled:S=!1,onApprove:m,onReject:k})=>{const[f,g]=u.useState(!1),W=a?.signatories??[],T=a?.jsonString,B=s==="pending"||s==="signed";return e.jsxs(t.Stack,{spacing:2,children:[e.jsxs(t.Stack,{direction:"row",sx:{alignItems:"center",justifyContent:"space-between"},children:[e.jsx(t.Typography,{variant:"h5",component:"h1",children:"Activity Details"}),l&&e.jsx(O,{href:l})]}),e.jsxs(t.Stack,{spacing:.5,children:[e.jsx(y,{label:"Status",value:e.jsx(t.Chip,{"data-testid":"activity-status",label:P.getActivityStatusLabel(s),color:P.getActivityStatusColor(s),size:"small"})}),e.jsx(y,{label:"Action type",value:P.getActivityType(a)}),e.jsx(y,{label:"Created at",value:P.formatActivityDate(r)}),e.jsx(y,{label:"Signatories",value:W.length?e.jsx(t.Stack,{spacing:.5,sx:{alignItems:"flex-end"},children:W.map(d=>e.jsxs(t.Stack,{direction:"row",sx:{alignItems:"center"},children:[e.jsx(t.Typography,{variant:"body2",noWrap:!0,title:d,children:d}),e.jsx(E,{value:d,label:"Copy signatory"})]},d))}):"N/A"}),e.jsx(F,{label:"Template",value:a?.templateId,copyLabel:"Copy template"}),e.jsx(F,{label:"Command ID",value:i,copyLabel:"Copy command ID"}),n&&e.jsx(F,{label:"External transaction ID",value:n,copyLabel:"Copy external transaction ID"}),e.jsx(F,{label:"Transaction hash",value:o,copyLabel:"Copy transaction hash"}),e.jsxs(t.Box,{children:[e.jsxs(t.Stack,{direction:"row",sx:{alignItems:"center",justifyContent:"space-between"},children:[e.jsx(t.Button,{color:"inherit","aria-expanded":f,endIcon:e.jsx(ue,{sx:{transform:f?"rotate(180deg)":"none"}}),onClick:()=>g(d=>!d),children:"Transaction JSON Object"}),T&&e.jsx(E,{value:T,label:"Copy transaction json object"})]}),e.jsx(t.Collapse,{in:f,unmountOnExit:!0,children:e.jsx(t.Box,{component:"pre",sx:{m:0,p:1.5,overflow:"auto",bgcolor:"action.hover",borderRadius:1,fontSize:"0.8125rem"},children:T||"N/A"})})]})]}),B&&e.jsx(N,{approveLabel:s==="signed"&&j?"Retry submit":"Approve",approving:c,rejecting:h,signing:p,disabled:S,onApprove:()=>m(i),onReject:s==="pending"&&k?()=>k(i):void 0})]})},Re=["CanActAs","CanReadAs","CanExecuteAs"],qe=72,Me=24,Ue=i=>i.length>Me?`${i.slice(0,10)}...${i.slice(-10)}`:i,Ne=({children:i})=>e.jsx(t.Typography,{variant:"body2",noWrap:!0,sx:{fontWeight:"bold",flexShrink:0,width:"8rem"},children:i}),Oe=({wallet:i,verified:n=!1,loading:s=!1,onAllocate:o,onSetPrimary:a,onEdit:r,onSelect:l,selectLabel:c="Select"})=>{const h=new Set(i.rights),p=Re.filter(f=>h.has(f)),j=!!(i.reason&&(i.reason.length>qe||i.reason.includes(`
|
|
11
|
+
`))),S=i.primary?e.jsx(t.Chip,{label:"PRIMARY",color:"success",size:"small"},"badge"):i.disabled?e.jsx(t.Chip,{label:"Disabled",color:"error",size:"small"},"badge"):null,m=[];l?m.push(e.jsx(t.Button,{size:"small",disabled:s,onClick:()=>l(i),children:c},"select")):(m.push(S),n?(!i.primary&&!i.disabled&&a&&m.push(e.jsx(t.Button,{size:"small",disabled:s,onClick:()=>a(i),children:"Set as primary"},"set-primary")),r&&m.push(e.jsx(t.Button,{size:"small",disabled:s,onClick:()=>r(i),children:"Edit"},"edit"))):o&&m.push(e.jsx(t.Button,{size:"small",variant:"outlined",color:"inherit",disabled:s||i.disabled===!0,onClick:()=>o(i),children:"Allocate party"},"allocate")));const k=m.some(Boolean);return e.jsxs(t.Card,{component:"article",variant:"outlined","data-testid":"wallet-card","party-id":i.partyId,sx:{display:"flex",flexDirection:"column",height:"100%"},children:[e.jsx(t.CardContent,{sx:{flexGrow:1},children:e.jsxs(t.Stack,{spacing:.5,"data-test-external-tx-id":i.externalTxId??"",children:[e.jsx(y,{label:"Party hint",value:i.hint||"-",action:i.hint?e.jsx(E,{value:i.hint,label:"Copy party hint"}):void 0}),e.jsx(y,{label:"Party ID",value:Ue(i.partyId),title:i.partyId,action:e.jsx(E,{value:i.partyId,label:"Copy party ID"})}),e.jsx(y,{label:"Signing provider",value:i.signingProviderId}),i.reason&&(j?e.jsxs(t.Box,{sx:{minHeight:40,py:.5},children:[e.jsx(Ne,{children:"Reason"}),e.jsx(t.Typography,{variant:"body2",title:i.reason,sx:{whiteSpace:"pre-wrap"},children:i.reason})]}):e.jsx(y,{label:"Reason",value:i.reason})),p.length>0&&e.jsx(y,{label:"Permissions",value:p.map(f=>e.jsx(t.Chip,{label:f,size:"small"},f))})]})}),k&&e.jsx(t.CardActions,{sx:{justifyContent:"space-between"},children:m})]})},$=({children:i,onSubmit:n,submitLabel:s,submittingLabel:o,submittingMessage:a,submitting:r=!1,loading:l=!1,submitDisabled:c=!1})=>{const h=r||l||c,p=j=>{j.preventDefault(),!h&&n()};return e.jsxs(t.Box,{component:"form",onSubmit:p,sx:{display:"flex",flexDirection:"column",height:"100%"},children:[e.jsx(t.Stack,{spacing:2,children:i}),e.jsxs(t.Stack,{spacing:1,sx:{mt:"auto",pt:3},children:[e.jsx(t.Button,{type:"submit",variant:"contained",fullWidth:!0,disabled:h,startIcon:r?e.jsx(t.CircularProgress,{size:16,color:"inherit","aria-hidden":"true"}):void 0,children:r?o:s}),r&&e.jsx(t.Typography,{variant:"body2",color:"text.secondary",role:"status","aria-live":"polite",children:a})]})]})},He=({signingProviders:i,keySigningProviders:n=[],publicKeys:s,selectedSigningProvider:o,showPrimary:a=!0,submitting:r=!1,submitLabel:l="Add",submittingLabel:c="Adding...",submittingMessage:h="Creating party, please wait...",onCreate:p,onSigningProviderChange:j})=>{const[S,m]=u.useState(""),[k,f]=u.useState(""),[g,W]=u.useState(!1),[T,B]=u.useState(""),d=o??k,I=!!d&&n.includes(d),x=i?.length===0,b=r||i===void 0||I&&s===void 0,w=A=>{f(A),B(""),j?.(A)},D=()=>{if(b||x)return;const A=s?.find(v=>v.id===T)?.name;A?p(S,d,g,A):p(S,d,g)};return e.jsx(t.Box,{"data-testid":"wallet-create-form",sx:{height:"100%"},children:e.jsxs($,{submitLabel:l,submittingLabel:c,submittingMessage:h,submitting:r,loading:b,submitDisabled:x,onSubmit:D,children:[e.jsx(t.TextField,{id:"party-id-hint",label:"Party ID Hint",required:!0,fullWidth:!0,placeholder:"Enter the name of your wallet?",disabled:r,value:S,onChange:A=>m(A.target.value)}),e.jsx(H,{signingProviders:i,value:d,onChange:w,disabled:r}),I&&e.jsxs(t.TextField,{id:"vault-name",select:!0,label:"Vault name",required:!0,fullWidth:!0,disabled:b,value:T,onChange:A=>B(A.target.value),slotProps:{select:{native:!0},inputLabel:{shrink:!0}},children:[e.jsx("option",{value:"",disabled:!0,children:b?"Loading vaults...":"Select vault name"}),s?.map(A=>e.jsx("option",{value:A.id,children:A.name},A.id))]}),a&&e.jsx(t.FormControlLabel,{label:"Set as primary wallet",control:e.jsx(t.Checkbox,{id:"primary",checked:g,disabled:r,onChange:A=>W(A.target.checked)})})]})})},$e=({partyId:i,signingProviders:n,disabledSigningProviders:s=[],publicKeys:o,selectedSigningProvider:a,selectedPublicKey:r,submitting:l=!1,submitLabel:c="Edit",submittingLabel:h="Editing...",submittingMessage:p="Editing party, please wait...",onEdit:j,onSigningProviderChange:S})=>{const[m,k]=u.useState(a??""),[f,g]=u.useState(r??""),[W,T]=u.useState(a),[B,d]=u.useState(r);a!==W&&(T(a),k(a??"")),r!==B&&(d(r),g(r??""));const I=n?.length===0,x=o===void 0,b=s.includes(m),w=l||n===void 0,D=v=>{k(v),g(""),S?.(v)},A=()=>{w||!f||!m||j(i,m,f)};return e.jsxs($,{submitLabel:c,submittingLabel:h,submittingMessage:p,submitting:l,loading:w,submitDisabled:I||!m||b||x,onSubmit:A,children:[e.jsx(t.TextField,{id:"party-id",label:"Party ID",fullWidth:!0,disabled:!0,value:i,slotProps:{htmlInput:{readOnly:!0}}}),e.jsx(H,{signingProviders:n,value:m,onChange:D,disabled:l,disabledProviders:s}),e.jsxs(t.TextField,{id:"public-key-id",select:!0,label:"Public Key",required:!0,fullWidth:!0,disabled:l,value:b?"":f,onChange:v=>g(v.target.value),slotProps:{select:{native:!0},inputLabel:{shrink:!0},...x&&{input:{startAdornment:e.jsx(t.InputAdornment,{position:"start",children:e.jsx(t.CircularProgress,{size:16,"aria-label":"Loading public keys"})})}}},children:[e.jsx("option",{value:"",disabled:!0,children:x?"":b?"Select different signing provider":"Select public key"}),o?.map(v=>e.jsxs("option",{value:v.publicKey,children:[v.name," (",v.publicKey,")"]},v.publicKey))]})]})},Ke=te.keyframes`
|
|
12
|
+
from {
|
|
13
|
+
transform: rotate(0deg);
|
|
14
|
+
}
|
|
15
|
+
to {
|
|
16
|
+
transform: rotate(360deg);
|
|
17
|
+
}
|
|
18
|
+
`,Ge=({syncNeeded:i=!1,syncing:n=!1,disabled:s=!1,onSync:o})=>{const a=n?"Syncing parties...":i?"Refresh parties (changes available)":"Refresh parties";return e.jsx(t.Tooltip,{title:a,describeChild:!0,children:e.jsx("span",{children:e.jsx(t.IconButton,{size:"small","aria-label":a,color:i?"primary":"default",disabled:s||n,onClick:o,children:e.jsx(ee,{fontSize:"small",sx:n?{animation:`${Ke} 1s linear infinite`,"@media (prefers-reduced-motion: reduce)":{animation:"none"}}:void 0})})})})},re=u.createContext(null),Ye=({children:i,autoHideDuration:n=5e3})=>{const[s,o]=u.useState([]),a=u.useRef(0),r=u.useCallback(c=>{o(h=>[...h,{...c,id:a.current++}])},[]),l=u.useMemo(()=>({showToast:r}),[r]);return e.jsxs(re.Provider,{value:l,children:[i,s.length>0&&e.jsx(t.Stack,{spacing:1,sx:{position:"fixed",right:{xs:16,sm:20},bottom:{xs:16,sm:20},zIndex:c=>c.zIndex.snackbar,width:{xs:"calc(100vw - 32px)",sm:380},maxWidth:"calc(100vw - 32px)",pointerEvents:"none"},children:s.map(({id:c,...h})=>e.jsx(se,{...h,autoHideDuration:n,onExited:()=>o(p=>p.filter(j=>j.id!==c))},c))})]})},ae=()=>{const i=u.useContext(re);if(!i)throw new Error("useToast must be used within a ToastProvider");return i},Je=()=>{const{showToast:i}=ae();return u.useCallback((n,s)=>i({...P.getErrorToastContent(n,s),type:"error"}),[i])};exports.ApiKeyCard=he;exports.ApiKeyForm=xe;exports.AppHeader=me;exports.ApprovalActions=N;exports.AuthEditor=ne;exports.BackLink=O;exports.CardDetailRow=y;exports.CopyButton=E;exports.ErrorPage=Ce;exports.IdpCard=Se;exports.IdpForm=ke;exports.LoadingState=Te;exports.LoginForm=Be;exports.MessageDetail=Pe;exports.NetworkCard=We;exports.NetworkForm=ze;exports.Pagination=Le;exports.SigningProviderSelect=H;exports.StatusDot=ie;exports.Toast=se;exports.ToastProvider=Ye;exports.TransactionCard=Fe;exports.TransactionDetail=_e;exports.WalletCard=Oe;exports.WalletCreateForm=He;exports.WalletEditForm=$e;exports.WalletForm=$;exports.WalletsSync=Ge;exports.defaultNavItems=pe;exports.useErrorToast=Je;exports.useToast=ae;
|
|
19
|
+
//# sourceMappingURL=index.cjs.map
|