@notabene/javascript-sdk 2.16.0-next.6 → 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 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
 
@@ -828,6 +897,9 @@ const options: TransactionOptions = {
828
897
  PersonType.SELF, // JS: 'self'
829
898
  ],
830
899
  },
900
+ contactSupport: { // Configures the contact support button (enabled via agentSections)
901
+ supportUrl: 'https://support.example.com',
902
+ },
831
903
  hide: [ValidationSections.ASSET, ValidationSections.DESTINATION], // Don't show specific sections of component
832
904
  autoSubmit: false // Automatically sends the complete event and hides the complete button - Default false
833
905
  };
@@ -943,6 +1015,7 @@ Fields like `proofs.deminimis`, `proofs.microTransfer`, and `proofs.reuseProof`
943
1015
  | `'microtransfer'` | Self-hosted | Ownership proof via micro-transfer (`ProofTypes.MicroTransfer`) |
944
1016
  | `'manual-signing'` | Self-hosted | Ownership proof via manual message signing (no `ProofTypes` equivalent) |
945
1017
  | `'add-vasp'` | Hosted | Manually add an unlisted exchange/VASP |
1018
+ | `'contact-support'` | Both | Show a contact support button |
946
1019
 
947
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`).
948
1021
 
@@ -963,6 +1036,41 @@ const options: TransactionOptions = {
963
1036
 
964
1037
  When `agentSections` is **not** provided, the existing behavior using `proofs.fallbacks` and `vasps.addUnknown` is preserved.
965
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
+
966
1074
  ### Configuring ownership proofs
967
1075
 
968
1076
  By default components support message signing proofs.