@redneckz/wildless-cms-uni-blocks 0.14.986 → 0.14.988

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 (78) hide show
  1. package/bundle/bundle.umd.js +68 -35
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/components/CalculatorCredit/utils.d.ts +12 -0
  4. package/bundle/components/CreditForm/getCreditInfo.d.ts +4 -0
  5. package/dist/components/CalculatorCredit/CalculatorCredit.js +4 -14
  6. package/dist/components/CalculatorCredit/CalculatorCredit.js.map +1 -1
  7. package/dist/components/CalculatorCredit/utils.d.ts +12 -0
  8. package/dist/components/CalculatorCredit/utils.js +18 -0
  9. package/dist/components/CalculatorCredit/utils.js.map +1 -0
  10. package/dist/components/CreditForm/PendingStatusContent.js +5 -3
  11. package/dist/components/CreditForm/PendingStatusContent.js.map +1 -1
  12. package/dist/components/CreditForm/SuccessStatusContent.js +4 -2
  13. package/dist/components/CreditForm/SuccessStatusContent.js.map +1 -1
  14. package/dist/components/CreditForm/getCreditInfo.d.ts +4 -0
  15. package/dist/components/CreditForm/getCreditInfo.js +21 -0
  16. package/dist/components/CreditForm/getCreditInfo.js.map +1 -0
  17. package/dist/retail/components/Fields/CreditCalcField.js +16 -5
  18. package/dist/retail/components/Fields/CreditCalcField.js.map +1 -1
  19. package/lib/components/CalculatorCredit/CalculatorCredit.js +4 -14
  20. package/lib/components/CalculatorCredit/CalculatorCredit.js.map +1 -1
  21. package/lib/components/CalculatorCredit/utils.d.ts +12 -0
  22. package/lib/components/CalculatorCredit/utils.js +15 -0
  23. package/lib/components/CalculatorCredit/utils.js.map +1 -0
  24. package/lib/components/CreditForm/PendingStatusContent.js +5 -3
  25. package/lib/components/CreditForm/PendingStatusContent.js.map +1 -1
  26. package/lib/components/CreditForm/SuccessStatusContent.js +4 -2
  27. package/lib/components/CreditForm/SuccessStatusContent.js.map +1 -1
  28. package/lib/components/CreditForm/getCreditInfo.d.ts +4 -0
  29. package/lib/components/CreditForm/getCreditInfo.js +18 -0
  30. package/lib/components/CreditForm/getCreditInfo.js.map +1 -0
  31. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +1 -1
  32. package/lib/retail/components/Fields/CreditCalcField.js +17 -6
  33. package/lib/retail/components/Fields/CreditCalcField.js.map +1 -1
  34. package/mobile/bundle/bundle.umd.js +68 -35
  35. package/mobile/bundle/bundle.umd.min.js +1 -1
  36. package/mobile/bundle/components/CalculatorCredit/utils.d.ts +12 -0
  37. package/mobile/bundle/components/CreditForm/getCreditInfo.d.ts +4 -0
  38. package/mobile/dist/components/CalculatorCredit/CalculatorCredit.js +4 -14
  39. package/mobile/dist/components/CalculatorCredit/CalculatorCredit.js.map +1 -1
  40. package/mobile/dist/components/CalculatorCredit/utils.d.ts +12 -0
  41. package/mobile/dist/components/CalculatorCredit/utils.js +18 -0
  42. package/mobile/dist/components/CalculatorCredit/utils.js.map +1 -0
  43. package/mobile/dist/components/CreditForm/PendingStatusContent.js +5 -3
  44. package/mobile/dist/components/CreditForm/PendingStatusContent.js.map +1 -1
  45. package/mobile/dist/components/CreditForm/SuccessStatusContent.js +4 -2
  46. package/mobile/dist/components/CreditForm/SuccessStatusContent.js.map +1 -1
  47. package/mobile/dist/components/CreditForm/getCreditInfo.d.ts +4 -0
  48. package/mobile/dist/components/CreditForm/getCreditInfo.js +21 -0
  49. package/mobile/dist/components/CreditForm/getCreditInfo.js.map +1 -0
  50. package/mobile/dist/retail/components/Fields/CreditCalcField.js +16 -5
  51. package/mobile/dist/retail/components/Fields/CreditCalcField.js.map +1 -1
  52. package/mobile/lib/components/CalculatorCredit/CalculatorCredit.js +4 -14
  53. package/mobile/lib/components/CalculatorCredit/CalculatorCredit.js.map +1 -1
  54. package/mobile/lib/components/CalculatorCredit/utils.d.ts +12 -0
  55. package/mobile/lib/components/CalculatorCredit/utils.js +15 -0
  56. package/mobile/lib/components/CalculatorCredit/utils.js.map +1 -0
  57. package/mobile/lib/components/CreditForm/PendingStatusContent.js +5 -3
  58. package/mobile/lib/components/CreditForm/PendingStatusContent.js.map +1 -1
  59. package/mobile/lib/components/CreditForm/SuccessStatusContent.js +4 -2
  60. package/mobile/lib/components/CreditForm/SuccessStatusContent.js.map +1 -1
  61. package/mobile/lib/components/CreditForm/getCreditInfo.d.ts +4 -0
  62. package/mobile/lib/components/CreditForm/getCreditInfo.js +18 -0
  63. package/mobile/lib/components/CreditForm/getCreditInfo.js.map +1 -0
  64. package/mobile/lib/retail/components/Fields/CreditCalcField.js +17 -6
  65. package/mobile/lib/retail/components/Fields/CreditCalcField.js.map +1 -1
  66. package/mobile/src/components/CalculatorCredit/CalculatorCredit.tsx +4 -21
  67. package/mobile/src/components/CalculatorCredit/utils.ts +20 -0
  68. package/mobile/src/components/CreditForm/PendingStatusContent.tsx +6 -3
  69. package/mobile/src/components/CreditForm/SuccessStatusContent.tsx +5 -2
  70. package/mobile/src/components/CreditForm/getCreditInfo.ts +17 -0
  71. package/mobile/src/retail/components/Fields/CreditCalcField.tsx +23 -7
  72. package/package.json +1 -1
  73. package/src/components/CalculatorCredit/CalculatorCredit.tsx +4 -21
  74. package/src/components/CalculatorCredit/utils.ts +20 -0
  75. package/src/components/CreditForm/PendingStatusContent.tsx +6 -3
  76. package/src/components/CreditForm/SuccessStatusContent.tsx +5 -2
  77. package/src/components/CreditForm/getCreditInfo.ts +17 -0
  78. package/src/retail/components/Fields/CreditCalcField.tsx +23 -7
@@ -1,9 +1,12 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { FormStatus } from '../../retail/components/FormStatus/FormStatus';
3
3
  import { useRetailFormStore } from '../../retail/hooks/useRetailFormStore';
4
+ import { getCreditInfo } from './getCreditInfo';
4
5
 
5
6
  export const PendingStatusContent = JSX(({ onExpire }: { onExpire: () => void }) => {
6
- const { statusInfo } = useRetailFormStore();
7
+ const { statusInfo, programId } = useRetailFormStore();
8
+
9
+ const creditInfo = getCreditInfo(programId);
7
10
 
8
11
  return (
9
12
  <FormStatus
@@ -14,11 +17,11 @@ export const PendingStatusContent = JSX(({ onExpire }: { onExpire: () => void })
14
17
  sectionInfo={[
15
18
  {
16
19
  label: 'Название продукта',
17
- description: 'Кредит на любые цели',
20
+ description: creditInfo.name,
18
21
  },
19
22
  {
20
23
  label: 'Цель кредита',
21
- description: 'На любые цели',
24
+ description: creditInfo.description,
22
25
  },
23
26
  {
24
27
  label: 'Сумма',
@@ -1,9 +1,12 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { FormStatus } from '../../retail/components/FormStatus/FormStatus';
3
3
  import { useRetailFormStore } from '../../retail/hooks/useRetailFormStore';
4
+ import { getCreditInfo } from './getCreditInfo';
4
5
 
5
6
  export const SuccessStatusContent = JSX(() => {
6
- const { statusInfo } = useRetailFormStore();
7
+ const { statusInfo, programId } = useRetailFormStore();
8
+
9
+ const creditInfo = getCreditInfo(programId);
7
10
 
8
11
  return (
9
12
  <FormStatus
@@ -12,7 +15,7 @@ export const SuccessStatusContent = JSX(() => {
12
15
  sectionInfo={[
13
16
  {
14
17
  label: 'Название продукта',
15
- description: 'Кредит на любые цели',
18
+ description: creditInfo.name,
16
19
  },
17
20
  {
18
21
  label: 'Ставка',
@@ -0,0 +1,17 @@
1
+ export const getCreditInfo = (programmId: string | null) => {
2
+ switch (programmId) {
3
+ case '11': {
4
+ return {
5
+ name: 'Потребительский кредит на рефинансирование',
6
+ description: 'Погашение основного долга по кредиту, иные цели и оплату страхования',
7
+ };
8
+ }
9
+ case '10':
10
+ default: {
11
+ return {
12
+ name: 'Кредит на любые цели',
13
+ description: 'На любые цели',
14
+ };
15
+ }
16
+ }
17
+ };
@@ -1,33 +1,49 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
2
+ import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { CalculatorCredit } from '../../../components/CalculatorCredit/CalculatorCredit';
4
4
  import {
5
5
  type CreditCalculatorUserInputParams,
6
6
  type CreditDefaultParams,
7
7
  } from '../../../components/CalculatorCredit/CalculatorCreditContent';
8
+ import { getCalcParams } from '../../../components/CalculatorCredit/utils';
8
9
  import { type CustomFieldProps } from '../../../ui-kit/FormField/CustomFieldProps';
10
+ import { Loader } from '../../../ui-kit/Loader/Loader';
9
11
 
10
12
  const FIELD_NAME = 'calculator';
11
13
 
12
14
  export const CreditCalcField = JSX<CustomFieldProps>(({ field, params }) => {
15
+ const [defaultParams, setDefaultParams] = useState<CreditDefaultParams>();
13
16
  const calcValue = field(FIELD_NAME)?.value;
14
- const defaultParams = calcValue
15
- ? defaultValueAdapter(field(FIELD_NAME).value as CreditCalculatorUserInputParams)
16
- : params?.calcData?.defaultParams;
17
- const defaultCalcSum = params?.calcData?.defaultParams?.sum ?? 0;
18
17
 
19
18
  const handleChange = useCallback((_: CreditCalculatorUserInputParams) => {
20
19
  field(FIELD_NAME).onChange?.(_);
21
20
  }, []);
22
21
 
23
- return (
22
+ useEffect(() => {
23
+ if (params?.calcData?.defaultParams) {
24
+ setDefaultParams(
25
+ calcValue
26
+ ? defaultValueAdapter(field(FIELD_NAME).value as CreditCalculatorUserInputParams)
27
+ : (params?.calcData?.defaultParams as CreditDefaultParams),
28
+ );
29
+ }
30
+ }, [params?.calcData?.defaultParams]);
31
+
32
+ useEffect(() => {
33
+ if (defaultParams) {
34
+ handleChange(getCalcParams(defaultParams));
35
+ }
36
+ }, [defaultParams]);
37
+
38
+ return defaultParams ? (
24
39
  <CalculatorCredit
25
- key={defaultCalcSum}
26
40
  {...params?.calcData}
27
41
  defaultParams={defaultParams}
28
42
  padding="p-0"
29
43
  onChange={handleChange}
30
44
  />
45
+ ) : (
46
+ <Loader />
31
47
  );
32
48
  });
33
49
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.14.986",
3
+ "version": "0.14.988",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -2,15 +2,10 @@
2
2
  import { useCallback, useEffect } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { type JSONRefObject } from '../../data/JSONRefObject';
4
4
  import { useForm, type FormFieldRegisterer } from '../../hooks/useForm/useForm';
5
- import { DEFAULT_MONTHS } from '../../ui-kit/Calculator/calculatorConstants';
6
5
  import { CalculatorLayout } from '../../ui-kit/Calculator/CalculatorLayout';
7
6
  import { CalculatorStyle } from '../../ui-kit/Calculator/CalculatorStyle';
8
7
  import { CalculatorValue } from '../../ui-kit/Calculator/CalculatorValue';
9
8
  import { getDefaultParamsMin } from '../../ui-kit/Calculator/getDefaultParams';
10
- import {
11
- getMoneyDefaultValue,
12
- getMonthsDefaultValue,
13
- } from '../../ui-kit/Calculator/getDefaultValues';
14
9
  import { renderFootnote } from '../../ui-kit/Calculator/renderFootnote';
15
10
  import { renderMonthsInput } from '../../ui-kit/Calculator/renderMonthsInput';
16
11
  import { renderPaymentType } from '../../ui-kit/Calculator/renderPaymentType';
@@ -32,8 +27,7 @@ import {
32
27
  } from './CalculatorCreditContent';
33
28
  import { getCreditCalculatorParams } from './getCreditCalculatorParams';
34
29
  import { isDefaultParams } from './isDefaultParams';
35
-
36
- const CREDIT_DEFAULT_SUM = 200000;
30
+ import { getCalcParams } from './utils';
37
31
 
38
32
  const MAP = {
39
33
  isSalaryClient: 'isSalaryClient',
@@ -74,20 +68,9 @@ export const CalculatorCredit = UniBlock<CalculatorDepositProps>(
74
68
  [paramsViewSettings, calcSource],
75
69
  );
76
70
 
77
- const [userInputParams, { field }] = useForm(
78
- {
79
- moneyValue: getMoneyDefaultValue(defaultParams, CREDIT_DEFAULT_SUM),
80
- monthsValue: getMonthsDefaultValue(defaultParams, DEFAULT_MONTHS),
81
- monthlyPayment: 0,
82
- rate: 0,
83
- isAnnuity: Boolean(defaultParams?.isAnnuity),
84
- isInsurance: Boolean(defaultParams?.isEnableInsurance),
85
- isSalaryClient: Boolean(defaultParams?.isEnableSalaryClient),
86
- isPensionClient: Boolean(defaultParams?.isEnablePensionClient),
87
- isStateEmployee: Boolean(defaultParams?.isEnableStateEmployee),
88
- },
89
- { onChange: handleChange },
90
- );
71
+ const [userInputParams, { field }] = useForm(getCalcParams(defaultParams), {
72
+ onChange: handleChange,
73
+ });
91
74
 
92
75
  const calcParams = getCreditCalculatorParams(userInputParams, calcSource, paramsViewSettings);
93
76
  const paymentTypeElement = renderPaymentType({
@@ -0,0 +1,20 @@
1
+ import { DEFAULT_MONTHS } from '../../ui-kit/Calculator/calculatorConstants';
2
+ import {
3
+ getMoneyDefaultValue,
4
+ getMonthsDefaultValue,
5
+ } from '../../ui-kit/Calculator/getDefaultValues';
6
+ import { type CreditDefaultParams } from './CalculatorCreditContent';
7
+
8
+ const CREDIT_DEFAULT_SUM = 200000;
9
+
10
+ export const getCalcParams = (defaultParams?: CreditDefaultParams) => ({
11
+ moneyValue: getMoneyDefaultValue(defaultParams, CREDIT_DEFAULT_SUM),
12
+ monthsValue: getMonthsDefaultValue(defaultParams, DEFAULT_MONTHS),
13
+ monthlyPayment: 0,
14
+ rate: 0,
15
+ isAnnuity: Boolean(defaultParams?.isAnnuity),
16
+ isInsurance: Boolean(defaultParams?.isEnableInsurance),
17
+ isSalaryClient: Boolean(defaultParams?.isEnableSalaryClient),
18
+ isPensionClient: Boolean(defaultParams?.isEnablePensionClient),
19
+ isStateEmployee: Boolean(defaultParams?.isEnableStateEmployee),
20
+ });
@@ -1,9 +1,12 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { FormStatus } from '../../retail/components/FormStatus/FormStatus';
3
3
  import { useRetailFormStore } from '../../retail/hooks/useRetailFormStore';
4
+ import { getCreditInfo } from './getCreditInfo';
4
5
 
5
6
  export const PendingStatusContent = JSX(({ onExpire }: { onExpire: () => void }) => {
6
- const { statusInfo } = useRetailFormStore();
7
+ const { statusInfo, programId } = useRetailFormStore();
8
+
9
+ const creditInfo = getCreditInfo(programId);
7
10
 
8
11
  return (
9
12
  <FormStatus
@@ -14,11 +17,11 @@ export const PendingStatusContent = JSX(({ onExpire }: { onExpire: () => void })
14
17
  sectionInfo={[
15
18
  {
16
19
  label: 'Название продукта',
17
- description: 'Кредит на любые цели',
20
+ description: creditInfo.name,
18
21
  },
19
22
  {
20
23
  label: 'Цель кредита',
21
- description: 'На любые цели',
24
+ description: creditInfo.description,
22
25
  },
23
26
  {
24
27
  label: 'Сумма',
@@ -1,9 +1,12 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { FormStatus } from '../../retail/components/FormStatus/FormStatus';
3
3
  import { useRetailFormStore } from '../../retail/hooks/useRetailFormStore';
4
+ import { getCreditInfo } from './getCreditInfo';
4
5
 
5
6
  export const SuccessStatusContent = JSX(() => {
6
- const { statusInfo } = useRetailFormStore();
7
+ const { statusInfo, programId } = useRetailFormStore();
8
+
9
+ const creditInfo = getCreditInfo(programId);
7
10
 
8
11
  return (
9
12
  <FormStatus
@@ -12,7 +15,7 @@ export const SuccessStatusContent = JSX(() => {
12
15
  sectionInfo={[
13
16
  {
14
17
  label: 'Название продукта',
15
- description: 'Кредит на любые цели',
18
+ description: creditInfo.name,
16
19
  },
17
20
  {
18
21
  label: 'Ставка',
@@ -0,0 +1,17 @@
1
+ export const getCreditInfo = (programmId: string | null) => {
2
+ switch (programmId) {
3
+ case '11': {
4
+ return {
5
+ name: 'Потребительский кредит на рефинансирование',
6
+ description: 'Погашение основного долга по кредиту, иные цели и оплату страхования',
7
+ };
8
+ }
9
+ case '10':
10
+ default: {
11
+ return {
12
+ name: 'Кредит на любые цели',
13
+ description: 'На любые цели',
14
+ };
15
+ }
16
+ }
17
+ };
@@ -1,33 +1,49 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
2
+ import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { CalculatorCredit } from '../../../components/CalculatorCredit/CalculatorCredit';
4
4
  import {
5
5
  type CreditCalculatorUserInputParams,
6
6
  type CreditDefaultParams,
7
7
  } from '../../../components/CalculatorCredit/CalculatorCreditContent';
8
+ import { getCalcParams } from '../../../components/CalculatorCredit/utils';
8
9
  import { type CustomFieldProps } from '../../../ui-kit/FormField/CustomFieldProps';
10
+ import { Loader } from '../../../ui-kit/Loader/Loader';
9
11
 
10
12
  const FIELD_NAME = 'calculator';
11
13
 
12
14
  export const CreditCalcField = JSX<CustomFieldProps>(({ field, params }) => {
15
+ const [defaultParams, setDefaultParams] = useState<CreditDefaultParams>();
13
16
  const calcValue = field(FIELD_NAME)?.value;
14
- const defaultParams = calcValue
15
- ? defaultValueAdapter(field(FIELD_NAME).value as CreditCalculatorUserInputParams)
16
- : params?.calcData?.defaultParams;
17
- const defaultCalcSum = params?.calcData?.defaultParams?.sum ?? 0;
18
17
 
19
18
  const handleChange = useCallback((_: CreditCalculatorUserInputParams) => {
20
19
  field(FIELD_NAME).onChange?.(_);
21
20
  }, []);
22
21
 
23
- return (
22
+ useEffect(() => {
23
+ if (params?.calcData?.defaultParams) {
24
+ setDefaultParams(
25
+ calcValue
26
+ ? defaultValueAdapter(field(FIELD_NAME).value as CreditCalculatorUserInputParams)
27
+ : (params?.calcData?.defaultParams as CreditDefaultParams),
28
+ );
29
+ }
30
+ }, [params?.calcData?.defaultParams]);
31
+
32
+ useEffect(() => {
33
+ if (defaultParams) {
34
+ handleChange(getCalcParams(defaultParams));
35
+ }
36
+ }, [defaultParams]);
37
+
38
+ return defaultParams ? (
24
39
  <CalculatorCredit
25
- key={defaultCalcSum}
26
40
  {...params?.calcData}
27
41
  defaultParams={defaultParams}
28
42
  padding="p-0"
29
43
  onChange={handleChange}
30
44
  />
45
+ ) : (
46
+ <Loader />
31
47
  );
32
48
  });
33
49