@medialane/ui 0.366.0 → 0.367.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/approve-mint-dialog.d.cts +0 -1
- package/dist/components/approve-mint-dialog.d.ts +0 -1
- package/dist/components/button.d.cts +2 -2
- package/dist/components/button.d.ts +2 -2
- package/dist/components/fast-mint/asset-form-parts.cjs +25 -51
- package/dist/components/fast-mint/asset-form-parts.cjs.map +1 -1
- package/dist/components/fast-mint/asset-form-parts.d.cts +11 -14
- package/dist/components/fast-mint/asset-form-parts.d.ts +11 -14
- package/dist/components/fast-mint/asset-form-parts.js +27 -52
- package/dist/components/fast-mint/asset-form-parts.js.map +1 -1
- package/dist/components/fast-mint/collection-section.cjs +11 -21
- package/dist/components/fast-mint/collection-section.cjs.map +1 -1
- package/dist/components/fast-mint/collection-section.d.cts +5 -7
- package/dist/components/fast-mint/collection-section.d.ts +5 -7
- package/dist/components/fast-mint/collection-section.js +11 -21
- package/dist/components/fast-mint/collection-section.js.map +1 -1
- package/dist/components/fast-mint/create-then-add.cjs +55 -0
- package/dist/components/fast-mint/create-then-add.cjs.map +1 -0
- package/dist/components/fast-mint/create-then-add.d.cts +24 -0
- package/dist/components/fast-mint/create-then-add.d.ts +24 -0
- package/dist/components/fast-mint/create-then-add.js +30 -0
- package/dist/components/fast-mint/create-then-add.js.map +1 -0
- package/dist/components/fast-mint/dropzone.d.cts +0 -1
- package/dist/components/fast-mint/dropzone.d.ts +0 -1
- package/dist/components/fast-mint/fast-mint.cjs +95 -167
- package/dist/components/fast-mint/fast-mint.cjs.map +1 -1
- package/dist/components/fast-mint/fast-mint.js +97 -169
- package/dist/components/fast-mint/fast-mint.js.map +1 -1
- package/dist/components/fast-mint/formats/nft.cjs +233 -0
- package/dist/components/fast-mint/formats/nft.cjs.map +1 -0
- package/dist/components/fast-mint/formats/nft.d.cts +19 -0
- package/dist/components/fast-mint/formats/nft.d.ts +19 -0
- package/dist/components/fast-mint/formats/nft.js +214 -0
- package/dist/components/fast-mint/formats/nft.js.map +1 -0
- package/dist/components/fast-mint/formats/pop.cjs +160 -0
- package/dist/components/fast-mint/formats/pop.cjs.map +1 -0
- package/dist/components/fast-mint/formats/pop.d.cts +18 -0
- package/dist/components/fast-mint/formats/pop.d.ts +18 -0
- package/dist/components/fast-mint/formats/pop.js +136 -0
- package/dist/components/fast-mint/formats/pop.js.map +1 -0
- package/dist/components/fast-mint/formats/registry.cjs +42 -0
- package/dist/components/fast-mint/formats/registry.cjs.map +1 -0
- package/dist/components/fast-mint/formats/registry.d.cts +20 -0
- package/dist/components/fast-mint/formats/registry.d.ts +20 -0
- package/dist/components/fast-mint/formats/registry.js +16 -0
- package/dist/components/fast-mint/formats/registry.js.map +1 -0
- package/dist/components/fast-mint/formats/tiers.cjs +206 -0
- package/dist/components/fast-mint/formats/tiers.cjs.map +1 -0
- package/dist/components/fast-mint/formats/tiers.d.cts +19 -0
- package/dist/components/fast-mint/formats/tiers.d.ts +19 -0
- package/dist/components/fast-mint/formats/tiers.js +181 -0
- package/dist/components/fast-mint/formats/tiers.js.map +1 -0
- package/dist/components/fast-mint/formats/types.cjs +31 -0
- package/dist/components/fast-mint/formats/types.cjs.map +1 -0
- package/dist/components/fast-mint/formats/types.d.cts +71 -0
- package/dist/components/fast-mint/formats/types.d.ts +71 -0
- package/dist/components/fast-mint/formats/types.js +7 -0
- package/dist/components/fast-mint/formats/types.js.map +1 -0
- package/dist/components/fast-mint/media-kind.d.cts +0 -1
- package/dist/components/fast-mint/media-kind.d.ts +0 -1
- package/dist/components/fast-mint/success-view.cjs +18 -59
- package/dist/components/fast-mint/success-view.cjs.map +1 -1
- package/dist/components/fast-mint/success-view.d.cts +13 -8
- package/dist/components/fast-mint/success-view.d.ts +13 -8
- package/dist/components/fast-mint/success-view.js +19 -60
- package/dist/components/fast-mint/success-view.js.map +1 -1
- package/dist/components/fast-mint/types.cjs.map +1 -1
- package/dist/components/fast-mint/types.d.cts +0 -3
- package/dist/components/fast-mint/types.d.ts +0 -3
- package/dist/components/launchpad/collection-create-form.cjs +6 -14
- package/dist/components/launchpad/collection-create-form.cjs.map +1 -1
- package/dist/components/launchpad/collection-create-form.js +6 -14
- package/dist/components/launchpad/collection-create-form.js.map +1 -1
- package/dist/components/launchpad/edition-mint-schema.d.cts +4 -4
- package/dist/components/launchpad/edition-mint-schema.d.ts +4 -4
- package/dist/components/launchpad/pop-create-fields.cjs +5 -3
- package/dist/components/launchpad/pop-create-fields.cjs.map +1 -1
- package/dist/components/launchpad/pop-create-fields.d.cts +8 -2
- package/dist/components/launchpad/pop-create-fields.d.ts +8 -2
- package/dist/components/launchpad/pop-create-fields.js +4 -3
- package/dist/components/launchpad/pop-create-fields.js.map +1 -1
- package/dist/components/launchpad/pop-create.cjs +9 -22
- package/dist/components/launchpad/pop-create.cjs.map +1 -1
- package/dist/components/launchpad/pop-create.js +9 -22
- package/dist/components/launchpad/pop-create.js.map +1 -1
- package/dist/components/launchpad/tier-mint-form.cjs +8 -25
- package/dist/components/launchpad/tier-mint-form.cjs.map +1 -1
- package/dist/components/launchpad/tier-mint-form.js +6 -23
- package/dist/components/launchpad/tier-mint-form.js.map +1 -1
- package/dist/components/transfer-dialog.d.cts +0 -1
- package/dist/components/transfer-dialog.d.ts +0 -1
- package/dist/data/launchpad-services.cjs +12 -12
- package/dist/data/launchpad-services.cjs.map +1 -1
- package/dist/data/launchpad-services.js +12 -12
- package/dist/data/launchpad-services.js.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/utils/drop/actions.d.cts +0 -1
- package/dist/utils/drop/actions.d.ts +0 -1
- package/dist/utils/drop/types.d.cts +0 -1
- package/dist/utils/drop/types.d.ts +0 -1
- package/dist/utils/launchpad-actions.cjs +90 -0
- package/dist/utils/launchpad-actions.cjs.map +1 -0
- package/dist/utils/launchpad-actions.d.cts +39 -0
- package/dist/utils/launchpad-actions.d.ts +39 -0
- package/dist/utils/launchpad-actions.js +60 -0
- package/dist/utils/launchpad-actions.js.map +1 -0
- package/dist/utils/media-wallet/use-erc20-balance.d.cts +1 -1
- package/dist/utils/media-wallet/use-erc20-balance.d.ts +1 -1
- package/dist/utils/use-transaction.d.cts +0 -1
- package/dist/utils/use-transaction.d.ts +0 -1
- package/package.json +1 -1
- package/dist/components/fast-mint/mint-asset.cjs +0 -124
- package/dist/components/fast-mint/mint-asset.cjs.map +0 -1
- package/dist/components/fast-mint/mint-asset.d.cts +0 -41
- package/dist/components/fast-mint/mint-asset.d.ts +0 -41
- package/dist/components/fast-mint/mint-asset.js +0 -100
- package/dist/components/fast-mint/mint-asset.js.map +0 -1
- package/dist/utils/launchpad-handoff.cjs +0 -62
- package/dist/utils/launchpad-handoff.cjs.map +0 -1
- package/dist/utils/launchpad-handoff.d.cts +0 -11
- package/dist/utils/launchpad-handoff.d.ts +0 -11
- package/dist/utils/launchpad-handoff.js +0 -35
- package/dist/utils/launchpad-handoff.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useRef, useState } from "react";
|
|
4
4
|
import { useForm } from "react-hook-form";
|
|
5
5
|
import { Loader2 } from "lucide-react";
|
|
@@ -7,6 +7,7 @@ import { profileHref } from "@medialane/sdk";
|
|
|
7
7
|
import { describeError } from "../../utils/describe-error.js";
|
|
8
8
|
import { uploadError } from "../../utils/upload-limits.js";
|
|
9
9
|
import { uploadFileToIpfs } from "../../utils/ipfs-upload.js";
|
|
10
|
+
import { invalidatePortfolioCache } from "../../utils/portfolio-cache.js";
|
|
10
11
|
import { cn } from "../../utils/cn.js";
|
|
11
12
|
import { Input } from "../input.js";
|
|
12
13
|
import { Textarea } from "../textarea.js";
|
|
@@ -14,15 +15,11 @@ import { MedialaneCollectionCard } from "../medialane-collection-card.js";
|
|
|
14
15
|
import { Dialog, DialogContent, DialogDescription, DialogTitle } from "../dialog.js";
|
|
15
16
|
import { Dropzone } from "./dropzone.js";
|
|
16
17
|
import { SuccessView } from "./success-view.js";
|
|
17
|
-
import { CoverUpload, FormatPicker,
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { LicensingSection } from "./licensing-section.js";
|
|
21
|
-
import { IpTypeSection } from "./ip-type-section.js";
|
|
18
|
+
import { CoverUpload, FormatPicker, MediaRow } from "./asset-form-parts.js";
|
|
19
|
+
import { PartialCreateError } from "./create-then-add.js";
|
|
20
|
+
import { FORMATS, getFormat, initialFormatStates } from "./formats/registry.js";
|
|
22
21
|
import { DEFAULT_VALUES } from "./form.js";
|
|
23
22
|
import { IP_TYPE_BY_KIND, MEDIA_ROUTE_MIME_TYPES, detectMediaKind } from "./media-kind.js";
|
|
24
|
-
import { mintAsset } from "./mint-asset.js";
|
|
25
|
-
import { mintableCollections } from "./mintable-collections.js";
|
|
26
23
|
import { useIpfsUpload } from "./use-ipfs-upload.js";
|
|
27
24
|
import { useNewCollectionDraft } from "./use-new-collection-draft.js";
|
|
28
25
|
function FastMint(props) {
|
|
@@ -32,7 +29,6 @@ function FastMint(props) {
|
|
|
32
29
|
onClose,
|
|
33
30
|
mediaKindLock,
|
|
34
31
|
onMinted,
|
|
35
|
-
onNavigate,
|
|
36
32
|
collections,
|
|
37
33
|
refetchCollections,
|
|
38
34
|
hasWallet,
|
|
@@ -41,27 +37,23 @@ function FastMint(props) {
|
|
|
41
37
|
connectLabel,
|
|
42
38
|
getUploadToken,
|
|
43
39
|
getSigner,
|
|
44
|
-
client
|
|
45
|
-
successFooter
|
|
40
|
+
client
|
|
46
41
|
} = props;
|
|
47
42
|
const [status, setStatus] = useState("idle");
|
|
48
43
|
const [errorMsg, setErrorMsg] = useState(null);
|
|
44
|
+
const [step, setStep] = useState(null);
|
|
49
45
|
const media = useIpfsUpload();
|
|
50
46
|
const feature = useIpfsUpload();
|
|
51
47
|
const [mediaFile, setMediaFile] = useState(null);
|
|
52
48
|
const [mediaKind, setMediaKind] = useState("image");
|
|
53
49
|
const mediaInputRef = useRef(null);
|
|
54
50
|
const featureInputRef = useRef(null);
|
|
55
|
-
const [
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
const [
|
|
59
|
-
const [collectionMode, setCollectionMode] = useState("existing");
|
|
60
|
-
const [existingCollectionId, setExistingCollectionId] = useState("");
|
|
61
|
-
const [existingCollectionContract, setExistingCollectionContract] = useState("");
|
|
51
|
+
const [formatKey, setFormatKey] = useState("single");
|
|
52
|
+
const [formatStates, setFormatStates] = useState(initialFormatStates);
|
|
53
|
+
const [resume, setResume] = useState(null);
|
|
54
|
+
const [result, setResult] = useState(null);
|
|
62
55
|
const [ipType, setIpType] = useState("NFT");
|
|
63
56
|
const templateFieldsRef = useRef([]);
|
|
64
|
-
const [mintedAsset, setMintedAsset] = useState(null);
|
|
65
57
|
const form = useForm({ defaultValues: DEFAULT_VALUES });
|
|
66
58
|
const name = form.watch("name");
|
|
67
59
|
const description = form.watch("description");
|
|
@@ -71,8 +63,9 @@ function FastMint(props) {
|
|
|
71
63
|
form.setValue("external_url", `https://medialane.io/account/${walletAddress}`);
|
|
72
64
|
}
|
|
73
65
|
}, [walletAddress, form]);
|
|
74
|
-
const
|
|
75
|
-
const
|
|
66
|
+
const format = getFormat(formatKey);
|
|
67
|
+
const formatState = formatStates[formatKey];
|
|
68
|
+
const updateFormat = (patch) => setFormatStates((states) => ({ ...states, [formatKey]: { ...states[formatKey], ...patch } }));
|
|
76
69
|
const uploadFile = async (file, kind) => {
|
|
77
70
|
const token = await getUploadToken();
|
|
78
71
|
if (!token) throw new Error("Sign in first");
|
|
@@ -104,76 +97,78 @@ function FastMint(props) {
|
|
|
104
97
|
media.clear();
|
|
105
98
|
if (mediaInputRef.current) mediaInputRef.current.value = "";
|
|
106
99
|
};
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
100
|
+
const image = mediaKind === "image" ? media.uri : feature.uri;
|
|
101
|
+
const previewImage = mediaKind === "image" ? media.preview : feature.preview;
|
|
102
|
+
const shared = media.uri && image && mediaFile ? {
|
|
103
|
+
form,
|
|
104
|
+
draft,
|
|
105
|
+
collections,
|
|
106
|
+
walletAddress: walletAddress ?? "",
|
|
107
|
+
mediaKind,
|
|
108
|
+
mediaUri: media.uri,
|
|
109
|
+
mediaName: mediaFile.name,
|
|
110
|
+
image,
|
|
111
|
+
previewImage,
|
|
112
|
+
ipType,
|
|
113
|
+
onIpTypeChange: setIpType,
|
|
114
|
+
templateFieldsRef,
|
|
115
|
+
uploadDocument: (file) => uploadFile(file, "document")
|
|
116
|
+
} : null;
|
|
117
|
+
const ready = !!shared && !media.uploading && !feature.uploading && name.trim().length > 0 && format.isReady(shared, formatState);
|
|
118
|
+
const onSubmit = async () => {
|
|
118
119
|
if (!hasWallet) {
|
|
119
120
|
onRequireWallet();
|
|
120
121
|
return;
|
|
121
122
|
}
|
|
122
|
-
if (!
|
|
123
|
-
|
|
123
|
+
if (!shared || !walletAddress) return;
|
|
124
|
+
const link = form.getValues("external_url");
|
|
125
|
+
if (link && !link.startsWith("http://") && !link.startsWith("https://")) {
|
|
124
126
|
setErrorMsg("External link must start with http:// or https://");
|
|
127
|
+
setStatus("error");
|
|
125
128
|
return;
|
|
126
129
|
}
|
|
127
130
|
setStatus("minting");
|
|
128
131
|
setErrorMsg(null);
|
|
132
|
+
setStep(null);
|
|
129
133
|
try {
|
|
130
|
-
const
|
|
134
|
+
const outcome = await format.submit(shared, formatState, {
|
|
131
135
|
client,
|
|
132
136
|
signer: await getSigner(),
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
templateFields: templateFieldsRef.current,
|
|
137
|
-
mediaKind,
|
|
138
|
-
mediaUri: media.uri,
|
|
139
|
-
featureUri: feature.uri,
|
|
140
|
-
assetType,
|
|
141
|
-
editionCount,
|
|
142
|
-
destination: collectionMode === "new" ? { mode: "new", name: draft.name, symbol: draft.symbol, description: draft.description } : { mode: "existing", collectionId: existingCollectionId, collectionContract: existingCollectionContract },
|
|
143
|
-
singleCollections: erc721Collections,
|
|
144
|
-
refetchCollections,
|
|
145
|
-
getUploadToken
|
|
137
|
+
getUploadToken,
|
|
138
|
+
resume: resume?.format === formatKey ? resume.destination : null,
|
|
139
|
+
onStep: setStep
|
|
146
140
|
});
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
onMinted?.(asset);
|
|
150
|
-
}
|
|
141
|
+
setResult(outcome);
|
|
142
|
+
setResume(null);
|
|
151
143
|
setStatus("success");
|
|
144
|
+
invalidatePortfolioCache(walletAddress);
|
|
145
|
+
if (outcome.asset) onMinted?.(outcome.asset);
|
|
146
|
+
void refetchCollections().catch(() => {
|
|
147
|
+
});
|
|
152
148
|
} catch (err) {
|
|
153
|
-
|
|
149
|
+
if (err instanceof PartialCreateError) {
|
|
150
|
+
setResume({ format: formatKey, destination: err.destination });
|
|
151
|
+
setErrorMsg(`${err.message} ${describeError(err.reason).message} Press the button again to finish.`);
|
|
152
|
+
} else {
|
|
153
|
+
setErrorMsg(describeError(err).message);
|
|
154
|
+
}
|
|
154
155
|
setStatus("error");
|
|
155
156
|
}
|
|
156
157
|
};
|
|
157
158
|
const resetAll = () => {
|
|
158
159
|
setStatus("idle");
|
|
159
160
|
setErrorMsg(null);
|
|
160
|
-
|
|
161
|
+
setStep(null);
|
|
162
|
+
setResult(null);
|
|
163
|
+
setResume(null);
|
|
161
164
|
form.reset();
|
|
162
165
|
clearMedia();
|
|
163
166
|
feature.clear();
|
|
164
|
-
|
|
165
|
-
setEditionCount("10");
|
|
166
|
-
setCollectionMode("existing");
|
|
167
|
-
setExistingCollectionId("");
|
|
168
|
-
setExistingCollectionContract("");
|
|
167
|
+
setFormatStates(initialFormatStates());
|
|
169
168
|
draft.reset();
|
|
170
169
|
templateFieldsRef.current = [];
|
|
171
170
|
};
|
|
172
171
|
const busy = status === "minting";
|
|
173
|
-
const previewImage = mediaKind === "image" ? media.preview : feature.preview;
|
|
174
|
-
const selectedExistingCollection = assetType === "single" ? erc721Collections.find((c) => c.collectionId === existingCollectionId) : erc1155Collections.find((c) => c.contractAddress === existingCollectionContract);
|
|
175
|
-
const formatTitle = MINT_FORMATS.find((f) => f.value === format)?.title ?? "";
|
|
176
|
-
const collectionLabel = handoffFormat ? void 0 : media.uri ? collectionMode === "new" ? draft.name || "New collection" : selectedExistingCollection?.name || "IP Asset" : void 0;
|
|
177
172
|
const wrap = (node) => {
|
|
178
173
|
if (presentation !== "dialog") return node;
|
|
179
174
|
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: (next) => {
|
|
@@ -184,20 +179,9 @@ function FastMint(props) {
|
|
|
184
179
|
node
|
|
185
180
|
] }) });
|
|
186
181
|
};
|
|
187
|
-
if (status === "success") {
|
|
182
|
+
if (status === "success" && result) {
|
|
188
183
|
return wrap(
|
|
189
|
-
/* @__PURE__ */ jsx(
|
|
190
|
-
SuccessView,
|
|
191
|
-
{
|
|
192
|
-
footer: successFooter,
|
|
193
|
-
presentation,
|
|
194
|
-
previewImage,
|
|
195
|
-
name,
|
|
196
|
-
collectionLabel,
|
|
197
|
-
mintedAsset,
|
|
198
|
-
onPublishAnother: resetAll
|
|
199
|
-
}
|
|
200
|
-
)
|
|
184
|
+
/* @__PURE__ */ jsx(SuccessView, { presentation, previewImage, result, onPublishAnother: resetAll })
|
|
201
185
|
);
|
|
202
186
|
}
|
|
203
187
|
if (!mediaFile) {
|
|
@@ -216,6 +200,7 @@ function FastMint(props) {
|
|
|
216
200
|
);
|
|
217
201
|
}
|
|
218
202
|
const submitBlocked = !ready || busy || !hasWallet;
|
|
203
|
+
const buttonLabel = busy ? `${step?.label ?? "Working"}\u2026${step && step.total > 1 ? ` (${step.index} of ${step.total})` : ""}` : format.submitLabel(formatState);
|
|
219
204
|
return wrap(
|
|
220
205
|
/* @__PURE__ */ jsxs("section", { className: "space-y-6", children: [
|
|
221
206
|
/* @__PURE__ */ jsx(
|
|
@@ -233,20 +218,9 @@ function FastMint(props) {
|
|
|
233
218
|
),
|
|
234
219
|
media.uri && /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-[1fr_320px] gap-8 items-start", children: [
|
|
235
220
|
/* @__PURE__ */ jsxs("div", { className: "space-y-5", children: [
|
|
236
|
-
/* @__PURE__ */ jsx(
|
|
237
|
-
FormatPicker,
|
|
238
|
-
{
|
|
239
|
-
value: format,
|
|
240
|
-
onChange: setFormat,
|
|
241
|
-
editionCount,
|
|
242
|
-
onEditionCount: setEditionCount
|
|
243
|
-
}
|
|
244
|
-
),
|
|
221
|
+
/* @__PURE__ */ jsx(FormatPicker, { formats: FORMATS, value: formatKey, onChange: setFormatKey }),
|
|
245
222
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
246
|
-
/* @__PURE__ */
|
|
247
|
-
"Title",
|
|
248
|
-
!handoffFormat && " *"
|
|
249
|
-
] }),
|
|
223
|
+
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Title *" }),
|
|
250
224
|
/* @__PURE__ */ jsx(
|
|
251
225
|
Input,
|
|
252
226
|
{
|
|
@@ -256,33 +230,31 @@ function FastMint(props) {
|
|
|
256
230
|
}
|
|
257
231
|
)
|
|
258
232
|
] }),
|
|
259
|
-
|
|
260
|
-
/* @__PURE__ */
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
233
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
234
|
+
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Description" }),
|
|
235
|
+
/* @__PURE__ */ jsx(
|
|
236
|
+
Textarea,
|
|
237
|
+
{
|
|
238
|
+
value: description,
|
|
239
|
+
onChange: (e) => form.setValue("description", e.target.value),
|
|
240
|
+
placeholder: "Describe your work, its story, and any context for buyers\u2026",
|
|
241
|
+
rows: 3
|
|
242
|
+
}
|
|
243
|
+
)
|
|
244
|
+
] }),
|
|
245
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
246
|
+
/* @__PURE__ */ jsxs("label", { className: "text-sm font-medium", children: [
|
|
247
|
+
"External link ",
|
|
248
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground font-normal", children: "(optional)" })
|
|
271
249
|
] }),
|
|
272
|
-
/* @__PURE__ */
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
value: form.watch("external_url"),
|
|
281
|
-
onChange: (e) => form.setValue("external_url", e.target.value),
|
|
282
|
-
placeholder: "https://yourwebsite.com"
|
|
283
|
-
}
|
|
284
|
-
)
|
|
285
|
-
] })
|
|
250
|
+
/* @__PURE__ */ jsx(
|
|
251
|
+
Input,
|
|
252
|
+
{
|
|
253
|
+
value: form.watch("external_url"),
|
|
254
|
+
onChange: (e) => form.setValue("external_url", e.target.value),
|
|
255
|
+
placeholder: "https://yourwebsite.com"
|
|
256
|
+
}
|
|
257
|
+
)
|
|
286
258
|
] }),
|
|
287
259
|
mediaKind !== "image" && /* @__PURE__ */ jsx(
|
|
288
260
|
CoverUpload,
|
|
@@ -293,76 +265,32 @@ function FastMint(props) {
|
|
|
293
265
|
onSelect: (file) => void feature.start(file, (f) => uploadFile(f, "image"), setErrorMsg)
|
|
294
266
|
}
|
|
295
267
|
),
|
|
296
|
-
|
|
297
|
-
/* @__PURE__ */ jsx(
|
|
298
|
-
CollectionSection,
|
|
299
|
-
{
|
|
300
|
-
assetType,
|
|
301
|
-
mode: collectionMode,
|
|
302
|
-
onModeChange: setCollectionMode,
|
|
303
|
-
collections: assetType === "single" ? erc721Collections : erc1155Collections,
|
|
304
|
-
existingId: existingCollectionId,
|
|
305
|
-
existingContract: existingCollectionContract,
|
|
306
|
-
onExistingId: setExistingCollectionId,
|
|
307
|
-
onExistingContract: setExistingCollectionContract,
|
|
308
|
-
draft,
|
|
309
|
-
previewImage
|
|
310
|
-
}
|
|
311
|
-
),
|
|
312
|
-
/* @__PURE__ */ jsx(LicensingSection, { form }),
|
|
313
|
-
/* @__PURE__ */ jsx(
|
|
314
|
-
IpTypeSection,
|
|
315
|
-
{
|
|
316
|
-
ipType,
|
|
317
|
-
onIpTypeChange: setIpType,
|
|
318
|
-
fieldsRef: templateFieldsRef,
|
|
319
|
-
uploadDocument: (file) => uploadFile(file, "document"),
|
|
320
|
-
existingDocument: mediaKind === "document" ? { uri: media.uri, name: mediaFile.name } : null
|
|
321
|
-
}
|
|
322
|
-
)
|
|
323
|
-
] }),
|
|
268
|
+
shared && /* @__PURE__ */ jsx(format.Fields, { shared, state: formatState, update: updateFormat }),
|
|
324
269
|
status === "error" && errorMsg && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: errorMsg }),
|
|
325
|
-
|
|
270
|
+
/* @__PURE__ */ jsxs(
|
|
326
271
|
"button",
|
|
327
272
|
{
|
|
328
273
|
type: "button",
|
|
329
|
-
disabled:
|
|
330
|
-
onClick:
|
|
274
|
+
disabled: submitBlocked,
|
|
275
|
+
onClick: () => void onSubmit(),
|
|
331
276
|
className: cn(
|
|
332
277
|
"w-full h-12 text-base font-semibold text-white rounded-xl flex items-center justify-center gap-2 transition-all hover:brightness-110 active:scale-[0.98] bg-brand-blue",
|
|
333
|
-
|
|
278
|
+
submitBlocked && "opacity-40 pointer-events-none"
|
|
334
279
|
),
|
|
335
280
|
children: [
|
|
336
|
-
"
|
|
337
|
-
|
|
281
|
+
busy && /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }),
|
|
282
|
+
buttonLabel
|
|
338
283
|
]
|
|
339
284
|
}
|
|
340
|
-
)
|
|
341
|
-
|
|
342
|
-
"button",
|
|
343
|
-
{
|
|
344
|
-
type: "button",
|
|
345
|
-
disabled: submitBlocked,
|
|
346
|
-
onClick: form.handleSubmit(onSubmit),
|
|
347
|
-
className: cn(
|
|
348
|
-
"w-full h-12 text-base font-semibold text-white rounded-xl flex items-center justify-center gap-2 transition-all hover:brightness-110 active:scale-[0.98] bg-brand-blue",
|
|
349
|
-
submitBlocked && "opacity-40 pointer-events-none"
|
|
350
|
-
),
|
|
351
|
-
children: busy ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
352
|
-
/* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }),
|
|
353
|
-
"Minting\u2026"
|
|
354
|
-
] }) : assetType === "single" ? "Mint NFT" : "Mint Editions"
|
|
355
|
-
}
|
|
356
|
-
),
|
|
357
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs text-center text-muted-foreground", children: "Zero platform fees to mint." })
|
|
358
|
-
] })
|
|
285
|
+
),
|
|
286
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-center text-muted-foreground", children: "Zero platform fees to mint." })
|
|
359
287
|
] }),
|
|
360
288
|
/* @__PURE__ */ jsx("div", { className: "order-first lg:order-last lg:sticky lg:top-20 max-w-[260px] mx-auto w-full lg:max-w-none lg:mx-0", children: /* @__PURE__ */ jsx(
|
|
361
289
|
MedialaneCollectionCard,
|
|
362
290
|
{
|
|
363
291
|
image: previewImage,
|
|
364
292
|
name,
|
|
365
|
-
collection:
|
|
293
|
+
collection: shared ? format.previewLabel(shared, formatState) : void 0,
|
|
366
294
|
creator: walletAddress ? `${walletAddress.slice(0, 6)}\u2026${walletAddress.slice(-4)}` : void 0,
|
|
367
295
|
creatorHref: walletAddress ? profileHref({ address: walletAddress }) : void 0
|
|
368
296
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/fast-mint/fast-mint.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport { Loader2 } from \"lucide-react\";\nimport { profileHref } from \"@medialane/sdk\";\nimport { describeError } from \"../../utils/describe-error.js\";\nimport { uploadError } from \"../../utils/upload-limits.js\";\nimport { uploadFileToIpfs, type SignedUploadKind } from \"../../utils/ipfs-upload.js\";\nimport { cn } from \"../../utils/cn.js\";\nimport type { IPType } from \"../../data/ip.js\";\nimport { Input } from \"../input.js\";\nimport { Textarea } from \"../textarea.js\";\nimport { MedialaneCollectionCard } from \"../medialane-collection-card.js\";\nimport { Dialog, DialogContent, DialogDescription, DialogTitle } from \"../dialog.js\";\nimport type { MetadataField } from \"../ip-type-fields.js\";\nimport { Dropzone } from \"./dropzone.js\";\nimport { SuccessView } from \"./success-view.js\";\nimport { CoverUpload, FormatPicker, MINT_FORMATS, MediaRow, type MintFormat } from \"./asset-form-parts.js\";\nimport { handoffHref, type HandoffFormat } from \"../../utils/launchpad-handoff.js\";\nimport { CollectionSection, type CollectionMode } from \"./collection-section.js\";\nimport { LicensingSection } from \"./licensing-section.js\";\nimport { IpTypeSection } from \"./ip-type-section.js\";\nimport { DEFAULT_VALUES, type FormValues } from \"./form.js\";\nimport { IP_TYPE_BY_KIND, MEDIA_ROUTE_MIME_TYPES, detectMediaKind } from \"./media-kind.js\";\nimport { mintAsset } from \"./mint-asset.js\";\nimport { mintableCollections, type MintAssetType } from \"./mintable-collections.js\";\nimport { useIpfsUpload } from \"./use-ipfs-upload.js\";\nimport { useNewCollectionDraft } from \"./use-new-collection-draft.js\";\nimport type { FastMintProps, MediaKind, MintedAsset } from \"./types.js\";\n\nexport function FastMint(props: FastMintProps) {\n const {\n presentation = \"inline\", open = true, onClose, mediaKindLock, onMinted, onNavigate,\n collections, refetchCollections,\n hasWallet, walletAddress, onRequireWallet, connectLabel, getUploadToken, getSigner,\n client, successFooter,\n } = props;\n\n const [status, setStatus] = useState<\"idle\" | \"minting\" | \"success\" | \"error\">(\"idle\");\n const [errorMsg, setErrorMsg] = useState<string | null>(null);\n\n const media = useIpfsUpload();\n const feature = useIpfsUpload();\n const [mediaFile, setMediaFile] = useState<File | null>(null);\n const [mediaKind, setMediaKind] = useState<MediaKind>(\"image\");\n const mediaInputRef = useRef<HTMLInputElement>(null);\n const featureInputRef = useRef<HTMLInputElement>(null);\n\n const [format, setFormat] = useState<MintFormat>(\"single\");\n const assetType: MintAssetType = format === \"editions\" ? \"editions\" : \"single\";\n const handoffFormat: HandoffFormat | null = format === \"pop\" || format === \"tickets\" || format === \"club\" ? format : null;\n const [editionCount, setEditionCount] = useState(\"10\");\n\n const [collectionMode, setCollectionMode] = useState<CollectionMode>(\"existing\");\n const [existingCollectionId, setExistingCollectionId] = useState(\"\");\n const [existingCollectionContract, setExistingCollectionContract] = useState(\"\");\n\n const [ipType, setIpType] = useState<IPType>(\"NFT\");\n const templateFieldsRef = useRef<MetadataField[]>([]);\n\n const [mintedAsset, setMintedAsset] = useState<MintedAsset | null>(null);\n\n const form = useForm<FormValues>({ defaultValues: DEFAULT_VALUES });\n const name = form.watch(\"name\");\n const description = form.watch(\"description\");\n const draft = useNewCollectionDraft(name, description);\n\n useEffect(() => {\n if (walletAddress && !form.getValues(\"external_url\")) {\n form.setValue(\"external_url\", `https://medialane.io/account/${walletAddress}`);\n }\n }, [walletAddress, form]);\n\n const erc721Collections = mintableCollections(\"single\", collections);\n const erc1155Collections = mintableCollections(\"editions\", collections);\n\n const uploadFile = async (file: File, kind: SignedUploadKind) => {\n const token = await getUploadToken();\n if (!token) throw new Error(\"Sign in first\");\n return (await uploadFileToIpfs(client.api, file, kind)).uri;\n };\n\n const handleMediaSelect = async (file: File) => {\n const kind = detectMediaKind(file.type);\n if (!kind) {\n setErrorMsg(\"Publish an image, audio, video (JPG/PNG/GIF/SVG/WebP, MP3/WAV/OGG/FLAC, MP4/WebM), or document (PDF, DOC, DOCX, ODT, RTF, TXT, MD).\");\n return;\n }\n if (mediaKindLock && kind !== mediaKindLock) {\n setErrorMsg(`Please upload a${mediaKindLock === \"image\" ? \"n\" : \"\"} ${mediaKindLock}.`);\n return;\n }\n const route = MEDIA_ROUTE_MIME_TYPES.has(file.type) ? \"media\" : \"document\";\n const fileError = uploadError(file, route);\n if (fileError) {\n setErrorMsg(fileError);\n return;\n }\n setMediaFile(file);\n setMediaKind(kind);\n setIpType(IP_TYPE_BY_KIND[kind]);\n await media.start(file, (f) => uploadFile(f, route), setErrorMsg);\n };\n\n const clearMedia = () => {\n setMediaFile(null);\n media.clear();\n if (mediaInputRef.current) mediaInputRef.current.value = \"\";\n };\n\n const handoffImageUri = mediaKind === \"image\" ? media.uri : feature.uri;\n const handoffReady = !!media.uri && !media.uploading && !feature.uploading && !!handoffImageUri;\n\n const continueToCreate = () => {\n if (!handoffFormat || !handoffImageUri) return;\n const href = handoffHref(handoffFormat, { name, imageUri: handoffImageUri });\n onClose?.();\n if (onNavigate) onNavigate(href);\n else window.location.assign(href);\n };\n\n const ready = !!media.uri && !media.uploading && name.trim().length > 0 &&\n (mediaKind === \"image\" || !!feature.uri) &&\n (collectionMode === \"existing\"\n ? assetType === \"single\" ? !!existingCollectionId : !!existingCollectionContract\n : draft.name.trim().length > 0 && draft.symbol.trim().length > 0);\n\n const onSubmit = async (values: FormValues) => {\n if (!hasWallet) { onRequireWallet(); return; }\n if (!walletAddress || !media.uri) return;\n if (values.external_url && !values.external_url.startsWith(\"http://\") && !values.external_url.startsWith(\"https://\")) {\n setErrorMsg(\"External link must start with http:// or https://\");\n return;\n }\n\n setStatus(\"minting\");\n setErrorMsg(null);\n\n try {\n const asset = await mintAsset({\n client,\n signer: await getSigner(),\n walletAddress,\n values,\n ipType,\n templateFields: templateFieldsRef.current,\n mediaKind,\n mediaUri: media.uri,\n featureUri: feature.uri,\n assetType,\n editionCount,\n destination: collectionMode === \"new\"\n ? { mode: \"new\", name: draft.name, symbol: draft.symbol, description: draft.description }\n : { mode: \"existing\", collectionId: existingCollectionId, collectionContract: existingCollectionContract },\n singleCollections: erc721Collections,\n refetchCollections,\n getUploadToken,\n });\n if (asset) {\n setMintedAsset(asset);\n onMinted?.(asset);\n }\n setStatus(\"success\");\n } catch (err) {\n setErrorMsg(describeError(err).message);\n setStatus(\"error\");\n }\n };\n\n const resetAll = () => {\n setStatus(\"idle\");\n setErrorMsg(null);\n setMintedAsset(null);\n form.reset();\n clearMedia();\n feature.clear();\n setFormat(\"single\");\n setEditionCount(\"10\");\n setCollectionMode(\"existing\");\n setExistingCollectionId(\"\");\n setExistingCollectionContract(\"\");\n draft.reset();\n templateFieldsRef.current = [];\n };\n\n const busy = status === \"minting\";\n const previewImage = mediaKind === \"image\" ? media.preview : feature.preview;\n const selectedExistingCollection = assetType === \"single\"\n ? erc721Collections.find((c) => c.collectionId === existingCollectionId)\n : erc1155Collections.find((c) => c.contractAddress === existingCollectionContract);\n const formatTitle = MINT_FORMATS.find((f) => f.value === format)?.title ?? \"\";\n const collectionLabel = handoffFormat ? undefined : media.uri\n ? (collectionMode === \"new\"\n ? (draft.name || \"New collection\")\n : (selectedExistingCollection?.name || \"IP Asset\"))\n : undefined;\n\n const wrap = (node: React.ReactNode) => {\n if (presentation !== \"dialog\") return node;\n return (\n <Dialog open={open} onOpenChange={(next) => { if (!next) onClose?.(); }}>\n <DialogContent className=\"gap-0 p-6 sm:max-w-2xl sm:p-8\">\n <DialogTitle className=\"sr-only\">Create</DialogTitle>\n <DialogDescription className=\"sr-only\">Add media, describe it and publish it as an asset.</DialogDescription>\n {node}\n </DialogContent>\n </Dialog>\n );\n };\n\n if (status === \"success\") {\n return wrap(\n <SuccessView\n footer={successFooter}\n presentation={presentation}\n previewImage={previewImage}\n name={name}\n collectionLabel={collectionLabel}\n mintedAsset={mintedAsset}\n onPublishAnother={resetAll}\n />\n );\n }\n\n if (!mediaFile) {\n return wrap(\n <Dropzone\n mediaKindLock={mediaKindLock}\n presentation={presentation}\n hasWallet={hasWallet}\n onRequireWallet={onRequireWallet}\n connectLabel={connectLabel}\n onFileSelected={handleMediaSelect}\n />\n );\n }\n\n const submitBlocked = !ready || busy || !hasWallet;\n\n return wrap(\n <section className=\"space-y-6\">\n <MediaRow\n file={mediaFile}\n kind={mediaKind}\n preview={media.preview}\n uri={media.uri}\n uploading={media.uploading}\n ipType={ipType}\n inputRef={mediaInputRef}\n onSelect={handleMediaSelect}\n />\n\n {media.uri && (\n <div className=\"grid grid-cols-1 lg:grid-cols-[1fr_320px] gap-8 items-start\">\n <div className=\"space-y-5\">\n <FormatPicker\n value={format}\n onChange={setFormat}\n editionCount={editionCount}\n onEditionCount={setEditionCount}\n />\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Title{!handoffFormat && \" *\"}</label>\n <Input\n value={name}\n onChange={(e) => form.setValue(\"name\", e.target.value)}\n placeholder=\"My Creative Work\"\n />\n </div>\n\n {!handoffFormat && (\n <>\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Description</label>\n <Textarea\n value={description}\n onChange={(e) => form.setValue(\"description\", e.target.value)}\n placeholder=\"Describe your work, its story, and any context for buyers…\"\n rows={3}\n />\n </div>\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">External link <span className=\"text-muted-foreground font-normal\">(optional)</span></label>\n <Input\n value={form.watch(\"external_url\")}\n onChange={(e) => form.setValue(\"external_url\", e.target.value)}\n placeholder=\"https://yourwebsite.com\"\n />\n </div>\n </>\n )}\n\n {mediaKind !== \"image\" && (\n <CoverUpload\n preview={feature.preview}\n uploading={feature.uploading}\n inputRef={featureInputRef}\n onSelect={(file) => void feature.start(file, (f) => uploadFile(f, \"image\"), setErrorMsg)}\n />\n )}\n\n {!handoffFormat && (\n <>\n <CollectionSection\n assetType={assetType}\n mode={collectionMode}\n onModeChange={setCollectionMode}\n collections={assetType === \"single\" ? erc721Collections : erc1155Collections}\n existingId={existingCollectionId}\n existingContract={existingCollectionContract}\n onExistingId={setExistingCollectionId}\n onExistingContract={setExistingCollectionContract}\n draft={draft}\n previewImage={previewImage}\n />\n\n <LicensingSection form={form} />\n\n <IpTypeSection\n ipType={ipType}\n onIpTypeChange={setIpType}\n fieldsRef={templateFieldsRef}\n uploadDocument={(file) => uploadFile(file, \"document\")}\n existingDocument={mediaKind === \"document\" ? { uri: media.uri, name: mediaFile.name } : null}\n />\n </>\n )}\n\n {status === \"error\" && errorMsg && <p className=\"text-xs text-destructive\">{errorMsg}</p>}\n\n {handoffFormat ? (\n <button\n type=\"button\"\n disabled={!handoffReady}\n onClick={continueToCreate}\n className={cn(\n \"w-full h-12 text-base font-semibold text-white rounded-xl flex items-center justify-center gap-2 transition-all hover:brightness-110 active:scale-[0.98] bg-brand-blue\",\n !handoffReady && \"opacity-40 pointer-events-none\"\n )}\n >\n Continue to {formatTitle}\n </button>\n ) : (\n <>\n <button\n type=\"button\"\n disabled={submitBlocked}\n onClick={form.handleSubmit(onSubmit)}\n className={cn(\n \"w-full h-12 text-base font-semibold text-white rounded-xl flex items-center justify-center gap-2 transition-all hover:brightness-110 active:scale-[0.98] bg-brand-blue\",\n submitBlocked && \"opacity-40 pointer-events-none\"\n )}\n >\n {busy ? <><Loader2 className=\"h-4 w-4 animate-spin\" />Minting…</> : assetType === \"single\" ? \"Mint NFT\" : \"Mint Editions\"}\n </button>\n <p className=\"text-xs text-center text-muted-foreground\">\n Zero platform fees to mint.\n </p>\n </>\n )}\n </div>\n\n <div className=\"order-first lg:order-last lg:sticky lg:top-20 max-w-[260px] mx-auto w-full lg:max-w-none lg:mx-0\">\n <MedialaneCollectionCard\n image={previewImage}\n name={name}\n collection={collectionLabel}\n creator={walletAddress ? `${walletAddress.slice(0, 6)}…${walletAddress.slice(-4)}` : undefined}\n creatorHref={walletAddress ? profileHref({ address: walletAddress }) : undefined}\n />\n </div>\n </div>\n )}\n </section>\n );\n}\n"],"mappings":";AA0MQ,SAuEM,UAtEJ,KADF;AAxMR,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,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A,YACC,OAAO;AAAA,YACP;AAAA,YACA,YAAY;AAAA,YACZ,SAAS,gBAAgB,GAAG,cAAc,MAAM,GAAG,CAAC,CAAC,SAAI,cAAc,MAAM,EAAE,CAAC,KAAK;AAAA,YACrF,aAAa,gBAAgB,YAAY,EAAE,SAAS,cAAc,CAAC,IAAI;AAAA;AAAA,QACzE,GACF;AAAA,SACF;AAAA,OAEJ;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/fast-mint/fast-mint.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport { Loader2 } from \"lucide-react\";\nimport { profileHref } from \"@medialane/sdk\";\nimport { describeError } from \"../../utils/describe-error.js\";\nimport { uploadError } from \"../../utils/upload-limits.js\";\nimport { uploadFileToIpfs, type SignedUploadKind } from \"../../utils/ipfs-upload.js\";\nimport { invalidatePortfolioCache } from \"../../utils/portfolio-cache.js\";\nimport { cn } from \"../../utils/cn.js\";\nimport type { IPType } from \"../../data/ip.js\";\nimport { Input } from \"../input.js\";\nimport { Textarea } from \"../textarea.js\";\nimport { MedialaneCollectionCard } from \"../medialane-collection-card.js\";\nimport { Dialog, DialogContent, DialogDescription, DialogTitle } from \"../dialog.js\";\nimport type { MetadataField } from \"../ip-type-fields.js\";\nimport { Dropzone } from \"./dropzone.js\";\nimport { SuccessView } from \"./success-view.js\";\nimport { CoverUpload, FormatPicker, MediaRow } from \"./asset-form-parts.js\";\nimport { PartialCreateError, type StepInfo } from \"./create-then-add.js\";\nimport { FORMATS, getFormat, initialFormatStates } from \"./formats/registry.js\";\nimport type { FormatResult, FormatShared, MintFormat } from \"./formats/types.js\";\nimport { DEFAULT_VALUES, type FormValues } from \"./form.js\";\nimport { IP_TYPE_BY_KIND, MEDIA_ROUTE_MIME_TYPES, detectMediaKind } from \"./media-kind.js\";\nimport { useIpfsUpload } from \"./use-ipfs-upload.js\";\nimport { useNewCollectionDraft } from \"./use-new-collection-draft.js\";\nimport type { FastMintProps, MediaKind } from \"./types.js\";\n\nexport function FastMint(props: FastMintProps) {\n const {\n presentation = \"inline\", open = true, onClose, mediaKindLock, onMinted,\n collections, refetchCollections,\n hasWallet, walletAddress, onRequireWallet, connectLabel, getUploadToken, getSigner,\n client,\n } = props;\n\n const [status, setStatus] = useState<\"idle\" | \"minting\" | \"success\" | \"error\">(\"idle\");\n const [errorMsg, setErrorMsg] = useState<string | null>(null);\n const [step, setStep] = useState<StepInfo | null>(null);\n\n const media = useIpfsUpload();\n const feature = useIpfsUpload();\n const [mediaFile, setMediaFile] = useState<File | null>(null);\n const [mediaKind, setMediaKind] = useState<MediaKind>(\"image\");\n const mediaInputRef = useRef<HTMLInputElement>(null);\n const featureInputRef = useRef<HTMLInputElement>(null);\n\n const [formatKey, setFormatKey] = useState<MintFormat>(\"single\");\n const [formatStates, setFormatStates] = useState(initialFormatStates);\n const [resume, setResume] = useState<{ format: MintFormat; destination: unknown } | null>(null);\n const [result, setResult] = useState<FormatResult | null>(null);\n\n const [ipType, setIpType] = useState<IPType>(\"NFT\");\n const templateFieldsRef = useRef<MetadataField[]>([]);\n\n const form = useForm<FormValues>({ defaultValues: DEFAULT_VALUES });\n const name = form.watch(\"name\");\n const description = form.watch(\"description\");\n const draft = useNewCollectionDraft(name, description);\n\n useEffect(() => {\n if (walletAddress && !form.getValues(\"external_url\")) {\n form.setValue(\"external_url\", `https://medialane.io/account/${walletAddress}`);\n }\n }, [walletAddress, form]);\n\n const format = getFormat(formatKey);\n const formatState = formatStates[formatKey];\n const updateFormat = (patch: object) =>\n setFormatStates((states) => ({ ...states, [formatKey]: { ...(states[formatKey] as object), ...patch } }));\n\n const uploadFile = async (file: File, kind: SignedUploadKind) => {\n const token = await getUploadToken();\n if (!token) throw new Error(\"Sign in first\");\n return (await uploadFileToIpfs(client.api, file, kind)).uri;\n };\n\n const handleMediaSelect = async (file: File) => {\n const kind = detectMediaKind(file.type);\n if (!kind) {\n setErrorMsg(\"Publish an image, audio, video (JPG/PNG/GIF/SVG/WebP, MP3/WAV/OGG/FLAC, MP4/WebM), or document (PDF, DOC, DOCX, ODT, RTF, TXT, MD).\");\n return;\n }\n if (mediaKindLock && kind !== mediaKindLock) {\n setErrorMsg(`Please upload a${mediaKindLock === \"image\" ? \"n\" : \"\"} ${mediaKindLock}.`);\n return;\n }\n const route = MEDIA_ROUTE_MIME_TYPES.has(file.type) ? \"media\" : \"document\";\n const fileError = uploadError(file, route);\n if (fileError) {\n setErrorMsg(fileError);\n return;\n }\n setMediaFile(file);\n setMediaKind(kind);\n setIpType(IP_TYPE_BY_KIND[kind]);\n await media.start(file, (f) => uploadFile(f, route), setErrorMsg);\n };\n\n const clearMedia = () => {\n setMediaFile(null);\n media.clear();\n if (mediaInputRef.current) mediaInputRef.current.value = \"\";\n };\n\n const image = mediaKind === \"image\" ? media.uri : feature.uri;\n const previewImage = mediaKind === \"image\" ? media.preview : feature.preview;\n\n const shared: FormatShared | null = media.uri && image && mediaFile\n ? {\n form, draft, collections,\n walletAddress: walletAddress ?? \"\",\n mediaKind, mediaUri: media.uri, mediaName: mediaFile.name, image, previewImage,\n ipType, onIpTypeChange: setIpType, templateFieldsRef,\n uploadDocument: (file) => uploadFile(file, \"document\"),\n }\n : null;\n\n const ready = !!shared && !media.uploading && !feature.uploading && name.trim().length > 0 && format.isReady(shared, formatState);\n\n const onSubmit = async () => {\n if (!hasWallet) { onRequireWallet(); return; }\n if (!shared || !walletAddress) return;\n const link = form.getValues(\"external_url\");\n if (link && !link.startsWith(\"http://\") && !link.startsWith(\"https://\")) {\n setErrorMsg(\"External link must start with http:// or https://\");\n setStatus(\"error\");\n return;\n }\n\n setStatus(\"minting\");\n setErrorMsg(null);\n setStep(null);\n\n try {\n const outcome = await format.submit(shared, formatState, {\n client,\n signer: await getSigner(),\n getUploadToken,\n resume: resume?.format === formatKey ? resume.destination : null,\n onStep: setStep,\n });\n setResult(outcome);\n setResume(null);\n setStatus(\"success\");\n invalidatePortfolioCache(walletAddress);\n if (outcome.asset) onMinted?.(outcome.asset);\n void refetchCollections().catch(() => {});\n } catch (err) {\n if (err instanceof PartialCreateError) {\n setResume({ format: formatKey, destination: err.destination });\n setErrorMsg(`${err.message} ${describeError(err.reason).message} Press the button again to finish.`);\n } else {\n setErrorMsg(describeError(err).message);\n }\n setStatus(\"error\");\n }\n };\n\n const resetAll = () => {\n setStatus(\"idle\");\n setErrorMsg(null);\n setStep(null);\n setResult(null);\n setResume(null);\n form.reset();\n clearMedia();\n feature.clear();\n setFormatStates(initialFormatStates());\n draft.reset();\n templateFieldsRef.current = [];\n };\n\n const busy = status === \"minting\";\n\n const wrap = (node: React.ReactNode) => {\n if (presentation !== \"dialog\") return node;\n return (\n <Dialog open={open} onOpenChange={(next) => { if (!next) onClose?.(); }}>\n <DialogContent className=\"gap-0 p-6 sm:max-w-2xl sm:p-8\">\n <DialogTitle className=\"sr-only\">Create</DialogTitle>\n <DialogDescription className=\"sr-only\">Add media, describe it and publish it as an asset.</DialogDescription>\n {node}\n </DialogContent>\n </Dialog>\n );\n };\n\n if (status === \"success\" && result) {\n return wrap(\n <SuccessView presentation={presentation} previewImage={previewImage} result={result} onPublishAnother={resetAll} />\n );\n }\n\n if (!mediaFile) {\n return wrap(\n <Dropzone\n mediaKindLock={mediaKindLock}\n presentation={presentation}\n hasWallet={hasWallet}\n onRequireWallet={onRequireWallet}\n connectLabel={connectLabel}\n onFileSelected={handleMediaSelect}\n />\n );\n }\n\n const submitBlocked = !ready || busy || !hasWallet;\n const buttonLabel = busy\n ? `${step?.label ?? \"Working\"}…${step && step.total > 1 ? ` (${step.index} of ${step.total})` : \"\"}`\n : format.submitLabel(formatState);\n\n return wrap(\n <section className=\"space-y-6\">\n <MediaRow\n file={mediaFile}\n kind={mediaKind}\n preview={media.preview}\n uri={media.uri}\n uploading={media.uploading}\n ipType={ipType}\n inputRef={mediaInputRef}\n onSelect={handleMediaSelect}\n />\n\n {media.uri && (\n <div className=\"grid grid-cols-1 lg:grid-cols-[1fr_320px] gap-8 items-start\">\n <div className=\"space-y-5\">\n <FormatPicker formats={FORMATS} value={formatKey} onChange={setFormatKey} />\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Title *</label>\n <Input\n value={name}\n onChange={(e) => form.setValue(\"name\", e.target.value)}\n placeholder=\"My Creative Work\"\n />\n </div>\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Description</label>\n <Textarea\n value={description}\n onChange={(e) => form.setValue(\"description\", e.target.value)}\n placeholder=\"Describe your work, its story, and any context for buyers…\"\n rows={3}\n />\n </div>\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">External link <span className=\"text-muted-foreground font-normal\">(optional)</span></label>\n <Input\n value={form.watch(\"external_url\")}\n onChange={(e) => form.setValue(\"external_url\", e.target.value)}\n placeholder=\"https://yourwebsite.com\"\n />\n </div>\n\n {mediaKind !== \"image\" && (\n <CoverUpload\n preview={feature.preview}\n uploading={feature.uploading}\n inputRef={featureInputRef}\n onSelect={(file) => void feature.start(file, (f) => uploadFile(f, \"image\"), setErrorMsg)}\n />\n )}\n\n {shared && <format.Fields shared={shared} state={formatState} update={updateFormat} />}\n\n {status === \"error\" && errorMsg && <p className=\"text-xs text-destructive\">{errorMsg}</p>}\n\n <button\n type=\"button\"\n disabled={submitBlocked}\n onClick={() => void onSubmit()}\n className={cn(\n \"w-full h-12 text-base font-semibold text-white rounded-xl flex items-center justify-center gap-2 transition-all hover:brightness-110 active:scale-[0.98] bg-brand-blue\",\n submitBlocked && \"opacity-40 pointer-events-none\"\n )}\n >\n {busy && <Loader2 className=\"h-4 w-4 animate-spin\" />}\n {buttonLabel}\n </button>\n <p className=\"text-xs text-center text-muted-foreground\">\n Zero platform fees to mint.\n </p>\n </div>\n\n <div className=\"order-first lg:order-last lg:sticky lg:top-20 max-w-[260px] mx-auto w-full lg:max-w-none lg:mx-0\">\n <MedialaneCollectionCard\n image={previewImage}\n name={name}\n collection={shared ? format.previewLabel(shared, formatState) : undefined}\n creator={walletAddress ? `${walletAddress.slice(0, 6)}…${walletAddress.slice(-4)}` : undefined}\n creatorHref={walletAddress ? profileHref({ address: walletAddress }) : undefined}\n />\n </div>\n </div>\n )}\n </section>\n );\n}\n"],"mappings":";AAoLQ,SACE,KADF;AAlLR,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAC5B,SAAS,wBAA+C;AACxD,SAAS,gCAAgC;AACzC,SAAS,UAAU;AAEnB,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,+BAA+B;AACxC,SAAS,QAAQ,eAAe,mBAAmB,mBAAmB;AAEtE,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAC5B,SAAS,aAAa,cAAc,gBAAgB;AACpD,SAAS,0BAAyC;AAClD,SAAS,SAAS,WAAW,2BAA2B;AAExD,SAAS,sBAAuC;AAChD,SAAS,iBAAiB,wBAAwB,uBAAuB;AACzE,SAAS,qBAAqB;AAC9B,SAAS,6BAA6B;AAG/B,SAAS,SAAS,OAAsB;AAC7C,QAAM;AAAA,IACJ,eAAe;AAAA,IAAU,OAAO;AAAA,IAAM;AAAA,IAAS;AAAA,IAAe;AAAA,IAC9D;AAAA,IAAa;AAAA,IACb;AAAA,IAAW;AAAA,IAAe;AAAA,IAAiB;AAAA,IAAc;AAAA,IAAgB;AAAA,IACzE;AAAA,EACF,IAAI;AAEJ,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAmD,MAAM;AACrF,QAAM,CAAC,UAAU,WAAW,IAAI,SAAwB,IAAI;AAC5D,QAAM,CAAC,MAAM,OAAO,IAAI,SAA0B,IAAI;AAEtD,QAAM,QAAQ,cAAc;AAC5B,QAAM,UAAU,cAAc;AAC9B,QAAM,CAAC,WAAW,YAAY,IAAI,SAAsB,IAAI;AAC5D,QAAM,CAAC,WAAW,Y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