@notabene/javascript-sdk 2.9.1-next.1 → 2.9.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 +201 -0
- package/dist/cjs/package.json +1 -1
- package/dist/esm/package.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,6 +43,11 @@ 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
|
+
- [Counterparty Assist](#counterparty-assist)
|
|
47
|
+
- [Use Cases](#use-cases)
|
|
48
|
+
- [Counterparty Assist Configuration](#counterparty-assist-configuration)
|
|
49
|
+
- [Component Response](#component-response)
|
|
50
|
+
- [Retrieving Completed Data](#retrieving-completed-data)
|
|
46
51
|
- [Error handling](#error-handling)
|
|
47
52
|
- [Error reference](#error-reference)
|
|
48
53
|
- [Transaction parameters](#transaction-parameters)
|
|
@@ -63,6 +68,7 @@ This library is the JavaScript SDK for loading the Notabene UX components in the
|
|
|
63
68
|
- [Counterparty Field Properties](#counterparty-field-properties)
|
|
64
69
|
- [Full Example](#full-example)
|
|
65
70
|
- [Field reference](#field-reference)
|
|
71
|
+
- [Configure Counterparty Assist](#counterparty-assist-configuration)
|
|
66
72
|
- [Locales](#locales)
|
|
67
73
|
- [Theming](#theming)
|
|
68
74
|
- [License](#license)
|
|
@@ -430,6 +436,194 @@ If any of the required parameters are missing the component will just show the N
|
|
|
430
436
|
|
|
431
437
|
---
|
|
432
438
|
|
|
439
|
+
## Counterparty Assist
|
|
440
|
+
|
|
441
|
+
The **Counterparty Assist** feature enables handoff of data collection to a counterparty or to another device by sharing a secure link. This facilitates more accurate and complete data collection, particularly when the counterparty is able to provide the required information directly.
|
|
442
|
+
|
|
443
|
+
This feature can be enabled globally for all counterparty types or selectively for specific types.
|
|
444
|
+
|
|
445
|
+
### Use Cases
|
|
446
|
+
|
|
447
|
+
#### Third Parties (`natural`, `legal`)
|
|
448
|
+
|
|
449
|
+
During the counterparty data collection step, users can generate and share a link to allow third-party counterparties (individuals or organizations) to enter their own data. This ensures data accuracy and supports robust address verification by allowing the rightful owner to provide the necessary information.
|
|
450
|
+
|
|
451
|
+
#### First Parties (`self`)
|
|
452
|
+
|
|
453
|
+
During the address verification step, users can share a link to complete self-hosted wallet proof submissions on another device. This is especially useful if the original device used to initiate the process doesn't support signing or wallet access.
|
|
454
|
+
|
|
455
|
+
### Counterparty Assist Configuration
|
|
456
|
+
|
|
457
|
+
You can enable **Counterparty Assist** via the `counterpartyAssist` configuration field in one of the following ways:
|
|
458
|
+
|
|
459
|
+
- `true`: Enable for all counterparty types (`self`, `natural`, and `legal`)
|
|
460
|
+
- `false`: Disable the feature entirely
|
|
461
|
+
- `{ counterpartyTypes: [PersonType.SELF, PersonType.NATURAL, PersonType.LEGAL] }`: Enable for specific counterparty types
|
|
462
|
+
|
|
463
|
+
**Example Config**
|
|
464
|
+
|
|
465
|
+
```ts
|
|
466
|
+
import Notabene, {
|
|
467
|
+
PersonType,
|
|
468
|
+
} from '@notabene/javascript-sdk';
|
|
469
|
+
|
|
470
|
+
// Counterparty assist is enabled for all counterparty types
|
|
471
|
+
const optionsAllEnabled: TransactionOptions = {
|
|
472
|
+
...
|
|
473
|
+
counterpartyAssist: true, // 'self', 'natural', and 'legal' enabled
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
// Counterparty assist is enabled for specific counterparty types
|
|
477
|
+
const options: TransactionOptions = {
|
|
478
|
+
...
|
|
479
|
+
counterpartyAssist: {
|
|
480
|
+
counterpartyTypes: [
|
|
481
|
+
PersonType.LEGAL, // JS: 'legal'
|
|
482
|
+
PersonType.NATURAL, // JS: 'natural'
|
|
483
|
+
PersonType.SELF, // JS: 'self'
|
|
484
|
+
],
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
### Component Response
|
|
490
|
+
|
|
491
|
+
The component emits a response once a participant has completed their portion of the process. Depending on the party type — **Third Party** (`natural`, `legal`) or **First Party** (`self`) — the behavior and expectations differ slightly.
|
|
492
|
+
|
|
493
|
+
#### Third Parties (`natural`, `legal`)
|
|
494
|
+
|
|
495
|
+
When a third party completes their step after following the shared link, the host application will receive a **`COMPLETE`** message from the component. However, because not all required data may be available at this point, the `response` object will include the information gathered so far, along with a `refreshSource` field. This allows the host to fetch the latest encrypted data once it's available.
|
|
496
|
+
|
|
497
|
+
##### Refresh Source Fields
|
|
498
|
+
|
|
499
|
+
| Field | Type | Description |
|
|
500
|
+
|-------|--------|--------------------------------------------------------------------------------------------------|
|
|
501
|
+
| `url` | URI | The endpoint where the host can retrieve the encrypted data. |
|
|
502
|
+
| `key` | string | The encryption key used to decrypt the PII (Personally Identifiable Information). Not stored by Notabene. |
|
|
503
|
+
|
|
504
|
+
**Example Response**
|
|
505
|
+
|
|
506
|
+
```json
|
|
507
|
+
{
|
|
508
|
+
type: CMType.COMPLETE, // 'complete'
|
|
509
|
+
response: { // transaciton data + refresh source
|
|
510
|
+
destination: "0xFf9A04788972C3803959454ECAE1ed327826a216",
|
|
511
|
+
asset: "eip155:1/erc20:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
|
512
|
+
customer: {
|
|
513
|
+
type: "natural",
|
|
514
|
+
name: "sdfsd",
|
|
515
|
+
email: "sdjlf@sdlfj.com"
|
|
516
|
+
},
|
|
517
|
+
amountDecimal: 100,
|
|
518
|
+
counterparty: {
|
|
519
|
+
type: "natural"
|
|
520
|
+
},
|
|
521
|
+
account: {
|
|
522
|
+
caip10: "eip155:1:0xFf9A04788972C3803959454ECAE1ed327826a216",
|
|
523
|
+
blockchainAddress: "0xFf9A04788972C3803959454ECAE1ed327826a216",
|
|
524
|
+
chain: "eip155:1",
|
|
525
|
+
did: "did:pkh:eip155:1:0xFf9A04788972C3803959454ECAE1ed327826a216",
|
|
526
|
+
valid: true
|
|
527
|
+
},
|
|
528
|
+
refreshSource: {
|
|
529
|
+
url: "https://safe-connections.notabene.id/17f76e4c-9a2a-4c34-afcb-b4868e609a96", // endpoint to retreive data
|
|
530
|
+
key: "1Lcp5SFhaMHH7CAEILrS8IWA6BXS4tFZunPx08WU5Ok=" // key that can be used to decrypt data
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
#### First Parties (`self`)
|
|
537
|
+
|
|
538
|
+
When the user is the originator (i.e., acting on their own behalf), they complete the verification process via a shared link and are then prompted to return to the original page to continue.
|
|
539
|
+
|
|
540
|
+
Upon completion, the component emits a **`COMPLETE`** response. In this case, the component handles all necessary data updates internally, so **no additional action is required from the host** to retrieve updated data. The host can directly proceed to submit the transfer to the Notabene API.
|
|
541
|
+
|
|
542
|
+
### Retrieving Completed Data
|
|
543
|
+
**(Third Parties Only: `natural`, `legal`)**
|
|
544
|
+
|
|
545
|
+
When data submission is handed off to third parties, we cannot predict how long it will take them to complete the process. For this reason, we provide the host with all the information needed to retrieve the data and allow them to design how the user experiences this flow.
|
|
546
|
+
|
|
547
|
+
To simplify retrieval and decryption, we provide an asynchronous [`getRefreshResult`](./docs/notabene/functions/getRefreshResult.md) function. It accepts a `refreshSource` and returns information about the associated transaction.
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
**Example**
|
|
551
|
+
|
|
552
|
+
```ts
|
|
553
|
+
import { getRefreshResult } from "@notabene/javascript-sdk";
|
|
554
|
+
|
|
555
|
+
const transaction = await getRefreshResult({
|
|
556
|
+
url: "https://safe-connections.notabene.id/17f76e4c-9a2a-4c34-afcb-b4868e609a96",
|
|
557
|
+
key: "1Lcp5SFhaMHH7CAEILrS8IWA6BXS4tFZunPx08WU5Ok="
|
|
558
|
+
})
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
#### Response from `getRefreshResult`
|
|
562
|
+
|
|
563
|
+
| **Property** | **Type** | **Optional?** | **Description** |
|
|
564
|
+
|--------------|---------------------------------------|---------------|---------------------------------------------------------------------------------|
|
|
565
|
+
| `id` | `UUID` | No | Unique identifier for the transaction. |
|
|
566
|
+
| `metadata` | `ConnectionMetadata` | No | Metadata associated with the transaction. |
|
|
567
|
+
| `status` | `'active'` \| `'completed'` \| `'closed'` | No | Current status of the transaction’s data collection. |
|
|
568
|
+
| `tx` | `T` | Yes | Ongoing transaction data (available when status is `active`). |
|
|
569
|
+
| `result` | `TransactionResponse<T>` | Yes | Finalized transaction data (available when status is `completed`). |
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
**Example Active Transaction Data**
|
|
573
|
+
|
|
574
|
+
```json
|
|
575
|
+
{
|
|
576
|
+
"id": "17f76e4c-9a2a-4c34-afcb-b4868e609a96",
|
|
577
|
+
"metadata": {
|
|
578
|
+
"participants": [
|
|
579
|
+
"did:ethr:0x54b75d2a0925508682e65194cccb6f1e8eaafb2c"
|
|
580
|
+
],
|
|
581
|
+
"nodeUrl": "https://api-qa.eu.notabene.id",
|
|
582
|
+
"transactionType": "withdraw"
|
|
583
|
+
},
|
|
584
|
+
"status": "active",
|
|
585
|
+
"tx": {
|
|
586
|
+
...
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
**Example Completed Transaction Data**
|
|
592
|
+
|
|
593
|
+
```json
|
|
594
|
+
{
|
|
595
|
+
"id": "17f76e4c-9a2a-4c34-afcb-b4868e609a96",
|
|
596
|
+
"metadata": {
|
|
597
|
+
"participants": [
|
|
598
|
+
"did:ethr:0x54b75d2a0925508682e65194cccb6f1e8eaafb2c" // DID of transaction participants
|
|
599
|
+
],
|
|
600
|
+
"nodeUrl": "https://api-qa.eu.notabene.dev",
|
|
601
|
+
"transactionType": "withdraw"
|
|
602
|
+
},
|
|
603
|
+
"status": "completed",
|
|
604
|
+
"result": { // the response returned from the embedded component when all information is successfully collected
|
|
605
|
+
"proof": {
|
|
606
|
+
...
|
|
607
|
+
},
|
|
608
|
+
"txCreate": {
|
|
609
|
+
...
|
|
610
|
+
},
|
|
611
|
+
"errors": [],
|
|
612
|
+
"status": "pending",
|
|
613
|
+
"valid": true,
|
|
614
|
+
"value": {
|
|
615
|
+
...
|
|
616
|
+
},
|
|
617
|
+
"ivms101": {
|
|
618
|
+
...
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
Once the host has retrieved the completed data, they can finalize the transaction by submitting it to the Notabene API.
|
|
626
|
+
|
|
433
627
|
## Error handling
|
|
434
628
|
|
|
435
629
|
If any error occurs, the `error` event is passed containing a message.
|
|
@@ -584,6 +778,13 @@ const options: TransactionOptions = {
|
|
|
584
778
|
VASPSearchControl.PENDING, // JS: 'pending'
|
|
585
779
|
], // Control searches for VASPs - Defaults to undefined
|
|
586
780
|
},
|
|
781
|
+
counterpartyAssist: { // Allows users to share a link to collect counterparty data
|
|
782
|
+
counterpartyTypes: [
|
|
783
|
+
PersonType.LEGAL, // JS: 'legal'
|
|
784
|
+
PersonType.NATURAL, // JS: 'natural'
|
|
785
|
+
PersonType.SELF, // JS: 'self'
|
|
786
|
+
],
|
|
787
|
+
}
|
|
587
788
|
};
|
|
588
789
|
const withdrawal = notabene.createWithdrawalAssist(tx, options);
|
|
589
790
|
```
|
package/dist/cjs/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"author": "Notabene <developers@notabene.id>",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"packageManager": "yarn@4.5.1",
|
|
13
|
-
"version": "2.9.
|
|
13
|
+
"version": "2.9.2",
|
|
14
14
|
"source": "src/notabene.ts",
|
|
15
15
|
"main": "dist/cjs/notabene.cjs",
|
|
16
16
|
"module": "dist/esm/notabene.js",
|
package/dist/esm/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"author": "Notabene <developers@notabene.id>",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"packageManager": "yarn@4.5.1",
|
|
13
|
-
"version": "2.9.
|
|
13
|
+
"version": "2.9.2",
|
|
14
14
|
"source": "src/notabene.ts",
|
|
15
15
|
"main": "dist/cjs/notabene.cjs",
|
|
16
16
|
"module": "dist/esm/notabene.js",
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"author": "Notabene <developers@notabene.id>",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"packageManager": "yarn@4.5.1",
|
|
13
|
-
"version": "2.9.
|
|
13
|
+
"version": "2.9.2",
|
|
14
14
|
"source": "src/notabene.ts",
|
|
15
15
|
"main": "dist/cjs/notabene.cjs",
|
|
16
16
|
"module": "dist/esm/notabene.js",
|