@lydianpay/sdk-web 3.19.3 → 3.19.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.
@@ -1,11 +1,15 @@
1
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
2
+ type GatewayRequestInit = Omit<RequestInit, 'method' | 'headers'> & {
3
+ method?: HttpMethod;
4
+ headers?: Record<string, string>;
5
+ };
1
6
  export declare abstract class Base {
2
7
  private baseUri;
3
8
  private publishableKey;
4
9
  constructor(baseUri: string, publishableKey?: string);
5
10
  private headers;
6
- protected request<T>(endpoint: string, options?: Omit<RequestInit, 'headers'> & {
7
- headers?: Record<string, string>;
8
- }): Promise<T>;
9
- protected requestText(endpoint: string, options?: RequestInit): Promise<string>;
10
- protected requestWithFormData<T>(endpoint: string, options?: RequestInit): Promise<T>;
11
+ protected request<T>(endpoint: string, options?: GatewayRequestInit): Promise<T>;
12
+ protected requestText(endpoint: string, options?: GatewayRequestInit): Promise<string>;
13
+ protected requestWithFormData<T>(endpoint: string, options?: GatewayRequestInit): Promise<T>;
11
14
  }
15
+ export {};
@@ -1,7 +1,8 @@
1
1
  import { Base } from '../base';
2
- import { AuthenticateCustomerOTPRequest, CustomerKYCValidationStatusResponse, RedactedCustomerPIIResponse, SendCustomerOTPRequest } from '../../types';
2
+ import { AuthenticateCustomerOTPRequest, CustomerKYCValidationStatusResponse, RedactedCustomerPIIResponse, SendCustomerOTPRequest, UpdateCustomerPIIRequest } 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
6
  getCustomerPII(authenticateOTPRequest: AuthenticateCustomerOTPRequest): Promise<RedactedCustomerPIIResponse>;
7
+ updateCustomerPII(updatePIIRequest: UpdateCustomerPIIRequest): Promise<RedactedCustomerPIIResponse>;
7
8
  }
@@ -156,6 +156,28 @@ export type RedactedCustomerPIIResponse = {
156
156
  cityOfBirth: string;
157
157
  dateOfBirth: CustomerDateOfBirth;
158
158
  };
159
+ export type CustomerAddress = {
160
+ line1: string;
161
+ line2: string;
162
+ city: string;
163
+ region: string;
164
+ country: string;
165
+ postalCode: string;
166
+ };
167
+ export type CustomerProfileUpdates = {
168
+ firstName?: string;
169
+ lastName?: string;
170
+ nationalID?: string;
171
+ dob?: CustomerDateOfBirth;
172
+ pob?: {
173
+ city: string;
174
+ country: string;
175
+ };
176
+ address?: CustomerAddress;
177
+ };
178
+ export type UpdateCustomerPIIRequest = CustomerProfileUpdates & {
179
+ otpRequest: AuthenticateCustomerOTPRequest;
180
+ };
159
181
  export type PlaceCountry = {
160
182
  name: string;
161
183
  iso2: string;
@@ -275,6 +297,7 @@ export type KYCVerificationRequest = {
275
297
  city?: string;
276
298
  region?: string;
277
299
  postalCode?: string;
300
+ addressCountry?: string;
278
301
  country?: string;
279
302
  yearOfBirth?: string;
280
303
  monthOfBirth?: string;
@@ -26,6 +26,7 @@ export interface KycFlow {
26
26
  customerUUID: string;
27
27
  country: string;
28
28
  email: string;
29
+ otp: string;
29
30
  onFile: RedactedCustomerPIIResponse;
30
31
  }): Promise<void>;
31
32
  }
@@ -1,5 +1,5 @@
1
1
  import type { CreateTransactionResponse } from '../types';
2
- export declare const KYC_PART_ORDER: readonly ["email", "country", "firstName", "lastName", "walletAddress", "cityOfBirth", "dateOfBirth", "nationalIDNumber", "customerIDNumber", "street", "street2", "region", "city", "postalCode"];
2
+ export declare const KYC_PART_ORDER: readonly ["email", "country", "firstName", "lastName", "walletAddress", "cityOfBirth", "dateOfBirth", "nationalIDNumber", "customerIDNumber", "addressCountry", "street", "street2", "region", "city", "postalCode"];
3
3
  export type KycFieldPart = (typeof KYC_PART_ORDER)[number];
4
4
  export declare const KYC_FIELD_ORDER: readonly ["email", "firstName", "lastName", "walletAddress", "country", "dateAndPlaceOfBirth", "cityOfBirth", "dateOfBirth", "physicalAddress", "nationalIDNumber", "customerIDNumber"];
5
5
  export type KycField = (typeof KYC_FIELD_ORDER)[number];
@@ -14,7 +14,7 @@ export declare const KYC_FIELD_PARTS: {
14
14
  readonly dateOfBirth: readonly ["dateOfBirth"];
15
15
  readonly nationalIDNumber: readonly ["nationalIDNumber"];
16
16
  readonly customerIDNumber: readonly ["customerIDNumber"];
17
- readonly physicalAddress: readonly ["country", "street", "street2", "region", "city", "postalCode"];
17
+ readonly physicalAddress: readonly ["addressCountry", "street", "street2", "region", "city", "postalCode"];
18
18
  };
19
19
  declare const KYC_DOCUMENT_TYPES: readonly ["ID_CARD", "PASSPORT", "RESIDENCE_PERMIT", "DRIVERS"];
20
20
  export type KycDocumentType = (typeof KYC_DOCUMENT_TYPES)[number];
@@ -67,6 +67,7 @@ export declare function getHiddenFilledParts({ group, chosenFields, values, }: {
67
67
  values: KycFormValues;
68
68
  }): KycFieldPart[];
69
69
  export declare function canFulfillKycRequirements({ requiredFields, fieldGroups, documentTypes, unsupportedFields, }: KycRequirements): boolean;
70
+ export declare function getRequestedKycFields({ requiredFields, fieldGroups, }: KycRequirements): KycField[];
70
71
  export declare function isKycEmailCollected({ requiredParts, fieldGroups }: KycRequirements): boolean;
71
72
  export declare function getKycPartError(part: KycFieldPart, values: KycFormValues): string | null;
72
73
  export declare function isKycFieldComplete(field: KycField, values: KycFormValues): boolean;
@@ -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, shouldSelectAllOnFocus, }: {
9
+ export default function FormField({ id, label, placeholder, value, onChange, type, autoComplete, maxLength, error, inputRef, shouldSelectAllOnFocus, isReadOnly, }: {
10
10
  id: string;
11
11
  label: string;
12
12
  placeholder: string;
@@ -18,4 +18,5 @@ export default function FormField({ id, label, placeholder, value, onChange, typ
18
18
  error?: string;
19
19
  inputRef?: React.Ref<HTMLInputElement>;
20
20
  shouldSelectAllOnFocus?: boolean;
21
+ isReadOnly?: boolean;
21
22
  }): React.JSX.Element;
@@ -8,6 +8,8 @@ export type KycInputProps = {
8
8
  merchantCountry: string | null;
9
9
  onChange: (part: KycFieldPart, value: string) => void;
10
10
  onFile: KycPartsOnFile;
11
+ isEmailReadOnly: boolean;
12
+ maskedAddressLines: KycFieldPart[];
11
13
  };
12
14
  export declare function KycFieldList({ parts, ...inputProps }: KycInputProps & {
13
15
  parts: KycFieldPart[];
@@ -139,6 +139,7 @@ export interface CheckoutCallbacks {
139
139
  customerUUID: string;
140
140
  country: string;
141
141
  email: string;
142
+ otp: string;
142
143
  onFile: RedactedCustomerPIIResponse;
143
144
  }): Promise<void>;
144
145
  onRestoreClose(): void;
@@ -1,6 +1,7 @@
1
- import { type KycFieldPart, type KycFormValues } from './kycValidation';
2
- import type { KycDraft } from './react/checkoutStore';
3
- import type { RedactedCustomerPIIResponse } from '../types';
1
+ import { type KycFieldPart, type KycFormValues, type KycRequirements } from './kycValidation';
2
+ import type { KycDraft, KycTextFields } from './react/checkoutStore';
3
+ import type { RestoreContext, RestoringCustomer } from './sessionHelpers';
4
+ import type { CustomerProfileUpdates, KYCVerificationRequest, RedactedCustomerPIIResponse } from '../types';
4
5
  export type KycPartsOnFile = Partial<Record<KycFieldPart, string>>;
5
6
  export declare const NO_KYC_PARTS_ON_FILE: KycPartsOnFile;
6
7
  export declare function getKycPartsOnFile(onFile: RedactedCustomerPIIResponse): KycPartsOnFile;
@@ -20,3 +21,22 @@ export declare function getKycPartsStillOnFile({ values, onFile, }: {
20
21
  values: KycFormValues;
21
22
  onFile: KycPartsOnFile;
22
23
  }): KycFieldPart[];
24
+ type AddressUpdateInputs = {
25
+ requirements: KycRequirements;
26
+ values: KycTextFields;
27
+ restoring: Pick<RestoringCustomer, 'onFile' | 'country'>;
28
+ };
29
+ export declare function isAddressUpdated({ requirements, values, restoring, }: AddressUpdateInputs): boolean;
30
+ export declare function getMaskedAddressLines(addressUpdateInputs: AddressUpdateInputs): KycFieldPart[];
31
+ export declare function getProfileUpdates({ requirements, request, values, restoring, }: {
32
+ requirements: KycRequirements;
33
+ request: KYCVerificationRequest;
34
+ values: KycTextFields;
35
+ restoring: RestoringCustomer;
36
+ }): CustomerProfileUpdates | null;
37
+ export declare function getRestoreContextAfterSave({ restoring, transactionId, savedRecord, }: {
38
+ restoring: RestoringCustomer;
39
+ transactionId: string;
40
+ savedRecord: RedactedCustomerPIIResponse;
41
+ }): RestoreContext;
42
+ export {};
@@ -36,6 +36,9 @@ export type RestoreContext = {
36
36
  country: string;
37
37
  transactionId: string;
38
38
  onFile: KycPartsOnFile;
39
+ otp: string;
40
+ email: string;
41
+ storedDateOfBirth: string;
39
42
  };
40
- export type RestoringCustomer = Pick<RestoreContext, 'customerUUID' | 'country' | 'onFile'>;
43
+ export type RestoringCustomer = Omit<RestoreContext, 'transactionId'>;
41
44
  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.19.3",
3
+ "version": "3.19.4",
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": {