@lydianpay/sdk-web 2.0.2 → 2.1.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.
- package/dist/chunks/{index-Cg2XHdVQ.js → index-4_VU2FT5.js} +117 -117
- package/dist/chunks/{index-BYdhdu5y.js → index-BdyjcbDf.js} +6633 -6218
- package/dist/chunks/{metamask-sdk-CEhBuHc0.js → metamask-sdk-iWMjgRt2.js} +1 -1
- package/dist/lydian.js +1 -1
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/types.d.ts +2 -0
- package/dist/types/ui/Checkout.d.ts +6 -1
- package/dist/types/ui/buttons/walletButton.d.ts +2 -1
- package/dist/types/ui/components/fieldShell.d.ts +7 -0
- package/dist/types/ui/components/icons.d.ts +1 -0
- package/dist/types/ui/components/searchSelectField.d.ts +18 -0
- package/dist/types/ui/markupNotice.d.ts +5 -0
- package/dist/types/ui/networkListHelpers.d.ts +4 -0
- package/dist/types/ui/optionFilter.d.ts +8 -0
- package/dist/types/ui/restoreDetailsController.d.ts +2 -1
- package/dist/types/ui/searchSelectController.d.ts +28 -0
- package/dist/types/ui/walletSelection.d.ts +19 -0
- package/dist/types/utils/collections.d.ts +7 -0
- package/package.json +2 -2
package/dist/types/types.d.ts
CHANGED
|
@@ -170,6 +170,7 @@ export type GetSessionResponse = {
|
|
|
170
170
|
customFeePercentagePerNetwork?: AmountPerNetwork;
|
|
171
171
|
customFeeFiatPerNetwork?: AmountPerNetwork;
|
|
172
172
|
customFeeCryptoPerNetwork?: AmountPerNetworkPerAsset;
|
|
173
|
+
markupPercentage?: number;
|
|
173
174
|
cryptoFXRates?: AmountPerAsset;
|
|
174
175
|
cryptoFXRateExpiration?: string;
|
|
175
176
|
fxRate?: number;
|
|
@@ -187,6 +188,7 @@ export type CalculatedTotals = {
|
|
|
187
188
|
baseAmountCrypto: number;
|
|
188
189
|
merchantCustomFeeCrypto: number;
|
|
189
190
|
additionalCustomerFeeCrypto: number;
|
|
191
|
+
markupCrypto: number;
|
|
190
192
|
totalAmountCrypto: number;
|
|
191
193
|
};
|
|
192
194
|
export type CreateTransactionResponse = {
|
|
@@ -42,6 +42,7 @@ export declare class Checkout extends HTMLElement {
|
|
|
42
42
|
private btnWalletSummaryRow;
|
|
43
43
|
private btnAssetWalletSummaryRow;
|
|
44
44
|
private assetSelectTotalAmount;
|
|
45
|
+
private assetMarkupNotice;
|
|
45
46
|
private paymentHeader;
|
|
46
47
|
private merchantLogoHeader;
|
|
47
48
|
private changePaymentMethodRow;
|
|
@@ -59,6 +60,8 @@ export declare class Checkout extends HTMLElement {
|
|
|
59
60
|
private displayAssetTotal;
|
|
60
61
|
private displayQrSubtotal;
|
|
61
62
|
private displayQrNetworkFee;
|
|
63
|
+
private displayQrMarkup;
|
|
64
|
+
private qrMarkupRow;
|
|
62
65
|
private displayWalletAddress;
|
|
63
66
|
private qrNetworkLogo;
|
|
64
67
|
private qrNetworkName;
|
|
@@ -109,7 +112,8 @@ export declare class Checkout extends HTMLElement {
|
|
|
109
112
|
private city;
|
|
110
113
|
private region;
|
|
111
114
|
private postalCode;
|
|
112
|
-
private
|
|
115
|
+
private countryInput;
|
|
116
|
+
private countryCombobox;
|
|
113
117
|
private documentType;
|
|
114
118
|
private documentFileFront;
|
|
115
119
|
private documentFileBackContainer;
|
|
@@ -122,6 +126,7 @@ export declare class Checkout extends HTMLElement {
|
|
|
122
126
|
private kycStepBasic;
|
|
123
127
|
private kycStepAddress;
|
|
124
128
|
private kycStepDocument;
|
|
129
|
+
private btnKycWalletSummaryRow;
|
|
125
130
|
private btnKycNetworkSummaryRow;
|
|
126
131
|
private btnCoinSummaryRow;
|
|
127
132
|
private kycSteps;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CheckoutWallet } from '../../constants';
|
|
2
|
-
export default function WalletButton({ wallet, badgeLabel, }: {
|
|
2
|
+
export default function WalletButton({ wallet, badgeLabel, iconSvg, }: {
|
|
3
3
|
wallet: CheckoutWallet;
|
|
4
4
|
badgeLabel?: string;
|
|
5
|
+
iconSvg?: string;
|
|
5
6
|
}): string;
|
|
@@ -16,3 +16,4 @@ export declare const checkMarkIconSvg = "<svg width=\"14\" height=\"14\" viewBox
|
|
|
16
16
|
export declare const xCircleIconSvg = "<svg width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"12\" cy=\"12\" r=\"11\" stroke=\"currentColor\" stroke-width=\"1.6\"/>\n <path d=\"M9 9l6 6M15 9l-6 6\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n</svg>";
|
|
17
17
|
export declare const alertCircleOutlineIconSvg = "<svg width=\"40\" height=\"40\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" stroke-width=\"1.6\"/>\n <path d=\"M12 7v6\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <circle cx=\"12\" cy=\"16.5\" r=\"1.1\" fill=\"currentColor\"/>\n</svg>";
|
|
18
18
|
export declare const walletIconSvg = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M18 7V5.5A1.5 1.5 0 0 0 16.5 4H5a2 2 0 0 0 0 4h13a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <circle cx=\"16.5\" cy=\"13.5\" r=\"1.25\" fill=\"currentColor\"/>\n</svg>";
|
|
19
|
+
export declare const otherWalletsIconSvg = "<svg width=\"32\" height=\"32\" viewBox=\"0 0 32 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"8\" cy=\"16\" r=\"2.5\" fill=\"currentColor\"/>\n <circle cx=\"16\" cy=\"16\" r=\"2.5\" fill=\"currentColor\"/>\n <circle cx=\"24\" cy=\"16\" r=\"2.5\" fill=\"currentColor\"/>\n</svg>";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SelectOption } from './formSelect';
|
|
2
|
+
export type SearchSelectFieldProps = {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
ariaLabel?: string;
|
|
7
|
+
};
|
|
8
|
+
export default function SearchSelectField({ id, label, placeholder, ariaLabel, }: SearchSelectFieldProps): string;
|
|
9
|
+
export declare const searchInputId: (id: string) => string;
|
|
10
|
+
export declare const listId: (id: string) => string;
|
|
11
|
+
export declare const caretId: (id: string) => string;
|
|
12
|
+
export declare const optionId: (id: string, index: number) => string;
|
|
13
|
+
export declare function searchSelectOptionList({ id, options, selectedValue, query, }: {
|
|
14
|
+
id: string;
|
|
15
|
+
options: SelectOption[];
|
|
16
|
+
selectedValue: string;
|
|
17
|
+
query: string;
|
|
18
|
+
}): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { GetSessionResponse } from '../types';
|
|
2
|
+
type MarkupSource = Pick<GetSessionResponse, 'markupPercentage' | 'amount' | 'fxRate' | 'cryptoFXRates' | 'calculatedCryptoTotals'>;
|
|
3
|
+
export declare function getSessionMarkupPercentage(session: MarkupSource | undefined): number | null;
|
|
4
|
+
export declare function formatMarkupPercentage(markupPercentage: number): string;
|
|
5
|
+
export {};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { AllowedWalletConfig, Asset, GetSessionResponse } from '../types';
|
|
2
2
|
export declare function resolveAllowedAssets(allowedCrypto: string[] | null | undefined): Asset[];
|
|
3
3
|
export declare function collectNetworksFromAssets(allowedAssets: Asset[]): string[];
|
|
4
|
+
export declare function hoistRecommendedNetwork({ networks, recommendedNetwork, }: {
|
|
5
|
+
networks: string[];
|
|
6
|
+
recommendedNetwork: string | null | undefined;
|
|
7
|
+
}): string[];
|
|
4
8
|
export declare function filterAssetsByNetwork(allowedAssets: Asset[], networkCode: string): Asset[];
|
|
5
9
|
type NetworkFeeSource = Pick<GetSessionResponse, 'customFlatFeePerNetwork' | 'customFeePercentagePerNetwork'>;
|
|
6
10
|
type CryptoTotalSource = Pick<GetSessionResponse, 'calculatedCryptoTotals' | 'calculatedCryptoTotalsPerNetwork'>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SelectOption } from './components/formSelect';
|
|
2
|
+
export declare function filterOptions(options: SelectOption[], query: string): SelectOption[];
|
|
3
|
+
export declare function resolveOption(options: SelectOption[], query: string): SelectOption | null;
|
|
4
|
+
export declare function initialHighlightIndex(options: SelectOption[], value: string | undefined): number;
|
|
5
|
+
export declare function wrapIndex({ index, count }: {
|
|
6
|
+
index: number;
|
|
7
|
+
count: number;
|
|
8
|
+
}): number;
|
|
@@ -10,7 +10,8 @@ export declare class RestoreDetailsController {
|
|
|
10
10
|
private readonly dialog;
|
|
11
11
|
private readonly views;
|
|
12
12
|
private readonly emailInput;
|
|
13
|
-
private readonly
|
|
13
|
+
private readonly countryInput;
|
|
14
|
+
private readonly countryCombobox;
|
|
14
15
|
private readonly emailError;
|
|
15
16
|
private readonly otpError;
|
|
16
17
|
private readonly otpEmailLabel;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { SelectOption } from './components/formSelect';
|
|
2
|
+
export type SearchSelectOptions = {
|
|
3
|
+
id: string;
|
|
4
|
+
options: SelectOption[];
|
|
5
|
+
onChange?: (value: string) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare class SearchSelectController {
|
|
8
|
+
private readonly elements;
|
|
9
|
+
private readonly caret;
|
|
10
|
+
private readonly options;
|
|
11
|
+
private readonly onChange?;
|
|
12
|
+
private visibleOptions;
|
|
13
|
+
private activeIndex;
|
|
14
|
+
constructor(root: ShadowRoot | HTMLElement, { id, options, onChange }: SearchSelectOptions);
|
|
15
|
+
/** Sets the selection from a code, or clears it when the code is unknown. */
|
|
16
|
+
setValue(code: string): void;
|
|
17
|
+
reset(): void;
|
|
18
|
+
private findOption;
|
|
19
|
+
private wire;
|
|
20
|
+
private onKeyDown;
|
|
21
|
+
private isOpen;
|
|
22
|
+
private open;
|
|
23
|
+
private highlight;
|
|
24
|
+
private close;
|
|
25
|
+
private dismiss;
|
|
26
|
+
private commitTypedText;
|
|
27
|
+
private commitSelection;
|
|
28
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CheckoutWallet } from '../constants';
|
|
2
|
+
import { WalletConnectWallet } from '../types';
|
|
3
|
+
export declare function otherWalletsTile(): CheckoutWallet;
|
|
4
|
+
export declare function getWalletSummaryValue({ walletConnect, selectedWallet, }: {
|
|
5
|
+
walletConnect: boolean;
|
|
6
|
+
selectedWallet: WalletConnectWallet | null;
|
|
7
|
+
}): {
|
|
8
|
+
img: string;
|
|
9
|
+
label: string;
|
|
10
|
+
} | null;
|
|
11
|
+
export declare function getScanPayHeading({ walletConnect, selectedWallet, }: {
|
|
12
|
+
walletConnect: boolean;
|
|
13
|
+
selectedWallet: WalletConnectWallet | null;
|
|
14
|
+
}): {
|
|
15
|
+
key: string;
|
|
16
|
+
params?: {
|
|
17
|
+
wallet: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
/** The items in first-seen order, with later duplicates dropped. */
|
|
2
2
|
export declare function unique<T>(items: T[]): T[];
|
|
3
|
+
/**
|
|
4
|
+
* The items with every match first, leaving both the matches and the rest in their
|
|
5
|
+
* original order — the source order, not the order a caller listed its targets in.
|
|
6
|
+
* Relies on Array.prototype.sort being stable, which it has been required to be
|
|
7
|
+
* since ES2019.
|
|
8
|
+
*/
|
|
9
|
+
export declare function matchesFirst<T>(items: T[], isMatch: (item: T) => boolean): T[];
|
|
3
10
|
/**
|
|
4
11
|
* Collects `[key, value]` entries into a Map of key to every value seen for it,
|
|
5
12
|
* both in first-seen order. Keys with one value still get an array.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lydianpay/sdk-web",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.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": {
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"vitest": "^3.0.0"
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@lydianpay/lydianconnect": "^1.
|
|
79
|
+
"@lydianpay/lydianconnect": "^1.3.0",
|
|
80
80
|
"@lydianpay/lydianconnect-catalog": "^1.3.1",
|
|
81
81
|
"@solana/qr-code-styling": "^1.6.0",
|
|
82
82
|
"dompurify": "^3.4.12",
|