@medialane/ui 0.365.0 → 0.367.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/approve-mint-dialog.d.cts +0 -1
- package/dist/components/approve-mint-dialog.d.ts +0 -1
- package/dist/components/fast-mint/asset-form-parts.cjs +28 -47
- package/dist/components/fast-mint/asset-form-parts.cjs.map +1 -1
- package/dist/components/fast-mint/asset-form-parts.d.cts +13 -8
- package/dist/components/fast-mint/asset-form-parts.d.ts +13 -8
- package/dist/components/fast-mint/asset-form-parts.js +29 -48
- package/dist/components/fast-mint/asset-form-parts.js.map +1 -1
- package/dist/components/fast-mint/collection-section.cjs +11 -21
- package/dist/components/fast-mint/collection-section.cjs.map +1 -1
- package/dist/components/fast-mint/collection-section.d.cts +5 -7
- package/dist/components/fast-mint/collection-section.d.ts +5 -7
- package/dist/components/fast-mint/collection-section.js +11 -21
- package/dist/components/fast-mint/collection-section.js.map +1 -1
- package/dist/components/fast-mint/create-then-add.cjs +55 -0
- package/dist/components/fast-mint/create-then-add.cjs.map +1 -0
- package/dist/components/fast-mint/create-then-add.d.cts +24 -0
- package/dist/components/fast-mint/create-then-add.d.ts +24 -0
- package/dist/components/fast-mint/create-then-add.js +30 -0
- package/dist/components/fast-mint/create-then-add.js.map +1 -0
- package/dist/components/fast-mint/dropzone.d.cts +0 -1
- package/dist/components/fast-mint/dropzone.d.ts +0 -1
- package/dist/components/fast-mint/fast-mint.cjs +68 -102
- package/dist/components/fast-mint/fast-mint.cjs.map +1 -1
- package/dist/components/fast-mint/fast-mint.js +70 -104
- package/dist/components/fast-mint/fast-mint.js.map +1 -1
- package/dist/components/fast-mint/formats/nft.cjs +233 -0
- package/dist/components/fast-mint/formats/nft.cjs.map +1 -0
- package/dist/components/fast-mint/formats/nft.d.cts +19 -0
- package/dist/components/fast-mint/formats/nft.d.ts +19 -0
- package/dist/components/fast-mint/formats/nft.js +214 -0
- package/dist/components/fast-mint/formats/nft.js.map +1 -0
- package/dist/components/fast-mint/formats/pop.cjs +160 -0
- package/dist/components/fast-mint/formats/pop.cjs.map +1 -0
- package/dist/components/fast-mint/formats/pop.d.cts +18 -0
- package/dist/components/fast-mint/formats/pop.d.ts +18 -0
- package/dist/components/fast-mint/formats/pop.js +136 -0
- package/dist/components/fast-mint/formats/pop.js.map +1 -0
- package/dist/components/fast-mint/formats/registry.cjs +42 -0
- package/dist/components/fast-mint/formats/registry.cjs.map +1 -0
- package/dist/components/fast-mint/formats/registry.d.cts +20 -0
- package/dist/components/fast-mint/formats/registry.d.ts +20 -0
- package/dist/components/fast-mint/formats/registry.js +16 -0
- package/dist/components/fast-mint/formats/registry.js.map +1 -0
- package/dist/components/fast-mint/formats/tiers.cjs +206 -0
- package/dist/components/fast-mint/formats/tiers.cjs.map +1 -0
- package/dist/components/fast-mint/formats/tiers.d.cts +19 -0
- package/dist/components/fast-mint/formats/tiers.d.ts +19 -0
- package/dist/components/fast-mint/formats/tiers.js +181 -0
- package/dist/components/fast-mint/formats/tiers.js.map +1 -0
- package/dist/components/fast-mint/formats/types.cjs +31 -0
- package/dist/components/fast-mint/formats/types.cjs.map +1 -0
- package/dist/components/fast-mint/formats/types.d.cts +71 -0
- package/dist/components/fast-mint/formats/types.d.ts +71 -0
- package/dist/components/fast-mint/formats/types.js +7 -0
- package/dist/components/fast-mint/formats/types.js.map +1 -0
- package/dist/components/fast-mint/media-kind.d.cts +0 -1
- package/dist/components/fast-mint/media-kind.d.ts +0 -1
- package/dist/components/fast-mint/success-view.cjs +18 -59
- package/dist/components/fast-mint/success-view.cjs.map +1 -1
- package/dist/components/fast-mint/success-view.d.cts +13 -8
- package/dist/components/fast-mint/success-view.d.ts +13 -8
- package/dist/components/fast-mint/success-view.js +19 -60
- package/dist/components/fast-mint/success-view.js.map +1 -1
- package/dist/components/fast-mint/types.cjs.map +1 -1
- package/dist/components/fast-mint/types.d.cts +0 -2
- package/dist/components/fast-mint/types.d.ts +0 -2
- package/dist/components/launchpad/collection-create-form.cjs +3 -2
- package/dist/components/launchpad/collection-create-form.cjs.map +1 -1
- package/dist/components/launchpad/collection-create-form.js +3 -2
- package/dist/components/launchpad/collection-create-form.js.map +1 -1
- package/dist/components/launchpad/pop-create-fields.cjs +5 -3
- package/dist/components/launchpad/pop-create-fields.cjs.map +1 -1
- package/dist/components/launchpad/pop-create-fields.d.cts +8 -2
- package/dist/components/launchpad/pop-create-fields.d.ts +8 -2
- package/dist/components/launchpad/pop-create-fields.js +4 -3
- package/dist/components/launchpad/pop-create-fields.js.map +1 -1
- package/dist/components/launchpad/pop-create.cjs +8 -12
- package/dist/components/launchpad/pop-create.cjs.map +1 -1
- package/dist/components/launchpad/pop-create.js +8 -12
- package/dist/components/launchpad/pop-create.js.map +1 -1
- package/dist/components/launchpad/tier-mint-form.cjs +8 -25
- package/dist/components/launchpad/tier-mint-form.cjs.map +1 -1
- package/dist/components/launchpad/tier-mint-form.js +6 -23
- package/dist/components/launchpad/tier-mint-form.js.map +1 -1
- package/dist/components/transfer-dialog.d.cts +0 -1
- package/dist/components/transfer-dialog.d.ts +0 -1
- package/dist/data/launchpad-services.cjs +12 -12
- package/dist/data/launchpad-services.cjs.map +1 -1
- package/dist/data/launchpad-services.js +12 -12
- package/dist/data/launchpad-services.js.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/utils/drop/actions.d.cts +0 -1
- package/dist/utils/drop/actions.d.ts +0 -1
- package/dist/utils/drop/types.d.cts +0 -1
- package/dist/utils/drop/types.d.ts +0 -1
- package/dist/utils/launchpad-actions.cjs +90 -0
- package/dist/utils/launchpad-actions.cjs.map +1 -0
- package/dist/utils/launchpad-actions.d.cts +39 -0
- package/dist/utils/launchpad-actions.d.ts +39 -0
- package/dist/utils/launchpad-actions.js +60 -0
- package/dist/utils/launchpad-actions.js.map +1 -0
- package/dist/utils/use-transaction.d.cts +0 -1
- package/dist/utils/use-transaction.d.ts +0 -1
- package/package.json +1 -1
- package/dist/components/fast-mint/mint-asset.cjs +0 -124
- package/dist/components/fast-mint/mint-asset.cjs.map +0 -1
- package/dist/components/fast-mint/mint-asset.d.cts +0 -41
- package/dist/components/fast-mint/mint-asset.d.ts +0 -41
- package/dist/components/fast-mint/mint-asset.js +0 -100
- package/dist/components/fast-mint/mint-asset.js.map +0 -1
|
@@ -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;AAAA,IAAS;AAAA,IAAe;AAAA,IAC9D;AAAA,IAAa;AAAA,IACb;AAAA,IAAW;AAAA,IAAe;AAAA,IAAiB;AAAA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sx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport { Loader2 } from \"lucide-react\";\nimport { profileHref } from \"@medialane/sdk\";\nimport { describeError } from \"../../utils/describe-error.js\";\nimport { uploadError } from \"../../utils/upload-limits.js\";\nimport { uploadFileToIpfs, type SignedUploadKind } from \"../../utils/ipfs-upload.js\";\nimport { invalidatePortfolioCache } from \"../../utils/portfolio-cache.js\";\nimport { cn } from \"../../utils/cn.js\";\nimport type { IPType } from \"../../data/ip.js\";\nimport { Input } from \"../input.js\";\nimport { Textarea } from \"../textarea.js\";\nimport { MedialaneCollectionCard } from \"../medialane-collection-card.js\";\nimport { Dialog, DialogContent, DialogDescription, DialogTitle } from \"../dialog.js\";\nimport type { MetadataField } from \"../ip-type-fields.js\";\nimport { Dropzone } from \"./dropzone.js\";\nimport { SuccessView } from \"./success-view.js\";\nimport { CoverUpload, FormatPicker, MediaRow } from \"./asset-form-parts.js\";\nimport { PartialCreateError, type StepInfo } from \"./create-then-add.js\";\nimport { FORMATS, getFormat, initialFormatStates } from \"./formats/registry.js\";\nimport type { FormatResult, FormatShared, MintFormat } from \"./formats/types.js\";\nimport { DEFAULT_VALUES, type FormValues } from \"./form.js\";\nimport { IP_TYPE_BY_KIND, MEDIA_ROUTE_MIME_TYPES, detectMediaKind } from \"./media-kind.js\";\nimport { useIpfsUpload } from \"./use-ipfs-upload.js\";\nimport { useNewCollectionDraft } from \"./use-new-collection-draft.js\";\nimport type { FastMintProps, MediaKind } from \"./types.js\";\n\nexport function FastMint(props: FastMintProps) {\n const {\n presentation = \"inline\", open = true, onClose, mediaKindLock, onMinted,\n collections, refetchCollections,\n hasWallet, walletAddress, onRequireWallet, connectLabel, getUploadToken, getSigner,\n client,\n } = props;\n\n const [status, setStatus] = useState<\"idle\" | \"minting\" | \"success\" | \"error\">(\"idle\");\n const [errorMsg, setErrorMsg] = useState<string | null>(null);\n const [step, setStep] = useState<StepInfo | null>(null);\n\n const media = useIpfsUpload();\n const feature = useIpfsUpload();\n const [mediaFile, setMediaFile] = useState<File | null>(null);\n const [mediaKind, setMediaKind] = useState<MediaKind>(\"image\");\n const mediaInputRef = useRef<HTMLInputElement>(null);\n const featureInputRef = useRef<HTMLInputElement>(null);\n\n const [formatKey, setFormatKey] = useState<MintFormat>(\"single\");\n const [formatStates, setFormatStates] = useState(initialFormatStates);\n const [resume, setResume] = useState<{ format: MintFormat; destination: unknown } | null>(null);\n const [result, setResult] = useState<FormatResult | null>(null);\n\n const [ipType, setIpType] = useState<IPType>(\"NFT\");\n const templateFieldsRef = useRef<MetadataField[]>([]);\n\n const form = useForm<FormValues>({ defaultValues: DEFAULT_VALUES });\n const name = form.watch(\"name\");\n const description = form.watch(\"description\");\n const draft = useNewCollectionDraft(name, description);\n\n useEffect(() => {\n if (walletAddress && !form.getValues(\"external_url\")) {\n form.setValue(\"external_url\", `https://medialane.io/account/${walletAddress}`);\n }\n }, [walletAddress, form]);\n\n const format = getFormat(formatKey);\n const formatState = formatStates[formatKey];\n const updateFormat = (patch: object) =>\n setFormatStates((states) => ({ ...states, [formatKey]: { ...(states[formatKey] as object), ...patch } }));\n\n const uploadFile = async (file: File, kind: SignedUploadKind) => {\n const token = await getUploadToken();\n if (!token) throw new Error(\"Sign in first\");\n return (await uploadFileToIpfs(client.api, file, kind)).uri;\n };\n\n const handleMediaSelect = async (file: File) => {\n const kind = detectMediaKind(file.type);\n if (!kind) {\n setErrorMsg(\"Publish an image, audio, video (JPG/PNG/GIF/SVG/WebP, MP3/WAV/OGG/FLAC, MP4/WebM), or document (PDF, DOC, DOCX, ODT, RTF, TXT, MD).\");\n return;\n }\n if (mediaKindLock && kind !== mediaKindLock) {\n setErrorMsg(`Please upload a${mediaKindLock === \"image\" ? \"n\" : \"\"} ${mediaKindLock}.`);\n return;\n }\n const route = MEDIA_ROUTE_MIME_TYPES.has(file.type) ? \"media\" : \"document\";\n const fileError = uploadError(file, route);\n if (fileError) {\n setErrorMsg(fileError);\n return;\n }\n setMediaFile(file);\n setMediaKind(kind);\n setIpType(IP_TYPE_BY_KIND[kind]);\n await media.start(file, (f) => uploadFile(f, route), setErrorMsg);\n };\n\n const clearMedia = () => {\n setMediaFile(null);\n media.clear();\n if (mediaInputRef.current) mediaInputRef.current.value = \"\";\n };\n\n const image = mediaKind === \"image\" ? media.uri : feature.uri;\n const previewImage = mediaKind === \"image\" ? media.preview : feature.preview;\n\n const shared: FormatShared | null = media.uri && image && mediaFile\n ? {\n form, draft, collections,\n walletAddress: walletAddress ?? \"\",\n mediaKind, mediaUri: media.uri, mediaName: mediaFile.name, image, previewImage,\n ipType, onIpTypeChange: setIpType, templateFieldsRef,\n uploadDocument: (file) => uploadFile(file, \"document\"),\n }\n : null;\n\n const ready = !!shared && !media.uploading && !feature.uploading && name.trim().length > 0 && format.isReady(shared, formatState);\n\n const onSubmit = async () => {\n if (!hasWallet) { onRequireWallet(); return; }\n if (!shared || !walletAddress) return;\n const link = form.getValues(\"external_url\");\n if (link && !link.startsWith(\"http://\") && !link.startsWith(\"https://\")) {\n setErrorMsg(\"External link must start with http:// or https://\");\n setStatus(\"error\");\n return;\n }\n\n setStatus(\"minting\");\n setErrorMsg(null);\n setStep(null);\n\n try {\n const outcome = await format.submit(shared, formatState, {\n client,\n signer: await getSigner(),\n getUploadToken,\n resume: resume?.format === formatKey ? resume.destination : null,\n onStep: setStep,\n });\n setResult(outcome);\n setResume(null);\n setStatus(\"success\");\n invalidatePortfolioCache(walletAddress);\n if (outcome.asset) onMinted?.(outcome.asset);\n void refetchCollections().catch(() => {});\n } catch (err) {\n if (err instanceof PartialCreateError) {\n setResume({ format: formatKey, destination: err.destination });\n setErrorMsg(`${err.message} ${describeError(err.reason).message} Press the button again to finish.`);\n } else {\n setErrorMsg(describeError(err).message);\n }\n setStatus(\"error\");\n }\n };\n\n const resetAll = () => {\n setStatus(\"idle\");\n setErrorMsg(null);\n setStep(null);\n setResult(null);\n setResume(null);\n form.reset();\n clearMedia();\n feature.clear();\n setFormatStates(initialFormatStates());\n draft.reset();\n templateFieldsRef.current = [];\n };\n\n const busy = status === \"minting\";\n\n const wrap = (node: React.ReactNode) => {\n if (presentation !== \"dialog\") return node;\n return (\n <Dialog open={open} onOpenChange={(next) => { if (!next) onClose?.(); }}>\n <DialogContent className=\"gap-0 p-6 sm:max-w-2xl sm:p-8\">\n <DialogTitle className=\"sr-only\">Create</DialogTitle>\n <DialogDescription className=\"sr-only\">Add media, describe it and publish it as an asset.</DialogDescription>\n {node}\n </DialogContent>\n </Dialog>\n );\n };\n\n if (status === \"success\" && result) {\n return wrap(\n <SuccessView presentation={presentation} previewImage={previewImage} result={result} onPublishAnother={resetAll} />\n );\n }\n\n if (!mediaFile) {\n return wrap(\n <Dropzone\n mediaKindLock={mediaKindLock}\n presentation={presentation}\n hasWallet={hasWallet}\n onRequireWallet={onRequireWallet}\n connectLabel={connectLabel}\n onFileSelected={handleMediaSelect}\n />\n );\n }\n\n const submitBlocked = !ready || busy || !hasWallet;\n const buttonLabel = busy\n ? `${step?.label ?? \"Working\"}…${step && step.total > 1 ? ` (${step.index} of ${step.total})` : \"\"}`\n : format.submitLabel(formatState);\n\n return wrap(\n <section className=\"space-y-6\">\n <MediaRow\n file={mediaFile}\n kind={mediaKind}\n preview={media.preview}\n uri={media.uri}\n uploading={media.uploading}\n ipType={ipType}\n inputRef={mediaInputRef}\n onSelect={handleMediaSelect}\n />\n\n {media.uri && (\n <div className=\"grid grid-cols-1 lg:grid-cols-[1fr_320px] gap-8 items-start\">\n <div className=\"space-y-5\">\n <FormatPicker formats={FORMATS} value={formatKey} onChange={setFormatKey} />\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Title *</label>\n <Input\n value={name}\n onChange={(e) => form.setValue(\"name\", e.target.value)}\n placeholder=\"My Creative Work\"\n />\n </div>\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Description</label>\n <Textarea\n value={description}\n onChange={(e) => form.setValue(\"description\", e.target.value)}\n placeholder=\"Describe your work, its story, and any context for buyers…\"\n rows={3}\n />\n </div>\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">External link <span className=\"text-muted-foreground font-normal\">(optional)</span></label>\n <Input\n value={form.watch(\"external_url\")}\n onChange={(e) => form.setValue(\"external_url\", e.target.value)}\n placeholder=\"https://yourwebsite.com\"\n />\n </div>\n\n {mediaKind !== \"image\" && (\n <CoverUpload\n preview={feature.preview}\n uploading={feature.uploading}\n inputRef={featureInputRef}\n onSelect={(file) => void feature.start(file, (f) => uploadFile(f, \"image\"), setErrorMsg)}\n />\n )}\n\n {shared && <format.Fields shared={shared} state={formatState} update={updateFormat} />}\n\n {status === \"error\" && errorMsg && <p className=\"text-xs text-destructive\">{errorMsg}</p>}\n\n <button\n type=\"button\"\n disabled={submitBlocked}\n onClick={() => void onSubmit()}\n className={cn(\n \"w-full h-12 text-base font-semibold text-white rounded-xl flex items-center justify-center gap-2 transition-all hover:brightness-110 active:scale-[0.98] bg-brand-blue\",\n submitBlocked && \"opacity-40 pointer-events-none\"\n )}\n >\n {busy && <Loader2 className=\"h-4 w-4 animate-spin\" />}\n {buttonLabel}\n </button>\n <p className=\"text-xs text-center text-muted-foreground\">\n Zero platform fees to mint.\n </p>\n </div>\n\n <div className=\"order-first lg:order-last lg:sticky lg:top-20 max-w-[260px] mx-auto w-full lg:max-w-none lg:mx-0\">\n <MedialaneCollectionCard\n image={previewImage}\n name={name}\n collection={shared ? format.previewLabel(shared, formatState) : undefined}\n creator={walletAddress ? `${walletAddress.slice(0, 6)}…${walletAddress.slice(-4)}` : undefined}\n creatorHref={walletAddress ? profileHref({ address: walletAddress }) : undefined}\n />\n </div>\n </div>\n )}\n </section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoLQ;AAlLR,mBAA4C;AAC5C,6BAAwB;AACxB,0BAAwB;AACxB,iBAA4B;AAC5B,4BAA8B;AAC9B,2BAA4B;AAC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;AAAA;AAAA,QACzE,GACF;AAAA,SACF;AAAA,OAEJ;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useRef, useState } from "react";
|
|
4
4
|
import { useForm } from "react-hook-form";
|
|
5
5
|
import { Loader2 } from "lucide-react";
|
|
@@ -7,6 +7,7 @@ import { profileHref } from "@medialane/sdk";
|
|
|
7
7
|
import { describeError } from "../../utils/describe-error.js";
|
|
8
8
|
import { uploadError } from "../../utils/upload-limits.js";
|
|
9
9
|
import { uploadFileToIpfs } from "../../utils/ipfs-upload.js";
|
|
10
|
+
import { invalidatePortfolioCache } from "../../utils/portfolio-cache.js";
|
|
10
11
|
import { cn } from "../../utils/cn.js";
|
|
11
12
|
import { Input } from "../input.js";
|
|
12
13
|
import { Textarea } from "../textarea.js";
|
|
@@ -14,14 +15,11 @@ import { MedialaneCollectionCard } from "../medialane-collection-card.js";
|
|
|
14
15
|
import { Dialog, DialogContent, DialogDescription, DialogTitle } from "../dialog.js";
|
|
15
16
|
import { Dropzone } from "./dropzone.js";
|
|
16
17
|
import { SuccessView } from "./success-view.js";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { IpTypeSection } from "./ip-type-section.js";
|
|
18
|
+
import { CoverUpload, FormatPicker, MediaRow } from "./asset-form-parts.js";
|
|
19
|
+
import { PartialCreateError } from "./create-then-add.js";
|
|
20
|
+
import { FORMATS, getFormat, initialFormatStates } from "./formats/registry.js";
|
|
21
21
|
import { DEFAULT_VALUES } from "./form.js";
|
|
22
22
|
import { IP_TYPE_BY_KIND, MEDIA_ROUTE_MIME_TYPES, detectMediaKind } from "./media-kind.js";
|
|
23
|
-
import { mintAsset } from "./mint-asset.js";
|
|
24
|
-
import { mintableCollections } from "./mintable-collections.js";
|
|
25
23
|
import { useIpfsUpload } from "./use-ipfs-upload.js";
|
|
26
24
|
import { useNewCollectionDraft } from "./use-new-collection-draft.js";
|
|
27
25
|
function FastMint(props) {
|
|
@@ -39,25 +37,23 @@ function FastMint(props) {
|
|
|
39
37
|
connectLabel,
|
|
40
38
|
getUploadToken,
|
|
41
39
|
getSigner,
|
|
42
|
-
client
|
|
43
|
-
successFooter
|
|
40
|
+
client
|
|
44
41
|
} = props;
|
|
45
42
|
const [status, setStatus] = useState("idle");
|
|
46
43
|
const [errorMsg, setErrorMsg] = useState(null);
|
|
44
|
+
const [step, setStep] = useState(null);
|
|
47
45
|
const media = useIpfsUpload();
|
|
48
46
|
const feature = useIpfsUpload();
|
|
49
47
|
const [mediaFile, setMediaFile] = useState(null);
|
|
50
48
|
const [mediaKind, setMediaKind] = useState("image");
|
|
51
49
|
const mediaInputRef = useRef(null);
|
|
52
50
|
const featureInputRef = useRef(null);
|
|
53
|
-
const [
|
|
54
|
-
const [
|
|
55
|
-
const [
|
|
56
|
-
const [
|
|
57
|
-
const [existingCollectionContract, setExistingCollectionContract] = useState("");
|
|
51
|
+
const [formatKey, setFormatKey] = useState("single");
|
|
52
|
+
const [formatStates, setFormatStates] = useState(initialFormatStates);
|
|
53
|
+
const [resume, setResume] = useState(null);
|
|
54
|
+
const [result, setResult] = useState(null);
|
|
58
55
|
const [ipType, setIpType] = useState("NFT");
|
|
59
56
|
const templateFieldsRef = useRef([]);
|
|
60
|
-
const [mintedAsset, setMintedAsset] = useState(null);
|
|
61
57
|
const form = useForm({ defaultValues: DEFAULT_VALUES });
|
|
62
58
|
const name = form.watch("name");
|
|
63
59
|
const description = form.watch("description");
|
|
@@ -67,8 +63,9 @@ function FastMint(props) {
|
|
|
67
63
|
form.setValue("external_url", `https://medialane.io/account/${walletAddress}`);
|
|
68
64
|
}
|
|
69
65
|
}, [walletAddress, form]);
|
|
70
|
-
const
|
|
71
|
-
const
|
|
66
|
+
const format = getFormat(formatKey);
|
|
67
|
+
const formatState = formatStates[formatKey];
|
|
68
|
+
const updateFormat = (patch) => setFormatStates((states) => ({ ...states, [formatKey]: { ...states[formatKey], ...patch } }));
|
|
72
69
|
const uploadFile = async (file, kind) => {
|
|
73
70
|
const token = await getUploadToken();
|
|
74
71
|
if (!token) throw new Error("Sign in first");
|
|
@@ -100,66 +97,78 @@ function FastMint(props) {
|
|
|
100
97
|
media.clear();
|
|
101
98
|
if (mediaInputRef.current) mediaInputRef.current.value = "";
|
|
102
99
|
};
|
|
103
|
-
const
|
|
104
|
-
const
|
|
100
|
+
const image = mediaKind === "image" ? media.uri : feature.uri;
|
|
101
|
+
const previewImage = mediaKind === "image" ? media.preview : feature.preview;
|
|
102
|
+
const shared = media.uri && image && mediaFile ? {
|
|
103
|
+
form,
|
|
104
|
+
draft,
|
|
105
|
+
collections,
|
|
106
|
+
walletAddress: walletAddress ?? "",
|
|
107
|
+
mediaKind,
|
|
108
|
+
mediaUri: media.uri,
|
|
109
|
+
mediaName: mediaFile.name,
|
|
110
|
+
image,
|
|
111
|
+
previewImage,
|
|
112
|
+
ipType,
|
|
113
|
+
onIpTypeChange: setIpType,
|
|
114
|
+
templateFieldsRef,
|
|
115
|
+
uploadDocument: (file) => uploadFile(file, "document")
|
|
116
|
+
} : null;
|
|
117
|
+
const ready = !!shared && !media.uploading && !feature.uploading && name.trim().length > 0 && format.isReady(shared, formatState);
|
|
118
|
+
const onSubmit = async () => {
|
|
105
119
|
if (!hasWallet) {
|
|
106
120
|
onRequireWallet();
|
|
107
121
|
return;
|
|
108
122
|
}
|
|
109
|
-
if (!
|
|
110
|
-
|
|
123
|
+
if (!shared || !walletAddress) return;
|
|
124
|
+
const link = form.getValues("external_url");
|
|
125
|
+
if (link && !link.startsWith("http://") && !link.startsWith("https://")) {
|
|
111
126
|
setErrorMsg("External link must start with http:// or https://");
|
|
127
|
+
setStatus("error");
|
|
112
128
|
return;
|
|
113
129
|
}
|
|
114
130
|
setStatus("minting");
|
|
115
131
|
setErrorMsg(null);
|
|
132
|
+
setStep(null);
|
|
116
133
|
try {
|
|
117
|
-
const
|
|
134
|
+
const outcome = await format.submit(shared, formatState, {
|
|
118
135
|
client,
|
|
119
136
|
signer: await getSigner(),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
templateFields: templateFieldsRef.current,
|
|
124
|
-
mediaKind,
|
|
125
|
-
mediaUri: media.uri,
|
|
126
|
-
featureUri: feature.uri,
|
|
127
|
-
assetType,
|
|
128
|
-
editionCount,
|
|
129
|
-
destination: collectionMode === "new" ? { mode: "new", name: draft.name, symbol: draft.symbol, description: draft.description } : { mode: "existing", collectionId: existingCollectionId, collectionContract: existingCollectionContract },
|
|
130
|
-
singleCollections: erc721Collections,
|
|
131
|
-
refetchCollections,
|
|
132
|
-
getUploadToken
|
|
137
|
+
getUploadToken,
|
|
138
|
+
resume: resume?.format === formatKey ? resume.destination : null,
|
|
139
|
+
onStep: setStep
|
|
133
140
|
});
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
onMinted?.(asset);
|
|
137
|
-
}
|
|
141
|
+
setResult(outcome);
|
|
142
|
+
setResume(null);
|
|
138
143
|
setStatus("success");
|
|
144
|
+
invalidatePortfolioCache(walletAddress);
|
|
145
|
+
if (outcome.asset) onMinted?.(outcome.asset);
|
|
146
|
+
void refetchCollections().catch(() => {
|
|
147
|
+
});
|
|
139
148
|
} catch (err) {
|
|
140
|
-
|
|
149
|
+
if (err instanceof PartialCreateError) {
|
|
150
|
+
setResume({ format: formatKey, destination: err.destination });
|
|
151
|
+
setErrorMsg(`${err.message} ${describeError(err.reason).message} Press the button again to finish.`);
|
|
152
|
+
} else {
|
|
153
|
+
setErrorMsg(describeError(err).message);
|
|
154
|
+
}
|
|
141
155
|
setStatus("error");
|
|
142
156
|
}
|
|
143
157
|
};
|
|
144
158
|
const resetAll = () => {
|
|
145
159
|
setStatus("idle");
|
|
146
160
|
setErrorMsg(null);
|
|
147
|
-
|
|
161
|
+
setStep(null);
|
|
162
|
+
setResult(null);
|
|
163
|
+
setResume(null);
|
|
148
164
|
form.reset();
|
|
149
165
|
clearMedia();
|
|
150
166
|
feature.clear();
|
|
151
|
-
|
|
152
|
-
setEditionCount("10");
|
|
153
|
-
setCollectionMode("existing");
|
|
154
|
-
setExistingCollectionId("");
|
|
155
|
-
setExistingCollectionContract("");
|
|
167
|
+
setFormatStates(initialFormatStates());
|
|
156
168
|
draft.reset();
|
|
157
169
|
templateFieldsRef.current = [];
|
|
158
170
|
};
|
|
159
171
|
const busy = status === "minting";
|
|
160
|
-
const previewImage = mediaKind === "image" ? media.preview : feature.preview;
|
|
161
|
-
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;
|
|
163
172
|
const wrap = (node) => {
|
|
164
173
|
if (presentation !== "dialog") return node;
|
|
165
174
|
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: (next) => {
|
|
@@ -170,20 +179,9 @@ function FastMint(props) {
|
|
|
170
179
|
node
|
|
171
180
|
] }) });
|
|
172
181
|
};
|
|
173
|
-
if (status === "success") {
|
|
182
|
+
if (status === "success" && result) {
|
|
174
183
|
return wrap(
|
|
175
|
-
/* @__PURE__ */ jsx(
|
|
176
|
-
SuccessView,
|
|
177
|
-
{
|
|
178
|
-
footer: successFooter,
|
|
179
|
-
presentation,
|
|
180
|
-
previewImage,
|
|
181
|
-
name,
|
|
182
|
-
collectionLabel,
|
|
183
|
-
mintedAsset,
|
|
184
|
-
onPublishAnother: resetAll
|
|
185
|
-
}
|
|
186
|
-
)
|
|
184
|
+
/* @__PURE__ */ jsx(SuccessView, { presentation, previewImage, result, onPublishAnother: resetAll })
|
|
187
185
|
);
|
|
188
186
|
}
|
|
189
187
|
if (!mediaFile) {
|
|
@@ -202,6 +200,7 @@ function FastMint(props) {
|
|
|
202
200
|
);
|
|
203
201
|
}
|
|
204
202
|
const submitBlocked = !ready || busy || !hasWallet;
|
|
203
|
+
const buttonLabel = busy ? `${step?.label ?? "Working"}\u2026${step && step.total > 1 ? ` (${step.index} of ${step.total})` : ""}` : format.submitLabel(formatState);
|
|
205
204
|
return wrap(
|
|
206
205
|
/* @__PURE__ */ jsxs("section", { className: "space-y-6", children: [
|
|
207
206
|
/* @__PURE__ */ jsx(
|
|
@@ -219,6 +218,7 @@ function FastMint(props) {
|
|
|
219
218
|
),
|
|
220
219
|
media.uri && /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-[1fr_320px] gap-8 items-start", children: [
|
|
221
220
|
/* @__PURE__ */ jsxs("div", { className: "space-y-5", children: [
|
|
221
|
+
/* @__PURE__ */ jsx(FormatPicker, { formats: FORMATS, value: formatKey, onChange: setFormatKey }),
|
|
222
222
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
223
223
|
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Title *" }),
|
|
224
224
|
/* @__PURE__ */ jsx(
|
|
@@ -265,56 +265,22 @@ function FastMint(props) {
|
|
|
265
265
|
onSelect: (file) => void feature.start(file, (f) => uploadFile(f, "image"), setErrorMsg)
|
|
266
266
|
}
|
|
267
267
|
),
|
|
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
|
-
),
|
|
268
|
+
shared && /* @__PURE__ */ jsx(format.Fields, { shared, state: formatState, update: updateFormat }),
|
|
303
269
|
status === "error" && errorMsg && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: errorMsg }),
|
|
304
|
-
/* @__PURE__ */
|
|
270
|
+
/* @__PURE__ */ jsxs(
|
|
305
271
|
"button",
|
|
306
272
|
{
|
|
307
273
|
type: "button",
|
|
308
274
|
disabled: submitBlocked,
|
|
309
|
-
onClick:
|
|
275
|
+
onClick: () => void onSubmit(),
|
|
310
276
|
className: cn(
|
|
311
277
|
"w-full h-12 text-base font-semibold text-white rounded-xl flex items-center justify-center gap-2 transition-all hover:brightness-110 active:scale-[0.98] bg-brand-blue",
|
|
312
278
|
submitBlocked && "opacity-40 pointer-events-none"
|
|
313
279
|
),
|
|
314
|
-
children:
|
|
315
|
-
/* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }),
|
|
316
|
-
|
|
317
|
-
]
|
|
280
|
+
children: [
|
|
281
|
+
busy && /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }),
|
|
282
|
+
buttonLabel
|
|
283
|
+
]
|
|
318
284
|
}
|
|
319
285
|
),
|
|
320
286
|
/* @__PURE__ */ jsx("p", { className: "text-xs text-center text-muted-foreground", children: "Zero platform fees to mint." })
|
|
@@ -324,7 +290,7 @@ function FastMint(props) {
|
|
|
324
290
|
{
|
|
325
291
|
image: previewImage,
|
|
326
292
|
name,
|
|
327
|
-
collection:
|
|
293
|
+
collection: shared ? format.previewLabel(shared, formatState) : void 0,
|
|
328
294
|
creator: walletAddress ? `${walletAddress.slice(0, 6)}\u2026${walletAddress.slice(-4)}` : void 0,
|
|
329
295
|
creatorHref: walletAddress ? profileHref({ address: walletAddress }) : void 0
|
|
330
296
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/fast-mint/fast-mint.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport { Loader2 } from \"lucide-react\";\nimport { profileHref } from \"@medialane/sdk\";\nimport { describeError } from \"../../utils/describe-error.js\";\nimport { uploadError } from \"../../utils/upload-limits.js\";\nimport { uploadFileToIpfs, type SignedUploadKind } from \"../../utils/ipfs-upload.js\";\nimport { cn } from \"../../utils/cn.js\";\nimport type { IPType } from \"../../data/ip.js\";\nimport { Input } from \"../input.js\";\nimport { Textarea } from \"../textarea.js\";\nimport { MedialaneCollectionCard } from \"../medialane-collection-card.js\";\nimport { Dialog, DialogContent, DialogDescription, DialogTitle } from \"../dialog.js\";\nimport type { MetadataField } from \"../ip-type-fields.js\";\nimport { Dropzone } from \"./dropzone.js\";\nimport { SuccessView } from \"./success-view.js\";\nimport { 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;AAC5B,SAAS,iBAAiB,aAAa,gBAAgB;AACvD,SAAS,yBAA8C;AACvD,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAC9B,SAAS,sBAAuC;AAChD,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Z,SAAS,gBAAgB,GAAG,cAAc,MAAM,GAAG,CAAC,CAAC,SAAI,cAAc,MAAM,EAAE,CAAC,KAAK;AAAA,YACrF,aAAa,gBAAgB,YAAY,EAAE,SAAS,cAAc,CAAC,IAAI;AAAA;AAAA,QACzE,GACF;AAAA,SACF;AAAA,OAEJ;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/fast-mint/fast-mint.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport { Loader2 } from \"lucide-react\";\nimport { profileHref } from \"@medialane/sdk\";\nimport { describeError } from \"../../utils/describe-error.js\";\nimport { uploadError } from \"../../utils/upload-limits.js\";\nimport { uploadFileToIpfs, type SignedUploadKind } from \"../../utils/ipfs-upload.js\";\nimport { invalidatePortfolioCache } from \"../../utils/portfolio-cache.js\";\nimport { cn } from \"../../utils/cn.js\";\nimport type { IPType } from \"../../data/ip.js\";\nimport { Input } from \"../input.js\";\nimport { Textarea } from \"../textarea.js\";\nimport { MedialaneCollectionCard } from \"../medialane-collection-card.js\";\nimport { Dialog, DialogContent, DialogDescription, DialogTitle } from \"../dialog.js\";\nimport type { MetadataField } from \"../ip-type-fields.js\";\nimport { Dropzone } from \"./dropzone.js\";\nimport { SuccessView } from \"./success-view.js\";\nimport { CoverUpload, FormatPicker, MediaRow } from \"./asset-form-parts.js\";\nimport { PartialCreateError, type StepInfo } from \"./create-then-add.js\";\nimport { FORMATS, getFormat, initialFormatStates } from \"./formats/registry.js\";\nimport type { FormatResult, FormatShared, MintFormat } from \"./formats/types.js\";\nimport { DEFAULT_VALUES, type FormValues } from \"./form.js\";\nimport { IP_TYPE_BY_KIND, MEDIA_ROUTE_MIME_TYPES, detectMediaKind } from \"./media-kind.js\";\nimport { useIpfsUpload } from \"./use-ipfs-upload.js\";\nimport { useNewCollectionDraft } from \"./use-new-collection-draft.js\";\nimport type { FastMintProps, MediaKind } from \"./types.js\";\n\nexport function FastMint(props: FastMintProps) {\n const {\n presentation = \"inline\", open = true, onClose, mediaKindLock, onMinted,\n collections, refetchCollections,\n hasWallet, walletAddress, onRequireWallet, connectLabel, getUploadToken, getSigner,\n client,\n } = props;\n\n const [status, setStatus] = useState<\"idle\" | \"minting\" | \"success\" | \"error\">(\"idle\");\n const [errorMsg, setErrorMsg] = useState<string | null>(null);\n const [step, setStep] = useState<StepInfo | null>(null);\n\n const media = useIpfsUpload();\n const feature = useIpfsUpload();\n const [mediaFile, setMediaFile] = useState<File | null>(null);\n const [mediaKind, setMediaKind] = useState<MediaKind>(\"image\");\n const mediaInputRef = useRef<HTMLInputElement>(null);\n const featureInputRef = useRef<HTMLInputElement>(null);\n\n const [formatKey, setFormatKey] = useState<MintFormat>(\"single\");\n const [formatStates, setFormatStates] = useState(initialFormatStates);\n const [resume, setResume] = useState<{ format: MintFormat; destination: unknown } | null>(null);\n const [result, setResult] = useState<FormatResult | null>(null);\n\n const [ipType, setIpType] = useState<IPType>(\"NFT\");\n const templateFieldsRef = useRef<MetadataField[]>([]);\n\n const form = useForm<FormValues>({ defaultValues: DEFAULT_VALUES });\n const name = form.watch(\"name\");\n const description = form.watch(\"description\");\n const draft = useNewCollectionDraft(name, description);\n\n useEffect(() => {\n if (walletAddress && !form.getValues(\"external_url\")) {\n form.setValue(\"external_url\", `https://medialane.io/account/${walletAddress}`);\n }\n }, [walletAddress, form]);\n\n const format = getFormat(formatKey);\n const formatState = formatStates[formatKey];\n const updateFormat = (patch: object) =>\n setFormatStates((states) => ({ ...states, [formatKey]: { ...(states[formatKey] as object), ...patch } }));\n\n const uploadFile = async (file: File, kind: SignedUploadKind) => {\n const token = await getUploadToken();\n if (!token) throw new Error(\"Sign in first\");\n return (await uploadFileToIpfs(client.api, file, kind)).uri;\n };\n\n const handleMediaSelect = async (file: File) => {\n const kind = detectMediaKind(file.type);\n if (!kind) {\n setErrorMsg(\"Publish an image, audio, video (JPG/PNG/GIF/SVG/WebP, MP3/WAV/OGG/FLAC, MP4/WebM), or document (PDF, DOC, DOCX, ODT, RTF, TXT, MD).\");\n return;\n }\n if (mediaKindLock && kind !== mediaKindLock) {\n setErrorMsg(`Please upload a${mediaKindLock === \"image\" ? \"n\" : \"\"} ${mediaKindLock}.`);\n return;\n }\n const route = MEDIA_ROUTE_MIME_TYPES.has(file.type) ? \"media\" : \"document\";\n const fileError = uploadError(file, route);\n if (fileError) {\n setErrorMsg(fileError);\n return;\n }\n setMediaFile(file);\n setMediaKind(kind);\n setIpType(IP_TYPE_BY_KIND[kind]);\n await media.start(file, (f) => uploadFile(f, route), setErrorMsg);\n };\n\n const clearMedia = () => {\n setMediaFile(null);\n media.clear();\n if (mediaInputRef.current) mediaInputRef.current.value = \"\";\n };\n\n const image = mediaKind === \"image\" ? media.uri : feature.uri;\n const previewImage = mediaKind === \"image\" ? media.preview : feature.preview;\n\n const shared: FormatShared | null = media.uri && image && mediaFile\n ? {\n form, draft, collections,\n walletAddress: walletAddress ?? \"\",\n mediaKind, mediaUri: media.uri, mediaName: mediaFile.name, image, previewImage,\n ipType, onIpTypeChange: setIpType, templateFieldsRef,\n uploadDocument: (file) => uploadFile(file, \"document\"),\n }\n : null;\n\n const ready = !!shared && !media.uploading && !feature.uploading && name.trim().length > 0 && format.isReady(shared, formatState);\n\n const onSubmit = async () => {\n if (!hasWallet) { onRequireWallet(); return; }\n if (!shared || !walletAddress) return;\n const link = form.getValues(\"external_url\");\n if (link && !link.startsWith(\"http://\") && !link.startsWith(\"https://\")) {\n setErrorMsg(\"External link must start with http:// or https://\");\n setStatus(\"error\");\n return;\n }\n\n setStatus(\"minting\");\n setErrorMsg(null);\n setStep(null);\n\n try {\n const outcome = await format.submit(shared, formatState, {\n client,\n signer: await getSigner(),\n getUploadToken,\n resume: resume?.format === formatKey ? resume.destination : null,\n onStep: setStep,\n });\n setResult(outcome);\n setResume(null);\n setStatus(\"success\");\n invalidatePortfolioCache(walletAddress);\n if (outcome.asset) onMinted?.(outcome.asset);\n void refetchCollections().catch(() => {});\n } catch (err) {\n if (err instanceof PartialCreateError) {\n setResume({ format: formatKey, destination: err.destination });\n setErrorMsg(`${err.message} ${describeError(err.reason).message} Press the button again to finish.`);\n } else {\n setErrorMsg(describeError(err).message);\n }\n setStatus(\"error\");\n }\n };\n\n const resetAll = () => {\n setStatus(\"idle\");\n setErrorMsg(null);\n setStep(null);\n setResult(null);\n setResume(null);\n form.reset();\n clearMedia();\n feature.clear();\n setFormatStates(initialFormatStates());\n draft.reset();\n templateFieldsRef.current = [];\n };\n\n const busy = status === \"minting\";\n\n const wrap = (node: React.ReactNode) => {\n if (presentation !== \"dialog\") return node;\n return (\n <Dialog open={open} onOpenChange={(next) => { if (!next) onClose?.(); }}>\n <DialogContent className=\"gap-0 p-6 sm:max-w-2xl sm:p-8\">\n <DialogTitle className=\"sr-only\">Create</DialogTitle>\n <DialogDescription className=\"sr-only\">Add media, describe it and publish it as an asset.</DialogDescription>\n {node}\n </DialogContent>\n </Dialog>\n );\n };\n\n if (status === \"success\" && result) {\n return wrap(\n <SuccessView presentation={presentation} previewImage={previewImage} result={result} onPublishAnother={resetAll} />\n );\n }\n\n if (!mediaFile) {\n return wrap(\n <Dropzone\n mediaKindLock={mediaKindLock}\n presentation={presentation}\n hasWallet={hasWallet}\n onRequireWallet={onRequireWallet}\n connectLabel={connectLabel}\n onFileSelected={handleMediaSelect}\n />\n );\n }\n\n const submitBlocked = !ready || busy || !hasWallet;\n const buttonLabel = busy\n ? `${step?.label ?? \"Working\"}…${step && step.total > 1 ? ` (${step.index} of ${step.total})` : \"\"}`\n : format.submitLabel(formatState);\n\n return wrap(\n <section className=\"space-y-6\">\n <MediaRow\n file={mediaFile}\n kind={mediaKind}\n preview={media.preview}\n uri={media.uri}\n uploading={media.uploading}\n ipType={ipType}\n inputRef={mediaInputRef}\n onSelect={handleMediaSelect}\n />\n\n {media.uri && (\n <div className=\"grid grid-cols-1 lg:grid-cols-[1fr_320px] gap-8 items-start\">\n <div className=\"space-y-5\">\n <FormatPicker formats={FORMATS} value={formatKey} onChange={setFormatKey} />\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Title *</label>\n <Input\n value={name}\n onChange={(e) => form.setValue(\"name\", e.target.value)}\n placeholder=\"My Creative Work\"\n />\n </div>\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Description</label>\n <Textarea\n value={description}\n onChange={(e) => form.setValue(\"description\", e.target.value)}\n placeholder=\"Describe your work, its story, and any context for buyers…\"\n rows={3}\n />\n </div>\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">External link <span className=\"text-muted-foreground font-normal\">(optional)</span></label>\n <Input\n value={form.watch(\"external_url\")}\n onChange={(e) => form.setValue(\"external_url\", e.target.value)}\n placeholder=\"https://yourwebsite.com\"\n />\n </div>\n\n {mediaKind !== \"image\" && (\n <CoverUpload\n preview={feature.preview}\n uploading={feature.uploading}\n inputRef={featureInputRef}\n onSelect={(file) => void feature.start(file, (f) => uploadFile(f, \"image\"), setErrorMsg)}\n />\n )}\n\n {shared && <format.Fields shared={shared} state={formatState} update={updateFormat} />}\n\n {status === \"error\" && errorMsg && <p className=\"text-xs text-destructive\">{errorMsg}</p>}\n\n <button\n type=\"button\"\n disabled={submitBlocked}\n onClick={() => void onSubmit()}\n className={cn(\n \"w-full h-12 text-base font-semibold text-white rounded-xl flex items-center justify-center gap-2 transition-all hover:brightness-110 active:scale-[0.98] bg-brand-blue\",\n submitBlocked && \"opacity-40 pointer-events-none\"\n )}\n >\n {busy && <Loader2 className=\"h-4 w-4 animate-spin\" />}\n {buttonLabel}\n </button>\n <p className=\"text-xs text-center text-muted-foreground\">\n Zero platform fees to mint.\n </p>\n </div>\n\n <div className=\"order-first lg:order-last lg:sticky lg:top-20 max-w-[260px] mx-auto w-full lg:max-w-none lg:mx-0\">\n <MedialaneCollectionCard\n image={previewImage}\n name={name}\n collection={shared ? format.previewLabel(shared, formatState) : undefined}\n creator={walletAddress ? `${walletAddress.slice(0, 6)}…${walletAddress.slice(-4)}` : undefined}\n creatorHref={walletAddress ? profileHref({ address: walletAddress }) : undefined}\n />\n </div>\n </div>\n )}\n </section>\n );\n}\n"],"mappings":";AAoLQ,SACE,KADF;AAlLR,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAC5B,SAAS,wBAA+C;AACxD,SAAS,gCAAgC;AACzC,SAAS,UAAU;AAEnB,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,+BAA+B;AACxC,SAAS,QAAQ,eAAe,mBAAmB,mBAAmB;AAEtE,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAC5B,SAAS,aAAa,cAAc,gBAAgB;AACpD,SAAS,0BAAyC;AAClD,SAAS,SAAS,WAAW,2BAA2B;AAExD,SAAS,sBAAuC;AAChD,SAAS,iBAAiB,wBAAwB,uBAAuB;AACzE,SAAS,qBAAqB;AAC9B,SAAS,6BAA6B;AAG/B,SAAS,SAAS,OAAsB;AAC7C,QAAM;AAAA,IACJ,eAAe;AAAA,IAAU,OAAO;AAAA,IAAM;AAAA,IAAS;AAAA,IAAe;AAAA,IAC9D;AAAA,IAAa;AAAA,IACb;AAAA,IAAW;AAAA,IAAe;AAAA,IAAiB;AAAA,IAAc;AAAA,IAAgB;AAAA,IACzE;AAAA,EACF,IAAI;AAEJ,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAmD,MAAM;AACrF,QAAM,CAAC,UAAU,WAAW,IAAI,SAAwB,IAAI;AAC5D,QAAM,CAAC,MAAM,OAAO,IAAI,SAA0B,IAAI;AAEtD,QAAM,QAAQ,cAAc;AAC5B,QAAM,UAAU,cAAc;AAC9B,QAAM,CAAC,WAAW,YAAY,IAAI,SAAsB,IAAI;AAC5D,QAAM,CAAC,WAAW,YAAY,IAAI,SAAoB,OAAO;AAC7D,QAAM,gBAAgB,OAA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