@redneckz/wildless-cms-uni-blocks 0.14.214 → 0.14.216

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 (134) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +22 -15
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/hooks/handlerDecorator.d.ts +1 -1
  5. package/bundle/hooks/useNavigateHandler.d.ts +1 -0
  6. package/bundle/model/LinkProps.d.ts +6 -0
  7. package/bundle/utils/dataAttributes.d.ts +2 -0
  8. package/dist/components/ApplicationFormCustom/AddressBranchField.js +3 -4
  9. package/dist/components/ApplicationFormCustom/AddressBranchField.js.map +1 -1
  10. package/dist/components/ApplicationFormCustom/RegionPremiumField.js +1 -1
  11. package/dist/components/ApplicationFormCustom/RegionPremiumField.js.map +1 -1
  12. package/dist/hooks/handlerDecorator.d.ts +1 -1
  13. package/dist/hooks/handlerDecorator.js +2 -2
  14. package/dist/hooks/handlerDecorator.js.map +1 -1
  15. package/dist/hooks/useLink.js +1 -1
  16. package/dist/hooks/useLink.js.map +1 -1
  17. package/dist/hooks/useNavigateHandler.d.ts +1 -0
  18. package/dist/hooks/useNavigateHandler.js +10 -3
  19. package/dist/hooks/useNavigateHandler.js.map +1 -1
  20. package/dist/hooks/usePremiumBranchesByRegions.js +1 -1
  21. package/dist/hooks/usePremiumBranchesByRegions.js.map +1 -1
  22. package/dist/hooks/useRegions.js +1 -1
  23. package/dist/hooks/useRegions.js.map +1 -1
  24. package/dist/model/LinkProps.d.ts +6 -0
  25. package/dist/ui-kit/Button/useButton.js +1 -1
  26. package/dist/ui-kit/Button/useButton.js.map +1 -1
  27. package/dist/ui-kit/LinkButton/LinkButton.js +2 -1
  28. package/dist/ui-kit/LinkButton/LinkButton.js.map +1 -1
  29. package/dist/utils/dataAttributes.d.ts +2 -0
  30. package/dist/utils/dataAttributes.js +5 -0
  31. package/dist/utils/dataAttributes.js.map +1 -0
  32. package/lib/common.css +1 -1
  33. package/lib/components/ApplicationFormCustom/AddressBranchField.js +3 -4
  34. package/lib/components/ApplicationFormCustom/AddressBranchField.js.map +1 -1
  35. package/lib/components/ApplicationFormCustom/RegionPremiumField.js +1 -1
  36. package/lib/components/ApplicationFormCustom/RegionPremiumField.js.map +1 -1
  37. package/lib/hooks/handlerDecorator.d.ts +1 -1
  38. package/lib/hooks/handlerDecorator.js +2 -2
  39. package/lib/hooks/handlerDecorator.js.map +1 -1
  40. package/lib/hooks/useLink.js +1 -1
  41. package/lib/hooks/useLink.js.map +1 -1
  42. package/lib/hooks/useNavigateHandler.d.ts +1 -0
  43. package/lib/hooks/useNavigateHandler.js +10 -2
  44. package/lib/hooks/useNavigateHandler.js.map +1 -1
  45. package/lib/hooks/usePremiumBranchesByRegions.js +1 -1
  46. package/lib/hooks/usePremiumBranchesByRegions.js.map +1 -1
  47. package/lib/hooks/useRegions.js +1 -1
  48. package/lib/hooks/useRegions.js.map +1 -1
  49. package/lib/model/LinkProps.d.ts +6 -0
  50. package/lib/ui-kit/Button/useButton.js +1 -1
  51. package/lib/ui-kit/Button/useButton.js.map +1 -1
  52. package/lib/ui-kit/LinkButton/LinkButton.js +2 -1
  53. package/lib/ui-kit/LinkButton/LinkButton.js.map +1 -1
  54. package/lib/utils/dataAttributes.d.ts +2 -0
  55. package/lib/utils/dataAttributes.js +2 -0
  56. package/lib/utils/dataAttributes.js.map +1 -0
  57. package/mobile/bundle/bundle.umd.js +22 -15
  58. package/mobile/bundle/bundle.umd.min.js +1 -1
  59. package/mobile/bundle/hooks/handlerDecorator.d.ts +1 -1
  60. package/mobile/bundle/hooks/useNavigateHandler.d.ts +1 -0
  61. package/mobile/bundle/model/LinkProps.d.ts +6 -0
  62. package/mobile/bundle/utils/dataAttributes.d.ts +2 -0
  63. package/mobile/dist/components/ApplicationFormCustom/AddressBranchField.js +3 -4
  64. package/mobile/dist/components/ApplicationFormCustom/AddressBranchField.js.map +1 -1
  65. package/mobile/dist/components/ApplicationFormCustom/RegionPremiumField.js +1 -1
  66. package/mobile/dist/components/ApplicationFormCustom/RegionPremiumField.js.map +1 -1
  67. package/mobile/dist/hooks/handlerDecorator.d.ts +1 -1
  68. package/mobile/dist/hooks/handlerDecorator.js +2 -2
  69. package/mobile/dist/hooks/handlerDecorator.js.map +1 -1
  70. package/mobile/dist/hooks/useLink.js +1 -1
  71. package/mobile/dist/hooks/useLink.js.map +1 -1
  72. package/mobile/dist/hooks/useNavigateHandler.d.ts +1 -0
  73. package/mobile/dist/hooks/useNavigateHandler.js +10 -3
  74. package/mobile/dist/hooks/useNavigateHandler.js.map +1 -1
  75. package/mobile/dist/hooks/usePremiumBranchesByRegions.js +1 -1
  76. package/mobile/dist/hooks/usePremiumBranchesByRegions.js.map +1 -1
  77. package/mobile/dist/hooks/useRegions.js +1 -1
  78. package/mobile/dist/hooks/useRegions.js.map +1 -1
  79. package/mobile/dist/model/LinkProps.d.ts +6 -0
  80. package/mobile/dist/ui-kit/Button/useButton.js +1 -1
  81. package/mobile/dist/ui-kit/Button/useButton.js.map +1 -1
  82. package/mobile/dist/ui-kit/LinkButton/LinkButton.js +2 -1
  83. package/mobile/dist/ui-kit/LinkButton/LinkButton.js.map +1 -1
  84. package/mobile/dist/utils/dataAttributes.d.ts +2 -0
  85. package/mobile/dist/utils/dataAttributes.js +5 -0
  86. package/mobile/dist/utils/dataAttributes.js.map +1 -0
  87. package/mobile/lib/common.css +1 -1
  88. package/mobile/lib/components/ApplicationFormCustom/AddressBranchField.js +3 -4
  89. package/mobile/lib/components/ApplicationFormCustom/AddressBranchField.js.map +1 -1
  90. package/mobile/lib/components/ApplicationFormCustom/RegionPremiumField.js +1 -1
  91. package/mobile/lib/components/ApplicationFormCustom/RegionPremiumField.js.map +1 -1
  92. package/mobile/lib/hooks/handlerDecorator.d.ts +1 -1
  93. package/mobile/lib/hooks/handlerDecorator.js +2 -2
  94. package/mobile/lib/hooks/handlerDecorator.js.map +1 -1
  95. package/mobile/lib/hooks/useLink.js +1 -1
  96. package/mobile/lib/hooks/useLink.js.map +1 -1
  97. package/mobile/lib/hooks/useNavigateHandler.d.ts +1 -0
  98. package/mobile/lib/hooks/useNavigateHandler.js +10 -2
  99. package/mobile/lib/hooks/useNavigateHandler.js.map +1 -1
  100. package/mobile/lib/hooks/usePremiumBranchesByRegions.js +1 -1
  101. package/mobile/lib/hooks/usePremiumBranchesByRegions.js.map +1 -1
  102. package/mobile/lib/hooks/useRegions.js +1 -1
  103. package/mobile/lib/hooks/useRegions.js.map +1 -1
  104. package/mobile/lib/model/LinkProps.d.ts +6 -0
  105. package/mobile/lib/ui-kit/Button/useButton.js +1 -1
  106. package/mobile/lib/ui-kit/Button/useButton.js.map +1 -1
  107. package/mobile/lib/ui-kit/LinkButton/LinkButton.js +2 -1
  108. package/mobile/lib/ui-kit/LinkButton/LinkButton.js.map +1 -1
  109. package/mobile/lib/utils/dataAttributes.d.ts +2 -0
  110. package/mobile/lib/utils/dataAttributes.js +2 -0
  111. package/mobile/lib/utils/dataAttributes.js.map +1 -0
  112. package/mobile/src/components/ApplicationFormCustom/AddressBranchField.tsx +3 -4
  113. package/mobile/src/components/ApplicationFormCustom/RegionPremiumField.tsx +1 -1
  114. package/mobile/src/hooks/handlerDecorator.ts +3 -3
  115. package/mobile/src/hooks/useLink.ts +1 -1
  116. package/mobile/src/hooks/useNavigateHandler.ts +20 -6
  117. package/mobile/src/hooks/usePremiumBranchesByRegions.ts +1 -1
  118. package/mobile/src/hooks/useRegions.ts +1 -1
  119. package/mobile/src/model/LinkProps.ts +7 -0
  120. package/mobile/src/ui-kit/Button/useButton.ts +1 -1
  121. package/mobile/src/ui-kit/LinkButton/LinkButton.tsx +16 -1
  122. package/mobile/src/utils/dataAttributes.ts +4 -0
  123. package/package.json +1 -1
  124. package/src/components/ApplicationFormCustom/AddressBranchField.tsx +3 -4
  125. package/src/components/ApplicationFormCustom/RegionPremiumField.tsx +1 -1
  126. package/src/hooks/handlerDecorator.ts +3 -3
  127. package/src/hooks/useLink.ts +1 -1
  128. package/src/hooks/useNavigateHandler.ts +20 -6
  129. package/src/hooks/usePremiumBranchesByRegions.ts +1 -1
  130. package/src/hooks/useRegions.ts +1 -1
  131. package/src/model/LinkProps.ts +7 -0
  132. package/src/ui-kit/Button/useButton.ts +1 -1
  133. package/src/ui-kit/LinkButton/LinkButton.tsx +16 -1
  134. package/src/utils/dataAttributes.ts +4 -0
@@ -434,8 +434,8 @@
434
434
  });
435
435
 
436
436
  /* eslint-disable @typescript-eslint/ban-types */
437
- const handlerDecorator = (handler, targetContent) => {
438
- return handlerDecorator._impl(handler, targetContent);
437
+ const handlerDecorator = (handler) => {
438
+ return handlerDecorator._impl(handler);
439
439
  };
440
440
  handlerDecorator._impl = (handler) => handler;
441
441
  handlerDecorator.setup = (impl) => {
@@ -450,7 +450,7 @@
450
450
  ...props,
451
451
  href: isRemote && !basePath ? props.href : adjustHref(router)(props.href, basePath),
452
452
  'aria-label': props.text,
453
- onClick: handlerDecorator(handleHref(props), props),
453
+ onClick: handlerDecorator(handleHref(props)),
454
454
  });
455
455
  function handleHref({ href, target, onClick }) {
456
456
  return (ev) => {
@@ -467,6 +467,8 @@
467
467
  }
468
468
  }
469
469
 
470
+ const dataAttributes = (data = {}) => Object.entries(data).reduce((res, [k, v]) => ({ ...res, [`data-${k.toLowerCase()}`]: v }), {});
471
+
470
472
  /** @deprecated */
471
473
  const ButtonInner = JSX((props) => {
472
474
  const { text, aboveText, appendLeft, appendRight, version = 'primary' } = props;
@@ -522,7 +524,7 @@
522
524
  const buttonInner = children ?? jsx(ButtonInner, { ...adjustedProps });
523
525
  return disabled ? (jsx(DisabledButton, { ...adjustedProps, children: buttonInner })) : (jsx(RegularButton, { ...adjustedProps, children: buttonInner }));
524
526
  });
525
- const RegularButton = JSX(({ className = '', href, rel, target, ariaLabel, version, rounded, onClick, type, children }) => (jsx("a", { className: getRegularButtonClasses({ className, version, rounded }), href: href, rel: rel, target: target, "aria-label": ariaLabel, role: href ? 'link' : 'button', onClick: onClick, type: type, children: children })));
527
+ const RegularButton = JSX(({ className = '', href, rel, target, ariaLabel, version, rounded, onClick, type, data, children, }) => (jsx("a", { className: getRegularButtonClasses({ className, version, rounded }), href: href, rel: rel, target: target, "aria-label": ariaLabel, role: href ? 'link' : 'button', onClick: onClick, type: type, ...dataAttributes(data), children: children })));
526
528
  const DisabledButton = JSX(({ className, ariaLabel, version, rounded, children }) => (jsx("button", { type: "button", "aria-disabled": "true", "aria-label": ariaLabel, tabIndex: -1, className: getDisabledButtonClasses({ className, rounded, version }), children: children })));
527
529
 
528
530
  function renderBackwardButton(version, handleClick) {
@@ -1321,7 +1323,7 @@
1321
1323
  const REGIONS_URL$1 = '/api/v1/premiumBranchesByRegions';
1322
1324
  function usePremiumBranchesByRegions() {
1323
1325
  const { data } = useAsyncData(REGIONS_URL$1, fetchJSONUnsafe);
1324
- return data || [];
1326
+ return Array.isArray(data) ? data : [];
1325
1327
  }
1326
1328
 
1327
1329
  const SVG = JSX(({ className, viewBox, fill = 'none', width, height, paths, ...commonOptions }) => {
@@ -1487,7 +1489,7 @@
1487
1489
  const REGIONS_URL = '/api/v1/regions';
1488
1490
  function useRegions() {
1489
1491
  const { data } = useAsyncData(REGIONS_URL, fetchJSONUnsafe);
1490
- return data || [];
1492
+ return Array.isArray(data) ? data : [];
1491
1493
  }
1492
1494
 
1493
1495
  const RegionField = JSX(({ field, input }) => {
@@ -1500,7 +1502,7 @@
1500
1502
  const regions = useMemo(() => branchByRegions?.map(({ region }) => ({
1501
1503
  key: region,
1502
1504
  text: region,
1503
- })), []);
1505
+ })), [branchByRegions]);
1504
1506
  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", options: regions, ...getValidation(field('region'), validatorObj.region, input?.required) }));
1505
1507
  });
1506
1508
 
@@ -1551,12 +1553,11 @@
1551
1553
  const addressBranch = isPremium
1552
1554
  ? usePremiumBranchesByRegions()?.find((_) => _?.region === regionKey)?.branches
1553
1555
  : useBranches(regionKey)?.filter((branch) => branch?.address);
1554
- const { value, onChange } = field?.('addressBranch') || {};
1555
1556
  useEffect(() => {
1556
- if (value?.key !== '') {
1557
- onChange?.('');
1557
+ if (field('region')?.value?.key !== '') {
1558
+ field?.('addressBranch')?.onChange?.('');
1558
1559
  }
1559
- }, [value]);
1560
+ }, [field('region')?.value]);
1560
1561
  return (jsx(SelectControl, { label: "\u0410\u0434\u0440\u0435\u0441", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0430\u0434\u0440\u0435\u0441", options: (addressBranch || []).map(({ address = '' }) => ({
1561
1562
  key: address,
1562
1563
  text: address,
@@ -1592,7 +1593,7 @@
1592
1593
  function useButton() {
1593
1594
  return (props) => ({
1594
1595
  ...props,
1595
- onClick: handlerDecorator(handleClick(props), props),
1596
+ onClick: handlerDecorator(handleClick(props)),
1596
1597
  });
1597
1598
  }
1598
1599
  function handleClick({ disabled, onClick }) {
@@ -5780,16 +5781,22 @@
5780
5781
  return url.toString();
5781
5782
  };
5782
5783
 
5783
- const useNavigateHandler = () => {
5784
+ const useNavigateHandler = handlerDecorator(() => {
5784
5785
  useEffect(() => {
5785
5786
  getSessionQuery(); //? Call first time for save query in sessionStorage
5786
5787
  }, []);
5787
5788
  useEventListener(globalThis, 'click', navigationHandler);
5788
- };
5789
+ });
5789
5790
  const navigationHandler = (ev) => {
5790
5791
  const element = getAnchorElement(ev.target);
5792
+ const [ymID] = projectSettings._.YANDEX_METRIKA_ID?.split(',').reverse() ?? [];
5793
+ const targetName = element?.dataset?.ymtarget;
5794
+ if ([ymID, targetName, globalThis.ym].every(Boolean)) {
5795
+ globalThis.ym(ymID, 'reachGoal', targetName);
5796
+ }
5791
5797
  if (isURL(element?.href)) {
5792
5798
  ev.preventDefault();
5799
+ ev.stopPropagation();
5793
5800
  const url = adjustSessionQuery(element?.href) || element?.href;
5794
5801
  if (url) {
5795
5802
  globalThis.location.href = url;
@@ -5954,7 +5961,7 @@
5954
5961
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
5955
5962
  });
5956
5963
 
5957
- const packageVersion = "0.14.213";
5964
+ const packageVersion = "0.14.215";
5958
5965
 
5959
5966
  exports.Blocks = Blocks;
5960
5967
  exports.ContentPage = ContentPage;