@tuwaio/nova-transactions 0.4.2 → 0.4.4
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/{TransactionsInfoModal-EKgcn7Ot.d.cts → TransactionsInfoModal-Cd6hZioh.d.cts} +229 -6
- package/dist/{TransactionsInfoModal-EKgcn7Ot.d.ts → TransactionsInfoModal-Cd6hZioh.d.ts} +229 -6
- package/dist/chunk-DC5FYE4N.cjs +2 -0
- package/dist/chunk-IJMNYPXP.js +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +59 -0
- package/dist/index.d.cts +49 -10
- package/dist/index.d.ts +49 -10
- package/dist/index.js +1 -1
- package/dist/providers/index.cjs +1 -1
- package/dist/providers/index.d.cts +70 -4
- package/dist/providers/index.d.ts +70 -4
- package/dist/providers/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-66O24XG2.cjs +0 -2
- package/dist/chunk-QNGBNGYN.js +0 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ToastCloseButtonProps, DialogContent } from '@tuwaio/nova-core';
|
|
3
3
|
import { TransactionStatus, Transaction, TxAdapter, TransactionPool, TxInMemoryPagination, ITxTrackingStore, InitialTransaction } from '@tuwaio/pulsar-core';
|
|
4
|
-
import { ReactNode, ComponentType,
|
|
4
|
+
import { ReactNode, ComponentType, ComponentPropsWithoutRef, JSX } from 'react';
|
|
5
5
|
import { OrbitAdapter, TuwaErrorState } from '@tuwaio/orbit-core';
|
|
6
|
-
import {
|
|
6
|
+
import { ToastContentProps, ToastContainerProps } from 'react-toastify';
|
|
7
7
|
import { MotionProps } from 'framer-motion';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -64,6 +64,171 @@ type StatusAwareTextProps = {
|
|
|
64
64
|
*/
|
|
65
65
|
declare function StatusAwareText({ txStatus, source, fallback, variant, className, applyColor, }: StatusAwareTextProps): ReactNode;
|
|
66
66
|
|
|
67
|
+
/**
|
|
68
|
+
* @file Contains the `ToastValidationError` component, a top-center error toast
|
|
69
|
+
* that fires when `executeTxAction` throws **before** the transaction is added
|
|
70
|
+
* to the pool — e.g., when input metadata fails Pulsar's validation rules or
|
|
71
|
+
* when a `beforeTxProcess` preflight check rejects.
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
/** Props forwarded to a custom icon component inside `ToastValidationError`. */
|
|
75
|
+
type ToastValidationErrorIconProps = {
|
|
76
|
+
/** Whether the error text has already been copied to the clipboard. */
|
|
77
|
+
isCopied: boolean;
|
|
78
|
+
/** Optional additional CSS classes. */
|
|
79
|
+
className?: string;
|
|
80
|
+
/** Whether the element is decorative (aria-hidden). */
|
|
81
|
+
'aria-hidden'?: boolean;
|
|
82
|
+
};
|
|
83
|
+
/** Props forwarded to a custom title component inside `ToastValidationError`. */
|
|
84
|
+
type ToastValidationErrorTitleProps = {
|
|
85
|
+
/** The resolved title string (from labels or prop override). */
|
|
86
|
+
title: string;
|
|
87
|
+
/** Optional additional CSS classes. */
|
|
88
|
+
className?: string;
|
|
89
|
+
};
|
|
90
|
+
/** Props forwarded to a custom field badge component inside `ToastValidationError`. */
|
|
91
|
+
type ToastValidationErrorFieldProps = {
|
|
92
|
+
/** The human-readable label prefix (e.g., "Field"). */
|
|
93
|
+
fieldLabel: string;
|
|
94
|
+
/** The actual field identifier that failed validation (e.g., "title"). */
|
|
95
|
+
fieldName: string;
|
|
96
|
+
/** Optional additional CSS classes. */
|
|
97
|
+
className?: string;
|
|
98
|
+
};
|
|
99
|
+
/** Props forwarded to a custom message component inside `ToastValidationError`. */
|
|
100
|
+
type ToastValidationErrorMessageProps = {
|
|
101
|
+
/** The error message string. */
|
|
102
|
+
message: string;
|
|
103
|
+
/** Optional additional CSS classes. */
|
|
104
|
+
className?: string;
|
|
105
|
+
};
|
|
106
|
+
/** Props forwarded to a custom copy-button content component. */
|
|
107
|
+
type ToastValidationErrorCopyContentProps = {
|
|
108
|
+
/** The icon element to render inside the button. */
|
|
109
|
+
icon: ReactNode;
|
|
110
|
+
/** Whether the text has been copied. */
|
|
111
|
+
isCopied: boolean;
|
|
112
|
+
/** The label to show before copying. */
|
|
113
|
+
copyLabel: string;
|
|
114
|
+
/** The label to show after a successful copy. */
|
|
115
|
+
copiedLabel: string;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Granular class name overrides for every sub-element of `ToastValidationError`.
|
|
119
|
+
* All keys are optional — omit any key to keep the default Tailwind classes.
|
|
120
|
+
*/
|
|
121
|
+
type ToastValidationErrorClassNames = {
|
|
122
|
+
/** Classes applied to the outermost container `<div>`. */
|
|
123
|
+
container?: string;
|
|
124
|
+
/** Classes applied to the header row (icon + title + copy button). */
|
|
125
|
+
header?: string;
|
|
126
|
+
/** Classes applied to the title/icon wrapper. */
|
|
127
|
+
titleWrapper?: string;
|
|
128
|
+
/** Classes applied to the `<ExclamationTriangleIcon>` (or custom icon). */
|
|
129
|
+
icon?: string;
|
|
130
|
+
/** Classes applied to the title text node. */
|
|
131
|
+
title?: string;
|
|
132
|
+
/** Classes applied to the field badge pill. */
|
|
133
|
+
fieldBadge?: string;
|
|
134
|
+
/** Classes applied to the scrollable message container. */
|
|
135
|
+
messageContainer?: string;
|
|
136
|
+
/** Classes applied to the mono message `<p>`. */
|
|
137
|
+
messageText?: string;
|
|
138
|
+
/** Classes applied to the copy button. */
|
|
139
|
+
copyButton?: string;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Customization options for `ToastValidationError`.
|
|
143
|
+
*
|
|
144
|
+
* All keys are optional. Provide only what you want to override — defaults
|
|
145
|
+
* follow the same visual language as the rest of `nova-transactions`.
|
|
146
|
+
*/
|
|
147
|
+
type ToastValidationErrorCustomization = {
|
|
148
|
+
/**
|
|
149
|
+
* Replace any default sub-component with your own.
|
|
150
|
+
* Each slot receives the same props the default component does,
|
|
151
|
+
* so you can wrap or fully replace the rendering.
|
|
152
|
+
*/
|
|
153
|
+
components?: {
|
|
154
|
+
/** Custom warning icon (top-left of the header). */
|
|
155
|
+
Icon?: ComponentType<ToastValidationErrorIconProps>;
|
|
156
|
+
/** Custom title renderer. */
|
|
157
|
+
Title?: ComponentType<ToastValidationErrorTitleProps>;
|
|
158
|
+
/** Custom field-badge renderer (shown only when `fieldName` is provided). */
|
|
159
|
+
FieldBadge?: ComponentType<ToastValidationErrorFieldProps>;
|
|
160
|
+
/** Custom error message renderer. */
|
|
161
|
+
Message?: ComponentType<ToastValidationErrorMessageProps>;
|
|
162
|
+
/** Custom inner content for the copy button (icon + label). */
|
|
163
|
+
CopyContent?: ComponentType<ToastValidationErrorCopyContentProps>;
|
|
164
|
+
};
|
|
165
|
+
/** Override native HTML props on the root container. */
|
|
166
|
+
containerProps?: Partial<Omit<ComponentPropsWithoutRef<'div'>, 'style'>>;
|
|
167
|
+
/** Override native HTML props on the copy button. */
|
|
168
|
+
buttonProps?: Partial<Omit<ComponentPropsWithoutRef<'button'>, 'style'>>;
|
|
169
|
+
/** Granular Tailwind class overrides for every sub-element. */
|
|
170
|
+
classNames?: ToastValidationErrorClassNames;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Props accepted by the `ToastValidationError` component.
|
|
174
|
+
*/
|
|
175
|
+
type ToastValidationErrorProps = {
|
|
176
|
+
/**
|
|
177
|
+
* The human-readable error message to display.
|
|
178
|
+
* Typically `error.message` from the caught `Error`.
|
|
179
|
+
*/
|
|
180
|
+
message: string;
|
|
181
|
+
/**
|
|
182
|
+
* The raw error text that will be written to the clipboard.
|
|
183
|
+
* Falls back to `message` when not provided.
|
|
184
|
+
*/
|
|
185
|
+
rawError?: string;
|
|
186
|
+
/**
|
|
187
|
+
* The name of the field that triggered the validation failure.
|
|
188
|
+
* When provided (e.g. `"title"`, `"description"`), a small badge is rendered
|
|
189
|
+
* below the header so users know exactly which input to fix.
|
|
190
|
+
* Omit for generic pre-flight errors (`beforeTxProcess` rejections).
|
|
191
|
+
*/
|
|
192
|
+
fieldName?: string;
|
|
193
|
+
/** Optional additional CSS class on the outermost container. */
|
|
194
|
+
className?: string;
|
|
195
|
+
/**
|
|
196
|
+
* Injected by `react-toastify` when used as toast content.
|
|
197
|
+
* Calling it programmatically closes this specific toast instance.
|
|
198
|
+
*/
|
|
199
|
+
closeToast?: ToastContentProps['closeToast'];
|
|
200
|
+
/** Full customization override object. */
|
|
201
|
+
customization?: ToastValidationErrorCustomization;
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* `ToastValidationError` is a self-contained toast body for pre-submission errors.
|
|
205
|
+
*
|
|
206
|
+
* It is designed to be rendered inside a `react-toastify` `ToastContainer` with
|
|
207
|
+
* `position="top-center"` and `autoClose={6000}` / `pauseOnHover`. The visual
|
|
208
|
+
* language mirrors `TxErrorBlock` and `nova-connect`'s `ToastError`:
|
|
209
|
+
*
|
|
210
|
+
* - Error color tokens (`--tuwa-error-*`)
|
|
211
|
+
* - `ExclamationTriangleIcon` header icon
|
|
212
|
+
* - Optional field badge identifying the offending input
|
|
213
|
+
* - Scrollable monospace message body
|
|
214
|
+
* - One-click copy-to-clipboard with feedback
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```tsx
|
|
218
|
+
* toast(
|
|
219
|
+
* (props) => (
|
|
220
|
+
* <ToastValidationError
|
|
221
|
+
* {...props}
|
|
222
|
+
* message={error.message}
|
|
223
|
+
* fieldName={(error as PulsarTransactionValidationError).field}
|
|
224
|
+
* />
|
|
225
|
+
* ),
|
|
226
|
+
* { containerId: 'nova-validation-errors', type: 'error' }
|
|
227
|
+
* );
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
declare function ToastValidationError({ message, rawError, fieldName, className, customization, }: ToastValidationErrorProps): JSX.Element;
|
|
231
|
+
|
|
67
232
|
/**
|
|
68
233
|
* @file This file defines the TypeScript type for the library's internationalization (i18n) labels.
|
|
69
234
|
* It provides a strict structure for all text used in the UI components, ensuring type safety for different languages.
|
|
@@ -143,6 +308,21 @@ type NovaTransactionsLabels = {
|
|
|
143
308
|
/** Confirmation text shown after copying an error message. */
|
|
144
309
|
copied: string;
|
|
145
310
|
};
|
|
311
|
+
/**
|
|
312
|
+
* Labels for the pre-submission validation error toast.
|
|
313
|
+
* This toast fires when `executeTxAction` throws before the transaction
|
|
314
|
+
* is added to the pool (e.g., validation failure, `beforeTxProcess` rejection).
|
|
315
|
+
*/
|
|
316
|
+
validationError: {
|
|
317
|
+
/** The main title shown in the toast header. */
|
|
318
|
+
title: string;
|
|
319
|
+
/** Prefix label for the field that caused the validation failure, e.g. "Field: title". */
|
|
320
|
+
field: string;
|
|
321
|
+
/** Label for the copy-error button before it is clicked. */
|
|
322
|
+
copy: string;
|
|
323
|
+
/** Label for the copy-error button after a successful copy. */
|
|
324
|
+
copied: string;
|
|
325
|
+
};
|
|
146
326
|
/** Labels for the detailed transaction tracking modal. */
|
|
147
327
|
trackingModal: {
|
|
148
328
|
/** The main title of the tracking modal. */
|
|
@@ -269,31 +449,74 @@ type NovaTransactionsLabels = {
|
|
|
269
449
|
};
|
|
270
450
|
|
|
271
451
|
/**
|
|
272
|
-
* Defines the props for the NovaTransactionsProvider component.
|
|
452
|
+
* Defines the props for the `NovaTransactionsProvider` component.
|
|
453
|
+
*
|
|
454
|
+
* @template T The specific transaction type, extending the base `Transaction`.
|
|
273
455
|
*/
|
|
274
456
|
type NovaTransactionsProviderProps<T extends Transaction> = {
|
|
457
|
+
/** The chain adapter (or array of adapters) passed through to all child components. */
|
|
275
458
|
adapter: TxAdapter<T> | TxAdapter<T>[];
|
|
459
|
+
/** The currently connected wallet address, used to gate certain UI actions. */
|
|
276
460
|
connectedWalletAddress?: string;
|
|
461
|
+
/** The active adapter type, used for chain-specific logic in modals. */
|
|
277
462
|
connectedAdapterType?: OrbitAdapter;
|
|
463
|
+
/** The live transaction pool from the Pulsar store. */
|
|
278
464
|
transactionsPool: TransactionPool<T>;
|
|
465
|
+
/** Partial label overrides for i18n. Merged with the built-in English defaults. */
|
|
279
466
|
labels?: Partial<NovaTransactionsLabels>;
|
|
467
|
+
/**
|
|
468
|
+
* Feature flags to selectively enable or disable UI sub-systems.
|
|
469
|
+
* All features are **enabled** by default.
|
|
470
|
+
*/
|
|
280
471
|
features?: {
|
|
472
|
+
/** Enables bottom-right transaction progress toasts. @defaultValue `true` */
|
|
281
473
|
toasts?: boolean;
|
|
474
|
+
/** Enables the full-screen transaction history modal. @defaultValue `true` */
|
|
282
475
|
transactionsModal?: boolean;
|
|
476
|
+
/** Enables the step-by-step tracking modal that opens on submission. @defaultValue `true` */
|
|
283
477
|
trackingTxModal?: boolean;
|
|
478
|
+
/**
|
|
479
|
+
* Enables the top-center pre-submission error toast.
|
|
480
|
+
* This fires when `executeTxAction` throws before the transaction reaches the pool
|
|
481
|
+
* (validation failures, `beforeTxProcess` rejections, missing adapter, etc.).
|
|
482
|
+
* @defaultValue `true`
|
|
483
|
+
*/
|
|
484
|
+
validationErrorToast?: boolean;
|
|
284
485
|
};
|
|
486
|
+
/** Customization overrides for individual UI sub-systems. */
|
|
285
487
|
customization?: {
|
|
488
|
+
/** Overrides for the bottom-right transaction progress toast body. */
|
|
286
489
|
toast?: ToastTransactionCustomization<T>;
|
|
490
|
+
/** Overrides for the close button shared by all transaction toasts. */
|
|
287
491
|
toastCloseButton?: Omit<ToastCloseButtonProps, 'closeToast'>;
|
|
492
|
+
/** Overrides for the full-screen transaction history modal. */
|
|
288
493
|
transactionsInfoModal?: TransactionsInfoModalCustomization<T>;
|
|
494
|
+
/** Overrides for the step-by-step tracking modal. */
|
|
289
495
|
trackingTxModal?: TrackingTxModalCustomization<T>;
|
|
496
|
+
/**
|
|
497
|
+
* Overrides for the top-center pre-submission validation error toast.
|
|
498
|
+
* See `ToastValidationErrorCustomization` for available slots.
|
|
499
|
+
*/
|
|
500
|
+
validationErrorToast?: ToastValidationErrorCustomization;
|
|
290
501
|
};
|
|
291
502
|
/** Pagination state for infinite scroll, forwarded to TransactionsInfoModal and TransactionsHistory. */
|
|
292
503
|
pagination?: TxInMemoryPagination;
|
|
293
504
|
} & Pick<ITxTrackingStore<T>, 'closeTxTrackedModal' | 'executeTxAction' | 'initialTx'> & Omit<ToastContainerProps, 'containerId'>;
|
|
294
505
|
/**
|
|
295
|
-
* The
|
|
296
|
-
*
|
|
506
|
+
* The root provider for the Nova UI ecosystem.
|
|
507
|
+
*
|
|
508
|
+
* Renders and orchestrates all UI sub-systems:
|
|
509
|
+
* - **Bottom-right transaction toasts** — live progress updates for every tracked transaction.
|
|
510
|
+
* - **Top-center validation error toast** — fires when `executeTxAction` throws *before*
|
|
511
|
+
* the transaction is added to the pool (e.g., metadata validation failure,
|
|
512
|
+
* `beforeTxProcess` rejection, or missing adapter).
|
|
513
|
+
* - **Transaction history modal** — paginated full-screen history.
|
|
514
|
+
* - **Tracking modal** — step-by-step view for the most recent transaction.
|
|
515
|
+
*
|
|
516
|
+
* Place this component once at the top level of your application, passing the live
|
|
517
|
+
* Pulsar store state as props.
|
|
518
|
+
*
|
|
519
|
+
* @template T The specific transaction type, extending the base `Transaction`.
|
|
297
520
|
*/
|
|
298
521
|
declare function NovaTransactionsProvider<T extends Transaction>({ adapter, connectedWalletAddress, connectedAdapterType, transactionsPool, initialTx, executeTxAction, closeTxTrackedModal, labels, features, customization, pagination, ...toastProps }: NovaTransactionsProviderProps<T>): react_jsx_runtime.JSX.Element;
|
|
299
522
|
|
|
@@ -944,4 +1167,4 @@ type TransactionsInfoModalProps<T extends Transaction> = Pick<NovaTransactionsPr
|
|
|
944
1167
|
};
|
|
945
1168
|
declare function TransactionsInfoModal<T extends Transaction>({ isOpen, setIsOpen, customization, adapter, connectedWalletAddress, transactionsPool, pagination, selectedTxKey, }: TransactionsInfoModalProps<T>): react_jsx_runtime.JSX.Element;
|
|
946
1169
|
|
|
947
|
-
export {
|
|
1170
|
+
export { type TxStatusVisualClassNames as $, type TransactionKeyProps as A, TransactionStatusBadge as B, type CopyableFieldProps as C, type DetailItemProps as D, type TransactionStatusBadgeProps as E, TransactionsHistory as F, type TransactionsHistoryCustomization as G, HashLink as H, type TransactionsHistoryLoaderProps as I, type JsonBlockProps as J, type TransactionsHistoryProps as K, TransactionsInfoModal as L, type MetadataRowProps as M, type NovaTransactionsLabels as N, type TransactionsInfoModalCustomization as O, type TransactionsInfoModalProps as P, TxErrorBlock as Q, type TxErrorBlockClassNames as R, StatusAwareText as S, ToastTransaction as T, type TxErrorBlockProps as U, TxInfoBlock as V, type TxInfoBlockCustomization as W, type TxInfoBlockProps as X, TxProgressIndicator as Y, type TxProgressIndicatorProps as Z, TxStatusVisual as _, type HashLinkProps as a, type TxStatusVisualProps as a0, NovaTransactionsProvider as a1, type NovaTransactionsProviderProps as a2, type StatusAwareTextProps as b, type StepClassNames as c, type StepProps as d, type StepStatus as e, type ToastTransactionCustomization as f, type ToastTransactionProps as g, ToastValidationError as h, type ToastValidationErrorClassNames as i, type ToastValidationErrorCopyContentProps as j, type ToastValidationErrorCustomization as k, type ToastValidationErrorFieldProps as l, type ToastValidationErrorIconProps as m, type ToastValidationErrorMessageProps as n, type ToastValidationErrorProps as o, type ToastValidationErrorTitleProps as p, TrackingTxModal as q, type TrackingTxModalCustomization as r, type TrackingTxModalProps as s, TransactionDetails as t, type TransactionDetailsCustomization as u, type TransactionDetailsProps as v, TransactionHistoryItem as w, type TransactionHistoryItemCustomization as x, type TransactionHistoryItemProps as y, TransactionKey as z };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ToastCloseButtonProps, DialogContent } from '@tuwaio/nova-core';
|
|
3
3
|
import { TransactionStatus, Transaction, TxAdapter, TransactionPool, TxInMemoryPagination, ITxTrackingStore, InitialTransaction } from '@tuwaio/pulsar-core';
|
|
4
|
-
import { ReactNode, ComponentType,
|
|
4
|
+
import { ReactNode, ComponentType, ComponentPropsWithoutRef, JSX } from 'react';
|
|
5
5
|
import { OrbitAdapter, TuwaErrorState } from '@tuwaio/orbit-core';
|
|
6
|
-
import {
|
|
6
|
+
import { ToastContentProps, ToastContainerProps } from 'react-toastify';
|
|
7
7
|
import { MotionProps } from 'framer-motion';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -64,6 +64,171 @@ type StatusAwareTextProps = {
|
|
|
64
64
|
*/
|
|
65
65
|
declare function StatusAwareText({ txStatus, source, fallback, variant, className, applyColor, }: StatusAwareTextProps): ReactNode;
|
|
66
66
|
|
|
67
|
+
/**
|
|
68
|
+
* @file Contains the `ToastValidationError` component, a top-center error toast
|
|
69
|
+
* that fires when `executeTxAction` throws **before** the transaction is added
|
|
70
|
+
* to the pool — e.g., when input metadata fails Pulsar's validation rules or
|
|
71
|
+
* when a `beforeTxProcess` preflight check rejects.
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
/** Props forwarded to a custom icon component inside `ToastValidationError`. */
|
|
75
|
+
type ToastValidationErrorIconProps = {
|
|
76
|
+
/** Whether the error text has already been copied to the clipboard. */
|
|
77
|
+
isCopied: boolean;
|
|
78
|
+
/** Optional additional CSS classes. */
|
|
79
|
+
className?: string;
|
|
80
|
+
/** Whether the element is decorative (aria-hidden). */
|
|
81
|
+
'aria-hidden'?: boolean;
|
|
82
|
+
};
|
|
83
|
+
/** Props forwarded to a custom title component inside `ToastValidationError`. */
|
|
84
|
+
type ToastValidationErrorTitleProps = {
|
|
85
|
+
/** The resolved title string (from labels or prop override). */
|
|
86
|
+
title: string;
|
|
87
|
+
/** Optional additional CSS classes. */
|
|
88
|
+
className?: string;
|
|
89
|
+
};
|
|
90
|
+
/** Props forwarded to a custom field badge component inside `ToastValidationError`. */
|
|
91
|
+
type ToastValidationErrorFieldProps = {
|
|
92
|
+
/** The human-readable label prefix (e.g., "Field"). */
|
|
93
|
+
fieldLabel: string;
|
|
94
|
+
/** The actual field identifier that failed validation (e.g., "title"). */
|
|
95
|
+
fieldName: string;
|
|
96
|
+
/** Optional additional CSS classes. */
|
|
97
|
+
className?: string;
|
|
98
|
+
};
|
|
99
|
+
/** Props forwarded to a custom message component inside `ToastValidationError`. */
|
|
100
|
+
type ToastValidationErrorMessageProps = {
|
|
101
|
+
/** The error message string. */
|
|
102
|
+
message: string;
|
|
103
|
+
/** Optional additional CSS classes. */
|
|
104
|
+
className?: string;
|
|
105
|
+
};
|
|
106
|
+
/** Props forwarded to a custom copy-button content component. */
|
|
107
|
+
type ToastValidationErrorCopyContentProps = {
|
|
108
|
+
/** The icon element to render inside the button. */
|
|
109
|
+
icon: ReactNode;
|
|
110
|
+
/** Whether the text has been copied. */
|
|
111
|
+
isCopied: boolean;
|
|
112
|
+
/** The label to show before copying. */
|
|
113
|
+
copyLabel: string;
|
|
114
|
+
/** The label to show after a successful copy. */
|
|
115
|
+
copiedLabel: string;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Granular class name overrides for every sub-element of `ToastValidationError`.
|
|
119
|
+
* All keys are optional — omit any key to keep the default Tailwind classes.
|
|
120
|
+
*/
|
|
121
|
+
type ToastValidationErrorClassNames = {
|
|
122
|
+
/** Classes applied to the outermost container `<div>`. */
|
|
123
|
+
container?: string;
|
|
124
|
+
/** Classes applied to the header row (icon + title + copy button). */
|
|
125
|
+
header?: string;
|
|
126
|
+
/** Classes applied to the title/icon wrapper. */
|
|
127
|
+
titleWrapper?: string;
|
|
128
|
+
/** Classes applied to the `<ExclamationTriangleIcon>` (or custom icon). */
|
|
129
|
+
icon?: string;
|
|
130
|
+
/** Classes applied to the title text node. */
|
|
131
|
+
title?: string;
|
|
132
|
+
/** Classes applied to the field badge pill. */
|
|
133
|
+
fieldBadge?: string;
|
|
134
|
+
/** Classes applied to the scrollable message container. */
|
|
135
|
+
messageContainer?: string;
|
|
136
|
+
/** Classes applied to the mono message `<p>`. */
|
|
137
|
+
messageText?: string;
|
|
138
|
+
/** Classes applied to the copy button. */
|
|
139
|
+
copyButton?: string;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Customization options for `ToastValidationError`.
|
|
143
|
+
*
|
|
144
|
+
* All keys are optional. Provide only what you want to override — defaults
|
|
145
|
+
* follow the same visual language as the rest of `nova-transactions`.
|
|
146
|
+
*/
|
|
147
|
+
type ToastValidationErrorCustomization = {
|
|
148
|
+
/**
|
|
149
|
+
* Replace any default sub-component with your own.
|
|
150
|
+
* Each slot receives the same props the default component does,
|
|
151
|
+
* so you can wrap or fully replace the rendering.
|
|
152
|
+
*/
|
|
153
|
+
components?: {
|
|
154
|
+
/** Custom warning icon (top-left of the header). */
|
|
155
|
+
Icon?: ComponentType<ToastValidationErrorIconProps>;
|
|
156
|
+
/** Custom title renderer. */
|
|
157
|
+
Title?: ComponentType<ToastValidationErrorTitleProps>;
|
|
158
|
+
/** Custom field-badge renderer (shown only when `fieldName` is provided). */
|
|
159
|
+
FieldBadge?: ComponentType<ToastValidationErrorFieldProps>;
|
|
160
|
+
/** Custom error message renderer. */
|
|
161
|
+
Message?: ComponentType<ToastValidationErrorMessageProps>;
|
|
162
|
+
/** Custom inner content for the copy button (icon + label). */
|
|
163
|
+
CopyContent?: ComponentType<ToastValidationErrorCopyContentProps>;
|
|
164
|
+
};
|
|
165
|
+
/** Override native HTML props on the root container. */
|
|
166
|
+
containerProps?: Partial<Omit<ComponentPropsWithoutRef<'div'>, 'style'>>;
|
|
167
|
+
/** Override native HTML props on the copy button. */
|
|
168
|
+
buttonProps?: Partial<Omit<ComponentPropsWithoutRef<'button'>, 'style'>>;
|
|
169
|
+
/** Granular Tailwind class overrides for every sub-element. */
|
|
170
|
+
classNames?: ToastValidationErrorClassNames;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Props accepted by the `ToastValidationError` component.
|
|
174
|
+
*/
|
|
175
|
+
type ToastValidationErrorProps = {
|
|
176
|
+
/**
|
|
177
|
+
* The human-readable error message to display.
|
|
178
|
+
* Typically `error.message` from the caught `Error`.
|
|
179
|
+
*/
|
|
180
|
+
message: string;
|
|
181
|
+
/**
|
|
182
|
+
* The raw error text that will be written to the clipboard.
|
|
183
|
+
* Falls back to `message` when not provided.
|
|
184
|
+
*/
|
|
185
|
+
rawError?: string;
|
|
186
|
+
/**
|
|
187
|
+
* The name of the field that triggered the validation failure.
|
|
188
|
+
* When provided (e.g. `"title"`, `"description"`), a small badge is rendered
|
|
189
|
+
* below the header so users know exactly which input to fix.
|
|
190
|
+
* Omit for generic pre-flight errors (`beforeTxProcess` rejections).
|
|
191
|
+
*/
|
|
192
|
+
fieldName?: string;
|
|
193
|
+
/** Optional additional CSS class on the outermost container. */
|
|
194
|
+
className?: string;
|
|
195
|
+
/**
|
|
196
|
+
* Injected by `react-toastify` when used as toast content.
|
|
197
|
+
* Calling it programmatically closes this specific toast instance.
|
|
198
|
+
*/
|
|
199
|
+
closeToast?: ToastContentProps['closeToast'];
|
|
200
|
+
/** Full customization override object. */
|
|
201
|
+
customization?: ToastValidationErrorCustomization;
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* `ToastValidationError` is a self-contained toast body for pre-submission errors.
|
|
205
|
+
*
|
|
206
|
+
* It is designed to be rendered inside a `react-toastify` `ToastContainer` with
|
|
207
|
+
* `position="top-center"` and `autoClose={6000}` / `pauseOnHover`. The visual
|
|
208
|
+
* language mirrors `TxErrorBlock` and `nova-connect`'s `ToastError`:
|
|
209
|
+
*
|
|
210
|
+
* - Error color tokens (`--tuwa-error-*`)
|
|
211
|
+
* - `ExclamationTriangleIcon` header icon
|
|
212
|
+
* - Optional field badge identifying the offending input
|
|
213
|
+
* - Scrollable monospace message body
|
|
214
|
+
* - One-click copy-to-clipboard with feedback
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```tsx
|
|
218
|
+
* toast(
|
|
219
|
+
* (props) => (
|
|
220
|
+
* <ToastValidationError
|
|
221
|
+
* {...props}
|
|
222
|
+
* message={error.message}
|
|
223
|
+
* fieldName={(error as PulsarTransactionValidationError).field}
|
|
224
|
+
* />
|
|
225
|
+
* ),
|
|
226
|
+
* { containerId: 'nova-validation-errors', type: 'error' }
|
|
227
|
+
* );
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
declare function ToastValidationError({ message, rawError, fieldName, className, customization, }: ToastValidationErrorProps): JSX.Element;
|
|
231
|
+
|
|
67
232
|
/**
|
|
68
233
|
* @file This file defines the TypeScript type for the library's internationalization (i18n) labels.
|
|
69
234
|
* It provides a strict structure for all text used in the UI components, ensuring type safety for different languages.
|
|
@@ -143,6 +308,21 @@ type NovaTransactionsLabels = {
|
|
|
143
308
|
/** Confirmation text shown after copying an error message. */
|
|
144
309
|
copied: string;
|
|
145
310
|
};
|
|
311
|
+
/**
|
|
312
|
+
* Labels for the pre-submission validation error toast.
|
|
313
|
+
* This toast fires when `executeTxAction` throws before the transaction
|
|
314
|
+
* is added to the pool (e.g., validation failure, `beforeTxProcess` rejection).
|
|
315
|
+
*/
|
|
316
|
+
validationError: {
|
|
317
|
+
/** The main title shown in the toast header. */
|
|
318
|
+
title: string;
|
|
319
|
+
/** Prefix label for the field that caused the validation failure, e.g. "Field: title". */
|
|
320
|
+
field: string;
|
|
321
|
+
/** Label for the copy-error button before it is clicked. */
|
|
322
|
+
copy: string;
|
|
323
|
+
/** Label for the copy-error button after a successful copy. */
|
|
324
|
+
copied: string;
|
|
325
|
+
};
|
|
146
326
|
/** Labels for the detailed transaction tracking modal. */
|
|
147
327
|
trackingModal: {
|
|
148
328
|
/** The main title of the tracking modal. */
|
|
@@ -269,31 +449,74 @@ type NovaTransactionsLabels = {
|
|
|
269
449
|
};
|
|
270
450
|
|
|
271
451
|
/**
|
|
272
|
-
* Defines the props for the NovaTransactionsProvider component.
|
|
452
|
+
* Defines the props for the `NovaTransactionsProvider` component.
|
|
453
|
+
*
|
|
454
|
+
* @template T The specific transaction type, extending the base `Transaction`.
|
|
273
455
|
*/
|
|
274
456
|
type NovaTransactionsProviderProps<T extends Transaction> = {
|
|
457
|
+
/** The chain adapter (or array of adapters) passed through to all child components. */
|
|
275
458
|
adapter: TxAdapter<T> | TxAdapter<T>[];
|
|
459
|
+
/** The currently connected wallet address, used to gate certain UI actions. */
|
|
276
460
|
connectedWalletAddress?: string;
|
|
461
|
+
/** The active adapter type, used for chain-specific logic in modals. */
|
|
277
462
|
connectedAdapterType?: OrbitAdapter;
|
|
463
|
+
/** The live transaction pool from the Pulsar store. */
|
|
278
464
|
transactionsPool: TransactionPool<T>;
|
|
465
|
+
/** Partial label overrides for i18n. Merged with the built-in English defaults. */
|
|
279
466
|
labels?: Partial<NovaTransactionsLabels>;
|
|
467
|
+
/**
|
|
468
|
+
* Feature flags to selectively enable or disable UI sub-systems.
|
|
469
|
+
* All features are **enabled** by default.
|
|
470
|
+
*/
|
|
280
471
|
features?: {
|
|
472
|
+
/** Enables bottom-right transaction progress toasts. @defaultValue `true` */
|
|
281
473
|
toasts?: boolean;
|
|
474
|
+
/** Enables the full-screen transaction history modal. @defaultValue `true` */
|
|
282
475
|
transactionsModal?: boolean;
|
|
476
|
+
/** Enables the step-by-step tracking modal that opens on submission. @defaultValue `true` */
|
|
283
477
|
trackingTxModal?: boolean;
|
|
478
|
+
/**
|
|
479
|
+
* Enables the top-center pre-submission error toast.
|
|
480
|
+
* This fires when `executeTxAction` throws before the transaction reaches the pool
|
|
481
|
+
* (validation failures, `beforeTxProcess` rejections, missing adapter, etc.).
|
|
482
|
+
* @defaultValue `true`
|
|
483
|
+
*/
|
|
484
|
+
validationErrorToast?: boolean;
|
|
284
485
|
};
|
|
486
|
+
/** Customization overrides for individual UI sub-systems. */
|
|
285
487
|
customization?: {
|
|
488
|
+
/** Overrides for the bottom-right transaction progress toast body. */
|
|
286
489
|
toast?: ToastTransactionCustomization<T>;
|
|
490
|
+
/** Overrides for the close button shared by all transaction toasts. */
|
|
287
491
|
toastCloseButton?: Omit<ToastCloseButtonProps, 'closeToast'>;
|
|
492
|
+
/** Overrides for the full-screen transaction history modal. */
|
|
288
493
|
transactionsInfoModal?: TransactionsInfoModalCustomization<T>;
|
|
494
|
+
/** Overrides for the step-by-step tracking modal. */
|
|
289
495
|
trackingTxModal?: TrackingTxModalCustomization<T>;
|
|
496
|
+
/**
|
|
497
|
+
* Overrides for the top-center pre-submission validation error toast.
|
|
498
|
+
* See `ToastValidationErrorCustomization` for available slots.
|
|
499
|
+
*/
|
|
500
|
+
validationErrorToast?: ToastValidationErrorCustomization;
|
|
290
501
|
};
|
|
291
502
|
/** Pagination state for infinite scroll, forwarded to TransactionsInfoModal and TransactionsHistory. */
|
|
292
503
|
pagination?: TxInMemoryPagination;
|
|
293
504
|
} & Pick<ITxTrackingStore<T>, 'closeTxTrackedModal' | 'executeTxAction' | 'initialTx'> & Omit<ToastContainerProps, 'containerId'>;
|
|
294
505
|
/**
|
|
295
|
-
* The
|
|
296
|
-
*
|
|
506
|
+
* The root provider for the Nova UI ecosystem.
|
|
507
|
+
*
|
|
508
|
+
* Renders and orchestrates all UI sub-systems:
|
|
509
|
+
* - **Bottom-right transaction toasts** — live progress updates for every tracked transaction.
|
|
510
|
+
* - **Top-center validation error toast** — fires when `executeTxAction` throws *before*
|
|
511
|
+
* the transaction is added to the pool (e.g., metadata validation failure,
|
|
512
|
+
* `beforeTxProcess` rejection, or missing adapter).
|
|
513
|
+
* - **Transaction history modal** — paginated full-screen history.
|
|
514
|
+
* - **Tracking modal** — step-by-step view for the most recent transaction.
|
|
515
|
+
*
|
|
516
|
+
* Place this component once at the top level of your application, passing the live
|
|
517
|
+
* Pulsar store state as props.
|
|
518
|
+
*
|
|
519
|
+
* @template T The specific transaction type, extending the base `Transaction`.
|
|
297
520
|
*/
|
|
298
521
|
declare function NovaTransactionsProvider<T extends Transaction>({ adapter, connectedWalletAddress, connectedAdapterType, transactionsPool, initialTx, executeTxAction, closeTxTrackedModal, labels, features, customization, pagination, ...toastProps }: NovaTransactionsProviderProps<T>): react_jsx_runtime.JSX.Element;
|
|
299
522
|
|
|
@@ -944,4 +1167,4 @@ type TransactionsInfoModalProps<T extends Transaction> = Pick<NovaTransactionsPr
|
|
|
944
1167
|
};
|
|
945
1168
|
declare function TransactionsInfoModal<T extends Transaction>({ isOpen, setIsOpen, customization, adapter, connectedWalletAddress, transactionsPool, pagination, selectedTxKey, }: TransactionsInfoModalProps<T>): react_jsx_runtime.JSX.Element;
|
|
946
1169
|
|
|
947
|
-
export {
|
|
1170
|
+
export { type TxStatusVisualClassNames as $, type TransactionKeyProps as A, TransactionStatusBadge as B, type CopyableFieldProps as C, type DetailItemProps as D, type TransactionStatusBadgeProps as E, TransactionsHistory as F, type TransactionsHistoryCustomization as G, HashLink as H, type TransactionsHistoryLoaderProps as I, type JsonBlockProps as J, type TransactionsHistoryProps as K, TransactionsInfoModal as L, type MetadataRowProps as M, type NovaTransactionsLabels as N, type TransactionsInfoModalCustomization as O, type TransactionsInfoModalProps as P, TxErrorBlock as Q, type TxErrorBlockClassNames as R, StatusAwareText as S, ToastTransaction as T, type TxErrorBlockProps as U, TxInfoBlock as V, type TxInfoBlockCustomization as W, type TxInfoBlockProps as X, TxProgressIndicator as Y, type TxProgressIndicatorProps as Z, TxStatusVisual as _, type HashLinkProps as a, type TxStatusVisualProps as a0, NovaTransactionsProvider as a1, type NovaTransactionsProviderProps as a2, type StatusAwareTextProps as b, type StepClassNames as c, type StepProps as d, type StepStatus as e, type ToastTransactionCustomization as f, type ToastTransactionProps as g, ToastValidationError as h, type ToastValidationErrorClassNames as i, type ToastValidationErrorCopyContentProps as j, type ToastValidationErrorCustomization as k, type ToastValidationErrorFieldProps as l, type ToastValidationErrorIconProps as m, type ToastValidationErrorMessageProps as n, type ToastValidationErrorProps as o, type ToastValidationErrorTitleProps as p, TrackingTxModal as q, type TrackingTxModalCustomization as r, type TrackingTxModalProps as s, TransactionDetails as t, type TransactionDetailsCustomization as u, type TransactionDetailsProps as v, TransactionHistoryItem as w, type TransactionHistoryItemCustomization as x, type TransactionHistoryItemProps as y, TransactionKey as z };
|