@lydianpay/sdk-web 2.0.1 → 2.0.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.
- package/dist/chunks/{index-CPaNT4Oo.js → index-BYdhdu5y.js} +2863 -2792
- package/dist/chunks/{index-CWd2eKRT.js → index-Cg2XHdVQ.js} +1 -1
- package/dist/chunks/{metamask-sdk-B763dcIQ.js → metamask-sdk-CEhBuHc0.js} +1 -1
- package/dist/lydian.js +1 -1
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/constants.d.ts +2 -1
- package/dist/types/ui/Checkout.d.ts +1 -0
- package/dist/types/ui/components/icons.d.ts +2 -2
- package/dist/types/utils/collections.d.ts +7 -0
- package/dist/types/utils/index.d.ts +1 -5
- package/dist/types/utils/moneyHelpers.d.ts +23 -0
- package/package.json +1 -1
|
@@ -39,7 +39,6 @@ export declare const AllowedAssetUSDP = "USDP";
|
|
|
39
39
|
export declare const AllowedAssetUSDS = "USDS";
|
|
40
40
|
export declare const AllowedAssetUSDT = "USDT";
|
|
41
41
|
export declare const AllowedAssetZKsync = "ZKSYNC";
|
|
42
|
-
export declare const SupportedCheckoutNetworks: string[];
|
|
43
42
|
export declare const AssetUSDT: DisplayAsset;
|
|
44
43
|
export declare const AssetUSDC: DisplayAsset;
|
|
45
44
|
export declare const AssetEthereum: DisplayAsset;
|
|
@@ -73,6 +72,8 @@ export type CheckoutNetwork = {
|
|
|
73
72
|
};
|
|
74
73
|
export declare const CheckoutNetworks: Record<string, CheckoutNetwork>;
|
|
75
74
|
export declare const NetworkAssetContracts: Record<string, Record<string, string>>;
|
|
75
|
+
export declare const SupportedCheckoutNetworks: string[];
|
|
76
|
+
export declare const CheckoutNativeAssets: Record<string, string>;
|
|
76
77
|
/** The onchain contract for an asset on a network, or undefined for a native coin. */
|
|
77
78
|
export declare function tokenContract(networkCode: string, assetCode: string): string | undefined;
|
|
78
79
|
export type CheckoutWallet = {
|
|
@@ -226,6 +226,7 @@ export declare class Checkout extends HTMLElement {
|
|
|
226
226
|
private populateKycSummaryRows;
|
|
227
227
|
private applyKycFieldVisibility;
|
|
228
228
|
private renderKycStep;
|
|
229
|
+
private syncKycContinueEnabled;
|
|
229
230
|
private readKycFieldValues;
|
|
230
231
|
private showKycFieldError;
|
|
231
232
|
private clearKycFieldErrors;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export declare const caretDownIconSvg = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M2.5 5.5L8 11L13.5 5.5\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>";
|
|
2
2
|
export declare const arrowLeftIconSvg = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M19 12H5M5 12L11 6M5 12L11 18\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>";
|
|
3
3
|
export declare const caretRightIconSvg = "<svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M9 4.5L16.5 12L9 19.5\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>";
|
|
4
|
-
export declare const alertCircleIconSvg = "<svg width=\"
|
|
4
|
+
export declare const alertCircleIconSvg = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 512 512\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M256 32C132.3 32 32 132.3 32 256s100.3 224 224 224 224-100.3 224-224S379.7 32 256 32zm0 338a26 26 0 1 1 0-52 26 26 0 0 1 0 52zm25-122c-.7 15-11.5 25-25 25s-24.3-10-25-25l-6-114c-.6-17.6 12.2-32 31-32s31.6 14.4 31 32z\"/>\n</svg>";
|
|
5
5
|
export declare const warningTriangleIconSvg = "<svg width=\"20\" height=\"18\" viewBox=\"0 0 21 19\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M10.5 2.23152L18.7952 16.7657H2.20476L10.5 2.23152ZM0.298949 15.6485C-0.549302 17.1344 0.508258 19 2.20476 19H18.7952C20.4917 19 21.5493 17.1344 20.7011 15.6485L12.4058 1.11436C11.5576 -0.371454 9.44244 -0.371454 8.59419 1.11436L0.298949 15.6485ZM9.39837 7.82846V10.0628C9.39837 10.6772 9.89411 11.1799 10.5 11.1799C11.1059 11.1799 11.6016 10.6772 11.6016 10.0628V7.82846C11.6016 7.21402 11.1059 6.7113 10.5 6.7113C9.89411 6.7113 9.39837 7.21402 9.39837 7.82846ZM9.39837 13.4142H11.6016V15.6485H9.39837Z\" fill=\"currentColor\"/>\n</svg>";
|
|
6
|
-
export declare const clockIconSvg = "<svg width=\"
|
|
6
|
+
export declare const clockIconSvg = "<svg width=\"28\" height=\"28\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M8.62788 16.8262C7.9509 16.6726 7.30072 16.4186 6.69896 16.0725M11.739 3.17285C13.2854 3.52603 14.6661 4.39375 15.655 5.63395C16.6438 6.87415 17.1824 8.41335 17.1824 9.99954C17.1824 11.5857 16.6438 13.1249 15.655 14.3651C14.6661 15.6053 13.2854 16.4731 11.739 16.8262M4.41149 13.9611C3.98721 13.3447 3.66497 12.6639 3.45714 11.945M3.27979 8.83275C3.40423 8.09385 3.64379 7.39384 3.9798 6.75216L4.11125 6.51493M6.22233 4.22754C6.95008 3.72656 7.7665 3.36863 8.62805 3.17285M10.1835 6.88863V9.99981L12.5168 12.3332\" stroke=\"currentColor\" stroke-width=\"1.66667\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>";
|
|
7
7
|
export declare const checkCircleIconSvg = "<svg width=\"72\" height=\"72\" viewBox=\"0 0 64 64\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"32\" cy=\"32\" r=\"32\" fill=\"currentColor\"/>\n <path d=\"M19 33L28 42L45 24\" stroke=\"#ffffff\" stroke-width=\"5.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>";
|
|
8
8
|
export declare const copyIconSvg = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M15 1H4C2.9 1 2 1.9 2 3V16C2 16.55 2.45 17 3 17C3.55 17 4 16.55 4 16V4C4 3.45 4.45 3 5 3H15C15.55 3 16 2.55 16 2C16 1.45 15.55 1 15 1ZM19 5H8C6.9 5 6 5.9 6 7V21C6 22.1 6.9 23 8 23H19C20.1 23 21 22.1 21 21V7C21 5.9 20.1 5 19 5ZM18 21H9C8.45 21 8 20.55 8 20V8C8 7.45 8.45 7 9 7H18C18.55 7 19 7.45 19 8V20C19 20.55 18.55 21 18 21Z\"/>\n</svg>";
|
|
9
9
|
export declare const arrowBendIconSvg = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" d=\"M14.854 4.854a.5.5 0 0 0 0-.708l-4-4a.5.5 0 0 0-.708.708L13.293 4H3.5A2.5 2.5 0 0 0 1 6.5v8a.5.5 0 0 0 1 0v-8A1.5 1.5 0 0 1 3.5 5h9.793l-3.147 3.146a.5.5 0 0 0 .708.708l4-4z\"/>\n</svg>";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** The items in first-seen order, with later duplicates dropped. */
|
|
2
|
+
export declare function unique<T>(items: T[]): T[];
|
|
3
|
+
/**
|
|
4
|
+
* Collects `[key, value]` entries into a Map of key to every value seen for it,
|
|
5
|
+
* both in first-seen order. Keys with one value still get an array.
|
|
6
|
+
*/
|
|
7
|
+
export declare function groupValuesByKey<K, V>(entries: [K, V][]): Map<K, V[]>;
|
|
@@ -5,12 +5,8 @@ export declare function capitalizeFirstLetter(str: string): string;
|
|
|
5
5
|
* @param currency - The currency code (USD or TRY)
|
|
6
6
|
* @returns Formatted currency string
|
|
7
7
|
*/
|
|
8
|
-
export declare function formatCurrency(amount: number, currency?: string | null): string;
|
|
8
|
+
export declare function formatCurrency(amount: number, currency?: string | null, maximumFractionDigits?: number): string;
|
|
9
9
|
export declare function formatExchangeRate(asset: string, cryptoRatePerUSD: number, fxRateToUSD: number, currency: string): string;
|
|
10
10
|
export declare function formatDateForTransactionDetails(isoDateString: string): string;
|
|
11
11
|
export declare function formatDateShort(isoDateString?: string | null): string;
|
|
12
|
-
export declare function formatCryptoAmount(num: number): string;
|
|
13
|
-
export declare function trimTrailingZeros(decimal: string): string;
|
|
14
|
-
export declare function formatToTwoDecimals(num: number): string;
|
|
15
|
-
export declare function formatToNDecimals(num: number, precision: number): string;
|
|
16
12
|
export declare function canvasSafeImageUrl(imageUrl: string): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A USD figure in the customer's local currency.
|
|
3
|
+
*
|
|
4
|
+
* fxRateToUSD is USD-per-local, so this divides. A zero rate returns null rather
|
|
5
|
+
* than Infinity — the caller hides the row instead of printing a nonsense amount.
|
|
6
|
+
*/
|
|
7
|
+
export declare function localFromUsd(usdAmount: number, fxRateToUSD: number): number | null;
|
|
8
|
+
/** How much of a partially-paid invoice has landed, in local currency. */
|
|
9
|
+
export declare function paidSoFar(totalLocal: number, remainingLocal: number): number;
|
|
10
|
+
/**
|
|
11
|
+
* The local-currency price of one unit of the asset.
|
|
12
|
+
*
|
|
13
|
+
* cryptoRatePerUSD is USD-per-crypto and fxRateToUSD is USD-per-local, so
|
|
14
|
+
* local-per-crypto is their quotient in this order — inverting it reads correctly
|
|
15
|
+
* only when both are 1. Returns null when either rate is missing or the result is
|
|
16
|
+
* not finite, which is the caller's signal to print nothing.
|
|
17
|
+
*/
|
|
18
|
+
export declare function localPerCrypto(cryptoRatePerUSD: number, fxRateToUSD: number): number | null;
|
|
19
|
+
export declare function rateFractionDigits(value: number): number;
|
|
20
|
+
export declare function formatCryptoAmount(num: number): string;
|
|
21
|
+
export declare function trimTrailingZeros(decimal: string): string;
|
|
22
|
+
export declare function formatToTwoDecimals(num: number): string;
|
|
23
|
+
export declare function formatToNDecimals(num: number, precision: number): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lydianpay/sdk-web",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.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": {
|