hl-core 0.0.9-beta.53 → 0.0.9-beta.55

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.
@@ -67,6 +67,20 @@ export const useDataStore = defineStore('data', {
67
67
  !!state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10 && i.coverSumCode === 'included'),
68
68
  },
69
69
  actions: {
70
+ async getProjectConfig() {
71
+ try {
72
+ const projectConfig = await this.api.getProjectConfig();
73
+ if (projectConfig) {
74
+ this.projectConfig = projectConfig;
75
+ return true;
76
+ } else {
77
+ return false;
78
+ }
79
+ } catch (err) {
80
+ this.projectConfig = null;
81
+ return false;
82
+ }
83
+ },
70
84
  isIframe() {
71
85
  try {
72
86
  return window.self !== window.top;
@@ -293,6 +307,18 @@ export const useDataStore = defineStore('data', {
293
307
  isTask() {
294
308
  return this.formStore.applicationData.processInstanceId !== 0 && this.formStore.applicationData.isTask;
295
309
  },
310
+ validateAccess() {
311
+ try {
312
+ const hasAccess = this.hasAccess();
313
+ if (this.isAML) return hasAccess.toAML;
314
+ if (this.isLKA) return hasAccess.toLKA;
315
+ if (this.isEFO) return hasAccess.toEFO;
316
+ if (this.isAULETTI) return hasAccess.toAULETTI;
317
+ return false;
318
+ } catch (err) {
319
+ return ErrorHandler(err);
320
+ }
321
+ },
296
322
  async loginUser(login: string, password: string, numAttempt: number) {
297
323
  try {
298
324
  const token = localStorage.getItem('accessToken') || null;
@@ -305,21 +331,12 @@ export const useDataStore = defineStore('data', {
305
331
  password: password,
306
332
  numAttempt: numAttempt,
307
333
  });
308
-
309
334
  this.accessToken = loginResponse.accessToken;
310
335
  this.refreshToken = loginResponse.refreshToken;
311
336
  this.getUserRoles();
312
337
  }
313
- const checkPermission = () => {
314
- const hasAccess = this.hasAccess();
315
- if (this.isAML) return hasAccess.toAML;
316
- if (this.isLKA) return hasAccess.toLKA;
317
- if (this.isEFO) return hasAccess.toEFO;
318
- if (this.isAULETTI) return hasAccess.toAULETTI;
319
- return false;
320
- };
321
338
  if (this.controls.onAuth) {
322
- const hasPermission = checkPermission();
339
+ const hasPermission = this.validateAccess();
323
340
  if (hasPermission) {
324
341
  localStorage.setItem('accessToken', this.accessToken);
325
342
  localStorage.setItem('refreshToken', String(this.refreshToken));
@@ -356,6 +373,15 @@ export const useDataStore = defineStore('data', {
356
373
  }
357
374
  this.isLoading = false;
358
375
  },
376
+ async checkToken() {
377
+ try {
378
+ await this.api.checkToken();
379
+ return true;
380
+ } catch (err) {
381
+ ErrorHandler(err);
382
+ return false;
383
+ }
384
+ },
359
385
  async resetSelected(route: RouteType) {
360
386
  this.settings.open = false;
361
387
  this.rightPanel.open = false;
@@ -939,6 +965,7 @@ export const useDataStore = defineStore('data', {
939
965
  data.profession = member.job;
940
966
  data.position = member.jobPosition;
941
967
  data.jobName = member.jobPlace;
968
+ data.positionCode = member.positionCode;
942
969
  data.familyStatusId = member.familyStatus.id;
943
970
  }
944
971
  if (whichMember === 'Spokesman') {
@@ -994,6 +1021,7 @@ export const useDataStore = defineStore('data', {
994
1021
  data.profession = member.job;
995
1022
  data.position = member.jobPosition;
996
1023
  data.jobName = member.jobPlace;
1024
+ data.positionCode = member.positionCode;
997
1025
  data.familyStatusId = member.familyStatus.id;
998
1026
  data.relationId = member.relationDegree.ids;
999
1027
  data.relationName = member.relationDegree.nameRu;
@@ -1496,6 +1524,15 @@ export const useDataStore = defineStore('data', {
1496
1524
  async getAuthorityBasis() {
1497
1525
  if (this.isDas || this.isLifeBusiness || this.isGns || this.isUU || this.isPrePension) return await this.getFromApi('authorityBasis', 'getArmDicts', 'DicAuthorityBasis');
1498
1526
  },
1527
+ async getWorkPosition(search: string) {
1528
+ try {
1529
+ const workPositions = await this.api.getWorkPosition(search);
1530
+ return workPositions;
1531
+ } catch (err) {
1532
+ ErrorHandler(err);
1533
+ return [];
1534
+ }
1535
+ },
1499
1536
  async getAllFormsData() {
1500
1537
  await Promise.allSettled([
1501
1538
  this.getCountries(),
@@ -1624,8 +1661,8 @@ export const useDataStore = defineStore('data', {
1624
1661
  delete query.processCodes;
1625
1662
  query.processCode = byOneProcess;
1626
1663
  }
1627
- if (byOneProcess === 19) {
1628
- query.processCodes = [19, 2, 4];
1664
+ if (byOneProcess === 19 && !useEnv().isProduction) {
1665
+ query.processCodes = [19, 2];
1629
1666
  delete query.processCode;
1630
1667
  }
1631
1668
  const taskList = await this.api.getTaskList(
@@ -2070,8 +2107,10 @@ export const useDataStore = defineStore('data', {
2070
2107
  this.formStore.isActOwnBehalf = clientData.isActOwnBehalf;
2071
2108
  this.formStore.hasRepresentative = !!applicationData.spokesmanApp;
2072
2109
 
2073
- const beneficiaryPolicyholderIndex = beneficiaryData.findIndex(i => i.insisId === clientData.insisId);
2074
- this.formStore.isPolicyholderBeneficiary = beneficiaryPolicyholderIndex !== -1;
2110
+ if (beneficiaryData) {
2111
+ const beneficiaryPolicyholderIndex = beneficiaryData.findIndex(i => i.insisId === clientData.insisId);
2112
+ this.formStore.isPolicyholderBeneficiary = beneficiaryPolicyholderIndex !== -1;
2113
+ }
2075
2114
 
2076
2115
  if ('finCenterData' in applicationData && !!applicationData.finCenterData) {
2077
2116
  this.formStore.finCenterData = applicationData.finCenterData;
@@ -2445,6 +2484,7 @@ export const useDataStore = defineStore('data', {
2445
2484
  if (!!this.formStore.applicationData[whichMember].profession) this.formStore[whichForm].job = this.formStore.applicationData[whichMember].profession;
2446
2485
  if (!!this.formStore.applicationData[whichMember].position) this.formStore[whichForm].jobPosition = this.formStore.applicationData[whichMember].position;
2447
2486
  if (!!this.formStore.applicationData[whichMember].jobName) this.formStore[whichForm].jobPlace = this.formStore.applicationData[whichMember].jobName;
2487
+ if (!!this.formStore.applicationData[whichMember].positionCode) this.formStore[whichForm].positionCode = this.formStore.applicationData[whichMember].positionCode;
2448
2488
  if (typeof this.formStore.applicationData[whichMember].isDisability === 'boolean')
2449
2489
  this.formStore[whichForm].isDisability = this.formStore.applicationData[whichMember].isDisability;
2450
2490
  if (!!this.formStore.applicationData[whichMember].disabilityGroupId) {
@@ -2481,6 +2521,9 @@ export const useDataStore = defineStore('data', {
2481
2521
  if ('jobPlace' in this.formStore[whichForm][index] && !!this.formStore.applicationData[whichMember][index].jobName) {
2482
2522
  this.formStore[whichForm][index].jobPlace = this.formStore.applicationData[whichMember][index].jobName;
2483
2523
  }
2524
+ if ('positionCode' in this.formStore[whichForm][index] && !!this.formStore.applicationData[whichMember][index].positionCode) {
2525
+ this.formStore[whichForm][index].positionCode = this.formStore.applicationData[whichMember][index].positionCode;
2526
+ }
2484
2527
  if (typeof this.formStore.applicationData[whichMember][index].isDisability === 'boolean') {
2485
2528
  this.formStore[whichForm][index].isDisability = this.formStore.applicationData[whichMember][index].isDisability;
2486
2529
  }
@@ -2527,7 +2570,7 @@ export const useDataStore = defineStore('data', {
2527
2570
  },
2528
2571
  ];
2529
2572
  }
2530
- case 'ContractSignedByAuthorizedPerson':
2573
+ case 'HeadManagerForm':
2531
2574
  return [
2532
2575
  {
2533
2576
  processInstanceId: String(this.formStore.applicationData.processInstanceId),
@@ -2559,19 +2602,20 @@ export const useDataStore = defineStore('data', {
2559
2602
  return signData;
2560
2603
  } else if (type === 'signature') {
2561
2604
  const ncaLayerClient = new NCALayerClient();
2605
+ const formTemplate = new FormData();
2606
+ formTemplate.append('format', 'pdf');
2607
+ formTemplate.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
2562
2608
  let activeTokens;
2563
2609
  try {
2564
2610
  await ncaLayerClient.connect();
2565
2611
  activeTokens = await ncaLayerClient.getActiveTokens();
2566
2612
  const storageType = activeTokens[0] || NCALayerClient.fileStorageType;
2567
- if (this.formStore.applicationData.statusCode === 'ContractSignedByAuthorizedPerson') {
2568
- const document = await this.generatePDFDocument('PAEnpf_Agreement', '40', 'pdf');
2613
+ if (this.formStore.applicationData.statusCode === 'ContractSignedFrom') {
2614
+ const document = await this.generatePDFDocument('PA_Contract', '38', 'pdf');
2569
2615
  const base64EncodedSignature = await ncaLayerClient.basicsSignCMS(storageType, document, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
2570
- const formData = new FormData();
2616
+ const formData = formTemplate;
2571
2617
  formData.append('base64EncodedSignature', base64EncodedSignature);
2572
- formData.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
2573
- formData.append('name', 'PAEnpf_Agreement');
2574
- formData.append('format', 'pdf');
2618
+ formData.append('name', 'PA_Contract');
2575
2619
  try {
2576
2620
  await this.api.uploadDigitalCertifijcate(formData);
2577
2621
  await this.handleTask('accept', String(this.formStore.applicationTaskId));
@@ -2579,40 +2623,55 @@ export const useDataStore = defineStore('data', {
2579
2623
  this.showToaster('error', String(e));
2580
2624
  return;
2581
2625
  }
2582
- } else if (this.formStore.applicationData.statusCode === 'ContractSignedFrom') {
2626
+ } else if (this.formStore.applicationData.statusCode === 'HeadManagerForm') {
2583
2627
  const document = await this.generatePDFDocument('PA_Contract', '38', 'pdf');
2584
2628
  const base64EncodedSignature = await ncaLayerClient.basicsSignCMS(storageType, document, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
2585
- const formData = new FormData();
2629
+ const formData = formTemplate;
2586
2630
  formData.append('base64EncodedSignature', base64EncodedSignature);
2587
- formData.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
2588
2631
  formData.append('name', 'PA_Contract');
2589
- formData.append('format', 'pdf');
2590
2632
  try {
2591
- await this.api.uploadDigitalCertifijcate(formData);
2633
+ await this.api.uploadDigitalCertificatePensionAnnuityNew(formData);
2592
2634
  await this.handleTask('accept', String(this.formStore.applicationTaskId));
2593
2635
  } catch (e) {
2594
2636
  this.showToaster('error', String(e));
2595
2637
  return;
2596
2638
  }
2597
2639
  } else {
2598
- const agreementXml = await this.getDocument(this.formStore.applicationData.processInstanceId as string);
2599
- const wnd = window.open('about:blank', '', '_blank');
2600
- wnd?.document.write(agreementXml as any);
2601
- const signedAgreement = await ncaLayerClient.signXml(storageType, agreementXml, 'SIGNATURE', '');
2602
- const document = {
2603
- processInstanceId: String(this.formStore.applicationData.processInstanceId),
2604
- name: 'PAEnpf_Agreement',
2605
- format: 'xml',
2606
- };
2607
- const signData = await this.api.signXml([document]);
2608
- const data = new FormData();
2609
- data.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
2610
- data.append('xmlData', signedAgreement);
2611
- data.append('name', 'PAEnpf_Agreement');
2612
- data.append('format', 'xml');
2613
- data.append('EdsXmlId', signData.data);
2614
- await this.api.uploadXml(data);
2615
- await this.getSignedDocList(this.formStore.applicationData.processInstanceId);
2640
+ if (!!this.formStore.signedDocumentList.find(i => i.fileTypeCode === '43')?.signed) {
2641
+ const statement = await this.generatePDFDocument('PA_Statement', '37', 'pdf');
2642
+ const statementSignature = await ncaLayerClient.basicsSignCMS(storageType, statement, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
2643
+ const statementData = formTemplate;
2644
+ statementData.append('base64EncodedSignature', statementSignature);
2645
+ statementData.append('name', 'PA_Statement');
2646
+ await this.api.uploadDigitalCertifijcate(statementData);
2647
+ const agreement = await this.generatePDFDocument('Agreement', '19', 'pdf');
2648
+ const agreementSignature = await ncaLayerClient.basicsSignCMS(storageType, agreement, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
2649
+ const agreementData = formTemplate;
2650
+ agreementData.append('base64EncodedSignature', agreementSignature);
2651
+ agreementData.append('name', 'Agreement');
2652
+ await this.api.uploadDigitalCertifijcate(agreementData);
2653
+ await this.handleTask('accept', String(this.formStore.applicationTaskId));
2654
+ } else {
2655
+ const document = {
2656
+ processInstanceId: String(this.formStore.applicationData.processInstanceId),
2657
+ name: 'PAEnpf_Agreement',
2658
+ format: 'xml',
2659
+ };
2660
+ const signData = await this.api.signXml([document]);
2661
+ const agreementXml = await this.api.getDocumentsByEdsXmlId(signData.data);
2662
+ const wnd = window.open('about:blank', '', '_blank');
2663
+ wnd?.document.write(agreementXml.data.document.documentXml);
2664
+ const signedAgreement = await ncaLayerClient.signXml(storageType, agreementXml.data.document.documentXml, 'SIGNATURE', '');
2665
+ const data = new FormData();
2666
+ data.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
2667
+ data.append('xmlData', signedAgreement);
2668
+ data.append('name', 'PAEnpf_Agreement');
2669
+ data.append('format', 'xml');
2670
+ data.append('EdsXmlId', signData.data);
2671
+ await this.api.uploadXml(data);
2672
+ await this.getSignedDocList(this.formStore.applicationData.processInstanceId);
2673
+ this.showToaster('success', this.t('pension.consentGiven'), 3000);
2674
+ }
2616
2675
  }
2617
2676
  } catch (error) {
2618
2677
  this.showToaster('error', String(error));
@@ -3385,7 +3444,7 @@ export const useDataStore = defineStore('data', {
3385
3444
  if (data[key] !== null) {
3386
3445
  if (key === 'iin' || key === 'bin') data[key] = data[key].replace(/-/g, '');
3387
3446
  if (key === 'phoneNumber') data[key] = formatPhone(data[key]);
3388
- if (key === 'issuedOn' || key === 'validUntil' || key === 'birthDate') data[key] = formatDate(data[key])?.toISOString() ?? '';
3447
+ if (key === 'issuedOn' || key === 'validUntil' || key === 'birthDate' || key === 'date') data[key] = formatDate(data[key])?.toISOString() ?? '';
3389
3448
  if (key === 'nameRu' && data['ids']) data['id'] = data['ids'];
3390
3449
  }
3391
3450
  }
@@ -3760,14 +3819,6 @@ export const useDataStore = defineStore('data', {
3760
3819
  return ErrorHandler(err);
3761
3820
  }
3762
3821
  },
3763
- async getDocument(id: string) {
3764
- try {
3765
- const response = await this.api.getDocument(id);
3766
- return response;
3767
- } catch (err) {
3768
- return ErrorHandler(err);
3769
- }
3770
- },
3771
3822
  async generateShortLink(url: string) {
3772
3823
  try {
3773
3824
  const response = await this.api.generateShortLink({
package/types/enum.ts CHANGED
@@ -121,7 +121,7 @@ export enum Statuses {
121
121
  ActuaryForm = 'ActuaryForm',
122
122
  DsoUsnsForm = 'DsoUsnsForm',
123
123
  AccountantForm = 'AccountantForm',
124
- ContractSignedByAuthorizedPerson = 'ContractSignedByAuthorizedPerson',
124
+ HeadManagerForm = 'HeadManagerForm',
125
125
  }
126
126
 
127
127
  export enum MemberCodes {
package/types/env.d.ts CHANGED
@@ -4,6 +4,7 @@ interface ImportMetaEnv {
4
4
  readonly VITE_MODE: EnvModes;
5
5
  readonly VITE_PRODUCT?: Projects;
6
6
  readonly VITE_PARENT_PRODUCT?: 'efo' | 'auletti';
7
+ readonly VITE_COMMIT_VERSION?: string;
7
8
  }
8
9
 
9
10
  interface ImportMeta {
package/types/index.ts CHANGED
@@ -355,7 +355,18 @@ declare global {
355
355
 
356
356
  type SignDataType = {
357
357
  processInstanceId: string;
358
- name: 'Statement' | 'Agreement' | 'Contract' | 'PA_Contract' | 'PA_Statement' | 'PA_RefundStatement' | 'PA_RefundAgreement' | 'PAEnpf_Agreement' | 'InvoicePayment';
358
+ name:
359
+ | 'Statement'
360
+ | 'Agreement'
361
+ | 'Contract'
362
+ | 'PA_Contract'
363
+ | 'PA_Statement'
364
+ | 'PA_RefundStatement'
365
+ | 'PA_RefundAgreement'
366
+ | 'PAEnpf_Agreement'
367
+ | 'InvoicePayment'
368
+ | 'RejectOSNS'
369
+ | 'RejectInsuredNotValid';
359
370
  format: 'pdf' | 'xml';
360
371
  };
361
372
 
@@ -728,10 +739,6 @@ declare global {
728
739
  totalAmount7: number | null;
729
740
  };
730
741
 
731
- type LabelSize = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;
732
-
733
- type VuetifyAnimations = 'expand' | 'fab' | 'fade' | 'scale' | 'scroll-x' | 'scroll-y' | 'slide-x' | 'slide-x-r' | 'slide-y' | 'slide-y-r';
734
-
735
742
  type InsuredPolicyType = {
736
743
  insSum: number;
737
744
  insSumWithLoad: number;
@@ -755,4 +762,27 @@ declare global {
755
762
  };
756
763
 
757
764
  type ResponseStructure<T> = { code: 0; message: 'OK'; data: T };
765
+
766
+ type SignedState = {
767
+ isOnline: boolean;
768
+ signValue: number;
769
+ signName: string;
770
+ code: string;
771
+ };
772
+
773
+ namespace Utils {
774
+ type ProjectConfig = {
775
+ version: string;
776
+ buildTime: string;
777
+ isDown: boolean;
778
+ };
779
+
780
+ type VuetifyAnimations = 'expand' | 'fab' | 'fade' | 'scale' | 'scroll-x' | 'scroll-y' | 'slide-x' | 'slide-x-r' | 'slide-y' | 'slide-y-r';
781
+
782
+ type LabelSize = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;
783
+ }
784
+
785
+ namespace Dicts {
786
+ type WorkPosition = { workPositionClassCode: string; workPositionCode: string; workPositionName: string };
787
+ }
758
788
  }