@notabene/javascript-sdk 2.0.3 → 2.1.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 +4 -0
- package/dist/notabene.cjs +1 -1
- package/dist/notabene.d.ts +23 -17
- package/dist/notabene.js +16 -15
- package/docs/README.md +4 -0
- package/docs/_media/TransactionOptions.md +6 -6
- package/docs/ivms/types/enumerations/PayloadVersionCode.md +2 -2
- package/docs/ivms/types/interfaces/PayloadMetadata.md +2 -2
- package/docs/ivms/types/type-aliases/Address.md +1 -1
- package/docs/ivms/types/type-aliases/AddressTypeCode.md +1 -1
- package/docs/ivms/types/type-aliases/Beneficiary.md +1 -1
- package/docs/ivms/types/type-aliases/BeneficiaryVASP.md +1 -1
- package/docs/ivms/types/type-aliases/DateAndPlaceOfBirth.md +1 -1
- package/docs/ivms/types/type-aliases/ISOCountryCode.md +1 -1
- package/docs/ivms/types/type-aliases/ISODate.md +1 -1
- package/docs/ivms/types/type-aliases/IVMS101.md +1 -1
- package/docs/ivms/types/type-aliases/IntermediaryVASP.md +1 -1
- package/docs/ivms/types/type-aliases/LegalPerson.md +1 -1
- package/docs/ivms/types/type-aliases/LegalPersonName.md +1 -1
- package/docs/ivms/types/type-aliases/LegalPersonNameID.md +1 -1
- package/docs/ivms/types/type-aliases/LegalPersonNameTypeCode.md +1 -1
- package/docs/ivms/types/type-aliases/LocalLegalPersonNameID.md +1 -1
- package/docs/ivms/types/type-aliases/LocalNaturalPersonNameID.md +1 -1
- package/docs/ivms/types/type-aliases/NationalIdentification.md +1 -1
- package/docs/ivms/types/type-aliases/NationalIdentifierTypeCode.md +1 -1
- package/docs/ivms/types/type-aliases/NaturalPerson.md +1 -1
- package/docs/ivms/types/type-aliases/NaturalPersonName.md +1 -1
- package/docs/ivms/types/type-aliases/NaturalPersonNameID.md +1 -1
- package/docs/ivms/types/type-aliases/NaturalPersonNameTypeCode.md +1 -1
- package/docs/ivms/types/type-aliases/OriginatingVASP.md +1 -1
- package/docs/ivms/types/type-aliases/Originator.md +1 -1
- package/docs/ivms/types/type-aliases/Person.md +1 -1
- package/docs/ivms/types/type-aliases/TransferPath.md +1 -1
- package/docs/ivms/types/type-aliases/TransliterationMethodCode.md +1 -1
- package/docs/notabene/README.md +6 -6
- package/docs/notabene/classes/EmbeddedComponent.md +16 -16
- package/docs/notabene/classes/default.md +6 -6
- package/docs/notabene/functions/decodeFragmentToObject.md +1 -1
- package/docs/notabene/interfaces/NotabeneConfig.md +5 -5
- package/docs/notabene/type-aliases/MessageCallback.md +1 -1
- package/docs/types/README.md +1 -1
- package/docs/types/enumerations/AgentType.md +2 -2
- package/docs/types/enumerations/CMType.md +6 -17
- package/docs/types/enumerations/HMType.md +2 -2
- package/docs/types/enumerations/PersonType.md +3 -3
- package/docs/types/enumerations/ProofStatus.md +4 -4
- package/docs/types/enumerations/ProofTypes.md +12 -12
- package/docs/types/enumerations/Status.md +5 -5
- package/docs/types/enumerations/VASPSearchControl.md +34 -0
- package/docs/types/enumerations/ValidationSections.md +4 -4
- package/docs/types/interfaces/Agent.md +6 -6
- package/docs/types/interfaces/CallbackOptions.md +2 -2
- package/docs/types/interfaces/ComponentRequest.md +2 -2
- package/docs/types/interfaces/ComponentResponse.md +4 -4
- package/docs/types/interfaces/ConnectionRecord.md +7 -7
- package/docs/types/interfaces/ConnectionRequest.md +3 -3
- package/docs/types/interfaces/Counterparty.md +10 -10
- package/docs/types/interfaces/DeclarationProof.md +6 -6
- package/docs/types/interfaces/Deposit.md +9 -9
- package/docs/types/interfaces/DepositRequest.md +7 -7
- package/docs/types/interfaces/DepositRequestOptions.md +1 -1
- package/docs/types/interfaces/LegalPerson.md +13 -13
- package/docs/types/interfaces/MicroTransferProof.md +9 -9
- package/docs/types/interfaces/NaturalPerson.md +13 -13
- package/docs/types/interfaces/OwnershipProof.md +4 -4
- package/docs/types/interfaces/ScreenshotProof.md +5 -5
- package/docs/types/interfaces/SignatureProof.md +7 -7
- package/docs/types/interfaces/ThresholdOptions.md +3 -3
- package/docs/types/interfaces/Transaction.md +8 -8
- package/docs/types/interfaces/TransactionOptions.md +6 -6
- package/docs/types/interfaces/TransactionResponse.md +8 -8
- package/docs/types/interfaces/VASP.md +9 -9
- package/docs/types/interfaces/Wallet.md +8 -8
- package/docs/types/interfaces/Withdrawal.md +9 -9
- package/docs/types/type-aliases/BlockchainAddress.md +1 -1
- package/docs/types/type-aliases/CAIP10.md +1 -1
- package/docs/types/type-aliases/CAIP19.md +1 -1
- package/docs/types/type-aliases/CAIP2.md +1 -1
- package/docs/types/type-aliases/CAIP220.md +1 -1
- package/docs/types/type-aliases/Cancel.md +1 -1
- package/docs/types/type-aliases/Completed.md +1 -1
- package/docs/types/type-aliases/ComponentMessage.md +2 -4
- package/docs/types/type-aliases/ConnectionOptions.md +1 -1
- package/docs/types/type-aliases/CryptoCredential.md +1 -1
- package/docs/types/type-aliases/DID.md +1 -1
- package/docs/types/type-aliases/DTI.md +1 -1
- package/docs/types/type-aliases/Destination.md +1 -1
- package/docs/types/type-aliases/Error.md +17 -1
- package/docs/types/type-aliases/FieldOptions.md +1 -1
- package/docs/types/type-aliases/FieldTypes.md +1 -1
- package/docs/types/type-aliases/HostMessage.md +1 -1
- package/docs/types/type-aliases/ISOCurrency.md +1 -1
- package/docs/types/type-aliases/InvalidValue.md +1 -1
- package/docs/types/type-aliases/LEI.md +1 -1
- package/docs/types/type-aliases/LegalPersonFieldName.md +1 -1
- package/docs/types/type-aliases/LegalPersonFields.md +1 -1
- package/docs/types/type-aliases/NaturalPersonFieldName.md +1 -1
- package/docs/types/type-aliases/NaturalPersonFields.md +1 -1
- package/docs/types/type-aliases/NotabeneAsset.md +1 -1
- package/docs/types/type-aliases/ResizeRequest.md +1 -1
- package/docs/types/type-aliases/Source.md +1 -1
- package/docs/types/type-aliases/Theme.md +9 -9
- package/docs/types/type-aliases/TransactionAsset.md +1 -1
- package/docs/types/type-aliases/TravelAddress.md +1 -1
- package/docs/types/type-aliases/URI.md +1 -1
- package/docs/types/type-aliases/UUID.md +1 -1
- package/docs/types/type-aliases/UpdateValue.md +1 -1
- package/docs/types/type-aliases/V1Asset.md +1 -1
- package/docs/types/type-aliases/V1Transaction.md +1 -1
- package/docs/types/type-aliases/VASPOptions.md +5 -1
- package/docs/types/type-aliases/ValidationError.md +1 -1
- package/package.json +1 -1
- package/src/notabene.ts +2 -2
- package/src/types.ts +22 -17
- package/src/utils/__tests__/MessageEventManager.test.ts +7 -7
- package/docs/types/type-aliases/Ready.md +0 -21
package/src/types.ts
CHANGED
|
@@ -235,10 +235,10 @@ export type ISOCurrency = string;
|
|
|
235
235
|
* @public
|
|
236
236
|
*/
|
|
237
237
|
export type Theme = {
|
|
238
|
-
primaryColor
|
|
239
|
-
secondaryColor
|
|
240
|
-
fontFamily
|
|
241
|
-
logo
|
|
238
|
+
primaryColor?: string;
|
|
239
|
+
secondaryColor?: string;
|
|
240
|
+
fontFamily?: string;
|
|
241
|
+
logo?: string;
|
|
242
242
|
};
|
|
243
243
|
|
|
244
244
|
/**
|
|
@@ -700,6 +700,19 @@ export type FieldTypes = {
|
|
|
700
700
|
legalPerson?: LegalPersonFields;
|
|
701
701
|
};
|
|
702
702
|
|
|
703
|
+
/**
|
|
704
|
+
* VASP Visibility Control representing allow/deny behaviour for VASP visibility
|
|
705
|
+
*
|
|
706
|
+
* @remarks
|
|
707
|
+
* - ALLOWED: Include VASPs you have explicitly allowed in the Notabene Network
|
|
708
|
+
* - PENDING: Include VASPs neither allowed nor denied
|
|
709
|
+
* @public
|
|
710
|
+
*/
|
|
711
|
+
export const enum VASPSearchControl {
|
|
712
|
+
ALLOWED = 'allowed',
|
|
713
|
+
PENDING = 'pending',
|
|
714
|
+
}
|
|
715
|
+
|
|
703
716
|
/**
|
|
704
717
|
* Options for which VASPs to be searchable
|
|
705
718
|
* @public
|
|
@@ -707,6 +720,7 @@ export type FieldTypes = {
|
|
|
707
720
|
export type VASPOptions = {
|
|
708
721
|
addUnknown?: boolean;
|
|
709
722
|
onlyActive?: boolean;
|
|
723
|
+
searchable?: VASPSearchControl[]; // If array left empty all VASPs will be searchable
|
|
710
724
|
};
|
|
711
725
|
|
|
712
726
|
/**
|
|
@@ -765,7 +779,6 @@ export interface TransactionOptions {
|
|
|
765
779
|
* - COMPLETE: Indicates a completed operation with response data
|
|
766
780
|
* - RESIZE: Request to adjust component size/dimensions
|
|
767
781
|
* - RESULT: Operation result notification
|
|
768
|
-
* - READY: Component is initialized and ready
|
|
769
782
|
* - INVALID: Validation failed with errors
|
|
770
783
|
* - ERROR: Operation encountered an error
|
|
771
784
|
* - CANCEL: Operation was cancelled
|
|
@@ -775,7 +788,6 @@ export const enum CMType {
|
|
|
775
788
|
COMPLETE = 'complete',
|
|
776
789
|
RESIZE = 'resize',
|
|
777
790
|
RESULT = 'result',
|
|
778
|
-
READY = 'ready',
|
|
779
791
|
INVALID = 'invalid',
|
|
780
792
|
ERROR = 'error',
|
|
781
793
|
CANCEL = 'cancel',
|
|
@@ -792,14 +804,6 @@ export type Completed<T> = {
|
|
|
792
804
|
response: TransactionResponse<T>;
|
|
793
805
|
};
|
|
794
806
|
|
|
795
|
-
/**
|
|
796
|
-
* Represents a ready component message
|
|
797
|
-
* @public
|
|
798
|
-
*/
|
|
799
|
-
export type Ready = {
|
|
800
|
-
type: CMType.READY;
|
|
801
|
-
};
|
|
802
|
-
|
|
803
807
|
/**
|
|
804
808
|
* Represents a resize request component message. This is handled by the library.
|
|
805
809
|
* @internal
|
|
@@ -812,11 +816,15 @@ export type ResizeRequest = {
|
|
|
812
816
|
/**
|
|
813
817
|
* Represents an error component message
|
|
814
818
|
* @param message - Error message
|
|
819
|
+
* @param description - Description of the error message
|
|
820
|
+
* @param identifier - Identifier code of the error message
|
|
815
821
|
* @public
|
|
816
822
|
*/
|
|
817
823
|
export type Error = {
|
|
818
824
|
type: CMType.ERROR;
|
|
819
825
|
message: string;
|
|
826
|
+
description?: string;
|
|
827
|
+
identifier?: string;
|
|
820
828
|
};
|
|
821
829
|
|
|
822
830
|
/**
|
|
@@ -849,7 +857,6 @@ export type InvalidValue<T> = {
|
|
|
849
857
|
* - Completed: Operation finished successfully with response data
|
|
850
858
|
* - Cancel: User cancelled the operation
|
|
851
859
|
* - Error: Operation failed with error message
|
|
852
|
-
* - Ready: Component initialized and ready for use
|
|
853
860
|
* - ResizeRequest: Component needs to adjust its dimensions
|
|
854
861
|
* - InvalidValue: Validation failed with current partial value
|
|
855
862
|
*
|
|
@@ -858,7 +865,6 @@ export type InvalidValue<T> = {
|
|
|
858
865
|
* @see {@link Completed} For successful completion message format
|
|
859
866
|
* @see {@link Cancel} For cancellation message format
|
|
860
867
|
* @see {@link Error} For error message format
|
|
861
|
-
* @see {@link Ready} For ready message format
|
|
862
868
|
* @see {@link ResizeRequest} For resize message format
|
|
863
869
|
* @see {@link InvalidValue} For validation failure message format
|
|
864
870
|
* @public
|
|
@@ -867,7 +873,6 @@ export type ComponentMessage<T> =
|
|
|
867
873
|
| Completed<T>
|
|
868
874
|
| Cancel
|
|
869
875
|
| Error
|
|
870
|
-
| Ready
|
|
871
876
|
| ResizeRequest
|
|
872
877
|
| InvalidValue<T>;
|
|
873
878
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
2
|
import {
|
|
3
|
-
HMType,
|
|
4
3
|
type TransactionOptions,
|
|
5
4
|
type UpdateValue,
|
|
6
5
|
type Withdrawal,
|
|
@@ -34,13 +33,13 @@ describe('MessageEventManager', () => {
|
|
|
34
33
|
});
|
|
35
34
|
|
|
36
35
|
it('should subscribe and receive messages of a specific type', () => {
|
|
37
|
-
const
|
|
38
|
-
messageEventManager.on('
|
|
36
|
+
const completeHandler = vi.fn();
|
|
37
|
+
messageEventManager.on('complete', completeHandler);
|
|
39
38
|
|
|
40
|
-
const
|
|
41
|
-
mockPort.onmessage!({ data:
|
|
39
|
+
const completeMessage = { type: 'complete' };
|
|
40
|
+
mockPort.onmessage!({ data: completeMessage } as MessageEvent);
|
|
42
41
|
|
|
43
|
-
expect(
|
|
42
|
+
expect(completeHandler).toHaveBeenCalledWith(completeMessage);
|
|
44
43
|
});
|
|
45
44
|
|
|
46
45
|
it('should not call handlers for different message types', () => {
|
|
@@ -82,7 +81,8 @@ describe('MessageEventManager', () => {
|
|
|
82
81
|
|
|
83
82
|
it('should send messages through the port', () => {
|
|
84
83
|
const message: UpdateValue<Withdrawal, TransactionOptions> = {
|
|
85
|
-
type
|
|
84
|
+
// @ts-expect-error Type '"update"' is not assignable to type 'HMType.UPDATE'.
|
|
85
|
+
type: 'update',
|
|
86
86
|
value: { requestId: 'id' },
|
|
87
87
|
};
|
|
88
88
|
messageEventManager.send(message);
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
[**@notabene/javascript-sdk**](../../README.md) • **Docs**
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@notabene/javascript-sdk](../../modules.md) / [types](../README.md) / Ready
|
|
6
|
-
|
|
7
|
-
# Type Alias: Ready
|
|
8
|
-
|
|
9
|
-
> **Ready**: `object`
|
|
10
|
-
|
|
11
|
-
Represents a ready component message
|
|
12
|
-
|
|
13
|
-
## Type declaration
|
|
14
|
-
|
|
15
|
-
### type
|
|
16
|
-
|
|
17
|
-
> **type**: [`READY`](../enumerations/CMType.md#ready)
|
|
18
|
-
|
|
19
|
-
## Defined in
|
|
20
|
-
|
|
21
|
-
[types.ts:799](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/types.ts#L799)
|