@tapni/auth 1.0.5 → 1.0.6-3.dev

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.
Files changed (78) hide show
  1. package/README.md +2 -0
  2. package/dist/.vite/manifest.json +16 -43
  3. package/dist/.well-known/assetlinks.json +10 -12
  4. package/dist/.well-known/microsoft-identity-association.json +5 -5
  5. package/dist/{Apps-DMds3Dv-.js → Apps-XNA4_3B4.js} +34 -34
  6. package/dist/Billing-Br0-fHed.js +256 -0
  7. package/dist/CustomApp-CrlbYDOm.js +83 -0
  8. package/dist/QR-Bvqb60-E.js +41 -0
  9. package/dist/TapniAuth.es.js +1 -1
  10. package/dist/TapniAuth.umd.js +49 -23
  11. package/dist/{install-L-cxSovH.js → install-7FOVy8Ol.js} +6267 -4743
  12. package/dist/site.webmanifest +11 -1
  13. package/dist/style.css +1 -1
  14. package/dist/{web-IFGkBi0t.js → web-UrTMimK1.js} +2 -2
  15. package/package.json +65 -55
  16. package/src/.prettierrc.json +16 -0
  17. package/src/App.vue +326 -269
  18. package/src/eslint.config.js +15 -0
  19. package/src/index.js +4 -0
  20. package/src/install.js +9 -10
  21. package/src/main.js +54 -57
  22. package/src/mixins/apple.mixin.js +56 -54
  23. package/src/mixins/auth.mixin.js +3 -2
  24. package/src/mixins/global.mixin.js +3 -3
  25. package/src/mixins/google.mixin.js +53 -54
  26. package/src/mixins/microsoft.mixin.js +2 -5
  27. package/src/mixins/okta.mixin.js +1 -1
  28. package/src/mixins/qr-auth.mixin.js +111 -107
  29. package/src/mixins/saml.mixin.js +82 -45
  30. package/src/router/index.js +6 -6
  31. package/src/routes.js +1 -1
  32. package/src/services/Api.js +56 -58
  33. package/src/services/AuthService.js +7 -9
  34. package/src/services/CompanyService.js +10 -10
  35. package/src/services/DeviceService.js +3 -3
  36. package/src/services/UserService.js +48 -45
  37. package/src/services/UtilService.js +317 -225
  38. package/src/store/auth.js +485 -549
  39. package/src/store/constants.js +2 -2
  40. package/src/store/event-bus.js +22 -22
  41. package/src/store/locales/cn.js +476 -458
  42. package/src/store/locales/de.js +478 -517
  43. package/src/store/locales/en.js +454 -513
  44. package/src/store/locales/es.js +477 -524
  45. package/src/store/locales/fr.js +477 -516
  46. package/src/store/locales/it.js +477 -514
  47. package/src/store/locales/ja.js +488 -0
  48. package/src/store/locales/kr.js +477 -491
  49. package/src/store/locales/lang.js +51 -43
  50. package/src/store/locales/pt.js +488 -0
  51. package/src/store/locales/sr.js +477 -492
  52. package/src/store/locales/tr.js +477 -487
  53. package/src/store/store.js +6 -6
  54. package/src/views/Account.vue +36 -8
  55. package/src/views/Billing.vue +464 -34
  56. package/src/views/Callback.vue +36 -33
  57. package/src/views/General.vue +151 -185
  58. package/src/views/Login.vue +2 -25
  59. package/src/views/Register.vue +2 -12
  60. package/src/views/Reset.vue +132 -135
  61. package/src/views/Security.vue +13 -7
  62. package/src/views/Verify.vue +153 -151
  63. package/src/views/Welcome.vue +85 -71
  64. package/dist/Account-Cuz87g_8.js +0 -153
  65. package/dist/Billing-BXlQEuNy.js +0 -113
  66. package/dist/CustomApp-CLCMXmMO.js +0 -83
  67. package/dist/General-dW73bMoR.js +0 -479
  68. package/dist/QR-D6ZGcPM0.js +0 -41
  69. package/dist/index.css +0 -193
  70. package/dist/web-AXRKjAOB.js +0 -92
  71. package/src/components/DELETE_Language.vue +0 -168
  72. package/src/components/DELETE_LinkIcon.vue +0 -288
  73. package/src/components/DELETE_ModalOverlay.vue +0 -68
  74. package/src/components/DELETE_OTP.vue +0 -105
  75. package/src/components/DELETE_SSO.vue +0 -120
  76. package/src/components/DELETE_SSOPick.vue +0 -166
  77. package/src/mixins/DELETE_mfa-auth.mixin.js +0 -53
  78. package/src/mixins/facebook.mixin.js +0 -78
@@ -0,0 +1,15 @@
1
+ import pluginVue from 'eslint-plugin-vue';
2
+ export default [
3
+ ...pluginVue.configs['flat/recommended'],
4
+ {
5
+ rules: {
6
+ 'vue/require-valid-default-prop': 'off',
7
+ 'vue/max-attributes-per-line': 'off',
8
+ 'vue/html-indent': 'off',
9
+ 'vue/html-self-closing': 'off',
10
+ 'vue/singleline-html-element-content-newline': 'off'
11
+ // override/add rules settings here, such as:
12
+ // 'vue/no-unused-vars': 'error'
13
+ }
14
+ }
15
+ ];
package/src/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import TapniAuth from './components/TapniAuth.vue';
2
+
3
+ export { TapniAuth };
4
+ export default TapniAuth;
package/src/install.js CHANGED
@@ -1,17 +1,16 @@
1
- import App from "./App.vue";
1
+ import App from './App.vue';
2
2
  import auth from './store/auth.js';
3
3
 
4
4
  // Export the component by default
5
5
  export default {
6
- install: (app, {store, apiRoot}) => {
7
- // Register the component
8
- app.component('TapniAuth', App);
6
+ install: (app, { store, apiRoot }) => {
7
+ // Register the component
8
+ app.component('TapniAuth', App);
9
9
 
10
- if(!store.hasModule('auth')) {
11
- store.registerModule('auth', auth);
12
- }
10
+ if (!store.hasModule('auth')) {
11
+ store.registerModule('auth', auth);
12
+ }
13
13
 
14
- app.config.globalProperties.$apiRoot = apiRoot;
15
-
16
- }
14
+ app.config.globalProperties.$apiRoot = apiRoot;
15
+ }
17
16
  };
package/src/main.js CHANGED
@@ -1,76 +1,75 @@
1
- import "@tapni/styles/dist/index.css";
2
- import { createApp } from 'vue'
3
- import RootApp from './App.vue'
4
- import router from './router'
5
- import VueCookies from 'vue-cookies'
1
+ import '@tapni/styles/dist/index.css';
2
+ import { createApp } from 'vue';
3
+ import RootApp from './App.vue';
4
+ import router from './router';
5
+ import VueCookies from 'vue-cookies';
6
6
  import { App } from '@capacitor/app';
7
7
  import { Browser } from '@capacitor/browser';
8
8
  import store from './store/store.js';
9
9
  import { sync } from 'vuex-router-sync';
10
10
 
11
- const app = createApp(RootApp)
11
+ const app = createApp(RootApp);
12
12
 
13
- app.config.productionTip = false
13
+ app.config.productionTip = false;
14
14
 
15
15
  // Vuex Router Sync
16
16
  sync(store, router);
17
17
 
18
18
  // Cookies
19
- app.use(VueCookies)
19
+ app.use(VueCookies);
20
20
 
21
- app.use(router)
21
+ app.use(router);
22
22
 
23
- app.use(store)
24
-
25
- app.mount('#app')
23
+ app.use(store);
26
24
 
25
+ app.mount('#app');
27
26
 
28
27
  function hasQueryParams(route) {
29
- return !!Object.keys(route.query).length
28
+ return !!Object.keys(route.query).length;
30
29
  }
31
30
 
32
31
  router.beforeEach((to, from, next) => {
33
- setTimeout(() => {
34
- window.scrollTo(0, 0)
35
- }, 100)
36
-
37
- if(!hasQueryParams(to) && hasQueryParams(from)){
38
- next({name: to.name, query: from.query});
39
- } else {
40
- next()
41
- }
42
- })
32
+ setTimeout(() => {
33
+ window.scrollTo(0, 0);
34
+ }, 100);
35
+
36
+ if (!hasQueryParams(to) && hasQueryParams(from)) {
37
+ next({ name: to.name, query: from.query });
38
+ } else {
39
+ next();
40
+ }
41
+ });
43
42
 
44
43
  /**
45
44
  * Redirect users to desired profile - DEEP LINKING
46
45
  * @param data
47
46
  */
48
47
  function redirectToProfile(data) {
49
- if (data && data.url) {
50
- let url = new URL(data.url)
51
- let pathname = url.pathname || '';
52
- let queryParams = url.search || ''
53
- if(queryParams) queryParams = Object.fromEntries(new URLSearchParams(queryParams));
54
- else queryParams = {};
55
- let subdomain = '';
56
- //['my', 'tapni', 'co']
57
- let tempArr = url.hostname.split('.');
58
- if(tempArr.length === 3) subdomain = tempArr[0];
59
- if(subdomain) queryParams.s = subdomain;
60
-
61
- // open t.link shorter links in browser
62
- if(pathname && /[A-Z]/.test(pathname) && !pathname.startsWith('/t/')) {
63
- Browser.open({url: url.toString()});
64
- return router.push('/');
65
- }
66
-
67
- if (pathname) {
68
- router.push({
69
- path: pathname,
70
- query: queryParams
71
- })
72
- }
73
- }
48
+ if (data && data.url && data.url !== '/undefined') {
49
+ let url = new URL(data.url);
50
+ let pathname = url.pathname || '';
51
+ let queryParams = url.search || '';
52
+ if (queryParams) queryParams = Object.fromEntries(new URLSearchParams(queryParams));
53
+ else queryParams = {};
54
+ let subdomain = '';
55
+ //['my', 'tapni', 'co']
56
+ let tempArr = url.hostname.split('.');
57
+ if (tempArr.length === 3) subdomain = tempArr[0];
58
+ if (subdomain) queryParams.s = subdomain;
59
+
60
+ // open t.link shorter links in browser
61
+ if (pathname && /[A-Z]/.test(pathname) && !pathname.startsWith('/t/')) {
62
+ Browser.open({ url: url.toString() });
63
+ return router.push('/');
64
+ }
65
+
66
+ if (pathname) {
67
+ router.push({
68
+ path: pathname,
69
+ query: queryParams
70
+ });
71
+ }
72
+ }
74
73
  }
75
74
  /**
76
75
  * CAPACITOR_CONFIG
@@ -78,13 +77,12 @@ function redirectToProfile(data) {
78
77
  * Users who have an app should get the profiles opened in the app ie: tapni.co/tapni
79
78
  */
80
79
  App.addListener('appUrlOpen', async function (data) {
81
- if(data.url && data.url.startsWith('tapni://')) data.url = data.url.replace('tapni://', 'https://')
82
- let url = new URL(data.url);
83
- if(url.pathname.includes('/callback/')) {
84
- await router.push({path: url.pathname, query: Object.fromEntries(new URLSearchParams(url.search))});
85
- }
86
- else redirectToProfile(data);
87
- })
80
+ if (data.url && data.url.startsWith('tapni://')) data.url = data.url.replace('tapni://', 'https://');
81
+ let url = new URL(data.url);
82
+ if (url.pathname.includes('/callback/')) {
83
+ await router.push({ path: url.pathname, query: Object.fromEntries(new URLSearchParams(url.search)) });
84
+ } else redirectToProfile(data);
85
+ });
88
86
 
89
87
  // When the app is open and you trigger NFC event to open the app
90
88
  // App.addListener('appStateChange', async function (l) {
@@ -93,8 +91,7 @@ App.addListener('appUrlOpen', async function (data) {
93
91
 
94
92
  // When the app is closed and NFC event opens the app
95
93
  App.getLaunchUrl().then((data) => {
96
- redirectToProfile(data)
94
+ redirectToProfile(data);
97
95
  });
98
96
 
99
-
100
97
  export { app };
@@ -1,59 +1,61 @@
1
- import to from 'await-to-js'
2
- import AuthService from '../services/AuthService'
3
- import {SignInWithApple} from '@capacitor-community/apple-sign-in';
1
+ import to from 'await-to-js';
2
+ import AuthService from '../services/AuthService';
3
+ import { SignInWithApple } from '@capacitor-community/apple-sign-in';
4
4
 
5
- import { jwtDecode } from "jwt-decode";
6
- import {EventBus} from '../store/event-bus';
5
+ import { jwtDecode } from 'jwt-decode';
6
+ import { EventBus } from '../store/event-bus';
7
7
  export default {
8
- data () {
9
- return {
10
- appleLoad: false
11
- }
12
- },
13
- computed: {
14
- displayAppleLogin () {
15
- return ((Capacitor.isNativePlatform() && Capacitor.getPlatform() === 'ios') || (!Capacitor.isNativePlatform() && this.isiOS));
16
- }
17
- },
18
- methods: {
19
- async appleLogin () {
20
- this.appleLoad = true
21
- const [errAuth, user] = await to(SignInWithApple.authorize({
22
- clientId: 'co.tapni.applelogin',
23
- redirectURI: 'https://' + window.location.host + '/login',
24
- scopes: 'email name'
25
- }))
26
- if (errAuth) return this.appleLoad = false
27
- user.response.tokenData = jwtDecode(user.response.identityToken);
8
+ data() {
9
+ return {
10
+ appleLoad: false
11
+ };
12
+ },
13
+ computed: {
14
+ displayAppleLogin() {
15
+ return (Capacitor.isNativePlatform() && Capacitor.getPlatform() === 'ios') || (!Capacitor.isNativePlatform() && this.isiOS);
16
+ }
17
+ },
18
+ methods: {
19
+ async appleLogin() {
20
+ this.appleLoad = true;
21
+ const [errAuth, user] = await to(
22
+ SignInWithApple.authorize({
23
+ clientId: 'co.tapni.applelogin',
24
+ redirectURI: 'https://' + window.location.host + '/login',
25
+ scopes: 'email name'
26
+ })
27
+ );
28
+ if (errAuth) return (this.appleLoad = false);
29
+ user.response.tokenData = jwtDecode(user.response.identityToken);
28
30
 
29
- if (user && user.response && user.response.identityToken) {
30
- // Track Referrals
31
- if (this.referral) user.response.ref = this.referral;
31
+ if (user && user.response && user.response.identityToken) {
32
+ // Track Referrals
33
+ if (this.referral) user.response.ref = this.referral;
32
34
 
33
- // Code Login
34
- if (this.display === 'popup') user.response_type = 'code';
35
+ // Code Login
36
+ if (this.display === 'popup') user.response_type = 'code';
35
37
 
36
- const [err, response] = await to(AuthService.appleSDK(user.response, this.$storex))
37
- if (err) {
38
- this.appleLoad = false
39
- EventBus.$emit('ssoEvent', {name: 'setLoading', data: false})
40
- return this.errorHandler(err)
41
- }
42
- if (response.data.success) {
43
- if (this.display === 'popup') {
44
- return window.parent?.postMessage({ code: response.data.auth_code, state: this.$route.query.state }, '*');
45
- }
46
- await this.loginSetup(response)
47
- await this.getLoggedInAccounts()
48
- this.loginSuccess({ ...response, isModal: this.isModal });
49
- setTimeout(() => {
50
- this.appleLoad = false
51
- }, 1000)
52
- } else this.errorSnack(this.ssoLang[this.appLanguage].unexpected_err)
53
- } else {
54
- this.appleLoad = false
55
- EventBus.$emit('ssoEvent', {name: 'setLoading', data: false})
56
- }
57
- }
58
- }
59
- }
38
+ const [err, response] = await to(AuthService.appleSDK(user.response, this.$storex));
39
+ if (err) {
40
+ this.appleLoad = false;
41
+ EventBus.$emit('ssoEvent', { name: 'setLoading', data: false });
42
+ return this.errorHandler(err);
43
+ }
44
+ if (response.data.success) {
45
+ if (this.display === 'popup') {
46
+ return window.parent?.postMessage({ code: response.data.auth_code, state: this.$route.query.state }, '*');
47
+ }
48
+ await this.loginSetup(response);
49
+ await this.getLoggedInAccounts();
50
+ this.loginSuccess({ ...response, isModal: this.isModal });
51
+ setTimeout(() => {
52
+ this.appleLoad = false;
53
+ }, 1000);
54
+ } else this.errorSnack(this.ssoLang[this.appLanguage].unexpected_err);
55
+ } else {
56
+ this.appleLoad = false;
57
+ EventBus.$emit('ssoEvent', { name: 'setLoading', data: false });
58
+ }
59
+ }
60
+ }
61
+ };
@@ -1,6 +1,6 @@
1
1
  import { createNamespacedHelpers } from 'vuex';
2
2
  const { mapState, mapActions, mapGetters } = createNamespacedHelpers('auth');
3
- import GlobalMixin from './global.mixin'
3
+ import GlobalMixin from './global.mixin';
4
4
 
5
5
  export default {
6
6
  mixins: [GlobalMixin],
@@ -64,6 +64,7 @@ export default {
64
64
  'setRedirectUri',
65
65
  'setDisplay',
66
66
  'setState',
67
+ 'setRealm',
67
68
  'setResponseType',
68
69
  'switchAccount',
69
70
  'loginSetup',
@@ -78,7 +79,7 @@ export default {
78
79
  if (this.$route.query.display) this.setDisplay(this.$route.query.display);
79
80
  if (this.$route.query.state) this.setState(this.$route.query.state)
80
81
  if (this.$route.query.response_type) this.setResponseType(this.$route.query.response_type);
81
- if (this.$route.query.realm && this.$storage) this.setRealm(this.$route.query.realm);
82
+ if (this.$route.query.realm) this.setRealm(this.$route.query.realm);
82
83
  },
83
84
  deep: true,
84
85
  },
@@ -30,10 +30,10 @@ export default {
30
30
  },
31
31
  methods: {
32
32
  getIcon(icon) {
33
- if (!this.isNative && false) {
33
+ if (!this.isNative) {
34
34
  return 'https://cdn.tapni.co/icons/' + icon;
35
35
  } else {
36
- return `http://localhost:7777/icons/${icon}`;
36
+ return `/icons/${icon}`;
37
37
  }
38
38
  },
39
39
  errorHandler(error) {
@@ -110,7 +110,7 @@ export default {
110
110
  try {
111
111
  return await window.grecaptcha.execute(import.meta.env.VITE_APP_GOOGLE_RECAPTCHA_SITE_KEY, {action: action});
112
112
  } catch (err){
113
- console.log(err)
113
+ console.error('grecaptcha_error', err)
114
114
  return null
115
115
  }
116
116
  },
@@ -1,60 +1,59 @@
1
- import to from 'await-to-js'
2
- import AuthService from '../services/AuthService'
3
- import { GoogleAuth } from '@codetrix-studio/capacitor-google-auth'
4
- import {EventBus} from "../store/event-bus";
1
+ import to from 'await-to-js';
2
+ import AuthService from '../services/AuthService';
3
+ import { GoogleAuth } from '@codetrix-studio/capacitor-google-auth';
4
+ import { EventBus } from '../store/event-bus';
5
5
 
6
6
  export default {
7
- data () {
8
- return {
9
- googleLoad: false
10
- }
11
- },
12
- computed: {
13
- displayGoogleLogin () {
14
- return true;
15
- }
16
- },
17
- mounted () {
18
- GoogleAuth.initialize()
19
- },
20
- methods: {
21
- async googleLogin () {
7
+ data() {
8
+ return {
9
+ googleLoad: false
10
+ };
11
+ },
12
+ computed: {
13
+ displayGoogleLogin() {
14
+ return true;
15
+ }
16
+ },
17
+ mounted() {
18
+ GoogleAuth.initialize();
19
+ },
20
+ methods: {
21
+ async googleLogin() {
22
+ this.googleLoad = true;
23
+ let [errAuth, user] = await to(GoogleAuth.signIn());
24
+ if (errAuth) return (this.googleLoad = false);
22
25
 
23
- this.googleLoad = true
24
- let [errAuth, user] = await to(GoogleAuth.signIn())
25
- if (errAuth) return this.googleLoad = false
26
+ // Track Referrals
27
+ if (this.referral) user.ref = this.referral;
26
28
 
27
- // Track Referrals
28
- if (this.referral) user.ref = this.referral;
29
+ if (user.authentication && (user.authentication.accessToken || user.authentication.idToken)) {
30
+ // Track Referrals
31
+ if (this.referral) user.ref = this.referral;
29
32
 
30
- if (user.authentication && (user.authentication.accessToken || user.authentication.idToken)) {
31
- // Track Referrals
32
- if (this.referral) user.ref = this.referral;
33
+ // Code Login
34
+ if (this.display === 'popup') user.response_type = 'code';
33
35
 
34
- // Code Login
35
- if (this.display === 'popup') user.response_type = 'code';
36
-
37
- const [err, response] = await to(AuthService.googleSDK(user, this.$storex))
38
- if (err) {
39
- this.googleLoad = false
40
- EventBus.$emit('ssoEvent', {name: 'setLoading', data: false})
41
- return this.errorHandler(err)
42
- }
43
- if (response.data.success) {
44
- if (this.display === 'popup') {
45
- return window.parent?.postMessage({ code: response.data.auth_code, state: this.$route.query.state }, '*');
46
- }
47
- await this.loginSetup(response)
48
- await this.getLoggedInAccounts()
49
- this.loginSuccess({ ...response, isModal: this.isModal });
50
- setTimeout(() => {
51
- this.googleLoad = false
52
- }, 1000)
53
- } else this.errorSnack(this.ssoLang[this.appLanguage].unexpected_err)
54
- } else {
55
- this.googleLoad = false
56
- EventBus.$emit('ssoEvent', {name: 'setLoading', data: false})
57
- }
58
- }
59
- }
60
- }
36
+ const [err, response] = await to(AuthService.googleSDK(user, this.$storex));
37
+ if (err) {
38
+ this.googleLoad = false;
39
+ EventBus.$emit('ssoEvent', { name: 'setLoading', data: false });
40
+ return this.errorHandler(err);
41
+ }
42
+ if (response.data.success) {
43
+ if (this.display === 'popup') {
44
+ return window.parent?.postMessage({ code: response.data.auth_code, state: this.$route.query.state }, '*');
45
+ }
46
+ await this.loginSetup(response);
47
+ await this.getLoggedInAccounts();
48
+ this.loginSuccess({ ...response, isModal: this.isModal });
49
+ setTimeout(() => {
50
+ this.googleLoad = false;
51
+ }, 1000);
52
+ } else this.errorSnack(this.ssoLang[this.appLanguage].unexpected_err);
53
+ } else {
54
+ this.googleLoad = false;
55
+ EventBus.$emit('ssoEvent', { name: 'setLoading', data: false });
56
+ }
57
+ }
58
+ }
59
+ };
@@ -27,14 +27,11 @@ export default {
27
27
  scopes: ["User.Read"],
28
28
  knownAuthorities: [],
29
29
  keyHash: "4+5wCp8QcLptlO0aeP5RDTTOWyg=", // Android,
30
- redirectUri:
31
- import.meta.env.DEV
32
- ? `${window.location.origin}/login`
33
- : "https://" + window.location.host + "/login",
30
+ redirectUri: `${window.location.origin}/login`
34
31
  })
35
32
  );
36
33
  if (errAuth) {
37
- console.log("Error: " + JSON.stringify(errAuth));
34
+ console.error("MsAuthPlugin Error: " + JSON.stringify(errAuth));
38
35
  return (this.microsoftLoad = false);
39
36
  }
40
37
 
@@ -89,7 +89,7 @@ export default {
89
89
  //if (response && response.data && response.data.url) {
90
90
  let code;
91
91
  window.addEventListener("message", async (message)=> {
92
- if (!this.allowedOriginsAuth.includes(message.origin)) return console.log('Origin is not allowed!');
92
+ if (!this.allowedOriginsAuth.includes(message.origin)) return console.error('Origin is not allowed!');
93
93
  if(message.data.type === 'okta') {
94
94
  code = message.data.code;
95
95
  await self.exchangeCode({domain: data.domain, code, clientID: data.clientID});