@powerhousedao/reactor-browser 6.2.2-dev.60 → 6.2.2-dev.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -3
- package/dist/{document-operations-C6nce9dH.js → document-operations-DQfMZpj8.js} +2 -2
- package/dist/{document-operations-C6nce9dH.js.map → document-operations-DQfMZpj8.js.map} +1 -1
- package/dist/{index-DjloxNSR.d.ts → index-BV00np9e.d.ts} +8 -4
- package/dist/index-BV00np9e.d.ts.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/{renown-BZabzj4l.js → renown-6w_ImTvm.js} +36 -7
- package/dist/renown-6w_ImTvm.js.map +1 -0
- package/dist/{renown-C7a1ygsj.js → renown-DRnlawbP.js} +64 -12
- package/dist/renown-DRnlawbP.js.map +1 -0
- package/dist/src/graphql-client/entry.js +1 -1
- package/dist/src/renown/index.d.ts +2 -2
- package/dist/src/renown/index.js +3 -3
- package/package.json +9 -9
- package/dist/index-DjloxNSR.d.ts.map +0 -1
- package/dist/renown-BZabzj4l.js.map +0 -1
- package/dist/renown-C7a1ygsj.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renown-DRnlawbP.js","names":["truncateAddress","logoutUtil","subscribeNothing","styles","defaultLogout"],"sources":["../src/renown/wallet-registry.ts","../src/renown/constants.ts","../src/renown/session.ts","../src/renown/use-renown-auth.ts","../src/renown/components/icons.tsx","../src/renown/components/slot.tsx","../src/renown/components/RenownLoginButton.tsx","../src/renown/components/RenownUserButton.tsx","../src/renown/components/RenownAuthButton.tsx","../src/renown/crypto.ts","../src/renown/use-renown-session-cookie.ts","../src/renown/use-renown-init.ts","../src/renown/renown-init.tsx","../src/renown/use-complete-redirect-sign-in.ts","../src/renown/wallet-provider.tsx","../src/renown/provider.tsx","../src/renown/login-methods.ts","../src/renown/use-renown-wallet-adapter.ts"],"sourcesContent":["import type {\n WalletAdapterDescriptor,\n WalletController,\n} from \"@renown/sdk/wallet\";\n\n// Module-level registry for the active wallet controller. Connect mounts the\n// configured adapter Providers and registers the controller for useRenownAuth.\nlet activeWalletController: WalletController | undefined;\nlet controllerWaiters: Array<{\n resolve: (controller: WalletController) => void;\n reject: (error: Error) => void;\n}> = [];\nlet walletActivator: (() => Promise<WalletController>) | undefined;\nconst activatorListeners = new Set<() => void>();\n\nexport function setActiveWalletController(\n controller: WalletController | undefined,\n): void {\n activeWalletController = controller;\n if (controller) {\n const waiters = controllerWaiters;\n controllerWaiters = [];\n waiters.forEach(({ resolve }) => resolve(controller));\n }\n}\n\n// Called when activation can't produce a controller (e.g. no adapter loaded\n// because a peer dep is missing) so a pending login() rejects instead of hanging.\nexport function failWalletActivation(error: Error): void {\n const waiters = controllerWaiters;\n controllerWaiters = [];\n waiters.forEach(({ reject }) => reject(error));\n}\n\nexport function getActiveWalletController(): WalletController | undefined {\n return activeWalletController;\n}\n\n// Registered by the app's wallet-provider mount. Lets login() mount the adapter\n// Providers on demand (on click) instead of loading wallet libraries at startup.\nexport function setWalletActivator(\n activator: (() => Promise<WalletController>) | undefined,\n): void {\n if (activator === walletActivator) return;\n walletActivator = activator;\n activatorListeners.forEach((listener) => listener());\n}\n\n// The provider registers the activator in an effect, after a child hook's first\n// effect has run, so a hook that activates on mount must wait for it.\nexport function subscribeWalletActivator(listener: () => void): () => void {\n activatorListeners.add(listener);\n return () => activatorListeners.delete(listener);\n}\n\nexport function getWalletActivator():\n | (() => Promise<WalletController>)\n | undefined {\n return walletActivator;\n}\n\n// Resolves once a wallet controller is registered (after on-demand mount), or\n// rejects if activation fails (see failWalletActivation).\nexport function whenWalletControllerReady(): Promise<WalletController> {\n if (activeWalletController) return Promise.resolve(activeWalletController);\n return new Promise((resolve, reject) =>\n controllerWaiters.push({ resolve, reject }),\n );\n}\n\n// Descriptors the mounted provider snapshotted. A registry rather than context\n// because a login UI is not always inside the provider tree (see the controller).\nconst NO_DESCRIPTORS: readonly WalletAdapterDescriptor[] = Object.freeze([]);\n\ninterface DescriptorStore {\n descriptors: readonly WalletAdapterDescriptor[];\n listeners: Set<() => void>;\n}\n\n// In the global symbol registry, not a module-level `let`, so duplicate copies\n// of this package share one store.\nconst DESCRIPTOR_STORE = Symbol.for(\n \"@powerhousedao/reactor-browser:renown-wallet-descriptors\",\n);\n\n// Safe on the server: `globalThis` exists there and SSR reads the constant\n// below instead, so nothing crosses requests.\nfunction descriptorStore(): DescriptorStore {\n const host = globalThis as unknown as Record<\n symbol,\n DescriptorStore | undefined\n >;\n return (host[DESCRIPTOR_STORE] ??= {\n descriptors: NO_DESCRIPTORS,\n listeners: new Set(),\n });\n}\n\nexport function setWalletDescriptors(\n descriptors: readonly WalletAdapterDescriptor[] | undefined,\n): void {\n const store = descriptorStore();\n const next = descriptors ?? NO_DESCRIPTORS;\n if (next === store.descriptors) return;\n // Copies of this module have distinct empty sentinels; treat them as equal.\n if (next.length === 0 && store.descriptors.length === 0) return;\n store.descriptors = next;\n store.listeners.forEach((listener) => listener());\n}\n\n// Identity-stable while unchanged, so useSyncExternalStore does not loop.\nexport function getWalletDescriptors(): readonly WalletAdapterDescriptor[] {\n return descriptorStore().descriptors;\n}\n\n// No provider is mounted during a server render; a constant keeps the hydration\n// snapshot stable until the client subscribes.\nexport function getServerWalletDescriptors(): readonly WalletAdapterDescriptor[] {\n return NO_DESCRIPTORS;\n}\n\nexport function subscribeWalletDescriptors(listener: () => void): () => void {\n const { listeners } = descriptorStore();\n listeners.add(listener);\n return () => listeners.delete(listener);\n}\n\n// Per-adapter controllers, keyed by meta.id, for hosts that drive one adapter's\n// own surface (e.g. Privy's email OTP) rather than the merged controller.\ntype AdapterControllers = Readonly<Record<string, WalletController>>;\n\nconst NO_CONTROLLERS: AdapterControllers = Object.freeze({});\n\ninterface ControllerStore {\n controllers: AdapterControllers;\n listeners: Set<() => void>;\n}\n\nconst CONTROLLER_STORE = Symbol.for(\n \"@powerhousedao/reactor-browser:renown-wallet-adapter-controllers\",\n);\n\nfunction controllerStore(): ControllerStore {\n const host = globalThis as unknown as Record<\n symbol,\n ControllerStore | undefined\n >;\n return (host[CONTROLLER_STORE] ??= {\n controllers: NO_CONTROLLERS,\n listeners: new Set(),\n });\n}\n\nexport function setWalletAdapterController(\n id: string,\n controller: WalletController | undefined,\n): void {\n const store = controllerStore();\n if (store.controllers[id] === controller) return;\n const next: Record<string, WalletController> = { ...store.controllers };\n if (controller) next[id] = controller;\n else delete next[id];\n store.controllers = Object.freeze(next);\n store.listeners.forEach((listener) => listener());\n}\n\n// Identity-stable while unchanged, so useSyncExternalStore does not loop.\nexport function getWalletAdapterControllers(): AdapterControllers {\n return controllerStore().controllers;\n}\n\nexport function getServerWalletAdapterControllers(): AdapterControllers {\n return NO_CONTROLLERS;\n}\n\nexport function subscribeWalletAdapterControllers(\n listener: () => void,\n): () => void {\n const { listeners } = controllerStore();\n listeners.add(listener);\n return () => listeners.delete(listener);\n}\n","export const RENOWN_URL = \"https://www.renown.id\";\nexport const RENOWN_NETWORK_ID = \"eip155\";\nexport const RENOWN_CHAIN_ID = \"1\";\n\n// EIP-712 credential types are canonical in @renown/sdk; re-export to avoid drift.\nexport {\n CREDENTIAL_TYPES,\n DOMAIN_TYPE,\n VERIFIABLE_CREDENTIAL_EIP712_TYPE,\n CREDENTIAL_SCHEMA_EIP712_TYPE,\n CREDENTIAL_SUBJECT_TYPE,\n ISSUER_TYPE,\n} from \"@renown/sdk\";\n","import type { IRenown, User } from \"@renown/sdk\";\nimport type { WalletSession } from \"@renown/sdk/wallet\";\nimport { logger } from \"document-model\";\nimport { RENOWN_CHAIN_ID, RENOWN_NETWORK_ID, RENOWN_URL } from \"./constants.js\";\nimport {\n getActiveWalletController,\n getWalletActivator,\n} from \"./wallet-registry.js\";\n\nexport function openRenown(documentId?: string) {\n const renown = window.ph?.renown;\n let renownUrl = renown?.baseUrl;\n if (!renownUrl) {\n logger.warn(\"Renown instance not found, falling back to: @url\", RENOWN_URL);\n renownUrl = RENOWN_URL;\n }\n\n if (documentId) {\n window.open(`${renownUrl}/profile/${documentId}`, \"_blank\")?.focus();\n return;\n }\n\n const url = new URL(renownUrl);\n url.searchParams.set(\"app\", renown?.did ?? \"\");\n url.searchParams.set(\"connect\", renown?.did ?? \"\");\n url.searchParams.set(\"network\", RENOWN_NETWORK_ID);\n url.searchParams.set(\"chain\", RENOWN_CHAIN_ID);\n\n const returnUrl = new URL(window.location.pathname, window.location.origin);\n url.searchParams.set(\"returnUrl\", returnUrl.toJSON());\n window.open(url, \"_self\")?.focus();\n}\n\n// In-page Renown sign-in: signs an app-key credential with the wallet session\n// and logs in via the configured switchboard. Throws if no switchboard is set.\nasync function signIn(session: WalletSession): Promise<User | undefined> {\n const renown = window.ph?.renown;\n if (!renown) {\n logger.warn(\"Renown instance not found, cannot sign in\");\n return;\n }\n return renown.signIn({\n address: session.address,\n chainId: session.chainId,\n signTypedData: session.signTypedData,\n });\n}\n\n// Idempotent sign-in gate the explicit login and OAuth-return auto-sign both\n// funnel through, so a duplicate / in-flight / lingering trigger is a no-op.\nlet inFlightSignIn: Promise<User | undefined> | undefined;\nlet inFlightAddress: string | undefined;\nlet lastSignedAddress: string | undefined;\n\nexport async function completeSignIn(\n session: WalletSession,\n): Promise<User | undefined> {\n const { address } = session;\n if (address === lastSignedAddress) return;\n if (inFlightSignIn && address === inFlightAddress) return inFlightSignIn;\n\n inFlightAddress = address;\n inFlightSignIn = (async () => {\n try {\n const user = await signIn(session);\n if (user) lastSignedAddress = address;\n return user;\n } finally {\n inFlightSignIn = undefined;\n inFlightAddress = undefined;\n }\n })();\n return inFlightSignIn;\n}\n\n// Cleared by logout so the same address can sign in again afterward.\nfunction resetSignInGuard(): void {\n inFlightSignIn = undefined;\n inFlightAddress = undefined;\n lastSignedAddress = undefined;\n}\n\n// True while a redirect sign-in is still inbound: the DID is in the URL but\n// init has not consumed it yet, so an empty credential store is not the answer.\nexport function hasRedirectSignIn(): boolean {\n if (typeof window === \"undefined\") return false;\n return new URLSearchParams(window.location.search).has(\"user\");\n}\n\n// Reads the `?user=` DID from the URL if present, then strips the param.\nfunction consumeDidFromUrl(): string | undefined {\n if (typeof window === \"undefined\") return;\n\n const urlParams = new URLSearchParams(window.location.search);\n const userParam = urlParams.get(\"user\");\n if (!userParam) return;\n\n const userDid = decodeURIComponent(userParam);\n\n // Clean up the URL parameter\n const cleanUrl = new URL(window.location.href);\n cleanUrl.searchParams.delete(\"user\");\n window.history.replaceState({}, \"\", cleanUrl.toString());\n\n return userDid;\n}\n\n// Log in the user, resolving the DID from (in order): explicit arg, the `?user=`\n// redirect param, then the Renown instance's stored session.\nexport async function login(\n userDid: string | undefined,\n renown: IRenown | undefined,\n): Promise<User | undefined> {\n if (!renown) {\n return;\n }\n\n const did = userDid ?? consumeDidFromUrl();\n\n try {\n const user = renown.user;\n\n if (user?.did && (user.did === did || !did)) {\n return user;\n }\n\n if (!did) {\n return;\n }\n\n return await renown.login(did);\n } catch (error) {\n logger.error(\n error instanceof Error ? error.message : JSON.stringify(error),\n );\n }\n}\n\nexport async function logout() {\n // Run the adapter's own logout first (Privy clears its session) so the next\n // login can't silently resume it. Adapters mount on demand, so activate when\n // none is mounted yet; with no activator (redirect-only) there is nothing to end.\n try {\n const controller =\n getActiveWalletController() ?? (await getWalletActivator()?.());\n await controller?.disconnect();\n } catch (error) {\n logger.error(error instanceof Error ? error.message : String(error));\n }\n\n const renown = window.ph?.renown;\n await renown?.logout();\n resetSignInGuard();\n\n // Clear the user parameter from URL to prevent auto-login on refresh\n const url = new URL(window.location.href);\n if (url.searchParams.has(\"user\")) {\n url.searchParams.delete(\"user\");\n window.history.replaceState(null, \"\", url.toString());\n }\n}\n","import {\n MissingSwitchboardError,\n type LoginStatus,\n type User,\n} from \"@renown/sdk\";\nimport type { LoginMethod, WalletSession } from \"@renown/sdk/wallet\";\nimport { useCallback, useState, useSyncExternalStore } from \"react\";\nimport { useLoginStatus, useUser } from \"../hooks/renown.js\";\nimport { useRenownInitialAuth } from \"./initial-user.js\";\nimport {\n getActiveWalletController,\n getWalletActivator,\n} from \"./wallet-registry.js\";\nimport {\n completeSignIn,\n hasRedirectSignIn,\n logout as logoutUtil,\n openRenown,\n} from \"./session.js\";\n\nexport type RenownAuthStatus = LoginStatus | \"loading\";\n\nexport interface RenownAuth {\n status: RenownAuthStatus | undefined;\n user: User | undefined;\n address: string | undefined;\n ensName: string | undefined;\n avatarUrl: string | undefined;\n profileId: string | undefined;\n displayName: string | undefined;\n displayAddress: string | undefined;\n login: (session?: WalletSession, method?: LoginMethod) => void;\n pending: boolean;\n error: Error | undefined;\n logout: () => Promise<void>;\n openProfile: () => void;\n}\n\nfunction truncateAddress(address: string): string {\n if (address.length <= 13) return address;\n return `${address.slice(0, 7)}...${address.slice(-5)}`;\n}\n\n// The user dismissed the provider modal (Privy `exited_auth_flow`, an injected\n// wallet reject) — a benign cancel, not a login failure, so don't surface it.\nfunction isUserCancellation(error: Error): boolean {\n const msg = error.message.toLowerCase();\n return (\n msg.includes(\"exited_auth_flow\") ||\n msg.includes(\"user rejected\") ||\n msg.includes(\"user denied\") ||\n msg.includes(\"userrejected\") ||\n msg.includes(\"cancel\")\n );\n}\n\nfunction toRenownAuthStatus(\n loginStatus: LoginStatus | \"loading\" | undefined,\n user: User | undefined,\n): RenownAuthStatus | undefined {\n if (loginStatus === \"authorized\") {\n return user ? \"authorized\" : \"checking\";\n }\n return loginStatus;\n}\n\nexport function useRenownAuth(): RenownAuth {\n const user = useUser();\n const loginStatus = useLoginStatus();\n const [pending, setPending] = useState(false);\n const [error, setError] = useState<Error | undefined>(undefined);\n\n // syncs user with login status\n const status = toRenownAuthStatus(loginStatus, user);\n\n const address = user?.address;\n const ensName = user?.ens?.name;\n const avatarUrl = user?.profile?.userImage ?? user?.ens?.avatarUrl;\n const profileId = user?.profile?.documentId;\n\n const displayName = ensName ?? user?.profile?.username ?? undefined;\n const displayAddress = address ? truncateAddress(address) : undefined;\n\n const login = useCallback((session?: WalletSession, method?: LoginMethod) => {\n // In-page sign-in path requires a session (passed in), an already-mounted\n // controller, or an activator that mounts the adapter on demand.\n const existing = getActiveWalletController();\n const activator = getWalletActivator();\n if (!session && !existing && !activator) {\n openRenown();\n return;\n }\n setPending(true);\n setError(undefined);\n void (async () => {\n try {\n let resolved = session;\n if (!resolved) {\n // Activate on click, then re-read the freshest controller so every\n // adapter that registered (not just the first) can route `method`.\n const activated =\n existing ?? (activator ? await activator() : undefined);\n const controller = getActiveWalletController() ?? activated;\n resolved = await controller?.connect(method);\n }\n if (!resolved) {\n openRenown();\n return;\n }\n // completeSignIn throws MissingSwitchboardError when none is configured;\n // fall back to the redirect flow only in that case so login still succeeds.\n await completeSignIn(resolved);\n } catch (e) {\n const err = e instanceof Error ? e : new Error(String(e));\n // A cancel clears pending (finally) without showing a red error.\n if (isUserCancellation(err)) return;\n setError(err);\n // Only when there is nowhere to post the credential. A switchboard that\n // REJECTED it is a failure to show, not a reason to leave the page.\n if (MissingSwitchboardError.is(err)) openRenown();\n } finally {\n setPending(false);\n }\n })();\n }, []);\n\n const logout = useCallback(async () => {\n await logoutUtil();\n }, []);\n\n const openProfile = useCallback(() => {\n if (profileId) {\n openRenown(profileId);\n }\n }, [profileId]);\n\n return {\n status,\n user,\n address,\n ensName,\n avatarUrl,\n profileId,\n displayName,\n displayAddress,\n login,\n pending,\n error,\n logout,\n openProfile,\n };\n}\n\nexport type RenownAuthResolution =\n | \"authenticated\"\n | \"resolving\"\n | \"unauthenticated\";\n\nexport interface RenownAuthAsync extends RenownAuth {\n /** Collapsed routing state; \"resolving\" until auth is known. */\n state: RenownAuthResolution;\n isResolving: boolean;\n}\n\nconst subscribeNothing = () => () => {};\n\n// Auth as a resolved three-state value instead of via Suspense: renders a\n// \"resolving\" phase you can branch on, so no Suspense boundary is required.\nexport function useRenownAuthAsync(): RenownAuthAsync {\n const auth = useRenownAuth();\n const initial = useRenownInitialAuth();\n // Server + hydration read false so the markup matches; the URL is checked\n // once mounted, which is when init would consume the DID anyway.\n const redirectSignIn = useSyncExternalStore(\n subscribeNothing,\n hasRedirectSignIn,\n () => false,\n );\n const { user, status, pending } = auth;\n let state: RenownAuthResolution;\n if (user) {\n state = \"authenticated\";\n } else if (pending) {\n state = \"resolving\";\n } else if (\n initial.state === \"anonymous\" &&\n // A redirect login is inbound, so the empty store is about to change; the\n // SDK only reports \"checking\" once init has consumed the DID.\n !redirectSignIn &&\n status !== \"checking\"\n ) {\n // Nothing to restore, so the SDK build cannot change the answer — resolve\n // now instead of spinning through IndexedDB and keypair setup.\n state = \"unauthenticated\";\n } else if (\n status === undefined ||\n status === \"loading\" ||\n status === \"checking\"\n ) {\n state = \"resolving\";\n } else {\n state = \"unauthenticated\";\n }\n return { ...auth, state, isResolving: state === \"resolving\" };\n}\n","import type { CSSProperties } from \"react\";\n\ninterface IconProps {\n size?: number;\n width?: number;\n height?: number;\n color?: string;\n style?: CSSProperties;\n className?: string;\n}\n\ninterface RenownLogoProps extends IconProps {\n hovered?: boolean;\n}\n\nexport function RenownLogo({\n width = 71,\n height = 19,\n hovered = false,\n color = \"currentColor\",\n className,\n}: RenownLogoProps) {\n return (\n <svg\n width={width}\n height={height}\n viewBox=\"0 0 71 19\"\n fill={color}\n xmlns=\"http://www.w3.org/2000/svg\"\n className={className}\n >\n <path d=\"M53.6211 18.4887V9.0342H56.435V10.8096H56.4923C56.7377 10.181 57.1085 9.70244 57.6047 9.37398C58.101 9.03986 58.6981 8.8728 59.3962 8.8728C60.4105 8.8728 61.2039 9.1871 61.7765 9.8157C62.3546 10.4443 62.6436 11.3164 62.6436 12.432V18.4887H59.7397V13.0776C59.7397 12.5283 59.6007 12.1007 59.3225 11.7949C59.0499 11.4835 58.6654 11.3277 58.1692 11.3277C57.6784 11.3277 57.2803 11.4976 56.9749 11.8374C56.6695 12.1772 56.5168 12.6161 56.5168 13.1541V18.4887H53.6211Z\" />\n <path d=\"M53.097 9.03394L50.7412 18.4884H47.6164L46.1522 12.075H46.0949L44.6389 18.4884H41.5632L39.1992 9.03394H42.1195L43.3056 15.7532H43.3628L44.7861 9.03394H47.551L48.9906 15.7532H49.0479L50.234 9.03394H53.097Z\" />\n <path d=\"M37.8661 17.3926C37.0427 18.2591 35.9084 18.6923 34.4632 18.6923C33.0181 18.6923 31.8838 18.2591 31.0604 17.3926C30.2369 16.5205 29.8252 15.3086 29.8252 13.7569C29.8252 12.2336 30.2424 11.033 31.0767 10.1552C31.9111 9.2718 33.0399 8.83008 34.4632 8.83008C35.892 8.83008 37.0208 9.26896 37.8497 10.1467C38.6841 11.0188 39.1013 12.2222 39.1013 13.7569C39.1013 15.3143 38.6896 16.5262 37.8661 17.3926ZM33.2117 15.7702C33.5116 16.2402 33.9288 16.4752 34.4632 16.4752C34.9977 16.4752 35.4148 16.2402 35.7148 15.7702C36.0147 15.2945 36.1647 14.6234 36.1647 13.7569C36.1647 12.9131 36.012 12.2506 35.7066 11.7692C35.4012 11.2878 34.9868 11.0472 34.4632 11.0472C33.9343 11.0472 33.5171 11.2878 33.2117 11.7692C32.9118 12.2449 32.7618 12.9075 32.7618 13.7569C32.7618 14.6234 32.9118 15.2945 33.2117 15.7702Z\" />\n <path d=\"M20.0088 18.4887V9.0342H22.8227V10.8096H22.88C23.1254 10.181 23.4962 9.70244 23.9924 9.37398C24.4887 9.03986 25.0858 8.8728 25.7838 8.8728C26.7982 8.8728 27.5916 9.1871 28.1642 9.8157C28.7423 10.4443 29.0313 11.3164 29.0313 12.432V18.4887H26.1274V13.0776C26.1274 12.5283 25.9883 12.1007 25.7102 11.7949C25.4376 11.4835 25.0531 11.3277 24.5569 11.3277C24.0661 11.3277 23.668 11.4976 23.3626 11.8374C23.0572 12.1772 22.9045 12.6161 22.9045 13.1541V18.4887H20.0088Z\" />\n <path d=\"M14.7486 10.9707C14.2851 10.9707 13.8952 11.1321 13.5789 11.4549C13.2626 11.7777 13.0854 12.1911 13.0472 12.6951H16.4337C16.4064 12.1741 16.2374 11.7579 15.9265 11.4464C15.6212 11.1293 15.2285 10.9707 14.7486 10.9707ZM16.4991 15.5153H19.1167C18.9749 16.4837 18.5141 17.2567 17.7343 17.8343C16.9599 18.4063 15.9838 18.6923 14.8059 18.6923C13.3662 18.6923 12.2374 18.2591 11.4194 17.3926C10.6014 16.5262 10.1924 15.3313 10.1924 13.8079C10.1924 12.2845 10.5987 11.0755 11.4112 10.1807C12.2237 9.28029 13.3226 8.83008 14.7077 8.83008C16.0656 8.83008 17.1481 9.26047 17.9552 10.1213C18.7677 10.9764 19.174 12.1231 19.174 13.5616V14.4195H13.0145V14.6064C13.0145 15.184 13.1835 15.6541 13.5216 16.0165C13.8597 16.3733 14.3015 16.5517 14.8468 16.5517C15.2503 16.5517 15.5993 16.461 15.8938 16.2798C16.1883 16.0929 16.3901 15.8381 16.4991 15.5153Z\" />\n <path d=\"M3.00205 8.58396V12.0667H4.7771C5.32789 12.0667 5.7587 11.911 6.06954 11.5995C6.38038 11.2881 6.5358 10.8662 6.5358 10.3338C6.5358 9.80718 6.37492 9.38528 6.05318 9.06815C5.73143 8.74535 5.30335 8.58396 4.76892 8.58396H3.00205ZM3.00205 14.1989V18.4886H0V6.23096H5.07158C6.53307 6.23096 7.65373 6.5849 8.43355 7.29278C9.21337 8.00066 9.60328 8.99453 9.60328 10.2744C9.60328 11.0446 9.42605 11.7439 9.07159 12.3725C8.71712 12.9955 8.2236 13.4514 7.59101 13.7402L9.94684 18.4886H6.5767L4.55624 14.1989H3.00205Z\" />\n <path\n d=\"M65.7255 0.211478C65.0841 2.46724 63.3737 4.2455 61.2041 4.90969C60.932 4.99366 60.932 5.39096 61.2041 5.47492C63.3725 6.13912 65.0841 7.91738 65.7255 10.1731C65.8056 10.4551 66.1932 10.4551 66.2745 10.1731C66.9159 7.91738 68.6263 6.13912 70.7959 5.47492C71.068 5.39096 71.068 4.99366 70.7959 4.90969C68.6276 4.2455 66.9159 2.46724 66.2745 0.211478C66.1944 -0.0704925 65.8068 -0.0704925 65.7255 0.211478Z\"\n fill={hovered ? \"#21FFB4\" : color}\n />\n </svg>\n );\n}\n\nexport function CopyIcon({\n size = 14,\n color = \"var(--muted-foreground, #9EA0A1)\",\n}: IconProps) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <rect\n x=\"5\"\n y=\"5\"\n width=\"9\"\n height=\"9\"\n rx=\"1\"\n stroke={color}\n strokeWidth=\"1.5\"\n />\n <path\n d=\"M11 5V3C11 2.44772 10.5523 2 10 2H3C2.44772 2 2 2.44772 2 3V10C2 10.5523 2.44772 11 3 11H5\"\n stroke={color}\n strokeWidth=\"1.5\"\n />\n </svg>\n );\n}\n\nexport function DisconnectIcon({\n size = 14,\n color = \"var(--destructive, #EA4335)\",\n}: IconProps) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M6 14H3.33333C2.97971 14 2.64057 13.8595 2.39052 13.6095C2.14048 13.3594 2 13.0203 2 12.6667V3.33333C2 2.97971 2.14048 2.64057 2.39052 2.39052C2.64057 2.14048 2.97971 2 3.33333 2H6\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M10.6667 11.3333L14 8L10.6667 4.66667\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M14 8H6\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n\nexport function SpinnerIcon({ size = 14, color = \"currentColor\" }: IconProps) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n style={{ animation: \"spin 1s linear infinite\" }}\n >\n <style>{`@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }`}</style>\n <path d=\"M8 1V4\" stroke={color} strokeWidth=\"1.5\" strokeLinecap=\"round\" />\n <path\n d=\"M8 12V15\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n opacity=\"0.3\"\n />\n <path\n d=\"M3.05 3.05L5.17 5.17\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n opacity=\"0.9\"\n />\n <path\n d=\"M10.83 10.83L12.95 12.95\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n opacity=\"0.4\"\n />\n <path\n d=\"M1 8H4\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n opacity=\"0.8\"\n />\n <path\n d=\"M12 8H15\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n opacity=\"0.5\"\n />\n <path\n d=\"M3.05 12.95L5.17 10.83\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n opacity=\"0.7\"\n />\n <path\n d=\"M10.83 5.17L12.95 3.05\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n opacity=\"0.6\"\n />\n </svg>\n );\n}\n\nexport function ChevronDownIcon({\n size = 14,\n color = \"currentColor\",\n style,\n}: IconProps) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n style={style}\n >\n <path\n d=\"M4 6L8 10L12 6\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n\nexport function UserIcon({ size = 24, color = \"#6366f1\" }: IconProps) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle cx=\"12\" cy=\"8\" r=\"4\" stroke={color} strokeWidth=\"2\" />\n <path\n d=\"M4 20C4 16.6863 7.58172 14 12 14C16.4183 14 20 16.6863 20 20\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n />\n </svg>\n );\n}\n","import {\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n type Ref,\n Children,\n cloneElement,\n forwardRef,\n isValidElement,\n} from \"react\";\n\ntype AnyProps = Record<string, unknown>;\n\nfunction mergeProps(parentProps: AnyProps, childProps: AnyProps): AnyProps {\n const merged: AnyProps = { ...parentProps };\n\n for (const key of Object.keys(childProps)) {\n const parentValue = parentProps[key];\n const childValue = childProps[key];\n\n if (key === \"style\") {\n merged[key] = { ...(parentValue as object), ...(childValue as object) };\n } else if (key === \"className\") {\n merged[key] = [parentValue, childValue].filter(Boolean).join(\" \");\n } else if (\n typeof parentValue === \"function\" &&\n typeof childValue === \"function\"\n ) {\n merged[key] = (...args: unknown[]) => {\n (childValue as (...a: unknown[]) => void)(...args);\n (parentValue as (...a: unknown[]) => void)(...args);\n };\n } else if (childValue !== undefined) {\n merged[key] = childValue;\n }\n }\n\n return merged;\n}\n\ninterface SlotProps extends HTMLAttributes<HTMLElement> {\n children?: ReactNode;\n ref?: Ref<HTMLElement>;\n}\n\nexport const Slot = forwardRef<HTMLElement, SlotProps>(\n ({ children, ...props }, ref) => {\n const child = Children.only(children);\n\n if (!isValidElement(child)) {\n return null;\n }\n\n const childElement = child as ReactElement<AnyProps>;\n const mergedProps = mergeProps(props, childElement.props);\n\n if (ref) {\n mergedProps.ref = ref;\n }\n\n return cloneElement(childElement, mergedProps);\n },\n);\n\nSlot.displayName = \"Slot\";\n","import type { CSSProperties, ReactNode } from \"react\";\nimport { useCallback, useState } from \"react\";\nimport { openRenown } from \"../session.js\";\nimport { SpinnerIcon } from \"./icons.js\";\nimport { Slot } from \"./slot.js\";\n\nexport interface RenownLoginButtonProps {\n onLogin?: () => void;\n darkMode?: boolean;\n style?: CSSProperties;\n className?: string;\n asChild?: boolean;\n children?: ReactNode;\n}\n\nconst colorStyles = {\n trigger: {\n backgroundColor: \"var(--card, #ffffff)\",\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"var(--border, #d1d5db)\",\n color: \"var(--card-foreground, #111827)\",\n },\n triggerHover: {\n backgroundColor: \"var(--accent, #ecf3f8)\",\n borderColor: \"var(--border, #d1d5db)\",\n },\n} as const;\n\nconst styles: Record<string, CSSProperties> = {\n wrapper: {\n position: \"relative\",\n display: \"inline-block\",\n },\n trigger: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: \"8px\",\n padding: \"8px 32px\",\n borderRadius: \"8px\",\n cursor: \"pointer\",\n fontSize: \"14px\",\n fontWeight: 500,\n fontFamily: \"inherit\",\n lineHeight: \"20px\",\n transition: \"background-color 150ms, border-color 150ms\",\n },\n};\n\nexport function RenownLoginButton({\n onLogin: onLoginProp,\n style,\n className,\n asChild = false,\n children,\n}: RenownLoginButtonProps) {\n const onLogin = onLoginProp ?? (() => openRenown());\n const [isLoading, setIsLoading] = useState(false);\n const [isHovered, setIsHovered] = useState(false);\n\n const handleMouseEnter = useCallback(() => setIsHovered(true), []);\n const handleMouseLeave = useCallback(() => setIsHovered(false), []);\n\n const handleClick = () => {\n if (!isLoading) {\n setIsLoading(true);\n onLogin();\n }\n };\n\n const themeStyles = colorStyles;\n\n const triggerStyle: CSSProperties = {\n ...styles.trigger,\n ...themeStyles.trigger,\n ...(isHovered && !isLoading ? themeStyles.triggerHover : {}),\n cursor: isLoading ? \"wait\" : \"pointer\",\n ...style,\n };\n\n const triggerElement = asChild ? (\n <Slot\n onClick={handleClick}\n data-renown-state=\"login\"\n {...(isLoading ? { \"data-loading\": \"\" } : {})}\n >\n {children}\n </Slot>\n ) : (\n <button\n type=\"button\"\n style={triggerStyle}\n aria-label=\"Log in with Renown\"\n onClick={handleClick}\n data-renown-state=\"login\"\n {...(isLoading ? { \"data-loading\": \"\" } : {})}\n >\n {isLoading ? <SpinnerIcon size={16} /> : <span>Log in</span>}\n </button>\n );\n\n return (\n <div\n style={styles.wrapper}\n className={className}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n {triggerElement}\n </div>\n );\n}\n","import type { CSSProperties, ReactNode } from \"react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { useUser } from \"../../hooks/renown.js\";\nimport { logout as defaultLogout, openRenown } from \"../session.js\";\nimport {\n ChevronDownIcon,\n CopyIcon,\n DisconnectIcon,\n UserIcon,\n} from \"./icons.js\";\nimport { Slot } from \"./slot.js\";\n\nconst POPOVER_GAP = 4;\nconst POPOVER_HEIGHT = 150;\n\nexport interface RenownUserButtonMenuItem {\n label: string;\n icon?: ReactNode;\n onClick: () => void;\n style?: CSSProperties;\n}\n\nexport interface RenownUserButtonProps {\n address?: string;\n username?: string;\n avatarUrl?: string;\n userId?: string;\n onDisconnect?: () => void;\n style?: CSSProperties;\n className?: string;\n asChild?: boolean;\n children?: ReactNode;\n menuItems?: RenownUserButtonMenuItem[];\n}\n\nconst styles: Record<string, CSSProperties> = {\n wrapper: {\n position: \"relative\",\n display: \"inline-block\",\n },\n trigger: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"8px\",\n padding: \"6px 12px\",\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"var(--border, #e5e7eb)\",\n backgroundColor: \"var(--card, #ffffff)\",\n cursor: \"pointer\",\n borderRadius: \"8px\",\n fontSize: \"12px\",\n fontWeight: 500,\n fontFamily: \"inherit\",\n color: \"var(--card-foreground, #111827)\",\n transition: \"background-color 150ms, border-color 150ms\",\n },\n triggerHover: {\n backgroundColor: \"var(--accent, #f3f4f6)\",\n borderColor: \"var(--border, #e5e7eb)\",\n },\n avatar: {\n width: \"28px\",\n height: \"28px\",\n borderRadius: \"50%\",\n objectFit: \"cover\",\n flexShrink: 0,\n },\n avatarPlaceholder: {\n width: \"28px\",\n height: \"28px\",\n borderRadius: \"50%\",\n background: \"linear-gradient(135deg, #8b5cf6, #3b82f6)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n flexShrink: 0,\n },\n avatarInitial: {\n fontSize: \"12px\",\n fontWeight: 700,\n color: \"#ffffff\",\n lineHeight: 1,\n },\n displayName: {\n maxWidth: \"120px\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n },\n chevron: {\n flexShrink: 0,\n transition: \"transform 150ms\",\n color: \"var(--muted-foreground, #6b7280)\",\n },\n chevronOpen: {\n transform: \"rotate(180deg)\",\n },\n popoverBase: {\n position: \"absolute\",\n right: 0,\n backgroundColor: \"var(--popover, #ffffff)\",\n borderRadius: \"8px\",\n boxShadow: \"0 4px 12px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08)\",\n width: \"100%\",\n zIndex: 1000,\n color: \"var(--popover-foreground, #111827)\",\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"var(--border, #e5e7eb)\",\n overflow: \"hidden\",\n },\n header: {\n padding: \"12px 16px\",\n borderBottom: \"1px solid var(--border, #e5e7eb)\",\n },\n headerUsername: {\n fontSize: \"14px\",\n fontWeight: 600,\n color: \"var(--foreground, #111827)\",\n margin: 0,\n },\n addressRow: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"4px\",\n marginTop: \"4px\",\n },\n addressButton: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"4px\",\n padding: 0,\n border: \"none\",\n backgroundColor: \"transparent\",\n cursor: \"pointer\",\n fontSize: \"12px\",\n color: \"var(--muted-foreground, #6b7280)\",\n fontFamily: \"inherit\",\n position: \"relative\",\n width: \"100%\",\n },\n copiedText: {\n fontSize: \"12px\",\n color: \"var(--success, #059669)\",\n position: \"absolute\",\n left: 0,\n transition: \"opacity 150ms\",\n fontWeight: 500,\n },\n addressText: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"4px\",\n transition: \"opacity 150ms\",\n },\n menuSection: {\n padding: \"4px 0\",\n },\n menuItem: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"8px\",\n width: \"100%\",\n padding: \"8px 16px\",\n border: \"none\",\n backgroundColor: \"transparent\",\n cursor: \"pointer\",\n fontSize: \"14px\",\n color: \"var(--foreground, #111827)\",\n textDecoration: \"none\",\n fontFamily: \"inherit\",\n transition: \"background-color 150ms\",\n },\n menuItemHover: {\n backgroundColor: \"var(--accent, #f3f4f6)\",\n },\n disconnectItem: {\n color: \"var(--destructive, #dc2626)\",\n },\n separator: {\n height: \"1px\",\n backgroundColor: \"var(--border, #e5e7eb)\",\n margin: 0,\n border: \"none\",\n },\n};\n\nfunction truncateAddress(address: string): string {\n if (address.length <= 13) return address;\n return `${address.slice(0, 7)}...${address.slice(-5)}`;\n}\n\nexport function RenownUserButton({\n address: addressProp,\n username: usernameProp,\n avatarUrl: avatarUrlProp,\n userId: userIdProp,\n onDisconnect: onDisconnectProp,\n style,\n className,\n asChild = false,\n children,\n menuItems,\n}: RenownUserButtonProps) {\n const user = useUser();\n\n const address = addressProp ?? user?.address ?? \"\";\n const username = usernameProp ?? user?.profile?.username ?? user?.ens?.name;\n const avatarUrl =\n avatarUrlProp ?? user?.profile?.userImage ?? user?.ens?.avatarUrl;\n const userId = userIdProp ?? user?.profile?.documentId;\n const onDisconnect = onDisconnectProp ?? (() => void defaultLogout());\n const displayName =\n username ?? (address ? truncateAddress(address) : \"Account\");\n const profileId = userId ?? address;\n\n const [isOpen, setIsOpen] = useState(false);\n const [isHovered, setIsHovered] = useState(false);\n const [isCopied, setIsCopied] = useState(false);\n const [showAbove, setShowAbove] = useState(true);\n const [hoveredItem, setHoveredItem] = useState<string | null>(null);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const closeTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const calculatePosition = useCallback(() => {\n if (!wrapperRef.current) return;\n const rect = wrapperRef.current.getBoundingClientRect();\n const spaceAbove = rect.top;\n setShowAbove(spaceAbove >= POPOVER_HEIGHT + POPOVER_GAP);\n }, []);\n\n const handleMouseEnter = useCallback(() => {\n setIsHovered(true);\n if (closeTimeoutRef.current) {\n clearTimeout(closeTimeoutRef.current);\n closeTimeoutRef.current = null;\n }\n calculatePosition();\n setIsOpen(true);\n }, [calculatePosition]);\n\n const handleMouseLeave = useCallback(() => {\n closeTimeoutRef.current = setTimeout(() => {\n setIsOpen(false);\n setIsHovered(false);\n setHoveredItem(null);\n }, 150);\n }, []);\n\n useEffect(() => {\n return () => {\n if (closeTimeoutRef.current) {\n clearTimeout(closeTimeoutRef.current);\n }\n };\n }, []);\n\n const copyToClipboard = useCallback(async () => {\n try {\n await navigator.clipboard.writeText(address);\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), 2000);\n } catch (err) {\n console.error(\"Failed to copy address:\", err);\n }\n }, [address]);\n\n const triggerElement = asChild ? (\n <Slot data-renown-state=\"authenticated\">{children}</Slot>\n ) : (\n <button\n type=\"button\"\n style={{\n ...styles.trigger,\n ...(isHovered ? styles.triggerHover : {}),\n ...style,\n }}\n aria-label=\"Open account menu\"\n data-renown-state=\"authenticated\"\n >\n {avatarUrl ? (\n <img src={avatarUrl} alt=\"Avatar\" style={styles.avatar} />\n ) : (\n <div style={styles.avatarPlaceholder}>\n <span style={styles.avatarInitial}>\n {(displayName || \"U\")[0].toUpperCase()}\n </span>\n </div>\n )}\n <span style={styles.displayName}>{displayName}</span>\n <ChevronDownIcon\n size={14}\n style={{\n ...styles.chevron,\n ...(isOpen ? styles.chevronOpen : {}),\n }}\n />\n </button>\n );\n\n return (\n <div\n ref={wrapperRef}\n style={styles.wrapper}\n className={className}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n {triggerElement}\n {isOpen && (\n <div\n style={{\n ...styles.popoverBase,\n ...(showAbove\n ? { bottom: `calc(100% + ${POPOVER_GAP}px)` }\n : { top: `calc(100% + ${POPOVER_GAP}px)` }),\n }}\n >\n <div style={styles.header}>\n {username && <div style={styles.headerUsername}>{username}</div>}\n {address && (\n <div style={styles.addressRow}>\n <button\n type=\"button\"\n onClick={() => void copyToClipboard()}\n style={styles.addressButton}\n >\n <div\n style={{\n position: \"relative\",\n display: \"flex\",\n alignItems: \"center\",\n gap: \"4px\",\n width: \"100%\",\n }}\n >\n <div\n style={{\n ...styles.addressText,\n opacity: isCopied ? 0 : 1,\n }}\n >\n <span>{truncateAddress(address)}</span>\n <CopyIcon\n size={12}\n color=\"var(--muted-foreground, #9ca3af)\"\n />\n </div>\n <div\n style={{\n ...styles.copiedText,\n opacity: isCopied ? 1 : 0,\n }}\n >\n Copied!\n </div>\n </div>\n </button>\n </div>\n )}\n </div>\n <div style={styles.menuSection}>\n {profileId && (\n <button\n type=\"button\"\n onClick={() => openRenown(profileId)}\n onMouseEnter={() => setHoveredItem(\"profile\")}\n onMouseLeave={() => setHoveredItem(null)}\n style={{\n ...styles.menuItem,\n ...(hoveredItem === \"profile\" ? styles.menuItemHover : {}),\n }}\n >\n <UserIcon size={14} color=\"var(--muted-foreground, #6b7280)\" />\n View Profile\n </button>\n )}\n {menuItems?.map((item) => (\n <button\n key={item.label}\n type=\"button\"\n onClick={item.onClick}\n onMouseEnter={() => setHoveredItem(item.label)}\n onMouseLeave={() => setHoveredItem(null)}\n style={{\n ...styles.menuItem,\n ...(hoveredItem === item.label ? styles.menuItemHover : {}),\n ...item.style,\n }}\n >\n {item.icon}\n {item.label}\n </button>\n ))}\n </div>\n <hr style={styles.separator} />\n <div style={styles.menuSection}>\n <button\n type=\"button\"\n onClick={onDisconnect}\n onMouseEnter={() => setHoveredItem(\"disconnect\")}\n onMouseLeave={() => setHoveredItem(null)}\n style={{\n ...styles.menuItem,\n ...styles.disconnectItem,\n ...(hoveredItem === \"disconnect\" ? styles.menuItemHover : {}),\n }}\n >\n <DisconnectIcon size={14} color=\"var(--destructive, #dc2626)\" />\n Log out\n </button>\n </div>\n </div>\n )}\n </div>\n );\n}\n","import type { ReactNode } from \"react\";\nimport { type RenownAuth, useRenownAuth } from \"../use-renown-auth.js\";\nimport { RenownLoginButton } from \"./RenownLoginButton.js\";\nimport { RenownUserButton } from \"./RenownUserButton.js\";\n\nexport interface RenownAuthButtonProps {\n className?: string;\n darkMode?: boolean;\n loginContent?: ReactNode;\n userContent?: ReactNode;\n loadingContent?: ReactNode;\n children?: (auth: RenownAuth) => ReactNode;\n}\n\nexport function RenownAuthButton({\n className = \"\",\n darkMode,\n loginContent,\n userContent,\n loadingContent,\n children,\n}: RenownAuthButtonProps) {\n const auth = useRenownAuth();\n\n if (children) {\n return <>{children(auth)}</>;\n }\n\n if (auth.status === \"loading\" || auth.status === \"checking\") {\n if (loadingContent) {\n return <div className={className}>{loadingContent}</div>;\n }\n\n return (\n <div className={className}>\n <div\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: \"8px\",\n padding: \"6px 12px\",\n borderRadius: \"8px\",\n border: \"1px solid var(--border, #f0f0f0)\",\n animation: \"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite\",\n }}\n >\n <div\n style={{\n width: \"28px\",\n height: \"28px\",\n borderRadius: \"50%\",\n backgroundColor: \"var(--secondary, #f0f0f0)\",\n }}\n />\n <div\n style={{\n width: \"80px\",\n height: \"14px\",\n borderRadius: \"4px\",\n backgroundColor: \"var(--secondary, #f0f0f0)\",\n }}\n />\n </div>\n <style>{`@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }`}</style>\n </div>\n );\n }\n\n if (auth.status === \"authorized\") {\n if (userContent) {\n return <div className={className}>{userContent}</div>;\n }\n\n return (\n <div className={className}>\n <RenownUserButton />\n </div>\n );\n }\n\n if (loginContent) {\n return <div className={className}>{loginContent}</div>;\n }\n\n return (\n <div className={className}>\n <RenownLoginButton darkMode={darkMode} />\n </div>\n );\n}\n","import { BrowserKeyStorage, RenownCryptoBuilder } from \"@renown/sdk\";\n\n/**\n * @deprecated Use {@link initRenownCrypto} instead\n *\n * Initialize ConnectCrypto\n * @returns ConnectCrypto instance\n */\nexport async function initConnectCrypto() {\n return initRenownCrypto();\n}\n\n/**\n * Initialize RenownCrypto\n * @returns RenownCrypto instance\n */\nexport async function initRenownCrypto() {\n const keyStorage = await BrowserKeyStorage.create();\n return await new RenownCryptoBuilder().withKeyPairStorage(keyStorage).build();\n}\n","\"use client\";\n\nimport type { RenownSessionProfile } from \"@renown/sdk\";\nimport { createContext, useContext, useEffect, useRef, useState } from \"react\";\nimport { useRenown } from \"../hooks/renown.js\";\nimport { useRenownAuth } from \"./use-renown-auth.js\";\n\nconst DEFAULT_ENDPOINT = \"/api/renown/session\";\nconst DEFAULT_EXPIRES_IN = 7 * 24 * 60 * 60; // 7 days, in seconds\n\nexport interface RenownSessionCookieOptions {\n /** Route handler that sets (POST) / clears (DELETE) the session cookie. */\n endpoint?: string;\n /** Bearer-token lifetime in seconds (default 7 days). */\n expiresIn?: number;\n /** When false the hook is inert (client-only apps with no server cookie). */\n enabled?: boolean;\n}\n\nexport interface RenownSessionCookieState {\n /** True once the cookie reflects the current authenticated user. */\n synced: boolean;\n}\n\n// Mirrors Renown auth into a server-readable session cookie: mints a bearer\n// token on login and POSTs it; DELETEs on logout. Mount inside the provider.\nexport function useRenownSessionCookie(\n options: RenownSessionCookieOptions = {},\n): RenownSessionCookieState {\n const endpoint = options.endpoint ?? DEFAULT_ENDPOINT;\n const expiresIn = options.expiresIn ?? DEFAULT_EXPIRES_IN;\n const enabled = options.enabled ?? true;\n const { user, displayName, avatarUrl } = useRenownAuth();\n const renown = useRenown();\n const address = user?.address;\n const profile = user?.profile;\n // Whether a prior render was authenticated, so we only DELETE on real logout\n // (not on an unauthenticated first load, which must not clobber the cookie).\n const hadUser = useRef(false);\n const [synced, setSynced] = useState(false);\n\n useEffect(() => {\n if (!enabled) return;\n const ready = !!renown && typeof renown.getBearerToken === \"function\";\n if (address && ready) {\n hadUser.current = true;\n setSynced(false);\n let cancelled = false;\n void (async () => {\n try {\n const token = await renown!.getBearerToken({ expiresIn });\n await fetch(endpoint, {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({\n token,\n // The richer fields let verifyRenownSession seed a `user.profile`\n // matching this one, so SSR renders the same identity.\n profile: {\n name: displayName ?? null,\n avatar: avatarUrl ?? null,\n documentId: profile?.documentId ?? null,\n username: profile?.username ?? null,\n userImage: profile?.userImage ?? null,\n } satisfies RenownSessionProfile,\n }),\n });\n if (!cancelled) setSynced(true);\n } catch (error) {\n console.error(\"Failed to sync Renown session cookie\", error);\n }\n })();\n return () => {\n cancelled = true;\n };\n }\n if (!address) {\n setSynced(false);\n if (hadUser.current) {\n hadUser.current = false;\n void fetch(endpoint, { method: \"DELETE\" }).catch(() => {});\n }\n }\n }, [\n address,\n displayName,\n avatarUrl,\n profile?.documentId,\n profile?.username,\n profile?.userImage,\n renown,\n endpoint,\n expiresIn,\n enabled,\n ]);\n\n return { synced };\n}\n\nconst RenownSessionSyncedContext = createContext(false);\nexport { RenownSessionSyncedContext };\n\n// True once the session cookie reflects the current authenticated user — gate a\n// post-login navigation on this so the server-side proxy sees the cookie.\nexport function useRenownSessionSynced(): boolean {\n return useContext(RenownSessionSyncedContext);\n}\n","import type { IRenown } from \"@renown/sdk\";\nimport { RenownBuilder } from \"@renown/sdk\";\nimport { useEffect, useRef } from \"react\";\nimport { loading } from \"../hooks/loading.js\";\nimport { addRenownEventHandler, setRenown } from \"../hooks/renown.js\";\nimport { login } from \"./session.js\";\n\nexport interface RenownInitOptions {\n appName: string;\n /** Prefix for localStorage keys, so multiple apps can share a domain. */\n namespace?: string;\n url?: string;\n switchboardUrl?: string;\n /** Re-check the restored credential against the source (default \"always\"). */\n revalidate?: \"always\" | \"never\";\n /** Chain id credentials are issued on (default 1). It is part of the user's DID, so sign-in from a wallet on another chain is rejected. */\n chainId?: number;\n}\n\nasync function initRenown(\n appName: string,\n namespace: string | undefined,\n url: string | undefined,\n switchboardUrl: string | undefined,\n revalidate: \"always\" | \"never\",\n chainId: number | undefined,\n): Promise<IRenown> {\n addRenownEventHandler();\n setRenown(loading);\n\n const builder = new RenownBuilder(appName, {\n basename: namespace,\n baseUrl: url,\n switchboardUrl,\n revalidate,\n chainId,\n });\n // Browser build() fires a non-blocking credential revalidate (when enabled)\n // plus a profile refresh; init stays optimistic either way.\n const renown = await builder.build();\n setRenown(renown);\n\n await login(undefined, renown);\n\n return renown;\n}\n\n/**\n * Hook that initializes the Renown SDK.\n * Call once at the top of your app. Options are read only on first mount.\n * Returns a promise that resolves with the Renown instance.\n *\n * @example\n * ```tsx\n * function App() {\n * const renownPromise = useRenownInit({ appName: \"my-app\" });\n * return <MyApp />;\n * }\n * ```\n */\nexport function useRenownInit({\n appName,\n namespace,\n url,\n switchboardUrl,\n revalidate = \"always\",\n chainId,\n}: RenownInitOptions): Promise<IRenown> {\n // Stable promise returned every render; resolved later by the init effect.\n const promiseRef = useRef<PromiseWithResolvers<IRenown> | null>(null);\n promiseRef.current ??= Promise.withResolvers<IRenown>();\n\n const initRef = useRef(false);\n\n // Init must run in an effect, not during render: setRenown() mutates the\n // useSyncExternalStore-backed store, which would update subscribers mid-render.\n useEffect(() => {\n if (initRef.current) return;\n initRef.current = true;\n\n initRenown(appName, namespace, url, switchboardUrl, revalidate, chainId)\n .then(promiseRef.current!.resolve)\n .catch(promiseRef.current!.reject);\n }, []);\n\n return promiseRef.current.promise;\n}\n","import { type RenownInitOptions, useRenownInit } from \"./use-renown-init.js\";\n\nexport interface RenownProps extends RenownInitOptions {\n onError?: (error: unknown) => void;\n}\n\n/**\n * Side-effect component that initializes the Renown SDK.\n * Renders nothing — place it alongside your app tree.\n *\n * @example\n * ```tsx\n * function App() {\n * return (\n * <>\n * <Renown appName=\"my-app\" onError={console.error} />\n * <MyApp />\n * </>\n * );\n * }\n * ```\n */\nexport function Renown({ onError, ...initOptions }: RenownProps) {\n useRenownInit(initOptions).catch(onError ?? console.error);\n return null;\n}\n","import type { WalletAdapterMeta, WalletSession } from \"@renown/sdk/wallet\";\nimport { isWalletRedirectReturn } from \"@renown/sdk/wallet\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { logger } from \"document-model\";\nimport { useRenown, useUser } from \"../hooks/renown.js\";\nimport { completeSignIn } from \"./session.js\";\n\nexport interface CompleteRedirectSignIn {\n /** Session sink for the adapter bridges; a silent session arms auto sign-in. */\n onSession: (id: string, session: WalletSession | undefined) => void;\n}\n\n// Completes Renown sign-in from the session an adapter pushes on a full-page\n// OAuth return (the original connect() promise died with the pre-redirect page).\nexport function useCompleteRedirectSignIn(\n metas: WalletAdapterMeta[],\n): CompleteRedirectSignIn {\n const renown = useRenown();\n const user = useUser();\n // Latest adapter session that can sign silently (Privy embedded wallet). Non-\n // silent sessions (injected wallets) never auto-sign — that'd pop a prompt.\n const [pendingSilentSession, setPendingSilentSession] =\n useState<WalletSession | null>(null);\n // Arm auto sign-in for the OAuth redirect return only, consumed once. A silent\n // session that lingers after logout must NOT hijack an explicit wallet login.\n const oauthReturnRef = useRef(\n typeof window !== \"undefined\" &&\n isWalletRedirectReturn(window.location.search, metas),\n );\n\n const onSession = useCallback(\n (_id: string, session: WalletSession | undefined) => {\n setPendingSilentSession(session?.canSignSilently ? session : null);\n },\n [],\n );\n\n // Complete sign-in from the session Privy pushes on an OAuth return, once the\n // SDK is ready; disarm as soon as it's handled or a user is present.\n useEffect(() => {\n if (!oauthReturnRef.current) return;\n if (user) {\n oauthReturnRef.current = false;\n return;\n }\n if (!pendingSilentSession || !renown) return;\n oauthReturnRef.current = false;\n void Promise.resolve(completeSignIn(pendingSilentSession)).catch(\n (error: unknown) =>\n logger.error(error instanceof Error ? error.message : String(error)),\n );\n }, [pendingSilentSession, renown, user]);\n\n return { onSession };\n}\n","import { isWalletRedirectReturn, resolveAdapters } from \"@renown/sdk/wallet\";\nimport type {\n LoginMethod,\n WalletAdapter,\n WalletAdapterDescriptor,\n WalletAdapterMeta,\n WalletController,\n WalletSession,\n WalletTheme,\n} from \"@renown/sdk/wallet\";\nimport {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ComponentType,\n type ReactNode,\n} from \"react\";\nimport {\n failWalletActivation,\n setActiveWalletController,\n setWalletActivator,\n setWalletAdapterController,\n setWalletDescriptors,\n whenWalletControllerReady,\n} from \"./wallet-registry.js\";\nimport { useCompleteRedirectSignIn } from \"./use-complete-redirect-sign-in.js\";\n\n// A live controller paired with the meta that declares which methods it serves.\ninterface MountedAdapter {\n meta: WalletAdapterMeta;\n controller: WalletController;\n}\n\n// Merge per-adapter controllers into one. A requested method routes to the\n// adapter whose meta declares it; a method-less connect uses the first adapter.\nfunction mergeControllers(\n mounted: MountedAdapter[],\n): WalletController | undefined {\n if (mounted.length === 0) return undefined;\n return {\n connect(method?: LoginMethod): Promise<WalletSession> {\n if (method) {\n const target = mounted.find((m) =>\n m.meta.supportedMethods.includes(method),\n );\n if (!target) {\n throw new Error(\n `No wallet adapter supports login method \"${method}\"`,\n );\n }\n return target.controller.connect(method);\n }\n const chosen = mounted.at(0);\n if (!chosen) throw new Error(\"No wallet adapter available\");\n return chosen.controller.connect(method);\n },\n async disconnect(): Promise<void> {\n await Promise.all(mounted.map((m) => m.controller.disconnect()));\n },\n getSession(): WalletSession | undefined {\n for (const { controller } of mounted) {\n const session = controller.getSession();\n if (session) return session;\n }\n return undefined;\n },\n };\n}\n\n// Calls one adapter's controller hook inside its Provider and publishes it to\n// the module-level registry; unregisters on unmount.\nfunction AdapterControllerBridge(props: {\n adapter: WalletAdapter;\n onController: (\n meta: WalletAdapterMeta,\n controller: WalletController | undefined,\n ) => void;\n onSession: (id: string, session: WalletSession | undefined) => void;\n}) {\n const { adapter, onController, onSession } = props;\n const { meta } = adapter;\n const controller = adapter.useController();\n useEffect(() => {\n onController(meta, controller);\n return () => onController(meta, undefined);\n }, [meta, controller, onController]);\n // Adapters that push session changes (Privy) let sign-in complete on an OAuth\n // return, where the connect() promise died with the pre-redirect page.\n useEffect(() => {\n if (!controller.subscribe) return;\n return controller.subscribe((session) => onSession(meta.id, session));\n }, [meta.id, controller, onSession]);\n return null;\n}\n\nexport interface RenownWalletProviderProps {\n /** Wallet adapter descriptors, e.g. `[privyAdapter({ appId }), rainbowAdapter({})]` from `@renown/sdk/wallet/<id>`. Each descriptor's wallet library loads lazily on first login. Keep the array stable (module scope or `useMemo`) — it is snapshotted on mount. `undefined`/empty = redirect-only. */\n adapters: WalletAdapterDescriptor[] | undefined;\n /** Theme handed to each adapter UI: `\"light\"`, `\"dark\"`, or `{ mode, accentColor?, accentColorForeground? }`. */\n theme?: WalletTheme;\n children: ReactNode;\n}\n\n/** Drop-in provider for Renown in-page wallet sign-in: registers the login activator, lazy-mounts the configured adapters on first demand (login, logout, {@link useRenownWalletAdapter}, or an OAuth redirect return — not on a restored session), and merges their controllers for {@link useRenownAuth}. Full walkthrough + examples: the `@powerhousedao/reactor-browser` README (\"Renown in-page sign-in\") and the Academy Renown authentication guide. Pair with {@link useRenownLoginMethods} to build the login UI. */\nexport function RenownWalletProvider({\n adapters: adaptersConfig,\n theme,\n children,\n}: RenownWalletProviderProps) {\n const [descriptors] = useState(() => adaptersConfig);\n // The snapshot above drops every array after the first; say so in dev.\n useEffect(() => {\n // `process` need not exist in a browser bundle.\n if (\n typeof process !== \"undefined\" &&\n process.env?.NODE_ENV === \"production\"\n )\n return;\n if (adaptersConfig === descriptors) return;\n console.error(\n \"RenownWalletProvider: the `adapters` array changed identity after mount, and the new value was ignored. Build it once at module scope (or memoize it) — see the @powerhousedao/reactor-browser README.\",\n );\n }, [adaptersConfig, descriptors]);\n // For useRenownLoginMethods, callable from outside this subtree.\n useEffect(() => {\n setWalletDescriptors(descriptors);\n return () => setWalletDescriptors(undefined);\n }, [descriptors]);\n // Eager metadata: enough to detect a redirect return and list login methods\n // without loading any wallet library.\n const metas = useMemo(\n () => descriptors?.map((descriptor) => descriptor.meta) ?? [],\n [descriptors],\n );\n // Mount on demand (login, logout, useRenownWalletAdapter) or on an OAuth\n // redirect return — never merely because a user is signed in, so a returning\n // visitor downloads no wallet code. Once mounted, stay mounted for the page's\n // life: a logout->login remount breaks Privy's modal.\n const [active, setActive] = useState(\n () =>\n typeof window !== \"undefined\" &&\n isWalletRedirectReturn(window.location.search, metas),\n );\n const [adapters, setAdapters] = useState<WalletAdapter[] | null>(null);\n const mountedRef = useRef(new Map<string, MountedAdapter>());\n // Auto-completes sign-in from the session an adapter pushes on an OAuth return.\n const { onSession } = useCompleteRedirectSignIn(metas);\n\n // Register an activator so login() can mount + lazy-load adapters on click.\n useEffect(() => {\n if (!descriptors) return;\n setWalletActivator(() => {\n setActive(true);\n return whenWalletControllerReady();\n });\n return () => setWalletActivator(undefined);\n }, [descriptors]);\n\n // Resolve + mount adapters only once activated; each descriptor's dynamic\n // import (and the wallet library it pulls) fires here, on demand.\n useEffect(() => {\n if (!active || !descriptors) return;\n let cancelled = false;\n void resolveAdapters(descriptors)\n .then((resolved) => {\n if (cancelled) return;\n if (resolved.length === 0) {\n failWalletActivation(\n new Error(\n \"No wallet adapters were configured for in-page sign-in.\",\n ),\n );\n return;\n }\n setAdapters(resolved);\n })\n .catch((error: unknown) => {\n if (!cancelled) {\n failWalletActivation(\n error instanceof Error ? error : new Error(String(error)),\n );\n }\n });\n return () => {\n cancelled = true;\n };\n }, [active, descriptors]);\n\n const onController = useCallback(\n (meta: WalletAdapterMeta, controller: WalletController | undefined) => {\n if (controller) mountedRef.current.set(meta.id, { meta, controller });\n else mountedRef.current.delete(meta.id);\n setWalletAdapterController(meta.id, controller);\n setActiveWalletController(\n mergeControllers(Array.from(mountedRef.current.values())),\n );\n },\n [],\n );\n\n // Provider tree wraps only the adapter bridges (each library's modal portals\n // to <body>), never `children`, so activating login never remounts the app.\n const walletTree =\n descriptors && active && adapters && adapters.length > 0\n ? adapters.reduceRight<ReactNode>(\n (acc, adapter) => {\n const Provider = adapter.Provider as ComponentType<{\n children: ReactNode;\n theme?: WalletTheme;\n }>;\n return <Provider theme={theme}>{acc}</Provider>;\n },\n <>\n {adapters.map((adapter) => (\n <AdapterControllerBridge\n key={adapter.meta.id}\n adapter={adapter}\n onController={onController}\n onSession={onSession}\n />\n ))}\n </>,\n )\n : null;\n\n return (\n <>\n {children}\n {walletTree}\n </>\n );\n}\n","\"use client\";\n\nimport { readPersistedUser, type User } from \"@renown/sdk\";\nimport type { WalletAdapterDescriptor, WalletTheme } from \"@renown/sdk/wallet\";\nimport { useMemo, useSyncExternalStore, type ReactNode } from \"react\";\nimport {\n RENOWN_INITIAL_ANONYMOUS,\n RENOWN_INITIAL_UNKNOWN,\n RenownInitialUserProvider,\n type RenownInitialAuth,\n} from \"./initial-user.js\";\nimport { Renown } from \"./renown-init.js\";\nimport {\n RenownSessionSyncedContext,\n useRenownSessionCookie,\n} from \"./use-renown-session-cookie.js\";\nimport { RenownWalletProvider } from \"./wallet-provider.js\";\n\nexport interface RenownProviderProps {\n appName: string;\n /** Prefix for localStorage keys, so multiple apps can share a domain. */\n namespace?: string;\n url?: string;\n switchboardUrl?: string;\n /** Wallet adapter descriptors for in-page sign-in (see {@link RenownWalletProvider}); omit for redirect-only. */\n adapters?: WalletAdapterDescriptor[];\n theme?: WalletTheme;\n /** Re-check the restored credential against the source (default \"always\"). */\n revalidate?: \"always\" | \"never\";\n /** Chain id credentials are issued on (default 1). Keep the adapters' chains in step: it is part of the user's DID, so a wallet on another chain is rejected. */\n chainId?: number;\n /** Server-resolved session (SSR); its presence seeds from the cookie + enables cookie sync. Omit for client-only (seed = localStorage). */\n session?: { user?: User } | null;\n /** Endpoint for the session-cookie sync (SSR). Default /api/renown/session. */\n sessionEndpoint?: string;\n onError?: (error: unknown) => void;\n children: ReactNode;\n}\n\nconst subscribeNothing = () => () => {};\n\n// Runs the cookie sync and publishes its `synced` state to descendants, so a\n// post-login navigation can wait for the cookie (see useRenownSessionSynced).\nfunction SessionSync({\n enabled,\n endpoint,\n children,\n}: {\n enabled: boolean;\n endpoint?: string;\n children: ReactNode;\n}) {\n const { synced } = useRenownSessionCookie({ endpoint, enabled });\n return (\n <RenownSessionSyncedContext.Provider value={synced}>\n {children}\n </RenownSessionSyncedContext.Provider>\n );\n}\n\n// One-stop Renown provider: initializes the SDK, seeds the first render (cookie\n// for SSR, localStorage for client-only), mounts wallets, and syncs the cookie.\nexport function RenownProvider({\n appName,\n namespace,\n url,\n switchboardUrl,\n adapters,\n theme,\n revalidate,\n chainId,\n session,\n sessionEndpoint,\n onError,\n children,\n}: RenownProviderProps) {\n const isServerSession = session !== undefined;\n // Hydration must match SSR, so the cookie answers first and localStorage\n // takes over once mounted.\n const mounted = useSyncExternalStore(\n subscribeNothing,\n () => true,\n () => false,\n );\n const seed = useMemo<RenownInitialAuth>(() => {\n // localStorage holds the credential the SDK actually restores; the cookie is\n // a display hint that is server-only and can go stale independently.\n if (mounted) {\n const persisted = readPersistedUser(namespace);\n return persisted\n ? { state: \"authenticated\", user: persisted }\n : RENOWN_INITIAL_ANONYMOUS;\n }\n if (!isServerSession) return RENOWN_INITIAL_UNKNOWN;\n return session?.user\n ? { state: \"authenticated\", user: session.user }\n : RENOWN_INITIAL_ANONYMOUS;\n }, [mounted, isServerSession, session, namespace]);\n\n return (\n <>\n <Renown\n appName={appName}\n namespace={namespace}\n url={url}\n switchboardUrl={switchboardUrl}\n revalidate={revalidate}\n chainId={chainId}\n onError={onError}\n />\n <RenownInitialUserProvider initialAuth={seed}>\n <RenownWalletProvider adapters={adapters} theme={theme}>\n <SessionSync enabled={isServerSession} endpoint={sessionEndpoint}>\n {children}\n </SessionSync>\n </RenownWalletProvider>\n </RenownInitialUserProvider>\n </>\n );\n}\n","import { LoginMethod } from \"@renown/sdk/wallet\";\nimport { useMemo, useSyncExternalStore } from \"react\";\nimport {\n getServerWalletDescriptors,\n getWalletDescriptors,\n subscribeWalletDescriptors,\n} from \"./wallet-registry.js\";\n\nexport interface RenownLoginMethod {\n id: LoginMethod;\n label: string;\n}\n\nconst DEFAULT_METHOD_LABELS: Partial<Record<LoginMethod, string>> = {\n [LoginMethod.WALLET]: \"Connect a Wallet\",\n [LoginMethod.GOOGLE]: \"Continue with Google\",\n [LoginMethod.EMAIL]: \"Continue with Email\",\n [LoginMethod.APPLE]: \"Continue with Apple\",\n};\n\n/** The login methods the mounted {@link RenownWalletProvider}'s adapters offer, for building a login UI. Reads each descriptor's eager metadata only — no wallet libraries load. Buttons follow the provider's descriptor array order, deduped; empty when no provider is mounted (redirect-only). Wire each to `useRenownAuth().login(undefined, id)`. Labels are overridable. See the reactor-browser README + Academy Renown auth guide. */\nexport function useRenownLoginMethods(\n labels?: Partial<Record<LoginMethod, string>>,\n): RenownLoginMethod[] {\n const descriptors = useSyncExternalStore(\n subscribeWalletDescriptors,\n getWalletDescriptors,\n getServerWalletDescriptors,\n );\n return useMemo(() => {\n const seen = new Set<LoginMethod>();\n const methods: RenownLoginMethod[] = [];\n for (const { meta } of descriptors) {\n for (const id of meta.supportedMethods) {\n if (seen.has(id)) continue;\n seen.add(id);\n methods.push({\n id,\n label: labels?.[id] ?? DEFAULT_METHOD_LABELS[id] ?? id,\n });\n }\n }\n return methods;\n }, [descriptors, labels]);\n}\n","import type { WalletController } from \"@renown/sdk/wallet\";\nimport { logger } from \"document-model\";\nimport { useEffect, useSyncExternalStore } from \"react\";\nimport {\n getServerWalletAdapterControllers,\n getWalletActivator,\n getWalletAdapterControllers,\n subscribeWalletActivator,\n subscribeWalletAdapterControllers,\n} from \"./wallet-registry.js\";\n\n/** The controller of one adapter mounted by {@link RenownWalletProvider}, by its `meta.id`, typed as that adapter's own surface — e.g. `useRenownWalletAdapter<PrivyWalletController>(\"privy\")` for headless email OTP. Rendering it activates the wallet tree (the adapter's library loads then), so call it from the sign-in screen, not the app shell. `undefined` until the adapter is mounted, or forever when no provider offers that id. */\nexport function useRenownWalletAdapter<\n T extends WalletController = WalletController,\n>(id: string): T | undefined {\n const controllers = useSyncExternalStore(\n subscribeWalletAdapterControllers,\n getWalletAdapterControllers,\n getServerWalletAdapterControllers,\n );\n const controller = controllers[id] as T | undefined;\n // Re-render when the provider registers its activator (it does so in an\n // effect, after this hook's first effect).\n const activator = useSyncExternalStore(\n subscribeWalletActivator,\n getWalletActivator,\n () => undefined,\n );\n const hasActivator = activator !== undefined;\n\n useEffect(() => {\n if (controller || !hasActivator) return;\n const current = getWalletActivator();\n if (!current) return;\n // Rejections (no adapter loaded) are reported by the provider; the hook\n // only needs to keep them from surfacing as unhandled.\n void current().catch((error: unknown) =>\n logger.error(error instanceof Error ? error.message : String(error)),\n );\n }, [controller, hasActivator, id]);\n\n return controller;\n}\n"],"mappings":";;;;;;;AAOA,IAAI;AACJ,IAAI,oBAGC,EAAE;AACP,IAAI;AACJ,MAAM,qCAAqB,IAAI,KAAiB;AAEhD,SAAgB,0BACd,YACM;AACN,0BAAyB;AACzB,KAAI,YAAY;EACd,MAAM,UAAU;AAChB,sBAAoB,EAAE;AACtB,UAAQ,SAAS,EAAE,cAAc,QAAQ,WAAW,CAAC;;;AAMzD,SAAgB,qBAAqB,OAAoB;CACvD,MAAM,UAAU;AAChB,qBAAoB,EAAE;AACtB,SAAQ,SAAS,EAAE,aAAa,OAAO,MAAM,CAAC;;AAGhD,SAAgB,4BAA0D;AACxE,QAAO;;AAKT,SAAgB,mBACd,WACM;AACN,KAAI,cAAc,gBAAiB;AACnC,mBAAkB;AAClB,oBAAmB,SAAS,aAAa,UAAU,CAAC;;AAKtD,SAAgB,yBAAyB,UAAkC;AACzE,oBAAmB,IAAI,SAAS;AAChC,cAAa,mBAAmB,OAAO,SAAS;;AAGlD,SAAgB,qBAEF;AACZ,QAAO;;AAKT,SAAgB,4BAAuD;AACrE,KAAI,uBAAwB,QAAO,QAAQ,QAAQ,uBAAuB;AAC1E,QAAO,IAAI,SAAS,SAAS,WAC3B,kBAAkB,KAAK;EAAE;EAAS;EAAQ,CAAC,CAC5C;;AAKH,MAAM,iBAAqD,OAAO,OAAO,EAAE,CAAC;AAS5E,MAAM,mBAAmB,OAAO,IAC9B,2DACD;AAID,SAAS,kBAAmC;CAC1C,MAAM,OAAO;AAIb,QAAQ,KAAK,sBAAsB;EACjC,aAAa;EACb,2BAAW,IAAI,KAAK;EACrB;;AAG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CACA,6BACA,kCACD,CAC8B;CAQ/B,MAAM,eALY,qBAChB,0BACA,0BACM,KAAA,EACP,KACkC,KAAA;AAEnC,iBAAgB;AACd,MAAI,cAAc,CAAC,aAAc;EACjC,MAAM,UAAU,oBAAoB;AACpC,MAAI,CAAC,QAAS;AAGT,WAAS,CAAC,OAAO,UACpB,OAAO,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC,CACrE;IACA;EAAC;EAAY;EAAc;EAAG,CAAC;AAElC,QAAO"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as setDocumentCache, c as useDocumentSafe, d as useGetDocumentAsync, f as useGetDocuments, h as readPromiseState, l as useDocuments, m as addPromiseState, o as useDocument, p as DocumentCache, r as useDispatch, s as useDocumentCache, u as useGetDocument } from "../../document-by-id-BSZqTN66.js";
|
|
2
|
-
import { $i as ReactorOperationFieldsFragmentDoc, Bi as makeAuthConnectionParams, Ft as useAttachmentService, Gi as subgraphUrlFromGraphqlUrl, Hi as subscriptionsUrlFromGraphqlUrl, Ji as resolveDocumentModelModule, Ki as StaticPackageManager, Li as GraphQLReactorClient, Qi as MutateDocumentWithOperationsDocument, Ri as isGraphQLReactorClient, Ui as SubgraphSdkRegistry, Vi as startDocumentChangesSubscription, W as useReactorClient, Wi as describeGraphQLDocument, Xi as signStampedAction, Yi as prepareSignedActions, Zi as stampAction, a as ensurePHEventHandlers, ea as ambientRenownTokenProvider, i as GraphQLReactorProvider, ia as revisionMapFromRevisionsList, n as useDocumentModelModuleById, na as phDocumentFromGetDocument, o as useSwitchboardClient, qi as packageFromDocumentModels, r as useDocumentModelModules, ra as phDocumentFromMutation, t as useDocumentOperations, ta as makeAuthMiddleware, z as setReactorClient, zi as viewFilterInputFromViewFilter } from "../../document-operations-
|
|
2
|
+
import { $i as ReactorOperationFieldsFragmentDoc, Bi as makeAuthConnectionParams, Ft as useAttachmentService, Gi as subgraphUrlFromGraphqlUrl, Hi as subscriptionsUrlFromGraphqlUrl, Ji as resolveDocumentModelModule, Ki as StaticPackageManager, Li as GraphQLReactorClient, Qi as MutateDocumentWithOperationsDocument, Ri as isGraphQLReactorClient, Ui as SubgraphSdkRegistry, Vi as startDocumentChangesSubscription, W as useReactorClient, Wi as describeGraphQLDocument, Xi as signStampedAction, Yi as prepareSignedActions, Zi as stampAction, a as ensurePHEventHandlers, ea as ambientRenownTokenProvider, i as GraphQLReactorProvider, ia as revisionMapFromRevisionsList, n as useDocumentModelModuleById, na as phDocumentFromGetDocument, o as useSwitchboardClient, qi as packageFromDocumentModels, r as useDocumentModelModules, ra as phDocumentFromMutation, t as useDocumentOperations, ta as makeAuthMiddleware, z as setReactorClient, zi as viewFilterInputFromViewFilter } from "../../document-operations-DQfMZpj8.js";
|
|
3
3
|
export { DocumentCache, GraphQLReactorClient, GraphQLReactorProvider, MutateDocumentWithOperationsDocument, ReactorOperationFieldsFragmentDoc, StaticPackageManager, SubgraphSdkRegistry, addPromiseState, ambientRenownTokenProvider, describeGraphQLDocument, ensurePHEventHandlers, isGraphQLReactorClient, makeAuthConnectionParams, makeAuthMiddleware, packageFromDocumentModels, phDocumentFromGetDocument, phDocumentFromMutation, prepareSignedActions, readPromiseState, resolveDocumentModelModule, revisionMapFromRevisionsList, setDocumentCache, setReactorClient, signStampedAction, stampAction, startDocumentChangesSubscription, subgraphUrlFromGraphqlUrl, subscriptionsUrlFromGraphqlUrl, useAttachmentService, useDispatch, useDocument, useDocumentCache, useDocumentModelModuleById, useDocumentModelModules, useDocumentOperations, useDocumentSafe, useDocuments, useGetDocument, useGetDocumentAsync, useGetDocuments, useReactorClient, useSwitchboardClient, viewFilterInputFromViewFilter };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { CREDENTIAL_SCHEMA_EIP712_TYPE, CREDENTIAL_SUBJECT_TYPE, CREDENTIAL_TYPES, ChevronDownIcon, CopyIcon, DOMAIN_TYPE, DisconnectIcon, ISSUER_TYPE, RENOWN_CHAIN_ID, RENOWN_INITIAL_ANONYMOUS, RENOWN_INITIAL_UNKNOWN, RENOWN_NETWORK_ID, RENOWN_URL, Renown, RenownAuth, RenownAuthAsync, RenownAuthButton, RenownAuthButtonProps, RenownAuthResolution, RenownAuthStatus, RenownInitOptions, RenownInitialAuth, RenownInitialUserProvider, RenownInitialUserProviderProps, RenownLoginButton, RenownLoginButtonProps, RenownLoginMethod, RenownLogo, RenownProps, RenownProvider, RenownProviderProps, RenownSessionCookieOptions, RenownSessionCookieState, RenownUserButton, RenownUserButtonMenuItem, RenownUserButtonProps, RenownWalletProvider, RenownWalletProviderProps, SpinnerIcon, UserIcon, VERIFIABLE_CREDENTIAL_EIP712_TYPE, initConnectCrypto, initRenownCrypto, openRenown, useRenown, useRenownAuth, useRenownAuthAsync, useRenownInit, useRenownInitialAuth, useRenownInitialUser, useRenownLoginMethods, useRenownSessionCookie, useRenownSessionSynced };
|
|
1
|
+
import { A as RENOWN_URL, B as RenownUserButton, C as CREDENTIAL_SCHEMA_EIP712_TYPE, D as ISSUER_TYPE, E as DOMAIN_TYPE, F as CopyIcon, G as RenownAuthButton, H as RenownUserButtonProps, I as DisconnectIcon, K as RenownAuthButtonProps, L as RenownLogo, M as initConnectCrypto, N as initRenownCrypto, O as RENOWN_CHAIN_ID, P as ChevronDownIcon, R as SpinnerIcon, S as useRenownInitialUser, T as CREDENTIAL_TYPES, U as RenownLoginButton, V as RenownUserButtonMenuItem, W as RenownLoginButtonProps, Z as useRenown, _ as RENOWN_INITIAL_UNKNOWN, a as RenownWalletProviderProps, at as RenownAuthStatus, b as RenownInitialUserProviderProps, c as Renown, d as useRenownInit, f as RenownSessionCookieOptions, g as RENOWN_INITIAL_ANONYMOUS, h as useRenownSessionSynced, i as RenownWalletProvider, it as RenownAuthResolution, j as VERIFIABLE_CREDENTIAL_EIP712_TYPE, k as RENOWN_NETWORK_ID, l as RenownProps, m as useRenownSessionCookie, n as RenownLoginMethod, nt as RenownAuth, o as RenownProvider, ot as useRenownAuth, p as RenownSessionCookieState, r as useRenownLoginMethods, rt as RenownAuthAsync, s as RenownProviderProps, st as useRenownAuthAsync, t as useRenownWalletAdapter, tt as openRenown, u as RenownInitOptions, v as RenownInitialAuth, w as CREDENTIAL_SUBJECT_TYPE, x as useRenownInitialAuth, y as RenownInitialUserProvider, z as UserIcon } from "../../index-BV00np9e.js";
|
|
2
|
+
export { CREDENTIAL_SCHEMA_EIP712_TYPE, CREDENTIAL_SUBJECT_TYPE, CREDENTIAL_TYPES, ChevronDownIcon, CopyIcon, DOMAIN_TYPE, DisconnectIcon, ISSUER_TYPE, RENOWN_CHAIN_ID, RENOWN_INITIAL_ANONYMOUS, RENOWN_INITIAL_UNKNOWN, RENOWN_NETWORK_ID, RENOWN_URL, Renown, RenownAuth, RenownAuthAsync, RenownAuthButton, RenownAuthButtonProps, RenownAuthResolution, RenownAuthStatus, RenownInitOptions, RenownInitialAuth, RenownInitialUserProvider, RenownInitialUserProviderProps, RenownLoginButton, RenownLoginButtonProps, RenownLoginMethod, RenownLogo, RenownProps, RenownProvider, RenownProviderProps, RenownSessionCookieOptions, RenownSessionCookieState, RenownUserButton, RenownUserButtonMenuItem, RenownUserButtonProps, RenownWalletProvider, RenownWalletProviderProps, SpinnerIcon, UserIcon, VERIFIABLE_CREDENTIAL_EIP712_TYPE, initConnectCrypto, initRenownCrypto, openRenown, useRenown, useRenownAuth, useRenownAuthAsync, useRenownInit, useRenownInitialAuth, useRenownInitialUser, useRenownLoginMethods, useRenownSessionCookie, useRenownSessionSynced, useRenownWalletAdapter };
|
package/dist/src/renown/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as useRenown, c as RENOWN_INITIAL_UNKNOWN, d as useRenownInitialUser, l as RenownInitialUserProvider, s as RENOWN_INITIAL_ANONYMOUS, u as useRenownInitialAuth } from "../../renown-
|
|
2
|
-
import { A as
|
|
3
|
-
export { CREDENTIAL_SCHEMA_EIP712_TYPE, CREDENTIAL_SUBJECT_TYPE, CREDENTIAL_TYPES, ChevronDownIcon, CopyIcon, DOMAIN_TYPE, DisconnectIcon, ISSUER_TYPE, RENOWN_CHAIN_ID, RENOWN_INITIAL_ANONYMOUS, RENOWN_INITIAL_UNKNOWN, RENOWN_NETWORK_ID, RENOWN_URL, Renown, RenownAuthButton, RenownInitialUserProvider, RenownLoginButton, RenownLogo, RenownProvider, RenownUserButton, RenownWalletProvider, SpinnerIcon, UserIcon, VERIFIABLE_CREDENTIAL_EIP712_TYPE, initConnectCrypto, initRenownCrypto, openRenown, useRenown, useRenownAuth, useRenownAuthAsync, useRenownInit, useRenownInitialAuth, useRenownInitialUser, useRenownLoginMethods, useRenownSessionCookie, useRenownSessionSynced };
|
|
1
|
+
import { a as useRenown, c as RENOWN_INITIAL_UNKNOWN, d as useRenownInitialUser, l as RenownInitialUserProvider, s as RENOWN_INITIAL_ANONYMOUS, u as useRenownInitialAuth } from "../../renown-6w_ImTvm.js";
|
|
2
|
+
import { A as RENOWN_CHAIN_ID, D as CREDENTIAL_TYPES, E as CREDENTIAL_SUBJECT_TYPE, M as RENOWN_URL, N as VERIFIABLE_CREDENTIAL_EIP712_TYPE, O as DOMAIN_TYPE, T as CREDENTIAL_SCHEMA_EIP712_TYPE, _ as RenownLogo, a as Renown, b as useRenownAuth, c as useRenownSessionSynced, d as RenownAuthButton, f as RenownUserButton, g as DisconnectIcon, h as CopyIcon, i as RenownWalletProvider, j as RENOWN_NETWORK_ID, k as ISSUER_TYPE, l as initConnectCrypto, m as ChevronDownIcon, n as useRenownLoginMethods, o as useRenownInit, p as RenownLoginButton, r as RenownProvider, s as useRenownSessionCookie, t as useRenownWalletAdapter, u as initRenownCrypto, v as SpinnerIcon, w as openRenown, x as useRenownAuthAsync, y as UserIcon } from "../../renown-DRnlawbP.js";
|
|
3
|
+
export { CREDENTIAL_SCHEMA_EIP712_TYPE, CREDENTIAL_SUBJECT_TYPE, CREDENTIAL_TYPES, ChevronDownIcon, CopyIcon, DOMAIN_TYPE, DisconnectIcon, ISSUER_TYPE, RENOWN_CHAIN_ID, RENOWN_INITIAL_ANONYMOUS, RENOWN_INITIAL_UNKNOWN, RENOWN_NETWORK_ID, RENOWN_URL, Renown, RenownAuthButton, RenownInitialUserProvider, RenownLoginButton, RenownLogo, RenownProvider, RenownUserButton, RenownWalletProvider, SpinnerIcon, UserIcon, VERIFIABLE_CREDENTIAL_EIP712_TYPE, initConnectCrypto, initRenownCrypto, openRenown, useRenown, useRenownAuth, useRenownAuthAsync, useRenownInit, useRenownInitialAuth, useRenownInitialUser, useRenownLoginMethods, useRenownSessionCookie, useRenownSessionSynced, useRenownWalletAdapter };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/reactor-browser",
|
|
3
|
-
"version": "6.2.2-dev.
|
|
3
|
+
"version": "6.2.2-dev.62",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -58,16 +58,16 @@
|
|
|
58
58
|
},
|
|
59
59
|
"sideEffects": false,
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@powerhousedao/analytics-engine-browser": "6.2.2-dev.
|
|
62
|
-
"@powerhousedao/analytics-engine-core": "6.2.2-dev.
|
|
63
|
-
"@powerhousedao/reactor": "6.2.2-dev.
|
|
64
|
-
"@powerhousedao/reactor-attachments": "6.2.2-dev.
|
|
65
|
-
"@powerhousedao/reactor-drive": "6.2.2-dev.
|
|
66
|
-
"@powerhousedao/shared": "6.2.2-dev.
|
|
67
|
-
"@renown/sdk": "6.2.2-dev.
|
|
61
|
+
"@powerhousedao/analytics-engine-browser": "6.2.2-dev.62",
|
|
62
|
+
"@powerhousedao/analytics-engine-core": "6.2.2-dev.62",
|
|
63
|
+
"@powerhousedao/reactor": "6.2.2-dev.62",
|
|
64
|
+
"@powerhousedao/reactor-attachments": "6.2.2-dev.62",
|
|
65
|
+
"@powerhousedao/reactor-drive": "6.2.2-dev.62",
|
|
66
|
+
"@powerhousedao/shared": "6.2.2-dev.62",
|
|
67
|
+
"@renown/sdk": "6.2.2-dev.62",
|
|
68
68
|
"@tanstack/react-query": "^5.49.2",
|
|
69
69
|
"change-case": "5.4.4",
|
|
70
|
-
"document-model": "6.2.2-dev.
|
|
70
|
+
"document-model": "6.2.2-dev.62",
|
|
71
71
|
"graphql-request": "7.4.0",
|
|
72
72
|
"graphql-ws": "6.0.7",
|
|
73
73
|
"kysely": "0.28.16",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-DjloxNSR.d.ts","names":[],"sources":["../src/renown/use-renown-auth.ts","../src/renown/session.ts","../src/hooks/renown.ts","../src/renown/components/RenownAuthButton.tsx","../src/renown/components/RenownLoginButton.tsx","../src/renown/components/RenownUserButton.tsx","../src/renown/components/icons.tsx","../src/renown/crypto.ts","../src/renown/constants.ts","../src/renown/initial-user.tsx","../src/renown/use-renown-session-cookie.ts","../src/renown/use-renown-init.ts","../src/renown/renown-init.tsx","../src/renown/provider.tsx","../src/renown/wallet-provider.tsx","../src/renown/login-methods.ts"],"mappings":";;;;;;;;KAgBY,gBAAA,GAAmB,WAAA;AAAA,UAEd,UAAA;EACf,MAAA,EAAQ,gBAAA;EACR,IAAA,EAAM,IAAA;EACN,OAAA;EACA,OAAA;EACA,SAAA;EACA,SAAA;EACA,WAAA;EACA,cAAA;EACA,KAAA,GAAQ,OAAA,GAAU,aAAA,EAAe,MAAA,GAAS,WAAA;EAC1C,OAAA;EACA,KAAA,EAAO,KAAA;EACP,MAAA,QAAc,OAAA;EACd,WAAA;AAAA;AAAA,iBA+Bc,aAAA,CAAA,GAAiB,UAAA;AAAA,KAqFrB,oBAAA;AAAA,UAKK,eAAA,SAAwB,UAAA;EA1HzB;EA4Hd,KAAA,EAAO,oBAAA;EACP,WAAA;AAAA;AAAA,iBAOc,kBAAA,CAAA,GAAsB,eAAA;;;iBC5JtB,UAAA,CAAW,UAAA;AAAA,iBAoGL,KA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,iBA0BI,cAAA,CAAA;EACd,OAAA;EACA,SAAA;EACA,GAAA;EACA,cAAA;EACA,QAAA;EACA,KAAA;EACA,UAAA;EACA,OAAA;EACA,OAAA;EACA,eAAA;EACA,OAAA;EACA;AAAA,GACC,mBAAA,GAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;UCsBL,yBAAA;;EAEf,QAAA,EAAU,uBAAA;;EAEV,KAAA,GAAQ,WAAA;EACR,QAAA,EAAU,SAAA;AAAA;;iBAII,oBAAA,CAAA;EACd,QAAA,EAAU,cAAA;EACV,KAAA;EACA;AAAA,GACC,yBAAA,GAAyB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;UCtGX,iBAAA;EACf,EAAA,EAAI,WAAA;EACJ,KAAA;AAAA;;iBAWc,qBAAA,CACd,MAAA,GAAS,OAAA,CAAQ,MAAA,CAAO,WAAA,aACvB,iBAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"renown-BZabzj4l.js","names":[],"sources":["../src/hooks/loading.ts","../src/renown/initial-user.tsx","../src/hooks/renown.ts"],"sourcesContent":["import type { LOADING } from \"../types/global.js\";\nimport { makePHEventFunctions } from \"./make-ph-event-functions.js\";\n\nexport const {\n useValue: useLoading,\n setValue: setLoading,\n addEventHandler: addLoadingEventHandler,\n} = makePHEventFunctions(\"loading\");\n\nexport const loading: LOADING = null;\n","\"use client\";\n\nimport type { User } from \"@renown/sdk\";\nimport { createContext, useContext, type ReactNode } from \"react\";\n\n/** Whether the first render already knows who (if anyone) is signed in. */\n// \"anonymous\" is load-bearing: it separates a signed-out visitor from an\n// unresolved one, which otherwise both have to render a spinner.\nexport type RenownInitialAuth =\n | { state: \"authenticated\"; user: User }\n | { state: \"anonymous\" }\n | { state: \"unknown\" };\n\nexport const RENOWN_INITIAL_UNKNOWN: RenownInitialAuth = { state: \"unknown\" };\nexport const RENOWN_INITIAL_ANONYMOUS: RenownInitialAuth = {\n state: \"anonymous\",\n};\n\n// Seeds the auth store's first render (server + hydration) from a session\n// cookie or localStorage, enabling authenticated SSR without a flash.\nconst RenownInitialUserContext = createContext<RenownInitialAuth>(\n RENOWN_INITIAL_UNKNOWN,\n);\n\nexport interface RenownInitialUserProviderProps {\n /** Resolved first-render auth (see `RenownProvider`). Takes precedence over `initialUser`. */\n initialAuth?: RenownInitialAuth;\n /** User resolved from a verified session cookie (see `verifyRenownSession`). */\n initialUser?: User;\n children: ReactNode;\n}\n\nexport function RenownInitialUserProvider({\n initialAuth,\n initialUser,\n children,\n}: RenownInitialUserProviderProps) {\n // `initialUser` alone cannot express \"anonymous\" — absence stays \"unknown\".\n const value =\n initialAuth ??\n (initialUser\n ? { state: \"authenticated\" as const, user: initialUser }\n : RENOWN_INITIAL_UNKNOWN);\n return (\n <RenownInitialUserContext.Provider value={value}>\n {children}\n </RenownInitialUserContext.Provider>\n );\n}\n\n/** First-render auth as a three-state value; use this to skip a spinner when anonymous. */\nexport function useRenownInitialAuth(): RenownInitialAuth {\n return useContext(RenownInitialUserContext);\n}\n\nexport function useRenownInitialUser(): User | undefined {\n const initial = useRenownInitialAuth();\n return initial.state === \"authenticated\" ? initial.user : undefined;\n}\n","import type { IRenown, LoginStatus, User } from \"@renown/sdk\";\nimport { useEffect, useState, useSyncExternalStore } from \"react\";\nimport { useRenownInitialUser } from \"../renown/initial-user.js\";\nimport type { LOADING } from \"../types/global.js\";\nimport { loading } from \"./loading.js\";\nimport { makePHEventFunctions } from \"./make-ph-event-functions.js\";\n\nconst renownEventFunctions = makePHEventFunctions(\"renown\");\n\n/** Adds an event handler for the renown instance */\nexport const addRenownEventHandler: () => void =\n renownEventFunctions.addEventHandler;\n\n/** Returns the renown instance */\nexport const useRenown: () => IRenown | LOADING | undefined =\n renownEventFunctions.useValue;\n\n/** Sets the renown instance */\nexport const setRenown: (value: IRenown | LOADING | undefined) => void =\n renownEventFunctions.setValue;\n\n/** Returns the DID from the renown instance */\nexport function useDid() {\n const renown = useRenown();\n return renown?.did;\n}\n\n/** Returns the current user from the renown instance, subscribing to user events */\nexport function useUser(): User | undefined {\n const renown = useRenown();\n // Seed (cookie on the server, localStorage once mounted) covers the first\n // paint; the SDK is authoritative after, so a logout/revoke clears it.\n const initialUser = useRenownInitialUser();\n const instance = renown ? renown : undefined;\n const [user, setUser] = useState<User | undefined>(\n instance ? instance.user : initialUser,\n );\n\n useEffect(() => {\n if (instance) {\n setUser(instance.user);\n return instance.on(\"user\", setUser);\n }\n }, [instance]);\n\n // useState captured only the first render, so defer to the seed until the SDK\n // exists — that is what lands the post-mount localStorage read.\n return instance ? user : (initialUser ?? user);\n}\n\n/** Returns the login status, subscribing to renown status events */\nexport function useLoginStatus(): LoginStatus | \"loading\" | undefined {\n const renown = useRenown();\n return useSyncExternalStore(\n (cb) => {\n if (!renown) {\n return () => {};\n }\n return renown.on(\"status\", cb);\n },\n () => (renown === loading ? \"loading\" : renown?.status),\n () => undefined,\n );\n}\n"],"mappings":";;;;AAGA,MAAa,EACX,UAAU,YACV,UAAU,YACV,iBAAiB,2BACf,qBAAqB,UAAU;AAEnC,MAAa,UAAmB;;;ACIhC,MAAa,yBAA4C,EAAE,OAAO,WAAW;AAC7E,MAAa,2BAA8C,EACzD,OAAO,aACR;AAID,MAAM,2BAA2B,cAC/B,uBACD;AAUD,SAAgB,0BAA0B,EACxC,aACA,aACA,YACiC;CAEjC,MAAM,QACJ,gBACC,cACG;EAAE,OAAO;EAA0B,MAAM;EAAa,GACtD;AACN,QACE,oBAAC,yBAAyB,UAA1B;EAA0C;EACvC;EACiC,CAAA;;;AAKxC,SAAgB,uBAA0C;AACxD,QAAO,WAAW,yBAAyB;;AAG7C,SAAgB,uBAAyC;CACvD,MAAM,UAAU,sBAAsB;AACtC,QAAO,QAAQ,UAAU,kBAAkB,QAAQ,OAAO,KAAA;;;;AClD5D,MAAM,uBAAuB,qBAAqB,SAAS;;AAG3D,MAAa,wBACX,qBAAqB;;AAGvB,MAAa,YACX,qBAAqB;;AAGvB,MAAa,YACX,qBAAqB;;AAGvB,SAAgB,SAAS;AAEvB,QADe,WAAW,EACX;;;AAIjB,SAAgB,UAA4B;CAC1C,MAAM,SAAS,WAAW;CAG1B,MAAM,cAAc,sBAAsB;CAC1C,MAAM,WAAW,SAAS,SAAS,KAAA;CACnC,MAAM,CAAC,MAAM,WAAW,SACtB,WAAW,SAAS,OAAO,YAC5B;AAED,iBAAgB;AACd,MAAI,UAAU;AACZ,WAAQ,SAAS,KAAK;AACtB,UAAO,SAAS,GAAG,QAAQ,QAAQ;;IAEpC,CAAC,SAAS,CAAC;AAId,QAAO,WAAW,OAAQ,eAAe;;;AAI3C,SAAgB,iBAAsD;CACpE,MAAM,SAAS,WAAW;AAC1B,QAAO,sBACJ,OAAO;AACN,MAAI,CAAC,OACH,cAAa;AAEf,SAAO,OAAO,GAAG,UAAU,GAAG;UAEzB,WAAA,OAAqB,YAAY,QAAQ,cAC1C,KAAA,EACP"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"renown-C7a1ygsj.js","names":["truncateAddress","logoutUtil","subscribeNothing","styles","defaultLogout"],"sources":["../src/renown/wallet-registry.ts","../src/renown/constants.ts","../src/renown/session.ts","../src/renown/use-renown-auth.ts","../src/renown/components/icons.tsx","../src/renown/components/slot.tsx","../src/renown/components/RenownLoginButton.tsx","../src/renown/components/RenownUserButton.tsx","../src/renown/components/RenownAuthButton.tsx","../src/renown/crypto.ts","../src/renown/use-renown-session-cookie.ts","../src/renown/use-renown-init.ts","../src/renown/renown-init.tsx","../src/renown/use-complete-redirect-sign-in.ts","../src/renown/wallet-provider.tsx","../src/renown/provider.tsx","../src/renown/login-methods.ts"],"sourcesContent":["import type {\n WalletAdapterDescriptor,\n WalletController,\n} from \"@renown/sdk/wallet\";\n\n// Module-level registry for the active wallet controller. Connect mounts the\n// configured adapter Providers and registers the controller for useRenownAuth.\nlet activeWalletController: WalletController | undefined;\nlet controllerWaiters: Array<{\n resolve: (controller: WalletController) => void;\n reject: (error: Error) => void;\n}> = [];\nlet walletActivator: (() => Promise<WalletController>) | undefined;\n\nexport function setActiveWalletController(\n controller: WalletController | undefined,\n): void {\n activeWalletController = controller;\n if (controller) {\n const waiters = controllerWaiters;\n controllerWaiters = [];\n waiters.forEach(({ resolve }) => resolve(controller));\n }\n}\n\n// Called when activation can't produce a controller (e.g. no adapter loaded\n// because a peer dep is missing) so a pending login() rejects instead of hanging.\nexport function failWalletActivation(error: Error): void {\n const waiters = controllerWaiters;\n controllerWaiters = [];\n waiters.forEach(({ reject }) => reject(error));\n}\n\nexport function getActiveWalletController(): WalletController | undefined {\n return activeWalletController;\n}\n\n// Registered by the app's wallet-provider mount. Lets login() mount the adapter\n// Providers on demand (on click) instead of loading wallet libraries at startup.\nexport function setWalletActivator(\n activator: (() => Promise<WalletController>) | undefined,\n): void {\n walletActivator = activator;\n}\n\nexport function getWalletActivator():\n | (() => Promise<WalletController>)\n | undefined {\n return walletActivator;\n}\n\n// Resolves once a wallet controller is registered (after on-demand mount), or\n// rejects if activation fails (see failWalletActivation).\nexport function whenWalletControllerReady(): Promise<WalletController> {\n if (activeWalletController) return Promise.resolve(activeWalletController);\n return new Promise((resolve, reject) =>\n controllerWaiters.push({ resolve, reject }),\n );\n}\n\n// Descriptors the mounted provider snapshotted. A registry rather than context\n// because a login UI is not always inside the provider tree (see the controller).\nconst NO_DESCRIPTORS: readonly WalletAdapterDescriptor[] = Object.freeze([]);\n\ninterface DescriptorStore {\n descriptors: readonly WalletAdapterDescriptor[];\n listeners: Set<() => void>;\n}\n\n// In the global symbol registry, not a module-level `let`, so duplicate copies\n// of this package share one store.\nconst DESCRIPTOR_STORE = Symbol.for(\n \"@powerhousedao/reactor-browser:renown-wallet-descriptors\",\n);\n\n// Safe on the server: `globalThis` exists there and SSR reads the constant\n// below instead, so nothing crosses requests.\nfunction descriptorStore(): DescriptorStore {\n const host = globalThis as unknown as Record<\n symbol,\n DescriptorStore | undefined\n >;\n return (host[DESCRIPTOR_STORE] ??= {\n descriptors: NO_DESCRIPTORS,\n listeners: new Set(),\n });\n}\n\nexport function setWalletDescriptors(\n descriptors: readonly WalletAdapterDescriptor[] | undefined,\n): void {\n const store = descriptorStore();\n const next = descriptors ?? NO_DESCRIPTORS;\n if (next === store.descriptors) return;\n // Copies of this module have distinct empty sentinels; treat them as equal.\n if (next.length === 0 && store.descriptors.length === 0) return;\n store.descriptors = next;\n store.listeners.forEach((listener) => listener());\n}\n\n// Identity-stable while unchanged, so useSyncExternalStore does not loop.\nexport function getWalletDescriptors(): readonly WalletAdapterDescriptor[] {\n return descriptorStore().descriptors;\n}\n\n// No provider is mounted during a server render; a constant keeps the hydration\n// snapshot stable until the client subscribes.\nexport function getServerWalletDescriptors(): readonly WalletAdapterDescriptor[] {\n return NO_DESCRIPTORS;\n}\n\nexport function subscribeWalletDescriptors(listener: () => void): () => void {\n const { listeners } = descriptorStore();\n listeners.add(listener);\n return () => listeners.delete(listener);\n}\n","export const RENOWN_URL = \"https://www.renown.id\";\nexport const RENOWN_NETWORK_ID = \"eip155\";\nexport const RENOWN_CHAIN_ID = \"1\";\n\n// EIP-712 credential types are canonical in @renown/sdk; re-export to avoid drift.\nexport {\n CREDENTIAL_TYPES,\n DOMAIN_TYPE,\n VERIFIABLE_CREDENTIAL_EIP712_TYPE,\n CREDENTIAL_SCHEMA_EIP712_TYPE,\n CREDENTIAL_SUBJECT_TYPE,\n ISSUER_TYPE,\n} from \"@renown/sdk\";\n","import type { IRenown, User } from \"@renown/sdk\";\nimport type { WalletSession } from \"@renown/sdk/wallet\";\nimport { logger } from \"document-model\";\nimport { RENOWN_CHAIN_ID, RENOWN_NETWORK_ID, RENOWN_URL } from \"./constants.js\";\nimport { getActiveWalletController } from \"./wallet-registry.js\";\n\nexport function openRenown(documentId?: string) {\n const renown = window.ph?.renown;\n let renownUrl = renown?.baseUrl;\n if (!renownUrl) {\n logger.warn(\"Renown instance not found, falling back to: @url\", RENOWN_URL);\n renownUrl = RENOWN_URL;\n }\n\n if (documentId) {\n window.open(`${renownUrl}/profile/${documentId}`, \"_blank\")?.focus();\n return;\n }\n\n const url = new URL(renownUrl);\n url.searchParams.set(\"app\", renown?.did ?? \"\");\n url.searchParams.set(\"connect\", renown?.did ?? \"\");\n url.searchParams.set(\"network\", RENOWN_NETWORK_ID);\n url.searchParams.set(\"chain\", RENOWN_CHAIN_ID);\n\n const returnUrl = new URL(window.location.pathname, window.location.origin);\n url.searchParams.set(\"returnUrl\", returnUrl.toJSON());\n window.open(url, \"_self\")?.focus();\n}\n\n// In-page Renown sign-in: signs an app-key credential with the wallet session\n// and logs in via the configured switchboard. Throws if no switchboard is set.\nasync function signIn(session: WalletSession): Promise<User | undefined> {\n const renown = window.ph?.renown;\n if (!renown) {\n logger.warn(\"Renown instance not found, cannot sign in\");\n return;\n }\n return renown.signIn({\n address: session.address,\n chainId: session.chainId,\n signTypedData: session.signTypedData,\n });\n}\n\n// Idempotent sign-in gate the explicit login and OAuth-return auto-sign both\n// funnel through, so a duplicate / in-flight / lingering trigger is a no-op.\nlet inFlightSignIn: Promise<User | undefined> | undefined;\nlet inFlightAddress: string | undefined;\nlet lastSignedAddress: string | undefined;\n\nexport async function completeSignIn(\n session: WalletSession,\n): Promise<User | undefined> {\n const { address } = session;\n if (address === lastSignedAddress) return;\n if (inFlightSignIn && address === inFlightAddress) return inFlightSignIn;\n\n inFlightAddress = address;\n inFlightSignIn = (async () => {\n try {\n const user = await signIn(session);\n if (user) lastSignedAddress = address;\n return user;\n } finally {\n inFlightSignIn = undefined;\n inFlightAddress = undefined;\n }\n })();\n return inFlightSignIn;\n}\n\n// Cleared by logout so the same address can sign in again afterward.\nfunction resetSignInGuard(): void {\n inFlightSignIn = undefined;\n inFlightAddress = undefined;\n lastSignedAddress = undefined;\n}\n\n// True while a redirect sign-in is still inbound: the DID is in the URL but\n// init has not consumed it yet, so an empty credential store is not the answer.\nexport function hasRedirectSignIn(): boolean {\n if (typeof window === \"undefined\") return false;\n return new URLSearchParams(window.location.search).has(\"user\");\n}\n\n// Reads the `?user=` DID from the URL if present, then strips the param.\nfunction consumeDidFromUrl(): string | undefined {\n if (typeof window === \"undefined\") return;\n\n const urlParams = new URLSearchParams(window.location.search);\n const userParam = urlParams.get(\"user\");\n if (!userParam) return;\n\n const userDid = decodeURIComponent(userParam);\n\n // Clean up the URL parameter\n const cleanUrl = new URL(window.location.href);\n cleanUrl.searchParams.delete(\"user\");\n window.history.replaceState({}, \"\", cleanUrl.toString());\n\n return userDid;\n}\n\n// Log in the user, resolving the DID from (in order): explicit arg, the `?user=`\n// redirect param, then the Renown instance's stored session.\nexport async function login(\n userDid: string | undefined,\n renown: IRenown | undefined,\n): Promise<User | undefined> {\n if (!renown) {\n return;\n }\n\n const did = userDid ?? consumeDidFromUrl();\n\n try {\n const user = renown.user;\n\n if (user?.did && (user.did === did || !did)) {\n return user;\n }\n\n if (!did) {\n return;\n }\n\n return await renown.login(did);\n } catch (error) {\n logger.error(\n error instanceof Error ? error.message : JSON.stringify(error),\n );\n }\n}\n\nexport async function logout() {\n // Disconnect the wallet first — while still authenticated the adapters are\n // mounted, so each adapter's own logout (Privy clears its session) runs first.\n try {\n await getActiveWalletController()?.disconnect();\n } catch (error) {\n logger.error(error instanceof Error ? error.message : String(error));\n }\n\n const renown = window.ph?.renown;\n await renown?.logout();\n resetSignInGuard();\n\n // Clear the user parameter from URL to prevent auto-login on refresh\n const url = new URL(window.location.href);\n if (url.searchParams.has(\"user\")) {\n url.searchParams.delete(\"user\");\n window.history.replaceState(null, \"\", url.toString());\n }\n}\n","import type { LoginStatus, User } from \"@renown/sdk\";\nimport type { LoginMethod, WalletSession } from \"@renown/sdk/wallet\";\nimport { useCallback, useState, useSyncExternalStore } from \"react\";\nimport { useLoginStatus, useUser } from \"../hooks/renown.js\";\nimport { useRenownInitialAuth } from \"./initial-user.js\";\nimport {\n getActiveWalletController,\n getWalletActivator,\n} from \"./wallet-registry.js\";\nimport {\n completeSignIn,\n hasRedirectSignIn,\n logout as logoutUtil,\n openRenown,\n} from \"./session.js\";\n\nexport type RenownAuthStatus = LoginStatus | \"loading\";\n\nexport interface RenownAuth {\n status: RenownAuthStatus | undefined;\n user: User | undefined;\n address: string | undefined;\n ensName: string | undefined;\n avatarUrl: string | undefined;\n profileId: string | undefined;\n displayName: string | undefined;\n displayAddress: string | undefined;\n login: (session?: WalletSession, method?: LoginMethod) => void;\n pending: boolean;\n error: Error | undefined;\n logout: () => Promise<void>;\n openProfile: () => void;\n}\n\nfunction truncateAddress(address: string): string {\n if (address.length <= 13) return address;\n return `${address.slice(0, 7)}...${address.slice(-5)}`;\n}\n\n// The user dismissed the provider modal (Privy `exited_auth_flow`, an injected\n// wallet reject) — a benign cancel, not a login failure, so don't surface it.\nfunction isUserCancellation(error: Error): boolean {\n const msg = error.message.toLowerCase();\n return (\n msg.includes(\"exited_auth_flow\") ||\n msg.includes(\"user rejected\") ||\n msg.includes(\"user denied\") ||\n msg.includes(\"userrejected\") ||\n msg.includes(\"cancel\")\n );\n}\n\nfunction toRenownAuthStatus(\n loginStatus: LoginStatus | \"loading\" | undefined,\n user: User | undefined,\n): RenownAuthStatus | undefined {\n if (loginStatus === \"authorized\") {\n return user ? \"authorized\" : \"checking\";\n }\n return loginStatus;\n}\n\nexport function useRenownAuth(): RenownAuth {\n const user = useUser();\n const loginStatus = useLoginStatus();\n const [pending, setPending] = useState(false);\n const [error, setError] = useState<Error | undefined>(undefined);\n\n // syncs user with login status\n const status = toRenownAuthStatus(loginStatus, user);\n\n const address = user?.address;\n const ensName = user?.ens?.name;\n const avatarUrl = user?.profile?.userImage ?? user?.ens?.avatarUrl;\n const profileId = user?.profile?.documentId;\n\n const displayName = ensName ?? user?.profile?.username ?? undefined;\n const displayAddress = address ? truncateAddress(address) : undefined;\n\n const login = useCallback((session?: WalletSession, method?: LoginMethod) => {\n // In-page sign-in path requires a session (passed in), an already-mounted\n // controller, or an activator that mounts the adapter on demand.\n const existing = getActiveWalletController();\n const activator = getWalletActivator();\n if (!session && !existing && !activator) {\n openRenown();\n return;\n }\n setPending(true);\n setError(undefined);\n void (async () => {\n try {\n let resolved = session;\n if (!resolved) {\n // Activate on click, then re-read the freshest controller so every\n // adapter that registered (not just the first) can route `method`.\n const activated =\n existing ?? (activator ? await activator() : undefined);\n const controller = getActiveWalletController() ?? activated;\n resolved = await controller?.connect(method);\n }\n if (!resolved) {\n openRenown();\n return;\n }\n // completeSignIn throws when no switchboard is configured; fall back to\n // the redirect flow only in that case so login still succeeds.\n await completeSignIn(resolved);\n } catch (e) {\n const err = e instanceof Error ? e : new Error(String(e));\n // A cancel clears pending (finally) without showing a red error.\n if (isUserCancellation(err)) return;\n setError(err);\n if (/switchboard/i.test(err.message)) openRenown();\n } finally {\n setPending(false);\n }\n })();\n }, []);\n\n const logout = useCallback(async () => {\n await logoutUtil();\n }, []);\n\n const openProfile = useCallback(() => {\n if (profileId) {\n openRenown(profileId);\n }\n }, [profileId]);\n\n return {\n status,\n user,\n address,\n ensName,\n avatarUrl,\n profileId,\n displayName,\n displayAddress,\n login,\n pending,\n error,\n logout,\n openProfile,\n };\n}\n\nexport type RenownAuthResolution =\n | \"authenticated\"\n | \"resolving\"\n | \"unauthenticated\";\n\nexport interface RenownAuthAsync extends RenownAuth {\n /** Collapsed routing state; \"resolving\" until auth is known. */\n state: RenownAuthResolution;\n isResolving: boolean;\n}\n\nconst subscribeNothing = () => () => {};\n\n// Auth as a resolved three-state value instead of via Suspense: renders a\n// \"resolving\" phase you can branch on, so no Suspense boundary is required.\nexport function useRenownAuthAsync(): RenownAuthAsync {\n const auth = useRenownAuth();\n const initial = useRenownInitialAuth();\n // Server + hydration read false so the markup matches; the URL is checked\n // once mounted, which is when init would consume the DID anyway.\n const redirectSignIn = useSyncExternalStore(\n subscribeNothing,\n hasRedirectSignIn,\n () => false,\n );\n const { user, status, pending } = auth;\n let state: RenownAuthResolution;\n if (user) {\n state = \"authenticated\";\n } else if (pending) {\n state = \"resolving\";\n } else if (\n initial.state === \"anonymous\" &&\n // A redirect login is inbound, so the empty store is about to change; the\n // SDK only reports \"checking\" once init has consumed the DID.\n !redirectSignIn &&\n status !== \"checking\"\n ) {\n // Nothing to restore, so the SDK build cannot change the answer — resolve\n // now instead of spinning through IndexedDB and keypair setup.\n state = \"unauthenticated\";\n } else if (\n status === undefined ||\n status === \"loading\" ||\n status === \"checking\"\n ) {\n state = \"resolving\";\n } else {\n state = \"unauthenticated\";\n }\n return { ...auth, state, isResolving: state === \"resolving\" };\n}\n","import type { CSSProperties } from \"react\";\n\ninterface IconProps {\n size?: number;\n width?: number;\n height?: number;\n color?: string;\n style?: CSSProperties;\n className?: string;\n}\n\ninterface RenownLogoProps extends IconProps {\n hovered?: boolean;\n}\n\nexport function RenownLogo({\n width = 71,\n height = 19,\n hovered = false,\n color = \"currentColor\",\n className,\n}: RenownLogoProps) {\n return (\n <svg\n width={width}\n height={height}\n viewBox=\"0 0 71 19\"\n fill={color}\n xmlns=\"http://www.w3.org/2000/svg\"\n className={className}\n >\n <path d=\"M53.6211 18.4887V9.0342H56.435V10.8096H56.4923C56.7377 10.181 57.1085 9.70244 57.6047 9.37398C58.101 9.03986 58.6981 8.8728 59.3962 8.8728C60.4105 8.8728 61.2039 9.1871 61.7765 9.8157C62.3546 10.4443 62.6436 11.3164 62.6436 12.432V18.4887H59.7397V13.0776C59.7397 12.5283 59.6007 12.1007 59.3225 11.7949C59.0499 11.4835 58.6654 11.3277 58.1692 11.3277C57.6784 11.3277 57.2803 11.4976 56.9749 11.8374C56.6695 12.1772 56.5168 12.6161 56.5168 13.1541V18.4887H53.6211Z\" />\n <path d=\"M53.097 9.03394L50.7412 18.4884H47.6164L46.1522 12.075H46.0949L44.6389 18.4884H41.5632L39.1992 9.03394H42.1195L43.3056 15.7532H43.3628L44.7861 9.03394H47.551L48.9906 15.7532H49.0479L50.234 9.03394H53.097Z\" />\n <path d=\"M37.8661 17.3926C37.0427 18.2591 35.9084 18.6923 34.4632 18.6923C33.0181 18.6923 31.8838 18.2591 31.0604 17.3926C30.2369 16.5205 29.8252 15.3086 29.8252 13.7569C29.8252 12.2336 30.2424 11.033 31.0767 10.1552C31.9111 9.2718 33.0399 8.83008 34.4632 8.83008C35.892 8.83008 37.0208 9.26896 37.8497 10.1467C38.6841 11.0188 39.1013 12.2222 39.1013 13.7569C39.1013 15.3143 38.6896 16.5262 37.8661 17.3926ZM33.2117 15.7702C33.5116 16.2402 33.9288 16.4752 34.4632 16.4752C34.9977 16.4752 35.4148 16.2402 35.7148 15.7702C36.0147 15.2945 36.1647 14.6234 36.1647 13.7569C36.1647 12.9131 36.012 12.2506 35.7066 11.7692C35.4012 11.2878 34.9868 11.0472 34.4632 11.0472C33.9343 11.0472 33.5171 11.2878 33.2117 11.7692C32.9118 12.2449 32.7618 12.9075 32.7618 13.7569C32.7618 14.6234 32.9118 15.2945 33.2117 15.7702Z\" />\n <path d=\"M20.0088 18.4887V9.0342H22.8227V10.8096H22.88C23.1254 10.181 23.4962 9.70244 23.9924 9.37398C24.4887 9.03986 25.0858 8.8728 25.7838 8.8728C26.7982 8.8728 27.5916 9.1871 28.1642 9.8157C28.7423 10.4443 29.0313 11.3164 29.0313 12.432V18.4887H26.1274V13.0776C26.1274 12.5283 25.9883 12.1007 25.7102 11.7949C25.4376 11.4835 25.0531 11.3277 24.5569 11.3277C24.0661 11.3277 23.668 11.4976 23.3626 11.8374C23.0572 12.1772 22.9045 12.6161 22.9045 13.1541V18.4887H20.0088Z\" />\n <path d=\"M14.7486 10.9707C14.2851 10.9707 13.8952 11.1321 13.5789 11.4549C13.2626 11.7777 13.0854 12.1911 13.0472 12.6951H16.4337C16.4064 12.1741 16.2374 11.7579 15.9265 11.4464C15.6212 11.1293 15.2285 10.9707 14.7486 10.9707ZM16.4991 15.5153H19.1167C18.9749 16.4837 18.5141 17.2567 17.7343 17.8343C16.9599 18.4063 15.9838 18.6923 14.8059 18.6923C13.3662 18.6923 12.2374 18.2591 11.4194 17.3926C10.6014 16.5262 10.1924 15.3313 10.1924 13.8079C10.1924 12.2845 10.5987 11.0755 11.4112 10.1807C12.2237 9.28029 13.3226 8.83008 14.7077 8.83008C16.0656 8.83008 17.1481 9.26047 17.9552 10.1213C18.7677 10.9764 19.174 12.1231 19.174 13.5616V14.4195H13.0145V14.6064C13.0145 15.184 13.1835 15.6541 13.5216 16.0165C13.8597 16.3733 14.3015 16.5517 14.8468 16.5517C15.2503 16.5517 15.5993 16.461 15.8938 16.2798C16.1883 16.0929 16.3901 15.8381 16.4991 15.5153Z\" />\n <path d=\"M3.00205 8.58396V12.0667H4.7771C5.32789 12.0667 5.7587 11.911 6.06954 11.5995C6.38038 11.2881 6.5358 10.8662 6.5358 10.3338C6.5358 9.80718 6.37492 9.38528 6.05318 9.06815C5.73143 8.74535 5.30335 8.58396 4.76892 8.58396H3.00205ZM3.00205 14.1989V18.4886H0V6.23096H5.07158C6.53307 6.23096 7.65373 6.5849 8.43355 7.29278C9.21337 8.00066 9.60328 8.99453 9.60328 10.2744C9.60328 11.0446 9.42605 11.7439 9.07159 12.3725C8.71712 12.9955 8.2236 13.4514 7.59101 13.7402L9.94684 18.4886H6.5767L4.55624 14.1989H3.00205Z\" />\n <path\n d=\"M65.7255 0.211478C65.0841 2.46724 63.3737 4.2455 61.2041 4.90969C60.932 4.99366 60.932 5.39096 61.2041 5.47492C63.3725 6.13912 65.0841 7.91738 65.7255 10.1731C65.8056 10.4551 66.1932 10.4551 66.2745 10.1731C66.9159 7.91738 68.6263 6.13912 70.7959 5.47492C71.068 5.39096 71.068 4.99366 70.7959 4.90969C68.6276 4.2455 66.9159 2.46724 66.2745 0.211478C66.1944 -0.0704925 65.8068 -0.0704925 65.7255 0.211478Z\"\n fill={hovered ? \"#21FFB4\" : color}\n />\n </svg>\n );\n}\n\nexport function CopyIcon({\n size = 14,\n color = \"var(--muted-foreground, #9EA0A1)\",\n}: IconProps) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <rect\n x=\"5\"\n y=\"5\"\n width=\"9\"\n height=\"9\"\n rx=\"1\"\n stroke={color}\n strokeWidth=\"1.5\"\n />\n <path\n d=\"M11 5V3C11 2.44772 10.5523 2 10 2H3C2.44772 2 2 2.44772 2 3V10C2 10.5523 2.44772 11 3 11H5\"\n stroke={color}\n strokeWidth=\"1.5\"\n />\n </svg>\n );\n}\n\nexport function DisconnectIcon({\n size = 14,\n color = \"var(--destructive, #EA4335)\",\n}: IconProps) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M6 14H3.33333C2.97971 14 2.64057 13.8595 2.39052 13.6095C2.14048 13.3594 2 13.0203 2 12.6667V3.33333C2 2.97971 2.14048 2.64057 2.39052 2.39052C2.64057 2.14048 2.97971 2 3.33333 2H6\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M10.6667 11.3333L14 8L10.6667 4.66667\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M14 8H6\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n\nexport function SpinnerIcon({ size = 14, color = \"currentColor\" }: IconProps) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n style={{ animation: \"spin 1s linear infinite\" }}\n >\n <style>{`@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }`}</style>\n <path d=\"M8 1V4\" stroke={color} strokeWidth=\"1.5\" strokeLinecap=\"round\" />\n <path\n d=\"M8 12V15\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n opacity=\"0.3\"\n />\n <path\n d=\"M3.05 3.05L5.17 5.17\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n opacity=\"0.9\"\n />\n <path\n d=\"M10.83 10.83L12.95 12.95\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n opacity=\"0.4\"\n />\n <path\n d=\"M1 8H4\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n opacity=\"0.8\"\n />\n <path\n d=\"M12 8H15\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n opacity=\"0.5\"\n />\n <path\n d=\"M3.05 12.95L5.17 10.83\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n opacity=\"0.7\"\n />\n <path\n d=\"M10.83 5.17L12.95 3.05\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n opacity=\"0.6\"\n />\n </svg>\n );\n}\n\nexport function ChevronDownIcon({\n size = 14,\n color = \"currentColor\",\n style,\n}: IconProps) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n style={style}\n >\n <path\n d=\"M4 6L8 10L12 6\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n\nexport function UserIcon({ size = 24, color = \"#6366f1\" }: IconProps) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle cx=\"12\" cy=\"8\" r=\"4\" stroke={color} strokeWidth=\"2\" />\n <path\n d=\"M4 20C4 16.6863 7.58172 14 12 14C16.4183 14 20 16.6863 20 20\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n />\n </svg>\n );\n}\n","import {\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n type Ref,\n Children,\n cloneElement,\n forwardRef,\n isValidElement,\n} from \"react\";\n\ntype AnyProps = Record<string, unknown>;\n\nfunction mergeProps(parentProps: AnyProps, childProps: AnyProps): AnyProps {\n const merged: AnyProps = { ...parentProps };\n\n for (const key of Object.keys(childProps)) {\n const parentValue = parentProps[key];\n const childValue = childProps[key];\n\n if (key === \"style\") {\n merged[key] = { ...(parentValue as object), ...(childValue as object) };\n } else if (key === \"className\") {\n merged[key] = [parentValue, childValue].filter(Boolean).join(\" \");\n } else if (\n typeof parentValue === \"function\" &&\n typeof childValue === \"function\"\n ) {\n merged[key] = (...args: unknown[]) => {\n (childValue as (...a: unknown[]) => void)(...args);\n (parentValue as (...a: unknown[]) => void)(...args);\n };\n } else if (childValue !== undefined) {\n merged[key] = childValue;\n }\n }\n\n return merged;\n}\n\ninterface SlotProps extends HTMLAttributes<HTMLElement> {\n children?: ReactNode;\n ref?: Ref<HTMLElement>;\n}\n\nexport const Slot = forwardRef<HTMLElement, SlotProps>(\n ({ children, ...props }, ref) => {\n const child = Children.only(children);\n\n if (!isValidElement(child)) {\n return null;\n }\n\n const childElement = child as ReactElement<AnyProps>;\n const mergedProps = mergeProps(props, childElement.props);\n\n if (ref) {\n mergedProps.ref = ref;\n }\n\n return cloneElement(childElement, mergedProps);\n },\n);\n\nSlot.displayName = \"Slot\";\n","import type { CSSProperties, ReactNode } from \"react\";\nimport { useCallback, useState } from \"react\";\nimport { openRenown } from \"../session.js\";\nimport { SpinnerIcon } from \"./icons.js\";\nimport { Slot } from \"./slot.js\";\n\nexport interface RenownLoginButtonProps {\n onLogin?: () => void;\n darkMode?: boolean;\n style?: CSSProperties;\n className?: string;\n asChild?: boolean;\n children?: ReactNode;\n}\n\nconst colorStyles = {\n trigger: {\n backgroundColor: \"var(--card, #ffffff)\",\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"var(--border, #d1d5db)\",\n color: \"var(--card-foreground, #111827)\",\n },\n triggerHover: {\n backgroundColor: \"var(--accent, #ecf3f8)\",\n borderColor: \"var(--border, #d1d5db)\",\n },\n} as const;\n\nconst styles: Record<string, CSSProperties> = {\n wrapper: {\n position: \"relative\",\n display: \"inline-block\",\n },\n trigger: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: \"8px\",\n padding: \"8px 32px\",\n borderRadius: \"8px\",\n cursor: \"pointer\",\n fontSize: \"14px\",\n fontWeight: 500,\n fontFamily: \"inherit\",\n lineHeight: \"20px\",\n transition: \"background-color 150ms, border-color 150ms\",\n },\n};\n\nexport function RenownLoginButton({\n onLogin: onLoginProp,\n style,\n className,\n asChild = false,\n children,\n}: RenownLoginButtonProps) {\n const onLogin = onLoginProp ?? (() => openRenown());\n const [isLoading, setIsLoading] = useState(false);\n const [isHovered, setIsHovered] = useState(false);\n\n const handleMouseEnter = useCallback(() => setIsHovered(true), []);\n const handleMouseLeave = useCallback(() => setIsHovered(false), []);\n\n const handleClick = () => {\n if (!isLoading) {\n setIsLoading(true);\n onLogin();\n }\n };\n\n const themeStyles = colorStyles;\n\n const triggerStyle: CSSProperties = {\n ...styles.trigger,\n ...themeStyles.trigger,\n ...(isHovered && !isLoading ? themeStyles.triggerHover : {}),\n cursor: isLoading ? \"wait\" : \"pointer\",\n ...style,\n };\n\n const triggerElement = asChild ? (\n <Slot\n onClick={handleClick}\n data-renown-state=\"login\"\n {...(isLoading ? { \"data-loading\": \"\" } : {})}\n >\n {children}\n </Slot>\n ) : (\n <button\n type=\"button\"\n style={triggerStyle}\n aria-label=\"Log in with Renown\"\n onClick={handleClick}\n data-renown-state=\"login\"\n {...(isLoading ? { \"data-loading\": \"\" } : {})}\n >\n {isLoading ? <SpinnerIcon size={16} /> : <span>Log in</span>}\n </button>\n );\n\n return (\n <div\n style={styles.wrapper}\n className={className}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n {triggerElement}\n </div>\n );\n}\n","import type { CSSProperties, ReactNode } from \"react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { useUser } from \"../../hooks/renown.js\";\nimport { logout as defaultLogout, openRenown } from \"../session.js\";\nimport {\n ChevronDownIcon,\n CopyIcon,\n DisconnectIcon,\n UserIcon,\n} from \"./icons.js\";\nimport { Slot } from \"./slot.js\";\n\nconst POPOVER_GAP = 4;\nconst POPOVER_HEIGHT = 150;\n\nexport interface RenownUserButtonMenuItem {\n label: string;\n icon?: ReactNode;\n onClick: () => void;\n style?: CSSProperties;\n}\n\nexport interface RenownUserButtonProps {\n address?: string;\n username?: string;\n avatarUrl?: string;\n userId?: string;\n onDisconnect?: () => void;\n style?: CSSProperties;\n className?: string;\n asChild?: boolean;\n children?: ReactNode;\n menuItems?: RenownUserButtonMenuItem[];\n}\n\nconst styles: Record<string, CSSProperties> = {\n wrapper: {\n position: \"relative\",\n display: \"inline-block\",\n },\n trigger: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"8px\",\n padding: \"6px 12px\",\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"var(--border, #e5e7eb)\",\n backgroundColor: \"var(--card, #ffffff)\",\n cursor: \"pointer\",\n borderRadius: \"8px\",\n fontSize: \"12px\",\n fontWeight: 500,\n fontFamily: \"inherit\",\n color: \"var(--card-foreground, #111827)\",\n transition: \"background-color 150ms, border-color 150ms\",\n },\n triggerHover: {\n backgroundColor: \"var(--accent, #f3f4f6)\",\n borderColor: \"var(--border, #e5e7eb)\",\n },\n avatar: {\n width: \"28px\",\n height: \"28px\",\n borderRadius: \"50%\",\n objectFit: \"cover\",\n flexShrink: 0,\n },\n avatarPlaceholder: {\n width: \"28px\",\n height: \"28px\",\n borderRadius: \"50%\",\n background: \"linear-gradient(135deg, #8b5cf6, #3b82f6)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n flexShrink: 0,\n },\n avatarInitial: {\n fontSize: \"12px\",\n fontWeight: 700,\n color: \"#ffffff\",\n lineHeight: 1,\n },\n displayName: {\n maxWidth: \"120px\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n },\n chevron: {\n flexShrink: 0,\n transition: \"transform 150ms\",\n color: \"var(--muted-foreground, #6b7280)\",\n },\n chevronOpen: {\n transform: \"rotate(180deg)\",\n },\n popoverBase: {\n position: \"absolute\",\n right: 0,\n backgroundColor: \"var(--popover, #ffffff)\",\n borderRadius: \"8px\",\n boxShadow: \"0 4px 12px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08)\",\n width: \"100%\",\n zIndex: 1000,\n color: \"var(--popover-foreground, #111827)\",\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"var(--border, #e5e7eb)\",\n overflow: \"hidden\",\n },\n header: {\n padding: \"12px 16px\",\n borderBottom: \"1px solid var(--border, #e5e7eb)\",\n },\n headerUsername: {\n fontSize: \"14px\",\n fontWeight: 600,\n color: \"var(--foreground, #111827)\",\n margin: 0,\n },\n addressRow: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"4px\",\n marginTop: \"4px\",\n },\n addressButton: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"4px\",\n padding: 0,\n border: \"none\",\n backgroundColor: \"transparent\",\n cursor: \"pointer\",\n fontSize: \"12px\",\n color: \"var(--muted-foreground, #6b7280)\",\n fontFamily: \"inherit\",\n position: \"relative\",\n width: \"100%\",\n },\n copiedText: {\n fontSize: \"12px\",\n color: \"var(--success, #059669)\",\n position: \"absolute\",\n left: 0,\n transition: \"opacity 150ms\",\n fontWeight: 500,\n },\n addressText: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"4px\",\n transition: \"opacity 150ms\",\n },\n menuSection: {\n padding: \"4px 0\",\n },\n menuItem: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"8px\",\n width: \"100%\",\n padding: \"8px 16px\",\n border: \"none\",\n backgroundColor: \"transparent\",\n cursor: \"pointer\",\n fontSize: \"14px\",\n color: \"var(--foreground, #111827)\",\n textDecoration: \"none\",\n fontFamily: \"inherit\",\n transition: \"background-color 150ms\",\n },\n menuItemHover: {\n backgroundColor: \"var(--accent, #f3f4f6)\",\n },\n disconnectItem: {\n color: \"var(--destructive, #dc2626)\",\n },\n separator: {\n height: \"1px\",\n backgroundColor: \"var(--border, #e5e7eb)\",\n margin: 0,\n border: \"none\",\n },\n};\n\nfunction truncateAddress(address: string): string {\n if (address.length <= 13) return address;\n return `${address.slice(0, 7)}...${address.slice(-5)}`;\n}\n\nexport function RenownUserButton({\n address: addressProp,\n username: usernameProp,\n avatarUrl: avatarUrlProp,\n userId: userIdProp,\n onDisconnect: onDisconnectProp,\n style,\n className,\n asChild = false,\n children,\n menuItems,\n}: RenownUserButtonProps) {\n const user = useUser();\n\n const address = addressProp ?? user?.address ?? \"\";\n const username = usernameProp ?? user?.profile?.username ?? user?.ens?.name;\n const avatarUrl =\n avatarUrlProp ?? user?.profile?.userImage ?? user?.ens?.avatarUrl;\n const userId = userIdProp ?? user?.profile?.documentId;\n const onDisconnect = onDisconnectProp ?? (() => void defaultLogout());\n const displayName =\n username ?? (address ? truncateAddress(address) : \"Account\");\n const profileId = userId ?? address;\n\n const [isOpen, setIsOpen] = useState(false);\n const [isHovered, setIsHovered] = useState(false);\n const [isCopied, setIsCopied] = useState(false);\n const [showAbove, setShowAbove] = useState(true);\n const [hoveredItem, setHoveredItem] = useState<string | null>(null);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const closeTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const calculatePosition = useCallback(() => {\n if (!wrapperRef.current) return;\n const rect = wrapperRef.current.getBoundingClientRect();\n const spaceAbove = rect.top;\n setShowAbove(spaceAbove >= POPOVER_HEIGHT + POPOVER_GAP);\n }, []);\n\n const handleMouseEnter = useCallback(() => {\n setIsHovered(true);\n if (closeTimeoutRef.current) {\n clearTimeout(closeTimeoutRef.current);\n closeTimeoutRef.current = null;\n }\n calculatePosition();\n setIsOpen(true);\n }, [calculatePosition]);\n\n const handleMouseLeave = useCallback(() => {\n closeTimeoutRef.current = setTimeout(() => {\n setIsOpen(false);\n setIsHovered(false);\n setHoveredItem(null);\n }, 150);\n }, []);\n\n useEffect(() => {\n return () => {\n if (closeTimeoutRef.current) {\n clearTimeout(closeTimeoutRef.current);\n }\n };\n }, []);\n\n const copyToClipboard = useCallback(async () => {\n try {\n await navigator.clipboard.writeText(address);\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), 2000);\n } catch (err) {\n console.error(\"Failed to copy address:\", err);\n }\n }, [address]);\n\n const triggerElement = asChild ? (\n <Slot data-renown-state=\"authenticated\">{children}</Slot>\n ) : (\n <button\n type=\"button\"\n style={{\n ...styles.trigger,\n ...(isHovered ? styles.triggerHover : {}),\n ...style,\n }}\n aria-label=\"Open account menu\"\n data-renown-state=\"authenticated\"\n >\n {avatarUrl ? (\n <img src={avatarUrl} alt=\"Avatar\" style={styles.avatar} />\n ) : (\n <div style={styles.avatarPlaceholder}>\n <span style={styles.avatarInitial}>\n {(displayName || \"U\")[0].toUpperCase()}\n </span>\n </div>\n )}\n <span style={styles.displayName}>{displayName}</span>\n <ChevronDownIcon\n size={14}\n style={{\n ...styles.chevron,\n ...(isOpen ? styles.chevronOpen : {}),\n }}\n />\n </button>\n );\n\n return (\n <div\n ref={wrapperRef}\n style={styles.wrapper}\n className={className}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n {triggerElement}\n {isOpen && (\n <div\n style={{\n ...styles.popoverBase,\n ...(showAbove\n ? { bottom: `calc(100% + ${POPOVER_GAP}px)` }\n : { top: `calc(100% + ${POPOVER_GAP}px)` }),\n }}\n >\n <div style={styles.header}>\n {username && <div style={styles.headerUsername}>{username}</div>}\n {address && (\n <div style={styles.addressRow}>\n <button\n type=\"button\"\n onClick={() => void copyToClipboard()}\n style={styles.addressButton}\n >\n <div\n style={{\n position: \"relative\",\n display: \"flex\",\n alignItems: \"center\",\n gap: \"4px\",\n width: \"100%\",\n }}\n >\n <div\n style={{\n ...styles.addressText,\n opacity: isCopied ? 0 : 1,\n }}\n >\n <span>{truncateAddress(address)}</span>\n <CopyIcon\n size={12}\n color=\"var(--muted-foreground, #9ca3af)\"\n />\n </div>\n <div\n style={{\n ...styles.copiedText,\n opacity: isCopied ? 1 : 0,\n }}\n >\n Copied!\n </div>\n </div>\n </button>\n </div>\n )}\n </div>\n <div style={styles.menuSection}>\n {profileId && (\n <button\n type=\"button\"\n onClick={() => openRenown(profileId)}\n onMouseEnter={() => setHoveredItem(\"profile\")}\n onMouseLeave={() => setHoveredItem(null)}\n style={{\n ...styles.menuItem,\n ...(hoveredItem === \"profile\" ? styles.menuItemHover : {}),\n }}\n >\n <UserIcon size={14} color=\"var(--muted-foreground, #6b7280)\" />\n View Profile\n </button>\n )}\n {menuItems?.map((item) => (\n <button\n key={item.label}\n type=\"button\"\n onClick={item.onClick}\n onMouseEnter={() => setHoveredItem(item.label)}\n onMouseLeave={() => setHoveredItem(null)}\n style={{\n ...styles.menuItem,\n ...(hoveredItem === item.label ? styles.menuItemHover : {}),\n ...item.style,\n }}\n >\n {item.icon}\n {item.label}\n </button>\n ))}\n </div>\n <hr style={styles.separator} />\n <div style={styles.menuSection}>\n <button\n type=\"button\"\n onClick={onDisconnect}\n onMouseEnter={() => setHoveredItem(\"disconnect\")}\n onMouseLeave={() => setHoveredItem(null)}\n style={{\n ...styles.menuItem,\n ...styles.disconnectItem,\n ...(hoveredItem === \"disconnect\" ? styles.menuItemHover : {}),\n }}\n >\n <DisconnectIcon size={14} color=\"var(--destructive, #dc2626)\" />\n Log out\n </button>\n </div>\n </div>\n )}\n </div>\n );\n}\n","import type { ReactNode } from \"react\";\nimport { type RenownAuth, useRenownAuth } from \"../use-renown-auth.js\";\nimport { RenownLoginButton } from \"./RenownLoginButton.js\";\nimport { RenownUserButton } from \"./RenownUserButton.js\";\n\nexport interface RenownAuthButtonProps {\n className?: string;\n darkMode?: boolean;\n loginContent?: ReactNode;\n userContent?: ReactNode;\n loadingContent?: ReactNode;\n children?: (auth: RenownAuth) => ReactNode;\n}\n\nexport function RenownAuthButton({\n className = \"\",\n darkMode,\n loginContent,\n userContent,\n loadingContent,\n children,\n}: RenownAuthButtonProps) {\n const auth = useRenownAuth();\n\n if (children) {\n return <>{children(auth)}</>;\n }\n\n if (auth.status === \"loading\" || auth.status === \"checking\") {\n if (loadingContent) {\n return <div className={className}>{loadingContent}</div>;\n }\n\n return (\n <div className={className}>\n <div\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: \"8px\",\n padding: \"6px 12px\",\n borderRadius: \"8px\",\n border: \"1px solid var(--border, #f0f0f0)\",\n animation: \"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite\",\n }}\n >\n <div\n style={{\n width: \"28px\",\n height: \"28px\",\n borderRadius: \"50%\",\n backgroundColor: \"var(--secondary, #f0f0f0)\",\n }}\n />\n <div\n style={{\n width: \"80px\",\n height: \"14px\",\n borderRadius: \"4px\",\n backgroundColor: \"var(--secondary, #f0f0f0)\",\n }}\n />\n </div>\n <style>{`@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }`}</style>\n </div>\n );\n }\n\n if (auth.status === \"authorized\") {\n if (userContent) {\n return <div className={className}>{userContent}</div>;\n }\n\n return (\n <div className={className}>\n <RenownUserButton />\n </div>\n );\n }\n\n if (loginContent) {\n return <div className={className}>{loginContent}</div>;\n }\n\n return (\n <div className={className}>\n <RenownLoginButton darkMode={darkMode} />\n </div>\n );\n}\n","import { BrowserKeyStorage, RenownCryptoBuilder } from \"@renown/sdk\";\n\n/**\n * @deprecated Use {@link initRenownCrypto} instead\n *\n * Initialize ConnectCrypto\n * @returns ConnectCrypto instance\n */\nexport async function initConnectCrypto() {\n return initRenownCrypto();\n}\n\n/**\n * Initialize RenownCrypto\n * @returns RenownCrypto instance\n */\nexport async function initRenownCrypto() {\n const keyStorage = await BrowserKeyStorage.create();\n return await new RenownCryptoBuilder().withKeyPairStorage(keyStorage).build();\n}\n","\"use client\";\n\nimport type { RenownSessionProfile } from \"@renown/sdk\";\nimport { createContext, useContext, useEffect, useRef, useState } from \"react\";\nimport { useRenown } from \"../hooks/renown.js\";\nimport { useRenownAuth } from \"./use-renown-auth.js\";\n\nconst DEFAULT_ENDPOINT = \"/api/renown/session\";\nconst DEFAULT_EXPIRES_IN = 7 * 24 * 60 * 60; // 7 days, in seconds\n\nexport interface RenownSessionCookieOptions {\n /** Route handler that sets (POST) / clears (DELETE) the session cookie. */\n endpoint?: string;\n /** Bearer-token lifetime in seconds (default 7 days). */\n expiresIn?: number;\n /** When false the hook is inert (client-only apps with no server cookie). */\n enabled?: boolean;\n}\n\nexport interface RenownSessionCookieState {\n /** True once the cookie reflects the current authenticated user. */\n synced: boolean;\n}\n\n// Mirrors Renown auth into a server-readable session cookie: mints a bearer\n// token on login and POSTs it; DELETEs on logout. Mount inside the provider.\nexport function useRenownSessionCookie(\n options: RenownSessionCookieOptions = {},\n): RenownSessionCookieState {\n const endpoint = options.endpoint ?? DEFAULT_ENDPOINT;\n const expiresIn = options.expiresIn ?? DEFAULT_EXPIRES_IN;\n const enabled = options.enabled ?? true;\n const { user, displayName, avatarUrl } = useRenownAuth();\n const renown = useRenown();\n const address = user?.address;\n const profile = user?.profile;\n // Whether a prior render was authenticated, so we only DELETE on real logout\n // (not on an unauthenticated first load, which must not clobber the cookie).\n const hadUser = useRef(false);\n const [synced, setSynced] = useState(false);\n\n useEffect(() => {\n if (!enabled) return;\n const ready = !!renown && typeof renown.getBearerToken === \"function\";\n if (address && ready) {\n hadUser.current = true;\n setSynced(false);\n let cancelled = false;\n void (async () => {\n try {\n const token = await renown!.getBearerToken({ expiresIn });\n await fetch(endpoint, {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({\n token,\n // The richer fields let verifyRenownSession seed a `user.profile`\n // matching this one, so SSR renders the same identity.\n profile: {\n name: displayName ?? null,\n avatar: avatarUrl ?? null,\n documentId: profile?.documentId ?? null,\n username: profile?.username ?? null,\n userImage: profile?.userImage ?? null,\n } satisfies RenownSessionProfile,\n }),\n });\n if (!cancelled) setSynced(true);\n } catch (error) {\n console.error(\"Failed to sync Renown session cookie\", error);\n }\n })();\n return () => {\n cancelled = true;\n };\n }\n if (!address) {\n setSynced(false);\n if (hadUser.current) {\n hadUser.current = false;\n void fetch(endpoint, { method: \"DELETE\" }).catch(() => {});\n }\n }\n }, [\n address,\n displayName,\n avatarUrl,\n profile?.documentId,\n profile?.username,\n profile?.userImage,\n renown,\n endpoint,\n expiresIn,\n enabled,\n ]);\n\n return { synced };\n}\n\nconst RenownSessionSyncedContext = createContext(false);\nexport { RenownSessionSyncedContext };\n\n// True once the session cookie reflects the current authenticated user — gate a\n// post-login navigation on this so the server-side proxy sees the cookie.\nexport function useRenownSessionSynced(): boolean {\n return useContext(RenownSessionSyncedContext);\n}\n","import type { IRenown } from \"@renown/sdk\";\nimport { RenownBuilder } from \"@renown/sdk\";\nimport { useEffect, useRef } from \"react\";\nimport { loading } from \"../hooks/loading.js\";\nimport { addRenownEventHandler, setRenown } from \"../hooks/renown.js\";\nimport { login } from \"./session.js\";\n\nexport interface RenownInitOptions {\n appName: string;\n /** Prefix for localStorage keys, so multiple apps can share a domain. */\n namespace?: string;\n url?: string;\n switchboardUrl?: string;\n /** Re-check the restored credential against the source (default \"always\"). */\n revalidate?: \"always\" | \"never\";\n /** Chain id credentials are issued on (default 1). It is part of the user's DID, so sign-in from a wallet on another chain is rejected. */\n chainId?: number;\n}\n\nasync function initRenown(\n appName: string,\n namespace: string | undefined,\n url: string | undefined,\n switchboardUrl: string | undefined,\n revalidate: \"always\" | \"never\",\n chainId: number | undefined,\n): Promise<IRenown> {\n addRenownEventHandler();\n setRenown(loading);\n\n const builder = new RenownBuilder(appName, {\n basename: namespace,\n baseUrl: url,\n switchboardUrl,\n revalidate,\n chainId,\n });\n // Browser build() fires a non-blocking credential revalidate (when enabled)\n // plus a profile refresh; init stays optimistic either way.\n const renown = await builder.build();\n setRenown(renown);\n\n await login(undefined, renown);\n\n return renown;\n}\n\n/**\n * Hook that initializes the Renown SDK.\n * Call once at the top of your app. Options are read only on first mount.\n * Returns a promise that resolves with the Renown instance.\n *\n * @example\n * ```tsx\n * function App() {\n * const renownPromise = useRenownInit({ appName: \"my-app\" });\n * return <MyApp />;\n * }\n * ```\n */\nexport function useRenownInit({\n appName,\n namespace,\n url,\n switchboardUrl,\n revalidate = \"always\",\n chainId,\n}: RenownInitOptions): Promise<IRenown> {\n // Stable promise returned every render; resolved later by the init effect.\n const promiseRef = useRef<PromiseWithResolvers<IRenown> | null>(null);\n promiseRef.current ??= Promise.withResolvers<IRenown>();\n\n const initRef = useRef(false);\n\n // Init must run in an effect, not during render: setRenown() mutates the\n // useSyncExternalStore-backed store, which would update subscribers mid-render.\n useEffect(() => {\n if (initRef.current) return;\n initRef.current = true;\n\n initRenown(appName, namespace, url, switchboardUrl, revalidate, chainId)\n .then(promiseRef.current!.resolve)\n .catch(promiseRef.current!.reject);\n }, []);\n\n return promiseRef.current.promise;\n}\n","import { type RenownInitOptions, useRenownInit } from \"./use-renown-init.js\";\n\nexport interface RenownProps extends RenownInitOptions {\n onError?: (error: unknown) => void;\n}\n\n/**\n * Side-effect component that initializes the Renown SDK.\n * Renders nothing — place it alongside your app tree.\n *\n * @example\n * ```tsx\n * function App() {\n * return (\n * <>\n * <Renown appName=\"my-app\" onError={console.error} />\n * <MyApp />\n * </>\n * );\n * }\n * ```\n */\nexport function Renown({ onError, ...initOptions }: RenownProps) {\n useRenownInit(initOptions).catch(onError ?? console.error);\n return null;\n}\n","import type { WalletAdapterMeta, WalletSession } from \"@renown/sdk/wallet\";\nimport { isWalletRedirectReturn } from \"@renown/sdk/wallet\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { logger } from \"document-model\";\nimport { useRenown, useUser } from \"../hooks/renown.js\";\nimport { completeSignIn } from \"./session.js\";\n\nexport interface CompleteRedirectSignIn {\n /** Session sink for the adapter bridges; a silent session arms auto sign-in. */\n onSession: (id: string, session: WalletSession | undefined) => void;\n}\n\n// Completes Renown sign-in from the session an adapter pushes on a full-page\n// OAuth return (the original connect() promise died with the pre-redirect page).\nexport function useCompleteRedirectSignIn(\n metas: WalletAdapterMeta[],\n): CompleteRedirectSignIn {\n const renown = useRenown();\n const user = useUser();\n // Latest adapter session that can sign silently (Privy embedded wallet). Non-\n // silent sessions (injected wallets) never auto-sign — that'd pop a prompt.\n const [pendingSilentSession, setPendingSilentSession] =\n useState<WalletSession | null>(null);\n // Arm auto sign-in for the OAuth redirect return only, consumed once. A silent\n // session that lingers after logout must NOT hijack an explicit wallet login.\n const oauthReturnRef = useRef(\n typeof window !== \"undefined\" &&\n isWalletRedirectReturn(window.location.search, metas),\n );\n\n const onSession = useCallback(\n (_id: string, session: WalletSession | undefined) => {\n setPendingSilentSession(session?.canSignSilently ? session : null);\n },\n [],\n );\n\n // Complete sign-in from the session Privy pushes on an OAuth return, once the\n // SDK is ready; disarm as soon as it's handled or a user is present.\n useEffect(() => {\n if (!oauthReturnRef.current) return;\n if (user) {\n oauthReturnRef.current = false;\n return;\n }\n if (!pendingSilentSession || !renown) return;\n oauthReturnRef.current = false;\n void Promise.resolve(completeSignIn(pendingSilentSession)).catch(\n (error: unknown) =>\n logger.error(error instanceof Error ? error.message : String(error)),\n );\n }, [pendingSilentSession, renown, user]);\n\n return { onSession };\n}\n","import { isWalletRedirectReturn, resolveAdapters } from \"@renown/sdk/wallet\";\nimport type {\n LoginMethod,\n WalletAdapter,\n WalletAdapterDescriptor,\n WalletAdapterMeta,\n WalletController,\n WalletSession,\n WalletTheme,\n} from \"@renown/sdk/wallet\";\nimport {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ComponentType,\n type ReactNode,\n} from \"react\";\nimport { useUser } from \"../hooks/renown.js\";\nimport {\n failWalletActivation,\n setActiveWalletController,\n setWalletActivator,\n setWalletDescriptors,\n whenWalletControllerReady,\n} from \"./wallet-registry.js\";\nimport { useCompleteRedirectSignIn } from \"./use-complete-redirect-sign-in.js\";\n\n// A live controller paired with the meta that declares which methods it serves.\ninterface MountedAdapter {\n meta: WalletAdapterMeta;\n controller: WalletController;\n}\n\n// Merge per-adapter controllers into one. A requested method routes to the\n// adapter whose meta declares it; a method-less connect uses the first adapter.\nfunction mergeControllers(\n mounted: MountedAdapter[],\n): WalletController | undefined {\n if (mounted.length === 0) return undefined;\n return {\n connect(method?: LoginMethod): Promise<WalletSession> {\n if (method) {\n const target = mounted.find((m) =>\n m.meta.supportedMethods.includes(method),\n );\n if (!target) {\n throw new Error(\n `No wallet adapter supports login method \"${method}\"`,\n );\n }\n return target.controller.connect(method);\n }\n const chosen = mounted.at(0);\n if (!chosen) throw new Error(\"No wallet adapter available\");\n return chosen.controller.connect(method);\n },\n async disconnect(): Promise<void> {\n await Promise.all(mounted.map((m) => m.controller.disconnect()));\n },\n getSession(): WalletSession | undefined {\n for (const { controller } of mounted) {\n const session = controller.getSession();\n if (session) return session;\n }\n return undefined;\n },\n };\n}\n\n// Calls one adapter's controller hook inside its Provider and publishes it to\n// the module-level registry; unregisters on unmount.\nfunction AdapterControllerBridge(props: {\n adapter: WalletAdapter;\n onController: (\n meta: WalletAdapterMeta,\n controller: WalletController | undefined,\n ) => void;\n onSession: (id: string, session: WalletSession | undefined) => void;\n}) {\n const { adapter, onController, onSession } = props;\n const { meta } = adapter;\n const controller = adapter.useController();\n useEffect(() => {\n onController(meta, controller);\n return () => onController(meta, undefined);\n }, [meta, controller, onController]);\n // Adapters that push session changes (Privy) let sign-in complete on an OAuth\n // return, where the connect() promise died with the pre-redirect page.\n useEffect(() => {\n if (!controller.subscribe) return;\n return controller.subscribe((session) => onSession(meta.id, session));\n }, [meta.id, controller, onSession]);\n return null;\n}\n\nexport interface RenownWalletProviderProps {\n /** Wallet adapter descriptors, e.g. `[privyAdapter({ appId }), rainbowAdapter({})]` from `@renown/sdk/wallet/<id>`. Each descriptor's wallet library loads lazily on first login. Keep the array stable (module scope or `useMemo`) — it is snapshotted on mount. `undefined`/empty = redirect-only. */\n adapters: WalletAdapterDescriptor[] | undefined;\n /** Theme handed to each adapter UI: `\"light\"`, `\"dark\"`, or `{ mode, accentColor?, accentColorForeground? }`. */\n theme?: WalletTheme;\n children: ReactNode;\n}\n\n/** Drop-in provider for Renown in-page wallet sign-in: registers the login activator, lazy-mounts the configured adapters on first click, and merges their controllers for {@link useRenownAuth}. Full walkthrough + examples: the `@powerhousedao/reactor-browser` README (\"Renown in-page sign-in\") and the Academy Renown authentication guide. Pair with {@link useRenownLoginMethods} to build the login UI. */\nexport function RenownWalletProvider({\n adapters: adaptersConfig,\n theme,\n children,\n}: RenownWalletProviderProps) {\n const [descriptors] = useState(() => adaptersConfig);\n const user = useUser();\n // The snapshot above drops every array after the first; say so in dev.\n useEffect(() => {\n // `process` need not exist in a browser bundle.\n if (\n typeof process !== \"undefined\" &&\n process.env?.NODE_ENV === \"production\"\n )\n return;\n if (adaptersConfig === descriptors) return;\n console.error(\n \"RenownWalletProvider: the `adapters` array changed identity after mount, and the new value was ignored. Build it once at module scope (or memoize it) — see the @powerhousedao/reactor-browser README.\",\n );\n }, [adaptersConfig, descriptors]);\n // For useRenownLoginMethods, callable from outside this subtree.\n useEffect(() => {\n setWalletDescriptors(descriptors);\n return () => setWalletDescriptors(undefined);\n }, [descriptors]);\n // Eager metadata: enough to detect a redirect return and list login methods\n // without loading any wallet library.\n const metas = useMemo(\n () => descriptors?.map((descriptor) => descriptor.meta) ?? [],\n [descriptors],\n );\n // Mount on a login click / OAuth redirect return, and latch on authentication so\n // we stay mounted for the page's life — a logout->login remount breaks Privy's modal.\n const [activated, setActivated] = useState(\n () =>\n typeof window !== \"undefined\" &&\n isWalletRedirectReturn(window.location.search, metas),\n );\n if (user && !activated) setActivated(true);\n const active = activated;\n const [adapters, setAdapters] = useState<WalletAdapter[] | null>(null);\n const mountedRef = useRef(new Map<string, MountedAdapter>());\n // Auto-completes sign-in from the session an adapter pushes on an OAuth return.\n const { onSession } = useCompleteRedirectSignIn(metas);\n\n // Register an activator so login() can mount + lazy-load adapters on click.\n useEffect(() => {\n if (!descriptors) return;\n setWalletActivator(() => {\n setActivated(true);\n return whenWalletControllerReady();\n });\n return () => setWalletActivator(undefined);\n }, [descriptors]);\n\n // Resolve + mount adapters only once activated; each descriptor's dynamic\n // import (and the wallet library it pulls) fires here, on demand.\n useEffect(() => {\n if (!active || !descriptors) return;\n let cancelled = false;\n void resolveAdapters(descriptors)\n .then((resolved) => {\n if (cancelled) return;\n if (resolved.length === 0) {\n failWalletActivation(\n new Error(\n \"No wallet adapters were configured for in-page sign-in.\",\n ),\n );\n return;\n }\n setAdapters(resolved);\n })\n .catch((error: unknown) => {\n if (!cancelled) {\n failWalletActivation(\n error instanceof Error ? error : new Error(String(error)),\n );\n }\n });\n return () => {\n cancelled = true;\n };\n }, [active, descriptors]);\n\n const onController = useCallback(\n (meta: WalletAdapterMeta, controller: WalletController | undefined) => {\n if (controller) mountedRef.current.set(meta.id, { meta, controller });\n else mountedRef.current.delete(meta.id);\n setActiveWalletController(\n mergeControllers(Array.from(mountedRef.current.values())),\n );\n },\n [],\n );\n\n // Provider tree wraps only the adapter bridges (each library's modal portals\n // to <body>), never `children`, so activating login never remounts the app.\n const walletTree =\n descriptors && active && adapters && adapters.length > 0\n ? adapters.reduceRight<ReactNode>(\n (acc, adapter) => {\n const Provider = adapter.Provider as ComponentType<{\n children: ReactNode;\n theme?: WalletTheme;\n }>;\n return <Provider theme={theme}>{acc}</Provider>;\n },\n <>\n {adapters.map((adapter) => (\n <AdapterControllerBridge\n key={adapter.meta.id}\n adapter={adapter}\n onController={onController}\n onSession={onSession}\n />\n ))}\n </>,\n )\n : null;\n\n return (\n <>\n {children}\n {walletTree}\n </>\n );\n}\n","\"use client\";\n\nimport { readPersistedUser, type User } from \"@renown/sdk\";\nimport type { WalletAdapterDescriptor, WalletTheme } from \"@renown/sdk/wallet\";\nimport { useMemo, useSyncExternalStore, type ReactNode } from \"react\";\nimport {\n RENOWN_INITIAL_ANONYMOUS,\n RENOWN_INITIAL_UNKNOWN,\n RenownInitialUserProvider,\n type RenownInitialAuth,\n} from \"./initial-user.js\";\nimport { Renown } from \"./renown-init.js\";\nimport {\n RenownSessionSyncedContext,\n useRenownSessionCookie,\n} from \"./use-renown-session-cookie.js\";\nimport { RenownWalletProvider } from \"./wallet-provider.js\";\n\nexport interface RenownProviderProps {\n appName: string;\n /** Prefix for localStorage keys, so multiple apps can share a domain. */\n namespace?: string;\n url?: string;\n switchboardUrl?: string;\n /** Wallet adapter descriptors for in-page sign-in (see {@link RenownWalletProvider}); omit for redirect-only. */\n adapters?: WalletAdapterDescriptor[];\n theme?: WalletTheme;\n /** Re-check the restored credential against the source (default \"always\"). */\n revalidate?: \"always\" | \"never\";\n /** Chain id credentials are issued on (default 1). Keep the adapters' chains in step: it is part of the user's DID, so a wallet on another chain is rejected. */\n chainId?: number;\n /** Server-resolved session (SSR); its presence seeds from the cookie + enables cookie sync. Omit for client-only (seed = localStorage). */\n session?: { user?: User } | null;\n /** Endpoint for the session-cookie sync (SSR). Default /api/renown/session. */\n sessionEndpoint?: string;\n onError?: (error: unknown) => void;\n children: ReactNode;\n}\n\nconst subscribeNothing = () => () => {};\n\n// Runs the cookie sync and publishes its `synced` state to descendants, so a\n// post-login navigation can wait for the cookie (see useRenownSessionSynced).\nfunction SessionSync({\n enabled,\n endpoint,\n children,\n}: {\n enabled: boolean;\n endpoint?: string;\n children: ReactNode;\n}) {\n const { synced } = useRenownSessionCookie({ endpoint, enabled });\n return (\n <RenownSessionSyncedContext.Provider value={synced}>\n {children}\n </RenownSessionSyncedContext.Provider>\n );\n}\n\n// One-stop Renown provider: initializes the SDK, seeds the first render (cookie\n// for SSR, localStorage for client-only), mounts wallets, and syncs the cookie.\nexport function RenownProvider({\n appName,\n namespace,\n url,\n switchboardUrl,\n adapters,\n theme,\n revalidate,\n chainId,\n session,\n sessionEndpoint,\n onError,\n children,\n}: RenownProviderProps) {\n const isServerSession = session !== undefined;\n // Hydration must match SSR, so the cookie answers first and localStorage\n // takes over once mounted.\n const mounted = useSyncExternalStore(\n subscribeNothing,\n () => true,\n () => false,\n );\n const seed = useMemo<RenownInitialAuth>(() => {\n // localStorage holds the credential the SDK actually restores; the cookie is\n // a display hint that is server-only and can go stale independently.\n if (mounted) {\n const persisted = readPersistedUser(namespace);\n return persisted\n ? { state: \"authenticated\", user: persisted }\n : RENOWN_INITIAL_ANONYMOUS;\n }\n if (!isServerSession) return RENOWN_INITIAL_UNKNOWN;\n return session?.user\n ? { state: \"authenticated\", user: session.user }\n : RENOWN_INITIAL_ANONYMOUS;\n }, [mounted, isServerSession, session, namespace]);\n\n return (\n <>\n <Renown\n appName={appName}\n namespace={namespace}\n url={url}\n switchboardUrl={switchboardUrl}\n revalidate={revalidate}\n chainId={chainId}\n onError={onError}\n />\n <RenownInitialUserProvider initialAuth={seed}>\n <RenownWalletProvider adapters={adapters} theme={theme}>\n <SessionSync enabled={isServerSession} endpoint={sessionEndpoint}>\n {children}\n </SessionSync>\n </RenownWalletProvider>\n </RenownInitialUserProvider>\n </>\n );\n}\n","import { LoginMethod } from \"@renown/sdk/wallet\";\nimport { useMemo, useSyncExternalStore } from \"react\";\nimport {\n getServerWalletDescriptors,\n getWalletDescriptors,\n subscribeWalletDescriptors,\n} from \"./wallet-registry.js\";\n\nexport interface RenownLoginMethod {\n id: LoginMethod;\n label: string;\n}\n\nconst DEFAULT_METHOD_LABELS: Partial<Record<LoginMethod, string>> = {\n [LoginMethod.WALLET]: \"Connect a Wallet\",\n [LoginMethod.GOOGLE]: \"Continue with Google\",\n [LoginMethod.EMAIL]: \"Continue with Email\",\n [LoginMethod.APPLE]: \"Continue with Apple\",\n};\n\n/** The login methods the mounted {@link RenownWalletProvider}'s adapters offer, for building a login UI. Reads each descriptor's eager metadata only — no wallet libraries load. Buttons follow the provider's descriptor array order, deduped; empty when no provider is mounted (redirect-only). Wire each to `useRenownAuth().login(undefined, id)`. Labels are overridable. See the reactor-browser README + Academy Renown auth guide. */\nexport function useRenownLoginMethods(\n labels?: Partial<Record<LoginMethod, string>>,\n): RenownLoginMethod[] {\n const descriptors = useSyncExternalStore(\n subscribeWalletDescriptors,\n getWalletDescriptors,\n getServerWalletDescriptors,\n );\n return useMemo(() => {\n const seen = new Set<LoginMethod>();\n const methods: RenownLoginMethod[] = [];\n for (const { meta } of descriptors) {\n for (const id of meta.supportedMethods) {\n if (seen.has(id)) continue;\n seen.add(id);\n methods.push({\n id,\n label: labels?.[id] ?? DEFAULT_METHOD_LABELS[id] ?? id,\n });\n }\n }\n return methods;\n }, [descriptors, labels]);\n}\n"],"mappings":";;;;;;;AAOA,IAAI;AACJ,IAAI,oBAGC,EAAE;AACP,IAAI;AAEJ,SAAgB,0BACd,YACM;AACN,0BAAyB;AACzB,KAAI,YAAY;EACd,MAAM,UAAU;AAChB,sBAAoB,EAAE;AACtB,UAAQ,SAAS,EAAE,cAAc,QAAQ,WAAW,CAAC;;;AAMzD,SAAgB,qBAAqB,OAAoB;CACvD,MAAM,UAAU;AAChB,qBAAoB,EAAE;AACtB,SAAQ,SAAS,EAAE,aAAa,OAAO,MAAM,CAAC;;AAGhD,SAAgB,4BAA0D;AACxE,QAAO;;AAKT,SAAgB,mBACd,WACM;AACN,mBAAkB;;AAGpB,SAAgB,qBAEF;AACZ,QAAO;;AAKT,SAAgB,4BAAuD;AACrE,KAAI,uBAAwB,QAAO,QAAQ,QAAQ,uBAAuB;AAC1E,QAAO,IAAI,SAAS,SAAS,WAC3B,kBAAkB,KAAK;EAAE;EAAS;EAAQ,CAAC,CAC5C;;AAKH,MAAM,iBAAqD,OAAO,OAAO,EAAE,CAAC;AAS5E,MAAM,mBAAmB,OAAO,IAC9B,2DACD;AAID,SAAS,kBAAmC;CAC1C,MAAM,OAAO;AAIb,QAAQ,KAAK,sBAAsB;EACjC,aAAa;EACb,2BAAW,IAAI,KAAK;EACrB;;AAGH,SAAgB,qBACd,aACM;CACN,MAAM,QAAQ,iBAAiB;CAC/B,MAAM,OAAO,eAAe;AAC5B,KAAI,SAAS,MAAM,YAAa;A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