@redneckz/wildless-cms-uni-blocks 0.14.205 → 0.14.207

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 (51) hide show
  1. package/bundle/bundle.umd.js +23 -9
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/utils/isUUID.d.ts +1 -1
  4. package/dist/components/Footer/Contacts.js +1 -1
  5. package/dist/components/Footer/Contacts.js.map +1 -1
  6. package/dist/hooks/useNavigateHandler.js +13 -4
  7. package/dist/hooks/useNavigateHandler.js.map +1 -1
  8. package/dist/utils/adjustHref.js +7 -2
  9. package/dist/utils/adjustHref.js.map +1 -1
  10. package/dist/utils/isUUID.d.ts +1 -1
  11. package/dist/utils/isUUID.js +1 -1
  12. package/dist/utils/isUUID.js.map +1 -1
  13. package/lib/components/Footer/Contacts.js +1 -1
  14. package/lib/components/Footer/Contacts.js.map +1 -1
  15. package/lib/hooks/useNavigateHandler.js +13 -4
  16. package/lib/hooks/useNavigateHandler.js.map +1 -1
  17. package/lib/utils/adjustHref.js +8 -3
  18. package/lib/utils/adjustHref.js.map +1 -1
  19. package/lib/utils/isUUID.d.ts +1 -1
  20. package/lib/utils/isUUID.js +1 -1
  21. package/lib/utils/isUUID.js.map +1 -1
  22. package/mobile/bundle/bundle.umd.js +23 -9
  23. package/mobile/bundle/bundle.umd.min.js +1 -1
  24. package/mobile/bundle/utils/isUUID.d.ts +1 -1
  25. package/mobile/dist/components/Footer/Contacts.js +1 -1
  26. package/mobile/dist/components/Footer/Contacts.js.map +1 -1
  27. package/mobile/dist/hooks/useNavigateHandler.js +13 -4
  28. package/mobile/dist/hooks/useNavigateHandler.js.map +1 -1
  29. package/mobile/dist/utils/adjustHref.js +7 -2
  30. package/mobile/dist/utils/adjustHref.js.map +1 -1
  31. package/mobile/dist/utils/isUUID.d.ts +1 -1
  32. package/mobile/dist/utils/isUUID.js +1 -1
  33. package/mobile/dist/utils/isUUID.js.map +1 -1
  34. package/mobile/lib/components/Footer/Contacts.js +1 -1
  35. package/mobile/lib/components/Footer/Contacts.js.map +1 -1
  36. package/mobile/lib/hooks/useNavigateHandler.js +13 -4
  37. package/mobile/lib/hooks/useNavigateHandler.js.map +1 -1
  38. package/mobile/lib/utils/adjustHref.js +8 -3
  39. package/mobile/lib/utils/adjustHref.js.map +1 -1
  40. package/mobile/lib/utils/isUUID.d.ts +1 -1
  41. package/mobile/lib/utils/isUUID.js +1 -1
  42. package/mobile/lib/utils/isUUID.js.map +1 -1
  43. package/mobile/src/components/Footer/Contacts.tsx +1 -1
  44. package/mobile/src/hooks/useNavigateHandler.ts +14 -4
  45. package/mobile/src/utils/adjustHref.ts +10 -3
  46. package/mobile/src/utils/isUUID.ts +1 -1
  47. package/package.json +1 -1
  48. package/src/components/Footer/Contacts.tsx +1 -1
  49. package/src/hooks/useNavigateHandler.ts +14 -4
  50. package/src/utils/adjustHref.ts +10 -3
  51. package/src/utils/isUUID.ts +1 -1
@@ -292,7 +292,7 @@
292
292
 
293
293
  const dirname = (path) => path?.split('/').slice(0, -1).join('/');
294
294
 
295
- const isUUID = (src) => {
295
+ const isUUID = (src = '') => {
296
296
  return /^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}(\/revs\/[0-9]{1,20})?$/.test(src);
297
297
  };
298
298
 
@@ -314,13 +314,18 @@
314
314
  const PREFIX_API = '/api/';
315
315
  const FILE_STORAGE_API = `${PREFIX_API}v1/storage`;
316
316
  const adjustHref = (router) => (href, basePath = projectSettings.BASE_PATH) => {
317
- if (!href || isURL(href) || [projectSettings.CDN, PREFIX_API].some((_) => hasPrefix(href, _))) {
317
+ if ([
318
+ !href,
319
+ isURL(href),
320
+ isHash(href),
321
+ [projectSettings.CDN, PREFIX_API].some((_) => hasPrefix(href, _)),
322
+ ].some(Boolean)) {
318
323
  return href;
319
324
  }
320
325
  if (isUUID(href)) {
321
326
  return `${FILE_STORAGE_API}/${href}/file`;
322
327
  }
323
- const isRelativeToBase = href.startsWith('/');
328
+ const isRelativeToBase = href?.startsWith('/');
324
329
  return joinPath(hasPrefix(href, basePath) ? '' : basePath, isRelativeToBase ? '/' : dirname(router.pathname), href);
325
330
  };
326
331
  const hasPrefix = (href, prefix) => prefix && href && href.startsWith(prefix);
@@ -4106,7 +4111,7 @@
4106
4111
  }
4107
4112
  };
4108
4113
 
4109
- const Contacts = JSX(({ className = '', items }) => (jsxs("div", { className: className, children: [items?.length ? items.map(renderContactsGroup) : null, jsx(LinkButton, { version: "primary", className: "w-full", href: "https://beta.rshb.ru/natural/feedback/question", target: "_blank", ariaLabel: "\u041E\u0431\u0440\u0430\u0442\u043D\u0430\u044F \u0441\u0432\u044F\u0437\u044C", text: "\u041E\u0431\u0440\u0430\u0442\u043D\u0430\u044F \u0441\u0432\u044F\u0437\u044C" })] })));
4114
+ const Contacts = JSX(({ className = '', items }) => (jsxs("div", { className: className, children: [items?.length ? items.map(renderContactsGroup) : null, jsx(LinkButton, { version: "primary", className: "w-full", href: "https://www.rshb.ru/natural/feedback/question", target: "_blank", ariaLabel: "\u041E\u0431\u0440\u0430\u0442\u043D\u0430\u044F \u0441\u0432\u044F\u0437\u044C", text: "\u041E\u0431\u0440\u0430\u0442\u043D\u0430\u044F \u0441\u0432\u044F\u0437\u044C" })] })));
4110
4115
  const renderContactsGroup = (item, i) => (jsxs("div", { className: "mb-m space-y-m", children: [jsx("div", { children: jsx(Text, { size: "text-l", font: "font-medium", children: item?.title }) }), jsx("div", { className: "space-y-m", children: item.items?.map(renderContact) })] }, String(i)));
4111
4116
  const renderContact = (item, index) => (jsxs("div", { className: "space-y-2xs", children: [jsx("div", { children: renderText(item.type, item.text) }), jsx(Paragraph, { size: "text-s", font: "font-light", color: "text-secondary-text", children: item.description })] }, String(index)));
4112
4117
  const renderText = (type, text = '') => {
@@ -5882,12 +5887,21 @@
5882
5887
  useEventListener(globalThis, 'click', navigationHandler);
5883
5888
  };
5884
5889
  const navigationHandler = (ev) => {
5885
- const target = ev.target;
5886
- if (target?.tagName === 'A' && isURL(target.href)) {
5890
+ const element = getAnchorElement(ev.target);
5891
+ if (isURL(element?.href)) {
5887
5892
  ev.preventDefault();
5888
- const url = adjustSessionQuery(target.href) || target.href;
5889
- globalThis.location.href = url;
5893
+ const url = adjustSessionQuery(element?.href) || element?.href;
5894
+ if (url) {
5895
+ globalThis.location.href = url;
5896
+ }
5897
+ }
5898
+ };
5899
+ const getAnchorElement = (target) => {
5900
+ let _target = target;
5901
+ while (Boolean(_target) && _target.tagName !== 'A') {
5902
+ _target = _target?.parentNode;
5890
5903
  }
5904
+ return _target;
5891
5905
  };
5892
5906
 
5893
5907
  const COOKIE_DIALOG_ID = 'cookie';
@@ -6040,7 +6054,7 @@
6040
6054
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
6041
6055
  });
6042
6056
 
6043
- const packageVersion = "0.14.204";
6057
+ const packageVersion = "0.14.206";
6044
6058
 
6045
6059
  exports.Blocks = Blocks;
6046
6060
  exports.ContentPage = ContentPage;