@lydianpay/sdk-web 3.18.6 → 3.18.8

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,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
  }
@@ -136,6 +136,26 @@ export type CustomerKYCValidationStatusResponse = {
136
136
  customerUUID: string;
137
137
  kycValidated: boolean;
138
138
  };
139
+ export type CustomerDateOfBirth = {
140
+ year: number;
141
+ month: number;
142
+ day: number;
143
+ };
144
+ export type RedactedCustomerPIIResponse = {
145
+ customerUUID: string;
146
+ firstName: string;
147
+ lastName: string;
148
+ email: string;
149
+ nationalID: string;
150
+ address1: string;
151
+ address2: string;
152
+ stateProvince: string;
153
+ city: string;
154
+ country: string;
155
+ postalCode: string;
156
+ cityOfBirth: string;
157
+ dateOfBirth: CustomerDateOfBirth;
158
+ };
139
159
  export type PlaceCountry = {
140
160
  name: string;
141
161
  iso2: string;
@@ -8,7 +8,7 @@ import type { ScreenNavigator } from './screenNavigator';
8
8
  import type { SessionLifecycle } from './sessionLifecycle';
9
9
  import type { SessionQuoteWatcher } from './sessionQuoteWatcher';
10
10
  import type { TransactionPoller } from './transactionPoller';
11
- import type { CheckoutEventName, CheckoutInitOptions, PaymentFailureReason } from '../types';
11
+ import type { CheckoutEventName, CheckoutInitOptions, PaymentFailureReason, RedactedCustomerPIIResponse } from '../types';
12
12
  export interface KycFlow {
13
13
  /** The -3 screen. No-op without a transaction to attach the details to. */
14
14
  showScreen(): void;
@@ -18,10 +18,15 @@ export interface KycFlow {
18
18
  documentBack: File | null;
19
19
  storeKyc: boolean;
20
20
  }): Promise<void>;
21
- /** Re-promote the same session against a stored customer record. */
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
+ */
22
25
  restoreWithCustomerUUID(restored: {
23
26
  customerUUID: string;
24
27
  country: string;
28
+ email: string;
29
+ onFile: RedactedCustomerPIIResponse;
25
30
  }): Promise<void>;
26
31
  }
27
32
  export interface KycFlowSeams {
@@ -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,4 +1,4 @@
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
4
  import type { SavedCustomer } from '../savedCustomer';
@@ -134,13 +134,12 @@ export interface CheckoutCallbacks {
134
134
  email: string;
135
135
  country: string;
136
136
  otp: string;
137
- }): Promise<{
138
- customerUUID?: string;
139
- }>;
137
+ }): Promise<RedactedCustomerPIIResponse>;
140
138
  onRestoreVerified(restored: {
141
139
  customerUUID: string;
142
140
  country: string;
143
141
  email: string;
142
+ onFile: RedactedCustomerPIIResponse;
144
143
  }): Promise<void>;
145
144
  onRestoreClose(): void;
146
145
  onRestoreDetails(opening: {
@@ -0,0 +1,22 @@
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 getStoredDateOfBirth({ dateOfBirth }: RedactedCustomerPIIResponse): string;
8
+ export declare function getRestoredKycDraft({ draft, onFile, email, country, }: {
9
+ draft: KycDraft | null;
10
+ onFile: RedactedCustomerPIIResponse;
11
+ email: string;
12
+ country: string;
13
+ }): KycDraft;
14
+ export declare function isKycPartStillOnFile({ part, value, onFile, }: {
15
+ part: KycFieldPart;
16
+ value: string;
17
+ onFile: KycPartsOnFile;
18
+ }): boolean;
19
+ export declare function getKycPartsStillOnFile({ values, onFile, }: {
20
+ values: KycFormValues;
21
+ onFile: KycPartsOnFile;
22
+ }): KycFieldPart[];
@@ -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 isAlreadyPromoted(session: GetSessionResponse): boolean;
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 declare function restoreContextFor(context: RestoreContext | null, transactionId: string | undefined): {
39
- customerUUID: string;
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.6",
3
+ "version": "3.18.8",
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": {