@medialane/ui 0.246.0 → 0.247.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 (57) hide show
  1. package/dist/components/asset-comments-dialog.cjs +2 -2
  2. package/dist/components/asset-comments-dialog.cjs.map +1 -1
  3. package/dist/components/asset-comments-dialog.d.cts +3 -9
  4. package/dist/components/asset-comments-dialog.d.ts +3 -9
  5. package/dist/components/asset-comments-dialog.js +2 -2
  6. package/dist/components/asset-comments-dialog.js.map +1 -1
  7. package/dist/components/asset-page.cjs +6 -7
  8. package/dist/components/asset-page.cjs.map +1 -1
  9. package/dist/components/asset-page.d.cts +4 -13
  10. package/dist/components/asset-page.d.ts +4 -13
  11. package/dist/components/asset-page.js +6 -7
  12. package/dist/components/asset-page.js.map +1 -1
  13. package/dist/components/collection-page.cjs +3 -2
  14. package/dist/components/collection-page.cjs.map +1 -1
  15. package/dist/components/collection-page.d.cts +0 -5
  16. package/dist/components/collection-page.d.ts +0 -5
  17. package/dist/components/collection-page.js +3 -2
  18. package/dist/components/collection-page.js.map +1 -1
  19. package/dist/components/comments-section.cjs +304 -0
  20. package/dist/components/comments-section.cjs.map +1 -0
  21. package/dist/components/comments-section.d.cts +10 -0
  22. package/dist/components/comments-section.d.ts +10 -0
  23. package/dist/components/comments-section.js +270 -0
  24. package/dist/components/comments-section.js.map +1 -0
  25. package/dist/components/medialane-app.cjs.map +1 -1
  26. package/dist/components/medialane-app.d.cts +3 -0
  27. package/dist/components/medialane-app.d.ts +3 -0
  28. package/dist/components/medialane-app.js.map +1 -1
  29. package/dist/components/pop-manage-page.cjs +224 -0
  30. package/dist/components/pop-manage-page.cjs.map +1 -0
  31. package/dist/components/pop-manage-page.d.cts +7 -0
  32. package/dist/components/pop-manage-page.d.ts +7 -0
  33. package/dist/components/pop-manage-page.js +190 -0
  34. package/dist/components/pop-manage-page.js.map +1 -0
  35. package/dist/components/portfolio-sponsorships.cjs +1 -1
  36. package/dist/components/portfolio-sponsorships.cjs.map +1 -1
  37. package/dist/components/portfolio-sponsorships.js +1 -1
  38. package/dist/components/portfolio-sponsorships.js.map +1 -1
  39. package/dist/components/transfer-collection-ownership.cjs +137 -0
  40. package/dist/components/transfer-collection-ownership.cjs.map +1 -0
  41. package/dist/components/transfer-collection-ownership.d.cts +11 -0
  42. package/dist/components/transfer-collection-ownership.d.ts +11 -0
  43. package/dist/components/transfer-collection-ownership.js +113 -0
  44. package/dist/components/transfer-collection-ownership.js.map +1 -0
  45. package/dist/index.cjs +9 -0
  46. package/dist/index.cjs.map +1 -1
  47. package/dist/index.d.cts +5 -2
  48. package/dist/index.d.ts +5 -2
  49. package/dist/index.js +6 -0
  50. package/dist/index.js.map +1 -1
  51. package/dist/utils/use-transaction.cjs +2 -0
  52. package/dist/utils/use-transaction.cjs.map +1 -1
  53. package/dist/utils/use-transaction.d.cts +1 -1
  54. package/dist/utils/use-transaction.d.ts +1 -1
  55. package/dist/utils/use-transaction.js +2 -0
  56. package/dist/utils/use-transaction.js.map +1 -1
  57. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/comments-section.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { ExternalLink, Flag, Loader2, MessageCircle, Send, Zap } from \"lucide-react\";\nimport { normalizeAddress, profileHref, STARKNET_NFTCOMMENTS_CONTRACT } from \"@medialane/sdk\";\nimport { AddressDisplay } from \"./address-display.js\";\nimport { Button } from \"./button.js\";\nimport Link from \"./link.js\";\nimport { useMedialaneApp, type ReportTarget } from \"./medialane-app.js\";\nimport { RewardEarned } from \"./rewards/reward-earned.js\";\nimport { Skeleton } from \"./skeleton.js\";\nimport { Textarea } from \"./textarea.js\";\nimport { TransactionDialog } from \"./transaction-dialog.js\";\nimport { TransactionDone } from \"./transaction-done.js\";\nimport { cn } from \"../utils/cn.js\";\nimport { EXPLORER_URL } from \"../utils/explorer-url.js\";\nimport { runIntentCalls } from \"../utils/run-intent-calls.js\";\nimport { timeAgo } from \"../utils/time.js\";\nimport { useComments } from \"../utils/use-comments.js\";\nimport { useTransaction } from \"../utils/use-transaction.js\";\n\nconst MAX_LEN = 1000;\n\nexport interface CommentsSectionProps {\n contract: string;\n tokenId: string;\n className?: string;\n}\n\nexport function CommentsSection({ contract, tokenId, className }: CommentsSectionProps) {\n const app = useMedialaneApp();\n const walletAddress = app.walletAddress;\n const hasWallet = !!walletAddress;\n const { ReportDialog } = app;\n const { comments, isLoading, mutate } = useComments(contract, tokenId);\n const tx = useTransaction();\n\n const [text, setText] = useState(\"\");\n const [reportTarget, setReportTarget] = useState<ReportTarget | null>(null);\n\n const messagesRef = useRef<HTMLDivElement>(null);\n const bottomRef = useRef<HTMLDivElement>(null);\n const composeRef = useRef<HTMLTextAreaElement>(null);\n\n const byteLen = new TextEncoder().encode(text).length;\n const canSubmit = text.trim().length > 0 && byteLen <= MAX_LEN && !!STARKNET_NFTCOMMENTS_CONTRACT;\n const isProcessing = tx.phase === \"preparing\" || tx.phase === \"submitting\" || tx.phase === \"confirming\";\n\n const isOwn = (author: string) =>\n !!walletAddress && normalizeAddress(\"STARKNET\", author) === normalizeAddress(\"STARKNET\", walletAddress);\n\n const isNearBottom = () => {\n const el = messagesRef.current;\n if (!el) return true;\n return el.scrollHeight - el.scrollTop - el.clientHeight < 100;\n };\n\n useEffect(() => {\n if (isNearBottom()) {\n bottomRef.current?.scrollIntoView({ behavior: \"smooth\" });\n }\n\n }, [comments.length]);\n\n const handleTextInput = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setText(e.target.value);\n e.target.style.height = \"auto\";\n e.target.style.height = Math.min(e.target.scrollHeight, 96) + \"px\";\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === \"Enter\" && !e.shiftKey && canSubmit && !isProcessing) {\n e.preventDefault();\n post();\n }\n };\n\n const post = () => {\n const body = text.trim();\n void tx\n .run(async (signer) => {\n await runIntentCalls(signer, () =>\n app.getClient().api.intents.create(\"comment\", { author: signer.address, nftContract: contract, tokenId, text: body }),\n );\n })\n .then((ok) => {\n if (!ok) return;\n setText(\"\");\n if (composeRef.current) composeRef.current.style.height = \"auto\";\n void mutate();\n });\n };\n\n const handleStartConversation = () => {\n if (hasWallet) composeRef.current?.focus();\n };\n\n return (\n <div className={cn(\"flex flex-col h-[480px] overflow-hidden\", className)}>\n\n <div ref={messagesRef} className=\"flex-1 overflow-y-auto px-4 py-4\">\n {isLoading ? (\n <div className=\"space-y-4\">\n {([\n { own: false, w: \"w-40\" },\n { own: true, w: \"w-56\" },\n { own: false, w: \"w-48\" },\n { own: true, w: \"w-32\" },\n ] as const).map((item, i) => (\n <div key={i} className={`flex ${item.own ? \"justify-end\" : \"justify-start\"} gap-2`}>\n {!item.own && <Skeleton className=\"h-8 w-8 rounded-full shrink-0\" />}\n <Skeleton\n className={`h-10 ${item.w} rounded-2xl ${item.own ? \"rounded-tr-sm\" : \"rounded-tl-sm\"}`}\n />\n </div>\n ))}\n </div>\n ) : comments.length === 0 ? (\n <div className=\"flex flex-col items-center justify-center h-full gap-4 text-center px-4\">\n <div className=\"flex h-16 w-16 items-center justify-center rounded-full\" style={{ background: \"linear-gradient(135deg, hsl(var(--brand-blue) / 0.15), hsl(var(--brand-purple) / 0.15))\" }}>\n <MessageCircle className=\"h-7 w-7\" style={{ color: \"hsl(var(--brand-blue))\" }} />\n </div>\n <div>\n <p className=\"text-sm font-semibold\">Nothing here yet</p>\n <p className=\"text-xs text-muted-foreground mt-1 leading-relaxed max-w-[220px]\">\n Your comment will be minted onchain — attached to this NFT forever.\n </p>\n </div>\n <Button\n size=\"sm\"\n onClick={handleStartConversation}\n className=\"rounded-full text-white px-5\"\n style={{ background: \"linear-gradient(135deg, hsl(var(--brand-blue)), hsl(var(--brand-purple)))\" }}\n >\n Write the first comment\n </Button>\n </div>\n ) : (\n <div className=\"space-y-5\">\n {comments.map((comment) => {\n const own = isOwn(comment.author);\n const avatarSeed = parseInt(comment.author.slice(2, 8), 16) % 360;\n const avatarBg = own\n ? \"linear-gradient(135deg, hsl(var(--brand-blue)), hsl(var(--brand-purple)))\"\n : `linear-gradient(135deg, hsl(${avatarSeed}, 65%, 45%), hsl(${(avatarSeed + 60) % 360}, 65%, 55%))`;\n\n return (\n <div\n key={comment.id}\n className={`group flex gap-2.5 ${own ? \"flex-row-reverse\" : \"flex-row\"}`}\n >\n\n <Link href={profileHref({ address: comment.author })} className=\"shrink-0 mt-0.5\">\n <div\n className=\"h-9 w-9 rounded-full flex items-center justify-center text-2xs font-bold text-white select-none ring-2 ring-background hover:ring-primary/40 transition-all\"\n style={{ background: avatarBg }}\n >\n {comment.author.slice(2, 5).toUpperCase()}\n </div>\n </Link>\n\n <div className={`flex flex-col max-w-[75%] gap-1 ${own ? \"items-end\" : \"items-start\"}`}>\n\n <div className={`flex items-center gap-2 px-1 ${own ? \"flex-row-reverse\" : \"flex-row\"}`}>\n <Link\n href={profileHref({ address: comment.author })}\n className=\"text-xs font-semibold text-foreground hover:underline underline-offset-2\"\n >\n {own ? \"You\" : <AddressDisplay address={comment.author} chars={5} showCopy={false} />}\n </Link>\n <span className=\"text-2xs text-muted-foreground\" title={comment.postedAt}>\n {timeAgo(comment.postedAt)}\n </span>\n </div>\n\n <div className=\"relative\">\n {own ? (\n <div\n className=\"px-3.5 py-2.5 text-sm leading-relaxed break-words rounded-2xl rounded-tr-sm text-white\"\n style={{ background: \"linear-gradient(135deg, hsl(var(--brand-blue)), hsl(var(--brand-purple)))\" }}\n >\n {comment.content}\n </div>\n ) : (\n <div className=\"px-3.5 py-2.5 text-sm leading-relaxed break-words bg-muted rounded-2xl rounded-tl-sm border border-border/50\">\n {comment.content}\n </div>\n )}\n {!own && hasWallet && (\n <button\n className=\"absolute -top-1 -right-5 opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground/40 hover:text-destructive/70\"\n title=\"Report comment\"\n aria-label=\"Report comment\"\n onClick={() => setReportTarget({ type: \"COMMENT\", commentId: comment.id })}\n >\n <Flag className=\"h-3 w-3\" />\n </button>\n )}\n </div>\n\n {comment.txHash && (\n <a\n href={`${EXPLORER_URL}/tx/${comment.txHash}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-1 px-1 text-2xs font-medium transition-colors\"\n style={{ color: \"hsl(var(--brand-blue) / 0.55)\" }}\n onMouseEnter={(e) => (e.currentTarget.style.color = \"hsl(var(--brand-blue))\")}\n onMouseLeave={(e) => (e.currentTarget.style.color = \"hsl(var(--brand-blue) / 0.55)\")}\n >\n <span>⛓</span>\n <span>onchain proof</span>\n <ExternalLink className=\"h-2.5 w-2.5\" />\n </a>\n )}\n </div>\n </div>\n );\n })}\n <div ref={bottomRef} />\n </div>\n )}\n </div>\n\n <div className=\"border-t border-border/60 shrink-0\">\n {!hasWallet ? (\n <div className=\"flex items-center justify-center px-4 h-16\">\n <button type=\"button\" onClick={app.onRequireWallet} className=\"text-sm text-primary hover:underline\">\n {app.connectLabel ?? \"Connect\"} to comment\n </button>\n </div>\n ) : (\n <div className=\"px-3 pt-2 pb-3 space-y-2\">\n\n <div className=\"flex items-center gap-1.5\">\n <Zap className=\"h-3 w-3\" style={{ color: \"hsl(var(--brand-blue))\" }} />\n <span className=\"text-2xs font-semibold\" style={{ color: \"hsl(var(--brand-blue))\" }}>\n Mint your message onchain\n </span>\n </div>\n\n <div\n className=\"rounded-xl border bg-background/60 transition-all focus-within:ring-2\"\n style={{\n borderColor: \"hsl(var(--border))\",\n }}\n onFocusCapture={(e) => {\n (e.currentTarget as HTMLDivElement).style.borderColor = \"hsl(var(--brand-blue) / 0.6)\";\n (e.currentTarget as HTMLDivElement).style.boxShadow = \"0 0 0 3px hsl(var(--brand-blue) / 0.12)\";\n }}\n onBlurCapture={(e) => {\n (e.currentTarget as HTMLDivElement).style.borderColor = \"hsl(var(--border))\";\n (e.currentTarget as HTMLDivElement).style.boxShadow = \"\";\n }}\n >\n <Textarea\n ref={composeRef}\n placeholder=\"Say something onchain… it's permanent.\"\n value={text}\n onChange={handleTextInput}\n onKeyDown={handleKeyDown}\n rows={2}\n className=\"resize-none min-h-[52px] max-h-[120px] w-full border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 px-3 pt-2.5 pb-1 text-sm rounded-xl\"\n disabled={isProcessing}\n />\n <div className=\"flex items-center justify-between px-3 pb-2.5\">\n <span className=\"text-2xs text-muted-foreground/40 flex items-center gap-1\">\n Enter ↵ to post\n </span>\n <div className=\"flex items-center gap-2\">\n {byteLen > 800 && (\n <span className={`text-2xs ${byteLen > MAX_LEN ? \"text-destructive\" : \"text-muted-foreground\"}`}>\n {byteLen}/{MAX_LEN}\n </span>\n )}\n <button\n onClick={post}\n disabled={!canSubmit || isProcessing}\n className=\"flex items-center gap-1.5 h-7 px-3 text-xs font-semibold rounded-full text-white transition-all hover:opacity-90 active:scale-95 disabled:opacity-40 disabled:cursor-not-allowed\"\n style={{ background: \"linear-gradient(135deg, hsl(var(--brand-blue)), hsl(var(--brand-purple)))\" }}\n >\n {isProcessing ? <Loader2 className=\"h-3 w-3 animate-spin\" /> : <Send className=\"h-3 w-3\" />}\n Post onchain\n </button>\n </div>\n </div>\n </div>\n </div>\n )}\n </div>\n\n {reportTarget && ReportDialog && (\n <ReportDialog\n target={reportTarget}\n open={!!reportTarget}\n onOpenChange={(open) => { if (!open) setReportTarget(null); }}\n />\n )}\n\n <TransactionDialog tx={tx} title=\"Comment\" workingLabel=\"Posting your comment…\" firstStepLabel=\"Prepare comment\">\n <TransactionDone\n tx={tx}\n name=\"Comment\"\n title=\"Comment posted!\"\n description=\"Your comment is onchain and will appear here once indexed (~30s).\"\n footer={<RewardEarned actionType=\"comment\" />}\n />\n </TransactionDialog>\n </div>\n );\n}\n"],"mappings":";AA6Gc,SACgB,KADhB;AA3Gd,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,cAAc,MAAM,SAAS,eAAe,MAAM,WAAW;AACtE,SAAS,kBAAkB,aAAa,qCA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gBACX,MAAM;AAAA,gBACN,WAAU;AAAA,gBACV,UAAU;AAAA;AAAA,YACZ;AAAA,YACA,qBAAC,SAAI,WAAU,iDACb;AAAA,kCAAC,UAAK,WAAU,6DAA4D,kCAE5E;AAAA,cACA,qBAAC,SAAI,WAAU,2BACZ;AAAA,0BAAU,OACT,qBAAC,UAAK,WAAW,YAAY,UAAU,UAAU,qBAAqB,uBAAuB,IAC1F;AAAA;AAAA,kBAAQ;AAAA,kBAAE;AAAA,mBACb;AAAA,gBAEF;AAAA,kBAAC;AAAA;AAAA,oBACC,SAAS;AAAA,oBACT,UAAU,CAAC,aAAa;AAAA,oBACxB,WAAU;AAAA,oBACV,OAAO,EAAE,YAAY,4EAA4E;AAAA,oBAEhG;AAAA,qCAAe,oBAAC,WAAQ,WAAU,wBAAuB,IAAK,oBAAC,QAAK,WAAU,WAAU;AAAA,sBAAG;AAAA;AAAA;AAAA,gBAE9F;AAAA,iBACF;AAAA,eACF;AAAA;AAAA;AAAA,MACF;AAAA,OACF,GAEJ;AAAA,IAEC,gBAAgB,gBACf;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ;AAAA,QACR,MAAM,CAAC,CAAC;AAAA,QACR,cAAc,CAAC,SAAS;AAAE,cAAI,CAAC,KAAM,iBAAgB,IAAI;AAAA,QAAG;AAAA;AAAA,IAC9D;AAAA,IAGF,oBAAC,qBAAkB,IAAQ,OAAM,WAAU,cAAa,8BAAwB,gBAAe,mBAC7F;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,MAAK;AAAA,QACL,OAAM;AAAA,QACN,aAAY;AAAA,QACZ,QAAQ,oBAAC,gBAAa,YAAW,WAAU;AAAA;AAAA,IAC7C,GACF;AAAA,KACF;AAEJ;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/medialane-app.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, useContext, type ComponentType, type ElementType, type ReactNode } from \"react\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { FastMintSigner } from \"./fast-mint/types.js\";\nimport type { ApiToken } from \"@medialane/sdk\";\nimport type { ImageResolver } from \"../utils/ipfs.js\";\n\nexport type AssetRef = Pick<ApiToken, \"chain\" | \"contractAddress\" | \"tokenId\">;\n\nexport interface CompanionApp {\n title: string;\n description: string;\n icon: ElementType;\n origin: string;\n}\n\nexport type ReportTarget =\n | { type: \"TOKEN\"; contract: string; tokenId: string; name?: string }\n | { type: \"COLLECTION\"; contract: string; name?: string }\n | { type: \"CREATOR\"; address: string; name?: string };\n\nexport type ReportDialogSlot = ComponentType<{ open: boolean; onOpenChange: (open: boolean) => void; target: ReportTarget }>;\n\nexport interface MedialaneApp {\n getClient: () => MedialaneClient;\n getSigner: () => Promise<FastMintSigner> | FastMintSigner;\n walletAddress: string | null;\n walletLoading?: boolean;\n onRequireWallet: () => void;\n releaseSigner?: () => void;\n ensureSignedIn?: () => Promise<void>;\n connectLabel?: string;\n connectDescription?: string;\n companion?: CompanionApp;\n ReportDialog?: ReportDialogSlot;\n resolveImage?: ImageResolver;\n}\n\nexport const MedialaneAppContext = createContext<MedialaneApp | null>(null);\n\nexport function MedialaneAppProvider({ value, children }: { value: MedialaneApp; children: ReactNode }) {\n return <MedialaneAppContext.Provider value={value}>{children}</MedialaneAppContext.Provider>;\n}\n\nexport function useMedialaneApp(): MedialaneApp {\n const app = useContext(MedialaneAppContext);\n if (!app) throw new Error(\"MedialaneAppProvider missing\");\n return app;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0CS;AAxCT,mBAAgG;AAqCzF,MAAM,0BAAsB,4BAAmC,IAAI;AAEnE,SAAS,qBAAqB,EAAE,OAAO,SAAS,GAAiD;AACtG,SAAO,4CAAC,oBAAoB,UAApB,EAA6B,OAAe,UAAS;AAC/D;AAEO,SAAS,kBAAgC;AAC9C,QAAM,UAAM,yBAAW,mBAAmB;AAC1C,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,8BAA8B;AACxD,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/components/medialane-app.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, useContext, type ComponentType, type ElementType, type ReactNode } from \"react\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { FastMintSigner } from \"./fast-mint/types.js\";\nimport type { ApiToken } from \"@medialane/sdk\";\nimport type { ImageResolver } from \"../utils/ipfs.js\";\n\nexport type AssetRef = Pick<ApiToken, \"chain\" | \"contractAddress\" | \"tokenId\">;\n\nexport interface CompanionApp {\n title: string;\n description: string;\n icon: ElementType;\n origin: string;\n}\n\nexport type ReportTarget =\n | { type: \"TOKEN\"; contract: string; tokenId: string; name?: string }\n | { type: \"COLLECTION\"; contract: string; name?: string }\n | { type: \"CREATOR\"; address: string; name?: string }\n | { type: \"COMMENT\"; commentId: string };\n\nexport type ReportDialogSlot = ComponentType<{ open: boolean; onOpenChange: (open: boolean) => void; target: ReportTarget }>;\n\nexport interface MedialaneApp {\n getClient: () => MedialaneClient;\n getSigner: () => Promise<FastMintSigner> | FastMintSigner;\n walletAddress: string | null;\n walletLoading?: boolean;\n onRequireWallet: () => void;\n releaseSigner?: () => void;\n ensureSignedIn?: () => Promise<void>;\n connectLabel?: string;\n connectDescription?: string;\n companion?: CompanionApp;\n ReportDialog?: ReportDialogSlot;\n resolveImage?: ImageResolver;\n}\n\nexport const MedialaneAppContext = createContext<MedialaneApp | null>(null);\n\nexport function MedialaneAppProvider({ value, children }: { value: MedialaneApp; children: ReactNode }) {\n return <MedialaneAppContext.Provider value={value}>{children}</MedialaneAppContext.Provider>;\n}\n\nexport function useMedialaneApp(): MedialaneApp {\n const app = useContext(MedialaneAppContext);\n if (!app) throw new Error(\"MedialaneAppProvider missing\");\n return app;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2CS;AAzCT,mBAAgG;AAsCzF,MAAM,0BAAsB,4BAAmC,IAAI;AAEnE,SAAS,qBAAqB,EAAE,OAAO,SAAS,GAAiD;AACtG,SAAO,4CAAC,oBAAoB,UAApB,EAA6B,OAAe,UAAS;AAC/D;AAEO,SAAS,kBAAgC;AAC9C,QAAM,UAAM,yBAAW,mBAAmB;AAC1C,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,8BAA8B;AACxD,SAAO;AACT;","names":[]}
@@ -27,6 +27,9 @@ type ReportTarget = {
27
27
  type: "CREATOR";
28
28
  address: string;
29
29
  name?: string;
30
+ } | {
31
+ type: "COMMENT";
32
+ commentId: string;
30
33
  };
31
34
  type ReportDialogSlot = ComponentType<{
32
35
  open: boolean;
@@ -27,6 +27,9 @@ type ReportTarget = {
27
27
  type: "CREATOR";
28
28
  address: string;
29
29
  name?: string;
30
+ } | {
31
+ type: "COMMENT";
32
+ commentId: string;
30
33
  };
31
34
  type ReportDialogSlot = ComponentType<{
32
35
  open: boolean;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/medialane-app.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, useContext, type ComponentType, type ElementType, type ReactNode } from \"react\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { FastMintSigner } from \"./fast-mint/types.js\";\nimport type { ApiToken } from \"@medialane/sdk\";\nimport type { ImageResolver } from \"../utils/ipfs.js\";\n\nexport type AssetRef = Pick<ApiToken, \"chain\" | \"contractAddress\" | \"tokenId\">;\n\nexport interface CompanionApp {\n title: string;\n description: string;\n icon: ElementType;\n origin: string;\n}\n\nexport type ReportTarget =\n | { type: \"TOKEN\"; contract: string; tokenId: string; name?: string }\n | { type: \"COLLECTION\"; contract: string; name?: string }\n | { type: \"CREATOR\"; address: string; name?: string };\n\nexport type ReportDialogSlot = ComponentType<{ open: boolean; onOpenChange: (open: boolean) => void; target: ReportTarget }>;\n\nexport interface MedialaneApp {\n getClient: () => MedialaneClient;\n getSigner: () => Promise<FastMintSigner> | FastMintSigner;\n walletAddress: string | null;\n walletLoading?: boolean;\n onRequireWallet: () => void;\n releaseSigner?: () => void;\n ensureSignedIn?: () => Promise<void>;\n connectLabel?: string;\n connectDescription?: string;\n companion?: CompanionApp;\n ReportDialog?: ReportDialogSlot;\n resolveImage?: ImageResolver;\n}\n\nexport const MedialaneAppContext = createContext<MedialaneApp | null>(null);\n\nexport function MedialaneAppProvider({ value, children }: { value: MedialaneApp; children: ReactNode }) {\n return <MedialaneAppContext.Provider value={value}>{children}</MedialaneAppContext.Provider>;\n}\n\nexport function useMedialaneApp(): MedialaneApp {\n const app = useContext(MedialaneAppContext);\n if (!app) throw new Error(\"MedialaneAppProvider missing\");\n return app;\n}\n"],"mappings":";AA0CS;AAxCT,SAAS,eAAe,kBAAwE;AAqCzF,MAAM,sBAAsB,cAAmC,IAAI;AAEnE,SAAS,qBAAqB,EAAE,OAAO,SAAS,GAAiD;AACtG,SAAO,oBAAC,oBAAoB,UAApB,EAA6B,OAAe,UAAS;AAC/D;AAEO,SAAS,kBAAgC;AAC9C,QAAM,MAAM,WAAW,mBAAmB;AAC1C,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,8BAA8B;AACxD,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/components/medialane-app.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, useContext, type ComponentType, type ElementType, type ReactNode } from \"react\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { FastMintSigner } from \"./fast-mint/types.js\";\nimport type { ApiToken } from \"@medialane/sdk\";\nimport type { ImageResolver } from \"../utils/ipfs.js\";\n\nexport type AssetRef = Pick<ApiToken, \"chain\" | \"contractAddress\" | \"tokenId\">;\n\nexport interface CompanionApp {\n title: string;\n description: string;\n icon: ElementType;\n origin: string;\n}\n\nexport type ReportTarget =\n | { type: \"TOKEN\"; contract: string; tokenId: string; name?: string }\n | { type: \"COLLECTION\"; contract: string; name?: string }\n | { type: \"CREATOR\"; address: string; name?: string }\n | { type: \"COMMENT\"; commentId: string };\n\nexport type ReportDialogSlot = ComponentType<{ open: boolean; onOpenChange: (open: boolean) => void; target: ReportTarget }>;\n\nexport interface MedialaneApp {\n getClient: () => MedialaneClient;\n getSigner: () => Promise<FastMintSigner> | FastMintSigner;\n walletAddress: string | null;\n walletLoading?: boolean;\n onRequireWallet: () => void;\n releaseSigner?: () => void;\n ensureSignedIn?: () => Promise<void>;\n connectLabel?: string;\n connectDescription?: string;\n companion?: CompanionApp;\n ReportDialog?: ReportDialogSlot;\n resolveImage?: ImageResolver;\n}\n\nexport const MedialaneAppContext = createContext<MedialaneApp | null>(null);\n\nexport function MedialaneAppProvider({ value, children }: { value: MedialaneApp; children: ReactNode }) {\n return <MedialaneAppContext.Provider value={value}>{children}</MedialaneAppContext.Provider>;\n}\n\nexport function useMedialaneApp(): MedialaneApp {\n const app = useContext(MedialaneAppContext);\n if (!app) throw new Error(\"MedialaneAppProvider missing\");\n return app;\n}\n"],"mappings":";AA2CS;AAzCT,SAAS,eAAe,kBAAwE;AAsCzF,MAAM,sBAAsB,cAAmC,IAAI;AAEnE,SAAS,qBAAqB,EAAE,OAAO,SAAS,GAAiD;AACtG,SAAO,oBAAC,oBAAoB,UAApB,EAA6B,OAAe,UAAS;AAC/D;AAEO,SAAS,kBAAgC;AAC9C,QAAM,MAAM,WAAW,mBAAmB;AAC1C,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,8BAA8B;AACxD,SAAO;AACT;","names":[]}
@@ -0,0 +1,224 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var pop_manage_page_exports = {};
31
+ __export(pop_manage_page_exports, {
32
+ PopManagePage: () => PopManagePage
33
+ });
34
+ module.exports = __toCommonJS(pop_manage_page_exports);
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_react = require("react");
37
+ var import_sdk = require("@medialane/sdk");
38
+ var import_starknet = require("@medialane/sdk/starknet");
39
+ var import_lucide_react = require("lucide-react");
40
+ var import_button = require("./button.js");
41
+ var import_link = __toESM(require("./link.js"), 1);
42
+ var import_medialane_app = require("./medialane-app.js");
43
+ var import_motion_primitives = require("./motion-primitives.js");
44
+ var import_skeleton = require("./skeleton.js");
45
+ var import_textarea = require("./textarea.js");
46
+ var import_transaction_dialog = require("./transaction-dialog.js");
47
+ var import_transaction_done = require("./transaction-done.js");
48
+ var import_wallet_required = require("./wallet-required.js");
49
+ var import_run_intent_calls = require("../utils/run-intent-calls.js");
50
+ var import_use_collections = require("../utils/use-collections.js");
51
+ var import_use_transaction = require("../utils/use-transaction.js");
52
+ function parseAddresses(raw) {
53
+ return raw.split(/[\n,\s]+/).map((a) => a.trim()).filter((a) => /^0x[0-9a-fA-F]+$/.test(a));
54
+ }
55
+ function downloadCsv(links) {
56
+ const href = URL.createObjectURL(new Blob([(0, import_starknet.popClaimLinksCsv)(links)], { type: "text/csv" }));
57
+ const anchor = Object.assign(document.createElement("a"), { href, download: "claim-links.csv" });
58
+ anchor.click();
59
+ URL.revokeObjectURL(href);
60
+ }
61
+ function IssueSection({
62
+ onIssue,
63
+ isSubmitting
64
+ }) {
65
+ const [raw, setRaw] = (0, import_react.useState)("");
66
+ const address = raw.trim();
67
+ const valid = /^0x[0-9a-fA-F]{1,64}$/.test(address);
68
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bento-cell p-5 space-y-3", children: [
69
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2", children: [
70
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Award, { className: "h-4 w-4 text-green-500" }),
71
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-semibold text-sm", children: "Issue directly" })
72
+ ] }),
73
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-muted-foreground", children: "Send the credential straight to one wallet \u2014 for a late participant, without republishing the list or changing anyone's claim link." }),
74
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
75
+ "input",
76
+ {
77
+ type: "text",
78
+ placeholder: "0x...",
79
+ value: raw,
80
+ onChange: (e) => setRaw(e.target.value),
81
+ className: "w-full rounded-lg border border-border bg-background px-3 py-2 text-sm tabular-nums placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"
82
+ }
83
+ ),
84
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
85
+ import_button.Button,
86
+ {
87
+ size: "sm",
88
+ variant: "outline",
89
+ className: "w-full",
90
+ disabled: !valid || isSubmitting,
91
+ onClick: () => {
92
+ onIssue(address);
93
+ setRaw("");
94
+ },
95
+ children: [
96
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Send, { className: "h-3.5 w-3.5 mr-1.5" }),
97
+ "Issue credential"
98
+ ]
99
+ }
100
+ )
101
+ ] });
102
+ }
103
+ function AllowlistSection({
104
+ onPublish,
105
+ isSubmitting,
106
+ links
107
+ }) {
108
+ const [raw, setRaw] = (0, import_react.useState)("");
109
+ const parsed = parseAddresses(raw);
110
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bento-cell p-5 space-y-3", children: [
111
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2", children: [
112
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Users, { className: "h-4 w-4 text-green-500" }),
113
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-semibold text-sm", children: "Participants" }),
114
+ parsed.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "ml-auto text-xs text-muted-foreground", children: [
115
+ parsed.length,
116
+ " address",
117
+ parsed.length !== 1 ? "es" : ""
118
+ ] })
119
+ ] }),
120
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-muted-foreground", children: "Paste every participant's wallet address. Publishing replaces the previous list and every link sent before it \u2014 send the new links to everyone who hasn't claimed yet. The list stays in this browser: download the claim links and send each participant theirs." }),
121
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
122
+ import_textarea.Textarea,
123
+ {
124
+ placeholder: "Paste Starknet addresses, one per line:\n0x04a...\n0x06b...",
125
+ rows: 8,
126
+ value: raw,
127
+ onChange: (e) => setRaw(e.target.value),
128
+ className: "tabular-nums text-xs resize-none"
129
+ }
130
+ ),
131
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
132
+ import_button.Button,
133
+ {
134
+ size: "sm",
135
+ className: "w-full bg-green-600 hover:bg-green-700 text-white",
136
+ disabled: parsed.length === 0 || isSubmitting,
137
+ onClick: () => onPublish(parsed),
138
+ children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
139
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Loader2, { className: "h-3.5 w-3.5 animate-spin mr-1.5" }),
140
+ "Publishing\u2026"
141
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
142
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.CheckCircle2, { className: "h-3.5 w-3.5 mr-1.5" }),
143
+ "Publish ",
144
+ parsed.length > 0 ? `${parsed.length} participant${parsed.length !== 1 ? "s" : ""}` : "participants"
145
+ ] })
146
+ }
147
+ ),
148
+ links && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2 pt-2", children: [
149
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_button.Button, { variant: "outline", size: "sm", className: "w-full", onClick: () => downloadCsv(links), children: [
150
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Download, { className: "h-3.5 w-3.5 mr-1.5" }),
151
+ "Download claim links (CSV)"
152
+ ] }),
153
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "max-h-48 overflow-auto text-xs tabular-nums space-y-1 text-muted-foreground", children: links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "truncate", children: link.address }, link.address)) })
154
+ ] })
155
+ ] });
156
+ }
157
+ function PopManagePage({ contract }) {
158
+ const app = (0, import_medialane_app.useMedialaneApp)();
159
+ const walletAddress = app.walletAddress;
160
+ const { collection, isLoading } = (0, import_use_collections.useCollection)(contract);
161
+ const tx = (0, import_use_transaction.useTransaction)();
162
+ const [done, setDone] = (0, import_react.useState)({ title: "", description: "" });
163
+ const [links, setLinks] = (0, import_react.useState)(null);
164
+ const isSubmitting = tx.phase === "preparing" || tx.phase === "submitting" || tx.phase === "confirming";
165
+ const isOwner = walletAddress && collection?.owner && (0, import_sdk.normalizeAddress)("STARKNET", walletAddress) === (0, import_sdk.normalizeAddress)("STARKNET", collection.owner);
166
+ const issue = (recipient) => {
167
+ setDone({ title: "Credential issued", description: "The credential is now in their wallet." });
168
+ void tx.run(async (signer) => {
169
+ await (0, import_run_intent_calls.runIntentCalls)(signer, () => app.getClient().api.intents.create("pop-manage", { owner: signer.address, collection: contract, action: "issue", recipient }));
170
+ });
171
+ };
172
+ const publish = (addresses) => {
173
+ const list = (0, import_starknet.buildPopAllowlist)(addresses);
174
+ const count = Object.keys(list.proofs).length;
175
+ setDone({ title: "Participants published", description: `Published ${count} participant${count !== 1 ? "s" : ""}.` });
176
+ void tx.run(async (signer) => {
177
+ await (0, import_run_intent_calls.runIntentCalls)(signer, () => app.getClient().api.intents.create("pop-manage", { owner: signer.address, collection: contract, action: "set_allowlist_root", root: list.root }));
178
+ }).then((ok) => {
179
+ if (ok) setLinks((0, import_starknet.popClaimLinks)(window.location.origin, contract, list));
180
+ });
181
+ };
182
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_required.WalletRequired, { icon: import_lucide_react.Award, title: "Connect your wallet", description: "Connect to manage your event.", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "max-w-xl mx-auto px-4 pt-10 pb-16 space-y-4", children: [
183
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: "h-6 w-24" }),
184
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: "h-32 w-full rounded-2xl" }),
185
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: "h-64 w-full rounded-2xl" })
186
+ ] }) : !collection ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "max-w-xl mx-auto px-4 pt-24 pb-8 text-center space-y-4", children: [
187
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.AlertCircle, { className: "h-10 w-10 text-muted-foreground/20 mx-auto" }),
188
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-muted-foreground", children: "Collection not found." }),
189
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { asChild: true, variant: "outline", size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: "/launchpad/pop", children: "\u2190 Back" }) })
190
+ ] }) : !isOwner ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "max-w-xl mx-auto px-4 pt-24 pb-8 text-center space-y-4", children: [
191
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Award, { className: "h-10 w-10 text-muted-foreground/20 mx-auto" }),
192
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-muted-foreground", children: "You are not the organizer of this event." }),
193
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { asChild: true, variant: "outline", size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: "/launchpad/pop", children: "\u2190 Back to events" }) })
194
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "max-w-xl mx-auto px-4 pt-10 pb-16 space-y-6", children: [
195
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_transaction_dialog.TransactionDialog, { tx, title: "Manage event", workingLabel: "Updating your event\u2026", firstStepLabel: "Prepare", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_transaction_done.TransactionDone, { tx, name: collection.name ?? "Event", title: done.title, description: done.description }) }),
196
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_motion_primitives.FadeIn, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { asChild: true, variant: "ghost", size: "sm", className: "-ml-2", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_link.default, { href: "/launchpad/pop", children: [
197
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ArrowLeft, { className: "h-3.5 w-3.5 mr-1.5" }),
198
+ "All events"
199
+ ] }) }) }),
200
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_motion_primitives.FadeIn, { delay: 0.04, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
201
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "pill-badge inline-flex gap-1.5 mb-2", children: [
202
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Award, { className: "h-3 w-3" }),
203
+ "Organizer"
204
+ ] }),
205
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { className: "text-2xl font-bold mt-1", children: "Manage Event" }),
206
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground", children: collection.name ?? contract })
207
+ ] }) }),
208
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_motion_primitives.FadeIn, { delay: 0.08, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bento-cell p-4 flex items-center gap-3", children: [
209
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Award, { className: "h-4 w-4 text-green-500 shrink-0" }),
210
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
211
+ "Only participants on your ",
212
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { className: "text-foreground", children: "published list" }),
213
+ " can claim, with the link you send them."
214
+ ] })
215
+ ] }) }),
216
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_motion_primitives.FadeIn, { delay: 0.12, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AllowlistSection, { onPublish: publish, isSubmitting, links }) }),
217
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_motion_primitives.FadeIn, { delay: 0.16, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IssueSection, { onIssue: issue, isSubmitting }) })
218
+ ] }) });
219
+ }
220
+ // Annotate the CommonJS export names for ESM import in node:
221
+ 0 && (module.exports = {
222
+ PopManagePage
223
+ });
224
+ //# sourceMappingURL=pop-manage-page.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/pop-manage-page.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { normalizeAddress } from \"@medialane/sdk\";\nimport { buildPopAllowlist, popClaimLinks, popClaimLinksCsv, type PopClaimLink } from \"@medialane/sdk/starknet\";\nimport { ArrowLeft, Award, AlertCircle, CheckCircle2, Download, Loader2, Send, Users } from \"lucide-react\";\nimport { Button } from \"./button.js\";\nimport Link from \"./link.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\nimport { FadeIn } from \"./motion-primitives.js\";\nimport { Skeleton } from \"./skeleton.js\";\nimport { Textarea } from \"./textarea.js\";\nimport { TransactionDialog } from \"./transaction-dialog.js\";\nimport { TransactionDone } from \"./transaction-done.js\";\nimport { WalletRequired } from \"./wallet-required.js\";\nimport { runIntentCalls } from \"../utils/run-intent-calls.js\";\nimport { useCollection } from \"../utils/use-collections.js\";\nimport { useTransaction } from \"../utils/use-transaction.js\";\n\nfunction parseAddresses(raw: string): string[] {\n return raw\n .split(/[\\n,\\s]+/)\n .map((a) => a.trim())\n .filter((a) => /^0x[0-9a-fA-F]+$/.test(a));\n}\n\nfunction downloadCsv(links: PopClaimLink[]) {\n const href = URL.createObjectURL(new Blob([popClaimLinksCsv(links)], { type: \"text/csv\" }));\n const anchor = Object.assign(document.createElement(\"a\"), { href, download: \"claim-links.csv\" });\n anchor.click();\n URL.revokeObjectURL(href);\n}\n\nfunction IssueSection({\n onIssue,\n isSubmitting,\n}: {\n onIssue: (address: string) => void;\n isSubmitting: boolean;\n}) {\n const [raw, setRaw] = useState(\"\");\n const address = raw.trim();\n const valid = /^0x[0-9a-fA-F]{1,64}$/.test(address);\n\n return (\n <div className=\"bento-cell p-5 space-y-3\">\n <div className=\"flex items-center gap-2\">\n <Award className=\"h-4 w-4 text-green-500\" />\n <span className=\"font-semibold text-sm\">Issue directly</span>\n </div>\n <p className=\"text-xs text-muted-foreground\">\n Send the credential straight to one wallet — for a late participant, without republishing the list or\n changing anyone&apos;s claim link.\n </p>\n <input\n type=\"text\"\n placeholder=\"0x...\"\n value={raw}\n onChange={(e) => setRaw(e.target.value)}\n className=\"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm tabular-nums placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring\"\n />\n <Button\n size=\"sm\"\n variant=\"outline\"\n className=\"w-full\"\n disabled={!valid || isSubmitting}\n onClick={() => {\n onIssue(address);\n setRaw(\"\");\n }}\n >\n <Send className=\"h-3.5 w-3.5 mr-1.5\" />\n Issue credential\n </Button>\n </div>\n );\n}\n\nfunction AllowlistSection({\n onPublish,\n isSubmitting,\n links,\n}: {\n onPublish: (addresses: string[]) => void;\n isSubmitting: boolean;\n links: PopClaimLink[] | null;\n}) {\n const [raw, setRaw] = useState(\"\");\n const parsed = parseAddresses(raw);\n\n return (\n <div className=\"bento-cell p-5 space-y-3\">\n <div className=\"flex items-center gap-2\">\n <Users className=\"h-4 w-4 text-green-500\" />\n <span className=\"font-semibold text-sm\">Participants</span>\n {parsed.length > 0 && (\n <span className=\"ml-auto text-xs text-muted-foreground\">\n {parsed.length} address{parsed.length !== 1 ? \"es\" : \"\"}\n </span>\n )}\n </div>\n <p className=\"text-xs text-muted-foreground\">\n Paste every participant&apos;s wallet address. Publishing replaces the previous list and every link\n sent before it — send the new links to everyone who hasn&apos;t claimed yet. The list stays in this\n browser: download the claim links and send each participant theirs.\n </p>\n <Textarea\n placeholder={\"Paste Starknet addresses, one per line:\\n0x04a...\\n0x06b...\"}\n rows={8}\n value={raw}\n onChange={(e) => setRaw(e.target.value)}\n className=\"tabular-nums text-xs resize-none\"\n />\n <Button\n size=\"sm\"\n className=\"w-full bg-green-600 hover:bg-green-700 text-white\"\n disabled={parsed.length === 0 || isSubmitting}\n onClick={() => onPublish(parsed)}\n >\n {isSubmitting ? (\n <>\n <Loader2 className=\"h-3.5 w-3.5 animate-spin mr-1.5\" />\n Publishing…\n </>\n ) : (\n <>\n <CheckCircle2 className=\"h-3.5 w-3.5 mr-1.5\" />\n Publish {parsed.length > 0 ? `${parsed.length} participant${parsed.length !== 1 ? \"s\" : \"\"}` : \"participants\"}\n </>\n )}\n </Button>\n {links && (\n <div className=\"space-y-2 pt-2\">\n <Button variant=\"outline\" size=\"sm\" className=\"w-full\" onClick={() => downloadCsv(links)}>\n <Download className=\"h-3.5 w-3.5 mr-1.5\" />\n Download claim links (CSV)\n </Button>\n <ul className=\"max-h-48 overflow-auto text-xs tabular-nums space-y-1 text-muted-foreground\">\n {links.map((link) => (\n <li key={link.address} className=\"truncate\">{link.address}</li>\n ))}\n </ul>\n </div>\n )}\n </div>\n );\n}\n\nexport function PopManagePage({ contract }: { contract: string }) {\n const app = useMedialaneApp();\n const walletAddress = app.walletAddress;\n const { collection, isLoading } = useCollection(contract);\n const tx = useTransaction();\n const [done, setDone] = useState({ title: \"\", description: \"\" });\n const [links, setLinks] = useState<PopClaimLink[] | null>(null);\n const isSubmitting = tx.phase === \"preparing\" || tx.phase === \"submitting\" || tx.phase === \"confirming\";\n\n const isOwner =\n walletAddress &&\n collection?.owner &&\n normalizeAddress(\"STARKNET\", walletAddress) === normalizeAddress(\"STARKNET\", collection.owner);\n\n const issue = (recipient: string) => {\n setDone({ title: \"Credential issued\", description: \"The credential is now in their wallet.\" });\n void tx.run(async (signer) => {\n await runIntentCalls(signer, () => app.getClient().api.intents.create(\"pop-manage\", { owner: signer.address, collection: contract, action: \"issue\", recipient }));\n });\n };\n\n const publish = (addresses: string[]) => {\n const list = buildPopAllowlist(addresses);\n const count = Object.keys(list.proofs).length;\n setDone({ title: \"Participants published\", description: `Published ${count} participant${count !== 1 ? \"s\" : \"\"}.` });\n void tx\n .run(async (signer) => {\n await runIntentCalls(signer, () => app.getClient().api.intents.create(\"pop-manage\", { owner: signer.address, collection: contract, action: \"set_allowlist_root\", root: list.root }));\n })\n .then((ok) => {\n if (ok) setLinks(popClaimLinks(window.location.origin, contract, list));\n });\n };\n\n return (\n <WalletRequired icon={Award} title=\"Connect your wallet\" description=\"Connect to manage your event.\">\n {isLoading ? (\n <div className=\"max-w-xl mx-auto px-4 pt-10 pb-16 space-y-4\">\n <Skeleton className=\"h-6 w-24\" />\n <Skeleton className=\"h-32 w-full rounded-2xl\" />\n <Skeleton className=\"h-64 w-full rounded-2xl\" />\n </div>\n ) : !collection ? (\n <div className=\"max-w-xl mx-auto px-4 pt-24 pb-8 text-center space-y-4\">\n <AlertCircle className=\"h-10 w-10 text-muted-foreground/20 mx-auto\" />\n <p className=\"text-muted-foreground\">Collection not found.</p>\n <Button asChild variant=\"outline\" size=\"sm\">\n <Link href=\"/launchpad/pop\">← Back</Link>\n </Button>\n </div>\n ) : !isOwner ? (\n <div className=\"max-w-xl mx-auto px-4 pt-24 pb-8 text-center space-y-4\">\n <Award className=\"h-10 w-10 text-muted-foreground/20 mx-auto\" />\n <p className=\"text-muted-foreground\">You are not the organizer of this event.</p>\n <Button asChild variant=\"outline\" size=\"sm\">\n <Link href=\"/launchpad/pop\">← Back to events</Link>\n </Button>\n </div>\n ) : (\n <div className=\"max-w-xl mx-auto px-4 pt-10 pb-16 space-y-6\">\n <TransactionDialog tx={tx} title=\"Manage event\" workingLabel=\"Updating your event…\" firstStepLabel=\"Prepare\">\n <TransactionDone tx={tx} name={collection.name ?? \"Event\"} title={done.title} description={done.description} />\n </TransactionDialog>\n\n <FadeIn>\n <Button asChild variant=\"ghost\" size=\"sm\" className=\"-ml-2\">\n <Link href=\"/launchpad/pop\">\n <ArrowLeft className=\"h-3.5 w-3.5 mr-1.5\" />\n All events\n </Link>\n </Button>\n </FadeIn>\n\n <FadeIn delay={0.04}>\n <div>\n <span className=\"pill-badge inline-flex gap-1.5 mb-2\">\n <Award className=\"h-3 w-3\" />\n Organizer\n </span>\n <h1 className=\"text-2xl font-bold mt-1\">Manage Event</h1>\n <p className=\"text-sm text-muted-foreground\">{collection.name ?? contract}</p>\n </div>\n </FadeIn>\n\n <FadeIn delay={0.08}>\n <div className=\"bento-cell p-4 flex items-center gap-3\">\n <Award className=\"h-4 w-4 text-green-500 shrink-0\" />\n <p className=\"text-xs text-muted-foreground\">\n Only participants on your <strong className=\"text-foreground\">published list</strong> can claim,\n with the link you send them.\n </p>\n </div>\n </FadeIn>\n\n <FadeIn delay={0.12}>\n <AllowlistSection onPublish={publish} isSubmitting={isSubmitting} links={links} />\n </FadeIn>\n\n <FadeIn delay={0.16}>\n <IssueSection onIssue={issue} isSubmitting={isSubmitting} />\n </FadeIn>\n </div>\n )}\n </WalletRequired>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8CM;AA5CN,mBAAyB;AACzB,iBAAiC;AACjC,sBAAsF;AACtF,0BAA4F;AAC5F,oBAAuB;AACvB,kBAAiB;AACjB,2BAAgC;AAChC,+BAAuB;AACvB,sBAAyB;AACzB,sBAAyB;AACzB,gCAAkC;AAClC,8BAAgC;AAChC,6BAA+B;AAC/B,8BAA+B;AAC/B,6BAA8B;AAC9B,6BAA+B;AAE/B,SAAS,eAAe,KAAuB;AAC7C,SAAO,IACJ,MAAM,UAAU,EAChB,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EACnB,OAAO,CAAC,MAAM,mBAAmB,KAAK,CAAC,CAAC;AAC7C;AAEA,SAAS,YAAY,OAAuB;AAC1C,QAAM,OAAO,IAAI,gBAAgB,IAAI,KAAK,KAAC,kCAAiB,KAAK,CAAC,GAAG,EAAE,MAAM,WAAW,CAAC,CAAC;AAC1F,QAAM,SAAS,OAAO,OAAO,SAAS,cAAc,GAAG,GAAG,EAAE,MAAM,UAAU,kBAAkB,CAAC;AAC/F,SAAO,MAAM;AACb,MAAI,gBAAgB,IAAI;AAC1B;AAEA,SAAS,aAAa;AAAA,EACpB;AAAA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,SAAI,WAAU,0CACb;AAAA,kDAAC,6BAAM,WAAU,mCAAkC;AAAA,MACnD,6CAAC,OAAE,WAAU,iCAAgC;AAAA;AAAA,QACjB,4CAAC,YAAO,WAAU,mBAAkB,4BAAc;AAAA,QAAS;AAAA,SAEvF;AAAA,OACF,GACF;AAAA,IAEA,4CAAC,mCAAO,OAAO,MACb,sDAAC,oBAAiB,WAAW,SAAS,cAA4B,OAAc,GAClF;AAAA,IAEA,4CAAC,mCAAO,OAAO,MACb,sDAAC,gBAAa,SAAS,OAAO,cAA4B,GAC5D;AAAA,KACF,GAEJ;AAEJ;","names":["Link"]}
@@ -0,0 +1,7 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ declare function PopManagePage({ contract }: {
4
+ contract: string;
5
+ }): react_jsx_runtime.JSX.Element;
6
+
7
+ export { PopManagePage };
@@ -0,0 +1,7 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ declare function PopManagePage({ contract }: {
4
+ contract: string;
5
+ }): react_jsx_runtime.JSX.Element;
6
+
7
+ export { PopManagePage };
@@ -0,0 +1,190 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { normalizeAddress } from "@medialane/sdk";
5
+ import { buildPopAllowlist, popClaimLinks, popClaimLinksCsv } from "@medialane/sdk/starknet";
6
+ import { ArrowLeft, Award, AlertCircle, CheckCircle2, Download, Loader2, Send, Users } from "lucide-react";
7
+ import { Button } from "./button.js";
8
+ import Link from "./link.js";
9
+ import { useMedialaneApp } from "./medialane-app.js";
10
+ import { FadeIn } from "./motion-primitives.js";
11
+ import { Skeleton } from "./skeleton.js";
12
+ import { Textarea } from "./textarea.js";
13
+ import { TransactionDialog } from "./transaction-dialog.js";
14
+ import { TransactionDone } from "./transaction-done.js";
15
+ import { WalletRequired } from "./wallet-required.js";
16
+ import { runIntentCalls } from "../utils/run-intent-calls.js";
17
+ import { useCollection } from "../utils/use-collections.js";
18
+ import { useTransaction } from "../utils/use-transaction.js";
19
+ function parseAddresses(raw) {
20
+ return raw.split(/[\n,\s]+/).map((a) => a.trim()).filter((a) => /^0x[0-9a-fA-F]+$/.test(a));
21
+ }
22
+ function downloadCsv(links) {
23
+ const href = URL.createObjectURL(new Blob([popClaimLinksCsv(links)], { type: "text/csv" }));
24
+ const anchor = Object.assign(document.createElement("a"), { href, download: "claim-links.csv" });
25
+ anchor.click();
26
+ URL.revokeObjectURL(href);
27
+ }
28
+ function IssueSection({
29
+ onIssue,
30
+ isSubmitting
31
+ }) {
32
+ const [raw, setRaw] = useState("");
33
+ const address = raw.trim();
34
+ const valid = /^0x[0-9a-fA-F]{1,64}$/.test(address);
35
+ return /* @__PURE__ */ jsxs("div", { className: "bento-cell p-5 space-y-3", children: [
36
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
37
+ /* @__PURE__ */ jsx(Award, { className: "h-4 w-4 text-green-500" }),
38
+ /* @__PURE__ */ jsx("span", { className: "font-semibold text-sm", children: "Issue directly" })
39
+ ] }),
40
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Send the credential straight to one wallet \u2014 for a late participant, without republishing the list or changing anyone's claim link." }),
41
+ /* @__PURE__ */ jsx(
42
+ "input",
43
+ {
44
+ type: "text",
45
+ placeholder: "0x...",
46
+ value: raw,
47
+ onChange: (e) => setRaw(e.target.value),
48
+ className: "w-full rounded-lg border border-border bg-background px-3 py-2 text-sm tabular-nums placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"
49
+ }
50
+ ),
51
+ /* @__PURE__ */ jsxs(
52
+ Button,
53
+ {
54
+ size: "sm",
55
+ variant: "outline",
56
+ className: "w-full",
57
+ disabled: !valid || isSubmitting,
58
+ onClick: () => {
59
+ onIssue(address);
60
+ setRaw("");
61
+ },
62
+ children: [
63
+ /* @__PURE__ */ jsx(Send, { className: "h-3.5 w-3.5 mr-1.5" }),
64
+ "Issue credential"
65
+ ]
66
+ }
67
+ )
68
+ ] });
69
+ }
70
+ function AllowlistSection({
71
+ onPublish,
72
+ isSubmitting,
73
+ links
74
+ }) {
75
+ const [raw, setRaw] = useState("");
76
+ const parsed = parseAddresses(raw);
77
+ return /* @__PURE__ */ jsxs("div", { className: "bento-cell p-5 space-y-3", children: [
78
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
79
+ /* @__PURE__ */ jsx(Users, { className: "h-4 w-4 text-green-500" }),
80
+ /* @__PURE__ */ jsx("span", { className: "font-semibold text-sm", children: "Participants" }),
81
+ parsed.length > 0 && /* @__PURE__ */ jsxs("span", { className: "ml-auto text-xs text-muted-foreground", children: [
82
+ parsed.length,
83
+ " address",
84
+ parsed.length !== 1 ? "es" : ""
85
+ ] })
86
+ ] }),
87
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Paste every participant's wallet address. Publishing replaces the previous list and every link sent before it \u2014 send the new links to everyone who hasn't claimed yet. The list stays in this browser: download the claim links and send each participant theirs." }),
88
+ /* @__PURE__ */ jsx(
89
+ Textarea,
90
+ {
91
+ placeholder: "Paste Starknet addresses, one per line:\n0x04a...\n0x06b...",
92
+ rows: 8,
93
+ value: raw,
94
+ onChange: (e) => setRaw(e.target.value),
95
+ className: "tabular-nums text-xs resize-none"
96
+ }
97
+ ),
98
+ /* @__PURE__ */ jsx(
99
+ Button,
100
+ {
101
+ size: "sm",
102
+ className: "w-full bg-green-600 hover:bg-green-700 text-white",
103
+ disabled: parsed.length === 0 || isSubmitting,
104
+ onClick: () => onPublish(parsed),
105
+ children: isSubmitting ? /* @__PURE__ */ jsxs(Fragment, { children: [
106
+ /* @__PURE__ */ jsx(Loader2, { className: "h-3.5 w-3.5 animate-spin mr-1.5" }),
107
+ "Publishing\u2026"
108
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
109
+ /* @__PURE__ */ jsx(CheckCircle2, { className: "h-3.5 w-3.5 mr-1.5" }),
110
+ "Publish ",
111
+ parsed.length > 0 ? `${parsed.length} participant${parsed.length !== 1 ? "s" : ""}` : "participants"
112
+ ] })
113
+ }
114
+ ),
115
+ links && /* @__PURE__ */ jsxs("div", { className: "space-y-2 pt-2", children: [
116
+ /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", className: "w-full", onClick: () => downloadCsv(links), children: [
117
+ /* @__PURE__ */ jsx(Download, { className: "h-3.5 w-3.5 mr-1.5" }),
118
+ "Download claim links (CSV)"
119
+ ] }),
120
+ /* @__PURE__ */ jsx("ul", { className: "max-h-48 overflow-auto text-xs tabular-nums space-y-1 text-muted-foreground", children: links.map((link) => /* @__PURE__ */ jsx("li", { className: "truncate", children: link.address }, link.address)) })
121
+ ] })
122
+ ] });
123
+ }
124
+ function PopManagePage({ contract }) {
125
+ const app = useMedialaneApp();
126
+ const walletAddress = app.walletAddress;
127
+ const { collection, isLoading } = useCollection(contract);
128
+ const tx = useTransaction();
129
+ const [done, setDone] = useState({ title: "", description: "" });
130
+ const [links, setLinks] = useState(null);
131
+ const isSubmitting = tx.phase === "preparing" || tx.phase === "submitting" || tx.phase === "confirming";
132
+ const isOwner = walletAddress && collection?.owner && normalizeAddress("STARKNET", walletAddress) === normalizeAddress("STARKNET", collection.owner);
133
+ const issue = (recipient) => {
134
+ setDone({ title: "Credential issued", description: "The credential is now in their wallet." });
135
+ void tx.run(async (signer) => {
136
+ await runIntentCalls(signer, () => app.getClient().api.intents.create("pop-manage", { owner: signer.address, collection: contract, action: "issue", recipient }));
137
+ });
138
+ };
139
+ const publish = (addresses) => {
140
+ const list = buildPopAllowlist(addresses);
141
+ const count = Object.keys(list.proofs).length;
142
+ setDone({ title: "Participants published", description: `Published ${count} participant${count !== 1 ? "s" : ""}.` });
143
+ void tx.run(async (signer) => {
144
+ await runIntentCalls(signer, () => app.getClient().api.intents.create("pop-manage", { owner: signer.address, collection: contract, action: "set_allowlist_root", root: list.root }));
145
+ }).then((ok) => {
146
+ if (ok) setLinks(popClaimLinks(window.location.origin, contract, list));
147
+ });
148
+ };
149
+ return /* @__PURE__ */ jsx(WalletRequired, { icon: Award, title: "Connect your wallet", description: "Connect to manage your event.", children: isLoading ? /* @__PURE__ */ jsxs("div", { className: "max-w-xl mx-auto px-4 pt-10 pb-16 space-y-4", children: [
150
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-24" }),
151
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-32 w-full rounded-2xl" }),
152
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-64 w-full rounded-2xl" })
153
+ ] }) : !collection ? /* @__PURE__ */ jsxs("div", { className: "max-w-xl mx-auto px-4 pt-24 pb-8 text-center space-y-4", children: [
154
+ /* @__PURE__ */ jsx(AlertCircle, { className: "h-10 w-10 text-muted-foreground/20 mx-auto" }),
155
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: "Collection not found." }),
156
+ /* @__PURE__ */ jsx(Button, { asChild: true, variant: "outline", size: "sm", children: /* @__PURE__ */ jsx(Link, { href: "/launchpad/pop", children: "\u2190 Back" }) })
157
+ ] }) : !isOwner ? /* @__PURE__ */ jsxs("div", { className: "max-w-xl mx-auto px-4 pt-24 pb-8 text-center space-y-4", children: [
158
+ /* @__PURE__ */ jsx(Award, { className: "h-10 w-10 text-muted-foreground/20 mx-auto" }),
159
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: "You are not the organizer of this event." }),
160
+ /* @__PURE__ */ jsx(Button, { asChild: true, variant: "outline", size: "sm", children: /* @__PURE__ */ jsx(Link, { href: "/launchpad/pop", children: "\u2190 Back to events" }) })
161
+ ] }) : /* @__PURE__ */ jsxs("div", { className: "max-w-xl mx-auto px-4 pt-10 pb-16 space-y-6", children: [
162
+ /* @__PURE__ */ jsx(TransactionDialog, { tx, title: "Manage event", workingLabel: "Updating your event\u2026", firstStepLabel: "Prepare", children: /* @__PURE__ */ jsx(TransactionDone, { tx, name: collection.name ?? "Event", title: done.title, description: done.description }) }),
163
+ /* @__PURE__ */ jsx(FadeIn, { children: /* @__PURE__ */ jsx(Button, { asChild: true, variant: "ghost", size: "sm", className: "-ml-2", children: /* @__PURE__ */ jsxs(Link, { href: "/launchpad/pop", children: [
164
+ /* @__PURE__ */ jsx(ArrowLeft, { className: "h-3.5 w-3.5 mr-1.5" }),
165
+ "All events"
166
+ ] }) }) }),
167
+ /* @__PURE__ */ jsx(FadeIn, { delay: 0.04, children: /* @__PURE__ */ jsxs("div", { children: [
168
+ /* @__PURE__ */ jsxs("span", { className: "pill-badge inline-flex gap-1.5 mb-2", children: [
169
+ /* @__PURE__ */ jsx(Award, { className: "h-3 w-3" }),
170
+ "Organizer"
171
+ ] }),
172
+ /* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold mt-1", children: "Manage Event" }),
173
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: collection.name ?? contract })
174
+ ] }) }),
175
+ /* @__PURE__ */ jsx(FadeIn, { delay: 0.08, children: /* @__PURE__ */ jsxs("div", { className: "bento-cell p-4 flex items-center gap-3", children: [
176
+ /* @__PURE__ */ jsx(Award, { className: "h-4 w-4 text-green-500 shrink-0" }),
177
+ /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
178
+ "Only participants on your ",
179
+ /* @__PURE__ */ jsx("strong", { className: "text-foreground", children: "published list" }),
180
+ " can claim, with the link you send them."
181
+ ] })
182
+ ] }) }),
183
+ /* @__PURE__ */ jsx(FadeIn, { delay: 0.12, children: /* @__PURE__ */ jsx(AllowlistSection, { onPublish: publish, isSubmitting, links }) }),
184
+ /* @__PURE__ */ jsx(FadeIn, { delay: 0.16, children: /* @__PURE__ */ jsx(IssueSection, { onIssue: issue, isSubmitting }) })
185
+ ] }) });
186
+ }
187
+ export {
188
+ PopManagePage
189
+ };
190
+ //# sourceMappingURL=pop-manage-page.js.map