@redneckz/wildless-cms-uni-blocks 0.14.967 → 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 (25) hide show
  1. package/bundle/bundle.umd.js +35 -13
  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/RegionRetailField.js +16 -5
  6. package/dist/retail/components/Fields/RegionRetailField.js.map +1 -1
  7. package/lib/retail/components/Fields/CardCategoryField.js +18 -7
  8. package/lib/retail/components/Fields/CardCategoryField.js.map +1 -1
  9. package/lib/retail/components/Fields/RegionRetailField.js +17 -6
  10. package/lib/retail/components/Fields/RegionRetailField.js.map +1 -1
  11. package/mobile/bundle/bundle.umd.js +35 -13
  12. package/mobile/bundle/bundle.umd.min.js +1 -1
  13. package/mobile/dist/retail/components/Fields/CardCategoryField.js +18 -7
  14. package/mobile/dist/retail/components/Fields/CardCategoryField.js.map +1 -1
  15. package/mobile/dist/retail/components/Fields/RegionRetailField.js +16 -5
  16. package/mobile/dist/retail/components/Fields/RegionRetailField.js.map +1 -1
  17. package/mobile/lib/retail/components/Fields/CardCategoryField.js +18 -7
  18. package/mobile/lib/retail/components/Fields/CardCategoryField.js.map +1 -1
  19. package/mobile/lib/retail/components/Fields/RegionRetailField.js +17 -6
  20. package/mobile/lib/retail/components/Fields/RegionRetailField.js.map +1 -1
  21. package/mobile/src/retail/components/Fields/CardCategoryField.tsx +21 -7
  22. package/mobile/src/retail/components/Fields/RegionRetailField.tsx +18 -7
  23. package/package.json +1 -1
  24. package/src/retail/components/Fields/CardCategoryField.tsx +21 -7
  25. package/src/retail/components/Fields/RegionRetailField.tsx +18 -7
@@ -4679,19 +4679,27 @@
4679
4679
  const CardCategoryField = JSX(({ field, input }) => {
4680
4680
  const [cardTypes, setCardTypes] = useState([]);
4681
4681
  const [programId] = useLocalStorage('programId');
4682
- const { productType } = useRetailFormStore();
4683
- const isSalaryCard = programId === '38';
4682
+ const { productType, leadForm } = useRetailFormStore();
4684
4683
  const isDebit = productType === 'debitCard';
4685
4684
  const isEsiaAuth = Boolean(field('esiaAccountTypeCd')?.value?.key);
4686
4685
  const { value: selectedCardCategory, onChange: cardCategoryChange } = field('cardCategory');
4687
4686
  const selectedPaymentSystem = field('paymentSystem')?.value?.key;
4688
- const handleChangeIsMomentDebitCard = field('isMomentDebitCard')?.onChange;
4689
- const getCardCategoryValue = useCallback((fetchedCardTypes) => fetchedCardTypes.length === 1
4687
+ const isOffice = leadForm?.methodObtain === 'office';
4688
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
4689
+ const noop = () => { };
4690
+ const handleChangeIsMomentDebitCard = useMemo(() => {
4691
+ const onChange = field('isMomentDebitCard')?.onChange;
4692
+ return onChange ?? noop;
4693
+ }, [field]);
4694
+ const isInstantSelectedCardCategory = field('cardCategory')
4695
+ ?.value?.text?.toLowerCase()
4696
+ ?.includes('неимен');
4697
+ const getCardCategoryValue = useCallback((fetchedCardTypes) => fetchedCardTypes.length !== 0
4690
4698
  ? {
4691
4699
  key: fetchedCardTypes[0].key,
4692
4700
  text: fetchedCardTypes[0].value,
4693
4701
  }
4694
- : null, []);
4702
+ : null, [selectedPaymentSystem]);
4695
4703
  const onChange = useCallback((value) => {
4696
4704
  cardCategoryChange?.(value);
4697
4705
  handleChangeIsMomentDebitCard?.(value?.text?.toLowerCase()?.includes('неимен'));
@@ -4700,16 +4708,19 @@
4700
4708
  if (selectedPaymentSystem && programId) {
4701
4709
  (async () => {
4702
4710
  const fetchedCardTypes = await getCardTypes(selectedPaymentSystem, programId);
4703
- const actualCardTypes = isDebit && !isEsiaAuth && !isSalaryCard
4711
+ const actualCardTypes = isDebit && (!isEsiaAuth || isOffice)
4704
4712
  ? excludeSomeСategoriesCards(fetchedCardTypes)
4705
4713
  : fetchedCardTypes;
4706
4714
  setCardTypes(actualCardTypes);
4707
4715
  if (!isValidCardCategory(actualCardTypes, selectedCardCategory)) {
4708
4716
  cardCategoryChange?.(getCardCategoryValue(actualCardTypes));
4709
4717
  }
4718
+ if (isDebit) {
4719
+ handleChangeIsMomentDebitCard(isInstantSelectedCardCategory ?? false);
4720
+ }
4710
4721
  })();
4711
4722
  }
4712
- }, [selectedPaymentSystem, getCardCategoryValue]);
4723
+ }, [selectedPaymentSystem, getCardCategoryValue, isInstantSelectedCardCategory]);
4713
4724
  const description = useMemo(() => cardTypes?.find((_) => _.key === selectedCardCategory?.key)?.description, [cardTypes, selectedCardCategory]);
4714
4725
  return (jsxs("div", { children: [jsx(SelectField, { field: field, source: cardTypes, label: "\u041A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F \u043A\u0430\u0440\u0442\u044B", fieldName: "cardCategory", input: input, onChange: onChange }), description ? jsx(InfoCard, { __html: description }) : null] }));
4715
4726
  });
@@ -5687,24 +5698,35 @@
5687
5698
  };
5688
5699
 
5689
5700
  const RegionRetailField = JSX(({ field, input }) => {
5690
- const { productType } = useRetailFormStore();
5701
+ const { programId, productType } = useRetailFormStore();
5691
5702
  const { data: regions } = useLeadFormData('REGION_RF');
5692
5703
  const { data: regionsDelivery } = useAsyncData('regionsDelivery', getRegionsCardDelivery);
5693
5704
  const { data: productSettings } = useLeadFormData(getCurrentProductSettings(productType));
5694
- const isEsiaAuth = field('esiaAccountTypeCd')?.value?.key;
5705
+ const isDebit = productType === 'debitCard';
5706
+ const isSalaryCard = programId === '38';
5707
+ const isEsiaAuth = Boolean(field('esiaAccountTypeCd')?.value?.key);
5695
5708
  const formatRegions = regions?.map(({ key, value }) => ({ key, text: value }));
5696
5709
  const isDeliveryActive = productSettings?.find((_) => _?.key === 'DELIVERY_ACTIVE')?.value === 'true';
5697
5710
  const handleChangeRegion = field('regionRetail')?.onChange;
5698
5711
  const handleChangeRegionHasDelivery = field('regionHasDelivery')?.onChange;
5699
5712
  const handleChangeMethodObtain = field('methodObtain')?.onChange;
5700
5713
  const onChange = useCallback((value) => {
5701
- const regionHasDelivery = isDeliveryActive &&
5702
- regionsDelivery?.find((_) => _.regionCode === value.key)?.deliveryFlg &&
5703
- Boolean(isEsiaAuth);
5714
+ const regionHasDelivery = isDebit
5715
+ ? isEsiaAuth &&
5716
+ !isSalaryCard &&
5717
+ isDeliveryActive &&
5718
+ regionsDelivery?.find((_) => _.regionCode === value.key)?.deliveryFlg
5719
+ : isDeliveryActive && regionsDelivery?.find((_) => _.regionCode === value.key)?.deliveryFlg;
5704
5720
  handleChangeRegionHasDelivery?.(regionHasDelivery);
5705
5721
  handleChangeMethodObtain?.(regionHasDelivery ? 'courier' : 'office');
5706
5722
  handleChangeRegion?.(value);
5707
5723
  }, [regionsDelivery, isDeliveryActive, isEsiaAuth]);
5724
+ useEffect(() => {
5725
+ if (!isEsiaAuth && isDebit) {
5726
+ handleChangeRegionHasDelivery?.(false);
5727
+ handleChangeMethodObtain?.('office');
5728
+ }
5729
+ }, []);
5708
5730
  return (jsx(SelectControl, { label: "\u0420\u0435\u0433\u0438\u043E\u043D", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0435\u0433\u0438\u043E\u043D", isSearch: true, options: formatRegions, ...field(input?.name ?? ''), onChange: onChange }));
5709
5731
  });
5710
5732
  const getCurrentProductSettings = (productType) => productType === 'debitCard' ? 'DEBIT_CARD_LEAD_PROCESS_SETTINGS' : 'CREDIT_LEAD_PROCESS_SETTINGS';
@@ -13021,7 +13043,7 @@
13021
13043
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
13022
13044
  });
13023
13045
 
13024
- const packageVersion = "0.14.966";
13046
+ const packageVersion = "0.14.967";
13025
13047
 
13026
13048
  exports.Blocks = Blocks;
13027
13049
  exports.ContentPage = ContentPage;