@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.
Files changed (107) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +80 -53
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
  5. package/bundle/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
  6. package/bundle/hooks/useLocalStorage.d.ts +1 -0
  7. package/bundle/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
  8. package/bundle/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
  9. package/dist/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
  10. package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +3 -5
  11. package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  12. package/dist/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
  13. package/dist/hooks/useLocalStorage.d.ts +1 -0
  14. package/dist/hooks/useLocalStorage.js +13 -0
  15. package/dist/hooks/useLocalStorage.js.map +1 -0
  16. package/dist/ui-kit/Checkbox/CheckboxGroup.js +2 -1
  17. package/dist/ui-kit/Checkbox/CheckboxGroup.js.map +1 -1
  18. package/dist/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
  19. package/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
  20. package/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.js +26 -0
  21. package/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.js.map +1 -0
  22. package/dist/ui-kit/FormField/getField.js +2 -0
  23. package/dist/ui-kit/FormField/getField.js.map +1 -1
  24. package/dist/ui-kit/FormField/getObjectValidator.js +1 -0
  25. package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  26. package/lib/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
  27. package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +3 -5
  28. package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  29. package/lib/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
  30. package/lib/components/ApplicationLeadForm/renderAgreementSubmit.d.ts +1 -0
  31. package/lib/hooks/useLocalStorage.d.ts +1 -0
  32. package/lib/hooks/useLocalStorage.js +10 -0
  33. package/lib/hooks/useLocalStorage.js.map +1 -0
  34. package/lib/ui-kit/Checkbox/CheckboxGroup.js +2 -1
  35. package/lib/ui-kit/Checkbox/CheckboxGroup.js.map +1 -1
  36. package/lib/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
  37. package/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
  38. package/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.js +24 -0
  39. package/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.js.map +1 -0
  40. package/lib/ui-kit/FormField/getField.js +2 -0
  41. package/lib/ui-kit/FormField/getField.js.map +1 -1
  42. package/lib/ui-kit/FormField/getObjectValidator.js +1 -0
  43. package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  44. package/mobile/bundle/bundle.umd.js +80 -53
  45. package/mobile/bundle/bundle.umd.min.js +1 -1
  46. package/mobile/bundle/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
  47. package/mobile/bundle/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
  48. package/mobile/bundle/hooks/useLocalStorage.d.ts +1 -0
  49. package/mobile/bundle/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
  50. package/mobile/bundle/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
  51. package/mobile/dist/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
  52. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +3 -5
  53. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  54. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
  55. package/mobile/dist/hooks/useLocalStorage.d.ts +1 -0
  56. package/mobile/dist/hooks/useLocalStorage.js +13 -0
  57. package/mobile/dist/hooks/useLocalStorage.js.map +1 -0
  58. package/mobile/dist/ui-kit/Checkbox/CheckboxGroup.js +2 -1
  59. package/mobile/dist/ui-kit/Checkbox/CheckboxGroup.js.map +1 -1
  60. package/mobile/dist/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
  61. package/mobile/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
  62. package/mobile/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.js +26 -0
  63. package/mobile/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.js.map +1 -0
  64. package/mobile/dist/ui-kit/FormField/getField.js +2 -0
  65. package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
  66. package/mobile/dist/ui-kit/FormField/getObjectValidator.js +1 -0
  67. package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  68. package/mobile/lib/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
  69. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +3 -5
  70. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  71. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
  72. package/mobile/lib/hooks/useLocalStorage.d.ts +1 -0
  73. package/mobile/lib/hooks/useLocalStorage.js +10 -0
  74. package/mobile/lib/hooks/useLocalStorage.js.map +1 -0
  75. package/mobile/lib/ui-kit/Checkbox/CheckboxGroup.js +2 -1
  76. package/mobile/lib/ui-kit/Checkbox/CheckboxGroup.js.map +1 -1
  77. package/mobile/lib/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
  78. package/mobile/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
  79. package/mobile/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.js +24 -0
  80. package/mobile/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.js.map +1 -0
  81. package/mobile/lib/ui-kit/FormField/getField.js +2 -0
  82. package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
  83. package/mobile/lib/ui-kit/FormField/getObjectValidator.js +1 -0
  84. package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  85. package/mobile/src/components/ApplicationForm/ApplicationFormContent.ts +2 -1
  86. package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.example.json +6 -856
  87. package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +3 -9
  88. package/mobile/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +2 -1
  89. package/mobile/src/hooks/useLocalStorage.ts +17 -0
  90. package/mobile/src/ui-kit/Checkbox/CheckboxGroup.tsx +7 -1
  91. package/mobile/src/ui-kit/Checkbox/CheckboxProps.ts +1 -1
  92. package/mobile/src/ui-kit/FormField/Fields/ConsentToAllDocsField.tsx +29 -0
  93. package/mobile/src/ui-kit/FormField/getField.tsx +2 -0
  94. package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +1 -0
  95. package/package.json +1 -1
  96. package/src/components/ApplicationForm/ApplicationFormContent.ts +2 -1
  97. package/src/components/ApplicationLeadForm/ApplicationLeadForm.example.json +6 -856
  98. package/src/components/ApplicationLeadForm/ApplicationLeadForm.fixture.mobile.tsx +8 -10
  99. package/src/components/ApplicationLeadForm/ApplicationLeadForm.fixture.tsx +7 -10
  100. package/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +3 -9
  101. package/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +2 -1
  102. package/src/hooks/useLocalStorage.ts +17 -0
  103. package/src/ui-kit/Checkbox/CheckboxGroup.tsx +7 -1
  104. package/src/ui-kit/Checkbox/CheckboxProps.ts +1 -1
  105. package/src/ui-kit/FormField/Fields/ConsentToAllDocsField.tsx +29 -0
  106. package/src/ui-kit/FormField/getField.tsx +2 -0
  107. 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: 'consentDataProcessing', required: true },
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: 'consentDataProcessing', required: true },
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 { renderAgreementSubmit } from './renderAgreementSubmit';
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, link, endpoint, ...rest }) => {
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
- {renderAgreementSubmit(
75
- fieldName ? field('consentDataProcessing') : undefined,
76
- link,
77
- button,
78
- )}
72
+ {renderSubmitButton(button)}
79
73
  </form>
80
74
  </ApplicationFormLayout>
81
75
  );
@@ -52,7 +52,8 @@ export type NameFieldDef =
52
52
  | 'product'
53
53
  | 'localities'
54
54
  | 'partnerComments'
55
- | 'consentDataProcessing';
55
+ | 'consentDataProcessing'
56
+ | 'consentToAllDocs';
56
57
 
57
58
  export type ConditionFieldProps = {
58
59
  /** @title Условия отображения полей формы */
@@ -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
- <Checkbox value={isChecked} onChange={handleGeneralToggle} {...props} />,
31
+ <CheckboxWithError
32
+ required={true}
33
+ value={isChecked}
34
+ onChange={handleGeneralToggle}
35
+ {...props}
36
+ />,
31
37
  )}
32
38
  />
33
39
  </div>
@@ -6,7 +6,7 @@ export interface CheckboxProps {
6
6
  isRadio?: boolean;
7
7
  onChange?: (value: boolean) => void;
8
8
  error?: string;
9
- subItems?: CheckboxProps[];
9
+ required?: boolean;
10
10
  }
11
11
 
12
12
  export interface CheckboxGroupProps {
@@ -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> => {