@notabene/javascript-sdk 2.16.0 → 2.17.0-next.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/README.md +116 -0
- package/dist/cjs/notabene.cjs +5 -5
- package/dist/cjs/notabene.d.ts +75 -6
- package/dist/cjs/package.json +1 -1
- package/dist/esm/notabene.d.ts +75 -6
- package/dist/esm/notabene.js +481 -480
- package/dist/esm/package.json +1 -1
- package/dist/notabene.d.ts +75 -6
- package/dist/notabene.js +481 -480
- package/package.json +2 -2
- package/src/ivms/v2Types.ts +1 -2
- package/src/notabene.ts +6 -0
- package/src/responseTransformer/transformer.ts +1 -3
- package/src/types.ts +86 -9
- package/src/utils/arbitraries.ts +72 -5
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,51 @@ 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
|
+
const { invoice, merchant, customer } = await notabene
|
|
457
|
+
.createInvoiceReader()
|
|
458
|
+
.openModal();
|
|
459
|
+
It also supports `openModal()` and `popup()` like the other components:
|
|
460
|
+
|
|
461
|
+
```js
|
|
462
|
+
// Modal
|
|
463
|
+
const { invoice, merchant, customer } = await notabene
|
|
464
|
+
.createInvoiceReader()
|
|
465
|
+
.openModal();
|
|
466
|
+
|
|
467
|
+
// Popup
|
|
468
|
+
const { invoice, merchant, customer } = await notabene
|
|
469
|
+
.createInvoiceReader()
|
|
470
|
+
.popup();
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### Response
|
|
474
|
+
|
|
475
|
+
The component emits a `complete` event (and resolves the `completion()` / `openModal()` / `popup()` promise) with an `InvoiceReaderResponse`:
|
|
476
|
+
|
|
477
|
+
| Field | Type | Description |
|
|
478
|
+
|------------|-----------|---------------------------------------------------------------------------------------------------|
|
|
479
|
+
| `invoice` | `Invoice` | The parsed TAIP-16 invoice (id, issueDate, currencyCode, lineItems, total, taxTotal, …) |
|
|
480
|
+
| `merchant` | `Party` | The parsed TAIP-16 party issuing the invoice, extracted from the PDF |
|
|
481
|
+
| `customer` | `Party` | The parsed TAIP-16 party the invoice is addressed to, extracted from the PDF |
|
|
482
|
+
|
|
483
|
+
All fields are optional — if the PDF cannot be parsed or a section is missing, the corresponding field will be `undefined`.
|
|
484
|
+
|
|
435
485
|
---
|
|
436
486
|
|
|
437
487
|
## Counterparty Handoff
|
|
@@ -694,6 +744,25 @@ component.on('warning', (event) => {
|
|
|
694
744
|
| `WALLET_UNREACHABLE` | Connection to wallet failed due to network issues or unsupported wallet type | ✅ Active |
|
|
695
745
|
| `JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE` | Unable to retrieve jurisdictional compliance requirements | ✅ Active |
|
|
696
746
|
|
|
747
|
+
## Info Message handling
|
|
748
|
+
|
|
749
|
+
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.
|
|
750
|
+
|
|
751
|
+
```ts
|
|
752
|
+
component.on('info', (event) => {
|
|
753
|
+
switch (event.identifier) {
|
|
754
|
+
case InfoIdentifierCode.CONTACT_SUPPORT:
|
|
755
|
+
// User clicked the contact support button — open a support modal, redirect, etc.
|
|
756
|
+
break;
|
|
757
|
+
}
|
|
758
|
+
});
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
#### Info reference
|
|
762
|
+
|
|
763
|
+
| Identifier Code | Description | Status |
|
|
764
|
+
|----------------|-------------|--------|
|
|
765
|
+
| `CONTACT_SUPPORT` | User clicked the contact support button | ✅ Active |
|
|
697
766
|
|
|
698
767
|
## Transaction parameters
|
|
699
768
|
|
|
@@ -806,6 +875,7 @@ const options: TransactionOptions = {
|
|
|
806
875
|
},
|
|
807
876
|
},
|
|
808
877
|
vasps: {
|
|
878
|
+
// V1 options — `searchable` is mutually exclusive with V2 `showTrustStatus` below
|
|
809
879
|
addUnknown: true, // Allow users to add a missing VASP - Defaults to false
|
|
810
880
|
onlyActive: true, // Only list active VASPs - Default false
|
|
811
881
|
searchable: [
|
|
@@ -813,6 +883,13 @@ const options: TransactionOptions = {
|
|
|
813
883
|
VASPSearchControl.PENDING, // JS: 'pending'
|
|
814
884
|
], // Control searches for VASPs - Defaults to undefined
|
|
815
885
|
},
|
|
886
|
+
// V2 alternative — filter by trust status instead of `searchable`. `addUnknown`
|
|
887
|
+
// and `onlyActive` remain valid; `searchable` cannot be combined with `showTrustStatus`:
|
|
888
|
+
// vasps: {
|
|
889
|
+
// addUnknown: true,
|
|
890
|
+
// onlyActive: true,
|
|
891
|
+
// showTrustStatus: ['TRUSTED', 'NEW'], // 'TRUSTED' | 'NEW' | 'FLAGGED' | 'BANNED'
|
|
892
|
+
// },
|
|
816
893
|
counterpartyAssist: { // Allows users to share a link to collect counterparty data
|
|
817
894
|
counterpartyTypes: [
|
|
818
895
|
PersonType.LEGAL, // JS: 'legal'
|
|
@@ -820,6 +897,9 @@ const options: TransactionOptions = {
|
|
|
820
897
|
PersonType.SELF, // JS: 'self'
|
|
821
898
|
],
|
|
822
899
|
},
|
|
900
|
+
contactSupport: { // Configures the contact support button (enabled via agentSections)
|
|
901
|
+
supportUrl: 'https://support.example.com',
|
|
902
|
+
},
|
|
823
903
|
hide: [ValidationSections.ASSET, ValidationSections.DESTINATION], // Don't show specific sections of component
|
|
824
904
|
autoSubmit: false // Automatically sends the complete event and hides the complete button - Default false
|
|
825
905
|
};
|
|
@@ -935,6 +1015,7 @@ Fields like `proofs.deminimis`, `proofs.microTransfer`, and `proofs.reuseProof`
|
|
|
935
1015
|
| `'microtransfer'` | Self-hosted | Ownership proof via micro-transfer (`ProofTypes.MicroTransfer`) |
|
|
936
1016
|
| `'manual-signing'` | Self-hosted | Ownership proof via manual message signing (no `ProofTypes` equivalent) |
|
|
937
1017
|
| `'add-vasp'` | Hosted | Manually add an unlisted exchange/VASP |
|
|
1018
|
+
| `'contact-support'` | Both | Show a contact support button |
|
|
938
1019
|
|
|
939
1020
|
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`).
|
|
940
1021
|
|
|
@@ -955,6 +1036,41 @@ const options: TransactionOptions = {
|
|
|
955
1036
|
|
|
956
1037
|
When `agentSections` is **not** provided, the existing behavior using `proofs.fallbacks` and `vasps.addUnknown` is preserved.
|
|
957
1038
|
|
|
1039
|
+
#### Contact Support
|
|
1040
|
+
|
|
1041
|
+
Include `'contact-support'` in `agentSections.main` or `agentSections.fallback` to show a contact support button in the agent selection step.
|
|
1042
|
+
|
|
1043
|
+
```ts
|
|
1044
|
+
const options: TransactionOptions = {
|
|
1045
|
+
agentSections: {
|
|
1046
|
+
main: ['signature'],
|
|
1047
|
+
fallback: ['contact-support'],
|
|
1048
|
+
},
|
|
1049
|
+
};
|
|
1050
|
+
```
|
|
1051
|
+
|
|
1052
|
+
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.).
|
|
1053
|
+
|
|
1054
|
+
To also provide a URL that the widget attempts to open as a fallback, use the `contactSupport` config:
|
|
1055
|
+
|
|
1056
|
+
```ts
|
|
1057
|
+
const options: TransactionOptions = {
|
|
1058
|
+
agentSections: {
|
|
1059
|
+
main: ['signature'],
|
|
1060
|
+
fallback: ['contact-support'],
|
|
1061
|
+
},
|
|
1062
|
+
contactSupport: {
|
|
1063
|
+
supportUrl: 'https://support.example.com',
|
|
1064
|
+
},
|
|
1065
|
+
};
|
|
1066
|
+
```
|
|
1067
|
+
|
|
1068
|
+
| Property | Type | Description |
|
|
1069
|
+
|----------|------|-------------|
|
|
1070
|
+
| `supportUrl` | `string` | URL to open when the user clicks the support button |
|
|
1071
|
+
|
|
1072
|
+
> **Note:** If `'contact-support'` is not included in `agentSections`, the button is hidden regardless of the `contactSupport` configuration.
|
|
1073
|
+
|
|
958
1074
|
### Configuring ownership proofs
|
|
959
1075
|
|
|
960
1076
|
By default components support message signing proofs.
|