@redneckz/wildless-cms-uni-blocks 0.13.16 → 0.13.18

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 (169) hide show
  1. package/bin/migration-scripts/0.13.13.js +34 -0
  2. package/bundle/blocks.schema.json +1 -1
  3. package/bundle/bundle.umd.js +13 -21
  4. package/bundle/bundle.umd.min.js +1 -1
  5. package/bundle/components/Calculator/CalculatorContent.d.ts +1 -3
  6. package/bundle/components/Carousel/Carousel.d.ts +0 -1
  7. package/bundle/components/Carousel/CarouselContent.d.ts +2 -0
  8. package/bundle/components/ContentPage/toMobileBlock.d.ts +2 -0
  9. package/bundle/components/ErrorBlock/ErrorBlockContent.d.ts +4 -4
  10. package/dist/components/Blocks.mobile.js +2 -0
  11. package/dist/components/Blocks.mobile.js.map +1 -1
  12. package/dist/components/Calculator/CalculatorContent.d.ts +1 -3
  13. package/dist/components/Calculator/RefinancingCalculatorForm.js +2 -3
  14. package/dist/components/Calculator/RefinancingCalculatorForm.js.map +1 -1
  15. package/dist/components/Calculator/checkRefinancingSourceBookRowCommonParams.js +0 -5
  16. package/dist/components/Calculator/checkRefinancingSourceBookRowCommonParams.js.map +1 -1
  17. package/dist/components/Calculator/getRefinancingCalculatorRateParams.js +1 -1
  18. package/dist/components/Calculator/getRefinancingCalculatorRateParams.js.map +1 -1
  19. package/dist/components/Calculator/useRefinancingCalculatorParams.js +3 -0
  20. package/dist/components/Calculator/useRefinancingCalculatorParams.js.map +1 -1
  21. package/dist/components/Carousel/Carousel.d.ts +0 -1
  22. package/dist/components/Carousel/Carousel.js.map +1 -1
  23. package/dist/components/Carousel/CarouselContent.d.ts +2 -0
  24. package/dist/components/ContentPage/ContentPage.js +1 -1
  25. package/dist/components/ContentPage/ContentPage.js.map +1 -1
  26. package/dist/components/ContentPage/normalizeBlock.mobile.js +3 -5
  27. package/dist/components/ContentPage/normalizeBlock.mobile.js.map +1 -1
  28. package/dist/components/ContentPage/toMobileBlock.d.ts +2 -0
  29. package/dist/components/ContentPage/toMobileBlock.js +12 -0
  30. package/dist/components/ContentPage/toMobileBlock.js.map +1 -0
  31. package/dist/components/ErrorBlock/ErrorBlock.js +3 -4
  32. package/dist/components/ErrorBlock/ErrorBlock.js.map +1 -1
  33. package/dist/components/ErrorBlock/ErrorBlockContent.d.ts +4 -4
  34. package/dist/components/ExchangeRateTile/ExchangeCurrencyCalculator.js +1 -1
  35. package/dist/components/ExchangeRateTile/ExchangeCurrencyCalculator.js.map +1 -1
  36. package/dist/ui-kit/Button/ButtonInner.js +1 -5
  37. package/dist/ui-kit/Button/ButtonInner.js.map +1 -1
  38. package/lib/common.css +1 -1
  39. package/lib/components/Blocks.mobile.js +2 -0
  40. package/lib/components/Blocks.mobile.js.map +1 -1
  41. package/lib/components/Calculator/CalculatorContent.d.ts +1 -3
  42. package/lib/components/Calculator/RefinancingCalculatorForm.js +2 -3
  43. package/lib/components/Calculator/RefinancingCalculatorForm.js.map +1 -1
  44. package/lib/components/Calculator/checkRefinancingSourceBookRowCommonParams.js +0 -5
  45. package/lib/components/Calculator/checkRefinancingSourceBookRowCommonParams.js.map +1 -1
  46. package/lib/components/Calculator/getRefinancingCalculatorRateParams.js +1 -1
  47. package/lib/components/Calculator/getRefinancingCalculatorRateParams.js.map +1 -1
  48. package/lib/components/Calculator/useRefinancingCalculatorParams.js +3 -0
  49. package/lib/components/Calculator/useRefinancingCalculatorParams.js.map +1 -1
  50. package/lib/components/Carousel/Carousel.d.ts +0 -1
  51. package/lib/components/Carousel/Carousel.js.map +1 -1
  52. package/lib/components/Carousel/CarouselContent.d.ts +2 -0
  53. package/lib/components/ContentPage/ContentPage.js +1 -1
  54. package/lib/components/ContentPage/ContentPage.js.map +1 -1
  55. package/lib/components/ContentPage/normalizeBlock.mobile.js +3 -5
  56. package/lib/components/ContentPage/normalizeBlock.mobile.js.map +1 -1
  57. package/lib/components/ContentPage/toMobileBlock.d.ts +2 -0
  58. package/lib/components/ContentPage/toMobileBlock.js +9 -0
  59. package/lib/components/ContentPage/toMobileBlock.js.map +1 -0
  60. package/lib/components/ErrorBlock/ErrorBlock.fixture.mobile.d.ts +7 -0
  61. package/lib/components/ErrorBlock/ErrorBlock.js +3 -4
  62. package/lib/components/ErrorBlock/ErrorBlock.js.map +1 -1
  63. package/lib/components/ErrorBlock/ErrorBlockContent.d.ts +4 -4
  64. package/lib/components/ExchangeRateTile/ExchangeCurrencyCalculator.js +1 -1
  65. package/lib/components/ExchangeRateTile/ExchangeCurrencyCalculator.js.map +1 -1
  66. package/lib/ui-kit/Button/ButtonInner.js +1 -5
  67. package/lib/ui-kit/Button/ButtonInner.js.map +1 -1
  68. package/mobile/bundle/bundle.umd.js +22 -17
  69. package/mobile/bundle/bundle.umd.min.js +1 -1
  70. package/mobile/bundle/components/Calculator/CalculatorContent.d.ts +1 -3
  71. package/mobile/bundle/components/Carousel/Carousel.d.ts +0 -1
  72. package/mobile/bundle/components/Carousel/CarouselContent.d.ts +2 -0
  73. package/mobile/bundle/components/ContentPage/toMobileBlock.d.ts +2 -0
  74. package/mobile/bundle/components/ErrorBlock/ErrorBlockContent.d.ts +4 -4
  75. package/mobile/dist/components/Blocks.js +2 -0
  76. package/mobile/dist/components/Blocks.js.map +1 -1
  77. package/mobile/dist/components/Calculator/CalculatorContent.d.ts +1 -3
  78. package/mobile/dist/components/Calculator/RefinancingCalculatorForm.js +2 -3
  79. package/mobile/dist/components/Calculator/RefinancingCalculatorForm.js.map +1 -1
  80. package/mobile/dist/components/Calculator/checkRefinancingSourceBookRowCommonParams.js +0 -5
  81. package/mobile/dist/components/Calculator/checkRefinancingSourceBookRowCommonParams.js.map +1 -1
  82. package/mobile/dist/components/Calculator/getRefinancingCalculatorRateParams.js +1 -1
  83. package/mobile/dist/components/Calculator/getRefinancingCalculatorRateParams.js.map +1 -1
  84. package/mobile/dist/components/Calculator/useRefinancingCalculatorParams.js +3 -0
  85. package/mobile/dist/components/Calculator/useRefinancingCalculatorParams.js.map +1 -1
  86. package/mobile/dist/components/Carousel/Carousel.d.ts +0 -1
  87. package/mobile/dist/components/Carousel/Carousel.js.map +1 -1
  88. package/mobile/dist/components/Carousel/CarouselContent.d.ts +2 -0
  89. package/mobile/dist/components/ContentPage/ContentPage.js +1 -1
  90. package/mobile/dist/components/ContentPage/ContentPage.js.map +1 -1
  91. package/mobile/dist/components/ContentPage/normalizeBlock.js +3 -5
  92. package/mobile/dist/components/ContentPage/normalizeBlock.js.map +1 -1
  93. package/mobile/dist/components/ContentPage/toMobileBlock.d.ts +2 -0
  94. package/mobile/dist/components/ContentPage/toMobileBlock.js +12 -0
  95. package/mobile/dist/components/ContentPage/toMobileBlock.js.map +1 -0
  96. package/mobile/dist/components/ErrorBlock/ErrorBlock.js +3 -4
  97. package/mobile/dist/components/ErrorBlock/ErrorBlock.js.map +1 -1
  98. package/mobile/dist/components/ErrorBlock/ErrorBlockContent.d.ts +4 -4
  99. package/mobile/dist/components/ExchangeRateTile/ExchangeCurrencyCalculator.js +1 -1
  100. package/mobile/dist/components/ExchangeRateTile/ExchangeCurrencyCalculator.js.map +1 -1
  101. package/mobile/dist/ui-kit/Button/ButtonInner.js +1 -5
  102. package/mobile/dist/ui-kit/Button/ButtonInner.js.map +1 -1
  103. package/mobile/lib/common.css +1 -1
  104. package/mobile/lib/components/Blocks.js +2 -0
  105. package/mobile/lib/components/Blocks.js.map +1 -1
  106. package/mobile/lib/components/Calculator/CalculatorContent.d.ts +1 -3
  107. package/mobile/lib/components/Calculator/RefinancingCalculatorForm.js +2 -3
  108. package/mobile/lib/components/Calculator/RefinancingCalculatorForm.js.map +1 -1
  109. package/mobile/lib/components/Calculator/checkRefinancingSourceBookRowCommonParams.js +0 -5
  110. package/mobile/lib/components/Calculator/checkRefinancingSourceBookRowCommonParams.js.map +1 -1
  111. package/mobile/lib/components/Calculator/getRefinancingCalculatorRateParams.js +1 -1
  112. package/mobile/lib/components/Calculator/getRefinancingCalculatorRateParams.js.map +1 -1
  113. package/mobile/lib/components/Calculator/useRefinancingCalculatorParams.js +3 -0
  114. package/mobile/lib/components/Calculator/useRefinancingCalculatorParams.js.map +1 -1
  115. package/mobile/lib/components/Carousel/Carousel.d.ts +0 -1
  116. package/mobile/lib/components/Carousel/Carousel.js.map +1 -1
  117. package/mobile/lib/components/Carousel/CarouselContent.d.ts +2 -0
  118. package/mobile/lib/components/ContentPage/ContentPage.js +1 -1
  119. package/mobile/lib/components/ContentPage/ContentPage.js.map +1 -1
  120. package/mobile/lib/components/ContentPage/normalizeBlock.js +3 -5
  121. package/mobile/lib/components/ContentPage/normalizeBlock.js.map +1 -1
  122. package/mobile/lib/components/ContentPage/toMobileBlock.d.ts +2 -0
  123. package/mobile/lib/components/ContentPage/toMobileBlock.js +9 -0
  124. package/mobile/lib/components/ContentPage/toMobileBlock.js.map +1 -0
  125. package/mobile/lib/components/ErrorBlock/ErrorBlock.js +3 -4
  126. package/mobile/lib/components/ErrorBlock/ErrorBlock.js.map +1 -1
  127. package/mobile/lib/components/ErrorBlock/ErrorBlockContent.d.ts +4 -4
  128. package/mobile/lib/components/ExchangeRateTile/ExchangeCurrencyCalculator.js +1 -1
  129. package/mobile/lib/components/ExchangeRateTile/ExchangeCurrencyCalculator.js.map +1 -1
  130. package/mobile/lib/ui-kit/Button/ButtonInner.js +1 -5
  131. package/mobile/lib/ui-kit/Button/ButtonInner.js.map +1 -1
  132. package/mobile/src/components/Blocks.ts +2 -0
  133. package/mobile/src/components/Calculator/CalculatorContent.ts +1 -3
  134. package/mobile/src/components/Calculator/RefinancingCalculatorForm.tsx +6 -9
  135. package/mobile/src/components/Calculator/checkRefinancingSourceBookRowCommonParams.ts +0 -5
  136. package/mobile/src/components/Calculator/getRefinancingCalculatorRateParams.ts +1 -1
  137. package/mobile/src/components/Calculator/useRefinancingCalculatorParams.ts +8 -0
  138. package/mobile/src/components/Carousel/Carousel.tsx +0 -1
  139. package/mobile/src/components/Carousel/CarouselContent.ts +2 -0
  140. package/mobile/src/components/ContentPage/ContentPage.tsx +1 -1
  141. package/mobile/src/components/ContentPage/normalizeBlock.ts +3 -10
  142. package/mobile/src/components/ContentPage/toMobileBlock.ts +11 -0
  143. package/mobile/src/components/ErrorBlock/ErrorBlock.example.json +2 -2
  144. package/mobile/src/components/ErrorBlock/ErrorBlock.tsx +8 -14
  145. package/mobile/src/components/ErrorBlock/ErrorBlock.ui.json +1 -1
  146. package/mobile/src/components/ErrorBlock/ErrorBlockContent.ts +4 -4
  147. package/mobile/src/components/ExchangeRateTile/ExchangeCurrencyCalculator.tsx +1 -5
  148. package/mobile/src/ui-kit/Button/ButtonInner.tsx +2 -2
  149. package/package.json +1 -1
  150. package/src/components/Blocks.mobile.ts +2 -0
  151. package/src/components/Calculator/Calculator.fixture.tsx +0 -1
  152. package/src/components/Calculator/CalculatorContent.ts +1 -3
  153. package/src/components/Calculator/RefinancingCalculatorForm.tsx +6 -9
  154. package/src/components/Calculator/checkRefinancingSourceBookRowCommonParams.ts +0 -5
  155. package/src/components/Calculator/getRefinancingCalculatorRateParams.ts +1 -1
  156. package/src/components/Calculator/useRefinancingCalculatorParams.ts +8 -0
  157. package/src/components/Carousel/Carousel.tsx +0 -1
  158. package/src/components/Carousel/CarouselContent.ts +2 -0
  159. package/src/components/ContentPage/ContentPage.tsx +1 -1
  160. package/src/components/ContentPage/normalizeBlock.mobile.ts +3 -10
  161. package/src/components/ContentPage/toMobileBlock.ts +11 -0
  162. package/src/components/ErrorBlock/ErrorBlock.example.json +2 -2
  163. package/src/components/ErrorBlock/ErrorBlock.fixture.mobile.tsx +52 -0
  164. package/src/components/ErrorBlock/ErrorBlock.fixture.tsx +4 -4
  165. package/src/components/ErrorBlock/ErrorBlock.tsx +8 -14
  166. package/src/components/ErrorBlock/ErrorBlock.ui.json +1 -1
  167. package/src/components/ErrorBlock/ErrorBlockContent.ts +4 -4
  168. package/src/components/ExchangeRateTile/ExchangeCurrencyCalculator.tsx +1 -5
  169. package/src/ui-kit/Button/ButtonInner.tsx +2 -2
@@ -26,8 +26,6 @@ export interface RefinancingCalculatorParamsViewSettings {
26
26
  isShowSalaryClient?: boolean;
27
27
  /** @title Комплексная страховая защита */
28
28
  isShowInsurance?: boolean;
29
- /** @title Получить дополнительную сумму */
30
- isShowExtraMoney?: boolean;
31
29
  }
32
30
 
33
31
  export interface DepositCalculatorParamsViewSettings {
@@ -118,7 +116,7 @@ export type BonusCalculatorParamsDef = TitleProps &
118
116
 
119
117
  /**
120
118
  * @title Калькулятор рефинансирования
121
- * @default {"calcType": "BonusCalculatorForm"}
119
+ * @default {"calcType": "RefinancingCalculatorForm"}
122
120
  */
123
121
  export type RefinancingCalculatorParamsDef = TitleProps &
124
122
  RefinancingCalculatorProps & {
@@ -54,13 +54,12 @@ export const RefinancingCalculatorForm = JSX<RefinancingCalculatorProp>(
54
54
  title: 'Остаток долга в других банках, ₽ ',
55
55
  step: 500,
56
56
  min: calculatorParams.minSum,
57
- max: calculatorParams.maxSum,
57
+ max: calculatorParams.maxSum - calculatorParams.maxSumExtra,
58
58
  ...field('moneyValue'),
59
59
  value: calculatorParams.moneyValue,
60
60
  })}
61
61
  {renderWantedSumInput({
62
62
  title: 'Ежемесячный платеж в других банках, ₽',
63
- isShowItems: false,
64
63
  step: 500,
65
64
  min: calculatorParams.minSumOld,
66
65
  max: calculatorParams.maxSumOld,
@@ -131,12 +130,10 @@ const renderCreditParamsForm = (
131
130
  value={params.isInsurance}
132
131
  />
133
132
  ) : null}
134
- {params.isShowExtraMoney ? (
135
- <Checkbox
136
- text="Получить дополнительную сумму"
137
- {...field('isExtraMoney')}
138
- value={params.isExtraMoney}
139
- />
140
- ) : null}
133
+ <Checkbox
134
+ text="Получить дополнительную сумму"
135
+ {...field('isExtraMoney')}
136
+ value={params.isExtraMoney}
137
+ />
141
138
  </div>
142
139
  );
@@ -25,11 +25,6 @@ export const checkRefinancingSourceBookRowCommonParams = (props: CheckSourceBook
25
25
  ...props,
26
26
  fieldKey: 'isInsurance',
27
27
  viewSettingFieldKey: 'isShowInsurance',
28
- }) &&
29
- checkRowParam({
30
- ...props,
31
- fieldKey: 'isExtraMoney',
32
- viewSettingFieldKey: 'isShowExtraMoney',
33
28
  });
34
29
 
35
30
  const checkRowParam = ({
@@ -33,7 +33,7 @@ export const getRefinancingCalculatorRateParams = ({
33
33
  userInputParams,
34
34
  paramsViewSettings,
35
35
  }) &&
36
- checkRangeByKeys(moneyValue, ['minSum', 'maxSum'], row) &&
36
+ checkRangeByKeys(moneyValue + moneyExtra, ['minSum', 'maxSum'], row) &&
37
37
  checkRangeByKeys(oldMonthlyPayment, ['minSumOld', 'maxSumOld'], row) &&
38
38
  checkRangeByKeys(moneyExtra, ['minSumExtra', 'maxSumExtra'], row) &&
39
39
  checkRangeByKeys(monthsValue, ['minMonths', 'maxMonths'], row),
@@ -78,6 +78,12 @@ export const useRefinancingCalculatorParams = (
78
78
  rateRows,
79
79
  );
80
80
 
81
+ const { minSumOld, maxSumOld } = getLimitRangeByKeys(
82
+ ['minSumOld', 'maxSumOld'],
83
+ sourceBookLimitParams,
84
+ rateRows,
85
+ );
86
+
81
87
  const { minMonths, maxMonths } = getLimitRangeByKeys(
82
88
  ['minMonths', 'maxMonths'],
83
89
  sourceBookLimitParams,
@@ -104,6 +110,8 @@ export const useRefinancingCalculatorParams = (
104
110
  ...userInputParams,
105
111
  minSum,
106
112
  maxSum,
113
+ minSumOld,
114
+ maxSumOld,
107
115
  minMonths,
108
116
  maxMonths,
109
117
  moneyValue,
@@ -13,7 +13,6 @@ import { renderCarouselCards } from './renderCarouselCards';
13
13
 
14
14
  export interface CarouselProps extends CarouselContent, UniBlockProps {
15
15
  itemCount?: number;
16
- showDots?: boolean;
17
16
  }
18
17
 
19
18
  export const Carousel: JSXBlock<CarouselProps> = JSX<CarouselProps>(
@@ -23,5 +23,7 @@ export type CarouselContent = UniBlockContent & {
23
23
  isGap?: boolean;
24
24
  /** @title Не показывать контур на карточках */
25
25
  noCardBorder?: boolean;
26
+ /** @title Показывать навигационные точки */
27
+ showDots?: boolean;
26
28
  cardSize?: CardSizeMode;
27
29
  };
@@ -44,7 +44,7 @@ export const ContentPage: JSXBlock<ContentPageProps> = JSX<ContentPageProps>(
44
44
  {renderBlocksList(slots?.header, { ...options, slotName: 'header' })}
45
45
  </div>
46
46
  ) : null}
47
- <div className="container @lg:grid @lg:grid-cols-12 @lg:gap-2xs">
47
+ <div className="container space-y-px @lg:space-y-0 @lg:grid @lg:grid-cols-12 @lg:gap-2xs">
48
48
  {renderChildren({ block: data, options, extraProps: { className: 'scroll-mt-12' } })}
49
49
  {renderBlocksList(slots?.footer, { ...options, slotName: 'footer' })}
50
50
  </div>
@@ -1,19 +1,12 @@
1
1
  import type { BlocksRegistry } from '../../model/BlocksRegistry';
2
2
  import type { BlockDef, Slot } from '../../model/ContentPageDef';
3
3
  import { mapSlot } from './mapSlot';
4
+ import { toMobileBlock } from './toMobileBlock';
4
5
 
5
6
  export function normalizeBlock<S extends Slot>(block?: S, blocksRegistry?: BlocksRegistry): S {
6
- const { mobile, ...desktop } = (block || {}) as BlockDef;
7
- const result = mobile
8
- ? Object.assign(
9
- {},
10
- desktop,
11
- mobile.style ? { style: mobile.style } : {},
12
- mobile.content ? { content: mobile.content } : {},
13
- )
14
- : block;
7
+ const { mobile } = (block || {}) as BlockDef;
15
8
 
16
- return mapSlot(filterBlocks(blocksRegistry))(result || {}) as S;
9
+ return mapSlot(filterBlocks(blocksRegistry))((mobile ? toMobileBlock(block) : block) || {}) as S;
17
10
  }
18
11
 
19
12
  const filterBlocks =
@@ -0,0 +1,11 @@
1
+ import type { BlockDef } from '../../model/ContentPageDef';
2
+
3
+ export function toMobileBlock(block: BlockDef = {}): BlockDef {
4
+ const { mobile, ...desktop } = block;
5
+
6
+ return {
7
+ ...desktop,
8
+ ...(mobile?.style ? { style: mobile.style } : {}),
9
+ ...(mobile?.content ? { content: mobile.content } : {}),
10
+ };
11
+ }
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "content": {
3
3
  "title": "Заголовок",
4
- "subtitle": "Описание",
4
+ "description": "Описание",
5
5
  "error": {
6
- "errorContentType": "Code",
6
+ "contentType": "Code",
7
7
  "code": "404",
8
8
  "image": {
9
9
  "format": "webp",
@@ -10,34 +10,28 @@ import { Headline } from '../Headline/Headline';
10
10
  export interface ErrorBlockProps extends ErrorBlockContent, UniBlockProps {}
11
11
 
12
12
  const renderErrorContent = (error: ErrorBlockContent['error']) => {
13
- if (error?.errorContentType === 'Image' && error?.image) {
13
+ if (error?.contentType === 'Image' && error?.image) {
14
14
  return <Img image={error.image} />;
15
15
  }
16
16
 
17
- if (error?.errorContentType === 'Code' && error.code) {
17
+ if (error?.contentType === 'Code' && error.code) {
18
18
  return <div className="font-mohave text-title-extra gradient-color-text">{error.code}</div>;
19
19
  }
20
20
 
21
21
  return null;
22
22
  };
23
23
 
24
- const getErrorBlockStyle = (text: string) => (text ? 'py-20' : 'mb-16 mt-24');
25
-
26
24
  export const ErrorBlock = JSX<ErrorBlockProps>(
27
- ({ className = '', title, subtitle, error, button, ...rest }) => (
25
+ ({ className = '', title, description, error, button, ...rest }) => (
28
26
  <BlockWrapper
29
- className={style('flex flex-col gap-lg justify-center items-center', className)}
30
- defaultPadding={style('py-xs', getErrorBlockStyle(button?.text as string))}
27
+ className={style('flex flex-col gap-2xl justify-center items-center', className)}
28
+ defaultPadding={style('p-6xl')}
31
29
  version="transparent"
32
30
  {...rest}
33
31
  >
34
- <div className="flex justify-center py-20">{renderErrorContent(error)}</div>
35
- <Headline title={title} description={subtitle} headlineVersion="XL" isEmbedded={true} />
36
- {button?.text ? (
37
- <Button className="py-4 px-9" version={button?.version} {...button}>
38
- {button.text}
39
- </Button>
40
- ) : null}
32
+ <div className="flex justify-center">{renderErrorContent(error)}</div>
33
+ <Headline title={title} description={description} headlineVersion="XL" isEmbedded={true} />
34
+ {button?.text ? <Button version={button?.version} text={button?.text} {...button} /> : null}
41
35
  </BlockWrapper>
42
36
  ),
43
37
  );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "content": {
3
3
  "error": {
4
- "errorContentType": {
4
+ "contentType": {
5
5
  "ui:widget": "hidden"
6
6
  },
7
7
  "image": {
@@ -1,4 +1,4 @@
1
- import type { SubtitleProps, TitleProps } from '../../model/HeadlineType';
1
+ import type { DescriptionProps, TitleProps } from '../../model/HeadlineType';
2
2
  import type { UniBlockContent } from '../../model/JSXBlock';
3
3
  import type { ImageContent } from '../../ui-kit/Img/ImgProps';
4
4
  import type { ButtonContent } from '../../ui-kit/Button/ButtonContent';
@@ -8,14 +8,14 @@ import type { ButtonContent } from '../../ui-kit/Button/ButtonContent';
8
8
  */
9
9
  export type ErrorImageDef = ImageContent & {
10
10
  /** @default Image */
11
- errorContentType: 'Image';
11
+ contentType: 'Image';
12
12
  };
13
13
 
14
14
  /**
15
15
  * @title Код ошибки
16
16
  */
17
17
  export type ErrorCodeDef = {
18
- errorContentType: 'Code';
18
+ contentType: 'Code';
19
19
  code?: ErrorType;
20
20
  };
21
21
 
@@ -42,7 +42,7 @@ export type ErrorType =
42
42
  */
43
43
  export type ErrorBlockContent = UniBlockContent &
44
44
  TitleProps &
45
- SubtitleProps & {
45
+ DescriptionProps & {
46
46
  error?: ErrorContentDef;
47
47
  /** @title Кнопка */
48
48
  button?: ButtonContent;
@@ -71,11 +71,7 @@ export const ExchangeCurrencyCalculator = JSX<ExchangeCurrencyCalculatorProps>(
71
71
  calcState.selectSell,
72
72
  ),
73
73
  })}
74
- {button?.text ? (
75
- <Button className="py-4 px-9" version={button?.version} {...button}>
76
- {button.text}
77
- </Button>
78
- ) : null}
74
+ {button?.text ? <Button text={button.text} version={button?.version} {...button} /> : null}
79
75
  </div>
80
76
  );
81
77
  },
@@ -30,11 +30,11 @@ const getButtonStyle = (props: ButtonContent) => {
30
30
 
31
31
  const withTextStyle = `${aboveText ? 'py-2.5 px-9' : 'py-4 px-9'}`;
32
32
 
33
- return [
33
+ return style(
34
34
  'group/btn items-center justify-center',
35
35
  isWithText(props) ? withTextStyle : 'h-12 w-12',
36
36
  rounded ? 'rounded-full' : '',
37
- ].join(' ');
37
+ );
38
38
  };
39
39
 
40
40
  const isWithText = ({ text, aboveText, appendLeft }: ButtonProps) =>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.13.16",
3
+ "version": "0.13.18",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -16,6 +16,7 @@ import { CarouselProgramsCard } from './CarouselProgramsCard/CarouselProgramsCar
16
16
  import { CarouselRecommendationCard } from './CarouselRecommendationCard/CarouselRecommendationCard';
17
17
  import { CarouselTariffsCard } from './CarouselTariffsCard/CarouselTariffsCard';
18
18
  import { ComparisonTable } from './ComparisonTable/ComparisonTable';
19
+ import { ErrorBlock } from './ErrorBlock/ErrorBlock';
19
20
  import { ExchangeRateTile } from './ExchangeRateTile/ExchangeRateTile';
20
21
  import { Footer } from './Footer/Footer';
21
22
  import { Header } from './Header/Header';
@@ -59,6 +60,7 @@ export const Blocks: BlocksRegistry = {
59
60
  CarouselRecommendationCard,
60
61
  CarouselTariffsCard,
61
62
  ComparisonTable,
63
+ ErrorBlock,
62
64
  ExchangeRateTile,
63
65
  Footer,
64
66
  Header,
@@ -65,7 +65,6 @@ const REFINANCING_CALCULATOR_BLOCK: RefinancingCalculatorParamsDef = {
65
65
  calcType: 'RefinancingCalculatorForm',
66
66
  paramsViewSettings: {
67
67
  isShowSalaryClient: true,
68
- isShowExtraMoney: true,
69
68
  isShowInsurance: true,
70
69
  },
71
70
  buttons: [
@@ -26,8 +26,6 @@ export interface RefinancingCalculatorParamsViewSettings {
26
26
  isShowSalaryClient?: boolean;
27
27
  /** @title Комплексная страховая защита */
28
28
  isShowInsurance?: boolean;
29
- /** @title Получить дополнительную сумму */
30
- isShowExtraMoney?: boolean;
31
29
  }
32
30
 
33
31
  export interface DepositCalculatorParamsViewSettings {
@@ -118,7 +116,7 @@ export type BonusCalculatorParamsDef = TitleProps &
118
116
 
119
117
  /**
120
118
  * @title Калькулятор рефинансирования
121
- * @default {"calcType": "BonusCalculatorForm"}
119
+ * @default {"calcType": "RefinancingCalculatorForm"}
122
120
  */
123
121
  export type RefinancingCalculatorParamsDef = TitleProps &
124
122
  RefinancingCalculatorProps & {
@@ -54,13 +54,12 @@ export const RefinancingCalculatorForm = JSX<RefinancingCalculatorProp>(
54
54
  title: 'Остаток долга в других банках, ₽ ',
55
55
  step: 500,
56
56
  min: calculatorParams.minSum,
57
- max: calculatorParams.maxSum,
57
+ max: calculatorParams.maxSum - calculatorParams.maxSumExtra,
58
58
  ...field('moneyValue'),
59
59
  value: calculatorParams.moneyValue,
60
60
  })}
61
61
  {renderWantedSumInput({
62
62
  title: 'Ежемесячный платеж в других банках, ₽',
63
- isShowItems: false,
64
63
  step: 500,
65
64
  min: calculatorParams.minSumOld,
66
65
  max: calculatorParams.maxSumOld,
@@ -131,12 +130,10 @@ const renderCreditParamsForm = (
131
130
  value={params.isInsurance}
132
131
  />
133
132
  ) : null}
134
- {params.isShowExtraMoney ? (
135
- <Checkbox
136
- text="Получить дополнительную сумму"
137
- {...field('isExtraMoney')}
138
- value={params.isExtraMoney}
139
- />
140
- ) : null}
133
+ <Checkbox
134
+ text="Получить дополнительную сумму"
135
+ {...field('isExtraMoney')}
136
+ value={params.isExtraMoney}
137
+ />
141
138
  </div>
142
139
  );
@@ -25,11 +25,6 @@ export const checkRefinancingSourceBookRowCommonParams = (props: CheckSourceBook
25
25
  ...props,
26
26
  fieldKey: 'isInsurance',
27
27
  viewSettingFieldKey: 'isShowInsurance',
28
- }) &&
29
- checkRowParam({
30
- ...props,
31
- fieldKey: 'isExtraMoney',
32
- viewSettingFieldKey: 'isShowExtraMoney',
33
28
  });
34
29
 
35
30
  const checkRowParam = ({
@@ -33,7 +33,7 @@ export const getRefinancingCalculatorRateParams = ({
33
33
  userInputParams,
34
34
  paramsViewSettings,
35
35
  }) &&
36
- checkRangeByKeys(moneyValue, ['minSum', 'maxSum'], row) &&
36
+ checkRangeByKeys(moneyValue + moneyExtra, ['minSum', 'maxSum'], row) &&
37
37
  checkRangeByKeys(oldMonthlyPayment, ['minSumOld', 'maxSumOld'], row) &&
38
38
  checkRangeByKeys(moneyExtra, ['minSumExtra', 'maxSumExtra'], row) &&
39
39
  checkRangeByKeys(monthsValue, ['minMonths', 'maxMonths'], row),
@@ -78,6 +78,12 @@ export const useRefinancingCalculatorParams = (
78
78
  rateRows,
79
79
  );
80
80
 
81
+ const { minSumOld, maxSumOld } = getLimitRangeByKeys(
82
+ ['minSumOld', 'maxSumOld'],
83
+ sourceBookLimitParams,
84
+ rateRows,
85
+ );
86
+
81
87
  const { minMonths, maxMonths } = getLimitRangeByKeys(
82
88
  ['minMonths', 'maxMonths'],
83
89
  sourceBookLimitParams,
@@ -104,6 +110,8 @@ export const useRefinancingCalculatorParams = (
104
110
  ...userInputParams,
105
111
  minSum,
106
112
  maxSum,
113
+ minSumOld,
114
+ maxSumOld,
107
115
  minMonths,
108
116
  maxMonths,
109
117
  moneyValue,
@@ -13,7 +13,6 @@ import { renderCarouselCards } from './renderCarouselCards';
13
13
 
14
14
  export interface CarouselProps extends CarouselContent, UniBlockProps {
15
15
  itemCount?: number;
16
- showDots?: boolean;
17
16
  }
18
17
 
19
18
  export const Carousel: JSXBlock<CarouselProps> = JSX<CarouselProps>(
@@ -23,5 +23,7 @@ export type CarouselContent = UniBlockContent & {
23
23
  isGap?: boolean;
24
24
  /** @title Не показывать контур на карточках */
25
25
  noCardBorder?: boolean;
26
+ /** @title Показывать навигационные точки */
27
+ showDots?: boolean;
26
28
  cardSize?: CardSizeMode;
27
29
  };
@@ -44,7 +44,7 @@ export const ContentPage: JSXBlock<ContentPageProps> = JSX<ContentPageProps>(
44
44
  {renderBlocksList(slots?.header, { ...options, slotName: 'header' })}
45
45
  </div>
46
46
  ) : null}
47
- <div className="container @lg:grid @lg:grid-cols-12 @lg:gap-2xs">
47
+ <div className="container space-y-px @lg:space-y-0 @lg:grid @lg:grid-cols-12 @lg:gap-2xs">
48
48
  {renderChildren({ block: data, options, extraProps: { className: 'scroll-mt-12' } })}
49
49
  {renderBlocksList(slots?.footer, { ...options, slotName: 'footer' })}
50
50
  </div>
@@ -1,19 +1,12 @@
1
1
  import type { BlocksRegistry } from '../../model/BlocksRegistry';
2
2
  import type { BlockDef, Slot } from '../../model/ContentPageDef';
3
3
  import { mapSlot } from './mapSlot';
4
+ import { toMobileBlock } from './toMobileBlock';
4
5
 
5
6
  export function normalizeBlock<S extends Slot>(block?: S, blocksRegistry?: BlocksRegistry): S {
6
- const { mobile, ...desktop } = (block || {}) as BlockDef;
7
- const result = mobile
8
- ? Object.assign(
9
- {},
10
- desktop,
11
- mobile.style ? { style: mobile.style } : {},
12
- mobile.content ? { content: mobile.content } : {},
13
- )
14
- : block;
7
+ const { mobile } = (block || {}) as BlockDef;
15
8
 
16
- return mapSlot(filterBlocks(blocksRegistry))(result || {}) as S;
9
+ return mapSlot(filterBlocks(blocksRegistry))((mobile ? toMobileBlock(block) : block) || {}) as S;
17
10
  }
18
11
 
19
12
  const filterBlocks =
@@ -0,0 +1,11 @@
1
+ import type { BlockDef } from '../../model/ContentPageDef';
2
+
3
+ export function toMobileBlock(block: BlockDef = {}): BlockDef {
4
+ const { mobile, ...desktop } = block;
5
+
6
+ return {
7
+ ...desktop,
8
+ ...(mobile?.style ? { style: mobile.style } : {}),
9
+ ...(mobile?.content ? { content: mobile.content } : {}),
10
+ };
11
+ }
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "content": {
3
3
  "title": "Заголовок",
4
- "subtitle": "Описание",
4
+ "description": "Описание",
5
5
  "error": {
6
- "errorContentType": "Code",
6
+ "contentType": "Code",
7
7
  "code": "404",
8
8
  "image": {
9
9
  "format": "webp",
@@ -0,0 +1,52 @@
1
+ import '../../setup-fixture';
2
+
3
+ import type { Picture } from '../../model/Picture';
4
+ import type { ButtonProps } from '../../ui-kit/Button/ButtonProps';
5
+ import { ErrorBlock } from './ErrorBlock';
6
+
7
+ const image: Picture = {
8
+ src: 'error.png',
9
+ format: 'webp',
10
+ alt: 'Ошибка',
11
+ size: {
12
+ width: 460,
13
+ height: 294,
14
+ },
15
+ };
16
+
17
+ const buttonPrimary: ButtonProps = {
18
+ href: '/credit-cards',
19
+ text: 'Вернуться на главную',
20
+ target: '_blank',
21
+ version: 'primary',
22
+ };
23
+
24
+ export default {
25
+ default: (
26
+ <div className="container grid grid-cols-12">
27
+ <ErrorBlock
28
+ className="col-span-12"
29
+ title="Страница не найдена"
30
+ description="Возможно неправильно набран адрес или такой странице не существует"
31
+ error={{
32
+ contentType: 'Code',
33
+ code: '404',
34
+ }}
35
+ button={buttonPrimary}
36
+ />
37
+ </div>
38
+ ),
39
+ 'error-with-image': (
40
+ <div className="container grid grid-cols-12">
41
+ <ErrorBlock
42
+ className="col-span-12"
43
+ title="Ваш браузер устарел"
44
+ description="Чтобы открыть наш сайт обновите Ваш браузер или скачайте обновленные версии браузеров"
45
+ error={{
46
+ contentType: 'Image',
47
+ image: image,
48
+ }}
49
+ />
50
+ </div>
51
+ ),
52
+ };
@@ -27,9 +27,9 @@ export default {
27
27
  <ErrorBlock
28
28
  className="col-span-12"
29
29
  title="Страница не найдена"
30
- subtitle="Возможно неправильно набран адрес или такой странице не существует"
30
+ description="Возможно неправильно набран адрес или такой странице не существует"
31
31
  error={{
32
- errorContentType: 'Code',
32
+ contentType: 'Code',
33
33
  code: '404',
34
34
  }}
35
35
  button={buttonPrimary}
@@ -41,9 +41,9 @@ export default {
41
41
  <ErrorBlock
42
42
  className="col-span-12"
43
43
  title="Ваш браузер устарел"
44
- subtitle="Чтобы открыть наш сайт обновите Ваш браузер или скачайте обновленные версии браузеров"
44
+ description="Чтобы открыть наш сайт обновите Ваш браузер или скачайте обновленные версии браузеров"
45
45
  error={{
46
- errorContentType: 'Image',
46
+ contentType: 'Image',
47
47
  image: image,
48
48
  }}
49
49
  />
@@ -10,34 +10,28 @@ import { Headline } from '../Headline/Headline';
10
10
  export interface ErrorBlockProps extends ErrorBlockContent, UniBlockProps {}
11
11
 
12
12
  const renderErrorContent = (error: ErrorBlockContent['error']) => {
13
- if (error?.errorContentType === 'Image' && error?.image) {
13
+ if (error?.contentType === 'Image' && error?.image) {
14
14
  return <Img image={error.image} />;
15
15
  }
16
16
 
17
- if (error?.errorContentType === 'Code' && error.code) {
17
+ if (error?.contentType === 'Code' && error.code) {
18
18
  return <div className="font-mohave text-title-extra gradient-color-text">{error.code}</div>;
19
19
  }
20
20
 
21
21
  return null;
22
22
  };
23
23
 
24
- const getErrorBlockStyle = (text: string) => (text ? 'py-20' : 'mb-16 mt-24');
25
-
26
24
  export const ErrorBlock = JSX<ErrorBlockProps>(
27
- ({ className = '', title, subtitle, error, button, ...rest }) => (
25
+ ({ className = '', title, description, error, button, ...rest }) => (
28
26
  <BlockWrapper
29
- className={style('flex flex-col gap-lg justify-center items-center', className)}
30
- defaultPadding={style('py-xs', getErrorBlockStyle(button?.text as string))}
27
+ className={style('flex flex-col gap-2xl justify-center items-center', className)}
28
+ defaultPadding={style('p-6xl')}
31
29
  version="transparent"
32
30
  {...rest}
33
31
  >
34
- <div className="flex justify-center py-20">{renderErrorContent(error)}</div>
35
- <Headline title={title} description={subtitle} headlineVersion="XL" isEmbedded={true} />
36
- {button?.text ? (
37
- <Button className="py-4 px-9" version={button?.version} {...button}>
38
- {button.text}
39
- </Button>
40
- ) : null}
32
+ <div className="flex justify-center">{renderErrorContent(error)}</div>
33
+ <Headline title={title} description={description} headlineVersion="XL" isEmbedded={true} />
34
+ {button?.text ? <Button version={button?.version} text={button?.text} {...button} /> : null}
41
35
  </BlockWrapper>
42
36
  ),
43
37
  );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "content": {
3
3
  "error": {
4
- "errorContentType": {
4
+ "contentType": {
5
5
  "ui:widget": "hidden"
6
6
  },
7
7
  "image": {