@gravity-ui/page-constructor 1.15.0-alpha.22 → 1.15.0-alpha.23
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 +88 -0
- package/README.md +3 -15
- package/build/cjs/blocks/Slider/Arrow/Arrow.js +2 -2
- package/build/cjs/blocks/Slider/Slider.css +0 -4
- package/build/cjs/components/Foldable/Foldable.css +4 -1
- package/build/cjs/components/Foldable/Foldable.js +7 -10
- package/build/cjs/components/FullscreenImage/FullscreenImage.js +8 -6
- package/build/cjs/components/FullscreenMedia/FullScreenMedia.css +70 -0
- package/build/cjs/components/FullscreenMedia/FullScreenMedia.d.ts +9 -0
- package/build/cjs/components/FullscreenMedia/FullScreenMedia.js +40 -0
- package/build/cjs/components/HeightCalculator/HeightCalculator.d.ts +4 -0
- package/build/cjs/components/HeightCalculator/HeightCalculator.js +4 -0
- package/build/cjs/components/Media/Media.js +3 -2
- package/build/cjs/components/MetaInfo/MetaInfo.css +13 -0
- package/build/cjs/components/MetaInfo/MetaInfo.d.ts +6 -0
- package/build/cjs/components/MetaInfo/MetaInfo.js +8 -0
- package/build/cjs/components/MetaInfo/schema.d.ts +8 -0
- package/build/cjs/components/MetaInfo/schema.js +10 -0
- package/build/cjs/components/VideoBlock/VideoBlock.d.ts +1 -0
- package/build/cjs/components/VideoBlock/VideoBlock.js +6 -10
- package/build/cjs/components/index.d.ts +2 -0
- package/build/cjs/components/index.js +5 -1
- package/build/cjs/constructor-items.d.ts +4 -0
- package/build/cjs/constructor-items.js +4 -0
- package/build/cjs/containers/PageConstructor/PageConstructor.css +1 -0
- package/build/cjs/hooks/useHeightCalculator.d.ts +6 -0
- package/build/cjs/hooks/useHeightCalculator.js +27 -0
- package/build/cjs/models/constructor-items/common.d.ts +1 -17
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +15 -0
- package/build/cjs/models/constructor-items/sub-blocks.js +4 -0
- package/build/cjs/schema/index.js +1 -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/BannerCard/BannerCard.js +2 -1
- package/build/cjs/sub-blocks/HubspotForm/HubspotForm.css +14 -9
- package/build/cjs/sub-blocks/HubspotForm/HubspotFormContainer.d.ts +1 -1
- package/build/cjs/sub-blocks/HubspotForm/HubspotFormContainer.js +26 -8
- package/build/cjs/sub-blocks/HubspotForm/index.js +4 -2
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.css +16 -0
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.d.ts +3 -0
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js +21 -0
- package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +218 -0
- package/build/cjs/sub-blocks/LayoutItem/schema.js +18 -0
- package/build/cjs/sub-blocks/LayoutItem/utils.d.ts +29 -0
- package/build/cjs/sub-blocks/LayoutItem/utils.js +12 -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/blocks.js +17 -0
- package/build/cjs/utils/hubspot.d.ts +2 -1
- package/build/cjs/utils/hubspot.js +5 -1
- package/build/esm/blocks/Slider/Arrow/Arrow.js +2 -2
- package/build/esm/blocks/Slider/Slider.css +0 -4
- package/build/esm/components/Foldable/Foldable.css +4 -1
- package/build/esm/components/Foldable/Foldable.js +8 -11
- package/build/esm/components/FullscreenImage/FullscreenImage.js +9 -7
- package/build/esm/components/FullscreenMedia/FullScreenMedia.css +70 -0
- package/build/esm/components/FullscreenMedia/FullScreenMedia.d.ts +10 -0
- package/build/esm/components/FullscreenMedia/FullScreenMedia.js +38 -0
- package/build/esm/components/HeightCalculator/HeightCalculator.d.ts +4 -0
- package/build/esm/components/HeightCalculator/HeightCalculator.js +4 -0
- package/build/esm/components/Media/Media.js +3 -2
- package/build/esm/components/MetaInfo/MetaInfo.css +13 -0
- package/build/esm/components/MetaInfo/MetaInfo.d.ts +7 -0
- package/build/esm/components/MetaInfo/MetaInfo.js +6 -0
- package/build/esm/components/MetaInfo/schema.d.ts +8 -0
- package/build/esm/components/MetaInfo/schema.js +8 -0
- package/build/esm/components/VideoBlock/VideoBlock.d.ts +1 -0
- package/build/esm/components/VideoBlock/VideoBlock.js +6 -10
- package/build/esm/components/index.d.ts +2 -0
- package/build/esm/components/index.js +2 -0
- package/build/esm/constructor-items.d.ts +4 -0
- package/build/esm/constructor-items.js +5 -1
- package/build/esm/containers/PageConstructor/PageConstructor.css +1 -0
- package/build/esm/hooks/useHeightCalculator.d.ts +6 -0
- package/build/esm/hooks/useHeightCalculator.js +24 -0
- package/build/esm/models/constructor-items/common.d.ts +1 -17
- package/build/esm/models/constructor-items/sub-blocks.d.ts +15 -0
- package/build/esm/models/constructor-items/sub-blocks.js +4 -0
- package/build/esm/schema/index.js +1 -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/BannerCard/BannerCard.js +3 -2
- package/build/esm/sub-blocks/HubspotForm/HubspotForm.css +14 -9
- package/build/esm/sub-blocks/HubspotForm/HubspotFormContainer.d.ts +1 -1
- package/build/esm/sub-blocks/HubspotForm/HubspotFormContainer.js +26 -8
- package/build/esm/sub-blocks/HubspotForm/index.js +4 -2
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.css +16 -0
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.d.ts +4 -0
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.js +20 -0
- package/build/esm/sub-blocks/LayoutItem/schema.d.ts +218 -0
- package/build/esm/sub-blocks/LayoutItem/schema.js +14 -0
- package/build/esm/sub-blocks/LayoutItem/utils.d.ts +29 -0
- package/build/esm/sub-blocks/LayoutItem/utils.js +6 -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/blocks.js +17 -0
- package/build/esm/utils/hubspot.d.ts +2 -1
- package/build/esm/utils/hubspot.js +5 -1
- package/package.json +5 -2
- package/server/models/constructor-items/common.d.ts +1 -17
- package/server/models/constructor-items/sub-blocks.d.ts +15 -0
- package/server/models/constructor-items/sub-blocks.js +4 -0
- package/server/text-transform/blocks.js +17 -0
- package/server/utils/hubspot.d.ts +2 -1
- package/server/utils/hubspot.js +5 -1
- package/styles/root.scss +1 -0
|
@@ -6,6 +6,7 @@ export * from '../../sub-blocks/NewsCard/schema';
|
|
|
6
6
|
export * from '../../sub-blocks/Partner/schema';
|
|
7
7
|
export * from '../../sub-blocks/TutorialCard/schema';
|
|
8
8
|
export * from '../../sub-blocks/CardWithImage/schema';
|
|
9
|
+
export * from '../../sub-blocks/LayoutItem/schema';
|
|
9
10
|
export * from '../../sub-blocks/Quote/schema';
|
|
10
11
|
export * from '../../sub-blocks/Divider/schema';
|
|
11
12
|
export * from '../../sub-blocks/BasicCard/schema';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import { block, getThemedValue } from '../../utils';
|
|
3
|
-
import { Button, YFMWrapper, BackgroundImage, HTML } from '../../components';
|
|
3
|
+
import { Button, YFMWrapper, BackgroundImage, HTML, RouterLink } from '../../components';
|
|
4
4
|
import { ThemeValueContext } from '../../context/theme/ThemeValueContext';
|
|
5
5
|
import './BannerCard.css';
|
|
6
6
|
const b = block('banner-card');
|
|
@@ -18,7 +18,8 @@ export const BannerCard = (props) => {
|
|
|
18
18
|
React.createElement("h2", { className: b('title') },
|
|
19
19
|
React.createElement(HTML, null, title)),
|
|
20
20
|
subtitle && (React.createElement(YFMWrapper, { className: b('subtitle'), content: subtitle, modifiers: { constructor: true } }))),
|
|
21
|
-
React.createElement(
|
|
21
|
+
React.createElement(RouterLink, { href: url },
|
|
22
|
+
React.createElement(Button, { className: b('button'), theme: "raised", size: "xl", text: text, url: url, target: target }))),
|
|
22
23
|
React.createElement(BackgroundImage, { className: b('image'), src: getThemedValue(image, theme), disableCompress: disableCompress }))));
|
|
23
24
|
};
|
|
24
25
|
export default BannerCard;
|
|
@@ -46,7 +46,7 @@ unpredictable css rules order in build */
|
|
|
46
46
|
color: var(--yc-color-text-primary);
|
|
47
47
|
background-color: transparent;
|
|
48
48
|
border: 1px solid var(--yc-color-line-generic);
|
|
49
|
-
border-radius:
|
|
49
|
+
border-radius: var(--yc-border-radius-l);
|
|
50
50
|
}
|
|
51
51
|
.pc-hubspot-form .hs-form-field .input input[type=text]:hover,
|
|
52
52
|
.pc-hubspot-form .hs-form-field .input input[type=number]:hover,
|
|
@@ -126,9 +126,9 @@ unpredictable css rules order in build */
|
|
|
126
126
|
opacity: 0;
|
|
127
127
|
flex-shrink: 0;
|
|
128
128
|
}
|
|
129
|
-
.pc-hubspot-form .hs-form-field .hs-form-checkbox-display span,
|
|
130
|
-
.pc-hubspot-form .hs-form-field .hs-form-booleancheckbox-display span,
|
|
131
|
-
.pc-hubspot-form .hs-form-field .hs-form-radio-display span {
|
|
129
|
+
.pc-hubspot-form .hs-form-field .hs-form-checkbox-display span:not(.hs-form-required),
|
|
130
|
+
.pc-hubspot-form .hs-form-field .hs-form-booleancheckbox-display span:not(.hs-form-required),
|
|
131
|
+
.pc-hubspot-form .hs-form-field .hs-form-radio-display span:not(.hs-form-required) {
|
|
132
132
|
color: var(--yc-color-text-primary);
|
|
133
133
|
font-size: var(--yc-text-body-2-font-size);
|
|
134
134
|
line-height: 16px;
|
|
@@ -136,12 +136,17 @@ unpredictable css rules order in build */
|
|
|
136
136
|
margin: 0;
|
|
137
137
|
flex-grow: 1;
|
|
138
138
|
}
|
|
139
|
+
.pc-hubspot-form .hs-form-field .hs-form-checkbox-display .hs-form-required,
|
|
140
|
+
.pc-hubspot-form .hs-form-field .hs-form-booleancheckbox-display .hs-form-required,
|
|
141
|
+
.pc-hubspot-form .hs-form-field .hs-form-radio-display .hs-form-required {
|
|
142
|
+
top: 0;
|
|
143
|
+
}
|
|
139
144
|
.pc-hubspot-form .hs-form-field .hs-form-booleancheckbox-display,
|
|
140
145
|
.pc-hubspot-form .hs-form-field .hs-form-checkbox-display {
|
|
141
146
|
position: relative;
|
|
142
147
|
}
|
|
143
|
-
.pc-hubspot-form .hs-form-field .hs-form-booleancheckbox-display span:before,
|
|
144
|
-
.pc-hubspot-form .hs-form-field .hs-form-checkbox-display span:before {
|
|
148
|
+
.pc-hubspot-form .hs-form-field .hs-form-booleancheckbox-display span:not(.hs-form-required):before,
|
|
149
|
+
.pc-hubspot-form .hs-form-field .hs-form-checkbox-display span:not(.hs-form-required):before {
|
|
145
150
|
content: "";
|
|
146
151
|
position: absolute;
|
|
147
152
|
top: 0;
|
|
@@ -153,8 +158,8 @@ unpredictable css rules order in build */
|
|
|
153
158
|
border: 1px solid var(--yc-color-line-generic-accent);
|
|
154
159
|
transition: background-color 0.1s linear;
|
|
155
160
|
}
|
|
156
|
-
.pc-hubspot-form .hs-form-field .hs-form-booleancheckbox-display span:after,
|
|
157
|
-
.pc-hubspot-form .hs-form-field .hs-form-checkbox-display span:after {
|
|
161
|
+
.pc-hubspot-form .hs-form-field .hs-form-booleancheckbox-display span:not(.hs-form-required):after,
|
|
162
|
+
.pc-hubspot-form .hs-form-field .hs-form-checkbox-display span:not(.hs-form-required):after {
|
|
158
163
|
content: "";
|
|
159
164
|
position: absolute;
|
|
160
165
|
top: -10px;
|
|
@@ -276,7 +281,7 @@ unpredictable css rules order in build */
|
|
|
276
281
|
box-sizing: border-box;
|
|
277
282
|
height: 44px;
|
|
278
283
|
padding: 0 20px;
|
|
279
|
-
border-radius:
|
|
284
|
+
border-radius: var(--yc-border-radius-xl);
|
|
280
285
|
background-color: var(--yc-color-base-special);
|
|
281
286
|
color: var(--yc-my-color-brand-text-contrast);
|
|
282
287
|
line-height: 44px;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HubspotFormProps } from '../../models';
|
|
2
|
-
type HubspotFormContainerPropsKeys = 'className' | 'formId' | 'formInstanceId' | 'portalId' | 'region' | 'formClassName';
|
|
2
|
+
type HubspotFormContainerPropsKeys = 'className' | 'formId' | 'formInstanceId' | 'portalId' | 'region' | 'formClassName' | 'createDOMElement';
|
|
3
3
|
type HubspotFormContainerProps = Pick<HubspotFormProps, HubspotFormContainerPropsKeys>;
|
|
4
4
|
declare const HubspotFormContainer: (props: HubspotFormContainerProps) => JSX.Element;
|
|
5
5
|
export default HubspotFormContainer;
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
2
|
import loadHubspotScript from './loadHubspotScript';
|
|
3
3
|
import { useMount } from '../../hooks';
|
|
4
4
|
const HubspotFormContainer = (props) => {
|
|
5
|
-
const { className, formId, formInstanceId, portalId, region, formClassName, } = props;
|
|
5
|
+
const { className, formId, formInstanceId, portalId, region, formClassName, createDOMElement, } = props;
|
|
6
|
+
const containerRef = useRef(null);
|
|
7
|
+
const hsContainerRef = useRef();
|
|
6
8
|
const containerId = formInstanceId
|
|
7
9
|
? `hubspot-form-${formId}-${formInstanceId}`
|
|
8
10
|
: `hubspot-form-${formId}`;
|
|
9
|
-
|
|
10
|
-
(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const createForm = () => {
|
|
12
|
+
if (containerRef.current && !hsContainerRef.current && createDOMElement) {
|
|
13
|
+
hsContainerRef.current = document.createElement('div');
|
|
14
|
+
containerRef.current.id = '';
|
|
15
|
+
hsContainerRef.current.id = containerId;
|
|
16
|
+
containerRef.current.appendChild(hsContainerRef.current);
|
|
17
|
+
}
|
|
18
|
+
if (!createDOMElement || hsContainerRef.current) {
|
|
14
19
|
if (window.hbspt) {
|
|
15
20
|
window.hbspt.forms.create({
|
|
16
21
|
region,
|
|
@@ -21,8 +26,21 @@ const HubspotFormContainer = (props) => {
|
|
|
21
26
|
formInstanceId,
|
|
22
27
|
});
|
|
23
28
|
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
useMount(() => {
|
|
32
|
+
(async () => {
|
|
33
|
+
if (!window.hbspt) {
|
|
34
|
+
await loadHubspotScript();
|
|
35
|
+
}
|
|
36
|
+
createForm();
|
|
24
37
|
})();
|
|
38
|
+
return () => {
|
|
39
|
+
if (createDOMElement && containerRef.current && containerRef.current.lastChild) {
|
|
40
|
+
containerRef.current.removeChild(containerRef.current.lastChild);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
25
43
|
});
|
|
26
|
-
return React.createElement("div", { className: className, id: containerId });
|
|
44
|
+
return React.createElement("div", { className: className, id: containerId, ref: containerRef });
|
|
27
45
|
};
|
|
28
46
|
export default HubspotFormContainer;
|
|
@@ -12,7 +12,7 @@ const b = block('hubspot-form');
|
|
|
12
12
|
const HubspotForm = (props) => {
|
|
13
13
|
const { className, theme: themeProp, isMobile: isMobileProp, formId, formInstanceId, portalId, region, formClassName, pixelEvents,
|
|
14
14
|
// hubspotEvents, // TODO: decide how to handle them
|
|
15
|
-
analyticsEvents, onBeforeSubmit, onSubmit, onBeforeLoad, onLoad, } = props;
|
|
15
|
+
analyticsEvents, onBeforeSubmit, onSubmit, onBeforeLoad, onLoad, createDOMElement, onSubmitError, } = props;
|
|
16
16
|
const handleMetrika = useMetrika();
|
|
17
17
|
const context = useContext(BlockPositionContext);
|
|
18
18
|
const defaultEvent = useMemo(() => ({
|
|
@@ -29,6 +29,7 @@ const HubspotForm = (props) => {
|
|
|
29
29
|
onBeforeLoad,
|
|
30
30
|
onBeforeSubmit,
|
|
31
31
|
onLoad,
|
|
32
|
+
onSubmitError,
|
|
32
33
|
onSubmit: (e) => {
|
|
33
34
|
handleMetrika === null || handleMetrika === void 0 ? void 0 : handleMetrika({ pixelEvents });
|
|
34
35
|
handleAnalytics(analyticsEvents);
|
|
@@ -43,8 +44,9 @@ const HubspotForm = (props) => {
|
|
|
43
44
|
handleAnalytics,
|
|
44
45
|
analyticsEvents,
|
|
45
46
|
onSubmit,
|
|
47
|
+
onSubmitError,
|
|
46
48
|
]);
|
|
47
49
|
useHandleHubspotEvents(handlers, formId);
|
|
48
|
-
return (React.createElement(HubspotFormContainer, { key: [formClassName, formId, formInstanceId, portalId, region].join(), className: b({ theme, mobile }, className), formClassName: formClassName, formId: formId, portalId: portalId, formInstanceId: formInstanceId, region: region }));
|
|
50
|
+
return (React.createElement(HubspotFormContainer, { createDOMElement: createDOMElement, key: [formClassName, formId, formInstanceId, portalId, region].join(), className: b({ theme, mobile }, className), formClassName: formClassName, formId: formId, portalId: portalId, formInstanceId: formInstanceId, region: region }));
|
|
49
51
|
};
|
|
50
52
|
export default HubspotForm;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
.pc-layout-item__media {
|
|
4
|
+
width: 100%;
|
|
5
|
+
display: block;
|
|
6
|
+
border-radius: var(--pc-border-radius);
|
|
7
|
+
}
|
|
8
|
+
.pc-layout-item__media_border {
|
|
9
|
+
border: 1px solid var(--yc-color-line-generic);
|
|
10
|
+
}
|
|
11
|
+
.pc-layout-item__meta-info {
|
|
12
|
+
margin: 16px 0 -8px 0;
|
|
13
|
+
}
|
|
14
|
+
.pc-layout-item__content {
|
|
15
|
+
margin: 16px 16px 0 0;
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { block } from '../../utils';
|
|
4
|
+
import { FullScreenMedia, Media, MetaInfo } from '../../components';
|
|
5
|
+
import { getLayoutItemLinks, hasFullScreen, showFullScreenIcon } from './utils';
|
|
6
|
+
import { Content } from '..';
|
|
7
|
+
import './LayoutItem.css';
|
|
8
|
+
const b = block('layout-item');
|
|
9
|
+
const LayoutItem = (_a) => {
|
|
10
|
+
var _b = _a.content, { links } = _b, content = __rest(_b, ["links"]), { metaInfo, media, border, fullScreen, className } = _a;
|
|
11
|
+
return (React.createElement("div", { className: b(null, className) },
|
|
12
|
+
fullScreen && hasFullScreen(media) ? (React.createElement(FullScreenMedia, { showFullScreenIcon: showFullScreenIcon(media) }, (_a = {}) => {
|
|
13
|
+
var { className: mediaClassName } = _a, fullScreenMediaProps = __rest(_a, ["className"]);
|
|
14
|
+
return (React.createElement(Media, Object.assign({}, media, fullScreenMediaProps, { className: b('media', { border }, mediaClassName) })));
|
|
15
|
+
})) : (React.createElement(Media, Object.assign({}, media, { className: b('media', { border }) }))),
|
|
16
|
+
metaInfo && React.createElement(MetaInfo, { items: metaInfo, className: b('meta-info') }),
|
|
17
|
+
React.createElement("div", { className: b('content') },
|
|
18
|
+
React.createElement(Content, Object.assign({}, content, { links: getLayoutItemLinks(links), size: "s", colSizes: { all: 12, md: 12 } })))));
|
|
19
|
+
};
|
|
20
|
+
export default LayoutItem;
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
export declare const LayoutItem: {
|
|
2
|
+
type: string;
|
|
3
|
+
additionalProperties: boolean;
|
|
4
|
+
required: string[];
|
|
5
|
+
properties: {
|
|
6
|
+
media: {
|
|
7
|
+
color: {
|
|
8
|
+
type: string;
|
|
9
|
+
};
|
|
10
|
+
image: {
|
|
11
|
+
anyOf: ({
|
|
12
|
+
oneOf: ({
|
|
13
|
+
type: string;
|
|
14
|
+
properties: {
|
|
15
|
+
when: {
|
|
16
|
+
type: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
} | {
|
|
20
|
+
type: string;
|
|
21
|
+
pattern: string;
|
|
22
|
+
})[];
|
|
23
|
+
} | {
|
|
24
|
+
type: string;
|
|
25
|
+
items: {
|
|
26
|
+
oneOf: ({
|
|
27
|
+
type: string;
|
|
28
|
+
properties: {
|
|
29
|
+
when: {
|
|
30
|
+
type: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
} | {
|
|
34
|
+
type: string;
|
|
35
|
+
pattern: string;
|
|
36
|
+
})[];
|
|
37
|
+
};
|
|
38
|
+
})[];
|
|
39
|
+
};
|
|
40
|
+
video: {
|
|
41
|
+
type: string;
|
|
42
|
+
additionalProperties: boolean;
|
|
43
|
+
required: string[];
|
|
44
|
+
properties: {
|
|
45
|
+
src: {
|
|
46
|
+
type: string;
|
|
47
|
+
items: {
|
|
48
|
+
type: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
loop: {
|
|
52
|
+
anyOf: ({
|
|
53
|
+
type: string;
|
|
54
|
+
additionalProperties: boolean;
|
|
55
|
+
required: string[];
|
|
56
|
+
properties: {
|
|
57
|
+
start: {
|
|
58
|
+
type: string;
|
|
59
|
+
};
|
|
60
|
+
end: {
|
|
61
|
+
type: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
} | {
|
|
65
|
+
type: string;
|
|
66
|
+
})[];
|
|
67
|
+
};
|
|
68
|
+
type: {
|
|
69
|
+
type: string;
|
|
70
|
+
enum: string[];
|
|
71
|
+
};
|
|
72
|
+
muted: {
|
|
73
|
+
type: string;
|
|
74
|
+
};
|
|
75
|
+
playing: {
|
|
76
|
+
type: string;
|
|
77
|
+
};
|
|
78
|
+
elapsedTime: {
|
|
79
|
+
type: string;
|
|
80
|
+
};
|
|
81
|
+
playIcon: {
|
|
82
|
+
type: string;
|
|
83
|
+
additionalProperties: boolean;
|
|
84
|
+
properties: {
|
|
85
|
+
type: {
|
|
86
|
+
type: string;
|
|
87
|
+
enum: string[];
|
|
88
|
+
};
|
|
89
|
+
theme: {
|
|
90
|
+
type: string;
|
|
91
|
+
enum: string[];
|
|
92
|
+
};
|
|
93
|
+
text: {
|
|
94
|
+
type: string;
|
|
95
|
+
contentType: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
controls: {
|
|
100
|
+
type: string;
|
|
101
|
+
enum: string[];
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
youtube: {
|
|
106
|
+
type: string;
|
|
107
|
+
};
|
|
108
|
+
parallax: {
|
|
109
|
+
type: string;
|
|
110
|
+
};
|
|
111
|
+
height: {
|
|
112
|
+
type: string;
|
|
113
|
+
};
|
|
114
|
+
previewImg: {
|
|
115
|
+
type: string;
|
|
116
|
+
};
|
|
117
|
+
dataLens: {
|
|
118
|
+
oneOf: ({
|
|
119
|
+
type: string;
|
|
120
|
+
additionalProperties: boolean;
|
|
121
|
+
required: string[];
|
|
122
|
+
properties: {
|
|
123
|
+
id: {
|
|
124
|
+
type: string;
|
|
125
|
+
};
|
|
126
|
+
theme: {
|
|
127
|
+
type: string;
|
|
128
|
+
enum: string[];
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
} | {
|
|
132
|
+
type: string;
|
|
133
|
+
})[];
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
content: Partial<{
|
|
137
|
+
title: {
|
|
138
|
+
oneOf: ({
|
|
139
|
+
type: string;
|
|
140
|
+
additionalProperties: boolean;
|
|
141
|
+
required: string[];
|
|
142
|
+
properties: {
|
|
143
|
+
text: {
|
|
144
|
+
type: string;
|
|
145
|
+
contentType: string;
|
|
146
|
+
};
|
|
147
|
+
textSize: {
|
|
148
|
+
type: string;
|
|
149
|
+
enum: string[];
|
|
150
|
+
};
|
|
151
|
+
url: {
|
|
152
|
+
type: string;
|
|
153
|
+
};
|
|
154
|
+
resetMargin: {
|
|
155
|
+
type: string;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
} | {
|
|
159
|
+
type: string;
|
|
160
|
+
contentType: string;
|
|
161
|
+
})[];
|
|
162
|
+
};
|
|
163
|
+
text: {
|
|
164
|
+
type: string;
|
|
165
|
+
contentType: string;
|
|
166
|
+
};
|
|
167
|
+
additionalInfo: {
|
|
168
|
+
type: string;
|
|
169
|
+
contentType: string;
|
|
170
|
+
};
|
|
171
|
+
size: {
|
|
172
|
+
type: string;
|
|
173
|
+
enum: string[];
|
|
174
|
+
};
|
|
175
|
+
links: {
|
|
176
|
+
type: string;
|
|
177
|
+
items: {
|
|
178
|
+
type: string;
|
|
179
|
+
properties: {
|
|
180
|
+
when: {
|
|
181
|
+
type: string;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
buttons: {
|
|
187
|
+
type: string;
|
|
188
|
+
items: {
|
|
189
|
+
type: string;
|
|
190
|
+
properties: {
|
|
191
|
+
when: {
|
|
192
|
+
type: string;
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
theme: {
|
|
198
|
+
type: string;
|
|
199
|
+
enum: string[];
|
|
200
|
+
};
|
|
201
|
+
}>;
|
|
202
|
+
metaInfo: {
|
|
203
|
+
type: string;
|
|
204
|
+
items: {
|
|
205
|
+
type: string;
|
|
206
|
+
contentType: string;
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
border: {
|
|
210
|
+
type: string;
|
|
211
|
+
};
|
|
212
|
+
fullScreen: {
|
|
213
|
+
type: string;
|
|
214
|
+
};
|
|
215
|
+
type: {};
|
|
216
|
+
when: {};
|
|
217
|
+
};
|
|
218
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { omit } from 'lodash';
|
|
2
|
+
import { BaseProps, MediaProps } from '../../schema/validators/common';
|
|
3
|
+
import { ContentBase } from '../../sub-blocks/Content/schema';
|
|
4
|
+
import metaInfo from '../../components/MetaInfo/schema';
|
|
5
|
+
export const LayoutItem = {
|
|
6
|
+
type: 'object',
|
|
7
|
+
additionalProperties: false,
|
|
8
|
+
required: ['content', 'media'],
|
|
9
|
+
properties: Object.assign(Object.assign({}, BaseProps), { media: MediaProps, content: omit(ContentBase, ['colSize', 'size', 'centered']), metaInfo: metaInfo, border: {
|
|
10
|
+
type: 'boolean',
|
|
11
|
+
}, fullScreen: {
|
|
12
|
+
type: 'boolean',
|
|
13
|
+
} }),
|
|
14
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { LayoutItemProps, LinkTheme, MediaProps } from '../../models';
|
|
2
|
+
export declare const getLayoutItemLinks: (links: LayoutItemProps['content']['links']) => {
|
|
3
|
+
url: string;
|
|
4
|
+
text?: string | undefined;
|
|
5
|
+
textSize?: import("../../models").TextSize | undefined;
|
|
6
|
+
theme: LinkTheme;
|
|
7
|
+
colorTheme?: import("../../models").TextTheme | undefined;
|
|
8
|
+
arrow?: boolean | undefined;
|
|
9
|
+
target?: string | undefined;
|
|
10
|
+
metrikaGoals?: import("../../models").MetrikaGoal | undefined;
|
|
11
|
+
pixelEvents?: import("../../models").ButtonPixel | undefined;
|
|
12
|
+
context?: string | undefined;
|
|
13
|
+
analyticsEvents?: {
|
|
14
|
+
name: string;
|
|
15
|
+
type?: string | undefined;
|
|
16
|
+
counters?: import("../../models").AnalyticsCounters | undefined;
|
|
17
|
+
context?: string | undefined;
|
|
18
|
+
target?: string | undefined;
|
|
19
|
+
} | {
|
|
20
|
+
name: string;
|
|
21
|
+
type?: string | undefined;
|
|
22
|
+
counters?: import("../../models").AnalyticsCounters | undefined;
|
|
23
|
+
context?: string | undefined;
|
|
24
|
+
target?: string | undefined;
|
|
25
|
+
}[] | undefined;
|
|
26
|
+
className?: string | undefined;
|
|
27
|
+
}[] | undefined;
|
|
28
|
+
export declare const hasFullScreen: ({ dataLens, image }: MediaProps) => boolean;
|
|
29
|
+
export declare const showFullScreenIcon: ({ youtube }: MediaProps) => boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const getLayoutItemLinks = (links) => links === null || links === void 0 ? void 0 : links.map((link) => (Object.assign({ theme: 'normal' }, link)));
|
|
2
|
+
export const hasFullScreen = ({ dataLens, image }) => {
|
|
3
|
+
// datalens and slider media card don't support fullScreen mode
|
|
4
|
+
return !(dataLens || Array.isArray(image));
|
|
5
|
+
};
|
|
6
|
+
export const showFullScreenIcon = ({ youtube }) => !youtube;
|
|
@@ -7,6 +7,7 @@ export { default as MediaCard } from './MediaCard/MediaCard';
|
|
|
7
7
|
export { default as BannerCard } from './BannerCard/BannerCard';
|
|
8
8
|
export { default as TutorialCard } from './TutorialCard/TutorialCard';
|
|
9
9
|
export { default as CardWithImage } from './CardWithImage/CardWithImage';
|
|
10
|
+
export { default as LayoutItem } from './LayoutItem/LayoutItem';
|
|
10
11
|
export { default as BackgroundCard } from './BackgroundCard/BackgroundCard';
|
|
11
12
|
export { default as BasicCard } from './BasicCard/BasicCard';
|
|
12
13
|
export { default as Content } from './Content/Content';
|
|
@@ -7,6 +7,7 @@ export { default as MediaCard } from './MediaCard/MediaCard';
|
|
|
7
7
|
export { default as BannerCard } from './BannerCard/BannerCard';
|
|
8
8
|
export { default as TutorialCard } from './TutorialCard/TutorialCard';
|
|
9
9
|
export { default as CardWithImage } from './CardWithImage/CardWithImage';
|
|
10
|
+
export { default as LayoutItem } from './LayoutItem/LayoutItem';
|
|
10
11
|
export { default as BackgroundCard } from './BackgroundCard/BackgroundCard';
|
|
11
12
|
export { default as BasicCard } from './BasicCard/BasicCard';
|
|
12
13
|
export { default as Content } from './Content/Content';
|
|
@@ -138,6 +138,23 @@ const config = {
|
|
|
138
138
|
transformer: typografTransformer,
|
|
139
139
|
},
|
|
140
140
|
],
|
|
141
|
+
[SubBlockType.LayoutItem]: [
|
|
142
|
+
{
|
|
143
|
+
fields: ['content'],
|
|
144
|
+
parser: parseContentLayout,
|
|
145
|
+
transformer: yfmTransformer,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
fields: ['content'],
|
|
149
|
+
parser: parseContentLayoutTitle,
|
|
150
|
+
transformer: typografTransformer,
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
fields: ['metaInfo'],
|
|
154
|
+
parser: createItemsParser([]),
|
|
155
|
+
transformer: typografTransformer,
|
|
156
|
+
},
|
|
157
|
+
],
|
|
141
158
|
[SubBlockType.Quote]: {
|
|
142
159
|
fields: ['text'],
|
|
143
160
|
transformer: typografTransformer,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type HubspotEventName = 'onBeforeFormInit' | 'onFormReady' | 'onFormSubmit' | 'onFormSubmitted' | `_${string}`;
|
|
1
|
+
export type HubspotEventName = 'onBeforeFormInit' | 'onFormReady' | 'onFormSubmit' | 'onFormSubmitted' | 'onFormError' | `_${string}`;
|
|
2
2
|
export interface HubspotEventData {
|
|
3
3
|
type: HubspotEventName | string;
|
|
4
4
|
eventName: HubspotEventName;
|
|
@@ -11,6 +11,7 @@ export interface HubspotEventHandlers {
|
|
|
11
11
|
onBeforeSubmit?: (arg: HubspotEventData) => void;
|
|
12
12
|
onSubmit?: (arg: HubspotEventData) => void;
|
|
13
13
|
onLoad?: (arg: HubspotEventData) => void;
|
|
14
|
+
onSubmitError?: (arg: HubspotEventData) => void;
|
|
14
15
|
}
|
|
15
16
|
export declare function loopBackHabspotEvents(formId: string): ({ data, source, origin }: MessageEvent) => void;
|
|
16
17
|
export declare function handleHubspotEvents(handlers: HubspotEventHandlers, formId: string): ({ data }: MessageEvent) => void;
|
|
@@ -20,7 +20,7 @@ export function loopBackHabspotEvents(formId) {
|
|
|
20
20
|
}
|
|
21
21
|
export function handleHubspotEvents(handlers, formId) {
|
|
22
22
|
return ({ data }) => {
|
|
23
|
-
var _a, _b, _c, _d;
|
|
23
|
+
var _a, _b, _c, _d, _e;
|
|
24
24
|
if (!isHubspotEventData(data)) {
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
@@ -44,6 +44,10 @@ export function handleHubspotEvents(handlers, formId) {
|
|
|
44
44
|
(_d = handlers.onSubmit) === null || _d === void 0 ? void 0 : _d.call(handlers, data);
|
|
45
45
|
break;
|
|
46
46
|
}
|
|
47
|
+
case 'onFormError': {
|
|
48
|
+
(_e = handlers.onSubmitError) === null || _e === void 0 ? void 0 : _e.call(handlers, data);
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
47
51
|
default:
|
|
48
52
|
break;
|
|
49
53
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/page-constructor",
|
|
3
|
-
"version": "1.15.0-alpha.
|
|
3
|
+
"version": "1.15.0-alpha.23",
|
|
4
4
|
"description": "Gravity UI Page Constructor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -56,7 +56,8 @@
|
|
|
56
56
|
"react-waypoint": "^10.1.0",
|
|
57
57
|
"sanitize-html": "^2.6.1",
|
|
58
58
|
"snakecase-keys": "^5.1.0",
|
|
59
|
-
"typograf": "^6.14.0"
|
|
59
|
+
"typograf": "^6.14.0",
|
|
60
|
+
"uuid": "^9.0.0"
|
|
60
61
|
},
|
|
61
62
|
"peerDependencies": {
|
|
62
63
|
"react": "^16.0.0 || ^17.0.0",
|
|
@@ -87,6 +88,8 @@
|
|
|
87
88
|
"@types/react-slick": "^0.23.7",
|
|
88
89
|
"@types/react-transition-group": "^4.4.4",
|
|
89
90
|
"@types/sanitize-html": "^2.6.0",
|
|
91
|
+
"@types/uuid": "^9.0.0",
|
|
92
|
+
"es5-ext": "0.10.53",
|
|
90
93
|
"eslint": "^7.32.0",
|
|
91
94
|
"eslint-plugin-local": "./eslint-plugin-local",
|
|
92
95
|
"eslint-plugin-testing-library": "^5.9.1",
|
|
@@ -174,6 +174,7 @@ export interface MediaComponentVideoProps extends AnalyticsEventsBase {
|
|
|
174
174
|
export interface MediaComponentYoutubeProps {
|
|
175
175
|
youtube: string;
|
|
176
176
|
previewImg?: string;
|
|
177
|
+
fullScreen?: boolean;
|
|
177
178
|
}
|
|
178
179
|
export interface MediaComponentImageProps {
|
|
179
180
|
image: ImageProps | ImageProps[] | ImageDeviceProps;
|
|
@@ -245,27 +246,10 @@ export interface TitleBaseProps {
|
|
|
245
246
|
custom?: string | ReactNode;
|
|
246
247
|
onClick?: () => void;
|
|
247
248
|
}
|
|
248
|
-
export interface CardData {
|
|
249
|
-
header?: CardHeader;
|
|
250
|
-
text?: string;
|
|
251
|
-
title?: string;
|
|
252
|
-
link?: LinkProps;
|
|
253
|
-
footer?: string;
|
|
254
|
-
url?: string;
|
|
255
|
-
service?: {
|
|
256
|
-
slug: string;
|
|
257
|
-
name: string;
|
|
258
|
-
};
|
|
259
|
-
links?: LinkProps[];
|
|
260
|
-
}
|
|
261
249
|
export type CardBorder = 'shadow' | 'line' | 'none';
|
|
262
250
|
export interface CardBaseProps {
|
|
263
251
|
border?: CardBorder;
|
|
264
252
|
}
|
|
265
|
-
export interface CardHeader {
|
|
266
|
-
title?: string;
|
|
267
|
-
image?: ImageProps;
|
|
268
|
-
}
|
|
269
253
|
export interface PriceDescriptionProps {
|
|
270
254
|
title: string;
|
|
271
255
|
detailedTitle?: string;
|