@medialane/ui 0.383.0 → 0.385.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/components/account/input-otp.d.cts +2 -2
- package/dist/components/account/input-otp.d.ts +2 -2
- package/dist/components/button.d.cts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/launchpad/edition-mint-schema.d.cts +2 -2
- package/dist/components/launchpad/edition-mint-schema.d.ts +2 -2
- package/dist/components/launchpad-services.cjs +29 -24
- package/dist/components/launchpad-services.cjs.map +1 -1
- package/dist/components/launchpad-services.d.cts +5 -0
- package/dist/components/launchpad-services.d.ts +5 -0
- package/dist/components/launchpad-services.js +29 -24
- package/dist/components/launchpad-services.js.map +1 -1
- package/dist/components/launchpad-strip.cjs +12 -4
- package/dist/components/launchpad-strip.cjs.map +1 -1
- package/dist/components/launchpad-strip.js +12 -4
- package/dist/components/launchpad-strip.js.map +1 -1
- package/dist/components/purchase-panel.cjs +237 -0
- package/dist/components/purchase-panel.cjs.map +1 -0
- package/dist/components/purchase-panel.d.cts +32 -0
- package/dist/components/purchase-panel.d.ts +32 -0
- package/dist/components/purchase-panel.js +201 -0
- package/dist/components/purchase-panel.js.map +1 -0
- package/dist/i18n/catalog/pt.cjs +10 -1
- package/dist/i18n/catalog/pt.cjs.map +1 -1
- package/dist/i18n/catalog/pt.js +10 -1
- package/dist/i18n/catalog/pt.js.map +1 -1
- package/dist/index.cjs +14 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/medialane.css +20 -0
- package/dist/utils/describe-error.cjs +14 -1
- package/dist/utils/describe-error.cjs.map +1 -1
- package/dist/utils/describe-error.d.cts +3 -1
- package/dist/utils/describe-error.d.ts +3 -1
- package/dist/utils/describe-error.js +12 -1
- package/dist/utils/describe-error.js.map +1 -1
- package/dist/utils/ipfs-gateway-fallback.cjs +9 -5
- package/dist/utils/ipfs-gateway-fallback.cjs.map +1 -1
- package/dist/utils/ipfs-gateway-fallback.d.cts +3 -1
- package/dist/utils/ipfs-gateway-fallback.d.ts +3 -1
- package/dist/utils/ipfs-gateway-fallback.js +9 -5
- package/dist/utils/ipfs-gateway-fallback.js.map +1 -1
- package/dist/utils/use-payment-options.cjs +65 -0
- package/dist/utils/use-payment-options.cjs.map +1 -0
- package/dist/utils/use-payment-options.d.cts +30 -0
- package/dist/utils/use-payment-options.d.ts +30 -0
- package/dist/utils/use-payment-options.js +39 -0
- package/dist/utils/use-payment-options.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var use_payment_options_exports = {};
|
|
21
|
+
__export(use_payment_options_exports, {
|
|
22
|
+
PAYMENT_COINS: () => PAYMENT_COINS,
|
|
23
|
+
pickPayment: () => pickPayment,
|
|
24
|
+
usePaymentOptions: () => usePaymentOptions
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(use_payment_options_exports);
|
|
27
|
+
var import_use_medialane_client = require("./use-medialane-client.js");
|
|
28
|
+
var import_use_swap_quote = require("./use-swap-quote.js");
|
|
29
|
+
var import_use_erc20_balance = require("./media-wallet/use-erc20-balance.js");
|
|
30
|
+
const PAYMENT_COINS = ["USDC", "USDT", "ETH", "STRK", "WBTC"];
|
|
31
|
+
function useCoin(symbol, currency, amountRaw, walletAddress) {
|
|
32
|
+
const { rawBalance, isLoading, decimals } = (0, import_use_erc20_balance.useTokenBalance)(symbol, walletAddress);
|
|
33
|
+
const balance = rawBalance ?? 0n;
|
|
34
|
+
const own = symbol === currency;
|
|
35
|
+
const swappable = !own && balance > 0n && amountRaw > 0n;
|
|
36
|
+
const { quote, isLoading: quoting } = (0, import_use_swap_quote.useSwapQuote)(swappable ? symbol : null, currency, swappable ? amountRaw.toString() : null, walletAddress);
|
|
37
|
+
const cost = own ? amountRaw : quote ? BigInt(quote.sellAmount) : null;
|
|
38
|
+
const option = own || balance > 0n ? { symbol, decimals, balance, cost, covers: cost !== null && balance >= cost } : null;
|
|
39
|
+
return { option, isLoading: isLoading || swappable && quoting };
|
|
40
|
+
}
|
|
41
|
+
function usePaymentOptions({ order, quantity, walletAddress }) {
|
|
42
|
+
const cost = (0, import_use_medialane_client.useMedialaneClient)().purchaseCost(order, quantity);
|
|
43
|
+
const currency = order.price?.currency ?? "";
|
|
44
|
+
const coins = [
|
|
45
|
+
useCoin(PAYMENT_COINS[0], currency, cost.total, walletAddress),
|
|
46
|
+
useCoin(PAYMENT_COINS[1], currency, cost.total, walletAddress),
|
|
47
|
+
useCoin(PAYMENT_COINS[2], currency, cost.total, walletAddress),
|
|
48
|
+
useCoin(PAYMENT_COINS[3], currency, cost.total, walletAddress),
|
|
49
|
+
useCoin(PAYMENT_COINS[4], currency, cost.total, walletAddress)
|
|
50
|
+
];
|
|
51
|
+
const listed = coins.map((c) => c.option).filter((o) => o !== null);
|
|
52
|
+
const options = [...listed.filter((o) => o.symbol === currency), ...listed.filter((o) => o.symbol !== currency)];
|
|
53
|
+
return { cost, options, isLoading: coins.some((c) => c.isLoading) };
|
|
54
|
+
}
|
|
55
|
+
function pickPayment(options, current) {
|
|
56
|
+
if (current && options.some((o) => o.symbol === current && o.covers)) return current;
|
|
57
|
+
return options.find((o) => o.covers)?.symbol ?? null;
|
|
58
|
+
}
|
|
59
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
+
0 && (module.exports = {
|
|
61
|
+
PAYMENT_COINS,
|
|
62
|
+
pickPayment,
|
|
63
|
+
usePaymentOptions
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=use-payment-options.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/use-payment-options.ts"],"sourcesContent":["\"use client\";\n\nimport type { ApiOrder } from \"@medialane/sdk\";\nimport type { PurchaseCost } from \"@medialane/sdk/starknet\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\nimport { useSwapQuote } from \"./use-swap-quote.js\";\nimport { useTokenBalance } from \"./media-wallet/use-erc20-balance.js\";\n\nexport interface PaymentOption {\n symbol: string;\n decimals: number;\n balance: bigint;\n /** What paying with this coin costs, in this coin; null while it is quoted or when there is no route. */\n cost: bigint | null;\n covers: boolean;\n}\n\n/** The coins a purchase can be paid with, in the order they are offered. */\nexport const PAYMENT_COINS = [\"USDC\", \"USDT\", \"ETH\", \"STRK\", \"WBTC\"] as const;\n\nfunction useCoin(symbol: string, currency: string, amountRaw: bigint, walletAddress: string | null) {\n const { rawBalance, isLoading, decimals } = useTokenBalance(symbol, walletAddress);\n const balance = rawBalance ?? 0n;\n const own = symbol === currency;\n const swappable = !own && balance > 0n && amountRaw > 0n;\n const { quote, isLoading: quoting } = useSwapQuote(swappable ? symbol : null, currency, swappable ? amountRaw.toString() : null, walletAddress);\n const cost = own ? amountRaw : quote ? BigInt(quote.sellAmount) : null;\n const option: PaymentOption | null =\n own || balance > 0n ? { symbol, decimals, balance, cost, covers: cost !== null && balance >= cost } : null;\n return { option, isLoading: isLoading || (swappable && quoting) };\n}\n\n/**\n * What buying `quantity` from `order` costs, and the coins the wallet can pay with: the order's own\n * coin first, then every other coin it holds, each priced through a swap quote.\n */\nexport function usePaymentOptions({ order, quantity, walletAddress }: { order: ApiOrder; quantity: number; walletAddress: string | null }): {\n cost: PurchaseCost;\n options: PaymentOption[];\n isLoading: boolean;\n} {\n const cost = useMedialaneClient().purchaseCost(order, quantity);\n const currency = order.price?.currency ?? \"\";\n const coins = [\n useCoin(PAYMENT_COINS[0], currency, cost.total, walletAddress),\n useCoin(PAYMENT_COINS[1], currency, cost.total, walletAddress),\n useCoin(PAYMENT_COINS[2], currency, cost.total, walletAddress),\n useCoin(PAYMENT_COINS[3], currency, cost.total, walletAddress),\n useCoin(PAYMENT_COINS[4], currency, cost.total, walletAddress),\n ];\n const listed = coins.map((c) => c.option).filter((o): o is PaymentOption => o !== null);\n const options = [...listed.filter((o) => o.symbol === currency), ...listed.filter((o) => o.symbol !== currency)];\n return { cost, options, isLoading: coins.some((c) => c.isLoading) };\n}\n\n/** The coin to pay with: `current` while it still covers the purchase, otherwise the first that does. */\nexport function pickPayment(options: readonly PaymentOption[], current: string | null): string | null {\n if (current && options.some((o) => o.symbol === current && o.covers)) return current;\n return options.find((o) => o.covers)?.symbol ?? null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,kCAAmC;AACnC,4BAA6B;AAC7B,+BAAgC;AAYzB,MAAM,gBAAgB,CAAC,QAAQ,QAAQ,OAAO,QAAQ,MAAM;AAEnE,SAAS,QAAQ,QAAgB,UAAkB,WAAmB,eAA8B;AAClG,QAAM,EAAE,YAAY,WAAW,SAAS,QAAI,0CAAgB,QAAQ,aAAa;AACjF,QAAM,UAAU,cAAc;AAC9B,QAAM,MAAM,WAAW;AACvB,QAAM,YAAY,CAAC,OAAO,UAAU,MAAM,YAAY;AACtD,QAAM,EAAE,OAAO,WAAW,QAAQ,QAAI,oCAAa,YAAY,SAAS,MAAM,UAAU,YAAY,UAAU,SAAS,IAAI,MAAM,aAAa;AAC9I,QAAM,OAAO,MAAM,YAAY,QAAQ,OAAO,MAAM,UAAU,IAAI;AAClE,QAAM,SACJ,OAAO,UAAU,KAAK,EAAE,QAAQ,UAAU,SAAS,MAAM,QAAQ,SAAS,QAAQ,WAAW,KAAK,IAAI;AACxG,SAAO,EAAE,QAAQ,WAAW,aAAc,aAAa,QAAS;AAClE;AAMO,SAAS,kBAAkB,EAAE,OAAO,UAAU,cAAc,GAIjE;AACA,QAAM,WAAO,gDAAmB,EAAE,aAAa,OAAO,QAAQ;AAC9D,QAAM,WAAW,MAAM,OAAO,YAAY;AAC1C,QAAM,QAAQ;AAAA,IACZ,QAAQ,cAAc,CAAC,GAAG,UAAU,KAAK,OAAO,aAAa;AAAA,IAC7D,QAAQ,cAAc,CAAC,GAAG,UAAU,KAAK,OAAO,aAAa;AAAA,IAC7D,QAAQ,cAAc,CAAC,GAAG,UAAU,KAAK,OAAO,aAAa;AAAA,IAC7D,QAAQ,cAAc,CAAC,GAAG,UAAU,KAAK,OAAO,aAAa;AAAA,IAC7D,QAAQ,cAAc,CAAC,GAAG,UAAU,KAAK,OAAO,aAAa;AAAA,EAC/D;AACA,QAAM,SAAS,MAAM,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,MAA0B,MAAM,IAAI;AACtF,QAAM,UAAU,CAAC,GAAG,OAAO,OAAO,CAAC,MAAM,EAAE,WAAW,QAAQ,GAAG,GAAG,OAAO,OAAO,CAAC,MAAM,EAAE,WAAW,QAAQ,CAAC;AAC/G,SAAO,EAAE,MAAM,SAAS,WAAW,MAAM,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE;AACpE;AAGO,SAAS,YAAY,SAAmC,SAAuC;AACpG,MAAI,WAAW,QAAQ,KAAK,CAAC,MAAM,EAAE,WAAW,WAAW,EAAE,MAAM,EAAG,QAAO;AAC7E,SAAO,QAAQ,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU;AAClD;","names":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ApiOrder } from '@medialane/sdk';
|
|
2
|
+
import { PurchaseCost } from '@medialane/sdk/starknet';
|
|
3
|
+
|
|
4
|
+
interface PaymentOption {
|
|
5
|
+
symbol: string;
|
|
6
|
+
decimals: number;
|
|
7
|
+
balance: bigint;
|
|
8
|
+
/** What paying with this coin costs, in this coin; null while it is quoted or when there is no route. */
|
|
9
|
+
cost: bigint | null;
|
|
10
|
+
covers: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** The coins a purchase can be paid with, in the order they are offered. */
|
|
13
|
+
declare const PAYMENT_COINS: readonly ["USDC", "USDT", "ETH", "STRK", "WBTC"];
|
|
14
|
+
/**
|
|
15
|
+
* What buying `quantity` from `order` costs, and the coins the wallet can pay with: the order's own
|
|
16
|
+
* coin first, then every other coin it holds, each priced through a swap quote.
|
|
17
|
+
*/
|
|
18
|
+
declare function usePaymentOptions({ order, quantity, walletAddress }: {
|
|
19
|
+
order: ApiOrder;
|
|
20
|
+
quantity: number;
|
|
21
|
+
walletAddress: string | null;
|
|
22
|
+
}): {
|
|
23
|
+
cost: PurchaseCost;
|
|
24
|
+
options: PaymentOption[];
|
|
25
|
+
isLoading: boolean;
|
|
26
|
+
};
|
|
27
|
+
/** The coin to pay with: `current` while it still covers the purchase, otherwise the first that does. */
|
|
28
|
+
declare function pickPayment(options: readonly PaymentOption[], current: string | null): string | null;
|
|
29
|
+
|
|
30
|
+
export { PAYMENT_COINS, type PaymentOption, pickPayment, usePaymentOptions };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ApiOrder } from '@medialane/sdk';
|
|
2
|
+
import { PurchaseCost } from '@medialane/sdk/starknet';
|
|
3
|
+
|
|
4
|
+
interface PaymentOption {
|
|
5
|
+
symbol: string;
|
|
6
|
+
decimals: number;
|
|
7
|
+
balance: bigint;
|
|
8
|
+
/** What paying with this coin costs, in this coin; null while it is quoted or when there is no route. */
|
|
9
|
+
cost: bigint | null;
|
|
10
|
+
covers: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** The coins a purchase can be paid with, in the order they are offered. */
|
|
13
|
+
declare const PAYMENT_COINS: readonly ["USDC", "USDT", "ETH", "STRK", "WBTC"];
|
|
14
|
+
/**
|
|
15
|
+
* What buying `quantity` from `order` costs, and the coins the wallet can pay with: the order's own
|
|
16
|
+
* coin first, then every other coin it holds, each priced through a swap quote.
|
|
17
|
+
*/
|
|
18
|
+
declare function usePaymentOptions({ order, quantity, walletAddress }: {
|
|
19
|
+
order: ApiOrder;
|
|
20
|
+
quantity: number;
|
|
21
|
+
walletAddress: string | null;
|
|
22
|
+
}): {
|
|
23
|
+
cost: PurchaseCost;
|
|
24
|
+
options: PaymentOption[];
|
|
25
|
+
isLoading: boolean;
|
|
26
|
+
};
|
|
27
|
+
/** The coin to pay with: `current` while it still covers the purchase, otherwise the first that does. */
|
|
28
|
+
declare function pickPayment(options: readonly PaymentOption[], current: string | null): string | null;
|
|
29
|
+
|
|
30
|
+
export { PAYMENT_COINS, type PaymentOption, pickPayment, usePaymentOptions };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMedialaneClient } from "./use-medialane-client.js";
|
|
3
|
+
import { useSwapQuote } from "./use-swap-quote.js";
|
|
4
|
+
import { useTokenBalance } from "./media-wallet/use-erc20-balance.js";
|
|
5
|
+
const PAYMENT_COINS = ["USDC", "USDT", "ETH", "STRK", "WBTC"];
|
|
6
|
+
function useCoin(symbol, currency, amountRaw, walletAddress) {
|
|
7
|
+
const { rawBalance, isLoading, decimals } = useTokenBalance(symbol, walletAddress);
|
|
8
|
+
const balance = rawBalance ?? 0n;
|
|
9
|
+
const own = symbol === currency;
|
|
10
|
+
const swappable = !own && balance > 0n && amountRaw > 0n;
|
|
11
|
+
const { quote, isLoading: quoting } = useSwapQuote(swappable ? symbol : null, currency, swappable ? amountRaw.toString() : null, walletAddress);
|
|
12
|
+
const cost = own ? amountRaw : quote ? BigInt(quote.sellAmount) : null;
|
|
13
|
+
const option = own || balance > 0n ? { symbol, decimals, balance, cost, covers: cost !== null && balance >= cost } : null;
|
|
14
|
+
return { option, isLoading: isLoading || swappable && quoting };
|
|
15
|
+
}
|
|
16
|
+
function usePaymentOptions({ order, quantity, walletAddress }) {
|
|
17
|
+
const cost = useMedialaneClient().purchaseCost(order, quantity);
|
|
18
|
+
const currency = order.price?.currency ?? "";
|
|
19
|
+
const coins = [
|
|
20
|
+
useCoin(PAYMENT_COINS[0], currency, cost.total, walletAddress),
|
|
21
|
+
useCoin(PAYMENT_COINS[1], currency, cost.total, walletAddress),
|
|
22
|
+
useCoin(PAYMENT_COINS[2], currency, cost.total, walletAddress),
|
|
23
|
+
useCoin(PAYMENT_COINS[3], currency, cost.total, walletAddress),
|
|
24
|
+
useCoin(PAYMENT_COINS[4], currency, cost.total, walletAddress)
|
|
25
|
+
];
|
|
26
|
+
const listed = coins.map((c) => c.option).filter((o) => o !== null);
|
|
27
|
+
const options = [...listed.filter((o) => o.symbol === currency), ...listed.filter((o) => o.symbol !== currency)];
|
|
28
|
+
return { cost, options, isLoading: coins.some((c) => c.isLoading) };
|
|
29
|
+
}
|
|
30
|
+
function pickPayment(options, current) {
|
|
31
|
+
if (current && options.some((o) => o.symbol === current && o.covers)) return current;
|
|
32
|
+
return options.find((o) => o.covers)?.symbol ?? null;
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
PAYMENT_COINS,
|
|
36
|
+
pickPayment,
|
|
37
|
+
usePaymentOptions
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=use-payment-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/use-payment-options.ts"],"sourcesContent":["\"use client\";\n\nimport type { ApiOrder } from \"@medialane/sdk\";\nimport type { PurchaseCost } from \"@medialane/sdk/starknet\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\nimport { useSwapQuote } from \"./use-swap-quote.js\";\nimport { useTokenBalance } from \"./media-wallet/use-erc20-balance.js\";\n\nexport interface PaymentOption {\n symbol: string;\n decimals: number;\n balance: bigint;\n /** What paying with this coin costs, in this coin; null while it is quoted or when there is no route. */\n cost: bigint | null;\n covers: boolean;\n}\n\n/** The coins a purchase can be paid with, in the order they are offered. */\nexport const PAYMENT_COINS = [\"USDC\", \"USDT\", \"ETH\", \"STRK\", \"WBTC\"] as const;\n\nfunction useCoin(symbol: string, currency: string, amountRaw: bigint, walletAddress: string | null) {\n const { rawBalance, isLoading, decimals } = useTokenBalance(symbol, walletAddress);\n const balance = rawBalance ?? 0n;\n const own = symbol === currency;\n const swappable = !own && balance > 0n && amountRaw > 0n;\n const { quote, isLoading: quoting } = useSwapQuote(swappable ? symbol : null, currency, swappable ? amountRaw.toString() : null, walletAddress);\n const cost = own ? amountRaw : quote ? BigInt(quote.sellAmount) : null;\n const option: PaymentOption | null =\n own || balance > 0n ? { symbol, decimals, balance, cost, covers: cost !== null && balance >= cost } : null;\n return { option, isLoading: isLoading || (swappable && quoting) };\n}\n\n/**\n * What buying `quantity` from `order` costs, and the coins the wallet can pay with: the order's own\n * coin first, then every other coin it holds, each priced through a swap quote.\n */\nexport function usePaymentOptions({ order, quantity, walletAddress }: { order: ApiOrder; quantity: number; walletAddress: string | null }): {\n cost: PurchaseCost;\n options: PaymentOption[];\n isLoading: boolean;\n} {\n const cost = useMedialaneClient().purchaseCost(order, quantity);\n const currency = order.price?.currency ?? \"\";\n const coins = [\n useCoin(PAYMENT_COINS[0], currency, cost.total, walletAddress),\n useCoin(PAYMENT_COINS[1], currency, cost.total, walletAddress),\n useCoin(PAYMENT_COINS[2], currency, cost.total, walletAddress),\n useCoin(PAYMENT_COINS[3], currency, cost.total, walletAddress),\n useCoin(PAYMENT_COINS[4], currency, cost.total, walletAddress),\n ];\n const listed = coins.map((c) => c.option).filter((o): o is PaymentOption => o !== null);\n const options = [...listed.filter((o) => o.symbol === currency), ...listed.filter((o) => o.symbol !== currency)];\n return { cost, options, isLoading: coins.some((c) => c.isLoading) };\n}\n\n/** The coin to pay with: `current` while it still covers the purchase, otherwise the first that does. */\nexport function pickPayment(options: readonly PaymentOption[], current: string | null): string | null {\n if (current && options.some((o) => o.symbol === current && o.covers)) return current;\n return options.find((o) => o.covers)?.symbol ?? null;\n}\n"],"mappings":";AAIA,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAYzB,MAAM,gBAAgB,CAAC,QAAQ,QAAQ,OAAO,QAAQ,MAAM;AAEnE,SAAS,QAAQ,QAAgB,UAAkB,WAAmB,eAA8B;AAClG,QAAM,EAAE,YAAY,WAAW,SAAS,IAAI,gBAAgB,QAAQ,aAAa;AACjF,QAAM,UAAU,cAAc;AAC9B,QAAM,MAAM,WAAW;AACvB,QAAM,YAAY,CAAC,OAAO,UAAU,MAAM,YAAY;AACtD,QAAM,EAAE,OAAO,WAAW,QAAQ,IAAI,aAAa,YAAY,SAAS,MAAM,UAAU,YAAY,UAAU,SAAS,IAAI,MAAM,aAAa;AAC9I,QAAM,OAAO,MAAM,YAAY,QAAQ,OAAO,MAAM,UAAU,IAAI;AAClE,QAAM,SACJ,OAAO,UAAU,KAAK,EAAE,QAAQ,UAAU,SAAS,MAAM,QAAQ,SAAS,QAAQ,WAAW,KAAK,IAAI;AACxG,SAAO,EAAE,QAAQ,WAAW,aAAc,aAAa,QAAS;AAClE;AAMO,SAAS,kBAAkB,EAAE,OAAO,UAAU,cAAc,GAIjE;AACA,QAAM,OAAO,mBAAmB,EAAE,aAAa,OAAO,QAAQ;AAC9D,QAAM,WAAW,MAAM,OAAO,YAAY;AAC1C,QAAM,QAAQ;AAAA,IACZ,QAAQ,cAAc,CAAC,GAAG,UAAU,KAAK,OAAO,aAAa;AAAA,IAC7D,QAAQ,cAAc,CAAC,GAAG,UAAU,KAAK,OAAO,aAAa;AAAA,IAC7D,QAAQ,cAAc,CAAC,GAAG,UAAU,KAAK,OAAO,aAAa;AAAA,IAC7D,QAAQ,cAAc,CAAC,GAAG,UAAU,KAAK,OAAO,aAAa;AAAA,IAC7D,QAAQ,cAAc,CAAC,GAAG,UAAU,KAAK,OAAO,aAAa;AAAA,EAC/D;AACA,QAAM,SAAS,MAAM,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,MAA0B,MAAM,IAAI;AACtF,QAAM,UAAU,CAAC,GAAG,OAAO,OAAO,CAAC,MAAM,EAAE,WAAW,QAAQ,GAAG,GAAG,OAAO,OAAO,CAAC,MAAM,EAAE,WAAW,QAAQ,CAAC;AAC/G,SAAO,EAAE,MAAM,SAAS,WAAW,MAAM,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE;AACpE;AAGO,SAAS,YAAY,SAAmC,SAAuC;AACpG,MAAI,WAAW,QAAQ,KAAK,CAAC,MAAM,EAAE,WAAW,WAAW,EAAE,MAAM,EAAG,QAAO;AAC7E,SAAO,QAAQ,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU;AAClD;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medialane/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.385.0",
|
|
4
4
|
"description": "Shared UI components for Medialane apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"preview": "vite --config preview/vite.config.ts"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@medialane/sdk": ">=0.
|
|
65
|
+
"@medialane/sdk": ">=0.237.0 <1.0.0",
|
|
66
66
|
"@radix-ui/react-checkbox": ">=1.1.0",
|
|
67
67
|
"@radix-ui/react-collapsible": ">=1.1.0",
|
|
68
68
|
"@radix-ui/react-dialog": ">=1.1.0",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"devDependencies": {
|
|
99
99
|
"@happy-dom/global-registrator": "^20.14.5",
|
|
100
100
|
"@hookform/resolvers": "^3.10.0",
|
|
101
|
-
"@medialane/sdk": "0.
|
|
101
|
+
"@medialane/sdk": "0.237.0",
|
|
102
102
|
"@radix-ui/react-checkbox": "^1.3.8",
|
|
103
103
|
"@radix-ui/react-collapsible": "^1.1.17",
|
|
104
104
|
"@radix-ui/react-dialog": "^1.1.20",
|