@cal.macconnachie/web-components 0.0.13 → 0.0.15
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/dist/components/auth.js +10 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +10 -2
- package/package.json +1 -1
package/dist/components/auth.js
CHANGED
|
@@ -1663,7 +1663,12 @@ let m = class extends H {
|
|
|
1663
1663
|
}
|
|
1664
1664
|
}
|
|
1665
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
|
|
1666
|
+
this.cookies.setAuthToken("ACCESS_TOKEN", e), this.cookies.setAuthToken("AUTH_TOKEN", t), this.cookies.setAuthToken("REFRESH_TOKEN", s), this.isLoggedIn = !0, this.dispatchEvent(
|
|
1667
|
+
new CustomEvent("auth-success", {
|
|
1668
|
+
bubbles: !0,
|
|
1669
|
+
composed: !0
|
|
1670
|
+
})
|
|
1671
|
+
);
|
|
1667
1672
|
}
|
|
1668
1673
|
async handleSignIn() {
|
|
1669
1674
|
const e = {
|
|
@@ -1784,6 +1789,9 @@ let m = class extends H {
|
|
|
1784
1789
|
otp: e.otp
|
|
1785
1790
|
}), await this.handleSignIn();
|
|
1786
1791
|
}
|
|
1792
|
+
isUserLoggedIn() {
|
|
1793
|
+
return this.isLoggedIn;
|
|
1794
|
+
}
|
|
1787
1795
|
async logout() {
|
|
1788
1796
|
const e = this.cookies.getAuthToken("ACCESS_TOKEN"), t = this.cookies.getAuthToken("AUTH_TOKEN"), s = this.cookies.getAuthToken("REFRESH_TOKEN");
|
|
1789
1797
|
if (e == null || s == null || t == null) {
|
|
@@ -1804,7 +1812,7 @@ let m = class extends H {
|
|
|
1804
1812
|
});
|
|
1805
1813
|
if (this.cookies.clearAllAuthTokens(), this.isLoggedIn = !1, o && r) {
|
|
1806
1814
|
const a = window.location.host;
|
|
1807
|
-
new URL(r).host !== a ? window.open(r, "newWindow", "width=400,height=
|
|
1815
|
+
new URL(r).host !== a ? window.open(r, "newWindow", "width=400,height=500,resizable=yes,scrollbars=yes,status=yes") : window.location.href = r;
|
|
1808
1816
|
}
|
|
1809
1817
|
}
|
|
1810
1818
|
// OAuth handlers
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1663,7 +1663,12 @@ let A = class extends ee {
|
|
|
1663
1663
|
}
|
|
1664
1664
|
}
|
|
1665
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
|
|
1666
|
+
this.cookies.setAuthToken("ACCESS_TOKEN", t), this.cookies.setAuthToken("AUTH_TOKEN", e), this.cookies.setAuthToken("REFRESH_TOKEN", s), this.isLoggedIn = !0, this.dispatchEvent(
|
|
1667
|
+
new CustomEvent("auth-success", {
|
|
1668
|
+
bubbles: !0,
|
|
1669
|
+
composed: !0
|
|
1670
|
+
})
|
|
1671
|
+
);
|
|
1667
1672
|
}
|
|
1668
1673
|
async handleSignIn() {
|
|
1669
1674
|
const t = {
|
|
@@ -1784,6 +1789,9 @@ let A = class extends ee {
|
|
|
1784
1789
|
otp: t.otp
|
|
1785
1790
|
}), await this.handleSignIn();
|
|
1786
1791
|
}
|
|
1792
|
+
isUserLoggedIn() {
|
|
1793
|
+
return this.isLoggedIn;
|
|
1794
|
+
}
|
|
1787
1795
|
async logout() {
|
|
1788
1796
|
const t = this.cookies.getAuthToken("ACCESS_TOKEN"), e = this.cookies.getAuthToken("AUTH_TOKEN"), s = this.cookies.getAuthToken("REFRESH_TOKEN");
|
|
1789
1797
|
if (t == null || s == null || e == null) {
|
|
@@ -1804,7 +1812,7 @@ let A = class extends ee {
|
|
|
1804
1812
|
});
|
|
1805
1813
|
if (this.cookies.clearAllAuthTokens(), this.isLoggedIn = !1, o && i) {
|
|
1806
1814
|
const n = window.location.host;
|
|
1807
|
-
new URL(i).host !== n ? window.open(i, "newWindow", "width=400,height=
|
|
1815
|
+
new URL(i).host !== n ? window.open(i, "newWindow", "width=400,height=500,resizable=yes,scrollbars=yes,status=yes") : window.location.href = i;
|
|
1808
1816
|
}
|
|
1809
1817
|
}
|
|
1810
1818
|
// OAuth handlers
|