@lydianpay/sdk-web 3.16.0 → 3.17.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/dist/chunks/{browser-CvvbM3fl.js → browser-D7hYBJ05.js} +1 -1
- package/dist/chunks/{connect-multichain-JrYKtq5o.js → connect-multichain-Cq0nfkUh.js} +9 -9
- package/dist/chunks/{index-GdvVEXe8.js → index-CA1kNBo-.js} +128 -101
- package/dist/chunks/{index-CD8P_mOo.js → index-CXIhRfTO.js} +2 -2
- package/dist/chunks/{index-DAsQ6TuK.js → index-Cg9sFEhj.js} +1 -1
- package/dist/chunks/{index-Bwl_cWLK.js → index-D4W8-w8-.js} +1 -1
- package/dist/chunks/{index-DGLVpgOJ.js → index-eNQBuUBY.js} +2 -2
- package/dist/chunks/{index-DFLPr81C.js → index-iy5xf-sU.js} +3 -3
- package/dist/chunks/{mountEngine-B9qRQyLg.js → mountEngine-CBqqdixh.js} +12816 -12637
- package/dist/lydian.js +1 -1
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/types.d.ts +21 -9
- package/dist/types/ui/kycFlow.d.ts +6 -5
- package/dist/types/ui/kycValidation.d.ts +51 -18
- package/dist/types/ui/kycVerificationRequest.d.ts +5 -7
- package/dist/types/ui/otpValidation.d.ts +0 -4
- package/dist/types/ui/react/KycDocumentFields.d.ts +11 -0
- package/dist/types/ui/react/KycFields.d.ts +15 -0
- package/dist/types/ui/react/checkoutActions.d.ts +1 -3
- package/dist/types/ui/react/checkoutStore.d.ts +8 -7
- package/package.json +1 -1
package/dist/types/types.d.ts
CHANGED
|
@@ -214,8 +214,12 @@ export type CreateTransactionResponse = {
|
|
|
214
214
|
additionalCustomerFee: number;
|
|
215
215
|
address: string;
|
|
216
216
|
status: number;
|
|
217
|
-
requiredFields: string[];
|
|
218
217
|
supportedDocumentTypes: string[];
|
|
218
|
+
combinedRequiredFields?: string[];
|
|
219
|
+
kycGroupFields?: string[];
|
|
220
|
+
kycGroupCount?: number;
|
|
221
|
+
travelGroupFields?: string[];
|
|
222
|
+
travelGroupCount?: number;
|
|
219
223
|
expiration?: string;
|
|
220
224
|
calculatedTotals?: CalculatedTotals;
|
|
221
225
|
cryptoFXRate?: number;
|
|
@@ -238,14 +242,22 @@ export type BroadcastTransferResponse = {
|
|
|
238
242
|
export type KYCVerificationRequest = {
|
|
239
243
|
asset: string;
|
|
240
244
|
network: string;
|
|
241
|
-
firstName
|
|
242
|
-
lastName
|
|
243
|
-
email
|
|
244
|
-
street
|
|
245
|
-
city
|
|
246
|
-
region
|
|
247
|
-
postalCode
|
|
248
|
-
country
|
|
245
|
+
firstName?: string;
|
|
246
|
+
lastName?: string;
|
|
247
|
+
email?: string;
|
|
248
|
+
street?: string;
|
|
249
|
+
city?: string;
|
|
250
|
+
region?: string;
|
|
251
|
+
postalCode?: string;
|
|
252
|
+
country?: string;
|
|
253
|
+
yearOfBirth?: string;
|
|
254
|
+
monthOfBirth?: string;
|
|
255
|
+
dayOfBirth?: string;
|
|
256
|
+
cityOfBirth?: string;
|
|
257
|
+
regionOfBirth?: string;
|
|
258
|
+
countryOfBirth?: string;
|
|
259
|
+
nationalIDNumber?: string;
|
|
260
|
+
customerIDNumber?: string;
|
|
249
261
|
storeKYC: boolean;
|
|
250
262
|
documentType: string | undefined;
|
|
251
263
|
documentFiles: File[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type CheckoutStore } from './react/checkoutStore';
|
|
2
2
|
import type { API } from '../network';
|
|
3
3
|
import type { CheckoutPresentation } from './checkoutPresentation';
|
|
4
|
-
import type {
|
|
4
|
+
import type { KycFormValues } from './kycValidation';
|
|
5
5
|
import type { PaymentFlow } from './paymentFlow';
|
|
6
6
|
import type { ScreenNavigator } from './screenNavigator';
|
|
7
7
|
import type { SessionLifecycle } from './sessionLifecycle';
|
|
@@ -12,15 +12,16 @@ export interface KycFlow {
|
|
|
12
12
|
/** The -3 screen. No-op without a transaction to attach the details to. */
|
|
13
13
|
showScreen(): void;
|
|
14
14
|
submit(submission: {
|
|
15
|
-
values:
|
|
15
|
+
values: KycFormValues;
|
|
16
16
|
documentFront: File | null;
|
|
17
17
|
documentBack: File | null;
|
|
18
18
|
storeKyc: boolean;
|
|
19
19
|
}): Promise<void>;
|
|
20
|
-
/** A recognised customer needs only documents; the form never renders. */
|
|
21
|
-
showDocumentOnlyScreen(customerUUID: string, country: string): void;
|
|
22
20
|
/** Re-promote the same session against a stored customer record. */
|
|
23
|
-
restoreWithCustomerUUID(
|
|
21
|
+
restoreWithCustomerUUID(restored: {
|
|
22
|
+
customerUUID: string;
|
|
23
|
+
country: string;
|
|
24
|
+
}): Promise<void>;
|
|
24
25
|
}
|
|
25
26
|
export interface KycFlowSeams {
|
|
26
27
|
reportFailure(message: string, reason: PaymentFailureReason, options?: {
|
|
@@ -1,23 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import type { CreateTransactionResponse } from '../types';
|
|
2
|
+
export declare const KYC_FIELD_PARTS: {
|
|
3
|
+
readonly firstName: readonly ["firstName"];
|
|
4
|
+
readonly lastName: readonly ["lastName"];
|
|
5
|
+
readonly email: readonly ["email"];
|
|
6
|
+
readonly walletAddress: readonly ["walletAddress"];
|
|
7
|
+
readonly dateAndPlaceOfBirth: readonly ["dateOfBirth", "cityOfBirth", "regionOfBirth", "countryOfBirth"];
|
|
8
|
+
readonly dateOfBirth: readonly ["dateOfBirth"];
|
|
9
|
+
readonly nationalIDNumber: readonly ["nationalIDNumber"];
|
|
10
|
+
readonly customerIDNumber: readonly ["customerIDNumber"];
|
|
11
|
+
readonly physicalAddress: readonly ["street", "city", "region", "postalCode", "country"];
|
|
12
|
+
readonly country: readonly ["country"];
|
|
13
|
+
};
|
|
14
|
+
export type KycField = keyof typeof KYC_FIELD_PARTS;
|
|
15
|
+
export type KycFieldPart = (typeof KYC_FIELD_PARTS)[KycField][number];
|
|
16
|
+
declare const KYC_DOCUMENT_TYPES: readonly ["ID_CARD", "PASSPORT", "RESIDENCE_PERMIT", "DRIVERS"];
|
|
17
|
+
export type KycDocumentType = (typeof KYC_DOCUMENT_TYPES)[number];
|
|
18
|
+
export type KycFormValues = Record<KycFieldPart, string> & {
|
|
11
19
|
documentType: string;
|
|
12
20
|
hasDocumentFront: boolean;
|
|
13
21
|
hasDocumentBack: boolean;
|
|
14
22
|
};
|
|
15
|
-
export type
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
export type KycFieldGroup = {
|
|
24
|
+
fields: KycField[];
|
|
25
|
+
count: number;
|
|
26
|
+
shownParts: KycFieldPart[];
|
|
27
|
+
};
|
|
28
|
+
export type KycRequirements = {
|
|
29
|
+
requiredFields: KycField[];
|
|
30
|
+
requiredParts: KycFieldPart[];
|
|
31
|
+
fieldGroups: KycFieldGroup[];
|
|
32
|
+
documentTypes: KycDocumentType[];
|
|
33
|
+
unsupportedFields: string[];
|
|
34
|
+
};
|
|
35
|
+
export declare function getKycRequirements({ transaction, hasConnectedWallet, }: {
|
|
36
|
+
transaction: Partial<CreateTransactionResponse>;
|
|
37
|
+
hasConnectedWallet: boolean;
|
|
38
|
+
}): KycRequirements;
|
|
39
|
+
export declare function canFulfillKycRequirements({ requiredFields, fieldGroups, documentTypes, unsupportedFields, }: KycRequirements): boolean;
|
|
40
|
+
export declare function isKycEmailCollected({ requiredParts, fieldGroups }: KycRequirements): boolean;
|
|
41
|
+
export declare function getKycPartError(part: KycFieldPart, values: KycFormValues): string | null;
|
|
42
|
+
export declare function isKycFieldComplete(field: KycField, values: KycFormValues): boolean;
|
|
43
|
+
export declare function documentHasTwoSides(documentType: string): boolean;
|
|
44
|
+
export declare function getKycGroupGuidance({ group, values, }: {
|
|
45
|
+
group: KycFieldGroup;
|
|
46
|
+
values: KycFormValues;
|
|
47
|
+
}): {
|
|
48
|
+
requiredCount: number;
|
|
49
|
+
totalCount: number;
|
|
50
|
+
completedCount: number;
|
|
18
51
|
};
|
|
19
|
-
export declare
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}):
|
|
23
|
-
export
|
|
52
|
+
export declare function isKycFormComplete({ requirements, values, }: {
|
|
53
|
+
requirements: KycRequirements;
|
|
54
|
+
values: KycFormValues;
|
|
55
|
+
}): boolean;
|
|
56
|
+
export {};
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type KycFormValues, type KycRequirements } from './kycValidation';
|
|
2
2
|
import type { KYCVerificationRequest } from '../types';
|
|
3
|
-
export declare function
|
|
4
|
-
|
|
3
|
+
export declare function getKycVerificationRequest({ requirements, values, asset, network, storeKyc, documentFront, documentBack, restoring, connectedWalletAddress, }: {
|
|
4
|
+
requirements: KycRequirements;
|
|
5
|
+
values: KycFormValues;
|
|
5
6
|
asset: string;
|
|
6
7
|
network: string;
|
|
7
8
|
storeKyc: boolean;
|
|
8
9
|
documentFront: File | null;
|
|
9
10
|
documentBack: File | null;
|
|
10
|
-
/** False when the transaction names no document types; nothing is attached. */
|
|
11
|
-
supportsDocuments: boolean;
|
|
12
|
-
/** Non-null only while finishing a recognised customer's KYC — see restoreContextFor. */
|
|
13
11
|
restoring: {
|
|
14
12
|
customerUUID: string;
|
|
15
13
|
country: string;
|
|
16
14
|
} | null;
|
|
17
|
-
|
|
15
|
+
connectedWalletAddress: string | null;
|
|
18
16
|
}): KYCVerificationRequest;
|
|
@@ -6,9 +6,6 @@ export declare function validateRestoreDetails(email: string, country: string):
|
|
|
6
6
|
export type OtpVerificationOutcome = {
|
|
7
7
|
status: 'ok';
|
|
8
8
|
customerUUID: string;
|
|
9
|
-
} | {
|
|
10
|
-
status: 'documentRequired';
|
|
11
|
-
customerUUID: string;
|
|
12
9
|
} | {
|
|
13
10
|
status: 'error';
|
|
14
11
|
message: string;
|
|
@@ -16,5 +13,4 @@ export type OtpVerificationOutcome = {
|
|
|
16
13
|
};
|
|
17
14
|
export declare function resolveOtpVerification(result: {
|
|
18
15
|
customerUUID?: string;
|
|
19
|
-
kycValidated?: boolean;
|
|
20
16
|
}): OtpVerificationOutcome;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type KycDocumentType } from '../kycValidation';
|
|
3
|
+
export default function KycDocumentFields({ documentTypes, documentType, documentFront, documentBack, onDocumentType, onDocumentFront, onDocumentBack, }: {
|
|
4
|
+
documentTypes: KycDocumentType[];
|
|
5
|
+
documentType: string;
|
|
6
|
+
documentFront: File | null;
|
|
7
|
+
documentBack: File | null;
|
|
8
|
+
onDocumentType: (documentType: string) => void;
|
|
9
|
+
onDocumentFront: (file: File | null) => void;
|
|
10
|
+
onDocumentBack: (file: File | null) => void;
|
|
11
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type KycFieldGroup, type KycFieldPart, type KycFormValues } from '../kycValidation';
|
|
3
|
+
import type { SelectOption } from '../optionFilter';
|
|
4
|
+
type KycInputProps = {
|
|
5
|
+
values: KycFormValues;
|
|
6
|
+
countries: SelectOption[];
|
|
7
|
+
onChange: (part: KycFieldPart, value: string) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare function KycFieldList({ parts, ...inputProps }: KycInputProps & {
|
|
10
|
+
parts: KycFieldPart[];
|
|
11
|
+
}): React.JSX.Element;
|
|
12
|
+
export declare function KycFieldGroupCard({ group, ...inputProps }: KycInputProps & {
|
|
13
|
+
group: KycFieldGroup;
|
|
14
|
+
}): React.JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -94,8 +94,6 @@ export type CheckoutAction = {
|
|
|
94
94
|
} | {
|
|
95
95
|
type: 'connect/balances';
|
|
96
96
|
balances: WalletBalances | null;
|
|
97
|
-
} | {
|
|
98
|
-
type: 'kyc/show';
|
|
99
97
|
} | {
|
|
100
98
|
type: 'kyc/formReset';
|
|
101
99
|
} | {
|
|
@@ -115,4 +113,4 @@ export type CheckoutAction = {
|
|
|
115
113
|
type: 'mode/applied';
|
|
116
114
|
isEmbedded: boolean;
|
|
117
115
|
};
|
|
118
|
-
export declare const PRESERVED_ON_RESET: readonly ["brandLogoUrl", "brandLogoAlt", "termNoticeHtml", "session", "flowOverride", "isEmbedded", "walletConnectFlow", "assetFirstFlow", "isLDKEnabled", "hideOtherWallets", "showApprovalPage", "restoreDialogSession", "
|
|
116
|
+
export declare const PRESERVED_ON_RESET: readonly ["brandLogoUrl", "brandLogoAlt", "termNoticeHtml", "session", "flowOverride", "isEmbedded", "walletConnectFlow", "assetFirstFlow", "isLDKEnabled", "hideOtherWallets", "showApprovalPage", "restoreDialogSession", "kycFormSession"];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CreateTransactionResponse, DisplayAsset, GetSessionResponse, GetTransactionResponse, InitFlowOptions, SendReceiptRequest, WalletConnectWallet } from '../../types';
|
|
2
2
|
import type { CheckoutWallet } from '../../constants';
|
|
3
3
|
import type { RestoreContext } from '../sessionHelpers';
|
|
4
|
-
import type {
|
|
4
|
+
import type { KycFormValues } from '../kycValidation';
|
|
5
5
|
export declare const SCREEN_NAMES: {
|
|
6
6
|
readonly PAY_BUTTONS: "payButtons";
|
|
7
7
|
readonly WALLETS: "wallets";
|
|
@@ -71,7 +71,6 @@ export interface CheckoutState {
|
|
|
71
71
|
headerAmount: string;
|
|
72
72
|
changeMethodVisible: boolean;
|
|
73
73
|
failureMessage: string;
|
|
74
|
-
kycStepSession: number;
|
|
75
74
|
kycFormSession: number;
|
|
76
75
|
kycDraft: KycDraft | null;
|
|
77
76
|
restoreContext: RestoreContext | null;
|
|
@@ -83,7 +82,7 @@ export type WalletBalances = {
|
|
|
83
82
|
account: string;
|
|
84
83
|
balances: Record<string, bigint>;
|
|
85
84
|
};
|
|
86
|
-
export type KycTextFields = Omit<
|
|
85
|
+
export type KycTextFields = Omit<KycFormValues, 'documentType' | 'hasDocumentFront' | 'hasDocumentBack'>;
|
|
87
86
|
export interface KycDraft {
|
|
88
87
|
text: KycTextFields;
|
|
89
88
|
documentType: string;
|
|
@@ -133,20 +132,22 @@ export interface CheckoutCallbacks {
|
|
|
133
132
|
otp: string;
|
|
134
133
|
}): Promise<{
|
|
135
134
|
customerUUID?: string;
|
|
136
|
-
kycValidated?: boolean;
|
|
137
135
|
}>;
|
|
138
|
-
onRestoreVerified(
|
|
139
|
-
|
|
136
|
+
onRestoreVerified(restored: {
|
|
137
|
+
customerUUID: string;
|
|
138
|
+
country: string;
|
|
139
|
+
}): Promise<void>;
|
|
140
140
|
onRestoreClose(): void;
|
|
141
141
|
onRestoreDetails(): void;
|
|
142
142
|
onKycSubmit(submission: {
|
|
143
|
-
values:
|
|
143
|
+
values: KycFormValues;
|
|
144
144
|
documentFront: File | null;
|
|
145
145
|
documentBack: File | null;
|
|
146
146
|
storeKyc: boolean;
|
|
147
147
|
}): void;
|
|
148
148
|
onKycCancel(): void;
|
|
149
149
|
onKycDraftSource(getDraft: (() => KycDraft) | null): void;
|
|
150
|
+
getConnectedWalletAddress(): string | null;
|
|
150
151
|
onKycWalletSummaryRow(): void;
|
|
151
152
|
onKycNetworkSummaryRow(): void;
|
|
152
153
|
onKycCoinSummaryRow(): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lydianpay/sdk-web",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.17.0",
|
|
4
4
|
"description": "Drop-in crypto payment checkout for the web — a <lydian-checkout> web component and window.Lydian API across 20+ chains and major stablecoins.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|