@tapni/auth 0.0.64 → 0.0.66
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/TapniAuth.es.js +17 -6
- package/dist/TapniAuth.umd.js +6 -6
- package/package.json +1 -1
- package/src/App.vue +4 -1
- package/src/mixins/auth.mixin.js +32 -6
package/dist/TapniAuth.es.js
CHANGED
|
@@ -8,7 +8,7 @@ import { Capacitor as Qt, registerPlugin as In, WebPlugin as Wo } from "@capacit
|
|
|
8
8
|
import { Browser as hn } from "@capacitor/browser";
|
|
9
9
|
import $o from "qr-code-styling";
|
|
10
10
|
import { sanitizeUrl as Jo } from "@braintree/sanitize-url";
|
|
11
|
-
const Xo = "0.0.
|
|
11
|
+
const Xo = "0.0.66";
|
|
12
12
|
let Un;
|
|
13
13
|
const Ft = {
|
|
14
14
|
setApiRootFromOptions(n) {
|
|
@@ -4337,6 +4337,7 @@ const ze = {
|
|
|
4337
4337
|
appLanguage: "en",
|
|
4338
4338
|
token: "",
|
|
4339
4339
|
refreshToken: "",
|
|
4340
|
+
refreshing: "",
|
|
4340
4341
|
loggedInUserId: "",
|
|
4341
4342
|
ssoUser: {},
|
|
4342
4343
|
ssoCompany: {},
|
|
@@ -4465,7 +4466,14 @@ const ze = {
|
|
|
4465
4466
|
}
|
|
4466
4467
|
]);
|
|
4467
4468
|
},
|
|
4469
|
+
async switchAccount(n) {
|
|
4470
|
+
this.$storage.username = n, this.$storage.UserId = this.loggedInAccounts[n].id, this.setLoggedInUserId(this.loggedInAccounts[n].id), this.setRefreshToken(this.loggedInAccounts[n].refreshToken), await this.refreshTokenAction({ id: this.loggedInAccounts[n].id }), z.$emit("ssoEvent", {
|
|
4471
|
+
name: "switchAccount",
|
|
4472
|
+
data: { lang: this.appLanguage, username: n }
|
|
4473
|
+
});
|
|
4474
|
+
},
|
|
4468
4475
|
async refreshTokenAction(n) {
|
|
4476
|
+
this.refreshing = !0;
|
|
4469
4477
|
const [e, t] = await Z(
|
|
4470
4478
|
Me.refreshToken({
|
|
4471
4479
|
id: n.id,
|
|
@@ -4475,7 +4483,7 @@ const ze = {
|
|
|
4475
4483
|
);
|
|
4476
4484
|
if (e && e.response && e.response.data.error === "ACCESS_DENIED")
|
|
4477
4485
|
return this.logout(!1), location.reload();
|
|
4478
|
-
t && t.data ? this.setToken(t.data.token) : console.error("Invalid response setToken");
|
|
4486
|
+
t && t.data ? this.setToken(t.data.token) : console.error("Invalid response setToken"), this.refreshing = !1;
|
|
4479
4487
|
},
|
|
4480
4488
|
async login(n) {
|
|
4481
4489
|
const [e, t] = await Z(Me.login(n, this.$storage));
|
|
@@ -4615,11 +4623,14 @@ const ze = {
|
|
|
4615
4623
|
this.ssoUser = n, this.$storage && this.ssoUser && this.$storage.username === this.ssoUser.username && (this.appLanguage = n.ssoLang);
|
|
4616
4624
|
},
|
|
4617
4625
|
getRefreshTokens() {
|
|
4618
|
-
|
|
4626
|
+
if (this.$storage && this.$storage.refreshTokens)
|
|
4627
|
+
this.$storage.refreshTokens.split(",");
|
|
4628
|
+
else
|
|
4629
|
+
return [];
|
|
4619
4630
|
},
|
|
4620
4631
|
setRefreshToken(n) {
|
|
4621
4632
|
let e = this.getRefreshTokens();
|
|
4622
|
-
n
|
|
4633
|
+
n ? (e.includes(n) || e.unshift(n), this.refreshToken = n) : (e = e.filter((t) => t !== this.refreshToken), e && e.length >= 1 && (this.refreshToken = e[0])), this.$storage.refreshTokens = e.join(","), z.$emit("ssoEvent", { name: "setRefreshToken", data: n });
|
|
4623
4634
|
},
|
|
4624
4635
|
setToken(n) {
|
|
4625
4636
|
this.$storage.token = n, this.token = n, z.$emit("ssoEvent", { name: "setToken", data: n });
|
|
@@ -16635,7 +16646,7 @@ const Su = { id: "ssoapp" }, Au = {
|
|
|
16635
16646
|
}
|
|
16636
16647
|
},
|
|
16637
16648
|
async mounted() {
|
|
16638
|
-
this.applyBgStyle(), z.$on("ssoEvent", this.ssoOutgoingEvent), z.$on("ssoLogout", (n) => this.logout(n)), z.$on("getLoggedInAccounts", (n) => this.getLoggedInAccounts(n)), z.$on("refreshTokenAction", (n) => this.refreshTokenAction(n));
|
|
16649
|
+
this.applyBgStyle(), z.$on("ssoEvent", this.ssoOutgoingEvent), z.$on("ssoLogout", (n) => this.logout(n)), z.$on("getLoggedInAccounts", (n) => this.getLoggedInAccounts(n)), z.$on("refreshTokenAction", (n) => this.refreshTokenAction(n)), z.$on("switchAccount", (n) => this.switchAccount(n));
|
|
16639
16650
|
},
|
|
16640
16651
|
methods: {
|
|
16641
16652
|
async init() {
|
|
@@ -16643,7 +16654,7 @@ const Su = { id: "ssoapp" }, Au = {
|
|
|
16643
16654
|
return;
|
|
16644
16655
|
this.isSetup = !0, this.setToken(this.$storage.token);
|
|
16645
16656
|
const n = this.getRefreshTokens();
|
|
16646
|
-
this.setRefreshToken(n[0]), this.getLoggedInAccounts(), this.$emit("ssoLibraryReady");
|
|
16657
|
+
n && n.length >= 1 && this.setRefreshToken(n[0]), this.getLoggedInAccounts(), this.$emit("ssoLibraryReady");
|
|
16647
16658
|
},
|
|
16648
16659
|
ssoOutgoingEvent(n) {
|
|
16649
16660
|
this.$emit("ssoEvent", n);
|