@medialane/ui 0.230.0 → 0.232.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/asset-publication.cjs +8 -8
- package/dist/components/asset-publication.cjs.map +1 -1
- package/dist/components/asset-publication.js +8 -8
- package/dist/components/asset-publication.js.map +1 -1
- package/dist/components/badge.d.cts +1 -1
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/button.d.cts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/medialane-app.cjs.map +1 -1
- package/dist/components/medialane-app.d.cts +1 -0
- package/dist/components/medialane-app.d.ts +1 -0
- package/dist/components/medialane-app.js.map +1 -1
- package/dist/components/transaction-dialog.cjs +90 -0
- package/dist/components/transaction-dialog.cjs.map +1 -0
- package/dist/components/transaction-dialog.d.cts +18 -0
- package/dist/components/transaction-dialog.d.ts +18 -0
- package/dist/components/transaction-dialog.js +66 -0
- package/dist/components/transaction-dialog.js.map +1 -0
- package/dist/index.cjs +6 -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 +4 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/use-transaction.cjs +84 -0
- package/dist/utils/use-transaction.cjs.map +1 -0
- package/dist/utils/use-transaction.d.cts +17 -0
- package/dist/utils/use-transaction.d.ts +17 -0
- package/dist/utils/use-transaction.js +60 -0
- package/dist/utils/use-transaction.js.map +1 -0
- package/package.json +3 -3
|
@@ -39,17 +39,17 @@ function AssetPublication({ name, text, image, imgError, onImageError, onZoom, a
|
|
|
39
39
|
const paragraphs = text.split(/\n{2,}/).map((p) => p.trim()).filter(Boolean);
|
|
40
40
|
const [lead, ...body] = paragraphs.length > 1 ? paragraphs : [null, ...paragraphs];
|
|
41
41
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("article", { className: "min-w-0 space-y-6", children: [
|
|
42
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
43
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { className: "text-2xl lg:text-4xl font-bold leading-tight break-words", children: name }),
|
|
44
|
-
author ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground", children: author }) : null
|
|
45
|
-
] }),
|
|
42
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("header", { className: "space-y-3", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { className: "text-2xl lg:text-4xl font-bold leading-tight break-words", children: name }) }),
|
|
46
43
|
lead ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "max-w-3xl text-base leading-relaxed text-foreground whitespace-pre-line", children: lead }) : null,
|
|
47
44
|
image && !imgError ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: onZoom, "aria-label": "View full image", className: "block w-full overflow-hidden rounded-3xl cursor-zoom-in focus:outline-none", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { src: image, alt: name, onError: onImageError, className: "w-full h-auto max-h-[80vh] object-contain" }) }) : null,
|
|
48
45
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "max-w-3xl space-y-4 text-sm leading-relaxed text-foreground/85 break-words", children: body.map((paragraph, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "whitespace-pre-line", children: paragraph }, i)) }),
|
|
49
|
-
website ? /* @__PURE__ */ (0, import_jsx_runtime.
|
|
50
|
-
"
|
|
51
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
52
|
-
|
|
46
|
+
author || website ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-wrap items-center gap-4", children: [
|
|
47
|
+
author ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "min-w-0 break-words text-sm text-muted-foreground", children: author }) : null,
|
|
48
|
+
website ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { asChild: true, variant: "outline", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("a", { href: website, target: "_blank", rel: "noopener noreferrer", children: [
|
|
49
|
+
"Read more",
|
|
50
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ExternalLink, {})
|
|
51
|
+
] }) }) : null
|
|
52
|
+
] }) : null
|
|
53
53
|
] });
|
|
54
54
|
}
|
|
55
55
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/asset-publication.tsx"],"sourcesContent":["\"use client\";\n\nimport { ExternalLink } from \"lucide-react\";\nimport { Button } from \"./button.js\";\n\nexport interface AssetPublicationProps {\n name: string;\n text: string;\n image: string | null;\n imgError: boolean;\n onImageError: () => void;\n onZoom: () => void;\n author?: string | null;\n websiteUrl?: string | null;\n}\n\nfunction webAddress(url?: string | null) {\n if (!url) return null;\n try {\n const parsed = new URL(url);\n return parsed.protocol === \"https:\" || parsed.protocol === \"http:\" ? parsed.href : null;\n } catch {\n return null;\n }\n}\n\nexport function AssetPublication({ name, text, image, imgError, onImageError, onZoom, author, websiteUrl }: AssetPublicationProps) {\n const website = webAddress(websiteUrl);\n const paragraphs = text.split(/\\n{2,}/).map((p) => p.trim()).filter(Boolean);\n const [lead, ...body] = paragraphs.length > 1 ? paragraphs : [null, ...paragraphs];\n\n return (\n <article className=\"min-w-0 space-y-6\">\n <header className=\"space-y-3\">\n <h1 className=\"text-2xl lg:text-4xl font-bold leading-tight break-words\">{name}</h1>\n
|
|
1
|
+
{"version":3,"sources":["../../src/components/asset-publication.tsx"],"sourcesContent":["\"use client\";\n\nimport { ExternalLink } from \"lucide-react\";\nimport { Button } from \"./button.js\";\n\nexport interface AssetPublicationProps {\n name: string;\n text: string;\n image: string | null;\n imgError: boolean;\n onImageError: () => void;\n onZoom: () => void;\n author?: string | null;\n websiteUrl?: string | null;\n}\n\nfunction webAddress(url?: string | null) {\n if (!url) return null;\n try {\n const parsed = new URL(url);\n return parsed.protocol === \"https:\" || parsed.protocol === \"http:\" ? parsed.href : null;\n } catch {\n return null;\n }\n}\n\nexport function AssetPublication({ name, text, image, imgError, onImageError, onZoom, author, websiteUrl }: AssetPublicationProps) {\n const website = webAddress(websiteUrl);\n const paragraphs = text.split(/\\n{2,}/).map((p) => p.trim()).filter(Boolean);\n const [lead, ...body] = paragraphs.length > 1 ? paragraphs : [null, ...paragraphs];\n\n return (\n <article className=\"min-w-0 space-y-6\">\n <header className=\"space-y-3\">\n <h1 className=\"text-2xl lg:text-4xl font-bold leading-tight break-words\">{name}</h1>\n </header>\n\n {lead ? <p className=\"max-w-3xl text-base leading-relaxed text-foreground whitespace-pre-line\">{lead}</p> : null}\n\n {image && !imgError ? (\n <button type=\"button\" onClick={onZoom} aria-label=\"View full image\" className=\"block w-full overflow-hidden rounded-3xl cursor-zoom-in focus:outline-none\">\n <img src={image} alt={name} onError={onImageError} className=\"w-full h-auto max-h-[80vh] object-contain\" />\n </button>\n ) : null}\n\n <div className=\"max-w-3xl space-y-4 text-sm leading-relaxed text-foreground/85 break-words\">\n {body.map((paragraph, i) => (\n <p key={i} className=\"whitespace-pre-line\">{paragraph}</p>\n ))}\n </div>\n\n {author || website ? (\n <div className=\"flex flex-wrap items-center gap-4\">\n {author ? <p className=\"min-w-0 break-words text-sm text-muted-foreground\">{author}</p> : null}\n {website ? (\n <Button asChild variant=\"outline\">\n <a href={website} target=\"_blank\" rel=\"noopener noreferrer\">\n Read more\n <ExternalLink />\n </a>\n </Button>\n ) : null}\n </div>\n ) : null}\n </article>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkCQ;AAhCR,0BAA6B;AAC7B,oBAAuB;AAavB,SAAS,WAAW,KAAqB;AACvC,MAAI,CAAC,IAAK,QAAO;AACjB,MAAI;AACF,UAAM,SAAS,IAAI,IAAI,GAAG;AAC1B,WAAO,OAAO,aAAa,YAAY,OAAO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= text.split(/\n{2,}/).map((p) => p.trim()).filter(Boolean);
|
|
17
17
|
const [lead, ...body] = paragraphs.length > 1 ? paragraphs : [null, ...paragraphs];
|
|
18
18
|
return /* @__PURE__ */ jsxs("article", { className: "min-w-0 space-y-6", children: [
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
/* @__PURE__ */ jsx("h1", { className: "text-2xl lg:text-4xl font-bold leading-tight break-words", children: name }),
|
|
21
|
-
author ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: author }) : null
|
|
22
|
-
] }),
|
|
19
|
+
/* @__PURE__ */ jsx("header", { className: "space-y-3", children: /* @__PURE__ */ jsx("h1", { className: "text-2xl lg:text-4xl font-bold leading-tight break-words", children: name }) }),
|
|
23
20
|
lead ? /* @__PURE__ */ jsx("p", { className: "max-w-3xl text-base leading-relaxed text-foreground whitespace-pre-line", children: lead }) : null,
|
|
24
21
|
image && !imgError ? /* @__PURE__ */ jsx("button", { type: "button", onClick: onZoom, "aria-label": "View full image", className: "block w-full overflow-hidden rounded-3xl cursor-zoom-in focus:outline-none", children: /* @__PURE__ */ jsx("img", { src: image, alt: name, onError: onImageError, className: "w-full h-auto max-h-[80vh] object-contain" }) }) : null,
|
|
25
22
|
/* @__PURE__ */ jsx("div", { className: "max-w-3xl space-y-4 text-sm leading-relaxed text-foreground/85 break-words", children: body.map((paragraph, i) => /* @__PURE__ */ jsx("p", { className: "whitespace-pre-line", children: paragraph }, i)) }),
|
|
26
|
-
website ? /* @__PURE__ */
|
|
27
|
-
"
|
|
28
|
-
/* @__PURE__ */ jsx(
|
|
29
|
-
|
|
23
|
+
author || website ? /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-4", children: [
|
|
24
|
+
author ? /* @__PURE__ */ jsx("p", { className: "min-w-0 break-words text-sm text-muted-foreground", children: author }) : null,
|
|
25
|
+
website ? /* @__PURE__ */ jsx(Button, { asChild: true, variant: "outline", children: /* @__PURE__ */ jsxs("a", { href: website, target: "_blank", rel: "noopener noreferrer", children: [
|
|
26
|
+
"Read more",
|
|
27
|
+
/* @__PURE__ */ jsx(ExternalLink, {})
|
|
28
|
+
] }) }) : null
|
|
29
|
+
] }) : null
|
|
30
30
|
] });
|
|
31
31
|
}
|
|
32
32
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/asset-publication.tsx"],"sourcesContent":["\"use client\";\n\nimport { ExternalLink } from \"lucide-react\";\nimport { Button } from \"./button.js\";\n\nexport interface AssetPublicationProps {\n name: string;\n text: string;\n image: string | null;\n imgError: boolean;\n onImageError: () => void;\n onZoom: () => void;\n author?: string | null;\n websiteUrl?: string | null;\n}\n\nfunction webAddress(url?: string | null) {\n if (!url) return null;\n try {\n const parsed = new URL(url);\n return parsed.protocol === \"https:\" || parsed.protocol === \"http:\" ? parsed.href : null;\n } catch {\n return null;\n }\n}\n\nexport function AssetPublication({ name, text, image, imgError, onImageError, onZoom, author, websiteUrl }: AssetPublicationProps) {\n const website = webAddress(websiteUrl);\n const paragraphs = text.split(/\\n{2,}/).map((p) => p.trim()).filter(Boolean);\n const [lead, ...body] = paragraphs.length > 1 ? paragraphs : [null, ...paragraphs];\n\n return (\n <article className=\"min-w-0 space-y-6\">\n <header className=\"space-y-3\">\n <h1 className=\"text-2xl lg:text-4xl font-bold leading-tight break-words\">{name}</h1>\n
|
|
1
|
+
{"version":3,"sources":["../../src/components/asset-publication.tsx"],"sourcesContent":["\"use client\";\n\nimport { ExternalLink } from \"lucide-react\";\nimport { Button } from \"./button.js\";\n\nexport interface AssetPublicationProps {\n name: string;\n text: string;\n image: string | null;\n imgError: boolean;\n onImageError: () => void;\n onZoom: () => void;\n author?: string | null;\n websiteUrl?: string | null;\n}\n\nfunction webAddress(url?: string | null) {\n if (!url) return null;\n try {\n const parsed = new URL(url);\n return parsed.protocol === \"https:\" || parsed.protocol === \"http:\" ? parsed.href : null;\n } catch {\n return null;\n }\n}\n\nexport function AssetPublication({ name, text, image, imgError, onImageError, onZoom, author, websiteUrl }: AssetPublicationProps) {\n const website = webAddress(websiteUrl);\n const paragraphs = text.split(/\\n{2,}/).map((p) => p.trim()).filter(Boolean);\n const [lead, ...body] = paragraphs.length > 1 ? paragraphs : [null, ...paragraphs];\n\n return (\n <article className=\"min-w-0 space-y-6\">\n <header className=\"space-y-3\">\n <h1 className=\"text-2xl lg:text-4xl font-bold leading-tight break-words\">{name}</h1>\n </header>\n\n {lead ? <p className=\"max-w-3xl text-base leading-relaxed text-foreground whitespace-pre-line\">{lead}</p> : null}\n\n {image && !imgError ? (\n <button type=\"button\" onClick={onZoom} aria-label=\"View full image\" className=\"block w-full overflow-hidden rounded-3xl cursor-zoom-in focus:outline-none\">\n <img src={image} alt={name} onError={onImageError} className=\"w-full h-auto max-h-[80vh] object-contain\" />\n </button>\n ) : null}\n\n <div className=\"max-w-3xl space-y-4 text-sm leading-relaxed text-foreground/85 break-words\">\n {body.map((paragraph, i) => (\n <p key={i} className=\"whitespace-pre-line\">{paragraph}</p>\n ))}\n </div>\n\n {author || website ? (\n <div className=\"flex flex-wrap items-center gap-4\">\n {author ? <p className=\"min-w-0 break-words text-sm text-muted-foreground\">{author}</p> : null}\n {website ? (\n <Button asChild variant=\"outline\">\n <a href={website} target=\"_blank\" rel=\"noopener noreferrer\">\n Read more\n <ExternalLink />\n </a>\n </Button>\n ) : null}\n </div>\n ) : null}\n </article>\n );\n}\n"],"mappings":";AAkCQ,cAsBM,YAtBN;AAhCR,SAAS,oBAAoB;AAC7B,SAAS,cAAc;AAavB,SAAS,WAAW,KAAqB;AACvC,MAAI,CAAC,IAAK,QAAO;AACjB,MAAI;AACF,UAAM,SAAS,IAAI,IAAI,GAAG;AAC1B,WAAO,OAAO,aAAa,YAAY,OAAO,aAAa,UAAU,OAAO,OAAO;AAAA,EACrF,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,SAAS,iBAAiB,EAAE,MAAM,MAAM,OAAO,UAAU,cAAc,QAAQ,QAAQ,WAAW,GAA0B;AACjI,QAAM,UAAU,WAAW,UAAU;AACrC,QAAM,aAAa,KAAK,MAAM,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,OAAO;AAC3E,QAAM,CAAC,MAAM,GAAG,IAAI,IAAI,WAAW,SAAS,IAAI,aAAa,CAAC,MAAM,GAAG,UAAU;AAEjF,SACE,qBAAC,aAAQ,WAAU,qBACjB;AAAA,wBAAC,YAAO,WAAU,aAChB,8BAAC,QAAG,WAAU,4DAA4D,gBAAK,GACjF;AAAA,IAEC,OAAO,oBAAC,OAAE,WAAU,2EAA2E,gBAAK,IAAO;AAAA,IAE3G,SAAS,CAAC,WACT,oBAAC,YAAO,MAAK,UAAS,SAAS,QAAQ,cAAW,mBAAkB,WAAU,8EAC5E,8BAAC,SAAI,KAAK,OAAO,KAAK,MAAM,SAAS,cAAc,WAAU,6CAA4C,GAC3G,IACE;AAAA,IAEJ,oBAAC,SAAI,WAAU,8EACZ,eAAK,IAAI,CAAC,WAAW,MACpB,oBAAC,OAAU,WAAU,uBAAuB,uBAApC,CAA8C,CACvD,GACH;AAAA,IAEC,UAAU,UACT,qBAAC,SAAI,WAAU,qCACZ;AAAA,eAAS,oBAAC,OAAE,WAAU,qDAAqD,kBAAO,IAAO;AAAA,MACzF,UACC,oBAAC,UAAO,SAAO,MAAC,SAAQ,WACtB,+BAAC,OAAE,MAAM,SAAS,QAAO,UAAS,KAAI,uBAAsB;AAAA;AAAA,QAE1D,oBAAC,gBAAa;AAAA,SAChB,GACF,IACE;AAAA,OACN,IACE;AAAA,KACN;AAEJ;","names":[]}
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
|
|
6
6
|
declare const badgeVariants: (props?: ({
|
|
7
|
-
variant?: "
|
|
7
|
+
variant?: "outline" | "default" | "destructive" | "secondary" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
10
10
|
}
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
|
|
6
6
|
declare const badgeVariants: (props?: ({
|
|
7
|
-
variant?: "
|
|
7
|
+
variant?: "outline" | "default" | "destructive" | "secondary" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
10
10
|
}
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "
|
|
6
|
+
variant?: "outline" | "link" | "default" | "destructive" | "secondary" | "ghost" | "premium" | "tonal" | "gradient-border" | "gradient-fill" | null | undefined;
|
|
7
7
|
size?: "default" | "icon" | "sm" | "lg" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "
|
|
6
|
+
variant?: "outline" | "link" | "default" | "destructive" | "secondary" | "ghost" | "premium" | "tonal" | "gradient-border" | "gradient-fill" | null | undefined;
|
|
7
7
|
size?: "default" | "icon" | "sm" | "lg" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/medialane-app.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, useContext, type ComponentType, type ElementType, type ReactNode } from \"react\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { FastMintSigner } from \"./fast-mint/types.js\";\nimport type { ApiToken } from \"@medialane/sdk\";\nimport type { ImageResolver } from \"../utils/ipfs.js\";\n\nexport type AssetRef = Pick<ApiToken, \"chain\" | \"contractAddress\" | \"tokenId\">;\n\nexport interface CompanionApp {\n title: string;\n description: string;\n icon: ElementType;\n origin: string;\n}\n\nexport type ReportTarget =\n | { type: \"TOKEN\"; contract: string; tokenId: string; name?: string }\n | { type: \"COLLECTION\"; contract: string; name?: string }\n | { type: \"CREATOR\"; address: string; name?: string };\n\nexport type ReportDialogSlot = ComponentType<{ open: boolean; onOpenChange: (open: boolean) => void; target: ReportTarget }>;\n\nexport interface MedialaneApp {\n getClient: () => MedialaneClient;\n getSigner: () => Promise<FastMintSigner> | FastMintSigner;\n walletAddress: string | null;\n walletLoading?: boolean;\n onRequireWallet: () => void;\n ensureSignedIn?: () => Promise<void>;\n connectLabel?: string;\n connectDescription?: string;\n companion?: CompanionApp;\n ReportDialog?: ReportDialogSlot;\n resolveImage?: ImageResolver;\n}\n\nexport const MedialaneAppContext = createContext<MedialaneApp | null>(null);\n\nexport function MedialaneAppProvider({ value, children }: { value: MedialaneApp; children: ReactNode }) {\n return <MedialaneAppContext.Provider value={value}>{children}</MedialaneAppContext.Provider>;\n}\n\nexport function useMedialaneApp(): MedialaneApp {\n const app = useContext(MedialaneAppContext);\n if (!app) throw new Error(\"MedialaneAppProvider missing\");\n return app;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
1
|
+
{"version":3,"sources":["../../src/components/medialane-app.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, useContext, type ComponentType, type ElementType, type ReactNode } from \"react\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { FastMintSigner } from \"./fast-mint/types.js\";\nimport type { ApiToken } from \"@medialane/sdk\";\nimport type { ImageResolver } from \"../utils/ipfs.js\";\n\nexport type AssetRef = Pick<ApiToken, \"chain\" | \"contractAddress\" | \"tokenId\">;\n\nexport interface CompanionApp {\n title: string;\n description: string;\n icon: ElementType;\n origin: string;\n}\n\nexport type ReportTarget =\n | { type: \"TOKEN\"; contract: string; tokenId: string; name?: string }\n | { type: \"COLLECTION\"; contract: string; name?: string }\n | { type: \"CREATOR\"; address: string; name?: string };\n\nexport type ReportDialogSlot = ComponentType<{ open: boolean; onOpenChange: (open: boolean) => void; target: ReportTarget }>;\n\nexport interface MedialaneApp {\n getClient: () => MedialaneClient;\n getSigner: () => Promise<FastMintSigner> | FastMintSigner;\n walletAddress: string | null;\n walletLoading?: boolean;\n onRequireWallet: () => void;\n releaseSigner?: () => void;\n ensureSignedIn?: () => Promise<void>;\n connectLabel?: string;\n connectDescription?: string;\n companion?: CompanionApp;\n ReportDialog?: ReportDialogSlot;\n resolveImage?: ImageResolver;\n}\n\nexport const MedialaneAppContext = createContext<MedialaneApp | null>(null);\n\nexport function MedialaneAppProvider({ value, children }: { value: MedialaneApp; children: ReactNode }) {\n return <MedialaneAppContext.Provider value={value}>{children}</MedialaneAppContext.Provider>;\n}\n\nexport function useMedialaneApp(): MedialaneApp {\n const app = useContext(MedialaneAppContext);\n if (!app) throw new Error(\"MedialaneAppProvider missing\");\n return app;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0CS;AAxCT,mBAAgG;AAqCzF,MAAM,0BAAsB,4BAAmC,IAAI;AAEnE,SAAS,qBAAqB,EAAE,OAAO,SAAS,GAAiD;AACtG,SAAO,4CAAC,oBAAoB,UAApB,EAA6B,OAAe,UAAS;AAC/D;AAEO,SAAS,kBAAgC;AAC9C,QAAM,UAAM,yBAAW,mBAAmB;AAC1C,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,8BAA8B;AACxD,SAAO;AACT;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/medialane-app.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, useContext, type ComponentType, type ElementType, type ReactNode } from \"react\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { FastMintSigner } from \"./fast-mint/types.js\";\nimport type { ApiToken } from \"@medialane/sdk\";\nimport type { ImageResolver } from \"../utils/ipfs.js\";\n\nexport type AssetRef = Pick<ApiToken, \"chain\" | \"contractAddress\" | \"tokenId\">;\n\nexport interface CompanionApp {\n title: string;\n description: string;\n icon: ElementType;\n origin: string;\n}\n\nexport type ReportTarget =\n | { type: \"TOKEN\"; contract: string; tokenId: string; name?: string }\n | { type: \"COLLECTION\"; contract: string; name?: string }\n | { type: \"CREATOR\"; address: string; name?: string };\n\nexport type ReportDialogSlot = ComponentType<{ open: boolean; onOpenChange: (open: boolean) => void; target: ReportTarget }>;\n\nexport interface MedialaneApp {\n getClient: () => MedialaneClient;\n getSigner: () => Promise<FastMintSigner> | FastMintSigner;\n walletAddress: string | null;\n walletLoading?: boolean;\n onRequireWallet: () => void;\n ensureSignedIn?: () => Promise<void>;\n connectLabel?: string;\n connectDescription?: string;\n companion?: CompanionApp;\n ReportDialog?: ReportDialogSlot;\n resolveImage?: ImageResolver;\n}\n\nexport const MedialaneAppContext = createContext<MedialaneApp | null>(null);\n\nexport function MedialaneAppProvider({ value, children }: { value: MedialaneApp; children: ReactNode }) {\n return <MedialaneAppContext.Provider value={value}>{children}</MedialaneAppContext.Provider>;\n}\n\nexport function useMedialaneApp(): MedialaneApp {\n const app = useContext(MedialaneAppContext);\n if (!app) throw new Error(\"MedialaneAppProvider missing\");\n return app;\n}\n"],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../../src/components/medialane-app.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, useContext, type ComponentType, type ElementType, type ReactNode } from \"react\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { FastMintSigner } from \"./fast-mint/types.js\";\nimport type { ApiToken } from \"@medialane/sdk\";\nimport type { ImageResolver } from \"../utils/ipfs.js\";\n\nexport type AssetRef = Pick<ApiToken, \"chain\" | \"contractAddress\" | \"tokenId\">;\n\nexport interface CompanionApp {\n title: string;\n description: string;\n icon: ElementType;\n origin: string;\n}\n\nexport type ReportTarget =\n | { type: \"TOKEN\"; contract: string; tokenId: string; name?: string }\n | { type: \"COLLECTION\"; contract: string; name?: string }\n | { type: \"CREATOR\"; address: string; name?: string };\n\nexport type ReportDialogSlot = ComponentType<{ open: boolean; onOpenChange: (open: boolean) => void; target: ReportTarget }>;\n\nexport interface MedialaneApp {\n getClient: () => MedialaneClient;\n getSigner: () => Promise<FastMintSigner> | FastMintSigner;\n walletAddress: string | null;\n walletLoading?: boolean;\n onRequireWallet: () => void;\n releaseSigner?: () => void;\n ensureSignedIn?: () => Promise<void>;\n connectLabel?: string;\n connectDescription?: string;\n companion?: CompanionApp;\n ReportDialog?: ReportDialogSlot;\n resolveImage?: ImageResolver;\n}\n\nexport const MedialaneAppContext = createContext<MedialaneApp | null>(null);\n\nexport function MedialaneAppProvider({ value, children }: { value: MedialaneApp; children: ReactNode }) {\n return <MedialaneAppContext.Provider value={value}>{children}</MedialaneAppContext.Provider>;\n}\n\nexport function useMedialaneApp(): MedialaneApp {\n const app = useContext(MedialaneAppContext);\n if (!app) throw new Error(\"MedialaneAppProvider missing\");\n return app;\n}\n"],"mappings":";AA0CS;AAxCT,SAAS,eAAe,kBAAwE;AAqCzF,MAAM,sBAAsB,cAAmC,IAAI;AAEnE,SAAS,qBAAqB,EAAE,OAAO,SAAS,GAAiD;AACtG,SAAO,oBAAC,oBAAoB,UAApB,EAA6B,OAAe,UAAS;AAC/D;AAEO,SAAS,kBAAgC;AAC9C,QAAM,MAAM,WAAW,mBAAmB;AAC1C,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,8BAA8B;AACxD,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,90 @@
|
|
|
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 transaction_dialog_exports = {};
|
|
21
|
+
__export(transaction_dialog_exports, {
|
|
22
|
+
TransactionDialog: () => TransactionDialog
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(transaction_dialog_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_lucide_react = require("lucide-react");
|
|
28
|
+
var import_dialog = require("./dialog.js");
|
|
29
|
+
var import_button = require("./button.js");
|
|
30
|
+
var import_confetti = require("../utils/media-wallet/confetti.js");
|
|
31
|
+
const ACTIVE_STEP = { preparing: 0, submitting: 1, confirming: 2 };
|
|
32
|
+
function TransactionDialog({ tx, title, workingLabel, firstStepLabel = "Prepare", children }) {
|
|
33
|
+
const { phase, error, reset } = tx;
|
|
34
|
+
const working = phase === "preparing" || phase === "submitting" || phase === "confirming";
|
|
35
|
+
const success = phase === "success";
|
|
36
|
+
const failed = phase === "error";
|
|
37
|
+
const steps = [firstStepLabel, "Submit transaction", "Confirm transaction"];
|
|
38
|
+
const confettiFired = (0, import_react.useRef)(false);
|
|
39
|
+
(0, import_react.useEffect)(() => {
|
|
40
|
+
if (success && !confettiFired.current) {
|
|
41
|
+
confettiFired.current = true;
|
|
42
|
+
(0, import_confetti.fireConfetti)();
|
|
43
|
+
}
|
|
44
|
+
if (!success) confettiFired.current = false;
|
|
45
|
+
}, [success]);
|
|
46
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog, { open: phase !== "idle", modal: true, onOpenChange: (open) => {
|
|
47
|
+
if (!open && !working) reset();
|
|
48
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
49
|
+
import_dialog.DialogContent,
|
|
50
|
+
{
|
|
51
|
+
className: "sm:max-w-md",
|
|
52
|
+
onInteractOutside: working ? (e) => e.preventDefault() : void 0,
|
|
53
|
+
onEscapeKeyDown: working ? (e) => e.preventDefault() : void 0,
|
|
54
|
+
...working ? { hideClose: true } : {},
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogTitle, { className: "sr-only", children: working ? workingLabel : title }),
|
|
57
|
+
working && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col items-center gap-6 py-4", children: [
|
|
58
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex h-16 w-16 items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Loader2, { className: "h-8 w-8 animate-spin text-primary" }) }),
|
|
59
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1 text-center", children: [
|
|
60
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-lg font-semibold", children: workingLabel }),
|
|
61
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground", children: phase === "confirming" ? "Waiting for block confirmation" : "Submitting transaction" })
|
|
62
|
+
] }),
|
|
63
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", { className: "w-full space-y-2 rounded-xl border border-border/60 bg-muted/30 p-4", children: steps.map((label, i) => {
|
|
64
|
+
const active = i === ACTIVE_STEP[phase];
|
|
65
|
+
const done = i < ACTIVE_STEP[phase];
|
|
66
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { "data-step": true, "aria-current": active ? "step" : void 0, className: "flex items-center gap-3", children: [
|
|
67
|
+
done ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.CheckCircle2, { className: "h-4 w-4 shrink-0 text-emerald-500" }) : active ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Loader2, { className: "h-4 w-4 shrink-0 animate-spin text-primary" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-4 w-4 shrink-0 rounded-full border-2 border-muted-foreground/30" }),
|
|
68
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: done ? "text-sm text-foreground" : active ? "text-sm font-medium text-primary" : "text-sm text-muted-foreground", children: label })
|
|
69
|
+
] }, label);
|
|
70
|
+
}) }),
|
|
71
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-center text-xs text-muted-foreground", children: "This usually takes 10\u201330 seconds. Do not close this window." })
|
|
72
|
+
] }),
|
|
73
|
+
success && children,
|
|
74
|
+
failed && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col items-center gap-5 py-2", children: [
|
|
75
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex h-16 w-16 items-center justify-center rounded-full bg-destructive/10", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.XCircle, { className: "h-9 w-9 text-destructive" }) }),
|
|
76
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1 text-center", children: [
|
|
77
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xl font-bold", children: "Something went wrong" }),
|
|
78
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mx-auto max-w-xs text-sm text-muted-foreground", children: error ?? "We couldn't complete that. Please try again." })
|
|
79
|
+
] }),
|
|
80
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { variant: "outline", className: "w-full", onClick: reset, children: "Try again" })
|
|
81
|
+
] })
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
) });
|
|
85
|
+
}
|
|
86
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
87
|
+
0 && (module.exports = {
|
|
88
|
+
TransactionDialog
|
|
89
|
+
});
|
|
90
|
+
//# sourceMappingURL=transaction-dialog.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/transaction-dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, type ReactNode } from \"react\";\nimport { CheckCircle2, Loader2, XCircle } from \"lucide-react\";\nimport { Dialog, DialogContent, DialogTitle } from \"./dialog.js\";\nimport { Button } from \"./button.js\";\nimport { fireConfetti } from \"../utils/media-wallet/confetti.js\";\nimport type { useTransaction } from \"../utils/use-transaction.js\";\n\nexport interface TransactionDialogProps {\n tx: Pick<ReturnType<typeof useTransaction>, \"phase\" | \"error\" | \"reset\">;\n title: string;\n workingLabel: string;\n firstStepLabel?: string;\n children?: ReactNode;\n}\n\nconst ACTIVE_STEP = { preparing: 0, submitting: 1, confirming: 2 } as const;\n\nexport function TransactionDialog({ tx, title, workingLabel, firstStepLabel = \"Prepare\", children }: TransactionDialogProps) {\n const { phase, error, reset } = tx;\n const working = phase === \"preparing\" || phase === \"submitting\" || phase === \"confirming\";\n const success = phase === \"success\";\n const failed = phase === \"error\";\n const steps = [firstStepLabel, \"Submit transaction\", \"Confirm transaction\"];\n\n const confettiFired = useRef(false);\n useEffect(() => {\n if (success && !confettiFired.current) {\n confettiFired.current = true;\n fireConfetti();\n }\n if (!success) confettiFired.current = false;\n }, [success]);\n\n return (\n <Dialog open={phase !== \"idle\"} modal onOpenChange={(open) => { if (!open && !working) reset(); }}>\n <DialogContent\n className=\"sm:max-w-md\"\n onInteractOutside={working ? (e) => e.preventDefault() : undefined}\n onEscapeKeyDown={working ? (e) => e.preventDefault() : undefined}\n {...(working ? { hideClose: true } : {})}\n >\n <DialogTitle className=\"sr-only\">{working ? workingLabel : title}</DialogTitle>\n\n {working && (\n <div className=\"flex flex-col items-center gap-6 py-4\">\n <div className=\"flex h-16 w-16 items-center justify-center rounded-full bg-primary/10\">\n <Loader2 className=\"h-8 w-8 animate-spin text-primary\" />\n </div>\n <div className=\"space-y-1 text-center\">\n <p className=\"text-lg font-semibold\">{workingLabel}</p>\n <p className=\"text-sm text-muted-foreground\">\n {phase === \"confirming\" ? \"Waiting for block confirmation\" : \"Submitting transaction\"}\n </p>\n </div>\n <ol className=\"w-full space-y-2 rounded-xl border border-border/60 bg-muted/30 p-4\">\n {steps.map((label, i) => {\n const active = i === ACTIVE_STEP[phase];\n const done = i < ACTIVE_STEP[phase];\n return (\n <li key={label} data-step aria-current={active ? \"step\" : undefined} className=\"flex items-center gap-3\">\n {done ? (\n <CheckCircle2 className=\"h-4 w-4 shrink-0 text-emerald-500\" />\n ) : active ? (\n <Loader2 className=\"h-4 w-4 shrink-0 animate-spin text-primary\" />\n ) : (\n <div className=\"h-4 w-4 shrink-0 rounded-full border-2 border-muted-foreground/30\" />\n )}\n <span className={done ? \"text-sm text-foreground\" : active ? \"text-sm font-medium text-primary\" : \"text-sm text-muted-foreground\"}>\n {label}\n </span>\n </li>\n );\n })}\n </ol>\n <p className=\"text-center text-xs text-muted-foreground\">This usually takes 10–30 seconds. Do not close this window.</p>\n </div>\n )}\n\n {success && children}\n\n {failed && (\n <div className=\"flex flex-col items-center gap-5 py-2\">\n <div className=\"flex h-16 w-16 items-center justify-center rounded-full bg-destructive/10\">\n <XCircle className=\"h-9 w-9 text-destructive\" />\n </div>\n <div className=\"space-y-1 text-center\">\n <p className=\"text-xl font-bold\">Something went wrong</p>\n <p className=\"mx-auto max-w-xs text-sm text-muted-foreground\">{error ?? \"We couldn't complete that. Please try again.\"}</p>\n </div>\n <Button variant=\"outline\" className=\"w-full\" onClick={reset}>\n Try again\n </Button>\n </div>\n )}\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2CQ;AAzCR,mBAAkD;AAClD,0BAA+C;AAC/C,oBAAmD;AACnD,oBAAuB;AACvB,sBAA6B;AAW7B,MAAM,cAAc,EAAE,WAAW,GAAG,YAAY,GAAG,YAAY,EAAE;AAE1D,SAAS,kBAAkB,EAAE,IAAI,OAAO,cAAc,iBAAiB,WAAW,SAAS,GAA2B;AAC3H,QAAM,EAAE,OAAO,OAAO,MAAM,IAAI;AAChC,QAAM,UAAU,UAAU,eAAe,UAAU,gBAAgB,UAAU;AAC7E,QAAM,UAAU,UAAU;AAC1B,QAAM,SAAS,UAAU;AACzB,QAAM,QAAQ,CAAC,gBAAgB,sBAAsB,qBAAqB;AAE1E,QAAM,oBAAgB,qBAAO,KAAK;AAClC,8BAAU,MAAM;AACd,QAAI,WAAW,CAAC,cAAc,SAAS;AACrC,oBAAc,UAAU;AACxB,wCAAa;AAAA,IACf;AACA,QAAI,CAAC,QAAS,eAAc,UAAU;AAAA,EACxC,GAAG,CAAC,OAAO,CAAC;AAEZ,SACE,4CAAC,wBAAO,MAAM,UAAU,QAAQ,OAAK,MAAC,cAAc,CAAC,SAAS;AAAE,QAAI,CAAC,QAAQ,CAAC,QAAS,OAAM;AAAA,EAAG,GAC9F;AAAA,IAAC;AAA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oB;AAAA,YACrD,4CAAC,OAAE,WAAU,kDAAkD,mBAAS,gDAA+C;AAAA,aACzH;AAAA,UACA,4CAAC,wBAAO,SAAQ,WAAU,WAAU,UAAS,SAAS,OAAO,uBAE7D;AAAA,WACF;AAAA;AAAA;AAAA,EAEJ,GACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { useTransaction } from '../utils/use-transaction.cjs';
|
|
4
|
+
import '@medialane/sdk/starknet';
|
|
5
|
+
import './fast-mint/types.cjs';
|
|
6
|
+
import 'starknet';
|
|
7
|
+
import '@medialane/sdk';
|
|
8
|
+
|
|
9
|
+
interface TransactionDialogProps {
|
|
10
|
+
tx: Pick<ReturnType<typeof useTransaction>, "phase" | "error" | "reset">;
|
|
11
|
+
title: string;
|
|
12
|
+
workingLabel: string;
|
|
13
|
+
firstStepLabel?: string;
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
declare function TransactionDialog({ tx, title, workingLabel, firstStepLabel, children }: TransactionDialogProps): react_jsx_runtime.JSX.Element;
|
|
17
|
+
|
|
18
|
+
export { TransactionDialog, type TransactionDialogProps };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { useTransaction } from '../utils/use-transaction.js';
|
|
4
|
+
import '@medialane/sdk/starknet';
|
|
5
|
+
import './fast-mint/types.js';
|
|
6
|
+
import 'starknet';
|
|
7
|
+
import '@medialane/sdk';
|
|
8
|
+
|
|
9
|
+
interface TransactionDialogProps {
|
|
10
|
+
tx: Pick<ReturnType<typeof useTransaction>, "phase" | "error" | "reset">;
|
|
11
|
+
title: string;
|
|
12
|
+
workingLabel: string;
|
|
13
|
+
firstStepLabel?: string;
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
declare function TransactionDialog({ tx, title, workingLabel, firstStepLabel, children }: TransactionDialogProps): react_jsx_runtime.JSX.Element;
|
|
17
|
+
|
|
18
|
+
export { TransactionDialog, type TransactionDialogProps };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
4
|
+
import { CheckCircle2, Loader2, XCircle } from "lucide-react";
|
|
5
|
+
import { Dialog, DialogContent, DialogTitle } from "./dialog.js";
|
|
6
|
+
import { Button } from "./button.js";
|
|
7
|
+
import { fireConfetti } from "../utils/media-wallet/confetti.js";
|
|
8
|
+
const ACTIVE_STEP = { preparing: 0, submitting: 1, confirming: 2 };
|
|
9
|
+
function TransactionDialog({ tx, title, workingLabel, firstStepLabel = "Prepare", children }) {
|
|
10
|
+
const { phase, error, reset } = tx;
|
|
11
|
+
const working = phase === "preparing" || phase === "submitting" || phase === "confirming";
|
|
12
|
+
const success = phase === "success";
|
|
13
|
+
const failed = phase === "error";
|
|
14
|
+
const steps = [firstStepLabel, "Submit transaction", "Confirm transaction"];
|
|
15
|
+
const confettiFired = useRef(false);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (success && !confettiFired.current) {
|
|
18
|
+
confettiFired.current = true;
|
|
19
|
+
fireConfetti();
|
|
20
|
+
}
|
|
21
|
+
if (!success) confettiFired.current = false;
|
|
22
|
+
}, [success]);
|
|
23
|
+
return /* @__PURE__ */ jsx(Dialog, { open: phase !== "idle", modal: true, onOpenChange: (open) => {
|
|
24
|
+
if (!open && !working) reset();
|
|
25
|
+
}, children: /* @__PURE__ */ jsxs(
|
|
26
|
+
DialogContent,
|
|
27
|
+
{
|
|
28
|
+
className: "sm:max-w-md",
|
|
29
|
+
onInteractOutside: working ? (e) => e.preventDefault() : void 0,
|
|
30
|
+
onEscapeKeyDown: working ? (e) => e.preventDefault() : void 0,
|
|
31
|
+
...working ? { hideClose: true } : {},
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "sr-only", children: working ? workingLabel : title }),
|
|
34
|
+
working && /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-6 py-4", children: [
|
|
35
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-16 w-16 items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ jsx(Loader2, { className: "h-8 w-8 animate-spin text-primary" }) }),
|
|
36
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1 text-center", children: [
|
|
37
|
+
/* @__PURE__ */ jsx("p", { className: "text-lg font-semibold", children: workingLabel }),
|
|
38
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: phase === "confirming" ? "Waiting for block confirmation" : "Submitting transaction" })
|
|
39
|
+
] }),
|
|
40
|
+
/* @__PURE__ */ jsx("ol", { className: "w-full space-y-2 rounded-xl border border-border/60 bg-muted/30 p-4", children: steps.map((label, i) => {
|
|
41
|
+
const active = i === ACTIVE_STEP[phase];
|
|
42
|
+
const done = i < ACTIVE_STEP[phase];
|
|
43
|
+
return /* @__PURE__ */ jsxs("li", { "data-step": true, "aria-current": active ? "step" : void 0, className: "flex items-center gap-3", children: [
|
|
44
|
+
done ? /* @__PURE__ */ jsx(CheckCircle2, { className: "h-4 w-4 shrink-0 text-emerald-500" }) : active ? /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 shrink-0 animate-spin text-primary" }) : /* @__PURE__ */ jsx("div", { className: "h-4 w-4 shrink-0 rounded-full border-2 border-muted-foreground/30" }),
|
|
45
|
+
/* @__PURE__ */ jsx("span", { className: done ? "text-sm text-foreground" : active ? "text-sm font-medium text-primary" : "text-sm text-muted-foreground", children: label })
|
|
46
|
+
] }, label);
|
|
47
|
+
}) }),
|
|
48
|
+
/* @__PURE__ */ jsx("p", { className: "text-center text-xs text-muted-foreground", children: "This usually takes 10\u201330 seconds. Do not close this window." })
|
|
49
|
+
] }),
|
|
50
|
+
success && children,
|
|
51
|
+
failed && /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-5 py-2", children: [
|
|
52
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-16 w-16 items-center justify-center rounded-full bg-destructive/10", children: /* @__PURE__ */ jsx(XCircle, { className: "h-9 w-9 text-destructive" }) }),
|
|
53
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1 text-center", children: [
|
|
54
|
+
/* @__PURE__ */ jsx("p", { className: "text-xl font-bold", children: "Something went wrong" }),
|
|
55
|
+
/* @__PURE__ */ jsx("p", { className: "mx-auto max-w-xs text-sm text-muted-foreground", children: error ?? "We couldn't complete that. Please try again." })
|
|
56
|
+
] }),
|
|
57
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", className: "w-full", onClick: reset, children: "Try again" })
|
|
58
|
+
] })
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
) });
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
TransactionDialog
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=transaction-dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/transaction-dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, type ReactNode } from \"react\";\nimport { CheckCircle2, Loader2, XCircle } from \"lucide-react\";\nimport { Dialog, DialogContent, DialogTitle } from \"./dialog.js\";\nimport { Button } from \"./button.js\";\nimport { fireConfetti } from \"../utils/media-wallet/confetti.js\";\nimport type { useTransaction } from \"../utils/use-transaction.js\";\n\nexport interface TransactionDialogProps {\n tx: Pick<ReturnType<typeof useTransaction>, \"phase\" | \"error\" | \"reset\">;\n title: string;\n workingLabel: string;\n firstStepLabel?: string;\n children?: ReactNode;\n}\n\nconst ACTIVE_STEP = { preparing: 0, submitting: 1, confirming: 2 } as const;\n\nexport function TransactionDialog({ tx, title, workingLabel, firstStepLabel = \"Prepare\", children }: TransactionDialogProps) {\n const { phase, error, reset } = tx;\n const working = phase === \"preparing\" || phase === \"submitting\" || phase === \"confirming\";\n const success = phase === \"success\";\n const failed = phase === \"error\";\n const steps = [firstStepLabel, \"Submit transaction\", \"Confirm transaction\"];\n\n const confettiFired = useRef(false);\n useEffect(() => {\n if (success && !confettiFired.current) {\n confettiFired.current = true;\n fireConfetti();\n }\n if (!success) confettiFired.current = false;\n }, [success]);\n\n return (\n <Dialog open={phase !== \"idle\"} modal onOpenChange={(open) => { if (!open && !working) reset(); }}>\n <DialogContent\n className=\"sm:max-w-md\"\n onInteractOutside={working ? (e) => e.preventDefault() : undefined}\n onEscapeKeyDown={working ? (e) => e.preventDefault() : undefined}\n {...(working ? { hideClose: true } : {})}\n >\n <DialogTitle className=\"sr-only\">{working ? workingLabel : title}</DialogTitle>\n\n {working && (\n <div className=\"flex flex-col items-center gap-6 py-4\">\n <div className=\"flex h-16 w-16 items-center justify-center rounded-full bg-primary/10\">\n <Loader2 className=\"h-8 w-8 animate-spin text-primary\" />\n </div>\n <div className=\"space-y-1 text-center\">\n <p className=\"text-lg font-semibold\">{workingLabel}</p>\n <p className=\"text-sm text-muted-foreground\">\n {phase === \"confirming\" ? \"Waiting for block confirmation\" : \"Submitting transaction\"}\n </p>\n </div>\n <ol className=\"w-full space-y-2 rounded-xl border border-border/60 bg-muted/30 p-4\">\n {steps.map((label, i) => {\n const active = i === ACTIVE_STEP[phase];\n const done = i < ACTIVE_STEP[phase];\n return (\n <li key={label} data-step aria-current={active ? \"step\" : undefined} className=\"flex items-center gap-3\">\n {done ? (\n <CheckCircle2 className=\"h-4 w-4 shrink-0 text-emerald-500\" />\n ) : active ? (\n <Loader2 className=\"h-4 w-4 shrink-0 animate-spin text-primary\" />\n ) : (\n <div className=\"h-4 w-4 shrink-0 rounded-full border-2 border-muted-foreground/30\" />\n )}\n <span className={done ? \"text-sm text-foreground\" : active ? \"text-sm font-medium text-primary\" : \"text-sm text-muted-foreground\"}>\n {label}\n </span>\n </li>\n );\n })}\n </ol>\n <p className=\"text-center text-xs text-muted-foreground\">This usually takes 10–30 seconds. Do not close this window.</p>\n </div>\n )}\n\n {success && children}\n\n {failed && (\n <div className=\"flex flex-col items-center gap-5 py-2\">\n <div className=\"flex h-16 w-16 items-center justify-center rounded-full bg-destructive/10\">\n <XCircle className=\"h-9 w-9 text-destructive\" />\n </div>\n <div className=\"space-y-1 text-center\">\n <p className=\"text-xl font-bold\">Something went wrong</p>\n <p className=\"mx-auto max-w-xs text-sm text-muted-foreground\">{error ?? \"We couldn't complete that. Please try again.\"}</p>\n </div>\n <Button variant=\"outline\" className=\"w-full\" onClick={reset}>\n Try again\n </Button>\n </div>\n )}\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AA2CQ,cAOI,YAPJ;AAzCR,SAAS,WAAW,cAA8B;AAClD,SAAS,cAAc,SAAS,eAAe;AAC/C,SAAS,QAAQ,eAAe,mBAAmB;AACnD,SAAS,cAAc;AACvB,SAAS,oBAAoB;AAW7B,MAAM,cAAc,EAAE,WAAW,GAAG,YAAY,GAAG,YAAY,EAAE;AAE1D,SAAS,kBAAkB,EAAE,IAAI,OAAO,cAAc,iBAAiB,WAAW,SAAS,GAA2B;AAC3H,QAAM,EAAE,OAAO,OAAO,MAAM,IAAI;AAChC,QAAM,UAAU,UAAU,eAAe,UAAU,gBAAgB,UAAU;AAC7E,QAAM,UAAU,UAAU;AAC1B,QAAM,SAAS,UAAU;AACzB,QAAM,QAAQ,CAAC,gBAAgB,sBAAsB,qBAAqB;AAE1E,QAAM,gBAAgB,OAAO,KAAK;AAClC,YAAU,MAAM;AACd,QAAI,WAAW,CAAC,cAAc,SAAS;AACrC,oBAAc,UAAU;AACxB,mBAAa;AAAA,IACf;AACA,QAAI,CAAC,QAAS,eAAc,UAAU;AAAA,EACxC,GAAG,CAAC,OAAO,CAAC;AAEZ,SACE,oBAAC,UAAO,MAAM,UAAU,QAAQ,OAAK,MAAC,cAAc,CAAC,SAAS;AAAE,QAAI,CAAC,QAAQ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WAAU,yBACb;AAAA,gCAAC,OAAE,WAAU,qBAAoB,kCAAoB;AAAA,YACrD,oBAAC,OAAE,WAAU,kDAAkD,mBAAS,gDAA+C;AAAA,aACzH;AAAA,UACA,oBAAC,UAAO,SAAQ,WAAU,WAAU,UAAS,SAAS,OAAO,uBAE7D;AAAA,WACF;AAAA;AAAA;AAAA,EAEJ,GACF;AAEJ;","names":[]}
|
package/dist/index.cjs
CHANGED
|
@@ -361,6 +361,7 @@ __export(index_exports, {
|
|
|
361
361
|
TokenCard: () => import_token_card.TokenCard,
|
|
362
362
|
TokenCardSkeleton: () => import_token_card.TokenCardSkeleton,
|
|
363
363
|
TokenGlyph: () => import_token_glyph.TokenGlyph,
|
|
364
|
+
TransactionDialog: () => import_transaction_dialog.TransactionDialog,
|
|
364
365
|
UserFacingError: () => import_describe_error.UserFacingError,
|
|
365
366
|
WrongNetworkError: () => import_wallet_error.WrongNetworkError,
|
|
366
367
|
XpEarned: () => import_xp_earned.XpEarned,
|
|
@@ -525,6 +526,7 @@ __export(index_exports, {
|
|
|
525
526
|
useTokenRemixes: () => import_use_remix_offers.useTokenRemixes,
|
|
526
527
|
useTokensByIpType: () => import_use_tokens_by_ip_type.useTokensByIpType,
|
|
527
528
|
useTokensByOwner: () => import_use_tokens.useTokensByOwner,
|
|
529
|
+
useTransaction: () => import_use_transaction.useTransaction,
|
|
528
530
|
useUsdPrices: () => import_use_usd_prices.useUsdPrices,
|
|
529
531
|
useUserOrders: () => import_use_orders.useUserOrders
|
|
530
532
|
});
|
|
@@ -695,6 +697,7 @@ var import_leaderboard_table = require("./components/rewards/leaderboard-table.j
|
|
|
695
697
|
var import_level_journey_list = require("./components/rewards/level-journey-list.js");
|
|
696
698
|
var import_badge_catalog = require("./components/rewards/badge-catalog.js");
|
|
697
699
|
var import_xp_earned = require("./components/rewards/xp-earned.js");
|
|
700
|
+
var import_use_transaction = require("./utils/use-transaction.js");
|
|
698
701
|
var import_reward_earned = require("./components/rewards/reward-earned.js");
|
|
699
702
|
var import_load_more_sentinel = require("./components/load-more-sentinel.js");
|
|
700
703
|
var import_activities_feed = require("./components/activities-feed.js");
|
|
@@ -702,6 +705,7 @@ var import_rewards_section = require("./components/rewards-section.js");
|
|
|
702
705
|
var import_action_button = require("./components/action-button.js");
|
|
703
706
|
var import_gradient_button = require("./components/gradient-button.js");
|
|
704
707
|
var import_coin_launch_preview = require("./components/coin-launch-preview.js");
|
|
708
|
+
var import_transaction_dialog = require("./components/transaction-dialog.js");
|
|
705
709
|
var import_creation_success = require("./components/creation-success.js");
|
|
706
710
|
var import_medialane_collection_card = require("./components/medialane-collection-card.js");
|
|
707
711
|
var import_token_glyph = require("./components/token-glyph.js");
|
|
@@ -1131,6 +1135,7 @@ var import_asset_accents = require("./utils/asset-accents.js");
|
|
|
1131
1135
|
TokenCard,
|
|
1132
1136
|
TokenCardSkeleton,
|
|
1133
1137
|
TokenGlyph,
|
|
1138
|
+
TransactionDialog,
|
|
1134
1139
|
UserFacingError,
|
|
1135
1140
|
WrongNetworkError,
|
|
1136
1141
|
XpEarned,
|
|
@@ -1295,6 +1300,7 @@ var import_asset_accents = require("./utils/asset-accents.js");
|
|
|
1295
1300
|
useTokenRemixes,
|
|
1296
1301
|
useTokensByIpType,
|
|
1297
1302
|
useTokensByOwner,
|
|
1303
|
+
useTransaction,
|
|
1298
1304
|
useUsdPrices,
|
|
1299
1305
|
useUserOrders
|
|
1300
1306
|
});
|