@tuwaio/nova-connect 0.1.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/LICENSE +201 -0
- package/README.md +279 -0
- package/dist/chunk-KKCRUSJT.js +2 -0
- package/dist/chunk-KKCRUSJT.js.map +1 -0
- package/dist/chunk-NJDPFYUJ.js +2 -0
- package/dist/chunk-NJDPFYUJ.js.map +1 -0
- package/dist/chunk-RR5G7U5F.js +2 -0
- package/dist/chunk-RR5G7U5F.js.map +1 -0
- package/dist/evm/index.cjs +2 -0
- package/dist/evm/index.cjs.map +1 -0
- package/dist/evm/index.js +2 -0
- package/dist/evm/index.js.map +1 -0
- package/dist/evm-F7OJEDX3.js +2 -0
- package/dist/evm-F7OJEDX3.js.map +1 -0
- package/dist/evm-RBGEX4L3.js +2 -0
- package/dist/evm-RBGEX4L3.js.map +1 -0
- package/dist/getChainsListByWalletType-KXWMBNB4.js +2 -0
- package/dist/getChainsListByWalletType-KXWMBNB4.js.map +1 -0
- package/dist/hooks/index.cjs +2 -0
- package/dist/hooks/index.cjs.map +1 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.cjs +6 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +2030 -0
- package/dist/index.d.cts +8154 -0
- package/dist/index.d.ts +8154 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/evm-5323YCLC.js +2 -0
- package/dist/providers/evm-5323YCLC.js.map +1 -0
- package/dist/providers/index.cjs +6 -0
- package/dist/providers/index.cjs.map +1 -0
- package/dist/providers/index.d.cts +506 -0
- package/dist/providers/index.d.ts +506 -0
- package/dist/providers/index.js +6 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/solana-WHT5KTOF.js +2 -0
- package/dist/providers/solana-WHT5KTOF.js.map +1 -0
- package/dist/providers/utils-FHHKXQ5Z.js +2 -0
- package/dist/providers/utils-FHHKXQ5Z.js.map +1 -0
- package/dist/providers/utils-L6CFHW4B.js +2 -0
- package/dist/providers/utils-L6CFHW4B.js.map +1 -0
- package/dist/solana/index.cjs +2 -0
- package/dist/solana/index.cjs.map +1 -0
- package/dist/solana/index.js +2 -0
- package/dist/solana/index.js.map +1 -0
- package/dist/solana-2MXIY6UT.js +2 -0
- package/dist/solana-2MXIY6UT.js.map +1 -0
- package/dist/solana-EV65GS7Q.js +2 -0
- package/dist/solana-EV65GS7Q.js.map +1 -0
- package/dist/utils-5KC7QXWB.js +2 -0
- package/dist/utils-5KC7QXWB.js.map +1 -0
- package/dist/utils-72MDY3OH.js +2 -0
- package/dist/utils-72MDY3OH.js.map +1 -0
- package/package.json +235 -0
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ComponentPropsWithoutRef, ComponentType, ReactNode } from 'react';
|
|
3
|
+
import { ToastContainer, toast, ToastPosition } from 'react-toastify';
|
|
4
|
+
import { OrbitAdapter } from '@tuwaio/orbit-core';
|
|
5
|
+
import { ISatelliteConnectStore, BaseWallet } from '@tuwaio/satellite-core';
|
|
6
|
+
import { StoreApi } from 'zustand/index';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @description
|
|
10
|
+
* This interface is intentionally left empty.
|
|
11
|
+
* Other packages (@tuwaio/satellite-*) will use module
|
|
12
|
+
* augmentation to add their specific wallet types here.
|
|
13
|
+
*/
|
|
14
|
+
interface AllWallets {
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @description
|
|
18
|
+
* This interface is intentionally left empty.
|
|
19
|
+
* It will be augmented by satellite packages.
|
|
20
|
+
*/
|
|
21
|
+
interface AllConnectors {
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Union type for all supported wallet types.
|
|
25
|
+
* It's created from the values of the AllWallets interface.
|
|
26
|
+
* e.g., { evm: EVMWallet, solana: SolanaWallet } -> EVMWallet | SolanaWallet
|
|
27
|
+
*/
|
|
28
|
+
type Wallet = AllWallets[keyof AllWallets];
|
|
29
|
+
/**
|
|
30
|
+
* Union type for all supported connector types.
|
|
31
|
+
*/
|
|
32
|
+
type Connector = AllConnectors[keyof AllConnectors];
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Type definitions for NovaConnect component translations
|
|
36
|
+
* Contains all text strings for multi-language support
|
|
37
|
+
*/
|
|
38
|
+
type NovaConnectLabels = {
|
|
39
|
+
connectWallet: string;
|
|
40
|
+
disconnect: string;
|
|
41
|
+
connecting: string;
|
|
42
|
+
connected: string;
|
|
43
|
+
tryAgain: string;
|
|
44
|
+
back: string;
|
|
45
|
+
connect: string;
|
|
46
|
+
close: string;
|
|
47
|
+
all: string;
|
|
48
|
+
connectionError: string;
|
|
49
|
+
connectedSuccessfully: string;
|
|
50
|
+
connectingTo: string;
|
|
51
|
+
walletConnectionError: string;
|
|
52
|
+
errorWhenChainSwitching: string;
|
|
53
|
+
cannotConnectWallet: string;
|
|
54
|
+
success: string;
|
|
55
|
+
error: string;
|
|
56
|
+
replaced: string;
|
|
57
|
+
recent: string;
|
|
58
|
+
transactionLoading: string;
|
|
59
|
+
transactionSuccess: string;
|
|
60
|
+
transactionError: string;
|
|
61
|
+
transactionReplaced: string;
|
|
62
|
+
aboutWallets: string;
|
|
63
|
+
getWallet: string;
|
|
64
|
+
connectImpersonatedWallet: string;
|
|
65
|
+
transactionsInApp: string;
|
|
66
|
+
switchNetwork: string;
|
|
67
|
+
switchNetworks: string;
|
|
68
|
+
connectingEllipsis: string;
|
|
69
|
+
installed: string;
|
|
70
|
+
popular: string;
|
|
71
|
+
impersonate: string;
|
|
72
|
+
readOnlyMode: string;
|
|
73
|
+
whatIsWallet: string;
|
|
74
|
+
walletDescription: string;
|
|
75
|
+
whatIsNetwork: string;
|
|
76
|
+
networkDescription: string;
|
|
77
|
+
learnMore: string;
|
|
78
|
+
listOfNetworks: string;
|
|
79
|
+
viewOnExplorer: string;
|
|
80
|
+
viewTransactions: string;
|
|
81
|
+
enterWalletAddress: string;
|
|
82
|
+
walletAddressPlaceholder: string;
|
|
83
|
+
noConnectorsFound: string;
|
|
84
|
+
noConnectorsDescription: string;
|
|
85
|
+
somethingWentWrong: string;
|
|
86
|
+
networkPickingError: string;
|
|
87
|
+
pulsarAdapterRequired: string;
|
|
88
|
+
pulsarAdapterDescription: string;
|
|
89
|
+
selectAvailableNetwork: string;
|
|
90
|
+
startExploringWeb3: string;
|
|
91
|
+
walletKeyToDigitalWorld: string;
|
|
92
|
+
iDontHaveWallet: string;
|
|
93
|
+
choseWallet: string;
|
|
94
|
+
keyToNewInternet: string;
|
|
95
|
+
keyToNewInternetDescription: string;
|
|
96
|
+
logInWithoutHassle: string;
|
|
97
|
+
logInWithoutHassleDescription: string;
|
|
98
|
+
copyRawError: string;
|
|
99
|
+
copied: string;
|
|
100
|
+
chainSelector: string;
|
|
101
|
+
closeModal: string;
|
|
102
|
+
selectChain: string;
|
|
103
|
+
chainOption: string;
|
|
104
|
+
openChainSelector: string;
|
|
105
|
+
currentChain: string;
|
|
106
|
+
scrollToTop: string;
|
|
107
|
+
scrollToBottom: string;
|
|
108
|
+
chainListContainer: string;
|
|
109
|
+
walletControls: string;
|
|
110
|
+
openWalletModal: string;
|
|
111
|
+
walletConnected: string;
|
|
112
|
+
walletNotConnected: string;
|
|
113
|
+
walletBalance: string;
|
|
114
|
+
walletAddress: string;
|
|
115
|
+
transactionStatus: string;
|
|
116
|
+
successIcon: string;
|
|
117
|
+
errorIcon: string;
|
|
118
|
+
replacedIcon: string;
|
|
119
|
+
statusIcon: string;
|
|
120
|
+
loading: string;
|
|
121
|
+
idle: string;
|
|
122
|
+
unknownWallet: string;
|
|
123
|
+
walletAvatar: string;
|
|
124
|
+
ensAvatar: string;
|
|
125
|
+
walletIcon: string;
|
|
126
|
+
impersonateAddressEmpty: string;
|
|
127
|
+
impersonateAddressNotCorrect: string;
|
|
128
|
+
impersonateAddressConnected: string;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
type ButtonTxStatus = 'idle' | 'loading' | 'succeed' | 'failed' | 'replaced';
|
|
132
|
+
type ConnectContentType = 'network' | 'connectors' | 'about' | 'getWallet' | 'connecting' | 'impersonate';
|
|
133
|
+
type ConnectedContentType = 'main' | 'transactions' | 'chains';
|
|
134
|
+
interface NovaConnectProviderProps$1 {
|
|
135
|
+
store: StoreApi<ISatelliteConnectStore<Connector, Wallet>>;
|
|
136
|
+
children: React.ReactNode;
|
|
137
|
+
labels?: Partial<NovaConnectLabels>;
|
|
138
|
+
}
|
|
139
|
+
interface NovaConnectProviderType {
|
|
140
|
+
activeWallet: BaseWallet | undefined;
|
|
141
|
+
walletConnectionError: string | undefined;
|
|
142
|
+
isConnectModalOpen: boolean;
|
|
143
|
+
setIsConnectModalOpen: (value: boolean) => void;
|
|
144
|
+
isConnectedModalOpen: boolean;
|
|
145
|
+
setIsConnectedModalOpen: (value: boolean) => void;
|
|
146
|
+
isChainsListOpen: boolean;
|
|
147
|
+
setIsChainsListOpen: (value: boolean) => void;
|
|
148
|
+
isChainsListOpenMobile: boolean;
|
|
149
|
+
setIsChainsListOpenMobile: (value: boolean) => void;
|
|
150
|
+
connectedButtonStatus: ButtonTxStatus;
|
|
151
|
+
setConnectedButtonStatus: (value: ButtonTxStatus) => void;
|
|
152
|
+
isConnected: boolean;
|
|
153
|
+
setIsConnected: (value: boolean) => void;
|
|
154
|
+
connectedModalContentType: ConnectedContentType;
|
|
155
|
+
setConnectedModalContentType: (value: ConnectedContentType) => void;
|
|
156
|
+
connectModalContentType: ConnectContentType;
|
|
157
|
+
setConnectModalContentType: (value: ConnectContentType) => void;
|
|
158
|
+
selectedAdapter: OrbitAdapter | undefined;
|
|
159
|
+
setSelectedAdapter: (value: OrbitAdapter | undefined) => void;
|
|
160
|
+
activeConnector: string | undefined;
|
|
161
|
+
setActiveConnector: (value: string | undefined) => void;
|
|
162
|
+
impersonatedAddress: string;
|
|
163
|
+
setImpersonatedAddress: (value: string) => void;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
type CustomIconProps = {
|
|
167
|
+
isCopied: boolean;
|
|
168
|
+
className?: string;
|
|
169
|
+
'aria-hidden'?: boolean;
|
|
170
|
+
};
|
|
171
|
+
type CustomTitleProps = {
|
|
172
|
+
title: string;
|
|
173
|
+
titleId: string;
|
|
174
|
+
className?: string;
|
|
175
|
+
};
|
|
176
|
+
type CustomDescriptionProps = {
|
|
177
|
+
rawError: string;
|
|
178
|
+
descriptionId: string;
|
|
179
|
+
className?: string;
|
|
180
|
+
};
|
|
181
|
+
type CustomButtonContentProps = {
|
|
182
|
+
icon: ReactNode;
|
|
183
|
+
isCopied: boolean;
|
|
184
|
+
copyLabel: string;
|
|
185
|
+
copiedLabel: string;
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* Customization options for ToastError component
|
|
189
|
+
*/
|
|
190
|
+
type ToastErrorCustomization = {
|
|
191
|
+
/** Override container element props */
|
|
192
|
+
containerProps?: Partial<Omit<ComponentPropsWithoutRef<'div'>, 'style'>>;
|
|
193
|
+
/** Override button element props */
|
|
194
|
+
buttonProps?: Partial<Omit<ComponentPropsWithoutRef<'button'>, 'style'>>;
|
|
195
|
+
/** Custom components */
|
|
196
|
+
components?: {
|
|
197
|
+
/** Custom icon component */
|
|
198
|
+
Icon?: ComponentType<CustomIconProps>;
|
|
199
|
+
/** Custom title component */
|
|
200
|
+
Title?: ComponentType<CustomTitleProps>;
|
|
201
|
+
/** Custom description component */
|
|
202
|
+
Description?: ComponentType<CustomDescriptionProps>;
|
|
203
|
+
/** Custom button content component */
|
|
204
|
+
ButtonContent?: ComponentType<CustomButtonContentProps>;
|
|
205
|
+
};
|
|
206
|
+
/** Custom class name generators */
|
|
207
|
+
classNames?: {
|
|
208
|
+
/** Function to generate container classes */
|
|
209
|
+
container?: (params: {
|
|
210
|
+
hasTitle: boolean;
|
|
211
|
+
hasError: boolean;
|
|
212
|
+
}) => string;
|
|
213
|
+
/** Function to generate title classes */
|
|
214
|
+
title?: (params: {
|
|
215
|
+
title: string;
|
|
216
|
+
}) => string;
|
|
217
|
+
/** Function to generate description classes */
|
|
218
|
+
description?: (params: {
|
|
219
|
+
rawError: string;
|
|
220
|
+
}) => string;
|
|
221
|
+
/** Function to generate button classes */
|
|
222
|
+
button?: (params: {
|
|
223
|
+
isCopied: boolean;
|
|
224
|
+
disabled: boolean;
|
|
225
|
+
}) => string;
|
|
226
|
+
/** Function to generate icon classes */
|
|
227
|
+
icon?: (params: {
|
|
228
|
+
isCopied: boolean;
|
|
229
|
+
}) => string;
|
|
230
|
+
};
|
|
231
|
+
/** Custom event handlers */
|
|
232
|
+
handlers?: {
|
|
233
|
+
/** Custom click handler wrapper */
|
|
234
|
+
onClick?: (originalHandler: (event: React.MouseEvent<HTMLButtonElement>) => void, event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
235
|
+
/** Custom keydown handler wrapper */
|
|
236
|
+
onKeyDown?: (originalHandler: (event: React.KeyboardEvent<HTMLButtonElement>) => void, event: React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
type CustomToastErrorProps = {
|
|
241
|
+
title: string;
|
|
242
|
+
rawError: string;
|
|
243
|
+
onCopyComplete?: (success: boolean) => void;
|
|
244
|
+
errorType: 'wallet' | 'switch' | null;
|
|
245
|
+
isConnected: boolean;
|
|
246
|
+
};
|
|
247
|
+
type CustomContainerProps = ComponentPropsWithoutRef<typeof ToastContainer>;
|
|
248
|
+
/**
|
|
249
|
+
* Customization options for ErrorsProvider component
|
|
250
|
+
*/
|
|
251
|
+
type ErrorsProviderCustomization = {
|
|
252
|
+
/** Override ToastContainer element props */
|
|
253
|
+
containerProps?: Partial<ComponentPropsWithoutRef<typeof ToastContainer>>;
|
|
254
|
+
/** Custom components */
|
|
255
|
+
components?: {
|
|
256
|
+
/** Custom ToastError component */
|
|
257
|
+
ToastError?: ComponentType<CustomToastErrorProps>;
|
|
258
|
+
/** Custom ToastContainer component */
|
|
259
|
+
Container?: ComponentType<CustomContainerProps>;
|
|
260
|
+
};
|
|
261
|
+
/** Default ToastError customization (only used with default ToastError component) */
|
|
262
|
+
toastErrorCustomization?: ToastErrorCustomization;
|
|
263
|
+
/** Custom class name generators */
|
|
264
|
+
classNames?: {
|
|
265
|
+
/** Function to generate container classes */
|
|
266
|
+
container?: (params: {
|
|
267
|
+
hasErrors: boolean;
|
|
268
|
+
errorType: 'wallet' | 'switch' | null;
|
|
269
|
+
}) => string;
|
|
270
|
+
};
|
|
271
|
+
/** Custom toast options generators */
|
|
272
|
+
toastOptions?: {
|
|
273
|
+
/** Function to generate toast options */
|
|
274
|
+
error?: (params: {
|
|
275
|
+
title: string;
|
|
276
|
+
rawError: string;
|
|
277
|
+
errorType: 'wallet' | 'switch' | null;
|
|
278
|
+
isConnected: boolean;
|
|
279
|
+
}) => Partial<Parameters<typeof toast.error>[1]>;
|
|
280
|
+
};
|
|
281
|
+
/** Custom logic handlers */
|
|
282
|
+
handlers?: {
|
|
283
|
+
/** Custom error display logic */
|
|
284
|
+
showError?: (originalHandler: (title: string, rawError: string, errorKey: string) => void, params: {
|
|
285
|
+
title: string;
|
|
286
|
+
rawError: string;
|
|
287
|
+
errorKey: string;
|
|
288
|
+
errorType: 'wallet' | 'switch' | null;
|
|
289
|
+
}) => void;
|
|
290
|
+
/** Custom error dismissal logic */
|
|
291
|
+
dismissError?: (originalHandler: () => void) => void;
|
|
292
|
+
/** Custom copy complete handler */
|
|
293
|
+
onCopyComplete?: (success: boolean, rawError: string, errorType: 'wallet' | 'switch' | null) => void;
|
|
294
|
+
};
|
|
295
|
+
/** Custom error title generator - does NOT customize labels, just allows title modification */
|
|
296
|
+
errorTitle?: (defaultTitle: string, params: {
|
|
297
|
+
errorType: 'wallet' | 'switch' | null;
|
|
298
|
+
}) => string;
|
|
299
|
+
/** Custom error hash generator for deduplication */
|
|
300
|
+
errorHash?: (defaultHash: string | null, params: {
|
|
301
|
+
primaryError: string | null;
|
|
302
|
+
errorType: 'wallet' | 'switch' | null;
|
|
303
|
+
}) => string | null;
|
|
304
|
+
};
|
|
305
|
+
interface ErrorsProviderProps extends Pick<NovaConnectProviderProps$1, 'store'> {
|
|
306
|
+
/** Custom container ID for toast notifications */
|
|
307
|
+
containerId?: string;
|
|
308
|
+
/** Custom position for toast notifications */
|
|
309
|
+
position?: ToastPosition;
|
|
310
|
+
/** Auto close delay in milliseconds */
|
|
311
|
+
autoClose?: number | false;
|
|
312
|
+
/** Whether to enable drag to dismiss */
|
|
313
|
+
draggable?: boolean;
|
|
314
|
+
/** Customization options */
|
|
315
|
+
customization?: ErrorsProviderCustomization;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* A highly customizable error toast provider with extensive styling options and component replacement capabilities.
|
|
319
|
+
* Provides comprehensive customization for appearance, behavior, and error handling logic while maintaining accessibility.
|
|
320
|
+
*/
|
|
321
|
+
declare function ErrorsProvider({ store, containerId, position, autoClose, draggable, customization, }: ErrorsProviderProps): react_jsx_runtime.JSX.Element;
|
|
322
|
+
declare namespace ErrorsProvider {
|
|
323
|
+
var displayName: string;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
interface NovaConnectLabelsProviderProps {
|
|
327
|
+
/** An object containing the custom labels */
|
|
328
|
+
labels: NovaConnectLabels;
|
|
329
|
+
/** The child components to render */
|
|
330
|
+
children: ReactNode;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* A React component that provides a custom set of labels to all child components.
|
|
334
|
+
* Wrap your application or component tree with this provider to apply custom translations.
|
|
335
|
+
*
|
|
336
|
+
* The provider uses React.memo optimization and validates labels in development mode.
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* ```typescript
|
|
340
|
+
* import { NovaConnectLabelsProvider } from './NovaConnectLabelsProvider';
|
|
341
|
+
*
|
|
342
|
+
* function App() {
|
|
343
|
+
* const customLabels = {
|
|
344
|
+
* connectWallet: 'Подключить кошелек',
|
|
345
|
+
* disconnect: 'Отключиться',
|
|
346
|
+
* };
|
|
347
|
+
*
|
|
348
|
+
* return (
|
|
349
|
+
* <NovaConnectLabelsProvider labels={customLabels}>
|
|
350
|
+
* <YourApp />
|
|
351
|
+
* </NovaConnectLabelsProvider>
|
|
352
|
+
* );
|
|
353
|
+
* }
|
|
354
|
+
* ```
|
|
355
|
+
*/
|
|
356
|
+
declare function NovaConnectLabelsProvider({ labels, children }: NovaConnectLabelsProviderProps): react_jsx_runtime.JSX.Element;
|
|
357
|
+
declare namespace NovaConnectLabelsProvider {
|
|
358
|
+
var displayName: string;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Props for custom NovaConnectLabelsProvider component
|
|
363
|
+
*/
|
|
364
|
+
type CustomLabelsProviderProps = {
|
|
365
|
+
labels?: Partial<NovaConnectLabels>;
|
|
366
|
+
children: ReactNode;
|
|
367
|
+
};
|
|
368
|
+
/**
|
|
369
|
+
* Props for custom ErrorsProvider component
|
|
370
|
+
*/
|
|
371
|
+
type CustomErrorsProviderProps = Pick<ErrorsProviderProps, 'store'> & {
|
|
372
|
+
customization?: ErrorsProviderCustomization;
|
|
373
|
+
};
|
|
374
|
+
/**
|
|
375
|
+
* Context data passed to custom provider components
|
|
376
|
+
*/
|
|
377
|
+
type ProviderContext = {
|
|
378
|
+
/** Current wallet connection state */
|
|
379
|
+
isConnected: boolean;
|
|
380
|
+
/** Active wallet instance */
|
|
381
|
+
activeWallet: BaseWallet | undefined;
|
|
382
|
+
/** Current wallet connection error */
|
|
383
|
+
walletConnectionError: string | undefined;
|
|
384
|
+
/** All modal and UI states */
|
|
385
|
+
modalStates: {
|
|
386
|
+
isConnectModalOpen: boolean;
|
|
387
|
+
isConnectedModalOpen: boolean;
|
|
388
|
+
isChainsListOpen: boolean;
|
|
389
|
+
isChainsListOpenMobile: boolean;
|
|
390
|
+
};
|
|
391
|
+
/** Current content types for modals */
|
|
392
|
+
contentTypes: {
|
|
393
|
+
connectModal: ConnectContentType;
|
|
394
|
+
connectedModal: ConnectedContentType;
|
|
395
|
+
};
|
|
396
|
+
/** Button and transaction statuses */
|
|
397
|
+
statuses: {
|
|
398
|
+
connectedButton: ButtonTxStatus;
|
|
399
|
+
};
|
|
400
|
+
};
|
|
401
|
+
/**
|
|
402
|
+
* Comprehensive customization options for NovaConnectProvider
|
|
403
|
+
*/
|
|
404
|
+
type NovaConnectProviderCustomization = {
|
|
405
|
+
/** Custom components */
|
|
406
|
+
components?: {
|
|
407
|
+
/** Custom labels provider component */
|
|
408
|
+
LabelsProvider?: ComponentType<CustomLabelsProviderProps>;
|
|
409
|
+
/** Custom errors provider component */
|
|
410
|
+
ErrorsProvider?: ComponentType<CustomErrorsProviderProps>;
|
|
411
|
+
};
|
|
412
|
+
/** Labels customization and merging strategy */
|
|
413
|
+
labels?: {
|
|
414
|
+
/** Custom labels merging function */
|
|
415
|
+
merge?: (defaultLabels: NovaConnectLabels, userLabels: Partial<NovaConnectLabels>) => NovaConnectLabels;
|
|
416
|
+
/** Transform final merged labels before use */
|
|
417
|
+
transform?: (mergedLabels: NovaConnectLabels, context: ProviderContext) => NovaConnectLabels;
|
|
418
|
+
};
|
|
419
|
+
/** ErrorsProvider customization - passed through to ErrorsProvider */
|
|
420
|
+
errors?: ErrorsProviderCustomization;
|
|
421
|
+
/** Custom initialization logic */
|
|
422
|
+
initialization?: {
|
|
423
|
+
/** Custom logic after store subscription setup */
|
|
424
|
+
onStoreSubscribed?: (context: ProviderContext) => void;
|
|
425
|
+
/** Custom logic when connection state changes */
|
|
426
|
+
onConnectionStateChange?: (isConnected: boolean, activeWallet: BaseWallet | undefined, context: ProviderContext) => void;
|
|
427
|
+
/** Custom logic when error state changes */
|
|
428
|
+
onErrorStateChange?: (error: string | undefined, context: ProviderContext) => void;
|
|
429
|
+
};
|
|
430
|
+
/** Custom context value transformation */
|
|
431
|
+
contextValue?: {
|
|
432
|
+
/** Transform context value before providing to children */
|
|
433
|
+
transform?: (defaultValue: NovaConnectProviderType, context: ProviderContext) => NovaConnectProviderType;
|
|
434
|
+
};
|
|
435
|
+
/** Custom rendering logic */
|
|
436
|
+
rendering?: {
|
|
437
|
+
/** Custom provider tree structure */
|
|
438
|
+
providerTree?: (defaultTree: ReactNode, components: {
|
|
439
|
+
ErrorsProvider: ReactNode;
|
|
440
|
+
LabelsProvider: ReactNode;
|
|
441
|
+
MainContent: ReactNode;
|
|
442
|
+
}, context: ProviderContext) => ReactNode;
|
|
443
|
+
};
|
|
444
|
+
};
|
|
445
|
+
/**
|
|
446
|
+
* Extended props for NovaConnectProvider with full customization capabilities
|
|
447
|
+
*/
|
|
448
|
+
interface NovaConnectProviderProps extends NovaConnectProviderProps$1 {
|
|
449
|
+
/** Comprehensive customization options for the provider and its sub-components */
|
|
450
|
+
customization?: NovaConnectProviderCustomization;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Main NovaConnect provider component with comprehensive customization capabilities.
|
|
454
|
+
*
|
|
455
|
+
* This provider manages wallet connection state, error handling, internationalization,
|
|
456
|
+
* and modal states while offering extensive customization options for all sub-components
|
|
457
|
+
* and behaviors.
|
|
458
|
+
*
|
|
459
|
+
* Features:
|
|
460
|
+
* - Complete wallet connection state management
|
|
461
|
+
* - Customizable error handling through ErrorsProvider
|
|
462
|
+
* - Flexible internationalization system
|
|
463
|
+
* - Modal and UI state coordination
|
|
464
|
+
* - Extensive customization API for all aspects
|
|
465
|
+
* - Custom component replacement capabilities
|
|
466
|
+
* - Advanced initialization and lifecycle hooks
|
|
467
|
+
*
|
|
468
|
+
* @example Basic usage
|
|
469
|
+
* ```tsx
|
|
470
|
+
* <NovaConnectProvider store={store}>
|
|
471
|
+
* <App />
|
|
472
|
+
* </NovaConnectProvider>
|
|
473
|
+
* ```
|
|
474
|
+
*
|
|
475
|
+
* @example With customization
|
|
476
|
+
* ```tsx
|
|
477
|
+
* <NovaConnectProvider
|
|
478
|
+
* store={store}
|
|
479
|
+
* labels={customLabels}
|
|
480
|
+
* customization={{
|
|
481
|
+
* errors: {
|
|
482
|
+
* position: 'bottom-right',
|
|
483
|
+
* autoClose: 5000,
|
|
484
|
+
* components: {
|
|
485
|
+
* ToastError: CustomToastError
|
|
486
|
+
* }
|
|
487
|
+
* },
|
|
488
|
+
* initialization: {
|
|
489
|
+
* onConnectionStateChange: (isConnected, wallet) => {
|
|
490
|
+
* console.log('Connection state:', isConnected, wallet);
|
|
491
|
+
* }
|
|
492
|
+
* }
|
|
493
|
+
* }}
|
|
494
|
+
* >
|
|
495
|
+
* <App />
|
|
496
|
+
* </NovaConnectProvider>
|
|
497
|
+
* ```
|
|
498
|
+
*
|
|
499
|
+
* @param props - Provider configuration and customization options
|
|
500
|
+
*/
|
|
501
|
+
declare function NovaConnectProvider({ labels, store, children, customization }: NovaConnectProviderProps): react_jsx_runtime.JSX.Element;
|
|
502
|
+
declare namespace NovaConnectProvider {
|
|
503
|
+
var displayName: string;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
export { ErrorsProvider, type ErrorsProviderCustomization, type ErrorsProviderProps, NovaConnectLabelsProvider, NovaConnectProvider, type NovaConnectProviderCustomization, type NovaConnectProviderProps };
|