@redneckz/wildless-cms-uni-blocks 0.14.667 → 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 (87) hide show
  1. package/bundle/bundle.umd.js +26 -20
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/ui-kit/YandexMap/YandexMap.d.ts +0 -1
  4. package/bundle/utils/dateToISO.d.ts +1 -0
  5. package/dist/components/CreditCardForm/CreditCardForm.js +5 -1
  6. package/dist/components/CreditCardForm/CreditCardForm.js.map +1 -1
  7. package/dist/components/CreditCardForm/getSixthStepData.js +2 -2
  8. package/dist/components/CreditCardForm/getSixthStepData.js.map +1 -1
  9. package/dist/components/CreditForm/CreditForm.js +5 -1
  10. package/dist/components/CreditForm/CreditForm.js.map +1 -1
  11. package/dist/ui-kit/FormField/Fields/AddressRetailField.js +2 -1
  12. package/dist/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -1
  13. package/dist/ui-kit/FormField/validators.js +1 -1
  14. package/dist/ui-kit/FormField/validators.js.map +1 -1
  15. package/dist/ui-kit/YandexMap/YandexMap.d.ts +0 -1
  16. package/dist/ui-kit/YandexMap/YandexMap.js +3 -13
  17. package/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
  18. package/dist/utils/dateToISO.d.ts +1 -0
  19. package/dist/utils/dateToISO.js +10 -0
  20. package/dist/utils/dateToISO.js.map +1 -0
  21. package/lib/components/CreditCardForm/CreditCardForm.js +6 -2
  22. package/lib/components/CreditCardForm/CreditCardForm.js.map +1 -1
  23. package/lib/components/CreditCardForm/getSixthStepData.js +2 -2
  24. package/lib/components/CreditCardForm/getSixthStepData.js.map +1 -1
  25. package/lib/components/CreditForm/CreditForm.js +6 -2
  26. package/lib/components/CreditForm/CreditForm.js.map +1 -1
  27. package/lib/ui-kit/FormField/Fields/AddressRetailField.js +2 -1
  28. package/lib/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -1
  29. package/lib/ui-kit/FormField/validators.js +1 -1
  30. package/lib/ui-kit/FormField/validators.js.map +1 -1
  31. package/lib/ui-kit/YandexMap/YandexMap.d.ts +0 -1
  32. package/lib/ui-kit/YandexMap/YandexMap.js +3 -13
  33. package/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
  34. package/lib/utils/dateToISO.d.ts +1 -0
  35. package/lib/utils/dateToISO.js +7 -0
  36. package/lib/utils/dateToISO.js.map +1 -0
  37. package/mobile/bundle/bundle.umd.js +26 -20
  38. package/mobile/bundle/bundle.umd.min.js +1 -1
  39. package/mobile/bundle/ui-kit/YandexMap/YandexMap.d.ts +0 -1
  40. package/mobile/bundle/utils/dateToISO.d.ts +1 -0
  41. package/mobile/dist/components/CreditCardForm/CreditCardForm.js +5 -1
  42. package/mobile/dist/components/CreditCardForm/CreditCardForm.js.map +1 -1
  43. package/mobile/dist/components/CreditCardForm/getSixthStepData.js +2 -2
  44. package/mobile/dist/components/CreditCardForm/getSixthStepData.js.map +1 -1
  45. package/mobile/dist/components/CreditForm/CreditForm.js +5 -1
  46. package/mobile/dist/components/CreditForm/CreditForm.js.map +1 -1
  47. package/mobile/dist/ui-kit/FormField/Fields/AddressRetailField.js +2 -1
  48. package/mobile/dist/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -1
  49. package/mobile/dist/ui-kit/FormField/validators.js +1 -1
  50. package/mobile/dist/ui-kit/FormField/validators.js.map +1 -1
  51. package/mobile/dist/ui-kit/YandexMap/YandexMap.d.ts +0 -1
  52. package/mobile/dist/ui-kit/YandexMap/YandexMap.js +3 -13
  53. package/mobile/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
  54. package/mobile/dist/utils/dateToISO.d.ts +1 -0
  55. package/mobile/dist/utils/dateToISO.js +10 -0
  56. package/mobile/dist/utils/dateToISO.js.map +1 -0
  57. package/mobile/lib/components/CreditCardForm/CreditCardForm.js +6 -2
  58. package/mobile/lib/components/CreditCardForm/CreditCardForm.js.map +1 -1
  59. package/mobile/lib/components/CreditCardForm/getSixthStepData.js +2 -2
  60. package/mobile/lib/components/CreditCardForm/getSixthStepData.js.map +1 -1
  61. package/mobile/lib/components/CreditForm/CreditForm.js +6 -2
  62. package/mobile/lib/components/CreditForm/CreditForm.js.map +1 -1
  63. package/mobile/lib/ui-kit/FormField/Fields/AddressRetailField.js +2 -1
  64. package/mobile/lib/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -1
  65. package/mobile/lib/ui-kit/FormField/validators.js +1 -1
  66. package/mobile/lib/ui-kit/FormField/validators.js.map +1 -1
  67. package/mobile/lib/ui-kit/YandexMap/YandexMap.d.ts +0 -1
  68. package/mobile/lib/ui-kit/YandexMap/YandexMap.js +3 -13
  69. package/mobile/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
  70. package/mobile/lib/utils/dateToISO.d.ts +1 -0
  71. package/mobile/lib/utils/dateToISO.js +7 -0
  72. package/mobile/lib/utils/dateToISO.js.map +1 -0
  73. package/mobile/src/components/CreditCardForm/CreditCardForm.tsx +10 -2
  74. package/mobile/src/components/CreditCardForm/getSixthStepData.ts +2 -2
  75. package/mobile/src/components/CreditForm/CreditForm.tsx +10 -2
  76. package/mobile/src/ui-kit/FormField/Fields/AddressRetailField.tsx +2 -6
  77. package/mobile/src/ui-kit/FormField/validators.ts +1 -1
  78. package/mobile/src/ui-kit/YandexMap/YandexMap.tsx +45 -59
  79. package/mobile/src/utils/dateToISO.ts +7 -0
  80. package/package.json +1 -1
  81. package/src/components/CreditCardForm/CreditCardForm.tsx +10 -2
  82. package/src/components/CreditCardForm/getSixthStepData.ts +2 -2
  83. package/src/components/CreditForm/CreditForm.tsx +10 -2
  84. package/src/ui-kit/FormField/Fields/AddressRetailField.tsx +2 -6
  85. package/src/ui-kit/FormField/validators.ts +1 -1
  86. package/src/ui-kit/YandexMap/YandexMap.tsx +45 -59
  87. package/src/utils/dateToISO.ts +7 -0
@@ -1464,7 +1464,7 @@
1464
1464
  const snilsValidator = (errorMsg) => validator(snilsValidate)(errorMsg);
1465
1465
  const emailValidate = (email) => /^[^\s@]+@[^\s@]+\.[a-zA-Z]{2,4}$/.test(email);
1466
1466
  const emailValidator = (errorMsg) => validator((_) => emailValidate(_))(errorMsg);
1467
- const addressDaDataValidate = (address) => Boolean(address.qc === '0' && address.qcComplete === '0' && address.qcHouse === '2');
1467
+ const addressDaDataValidate = (address) => Boolean(address.region && address.city && address.house);
1468
1468
  const addressDaDataValidator = () => validator(addressDaDataValidate)('Укажите регион, город/населенный пункт, улицу, дом, квартиру');
1469
1469
  const addressOrganizationValidator = () => validator((address) => Boolean(address.fiasCode && address.city && address.house))('Укажите регион, город/населенный пункт, улицу, дом');
1470
1470
  const codeWordValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length >= 3 && _.length <= 21 && /^[\u0400-\u04FF\d]+$/u.test(_))(errorMsg ?? ERROR_MESSAGE);
@@ -1983,12 +1983,12 @@
1983
1983
  // Сейчас реализован поиск среди тестовых данных
1984
1984
  // TODO: Также выяснить что делать когда ничего не найдено
1985
1985
  // TODO: На макетах также когда есть поле поиска нет кнопки открыть на карте.
1986
- const YandexMap = JSX(({ points, className = '', zoom = 5, isLoad, selectedAddress }) => {
1986
+ const YandexMap = JSX(({ points, className = '', zoom = 5, isLoad }) => {
1987
1987
  const map = useRef(null);
1988
1988
  const yandexMaps = useYandexMaps();
1989
1989
  useEffect(() => {
1990
1990
  if (map.current) {
1991
- renderClusterer({ yandexMaps, map: map.current, points, isLoad, selectedAddress });
1991
+ renderClusterer({ yandexMaps, map: map.current, points, isLoad });
1992
1992
  }
1993
1993
  else {
1994
1994
  yandexMaps?.ready(() => {
@@ -2006,17 +2006,7 @@
2006
2006
  renderClusterer({ yandexMaps, map: map.current, points, isLoad });
2007
2007
  });
2008
2008
  }
2009
- }, [yandexMaps, points, zoom, isLoad, selectedAddress]);
2010
- useEffect(() => {
2011
- if (map.current && selectedAddress) {
2012
- yandexMaps?.geocode(selectedAddress).then((res) => {
2013
- const firstGeoObject = res.geoObjects.get(0);
2014
- const coords = firstGeoObject.geometry.getCoordinates();
2015
- map.current.setCenter(coords);
2016
- map.current.setZoom(18);
2017
- });
2018
- }
2019
- }, [selectedAddress]);
2009
+ }, [yandexMaps, points, zoom, isLoad]);
2020
2010
  if (!yandexMaps) {
2021
2011
  return null;
2022
2012
  }
@@ -2484,7 +2474,8 @@
2484
2474
  const [offices, setOffices] = useState([]);
2485
2475
  const { data } = useLeadFormData('REGION_RF');
2486
2476
  const regionValue = field('regionRetail')?.value || {};
2487
- const fieldBranch = field('addressRetail');
2477
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2478
+ field('addressRetail');
2488
2479
  useEffect(() => {
2489
2480
  (async () => {
2490
2481
  const officesList = await regionOffices(regionValue?.key ?? '');
@@ -2504,7 +2495,7 @@
2504
2495
  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 = '' }) => ({
2505
2496
  key: id?.toString() || '',
2506
2497
  text: address,
2507
- })), ...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 }) }) })] }));
2498
+ })), ...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" }) }) })] }));
2508
2499
  });
2509
2500
 
2510
2501
  const useNormalizedInput = (props, { normalize, format }) => {
@@ -6393,11 +6384,18 @@
6393
6384
  };
6394
6385
  };
6395
6386
 
6387
+ const dateToISO = (date) => {
6388
+ if (!date) {
6389
+ return '';
6390
+ }
6391
+ return new Date(date).toISOString().split('.')[0];
6392
+ };
6393
+
6396
6394
  const getDeliveryData = (formData) => {
6397
6395
  const { methodObtain, deliveryDate = '' } = formData;
6398
6396
  return {
6399
6397
  courierDeliveryFlg: methodObtain === 'courier',
6400
- deliveryDate: formatDate(deliveryDate, true),
6398
+ deliveryDate: dateToISO(deliveryDate),
6401
6399
  deliveryTimeCd: { value: 'TIME_2' },
6402
6400
  };
6403
6401
  };
@@ -6890,17 +6888,21 @@
6890
6888
  ];
6891
6889
  const CreditCardForm = JSX(({ className, ...rest }) => {
6892
6890
  const [step, setStep] = useState(0);
6891
+ const formContainerRef = useRef(null);
6892
+ const scrollToTop = useCallback(() => formContainerRef?.current?.scrollIntoView({ behavior: 'smooth' }), [formContainerRef]);
6893
6893
  useEffect(updateRefreshToken, []);
6894
6894
  const handleNextStep = useCallback(() => {
6895
6895
  setStep((_) => Math.min(_ + 1, WIZARD_STEPS$1));
6896
+ scrollToTop();
6896
6897
  }, []);
6897
6898
  const handlePrevStep = useCallback(() => {
6898
6899
  //TODO search hook - 1,
6899
6900
  setStep((_) => Math.max(_ - 1, 0));
6901
+ scrollToTop();
6900
6902
  }, []);
6901
6903
  const sections = useMemo(() => stepsSectionsMap$1[step], [step]);
6902
6904
  const [isFormFinished, setIsFormFinished] = useState(false);
6903
- 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)) })] }) }));
6905
+ 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)) })] }) }));
6904
6906
  });
6905
6907
 
6906
6908
  const CreditFormProgress = JSX(({ step = 1, totalSteps = 5, stepsTitles = [] }) => {
@@ -7671,18 +7673,22 @@
7671
7673
  ];
7672
7674
  const CreditForm = JSX(({ className, ...rest }) => {
7673
7675
  const [step, setStep] = useState(0);
7676
+ const formContainerRef = useRef(null);
7677
+ const scrollToTop = useCallback(() => formContainerRef?.current?.scrollIntoView({ behavior: 'smooth' }), [formContainerRef]);
7674
7678
  useEffect(updateRefreshToken, []);
7675
7679
  const handleNextStep = useCallback(() => {
7676
7680
  setStep((_) => Math.min(_ + 1, WIZARD_STEPS));
7681
+ scrollToTop();
7677
7682
  }, []);
7678
7683
  const handlePrevStep = useCallback(() => {
7679
7684
  //TODO search hook - 1,
7680
7685
  setStep((_) => Math.max(_ - 1, 0));
7686
+ scrollToTop();
7681
7687
  }, []);
7682
7688
  const sections = useMemo(() => stepsSectionsMap[step], [step]);
7683
7689
  const isStartStep = step === 0;
7684
7690
  const [isFormFinished, setIsFormFinished] = useState(false);
7685
- 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
7691
+ 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
7686
7692
  ? ({ registerSubmit, field }) => (jsx(CalculatorCredit, { ...{
7687
7693
  defaultParams: {
7688
7694
  sum: field('moneyValue').value,
@@ -9592,7 +9598,7 @@
9592
9598
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
9593
9599
  });
9594
9600
 
9595
- const packageVersion = "0.14.666";
9601
+ const packageVersion = "0.14.668";
9596
9602
 
9597
9603
  exports.Blocks = Blocks;
9598
9604
  exports.ContentPage = ContentPage;