@lydianpay/sdk-web 3.19.5 → 3.20.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.
Files changed (34) hide show
  1. package/dist/chunks/{browser-DL9_hXMV.js → browser-rxX-1RlV.js} +1 -1
  2. package/dist/chunks/{connect-multichain-Cv_d4cUb.js → connect-multichain-BwOA1L8N.js} +9 -9
  3. package/dist/chunks/{dist-2JlmBYpb.js → dist-BTA0E_b3.js} +2 -2
  4. package/dist/chunks/{dist-C8wtmWKA.js → dist-Bnz-_T3x.js} +3 -3
  5. package/dist/chunks/{index-YSt1dpEp.js → index-C7WgU0CK.js} +22 -13
  6. package/dist/chunks/{index-B0iJjksC.js → index-DbCr6lts.js} +2 -2
  7. package/dist/chunks/{index-Dg1EY0o2.js → index-_SoQft4L.js} +1 -1
  8. package/dist/chunks/{index-DyzbNiWD.js → index-hVXeCXXz.js} +1 -1
  9. package/dist/chunks/{mountEngine-DVTbWmeA.js → mountEngine-CjLQCm5Y.js} +11648 -11153
  10. package/dist/lydian.js +1 -1
  11. package/dist/types/.tsbuildinfo +1 -1
  12. package/dist/types/types.d.ts +1 -0
  13. package/dist/types/ui/countries.d.ts +2 -0
  14. package/dist/types/ui/kycFlow.d.ts +11 -0
  15. package/dist/types/ui/kycValidation.d.ts +8 -2
  16. package/dist/types/ui/otpValidation.d.ts +5 -0
  17. package/dist/types/ui/react/ContactInfoSection/ContactInfoSection.d.ts +11 -0
  18. package/dist/types/ui/react/ContactInfoSection/EmailCodeCard.d.ts +10 -0
  19. package/dist/types/ui/react/ContactInfoSection/EmailEntryStep.d.ts +10 -0
  20. package/dist/types/ui/react/ContactInfoSection/NotYouButton.d.ts +6 -0
  21. package/dist/types/ui/react/ContactInfoSection/Reveal.d.ts +5 -0
  22. package/dist/types/ui/react/ContactInfoSection/SavedLoginStep.d.ts +9 -0
  23. package/dist/types/ui/react/ContactInfoSection/SendCodeButton.d.ts +5 -0
  24. package/dist/types/ui/react/ContactInfoSection/StepCard.d.ts +5 -0
  25. package/dist/types/ui/react/ContactInfoSection/VerifiedEmailCard.d.ts +5 -0
  26. package/dist/types/ui/react/ContactInfoSection/emailStep.d.ts +20 -0
  27. package/dist/types/ui/react/ContactInfoSection/useEmailVerification.d.ts +17 -0
  28. package/dist/types/ui/react/ErrorText.d.ts +5 -0
  29. package/dist/types/ui/react/FormField.d.ts +2 -1
  30. package/dist/types/ui/react/KycFields.d.ts +2 -1
  31. package/dist/types/ui/react/SearchSelect.d.ts +2 -1
  32. package/dist/types/ui/react/checkoutStore.d.ts +11 -0
  33. package/dist/types/ui/restoredCustomer.d.ts +17 -3
  34. package/package.json +1 -1
@@ -126,6 +126,7 @@ export type CreateTransactionRequest = {
126
126
  export type SendCustomerOTPRequest = {
127
127
  email: string;
128
128
  country: string;
129
+ transactionID?: string;
129
130
  };
130
131
  export type AuthenticateCustomerOTPRequest = {
131
132
  otp: string;
@@ -1,6 +1,8 @@
1
1
  import type { SelectOption } from './optionFilter';
2
2
  import type { PlaceCountry } from '../types';
3
3
  export declare function isSupportedCountryCode(countryCode: string): boolean;
4
+ export declare function getCountryCodeForAlpha3(alpha3: string): string | null;
5
+ export declare function getSupportedMerchantCountry(merchantCountry: string | undefined): string | null;
4
6
  export declare function countryOptions(locale?: string): SelectOption[];
5
7
  export declare function getCountryName(code: string, locale?: string): string;
6
8
  export declare function getCountryNameInSentence(code: string, locale?: string): string;
@@ -1,4 +1,5 @@
1
1
  import { type CheckoutStore } from './react/checkoutStore';
2
+ import { type VerifiedCustomer } from './restoredCustomer';
2
3
  import type { API } from '../network';
3
4
  import type { CheckoutPresentation } from './checkoutPresentation';
4
5
  import type { KycFormValues } from './kycValidation';
@@ -29,6 +30,16 @@ export interface KycFlow {
29
30
  otp: string;
30
31
  onFile: RedactedCustomerPIIResponse;
31
32
  }): Promise<void>;
33
+ sendEmailCode(details: {
34
+ email: string;
35
+ country: string;
36
+ }): Promise<void>;
37
+ verifyEmailCode(details: {
38
+ email: string;
39
+ country: string;
40
+ otp: string;
41
+ }): Promise<VerifiedCustomer>;
42
+ forgetVerifiedEmail(): void;
32
43
  }
33
44
  export interface KycFlowSeams {
34
45
  reportFailure(message: string, reason: PaymentFailureReason, options?: {
@@ -1,7 +1,7 @@
1
1
  import type { CreateTransactionResponse } from '../types';
2
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
- export declare const KYC_FIELD_ORDER: readonly ["email", "firstName", "lastName", "walletAddress", "country", "dateAndPlaceOfBirth", "cityOfBirth", "dateOfBirth", "physicalAddress", "nationalIDNumber", "customerIDNumber"];
4
+ export declare const KYC_FIELD_ORDER: readonly ["email", "firstName", "lastName", "walletAddress", "country", "countryOfResidence", "dateAndPlaceOfBirth", "cityOfBirth", "dateOfBirth", "physicalAddress", "nationalIDNumber", "customerIDNumber"];
5
5
  export type KycField = (typeof KYC_FIELD_ORDER)[number];
6
6
  export declare const KYC_FIELD_PARTS: {
7
7
  readonly email: readonly ["email"];
@@ -9,6 +9,7 @@ export declare const KYC_FIELD_PARTS: {
9
9
  readonly lastName: readonly ["lastName"];
10
10
  readonly walletAddress: readonly ["walletAddress"];
11
11
  readonly country: readonly ["country"];
12
+ readonly countryOfResidence: readonly ["addressCountry"];
12
13
  readonly dateAndPlaceOfBirth: readonly ["cityOfBirth", "dateOfBirth"];
13
14
  readonly cityOfBirth: readonly ["cityOfBirth"];
14
15
  readonly dateOfBirth: readonly ["dateOfBirth"];
@@ -54,9 +55,10 @@ export declare function getRevealedKycParts({ parts, values, }: {
54
55
  parts: KycFieldPart[];
55
56
  values: KycFormValues;
56
57
  }): KycFieldPart[];
57
- export declare function getKycRequirements({ transaction, hasConnectedWallet, }: {
58
+ export declare function getKycRequirements({ transaction, hasConnectedWallet, isCountryAskedAsCitizenship, }: {
58
59
  transaction: Partial<CreateTransactionResponse>;
59
60
  hasConnectedWallet: boolean;
61
+ isCountryAskedAsCitizenship?: boolean;
60
62
  }): KycRequirements;
61
63
  export declare function getKycGroupChoices(group: KycFieldGroup): KycGroupChoice[];
62
64
  export declare function getKycChoiceInputs({ group, chosenFields, }: {
@@ -75,6 +77,10 @@ export declare function getHiddenFilledParts({ group, chosenFields, values, }: {
75
77
  values: KycFormValues;
76
78
  }): KycFieldPart[];
77
79
  export declare function canFulfillKycRequirements({ requiredFields, fieldGroups, documentTypes, unsupportedFields, }: KycRequirements): boolean;
80
+ export declare function joinStreetLines({ street, street2, }: {
81
+ street: string | undefined;
82
+ street2: string | undefined;
83
+ }): string | undefined;
78
84
  export declare function getRequestedKycFields({ requiredFields, fieldGroups, }: KycRequirements): KycField[];
79
85
  export declare function isKycEmailCollected({ requiredParts, fieldGroups }: KycRequirements): boolean;
80
86
  export declare function getKycPartError({ part, values, partsStillOnFile, }: {
@@ -2,6 +2,11 @@ export declare const EMAIL_PATTERN: RegExp;
2
2
  export declare const OTP_LENGTH = 6;
3
3
  export declare function isValidEmail(email: string): boolean;
4
4
  export declare function isValidOtp(otp: string): boolean;
5
+ export declare function getOtpDigits(input: string): string;
6
+ export declare function canSendEmailCode({ email, country }: {
7
+ email: string;
8
+ country: string;
9
+ }): boolean;
5
10
  export declare function validateRestoreDetails(email: string, country: string): string | null;
6
11
  export type OtpVerificationOutcome = {
7
12
  status: 'ok';
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ import type { VerifiedCustomer } from '../../restoredCustomer';
3
+ export default function ContactInfoSection({ email, country, citizenshipInput, verifiedCustomer, onEmailChange, onVerified, onVerifiedCustomerRejected, }: {
4
+ email: string;
5
+ country: string;
6
+ citizenshipInput: React.ReactNode;
7
+ verifiedCustomer: VerifiedCustomer | null;
8
+ onEmailChange: (email: string) => void;
9
+ onVerified: (customer: VerifiedCustomer) => void;
10
+ onVerifiedCustomerRejected: () => void;
11
+ }): React.JSX.Element;
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ export default function EmailCodeCard({ recipientEmail, code, isBusy, error, onCodeChange, onSendAgain, onNotYou, }: {
3
+ recipientEmail: string;
4
+ code: string;
5
+ isBusy: boolean;
6
+ error: string;
7
+ onCodeChange: (code: string) => void;
8
+ onSendAgain: () => void;
9
+ onNotYou: () => void;
10
+ }): React.JSX.Element;
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ export default function EmailEntryStep({ email, country, citizenshipInput, isBusy, error, onEmailChange, onSendCode, }: {
3
+ email: string;
4
+ country: string;
5
+ citizenshipInput: React.ReactNode;
6
+ isBusy: boolean;
7
+ error: string;
8
+ onEmailChange: (email: string) => void;
9
+ onSendCode: () => void;
10
+ }): React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ export default function NotYouButton({ id, onClick, isDisabled, }: {
3
+ id: string;
4
+ onClick: () => void;
5
+ isDisabled?: boolean;
6
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export default function Reveal({ isShown, children, }: {
3
+ isShown: boolean;
4
+ children: React.ReactNode;
5
+ }): React.JSX.Element;
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ import type { SavedCustomer } from '../../savedCustomer';
3
+ export default function SavedLoginStep({ savedCustomer, isBusy, error, onSendCode, onNotYou, }: {
4
+ savedCustomer: SavedCustomer;
5
+ isBusy: boolean;
6
+ error: string;
7
+ onSendCode: () => void;
8
+ onNotYou: () => void;
9
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export default function SendCodeButton({ isBusy, onClick, }: {
3
+ isBusy: boolean;
4
+ onClick: () => void;
5
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export default function StepCard({ id, children }: {
3
+ id: string;
4
+ children: React.ReactNode;
5
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export default function VerifiedEmailCard({ email, onNotYou, }: {
3
+ email: string;
4
+ onNotYou: () => void;
5
+ }): React.JSX.Element;
@@ -0,0 +1,20 @@
1
+ import type { CodeRecipient } from './useEmailVerification';
2
+ import type { SavedCustomer } from '../../savedCustomer';
3
+ import type { VerifiedCustomer } from '../../restoredCustomer';
4
+ export type EmailStep = {
5
+ kind: 'verified';
6
+ customer: VerifiedCustomer;
7
+ } | {
8
+ kind: 'code';
9
+ recipient: CodeRecipient;
10
+ } | {
11
+ kind: 'savedLogin';
12
+ savedCustomer: SavedCustomer;
13
+ } | {
14
+ kind: 'entry';
15
+ };
16
+ export declare function getEmailStep({ verifiedCustomer, codeRecipient, savedCustomer, }: {
17
+ verifiedCustomer: VerifiedCustomer | null;
18
+ codeRecipient: CodeRecipient | null;
19
+ savedCustomer: SavedCustomer | null;
20
+ }): EmailStep;
@@ -0,0 +1,17 @@
1
+ import type { VerifiedCustomer } from '../../restoredCustomer';
2
+ export type CodeRecipient = {
3
+ email: string;
4
+ country: string;
5
+ };
6
+ export declare function useEmailVerification({ onVerified, }: {
7
+ onVerified: (customer: VerifiedCustomer) => void;
8
+ }): {
9
+ code: string;
10
+ codeRecipient: CodeRecipient | null;
11
+ isBusy: boolean;
12
+ error: string;
13
+ sendCode: (recipient: CodeRecipient) => Promise<void>;
14
+ sendCodeAgain: () => Promise<void>;
15
+ enterCode: (input: string) => void;
16
+ changeEmail: () => void;
17
+ };
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export default function ErrorText({ id, message }: {
3
+ id?: string;
4
+ message: string;
5
+ }): React.JSX.Element | null;
@@ -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, isReadOnly, }: {
9
+ export default function FormField({ id, label, placeholder, value, onChange, type, autoComplete, inputMode, maxLength, error, inputRef, shouldSelectAllOnFocus, isReadOnly, }: {
10
10
  id: string;
11
11
  label: string;
12
12
  placeholder: string;
@@ -14,6 +14,7 @@ export default function FormField({ id, label, placeholder, value, onChange, typ
14
14
  onChange: (value: string) => void;
15
15
  type?: string;
16
16
  autoComplete?: string;
17
+ inputMode?: React.HTMLAttributes<HTMLInputElement>['inputMode'];
17
18
  maxLength?: number;
18
19
  error?: string;
19
20
  inputRef?: React.Ref<HTMLInputElement>;
@@ -8,7 +8,8 @@ export type KycInputProps = {
8
8
  onChange: (part: KycFieldPart, value: string) => void;
9
9
  partsStillOnFile: KycFieldPart[];
10
10
  isEmailReadOnly: boolean;
11
- maskedAddressLines: KycFieldPart[];
11
+ maskedAddressParts: KycFieldPart[];
12
+ isAddressCountryResidence: boolean;
12
13
  };
13
14
  export declare function KycFieldList({ parts, ...inputProps }: KycInputProps & {
14
15
  parts: KycFieldPart[];
@@ -1,11 +1,12 @@
1
1
  import * as React from 'react';
2
2
  import type { SelectOption } from '../optionFilter';
3
- export default function SearchSelect({ id, label, placeholder, options, value, onChange, error, }: {
3
+ export default function SearchSelect({ id, label, placeholder, options, value, unlistedValueLabel, onChange, error, }: {
4
4
  id: string;
5
5
  label: string;
6
6
  placeholder?: string;
7
7
  options: SelectOption[];
8
8
  value: string;
9
+ unlistedValueLabel?: string;
9
10
  onChange: (value: string) => void;
10
11
  error?: string;
11
12
  }): React.JSX.Element;
@@ -2,6 +2,7 @@ import type { CreateTransactionResponse, DisplayAsset, GetSessionResponse, GetTr
2
2
  import type { CheckoutWallet } from '../../constants';
3
3
  import type { RestoreContext } from '../sessionHelpers';
4
4
  import type { SavedCustomer } from '../savedCustomer';
5
+ import type { VerifiedCustomer } from '../restoredCustomer';
5
6
  import type { KycFormValues } from '../kycValidation';
6
7
  import type { SelectOption } from '../optionFilter';
7
8
  export declare const SCREEN_NAMES: {
@@ -147,6 +148,16 @@ export interface CheckoutCallbacks {
147
148
  savedCustomer: SavedCustomer | null;
148
149
  }): void;
149
150
  onForgetSavedCustomer(): void;
151
+ onSendEmailCode(details: {
152
+ email: string;
153
+ country: string;
154
+ }): Promise<void>;
155
+ onVerifyEmailCode(details: {
156
+ email: string;
157
+ country: string;
158
+ otp: string;
159
+ }): Promise<VerifiedCustomer>;
160
+ onForgetVerifiedEmail(): void;
150
161
  onGetCountryOptions(details: {
151
162
  signal: AbortSignal;
152
163
  }): Promise<SelectOption[]>;
@@ -12,6 +12,16 @@ export declare function getRestoredKycDraft({ draft, onFile, email, country, }:
12
12
  email: string;
13
13
  country: string;
14
14
  }): KycDraft;
15
+ export type VerifiedCustomer = Pick<RestoringCustomer, 'email' | 'country' | 'onFile' | 'storedDateOfBirth'>;
16
+ export declare function getKycTextWithCustomerOnFile({ text, customer, }: {
17
+ text: KycTextFields;
18
+ customer: VerifiedCustomer;
19
+ }): KycTextFields;
20
+ export declare function getKycTextWithoutCustomerOnFile({ text, customer, blankText, }: {
21
+ text: KycTextFields;
22
+ customer: VerifiedCustomer;
23
+ blankText: KycTextFields;
24
+ }): KycTextFields;
15
25
  export declare function isKycPartStillOnFile({ part, value, onFile, }: {
16
26
  part: KycFieldPart;
17
27
  value: string;
@@ -21,6 +31,10 @@ export declare function getKycPartsStillOnFile({ values, onFile, }: {
21
31
  values: KycFormValues;
22
32
  onFile: KycPartsOnFile;
23
33
  }): KycFieldPart[];
34
+ export declare function getKycPartsLeftToRecord({ values, onFile, }: {
35
+ values: KycFormValues;
36
+ onFile: KycPartsOnFile;
37
+ }): KycFieldPart[];
24
38
  export declare function getEditedKycPartValue({ part, currentValue, nextValue, onFile, }: {
25
39
  part: KycFieldPart;
26
40
  currentValue: string;
@@ -29,15 +43,15 @@ export declare function getEditedKycPartValue({ part, currentValue, nextValue, o
29
43
  }): string;
30
44
  type AddressUpdateInputs = {
31
45
  requirements: KycRequirements;
32
- values: KycTextFields;
46
+ values: KycFormValues;
33
47
  restoring: Pick<RestoringCustomer, 'onFile' | 'country'>;
34
48
  };
35
49
  export declare function isAddressUpdated({ requirements, values, restoring, }: AddressUpdateInputs): boolean;
36
- export declare function getMaskedAddressLines(addressUpdateInputs: AddressUpdateInputs): KycFieldPart[];
50
+ export declare function getMaskedAddressParts(addressUpdateInputs: AddressUpdateInputs): KycFieldPart[];
37
51
  export declare function getProfileUpdates({ requirements, request, values, restoring, }: {
38
52
  requirements: KycRequirements;
39
53
  request: KYCVerificationRequest;
40
- values: KycTextFields;
54
+ values: KycFormValues;
41
55
  restoring: RestoringCustomer;
42
56
  }): CustomerProfileUpdates | null;
43
57
  export declare function getRestoreContextAfterSave({ restoring, transactionId, savedRecord, }: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lydianpay/sdk-web",
3
- "version": "3.19.5",
3
+ "version": "3.20.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": {