@redneckz/wildless-cms-uni-blocks 0.14.1057 → 0.14.1059
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.
- package/bin/migration-scripts/0.14.1058.js +21 -0
- package/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +12 -12
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/model/LinkProps.d.ts +0 -2
- package/bundle/ui-kit/LinkButton/LinkButtonContent.d.ts +4 -0
- package/dist/model/LinkProps.d.ts +0 -2
- package/dist/ui-kit/LinkButton/LinkButton.js +9 -9
- package/dist/ui-kit/LinkButton/LinkButton.js.map +1 -1
- package/dist/ui-kit/LinkButton/LinkButtonContent.d.ts +4 -0
- package/dist/ui-kit/UserSurveyDialog/useUserSurveyDialog.js +2 -2
- package/dist/ui-kit/UserSurveyDialog/useUserSurveyDialog.js.map +1 -1
- package/lib/model/LinkProps.d.ts +0 -2
- package/lib/ui-kit/LinkButton/LinkButton.js +9 -9
- package/lib/ui-kit/LinkButton/LinkButton.js.map +1 -1
- package/lib/ui-kit/LinkButton/LinkButtonContent.d.ts +4 -0
- package/lib/ui-kit/UserSurveyDialog/useUserSurveyDialog.js +2 -2
- package/lib/ui-kit/UserSurveyDialog/useUserSurveyDialog.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +12 -12
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/model/LinkProps.d.ts +0 -2
- package/mobile/bundle/ui-kit/LinkButton/LinkButtonContent.d.ts +4 -0
- package/mobile/dist/model/LinkProps.d.ts +0 -2
- package/mobile/dist/ui-kit/LinkButton/LinkButton.js +9 -9
- package/mobile/dist/ui-kit/LinkButton/LinkButton.js.map +1 -1
- package/mobile/dist/ui-kit/LinkButton/LinkButtonContent.d.ts +4 -0
- package/mobile/dist/ui-kit/UserSurveyDialog/useUserSurveyDialog.js +2 -2
- package/mobile/dist/ui-kit/UserSurveyDialog/useUserSurveyDialog.js.map +1 -1
- package/mobile/lib/model/LinkProps.d.ts +0 -2
- package/mobile/lib/ui-kit/LinkButton/LinkButton.js +9 -9
- package/mobile/lib/ui-kit/LinkButton/LinkButton.js.map +1 -1
- package/mobile/lib/ui-kit/LinkButton/LinkButtonContent.d.ts +4 -0
- package/mobile/lib/ui-kit/UserSurveyDialog/useUserSurveyDialog.js +2 -2
- package/mobile/lib/ui-kit/UserSurveyDialog/useUserSurveyDialog.js.map +1 -1
- package/mobile/src/model/LinkProps.ts +0 -2
- package/mobile/src/ui-kit/LinkButton/LinkButton.tsx +11 -10
- package/mobile/src/ui-kit/LinkButton/LinkButtonContent.ts +4 -0
- package/mobile/src/ui-kit/UserSurveyDialog/useUserSurveyDialog.ts +2 -2
- package/package.json +1 -1
- package/src/components/ButtonsBlock/ButtonsBlock.fixture.tsx +2 -1
- package/src/model/LinkProps.ts +0 -2
- package/src/ui-kit/LinkButton/LinkButton.tsx +11 -10
- package/src/ui-kit/LinkButton/LinkButtonContent.ts +4 -0
- package/src/ui-kit/UserSurveyDialog/useUserSurveyDialog.ts +2 -2
package/bundle/bundle.umd.js
CHANGED
|
@@ -706,15 +706,15 @@
|
|
|
706
706
|
}, [method, href]);
|
|
707
707
|
|
|
708
708
|
/** @deprecated */
|
|
709
|
-
const LinkButton = JSX(({ disabled, children, method = 'LINK', href, id,
|
|
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
|
-
|
|
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
|
-
}, [
|
|
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 = '',
|
|
726
|
-
const
|
|
727
|
-
return
|
|
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,
|
|
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()) &&
|
|
738
|
+
if ((!buttonLinkStore || buttonLinkStore.nextDueAt <= Date.now()) && additionalHref) {
|
|
739
739
|
// Получаем рандомную ссылку
|
|
740
|
-
const randomHref = getRandomHref(href,
|
|
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;
|
|
@@ -2082,7 +2082,7 @@
|
|
|
2082
2082
|
};
|
|
2083
2083
|
const isOtherLanguagePortal = () => {
|
|
2084
2084
|
const regexp = new RegExp('^/(cn|en)($|/.*)');
|
|
2085
|
-
return regexp.test(globalThis
|
|
2085
|
+
return regexp.test(globalThis?.location?.pathname);
|
|
2086
2086
|
};
|
|
2087
2087
|
|
|
2088
2088
|
const SERVICE_TYPES = [{ key: 'ULTRASERVICE', text: 'Ультра' }];
|
|
@@ -14818,7 +14818,7 @@
|
|
|
14818
14818
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
14819
14819
|
});
|
|
14820
14820
|
|
|
14821
|
-
const packageVersion = "0.14.
|
|
14821
|
+
const packageVersion = "0.14.1058";
|
|
14822
14822
|
|
|
14823
14823
|
exports.Blocks = Blocks;
|
|
14824
14824
|
exports.ContentPage = ContentPage;
|