@canton-network/core-wallet-ui-components 1.16.0 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/activity-utils-CmKMEsoq.cjs +4 -0
- package/dist/activity-utils-CmKMEsoq.cjs.map +1 -0
- package/dist/activity-utils-DI0OIiL2.js +1744 -0
- package/dist/activity-utils-DI0OIiL2.js.map +1 -0
- package/dist/components/api-key-card.d.ts +1 -1
- package/dist/components/api-key-card.d.ts.map +1 -1
- package/dist/components/api-key-form.d.ts +1 -1
- package/dist/components/api-key-form.d.ts.map +1 -1
- package/dist/components/app-header.d.ts +6 -6
- package/dist/components/app-header.d.ts.map +1 -1
- package/dist/components/app-layout.d.ts +6 -6
- package/dist/components/app-layout.d.ts.map +1 -1
- package/dist/components/auth-editor.d.ts +3 -3
- package/dist/components/auth-editor.d.ts.map +1 -1
- package/dist/components/back-link.d.ts +2 -2
- package/dist/components/back-link.d.ts.map +1 -1
- package/dist/components/copy-button.d.ts +3 -3
- package/dist/components/copy-button.d.ts.map +1 -1
- package/dist/components/custom-toast.d.ts +5 -5
- package/dist/components/custom-toast.d.ts.map +1 -1
- package/dist/components/error-page.d.ts +5 -5
- package/dist/components/error-page.d.ts.map +1 -1
- package/dist/components/form-input.d.ts +6 -6
- package/dist/components/form-input.d.ts.map +1 -1
- package/dist/components/idp-card.d.ts +2 -2
- package/dist/components/idp-card.d.ts.map +1 -1
- package/dist/components/idp-form.d.ts +3 -3
- package/dist/components/idp-form.d.ts.map +1 -1
- package/dist/components/loading-state.d.ts +1 -1
- package/dist/components/loading-state.d.ts.map +1 -1
- package/dist/components/login-form.d.ts +5 -5
- package/dist/components/login-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/network-card.d.ts +4 -4
- package/dist/components/network-card.d.ts.map +1 -1
- package/dist/components/network-form.d.ts +1 -1
- package/dist/components/network-form.d.ts.map +1 -1
- package/dist/components/not-found.d.ts +1 -1
- package/dist/components/not-found.d.ts.map +1 -1
- package/dist/components/pagination.d.ts +3 -3
- package/dist/components/pagination.d.ts.map +1 -1
- package/dist/components/transaction-card.d.ts +9 -9
- package/dist/components/transaction-card.d.ts.map +1 -1
- package/dist/components/transaction-detail.d.ts +16 -16
- package/dist/components/transaction-detail.d.ts.map +1 -1
- package/dist/components/wallet-card.d.ts +5 -5
- package/dist/components/wallet-card.d.ts.map +1 -1
- package/dist/components/wallet-create-form.d.ts +3 -3
- package/dist/components/wallet-create-form.d.ts.map +1 -1
- package/dist/components/wallet-edit-form.d.ts +2 -2
- package/dist/components/wallet-edit-form.d.ts.map +1 -1
- package/dist/components/wallet-form.d.ts +8 -4
- package/dist/components/wallet-form.d.ts.map +1 -1
- package/dist/components/wallet-picker.d.ts +14 -2
- package/dist/components/wallet-picker.d.ts.map +1 -1
- package/dist/components/wallets-sync.d.ts +1 -1
- package/dist/components/wallets-sync.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 +740 -743
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +2 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13001 -8818
- 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 +2011 -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 +57 -26
- 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
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../activity-utils-CmKMEsoq.cjs");let t=require("@mui/material"),n=require("react/jsx-runtime"),r=require("react"),i=require("@mui/icons-material/Menu");i=e.d(i,1);let a=require("@mui/icons-material/ContentCopy");a=e.d(a,1);let o=require("@mui/icons-material/ChevronLeft");o=e.d(o,1);let s=require("@mui/icons-material/WarningAmber");s=e.d(s,1);let c=require("@mui/icons-material/ArrowBack");c=e.d(c,1);let l=require("@mui/icons-material/Refresh");l=e.d(l,1);let u=require("@mui/material/styles"),d=require("@mui/icons-material/ArrowForward");d=e.d(d,1);let f=require("@mui/icons-material/ExpandMore");f=e.d(f,1);var p=({label:e,value:r,title:i=typeof r==`string`?r:void 0,muted:a=!1,action:o})=>{let s=typeof r==`string`;return(0,n.jsxs)(t.Box,{sx:{display:`flex`,alignItems:`center`,gap:2,minWidth:0,minHeight:40},children:[(0,n.jsx)(t.Typography,{variant:`body2`,noWrap:!0,sx:{fontWeight:`bold`,flexShrink:0,minWidth:`8rem`},children:e}),(0,n.jsx)(t.Typography,{variant:`body2`,component:`div`,noWrap:s,title:s?i:void 0,color:a?`text.secondary`:`text.primary`,sx:{flex:1,minWidth:0,textAlign:`right`,...!s&&{display:`flex`,flexWrap:`wrap`,alignItems:`center`,justifyContent:`flex-end`,gap:.5}},children:r}),o&&(0,n.jsx)(t.Box,{sx:{position:`relative`,zIndex:1,flexShrink:0},children:o})]})},m=({apiKey:e,onRevoke:r})=>(0,n.jsxs)(t.Card,{children:[(0,n.jsxs)(t.CardContent,{children:[(0,n.jsx)(t.Typography,{variant:`body1`,sx:{mb:2,fontWeight:`bold`},children:e.name}),(0,n.jsxs)(t.Stack,{spacing:1,children:[(0,n.jsx)(p,{label:`ID`,value:e.id}),(0,n.jsx)(p,{label:`Created At`,value:e.createdAt})]})]}),(0,n.jsx)(t.Divider,{}),(0,n.jsx)(t.CardActions,{children:(0,n.jsx)(t.Button,{color:`error`,onClick:()=>r(e),children:`Revoke`})})]}),h=()=>(0,n.jsx)(t.CircularProgress,{size:16,color:`inherit`,"aria-hidden":`true`}),g=({onApprove:e,onReject:r,approveLabel:i=`Approve`,approving:a=!1,rejecting:o=!1,signing:s=!1,disabled:c=!1})=>(0,n.jsxs)(t.Stack,{direction:`row`,spacing:2,children:[r&&(0,n.jsx)(t.Button,{variant:`outlined`,color:`error`,fullWidth:!0,disabled:c||a||o,startIcon:o?(0,n.jsx)(h,{}):void 0,onClick:r,children:`Reject`}),(0,n.jsx)(t.Button,{variant:`contained`,fullWidth:!0,disabled:c||a||o||s,startIcon:a||s?(0,n.jsx)(h,{}):void 0,onClick:e,children:i})]}),_=({onGenerate:e})=>{let[i,a]=(0,r.useState)(``);return(0,n.jsxs)(t.Box,{component:`form`,onSubmit:t=>{t.preventDefault(),e({name:i})},sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,n.jsx)(t.Stack,{spacing:2,children:(0,n.jsx)(t.TextField,{label:`Name`,required:!0,fullWidth:!0,value:i,onChange:e=>a(e.target.value)})}),(0,n.jsx)(t.Box,{sx:{mt:`auto`,pt:3},children:(0,n.jsx)(t.Button,{type:`submit`,variant:`contained`,fullWidth:!0,children:`Generate`})})]})},v=({online:e})=>(0,n.jsx)(t.Box,{sx:{display:`inline-block`,flexShrink:0,width:`10px`,height:`10px`,borderRadius:`50%`,bgcolor:e?`success.main`:`text.disabled`}}),y=[{label:`Parties`,href:`/parties/`},{label:`Activities`,href:`/activities/`},{label:`Networks`,href:`/networks/`},{label:`API Keys`,href:`/api-keys/`},{label:`Identity Providers`,href:`/identity-providers/`}],b=({iconSrc:o=e.l,networkName:s=`No network connected`,networkConnected:c=!1,dappApiUrl:l,homeHref:u=`/`,navItems:d,onLogout:f,onDappApiUrlCopy:p})=>{let[m,h]=(0,r.useState)(null),g=!!m,_=(0,r.useId)(),y=()=>h(null),b=(0,t.useTheme)().components?.MuiButtonBase?.defaultProps?.LinkComponent??`a`;return(0,n.jsxs)(t.AppBar,{position:`sticky`,color:`default`,children:[(0,n.jsxs)(t.Toolbar,{sx:{display:`grid`,gridTemplateColumns:`minmax(max-content, 1fr) minmax(0, auto) minmax(max-content, 1fr)`,alignItems:`center`,gap:1},children:[(0,n.jsx)(t.IconButton,{href:u,"aria-label":`Go to home`,sx:{justifySelf:`start`,p:.5},children:(0,n.jsx)(t.Box,{component:`img`,src:o,alt:``,sx:{height:30,display:`block`}})}),(0,n.jsxs)(t.Box,{title:s,"data-testid":`network-status-${c?`connected`:`disconnected`}`,sx:{display:`flex`,alignItems:`center`,gap:1,minWidth:0,maxWidth:`min(52vw, 420px)`},children:[(0,n.jsx)(v,{online:c}),(0,n.jsx)(t.Typography,{variant:`subtitle1`,noWrap:!0,children:s})]}),(0,n.jsx)(t.IconButton,{"aria-label":`menu`,"aria-controls":g?_:void 0,"aria-haspopup":`true`,"aria-expanded":g?`true`:void 0,onClick:e=>h(e.currentTarget),sx:{justifySelf:`end`},children:(0,n.jsx)(i.default,{})})]}),(0,n.jsxs)(t.Menu,{id:_,anchorEl:m,open:g,onClose:y,children:[d.map(({label:e,href:r})=>(0,n.jsx)(t.MenuItem,{component:b,href:r,onClick:y,children:e},r)),p&&(0,n.jsxs)(t.MenuItem,{title:l||`Copy dApp API URL`,"aria-label":l?`Copy dApp API URL: ${l}`:`Copy dApp API URL`,onClick:()=>{y(),p()},children:[(0,n.jsx)(t.ListItemText,{children:`Dapp API URL`}),(0,n.jsx)(t.ListItemIcon,{sx:{justifyContent:`flex-end`},children:(0,n.jsx)(a.default,{fontSize:`small`})})]}),(0,n.jsx)(t.Divider,{}),(0,n.jsx)(t.MenuItem,{onClick:()=>{y(),f()},children:`Logout`})]})]})},x=[`authorization_code`,`client_credentials`,`self_signed`,`self_issued`],S=e=>typeof e?.method==`string`,C=e=>{switch(e){case`authorization_code`:return{method:e,clientId:``,audience:``,scope:``};case`client_credentials`:return{method:e,clientId:``,audience:``,scope:``,clientSecret:``};case`self_issued`:return{method:e,audience:``,scope:``};case`self_signed`:return{method:e,clientId:``,audience:``,scope:``,issuer:``,clientSecret:``}}},w=e=>e?`********`:`(not set)`,T=e=>{let t=[{key:`Method`,value:e.method},{key:`Audience`,value:e.audience??``},{key:`Scope`,value:e.scope??``}];return`clientId`in e&&t.splice(1,0,{key:`Client Id`,value:e.clientId??``}),`issuer`in e&&t.push({key:`Issuer`,value:e.issuer??``}),`clientSecret`in e&&t.push({key:`Client Secret`,value:w(e.clientSecret)}),e.method===`client_credentials`&&e.identityProviderId&&t.push({key:`Identity Provider Id`,value:e.identityProviderId}),t},E=(e,t)=>{let n=`clientId`in e?e.clientId:``,r=e.audience??``,i=e.scope??``;switch(t){case`authorization_code`:return{method:t,clientId:n,audience:r,scope:i};case`self_signed`:return{method:t,clientId:n,audience:r,scope:i,issuer:e.issuer??``,clientSecret:e.clientSecret??``};case`self_issued`:return{method:t,audience:r,scope:i};case`client_credentials`:return{method:t,...e.method===`client_credentials`&&e.identityProviderId?{identityProviderId:e.identityProviderId}:{},clientId:n,audience:r,scope:i,clientSecret:e.clientSecret??``};default:throw Error(`Unsupported auth method: ${String(t)}`)}},D=({label:e,testId:r,value:i,onChange:a,required:o=!1,placeholder:s,helperText:c})=>(0,n.jsx)(t.TextField,{label:e,required:o,fullWidth:!0,value:i,placeholder:s,helperText:c,onChange:e=>a(e.target.value),slotProps:{htmlInput:{"data-test-id":r}}}),O=({auth:e,onChange:i,allowedMethods:a=x,optional:o=!1,label:s=`auth`})=>{let c=`No ${s} configured.`,l=`${s.charAt(0).toUpperCase()}${s.slice(1)} will be removed after submitting this form.`,[u,d]=(0,r.useState)(()=>o?S(e)?`view`:`none`:`edit`),[f,p]=(0,r.useState)(),[m,h]=(0,r.useState)(``),g=()=>{h(``),d(`add`)},_=()=>{e&&p(structuredClone(e)),h(``),d(`edit`)},v=()=>{e&&p(structuredClone(e)),i(void 0),d(`pending-remove`)},y=()=>{f?(i(structuredClone(f)),d(`view`)):d(o?`none`:`edit`)},b=()=>{f?(i(structuredClone(f)),d(`view`)):(i(void 0),d(o?`none`:`edit`)),h(``)},w=(0,n.jsxs)(t.Stack,{spacing:1,"data-test-id":`auth-editor-empty-state`,children:[(0,n.jsx)(t.Typography,{variant:`body2`,color:`text.secondary`,"data-test-id":`auth-editor-empty-text`,children:c}),(0,n.jsx)(t.Box,{children:(0,n.jsx)(t.Button,{size:`small`,"data-test-id":`auth-editor-add-button`,onClick:g,children:`Add`})})]});if(u===`none`)return w;if(u===`pending-remove`)return(0,n.jsxs)(t.Stack,{spacing:1,"data-test-id":`auth-editor-pending-remove-state`,children:[(0,n.jsx)(t.Alert,{severity:`warning`,"data-test-id":`auth-editor-pending-remove-text`,children:l}),(0,n.jsx)(t.Box,{children:(0,n.jsx)(t.Button,{size:`small`,"data-test-id":`auth-editor-cancel-remove-button`,onClick:y,children:`Cancel`})})]});if(u===`view`&&S(e))return(0,n.jsxs)(t.Stack,{spacing:1,"data-test-id":`auth-editor-view-state`,children:[(0,n.jsx)(t.Box,{component:`dl`,"data-test-id":`auth-editor-summary-list`,sx:{m:0},children:T(e).map(e=>(0,n.jsxs)(t.Box,{"data-test-id":`auth-editor-summary-row`,sx:{display:`flex`,gap:2,minHeight:32,alignItems:`center`},children:[(0,n.jsx)(t.Typography,{component:`dt`,variant:`body2`,noWrap:!0,sx:{fontWeight:`bold`,flexShrink:0,minWidth:`8rem`},children:e.key}),(0,n.jsx)(t.Typography,{component:`dd`,variant:`body2`,noWrap:!0,title:e.value,sx:{m:0,flex:1,minWidth:0,textAlign:`right`},children:e.value})]},e.key))}),(0,n.jsxs)(t.Stack,{direction:`row`,spacing:1,children:[(0,n.jsx)(t.Button,{size:`small`,"data-test-id":`auth-editor-edit-button`,onClick:_,children:`Edit`}),(0,n.jsx)(t.Button,{size:`small`,color:`error`,"data-test-id":`auth-editor-remove-button`,onClick:v,children:`Remove`})]})]});let O=S(e)?e:C(a[0]??`authorization_code`),k=O.method,A=e=>i({...O,...e}),j=f&&`clientSecret`in f?f.clientSecret:void 0,M=`clientSecret`in O?O.clientSecret:void 0,N=m.trim()===``&&u!==`add`&&(typeof M==`string`&&M!==``||typeof j==`string`&&j.length>0),P=e=>{h(e);let t;t=e.trim()===``?u===`add`?``:typeof j==`string`?j:M??``:e,A({clientSecret:t})},F=e=>{let t=e.trim(),{identityProviderId:n,...r}=O;i(t?{...r,identityProviderId:t}:r)},I=`clientId`in O&&(0,n.jsx)(D,{label:`Client Id`,testId:`auth-editor-client-id-input`,required:!0,value:O.clientId??``,onChange:e=>A({clientId:e})}),L=(0,n.jsx)(D,{label:`Client Secret`,testId:`auth-editor-client-secret-input`,required:!N,value:m,placeholder:N?`********`:``,helperText:N?(0,n.jsx)(`span`,{"data-test-id":`auth-editor-secret-help`,children:`Current secret is hidden. Enter a new value to replace it.`}):void 0,onChange:P});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(t.Stack,{spacing:2,"data-test-id":`auth-editor-edit-state`,children:[(0,n.jsxs)(t.TextField,{select:!0,label:`Method`,required:!0,fullWidth:!0,value:k,onChange:e=>i(E(O,e.target.value)),slotProps:{select:{native:!0},htmlInput:{"data-test-id":`auth-editor-method-select`}},children:[!a.includes(k)&&(0,n.jsx)(`option`,{value:k,disabled:!0,children:k}),a.map(e=>(0,n.jsx)(`option`,{value:e,children:e},e))]}),(0,n.jsx)(D,{label:`Audience`,testId:`auth-editor-audience-input`,required:!0,value:O.audience??``,onChange:e=>A({audience:e})}),(0,n.jsx)(D,{label:`Scope`,testId:`auth-editor-scope-input`,required:!0,value:O.scope??``,onChange:e=>A({scope:e})}),k===`authorization_code`&&I,k===`client_credentials`&&(0,n.jsxs)(n.Fragment,{children:[I,(0,n.jsx)(D,{label:`Identity Provider Id Override`,testId:`auth-editor-identity-provider-id-input`,value:O.identityProviderId??``,helperText:`Optional. Uses the network identity provider when empty.`,onChange:F}),L]}),k===`self_signed`&&(0,n.jsxs)(n.Fragment,{children:[I,(0,n.jsx)(D,{label:`Issuer`,testId:`auth-editor-issuer-input`,required:!0,value:O.issuer??``,onChange:e=>A({issuer:e})}),L]}),![`authorization_code`,`client_credentials`,`self_signed`,`self_issued`].includes(k)&&(0,n.jsxs)(t.Alert,{severity:`warning`,"data-test-id":`auth-editor-unsupported-method-warning`,children:[`Unsupported auth method "`,k,`". Select a supported method to continue.`]})]}),o&&(0,n.jsx)(t.Box,{sx:{mt:1},children:(0,n.jsx)(t.Button,{size:`small`,"data-test-id":`auth-editor-cancel-edit-button`,onClick:b,children:`Cancel`})})]})},k=({label:e=`Back`,href:r,onClick:i})=>(0,n.jsx)(t.Button,{color:`inherit`,size:`small`,startIcon:(0,n.jsx)(o.default,{}),...r===void 0?{onClick:i}:{href:r},children:e}),A=e.c([`core`,`wallet-ui-components/react`]),j=({onCopy:e,value:i,label:o=`Copy to clipboard`})=>{let[s,c]=(0,r.useState)(!1),l=(0,r.useRef)(void 0);return(0,r.useEffect)(()=>()=>clearTimeout(l.current),[]),(0,n.jsx)(t.Tooltip,{title:s?`Copied`:o,children:(0,n.jsx)(t.IconButton,{"aria-label":o,onClick:async t=>{if(t.stopPropagation(),i)try{if(navigator.clipboard?.writeText)await navigator.clipboard.writeText(i);else throw Error(`Browser does not support clipboard functionality.`);e!==void 0&&e(i),clearTimeout(l.current),l.current=setTimeout(()=>c(!1),1200),c(!0)}catch(e){A.getChild(`CopyButton`).error(`Unable to copy value`,{error:e})}},children:(0,n.jsx)(a.default,{color:s?`success`:`inherit`})})})},M=({mode:e,title:r=`Something went wrong`,message:i=`An unexpected error occurred while loading this page.`,onAction:a})=>(0,n.jsx)(t.Paper,{children:(0,n.jsxs)(t.Stack,{sx:{justifyContent:`center`,alignItems:`center`,p:4},children:[(0,n.jsx)(t.Box,{children:(0,n.jsx)(s.default,{color:`error`})}),(0,n.jsxs)(t.Box,{children:[(0,n.jsx)(t.Typography,{variant:`h5`,component:`h1`,children:r}),(0,n.jsx)(t.Typography,{variant:`body1`,children:i})]}),(0,n.jsx)(t.Box,{sx:{mt:4},children:(0,n.jsx)(t.Button,{variant:`contained`,color:`primary`,startIcon:e===`back`?(0,n.jsx)(c.default,{}):(0,n.jsx)(l.default,{}),onClick:a,children:e===`back`?`Back`:`Refresh`})})]})}),N=({idp:e,onReview:r})=>{let i=`configUrl`in e?e.configUrl:``;return(0,n.jsx)(t.Card,{component:`article`,"data-testid":`idp-card`,variant:`outlined`,sx:{position:`relative`,...r&&{"&:hover":{borderColor:`primary.main`,boxShadow:2}}},children:(0,n.jsxs)(t.CardContent,{children:[(0,n.jsx)(t.Box,{sx:{mb:1},children:r?(0,n.jsx)(t.Link,{component:`button`,type:`button`,variant:`body1`,color:`inherit`,underline:`none`,onClick:()=>r(e),sx:{fontWeight:`bold`,textAlign:`left`,position:`static`,"&::after":{content:`""`,position:`absolute`,inset:0,cursor:`pointer`}},children:e.id}):(0,n.jsx)(t.Typography,{variant:`body1`,sx:{fontWeight:`bold`},children:e.id})}),(0,n.jsxs)(t.Stack,{spacing:.5,children:[(0,n.jsx)(p,{label:`Type`,value:e.type}),`issuer`in e&&(0,n.jsx)(p,{label:`Issuer`,value:e.issuer,action:(0,n.jsx)(j,{value:e.issuer,label:`Copy issuer URL`})}),i&&(0,n.jsx)(p,{label:`Config URL`,value:i,action:(0,n.jsx)(j,{value:i,label:`Copy config URL`})})]})]})})},P={id:``,type:`oauth`,issuer:``,configUrl:``},F=e=>`issuer`in e?e.issuer:``,I=e=>`configUrl`in e?e.configUrl:``,L=({idp:e,loading:i=!1,onSave:a,onDelete:o,onCancel:s})=>{let c=e??P,[l,u]=(0,r.useState)(c.id),[d,f]=(0,r.useState)(c.type),[p,m]=(0,r.useState)(F(c)),[h,g]=(0,r.useState)(I(c)),[_,v]=(0,r.useState)(``),[y,b]=(0,r.useState)(e);return e!==y&&(b(e),u(c.id),f(c.type),m(F(c)),g(I(c)),v(``)),(0,n.jsxs)(t.Box,{component:`form`,onSubmit:e=>{if(e.preventDefault(),!l||d!==`self_issued`&&!p||d===`oauth`&&!h)v(`Please fill in all required fields`);else switch(v(``),d){case`oauth`:a({id:l,type:d,issuer:p,configUrl:h});break;case`self_signed`:a({id:l,type:d,issuer:p});break;case`self_issued`:a({id:l,type:d})}},sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,n.jsxs)(t.Stack,{spacing:2,children:[(0,n.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:i,value:l,onChange:e=>u(e.target.value)}),(0,n.jsxs)(t.TextField,{id:`idp-type`,select:!0,label:`Type`,required:!0,fullWidth:!0,disabled:i,value:d,onChange:e=>f(e.target.value),slotProps:{select:{native:!0}},children:[(0,n.jsx)(`option`,{value:`oauth`,children:`oauth`}),(0,n.jsx)(`option`,{value:`self_signed`,children:`self_signed`}),(0,n.jsx)(`option`,{value:`self_issued`,children:`self_issued`})]}),d!==`self_issued`&&(0,n.jsx)(t.TextField,{id:`idp-issuer`,label:`Issuer URL`,required:!0,fullWidth:!0,placeholder:`Enter the issuer URL`,disabled:i,value:p,onChange:e=>m(e.target.value)}),d===`oauth`&&(0,n.jsx)(t.TextField,{id:`idp-config-url`,label:`Config URL`,required:!0,fullWidth:!0,placeholder:`Enter the configuration URL`,disabled:i,value:h,onChange:e=>g(e.target.value)})]}),_&&(0,n.jsx)(t.Alert,{severity:`error`,sx:{mt:2},children:_}),e?(0,n.jsxs)(n.Fragment,{children:[o&&(0,n.jsxs)(t.Box,{sx:{mt:4},children:[(0,n.jsx)(t.Divider,{sx:{mb:3}}),(0,n.jsx)(t.Typography,{variant:`subtitle1`,component:`h2`,sx:{fontWeight:`bold`,mb:1},children:`Delete identity provider`}),(0,n.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.`}),(0,n.jsx)(t.Button,{variant:`outlined`,color:`error`,onClick:()=>o(e),children:`Delete identity provider`})]}),(0,n.jsxs)(t.Stack,{direction:`row`,spacing:2,sx:{mt:3},children:[s&&(0,n.jsx)(t.Button,{variant:`outlined`,color:`inherit`,fullWidth:!0,onClick:s,children:`Cancel`}),(0,n.jsx)(t.Button,{type:`submit`,variant:`contained`,fullWidth:!0,disabled:i,children:`Update`})]})]}):(0,n.jsx)(t.Box,{sx:{mt:`auto`,pt:3},children:(0,n.jsx)(t.Button,{type:`submit`,variant:`contained`,fullWidth:!0,disabled:i,children:`Add`})})]})},R=u.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
|
+
`,ee=({text:e=`Loading`})=>(0,n.jsxs)(t.Stack,{role:`status`,"aria-live":`polite`,spacing:2,sx:{minHeight:180,justifyContent:`center`,alignItems:`center`,p:3},children:[(0,n.jsx)(t.Stack,{direction:`row`,spacing:1,"aria-hidden":`true`,children:[0,1,2].map(e=>(0,n.jsx)(t.Box,{sx:{width:8,height:8,borderRadius:`50%`,bgcolor:`primary.main`,animation:`${R} 1s infinite ease-in-out`,animationDelay:`${e*.15}s`,"@media (prefers-reduced-motion: reduce)":{animation:`none`}}},e))}),(0,n.jsx)(t.Typography,{variant:`body1`,color:`text.secondary`,children:e})]}),z=e=>e.authMethod!==`client_credentials`,B=({networks:i,idps:a,loading:o=!1,connecting:s=!1,message:c=null,onConnect:l})=>{let[u,d]=(0,r.useState)(),[f,p]=(0,r.useState)(null),[m,h]=(0,r.useState)(``),[g,_]=(0,r.useState)(``),[v,y]=(0,r.useState)(null),[b,x]=(0,r.useState)(null),S=i.find(e=>e.id===u),C=u===null?null:S&&z(S)?S:i.find(z)??null,w=a.find(e=>e.id===C?.identityProviderId)??null,T=w?.type===`self_issued`||C?.authMethod===`self_issued`,E=!T&&w?.type===`self_signed`,D=v?{type:`error`,text:v}:c&&c!==b?c:null,O=e=>{d(e===``?null:e),p(null),y(null),x(c)};return(0,n.jsxs)(t.Box,{component:`form`,onSubmit:e=>{e.preventDefault(),y(null),x(c),C?w?w.type===`self_signed`?l(C,w,f||C.clientId,m):w.type===`self_issued`?l(C,w,void 0,void 0,g.trim()):l(C,w):y(`Identity provider misconfigured for this network.`):y(`Please select a network before connecting.`)},sx:{minHeight:`100dvh`,display:`flex`,flexDirection:`column`},children:[(0,n.jsx)(t.Box,{sx:{height:44,display:`flex`,alignItems:`center`,px:2,borderBottom:1,borderColor:`divider`},children:(0,n.jsx)(`img`,{src:e.l,alt:`Canton logo`,width:24,height:24,style:{objectFit:`contain`}})}),(0,n.jsxs)(t.Stack,{spacing:2,sx:{flex:1,px:2,pt:2},children:[(0,n.jsx)(t.Typography,{variant:`h5`,component:`h1`,sx:{fontWeight:`bold`},children:`Wallet Gateway`}),(0,n.jsxs)(t.TextField,{select:!0,fullWidth:!0,label:`Select a network`,value:C?.id??``,disabled:o||s,onChange:e=>O(e.target.value),slotProps:{select:{native:!0},inputLabel:{shrink:!0}},children:[(0,n.jsx)(`option`,{value:``,children:`Select network`}),i.map(e=>(0,n.jsx)(`option`,{value:e.id,disabled:!z(e),children:e.name},e.id))]}),T&&(0,n.jsx)(t.TextField,{fullWidth:!0,required:!0,label:`Username`,autoComplete:`username`,value:g,disabled:s,onChange:e=>_(e.target.value)}),E&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(t.TextField,{fullWidth:!0,label:`Client ID`,autoComplete:`username`,value:f??C?.clientId??``,disabled:s,onChange:e=>p(e.target.value)}),(0,n.jsx)(t.TextField,{fullWidth:!0,label:`Client Secret`,type:`password`,autoComplete:`current-password`,value:m,disabled:s,onChange:e=>h(e.target.value)})]}),D?(0,n.jsx)(t.Alert,{severity:D.type,children:D.text}):(0,n.jsx)(t.Typography,{variant:`body2`,color:`text.secondary`,children:o?`Loading networks...`:C?`Selected: ${C.name}`:`Choose a network to continue.`})]}),(0,n.jsx)(t.Box,{sx:{p:2},children:(0,n.jsx)(t.Button,{type:`submit`,variant:`contained`,size:`large`,fullWidth:!0,disabled:o||s||!C,children:s?`Connecting…`:`Connect`})})]})},te=({messageId:r,message:i,status:a,origin:o=null,externalTxId:s=null,backHref:c,approving:l=!1,rejecting:u=!1,signing:d=!1,disabled:f=!1,onApprove:m,onReject:h})=>(0,n.jsxs)(t.Stack,{spacing:2,children:[(0,n.jsxs)(t.Stack,{direction:`row`,sx:{alignItems:`center`,justifyContent:`space-between`},children:[(0,n.jsx)(t.Typography,{variant:`h5`,component:`h1`,children:`Message Details`}),c&&(0,n.jsx)(k,{href:c})]}),(0,n.jsxs)(t.Stack,{spacing:.5,children:[(0,n.jsx)(p,{label:`Status`,value:(0,n.jsx)(t.Chip,{"data-testid":`activity-status`,label:e.a(a),color:e.i(a),size:`small`})}),o&&(0,n.jsx)(p,{label:`Requested by`,value:o}),s&&(0,n.jsx)(p,{label:`External transaction ID`,value:s,action:(0,n.jsx)(j,{value:s,label:`Copy external transaction ID`})}),(0,n.jsxs)(t.Box,{children:[(0,n.jsx)(t.Typography,{variant:`body2`,component:`h2`,sx:{fontWeight:`bold`,py:1},children:`Message`}),(0,n.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:i})]})]}),a===`pending`&&(0,n.jsx)(g,{approving:l,rejecting:u,signing:d,disabled:f,onApprove:()=>m(r),onReject:h&&(()=>h(r))})]}),ne=({network:e,activeSession:r=!1,accessToken:i=``,onReview:a})=>{let o=e.synchronizerId??``;return(0,n.jsx)(t.Card,{component:`article`,"data-testid":`network-card`,variant:`outlined`,sx:{position:`relative`,...a&&{"&:hover":{borderColor:`primary.main`,boxShadow:2}}},children:(0,n.jsxs)(t.CardContent,{children:[(0,n.jsxs)(t.Stack,{direction:`row`,spacing:1,sx:{alignItems:`center`,mb:1},children:[a?(0,n.jsx)(t.Link,{component:`button`,type:`button`,variant:`body1`,color:`inherit`,underline:`none`,onClick:()=>a(e),sx:{fontWeight:`bold`,textAlign:`left`,position:`static`,"&::after":{content:`""`,position:`absolute`,inset:0,cursor:`pointer`}},children:e.name}):(0,n.jsx)(t.Typography,{variant:`body1`,sx:{fontWeight:`bold`},children:e.name}),r&&(0,n.jsx)(t.Chip,{label:`CONNECTED`,color:`success`,size:`small`})]}),(0,n.jsxs)(t.Stack,{spacing:.5,children:[(0,n.jsx)(p,{label:`ID`,value:e.id}),r&&(0,n.jsx)(p,{label:`Access Token`,value:`[private]`,muted:!0,action:(0,n.jsx)(j,{value:i,label:`Copy access token`})}),(0,n.jsx)(p,{label:`Auth`,value:e.authMethod}),o&&(0,n.jsx)(p,{label:`Synchronizer`,value:o,action:(0,n.jsx)(j,{value:o,label:`Copy synchronizer ID`})}),e.identityProviderId&&(0,n.jsx)(p,{label:`Identity provider`,value:e.identityProviderId})]})]})})},V=(0,r.memo)(O),H=[`client_credentials`],U={id:``,name:``,description:``,identityProviderId:``,ledgerApi:``,auth:{method:`authorization_code`,audience:``,scope:``,clientId:``}},W=e=>{try{return new URL(e),!0}catch{return!1}},G=e=>({synchronizerId:!e.synchronizerId||e.synchronizerId.includes(`::`)&&e.synchronizerId.length>=10?void 0:`Must contain "::" and be at least 10 characters`,ledgerApi:W(e.ledgerApi)?void 0:`Must be a valid URL`}),K=({title:e,children:i})=>{let a=(0,r.useId)();return(0,n.jsxs)(t.Box,{component:`section`,"aria-labelledby":a,children:[(0,n.jsx)(t.Typography,{id:a,variant:`subtitle1`,component:`h3`,sx:{fontWeight:`bold`,mb:1},children:e}),i]})},q=({network:e,onSave:i,onDelete:a,onCancel:o})=>{let s=e??U,[c,l]=(0,r.useState)(s),[u,d]=(0,r.useState)(e),[f,p]=(0,r.useState)(0),[m,h]=(0,r.useState)(!1);e!==u&&(d(e),l(s),p(e=>e+1),h(!1));let g=m?G(c):{synchronizerId:void 0,ledgerApi:void 0},_=Object.values(g).some(Boolean),v=e=>l(t=>({...t,...e})),y=(0,r.useCallback)(e=>{e&&l(t=>({...t,auth:e}))},[]),b=(0,r.useCallback)((e,t)=>l(n=>{let r={...n};return delete r[e],t?{...r,[e]:t}:r}),[]),x=(0,r.useCallback)(e=>b(`adminAuth`,e),[b]),S=(0,r.useCallback)(e=>b(`serviceAccountAuth`,e),[b]);return(0,n.jsxs)(t.Box,{component:`form`,onSubmit:e=>{e.preventDefault(),h(!0),!Object.values(G(c)).some(Boolean)&&i(c)},sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,n.jsxs)(t.Stack,{spacing:2,children:[(0,n.jsx)(t.TextField,{label:`Network Id`,required:!0,fullWidth:!0,helperText:`A unique identifier for the network`,value:c.id,onChange:e=>v({id:e.target.value})}),(0,n.jsx)(t.TextField,{label:`Name`,required:!0,fullWidth:!0,value:c.name,onChange:e=>v({name:e.target.value})}),(0,n.jsx)(t.TextField,{label:`Description`,required:!0,fullWidth:!0,value:c.description,onChange:e=>v({description:e.target.value})}),(0,n.jsx)(t.TextField,{label:`Synchronizer Id`,fullWidth:!0,error:!!g.synchronizerId,helperText:g.synchronizerId,value:c.synchronizerId??``,onChange:e=>{let t={...c};e.target.value?t.synchronizerId=e.target.value:delete t.synchronizerId,l(t)}}),(0,n.jsx)(t.TextField,{label:`Identity Provider Id`,required:!0,fullWidth:!0,value:c.identityProviderId,onChange:e=>v({identityProviderId:e.target.value})}),(0,n.jsx)(t.TextField,{label:`Ledger API Base Url`,required:!0,fullWidth:!0,error:!!g.ledgerApi,helperText:g.ledgerApi,value:c.ledgerApi,onChange:e=>v({ledgerApi:e.target.value})}),(0,n.jsx)(K,{title:`Configure user auth`,children:(0,n.jsx)(V,{auth:c.auth,onChange:y},f)}),(0,n.jsx)(K,{title:`Configure admin auth`,children:(0,n.jsx)(V,{auth:c.adminAuth,optional:!0,label:`admin auth`,onChange:x},f)}),(0,n.jsx)(K,{title:`Configure service account auth`,children:(0,n.jsx)(V,{auth:c.serviceAccountAuth,allowedMethods:H,optional:!0,label:`service account auth`,onChange:S},f)})]}),_&&(0,n.jsx)(t.Alert,{severity:`error`,sx:{mt:2},children:`Invalid network data, please ensure all fields are set correctly`}),e?(0,n.jsxs)(n.Fragment,{children:[a&&(0,n.jsxs)(t.Box,{sx:{mt:4},children:[(0,n.jsx)(t.Divider,{sx:{mb:3}}),(0,n.jsx)(t.Typography,{variant:`subtitle1`,component:`h2`,sx:{fontWeight:`bold`,mb:1},children:`Delete network`}),(0,n.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.`}),(0,n.jsx)(t.Button,{variant:`outlined`,color:`error`,onClick:()=>a(e),children:`Delete Network`})]}),(0,n.jsxs)(t.Stack,{direction:`row`,spacing:2,sx:{mt:3},children:[o&&(0,n.jsx)(t.Button,{variant:`outlined`,color:`inherit`,fullWidth:!0,onClick:o,children:`Cancel`}),(0,n.jsx)(t.Button,{type:`submit`,variant:`contained`,fullWidth:!0,"data-test-id":`update-network-button`,children:`Update`})]})]}):(0,n.jsx)(t.Box,{sx:{mt:`auto`,pt:3},children:(0,n.jsx)(t.Button,{type:`submit`,variant:`contained`,fullWidth:!0,"data-test-id":`add-network-button`,children:`Add`})})]})},re=({total:e,pageSize:r=5,page:i=1,onPageChange:a})=>{let o=Math.max(r,1),s=Math.max(1,Math.ceil(e/o)),l=Math.min(Math.max(i,1),s),u=e>0?(l-1)*o+1:0,f=e>0?Math.min(u+o-1,e):0;return(0,n.jsxs)(t.Stack,{component:`nav`,"aria-label":`Pagination`,direction:`row`,spacing:1,sx:{alignItems:`center`,display:`inline-flex`},children:[(0,n.jsx)(t.IconButton,{size:`small`,"aria-label":`Previous page`,disabled:l<=1,onClick:()=>a(l-1),children:(0,n.jsx)(c.default,{fontSize:`small`})}),(0,n.jsxs)(t.Typography,{variant:`body2`,component:`span`,children:[u,`-`,f,` of `,e]}),(0,n.jsx)(t.IconButton,{size:`small`,"aria-label":`Next page`,disabled:l>=s,onClick:()=>a(l+1),children:(0,n.jsx)(d.default,{fontSize:`small`})})]})},J=({signingProviders:e,value:r,onChange:i,disabled:a=!1,disabledProviders:o=[]})=>{let s=e===void 0,c=e?.length===0;return(0,n.jsxs)(t.TextField,{id:`signing-provider-id`,select:!0,label:`Signing Provider`,required:!0,fullWidth:!0,value:r,disabled:a||s||c,onChange:e=>i(e.target.value),slotProps:{select:{native:!0},inputLabel:{shrink:!0}},children:[(0,n.jsx)(`option`,{value:``,disabled:!0,children:s?`Loading signing providers...`:c?`No signing providers available`:`Select signing provider`}),e?.map(e=>(0,n.jsx)(`option`,{value:e,disabled:o.includes(e),children:e},e))]})},Y=({title:e,message:i,type:a=`error`,buttonText:o=`Dismiss notification`,autoHideDuration:s,onExited:c})=>{let[l,u]=(0,r.useState)(!0);return(0,n.jsx)(t.Snackbar,{open:l,autoHideDuration:s,onClose:(e,t)=>{t!==`clickaway`&&u(!1)},slotProps:{transition:{onExited:()=>c?.()}},sx:{position:`static`,pointerEvents:`auto`},children:(0,n.jsxs)(t.Alert,{role:a===`error`?`alert`:`status`,severity:a,closeText:o,onClose:()=>u(!1),sx:{width:`100%`},children:[(0,n.jsx)(t.AlertTitle,{children:e}),i]})})},ie=({transactionId:r,commandId:i,externalTxId:a=null,status:o,parsed:s=null,createdAt:c=null,loading:l=!1,onReview:u})=>{let d=e.o(s),f=e.n(s),m=e.t(c);return(0,n.jsx)(t.Card,{variant:`outlined`,"data-testid":`transaction-card`,children:(0,n.jsx)(t.CardActionArea,{disabled:l,"aria-label":`Open activity ${i}`,onClick:()=>u(r,i),children:(0,n.jsx)(t.CardContent,{children:(0,n.jsxs)(t.Stack,{spacing:.5,children:[(0,n.jsx)(p,{label:`Command ID`,value:i}),a&&(0,n.jsx)(p,{label:`External transaction ID`,value:a}),(0,n.jsx)(p,{label:`Status`,value:(0,n.jsx)(t.Chip,{"data-testid":`activity-status`,label:e.a(o),color:e.i(o),size:`small`})}),(0,n.jsx)(p,{label:`Action type`,value:d}),(0,n.jsx)(p,{label:`Created at`,value:m}),(0,n.jsx)(p,{label:`Amount`,value:f})]})})})})},X=({label:e,value:t,copyLabel:r})=>(0,n.jsx)(p,{label:e,value:t||`N/A`,action:t?(0,n.jsx)(j,{value:t,label:r}):void 0}),ae=({commandId:i,externalTxId:a=null,status:o,txHash:s,parsed:c=null,createdAt:l=null,backHref:u,approving:d=!1,rejecting:m=!1,signing:h=!1,submitFailed:_=!1,disabled:v=!1,onApprove:y,onReject:b})=>{let[x,S]=(0,r.useState)(!1),C=c?.signatories??[],w=c?.jsonString,T=o===`pending`||o===`signed`;return(0,n.jsxs)(t.Stack,{spacing:2,children:[(0,n.jsxs)(t.Stack,{direction:`row`,sx:{alignItems:`center`,justifyContent:`space-between`},children:[(0,n.jsx)(t.Typography,{variant:`h5`,component:`h1`,children:`Activity Details`}),u&&(0,n.jsx)(k,{href:u})]}),(0,n.jsxs)(t.Stack,{spacing:.5,children:[(0,n.jsx)(p,{label:`Status`,value:(0,n.jsx)(t.Chip,{"data-testid":`activity-status`,label:e.a(o),color:e.i(o),size:`small`})}),(0,n.jsx)(p,{label:`Action type`,value:e.o(c)}),(0,n.jsx)(p,{label:`Created at`,value:e.t(l)}),(0,n.jsx)(p,{label:`Signatories`,value:C.length?(0,n.jsx)(t.Stack,{spacing:.5,sx:{alignItems:`flex-end`},children:C.map(e=>(0,n.jsxs)(t.Stack,{direction:`row`,sx:{alignItems:`center`},children:[(0,n.jsx)(t.Typography,{variant:`body2`,noWrap:!0,title:e,children:e}),(0,n.jsx)(j,{value:e,label:`Copy signatory`})]},e))}):`N/A`}),(0,n.jsx)(X,{label:`Template`,value:c?.templateId,copyLabel:`Copy template`}),(0,n.jsx)(X,{label:`Command ID`,value:i,copyLabel:`Copy command ID`}),a&&(0,n.jsx)(X,{label:`External transaction ID`,value:a,copyLabel:`Copy external transaction ID`}),(0,n.jsx)(X,{label:`Transaction hash`,value:s,copyLabel:`Copy transaction hash`}),(0,n.jsxs)(t.Box,{children:[(0,n.jsxs)(t.Stack,{direction:`row`,sx:{alignItems:`center`,justifyContent:`space-between`},children:[(0,n.jsx)(t.Button,{color:`inherit`,"aria-expanded":x,endIcon:(0,n.jsx)(f.default,{sx:{transform:x?`rotate(180deg)`:`none`}}),onClick:()=>S(e=>!e),children:`Transaction JSON Object`}),w&&(0,n.jsx)(j,{value:w,label:`Copy transaction json object`})]}),(0,n.jsx)(t.Collapse,{in:x,unmountOnExit:!0,children:(0,n.jsx)(t.Box,{component:`pre`,sx:{m:0,p:1.5,overflow:`auto`,bgcolor:`action.hover`,borderRadius:1,fontSize:`0.8125rem`},children:w||`N/A`})})]})]}),T&&(0,n.jsx)(g,{approveLabel:o===`signed`&&_?`Retry submit`:`Approve`,approving:d,rejecting:m,signing:h,disabled:v,onApprove:()=>y(i),onReject:o===`pending`&&b?()=>b(i):void 0})]})},oe=[`CanActAs`,`CanReadAs`,`CanExecuteAs`],se=72,ce=24,le=e=>e.length>ce?`${e.slice(0,10)}...${e.slice(-10)}`:e,ue=({children:e})=>(0,n.jsx)(t.Typography,{variant:`body2`,noWrap:!0,sx:{fontWeight:`bold`,flexShrink:0,width:`8rem`},children:e}),de=({wallet:e,verified:r=!1,loading:i=!1,onAllocate:a,onSetPrimary:o,onEdit:s,onSelect:c,selectLabel:l=`Select`})=>{let u=new Set(e.rights),d=oe.filter(e=>u.has(e)),f=!!(e.reason&&(e.reason.length>se||e.reason.includes(`
|
|
11
|
+
`))),m=e.primary?(0,n.jsx)(t.Chip,{label:`PRIMARY`,color:`success`,size:`small`},`badge`):e.disabled?(0,n.jsx)(t.Chip,{label:`Disabled`,color:`error`,size:`small`},`badge`):null,h=[];c?h.push((0,n.jsx)(t.Button,{size:`small`,disabled:i,onClick:()=>c(e),children:l},`select`)):(h.push(m),r?(!e.primary&&!e.disabled&&o&&h.push((0,n.jsx)(t.Button,{size:`small`,disabled:i,onClick:()=>o(e),children:`Set as primary`},`set-primary`)),s&&h.push((0,n.jsx)(t.Button,{size:`small`,disabled:i,onClick:()=>s(e),children:`Edit`},`edit`))):a&&h.push((0,n.jsx)(t.Button,{size:`small`,variant:`outlined`,color:`inherit`,disabled:i||e.disabled===!0,onClick:()=>a(e),children:`Allocate party`},`allocate`)));let g=h.some(Boolean);return(0,n.jsxs)(t.Card,{component:`article`,variant:`outlined`,"data-testid":`wallet-card`,"party-id":e.partyId,sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,n.jsx)(t.CardContent,{sx:{flexGrow:1},children:(0,n.jsxs)(t.Stack,{spacing:.5,"data-test-external-tx-id":e.externalTxId??``,children:[(0,n.jsx)(p,{label:`Party hint`,value:e.hint||`-`,action:e.hint?(0,n.jsx)(j,{value:e.hint,label:`Copy party hint`}):void 0}),(0,n.jsx)(p,{label:`Party ID`,value:le(e.partyId),title:e.partyId,action:(0,n.jsx)(j,{value:e.partyId,label:`Copy party ID`})}),(0,n.jsx)(p,{label:`Signing provider`,value:e.signingProviderId}),e.reason&&(f?(0,n.jsxs)(t.Box,{sx:{minHeight:40,py:.5},children:[(0,n.jsx)(ue,{children:`Reason`}),(0,n.jsx)(t.Typography,{variant:`body2`,title:e.reason,sx:{whiteSpace:`pre-wrap`},children:e.reason})]}):(0,n.jsx)(p,{label:`Reason`,value:e.reason})),d.length>0&&(0,n.jsx)(p,{label:`Permissions`,value:d.map(e=>(0,n.jsx)(t.Chip,{label:e,size:`small`},e))})]})}),g&&(0,n.jsx)(t.CardActions,{sx:{justifyContent:`space-between`},children:h})]})},Z=({children:e,onSubmit:r,submitLabel:i,submittingLabel:a,submittingMessage:o,submitting:s=!1,loading:c=!1,submitDisabled:l=!1})=>{let u=s||c||l;return(0,n.jsxs)(t.Box,{component:`form`,onSubmit:e=>{e.preventDefault(),!u&&r()},sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,n.jsx)(t.Stack,{spacing:2,children:e}),(0,n.jsxs)(t.Stack,{spacing:1,sx:{mt:`auto`,pt:3},children:[(0,n.jsx)(t.Button,{type:`submit`,variant:`contained`,fullWidth:!0,disabled:u,startIcon:s?(0,n.jsx)(t.CircularProgress,{size:16,color:`inherit`,"aria-hidden":`true`}):void 0,children:s?a:i}),s&&(0,n.jsx)(t.Typography,{variant:`body2`,color:`text.secondary`,role:`status`,"aria-live":`polite`,children:o})]})]})},fe=({signingProviders:e,keySigningProviders:i=[],publicKeys:a,selectedSigningProvider:o,showPrimary:s=!0,submitting:c=!1,submitLabel:l=`Add`,submittingLabel:u=`Adding...`,submittingMessage:d=`Creating party, please wait...`,onCreate:f,onSigningProviderChange:p})=>{let[m,h]=(0,r.useState)(``),[g,_]=(0,r.useState)(``),[v,y]=(0,r.useState)(!1),[b,x]=(0,r.useState)(``),S=o??g,C=!!S&&i.includes(S),w=e?.length===0,T=c||e===void 0||C&&a===void 0;return(0,n.jsx)(t.Box,{"data-testid":`wallet-create-form`,sx:{height:`100%`},children:(0,n.jsxs)(Z,{submitLabel:l,submittingLabel:u,submittingMessage:d,submitting:c,loading:T,submitDisabled:w,onSubmit:()=>{if(T||w)return;let e=a?.find(e=>e.id===b)?.name;e?f(m,S,v,e):f(m,S,v)},children:[(0,n.jsx)(t.TextField,{id:`party-id-hint`,label:`Party ID Hint`,required:!0,fullWidth:!0,placeholder:`Enter the name of your wallet?`,disabled:c,value:m,onChange:e=>h(e.target.value)}),(0,n.jsx)(J,{signingProviders:e,value:S,onChange:e=>{_(e),x(``),p?.(e)},disabled:c}),C&&(0,n.jsxs)(t.TextField,{id:`vault-name`,select:!0,label:`Vault name`,required:!0,fullWidth:!0,disabled:T,value:b,onChange:e=>x(e.target.value),slotProps:{select:{native:!0},inputLabel:{shrink:!0}},children:[(0,n.jsx)(`option`,{value:``,disabled:!0,children:T?`Loading vaults...`:`Select vault name`}),a?.map(e=>(0,n.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),s&&(0,n.jsx)(t.FormControlLabel,{label:`Set as primary wallet`,control:(0,n.jsx)(t.Checkbox,{id:`primary`,checked:v,disabled:c,onChange:e=>y(e.target.checked)})})]})})},pe=({partyId:e,signingProviders:i,disabledSigningProviders:a=[],publicKeys:o,selectedSigningProvider:s,selectedPublicKey:c,submitting:l=!1,submitLabel:u=`Edit`,submittingLabel:d=`Editing...`,submittingMessage:f=`Editing party, please wait...`,onEdit:p,onSigningProviderChange:m})=>{let[h,g]=(0,r.useState)(s??``),[_,v]=(0,r.useState)(c??``),[y,b]=(0,r.useState)(s),[x,S]=(0,r.useState)(c);s!==y&&(b(s),g(s??``)),c!==x&&(S(c),v(c??``));let C=i?.length===0,w=o===void 0,T=a.includes(h),E=l||i===void 0;return(0,n.jsxs)(Z,{submitLabel:u,submittingLabel:d,submittingMessage:f,submitting:l,loading:E,submitDisabled:C||!h||T||w,onSubmit:()=>{!E&&_&&h&&p(e,h,_)},children:[(0,n.jsx)(t.TextField,{id:`party-id`,label:`Party ID`,fullWidth:!0,disabled:!0,value:e,slotProps:{htmlInput:{readOnly:!0}}}),(0,n.jsx)(J,{signingProviders:i,value:h,onChange:e=>{g(e),v(``),m?.(e)},disabled:l,disabledProviders:a}),(0,n.jsxs)(t.TextField,{id:`public-key-id`,select:!0,label:`Public Key`,required:!0,fullWidth:!0,disabled:l,value:T?``:_,onChange:e=>v(e.target.value),slotProps:{select:{native:!0},inputLabel:{shrink:!0},...w&&{input:{startAdornment:(0,n.jsx)(t.InputAdornment,{position:`start`,children:(0,n.jsx)(t.CircularProgress,{size:16,"aria-label":`Loading public keys`})})}}},children:[(0,n.jsx)(`option`,{value:``,disabled:!0,children:w?``:T?`Select different signing provider`:`Select public key`}),o?.map(e=>(0,n.jsxs)(`option`,{value:e.publicKey,children:[e.name,` (`,e.publicKey,`)`]},e.publicKey))]})]})},me=u.keyframes`
|
|
12
|
+
from {
|
|
13
|
+
transform: rotate(0deg);
|
|
14
|
+
}
|
|
15
|
+
to {
|
|
16
|
+
transform: rotate(360deg);
|
|
17
|
+
}
|
|
18
|
+
`,he=({syncNeeded:e=!1,syncing:r=!1,disabled:i=!1,onSync:a})=>{let o=r?`Syncing parties...`:e?`Refresh parties (changes available)`:`Refresh parties`;return(0,n.jsx)(t.Tooltip,{title:o,describeChild:!0,children:(0,n.jsx)(`span`,{children:(0,n.jsx)(t.IconButton,{size:`small`,"aria-label":o,color:e?`primary`:`default`,disabled:i||r,onClick:a,children:(0,n.jsx)(l.default,{fontSize:`small`,sx:r?{animation:`${me} 1s linear infinite`,"@media (prefers-reduced-motion: reduce)":{animation:`none`}}:void 0})})})})},Q=(0,r.createContext)(null),ge=({children:e,autoHideDuration:i=5e3})=>{let[a,o]=(0,r.useState)([]),s=(0,r.useRef)(0),c=(0,r.useCallback)(e=>{o(t=>[...t,{...e,id:s.current++}])},[]),l=(0,r.useMemo)(()=>({showToast:c}),[c]);return(0,n.jsxs)(Q.Provider,{value:l,children:[e,a.length>0&&(0,n.jsx)(t.Stack,{spacing:1,sx:{position:`fixed`,right:{xs:16,sm:20},bottom:{xs:16,sm:20},zIndex:e=>e.zIndex.snackbar,width:{xs:`calc(100vw - 32px)`,sm:380},maxWidth:`calc(100vw - 32px)`,pointerEvents:`none`},children:a.map(({id:e,...t})=>(0,n.jsx)(Y,{...t,autoHideDuration:i,onExited:()=>o(t=>t.filter(t=>t.id!==e))},e))})]})},$=()=>{let e=(0,r.useContext)(Q);if(!e)throw Error(`useToast must be used within a ToastProvider`);return e},_e=()=>{let{showToast:t}=$();return(0,r.useCallback)((n,r)=>t({...e.s(n,r),type:`error`}),[t])};exports.ApiKeyCard=m,exports.ApiKeyForm=_,exports.AppHeader=b,exports.ApprovalActions=g,exports.AuthEditor=O,exports.BackLink=k,exports.CardDetailRow=p,exports.CopyButton=j,exports.ErrorPage=M,exports.IdpCard=N,exports.IdpForm=L,exports.LoadingState=ee,exports.LoginForm=B,exports.MessageDetail=te,exports.NetworkCard=ne,exports.NetworkForm=q,exports.Pagination=re,exports.SigningProviderSelect=J,exports.StatusDot=v,exports.Toast=Y,exports.ToastProvider=ge,exports.TransactionCard=ie,exports.TransactionDetail=ae,exports.WalletCard=de,exports.WalletCreateForm=fe,exports.WalletEditForm=pe,exports.WalletForm=Z,exports.WalletsSync=he,exports.defaultNavItems=y,exports.useErrorToast=_e,exports.useToast=$;
|
|
19
|
+
//# sourceMappingURL=index.cjs.map
|