@medialane/ui 0.218.0 → 0.219.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 +2 -2
- package/dist/components/button.d.ts +2 -2
- package/dist/components/fast-mint/fast-mint.d.cts +2 -2
- package/dist/components/fast-mint/fast-mint.d.ts +2 -2
- package/dist/components/portfolio-shell.cjs +22 -12
- package/dist/components/portfolio-shell.cjs.map +1 -1
- package/dist/components/portfolio-shell.d.cts +6 -1
- package/dist/components/portfolio-shell.d.ts +6 -1
- package/dist/components/portfolio-shell.js +22 -12
- package/dist/components/portfolio-shell.js.map +1 -1
- package/dist/components/sheet.d.cts +1 -1
- package/dist/components/sheet.d.ts +1 -1
- package/dist/utils/portfolio-counts.cjs +2 -1
- package/dist/utils/portfolio-counts.cjs.map +1 -1
- package/dist/utils/portfolio-counts.d.cts +1 -0
- package/dist/utils/portfolio-counts.d.ts +1 -0
- package/dist/utils/portfolio-counts.js +2 -1
- package/dist/utils/portfolio-counts.js.map +1 -1
- package/dist/utils/portfolio-tabs.cjs +33 -0
- package/dist/utils/portfolio-tabs.cjs.map +1 -0
- package/dist/utils/portfolio-tabs.d.cts +8 -0
- package/dist/utils/portfolio-tabs.d.ts +8 -0
- package/dist/utils/portfolio-tabs.js +9 -0
- package/dist/utils/portfolio-tabs.js.map +1 -0
- package/dist/utils/use-sponsorship.cjs +10 -8
- package/dist/utils/use-sponsorship.cjs.map +1 -1
- package/dist/utils/use-sponsorship.d.cts +1 -0
- package/dist/utils/use-sponsorship.d.ts +1 -0
- package/dist/utils/use-sponsorship.js +10 -8
- package/dist/utils/use-sponsorship.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as input_otp from 'input-otp';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
-
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
4
|
+
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
5
5
|
value?: string;
|
|
6
6
|
onChange?: (newValue: string) => unknown;
|
|
7
7
|
maxLength: number;
|
|
@@ -14,7 +14,7 @@ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHT
|
|
|
14
14
|
} & {
|
|
15
15
|
render: (props: input_otp.RenderProps) => React.ReactNode;
|
|
16
16
|
children?: never;
|
|
17
|
-
} & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
17
|
+
} & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
18
18
|
value?: string;
|
|
19
19
|
onChange?: (newValue: string) => unknown;
|
|
20
20
|
maxLength: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as input_otp from 'input-otp';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
-
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
4
|
+
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
5
5
|
value?: string;
|
|
6
6
|
onChange?: (newValue: string) => unknown;
|
|
7
7
|
maxLength: number;
|
|
@@ -14,7 +14,7 @@ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHT
|
|
|
14
14
|
} & {
|
|
15
15
|
render: (props: input_otp.RenderProps) => React.ReactNode;
|
|
16
16
|
children?: never;
|
|
17
|
-
} & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
17
|
+
} & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
18
18
|
value?: string;
|
|
19
19
|
onChange?: (newValue: string) => unknown;
|
|
20
20
|
maxLength: number;
|
|
@@ -3,8 +3,8 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "
|
|
7
|
-
size?: "
|
|
6
|
+
variant?: "ghost" | "link" | "default" | "destructive" | "outline" | "secondary" | "premium" | "tonal" | "gradient-border" | "gradient-fill" | null | undefined;
|
|
7
|
+
size?: "icon" | "default" | "sm" | "lg" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
10
10
|
asChild?: boolean;
|
|
@@ -3,8 +3,8 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "
|
|
7
|
-
size?: "
|
|
6
|
+
variant?: "ghost" | "link" | "default" | "destructive" | "outline" | "secondary" | "premium" | "tonal" | "gradient-border" | "gradient-fill" | null | undefined;
|
|
7
|
+
size?: "icon" | "default" | "sm" | "lg" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
10
10
|
asChild?: boolean;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { FastMintProps } from './types.cjs';
|
|
4
4
|
import 'starknet';
|
|
5
5
|
import '@medialane/sdk';
|
|
6
6
|
import '@medialane/sdk/starknet';
|
|
7
7
|
|
|
8
|
-
declare function FastMint(props: FastMintProps): string | number | bigint | boolean |
|
|
8
|
+
declare function FastMint(props: FastMintProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
9
9
|
|
|
10
10
|
export { FastMint };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { FastMintProps } from './types.js';
|
|
4
4
|
import 'starknet';
|
|
5
5
|
import '@medialane/sdk';
|
|
6
6
|
import '@medialane/sdk/starknet';
|
|
7
7
|
|
|
8
|
-
declare function FastMint(props: FastMintProps): string | number | bigint | boolean |
|
|
8
|
+
declare function FastMint(props: FastMintProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
9
9
|
|
|
10
10
|
export { FastMint };
|
|
@@ -33,6 +33,7 @@ var import_portfolio_header = require("./portfolio-header.js");
|
|
|
33
33
|
var import_portfolio_chip_filter = require("./portfolio-chip-filter.js");
|
|
34
34
|
var import_medialane_app = require("./medialane-app.js");
|
|
35
35
|
var import_portfolio_counts = require("../utils/portfolio-counts.js");
|
|
36
|
+
var import_portfolio_tabs = require("../utils/portfolio-tabs.js");
|
|
36
37
|
var import_seen_offers = require("../utils/seen-offers.js");
|
|
37
38
|
var import_use_orders = require("../utils/use-orders.js");
|
|
38
39
|
var import_use_rewards = require("../utils/use-rewards.js");
|
|
@@ -40,12 +41,12 @@ var import_use_sponsorship = require("../utils/use-sponsorship.js");
|
|
|
40
41
|
const PORTFOLIO_TABS = [
|
|
41
42
|
{ key: "assets", label: "Assets", href: "/portfolio/assets" },
|
|
42
43
|
{ key: "collections", label: "Collections", href: "/portfolio/collections" },
|
|
43
|
-
{ key: "listings", label: "Listings", href: "/portfolio/listings" },
|
|
44
|
-
{ key: "received", label: "Offers received", href: "/portfolio/received" },
|
|
45
|
-
{ key: "offers", label: "Offers sent", href: "/portfolio/offers" },
|
|
46
|
-
{ key: "counter", label: "Counter-offers", href: "/portfolio/counter-offers" },
|
|
47
|
-
{ key: "licensing", label: "Licensing", href: "/portfolio/licensing" },
|
|
48
|
-
{ key: "sponsorship", label: "Sponsorships", href: "/portfolio/sponsorships" },
|
|
44
|
+
{ key: "listings", label: "Listings", href: "/portfolio/listings", hideWhenEmpty: true },
|
|
45
|
+
{ key: "received", label: "Offers received", href: "/portfolio/received", hideWhenEmpty: true },
|
|
46
|
+
{ key: "offers", label: "Offers sent", href: "/portfolio/offers", hideWhenEmpty: true },
|
|
47
|
+
{ key: "counter", label: "Counter-offers", href: "/portfolio/counter-offers", hideWhenEmpty: true },
|
|
48
|
+
{ key: "licensing", label: "Licensing", href: "/portfolio/licensing", hideWhenEmpty: true },
|
|
49
|
+
{ key: "sponsorship", label: "Sponsorships", href: "/portfolio/sponsorships", hideWhenEmpty: true },
|
|
49
50
|
{ key: "activity", label: "Activity", href: "/portfolio/activity" }
|
|
50
51
|
];
|
|
51
52
|
function SignedOut() {
|
|
@@ -64,19 +65,28 @@ function Loading() {
|
|
|
64
65
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: "mx-auto h-4 w-72" })
|
|
65
66
|
] });
|
|
66
67
|
}
|
|
67
|
-
function PortfolioShell({ tabs = PORTFOLIO_TABS, remixOffers, children }) {
|
|
68
|
+
function PortfolioShell({ tabs = PORTFOLIO_TABS, remixOffers, licensing, children }) {
|
|
68
69
|
const { walletAddress: address, walletLoading } = (0, import_medialane_app.useMedialaneApp)();
|
|
69
70
|
const pathname = (0, import_router.usePathname)();
|
|
70
|
-
const { orders } = (0, import_use_orders.useUserOrders)(address);
|
|
71
|
-
const { orders: receivedOffers } = (0, import_use_orders.useReceivedOffers)(address);
|
|
71
|
+
const { orders, isLoading: ordersLoading } = (0, import_use_orders.useUserOrders)(address);
|
|
72
|
+
const { orders: receivedOffers, isLoading: receivedLoading } = (0, import_use_orders.useReceivedOffers)(address);
|
|
72
73
|
const { data: rewards } = (0, import_use_rewards.useRewards)(address);
|
|
73
|
-
const
|
|
74
|
+
const sponsorship = (0, import_use_sponsorship.useMySponsorshipDealCounts)(address);
|
|
74
75
|
(0, import_react.useEffect)(() => {
|
|
75
76
|
if (receivedOffers.length > 0) (0, import_seen_offers.markOffersAsSeen)(receivedOffers.map((o) => o.orderHash));
|
|
76
77
|
}, [receivedOffers]);
|
|
77
78
|
if (!address) return walletLoading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loading, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SignedOut, {});
|
|
78
|
-
const counts = (0, import_portfolio_counts.derivePortfolioCounts)({ orders, receivedOffers, remixOffers, address, sponsorshipPendingCount: pendingCount });
|
|
79
|
+
const counts = (0, import_portfolio_counts.derivePortfolioCounts)({ orders, receivedOffers, remixOffers, address, sponsorshipPendingCount: sponsorship.pendingCount });
|
|
79
80
|
const countFor = { received: counts.received, counter: counts.counter, licensing: counts.remix, sponsorship: counts.sponsorships };
|
|
81
|
+
const present = {
|
|
82
|
+
listings: ordersLoading ? void 0 : counts.listings > 0,
|
|
83
|
+
offers: ordersLoading ? void 0 : counts.offers > 0,
|
|
84
|
+
counter: ordersLoading ? void 0 : counts.counter > 0,
|
|
85
|
+
received: receivedLoading ? void 0 : counts.received > 0,
|
|
86
|
+
licensing: licensing ? licensing.isLoading ? void 0 : licensing.present : true,
|
|
87
|
+
sponsorship: sponsorship.isLoading ? void 0 : sponsorship.hasAny
|
|
88
|
+
};
|
|
89
|
+
const shownTabs = (0, import_portfolio_tabs.visiblePortfolioTabs)(tabs, present, pathname ?? "");
|
|
80
90
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-6 px-4 pt-20 pb-8 sm:px-6 lg:px-8", children: [
|
|
81
91
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
82
92
|
import_portfolio_header.PortfolioHeader,
|
|
@@ -88,7 +98,7 @@ function PortfolioShell({ tabs = PORTFOLIO_TABS, remixOffers, children }) {
|
|
|
88
98
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
89
99
|
import_portfolio_chip_filter.PortfolioChipFilter,
|
|
90
100
|
{
|
|
91
|
-
options:
|
|
101
|
+
options: shownTabs.map((t) => ({ key: t.key, href: t.href, label: countFor[t.key] ? `${t.label} (${countFor[t.key]})` : t.label })),
|
|
92
102
|
value: pathname ?? "",
|
|
93
103
|
onChange: () => {
|
|
94
104
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/portfolio-shell.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, type ReactNode } from \"react\";\nimport { Wallet } from \"lucide-react\";\nimport { usePathname } from \"./router.js\";\nimport { Button } from \"./button.js\";\nimport { Skeleton } from \"./skeleton.js\";\nimport { PortfolioHeader } from \"./portfolio-header.js\";\nimport { PortfolioChipFilter } from \"./portfolio-chip-filter.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\nimport { derivePortfolioCounts } from \"../utils/portfolio-counts.js\";\nimport { markOffersAsSeen } from \"../utils/seen-offers.js\";\nimport { useReceivedOffers, useUserOrders } from \"../utils/use-orders.js\";\nimport { useRewards } from \"../utils/use-rewards.js\";\nimport { useMySponsorshipDealCounts } from \"../utils/use-sponsorship.js\";\n\nexport interface PortfolioTab {\n key: string;\n label: string;\n href: string;\n}\n\nexport const PORTFOLIO_TABS: PortfolioTab[] = [\n { key: \"assets\", label: \"Assets\", href: \"/portfolio/assets\" },\n { key: \"collections\", label: \"Collections\", href: \"/portfolio/collections\" },\n { key: \"listings\", label: \"Listings\", href: \"/portfolio/listings\" },\n { key: \"received\", label: \"Offers received\", href: \"/portfolio/received\" },\n { key: \"offers\", label: \"Offers sent\", href: \"/portfolio/offers\" },\n { key: \"counter\", label: \"Counter-offers\", href: \"/portfolio/counter-offers\" },\n { key: \"licensing\", label: \"Licensing\", href: \"/portfolio/licensing\" },\n { key: \"sponsorship\", label: \"Sponsorships\", href: \"/portfolio/sponsorships\" },\n { key: \"activity\", label: \"Activity\", href: \"/portfolio/activity\" },\n];\n\nfunction SignedOut() {\n const { onRequireWallet, connectLabel } = useMedialaneApp();\n return (\n <div className=\"mx-auto max-w-lg space-y-4 px-4 pt-24 pb-8 text-center\">\n <Wallet className=\"mx-auto h-10 w-10 text-muted-foreground\" />\n <h1 className=\"text-2xl font-bold\">Your portfolio</h1>\n <p className=\"text-muted-foreground\">Sign in to see your assets, listings and offers.</p>\n <Button size=\"lg\" className=\"rounded-full px-7\" onClick={onRequireWallet}>\n {connectLabel ?? \"Sign in\"}\n </Button>\n </div>\n );\n}\n\nfunction Loading() {\n return (\n <div className=\"mx-auto max-w-lg space-y-4 px-4 pt-24 pb-8\">\n <Skeleton className=\"mx-auto h-10 w-10 rounded-full\" />\n <Skeleton className=\"mx-auto h-7 w-56\" />\n <Skeleton className=\"mx-auto h-4 w-72\" />\n </div>\n );\n}\n\nexport function PortfolioShell({ tabs = PORTFOLIO_TABS, remixOffers, children }: {\n tabs?: PortfolioTab[];\n remixOffers?: ReadonlyArray<{ status: string }>;\n children: ReactNode;\n}) {\n const { walletAddress: address, walletLoading } = useMedialaneApp();\n const pathname = usePathname();\n const { orders } = useUserOrders(address);\n const { orders: receivedOffers } = useReceivedOffers(address);\n const { data: rewards } = useRewards(address);\n const
|
|
1
|
+
{"version":3,"sources":["../../src/components/portfolio-shell.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, type ReactNode } from \"react\";\nimport { Wallet } from \"lucide-react\";\nimport { usePathname } from \"./router.js\";\nimport { Button } from \"./button.js\";\nimport { Skeleton } from \"./skeleton.js\";\nimport { PortfolioHeader } from \"./portfolio-header.js\";\nimport { PortfolioChipFilter } from \"./portfolio-chip-filter.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\nimport { derivePortfolioCounts } from \"../utils/portfolio-counts.js\";\nimport { visiblePortfolioTabs } from \"../utils/portfolio-tabs.js\";\nimport { markOffersAsSeen } from \"../utils/seen-offers.js\";\nimport { useReceivedOffers, useUserOrders } from \"../utils/use-orders.js\";\nimport { useRewards } from \"../utils/use-rewards.js\";\nimport { useMySponsorshipDealCounts } from \"../utils/use-sponsorship.js\";\n\nexport interface PortfolioTab {\n key: string;\n label: string;\n href: string;\n hideWhenEmpty?: boolean;\n}\n\nexport const PORTFOLIO_TABS: PortfolioTab[] = [\n { key: \"assets\", label: \"Assets\", href: \"/portfolio/assets\" },\n { key: \"collections\", label: \"Collections\", href: \"/portfolio/collections\" },\n { key: \"listings\", label: \"Listings\", href: \"/portfolio/listings\", hideWhenEmpty: true },\n { key: \"received\", label: \"Offers received\", href: \"/portfolio/received\", hideWhenEmpty: true },\n { key: \"offers\", label: \"Offers sent\", href: \"/portfolio/offers\", hideWhenEmpty: true },\n { key: \"counter\", label: \"Counter-offers\", href: \"/portfolio/counter-offers\", hideWhenEmpty: true },\n { key: \"licensing\", label: \"Licensing\", href: \"/portfolio/licensing\", hideWhenEmpty: true },\n { key: \"sponsorship\", label: \"Sponsorships\", href: \"/portfolio/sponsorships\", hideWhenEmpty: true },\n { key: \"activity\", label: \"Activity\", href: \"/portfolio/activity\" },\n];\n\nfunction SignedOut() {\n const { onRequireWallet, connectLabel } = useMedialaneApp();\n return (\n <div className=\"mx-auto max-w-lg space-y-4 px-4 pt-24 pb-8 text-center\">\n <Wallet className=\"mx-auto h-10 w-10 text-muted-foreground\" />\n <h1 className=\"text-2xl font-bold\">Your portfolio</h1>\n <p className=\"text-muted-foreground\">Sign in to see your assets, listings and offers.</p>\n <Button size=\"lg\" className=\"rounded-full px-7\" onClick={onRequireWallet}>\n {connectLabel ?? \"Sign in\"}\n </Button>\n </div>\n );\n}\n\nfunction Loading() {\n return (\n <div className=\"mx-auto max-w-lg space-y-4 px-4 pt-24 pb-8\">\n <Skeleton className=\"mx-auto h-10 w-10 rounded-full\" />\n <Skeleton className=\"mx-auto h-7 w-56\" />\n <Skeleton className=\"mx-auto h-4 w-72\" />\n </div>\n );\n}\n\nexport function PortfolioShell({ tabs = PORTFOLIO_TABS, remixOffers, licensing, children }: {\n tabs?: PortfolioTab[];\n remixOffers?: ReadonlyArray<{ status: string }>;\n licensing?: { present: boolean; isLoading: boolean };\n children: ReactNode;\n}) {\n const { walletAddress: address, walletLoading } = useMedialaneApp();\n const pathname = usePathname();\n const { orders, isLoading: ordersLoading } = useUserOrders(address);\n const { orders: receivedOffers, isLoading: receivedLoading } = useReceivedOffers(address);\n const { data: rewards } = useRewards(address);\n const sponsorship = useMySponsorshipDealCounts(address);\n\n useEffect(() => {\n if (receivedOffers.length > 0) markOffersAsSeen(receivedOffers.map((o) => o.orderHash));\n }, [receivedOffers]);\n\n if (!address) return walletLoading ? <Loading /> : <SignedOut />;\n\n const counts = derivePortfolioCounts({ orders, receivedOffers, remixOffers, address, sponsorshipPendingCount: sponsorship.pendingCount });\n const countFor: Record<string, number> = { received: counts.received, counter: counts.counter, licensing: counts.remix, sponsorship: counts.sponsorships };\n const present: Record<string, boolean | undefined> = {\n listings: ordersLoading ? undefined : counts.listings > 0,\n offers: ordersLoading ? undefined : counts.offers > 0,\n counter: ordersLoading ? undefined : counts.counter > 0,\n received: receivedLoading ? undefined : counts.received > 0,\n licensing: licensing ? (licensing.isLoading ? undefined : licensing.present) : true,\n sponsorship: sponsorship.isLoading ? undefined : sponsorship.hasAny,\n };\n const shownTabs = visiblePortfolioTabs(tabs, present, pathname ?? \"\");\n\n return (\n <div className=\"space-y-6 px-4 pt-20 pb-8 sm:px-6 lg:px-8\">\n <PortfolioHeader\n address={address}\n score={rewards ? { levelName: rewards.currentLevelName, totalXp: rewards.totalXp, href: \"/rewards\" } : null}\n />\n <PortfolioChipFilter\n options={shownTabs.map((t) => ({ key: t.key, href: t.href, label: countFor[t.key] ? `${t.label} (${countFor[t.key]})` : t.label }))}\n value={pathname ?? \"\"}\n onChange={() => {}}\n showAll={false}\n />\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuCI;AArCJ,mBAA0C;AAC1C,0BAAuB;AACvB,oBAA4B;AAC5B,oBAAuB;AACvB,sBAAyB;AACzB,8BAAgC;AAChC,mCAAoC;AACpC,2BAAgC;AAChC,8BAAsC;AACtC,4BAAqC;AACrC,yBAAiC;AACjC,wBAAiD;AACjD,yBAA2B;AAC3B,6BAA2C;AASpC,MAAM,iBAAiC;AAAA,EAC5C,EAAE,KAAK,UAAU,OAAO,UAAU,MAAM,oBAAoB;AAAA,EAC5D,EAAE,KAAK,eAAe,OAAO,eAAe,MAAM,yBAAyB;AAAA,EAC3E,EAAE,KAAK,YAAY,OAAO,YAAY,MAAM,uBAAuB,eAAe,KAAK;AAAA,EACvF,EAAE,KAAK,YAAY,OAAO,mBAAmB,MAAM,uBAAuB,eAAe,KAAK;AAAA,EAC9F,EAAE,KAAK,UAAU,OAAO,eAAe,MAAM,qBAAqB,eAAe,KAAK;AAAA,EACtF,EAAE,KAAK,WAA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
6
|
label: string;
|
|
7
7
|
href: string;
|
|
8
|
+
hideWhenEmpty?: boolean;
|
|
8
9
|
}
|
|
9
10
|
declare const PORTFOLIO_TABS: PortfolioTab[];
|
|
10
|
-
declare function PortfolioShell({ tabs, remixOffers, children }: {
|
|
11
|
+
declare function PortfolioShell({ tabs, remixOffers, licensing, children }: {
|
|
11
12
|
tabs?: PortfolioTab[];
|
|
12
13
|
remixOffers?: ReadonlyArray<{
|
|
13
14
|
status: string;
|
|
14
15
|
}>;
|
|
16
|
+
licensing?: {
|
|
17
|
+
present: boolean;
|
|
18
|
+
isLoading: boolean;
|
|
19
|
+
};
|
|
15
20
|
children: ReactNode;
|
|
16
21
|
}): react_jsx_runtime.JSX.Element;
|
|
17
22
|
|
|
@@ -5,13 +5,18 @@ interface PortfolioTab {
|
|
|
5
5
|
key: string;
|
|
6
6
|
label: string;
|
|
7
7
|
href: string;
|
|
8
|
+
hideWhenEmpty?: boolean;
|
|
8
9
|
}
|
|
9
10
|
declare const PORTFOLIO_TABS: PortfolioTab[];
|
|
10
|
-
declare function PortfolioShell({ tabs, remixOffers, children }: {
|
|
11
|
+
declare function PortfolioShell({ tabs, remixOffers, licensing, children }: {
|
|
11
12
|
tabs?: PortfolioTab[];
|
|
12
13
|
remixOffers?: ReadonlyArray<{
|
|
13
14
|
status: string;
|
|
14
15
|
}>;
|
|
16
|
+
licensing?: {
|
|
17
|
+
present: boolean;
|
|
18
|
+
isLoading: boolean;
|
|
19
|
+
};
|
|
15
20
|
children: ReactNode;
|
|
16
21
|
}): react_jsx_runtime.JSX.Element;
|
|
17
22
|
|
|
@@ -9,6 +9,7 @@ import { PortfolioHeader } from "./portfolio-header.js";
|
|
|
9
9
|
import { PortfolioChipFilter } from "./portfolio-chip-filter.js";
|
|
10
10
|
import { useMedialaneApp } from "./medialane-app.js";
|
|
11
11
|
import { derivePortfolioCounts } from "../utils/portfolio-counts.js";
|
|
12
|
+
import { visiblePortfolioTabs } from "../utils/portfolio-tabs.js";
|
|
12
13
|
import { markOffersAsSeen } from "../utils/seen-offers.js";
|
|
13
14
|
import { useReceivedOffers, useUserOrders } from "../utils/use-orders.js";
|
|
14
15
|
import { useRewards } from "../utils/use-rewards.js";
|
|
@@ -16,12 +17,12 @@ import { useMySponsorshipDealCounts } from "../utils/use-sponsorship.js";
|
|
|
16
17
|
const PORTFOLIO_TABS = [
|
|
17
18
|
{ key: "assets", label: "Assets", href: "/portfolio/assets" },
|
|
18
19
|
{ key: "collections", label: "Collections", href: "/portfolio/collections" },
|
|
19
|
-
{ key: "listings", label: "Listings", href: "/portfolio/listings" },
|
|
20
|
-
{ key: "received", label: "Offers received", href: "/portfolio/received" },
|
|
21
|
-
{ key: "offers", label: "Offers sent", href: "/portfolio/offers" },
|
|
22
|
-
{ key: "counter", label: "Counter-offers", href: "/portfolio/counter-offers" },
|
|
23
|
-
{ key: "licensing", label: "Licensing", href: "/portfolio/licensing" },
|
|
24
|
-
{ key: "sponsorship", label: "Sponsorships", href: "/portfolio/sponsorships" },
|
|
20
|
+
{ key: "listings", label: "Listings", href: "/portfolio/listings", hideWhenEmpty: true },
|
|
21
|
+
{ key: "received", label: "Offers received", href: "/portfolio/received", hideWhenEmpty: true },
|
|
22
|
+
{ key: "offers", label: "Offers sent", href: "/portfolio/offers", hideWhenEmpty: true },
|
|
23
|
+
{ key: "counter", label: "Counter-offers", href: "/portfolio/counter-offers", hideWhenEmpty: true },
|
|
24
|
+
{ key: "licensing", label: "Licensing", href: "/portfolio/licensing", hideWhenEmpty: true },
|
|
25
|
+
{ key: "sponsorship", label: "Sponsorships", href: "/portfolio/sponsorships", hideWhenEmpty: true },
|
|
25
26
|
{ key: "activity", label: "Activity", href: "/portfolio/activity" }
|
|
26
27
|
];
|
|
27
28
|
function SignedOut() {
|
|
@@ -40,19 +41,28 @@ function Loading() {
|
|
|
40
41
|
/* @__PURE__ */ jsx(Skeleton, { className: "mx-auto h-4 w-72" })
|
|
41
42
|
] });
|
|
42
43
|
}
|
|
43
|
-
function PortfolioShell({ tabs = PORTFOLIO_TABS, remixOffers, children }) {
|
|
44
|
+
function PortfolioShell({ tabs = PORTFOLIO_TABS, remixOffers, licensing, children }) {
|
|
44
45
|
const { walletAddress: address, walletLoading } = useMedialaneApp();
|
|
45
46
|
const pathname = usePathname();
|
|
46
|
-
const { orders } = useUserOrders(address);
|
|
47
|
-
const { orders: receivedOffers } = useReceivedOffers(address);
|
|
47
|
+
const { orders, isLoading: ordersLoading } = useUserOrders(address);
|
|
48
|
+
const { orders: receivedOffers, isLoading: receivedLoading } = useReceivedOffers(address);
|
|
48
49
|
const { data: rewards } = useRewards(address);
|
|
49
|
-
const
|
|
50
|
+
const sponsorship = useMySponsorshipDealCounts(address);
|
|
50
51
|
useEffect(() => {
|
|
51
52
|
if (receivedOffers.length > 0) markOffersAsSeen(receivedOffers.map((o) => o.orderHash));
|
|
52
53
|
}, [receivedOffers]);
|
|
53
54
|
if (!address) return walletLoading ? /* @__PURE__ */ jsx(Loading, {}) : /* @__PURE__ */ jsx(SignedOut, {});
|
|
54
|
-
const counts = derivePortfolioCounts({ orders, receivedOffers, remixOffers, address, sponsorshipPendingCount: pendingCount });
|
|
55
|
+
const counts = derivePortfolioCounts({ orders, receivedOffers, remixOffers, address, sponsorshipPendingCount: sponsorship.pendingCount });
|
|
55
56
|
const countFor = { received: counts.received, counter: counts.counter, licensing: counts.remix, sponsorship: counts.sponsorships };
|
|
57
|
+
const present = {
|
|
58
|
+
listings: ordersLoading ? void 0 : counts.listings > 0,
|
|
59
|
+
offers: ordersLoading ? void 0 : counts.offers > 0,
|
|
60
|
+
counter: ordersLoading ? void 0 : counts.counter > 0,
|
|
61
|
+
received: receivedLoading ? void 0 : counts.received > 0,
|
|
62
|
+
licensing: licensing ? licensing.isLoading ? void 0 : licensing.present : true,
|
|
63
|
+
sponsorship: sponsorship.isLoading ? void 0 : sponsorship.hasAny
|
|
64
|
+
};
|
|
65
|
+
const shownTabs = visiblePortfolioTabs(tabs, present, pathname ?? "");
|
|
56
66
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-6 px-4 pt-20 pb-8 sm:px-6 lg:px-8", children: [
|
|
57
67
|
/* @__PURE__ */ jsx(
|
|
58
68
|
PortfolioHeader,
|
|
@@ -64,7 +74,7 @@ function PortfolioShell({ tabs = PORTFOLIO_TABS, remixOffers, children }) {
|
|
|
64
74
|
/* @__PURE__ */ jsx(
|
|
65
75
|
PortfolioChipFilter,
|
|
66
76
|
{
|
|
67
|
-
options:
|
|
77
|
+
options: shownTabs.map((t) => ({ key: t.key, href: t.href, label: countFor[t.key] ? `${t.label} (${countFor[t.key]})` : t.label })),
|
|
68
78
|
value: pathname ?? "",
|
|
69
79
|
onChange: () => {
|
|
70
80
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/portfolio-shell.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, type ReactNode } from \"react\";\nimport { Wallet } from \"lucide-react\";\nimport { usePathname } from \"./router.js\";\nimport { Button } from \"./button.js\";\nimport { Skeleton } from \"./skeleton.js\";\nimport { PortfolioHeader } from \"./portfolio-header.js\";\nimport { PortfolioChipFilter } from \"./portfolio-chip-filter.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\nimport { derivePortfolioCounts } from \"../utils/portfolio-counts.js\";\nimport { markOffersAsSeen } from \"../utils/seen-offers.js\";\nimport { useReceivedOffers, useUserOrders } from \"../utils/use-orders.js\";\nimport { useRewards } from \"../utils/use-rewards.js\";\nimport { useMySponsorshipDealCounts } from \"../utils/use-sponsorship.js\";\n\nexport interface PortfolioTab {\n key: string;\n label: string;\n href: string;\n}\n\nexport const PORTFOLIO_TABS: PortfolioTab[] = [\n { key: \"assets\", label: \"Assets\", href: \"/portfolio/assets\" },\n { key: \"collections\", label: \"Collections\", href: \"/portfolio/collections\" },\n { key: \"listings\", label: \"Listings\", href: \"/portfolio/listings\" },\n { key: \"received\", label: \"Offers received\", href: \"/portfolio/received\" },\n { key: \"offers\", label: \"Offers sent\", href: \"/portfolio/offers\" },\n { key: \"counter\", label: \"Counter-offers\", href: \"/portfolio/counter-offers\" },\n { key: \"licensing\", label: \"Licensing\", href: \"/portfolio/licensing\" },\n { key: \"sponsorship\", label: \"Sponsorships\", href: \"/portfolio/sponsorships\" },\n { key: \"activity\", label: \"Activity\", href: \"/portfolio/activity\" },\n];\n\nfunction SignedOut() {\n const { onRequireWallet, connectLabel } = useMedialaneApp();\n return (\n <div className=\"mx-auto max-w-lg space-y-4 px-4 pt-24 pb-8 text-center\">\n <Wallet className=\"mx-auto h-10 w-10 text-muted-foreground\" />\n <h1 className=\"text-2xl font-bold\">Your portfolio</h1>\n <p className=\"text-muted-foreground\">Sign in to see your assets, listings and offers.</p>\n <Button size=\"lg\" className=\"rounded-full px-7\" onClick={onRequireWallet}>\n {connectLabel ?? \"Sign in\"}\n </Button>\n </div>\n );\n}\n\nfunction Loading() {\n return (\n <div className=\"mx-auto max-w-lg space-y-4 px-4 pt-24 pb-8\">\n <Skeleton className=\"mx-auto h-10 w-10 rounded-full\" />\n <Skeleton className=\"mx-auto h-7 w-56\" />\n <Skeleton className=\"mx-auto h-4 w-72\" />\n </div>\n );\n}\n\nexport function PortfolioShell({ tabs = PORTFOLIO_TABS, remixOffers, children }: {\n tabs?: PortfolioTab[];\n remixOffers?: ReadonlyArray<{ status: string }>;\n children: ReactNode;\n}) {\n const { walletAddress: address, walletLoading } = useMedialaneApp();\n const pathname = usePathname();\n const { orders } = useUserOrders(address);\n const { orders: receivedOffers } = useReceivedOffers(address);\n const { data: rewards } = useRewards(address);\n const
|
|
1
|
+
{"version":3,"sources":["../../src/components/portfolio-shell.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, type ReactNode } from \"react\";\nimport { Wallet } from \"lucide-react\";\nimport { usePathname } from \"./router.js\";\nimport { Button } from \"./button.js\";\nimport { Skeleton } from \"./skeleton.js\";\nimport { PortfolioHeader } from \"./portfolio-header.js\";\nimport { PortfolioChipFilter } from \"./portfolio-chip-filter.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\nimport { derivePortfolioCounts } from \"../utils/portfolio-counts.js\";\nimport { visiblePortfolioTabs } from \"../utils/portfolio-tabs.js\";\nimport { markOffersAsSeen } from \"../utils/seen-offers.js\";\nimport { useReceivedOffers, useUserOrders } from \"../utils/use-orders.js\";\nimport { useRewards } from \"../utils/use-rewards.js\";\nimport { useMySponsorshipDealCounts } from \"../utils/use-sponsorship.js\";\n\nexport interface PortfolioTab {\n key: string;\n label: string;\n href: string;\n hideWhenEmpty?: boolean;\n}\n\nexport const PORTFOLIO_TABS: PortfolioTab[] = [\n { key: \"assets\", label: \"Assets\", href: \"/portfolio/assets\" },\n { key: \"collections\", label: \"Collections\", href: \"/portfolio/collections\" },\n { key: \"listings\", label: \"Listings\", href: \"/portfolio/listings\", hideWhenEmpty: true },\n { key: \"received\", label: \"Offers received\", href: \"/portfolio/received\", hideWhenEmpty: true },\n { key: \"offers\", label: \"Offers sent\", href: \"/portfolio/offers\", hideWhenEmpty: true },\n { key: \"counter\", label: \"Counter-offers\", href: \"/portfolio/counter-offers\", hideWhenEmpty: true },\n { key: \"licensing\", label: \"Licensing\", href: \"/portfolio/licensing\", hideWhenEmpty: true },\n { key: \"sponsorship\", label: \"Sponsorships\", href: \"/portfolio/sponsorships\", hideWhenEmpty: true },\n { key: \"activity\", label: \"Activity\", href: \"/portfolio/activity\" },\n];\n\nfunction SignedOut() {\n const { onRequireWallet, connectLabel } = useMedialaneApp();\n return (\n <div className=\"mx-auto max-w-lg space-y-4 px-4 pt-24 pb-8 text-center\">\n <Wallet className=\"mx-auto h-10 w-10 text-muted-foreground\" />\n <h1 className=\"text-2xl font-bold\">Your portfolio</h1>\n <p className=\"text-muted-foreground\">Sign in to see your assets, listings and offers.</p>\n <Button size=\"lg\" className=\"rounded-full px-7\" onClick={onRequireWallet}>\n {connectLabel ?? \"Sign in\"}\n </Button>\n </div>\n );\n}\n\nfunction Loading() {\n return (\n <div className=\"mx-auto max-w-lg space-y-4 px-4 pt-24 pb-8\">\n <Skeleton className=\"mx-auto h-10 w-10 rounded-full\" />\n <Skeleton className=\"mx-auto h-7 w-56\" />\n <Skeleton className=\"mx-auto h-4 w-72\" />\n </div>\n );\n}\n\nexport function PortfolioShell({ tabs = PORTFOLIO_TABS, remixOffers, licensing, children }: {\n tabs?: PortfolioTab[];\n remixOffers?: ReadonlyArray<{ status: string }>;\n licensing?: { present: boolean; isLoading: boolean };\n children: ReactNode;\n}) {\n const { walletAddress: address, walletLoading } = useMedialaneApp();\n const pathname = usePathname();\n const { orders, isLoading: ordersLoading } = useUserOrders(address);\n const { orders: receivedOffers, isLoading: receivedLoading } = useReceivedOffers(address);\n const { data: rewards } = useRewards(address);\n const sponsorship = useMySponsorshipDealCounts(address);\n\n useEffect(() => {\n if (receivedOffers.length > 0) markOffersAsSeen(receivedOffers.map((o) => o.orderHash));\n }, [receivedOffers]);\n\n if (!address) return walletLoading ? <Loading /> : <SignedOut />;\n\n const counts = derivePortfolioCounts({ orders, receivedOffers, remixOffers, address, sponsorshipPendingCount: sponsorship.pendingCount });\n const countFor: Record<string, number> = { received: counts.received, counter: counts.counter, licensing: counts.remix, sponsorship: counts.sponsorships };\n const present: Record<string, boolean | undefined> = {\n listings: ordersLoading ? undefined : counts.listings > 0,\n offers: ordersLoading ? undefined : counts.offers > 0,\n counter: ordersLoading ? undefined : counts.counter > 0,\n received: receivedLoading ? undefined : counts.received > 0,\n licensing: licensing ? (licensing.isLoading ? undefined : licensing.present) : true,\n sponsorship: sponsorship.isLoading ? undefined : sponsorship.hasAny,\n };\n const shownTabs = visiblePortfolioTabs(tabs, present, pathname ?? \"\");\n\n return (\n <div className=\"space-y-6 px-4 pt-20 pb-8 sm:px-6 lg:px-8\">\n <PortfolioHeader\n address={address}\n score={rewards ? { levelName: rewards.currentLevelName, totalXp: rewards.totalXp, href: \"/rewards\" } : null}\n />\n <PortfolioChipFilter\n options={shownTabs.map((t) => ({ key: t.key, href: t.href, label: countFor[t.key] ? `${t.label} (${countFor[t.key]})` : t.label }))}\n value={pathname ?? \"\"}\n onChange={() => {}}\n showAll={false}\n />\n {children}\n </div>\n );\n}\n"],"mappings":";AAuCI,SACE,KADF;AArCJ,SAAS,iBAAiC;AAC1C,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAChC,SAAS,2BAA2B;AACpC,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,4BAA4B;AACrC,SAAS,wBAAwB;AACjC,SAAS,mBAAmB,qBAAqB;AACjD,SAAS,kBAAkB;AAC3B,SAAS,kCAAkC;AASpC,MAAM,iBAAiC;AAAA,EAC5C,EAAE,KAAK,UAAU,OAAO,UAAU,MAAM,oBAAoB;AAAA,EAC5D,EAAE,KAAK,eAAe,OAAO,eAAe,MAAM,yBAAyB;AAAA,EAC3E,EAAE,KAAK,YAAY,OAAO,YAAY,MAAM,uBAAuB,eAAe,KAAK;AAAA,EACvF,EAAE,KAAK,YAAY,OAAO,mBAAmB,MAAM,uBAAuB,eAAe,KAAK;AAAA,EAC9F,EAAE,KAAK,UAAU,OAAO,eAAe,MAAM,qBAAqB,eAAe,KAAK;AAAA,EACtF,EAAE,KAAK,WAAW,OAAO,kBAAkB,MAAM,6BAA6B,eAAe,KAAK;AAAA,EAClG,EAAE,KAAK,aAAa,OAAO,aAAa,MAAM,wBAAwB,eAAe,KAAK;AAAA,EAC1F,EAAE,KAAK,eAAe,OAAO,gBAAgB,MAAM,2BAA2B,eAAe,KAAK;AAAA,EAClG,EAAE,KAAK,YAAY,OAAO,YAAY,MAAM,sBAAsB;AACpE;AAEA,SAAS,YAAY;AACnB,QAAM,EAAE,iBAAiB,aAAa,IAAI,gBAAgB;AAC1D,SACE,qBAAC,SAAI,WAAU,0DACb;AAAA,wBAAC,UAAO,WAAU,2CAA0C;AAAA,IAC5D,oBAAC,QAAG,WAAU,sBAAqB,4BAAc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,IACtD,UAAU,kBAAkB,SAAY,OAAO,WAAW;AAAA,IAC1D,WAAW,YAAa,UAAU,YAAY,SAAY,UAAU,UAAW;AAAA,IAC/E,aAAa,YAAY,YAAY,SAAY,YAAY;AAAA,EAC/D;AACA,QAAM,YAAY,qBAAqB,MAAM,SAAS,YAAY,EAAE;AAEpE,SACE,qBAAC,SAAI,WAAU,6CACb;AAAA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,OAAO,UAAU,EAAE,WAAW,QAAQ,kBAAkB,SAAS,QAAQ,SAAS,MAAM,WAAW,IAAI;AAAA;AAAA,IACzG;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,SAAS,UAAU,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,MAAM,EAAE,MAAM,OAAO,SAAS,EAAE,GAAG,IAAI,GAAG,EAAE,KAAK,KAAK,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE;AAAA,QAClI,OAAO,YAAY;AAAA,QACnB,UAAU,MAAM;AAAA,QAAC;AAAA,QACjB,SAAS;AAAA;AAAA,IACX;AAAA,IACC;AAAA,KACH;AAEJ;","names":[]}
|
|
@@ -10,7 +10,7 @@ declare const SheetClose: React.ForwardRefExoticComponent<SheetPrimitive.DialogC
|
|
|
10
10
|
declare const SheetPortal: React.FC<SheetPrimitive.DialogPortalProps>;
|
|
11
11
|
declare const SheetOverlay: React.ForwardRefExoticComponent<Omit<SheetPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
12
|
declare const sheetVariants: (props?: ({
|
|
13
|
-
side?: "
|
|
13
|
+
side?: "left" | "right" | "bottom" | "top" | null | undefined;
|
|
14
14
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
15
15
|
interface SheetContentProps extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>, VariantProps<typeof sheetVariants> {
|
|
16
16
|
overlayClassName?: string;
|
|
@@ -10,7 +10,7 @@ declare const SheetClose: React.ForwardRefExoticComponent<SheetPrimitive.DialogC
|
|
|
10
10
|
declare const SheetPortal: React.FC<SheetPrimitive.DialogPortalProps>;
|
|
11
11
|
declare const SheetOverlay: React.ForwardRefExoticComponent<Omit<SheetPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
12
|
declare const sheetVariants: (props?: ({
|
|
13
|
-
side?: "
|
|
13
|
+
side?: "left" | "right" | "bottom" | "top" | null | undefined;
|
|
14
14
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
15
15
|
interface SheetContentProps extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>, VariantProps<typeof sheetVariants> {
|
|
16
16
|
overlayClassName?: string;
|
|
@@ -44,13 +44,14 @@ function derivePortfolioCounts({
|
|
|
44
44
|
const listings = list.filter(
|
|
45
45
|
(o) => (o.offer.itemType === "ERC721" || o.offer.itemType === "ERC1155") && o.status === "ACTIVE"
|
|
46
46
|
).length;
|
|
47
|
+
const offers = list.filter((o) => o.offer.itemType === "ERC20" && o.status === "ACTIVE").length;
|
|
47
48
|
const remix = Array.isArray(remixOffers) ? remixOffers.filter(
|
|
48
49
|
(o) => o.status === "PENDING" || o.status === "AUTO_PENDING"
|
|
49
50
|
).length : 0;
|
|
50
51
|
const counter = list.filter(
|
|
51
52
|
(o) => o.offer.itemType === "ERC20" && addr !== null && safeNormalize(o.offerer) === addr && o.hasActiveCounterOffer === true
|
|
52
53
|
).length;
|
|
53
|
-
return { received, listings, remix, counter, sponsorships: Math.max(0, sponsorshipPendingCount) };
|
|
54
|
+
return { received, listings, offers, remix, counter, sponsorships: Math.max(0, sponsorshipPendingCount) };
|
|
54
55
|
}
|
|
55
56
|
// Annotate the CommonJS export names for ESM import in node:
|
|
56
57
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/portfolio-counts.ts"],"sourcesContent":["import { normalizeAddress } from \"@medialane/sdk\";\n\nexport interface CountableOrder {\n status: string;\n offerer: string;\n offer: { itemType: string };\n hasActiveCounterOffer?: boolean;\n}\n\nexport interface PortfolioCounts {\n\n received: number;\n\n listings: number;\n\n remix: number;\n\n counter: number;\n\n sponsorships: number;\n}\n\nfunction safeNormalize(address: string): string | null {\n try {\n return normalizeAddress(\"STARKNET\", address);\n } catch {\n return null;\n }\n}\n\nexport function derivePortfolioCounts({\n orders,\n receivedOffers,\n remixOffers,\n address,\n sponsorshipPendingCount = 0,\n}: {\n orders: ReadonlyArray<CountableOrder> | null | undefined;\n receivedOffers: ReadonlyArray<CountableOrder> | null | undefined;\n remixOffers: ReadonlyArray<{ status: string }> | null | undefined;\n address: string | null | undefined;\n sponsorshipPendingCount?: number;\n}): PortfolioCounts {\n const list = Array.isArray(orders) ? orders : [];\n const addr = address ? safeNormalize(address) : null;\n\n const received = (Array.isArray(receivedOffers) ? receivedOffers : []).filter(\n (o) =>\n o.status === \"ACTIVE\" &&\n o.offer.itemType === \"ERC20\" &&\n safeNormalize(o.offerer) !== addr,\n ).length;\n\n const listings = list.filter(\n (o) =>\n (o.offer.itemType === \"ERC721\" || o.offer.itemType === \"ERC1155\") &&\n o.status === \"ACTIVE\",\n ).length;\n\n const remix = Array.isArray(remixOffers)\n ? remixOffers.filter(\n (o) => o.status === \"PENDING\" || o.status === \"AUTO_PENDING\",\n ).length\n : 0;\n\n const counter = list.filter(\n (o) =>\n o.offer.itemType === \"ERC20\" &&\n addr !== null &&\n safeNormalize(o.offerer) === addr &&\n o.hasActiveCounterOffer === true,\n ).length;\n\n return { received, listings, remix, counter, sponsorships: Math.max(0, sponsorshipPendingCount) };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAiC;
|
|
1
|
+
{"version":3,"sources":["../../src/utils/portfolio-counts.ts"],"sourcesContent":["import { normalizeAddress } from \"@medialane/sdk\";\n\nexport interface CountableOrder {\n status: string;\n offerer: string;\n offer: { itemType: string };\n hasActiveCounterOffer?: boolean;\n}\n\nexport interface PortfolioCounts {\n\n received: number;\n\n listings: number;\n\n offers: number;\n\n remix: number;\n\n counter: number;\n\n sponsorships: number;\n}\n\nfunction safeNormalize(address: string): string | null {\n try {\n return normalizeAddress(\"STARKNET\", address);\n } catch {\n return null;\n }\n}\n\nexport function derivePortfolioCounts({\n orders,\n receivedOffers,\n remixOffers,\n address,\n sponsorshipPendingCount = 0,\n}: {\n orders: ReadonlyArray<CountableOrder> | null | undefined;\n receivedOffers: ReadonlyArray<CountableOrder> | null | undefined;\n remixOffers: ReadonlyArray<{ status: string }> | null | undefined;\n address: string | null | undefined;\n sponsorshipPendingCount?: number;\n}): PortfolioCounts {\n const list = Array.isArray(orders) ? orders : [];\n const addr = address ? safeNormalize(address) : null;\n\n const received = (Array.isArray(receivedOffers) ? receivedOffers : []).filter(\n (o) =>\n o.status === \"ACTIVE\" &&\n o.offer.itemType === \"ERC20\" &&\n safeNormalize(o.offerer) !== addr,\n ).length;\n\n const listings = list.filter(\n (o) =>\n (o.offer.itemType === \"ERC721\" || o.offer.itemType === \"ERC1155\") &&\n o.status === \"ACTIVE\",\n ).length;\n\n const offers = list.filter((o) => o.offer.itemType === \"ERC20\" && o.status === \"ACTIVE\").length;\n\n const remix = Array.isArray(remixOffers)\n ? remixOffers.filter(\n (o) => o.status === \"PENDING\" || o.status === \"AUTO_PENDING\",\n ).length\n : 0;\n\n const counter = list.filter(\n (o) =>\n o.offer.itemType === \"ERC20\" &&\n addr !== null &&\n safeNormalize(o.offerer) === addr &&\n o.hasActiveCounterOffer === true,\n ).length;\n\n return { received, listings, offers, remix, counter, sponsorships: Math.max(0, sponsorshipPendingCount) };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAiC;AAwBjC,SAAS,cAAc,SAAgC;AACrD,MAAI;AACF,eAAO,6BAAiB,YAAY,OAAO;AAAA,EAC7C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,SAAS,sBAAsB;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,0BAA0B;AAC5B,GAMoB;AAClB,QAAM,OAAO,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC;AAC/C,QAAM,OAAO,UAAU,cAAc,OAAO,IAAI;AAEhD,QAAM,YAAY,MAAM,QAAQ,cAAc,IAAI,iBAAiB,CAAC,GAAG;AAAA,IACrE,CAAC,MACC,EAAE,WAAW,YACb,EAAE,MAAM,aAAa,WACrB,cAAc,EAAE,OAAO,MAAM;AAAA,EACjC,EAAE;AAEF,QAAM,WAAW,KAAK;AAAA,IACpB,CAAC,OACE,EAAE,MAAM,aAAa,YAAY,EAAE,MAAM,aAAa,cACvD,EAAE,WAAW;AAAA,EACjB,EAAE;AAEF,QAAM,SAAS,KAAK,OAAO,CAAC,MAAM,EAAE,MAAM,aAAa,WAAW,EAAE,WAAW,QAAQ,EAAE;AAEzF,QAAM,QAAQ,MAAM,QAAQ,WAAW,IACnC,YAAY;AAAA,IACV,CAAC,MAAM,EAAE,WAAW,aAAa,EAAE,WAAW;AAAA,EAChD,EAAE,SACF;AAEJ,QAAM,UAAU,KAAK;AAAA,IACnB,CAAC,MACC,EAAE,MAAM,aAAa,WACrB,SAAS,QACT,cAAc,EAAE,OAAO,MAAM,QAC7B,EAAE,0BAA0B;AAAA,EAChC,EAAE;AAEF,SAAO,EAAE,UAAU,UAAU,QAAQ,OAAO,SAAS,cAAc,KAAK,IAAI,GAAG,uBAAuB,EAAE;AAC1G;","names":[]}
|
|
@@ -21,13 +21,14 @@ function derivePortfolioCounts({
|
|
|
21
21
|
const listings = list.filter(
|
|
22
22
|
(o) => (o.offer.itemType === "ERC721" || o.offer.itemType === "ERC1155") && o.status === "ACTIVE"
|
|
23
23
|
).length;
|
|
24
|
+
const offers = list.filter((o) => o.offer.itemType === "ERC20" && o.status === "ACTIVE").length;
|
|
24
25
|
const remix = Array.isArray(remixOffers) ? remixOffers.filter(
|
|
25
26
|
(o) => o.status === "PENDING" || o.status === "AUTO_PENDING"
|
|
26
27
|
).length : 0;
|
|
27
28
|
const counter = list.filter(
|
|
28
29
|
(o) => o.offer.itemType === "ERC20" && addr !== null && safeNormalize(o.offerer) === addr && o.hasActiveCounterOffer === true
|
|
29
30
|
).length;
|
|
30
|
-
return { received, listings, remix, counter, sponsorships: Math.max(0, sponsorshipPendingCount) };
|
|
31
|
+
return { received, listings, offers, remix, counter, sponsorships: Math.max(0, sponsorshipPendingCount) };
|
|
31
32
|
}
|
|
32
33
|
export {
|
|
33
34
|
derivePortfolioCounts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/portfolio-counts.ts"],"sourcesContent":["import { normalizeAddress } from \"@medialane/sdk\";\n\nexport interface CountableOrder {\n status: string;\n offerer: string;\n offer: { itemType: string };\n hasActiveCounterOffer?: boolean;\n}\n\nexport interface PortfolioCounts {\n\n received: number;\n\n listings: number;\n\n remix: number;\n\n counter: number;\n\n sponsorships: number;\n}\n\nfunction safeNormalize(address: string): string | null {\n try {\n return normalizeAddress(\"STARKNET\", address);\n } catch {\n return null;\n }\n}\n\nexport function derivePortfolioCounts({\n orders,\n receivedOffers,\n remixOffers,\n address,\n sponsorshipPendingCount = 0,\n}: {\n orders: ReadonlyArray<CountableOrder> | null | undefined;\n receivedOffers: ReadonlyArray<CountableOrder> | null | undefined;\n remixOffers: ReadonlyArray<{ status: string }> | null | undefined;\n address: string | null | undefined;\n sponsorshipPendingCount?: number;\n}): PortfolioCounts {\n const list = Array.isArray(orders) ? orders : [];\n const addr = address ? safeNormalize(address) : null;\n\n const received = (Array.isArray(receivedOffers) ? receivedOffers : []).filter(\n (o) =>\n o.status === \"ACTIVE\" &&\n o.offer.itemType === \"ERC20\" &&\n safeNormalize(o.offerer) !== addr,\n ).length;\n\n const listings = list.filter(\n (o) =>\n (o.offer.itemType === \"ERC721\" || o.offer.itemType === \"ERC1155\") &&\n o.status === \"ACTIVE\",\n ).length;\n\n const remix = Array.isArray(remixOffers)\n ? remixOffers.filter(\n (o) => o.status === \"PENDING\" || o.status === \"AUTO_PENDING\",\n ).length\n : 0;\n\n const counter = list.filter(\n (o) =>\n o.offer.itemType === \"ERC20\" &&\n addr !== null &&\n safeNormalize(o.offerer) === addr &&\n o.hasActiveCounterOffer === true,\n ).length;\n\n return { received, listings, remix, counter, sponsorships: Math.max(0, sponsorshipPendingCount) };\n}\n"],"mappings":"AAAA,SAAS,wBAAwB;
|
|
1
|
+
{"version":3,"sources":["../../src/utils/portfolio-counts.ts"],"sourcesContent":["import { normalizeAddress } from \"@medialane/sdk\";\n\nexport interface CountableOrder {\n status: string;\n offerer: string;\n offer: { itemType: string };\n hasActiveCounterOffer?: boolean;\n}\n\nexport interface PortfolioCounts {\n\n received: number;\n\n listings: number;\n\n offers: number;\n\n remix: number;\n\n counter: number;\n\n sponsorships: number;\n}\n\nfunction safeNormalize(address: string): string | null {\n try {\n return normalizeAddress(\"STARKNET\", address);\n } catch {\n return null;\n }\n}\n\nexport function derivePortfolioCounts({\n orders,\n receivedOffers,\n remixOffers,\n address,\n sponsorshipPendingCount = 0,\n}: {\n orders: ReadonlyArray<CountableOrder> | null | undefined;\n receivedOffers: ReadonlyArray<CountableOrder> | null | undefined;\n remixOffers: ReadonlyArray<{ status: string }> | null | undefined;\n address: string | null | undefined;\n sponsorshipPendingCount?: number;\n}): PortfolioCounts {\n const list = Array.isArray(orders) ? orders : [];\n const addr = address ? safeNormalize(address) : null;\n\n const received = (Array.isArray(receivedOffers) ? receivedOffers : []).filter(\n (o) =>\n o.status === \"ACTIVE\" &&\n o.offer.itemType === \"ERC20\" &&\n safeNormalize(o.offerer) !== addr,\n ).length;\n\n const listings = list.filter(\n (o) =>\n (o.offer.itemType === \"ERC721\" || o.offer.itemType === \"ERC1155\") &&\n o.status === \"ACTIVE\",\n ).length;\n\n const offers = list.filter((o) => o.offer.itemType === \"ERC20\" && o.status === \"ACTIVE\").length;\n\n const remix = Array.isArray(remixOffers)\n ? remixOffers.filter(\n (o) => o.status === \"PENDING\" || o.status === \"AUTO_PENDING\",\n ).length\n : 0;\n\n const counter = list.filter(\n (o) =>\n o.offer.itemType === \"ERC20\" &&\n addr !== null &&\n safeNormalize(o.offerer) === addr &&\n o.hasActiveCounterOffer === true,\n ).length;\n\n return { received, listings, offers, remix, counter, sponsorships: Math.max(0, sponsorshipPendingCount) };\n}\n"],"mappings":"AAAA,SAAS,wBAAwB;AAwBjC,SAAS,cAAc,SAAgC;AACrD,MAAI;AACF,WAAO,iBAAiB,YAAY,OAAO;AAAA,EAC7C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,SAAS,sBAAsB;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,0BAA0B;AAC5B,GAMoB;AAClB,QAAM,OAAO,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC;AAC/C,QAAM,OAAO,UAAU,cAAc,OAAO,IAAI;AAEhD,QAAM,YAAY,MAAM,QAAQ,cAAc,IAAI,iBAAiB,CAAC,GAAG;AAAA,IACrE,CAAC,MACC,EAAE,WAAW,YACb,EAAE,MAAM,aAAa,WACrB,cAAc,EAAE,OAAO,MAAM;AAAA,EACjC,EAAE;AAEF,QAAM,WAAW,KAAK;AAAA,IACpB,CAAC,OACE,EAAE,MAAM,aAAa,YAAY,EAAE,MAAM,aAAa,cACvD,EAAE,WAAW;AAAA,EACjB,EAAE;AAEF,QAAM,SAAS,KAAK,OAAO,CAAC,MAAM,EAAE,MAAM,aAAa,WAAW,EAAE,WAAW,QAAQ,EAAE;AAEzF,QAAM,QAAQ,MAAM,QAAQ,WAAW,IACnC,YAAY;AAAA,IACV,CAAC,MAAM,EAAE,WAAW,aAAa,EAAE,WAAW;AAAA,EAChD,EAAE,SACF;AAEJ,QAAM,UAAU,KAAK;AAAA,IACnB,CAAC,MACC,EAAE,MAAM,aAAa,WACrB,SAAS,QACT,cAAc,EAAE,OAAO,MAAM,QAC7B,EAAE,0BAA0B;AAAA,EAChC,EAAE;AAEF,SAAO,EAAE,UAAU,UAAU,QAAQ,OAAO,SAAS,cAAc,KAAK,IAAI,GAAG,uBAAuB,EAAE;AAC1G;","names":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var portfolio_tabs_exports = {};
|
|
20
|
+
__export(portfolio_tabs_exports, {
|
|
21
|
+
visiblePortfolioTabs: () => visiblePortfolioTabs
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(portfolio_tabs_exports);
|
|
24
|
+
function visiblePortfolioTabs(tabs, present, pathname) {
|
|
25
|
+
return tabs.filter(
|
|
26
|
+
(tab) => !tab.hideWhenEmpty || present[tab.key] === true || pathname === tab.href || pathname.startsWith(`${tab.href}/`)
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
visiblePortfolioTabs
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=portfolio-tabs.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/portfolio-tabs.ts"],"sourcesContent":["export interface TabWithPresence {\n key: string;\n href: string;\n hideWhenEmpty?: boolean;\n}\n\nexport function visiblePortfolioTabs<T extends TabWithPresence>(\n tabs: ReadonlyArray<T>,\n present: Readonly<Record<string, boolean | undefined>>,\n pathname: string,\n): T[] {\n return tabs.filter(\n (tab) =>\n !tab.hideWhenEmpty ||\n present[tab.key] === true ||\n pathname === tab.href ||\n pathname.startsWith(`${tab.href}/`),\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,SAAS,qBACd,MACA,SACA,UACK;AACL,SAAO,KAAK;AAAA,IACV,CAAC,QACC,CAAC,IAAI,iBACL,QAAQ,IAAI,GAAG,MAAM,QACrB,aAAa,IAAI,QACjB,SAAS,WAAW,GAAG,IAAI,IAAI,GAAG;AAAA,EACtC;AACF;","names":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface TabWithPresence {
|
|
2
|
+
key: string;
|
|
3
|
+
href: string;
|
|
4
|
+
hideWhenEmpty?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare function visiblePortfolioTabs<T extends TabWithPresence>(tabs: ReadonlyArray<T>, present: Readonly<Record<string, boolean | undefined>>, pathname: string): T[];
|
|
7
|
+
|
|
8
|
+
export { type TabWithPresence, visiblePortfolioTabs };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface TabWithPresence {
|
|
2
|
+
key: string;
|
|
3
|
+
href: string;
|
|
4
|
+
hideWhenEmpty?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare function visiblePortfolioTabs<T extends TabWithPresence>(tabs: ReadonlyArray<T>, present: Readonly<Record<string, boolean | undefined>>, pathname: string): T[];
|
|
7
|
+
|
|
8
|
+
export { type TabWithPresence, visiblePortfolioTabs };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
function visiblePortfolioTabs(tabs, present, pathname) {
|
|
2
|
+
return tabs.filter(
|
|
3
|
+
(tab) => !tab.hideWhenEmpty || present[tab.key] === true || pathname === tab.href || pathname.startsWith(`${tab.href}/`)
|
|
4
|
+
);
|
|
5
|
+
}
|
|
6
|
+
export {
|
|
7
|
+
visiblePortfolioTabs
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=portfolio-tabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/portfolio-tabs.ts"],"sourcesContent":["export interface TabWithPresence {\n key: string;\n href: string;\n hideWhenEmpty?: boolean;\n}\n\nexport function visiblePortfolioTabs<T extends TabWithPresence>(\n tabs: ReadonlyArray<T>,\n present: Readonly<Record<string, boolean | undefined>>,\n pathname: string,\n): T[] {\n return tabs.filter(\n (tab) =>\n !tab.hideWhenEmpty ||\n present[tab.key] === true ||\n pathname === tab.href ||\n pathname.startsWith(`${tab.href}/`),\n );\n}\n"],"mappings":"AAMO,SAAS,qBACd,MACA,SACA,UACK;AACL,SAAO,KAAK;AAAA,IACV,CAAC,QACC,CAAC,IAAI,iBACL,QAAQ,IAAI,GAAG,MAAM,QACrB,aAAa,IAAI,QACjB,SAAS,WAAW,GAAG,IAAI,IAAI,GAAG;AAAA,EACtC;AACF;","names":[]}
|
|
@@ -105,14 +105,16 @@ function useSponsorshipLicenses(params) {
|
|
|
105
105
|
return { licenses: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };
|
|
106
106
|
}
|
|
107
107
|
function useMySponsorshipDealCounts(walletAddress) {
|
|
108
|
-
const {
|
|
109
|
-
|
|
110
|
-
);
|
|
111
|
-
const {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
108
|
+
const owner = useSponsorshipProposals(walletAddress ? { owner: walletAddress, open: true } : void 0);
|
|
109
|
+
const sent = useSponsorshipProposals(walletAddress ? { proposer: walletAddress, open: true } : void 0);
|
|
110
|
+
const offers = useSponsorshipOffers(walletAddress ? { author: walletAddress, open: true } : void 0);
|
|
111
|
+
const held = useSponsorshipLicenses(walletAddress ? { holder: walletAddress } : void 0);
|
|
112
|
+
const issued = useSponsorshipLicenses(walletAddress ? { author: walletAddress } : void 0);
|
|
113
|
+
return {
|
|
114
|
+
pendingCount: owner.proposals.length,
|
|
115
|
+
hasAny: owner.proposals.length + sent.proposals.length + offers.offers.length + held.licenses.length + issued.licenses.length > 0,
|
|
116
|
+
isLoading: owner.isLoading || sent.isLoading || offers.isLoading || held.isLoading || issued.isLoading
|
|
117
|
+
};
|
|
116
118
|
}
|
|
117
119
|
// Annotate the CommonJS export names for ESM import in node:
|
|
118
120
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/use-sponsorship.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiSponsorshipOffer, ApiSponsorshipBid, ApiSponsorshipProposal, ApiSponsorshipLicense, ApiResponse } from \"@medialane/sdk\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\n\nexport type {\n ApiSponsorshipOffer as SponsorshipOffer,\n ApiSponsorshipBid as SponsorshipBid,\n ApiSponsorshipProposal as SponsorshipProposal,\n ApiSponsorshipLicense as SponsorshipLicense,\n} from \"@medialane/sdk\";\n\nexport function useSponsorshipOffers( params?: { nftContract?: string; author?: string; owner?: string; open?: boolean }) {\n const key = `sponsorship-offers-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipOffer[]>>(\n key,\n () => client.api.getSponsorshipOffers({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { offers: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useSponsorshipOffer( offerId: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipOffer | null>(\n offerId ? `sponsorship-offer-${offerId}` : null,\n () => client.api.getSponsorshipOffer(offerId!),\n { revalidateOnFocus: false }\n );\n\n return { offer: data ?? null, isLoading, error, mutate };\n}\n\nexport function useSponsorshipBids( offerId: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipBid[]>(\n offerId ? `sponsorship-bids-${offerId}` : null,\n () => client.api.getSponsorshipBids(offerId!),\n { revalidateOnFocus: false }\n );\n\n return { bids: data ?? [], isLoading, error, mutate };\n}\n\nexport function useSponsorshipProposals( params?: { nftContract?: string; proposer?: string; owner?: string; open?: boolean }) {\n const key = `sponsorship-proposals-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipProposal[]>>(\n key,\n () => client.api.getSponsorshipProposals({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { proposals: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useSponsorshipProposal( proposalId: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipProposal | null>(\n proposalId ? `sponsorship-proposal-${proposalId}` : null,\n () => client.api.getSponsorshipProposal(proposalId!),\n { revalidateOnFocus: false }\n );\n\n return { proposal: data ?? null, isLoading, error, mutate };\n}\n\nexport function usePendingProposalsForAsset( nftContract: string | null) {\n const { proposals, isLoading, error, mutate } = useSponsorshipProposals(\n nftContract ? { nftContract, open: true } : undefined\n );\n return { proposals: nftContract ? proposals : [], isLoading, error, mutate };\n}\n\nexport function useSponsorshipLicenses( params?: { holder?: string; author?: string }) {\n const key = `sponsorship-licenses-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipLicense[]>>(\n key,\n () => client.api.getSponsorshipLicenses({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { licenses: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useMySponsorshipDealCounts( walletAddress: string | null) {\n const {
|
|
1
|
+
{"version":3,"sources":["../../src/utils/use-sponsorship.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiSponsorshipOffer, ApiSponsorshipBid, ApiSponsorshipProposal, ApiSponsorshipLicense, ApiResponse } from \"@medialane/sdk\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\n\nexport type {\n ApiSponsorshipOffer as SponsorshipOffer,\n ApiSponsorshipBid as SponsorshipBid,\n ApiSponsorshipProposal as SponsorshipProposal,\n ApiSponsorshipLicense as SponsorshipLicense,\n} from \"@medialane/sdk\";\n\nexport function useSponsorshipOffers( params?: { nftContract?: string; author?: string; owner?: string; open?: boolean }) {\n const key = `sponsorship-offers-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipOffer[]>>(\n key,\n () => client.api.getSponsorshipOffers({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { offers: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useSponsorshipOffer( offerId: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipOffer | null>(\n offerId ? `sponsorship-offer-${offerId}` : null,\n () => client.api.getSponsorshipOffer(offerId!),\n { revalidateOnFocus: false }\n );\n\n return { offer: data ?? null, isLoading, error, mutate };\n}\n\nexport function useSponsorshipBids( offerId: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipBid[]>(\n offerId ? `sponsorship-bids-${offerId}` : null,\n () => client.api.getSponsorshipBids(offerId!),\n { revalidateOnFocus: false }\n );\n\n return { bids: data ?? [], isLoading, error, mutate };\n}\n\nexport function useSponsorshipProposals( params?: { nftContract?: string; proposer?: string; owner?: string; open?: boolean }) {\n const key = `sponsorship-proposals-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipProposal[]>>(\n key,\n () => client.api.getSponsorshipProposals({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { proposals: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useSponsorshipProposal( proposalId: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipProposal | null>(\n proposalId ? `sponsorship-proposal-${proposalId}` : null,\n () => client.api.getSponsorshipProposal(proposalId!),\n { revalidateOnFocus: false }\n );\n\n return { proposal: data ?? null, isLoading, error, mutate };\n}\n\nexport function usePendingProposalsForAsset( nftContract: string | null) {\n const { proposals, isLoading, error, mutate } = useSponsorshipProposals(\n nftContract ? { nftContract, open: true } : undefined\n );\n return { proposals: nftContract ? proposals : [], isLoading, error, mutate };\n}\n\nexport function useSponsorshipLicenses( params?: { holder?: string; author?: string }) {\n const key = `sponsorship-licenses-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipLicense[]>>(\n key,\n () => client.api.getSponsorshipLicenses({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { licenses: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useMySponsorshipDealCounts( walletAddress: string | null) {\n const owner = useSponsorshipProposals(walletAddress ? { owner: walletAddress, open: true } : undefined);\n const sent = useSponsorshipProposals(walletAddress ? { proposer: walletAddress, open: true } : undefined);\n const offers = useSponsorshipOffers(walletAddress ? { author: walletAddress, open: true } : undefined);\n const held = useSponsorshipLicenses(walletAddress ? { holder: walletAddress } : undefined);\n const issued = useSponsorshipLicenses(walletAddress ? { author: walletAddress } : undefined);\n\n return {\n pendingCount: owner.proposals.length,\n hasAny:\n owner.proposals.length + sent.proposals.length + offers.offers.length + held.licenses.length + issued.licenses.length > 0,\n isLoading: owner.isLoading || sent.isLoading || offers.isLoading || held.isLoading || issued.isLoading,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AAEnB,kCAAmC;AAS5B,SAAS,qBAAsB,QAAoF;AACxH,QAAM,MAAM,sBAAsB,KAAK,UAAU,UAAU,CAAC,CAAC,CAAC;AAC9D,QAAM,aAAS,gDAAmB;AAClC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,QAAI,WAAAA;AAAA,IACzC;AAAA,IACA,MAAM,OAAO,IAAI,qBAAqB,EAAE,GAAG,QAAQ,OAAO,GAAG,CAAC;AAAA,IAC9D,EAAE,mBAAmB,MAAM;AAAA,EAC7B;AAEA,SAAO,EAAE,QAAQ,MAAM,QAAQ,CAAC,GAAG,MAAM,MAAM,MAAM,WAAW,OAAO,OAAO;AAChF;AAEO,SAAS,oBAAqB,SAAwB;AAC3D,QAAM,aAAS,gDAAmB;AAClC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,QAAI,WAAAA;AAAA,IACzC,UAAU,qBAAqB,OAAO,KAAK;AAAA,IAC3C,MAAM,OAAO,IAAI,oBAAoB,OAAQ;AAAA,IAC7C,EAAE,mBAAmB,MAAM;AAAA,EAC7B;AAEA,SAAO,EAAE,OAAO,QAAQ,MAAM,WAAW,OAAO,OAAO;AACzD;AAEO,SAAS,mBAAoB,SAAwB;AAC1D,QAAM,aAAS,gDAAmB;AAClC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,QAAI,WAAAA;AAAA,IACzC,UAAU,oBAAoB,OAAO,KAAK;AAAA,IAC1C,MAAM,OAAO,IAAI,mBAAmB,OAAQ;AAAA,IAC5C,EAAE,mBAAmB,MAAM;AAAA,EAC7B;AAEA,SAAO,EAAE,MAAM,QA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B,MAAM;AAAA,EAC7B;AAEA,SAAO,EAAE,UAAU,MAAM,QAAQ,CAAC,GAAG,MAAM,MAAM,MAAM,WAAW,OAAO,OAAO;AAClF;AAEO,SAAS,2BAA4B,eAA8B;AACxE,QAAM,QAAQ,wBAAwB,gBAAgB,EAAE,OAAO,eAAe,MAAM,KAAK,IAAI,MAAS;AACtG,QAAM,OAAO,wBAAwB,gBAAgB,EAAE,UAAU,eAAe,MAAM,KAAK,IAAI,MAAS;AACxG,QAAM,SAAS,qBAAqB,gBAAgB,EAAE,QAAQ,eAAe,MAAM,KAAK,IAAI,MAAS;AACrG,QAAM,OAAO,uBAAuB,gBAAgB,EAAE,QAAQ,cAAc,IAAI,MAAS;AACzF,QAAM,SAAS,uBAAuB,gBAAgB,EAAE,QAAQ,cAAc,IAAI,MAAS;AAE3F,SAAO;AAAA,IACL,cAAc,MAAM,UAAU;AAAA,IAC9B,QACE,MAAM,UAAU,SAAS,KAAK,UAAU,SAAS,OAAO,OAAO,SAAS,KAAK,SAAS,SAAS,OAAO,SAAS,SAAS;AAAA,IAC1H,WAAW,MAAM,aAAa,KAAK,aAAa,OAAO,aAAa,KAAK,aAAa,OAAO;AAAA,EAC/F;AACF;","names":["useSWR"]}
|
|
@@ -65,14 +65,16 @@ function useSponsorshipLicenses(params) {
|
|
|
65
65
|
return { licenses: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };
|
|
66
66
|
}
|
|
67
67
|
function useMySponsorshipDealCounts(walletAddress) {
|
|
68
|
-
const {
|
|
69
|
-
|
|
70
|
-
);
|
|
71
|
-
const {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
const owner = useSponsorshipProposals(walletAddress ? { owner: walletAddress, open: true } : void 0);
|
|
69
|
+
const sent = useSponsorshipProposals(walletAddress ? { proposer: walletAddress, open: true } : void 0);
|
|
70
|
+
const offers = useSponsorshipOffers(walletAddress ? { author: walletAddress, open: true } : void 0);
|
|
71
|
+
const held = useSponsorshipLicenses(walletAddress ? { holder: walletAddress } : void 0);
|
|
72
|
+
const issued = useSponsorshipLicenses(walletAddress ? { author: walletAddress } : void 0);
|
|
73
|
+
return {
|
|
74
|
+
pendingCount: owner.proposals.length,
|
|
75
|
+
hasAny: owner.proposals.length + sent.proposals.length + offers.offers.length + held.licenses.length + issued.licenses.length > 0,
|
|
76
|
+
isLoading: owner.isLoading || sent.isLoading || offers.isLoading || held.isLoading || issued.isLoading
|
|
77
|
+
};
|
|
76
78
|
}
|
|
77
79
|
export {
|
|
78
80
|
useMySponsorshipDealCounts,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/use-sponsorship.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiSponsorshipOffer, ApiSponsorshipBid, ApiSponsorshipProposal, ApiSponsorshipLicense, ApiResponse } from \"@medialane/sdk\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\n\nexport type {\n ApiSponsorshipOffer as SponsorshipOffer,\n ApiSponsorshipBid as SponsorshipBid,\n ApiSponsorshipProposal as SponsorshipProposal,\n ApiSponsorshipLicense as SponsorshipLicense,\n} from \"@medialane/sdk\";\n\nexport function useSponsorshipOffers( params?: { nftContract?: string; author?: string; owner?: string; open?: boolean }) {\n const key = `sponsorship-offers-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipOffer[]>>(\n key,\n () => client.api.getSponsorshipOffers({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { offers: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useSponsorshipOffer( offerId: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipOffer | null>(\n offerId ? `sponsorship-offer-${offerId}` : null,\n () => client.api.getSponsorshipOffer(offerId!),\n { revalidateOnFocus: false }\n );\n\n return { offer: data ?? null, isLoading, error, mutate };\n}\n\nexport function useSponsorshipBids( offerId: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipBid[]>(\n offerId ? `sponsorship-bids-${offerId}` : null,\n () => client.api.getSponsorshipBids(offerId!),\n { revalidateOnFocus: false }\n );\n\n return { bids: data ?? [], isLoading, error, mutate };\n}\n\nexport function useSponsorshipProposals( params?: { nftContract?: string; proposer?: string; owner?: string; open?: boolean }) {\n const key = `sponsorship-proposals-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipProposal[]>>(\n key,\n () => client.api.getSponsorshipProposals({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { proposals: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useSponsorshipProposal( proposalId: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipProposal | null>(\n proposalId ? `sponsorship-proposal-${proposalId}` : null,\n () => client.api.getSponsorshipProposal(proposalId!),\n { revalidateOnFocus: false }\n );\n\n return { proposal: data ?? null, isLoading, error, mutate };\n}\n\nexport function usePendingProposalsForAsset( nftContract: string | null) {\n const { proposals, isLoading, error, mutate } = useSponsorshipProposals(\n nftContract ? { nftContract, open: true } : undefined\n );\n return { proposals: nftContract ? proposals : [], isLoading, error, mutate };\n}\n\nexport function useSponsorshipLicenses( params?: { holder?: string; author?: string }) {\n const key = `sponsorship-licenses-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipLicense[]>>(\n key,\n () => client.api.getSponsorshipLicenses({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { licenses: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useMySponsorshipDealCounts( walletAddress: string | null) {\n const {
|
|
1
|
+
{"version":3,"sources":["../../src/utils/use-sponsorship.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiSponsorshipOffer, ApiSponsorshipBid, ApiSponsorshipProposal, ApiSponsorshipLicense, ApiResponse } from \"@medialane/sdk\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\n\nexport type {\n ApiSponsorshipOffer as SponsorshipOffer,\n ApiSponsorshipBid as SponsorshipBid,\n ApiSponsorshipProposal as SponsorshipProposal,\n ApiSponsorshipLicense as SponsorshipLicense,\n} from \"@medialane/sdk\";\n\nexport function useSponsorshipOffers( params?: { nftContract?: string; author?: string; owner?: string; open?: boolean }) {\n const key = `sponsorship-offers-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipOffer[]>>(\n key,\n () => client.api.getSponsorshipOffers({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { offers: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useSponsorshipOffer( offerId: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipOffer | null>(\n offerId ? `sponsorship-offer-${offerId}` : null,\n () => client.api.getSponsorshipOffer(offerId!),\n { revalidateOnFocus: false }\n );\n\n return { offer: data ?? null, isLoading, error, mutate };\n}\n\nexport function useSponsorshipBids( offerId: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipBid[]>(\n offerId ? `sponsorship-bids-${offerId}` : null,\n () => client.api.getSponsorshipBids(offerId!),\n { revalidateOnFocus: false }\n );\n\n return { bids: data ?? [], isLoading, error, mutate };\n}\n\nexport function useSponsorshipProposals( params?: { nftContract?: string; proposer?: string; owner?: string; open?: boolean }) {\n const key = `sponsorship-proposals-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipProposal[]>>(\n key,\n () => client.api.getSponsorshipProposals({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { proposals: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useSponsorshipProposal( proposalId: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipProposal | null>(\n proposalId ? `sponsorship-proposal-${proposalId}` : null,\n () => client.api.getSponsorshipProposal(proposalId!),\n { revalidateOnFocus: false }\n );\n\n return { proposal: data ?? null, isLoading, error, mutate };\n}\n\nexport function usePendingProposalsForAsset( nftContract: string | null) {\n const { proposals, isLoading, error, mutate } = useSponsorshipProposals(\n nftContract ? { nftContract, open: true } : undefined\n );\n return { proposals: nftContract ? proposals : [], isLoading, error, mutate };\n}\n\nexport function useSponsorshipLicenses( params?: { holder?: string; author?: string }) {\n const key = `sponsorship-licenses-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipLicense[]>>(\n key,\n () => client.api.getSponsorshipLicenses({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { licenses: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useMySponsorshipDealCounts( walletAddress: string | null) {\n const owner = useSponsorshipProposals(walletAddress ? { owner: walletAddress, open: true } : undefined);\n const sent = useSponsorshipProposals(walletAddress ? { proposer: walletAddress, open: true } : undefined);\n const offers = useSponsorshipOffers(walletAddress ? { author: walletAddress, open: true } : undefined);\n const held = useSponsorshipLicenses(walletAddress ? { holder: walletAddress } : undefined);\n const issued = useSponsorshipLicenses(walletAddress ? { author: walletAddress } : undefined);\n\n return {\n pendingCount: owner.proposals.length,\n hasAny:\n owner.proposals.length + sent.proposals.length + offers.offers.length + held.licenses.length + issued.licenses.length > 0,\n isLoading: owner.isLoading || sent.isLoading || offers.isLoading || held.isLoading || issued.isLoading,\n };\n}\n"],"mappings":";AAEA,OAAO,YAAY;AAEnB,SAAS,0BAA0B;AAS5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