@tapni/auth 1.0.14 → 1.0.16

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.
@@ -1397,7 +1397,7 @@ function pa(n, e, t, r, o, i) {
1397
1397
  const ao = /* @__PURE__ */ _t(oa, [["render", pa], ["__scopeId", "data-v-7aad6400"]]), ha = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1398
1398
  __proto__: null,
1399
1399
  default: ao
1400
- }, Symbol.toStringTag, { value: "Module" })), fa = "1.0.14", cr = {
1400
+ }, Symbol.toStringTag, { value: "Module" })), fa = "1.0.16", cr = {
1401
1401
  getMe() {
1402
1402
  return le().get("/users/me");
1403
1403
  },
@@ -5563,7 +5563,7 @@ Tanıştığınız herkesi etkileyin 😎 <br> Kendinize bir tane ayırın 👇`
5563
5563
  choose_other_login_methods: "다른 로그인 방법 선택하기",
5564
5564
  no_sso_logins: "귀하의 회사는 SSO 로그인을 사용하지 않습니다. 관리자에게 문의하십시오."
5565
5565
  }
5566
- }, To = () => Promise.resolve().then(() => ha), ma = () => Promise.resolve().then(() => mc), _a = () => Promise.resolve().then(() => cl), va = () => Promise.resolve().then(() => Xu), ya = () => Promise.resolve().then(() => zc), wa = () => Promise.resolve().then(() => Cl), ba = () => Promise.resolve().then(() => od), ka = () => import("./QR-BfTMaaLP.js"), Ca = () => Promise.resolve().then(() => Cu), Ea = () => import("./Apps-CFXAriI4.js"), Ta = () => import("./Billing-JwfACI7M.js"), Sa = () => import("./CustomApp---b2SbIq.js"), Ia = () => import("./General-kIEcVs4A.js"), Aa = [
5566
+ }, To = () => Promise.resolve().then(() => ha), ma = () => Promise.resolve().then(() => mc), _a = () => Promise.resolve().then(() => cl), va = () => Promise.resolve().then(() => Xu), ya = () => Promise.resolve().then(() => zc), wa = () => Promise.resolve().then(() => Cl), ba = () => Promise.resolve().then(() => od), ka = () => import("./QR-CvamZkR6.js"), Ca = () => Promise.resolve().then(() => Cu), Ea = () => import("./Apps-DgbnT61Y.js"), Ta = () => import("./Billing-CSZHUj6r.js"), Sa = () => import("./CustomApp-9V1Zs2Qk.js"), Ia = () => import("./General-CtJdOqp0.js"), Aa = [
5567
5567
  {
5568
5568
  path: "/welcome",
5569
5569
  name: "AuthWelcome",
@@ -15231,7 +15231,7 @@ const xs = Ir("MsAuthPlugin", {
15231
15231
  var a;
15232
15232
  if (!this.allowedOriginsAuth.includes(i.origin)) return console.log("Origin is not allowed! " + i.origin);
15233
15233
  if (i.data.code) {
15234
- if (console.log("post message from opener", i.data, o.display), o.display === "popup")
15234
+ if (o.display === "popup")
15235
15235
  return (a = window.parent) == null ? void 0 : a.postMessage({ code: i.data.code, state: i.data.state, code_verifier: localStorage.getItem("pkce_code_verifier") }, "*");
15236
15236
  await o.exchangeAuthCode({ code: i.data.code, code_verifier: localStorage.getItem("pkce_code_verifier") }), localStorage.removeItem("pkce_code_verifier");
15237
15237
  }
@@ -15240,7 +15240,7 @@ const xs = Ir("MsAuthPlugin", {
15240
15240
  ), this.isNative ? this.popupWindow = await fr.open({ url: n, presentationStyle: "popover" }) : (this.checkInterval = setInterval(() => {
15241
15241
  var s;
15242
15242
  const i = localStorage.getItem("auth_code"), a = localStorage.getItem("pkce_code_verifier");
15243
- console.log("interval", i, a), i && (clearInterval(this.checkInterval), localStorage.removeItem("auth_code"), localStorage.removeItem("pkce_code_verifier"), (s = window.parent) == null || s.postMessage({ code: i, state: this.$route.query.state, code_verifier: a }, "*"));
15243
+ i && (clearInterval(this.checkInterval), localStorage.removeItem("auth_code"), localStorage.removeItem("pkce_code_verifier"), (s = window.parent) == null || s.postMessage({ code: i, state: this.$route.query.state, code_verifier: a }, "*"), (this.display === "npm" || this.display === "redirect") && this.exchangeAuthCode({ code: i, code_verifier: a }));
15244
15244
  }, 500), this.popupWindow = window.open(window.location.origin + "/callback/redirect?uri=" + btoa(n), "popup", "width=600,height=600")), this.popupWindow && this.popupWindow.addEventListener("beforeunload", () => {
15245
15245
  console.log("popup window closed");
15246
15246
  });
@@ -15248,15 +15248,12 @@ const xs = Ir("MsAuthPlugin", {
15248
15248
  async handleSamlRedirect() {
15249
15249
  var e;
15250
15250
  let n;
15251
- if (this.$route.query.code && (n = this.$route.query.code), console.log("window1", window.opener), console.log("window2", window.parent), window.opener)
15251
+ if (this.$route.query.code && (n = this.$route.query.code), window.opener)
15252
15252
  window.opener.postMessage({ type: "saml", code: n }, "*"), this.closeWindow();
15253
15253
  else {
15254
- if (this.isNative && this.isiOS && await fr.close(), Y.$emit("ssoEvent", { name: "setLoading", data: !0 }), console.log(this.display, { code: n }, window.parent, window.opener), n) {
15255
- if (this.display === "popup" && (localStorage.setItem("auth_code", n), this.shouldCloseWindow = !0, (e = window.parent) == null || e.postMessage({ code: n, state: this.$route.query.state }, "*"), this.closeWindow()), this.display === "redirect" || location.host === "auth.tapni.com") {
15256
- let t = "https://auth.tapni.com/callback/auth";
15257
- return this.realm === "dashboard" && (t = "https://business.tapni.com/login"), location.href = t + "?code=" + n + "&code_verifier=" + localStorage.getItem("pkce_code_verifier");
15258
- }
15259
- await this.exchangeAuthCode({ code: n, code_verifier: localStorage.getItem("pkce_code_verifier") });
15254
+ if (this.isNative && this.isiOS && await fr.close(), Y.$emit("ssoEvent", { name: "setLoading", data: !0 }), n && ((this.display === "popup" || this.display === "npm") && (localStorage.setItem("auth_code", n), this.shouldCloseWindow = !0, (e = window.parent) == null || e.postMessage({ code: n, state: this.$route.query.state }, "*"), this.closeWindow()), this.display === "redirect" || location.host === "auth.tapni.com")) {
15255
+ let t = "https://auth.tapni.com/callback/auth";
15256
+ return this.realm === "dashboard" && (t = "https://business.tapni.com/login"), location.href = t + "?code=" + n + "&code_verifier=" + localStorage.getItem("pkce_code_verifier");
15260
15257
  }
15261
15258
  Y.$emit("ssoEvent", { name: "setLoading", data: !1 });
15262
15259
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapni/auth",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "type": "module",
5
5
  "main": "./dist/TapniAuth.umd.js",
6
6
  "module": "./dist/TapniAuth.es.js",
@@ -52,8 +52,6 @@ export default {
52
52
  async (message) => {
53
53
  if (!this.allowedOriginsAuth.includes(message.origin)) return console.log('Origin is not allowed! ' + message.origin);
54
54
  if (message.data.code) {
55
- console.log('post message from opener', message.data, self.display);
56
-
57
55
  if (self.display === 'popup') {
58
56
  return window.parent?.postMessage({ code: message.data.code, state: message.data.state, code_verifier: localStorage.getItem('pkce_code_verifier') }, '*');
59
57
  }
@@ -72,8 +70,6 @@ export default {
72
70
  const code = localStorage.getItem('auth_code');
73
71
  const pkce = localStorage.getItem('pkce_code_verifier');
74
72
 
75
- console.log('interval', code, pkce);
76
-
77
73
  if (code) {
78
74
  clearInterval(this.checkInterval);
79
75
  localStorage.removeItem('auth_code');
@@ -82,8 +78,9 @@ export default {
82
78
  // handle code exchange
83
79
  window.parent?.postMessage({ code: code, state: this.$route.query.state, code_verifier: pkce }, '*');
84
80
 
85
- // attempt to close child if possible
86
- // if (this.popupWindow?.closed === false) this.popupWindow.close();
81
+ if (this.display === 'npm' || this.display === 'redirect') {
82
+ this.exchangeAuthCode({ code, code_verifier: pkce });
83
+ }
87
84
  }
88
85
  }, 500);
89
86
 
@@ -102,8 +99,6 @@ export default {
102
99
  if (this.$route.query.code) {
103
100
  code = this.$route.query.code
104
101
  }
105
- console.log('window1', window.opener);
106
- console.log('window2', window.parent);
107
102
  if (window.opener) {
108
103
  window.opener.postMessage({ type: 'saml', code }, '*');
109
104
  this.closeWindow();
@@ -111,10 +106,8 @@ export default {
111
106
  if (this.isNative && this.isiOS) await Browser.close();
112
107
  EventBus.$emit('ssoEvent', { name: 'setLoading', data: true });
113
108
 
114
- console.log(this.display, { code }, window.parent, window.opener);
115
-
116
109
  if (code) {
117
- if (this.display === 'popup') {
110
+ if (this.display === 'popup' || this.display === 'npm') {
118
111
  localStorage.setItem('auth_code', code);
119
112
  this.shouldCloseWindow = true;
120
113
  window.parent?.postMessage({ code: code, state: this.$route.query.state }, '*');
@@ -128,9 +121,7 @@ export default {
128
121
  }
129
122
  return location.href = redirect_url + '?code=' + code + '&code_verifier=' + localStorage.getItem('pkce_code_verifier');
130
123
  }
131
- await this.exchangeAuthCode({ code, code_verifier: localStorage.getItem('pkce_code_verifier') });
132
124
  }
133
- // localStorage.removeItem('pkce_code_verifier');
134
125
  EventBus.$emit('ssoEvent', { name: 'setLoading', data: false });
135
126
  }
136
127
  }