stack/examples/js-example/index-script.ts
Bilal Godil 8fc11e1c93 Rename Stack -> Hexclave in examples, app-internal symbols, and crypto docs
- examples: rename the user config module stack.ts/.tsx (and the convex/lovable
  stack/ dirs) to hexclave and update all importers across .ts/.tsx/.jsx; the
  public handler/[...stack] route segment is left unchanged.
- apps/{dashboard,backend,internal-tool}: rename app-local SDK-init symbols
  (stackClientApp -> hexclaveClientApp, getStackServerApp -> getHexclaveServerApp)
  and the dashboard StackCompanion component -> HexclaveCompanion. The public
  StackClientApp/StackServerApp SDK classes are intentionally left unchanged.
- packages/stack-shared: add comments explaining why the crypto/JWT/vault
  "stack-*" literals must NOT be renamed (key derivation / JWKS / KMS-alias
  stability would break existing encrypted data and tokens).

Deliberately excluded: the STACK_* -> HEXCLAVE_* env-var rename (already works via
the dual-read layers; the docker post-build sentinel path is author-deferred), and
all public-contract names (SDK classes, env vars, HTTP headers, handler routes).
2026-06-01 17:20:35 -07:00

29 lines
901 B
TypeScript

import { stackClientApp } from "./hexclave";
const updateUIState = (user: any | null) => {
const authOptions = document.getElementById("authOptions");
const userInfo = document.getElementById("userInfo");
const userEmailSpan = document.getElementById("userEmail");
if (user) {
if (authOptions) authOptions.style.display = "none";
if (userInfo) userInfo.style.display = "block";
if (userEmailSpan) userEmailSpan.textContent = user.primaryEmail || "";
} else {
if (authOptions) authOptions.style.display = "block";
if (userInfo) userInfo.style.display = "none";
}
};
// Check if user is already signed in
stackClientApp.getUser().then(updateUIState);
// Handle Sign Out
document.getElementById("signOut")?.addEventListener("click", async () => {
const user = await stackClientApp.getUser();
if (user) {
await user.signOut();
updateUIState(null);
}
});