@redneckz/wildless-cms-uni-blocks 0.14.668 → 0.14.669

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 (61) hide show
  1. package/bundle/bundle.umd.js +18 -19
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/ui-kit/YandexMap/YandexMap.d.ts +0 -1
  4. package/dist/components/CreditCardForm/CreditCardForm.js +5 -1
  5. package/dist/components/CreditCardForm/CreditCardForm.js.map +1 -1
  6. package/dist/components/CreditForm/CreditForm.js +5 -1
  7. package/dist/components/CreditForm/CreditForm.js.map +1 -1
  8. package/dist/ui-kit/FormField/Fields/AddressRetailField.js +2 -1
  9. package/dist/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -1
  10. package/dist/ui-kit/FormField/validators.js +1 -1
  11. package/dist/ui-kit/FormField/validators.js.map +1 -1
  12. package/dist/ui-kit/YandexMap/YandexMap.d.ts +0 -1
  13. package/dist/ui-kit/YandexMap/YandexMap.js +3 -13
  14. package/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
  15. package/lib/components/CreditCardForm/CreditCardForm.js +6 -2
  16. package/lib/components/CreditCardForm/CreditCardForm.js.map +1 -1
  17. package/lib/components/CreditForm/CreditForm.js +6 -2
  18. package/lib/components/CreditForm/CreditForm.js.map +1 -1
  19. package/lib/ui-kit/FormField/Fields/AddressRetailField.js +2 -1
  20. package/lib/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -1
  21. package/lib/ui-kit/FormField/validators.js +1 -1
  22. package/lib/ui-kit/FormField/validators.js.map +1 -1
  23. package/lib/ui-kit/YandexMap/YandexMap.d.ts +0 -1
  24. package/lib/ui-kit/YandexMap/YandexMap.js +3 -13
  25. package/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
  26. package/mobile/bundle/bundle.umd.js +18 -19
  27. package/mobile/bundle/bundle.umd.min.js +1 -1
  28. package/mobile/bundle/ui-kit/YandexMap/YandexMap.d.ts +0 -1
  29. package/mobile/dist/components/CreditCardForm/CreditCardForm.js +5 -1
  30. package/mobile/dist/components/CreditCardForm/CreditCardForm.js.map +1 -1
  31. package/mobile/dist/components/CreditForm/CreditForm.js +5 -1
  32. package/mobile/dist/components/CreditForm/CreditForm.js.map +1 -1
  33. package/mobile/dist/ui-kit/FormField/Fields/AddressRetailField.js +2 -1
  34. package/mobile/dist/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -1
  35. package/mobile/dist/ui-kit/FormField/validators.js +1 -1
  36. package/mobile/dist/ui-kit/FormField/validators.js.map +1 -1
  37. package/mobile/dist/ui-kit/YandexMap/YandexMap.d.ts +0 -1
  38. package/mobile/dist/ui-kit/YandexMap/YandexMap.js +3 -13
  39. package/mobile/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
  40. package/mobile/lib/components/CreditCardForm/CreditCardForm.js +6 -2
  41. package/mobile/lib/components/CreditCardForm/CreditCardForm.js.map +1 -1
  42. package/mobile/lib/components/CreditForm/CreditForm.js +6 -2
  43. package/mobile/lib/components/CreditForm/CreditForm.js.map +1 -1
  44. package/mobile/lib/ui-kit/FormField/Fields/AddressRetailField.js +2 -1
  45. package/mobile/lib/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -1
  46. package/mobile/lib/ui-kit/FormField/validators.js +1 -1
  47. package/mobile/lib/ui-kit/FormField/validators.js.map +1 -1
  48. package/mobile/lib/ui-kit/YandexMap/YandexMap.d.ts +0 -1
  49. package/mobile/lib/ui-kit/YandexMap/YandexMap.js +3 -13
  50. package/mobile/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
  51. package/mobile/src/components/CreditCardForm/CreditCardForm.tsx +10 -2
  52. package/mobile/src/components/CreditForm/CreditForm.tsx +10 -2
  53. package/mobile/src/ui-kit/FormField/Fields/AddressRetailField.tsx +2 -6
  54. package/mobile/src/ui-kit/FormField/validators.ts +1 -1
  55. package/mobile/src/ui-kit/YandexMap/YandexMap.tsx +45 -59
  56. package/package.json +1 -1
  57. package/src/components/CreditCardForm/CreditCardForm.tsx +10 -2
  58. package/src/components/CreditForm/CreditForm.tsx +10 -2
  59. package/src/ui-kit/FormField/Fields/AddressRetailField.tsx +2 -6
  60. package/src/ui-kit/FormField/validators.ts +1 -1
  61. package/src/ui-kit/YandexMap/YandexMap.tsx +45 -59
@@ -1456,7 +1456,7 @@
1456
1456
  const snilsValidator = (errorMsg) => validator(snilsValidate)(errorMsg);
1457
1457
  const emailValidate = (email) => /^[^\s@]+@[^\s@]+\.[a-zA-Z]{2,4}$/.test(email);
1458
1458
  const emailValidator = (errorMsg) => validator((_) => emailValidate(_))(errorMsg);
1459
- const addressDaDataValidate = (address) => Boolean(address.qc === '0' && address.qcComplete === '0' && address.qcHouse === '2');
1459
+ const addressDaDataValidate = (address) => Boolean(address.region && address.city && address.house);
1460
1460
  const addressDaDataValidator = () => validator(addressDaDataValidate)('Укажите регион, город/населенный пункт, улицу, дом, квартиру');
1461
1461
  const addressOrganizationValidator = () => validator((address) => Boolean(address.fiasCode && address.city && address.house))('Укажите регион, город/населенный пункт, улицу, дом');
1462
1462
  const codeWordValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length >= 3 && _.length <= 21 && /^[\u0400-\u04FF\d]+$/u.test(_))(errorMsg ?? ERROR_MESSAGE);
@@ -1975,12 +1975,12 @@
1975
1975
  // Сейчас реализован поиск среди тестовых данных
1976
1976
  // TODO: Также выяснить что делать когда ничего не найдено
1977
1977
  // TODO: На макетах также когда есть поле поиска нет кнопки открыть на карте.
1978
- const YandexMap = JSX(({ points, className = '', zoom = 5, isLoad, selectedAddress }) => {
1978
+ const YandexMap = JSX(({ points, className = '', zoom = 5, isLoad }) => {
1979
1979
  const map = useRef(null);
1980
1980
  const yandexMaps = useYandexMaps();
1981
1981
  useEffect(() => {
1982
1982
  if (map.current) {
1983
- renderClusterer({ yandexMaps, map: map.current, points, isLoad, selectedAddress });
1983
+ renderClusterer({ yandexMaps, map: map.current, points, isLoad });
1984
1984
  }
1985
1985
  else {
1986
1986
  yandexMaps?.ready(() => {
@@ -1998,17 +1998,7 @@
1998
1998
  renderClusterer({ yandexMaps, map: map.current, points, isLoad });
1999
1999
  });
2000
2000
  }
2001
- }, [yandexMaps, points, zoom, isLoad, selectedAddress]);
2002
- useEffect(() => {
2003
- if (map.current && selectedAddress) {
2004
- yandexMaps?.geocode(selectedAddress).then((res) => {
2005
- const firstGeoObject = res.geoObjects.get(0);
2006
- const coords = firstGeoObject.geometry.getCoordinates();
2007
- map.current.setCenter(coords);
2008
- map.current.setZoom(18);
2009
- });
2010
- }
2011
- }, [selectedAddress]);
2001
+ }, [yandexMaps, points, zoom, isLoad]);
2012
2002
  if (!yandexMaps) {
2013
2003
  return null;
2014
2004
  }
@@ -2476,7 +2466,8 @@
2476
2466
  const [offices, setOffices] = useState([]);
2477
2467
  const { data } = useLeadFormData('REGION_RF');
2478
2468
  const regionValue = field('regionRetail')?.value || {};
2479
- const fieldBranch = field('addressRetail');
2469
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2470
+ field('addressRetail');
2480
2471
  useEffect(() => {
2481
2472
  (async () => {
2482
2473
  const officesList = await regionOffices(regionValue?.key ?? '');
@@ -2496,7 +2487,7 @@
2496
2487
  return (jsxs("div", { children: [jsx(SelectControl, { label: "\u0410\u0434\u0440\u0435\u0441 \u043E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u044F", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u0435", options: offices.map(({ id, address = '' }) => ({
2497
2488
  key: id?.toString() || '',
2498
2489
  text: address,
2499
- })), ...getValidation(field('addressRetail'), validatorObj.addressRetail, input?.required && isRegionSelected), isSearch: true }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, isLoad: !data, className: "h-full", selectedAddress: fieldBranch?.value?.text }) }) })] }));
2490
+ })), ...getValidation(field('addressRetail'), validatorObj.addressRetail, input?.required && isRegionSelected), isSearch: true }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, isLoad: !data, className: "h-full" }) }) })] }));
2500
2491
  });
2501
2492
 
2502
2493
  const useNormalizedInput = (props, { normalize, format }) => {
@@ -6917,17 +6908,21 @@
6917
6908
  ];
6918
6909
  const CreditCardForm = JSX(({ className, ...rest }) => {
6919
6910
  const [step, setStep] = useState(0);
6911
+ const formContainerRef = useRef(null);
6912
+ const scrollToTop = useCallback(() => formContainerRef?.current?.scrollIntoView({ behavior: 'smooth' }), [formContainerRef]);
6920
6913
  useEffect(updateRefreshToken, []);
6921
6914
  const handleNextStep = useCallback(() => {
6922
6915
  setStep((_) => Math.min(_ + 1, WIZARD_STEPS$1));
6916
+ scrollToTop();
6923
6917
  }, []);
6924
6918
  const handlePrevStep = useCallback(() => {
6925
6919
  //TODO search hook - 1,
6926
6920
  setStep((_) => Math.max(_ - 1, 0));
6921
+ scrollToTop();
6927
6922
  }, []);
6928
6923
  const sections = useMemo(() => stepsSectionsMap$1[step], [step]);
6929
6924
  const [isFormFinished, setIsFormFinished] = useState(false);
6930
- return (jsx(BlockWrapper, { className: style('bg-transparent', className), defaultPadding: "p-0", ...rest, children: jsxs("div", { className: "container grid grid-cols-12", children: [isFormFinished ? null : (jsx(CreditCardFormProgress, { stepsTitles: WIZARD_TITLES$1, step: step, totalSteps: WIZARD_STEPS$1 })), jsx("div", { className: "py-lg px-5xl mt-2xs bg-white col-span-12", children: jsx(CreditCardFormStep, { step: step, sections: sections, onNextStep: handleNextStep, onPrevStep: handlePrevStep, isFormFinished: isFormFinished, finishForm: setIsFormFinished }, String(step)) })] }) }));
6925
+ return (jsx(BlockWrapper, { className: style('bg-transparent', className), defaultPadding: "p-0", ...rest, children: jsxs("div", { ref: formContainerRef, className: "container grid grid-cols-12", children: [isFormFinished ? null : (jsx(CreditCardFormProgress, { stepsTitles: WIZARD_TITLES$1, step: step, totalSteps: WIZARD_STEPS$1 })), jsx("div", { className: "py-lg px-5xl mt-2xs bg-white col-span-12", children: jsx(CreditCardFormStep, { step: step, sections: sections, onNextStep: handleNextStep, onPrevStep: handlePrevStep, isFormFinished: isFormFinished, finishForm: setIsFormFinished }, String(step)) })] }) }));
6931
6926
  });
6932
6927
 
6933
6928
  const CreditFormProgress = JSX(({ step = 1, totalSteps = 5, stepsTitles = [] }) => {
@@ -7698,18 +7693,22 @@
7698
7693
  ];
7699
7694
  const CreditForm = JSX(({ className, ...rest }) => {
7700
7695
  const [step, setStep] = useState(0);
7696
+ const formContainerRef = useRef(null);
7697
+ const scrollToTop = useCallback(() => formContainerRef?.current?.scrollIntoView({ behavior: 'smooth' }), [formContainerRef]);
7701
7698
  useEffect(updateRefreshToken, []);
7702
7699
  const handleNextStep = useCallback(() => {
7703
7700
  setStep((_) => Math.min(_ + 1, WIZARD_STEPS));
7701
+ scrollToTop();
7704
7702
  }, []);
7705
7703
  const handlePrevStep = useCallback(() => {
7706
7704
  //TODO search hook - 1,
7707
7705
  setStep((_) => Math.max(_ - 1, 0));
7706
+ scrollToTop();
7708
7707
  }, []);
7709
7708
  const sections = useMemo(() => stepsSectionsMap[step], [step]);
7710
7709
  const isStartStep = step === 0;
7711
7710
  const [isFormFinished, setIsFormFinished] = useState(false);
7712
- return (jsx(BlockWrapper, { className: style('bg-transparent', className), defaultPadding: "p-0", ...rest, children: jsxs("div", { className: "container grid grid-cols-12", children: [isStartStep || isFormFinished ? null : (jsx(CreditFormProgress, { stepsTitles: WIZARD_TITLES, step: step, totalSteps: WIZARD_STEPS })), jsx("div", { className: "py-lg px-5xl mt-2xs bg-white col-span-12", children: jsx(CreditFormStep, { step: step, sections: sections, onNextStep: handleNextStep, onPrevStep: handlePrevStep, isFormFinished: isFormFinished, finishForm: setIsFormFinished, renderStep: isStartStep
7711
+ return (jsx(BlockWrapper, { className: style('bg-transparent', className), defaultPadding: "p-0", ...rest, children: jsxs("div", { ref: formContainerRef, className: "container grid grid-cols-12", children: [isStartStep || isFormFinished ? null : (jsx(CreditFormProgress, { stepsTitles: WIZARD_TITLES, step: step, totalSteps: WIZARD_STEPS })), jsx("div", { className: "py-lg px-5xl mt-2xs bg-white col-span-12", children: jsx(CreditFormStep, { step: step, sections: sections, onNextStep: handleNextStep, onPrevStep: handlePrevStep, isFormFinished: isFormFinished, finishForm: setIsFormFinished, renderStep: isStartStep
7713
7712
  ? ({ registerSubmit, field }) => (jsx(CalculatorCredit, { ...{
7714
7713
  defaultParams: {
7715
7714
  sum: field('moneyValue').value,
@@ -9985,7 +9984,7 @@
9985
9984
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
9986
9985
  });
9987
9986
 
9988
- const packageVersion = "0.14.667";
9987
+ const packageVersion = "0.14.668";
9989
9988
 
9990
9989
  exports.Blocks = Blocks;
9991
9990
  exports.ContentPage = ContentPage;