@redneckz/wildless-cms-uni-blocks 0.14.1057 → 0.14.1058

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 (44) hide show
  1. package/bin/migration-scripts/0.14.1058.js +21 -0
  2. package/bundle/blocks.schema.json +1 -1
  3. package/bundle/bundle.umd.js +11 -11
  4. package/bundle/bundle.umd.min.js +1 -1
  5. package/bundle/model/LinkProps.d.ts +0 -2
  6. package/bundle/ui-kit/LinkButton/LinkButtonContent.d.ts +4 -0
  7. package/dist/model/LinkProps.d.ts +0 -2
  8. package/dist/ui-kit/LinkButton/LinkButton.js +9 -9
  9. package/dist/ui-kit/LinkButton/LinkButton.js.map +1 -1
  10. package/dist/ui-kit/LinkButton/LinkButtonContent.d.ts +4 -0
  11. package/dist/ui-kit/UserSurveyDialog/useUserSurveyDialog.js +1 -1
  12. package/dist/ui-kit/UserSurveyDialog/useUserSurveyDialog.js.map +1 -1
  13. package/lib/model/LinkProps.d.ts +0 -2
  14. package/lib/ui-kit/LinkButton/LinkButton.js +9 -9
  15. package/lib/ui-kit/LinkButton/LinkButton.js.map +1 -1
  16. package/lib/ui-kit/LinkButton/LinkButtonContent.d.ts +4 -0
  17. package/lib/ui-kit/UserSurveyDialog/useUserSurveyDialog.js +1 -1
  18. package/lib/ui-kit/UserSurveyDialog/useUserSurveyDialog.js.map +1 -1
  19. package/mobile/bundle/bundle.umd.js +11 -11
  20. package/mobile/bundle/bundle.umd.min.js +1 -1
  21. package/mobile/bundle/model/LinkProps.d.ts +0 -2
  22. package/mobile/bundle/ui-kit/LinkButton/LinkButtonContent.d.ts +4 -0
  23. package/mobile/dist/model/LinkProps.d.ts +0 -2
  24. package/mobile/dist/ui-kit/LinkButton/LinkButton.js +9 -9
  25. package/mobile/dist/ui-kit/LinkButton/LinkButton.js.map +1 -1
  26. package/mobile/dist/ui-kit/LinkButton/LinkButtonContent.d.ts +4 -0
  27. package/mobile/dist/ui-kit/UserSurveyDialog/useUserSurveyDialog.js +1 -1
  28. package/mobile/dist/ui-kit/UserSurveyDialog/useUserSurveyDialog.js.map +1 -1
  29. package/mobile/lib/model/LinkProps.d.ts +0 -2
  30. package/mobile/lib/ui-kit/LinkButton/LinkButton.js +9 -9
  31. package/mobile/lib/ui-kit/LinkButton/LinkButton.js.map +1 -1
  32. package/mobile/lib/ui-kit/LinkButton/LinkButtonContent.d.ts +4 -0
  33. package/mobile/lib/ui-kit/UserSurveyDialog/useUserSurveyDialog.js +1 -1
  34. package/mobile/lib/ui-kit/UserSurveyDialog/useUserSurveyDialog.js.map +1 -1
  35. package/mobile/src/model/LinkProps.ts +0 -2
  36. package/mobile/src/ui-kit/LinkButton/LinkButton.tsx +11 -10
  37. package/mobile/src/ui-kit/LinkButton/LinkButtonContent.ts +4 -0
  38. package/mobile/src/ui-kit/UserSurveyDialog/useUserSurveyDialog.ts +1 -1
  39. package/package.json +1 -1
  40. package/src/components/ButtonsBlock/ButtonsBlock.fixture.tsx +2 -1
  41. package/src/model/LinkProps.ts +0 -2
  42. package/src/ui-kit/LinkButton/LinkButton.tsx +11 -10
  43. package/src/ui-kit/LinkButton/LinkButtonContent.ts +4 -0
  44. package/src/ui-kit/UserSurveyDialog/useUserSurveyDialog.ts +1 -1
@@ -706,15 +706,15 @@
706
706
  }, [method, href]);
707
707
 
708
708
  /** @deprecated */
709
- const LinkButton = JSX(({ disabled, children, method = 'LINK', href, id, additionalHrefs, ...rest }) => {
709
+ const LinkButton = JSX(({ disabled, children, method = 'LINK', href, id, additionalHref, chance, ...rest }) => {
710
710
  const [currentLink, setCurrentLink] = useState();
711
711
  const handleFormSubmit = useFormSubmit({ method, href });
712
712
  const linksStore = useLocalStore();
713
713
  useEffect(() => {
714
- additionalHrefs && saveLinksToStore({ linksStore, href, id, additionalHrefs });
714
+ additionalHref && saveLinksToStore({ linksStore, href, id, additionalHref, chance });
715
715
  const adjustedHref = (linksStore.links || []).find((store) => store.id === id)?.lastLink;
716
716
  setCurrentLink(adjustedHref ?? href);
717
- }, [additionalHrefs, href]);
717
+ }, [additionalHref, href]);
718
718
  const link = useLink();
719
719
  const adjustedProps = link({ onClick: handleFormSubmit, href: currentLink, ...rest });
720
720
  const buttonInner = children ?? jsx(ButtonInner, { ...adjustedProps });
@@ -722,22 +722,22 @@
722
722
  });
723
723
  const RegularButton = JSX(({ className = '', href, rel, target, ariaLabel, version, rounded, onClick, type, data, children, text, }) => (jsx("a", { className: getRegularButtonClasses({ className, version, rounded }), href: href, rel: rel, target: target, "aria-label": ariaLabel || `Ссылка на ${text}`, role: href ? 'link' : 'button', onClick: onClick, type: type, ...getAspectsAttributes(data), children: children })));
724
724
  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 })));
725
- const getRandomHref = (href = '', additionalHrefs = []) => {
726
- const hrefs = [href, ...additionalHrefs];
727
- return hrefs[Math.floor(Math.random() * hrefs.length)];
725
+ const getRandomHref = (href = '', additionalHref = '', chance = 50) => {
726
+ const randomNumber = Math.random() * 100;
727
+ return randomNumber < chance ? additionalHref : href;
728
728
  };
729
729
  // Отсчитываем 7 длей с текущей даты
730
730
  const getTimeAfter7days = () => Date.now() + 7 * 24 * 60 * 60 * 1000;
731
731
  // Сохраняем или заменяем рандомную ссылку в localStorage
732
- const saveLinksToStore = ({ linksStore, id, href, additionalHrefs }) => {
732
+ const saveLinksToStore = ({ linksStore, id, href, additionalHref, chance }) => {
733
733
  const buttonLinkStore = (linksStore.links || []).find((store) => store.id === id);
734
734
  // Если хранилища вообще нет
735
735
  if (!linksStore.links) {
736
736
  linksStore.links = [];
737
737
  }
738
- if ((!buttonLinkStore || buttonLinkStore.nextDueAt <= Date.now()) && additionalHrefs) {
738
+ if ((!buttonLinkStore || buttonLinkStore.nextDueAt <= Date.now()) && additionalHref) {
739
739
  // Получаем рандомную ссылку
740
- const randomHref = getRandomHref(href, additionalHrefs);
740
+ const randomHref = getRandomHref(href, additionalHref, chance);
741
741
  // При наличии ссылки для этой кнопки в хранилище удаляем этот элемент из массива ссылок
742
742
  const updatedLinks = linksStore.links?.filter((item) => item.id !== id);
743
743
  // Добавляем новый элемент
@@ -2041,7 +2041,7 @@
2041
2041
  ? Date.now() - Number.parseInt(sessionStore.surveyTimerStart)
2042
2042
  : 0;
2043
2043
  const isShowSurvey = !isSurveySkipped &&
2044
- !isOtherLanguagePortal &&
2044
+ !isOtherLanguagePortal() &&
2045
2045
  (!userSurveyStore.userSurvey || userSurveyStore.userSurvey?.nextDueAt <= Date.now());
2046
2046
  const handleSkipSurvey = useCallback(() => {
2047
2047
  sessionStore.isSurveySkipped = true;
@@ -14818,7 +14818,7 @@
14818
14818
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
14819
14819
  });
14820
14820
 
14821
- const packageVersion = "0.14.1056";
14821
+ const packageVersion = "0.14.1057";
14822
14822
 
14823
14823
  exports.Blocks = Blocks;
14824
14824
  exports.ContentPage = ContentPage;