@redneckz/wildless-cms-uni-blocks 0.14.213 → 0.14.215

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 (118) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +19 -11
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/hooks/useNavigateHandler.d.ts +1 -0
  5. package/bundle/model/LinkProps.d.ts +6 -0
  6. package/bundle/utils/dataAttributes.d.ts +2 -0
  7. package/dist/components/ApplicationFormCustom/AddressBranchField.js +2 -2
  8. package/dist/components/ApplicationFormCustom/AddressBranchField.js.map +1 -1
  9. package/dist/components/ApplicationFormCustom/ApplicationFormCustom.js +1 -1
  10. package/dist/components/ApplicationFormCustom/ApplicationFormCustom.js.map +1 -1
  11. package/dist/components/ApplicationFormCustom/RegionField.js +1 -1
  12. package/dist/components/ApplicationFormCustom/RegionField.js.map +1 -1
  13. package/dist/components/ApplicationFormCustom/RegionPremiumField.js +1 -1
  14. package/dist/components/ApplicationFormCustom/RegionPremiumField.js.map +1 -1
  15. package/dist/components/ApplicationFormCustom/getFormatData.js +1 -1
  16. package/dist/components/ApplicationFormCustom/getFormatData.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/model/LinkProps.d.ts +6 -0
  21. package/dist/ui-kit/Button/useButton.js +1 -1
  22. package/dist/ui-kit/Button/useButton.js.map +1 -1
  23. package/dist/ui-kit/LinkButton/LinkButton.js +2 -1
  24. package/dist/ui-kit/LinkButton/LinkButton.js.map +1 -1
  25. package/dist/utils/dataAttributes.d.ts +2 -0
  26. package/dist/utils/dataAttributes.js +5 -0
  27. package/dist/utils/dataAttributes.js.map +1 -0
  28. package/lib/common.css +1 -1
  29. package/lib/components/ApplicationFormCustom/AddressBranchField.js +2 -2
  30. package/lib/components/ApplicationFormCustom/AddressBranchField.js.map +1 -1
  31. package/lib/components/ApplicationFormCustom/ApplicationFormCustom.js +1 -1
  32. package/lib/components/ApplicationFormCustom/ApplicationFormCustom.js.map +1 -1
  33. package/lib/components/ApplicationFormCustom/RegionField.js +1 -1
  34. package/lib/components/ApplicationFormCustom/RegionField.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/components/ApplicationFormCustom/getFormatData.js +1 -1
  38. package/lib/components/ApplicationFormCustom/getFormatData.js.map +1 -1
  39. package/lib/hooks/useNavigateHandler.d.ts +1 -0
  40. package/lib/hooks/useNavigateHandler.js +10 -2
  41. package/lib/hooks/useNavigateHandler.js.map +1 -1
  42. package/lib/model/LinkProps.d.ts +6 -0
  43. package/lib/ui-kit/Button/useButton.js +1 -1
  44. package/lib/ui-kit/Button/useButton.js.map +1 -1
  45. package/lib/ui-kit/LinkButton/LinkButton.js +2 -1
  46. package/lib/ui-kit/LinkButton/LinkButton.js.map +1 -1
  47. package/lib/utils/dataAttributes.d.ts +2 -0
  48. package/lib/utils/dataAttributes.js +2 -0
  49. package/lib/utils/dataAttributes.js.map +1 -0
  50. package/mobile/bundle/bundle.umd.js +19 -11
  51. package/mobile/bundle/bundle.umd.min.js +1 -1
  52. package/mobile/bundle/hooks/useNavigateHandler.d.ts +1 -0
  53. package/mobile/bundle/model/LinkProps.d.ts +6 -0
  54. package/mobile/bundle/utils/dataAttributes.d.ts +2 -0
  55. package/mobile/dist/components/ApplicationFormCustom/AddressBranchField.js +2 -2
  56. package/mobile/dist/components/ApplicationFormCustom/AddressBranchField.js.map +1 -1
  57. package/mobile/dist/components/ApplicationFormCustom/ApplicationFormCustom.js +1 -1
  58. package/mobile/dist/components/ApplicationFormCustom/ApplicationFormCustom.js.map +1 -1
  59. package/mobile/dist/components/ApplicationFormCustom/RegionField.js +1 -1
  60. package/mobile/dist/components/ApplicationFormCustom/RegionField.js.map +1 -1
  61. package/mobile/dist/components/ApplicationFormCustom/RegionPremiumField.js +1 -1
  62. package/mobile/dist/components/ApplicationFormCustom/RegionPremiumField.js.map +1 -1
  63. package/mobile/dist/components/ApplicationFormCustom/getFormatData.js +1 -1
  64. package/mobile/dist/components/ApplicationFormCustom/getFormatData.js.map +1 -1
  65. package/mobile/dist/hooks/useNavigateHandler.d.ts +1 -0
  66. package/mobile/dist/hooks/useNavigateHandler.js +10 -3
  67. package/mobile/dist/hooks/useNavigateHandler.js.map +1 -1
  68. package/mobile/dist/model/LinkProps.d.ts +6 -0
  69. package/mobile/dist/ui-kit/Button/useButton.js +1 -1
  70. package/mobile/dist/ui-kit/Button/useButton.js.map +1 -1
  71. package/mobile/dist/ui-kit/LinkButton/LinkButton.js +2 -1
  72. package/mobile/dist/ui-kit/LinkButton/LinkButton.js.map +1 -1
  73. package/mobile/dist/utils/dataAttributes.d.ts +2 -0
  74. package/mobile/dist/utils/dataAttributes.js +5 -0
  75. package/mobile/dist/utils/dataAttributes.js.map +1 -0
  76. package/mobile/lib/common.css +1 -1
  77. package/mobile/lib/components/ApplicationFormCustom/AddressBranchField.js +2 -2
  78. package/mobile/lib/components/ApplicationFormCustom/AddressBranchField.js.map +1 -1
  79. package/mobile/lib/components/ApplicationFormCustom/ApplicationFormCustom.js +1 -1
  80. package/mobile/lib/components/ApplicationFormCustom/ApplicationFormCustom.js.map +1 -1
  81. package/mobile/lib/components/ApplicationFormCustom/RegionField.js +1 -1
  82. package/mobile/lib/components/ApplicationFormCustom/RegionField.js.map +1 -1
  83. package/mobile/lib/components/ApplicationFormCustom/RegionPremiumField.js +1 -1
  84. package/mobile/lib/components/ApplicationFormCustom/RegionPremiumField.js.map +1 -1
  85. package/mobile/lib/components/ApplicationFormCustom/getFormatData.js +1 -1
  86. package/mobile/lib/components/ApplicationFormCustom/getFormatData.js.map +1 -1
  87. package/mobile/lib/hooks/useNavigateHandler.d.ts +1 -0
  88. package/mobile/lib/hooks/useNavigateHandler.js +10 -2
  89. package/mobile/lib/hooks/useNavigateHandler.js.map +1 -1
  90. package/mobile/lib/model/LinkProps.d.ts +6 -0
  91. package/mobile/lib/ui-kit/Button/useButton.js +1 -1
  92. package/mobile/lib/ui-kit/Button/useButton.js.map +1 -1
  93. package/mobile/lib/ui-kit/LinkButton/LinkButton.js +2 -1
  94. package/mobile/lib/ui-kit/LinkButton/LinkButton.js.map +1 -1
  95. package/mobile/lib/utils/dataAttributes.d.ts +2 -0
  96. package/mobile/lib/utils/dataAttributes.js +2 -0
  97. package/mobile/lib/utils/dataAttributes.js.map +1 -0
  98. package/mobile/src/components/ApplicationFormCustom/AddressBranchField.tsx +2 -3
  99. package/mobile/src/components/ApplicationFormCustom/ApplicationFormCustom.tsx +1 -1
  100. package/mobile/src/components/ApplicationFormCustom/RegionField.tsx +1 -1
  101. package/mobile/src/components/ApplicationFormCustom/RegionPremiumField.tsx +1 -1
  102. package/mobile/src/components/ApplicationFormCustom/getFormatData.tsx +1 -1
  103. package/mobile/src/hooks/useNavigateHandler.ts +20 -6
  104. package/mobile/src/model/LinkProps.ts +7 -0
  105. package/mobile/src/ui-kit/Button/useButton.ts +1 -1
  106. package/mobile/src/ui-kit/LinkButton/LinkButton.tsx +16 -1
  107. package/mobile/src/utils/dataAttributes.ts +4 -0
  108. package/package.json +1 -1
  109. package/src/components/ApplicationFormCustom/AddressBranchField.tsx +2 -3
  110. package/src/components/ApplicationFormCustom/ApplicationFormCustom.tsx +1 -1
  111. package/src/components/ApplicationFormCustom/RegionField.tsx +1 -1
  112. package/src/components/ApplicationFormCustom/RegionPremiumField.tsx +1 -1
  113. package/src/components/ApplicationFormCustom/getFormatData.tsx +1 -1
  114. package/src/hooks/useNavigateHandler.ts +20 -6
  115. package/src/model/LinkProps.ts +7 -0
  116. package/src/ui-kit/Button/useButton.ts +1 -1
  117. package/src/ui-kit/LinkButton/LinkButton.tsx +16 -1
  118. package/src/utils/dataAttributes.ts +4 -0
@@ -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) {
@@ -1492,12 +1494,12 @@
1492
1494
 
1493
1495
  const RegionField = JSX(({ field, input }) => {
1494
1496
  const regions = useRegions();
1495
- return (jsx(SelectControl, { label: "\u0424\u0438\u043B\u0438\u0430\u043B", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0438\u043B\u0438\u0430\u043B", isSearch: true, options: useMemo(() => regions.map(({ code = '', name = '' }) => ({ key: code, text: name })), [regions]), ...getValidation(field('region'), validatorObj.region, input?.required) }));
1497
+ return (jsx(SelectControl, { label: "\u0424\u0438\u043B\u0438\u0430\u043B", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0438\u043B\u0438\u0430\u043B", isSearch: true, options: useMemo(() => regions?.map(({ code = '', name = '' }) => ({ key: code, text: name })), [regions]), ...getValidation(field('region'), validatorObj.region, input?.required) }));
1496
1498
  });
1497
1499
 
1498
1500
  const RegionPremiumField = JSX(({ field, input }) => {
1499
1501
  const branchByRegions = usePremiumBranchesByRegions();
1500
- const regions = useMemo(() => branchByRegions.map(({ region }) => ({
1502
+ const regions = useMemo(() => branchByRegions?.map(({ region }) => ({
1501
1503
  key: region,
1502
1504
  text: region,
1503
1505
  })), []);
@@ -1549,8 +1551,8 @@
1549
1551
  const AddressBranchField = JSX(({ field, input, isPremium = false }) => {
1550
1552
  const regionKey = field('region')?.value?.text;
1551
1553
  const addressBranch = isPremium
1552
- ? usePremiumBranchesByRegions().find((_) => _?.region === regionKey)?.branches
1553
- : useBranches(regionKey).filter((branch) => branch?.address);
1554
+ ? usePremiumBranchesByRegions()?.find((_) => _?.region === regionKey)?.branches
1555
+ : useBranches(regionKey)?.filter((branch) => branch?.address);
1554
1556
  const { value, onChange } = field?.('addressBranch') || {};
1555
1557
  useEffect(() => {
1556
1558
  if (value?.key !== '') {
@@ -1592,7 +1594,7 @@
1592
1594
  function useButton() {
1593
1595
  return (props) => ({
1594
1596
  ...props,
1595
- onClick: handlerDecorator(handleClick(props), props),
1597
+ onClick: handlerDecorator(handleClick(props)),
1596
1598
  });
1597
1599
  }
1598
1600
  function handleClick({ disabled, onClick }) {
@@ -1807,7 +1809,7 @@
1807
1809
  const { acquiringType, onlineCheckout, posTerminal, amount, term, annualRevenue, serviceType, ...usedData } = data;
1808
1810
  const partnerComments = acquiringType || annualRevenue ? getPartnerComments(data) : null;
1809
1811
  const formatData = { ...usedData, ...(partnerComments ? { partnerComments } : {}) };
1810
- return Object.fromEntries(Object.entries(formatData).map(([k, v]) => [
1812
+ return Object.fromEntries(Object.entries(formatData)?.map(([k, v]) => [
1811
1813
  k,
1812
1814
  (k === 'region' ? v?.text : v?.key) || v,
1813
1815
  ]));
@@ -1864,7 +1866,7 @@
1864
1866
  return (jsx(ApplicationFormLayout, { className: style(formStyle, className), title: title, responseType: responseType, children: jsxs("form", { className: "", onSubmit: onSubmit, children: [sections.map((_, i) => (jsxs("div", { className: style(inputColumnStyles(_.columns), 'grid gap-x-m'), children: [_?.title ? jsx("div", { className: "@xl:text-center @xl:col-span-2", children: _.title }) : null, _?.inputs?.map(getField(field, typeForm))] }, `section-${i}`))), renderAgreementSubmit(fieldName ? field('consentDataProcessing') : undefined, link, button)] }) }));
1865
1867
  });
1866
1868
  const inputColumnStyles = (column) => column === 2 ? '@xl:grid-cols-2' : '';
1867
- const getConsentDataProcessing = (inputs) => inputs.find((_) => _?.name === 'consentDataProcessing');
1869
+ const getConsentDataProcessing = (inputs) => inputs?.find((_) => _?.name === 'consentDataProcessing');
1868
1870
 
1869
1871
  /** @deprecated */
1870
1872
  const AlignStyles = 'text-center';
@@ -5780,16 +5782,22 @@
5780
5782
  return url.toString();
5781
5783
  };
5782
5784
 
5783
- const useNavigateHandler = () => {
5785
+ const useNavigateHandler = handlerDecorator(() => {
5784
5786
  useEffect(() => {
5785
5787
  getSessionQuery(); //? Call first time for save query in sessionStorage
5786
5788
  }, []);
5787
5789
  useEventListener(globalThis, 'click', navigationHandler);
5788
- };
5790
+ });
5789
5791
  const navigationHandler = (ev) => {
5790
5792
  const element = getAnchorElement(ev.target);
5793
+ const [ymID] = projectSettings._.YANDEX_METRIKA_ID?.split(',').reverse() ?? [];
5794
+ const targetName = element?.dataset?.ymtarget;
5795
+ if ([ymID, targetName, globalThis.ym].every(Boolean)) {
5796
+ globalThis.ym(ymID, 'reachGoal', targetName);
5797
+ }
5791
5798
  if (isURL(element?.href)) {
5792
5799
  ev.preventDefault();
5800
+ ev.stopPropagation();
5793
5801
  const url = adjustSessionQuery(element?.href) || element?.href;
5794
5802
  if (url) {
5795
5803
  globalThis.location.href = url;
@@ -5954,7 +5962,7 @@
5954
5962
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
5955
5963
  });
5956
5964
 
5957
- const packageVersion = "0.14.212";
5965
+ const packageVersion = "0.14.214";
5958
5966
 
5959
5967
  exports.Blocks = Blocks;
5960
5968
  exports.ContentPage = ContentPage;