@notabene/javascript-sdk 2.16.0-next.1 → 2.16.0-next.5

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/src/types.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { Invoice, Party } from '@taprsvp/types';
1
2
  import type {
2
3
  Address,
3
4
  Beneficiary,
@@ -23,6 +24,8 @@ export type {
23
24
  NationalIdentification,
24
25
  Originator,
25
26
  };
27
+ // Re-export TAIP-16 invoice types for SDK consumers
28
+ export type { Invoice };
26
29
  /**
27
30
  * Interoperable Virtual Asset Service Provider (VASP) Messaging Standard
28
31
  * @public
@@ -209,6 +212,7 @@ export type Source = BlockchainAddress | CAIP10;
209
212
 
210
213
  /**
211
214
  * A Uniform Resource Identifier
215
+ * @remarks This type will be narrowed to `` `${string}:${string}` `` in the next major release.
212
216
  * @public
213
217
  */
214
218
  export type URI = string;
@@ -617,6 +621,14 @@ export interface DepositRequestOptions {
617
621
  showQrCode?: boolean; // Defaults to true
618
622
  }
619
623
 
624
+ /** Output fields populated by the component on completion */
625
+ export interface InvoiceReaderResponse {
626
+ /** TAIP-16 compliant invoice data (populated by the component after PDF parsing) */
627
+ invoice?: Invoice;
628
+ merchant?: Party;
629
+ customer?: Party;
630
+ }
631
+
620
632
  /**
621
633
  * An object representing a connection request
622
634
  * @public
@@ -777,14 +789,53 @@ export enum VASPSearchControl {
777
789
  }
778
790
 
779
791
  /**
780
- * Options for which VASPs to be searchable
792
+ * Trust status assigned to a VASP in the Notabene network.
793
+ *
794
+ * Used by {@link VASPOptions.showTrustStatus} to filter which VASPs are listed in the picker.
795
+ *
781
796
  * @public
782
797
  */
783
- export type VASPOptions = {
784
- addUnknown?: boolean;
785
- onlyActive?: boolean;
786
- searchable?: VASPSearchControl[]; // If array left empty all VASPs will be searchable
787
- };
798
+ export type VASPTrustStatus = 'TRUSTED' | 'NEW' | 'FLAGGED' | 'BANNED';
799
+
800
+ /**
801
+ * Options controlling which VASPs are listed and searchable in the picker.
802
+ *
803
+ * Two mutually exclusive variants:
804
+ *
805
+ * - **V1** — `addUnknown`, `onlyActive`, `searchable` (filters by {@link VASPSearchControl} status).
806
+ * - **V2** — `addUnknown`, `onlyActive`, `showTrustStatus` (filters by {@link VASPTrustStatus}).
807
+ *
808
+ * `searchable` (V1-only) cannot be combined with `showTrustStatus` (V2-only);
809
+ * TypeScript will reject the mix at compile time. `addUnknown` and `onlyActive` are valid in both variants.
810
+ *
811
+ * @example V1
812
+ * ```ts
813
+ * { addUnknown: true, onlyActive: true, searchable: [VASPSearchControl.ALLOWED] }
814
+ * ```
815
+ *
816
+ * @example V2
817
+ * ```ts
818
+ * { addUnknown: true, onlyActive: true, showTrustStatus: ['TRUSTED', 'NEW'] }
819
+ * ```
820
+ *
821
+ * @public
822
+ */
823
+ export type VASPOptions =
824
+ // V1 vasps options
825
+ | {
826
+ addUnknown?: boolean;
827
+ onlyActive?: boolean;
828
+ searchable?: VASPSearchControl[]; // If array left empty all VASPs will be searchable
829
+ }
830
+ // V2 vasps options
831
+ | {
832
+ // Typing `searchable` as `undefined` (rather than omitting it) makes TS reject
833
+ // mixing V1 and V2 options, e.g. { searchable: [...], showTrustStatus: [...] }.
834
+ searchable?: undefined;
835
+ addUnknown?: boolean;
836
+ onlyActive?: boolean;
837
+ showTrustStatus?: VASPTrustStatus[];
838
+ };
788
839
 
789
840
  /**
790
841
  * Available methods for identity verification
@@ -24,6 +24,7 @@ import type {
24
24
  TransactionOptions,
25
25
  TravelAddress,
26
26
  VASPOptions,
27
+ VASPTrustStatus,
27
28
  Withdrawal,
28
29
  } from '../types';
29
30
  import {
@@ -31,6 +32,7 @@ import {
31
32
  PersonType,
32
33
  ProofTypes,
33
34
  ValidationSections,
35
+ VASPSearchControl,
34
36
  } from '../types';
35
37
  import {
36
38
  CAIP10_MATCHER,
@@ -194,10 +196,33 @@ export const arbitraryFieldTypes = (): fc.Arbitrary<FieldTypes> =>
194
196
  });
195
197
 
196
198
  export const arbitraryVASPOptions = (): fc.Arbitrary<VASPOptions> =>
197
- fc.record({
198
- addUnknown: fc.option(fc.boolean()),
199
- onlyActive: fc.option(fc.boolean()),
200
- });
199
+ fc.oneof(
200
+ fc.record({
201
+ addUnknown: fc.option(fc.boolean(), { nil: undefined }),
202
+ onlyActive: fc.option(fc.boolean(), { nil: undefined }),
203
+ searchable: fc.option(
204
+ fc.array(
205
+ fc.constantFrom(VASPSearchControl.ALLOWED, VASPSearchControl.PENDING),
206
+ ),
207
+ { nil: undefined },
208
+ ),
209
+ }),
210
+ fc.record({
211
+ addUnknown: fc.option(fc.boolean(), { nil: undefined }),
212
+ onlyActive: fc.option(fc.boolean(), { nil: undefined }),
213
+ showTrustStatus: fc.option(
214
+ fc.array(
215
+ fc.constantFrom<VASPTrustStatus>(
216
+ 'TRUSTED',
217
+ 'NEW',
218
+ 'FLAGGED',
219
+ 'BANNED',
220
+ ),
221
+ ),
222
+ { nil: undefined },
223
+ ),
224
+ }),
225
+ );
201
226
 
202
227
  export const arbitraryTransactionOptions =
203
228
  (): fc.Arbitrary<TransactionOptions> =>