@redneckz/wildless-cms-uni-blocks 0.14.569 → 0.14.571
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/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +80 -53
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
- package/bundle/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
- package/bundle/hooks/useLocalStorage.d.ts +1 -0
- package/bundle/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
- package/bundle/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
- package/dist/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
- package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +3 -5
- package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/dist/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
- package/dist/hooks/useLocalStorage.d.ts +1 -0
- package/dist/hooks/useLocalStorage.js +13 -0
- package/dist/hooks/useLocalStorage.js.map +1 -0
- package/dist/ui-kit/Checkbox/CheckboxGroup.js +2 -1
- package/dist/ui-kit/Checkbox/CheckboxGroup.js.map +1 -1
- package/dist/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
- package/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
- package/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.js +26 -0
- package/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.js.map +1 -0
- package/dist/ui-kit/FormField/getField.js +2 -0
- package/dist/ui-kit/FormField/getField.js.map +1 -1
- package/dist/ui-kit/FormField/getObjectValidator.js +1 -0
- package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/lib/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
- package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +3 -5
- package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/lib/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
- package/lib/components/ApplicationLeadForm/renderAgreementSubmit.d.ts +1 -0
- package/lib/hooks/useLocalStorage.d.ts +1 -0
- package/lib/hooks/useLocalStorage.js +10 -0
- package/lib/hooks/useLocalStorage.js.map +1 -0
- package/lib/ui-kit/Checkbox/CheckboxGroup.js +2 -1
- package/lib/ui-kit/Checkbox/CheckboxGroup.js.map +1 -1
- package/lib/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
- package/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
- package/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.js +24 -0
- package/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.js.map +1 -0
- package/lib/ui-kit/FormField/getField.js +2 -0
- package/lib/ui-kit/FormField/getField.js.map +1 -1
- package/lib/ui-kit/FormField/getObjectValidator.js +1 -0
- package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +80 -53
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
- package/mobile/bundle/hooks/useLocalStorage.d.ts +1 -0
- package/mobile/bundle/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
- package/mobile/bundle/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
- package/mobile/dist/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
- package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +3 -5
- package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
- package/mobile/dist/hooks/useLocalStorage.d.ts +1 -0
- package/mobile/dist/hooks/useLocalStorage.js +13 -0
- package/mobile/dist/hooks/useLocalStorage.js.map +1 -0
- package/mobile/dist/ui-kit/Checkbox/CheckboxGroup.js +2 -1
- package/mobile/dist/ui-kit/Checkbox/CheckboxGroup.js.map +1 -1
- package/mobile/dist/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
- package/mobile/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.js +26 -0
- package/mobile/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.js.map +1 -0
- package/mobile/dist/ui-kit/FormField/getField.js +2 -0
- package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js +1 -0
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/lib/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
- package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +3 -5
- package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
- package/mobile/lib/hooks/useLocalStorage.d.ts +1 -0
- package/mobile/lib/hooks/useLocalStorage.js +10 -0
- package/mobile/lib/hooks/useLocalStorage.js.map +1 -0
- package/mobile/lib/ui-kit/Checkbox/CheckboxGroup.js +2 -1
- package/mobile/lib/ui-kit/Checkbox/CheckboxGroup.js.map +1 -1
- package/mobile/lib/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
- package/mobile/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.js +24 -0
- package/mobile/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.js.map +1 -0
- package/mobile/lib/ui-kit/FormField/getField.js +2 -0
- package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js +1 -0
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/src/components/ApplicationForm/ApplicationFormContent.ts +2 -1
- package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.example.json +6 -856
- package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +3 -9
- package/mobile/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +2 -1
- package/mobile/src/hooks/useLocalStorage.ts +17 -0
- package/mobile/src/ui-kit/Checkbox/CheckboxGroup.tsx +7 -1
- package/mobile/src/ui-kit/Checkbox/CheckboxProps.ts +1 -1
- package/mobile/src/ui-kit/FormField/Fields/ConsentToAllDocsField.tsx +29 -0
- package/mobile/src/ui-kit/FormField/getField.tsx +2 -0
- package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +1 -0
- package/package.json +1 -1
- package/src/components/ApplicationForm/ApplicationFormContent.ts +2 -1
- package/src/components/ApplicationLeadForm/ApplicationLeadForm.example.json +6 -856
- package/src/components/ApplicationLeadForm/ApplicationLeadForm.fixture.mobile.tsx +8 -10
- package/src/components/ApplicationLeadForm/ApplicationLeadForm.fixture.tsx +7 -10
- package/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +3 -9
- package/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +2 -1
- package/src/hooks/useLocalStorage.ts +17 -0
- package/src/ui-kit/Checkbox/CheckboxGroup.tsx +7 -1
- package/src/ui-kit/Checkbox/CheckboxProps.ts +1 -1
- package/src/ui-kit/FormField/Fields/ConsentToAllDocsField.tsx +29 -0
- package/src/ui-kit/FormField/getField.tsx +2 -0
- package/src/ui-kit/FormField/getObjectValidator.tsx +1 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import '../../setup-fixture';
|
|
2
|
-
|
|
3
|
-
import { type LinkProps } from '../../model/LinkProps';
|
|
2
|
+
import { DialogManager } from '../../ui-kit/DialogManager/DialogManager';
|
|
4
3
|
import { PopupManager } from '../../ui-kit/PopupManager/PopupManager';
|
|
5
4
|
import { ApplicationLeadForm } from './ApplicationLeadForm';
|
|
6
5
|
import { type SubmitButtonProps } from './ApplicationLeadFormContent';
|
|
@@ -10,12 +9,6 @@ const button: SubmitButtonProps = {
|
|
|
10
9
|
version: 'primary',
|
|
11
10
|
};
|
|
12
11
|
|
|
13
|
-
const link: LinkProps = {
|
|
14
|
-
text: 'Согласен на обработку персональных данных',
|
|
15
|
-
href: '/privacy-policy',
|
|
16
|
-
target: '_blank',
|
|
17
|
-
};
|
|
18
|
-
|
|
19
12
|
export default {
|
|
20
13
|
default: (
|
|
21
14
|
<div className="container grid grid-cols-12">
|
|
@@ -26,17 +19,22 @@ export default {
|
|
|
26
19
|
endpoint="lead"
|
|
27
20
|
sections={[
|
|
28
21
|
{
|
|
22
|
+
columns: 2,
|
|
29
23
|
inputs: [
|
|
24
|
+
{ fieldType: 'common', name: 'surname', required: true },
|
|
30
25
|
{ fieldType: 'common', name: 'name', required: true },
|
|
31
26
|
{ fieldType: 'common', name: 'middleName' },
|
|
32
|
-
{ fieldType: 'common', name: '
|
|
27
|
+
{ fieldType: 'common', name: 'birthday', required: true },
|
|
28
|
+
{ fieldType: 'common', name: 'phone', required: true },
|
|
29
|
+
{ fieldType: 'common', name: 'email', required: true },
|
|
33
30
|
],
|
|
34
31
|
},
|
|
32
|
+
{ inputs: [{ fieldType: 'common', name: 'consentToAllDocs', required: true }] },
|
|
35
33
|
]}
|
|
36
34
|
button={button}
|
|
37
|
-
link={link}
|
|
38
35
|
/>
|
|
39
36
|
<PopupManager />
|
|
37
|
+
<DialogManager />
|
|
40
38
|
</div>
|
|
41
39
|
),
|
|
42
40
|
};
|
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
import '../../setup-fixture';
|
|
2
2
|
|
|
3
|
-
import { type LinkProps } from '../../model/LinkProps';
|
|
4
3
|
import { DialogManager } from '../../ui-kit/DialogManager/DialogManager';
|
|
5
4
|
import { PopupManager } from '../../ui-kit/PopupManager/PopupManager';
|
|
6
5
|
import { ApplicationLeadForm } from './ApplicationLeadForm';
|
|
7
6
|
import { type SubmitButtonProps } from './ApplicationLeadFormContent';
|
|
8
7
|
|
|
9
8
|
const button: SubmitButtonProps = {
|
|
10
|
-
text: '
|
|
9
|
+
text: 'Оформить',
|
|
11
10
|
version: 'primary',
|
|
12
11
|
};
|
|
13
12
|
|
|
14
|
-
const link: LinkProps = {
|
|
15
|
-
text: 'Согласен на обработку персональных данных',
|
|
16
|
-
href: '/privacy-policy',
|
|
17
|
-
target: '_blank',
|
|
18
|
-
};
|
|
19
|
-
|
|
20
13
|
export default {
|
|
21
14
|
default: (
|
|
22
15
|
<div className="container grid grid-cols-12">
|
|
@@ -27,15 +20,19 @@ export default {
|
|
|
27
20
|
endpoint="lead"
|
|
28
21
|
sections={[
|
|
29
22
|
{
|
|
23
|
+
columns: 2,
|
|
30
24
|
inputs: [
|
|
25
|
+
{ fieldType: 'common', name: 'surname', required: true },
|
|
31
26
|
{ fieldType: 'common', name: 'name', required: true },
|
|
32
27
|
{ fieldType: 'common', name: 'middleName' },
|
|
33
|
-
{ fieldType: 'common', name: '
|
|
28
|
+
{ fieldType: 'common', name: 'birthday', required: true },
|
|
29
|
+
{ fieldType: 'common', name: 'phone', required: true },
|
|
30
|
+
{ fieldType: 'common', name: 'email', required: true },
|
|
34
31
|
],
|
|
35
32
|
},
|
|
33
|
+
{ inputs: [{ fieldType: 'common', name: 'consentToAllDocs', required: true }] },
|
|
36
34
|
]}
|
|
37
35
|
button={button}
|
|
38
|
-
link={link}
|
|
39
36
|
/>
|
|
40
37
|
<PopupManager />
|
|
41
38
|
<DialogManager />
|
|
@@ -3,7 +3,6 @@ import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
|
3
3
|
import { LeadServiceAPI } from '../../api/LeadServiceAPI';
|
|
4
4
|
import { useForm } from '../../hooks/useForm';
|
|
5
5
|
import { ApplicationFormLayout } from '../../ui-kit/ApplicationFormLayout/ApplicationFormLayout';
|
|
6
|
-
import { getConsentDataProcessing } from '../../ui-kit/FormField/getConsentDataProcessing';
|
|
7
6
|
import { getField } from '../../ui-kit/FormField/getField';
|
|
8
7
|
import { getObjectValidator } from '../../ui-kit/FormField/getObjectValidator';
|
|
9
8
|
import { inputColumnStyles } from '../../ui-kit/FormField/inputColumnStyle';
|
|
@@ -16,7 +15,7 @@ import { isValidationSuccess } from '../../validation/validator';
|
|
|
16
15
|
import { type ApplicationLeadFormContent, type FieldDef } from './ApplicationLeadFormContent';
|
|
17
16
|
import { getFormatData } from './getFormatData';
|
|
18
17
|
import { getInitialFormState, type FormState } from './getInitialFormState';
|
|
19
|
-
import {
|
|
18
|
+
import { renderSubmitButton } from './renderSubmitButton';
|
|
20
19
|
|
|
21
20
|
interface ApplicationLeadFormProps extends ApplicationLeadFormContent, UniBlockProps {}
|
|
22
21
|
|
|
@@ -24,7 +23,7 @@ const API = LeadServiceAPI();
|
|
|
24
23
|
|
|
25
24
|
export const ApplicationLeadForm = JSX<ApplicationLeadFormProps>(
|
|
26
25
|
// eslint-disable-next-line max-lines-per-function
|
|
27
|
-
({ className, title, typeForm = '', sections = [], button,
|
|
26
|
+
({ className, title, typeForm = '', sections = [], button, endpoint, ...rest }) => {
|
|
28
27
|
const inputs = (sections?.flatMap((_) => _?.inputs) || []) as FieldDef[];
|
|
29
28
|
const initialFormState = getInitialFormState(inputs, typeForm);
|
|
30
29
|
const [responseType, setResponseType] = useState<'OK' | 'Fail' | ''>('');
|
|
@@ -46,7 +45,6 @@ export const ApplicationLeadForm = JSX<ApplicationLeadFormProps>(
|
|
|
46
45
|
}, []);
|
|
47
46
|
|
|
48
47
|
const [, { field, onSubmit, reset }] = useForm(initialFormState, { onSubmit: handleSubmit });
|
|
49
|
-
const fieldName = getConsentDataProcessing(inputs)?.name;
|
|
50
48
|
|
|
51
49
|
useEffect(() => {
|
|
52
50
|
if (responseType === 'OK') {
|
|
@@ -71,11 +69,7 @@ export const ApplicationLeadForm = JSX<ApplicationLeadFormProps>(
|
|
|
71
69
|
{(_?.inputs || [])?.map(getField(field, typeForm))}
|
|
72
70
|
</div>
|
|
73
71
|
))}
|
|
74
|
-
{
|
|
75
|
-
fieldName ? field('consentDataProcessing') : undefined,
|
|
76
|
-
link,
|
|
77
|
-
button,
|
|
78
|
-
)}
|
|
72
|
+
{renderSubmitButton(button)}
|
|
79
73
|
</form>
|
|
80
74
|
</ApplicationFormLayout>
|
|
81
75
|
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useCallback, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
|
+
|
|
3
|
+
export function useLocalStorage<T>(key: string): [T | null, (value: T) => void] {
|
|
4
|
+
const [storedValue, setStoredValue] = useState<T | null>(
|
|
5
|
+
JSON.parse(globalThis.localStorage?.getItem(key) || 'null') as T | null,
|
|
6
|
+
);
|
|
7
|
+
|
|
8
|
+
const setValue = useCallback(
|
|
9
|
+
(value: T) => {
|
|
10
|
+
globalThis.localStorage?.setItem(key, JSON.stringify(value));
|
|
11
|
+
setStoredValue(value);
|
|
12
|
+
},
|
|
13
|
+
[key, globalThis.localStorage],
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
return [storedValue, setValue];
|
|
17
|
+
}
|
|
@@ -7,6 +7,7 @@ import { FoldableSection } from '../Foldable/FoldableSection';
|
|
|
7
7
|
import { Icon } from '../Icon/Icon';
|
|
8
8
|
import { Checkbox } from './Checkbox';
|
|
9
9
|
import { type CheckboxGroupProps } from './CheckboxProps';
|
|
10
|
+
import { CheckboxWithError } from './CheckboxWithError';
|
|
10
11
|
|
|
11
12
|
export const CheckboxGroup = JSX<CheckboxGroupProps>(({ className, items = [], ...props }) => {
|
|
12
13
|
const isChecked = items.every((_) => _?.value);
|
|
@@ -27,7 +28,12 @@ export const CheckboxGroup = JSX<CheckboxGroupProps>(({ className, items = [], .
|
|
|
27
28
|
</FoldableSection>
|
|
28
29
|
)}
|
|
29
30
|
renderFoldButton={renderGeneralCheckbox(
|
|
30
|
-
<
|
|
31
|
+
<CheckboxWithError
|
|
32
|
+
required={true}
|
|
33
|
+
value={isChecked}
|
|
34
|
+
onChange={handleGeneralToggle}
|
|
35
|
+
{...props}
|
|
36
|
+
/>,
|
|
31
37
|
)}
|
|
32
38
|
/>
|
|
33
39
|
</div>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { CheckboxGroup } from '../../Checkbox/CheckboxGroup';
|
|
3
|
+
import { type CustomFieldProps } from '../CustomFieldProps';
|
|
4
|
+
|
|
5
|
+
const items = [
|
|
6
|
+
{
|
|
7
|
+
field: 'processPersonalDataLeadFlg',
|
|
8
|
+
text: 'Согласие на обработку персональных данных',
|
|
9
|
+
required: true,
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
field: 'consentOtherFlg',
|
|
13
|
+
text: 'Согласие на информирование о продуктах и услугах Банка',
|
|
14
|
+
required: true,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
field: 'consentProviderFlg',
|
|
18
|
+
text: 'Согласие об использовании простой электронной подписи',
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
{ field: 'consentPfrFlg', text: 'Согласие на запрос в ПФР Открыты по субботам', required: true },
|
|
22
|
+
{ field: 'consentPhotoFlg', text: 'Прочие согласия (согласие на фотографирование)' },
|
|
23
|
+
];
|
|
24
|
+
export const ConsentToAllDocsField = JSX<CustomFieldProps>(({ field }) => (
|
|
25
|
+
<CheckboxGroup
|
|
26
|
+
text="Согласие на все документы"
|
|
27
|
+
items={items.map((_) => ({ ...field(_.field), text: _.text, required: _.required }))}
|
|
28
|
+
/>
|
|
29
|
+
));
|
|
@@ -8,6 +8,7 @@ import { AcquiringField } from './Fields/AcquiringField';
|
|
|
8
8
|
import { AddressBranchField } from './Fields/AddressBranchField';
|
|
9
9
|
import { AmountField } from './Fields/AmountField';
|
|
10
10
|
import { CommentField } from './Fields/CommentField';
|
|
11
|
+
import { ConsentToAllDocsField } from './Fields/ConsentToAllDocsField';
|
|
11
12
|
import { FeedbackMethodField } from './Fields/FeedbackMethodField';
|
|
12
13
|
import { FeedbackTypeField } from './Fields/FeedbackTypeField';
|
|
13
14
|
import { IsClientField } from './Fields/IsClientField';
|
|
@@ -129,6 +130,7 @@ export const getField =
|
|
|
129
130
|
<InputControl label="Дата и время обращения в Банк" {...field('applicationDate')} />
|
|
130
131
|
),
|
|
131
132
|
secondaryPhone: <SecondaryPhoneField field={field} />,
|
|
133
|
+
сonsentToAllDocs: <ConsentToAllDocsField field={field} />,
|
|
132
134
|
};
|
|
133
135
|
|
|
134
136
|
return isRenderField({ input, field }) ? (
|
|
@@ -35,6 +35,7 @@ export const validatorObj: Record<string, Validator> = {
|
|
|
35
35
|
localities: defaultValidator,
|
|
36
36
|
consentDataProcessing: agreementValidator,
|
|
37
37
|
annualRevenue: defaultValidator,
|
|
38
|
+
consentToAllDocs: agreementValidator,
|
|
38
39
|
};
|
|
39
40
|
|
|
40
41
|
export const getObjectValidator = (inputs: FieldDef[]): Record<string, Validator> => {
|