@lydianpay/sdk-web 3.18.5 → 3.18.7
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-CVOwvGr5.js → browser-B7Rxf-Bu.js} +1 -1
- package/dist/chunks/{connect-multichain-_NxUAIzm.js → connect-multichain-DmSOZ6si.js} +9 -9
- package/dist/chunks/{dist-CFzvrfDT.js → dist-BgxCOd2O.js} +3 -3
- package/dist/chunks/{dist-Bfwrp0r9.js → dist-CXSFu8-J.js} +2 -2
- package/dist/chunks/{index-R4WX4ogg.js → index-BhTaLNkR.js} +2 -2
- package/dist/chunks/{index-CoiVOJK6.js → index-BmB5ME03.js} +1 -1
- package/dist/chunks/{index-Ul_-S-KR.js → index-CpjSM5Xu.js} +1 -1
- package/dist/chunks/{index-BHvqWN2h.js → index-CqjYiCV9.js} +123 -110
- package/dist/chunks/{mountEngine-B7wlou0O.js → mountEngine-CG_6rKvA.js} +12178 -11984
- package/dist/lydian.js +1 -1
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/network/customer/index.d.ts +2 -1
- package/dist/types/types.d.ts +15 -0
- package/dist/types/ui/checkoutCallbacks.d.ts +6 -2
- package/dist/types/ui/kycFlow.d.ts +10 -3
- package/dist/types/ui/kycValidation.d.ts +1 -0
- package/dist/types/ui/kycVerificationRequest.d.ts +2 -4
- package/dist/types/ui/react/FormField.d.ts +2 -1
- package/dist/types/ui/react/KycFields.d.ts +2 -0
- package/dist/types/ui/react/RestoreDetailsEntry.d.ts +2 -0
- package/dist/types/ui/react/checkoutActions.d.ts +6 -1
- package/dist/types/ui/react/checkoutStore.d.ts +11 -5
- package/dist/types/ui/restoredCustomer.d.ts +21 -0
- package/dist/types/ui/savedCustomer.d.ts +13 -0
- package/dist/types/ui/sessionBootstrap.d.ts +5 -9
- package/dist/types/ui/sessionHelpers.d.ts +4 -4
- package/dist/types/utils/guards.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Base } from '../base';
|
|
2
|
-
import { AuthenticateCustomerOTPRequest, CustomerKYCValidationStatusResponse, SendCustomerOTPRequest } from '../../types';
|
|
2
|
+
import { AuthenticateCustomerOTPRequest, CustomerKYCValidationStatusResponse, RedactedCustomerPIIResponse, SendCustomerOTPRequest } from '../../types';
|
|
3
3
|
export declare class Customer extends Base {
|
|
4
4
|
sendCustomerOTP(sendOTPRequest: SendCustomerOTPRequest): Promise<string>;
|
|
5
5
|
authenticateCustomerOTP(authenticateOTPRequest: AuthenticateCustomerOTPRequest): Promise<CustomerKYCValidationStatusResponse>;
|
|
6
|
+
getCustomerPII(authenticateOTPRequest: AuthenticateCustomerOTPRequest): Promise<RedactedCustomerPIIResponse>;
|
|
6
7
|
}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -136,6 +136,21 @@ export type CustomerKYCValidationStatusResponse = {
|
|
|
136
136
|
customerUUID: string;
|
|
137
137
|
kycValidated: boolean;
|
|
138
138
|
};
|
|
139
|
+
export type RedactedCustomerPIIResponse = {
|
|
140
|
+
customerUUID: string;
|
|
141
|
+
firstName: string;
|
|
142
|
+
lastName: string;
|
|
143
|
+
email: string;
|
|
144
|
+
nationalID: string;
|
|
145
|
+
address1: string;
|
|
146
|
+
address2: string;
|
|
147
|
+
stateProvince: string;
|
|
148
|
+
city: string;
|
|
149
|
+
subdivision: string;
|
|
150
|
+
country: string;
|
|
151
|
+
postalCode: string;
|
|
152
|
+
cityOfBirth: string;
|
|
153
|
+
};
|
|
139
154
|
export type PlaceCountry = {
|
|
140
155
|
name: string;
|
|
141
156
|
iso2: string;
|
|
@@ -3,6 +3,7 @@ import type { CheckoutCallbacks, CheckoutStore } from './react/checkoutStore';
|
|
|
3
3
|
import type { CheckoutSelection } from './checkoutSelection';
|
|
4
4
|
import type { DialogController } from './dialogController';
|
|
5
5
|
import type { KycFlow } from './kycFlow';
|
|
6
|
+
import type { SavedCustomer, SavedCustomerMemory } from './savedCustomer';
|
|
6
7
|
import type { ScreenNavigator } from './screenNavigator';
|
|
7
8
|
import type { WalletConnection } from './walletConnection';
|
|
8
9
|
/** The few exits that belong to the checkout as a whole rather than to one flow. */
|
|
@@ -10,16 +11,19 @@ export interface CheckoutCallbackSeams {
|
|
|
10
11
|
confirmCloseTransaction(): void;
|
|
11
12
|
endCheckout(): void;
|
|
12
13
|
resetCheckout(): void;
|
|
13
|
-
openRestoreDetails(
|
|
14
|
+
openRestoreDetails(opening: {
|
|
15
|
+
savedCustomer: SavedCustomer | null;
|
|
16
|
+
}): void;
|
|
14
17
|
notifyCountdownLapsed(): void;
|
|
15
18
|
requireApi(): API;
|
|
16
19
|
}
|
|
17
|
-
export declare function createCheckoutCallbacks({ store, shadowRoot, screenNavigator, selection, kycFlow, wallet, dialogs, seams, }: {
|
|
20
|
+
export declare function createCheckoutCallbacks({ store, shadowRoot, screenNavigator, selection, kycFlow, savedCustomer, wallet, dialogs, seams, }: {
|
|
18
21
|
store: CheckoutStore;
|
|
19
22
|
shadowRoot: ShadowRoot;
|
|
20
23
|
screenNavigator: ScreenNavigator;
|
|
21
24
|
selection: CheckoutSelection;
|
|
22
25
|
kycFlow: KycFlow;
|
|
26
|
+
savedCustomer: SavedCustomerMemory;
|
|
23
27
|
wallet: WalletConnection;
|
|
24
28
|
dialogs: DialogController;
|
|
25
29
|
seams: CheckoutCallbackSeams;
|
|
@@ -3,11 +3,12 @@ import type { API } from '../network';
|
|
|
3
3
|
import type { CheckoutPresentation } from './checkoutPresentation';
|
|
4
4
|
import type { KycFormValues } from './kycValidation';
|
|
5
5
|
import type { PaymentFlow } from './paymentFlow';
|
|
6
|
+
import type { SavedCustomerMemory } from './savedCustomer';
|
|
6
7
|
import type { ScreenNavigator } from './screenNavigator';
|
|
7
8
|
import type { SessionLifecycle } from './sessionLifecycle';
|
|
8
9
|
import type { SessionQuoteWatcher } from './sessionQuoteWatcher';
|
|
9
10
|
import type { TransactionPoller } from './transactionPoller';
|
|
10
|
-
import type { CheckoutEventName, CheckoutInitOptions, PaymentFailureReason } from '../types';
|
|
11
|
+
import type { CheckoutEventName, CheckoutInitOptions, PaymentFailureReason, RedactedCustomerPIIResponse } from '../types';
|
|
11
12
|
export interface KycFlow {
|
|
12
13
|
/** The -3 screen. No-op without a transaction to attach the details to. */
|
|
13
14
|
showScreen(): void;
|
|
@@ -17,10 +18,15 @@ export interface KycFlow {
|
|
|
17
18
|
documentBack: File | null;
|
|
18
19
|
storeKyc: boolean;
|
|
19
20
|
}): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Re-promote the same session against a stored customer record and, when the
|
|
23
|
+
* form is still due, open it on what that record holds.
|
|
24
|
+
*/
|
|
21
25
|
restoreWithCustomerUUID(restored: {
|
|
22
26
|
customerUUID: string;
|
|
23
27
|
country: string;
|
|
28
|
+
email: string;
|
|
29
|
+
onFile: RedactedCustomerPIIResponse;
|
|
24
30
|
}): Promise<void>;
|
|
25
31
|
}
|
|
26
32
|
export interface KycFlowSeams {
|
|
@@ -30,8 +36,9 @@ export interface KycFlowSeams {
|
|
|
30
36
|
}): void;
|
|
31
37
|
closeRestoreDialog(): void;
|
|
32
38
|
}
|
|
33
|
-
export declare function createKycFlow({ store, presentation, screenNavigator, sessionLifecycle, paymentFlow, poller, quoteWatcher, getApi, getOptions, getWalletAccount, emit, seams, }: {
|
|
39
|
+
export declare function createKycFlow({ store, savedCustomer, presentation, screenNavigator, sessionLifecycle, paymentFlow, poller, quoteWatcher, getApi, getOptions, getWalletAccount, emit, seams, }: {
|
|
34
40
|
store: CheckoutStore;
|
|
41
|
+
savedCustomer: SavedCustomerMemory;
|
|
35
42
|
presentation: CheckoutPresentation;
|
|
36
43
|
screenNavigator: ScreenNavigator;
|
|
37
44
|
sessionLifecycle: SessionLifecycle;
|
|
@@ -23,6 +23,7 @@ export type KycFormValues = Record<KycFieldPart, string> & {
|
|
|
23
23
|
hasDocumentFront: boolean;
|
|
24
24
|
hasDocumentBack: boolean;
|
|
25
25
|
};
|
|
26
|
+
export declare const EMPTY_KYC_TEXT: Record<KycFieldPart, string>;
|
|
26
27
|
export type KycFieldGroup = {
|
|
27
28
|
fields: KycField[];
|
|
28
29
|
count: number;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type KycFormValues, type KycRequirements } from './kycValidation';
|
|
2
|
+
import type { RestoringCustomer } from './sessionHelpers';
|
|
2
3
|
import type { KYCVerificationRequest } from '../types';
|
|
3
4
|
export declare function getKycVerificationRequest({ requirements, values, asset, network, storeKyc, documentFront, documentBack, restoring, connectedWalletAddress, }: {
|
|
4
5
|
requirements: KycRequirements;
|
|
@@ -8,9 +9,6 @@ export declare function getKycVerificationRequest({ requirements, values, asset,
|
|
|
8
9
|
storeKyc: boolean;
|
|
9
10
|
documentFront: File | null;
|
|
10
11
|
documentBack: File | null;
|
|
11
|
-
restoring:
|
|
12
|
-
customerUUID: string;
|
|
13
|
-
country: string;
|
|
14
|
-
} | null;
|
|
12
|
+
restoring: RestoringCustomer | null;
|
|
15
13
|
connectedWalletAddress: string | null;
|
|
16
14
|
}): KYCVerificationRequest;
|
|
@@ -6,7 +6,7 @@ export declare function FieldShell({ id, label, labelFor, error, children, }: {
|
|
|
6
6
|
error?: string;
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
}): React.JSX.Element;
|
|
9
|
-
export default function FormField({ id, label, placeholder, value, onChange, type, autoComplete, maxLength, error, inputRef, }: {
|
|
9
|
+
export default function FormField({ id, label, placeholder, value, onChange, type, autoComplete, maxLength, error, inputRef, shouldSelectAllOnFocus, }: {
|
|
10
10
|
id: string;
|
|
11
11
|
label: string;
|
|
12
12
|
placeholder: string;
|
|
@@ -17,4 +17,5 @@ export default function FormField({ id, label, placeholder, value, onChange, typ
|
|
|
17
17
|
maxLength?: number;
|
|
18
18
|
error?: string;
|
|
19
19
|
inputRef?: React.Ref<HTMLInputElement>;
|
|
20
|
+
shouldSelectAllOnFocus?: boolean;
|
|
20
21
|
}): React.JSX.Element;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type KycFieldPart, type KycFormValues } from '../kycValidation';
|
|
3
|
+
import { type KycPartsOnFile } from '../restoredCustomer';
|
|
3
4
|
import type { SelectOption } from '../optionFilter';
|
|
4
5
|
export type KycInputProps = {
|
|
5
6
|
values: KycFormValues;
|
|
6
7
|
countries: SelectOption[];
|
|
7
8
|
onChange: (part: KycFieldPart, value: string) => void;
|
|
9
|
+
onFile: KycPartsOnFile;
|
|
8
10
|
};
|
|
9
11
|
export declare function KycFieldList({ parts, ...inputProps }: KycInputProps & {
|
|
10
12
|
parts: KycFieldPart[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ActiveScreen, CloseDialogVariant, KycDraft, WalletBalances } from './checkoutStore';
|
|
2
2
|
import type { CreateTransactionResponse, DisplayAsset, GetSessionResponse, GetTransactionResponse, InitFlowOptions, WalletConnectWallet } from '../../types';
|
|
3
3
|
import type { RestoreContext } from '../sessionHelpers';
|
|
4
|
+
import type { SavedCustomer } from '../savedCustomer';
|
|
4
5
|
export type CheckoutAction = {
|
|
5
6
|
type: 'session/loaded';
|
|
6
7
|
session: GetSessionResponse | null;
|
|
@@ -101,6 +102,10 @@ export type CheckoutAction = {
|
|
|
101
102
|
draft: KycDraft | null;
|
|
102
103
|
} | {
|
|
103
104
|
type: 'restore/dialogOpened';
|
|
105
|
+
savedCustomer: SavedCustomer | null;
|
|
106
|
+
} | {
|
|
107
|
+
type: 'savedCustomer/set';
|
|
108
|
+
customer: SavedCustomer | null;
|
|
104
109
|
} | {
|
|
105
110
|
type: 'dialog/closeVariant';
|
|
106
111
|
variant: CloseDialogVariant;
|
|
@@ -113,4 +118,4 @@ export type CheckoutAction = {
|
|
|
113
118
|
type: 'mode/applied';
|
|
114
119
|
isEmbedded: boolean;
|
|
115
120
|
};
|
|
116
|
-
export declare const PRESERVED_ON_RESET: readonly ["brandLogoUrl", "brandLogoAlt", "termNoticeHtml", "session", "flowOverride", "isEmbedded", "walletConnectFlow", "assetFirstFlow", "isLDKEnabled", "hideOtherWallets", "showApprovalPage", "restoreDialogSession", "kycFormSession"];
|
|
121
|
+
export declare const PRESERVED_ON_RESET: readonly ["brandLogoUrl", "brandLogoAlt", "termNoticeHtml", "session", "flowOverride", "isEmbedded", "walletConnectFlow", "assetFirstFlow", "isLDKEnabled", "hideOtherWallets", "showApprovalPage", "restoreDialogSession", "savedCustomer", "kycFormSession"];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { CreateTransactionResponse, DisplayAsset, GetSessionResponse, GetTransactionResponse, InitFlowOptions, SendReceiptRequest, WalletConnectWallet } from '../../types';
|
|
1
|
+
import type { CreateTransactionResponse, DisplayAsset, GetSessionResponse, GetTransactionResponse, InitFlowOptions, RedactedCustomerPIIResponse, SendReceiptRequest, WalletConnectWallet } from '../../types';
|
|
2
2
|
import type { CheckoutWallet } from '../../constants';
|
|
3
3
|
import type { RestoreContext } from '../sessionHelpers';
|
|
4
|
+
import type { SavedCustomer } from '../savedCustomer';
|
|
4
5
|
import type { KycFormValues } from '../kycValidation';
|
|
5
6
|
import type { SelectOption } from '../optionFilter';
|
|
6
7
|
export declare const SCREEN_NAMES: {
|
|
@@ -76,6 +77,8 @@ export interface CheckoutState {
|
|
|
76
77
|
kycDraft: KycDraft | null;
|
|
77
78
|
restoreContext: RestoreContext | null;
|
|
78
79
|
restoreDialogSession: number;
|
|
80
|
+
restoreDialogSavedCustomer: SavedCustomer | null;
|
|
81
|
+
savedCustomer: SavedCustomer | null;
|
|
79
82
|
closeDialogVariant: CloseDialogVariant;
|
|
80
83
|
}
|
|
81
84
|
export type WalletBalances = {
|
|
@@ -131,15 +134,18 @@ export interface CheckoutCallbacks {
|
|
|
131
134
|
email: string;
|
|
132
135
|
country: string;
|
|
133
136
|
otp: string;
|
|
134
|
-
}): Promise<
|
|
135
|
-
customerUUID?: string;
|
|
136
|
-
}>;
|
|
137
|
+
}): Promise<RedactedCustomerPIIResponse>;
|
|
137
138
|
onRestoreVerified(restored: {
|
|
138
139
|
customerUUID: string;
|
|
139
140
|
country: string;
|
|
141
|
+
email: string;
|
|
142
|
+
onFile: RedactedCustomerPIIResponse;
|
|
140
143
|
}): Promise<void>;
|
|
141
144
|
onRestoreClose(): void;
|
|
142
|
-
onRestoreDetails(
|
|
145
|
+
onRestoreDetails(opening: {
|
|
146
|
+
savedCustomer: SavedCustomer | null;
|
|
147
|
+
}): void;
|
|
148
|
+
onForgetSavedCustomer(): void;
|
|
143
149
|
onGetCountryOptions(details: {
|
|
144
150
|
signal: AbortSignal;
|
|
145
151
|
}): Promise<SelectOption[]>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type KycFieldPart, type KycFormValues } from './kycValidation';
|
|
2
|
+
import type { KycDraft } from './react/checkoutStore';
|
|
3
|
+
import type { RedactedCustomerPIIResponse } from '../types';
|
|
4
|
+
export type KycPartsOnFile = Partial<Record<KycFieldPart, string>>;
|
|
5
|
+
export declare const NO_KYC_PARTS_ON_FILE: KycPartsOnFile;
|
|
6
|
+
export declare function getKycPartsOnFile(onFile: RedactedCustomerPIIResponse): KycPartsOnFile;
|
|
7
|
+
export declare function getRestoredKycDraft({ draft, partsOnFile, email, country, }: {
|
|
8
|
+
draft: KycDraft | null;
|
|
9
|
+
partsOnFile: KycPartsOnFile;
|
|
10
|
+
email: string;
|
|
11
|
+
country: string;
|
|
12
|
+
}): KycDraft;
|
|
13
|
+
export declare function isKycPartStillOnFile({ part, value, onFile, }: {
|
|
14
|
+
part: KycFieldPart;
|
|
15
|
+
value: string;
|
|
16
|
+
onFile: KycPartsOnFile;
|
|
17
|
+
}): boolean;
|
|
18
|
+
export declare function getKycPartsStillOnFile({ values, onFile, }: {
|
|
19
|
+
values: KycFormValues;
|
|
20
|
+
onFile: KycPartsOnFile;
|
|
21
|
+
}): KycFieldPart[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CheckoutStore } from './react/checkoutStore';
|
|
2
|
+
export type SavedCustomer = {
|
|
3
|
+
email: string;
|
|
4
|
+
country: string;
|
|
5
|
+
};
|
|
6
|
+
export interface SavedCustomerMemory {
|
|
7
|
+
load(): void;
|
|
8
|
+
remember(customer: SavedCustomer): void;
|
|
9
|
+
forget(): void;
|
|
10
|
+
}
|
|
11
|
+
export declare function createSavedCustomerMemory({ store, }: {
|
|
12
|
+
store: CheckoutStore;
|
|
13
|
+
}): SavedCustomerMemory;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import type { API } from '../network';
|
|
2
2
|
import type { CheckoutEventName, CheckoutInitOptions, GetSessionResponse, GetTransactionResponse } from '../types';
|
|
3
3
|
export type SessionBootstrapApi = Pick<API, 'createSession' | 'getSession' | 'getCryptoTransaction'>;
|
|
4
|
-
export type SessionSnapshot = {
|
|
5
|
-
session: GetSessionResponse;
|
|
6
|
-
sessionPromoted: boolean;
|
|
7
|
-
};
|
|
8
4
|
export type SessionBootstrapResult = {
|
|
9
5
|
ok: true;
|
|
10
6
|
session: GetSessionResponse;
|
|
@@ -27,12 +23,12 @@ export declare function resolveSessionId({ api, options, }: {
|
|
|
27
23
|
api: SessionBootstrapApi;
|
|
28
24
|
options: CheckoutInitOptions;
|
|
29
25
|
}): Promise<string>;
|
|
30
|
-
export declare function readSession({ api, sessionID, }: {
|
|
31
|
-
api: SessionBootstrapApi;
|
|
32
|
-
sessionID: string;
|
|
33
|
-
}): Promise<SessionSnapshot>;
|
|
34
26
|
export declare function sessionLoadedEvent(session: GetSessionResponse): Record<string, unknown>;
|
|
35
|
-
export declare function
|
|
27
|
+
export declare function hasLinkedTransaction(session: GetSessionResponse): boolean;
|
|
28
|
+
export declare function shouldSkipPromotionOnResume({ session, linkedTransaction, }: {
|
|
29
|
+
session: GetSessionResponse;
|
|
30
|
+
linkedTransaction: GetTransactionResponse | null;
|
|
31
|
+
}): boolean;
|
|
36
32
|
export declare function fetchLinkedTransaction({ api, transactionID, }: {
|
|
37
33
|
api: SessionBootstrapApi;
|
|
38
34
|
transactionID: string | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CreateTransactionResponse, GetTransactionResponse } from '../types';
|
|
2
|
+
import type { KycPartsOnFile } from './restoredCustomer';
|
|
2
3
|
export declare function parseInstant(iso: string | undefined): number | null;
|
|
3
4
|
export declare function isFutureInstant(iso: string | undefined, now?: number): boolean;
|
|
4
5
|
export declare function isSessionPromotable(session: {
|
|
@@ -34,8 +35,7 @@ export type RestoreContext = {
|
|
|
34
35
|
customerUUID: string;
|
|
35
36
|
country: string;
|
|
36
37
|
transactionId: string;
|
|
38
|
+
onFile: KycPartsOnFile;
|
|
37
39
|
};
|
|
38
|
-
export
|
|
39
|
-
|
|
40
|
-
country: string;
|
|
41
|
-
} | null;
|
|
40
|
+
export type RestoringCustomer = Pick<RestoreContext, 'customerUUID' | 'country' | 'onFile'>;
|
|
41
|
+
export declare function restoreContextFor(context: RestoreContext | null, transactionId: string | undefined): RestoringCustomer | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lydianpay/sdk-web",
|
|
3
|
-
"version": "3.18.
|
|
3
|
+
"version": "3.18.7",
|
|
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": {
|