diff --git a/shared/components/rstack-identity.ts b/shared/components/rstack-identity.ts index 7c082c0..c04ec68 100644 --- a/shared/components/rstack-identity.ts +++ b/shared/components/rstack-identity.ts @@ -810,8 +810,8 @@ export class RStackIdentity extends HTMLElement { this.#render(); this.dispatchEvent(new CustomEvent("auth-change", { bubbles: true, composed: true })); callbacks?.onSuccess?.(); - // Auto-redirect to personal space - autoResolveSpace(data.token, username); + // Show post-signup prompt recommending second device before redirecting + this.#showPostSignupPrompt(data.token, username); } catch (err: any) { btn.disabled = false; btn.innerHTML = "🔐 Create Passkey"; @@ -861,6 +861,123 @@ export class RStackIdentity extends HTMLElement { } } + // ── Post-signup onboarding prompt ── + + #showPostSignupPrompt(token: string, username: string): void { + const overlay = document.createElement("div"); + overlay.className = "rstack-auth-overlay"; + + const goToSpace = () => { + overlay.remove(); + autoResolveSpace(token, username); + }; + + let step: "welcome" | "linking" | "done" = "welcome"; + let linkUrl = ""; + + const render = () => { + if (step === "welcome") { + const qrHint = /Mobi|Android|iPhone|iPad/i.test(navigator.userAgent) + ? "You can link your laptop or another phone." + : "Grab your phone or tablet and scan the code."; + overlay.innerHTML = ` + +
Your account ${username} is ready.
+ +You can always link devices later from My Account.
+Scan this QR code on your phone or tablet to add a passkey.
+Link expires in 10 minutes
+You can now sign in from your other device too.
+ +