@medialane/ui 0.364.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.
- package/dist/components/fast-mint/asset-form-parts.cjs +19 -12
- package/dist/components/fast-mint/asset-form-parts.cjs.map +1 -1
- package/dist/components/fast-mint/asset-form-parts.d.cts +14 -6
- package/dist/components/fast-mint/asset-form-parts.d.ts +14 -6
- package/dist/components/fast-mint/asset-form-parts.js +18 -12
- package/dist/components/fast-mint/asset-form-parts.js.map +1 -1
- package/dist/components/fast-mint/fast-mint.cjs +111 -73
- package/dist/components/fast-mint/fast-mint.cjs.map +1 -1
- package/dist/components/fast-mint/fast-mint.js +112 -74
- package/dist/components/fast-mint/fast-mint.js.map +1 -1
- package/dist/components/fast-mint/types.cjs.map +1 -1
- package/dist/components/fast-mint/types.d.cts +1 -0
- package/dist/components/fast-mint/types.d.ts +1 -0
- package/dist/components/launchpad/collection-create-form.cjs +12 -3
- package/dist/components/launchpad/collection-create-form.cjs.map +1 -1
- package/dist/components/launchpad/collection-create-form.js +12 -3
- package/dist/components/launchpad/collection-create-form.js.map +1 -1
- package/dist/components/launchpad/pop-create.cjs +10 -1
- package/dist/components/launchpad/pop-create.cjs.map +1 -1
- package/dist/components/launchpad/pop-create.js +10 -1
- package/dist/components/launchpad/pop-create.js.map +1 -1
- package/dist/components/launchpad-filter-bar.cjs +20 -35
- package/dist/components/launchpad-filter-bar.cjs.map +1 -1
- package/dist/components/launchpad-filter-bar.d.cts +6 -6
- package/dist/components/launchpad-filter-bar.d.ts +6 -6
- package/dist/components/launchpad-filter-bar.js +21 -38
- package/dist/components/launchpad-filter-bar.js.map +1 -1
- package/dist/components/launchpad-page.cjs +10 -22
- package/dist/components/launchpad-page.cjs.map +1 -1
- package/dist/components/launchpad-page.js +11 -23
- package/dist/components/launchpad-page.js.map +1 -1
- package/dist/components/launchpad-services.cjs +41 -52
- package/dist/components/launchpad-services.cjs.map +1 -1
- package/dist/components/launchpad-services.d.cts +11 -10
- package/dist/components/launchpad-services.d.ts +11 -10
- package/dist/components/launchpad-services.js +40 -53
- package/dist/components/launchpad-services.js.map +1 -1
- package/dist/data/launchpad-services.cjs +21 -16
- package/dist/data/launchpad-services.cjs.map +1 -1
- package/dist/data/launchpad-services.d.cts +1 -1
- package/dist/data/launchpad-services.d.ts +1 -1
- package/dist/data/launchpad-services.js +21 -16
- package/dist/data/launchpad-services.js.map +1 -1
- package/dist/utils/launchpad-handoff.cjs +62 -0
- package/dist/utils/launchpad-handoff.cjs.map +1 -0
- package/dist/utils/launchpad-handoff.d.cts +11 -0
- package/dist/utils/launchpad-handoff.d.ts +11 -0
- package/dist/utils/launchpad-handoff.js +35 -0
- package/dist/utils/launchpad-handoff.js.map +1 -0
- package/package.json +1 -1
|
@@ -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,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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":[]}
|
|
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":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA0MQ;AAxMR,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,8BAAmF;AACnF,+BAAgD;AAChD,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;AAAA,IAAS;AAAA,IAAe;AAAA,IAAU;AAAA,IACxE;AAAA,IAAa;AAAA,IACb;AAAA,IAAW;AAAA,IAAe;AAAA,IAAiB;AAAA,IAAc;AAAA,IAAgB;AAAA,IACzE;AAAA,IAAQ;AAAA,EACV,IAAI;AAEJ,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAmD,MAAM;AACrF,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAwB,IAAI;AAE5D,QAAM,YAAQ,sCAAc;AAC5B,QAAM,cAAU,sCAAc;AAC9B,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAsB,IAAI;AAC5D,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAoB,OAAO;AAC7D,QAAM,oBAAgB,qBAAyB,IAAI;AACnD,QAAM,sBAAkB,qBAAyB,IAAI;AAErD,QAAM,CAAC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E;AAAA,mBAAQ,IAAM,cAAc,WAAW,aAAa;AAAA;AAAA,YAC5G;AAAA,YACA,4CAAC,OAAE,WAAU,6CAA4C,yCAEzD;AAAA,aACF;AAAA,WAEJ;AAAA,QAEA,4CAAC,SAAI,WAAU,oGACb;AAAA,UAAC;AAAA;AAAA,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,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 {
|
|
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 [
|
|
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
|
-
|
|
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
|
|
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__ */
|
|
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(
|
|
234
|
-
/* @__PURE__ */
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
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__ */
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
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__ */
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
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__ */
|
|
325
|
+
handoffFormat ? /* @__PURE__ */ jsxs(
|
|
305
326
|
"button",
|
|
306
327
|
{
|
|
307
328
|
type: "button",
|
|
308
|
-
disabled:
|
|
309
|
-
onClick:
|
|
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
|
-
|
|
333
|
+
!handoffReady && "opacity-40 pointer-events-none"
|
|
313
334
|
),
|
|
314
|
-
children:
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
]
|
|
335
|
+
children: [
|
|
336
|
+
"Continue to ",
|
|
337
|
+
formatTitle
|
|
338
|
+
]
|
|
318
339
|
}
|
|
319
|
-
),
|
|
320
|
-
|
|
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,
|
|
@@ -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":";AA2LQ,SAoIc,UAnIZ,KADF;AAzLR,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,UAAU;AAEnB,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,+BAA+B;AACxC,SAAS,QAAQ,eAAe,mBAAmB,mBAAmB;AAEtE,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AA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zD;AAAA,WACF;AAAA,QAEA,oBAAC,SAAI,WAAU,oGACb;AAAA,UAAC;AAAA;AAAA,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 { 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,SAAS,mBAAmB;AAC5B,SAAS,wBAA+C;AACxD,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,cAAc,gBAAiC;AACnF,SAAS,mBAAuC;AAChD,SAAS,yBAA8C;AACvD,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAC9B,SAAS,sBAAuC;AAChD,SAAS,iBAAiB,wBAAwB,uBAAuB;AACzE,SAAS,iBAAiB;AAC1B,SAAS,2BAA+C;AACxD,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,IAAU;AAAA,IACxE;AAAA,IAAa;AAAA,IACb;AAAA,IAAW;AAAA,IAAe;AAAA,IAAiB;AAAA,IAAc;AAAA,IAAgB;AAAA,IACzE;AAAA,IAAQ;AAAA,EACV,IAAI;AAEJ,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAmD,MAAM;AACrF,QAAM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UACf,IAEA,iCACE;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,MAAK;AAAA,gBACL,UAAU;AAAA,gBACV,SAAS,KAAK,aAAa,QAAQ;AAAA,gBACnC,WAAW;AAAA,kBACT;AAAA,kBACA,iBAAiB;AAAA,gBACnB;AAAA,gBAEC,iBAAO,iCAAE;AAAA,sCAAC,WAAQ,WAAU,wBAAuB;AAAA,kBAAE;AAAA,mBAAQ,IAAM,cAAc,WAAW,aAAa;AAAA;AAAA,YAC5G;AAAA,YACA,oBAAC,OAAE,WAAU,6CAA4C,yCAEzD;AAAA,aACF;AAAA,WAEJ;AAAA,QAEA,oBAAC,SAAI,WAAU,oGACb;AAAA,UAAC;AAAA;AAAA,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 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/fast-mint/types.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport type { Call, TypedData } from \"starknet\";\nimport type { ApiCollection } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\n\nexport type MediaKind = \"image\" | \"audio\" | \"video\" | \"document\";\n\nexport interface FastMintSigner {\n readonly address: string;\n execute(calls: Call[], opts?: { intentIds?: string[] }): Promise<{ txHash: string }>;\n signTypedData(data: TypedData): Promise<string[]>;\n}\n\nexport interface MintedAsset {\n contract: string;\n tokenId: string;\n image: string | null;\n}\n\nexport interface FastMintProps {\n presentation?: \"inline\" | \"dialog\";\n open?: boolean;\n onClose?: () => void;\n\n mediaKindLock?: MediaKind;\n onMinted?: (asset: MintedAsset) => void;\n\n collections: ApiCollection[];\n refetchCollections: () => Promise<ApiCollection[]>;\n\n hasWallet: boolean;\n walletAddress: string | null;\n onRequireWallet: () => void;\n connectLabel?: string;\n getUploadToken: () => Promise<string | null>;\n getSigner: () => Promise<FastMintSigner> | FastMintSigner;\n client: MedialaneClient;\n successFooter?: ReactNode;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/fast-mint/types.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport type { Call, TypedData } from \"starknet\";\nimport type { ApiCollection } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\n\nexport type MediaKind = \"image\" | \"audio\" | \"video\" | \"document\";\n\nexport interface FastMintSigner {\n readonly address: string;\n execute(calls: Call[], opts?: { intentIds?: string[] }): Promise<{ txHash: string }>;\n signTypedData(data: TypedData): Promise<string[]>;\n}\n\nexport interface MintedAsset {\n contract: string;\n tokenId: string;\n image: string | null;\n}\n\nexport interface FastMintProps {\n presentation?: \"inline\" | \"dialog\";\n open?: boolean;\n onClose?: () => void;\n\n mediaKindLock?: MediaKind;\n onMinted?: (asset: MintedAsset) => void;\n\n onNavigate?: (href: string) => void;\n\n collections: ApiCollection[];\n refetchCollections: () => Promise<ApiCollection[]>;\n\n hasWallet: boolean;\n walletAddress: string | null;\n onRequireWallet: () => void;\n connectLabel?: string;\n getUploadToken: () => Promise<string | null>;\n getSigner: () => Promise<FastMintSigner> | FastMintSigner;\n client: MedialaneClient;\n successFooter?: ReactNode;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -24,6 +24,7 @@ interface FastMintProps {
|
|
|
24
24
|
onClose?: () => void;
|
|
25
25
|
mediaKindLock?: MediaKind;
|
|
26
26
|
onMinted?: (asset: MintedAsset) => void;
|
|
27
|
+
onNavigate?: (href: string) => void;
|
|
27
28
|
collections: ApiCollection[];
|
|
28
29
|
refetchCollections: () => Promise<ApiCollection[]>;
|
|
29
30
|
hasWallet: boolean;
|
|
@@ -24,6 +24,7 @@ interface FastMintProps {
|
|
|
24
24
|
onClose?: () => void;
|
|
25
25
|
mediaKindLock?: MediaKind;
|
|
26
26
|
onMinted?: (asset: MintedAsset) => void;
|
|
27
|
+
onNavigate?: (href: string) => void;
|
|
27
28
|
collections: ApiCollection[];
|
|
28
29
|
refetchCollections: () => Promise<ApiCollection[]>;
|
|
29
30
|
hasWallet: boolean;
|
|
@@ -59,6 +59,8 @@ var import_run_intent_calls = require("../../utils/run-intent-calls.js");
|
|
|
59
59
|
var import_ipfs_upload = require("../../utils/ipfs-upload.js");
|
|
60
60
|
var import_use_transaction = require("../../utils/use-transaction.js");
|
|
61
61
|
var import_use_launchpad_image_upload = require("../../utils/use-launchpad-image-upload.js");
|
|
62
|
+
var import_launchpad_handoff = require("../../utils/launchpad-handoff.js");
|
|
63
|
+
var import_ipfs = require("../../utils/ipfs.js");
|
|
62
64
|
var import_portfolio_cache = require("../../utils/portfolio-cache.js");
|
|
63
65
|
var import_launchpad_defaults = require("../../utils/launchpad-defaults.js");
|
|
64
66
|
const schema = z.object({
|
|
@@ -74,7 +76,7 @@ function CollectionCreateForm({ preset, aside }) {
|
|
|
74
76
|
const walletAddress = app.walletAddress;
|
|
75
77
|
const tx = (0, import_use_transaction.useTransaction)();
|
|
76
78
|
const upload = (0, import_use_launchpad_image_upload.useLaunchpadImageUpload)({ successMessage: "Image uploaded" });
|
|
77
|
-
const { imageFile, imagePreview, imageUri, imageUploading, uploadError, fileInputRef, handleImageSelect, clearImage } = upload;
|
|
79
|
+
const { imageFile, imagePreview, imageUri, imageUploading, uploadError, fileInputRef, handleImageSelect, clearImage, setImageUri, setImagePreview } = upload;
|
|
78
80
|
const [autoSymbol, setAutoSymbol] = (0, import_react.useState)("");
|
|
79
81
|
const [viewHref, setViewHref] = (0, import_react.useState)(null);
|
|
80
82
|
const Icon = preset.icon;
|
|
@@ -83,6 +85,13 @@ function CollectionCreateForm({ preset, aside }) {
|
|
|
83
85
|
defaultValues: { name: "", symbol: "", description: "", external_link: "" }
|
|
84
86
|
});
|
|
85
87
|
const name = form.watch("name");
|
|
88
|
+
(0, import_launchpad_handoff.useAppliedHandoff)(({ name: carriedName, imageUri: carried }) => {
|
|
89
|
+
if (carriedName) form.setValue("name", carriedName);
|
|
90
|
+
if (carried) {
|
|
91
|
+
setImageUri(carried);
|
|
92
|
+
setImagePreview((0, import_ipfs.ipfsToHttp)(carried));
|
|
93
|
+
}
|
|
94
|
+
});
|
|
86
95
|
(0, import_react.useEffect)(() => {
|
|
87
96
|
if (!preset.suggestSymbol) return;
|
|
88
97
|
const suggested = (0, import_launchpad_defaults.suggestLaunchpadSymbol)(name);
|
|
@@ -224,8 +233,8 @@ function CollectionCreateForm({ preset, aside }) {
|
|
|
224
233
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { type: "button", variant: "outline", size: "sm", disabled: imageUploading, onClick: () => fileInputRef.current?.click(), children: imageUploading ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
225
234
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Loader2, { className: "h-3.5 w-3.5 mr-1.5 animate-spin" }),
|
|
226
235
|
"Uploading\u2026"
|
|
227
|
-
] }) : imageFile ? "Change image" : "Upload image" }),
|
|
228
|
-
imageFile && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
236
|
+
] }) : imageFile || imageUri ? "Change image" : "Upload image" }),
|
|
237
|
+
(imageFile || imageUri) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
229
238
|
"button",
|
|
230
239
|
{
|
|
231
240
|
type: "button",
|