@tapni/auth 0.0.170 → 0.0.172

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 (69) hide show
  1. package/README.md +2 -0
  2. package/dist/.vite/manifest.json +18 -10
  3. package/dist/.well-known/assetlinks.json +10 -12
  4. package/dist/.well-known/microsoft-identity-association.json +5 -5
  5. package/dist/{Account-6F9eRo1R.js → Account-BVGvxZ85.js} +31 -32
  6. package/dist/{QR-2Izy5Dj4.js → QR-DwjajyG2.js} +3 -3
  7. package/dist/TapniAuth.es.js +1 -1
  8. package/dist/TapniAuth.umd.js +9 -9
  9. package/dist/blank.html +31 -0
  10. package/dist/{install-co2F1hxN.js → install-B8fBS6C4.js} +752 -996
  11. package/dist/site.webmanifest +11 -1
  12. package/dist/style.css +1 -1
  13. package/dist/{web-NrPZl3qD.js → web-XbruGdlD.js} +2 -5
  14. package/package.json +64 -55
  15. package/src/.prettierrc.json +16 -0
  16. package/src/App.vue +249 -265
  17. package/src/components/Language.vue +66 -143
  18. package/src/components/LinkIcon.vue +174 -225
  19. package/src/components/ModalOverlay.vue +47 -50
  20. package/src/components/OTP.vue +64 -94
  21. package/src/components/SSO.vue +80 -111
  22. package/src/components/SSOPick.vue +93 -148
  23. package/src/eslint.config.js +15 -0
  24. package/src/install.js +9 -10
  25. package/src/main.js +54 -57
  26. package/src/mixins/apple.mixin.js +56 -54
  27. package/src/mixins/auth.mixin.js +21 -74
  28. package/src/mixins/facebook.mixin.js +67 -66
  29. package/src/mixins/global.mixin.js +107 -109
  30. package/src/mixins/google.mixin.js +53 -54
  31. package/src/mixins/mfa-auth.mixin.js +68 -68
  32. package/src/mixins/microsoft.mixin.js +67 -75
  33. package/src/mixins/okta.mixin.js +50 -57
  34. package/src/mixins/qr-auth.mixin.js +111 -107
  35. package/src/mixins/saml.mixin.js +97 -48
  36. package/src/router/index.js +6 -6
  37. package/src/routes.js +60 -66
  38. package/src/services/Api.js +55 -57
  39. package/src/services/AuthService.js +75 -75
  40. package/src/services/CompanyService.js +10 -10
  41. package/src/services/DeviceService.js +3 -3
  42. package/src/services/UserService.js +45 -45
  43. package/src/services/UtilService.js +256 -218
  44. package/src/store/auth.js +471 -543
  45. package/src/store/constants.js +1 -1
  46. package/src/store/event-bus.js +22 -22
  47. package/src/store/locales/cn.js +442 -458
  48. package/src/store/locales/de.js +438 -517
  49. package/src/store/locales/en.js +449 -510
  50. package/src/store/locales/es.js +442 -524
  51. package/src/store/locales/fr.js +442 -516
  52. package/src/store/locales/it.js +442 -514
  53. package/src/store/locales/kr.js +442 -491
  54. package/src/store/locales/lang.js +43 -43
  55. package/src/store/locales/sr.js +439 -492
  56. package/src/store/locales/tr.js +436 -487
  57. package/src/store/store.js +6 -6
  58. package/src/views/Account.vue +169 -207
  59. package/src/views/Callback.vue +36 -33
  60. package/src/views/Login.vue +220 -392
  61. package/src/views/MFA.vue +89 -103
  62. package/src/views/QR.vue +25 -28
  63. package/src/views/Register.vue +201 -205
  64. package/src/views/Reset.vue +132 -135
  65. package/src/views/Verify.vue +153 -151
  66. package/src/views/Welcome.vue +61 -60
  67. /package/dist/{web-L3jORB19.js → web-AXRKjAOB.js} +0 -0
  68. /package/dist/{web-5VtGcKeU.js → web-IFGkBi0t.js} +0 -0
  69. /package/dist/{web-AImUTDQQ.js → web-LIfHmYL2.js} +0 -0
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) {
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,79 +1,26 @@
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
- mixins: [GlobalMixin],
7
- computed: {
8
- ...mapState([
9
- '$storex',
10
- 'refreshing',
11
- 'loggedInUserId',
12
- 'account',
13
- 'device',
14
- 'loggedInAccounts',
15
- 'ssoLang',
16
- 'display',
17
- 'redirect_uri',
18
- 'response_type',
19
- 'state',
20
- 'allowedOriginsAuth'
21
- ]),
22
- ...mapGetters([
23
- 'accessToken',
24
- 'refreshTokens',
25
- 'isLoggedIn',
26
- 'renderView',
27
- 'appLanguage'
28
- ])
29
- },
30
- methods: {
31
- ...mapActions([
32
- 'setLoggedInAccounts',
33
- 'setLoggedInUserId',
34
- 'getRefreshTokens',
35
- 'setRefreshToken',
36
- 'unsetRefreshToken',
37
- 'setToken',
38
- 'setView',
39
- 'setStorage',
40
- 'updateLang',
41
- 'login',
42
- 'register',
43
- 'verify',
44
- 'reset',
45
- 'exchangeAuthCode',
46
- 'changePassword',
47
- 'newPassword',
48
- 'deleteAccount',
49
- 'registerDevice',
50
- 'addFcmToken',
51
- 'acceptCompanyInvitation',
52
- 'logout',
53
- 'getCompanyBySSOEmail',
54
- 'getLoggedInAccounts',
55
- 'loginUsingQR',
56
- 'getAccountSettings',
57
- 'setRedirectUri',
58
- 'setDisplay',
59
- 'setState',
60
- 'setResponseType',
61
- 'switchAccount',
62
- 'loginSetup',
63
- 'loginSuccess',
64
- 'refreshTokenAction'
65
- ])
66
- },
67
- watch: {
68
- "$route.query": {
69
- handler: function handler() {
70
- if (this.$route.query.redirect_uri) this.setRedirectUri(this.$route.query.redirect_uri);
71
- if (this.$route.query.display) this.setDisplay(this.$route.query.display);
72
- if (this.$route.query.state) this.setState(this.$route.query.state)
73
- if (this.$route.query.response_type) this.setResponseType(this.$route.query.response_type);
74
- if (this.$route.query.realm && this.$storage) this.setRealm(this.$route.query.realm);
75
- },
76
- deep: true,
77
- },
78
- },
6
+ mixins: [GlobalMixin],
7
+ computed: {
8
+ ...mapState(['$storex', 'refreshing', 'loggedInUserId', 'account', 'device', 'loggedInAccounts', 'ssoLang', 'display', 'redirect_uri', 'response_type', 'state', 'allowedOriginsAuth']),
9
+ ...mapGetters(['accessToken', 'refreshTokens', 'isLoggedIn', 'renderView', 'appLanguage'])
10
+ },
11
+ methods: {
12
+ ...mapActions(['setLoggedInAccounts', 'setLoggedInUserId', 'getRefreshTokens', 'setRefreshToken', 'unsetRefreshToken', 'setToken', 'setView', 'setStorage', 'updateLang', 'login', 'register', 'verify', 'reset', 'exchangeAuthCode', 'changePassword', 'newPassword', 'deleteAccount', 'registerDevice', 'addFcmToken', 'acceptCompanyInvitation', 'logout', 'getCompanyBySSOEmail', 'getLoggedInAccounts', 'loginUsingQR', 'getAccountSettings', 'setRedirectUri', 'setDisplay', 'setState', 'setRealm', 'setResponseType', 'switchAccount', 'loginSetup', 'loginSuccess', 'refreshTokenAction'])
13
+ },
14
+ watch: {
15
+ '$route.query': {
16
+ handler: function handler() {
17
+ if (this.$route.query.redirect_uri) this.setRedirectUri(this.$route.query.redirect_uri);
18
+ if (this.$route.query.display) this.setDisplay(this.$route.query.display);
19
+ if (this.$route.query.state) this.setState(this.$route.query.state);
20
+ if (this.$route.query.response_type) this.setResponseType(this.$route.query.response_type);
21
+ if (this.$route.query.realm) this.setRealm(this.$route.query.realm);
22
+ },
23
+ deep: true
24
+ }
25
+ }
79
26
  };
@@ -1,78 +1,79 @@
1
- import to from 'await-to-js'
2
- import AuthService from '../services/AuthService'
1
+ import to from 'await-to-js';
2
+ import AuthService from '../services/AuthService';
3
3
  import { FacebookLogin } from '@capacitor-community/facebook-login';
4
- import {EventBus} from "../store/event-bus";
4
+ import { EventBus } from '../store/event-bus';
5
5
 
6
6
  window.fbAsyncInit = function () {
7
- // eslint-disable-next-line no-undef
8
- FB.init({
9
- appId: '202577611527680',
10
- cookie: true, // enable cookies to allow the server to access the session
11
- xfbml: true, // parse social plugins on this page
12
- version: 'v16.0' // use graph api current version
13
- })
7
+ // eslint-disable-next-line no-undef
8
+ FB.init({
9
+ appId: '202577611527680',
10
+ cookie: true, // enable cookies to allow the server to access the session
11
+ xfbml: true, // parse social plugins on this page
12
+ version: 'v16.0' // use graph api current version
13
+ });
14
14
  };
15
15
 
16
16
  // Load the SDK asynchronously
17
17
  (function (d, s, id) {
18
- // eslint-disable-next-line one-var
19
- var js, fjs = d.getElementsByTagName(s)[0]
20
- if (d.getElementById(id)) return
21
- js = d.createElement(s); js.id = id
22
- js.src = 'https://connect.facebook.net/en_US/sdk.js'
23
- fjs.parentNode.insertBefore(js, fjs)
24
- }(document, 'script', 'facebook-jssdk'))
18
+ // eslint-disable-next-line one-var
19
+ var js,
20
+ fjs = d.getElementsByTagName(s)[0];
21
+ if (d.getElementById(id)) return;
22
+ js = d.createElement(s);
23
+ js.id = id;
24
+ js.src = 'https://connect.facebook.net/en_US/sdk.js';
25
+ fjs.parentNode.insertBefore(js, fjs);
26
+ })(document, 'script', 'facebook-jssdk');
25
27
 
26
28
  export default {
27
- data () {
28
- return {
29
- facebookLoad: false
30
- }
31
- },
32
- computed: {
33
- fbLoginUrl () {
34
- return 'https://www.facebook.com/v16.0/dialog/oauth?client_id=202577611527680&state={"oauth":"facebook"}&response_type=code%20granted_scopes&scope=email&redirect_uri=https://' + window.location.host + '/login'
35
- },
36
- displayFacebookLogin () {
37
- return false;
38
- }
39
- },
40
- methods: {
41
- async facebookLogin () {
42
- this.facebookLoad = true
43
- const FACEBOOK_PERMISSIONS = ['email']
44
- const [errAuth, user] = await to(FacebookLogin.login({permissions: FACEBOOK_PERMISSIONS}))
45
- if (errAuth) return this.facebookLoad = false
29
+ data() {
30
+ return {
31
+ facebookLoad: false
32
+ };
33
+ },
34
+ computed: {
35
+ fbLoginUrl() {
36
+ return 'https://www.facebook.com/v16.0/dialog/oauth?client_id=202577611527680&state={"oauth":"facebook"}&response_type=code%20granted_scopes&scope=email&redirect_uri=https://' + window.location.host + '/login';
37
+ },
38
+ displayFacebookLogin() {
39
+ return false;
40
+ }
41
+ },
42
+ methods: {
43
+ async facebookLogin() {
44
+ this.facebookLoad = true;
45
+ const FACEBOOK_PERMISSIONS = ['email'];
46
+ const [errAuth, user] = await to(FacebookLogin.login({ permissions: FACEBOOK_PERMISSIONS }));
47
+ if (errAuth) return (this.facebookLoad = false);
46
48
 
47
- // Track Referrals
48
- if (this.referral) user.ref = this.referral;
49
+ // Track Referrals
50
+ if (this.referral) user.ref = this.referral;
49
51
 
50
- if (this.display === 'popup') user.response_type = 'code';
52
+ if (this.display === 'popup') user.response_type = 'code';
51
53
 
52
- if (user && user.accessToken) {
53
-
54
- const [err, response] = await to(AuthService.facebookSDK(user, this.$storex))
55
- if (err) {
56
- this.facebookLoad = false
57
- EventBus.$emit('ssoEvent', {name: 'setLoading', data: false})
58
- return this.errorHandler(err)
59
- }
60
- if (response.data.success) {
61
- if (this.display === 'popup') {
62
- return window.parent?.postMessage({ code: response.data.auth_code, state: this.$route.query.state }, '*');
63
- }
64
- await this.loginSetup(response)
65
- await this.getLoggedInAccounts()
66
- this.$router.push('/' + response.data.data.username + '#edit')
67
- setTimeout(() => {
68
- this.facebookLoad = false
69
- EventBus.$emit('ssoEvent', {name: 'setLoading', data: false})
70
- }, 1000)
71
- } else this.errorSnack(this.ssoLang[this.appLanguage].unexpected_err)
72
- } else {
73
- this.facebookLoad = false
74
- EventBus.$emit('ssoEvent', {name: 'setLoading', data: false})
75
- }
76
- }
77
- }
78
- }
54
+ if (user && user.accessToken) {
55
+ const [err, response] = await to(AuthService.facebookSDK(user, this.$storex));
56
+ if (err) {
57
+ this.facebookLoad = false;
58
+ EventBus.$emit('ssoEvent', { name: 'setLoading', data: false });
59
+ return this.errorHandler(err);
60
+ }
61
+ if (response.data.success) {
62
+ if (this.display === 'popup') {
63
+ return window.parent?.postMessage({ code: response.data.auth_code, state: this.$route.query.state }, '*');
64
+ }
65
+ await this.loginSetup(response);
66
+ await this.getLoggedInAccounts();
67
+ this.$router.push('/' + response.data.data.username + '#edit');
68
+ setTimeout(() => {
69
+ this.facebookLoad = false;
70
+ EventBus.$emit('ssoEvent', { name: 'setLoading', data: false });
71
+ }, 1000);
72
+ } else this.errorSnack(this.ssoLang[this.appLanguage].unexpected_err);
73
+ } else {
74
+ this.facebookLoad = false;
75
+ EventBus.$emit('ssoEvent', { name: 'setLoading', data: false });
76
+ }
77
+ }
78
+ }
79
+ };