@notabene/javascript-sdk 2.14.1 → 2.14.2-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.
@@ -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.14.1",
13
+ "version": "2.14.2-next.4",
14
14
  "source": "src/notabene.ts",
15
15
  "main": "dist/cjs/notabene.cjs",
16
16
  "module": "dist/esm/notabene.js",
@@ -82,6 +82,11 @@ export declare enum AgentType {
82
82
  VASP = "VASP"
83
83
  }
84
84
 
85
+ declare interface BaseRequestConfig {
86
+ originatorId?: DID_2;
87
+ beneficiaryId?: DID_2;
88
+ }
89
+
85
90
  /**
86
91
  * Beneficiary
87
92
  * Represents the receiver of the requested VA transfer
@@ -99,7 +104,7 @@ declare type Beneficiary = {
99
104
  * @public
100
105
  */
101
106
  declare type BeneficiaryFields = {
102
- destination?: Destination;
107
+ destination: Destination;
103
108
  };
104
109
 
105
110
  declare type BeneficiaryV2 = {
@@ -331,32 +336,45 @@ export declare interface ComponentResponse {
331
336
  /**
332
337
  * Transforms a Notabene component response to IVMS101 format
333
338
  *
339
+ * ## IVMS101 Config by Transaction Type
340
+ *
341
+ * The `originator` and `beneficiary` config options provide the customer's PII data.
342
+ * Which one to use depends on the transaction type:
343
+ *
344
+ * - **Withdrawals**: Pass `originator` - the customer is sending funds (customer = originator)
345
+ * - **Deposits**: Pass `beneficiary` - the customer is receiving funds (customer = beneficiary)
346
+ *
347
+ * For self-transfers, the provided data is automatically reused for both parties.
348
+ *
334
349
  * @param response - The response from the Notabene Embedded Component
335
- * @param delegateToken - The JWT delegate token for extracting the originator ID
350
+ * @param delegateToken - The JWT delegate token for extracting the customer ID
336
351
  * @param config - Configuration object with optional IDs
337
- * @param config.originatorId - Optional originator ID (auto-extracted from delegateToken if not provided)
338
- * @param config.beneficiaryId - Optional beneficiary ID (auto-generated if not provided)
339
- * @param config.referenceId - Optional reference ID for the transaction
340
- * @param config.originator - Optional originator data in V2 format
352
+ * @param config.originatorId - Optional originator ID (auto-extracted from delegateToken for withdrawals)
353
+ * @param config.beneficiaryId - Optional beneficiary ID (auto-extracted from delegateToken for deposits)
354
+ * @param config.originator - Customer's IVMS101 data for withdrawals (customer is the sender)
355
+ * @param config.beneficiary - Customer's IVMS101 data for deposits (customer is the receiver)
341
356
  * @returns The transformed request body in IVMS101 format
342
357
  *
343
358
  * @example
344
359
  * ```typescript
345
360
  * import { componentResponseToIVMS101 } from '$lib/notabene-tx-transformer';
346
361
  *
347
- * const requestBody = componentResponseToIVMS101(
348
- * result.response,
349
- * session.user.token,
350
- * { originator: myOriginatorData }
362
+ * // For withdrawals: pass originator (customer is sending)
363
+ * const withdrawalIvms = componentResponseToIVMS101(
364
+ * withdrawalResponse,
365
+ * delegateToken,
366
+ * { originator: customerIvmsData }
351
367
  * );
352
368
  *
353
- * await fetch('/entity/${vaspDid}/tx/${txId}/append', {
354
- * method: 'POST',
355
- * body: JSON.stringify(requestBody)
356
- * });
369
+ * // For deposits: pass beneficiary (customer is receiving)
370
+ * const depositIvms = componentResponseToIVMS101(
371
+ * depositResponse,
372
+ * delegateToken,
373
+ * { beneficiary: customerIvmsData }
374
+ * );
357
375
  * ```
358
376
  */
359
- export declare function componentResponseToIVMS101(response: TransactionResponse<Withdrawal>, delegateToken: string, config?: ResponseToTxRequestConfig): TransactionIVMS101Request;
377
+ export declare function componentResponseToIVMS101(response: TransactionResponse<Withdrawal | Deposit>, delegateToken: string, config?: ResponseToIVMS101RequestConfig): TransactionIVMS101Request;
360
378
 
361
379
  /**
362
380
  * Transforms a Notabene component response to a Version 2 transaction create API request body
@@ -373,9 +391,11 @@ export declare function componentResponseToIVMS101(response: TransactionResponse
373
391
  * ```typescript
374
392
  * import { componentResponseToTxCreateRequest } from '$lib/notabene-tx-transformer';
375
393
  *
376
- * withdrawal.on('complete', async (result) => {
394
+ * // Works with both withdrawal and deposit responses
395
+ * transaction.on('complete', async (result) => {
377
396
  * const requestBody = componentResponseToTxCreateRequest(
378
397
  * result.response,
398
+ * delegateToken,
379
399
  * {
380
400
  * originatorId: 'mailto:user@example.com',
381
401
  * beneficiaryId: 'urn:beneficiary:recipient',
@@ -390,7 +410,7 @@ export declare function componentResponseToIVMS101(response: TransactionResponse
390
410
  * });
391
411
  * ```
392
412
  */
393
- export declare function componentResponseToTxCreateRequest(response: TransactionResponse<Withdrawal>, delegateToken: string, config?: Omit<ResponseToTxRequestConfig, 'originator'>): TransactionCreateRequestV2;
413
+ export declare function componentResponseToTxCreateRequest(response: TransactionResponse<Withdrawal | Deposit>, delegateToken: string, config?: ResponseToTxCreateRequestConfig): TransactionCreateRequestV2;
394
414
 
395
415
  /**
396
416
  * Transforms a Notabene component response into txCreate, IVMS101, and confirmRelationship request bodies
@@ -400,50 +420,50 @@ export declare function componentResponseToTxCreateRequest(response: Transaction
400
420
  * which is useful for V2 workflows where you need to create a transaction first,
401
421
  * then append IVMS101 data to it, and finally confirm the relationship.
402
422
  *
423
+ * ## IVMS101 Config by Transaction Type
424
+ *
425
+ * The `originator` and `beneficiary` config options provide the customer's PII data.
426
+ * Which one to use depends on the transaction type:
427
+ *
428
+ * - **Withdrawals**: Pass `originator` - the customer is sending funds (customer = originator)
429
+ * - **Deposits**: Pass `beneficiary` - the customer is receiving funds (customer = beneficiary)
430
+ *
431
+ * For self-transfers, the provided data is automatically reused for both parties.
432
+ *
403
433
  * @param response - The response from the Notabene Embedded Component
404
- * @param delegateToken - The JWT delegate token for extracting the originator ID
434
+ * @param delegateToken - The JWT delegate token for extracting the customer ID
405
435
  * @param config - Optional configuration for IDs and reference
406
- * @param config.originatorId - Optional originator ID (auto-extracted from delegateToken if not provided)
407
- * @param config.beneficiaryId - Optional beneficiary ID (auto-generated if not provided)
436
+ * @param config.originatorId - Optional originator ID (auto-extracted from delegateToken for withdrawals)
437
+ * @param config.beneficiaryId - Optional beneficiary ID (auto-extracted from delegateToken for deposits)
408
438
  * @param config.referenceId - Optional reference ID (auto-generated if not provided)
409
- * @param config.originator - Optional originator data in V2 format
439
+ * @param config.originator - Customer's IVMS101 data for withdrawals (customer is the sender)
440
+ * @param config.beneficiary - Customer's IVMS101 data for deposits (customer is the receiver)
410
441
  * @returns Object with `createTx`, `ivms101`, and optional `confirmRelationship` properties containing the respective request bodies
411
442
  *
412
443
  * @example
413
444
  * ```typescript
414
445
  * import { componentResponseToTxRequests } from '$lib/notabene-tx-transformer';
415
446
  *
447
+ * // For withdrawals: pass originator (customer is sending)
416
448
  * withdrawal.on('complete', async (result) => {
417
- * const { createTx, ivms101, confirmRelationship } = componentResponseToTxRequests(
449
+ * const { createTx, ivms101 } = componentResponseToTxRequests(
418
450
  * result.response,
419
- * session.user.token,
420
- * { originator: originatorData }
451
+ * delegateToken,
452
+ * { originator: customerIvmsData }
421
453
  * );
454
+ * });
422
455
  *
423
- * // First, create the transaction
424
- * const txResponse = await fetch('/entity/${vaspDid}/tx', {
425
- * method: 'POST',
426
- * body: JSON.stringify(createTx)
427
- * });
428
- *
429
- * // Then, append IVMS101 data
430
- * const txId = txResponse.transfer['@id'];
431
- * await fetch(`/entity/${vaspDid}/tx/${txId}/append`, {
432
- * method: 'POST',
433
- * body: JSON.stringify(ivms101)
434
- * });
435
- *
436
- * // Finally, confirm relationship
437
- * if (confirmRelationship) {
438
- * await fetch(`/entity/${vaspDid}/relationship?to=${to}&from=${from}`, {
439
- * method: 'PATCH',
440
- * body: JSON.stringify({ proof: confirmRelationship.proof })
441
- * });
442
- * }
456
+ * // For deposits: pass beneficiary (customer is receiving)
457
+ * deposit.on('complete', async (result) => {
458
+ * const { createTx, ivms101 } = componentResponseToTxRequests(
459
+ * result.response,
460
+ * delegateToken,
461
+ * { beneficiary: customerIvmsData }
462
+ * );
443
463
  * });
444
464
  * ```
445
465
  */
446
- export declare function componentResponseToTxRequests(response: TransactionResponse<Withdrawal>, delegateToken: string, config?: ResponseToTxRequestConfig): {
466
+ export declare function componentResponseToTxRequests(response: TransactionResponse<Withdrawal | Deposit>, delegateToken: string, config?: ResponseToTxRequestConfig): {
447
467
  createTx: TransactionCreateRequestV2;
448
468
  ivms101: TransactionIVMS101Request;
449
469
  confirmRelationship?: {
@@ -633,6 +653,7 @@ export declare interface Counterparty {
633
653
  */
634
654
  export declare type CounterpartyAssistConfig = boolean | {
635
655
  counterpartyTypes: PersonType[];
656
+ /** @remarks Requires a transactionId to be passed in. */
636
657
  identityVerification?: IdentityVerificationConfig;
637
658
  };
638
659
 
@@ -918,8 +939,6 @@ export declare type HostMessage<T, O> = UpdateValue<T, O>;
918
939
  declare type IdentityVerificationConfig = {
919
940
  /** The required verification method. If not specified, none will be used */
920
941
  requiredMethod?: IdentityVerificationMethod;
921
- /** OAuth provider(s) to use for authentication. Can be a single provider or array of providers */
922
- oAuth?: OAuthProvider[] | OAuthProvider;
923
942
  };
924
943
 
925
944
  /**
@@ -927,8 +946,7 @@ declare type IdentityVerificationConfig = {
927
946
  * @public
928
947
  */
929
948
  export declare enum IdentityVerificationMethod {
930
- SMS = "sms",
931
- EMAIL = "email"
949
+ SMS = "sms"
932
950
  }
933
951
 
934
952
  /**
@@ -1307,15 +1325,6 @@ declare type NaturalPersonV2 = Omit<NaturalPerson_2, 'name'> & {
1307
1325
  name: NaturalPersonNameV2;
1308
1326
  };
1309
1327
 
1310
- /**
1311
- * Primary constructor for Notabene UX elements
1312
- *
1313
- * This class provides methods to create and manage various Notabene components
1314
- * such as withdrawal assist, deposit assist, connect, and deposit request.
1315
- * It also handles URL generation and fragment decoding for these components.
1316
- *
1317
- * @public
1318
- */
1319
1328
  declare class Notabene {
1320
1329
  private nodeUrl?;
1321
1330
  private authToken?;
@@ -1440,14 +1449,6 @@ export declare interface NotabeneConfig {
1440
1449
  locale?: string;
1441
1450
  }
1442
1451
 
1443
- /**
1444
- * Supported OAuth providers for authentication
1445
- * @public
1446
- */
1447
- export declare enum OAuthProvider {
1448
- COINBASE = "coinbase"
1449
- }
1450
-
1451
1452
  /**
1452
1453
  * Originating VASP
1453
1454
  * Represents the VASP which initiates the VA transfer
@@ -1475,7 +1476,7 @@ declare type Originator = {
1475
1476
  * @public
1476
1477
  */
1477
1478
  declare type OriginatorFields = {
1478
- source?: Source | Source[];
1479
+ source: Source | Source[];
1479
1480
  };
1480
1481
 
1481
1482
  declare type OriginatorV2 = {
@@ -1672,13 +1673,18 @@ export declare type ResizeRequest = {
1672
1673
  height: number;
1673
1674
  };
1674
1675
 
1675
- export declare interface ResponseToTxRequestConfig {
1676
- originatorId?: DID_2;
1677
- beneficiaryId?: DID_2;
1678
- referenceId?: string;
1676
+ declare interface ResponseToIVMS101RequestConfig extends BaseRequestConfig {
1679
1677
  originator?: OriginatorV2;
1678
+ beneficiary?: BeneficiaryV2;
1679
+ }
1680
+
1681
+ declare interface ResponseToTxCreateRequestConfig extends BaseRequestConfig {
1682
+ referenceId?: string;
1683
+ settlementAddress?: string;
1680
1684
  }
1681
1685
 
1686
+ export declare type ResponseToTxRequestConfig = ResponseToTxCreateRequestConfig & ResponseToIVMS101RequestConfig;
1687
+
1682
1688
  /**
1683
1689
  * Ownership Proof using Screenshot
1684
1690
  * @public
@@ -1796,8 +1802,11 @@ export declare enum Status {
1796
1802
  */
1797
1803
  export declare type Theme = {
1798
1804
  mode: 'light' | 'dark';
1805
+ backgroundColor?: string;
1799
1806
  primaryColor?: string;
1807
+ primaryForeground?: string;
1800
1808
  secondaryColor?: string;
1809
+ secondaryForeground?: string;
1801
1810
  fontFamily?: string;
1802
1811
  logo?: string;
1803
1812
  };
@@ -1922,6 +1931,7 @@ export declare interface TransactionOptions {
1922
1931
  hide?: ValidationSections[];
1923
1932
  counterpartyAssist?: CounterpartyAssistConfig;
1924
1933
  autoSubmit?: boolean;
1934
+ supportUrl?: string;
1925
1935
  }
1926
1936
 
1927
1937
  /**