@connect-xyz/withdraw-js 0.35.0 → 0.36.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 +15 -0
- package/dist/index.d.ts +4 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -68,6 +68,9 @@ const withdraw = new Withdraw({
|
|
|
68
68
|
onEvent: ({ type, data }) => {
|
|
69
69
|
console.log('Event received:', type, data);
|
|
70
70
|
},
|
|
71
|
+
onLoaded: () => {
|
|
72
|
+
console.log('Withdraw widget loaded and ready');
|
|
73
|
+
},
|
|
71
74
|
});
|
|
72
75
|
|
|
73
76
|
// Render the widget to a container element
|
|
@@ -101,6 +104,7 @@ withdraw.destroy();
|
|
|
101
104
|
| `onClose` | `() => void` | No | - | Callback when the widget is closed |
|
|
102
105
|
| `onWithdrawal` | `({ data }) => void` | No | - | Callback for withdrawal completed |
|
|
103
106
|
| `onEvent` | `({ type, data }) => void` | No | - | Callback for general events |
|
|
107
|
+
| `onLoaded` | `() => void` | No | - | Callback when the widget is loaded and ready |
|
|
104
108
|
|
|
105
109
|
### Constructor
|
|
106
110
|
|
|
@@ -119,6 +123,7 @@ Creates a new Withdraw instance with the provided configuration.
|
|
|
119
123
|
- `onClose` (function, optional): Close callback
|
|
120
124
|
- `onWithdrawal` (function, optional): Withdrawal callback
|
|
121
125
|
- `onEvent` (function, optional): General event callback
|
|
126
|
+
- `onLoaded` (function, optional): Callback when widget is loaded and ready
|
|
122
127
|
|
|
123
128
|
### Methods
|
|
124
129
|
|
|
@@ -214,6 +219,16 @@ onEvent: ({ type, data }) => {
|
|
|
214
219
|
};
|
|
215
220
|
```
|
|
216
221
|
|
|
222
|
+
### onLoaded
|
|
223
|
+
|
|
224
|
+
Called when the Withdraw widget has fully loaded and is ready for user interaction. This callback is useful for showing loading states or performing actions once the widget is initialized.
|
|
225
|
+
|
|
226
|
+
```javascript
|
|
227
|
+
onLoaded: () => {
|
|
228
|
+
// Widget is fully loaded and ready
|
|
229
|
+
};
|
|
230
|
+
```
|
|
231
|
+
|
|
217
232
|
## Browser Support
|
|
218
233
|
|
|
219
234
|
- Chrome/Edge 90+
|
package/dist/index.d.ts
CHANGED
|
@@ -317,6 +317,8 @@ declare type CommonCallbacks<TEvent = AppEvent> = {
|
|
|
317
317
|
onClose?: () => void;
|
|
318
318
|
/** Called when a general event occurs */
|
|
319
319
|
onEvent?: (event: TEvent) => void;
|
|
320
|
+
/** Called when the widget has loaded and is ready */
|
|
321
|
+
onLoaded?: () => void;
|
|
320
322
|
};
|
|
321
323
|
|
|
322
324
|
export declare type ConnectWithdrawElement = SdkElement<WithdrawConfig>;
|
|
@@ -396,7 +398,8 @@ declare type Theme = 'auto' | 'light' | 'dark';
|
|
|
396
398
|
* onError: ({ error, reason }) => console.error(error, reason),
|
|
397
399
|
* onClose: () => console.log('Withdraw closed'),
|
|
398
400
|
* onWithdrawal: ({ data }) => console.log('Withdrawal', data),
|
|
399
|
-
* onEvent: ({ type, data }) => console.log('Event', type, data)
|
|
401
|
+
* onEvent: ({ type, data }) => console.log('Event', type, data),
|
|
402
|
+
* onLoaded: () => console.log('Withdraw widget loaded and ready')
|
|
400
403
|
* });
|
|
401
404
|
*
|
|
402
405
|
* // Render to a container
|