@medialane/ui 0.257.0 → 0.259.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 (185) hide show
  1. package/dist/components/account/add-guardian-dialog.cjs +1 -1
  2. package/dist/components/account/add-guardian-dialog.cjs.map +1 -1
  3. package/dist/components/account/add-guardian-dialog.js +1 -1
  4. package/dist/components/account/add-guardian-dialog.js.map +1 -1
  5. package/dist/components/account/device-approval-dialog.cjs +2 -2
  6. package/dist/components/account/device-approval-dialog.cjs.map +1 -1
  7. package/dist/components/account/device-approval-dialog.js +2 -2
  8. package/dist/components/account/device-approval-dialog.js.map +1 -1
  9. package/dist/components/account/devices-section.cjs +1 -1
  10. package/dist/components/account/devices-section.cjs.map +1 -1
  11. package/dist/components/account/devices-section.js +1 -1
  12. package/dist/components/account/devices-section.js.map +1 -1
  13. package/dist/components/account/guardian-recovery-section.cjs +1 -1
  14. package/dist/components/account/guardian-recovery-section.cjs.map +1 -1
  15. package/dist/components/account/guardian-recovery-section.js +1 -1
  16. package/dist/components/account/guardian-recovery-section.js.map +1 -1
  17. package/dist/components/comments-section.cjs +5 -4
  18. package/dist/components/comments-section.cjs.map +1 -1
  19. package/dist/components/comments-section.js +5 -4
  20. package/dist/components/comments-section.js.map +1 -1
  21. package/dist/components/drop/create/launch-dialog.cjs +1 -1
  22. package/dist/components/drop/create/launch-dialog.cjs.map +1 -1
  23. package/dist/components/drop/create/launch-dialog.js +1 -1
  24. package/dist/components/drop/create/launch-dialog.js.map +1 -1
  25. package/dist/components/drop/page/drop-manage.cjs +1 -1
  26. package/dist/components/drop/page/drop-manage.cjs.map +1 -1
  27. package/dist/components/drop/page/drop-manage.js +1 -1
  28. package/dist/components/drop/page/drop-manage.js.map +1 -1
  29. package/dist/components/drop/page/drop-mint-dialog.cjs +1 -1
  30. package/dist/components/drop/page/drop-mint-dialog.cjs.map +1 -1
  31. package/dist/components/drop/page/drop-mint-dialog.js +1 -1
  32. package/dist/components/drop/page/drop-mint-dialog.js.map +1 -1
  33. package/dist/components/empty-or-error.cjs +2 -2
  34. package/dist/components/empty-or-error.cjs.map +1 -1
  35. package/dist/components/empty-or-error.js +2 -2
  36. package/dist/components/empty-or-error.js.map +1 -1
  37. package/dist/components/fast-mint/fast-mint.cjs +2 -1
  38. package/dist/components/fast-mint/fast-mint.cjs.map +1 -1
  39. package/dist/components/fast-mint/fast-mint.js +2 -1
  40. package/dist/components/fast-mint/fast-mint.js.map +1 -1
  41. package/dist/components/launchpad/coin-create.cjs +9 -7
  42. package/dist/components/launchpad/coin-create.cjs.map +1 -1
  43. package/dist/components/launchpad/coin-create.js +9 -7
  44. package/dist/components/launchpad/coin-create.js.map +1 -1
  45. package/dist/components/launchpad/collection-create-form.cjs +11 -14
  46. package/dist/components/launchpad/collection-create-form.cjs.map +1 -1
  47. package/dist/components/launchpad/collection-create-form.js +12 -15
  48. package/dist/components/launchpad/collection-create-form.js.map +1 -1
  49. package/dist/components/launchpad/collection-create-presets.cjs +8 -8
  50. package/dist/components/launchpad/collection-create-presets.cjs.map +1 -1
  51. package/dist/components/launchpad/collection-create-presets.d.cts +2 -1
  52. package/dist/components/launchpad/collection-create-presets.d.ts +2 -1
  53. package/dist/components/launchpad/collection-create-presets.js +8 -8
  54. package/dist/components/launchpad/collection-create-presets.js.map +1 -1
  55. package/dist/components/launchpad/edition-mint.cjs +9 -7
  56. package/dist/components/launchpad/edition-mint.cjs.map +1 -1
  57. package/dist/components/launchpad/edition-mint.js +9 -7
  58. package/dist/components/launchpad/edition-mint.js.map +1 -1
  59. package/dist/components/launchpad/pop-create.cjs +5 -6
  60. package/dist/components/launchpad/pop-create.cjs.map +1 -1
  61. package/dist/components/launchpad/pop-create.js +5 -6
  62. package/dist/components/launchpad/pop-create.js.map +1 -1
  63. package/dist/components/launchpad/remix-mint.cjs +9 -7
  64. package/dist/components/launchpad/remix-mint.cjs.map +1 -1
  65. package/dist/components/launchpad/remix-mint.js +9 -7
  66. package/dist/components/launchpad/remix-mint.js.map +1 -1
  67. package/dist/components/launchpad/single-edition-mint.cjs +9 -7
  68. package/dist/components/launchpad/single-edition-mint.cjs.map +1 -1
  69. package/dist/components/launchpad/single-edition-mint.js +9 -7
  70. package/dist/components/launchpad/single-edition-mint.js.map +1 -1
  71. package/dist/components/launchpad/sponsorship-create.cjs +5 -6
  72. package/dist/components/launchpad/sponsorship-create.cjs.map +1 -1
  73. package/dist/components/launchpad/sponsorship-create.js +5 -6
  74. package/dist/components/launchpad/sponsorship-create.js.map +1 -1
  75. package/dist/components/launchpad/tier-mint-form.cjs +5 -6
  76. package/dist/components/launchpad/tier-mint-form.cjs.map +1 -1
  77. package/dist/components/launchpad/tier-mint-form.js +5 -6
  78. package/dist/components/launchpad/tier-mint-form.js.map +1 -1
  79. package/dist/components/launchpad/tier-mint-presets.cjs +2 -2
  80. package/dist/components/launchpad/tier-mint-presets.cjs.map +1 -1
  81. package/dist/components/launchpad/tier-mint-presets.d.cts +2 -1
  82. package/dist/components/launchpad/tier-mint-presets.d.ts +2 -1
  83. package/dist/components/launchpad/tier-mint-presets.js +2 -2
  84. package/dist/components/launchpad/tier-mint-presets.js.map +1 -1
  85. package/dist/components/license-request-page.cjs +1 -1
  86. package/dist/components/license-request-page.cjs.map +1 -1
  87. package/dist/components/license-request-page.js +1 -1
  88. package/dist/components/license-request-page.js.map +1 -1
  89. package/dist/components/marketplace-dialog-primitives.cjs +0 -30
  90. package/dist/components/marketplace-dialog-primitives.cjs.map +1 -1
  91. package/dist/components/marketplace-dialog-primitives.d.cts +1 -12
  92. package/dist/components/marketplace-dialog-primitives.d.ts +1 -12
  93. package/dist/components/marketplace-dialog-primitives.js +1 -30
  94. package/dist/components/marketplace-dialog-primitives.js.map +1 -1
  95. package/dist/components/media-wallet/activate-card.cjs +1 -1
  96. package/dist/components/media-wallet/activate-card.cjs.map +1 -1
  97. package/dist/components/media-wallet/activate-card.js +1 -1
  98. package/dist/components/media-wallet/activate-card.js.map +1 -1
  99. package/dist/components/media-wallet/media-wallet-activity.cjs +1 -1
  100. package/dist/components/media-wallet/media-wallet-activity.cjs.map +1 -1
  101. package/dist/components/media-wallet/media-wallet-activity.js +1 -1
  102. package/dist/components/media-wallet/media-wallet-activity.js.map +1 -1
  103. package/dist/components/media-wallet/media-wallet-send.cjs +2 -6
  104. package/dist/components/media-wallet/media-wallet-send.cjs.map +1 -1
  105. package/dist/components/media-wallet/media-wallet-send.js +2 -6
  106. package/dist/components/media-wallet/media-wallet-send.js.map +1 -1
  107. package/dist/components/pop-claim-button.cjs +5 -4
  108. package/dist/components/pop-claim-button.cjs.map +1 -1
  109. package/dist/components/pop-claim-button.js +5 -4
  110. package/dist/components/pop-claim-button.js.map +1 -1
  111. package/dist/components/pop-manage-page.cjs +2 -2
  112. package/dist/components/pop-manage-page.cjs.map +1 -1
  113. package/dist/components/pop-manage-page.js +2 -2
  114. package/dist/components/pop-manage-page.js.map +1 -1
  115. package/dist/components/portfolio-sponsorships.cjs +2 -2
  116. package/dist/components/portfolio-sponsorships.cjs.map +1 -1
  117. package/dist/components/portfolio-sponsorships.js +2 -2
  118. package/dist/components/portfolio-sponsorships.js.map +1 -1
  119. package/dist/components/sponsorship-offer-page.cjs +5 -4
  120. package/dist/components/sponsorship-offer-page.cjs.map +1 -1
  121. package/dist/components/sponsorship-offer-page.js +5 -4
  122. package/dist/components/sponsorship-offer-page.js.map +1 -1
  123. package/dist/components/transaction-dialog.cjs +4 -4
  124. package/dist/components/transaction-dialog.cjs.map +1 -1
  125. package/dist/components/transaction-dialog.d.cts +3 -1
  126. package/dist/components/transaction-dialog.d.ts +3 -1
  127. package/dist/components/transaction-dialog.js +4 -4
  128. package/dist/components/transaction-dialog.js.map +1 -1
  129. package/dist/components/{creation-success.cjs → transaction-success.cjs} +14 -15
  130. package/dist/components/transaction-success.cjs.map +1 -0
  131. package/dist/components/transaction-success.d.cts +20 -0
  132. package/dist/components/transaction-success.d.ts +20 -0
  133. package/dist/components/{creation-success.js → transaction-success.js} +10 -11
  134. package/dist/components/transaction-success.js.map +1 -0
  135. package/dist/components/transfer-collection-ownership.cjs +5 -4
  136. package/dist/components/transfer-collection-ownership.cjs.map +1 -1
  137. package/dist/components/transfer-collection-ownership.js +5 -4
  138. package/dist/components/transfer-collection-ownership.js.map +1 -1
  139. package/dist/components/wallet/export-key-section.cjs +3 -3
  140. package/dist/components/wallet/export-key-section.cjs.map +1 -1
  141. package/dist/components/wallet/export-key-section.d.cts +1 -2
  142. package/dist/components/wallet/export-key-section.d.ts +1 -2
  143. package/dist/components/wallet/export-key-section.js +3 -3
  144. package/dist/components/wallet/export-key-section.js.map +1 -1
  145. package/dist/index.cjs +6 -10
  146. package/dist/index.cjs.map +1 -1
  147. package/dist/index.d.cts +4 -4
  148. package/dist/index.d.ts +4 -4
  149. package/dist/index.js +4 -8
  150. package/dist/index.js.map +1 -1
  151. package/dist/utils/describe-error.cjs +16 -11
  152. package/dist/utils/describe-error.cjs.map +1 -1
  153. package/dist/utils/describe-error.d.cts +4 -4
  154. package/dist/utils/describe-error.d.ts +4 -4
  155. package/dist/utils/describe-error.js +16 -10
  156. package/dist/utils/describe-error.js.map +1 -1
  157. package/dist/utils/media-wallet/use-erc20-balance.d.cts +1 -1
  158. package/dist/utils/media-wallet/use-erc20-balance.d.ts +1 -1
  159. package/dist/utils/success-messages.cjs +54 -0
  160. package/dist/utils/success-messages.cjs.map +1 -0
  161. package/dist/utils/success-messages.d.cts +31 -0
  162. package/dist/utils/success-messages.d.ts +31 -0
  163. package/dist/utils/success-messages.js +30 -0
  164. package/dist/utils/success-messages.js.map +1 -0
  165. package/dist/utils/use-email-code.cjs +2 -2
  166. package/dist/utils/use-email-code.cjs.map +1 -1
  167. package/dist/utils/use-email-code.js +2 -2
  168. package/dist/utils/use-email-code.js.map +1 -1
  169. package/dist/utils/use-transaction.cjs +16 -2
  170. package/dist/utils/use-transaction.cjs.map +1 -1
  171. package/dist/utils/use-transaction.d.cts +1 -0
  172. package/dist/utils/use-transaction.d.ts +1 -0
  173. package/dist/utils/use-transaction.js +17 -3
  174. package/dist/utils/use-transaction.js.map +1 -1
  175. package/package.json +3 -3
  176. package/dist/components/creation-success.cjs.map +0 -1
  177. package/dist/components/creation-success.d.cts +0 -20
  178. package/dist/components/creation-success.d.ts +0 -20
  179. package/dist/components/creation-success.js.map +0 -1
  180. package/dist/components/transaction-done.cjs +0 -46
  181. package/dist/components/transaction-done.cjs.map +0 -1
  182. package/dist/components/transaction-done.d.cts +0 -18
  183. package/dist/components/transaction-done.d.ts +0 -18
  184. package/dist/components/transaction-done.js +0 -22
  185. package/dist/components/transaction-done.js.map +0 -1
@@ -12,7 +12,7 @@ import { FadeIn } from "./motion-primitives.js";
12
12
  import { RewardEarned } from "./rewards/reward-earned.js";
13
13
  import { ServiceHeader } from "./service-header.js";
14
14
  import { TransactionDialog } from "./transaction-dialog.js";
15
- import { TransactionDone } from "./transaction-done.js";
15
+ import { TransactionSuccess } from "./transaction-success.js";
16
16
  import { shortenAddress } from "../utils/address.js";
17
17
  import { runIntentCalls } from "../utils/run-intent-calls.js";
18
18
  import { useImageUrl } from "../utils/use-image-url.js";
@@ -77,13 +77,14 @@ function SponsorshipOfferPage({ offerId }) {
77
77
  const copy = COPY[action];
78
78
  return /* @__PURE__ */ jsxs("div", { className: "pb-16", children: [
79
79
  /* @__PURE__ */ jsx(TransactionDialog, { tx, title: copy.title, workingLabel: copy.working, firstStepLabel: "Prepare", children: /* @__PURE__ */ jsx(
80
- TransactionDone,
80
+ TransactionSuccess,
81
81
  {
82
- tx,
83
82
  name,
84
83
  title: copy.done,
85
84
  description: copy.description,
86
- footer: action === "bid" ? /* @__PURE__ */ jsx(RewardEarned, { actionType: "place_sponsorship_bid" }) : void 0
85
+ txHash: tx.txHash,
86
+ actions: [{ label: "Done", onClick: tx.reset }],
87
+ children: action === "bid" && /* @__PURE__ */ jsx(RewardEarned, { actionType: "place_sponsorship_bid" })
87
88
  }
88
89
  ) }),
89
90
  /* @__PURE__ */ jsxs("section", { className: "px-4 pt-10 max-w-3xl mx-auto space-y-6", children: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/sponsorship-offer-page.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { Handshake, ImageIcon, Loader2 } from \"lucide-react\";\nimport { formatAmount, getTokenByAddress, normalizeAddress } from \"@medialane/sdk\";\nimport { BackButton } from \"./back-button.js\";\nimport { Button } from \"./button.js\";\nimport Image from \"./image.js\";\nimport { Input } from \"./input.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\nimport { FadeIn } from \"./motion-primitives.js\";\nimport { RewardEarned } from \"./rewards/reward-earned.js\";\nimport { ServiceHeader } from \"./service-header.js\";\nimport { TransactionDialog } from \"./transaction-dialog.js\";\nimport { TransactionDone } from \"./transaction-done.js\";\nimport { shortenAddress } from \"../utils/address.js\";\nimport { runIntentCalls } from \"../utils/run-intent-calls.js\";\nimport { useImageUrl } from \"../utils/use-image-url.js\";\nimport { useSponsorshipBids, useSponsorshipOffer } from \"../utils/use-sponsorship.js\";\nimport { useToken } from \"../utils/use-tokens.js\";\nimport { useTransaction } from \"../utils/use-transaction.js\";\n\ntype Action = \"bid\" | \"accept\";\n\nconst COPY = {\n bid: { title: \"Place bid\", working: \"Placing your bid…\", done: \"Bid placed!\", description: \"Your bid is now on-chain.\" },\n accept: { title: \"Accept bid\", working: \"Accepting the bid…\", done: \"Bid accepted!\", description: \"The license is minted to the sponsor.\" },\n} as const;\n\nexport function SponsorshipOfferPage({ offerId }: { offerId: string }) {\n const app = useMedialaneApp();\n const walletAddress = app.walletAddress;\n const resolveImage = useImageUrl();\n const { offer, isLoading, mutate: mutateOffer } = useSponsorshipOffer(offerId);\n const { bids, isLoading: bidsLoading, mutate: mutateBids } = useSponsorshipBids(offerId);\n const { token } = useToken(offer?.nftContract ?? \"\", offer?.tokenId ?? \"\");\n const tx = useTransaction();\n const [action, setAction] = useState<Action>(\"bid\");\n const [amount, setAmount] = useState(\"\");\n const [activeSponsor, setActiveSponsor] = useState<string | null>(null);\n\n useEffect(() => {\n if (tx.phase !== \"success\") return;\n setAmount(\"\");\n void Promise.all([mutateOffer(), mutateBids()]);\n }, [tx.phase, mutateOffer, mutateBids]);\n\n if (isLoading) {\n return <div className=\"max-w-3xl mx-auto px-4 pt-24 pb-8 text-center text-sm text-muted-foreground\">Loading offer…</div>;\n }\n if (!offer) {\n return <div className=\"max-w-3xl mx-auto px-4 pt-24 pb-8 text-center text-sm text-muted-foreground\">Offer not found.</div>;\n }\n\n const isOwner = !!walletAddress && normalizeAddress(\"STARKNET\", walletAddress) === normalizeAddress(\"STARKNET\", offer.author);\n const paymentToken = getTokenByAddress(offer.paymentToken);\n const busy = tx.phase === \"preparing\" || tx.phase === \"submitting\" || tx.phase === \"confirming\";\n const name = token?.metadata?.name ?? `Token #${offer.tokenId}`;\n const imageUrl = resolveImage(token?.metadata?.image);\n const minDisplay = paymentToken ? `${formatAmount(offer.minAmount, paymentToken.decimals)} ${paymentToken.symbol}` : offer.minAmount;\n const format = (value: string) => (paymentToken ? `${formatAmount(value, paymentToken.decimals)} ${paymentToken.symbol}` : value);\n\n const placeBid = () => {\n if (!walletAddress || !paymentToken) return;\n setAction(\"bid\");\n void tx.run(async (signer) => {\n const value = BigInt(Math.round(Number(amount) * 10 ** paymentToken.decimals));\n await runIntentCalls(signer, () =>\n app.getClient().api.intents.create(\"sponsorship-bid\", { sponsor: walletAddress, offerId: offer.offerId, amount: value.toString(), paymentToken: offer.paymentToken }),\n );\n });\n };\n\n const acceptBid = (sponsor: string) => {\n if (!walletAddress) return;\n setAction(\"accept\");\n setActiveSponsor(sponsor);\n void tx\n .run(async (signer) => {\n await runIntentCalls(signer, () =>\n app.getClient().api.intents.create(\"sponsorship-bid-accept\", { author: walletAddress, offerId: offer.offerId, sponsor }),\n );\n })\n .finally(() => setActiveSponsor(null));\n };\n\n const copy = COPY[action];\n\n return (\n <div className=\"pb-16\">\n <TransactionDialog tx={tx} title={copy.title} workingLabel={copy.working} firstStepLabel=\"Prepare\">\n <TransactionDone\n tx={tx}\n name={name}\n title={copy.done}\n description={copy.description}\n footer={action === \"bid\" ? <RewardEarned actionType=\"place_sponsorship_bid\" /> : undefined}\n />\n </TransactionDialog>\n\n <section className=\"px-4 pt-10 max-w-3xl mx-auto space-y-6\">\n <BackButton fallbackHref=\"/launchpad/sponsorship\" />\n <FadeIn>\n <ServiceHeader plain icon={<Handshake className=\"h-4 w-4 text-white\" />} title={name} subtitle={offer.open ? \"Open for bids\" : \"Closed\"} />\n </FadeIn>\n\n <FadeIn>\n <div className=\"rounded-2xl border border-border/40 overflow-hidden\">\n <div className=\"relative aspect-square bg-muted/40\">\n {imageUrl ? (\n <Image src={imageUrl} alt={name} fill sizes=\"(min-width: 768px) 768px, 100vw\" className=\"object-cover\" unoptimized />\n ) : (\n <div className=\"h-full w-full flex items-center justify-center\">\n <ImageIcon className=\"h-8 w-8 text-muted-foreground/40\" />\n </div>\n )}\n </div>\n <div className=\"p-5 grid grid-cols-2 sm:grid-cols-4 gap-4 text-sm\">\n <div>\n <p className=\"text-xs text-muted-foreground\">Minimum bid</p>\n <p className=\"font-semibold\">{minDisplay}</p>\n </div>\n <div>\n <p className=\"text-xs text-muted-foreground\">License length</p>\n <p className=\"font-semibold\">{Math.round(Number(offer.duration) / 86400)} days</p>\n </div>\n <div>\n <p className=\"text-xs text-muted-foreground\">Resale royalty</p>\n <p className=\"font-semibold\">{(offer.royaltyBps / 100).toFixed(1)}%</p>\n </div>\n <div>\n <p className=\"text-xs text-muted-foreground\">Owner</p>\n <p className=\"font-semibold\">{shortenAddress(offer.author)}</p>\n </div>\n </div>\n </div>\n </FadeIn>\n\n {!offer.open ? (\n <FadeIn>\n <p className=\"text-sm text-muted-foreground text-center py-6\">This offer is no longer open.</p>\n </FadeIn>\n ) : isOwner ? (\n <FadeIn>\n <div className=\"space-y-3\">\n <p className=\"text-sm font-semibold\">Bids</p>\n {bidsLoading ? (\n <p className=\"text-xs text-muted-foreground\">Loading bids…</p>\n ) : bids.length === 0 ? (\n <p className=\"text-xs text-muted-foreground\">No bids yet.</p>\n ) : (\n <div className=\"space-y-2\">\n {bids.map((bid) => (\n <div key={bid.id} className=\"flex items-center justify-between gap-3 rounded-xl border border-border/30 p-3\">\n <div>\n <p className=\"text-sm font-medium\">{shortenAddress(bid.sponsor)}</p>\n <p className=\"text-xs text-muted-foreground\">{format(bid.amount)}</p>\n </div>\n <Button size=\"sm\" className=\"bg-brand-rose hover:brightness-110 text-white\" disabled={busy} onClick={() => acceptBid(bid.sponsor)}>\n {busy && activeSponsor === bid.sponsor ? <Loader2 className=\"h-3.5 w-3.5 animate-spin\" /> : \"Accept\"}\n </Button>\n </div>\n ))}\n </div>\n )}\n </div>\n </FadeIn>\n ) : (\n <FadeIn>\n <div className=\"space-y-2\">\n <p className=\"text-sm font-semibold\">Place a bid</p>\n <div className=\"flex gap-2\">\n <Input type=\"number\" min={0} step=\"0.01\" placeholder=\"Your bid\" value={amount} onChange={(e) => setAmount(e.target.value)} disabled={busy} />\n <Button className=\"bg-brand-rose hover:brightness-110 text-white shrink-0\" disabled={busy || !walletAddress || !paymentToken || !amount || Number(amount) <= 0} onClick={placeBid}>\n {busy ? <Loader2 className=\"h-4 w-4 animate-spin\" /> : \"Place bid\"}\n </Button>\n </div>\n {!walletAddress && (\n <button type=\"button\" className=\"text-xs text-muted-foreground underline\" onClick={app.onRequireWallet}>\n {app.connectLabel ?? \"Connect\"} to place a bid\n </button>\n )}\n {!paymentToken && <p className=\"text-xs text-destructive\">This offer uses a currency the app does not support yet.</p>}\n <p className=\"text-xs text-muted-foreground\">\n Placing a bid approves the offer&apos;s payment token — no funds move until the owner accepts.\n </p>\n </div>\n </FadeIn>\n )}\n </section>\n </div>\n );\n}\n"],"mappings":";AAgDW,cAsEG,YAtEH;AA9CX,SAAS,WAAW,gBAAgB;AACpC,SAAS,WAAW,WAAW,eAAe;AAC9C,SAAS,cAAc,mBAAmB,wBAAwB;AAClE,SAAS,k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,qBAAC,SAAI,WAAU,cACb;AAAA,8BAAC,SAAM,MAAK,UAAS,KAAK,GAAG,MAAK,QAAO,aAAY,YAAW,OAAO,QAAQ,UAAU,CAAC,MAAM,UAAU,EAAE,OAAO,KAAK,GAAG,UAAU,MAAM;AAAA,UAC3I,oBAAC,UAAO,WAAU,0DAAyD,UAAU,QAAQ,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,UAAU,OAAO,MAAM,KAAK,GAAG,SAAS,UACtK,iBAAO,oBAAC,WAAQ,WAAU,wBAAuB,IAAK,aACzD;AAAA,WACF;AAAA,QACC,CAAC,iBACA,qBAAC,YAAO,MAAK,UAAS,WAAU,2CAA0C,SAAS,IAAI,iBACpF;AAAA,cAAI,gBAAgB;AAAA,UAAU;AAAA,WACjC;AAAA,QAED,CAAC,gBAAgB,oBAAC,OAAE,WAAU,4BAA2B,sEAAwD;AAAA,QAClH,oBAAC,OAAE,WAAU,iCAAgC,4GAE7C;AAAA,SACF,GACF;AAAA,OAEJ;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/sponsorship-offer-page.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { Handshake, ImageIcon, Loader2 } from \"lucide-react\";\nimport { formatAmount, getTokenByAddress, normalizeAddress } from \"@medialane/sdk\";\nimport { BackButton } from \"./back-button.js\";\nimport { Button } from \"./button.js\";\nimport Image from \"./image.js\";\nimport { Input } from \"./input.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\nimport { FadeIn } from \"./motion-primitives.js\";\nimport { RewardEarned } from \"./rewards/reward-earned.js\";\nimport { ServiceHeader } from \"./service-header.js\";\nimport { TransactionDialog } from \"./transaction-dialog.js\";\nimport { TransactionSuccess } from \"./transaction-success.js\";\nimport { shortenAddress } from \"../utils/address.js\";\nimport { runIntentCalls } from \"../utils/run-intent-calls.js\";\nimport { useImageUrl } from \"../utils/use-image-url.js\";\nimport { useSponsorshipBids, useSponsorshipOffer } from \"../utils/use-sponsorship.js\";\nimport { useToken } from \"../utils/use-tokens.js\";\nimport { useTransaction } from \"../utils/use-transaction.js\";\n\ntype Action = \"bid\" | \"accept\";\n\nconst COPY = {\n bid: { title: \"Place bid\", working: \"Placing your bid…\", done: \"Bid placed!\", description: \"Your bid is now on-chain.\" },\n accept: { title: \"Accept bid\", working: \"Accepting the bid…\", done: \"Bid accepted!\", description: \"The license is minted to the sponsor.\" },\n} as const;\n\nexport function SponsorshipOfferPage({ offerId }: { offerId: string }) {\n const app = useMedialaneApp();\n const walletAddress = app.walletAddress;\n const resolveImage = useImageUrl();\n const { offer, isLoading, mutate: mutateOffer } = useSponsorshipOffer(offerId);\n const { bids, isLoading: bidsLoading, mutate: mutateBids } = useSponsorshipBids(offerId);\n const { token } = useToken(offer?.nftContract ?? \"\", offer?.tokenId ?? \"\");\n const tx = useTransaction();\n const [action, setAction] = useState<Action>(\"bid\");\n const [amount, setAmount] = useState(\"\");\n const [activeSponsor, setActiveSponsor] = useState<string | null>(null);\n\n useEffect(() => {\n if (tx.phase !== \"success\") return;\n setAmount(\"\");\n void Promise.all([mutateOffer(), mutateBids()]);\n }, [tx.phase, mutateOffer, mutateBids]);\n\n if (isLoading) {\n return <div className=\"max-w-3xl mx-auto px-4 pt-24 pb-8 text-center text-sm text-muted-foreground\">Loading offer…</div>;\n }\n if (!offer) {\n return <div className=\"max-w-3xl mx-auto px-4 pt-24 pb-8 text-center text-sm text-muted-foreground\">Offer not found.</div>;\n }\n\n const isOwner = !!walletAddress && normalizeAddress(\"STARKNET\", walletAddress) === normalizeAddress(\"STARKNET\", offer.author);\n const paymentToken = getTokenByAddress(offer.paymentToken);\n const busy = tx.phase === \"preparing\" || tx.phase === \"submitting\" || tx.phase === \"confirming\";\n const name = token?.metadata?.name ?? `Token #${offer.tokenId}`;\n const imageUrl = resolveImage(token?.metadata?.image);\n const minDisplay = paymentToken ? `${formatAmount(offer.minAmount, paymentToken.decimals)} ${paymentToken.symbol}` : offer.minAmount;\n const format = (value: string) => (paymentToken ? `${formatAmount(value, paymentToken.decimals)} ${paymentToken.symbol}` : value);\n\n const placeBid = () => {\n if (!walletAddress || !paymentToken) return;\n setAction(\"bid\");\n void tx.run(async (signer) => {\n const value = BigInt(Math.round(Number(amount) * 10 ** paymentToken.decimals));\n await runIntentCalls(signer, () =>\n app.getClient().api.intents.create(\"sponsorship-bid\", { sponsor: walletAddress, offerId: offer.offerId, amount: value.toString(), paymentToken: offer.paymentToken }),\n );\n });\n };\n\n const acceptBid = (sponsor: string) => {\n if (!walletAddress) return;\n setAction(\"accept\");\n setActiveSponsor(sponsor);\n void tx\n .run(async (signer) => {\n await runIntentCalls(signer, () =>\n app.getClient().api.intents.create(\"sponsorship-bid-accept\", { author: walletAddress, offerId: offer.offerId, sponsor }),\n );\n })\n .finally(() => setActiveSponsor(null));\n };\n\n const copy = COPY[action];\n\n return (\n <div className=\"pb-16\">\n <TransactionDialog tx={tx} title={copy.title} workingLabel={copy.working} firstStepLabel=\"Prepare\">\n <TransactionSuccess\n name={name}\n title={copy.done}\n description={copy.description}\n txHash={tx.txHash}\n actions={[{ label: \"Done\", onClick: tx.reset }]}\n >\n {action === \"bid\" && <RewardEarned actionType=\"place_sponsorship_bid\" />}\n </TransactionSuccess>\n </TransactionDialog>\n\n <section className=\"px-4 pt-10 max-w-3xl mx-auto space-y-6\">\n <BackButton fallbackHref=\"/launchpad/sponsorship\" />\n <FadeIn>\n <ServiceHeader plain icon={<Handshake className=\"h-4 w-4 text-white\" />} title={name} subtitle={offer.open ? \"Open for bids\" : \"Closed\"} />\n </FadeIn>\n\n <FadeIn>\n <div className=\"rounded-2xl border border-border/40 overflow-hidden\">\n <div className=\"relative aspect-square bg-muted/40\">\n {imageUrl ? (\n <Image src={imageUrl} alt={name} fill sizes=\"(min-width: 768px) 768px, 100vw\" className=\"object-cover\" unoptimized />\n ) : (\n <div className=\"h-full w-full flex items-center justify-center\">\n <ImageIcon className=\"h-8 w-8 text-muted-foreground/40\" />\n </div>\n )}\n </div>\n <div className=\"p-5 grid grid-cols-2 sm:grid-cols-4 gap-4 text-sm\">\n <div>\n <p className=\"text-xs text-muted-foreground\">Minimum bid</p>\n <p className=\"font-semibold\">{minDisplay}</p>\n </div>\n <div>\n <p className=\"text-xs text-muted-foreground\">License length</p>\n <p className=\"font-semibold\">{Math.round(Number(offer.duration) / 86400)} days</p>\n </div>\n <div>\n <p className=\"text-xs text-muted-foreground\">Resale royalty</p>\n <p className=\"font-semibold\">{(offer.royaltyBps / 100).toFixed(1)}%</p>\n </div>\n <div>\n <p className=\"text-xs text-muted-foreground\">Owner</p>\n <p className=\"font-semibold\">{shortenAddress(offer.author)}</p>\n </div>\n </div>\n </div>\n </FadeIn>\n\n {!offer.open ? (\n <FadeIn>\n <p className=\"text-sm text-muted-foreground text-center py-6\">This offer is no longer open.</p>\n </FadeIn>\n ) : isOwner ? (\n <FadeIn>\n <div className=\"space-y-3\">\n <p className=\"text-sm font-semibold\">Bids</p>\n {bidsLoading ? (\n <p className=\"text-xs text-muted-foreground\">Loading bids…</p>\n ) : bids.length === 0 ? (\n <p className=\"text-xs text-muted-foreground\">No bids yet.</p>\n ) : (\n <div className=\"space-y-2\">\n {bids.map((bid) => (\n <div key={bid.id} className=\"flex items-center justify-between gap-3 rounded-xl border border-border/30 p-3\">\n <div>\n <p className=\"text-sm font-medium\">{shortenAddress(bid.sponsor)}</p>\n <p className=\"text-xs text-muted-foreground\">{format(bid.amount)}</p>\n </div>\n <Button size=\"sm\" className=\"bg-brand-rose hover:brightness-110 text-white\" disabled={busy} onClick={() => acceptBid(bid.sponsor)}>\n {busy && activeSponsor === bid.sponsor ? <Loader2 className=\"h-3.5 w-3.5 animate-spin\" /> : \"Accept\"}\n </Button>\n </div>\n ))}\n </div>\n )}\n </div>\n </FadeIn>\n ) : (\n <FadeIn>\n <div className=\"space-y-2\">\n <p className=\"text-sm font-semibold\">Place a bid</p>\n <div className=\"flex gap-2\">\n <Input type=\"number\" min={0} step=\"0.01\" placeholder=\"Your bid\" value={amount} onChange={(e) => setAmount(e.target.value)} disabled={busy} />\n <Button className=\"bg-brand-rose hover:brightness-110 text-white shrink-0\" disabled={busy || !walletAddress || !paymentToken || !amount || Number(amount) <= 0} onClick={placeBid}>\n {busy ? <Loader2 className=\"h-4 w-4 animate-spin\" /> : \"Place bid\"}\n </Button>\n </div>\n {!walletAddress && (\n <button type=\"button\" className=\"text-xs text-muted-foreground underline\" onClick={app.onRequireWallet}>\n {app.connectLabel ?? \"Connect\"} to place a bid\n </button>\n )}\n {!paymentToken && <p className=\"text-xs text-destructive\">This offer uses a currency the app does not support yet.</p>}\n <p className=\"text-xs text-muted-foreground\">\n Placing a bid approves the offer&apos;s payment token — no funds move until the owner accepts.\n </p>\n </div>\n </FadeIn>\n )}\n </section>\n </div>\n );\n}\n"],"mappings":";AAgDW,cAwEG,YAxEH;AA9CX,SAAS,WAAW,gBAAgB;AACpC,SAAS,WAAW,WAAW,eAAe;AAC9C,SAAS,cAAc,mBAAmB,wBAAwB;AAClE,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AACvB,OAAO,WAAW;AAClB,SAAS,aAAa;AACtB,SAAS,uBAAuB;AAChC,SAAS,cAAc;AACvB,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAClC,SAAS,0BAA0B;AACnC,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB,2BAA2B;AACxD,SAAS,gBAAgB;AACzB,SAAS,sBAAsB;AAI/B,MAAM,OAAO;AAAA,EACX,KAAK,EAAE,OAAO,aAAa,SAAS,0BAAqB,MAAM,eAAe,aAAa,4BAA4B;AAAA,EACvH,QAAQ,EAAE,OAAO,cAAc,SAAS,2BAAsB,MAAM,iBAAiB,aAAa,wCAAwC;AAC5I;AAEO,SAAS,qBAAqB,EAAE,QAAQ,GAAwB;AACrE,QAAM,MAAM,gBAAgB;AAC5B,QAAM,gBAAg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WAAU,4BAA2B,sEAAwD;AAAA,QAClH,oBAAC,OAAE,WAAU,iCAAgC,4GAE7C;AAAA,SACF,GACF;AAAA,OAEJ;AAAA,KACF;AAEJ;","names":[]}
@@ -30,7 +30,7 @@ var import_button = require("./button.js");
30
30
  var import_confetti = require("../utils/media-wallet/confetti.js");
31
31
  const ACTIVE_STEP = { preparing: 0, submitting: 1, confirming: 2 };
32
32
  function TransactionDialog({ tx, title, workingLabel, firstStepLabel = "Prepare", children }) {
33
- const { phase, error, reset } = tx;
33
+ const { phase, error, reset, retryable = true } = tx;
34
34
  const working = phase === "preparing" || phase === "submitting" || phase === "confirming";
35
35
  const success = phase === "success";
36
36
  const failed = phase === "error";
@@ -74,10 +74,10 @@ function TransactionDialog({ tx, title, workingLabel, firstStepLabel = "Prepare"
74
74
  failed && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col items-center gap-5 py-2", children: [
75
75
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex h-16 w-16 items-center justify-center rounded-full bg-destructive/10", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.XCircle, { className: "h-9 w-9 text-destructive" }) }),
76
76
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1 text-center", children: [
77
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xl font-bold", children: "Something went wrong" }),
78
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mx-auto max-w-xs text-sm text-muted-foreground", children: error ?? "We couldn't complete that. Please try again." })
77
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xl font-bold", children: title }),
78
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mx-auto max-w-xs text-sm text-muted-foreground", children: error })
79
79
  ] }),
80
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { variant: "outline", className: "w-full", onClick: reset, children: "Try again" })
80
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { variant: "outline", className: "w-full", onClick: reset, children: retryable ? "Try again" : "Close" })
81
81
  ] })
82
82
  ]
83
83
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/transaction-dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, type ReactNode } from \"react\";\nimport { CheckCircle2, Loader2, XCircle } from \"lucide-react\";\nimport { Dialog, DialogContent, DialogTitle } from \"./dialog.js\";\nimport { Button } from \"./button.js\";\nimport { fireConfetti } from \"../utils/media-wallet/confetti.js\";\nimport type { useTransaction } from \"../utils/use-transaction.js\";\n\nexport interface TransactionDialogProps {\n tx: Pick<ReturnType<typeof useTransaction>, \"phase\" | \"error\" | \"reset\">;\n title: string;\n workingLabel: string;\n firstStepLabel?: string;\n children?: ReactNode;\n}\n\nconst ACTIVE_STEP = { preparing: 0, submitting: 1, confirming: 2 } as const;\n\nexport function TransactionDialog({ tx, title, workingLabel, firstStepLabel = \"Prepare\", children }: TransactionDialogProps) {\n const { phase, error, reset } = tx;\n const working = phase === \"preparing\" || phase === \"submitting\" || phase === \"confirming\";\n const success = phase === \"success\";\n const failed = phase === \"error\";\n const steps = [firstStepLabel, \"Submit transaction\", \"Confirm transaction\"];\n\n const confettiFired = useRef(false);\n useEffect(() => {\n if (success && !confettiFired.current) {\n confettiFired.current = true;\n fireConfetti();\n }\n if (!success) confettiFired.current = false;\n }, [success]);\n\n return (\n <Dialog open={phase !== \"idle\"} modal onOpenChange={(open) => { if (!open && !working) reset(); }}>\n <DialogContent\n className=\"sm:max-w-md\"\n onInteractOutside={working ? (e) => e.preventDefault() : undefined}\n onEscapeKeyDown={working ? (e) => e.preventDefault() : undefined}\n {...(working ? { hideClose: true } : {})}\n >\n <DialogTitle className=\"sr-only\">{working ? workingLabel : title}</DialogTitle>\n\n {working && (\n <div className=\"flex flex-col items-center gap-6 py-4\">\n <div className=\"flex h-16 w-16 items-center justify-center rounded-full bg-primary/10\">\n <Loader2 className=\"h-8 w-8 animate-spin text-primary\" />\n </div>\n <div className=\"space-y-1 text-center\">\n <p className=\"text-lg font-semibold\">{workingLabel}</p>\n <p className=\"text-sm text-muted-foreground\">\n {phase === \"confirming\" ? \"Waiting for block confirmation\" : \"Submitting transaction\"}\n </p>\n </div>\n <ol className=\"w-full space-y-2 rounded-xl border border-border/60 bg-muted/30 p-4\">\n {steps.map((label, i) => {\n const active = i === ACTIVE_STEP[phase];\n const done = i < ACTIVE_STEP[phase];\n return (\n <li key={label} data-step aria-current={active ? \"step\" : undefined} className=\"flex items-center gap-3\">\n {done ? (\n <CheckCircle2 className=\"h-4 w-4 shrink-0 text-emerald-500\" />\n ) : active ? (\n <Loader2 className=\"h-4 w-4 shrink-0 animate-spin text-primary\" />\n ) : (\n <div className=\"h-4 w-4 shrink-0 rounded-full border-2 border-muted-foreground/30\" />\n )}\n <span className={done ? \"text-sm text-foreground\" : active ? \"text-sm font-medium text-primary\" : \"text-sm text-muted-foreground\"}>\n {label}\n </span>\n </li>\n );\n })}\n </ol>\n <p className=\"text-center text-xs text-muted-foreground\">This usually takes 10–30 seconds. Do not close this window.</p>\n </div>\n )}\n\n {success && children}\n\n {failed && (\n <div className=\"flex flex-col items-center gap-5 py-2\">\n <div className=\"flex h-16 w-16 items-center justify-center rounded-full bg-destructive/10\">\n <XCircle className=\"h-9 w-9 text-destructive\" />\n </div>\n <div className=\"space-y-1 text-center\">\n <p className=\"text-xl font-bold\">Something went wrong</p>\n <p className=\"mx-auto max-w-xs text-sm text-muted-foreground\">{error ?? \"We couldn't complete that. Please try again.\"}</p>\n </div>\n <Button variant=\"outline\" className=\"w-full\" onClick={reset}>\n Try again\n </Button>\n </div>\n )}\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2CQ;AAzCR,mBAAkD;AAClD,0BAA+C;AAC/C,oBAAmD;AACnD,oBAAuB;AACvB,sBAA6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AU,uEACX,gBAAM,IAAI,CAAC,OAAO,MAAM;AACvB,kBAAM,SAAS,MAAM,YAAY,KAAK;AACtC,kBAAM,OAAO,IAAI,YAAY,KAAK;AAClC,mBACE,6CAAC,QAAe,aAAS,MAAC,gBAAc,SAAS,SAAS,QAAW,WAAU,2BAC5E;AAAA,qBACC,4CAAC,oCAAa,WAAU,qCAAoC,IAC1D,SACF,4CAAC,+BAAQ,WAAU,8CAA6C,IAEhE,4CAAC,SAAI,WAAU,qEAAoE;AAAA,cAErF,4CAAC,UAAK,WAAW,OAAO,4BAA4B,SAAS,qCAAqC,iCAC/F,iBACH;AAAA,iBAVO,KAWT;AAAA,UAEJ,CAAC,GACH;AAAA,UACA,4CAAC,OAAE,WAAU,6CAA4C,8EAA2D;AAAA,WACtH;AAAA,QAGD,WAAW;AAAA,QAEX,UACC,6CAAC,SAAI,WAAU,yCACb;AAAA,sDAAC,SAAI,WAAU,6EACb,sDAAC,+BAAQ,WAAU,4BAA2B,GAChD;AAAA,UACA,6CAAC,SAAI,WAAU,yBACb;AAAA,wDAAC,OAAE,WAAU,qBAAoB,kCAAoB;AAAA,YACrD,4CAAC,OAAE,WAAU,kDAAkD,mBAAS,gDAA+C;AAAA,aACzH;AAAA,UACA,4CAAC,wBAAO,SAAQ,WAAU,WAAU,UAAS,SAAS,OAAO,uBAE7D;AAAA,WACF;AAAA;AAAA;AAAA,EAEJ,GACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/transaction-dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, type ReactNode } from \"react\";\nimport { CheckCircle2, Loader2, XCircle } from \"lucide-react\";\nimport { Dialog, DialogContent, DialogTitle } from \"./dialog.js\";\nimport { Button } from \"./button.js\";\nimport { fireConfetti } from \"../utils/media-wallet/confetti.js\";\nimport type { useTransaction } from \"../utils/use-transaction.js\";\n\nexport interface TransactionDialogProps {\n tx: Pick<ReturnType<typeof useTransaction>, \"phase\" | \"error\" | \"reset\"> & { retryable?: boolean };\n title: string;\n workingLabel: string;\n firstStepLabel?: string;\n children?: ReactNode;\n}\n\nconst ACTIVE_STEP = { preparing: 0, submitting: 1, confirming: 2 } as const;\n\nexport function TransactionDialog({ tx, title, workingLabel, firstStepLabel = \"Prepare\", children }: TransactionDialogProps) {\n const { phase, error, reset, retryable = true } = tx;\n const working = phase === \"preparing\" || phase === \"submitting\" || phase === \"confirming\";\n const success = phase === \"success\";\n const failed = phase === \"error\";\n const steps = [firstStepLabel, \"Submit transaction\", \"Confirm transaction\"];\n\n const confettiFired = useRef(false);\n useEffect(() => {\n if (success && !confettiFired.current) {\n confettiFired.current = true;\n fireConfetti();\n }\n if (!success) confettiFired.current = false;\n }, [success]);\n\n return (\n <Dialog open={phase !== \"idle\"} modal onOpenChange={(open) => { if (!open && !working) reset(); }}>\n <DialogContent\n className=\"sm:max-w-md\"\n onInteractOutside={working ? (e) => e.preventDefault() : undefined}\n onEscapeKeyDown={working ? (e) => e.preventDefault() : undefined}\n {...(working ? { hideClose: true } : {})}\n >\n <DialogTitle className=\"sr-only\">{working ? workingLabel : title}</DialogTitle>\n\n {working && (\n <div className=\"flex flex-col items-center gap-6 py-4\">\n <div className=\"flex h-16 w-16 items-center justify-center rounded-full bg-primary/10\">\n <Loader2 className=\"h-8 w-8 animate-spin text-primary\" />\n </div>\n <div className=\"space-y-1 text-center\">\n <p className=\"text-lg font-semibold\">{workingLabel}</p>\n <p className=\"text-sm text-muted-foreground\">\n {phase === \"confirming\" ? \"Waiting for block confirmation\" : \"Submitting transaction\"}\n </p>\n </div>\n <ol className=\"w-full space-y-2 rounded-xl border border-border/60 bg-muted/30 p-4\">\n {steps.map((label, i) => {\n const active = i === ACTIVE_STEP[phase];\n const done = i < ACTIVE_STEP[phase];\n return (\n <li key={label} data-step aria-current={active ? \"step\" : undefined} className=\"flex items-center gap-3\">\n {done ? (\n <CheckCircle2 className=\"h-4 w-4 shrink-0 text-emerald-500\" />\n ) : active ? (\n <Loader2 className=\"h-4 w-4 shrink-0 animate-spin text-primary\" />\n ) : (\n <div className=\"h-4 w-4 shrink-0 rounded-full border-2 border-muted-foreground/30\" />\n )}\n <span className={done ? \"text-sm text-foreground\" : active ? \"text-sm font-medium text-primary\" : \"text-sm text-muted-foreground\"}>\n {label}\n </span>\n </li>\n );\n })}\n </ol>\n <p className=\"text-center text-xs text-muted-foreground\">This usually takes 10–30 seconds. Do not close this window.</p>\n </div>\n )}\n\n {success && children}\n\n {failed && (\n <div className=\"flex flex-col items-center gap-5 py-2\">\n <div className=\"flex h-16 w-16 items-center justify-center rounded-full bg-destructive/10\">\n <XCircle className=\"h-9 w-9 text-destructive\" />\n </div>\n <div className=\"space-y-1 text-center\">\n <p className=\"text-xl font-bold\">{title}</p>\n <p className=\"mx-auto max-w-xs text-sm text-muted-foreground\">{error}</p>\n </div>\n <Button variant=\"outline\" className=\"w-full\" onClick={reset}>\n {retryable ? \"Try again\" : \"Close\"}\n </Button>\n </div>\n )}\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2CQ;AAzCR,mBAAkD;AAClD,0BAA+C;AAC/C,oBAAmD;AACnD,oBAAuB;AACvB,sBAA6B;AAW7B,MAAM,cAAc,EAAE,WAAW,GAAG,YAAY,GAAG,YAAY,EAAE;AAE1D,SAAS,kBAAkB,EAAE,IAAI,OAAO,cAAc,iBAAiB,WAAW,SAAS,GAA2B;AAC3H,QAAM,EAAE,OAAO,OAAO,OAAO,YAAY,KAAK,IAAI;AAClD,QAAM,UAAU,UAAU,eAAe,UAAU,gBAAgB,UAAU;AAC7E,QAAM,UAAU,UAAU;AAC1B,QAAM,SAAS,UAAU;AACzB,QAAM,QAAQ,CAAC,gBAAgB,sBAAsB,qBAAqB;AAE1E,QAAM,oBAAgB,qBAAO,KAAK;AAClC,8BAAU,MAAM;AACd,QAAI,WAAW,CAAC,cAAc,SAAS;AACrC,oBAAc,UAAU;AACxB,wCAA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,WAAU,6CAA4C,8EAA2D;AAAA,WACtH;AAAA,QAGD,WAAW;AAAA,QAEX,UACC,6CAAC,SAAI,WAAU,yCACb;AAAA,sDAAC,SAAI,WAAU,6EACb,sDAAC,+BAAQ,WAAU,4BAA2B,GAChD;AAAA,UACA,6CAAC,SAAI,WAAU,yBACb;AAAA,wDAAC,OAAE,WAAU,qBAAqB,iBAAM;AAAA,YACxC,4CAAC,OAAE,WAAU,kDAAkD,iBAAM;AAAA,aACvE;AAAA,UACA,4CAAC,wBAAO,SAAQ,WAAU,WAAU,UAAS,SAAS,OACnD,sBAAY,cAAc,SAC7B;AAAA,WACF;AAAA;AAAA;AAAA,EAEJ,GACF;AAEJ;","names":[]}
@@ -7,7 +7,9 @@ import 'starknet';
7
7
  import '@medialane/sdk';
8
8
 
9
9
  interface TransactionDialogProps {
10
- tx: Pick<ReturnType<typeof useTransaction>, "phase" | "error" | "reset">;
10
+ tx: Pick<ReturnType<typeof useTransaction>, "phase" | "error" | "reset"> & {
11
+ retryable?: boolean;
12
+ };
11
13
  title: string;
12
14
  workingLabel: string;
13
15
  firstStepLabel?: string;
@@ -7,7 +7,9 @@ import 'starknet';
7
7
  import '@medialane/sdk';
8
8
 
9
9
  interface TransactionDialogProps {
10
- tx: Pick<ReturnType<typeof useTransaction>, "phase" | "error" | "reset">;
10
+ tx: Pick<ReturnType<typeof useTransaction>, "phase" | "error" | "reset"> & {
11
+ retryable?: boolean;
12
+ };
11
13
  title: string;
12
14
  workingLabel: string;
13
15
  firstStepLabel?: string;
@@ -7,7 +7,7 @@ import { Button } from "./button.js";
7
7
  import { fireConfetti } from "../utils/media-wallet/confetti.js";
8
8
  const ACTIVE_STEP = { preparing: 0, submitting: 1, confirming: 2 };
9
9
  function TransactionDialog({ tx, title, workingLabel, firstStepLabel = "Prepare", children }) {
10
- const { phase, error, reset } = tx;
10
+ const { phase, error, reset, retryable = true } = tx;
11
11
  const working = phase === "preparing" || phase === "submitting" || phase === "confirming";
12
12
  const success = phase === "success";
13
13
  const failed = phase === "error";
@@ -51,10 +51,10 @@ function TransactionDialog({ tx, title, workingLabel, firstStepLabel = "Prepare"
51
51
  failed && /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-5 py-2", children: [
52
52
  /* @__PURE__ */ jsx("div", { className: "flex h-16 w-16 items-center justify-center rounded-full bg-destructive/10", children: /* @__PURE__ */ jsx(XCircle, { className: "h-9 w-9 text-destructive" }) }),
53
53
  /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-center", children: [
54
- /* @__PURE__ */ jsx("p", { className: "text-xl font-bold", children: "Something went wrong" }),
55
- /* @__PURE__ */ jsx("p", { className: "mx-auto max-w-xs text-sm text-muted-foreground", children: error ?? "We couldn't complete that. Please try again." })
54
+ /* @__PURE__ */ jsx("p", { className: "text-xl font-bold", children: title }),
55
+ /* @__PURE__ */ jsx("p", { className: "mx-auto max-w-xs text-sm text-muted-foreground", children: error })
56
56
  ] }),
57
- /* @__PURE__ */ jsx(Button, { variant: "outline", className: "w-full", onClick: reset, children: "Try again" })
57
+ /* @__PURE__ */ jsx(Button, { variant: "outline", className: "w-full", onClick: reset, children: retryable ? "Try again" : "Close" })
58
58
  ] })
59
59
  ]
60
60
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/transaction-dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, type ReactNode } from \"react\";\nimport { CheckCircle2, Loader2, XCircle } from \"lucide-react\";\nimport { Dialog, DialogContent, DialogTitle } from \"./dialog.js\";\nimport { Button } from \"./button.js\";\nimport { fireConfetti } from \"../utils/media-wallet/confetti.js\";\nimport type { useTransaction } from \"../utils/use-transaction.js\";\n\nexport interface TransactionDialogProps {\n tx: Pick<ReturnType<typeof useTransaction>, \"phase\" | \"error\" | \"reset\">;\n title: string;\n workingLabel: string;\n firstStepLabel?: string;\n children?: ReactNode;\n}\n\nconst ACTIVE_STEP = { preparing: 0, submitting: 1, confirming: 2 } as const;\n\nexport function TransactionDialog({ tx, title, workingLabel, firstStepLabel = \"Prepare\", children }: TransactionDialogProps) {\n const { phase, error, reset } = tx;\n const working = phase === \"preparing\" || phase === \"submitting\" || phase === \"confirming\";\n const success = phase === \"success\";\n const failed = phase === \"error\";\n const steps = [firstStepLabel, \"Submit transaction\", \"Confirm transaction\"];\n\n const confettiFired = useRef(false);\n useEffect(() => {\n if (success && !confettiFired.current) {\n confettiFired.current = true;\n fireConfetti();\n }\n if (!success) confettiFired.current = false;\n }, [success]);\n\n return (\n <Dialog open={phase !== \"idle\"} modal onOpenChange={(open) => { if (!open && !working) reset(); }}>\n <DialogContent\n className=\"sm:max-w-md\"\n onInteractOutside={working ? (e) => e.preventDefault() : undefined}\n onEscapeKeyDown={working ? (e) => e.preventDefault() : undefined}\n {...(working ? { hideClose: true } : {})}\n >\n <DialogTitle className=\"sr-only\">{working ? workingLabel : title}</DialogTitle>\n\n {working && (\n <div className=\"flex flex-col items-center gap-6 py-4\">\n <div className=\"flex h-16 w-16 items-center justify-center rounded-full bg-primary/10\">\n <Loader2 className=\"h-8 w-8 animate-spin text-primary\" />\n </div>\n <div className=\"space-y-1 text-center\">\n <p className=\"text-lg font-semibold\">{workingLabel}</p>\n <p className=\"text-sm text-muted-foreground\">\n {phase === \"confirming\" ? \"Waiting for block confirmation\" : \"Submitting transaction\"}\n </p>\n </div>\n <ol className=\"w-full space-y-2 rounded-xl border border-border/60 bg-muted/30 p-4\">\n {steps.map((label, i) => {\n const active = i === ACTIVE_STEP[phase];\n const done = i < ACTIVE_STEP[phase];\n return (\n <li key={label} data-step aria-current={active ? \"step\" : undefined} className=\"flex items-center gap-3\">\n {done ? (\n <CheckCircle2 className=\"h-4 w-4 shrink-0 text-emerald-500\" />\n ) : active ? (\n <Loader2 className=\"h-4 w-4 shrink-0 animate-spin text-primary\" />\n ) : (\n <div className=\"h-4 w-4 shrink-0 rounded-full border-2 border-muted-foreground/30\" />\n )}\n <span className={done ? \"text-sm text-foreground\" : active ? \"text-sm font-medium text-primary\" : \"text-sm text-muted-foreground\"}>\n {label}\n </span>\n </li>\n );\n })}\n </ol>\n <p className=\"text-center text-xs text-muted-foreground\">This usually takes 10–30 seconds. Do not close this window.</p>\n </div>\n )}\n\n {success && children}\n\n {failed && (\n <div className=\"flex flex-col items-center gap-5 py-2\">\n <div className=\"flex h-16 w-16 items-center justify-center rounded-full bg-destructive/10\">\n <XCircle className=\"h-9 w-9 text-destructive\" />\n </div>\n <div className=\"space-y-1 text-center\">\n <p className=\"text-xl font-bold\">Something went wrong</p>\n <p className=\"mx-auto max-w-xs text-sm text-muted-foreground\">{error ?? \"We couldn't complete that. Please try again.\"}</p>\n </div>\n <Button variant=\"outline\" className=\"w-full\" onClick={reset}>\n Try again\n </Button>\n </div>\n )}\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AA2CQ,cAOI,YAPJ;AAzCR,SAAS,WAAW,cAA8B;AAClD,SAAS,cAAc,SAAS,eAAe;AAC/C,SAAS,QAAQ,eAAe,mBAAmB;AACnD,SAAS,cAAc;AACvB,SAAS,oBAAoB;AAW7B,MAAM,cAAc,EAAE,WAAW,GAAG,YAAY,GAAG,YAAY,EAAE;AAE1D,SAAS,kBAAkB,EAAE,IAAI,OAAO,cAAc,iBAAiB,WAAW,SAAS,GAA2B;AAC3H,QAAM,EAAE,OAAO,OAAO,MAAM,IAAI;AAChC,QAAM,UAAU,UAAU,eAAe,UAAU,gBAAgB,UAAU;AAC7E,QAAM,UAAU,UAAU;AAC1B,QAAM,SAAS,UAAU;AACzB,QAAM,QAAQ,CAAC,gBAAgB,sBAAsB,qBAAqB;AAE1E,QAAM,gBAAgB,OAAO,KAAK;AAClC,YAAU,MAAM;AACd,QAAI,WAAW,CAAC,cAAc,SAAS;AACrC,oBAAc,UAAU;AACxB,mBAAa;AAAA,IACf;AACA,QAAI,CAAC,QAAS,eAAc,UAAU;AAAA,EACxC,GAAG,CAAC,OAAO,CAAC;AAEZ,SACE,oBAAC,UAAO,MAAM,UAAU,QAAQ,OA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AAQ,WAAU,4BAA2B,GAChD;AAAA,UACA,qBAAC,SAAI,WAAU,yBACb;AAAA,gCAAC,OAAE,WAAU,qBAAoB,kCAAoB;AAAA,YACrD,oBAAC,OAAE,WAAU,kDAAkD,mBAAS,gDAA+C;AAAA,aACzH;AAAA,UACA,oBAAC,UAAO,SAAQ,WAAU,WAAU,UAAS,SAAS,OAAO,uBAE7D;AAAA,WACF;AAAA;AAAA;AAAA,EAEJ,GACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/transaction-dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, type ReactNode } from \"react\";\nimport { CheckCircle2, Loader2, XCircle } from \"lucide-react\";\nimport { Dialog, DialogContent, DialogTitle } from \"./dialog.js\";\nimport { Button } from \"./button.js\";\nimport { fireConfetti } from \"../utils/media-wallet/confetti.js\";\nimport type { useTransaction } from \"../utils/use-transaction.js\";\n\nexport interface TransactionDialogProps {\n tx: Pick<ReturnType<typeof useTransaction>, \"phase\" | \"error\" | \"reset\"> & { retryable?: boolean };\n title: string;\n workingLabel: string;\n firstStepLabel?: string;\n children?: ReactNode;\n}\n\nconst ACTIVE_STEP = { preparing: 0, submitting: 1, confirming: 2 } as const;\n\nexport function TransactionDialog({ tx, title, workingLabel, firstStepLabel = \"Prepare\", children }: TransactionDialogProps) {\n const { phase, error, reset, retryable = true } = tx;\n const working = phase === \"preparing\" || phase === \"submitting\" || phase === \"confirming\";\n const success = phase === \"success\";\n const failed = phase === \"error\";\n const steps = [firstStepLabel, \"Submit transaction\", \"Confirm transaction\"];\n\n const confettiFired = useRef(false);\n useEffect(() => {\n if (success && !confettiFired.current) {\n confettiFired.current = true;\n fireConfetti();\n }\n if (!success) confettiFired.current = false;\n }, [success]);\n\n return (\n <Dialog open={phase !== \"idle\"} modal onOpenChange={(open) => { if (!open && !working) reset(); }}>\n <DialogContent\n className=\"sm:max-w-md\"\n onInteractOutside={working ? (e) => e.preventDefault() : undefined}\n onEscapeKeyDown={working ? (e) => e.preventDefault() : undefined}\n {...(working ? { hideClose: true } : {})}\n >\n <DialogTitle className=\"sr-only\">{working ? workingLabel : title}</DialogTitle>\n\n {working && (\n <div className=\"flex flex-col items-center gap-6 py-4\">\n <div className=\"flex h-16 w-16 items-center justify-center rounded-full bg-primary/10\">\n <Loader2 className=\"h-8 w-8 animate-spin text-primary\" />\n </div>\n <div className=\"space-y-1 text-center\">\n <p className=\"text-lg font-semibold\">{workingLabel}</p>\n <p className=\"text-sm text-muted-foreground\">\n {phase === \"confirming\" ? \"Waiting for block confirmation\" : \"Submitting transaction\"}\n </p>\n </div>\n <ol className=\"w-full space-y-2 rounded-xl border border-border/60 bg-muted/30 p-4\">\n {steps.map((label, i) => {\n const active = i === ACTIVE_STEP[phase];\n const done = i < ACTIVE_STEP[phase];\n return (\n <li key={label} data-step aria-current={active ? \"step\" : undefined} className=\"flex items-center gap-3\">\n {done ? (\n <CheckCircle2 className=\"h-4 w-4 shrink-0 text-emerald-500\" />\n ) : active ? (\n <Loader2 className=\"h-4 w-4 shrink-0 animate-spin text-primary\" />\n ) : (\n <div className=\"h-4 w-4 shrink-0 rounded-full border-2 border-muted-foreground/30\" />\n )}\n <span className={done ? \"text-sm text-foreground\" : active ? \"text-sm font-medium text-primary\" : \"text-sm text-muted-foreground\"}>\n {label}\n </span>\n </li>\n );\n })}\n </ol>\n <p className=\"text-center text-xs text-muted-foreground\">This usually takes 10–30 seconds. Do not close this window.</p>\n </div>\n )}\n\n {success && children}\n\n {failed && (\n <div className=\"flex flex-col items-center gap-5 py-2\">\n <div className=\"flex h-16 w-16 items-center justify-center rounded-full bg-destructive/10\">\n <XCircle className=\"h-9 w-9 text-destructive\" />\n </div>\n <div className=\"space-y-1 text-center\">\n <p className=\"text-xl font-bold\">{title}</p>\n <p className=\"mx-auto max-w-xs text-sm text-muted-foreground\">{error}</p>\n </div>\n <Button variant=\"outline\" className=\"w-full\" onClick={reset}>\n {retryable ? \"Try again\" : \"Close\"}\n </Button>\n </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WAAU,qCAAoC,GACzD;AAAA,UACA,qBAAC,SAAI,WAAU,yBACb;AAAA,gCAAC,OAAE,WAAU,yBAAyB,wBAAa;AAAA,YACnD,oBAAC,OAAE,WAAU,iCACV,oBAAU,eAAe,mCAAmC,0BAC/D;AAAA,aACF;AAAA,UACA,oBAAC,QAAG,WAAU,uEACX,gBAAM,IAAI,CAAC,OAAO,MAAM;AACvB,kBAAM,SAAS,MAAM,YAAY,KAAK;AACtC,kBAAM,OAAO,IAAI,YAAY,KAAK;AAClC,mBACE,qBAAC,QAAe,aAAS,MAAC,gBAAc,SAAS,SAAS,QAAW,WAAU,2BAC5E;AAAA,qBACC,oBAAC,gBAAa,WAAU,qCAAoC,IAC1D,SACF,oBAAC,WAAQ,WAAU,8CAA6C,IAEhE,oBAAC,SAAI,WAAU,qEAAoE;AAAA,cAErF,oBAAC,UAAK,WAAW,OAAO,4BAA4B,SAAS,qCAAqC,iCAC/F,iBACH;AAAA,iBAVO,KAWT;AAAA,UAEJ,CAAC,GACH;AAAA,UACA,oBAAC,OAAE,WAAU,6CAA4C,8EAA2D;AAAA,WACtH;AAAA,QAGD,WAAW;AAAA,QAEX,UACC,qBAAC,SAAI,WAAU,yCACb;AAAA,8BAAC,SAAI,WAAU,6EACb,8BAAC,WAAQ,WAAU,4BAA2B,GAChD;AAAA,UACA,qBAAC,SAAI,WAAU,yBACb;AAAA,gCAAC,OAAE,WAAU,qBAAqB,iBAAM;AAAA,YACxC,oBAAC,OAAE,WAAU,kDAAkD,iBAAM;AAAA,aACvE;AAAA,UACA,oBAAC,UAAO,SAAQ,WAAU,WAAU,UAAS,SAAS,OACnD,sBAAY,cAAc,SAC7B;AAAA,WACF;AAAA;AAAA;AAAA,EAEJ,GACF;AAEJ;","names":[]}
@@ -27,17 +27,20 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  mod
28
28
  ));
29
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
- var creation_success_exports = {};
31
- __export(creation_success_exports, {
32
- CreationSuccess: () => CreationSuccess
30
+ var transaction_success_exports = {};
31
+ __export(transaction_success_exports, {
32
+ TransactionSuccess: () => TransactionSuccess
33
33
  });
34
- module.exports = __toCommonJS(creation_success_exports);
34
+ module.exports = __toCommonJS(transaction_success_exports);
35
35
  var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var import_lucide_react = require("lucide-react");
37
37
  var import_link = __toESM(require("./link.js"), 1);
38
38
  var import_image = __toESM(require("./image.js"), 1);
39
39
  var import_button = require("./button.js");
40
- function CreationSuccess({ name, image, caption, primary, secondary, onAgain, againLabel, children }) {
40
+ var import_marketplace_dialog_primitives = require("./marketplace-dialog-primitives.js");
41
+ var import_explorer_url = require("../utils/explorer-url.js");
42
+ function TransactionSuccess({ name, image, title, description, txHash, actions, children }) {
43
+ const shown = actions.filter((a) => !!a);
41
44
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex w-full flex-col items-center gap-6 py-2 text-center", children: [
42
45
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative", children: [
43
46
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "relative h-40 w-40 overflow-hidden rounded-3xl border border-border bg-muted shadow-lg", children: image ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_image.default, { src: image, alt: name, fill: true, sizes: "160px", unoptimized: true, className: "object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex h-full w-full items-center justify-center text-muted-foreground/40", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ImageIcon, { className: "h-10 w-10" }) }) }),
@@ -45,20 +48,16 @@ function CreationSuccess({ name, image, caption, primary, secondary, onAgain, ag
45
48
  ] }),
46
49
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "w-full min-w-0 space-y-1", children: [
47
50
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "line-clamp-2 break-words text-xl font-bold", children: name }),
48
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground", children: caption })
49
- ] }),
50
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex w-full flex-col gap-2", children: [
51
- (primary || secondary) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col gap-2 sm:flex-row", children: [
52
- primary && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { asChild: true, className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: primary.href, children: primary.label }) }),
53
- secondary && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { asChild: true, variant: "outline", className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: secondary.href, children: secondary.label }) })
54
- ] }),
55
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { variant: "ghost", size: "sm", className: "text-muted-foreground", onClick: onAgain, children: againLabel })
51
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "font-medium", children: title }),
52
+ description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "break-words text-sm text-muted-foreground", children: description }),
53
+ txHash && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_marketplace_dialog_primitives.MarketplaceTxLink, { txHash, explorerUrl: import_explorer_url.EXPLORER_URL, className: "pt-1" })
56
54
  ] }),
55
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex w-full flex-col gap-2", children: shown.map((action, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { asChild: !!action.href, variant: i === 0 ? "default" : "outline", className: "w-full", onClick: action.onClick, children: action.href ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: action.href, children: action.label }) : action.label }, action.label)) }),
57
56
  children
58
57
  ] });
59
58
  }
60
59
  // Annotate the CommonJS export names for ESM import in node:
61
60
  0 && (module.exports = {
62
- CreationSuccess
61
+ TransactionSuccess
63
62
  });
64
- //# sourceMappingURL=creation-success.cjs.map
63
+ //# sourceMappingURL=transaction-success.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/transaction-success.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { Check, ImageIcon } from \"lucide-react\";\nimport Link from \"./link.js\";\nimport Image from \"./image.js\";\nimport { Button } from \"./button.js\";\nimport { MarketplaceTxLink } from \"./marketplace-dialog-primitives.js\";\nimport { EXPLORER_URL } from \"../utils/explorer-url.js\";\n\nexport interface TransactionSuccessAction {\n label: string;\n href?: string;\n onClick?: () => void;\n}\n\nexport interface TransactionSuccessProps {\n name: string;\n image?: string | null;\n title: string;\n description?: ReactNode;\n txHash?: string | null;\n actions: Array<TransactionSuccessAction | undefined>;\n children?: ReactNode;\n}\n\nexport function TransactionSuccess({ name, image, title, description, txHash, actions, children }: TransactionSuccessProps) {\n const shown = actions.filter((a): a is TransactionSuccessAction => !!a);\n return (\n <div className=\"flex w-full flex-col items-center gap-6 py-2 text-center\">\n <div className=\"relative\">\n <div className=\"relative h-40 w-40 overflow-hidden rounded-3xl border border-border bg-muted shadow-lg\">\n {image ? (\n <Image src={image} alt={name} fill sizes=\"160px\" unoptimized className=\"object-cover\" />\n ) : (\n <div className=\"flex h-full w-full items-center justify-center text-muted-foreground/40\">\n <ImageIcon className=\"h-10 w-10\" />\n </div>\n )}\n </div>\n <span className=\"absolute -bottom-2 -right-2 flex h-9 w-9 items-center justify-center rounded-full bg-emerald-500 text-white ring-4 ring-background\">\n <Check className=\"h-5 w-5\" strokeWidth={3} />\n </span>\n </div>\n\n <div className=\"w-full min-w-0 space-y-1\">\n <p className=\"line-clamp-2 break-words text-xl font-bold\">{name}</p>\n <p className=\"font-medium\">{title}</p>\n {description && <div className=\"break-words text-sm text-muted-foreground\">{description}</div>}\n {txHash && <MarketplaceTxLink txHash={txHash} explorerUrl={EXPLORER_URL} className=\"pt-1\" />}\n </div>\n\n <div className=\"flex w-full flex-col gap-2\">\n {shown.map((action, i) => (\n <Button key={action.label} asChild={!!action.href} variant={i === 0 ? \"default\" : \"outline\"} className=\"w-full\" onClick={action.onClick}>\n {action.href ? <Link href={action.href}>{action.label}</Link> : action.label}\n </Button>\n ))}\n </div>\n\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BM;AA3BN,0BAAiC;AACjC,kBAAiB;AACjB,mBAAkB;AAClB,oBAAuB;AACvB,2CAAkC;AAClC,0BAA6B;AAkBtB,SAAS,mBAAmB,EAAE,MAAM,OAAO,OAAO,aAAa,QAAQ,SAAS,SAAS,GAA4B;AAC1H,QAAM,QAAQ,QAAQ,OAAO,CAAC,MAAqC,CAAC,CAAC,CAAC;AACtE,SACE,6CAAC,SAAI,WAAU,4DACb;AAAA,iDAAC,SAAI,WAAU,YACb;AAAA,kDAAC,SAAI,WAAU,0FACZ,kBACC,4CAAC,aAAAA,SAAA,EAAM,KAAK,OAAO,KAAK,MAAM,MAAI,MAAC,OAAM,SAAQ,aAAW,MAAC,WAAU,gBAAe,IAEtF,4CAAC,SAAI,WAAU,2EACb,sDAAC,iCAAU,WAAU,aAAY,GACnC,GAEJ;AAAA,MACA,4CAAC,UAAK,WAAU,sIACd,sDAAC,6BAAM,WAAU,WAAU,aAAa,GAAG,GAC7C;AAAA,OACF;AAAA,IAEA,6CAAC,SAAI,WAAU,4BACb;AAAA,kDAAC,OAAE,WAAU,8CAA8C,gBAAK;AAAA,MAChE,4CAAC,OAAE,WAAU,eAAe,iBAAM;AAAA,MACjC,eAAe,4CAAC,SAAI,WAAU,6CAA6C,uBAAY;AAAA,MACvF,UAAU,4CAAC,0DAAkB,QAAgB,aAAa,kCAAc,WAAU,QAAO;AAAA,OAC5F;AAAA,IAEA,4CAAC,SAAI,WAAU,8BACZ,gBAAM,IAAI,CAAC,QAAQ,MAClB,4CAAC,wBAA0B,SAAS,CAAC,CAAC,OAAO,MAAM,SAAS,MAAM,IAAI,YAAY,WAAW,WAAU,UAAS,SAAS,OAAO,SAC7H,iBAAO,OAAO,4CAAC,YAAAC,SAAA,EAAK,MAAM,OAAO,MAAO,iBAAO,OAAM,IAAU,OAAO,SAD5D,OAAO,KAEpB,CACD,GACH;AAAA,IAEC;AAAA,KACH;AAEJ;","names":["Image","Link"]}
@@ -0,0 +1,20 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ interface TransactionSuccessAction {
5
+ label: string;
6
+ href?: string;
7
+ onClick?: () => void;
8
+ }
9
+ interface TransactionSuccessProps {
10
+ name: string;
11
+ image?: string | null;
12
+ title: string;
13
+ description?: ReactNode;
14
+ txHash?: string | null;
15
+ actions: Array<TransactionSuccessAction | undefined>;
16
+ children?: ReactNode;
17
+ }
18
+ declare function TransactionSuccess({ name, image, title, description, txHash, actions, children }: TransactionSuccessProps): react_jsx_runtime.JSX.Element;
19
+
20
+ export { TransactionSuccess, type TransactionSuccessAction, type TransactionSuccessProps };
@@ -0,0 +1,20 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ interface TransactionSuccessAction {
5
+ label: string;
6
+ href?: string;
7
+ onClick?: () => void;
8
+ }
9
+ interface TransactionSuccessProps {
10
+ name: string;
11
+ image?: string | null;
12
+ title: string;
13
+ description?: ReactNode;
14
+ txHash?: string | null;
15
+ actions: Array<TransactionSuccessAction | undefined>;
16
+ children?: ReactNode;
17
+ }
18
+ declare function TransactionSuccess({ name, image, title, description, txHash, actions, children }: TransactionSuccessProps): react_jsx_runtime.JSX.Element;
19
+
20
+ export { TransactionSuccess, type TransactionSuccessAction, type TransactionSuccessProps };
@@ -4,7 +4,10 @@ import { Check, ImageIcon } from "lucide-react";
4
4
  import Link from "./link.js";
5
5
  import Image from "./image.js";
6
6
  import { Button } from "./button.js";
7
- function CreationSuccess({ name, image, caption, primary, secondary, onAgain, againLabel, children }) {
7
+ import { MarketplaceTxLink } from "./marketplace-dialog-primitives.js";
8
+ import { EXPLORER_URL } from "../utils/explorer-url.js";
9
+ function TransactionSuccess({ name, image, title, description, txHash, actions, children }) {
10
+ const shown = actions.filter((a) => !!a);
8
11
  return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col items-center gap-6 py-2 text-center", children: [
9
12
  /* @__PURE__ */ jsxs("div", { className: "relative", children: [
10
13
  /* @__PURE__ */ jsx("div", { className: "relative h-40 w-40 overflow-hidden rounded-3xl border border-border bg-muted shadow-lg", children: image ? /* @__PURE__ */ jsx(Image, { src: image, alt: name, fill: true, sizes: "160px", unoptimized: true, className: "object-cover" }) : /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center justify-center text-muted-foreground/40", children: /* @__PURE__ */ jsx(ImageIcon, { className: "h-10 w-10" }) }) }),
@@ -12,19 +15,15 @@ function CreationSuccess({ name, image, caption, primary, secondary, onAgain, ag
12
15
  ] }),
13
16
  /* @__PURE__ */ jsxs("div", { className: "w-full min-w-0 space-y-1", children: [
14
17
  /* @__PURE__ */ jsx("p", { className: "line-clamp-2 break-words text-xl font-bold", children: name }),
15
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: caption })
16
- ] }),
17
- /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-2", children: [
18
- (primary || secondary) && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 sm:flex-row", children: [
19
- primary && /* @__PURE__ */ jsx(Button, { asChild: true, className: "flex-1", children: /* @__PURE__ */ jsx(Link, { href: primary.href, children: primary.label }) }),
20
- secondary && /* @__PURE__ */ jsx(Button, { asChild: true, variant: "outline", className: "flex-1", children: /* @__PURE__ */ jsx(Link, { href: secondary.href, children: secondary.label }) })
21
- ] }),
22
- /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", className: "text-muted-foreground", onClick: onAgain, children: againLabel })
18
+ /* @__PURE__ */ jsx("p", { className: "font-medium", children: title }),
19
+ description && /* @__PURE__ */ jsx("div", { className: "break-words text-sm text-muted-foreground", children: description }),
20
+ txHash && /* @__PURE__ */ jsx(MarketplaceTxLink, { txHash, explorerUrl: EXPLORER_URL, className: "pt-1" })
23
21
  ] }),
22
+ /* @__PURE__ */ jsx("div", { className: "flex w-full flex-col gap-2", children: shown.map((action, i) => /* @__PURE__ */ jsx(Button, { asChild: !!action.href, variant: i === 0 ? "default" : "outline", className: "w-full", onClick: action.onClick, children: action.href ? /* @__PURE__ */ jsx(Link, { href: action.href, children: action.label }) : action.label }, action.label)) }),
24
23
  children
25
24
  ] });
26
25
  }
27
26
  export {
28
- CreationSuccess
27
+ TransactionSuccess
29
28
  };
30
- //# sourceMappingURL=creation-success.js.map
29
+ //# sourceMappingURL=transaction-success.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/transaction-success.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { Check, ImageIcon } from \"lucide-react\";\nimport Link from \"./link.js\";\nimport Image from \"./image.js\";\nimport { Button } from \"./button.js\";\nimport { MarketplaceTxLink } from \"./marketplace-dialog-primitives.js\";\nimport { EXPLORER_URL } from \"../utils/explorer-url.js\";\n\nexport interface TransactionSuccessAction {\n label: string;\n href?: string;\n onClick?: () => void;\n}\n\nexport interface TransactionSuccessProps {\n name: string;\n image?: string | null;\n title: string;\n description?: ReactNode;\n txHash?: string | null;\n actions: Array<TransactionSuccessAction | undefined>;\n children?: ReactNode;\n}\n\nexport function TransactionSuccess({ name, image, title, description, txHash, actions, children }: TransactionSuccessProps) {\n const shown = actions.filter((a): a is TransactionSuccessAction => !!a);\n return (\n <div className=\"flex w-full flex-col items-center gap-6 py-2 text-center\">\n <div className=\"relative\">\n <div className=\"relative h-40 w-40 overflow-hidden rounded-3xl border border-border bg-muted shadow-lg\">\n {image ? (\n <Image src={image} alt={name} fill sizes=\"160px\" unoptimized className=\"object-cover\" />\n ) : (\n <div className=\"flex h-full w-full items-center justify-center text-muted-foreground/40\">\n <ImageIcon className=\"h-10 w-10\" />\n </div>\n )}\n </div>\n <span className=\"absolute -bottom-2 -right-2 flex h-9 w-9 items-center justify-center rounded-full bg-emerald-500 text-white ring-4 ring-background\">\n <Check className=\"h-5 w-5\" strokeWidth={3} />\n </span>\n </div>\n\n <div className=\"w-full min-w-0 space-y-1\">\n <p className=\"line-clamp-2 break-words text-xl font-bold\">{name}</p>\n <p className=\"font-medium\">{title}</p>\n {description && <div className=\"break-words text-sm text-muted-foreground\">{description}</div>}\n {txHash && <MarketplaceTxLink txHash={txHash} explorerUrl={EXPLORER_URL} className=\"pt-1\" />}\n </div>\n\n <div className=\"flex w-full flex-col gap-2\">\n {shown.map((action, i) => (\n <Button key={action.label} asChild={!!action.href} variant={i === 0 ? \"default\" : \"outline\"} className=\"w-full\" onClick={action.onClick}>\n {action.href ? <Link href={action.href}>{action.label}</Link> : action.label}\n </Button>\n ))}\n </div>\n\n {children}\n </div>\n );\n}\n"],"mappings":";AA8BM,SAGM,KAHN;AA3BN,SAAS,OAAO,iBAAiB;AACjC,OAAO,UAAU;AACjB,OAAO,WAAW;AAClB,SAAS,cAAc;AACvB,SAAS,yBAAyB;AAClC,SAAS,oBAAoB;AAkBtB,SAAS,mBAAmB,EAAE,MAAM,OAAO,OAAO,aAAa,QAAQ,SAAS,SAAS,GAA4B;AAC1H,QAAM,QAAQ,QAAQ,OAAO,CAAC,MAAqC,CAAC,CAAC,CAAC;AACtE,SACE,qBAAC,SAAI,WAAU,4DACb;AAAA,yBAAC,SAAI,WAAU,YACb;AAAA,0BAAC,SAAI,WAAU,0FACZ,kBACC,oBAAC,SAAM,KAAK,OAAO,KAAK,MAAM,MAAI,MAAC,OAAM,SAAQ,aAAW,MAAC,WAAU,gBAAe,IAEtF,oBAAC,SAAI,WAAU,2EACb,8BAAC,aAAU,WAAU,aAAY,GACnC,GAEJ;AAAA,MACA,oBAAC,UAAK,WAAU,sIACd,8BAAC,SAAM,WAAU,WAAU,aAAa,GAAG,GAC7C;AAAA,OACF;AAAA,IAEA,qBAAC,SAAI,WAAU,4BACb;AAAA,0BAAC,OAAE,WAAU,8CAA8C,gBAAK;AAAA,MAChE,oBAAC,OAAE,WAAU,eAAe,iBAAM;AAAA,MACjC,eAAe,oBAAC,SAAI,WAAU,6CAA6C,uBAAY;AAAA,MACvF,UAAU,oBAAC,qBAAkB,QAAgB,aAAa,cAAc,WAAU,QAAO;AAAA,OAC5F;AAAA,IAEA,oBAAC,SAAI,WAAU,8BACZ,gBAAM,IAAI,CAAC,QAAQ,MAClB,oBAAC,UAA0B,SAAS,CAAC,CAAC,OAAO,MAAM,SAAS,MAAM,IAAI,YAAY,WAAW,WAAU,UAAS,SAAS,OAAO,SAC7H,iBAAO,OAAO,oBAAC,QAAK,MAAM,OAAO,MAAO,iBAAO,OAAM,IAAU,OAAO,SAD5D,OAAO,KAEpB,CACD,GACH;AAAA,IAEC;AAAA,KACH;AAEJ;","names":[]}
@@ -33,7 +33,7 @@ var import_label = require("./label.js");
33
33
  var import_marketplace_dialog_primitives = require("./marketplace-dialog-primitives.js");
34
34
  var import_medialane_app = require("./medialane-app.js");
35
35
  var import_transaction_dialog = require("./transaction-dialog.js");
36
- var import_transaction_done = require("./transaction-done.js");
36
+ var import_transaction_success = require("./transaction-success.js");
37
37
  var import_address = require("../utils/address.js");
38
38
  var import_run_intent_calls = require("../utils/run-intent-calls.js");
39
39
  var import_use_transaction = require("../utils/use-transaction.js");
@@ -117,15 +117,16 @@ function TransferCollectionOwnership({ collectionId, currentOwner, collectionNam
117
117
  ] })
118
118
  ] }) }),
119
119
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_transaction_dialog.TransactionDialog, { tx, title: "Transfer ownership", workingLabel: "Transferring ownership\u2026", firstStepLabel: "Prepare transfer", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
120
- import_transaction_done.TransactionDone,
120
+ import_transaction_success.TransactionSuccess,
121
121
  {
122
- tx,
123
122
  name: collectionName ?? "Collection",
124
123
  title: "Ownership transferred",
125
124
  description: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "tabular-nums", children: [
126
125
  "New owner: ",
127
126
  (0, import_address.shortenAddress)(trimmed)
128
- ] })
127
+ ] }),
128
+ txHash: tx.txHash,
129
+ actions: [{ label: "Done", onClick: tx.reset }]
129
130
  }
130
131
  ) })
131
132
  ] });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/transfer-collection-ownership.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { UserRoundCog } from \"lucide-react\";\nimport { normalizeAddress } from \"@medialane/sdk\";\nimport { Button } from \"./button.js\";\nimport { Dialog, DialogContent, DialogDescription, DialogTitle } from \"./dialog.js\";\nimport { Input } from \"./input.js\";\nimport { Label } from \"./label.js\";\nimport { MarketplaceConfirmStep } from \"./marketplace-dialog-primitives.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\nimport { TransactionDialog } from \"./transaction-dialog.js\";\nimport { TransactionDone } from \"./transaction-done.js\";\nimport { shortenAddress } from \"../utils/address.js\";\nimport { runIntentCalls } from \"../utils/run-intent-calls.js\";\nimport { useTransaction } from \"../utils/use-transaction.js\";\n\nexport interface TransferCollectionOwnershipProps {\n collectionId: string;\n currentOwner: string;\n collectionName?: string | null;\n onTransferred?: () => void;\n}\n\nexport function TransferCollectionOwnership({ collectionId, currentOwner, collectionName, onTransferred }: TransferCollectionOwnershipProps) {\n const app = useMedialaneApp();\n const tx = useTransaction();\n const [open, setOpen] = useState(false);\n const [confirming, setConfirming] = useState(false);\n const [newOwner, setNewOwner] = useState(\"\");\n\n const trimmed = newOwner.trim();\n const isValid = /^0x[0-9a-fA-F]{1,64}$/.test(trimmed);\n const wouldNoop = isValid && normalizeAddress(\"STARKNET\", trimmed) === normalizeAddress(\"STARKNET\", currentOwner);\n\n const close = () => {\n setOpen(false);\n setConfirming(false);\n };\n\n const transfer = () => {\n close();\n void tx\n .run(async (signer) => {\n await runIntentCalls(signer, () =>\n app.getClient().api.intents.create(\"transfer-collection-ownership\", { owner: signer.address, collectionId: String(collectionId), newOwner: trimmed }),\n );\n })\n .then((ok) => {\n if (ok) onTransferred?.();\n });\n };\n\n return (\n <>\n <Button variant=\"outline\" size=\"sm\" className=\"gap-2\" onClick={() => { setNewOwner(\"\"); setOpen(true); }}>\n <UserRoundCog className=\"h-4 w-4\" />\n Transfer ownership\n </Button>\n\n <Dialog open={open} onOpenChange={(next) => { if (!next) close(); }}>\n <DialogContent className=\"max-w-[calc(100%-6px)] sm:max-w-md p-0 overflow-hidden gap-0 rounded-2xl\">\n <DialogTitle className=\"sr-only\">Transfer ownership of {collectionName ?? \"collection\"}</DialogTitle>\n <DialogDescription className=\"sr-only\">Transfer the on-chain owner of this collection. Existing tokens are unaffected.</DialogDescription>\n\n {confirming ? (\n <MarketplaceConfirmStep\n description={`Transfer ownership to ${shortenAddress(trimmed)}?`}\n secondaryLabel=\"Back\"\n onSecondary={() => setConfirming(false)}\n primaryLabel=\"Transfer ownership\"\n onPrimary={transfer}\n primaryIcon={<UserRoundCog className=\"h-4 w-4\" />}\n />\n ) : (\n <div className=\"p-6 space-y-4\">\n <div className=\"flex items-center gap-2\">\n <UserRoundCog className=\"h-5 w-5\" />\n <p className=\"font-bold text-lg\">Transfer collection ownership</p>\n </div>\n <p className=\"text-sm text-muted-foreground\">\n The new owner will control minting and future ownership transfers for this collection. Existing tokens are unaffected.\n </p>\n <div className=\"space-y-2\">\n <Label htmlFor=\"new-owner\">New owner address</Label>\n <Input\n id=\"new-owner\"\n placeholder=\"0x…\"\n value={newOwner}\n onChange={(e) => setNewOwner(e.target.value)}\n className=\"tabular-nums text-sm\"\n spellCheck={false}\n autoComplete=\"off\"\n />\n {trimmed && !isValid && <p className=\"text-xs text-red-500\">Not a valid Starknet address.</p>}\n {wouldNoop && <p className=\"text-xs text-amber-500\">This is already the current owner.</p>}\n </div>\n <div className=\"flex gap-2 pt-2\">\n <Button variant=\"ghost\" className=\"flex-1\" onClick={close}>\n Cancel\n </Button>\n <Button className=\"flex-1\" onClick={() => setConfirming(true)} disabled={!isValid || wouldNoop || !app.walletAddress}>\n Continue\n </Button>\n </div>\n </div>\n )}\n </DialogContent>\n </Dialog>\n\n <TransactionDialog tx={tx} title=\"Transfer ownership\" workingLabel=\"Transferring ownership…\" firstStepLabel=\"Prepare transfer\">\n <TransactionDone\n tx={tx}\n name={collectionName ?? \"Collection\"}\n title=\"Ownership transferred\"\n description={<span className=\"tabular-nums\">New owner: {shortenAddress(trimmed)}</span>}\n />\n </TransactionDialog>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsDI;AApDJ,mBAAyB;AACzB,0BAA6B;AAC7B,iBAAiC;AACjC,oBAAuB;AACvB,oBAAsE;AACtE,mBAAsB;AACtB,mBAAsB;AACtB,2CAAuC;AACvC,2BAAgC;AAChC,gCAAkC;AAClC,8BAAgC;AAChC,qBAA+B;AAC/B,8BAA+B;AAC/B,6BAA+B;AASxB,SAAS,4BAA4B,EAAE,cAAc,cAAc,gBAAgB,cAAc,GAAqC;AAC3I,QAAM,UAAM,sCAAgB;AAC5B,QAAM,SAAK,uCAAe;AAC1B,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAS,KAAK;AACtC,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAClD,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAS,EAAE;AAE3C,QAAM,UAAU,SAAS,KAAK;AAC9B,QAAM,UAAU,wBAAwB,KAAK,OAAO;AACpD,QAAM,YAAY,eAAW,6BAAiB,YAAY,OAAO,UAAM,6BAAiB,YAAY,YAAY;AAEhH,QAAM,QAAQ,MAAM;AAClB,YAAQ,KAAK;AACb,kBAAc,KAAK;AAAA,EACrB;AAEA,QAAM,WAAW,MAAM;AACrB,UAAM;AACN,S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,SAAQ,aAAY,+BAAiB;AAAA,UAC5C;AAAA,YAAC;AAAA;AAAA,cACC,IAAG;AAAA,cACH,aAAY;AAAA,cACZ,OAAO;AAAA,cACP,UAAU,CAAC,MAAM,YAAY,EAAE,OAAO,KAAK;AAAA,cAC3C,WAAU;AAAA,cACV,YAAY;AAAA,cACZ,cAAa;AAAA;AAAA,UACf;AAAA,UACC,WAAW,CAAC,WAAW,4CAAC,OAAE,WAAU,wBAAuB,2CAA6B;AAAA,UACxF,aAAa,4CAAC,OAAE,WAAU,0BAAyB,gDAAkC;AAAA,WACxF;AAAA,QACA,6CAAC,SAAI,WAAU,mBACb;AAAA,sDAAC,wBAAO,SAAQ,SAAQ,WAAU,UAAS,SAAS,OAAO,oBAE3D;AAAA,UACA,4CAAC,wBAAO,WAAU,UAAS,SAAS,MAAM,cAAc,IAAI,GAAG,UAAU,CAAC,WAAW,aAAa,CAAC,IAAI,eAAe,sBAEtH;AAAA,WACF;AAAA,SACF;AAAA,OAEJ,GACF;AAAA,IAEA,4CAAC,+CAAkB,IAAQ,OAAM,sBAAqB,cAAa,gCAA0B,gBAAe,oBAC1G;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,MAAM,kBAAkB;AAAA,QACxB,OAAM;AAAA,QACN,aAAa,6CAAC,UAAK,WAAU,gBAAe;AAAA;AAAA,cAAY,+BAAe,OAAO;AAAA,WAAE;AAAA;AAAA,IAClF,GACF;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/transfer-collection-ownership.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { UserRoundCog } from \"lucide-react\";\nimport { normalizeAddress } from \"@medialane/sdk\";\nimport { Button } from \"./button.js\";\nimport { Dialog, DialogContent, DialogDescription, DialogTitle } from \"./dialog.js\";\nimport { Input } from \"./input.js\";\nimport { Label } from \"./label.js\";\nimport { MarketplaceConfirmStep } from \"./marketplace-dialog-primitives.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\nimport { TransactionDialog } from \"./transaction-dialog.js\";\nimport { TransactionSuccess } from \"./transaction-success.js\";\nimport { shortenAddress } from \"../utils/address.js\";\nimport { runIntentCalls } from \"../utils/run-intent-calls.js\";\nimport { useTransaction } from \"../utils/use-transaction.js\";\n\nexport interface TransferCollectionOwnershipProps {\n collectionId: string;\n currentOwner: string;\n collectionName?: string | null;\n onTransferred?: () => void;\n}\n\nexport function TransferCollectionOwnership({ collectionId, currentOwner, collectionName, onTransferred }: TransferCollectionOwnershipProps) {\n const app = useMedialaneApp();\n const tx = useTransaction();\n const [open, setOpen] = useState(false);\n const [confirming, setConfirming] = useState(false);\n const [newOwner, setNewOwner] = useState(\"\");\n\n const trimmed = newOwner.trim();\n const isValid = /^0x[0-9a-fA-F]{1,64}$/.test(trimmed);\n const wouldNoop = isValid && normalizeAddress(\"STARKNET\", trimmed) === normalizeAddress(\"STARKNET\", currentOwner);\n\n const close = () => {\n setOpen(false);\n setConfirming(false);\n };\n\n const transfer = () => {\n close();\n void tx\n .run(async (signer) => {\n await runIntentCalls(signer, () =>\n app.getClient().api.intents.create(\"transfer-collection-ownership\", { owner: signer.address, collectionId: String(collectionId), newOwner: trimmed }),\n );\n })\n .then((ok) => {\n if (ok) onTransferred?.();\n });\n };\n\n return (\n <>\n <Button variant=\"outline\" size=\"sm\" className=\"gap-2\" onClick={() => { setNewOwner(\"\"); setOpen(true); }}>\n <UserRoundCog className=\"h-4 w-4\" />\n Transfer ownership\n </Button>\n\n <Dialog open={open} onOpenChange={(next) => { if (!next) close(); }}>\n <DialogContent className=\"max-w-[calc(100%-6px)] sm:max-w-md p-0 overflow-hidden gap-0 rounded-2xl\">\n <DialogTitle className=\"sr-only\">Transfer ownership of {collectionName ?? \"collection\"}</DialogTitle>\n <DialogDescription className=\"sr-only\">Transfer the on-chain owner of this collection. Existing tokens are unaffected.</DialogDescription>\n\n {confirming ? (\n <MarketplaceConfirmStep\n description={`Transfer ownership to ${shortenAddress(trimmed)}?`}\n secondaryLabel=\"Back\"\n onSecondary={() => setConfirming(false)}\n primaryLabel=\"Transfer ownership\"\n onPrimary={transfer}\n primaryIcon={<UserRoundCog className=\"h-4 w-4\" />}\n />\n ) : (\n <div className=\"p-6 space-y-4\">\n <div className=\"flex items-center gap-2\">\n <UserRoundCog className=\"h-5 w-5\" />\n <p className=\"font-bold text-lg\">Transfer collection ownership</p>\n </div>\n <p className=\"text-sm text-muted-foreground\">\n The new owner will control minting and future ownership transfers for this collection. Existing tokens are unaffected.\n </p>\n <div className=\"space-y-2\">\n <Label htmlFor=\"new-owner\">New owner address</Label>\n <Input\n id=\"new-owner\"\n placeholder=\"0x…\"\n value={newOwner}\n onChange={(e) => setNewOwner(e.target.value)}\n className=\"tabular-nums text-sm\"\n spellCheck={false}\n autoComplete=\"off\"\n />\n {trimmed && !isValid && <p className=\"text-xs text-red-500\">Not a valid Starknet address.</p>}\n {wouldNoop && <p className=\"text-xs text-amber-500\">This is already the current owner.</p>}\n </div>\n <div className=\"flex gap-2 pt-2\">\n <Button variant=\"ghost\" className=\"flex-1\" onClick={close}>\n Cancel\n </Button>\n <Button className=\"flex-1\" onClick={() => setConfirming(true)} disabled={!isValid || wouldNoop || !app.walletAddress}>\n Continue\n </Button>\n </div>\n </div>\n )}\n </DialogContent>\n </Dialog>\n\n <TransactionDialog tx={tx} title=\"Transfer ownership\" workingLabel=\"Transferring ownership…\" firstStepLabel=\"Prepare transfer\">\n <TransactionSuccess\n name={collectionName ?? \"Collection\"}\n title=\"Ownership transferred\"\n description={<span className=\"tabular-nums\">New owner: {shortenAddress(trimmed)}</span>}\n txHash={tx.txHash}\n actions={[{ label: \"Done\", onClick: tx.reset }]}\n />\n </TransactionDialog>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsDI;AApDJ,mBAAyB;AACzB,0BAA6B;AAC7B,iBAAiC;AACjC,oBAAuB;AACvB,oBAAsE;AACtE,mBAAsB;AACtB,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A,SACF;AAAA,OAEJ,GACF;AAAA,IAEA,4CAAC,+CAAkB,IAAQ,OAAM,sBAAqB,cAAa,gCAA0B,gBAAe,oBAC1G;AAAA,MAAC;AAAA;AAAA,QACC,MAAM,kBAAkB;AAAA,QACxB,OAAM;AAAA,QACN,aAAa,6CAAC,UAAK,WAAU,gBAAe;AAAA;AAAA,cAAY,+BAAe,OAAO;AAAA,WAAE;AAAA,QAChF,QAAQ,GAAG;AAAA,QACX,SAAS,CAAC,EAAE,OAAO,QAAQ,SAAS,GAAG,MAAM,CAAC;AAAA;AAAA,IAChD,GACF;AAAA,KACF;AAEJ;","names":[]}
@@ -10,7 +10,7 @@ import { Label } from "./label.js";
10
10
  import { MarketplaceConfirmStep } from "./marketplace-dialog-primitives.js";
11
11
  import { useMedialaneApp } from "./medialane-app.js";
12
12
  import { TransactionDialog } from "./transaction-dialog.js";
13
- import { TransactionDone } from "./transaction-done.js";
13
+ import { TransactionSuccess } from "./transaction-success.js";
14
14
  import { shortenAddress } from "../utils/address.js";
15
15
  import { runIntentCalls } from "../utils/run-intent-calls.js";
16
16
  import { useTransaction } from "../utils/use-transaction.js";
@@ -94,15 +94,16 @@ function TransferCollectionOwnership({ collectionId, currentOwner, collectionNam
94
94
  ] })
95
95
  ] }) }),
96
96
  /* @__PURE__ */ jsx(TransactionDialog, { tx, title: "Transfer ownership", workingLabel: "Transferring ownership\u2026", firstStepLabel: "Prepare transfer", children: /* @__PURE__ */ jsx(
97
- TransactionDone,
97
+ TransactionSuccess,
98
98
  {
99
- tx,
100
99
  name: collectionName ?? "Collection",
101
100
  title: "Ownership transferred",
102
101
  description: /* @__PURE__ */ jsxs("span", { className: "tabular-nums", children: [
103
102
  "New owner: ",
104
103
  shortenAddress(trimmed)
105
- ] })
104
+ ] }),
105
+ txHash: tx.txHash,
106
+ actions: [{ label: "Done", onClick: tx.reset }]
106
107
  }
107
108
  ) })
108
109
  ] });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/transfer-collection-ownership.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { UserRoundCog } from \"lucide-react\";\nimport { normalizeAddress } from \"@medialane/sdk\";\nimport { Button } from \"./button.js\";\nimport { Dialog, DialogContent, DialogDescription, DialogTitle } from \"./dialog.js\";\nimport { Input } from \"./input.js\";\nimport { Label } from \"./label.js\";\nimport { MarketplaceConfirmStep } from \"./marketplace-dialog-primitives.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\nimport { TransactionDialog } from \"./transaction-dialog.js\";\nimport { TransactionDone } from \"./transaction-done.js\";\nimport { shortenAddress } from \"../utils/address.js\";\nimport { runIntentCalls } from \"../utils/run-intent-calls.js\";\nimport { useTransaction } from \"../utils/use-transaction.js\";\n\nexport interface TransferCollectionOwnershipProps {\n collectionId: string;\n currentOwner: string;\n collectionName?: string | null;\n onTransferred?: () => void;\n}\n\nexport function TransferCollectionOwnership({ collectionId, currentOwner, collectionName, onTransferred }: TransferCollectionOwnershipProps) {\n const app = useMedialaneApp();\n const tx = useTransaction();\n const [open, setOpen] = useState(false);\n const [confirming, setConfirming] = useState(false);\n const [newOwner, setNewOwner] = useState(\"\");\n\n const trimmed = newOwner.trim();\n const isValid = /^0x[0-9a-fA-F]{1,64}$/.test(trimmed);\n const wouldNoop = isValid && normalizeAddress(\"STARKNET\", trimmed) === normalizeAddress(\"STARKNET\", currentOwner);\n\n const close = () => {\n setOpen(false);\n setConfirming(false);\n };\n\n const transfer = () => {\n close();\n void tx\n .run(async (signer) => {\n await runIntentCalls(signer, () =>\n app.getClient().api.intents.create(\"transfer-collection-ownership\", { owner: signer.address, collectionId: String(collectionId), newOwner: trimmed }),\n );\n })\n .then((ok) => {\n if (ok) onTransferred?.();\n });\n };\n\n return (\n <>\n <Button variant=\"outline\" size=\"sm\" className=\"gap-2\" onClick={() => { setNewOwner(\"\"); setOpen(true); }}>\n <UserRoundCog className=\"h-4 w-4\" />\n Transfer ownership\n </Button>\n\n <Dialog open={open} onOpenChange={(next) => { if (!next) close(); }}>\n <DialogContent className=\"max-w-[calc(100%-6px)] sm:max-w-md p-0 overflow-hidden gap-0 rounded-2xl\">\n <DialogTitle className=\"sr-only\">Transfer ownership of {collectionName ?? \"collection\"}</DialogTitle>\n <DialogDescription className=\"sr-only\">Transfer the on-chain owner of this collection. Existing tokens are unaffected.</DialogDescription>\n\n {confirming ? (\n <MarketplaceConfirmStep\n description={`Transfer ownership to ${shortenAddress(trimmed)}?`}\n secondaryLabel=\"Back\"\n onSecondary={() => setConfirming(false)}\n primaryLabel=\"Transfer ownership\"\n onPrimary={transfer}\n primaryIcon={<UserRoundCog className=\"h-4 w-4\" />}\n />\n ) : (\n <div className=\"p-6 space-y-4\">\n <div className=\"flex items-center gap-2\">\n <UserRoundCog className=\"h-5 w-5\" />\n <p className=\"font-bold text-lg\">Transfer collection ownership</p>\n </div>\n <p className=\"text-sm text-muted-foreground\">\n The new owner will control minting and future ownership transfers for this collection. Existing tokens are unaffected.\n </p>\n <div className=\"space-y-2\">\n <Label htmlFor=\"new-owner\">New owner address</Label>\n <Input\n id=\"new-owner\"\n placeholder=\"0x…\"\n value={newOwner}\n onChange={(e) => setNewOwner(e.target.value)}\n className=\"tabular-nums text-sm\"\n spellCheck={false}\n autoComplete=\"off\"\n />\n {trimmed && !isValid && <p className=\"text-xs text-red-500\">Not a valid Starknet address.</p>}\n {wouldNoop && <p className=\"text-xs text-amber-500\">This is already the current owner.</p>}\n </div>\n <div className=\"flex gap-2 pt-2\">\n <Button variant=\"ghost\" className=\"flex-1\" onClick={close}>\n Cancel\n </Button>\n <Button className=\"flex-1\" onClick={() => setConfirming(true)} disabled={!isValid || wouldNoop || !app.walletAddress}>\n Continue\n </Button>\n </div>\n </div>\n )}\n </DialogContent>\n </Dialog>\n\n <TransactionDialog tx={tx} title=\"Transfer ownership\" workingLabel=\"Transferring ownership…\" firstStepLabel=\"Prepare transfer\">\n <TransactionDone\n tx={tx}\n name={collectionName ?? \"Collection\"}\n title=\"Ownership transferred\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UACxF,aAAa,oBAAC,OAAE,WAAU,0BAAyB,gDAAkC;AAAA,WACxF;AAAA,QACA,qBAAC,SAAI,WAAU,mBACb;AAAA,8BAAC,UAAO,SAAQ,SAAQ,WAAU,UAAS,SAAS,OAAO,oBAE3D;AAAA,UACA,oBAAC,UAAO,WAAU,UAAS,SAAS,MAAM,cAAc,IAAI,GAAG,UAAU,CAAC,WAAW,aAAa,CAAC,IAAI,eAAe,sBAEtH;AAAA,WACF;AAAA,SACF;AAAA,OAEJ,GACF;AAAA,IAEA,oBAAC,qBAAkB,IAAQ,OAAM,sBAAqB,cAAa,gCAA0B,gBAAe,oBAC1G;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,MAAM,kBAAkB;AAAA,QACxB,OAAM;AAAA,QACN,aAAa,qBAAC,UAAK,WAAU,gBAAe;AAAA;AAAA,UAAY,eAAe,OAAO;AAAA,WAAE;AAAA;AAAA,IAClF,GACF;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/transfer-collection-ownership.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { UserRoundCog } from \"lucide-react\";\nimport { normalizeAddress } from \"@medialane/sdk\";\nimport { Button } from \"./button.js\";\nimport { Dialog, DialogContent, DialogDescription, DialogTitle } from \"./dialog.js\";\nimport { Input } from \"./input.js\";\nimport { Label } from \"./label.js\";\nimport { MarketplaceConfirmStep } from \"./marketplace-dialog-primitives.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\nimport { TransactionDialog } from \"./transaction-dialog.js\";\nimport { TransactionSuccess } from \"./transaction-success.js\";\nimport { shortenAddress } from \"../utils/address.js\";\nimport { runIntentCalls } from \"../utils/run-intent-calls.js\";\nimport { useTransaction } from \"../utils/use-transaction.js\";\n\nexport interface TransferCollectionOwnershipProps {\n collectionId: string;\n currentOwner: string;\n collectionName?: string | null;\n onTransferred?: () => void;\n}\n\nexport function TransferCollectionOwnership({ collectionId, currentOwner, collectionName, onTransferred }: TransferCollectionOwnershipProps) {\n const app = useMedialaneApp();\n const tx = useTransaction();\n const [open, setOpen] = useState(false);\n const [confirming, setConfirming] = useState(false);\n const [newOwner, setNewOwner] = useState(\"\");\n\n const trimmed = newOwner.trim();\n const isValid = /^0x[0-9a-fA-F]{1,64}$/.test(trimmed);\n const wouldNoop = isValid && normalizeAddress(\"STARKNET\", trimmed) === normalizeAddress(\"STARKNET\", currentOwner);\n\n const close = () => {\n setOpen(false);\n setConfirming(false);\n };\n\n const transfer = () => {\n close();\n void tx\n .run(async (signer) => {\n await runIntentCalls(signer, () =>\n app.getClient().api.intents.create(\"transfer-collection-ownership\", { owner: signer.address, collectionId: String(collectionId), newOwner: trimmed }),\n );\n })\n .then((ok) => {\n if (ok) onTransferred?.();\n });\n };\n\n return (\n <>\n <Button variant=\"outline\" size=\"sm\" className=\"gap-2\" onClick={() => { setNewOwner(\"\"); setOpen(true); }}>\n <UserRoundCog className=\"h-4 w-4\" />\n Transfer ownership\n </Button>\n\n <Dialog open={open} onOpenChange={(next) => { if (!next) close(); }}>\n <DialogContent className=\"max-w-[calc(100%-6px)] sm:max-w-md p-0 overflow-hidden gap-0 rounded-2xl\">\n <DialogTitle className=\"sr-only\">Transfer ownership of {collectionName ?? \"collection\"}</DialogTitle>\n <DialogDescription className=\"sr-only\">Transfer the on-chain owner of this collection. Existing tokens are unaffected.</DialogDescription>\n\n {confirming ? (\n <MarketplaceConfirmStep\n description={`Transfer ownership to ${shortenAddress(trimmed)}?`}\n secondaryLabel=\"Back\"\n onSecondary={() => setConfirming(false)}\n primaryLabel=\"Transfer ownership\"\n onPrimary={transfer}\n primaryIcon={<UserRoundCog className=\"h-4 w-4\" />}\n />\n ) : (\n <div className=\"p-6 space-y-4\">\n <div className=\"flex items-center gap-2\">\n <UserRoundCog className=\"h-5 w-5\" />\n <p className=\"font-bold text-lg\">Transfer collection ownership</p>\n </div>\n <p className=\"text-sm text-muted-foreground\">\n The new owner will control minting and future ownership transfers for this collection. Existing tokens are unaffected.\n </p>\n <div className=\"space-y-2\">\n <Label htmlFor=\"new-owner\">New owner address</Label>\n <Input\n id=\"new-owner\"\n placeholder=\"0x…\"\n value={newOwner}\n onChange={(e) => setNewOwner(e.target.value)}\n className=\"tabular-nums text-sm\"\n spellCheck={false}\n autoComplete=\"off\"\n />\n {trimmed && !isValid && <p className=\"text-xs text-red-500\">Not a valid Starknet address.</p>}\n {wouldNoop && <p className=\"text-xs text-amber-500\">This is already the current owner.</p>}\n </div>\n <div className=\"flex gap-2 pt-2\">\n <Button variant=\"ghost\" className=\"flex-1\" onClick={close}>\n Cancel\n </Button>\n <Button className=\"flex-1\" onClick={() => setConfirming(true)} disabled={!isValid || wouldNoop || !app.walletAddress}>\n Continue\n </Button>\n </div>\n </div>\n )}\n </DialogContent>\n </Dialog>\n\n <TransactionDialog tx={tx} title=\"Transfer ownership\" workingLabel=\"Transferring ownership…\" firstStepLabel=\"Prepare transfer\">\n <TransactionSuccess\n name={collectionName ?? \"Collection\"}\n title=\"Ownership transferred\"\n description={<span className=\"tabular-nums\">New owner: {shortenAddress(trimmed)}</span>}\n txHash={tx.txHash}\n actions={[{ label: \"Done\", onClick: tx.reset }]}\n />\n </TransactionDialog>\n </>\n );\n}\n"],"mappings":";AAsDI,mBAEI,KADF,YADF;AApDJ,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AACjC,SAAS,cAAc;AACvB,SAAS,QAAQ,eAAe,mBAAmB,mBAAmB;AACtE,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,8BAA8B;AACvC,SAAS,uBAAuB;AAChC,SAAS,yBAAyB;AAClC,SAAS,0BAA0B;AACnC,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AASxB,SAAS,4BAA4B,EAAE,cAAc,cAAc,gBAAgB,cAAc,GAAqC;AAC3I,QAAM,MAAM,gBAAgB;AAC5B,QAAM,KAAK,eAAe;AAC1B,QAAM,CA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A,QAChF,QAAQ,GAAG;AAAA,QACX,SAAS,CAAC,EAAE,OAAO,QAAQ,SAAS,GAAG,MAAM,CAAC;AAAA;AAAA,IAChD,GACF;AAAA,KACF;AAEJ;","names":[]}
@@ -26,9 +26,10 @@ var import_jsx_runtime = require("react/jsx-runtime");
26
26
  var import_react = require("react");
27
27
  var import_lucide_react = require("lucide-react");
28
28
  var import_starknet = require("@medialane/sdk/starknet");
29
+ var import_describe_error = require("../../utils/describe-error.js");
29
30
  var import_button = require("../button.js");
30
31
  var import_alert = require("../alert.js");
31
- function ExportKeySection({ loadSealed, unlock, describeError }) {
32
+ function ExportKeySection({ loadSealed, unlock }) {
32
33
  const [recoveryKey, setRecoveryKey] = (0, import_react.useState)(null);
33
34
  const [busy, setBusy] = (0, import_react.useState)(false);
34
35
  const [error, setError] = (0, import_react.useState)(null);
@@ -44,8 +45,7 @@ function ExportKeySection({ loadSealed, unlock, describeError }) {
44
45
  }
45
46
  setRecoveryKey((0, import_starknet.encodeRecoveryKey)({ walletAddress: sealed.address, privateKey: await unlock(sealed) }));
46
47
  } catch (err) {
47
- const fallback = "Could not unlock your key. Please try again.";
48
- setError(describeError ? describeError(err, fallback) : fallback);
48
+ setError((0, import_describe_error.describeError)(err).message);
49
49
  } finally {
50
50
  setBusy(false);
51
51
  }