@gravity-ui/page-constructor 4.51.2-alpha.0 → 4.53.0
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/README.md +3 -5
- package/build/cjs/blocks/Banner/schema.d.ts +264 -0
- package/build/cjs/blocks/ExtendedFeatures/ExtendedFeatures.js +2 -2
- package/build/cjs/blocks/FilterBlock/FilterBlock.js +2 -2
- package/build/cjs/blocks/FilterBlock/i18n/index.d.ts +2 -1
- package/build/cjs/blocks/FilterBlock/i18n/index.js +3 -4
- package/build/cjs/blocks/Map/schema.d.ts +88 -0
- package/build/cjs/blocks/Media/schema.d.ts +176 -0
- package/build/cjs/blocks/Security/i18n/index.d.ts +2 -1
- package/build/cjs/blocks/Security/i18n/index.js +3 -4
- package/build/cjs/blocks/Share/Share.js +4 -4
- package/build/cjs/blocks/Share/i18n/index.d.ts +2 -1
- package/build/cjs/blocks/Share/i18n/index.js +3 -4
- package/build/cjs/blocks/Slider/Arrow/Arrow.js +2 -2
- package/build/cjs/blocks/Slider/i18n/index.d.ts +2 -1
- package/build/cjs/blocks/Slider/i18n/index.js +3 -4
- package/build/cjs/components/Button/Button.js +7 -4
- package/build/cjs/components/Button/i18n/index.d.ts +2 -1
- package/build/cjs/components/Button/i18n/index.js +3 -4
- package/build/cjs/components/CardBase/CardBase.d.ts +3 -1
- package/build/cjs/components/CardBase/CardBase.js +4 -1
- package/build/cjs/components/Control/Control.js +2 -2
- package/build/cjs/components/Control/i18n/index.d.ts +2 -1
- package/build/cjs/components/Control/i18n/index.js +3 -4
- package/build/cjs/components/FullscreenImage/FullscreenImage.js +3 -3
- package/build/cjs/components/FullscreenImage/i18n/index.d.ts +2 -1
- package/build/cjs/components/FullscreenImage/i18n/index.js +3 -4
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +6 -3
- package/build/cjs/components/Link/Link.js +4 -1
- package/build/cjs/components/Map/GoogleMap.js +2 -2
- package/build/cjs/components/Map/YMap/YandexMap.js +2 -2
- package/build/cjs/components/Map/YMap/i18n/index.d.ts +2 -1
- package/build/cjs/components/Map/YMap/i18n/index.js +3 -4
- package/build/cjs/components/Media/DataLens/DataLens.js +2 -2
- package/build/cjs/components/Media/DataLens/i18n/index.d.ts +2 -1
- package/build/cjs/components/Media/DataLens/i18n/index.js +3 -4
- package/build/cjs/components/Media/Iframe/Iframe.js +2 -2
- package/build/cjs/components/Media/Iframe/i18n/index.d.ts +2 -1
- package/build/cjs/components/Media/Iframe/i18n/index.js +3 -4
- package/build/cjs/components/Media/Media.js +3 -1
- package/build/cjs/components/Media/Video/Video.js +3 -2
- package/build/cjs/components/OverflowScroller/OverflowScroller.js +2 -2
- package/build/cjs/components/OverflowScroller/i18n/index.d.ts +2 -1
- package/build/cjs/components/OverflowScroller/i18n/index.js +3 -4
- package/build/cjs/components/ReactPlayer/CustomBarControls.js +3 -3
- package/build/cjs/components/ReactPlayer/ReactPlayer.js +38 -6
- package/build/cjs/components/ReactPlayer/i18n/index.d.ts +2 -1
- package/build/cjs/components/ReactPlayer/i18n/index.js +3 -4
- package/build/cjs/components/ReactPlayer/utils/youtube.d.ts +2 -0
- package/build/cjs/components/ReactPlayer/utils/youtube.js +7 -0
- package/build/cjs/components/UnpublishedLabel/UnpublishedLabel.js +2 -2
- package/build/cjs/components/UnpublishedLabel/i18n/index.d.ts +2 -1
- package/build/cjs/components/UnpublishedLabel/i18n/index.js +3 -4
- package/build/cjs/components/VideoBlock/VideoBlock.js +2 -2
- package/build/cjs/components/VideoBlock/i18n/index.d.ts +2 -1
- package/build/cjs/components/VideoBlock/i18n/index.js +3 -4
- package/build/cjs/components/YandexForm/YandexForm.js +13 -2
- package/build/cjs/constructor-items.d.ts +1 -0
- package/build/cjs/constructor-items.js +1 -0
- package/build/cjs/containers/Loadable/Loadable.js +2 -2
- package/build/cjs/containers/Loadable/i18n/index.d.ts +2 -1
- package/build/cjs/containers/Loadable/i18n/index.js +3 -4
- package/build/cjs/containers/PageConstructor/Provider.d.ts +2 -0
- package/build/cjs/containers/PageConstructor/Provider.js +3 -1
- package/build/cjs/context/localeContext/localeContext.d.ts +2 -2
- package/build/cjs/context/localeContext/localeContext.js +2 -2
- package/build/cjs/context/metrikaContext/index.d.ts +1 -0
- package/build/cjs/context/metrikaContext/index.js +4 -0
- package/build/cjs/context/metrikaContext/metrikaContext.d.ts +13 -0
- package/build/cjs/context/metrikaContext/metrikaContext.js +6 -0
- package/build/cjs/editor/components/ControlPanel/ControlPanel.js +3 -3
- package/build/cjs/editor/components/ControlPanel/i18n/en.json +1 -2
- package/build/cjs/editor/components/ControlPanel/i18n/index.d.ts +2 -1
- package/build/cjs/editor/components/ControlPanel/i18n/index.js +3 -4
- package/build/cjs/editor/components/ControlPanel/i18n/ru.json +1 -2
- package/build/cjs/editor/components/ErrorBoundary/ErrorBoundary.js +3 -3
- package/build/cjs/editor/components/ErrorBoundary/i18n/index.d.ts +2 -1
- package/build/cjs/editor/components/ErrorBoundary/i18n/index.js +3 -4
- package/build/cjs/editor/components/NotFoundBlock/NotFoundBlock.js +2 -2
- package/build/cjs/editor/components/NotFoundBlock/i18n/index.d.ts +2 -1
- package/build/cjs/editor/components/NotFoundBlock/i18n/index.js +3 -4
- package/build/cjs/hooks/useAnalytics.d.ts +2 -2
- package/build/cjs/hooks/useMetrika.d.ts +13 -1
- package/build/cjs/hooks/useMetrika.js +41 -0
- package/build/cjs/i18n.d.ts +2 -0
- package/build/cjs/i18n.js +12 -0
- package/build/cjs/models/common.d.ts +53 -2
- package/build/cjs/models/common.js +25 -1
- package/build/cjs/models/constructor-items/common.d.ts +29 -2
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +20 -4
- package/build/cjs/models/constructor-items/sub-blocks.js +7 -1
- package/build/cjs/models/guards.d.ts +2 -0
- package/build/cjs/models/guards.js +5 -1
- package/build/cjs/schema/constants.d.ts +252 -0
- package/build/cjs/schema/constants.js +2 -1
- package/build/cjs/schema/validators/common.d.ts +188 -0
- package/build/cjs/schema/validators/common.js +31 -0
- package/build/cjs/schema/validators/index.d.ts +2 -0
- package/build/cjs/schema/validators/index.js +2 -0
- package/build/cjs/schema/validators/pixel.d.ts +57 -0
- package/build/cjs/schema/validators/pixel.js +63 -0
- package/build/cjs/schema/validators/sub-blocks.d.ts +1 -0
- package/build/cjs/schema/validators/sub-blocks.js +1 -0
- package/build/cjs/sub-blocks/BasicCard/BasicCard.js +2 -2
- package/build/cjs/sub-blocks/HubspotForm/index.js +6 -1
- package/build/cjs/sub-blocks/ImageCard/ImageCard.css +59 -0
- package/build/cjs/sub-blocks/ImageCard/ImageCard.d.ts +3 -0
- package/build/cjs/sub-blocks/ImageCard/ImageCard.js +21 -0
- package/build/cjs/sub-blocks/ImageCard/schema.d.ts +78 -0
- package/build/cjs/sub-blocks/ImageCard/schema.js +24 -0
- package/build/cjs/sub-blocks/LayoutItem/utils.d.ts +15 -1
- package/build/cjs/sub-blocks/PriceCard/schema.d.ts +88 -0
- package/build/cjs/sub-blocks/index.d.ts +1 -0
- package/build/cjs/sub-blocks/index.js +3 -1
- package/build/cjs/text-transform/common.d.ts +4 -4
- package/build/cjs/text-transform/transformers.d.ts +2 -2
- package/build/cjs/text-transform/utils.d.ts +6 -6
- package/build/cjs/text-transform/utils.js +5 -5
- package/build/cjs/utils/configure.d.ts +12 -0
- package/build/cjs/utils/configure.js +26 -0
- package/build/cjs/utils/index.d.ts +1 -0
- package/build/cjs/utils/index.js +4 -1
- package/build/cjs/utils/registerKeyset.d.ts +5 -0
- package/build/cjs/utils/registerKeyset.js +9 -0
- package/build/esm/blocks/Banner/schema.d.ts +264 -0
- package/build/esm/blocks/ExtendedFeatures/ExtendedFeatures.js +2 -2
- package/build/esm/blocks/FilterBlock/FilterBlock.js +1 -1
- package/build/esm/blocks/FilterBlock/i18n/index.d.ts +2 -1
- package/build/esm/blocks/FilterBlock/i18n/index.js +3 -3
- package/build/esm/blocks/Map/schema.d.ts +88 -0
- package/build/esm/blocks/Media/schema.d.ts +176 -0
- package/build/esm/blocks/Security/i18n/index.d.ts +2 -1
- package/build/esm/blocks/Security/i18n/index.js +3 -3
- package/build/esm/blocks/Share/Share.js +1 -1
- package/build/esm/blocks/Share/i18n/index.d.ts +2 -1
- package/build/esm/blocks/Share/i18n/index.js +3 -3
- package/build/esm/blocks/Slider/Arrow/Arrow.js +1 -1
- package/build/esm/blocks/Slider/i18n/index.d.ts +2 -1
- package/build/esm/blocks/Slider/i18n/index.js +3 -3
- package/build/esm/components/Button/Button.js +6 -3
- package/build/esm/components/Button/i18n/index.d.ts +2 -1
- package/build/esm/components/Button/i18n/index.js +3 -3
- package/build/esm/components/CardBase/CardBase.d.ts +3 -1
- package/build/esm/components/CardBase/CardBase.js +4 -1
- package/build/esm/components/Control/Control.js +1 -1
- package/build/esm/components/Control/i18n/index.d.ts +2 -1
- package/build/esm/components/Control/i18n/index.js +3 -3
- package/build/esm/components/FullscreenImage/FullscreenImage.js +1 -1
- package/build/esm/components/FullscreenImage/i18n/index.d.ts +2 -1
- package/build/esm/components/FullscreenImage/i18n/index.js +3 -3
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +6 -3
- package/build/esm/components/Link/Link.js +4 -1
- package/build/esm/components/Map/GoogleMap.js +1 -1
- package/build/esm/components/Map/YMap/YandexMap.js +1 -1
- package/build/esm/components/Map/YMap/i18n/index.d.ts +2 -1
- package/build/esm/components/Map/YMap/i18n/index.js +3 -3
- package/build/esm/components/Media/DataLens/DataLens.js +1 -1
- package/build/esm/components/Media/DataLens/i18n/index.d.ts +2 -1
- package/build/esm/components/Media/DataLens/i18n/index.js +3 -3
- package/build/esm/components/Media/Iframe/Iframe.js +1 -1
- package/build/esm/components/Media/Iframe/i18n/index.d.ts +2 -1
- package/build/esm/components/Media/Iframe/i18n/index.js +3 -3
- package/build/esm/components/Media/Media.js +3 -1
- package/build/esm/components/Media/Video/Video.js +3 -2
- package/build/esm/components/OverflowScroller/OverflowScroller.js +1 -1
- package/build/esm/components/OverflowScroller/i18n/index.d.ts +2 -1
- package/build/esm/components/OverflowScroller/i18n/index.js +3 -3
- package/build/esm/components/ReactPlayer/CustomBarControls.js +1 -1
- package/build/esm/components/ReactPlayer/ReactPlayer.js +37 -5
- package/build/esm/components/ReactPlayer/i18n/index.d.ts +2 -1
- package/build/esm/components/ReactPlayer/i18n/index.js +3 -3
- package/build/esm/components/ReactPlayer/utils/youtube.d.ts +2 -0
- package/build/esm/components/ReactPlayer/utils/youtube.js +3 -0
- package/build/esm/components/UnpublishedLabel/UnpublishedLabel.js +1 -1
- package/build/esm/components/UnpublishedLabel/i18n/index.d.ts +2 -1
- package/build/esm/components/UnpublishedLabel/i18n/index.js +3 -3
- package/build/esm/components/VideoBlock/VideoBlock.js +1 -1
- package/build/esm/components/VideoBlock/i18n/index.d.ts +2 -1
- package/build/esm/components/VideoBlock/i18n/index.js +3 -3
- package/build/esm/components/YandexForm/YandexForm.js +13 -2
- package/build/esm/constructor-items.d.ts +1 -0
- package/build/esm/constructor-items.js +2 -1
- package/build/esm/containers/Loadable/Loadable.js +1 -1
- package/build/esm/containers/Loadable/i18n/index.d.ts +2 -1
- package/build/esm/containers/Loadable/i18n/index.js +3 -3
- package/build/esm/containers/PageConstructor/Provider.d.ts +2 -0
- package/build/esm/containers/PageConstructor/Provider.js +3 -1
- package/build/esm/context/localeContext/localeContext.d.ts +2 -2
- package/build/esm/context/localeContext/localeContext.js +1 -1
- package/build/esm/context/metrikaContext/index.d.ts +1 -0
- package/build/esm/context/metrikaContext/index.js +1 -0
- package/build/esm/context/metrikaContext/metrikaContext.d.ts +13 -0
- package/build/esm/context/metrikaContext/metrikaContext.js +2 -0
- package/build/esm/editor/components/ControlPanel/ControlPanel.js +2 -2
- package/build/esm/editor/components/ControlPanel/i18n/en.json +1 -2
- package/build/esm/editor/components/ControlPanel/i18n/index.d.ts +2 -1
- package/build/esm/editor/components/ControlPanel/i18n/index.js +3 -3
- package/build/esm/editor/components/ControlPanel/i18n/ru.json +1 -2
- package/build/esm/editor/components/ErrorBoundary/ErrorBoundary.js +1 -1
- package/build/esm/editor/components/ErrorBoundary/i18n/index.d.ts +2 -1
- package/build/esm/editor/components/ErrorBoundary/i18n/index.js +3 -3
- package/build/esm/editor/components/NotFoundBlock/NotFoundBlock.js +1 -1
- package/build/esm/editor/components/NotFoundBlock/i18n/index.d.ts +2 -1
- package/build/esm/editor/components/NotFoundBlock/i18n/index.js +3 -3
- package/build/esm/hooks/useAnalytics.d.ts +2 -2
- package/build/esm/hooks/useMetrika.d.ts +13 -1
- package/build/esm/hooks/useMetrika.js +38 -1
- package/build/esm/i18n.d.ts +2 -0
- package/build/esm/i18n.js +9 -0
- package/build/esm/models/common.d.ts +53 -2
- package/build/esm/models/common.js +24 -0
- package/build/esm/models/constructor-items/common.d.ts +29 -2
- package/build/esm/models/constructor-items/sub-blocks.d.ts +20 -4
- package/build/esm/models/constructor-items/sub-blocks.js +6 -0
- package/build/esm/models/guards.d.ts +2 -0
- package/build/esm/models/guards.js +3 -0
- package/build/esm/schema/constants.d.ts +252 -0
- package/build/esm/schema/constants.js +3 -2
- package/build/esm/schema/validators/common.d.ts +188 -0
- package/build/esm/schema/validators/common.js +31 -0
- package/build/esm/schema/validators/index.d.ts +2 -0
- package/build/esm/schema/validators/index.js +2 -0
- package/build/esm/schema/validators/pixel.d.ts +57 -0
- package/build/esm/schema/validators/pixel.js +60 -0
- package/build/esm/schema/validators/sub-blocks.d.ts +1 -0
- package/build/esm/schema/validators/sub-blocks.js +1 -0
- package/build/esm/sub-blocks/BasicCard/BasicCard.js +2 -2
- package/build/esm/sub-blocks/HubspotForm/index.js +6 -1
- package/build/esm/sub-blocks/ImageCard/ImageCard.css +59 -0
- package/build/esm/sub-blocks/ImageCard/ImageCard.d.ts +4 -0
- package/build/esm/sub-blocks/ImageCard/ImageCard.js +19 -0
- package/build/esm/sub-blocks/ImageCard/schema.d.ts +78 -0
- package/build/esm/sub-blocks/ImageCard/schema.js +20 -0
- package/build/esm/sub-blocks/LayoutItem/utils.d.ts +15 -1
- package/build/esm/sub-blocks/PriceCard/schema.d.ts +88 -0
- package/build/esm/sub-blocks/index.d.ts +1 -0
- package/build/esm/sub-blocks/index.js +1 -0
- package/build/esm/text-transform/common.d.ts +4 -4
- package/build/esm/text-transform/transformers.d.ts +2 -2
- package/build/esm/text-transform/utils.d.ts +6 -6
- package/build/esm/text-transform/utils.js +1 -1
- package/build/esm/utils/configure.d.ts +12 -0
- package/build/esm/utils/configure.js +20 -0
- package/build/esm/utils/index.d.ts +1 -0
- package/build/esm/utils/index.js +1 -0
- package/build/esm/utils/registerKeyset.d.ts +5 -0
- package/build/esm/utils/registerKeyset.js +5 -0
- package/package.json +2 -1
- package/server/models/common.d.ts +53 -2
- package/server/models/common.js +25 -1
- package/server/models/constructor-items/common.d.ts +29 -2
- package/server/models/constructor-items/sub-blocks.d.ts +20 -4
- package/server/models/constructor-items/sub-blocks.js +7 -1
- package/server/models/guards.d.ts +2 -0
- package/server/models/guards.js +5 -1
- package/server/text-transform/common.d.ts +4 -4
- package/server/text-transform/transformers.d.ts +2 -2
- package/server/text-transform/utils.d.ts +6 -6
- package/server/text-transform/utils.js +5 -5
- package/server/utils/configure.d.ts +12 -0
- package/server/utils/configure.js +26 -0
- package/server/utils/index.d.ts +1 -0
- package/server/utils/index.js +4 -1
- package/widget/index.js +1 -1
|
@@ -6,6 +6,7 @@ const react_1 = tslib_1.__importStar(require("react"));
|
|
|
6
6
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
7
7
|
const debounce_1 = tslib_1.__importDefault(require("lodash/debounce"));
|
|
8
8
|
const react_player_1 = tslib_1.__importDefault(require("react-player"));
|
|
9
|
+
const metrikaContext_1 = require("../../context/metrikaContext");
|
|
9
10
|
const mobileContext_1 = require("../../context/mobileContext");
|
|
10
11
|
const videoContext_1 = require("../../context/videoContext");
|
|
11
12
|
const hooks_1 = require("../../hooks");
|
|
@@ -13,14 +14,16 @@ const icons_1 = require("../../icons");
|
|
|
13
14
|
const models_1 = require("../../models");
|
|
14
15
|
const utils_1 = require("../../utils");
|
|
15
16
|
const CustomBarControls_1 = tslib_1.__importDefault(require("./CustomBarControls"));
|
|
16
|
-
const i18n_1 = require("./i18n");
|
|
17
|
+
const i18n_1 = tslib_1.__importDefault(require("./i18n"));
|
|
17
18
|
const utils_2 = require("./utils");
|
|
19
|
+
const youtube_1 = require("./utils/youtube");
|
|
18
20
|
const b = (0, utils_1.block)('ReactPlayer');
|
|
19
21
|
const FPS = 60;
|
|
20
22
|
// eslint-disable-next-line react/display-name
|
|
21
23
|
exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
22
24
|
const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
|
|
23
|
-
const {
|
|
25
|
+
const { metrika } = (0, react_1.useContext)(metrikaContext_1.MetrikaContext);
|
|
26
|
+
const { src, previewImgUrl, loop = false, controls = models_1.MediaVideoControlsType.Default, customControlsOptions = {}, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika, analyticsEvents, height, ariaLabel, ratio, } = props;
|
|
24
27
|
const { type = models_1.PlayButtonType.Default, theme = models_1.PlayButtonThemes.Blue, text, className: buttonClassName, } = playButton || {};
|
|
25
28
|
const { type: customControlsType = models_1.CustomControlsType.WithMuteButton, muteButtonShown, positioning = models_1.CustomControlsButtonPositioning.Center, } = customControlsOptions;
|
|
26
29
|
const autoPlay = Boolean(!isMobile && !previewImgUrl && props.autoplay);
|
|
@@ -50,8 +53,15 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
50
53
|
if (!playerRef) {
|
|
51
54
|
return;
|
|
52
55
|
}
|
|
56
|
+
let play, pause, addEventListener;
|
|
53
57
|
const videoInstance = playerRef.getInternalPlayer();
|
|
54
|
-
|
|
58
|
+
if ((0, youtube_1.isYoutubePlayerInstance)(videoInstance)) {
|
|
59
|
+
({ pauseVideo: pause, playVideo: play, addEventListener } = videoInstance);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
// it is assumed that `videoInstance` is HTMLVideoElement by default
|
|
63
|
+
({ play, pause, addEventListener } = videoInstance);
|
|
64
|
+
}
|
|
55
65
|
// eslint-disable-next-line consistent-return
|
|
56
66
|
return {
|
|
57
67
|
play: play.bind(videoInstance),
|
|
@@ -117,7 +127,7 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
117
127
|
playButtonContent = react_1.default.createElement(uikit_1.Icon, { className: b('icon'), data: icons_1.PlayVideo, size: 24 });
|
|
118
128
|
break;
|
|
119
129
|
}
|
|
120
|
-
return (react_1.default.createElement("button", { className: b('button', { theme, text: Boolean(text) }, buttonClassName), "aria-label": (0, i18n_1.
|
|
130
|
+
return (react_1.default.createElement("button", { className: b('button', { theme, text: Boolean(text) }, buttonClassName), "aria-label": (0, i18n_1.default)('play') }, playButtonContent));
|
|
121
131
|
}, [type, theme, text, buttonClassName]);
|
|
122
132
|
const changeMute = (0, react_1.useCallback)((isMuted) => {
|
|
123
133
|
if (isMuted &&
|
|
@@ -126,6 +136,13 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
126
136
|
playerRef.seekTo(0);
|
|
127
137
|
setPlayedPercent(0);
|
|
128
138
|
}
|
|
139
|
+
if (metrika && videoMetrika) {
|
|
140
|
+
const { play, stop, counterName } = videoMetrika;
|
|
141
|
+
const goal = isMuted ? play : stop;
|
|
142
|
+
if (goal) {
|
|
143
|
+
metrika.reachGoals(goal, counterName);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
129
146
|
const events = isMuted ? playEvents : stopEvents;
|
|
130
147
|
handleAnalytics(events);
|
|
131
148
|
if (isMuted) {
|
|
@@ -133,12 +150,27 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
133
150
|
}
|
|
134
151
|
// In order to the progress bar to update (equals 0) before displaying
|
|
135
152
|
setTimeout(() => setMuted(!isMuted), 0);
|
|
136
|
-
}, [
|
|
153
|
+
}, [
|
|
154
|
+
playerRef,
|
|
155
|
+
customControlsType,
|
|
156
|
+
metrika,
|
|
157
|
+
videoMetrika,
|
|
158
|
+
playEvents,
|
|
159
|
+
stopEvents,
|
|
160
|
+
handleAnalytics,
|
|
161
|
+
setProps,
|
|
162
|
+
]);
|
|
137
163
|
const handleClickPreview = (0, react_1.useCallback)(() => {
|
|
138
164
|
setIsPlaying(true);
|
|
139
165
|
onClickPreview === null || onClickPreview === void 0 ? void 0 : onClickPreview();
|
|
166
|
+
if (metrika && videoMetrika) {
|
|
167
|
+
const { play, counterName } = videoMetrika;
|
|
168
|
+
if (play) {
|
|
169
|
+
metrika.reachGoals(play, counterName);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
140
172
|
handleAnalytics(playEvents);
|
|
141
|
-
}, [onClickPreview, handleAnalytics, playEvents]);
|
|
173
|
+
}, [onClickPreview, metrika, videoMetrika, handleAnalytics, playEvents]);
|
|
142
174
|
const onPause = (0, react_1.useCallback)(() => {
|
|
143
175
|
// For support correct state for youtube
|
|
144
176
|
if (controls !== models_1.MediaVideoControlsType.Custom ||
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
|
|
2
|
+
export default _default;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.i18n = void 0;
|
|
4
3
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
6
|
-
const cn_1 = require("../../../utils/cn");
|
|
4
|
+
const registerKeyset_1 = require("../../../utils/registerKeyset");
|
|
7
5
|
const en_json_1 = tslib_1.__importDefault(require("./en.json"));
|
|
8
6
|
const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
|
|
9
|
-
|
|
7
|
+
const COMPONENT = 'ReactPlayer';
|
|
8
|
+
exports.default = (0, registerKeyset_1.registerKeyset)({ en: en_json_1.default, ru: ru_json_1.default }, COMPONENT);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isYoutubePlayerInstance = void 0;
|
|
4
|
+
const isYoutubePlayerInstance = (playerInstance) => {
|
|
5
|
+
return Boolean(playerInstance['pauseVideo'] && playerInstance['playVideo']);
|
|
6
|
+
};
|
|
7
|
+
exports.isYoutubePlayerInstance = isYoutubePlayerInstance;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
5
|
const utils_1 = require("../../utils");
|
|
6
|
-
const i18n_1 = require("./i18n");
|
|
6
|
+
const i18n_1 = tslib_1.__importDefault(require("./i18n"));
|
|
7
7
|
const b = (0, utils_1.block)('unpublished-label');
|
|
8
|
-
const UnpublishedLabel = ({ className, children, type = 'line', }) => (react_1.default.createElement("div", { className: b({ type }, className) }, children || (0, i18n_1.
|
|
8
|
+
const UnpublishedLabel = ({ className, children, type = 'line', }) => (react_1.default.createElement("div", { className: b({ type }, className) }, children || (0, i18n_1.default)('label_non_published')));
|
|
9
9
|
exports.default = UnpublishedLabel;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
|
|
2
|
+
export default _default;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.i18n = void 0;
|
|
4
3
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
6
|
-
const cn_1 = require("../../../utils/cn");
|
|
4
|
+
const registerKeyset_1 = require("../../../utils/registerKeyset");
|
|
7
5
|
const en_json_1 = tslib_1.__importDefault(require("./en.json"));
|
|
8
6
|
const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
|
|
9
|
-
|
|
7
|
+
const COMPONENT = 'UnpublishedLabel';
|
|
8
|
+
exports.default = (0, registerKeyset_1.registerKeyset)({ en: en_json_1.default, ru: ru_json_1.default }, COMPONENT);
|
|
@@ -11,7 +11,7 @@ const icons_1 = require("../../icons");
|
|
|
11
11
|
const common_1 = require("../../models/common");
|
|
12
12
|
const utils_1 = require("../../utils");
|
|
13
13
|
const Image_1 = tslib_1.__importDefault(require("../Image/Image"));
|
|
14
|
-
const i18n_1 = require("./i18n");
|
|
14
|
+
const i18n_1 = tslib_1.__importDefault(require("./i18n"));
|
|
15
15
|
const RECORD_URL = 'https://www.youtube.com/embed/';
|
|
16
16
|
const STREAM_URL = 'https://www.youtube.com/embed/live_stream?channel=';
|
|
17
17
|
const RECORD_RE = /[0-9A-Za-z_-]{11}/;
|
|
@@ -79,7 +79,7 @@ const VideoBlock = (props) => {
|
|
|
79
79
|
}
|
|
80
80
|
iframe.width = '100%';
|
|
81
81
|
iframe.height = '100%';
|
|
82
|
-
iframe.title = (0, i18n_1.
|
|
82
|
+
iframe.title = (0, i18n_1.default)('iframe-title');
|
|
83
83
|
iframe.frameBorder = '0';
|
|
84
84
|
iframe.setAttribute('allowfullscreen', 'true');
|
|
85
85
|
iframe.setAttribute('allow', 'autoplay');
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
|
|
2
|
+
export default _default;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.i18n = void 0;
|
|
4
3
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
6
|
-
const cn_1 = require("../../../utils/cn");
|
|
4
|
+
const registerKeyset_1 = require("../../../utils/registerKeyset");
|
|
7
5
|
const en_json_1 = tslib_1.__importDefault(require("./en.json"));
|
|
8
6
|
const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
|
|
9
|
-
|
|
7
|
+
const COMPONENT = 'VideoBlock';
|
|
8
|
+
exports.default = (0, registerKeyset_1.registerKeyset)({ en: en_json_1.default, ru: ru_json_1.default }, COMPONENT);
|
|
@@ -6,6 +6,7 @@ const react_1 = tslib_1.__importStar(require("react"));
|
|
|
6
6
|
const localeContext_1 = require("../../context/localeContext");
|
|
7
7
|
const mobileContext_1 = require("../../context/mobileContext");
|
|
8
8
|
const hooks_1 = require("../../hooks");
|
|
9
|
+
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
9
10
|
const common_1 = require("../../models/common");
|
|
10
11
|
const utils_1 = require("../../utils");
|
|
11
12
|
const constants_1 = require("../constants");
|
|
@@ -14,11 +15,12 @@ exports.YANDEX_FORM_SECTION = 'surveys';
|
|
|
14
15
|
const CONTAINER_ID = 'pc-yandex-form-container';
|
|
15
16
|
const b = (0, utils_1.block)('yandex-form');
|
|
16
17
|
const YandexForm = (props) => {
|
|
17
|
-
const { onLoad, id, params, className, theme, containerId = CONTAINER_ID, headerHeight = constants_1.HEADER_HEIGHT, onSubmit, analyticsEvents, customFormOrigin, customFormSection, } = props;
|
|
18
|
+
const { onLoad, id, params, className, theme, containerId = CONTAINER_ID, headerHeight = constants_1.HEADER_HEIGHT, onSubmit, metrikaGoals, pixelEvents, analyticsEvents, customFormOrigin, customFormSection, } = props;
|
|
18
19
|
const formContainerRef = (0, react_1.useRef)(null);
|
|
19
20
|
const iframeRef = (0, react_1.useRef)();
|
|
20
21
|
const yaFormOrigin = customFormOrigin || exports.YANDEX_FORM_ORIGIN;
|
|
21
22
|
const yaFormSection = customFormSection || exports.YANDEX_FORM_SECTION;
|
|
23
|
+
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
22
24
|
const handleAnalytics = (0, hooks_1.useAnalytics)(common_1.DefaultEventNames.YandexFormSubmit);
|
|
23
25
|
const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
|
|
24
26
|
const locale = (0, react_1.useContext)(localeContext_1.LocaleContext);
|
|
@@ -60,11 +62,20 @@ const YandexForm = (props) => {
|
|
|
60
62
|
const { top } = formContainerRef.current.getBoundingClientRect();
|
|
61
63
|
window.scrollBy(0, top - headerHeight);
|
|
62
64
|
}
|
|
65
|
+
handleMetrika({ metrikaGoals, pixelEvents });
|
|
63
66
|
handleAnalytics(analyticsEvents);
|
|
64
67
|
if (onSubmit) {
|
|
65
68
|
onSubmit();
|
|
66
69
|
}
|
|
67
|
-
}, [
|
|
70
|
+
}, [
|
|
71
|
+
handleMetrika,
|
|
72
|
+
metrikaGoals,
|
|
73
|
+
pixelEvents,
|
|
74
|
+
handleAnalytics,
|
|
75
|
+
analyticsEvents,
|
|
76
|
+
onSubmit,
|
|
77
|
+
headerHeight,
|
|
78
|
+
]);
|
|
68
79
|
const handleMessage = (0, react_1.useCallback)(({ origin, data }) => {
|
|
69
80
|
if (origin !== yaFormOrigin) {
|
|
70
81
|
return;
|
|
@@ -30,6 +30,7 @@ export declare const subBlockMap: {
|
|
|
30
30
|
content: (props: import("./sub-blocks/Content/Content").ContentProps) => JSX.Element;
|
|
31
31
|
quote: (props: import("./models").QuoteProps) => JSX.Element;
|
|
32
32
|
"price-card": (props: import("./models").PriceCardProps) => JSX.Element;
|
|
33
|
+
"image-card": (props: import("./models").ImageCardProps) => JSX.Element;
|
|
33
34
|
};
|
|
34
35
|
export declare const navItemMap: {
|
|
35
36
|
button: import("react").FC<Pick<import("./navigation/models").NavigationItemProps, "className"> & import("./models").ButtonProps>;
|
|
@@ -39,6 +39,7 @@ exports.subBlockMap = {
|
|
|
39
39
|
[models_1.SubBlockType.Content]: sub_blocks_1.Content,
|
|
40
40
|
[models_1.SubBlockType.Quote]: sub_blocks_1.Quote,
|
|
41
41
|
[models_1.SubBlockType.PriceCard]: sub_blocks_1.PriceCard,
|
|
42
|
+
[models_1.SubBlockType.ImageCard]: sub_blocks_1.ImageCard,
|
|
42
43
|
};
|
|
43
44
|
exports.navItemMap = {
|
|
44
45
|
[models_1.NavigationItemType.Button]: NavigationItem_1.NavigationButton,
|
|
@@ -5,7 +5,7 @@ const react_1 = tslib_1.__importStar(require("react"));
|
|
|
5
5
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
6
6
|
const ErrorWrapper_1 = tslib_1.__importDefault(require("../../components/ErrorWrapper/ErrorWrapper"));
|
|
7
7
|
const cn_1 = require("../../utils/cn");
|
|
8
|
-
const i18n_1 = require("./i18n");
|
|
8
|
+
const i18n_1 = tslib_1.__importDefault(require("./i18n"));
|
|
9
9
|
const b = (0, cn_1.block)('loadable-block');
|
|
10
10
|
const initData = {
|
|
11
11
|
loading: false,
|
|
@@ -39,7 +39,7 @@ const Loadable = (props) => {
|
|
|
39
39
|
return (react_1.default.createElement("div", { className: b('loader') },
|
|
40
40
|
react_1.default.createElement(uikit_1.Spin, { size: "xl" })));
|
|
41
41
|
}
|
|
42
|
-
return (react_1.default.createElement(ErrorWrapper_1.default, { isError: error, text: (0, i18n_1.
|
|
42
|
+
return (react_1.default.createElement(ErrorWrapper_1.default, { isError: error, text: (0, i18n_1.default)('loadable-load-error'), buttonText: (0, i18n_1.default)('loadable-try-again'), handler: onTryAgain },
|
|
43
43
|
react_1.default.createElement(Component, Object.assign({}, block), data &&
|
|
44
44
|
(Array.isArray(data) ? (data.map((componentData, index) => (react_1.default.createElement(ChildComponent, Object.assign({ key: componentData.id || index }, componentData))))) : (react_1.default.createElement(ChildComponent, Object.assign({}, data)))))));
|
|
45
45
|
};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
|
|
2
|
+
export default _default;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.i18n = void 0;
|
|
4
3
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
6
|
-
const cn_1 = require("../../../utils/cn");
|
|
4
|
+
const registerKeyset_1 = require("../../../utils/registerKeyset");
|
|
7
5
|
const en_json_1 = tslib_1.__importDefault(require("./en.json"));
|
|
8
6
|
const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
|
|
9
|
-
|
|
7
|
+
const COMPONENT = 'Loadable';
|
|
8
|
+
exports.default = (0, registerKeyset_1.registerKeyset)({ en: en_json_1.default, ru: ru_json_1.default }, COMPONENT);
|
|
@@ -3,6 +3,7 @@ import { ImageContextProps } from '../../context/imageContext';
|
|
|
3
3
|
import { LocaleContextProps } from '../../context/localeContext';
|
|
4
4
|
import { LocationContextProps } from '../../context/locationContext';
|
|
5
5
|
import { MapsContextType } from '../../context/mapsContext/mapsContext';
|
|
6
|
+
import { MetrikaContextProps } from '../../context/metrikaContext';
|
|
6
7
|
import { ProjectSettingsContextProps } from '../../context/projectSettingsContext';
|
|
7
8
|
import { SSRContextProps } from '../../context/ssrContext';
|
|
8
9
|
import { Theme, WithChildren } from '../../models';
|
|
@@ -10,6 +11,7 @@ export interface PageConstructorProviderProps {
|
|
|
10
11
|
isMobile?: boolean;
|
|
11
12
|
locale?: LocaleContextProps;
|
|
12
13
|
location?: LocationContextProps;
|
|
14
|
+
metrika?: MetrikaContextProps;
|
|
13
15
|
ssrConfig?: SSRContextProps;
|
|
14
16
|
theme?: Theme;
|
|
15
17
|
mapsContext?: MapsContextType;
|
|
@@ -9,12 +9,13 @@ const imageContext_1 = require("../../context/imageContext");
|
|
|
9
9
|
const localeContext_1 = require("../../context/localeContext");
|
|
10
10
|
const locationContext_1 = require("../../context/locationContext");
|
|
11
11
|
const mapsContext_1 = require("../../context/mapsContext/mapsContext");
|
|
12
|
+
const metrikaContext_1 = require("../../context/metrikaContext");
|
|
12
13
|
const mobileContext_1 = require("../../context/mobileContext");
|
|
13
14
|
const projectSettingsContext_1 = require("../../context/projectSettingsContext");
|
|
14
15
|
const ssrContext_1 = require("../../context/ssrContext");
|
|
15
16
|
const theme_1 = require("../../context/theme");
|
|
16
17
|
const PageConstructorProvider = (props) => {
|
|
17
|
-
const { isMobile, mapsContext = mapsContext_1.initialMapValue, locale = {}, location = {}, analytics = {}, ssrConfig = {}, projectSettings = {}, theme = constants_1.DEFAULT_THEME, children, image = {}, } = props;
|
|
18
|
+
const { isMobile, mapsContext = mapsContext_1.initialMapValue, locale = {}, location = {}, metrika = {}, analytics = {}, ssrConfig = {}, projectSettings = {}, theme = constants_1.DEFAULT_THEME, children, image = {}, } = props;
|
|
18
19
|
/* eslint-disable react/jsx-key */
|
|
19
20
|
const context = [
|
|
20
21
|
react_1.default.createElement(theme_1.ThemeContext.Provider, { value: { theme } }),
|
|
@@ -24,6 +25,7 @@ const PageConstructorProvider = (props) => {
|
|
|
24
25
|
react_1.default.createElement(locationContext_1.LocationContext.Provider, { value: location }),
|
|
25
26
|
react_1.default.createElement(mobileContext_1.MobileContext.Provider, { value: Boolean(isMobile) }),
|
|
26
27
|
react_1.default.createElement(mapsContext_1.MapsContext.Provider, { value: mapsContext }),
|
|
28
|
+
react_1.default.createElement(metrikaContext_1.MetrikaContext.Provider, { value: metrika }),
|
|
27
29
|
react_1.default.createElement(analyticsContext_1.AnalyticsContext.Provider, { value: analytics }),
|
|
28
30
|
react_1.default.createElement(ssrContext_1.SSRContext.Provider, { value: { isServer: ssrConfig === null || ssrConfig === void 0 ? void 0 : ssrConfig.isServer } }),
|
|
29
31
|
].reduceRight((prev, provider) => react_1.default.cloneElement(provider, {}, prev), children);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Lang } from '
|
|
2
|
+
import { Lang } from '../../utils/configure';
|
|
3
3
|
export type LocaleContextProps = {
|
|
4
|
-
lang?:
|
|
4
|
+
lang?: Lang;
|
|
5
5
|
tld?: string;
|
|
6
6
|
};
|
|
7
7
|
export declare const LocaleContext: React.Context<LocaleContextProps>;
|
|
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.LocaleContext = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
7
|
-
exports.LocaleContext = react_1.default.createContext({ lang:
|
|
6
|
+
const configure_1 = require("../../utils/configure");
|
|
7
|
+
exports.LocaleContext = react_1.default.createContext({ lang: configure_1.Lang.Ru, tld: '.ru' });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './metrikaContext';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Metrika, Pixel } from '../../models';
|
|
3
|
+
export interface MetrikaContextProps {
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Metrika will be deleted
|
|
6
|
+
*/
|
|
7
|
+
metrika?: Metrika;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Metrika will be deleted
|
|
10
|
+
*/
|
|
11
|
+
pixel?: Pixel;
|
|
12
|
+
}
|
|
13
|
+
export declare const MetrikaContext: React.Context<MetrikaContextProps>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MetrikaContext = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
exports.MetrikaContext = react_1.default.createContext({});
|
|
@@ -8,7 +8,7 @@ const models_1 = require("../../../models");
|
|
|
8
8
|
const utils_1 = require("../../../utils");
|
|
9
9
|
const Tablet_1 = require("../../icons/Tablet");
|
|
10
10
|
const types_1 = require("../../types");
|
|
11
|
-
const i18n_1 = require("./i18n");
|
|
11
|
+
const i18n_1 = tslib_1.__importDefault(require("./i18n"));
|
|
12
12
|
const ICON_SIZE = 14;
|
|
13
13
|
const b = (0, utils_1.block)('control-panel');
|
|
14
14
|
const ControlPanelViewModeIcons = {
|
|
@@ -21,7 +21,7 @@ const ControlPanel = ({ viewMode = types_1.ViewModeItem.Edititng, onViewModeChan
|
|
|
21
21
|
return (react_1.default.createElement("div", { className: b(null, className) },
|
|
22
22
|
react_1.default.createElement("div", null),
|
|
23
23
|
react_1.default.createElement("div", { className: b('mode-switch') },
|
|
24
|
-
react_1.default.createElement("span", null, (0, i18n_1.
|
|
24
|
+
react_1.default.createElement("span", null, (0, i18n_1.default)('mode')),
|
|
25
25
|
react_1.default.createElement(uikit_1.RadioButton, { className: b('radio-button'), value: viewMode, onUpdate: (value) => onViewModeChange(value) }, Object.values(types_1.ViewModeItem).map((item) => {
|
|
26
26
|
const Icon = ControlPanelViewModeIcons[item];
|
|
27
27
|
return (react_1.default.createElement(uikit_1.RadioButton.Option, { key: item, value: item },
|
|
@@ -29,7 +29,7 @@ const ControlPanel = ({ viewMode = types_1.ViewModeItem.Edititng, onViewModeChan
|
|
|
29
29
|
react_1.default.createElement(Icon, { width: ICON_SIZE, height: ICON_SIZE }))));
|
|
30
30
|
}))),
|
|
31
31
|
react_1.default.createElement("div", { className: b('theme-switch') },
|
|
32
|
-
react_1.default.createElement("span", null, (0, i18n_1.
|
|
32
|
+
react_1.default.createElement("span", null, (0, i18n_1.default)('Theme')),
|
|
33
33
|
react_1.default.createElement(uikit_1.Select, { value: [theme], onUpdate: (value) => onThemeChange(value[0]) }, Object.values(models_1.Theme).map((item) => (react_1.default.createElement(uikit_1.Select.Option, { key: item, value: item }, models_1.themeNames[item])))))));
|
|
34
34
|
};
|
|
35
35
|
exports.default = ControlPanel;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
|
|
2
|
+
export default _default;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.i18n = void 0;
|
|
4
3
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
6
|
-
const cn_1 = require("../../../../utils/cn");
|
|
4
|
+
const registerKeyset_1 = require("../../../../utils/registerKeyset");
|
|
7
5
|
const en_json_1 = tslib_1.__importDefault(require("./en.json"));
|
|
8
6
|
const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
|
|
9
|
-
|
|
7
|
+
const COMPONENT = 'ControlPanel';
|
|
8
|
+
exports.default = (0, registerKeyset_1.registerKeyset)({ en: en_json_1.default, ru: ru_json_1.default }, COMPONENT);
|
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const utils_1 = require("../../../utils");
|
|
7
7
|
const utils_2 = require("../../utils");
|
|
8
|
-
const i18n_1 = require("./i18n");
|
|
8
|
+
const i18n_1 = tslib_1.__importDefault(require("./i18n"));
|
|
9
9
|
const b = (0, utils_1.block)('error-boundary');
|
|
10
10
|
class ErrorBoundary extends react_1.default.Component {
|
|
11
11
|
constructor() {
|
|
@@ -19,8 +19,8 @@ class ErrorBoundary extends react_1.default.Component {
|
|
|
19
19
|
const { type, index } = this.props;
|
|
20
20
|
const { error } = this.state;
|
|
21
21
|
const header = type
|
|
22
|
-
? (0, i18n_1.
|
|
23
|
-
: (0, i18n_1.
|
|
22
|
+
? (0, i18n_1.default)('error-block-header', { id: (0, utils_2.getBlockId)({ type, index }) })
|
|
23
|
+
: (0, i18n_1.default)('error-page-header');
|
|
24
24
|
if (this.state.error) {
|
|
25
25
|
return (react_1.default.createElement("div", { className: b() },
|
|
26
26
|
react_1.default.createElement("div", { className: b('container') },
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
|
|
2
|
+
export default _default;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.i18n = void 0;
|
|
4
3
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
6
|
-
const cn_1 = require("../../../../utils/cn");
|
|
4
|
+
const registerKeyset_1 = require("../../../../utils/registerKeyset");
|
|
7
5
|
const en_json_1 = tslib_1.__importDefault(require("./en.json"));
|
|
8
6
|
const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
|
|
9
|
-
|
|
7
|
+
const COMPONENT = 'ErrorBoundary';
|
|
8
|
+
exports.default = (0, registerKeyset_1.registerKeyset)({ en: en_json_1.default, ru: ru_json_1.default }, COMPONENT);
|
|
@@ -5,8 +5,8 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const components_1 = require("../../../components");
|
|
7
7
|
const utils_1 = require("../../../utils");
|
|
8
|
-
const i18n_1 = require("./i18n");
|
|
8
|
+
const i18n_1 = tslib_1.__importDefault(require("./i18n"));
|
|
9
9
|
const b = (0, utils_1.block)('not-found-block');
|
|
10
10
|
const NotFoundBlock = ({ type, children }) => children ? (react_1.default.createElement(react_1.Fragment, null, children)) : (react_1.default.createElement(components_1.BlockBase, null,
|
|
11
|
-
react_1.default.createElement("div", { className: b() }, (0, i18n_1.
|
|
11
|
+
react_1.default.createElement("div", { className: b() }, (0, i18n_1.default)('message', { type }))));
|
|
12
12
|
exports.NotFoundBlock = NotFoundBlock;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
|
|
2
|
+
export default _default;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.i18n = void 0;
|
|
4
3
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
6
|
-
const cn_1 = require("../../../../utils/cn");
|
|
4
|
+
const registerKeyset_1 = require("../../../../utils/registerKeyset");
|
|
7
5
|
const en_json_1 = tslib_1.__importDefault(require("./en.json"));
|
|
8
6
|
const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
|
|
9
|
-
|
|
7
|
+
const COMPONENT = 'NotFoundBlock';
|
|
8
|
+
exports.default = (0, registerKeyset_1.registerKeyset)({ en: en_json_1.default, ru: ru_json_1.default }, COMPONENT);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const useAnalytics: (name?: string, target?: string) => (e?:
|
|
1
|
+
import { AnalyticsEvent } from '../models';
|
|
2
|
+
export declare const useAnalytics: (name?: string, target?: string) => (e?: AnalyticsEvent | AnalyticsEvent[] | null, additionalContext?: Record<string, string>) => void;
|
|
@@ -1 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { ButtonPixel, MetrikaGoal, PixelEvent } from '../models';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Metrika will be deleted
|
|
4
|
+
*/
|
|
5
|
+
type UseMetrikaProps = {
|
|
6
|
+
metrikaGoals?: MetrikaGoal;
|
|
7
|
+
pixelEvents?: string | string[] | PixelEvent | PixelEvent[] | ButtonPixel;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated useMetrika will be deleted
|
|
11
|
+
*/
|
|
12
|
+
export declare const useMetrika: () => ({ metrikaGoals, pixelEvents }: UseMetrikaProps) => void;
|
|
13
|
+
export {};
|
|
@@ -1 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useMetrika = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const metrikaContext_1 = require("../context/metrikaContext");
|
|
6
|
+
const guards_1 = require("../models/guards");
|
|
7
|
+
// eslint-disable-next-line valid-jsdoc
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Metrika will be deleted, which uses this logic
|
|
10
|
+
*/
|
|
11
|
+
function isButtonPixel(pixelEvents) {
|
|
12
|
+
if (Array.isArray(pixelEvents) && pixelEvents.length && 'name' in pixelEvents) {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
// eslint-disable-next-line valid-jsdoc
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated useMetrika will be deleted
|
|
20
|
+
*/
|
|
21
|
+
const useMetrika = () => {
|
|
22
|
+
const { metrika, pixel } = (0, react_1.useContext)(metrikaContext_1.MetrikaContext);
|
|
23
|
+
return ({ metrikaGoals, pixelEvents }) => {
|
|
24
|
+
if (metrika && metrikaGoals) {
|
|
25
|
+
if ((0, guards_1.isNewMetrikaFormat)(metrikaGoals)) {
|
|
26
|
+
metrikaGoals.forEach(({ name, isCrossSite }) => metrika.reachGoal(isCrossSite ? 'cross-site' : 'main', name));
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
metrika.reachGoals(metrikaGoals);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (pixel && pixelEvents) {
|
|
33
|
+
if (isButtonPixel(pixelEvents)) {
|
|
34
|
+
pixelEvents.forEach(({ name, data }) => pixel.trackStandard(name, data));
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
pixel.track(pixelEvents);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
exports.useMetrika = useMetrika;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.i18n = void 0;
|
|
4
|
+
const i18n_1 = require("@gravity-ui/i18n");
|
|
5
|
+
const configure_1 = require("./utils/configure");
|
|
6
|
+
exports.i18n = new i18n_1.I18N();
|
|
7
|
+
exports.i18n.setLang((0, configure_1.getConfig)().lang || configure_1.Lang.En);
|
|
8
|
+
(0, configure_1.subscribeConfigure)((config) => {
|
|
9
|
+
if (config.lang) {
|
|
10
|
+
exports.i18n.setLang(config.lang);
|
|
11
|
+
}
|
|
12
|
+
});
|