@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.
Files changed (112) hide show
  1. package/dist/components/approve-mint-dialog.d.cts +0 -1
  2. package/dist/components/approve-mint-dialog.d.ts +0 -1
  3. package/dist/components/fast-mint/asset-form-parts.cjs +28 -47
  4. package/dist/components/fast-mint/asset-form-parts.cjs.map +1 -1
  5. package/dist/components/fast-mint/asset-form-parts.d.cts +13 -8
  6. package/dist/components/fast-mint/asset-form-parts.d.ts +13 -8
  7. package/dist/components/fast-mint/asset-form-parts.js +29 -48
  8. package/dist/components/fast-mint/asset-form-parts.js.map +1 -1
  9. package/dist/components/fast-mint/collection-section.cjs +11 -21
  10. package/dist/components/fast-mint/collection-section.cjs.map +1 -1
  11. package/dist/components/fast-mint/collection-section.d.cts +5 -7
  12. package/dist/components/fast-mint/collection-section.d.ts +5 -7
  13. package/dist/components/fast-mint/collection-section.js +11 -21
  14. package/dist/components/fast-mint/collection-section.js.map +1 -1
  15. package/dist/components/fast-mint/create-then-add.cjs +55 -0
  16. package/dist/components/fast-mint/create-then-add.cjs.map +1 -0
  17. package/dist/components/fast-mint/create-then-add.d.cts +24 -0
  18. package/dist/components/fast-mint/create-then-add.d.ts +24 -0
  19. package/dist/components/fast-mint/create-then-add.js +30 -0
  20. package/dist/components/fast-mint/create-then-add.js.map +1 -0
  21. package/dist/components/fast-mint/dropzone.d.cts +0 -1
  22. package/dist/components/fast-mint/dropzone.d.ts +0 -1
  23. package/dist/components/fast-mint/fast-mint.cjs +68 -102
  24. package/dist/components/fast-mint/fast-mint.cjs.map +1 -1
  25. package/dist/components/fast-mint/fast-mint.js +70 -104
  26. package/dist/components/fast-mint/fast-mint.js.map +1 -1
  27. package/dist/components/fast-mint/formats/nft.cjs +233 -0
  28. package/dist/components/fast-mint/formats/nft.cjs.map +1 -0
  29. package/dist/components/fast-mint/formats/nft.d.cts +19 -0
  30. package/dist/components/fast-mint/formats/nft.d.ts +19 -0
  31. package/dist/components/fast-mint/formats/nft.js +214 -0
  32. package/dist/components/fast-mint/formats/nft.js.map +1 -0
  33. package/dist/components/fast-mint/formats/pop.cjs +160 -0
  34. package/dist/components/fast-mint/formats/pop.cjs.map +1 -0
  35. package/dist/components/fast-mint/formats/pop.d.cts +18 -0
  36. package/dist/components/fast-mint/formats/pop.d.ts +18 -0
  37. package/dist/components/fast-mint/formats/pop.js +136 -0
  38. package/dist/components/fast-mint/formats/pop.js.map +1 -0
  39. package/dist/components/fast-mint/formats/registry.cjs +42 -0
  40. package/dist/components/fast-mint/formats/registry.cjs.map +1 -0
  41. package/dist/components/fast-mint/formats/registry.d.cts +20 -0
  42. package/dist/components/fast-mint/formats/registry.d.ts +20 -0
  43. package/dist/components/fast-mint/formats/registry.js +16 -0
  44. package/dist/components/fast-mint/formats/registry.js.map +1 -0
  45. package/dist/components/fast-mint/formats/tiers.cjs +206 -0
  46. package/dist/components/fast-mint/formats/tiers.cjs.map +1 -0
  47. package/dist/components/fast-mint/formats/tiers.d.cts +19 -0
  48. package/dist/components/fast-mint/formats/tiers.d.ts +19 -0
  49. package/dist/components/fast-mint/formats/tiers.js +181 -0
  50. package/dist/components/fast-mint/formats/tiers.js.map +1 -0
  51. package/dist/components/fast-mint/formats/types.cjs +31 -0
  52. package/dist/components/fast-mint/formats/types.cjs.map +1 -0
  53. package/dist/components/fast-mint/formats/types.d.cts +71 -0
  54. package/dist/components/fast-mint/formats/types.d.ts +71 -0
  55. package/dist/components/fast-mint/formats/types.js +7 -0
  56. package/dist/components/fast-mint/formats/types.js.map +1 -0
  57. package/dist/components/fast-mint/media-kind.d.cts +0 -1
  58. package/dist/components/fast-mint/media-kind.d.ts +0 -1
  59. package/dist/components/fast-mint/success-view.cjs +18 -59
  60. package/dist/components/fast-mint/success-view.cjs.map +1 -1
  61. package/dist/components/fast-mint/success-view.d.cts +13 -8
  62. package/dist/components/fast-mint/success-view.d.ts +13 -8
  63. package/dist/components/fast-mint/success-view.js +19 -60
  64. package/dist/components/fast-mint/success-view.js.map +1 -1
  65. package/dist/components/fast-mint/types.cjs.map +1 -1
  66. package/dist/components/fast-mint/types.d.cts +0 -2
  67. package/dist/components/fast-mint/types.d.ts +0 -2
  68. package/dist/components/launchpad/collection-create-form.cjs +3 -2
  69. package/dist/components/launchpad/collection-create-form.cjs.map +1 -1
  70. package/dist/components/launchpad/collection-create-form.js +3 -2
  71. package/dist/components/launchpad/collection-create-form.js.map +1 -1
  72. package/dist/components/launchpad/pop-create-fields.cjs +5 -3
  73. package/dist/components/launchpad/pop-create-fields.cjs.map +1 -1
  74. package/dist/components/launchpad/pop-create-fields.d.cts +8 -2
  75. package/dist/components/launchpad/pop-create-fields.d.ts +8 -2
  76. package/dist/components/launchpad/pop-create-fields.js +4 -3
  77. package/dist/components/launchpad/pop-create-fields.js.map +1 -1
  78. package/dist/components/launchpad/pop-create.cjs +8 -12
  79. package/dist/components/launchpad/pop-create.cjs.map +1 -1
  80. package/dist/components/launchpad/pop-create.js +8 -12
  81. package/dist/components/launchpad/pop-create.js.map +1 -1
  82. package/dist/components/launchpad/tier-mint-form.cjs +8 -25
  83. package/dist/components/launchpad/tier-mint-form.cjs.map +1 -1
  84. package/dist/components/launchpad/tier-mint-form.js +6 -23
  85. package/dist/components/launchpad/tier-mint-form.js.map +1 -1
  86. package/dist/components/transfer-dialog.d.cts +0 -1
  87. package/dist/components/transfer-dialog.d.ts +0 -1
  88. package/dist/data/launchpad-services.cjs +12 -12
  89. package/dist/data/launchpad-services.cjs.map +1 -1
  90. package/dist/data/launchpad-services.js +12 -12
  91. package/dist/data/launchpad-services.js.map +1 -1
  92. package/dist/index.d.cts +4 -0
  93. package/dist/index.d.ts +4 -0
  94. package/dist/utils/drop/actions.d.cts +0 -1
  95. package/dist/utils/drop/actions.d.ts +0 -1
  96. package/dist/utils/drop/types.d.cts +0 -1
  97. package/dist/utils/drop/types.d.ts +0 -1
  98. package/dist/utils/launchpad-actions.cjs +90 -0
  99. package/dist/utils/launchpad-actions.cjs.map +1 -0
  100. package/dist/utils/launchpad-actions.d.cts +39 -0
  101. package/dist/utils/launchpad-actions.d.ts +39 -0
  102. package/dist/utils/launchpad-actions.js +60 -0
  103. package/dist/utils/launchpad-actions.js.map +1 -0
  104. package/dist/utils/use-transaction.d.cts +0 -1
  105. package/dist/utils/use-transaction.d.ts +0 -1
  106. package/package.json +1 -1
  107. package/dist/components/fast-mint/mint-asset.cjs +0 -124
  108. package/dist/components/fast-mint/mint-asset.cjs.map +0 -1
  109. package/dist/components/fast-mint/mint-asset.d.cts +0 -41
  110. package/dist/components/fast-mint/mint-asset.d.ts +0 -41
  111. package/dist/components/fast-mint/mint-asset.js +0 -100
  112. package/dist/components/fast-mint/mint-asset.js.map +0 -1
@@ -8,7 +8,6 @@ import { Textarea } from "../textarea.js";
8
8
  import { Popover, PopoverContent, PopoverTrigger } from "../popover.js";
9
9
  import { cn } from "../../utils/cn.js";
10
10
  import { useImageUrl } from "../../utils/use-image-url.js";
11
- import { collectionKey } from "./mintable-collections.js";
12
11
  function collectionDisplayLabel(col) {
13
12
  return col.name || col.symbol || `Collection #${col.collectionId}`;
14
13
  }
@@ -75,23 +74,22 @@ function CollectionPicker({
75
74
  ] });
76
75
  }
77
76
  function CollectionSection({
78
- assetType,
79
77
  mode,
80
78
  onModeChange,
81
79
  collections,
82
- existingId,
83
- existingContract,
84
- onExistingId,
85
- onExistingContract,
80
+ value,
81
+ onValue,
82
+ valueOf,
86
83
  draft,
87
- previewImage
84
+ previewImage,
85
+ noun = "collection"
88
86
  }) {
89
- const single = assetType === "single";
90
87
  return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
91
88
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
92
89
  /* @__PURE__ */ jsxs("label", { className: "text-sm font-medium flex items-center gap-1.5", children: [
93
90
  /* @__PURE__ */ jsx(Boxes, { className: "h-4 w-4" }),
94
- "Collection *"
91
+ noun.charAt(0).toUpperCase() + noun.slice(1),
92
+ " *"
95
93
  ] }),
96
94
  /* @__PURE__ */ jsxs("div", { className: "flex rounded-lg border border-border overflow-hidden", children: [
97
95
  /* @__PURE__ */ jsx(
@@ -123,15 +121,7 @@ function CollectionSection({
123
121
  )
124
122
  ] })
125
123
  ] }),
126
- mode === "existing" ? /* @__PURE__ */ jsx(
127
- CollectionPicker,
128
- {
129
- collections,
130
- value: single ? existingId : existingContract,
131
- onChange: single ? onExistingId : onExistingContract,
132
- valueOf: collectionKey(assetType)
133
- }
134
- ) : /* @__PURE__ */ jsxs("div", { className: "flex gap-3 rounded-xl border border-border p-3", children: [
124
+ mode === "existing" ? /* @__PURE__ */ jsx(CollectionPicker, { collections, value, onChange: onValue, valueOf }) : /* @__PURE__ */ jsxs("div", { className: "flex gap-3 rounded-xl border border-border p-3", children: [
135
125
  /* @__PURE__ */ jsx("div", { className: "relative h-16 w-16 rounded-lg overflow-hidden bg-muted shrink-0", children: previewImage ? /* @__PURE__ */ jsx(Image, { src: previewImage, alt: "", fill: true, className: "object-cover", unoptimized: true }) : /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx(Boxes, { className: "h-5 w-5 text-muted-foreground/40" }) }) }),
136
126
  /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 space-y-2", children: [
137
127
  /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[1fr_100px] gap-2", children: [
@@ -140,7 +130,7 @@ function CollectionSection({
140
130
  {
141
131
  value: draft.name,
142
132
  onChange: (e) => draft.setName(e.target.value),
143
- placeholder: "Collection name",
133
+ placeholder: `${noun.charAt(0).toUpperCase() + noun.slice(1)} name`,
144
134
  className: "h-9 text-sm"
145
135
  }
146
136
  ),
@@ -159,12 +149,12 @@ function CollectionSection({
159
149
  {
160
150
  value: draft.description,
161
151
  onChange: (e) => draft.setDescription(e.target.value),
162
- placeholder: "Describe this collection\u2026",
152
+ placeholder: `Describe this ${noun}\u2026`,
163
153
  rows: 2,
164
154
  className: "text-sm resize-none"
165
155
  }
166
156
  ),
167
- /* @__PURE__ */ jsx("p", { className: "text-2xs text-muted-foreground", children: "Prefilled from your asset \u2014 edit anything above." })
157
+ /* @__PURE__ */ jsx("p", { className: "text-2xs text-muted-foreground", children: "Prefilled from the title and description \u2014 edit anything above." })
168
158
  ] })
169
159
  ] })
170
160
  ] });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/fast-mint/collection-section.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport Image from \"next/image\";\nimport type { ApiCollection } from \"@medialane/sdk\";\nimport { Boxes, Check, ChevronDown, Plus } from \"lucide-react\";\nimport { Input } from \"../input.js\";\nimport { Textarea } from \"../textarea.js\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover.js\";\nimport { cn } from \"../../utils/cn.js\";\nimport { useImageUrl } from \"../../utils/use-image-url.js\";\nimport { collectionKey, type MintAssetType } from \"./mintable-collections.js\";\nimport type { useNewCollectionDraft } from \"./use-new-collection-draft.js\";\n\nfunction collectionDisplayLabel(col: ApiCollection) {\n return col.name || col.symbol || `Collection #${col.collectionId}`;\n}\n\nfunction CollectionThumb({ image }: { image: string | null | undefined }) {\n const resolveImage = useImageUrl();\n const imageUrl = resolveImage(image);\n return (\n <div className=\"relative h-10 w-10 rounded-lg overflow-hidden bg-muted shrink-0\">\n {imageUrl ? (\n <Image src={imageUrl} alt=\"\" fill className=\"object-cover\" unoptimized />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n <Boxes className=\"h-4 w-4 text-muted-foreground/40\" />\n </div>\n )}\n </div>\n );\n}\n\nexport function CollectionPicker({\n collections, value, onChange, valueOf,\n}: {\n collections: ApiCollection[];\n value: string;\n onChange: (id: string) => void;\n valueOf: (c: ApiCollection) => string | null | undefined;\n}) {\n const [open, setOpen] = useState(false);\n const selected = value\n ? collections.find((c) => valueOf(c) === value) ?? null\n : null;\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n aria-expanded={open}\n className=\"flex w-full items-center gap-3 rounded-xl border border-border p-3 text-left transition-colors hover:bg-muted/40\"\n >\n <CollectionThumb image={selected?.image} />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-semibold truncate\">\n {selected ? collectionDisplayLabel(selected) : collections.length ? \"Choose a collection\" : \"No collections yet\"}\n </p>\n <p className=\"text-xs text-muted-foreground\">\n {selected ? `${selected.totalSupply ?? 0} work${selected.totalSupply === 1 ? \"\" : \"s\"}` : \"Where this work will live\"}\n </p>\n </div>\n <ChevronDown className=\"h-3.5 w-3.5 text-muted-foreground shrink-0\" />\n </button>\n </PopoverTrigger>\n <PopoverContent className=\"w-[var(--radix-popover-trigger-width)] p-0\" align=\"start\">\n <div className=\"max-h-64 overflow-y-auto p-1\">\n {collections.length === 0 ? (\n <p className=\"px-3 py-4 text-center text-sm text-muted-foreground\">No collections yet — create one instead.</p>\n ) : (\n collections.map((col) => {\n const id = valueOf(col);\n const isSelected = !!id && value === id;\n return (\n <button\n key={id ?? col.contractAddress ?? col.name}\n type=\"button\"\n disabled={!id}\n onClick={() => { if (!id) return; onChange(id); setOpen(false); }}\n className=\"flex w-full items-center gap-2.5 rounded-lg px-2 py-2 text-left transition-colors hover:bg-muted/60\"\n >\n <CollectionThumb image={col.image} />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-medium truncate\">{collectionDisplayLabel(col)}</p>\n <p className=\"text-xs text-muted-foreground\">{col.totalSupply ?? 0} work{col.totalSupply === 1 ? \"\" : \"s\"}</p>\n </div>\n {isSelected && <Check className=\"h-4 w-4 text-brand-blue shrink-0\" />}\n </button>\n );\n })\n )}\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n\n\nexport type CollectionMode = \"existing\" | \"new\";\n\nexport function CollectionSection({\n assetType, mode, onModeChange, collections, existingId, existingContract, onExistingId, onExistingContract, draft, previewImage,\n}: {\n assetType: MintAssetType;\n mode: CollectionMode;\n onModeChange: (mode: CollectionMode) => void;\n collections: ApiCollection[];\n existingId: string;\n existingContract: string;\n onExistingId: (id: string) => void;\n onExistingContract: (contract: string) => void;\n draft: ReturnType<typeof useNewCollectionDraft>;\n previewImage: string | null;\n}) {\n const single = assetType === \"single\";\n return (\n <div className=\"space-y-2\">\n <div className=\"flex items-center justify-between\">\n <label className=\"text-sm font-medium flex items-center gap-1.5\">\n <Boxes className=\"h-4 w-4\" />\n Collection *\n </label>\n <div className=\"flex rounded-lg border border-border overflow-hidden\">\n <button\n type=\"button\"\n onClick={() => onModeChange(\"existing\")}\n className={cn(\"px-3 h-7 text-xs font-medium transition-colors\",\n mode === \"existing\" ? \"bg-primary text-primary-foreground\" : \"bg-background hover:bg-muted text-muted-foreground\")}\n >\n Existing\n </button>\n <button\n type=\"button\"\n onClick={() => onModeChange(\"new\")}\n className={cn(\"px-3 h-7 text-xs font-medium border-l border-border transition-colors flex items-center gap-1\",\n mode === \"new\" ? \"bg-primary text-primary-foreground\" : \"bg-background hover:bg-muted text-muted-foreground\")}\n >\n <Plus className=\"h-3 w-3\" />New\n </button>\n </div>\n </div>\n\n {mode === \"existing\" ? (\n <CollectionPicker\n collections={collections}\n value={single ? existingId : existingContract}\n onChange={single ? onExistingId : onExistingContract}\n valueOf={collectionKey(assetType)}\n />\n ) : (\n <div className=\"flex gap-3 rounded-xl border border-border p-3\">\n <div className=\"relative h-16 w-16 rounded-lg overflow-hidden bg-muted shrink-0\">\n {previewImage ? (\n <Image src={previewImage} alt=\"\" fill className=\"object-cover\" unoptimized />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n <Boxes className=\"h-5 w-5 text-muted-foreground/40\" />\n </div>\n )}\n </div>\n <div className=\"min-w-0 flex-1 space-y-2\">\n <div className=\"grid grid-cols-[1fr_100px] gap-2\">\n <Input\n value={draft.name}\n onChange={(e) => draft.setName(e.target.value)}\n placeholder=\"Collection name\"\n className=\"h-9 text-sm\"\n />\n <Input\n value={draft.symbol}\n onChange={(e) => draft.setSymbol(e.target.value.toUpperCase())}\n placeholder=\"SYMBOL\"\n className=\"h-9 text-sm\"\n />\n </div>\n <Textarea\n value={draft.description}\n onChange={(e) => draft.setDescription(e.target.value)}\n placeholder=\"Describe this collection…\"\n rows={2}\n className=\"text-sm resize-none\"\n />\n <p className=\"text-2xs text-muted-foreground\">Prefilled from your asset — edit anything above.</p>\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";AAwBQ,cAgCE,YAhCF;AAtBR,SAAS,gBAAgB;AACzB,OAAO,WAAW;AAElB,SAAS,OAAO,OAAO,aAAa,YAAY;AAChD,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,qBAAyC;AAGlD,SAAS,uBAAuB,KAAoB;AAClD,SAAO,IAAI,QAAQ,IAAI,UAAU,eAAe,IAAI,YAAY;AAClE;AAEA,SAAS,gBAAgB,EAAE,MAAM,GAAyC;AACxE,QAAM,eAAe,YAAY;AACjC,QAAM,WAAW,aAAa,KAAK;AACnC,SACE,oBAAC,SAAI,WAAU,mEACZ,qBACC,oBAAC,SAAM,KAAK,UAAU,KAAI,IAAG,MAAI,MAAC,WAAU,gBAAe,aAAW,MAAC,IAEvE,oBAAC,SAAI,WAAU,qDACb,8BAAC,SAAM,WAAU,oCAAmC,GACtD,GAEJ;AAEJ;AAEO,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EAAa;AAAA,EAAO;AAAA,EAAU;AAChC,GAKG;AACD,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,KAAK;AACtC,QAAM,WAAW,QACb,YAAY,KAAK,CAAC,MAAM,QAAQ,CAAC,MAAM,KAAK,KAAK,OACjD;AAEJ,SACE,qBAAC,WAAQ,MAAY,cAAc,SACjC;AAAA,wBAAC,kBAAe,SAAO,MACrB;AAAA,MAAC;AAAA;AAAA,QACC,MAAK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GAEJ;AAAA,MACA,qBAAC,SAAI,WAAU,4BACb;AAAA,6BAAC,SAAI,WAAU,oCACb;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,OAAO,MAAM;AAAA,cACb,UAAU,CAAC,MAAM,MAAM,QAAQ,EAAE,OAAO,KAAK;AAAA,cAC7C,aAAY;AAAA,cACZ,WAAU;AAAA;AAAA,UACZ;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,OAAO,MAAM;AAAA,cACb,UAAU,CAAC,MAAM,MAAM,UAAU,EAAE,OAAO,MAAM,YAAY,CAAC;AAAA,cAC7D,aAAY;AAAA,cACZ,WAAU;AAAA;AAAA,UACZ;AAAA,WACF;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,OAAO,MAAM;AAAA,YACb,UAAU,CAAC,MAAM,MAAM,eAAe,EAAE,OAAO,KAAK;AAAA,YACpD,aAAY;AAAA,YACZ,MAAM;AAAA,YACN,WAAU;AAAA;AAAA,QACZ;AAAA,QACA,oBAAC,OAAE,WAAU,kCAAiC,mEAAgD;AAAA,SAChG;AAAA,OACF;AAAA,KAEJ;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/fast-mint/collection-section.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport Image from \"next/image\";\nimport type { ApiCollection } from \"@medialane/sdk\";\nimport { Boxes, Check, ChevronDown, Plus } from \"lucide-react\";\nimport { Input } from \"../input.js\";\nimport { Textarea } from \"../textarea.js\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover.js\";\nimport { cn } from \"../../utils/cn.js\";\nimport { useImageUrl } from \"../../utils/use-image-url.js\";\nimport type { useNewCollectionDraft } from \"./use-new-collection-draft.js\";\n\nfunction collectionDisplayLabel(col: ApiCollection) {\n return col.name || col.symbol || `Collection #${col.collectionId}`;\n}\n\nfunction CollectionThumb({ image }: { image: string | null | undefined }) {\n const resolveImage = useImageUrl();\n const imageUrl = resolveImage(image);\n return (\n <div className=\"relative h-10 w-10 rounded-lg overflow-hidden bg-muted shrink-0\">\n {imageUrl ? (\n <Image src={imageUrl} alt=\"\" fill className=\"object-cover\" unoptimized />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n <Boxes className=\"h-4 w-4 text-muted-foreground/40\" />\n </div>\n )}\n </div>\n );\n}\n\nexport function CollectionPicker({\n collections, value, onChange, valueOf,\n}: {\n collections: ApiCollection[];\n value: string;\n onChange: (id: string) => void;\n valueOf: (c: ApiCollection) => string | null | undefined;\n}) {\n const [open, setOpen] = useState(false);\n const selected = value\n ? collections.find((c) => valueOf(c) === value) ?? null\n : null;\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n aria-expanded={open}\n className=\"flex w-full items-center gap-3 rounded-xl border border-border p-3 text-left transition-colors hover:bg-muted/40\"\n >\n <CollectionThumb image={selected?.image} />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-semibold truncate\">\n {selected ? collectionDisplayLabel(selected) : collections.length ? \"Choose a collection\" : \"No collections yet\"}\n </p>\n <p className=\"text-xs text-muted-foreground\">\n {selected ? `${selected.totalSupply ?? 0} work${selected.totalSupply === 1 ? \"\" : \"s\"}` : \"Where this work will live\"}\n </p>\n </div>\n <ChevronDown className=\"h-3.5 w-3.5 text-muted-foreground shrink-0\" />\n </button>\n </PopoverTrigger>\n <PopoverContent className=\"w-[var(--radix-popover-trigger-width)] p-0\" align=\"start\">\n <div className=\"max-h-64 overflow-y-auto p-1\">\n {collections.length === 0 ? (\n <p className=\"px-3 py-4 text-center text-sm text-muted-foreground\">No collections yet — create one instead.</p>\n ) : (\n collections.map((col) => {\n const id = valueOf(col);\n const isSelected = !!id && value === id;\n return (\n <button\n key={id ?? col.contractAddress ?? col.name}\n type=\"button\"\n disabled={!id}\n onClick={() => { if (!id) return; onChange(id); setOpen(false); }}\n className=\"flex w-full items-center gap-2.5 rounded-lg px-2 py-2 text-left transition-colors hover:bg-muted/60\"\n >\n <CollectionThumb image={col.image} />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-medium truncate\">{collectionDisplayLabel(col)}</p>\n <p className=\"text-xs text-muted-foreground\">{col.totalSupply ?? 0} work{col.totalSupply === 1 ? \"\" : \"s\"}</p>\n </div>\n {isSelected && <Check className=\"h-4 w-4 text-brand-blue shrink-0\" />}\n </button>\n );\n })\n )}\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n\n\nexport type CollectionMode = \"existing\" | \"new\";\n\nexport function CollectionSection({\n mode, onModeChange, collections, value, onValue, valueOf, draft, previewImage, noun = \"collection\",\n}: {\n mode: CollectionMode;\n onModeChange: (mode: CollectionMode) => void;\n collections: ApiCollection[];\n value: string;\n onValue: (value: string) => void;\n valueOf: (c: ApiCollection) => string | null | undefined;\n draft: ReturnType<typeof useNewCollectionDraft>;\n previewImage: string | null;\n noun?: string;\n}) {\n return (\n <div className=\"space-y-2\">\n <div className=\"flex items-center justify-between\">\n <label className=\"text-sm font-medium flex items-center gap-1.5\">\n <Boxes className=\"h-4 w-4\" />\n {noun.charAt(0).toUpperCase() + noun.slice(1)} *\n </label>\n <div className=\"flex rounded-lg border border-border overflow-hidden\">\n <button\n type=\"button\"\n onClick={() => onModeChange(\"existing\")}\n className={cn(\"px-3 h-7 text-xs font-medium transition-colors\",\n mode === \"existing\" ? \"bg-primary text-primary-foreground\" : \"bg-background hover:bg-muted text-muted-foreground\")}\n >\n Existing\n </button>\n <button\n type=\"button\"\n onClick={() => onModeChange(\"new\")}\n className={cn(\"px-3 h-7 text-xs font-medium border-l border-border transition-colors flex items-center gap-1\",\n mode === \"new\" ? \"bg-primary text-primary-foreground\" : \"bg-background hover:bg-muted text-muted-foreground\")}\n >\n <Plus className=\"h-3 w-3\" />New\n </button>\n </div>\n </div>\n\n {mode === \"existing\" ? (\n <CollectionPicker collections={collections} value={value} onChange={onValue} valueOf={valueOf} />\n ) : (\n <div className=\"flex gap-3 rounded-xl border border-border p-3\">\n <div className=\"relative h-16 w-16 rounded-lg overflow-hidden bg-muted shrink-0\">\n {previewImage ? (\n <Image src={previewImage} alt=\"\" fill className=\"object-cover\" unoptimized />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n <Boxes className=\"h-5 w-5 text-muted-foreground/40\" />\n </div>\n )}\n </div>\n <div className=\"min-w-0 flex-1 space-y-2\">\n <div className=\"grid grid-cols-[1fr_100px] gap-2\">\n <Input\n value={draft.name}\n onChange={(e) => draft.setName(e.target.value)}\n placeholder={`${noun.charAt(0).toUpperCase() + noun.slice(1)} name`}\n className=\"h-9 text-sm\"\n />\n <Input\n value={draft.symbol}\n onChange={(e) => draft.setSymbol(e.target.value.toUpperCase())}\n placeholder=\"SYMBOL\"\n className=\"h-9 text-sm\"\n />\n </div>\n <Textarea\n value={draft.description}\n onChange={(e) => draft.setDescription(e.target.value)}\n placeholder={`Describe this ${noun}…`}\n rows={2}\n className=\"text-sm resize-none\"\n />\n <p className=\"text-2xs text-muted-foreground\">Prefilled from the title and description — edit anything above.</p>\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";AAuBQ,cAgCE,YAhCF;AArBR,SAAS,gBAAgB;AACzB,OAAO,WAAW;AAElB,SAAS,OAAO,OAAO,aAAa,YAAY;AAChD,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAG5B,SAAS,uBAAuB,KAAoB;AAClD,SAAO,IAAI,QAAQ,IAAI,UAAU,eAAe,IAAI,YAAY;AAClE;AAEA,SAAS,gBAAgB,EAAE,MAAM,GAAyC;AACxE,QAAM,eAAe,YAAY;AACjC,QAAM,WAAW,aAAa,KAAK;AACnC,SACE,oBAAC,SAAI,WAAU,mEACZ,qBACC,oBAAC,SAAM,KAAK,UAAU,KAAI,IAAG,MAAI,MAAC,WAAU,gBAAe,aAAW,MAAC,IAEvE,oBAAC,SAAI,WAAU,qDACb,8BA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,QAC9B;AAAA,SACF;AAAA,OACF;AAAA,IAEC,SAAS,aACR,oBAAC,oBAAiB,aAA0B,OAAc,UAAU,SAAS,SAAkB,IAE/F,qBAAC,SAAI,WAAU,kDACb;AAAA,0BAAC,SAAI,WAAU,mEACZ,yBACC,oBAAC,SAAM,KAAK,cAAc,KAAI,IAAG,MAAI,MAAC,WAAU,gBAAe,aAAW,MAAC,IAE3E,oBAAC,SAAI,WAAU,qDACb,8BAAC,SAAM,WAAU,oCAAmC,GACtD,GAEJ;AAAA,MACA,qBAAC,SAAI,WAAU,4BACb;AAAA,6BAAC,SAAI,WAAU,oCACb;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,OAAO,MAAM;AAAA,cACb,UAAU,CAAC,MAAM,MAAM,QAAQ,EAAE,OAAO,KAAK;AAAA,cAC7C,aAAa,GAAG,KAAK,OAAO,CAAC,EAAE,YAAY,IAAI,KAAK,MAAM,CAAC,CAAC;AAAA,cAC5D,WAAU;AAAA;AAAA,UACZ;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,OAAO,MAAM;AAAA,cACb,UAAU,CAAC,MAAM,MAAM,UAAU,EAAE,OAAO,MAAM,YAAY,CAAC;AAAA,cAC7D,aAAY;AAAA,cACZ,WAAU;AAAA;AAAA,UACZ;AAAA,WACF;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,OAAO,MAAM;AAAA,YACb,UAAU,CAAC,MAAM,MAAM,eAAe,EAAE,OAAO,KAAK;AAAA,YACpD,aAAa,iBAAiB,IAAI;AAAA,YAClC,MAAM;AAAA,YACN,WAAU;AAAA;AAAA,QACZ;AAAA,QACA,oBAAC,OAAE,WAAU,kCAAiC,kFAA+D;AAAA,SAC/G;AAAA,OACF;AAAA,KAEJ;AAEJ;","names":[]}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var create_then_add_exports = {};
20
+ __export(create_then_add_exports, {
21
+ PartialCreateError: () => PartialCreateError,
22
+ createThenAdd: () => createThenAdd
23
+ });
24
+ module.exports = __toCommonJS(create_then_add_exports);
25
+ class PartialCreateError extends Error {
26
+ constructor(destination, noun, reason) {
27
+ super(`Your ${noun} was created, but the last step did not finish.`);
28
+ this.name = "PartialCreateError";
29
+ this.destination = destination;
30
+ this.noun = noun;
31
+ this.reason = reason;
32
+ }
33
+ }
34
+ async function createThenAdd(opts) {
35
+ const { existing, create, add, labels, noun, onStep } = opts;
36
+ const total = existing === null ? 2 : 1;
37
+ if (existing !== null) {
38
+ onStep({ label: labels.add, index: 1, total });
39
+ return add(existing);
40
+ }
41
+ onStep({ label: labels.create, index: 1, total });
42
+ const created = await create();
43
+ onStep({ label: labels.add, index: 2, total });
44
+ try {
45
+ return await add(created);
46
+ } catch (reason) {
47
+ throw new PartialCreateError(created, noun, reason);
48
+ }
49
+ }
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ PartialCreateError,
53
+ createThenAdd
54
+ });
55
+ //# sourceMappingURL=create-then-add.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/fast-mint/create-then-add.ts"],"sourcesContent":["export interface StepInfo {\n label: string;\n index: number;\n total: number;\n}\n\nexport class PartialCreateError extends Error {\n readonly destination: unknown;\n readonly noun: string;\n readonly reason: unknown;\n\n constructor(destination: unknown, noun: string, reason: unknown) {\n super(`Your ${noun} was created, but the last step did not finish.`);\n this.name = \"PartialCreateError\";\n this.destination = destination;\n this.noun = noun;\n this.reason = reason;\n }\n}\n\nexport async function createThenAdd<D, R>(opts: {\n existing: D | null;\n create: () => Promise<D>;\n add: (destination: D) => Promise<R>;\n labels: { create: string; add: string };\n noun: string;\n onStep: (step: StepInfo) => void;\n}): Promise<R> {\n const { existing, create, add, labels, noun, onStep } = opts;\n const total = existing === null ? 2 : 1;\n\n if (existing !== null) {\n onStep({ label: labels.add, index: 1, total });\n return add(existing);\n }\n\n onStep({ label: labels.create, index: 1, total });\n const created = await create();\n onStep({ label: labels.add, index: 2, total });\n try {\n return await add(created);\n } catch (reason) {\n throw new PartialCreateError(created, noun, reason);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,MAAM,2BAA2B,MAAM;AAAA,EAK5C,YAAY,aAAsB,MAAc,QAAiB;AAC/D,UAAM,QAAQ,IAAI,iDAAiD;AACnE,SAAK,OAAO;AACZ,SAAK,cAAc;AACnB,SAAK,OAAO;AACZ,SAAK,SAAS;AAAA,EAChB;AACF;AAEA,eAAsB,cAAoB,MAO3B;AACb,QAAM,EAAE,UAAU,QAAQ,KAAK,QAAQ,MAAM,OAAO,IAAI;AACxD,QAAM,QAAQ,aAAa,OAAO,IAAI;AAEtC,MAAI,aAAa,MAAM;AACrB,WAAO,EAAE,OAAO,OAAO,KAAK,OAAO,GAAG,MAAM,CAAC;AAC7C,WAAO,IAAI,QAAQ;AAAA,EACrB;AAEA,SAAO,EAAE,OAAO,OAAO,QAAQ,OAAO,GAAG,MAAM,CAAC;AAChD,QAAM,UAAU,MAAM,OAAO;AAC7B,SAAO,EAAE,OAAO,OAAO,KAAK,OAAO,GAAG,MAAM,CAAC;AAC7C,MAAI;AACF,WAAO,MAAM,IAAI,OAAO;AAAA,EAC1B,SAAS,QAAQ;AACf,UAAM,IAAI,mBAAmB,SAAS,MAAM,MAAM;AAAA,EACpD;AACF;","names":[]}
@@ -0,0 +1,24 @@
1
+ interface StepInfo {
2
+ label: string;
3
+ index: number;
4
+ total: number;
5
+ }
6
+ declare class PartialCreateError extends Error {
7
+ readonly destination: unknown;
8
+ readonly noun: string;
9
+ readonly reason: unknown;
10
+ constructor(destination: unknown, noun: string, reason: unknown);
11
+ }
12
+ declare function createThenAdd<D, R>(opts: {
13
+ existing: D | null;
14
+ create: () => Promise<D>;
15
+ add: (destination: D) => Promise<R>;
16
+ labels: {
17
+ create: string;
18
+ add: string;
19
+ };
20
+ noun: string;
21
+ onStep: (step: StepInfo) => void;
22
+ }): Promise<R>;
23
+
24
+ export { PartialCreateError, type StepInfo, createThenAdd };
@@ -0,0 +1,24 @@
1
+ interface StepInfo {
2
+ label: string;
3
+ index: number;
4
+ total: number;
5
+ }
6
+ declare class PartialCreateError extends Error {
7
+ readonly destination: unknown;
8
+ readonly noun: string;
9
+ readonly reason: unknown;
10
+ constructor(destination: unknown, noun: string, reason: unknown);
11
+ }
12
+ declare function createThenAdd<D, R>(opts: {
13
+ existing: D | null;
14
+ create: () => Promise<D>;
15
+ add: (destination: D) => Promise<R>;
16
+ labels: {
17
+ create: string;
18
+ add: string;
19
+ };
20
+ noun: string;
21
+ onStep: (step: StepInfo) => void;
22
+ }): Promise<R>;
23
+
24
+ export { PartialCreateError, type StepInfo, createThenAdd };
@@ -0,0 +1,30 @@
1
+ class PartialCreateError extends Error {
2
+ constructor(destination, noun, reason) {
3
+ super(`Your ${noun} was created, but the last step did not finish.`);
4
+ this.name = "PartialCreateError";
5
+ this.destination = destination;
6
+ this.noun = noun;
7
+ this.reason = reason;
8
+ }
9
+ }
10
+ async function createThenAdd(opts) {
11
+ const { existing, create, add, labels, noun, onStep } = opts;
12
+ const total = existing === null ? 2 : 1;
13
+ if (existing !== null) {
14
+ onStep({ label: labels.add, index: 1, total });
15
+ return add(existing);
16
+ }
17
+ onStep({ label: labels.create, index: 1, total });
18
+ const created = await create();
19
+ onStep({ label: labels.add, index: 2, total });
20
+ try {
21
+ return await add(created);
22
+ } catch (reason) {
23
+ throw new PartialCreateError(created, noun, reason);
24
+ }
25
+ }
26
+ export {
27
+ PartialCreateError,
28
+ createThenAdd
29
+ };
30
+ //# sourceMappingURL=create-then-add.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/fast-mint/create-then-add.ts"],"sourcesContent":["export interface StepInfo {\n label: string;\n index: number;\n total: number;\n}\n\nexport class PartialCreateError extends Error {\n readonly destination: unknown;\n readonly noun: string;\n readonly reason: unknown;\n\n constructor(destination: unknown, noun: string, reason: unknown) {\n super(`Your ${noun} was created, but the last step did not finish.`);\n this.name = \"PartialCreateError\";\n this.destination = destination;\n this.noun = noun;\n this.reason = reason;\n }\n}\n\nexport async function createThenAdd<D, R>(opts: {\n existing: D | null;\n create: () => Promise<D>;\n add: (destination: D) => Promise<R>;\n labels: { create: string; add: string };\n noun: string;\n onStep: (step: StepInfo) => void;\n}): Promise<R> {\n const { existing, create, add, labels, noun, onStep } = opts;\n const total = existing === null ? 2 : 1;\n\n if (existing !== null) {\n onStep({ label: labels.add, index: 1, total });\n return add(existing);\n }\n\n onStep({ label: labels.create, index: 1, total });\n const created = await create();\n onStep({ label: labels.add, index: 2, total });\n try {\n return await add(created);\n } catch (reason) {\n throw new PartialCreateError(created, noun, reason);\n }\n}\n"],"mappings":"AAMO,MAAM,2BAA2B,MAAM;AAAA,EAK5C,YAAY,aAAsB,MAAc,QAAiB;AAC/D,UAAM,QAAQ,IAAI,iDAAiD;AACnE,SAAK,OAAO;AACZ,SAAK,cAAc;AACnB,SAAK,OAAO;AACZ,SAAK,SAAS;AAAA,EAChB;AACF;AAEA,eAAsB,cAAoB,MAO3B;AACb,QAAM,EAAE,UAAU,QAAQ,KAAK,QAAQ,MAAM,OAAO,IAAI;AACxD,QAAM,QAAQ,aAAa,OAAO,IAAI;AAEtC,MAAI,aAAa,MAAM;AACrB,WAAO,EAAE,OAAO,OAAO,KAAK,OAAO,GAAG,MAAM,CAAC;AAC7C,WAAO,IAAI,QAAQ;AAAA,EACrB;AAEA,SAAO,EAAE,OAAO,OAAO,QAAQ,OAAO,GAAG,MAAM,CAAC;AAChD,QAAM,UAAU,MAAM,OAAO;AAC7B,SAAO,EAAE,OAAO,OAAO,KAAK,OAAO,GAAG,MAAM,CAAC;AAC7C,MAAI;AACF,WAAO,MAAM,IAAI,OAAO;AAAA,EAC1B,SAAS,QAAQ;AACf,UAAM,IAAI,mBAAmB,SAAS,MAAM,MAAM;AAAA,EACpD;AACF;","names":[]}
@@ -1,6 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { MediaKind } from './types.cjs';
3
- import 'react';
4
3
  import 'starknet';
5
4
  import '@medialane/sdk';
6
5
  import '@medialane/sdk/starknet';
@@ -1,6 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { MediaKind } from './types.js';
3
- import 'react';
4
3
  import 'starknet';
5
4
  import '@medialane/sdk';
6
5
  import '@medialane/sdk/starknet';
@@ -30,6 +30,7 @@ var import_sdk = require("@medialane/sdk");
30
30
  var import_describe_error = require("../../utils/describe-error.js");
31
31
  var import_upload_limits = require("../../utils/upload-limits.js");
32
32
  var import_ipfs_upload = require("../../utils/ipfs-upload.js");
33
+ var import_portfolio_cache = require("../../utils/portfolio-cache.js");
33
34
  var import_cn = require("../../utils/cn.js");
34
35
  var import_input = require("../input.js");
35
36
  var import_textarea = require("../textarea.js");
@@ -38,13 +39,10 @@ var import_dialog = require("../dialog.js");
38
39
  var import_dropzone = require("./dropzone.js");
39
40
  var import_success_view = require("./success-view.js");
40
41
  var import_asset_form_parts = require("./asset-form-parts.js");
41
- var import_collection_section = require("./collection-section.js");
42
- var import_licensing_section = require("./licensing-section.js");
43
- var import_ip_type_section = require("./ip-type-section.js");
42
+ var import_create_then_add = require("./create-then-add.js");
43
+ var import_registry = require("./formats/registry.js");
44
44
  var import_form = require("./form.js");
45
45
  var import_media_kind = require("./media-kind.js");
46
- var import_mint_asset = require("./mint-asset.js");
47
- var import_mintable_collections = require("./mintable-collections.js");
48
46
  var import_use_ipfs_upload = require("./use-ipfs-upload.js");
49
47
  var import_use_new_collection_draft = require("./use-new-collection-draft.js");
50
48
  function FastMint(props) {
@@ -62,25 +60,23 @@ function FastMint(props) {
62
60
  connectLabel,
63
61
  getUploadToken,
64
62
  getSigner,
65
- client,
66
- successFooter
63
+ client
67
64
  } = props;
68
65
  const [status, setStatus] = (0, import_react.useState)("idle");
69
66
  const [errorMsg, setErrorMsg] = (0, import_react.useState)(null);
67
+ const [step, setStep] = (0, import_react.useState)(null);
70
68
  const media = (0, import_use_ipfs_upload.useIpfsUpload)();
71
69
  const feature = (0, import_use_ipfs_upload.useIpfsUpload)();
72
70
  const [mediaFile, setMediaFile] = (0, import_react.useState)(null);
73
71
  const [mediaKind, setMediaKind] = (0, import_react.useState)("image");
74
72
  const mediaInputRef = (0, import_react.useRef)(null);
75
73
  const featureInputRef = (0, import_react.useRef)(null);
76
- const [assetType, setAssetType] = (0, import_react.useState)("single");
77
- const [editionCount, setEditionCount] = (0, import_react.useState)("10");
78
- const [collectionMode, setCollectionMode] = (0, import_react.useState)("existing");
79
- const [existingCollectionId, setExistingCollectionId] = (0, import_react.useState)("");
80
- const [existingCollectionContract, setExistingCollectionContract] = (0, import_react.useState)("");
74
+ const [formatKey, setFormatKey] = (0, import_react.useState)("single");
75
+ const [formatStates, setFormatStates] = (0, import_react.useState)(import_registry.initialFormatStates);
76
+ const [resume, setResume] = (0, import_react.useState)(null);
77
+ const [result, setResult] = (0, import_react.useState)(null);
81
78
  const [ipType, setIpType] = (0, import_react.useState)("NFT");
82
79
  const templateFieldsRef = (0, import_react.useRef)([]);
83
- const [mintedAsset, setMintedAsset] = (0, import_react.useState)(null);
84
80
  const form = (0, import_react_hook_form.useForm)({ defaultValues: import_form.DEFAULT_VALUES });
85
81
  const name = form.watch("name");
86
82
  const description = form.watch("description");
@@ -90,8 +86,9 @@ function FastMint(props) {
90
86
  form.setValue("external_url", `https://medialane.io/account/${walletAddress}`);
91
87
  }
92
88
  }, [walletAddress, form]);
93
- const erc721Collections = (0, import_mintable_collections.mintableCollections)("single", collections);
94
- const erc1155Collections = (0, import_mintable_collections.mintableCollections)("editions", collections);
89
+ const format = (0, import_registry.getFormat)(formatKey);
90
+ const formatState = formatStates[formatKey];
91
+ const updateFormat = (patch) => setFormatStates((states) => ({ ...states, [formatKey]: { ...states[formatKey], ...patch } }));
95
92
  const uploadFile = async (file, kind) => {
96
93
  const token = await getUploadToken();
97
94
  if (!token) throw new Error("Sign in first");
@@ -123,66 +120,78 @@ function FastMint(props) {
123
120
  media.clear();
124
121
  if (mediaInputRef.current) mediaInputRef.current.value = "";
125
122
  };
126
- const ready = !!media.uri && !media.uploading && name.trim().length > 0 && (mediaKind === "image" || !!feature.uri) && (collectionMode === "existing" ? assetType === "single" ? !!existingCollectionId : !!existingCollectionContract : draft.name.trim().length > 0 && draft.symbol.trim().length > 0);
127
- const onSubmit = async (values) => {
123
+ const image = mediaKind === "image" ? media.uri : feature.uri;
124
+ const previewImage = mediaKind === "image" ? media.preview : feature.preview;
125
+ const shared = media.uri && image && mediaFile ? {
126
+ form,
127
+ draft,
128
+ collections,
129
+ walletAddress: walletAddress ?? "",
130
+ mediaKind,
131
+ mediaUri: media.uri,
132
+ mediaName: mediaFile.name,
133
+ image,
134
+ previewImage,
135
+ ipType,
136
+ onIpTypeChange: setIpType,
137
+ templateFieldsRef,
138
+ uploadDocument: (file) => uploadFile(file, "document")
139
+ } : null;
140
+ const ready = !!shared && !media.uploading && !feature.uploading && name.trim().length > 0 && format.isReady(shared, formatState);
141
+ const onSubmit = async () => {
128
142
  if (!hasWallet) {
129
143
  onRequireWallet();
130
144
  return;
131
145
  }
132
- if (!walletAddress || !media.uri) return;
133
- if (values.external_url && !values.external_url.startsWith("http://") && !values.external_url.startsWith("https://")) {
146
+ if (!shared || !walletAddress) return;
147
+ const link = form.getValues("external_url");
148
+ if (link && !link.startsWith("http://") && !link.startsWith("https://")) {
134
149
  setErrorMsg("External link must start with http:// or https://");
150
+ setStatus("error");
135
151
  return;
136
152
  }
137
153
  setStatus("minting");
138
154
  setErrorMsg(null);
155
+ setStep(null);
139
156
  try {
140
- const asset = await (0, import_mint_asset.mintAsset)({
157
+ const outcome = await format.submit(shared, formatState, {
141
158
  client,
142
159
  signer: await getSigner(),
143
- walletAddress,
144
- values,
145
- ipType,
146
- templateFields: templateFieldsRef.current,
147
- mediaKind,
148
- mediaUri: media.uri,
149
- featureUri: feature.uri,
150
- assetType,
151
- editionCount,
152
- destination: collectionMode === "new" ? { mode: "new", name: draft.name, symbol: draft.symbol, description: draft.description } : { mode: "existing", collectionId: existingCollectionId, collectionContract: existingCollectionContract },
153
- singleCollections: erc721Collections,
154
- refetchCollections,
155
- getUploadToken
160
+ getUploadToken,
161
+ resume: resume?.format === formatKey ? resume.destination : null,
162
+ onStep: setStep
156
163
  });
157
- if (asset) {
158
- setMintedAsset(asset);
159
- onMinted?.(asset);
160
- }
164
+ setResult(outcome);
165
+ setResume(null);
161
166
  setStatus("success");
167
+ (0, import_portfolio_cache.invalidatePortfolioCache)(walletAddress);
168
+ if (outcome.asset) onMinted?.(outcome.asset);
169
+ void refetchCollections().catch(() => {
170
+ });
162
171
  } catch (err) {
163
- setErrorMsg((0, import_describe_error.describeError)(err).message);
172
+ if (err instanceof import_create_then_add.PartialCreateError) {
173
+ setResume({ format: formatKey, destination: err.destination });
174
+ setErrorMsg(`${err.message} ${(0, import_describe_error.describeError)(err.reason).message} Press the button again to finish.`);
175
+ } else {
176
+ setErrorMsg((0, import_describe_error.describeError)(err).message);
177
+ }
164
178
  setStatus("error");
165
179
  }
166
180
  };
167
181
  const resetAll = () => {
168
182
  setStatus("idle");
169
183
  setErrorMsg(null);
170
- setMintedAsset(null);
184
+ setStep(null);
185
+ setResult(null);
186
+ setResume(null);
171
187
  form.reset();
172
188
  clearMedia();
173
189
  feature.clear();
174
- setAssetType("single");
175
- setEditionCount("10");
176
- setCollectionMode("existing");
177
- setExistingCollectionId("");
178
- setExistingCollectionContract("");
190
+ setFormatStates((0, import_registry.initialFormatStates)());
179
191
  draft.reset();
180
192
  templateFieldsRef.current = [];
181
193
  };
182
194
  const busy = status === "minting";
183
- const previewImage = mediaKind === "image" ? media.preview : feature.preview;
184
- const selectedExistingCollection = assetType === "single" ? erc721Collections.find((c) => c.collectionId === existingCollectionId) : erc1155Collections.find((c) => c.contractAddress === existingCollectionContract);
185
- const collectionLabel = media.uri ? collectionMode === "new" ? draft.name || "New collection" : selectedExistingCollection?.name || "IP Asset" : void 0;
186
195
  const wrap = (node) => {
187
196
  if (presentation !== "dialog") return node;
188
197
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog, { open, onOpenChange: (next) => {
@@ -193,20 +202,9 @@ function FastMint(props) {
193
202
  node
194
203
  ] }) });
195
204
  };
196
- if (status === "success") {
205
+ if (status === "success" && result) {
197
206
  return wrap(
198
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
199
- import_success_view.SuccessView,
200
- {
201
- footer: successFooter,
202
- presentation,
203
- previewImage,
204
- name,
205
- collectionLabel,
206
- mintedAsset,
207
- onPublishAnother: resetAll
208
- }
209
- )
207
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_success_view.SuccessView, { presentation, previewImage, result, onPublishAnother: resetAll })
210
208
  );
211
209
  }
212
210
  if (!mediaFile) {
@@ -225,6 +223,7 @@ function FastMint(props) {
225
223
  );
226
224
  }
227
225
  const submitBlocked = !ready || busy || !hasWallet;
226
+ const buttonLabel = busy ? `${step?.label ?? "Working"}\u2026${step && step.total > 1 ? ` (${step.index} of ${step.total})` : ""}` : format.submitLabel(formatState);
228
227
  return wrap(
229
228
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "space-y-6", children: [
230
229
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -242,6 +241,7 @@ function FastMint(props) {
242
241
  ),
243
242
  media.uri && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid grid-cols-1 lg:grid-cols-[1fr_320px] gap-8 items-start", children: [
244
243
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-5", children: [
244
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_asset_form_parts.FormatPicker, { formats: import_registry.FORMATS, value: formatKey, onChange: setFormatKey }),
245
245
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
246
246
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: "text-sm font-medium", children: "Title *" }),
247
247
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -288,56 +288,22 @@ function FastMint(props) {
288
288
  onSelect: (file) => void feature.start(file, (f) => uploadFile(f, "image"), setErrorMsg)
289
289
  }
290
290
  ),
291
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
292
- import_asset_form_parts.AssetTypePicker,
293
- {
294
- value: assetType,
295
- onChange: setAssetType,
296
- editionCount,
297
- onEditionCount: setEditionCount
298
- }
299
- ),
300
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
301
- import_collection_section.CollectionSection,
302
- {
303
- assetType,
304
- mode: collectionMode,
305
- onModeChange: setCollectionMode,
306
- collections: assetType === "single" ? erc721Collections : erc1155Collections,
307
- existingId: existingCollectionId,
308
- existingContract: existingCollectionContract,
309
- onExistingId: setExistingCollectionId,
310
- onExistingContract: setExistingCollectionContract,
311
- draft,
312
- previewImage
313
- }
314
- ),
315
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_licensing_section.LicensingSection, { form }),
316
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
317
- import_ip_type_section.IpTypeSection,
318
- {
319
- ipType,
320
- onIpTypeChange: setIpType,
321
- fieldsRef: templateFieldsRef,
322
- uploadDocument: (file) => uploadFile(file, "document"),
323
- existingDocument: mediaKind === "document" ? { uri: media.uri, name: mediaFile.name } : null
324
- }
325
- ),
291
+ shared && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(format.Fields, { shared, state: formatState, update: updateFormat }),
326
292
  status === "error" && errorMsg && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-destructive", children: errorMsg }),
327
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
293
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
328
294
  "button",
329
295
  {
330
296
  type: "button",
331
297
  disabled: submitBlocked,
332
- onClick: form.handleSubmit(onSubmit),
298
+ onClick: () => void onSubmit(),
333
299
  className: (0, import_cn.cn)(
334
300
  "w-full h-12 text-base font-semibold text-white rounded-xl flex items-center justify-center gap-2 transition-all hover:brightness-110 active:scale-[0.98] bg-brand-blue",
335
301
  submitBlocked && "opacity-40 pointer-events-none"
336
302
  ),
337
- children: busy ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
338
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Loader2, { className: "h-4 w-4 animate-spin" }),
339
- "Minting\u2026"
340
- ] }) : assetType === "single" ? "Mint NFT" : "Mint Editions"
303
+ children: [
304
+ busy && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Loader2, { className: "h-4 w-4 animate-spin" }),
305
+ buttonLabel
306
+ ]
341
307
  }
342
308
  ),
343
309
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-center text-muted-foreground", children: "Zero platform fees to mint." })
@@ -347,7 +313,7 @@ function FastMint(props) {
347
313
  {
348
314
  image: previewImage,
349
315
  name,
350
- collection: collectionLabel,
316
+ collection: shared ? format.previewLabel(shared, formatState) : void 0,
351
317
  creator: walletAddress ? `${walletAddress.slice(0, 6)}\u2026${walletAddress.slice(-4)}` : void 0,
352
318
  creatorHref: walletAddress ? (0, import_sdk.profileHref)({ address: walletAddress }) : void 0
353
319
  }