@gravity-ui/page-constructor 4.51.0 → 4.51.2-alpha.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 +5 -3
- package/build/cjs/blocks/Banner/schema.d.ts +12 -264
- package/build/cjs/blocks/Banner/schema.js +4 -1
- package/build/cjs/blocks/FilterBlock/FilterBlock.js +2 -2
- package/build/cjs/blocks/FilterBlock/i18n/index.d.ts +1 -2
- package/build/cjs/blocks/FilterBlock/i18n/index.js +4 -3
- package/build/cjs/blocks/Header/schema.js +1 -1
- package/build/cjs/blocks/Map/schema.d.ts +0 -88
- package/build/cjs/blocks/Media/schema.d.ts +0 -176
- package/build/cjs/blocks/Security/i18n/index.d.ts +1 -2
- package/build/cjs/blocks/Security/i18n/index.js +4 -3
- package/build/cjs/blocks/Share/Share.js +4 -4
- package/build/cjs/blocks/Share/i18n/index.d.ts +1 -2
- package/build/cjs/blocks/Share/i18n/index.js +4 -3
- package/build/cjs/blocks/Slider/Arrow/Arrow.js +2 -2
- package/build/cjs/blocks/Slider/i18n/index.d.ts +1 -2
- package/build/cjs/blocks/Slider/i18n/index.js +4 -3
- package/build/cjs/components/Button/Button.js +4 -7
- package/build/cjs/components/Button/i18n/index.d.ts +1 -2
- package/build/cjs/components/Button/i18n/index.js +4 -3
- package/build/cjs/components/CardBase/CardBase.d.ts +1 -3
- package/build/cjs/components/CardBase/CardBase.js +1 -4
- package/build/cjs/components/Control/Control.js +2 -2
- package/build/cjs/components/Control/i18n/index.d.ts +1 -2
- package/build/cjs/components/Control/i18n/index.js +4 -3
- package/build/cjs/components/FullscreenImage/FullscreenImage.js +3 -3
- package/build/cjs/components/FullscreenImage/i18n/index.d.ts +1 -2
- package/build/cjs/components/FullscreenImage/i18n/index.js +4 -3
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +3 -6
- package/build/cjs/components/Link/Link.js +1 -4
- 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 +1 -2
- package/build/cjs/components/Map/YMap/i18n/index.js +4 -3
- package/build/cjs/components/Media/DataLens/DataLens.js +2 -2
- package/build/cjs/components/Media/DataLens/i18n/index.d.ts +1 -2
- package/build/cjs/components/Media/DataLens/i18n/index.js +4 -3
- package/build/cjs/components/Media/Iframe/Iframe.js +2 -2
- package/build/cjs/components/Media/Iframe/i18n/index.d.ts +1 -2
- package/build/cjs/components/Media/Iframe/i18n/index.js +4 -3
- package/build/cjs/components/Media/Media.js +1 -3
- package/build/cjs/components/Media/Video/Video.js +2 -3
- package/build/cjs/components/OverflowScroller/OverflowScroller.js +2 -2
- package/build/cjs/components/OverflowScroller/i18n/index.d.ts +1 -2
- package/build/cjs/components/OverflowScroller/i18n/index.js +4 -3
- package/build/cjs/components/ReactPlayer/CustomBarControls.js +3 -3
- package/build/cjs/components/ReactPlayer/ReactPlayer.js +5 -29
- package/build/cjs/components/ReactPlayer/i18n/index.d.ts +1 -2
- package/build/cjs/components/ReactPlayer/i18n/index.js +4 -3
- package/build/cjs/components/UnpublishedLabel/UnpublishedLabel.js +2 -2
- package/build/cjs/components/UnpublishedLabel/i18n/index.d.ts +1 -2
- package/build/cjs/components/UnpublishedLabel/i18n/index.js +4 -3
- package/build/cjs/components/VideoBlock/VideoBlock.js +2 -2
- package/build/cjs/components/VideoBlock/i18n/index.d.ts +1 -2
- package/build/cjs/components/VideoBlock/i18n/index.js +4 -3
- package/build/cjs/components/YandexForm/YandexForm.js +2 -13
- package/build/cjs/containers/Loadable/Loadable.js +2 -2
- package/build/cjs/containers/Loadable/i18n/index.d.ts +1 -2
- package/build/cjs/containers/Loadable/i18n/index.js +4 -3
- package/build/cjs/containers/PageConstructor/Provider.d.ts +0 -2
- package/build/cjs/containers/PageConstructor/Provider.js +1 -3
- package/build/cjs/context/localeContext/localeContext.d.ts +2 -2
- package/build/cjs/context/localeContext/localeContext.js +2 -2
- package/build/cjs/editor/components/ControlPanel/ControlPanel.js +3 -3
- package/build/cjs/editor/components/ControlPanel/i18n/en.json +2 -1
- package/build/cjs/editor/components/ControlPanel/i18n/index.d.ts +1 -2
- package/build/cjs/editor/components/ControlPanel/i18n/index.js +4 -3
- package/build/cjs/editor/components/ControlPanel/i18n/ru.json +2 -1
- package/build/cjs/editor/components/ErrorBoundary/ErrorBoundary.js +3 -3
- package/build/cjs/editor/components/ErrorBoundary/i18n/index.d.ts +1 -2
- package/build/cjs/editor/components/ErrorBoundary/i18n/index.js +4 -3
- package/build/cjs/editor/components/NotFoundBlock/NotFoundBlock.js +2 -2
- package/build/cjs/editor/components/NotFoundBlock/i18n/index.d.ts +1 -2
- package/build/cjs/editor/components/NotFoundBlock/i18n/index.js +4 -3
- package/build/cjs/hooks/useAnalytics.d.ts +2 -2
- package/build/cjs/hooks/useMetrika.d.ts +1 -13
- package/build/cjs/hooks/useMetrika.js +0 -41
- package/build/cjs/models/common.d.ts +2 -53
- package/build/cjs/models/common.js +1 -25
- package/build/cjs/models/constructor-items/common.d.ts +2 -28
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +2 -3
- package/build/cjs/models/guards.d.ts +0 -2
- package/build/cjs/models/guards.js +1 -5
- package/build/cjs/schema/constants.d.ts +4 -176
- package/build/cjs/schema/validators/common.d.ts +1 -188
- package/build/cjs/schema/validators/common.js +2 -32
- package/build/cjs/schema/validators/index.d.ts +0 -2
- package/build/cjs/schema/validators/index.js +0 -2
- package/build/cjs/sub-blocks/HubspotForm/index.js +1 -6
- package/build/cjs/sub-blocks/LayoutItem/utils.d.ts +1 -15
- package/build/cjs/sub-blocks/PriceCard/schema.d.ts +0 -88
- 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/index.d.ts +0 -1
- package/build/cjs/utils/index.js +1 -4
- package/build/esm/blocks/Banner/schema.d.ts +12 -264
- package/build/esm/blocks/Banner/schema.js +5 -2
- package/build/esm/blocks/FilterBlock/FilterBlock.js +1 -1
- package/build/esm/blocks/FilterBlock/i18n/index.d.ts +1 -2
- package/build/esm/blocks/FilterBlock/i18n/index.js +3 -3
- package/build/esm/blocks/Header/schema.js +2 -2
- package/build/esm/blocks/Map/schema.d.ts +0 -88
- package/build/esm/blocks/Media/schema.d.ts +0 -176
- package/build/esm/blocks/Security/i18n/index.d.ts +1 -2
- 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 +1 -2
- 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 +1 -2
- package/build/esm/blocks/Slider/i18n/index.js +3 -3
- package/build/esm/components/Button/Button.js +3 -6
- package/build/esm/components/Button/i18n/index.d.ts +1 -2
- package/build/esm/components/Button/i18n/index.js +3 -3
- package/build/esm/components/CardBase/CardBase.d.ts +1 -3
- package/build/esm/components/CardBase/CardBase.js +1 -4
- package/build/esm/components/Control/Control.js +1 -1
- package/build/esm/components/Control/i18n/index.d.ts +1 -2
- 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 +1 -2
- package/build/esm/components/FullscreenImage/i18n/index.js +3 -3
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +3 -6
- package/build/esm/components/Link/Link.js +1 -4
- 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 +1 -2
- 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 +1 -2
- 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 +1 -2
- package/build/esm/components/Media/Iframe/i18n/index.js +3 -3
- package/build/esm/components/Media/Media.js +1 -3
- package/build/esm/components/Media/Video/Video.js +2 -3
- package/build/esm/components/OverflowScroller/OverflowScroller.js +1 -1
- package/build/esm/components/OverflowScroller/i18n/index.d.ts +1 -2
- 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 +4 -28
- package/build/esm/components/ReactPlayer/i18n/index.d.ts +1 -2
- package/build/esm/components/ReactPlayer/i18n/index.js +3 -3
- package/build/esm/components/UnpublishedLabel/UnpublishedLabel.js +1 -1
- package/build/esm/components/UnpublishedLabel/i18n/index.d.ts +1 -2
- 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 +1 -2
- package/build/esm/components/VideoBlock/i18n/index.js +3 -3
- package/build/esm/components/YandexForm/YandexForm.js +2 -13
- package/build/esm/containers/Loadable/Loadable.js +1 -1
- package/build/esm/containers/Loadable/i18n/index.d.ts +1 -2
- package/build/esm/containers/Loadable/i18n/index.js +3 -3
- package/build/esm/containers/PageConstructor/Provider.d.ts +0 -2
- package/build/esm/containers/PageConstructor/Provider.js +1 -3
- package/build/esm/context/localeContext/localeContext.d.ts +2 -2
- package/build/esm/context/localeContext/localeContext.js +1 -1
- package/build/esm/editor/components/ControlPanel/ControlPanel.js +2 -2
- package/build/esm/editor/components/ControlPanel/i18n/en.json +2 -1
- package/build/esm/editor/components/ControlPanel/i18n/index.d.ts +1 -2
- package/build/esm/editor/components/ControlPanel/i18n/index.js +3 -3
- package/build/esm/editor/components/ControlPanel/i18n/ru.json +2 -1
- package/build/esm/editor/components/ErrorBoundary/ErrorBoundary.js +1 -1
- package/build/esm/editor/components/ErrorBoundary/i18n/index.d.ts +1 -2
- 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 +1 -2
- 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 +1 -13
- package/build/esm/hooks/useMetrika.js +1 -38
- package/build/esm/models/common.d.ts +2 -53
- package/build/esm/models/common.js +0 -24
- package/build/esm/models/constructor-items/common.d.ts +2 -28
- package/build/esm/models/constructor-items/sub-blocks.d.ts +2 -3
- package/build/esm/models/guards.d.ts +0 -2
- package/build/esm/models/guards.js +0 -3
- package/build/esm/schema/constants.d.ts +4 -176
- package/build/esm/schema/validators/common.d.ts +1 -188
- package/build/esm/schema/validators/common.js +1 -31
- package/build/esm/schema/validators/index.d.ts +0 -2
- package/build/esm/schema/validators/index.js +0 -2
- package/build/esm/sub-blocks/HubspotForm/index.js +1 -6
- package/build/esm/sub-blocks/LayoutItem/utils.d.ts +1 -15
- package/build/esm/sub-blocks/PriceCard/schema.d.ts +0 -88
- 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/index.d.ts +0 -1
- package/build/esm/utils/index.js +0 -1
- package/package.json +1 -1
- package/server/models/common.d.ts +2 -53
- package/server/models/common.js +1 -25
- package/server/models/constructor-items/common.d.ts +2 -28
- package/server/models/constructor-items/sub-blocks.d.ts +2 -3
- package/server/models/guards.d.ts +0 -2
- package/server/models/guards.js +1 -5
- 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/index.d.ts +0 -1
- package/server/utils/index.js +1 -4
- package/widget/index.js +1 -1
- package/build/cjs/context/metrikaContext/index.d.ts +0 -1
- package/build/cjs/context/metrikaContext/index.js +0 -4
- package/build/cjs/context/metrikaContext/metrikaContext.d.ts +0 -13
- package/build/cjs/context/metrikaContext/metrikaContext.js +0 -6
- package/build/cjs/i18n.d.ts +0 -2
- package/build/cjs/i18n.js +0 -12
- package/build/cjs/schema/validators/pixel.d.ts +0 -57
- package/build/cjs/schema/validators/pixel.js +0 -63
- package/build/cjs/utils/configure.d.ts +0 -12
- package/build/cjs/utils/configure.js +0 -26
- package/build/cjs/utils/registerKeyset.d.ts +0 -5
- package/build/cjs/utils/registerKeyset.js +0 -9
- package/build/esm/context/metrikaContext/index.d.ts +0 -1
- package/build/esm/context/metrikaContext/index.js +0 -1
- package/build/esm/context/metrikaContext/metrikaContext.d.ts +0 -13
- package/build/esm/context/metrikaContext/metrikaContext.js +0 -2
- package/build/esm/i18n.d.ts +0 -2
- package/build/esm/i18n.js +0 -9
- package/build/esm/schema/validators/pixel.d.ts +0 -57
- package/build/esm/schema/validators/pixel.js +0 -60
- package/build/esm/utils/configure.d.ts +0 -12
- package/build/esm/utils/configure.js +0 -20
- package/build/esm/utils/registerKeyset.d.ts +0 -5
- package/build/esm/utils/registerKeyset.js +0 -5
- package/server/utils/configure.d.ts +0 -12
- package/server/utils/configure.js +0 -26
|
@@ -6,7 +6,6 @@ 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");
|
|
10
9
|
const mobileContext_1 = require("../../context/mobileContext");
|
|
11
10
|
const videoContext_1 = require("../../context/videoContext");
|
|
12
11
|
const hooks_1 = require("../../hooks");
|
|
@@ -14,15 +13,14 @@ const icons_1 = require("../../icons");
|
|
|
14
13
|
const models_1 = require("../../models");
|
|
15
14
|
const utils_1 = require("../../utils");
|
|
16
15
|
const CustomBarControls_1 = tslib_1.__importDefault(require("./CustomBarControls"));
|
|
17
|
-
const i18n_1 =
|
|
16
|
+
const i18n_1 = require("./i18n");
|
|
18
17
|
const utils_2 = require("./utils");
|
|
19
18
|
const b = (0, utils_1.block)('ReactPlayer');
|
|
20
19
|
const FPS = 60;
|
|
21
20
|
// eslint-disable-next-line react/display-name
|
|
22
21
|
exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
23
22
|
const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
|
|
24
|
-
const {
|
|
25
|
-
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;
|
|
23
|
+
const { src, previewImgUrl, loop = false, controls = models_1.MediaVideoControlsType.Default, customControlsOptions = {}, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, analyticsEvents, height, ariaLabel, ratio, } = props;
|
|
26
24
|
const { type = models_1.PlayButtonType.Default, theme = models_1.PlayButtonThemes.Blue, text, className: buttonClassName, } = playButton || {};
|
|
27
25
|
const { type: customControlsType = models_1.CustomControlsType.WithMuteButton, muteButtonShown, positioning = models_1.CustomControlsButtonPositioning.Center, } = customControlsOptions;
|
|
28
26
|
const autoPlay = Boolean(!isMobile && !previewImgUrl && props.autoplay);
|
|
@@ -119,7 +117,7 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
119
117
|
playButtonContent = react_1.default.createElement(uikit_1.Icon, { className: b('icon'), data: icons_1.PlayVideo, size: 24 });
|
|
120
118
|
break;
|
|
121
119
|
}
|
|
122
|
-
return (react_1.default.createElement("button", { className: b('button', { theme, text: Boolean(text) }, buttonClassName), "aria-label": (0, i18n_1.
|
|
120
|
+
return (react_1.default.createElement("button", { className: b('button', { theme, text: Boolean(text) }, buttonClassName), "aria-label": (0, i18n_1.i18n)('play') }, playButtonContent));
|
|
123
121
|
}, [type, theme, text, buttonClassName]);
|
|
124
122
|
const changeMute = (0, react_1.useCallback)((isMuted) => {
|
|
125
123
|
if (isMuted &&
|
|
@@ -128,13 +126,6 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
128
126
|
playerRef.seekTo(0);
|
|
129
127
|
setPlayedPercent(0);
|
|
130
128
|
}
|
|
131
|
-
if (metrika && videoMetrika) {
|
|
132
|
-
const { play, stop, counterName } = videoMetrika;
|
|
133
|
-
const goal = isMuted ? play : stop;
|
|
134
|
-
if (goal) {
|
|
135
|
-
metrika.reachGoals(goal, counterName);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
129
|
const events = isMuted ? playEvents : stopEvents;
|
|
139
130
|
handleAnalytics(events);
|
|
140
131
|
if (isMuted) {
|
|
@@ -142,27 +133,12 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
142
133
|
}
|
|
143
134
|
// In order to the progress bar to update (equals 0) before displaying
|
|
144
135
|
setTimeout(() => setMuted(!isMuted), 0);
|
|
145
|
-
}, [
|
|
146
|
-
playerRef,
|
|
147
|
-
customControlsType,
|
|
148
|
-
metrika,
|
|
149
|
-
videoMetrika,
|
|
150
|
-
playEvents,
|
|
151
|
-
stopEvents,
|
|
152
|
-
handleAnalytics,
|
|
153
|
-
setProps,
|
|
154
|
-
]);
|
|
136
|
+
}, [playerRef, customControlsType, playEvents, stopEvents, handleAnalytics, setProps]);
|
|
155
137
|
const handleClickPreview = (0, react_1.useCallback)(() => {
|
|
156
138
|
setIsPlaying(true);
|
|
157
139
|
onClickPreview === null || onClickPreview === void 0 ? void 0 : onClickPreview();
|
|
158
|
-
if (metrika && videoMetrika) {
|
|
159
|
-
const { play, counterName } = videoMetrika;
|
|
160
|
-
if (play) {
|
|
161
|
-
metrika.reachGoals(play, counterName);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
140
|
handleAnalytics(playEvents);
|
|
165
|
-
}, [onClickPreview,
|
|
141
|
+
}, [onClickPreview, handleAnalytics, playEvents]);
|
|
166
142
|
const onPause = (0, react_1.useCallback)(() => {
|
|
167
143
|
// For support correct state for youtube
|
|
168
144
|
if (controls !== models_1.MediaVideoControlsType.Custom ||
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export default _default;
|
|
1
|
+
export declare const i18n: (key: "play" | "pause" | "mute" | "unmute", params?: import("@gravity-ui/i18n").Params | undefined) => string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.i18n = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
5
|
+
const i18n_1 = require("@gravity-ui/uikit/i18n");
|
|
6
|
+
const cn_1 = require("../../../utils/cn");
|
|
5
7
|
const en_json_1 = tslib_1.__importDefault(require("./en.json"));
|
|
6
8
|
const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
|
|
7
|
-
|
|
8
|
-
exports.default = (0, registerKeyset_1.registerKeyset)({ en: en_json_1.default, ru: ru_json_1.default }, COMPONENT);
|
|
9
|
+
exports.i18n = (0, i18n_1.addComponentKeysets)({ en: en_json_1.default, ru: ru_json_1.default }, `${cn_1.NAMESPACE}ReactPlayer`);
|
|
@@ -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 =
|
|
6
|
+
const i18n_1 = 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.i18n)('label_non_published')));
|
|
9
9
|
exports.default = UnpublishedLabel;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export default _default;
|
|
1
|
+
export declare const i18n: (key: "label_non_published", params?: import("@gravity-ui/i18n").Params | undefined) => string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.i18n = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
5
|
+
const i18n_1 = require("@gravity-ui/uikit/i18n");
|
|
6
|
+
const cn_1 = require("../../../utils/cn");
|
|
5
7
|
const en_json_1 = tslib_1.__importDefault(require("./en.json"));
|
|
6
8
|
const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
|
|
7
|
-
|
|
8
|
-
exports.default = (0, registerKeyset_1.registerKeyset)({ en: en_json_1.default, ru: ru_json_1.default }, COMPONENT);
|
|
9
|
+
exports.i18n = (0, i18n_1.addComponentKeysets)({ en: en_json_1.default, ru: ru_json_1.default }, `${cn_1.NAMESPACE}UnpublishedLabel`);
|
|
@@ -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 =
|
|
14
|
+
const i18n_1 = 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.i18n)('iframe-title');
|
|
83
83
|
iframe.frameBorder = '0';
|
|
84
84
|
iframe.setAttribute('allowfullscreen', 'true');
|
|
85
85
|
iframe.setAttribute('allow', 'autoplay');
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export default _default;
|
|
1
|
+
export declare const i18n: (key: "iframe-title", params?: import("@gravity-ui/i18n").Params | undefined) => string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.i18n = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
5
|
+
const i18n_1 = require("@gravity-ui/uikit/i18n");
|
|
6
|
+
const cn_1 = require("../../../utils/cn");
|
|
5
7
|
const en_json_1 = tslib_1.__importDefault(require("./en.json"));
|
|
6
8
|
const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
|
|
7
|
-
|
|
8
|
-
exports.default = (0, registerKeyset_1.registerKeyset)({ en: en_json_1.default, ru: ru_json_1.default }, COMPONENT);
|
|
9
|
+
exports.i18n = (0, i18n_1.addComponentKeysets)({ en: en_json_1.default, ru: ru_json_1.default }, `${cn_1.NAMESPACE}VideoBlock`);
|
|
@@ -6,7 +6,6 @@ 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");
|
|
10
9
|
const common_1 = require("../../models/common");
|
|
11
10
|
const utils_1 = require("../../utils");
|
|
12
11
|
const constants_1 = require("../constants");
|
|
@@ -15,12 +14,11 @@ exports.YANDEX_FORM_SECTION = 'surveys';
|
|
|
15
14
|
const CONTAINER_ID = 'pc-yandex-form-container';
|
|
16
15
|
const b = (0, utils_1.block)('yandex-form');
|
|
17
16
|
const YandexForm = (props) => {
|
|
18
|
-
const { onLoad, id, params, className, theme, containerId = CONTAINER_ID, headerHeight = constants_1.HEADER_HEIGHT, onSubmit,
|
|
17
|
+
const { onLoad, id, params, className, theme, containerId = CONTAINER_ID, headerHeight = constants_1.HEADER_HEIGHT, onSubmit, analyticsEvents, customFormOrigin, customFormSection, } = props;
|
|
19
18
|
const formContainerRef = (0, react_1.useRef)(null);
|
|
20
19
|
const iframeRef = (0, react_1.useRef)();
|
|
21
20
|
const yaFormOrigin = customFormOrigin || exports.YANDEX_FORM_ORIGIN;
|
|
22
21
|
const yaFormSection = customFormSection || exports.YANDEX_FORM_SECTION;
|
|
23
|
-
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
24
22
|
const handleAnalytics = (0, hooks_1.useAnalytics)(common_1.DefaultEventNames.YandexFormSubmit);
|
|
25
23
|
const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
|
|
26
24
|
const locale = (0, react_1.useContext)(localeContext_1.LocaleContext);
|
|
@@ -62,20 +60,11 @@ const YandexForm = (props) => {
|
|
|
62
60
|
const { top } = formContainerRef.current.getBoundingClientRect();
|
|
63
61
|
window.scrollBy(0, top - headerHeight);
|
|
64
62
|
}
|
|
65
|
-
handleMetrika({ metrikaGoals, pixelEvents });
|
|
66
63
|
handleAnalytics(analyticsEvents);
|
|
67
64
|
if (onSubmit) {
|
|
68
65
|
onSubmit();
|
|
69
66
|
}
|
|
70
|
-
}, [
|
|
71
|
-
handleMetrika,
|
|
72
|
-
metrikaGoals,
|
|
73
|
-
pixelEvents,
|
|
74
|
-
handleAnalytics,
|
|
75
|
-
analyticsEvents,
|
|
76
|
-
onSubmit,
|
|
77
|
-
headerHeight,
|
|
78
|
-
]);
|
|
67
|
+
}, [handleAnalytics, analyticsEvents, onSubmit, headerHeight]);
|
|
79
68
|
const handleMessage = (0, react_1.useCallback)(({ origin, data }) => {
|
|
80
69
|
if (origin !== yaFormOrigin) {
|
|
81
70
|
return;
|
|
@@ -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 =
|
|
8
|
+
const i18n_1 = 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.i18n)('loadable-load-error'), buttonText: (0, i18n_1.i18n)('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,2 +1 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export default _default;
|
|
1
|
+
export declare const i18n: (key: "loadable-load-error" | "loadable-try-again", params?: import("@gravity-ui/i18n").Params | undefined) => string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.i18n = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
5
|
+
const i18n_1 = require("@gravity-ui/uikit/i18n");
|
|
6
|
+
const cn_1 = require("../../../utils/cn");
|
|
5
7
|
const en_json_1 = tslib_1.__importDefault(require("./en.json"));
|
|
6
8
|
const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
|
|
7
|
-
|
|
8
|
-
exports.default = (0, registerKeyset_1.registerKeyset)({ en: en_json_1.default, ru: ru_json_1.default }, COMPONENT);
|
|
9
|
+
exports.i18n = (0, i18n_1.addComponentKeysets)({ en: en_json_1.default, ru: ru_json_1.default }, `${cn_1.NAMESPACE}Loadable`);
|
|
@@ -3,7 +3,6 @@ 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';
|
|
7
6
|
import { ProjectSettingsContextProps } from '../../context/projectSettingsContext';
|
|
8
7
|
import { SSRContextProps } from '../../context/ssrContext';
|
|
9
8
|
import { Theme, WithChildren } from '../../models';
|
|
@@ -11,7 +10,6 @@ export interface PageConstructorProviderProps {
|
|
|
11
10
|
isMobile?: boolean;
|
|
12
11
|
locale?: LocaleContextProps;
|
|
13
12
|
location?: LocationContextProps;
|
|
14
|
-
metrika?: MetrikaContextProps;
|
|
15
13
|
ssrConfig?: SSRContextProps;
|
|
16
14
|
theme?: Theme;
|
|
17
15
|
mapsContext?: MapsContextType;
|
|
@@ -9,13 +9,12 @@ 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");
|
|
13
12
|
const mobileContext_1 = require("../../context/mobileContext");
|
|
14
13
|
const projectSettingsContext_1 = require("../../context/projectSettingsContext");
|
|
15
14
|
const ssrContext_1 = require("../../context/ssrContext");
|
|
16
15
|
const theme_1 = require("../../context/theme");
|
|
17
16
|
const PageConstructorProvider = (props) => {
|
|
18
|
-
const { isMobile, mapsContext = mapsContext_1.initialMapValue, locale = {}, location = {},
|
|
17
|
+
const { isMobile, mapsContext = mapsContext_1.initialMapValue, locale = {}, location = {}, analytics = {}, ssrConfig = {}, projectSettings = {}, theme = constants_1.DEFAULT_THEME, children, image = {}, } = props;
|
|
19
18
|
/* eslint-disable react/jsx-key */
|
|
20
19
|
const context = [
|
|
21
20
|
react_1.default.createElement(theme_1.ThemeContext.Provider, { value: { theme } }),
|
|
@@ -25,7 +24,6 @@ const PageConstructorProvider = (props) => {
|
|
|
25
24
|
react_1.default.createElement(locationContext_1.LocationContext.Provider, { value: location }),
|
|
26
25
|
react_1.default.createElement(mobileContext_1.MobileContext.Provider, { value: Boolean(isMobile) }),
|
|
27
26
|
react_1.default.createElement(mapsContext_1.MapsContext.Provider, { value: mapsContext }),
|
|
28
|
-
react_1.default.createElement(metrikaContext_1.MetrikaContext.Provider, { value: metrika }),
|
|
29
27
|
react_1.default.createElement(analyticsContext_1.AnalyticsContext.Provider, { value: analytics }),
|
|
30
28
|
react_1.default.createElement(ssrContext_1.SSRContext.Provider, { value: { isServer: ssrConfig === null || ssrConfig === void 0 ? void 0 : ssrConfig.isServer } }),
|
|
31
29
|
].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 '@gravity-ui/uikit';
|
|
3
3
|
export type LocaleContextProps = {
|
|
4
|
-
lang?: 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 uikit_1 = require("@gravity-ui/uikit");
|
|
7
|
+
exports.LocaleContext = react_1.default.createContext({ lang: uikit_1.Lang.Ru, tld: '.ru' });
|
|
@@ -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 =
|
|
11
|
+
const i18n_1 = 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.i18n)('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.i18n)('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,2 +1 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export default _default;
|
|
1
|
+
export declare const i18n: (key: "theme" | "mode", params?: import("@gravity-ui/i18n").Params | undefined) => string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.i18n = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
5
|
+
const i18n_1 = require("@gravity-ui/uikit/i18n");
|
|
6
|
+
const cn_1 = require("../../../../utils/cn");
|
|
5
7
|
const en_json_1 = tslib_1.__importDefault(require("./en.json"));
|
|
6
8
|
const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
|
|
7
|
-
|
|
8
|
-
exports.default = (0, registerKeyset_1.registerKeyset)({ en: en_json_1.default, ru: ru_json_1.default }, COMPONENT);
|
|
9
|
+
exports.i18n = (0, i18n_1.addComponentKeysets)({ en: en_json_1.default, ru: ru_json_1.default }, `${cn_1.NAMESPACE}ControlPanel`);
|
|
@@ -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 =
|
|
8
|
+
const i18n_1 = 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.i18n)('error-block-header', { id: (0, utils_2.getBlockId)({ type, index }) })
|
|
23
|
+
: (0, i18n_1.i18n)('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,2 +1 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export default _default;
|
|
1
|
+
export declare const i18n: (key: "error-block-header" | "error-page-header", params?: import("@gravity-ui/i18n").Params | undefined) => string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.i18n = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
5
|
+
const i18n_1 = require("@gravity-ui/uikit/i18n");
|
|
6
|
+
const cn_1 = require("../../../../utils/cn");
|
|
5
7
|
const en_json_1 = tslib_1.__importDefault(require("./en.json"));
|
|
6
8
|
const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
|
|
7
|
-
|
|
8
|
-
exports.default = (0, registerKeyset_1.registerKeyset)({ en: en_json_1.default, ru: ru_json_1.default }, COMPONENT);
|
|
9
|
+
exports.i18n = (0, i18n_1.addComponentKeysets)({ en: en_json_1.default, ru: ru_json_1.default }, `${cn_1.NAMESPACE}ErrorBoundary`);
|
|
@@ -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 =
|
|
8
|
+
const i18n_1 = 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.i18n)('message', { type }))));
|
|
12
12
|
exports.NotFoundBlock = NotFoundBlock;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export default _default;
|
|
1
|
+
export declare const i18n: (key: "message", params?: import("@gravity-ui/i18n").Params | undefined) => string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.i18n = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
5
|
+
const i18n_1 = require("@gravity-ui/uikit/i18n");
|
|
6
|
+
const cn_1 = require("../../../../utils/cn");
|
|
5
7
|
const en_json_1 = tslib_1.__importDefault(require("./en.json"));
|
|
6
8
|
const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
|
|
7
|
-
|
|
8
|
-
exports.default = (0, registerKeyset_1.registerKeyset)({ en: en_json_1.default, ru: ru_json_1.default }, COMPONENT);
|
|
9
|
+
exports.i18n = (0, i18n_1.addComponentKeysets)({ en: en_json_1.default, ru: ru_json_1.default }, `${cn_1.NAMESPACE}NotFoundBlock`);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const useAnalytics: (name?: string, target?: string) => (e?:
|
|
1
|
+
import { AnalyticsEventsProp } from '../models';
|
|
2
|
+
export declare const useAnalytics: (name?: string, target?: string) => (e?: AnalyticsEventsProp | null, additionalContext?: Record<string, string>) => void;
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
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
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;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { MetrikaGoal } from './';
|
|
3
2
|
export interface Refable<T> {
|
|
4
3
|
ref?: React.Ref<T>;
|
|
5
4
|
}
|
|
@@ -8,59 +7,9 @@ export declare enum Theme {
|
|
|
8
7
|
Dark = "dark"
|
|
9
8
|
}
|
|
10
9
|
export declare const themeNames: Record<Theme, string>;
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated Pixel will be deleted
|
|
13
|
-
*/
|
|
14
|
-
type PixelCommand = 'track' | 'trackCustom';
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated Pixel will be deleted
|
|
17
|
-
*/
|
|
18
|
-
export interface PixelEvent {
|
|
19
|
-
command: PixelCommand;
|
|
20
|
-
event: PixelEventType | string;
|
|
21
|
-
data?: Object;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated Pixel will be deleted from package
|
|
25
|
-
*/
|
|
26
|
-
export declare enum PixelEventType {
|
|
27
|
-
AddPaymentInfo = "AddPaymentInfo",
|
|
28
|
-
AddToCart = "AddToCart",
|
|
29
|
-
AddToWishlist = "AddToWishlist",
|
|
30
|
-
CompleteRegistration = "CompleteRegistration",
|
|
31
|
-
Contact = "Contact",
|
|
32
|
-
CustomizeProduct = "CustomizeProduct",
|
|
33
|
-
Donate = "Donate",
|
|
34
|
-
FindLocation = "FindLocation",
|
|
35
|
-
InitiateCheckout = "InitiateCheckout",
|
|
36
|
-
Lead = "Lead",
|
|
37
|
-
PageView = "PageView",
|
|
38
|
-
Purchase = "Purchase",
|
|
39
|
-
Schedule = "Schedule",
|
|
40
|
-
Search = "Search",
|
|
41
|
-
StartTrial = "StartTrial",
|
|
42
|
-
SubmitApplication = "SubmitApplication",
|
|
43
|
-
Subscribe = "Subscribe",
|
|
44
|
-
ViewContent = "ViewContent"
|
|
45
|
-
}
|
|
46
10
|
export type Modifiers = {
|
|
47
11
|
[name: string]: string | boolean | undefined;
|
|
48
12
|
};
|
|
49
|
-
/**
|
|
50
|
-
* @deprecated Pixel will be deleted
|
|
51
|
-
*/
|
|
52
|
-
export interface Pixel<TEvent = string> {
|
|
53
|
-
trackStandard: (event: TEvent, data?: Object) => void;
|
|
54
|
-
trackCustom: (event: string, data?: Object) => void;
|
|
55
|
-
track: (trackEvents: string | string[] | PixelEvent[] | PixelEvent) => void;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* @deprecated Metrika will be deleted
|
|
59
|
-
*/
|
|
60
|
-
export interface Metrika {
|
|
61
|
-
reachGoal: (counterName: string, ...args: any) => void;
|
|
62
|
-
reachGoals: (goals: MetrikaGoal, counterName?: string) => void;
|
|
63
|
-
}
|
|
64
13
|
export interface ClassNameProps {
|
|
65
14
|
className?: string;
|
|
66
15
|
}
|
|
@@ -97,7 +46,7 @@ export type AnalyticsEvent<T = {}> = T & {
|
|
|
97
46
|
context?: string;
|
|
98
47
|
target?: string;
|
|
99
48
|
};
|
|
49
|
+
export type AnalyticsEventsProp = AnalyticsEvent | AnalyticsEvent[];
|
|
100
50
|
export interface AnalyticsEventsBase {
|
|
101
|
-
analyticsEvents?:
|
|
51
|
+
analyticsEvents?: AnalyticsEventsProp;
|
|
102
52
|
}
|
|
103
|
-
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DefaultEventNames = exports.PredefinedEventTypes = exports.
|
|
3
|
+
exports.DefaultEventNames = exports.PredefinedEventTypes = exports.themeNames = exports.Theme = void 0;
|
|
4
4
|
var Theme;
|
|
5
5
|
(function (Theme) {
|
|
6
6
|
Theme["Light"] = "light";
|
|
@@ -10,30 +10,6 @@ exports.themeNames = {
|
|
|
10
10
|
[Theme.Light]: 'Light',
|
|
11
11
|
[Theme.Dark]: 'Dark',
|
|
12
12
|
};
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated Pixel will be deleted from package
|
|
15
|
-
*/
|
|
16
|
-
var PixelEventType;
|
|
17
|
-
(function (PixelEventType) {
|
|
18
|
-
PixelEventType["AddPaymentInfo"] = "AddPaymentInfo";
|
|
19
|
-
PixelEventType["AddToCart"] = "AddToCart";
|
|
20
|
-
PixelEventType["AddToWishlist"] = "AddToWishlist";
|
|
21
|
-
PixelEventType["CompleteRegistration"] = "CompleteRegistration";
|
|
22
|
-
PixelEventType["Contact"] = "Contact";
|
|
23
|
-
PixelEventType["CustomizeProduct"] = "CustomizeProduct";
|
|
24
|
-
PixelEventType["Donate"] = "Donate";
|
|
25
|
-
PixelEventType["FindLocation"] = "FindLocation";
|
|
26
|
-
PixelEventType["InitiateCheckout"] = "InitiateCheckout";
|
|
27
|
-
PixelEventType["Lead"] = "Lead";
|
|
28
|
-
PixelEventType["PageView"] = "PageView";
|
|
29
|
-
PixelEventType["Purchase"] = "Purchase";
|
|
30
|
-
PixelEventType["Schedule"] = "Schedule";
|
|
31
|
-
PixelEventType["Search"] = "Search";
|
|
32
|
-
PixelEventType["StartTrial"] = "StartTrial";
|
|
33
|
-
PixelEventType["SubmitApplication"] = "SubmitApplication";
|
|
34
|
-
PixelEventType["Subscribe"] = "Subscribe";
|
|
35
|
-
PixelEventType["ViewContent"] = "ViewContent";
|
|
36
|
-
})(PixelEventType = exports.PixelEventType || (exports.PixelEventType = {}));
|
|
37
13
|
var PredefinedEventTypes;
|
|
38
14
|
(function (PredefinedEventTypes) {
|
|
39
15
|
PredefinedEventTypes["Default"] = "default-event";
|