@notabene/javascript-sdk 2.9.0 → 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 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)
@@ -380,7 +386,7 @@ const connect = notabene.createConnectWallet(
380
386
  The Deposit Request lets your customers request deposits that are fully Travel Rule compliant.
381
387
 
382
388
  ```js
383
- const withdrawal = notabene.createDepositRequest({
389
+ const depositRequest = notabene.createDepositRequest({
384
390
  asset: 'ETH',
385
391
  destination: '0x...',
386
392
  amountDecimal: 1.23,
@@ -408,7 +414,7 @@ const deposit = notabene.createDepositAssist(
408
414
  {
409
415
  asset: 'ETH',
410
416
  amountDecimal: 1.23,
411
- origin: '0x...',
417
+ source: '0x...',
412
418
  destination: '0x...',
413
419
  transactionId: "UUID"
414
420
  },
@@ -421,7 +427,7 @@ const deposit = notabene.createDepositAssist(
421
427
  ### Parameters
422
428
 
423
429
  - `asset`: The cryptocurrency or token being transferred. See [Asset Specification](#asset-specification)
424
- - `origin`: The origin or blockchain address for the deposit. See [Origin](#origin)
430
+ - `source`: The source or blockchain address for the deposit. See [Origin](#origin)
425
431
  - `destination`: The destination or blockchain address for the deposit. See [Destination](#destination)
426
432
  - `amountDecimal`: Optional amount to deposit in decimal format. See [Transaction Amount](#transaction-amount)
427
433
  - `transactionId`: Optional transactionId of a Notabene transaction. Will be returned with the payload to assist updating the Transaction
@@ -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.
@@ -480,7 +674,6 @@ The `asset` field the following types of assets specified:
480
674
 
481
675
  - `notabene_asset` code passed as a`string`. See [Notabene Assets Service](https://devx.notabene.id/docs/coins-decimals#assets-service-api).
482
676
  - [CAIP-19](https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-19.md_) is a chain agnostic format allows you to support the widest amount of assets and blockchains including NFTs.
483
- - [DTI](https://www.iso.org/standard/80601.html) is the ISO Digital Token Identifier format. See [DTI registry](https://dtif.org/registry-search/) for supported tokens.
484
677
 
485
678
  ### Transaction amount
486
679
 
@@ -497,9 +690,9 @@ Specify the beneficiary address as `destination` using one of the following form
497
690
  - [BIP-21](https://en.bitcoin.it/wiki/BIP_0021) Bitcoin URI
498
691
  - Native blockchain address
499
692
 
500
- ### Origin
693
+ ### Source
501
694
 
502
- Specify the originator address as `origin` using one of the following formats:
695
+ Specify the originator address as `source` using one of the following formats:
503
696
 
504
697
  - [CAIP-10](https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-10.md_) is a chain agnostic format allows you to specify the specific blockchain and address
505
698
  - [EIP-3770](https://eips.ethereum.org/EIPS/eip-3770) EVM URI
@@ -575,16 +768,23 @@ const options: TransactionOptions = {
575
768
  nationalIdentification: false,
576
769
  countryOfRegistration: true,
577
770
  },
578
- vasps: {
579
- addUnknown: true, // Allow users to add a missing VASP - Defaults to false
580
- onlyActive: true, // Only list active VASPs - Default false
581
- searchable: [
582
- VASPSearchControl.ALLOWED, // JS: 'allowed'
583
- VASPSearchControl.PENDING, // JS: 'pending'
584
- ], // Control searches for VASPs - Defaults to undefined
585
- },
586
771
  hide: [ValidationSections.ASSET, ValidationSections.DESTINATION], // Don't show specific sections of component
587
772
  },
773
+ vasps: {
774
+ addUnknown: true, // Allow users to add a missing VASP - Defaults to false
775
+ onlyActive: true, // Only list active VASPs - Default false
776
+ searchable: [
777
+ VASPSearchControl.ALLOWED, // JS: 'allowed'
778
+ VASPSearchControl.PENDING, // JS: 'pending'
779
+ ], // Control searches for VASPs - Defaults to undefined
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
+ }
588
788
  };
589
789
  const withdrawal = notabene.createWithdrawalAssist(tx, options);
590
790
  ```
@@ -430,12 +430,8 @@ export declare interface Counterparty {
430
430
  *
431
431
  * @public
432
432
  */
433
- export declare type CounterpartyAssistConfig = {
434
- enabled?: boolean;
435
- } | {
436
- [key in PersonType]: {
437
- enabled?: boolean;
438
- };
433
+ export declare type CounterpartyAssistConfig = boolean | {
434
+ counterpartyTypes: PersonType[];
439
435
  };
440
436
 
441
437
  /**
@@ -1556,7 +1552,7 @@ export declare interface TransactionOptions {
1556
1552
  fields?: FieldTypes;
1557
1553
  vasps?: VASPOptions;
1558
1554
  hide?: ValidationSections[];
1559
- counterpartyAssistConfig?: CounterpartyAssistConfig;
1555
+ counterpartyAssist?: CounterpartyAssistConfig;
1560
1556
  }
1561
1557
 
1562
1558
  /**
@@ -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.0",
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",
@@ -430,12 +430,8 @@ export declare interface Counterparty {
430
430
  *
431
431
  * @public
432
432
  */
433
- export declare type CounterpartyAssistConfig = {
434
- enabled?: boolean;
435
- } | {
436
- [key in PersonType]: {
437
- enabled?: boolean;
438
- };
433
+ export declare type CounterpartyAssistConfig = boolean | {
434
+ counterpartyTypes: PersonType[];
439
435
  };
440
436
 
441
437
  /**
@@ -1556,7 +1552,7 @@ export declare interface TransactionOptions {
1556
1552
  fields?: FieldTypes;
1557
1553
  vasps?: VASPOptions;
1558
1554
  hide?: ValidationSections[];
1559
- counterpartyAssistConfig?: CounterpartyAssistConfig;
1555
+ counterpartyAssist?: CounterpartyAssistConfig;
1560
1556
  }
1561
1557
 
1562
1558
  /**
@@ -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.0",
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",
@@ -430,12 +430,8 @@ export declare interface Counterparty {
430
430
  *
431
431
  * @public
432
432
  */
433
- export declare type CounterpartyAssistConfig = {
434
- enabled?: boolean;
435
- } | {
436
- [key in PersonType]: {
437
- enabled?: boolean;
438
- };
433
+ export declare type CounterpartyAssistConfig = boolean | {
434
+ counterpartyTypes: PersonType[];
439
435
  };
440
436
 
441
437
  /**
@@ -1556,7 +1552,7 @@ export declare interface TransactionOptions {
1556
1552
  fields?: FieldTypes;
1557
1553
  vasps?: VASPOptions;
1558
1554
  hide?: ValidationSections[];
1559
- counterpartyAssistConfig?: CounterpartyAssistConfig;
1555
+ counterpartyAssist?: CounterpartyAssistConfig;
1560
1556
  }
1561
1557
 
1562
1558
  /**
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.0",
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/src/types.ts CHANGED
@@ -802,13 +802,9 @@ export type VASPOptions = {
802
802
  * @public
803
803
  */
804
804
  export type CounterpartyAssistConfig =
805
+ | boolean
805
806
  | {
806
- enabled?: boolean;
807
- }
808
- | {
809
- [key in PersonType]: {
810
- enabled?: boolean;
811
- };
807
+ counterpartyTypes: PersonType[];
812
808
  };
813
809
 
814
810
  /**
@@ -859,7 +855,7 @@ export interface TransactionOptions {
859
855
  fields?: FieldTypes;
860
856
  vasps?: VASPOptions;
861
857
  hide?: ValidationSections[]; // You can hide a specific section of the component by listing it here
862
- counterpartyAssistConfig?: CounterpartyAssistConfig;
858
+ counterpartyAssist?: CounterpartyAssistConfig;
863
859
  }
864
860
  /**
865
861
  * Component Message Type enum representing different message types that can be sent