hl-core 0.0.7-beta.0 → 0.0.7-beta.2

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.
@@ -0,0 +1,50 @@
1
+ export const constants = Object.freeze({
2
+ products: { baiterek: 3, halykmycar: 5, lifetrip: 7, bolashak: 8 },
3
+ BAITEREK_ROUTE: 'baiterek',
4
+ MYCAR_ROUTE: 'halykmycar',
5
+ LIFETRIP_ROUTE: 'lifetrip',
6
+ BOLASHAK_ROUTE: 'bolashak',
7
+ editableStatuses: ['StartForm', 'EditBeneficiaryForm', 'EditForm'],
8
+ documentsLinkVisibleStatuses: [
9
+ 'DocumentsSignedFrom',
10
+ 'UnderwriterForm',
11
+ 'AffilationResolutionForm',
12
+ 'Completed',
13
+ ],
14
+ gbdErrors: ['INVALID', 'TIMEOUT', 'ERROR', 'NOT_FOUND'],
15
+ types: {
16
+ string: 'string',
17
+ array: 'object',
18
+ object: 'object',
19
+ },
20
+ roles: {
21
+ manager: 'Manager',
22
+ admin: 'Admin',
23
+ underwriter: 'Underwriter',
24
+ agent: 'Agent',
25
+ compliance: 'Compliance',
26
+ agentMycar: 'AgentMycar',
27
+ analyst: 'Analyst',
28
+ upk: 'UPK',
29
+ },
30
+ actions: {
31
+ accept: 'accept',
32
+ rejectclient: 'rejectclient',
33
+ reject: 'reject',
34
+ return: 'return',
35
+ claim: 'claim',
36
+ signed: 'signed',
37
+ payed: 'payed',
38
+ },
39
+ yearCases: [2, 0, 1, 1, 1, 2],
40
+ yearTitles: ['год', 'года', 'лет'],
41
+ postActions: {
42
+ route: 'route',
43
+ applicationCreated: 'applicationCreated',
44
+ clipboard: 'clipboard',
45
+ toHomePage: 'toHomePage',
46
+ DOMevent: 'DOMevent',
47
+ toStatementHistory: 'toStatementHistory',
48
+ Error401: 'Error401',
49
+ },
50
+ });
@@ -1,6 +1,134 @@
1
1
  import { useDisplay } from 'vuetify';
2
+ import jwt_decode from 'jwt-decode';
3
+ import { XMLParser } from 'fast-xml-parser';
2
4
 
3
5
  export const useDisplayInfo = useDisplay;
4
6
 
5
7
  export const capitalize = (word: string): string =>
6
- word ? word.charAt(0).toUpperCase() + word.slice(1) : word;
8
+ word ? word.charAt(0).toUpperCase() + word.slice(1).toLowerCase() : word;
9
+
10
+ const xmlParser = new XMLParser({
11
+ // numberParseOptions: {
12
+ // leadingZeros: true,
13
+ // skipLike: /[0-9]+/,
14
+ // },
15
+ });
16
+
17
+ export const formatDate = (date: string) => {
18
+ if (date) {
19
+ const data = date.split('.');
20
+ const day = data[0];
21
+ const month = data[1];
22
+ const year = data[2];
23
+ return new Date(`${year}-${month}-${day}`);
24
+ } else {
25
+ return null;
26
+ }
27
+ };
28
+
29
+ export const reformatDate = (date: string) => {
30
+ if (date) {
31
+ const data = new Date(date);
32
+ let day: string | number = data.getDate();
33
+ let month: string | number = data.getMonth() + 1;
34
+ if (month < 10) {
35
+ month = '0' + month;
36
+ }
37
+ if (day < 10) {
38
+ day = '0' + day;
39
+ }
40
+ const year = data.getFullYear();
41
+ return `${day}.${month}.${year}`;
42
+ } else {
43
+ return null;
44
+ }
45
+ };
46
+
47
+ export const reformatIin = (iin: string) => {
48
+ if (!!iin) {
49
+ const matched = iin.match(/.{1,3}/g);
50
+ return matched ? matched.join('-') : '';
51
+ } else {
52
+ return '';
53
+ }
54
+ };
55
+
56
+ export const formatPhone = (phone: string) => {
57
+ return phone?.replace(/(\(|\)|\+| )/g, '');
58
+ };
59
+
60
+ export const jwtDecode = (token: string): any => {
61
+ if (token) return jwt_decode(token);
62
+ else return null;
63
+ };
64
+
65
+ export const isValidToken = (token: string) => {
66
+ return (
67
+ (new Date(jwtDecode(token).exp * 1000).getTime() - Date.now()) / 1000 > 0
68
+ );
69
+ };
70
+
71
+ export const isValidGUID = (value: string) => {
72
+ return (
73
+ !!value &&
74
+ value.length > 0 &&
75
+ /^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$/.test(
76
+ value,
77
+ )
78
+ );
79
+ };
80
+
81
+ export const getKeyWithPattern = (obj: any, key: string) => {
82
+ return Object.keys(obj).find(i => i.match(new RegExp(key, 'i'))) || null;
83
+ };
84
+
85
+ export const getFullNameShorted = (
86
+ text: string | null,
87
+ fromWhichWord: number = 1,
88
+ ) => {
89
+ if (text) {
90
+ const names = text.split(' ');
91
+ if (names.length > 1) {
92
+ let fullName = '';
93
+ names.forEach((name, index) => {
94
+ if (index >= fromWhichWord) fullName += ` ${name.charAt(0)}.`;
95
+ else fullName += `${name} `;
96
+ });
97
+ return fullName;
98
+ }
99
+ return text;
100
+ } else {
101
+ return '';
102
+ }
103
+ };
104
+
105
+ export const parseProcents = (val: string | number) =>
106
+ val ? Number(((val as number) * 100).toFixed(0)) : val;
107
+
108
+ export const formatProcents = (val: string | number) =>
109
+ val ? Number(((val as number) / 100).toFixed(2)) : Number(val);
110
+
111
+ export const sanitizeURL = (text: string) =>
112
+ text ? text.replace(/\r?\n|\r|\\|"/g, '') : '';
113
+
114
+ export const parseXML = (
115
+ xml: boolean | string = true,
116
+ withTag = false,
117
+ tag: string | null = null,
118
+ ) => {
119
+ if (xml) {
120
+ const localXml = xml as string;
121
+ if (withTag && tag !== null) {
122
+ const DOMparser = new DOMParser();
123
+ const xmLSerializer = new XMLSerializer();
124
+ const tagDOM = DOMparser.parseFromString(
125
+ localXml,
126
+ 'text/xml',
127
+ ).getElementsByTagName(tag);
128
+ const tagXml = xmLSerializer.serializeToString(tagDOM[0]);
129
+ return xmlParser.parse(tagXml);
130
+ } else {
131
+ return xmlParser.parse(localXml);
132
+ }
133
+ }
134
+ };
@@ -7,18 +7,20 @@ export class Styles {
7
7
 
8
8
  // Blue
9
9
  blueBg: string = 'bg-[#A0B3D8]';
10
+ blueBgHover: string = 'hover:bg-[#96abd6]';
10
11
  blueBgLight: string = 'bg-[#F3F6FC]';
11
12
  blueText: string = 'text-[#A0B3D8]';
12
13
  blueTextLight: string = 'text-[#F3F6FC]';
13
14
 
14
15
  // Green
15
16
  greenBg: string = 'bg-[#009C73]';
17
+ greenBgHover: string = 'hover:bg-[#00a277]';
16
18
  greenBgLight: string = 'bg-[#009C73]';
17
19
 
18
20
  // Grey
19
- greyBg: string = 'bg-[#A9ACAE]';
20
- greyText: string = 'text-[#A9ACAE]';
21
- greyTextLight: string = 'text-[#A5A5A5]';
21
+ greyBg: string = 'bg-[#B8B8B8]';
22
+ greyText: string = 'text-[#B8B8B8]';
23
+ greyTextLight: string = 'text-[#B8B8B8]';
22
24
  greyIcon: string = 'text-[#DADADA]';
23
25
  greyIconBg: string = 'bg-[#DADADA]';
24
26
  greyBtnBg: string = 'bg-[#EEE6E6]';
@@ -28,6 +30,10 @@ export class Styles {
28
30
  redText: string = 'text-[#E46962]';
29
31
  redBg: string = 'bg-[#E46962]';
30
32
 
33
+ // Error
34
+ errorBg: string = 'bg-[#FF5449]';
35
+ errorText: string = 'text-[#FF5449]';
36
+
31
37
  // Border
32
38
  rounded: string = 'rounded-[8px]';
33
39
 
@@ -37,14 +43,17 @@ export class Styles {
37
43
  textBold: string = 'font-bold';
38
44
 
39
45
  // Button
46
+ btnHSm: string = 'h-[40px]';
40
47
  btnHMd: string = 'h-[60px]';
41
48
  btnHLg: string = 'h-[60px]';
42
49
 
43
50
  // Complex
44
51
  greenBtn: string;
52
+ blueBtn: string;
45
53
 
46
54
  constructor() {
47
55
  // Complex
48
- this.greenBtn = `${this.greenBg} ${this.whiteText} ${this.textTitle} ${this.rounded} w-full`;
56
+ this.greenBtn = `${this.greenBg} ${this.whiteText} ${this.textTitle} ${this.rounded} w-full ${this.greenBgHover}`;
57
+ this.blueBtn = `${this.blueBg} ${this.whiteText} ${this.textTitle} ${this.rounded} w-full ${this.blueBgHover}`;
49
58
  }
50
59
  }
@@ -0,0 +1,3 @@
1
+ <template>
2
+ <slot></slot>
3
+ </template>
@@ -0,0 +1,9 @@
1
+ <template>
2
+ <div
3
+ :class="[$libStyles.greenBg]"
4
+ class="hidden lg:block absolute top-0 h-[200px] w-full"
5
+ ></div>
6
+ <div class="h-full z-[1] lg:mx-[22px] lg:my-[33px] lg:shadow-xl">
7
+ <slot></slot>
8
+ </div>
9
+ </template>
@@ -0,0 +1,23 @@
1
+ export type InputTypes =
2
+ | 'button'
3
+ | 'checkbox'
4
+ | 'color'
5
+ | 'date'
6
+ | 'datetime-local'
7
+ | 'email'
8
+ | 'file'
9
+ | 'hidden'
10
+ | 'image'
11
+ | 'month'
12
+ | 'number'
13
+ | 'password'
14
+ | 'radio'
15
+ | 'range'
16
+ | 'reset'
17
+ | 'search'
18
+ | 'submit'
19
+ | 'tel'
20
+ | 'text'
21
+ | 'time'
22
+ | 'url'
23
+ | 'week';
package/nuxt.config.ts CHANGED
@@ -1,13 +1,32 @@
1
+ import path from 'path';
2
+
1
3
  export default defineNuxtConfig({
2
4
  ssr: false,
3
5
 
4
- modules: [
5
- '@pinia/nuxt',
6
- '@nuxtjs/tailwindcss',
7
- ],
6
+ modules: ['@pinia/nuxt', '@nuxtjs/tailwindcss'],
8
7
 
9
8
  imports: {
10
- dirs: ['store', 'composables'],
9
+ dirs: ['store', 'composables', 'models'],
10
+ },
11
+
12
+ vite: {
13
+ resolve: {
14
+ alias: [
15
+ {
16
+ find: '@',
17
+ replacement: path.resolve(__dirname, '.'),
18
+ },
19
+ ],
20
+ },
21
+ vue: {
22
+ template: {
23
+ compilerOptions: {
24
+ isCustomElement: tag => {
25
+ return tag.startsWith('Base');
26
+ },
27
+ },
28
+ },
29
+ },
11
30
  },
12
31
 
13
32
  components: [{ path: './components', prefix: 'Base', pathPrefix: false }],
package/package.json CHANGED
@@ -1,23 +1,26 @@
1
1
  {
2
2
  "name": "hl-core",
3
- "version": "0.0.7-beta.0",
3
+ "version": "0.0.7-beta.2",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "nuxt.config.ts",
7
7
  "files": [
8
+ "api/",
9
+ "models/",
8
10
  "store/",
11
+ "layouts/",
9
12
  "composables/",
10
13
  "components/",
11
14
  "plugins/",
12
15
  "nuxt.config.ts",
16
+ "tailwind.config.ts",
13
17
  ".prettierrc"
14
18
  ],
15
19
  "scripts": {
16
20
  "build": "nuxt build",
17
21
  "dev": "nuxt dev",
18
22
  "generate": "nuxt generate",
19
- "preview": "nuxt preview",
20
- "postinstall": "nuxt prepare"
23
+ "preview": "nuxt preview"
21
24
  },
22
25
  "devDependencies": {
23
26
  "nuxt": "^3.2.3",
@@ -25,9 +28,13 @@
25
28
  "typescript": "^4.9.5"
26
29
  },
27
30
  "dependencies": {
28
- "@nuxtjs/tailwindcss": "^6.4.1",
29
31
  "@mdi/font": "^7.1.96",
32
+ "@nuxtjs/tailwindcss": "^6.4.1",
30
33
  "@pinia/nuxt": "^0.4.7",
34
+ "animate.css": "^4.1.1",
35
+ "axios": "^1.3.4",
36
+ "fast-xml-parser": "4.0.12",
37
+ "jwt-decode": "^3.1.2",
31
38
  "pinia": "^2.0.33",
32
39
  "vue-toastification": "^2.0.0-rc.5",
33
40
  "vuetify": "^3.1.8"
@@ -1,9 +1,13 @@
1
- import { capitalize } from '../composables';
1
+ import { capitalize, getFullNameShorted, reformatIin } from '../composables';
2
+ import { constants } from '../composables/constants';
2
3
 
3
4
  export default defineNuxtPlugin(() => {
4
5
  return {
5
6
  provide: {
6
7
  capitalize: capitalize,
8
+ getFullNameShorted: getFullNameShorted,
9
+ reformatIin: reformatIin,
10
+ constants: constants,
7
11
  },
8
12
  };
9
13
  });
@@ -1,4 +1,3 @@
1
- import { useAppStore } from '../store/app.store';
2
1
  import { useDataStore } from '../store/data.store';
3
2
  import { Styles } from '../composables/styles';
4
3
 
@@ -11,7 +10,6 @@ export default defineNuxtPlugin(nuxtApp => {
11
10
 
12
11
  return {
13
12
  provide: {
14
- appStore: useAppStore(),
15
13
  dataStore: useDataStore(),
16
14
  libStyles: new Styles(),
17
15
  t: useDataStore().t,
@@ -1,4 +1,5 @@
1
1
  import '@mdi/font/css/materialdesignicons.css';
2
+ import 'animate.css';
2
3
  import 'vuetify/styles';
3
4
  import { createVuetify } from 'vuetify';
4
5
  import * as components from 'vuetify/components';
@@ -9,6 +10,15 @@ export default defineNuxtPlugin(nuxtApp => {
9
10
  ssr: false,
10
11
  components,
11
12
  directives,
13
+ theme: {
14
+ themes: {
15
+ light: {
16
+ colors: {
17
+ error: '#FF5449',
18
+ },
19
+ },
20
+ },
21
+ },
12
22
  });
13
23
 
14
24
  nuxtApp.vueApp.use(vuetify);