hl-core 0.0.10-beta.15 → 0.0.10-beta.17
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/composables/index.ts +6 -5
- package/package.json +12 -12
- package/plugins/head.ts +1 -1
- package/store/data.store.ts +22 -17
- package/types/index.ts +17 -0
package/composables/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useDisplay } from 'vuetify';
|
|
2
|
-
import jwt_decode from 'jwt-decode';
|
|
2
|
+
import { jwtDecode as jwt_decode } from 'jwt-decode';
|
|
3
3
|
import { XMLParser } from 'fast-xml-parser';
|
|
4
4
|
import { AxiosError } from 'axios';
|
|
5
5
|
import { DocumentReaderApi, Scenario, TextFieldType, LCID } from '@regulaforensics/document-reader-webclient';
|
|
6
6
|
import { PolicyholderClass } from '../composables/classes';
|
|
7
|
-
import type { EnvModes, NestedKeyOf, ResponseStructure } from '../types';
|
|
7
|
+
import type { EnvModes, NestedKeyOf, ResponseStructure, Utils } from '../types';
|
|
8
8
|
|
|
9
9
|
export const useEnv = () => {
|
|
10
10
|
return {
|
|
@@ -102,13 +102,14 @@ export const formatPhone = (phone: string) => {
|
|
|
102
102
|
|
|
103
103
|
export const cleanWhiteSpace = (str: string) => String(str).replace(/\s+/g, '');
|
|
104
104
|
|
|
105
|
-
export const jwtDecode = (token
|
|
106
|
-
if (token) return jwt_decode(token);
|
|
105
|
+
export const jwtDecode = (token?: string | null) => {
|
|
106
|
+
if (token) return jwt_decode<Utils.JwtToken>(token);
|
|
107
107
|
else return null;
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
export const isValidToken = (token: string) => {
|
|
111
|
-
|
|
111
|
+
const decoded = jwtDecode(token);
|
|
112
|
+
return !!decoded && (new Date(Number(decoded.exp) * 1000).getTime() - Date.now()) / 1000 > 0;
|
|
112
113
|
};
|
|
113
114
|
|
|
114
115
|
export const isValidGUID = (value: string) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hl-core",
|
|
3
|
-
"version": "0.0.10-beta.
|
|
3
|
+
"version": "0.0.10-beta.17",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "nuxt.config.ts",
|
|
@@ -36,35 +36,35 @@
|
|
|
36
36
|
"i:all": "cd .. && for /d %i in (.\\*) do echo Project: = %i && cd %i && yarn && cd .."
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@nuxt/devtools": "1.0.
|
|
40
|
-
"@vueuse/components": "10.
|
|
41
|
-
"@vueuse/core": "10.
|
|
42
|
-
"@vueuse/nuxt": "10.
|
|
43
|
-
"nuxt": "3.10.
|
|
39
|
+
"@nuxt/devtools": "1.0.8",
|
|
40
|
+
"@vueuse/components": "10.8.0",
|
|
41
|
+
"@vueuse/core": "10.8.0",
|
|
42
|
+
"@vueuse/nuxt": "10.8.0",
|
|
43
|
+
"nuxt": "3.10.3",
|
|
44
44
|
"prettier": "3.2.5",
|
|
45
45
|
"vue": "3.4.19",
|
|
46
|
-
"vue-router": "4.
|
|
46
|
+
"vue-router": "4.3.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@intlify/unplugin-vue-i18n": "2.0.0",
|
|
50
50
|
"@microsoft/signalr": "7.0.12",
|
|
51
|
-
"@nuxtjs/tailwindcss": "6.11.
|
|
51
|
+
"@nuxtjs/tailwindcss": "6.11.4",
|
|
52
52
|
"@pinia/nuxt": "0.5.1",
|
|
53
53
|
"@regulaforensics/document-reader-webclient": "6.9.5",
|
|
54
|
-
"@vite-pwa/nuxt": "0.
|
|
54
|
+
"@vite-pwa/nuxt": "0.5.0",
|
|
55
55
|
"@vuepic/vue-datepicker": "7.4.1",
|
|
56
56
|
"axios": "1.6.7",
|
|
57
57
|
"fast-xml-parser": "4.0.12",
|
|
58
|
-
"jwt-decode": "
|
|
58
|
+
"jwt-decode": "4.0.0",
|
|
59
59
|
"maska": "1.5.0",
|
|
60
60
|
"ncalayer-js-client": "1.3.4",
|
|
61
61
|
"pinia": "2.1.7",
|
|
62
62
|
"qrcode.vue": "3.4.1",
|
|
63
63
|
"typescript": "5.3.3",
|
|
64
64
|
"vue-i18n": "9.9.1",
|
|
65
|
-
"vue-json-pretty": "2.
|
|
65
|
+
"vue-json-pretty": "2.3.0",
|
|
66
66
|
"vue-toastification": "2.0.0-rc.5",
|
|
67
67
|
"vue-uuid": "3.0.0",
|
|
68
|
-
"vuetify": "3.5.
|
|
68
|
+
"vuetify": "3.5.6"
|
|
69
69
|
}
|
|
70
70
|
}
|
package/plugins/head.ts
CHANGED
|
@@ -5,7 +5,7 @@ export default defineNuxtPlugin(() => {
|
|
|
5
5
|
{
|
|
6
6
|
rel: 'icon',
|
|
7
7
|
type: 'image/x-icon',
|
|
8
|
-
href: import.meta.env.VITE_PARENT_PRODUCT === 'auletti' || import.meta.env.VITE_PRODUCT
|
|
8
|
+
href: import.meta.env.VITE_PARENT_PRODUCT === 'auletti' || String(import.meta.env.VITE_PRODUCT).includes('auletti') ? '/logo-auletti.svg' : '/logo.svg',
|
|
9
9
|
},
|
|
10
10
|
{ rel: 'preconnect', href: 'https://fonts.googleapis.com' },
|
|
11
11
|
{ rel: 'preconnect', href: 'https://fonts.gstatic.com' },
|
package/store/data.store.ts
CHANGED
|
@@ -160,21 +160,23 @@ export const useDataStore = defineStore('data', {
|
|
|
160
160
|
getUserRoles() {
|
|
161
161
|
if (this.accessToken && this.user.roles.length === 0) {
|
|
162
162
|
const decoded = jwtDecode(this.accessToken);
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
163
|
+
if (decoded) {
|
|
164
|
+
this.user.id = String(decoded.sub);
|
|
165
|
+
this.user.fullName = `${decoded.lastName} ${decoded.firstName} ${decoded.middleName ?? ''}`;
|
|
166
|
+
const key = getKeyWithPattern(decoded, 'role');
|
|
167
|
+
if (key) {
|
|
168
|
+
const roles = decoded[key as keyof Types.Utils.JwtToken];
|
|
169
|
+
if (typeof roles === 'string') {
|
|
170
|
+
this.user.roles.push(roles);
|
|
171
|
+
} else if (typeof roles === 'object') {
|
|
172
|
+
this.user.roles = roles;
|
|
173
|
+
}
|
|
172
174
|
}
|
|
173
175
|
}
|
|
174
176
|
}
|
|
175
177
|
},
|
|
176
178
|
getUserData() {
|
|
177
|
-
return
|
|
179
|
+
return jwtDecode(this.accessToken);
|
|
178
180
|
},
|
|
179
181
|
async getUserGroups() {
|
|
180
182
|
try {
|
|
@@ -3253,13 +3255,16 @@ export const useDataStore = defineStore('data', {
|
|
|
3253
3255
|
if (!this.accessToken) return null;
|
|
3254
3256
|
try {
|
|
3255
3257
|
const decoded = jwtDecode(this.accessToken);
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3258
|
+
if (decoded) {
|
|
3259
|
+
const data = {
|
|
3260
|
+
userName: decoded.code,
|
|
3261
|
+
branchName: decoded.branchCode,
|
|
3262
|
+
bin: bin.replace(/-/g, ''),
|
|
3263
|
+
};
|
|
3264
|
+
const gbdulResponse = await this.api.getGbdUl(data);
|
|
3265
|
+
return gbdulResponse;
|
|
3266
|
+
}
|
|
3267
|
+
return null;
|
|
3263
3268
|
} catch (err) {
|
|
3264
3269
|
return ErrorHandler(err);
|
|
3265
3270
|
}
|
package/types/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Value } from '../composables/classes';
|
|
|
2
2
|
import type { RouteLocationNormalizedLoaded, RouteLocationNormalized } from 'vue-router';
|
|
3
3
|
import type { AxiosRequestConfig } from 'axios';
|
|
4
4
|
import { Methods, CoreEnums, Actions, Statuses } from './enum';
|
|
5
|
+
import type { JwtPayload } from 'jwt-decode';
|
|
5
6
|
export { Methods, CoreEnums, Actions, Statuses };
|
|
6
7
|
|
|
7
8
|
export type EnvModes = 'development' | 'test' | 'production';
|
|
@@ -732,6 +733,22 @@ export namespace Utils {
|
|
|
732
733
|
export type VuetifyAnimations = 'expand' | 'fab' | 'fade' | 'scale' | 'scroll-x' | 'scroll-y' | 'slide-x' | 'slide-x-r' | 'slide-y' | 'slide-y-r';
|
|
733
734
|
export type LabelSize = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;
|
|
734
735
|
export type VIcon = { mdi?: string; color?: string; bg?: string; size?: 'x-small' | 'small' | 'default' | 'large' | 'x-large' };
|
|
736
|
+
export type JwtToken = JwtPayload & {
|
|
737
|
+
lastName: string;
|
|
738
|
+
firstName: string;
|
|
739
|
+
middleName?: string;
|
|
740
|
+
code: string;
|
|
741
|
+
name?: string;
|
|
742
|
+
branchId: string;
|
|
743
|
+
branchCode: string;
|
|
744
|
+
branchName: string;
|
|
745
|
+
isAdmin: boolean;
|
|
746
|
+
iin: string;
|
|
747
|
+
phone: string;
|
|
748
|
+
email: string;
|
|
749
|
+
isChangePassword: boolean;
|
|
750
|
+
Permission: string[];
|
|
751
|
+
};
|
|
735
752
|
}
|
|
736
753
|
|
|
737
754
|
export namespace Api {
|