@cal.macconnachie/web-components 0.0.9 → 0.0.11
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.
- package/README.md +8 -8
- package/dist/components/auth.js +88 -85
- package/dist/components/index.d.ts +18 -3
- package/dist/components/theme-toggle.js +1 -1
- package/dist/index.d.ts +18 -3
- package/dist/index.js +2758 -947
- package/dist/stylesheets/main.css +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -34,14 +34,14 @@ Then create a type declaration file for TypeScript support:
|
|
|
34
34
|
|
|
35
35
|
```typescript
|
|
36
36
|
// src/types/auth.d.ts
|
|
37
|
-
export interface
|
|
37
|
+
export interface Auth extends HTMLElement {
|
|
38
38
|
openModal(): void;
|
|
39
39
|
logout(): void;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
declare global {
|
|
43
43
|
interface HTMLElementTagNameMap {
|
|
44
|
-
'auth':
|
|
44
|
+
'auth': Auth;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
```
|
|
@@ -57,9 +57,9 @@ Now you can use it with full type safety in your components:
|
|
|
57
57
|
|
|
58
58
|
<script setup lang="ts">
|
|
59
59
|
import { ref } from 'vue';
|
|
60
|
-
import type {
|
|
60
|
+
import type { Auth } from '@/types/auth';
|
|
61
61
|
|
|
62
|
-
const authRef = ref<
|
|
62
|
+
const authRef = ref<Auth>();
|
|
63
63
|
|
|
64
64
|
const openAuth = () => {
|
|
65
65
|
authRef.value?.openModal();
|
|
@@ -70,10 +70,10 @@ const openAuth = () => {
|
|
|
70
70
|
**React:**
|
|
71
71
|
```tsx
|
|
72
72
|
import { useRef } from 'react';
|
|
73
|
-
import type {
|
|
73
|
+
import type { Auth } from '@/types/auth';
|
|
74
74
|
|
|
75
75
|
function App() {
|
|
76
|
-
const authRef = useRef<
|
|
76
|
+
const authRef = useRef<Auth>(null);
|
|
77
77
|
|
|
78
78
|
return (
|
|
79
79
|
<>
|
|
@@ -112,9 +112,9 @@ document.getElementById('logout-auth')?.addEventListener('click', () => {
|
|
|
112
112
|
|
|
113
113
|
TypeScript:
|
|
114
114
|
```typescript
|
|
115
|
-
import type {
|
|
115
|
+
import type { Auth } from 'https://cdn.cals-api.com/components/auth.js';
|
|
116
116
|
|
|
117
|
-
const auth = document.querySelector<
|
|
117
|
+
const auth = document.querySelector<Auth>('auth');
|
|
118
118
|
|
|
119
119
|
document.getElementById('open-auth')?.addEventListener('click', () => {
|
|
120
120
|
auth?.openModal();
|
package/dist/components/auth.js
CHANGED
|
@@ -249,7 +249,7 @@ let U = class extends HTMLElement {
|
|
|
249
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
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 }),
|
|
252
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), pt = /'/g, ut = /"/g, At = /^(?:script|style|textarea|title)$/i, jt = (e) => (t, ...s) => ({ _$litType$: e, strings: t, values: s }), y = jt(1), x = 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;
|
|
@@ -1461,7 +1461,7 @@ const yt = (e, t, s) => {
|
|
|
1461
1461
|
transition: none !important;
|
|
1462
1462
|
}
|
|
1463
1463
|
}`;
|
|
1464
|
-
var pe = Object.defineProperty, ue = Object.getOwnPropertyDescriptor,
|
|
1464
|
+
var pe = Object.defineProperty, ue = Object.getOwnPropertyDescriptor, f = (e, t, s, i) => {
|
|
1465
1465
|
for (var r = i > 1 ? void 0 : i ? ue(t, s) : t, o = e.length - 1, a; o >= 0; o--)
|
|
1466
1466
|
(a = e[o]) && (r = (i ? a(t, s, r) : a(r)) || r);
|
|
1467
1467
|
return i && r && pe(t, s, r), r;
|
|
@@ -1479,7 +1479,7 @@ const ge = [
|
|
|
1479
1479
|
];
|
|
1480
1480
|
let m = class extends H {
|
|
1481
1481
|
constructor() {
|
|
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.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) => {
|
|
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();
|
|
1484
1484
|
}, this.baseUrlErrorMessage = "Authentication service is not configured correctly. Please add an API domain or contact support.", this.handleClose = () => {
|
|
1485
1485
|
this.isClosing || !this.isVisible || (this.cleanupInlineStyles(), this.isDragging = !1, this.dragStartY = 0, this.dragCurrentY = 0, this.dragStartTime = 0, this.isClosing = !0, setTimeout(() => {
|
|
@@ -1536,7 +1536,7 @@ let m = class extends H {
|
|
|
1536
1536
|
connectedCallback() {
|
|
1537
1537
|
super.connectedCallback(), window.addEventListener("keyup", this.boundKeyHandler);
|
|
1538
1538
|
const e = this.cookies.getAuthToken("AUTH_TOKEN"), t = this.cookies.getAuthToken("REFRESH_TOKEN");
|
|
1539
|
-
this.isLoggedIn = !!(e && t), this.mode = this.initialMode, this.hasApiBaseUrl() || (this.error = this.baseUrlErrorMessage), this.handleOAuthCallbackIfPresent();
|
|
1539
|
+
this.isLoggedIn = !!(e && t), this.mode = this.disableSignup && this.initialMode === "signup" ? "signin" : this.initialMode, this.hasApiBaseUrl() || (this.error = this.baseUrlErrorMessage), this.handleOAuthCallbackIfPresent();
|
|
1540
1540
|
}
|
|
1541
1541
|
disconnectedCallback() {
|
|
1542
1542
|
window.removeEventListener("keyup", this.boundKeyHandler), this.unlockBodyScroll(), super.disconnectedCallback();
|
|
@@ -1545,7 +1545,7 @@ let m = class extends H {
|
|
|
1545
1545
|
this.open && (this.isVisible = !0);
|
|
1546
1546
|
}
|
|
1547
1547
|
updated(e) {
|
|
1548
|
-
e.has("baseUrl") && (this.apiService = void 0, this.hasApiBaseUrl() ? (this.error === this.baseUrlErrorMessage && (this.error = ""), this.hasHandledOAuthCallback || this.handleOAuthCallbackIfPresent()) : this.error = this.baseUrlErrorMessage), (e.has("oauthDomain") || e.has("oauthRegion") || e.has("oauthUserPoolId") || e.has("oauthClientId") || e.has("oauthRedirectUri")) && (this.oauthService = void 0, this.handleOAuthCallbackIfPresent()), e.has("open") && (this.open ? (this.isVisible = !0, this.lockBodyScroll(), setTimeout(() => {
|
|
1548
|
+
e.has("disableSignup") && this.disableSignup && this.mode === "signup" && (this.mode = "signin", this.signupStep = "form"), e.has("baseUrl") && (this.apiService = void 0, this.hasApiBaseUrl() ? (this.error === this.baseUrlErrorMessage && (this.error = ""), this.hasHandledOAuthCallback || this.handleOAuthCallbackIfPresent()) : this.error = this.baseUrlErrorMessage), (e.has("oauthDomain") || e.has("oauthRegion") || e.has("oauthUserPoolId") || e.has("oauthClientId") || e.has("oauthRedirectUri")) && (this.oauthService = void 0, this.handleOAuthCallbackIfPresent()), e.has("open") && (this.open ? (this.isVisible = !0, this.lockBodyScroll(), setTimeout(() => {
|
|
1549
1549
|
this.emailInput?.focus();
|
|
1550
1550
|
}, 100)) : this.isVisible && this.handleClose()), e.has("isVisible") && (this.isVisible ? (this.lockBodyScroll(), this.cleanupInlineStyles()) : (this.unlockBodyScroll(), this.resetState()));
|
|
1551
1551
|
}
|
|
@@ -1564,7 +1564,7 @@ let m = class extends H {
|
|
|
1564
1564
|
this.isDragging = !1, this.lastDragEndTime = 0, this.dragStartY = 0, this.dragCurrentY = 0, this.dragStartTime = 0, this.error = "", this.notice = "", this.errors = {}, this.email = "", this.password = "", this.givenName = "", this.familyName = "", this.newPassword = "", this.confirmPassword = "", this.otpDigits = ["", "", "", "", "", ""], this.signupOtpDigits = ["", "", "", "", "", ""], this.resetStep = "none", this.signupStep = "form", this.mode = this.initialMode;
|
|
1565
1565
|
}
|
|
1566
1566
|
toggleMode() {
|
|
1567
|
-
this.resetStep === "none" && (this.mode = this.mode === "signin" ? "signup" : "signin", this.signupStep = "form", this.error = "", this.notice = "", this.errors = {}, this.confirmPassword = "", this.mode === "signin" && (this.givenName = "", this.familyName = "", this.signupOtpDigits = ["", "", "", "", "", ""]));
|
|
1567
|
+
this.resetStep === "none" && (this.disableSignup && this.mode === "signin" || (this.mode = this.mode === "signin" ? "signup" : "signin", this.signupStep = "form", this.error = "", this.notice = "", this.errors = {}, this.confirmPassword = "", this.mode === "signin" && (this.givenName = "", this.familyName = "", this.signupOtpDigits = ["", "", "", "", "", ""])));
|
|
1568
1568
|
}
|
|
1569
1569
|
startReset() {
|
|
1570
1570
|
this.mode = "signin", this.resetStep = "request", this.error = "", this.notice = "", this.errors = {}, this.password = "", this.newPassword = "", this.confirmPassword = "";
|
|
@@ -1898,7 +1898,7 @@ let m = class extends H {
|
|
|
1898
1898
|
"modal-container--dragging": this.isDragging,
|
|
1899
1899
|
[`modal-container--${this.size}`]: !0
|
|
1900
1900
|
};
|
|
1901
|
-
return
|
|
1901
|
+
return y`
|
|
1902
1902
|
<!-- Modal/Drawer -->
|
|
1903
1903
|
<div
|
|
1904
1904
|
class=${mt(e)}
|
|
@@ -1938,8 +1938,8 @@ let m = class extends H {
|
|
|
1938
1938
|
renderContent() {
|
|
1939
1939
|
if (!this.hasApiBaseUrl()) {
|
|
1940
1940
|
const e = this.baseUrlErrorMessage;
|
|
1941
|
-
return
|
|
1942
|
-
${this.logoUrl.length > 0 ?
|
|
1941
|
+
return y`
|
|
1942
|
+
${this.logoUrl.length > 0 ? y`
|
|
1943
1943
|
<header class="modal-header">
|
|
1944
1944
|
<div class="auth-header">
|
|
1945
1945
|
<img
|
|
@@ -1962,9 +1962,9 @@ let m = class extends H {
|
|
|
1962
1962
|
</div>
|
|
1963
1963
|
`;
|
|
1964
1964
|
}
|
|
1965
|
-
return this.isLoggedIn ?
|
|
1965
|
+
return this.isLoggedIn ? y`
|
|
1966
1966
|
<!-- Header -->
|
|
1967
|
-
${this.logoUrl.length > 0 ?
|
|
1967
|
+
${this.logoUrl.length > 0 ? y`
|
|
1968
1968
|
<header class="modal-header">
|
|
1969
1969
|
<div class="auth-header">
|
|
1970
1970
|
<img
|
|
@@ -1987,9 +1987,9 @@ let m = class extends H {
|
|
|
1987
1987
|
${this.renderAlerts()}
|
|
1988
1988
|
</div>
|
|
1989
1989
|
</div>
|
|
1990
|
-
` :
|
|
1990
|
+
` : y`
|
|
1991
1991
|
<!-- Header -->
|
|
1992
|
-
${(!this.mode || this.resetStep === "none") && this.logoUrl.length > 0 && this.mode === "signin" ?
|
|
1992
|
+
${(!this.mode || this.resetStep === "none") && this.logoUrl.length > 0 && this.mode === "signin" ? y`
|
|
1993
1993
|
<header class="modal-header">
|
|
1994
1994
|
|
|
1995
1995
|
<div class="auth-header">
|
|
@@ -2023,7 +2023,7 @@ let m = class extends H {
|
|
|
2023
2023
|
}
|
|
2024
2024
|
renderFormContent() {
|
|
2025
2025
|
if (this.resetStep === "none" && (!this.mode || this.mode === "signin" || this.signupStep === "form"))
|
|
2026
|
-
return
|
|
2026
|
+
return y`
|
|
2027
2027
|
<!-- Email -->
|
|
2028
2028
|
<label class="field">
|
|
2029
2029
|
<span class="field-label">Email Address</span>
|
|
@@ -2037,7 +2037,7 @@ let m = class extends H {
|
|
|
2037
2037
|
required
|
|
2038
2038
|
autocomplete="email"
|
|
2039
2039
|
/>
|
|
2040
|
-
${this.errors.email ?
|
|
2040
|
+
${this.errors.email ? y`<span class="field-error">${this.errors.email}</span>` : g}
|
|
2041
2041
|
</label>
|
|
2042
2042
|
|
|
2043
2043
|
<!-- Password -->
|
|
@@ -2052,10 +2052,10 @@ let m = class extends H {
|
|
|
2052
2052
|
required
|
|
2053
2053
|
autocomplete=${this.mode === "signup" ? "new-password" : "current-password"}
|
|
2054
2054
|
/>
|
|
2055
|
-
${this.errors.password ?
|
|
2055
|
+
${this.errors.password ? y`<span class="field-error">${this.errors.password}</span>` : g}
|
|
2056
2056
|
</label>
|
|
2057
2057
|
|
|
2058
|
-
${this.mode === "signin" && this.error ?
|
|
2058
|
+
${this.mode === "signin" && this.error ? y`
|
|
2059
2059
|
<div class="forgot-row">
|
|
2060
2060
|
<button type="button" class="text-btn" @click=${this.startReset}>
|
|
2061
2061
|
Forgot your password?
|
|
@@ -2063,7 +2063,7 @@ let m = class extends H {
|
|
|
2063
2063
|
</div>
|
|
2064
2064
|
` : g}
|
|
2065
2065
|
|
|
2066
|
-
${this.mode === "signup" ?
|
|
2066
|
+
${this.mode === "signup" ? y`
|
|
2067
2067
|
<!-- Confirm Password -->
|
|
2068
2068
|
<label class="field">
|
|
2069
2069
|
<span class="field-label">Confirm Password</span>
|
|
@@ -2076,7 +2076,7 @@ let m = class extends H {
|
|
|
2076
2076
|
required
|
|
2077
2077
|
autocomplete="new-password"
|
|
2078
2078
|
/>
|
|
2079
|
-
${this.errors.confirm_password ?
|
|
2079
|
+
${this.errors.confirm_password ? y`<span class="field-error">${this.errors.confirm_password}</span>` : g}
|
|
2080
2080
|
</label>
|
|
2081
2081
|
|
|
2082
2082
|
<!-- First Name -->
|
|
@@ -2091,7 +2091,7 @@ let m = class extends H {
|
|
|
2091
2091
|
required
|
|
2092
2092
|
autocomplete="given-name"
|
|
2093
2093
|
/>
|
|
2094
|
-
${this.errors.givenName ?
|
|
2094
|
+
${this.errors.givenName ? y`<span class="field-error">${this.errors.givenName}</span>` : g}
|
|
2095
2095
|
</label>
|
|
2096
2096
|
|
|
2097
2097
|
<!-- Last Name -->
|
|
@@ -2106,19 +2106,19 @@ let m = class extends H {
|
|
|
2106
2106
|
required
|
|
2107
2107
|
autocomplete="family-name"
|
|
2108
2108
|
/>
|
|
2109
|
-
${this.errors.familyName ?
|
|
2109
|
+
${this.errors.familyName ? y`<span class="field-error">${this.errors.familyName}</span>` : g}
|
|
2110
2110
|
</label>
|
|
2111
2111
|
` : g}
|
|
2112
2112
|
`;
|
|
2113
2113
|
if (this.mode === "signup" && this.signupStep === "otp")
|
|
2114
|
-
return
|
|
2114
|
+
return y`
|
|
2115
2115
|
<div class="otp-section">
|
|
2116
2116
|
<label class="otp-label">Enter 6-digit code</label>
|
|
2117
2117
|
<div class="otp-inputs" role="group" aria-label="One time code">
|
|
2118
2118
|
${$t(
|
|
2119
2119
|
Array.from({ length: 6 }, (e, t) => t),
|
|
2120
2120
|
(e) => e,
|
|
2121
|
-
(e) =>
|
|
2121
|
+
(e) => y`
|
|
2122
2122
|
<input
|
|
2123
2123
|
class="otp-input signup-otp-input ${this.errors.signup_otp ? "otp-input--error" : ""}"
|
|
2124
2124
|
type="text"
|
|
@@ -2135,7 +2135,7 @@ let m = class extends H {
|
|
|
2135
2135
|
`
|
|
2136
2136
|
)}
|
|
2137
2137
|
</div>
|
|
2138
|
-
${this.errors.signup_otp ?
|
|
2138
|
+
${this.errors.signup_otp ? y`<p class="otp-error">${this.errors.signup_otp}</p>` : g}
|
|
2139
2139
|
</div>
|
|
2140
2140
|
<div class="forgot-row">
|
|
2141
2141
|
<button type="button" class="text-btn" @click=${this.backToSignupForm}>
|
|
@@ -2144,7 +2144,7 @@ let m = class extends H {
|
|
|
2144
2144
|
</div>
|
|
2145
2145
|
`;
|
|
2146
2146
|
if (this.resetStep === "request")
|
|
2147
|
-
return
|
|
2147
|
+
return y`
|
|
2148
2148
|
<label class="field">
|
|
2149
2149
|
<span class="field-label">Email Address</span>
|
|
2150
2150
|
<input
|
|
@@ -2157,7 +2157,7 @@ let m = class extends H {
|
|
|
2157
2157
|
required
|
|
2158
2158
|
autocomplete="email"
|
|
2159
2159
|
/>
|
|
2160
|
-
${this.errors.email ?
|
|
2160
|
+
${this.errors.email ? y`<span class="field-error">${this.errors.email}</span>` : g}
|
|
2161
2161
|
</label>
|
|
2162
2162
|
<div class="forgot-row">
|
|
2163
2163
|
<button type="button" class="text-btn" @click=${this.cancelReset}>
|
|
@@ -2167,7 +2167,7 @@ let m = class extends H {
|
|
|
2167
2167
|
`;
|
|
2168
2168
|
if (this.resetStep === "confirm") {
|
|
2169
2169
|
const e = this.otpDigits.every((t) => /^\d$/.test(t));
|
|
2170
|
-
return
|
|
2170
|
+
return y`
|
|
2171
2171
|
<label class="field">
|
|
2172
2172
|
<span class="field-label">Email Address</span>
|
|
2173
2173
|
<input
|
|
@@ -2179,7 +2179,7 @@ let m = class extends H {
|
|
|
2179
2179
|
required
|
|
2180
2180
|
autocomplete="email"
|
|
2181
2181
|
/>
|
|
2182
|
-
${this.errors.email ?
|
|
2182
|
+
${this.errors.email ? y`<span class="field-error">${this.errors.email}</span>` : g}
|
|
2183
2183
|
</label>
|
|
2184
2184
|
|
|
2185
2185
|
<div class="otp-section">
|
|
@@ -2188,7 +2188,7 @@ let m = class extends H {
|
|
|
2188
2188
|
${$t(
|
|
2189
2189
|
Array.from({ length: 6 }, (t, s) => s),
|
|
2190
2190
|
(t) => t,
|
|
2191
|
-
(t) =>
|
|
2191
|
+
(t) => y`
|
|
2192
2192
|
<input
|
|
2193
2193
|
class="otp-input reset-otp-input ${this.errors.otp ? "otp-input--error" : ""}"
|
|
2194
2194
|
type="text"
|
|
@@ -2205,10 +2205,10 @@ let m = class extends H {
|
|
|
2205
2205
|
`
|
|
2206
2206
|
)}
|
|
2207
2207
|
</div>
|
|
2208
|
-
${this.errors.otp ?
|
|
2208
|
+
${this.errors.otp ? y`<p class="otp-error">${this.errors.otp}</p>` : g}
|
|
2209
2209
|
</div>
|
|
2210
2210
|
|
|
2211
|
-
${e ?
|
|
2211
|
+
${e ? y`
|
|
2212
2212
|
<div class="new-password-fields">
|
|
2213
2213
|
<label class="field">
|
|
2214
2214
|
<span class="field-label">New Password</span>
|
|
@@ -2221,7 +2221,7 @@ let m = class extends H {
|
|
|
2221
2221
|
required
|
|
2222
2222
|
autocomplete="new-password"
|
|
2223
2223
|
/>
|
|
2224
|
-
${this.errors.new_password ?
|
|
2224
|
+
${this.errors.new_password ? y`<span class="field-error">${this.errors.new_password}</span>` : g}
|
|
2225
2225
|
</label>
|
|
2226
2226
|
|
|
2227
2227
|
<label class="field">
|
|
@@ -2235,7 +2235,7 @@ let m = class extends H {
|
|
|
2235
2235
|
required
|
|
2236
2236
|
autocomplete="new-password"
|
|
2237
2237
|
/>
|
|
2238
|
-
${this.errors.confirm_password ?
|
|
2238
|
+
${this.errors.confirm_password ? y`<span class="field-error">${this.errors.confirm_password}</span>` : g}
|
|
2239
2239
|
</label>
|
|
2240
2240
|
</div>
|
|
2241
2241
|
` : g}
|
|
@@ -2251,31 +2251,31 @@ let m = class extends H {
|
|
|
2251
2251
|
}
|
|
2252
2252
|
renderActions() {
|
|
2253
2253
|
if (this.resetStep === "request")
|
|
2254
|
-
return
|
|
2254
|
+
return y`
|
|
2255
2255
|
<button type="submit" class="cta" ?disabled=${this.isLoading}>
|
|
2256
2256
|
${this.isLoading ? "Sending..." : "Send Reset Code"}
|
|
2257
2257
|
</button>
|
|
2258
2258
|
`;
|
|
2259
2259
|
if (this.resetStep === "confirm")
|
|
2260
|
-
return this.otpDigits.every((t) => /^\d$/.test(t)) ?
|
|
2260
|
+
return this.otpDigits.every((t) => /^\d$/.test(t)) ? y`
|
|
2261
2261
|
<button type="submit" class="cta" ?disabled=${this.isLoading}>
|
|
2262
2262
|
${this.isLoading ? "Resetting..." : "Reset Password"}
|
|
2263
2263
|
</button>
|
|
2264
2264
|
` : g;
|
|
2265
2265
|
if (this.mode === "signup" && this.signupStep === "otp") {
|
|
2266
2266
|
const e = this.signupOtpDigits.every((t) => /^\d$/.test(t));
|
|
2267
|
-
return
|
|
2267
|
+
return y`
|
|
2268
2268
|
<button type="submit" class="cta" ?disabled=${!e || this.isLoading}>
|
|
2269
2269
|
${this.isLoading ? "Completing..." : "Complete Registration"}
|
|
2270
2270
|
</button>
|
|
2271
2271
|
`;
|
|
2272
2272
|
}
|
|
2273
|
-
return
|
|
2273
|
+
return y`
|
|
2274
2274
|
<button type="submit" class="cta" ?disabled=${this.isLoading}>
|
|
2275
2275
|
${this.isLoading ? "Loading..." : this.mode === "signup" ? "Continue" : "Sign In"}
|
|
2276
2276
|
</button>
|
|
2277
2277
|
|
|
2278
|
-
${this.isOAuthConfigured() && this.mode === "signin" ?
|
|
2278
|
+
${this.isOAuthConfigured() && this.mode === "signin" ? y`
|
|
2279
2279
|
<div class="button-row">
|
|
2280
2280
|
<button
|
|
2281
2281
|
type="button"
|
|
@@ -2299,8 +2299,8 @@ let m = class extends H {
|
|
|
2299
2299
|
`;
|
|
2300
2300
|
}
|
|
2301
2301
|
renderAlerts() {
|
|
2302
|
-
return
|
|
2303
|
-
${this.notice ?
|
|
2302
|
+
return y`
|
|
2303
|
+
${this.notice ? y`
|
|
2304
2304
|
<div class="alert alert--success">
|
|
2305
2305
|
${this.notice}
|
|
2306
2306
|
<button class="alert-close" @click=${() => this.notice = ""} aria-label="Dismiss">
|
|
@@ -2308,7 +2308,7 @@ let m = class extends H {
|
|
|
2308
2308
|
</button>
|
|
2309
2309
|
</div>
|
|
2310
2310
|
` : g}
|
|
2311
|
-
${this.error ?
|
|
2311
|
+
${this.error ? y`
|
|
2312
2312
|
<div class="alert alert--error">
|
|
2313
2313
|
${this.error}
|
|
2314
2314
|
<button class="alert-close" @click=${() => this.error = ""} aria-label="Dismiss">
|
|
@@ -2319,7 +2319,7 @@ let m = class extends H {
|
|
|
2319
2319
|
`;
|
|
2320
2320
|
}
|
|
2321
2321
|
renderFooter() {
|
|
2322
|
-
return this.isLoggedIn ? g : this.resetStep === "none" && (!this.mode || this.mode === "signin" || this.signupStep === "form") ?
|
|
2322
|
+
return this.isLoggedIn ? g : this.resetStep === "none" && (!this.mode || this.mode === "signin" || this.signupStep === "form") ? this.disableSignup ? g : y`
|
|
2323
2323
|
<div class="auth-footer">
|
|
2324
2324
|
<p class="toggle-text">
|
|
2325
2325
|
${this.mode === "signup" ? "Already have an account?" : "Don't have an account?"}
|
|
@@ -2328,7 +2328,7 @@ let m = class extends H {
|
|
|
2328
2328
|
${this.mode === "signup" ? "Sign In" : "Sign Up"}
|
|
2329
2329
|
</button>
|
|
2330
2330
|
</div>
|
|
2331
|
-
` :
|
|
2331
|
+
` : y`
|
|
2332
2332
|
<div class="auth-footer">
|
|
2333
2333
|
<p class="toggle-text">
|
|
2334
2334
|
Having trouble? Email
|
|
@@ -2338,7 +2338,7 @@ let m = class extends H {
|
|
|
2338
2338
|
`;
|
|
2339
2339
|
}
|
|
2340
2340
|
renderGoogleIcon() {
|
|
2341
|
-
return
|
|
2341
|
+
return y`
|
|
2342
2342
|
<svg viewBox="-0.5 0 48 48" width="18" height="18" fill="none">
|
|
2343
2343
|
<path d="M9.82727273,24 C9.82727273,22.4757333 10.0804318,21.0144 10.5322727,19.6437333 L2.62345455,13.6042667 C1.08206818,16.7338667 0.213636364,20.2602667 0.213636364,24 C0.213636364,27.7365333 1.081,31.2608 2.62025,34.3882667 L10.5247955,28.3370667 C10.0772273,26.9728 9.82727273,25.5168 9.82727273,24" fill="#FBBC05"></path>
|
|
2344
2344
|
<path d="M23.7136364,10.1333333 C27.025,10.1333333 30.0159091,11.3066667 32.3659091,13.2266667 L39.2022727,6.4 C35.0363636,2.77333333 29.6954545,0.533333333 23.7136364,0.533333333 C14.4268636,0.533333333 6.44540909,5.84426667 2.62345455,13.6042667 L10.5322727,19.6437333 C12.3545909,14.112 17.5491591,10.1333333 23.7136364,10.1333333" fill="#EB4335"></path>
|
|
@@ -2348,7 +2348,7 @@ let m = class extends H {
|
|
|
2348
2348
|
`;
|
|
2349
2349
|
}
|
|
2350
2350
|
renderAppleIcon() {
|
|
2351
|
-
return
|
|
2351
|
+
return y`
|
|
2352
2352
|
<svg viewBox="-3.5 0 48 48" width="18" height="18" class="apple-icon">
|
|
2353
2353
|
<path d="M231.174735,567.792499 C232.740177,565.771699 233.926883,562.915484 233.497649,560 C230.939077,560.177808 227.948466,561.814769 226.203475,563.948463 C224.612784,565.88177 223.305444,568.757742 223.816036,571.549042 C226.613071,571.636535 229.499881,569.960061 231.174735,567.792499 L231.174735,567.792499 Z M245,595.217241 C243.880625,597.712195 243.341978,598.827022 241.899976,601.03692 C239.888467,604.121745 237.052156,607.962958 233.53412,607.991182 C230.411652,608.02505 229.606488,605.94498 225.367451,605.970382 C221.128414,605.99296 220.244696,608.030695 217.116618,607.999649 C213.601387,607.968603 210.913765,604.502761 208.902256,601.417937 C203.27452,592.79849 202.68257,582.680377 206.152914,577.298162 C208.621711,573.476705 212.515678,571.241407 216.173986,571.241407 C219.89682,571.241407 222.239372,573.296075 225.322563,573.296075 C228.313175,573.296075 230.133913,571.235762 234.440281,571.235762 C237.700215,571.235762 241.153726,573.022307 243.611302,576.10431 C235.554045,580.546683 236.85858,592.121127 245,595.217241 L245,595.217241 Z" transform="translate(-204.000000, -560.000000)" fill="#0b0b0a"></path>
|
|
2354
2354
|
</svg>
|
|
@@ -2388,123 +2388,126 @@ let m = class extends H {
|
|
|
2388
2388
|
}
|
|
2389
2389
|
};
|
|
2390
2390
|
m.styles = de();
|
|
2391
|
-
|
|
2391
|
+
f([
|
|
2392
2392
|
S({ type: Boolean, reflect: !0 })
|
|
2393
2393
|
], m.prototype, "open", 2);
|
|
2394
|
-
|
|
2394
|
+
f([
|
|
2395
2395
|
S({ type: String, attribute: "initial-mode" })
|
|
2396
2396
|
], m.prototype, "initialMode", 2);
|
|
2397
|
-
|
|
2397
|
+
f([
|
|
2398
2398
|
S({ type: String, attribute: "logo-url" })
|
|
2399
2399
|
], m.prototype, "logoUrl", 2);
|
|
2400
|
-
|
|
2400
|
+
f([
|
|
2401
2401
|
S({ type: String, attribute: "api-domain" })
|
|
2402
2402
|
], m.prototype, "baseUrl", 2);
|
|
2403
|
-
|
|
2403
|
+
f([
|
|
2404
2404
|
S({ type: String, attribute: "oauth-domain" })
|
|
2405
2405
|
], m.prototype, "oauthDomain", 2);
|
|
2406
|
-
|
|
2406
|
+
f([
|
|
2407
2407
|
S({ type: String, attribute: "oauth-region" })
|
|
2408
2408
|
], m.prototype, "oauthRegion", 2);
|
|
2409
|
-
|
|
2409
|
+
f([
|
|
2410
2410
|
S({ type: String, attribute: "oauth-user-pool-id" })
|
|
2411
2411
|
], m.prototype, "oauthUserPoolId", 2);
|
|
2412
|
-
|
|
2412
|
+
f([
|
|
2413
2413
|
S({ type: String, attribute: "oauth-client-id" })
|
|
2414
2414
|
], m.prototype, "oauthClientId", 2);
|
|
2415
|
-
|
|
2415
|
+
f([
|
|
2416
2416
|
S({ type: String, attribute: "oauth-redirect-uri" })
|
|
2417
2417
|
], m.prototype, "oauthRedirectUri", 2);
|
|
2418
|
-
|
|
2418
|
+
f([
|
|
2419
2419
|
S({ type: String, attribute: "oauth-spa-domain" })
|
|
2420
2420
|
], m.prototype, "oauthSpaDomain", 2);
|
|
2421
|
-
|
|
2421
|
+
f([
|
|
2422
2422
|
S({ type: String, attribute: "size" })
|
|
2423
2423
|
], m.prototype, "size", 2);
|
|
2424
|
-
|
|
2424
|
+
f([
|
|
2425
2425
|
S({ type: String, attribute: "data-theme", reflect: !0 })
|
|
2426
2426
|
], m.prototype, "theme", 2);
|
|
2427
|
-
|
|
2427
|
+
f([
|
|
2428
|
+
S({ type: Boolean, attribute: "disable-signup" })
|
|
2429
|
+
], m.prototype, "disableSignup", 2);
|
|
2430
|
+
f([
|
|
2428
2431
|
b()
|
|
2429
2432
|
], m.prototype, "mode", 2);
|
|
2430
|
-
|
|
2433
|
+
f([
|
|
2431
2434
|
b()
|
|
2432
2435
|
], m.prototype, "resetStep", 2);
|
|
2433
|
-
|
|
2436
|
+
f([
|
|
2434
2437
|
b()
|
|
2435
2438
|
], m.prototype, "signupStep", 2);
|
|
2436
|
-
|
|
2439
|
+
f([
|
|
2437
2440
|
b()
|
|
2438
2441
|
], m.prototype, "isLoading", 2);
|
|
2439
|
-
|
|
2442
|
+
f([
|
|
2440
2443
|
b()
|
|
2441
2444
|
], m.prototype, "isClosing", 2);
|
|
2442
|
-
|
|
2445
|
+
f([
|
|
2443
2446
|
b()
|
|
2444
2447
|
], m.prototype, "isVisible", 2);
|
|
2445
|
-
|
|
2448
|
+
f([
|
|
2446
2449
|
b()
|
|
2447
2450
|
], m.prototype, "isLoggedIn", 2);
|
|
2448
|
-
|
|
2451
|
+
f([
|
|
2449
2452
|
b()
|
|
2450
2453
|
], m.prototype, "email", 2);
|
|
2451
|
-
|
|
2454
|
+
f([
|
|
2452
2455
|
b()
|
|
2453
2456
|
], m.prototype, "password", 2);
|
|
2454
|
-
|
|
2457
|
+
f([
|
|
2455
2458
|
b()
|
|
2456
2459
|
], m.prototype, "givenName", 2);
|
|
2457
|
-
|
|
2460
|
+
f([
|
|
2458
2461
|
b()
|
|
2459
2462
|
], m.prototype, "familyName", 2);
|
|
2460
|
-
|
|
2463
|
+
f([
|
|
2461
2464
|
b()
|
|
2462
2465
|
], m.prototype, "newPassword", 2);
|
|
2463
|
-
|
|
2466
|
+
f([
|
|
2464
2467
|
b()
|
|
2465
2468
|
], m.prototype, "confirmPassword", 2);
|
|
2466
|
-
|
|
2469
|
+
f([
|
|
2467
2470
|
b()
|
|
2468
2471
|
], m.prototype, "notice", 2);
|
|
2469
|
-
|
|
2472
|
+
f([
|
|
2470
2473
|
b()
|
|
2471
2474
|
], m.prototype, "error", 2);
|
|
2472
|
-
|
|
2475
|
+
f([
|
|
2473
2476
|
b()
|
|
2474
2477
|
], m.prototype, "errors", 2);
|
|
2475
|
-
|
|
2478
|
+
f([
|
|
2476
2479
|
b()
|
|
2477
2480
|
], m.prototype, "otpDigits", 2);
|
|
2478
|
-
|
|
2481
|
+
f([
|
|
2479
2482
|
b()
|
|
2480
2483
|
], m.prototype, "signupOtpDigits", 2);
|
|
2481
|
-
|
|
2484
|
+
f([
|
|
2482
2485
|
b()
|
|
2483
2486
|
], m.prototype, "isDragging", 2);
|
|
2484
|
-
|
|
2487
|
+
f([
|
|
2485
2488
|
b()
|
|
2486
2489
|
], m.prototype, "dragStartY", 2);
|
|
2487
|
-
|
|
2490
|
+
f([
|
|
2488
2491
|
b()
|
|
2489
2492
|
], m.prototype, "dragCurrentY", 2);
|
|
2490
|
-
|
|
2493
|
+
f([
|
|
2491
2494
|
b()
|
|
2492
2495
|
], m.prototype, "dragStartTime", 2);
|
|
2493
|
-
|
|
2496
|
+
f([
|
|
2494
2497
|
b()
|
|
2495
2498
|
], m.prototype, "lastDragEndTime", 2);
|
|
2496
|
-
|
|
2499
|
+
f([
|
|
2497
2500
|
it(".modal-container")
|
|
2498
2501
|
], m.prototype, "modalContainer", 2);
|
|
2499
|
-
|
|
2502
|
+
f([
|
|
2500
2503
|
it("#email-input")
|
|
2501
2504
|
], m.prototype, "emailInput", 2);
|
|
2502
|
-
|
|
2505
|
+
f([
|
|
2503
2506
|
it(".modal-body")
|
|
2504
2507
|
], m.prototype, "modalBody", 2);
|
|
2505
|
-
m =
|
|
2508
|
+
m = f([
|
|
2506
2509
|
Zt("auth")
|
|
2507
2510
|
], m);
|
|
2508
2511
|
export {
|
|
2509
|
-
m as
|
|
2512
|
+
m as Auth
|
|
2510
2513
|
};
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
1
2
|
import { CSSResult } from 'lit';
|
|
2
3
|
import { LitElement } from 'lit';
|
|
3
4
|
import { nothing } from 'lit';
|
|
4
5
|
import { PropertyValues } from 'lit';
|
|
5
6
|
import { TemplateResult } from 'lit-html';
|
|
6
7
|
|
|
7
|
-
declare
|
|
8
|
+
export declare const apiClient: ({ baseUrl, apiBaseUrl }: ApiClientConfig) => AxiosInstance;
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
declare interface ApiClientConfig {
|
|
11
|
+
baseUrl: string;
|
|
12
|
+
apiBaseUrl?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export declare class Auth extends LitElement {
|
|
10
16
|
open: boolean;
|
|
11
17
|
initialMode: AuthMode;
|
|
12
18
|
logoUrl: string;
|
|
@@ -19,6 +25,7 @@ export declare class CalsAuth extends LitElement {
|
|
|
19
25
|
oauthSpaDomain: string;
|
|
20
26
|
size: 'sm' | 'md' | 'lg';
|
|
21
27
|
theme: 'light' | 'dark';
|
|
28
|
+
disableSignup: boolean;
|
|
22
29
|
private mode;
|
|
23
30
|
private resetStep;
|
|
24
31
|
private signupStep;
|
|
@@ -110,7 +117,15 @@ export declare class CalsAuth extends LitElement {
|
|
|
110
117
|
static styles: CSSResult;
|
|
111
118
|
}
|
|
112
119
|
|
|
113
|
-
|
|
120
|
+
declare type AuthMode = 'signin' | 'signup';
|
|
121
|
+
|
|
122
|
+
export declare class AuthRefreshError extends Error {
|
|
123
|
+
constructor(message?: string);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export declare const createApiClient: ({ baseUrl, apiBaseUrl }: ApiClientConfig) => AxiosInstance;
|
|
127
|
+
|
|
128
|
+
export declare class ThemeToggle extends LitElement {
|
|
114
129
|
theme: 'light' | 'dark';
|
|
115
130
|
storageKey: string;
|
|
116
131
|
size: 'sm' | 'md' | 'lg';
|