hl-core 0.0.9-beta.9 → 0.0.10-beta.10
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/api/base.api.ts +1110 -0
- package/api/index.ts +2 -620
- package/api/interceptors.ts +38 -1
- package/components/Button/Btn.vue +1 -6
- package/components/Complex/MessageBlock.vue +1 -1
- package/components/Complex/Page.vue +1 -1
- package/components/Complex/TextBlock.vue +25 -0
- package/components/Dialog/Dialog.vue +72 -16
- package/components/Dialog/FamilyDialog.vue +3 -1
- package/components/Form/DynamicForm.vue +101 -0
- package/components/Form/FormBlock.vue +12 -3
- package/components/Form/FormData.vue +111 -0
- package/components/Form/FormSection.vue +3 -3
- package/components/Form/FormTextSection.vue +11 -3
- package/components/Form/FormToggle.vue +25 -5
- package/components/Form/ManagerAttachment.vue +178 -89
- package/components/Form/ProductConditionsBlock.vue +59 -6
- package/components/Input/Datepicker.vue +43 -7
- package/components/Input/DynamicInput.vue +25 -0
- package/components/Input/FileInput.vue +25 -5
- package/components/Input/FormInput.vue +9 -4
- package/components/Input/Monthpicker.vue +34 -0
- package/components/Input/PanelInput.vue +6 -1
- package/components/Input/RoundedInput.vue +2 -0
- package/components/Input/RoundedSelect.vue +9 -2
- package/components/Input/SwitchInput.vue +66 -0
- package/components/Input/TextInput.vue +162 -0
- package/components/Layout/Drawer.vue +18 -4
- package/components/Layout/Header.vue +23 -2
- package/components/Layout/Loader.vue +2 -1
- package/components/Layout/SettingsPanel.vue +24 -11
- package/components/Menu/InfoMenu.vue +35 -0
- package/components/Menu/MenuNav.vue +25 -3
- package/components/Pages/Anketa.vue +255 -65
- package/components/Pages/Auth.vue +58 -9
- package/components/Pages/ContragentForm.vue +10 -9
- package/components/Pages/Documents.vue +267 -30
- package/components/Pages/InvoiceInfo.vue +1 -1
- package/components/Pages/MemberForm.vue +775 -102
- package/components/Pages/ProductAgreement.vue +1 -8
- package/components/Pages/ProductConditions.vue +1133 -180
- package/components/Panel/PanelHandler.vue +627 -49
- package/components/Panel/PanelSelectItem.vue +17 -2
- package/components/Panel/RightPanelCloser.vue +7 -0
- package/components/Transitions/Animation.vue +30 -0
- package/components/Utilities/Chip.vue +2 -0
- package/components/Utilities/JsonViewer.vue +2 -2
- package/components/Utilities/Qr.vue +44 -0
- package/composables/axios.ts +1 -0
- package/composables/classes.ts +550 -44
- package/composables/constants.ts +126 -6
- package/composables/fields.ts +330 -0
- package/composables/index.ts +356 -20
- package/composables/styles.ts +23 -6
- package/configs/pwa.ts +63 -0
- package/layouts/clear.vue +21 -0
- package/layouts/default.vue +62 -3
- package/layouts/full.vue +21 -0
- package/locales/ru.json +558 -16
- package/nuxt.config.ts +6 -15
- package/package.json +38 -39
- package/pages/Token.vue +0 -13
- package/plugins/head.ts +26 -0
- package/plugins/vuetifyPlugin.ts +1 -5
- package/store/data.store.ts +1647 -348
- package/store/extractStore.ts +17 -0
- package/store/form.store.ts +13 -1
- package/store/member.store.ts +2 -1
- package/store/rules.ts +97 -3
- package/store/toast.ts +1 -1
- package/tsconfig.json +3 -0
- package/types/enum.ts +82 -0
- package/types/env.d.ts +2 -0
- package/types/form.ts +90 -0
- package/types/index.ts +847 -506
package/composables/index.ts
CHANGED
|
@@ -2,22 +2,15 @@ import { useDisplay } from 'vuetify';
|
|
|
2
2
|
import jwt_decode from 'jwt-decode';
|
|
3
3
|
import { XMLParser } from 'fast-xml-parser';
|
|
4
4
|
import { AxiosError } from 'axios';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
production: { login: '', password: '' },
|
|
9
|
-
test: { login: '', password: '' },
|
|
10
|
-
development: { login: 'manager', password: 'asdqwe123' },
|
|
11
|
-
vercel: { login: '', password: 'asdqwe123' },
|
|
12
|
-
};
|
|
13
|
-
};
|
|
5
|
+
import { DocumentReaderApi, Scenario, TextFieldType, LCID } from '@regulaforensics/document-reader-webclient';
|
|
6
|
+
import { PolicyholderClass } from '../composables/classes';
|
|
7
|
+
import type { EnvModes, NestedKeyOf, ResponseStructure } from '../types';
|
|
14
8
|
|
|
15
9
|
export const useEnv = () => {
|
|
16
10
|
return {
|
|
17
11
|
envMode: import.meta.env.VITE_MODE,
|
|
18
12
|
isDev: import.meta.env.VITE_MODE === 'development',
|
|
19
13
|
isTest: import.meta.env.VITE_MODE === 'test',
|
|
20
|
-
isVercel: import.meta.env.VITE_MODE === 'vercel',
|
|
21
14
|
isProduction: import.meta.env.VITE_MODE === 'production',
|
|
22
15
|
};
|
|
23
16
|
};
|
|
@@ -25,11 +18,13 @@ export const useEnv = () => {
|
|
|
25
18
|
export class Masks {
|
|
26
19
|
numbers: string = '#*';
|
|
27
20
|
otp: string = '# # # #';
|
|
21
|
+
spacedNumbers: string = '### ### ### ### ### ### ###';
|
|
28
22
|
iin: string = '###-###-###-###';
|
|
29
23
|
phone: string = '+7 (7##) ### ## ##';
|
|
30
24
|
date: string = '##.##.####';
|
|
31
25
|
post: string = '######';
|
|
32
26
|
threeDigit: string = '###';
|
|
27
|
+
iik: string = 'KZXXXXXXXXXXXXXXXXXX';
|
|
33
28
|
}
|
|
34
29
|
|
|
35
30
|
export const useMask = () => new Masks();
|
|
@@ -62,6 +57,18 @@ export const formatDate = (date: string) => {
|
|
|
62
57
|
}
|
|
63
58
|
};
|
|
64
59
|
|
|
60
|
+
export const formatToPlanDate = (date: string) => {
|
|
61
|
+
if (date) {
|
|
62
|
+
const data = date.split('.');
|
|
63
|
+
const day = data[0];
|
|
64
|
+
const month = data[1];
|
|
65
|
+
const year = data[2];
|
|
66
|
+
return `${year}-${month}-${day}`;
|
|
67
|
+
} else {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
65
72
|
export const reformatDate = (date: string) => {
|
|
66
73
|
if (date) {
|
|
67
74
|
const data = new Date(date);
|
|
@@ -93,6 +100,8 @@ export const formatPhone = (phone: string) => {
|
|
|
93
100
|
return phone?.replace(/(\(|\)|\+| )/g, '');
|
|
94
101
|
};
|
|
95
102
|
|
|
103
|
+
export const cleanWhiteSpace = (str: string) => String(str).replace(/\s+/g, '');
|
|
104
|
+
|
|
96
105
|
export const jwtDecode = (token: string): any => {
|
|
97
106
|
if (token) return jwt_decode(token);
|
|
98
107
|
else return null;
|
|
@@ -183,18 +192,66 @@ export const ESBDMessage = (ESBDObject: any, initialPoint: any) => {
|
|
|
183
192
|
|
|
184
193
|
export const ErrorHandler = (err: unknown, errorText?: string) => {
|
|
185
194
|
console.log(err);
|
|
186
|
-
if (
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
195
|
+
if (useDataStore) {
|
|
196
|
+
const dataStore = useDataStore();
|
|
197
|
+
if (typeof err === 'string') dataStore.showToaster('error', err);
|
|
198
|
+
if (err instanceof AxiosError) {
|
|
199
|
+
if ('response' in err && err.response && err.response.data) {
|
|
200
|
+
if (err.response.data === Object(err.response.data) && 'errors' in err.response.data && 'title' in err.response.data && 'traceId' in err.response.data) {
|
|
201
|
+
Object.entries(err.response.data.errors).forEach(([field, errors]) => {
|
|
202
|
+
dataStore.showToaster('error', `Поле: ${field}. Ошибка: ${Array.isArray(errors) ? errors.join(', ') : errors}`, 10000);
|
|
203
|
+
});
|
|
204
|
+
} else {
|
|
205
|
+
dataStore.showToaster('error', errorText ? errorText : err.response.data, 10000);
|
|
206
|
+
}
|
|
192
207
|
}
|
|
193
208
|
}
|
|
194
209
|
}
|
|
195
210
|
return false;
|
|
196
211
|
};
|
|
197
212
|
|
|
213
|
+
export const policyholderToBeneficialOwner = (isPolicyholderBeneficialOwner: boolean, policyholder?: PolicyholderClass) => {
|
|
214
|
+
const formStore = useFormStore();
|
|
215
|
+
const dataStore = useDataStore();
|
|
216
|
+
const beneficialOwner = formStore.lfb.beneficialOwners[0].beneficialOwnerData;
|
|
217
|
+
if (isPolicyholderBeneficialOwner && policyholder) {
|
|
218
|
+
beneficialOwner.iin = policyholder.clientData.authoritedPerson.iin;
|
|
219
|
+
beneficialOwner.firstName = policyholder.clientData.authoritedPerson.firstName;
|
|
220
|
+
beneficialOwner.middleName = policyholder.clientData.authoritedPerson.middleName;
|
|
221
|
+
beneficialOwner.lastName = policyholder.clientData.authoritedPerson.lastName;
|
|
222
|
+
beneficialOwner.citizenship = policyholder.clientData.authoritedPerson.citizenship;
|
|
223
|
+
beneficialOwner.birthDate = policyholder.clientData.authoritedPerson.birthDate;
|
|
224
|
+
beneficialOwner.gender = policyholder.clientData.authoritedPerson.gender;
|
|
225
|
+
beneficialOwner.resident = policyholder.clientData.resident;
|
|
226
|
+
beneficialOwner.taxResidentCountry = policyholder.clientData.taxResidentCountry;
|
|
227
|
+
beneficialOwner.economySectorCode = policyholder.clientData.economySectorCode;
|
|
228
|
+
beneficialOwner.identityDocument.issuedOn = policyholder.clientData.authoritedPerson.identityDocument.issuedOn;
|
|
229
|
+
beneficialOwner.identityDocument.documentNumber = policyholder.clientData.authoritedPerson.identityDocument.documentNumber;
|
|
230
|
+
beneficialOwner.identityDocument.documentType = policyholder.clientData.authoritedPerson.identityDocument.documentType;
|
|
231
|
+
beneficialOwner.identityDocument.issuedBy = policyholder.clientData.authoritedPerson.identityDocument.issuedBy;
|
|
232
|
+
beneficialOwner.identityDocument.validUntil = policyholder.clientData.authoritedPerson.identityDocument.validUntil;
|
|
233
|
+
beneficialOwner.identityDocument.series = policyholder.clientData.authoritedPerson.identityDocument.series;
|
|
234
|
+
dataStore.showToaster('warning', dataStore.t('toaster.formFieldEmptyWarning'));
|
|
235
|
+
} else {
|
|
236
|
+
beneficialOwner.iin = '';
|
|
237
|
+
beneficialOwner.firstName = '';
|
|
238
|
+
beneficialOwner.middleName = '';
|
|
239
|
+
beneficialOwner.lastName = '';
|
|
240
|
+
beneficialOwner.citizenship = new Value();
|
|
241
|
+
beneficialOwner.birthDate = '';
|
|
242
|
+
beneficialOwner.gender = new Value();
|
|
243
|
+
beneficialOwner.resident = new Value();
|
|
244
|
+
beneficialOwner.taxResidentCountry = new Value();
|
|
245
|
+
beneficialOwner.economySectorCode = new Value();
|
|
246
|
+
beneficialOwner.identityDocument.issuedOn = '';
|
|
247
|
+
beneficialOwner.identityDocument.documentNumber = '';
|
|
248
|
+
beneficialOwner.identityDocument.documentType = new Value();
|
|
249
|
+
beneficialOwner.identityDocument.issuedBy = new Value();
|
|
250
|
+
beneficialOwner.identityDocument.validUntil = '';
|
|
251
|
+
beneficialOwner.identityDocument.series = '';
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
|
|
198
255
|
export const setAddressBeneficiary = (whichIndex: number, sameAddress: boolean) => {
|
|
199
256
|
const formStore = useFormStore();
|
|
200
257
|
const dataStore = useDataStore();
|
|
@@ -254,15 +311,82 @@ export const setAddressBeneficiary = (whichIndex: number, sameAddress: boolean)
|
|
|
254
311
|
}
|
|
255
312
|
}
|
|
256
313
|
};
|
|
257
|
-
|
|
314
|
+
export const setAddressInsured = (whichIndex: number, sameAddress: boolean) => {
|
|
315
|
+
const formStore = useFormStore();
|
|
316
|
+
const dataStore = useDataStore();
|
|
317
|
+
const insured = formStore.insuredForm[Number(whichIndex)];
|
|
318
|
+
const policyholder = formStore.policyholderForm;
|
|
319
|
+
if (sameAddress === true) {
|
|
320
|
+
insured.registrationCity = policyholder.registrationCity;
|
|
321
|
+
insured.registrationCountry = policyholder.registrationCountry;
|
|
322
|
+
insured.birthPlace = policyholder.birthPlace;
|
|
323
|
+
insured.registrationMicroDistrict = policyholder.registrationMicroDistrict;
|
|
324
|
+
insured.registrationNumberApartment = policyholder.registrationNumberApartment;
|
|
325
|
+
insured.registrationNumberApartment = policyholder.registrationNumberApartment;
|
|
326
|
+
insured.registrationNumberHouse = policyholder.registrationNumberHouse;
|
|
327
|
+
insured.registrationProvince = policyholder.registrationProvince;
|
|
328
|
+
insured.registrationQuarter = policyholder.registrationQuarter;
|
|
329
|
+
insured.registrationRegion = policyholder.registrationRegion;
|
|
330
|
+
insured.registrationRegionType = policyholder.registrationRegionType;
|
|
331
|
+
insured.registrationStreet = policyholder.registrationStreet;
|
|
332
|
+
} else {
|
|
333
|
+
if (insured.id === 0) {
|
|
334
|
+
insured.registrationCity = new Value();
|
|
335
|
+
insured.registrationCountry = new Value();
|
|
336
|
+
insured.registrationMicroDistrict = '';
|
|
337
|
+
insured.registrationNumberApartment = '';
|
|
338
|
+
insured.registrationNumberApartment = '';
|
|
339
|
+
insured.registrationNumberHouse = '';
|
|
340
|
+
insured.registrationProvince = new Value();
|
|
341
|
+
insured.registrationQuarter = '';
|
|
342
|
+
insured.registrationRegion = new Value();
|
|
343
|
+
insured.registrationRegionType = new Value();
|
|
344
|
+
insured.registrationStreet = '';
|
|
345
|
+
} else {
|
|
346
|
+
if (insured.response && insured.response.addresses && insured.response.addresses.length) {
|
|
347
|
+
const benAddress = insured.response.addresses;
|
|
348
|
+
const countryName = benAddress[0].countryName;
|
|
349
|
+
const cityName = benAddress[0].cityName;
|
|
350
|
+
if (countryName) {
|
|
351
|
+
const country = dataStore.countries.find(i => (i.nameRu as string).match(new RegExp(countryName, 'i')));
|
|
352
|
+
insured.registrationCountry = country ?? new Value();
|
|
353
|
+
}
|
|
354
|
+
if (cityName) {
|
|
355
|
+
const city = dataStore.cities.find(i => i.nameRu === cityName.replace('г.', ''));
|
|
356
|
+
insured.registrationCity = city ?? new Value();
|
|
357
|
+
}
|
|
358
|
+
const province = dataStore.states.find(i => i.ids === benAddress[0].stateCode);
|
|
359
|
+
const localityType = dataStore.localityTypes.find(i => i.nameRu === benAddress[0].cityTypeName);
|
|
360
|
+
const region = dataStore.regions.find(i => i.ids == benAddress[0].regionCode);
|
|
361
|
+
insured.registrationMicroDistrict = insured.response?.addresses[0].microRaion ?? '';
|
|
362
|
+
insured.registrationNumberApartment = insured.response?.addresses[0].apartmentNumber ?? '';
|
|
363
|
+
insured.registrationNumberHouse = insured.response?.addresses[0].blockNumber ?? '';
|
|
364
|
+
insured.registrationProvince = province ?? new Value();
|
|
365
|
+
insured.registrationQuarter = insured.response?.addresses[0].kvartal ?? '';
|
|
366
|
+
insured.registrationRegion = region ?? new Value();
|
|
367
|
+
insured.registrationRegionType = localityType ?? new Value();
|
|
368
|
+
insured.registrationStreet = insured.response?.addresses[0].streetName ?? '';
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
};
|
|
258
373
|
export const changeBridge = async (toBridge: 'efo' | 'lka', token: string) => {
|
|
259
|
-
const bridgeUrl = import.meta.env[`VITE_${toBridge.toUpperCase()}_URL`] as string;
|
|
374
|
+
const bridgeUrl = ref<string>(import.meta.env[`VITE_${toBridge.toUpperCase()}_URL`] as string);
|
|
260
375
|
if (!toBridge) return;
|
|
261
|
-
if (!bridgeUrl || !token) {
|
|
376
|
+
if (!bridgeUrl.value || !token) {
|
|
262
377
|
useDataStore().showToaster('error', `${useDataStore().t('toaster.noUrl')} [import.meta.env.VITE_${toBridge.toUpperCase()}_URL]`);
|
|
263
378
|
return;
|
|
264
379
|
}
|
|
265
|
-
window.
|
|
380
|
+
const host = window.location.hostname;
|
|
381
|
+
if (toBridge === 'efo') {
|
|
382
|
+
if (host.startsWith('bpmsrv02') && bridgeUrl.value !== 'http://bpmsrv02:88') bridgeUrl.value = 'http://bpmsrv02:88';
|
|
383
|
+
if (host.startsWith('vega') && bridgeUrl.value !== 'http://vega:800') bridgeUrl.value = 'http://vega:800';
|
|
384
|
+
}
|
|
385
|
+
if (toBridge === 'lka') {
|
|
386
|
+
if (host.startsWith('bpmsrv02') && bridgeUrl.value !== 'http://bpmsrv02:890') bridgeUrl.value = 'http://bpmsrv02:890';
|
|
387
|
+
if (host.startsWith('vega') && bridgeUrl.value !== 'http://vega:890') bridgeUrl.value = 'http://vega:890';
|
|
388
|
+
}
|
|
389
|
+
window.open(`${bridgeUrl.value}/#/Token?token=${token}`, '_blank');
|
|
266
390
|
};
|
|
267
391
|
|
|
268
392
|
export const getFirstDayOfMonth = (year: number, month: number) => {
|
|
@@ -274,3 +398,215 @@ export const getLastDayOfMonth = (year: number, month: number) => {
|
|
|
274
398
|
const date = new Date();
|
|
275
399
|
return new Date(year, month + 1, 0, (date.getTimezoneOffset() / 60) * -1).toISOString();
|
|
276
400
|
};
|
|
401
|
+
|
|
402
|
+
type WhichValuePerEnv =
|
|
403
|
+
| 'qrHubUrl'
|
|
404
|
+
| 'qrGenUrl'
|
|
405
|
+
| 'qrXmlGenUrl'
|
|
406
|
+
| 'gatewayApiUrl'
|
|
407
|
+
| 'gatewayApiUrlLocal'
|
|
408
|
+
| 'baseApi'
|
|
409
|
+
| 'baseApiLocal'
|
|
410
|
+
| 'efoBaseApi'
|
|
411
|
+
| 'efoBaseApiLocal'
|
|
412
|
+
| 'amlBaseApi'
|
|
413
|
+
| 'amlBaseApiLocal';
|
|
414
|
+
|
|
415
|
+
export const getStrValuePerEnv = (which: WhichValuePerEnv) => {
|
|
416
|
+
const valuesPerEnv: {
|
|
417
|
+
[key in WhichValuePerEnv]: {
|
|
418
|
+
[key in EnvModes]: string;
|
|
419
|
+
};
|
|
420
|
+
} = {
|
|
421
|
+
qrHubUrl: {
|
|
422
|
+
production: 'https://prod-sign.halyklife.kz/qrhub',
|
|
423
|
+
development: 'https://test-sign.halyklife.kz/qrhub',
|
|
424
|
+
test: 'https://test-sign.halyklife.kz/qrhub',
|
|
425
|
+
},
|
|
426
|
+
qrGenUrl: {
|
|
427
|
+
production: 'https://prod-sign.halyklife.kz/EgovQrCms',
|
|
428
|
+
development: 'https://test-sign.halyklife.kz/EgovQrCms',
|
|
429
|
+
test: 'https://test-sign.halyklife.kz/EgovQrCms',
|
|
430
|
+
},
|
|
431
|
+
qrXmlGenUrl: {
|
|
432
|
+
production: 'https://prod-sign.halyklife.kz/EgovQrXml',
|
|
433
|
+
development: 'https://test-sign.halyklife.kz/EgovQrXml',
|
|
434
|
+
test: 'https://test-sign.halyklife.kz/EgovQrXml',
|
|
435
|
+
},
|
|
436
|
+
gatewayApiUrl: {
|
|
437
|
+
production: 'https://products.halyklife.kz/gateway',
|
|
438
|
+
development: 'https://products.halyklife.kz/test/gateway',
|
|
439
|
+
test: 'https://products.halyklife.kz/test/gateway',
|
|
440
|
+
},
|
|
441
|
+
gatewayApiUrlLocal: {
|
|
442
|
+
production: 'http://products.halyklife.nb/gateway',
|
|
443
|
+
development: 'http://products.halyklife.nb/test/gateway',
|
|
444
|
+
test: 'http://products.halyklife.nb/test/gateway',
|
|
445
|
+
},
|
|
446
|
+
baseApi: {
|
|
447
|
+
production: 'https://products.halyklife.kz/api/v1/insis',
|
|
448
|
+
development: 'https://products.halyklife.kz/api/v1/test/insis',
|
|
449
|
+
test: 'https://products.halyklife.kz/api/v1/test/insis',
|
|
450
|
+
},
|
|
451
|
+
baseApiLocal: {
|
|
452
|
+
production: 'http://bpmsrv02.halyklife.nb',
|
|
453
|
+
development: 'http://vega:84',
|
|
454
|
+
test: 'http://vega:84',
|
|
455
|
+
},
|
|
456
|
+
efoBaseApi: {
|
|
457
|
+
production: 'https://products.halyklife.kz/efo/api',
|
|
458
|
+
development: 'https://products.halyklife.kz/test/efo/api',
|
|
459
|
+
test: 'https://products.halyklife.kz/test/efo/api',
|
|
460
|
+
},
|
|
461
|
+
efoBaseApiLocal: {
|
|
462
|
+
production: 'http://efo-prod.halyklife.nb/api',
|
|
463
|
+
development: 'http://efo-dev.halyklife.nb/api',
|
|
464
|
+
test: 'http://efo-dev.halyklife.nb/api',
|
|
465
|
+
},
|
|
466
|
+
amlBaseApi: {
|
|
467
|
+
production: 'https://products.halyklife.kz/aml/api',
|
|
468
|
+
development: 'https://products.halyklife.kz/test/aml/api',
|
|
469
|
+
test: 'https://products.halyklife.kz/test/aml/api',
|
|
470
|
+
},
|
|
471
|
+
amlBaseApiLocal: {
|
|
472
|
+
production: 'http://aml-prod.halyklife.nb/api',
|
|
473
|
+
development: 'http://aml-dev.halyklife.nb/api',
|
|
474
|
+
test: 'http://aml-dev.halyklife.nb/api',
|
|
475
|
+
},
|
|
476
|
+
};
|
|
477
|
+
return valuesPerEnv[which][import.meta.env.VITE_MODE as EnvModes];
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
export const getMainPageRoute = () => {
|
|
481
|
+
const dataStore = useDataStore();
|
|
482
|
+
if (dataStore.isEFO || dataStore.isAULETTI) {
|
|
483
|
+
return 'Insurance-Product';
|
|
484
|
+
}
|
|
485
|
+
if (dataStore.isLKA || dataStore.isLKA_A) {
|
|
486
|
+
return 'Menu';
|
|
487
|
+
}
|
|
488
|
+
if (dataStore.isAML) {
|
|
489
|
+
return 'Main';
|
|
490
|
+
}
|
|
491
|
+
return 'index';
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
export const keyDeleter = <T extends object>(data: T, keys: Array<NestedKeyOf<T>>) => {
|
|
495
|
+
if (typeof data === 'object' && !!data && keys && Array.isArray(keys) && keys.length) {
|
|
496
|
+
keys.forEach(key => {
|
|
497
|
+
if (key) {
|
|
498
|
+
if (String(key).includes('.')) {
|
|
499
|
+
const childKey = String(key).substring(0, String(key).indexOf('.'));
|
|
500
|
+
const keyChain = [String(key).substring(String(key).indexOf('.') + 1)];
|
|
501
|
+
// @ts-ignore
|
|
502
|
+
keyDeleter(data[childKey], keyChain);
|
|
503
|
+
} else {
|
|
504
|
+
//@ts-ignore
|
|
505
|
+
delete data[key];
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
export const formatDateProperty = (item: any, to: 'front' | 'back', additionalKeys?: string[]) => {
|
|
513
|
+
try {
|
|
514
|
+
if (item) {
|
|
515
|
+
Object.keys(item).forEach((key: string) => {
|
|
516
|
+
if (item[key] === Object(item[key])) {
|
|
517
|
+
formatDateProperty(item[key], to);
|
|
518
|
+
} else {
|
|
519
|
+
if (Array.isArray(additionalKeys)) {
|
|
520
|
+
additionalKeys.forEach(k => {
|
|
521
|
+
if (String(key).includes(k) && typeof item[key] === 'string' && !!item[key]) {
|
|
522
|
+
item[key] = to === 'front' ? reformatDate(item[key]) : formatDate(item[key])!.toISOString();
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
if ((String(key).includes('date') || String(key).includes('Date')) && typeof item[key] === 'string' && !!item[key]) {
|
|
527
|
+
item[key] = to === 'front' ? reformatDate(item[key]) : formatDate(item[key])!.toISOString();
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
} catch (err) {
|
|
533
|
+
console.log(err);
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
export const callDocumentReader = async (imageBase64: string | string[]) => {
|
|
538
|
+
if (!imageBase64) return false;
|
|
539
|
+
const dataStore = useDataStore();
|
|
540
|
+
try {
|
|
541
|
+
const api = new DocumentReaderApi({
|
|
542
|
+
basePath: `${getStrValuePerEnv('gatewayApiUrl')}/regulaforensics`,
|
|
543
|
+
baseOptions: { headers: { Authorization: `Bearer ${dataStore.accessToken}` } },
|
|
544
|
+
});
|
|
545
|
+
const result = await api.process({
|
|
546
|
+
images: Array.isArray(imageBase64) ? imageBase64 : [imageBase64],
|
|
547
|
+
processParam: { scenario: Scenario.FULL_PROCESS, doublePageSpread: true, measureSystem: 0 },
|
|
548
|
+
});
|
|
549
|
+
const documentName = ref<string | undefined>(undefined);
|
|
550
|
+
if (result.rawResponse && result.rawResponse.ContainerList) {
|
|
551
|
+
const dType = result.rawResponse.ContainerList.List.find(i => i.result_type === 9);
|
|
552
|
+
if (dType && 'OneCandidate' in dType && dType.OneCandidate && dType.OneCandidate.DocumentName) {
|
|
553
|
+
documentName.value = dType.OneCandidate.DocumentName;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
if (result.text) {
|
|
557
|
+
const iin = result.text.getField(TextFieldType.PERSONAL_NUMBER);
|
|
558
|
+
const lastName = result.text.getField(TextFieldType.SURNAME, LCID.KAZAKH);
|
|
559
|
+
const firstName = result.text.getField(TextFieldType.GIVEN_NAMES_RUS, LCID.KAZAKH) ?? result.text.getField(TextFieldType.GIVEN_NAMES, LCID.KAZAKH);
|
|
560
|
+
const middleName = result.text.getField(TextFieldType.FATHERS_NAME_RUS, LCID.KAZAKH) ?? result.text.getField(TextFieldType.FATHERS_NAME, LCID.KAZAKH);
|
|
561
|
+
const fullName = result.text.getField(TextFieldType.SURNAME_AND_GIVEN_NAMES, LCID.KAZAKH);
|
|
562
|
+
const birthDate = result.text.getField(TextFieldType.DATE_OF_BIRTH);
|
|
563
|
+
const age = result.text.getField(TextFieldType.AGE);
|
|
564
|
+
const gender = result.text.getField(TextFieldType.SEX);
|
|
565
|
+
const documentNumber = result.text.getField(TextFieldType.DOCUMENT_NUMBER);
|
|
566
|
+
const documentIssuer = result.text.getField(TextFieldType.AUTHORITY_RUS) ?? result.text.getField(TextFieldType.AUTHORITY);
|
|
567
|
+
const documentIssueDate = result.text.getField(TextFieldType.DATE_OF_ISSUE);
|
|
568
|
+
const documentExpireDate = result.text.getField(TextFieldType.DATE_OF_EXPIRY);
|
|
569
|
+
const parsedDocument = {
|
|
570
|
+
iin: iin?.value,
|
|
571
|
+
lastName: lastName?.value,
|
|
572
|
+
firstName: firstName?.value,
|
|
573
|
+
middleName: middleName?.value,
|
|
574
|
+
fullName: fullName?.value,
|
|
575
|
+
birthDate: birthDate?.value,
|
|
576
|
+
age: age?.value,
|
|
577
|
+
gender: gender?.value,
|
|
578
|
+
documentName: documentName.value,
|
|
579
|
+
documentNumber: documentNumber?.value,
|
|
580
|
+
documentIssuer: documentIssuer?.value,
|
|
581
|
+
documentIssueDate: documentIssueDate?.value,
|
|
582
|
+
documentExpireDate: documentExpireDate?.value,
|
|
583
|
+
};
|
|
584
|
+
if (Object.values(parsedDocument).every(i => !i)) {
|
|
585
|
+
dataStore.showToaster('error', dataStore.t('toaster.notParsedDocument'));
|
|
586
|
+
return false;
|
|
587
|
+
}
|
|
588
|
+
return parsedDocument;
|
|
589
|
+
} else {
|
|
590
|
+
dataStore.showToaster('error', dataStore.t('toaster.notParsedDocument'));
|
|
591
|
+
}
|
|
592
|
+
return false;
|
|
593
|
+
} catch (err) {
|
|
594
|
+
return ErrorHandler(err);
|
|
595
|
+
}
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
export const validateResponseStructure = <T>(res: ResponseStructure<T>) => {
|
|
599
|
+
if (res && res.code === 0) {
|
|
600
|
+
return res.data;
|
|
601
|
+
} else {
|
|
602
|
+
useDataStore().showToaster('error', res.message);
|
|
603
|
+
return null;
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
|
|
607
|
+
export const isEveryFormDisabled = (isDisabledForm: any) => {
|
|
608
|
+
if (!isDisabledForm) return false;
|
|
609
|
+
return Object.values(isDisabledForm).every(i => i === true);
|
|
610
|
+
};
|
|
611
|
+
|
|
612
|
+
export class ApiError extends AxiosError<any, any> {}
|
package/composables/styles.ts
CHANGED
|
@@ -15,12 +15,24 @@ export class Styles {
|
|
|
15
15
|
blueTextLight: string = 'text-[#F3F6FC]';
|
|
16
16
|
|
|
17
17
|
// Green
|
|
18
|
-
greenBg: string =
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
greenBg: string =
|
|
19
|
+
import.meta.env.VITE_PRODUCT === 'auletti' || import.meta.env.VITE_PARENT_PRODUCT === 'auletti' || import.meta.env.VITE_PRODUCT === 'lka-auletti'
|
|
20
|
+
? 'bg-[#DEBE8C]'
|
|
21
|
+
: 'bg-[#009C73]';
|
|
22
|
+
greenBgHover: string =
|
|
23
|
+
import.meta.env.VITE_PRODUCT === 'auletti' || import.meta.env.VITE_PARENT_PRODUCT === 'auletti' || import.meta.env.VITE_PRODUCT === 'lka-auletti'
|
|
24
|
+
? 'bg-[#C19B5F]'
|
|
25
|
+
: 'hover:bg-[#00a277]';
|
|
26
|
+
greenBgLight: string =
|
|
27
|
+
import.meta.env.VITE_PRODUCT === 'auletti' || import.meta.env.VITE_PARENT_PRODUCT === 'auletti' || import.meta.env.VITE_PRODUCT === 'lka-auletti'
|
|
28
|
+
? 'bg-[#e8d2af]'
|
|
29
|
+
: 'bg-[#EAF6EF]';
|
|
21
30
|
greenText: string = '!text-[#009C73]';
|
|
22
31
|
greenTextHover: string = 'hover:text-[#009C73]';
|
|
23
|
-
greenBgLightHover: string =
|
|
32
|
+
greenBgLightHover: string =
|
|
33
|
+
import.meta.env.VITE_PRODUCT === 'auletti' || import.meta.env.VITE_PARENT_PRODUCT === 'auletti' || import.meta.env.VITE_PRODUCT === 'lka-auletti'
|
|
34
|
+
? 'hover:bg-[#efdfc6]'
|
|
35
|
+
: 'hover:bg-[#dbf0e4]';
|
|
24
36
|
|
|
25
37
|
// Yellow
|
|
26
38
|
yellowText: string = '!text-[#FAB31C]';
|
|
@@ -52,7 +64,10 @@ export class Styles {
|
|
|
52
64
|
roundedB: string = 'rounded-b-[8px]';
|
|
53
65
|
blueBorder: string = 'border-[1px] border-[#A0B3D8]';
|
|
54
66
|
blueLightBorder: string = 'border-[1px] border-[#F3F6FC]';
|
|
55
|
-
greenBorder: string =
|
|
67
|
+
greenBorder: string =
|
|
68
|
+
import.meta.env.VITE_PRODUCT === 'auletti' || import.meta.env.VITE_PARENT_PRODUCT === 'auletti' || import.meta.env.VITE_PRODUCT === 'lka-auletti'
|
|
69
|
+
? 'border-[1px] border-[#DEBE8C]'
|
|
70
|
+
: 'border-[1px] border-[#009C73]';
|
|
56
71
|
redBorder: string = 'border-[1px] border-[#FD2D39]';
|
|
57
72
|
yellowBorder: string = 'border-[1px] border-[#FAB31C]';
|
|
58
73
|
|
|
@@ -70,6 +85,7 @@ export class Styles {
|
|
|
70
85
|
redBtn: string;
|
|
71
86
|
yellowBtn: string;
|
|
72
87
|
whiteBtn: string;
|
|
88
|
+
whiteBorderBtn: string;
|
|
73
89
|
whiteBtnBlueBr: string;
|
|
74
90
|
blueLightBtn: string;
|
|
75
91
|
greenLightBtn: string;
|
|
@@ -92,13 +108,14 @@ export class Styles {
|
|
|
92
108
|
this.blueBtn = `${this.blueBg} ${this.whiteText} ${this.textTitle} ${this.rounded} w-full ${this.blueBgHover}`;
|
|
93
109
|
this.whiteBtnBlueBr = `${this.whiteBg} ${this.blueText} ${this.textTitle} ${this.rounded} w-full ${this.blueBgLightHover} ${this.blueBorder}`;
|
|
94
110
|
this.whiteBtn = ` ${this.blackText} ${this.textTitle} ${this.rounded} w-full ${this.blueLightBgHover}`;
|
|
111
|
+
this.whiteBorderBtn = ` ${this.blackText} ${this.textTitle} ${this.rounded} w-full ${this.blueLightBgHover} border-[#A0B3D8] border-[1px]`;
|
|
95
112
|
this.blueLightBtn = `${this.blueBgLight} ${this.greyTextLight} ${this.textTitle} ${this.rounded} w-full ${this.blueBgLightHover}`;
|
|
96
113
|
this.greenLightBtn = `${this.greenBgLight} ${this.greenText} ${this.textTitle} ${this.rounded} w-full ${this.greenBgLightHover}`;
|
|
97
114
|
|
|
98
115
|
// Complex
|
|
99
116
|
this.flexColNav = 'flex flex-col gap-[10px] px-2 pt-[14px]';
|
|
100
117
|
this.emptyBlockCol = 'w-[60px] sm:w-[100px] h-[30%] rounded-[8px] bg-[#f5f5f5]';
|
|
101
|
-
this.scrollPage = 'max-h-[
|
|
118
|
+
this.scrollPage = 'max-h-[85svh] overflow-y-scroll';
|
|
102
119
|
}
|
|
103
120
|
}
|
|
104
121
|
|
package/configs/pwa.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { ModuleOptions } from '@vite-pwa/nuxt';
|
|
2
|
+
|
|
3
|
+
export const pwaBaseConfig: Partial<ModuleOptions> = {
|
|
4
|
+
registerType: 'autoUpdate',
|
|
5
|
+
workbox: {
|
|
6
|
+
globPatterns: ['**/*.{js,css,html,txt,png,ico,svg}'],
|
|
7
|
+
navigateFallbackDenylist: [/^\/api\//],
|
|
8
|
+
navigateFallback: '/',
|
|
9
|
+
cleanupOutdatedCaches: true,
|
|
10
|
+
runtimeCaching: [
|
|
11
|
+
{
|
|
12
|
+
urlPattern: /^https:\/\/fonts.googleapis.com\/.*/i,
|
|
13
|
+
handler: 'CacheFirst',
|
|
14
|
+
options: {
|
|
15
|
+
cacheName: 'google-fonts-cache',
|
|
16
|
+
expiration: {
|
|
17
|
+
maxEntries: 10,
|
|
18
|
+
maxAgeSeconds: 60 * 60 * 24 * 365,
|
|
19
|
+
},
|
|
20
|
+
cacheableResponse: {
|
|
21
|
+
statuses: [0, 200],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
urlPattern: /^https:\/\/fonts.gstatic.com\/.*/i,
|
|
27
|
+
handler: 'CacheFirst',
|
|
28
|
+
options: {
|
|
29
|
+
cacheName: 'gstatic-fonts-cache',
|
|
30
|
+
expiration: {
|
|
31
|
+
maxEntries: 10,
|
|
32
|
+
maxAgeSeconds: 60 * 60 * 24 * 365,
|
|
33
|
+
},
|
|
34
|
+
cacheableResponse: {
|
|
35
|
+
statuses: [0, 200],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
urlPattern: /^https:\/\/cdn.jsdelivr.net\/.*/i,
|
|
41
|
+
handler: 'CacheFirst',
|
|
42
|
+
options: {
|
|
43
|
+
cacheName: 'cdn-jsdelivr-cache',
|
|
44
|
+
expiration: {
|
|
45
|
+
maxEntries: 10,
|
|
46
|
+
maxAgeSeconds: 60 * 60 * 24 * 365,
|
|
47
|
+
},
|
|
48
|
+
cacheableResponse: {
|
|
49
|
+
statuses: [0, 200],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
registerWebManifestInRouteRules: true,
|
|
56
|
+
writePlugin: true,
|
|
57
|
+
devOptions: {
|
|
58
|
+
enabled: true,
|
|
59
|
+
suppressWarnings: true,
|
|
60
|
+
navigateFallback: '/',
|
|
61
|
+
type: 'module',
|
|
62
|
+
},
|
|
63
|
+
};
|
package/layouts/clear.vue
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="h-full w-full"><slot></slot></div>
|
|
3
3
|
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
const dataStore = useDataStore();
|
|
7
|
+
const { $pwa } = useNuxtApp();
|
|
8
|
+
|
|
9
|
+
const onInit = async () => {
|
|
10
|
+
const projectConfig = dataStore.projectConfig;
|
|
11
|
+
if (!useEnv().isProduction && process.env.NODE_ENV === 'production' && $pwa && projectConfig === null) {
|
|
12
|
+
const hasConfig = await dataStore.getProjectConfig();
|
|
13
|
+
if (hasConfig === true) {
|
|
14
|
+
const commitVersion = String(import.meta.env.VITE_COMMIT_VERSION);
|
|
15
|
+
if (dataStore.projectConfig !== null && commitVersion !== dataStore.projectConfig.version) {
|
|
16
|
+
//@ts-ignore
|
|
17
|
+
await $pwa.updateServiceWorker(true);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
onInit();
|
|
24
|
+
</script>
|