${msg( html`You've been invited to join ${hasInviteInfo ? this.inviteInfo.orgName || msg("Browsertrix Cloud") : placeholder}` )}
import { state, property } from "lit/decorators.js"; import { msg, str, localized } from "@lit/localize"; import LiteElement, { html } from "../utils/LiteElement"; import type { AuthState } from "../utils/AuthService"; import { ROUTES } from "../routes"; @localized() export class AcceptInvite extends LiteElement { @property({ type: Object }) authState?: AuthState; @property({ type: String }) token?: string; @property({ type: String }) email?: string; @state() serverError?: string; @state() private inviteInfo: { inviterEmail: string; inviterName: string; orgName: string; } = { inviterEmail: "", inviterName: "", orgName: "", }; connectedCallback(): void { if (this.token && this.email) { super.connectedCallback(); } else { throw new Error("Missing email or token"); } } private get isLoggedIn(): boolean { return Boolean( this.authState && this.email && this.authState.username === this.email ); } firstUpdated() { if (this.isLoggedIn) { this.getInviteInfo(); } else { this.notify({ message: msg("Log in to continue."), variant: "success", icon: "check2-circle", duration: 10000, }); this.navTo( `/log-in?redirectUrl=${encodeURIComponent( `${window.location.pathname}${window.location.search}` )}` ); } } render() { let serverError; if (this.serverError) { serverError = html`
${msg( html`You've been invited to join ${hasInviteInfo ? this.inviteInfo.orgName || msg("Browsertrix Cloud") : placeholder}` )}