@canton-network/core-wallet-ui-components 1.17.0 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -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 +9 -6
- package/dist/components/app-header.d.ts.map +1 -1
- package/dist/components/app-layout.d.ts +8 -6
- package/dist/components/app-layout.d.ts.map +1 -1
- package/dist/components/auth-editor.d.ts +5 -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 +10 -10
- package/dist/components/message-detail.d.ts.map +1 -1
- 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/page-header.d.ts +14 -0
- package/dist/components/page-header.d.ts.map +1 -0
- package/dist/components/pagination.d.ts +4 -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 +6 -5
- package/dist/components/wallet-card.d.ts.map +1 -1
- package/dist/components/wallet-create-form.d.ts +2 -2
- package/dist/components/wallet-create-form.d.ts.map +1 -1
- package/dist/components/wallet-edit-form.d.ts +3 -2
- package/dist/components/wallet-edit-form.d.ts.map +1 -1
- package/dist/components/wallet-form.d.ts +7 -7
- package/dist/components/wallet-form.d.ts.map +1 -1
- package/dist/components/wallet-list.d.ts +18 -0
- package/dist/components/wallet-list.d.ts.map +1 -0
- 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 +14 -7
- package/dist/components/wallets-sync.d.ts.map +1 -1
- package/dist/date-time.d.ts +14 -0
- package/dist/date-time.d.ts.map +1 -0
- package/dist/error-toast-By8cEMjq.cjs +4002 -0
- package/dist/error-toast-By8cEMjq.cjs.map +1 -0
- package/dist/error-toast-DQZ4SB72.js +17335 -0
- package/dist/error-toast-DQZ4SB72.js.map +1 -0
- package/dist/index.cjs +714 -4548
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +2 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2210 -12941
- package/dist/index.js.map +1 -1
- package/dist/internal/activity-render.d.ts +6 -1
- package/dist/internal/activity-render.d.ts.map +1 -1
- package/dist/internal/activity-utils.d.ts +0 -1
- package/dist/internal/activity-utils.d.ts.map +1 -1
- package/dist/internal/base-element.d.ts.map +1 -1
- package/dist/logic/index.cjs +1 -0
- package/dist/logic/index.d.ts +2 -0
- package/dist/logic/index.d.ts.map +1 -0
- package/dist/logic/index.js +1 -0
- package/dist/logic/parties.d.ts +59 -0
- package/dist/logic/parties.d.ts.map +1 -0
- package/dist/parties-B5mhMShF.js +111 -0
- package/dist/parties-B5mhMShF.js.map +1 -0
- package/dist/parties-DTtG9UJI.cjs +2 -0
- package/dist/parties-DTtG9UJI.cjs.map +1 -0
- package/dist/react/components/ApiKeyCard.d.ts +5 -7
- package/dist/react/components/ApiKeyCard.d.ts.map +1 -1
- package/dist/react/components/ApiKeyForm.d.ts +5 -7
- package/dist/react/components/ApiKeyForm.d.ts.map +1 -1
- package/dist/react/components/AppHeader.d.ts +6 -29
- package/dist/react/components/AppHeader.d.ts.map +1 -1
- package/dist/react/components/CardDetailRow.d.ts +1 -1
- package/dist/react/components/CardDetailRow.d.ts.map +1 -1
- package/dist/react/components/ErrorPage.d.ts +6 -9
- package/dist/react/components/ErrorPage.d.ts.map +1 -1
- package/dist/react/components/IdpCard.d.ts +7 -8
- package/dist/react/components/IdpCard.d.ts.map +1 -1
- package/dist/react/components/IdpForm.d.ts +8 -18
- package/dist/react/components/IdpForm.d.ts.map +1 -1
- package/dist/react/components/LoginForm.d.ts +6 -29
- package/dist/react/components/LoginForm.d.ts.map +1 -1
- package/dist/react/components/MessageDetail.d.ts +6 -26
- package/dist/react/components/MessageDetail.d.ts.map +1 -1
- package/dist/react/components/NetworkCard.d.ts +7 -12
- package/dist/react/components/NetworkCard.d.ts.map +1 -1
- package/dist/react/components/NetworkForm.d.ts +7 -16
- package/dist/react/components/NetworkForm.d.ts.map +1 -1
- package/dist/react/components/NotFound.d.ts +3 -0
- package/dist/react/components/NotFound.d.ts.map +1 -0
- package/dist/react/components/PageHeader.d.ts +3 -0
- package/dist/react/components/PageHeader.d.ts.map +1 -0
- package/dist/react/components/Pagination.d.ts +5 -12
- package/dist/react/components/Pagination.d.ts.map +1 -1
- package/dist/react/components/TransactionCard.d.ts +5 -16
- package/dist/react/components/TransactionCard.d.ts.map +1 -1
- package/dist/react/components/TransactionDetail.d.ts +6 -28
- package/dist/react/components/TransactionDetail.d.ts.map +1 -1
- package/dist/react/components/WalletCard.d.ts +8 -20
- package/dist/react/components/WalletCard.d.ts.map +1 -1
- package/dist/react/components/WalletCreateForm.d.ts +7 -34
- package/dist/react/components/WalletCreateForm.d.ts.map +1 -1
- package/dist/react/components/WalletEditForm.d.ts +7 -34
- package/dist/react/components/WalletEditForm.d.ts.map +1 -1
- package/dist/react/components/WalletList.d.ts +9 -0
- package/dist/react/components/WalletList.d.ts.map +1 -0
- package/dist/react/components/WalletsSync.d.ts +5 -12
- package/dist/react/components/WalletsSync.d.ts.map +1 -1
- package/dist/react/index.cjs +3 -11
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.ts +3 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +422 -2479
- package/dist/react/index.js.map +1 -1
- package/dist/routing.d.ts +1 -1
- package/dist/routing.d.ts.map +1 -1
- package/package.json +18 -14
- package/themes/default.css +125 -74
- package/dist/activity-utils-CsiZsTG2.cjs +0 -4
- package/dist/activity-utils-CsiZsTG2.cjs.map +0 -1
- package/dist/activity-utils-glrdQSNU.js +0 -1944
- package/dist/activity-utils-glrdQSNU.js.map +0 -1
- package/dist/react/components/AuthEditor.d.ts +0 -21
- package/dist/react/components/AuthEditor.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkCard.d.ts","sourceRoot":"","sources":["../../../src/react/components/NetworkCard.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NetworkCard.d.ts","sourceRoot":"","sources":["../../../src/react/components/NetworkCard.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EACH,WAAW,IAAI,kBAAkB,EACjC,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC9B,MAAM,kCAAkC,CAAA;AAEzC,eAAO,MAAM,WAAW;qBAKqB,SAAS,CAAC,sBAAsB,CAAC;cAChD,SAAS,CAAC,sBAAsB,CAAC;cACjC,SAAS,CAAC,sBAAsB,CAAC;EAE7D,CAAA"}
|
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/** Called with the entered network when the form is submitted */
|
|
9
|
-
onSave: (network: Network) => void;
|
|
10
|
-
/** Reviewing only. Called when "Delete Network" is clicked, with the `network` prop. The delete section is hidden when omitted */
|
|
11
|
-
onDelete?: (network: Network) => void;
|
|
12
|
-
/** Reviewing only. Called when Cancel is clicked. The button is hidden when omitted */
|
|
13
|
-
onCancel?: () => void;
|
|
14
|
-
}
|
|
15
|
-
export declare const NetworkForm: ({ network: reviewedNetwork, onSave, onDelete, onCancel, }: NetworkFormProps) => import('react').JSX.Element;
|
|
16
|
-
export {};
|
|
1
|
+
import { EventName } from '@lit/react';
|
|
2
|
+
import { NetworkForm as NetworkFormElement, NetworkEditCancelEvent, NetworkEditSaveEvent, NetworkDeleteEvent } from '../../components/network-form.js';
|
|
3
|
+
export declare const NetworkForm: import('@lit/react').ReactWebComponent<NetworkFormElement, {
|
|
4
|
+
onNetworkEditCancel: EventName<NetworkEditCancelEvent>;
|
|
5
|
+
onNetworkEditSave: EventName<NetworkEditSaveEvent>;
|
|
6
|
+
onNetworkDelete: EventName<NetworkDeleteEvent>;
|
|
7
|
+
}>;
|
|
17
8
|
//# sourceMappingURL=NetworkForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkForm.d.ts","sourceRoot":"","sources":["../../../src/react/components/NetworkForm.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NetworkForm.d.ts","sourceRoot":"","sources":["../../../src/react/components/NetworkForm.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EACH,WAAW,IAAI,kBAAkB,EACjC,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EAC1B,MAAM,kCAAkC,CAAA;AAEzC,eAAO,MAAM,WAAW;yBAMa,SAAS,CAAC,sBAAsB,CAAC;uBAEnC,SAAS,CAAC,oBAAoB,CAAC;qBACrB,SAAS,CAAC,kBAAkB,CAAC;EAExE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotFound.d.ts","sourceRoot":"","sources":["../../../src/react/components/NotFound.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAE3E,eAAO,MAAM,QAAQ,6DAInB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageHeader.d.ts","sourceRoot":"","sources":["../../../src/react/components/PageHeader.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,IAAI,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AAErF,eAAO,MAAM,UAAU,iEAIrB,CAAA"}
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/** Current 1-based page. Out-of-range values are clamped for display. @default 1 */
|
|
7
|
-
page?: number;
|
|
8
|
-
/** Called with the requested 1-based page when Previous/Next is clicked */
|
|
9
|
-
onPageChange: (page: number) => void;
|
|
10
|
-
}
|
|
11
|
-
export declare const Pagination: ({ total, pageSize, page, onPageChange, }: PaginationProps) => import('react').JSX.Element;
|
|
12
|
-
export {};
|
|
1
|
+
import { EventName } from '@lit/react';
|
|
2
|
+
import { WgPagination as WgPaginationElement, PageChangeEvent } from '../../components/pagination.js';
|
|
3
|
+
export declare const Pagination: import('@lit/react').ReactWebComponent<WgPaginationElement, {
|
|
4
|
+
onPageChange: EventName<PageChangeEvent>;
|
|
5
|
+
}>;
|
|
13
6
|
//# sourceMappingURL=Pagination.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../../src/react/components/Pagination.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../../src/react/components/Pagination.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EACH,YAAY,IAAI,mBAAmB,EACnC,KAAK,eAAe,EACvB,MAAM,gCAAgC,CAAA;AAEvC,eAAO,MAAM,UAAU;kBAKgB,SAAS,CAAC,eAAe,CAAC;EAE/D,CAAA"}
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/** e.g. 'pending', 'signed', 'executed', 'failed'. Shown as a coloured badge */
|
|
7
|
-
status: string;
|
|
8
|
-
parsed?: ParsedTransactionInfo | null;
|
|
9
|
-
createdAt?: string | null;
|
|
10
|
-
/** Disables the card, e.g. while the list is being refreshed */
|
|
11
|
-
loading?: boolean;
|
|
12
|
-
/** Called when the card is clicked */
|
|
13
|
-
onReview: (transactionId: string, commandId: string) => void;
|
|
14
|
-
}
|
|
15
|
-
export declare const TransactionCard: ({ transactionId, commandId, externalTxId, status, parsed, createdAt, loading, onReview, }: TransactionCardProps) => import('react').JSX.Element;
|
|
16
|
-
export {};
|
|
1
|
+
import { EventName } from '@lit/react';
|
|
2
|
+
import { WgTransactionCard as WgTransactionCardElement, TransactionCardReviewEvent } from '../../components/transaction-card.js';
|
|
3
|
+
export declare const TransactionCard: import('@lit/react').ReactWebComponent<WgTransactionCardElement, {
|
|
4
|
+
onTransactionReview: EventName<TransactionCardReviewEvent>;
|
|
5
|
+
}>;
|
|
17
6
|
//# sourceMappingURL=TransactionCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionCard.d.ts","sourceRoot":"","sources":["../../../src/react/components/TransactionCard.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TransactionCard.d.ts","sourceRoot":"","sources":["../../../src/react/components/TransactionCard.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EACH,iBAAiB,IAAI,wBAAwB,EAC7C,KAAK,0BAA0B,EAClC,MAAM,sCAAsC,CAAA;AAE7C,eAAO,MAAM,eAAe;yBAMQ,SAAS,CAAC,0BAA0B,CAAC;EAEvE,CAAA"}
|
|
@@ -1,29 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
txHash?: string;
|
|
8
|
-
parsed?: ParsedTransactionInfo | null;
|
|
9
|
-
createdAt?: string | null;
|
|
10
|
-
/** Shows a "Back" link to this URL. The link is hidden when omitted */
|
|
11
|
-
backHref?: string;
|
|
12
|
-
/** Shows progress on "Approve" and disables both buttons @default false */
|
|
13
|
-
approving?: boolean;
|
|
14
|
-
/** Shows progress on "Reject" and disables both buttons @default false */
|
|
15
|
-
rejecting?: boolean;
|
|
16
|
-
/** Shows progress on "Approve" and disables it. "Reject" stays available, so a transaction can still be turned down while it is signed @default false */
|
|
17
|
-
signing?: boolean;
|
|
18
|
-
/** The last submit of a signed transaction failed: "Approve" becomes "Retry submit" @default false */
|
|
19
|
-
submitFailed?: boolean;
|
|
20
|
-
/** Disables both buttons, whatever the status @default false */
|
|
21
|
-
disabled?: boolean;
|
|
22
|
-
/** Called when "Approve" (or "Retry submit") is clicked */
|
|
23
|
-
onApprove: (commandId: string) => void;
|
|
24
|
-
/** Called when "Reject" is clicked. The button is hidden when omitted */
|
|
25
|
-
onReject?: (commandId: string) => void;
|
|
26
|
-
}
|
|
27
|
-
export declare const TransactionDetail: ({ commandId, externalTxId, status, txHash, parsed, createdAt, backHref, approving, rejecting, signing, submitFailed, disabled, onApprove, onReject, }: TransactionDetailProps) => import('react').JSX.Element;
|
|
28
|
-
export {};
|
|
1
|
+
import { EventName } from '@lit/react';
|
|
2
|
+
import { WgTransactionDetail as WgTransactionDetailElement, TransactionApproveEvent, TransactionDeleteEvent } from '../../components/transaction-detail.js';
|
|
3
|
+
export declare const TransactionDetail: import('@lit/react').ReactWebComponent<WgTransactionDetailElement, {
|
|
4
|
+
onTransactionApprove: EventName<TransactionApproveEvent>;
|
|
5
|
+
onTransactionDelete: EventName<TransactionDeleteEvent>;
|
|
6
|
+
}>;
|
|
29
7
|
//# sourceMappingURL=TransactionDetail.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionDetail.d.ts","sourceRoot":"","sources":["../../../src/react/components/TransactionDetail.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"TransactionDetail.d.ts","sourceRoot":"","sources":["../../../src/react/components/TransactionDetail.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EACH,mBAAmB,IAAI,0BAA0B,EACjD,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC9B,MAAM,wCAAwC,CAAA;AAE/C,eAAO,MAAM,iBAAiB;0BAMO,SAAS,CAAC,uBAAuB,CAAC;yBAEnC,SAAS,CAAC,sBAAsB,CAAC;EAEnE,CAAA"}
|
|
@@ -1,21 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
onAllocate?: (wallet: Wallet) => void;
|
|
10
|
-
/** Called when "Set as primary" is clicked (verified, non-primary, enabled wallets). The button is hidden when omitted */
|
|
11
|
-
onSetPrimary?: (wallet: Wallet) => void;
|
|
12
|
-
/** Called when "Edit" is clicked (verified wallets). The button is hidden when omitted */
|
|
13
|
-
onEdit?: (wallet: Wallet) => void;
|
|
14
|
-
/** Called when the select button is clicked. When set, it replaces all other actions and the badge */
|
|
15
|
-
onSelect?: (wallet: Wallet) => void;
|
|
16
|
-
/** Label of the select button @default 'Select' */
|
|
17
|
-
selectLabel?: string;
|
|
18
|
-
}
|
|
19
|
-
export declare const WalletCard: ({ wallet, verified, loading, onAllocate, onSetPrimary, onEdit, onSelect, selectLabel, }: WalletCardProps) => import('react').JSX.Element;
|
|
20
|
-
export {};
|
|
1
|
+
import { EventName } from '@lit/react';
|
|
2
|
+
import { WgWalletCard as WgWalletCardElement, WalletSetPrimaryEvent, WalletCardEditEvent, WalletAllocateEvent, WalletCardSelectEvent } from '../../components/wallet-card.js';
|
|
3
|
+
export declare const WalletCard: import('@lit/react').ReactWebComponent<WgWalletCardElement, {
|
|
4
|
+
onWalletSetPrimary: EventName<WalletSetPrimaryEvent>;
|
|
5
|
+
onWalletEdit: EventName<WalletCardEditEvent>;
|
|
6
|
+
onWalletAllocate: EventName<WalletAllocateEvent>;
|
|
7
|
+
onWalletSelect: EventName<WalletCardSelectEvent>;
|
|
8
|
+
}>;
|
|
21
9
|
//# sourceMappingURL=WalletCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WalletCard.d.ts","sourceRoot":"","sources":["../../../src/react/components/WalletCard.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"WalletCard.d.ts","sourceRoot":"","sources":["../../../src/react/components/WalletCard.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EACH,YAAY,IAAI,mBAAmB,EACnC,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC7B,MAAM,iCAAiC,CAAA;AAExC,eAAO,MAAM,UAAU;wBAMa,SAAS,CAAC,qBAAqB,CAAC;kBAC7B,SAAS,CAAC,mBAAmB,CAAC;sBACtB,SAAS,CAAC,mBAAmB,CAAC;oBAClC,SAAS,CAAC,qBAAqB,CAAC;EAEzE,CAAA"}
|
|
@@ -1,35 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* The keys offered for `keySigningProviders`: load them when
|
|
9
|
-
* `onSigningProviderChange` reports such a provider. `undefined` while they
|
|
10
|
-
* are loading, which disables the form once one of those providers is selected
|
|
11
|
-
*/
|
|
12
|
-
publicKeys?: Key[] | undefined;
|
|
13
|
-
/** The selected signing provider. Pass it, together with `onSigningProviderChange`, to control the selection; without it the form keeps its own */
|
|
14
|
-
selectedSigningProvider?: string;
|
|
15
|
-
/** Offers the "Set as primary wallet" checkbox @default true */
|
|
16
|
-
showPrimary?: boolean;
|
|
17
|
-
/** Disables the form and shows `submittingLabel` and `submittingMessage` @default false */
|
|
18
|
-
submitting?: boolean;
|
|
19
|
-
/** @default 'Add' */
|
|
20
|
-
submitLabel?: string;
|
|
21
|
-
/** @default 'Adding...' */
|
|
22
|
-
submittingLabel?: string;
|
|
23
|
-
/** @default 'Creating party, please wait...' */
|
|
24
|
-
submittingMessage?: string;
|
|
25
|
-
/**
|
|
26
|
-
* Called when the form is submitted. `keyName` is the name of the chosen
|
|
27
|
-
* key, for the signing providers that have keys
|
|
28
|
-
*/
|
|
29
|
-
onCreate: (partyHint: PartyHint, signingProviderId: SigningProviderId, primary: boolean, keyName?: KeyName) => void;
|
|
30
|
-
/** Called when another signing provider is chosen */
|
|
31
|
-
onSigningProviderChange?: (signingProviderId: SigningProviderId) => void;
|
|
32
|
-
}
|
|
33
|
-
export declare const WalletCreateForm: ({ signingProviders, keySigningProviders, publicKeys, selectedSigningProvider, showPrimary, submitting, submitLabel, submittingLabel, submittingMessage, onCreate, onSigningProviderChange, }: WalletCreateFormProps) => import('react').JSX.Element;
|
|
34
|
-
export {};
|
|
1
|
+
import { EventName } from '@lit/react';
|
|
2
|
+
import { WgWalletCreateForm as WgWalletCreateFormElement, WalletCreateEvent } from '../../components/wallet-create-form.js';
|
|
3
|
+
import { SigningProviderChangeEvent } from '../../components/wallet-form.js';
|
|
4
|
+
export declare const WalletCreateForm: import('@lit/react').ReactWebComponent<WgWalletCreateFormElement, {
|
|
5
|
+
onWalletCreate: EventName<WalletCreateEvent>;
|
|
6
|
+
onSigningProviderChange: EventName<SigningProviderChangeEvent>;
|
|
7
|
+
}>;
|
|
35
8
|
//# sourceMappingURL=WalletCreateForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WalletCreateForm.d.ts","sourceRoot":"","sources":["../../../src/react/components/WalletCreateForm.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"WalletCreateForm.d.ts","sourceRoot":"","sources":["../../../src/react/components/WalletCreateForm.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EACH,kBAAkB,IAAI,yBAAyB,EAC/C,KAAK,iBAAiB,EACzB,MAAM,wCAAwC,CAAA;AAC/C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA;AAEjF,eAAO,MAAM,gBAAgB;oBAKc,SAAS,CAAC,iBAAiB,CAAC;6BAE9B,SAAS,CAAC,0BAA0B,CAAC;EAE5E,CAAA"}
|
|
@@ -1,35 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 {};
|
|
1
|
+
import { EventName } from '@lit/react';
|
|
2
|
+
import { WgWalletEditForm as WgWalletEditFormElement, WalletEditEvent } from '../../components/wallet-edit-form.js';
|
|
3
|
+
import { SigningProviderChangeEvent } from '../../components/wallet-form.js';
|
|
4
|
+
export declare const WalletEditForm: import('@lit/react').ReactWebComponent<WgWalletEditFormElement, {
|
|
5
|
+
onWalletEdit: EventName<WalletEditEvent>;
|
|
6
|
+
onSigningProviderChange: EventName<SigningProviderChangeEvent>;
|
|
7
|
+
}>;
|
|
35
8
|
//# sourceMappingURL=WalletEditForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WalletEditForm.d.ts","sourceRoot":"","sources":["../../../src/react/components/WalletEditForm.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"WalletEditForm.d.ts","sourceRoot":"","sources":["../../../src/react/components/WalletEditForm.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EACH,gBAAgB,IAAI,uBAAuB,EAC3C,KAAK,eAAe,EACvB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA;AAEjF,eAAO,MAAM,cAAc;kBAKY,SAAS,CAAC,eAAe,CAAC;6BAExB,SAAS,CAAC,0BAA0B,CAAC;EAE5E,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EventName } from '@lit/react';
|
|
2
|
+
import { WgWalletList as WgWalletListElement } from '../../components/wallet-list.js';
|
|
3
|
+
import { WalletAllocateEvent, WalletCardEditEvent, WalletSetPrimaryEvent } from '../../components/wallet-card.js';
|
|
4
|
+
export declare const WalletList: import('@lit/react').ReactWebComponent<WgWalletListElement, {
|
|
5
|
+
onWalletAllocate: EventName<WalletAllocateEvent>;
|
|
6
|
+
onWalletEdit: EventName<WalletCardEditEvent>;
|
|
7
|
+
onWalletSetPrimary: EventName<WalletSetPrimaryEvent>;
|
|
8
|
+
}>;
|
|
9
|
+
//# sourceMappingURL=WalletList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalletList.d.ts","sourceRoot":"","sources":["../../../src/react/components/WalletList.ts"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAE,YAAY,IAAI,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AACrF,OAAO,KAAK,EACR,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACxB,MAAM,iCAAiC,CAAA;AAExC,eAAO,MAAM,UAAU;sBAKwB,SAAS,CAAC,mBAAmB,CAAC;kBACtC,SAAS,CAAC,mBAAmB,CAAC;wBAEjC,SAAS,CAAC,qBAAqB,CAAC;EAElE,CAAA"}
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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 {};
|
|
1
|
+
import { EventName } from '@lit/react';
|
|
2
|
+
import { WgWalletsSync as WgWalletsSyncElement, WalletsSyncEvent } from '../../components/wallets-sync.js';
|
|
3
|
+
export declare const WalletsSync: import('@lit/react').ReactWebComponent<WgWalletsSyncElement, {
|
|
4
|
+
onWalletsSync: EventName<WalletsSyncEvent>;
|
|
5
|
+
}>;
|
|
13
6
|
//# sourceMappingURL=WalletsSync.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WalletsSync.d.ts","sourceRoot":"","sources":["../../../src/react/components/WalletsSync.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WalletsSync.d.ts","sourceRoot":"","sources":["../../../src/react/components/WalletsSync.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EACH,aAAa,IAAI,oBAAoB,EACrC,KAAK,gBAAgB,EACxB,MAAM,kCAAkC,CAAA;AAEzC,eAAO,MAAM,WAAW;mBAKiB,SAAS,CAAC,gBAAgB,CAAC;EAElE,CAAA"}
|
package/dist/react/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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`
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../error-toast-By8cEMjq.cjs");let t=require("react");t=e.Lt(t,1);let n=require("@lit/react"),r=require("@mui/material"),i=require("react/jsx-runtime"),a=require("@mui/icons-material/ChevronLeft");a=e.Lt(a,1);let o=require("@mui/icons-material/ContentCopy");o=e.Lt(o,1);let s=require("@mui/material/styles");var c=(0,n.createComponent)({tagName:`api-key-card`,elementClass:e.Mt,react:t.default,events:{onRevoke:`revoke`}}),l=()=>(0,i.jsx)(r.CircularProgress,{size:16,color:`inherit`,"aria-hidden":`true`}),u=({onApprove:e,onReject:t,approveLabel:n=`Approve`,approving:a=!1,rejecting:o=!1,signing:s=!1,disabled:c=!1})=>(0,i.jsxs)(r.Stack,{direction:`row`,spacing:2,children:[t&&(0,i.jsx)(r.Button,{variant:`outlined`,color:`error`,fullWidth:!0,disabled:c||a||o,startIcon:o?(0,i.jsx)(l,{}):void 0,onClick:t,children:`Reject`}),(0,i.jsx)(r.Button,{variant:`contained`,fullWidth:!0,disabled:c||a||o||s,startIcon:a||s?(0,i.jsx)(l,{}):void 0,onClick:e,children:n})]}),d=(0,n.createComponent)({tagName:`api-key-form`,elementClass:e.At,react:t.default,events:{onApiKeyGenerate:`api-key-generate`}}),f=(0,n.createComponent)({tagName:`app-header`,elementClass:e.vt,react:t.default,events:{onLogout:`logout`,onCopyDappApiUrl:`copy-dapp-api-url`}}),p=({label:e=`Back`,href:t,onClick:n})=>(0,i.jsx)(r.Button,{color:`inherit`,size:`small`,startIcon:(0,i.jsx)(a.default,{}),...t===void 0?{onClick:n}:{href:t},children:e}),m=({label:e,value:t,title:n=typeof t==`string`?t:void 0,muted:a=!1,action:o})=>{let s=typeof t==`string`;return(0,i.jsxs)(r.Box,{sx:{display:`flex`,alignItems:`center`,gap:2,minWidth:0,minHeight:40},children:[(0,i.jsx)(r.Typography,{variant:`body2`,noWrap:!0,sx:{fontWeight:`bold`,flexShrink:0,minWidth:`8rem`},children:e}),(0,i.jsx)(r.Typography,{variant:`body2`,component:`div`,noWrap:s,title:s?n: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:t}),o&&(0,i.jsx)(r.Box,{sx:{position:`relative`,zIndex:1,flexShrink:0},children:o})]})},h=e.j([`core`,`wallet-ui-components/react`]),g=({onCopy:e,value:n,label:a=`Copy to clipboard`})=>{let[s,c]=(0,t.useState)(!1),l=(0,t.useRef)(void 0);return(0,t.useEffect)(()=>()=>clearTimeout(l.current),[]),(0,i.jsx)(r.Tooltip,{title:s?`Copied`:a,children:(0,i.jsx)(r.IconButton,{"aria-label":a,onClick:async t=>{if(t.stopPropagation(),n)try{if(navigator.clipboard?.writeText)await navigator.clipboard.writeText(n);else throw Error(`Browser does not support clipboard functionality.`);e!==void 0&&e(n),clearTimeout(l.current),l.current=setTimeout(()=>c(!1),1200),c(!0)}catch(e){h.getChild(`CopyButton`).error(`Unable to copy value`,{error:e})}},children:(0,i.jsx)(o.default,{color:s?`success`:`inherit`})})})},_=(0,n.createComponent)({tagName:`wg-error-page`,elementClass:e.ft,react:t.default,events:{onErrorBack:`error-back`,onErrorRefresh:`error-refresh`}}),v=(0,n.createComponent)({tagName:`idp-card`,elementClass:e.ot,react:t.default,events:{onIdpReview:`idp-review`,onDelete:`delete`,onUpdate:`update`}}),y=(0,n.createComponent)({tagName:`idp-form`,elementClass:e.nt,react:t.default,events:{onIdpFormSave:`idp-form-save`,onIdpFormDelete:`idp-form-delete`,onIdpFormCancel:`idp-form-cancel`,onIdpFormBack:`idp-form-back`}}),b=s.keyframes`
|
|
2
2
|
0%, 80%, 100% {
|
|
3
3
|
transform: scale(0.7);
|
|
4
4
|
opacity: 0.4;
|
|
@@ -7,13 +7,5 @@
|
|
|
7
7
|
transform: scale(1);
|
|
8
8
|
opacity: 1;
|
|
9
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
|
-
|
|
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
|
|
10
|
+
`,x=({text:e=`Loading`})=>(0,i.jsxs)(r.Stack,{role:`status`,"aria-live":`polite`,spacing:2,sx:{minHeight:180,justifyContent:`center`,alignItems:`center`,p:3},children:[(0,i.jsx)(r.Stack,{direction:`row`,spacing:1,"aria-hidden":`true`,children:[0,1,2].map(e=>(0,i.jsx)(r.Box,{sx:{width:8,height:8,borderRadius:`50%`,bgcolor:`primary.main`,animation:`${b} 1s infinite ease-in-out`,animationDelay:`${e*.15}s`,"@media (prefers-reduced-motion: reduce)":{animation:`none`}}},e))}),(0,i.jsx)(r.Typography,{variant:`body1`,color:`text.secondary`,children:e})]}),S=(0,n.createComponent)({tagName:`wg-login-form`,elementClass:e.f,react:t.default,events:{onLoginConnect:`login-connect`,onLoginBack:`login-back`}}),C=(0,n.createComponent)({tagName:`wg-message-detail`,elementClass:e.i,react:t.default,events:{onMessageApprove:`message-approve`,onMessageDelete:`message-delete`}}),w=(0,n.createComponent)({tagName:`network-card`,elementClass:e.Z,react:t.default,events:{onNetworkReview:`network-review`,onDelete:`delete`,onUpdate:`update`}}),T=(0,n.createComponent)({tagName:`network-form`,elementClass:e.A,react:t.default,events:{onNetworkEditCancel:`network-edit-cancel`,onNetworkEditSave:`network-edit-save`,onNetworkDelete:`network-delete`}}),E=(0,n.createComponent)({tagName:`not-found`,elementClass:e.E,react:t.default}),D=(0,n.createComponent)({tagName:`wg-page-header`,elementClass:e.lt,react:t.default}),O=(0,n.createComponent)({tagName:`wg-pagination`,elementClass:e.ct,react:t.default,events:{onPageChange:`page-change`}}),k=({signingProviders:e,value:t,onChange:n,disabled:a=!1,disabledProviders:o=[]})=>{let s=e===void 0,c=e?.length===0;return(0,i.jsxs)(r.TextField,{id:`signing-provider-id`,select:!0,label:`Signing Provider`,required:!0,fullWidth:!0,value:t,disabled:a||s||c,onChange:e=>n(e.target.value),slotProps:{select:{native:!0},inputLabel:{shrink:!0}},children:[(0,i.jsx)(`option`,{value:``,disabled:!0,children:s?`Loading signing providers...`:c?`No signing providers available`:`Select signing provider`}),e?.map(e=>(0,i.jsx)(`option`,{value:e,disabled:o.includes(e),children:e},e))]})},A=({title:e,message:n,type:a=`error`,buttonText:o=`Dismiss notification`,autoHideDuration:s,onExited:c})=>{let[l,u]=(0,t.useState)(!0);return(0,i.jsx)(r.Snackbar,{open:l,autoHideDuration:s,onClose:(e,t)=>{t!==`clickaway`&&u(!1)},slotProps:{transition:{onExited:()=>c?.()}},sx:{position:`static`,pointerEvents:`auto`},children:(0,i.jsxs)(r.Alert,{role:a===`error`?`alert`:`status`,severity:a,closeText:o,onClose:()=>u(!1),sx:{width:`100%`},children:[(0,i.jsx)(r.AlertTitle,{children:e}),n]})})},j=(0,n.createComponent)({tagName:`wg-transaction-card`,elementClass:e.l,react:t.default,events:{onTransactionReview:`transaction-review`}}),M=(0,n.createComponent)({tagName:`wg-transaction-detail`,elementClass:e.s,react:t.default,events:{onTransactionApprove:`transaction-approve`,onTransactionDelete:`transaction-delete`}}),N=(0,n.createComponent)({tagName:`wg-wallet-card`,elementClass:e.C,react:t.default,events:{onWalletSetPrimary:`wallet-set-primary`,onWalletEdit:`wallet-edit`,onWalletAllocate:`wallet-allocate`,onWalletSelect:`wallet-select`}}),P=(0,n.createComponent)({tagName:`wg-wallet-create-form`,elementClass:e.g,react:t.default,events:{onWalletCreate:`wallet-create`,onSigningProviderChange:`signing-provider-change`}}),F=(0,n.createComponent)({tagName:`wg-wallet-edit-form`,elementClass:e.m,react:t.default,events:{onWalletEdit:`wallet-edit`,onSigningProviderChange:`signing-provider-change`}}),I=({children:e,onSubmit:t,submitLabel:n,submittingLabel:a,submittingMessage:o,submitting:s=!1,loading:c=!1,submitDisabled:l=!1})=>{let u=s||c||l;return(0,i.jsxs)(r.Box,{component:`form`,onSubmit:e=>{e.preventDefault(),u||t()},sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,i.jsx)(r.Stack,{spacing:2,children:e}),(0,i.jsxs)(r.Stack,{spacing:1,sx:{mt:`auto`,pt:3},children:[(0,i.jsx)(r.Button,{type:`submit`,variant:`contained`,fullWidth:!0,disabled:u,startIcon:s?(0,i.jsx)(r.CircularProgress,{size:16,color:`inherit`,"aria-hidden":`true`}):void 0,children:s?a:n}),s&&(0,i.jsx)(r.Typography,{variant:`body2`,color:`text.secondary`,role:`status`,"aria-live":`polite`,children:o})]})]})},L=(0,n.createComponent)({tagName:`wg-wallet-list`,elementClass:e.v,react:t.default,events:{onWalletAllocate:`wallet-allocate`,onWalletEdit:`wallet-edit`,onWalletSetPrimary:`wallet-set-primary`}}),R=(0,n.createComponent)({tagName:`wg-wallets-sync`,elementClass:e.T,react:t.default,events:{onWalletsSync:`wallets-sync`}}),z=(0,t.createContext)(null),B=({children:e,autoHideDuration:n=5e3})=>{let[a,o]=(0,t.useState)([]),s=(0,t.useRef)(0),c=(0,t.useCallback)(e=>{o(t=>[...t,{...e,id:s.current++}])},[]),l=(0,t.useMemo)(()=>({showToast:c}),[c]);return(0,i.jsxs)(z.Provider,{value:l,children:[e,a.length>0&&(0,i.jsx)(r.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,i.jsx)(A,{...t,autoHideDuration:n,onExited:()=>o(t=>t.filter(t=>t.id!==e))},e))})]})},V=()=>{let e=(0,t.useContext)(z);if(!e)throw Error(`useToast must be used within a ToastProvider`);return e},H=()=>{let{showToast:n}=V();return(0,t.useCallback)((t,r)=>n({...e.t(t,r),type:`error`}),[n])};exports.ApiKeyCard=c,exports.ApiKeyForm=d,exports.AppHeader=f,exports.ApprovalActions=u,exports.BackLink=p,exports.CardDetailRow=m,exports.CopyButton=g,exports.ErrorPage=_,exports.IdpCard=v,exports.IdpForm=y,exports.LoadingState=x,exports.LoginForm=S,exports.MessageDetail=C,exports.NetworkCard=w,exports.NetworkForm=T,exports.NotFound=E,exports.PageHeader=D,exports.Pagination=O,exports.SigningProviderSelect=k,exports.Toast=A,exports.ToastProvider=B,exports.TransactionCard=j,exports.TransactionDetail=M,exports.WalletCard=N,exports.WalletCreateForm=P,exports.WalletEditForm=F,exports.WalletForm=I,exports.WalletList=L,exports.WalletsSync=R,exports.useErrorToast=H,exports.useToast=V;
|
|
11
|
+
//# sourceMappingURL=index.cjs.map
|