@redneckz/wildless-cms-uni-blocks 0.14.691 → 0.14.692
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/bundle/api/dadataHints/dadataHintsType.d.ts +7 -1
- package/bundle/bundle.umd.js +40 -23
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/ui-kit/FormField/Fields/AddressField.d.ts +18 -0
- package/bundle/ui-kit/FormField/Fields/CurrencyField.d.ts +5 -0
- package/dist/api/dadataHints/dadataHintsType.d.ts +7 -1
- package/dist/components/CreditCardForm/getFourthStepData.js +1 -1
- package/dist/components/CreditCardForm/getFourthStepData.js.map +1 -1
- package/dist/components/CreditForm/getThirdStepData.js +1 -1
- package/dist/components/CreditForm/getThirdStepData.js.map +1 -1
- package/dist/ui-kit/ConsentBkiDialog/ConsentBkiDialog.js +1 -1
- package/dist/ui-kit/ConsentBkiDialog/ConsentBkiDialog.js.map +1 -1
- package/dist/ui-kit/EsiaLoginDialog/EsiaLoginDialog.js +11 -1
- package/dist/ui-kit/EsiaLoginDialog/EsiaLoginDialog.js.map +1 -1
- package/dist/ui-kit/FormField/Fields/AddressField.d.ts +18 -0
- package/dist/ui-kit/FormField/Fields/AddressField.js +20 -18
- package/dist/ui-kit/FormField/Fields/AddressField.js.map +1 -1
- package/dist/ui-kit/FormField/Fields/CurrencyField.d.ts +5 -0
- package/dist/ui-kit/FormField/Fields/CurrencyField.js +8 -2
- package/dist/ui-kit/FormField/Fields/CurrencyField.js.map +1 -1
- package/dist/ui-kit/FormField/Fields/InnField.js +2 -0
- package/dist/ui-kit/FormField/Fields/InnField.js.map +1 -1
- package/lib/api/dadataHints/dadataHintsType.d.ts +7 -1
- package/lib/components/CreditCardForm/getFourthStepData.js +1 -1
- package/lib/components/CreditCardForm/getFourthStepData.js.map +1 -1
- package/lib/components/CreditForm/getThirdStepData.js +1 -1
- package/lib/components/CreditForm/getThirdStepData.js.map +1 -1
- package/lib/ui-kit/ConsentBkiDialog/ConsentBkiDialog.js +1 -1
- package/lib/ui-kit/ConsentBkiDialog/ConsentBkiDialog.js.map +1 -1
- package/lib/ui-kit/EsiaLoginDialog/EsiaLoginDialog.js +11 -1
- package/lib/ui-kit/EsiaLoginDialog/EsiaLoginDialog.js.map +1 -1
- package/lib/ui-kit/FormField/Fields/AddressField.d.ts +18 -0
- package/lib/ui-kit/FormField/Fields/AddressField.js +18 -17
- package/lib/ui-kit/FormField/Fields/AddressField.js.map +1 -1
- package/lib/ui-kit/FormField/Fields/CurrencyField.d.ts +5 -0
- package/lib/ui-kit/FormField/Fields/CurrencyField.js +7 -1
- package/lib/ui-kit/FormField/Fields/CurrencyField.js.map +1 -1
- package/lib/ui-kit/FormField/Fields/InnField.js +2 -0
- package/lib/ui-kit/FormField/Fields/InnField.js.map +1 -1
- package/mobile/bundle/api/dadataHints/dadataHintsType.d.ts +7 -1
- package/mobile/bundle/bundle.umd.js +40 -23
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/ui-kit/FormField/Fields/AddressField.d.ts +18 -0
- package/mobile/bundle/ui-kit/FormField/Fields/CurrencyField.d.ts +5 -0
- package/mobile/dist/api/dadataHints/dadataHintsType.d.ts +7 -1
- package/mobile/dist/components/CreditCardForm/getFourthStepData.js +1 -1
- package/mobile/dist/components/CreditCardForm/getFourthStepData.js.map +1 -1
- package/mobile/dist/components/CreditForm/getThirdStepData.js +1 -1
- package/mobile/dist/components/CreditForm/getThirdStepData.js.map +1 -1
- package/mobile/dist/ui-kit/ConsentBkiDialog/ConsentBkiDialog.js +1 -1
- package/mobile/dist/ui-kit/ConsentBkiDialog/ConsentBkiDialog.js.map +1 -1
- package/mobile/dist/ui-kit/EsiaLoginDialog/EsiaLoginDialog.js +11 -1
- package/mobile/dist/ui-kit/EsiaLoginDialog/EsiaLoginDialog.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/AddressField.d.ts +18 -0
- package/mobile/dist/ui-kit/FormField/Fields/AddressField.js +20 -18
- package/mobile/dist/ui-kit/FormField/Fields/AddressField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/CurrencyField.d.ts +5 -0
- package/mobile/dist/ui-kit/FormField/Fields/CurrencyField.js +8 -2
- package/mobile/dist/ui-kit/FormField/Fields/CurrencyField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/InnField.js +2 -0
- package/mobile/dist/ui-kit/FormField/Fields/InnField.js.map +1 -1
- package/mobile/lib/api/dadataHints/dadataHintsType.d.ts +7 -1
- package/mobile/lib/components/CreditCardForm/getFourthStepData.js +1 -1
- package/mobile/lib/components/CreditCardForm/getFourthStepData.js.map +1 -1
- package/mobile/lib/components/CreditForm/getThirdStepData.js +1 -1
- package/mobile/lib/components/CreditForm/getThirdStepData.js.map +1 -1
- package/mobile/lib/ui-kit/ConsentBkiDialog/ConsentBkiDialog.js +1 -1
- package/mobile/lib/ui-kit/ConsentBkiDialog/ConsentBkiDialog.js.map +1 -1
- package/mobile/lib/ui-kit/EsiaLoginDialog/EsiaLoginDialog.js +11 -1
- package/mobile/lib/ui-kit/EsiaLoginDialog/EsiaLoginDialog.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/AddressField.d.ts +18 -0
- package/mobile/lib/ui-kit/FormField/Fields/AddressField.js +18 -17
- package/mobile/lib/ui-kit/FormField/Fields/AddressField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/CurrencyField.d.ts +5 -0
- package/mobile/lib/ui-kit/FormField/Fields/CurrencyField.js +7 -1
- package/mobile/lib/ui-kit/FormField/Fields/CurrencyField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/InnField.js +2 -0
- package/mobile/lib/ui-kit/FormField/Fields/InnField.js.map +1 -1
- package/mobile/src/api/dadataHints/dadataHintsType.ts +8 -1
- package/mobile/src/components/CreditCardForm/getFourthStepData.ts +1 -1
- package/mobile/src/components/CreditForm/getThirdStepData.ts +1 -1
- package/mobile/src/ui-kit/ConsentBkiDialog/ConsentBkiDialog.tsx +1 -1
- package/mobile/src/ui-kit/EsiaLoginDialog/EsiaLoginDialog.tsx +14 -2
- package/mobile/src/ui-kit/FormField/Fields/AddressField.tsx +19 -17
- package/mobile/src/ui-kit/FormField/Fields/CurrencyField.tsx +7 -1
- package/mobile/src/ui-kit/FormField/Fields/InnField.tsx +4 -0
- package/package.json +1 -1
- package/src/api/dadataHints/dadataHintsType.ts +8 -1
- package/src/components/CreditCardForm/getFourthStepData.ts +1 -1
- package/src/components/CreditForm/getThirdStepData.ts +1 -1
- package/src/ui-kit/ConsentBkiDialog/ConsentBkiDialog.tsx +1 -1
- package/src/ui-kit/EsiaLoginDialog/EsiaLoginDialog.tsx +14 -2
- package/src/ui-kit/FormField/Fields/AddressField.tsx +19 -17
- package/src/ui-kit/FormField/Fields/CurrencyField.tsx +7 -1
- package/src/ui-kit/FormField/Fields/InnField.tsx +4 -0
|
@@ -4,8 +4,10 @@ import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
|
|
|
4
4
|
import { InputControl } from '../../Input/InputControl.js';
|
|
5
5
|
import { validatorObj } from '../getObjectValidator.js';
|
|
6
6
|
import { getValidation } from '../getValidation.js';
|
|
7
|
+
import { getAddressFromDaDataItem } from './AddressField.js';
|
|
7
8
|
export const InnField = JSX(({ field, input }) => {
|
|
8
9
|
const onDaDataChange = useCallback((item) => {
|
|
10
|
+
field?.('organizationAddress')?.onChange?.(getAddressFromDaDataItem(item.data?.address));
|
|
9
11
|
field?.('organizationName')?.onChange?.(item.data?.name?.short_with_opf);
|
|
10
12
|
field?.('legalForm')?.onChange?.(item.data?.opf?.short);
|
|
11
13
|
}, []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InnField.js","sourceRoot":"","sources":["../../../../src/ui-kit/FormField/Fields/InnField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"InnField.js","sourceRoot":"","sources":["../../../../src/ui-kit/FormField/Fields/InnField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,CAAmB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;IACjE,MAAM,cAAc,GAAG,WAAW,CAAC,CAAC,IAAsB,EAAE,EAAE;QAC5D,KAAK,EAAE,CAAC,qBAAqB,CAAC,EAAE,QAAQ,EAAE,CACxC,wBAAwB,CAAC,IAAI,CAAC,IAAI,EAAE,OAA2B,CAAC,CACjE,CAAC;QACF,KAAK,EAAE,CAAC,kBAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;QACzE,KAAK,EAAE,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC1D,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,KAAC,YAAY,IACX,KAAK,EAAC,oBAAK,EACX,SAAS,EAAE,IAAI,EACf,SAAS,EAAE,EAAE,KACT,KAAK,KACL,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,EAClE,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -10,12 +10,14 @@ export interface DaDataSuggestion {
|
|
|
10
10
|
|
|
11
11
|
type DaDataGender = 'MALE' | 'FEMALE' | 'UNKNOWN';
|
|
12
12
|
|
|
13
|
+
type DaDataQC = '0' | '1';
|
|
14
|
+
|
|
13
15
|
interface DaDataFio {
|
|
14
16
|
surname: Nullable<string>;
|
|
15
17
|
name: Nullable<string>;
|
|
16
18
|
patronymic: Nullable<string>;
|
|
17
19
|
gender: DaDataGender;
|
|
18
|
-
qc:
|
|
20
|
+
qc: DaDataQC;
|
|
19
21
|
source: null;
|
|
20
22
|
}
|
|
21
23
|
|
|
@@ -30,6 +32,10 @@ interface DaDataPassportFms {
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
interface DaDataOrganization {
|
|
35
|
+
address: {
|
|
36
|
+
data: DaDataAddress;
|
|
37
|
+
value: string;
|
|
38
|
+
};
|
|
33
39
|
inn: string;
|
|
34
40
|
name: {
|
|
35
41
|
short_with_opf: string;
|
|
@@ -52,6 +58,7 @@ export interface DaDataAddress {
|
|
|
52
58
|
settlement_with_type: Nullable<string>;
|
|
53
59
|
street: Nullable<string>;
|
|
54
60
|
fias_code: string;
|
|
61
|
+
qc: DaDataQC;
|
|
55
62
|
qc_complete: Nullable<string>;
|
|
56
63
|
qc_house: Nullable<string>;
|
|
57
64
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { getLink } from '../../api/RetailAPI/getLink';
|
|
4
|
+
import { type FormState } from '../../components/ApplicationLeadForm/getInitialFormState';
|
|
4
5
|
import { locationNavigator } from '../../external/locationNavigator';
|
|
6
|
+
import { useLocalStorage } from '../../hooks/useLocalStorage';
|
|
5
7
|
import { Button } from '../Button/Button';
|
|
6
8
|
import { Dialog } from '../DialogManager/Dialog';
|
|
7
9
|
import { Img } from '../Img/Img';
|
|
@@ -12,6 +14,7 @@ export interface EsiaLoginDialogProps {
|
|
|
12
14
|
|
|
13
15
|
export const EsiaLoginDialog = JSX<EsiaLoginDialogProps>(({ onClose }) => {
|
|
14
16
|
const navigator = locationNavigator();
|
|
17
|
+
const [leadForm, setLeadForm] = useLocalStorage<FormState>('leadForm');
|
|
15
18
|
const handleAuth = useCallback(async () => {
|
|
16
19
|
const resp = await getLink({
|
|
17
20
|
redirectUri: navigator.href,
|
|
@@ -22,8 +25,17 @@ export const EsiaLoginDialog = JSX<EsiaLoginDialogProps>(({ onClose }) => {
|
|
|
22
25
|
}
|
|
23
26
|
}, []);
|
|
24
27
|
|
|
28
|
+
const handleClose = useCallback(() => {
|
|
29
|
+
if (leadForm !== null) {
|
|
30
|
+
const leadFormCopy = { ...leadForm };
|
|
31
|
+
Reflect.deleteProperty(leadFormCopy, 'esiaAccountTypeCd');
|
|
32
|
+
setLeadForm(leadFormCopy);
|
|
33
|
+
}
|
|
34
|
+
onClose?.();
|
|
35
|
+
}, []);
|
|
36
|
+
|
|
25
37
|
return (
|
|
26
|
-
<Dialog className="my-6xl max-w-lg w-full min-h-fit mx-auto rounded-lg" onClose={
|
|
38
|
+
<Dialog className="my-6xl max-w-lg w-full min-h-fit mx-auto rounded-lg" onClose={handleClose}>
|
|
27
39
|
<div className="flex flex-col gap-lg items-center rounded-md">
|
|
28
40
|
<div className="flex items-center justify-around w-full">
|
|
29
41
|
<ul className="list-disc">
|
|
@@ -37,7 +49,7 @@ export const EsiaLoginDialog = JSX<EsiaLoginDialogProps>(({ onClose }) => {
|
|
|
37
49
|
<Button type="button" onClick={handleAuth}>
|
|
38
50
|
Заполнить через Госуслуги
|
|
39
51
|
</Button>
|
|
40
|
-
<Button type="button" version="secondary" onClick={
|
|
52
|
+
<Button type="button" version="secondary" onClick={handleClose}>
|
|
41
53
|
Пропустить
|
|
42
54
|
</Button>
|
|
43
55
|
</div>
|
|
@@ -12,23 +12,7 @@ export const AddressField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
|
12
12
|
const fieldValue = field(fieldName).value;
|
|
13
13
|
|
|
14
14
|
const onDaDataChange = useCallback((item: DaDataSuggestion) => {
|
|
15
|
-
field?.(fieldName)?.onChange?.(
|
|
16
|
-
apartment: item?.data?.flat,
|
|
17
|
-
city: item?.data?.city,
|
|
18
|
-
district: item?.data?.area_with_type,
|
|
19
|
-
fullAddress: item?.value,
|
|
20
|
-
fiasCode: item?.data?.fias_id,
|
|
21
|
-
house: item?.data?.house,
|
|
22
|
-
locality: item?.data?.settlement_with_type,
|
|
23
|
-
okatoRegionCode: item?.data?.okato,
|
|
24
|
-
postcode: item?.data?.postal_code,
|
|
25
|
-
region: item?.data?.region,
|
|
26
|
-
regionCode: item?.data?.region_kladr_id ? item?.data?.region_kladr_id.substring(0, 2) : '',
|
|
27
|
-
street: item?.data?.house,
|
|
28
|
-
qc: item?.data?.qc,
|
|
29
|
-
qcComplete: item?.data?.qc_complete,
|
|
30
|
-
qcHouse: item?.data?.qc_house,
|
|
31
|
-
});
|
|
15
|
+
field?.(fieldName)?.onChange?.(getAddressFromDaDataItem(item));
|
|
32
16
|
}, []);
|
|
33
17
|
|
|
34
18
|
const onChange = useCallback((value: string) => {
|
|
@@ -63,3 +47,21 @@ export const AddressField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
|
63
47
|
/>
|
|
64
48
|
);
|
|
65
49
|
});
|
|
50
|
+
|
|
51
|
+
export const getAddressFromDaDataItem = (item?: DaDataSuggestion) => ({
|
|
52
|
+
apartment: item?.data?.flat,
|
|
53
|
+
city: item?.data?.city,
|
|
54
|
+
district: item?.data?.area_with_type,
|
|
55
|
+
fullAddress: item?.value,
|
|
56
|
+
fiasCode: item?.data?.fias_id,
|
|
57
|
+
house: item?.data?.house,
|
|
58
|
+
locality: item?.data?.settlement_with_type,
|
|
59
|
+
okatoRegionCode: item?.data?.okato,
|
|
60
|
+
postcode: item?.data?.postal_code,
|
|
61
|
+
region: item?.data?.region,
|
|
62
|
+
regionCode: item?.data?.region_kladr_id ? item?.data?.region_kladr_id.substring(0, 2) : '',
|
|
63
|
+
street: item?.data?.house,
|
|
64
|
+
qc: item?.data?.qc,
|
|
65
|
+
qcComplete: item?.data?.qc_complete,
|
|
66
|
+
qcHouse: item?.data?.qc_house,
|
|
67
|
+
});
|
|
@@ -5,7 +5,13 @@ import { type CustomFieldProps } from '../CustomFieldProps';
|
|
|
5
5
|
import { validatorObj } from '../getObjectValidator';
|
|
6
6
|
import { getValidation } from '../getValidation';
|
|
7
7
|
|
|
8
|
-
export
|
|
8
|
+
export enum CurrencyCode {
|
|
9
|
+
'rub' = '810',
|
|
10
|
+
'dollar' = '840',
|
|
11
|
+
'euro' = '978',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const CURRENCY_TYPES: RadioButtonItem[] = [{ id: CurrencyCode.rub, text: 'Рубль' }];
|
|
9
15
|
|
|
10
16
|
export const CurrencyField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
11
17
|
const { value, onChange } = field('currency');
|
|
@@ -5,9 +5,13 @@ import { InputControl } from '../../Input/InputControl';
|
|
|
5
5
|
import { type CustomFieldProps } from '../CustomFieldProps';
|
|
6
6
|
import { validatorObj } from '../getObjectValidator';
|
|
7
7
|
import { getValidation } from '../getValidation';
|
|
8
|
+
import { getAddressFromDaDataItem } from './AddressField';
|
|
8
9
|
|
|
9
10
|
export const InnField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
10
11
|
const onDaDataChange = useCallback((item: DaDataSuggestion) => {
|
|
12
|
+
field?.('organizationAddress')?.onChange?.(
|
|
13
|
+
getAddressFromDaDataItem(item.data?.address as DaDataSuggestion),
|
|
14
|
+
);
|
|
11
15
|
field?.('organizationName')?.onChange?.(item.data?.name?.short_with_opf);
|
|
12
16
|
field?.('legalForm')?.onChange?.(item.data?.opf?.short);
|
|
13
17
|
}, []);
|
package/package.json
CHANGED
|
@@ -10,12 +10,14 @@ export interface DaDataSuggestion {
|
|
|
10
10
|
|
|
11
11
|
type DaDataGender = 'MALE' | 'FEMALE' | 'UNKNOWN';
|
|
12
12
|
|
|
13
|
+
type DaDataQC = '0' | '1';
|
|
14
|
+
|
|
13
15
|
interface DaDataFio {
|
|
14
16
|
surname: Nullable<string>;
|
|
15
17
|
name: Nullable<string>;
|
|
16
18
|
patronymic: Nullable<string>;
|
|
17
19
|
gender: DaDataGender;
|
|
18
|
-
qc:
|
|
20
|
+
qc: DaDataQC;
|
|
19
21
|
source: null;
|
|
20
22
|
}
|
|
21
23
|
|
|
@@ -30,6 +32,10 @@ interface DaDataPassportFms {
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
interface DaDataOrganization {
|
|
35
|
+
address: {
|
|
36
|
+
data: DaDataAddress;
|
|
37
|
+
value: string;
|
|
38
|
+
};
|
|
33
39
|
inn: string;
|
|
34
40
|
name: {
|
|
35
41
|
short_with_opf: string;
|
|
@@ -52,6 +58,7 @@ export interface DaDataAddress {
|
|
|
52
58
|
settlement_with_type: Nullable<string>;
|
|
53
59
|
street: Nullable<string>;
|
|
54
60
|
fias_code: string;
|
|
61
|
+
qc: DaDataQC;
|
|
55
62
|
qc_complete: Nullable<string>;
|
|
56
63
|
qc_house: Nullable<string>;
|
|
57
64
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { getLink } from '../../api/RetailAPI/getLink';
|
|
4
|
+
import { type FormState } from '../../components/ApplicationLeadForm/getInitialFormState';
|
|
4
5
|
import { locationNavigator } from '../../external/locationNavigator';
|
|
6
|
+
import { useLocalStorage } from '../../hooks/useLocalStorage';
|
|
5
7
|
import { Button } from '../Button/Button';
|
|
6
8
|
import { Dialog } from '../DialogManager/Dialog';
|
|
7
9
|
import { Img } from '../Img/Img';
|
|
@@ -12,6 +14,7 @@ export interface EsiaLoginDialogProps {
|
|
|
12
14
|
|
|
13
15
|
export const EsiaLoginDialog = JSX<EsiaLoginDialogProps>(({ onClose }) => {
|
|
14
16
|
const navigator = locationNavigator();
|
|
17
|
+
const [leadForm, setLeadForm] = useLocalStorage<FormState>('leadForm');
|
|
15
18
|
const handleAuth = useCallback(async () => {
|
|
16
19
|
const resp = await getLink({
|
|
17
20
|
redirectUri: navigator.href,
|
|
@@ -22,8 +25,17 @@ export const EsiaLoginDialog = JSX<EsiaLoginDialogProps>(({ onClose }) => {
|
|
|
22
25
|
}
|
|
23
26
|
}, []);
|
|
24
27
|
|
|
28
|
+
const handleClose = useCallback(() => {
|
|
29
|
+
if (leadForm !== null) {
|
|
30
|
+
const leadFormCopy = { ...leadForm };
|
|
31
|
+
Reflect.deleteProperty(leadFormCopy, 'esiaAccountTypeCd');
|
|
32
|
+
setLeadForm(leadFormCopy);
|
|
33
|
+
}
|
|
34
|
+
onClose?.();
|
|
35
|
+
}, []);
|
|
36
|
+
|
|
25
37
|
return (
|
|
26
|
-
<Dialog className="my-6xl max-w-lg w-full min-h-fit mx-auto rounded-lg" onClose={
|
|
38
|
+
<Dialog className="my-6xl max-w-lg w-full min-h-fit mx-auto rounded-lg" onClose={handleClose}>
|
|
27
39
|
<div className="flex flex-col gap-lg items-center rounded-md">
|
|
28
40
|
<div className="flex items-center justify-around w-full">
|
|
29
41
|
<ul className="list-disc">
|
|
@@ -37,7 +49,7 @@ export const EsiaLoginDialog = JSX<EsiaLoginDialogProps>(({ onClose }) => {
|
|
|
37
49
|
<Button type="button" onClick={handleAuth}>
|
|
38
50
|
Заполнить через Госуслуги
|
|
39
51
|
</Button>
|
|
40
|
-
<Button type="button" version="secondary" onClick={
|
|
52
|
+
<Button type="button" version="secondary" onClick={handleClose}>
|
|
41
53
|
Пропустить
|
|
42
54
|
</Button>
|
|
43
55
|
</div>
|
|
@@ -12,23 +12,7 @@ export const AddressField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
|
12
12
|
const fieldValue = field(fieldName).value;
|
|
13
13
|
|
|
14
14
|
const onDaDataChange = useCallback((item: DaDataSuggestion) => {
|
|
15
|
-
field?.(fieldName)?.onChange?.(
|
|
16
|
-
apartment: item?.data?.flat,
|
|
17
|
-
city: item?.data?.city,
|
|
18
|
-
district: item?.data?.area_with_type,
|
|
19
|
-
fullAddress: item?.value,
|
|
20
|
-
fiasCode: item?.data?.fias_id,
|
|
21
|
-
house: item?.data?.house,
|
|
22
|
-
locality: item?.data?.settlement_with_type,
|
|
23
|
-
okatoRegionCode: item?.data?.okato,
|
|
24
|
-
postcode: item?.data?.postal_code,
|
|
25
|
-
region: item?.data?.region,
|
|
26
|
-
regionCode: item?.data?.region_kladr_id ? item?.data?.region_kladr_id.substring(0, 2) : '',
|
|
27
|
-
street: item?.data?.house,
|
|
28
|
-
qc: item?.data?.qc,
|
|
29
|
-
qcComplete: item?.data?.qc_complete,
|
|
30
|
-
qcHouse: item?.data?.qc_house,
|
|
31
|
-
});
|
|
15
|
+
field?.(fieldName)?.onChange?.(getAddressFromDaDataItem(item));
|
|
32
16
|
}, []);
|
|
33
17
|
|
|
34
18
|
const onChange = useCallback((value: string) => {
|
|
@@ -63,3 +47,21 @@ export const AddressField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
|
63
47
|
/>
|
|
64
48
|
);
|
|
65
49
|
});
|
|
50
|
+
|
|
51
|
+
export const getAddressFromDaDataItem = (item?: DaDataSuggestion) => ({
|
|
52
|
+
apartment: item?.data?.flat,
|
|
53
|
+
city: item?.data?.city,
|
|
54
|
+
district: item?.data?.area_with_type,
|
|
55
|
+
fullAddress: item?.value,
|
|
56
|
+
fiasCode: item?.data?.fias_id,
|
|
57
|
+
house: item?.data?.house,
|
|
58
|
+
locality: item?.data?.settlement_with_type,
|
|
59
|
+
okatoRegionCode: item?.data?.okato,
|
|
60
|
+
postcode: item?.data?.postal_code,
|
|
61
|
+
region: item?.data?.region,
|
|
62
|
+
regionCode: item?.data?.region_kladr_id ? item?.data?.region_kladr_id.substring(0, 2) : '',
|
|
63
|
+
street: item?.data?.house,
|
|
64
|
+
qc: item?.data?.qc,
|
|
65
|
+
qcComplete: item?.data?.qc_complete,
|
|
66
|
+
qcHouse: item?.data?.qc_house,
|
|
67
|
+
});
|
|
@@ -5,7 +5,13 @@ import { type CustomFieldProps } from '../CustomFieldProps';
|
|
|
5
5
|
import { validatorObj } from '../getObjectValidator';
|
|
6
6
|
import { getValidation } from '../getValidation';
|
|
7
7
|
|
|
8
|
-
export
|
|
8
|
+
export enum CurrencyCode {
|
|
9
|
+
'rub' = '810',
|
|
10
|
+
'dollar' = '840',
|
|
11
|
+
'euro' = '978',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const CURRENCY_TYPES: RadioButtonItem[] = [{ id: CurrencyCode.rub, text: 'Рубль' }];
|
|
9
15
|
|
|
10
16
|
export const CurrencyField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
11
17
|
const { value, onChange } = field('currency');
|
|
@@ -5,9 +5,13 @@ import { InputControl } from '../../Input/InputControl';
|
|
|
5
5
|
import { type CustomFieldProps } from '../CustomFieldProps';
|
|
6
6
|
import { validatorObj } from '../getObjectValidator';
|
|
7
7
|
import { getValidation } from '../getValidation';
|
|
8
|
+
import { getAddressFromDaDataItem } from './AddressField';
|
|
8
9
|
|
|
9
10
|
export const InnField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
10
11
|
const onDaDataChange = useCallback((item: DaDataSuggestion) => {
|
|
12
|
+
field?.('organizationAddress')?.onChange?.(
|
|
13
|
+
getAddressFromDaDataItem(item.data?.address as DaDataSuggestion),
|
|
14
|
+
);
|
|
11
15
|
field?.('organizationName')?.onChange?.(item.data?.name?.short_with_opf);
|
|
12
16
|
field?.('legalForm')?.onChange?.(item.data?.opf?.short);
|
|
13
17
|
}, []);
|