@lydianpay/sdk-web 3.19.3 → 3.19.5

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,16 @@
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
+ private send;
12
+ protected request<T>(endpoint: string, options?: GatewayRequestInit): Promise<T>;
13
+ protected requestText(endpoint: string, options?: GatewayRequestInit): Promise<string>;
14
+ protected requestWithFormData<T>(endpoint: string, options?: GatewayRequestInit): Promise<T>;
11
15
  }
16
+ export {};
@@ -1,7 +1,8 @@
1
1
  import { Base } from '../base';
2
- import { AuthenticateCustomerOTPRequest, CustomerKYCValidationStatusResponse, RedactedCustomerPIIResponse, SendCustomerOTPRequest } from '../../types';
2
+ import { AuthenticateCustomerOTPRequest, CustomerKYCValidationStatusResponse, CustomerPIIRequest, 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
- getCustomerPII(authenticateOTPRequest: AuthenticateCustomerOTPRequest): Promise<RedactedCustomerPIIResponse>;
6
+ getCustomerPII(customerPIIRequest: CustomerPIIRequest): Promise<RedactedCustomerPIIResponse>;
7
+ updateCustomerPII(updatePIIRequest: UpdateCustomerPIIRequest): Promise<RedactedCustomerPIIResponse>;
7
8
  }
@@ -132,6 +132,11 @@ export type AuthenticateCustomerOTPRequest = {
132
132
  email: string;
133
133
  country: string;
134
134
  };
135
+ export type CheckoutIdentifiers = {
136
+ sessionID?: string;
137
+ transactionID?: string;
138
+ };
139
+ export type CustomerPIIRequest = AuthenticateCustomerOTPRequest & CheckoutIdentifiers;
135
140
  export type CustomerKYCValidationStatusResponse = {
136
141
  customerUUID: string;
137
142
  kycValidated: boolean;
@@ -156,6 +161,28 @@ export type RedactedCustomerPIIResponse = {
156
161
  cityOfBirth: string;
157
162
  dateOfBirth: CustomerDateOfBirth;
158
163
  };
164
+ export type CustomerAddress = {
165
+ line1: string;
166
+ line2: string;
167
+ city: string;
168
+ region: string;
169
+ country: string;
170
+ postalCode: string;
171
+ };
172
+ export type CustomerProfileUpdates = {
173
+ firstName?: string;
174
+ lastName?: string;
175
+ nationalID?: string;
176
+ dob?: CustomerDateOfBirth;
177
+ pob?: {
178
+ city: string;
179
+ country: string;
180
+ };
181
+ address?: CustomerAddress;
182
+ };
183
+ export type UpdateCustomerPIIRequest = CustomerProfileUpdates & {
184
+ otpRequest: AuthenticateCustomerOTPRequest;
185
+ };
159
186
  export type PlaceCountry = {
160
187
  name: string;
161
188
  iso2: string;
@@ -275,6 +302,7 @@ export type KYCVerificationRequest = {
275
302
  city?: string;
276
303
  region?: string;
277
304
  postalCode?: string;
305
+ addressCountry?: string;
278
306
  country?: string;
279
307
  yearOfBirth?: string;
280
308
  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", "nationalIDDocumentType", "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];
@@ -12,12 +12,14 @@ export declare const KYC_FIELD_PARTS: {
12
12
  readonly dateAndPlaceOfBirth: readonly ["cityOfBirth", "dateOfBirth"];
13
13
  readonly cityOfBirth: readonly ["cityOfBirth"];
14
14
  readonly dateOfBirth: readonly ["dateOfBirth"];
15
- readonly nationalIDNumber: readonly ["nationalIDNumber"];
15
+ readonly nationalIDNumber: readonly ["nationalIDDocumentType", "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];
21
+ export declare const NATIONAL_ID_DOCUMENT_TYPES: readonly ["PASSPORT", "SSS", "DRIVER_LICENSE", "TIN", "OTHER"];
22
+ export type NationalIdDocumentType = (typeof NATIONAL_ID_DOCUMENT_TYPES)[number];
21
23
  export type KycFormValues = Record<KycFieldPart, string> & {
22
24
  documentType: string;
23
25
  hasDocumentFront: boolean;
@@ -47,6 +49,11 @@ export type KycRequirements = {
47
49
  documentTypes: KycDocumentType[];
48
50
  unsupportedFields: string[];
49
51
  };
52
+ export declare function isNationalIdDocumentType(name: string): name is NationalIdDocumentType;
53
+ export declare function getRevealedKycParts({ parts, values, }: {
54
+ parts: KycFieldPart[];
55
+ values: KycFormValues;
56
+ }): KycFieldPart[];
50
57
  export declare function getKycRequirements({ transaction, hasConnectedWallet, }: {
51
58
  transaction: Partial<CreateTransactionResponse>;
52
59
  hasConnectedWallet: boolean;
@@ -56,9 +63,10 @@ export declare function getKycChoiceInputs({ group, chosenFields, }: {
56
63
  group: KycFieldGroup;
57
64
  chosenFields: KycField[];
58
65
  }): KycGroupChoice[];
59
- export declare function getInitialKycChoiceFields({ group, values, blankText, }: {
66
+ export declare function getInitialKycChoiceFields({ group, values, partsStillOnFile, blankText, }: {
60
67
  group: KycFieldGroup;
61
68
  values: KycFormValues;
69
+ partsStillOnFile: KycFieldPart[];
62
70
  blankText?: Record<KycFieldPart, string>;
63
71
  }): KycField[];
64
72
  export declare function getHiddenFilledParts({ group, chosenFields, values, }: {
@@ -67,20 +75,31 @@ export declare function getHiddenFilledParts({ group, chosenFields, values, }: {
67
75
  values: KycFormValues;
68
76
  }): KycFieldPart[];
69
77
  export declare function canFulfillKycRequirements({ requiredFields, fieldGroups, documentTypes, unsupportedFields, }: KycRequirements): boolean;
78
+ export declare function getRequestedKycFields({ requiredFields, fieldGroups, }: KycRequirements): KycField[];
70
79
  export declare function isKycEmailCollected({ requiredParts, fieldGroups }: KycRequirements): boolean;
71
- export declare function getKycPartError(part: KycFieldPart, values: KycFormValues): string | null;
72
- export declare function isKycFieldComplete(field: KycField, values: KycFormValues): boolean;
80
+ export declare function getKycPartError({ part, values, partsStillOnFile, }: {
81
+ part: KycFieldPart;
82
+ values: KycFormValues;
83
+ partsStillOnFile: KycFieldPart[];
84
+ }): string | null;
85
+ export declare function isKycFieldComplete({ field, values, partsStillOnFile, }: {
86
+ field: KycField;
87
+ values: KycFormValues;
88
+ partsStillOnFile: KycFieldPart[];
89
+ }): boolean;
73
90
  export declare function documentHasTwoSides(documentType: string): boolean;
74
- export declare function getKycGroupGuidance({ group, values, }: {
91
+ export declare function getKycGroupGuidance({ group, values, partsStillOnFile, }: {
75
92
  group: KycFieldGroup;
76
93
  values: KycFormValues;
94
+ partsStillOnFile: KycFieldPart[];
77
95
  }): {
78
96
  requiredCount: number;
79
97
  totalCount: number;
80
98
  completedCount: number;
81
99
  };
82
- export declare function isKycFormComplete({ requirements, values, }: {
100
+ export declare function isKycFormComplete({ requirements, values, partsStillOnFile, }: {
83
101
  requirements: KycRequirements;
84
102
  values: KycFormValues;
103
+ partsStillOnFile: KycFieldPart[];
85
104
  }): boolean;
86
105
  export {};
@@ -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;
@@ -1,13 +1,14 @@
1
1
  import * as React from 'react';
2
2
  import { type KycFieldPart, type KycFormValues } from '../kycValidation';
3
- import { type KycPartsOnFile } from '../restoredCustomer';
4
3
  import type { SelectOption } from '../optionFilter';
5
4
  export type KycInputProps = {
6
5
  values: KycFormValues;
7
6
  countries: SelectOption[];
8
7
  merchantCountry: string | null;
9
8
  onChange: (part: KycFieldPart, value: string) => void;
10
- onFile: KycPartsOnFile;
9
+ partsStillOnFile: KycFieldPart[];
10
+ isEmailReadOnly: boolean;
11
+ maskedAddressLines: KycFieldPart[];
11
12
  };
12
13
  export declare function KycFieldList({ parts, ...inputProps }: KycInputProps & {
13
14
  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,28 @@ export declare function getKycPartsStillOnFile({ values, onFile, }: {
20
21
  values: KycFormValues;
21
22
  onFile: KycPartsOnFile;
22
23
  }): KycFieldPart[];
24
+ export declare function getEditedKycPartValue({ part, currentValue, nextValue, onFile, }: {
25
+ part: KycFieldPart;
26
+ currentValue: string;
27
+ nextValue: string;
28
+ onFile: KycPartsOnFile;
29
+ }): string;
30
+ type AddressUpdateInputs = {
31
+ requirements: KycRequirements;
32
+ values: KycTextFields;
33
+ restoring: Pick<RestoringCustomer, 'onFile' | 'country'>;
34
+ };
35
+ export declare function isAddressUpdated({ requirements, values, restoring, }: AddressUpdateInputs): boolean;
36
+ export declare function getMaskedAddressLines(addressUpdateInputs: AddressUpdateInputs): KycFieldPart[];
37
+ export declare function getProfileUpdates({ requirements, request, values, restoring, }: {
38
+ requirements: KycRequirements;
39
+ request: KYCVerificationRequest;
40
+ values: KycTextFields;
41
+ restoring: RestoringCustomer;
42
+ }): CustomerProfileUpdates | null;
43
+ export declare function getRestoreContextAfterSave({ restoring, transactionId, savedRecord, }: {
44
+ restoring: RestoringCustomer;
45
+ transactionId: string;
46
+ savedRecord: RedactedCustomerPIIResponse;
47
+ }): RestoreContext;
48
+ export {};
@@ -1,4 +1,4 @@
1
- import type { CreateTransactionResponse, GetTransactionResponse } from '../types';
1
+ import type { CheckoutIdentifiers, CreateTransactionResponse, GetTransactionResponse } from '../types';
2
2
  import type { KycPartsOnFile } from './restoredCustomer';
3
3
  export declare function parseInstant(iso: string | undefined): number | null;
4
4
  export declare function isFutureInstant(iso: string | undefined, now?: number): boolean;
@@ -10,6 +10,14 @@ export declare function getTransactionIdToRequote(session: {
10
10
  } | null, cryptoTransaction: {
11
11
  transactionId?: string;
12
12
  } | null, promoted: boolean): string | null;
13
+ export declare function getCheckoutIdentifiers({ session, cryptoTransaction, }: {
14
+ session: {
15
+ sessionID?: string;
16
+ } | null;
17
+ cryptoTransaction: {
18
+ transactionId?: string;
19
+ } | null;
20
+ }): CheckoutIdentifiers;
13
21
  export { transactionOutcome, type TransactionOutcome } from './transactionOutcome';
14
22
  export declare const POLL_FAILURES_BEFORE_NOTICE = 5;
15
23
  export declare function shouldReportPollFailure(consecutiveFailures: number): boolean;
@@ -36,6 +44,9 @@ export type RestoreContext = {
36
44
  country: string;
37
45
  transactionId: string;
38
46
  onFile: KycPartsOnFile;
47
+ otp: string;
48
+ email: string;
49
+ storedDateOfBirth: string;
39
50
  };
40
- export type RestoringCustomer = Pick<RestoreContext, 'customerUUID' | 'country' | 'onFile'>;
51
+ export type RestoringCustomer = Omit<RestoreContext, 'transactionId'>;
41
52
  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.5",
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": {