@cal.macconnachie/web-components 0.0.18 → 0.0.19

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.
@@ -17,7 +17,7 @@ let wt = class {
17
17
  return this.cssText;
18
18
  }
19
19
  };
20
- const xt = (e) => new wt(typeof e == "string" ? e : e + "", void 0, Q), Et = (e, ...t) => {
20
+ const Et = (e) => new wt(typeof e == "string" ? e : e + "", void 0, Q), xt = (e, ...t) => {
21
21
  const s = e.length === 1 ? e[0] : t.reduce(((i, r, o) => i + ((a) => {
22
22
  if (a._$cssResult$ === !0) return a.cssText;
23
23
  if (typeof a == "number") return a;
@@ -33,9 +33,9 @@ const xt = (e) => new wt(typeof e == "string" ? e : e + "", void 0, Q), Et = (e,
33
33
  }, at = Z ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((t) => {
34
34
  let s = "";
35
35
  for (const i of t.cssRules) s += i.cssText;
36
- return xt(s);
36
+ return Et(s);
37
37
  })(e) : e;
38
- const { is: Pt, defineProperty: Ot, getOwnPropertyDescriptor: Dt, getOwnPropertyNames: Ut, getOwnPropertySymbols: Rt, getPrototypeOf: It } = Object, F = globalThis, nt = F.trustedTypes, Nt = nt ? nt.emptyScript : "", Lt = F.reactiveElementPolyfillSupport, H = (e, t) => e, Y = { toAttribute(e, t) {
38
+ const { is: Pt, defineProperty: Ot, getOwnPropertyDescriptor: Dt, getOwnPropertyNames: Ut, getOwnPropertySymbols: Rt, getPrototypeOf: It } = Object, F = globalThis, nt = F.trustedTypes, Nt = nt ? nt.emptyScript : "", Lt = F.reactiveElementPolyfillSupport, M = (e, t) => e, Y = { toAttribute(e, t) {
39
39
  switch (t) {
40
40
  case Boolean:
41
41
  e = e ? Nt : null;
@@ -93,13 +93,13 @@ let U = class extends HTMLElement {
93
93
  return this.elementProperties.get(t) ?? lt;
94
94
  }
95
95
  static _$Ei() {
96
- if (this.hasOwnProperty(H("elementProperties"))) return;
96
+ if (this.hasOwnProperty(M("elementProperties"))) return;
97
97
  const t = It(this);
98
98
  t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
99
99
  }
100
100
  static finalize() {
101
- if (this.hasOwnProperty(H("finalized"))) return;
102
- if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(H("properties"))) {
101
+ if (this.hasOwnProperty(M("finalized"))) return;
102
+ if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(M("properties"))) {
103
103
  const s = this.properties, i = [...Ut(s), ...Rt(s)];
104
104
  for (const r of i) this.createProperty(r, s[r]);
105
105
  }
@@ -246,10 +246,10 @@ let U = class extends HTMLElement {
246
246
  firstUpdated(t) {
247
247
  }
248
248
  };
249
- U.elementStyles = [], U.shadowRootOptions = { mode: "open" }, U[H("elementProperties")] = /* @__PURE__ */ new Map(), U[H("finalized")] = /* @__PURE__ */ new Map(), Lt?.({ ReactiveElement: U }), (F.reactiveElementVersions ??= []).push("2.1.1");
250
- const tt = globalThis, K = tt.trustedTypes, ht = K ? K.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, bt = "$lit$", C = `lit$${Math.random().toFixed(9).slice(2)}$`, vt = "?" + C, Ht = `<${vt}>`, D = document, j = () => D.createComment(""), q = (e) => e === null || typeof e != "object" && typeof e != "function", et = Array.isArray, Mt = (e) => et(e) || typeof e?.[Symbol.iterator] == "function", W = `[
249
+ U.elementStyles = [], U.shadowRootOptions = { mode: "open" }, U[M("elementProperties")] = /* @__PURE__ */ new Map(), U[M("finalized")] = /* @__PURE__ */ new Map(), Lt?.({ ReactiveElement: U }), (F.reactiveElementVersions ??= []).push("2.1.1");
250
+ const tt = globalThis, K = tt.trustedTypes, ht = K ? K.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, bt = "$lit$", C = `lit$${Math.random().toFixed(9).slice(2)}$`, vt = "?" + C, Mt = `<${vt}>`, D = document, j = () => D.createComment(""), q = (e) => e === null || typeof e != "object" && typeof e != "function", et = Array.isArray, Ht = (e) => et(e) || typeof e?.[Symbol.iterator] == "function", W = `[
251
251
  \f\r]`, N = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ct = /-->/g, dt = />/g, T = RegExp(`>|${W}(?:([^\\s"'>=/]+)(${W}*=${W}*(?:[^
252
- \f\r"'\`<>=]|("|')|))|$)`, "g"), pt = /'/g, ut = /"/g, At = /^(?:script|style|textarea|title)$/i, jt = (e) => (t, ...s) => ({ _$litType$: e, strings: t, values: s }), f = jt(1), x = Symbol.for("lit-noChange"), g = Symbol.for("lit-nothing"), gt = /* @__PURE__ */ new WeakMap(), O = D.createTreeWalker(D, 129);
252
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), pt = /'/g, ut = /"/g, At = /^(?:script|style|textarea|title)$/i, jt = (e) => (t, ...s) => ({ _$litType$: e, strings: t, values: s }), f = jt(1), E = Symbol.for("lit-noChange"), g = Symbol.for("lit-nothing"), gt = /* @__PURE__ */ new WeakMap(), O = D.createTreeWalker(D, 129);
253
253
  function _t(e, t) {
254
254
  if (!et(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
255
255
  return ht !== void 0 ? ht.createHTML(t) : t;
@@ -262,7 +262,7 @@ const qt = (e, t) => {
262
262
  let h, d, l = -1, p = 0;
263
263
  for (; p < n.length && (a.lastIndex = p, d = a.exec(n), d !== null); ) p = a.lastIndex, a === N ? d[1] === "!--" ? a = ct : d[1] !== void 0 ? a = dt : d[2] !== void 0 ? (At.test(d[2]) && (r = RegExp("</" + d[2], "g")), a = T) : d[3] !== void 0 && (a = T) : a === T ? d[0] === ">" ? (a = r ?? N, l = -1) : d[1] === void 0 ? l = -2 : (l = a.lastIndex - d[2].length, h = d[1], a = d[3] === void 0 ? T : d[3] === '"' ? ut : pt) : a === ut || a === pt ? a = T : a === ct || a === dt ? a = N : (a = T, r = void 0);
264
264
  const u = a === T && e[c + 1].startsWith("/>") ? " " : "";
265
- o += a === N ? n + Ht : l >= 0 ? (i.push(h), n.slice(0, l) + bt + n.slice(l) + C + u) : n + C + (l === -2 ? c : u);
265
+ o += a === N ? n + Mt : l >= 0 ? (i.push(h), n.slice(0, l) + bt + n.slice(l) + C + u) : n + C + (l === -2 ? c : u);
266
266
  }
267
267
  return [_t(e, o + (e[s] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), i];
268
268
  };
@@ -304,7 +304,7 @@ class B {
304
304
  }
305
305
  }
306
306
  function R(e, t, s = e, i) {
307
- if (t === x) return t;
307
+ if (t === E) return t;
308
308
  let r = i !== void 0 ? s._$Co?.[i] : s._$Cl;
309
309
  const o = q(t) ? void 0 : t._$litDirective$;
310
310
  return r?.constructor !== o && (r?._$AO?.(!1), o === void 0 ? r = void 0 : (r = new o(e), r._$AT(e, s, i)), i !== void 0 ? (s._$Co ??= [])[i] = r : s._$Cl = r), r !== void 0 && (t = R(e, r._$AS(e, t.values), r, i)), t;
@@ -356,7 +356,7 @@ class I {
356
356
  return this._$AB;
357
357
  }
358
358
  _$AI(t, s = this) {
359
- t = R(this, t, s), q(t) ? t === g || t == null || t === "" ? (this._$AH !== g && this._$AR(), this._$AH = g) : t !== this._$AH && t !== x && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Mt(t) ? this.k(t) : this._(t);
359
+ t = R(this, t, s), q(t) ? t === g || t == null || t === "" ? (this._$AH !== g && this._$AR(), this._$AH = g) : t !== this._$AH && t !== E && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Ht(t) ? this.k(t) : this._(t);
360
360
  }
361
361
  O(t) {
362
362
  return this._$AA.parentNode.insertBefore(t, this._$AB);
@@ -409,11 +409,11 @@ class V {
409
409
  _$AI(t, s = this, i, r) {
410
410
  const o = this.strings;
411
411
  let a = !1;
412
- if (o === void 0) t = R(this, t, s, 0), a = !q(t) || t !== this._$AH && t !== x, a && (this._$AH = t);
412
+ if (o === void 0) t = R(this, t, s, 0), a = !q(t) || t !== this._$AH && t !== E, a && (this._$AH = t);
413
413
  else {
414
414
  const c = t;
415
415
  let n, h;
416
- for (t = o[0], n = 0; n < o.length - 1; n++) h = R(this, c[i + n], s, n), h === x && (h = this._$AH[n]), a ||= !q(h) || h !== this._$AH[n], h === g ? t = g : t !== g && (t += (h ?? "") + o[n + 1]), this._$AH[n] = h;
416
+ for (t = o[0], n = 0; n < o.length - 1; n++) h = R(this, c[i + n], s, n), h === E && (h = this._$AH[n]), a ||= !q(h) || h !== this._$AH[n], h === g ? t = g : t !== g && (t += (h ?? "") + o[n + 1]), this._$AH[n] = h;
417
417
  }
418
418
  a && !r && this.j(t);
419
419
  }
@@ -442,7 +442,7 @@ class Kt extends V {
442
442
  super(t, s, i, r, o), this.type = 5;
443
443
  }
444
444
  _$AI(t, s = this) {
445
- if ((t = R(this, t, s, 0) ?? g) === x) return;
445
+ if ((t = R(this, t, s, 0) ?? g) === E) return;
446
446
  const i = this._$AH, r = t === g && i !== g || t.capture !== i.capture || t.once !== i.once || t.passive !== i.passive, o = t !== g && (i === g || r);
447
447
  r && this.element.removeEventListener(this.name, this, i), o && this.element.addEventListener(this.name, this, t), this._$AH = t;
448
448
  }
@@ -473,7 +473,7 @@ const Gt = (e, t, s) => {
473
473
  return r._$AI(e), r;
474
474
  };
475
475
  const st = globalThis;
476
- let M = class extends U {
476
+ let H = class extends U {
477
477
  constructor() {
478
478
  super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
479
479
  }
@@ -492,12 +492,12 @@ let M = class extends U {
492
492
  super.disconnectedCallback(), this._$Do?.setConnected(!1);
493
493
  }
494
494
  render() {
495
- return x;
495
+ return E;
496
496
  }
497
497
  };
498
- M._$litElement$ = !0, M.finalized = !0, st.litElementHydrateSupport?.({ LitElement: M });
498
+ H._$litElement$ = !0, H.finalized = !0, st.litElementHydrateSupport?.({ LitElement: H });
499
499
  const Jt = st.litElementPolyfillSupport;
500
- Jt?.({ LitElement: M });
500
+ Jt?.({ LitElement: H });
501
501
  (st.litElementVersions ??= []).push("4.2.1");
502
502
  const Zt = (e) => (t, s) => {
503
503
  s !== void 0 ? s.addInitializer((() => {
@@ -579,7 +579,7 @@ const mt = kt(class extends Ct {
579
579
  const r = !!t[i];
580
580
  r === this.st.has(i) || this.nt?.has(i) || (r ? (s.add(i), this.st.add(i)) : (s.remove(i), this.st.delete(i)));
581
581
  }
582
- return x;
582
+ return E;
583
583
  }
584
584
  });
585
585
  const { I: ee } = Vt, ft = () => document.createComment(""), L = (e, t, s) => {
@@ -652,7 +652,7 @@ const yt = (e, t, s) => {
652
652
  const v = r[l++];
653
653
  v !== null && G(v);
654
654
  }
655
- return this.ut = a, ie(e, n), x;
655
+ return this.ut = a, ie(e, n), E;
656
656
  }
657
657
  }), oe = ({
658
658
  baseUrl: e
@@ -884,10 +884,10 @@ const yt = (e, t, s) => {
884
884
  redirectUri: he(r)
885
885
  }, a = (w) => {
886
886
  const _ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~", k = new Uint8Array(w);
887
- return crypto.getRandomValues(k), Array.from(k).map((E) => _[E % _.length]).join("");
887
+ return crypto.getRandomValues(k), Array.from(k).map((x) => _[x % _.length]).join("");
888
888
  }, c = async (w) => {
889
- const k = new TextEncoder().encode(w), E = await crypto.subtle.digest("SHA-256", k);
890
- return btoa(String.fromCharCode(...new Uint8Array(E))).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
889
+ const k = new TextEncoder().encode(w), x = await crypto.subtle.digest("SHA-256", k);
890
+ return btoa(String.fromCharCode(...new Uint8Array(x))).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
891
891
  }, n = async () => {
892
892
  const w = a(128), _ = await c(w);
893
893
  return sessionStorage.setItem("pkce_code_verifier", w), { codeVerifier: w, codeChallenge: _ };
@@ -947,21 +947,21 @@ const yt = (e, t, s) => {
947
947
  code: w,
948
948
  redirect_uri: o.redirectUri,
949
949
  code_verifier: _
950
- }), E = await fetch(`${o.domain}/oauth2/token`, {
950
+ }), x = await fetch(`${o.domain}/oauth2/token`, {
951
951
  method: "POST",
952
952
  headers: {
953
953
  "Content-Type": "application/x-www-form-urlencoded"
954
954
  },
955
955
  body: k.toString()
956
956
  });
957
- if (!E.ok) {
958
- const rt = await E.text();
957
+ if (!x.ok) {
958
+ const rt = await x.text();
959
959
  throw new Error(`Token exchange failed: ${rt}`);
960
960
  }
961
- return E.json();
961
+ return x.json();
962
962
  }
963
963
  };
964
- }, de = () => Et`
964
+ }, de = () => xt`
965
965
  :host {
966
966
  display: inline-block;
967
967
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
@@ -1477,7 +1477,7 @@ const ge = [
1477
1477
  "token_type",
1478
1478
  "expires_in"
1479
1479
  ];
1480
- let m = class extends M {
1480
+ let m = class extends H {
1481
1481
  constructor() {
1482
1482
  super(...arguments), this.open = !1, this.initialMode = "signin", this.logoUrl = "", this.baseUrl = "", this.oauthDomain = "", this.oauthRegion = "", this.oauthUserPoolId = "", this.oauthClientId = "", this.oauthRedirectUri = "", this.oauthSpaDomain = "", this.size = "sm", this.theme = "light", this.disableSignup = !1, this.mode = "signin", this.resetStep = "none", this.signupStep = "form", this.isLoading = !1, this.isClosing = !1, this.isVisible = !1, this.isLoggedIn = !1, this.email = "", this.password = "", this.givenName = "", this.familyName = "", this.newPassword = "", this.confirmPassword = "", this.notice = "", this.error = "", this.errors = {}, this.otpDigits = ["", "", "", "", "", ""], this.signupOtpDigits = ["", "", "", "", "", ""], this.isDragging = !1, this.dragStartY = 0, this.dragCurrentY = 0, this.dragStartTime = 0, this.lastDragEndTime = 0, this.cookies = ne(), this.scrollPosition = 0, this.transitionDuration = 300, this.hasHandledOAuthCallback = !1, this.boundKeyHandler = (e) => {
1483
1483
  e.key === "Escape" && this.isVisible && this.handleClose();
@@ -1662,8 +1662,8 @@ let m = class extends M {
1662
1662
  }
1663
1663
  }
1664
1664
  }
1665
- setAuthTokens(e, t, s) {
1666
- this.cookies.setAuthToken("ACCESS_TOKEN", e), this.cookies.setAuthToken("AUTH_TOKEN", t), this.cookies.setAuthToken("REFRESH_TOKEN", s), this.isLoggedIn = !0, this.dispatchEvent(
1665
+ setAuthTokens(e, t, s, i) {
1666
+ this.cookies.setAuthToken("ACCESS_TOKEN", e), this.cookies.setAuthToken("AUTH_TOKEN", t), this.cookies.setAuthToken("REFRESH_TOKEN", s), this.cookies.setCookie("USER_EMAIL", i.email), this.isLoggedIn = !0, this.dispatchEvent(
1667
1667
  new CustomEvent("auth-success", {
1668
1668
  bubbles: !0,
1669
1669
  composed: !0
@@ -1674,8 +1674,8 @@ let m = class extends M {
1674
1674
  const e = {
1675
1675
  email: this.email.trim(),
1676
1676
  password: this.password
1677
- }, { accessToken: t, idToken: s, refreshToken: i } = await this.getApiService().login(e);
1678
- this.setAuthTokens(t, s, i), this.handleClose();
1677
+ }, { accessToken: t, idToken: s, refreshToken: i, user: r } = await this.getApiService().login(e);
1678
+ this.setAuthTokens(t, s, i, r), this.handleClose();
1679
1679
  }
1680
1680
  isOAuthConfigured() {
1681
1681
  return [this.oauthDomain, this.oauthRegion, this.oauthUserPoolId, this.oauthClientId].every(
@@ -1719,12 +1719,12 @@ let m = class extends M {
1719
1719
  if (a)
1720
1720
  throw new Error(c || `OAuth error: ${a}`);
1721
1721
  if (t && s && i) {
1722
- const { accessToken: h, idToken: d, refreshToken: l } = await this.getApiService().login({
1722
+ const { accessToken: h, idToken: d, refreshToken: l, user: p } = await this.getApiService().login({
1723
1723
  accessToken: t,
1724
1724
  refreshToken: i,
1725
1725
  idToken: s
1726
1726
  });
1727
- this.setAuthTokens(h, d, l ?? i), this.handleClose();
1727
+ this.setAuthTokens(h, d, l ?? i, p), this.handleClose();
1728
1728
  } else if (r && o) {
1729
1729
  if (!this.isOAuthConfigured())
1730
1730
  throw new Error("OAuth is not configured correctly. Please try again later.");
@@ -1733,12 +1733,12 @@ let m = class extends M {
1733
1733
  throw new Error("OAuth is not configured correctly. Please try again later.");
1734
1734
  if (!h.validateState(o))
1735
1735
  throw new Error("Invalid state parameter. Please try signing in again.");
1736
- const d = await h.exchangeCodeForTokens(r), { accessToken: l, idToken: p, refreshToken: u } = await this.getApiService().login({
1736
+ const d = await h.exchangeCodeForTokens(r), { accessToken: l, idToken: p, refreshToken: u, user: $ } = await this.getApiService().login({
1737
1737
  accessToken: d.access_token,
1738
1738
  refreshToken: d.refresh_token,
1739
1739
  idToken: d.id_token
1740
1740
  });
1741
- this.setAuthTokens(l, p, u ?? d.refresh_token), this.handleClose();
1741
+ this.setAuthTokens(l, p, u ?? d.refresh_token, $), this.handleClose();
1742
1742
  } else
1743
1743
  throw new Error("Missing required OAuth parameters");
1744
1744
  } catch (h) {
@@ -2422,6 +2422,9 @@ let m = class extends M {
2422
2422
  this.cookies.clearAllAuthTokens(), this.isLoggedIn = !1;
2423
2423
  }
2424
2424
  }
2425
+ getUserEmail() {
2426
+ return this.cookies.getCookie("USER_EMAIL") || null;
2427
+ }
2425
2428
  };
2426
2429
  m.styles = de();
2427
2430
  y([
@@ -115,6 +115,7 @@ export declare class Auth extends LitElement {
115
115
  closeModal(): void;
116
116
  openModal(): void;
117
117
  refresh(): Promise<void>;
118
+ getUserEmail(): string | null;
118
119
  static styles: CSSResult;
119
120
  }
120
121
 
package/dist/index.d.ts CHANGED
@@ -115,6 +115,7 @@ export declare class Auth extends LitElement {
115
115
  closeModal(): void;
116
116
  openModal(): void;
117
117
  refresh(): Promise<void>;
118
+ getUserEmail(): string | null;
118
119
  static styles: CSSResult;
119
120
  }
120
121
 
package/dist/index.js CHANGED
@@ -249,7 +249,7 @@ let Q = class extends HTMLElement {
249
249
  Q.elementStyles = [], Q.shadowRootOptions = { mode: "open" }, Q[de("elementProperties")] = /* @__PURE__ */ new Map(), Q[de("finalized")] = /* @__PURE__ */ new Map(), Ns?.({ ReactiveElement: Q }), (xe.reactiveElementVersions ??= []).push("2.1.1");
250
250
  const Xe = globalThis, Ce = Xe.trustedTypes, yt = Ce ? Ce.createPolicy("lit-html", { createHTML: (t) => t }) : void 0, Vt = "$lit$", j = `lit$${Math.random().toFixed(9).slice(2)}$`, Wt = "?" + j, Ls = `<${Wt}>`, G = document, ue = () => G.createComment(""), pe = (t) => t === null || typeof t != "object" && typeof t != "function", Qe = Array.isArray, Is = (t) => Qe(t) || typeof t?.[Symbol.iterator] == "function", He = `[
251
251
  \f\r]`, le = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, bt = /-->/g, wt = />/g, K = RegExp(`>|${He}(?:([^\\s"'>=/]+)(${He}*=${He}*(?:[^
252
- \f\r"'\`<>=]|("|')|))|$)`, "g"), St = /'/g, $t = /"/g, Yt = /^(?:script|style|textarea|title)$/i, Bs = (t) => (e, ...s) => ({ _$litType$: t, strings: e, values: s }), w = Bs(1), F = Symbol.for("lit-noChange"), S = Symbol.for("lit-nothing"), At = /* @__PURE__ */ new WeakMap(), W = G.createTreeWalker(G, 129);
252
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), St = /'/g, $t = /"/g, Yt = /^(?:script|style|textarea|title)$/i, Bs = (t) => (e, ...s) => ({ _$litType$: t, strings: e, values: s }), w = Bs(1), M = Symbol.for("lit-noChange"), S = Symbol.for("lit-nothing"), At = /* @__PURE__ */ new WeakMap(), W = G.createTreeWalker(G, 129);
253
253
  function Jt(t, e) {
254
254
  if (!Qe(t) || !t.hasOwnProperty("raw")) throw Error("invalid template strings array");
255
255
  return yt !== void 0 ? yt.createHTML(e) : e;
@@ -280,7 +280,7 @@ class fe {
280
280
  if (i.nodeType === 1) {
281
281
  if (i.hasAttributes()) for (const u of i.getAttributeNames()) if (u.endsWith(Vt)) {
282
282
  const f = c[n++], y = i.getAttribute(u).split(j), p = /([.?@])?(.*)/.exec(f);
283
- l.push({ type: 1, index: o, name: p[2], strings: y, ctor: p[1] === "." ? Fs : p[1] === "?" ? Ms : p[1] === "@" ? qs : Re }), i.removeAttribute(u);
283
+ l.push({ type: 1, index: o, name: p[2], strings: y, ctor: p[1] === "." ? Ms : p[1] === "?" ? Fs : p[1] === "@" ? qs : Re }), i.removeAttribute(u);
284
284
  } else u.startsWith(j) && (l.push({ type: 6, index: o }), i.removeAttribute(u));
285
285
  if (Yt.test(i.tagName)) {
286
286
  const u = i.textContent.split(j), f = u.length - 1;
@@ -304,7 +304,7 @@ class fe {
304
304
  }
305
305
  }
306
306
  function te(t, e, s = t, r) {
307
- if (e === F) return e;
307
+ if (e === M) return e;
308
308
  let i = r !== void 0 ? s._$Co?.[r] : s._$Cl;
309
309
  const o = pe(e) ? void 0 : e._$litDirective$;
310
310
  return i?.constructor !== o && (i?._$AO?.(!1), o === void 0 ? i = void 0 : (i = new o(t), i._$AT(t, s, r)), r !== void 0 ? (s._$Co ??= [])[r] = i : s._$Cl = i), i !== void 0 && (e = te(t, i._$AS(t, e.values), i, r)), e;
@@ -356,7 +356,7 @@ class re {
356
356
  return this._$AB;
357
357
  }
358
358
  _$AI(e, s = this) {
359
- e = te(this, e, s), pe(e) ? e === S || e == null || e === "" ? (this._$AH !== S && this._$AR(), this._$AH = S) : e !== this._$AH && e !== F && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Is(e) ? this.k(e) : this._(e);
359
+ e = te(this, e, s), pe(e) ? e === S || e == null || e === "" ? (this._$AH !== S && this._$AR(), this._$AH = S) : e !== this._$AH && e !== M && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Is(e) ? this.k(e) : this._(e);
360
360
  }
361
361
  O(e) {
362
362
  return this._$AA.parentNode.insertBefore(e, this._$AB);
@@ -409,11 +409,11 @@ class Re {
409
409
  _$AI(e, s = this, r, i) {
410
410
  const o = this.strings;
411
411
  let n = !1;
412
- if (o === void 0) e = te(this, e, s, 0), n = !pe(e) || e !== this._$AH && e !== F, n && (this._$AH = e);
412
+ if (o === void 0) e = te(this, e, s, 0), n = !pe(e) || e !== this._$AH && e !== M, n && (this._$AH = e);
413
413
  else {
414
414
  const a = e;
415
415
  let l, h;
416
- for (e = o[0], l = 0; l < o.length - 1; l++) h = te(this, a[r + l], s, l), h === F && (h = this._$AH[l]), n ||= !pe(h) || h !== this._$AH[l], h === S ? e = S : e !== S && (e += (h ?? "") + o[l + 1]), this._$AH[l] = h;
416
+ for (e = o[0], l = 0; l < o.length - 1; l++) h = te(this, a[r + l], s, l), h === M && (h = this._$AH[l]), n ||= !pe(h) || h !== this._$AH[l], h === S ? e = S : e !== S && (e += (h ?? "") + o[l + 1]), this._$AH[l] = h;
417
417
  }
418
418
  n && !i && this.j(e);
419
419
  }
@@ -421,7 +421,7 @@ class Re {
421
421
  e === S ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
422
422
  }
423
423
  }
424
- class Fs extends Re {
424
+ class Ms extends Re {
425
425
  constructor() {
426
426
  super(...arguments), this.type = 3;
427
427
  }
@@ -429,7 +429,7 @@ class Fs extends Re {
429
429
  this.element[this.name] = e === S ? void 0 : e;
430
430
  }
431
431
  }
432
- class Ms extends Re {
432
+ class Fs extends Re {
433
433
  constructor() {
434
434
  super(...arguments), this.type = 4;
435
435
  }
@@ -442,7 +442,7 @@ class qs extends Re {
442
442
  super(e, s, r, i, o), this.type = 5;
443
443
  }
444
444
  _$AI(e, s = this) {
445
- if ((e = te(this, e, s, 0) ?? S) === F) return;
445
+ if ((e = te(this, e, s, 0) ?? S) === M) return;
446
446
  const r = this._$AH, i = e === S && r !== S || e.capture !== r.capture || e.once !== r.once || e.passive !== r.passive, o = e !== S && (r === S || i);
447
447
  i && this.element.removeEventListener(this.name, this, r), o && this.element.addEventListener(this.name, this, e), this._$AH = e;
448
448
  }
@@ -492,7 +492,7 @@ let ee = class extends Q {
492
492
  super.disconnectedCallback(), this._$Do?.setConnected(!1);
493
493
  }
494
494
  render() {
495
- return F;
495
+ return M;
496
496
  }
497
497
  };
498
498
  ee._$litElement$ = !0, ee.finalized = !0, et.litElementHydrateSupport?.({ LitElement: ee });
@@ -579,7 +579,7 @@ const vt = Xt(class extends Qt {
579
579
  const i = !!e[r];
580
580
  i === this.st.has(r) || this.nt?.has(r) || (i ? (s.add(r), this.st.add(r)) : (s.remove(r), this.st.delete(r)));
581
581
  }
582
- return F;
582
+ return M;
583
583
  }
584
584
  });
585
585
  const { I: Xs } = Ks, Et = () => document.createComment(""), ce = (t, e, s) => {
@@ -652,7 +652,7 @@ const _t = (t, e, s) => {
652
652
  const g = i[u++];
653
653
  g !== null && je(g);
654
654
  }
655
- return this.ut = n, er(t, l), F;
655
+ return this.ut = n, er(t, l), M;
656
656
  }
657
657
  }), es = ({
658
658
  baseUrl: t
@@ -814,7 +814,7 @@ const _t = (t, e, s) => {
814
814
  return f.json();
815
815
  }
816
816
  };
817
- }, Fe = {
817
+ }, Me = {
818
818
  AUTH_TOKEN: "authToken",
819
819
  ACCESS_TOKEN: "accessToken",
820
820
  REFRESH_TOKEN: "refreshToken"
@@ -851,9 +851,9 @@ const _t = (t, e, s) => {
851
851
  maxAge: -1
852
852
  });
853
853
  }, r = (l) => e(l) !== null, i = (l, h) => {
854
- t(Fe[l], h, sr);
855
- }, o = (l) => e(Fe[l]), n = (l) => {
856
- s(Fe[l]);
854
+ t(Me[l], h, sr);
855
+ }, o = (l) => e(Me[l]), n = (l) => {
856
+ s(Me[l]);
857
857
  };
858
858
  return {
859
859
  setCookie: t,
@@ -1662,8 +1662,8 @@ let A = class extends ee {
1662
1662
  }
1663
1663
  }
1664
1664
  }
1665
- setAuthTokens(t, e, s) {
1666
- this.cookies.setAuthToken("ACCESS_TOKEN", t), this.cookies.setAuthToken("AUTH_TOKEN", e), this.cookies.setAuthToken("REFRESH_TOKEN", s), this.isLoggedIn = !0, this.dispatchEvent(
1665
+ setAuthTokens(t, e, s, r) {
1666
+ this.cookies.setAuthToken("ACCESS_TOKEN", t), this.cookies.setAuthToken("AUTH_TOKEN", e), this.cookies.setAuthToken("REFRESH_TOKEN", s), this.cookies.setCookie("USER_EMAIL", r.email), this.isLoggedIn = !0, this.dispatchEvent(
1667
1667
  new CustomEvent("auth-success", {
1668
1668
  bubbles: !0,
1669
1669
  composed: !0
@@ -1674,8 +1674,8 @@ let A = class extends ee {
1674
1674
  const t = {
1675
1675
  email: this.email.trim(),
1676
1676
  password: this.password
1677
- }, { accessToken: e, idToken: s, refreshToken: r } = await this.getApiService().login(t);
1678
- this.setAuthTokens(e, s, r), this.handleClose();
1677
+ }, { accessToken: e, idToken: s, refreshToken: r, user: i } = await this.getApiService().login(t);
1678
+ this.setAuthTokens(e, s, r, i), this.handleClose();
1679
1679
  }
1680
1680
  isOAuthConfigured() {
1681
1681
  return [this.oauthDomain, this.oauthRegion, this.oauthUserPoolId, this.oauthClientId].every(
@@ -1719,12 +1719,12 @@ let A = class extends ee {
1719
1719
  if (n)
1720
1720
  throw new Error(a || `OAuth error: ${n}`);
1721
1721
  if (e && s && r) {
1722
- const { accessToken: h, idToken: c, refreshToken: u } = await this.getApiService().login({
1722
+ const { accessToken: h, idToken: c, refreshToken: u, user: f } = await this.getApiService().login({
1723
1723
  accessToken: e,
1724
1724
  refreshToken: r,
1725
1725
  idToken: s
1726
1726
  });
1727
- this.setAuthTokens(h, c, u ?? r), this.handleClose();
1727
+ this.setAuthTokens(h, c, u ?? r, f), this.handleClose();
1728
1728
  } else if (i && o) {
1729
1729
  if (!this.isOAuthConfigured())
1730
1730
  throw new Error("OAuth is not configured correctly. Please try again later.");
@@ -1733,12 +1733,12 @@ let A = class extends ee {
1733
1733
  throw new Error("OAuth is not configured correctly. Please try again later.");
1734
1734
  if (!h.validateState(o))
1735
1735
  throw new Error("Invalid state parameter. Please try signing in again.");
1736
- const c = await h.exchangeCodeForTokens(i), { accessToken: u, idToken: f, refreshToken: y } = await this.getApiService().login({
1736
+ const c = await h.exchangeCodeForTokens(i), { accessToken: u, idToken: f, refreshToken: y, user: p } = await this.getApiService().login({
1737
1737
  accessToken: c.access_token,
1738
1738
  refreshToken: c.refresh_token,
1739
1739
  idToken: c.id_token
1740
1740
  });
1741
- this.setAuthTokens(u, f, y ?? c.refresh_token), this.handleClose();
1741
+ this.setAuthTokens(u, f, y ?? c.refresh_token, p), this.handleClose();
1742
1742
  } else
1743
1743
  throw new Error("Missing required OAuth parameters");
1744
1744
  } catch (h) {
@@ -2422,6 +2422,9 @@ let A = class extends ee {
2422
2422
  this.cookies.clearAllAuthTokens(), this.isLoggedIn = !1;
2423
2423
  }
2424
2424
  }
2425
+ getUserEmail() {
2426
+ return this.cookies.getCookie("USER_EMAIL") || null;
2427
+ }
2425
2428
  };
2426
2429
  A.styles = nr();
2427
2430
  v([
@@ -2549,7 +2552,7 @@ var hr = Object.defineProperty, dr = Object.getOwnPropertyDescriptor, ie = (t, e
2549
2552
  (n = t[o]) && (i = (r ? n(e, s, i) : n(i)) || i);
2550
2553
  return r && i && hr(e, s, i), i;
2551
2554
  };
2552
- let M = class extends ee {
2555
+ let F = class extends ee {
2553
2556
  constructor() {
2554
2557
  super(...arguments), this.theme = "light", this.storageKey = "theme-preference", this.size = "sm", this.variant = "ghost", this.isDark = !1;
2555
2558
  }
@@ -2624,7 +2627,7 @@ let M = class extends ee {
2624
2627
  `;
2625
2628
  }
2626
2629
  };
2627
- M.styles = Kt`
2630
+ F.styles = Kt`
2628
2631
  :host {
2629
2632
  display: inline-block;
2630
2633
  }
@@ -2776,22 +2779,22 @@ M.styles = Kt`
2776
2779
  `;
2777
2780
  ie([
2778
2781
  O({ type: String, reflect: !0 })
2779
- ], M.prototype, "theme", 2);
2782
+ ], F.prototype, "theme", 2);
2780
2783
  ie([
2781
2784
  O({ type: String, attribute: "storage-key" })
2782
- ], M.prototype, "storageKey", 2);
2785
+ ], F.prototype, "storageKey", 2);
2783
2786
  ie([
2784
2787
  O({ type: String, attribute: "size" })
2785
- ], M.prototype, "size", 2);
2788
+ ], F.prototype, "size", 2);
2786
2789
  ie([
2787
2790
  O({ type: String, attribute: "variant" })
2788
- ], M.prototype, "variant", 2);
2791
+ ], F.prototype, "variant", 2);
2789
2792
  ie([
2790
2793
  T()
2791
- ], M.prototype, "isDark", 2);
2792
- M = ie([
2794
+ ], F.prototype, "isDark", 2);
2795
+ F = ie([
2793
2796
  Gt("theme-toggle")
2794
- ], M);
2797
+ ], F);
2795
2798
  function ss(t, e) {
2796
2799
  return function() {
2797
2800
  return t.apply(e, arguments);
@@ -2917,7 +2920,7 @@ const Or = (t, e, s, { allOwnKeys: r } = {}) => (ye(e, (i, o) => {
2917
2920
  let n;
2918
2921
  (n = e(i, o, t)) !== !1 && (r[o] = n || i);
2919
2922
  }), Object.defineProperties(t, r);
2920
- }, Fr = (t) => {
2923
+ }, Mr = (t) => {
2921
2924
  ls(t, (e, s) => {
2922
2925
  if (P(t) && ["arguments", "caller", "callee"].indexOf(s) !== -1)
2923
2926
  return !1;
@@ -2932,7 +2935,7 @@ const Or = (t, e, s, { allOwnKeys: r } = {}) => (ye(e, (i, o) => {
2932
2935
  });
2933
2936
  }
2934
2937
  });
2935
- }, Mr = (t, e) => {
2938
+ }, Fr = (t, e) => {
2936
2939
  const s = {}, r = (i) => {
2937
2940
  i.forEach((o) => {
2938
2941
  s[o] = !0;
@@ -3014,8 +3017,8 @@ const Vr = (t) => {
3014
3017
  hasOwnProp: kt,
3015
3018
  // an alias to avoid ESLint no-prototype-builtins detection
3016
3019
  reduceDescriptors: ls,
3017
- freezeMethods: Fr,
3018
- toObjectSet: Mr,
3020
+ freezeMethods: Mr,
3021
+ toObjectSet: Fr,
3019
3022
  toCamelCase: Hr,
3020
3023
  noop: qr,
3021
3024
  toFiniteNumber: zr,
@@ -3442,7 +3445,7 @@ function mi(t) {
3442
3445
  return e;
3443
3446
  }
3444
3447
  const gi = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());
3445
- function Me(t, e, s, r, i) {
3448
+ function Fe(t, e, s, r, i) {
3446
3449
  if (d.isFunction(r))
3447
3450
  return r.call(this, e, s);
3448
3451
  if (i && (e = s), !!d.isString(e)) {
@@ -3516,7 +3519,7 @@ class D {
3516
3519
  has(e, s) {
3517
3520
  if (e = he(e), e) {
3518
3521
  const r = d.findKey(this, e);
3519
- return !!(r && this[r] !== void 0 && (!s || Me(this, this[r], r, s)));
3522
+ return !!(r && this[r] !== void 0 && (!s || Fe(this, this[r], r, s)));
3520
3523
  }
3521
3524
  return !1;
3522
3525
  }
@@ -3526,7 +3529,7 @@ class D {
3526
3529
  function o(n) {
3527
3530
  if (n = he(n), n) {
3528
3531
  const a = d.findKey(r, n);
3529
- a && (!s || Me(r, r[a], a, s)) && (delete r[a], i = !0);
3532
+ a && (!s || Fe(r, r[a], a, s)) && (delete r[a], i = !0);
3530
3533
  }
3531
3534
  }
3532
3535
  return d.isArray(e) ? e.forEach(o) : o(e), i;
@@ -3536,7 +3539,7 @@ class D {
3536
3539
  let r = s.length, i = !1;
3537
3540
  for (; r--; ) {
3538
3541
  const o = s[r];
3539
- (!e || Me(this, this[o], o, e, !0)) && (delete this[o], i = !0);
3542
+ (!e || Fe(this, this[o], o, e, !0)) && (delete this[o], i = !0);
3540
3543
  }
3541
3544
  return i;
3542
3545
  }
@@ -4171,7 +4174,7 @@ function ze(t) {
4171
4174
  if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted)
4172
4175
  throw new ne(null, t);
4173
4176
  }
4174
- function Ft(t) {
4177
+ function Mt(t) {
4175
4178
  return ze(t), t.headers = D.from(t.headers), t.data = qe.call(
4176
4179
  t,
4177
4180
  t.transformRequest
@@ -4195,7 +4198,7 @@ const vs = "1.13.2", Le = {};
4195
4198
  return typeof r === t || "a" + (e < 1 ? "n " : " ") + t;
4196
4199
  };
4197
4200
  });
4198
- const Mt = {};
4201
+ const Ft = {};
4199
4202
  Le.transitional = function(e, s, r) {
4200
4203
  function i(o, n) {
4201
4204
  return "[Axios v" + vs + "] Transitional option '" + o + "'" + n + (r ? ". " + r : "");
@@ -4206,7 +4209,7 @@ Le.transitional = function(e, s, r) {
4206
4209
  i(n, " has been removed" + (s ? " in " + s : "")),
4207
4210
  $.ERR_DEPRECATED
4208
4211
  );
4209
- return s && !Mt[n] && (Mt[n] = !0), e ? e(o, n, a) : !0;
4212
+ return s && !Ft[n] && (Ft[n] = !0), e ? e(o, n, a) : !0;
4210
4213
  };
4211
4214
  };
4212
4215
  Le.spelling = function(e) {
@@ -4302,7 +4305,7 @@ class J {
4302
4305
  });
4303
4306
  let c, u = 0, f;
4304
4307
  if (!l) {
4305
- const p = [Ft.bind(this), void 0];
4308
+ const p = [Mt.bind(this), void 0];
4306
4309
  for (p.unshift(...a), p.push(...h), f = p.length, c = Promise.resolve(s); u < f; )
4307
4310
  c = c.then(p[u++], p[u++]);
4308
4311
  return c;
@@ -4319,7 +4322,7 @@ class J {
4319
4322
  }
4320
4323
  }
4321
4324
  try {
4322
- c = Ft.call(this, y);
4325
+ c = Mt.call(this, y);
4323
4326
  } catch (p) {
4324
4327
  return Promise.reject(p);
4325
4328
  }
@@ -4600,7 +4603,7 @@ const ji = ({ baseUrl: t, apiBaseUrl: e }) => {
4600
4603
  export {
4601
4604
  A as Auth,
4602
4605
  qt as AuthRefreshError,
4603
- M as ThemeToggle,
4606
+ F as ThemeToggle,
4604
4607
  Ki as apiClient,
4605
4608
  ji as createApiClient
4606
4609
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cal.macconnachie/web-components",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "Web components hosted on a CDN",
5
5
  "keywords": [
6
6
  "lit",