@powerhousedao/reactor-browser 6.2.2-dev.24 → 6.2.2-dev.25
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 +23 -9
- package/dist/{index-C0wfUnfF.d.ts → index-BlPURnJv.d.ts} +10 -4
- package/dist/{index-C0wfUnfF.d.ts.map → index-BlPURnJv.d.ts.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{renown-BDH93sB5.js → renown-Bihtk0Mj.js} +50 -11
- package/dist/renown-Bihtk0Mj.js.map +1 -0
- package/dist/src/renown/index.d.ts +1 -1
- package/dist/src/renown/index.js +1 -1
- package/package.json +9 -9
- package/dist/renown-BDH93sB5.js.map +0 -1
package/README.md
CHANGED
|
@@ -549,6 +549,13 @@ const ADAPTERS = [
|
|
|
549
549
|
</RenownProvider>;
|
|
550
550
|
```
|
|
551
551
|
|
|
552
|
+
**One chain per app.** `chainId` (default `1`) is the chain credentials are issued
|
|
553
|
+
on, and it is part of the user's DID (`did:pkh:eip155:<chainId>:<address>`), so the
|
|
554
|
+
same wallet on another chain is a different user. Sign-in from a wallet on a
|
|
555
|
+
different chain is rejected, so if you set `chainId`, pass matching `chains` to the
|
|
556
|
+
wallet adapters — that is what makes the wallet UI prompt a network switch rather
|
|
557
|
+
than failing at the end of the flow.
|
|
558
|
+
|
|
552
559
|
**Install only the peers of the adapters you import.** Importing
|
|
553
560
|
`@renown/sdk/wallet/rainbow` is what makes RainbowKit a build requirement; an app
|
|
554
561
|
that only imports `@renown/sdk/wallet/privy` needs no RainbowKit and no bundler
|
|
@@ -557,8 +564,9 @@ aliases. See the `@renown/sdk` README for the per-adapter peer list.
|
|
|
557
564
|
The provider is **SSR-safe** — it renders on the server without `ssr: false`;
|
|
558
565
|
the wallet libraries only load client-side on the first login click.
|
|
559
566
|
|
|
560
|
-
Then build the login UI with `useRenownLoginMethods` (
|
|
561
|
-
|
|
567
|
+
Then build the login UI with `useRenownLoginMethods` (the button list, read from
|
|
568
|
+
the mounted provider) and `useRenownAuth` (login + user state). Neither takes the
|
|
569
|
+
adapters, so the login UI need not sit inside the provider's subtree:
|
|
562
570
|
|
|
563
571
|
```tsx
|
|
564
572
|
import {
|
|
@@ -566,9 +574,9 @@ import {
|
|
|
566
574
|
useRenownLoginMethods,
|
|
567
575
|
} from "@powerhousedao/reactor-browser/renown";
|
|
568
576
|
|
|
569
|
-
function Login(
|
|
577
|
+
function Login() {
|
|
570
578
|
const { user, login, pending, error, logout } = useRenownAuth();
|
|
571
|
-
const methods = useRenownLoginMethods(
|
|
579
|
+
const methods = useRenownLoginMethods();
|
|
572
580
|
if (user) return <button onClick={() => void logout()}>Log out</button>;
|
|
573
581
|
return (
|
|
574
582
|
<>
|
|
@@ -703,12 +711,18 @@ adapter bridges (each library's modal portals to `<body>`), never your
|
|
|
703
711
|
`children`, so activating login never remounts your app. Props: `adapters`
|
|
704
712
|
(`WalletAdapterDescriptor[]`), `theme?`, `children`.
|
|
705
713
|
|
|
706
|
-
### `useRenownLoginMethods(
|
|
714
|
+
### `useRenownLoginMethods(labels?)`
|
|
715
|
+
|
|
716
|
+
Returns `{ id, label }[]` — one per login method the mounted
|
|
717
|
+
`RenownWalletProvider`'s adapters offer, deduped, in descriptor-array order —
|
|
718
|
+
reading each descriptor's eager metadata only (no wallet libraries load).
|
|
719
|
+
Reorder the array you pass the provider to reorder the buttons. Override labels
|
|
720
|
+
via the argument. Wire each to `login(undefined, id)`.
|
|
707
721
|
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
722
|
+
The descriptors come from the provider, not from a prop or context, so a login UI
|
|
723
|
+
mounted **outside** the provider's subtree still gets the full list — Connect
|
|
724
|
+
renders its login modal as a sibling of the app. Empty when no provider is
|
|
725
|
+
mounted, which is the redirect-only case.
|
|
712
726
|
|
|
713
727
|
### Next.js
|
|
714
728
|
|
|
@@ -599,6 +599,8 @@ interface RenownInitOptions {
|
|
|
599
599
|
switchboardUrl?: string;
|
|
600
600
|
/** Re-check the restored credential against the source (default "always"). */
|
|
601
601
|
revalidate?: "always" | "never";
|
|
602
|
+
/** 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. */
|
|
603
|
+
chainId?: number;
|
|
602
604
|
}
|
|
603
605
|
/**
|
|
604
606
|
* Hook that initializes the Renown SDK.
|
|
@@ -618,7 +620,8 @@ declare function useRenownInit({
|
|
|
618
620
|
namespace,
|
|
619
621
|
url,
|
|
620
622
|
switchboardUrl,
|
|
621
|
-
revalidate
|
|
623
|
+
revalidate,
|
|
624
|
+
chainId
|
|
622
625
|
}: RenownInitOptions): Promise<IRenown>;
|
|
623
626
|
//#endregion
|
|
624
627
|
//#region src/renown/renown-init.d.ts
|
|
@@ -658,6 +661,8 @@ interface RenownProviderProps {
|
|
|
658
661
|
theme?: WalletTheme;
|
|
659
662
|
/** Re-check the restored credential against the source (default "always"). */
|
|
660
663
|
revalidate?: "always" | "never";
|
|
664
|
+
/** 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. */
|
|
665
|
+
chainId?: number;
|
|
661
666
|
/** Server-resolved session (SSR); its presence seeds from the cookie + enables cookie sync. Omit for client-only (seed = localStorage). */
|
|
662
667
|
session?: {
|
|
663
668
|
user?: User;
|
|
@@ -675,6 +680,7 @@ declare function RenownProvider({
|
|
|
675
680
|
adapters,
|
|
676
681
|
theme,
|
|
677
682
|
revalidate,
|
|
683
|
+
chainId,
|
|
678
684
|
session,
|
|
679
685
|
sessionEndpoint,
|
|
680
686
|
onError,
|
|
@@ -701,8 +707,8 @@ interface RenownLoginMethod {
|
|
|
701
707
|
id: LoginMethod;
|
|
702
708
|
label: string;
|
|
703
709
|
}
|
|
704
|
-
/**
|
|
705
|
-
declare function useRenownLoginMethods(
|
|
710
|
+
/** 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. */
|
|
711
|
+
declare function useRenownLoginMethods(labels?: Partial<Record<LoginMethod, string>>): RenownLoginMethod[];
|
|
706
712
|
//#endregion
|
|
707
713
|
export { BrowserReactorClientModule as $, PHSentryGlobalConfig as $t, VERIFIABLE_CREDENTIAL_EIP712_TYPE as A, PendingInstallation as At, RenownUserButtonMenuItem as B, PHDocumentEditorConfigHooks as Bt, CREDENTIAL_SUBJECT_TYPE as C, TimelineDividerItem as Ct, RENOWN_CHAIN_ID as D, FailedInstallation as Dt, ISSUER_TYPE as E, DiscoveryEventListener as Et, DisconnectIcon as F, PHAppConfigHooks as Ft, RenownAuthButtonProps as G, PHGlobalConfigHooks as Gt, RenownLoginButton as H, PHDocumentEditorConfigSetters as Ht, RenownLogo as I, PHAppConfigKey as It, useDid as J, PHGlobalConfigSetters as Jt, addRenownEventHandler as K, PHGlobalConfigHooksForKey as Kt, SpinnerIcon as L, PHAppConfigSetters as Lt, initRenownCrypto as M, FullPHGlobalConfig as Mt, ChevronDownIcon as N, PHAnalyticsGlobalConfig as Nt, RENOWN_NETWORK_ID as O, FailedInstallationReason as Ot, CopyIcon as P, PHAppConfig as Pt, AddPHGlobalEventHandler as Q, PHRenownGlobalConfig as Qt, UserIcon as R, PHCommonGlobalConfig as Rt, CREDENTIAL_SCHEMA_EIP712_TYPE as S, TimelineBarItem as St, DOMAIN_TYPE as T, DiscoveryEvent as Tt, RenownLoginButtonProps as U, PHDrivesGlobalConfig as Ut, RenownUserButtonProps as V, PHDocumentEditorConfigKey as Vt, RenownAuthButton as W, PHGlobalConfig as Wt, useRenown as X, PHProcessorsGlobalConfig as Xt, useLoginStatus as Y, PHGlobalConfigSettersForKey as Yt, useUser as Z, PHRelationalProcessorsGlobalConfig as Zt, RenownInitialAuth as _, IPackagesListener as _t, RenownProvider as a, RenownAuthResolution as an, PHGlobalValue as at, useRenownInitialAuth as b, PHToastOptions as bt, RenownProps as c, useRenownAuthAsync as cn, UsePHGlobalValue as ct, RenownSessionCookieOptions as d, IDocumentCache as dn, DraggingNode as dt, login as en, BrowserReactorModule as et, RenownSessionCookieState as f, PromiseState as fn, addDraggingNodeEventHandler as ft, RENOWN_INITIAL_UNKNOWN as g, IPackageManager as gt, RENOWN_INITIAL_ANONYMOUS as h, IPackageListerUnsubscribe as ht, RenownWalletProviderProps as i, RenownAuthAsync as in, PHGlobalKey as it, initConnectCrypto as j, PHModal as jt, RENOWN_URL as k, IPackageDiscoveryService as kt, RenownInitOptions as l, DocumentDispatch as ln, WorkerReactorClientModule as lt, useRenownSessionSynced as m, RejectedPromise as mn, useDropNode as mt, useRenownLoginMethods as n, openRenown as nn, PHGlobal as nt, RenownProviderProps as o, RenownAuthStatus as on, SetEvent as ot, useRenownSessionCookie as p, PromiseWithState as pn, useDragNode as pt, setRenown as q, PHGlobalConfigKey as qt, RenownWalletProvider as r, RenownAuth as rn, PHGlobalEventHandlerAdders as rt, Renown as s, useRenownAuth as sn, SetPHGlobalValue as st, RenownLoginMethod as t, logout as tn, LOADING as tt, useRenownInit as u, FulfilledPromise as un, WorkerReactorModule as ut, RenownInitialUserProvider as v, PackageManagerInstallResult as vt, CREDENTIAL_TYPES as w, TimelineItem as wt, useRenownInitialUser as x, PHToastType as xt, RenownInitialUserProviderProps as y, PHToastFn as yt, RenownUserButton as z, PHDocumentEditorConfig as zt };
|
|
708
|
-
//# sourceMappingURL=index-
|
|
714
|
+
//# sourceMappingURL=index-BlPURnJv.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-C0wfUnfF.d.ts","names":[],"sources":["../src/types/documents.ts","../src/renown/use-renown-auth.ts","../src/renown/session.ts","../src/types/config.ts","../src/types/modals.ts","../src/types/package-discovery.ts","../src/types/timeline.ts","../src/types/toast.ts","../src/types/vetra.ts","../src/hooks/node-drag-and-drop.ts","../src/types/global.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":";;;;;;;;;;;;;;;;KAMY,gBAAA,iBAAiC,MAAA,KAC3C,eAAA,EACI,OAAA,GACA,OAAA,KACA,cAAA,GACA,cAAA,gBAEJ,QAAA,IAAY,MAAA,EAAQ,KAAA,aACpB,SAAA,IAAa,MAAA,EAAQ,UAAA;AAAA,KAGX,gBAAA,MAAsB,OAAA,CAAQ,CAAA,IAAK,YAAA,CAAa,CAAA;AAAA,KAEhD,gBAAA,MAAsB,OAAA,CAAQ,CAAA;EACxC,MAAA;EACA,KAAA,EAAO,CAAA;AAAA;AAAA,KAGG,eAAA,MAAqB,OAAA,CAAQ,CAAA;EACvC,MAAA;EACA,MAAA;AAAA;AAAA,KAGU,YAAA;EAEN,MAAA;AAAA;EAEA,MAAA;EAAqB,KAAA,EAAO,CAAA;AAAA;EAC5B,MAAA;EAAoB,MAAA;AAAA;AAAA,UAET,cAAA;EACf,GAAA,CAAI,EAAA,UAAY,OAAA,aAAoB,OAAA,CAAQ,UAAA;EAC5C,QAAA,CAAS,GAAA,YAAe,OAAA,aAAoB,OAAA,CAAQ,UAAA;EACpD,SAAA,CAAU,EAAA,qBAAuB,QAAA;AAAA;;;KCvBvB,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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AA;EACJ,KAAA;AAAA;;iBAWc,qBAAA,CACd,QAAA,EAAU,uBAAA,gBACV,MAAA,GAAS,OAAA,CAAQ,MAAA,CAAO,WAAA,aACvB,iBAAA"}
|
|
1
|
+
{"version":3,"file":"index-BlPURnJv.d.ts","names":[],"sources":["../src/types/documents.ts","../src/renown/use-renown-auth.ts","../src/renown/session.ts","../src/types/config.ts","../src/types/modals.ts","../src/types/package-discovery.ts","../src/types/timeline.ts","../src/types/toast.ts","../src/types/vetra.ts","../src/hooks/node-drag-and-drop.ts","../src/types/global.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":";;;;;;;;;;;;;;;;KAMY,gBAAA,iBAAiC,MAAA,KAC3C,eAAA,EACI,OAAA,GACA,OAAA,KACA,cAAA,GACA,cAAA,gBAEJ,QAAA,IAAY,MAAA,EAAQ,KAAA,aACpB,SAAA,IAAa,MAAA,EAAQ,UAAA;AAAA,KAGX,gBAAA,MAAsB,OAAA,CAAQ,CAAA,IAAK,YAAA,CAAa,CAAA;AAAA,KAEhD,gBAAA,MAAsB,OAAA,CAAQ,CAAA;EACxC,MAAA;EACA,KAAA,EAAO,CAAA;AAAA;AAAA,KAGG,eAAA,MAAqB,OAAA,CAAQ,CAAA;EACvC,MAAA;EACA,MAAA;AAAA;AAAA,KAGU,YAAA;EAEN,MAAA;AAAA;EAEA,MAAA;EAAqB,KAAA,EAAO,CAAA;AAAA;EAC5B,MAAA;EAAoB,MAAA;AAAA;AAAA,UAET,cAAA;EACf,GAAA,CAAI,EAAA,UAAY,OAAA,aAAoB,OAAA,CAAQ,UAAA;EAC5C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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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as getAnalyticsStore, i as createAnalyticsStore, n as IPowerhouseAnalytics, r as CreateStoreOptions } from "./types-CPV0Cnsy.js";
|
|
2
|
-
import { $ as BrowserReactorClientModule, $t as PHSentryGlobalConfig, A as VERIFIABLE_CREDENTIAL_EIP712_TYPE, At as PendingInstallation, B as RenownUserButtonMenuItem, Bt as PHDocumentEditorConfigHooks, C as CREDENTIAL_SUBJECT_TYPE, Ct as TimelineDividerItem, D as RENOWN_CHAIN_ID, Dt as FailedInstallation, E as ISSUER_TYPE, Et as DiscoveryEventListener, F as DisconnectIcon, Ft as PHAppConfigHooks, G as RenownAuthButtonProps, Gt as PHGlobalConfigHooks, H as RenownLoginButton, Ht as PHDocumentEditorConfigSetters, I as RenownLogo, It as PHAppConfigKey, J as useDid, Jt as PHGlobalConfigSetters, K as addRenownEventHandler, Kt as PHGlobalConfigHooksForKey, L as SpinnerIcon, Lt as PHAppConfigSetters, M as initRenownCrypto, Mt as FullPHGlobalConfig, N as ChevronDownIcon, Nt as PHAnalyticsGlobalConfig, O as RENOWN_NETWORK_ID, Ot as FailedInstallationReason, P as CopyIcon, Pt as PHAppConfig, Q as AddPHGlobalEventHandler, Qt as PHRenownGlobalConfig, R as UserIcon, Rt as PHCommonGlobalConfig, S as CREDENTIAL_SCHEMA_EIP712_TYPE, St as TimelineBarItem, T as DOMAIN_TYPE, Tt as DiscoveryEvent, U as RenownLoginButtonProps, Ut as PHDrivesGlobalConfig, V as RenownUserButtonProps, Vt as PHDocumentEditorConfigKey, W as RenownAuthButton, Wt as PHGlobalConfig, X as useRenown, Xt as PHProcessorsGlobalConfig, Y as useLoginStatus, Yt as PHGlobalConfigSettersForKey, Z as useUser, Zt as PHRelationalProcessorsGlobalConfig, _ as RenownInitialAuth, _t as IPackagesListener, a as RenownProvider, an as RenownAuthResolution, at as PHGlobalValue, b as useRenownInitialAuth, bt as PHToastOptions, c as RenownProps, cn as useRenownAuthAsync, ct as UsePHGlobalValue, d as RenownSessionCookieOptions, dn as IDocumentCache, dt as DraggingNode, en as login, et as BrowserReactorModule, f as RenownSessionCookieState, fn as PromiseState, ft as addDraggingNodeEventHandler, g as RENOWN_INITIAL_UNKNOWN, gt as IPackageManager, h as RENOWN_INITIAL_ANONYMOUS, ht as IPackageListerUnsubscribe, i as RenownWalletProviderProps, in as RenownAuthAsync, it as PHGlobalKey, j as initConnectCrypto, jt as PHModal, k as RENOWN_URL, kt as IPackageDiscoveryService, l as RenownInitOptions, ln as DocumentDispatch, lt as WorkerReactorClientModule, m as useRenownSessionSynced, mn as RejectedPromise, mt as useDropNode, n as useRenownLoginMethods, nn as openRenown, nt as PHGlobal, o as RenownProviderProps, on as RenownAuthStatus, ot as SetEvent, p as useRenownSessionCookie, pn as PromiseWithState, pt as useDragNode, q as setRenown, qt as PHGlobalConfigKey, r as RenownWalletProvider, rn as RenownAuth, rt as PHGlobalEventHandlerAdders, s as Renown, sn as useRenownAuth, st as SetPHGlobalValue, t as RenownLoginMethod, tn as logout, tt as LOADING, u as useRenownInit, un as FulfilledPromise, ut as WorkerReactorModule, v as RenownInitialUserProvider, vt as PackageManagerInstallResult, w as CREDENTIAL_TYPES, wt as TimelineItem, x as useRenownInitialUser, xt as PHToastType, y as RenownInitialUserProviderProps, yt as PHToastFn, z as RenownUserButton, zt as PHDocumentEditorConfig } from "./index-
|
|
2
|
+
import { $ as BrowserReactorClientModule, $t as PHSentryGlobalConfig, A as VERIFIABLE_CREDENTIAL_EIP712_TYPE, At as PendingInstallation, B as RenownUserButtonMenuItem, Bt as PHDocumentEditorConfigHooks, C as CREDENTIAL_SUBJECT_TYPE, Ct as TimelineDividerItem, D as RENOWN_CHAIN_ID, Dt as FailedInstallation, E as ISSUER_TYPE, Et as DiscoveryEventListener, F as DisconnectIcon, Ft as PHAppConfigHooks, G as RenownAuthButtonProps, Gt as PHGlobalConfigHooks, H as RenownLoginButton, Ht as PHDocumentEditorConfigSetters, I as RenownLogo, It as PHAppConfigKey, J as useDid, Jt as PHGlobalConfigSetters, K as addRenownEventHandler, Kt as PHGlobalConfigHooksForKey, L as SpinnerIcon, Lt as PHAppConfigSetters, M as initRenownCrypto, Mt as FullPHGlobalConfig, N as ChevronDownIcon, Nt as PHAnalyticsGlobalConfig, O as RENOWN_NETWORK_ID, Ot as FailedInstallationReason, P as CopyIcon, Pt as PHAppConfig, Q as AddPHGlobalEventHandler, Qt as PHRenownGlobalConfig, R as UserIcon, Rt as PHCommonGlobalConfig, S as CREDENTIAL_SCHEMA_EIP712_TYPE, St as TimelineBarItem, T as DOMAIN_TYPE, Tt as DiscoveryEvent, U as RenownLoginButtonProps, Ut as PHDrivesGlobalConfig, V as RenownUserButtonProps, Vt as PHDocumentEditorConfigKey, W as RenownAuthButton, Wt as PHGlobalConfig, X as useRenown, Xt as PHProcessorsGlobalConfig, Y as useLoginStatus, Yt as PHGlobalConfigSettersForKey, Z as useUser, Zt as PHRelationalProcessorsGlobalConfig, _ as RenownInitialAuth, _t as IPackagesListener, a as RenownProvider, an as RenownAuthResolution, at as PHGlobalValue, b as useRenownInitialAuth, bt as PHToastOptions, c as RenownProps, cn as useRenownAuthAsync, ct as UsePHGlobalValue, d as RenownSessionCookieOptions, dn as IDocumentCache, dt as DraggingNode, en as login, et as BrowserReactorModule, f as RenownSessionCookieState, fn as PromiseState, ft as addDraggingNodeEventHandler, g as RENOWN_INITIAL_UNKNOWN, gt as IPackageManager, h as RENOWN_INITIAL_ANONYMOUS, ht as IPackageListerUnsubscribe, i as RenownWalletProviderProps, in as RenownAuthAsync, it as PHGlobalKey, j as initConnectCrypto, jt as PHModal, k as RENOWN_URL, kt as IPackageDiscoveryService, l as RenownInitOptions, ln as DocumentDispatch, lt as WorkerReactorClientModule, m as useRenownSessionSynced, mn as RejectedPromise, mt as useDropNode, n as useRenownLoginMethods, nn as openRenown, nt as PHGlobal, o as RenownProviderProps, on as RenownAuthStatus, ot as SetEvent, p as useRenownSessionCookie, pn as PromiseWithState, pt as useDragNode, q as setRenown, qt as PHGlobalConfigKey, r as RenownWalletProvider, rn as RenownAuth, rt as PHGlobalEventHandlerAdders, s as Renown, sn as useRenownAuth, st as SetPHGlobalValue, t as RenownLoginMethod, tn as logout, tt as LOADING, u as useRenownInit, un as FulfilledPromise, ut as WorkerReactorModule, v as RenownInitialUserProvider, vt as PackageManagerInstallResult, w as CREDENTIAL_TYPES, wt as TimelineItem, x as useRenownInitialUser, xt as PHToastType, y as RenownInitialUserProviderProps, yt as PHToastFn, z as RenownUserButton, zt as PHDocumentEditorConfig } from "./index-BlPURnJv.js";
|
|
3
3
|
import { baseDocumentModels, baseDocumentModelsMap } from "./src/document-model.js";
|
|
4
4
|
import { t as PGlite } from "./pglite-CntadC_p-BgIvrYtV.js";
|
|
5
5
|
import { r as PGliteWithLive } from "./index-B3keszpu.js";
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { C as queueOperations, S as queueActions, _ as getAnalyticsStore, a as s
|
|
|
2
2
|
import { t as makePHEventFunctions } from "./make-ph-event-functions-BHoLPif5.js";
|
|
3
3
|
import { baseDocumentModels, baseDocumentModelsMap } from "./src/document-model.js";
|
|
4
4
|
import { n as GetDocumentWithOperationsDocument, r as PropagationMode, t as createClient } from "./client-_Gh2Uf0E.js";
|
|
5
|
-
import { A as RENOWN_NETWORK_ID, B as loading, C as openRenown, D as DOMAIN_TYPE, E as CREDENTIAL_TYPES, F as useDid, G as RenownInitialUserProvider, H as useLoading, I as useLoginStatus, K as useRenownInitialAuth, L as useRenown, M as VERIFIABLE_CREDENTIAL_EIP712_TYPE, N as addRenownEventHandler, O as ISSUER_TYPE, P as setRenown, R as useUser, S as logout, T as CREDENTIAL_SUBJECT_TYPE, U as RENOWN_INITIAL_ANONYMOUS, V as setLoading, W as RENOWN_INITIAL_UNKNOWN, _ as SpinnerIcon, a as useRenownInit, b as useRenownAuthAsync, c as initConnectCrypto, d as RenownUserButton, f as RenownLoginButton, g as RenownLogo, h as DisconnectIcon, i as Renown, j as RENOWN_URL, k as RENOWN_CHAIN_ID, l as initRenownCrypto, m as CopyIcon, n as RenownProvider, o as useRenownSessionCookie, p as ChevronDownIcon, q as useRenownInitialUser, r as RenownWalletProvider, s as useRenownSessionSynced, t as useRenownLoginMethods, u as RenownAuthButton, v as UserIcon, w as CREDENTIAL_SCHEMA_EIP712_TYPE, x as login, y as useRenownAuth, z as addLoadingEventHandler } from "./renown-
|
|
5
|
+
import { A as RENOWN_NETWORK_ID, B as loading, C as openRenown, D as DOMAIN_TYPE, E as CREDENTIAL_TYPES, F as useDid, G as RenownInitialUserProvider, H as useLoading, I as useLoginStatus, K as useRenownInitialAuth, L as useRenown, M as VERIFIABLE_CREDENTIAL_EIP712_TYPE, N as addRenownEventHandler, O as ISSUER_TYPE, P as setRenown, R as useUser, S as logout, T as CREDENTIAL_SUBJECT_TYPE, U as RENOWN_INITIAL_ANONYMOUS, V as setLoading, W as RENOWN_INITIAL_UNKNOWN, _ as SpinnerIcon, a as useRenownInit, b as useRenownAuthAsync, c as initConnectCrypto, d as RenownUserButton, f as RenownLoginButton, g as RenownLogo, h as DisconnectIcon, i as Renown, j as RENOWN_URL, k as RENOWN_CHAIN_ID, l as initRenownCrypto, m as CopyIcon, n as RenownProvider, o as useRenownSessionCookie, p as ChevronDownIcon, q as useRenownInitialUser, r as RenownWalletProvider, s as useRenownSessionSynced, t as useRenownLoginMethods, u as RenownAuthButton, v as UserIcon, w as CREDENTIAL_SCHEMA_EIP712_TYPE, x as login, y as useRenownAuth, z as addLoadingEventHandler } from "./renown-Bihtk0Mj.js";
|
|
6
6
|
import { i as setPGliteDB, n as useRelationalQuery, r as useRelationalDb, t as createProcessorQuery } from "./relational-Dj06-YkI.js";
|
|
7
7
|
import { a as getPackagesForDocumentType, i as getPackagesByDocumentType, n as getPackagePage, o as trimTrailingSlash, r as getPackages, t as RegistryClient } from "./client-DKuvLO3_.js";
|
|
8
8
|
import { logger } from "document-model";
|
|
@@ -99,6 +99,34 @@ function whenWalletControllerReady() {
|
|
|
99
99
|
reject
|
|
100
100
|
}));
|
|
101
101
|
}
|
|
102
|
+
const NO_DESCRIPTORS = Object.freeze([]);
|
|
103
|
+
const DESCRIPTOR_STORE = Symbol.for("@powerhousedao/reactor-browser:renown-wallet-descriptors");
|
|
104
|
+
function descriptorStore() {
|
|
105
|
+
const host = globalThis;
|
|
106
|
+
return host[DESCRIPTOR_STORE] ??= {
|
|
107
|
+
descriptors: NO_DESCRIPTORS,
|
|
108
|
+
listeners: /* @__PURE__ */ new Set()
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function setWalletDescriptors(descriptors) {
|
|
112
|
+
const store = descriptorStore();
|
|
113
|
+
const next = descriptors ?? NO_DESCRIPTORS;
|
|
114
|
+
if (next === store.descriptors) return;
|
|
115
|
+
if (next.length === 0 && store.descriptors.length === 0) return;
|
|
116
|
+
store.descriptors = next;
|
|
117
|
+
store.listeners.forEach((listener) => listener());
|
|
118
|
+
}
|
|
119
|
+
function getWalletDescriptors() {
|
|
120
|
+
return descriptorStore().descriptors;
|
|
121
|
+
}
|
|
122
|
+
function getServerWalletDescriptors() {
|
|
123
|
+
return NO_DESCRIPTORS;
|
|
124
|
+
}
|
|
125
|
+
function subscribeWalletDescriptors(listener) {
|
|
126
|
+
const { listeners } = descriptorStore();
|
|
127
|
+
listeners.add(listener);
|
|
128
|
+
return () => listeners.delete(listener);
|
|
129
|
+
}
|
|
102
130
|
//#endregion
|
|
103
131
|
//#region src/renown/constants.ts
|
|
104
132
|
const RENOWN_URL = "https://www.renown.id";
|
|
@@ -1075,14 +1103,15 @@ function useRenownSessionSynced() {
|
|
|
1075
1103
|
}
|
|
1076
1104
|
//#endregion
|
|
1077
1105
|
//#region src/renown/use-renown-init.ts
|
|
1078
|
-
async function initRenown(appName, namespace, url, switchboardUrl, revalidate) {
|
|
1106
|
+
async function initRenown(appName, namespace, url, switchboardUrl, revalidate, chainId) {
|
|
1079
1107
|
addRenownEventHandler();
|
|
1080
1108
|
setRenown(null);
|
|
1081
1109
|
const renown = await new RenownBuilder(appName, {
|
|
1082
1110
|
basename: namespace,
|
|
1083
1111
|
baseUrl: url,
|
|
1084
1112
|
switchboardUrl,
|
|
1085
|
-
revalidate
|
|
1113
|
+
revalidate,
|
|
1114
|
+
chainId
|
|
1086
1115
|
}).build();
|
|
1087
1116
|
setRenown(renown);
|
|
1088
1117
|
await login(void 0, renown);
|
|
@@ -1101,14 +1130,14 @@ async function initRenown(appName, namespace, url, switchboardUrl, revalidate) {
|
|
|
1101
1130
|
* }
|
|
1102
1131
|
* ```
|
|
1103
1132
|
*/
|
|
1104
|
-
function useRenownInit({ appName, namespace, url, switchboardUrl, revalidate = "always" }) {
|
|
1133
|
+
function useRenownInit({ appName, namespace, url, switchboardUrl, revalidate = "always", chainId }) {
|
|
1105
1134
|
const promiseRef = useRef(null);
|
|
1106
1135
|
promiseRef.current ??= Promise.withResolvers();
|
|
1107
1136
|
const initRef = useRef(false);
|
|
1108
1137
|
useEffect(() => {
|
|
1109
1138
|
if (initRef.current) return;
|
|
1110
1139
|
initRef.current = true;
|
|
1111
|
-
initRenown(appName, namespace, url, switchboardUrl, revalidate).then(promiseRef.current.resolve).catch(promiseRef.current.reject);
|
|
1140
|
+
initRenown(appName, namespace, url, switchboardUrl, revalidate, chainId).then(promiseRef.current.resolve).catch(promiseRef.current.reject);
|
|
1112
1141
|
}, []);
|
|
1113
1142
|
return promiseRef.current.promise;
|
|
1114
1143
|
}
|
|
@@ -1212,6 +1241,15 @@ function AdapterControllerBridge(props) {
|
|
|
1212
1241
|
function RenownWalletProvider({ adapters: adaptersConfig, theme, children }) {
|
|
1213
1242
|
const [descriptors] = useState(() => adaptersConfig);
|
|
1214
1243
|
const user = useUser();
|
|
1244
|
+
useEffect(() => {
|
|
1245
|
+
if (typeof process !== "undefined" && true) return;
|
|
1246
|
+
if (adaptersConfig === descriptors) return;
|
|
1247
|
+
console.error("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.");
|
|
1248
|
+
}, [adaptersConfig, descriptors]);
|
|
1249
|
+
useEffect(() => {
|
|
1250
|
+
setWalletDescriptors(descriptors);
|
|
1251
|
+
return () => setWalletDescriptors(void 0);
|
|
1252
|
+
}, [descriptors]);
|
|
1215
1253
|
const metas = useMemo(() => descriptors?.map((descriptor) => descriptor.meta) ?? [], [descriptors]);
|
|
1216
1254
|
const [activated, setActivated] = useState(() => typeof window !== "undefined" && isWalletRedirectReturn(window.location.search, metas));
|
|
1217
1255
|
if (user && !activated) setActivated(true);
|
|
@@ -1277,7 +1315,7 @@ function SessionSync({ enabled, endpoint, children }) {
|
|
|
1277
1315
|
children
|
|
1278
1316
|
});
|
|
1279
1317
|
}
|
|
1280
|
-
function RenownProvider({ appName, namespace, url, switchboardUrl, adapters, theme, revalidate, session, sessionEndpoint, onError, children }) {
|
|
1318
|
+
function RenownProvider({ appName, namespace, url, switchboardUrl, adapters, theme, revalidate, chainId, session, sessionEndpoint, onError, children }) {
|
|
1281
1319
|
const isServerSession = session !== void 0;
|
|
1282
1320
|
const mounted = useSyncExternalStore(subscribeNothing, () => true, () => false);
|
|
1283
1321
|
const seed = useMemo(() => {
|
|
@@ -1305,6 +1343,7 @@ function RenownProvider({ appName, namespace, url, switchboardUrl, adapters, the
|
|
|
1305
1343
|
url,
|
|
1306
1344
|
switchboardUrl,
|
|
1307
1345
|
revalidate,
|
|
1346
|
+
chainId,
|
|
1308
1347
|
onError
|
|
1309
1348
|
}), /* @__PURE__ */ jsx(RenownInitialUserProvider, {
|
|
1310
1349
|
initialAuth: seed,
|
|
@@ -1327,13 +1366,13 @@ const DEFAULT_METHOD_LABELS = {
|
|
|
1327
1366
|
[LoginMethod.EMAIL]: "Continue with Email",
|
|
1328
1367
|
[LoginMethod.APPLE]: "Continue with Apple"
|
|
1329
1368
|
};
|
|
1330
|
-
/**
|
|
1331
|
-
function useRenownLoginMethods(
|
|
1369
|
+
/** 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. */
|
|
1370
|
+
function useRenownLoginMethods(labels) {
|
|
1371
|
+
const descriptors = useSyncExternalStore(subscribeWalletDescriptors, getWalletDescriptors, getServerWalletDescriptors);
|
|
1332
1372
|
return useMemo(() => {
|
|
1333
|
-
if (!adapters) return [];
|
|
1334
1373
|
const seen = /* @__PURE__ */ new Set();
|
|
1335
1374
|
const methods = [];
|
|
1336
|
-
for (const { meta } of
|
|
1375
|
+
for (const { meta } of descriptors) for (const id of meta.supportedMethods) {
|
|
1337
1376
|
if (seen.has(id)) continue;
|
|
1338
1377
|
seen.add(id);
|
|
1339
1378
|
methods.push({
|
|
@@ -1342,9 +1381,9 @@ function useRenownLoginMethods(adapters, labels) {
|
|
|
1342
1381
|
});
|
|
1343
1382
|
}
|
|
1344
1383
|
return methods;
|
|
1345
|
-
}, [
|
|
1384
|
+
}, [descriptors, labels]);
|
|
1346
1385
|
}
|
|
1347
1386
|
//#endregion
|
|
1348
1387
|
export { RENOWN_NETWORK_ID as A, loading as B, openRenown as C, DOMAIN_TYPE as D, CREDENTIAL_TYPES as E, useDid as F, RenownInitialUserProvider as G, useLoading as H, useLoginStatus as I, useRenownInitialAuth as K, useRenown as L, VERIFIABLE_CREDENTIAL_EIP712_TYPE as M, addRenownEventHandler as N, ISSUER_TYPE as O, setRenown as P, useUser as R, logout as S, CREDENTIAL_SUBJECT_TYPE as T, RENOWN_INITIAL_ANONYMOUS as U, setLoading as V, RENOWN_INITIAL_UNKNOWN as W, SpinnerIcon as _, useRenownInit as a, useRenownAuthAsync as b, initConnectCrypto as c, RenownUserButton as d, RenownLoginButton as f, RenownLogo as g, DisconnectIcon as h, Renown as i, RENOWN_URL as j, RENOWN_CHAIN_ID as k, initRenownCrypto as l, CopyIcon as m, RenownProvider as n, useRenownSessionCookie as o, ChevronDownIcon as p, useRenownInitialUser as q, RenownWalletProvider as r, useRenownSessionSynced as s, useRenownLoginMethods as t, RenownAuthButton as u, UserIcon as v, CREDENTIAL_SCHEMA_EIP712_TYPE as w, login as x, useRenownAuth as y, addLoadingEventHandler as z };
|
|
1349
1388
|
|
|
1350
|
-
//# sourceMappingURL=renown-
|
|
1389
|
+
//# sourceMappingURL=renown-Bihtk0Mj.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renown-Bihtk0Mj.js","names":["truncateAddress","logoutUtil","subscribeNothing","styles","defaultLogout"],"sources":["../src/renown/initial-user.tsx","../src/hooks/loading.ts","../src/hooks/renown.ts","../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":["\"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 { 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","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","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":";;;;;;;AAaA,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;;;;ACtD5D,MAAa,EACX,UAAU,YACV,UAAU,YACV,iBAAiB,2BACf,qBAAqB,UAAU;AAEnC,MAAa,UAAmB;;;ACFhC,MAAM,uBAAuB,qBAAqB,SAAS;;AAG3D,MAAa,wBACX,qBAAqB;;AAGvB,MAAa,YACX,qBAAqB;;AAGvB,MAAa,YACX,qBAAqB;;AAGvB,SAAgB,SAAS;AAEvB,QADe,WAAW,EACX;;;AAIjB,SAAg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;aAC/C,oBAAC,aAAD;IAAa,SAAS;IAAiB,UAAU;IAC9C;IACW,CAAA;GACO,CAAA;EACG,CAAA,CAC3B,EAAA,CAAA;;;;ACxGP,MAAM,wBAA8D;EACjE,YAAY,SAAS;EACrB,YAAY,SAAS;EACrB,YAAY,QAAQ;EACpB,YAAY,QAAQ;CACtB;;AAGD,SAAgB,sBACd,QACqB;CACrB,MAAM,cAAc,qBAClB,4BACA,sBACA,2BACD;AACD,QAAO,cAAc;EACnB,MAAM,uBAAO,IAAI,KAAkB;EACnC,MAAM,UAA+B,EAAE;AACvC,OAAK,MAAM,EAAE,UAAU,YACrB,MAAK,MAAM,MAAM,KAAK,kBAAkB;AACtC,OAAI,KAAK,IAAI,GAAG,CAAE;AAClB,QAAK,IAAI,GAAG;AACZ,WAAQ,KAAK;IACX;IACA,OAAO,SAAS,OAAO,sBAAsB,OAAO;IACrD,CAAC;;AAGN,SAAO;IACN,CAAC,aAAa,OAAO,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as VERIFIABLE_CREDENTIAL_EIP712_TYPE, B as RenownUserButtonMenuItem, C as CREDENTIAL_SUBJECT_TYPE, D as RENOWN_CHAIN_ID, E as ISSUER_TYPE, F as DisconnectIcon, G as RenownAuthButtonProps, H as RenownLoginButton, I as RenownLogo, L as SpinnerIcon, M as initRenownCrypto, N as ChevronDownIcon, O as RENOWN_NETWORK_ID, P as CopyIcon, R as UserIcon, S as CREDENTIAL_SCHEMA_EIP712_TYPE, T as DOMAIN_TYPE, U as RenownLoginButtonProps, V as RenownUserButtonProps, W as RenownAuthButton, X as useRenown, _ as RenownInitialAuth, a as RenownProvider, an as RenownAuthResolution, b as useRenownInitialAuth, c as RenownProps, cn as useRenownAuthAsync, d as RenownSessionCookieOptions, f as RenownSessionCookieState, g as RENOWN_INITIAL_UNKNOWN, h as RENOWN_INITIAL_ANONYMOUS, i as RenownWalletProviderProps, in as RenownAuthAsync, j as initConnectCrypto, k as RENOWN_URL, l as RenownInitOptions, m as useRenownSessionSynced, n as useRenownLoginMethods, nn as openRenown, o as RenownProviderProps, on as RenownAuthStatus, p as useRenownSessionCookie, r as RenownWalletProvider, rn as RenownAuth, s as Renown, sn as useRenownAuth, t as RenownLoginMethod, u as useRenownInit, v as RenownInitialUserProvider, w as CREDENTIAL_TYPES, x as useRenownInitialUser, y as RenownInitialUserProviderProps, z as RenownUserButton } from "../../index-
|
|
1
|
+
import { A as VERIFIABLE_CREDENTIAL_EIP712_TYPE, B as RenownUserButtonMenuItem, C as CREDENTIAL_SUBJECT_TYPE, D as RENOWN_CHAIN_ID, E as ISSUER_TYPE, F as DisconnectIcon, G as RenownAuthButtonProps, H as RenownLoginButton, I as RenownLogo, L as SpinnerIcon, M as initRenownCrypto, N as ChevronDownIcon, O as RENOWN_NETWORK_ID, P as CopyIcon, R as UserIcon, S as CREDENTIAL_SCHEMA_EIP712_TYPE, T as DOMAIN_TYPE, U as RenownLoginButtonProps, V as RenownUserButtonProps, W as RenownAuthButton, X as useRenown, _ as RenownInitialAuth, a as RenownProvider, an as RenownAuthResolution, b as useRenownInitialAuth, c as RenownProps, cn as useRenownAuthAsync, d as RenownSessionCookieOptions, f as RenownSessionCookieState, g as RENOWN_INITIAL_UNKNOWN, h as RENOWN_INITIAL_ANONYMOUS, i as RenownWalletProviderProps, in as RenownAuthAsync, j as initConnectCrypto, k as RENOWN_URL, l as RenownInitOptions, m as useRenownSessionSynced, n as useRenownLoginMethods, nn as openRenown, o as RenownProviderProps, on as RenownAuthStatus, p as useRenownSessionCookie, r as RenownWalletProvider, rn as RenownAuth, s as Renown, sn as useRenownAuth, t as RenownLoginMethod, u as useRenownInit, v as RenownInitialUserProvider, w as CREDENTIAL_TYPES, x as useRenownInitialUser, y as RenownInitialUserProviderProps, z as RenownUserButton } from "../../index-BlPURnJv.js";
|
|
2
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 };
|
package/dist/src/renown/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as RENOWN_NETWORK_ID, C as openRenown, D as DOMAIN_TYPE, E as CREDENTIAL_TYPES, G as RenownInitialUserProvider, K as useRenownInitialAuth, L as useRenown, M as VERIFIABLE_CREDENTIAL_EIP712_TYPE, O as ISSUER_TYPE, T as CREDENTIAL_SUBJECT_TYPE, U as RENOWN_INITIAL_ANONYMOUS, W as RENOWN_INITIAL_UNKNOWN, _ as SpinnerIcon, a as useRenownInit, b as useRenownAuthAsync, c as initConnectCrypto, d as RenownUserButton, f as RenownLoginButton, g as RenownLogo, h as DisconnectIcon, i as Renown, j as RENOWN_URL, k as RENOWN_CHAIN_ID, l as initRenownCrypto, m as CopyIcon, n as RenownProvider, o as useRenownSessionCookie, p as ChevronDownIcon, q as useRenownInitialUser, r as RenownWalletProvider, s as useRenownSessionSynced, t as useRenownLoginMethods, u as RenownAuthButton, v as UserIcon, w as CREDENTIAL_SCHEMA_EIP712_TYPE, y as useRenownAuth } from "../../renown-
|
|
1
|
+
import { A as RENOWN_NETWORK_ID, C as openRenown, D as DOMAIN_TYPE, E as CREDENTIAL_TYPES, G as RenownInitialUserProvider, K as useRenownInitialAuth, L as useRenown, M as VERIFIABLE_CREDENTIAL_EIP712_TYPE, O as ISSUER_TYPE, T as CREDENTIAL_SUBJECT_TYPE, U as RENOWN_INITIAL_ANONYMOUS, W as RENOWN_INITIAL_UNKNOWN, _ as SpinnerIcon, a as useRenownInit, b as useRenownAuthAsync, c as initConnectCrypto, d as RenownUserButton, f as RenownLoginButton, g as RenownLogo, h as DisconnectIcon, i as Renown, j as RENOWN_URL, k as RENOWN_CHAIN_ID, l as initRenownCrypto, m as CopyIcon, n as RenownProvider, o as useRenownSessionCookie, p as ChevronDownIcon, q as useRenownInitialUser, r as RenownWalletProvider, s as useRenownSessionSynced, t as useRenownLoginMethods, u as RenownAuthButton, v as UserIcon, w as CREDENTIAL_SCHEMA_EIP712_TYPE, y as useRenownAuth } from "../../renown-Bihtk0Mj.js";
|
|
2
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, 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 };
|
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.25",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -66,14 +66,14 @@
|
|
|
66
66
|
"slug": "^11.0.0",
|
|
67
67
|
"usehooks-ts": "^3.1.1",
|
|
68
68
|
"zod": "4.3.6",
|
|
69
|
-
"@powerhousedao/analytics-engine-
|
|
70
|
-
"@powerhousedao/reactor": "6.2.2-dev.
|
|
71
|
-
"@powerhousedao/
|
|
72
|
-
"@powerhousedao/reactor-
|
|
73
|
-
"@powerhousedao/
|
|
74
|
-
"@
|
|
75
|
-
"
|
|
76
|
-
"
|
|
69
|
+
"@powerhousedao/analytics-engine-browser": "6.2.2-dev.25",
|
|
70
|
+
"@powerhousedao/reactor": "6.2.2-dev.25",
|
|
71
|
+
"@powerhousedao/analytics-engine-core": "6.2.2-dev.25",
|
|
72
|
+
"@powerhousedao/reactor-attachments": "6.2.2-dev.25",
|
|
73
|
+
"@powerhousedao/reactor-drive": "6.2.2-dev.25",
|
|
74
|
+
"@renown/sdk": "6.2.2-dev.25",
|
|
75
|
+
"document-model": "6.2.2-dev.25",
|
|
76
|
+
"@powerhousedao/shared": "6.2.2-dev.25"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@electric-sql/pglite": "0.3.15",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"renown-BDH93sB5.js","names":["truncateAddress","logoutUtil","subscribeNothing","styles","defaultLogout"],"sources":["../src/renown/initial-user.tsx","../src/hooks/loading.ts","../src/hooks/renown.ts","../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":["\"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 { 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","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","import type { WalletController } 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","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}\n\nasync function initRenown(\n appName: string,\n namespace: string | undefined,\n url: string | undefined,\n switchboardUrl: string | undefined,\n revalidate: \"always\" | \"never\",\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 });\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}: 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)\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 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 // 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 /** 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 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 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, type WalletAdapterDescriptor } from \"@renown/sdk/wallet\";\nimport { useMemo } from \"react\";\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/** Derive the offered login methods from wallet adapter descriptors, for building a login UI. Reads each descriptor's eager metadata only — no wallet libraries load. Buttons follow the descriptor array order, deduped. Wire each to `useRenownAuth().login(undefined, id)`. Labels are overridable. See the reactor-browser README + Academy Renown auth guide. */\nexport function useRenownLoginMethods(\n adapters: WalletAdapterDescriptor[] | undefined,\n labels?: Partial<Record<LoginMethod, string>>,\n): RenownLoginMethod[] {\n return useMemo(() => {\n if (!adapters) return [];\n const seen = new Set<LoginMethod>();\n const methods: RenownLoginMethod[] = [];\n for (const { meta } of adapters) {\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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