@medialane/ui 0.365.0 → 0.366.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.
Files changed (36) hide show
  1. package/dist/components/account/input-otp.d.cts +2 -2
  2. package/dist/components/account/input-otp.d.ts +2 -2
  3. package/dist/components/button.d.cts +2 -2
  4. package/dist/components/button.d.ts +2 -2
  5. package/dist/components/fast-mint/asset-form-parts.cjs +19 -12
  6. package/dist/components/fast-mint/asset-form-parts.cjs.map +1 -1
  7. package/dist/components/fast-mint/asset-form-parts.d.cts +14 -6
  8. package/dist/components/fast-mint/asset-form-parts.d.ts +14 -6
  9. package/dist/components/fast-mint/asset-form-parts.js +18 -12
  10. package/dist/components/fast-mint/asset-form-parts.js.map +1 -1
  11. package/dist/components/fast-mint/fast-mint.cjs +111 -73
  12. package/dist/components/fast-mint/fast-mint.cjs.map +1 -1
  13. package/dist/components/fast-mint/fast-mint.js +112 -74
  14. package/dist/components/fast-mint/fast-mint.js.map +1 -1
  15. package/dist/components/fast-mint/types.cjs.map +1 -1
  16. package/dist/components/fast-mint/types.d.cts +1 -0
  17. package/dist/components/fast-mint/types.d.ts +1 -0
  18. package/dist/components/launchpad/collection-create-form.cjs +12 -3
  19. package/dist/components/launchpad/collection-create-form.cjs.map +1 -1
  20. package/dist/components/launchpad/collection-create-form.js +12 -3
  21. package/dist/components/launchpad/collection-create-form.js.map +1 -1
  22. package/dist/components/launchpad/edition-mint-schema.d.cts +4 -4
  23. package/dist/components/launchpad/edition-mint-schema.d.ts +4 -4
  24. package/dist/components/launchpad/pop-create.cjs +10 -1
  25. package/dist/components/launchpad/pop-create.cjs.map +1 -1
  26. package/dist/components/launchpad/pop-create.js +10 -1
  27. package/dist/components/launchpad/pop-create.js.map +1 -1
  28. package/dist/utils/launchpad-handoff.cjs +62 -0
  29. package/dist/utils/launchpad-handoff.cjs.map +1 -0
  30. package/dist/utils/launchpad-handoff.d.cts +11 -0
  31. package/dist/utils/launchpad-handoff.d.ts +11 -0
  32. package/dist/utils/launchpad-handoff.js +35 -0
  33. package/dist/utils/launchpad-handoff.js.map +1 -0
  34. package/dist/utils/media-wallet/use-erc20-balance.d.cts +1 -1
  35. package/dist/utils/media-wallet/use-erc20-balance.d.ts +1 -1
  36. package/package.json +1 -1
@@ -38,6 +38,7 @@ var import_dialog = require("../dialog.js");
38
38
  var import_dropzone = require("./dropzone.js");
39
39
  var import_success_view = require("./success-view.js");
40
40
  var import_asset_form_parts = require("./asset-form-parts.js");
41
+ var import_launchpad_handoff = require("../../utils/launchpad-handoff.js");
41
42
  var import_collection_section = require("./collection-section.js");
42
43
  var import_licensing_section = require("./licensing-section.js");
43
44
  var import_ip_type_section = require("./ip-type-section.js");
@@ -54,6 +55,7 @@ function FastMint(props) {
54
55
  onClose,
55
56
  mediaKindLock,
56
57
  onMinted,
58
+ onNavigate,
57
59
  collections,
58
60
  refetchCollections,
59
61
  hasWallet,
@@ -73,7 +75,9 @@ function FastMint(props) {
73
75
  const [mediaKind, setMediaKind] = (0, import_react.useState)("image");
74
76
  const mediaInputRef = (0, import_react.useRef)(null);
75
77
  const featureInputRef = (0, import_react.useRef)(null);
76
- const [assetType, setAssetType] = (0, import_react.useState)("single");
78
+ const [format, setFormat] = (0, import_react.useState)("single");
79
+ const assetType = format === "editions" ? "editions" : "single";
80
+ const handoffFormat = format === "pop" || format === "tickets" || format === "club" ? format : null;
77
81
  const [editionCount, setEditionCount] = (0, import_react.useState)("10");
78
82
  const [collectionMode, setCollectionMode] = (0, import_react.useState)("existing");
79
83
  const [existingCollectionId, setExistingCollectionId] = (0, import_react.useState)("");
@@ -123,6 +127,15 @@ function FastMint(props) {
123
127
  media.clear();
124
128
  if (mediaInputRef.current) mediaInputRef.current.value = "";
125
129
  };
130
+ const handoffImageUri = mediaKind === "image" ? media.uri : feature.uri;
131
+ const handoffReady = !!media.uri && !media.uploading && !feature.uploading && !!handoffImageUri;
132
+ const continueToCreate = () => {
133
+ if (!handoffFormat || !handoffImageUri) return;
134
+ const href = (0, import_launchpad_handoff.handoffHref)(handoffFormat, { name, imageUri: handoffImageUri });
135
+ onClose?.();
136
+ if (onNavigate) onNavigate(href);
137
+ else window.location.assign(href);
138
+ };
126
139
  const ready = !!media.uri && !media.uploading && name.trim().length > 0 && (mediaKind === "image" || !!feature.uri) && (collectionMode === "existing" ? assetType === "single" ? !!existingCollectionId : !!existingCollectionContract : draft.name.trim().length > 0 && draft.symbol.trim().length > 0);
127
140
  const onSubmit = async (values) => {
128
141
  if (!hasWallet) {
@@ -171,7 +184,7 @@ function FastMint(props) {
171
184
  form.reset();
172
185
  clearMedia();
173
186
  feature.clear();
174
- setAssetType("single");
187
+ setFormat("single");
175
188
  setEditionCount("10");
176
189
  setCollectionMode("existing");
177
190
  setExistingCollectionId("");
@@ -182,7 +195,8 @@ function FastMint(props) {
182
195
  const busy = status === "minting";
183
196
  const previewImage = mediaKind === "image" ? media.preview : feature.preview;
184
197
  const selectedExistingCollection = assetType === "single" ? erc721Collections.find((c) => c.collectionId === existingCollectionId) : erc1155Collections.find((c) => c.contractAddress === existingCollectionContract);
185
- const collectionLabel = media.uri ? collectionMode === "new" ? draft.name || "New collection" : selectedExistingCollection?.name || "IP Asset" : void 0;
198
+ const formatTitle = import_asset_form_parts.MINT_FORMATS.find((f) => f.value === format)?.title ?? "";
199
+ const collectionLabel = handoffFormat ? void 0 : media.uri ? collectionMode === "new" ? draft.name || "New collection" : selectedExistingCollection?.name || "IP Asset" : void 0;
186
200
  const wrap = (node) => {
187
201
  if (presentation !== "dialog") return node;
188
202
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog, { open, onOpenChange: (next) => {
@@ -242,8 +256,20 @@ function FastMint(props) {
242
256
  ),
243
257
  media.uri && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid grid-cols-1 lg:grid-cols-[1fr_320px] gap-8 items-start", children: [
244
258
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-5", children: [
259
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
260
+ import_asset_form_parts.FormatPicker,
261
+ {
262
+ value: format,
263
+ onChange: setFormat,
264
+ editionCount,
265
+ onEditionCount: setEditionCount
266
+ }
267
+ ),
245
268
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
246
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: "text-sm font-medium", children: "Title *" }),
269
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "text-sm font-medium", children: [
270
+ "Title",
271
+ !handoffFormat && " *"
272
+ ] }),
247
273
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
248
274
  import_input.Input,
249
275
  {
@@ -253,31 +279,33 @@ function FastMint(props) {
253
279
  }
254
280
  )
255
281
  ] }),
256
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
257
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: "text-sm font-medium", children: "Description" }),
258
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
259
- import_textarea.Textarea,
260
- {
261
- value: description,
262
- onChange: (e) => form.setValue("description", e.target.value),
263
- placeholder: "Describe your work, its story, and any context for buyers\u2026",
264
- rows: 3
265
- }
266
- )
267
- ] }),
268
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
269
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "text-sm font-medium", children: [
270
- "External link ",
271
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-muted-foreground font-normal", children: "(optional)" })
282
+ !handoffFormat && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
283
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
284
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: "text-sm font-medium", children: "Description" }),
285
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
286
+ import_textarea.Textarea,
287
+ {
288
+ value: description,
289
+ onChange: (e) => form.setValue("description", e.target.value),
290
+ placeholder: "Describe your work, its story, and any context for buyers\u2026",
291
+ rows: 3
292
+ }
293
+ )
272
294
  ] }),
273
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
274
- import_input.Input,
275
- {
276
- value: form.watch("external_url"),
277
- onChange: (e) => form.setValue("external_url", e.target.value),
278
- placeholder: "https://yourwebsite.com"
279
- }
280
- )
295
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
296
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "text-sm font-medium", children: [
297
+ "External link ",
298
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-muted-foreground font-normal", children: "(optional)" })
299
+ ] }),
300
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
301
+ import_input.Input,
302
+ {
303
+ value: form.watch("external_url"),
304
+ onChange: (e) => form.setValue("external_url", e.target.value),
305
+ placeholder: "https://yourwebsite.com"
306
+ }
307
+ )
308
+ ] })
281
309
  ] }),
282
310
  mediaKind !== "image" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
283
311
  import_asset_form_parts.CoverUpload,
@@ -288,59 +316,69 @@ function FastMint(props) {
288
316
  onSelect: (file) => void feature.start(file, (f) => uploadFile(f, "image"), setErrorMsg)
289
317
  }
290
318
  ),
291
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
292
- import_asset_form_parts.AssetTypePicker,
293
- {
294
- value: assetType,
295
- onChange: setAssetType,
296
- editionCount,
297
- onEditionCount: setEditionCount
298
- }
299
- ),
300
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
301
- import_collection_section.CollectionSection,
302
- {
303
- assetType,
304
- mode: collectionMode,
305
- onModeChange: setCollectionMode,
306
- collections: assetType === "single" ? erc721Collections : erc1155Collections,
307
- existingId: existingCollectionId,
308
- existingContract: existingCollectionContract,
309
- onExistingId: setExistingCollectionId,
310
- onExistingContract: setExistingCollectionContract,
311
- draft,
312
- previewImage
313
- }
314
- ),
315
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_licensing_section.LicensingSection, { form }),
316
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
317
- import_ip_type_section.IpTypeSection,
318
- {
319
- ipType,
320
- onIpTypeChange: setIpType,
321
- fieldsRef: templateFieldsRef,
322
- uploadDocument: (file) => uploadFile(file, "document"),
323
- existingDocument: mediaKind === "document" ? { uri: media.uri, name: mediaFile.name } : null
324
- }
325
- ),
319
+ !handoffFormat && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
320
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
321
+ import_collection_section.CollectionSection,
322
+ {
323
+ assetType,
324
+ mode: collectionMode,
325
+ onModeChange: setCollectionMode,
326
+ collections: assetType === "single" ? erc721Collections : erc1155Collections,
327
+ existingId: existingCollectionId,
328
+ existingContract: existingCollectionContract,
329
+ onExistingId: setExistingCollectionId,
330
+ onExistingContract: setExistingCollectionContract,
331
+ draft,
332
+ previewImage
333
+ }
334
+ ),
335
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_licensing_section.LicensingSection, { form }),
336
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
337
+ import_ip_type_section.IpTypeSection,
338
+ {
339
+ ipType,
340
+ onIpTypeChange: setIpType,
341
+ fieldsRef: templateFieldsRef,
342
+ uploadDocument: (file) => uploadFile(file, "document"),
343
+ existingDocument: mediaKind === "document" ? { uri: media.uri, name: mediaFile.name } : null
344
+ }
345
+ )
346
+ ] }),
326
347
  status === "error" && errorMsg && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-destructive", children: errorMsg }),
327
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
348
+ handoffFormat ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
328
349
  "button",
329
350
  {
330
351
  type: "button",
331
- disabled: submitBlocked,
332
- onClick: form.handleSubmit(onSubmit),
352
+ disabled: !handoffReady,
353
+ onClick: continueToCreate,
333
354
  className: (0, import_cn.cn)(
334
355
  "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",
335
- submitBlocked && "opacity-40 pointer-events-none"
356
+ !handoffReady && "opacity-40 pointer-events-none"
336
357
  ),
337
- children: busy ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
338
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Loader2, { className: "h-4 w-4 animate-spin" }),
339
- "Minting\u2026"
340
- ] }) : assetType === "single" ? "Mint NFT" : "Mint Editions"
358
+ children: [
359
+ "Continue to ",
360
+ formatTitle
361
+ ]
341
362
  }
342
- ),
343
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-center text-muted-foreground", children: "Zero platform fees to mint." })
363
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
364
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
365
+ "button",
366
+ {
367
+ type: "button",
368
+ disabled: submitBlocked,
369
+ onClick: form.handleSubmit(onSubmit),
370
+ className: (0, import_cn.cn)(
371
+ "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",
372
+ submitBlocked && "opacity-40 pointer-events-none"
373
+ ),
374
+ children: busy ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
375
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Loader2, { className: "h-4 w-4 animate-spin" }),
376
+ "Minting\u2026"
377
+ ] }) : assetType === "single" ? "Mint NFT" : "Mint Editions"
378
+ }
379
+ ),
380
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-center text-muted-foreground", children: "Zero platform fees to mint." })
381
+ ] })
344
382
  ] }),
345
383
  /* @__PURE__ */ (0, import_jsx_runtime.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__ */ (0, import_jsx_runtime.jsx)(
346
384
  import_medialane_collection_card.MedialaneCollectionCard,
@@ -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 { AssetTypePicker, CoverUpload, MediaRow } from \"./asset-form-parts.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,\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 [assetType, setAssetType] = useState<MintAssetType>(\"single\");\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 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 setAssetType(\"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 collectionLabel = 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 <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 <AssetTypePicker\n value={assetType}\n onChange={setAssetType}\n editionCount={editionCount}\n onEditionCount={setEditionCount}\n />\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 {status === \"error\" && errorMsg && <p className=\"text-xs text-destructive\">{errorMsg}</p>}\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 </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":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2LQ;AAzLR,mBAA4C;AAC5C,6BAAwB;AACxB,0BAAwB;AACxB,iBAA4B;AAC5B,4BAA8B;AAC9B,2BAA4B;AAC5B,yBAAwD;AACxD,gBAAmB;AAEnB,mBAAsB;AACtB,sBAAyB;AACzB,uCAAwC;AACxC,oBAAsE;AAEtE,sBAAyB;AACzB,0BAA4B;AAC5B,8BAAuD;AACvD,gCAAuD;AACvD,+BAAiC;AACjC,6BAA8B;AAC9B,kBAAgD;AAChD,wBAAyE;AACzE,wBAA0B;AAC1B,kCAAwD;AACxD,6BAA8B;AAC9B,sCAAsC;AAG/B,SAAS,SAAS,OAAsB;AAC7C,QAAM;AAAA,IACJ,eAAe;AAAA,IAAU,OAAO;AAAA,IAAM;A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ACF;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 { 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":";;;;;;;;;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C,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,oBAAgB,wBAAY,EAAE,SAAS,cAAc,CAAC,IAAI;AAAA;AAAA,QACzE,GACF;AAAA,SACF;AAAA,OAEJ;AAAA,EACF;AACF;","names":[]}
@@ -14,7 +14,8 @@ import { MedialaneCollectionCard } from "../medialane-collection-card.js";
14
14
  import { Dialog, DialogContent, DialogDescription, DialogTitle } from "../dialog.js";
15
15
  import { Dropzone } from "./dropzone.js";
16
16
  import { SuccessView } from "./success-view.js";
17
- import { AssetTypePicker, CoverUpload, MediaRow } from "./asset-form-parts.js";
17
+ import { CoverUpload, FormatPicker, MINT_FORMATS, MediaRow } from "./asset-form-parts.js";
18
+ import { handoffHref } from "../../utils/launchpad-handoff.js";
18
19
  import { CollectionSection } from "./collection-section.js";
19
20
  import { LicensingSection } from "./licensing-section.js";
20
21
  import { IpTypeSection } from "./ip-type-section.js";
@@ -31,6 +32,7 @@ function FastMint(props) {
31
32
  onClose,
32
33
  mediaKindLock,
33
34
  onMinted,
35
+ onNavigate,
34
36
  collections,
35
37
  refetchCollections,
36
38
  hasWallet,
@@ -50,7 +52,9 @@ function FastMint(props) {
50
52
  const [mediaKind, setMediaKind] = useState("image");
51
53
  const mediaInputRef = useRef(null);
52
54
  const featureInputRef = useRef(null);
53
- const [assetType, setAssetType] = useState("single");
55
+ const [format, setFormat] = useState("single");
56
+ const assetType = format === "editions" ? "editions" : "single";
57
+ const handoffFormat = format === "pop" || format === "tickets" || format === "club" ? format : null;
54
58
  const [editionCount, setEditionCount] = useState("10");
55
59
  const [collectionMode, setCollectionMode] = useState("existing");
56
60
  const [existingCollectionId, setExistingCollectionId] = useState("");
@@ -100,6 +104,15 @@ function FastMint(props) {
100
104
  media.clear();
101
105
  if (mediaInputRef.current) mediaInputRef.current.value = "";
102
106
  };
107
+ const handoffImageUri = mediaKind === "image" ? media.uri : feature.uri;
108
+ const handoffReady = !!media.uri && !media.uploading && !feature.uploading && !!handoffImageUri;
109
+ const continueToCreate = () => {
110
+ if (!handoffFormat || !handoffImageUri) return;
111
+ const href = handoffHref(handoffFormat, { name, imageUri: handoffImageUri });
112
+ onClose?.();
113
+ if (onNavigate) onNavigate(href);
114
+ else window.location.assign(href);
115
+ };
103
116
  const ready = !!media.uri && !media.uploading && name.trim().length > 0 && (mediaKind === "image" || !!feature.uri) && (collectionMode === "existing" ? assetType === "single" ? !!existingCollectionId : !!existingCollectionContract : draft.name.trim().length > 0 && draft.symbol.trim().length > 0);
104
117
  const onSubmit = async (values) => {
105
118
  if (!hasWallet) {
@@ -148,7 +161,7 @@ function FastMint(props) {
148
161
  form.reset();
149
162
  clearMedia();
150
163
  feature.clear();
151
- setAssetType("single");
164
+ setFormat("single");
152
165
  setEditionCount("10");
153
166
  setCollectionMode("existing");
154
167
  setExistingCollectionId("");
@@ -159,7 +172,8 @@ function FastMint(props) {
159
172
  const busy = status === "minting";
160
173
  const previewImage = mediaKind === "image" ? media.preview : feature.preview;
161
174
  const selectedExistingCollection = assetType === "single" ? erc721Collections.find((c) => c.collectionId === existingCollectionId) : erc1155Collections.find((c) => c.contractAddress === existingCollectionContract);
162
- const collectionLabel = media.uri ? collectionMode === "new" ? draft.name || "New collection" : selectedExistingCollection?.name || "IP Asset" : void 0;
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;
163
177
  const wrap = (node) => {
164
178
  if (presentation !== "dialog") return node;
165
179
  return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: (next) => {
@@ -219,8 +233,20 @@ function FastMint(props) {
219
233
  ),
220
234
  media.uri && /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-[1fr_320px] gap-8 items-start", children: [
221
235
  /* @__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
+ ),
222
245
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
223
- /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Title *" }),
246
+ /* @__PURE__ */ jsxs("label", { className: "text-sm font-medium", children: [
247
+ "Title",
248
+ !handoffFormat && " *"
249
+ ] }),
224
250
  /* @__PURE__ */ jsx(
225
251
  Input,
226
252
  {
@@ -230,31 +256,33 @@ function FastMint(props) {
230
256
  }
231
257
  )
232
258
  ] }),
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)" })
259
+ !handoffFormat && /* @__PURE__ */ jsxs(Fragment, { children: [
260
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
261
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Description" }),
262
+ /* @__PURE__ */ jsx(
263
+ Textarea,
264
+ {
265
+ value: description,
266
+ onChange: (e) => form.setValue("description", e.target.value),
267
+ placeholder: "Describe your work, its story, and any context for buyers\u2026",
268
+ rows: 3
269
+ }
270
+ )
249
271
  ] }),
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
- )
272
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
273
+ /* @__PURE__ */ jsxs("label", { className: "text-sm font-medium", children: [
274
+ "External link ",
275
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground font-normal", children: "(optional)" })
276
+ ] }),
277
+ /* @__PURE__ */ jsx(
278
+ Input,
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
+ ] })
258
286
  ] }),
259
287
  mediaKind !== "image" && /* @__PURE__ */ jsx(
260
288
  CoverUpload,
@@ -265,59 +293,69 @@ function FastMint(props) {
265
293
  onSelect: (file) => void feature.start(file, (f) => uploadFile(f, "image"), setErrorMsg)
266
294
  }
267
295
  ),
268
- /* @__PURE__ */ jsx(
269
- AssetTypePicker,
270
- {
271
- value: assetType,
272
- onChange: setAssetType,
273
- editionCount,
274
- onEditionCount: setEditionCount
275
- }
276
- ),
277
- /* @__PURE__ */ jsx(
278
- CollectionSection,
279
- {
280
- assetType,
281
- mode: collectionMode,
282
- onModeChange: setCollectionMode,
283
- collections: assetType === "single" ? erc721Collections : erc1155Collections,
284
- existingId: existingCollectionId,
285
- existingContract: existingCollectionContract,
286
- onExistingId: setExistingCollectionId,
287
- onExistingContract: setExistingCollectionContract,
288
- draft,
289
- previewImage
290
- }
291
- ),
292
- /* @__PURE__ */ jsx(LicensingSection, { form }),
293
- /* @__PURE__ */ jsx(
294
- IpTypeSection,
295
- {
296
- ipType,
297
- onIpTypeChange: setIpType,
298
- fieldsRef: templateFieldsRef,
299
- uploadDocument: (file) => uploadFile(file, "document"),
300
- existingDocument: mediaKind === "document" ? { uri: media.uri, name: mediaFile.name } : null
301
- }
302
- ),
296
+ !handoffFormat && /* @__PURE__ */ jsxs(Fragment, { children: [
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
+ ] }),
303
324
  status === "error" && errorMsg && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: errorMsg }),
304
- /* @__PURE__ */ jsx(
325
+ handoffFormat ? /* @__PURE__ */ jsxs(
305
326
  "button",
306
327
  {
307
328
  type: "button",
308
- disabled: submitBlocked,
309
- onClick: form.handleSubmit(onSubmit),
329
+ disabled: !handoffReady,
330
+ onClick: continueToCreate,
310
331
  className: cn(
311
332
  "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",
312
- submitBlocked && "opacity-40 pointer-events-none"
333
+ !handoffReady && "opacity-40 pointer-events-none"
313
334
  ),
314
- children: busy ? /* @__PURE__ */ jsxs(Fragment, { children: [
315
- /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }),
316
- "Minting\u2026"
317
- ] }) : assetType === "single" ? "Mint NFT" : "Mint Editions"
335
+ children: [
336
+ "Continue to ",
337
+ formatTitle
338
+ ]
318
339
  }
319
- ),
320
- /* @__PURE__ */ jsx("p", { className: "text-xs text-center text-muted-foreground", children: "Zero platform fees to mint." })
340
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
341
+ /* @__PURE__ */ jsx(
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
+ ] })
321
359
  ] }),
322
360
  /* @__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(
323
361
  MedialaneCollectionCard,