@lydianpay/sdk-web 3.18.0 → 3.18.2

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 (27) hide show
  1. package/dist/chunks/{browser-CpRXBrlm.js → browser-ByUw6qxL.js} +1 -1
  2. package/dist/chunks/{connect-multichain-CJf52rh9.js → connect-multichain-B5TudJIg.js} +9 -9
  3. package/dist/chunks/{index-Df3XemZg.js → dist-CgyqdZZP.js} +3 -3
  4. package/dist/chunks/{index-97Gtx-8y.js → dist-DxDvLdBX.js} +3 -4
  5. package/dist/chunks/{index-CC6lwg0u.js → index-BJAiOYNA.js} +60 -69
  6. package/dist/chunks/{index-BBjqv--5.js → index-BMvT5fJ_.js} +2 -2
  7. package/dist/chunks/{index-BkSKEmfK.js → index-CF-D_uxJ.js} +1 -1
  8. package/dist/chunks/{index-CfbOkWrq.js → index-CxHFTZ5V.js} +1 -1
  9. package/dist/chunks/{mountEngine-Bm7mzS_d.js → mountEngine-DURf9AtR.js} +11824 -11337
  10. package/dist/lydian.js +1 -1
  11. package/dist/types/.tsbuildinfo +1 -1
  12. package/dist/types/network/places/index.d.ts +3 -3
  13. package/dist/types/types.d.ts +8 -24
  14. package/dist/types/ui/countries.d.ts +6 -0
  15. package/dist/types/ui/kycRegions.d.ts +12 -0
  16. package/dist/types/ui/kycValidation.d.ts +9 -4
  17. package/dist/types/ui/react/KycFieldGroupCard.d.ts +2 -2
  18. package/dist/types/ui/react/KycFields.d.ts +1 -5
  19. package/dist/types/ui/react/checkoutStore.d.ts +6 -7
  20. package/dist/types/ui/react/useCountryOptions.d.ts +2 -0
  21. package/dist/types/ui/react/useRegionOptions.d.ts +5 -0
  22. package/dist/types/ui/regionDirectory.d.ts +14 -0
  23. package/package.json +11 -6
  24. package/dist/types/ui/kycPlaceAddress.d.ts +0 -11
  25. package/dist/types/ui/react/AddressSearch/AddressSearch.d.ts +0 -3
  26. package/dist/types/ui/react/AddressSearch/AddressSearch.helpers.d.ts +0 -21
  27. package/dist/types/ui/react/AddressSearch/useAddressSearch.d.ts +0 -21
@@ -1,6 +1,6 @@
1
1
  import { Base } from '../base';
2
- import type { PlaceAutocompleteResponse, PlaceDetailsResponse } from '../../types';
2
+ import type { PlaceCountry, PlaceState } from '../../types';
3
3
  export declare class Places extends Base {
4
- autocompleteAddress(input: string, signal?: AbortSignal): Promise<PlaceAutocompleteResponse>;
5
- getPlaceDetails(placeId: string, signal?: AbortSignal): Promise<PlaceDetailsResponse>;
4
+ getCountries(signal?: AbortSignal): Promise<PlaceCountry[] | null>;
5
+ getStates(countryCode: string, signal?: AbortSignal): Promise<PlaceState[] | null>;
6
6
  }
@@ -136,30 +136,13 @@ export type CustomerKYCValidationStatusResponse = {
136
136
  customerUUID: string;
137
137
  kycValidated: boolean;
138
138
  };
139
- export type PlaceAutocompleteResponse = {
140
- suggestions?: Array<{
141
- placePrediction?: {
142
- placeId?: string;
143
- text?: {
144
- text?: string;
145
- };
146
- types?: string[] | null;
147
- };
148
- }> | null;
149
- };
150
- export type PlaceDetailsResponse = {
151
- postalAddress?: {
152
- regionCode?: string;
153
- postalCode?: string;
154
- administrativeArea?: string;
155
- locality?: string;
156
- addressLines?: string[] | null;
157
- };
158
- addressComponents?: Array<{
159
- longText: string;
160
- shortText: string;
161
- types?: string[] | null;
162
- }> | null;
139
+ export type PlaceState = {
140
+ name: string;
141
+ iso2: string;
142
+ };
143
+ export type PlaceCountry = {
144
+ name: string;
145
+ iso2: string;
163
146
  };
164
147
  export type CreateSessionRequest = {
165
148
  amount: number;
@@ -272,6 +255,7 @@ export type KYCVerificationRequest = {
272
255
  email?: string;
273
256
  street?: string;
274
257
  city?: string;
258
+ subdivision?: string;
275
259
  region?: string;
276
260
  postalCode?: string;
277
261
  country?: string;
@@ -1,3 +1,9 @@
1
1
  import type { SelectOption } from './optionFilter';
2
+ import type { PlaceCountry } from '../types';
2
3
  export declare function isSupportedCountryCode(countryCode: string): boolean;
3
4
  export declare function countryOptions(locale?: string): SelectOption[];
5
+ export declare function getCountryOptions({ countries, locale, }: {
6
+ countries: PlaceCountry[];
7
+ locale?: string;
8
+ }): SelectOption[];
9
+ export declare function getValidCountries(response: unknown): PlaceCountry[];
@@ -0,0 +1,12 @@
1
+ import type { SelectOption } from './optionFilter';
2
+ import type { PlaceState } from '../types';
3
+ export declare function applyKycPartChange<Fields extends {
4
+ country: string;
5
+ region: string;
6
+ }>({ fields, part, value, }: {
7
+ fields: Fields;
8
+ part: string;
9
+ value: string;
10
+ }): Fields;
11
+ export declare function getValidStates(response: unknown): PlaceState[];
12
+ export declare function getRegionOptions(states: PlaceState[]): SelectOption[];
@@ -1,15 +1,16 @@
1
1
  import type { CreateTransactionResponse } from '../types';
2
2
  export declare const KYC_FIELD_PARTS: {
3
+ readonly email: readonly ["email"];
3
4
  readonly firstName: readonly ["firstName"];
4
5
  readonly lastName: readonly ["lastName"];
5
- readonly email: readonly ["email"];
6
6
  readonly walletAddress: readonly ["walletAddress"];
7
- readonly dateAndPlaceOfBirth: readonly ["dateOfBirth", "cityOfBirth", "regionOfBirth", "countryOfBirth"];
7
+ readonly country: readonly ["country"];
8
+ readonly dateAndPlaceOfBirth: readonly ["cityOfBirth", "dateOfBirth"];
9
+ readonly cityOfBirth: readonly ["cityOfBirth"];
8
10
  readonly dateOfBirth: readonly ["dateOfBirth"];
9
11
  readonly nationalIDNumber: readonly ["nationalIDNumber"];
10
12
  readonly customerIDNumber: readonly ["customerIDNumber"];
11
- readonly physicalAddress: readonly ["street", "city", "region", "postalCode", "country"];
12
- readonly country: readonly ["country"];
13
+ readonly physicalAddress: readonly ["country", "region", "city", "subdivision", "postalCode", "street"];
13
14
  };
14
15
  export type KycField = keyof typeof KYC_FIELD_PARTS;
15
16
  export type KycFieldPart = (typeof KYC_FIELD_PARTS)[KycField][number];
@@ -56,6 +57,10 @@ export declare function getHiddenFilledParts({ group, chosenFields, values, }: {
56
57
  }): KycFieldPart[];
57
58
  export declare function canFulfillKycRequirements({ requiredFields, fieldGroups, documentTypes, unsupportedFields, }: KycRequirements): boolean;
58
59
  export declare function isKycEmailCollected({ requiredParts, fieldGroups }: KycRequirements): boolean;
60
+ export declare function isKycPartRevealed({ part, values, }: {
61
+ part: KycFieldPart;
62
+ values: KycFormValues;
63
+ }): boolean;
59
64
  export declare function getKycPartError(part: KycFieldPart, values: KycFormValues): string | null;
60
65
  export declare function isKycFieldComplete(field: KycField, values: KycFormValues): boolean;
61
66
  export declare function documentHasTwoSides(documentType: string): boolean;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { type KycFieldListProps } from './KycFields';
2
+ import { type KycInputProps } from './KycFields';
3
3
  import { type KycFieldGroup } from '../kycValidation';
4
- export default function KycFieldGroupCard({ group, ...inputProps }: KycFieldListProps & {
4
+ export default function KycFieldGroupCard({ group, ...inputProps }: KycInputProps & {
5
5
  group: KycFieldGroup;
6
6
  }): React.JSX.Element;
@@ -1,5 +1,4 @@
1
1
  import * as React from 'react';
2
- import type { AddressFillTarget } from './AddressSearch/useAddressSearch';
3
2
  import { type KycFieldPart, type KycFormValues } from '../kycValidation';
4
3
  import type { SelectOption } from '../optionFilter';
5
4
  export type KycInputProps = {
@@ -7,10 +6,7 @@ export type KycInputProps = {
7
6
  countries: SelectOption[];
8
7
  onChange: (part: KycFieldPart, value: string) => void;
9
8
  };
10
- export type KycFieldListProps = KycInputProps & {
11
- addressFillTarget: AddressFillTarget;
12
- };
13
- export declare function KycFieldList({ parts, addressFillTarget, ...inputProps }: KycFieldListProps & {
9
+ export declare function KycFieldList({ parts, ...inputProps }: KycInputProps & {
14
10
  parts: KycFieldPart[];
15
11
  }): React.JSX.Element;
16
12
  export declare function KycSection({ title, children }: {
@@ -2,7 +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 { KycFormValues } from '../kycValidation';
5
- import type { AddressSuggestion, KycAddress } from '../kycPlaceAddress';
5
+ import type { SelectOption } from '../optionFilter';
6
6
  export declare const SCREEN_NAMES: {
7
7
  readonly PAY_BUTTONS: "payButtons";
8
8
  readonly WALLETS: "wallets";
@@ -140,14 +140,13 @@ export interface CheckoutCallbacks {
140
140
  }): Promise<void>;
141
141
  onRestoreClose(): void;
142
142
  onRestoreDetails(): void;
143
- onSearchAddresses(details: {
144
- input: string;
143
+ onGetCountryOptions(details: {
145
144
  signal: AbortSignal;
146
- }): Promise<AddressSuggestion[]>;
147
- onGetPlaceAddress(details: {
148
- placeId: string;
145
+ }): Promise<SelectOption[]>;
146
+ onGetRegionOptions(details: {
147
+ countryCode: string;
149
148
  signal: AbortSignal;
150
- }): Promise<KycAddress | null>;
149
+ }): Promise<SelectOption[]>;
151
150
  onKycSubmit(submission: {
152
151
  values: KycFormValues;
153
152
  documentFront: File | null;
@@ -0,0 +1,2 @@
1
+ import type { SelectOption } from '../optionFilter';
2
+ export declare function useCountryOptions(): SelectOption[];
@@ -0,0 +1,5 @@
1
+ import type { SelectOption } from '../optionFilter';
2
+ export declare function useRegionOptions(countryCode: string): {
3
+ isLoading: boolean;
4
+ options: SelectOption[];
5
+ };
@@ -0,0 +1,14 @@
1
+ import type { PlaceCountry, PlaceState } from '../types';
2
+ export type RegionDirectory = {
3
+ getCountries(details: {
4
+ signal?: AbortSignal;
5
+ }): Promise<PlaceCountry[]>;
6
+ getStates(details: {
7
+ countryCode: string;
8
+ signal?: AbortSignal;
9
+ }): Promise<PlaceState[]>;
10
+ };
11
+ export declare function createRegionDirectory({ fetchCountries, fetchStates, }: {
12
+ fetchCountries: (signal?: AbortSignal) => Promise<unknown>;
13
+ fetchStates: (countryCode: string, signal?: AbortSignal) => Promise<unknown>;
14
+ }): RegionDirectory;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lydianpay/sdk-web",
3
- "version": "3.18.0",
3
+ "version": "3.18.2",
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": {
@@ -69,31 +69,36 @@
69
69
  "@types/qrcode": "^1.5.5",
70
70
  "@types/react": "^19.2.18",
71
71
  "@types/react-dom": "^19.2.4",
72
- "@vitest/coverage-v8": "^3.0.0",
72
+ "@vitest/coverage-v8": "^4.1.12",
73
73
  "autoprefixer": "^10.4.0",
74
74
  "eslint": "^9.0.0",
75
75
  "eslint-plugin-react-hooks": "^7.1.1",
76
76
  "globals": "^16.0.0",
77
77
  "jsdom": "^29.1.1",
78
78
  "npm-run-all2": "^7.0.2",
79
- "postcss": "^8.4.6",
79
+ "postcss": "^8.5.32",
80
80
  "prettier": "3.9.5",
81
81
  "qrcode": "^1.5.4",
82
82
  "qrcode-terminal": "^0.12.0",
83
83
  "tailwindcss": "^3.0.0",
84
84
  "typescript": "^5.0.0",
85
85
  "typescript-eslint": "^8.0.0",
86
- "vite": "^6.3.5",
87
- "vitest": "^3.0.0"
86
+ "vite": "^6.4.5",
87
+ "vitest": "^4.1.12"
88
88
  },
89
89
  "dependencies": {
90
90
  "@lydianpay/frontend-shared-helpers": "1.2.0",
91
91
  "@lydianpay/lydianconnect": "^1.10.3",
92
92
  "@lydianpay/lydianconnect-catalog": "^1.4.1",
93
93
  "@solana/qr-code-styling": "^1.6.0",
94
- "dompurify": "^3.4.12",
94
+ "dompurify": "^3.4.17",
95
95
  "react": "^19.2.8",
96
96
  "react-dom": "^19.2.8",
97
97
  "viem": "^2.30.6"
98
+ },
99
+ "overrides": {
100
+ "@metamask/utils": {
101
+ "uuid": "^11.1.1"
102
+ }
98
103
  }
99
104
  }
@@ -1,11 +0,0 @@
1
- import { type KycFormValues } from './kycValidation';
2
- import type { PlaceAutocompleteResponse, PlaceDetailsResponse } from '../types';
3
- export declare const KYC_ADDRESS_PARTS: readonly ["street", "city", "region", "postalCode", "country"];
4
- export type KycAddress = Pick<KycFormValues, (typeof KYC_ADDRESS_PARTS)[number]>;
5
- export type AddressSuggestion = {
6
- placeId: string;
7
- description: string;
8
- };
9
- export declare function getAddressSuggestions(response: PlaceAutocompleteResponse): AddressSuggestion[];
10
- export declare function getKycAddressFromPlace(place: PlaceDetailsResponse): KycAddress | null;
11
- export declare function hasSameAddressParts(first: KycAddress, second: KycAddress): boolean;
@@ -1,3 +0,0 @@
1
- import * as React from 'react';
2
- import { type AddressFillTarget } from './useAddressSearch';
3
- export default function AddressSearch({ readAddress, fillAddress }: AddressFillTarget): React.JSX.Element;
@@ -1,21 +0,0 @@
1
- import { type KycAddress } from '../../kycPlaceAddress';
2
- export declare const FIELD_ID = "addressSearch";
3
- declare const AUTO_FOCUSED_PARTS: readonly ["street", "city", "region", "postalCode"];
4
- export type AutoFocusedAddressPart = (typeof AUTO_FOCUSED_PARTS)[number];
5
- export type AddressSearchStatus = 'idle' | 'searching' | 'suggesting' | 'fetching' | 'filled' | 'filledWithBlanks' | 'editsKept' | 'unavailable';
6
- export declare function getStatusText({ status, isOpen, suggestionCount, }: {
7
- status: AddressSearchStatus;
8
- isOpen: boolean;
9
- suggestionCount: number;
10
- }): string;
11
- export declare function getRowId(rowIndex: number): string;
12
- export declare function getFillOutcome(address: KycAddress): {
13
- status: AddressSearchStatus;
14
- partToFocus: AutoFocusedAddressPart | undefined;
15
- };
16
- export declare function focusPartIfStillInSearch({ searchInput, part, }: {
17
- searchInput: HTMLInputElement;
18
- part: AutoFocusedAddressPart;
19
- }): void;
20
- export declare function isCountryInputFocused(searchInput: HTMLInputElement): boolean;
21
- export {};
@@ -1,21 +0,0 @@
1
- import { type AddressSuggestion, type KycAddress } from '../../kycPlaceAddress';
2
- import { type AddressSearchStatus, type AutoFocusedAddressPart } from './AddressSearch.helpers';
3
- export type AddressFillTarget = {
4
- readAddress: () => KycAddress;
5
- fillAddress: (address: KycAddress) => void;
6
- };
7
- export declare function useAddressSearch({ readAddress, fillAddress, focusPart, isTypingCountry, }: AddressFillTarget & {
8
- focusPart: (part: AutoFocusedAddressPart) => void;
9
- isTypingCountry: () => boolean;
10
- }): {
11
- query: string;
12
- suggestions: AddressSuggestion[];
13
- status: AddressSearchStatus;
14
- isOpen: boolean;
15
- activeIndex: number | null;
16
- changeQuery: (nextQuery: string) => void;
17
- selectRow: (rowIndex: number) => void;
18
- closeList: () => void;
19
- reopenList: () => void;
20
- moveActiveRow: (step: 1 | -1) => void;
21
- };