@tapni/auth 0.0.170 → 0.0.171

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-BB71UmF3.js} +31 -32
  6. package/dist/{QR-2Izy5Dj4.js → QR-BJnR_0ci.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-Cx9Gi17U.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/routes.js CHANGED
@@ -1,69 +1,63 @@
1
- const Welcome = () =>
2
- import("./views/Welcome.vue");
3
- const Login = () => import("./views/Login.vue");
4
- const Register = () =>
5
- import("./views/Register.vue");
6
- const Reset = () => import("./views/Reset.vue");
7
- const Account = () => import("./views/Account.vue");
8
- const Verify = () =>
9
- import("./views/Verify.vue");
10
- const Callback = () =>
11
- import("./views/Callback.vue");
12
- const QR = () =>
13
- import("./views/QR.vue");
14
- const MFA = () =>
15
- import("./views/MFA.vue");
1
+ const Welcome = () => import('./views/Welcome.vue');
2
+ const Login = () => import('./views/Login.vue');
3
+ const Register = () => import('./views/Register.vue');
4
+ const Reset = () => import('./views/Reset.vue');
5
+ const Account = () => import('./views/Account.vue');
6
+ const Verify = () => import('./views/Verify.vue');
7
+ const Callback = () => import('./views/Callback.vue');
8
+ const QR = () => import('./views/QR.vue');
9
+ const MFA = () => import('./views/MFA.vue');
16
10
 
17
11
  export default [
18
- {
19
- path: "/welcome",
20
- name: "AuthWelcome",
21
- component: Welcome,
22
- },
23
- {
24
- path: "/login",
25
- name: "AuthLogin",
26
- component: Login,
27
- },
28
- {
29
- path: "/callback/saml",
30
- name: "Callback",
31
- alias: ['/callback/okta', '/callback/auth'],
32
- component: Callback,
33
- },
34
- {
35
- path: "/qr",
36
- name: "AuthQR",
37
- component: QR,
38
- },
39
- {
40
- path: "/mfa",
41
- name: "AuthMFA",
42
- component: MFA,
43
- },
44
- {
45
- path: "/account",
46
- name: "AuthAccount",
47
- component: Account,
48
- },
49
- {
50
- path: "/reset",
51
- name: "AuthReset",
52
- component: Reset,
53
- },
54
- {
55
- path: "/register",
56
- name: "AuthRegister",
57
- component: Register,
58
- },
59
- {
60
- path: "/verify",
61
- name: "AuthVerify",
62
- component: Verify,
63
- },
64
- {
65
- path: "/",
66
- name: "404",
67
- component: Welcome
68
- },
12
+ {
13
+ path: '/welcome',
14
+ name: 'AuthWelcome',
15
+ component: Welcome
16
+ },
17
+ {
18
+ path: '/login',
19
+ name: 'AuthLogin',
20
+ component: Login
21
+ },
22
+ {
23
+ path: '/callback/saml',
24
+ name: 'Callback',
25
+ alias: ['/callback/okta', '/callback/auth', '/callback/redirect'],
26
+ component: Callback
27
+ },
28
+ {
29
+ path: '/qr',
30
+ name: 'AuthQR',
31
+ component: QR
32
+ },
33
+ {
34
+ path: '/mfa',
35
+ name: 'AuthMFA',
36
+ component: MFA
37
+ },
38
+ {
39
+ path: '/account',
40
+ name: 'AuthAccount',
41
+ component: Account
42
+ },
43
+ {
44
+ path: '/reset',
45
+ name: 'AuthReset',
46
+ component: Reset
47
+ },
48
+ {
49
+ path: '/register',
50
+ name: 'AuthRegister',
51
+ component: Register
52
+ },
53
+ {
54
+ path: '/verify',
55
+ name: 'AuthVerify',
56
+ component: Verify
57
+ },
58
+ {
59
+ path: '/',
60
+ name: '404',
61
+ component: Welcome
62
+ }
69
63
  ];
@@ -1,60 +1,58 @@
1
- import axios from 'axios'
2
- import { jwtDecode } from "jwt-decode";
3
- import { version } from "../../package.json"
1
+ import axios from 'axios';
2
+ import { jwtDecode } from 'jwt-decode';
3
+ import { version } from '../../package.json';
4
4
  import store from '../store/store.js';
5
5
 
6
6
  export default (refreshTokenAction = null) => {
7
- const appInfo = version;
8
- let baseURL = import.meta.env.VITE_APP_API_ROOT + '/v1/';
9
-
10
- if (store.getters['auth/apiRoot']) {
11
- baseURL = store.getters['auth/apiRoot'] + '/v1/';
12
- }
13
-
14
- let apiInstance = axios.create({
15
- baseURL,
16
- headers: {
17
- Authorization: `Bearer ${store.getters['auth/accessToken']}`,
18
- "X-Client-Name": "sso-" + appInfo.platform,
19
- "X-Client-Version": appInfo.version
20
- }
21
- })
22
-
23
- // Add a request interceptor
24
- apiInstance.interceptors.request.use(async function (config) {
25
-
26
- if (['post', 'put', 'delete'].includes(config.method.toLowerCase())) {
27
- config.data = {
28
- ...config.data,
29
- lang: store.getters['auth/appLanguage'],
30
- realm: store.getters['auth/appRealm'] || 'app'
31
- }
32
- } else if (config.method.toLowerCase() === 'get') {
33
- config.params = {
34
- ...config.params,
35
- lang: store.getters['auth/appLanguage'],
36
- realm: store.getters['auth/appRealm'] || 'app'
37
- }
38
- }
39
-
40
- // Check refresh token expiration before request is sent
41
- if (store.getters['auth/accessToken'] && !refreshTokenAction) {
42
- const decoded = jwtDecode(store.getters['auth/accessToken'])
43
-
44
- // Check if access token expired
45
- if (decoded.exp - 30 < Math.floor(Date.now() / 1000)) {
46
- return store.dispatch('auth/refreshTokenAction', decoded)
47
- .then(() => {
48
- config.headers = {
49
- ...config.headers,
50
- Authorization: `Bearer ${store.getters['auth/accessToken']}`
51
- }
52
- return config;
53
- })
54
- }
55
- }
56
- return config;
57
- });
58
-
59
- return apiInstance;
60
- }
7
+ const appInfo = version;
8
+ let baseURL = import.meta.env.VITE_APP_API_ROOT + '/v1/';
9
+
10
+ if (store.getters['auth/apiRoot']) {
11
+ baseURL = store.getters['auth/apiRoot'] + '/v1/';
12
+ }
13
+
14
+ let apiInstance = axios.create({
15
+ baseURL,
16
+ headers: {
17
+ Authorization: `Bearer ${store.getters['auth/accessToken']}`,
18
+ 'X-Client-Name': 'sso-' + appInfo.platform,
19
+ 'X-Client-Version': appInfo.version
20
+ }
21
+ });
22
+
23
+ // Add a request interceptor
24
+ apiInstance.interceptors.request.use(async function (config) {
25
+ if (['post', 'put', 'delete'].includes(config.method.toLowerCase())) {
26
+ config.data = {
27
+ ...config.data,
28
+ lang: store.getters['auth/appLanguage'],
29
+ realm: store.getters['auth/appRealm'] || 'app'
30
+ };
31
+ } else if (config.method.toLowerCase() === 'get') {
32
+ config.params = {
33
+ ...config.params,
34
+ lang: store.getters['auth/appLanguage'],
35
+ realm: store.getters['auth/appRealm'] || 'app'
36
+ };
37
+ }
38
+
39
+ // Check refresh token expiration before request is sent
40
+ if (store.getters['auth/accessToken'] && !refreshTokenAction) {
41
+ const decoded = jwtDecode(store.getters['auth/accessToken']);
42
+
43
+ // Check if access token expired
44
+ if (decoded.exp - 30 < Math.floor(Date.now() / 1000)) {
45
+ return store.dispatch('auth/refreshTokenAction', decoded).then(() => {
46
+ config.headers = {
47
+ ...config.headers,
48
+ Authorization: `Bearer ${store.getters['auth/accessToken']}`
49
+ };
50
+ return config;
51
+ });
52
+ }
53
+ }
54
+ return config;
55
+ });
56
+
57
+ return apiInstance;
58
+ };
@@ -2,80 +2,80 @@ import api from './Api';
2
2
  import { Device } from '@capacitor/device';
3
3
 
4
4
  let deviceID;
5
- Device.getId().then((DeviceId)=> deviceID = DeviceId.uuid)
5
+ Device.getId().then((DeviceId) => (deviceID = DeviceId.uuid));
6
6
 
7
7
  export default {
8
- register (data) {
9
- data.device_id = deviceID
10
- return api().post('/users/register', data)
11
- },
12
- login (data) {
13
- data.device_id = deviceID
14
- return api().post('/users/login', data)
15
- },
16
- logout (data) {
17
- data.device_id = deviceID
18
- return api().post('/users/logout', data)
19
- },
20
- refreshToken (data) {
21
- return api( true).get(`/users/refresh-token?UserId=${data.id}&token=${data.refreshToken}`)
22
- },
23
- getLoggedInAccounts(data) {
24
- return api().post(`/users/tokens`, data);
25
- },
26
- sendResetEmail (data) {
27
- data.device_id = deviceID
28
- return api().post('/users/reset', data)
29
- },
30
- changePassword (data) {
31
- return api().put('/users/password', data, {
32
- headers: { Authorization: 'Bearer ' + data.token }
33
- })
34
- },
35
- verify (data) {
36
- return api().get('/users/verify?c=' + data.code + '&e=' + data.email + '&captchatoken=' + data.captchaToken)
37
- },
38
- googleUrl (storage) {
39
- return api().get('/users/google/url')
40
- },
41
- google (data) {
42
- data.device_id = deviceID
43
- return api().post('/users/google', data)
44
- },
45
- facebook (data) {
46
- data.device_id = deviceID
47
- return api().post('/users/facebook', data)
48
- },
49
- googleSDK (data) {
50
- data.device_id = deviceID
51
- return api().post('/users/google/sdk', data)
52
- },
53
- facebookSDK (data) {
54
- data.device_id = deviceID
55
- return api().post('/users/facebook/sdk', data)
56
- },
57
- appleSDK (data) {
58
- data.device_id = deviceID
59
- return api().post('/users/apple/sdk', data)
60
- },
61
- microsoftSDK (data) {
62
- data.device_id = deviceID
63
- return api().post('/users/microsoft/sdk', data)
64
- },
65
- oktaSDK (data) {
66
- data.device_id = deviceID
67
- return api().post('/users/okta/sdk', data)
68
- },
69
- samlLoginUrl (data) {
70
- return api().post('/saml/url', data)
71
- },
72
- exchangeAuthCode (data) {
73
- return api().post('/users/auth-code', data)
74
- },
75
- setMfa(data) {
76
- return api().post("/users/set-mfa", data);
77
- },
78
- getAccountSettings() {
79
- return api().get("/users/settings");
80
- },
81
- }
8
+ register(data) {
9
+ data.device_id = deviceID;
10
+ return api().post('/users/register', data);
11
+ },
12
+ login(data) {
13
+ data.device_id = deviceID;
14
+ return api().post('/users/login', data);
15
+ },
16
+ logout(data) {
17
+ data.device_id = deviceID;
18
+ return api().post('/users/logout', data);
19
+ },
20
+ refreshToken(data) {
21
+ return api(true).get(`/users/refresh-token?UserId=${data.id}&token=${data.refreshToken}`);
22
+ },
23
+ getLoggedInAccounts(data) {
24
+ return api().post(`/users/tokens`, data);
25
+ },
26
+ sendResetEmail(data) {
27
+ data.device_id = deviceID;
28
+ return api().post('/users/reset', data);
29
+ },
30
+ changePassword(data) {
31
+ return api().put('/users/password', data, {
32
+ headers: { Authorization: 'Bearer ' + data.token }
33
+ });
34
+ },
35
+ verify(data) {
36
+ return api().get('/users/verify?c=' + data.code + '&e=' + data.email + '&captchatoken=' + data.captchaToken);
37
+ },
38
+ googleUrl(storage) {
39
+ return api().get('/users/google/url');
40
+ },
41
+ google(data) {
42
+ data.device_id = deviceID;
43
+ return api().post('/users/google', data);
44
+ },
45
+ facebook(data) {
46
+ data.device_id = deviceID;
47
+ return api().post('/users/facebook', data);
48
+ },
49
+ googleSDK(data) {
50
+ data.device_id = deviceID;
51
+ return api().post('/users/google/sdk', data);
52
+ },
53
+ facebookSDK(data) {
54
+ data.device_id = deviceID;
55
+ return api().post('/users/facebook/sdk', data);
56
+ },
57
+ appleSDK(data) {
58
+ data.device_id = deviceID;
59
+ return api().post('/users/apple/sdk', data);
60
+ },
61
+ microsoftSDK(data) {
62
+ data.device_id = deviceID;
63
+ return api().post('/users/microsoft/sdk', data);
64
+ },
65
+ oktaSDK(data) {
66
+ data.device_id = deviceID;
67
+ return api().post('/users/okta/sdk', data);
68
+ },
69
+ samlLoginUrl(data) {
70
+ return api().post('/saml/url', data);
71
+ },
72
+ exchangeAuthCode(data) {
73
+ return api().post('/users/auth-code', data);
74
+ },
75
+ setMfa(data) {
76
+ return api().post('/users/set-mfa', data);
77
+ },
78
+ getAccountSettings() {
79
+ return api().get('/users/settings');
80
+ }
81
+ };
@@ -1,13 +1,13 @@
1
1
  import api from './Api';
2
2
 
3
3
  export default {
4
- getBySSOEmail (email) {
5
- return api().get(`/company/sso/${email}`)
6
- },
7
- acceptCompanyInvitation (code) {
8
- return api().get(`/users/invitation?ic=${code}`)
9
- },
10
- qrCodePooling(payload) {
11
- return api().post("/company/login/qr", payload);
12
- },
13
- }
4
+ getBySSOEmail(email) {
5
+ return api().get(`/company/sso/${email}`);
6
+ },
7
+ acceptCompanyInvitation(code) {
8
+ return api().get(`/users/invitation?ic=${code}`);
9
+ },
10
+ qrCodePooling(payload) {
11
+ return api().post('/company/login/qr', payload);
12
+ }
13
+ };
@@ -2,9 +2,9 @@ import api from './Api';
2
2
 
3
3
  export default {
4
4
  registerDevice(data) {
5
- return api().post(`/devices/add`, data)
5
+ return api().post(`/devices/add`, data);
6
6
  },
7
7
  addFcmToken(data) {
8
- return api().post(`/devices/fcm/add`, data)
8
+ return api().post(`/devices/fcm/add`, data);
9
9
  }
10
- }
10
+ };
@@ -1,49 +1,49 @@
1
1
  import api from './Api.js';
2
2
 
3
3
  export default {
4
- getMe() {
5
- return api().get(`/users/me`);
6
- },
7
- getByUsername(data) {
8
- let referrer = document.referrer || "";
9
- let params = data.utmParams || {};
10
- if (data.dontTap) params.dontTap = true;
11
- return api().get(`/users/${data.username}`, {
12
- params,
13
- headers: { "X-Referer": referrer },
14
- });
15
- },
16
- getByNumber(data) {
17
- let referrer = document.referrer || "";
18
- let params = data.utmParams || {};
19
- if (data.dontTap) params.dontTap = true;
20
- return api().get(`/users/tag/${data.serial}`, {
21
- params,
22
- headers: { "X-Referer": referrer },
23
- });
24
- },
25
- save(data) {
26
- return api().put(`/users`, data);
27
- },
28
- newPassword(data) {
29
- return api().put(`/users/new-password`, data);
30
- },
31
- connect(data) {
32
- return api().post(`/users/connect`, data);
33
- },
34
- eventLog(data) {
35
- return api().post(`/users/log`, data);
36
- },
37
- deleteAccount(data) {
38
- return api().post(`/users/profile/delete`, data);
39
- },
40
- registerDevice(data) {
41
- return api().post(`/users/device/register`, data);
42
- },
43
- addFcmToken(data) {
44
- return api().post(`/users/device/fcm`, data);
45
- },
46
- loginUsingQR(data) {
47
- return api().post("/users/qr/login", data);
48
- }
4
+ getMe() {
5
+ return api().get(`/users/me`);
6
+ },
7
+ getByUsername(data) {
8
+ let referrer = document.referrer || '';
9
+ let params = data.utmParams || {};
10
+ if (data.dontTap) params.dontTap = true;
11
+ return api().get(`/users/${data.username}`, {
12
+ params,
13
+ headers: { 'X-Referer': referrer }
14
+ });
15
+ },
16
+ getByNumber(data) {
17
+ let referrer = document.referrer || '';
18
+ let params = data.utmParams || {};
19
+ if (data.dontTap) params.dontTap = true;
20
+ return api().get(`/users/tag/${data.serial}`, {
21
+ params,
22
+ headers: { 'X-Referer': referrer }
23
+ });
24
+ },
25
+ save(data) {
26
+ return api().put(`/users`, data);
27
+ },
28
+ newPassword(data) {
29
+ return api().put(`/users/new-password`, data);
30
+ },
31
+ connect(data) {
32
+ return api().post(`/users/connect`, data);
33
+ },
34
+ eventLog(data) {
35
+ return api().post(`/users/log`, data);
36
+ },
37
+ deleteAccount(data) {
38
+ return api().post(`/users/profile/delete`, data);
39
+ },
40
+ registerDevice(data) {
41
+ return api().post(`/users/device/register`, data);
42
+ },
43
+ addFcmToken(data) {
44
+ return api().post(`/users/device/fcm`, data);
45
+ },
46
+ loginUsingQR(data) {
47
+ return api().post('/users/qr/login', data);
48
+ }
49
49
  };