@redneckz/wildless-cms-uni-blocks 0.14.636 → 0.14.637

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 (39) hide show
  1. package/bundle/api/RetailAPI/updateProfileEsia.d.ts +7 -7
  2. package/bundle/bundle.umd.js +54 -4
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +3 -0
  5. package/dist/api/RetailAPI/updateProfileEsia.d.ts +7 -7
  6. package/dist/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +3 -0
  7. package/dist/components/ApplicationLeadForm/pasreEsiaProfile.js +52 -0
  8. package/dist/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -0
  9. package/dist/components/ApplicationLeadForm/useInitApplicationLead.js +6 -3
  10. package/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  11. package/lib/api/RetailAPI/updateProfileEsia.d.ts +7 -7
  12. package/lib/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +3 -0
  13. package/lib/components/ApplicationLeadForm/pasreEsiaProfile.js +49 -0
  14. package/lib/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -0
  15. package/lib/components/ApplicationLeadForm/useInitApplicationLead.js +6 -3
  16. package/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  17. package/mobile/bundle/api/RetailAPI/updateProfileEsia.d.ts +7 -7
  18. package/mobile/bundle/bundle.umd.js +54 -4
  19. package/mobile/bundle/bundle.umd.min.js +1 -1
  20. package/mobile/bundle/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +3 -0
  21. package/mobile/dist/api/RetailAPI/updateProfileEsia.d.ts +7 -7
  22. package/mobile/dist/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +3 -0
  23. package/mobile/dist/components/ApplicationLeadForm/pasreEsiaProfile.js +52 -0
  24. package/mobile/dist/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -0
  25. package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js +6 -3
  26. package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  27. package/mobile/lib/api/RetailAPI/updateProfileEsia.d.ts +7 -7
  28. package/mobile/lib/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +3 -0
  29. package/mobile/lib/components/ApplicationLeadForm/pasreEsiaProfile.js +49 -0
  30. package/mobile/lib/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -0
  31. package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js +6 -3
  32. package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  33. package/mobile/src/api/RetailAPI/updateProfileEsia.ts +7 -7
  34. package/mobile/src/components/ApplicationLeadForm/pasreEsiaProfile.ts +69 -0
  35. package/mobile/src/components/ApplicationLeadForm/useInitApplicationLead.ts +8 -3
  36. package/package.json +1 -1
  37. package/src/api/RetailAPI/updateProfileEsia.ts +7 -7
  38. package/src/components/ApplicationLeadForm/pasreEsiaProfile.ts +69 -0
  39. package/src/components/ApplicationLeadForm/useInitApplicationLead.ts +8 -3
@@ -11,7 +11,7 @@ export declare type UpdateProfileEsiaResponse = {
11
11
  surname: string;
12
12
  name: string;
13
13
  midname: string;
14
- birthDate: string;
14
+ birthDate: Date;
15
15
  phone: string;
16
16
  email: string;
17
17
  esiaAccountType: {
@@ -39,11 +39,11 @@ export declare type UpdateProfileEsiaResponse = {
39
39
  value: string;
40
40
  };
41
41
  city: string;
42
- locality: null;
42
+ locality: string;
43
43
  street: string;
44
44
  house: string;
45
- building: null;
46
- block: null;
45
+ building: string;
46
+ block: string;
47
47
  apartment: string;
48
48
  };
49
49
  addressFact: {
@@ -55,11 +55,11 @@ export declare type UpdateProfileEsiaResponse = {
55
55
  value: string;
56
56
  };
57
57
  city: string;
58
- locality: null;
58
+ locality: string;
59
59
  street: string;
60
60
  house: string;
61
- building: null;
62
- block: null;
61
+ building: string;
62
+ block: string;
63
63
  apartment: string;
64
64
  };
65
65
  };
@@ -4105,10 +4105,58 @@
4105
4105
 
4106
4106
  const updateProfileEsia = (body) => doRequest('/esia/updateProfileEsia', 'POST', body);
4107
4107
 
4108
+ const parseEsiaProfile = (esiaProfile) => {
4109
+ const { profile, addInfo, document, addressRegistration, addressFact } = esiaProfile;
4110
+ return {
4111
+ name: profile?.name,
4112
+ surname: profile?.surname,
4113
+ middleName: profile?.midname,
4114
+ birthday: profile?.birthDate,
4115
+ phone: normalizePhone(profile?.phone),
4116
+ email: profile?.email,
4117
+ dulIssueDateField: document?.dulIssueDate,
4118
+ dulIssuedBy: document?.dulIssuedBy,
4119
+ dulNumber: document?.dulNumber,
4120
+ dulSerie: document?.dulSerie,
4121
+ dulSubdivisionCode: document?.dulSubdivisionCode,
4122
+ snils: addInfo?.snils,
4123
+ birthPlace: addInfo?.birthPlace,
4124
+ addressRegistration: buildAddress(addressRegistration),
4125
+ addressFact: buildAddress(addressFact),
4126
+ };
4127
+ };
4128
+ const concatFullAddress = (address) => {
4129
+ return address.reduce((acc, value) => {
4130
+ if (value) {
4131
+ return acc ? `${acc}, ${value}` : value;
4132
+ }
4133
+ return acc;
4134
+ }, '');
4135
+ };
4136
+ const buildAddress = (fields) => {
4137
+ const { postcode, region, regionCode, locality, city, street, house, building, block, apartment, } = fields;
4138
+ const place = locality || city;
4139
+ const fullAddress = concatFullAddress([
4140
+ postcode,
4141
+ region,
4142
+ place,
4143
+ street ? `ул ${street}` : undefined,
4144
+ house ? `д ${house}` : undefined,
4145
+ block ? `к ${block}` : undefined,
4146
+ building ? `стр ${building}` : undefined,
4147
+ apartment ? `кв ${apartment}` : undefined,
4148
+ ]);
4149
+ return {
4150
+ ...fields,
4151
+ regionCode: regionCode?.key,
4152
+ fullAddress,
4153
+ };
4154
+ };
4155
+
4108
4156
  const useInitApplicationLead = (nextStepLink) => {
4109
4157
  const [isLoading, setIsLoading] = useState(false);
4110
4158
  const [profileId] = useLocalStorage('profileId');
4111
- const [, setEsiaData] = useLocalStorage('esiaData');
4159
+ const [leadForm, setLeadForm] = useLocalStorage('leadForm');
4112
4160
  const params = new URLSearchParams(decodeURIComponent(globalThis.location?.search));
4113
4161
  const code = params.get('code');
4114
4162
  const state = params.get('state');
@@ -4120,7 +4168,10 @@
4120
4168
  state,
4121
4169
  redirectUri: globalThis.location?.href,
4122
4170
  });
4123
- setEsiaData(JSON.stringify(data));
4171
+ setLeadForm({
4172
+ ...leadForm,
4173
+ ...parseEsiaProfile(data),
4174
+ });
4124
4175
  globalThis.location.href = nextStepLink;
4125
4176
  }
4126
4177
  }, []);
@@ -4130,7 +4181,6 @@
4130
4181
  updateEsiaProfile();
4131
4182
  }
4132
4183
  else {
4133
- setEsiaData('');
4134
4184
  sessionStorage.removeItem('accessToken');
4135
4185
  sessionStorage.removeItem('refreshToken');
4136
4186
  }
@@ -8596,7 +8646,7 @@
8596
8646
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
8597
8647
  });
8598
8648
 
8599
- const packageVersion = "0.14.635";
8649
+ const packageVersion = "0.14.636";
8600
8650
 
8601
8651
  exports.Blocks = Blocks;
8602
8652
  exports.ContentPage = ContentPage;