@gravity-ui/page-constructor 4.31.0 → 4.31.1-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/build/cjs/blocks/Form/Form.css +136 -0
- package/build/cjs/blocks/Form/Form.d.ts +4 -0
- package/build/cjs/blocks/Form/Form.js +61 -0
- package/build/cjs/blocks/Form/HubspotInlineForm.d.ts +7 -0
- package/build/cjs/blocks/Form/HubspotInlineForm.js +14 -0
- package/build/cjs/blocks/Form/InnerForm/InnerForm.d.ts +9 -0
- package/build/cjs/blocks/Form/InnerForm/InnerForm.js +28 -0
- package/build/cjs/blocks/Form/schema.d.ts +202 -0
- package/build/cjs/blocks/Form/schema.js +44 -0
- package/build/cjs/blocks/index.d.ts +1 -0
- package/build/cjs/blocks/index.js +3 -1
- package/build/cjs/components/YandexForm/YandexForm.d.ts +2 -17
- package/build/cjs/components/YandexForm/YandexForm.js +6 -4
- package/build/cjs/components/YandexForm/schema.d.ts +16 -0
- package/build/cjs/components/YandexForm/schema.js +13 -0
- package/build/cjs/constructor-items.d.ts +1 -0
- package/build/cjs/constructor-items.js +1 -0
- package/build/cjs/editor/data/templates/form-block.json +20 -0
- package/build/cjs/models/constructor-items/blocks.d.ts +31 -4
- package/build/cjs/models/constructor-items/blocks.js +13 -1
- package/build/cjs/models/constructor-items/common.d.ts +17 -1
- package/build/cjs/models/guards.d.ts +3 -1
- package/build/cjs/models/guards.js +9 -1
- package/build/cjs/schema/constants.js +2 -1
- package/build/cjs/schema/validators/blocks.d.ts +1 -0
- package/build/cjs/schema/validators/blocks.js +1 -0
- package/build/cjs/sub-blocks/HubspotForm/schema.d.ts +22 -0
- package/build/cjs/sub-blocks/HubspotForm/schema.js +17 -0
- package/build/esm/blocks/Form/Form.css +136 -0
- package/build/esm/blocks/Form/Form.d.ts +5 -0
- package/build/esm/blocks/Form/Form.js +59 -0
- package/build/esm/blocks/Form/HubspotInlineForm.d.ts +7 -0
- package/build/esm/blocks/Form/HubspotInlineForm.js +12 -0
- package/build/esm/blocks/Form/InnerForm/InnerForm.d.ts +9 -0
- package/build/esm/blocks/Form/InnerForm/InnerForm.js +26 -0
- package/build/esm/blocks/Form/schema.d.ts +202 -0
- package/build/esm/blocks/Form/schema.js +40 -0
- package/build/esm/blocks/index.d.ts +1 -0
- package/build/esm/blocks/index.js +1 -0
- package/build/esm/components/YandexForm/YandexForm.d.ts +2 -17
- package/build/esm/components/YandexForm/YandexForm.js +5 -3
- package/build/esm/components/YandexForm/schema.d.ts +16 -0
- package/build/esm/components/YandexForm/schema.js +10 -0
- package/build/esm/constructor-items.d.ts +1 -0
- package/build/esm/constructor-items.js +2 -1
- package/build/esm/editor/data/templates/form-block.json +20 -0
- package/build/esm/models/constructor-items/blocks.d.ts +31 -4
- package/build/esm/models/constructor-items/blocks.js +12 -0
- package/build/esm/models/constructor-items/common.d.ts +17 -1
- package/build/esm/models/guards.d.ts +3 -1
- package/build/esm/models/guards.js +7 -1
- package/build/esm/schema/constants.js +3 -2
- package/build/esm/schema/validators/blocks.d.ts +1 -0
- package/build/esm/schema/validators/blocks.js +1 -0
- package/build/esm/sub-blocks/HubspotForm/schema.d.ts +22 -0
- package/build/esm/sub-blocks/HubspotForm/schema.js +14 -0
- package/package.json +1 -1
- package/server/models/constructor-items/blocks.d.ts +31 -4
- package/server/models/constructor-items/blocks.js +13 -1
- package/server/models/constructor-items/common.d.ts +17 -1
- package/server/models/guards.d.ts +3 -1
- package/server/models/guards.js +9 -1
- package/widget/index.js +1 -1
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
export declare const FormBlock: {
|
|
2
|
+
'form-block': {
|
|
3
|
+
additionalProperties: boolean;
|
|
4
|
+
required: string[];
|
|
5
|
+
properties: {
|
|
6
|
+
title: {
|
|
7
|
+
type: string;
|
|
8
|
+
};
|
|
9
|
+
formData: {
|
|
10
|
+
oneOf: ({
|
|
11
|
+
type: string;
|
|
12
|
+
optionName: string;
|
|
13
|
+
properties: {
|
|
14
|
+
yandex: {
|
|
15
|
+
type: string;
|
|
16
|
+
required: string[];
|
|
17
|
+
properties: {
|
|
18
|
+
id: {
|
|
19
|
+
type: string;
|
|
20
|
+
};
|
|
21
|
+
containerId: {
|
|
22
|
+
type: string;
|
|
23
|
+
};
|
|
24
|
+
type: {};
|
|
25
|
+
when: {
|
|
26
|
+
type: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
hubspot?: undefined;
|
|
31
|
+
};
|
|
32
|
+
} | {
|
|
33
|
+
type: string;
|
|
34
|
+
optionName: string;
|
|
35
|
+
properties: {
|
|
36
|
+
hubspot: {
|
|
37
|
+
type: string;
|
|
38
|
+
required: string[];
|
|
39
|
+
properties: {
|
|
40
|
+
region: {
|
|
41
|
+
type: string;
|
|
42
|
+
};
|
|
43
|
+
portalId: {
|
|
44
|
+
type: string;
|
|
45
|
+
};
|
|
46
|
+
formId: {
|
|
47
|
+
type: string;
|
|
48
|
+
};
|
|
49
|
+
formInstanceId: {
|
|
50
|
+
type: string;
|
|
51
|
+
};
|
|
52
|
+
type: {};
|
|
53
|
+
when: {
|
|
54
|
+
type: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
yandex?: undefined;
|
|
59
|
+
};
|
|
60
|
+
})[];
|
|
61
|
+
};
|
|
62
|
+
textContent: {
|
|
63
|
+
additionalProperties: boolean;
|
|
64
|
+
properties: Partial<{
|
|
65
|
+
title: {
|
|
66
|
+
oneOf: ({
|
|
67
|
+
type: string;
|
|
68
|
+
contentType: string;
|
|
69
|
+
optionName: string;
|
|
70
|
+
} | {
|
|
71
|
+
optionName: string;
|
|
72
|
+
type: string;
|
|
73
|
+
additionalProperties: boolean;
|
|
74
|
+
required: string[];
|
|
75
|
+
properties: {
|
|
76
|
+
text: {
|
|
77
|
+
type: string;
|
|
78
|
+
contentType: string;
|
|
79
|
+
};
|
|
80
|
+
textSize: {
|
|
81
|
+
type: string;
|
|
82
|
+
enum: string[];
|
|
83
|
+
};
|
|
84
|
+
url: {
|
|
85
|
+
type: string;
|
|
86
|
+
};
|
|
87
|
+
urlTitle: {
|
|
88
|
+
type: string;
|
|
89
|
+
};
|
|
90
|
+
resetMargin: {
|
|
91
|
+
type: string;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
contentType?: undefined;
|
|
95
|
+
})[];
|
|
96
|
+
};
|
|
97
|
+
text: {
|
|
98
|
+
type: string;
|
|
99
|
+
contentType: string;
|
|
100
|
+
inputType: string;
|
|
101
|
+
};
|
|
102
|
+
additionalInfo: {
|
|
103
|
+
type: string;
|
|
104
|
+
contentType: string;
|
|
105
|
+
};
|
|
106
|
+
size: {
|
|
107
|
+
type: string;
|
|
108
|
+
enum: string[];
|
|
109
|
+
};
|
|
110
|
+
links: {
|
|
111
|
+
type: string;
|
|
112
|
+
items: {
|
|
113
|
+
type: string;
|
|
114
|
+
properties: {
|
|
115
|
+
when: {
|
|
116
|
+
type: string;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
buttons: {
|
|
122
|
+
type: string;
|
|
123
|
+
items: {
|
|
124
|
+
type: string;
|
|
125
|
+
properties: {
|
|
126
|
+
when: {
|
|
127
|
+
type: string;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
theme: {
|
|
133
|
+
type: string;
|
|
134
|
+
enum: string[];
|
|
135
|
+
};
|
|
136
|
+
list: {
|
|
137
|
+
type: string;
|
|
138
|
+
items: {
|
|
139
|
+
type: string;
|
|
140
|
+
properties: {
|
|
141
|
+
when: {
|
|
142
|
+
type: string;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
}>;
|
|
148
|
+
};
|
|
149
|
+
direction: {
|
|
150
|
+
enum: string[];
|
|
151
|
+
};
|
|
152
|
+
image: {
|
|
153
|
+
oneOf: ({
|
|
154
|
+
type: string;
|
|
155
|
+
properties: {
|
|
156
|
+
when: {
|
|
157
|
+
type: string;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
} | {
|
|
161
|
+
type: string;
|
|
162
|
+
pattern: string;
|
|
163
|
+
optionName: string;
|
|
164
|
+
})[];
|
|
165
|
+
};
|
|
166
|
+
backgroundColor: {
|
|
167
|
+
type: string;
|
|
168
|
+
};
|
|
169
|
+
anchor: {
|
|
170
|
+
type: string;
|
|
171
|
+
additionalProperties: boolean;
|
|
172
|
+
required: string[];
|
|
173
|
+
properties: {
|
|
174
|
+
text: {
|
|
175
|
+
type: string;
|
|
176
|
+
contentType: string;
|
|
177
|
+
};
|
|
178
|
+
url: {
|
|
179
|
+
type: string;
|
|
180
|
+
};
|
|
181
|
+
urlTitle: {
|
|
182
|
+
type: string;
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
visible: {
|
|
187
|
+
type: string;
|
|
188
|
+
enum: string[];
|
|
189
|
+
};
|
|
190
|
+
resetPaddings: {
|
|
191
|
+
type: string;
|
|
192
|
+
};
|
|
193
|
+
context: {
|
|
194
|
+
type: string;
|
|
195
|
+
};
|
|
196
|
+
type: {};
|
|
197
|
+
when: {
|
|
198
|
+
type: string;
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import omit from 'lodash/omit';
|
|
2
|
+
import { ImageProps } from '../../components/Image/schema';
|
|
3
|
+
import { YandexFormProps } from '../../components/YandexForm/schema';
|
|
4
|
+
import { BlockBaseProps } from '../../schema/validators/common';
|
|
5
|
+
import { ContentBase } from '../../sub-blocks/Content/schema';
|
|
6
|
+
import { HubspotFormProps } from '../../sub-blocks/HubspotForm/schema';
|
|
7
|
+
const FormBlockContentProps = omit(ContentBase, ['size', 'centered', 'colSizes']);
|
|
8
|
+
export const FormBlock = {
|
|
9
|
+
'form-block': {
|
|
10
|
+
additionalProperties: false,
|
|
11
|
+
required: ['formData'],
|
|
12
|
+
properties: Object.assign(Object.assign({}, BlockBaseProps), { title: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
}, formData: {
|
|
15
|
+
oneOf: [
|
|
16
|
+
{
|
|
17
|
+
type: 'object',
|
|
18
|
+
optionName: 'yandex',
|
|
19
|
+
properties: {
|
|
20
|
+
yandex: YandexFormProps,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
type: 'object',
|
|
25
|
+
optionName: 'hubspot-inline',
|
|
26
|
+
properties: {
|
|
27
|
+
hubspot: HubspotFormProps,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
}, textContent: {
|
|
32
|
+
additionalProperties: false,
|
|
33
|
+
properties: FormBlockContentProps,
|
|
34
|
+
}, direction: {
|
|
35
|
+
enum: ['content-form', 'form-content', 'center'],
|
|
36
|
+
}, image: ImageProps, backgroundColor: {
|
|
37
|
+
type: 'string',
|
|
38
|
+
} }),
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -16,3 +16,4 @@ export { default as CardLayoutBlock } from './CardLayout/CardLayout';
|
|
|
16
16
|
export { default as ContentLayoutBlock } from './ContentLayout/ContentLayout';
|
|
17
17
|
export { default as ShareBlock } from './Share/Share';
|
|
18
18
|
export { default as FilterBlock } from './FilterBlock/FilterBlock';
|
|
19
|
+
export { default as FormBlock } from './Form/Form';
|
|
@@ -16,3 +16,4 @@ export { default as CardLayoutBlock } from './CardLayout/CardLayout';
|
|
|
16
16
|
export { default as ContentLayoutBlock } from './ContentLayout/ContentLayout';
|
|
17
17
|
export { default as ShareBlock } from './Share/Share';
|
|
18
18
|
export { default as FilterBlock } from './FilterBlock/FilterBlock';
|
|
19
|
+
export { default as FormBlock } from './Form/Form';
|
|
@@ -1,20 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AnalyticsEventsBase } from '../../models/common';
|
|
1
|
+
import { YandexFormProps } from '../../models';
|
|
3
2
|
export declare const YANDEX_FORM_ORIGIN = "https://forms.yandex.ru";
|
|
4
|
-
export
|
|
5
|
-
id: number | string;
|
|
6
|
-
containerId?: string;
|
|
7
|
-
theme?: string;
|
|
8
|
-
className?: string;
|
|
9
|
-
headerHeight?: number;
|
|
10
|
-
customFormOrigin?: string;
|
|
11
|
-
params?: {
|
|
12
|
-
[key: string]: string;
|
|
13
|
-
};
|
|
14
|
-
onSubmit?: () => void;
|
|
15
|
-
onLoad?: () => void;
|
|
16
|
-
metrikaGoals?: string | string[];
|
|
17
|
-
pixelEvents?: string | string[] | PixelEvent | PixelEvent[];
|
|
18
|
-
}
|
|
3
|
+
export declare const YANDEX_FORM_SECTION = "surveys";
|
|
19
4
|
declare const YandexForm: (props: YandexFormProps) => JSX.Element;
|
|
20
5
|
export default YandexForm;
|
|
@@ -7,13 +7,15 @@ import { DefaultEventNames } from '../../models/common';
|
|
|
7
7
|
import { block } from '../../utils';
|
|
8
8
|
import { HEADER_HEIGHT } from '../constants';
|
|
9
9
|
export const YANDEX_FORM_ORIGIN = 'https://forms.yandex.ru';
|
|
10
|
+
export const YANDEX_FORM_SECTION = 'surveys';
|
|
10
11
|
const CONTAINER_ID = 'pc-yandex-form-container';
|
|
11
12
|
const b = block('yandex-form');
|
|
12
13
|
const YandexForm = (props) => {
|
|
13
|
-
const { onLoad, id, params, className, theme, containerId = CONTAINER_ID, headerHeight = HEADER_HEIGHT, onSubmit, metrikaGoals, pixelEvents, analyticsEvents, customFormOrigin, } = props;
|
|
14
|
+
const { onLoad, id, params, className, theme, containerId = CONTAINER_ID, headerHeight = HEADER_HEIGHT, onSubmit, metrikaGoals, pixelEvents, analyticsEvents, customFormOrigin, customFormSection, } = props;
|
|
14
15
|
const formContainerRef = useRef(null);
|
|
15
16
|
const iframeRef = useRef();
|
|
16
17
|
const yaFormOrigin = customFormOrigin || YANDEX_FORM_ORIGIN;
|
|
18
|
+
const yaFormSection = customFormSection || YANDEX_FORM_SECTION;
|
|
17
19
|
const handleMetrika = useMetrika();
|
|
18
20
|
const handleAnalytics = useAnalytics(DefaultEventNames.YandexFormSubmit);
|
|
19
21
|
const isMobile = useContext(MobileContext);
|
|
@@ -35,7 +37,7 @@ const YandexForm = (props) => {
|
|
|
35
37
|
queryParams.set(param, params[param]);
|
|
36
38
|
});
|
|
37
39
|
}
|
|
38
|
-
const src = `${yaFormOrigin}
|
|
40
|
+
const src = `${yaFormOrigin}/${yaFormSection}/${id}/?${queryParams}`;
|
|
39
41
|
if (iframeRef.current) {
|
|
40
42
|
iframeRef.current.src = src;
|
|
41
43
|
}
|
|
@@ -50,7 +52,7 @@ const YandexForm = (props) => {
|
|
|
50
52
|
iframeRef.current.width = '100%';
|
|
51
53
|
container.appendChild(iframeRef.current);
|
|
52
54
|
}
|
|
53
|
-
}, [locale.lang, theme, isMobile, yaFormOrigin, id, containerId, params]);
|
|
55
|
+
}, [locale.lang, theme, isMobile, yaFormOrigin, yaFormSection, id, containerId, params]);
|
|
54
56
|
const handleSubmit = useCallback(() => {
|
|
55
57
|
if (formContainerRef && formContainerRef.current) {
|
|
56
58
|
const { top } = formContainerRef.current.getBoundingClientRect();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseProps } from '../../schema/validators/common';
|
|
2
|
+
export const YandexFormProps = {
|
|
3
|
+
type: 'object',
|
|
4
|
+
required: ['id'],
|
|
5
|
+
properties: Object.assign(Object.assign({}, BaseProps), { id: {
|
|
6
|
+
type: 'string',
|
|
7
|
+
}, containerId: {
|
|
8
|
+
type: 'string',
|
|
9
|
+
} }),
|
|
10
|
+
};
|
|
@@ -17,6 +17,7 @@ export declare const blockMap: {
|
|
|
17
17
|
"share-block": ({ items, title }: import("./models").ShareBlockProps) => JSX.Element;
|
|
18
18
|
"map-block": ({ map, ...props }: import("./models").MapBlockProps) => JSX.Element;
|
|
19
19
|
"filter-block": import("react").FC<import("./models").FilterBlockProps>;
|
|
20
|
+
"form-block": import("react").FC<import("./models").FormBlockProps>;
|
|
20
21
|
};
|
|
21
22
|
export declare const subBlockMap: {
|
|
22
23
|
divider: ({ size, border }: import("./models").DividerProps) => JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BannerBlock, CardLayoutBlock, CompaniesBlock, ContentLayoutBlock, ExtendedFeaturesBlock, FilterBlock, HeaderBlock, HeaderSliderBlock, IconsBlock, InfoBlock, MapBlock, MediaBlock, PromoFeaturesBlock, QuestionsBlock, ShareBlock, SliderBlock, TableBlock, TabsBlock, } from './blocks';
|
|
1
|
+
import { BannerBlock, CardLayoutBlock, CompaniesBlock, ContentLayoutBlock, ExtendedFeaturesBlock, FilterBlock, FormBlock, HeaderBlock, HeaderSliderBlock, IconsBlock, InfoBlock, MapBlock, MediaBlock, PromoFeaturesBlock, QuestionsBlock, ShareBlock, SliderBlock, TableBlock, TabsBlock, } from './blocks';
|
|
2
2
|
import { BlockType, NavigationItemType, SubBlockType } from './models';
|
|
3
3
|
import { GithubButton, NavigationButton, NavigationDropdown, NavigationLink, } from './navigation/components/NavigationItem';
|
|
4
4
|
import SocialIcon from './navigation/components/SocialIcon/SocialIcon';
|
|
@@ -22,6 +22,7 @@ export const blockMap = {
|
|
|
22
22
|
[BlockType.ShareBlock]: ShareBlock,
|
|
23
23
|
[BlockType.MapBlock]: MapBlock,
|
|
24
24
|
[BlockType.FilterBlock]: FilterBlock,
|
|
25
|
+
[BlockType.FormBlock]: FormBlock,
|
|
25
26
|
};
|
|
26
27
|
export const subBlockMap = {
|
|
27
28
|
[SubBlockType.Divider]: Divider,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"template": {
|
|
3
|
+
"type": "form-block",
|
|
4
|
+
"formData": {
|
|
5
|
+
"yandex": {
|
|
6
|
+
"hash": "hashString",
|
|
7
|
+
"title": ""
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"direction": "center",
|
|
11
|
+
"textContent": {
|
|
12
|
+
"title": "Lorem ipsum dolor sit amet, consectetur adipiscing elit",
|
|
13
|
+
"text": "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
|
|
14
|
+
},
|
|
15
|
+
"image": {
|
|
16
|
+
"src": "https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/img-mini_4-12_light.png"
|
|
17
|
+
},
|
|
18
|
+
"backgroundColor": "#262626"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -3,8 +3,8 @@ import { ButtonSize } from '@gravity-ui/uikit';
|
|
|
3
3
|
import { GridColumnSize, GridColumnSizesType } from '../../grid/types';
|
|
4
4
|
import { ThemeSupporting } from '../../utils';
|
|
5
5
|
import { AnalyticsEventsBase } from '../common';
|
|
6
|
-
import { AnchorProps, Animatable, BackgroundImageProps, ButtonProps, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, ImageDeviceProps, Justify, LegendTableMarkerType, LinkProps, MapProps, MediaDirection, MediaProps, TextSize, TextTheme, ThemedImage, ThemedMediaProps, ThemedMediaVideoProps, TitleItemBaseProps, TitleItemProps } from './common';
|
|
7
|
-
import { BannerCardProps, SubBlock, SubBlockModels } from './sub-blocks';
|
|
6
|
+
import { AnchorProps, Animatable, BackgroundImageProps, ButtonProps, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, ImageDeviceProps, Justify, LegendTableMarkerType, LinkProps, MapProps, MediaDirection, MediaProps, TextSize, TextTheme, ThemedImage, ThemedMediaProps, ThemedMediaVideoProps, TitleItemBaseProps, TitleItemProps, YandexFormProps } from './common';
|
|
7
|
+
import { BannerCardProps, HubspotFormProps, SubBlock, SubBlockModels } from './sub-blocks';
|
|
8
8
|
export declare enum BlockType {
|
|
9
9
|
PromoFeaturesBlock = "promo-features-block",
|
|
10
10
|
ExtendedFeaturesBlock = "extended-features-block",
|
|
@@ -23,7 +23,8 @@ export declare enum BlockType {
|
|
|
23
23
|
ContentLayoutBlock = "content-layout-block",
|
|
24
24
|
ShareBlock = "share-block",
|
|
25
25
|
MapBlock = "map-block",
|
|
26
|
-
FilterBlock = "filter-block"
|
|
26
|
+
FilterBlock = "filter-block",
|
|
27
|
+
FormBlock = "form-block"
|
|
27
28
|
}
|
|
28
29
|
export declare const BlockTypes: BlockType[];
|
|
29
30
|
export declare const HeaderBlockTypes: BlockType[];
|
|
@@ -295,6 +296,29 @@ export interface ShareBlockProps {
|
|
|
295
296
|
items: PCShareSocialNetwork[];
|
|
296
297
|
title?: string;
|
|
297
298
|
}
|
|
299
|
+
export declare enum FormBlockDataTypes {
|
|
300
|
+
YANDEX = "yandex",
|
|
301
|
+
HUBSPOT_INLINE = "hubspot-inline"
|
|
302
|
+
}
|
|
303
|
+
export declare enum FormBlockDirection {
|
|
304
|
+
FormContent = "form-content",
|
|
305
|
+
ContentForm = "content-form",
|
|
306
|
+
Center = "center"
|
|
307
|
+
}
|
|
308
|
+
export interface FormBlockYandexData {
|
|
309
|
+
yandex: YandexFormProps;
|
|
310
|
+
}
|
|
311
|
+
export interface FormBlockHubspotData {
|
|
312
|
+
hubspot: HubspotFormProps;
|
|
313
|
+
}
|
|
314
|
+
export type FormBlockData = FormBlockYandexData | FormBlockHubspotData;
|
|
315
|
+
export interface FormBlockProps {
|
|
316
|
+
formData: FormBlockData;
|
|
317
|
+
title?: string;
|
|
318
|
+
textContent?: Omit<ContentBlockProps, 'centered' | 'colSizes' | 'size'>;
|
|
319
|
+
direction?: FormBlockDirection;
|
|
320
|
+
background?: BackgroundImageProps;
|
|
321
|
+
}
|
|
298
322
|
export type HeaderBlockModel = {
|
|
299
323
|
type: BlockType.HeaderBlock;
|
|
300
324
|
} & HeaderBlockProps;
|
|
@@ -349,6 +373,9 @@ export type ContentLayoutBlockModel = {
|
|
|
349
373
|
export type ShareBLockModel = {
|
|
350
374
|
type: BlockType.ShareBlock;
|
|
351
375
|
} & ShareBlockProps;
|
|
352
|
-
type
|
|
376
|
+
export type FormBlockModel = {
|
|
377
|
+
type: BlockType.FormBlock;
|
|
378
|
+
} & FormBlockProps;
|
|
379
|
+
type BlockModels = SliderBlockModel | ExtendedFeaturesBlockModel | PromoFeaturesBlockModel | QuestionsBlockModel | BannerBlockModel | CompaniesBlockModel | MediaBlockModel | MapBlockModel | InfoBlockModel | TableBlockModel | TabsBlockModel | HeaderBlockModel | IconsBlockModel | HeaderSliderBlockModel | CardLayoutBlockModel | ContentLayoutBlockModel | ShareBLockModel | FilterBlockModel | FormBlockModel;
|
|
353
380
|
export type Block = BlockModels & BlockBaseProps;
|
|
354
381
|
export {};
|
|
@@ -18,6 +18,7 @@ export var BlockType;
|
|
|
18
18
|
BlockType["ShareBlock"] = "share-block";
|
|
19
19
|
BlockType["MapBlock"] = "map-block";
|
|
20
20
|
BlockType["FilterBlock"] = "filter-block";
|
|
21
|
+
BlockType["FormBlock"] = "form-block";
|
|
21
22
|
})(BlockType || (BlockType = {}));
|
|
22
23
|
export const BlockTypes = Object.values(BlockType);
|
|
23
24
|
export const HeaderBlockTypes = [BlockType.HeaderBlock, BlockType.HeaderSliderBlock];
|
|
@@ -41,3 +42,14 @@ export var PCShareSocialNetwork;
|
|
|
41
42
|
PCShareSocialNetwork["Facebook"] = "facebook";
|
|
42
43
|
PCShareSocialNetwork["LinkedIn"] = "linkedin";
|
|
43
44
|
})(PCShareSocialNetwork || (PCShareSocialNetwork = {}));
|
|
45
|
+
export var FormBlockDataTypes;
|
|
46
|
+
(function (FormBlockDataTypes) {
|
|
47
|
+
FormBlockDataTypes["YANDEX"] = "yandex";
|
|
48
|
+
FormBlockDataTypes["HUBSPOT_INLINE"] = "hubspot-inline";
|
|
49
|
+
})(FormBlockDataTypes || (FormBlockDataTypes = {}));
|
|
50
|
+
export var FormBlockDirection;
|
|
51
|
+
(function (FormBlockDirection) {
|
|
52
|
+
FormBlockDirection["FormContent"] = "form-content";
|
|
53
|
+
FormBlockDirection["ContentForm"] = "content-form";
|
|
54
|
+
FormBlockDirection["Center"] = "center";
|
|
55
|
+
})(FormBlockDirection || (FormBlockDirection = {}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { ButtonView, ButtonProps as UikitButtonProps } from '@gravity-ui/uikit';
|
|
3
3
|
import { ThemeSupporting } from '../../utils';
|
|
4
|
-
import { AnalyticsEventsBase, ClassNameProps, PixelEventType, QAProps } from '../common';
|
|
4
|
+
import { AnalyticsEventsBase, ClassNameProps, PixelEvent, PixelEventType, QAProps } from '../common';
|
|
5
5
|
export declare enum AuthorType {
|
|
6
6
|
Column = "column",
|
|
7
7
|
Line = "line"
|
|
@@ -337,4 +337,20 @@ export interface TitleProps {
|
|
|
337
337
|
title?: TitleItemProps | string;
|
|
338
338
|
subtitle?: string;
|
|
339
339
|
}
|
|
340
|
+
export interface YandexFormProps extends AnalyticsEventsBase {
|
|
341
|
+
id: number | string;
|
|
342
|
+
containerId?: string;
|
|
343
|
+
theme?: string;
|
|
344
|
+
className?: string;
|
|
345
|
+
headerHeight?: number;
|
|
346
|
+
customFormOrigin?: string;
|
|
347
|
+
customFormSection?: string;
|
|
348
|
+
params?: {
|
|
349
|
+
[key: string]: string;
|
|
350
|
+
};
|
|
351
|
+
onSubmit?: () => void;
|
|
352
|
+
onLoad?: () => void;
|
|
353
|
+
metrikaGoals?: string | string[];
|
|
354
|
+
pixelEvents?: string | string[] | PixelEvent | PixelEvent[];
|
|
355
|
+
}
|
|
340
356
|
export {};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { Block, ConstructorItem } from './';
|
|
1
|
+
import { Block, ConstructorItem, FormBlockData, FormBlockHubspotData, FormBlockYandexData } from './';
|
|
2
2
|
import { MetrikaGoal, NewMetrikaGoal } from './index';
|
|
3
3
|
export declare function isBlock(block: ConstructorItem): block is Block;
|
|
4
4
|
export declare function isNewMetrikaFormat(metrika: MetrikaGoal): metrika is NewMetrikaGoal[];
|
|
5
|
+
export declare function isYandexDataForm(data: FormBlockData): data is FormBlockYandexData;
|
|
6
|
+
export declare function isHubspotDataForm(data: FormBlockData): data is FormBlockHubspotData;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { BlockTypes } from './';
|
|
1
|
+
import { BlockTypes, } from './';
|
|
2
2
|
export function isBlock(block) {
|
|
3
3
|
return block.type in BlockTypes;
|
|
4
4
|
}
|
|
5
5
|
export function isNewMetrikaFormat(metrika) {
|
|
6
6
|
return Boolean(Array.isArray(metrika) && metrika.length && typeof metrika[0] === 'object');
|
|
7
7
|
}
|
|
8
|
+
export function isYandexDataForm(data) {
|
|
9
|
+
return Boolean(data.yandex);
|
|
10
|
+
}
|
|
11
|
+
export function isHubspotDataForm(data) {
|
|
12
|
+
return Boolean(data.hubspot);
|
|
13
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BannerBlock, BannerCard, CardLayoutBlock, CompaniesBlock, ContentLayoutBlock, ExtendedFeaturesBlock, FilterBlock, HeaderBlock, HeaderSliderBlock, IconsBlock, InfoBlock, MapBlock, MediaBlock, PromoFeaturesBlock, QuestionsBlock, ShareBlock, SliderBlock, TableBlock, TabsBlock, } from './validators/blocks';
|
|
1
|
+
import { BannerBlock, BannerCard, CardLayoutBlock, CompaniesBlock, ContentLayoutBlock, ExtendedFeaturesBlock, FilterBlock, FormBlock, HeaderBlock, HeaderSliderBlock, IconsBlock, InfoBlock, MapBlock, MediaBlock, PromoFeaturesBlock, QuestionsBlock, ShareBlock, SliderBlock, TableBlock, TabsBlock, } from './validators/blocks';
|
|
2
2
|
import { BackgroundCard, BasicCard, Divider, MediaCardBlock, PriceDetailedBlock, Quote, } from './validators/sub-blocks';
|
|
3
|
-
export const blockSchemas = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, Divider), ExtendedFeaturesBlock), PromoFeaturesBlock), SliderBlock), QuestionsBlock), HeaderBlock), BannerBlock), CompaniesBlock), MediaBlock), MapBlock), InfoBlock), TableBlock), TabsBlock), HeaderSliderBlock), IconsBlock), CardLayoutBlock), ContentLayoutBlock), ShareBlock), FilterBlock);
|
|
3
|
+
export const blockSchemas = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, Divider), ExtendedFeaturesBlock), PromoFeaturesBlock), SliderBlock), QuestionsBlock), HeaderBlock), BannerBlock), CompaniesBlock), MediaBlock), MapBlock), InfoBlock), TableBlock), TabsBlock), HeaderSliderBlock), IconsBlock), CardLayoutBlock), ContentLayoutBlock), ShareBlock), FilterBlock), FormBlock);
|
|
4
4
|
export const cardSchemas = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, MediaCardBlock), BannerCard), PriceDetailedBlock), BackgroundCard), Quote), BasicCard);
|
|
5
5
|
export const constructorBlockSchemaNames = [
|
|
6
6
|
'divider',
|
|
@@ -27,6 +27,7 @@ export const constructorBlockSchemaNames = [
|
|
|
27
27
|
'content-layout-block',
|
|
28
28
|
'share-block',
|
|
29
29
|
'filter-block',
|
|
30
|
+
'form-block',
|
|
30
31
|
];
|
|
31
32
|
export const constructorCardSchemaNames = [
|
|
32
33
|
'media-card',
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const HubspotFormProps: {
|
|
2
|
+
type: string;
|
|
3
|
+
required: string[];
|
|
4
|
+
properties: {
|
|
5
|
+
region: {
|
|
6
|
+
type: string;
|
|
7
|
+
};
|
|
8
|
+
portalId: {
|
|
9
|
+
type: string;
|
|
10
|
+
};
|
|
11
|
+
formId: {
|
|
12
|
+
type: string;
|
|
13
|
+
};
|
|
14
|
+
formInstanceId: {
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
type: {};
|
|
18
|
+
when: {
|
|
19
|
+
type: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseProps } from '../../schema/validators/common';
|
|
2
|
+
export const HubspotFormProps = {
|
|
3
|
+
type: 'object',
|
|
4
|
+
required: ['portalId', 'formId'],
|
|
5
|
+
properties: Object.assign(Object.assign({}, BaseProps), { region: {
|
|
6
|
+
type: 'string',
|
|
7
|
+
}, portalId: {
|
|
8
|
+
type: 'string',
|
|
9
|
+
}, formId: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
}, formInstanceId: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
} }),
|
|
14
|
+
};
|