@redneckz/wildless-cms-uni-blocks 0.14.966 → 0.14.968

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 (35) hide show
  1. package/bundle/bundle.umd.js +37 -28
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/dist/retail/components/Fields/CardCategoryField.js +18 -7
  4. package/dist/retail/components/Fields/CardCategoryField.js.map +1 -1
  5. package/dist/retail/components/Fields/CreditCalcField.js +2 -15
  6. package/dist/retail/components/Fields/CreditCalcField.js.map +1 -1
  7. package/dist/retail/components/Fields/RegionRetailField.js +16 -5
  8. package/dist/retail/components/Fields/RegionRetailField.js.map +1 -1
  9. package/lib/retail/components/Fields/CardCategoryField.js +18 -7
  10. package/lib/retail/components/Fields/CardCategoryField.js.map +1 -1
  11. package/lib/retail/components/Fields/CreditCalcField.js +2 -15
  12. package/lib/retail/components/Fields/CreditCalcField.js.map +1 -1
  13. package/lib/retail/components/Fields/RegionRetailField.js +17 -6
  14. package/lib/retail/components/Fields/RegionRetailField.js.map +1 -1
  15. package/mobile/bundle/bundle.umd.js +37 -28
  16. package/mobile/bundle/bundle.umd.min.js +1 -1
  17. package/mobile/dist/retail/components/Fields/CardCategoryField.js +18 -7
  18. package/mobile/dist/retail/components/Fields/CardCategoryField.js.map +1 -1
  19. package/mobile/dist/retail/components/Fields/CreditCalcField.js +2 -15
  20. package/mobile/dist/retail/components/Fields/CreditCalcField.js.map +1 -1
  21. package/mobile/dist/retail/components/Fields/RegionRetailField.js +16 -5
  22. package/mobile/dist/retail/components/Fields/RegionRetailField.js.map +1 -1
  23. package/mobile/lib/retail/components/Fields/CardCategoryField.js +18 -7
  24. package/mobile/lib/retail/components/Fields/CardCategoryField.js.map +1 -1
  25. package/mobile/lib/retail/components/Fields/CreditCalcField.js +2 -15
  26. package/mobile/lib/retail/components/Fields/CreditCalcField.js.map +1 -1
  27. package/mobile/lib/retail/components/Fields/RegionRetailField.js +17 -6
  28. package/mobile/lib/retail/components/Fields/RegionRetailField.js.map +1 -1
  29. package/mobile/src/retail/components/Fields/CardCategoryField.tsx +21 -7
  30. package/mobile/src/retail/components/Fields/CreditCalcField.tsx +3 -29
  31. package/mobile/src/retail/components/Fields/RegionRetailField.tsx +18 -7
  32. package/package.json +1 -1
  33. package/src/retail/components/Fields/CardCategoryField.tsx +21 -7
  34. package/src/retail/components/Fields/CreditCalcField.tsx +3 -29
  35. package/src/retail/components/Fields/RegionRetailField.tsx +18 -7
@@ -1,49 +1,23 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { CalculatorCredit } from '../../../components/CalculatorCredit/CalculatorCredit';
4
- import {
5
- type CreditCalculatorUserInputParams,
6
- type CreditDefaultParams,
7
- } from '../../../components/CalculatorCredit/CalculatorCreditContent';
4
+ import { type CreditCalculatorUserInputParams } from '../../../components/CalculatorCredit/CalculatorCreditContent';
8
5
  import { type CustomFieldProps } from '../../../ui-kit/FormField/CustomFieldProps';
9
6
 
10
7
  const FIELD_NAME = 'calculator';
11
8
 
12
9
  export const CreditCalcField = JSX<CustomFieldProps>(({ field, params }) => {
10
+ const defaultCalcSum = params?.calcData?.defaultParams?.sum ?? 0;
13
11
  const handleChange = useCallback((_: CreditCalculatorUserInputParams) => {
14
12
  field(FIELD_NAME).onChange?.(_);
15
13
  }, []);
16
14
 
17
15
  return (
18
16
  <CalculatorCredit
17
+ key={defaultCalcSum}
19
18
  {...params?.calcData}
20
19
  padding="p-0"
21
- defaultParams={defaultValueAdapter(
22
- field(FIELD_NAME).value as CreditCalculatorUserInputParams,
23
- )}
24
20
  onChange={handleChange}
25
21
  />
26
22
  );
27
23
  });
28
-
29
- const PARAMS_MAP = {
30
- moneyValue: 'sum',
31
- monthsValue: 'period',
32
- isInsurance: 'isEnableInsurance',
33
- isPensionClient: 'isEnablePensionClient',
34
- isStateEmployee: 'isEnableStateEmployee',
35
- isSalaryClient: 'isEnableSalaryClient',
36
- isAnnuity: 'isAnnuity',
37
- };
38
-
39
- const defaultValueAdapter = (
40
- value?: CreditCalculatorUserInputParams,
41
- isInverse = false,
42
- ): CreditDefaultParams => {
43
- const keysMap = isInverse ? swap(PARAMS_MAP) : PARAMS_MAP;
44
-
45
- return Object.fromEntries(Object.entries(value ?? {}).map(([k, v]) => [keysMap[k], v]));
46
- };
47
-
48
- const swap = (_: Record<string, string>) =>
49
- Object.fromEntries(Object.entries(_).map(([k, v]) => [v, k]));
@@ -1,5 +1,5 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
2
+ import { useCallback, useEffect } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { useAsyncData } from '@redneckz/uni-jsx/lib/hooks/useAsyncData';
4
4
  import { type ProductType } from '../../../components/ApplicationLeadForm/ApplicationLeadFormContent';
5
5
  import { type CustomFieldProps } from '../../../ui-kit/FormField/CustomFieldProps';
@@ -10,11 +10,13 @@ import { useLeadFormData } from '../../hooks/useLeadFormData';
10
10
  import { useRetailFormStore } from '../../hooks/useRetailFormStore';
11
11
 
12
12
  export const RegionRetailField = JSX<CustomFieldProps>(({ field, input }) => {
13
- const { productType } = useRetailFormStore();
13
+ const { programId, productType } = useRetailFormStore();
14
14
  const { data: regions } = useLeadFormData('REGION_RF');
15
15
  const { data: regionsDelivery } = useAsyncData('regionsDelivery', getRegionsCardDelivery);
16
16
  const { data: productSettings } = useLeadFormData(getCurrentProductSettings(productType));
17
- const isEsiaAuth = field('esiaAccountTypeCd')?.value?.key;
17
+ const isDebit = productType === 'debitCard';
18
+ const isSalaryCard = programId === '38';
19
+ const isEsiaAuth = Boolean(field('esiaAccountTypeCd')?.value?.key);
18
20
  const formatRegions = regions?.map(({ key, value }) => ({ key, text: value }));
19
21
  const isDeliveryActive =
20
22
  productSettings?.find((_) => _?.key === 'DELIVERY_ACTIVE')?.value === 'true';
@@ -24,10 +26,12 @@ export const RegionRetailField = JSX<CustomFieldProps>(({ field, input }) => {
24
26
 
25
27
  const onChange = useCallback(
26
28
  (value: Option) => {
27
- const regionHasDelivery =
28
- isDeliveryActive &&
29
- regionsDelivery?.find((_) => _.regionCode === value.key)?.deliveryFlg &&
30
- Boolean(isEsiaAuth);
29
+ const regionHasDelivery = isDebit
30
+ ? isEsiaAuth &&
31
+ !isSalaryCard &&
32
+ isDeliveryActive &&
33
+ regionsDelivery?.find((_) => _.regionCode === value.key)?.deliveryFlg
34
+ : isDeliveryActive && regionsDelivery?.find((_) => _.regionCode === value.key)?.deliveryFlg;
31
35
 
32
36
  handleChangeRegionHasDelivery?.(regionHasDelivery);
33
37
  handleChangeMethodObtain?.(regionHasDelivery ? 'courier' : 'office');
@@ -36,6 +40,13 @@ export const RegionRetailField = JSX<CustomFieldProps>(({ field, input }) => {
36
40
  [regionsDelivery, isDeliveryActive, isEsiaAuth],
37
41
  );
38
42
 
43
+ useEffect(() => {
44
+ if (!isEsiaAuth && isDebit) {
45
+ handleChangeRegionHasDelivery?.(false);
46
+ handleChangeMethodObtain?.('office');
47
+ }
48
+ }, []);
49
+
39
50
  return (
40
51
  <SelectControl
41
52
  label="Регион"