@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
@@ -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 }) => {
@@ -6413,11 +6404,18 @@
6413
6404
  };
6414
6405
  };
6415
6406
 
6407
+ const dateToISO = (date) => {
6408
+ if (!date) {
6409
+ return '';
6410
+ }
6411
+ return new Date(date).toISOString().split('.')[0];
6412
+ };
6413
+
6416
6414
  const getDeliveryData = (formData) => {
6417
6415
  const { methodObtain, deliveryDate = '' } = formData;
6418
6416
  return {
6419
6417
  courierDeliveryFlg: methodObtain === 'courier',
6420
- deliveryDate: formatDate(deliveryDate, true),
6418
+ deliveryDate: dateToISO(deliveryDate),
6421
6419
  deliveryTimeCd: { value: 'TIME_2' },
6422
6420
  };
6423
6421
  };
@@ -6910,17 +6908,21 @@
6910
6908
  ];
6911
6909
  const CreditCardForm = JSX(({ className, ...rest }) => {
6912
6910
  const [step, setStep] = useState(0);
6911
+ const formContainerRef = useRef(null);
6912
+ const scrollToTop = useCallback(() => formContainerRef?.current?.scrollIntoView({ behavior: 'smooth' }), [formContainerRef]);
6913
6913
  useEffect(updateRefreshToken, []);
6914
6914
  const handleNextStep = useCallback(() => {
6915
6915
  setStep((_) => Math.min(_ + 1, WIZARD_STEPS$1));
6916
+ scrollToTop();
6916
6917
  }, []);
6917
6918
  const handlePrevStep = useCallback(() => {
6918
6919
  //TODO search hook - 1,
6919
6920
  setStep((_) => Math.max(_ - 1, 0));
6921
+ scrollToTop();
6920
6922
  }, []);
6921
6923
  const sections = useMemo(() => stepsSectionsMap$1[step], [step]);
6922
6924
  const [isFormFinished, setIsFormFinished] = useState(false);
6923
- 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)) })] }) }));
6924
6926
  });
6925
6927
 
6926
6928
  const CreditFormProgress = JSX(({ step = 1, totalSteps = 5, stepsTitles = [] }) => {
@@ -7691,18 +7693,22 @@
7691
7693
  ];
7692
7694
  const CreditForm = JSX(({ className, ...rest }) => {
7693
7695
  const [step, setStep] = useState(0);
7696
+ const formContainerRef = useRef(null);
7697
+ const scrollToTop = useCallback(() => formContainerRef?.current?.scrollIntoView({ behavior: 'smooth' }), [formContainerRef]);
7694
7698
  useEffect(updateRefreshToken, []);
7695
7699
  const handleNextStep = useCallback(() => {
7696
7700
  setStep((_) => Math.min(_ + 1, WIZARD_STEPS));
7701
+ scrollToTop();
7697
7702
  }, []);
7698
7703
  const handlePrevStep = useCallback(() => {
7699
7704
  //TODO search hook - 1,
7700
7705
  setStep((_) => Math.max(_ - 1, 0));
7706
+ scrollToTop();
7701
7707
  }, []);
7702
7708
  const sections = useMemo(() => stepsSectionsMap[step], [step]);
7703
7709
  const isStartStep = step === 0;
7704
7710
  const [isFormFinished, setIsFormFinished] = useState(false);
7705
- 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
7706
7712
  ? ({ registerSubmit, field }) => (jsx(CalculatorCredit, { ...{
7707
7713
  defaultParams: {
7708
7714
  sum: field('moneyValue').value,
@@ -9978,7 +9984,7 @@
9978
9984
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
9979
9985
  });
9980
9986
 
9981
- const packageVersion = "0.14.666";
9987
+ const packageVersion = "0.14.668";
9982
9988
 
9983
9989
  exports.Blocks = Blocks;
9984
9990
  exports.ContentPage = ContentPage;