@notabene/javascript-sdk 2.17.0 → 2.18.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 +102 -0
- package/dist/cjs/notabene.cjs +5 -5
- package/dist/cjs/notabene.d.ts +38 -1
- package/dist/cjs/package.json +1 -1
- package/dist/esm/notabene.d.ts +38 -1
- package/dist/esm/notabene.js +480 -479
- package/dist/esm/package.json +1 -1
- package/dist/notabene.d.ts +38 -1
- package/dist/notabene.js +480 -479
- package/package.json +2 -2
- package/src/notabene.ts +4 -0
- package/src/types.ts +39 -1
- package/src/utils/arbitraries.ts +30 -0
package/README.md
CHANGED
|
@@ -43,6 +43,8 @@ This library is the JavaScript SDK for loading the Notabene UX components in the
|
|
|
43
43
|
- [Parameters](#parameters-2)
|
|
44
44
|
- [Deposit Assist](#deposit-assist)
|
|
45
45
|
- [Parameters](#parameters-3)
|
|
46
|
+
- [Invoice Reader](#invoice-reader)
|
|
47
|
+
- [Response](#response)
|
|
46
48
|
- [Counterparty Assist](#counterparty-assist)
|
|
47
49
|
- [Use Cases](#use-cases)
|
|
48
50
|
- [Counterparty Assist Configuration](#counterparty-assist-configuration)
|
|
@@ -52,6 +54,8 @@ This library is the JavaScript SDK for loading the Notabene UX components in the
|
|
|
52
54
|
- [Error reference](#error-reference)
|
|
53
55
|
- [Warning Message handling](#warning-message-handling)
|
|
54
56
|
- [Warning reference](#warning-reference)
|
|
57
|
+
- [Info Message handling](#info-message-handling)
|
|
58
|
+
- [Info reference](#info-reference)
|
|
55
59
|
- [Transaction parameters](#transaction-parameters)
|
|
56
60
|
- [Asset specification](#asset-specification)
|
|
57
61
|
- [Transaction amount](#transaction-amount)
|
|
@@ -68,6 +72,7 @@ This library is the JavaScript SDK for loading the Notabene UX components in the
|
|
|
68
72
|
- [Section Options](#section-options)
|
|
69
73
|
- [Fallback Promotion](#fallback-promotion)
|
|
70
74
|
- [Legacy Behavior](#legacy-behavior)
|
|
75
|
+
- [Contact Support](#contact-support)
|
|
71
76
|
- [Configuring ownership proofs](#configuring-ownership-proofs)
|
|
72
77
|
- [Supporting Micro Transactions (aka Satoshi tests)](#supporting-micro-transactions-aka-satoshi-tests)
|
|
73
78
|
- [Fallback Proof Options](#fallback-proof-options)
|
|
@@ -432,6 +437,45 @@ const deposit = notabene.createDepositAssist(
|
|
|
432
437
|
|
|
433
438
|
If any of the required parameters are missing the component will just show the Notabene badge.
|
|
434
439
|
|
|
440
|
+
## Invoice Reader
|
|
441
|
+
|
|
442
|
+
The Invoice Reader component extracts structured [TAIP-16](https://tap.rsvp/TAIPs/taip-16) invoice data from a PDF invoice. The component renders a drag-and-drop upload UI; once the user drops a PDF, it is parsed and the extracted invoice, merchant, and customer data are returned to the host.
|
|
443
|
+
|
|
444
|
+
It takes no input parameters.
|
|
445
|
+
|
|
446
|
+
```js
|
|
447
|
+
const reader = notabene.createInvoiceReader();
|
|
448
|
+
reader.mount('#nb-invoice-reader');
|
|
449
|
+
|
|
450
|
+
const { invoice, merchant, customer } = await reader.completion();
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
It also supports `openModal()` and `popup()` like the other components:
|
|
454
|
+
|
|
455
|
+
```js
|
|
456
|
+
// Modal
|
|
457
|
+
const { invoice, merchant, customer } = await notabene
|
|
458
|
+
.createInvoiceReader()
|
|
459
|
+
.openModal();
|
|
460
|
+
|
|
461
|
+
// Popup
|
|
462
|
+
const { invoice, merchant, customer } = await notabene
|
|
463
|
+
.createInvoiceReader()
|
|
464
|
+
.popup();
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
### Response
|
|
468
|
+
|
|
469
|
+
The component emits a `complete` event (and resolves the `completion()` / `openModal()` / `popup()` promise) with an `InvoiceReaderResponse`:
|
|
470
|
+
|
|
471
|
+
| Field | Type | Description |
|
|
472
|
+
|------------|-----------|---------------------------------------------------------------------------------------------------|
|
|
473
|
+
| `invoice` | `Invoice` | The parsed TAIP-16 invoice (id, issueDate, currencyCode, lineItems, total, taxTotal, …) |
|
|
474
|
+
| `merchant` | `Party` | The parsed TAIP-16 party issuing the invoice, extracted from the PDF |
|
|
475
|
+
| `customer` | `Party` | The parsed TAIP-16 party the invoice is addressed to, extracted from the PDF |
|
|
476
|
+
|
|
477
|
+
All fields are optional — if the PDF cannot be parsed or a section is missing, the corresponding field will be `undefined`.
|
|
478
|
+
|
|
435
479
|
---
|
|
436
480
|
|
|
437
481
|
## Counterparty Handoff
|
|
@@ -694,6 +738,25 @@ component.on('warning', (event) => {
|
|
|
694
738
|
| `WALLET_UNREACHABLE` | Connection to wallet failed due to network issues or unsupported wallet type | ✅ Active |
|
|
695
739
|
| `JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE` | Unable to retrieve jurisdictional compliance requirements | ✅ Active |
|
|
696
740
|
|
|
741
|
+
## Info Message handling
|
|
742
|
+
|
|
743
|
+
Info messages notify the host application of events within the component. Some are purely informational, while others (identified by an `identifier` code) may require host-side handling.
|
|
744
|
+
|
|
745
|
+
```ts
|
|
746
|
+
component.on('info', (event) => {
|
|
747
|
+
switch (event.identifier) {
|
|
748
|
+
case InfoIdentifierCode.CONTACT_SUPPORT:
|
|
749
|
+
// User clicked the contact support button — open a support modal, redirect, etc.
|
|
750
|
+
break;
|
|
751
|
+
}
|
|
752
|
+
});
|
|
753
|
+
```
|
|
754
|
+
|
|
755
|
+
#### Info reference
|
|
756
|
+
|
|
757
|
+
| Identifier Code | Description | Status |
|
|
758
|
+
|----------------|-------------|--------|
|
|
759
|
+
| `CONTACT_SUPPORT` | User clicked the contact support button | ✅ Active |
|
|
697
760
|
|
|
698
761
|
## Transaction parameters
|
|
699
762
|
|
|
@@ -828,6 +891,9 @@ const options: TransactionOptions = {
|
|
|
828
891
|
PersonType.SELF, // JS: 'self'
|
|
829
892
|
],
|
|
830
893
|
},
|
|
894
|
+
contactSupport: { // Configures the contact support button (enabled via agentSections)
|
|
895
|
+
supportUrl: 'https://support.example.com',
|
|
896
|
+
},
|
|
831
897
|
hide: [ValidationSections.ASSET, ValidationSections.DESTINATION], // Don't show specific sections of component
|
|
832
898
|
autoSubmit: false // Automatically sends the complete event and hides the complete button - Default false
|
|
833
899
|
};
|
|
@@ -943,6 +1009,7 @@ Fields like `proofs.deminimis`, `proofs.microTransfer`, and `proofs.reuseProof`
|
|
|
943
1009
|
| `'microtransfer'` | Self-hosted | Ownership proof via micro-transfer (`ProofTypes.MicroTransfer`) |
|
|
944
1010
|
| `'manual-signing'` | Self-hosted | Ownership proof via manual message signing (no `ProofTypes` equivalent) |
|
|
945
1011
|
| `'add-vasp'` | Hosted | Manually add an unlisted exchange/VASP |
|
|
1012
|
+
| `'contact-support'` | Both | Show a contact support button |
|
|
946
1013
|
|
|
947
1014
|
Options are automatically filtered by flow — e.g. `'add-vasp'` is ignored in the self-hosted tab, `'signature'` is ignored in the hosted tab. Including an option implicitly enables that capability (e.g. `'add-vasp'` enables VASP creation without needing `vasps.addUnknown`).
|
|
948
1015
|
|
|
@@ -963,6 +1030,41 @@ const options: TransactionOptions = {
|
|
|
963
1030
|
|
|
964
1031
|
When `agentSections` is **not** provided, the existing behavior using `proofs.fallbacks` and `vasps.addUnknown` is preserved.
|
|
965
1032
|
|
|
1033
|
+
#### Contact Support
|
|
1034
|
+
|
|
1035
|
+
Include `'contact-support'` in `agentSections.main` or `agentSections.fallback` to show a contact support button in the agent selection step.
|
|
1036
|
+
|
|
1037
|
+
```ts
|
|
1038
|
+
const options: TransactionOptions = {
|
|
1039
|
+
agentSections: {
|
|
1040
|
+
main: ['signature'],
|
|
1041
|
+
fallback: ['contact-support'],
|
|
1042
|
+
},
|
|
1043
|
+
};
|
|
1044
|
+
```
|
|
1045
|
+
|
|
1046
|
+
By default, clicking the button sends an `info` message to the host application, letting the host decide what to do (open a modal, redirect, etc.).
|
|
1047
|
+
|
|
1048
|
+
To also provide a URL that the widget attempts to open as a fallback, use the `contactSupport` config:
|
|
1049
|
+
|
|
1050
|
+
```ts
|
|
1051
|
+
const options: TransactionOptions = {
|
|
1052
|
+
agentSections: {
|
|
1053
|
+
main: ['signature'],
|
|
1054
|
+
fallback: ['contact-support'],
|
|
1055
|
+
},
|
|
1056
|
+
contactSupport: {
|
|
1057
|
+
supportUrl: 'https://support.example.com',
|
|
1058
|
+
},
|
|
1059
|
+
};
|
|
1060
|
+
```
|
|
1061
|
+
|
|
1062
|
+
| Property | Type | Description |
|
|
1063
|
+
|----------|------|-------------|
|
|
1064
|
+
| `supportUrl` | `string` | URL to open when the user clicks the support button |
|
|
1065
|
+
|
|
1066
|
+
> **Note:** If `'contact-support'` is not included in `agentSections`, the button is hidden regardless of the `contactSupport` configuration.
|
|
1067
|
+
|
|
966
1068
|
### Configuring ownership proofs
|
|
967
1069
|
|
|
968
1070
|
By default components support message signing proofs.
|