You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: support Magic account deletion alongside thirdweb (#630)
* feat: scaffold account settings shell under /account
* feat: apply account settings brand colors (violet gradient, magenta nav)
* feat: build account wallets section (balances, receive, deep-links)
* feat: build account notifications settings section
* feat: build account delete section with thirdweb flow
* feat: build account credits settings section
* fix: lazy-construct thirdweb client to avoid shell-chunk top-level throw
* feat: rework account notifications as per-type accordions with master toggle
* feat: redesign account sidebar (user header with address copy, dividers, icons)
* feat: make account sidebar a full-height left rail
* feat: add lazy BlockchainShell and in-page MANA send to account wallets
* fix: match account notifications and delete account designs to figma
* fix: mobile master-detail navigation for account settings
* fix: notification accordions fill their column width
* fix: resolve env via sites config so dev defaults to zone not production
* fix: add per-group icons and hover shadow to notification accordions
* fix: align account sidebar with content and use 59px navbar gap on desktop
* fix: keep notification toggles instant and independent on change
* feat: enroll in credits program in-place instead of marketplace redirect
* fix: master email toggle flips only the global mute, not every switch
* fix: use the design SVG icons for notification group accordions
* fix: inject web3 reducers before Web3Inner mounts to avoid wallet crash
* feat: in-page MANA swap depositing from ethereum to polygon
* feat: track and list wallet send and swap transactions locally
* feat: align account wallets ui with figma (transactions grid, action buttons, mana mark)
* feat: in-page buy, withdraw and claim for account wallets with thirdweb-gated delete
* fix: make the account buy-with-fiat modal directional per card
* feat: support Magic account deletion alongside thirdweb
The account Delete flow was thirdweb-only. Extend it to Magic logins:
- Detect Magic accounts via the dcl_magic_user_email key (useIsMagicAccount),
mirroring useIsThirdwebAccount.
- Gate the Delete section/nav on thirdweb OR Magic (DeleteAccountPage,
AccountSidebar).
- Branch the confirm modal by provider: thirdweb keeps the client-side SDK
unlink flow; Magic mints a DID token (lib/magic) and calls the auth-server
DELETE /accounts (lib/accountDeletion) via a signed fetch carrying the token
in the request metadata. Local cleanup is provider-aware.
- Add AUTH_SERVER_URL per env; fix dev to use the test Magic app key so the
minted token's audience matches auth-server-dev's MAGIC_CLIENT_ID (test app).
stg/prd were already aligned (test/prod respectively).
* refactor: detect Magic via layered signals to cover email-less logins
useIsMagicAccount keyed off dcl_magic_user_email, which only exists for
Magic logins that produced an email. SMS / passkey / OAuth-without-email
sessions never set it, so those users were classed as non-Magic and never
saw the Delete flow (the very users Magic's public-address deletion targets).
Detect with layered signals, cheapest first:
1. dcl_magic_user_email (synchronous positive fast-path for email logins).
2. wagmi's persisted connector id (wagmi.recentConnectorId === 'magic') — the
core-web3 connector signal, present once a wallet action has populated it;
covers email-less logins without loading the Magic SDK.
3. magic.user.isLoggedIn() — authoritative fallback when neither is present
(fresh session, no wallet action); the same call getMagicDidToken() makes.
The check is skipped for known thirdweb logins so the Magic SDK/iframe is
never loaded needlessly. The hook now returns boolean | undefined; the Delete
page shows a loader while the async check resolves instead of flashing the
"unavailable" message at a Magic user.
wagmi.recentConnectorId is read straight from localStorage (new
utils/recentConnector, defensively parsed) because core-web3 builds its wagmi
config lazily — only on a BlockchainShell wallet action — so the connector is
not reachable via wagmi hooks in the provider-free account section.
* refactor: detect Magic purely via the SDK session check
Drop the synchronous signal layering (dcl_magic_user_email +
wagmi.recentConnectorId) from useIsMagicAccount and resolve solely through
magic.user.isLoggedIn() — one authoritative, login-method-agnostic source
instead of three, and no more coupling to wagmi's localStorage shape (the
recentConnector util is removed).
The thirdweb skip guard stays, so the Magic SDK is still not loaded for known
thirdweb logins. Other non-Magic logins (e.g. MetaMask) now resolve through
the SDK check — a brief loader / hidden Delete entry while it resolves —
rather than a synchronous localStorage read.
* refactor: extract useCanDeleteAccount, cache Magic instance, name the status hook
Addresses PR review (P2):
- Extract useCanDeleteAccount() returning { canDelete, isMagic,
isResolvingProvider }, shared by the Delete page and the sidebar so the
gating logic can't drift (it was duplicated 3 lines in both).
- Cache the Magic SDK instance as a module-level lazy singleton so the SDK /
its iframe bootstraps once even when the sidebar and page detect
concurrently; a failed bootstrap is not cached, so a later call can retry.
- Rename useIsMagicAccount -> useMagicAccountStatus returning an explicit
{ isMagic, isLoading } object, since the useIs* convention implies a boolean
(it previously returned boolean | undefined).
The fetchWithIdentity positional-args -> options-object cleanup (also P2) is
left for a follow-up: it touches ~16 call sites across unrelated features.
---------
Co-authored-by: Braian Mellor <braianj@gmail.com>
0 commit comments