@redneckz/wildless-cms-uni-blocks 0.14.1038 → 0.14.1040

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 (80) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +109 -24
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/ReferalForm/ReferalFormContent.d.ts +2 -2
  5. package/bundle/components/ReferalForm/referalFormData.d.ts +2 -2
  6. package/dist/components/CreditForm/StepsNavigationButtons.js +93 -1
  7. package/dist/components/CreditForm/StepsNavigationButtons.js.map +1 -1
  8. package/dist/components/ReferalForm/ReferalForm.js +6 -6
  9. package/dist/components/ReferalForm/ReferalForm.js.map +1 -1
  10. package/dist/components/ReferalForm/ReferalFormContent.d.ts +2 -2
  11. package/dist/components/ReferalForm/referalFormData.d.ts +2 -2
  12. package/dist/components/ReferalForm/referalFormData.js +8 -14
  13. package/dist/components/ReferalForm/referalFormData.js.map +1 -1
  14. package/dist/components/ReferalForm/renderLinkInput.js +4 -1
  15. package/dist/components/ReferalForm/renderLinkInput.js.map +1 -1
  16. package/lib/components/CreditForm/StepsNavigationButtons.js +93 -1
  17. package/lib/components/CreditForm/StepsNavigationButtons.js.map +1 -1
  18. package/lib/components/ReferalForm/ReferalForm.js +6 -6
  19. package/lib/components/ReferalForm/ReferalForm.js.map +1 -1
  20. package/lib/components/ReferalForm/ReferalFormContent.d.ts +2 -2
  21. package/lib/components/ReferalForm/referalFormData.d.ts +2 -2
  22. package/lib/components/ReferalForm/referalFormData.js +7 -13
  23. package/lib/components/ReferalForm/referalFormData.js.map +1 -1
  24. package/lib/components/ReferalForm/renderLinkInput.js +4 -1
  25. package/lib/components/ReferalForm/renderLinkInput.js.map +1 -1
  26. package/mobile/bundle/bundle.umd.js +109 -24
  27. package/mobile/bundle/bundle.umd.min.js +1 -1
  28. package/mobile/bundle/components/ReferalForm/ReferalFormContent.d.ts +2 -2
  29. package/mobile/bundle/components/ReferalForm/referalFormData.d.ts +2 -2
  30. package/mobile/dist/components/CreditForm/StepsNavigationButtons.js +93 -1
  31. package/mobile/dist/components/CreditForm/StepsNavigationButtons.js.map +1 -1
  32. package/mobile/dist/components/ReferalForm/ReferalForm.js +6 -6
  33. package/mobile/dist/components/ReferalForm/ReferalForm.js.map +1 -1
  34. package/mobile/dist/components/ReferalForm/ReferalFormContent.d.ts +2 -2
  35. package/mobile/dist/components/ReferalForm/referalFormData.d.ts +2 -2
  36. package/mobile/dist/components/ReferalForm/referalFormData.js +8 -14
  37. package/mobile/dist/components/ReferalForm/referalFormData.js.map +1 -1
  38. package/mobile/dist/components/ReferalForm/renderLinkInput.js +4 -1
  39. package/mobile/dist/components/ReferalForm/renderLinkInput.js.map +1 -1
  40. package/mobile/lib/components/CreditForm/StepsNavigationButtons.js +93 -1
  41. package/mobile/lib/components/CreditForm/StepsNavigationButtons.js.map +1 -1
  42. package/mobile/lib/components/ReferalForm/ReferalForm.js +6 -6
  43. package/mobile/lib/components/ReferalForm/ReferalForm.js.map +1 -1
  44. package/mobile/lib/components/ReferalForm/ReferalFormContent.d.ts +2 -2
  45. package/mobile/lib/components/ReferalForm/referalFormData.d.ts +2 -2
  46. package/mobile/lib/components/ReferalForm/referalFormData.js +7 -13
  47. package/mobile/lib/components/ReferalForm/referalFormData.js.map +1 -1
  48. package/mobile/lib/components/ReferalForm/renderLinkInput.js +4 -1
  49. package/mobile/lib/components/ReferalForm/renderLinkInput.js.map +1 -1
  50. package/mobile/src/components/CreditForm/StepsNavigationButtons.tsx +97 -1
  51. package/mobile/src/components/ReferalForm/ReferalForm.example.json +3 -1
  52. package/mobile/src/components/ReferalForm/ReferalForm.tsx +11 -11
  53. package/mobile/src/components/ReferalForm/ReferalFormContent.ts +11 -9
  54. package/mobile/src/components/ReferalForm/referalFormData.ts +8 -14
  55. package/mobile/src/components/ReferalForm/renderLinkInput.tsx +5 -1
  56. package/package.json +1 -1
  57. package/src/components/CreditForm/StepsNavigationButtons.tsx +97 -1
  58. package/src/components/ReferalForm/ReferalForm.example.json +3 -1
  59. package/src/components/ReferalForm/ReferalForm.fixture.mobile.tsx +2 -0
  60. package/src/components/ReferalForm/ReferalForm.fixture.tsx +2 -0
  61. package/src/components/ReferalForm/ReferalForm.tsx +11 -11
  62. package/src/components/ReferalForm/ReferalFormContent.ts +11 -9
  63. package/src/components/ReferalForm/referalFormData.ts +8 -14
  64. package/src/components/ReferalForm/renderLinkInput.tsx +5 -1
  65. package/bundle/components/ReferalForm/renderSections.d.ts +0 -3
  66. package/dist/components/ReferalForm/renderSections.d.ts +0 -3
  67. package/dist/components/ReferalForm/renderSections.js +0 -10
  68. package/dist/components/ReferalForm/renderSections.js.map +0 -1
  69. package/lib/components/ReferalForm/renderSections.d.ts +0 -3
  70. package/lib/components/ReferalForm/renderSections.js +0 -7
  71. package/lib/components/ReferalForm/renderSections.js.map +0 -1
  72. package/mobile/bundle/components/ReferalForm/renderSections.d.ts +0 -3
  73. package/mobile/dist/components/ReferalForm/renderSections.d.ts +0 -3
  74. package/mobile/dist/components/ReferalForm/renderSections.js +0 -10
  75. package/mobile/dist/components/ReferalForm/renderSections.js.map +0 -1
  76. package/mobile/lib/components/ReferalForm/renderSections.d.ts +0 -3
  77. package/mobile/lib/components/ReferalForm/renderSections.js +0 -7
  78. package/mobile/lib/components/ReferalForm/renderSections.js.map +0 -1
  79. package/mobile/src/components/ReferalForm/renderSections.tsx +0 -18
  80. package/src/components/ReferalForm/renderSections.tsx +0 -18
@@ -1,4 +1,6 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
+ import { type AspectsDef } from '../../model/AspectsProps';
3
+ import { projectSettings } from '../../ProjectSettings';
2
4
  import { Button } from '../../ui-kit/Button/Button';
3
5
  import { SubmitButton } from '../../ui-kit/Button/SubmitButton';
4
6
 
@@ -8,6 +10,100 @@ export interface StepsNavigationButtonsProps {
8
10
  onPrevStep?: () => void;
9
11
  }
10
12
 
13
+ const YANDEX_ID = projectSettings.YANDEX_METRIKA_ID || '92511315';
14
+
15
+ const data: AspectsDef[][] = [
16
+ [
17
+ {
18
+ aspectName: 'ymReachGoal',
19
+ params: {
20
+ yandexId: YANDEX_ID,
21
+ targetName: 'credit_calculator',
22
+ },
23
+ },
24
+ {
25
+ aspectName: 'snowplowEvent',
26
+ params: {
27
+ eventAction: 'naturalCreditsReducedPaymentCreditSummPeriodNext',
28
+ eventCategory: 'naturalCredits',
29
+ eventValueText: 'Кредит со сниженным платежом Сумма и сроки кредита Кнопка Далее',
30
+ },
31
+ },
32
+ ],
33
+ [
34
+ {
35
+ aspectName: 'ymReachGoal',
36
+ params: {
37
+ yandexId: YANDEX_ID,
38
+ targetName: 'app_personal_data',
39
+ },
40
+ },
41
+ {
42
+ aspectName: 'snowplowEvent',
43
+ params: {
44
+ eventAction: 'naturalCreditsReducedPaymentCreditFormPassportNext',
45
+ eventCategory: 'naturalCredits',
46
+ eventValueText: 'Кредит со сниженным платежом Паспортные данные Кнопка Далее',
47
+ },
48
+ },
49
+ ],
50
+ [
51
+ {
52
+ aspectName: 'ymReachGoal',
53
+ params: {
54
+ yandexId: YANDEX_ID,
55
+ targetName: 'app_work',
56
+ },
57
+ },
58
+ {
59
+ aspectName: 'snowplowEvent',
60
+ params: {
61
+ eventAction: 'naturalCreditsReducedPaymentCreditFormEmployerDetailsNext',
62
+ eventCategory: 'naturalCredits',
63
+ eventValueText: 'Кредит со сниженным платежом Данные о работодателе Кнопка Далее',
64
+ },
65
+ },
66
+ ],
67
+ [
68
+ {
69
+ aspectName: 'ymReachGoal',
70
+ params: {
71
+ yandexId: YANDEX_ID,
72
+ targetName: 'app_income',
73
+ },
74
+ },
75
+ {
76
+ aspectName: 'snowplowEvent',
77
+ params: {
78
+ eventAction: 'naturalCreditsReducedPaymentCreditFormFamilyStatusNext',
79
+ eventCategory: 'naturalCredits',
80
+ eventValueText: 'Кредит со сниженным платежом Семейное положение и доход Кнопка Далее',
81
+ },
82
+ },
83
+ ],
84
+ [
85
+ {
86
+ aspectName: 'ymReachGoal',
87
+ params: {
88
+ yandexId: YANDEX_ID,
89
+ targetName: 'app_bank_office',
90
+ },
91
+ },
92
+ {
93
+ aspectName: 'snowplowEvent',
94
+ params: {
95
+ eventAction: 'naturalCreditsReducedPaymentCreditFormBankDepartmentChoosingNext',
96
+ eventCategory: 'naturalCredits',
97
+ eventValueText: 'Кредит со сниженным платежом Выбор отделения Кнопка Далее',
98
+ },
99
+ },
100
+ ],
101
+ ];
102
+
103
+ const getAspects = (step: number): AspectsDef[] => {
104
+ return data[step] || [];
105
+ };
106
+
11
107
  export const StepsNavigationButtons = JSX<StepsNavigationButtonsProps>(
12
108
  ({ step, onPrevStep, isSending }) => {
13
109
  const isFirstStep = step === 0;
@@ -23,7 +119,7 @@ export const StepsNavigationButtons = JSX<StepsNavigationButtonsProps>(
23
119
  >
24
120
  Назад
25
121
  </Button>
26
- <SubmitButton isLoading={isSending} testId="next-button">
122
+ <SubmitButton isLoading={isSending} testId="next-button" data={getAspects(step)}>
27
123
  {isFinalStep ? 'Отправить заявку' : 'Далее'}
28
124
  </SubmitButton>
29
125
  </div>
@@ -3,6 +3,8 @@
3
3
  "link": "https://www.rshb.ru/business/dlya-druga/rko",
4
4
  "button": {
5
5
  "text": "Получить ссылку"
6
- }
6
+ },
7
+ "title": "Как получить бесплатное обслуживание счёта",
8
+ "description": "Заполните ваши данные и получите персональную ссылку"
7
9
  }
8
10
  }
@@ -2,7 +2,9 @@ import { useCallback, useMemo, useState } from '@redneckz/uni-jsx/lib/hooks';
2
2
  import { useForm } from '../../hooks/useForm/useForm';
3
3
  import { ApplicationFormLayout } from '../../ui-kit/ApplicationFormLayout/ApplicationFormLayout';
4
4
  import { SubmitButton } from '../../ui-kit/Button/SubmitButton';
5
+ import { getField } from '../../ui-kit/FormField/getField';
5
6
  import { getFormValidator } from '../../ui-kit/FormField/getObjectValidator';
7
+ import { renderTitle } from '../../ui-kit/FormField/renderTitle';
6
8
  import { Link } from '../../ui-kit/Link/Link';
7
9
  import { Paragraph } from '../../ui-kit/Paragraph/Paragraph';
8
10
  import { type Option } from '../../ui-kit/Select/Option';
@@ -11,8 +13,7 @@ import { UniBlock } from '../../UniBlock/UniBlock';
11
13
  import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
12
14
  import { type FieldDef } from '../ApplicationForm/ApplicationFormContent';
13
15
  import { type ReferalFormContent } from './ReferalFormContent';
14
- import { sections } from './referalFormData';
15
- import { renderSections } from './renderSections';
16
+ import { inputs } from './referalFormData';
16
17
  import { ResultLink } from './ResultLink';
17
18
 
18
19
  export interface FormState {
@@ -23,13 +24,9 @@ export interface FormState {
23
24
  export interface ReferalFormProps extends ReferalFormContent, UniBlockProps {}
24
25
 
25
26
  export const ReferalForm = UniBlock<ReferalFormProps>(
26
- ({ link = '', button, copyIcon, ...rest }) => {
27
+ ({ title, description, link = '', button, copyIcon, ...rest }) => {
27
28
  const [isShowResultLink, setIsShowResultLink] = useState(false);
28
29
  const [referalLink, setReferalLink] = useState('');
29
- const inputs = useMemo(
30
- () => (sections?.flatMap((_) => _?.inputs) || []) as FieldDef[],
31
- [sections],
32
- );
33
30
 
34
31
  const formValidator = useMemo(() => getFormValidator(inputs), [inputs]);
35
32
 
@@ -52,14 +49,17 @@ export const ReferalForm = UniBlock<ReferalFormProps>(
52
49
  return (
53
50
  <ApplicationFormLayout
54
51
  className="container space-y-m col-span-12"
55
- title={getTitle(isShowResultLink)}
52
+ title={getTitle(title, isShowResultLink)}
56
53
  {...rest}
57
54
  >
58
55
  {isShowResultLink ? (
59
56
  <ResultLink link={referalLink} copyIcon={copyIcon} />
60
57
  ) : (
61
58
  <form onSubmit={onSubmit}>
62
- {renderSections(sections, field)}
59
+ <div className="grid @xl:grid-cols-2 gap-x-m">
60
+ {renderTitle(description)}
61
+ {inputs.map(getField<FieldDef>(field))}
62
+ </div>
63
63
  <Paragraph size="text-l" font="font-light" color="text-secondary-text">
64
64
  <Text>Нажимая кнопку, вы подтверждаете согласие с </Text>
65
65
  <Link href="/privacy-policy" target="_blank" ariaLabel="условия передачи данных">
@@ -76,5 +76,5 @@ export const ReferalForm = UniBlock<ReferalFormProps>(
76
76
  },
77
77
  );
78
78
 
79
- const getTitle = (isShowResultLink = false) =>
80
- isShowResultLink ? 'Ваша личная ссылка' : 'Как получить бесплатное обслуживание счёта';
79
+ const getTitle = (title = '', isShowResultLink = false) =>
80
+ isShowResultLink ? 'Ваша личная ссылка' : title;
@@ -1,15 +1,17 @@
1
- import { type TextProps } from '../../model/HeadlineType';
1
+ import { type DescriptionProps, type TextProps, type TitleProps } from '../../model/HeadlineType';
2
2
  import { type Picture } from '../../model/Picture';
3
3
  import { type UniBlockContent } from '../../UniBlock/UniBlockProps';
4
4
 
5
5
  /**
6
6
  * @title Форма для создания реферальной ссылки
7
7
  */
8
- export type ReferalFormContent = UniBlockContent & {
9
- /** @title Адрес страницы с заявкой для реферала */
10
- link?: string;
11
- /** @title Кнопка */
12
- button?: TextProps;
13
- /** @title Иконка кнопки копирования */
14
- copyIcon?: Picture;
15
- };
8
+ export type ReferalFormContent = UniBlockContent &
9
+ TitleProps &
10
+ DescriptionProps & {
11
+ /** @title Адрес страницы с заявкой для реферала */
12
+ link?: string;
13
+ /** @title Кнопка */
14
+ button?: TextProps;
15
+ /** @title Иконка кнопки копирования */
16
+ copyIcon?: Picture;
17
+ };
@@ -1,18 +1,12 @@
1
- import { type SectionsProps } from '../../model/InputSectionsType';
1
+ import { type FieldDef } from '../ApplicationForm/ApplicationFormContent';
2
2
 
3
- export const sections: SectionsProps[] = [
4
- { title: 'Заполните ваши данные и получите персональную ссылку', inputs: [] },
3
+ export const inputs: FieldDef[] = [
5
4
  {
6
- columns: 2,
7
- inputs: [
8
- {
9
- name: 'dadataPartyInnSelect',
10
- required: true,
11
- },
12
- {
13
- name: 'email',
14
- required: true,
15
- },
16
- ],
5
+ name: 'dadataPartyInnSelect',
6
+ required: true,
7
+ },
8
+ {
9
+ name: 'email',
10
+ required: true,
17
11
  },
18
12
  ];
@@ -10,6 +10,10 @@ type renderLinkInputProps = InputProps & {
10
10
  copyIcon?: Picture;
11
11
  };
12
12
 
13
+ const defaultIcon: Picture = {
14
+ icon: 'CopyIcon',
15
+ };
16
+
13
17
  export const renderLinkInput = JSX<renderLinkInputProps>(({ className, value = '', copyIcon }) => {
14
18
  const onClick = useCallback(async () => {
15
19
  try {
@@ -28,7 +32,7 @@ export const renderLinkInput = JSX<renderLinkInputProps>(({ className, value = '
28
32
  disabled={true}
29
33
  />
30
34
  <div role="button" className="absolute right-3" onClick={onClick}>
31
- <Img image={copyIcon} />
35
+ <Img image={copyIcon ?? defaultIcon} width="20px" />
32
36
  </div>
33
37
  </div>
34
38
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.14.1038",
3
+ "version": "0.14.1040",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -1,4 +1,6 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
+ import { type AspectsDef } from '../../model/AspectsProps';
3
+ import { projectSettings } from '../../ProjectSettings';
2
4
  import { Button } from '../../ui-kit/Button/Button';
3
5
  import { SubmitButton } from '../../ui-kit/Button/SubmitButton';
4
6
 
@@ -8,6 +10,100 @@ export interface StepsNavigationButtonsProps {
8
10
  onPrevStep?: () => void;
9
11
  }
10
12
 
13
+ const YANDEX_ID = projectSettings.YANDEX_METRIKA_ID || '92511315';
14
+
15
+ const data: AspectsDef[][] = [
16
+ [
17
+ {
18
+ aspectName: 'ymReachGoal',
19
+ params: {
20
+ yandexId: YANDEX_ID,
21
+ targetName: 'credit_calculator',
22
+ },
23
+ },
24
+ {
25
+ aspectName: 'snowplowEvent',
26
+ params: {
27
+ eventAction: 'naturalCreditsReducedPaymentCreditSummPeriodNext',
28
+ eventCategory: 'naturalCredits',
29
+ eventValueText: 'Кредит со сниженным платежом Сумма и сроки кредита Кнопка Далее',
30
+ },
31
+ },
32
+ ],
33
+ [
34
+ {
35
+ aspectName: 'ymReachGoal',
36
+ params: {
37
+ yandexId: YANDEX_ID,
38
+ targetName: 'app_personal_data',
39
+ },
40
+ },
41
+ {
42
+ aspectName: 'snowplowEvent',
43
+ params: {
44
+ eventAction: 'naturalCreditsReducedPaymentCreditFormPassportNext',
45
+ eventCategory: 'naturalCredits',
46
+ eventValueText: 'Кредит со сниженным платежом Паспортные данные Кнопка Далее',
47
+ },
48
+ },
49
+ ],
50
+ [
51
+ {
52
+ aspectName: 'ymReachGoal',
53
+ params: {
54
+ yandexId: YANDEX_ID,
55
+ targetName: 'app_work',
56
+ },
57
+ },
58
+ {
59
+ aspectName: 'snowplowEvent',
60
+ params: {
61
+ eventAction: 'naturalCreditsReducedPaymentCreditFormEmployerDetailsNext',
62
+ eventCategory: 'naturalCredits',
63
+ eventValueText: 'Кредит со сниженным платежом Данные о работодателе Кнопка Далее',
64
+ },
65
+ },
66
+ ],
67
+ [
68
+ {
69
+ aspectName: 'ymReachGoal',
70
+ params: {
71
+ yandexId: YANDEX_ID,
72
+ targetName: 'app_income',
73
+ },
74
+ },
75
+ {
76
+ aspectName: 'snowplowEvent',
77
+ params: {
78
+ eventAction: 'naturalCreditsReducedPaymentCreditFormFamilyStatusNext',
79
+ eventCategory: 'naturalCredits',
80
+ eventValueText: 'Кредит со сниженным платежом Семейное положение и доход Кнопка Далее',
81
+ },
82
+ },
83
+ ],
84
+ [
85
+ {
86
+ aspectName: 'ymReachGoal',
87
+ params: {
88
+ yandexId: YANDEX_ID,
89
+ targetName: 'app_bank_office',
90
+ },
91
+ },
92
+ {
93
+ aspectName: 'snowplowEvent',
94
+ params: {
95
+ eventAction: 'naturalCreditsReducedPaymentCreditFormBankDepartmentChoosingNext',
96
+ eventCategory: 'naturalCredits',
97
+ eventValueText: 'Кредит со сниженным платежом Выбор отделения Кнопка Далее',
98
+ },
99
+ },
100
+ ],
101
+ ];
102
+
103
+ const getAspects = (step: number): AspectsDef[] => {
104
+ return data[step] || [];
105
+ };
106
+
11
107
  export const StepsNavigationButtons = JSX<StepsNavigationButtonsProps>(
12
108
  ({ step, onPrevStep, isSending }) => {
13
109
  const isFirstStep = step === 0;
@@ -23,7 +119,7 @@ export const StepsNavigationButtons = JSX<StepsNavigationButtonsProps>(
23
119
  >
24
120
  Назад
25
121
  </Button>
26
- <SubmitButton isLoading={isSending} testId="next-button">
122
+ <SubmitButton isLoading={isSending} testId="next-button" data={getAspects(step)}>
27
123
  {isFinalStep ? 'Отправить заявку' : 'Далее'}
28
124
  </SubmitButton>
29
125
  </div>
@@ -3,6 +3,8 @@
3
3
  "link": "https://www.rshb.ru/business/dlya-druga/rko",
4
4
  "button": {
5
5
  "text": "Получить ссылку"
6
- }
6
+ },
7
+ "title": "Как получить бесплатное обслуживание счёта",
8
+ "description": "Заполните ваши данные и получите персональную ссылку"
7
9
  }
8
10
  }
@@ -15,6 +15,8 @@ export default {
15
15
  <div className="container grid grid-cols-12">
16
16
  <ReferalForm
17
17
  link="https://www.rshb.ru/business/dlya-druga/rko"
18
+ description="Заполните ваши данные и получите персональную ссылку"
19
+ title="Как получить бесплатное обслуживание счёта"
18
20
  button={{ text: 'Получить ссылку' }}
19
21
  copyIcon={icon}
20
22
  />
@@ -15,6 +15,8 @@ export default {
15
15
  <div className="container grid grid-cols-12">
16
16
  <ReferalForm
17
17
  link="https://www.rshb.ru/business/dlya-druga/rko"
18
+ description="Заполните ваши данные и получите персональную ссылку"
19
+ title="Как получить бесплатное обслуживание счёта"
18
20
  button={{ text: 'Получить ссылку' }}
19
21
  copyIcon={icon}
20
22
  />
@@ -2,7 +2,9 @@ import { useCallback, useMemo, useState } from '@redneckz/uni-jsx/lib/hooks';
2
2
  import { useForm } from '../../hooks/useForm/useForm';
3
3
  import { ApplicationFormLayout } from '../../ui-kit/ApplicationFormLayout/ApplicationFormLayout';
4
4
  import { SubmitButton } from '../../ui-kit/Button/SubmitButton';
5
+ import { getField } from '../../ui-kit/FormField/getField';
5
6
  import { getFormValidator } from '../../ui-kit/FormField/getObjectValidator';
7
+ import { renderTitle } from '../../ui-kit/FormField/renderTitle';
6
8
  import { Link } from '../../ui-kit/Link/Link';
7
9
  import { Paragraph } from '../../ui-kit/Paragraph/Paragraph';
8
10
  import { type Option } from '../../ui-kit/Select/Option';
@@ -11,8 +13,7 @@ import { UniBlock } from '../../UniBlock/UniBlock';
11
13
  import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
12
14
  import { type FieldDef } from '../ApplicationForm/ApplicationFormContent';
13
15
  import { type ReferalFormContent } from './ReferalFormContent';
14
- import { sections } from './referalFormData';
15
- import { renderSections } from './renderSections';
16
+ import { inputs } from './referalFormData';
16
17
  import { ResultLink } from './ResultLink';
17
18
 
18
19
  export interface FormState {
@@ -23,13 +24,9 @@ export interface FormState {
23
24
  export interface ReferalFormProps extends ReferalFormContent, UniBlockProps {}
24
25
 
25
26
  export const ReferalForm = UniBlock<ReferalFormProps>(
26
- ({ link = '', button, copyIcon, ...rest }) => {
27
+ ({ title, description, link = '', button, copyIcon, ...rest }) => {
27
28
  const [isShowResultLink, setIsShowResultLink] = useState(false);
28
29
  const [referalLink, setReferalLink] = useState('');
29
- const inputs = useMemo(
30
- () => (sections?.flatMap((_) => _?.inputs) || []) as FieldDef[],
31
- [sections],
32
- );
33
30
 
34
31
  const formValidator = useMemo(() => getFormValidator(inputs), [inputs]);
35
32
 
@@ -52,14 +49,17 @@ export const ReferalForm = UniBlock<ReferalFormProps>(
52
49
  return (
53
50
  <ApplicationFormLayout
54
51
  className="container space-y-m col-span-12"
55
- title={getTitle(isShowResultLink)}
52
+ title={getTitle(title, isShowResultLink)}
56
53
  {...rest}
57
54
  >
58
55
  {isShowResultLink ? (
59
56
  <ResultLink link={referalLink} copyIcon={copyIcon} />
60
57
  ) : (
61
58
  <form onSubmit={onSubmit}>
62
- {renderSections(sections, field)}
59
+ <div className="grid @xl:grid-cols-2 gap-x-m">
60
+ {renderTitle(description)}
61
+ {inputs.map(getField<FieldDef>(field))}
62
+ </div>
63
63
  <Paragraph size="text-l" font="font-light" color="text-secondary-text">
64
64
  <Text>Нажимая кнопку, вы подтверждаете согласие с </Text>
65
65
  <Link href="/privacy-policy" target="_blank" ariaLabel="условия передачи данных">
@@ -76,5 +76,5 @@ export const ReferalForm = UniBlock<ReferalFormProps>(
76
76
  },
77
77
  );
78
78
 
79
- const getTitle = (isShowResultLink = false) =>
80
- isShowResultLink ? 'Ваша личная ссылка' : 'Как получить бесплатное обслуживание счёта';
79
+ const getTitle = (title = '', isShowResultLink = false) =>
80
+ isShowResultLink ? 'Ваша личная ссылка' : title;
@@ -1,15 +1,17 @@
1
- import { type TextProps } from '../../model/HeadlineType';
1
+ import { type DescriptionProps, type TextProps, type TitleProps } from '../../model/HeadlineType';
2
2
  import { type Picture } from '../../model/Picture';
3
3
  import { type UniBlockContent } from '../../UniBlock/UniBlockProps';
4
4
 
5
5
  /**
6
6
  * @title Форма для создания реферальной ссылки
7
7
  */
8
- export type ReferalFormContent = UniBlockContent & {
9
- /** @title Адрес страницы с заявкой для реферала */
10
- link?: string;
11
- /** @title Кнопка */
12
- button?: TextProps;
13
- /** @title Иконка кнопки копирования */
14
- copyIcon?: Picture;
15
- };
8
+ export type ReferalFormContent = UniBlockContent &
9
+ TitleProps &
10
+ DescriptionProps & {
11
+ /** @title Адрес страницы с заявкой для реферала */
12
+ link?: string;
13
+ /** @title Кнопка */
14
+ button?: TextProps;
15
+ /** @title Иконка кнопки копирования */
16
+ copyIcon?: Picture;
17
+ };
@@ -1,18 +1,12 @@
1
- import { type SectionsProps } from '../../model/InputSectionsType';
1
+ import { type FieldDef } from '../ApplicationForm/ApplicationFormContent';
2
2
 
3
- export const sections: SectionsProps[] = [
4
- { title: 'Заполните ваши данные и получите персональную ссылку', inputs: [] },
3
+ export const inputs: FieldDef[] = [
5
4
  {
6
- columns: 2,
7
- inputs: [
8
- {
9
- name: 'dadataPartyInnSelect',
10
- required: true,
11
- },
12
- {
13
- name: 'email',
14
- required: true,
15
- },
16
- ],
5
+ name: 'dadataPartyInnSelect',
6
+ required: true,
7
+ },
8
+ {
9
+ name: 'email',
10
+ required: true,
17
11
  },
18
12
  ];
@@ -10,6 +10,10 @@ type renderLinkInputProps = InputProps & {
10
10
  copyIcon?: Picture;
11
11
  };
12
12
 
13
+ const defaultIcon: Picture = {
14
+ icon: 'CopyIcon',
15
+ };
16
+
13
17
  export const renderLinkInput = JSX<renderLinkInputProps>(({ className, value = '', copyIcon }) => {
14
18
  const onClick = useCallback(async () => {
15
19
  try {
@@ -28,7 +32,7 @@ export const renderLinkInput = JSX<renderLinkInputProps>(({ className, value = '
28
32
  disabled={true}
29
33
  />
30
34
  <div role="button" className="absolute right-3" onClick={onClick}>
31
- <Img image={copyIcon} />
35
+ <Img image={copyIcon ?? defaultIcon} width="20px" />
32
36
  </div>
33
37
  </div>
34
38
  );
@@ -1,3 +0,0 @@
1
- import type { FormFieldRegisterer } from '../../hooks/useForm/useForm';
2
- import type { SectionsProps } from '../../model/InputSectionsType';
3
- export declare const renderSections: (sections: SectionsProps[], field: FormFieldRegisterer<Record<string, any>>) => any[];
@@ -1,3 +0,0 @@
1
- import type { FormFieldRegisterer } from '../../hooks/useForm/useForm';
2
- import type { SectionsProps } from '../../model/InputSectionsType';
3
- export declare const renderSections: (sections: SectionsProps[], field: FormFieldRegisterer<Record<string, any>>) => any[];
@@ -1,10 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.renderSections = void 0;
3
- const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
4
- const getField_1 = require("../../ui-kit/FormField/getField");
5
- const inputColumnStyle_1 = require("../../ui-kit/FormField/inputColumnStyle");
6
- const renderTitle_1 = require("../../ui-kit/FormField/renderTitle");
7
- const style_1 = require("../../utils/style");
8
- const renderSections = (sections, field) => sections.map((_, i) => ((0, jsx_runtime_1.jsxs)("div", { className: (0, style_1.style)((0, inputColumnStyle_1.inputColumnStyles)(_.columns), 'grid'), children: [(0, renderTitle_1.renderTitle)(_.title), (_?.inputs || [])?.map((0, getField_1.getField)(field))] }, `section-${i}`)));
9
- exports.renderSections = renderSections;
10
- //# sourceMappingURL=renderSections.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderSections.js","sourceRoot":"","sources":["../../../src/components/ReferalForm/renderSections.tsx"],"names":[],"mappings":";;;AAEA,8DAA2D;AAC3D,8EAA4E;AAC5E,oEAAiE;AACjE,6CAA0C;AAGnC,MAAM,cAAc,GAAG,CAC5B,QAAyB,EACzB,KAA+C,EAC/C,EAAE,CACF,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACrB,iCAA0B,SAAS,EAAE,IAAA,aAAK,EAAC,IAAA,oCAAiB,EAAC,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,aAC7E,IAAA,yBAAW,EAAC,CAAC,CAAC,KAAK,CAAC,EACpB,CAAC,CAAC,EAAE,MAAM,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,IAAA,mBAAQ,EAAW,KAAK,CAAC,CAAC,KAF1C,WAAW,CAAC,EAAE,CAGlB,CACP,CAAC,CAAC;AATQ,QAAA,cAAc,kBAStB"}
@@ -1,3 +0,0 @@
1
- import type { FormFieldRegisterer } from '../../hooks/useForm/useForm';
2
- import type { SectionsProps } from '../../model/InputSectionsType';
3
- export declare const renderSections: (sections: SectionsProps[], field: FormFieldRegisterer<Record<string, any>>) => any[];
@@ -1,7 +0,0 @@
1
- import { jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
2
- import { getField } from '../../ui-kit/FormField/getField.js';
3
- import { inputColumnStyles } from '../../ui-kit/FormField/inputColumnStyle.js';
4
- import { renderTitle } from '../../ui-kit/FormField/renderTitle.js';
5
- import { style } from '../../utils/style.js';
6
- export const renderSections = (sections, field) => sections.map((_, i) => (_jsxs("div", { className: style(inputColumnStyles(_.columns), 'grid'), children: [renderTitle(_.title), (_?.inputs || [])?.map(getField(field))] }, `section-${i}`)));
7
- //# sourceMappingURL=renderSections.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderSections.js","sourceRoot":"","sources":["../../../src/components/ReferalForm/renderSections.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG1C,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,QAAyB,EACzB,KAA+C,EAC/C,EAAE,CACF,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACrB,eAA0B,SAAS,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,aAC7E,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,EACpB,CAAC,CAAC,EAAE,MAAM,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,QAAQ,CAAW,KAAK,CAAC,CAAC,KAF1C,WAAW,CAAC,EAAE,CAGlB,CACP,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { FormFieldRegisterer } from '../../hooks/useForm/useForm';
2
- import type { SectionsProps } from '../../model/InputSectionsType';
3
- export declare const renderSections: (sections: SectionsProps[], field: FormFieldRegisterer<Record<string, any>>) => any[];
@@ -1,3 +0,0 @@
1
- import type { FormFieldRegisterer } from '../../hooks/useForm/useForm';
2
- import type { SectionsProps } from '../../model/InputSectionsType';
3
- export declare const renderSections: (sections: SectionsProps[], field: FormFieldRegisterer<Record<string, any>>) => any[];
@@ -1,10 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.renderSections = void 0;
3
- const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
4
- const getField_1 = require("../../ui-kit/FormField/getField");
5
- const inputColumnStyle_1 = require("../../ui-kit/FormField/inputColumnStyle");
6
- const renderTitle_1 = require("../../ui-kit/FormField/renderTitle");
7
- const style_1 = require("../../utils/style");
8
- const renderSections = (sections, field) => sections.map((_, i) => ((0, jsx_runtime_1.jsxs)("div", { className: (0, style_1.style)((0, inputColumnStyle_1.inputColumnStyles)(_.columns), 'grid'), children: [(0, renderTitle_1.renderTitle)(_.title), (_?.inputs || [])?.map((0, getField_1.getField)(field))] }, `section-${i}`)));
9
- exports.renderSections = renderSections;
10
- //# sourceMappingURL=renderSections.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderSections.js","sourceRoot":"","sources":["../../../src/components/ReferalForm/renderSections.tsx"],"names":[],"mappings":";;;AAEA,8DAA2D;AAC3D,8EAA4E;AAC5E,oEAAiE;AACjE,6CAA0C;AAGnC,MAAM,cAAc,GAAG,CAC5B,QAAyB,EACzB,KAA+C,EAC/C,EAAE,CACF,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACrB,iCAA0B,SAAS,EAAE,IAAA,aAAK,EAAC,IAAA,oCAAiB,EAAC,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,aAC7E,IAAA,yBAAW,EAAC,CAAC,CAAC,KAAK,CAAC,EACpB,CAAC,CAAC,EAAE,MAAM,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,IAAA,mBAAQ,EAAW,KAAK,CAAC,CAAC,KAF1C,WAAW,CAAC,EAAE,CAGlB,CACP,CAAC,CAAC;AATQ,QAAA,cAAc,kBAStB"}
@@ -1,3 +0,0 @@
1
- import type { FormFieldRegisterer } from '../../hooks/useForm/useForm';
2
- import type { SectionsProps } from '../../model/InputSectionsType';
3
- export declare const renderSections: (sections: SectionsProps[], field: FormFieldRegisterer<Record<string, any>>) => any[];
@@ -1,7 +0,0 @@
1
- import { jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
2
- import { getField } from '../../ui-kit/FormField/getField.js';
3
- import { inputColumnStyles } from '../../ui-kit/FormField/inputColumnStyle.js';
4
- import { renderTitle } from '../../ui-kit/FormField/renderTitle.js';
5
- import { style } from '../../utils/style.js';
6
- export const renderSections = (sections, field) => sections.map((_, i) => (_jsxs("div", { className: style(inputColumnStyles(_.columns), 'grid'), children: [renderTitle(_.title), (_?.inputs || [])?.map(getField(field))] }, `section-${i}`)));
7
- //# sourceMappingURL=renderSections.js.map