@notabene/javascript-sdk 2.5.1 → 2.5.2
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 +62 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,6 +64,7 @@ This library is the JavaScript SDK for loading the Notabene UX components in the
|
|
|
64
64
|
- [Field reference](#field-reference)
|
|
65
65
|
- [Locales](#locales)
|
|
66
66
|
- [License](#license)
|
|
67
|
+
- [Theming](#theming)
|
|
67
68
|
|
|
68
69
|
## Installation
|
|
69
70
|
|
|
@@ -198,6 +199,14 @@ To be notified of any validation errors use:
|
|
|
198
199
|
withdrawal.on('error',error => ...)
|
|
199
200
|
```
|
|
200
201
|
|
|
202
|
+
To be notified when the component is Ready:
|
|
203
|
+
|
|
204
|
+
```js
|
|
205
|
+
withdrawal.on('ready', ({ type }) => {
|
|
206
|
+
console.log(type === 'ready');
|
|
207
|
+
});
|
|
208
|
+
```
|
|
209
|
+
|
|
201
210
|
Calling `on` returns a function that will allow you to cleanly unsubscribe.
|
|
202
211
|
|
|
203
212
|
```js
|
|
@@ -423,9 +432,43 @@ If any of the required parameters are missing the component will just show the N
|
|
|
423
432
|
If any error occurs, the `error` event is passed containing a message.
|
|
424
433
|
|
|
425
434
|
```ts
|
|
426
|
-
withdrawal.on('error',
|
|
435
|
+
withdrawal.on('error', (error) => ...)
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
An example error object.
|
|
439
|
+
|
|
440
|
+
```ts
|
|
441
|
+
type Error = {
|
|
442
|
+
type: CMType.Error;
|
|
443
|
+
message: string;
|
|
444
|
+
description: string;
|
|
445
|
+
identifier: ErrorIdentifierCode;
|
|
446
|
+
};
|
|
447
|
+
```
|
|
448
|
+
Errors can be handled in this way:
|
|
449
|
+
|
|
450
|
+
```ts
|
|
451
|
+
component.on('error', (error) => {
|
|
452
|
+
if (error.type === CMType.Error) {
|
|
453
|
+
switch (error.identifier) {
|
|
454
|
+
case ErrorIdentifierCode.SERVICE_UNAVAILABLE:
|
|
455
|
+
// handle the error
|
|
456
|
+
break;
|
|
457
|
+
//...
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
});
|
|
427
461
|
```
|
|
428
462
|
|
|
463
|
+
#### Error reference
|
|
464
|
+
|
|
465
|
+
| ErrorIdentifierCode | Description/Message | In Use |
|
|
466
|
+
|--------------------------|----------------------------------------------------------------------------------------------------------|---|
|
|
467
|
+
| SERVICE_UNAVAILABLE | The Notabene service is currently unavailable | ✅ |
|
|
468
|
+
| TOKEN_INVALID | Auth Token is Invalid | ✅ |
|
|
469
|
+
| WALLET_CONNECTION_FAILED | The connection to the wallet service failed, possibly due to network issues or unsupported wallet types. | ✅ |
|
|
470
|
+
| WALLET_NOT_SUPPORTED | The wallet used does not support the required functionality or blockchain. | |
|
|
471
|
+
|
|
429
472
|
## Transaction parameters
|
|
430
473
|
|
|
431
474
|
### Asset specification
|
|
@@ -493,7 +536,7 @@ const options: TransactionOptions = {
|
|
|
493
536
|
amountSubunits: '12344',
|
|
494
537
|
timeout: 86440,
|
|
495
538
|
},
|
|
496
|
-
fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration], // js ['screenshot','
|
|
539
|
+
fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration], // js ['screenshot','self-declaration']
|
|
497
540
|
deminimis: {
|
|
498
541
|
threshold: 1000,
|
|
499
542
|
currency: 'EUR',
|
|
@@ -729,6 +772,23 @@ const options: TransactionOptions = {
|
|
|
729
772
|
|
|
730
773
|
See [locales](src/locales.ts) for the list of supported locales.
|
|
731
774
|
|
|
775
|
+
## Theming
|
|
776
|
+
|
|
777
|
+
You can optionally theme the UI when creating an instance of `Notabene`
|
|
778
|
+
|
|
779
|
+
```js
|
|
780
|
+
const notabene = new Notabene({
|
|
781
|
+
nodeUrl: 'https://api.notabene.id',
|
|
782
|
+
authToken: 'YOUR_CUSTOMER_TOKEN',
|
|
783
|
+
theme: {
|
|
784
|
+
mode: 'light', // 'light', 'dark'
|
|
785
|
+
primaryColor: '#0a852d',
|
|
786
|
+
secondaryColor: '#f5f7fa',
|
|
787
|
+
fontFamily: 'Montserrat' // Google Fonts Supported
|
|
788
|
+
}
|
|
789
|
+
});
|
|
790
|
+
```
|
|
791
|
+
|
|
732
792
|
## [License](LICENSE.md)
|
|
733
793
|
|
|
734
794
|
MIT © Notabene Inc.
|
package/package.json
CHANGED