@gravity-ui/page-constructor 1.14.0-alpha.8 → 1.15.0-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/CHANGELOG.md +21 -0
- package/build/cjs/blocks/Banner/schema.d.ts +36 -138
- package/build/cjs/blocks/Media/schema.d.ts +12 -46
- package/build/cjs/components/Button/Button.js +3 -3
- package/build/cjs/components/CardBase/CardBase.d.ts +2 -2
- package/build/cjs/components/CardBase/CardBase.js +3 -3
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +3 -3
- package/build/cjs/components/Link/Link.js +3 -3
- package/build/cjs/components/Media/Media.js +3 -2
- package/build/cjs/components/Media/Video/Video.js +4 -3
- package/build/cjs/components/ReactPlayer/ReactPlayer.js +27 -3
- package/build/cjs/components/YandexForm/YandexForm.d.ts +2 -2
- package/build/cjs/components/YandexForm/YandexForm.js +3 -3
- package/build/cjs/context/analyticsContext/analyticsContext.d.ts +2 -2
- package/build/cjs/hooks/index.d.ts +1 -0
- package/build/cjs/hooks/index.js +1 -0
- package/build/cjs/hooks/useAnalytics.d.ts +2 -2
- package/build/cjs/hooks/useAnalytics.js +4 -1
- package/build/cjs/models/common.d.ts +11 -5
- package/build/cjs/models/constructor-items/common.d.ts +6 -4
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +2 -2
- package/build/cjs/models/navigation.d.ts +1 -3
- package/build/cjs/navigation/components/Header/Header.css +5 -3
- package/build/cjs/navigation/components/Logo/Logo.css +5 -6
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.css +1 -0
- package/build/cjs/navigation/schema.d.ts +60 -0
- package/build/cjs/navigation/schema.js +80 -0
- package/build/cjs/schema/index.d.ts +67 -0
- package/build/cjs/schema/index.js +2 -1
- package/build/cjs/schema/validators/common.d.ts +24 -92
- package/build/cjs/schema/validators/common.js +1 -1
- package/build/cjs/schema/validators/event.d.ts +37 -0
- package/build/cjs/schema/validators/event.js +34 -1
- package/build/cjs/schema/validators/index.d.ts +2 -0
- package/build/cjs/schema/validators/index.js +2 -0
- package/build/cjs/schema/validators/navigation.d.ts +1 -0
- package/build/cjs/schema/validators/navigation.js +4 -0
- package/build/cjs/sub-blocks/HubspotForm/index.js +2 -3
- package/build/cjs/text-transform/blocks.js +1 -10
- package/build/esm/blocks/Banner/schema.d.ts +36 -138
- package/build/esm/blocks/Media/schema.d.ts +12 -46
- package/build/esm/components/Button/Button.js +2 -2
- package/build/esm/components/CardBase/CardBase.d.ts +2 -2
- package/build/esm/components/CardBase/CardBase.js +2 -2
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +2 -2
- package/build/esm/components/Link/Link.js +2 -2
- package/build/esm/components/Media/Media.js +3 -2
- package/build/esm/components/Media/Video/Video.js +4 -3
- package/build/esm/components/ReactPlayer/ReactPlayer.js +27 -3
- package/build/esm/components/YandexForm/YandexForm.d.ts +2 -2
- package/build/esm/components/YandexForm/YandexForm.js +2 -2
- package/build/esm/context/analyticsContext/analyticsContext.d.ts +2 -2
- package/build/esm/hooks/index.d.ts +1 -0
- package/build/esm/hooks/index.js +1 -0
- package/build/esm/hooks/useAnalytics.d.ts +2 -2
- package/build/esm/hooks/useAnalytics.js +4 -1
- package/build/esm/models/common.d.ts +11 -5
- package/build/esm/models/constructor-items/common.d.ts +6 -4
- package/build/esm/models/constructor-items/sub-blocks.d.ts +2 -2
- package/build/esm/models/navigation.d.ts +1 -3
- package/build/esm/navigation/components/Header/Header.css +5 -3
- package/build/esm/navigation/components/Logo/Logo.css +5 -6
- package/build/esm/navigation/components/NavigationItem/NavigationItem.css +1 -0
- package/build/esm/navigation/schema.d.ts +60 -0
- package/build/esm/navigation/schema.js +77 -0
- package/build/esm/schema/index.d.ts +67 -0
- package/build/esm/schema/index.js +2 -1
- package/build/esm/schema/validators/common.d.ts +24 -92
- package/build/esm/schema/validators/common.js +2 -2
- package/build/esm/schema/validators/event.d.ts +37 -0
- package/build/esm/schema/validators/event.js +33 -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/navigation.d.ts +1 -0
- package/build/esm/schema/validators/navigation.js +1 -0
- package/build/esm/sub-blocks/HubspotForm/index.js +2 -3
- package/build/esm/text-transform/blocks.js +1 -10
- package/package.json +1 -1
- package/server/models/common.d.ts +11 -5
- package/server/models/constructor-items/common.d.ts +6 -4
- package/server/models/constructor-items/sub-blocks.d.ts +2 -2
- package/server/models/navigation.d.ts +1 -3
- package/server/text-transform/blocks.js +1 -10
|
@@ -9,6 +9,7 @@ import { VideoContext } from '../../context/videoContext';
|
|
|
9
9
|
import { MetrikaContext } from '../../context/metrikaContext';
|
|
10
10
|
import { MobileContext } from '../../context/mobileContext';
|
|
11
11
|
import { PlayVideo } from '../../icons';
|
|
12
|
+
import { useAnalytics } from '../../hooks';
|
|
12
13
|
import './ReactPlayer.css';
|
|
13
14
|
const b = block('ReactPlayer');
|
|
14
15
|
const FPS = 60;
|
|
@@ -16,7 +17,7 @@ const FPS = 60;
|
|
|
16
17
|
export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
17
18
|
const isMobile = useContext(MobileContext);
|
|
18
19
|
const { metrika } = useContext(MetrikaContext);
|
|
19
|
-
const { src, previewImgUrl, loop = false, controls = MediaVideoControlsType.Default, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika, height, } = props;
|
|
20
|
+
const { src, previewImgUrl, loop = false, controls = MediaVideoControlsType.Default, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika, analyticsEvents, height, } = props;
|
|
20
21
|
const { type = PlayButtonType.Default, theme = PlayButtonThemes.Blue, text, className: buttonClassName, } = playButton || {};
|
|
21
22
|
const autoPlay = Boolean(!isMobile && !previewImgUrl && props.autoplay);
|
|
22
23
|
const mute = initiallyMuted || autoPlay;
|
|
@@ -31,6 +32,7 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
31
32
|
const [started, setStarted] = useState(autoPlay);
|
|
32
33
|
const [paused, setPaused] = useState(false);
|
|
33
34
|
const [ended, setEnded] = useState(false);
|
|
35
|
+
const handleAnalytics = useAnalytics();
|
|
34
36
|
useImperativeHandle(originRef, () => ({
|
|
35
37
|
pause: () => setIsPlaying(false),
|
|
36
38
|
}));
|
|
@@ -79,6 +81,8 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
79
81
|
window.removeEventListener('resize', updateSize);
|
|
80
82
|
};
|
|
81
83
|
}, []);
|
|
84
|
+
const playEvents = useMemo(() => analyticsEvents === null || analyticsEvents === void 0 ? void 0 : analyticsEvents.filter((e) => e.type === 'play'), [analyticsEvents]);
|
|
85
|
+
const stopEvents = useMemo(() => analyticsEvents === null || analyticsEvents === void 0 ? void 0 : analyticsEvents.filter((e) => e.type === 'stop'), [analyticsEvents]);
|
|
82
86
|
const playIcon = useMemo(() => {
|
|
83
87
|
let playButtonContent;
|
|
84
88
|
switch (type) {
|
|
@@ -104,12 +108,27 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
104
108
|
metrika.reachGoals(goal, counterName);
|
|
105
109
|
}
|
|
106
110
|
}
|
|
111
|
+
if (handleAnalytics && analyticsEvents) {
|
|
112
|
+
const events = isMuted ? playEvents : stopEvents;
|
|
113
|
+
if (events) {
|
|
114
|
+
handleAnalytics(events);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
107
117
|
if (isMuted) {
|
|
108
118
|
setProps({ playingVideoRef: ref.current });
|
|
109
119
|
}
|
|
110
120
|
// In order to the progress bar to update (equals 0) before displaying
|
|
111
121
|
setTimeout(() => setMuted(!isMuted), 0);
|
|
112
|
-
}, [
|
|
122
|
+
}, [
|
|
123
|
+
playerRef,
|
|
124
|
+
metrika,
|
|
125
|
+
videoMetrika,
|
|
126
|
+
handleAnalytics,
|
|
127
|
+
analyticsEvents,
|
|
128
|
+
playEvents,
|
|
129
|
+
stopEvents,
|
|
130
|
+
setProps,
|
|
131
|
+
]);
|
|
113
132
|
const handleClick = useCallback(() => changeMute(muted), [changeMute, muted]);
|
|
114
133
|
const handleClickPreview = useCallback(() => {
|
|
115
134
|
setIsPlaying(true);
|
|
@@ -120,7 +139,12 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
120
139
|
metrika.reachGoals(play, counterName);
|
|
121
140
|
}
|
|
122
141
|
}
|
|
123
|
-
|
|
142
|
+
if (handleAnalytics && analyticsEvents) {
|
|
143
|
+
if (playEvents) {
|
|
144
|
+
handleAnalytics(playEvents);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}, [onClickPreview, metrika, videoMetrika, handleAnalytics, analyticsEvents, playEvents]);
|
|
124
148
|
const onPause = useCallback(() => {
|
|
125
149
|
// For support correct state for youtube
|
|
126
150
|
setIsPlaying(false);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PixelEvent } from '../../models';
|
|
2
|
-
import {
|
|
2
|
+
import { AnalyticsEventV2 } from '../../models/common';
|
|
3
3
|
export declare const YANDEX_FORM_ORIGIN = "https://forms.yandex.ru";
|
|
4
4
|
export interface YandexFormProps {
|
|
5
5
|
id: number | string;
|
|
@@ -15,7 +15,7 @@ export interface YandexFormProps {
|
|
|
15
15
|
onLoad?: () => void;
|
|
16
16
|
metrikaGoals?: string | string[];
|
|
17
17
|
pixelEvents?: string | string[] | PixelEvent | PixelEvent[];
|
|
18
|
-
analyticsEvents?:
|
|
18
|
+
analyticsEvents?: AnalyticsEventV2 | AnalyticsEventV2[];
|
|
19
19
|
}
|
|
20
20
|
declare const YandexForm: (props: YandexFormProps) => JSX.Element;
|
|
21
21
|
export default YandexForm;
|
|
@@ -4,7 +4,7 @@ import { LocaleContext } from '../../context/localeContext';
|
|
|
4
4
|
import { MobileContext } from '../../context/mobileContext';
|
|
5
5
|
import { block } from '../../utils';
|
|
6
6
|
import { useMetrika } from '../../hooks/useMetrika';
|
|
7
|
-
import { useAnalytics } from '../..//hooks
|
|
7
|
+
import { useAnalytics } from '../..//hooks';
|
|
8
8
|
export const YANDEX_FORM_ORIGIN = 'https://forms.yandex.ru';
|
|
9
9
|
const CONTAINER_ID = 'pc-yandex-form-container';
|
|
10
10
|
const b = block('yandex-form');
|
|
@@ -55,7 +55,7 @@ const YandexForm = (props) => {
|
|
|
55
55
|
window.scrollBy(0, top - headerHeight);
|
|
56
56
|
}
|
|
57
57
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
58
|
-
handleAnalytics(analyticsEvents);
|
|
58
|
+
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
|
|
59
59
|
if (onSubmit) {
|
|
60
60
|
onSubmit();
|
|
61
61
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { AnalyticsEventV2 } from '../../models';
|
|
3
3
|
export interface AnalyticsContextProps {
|
|
4
|
-
sendEvents?: (e:
|
|
4
|
+
sendEvents?: (e: AnalyticsEventV2 | AnalyticsEventV2[]) => void;
|
|
5
5
|
}
|
|
6
6
|
export declare const AnalyticsContext: React.Context<AnalyticsContextProps>;
|
|
@@ -2,4 +2,5 @@ export { default as useFocus } from './useFocus';
|
|
|
2
2
|
export { default as useWindowBreakpoint } from './useWindowBreakpoint';
|
|
3
3
|
export { useIntersection } from './useIntersection';
|
|
4
4
|
export { default as useMount } from './useMount';
|
|
5
|
+
export * from './useAnalytics';
|
|
5
6
|
export * from './hubspot';
|
package/build/esm/hooks/index.js
CHANGED
|
@@ -2,4 +2,5 @@ export { default as useFocus } from './useFocus';
|
|
|
2
2
|
export { default as useWindowBreakpoint } from './useWindowBreakpoint';
|
|
3
3
|
export { useIntersection } from './useIntersection';
|
|
4
4
|
export { default as useMount } from './useMount';
|
|
5
|
+
export * from './useAnalytics';
|
|
5
6
|
export * from './hubspot';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const useAnalytics: () => (e?:
|
|
1
|
+
import { AnalyticsEventV2 } from '../models';
|
|
2
|
+
export declare const useAnalytics: () => ((e?: AnalyticsEventV2 | AnalyticsEventV2[]) => void) | undefined;
|
|
@@ -2,10 +2,13 @@ import { useContext } from 'react';
|
|
|
2
2
|
import { AnalyticsContext } from '../context/analyticsContext';
|
|
3
3
|
export const useAnalytics = () => {
|
|
4
4
|
const { sendEvents } = useContext(AnalyticsContext);
|
|
5
|
+
if (!sendEvents) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
5
8
|
return (e) => {
|
|
6
9
|
if (!e) {
|
|
7
10
|
return;
|
|
8
11
|
}
|
|
9
|
-
sendEvents
|
|
12
|
+
sendEvents(e);
|
|
10
13
|
};
|
|
11
14
|
};
|
|
@@ -66,17 +66,23 @@ export interface ClassNameProps {
|
|
|
66
66
|
export type Timeout = ReturnType<typeof setTimeout> | undefined;
|
|
67
67
|
export type AnalyticsParameter = {
|
|
68
68
|
key: string;
|
|
69
|
-
value: string;
|
|
69
|
+
value: string | number | boolean;
|
|
70
|
+
};
|
|
71
|
+
export type AnalyticsCounters = {
|
|
72
|
+
include?: string[];
|
|
73
|
+
exclude?: string[];
|
|
70
74
|
};
|
|
71
75
|
export type AnalyticsEvent = {
|
|
72
76
|
name: string;
|
|
73
77
|
type?: string;
|
|
74
|
-
counters?:
|
|
75
|
-
include?: string[];
|
|
76
|
-
exclude?: string[];
|
|
77
|
-
};
|
|
78
|
+
counters?: AnalyticsCounters;
|
|
78
79
|
category?: string;
|
|
79
80
|
label?: string;
|
|
80
81
|
params?: AnalyticsParameter[];
|
|
81
82
|
};
|
|
83
|
+
export type AnalyticsEventV2<T = {}> = T & {
|
|
84
|
+
name: string;
|
|
85
|
+
type?: string;
|
|
86
|
+
counters?: AnalyticsCounters;
|
|
87
|
+
};
|
|
82
88
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { ButtonSize, ButtonView } from '@gravity-ui/uikit';
|
|
3
3
|
import { ThemeSupporting } from '../../utils/theme';
|
|
4
|
-
import {
|
|
4
|
+
import { AnalyticsEventV2, ClassNameProps, PixelEventType } from '../common';
|
|
5
5
|
export declare enum AuthorType {
|
|
6
6
|
Column = "column",
|
|
7
7
|
Line = "line"
|
|
@@ -110,6 +110,7 @@ export interface MediaVideoProps {
|
|
|
110
110
|
playButton?: PlayButtonProps;
|
|
111
111
|
controls?: MediaVideoControlsType;
|
|
112
112
|
metrika?: MetrikaVideo;
|
|
113
|
+
analyticsEvents?: AnalyticsEventV2[];
|
|
113
114
|
}
|
|
114
115
|
export interface LinkProps extends Stylable {
|
|
115
116
|
url: string;
|
|
@@ -121,7 +122,7 @@ export interface LinkProps extends Stylable {
|
|
|
121
122
|
target?: string;
|
|
122
123
|
metrikaGoals?: MetrikaGoal;
|
|
123
124
|
pixelEvents?: ButtonPixel;
|
|
124
|
-
analyticsEvents?:
|
|
125
|
+
analyticsEvents?: AnalyticsEventV2 | AnalyticsEventV2[];
|
|
125
126
|
}
|
|
126
127
|
export interface FileLinkProps extends ClassNameProps {
|
|
127
128
|
href: string;
|
|
@@ -140,7 +141,7 @@ export interface ButtonProps {
|
|
|
140
141
|
img?: ButtonImageProps | string;
|
|
141
142
|
metrikaGoals?: MetrikaGoal;
|
|
142
143
|
pixelEvents?: ButtonPixel;
|
|
143
|
-
analyticsEvents?:
|
|
144
|
+
analyticsEvents?: AnalyticsEventV2[];
|
|
144
145
|
target?: string;
|
|
145
146
|
}
|
|
146
147
|
export interface ButtonImageProps {
|
|
@@ -169,6 +170,7 @@ export interface MediaComponentVideoProps {
|
|
|
169
170
|
video: MediaVideoProps;
|
|
170
171
|
height?: number;
|
|
171
172
|
metrika?: MetrikaVideo;
|
|
173
|
+
analyticsEvents?: AnalyticsEventV2[];
|
|
172
174
|
previewImg?: string;
|
|
173
175
|
}
|
|
174
176
|
export interface MediaComponentYoutubeProps {
|
|
@@ -224,7 +226,7 @@ export interface HeaderBreadCrumbsProps extends ClassNameProps {
|
|
|
224
226
|
theme?: TextTheme;
|
|
225
227
|
metrikaGoals?: MetrikaGoal;
|
|
226
228
|
pixelEvents?: ButtonPixel;
|
|
227
|
-
analyticsEvents?:
|
|
229
|
+
analyticsEvents?: AnalyticsEventV2 | AnalyticsEventV2[];
|
|
228
230
|
}
|
|
229
231
|
export interface PreviewContentItemProps {
|
|
230
232
|
title: string;
|
|
@@ -3,7 +3,7 @@ import { ThemeSupporting } from '../../utils';
|
|
|
3
3
|
import { HubspotEventData, HubspotEventHandlers } from '../../utils/hubspot';
|
|
4
4
|
import { AuthorItem, ButtonPixel, ButtonProps, CardBaseProps, ContentTheme, DividerSize, ImageObjectProps, ImageProps, LinkProps, MediaProps, PriceDetailedProps, TextTheme, Themable, ThemedImage } from './common';
|
|
5
5
|
import { ContentBlockProps } from './blocks';
|
|
6
|
-
import {
|
|
6
|
+
import { AnalyticsEventV2, PixelEvent } from '../common';
|
|
7
7
|
export declare enum SubBlockType {
|
|
8
8
|
Divider = "divider",
|
|
9
9
|
Quote = "quote",
|
|
@@ -61,7 +61,7 @@ export interface HubspotFormProps extends HubspotEventHandlers {
|
|
|
61
61
|
onLoad?: (arg: HubspotEventData) => void;
|
|
62
62
|
pixelEvents?: string | string[] | PixelEvent | PixelEvent[] | ButtonPixel;
|
|
63
63
|
hubspotEvents?: string[];
|
|
64
|
-
analyticsEvents?:
|
|
64
|
+
analyticsEvents?: AnalyticsEventV2 | AnalyticsEventV2[];
|
|
65
65
|
}
|
|
66
66
|
export interface PartnerProps extends CardBaseProps {
|
|
67
67
|
text: string;
|
|
@@ -11,7 +11,7 @@ export interface NavigationItemBase {
|
|
|
11
11
|
icon?: ImageProps;
|
|
12
12
|
url?: string;
|
|
13
13
|
}
|
|
14
|
-
export interface NavigationLinkItem extends NavigationItemBase {
|
|
14
|
+
export interface NavigationLinkItem extends Omit<NavigationItemBase, 'url'> {
|
|
15
15
|
type: NavigationItemType.Link;
|
|
16
16
|
url: string;
|
|
17
17
|
arrow?: boolean;
|
|
@@ -19,8 +19,6 @@ export interface NavigationLinkItem extends NavigationItemBase {
|
|
|
19
19
|
}
|
|
20
20
|
export interface NavigationButtonItem extends ButtonProps {
|
|
21
21
|
type: NavigationItemType.Button;
|
|
22
|
-
url: string;
|
|
23
|
-
target?: string;
|
|
24
22
|
}
|
|
25
23
|
export interface NavigationDropdownItem extends NavigationItemBase {
|
|
26
24
|
type: NavigationItemType.Dropdown;
|
|
@@ -18,25 +18,27 @@ unpredictable css rules order in build */
|
|
|
18
18
|
height: var(--header-height);
|
|
19
19
|
}
|
|
20
20
|
@media (min-width: 769px) {
|
|
21
|
-
.pc-header__mobile-menu-button {
|
|
21
|
+
.pc-header__mobile-menu-button.pc-header__mobile-menu-button {
|
|
22
22
|
display: none;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
+
|
|
25
26
|
.pc-header__navigation, .pc-header__left, .pc-header__right {
|
|
26
27
|
display: flex;
|
|
27
28
|
align-items: center;
|
|
28
29
|
}
|
|
29
|
-
.pc-header__navigation {
|
|
30
|
+
.pc-header__navigation.pc-header__navigation {
|
|
30
31
|
position: relative;
|
|
31
32
|
margin-right: 20px;
|
|
32
33
|
flex: 1 0 0;
|
|
33
34
|
justify-content: flex-start;
|
|
34
35
|
}
|
|
35
36
|
@media (max-width: 768px) {
|
|
36
|
-
.pc-header__navigation {
|
|
37
|
+
.pc-header__navigation.pc-header__navigation {
|
|
37
38
|
display: none;
|
|
38
39
|
}
|
|
39
40
|
}
|
|
41
|
+
|
|
40
42
|
.pc-header__right {
|
|
41
43
|
flex: 0;
|
|
42
44
|
justify-content: flex-end;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.pc-
|
|
1
|
+
.pc-logo__text {
|
|
2
2
|
margin: 0;
|
|
3
3
|
}
|
|
4
4
|
|
|
@@ -7,11 +7,6 @@ unpredictable css rules order in build */
|
|
|
7
7
|
.pc-logo {
|
|
8
8
|
display: flex;
|
|
9
9
|
align-items: center;
|
|
10
|
-
font-weight: var(--yc-text-accent-font-weight);
|
|
11
|
-
font-size: var(--yc-text-header-1-font-size);
|
|
12
|
-
line-height: var(--yc-text-header-1-line-height);
|
|
13
|
-
color: var(--pc-text-header-color);
|
|
14
|
-
font-weight: var(--yc-text-accent-font-weight);
|
|
15
10
|
}
|
|
16
11
|
.pc-logo__icon {
|
|
17
12
|
display: flex;
|
|
@@ -19,5 +14,9 @@ unpredictable css rules order in build */
|
|
|
19
14
|
object-fit: contain;
|
|
20
15
|
}
|
|
21
16
|
.pc-logo__text {
|
|
17
|
+
font-size: var(--yc-text-header-1-font-size);
|
|
18
|
+
line-height: var(--yc-text-header-1-line-height);
|
|
19
|
+
color: var(--pc-text-header-color);
|
|
20
|
+
font-weight: var(--yc-text-accent-font-weight);
|
|
22
21
|
white-space: nowrap;
|
|
23
22
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export declare const LogoProps: {
|
|
2
|
+
type: string;
|
|
3
|
+
additionalProperties: boolean;
|
|
4
|
+
required: string[];
|
|
5
|
+
properties: {
|
|
6
|
+
icon: {
|
|
7
|
+
oneOf: ({
|
|
8
|
+
type: string;
|
|
9
|
+
properties: {
|
|
10
|
+
when: {
|
|
11
|
+
type: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
} | {
|
|
15
|
+
type: string;
|
|
16
|
+
pattern: string;
|
|
17
|
+
})[];
|
|
18
|
+
};
|
|
19
|
+
text: {
|
|
20
|
+
type: string;
|
|
21
|
+
contentType: string;
|
|
22
|
+
};
|
|
23
|
+
url: {
|
|
24
|
+
type: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export declare const NavigationHeaderProps: {
|
|
29
|
+
type: string;
|
|
30
|
+
additionalProperties: boolean;
|
|
31
|
+
required: string[];
|
|
32
|
+
properties: {
|
|
33
|
+
leftItems: {
|
|
34
|
+
oneOf: {
|
|
35
|
+
type: string;
|
|
36
|
+
items: {
|
|
37
|
+
type: string;
|
|
38
|
+
properties: {
|
|
39
|
+
when: {
|
|
40
|
+
type: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
}[];
|
|
45
|
+
};
|
|
46
|
+
rightItems: {
|
|
47
|
+
oneOf: {
|
|
48
|
+
type: string;
|
|
49
|
+
items: {
|
|
50
|
+
type: string;
|
|
51
|
+
properties: {
|
|
52
|
+
when: {
|
|
53
|
+
type: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
}[];
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { ButtonProps } from '../schema/validators/common';
|
|
2
|
+
import { ImageProps, urlPattern } from '../components/Image/schema';
|
|
3
|
+
import { omit } from 'lodash';
|
|
4
|
+
import { filteredArray } from '../schema/validators/utils';
|
|
5
|
+
const NavigationItemType = {
|
|
6
|
+
type: 'string',
|
|
7
|
+
enum: ['link', 'button', 'dropdown'],
|
|
8
|
+
};
|
|
9
|
+
export const LogoProps = {
|
|
10
|
+
type: 'object',
|
|
11
|
+
additionalProperties: false,
|
|
12
|
+
required: ['icon'],
|
|
13
|
+
properties: {
|
|
14
|
+
icon: ImageProps,
|
|
15
|
+
text: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
contentType: 'text',
|
|
18
|
+
},
|
|
19
|
+
url: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
const NavigationItemBaseProps = {
|
|
25
|
+
text: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
contentType: 'text',
|
|
28
|
+
},
|
|
29
|
+
url: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
},
|
|
32
|
+
icon: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
pattern: urlPattern,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
const NavigationItemBaseLinkProps = omit(NavigationItemBaseProps, ['url']);
|
|
38
|
+
const NavigationLinkItemProps = {
|
|
39
|
+
type: 'object',
|
|
40
|
+
additionalProperties: false,
|
|
41
|
+
required: ['type', 'text'],
|
|
42
|
+
properties: Object.assign(Object.assign({}, NavigationItemBaseLinkProps), { type: Object.assign({}, NavigationItemType), url: {
|
|
43
|
+
type: 'string',
|
|
44
|
+
}, target: {
|
|
45
|
+
type: 'string',
|
|
46
|
+
}, arrow: {
|
|
47
|
+
type: 'boolean',
|
|
48
|
+
} }),
|
|
49
|
+
};
|
|
50
|
+
const NavigationButtonItemProps = {
|
|
51
|
+
type: 'object',
|
|
52
|
+
additionalProperties: false,
|
|
53
|
+
required: ['type', 'text', 'url'],
|
|
54
|
+
properties: Object.assign(Object.assign({}, ButtonProps), { type: Object.assign({}, NavigationItemType) }),
|
|
55
|
+
};
|
|
56
|
+
const NavigationDropdownItemProps = {
|
|
57
|
+
type: 'object',
|
|
58
|
+
additionalProperties: false,
|
|
59
|
+
required: ['type', 'items'],
|
|
60
|
+
properties: Object.assign(Object.assign({}, NavigationItemBaseProps), { type: Object.assign({}, NavigationItemType), items: filteredArray(NavigationLinkItemProps) }),
|
|
61
|
+
};
|
|
62
|
+
const NavigationItemProps = {
|
|
63
|
+
oneOf: [
|
|
64
|
+
filteredArray(NavigationLinkItemProps),
|
|
65
|
+
filteredArray(NavigationButtonItemProps),
|
|
66
|
+
filteredArray(NavigationDropdownItemProps),
|
|
67
|
+
],
|
|
68
|
+
};
|
|
69
|
+
export const NavigationHeaderProps = {
|
|
70
|
+
type: 'object',
|
|
71
|
+
additionalProperties: false,
|
|
72
|
+
required: ['leftItems'],
|
|
73
|
+
properties: {
|
|
74
|
+
leftItems: NavigationItemProps,
|
|
75
|
+
rightItems: NavigationItemProps,
|
|
76
|
+
},
|
|
77
|
+
};
|
|
@@ -31,6 +31,73 @@ export declare function generateDefaultSchema(config?: SchemaCustomConfig): {
|
|
|
31
31
|
additionalProperties: boolean;
|
|
32
32
|
required: string[];
|
|
33
33
|
properties: {
|
|
34
|
+
logo: {
|
|
35
|
+
oneOf: ({
|
|
36
|
+
type: string;
|
|
37
|
+
additionalProperties: boolean;
|
|
38
|
+
required: string[];
|
|
39
|
+
properties: {
|
|
40
|
+
icon: {
|
|
41
|
+
oneOf: ({
|
|
42
|
+
type: string;
|
|
43
|
+
properties: {
|
|
44
|
+
when: {
|
|
45
|
+
type: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
} | {
|
|
49
|
+
type: string;
|
|
50
|
+
pattern: string;
|
|
51
|
+
})[];
|
|
52
|
+
};
|
|
53
|
+
text: {
|
|
54
|
+
type: string;
|
|
55
|
+
contentType: string;
|
|
56
|
+
};
|
|
57
|
+
url: {
|
|
58
|
+
type: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
} | {
|
|
62
|
+
type: string;
|
|
63
|
+
additionalProperties: boolean;
|
|
64
|
+
required: import("..").Theme[];
|
|
65
|
+
properties: {};
|
|
66
|
+
})[];
|
|
67
|
+
};
|
|
68
|
+
header: {
|
|
69
|
+
type: string;
|
|
70
|
+
additionalProperties: boolean;
|
|
71
|
+
required: string[];
|
|
72
|
+
properties: {
|
|
73
|
+
leftItems: {
|
|
74
|
+
oneOf: {
|
|
75
|
+
type: string;
|
|
76
|
+
items: {
|
|
77
|
+
type: string;
|
|
78
|
+
properties: {
|
|
79
|
+
when: {
|
|
80
|
+
type: string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
}[];
|
|
85
|
+
};
|
|
86
|
+
rightItems: {
|
|
87
|
+
oneOf: {
|
|
88
|
+
type: string;
|
|
89
|
+
items: {
|
|
90
|
+
type: string;
|
|
91
|
+
properties: {
|
|
92
|
+
when: {
|
|
93
|
+
type: string;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
}[];
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
};
|
|
34
101
|
blocks: {
|
|
35
102
|
type: string;
|
|
36
103
|
items: {
|
|
@@ -3,6 +3,7 @@ import { TabsBlock, BannerCard, SliderBlock, ExtendedFeaturesBlock, HeaderBlock,
|
|
|
3
3
|
import { PartnerBlock, MediaCardBlock, TutorialCard, BackgroundCard, NewsCard, CardWithImage, PriceDetailedBlock, Quote, Divider, BasicCard, } from './validators/sub-blocks';
|
|
4
4
|
import { AnimatableProps, BackgroundProps, MenuProps, withTheme } from './validators/common';
|
|
5
5
|
import { filteredItem } from './validators/utils';
|
|
6
|
+
import { LogoProps, NavigationHeaderProps } from './validators/navigation';
|
|
6
7
|
export const getBlocksCases = (blocks) => {
|
|
7
8
|
return Object.values(blocks).reduce((acc, block) => (Object.assign(Object.assign({}, acc), block)));
|
|
8
9
|
};
|
|
@@ -83,7 +84,7 @@ export function generateDefaultSchema(config) {
|
|
|
83
84
|
type: 'object',
|
|
84
85
|
additionalProperties: false,
|
|
85
86
|
required: ['blocks'],
|
|
86
|
-
properties: Object.assign(Object.assign(Object.assign({}, AnimatableProps), { blocks: {
|
|
87
|
+
properties: Object.assign(Object.assign(Object.assign({}, AnimatableProps), { logo: withTheme(LogoProps), header: NavigationHeaderProps, blocks: {
|
|
87
88
|
type: 'array',
|
|
88
89
|
items: {
|
|
89
90
|
$ref: '#/definitions/children',
|