@notabene/javascript-sdk 2.19.0 → 2.20.0-next.1
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/dist/cjs/notabene.cjs +6 -6
- package/dist/cjs/notabene.d.ts +38 -41
- package/dist/cjs/package.json +1 -1
- package/dist/esm/notabene.d.ts +38 -41
- package/dist/esm/notabene.js +1420 -1539
- package/dist/esm/package.json +1 -1
- package/dist/notabene.d.ts +38 -41
- package/dist/notabene.js +1420 -1539
- package/package.json +1 -1
- package/src/__tests__/EmbeddedComponent.portless-message.test.ts +66 -0
- package/src/__tests__/EmbeddedComponent.test.ts +3 -3
- package/src/components/EmbeddedComponent.ts +18 -8
- package/src/notabene.ts +1 -2
- package/src/responseTransformer/README.md +0 -30
- package/src/responseTransformer/__tests__/transformer.test.ts +2 -2
- package/src/responseTransformer/index.ts +1 -3
- package/src/responseTransformer/mappers.ts +9 -218
- package/src/responseTransformer/transformer.ts +1 -57
- package/src/responseTransformer/types.ts +0 -18
- package/src/types.ts +17 -0
- package/src/utils/MessageEventManager.ts +2 -0
- package/src/utils/__tests__/MessageEventManager.test.ts +8 -0
- package/src/utils/__tests__/connections.test.ts +29 -0
- package/src/utils/connections.ts +25 -1
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.
|
|
13
|
+
"version": "2.20.0-next.1",
|
|
14
14
|
"source": "src/notabene.ts",
|
|
15
15
|
"main": "dist/cjs/notabene.cjs",
|
|
16
16
|
"module": "dist/esm/notabene.js",
|
package/dist/notabene.d.ts
CHANGED
|
@@ -633,28 +633,6 @@ export declare function componentResponseToTxRequests(response: TransactionRespo
|
|
|
633
633
|
};
|
|
634
634
|
};
|
|
635
635
|
|
|
636
|
-
/**
|
|
637
|
-
* Transforms a Notabene component response to a Version 1 API request body
|
|
638
|
-
*
|
|
639
|
-
* @param response - The response from the Notabene TX Create component
|
|
640
|
-
* @returns The transformed request body ready for the Version 1 API
|
|
641
|
-
*
|
|
642
|
-
* @example
|
|
643
|
-
* ```typescript
|
|
644
|
-
* import { componentResponseToV1TxCreateRequest } from '$lib/notabene-tx-transformer';
|
|
645
|
-
*
|
|
646
|
-
* withdrawal.on('complete', async (result) => {
|
|
647
|
-
* const requestBody = componentResponseToV1TxCreateRequest(result.response);
|
|
648
|
-
*
|
|
649
|
-
* await fetch(endpointUrl, {
|
|
650
|
-
* method: 'POST',
|
|
651
|
-
* body: JSON.stringify(requestBody)
|
|
652
|
-
* });
|
|
653
|
-
* });
|
|
654
|
-
* ```
|
|
655
|
-
*/
|
|
656
|
-
export declare function componentResponseToV1TxCreateRequest(response: TransactionResponse<Withdrawal>): TransactionCreateRequest;
|
|
657
|
-
|
|
658
636
|
export declare interface ConnectionData<T extends ComponentRequest> {
|
|
659
637
|
readonly tx: T;
|
|
660
638
|
readonly authToken?: string;
|
|
@@ -710,6 +688,14 @@ export declare interface ConnectionMetadata {
|
|
|
710
688
|
readonly participants: readonly string[];
|
|
711
689
|
readonly transactionType: TransactionType;
|
|
712
690
|
readonly locale?: string;
|
|
691
|
+
/**
|
|
692
|
+
* Delivery target for Counterparty Assist completion/closure webhooks.
|
|
693
|
+
* Sent and stored as plaintext so the connection can route the event, so do not
|
|
694
|
+
* embed secrets (e.g. `?token=`) in this URL. Webhook payloads carry the encrypted
|
|
695
|
+
* `sealed` blob, whose successful decryption is itself an authenticity check;
|
|
696
|
+
* signed delivery is provided by the future Svix-backed pipeline.
|
|
697
|
+
*/
|
|
698
|
+
readonly webhookUrl?: string;
|
|
713
699
|
}
|
|
714
700
|
|
|
715
701
|
/**
|
|
@@ -854,6 +840,17 @@ export declare type CounterpartyAssistConfig = boolean | {
|
|
|
854
840
|
counterpartyTypes: PersonType[];
|
|
855
841
|
/** @remarks Requires a transactionId to be passed in. */
|
|
856
842
|
identityVerification?: IdentityVerificationConfig;
|
|
843
|
+
/**
|
|
844
|
+
* Optional URL that receives an `EC.counterpartyAssist*` webhook when the
|
|
845
|
+
* counterparty completes or closes their part. MVP-only per-link override;
|
|
846
|
+
* superseded by Portal-managed subscriptions post-migration.
|
|
847
|
+
*
|
|
848
|
+
* Transmitted and stored as plaintext, so do not embed secrets (e.g. `?token=`)
|
|
849
|
+
* in this URL. Payloads carry the encrypted `sealed` blob (a successful decrypt
|
|
850
|
+
* is itself an authenticity check); signed delivery is provided by the future
|
|
851
|
+
* Svix-backed pipeline.
|
|
852
|
+
*/
|
|
853
|
+
webhookUrl?: string;
|
|
857
854
|
};
|
|
858
855
|
|
|
859
856
|
declare type CountryCode = "AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AI" | "AQ" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BM" | "BT" | "BO" | "BQ" | "BA" | "BW" | "BV" | "BR" | "IO" | "BN" | "BG" | "BF" | "BI" | "CV" | "KH" | "CM" | "CA" | "KY" | "CF" | "TD" | "CL" | "CN" | "CX" | "CC" | "CO" | "KM" | "CD" | "CG" | "CK" | "CR" | "HR" | "CU" | "CW" | "CY" | "CZ" | "CI" | "DK" | "DJ" | "DM" | "DO" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "SZ" | "ET" | "FK" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "TF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GI" | "GR" | "GL" | "GD" | "GP" | "GU" | "GT" | "GG" | "GN" | "GW" | "GY" | "HT" | "HM" | "VA" | "HN" | "HK" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "KP" | "KR" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LY" | "LI" | "LT" | "LU" | "MO" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MH" | "MQ" | "MR" | "MU" | "YT" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "MM" | "NA" | "NR" | "NP" | "NL" | "NC" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "MK" | "MP" | "NO" | "OM" | "PK" | "PW" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PN" | "PL" | "PT" | "PR" | "QA" | "RO" | "RU" | "RW" | "RE" | "BL" | "SH" | "KN" | "LC" | "MF" | "PM" | "VC" | "WS" | "SM" | "ST" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SB" | "SO" | "ZA" | "GS" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SE" | "CH" | "SY" | "TW" | "TJ" | "TZ" | "TH" | "TL" | "TG" | "TK" | "TO" | "TT" | "TN" | "TR" | "TM" | "TC" | "TV" | "UG" | "UA" | "AE" | "GB" | "UM" | "US" | "UY" | "UZ" | "VU" | "VE" | "VN" | "VG" | "VI" | "WF" | "EH" | "YE" | "ZM" | "ZW" | "AX" | "XX";
|
|
@@ -894,6 +891,17 @@ export declare interface DeclarationProof extends OwnershipProof {
|
|
|
894
891
|
*/
|
|
895
892
|
export declare function decodeFragmentToObject(fragment: string): Record<string, string>;
|
|
896
893
|
|
|
894
|
+
/**
|
|
895
|
+
* Decrypt a Counterparty Assist webhook payload with the key the VASP captured
|
|
896
|
+
* at connection creation. Single call, no network fetch (the webhook already
|
|
897
|
+
* carried the ciphertext).
|
|
898
|
+
* @public
|
|
899
|
+
*/
|
|
900
|
+
export declare function decryptCounterpartyAssistPayload<T>({ sealed, key, }: {
|
|
901
|
+
sealed: string;
|
|
902
|
+
key: string;
|
|
903
|
+
}): Promise<T>;
|
|
904
|
+
|
|
897
905
|
/**
|
|
898
906
|
* An object representing a deposit transaction
|
|
899
907
|
* @public
|
|
@@ -1010,6 +1018,7 @@ export declare class EmbeddedComponent<V, O> {
|
|
|
1010
1018
|
private iframe?;
|
|
1011
1019
|
private eventManager;
|
|
1012
1020
|
private modal?;
|
|
1021
|
+
private messageHandler?;
|
|
1013
1022
|
/**
|
|
1014
1023
|
* Creates an instance of EmbeddedComponent.
|
|
1015
1024
|
* @param url - The URL of the embedded component
|
|
@@ -1138,7 +1147,7 @@ export declare type FieldTypes = {
|
|
|
1138
1147
|
* @param refreshSource Source information for the refresh operation
|
|
1139
1148
|
* @returns Promise resolving to connection result with decrypted data
|
|
1140
1149
|
*/
|
|
1141
|
-
export declare function getRefreshResult<T extends ComponentRequest>(refreshSource: RefreshSource): Promise<ConnectionResult<T>>;
|
|
1150
|
+
export declare function getRefreshResult<T extends ComponentRequest>(refreshSource: Pick<RefreshSource, 'url' | 'key'>): Promise<ConnectionResult<T>>;
|
|
1142
1151
|
|
|
1143
1152
|
/**
|
|
1144
1153
|
* Host Message Type enum representing different message types that can be sent
|
|
@@ -2858,6 +2867,12 @@ declare interface Refreshable {
|
|
|
2858
2867
|
export declare interface RefreshSource {
|
|
2859
2868
|
url: URI;
|
|
2860
2869
|
key: string;
|
|
2870
|
+
/**
|
|
2871
|
+
* The connection id (also embedded in `url`). Exposed directly so consumers can
|
|
2872
|
+
* correlate a Counterparty Assist webhook event (whose `payload.id` is this id)
|
|
2873
|
+
* without parsing it out of the url.
|
|
2874
|
+
*/
|
|
2875
|
+
id: string;
|
|
2861
2876
|
}
|
|
2862
2877
|
|
|
2863
2878
|
declare type RequestID = UUID;
|
|
@@ -3282,24 +3297,6 @@ export declare interface Transaction extends ComponentRequest {
|
|
|
3282
3297
|
*/
|
|
3283
3298
|
export declare type TransactionAsset = NotabeneAsset | CAIP19 | DTI;
|
|
3284
3299
|
|
|
3285
|
-
export declare interface TransactionCreateRequest {
|
|
3286
|
-
transactionAsset: any;
|
|
3287
|
-
transactionAmount: string;
|
|
3288
|
-
beneficiaryDid?: string;
|
|
3289
|
-
originatorVASPdid: string;
|
|
3290
|
-
beneficiaryVASPdid?: string;
|
|
3291
|
-
beneficiaryVASPname?: string;
|
|
3292
|
-
beneficiaryVASPwebsite?: string;
|
|
3293
|
-
transactionBlockchainInfo: {
|
|
3294
|
-
origin?: string;
|
|
3295
|
-
destination?: string;
|
|
3296
|
-
};
|
|
3297
|
-
beneficiaryProof?: any;
|
|
3298
|
-
beneficiary?: any;
|
|
3299
|
-
originator?: any;
|
|
3300
|
-
originatorEqualsBeneficiary?: boolean;
|
|
3301
|
-
}
|
|
3302
|
-
|
|
3303
3300
|
export declare interface TransactionCreateRequestV2 {
|
|
3304
3301
|
originator: {
|
|
3305
3302
|
'@id': string;
|