@gravity-ui/page-constructor 2.22.0-alpha → 2.22.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 +53 -0
- package/build/cjs/components/Anchor/Anchor.d.ts +2 -2
- package/build/cjs/components/Anchor/Anchor.js +1 -1
- package/build/cjs/components/BackgroundImage/BackgroundImage.js +2 -2
- package/build/cjs/components/BlockBase/BlockBase.d.ts +3 -2
- package/build/cjs/components/BlockBase/BlockBase.js +4 -2
- package/build/cjs/components/Button/Button.css +3 -0
- package/build/cjs/components/Button/Button.js +5 -4
- package/build/cjs/components/Image/Image.d.ts +1 -0
- package/build/cjs/components/Image/Image.js +2 -2
- package/build/cjs/containers/Loadable/Loadable.d.ts +2 -2
- package/build/cjs/containers/PageConstructor/PageConstructor.js +5 -3
- package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +3 -2
- package/build/cjs/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts +1 -1
- package/build/cjs/containers/PageConstructor/components/ConstructorItem/ConstructorItem.js +5 -5
- package/build/cjs/context/innerContext/InnerContext.d.ts +2 -1
- package/build/cjs/customization/BlockDecoration.d.ts +3 -0
- package/build/cjs/customization/BlockDecoration.js +22 -0
- package/build/cjs/editor/Components/AddBlock/AddBlock.css +82 -0
- package/build/cjs/editor/Components/AddBlock/AddBlock.d.ts +7 -0
- package/build/cjs/editor/Components/AddBlock/AddBlock.js +43 -0
- package/build/cjs/editor/Components/EditBlock/EditBlock.css +47 -0
- package/build/cjs/editor/Components/EditBlock/EditBlock.d.ts +4 -0
- package/build/cjs/editor/Components/EditBlock/EditBlock.js +32 -0
- package/build/cjs/editor/Containers/Editor.d.ts +2 -0
- package/build/cjs/editor/Containers/Editor.js +24 -0
- package/build/cjs/editor/data/index.d.ts +13 -0
- package/build/cjs/editor/data/index.js +27 -0
- package/build/cjs/editor/data/previews/default-preview.d.ts +3 -0
- package/build/cjs/editor/data/previews/default-preview.js +18 -0
- package/build/cjs/editor/data/previews/header-block.d.ts +3 -0
- package/build/cjs/editor/data/previews/header-block.js +19 -0
- package/build/cjs/editor/index.d.ts +2 -0
- package/build/cjs/editor/index.js +7 -0
- package/build/cjs/editor/store/index.d.ts +15 -0
- package/build/cjs/editor/store/index.js +32 -0
- package/build/cjs/editor/store/reducer.d.ts +41 -0
- package/build/cjs/editor/store/reducer.js +59 -0
- package/build/cjs/editor/store/utils.d.ts +13 -0
- package/build/cjs/editor/store/utils.js +34 -0
- package/build/cjs/editor/styles/mixins.css +0 -0
- package/build/cjs/editor/styles/variables.css +0 -0
- package/build/cjs/editor/types/index.d.ts +17 -0
- package/build/cjs/editor/types/index.js +2 -0
- package/build/cjs/editor/utils/index.d.ts +11 -0
- package/build/cjs/editor/utils/index.js +12 -0
- package/build/cjs/grid/Col/Col.d.ts +1 -1
- package/build/cjs/hooks/useMetrika.js +0 -7
- package/build/cjs/internal-typings/global.d.ts +18 -16
- package/build/cjs/models/constructor-items/blocks.d.ts +1 -11
- package/build/cjs/models/constructor-items/blocks.js +0 -2
- package/build/cjs/models/constructor-items/common.d.ts +3 -3
- package/build/cjs/models/constructor.d.ts +4 -1
- package/build/cjs/models/customization.d.ts +9 -0
- package/build/cjs/models/customization.js +2 -0
- package/build/cjs/models/index.d.ts +1 -0
- package/build/cjs/models/index.js +1 -0
- package/build/cjs/sub-blocks/HubspotForm/HubspotFormContainer.d.ts +2 -1
- package/build/cjs/sub-blocks/HubspotForm/HubspotFormContainer.js +5 -2
- package/build/cjs/sub-blocks/HubspotForm/index.d.ts +1 -1
- package/build/cjs/sub-blocks/HubspotForm/index.js +6 -5
- package/build/cjs/utils/blocks.d.ts +4 -1
- package/build/cjs/utils/blocks.js +11 -1
- package/build/esm/components/Anchor/Anchor.d.ts +2 -2
- package/build/esm/components/Anchor/Anchor.js +1 -1
- package/build/esm/components/BackgroundImage/BackgroundImage.js +2 -2
- package/build/esm/components/BlockBase/BlockBase.d.ts +3 -2
- package/build/esm/components/BlockBase/BlockBase.js +4 -2
- package/build/esm/components/Button/Button.css +3 -0
- package/build/esm/components/Button/Button.js +5 -4
- package/build/esm/components/Image/Image.d.ts +1 -0
- package/build/esm/components/Image/Image.js +2 -2
- package/build/esm/containers/Loadable/Loadable.d.ts +2 -2
- package/build/esm/containers/PageConstructor/PageConstructor.js +6 -4
- package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +3 -2
- package/build/esm/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts +1 -1
- package/build/esm/containers/PageConstructor/components/ConstructorItem/ConstructorItem.js +5 -5
- package/build/esm/context/innerContext/InnerContext.d.ts +2 -1
- package/build/esm/customization/BlockDecoration.d.ts +3 -0
- package/build/esm/customization/BlockDecoration.js +17 -0
- package/build/esm/editor/Components/AddBlock/AddBlock.css +82 -0
- package/build/esm/editor/Components/AddBlock/AddBlock.d.ts +8 -0
- package/build/esm/editor/Components/AddBlock/AddBlock.js +41 -0
- package/build/esm/editor/Components/EditBlock/EditBlock.css +47 -0
- package/build/esm/editor/Components/EditBlock/EditBlock.d.ts +5 -0
- package/build/esm/editor/Components/EditBlock/EditBlock.js +30 -0
- package/build/esm/editor/Containers/Editor.d.ts +2 -0
- package/build/esm/editor/Containers/Editor.js +20 -0
- package/build/esm/editor/data/index.d.ts +13 -0
- package/build/esm/editor/data/index.js +24 -0
- package/build/esm/editor/data/previews/default-preview.d.ts +3 -0
- package/build/esm/editor/data/previews/default-preview.js +15 -0
- package/build/esm/editor/data/previews/header-block.d.ts +3 -0
- package/build/esm/editor/data/previews/header-block.js +16 -0
- package/build/esm/editor/index.d.ts +2 -0
- package/build/esm/editor/index.js +2 -0
- package/build/esm/editor/store/index.d.ts +15 -0
- package/build/esm/editor/store/index.js +28 -0
- package/build/esm/editor/store/reducer.d.ts +41 -0
- package/build/esm/editor/store/reducer.js +55 -0
- package/build/esm/editor/store/utils.d.ts +13 -0
- package/build/esm/editor/store/utils.js +26 -0
- package/build/esm/editor/styles/mixins.css +0 -0
- package/build/esm/editor/styles/variables.css +0 -0
- package/build/esm/editor/types/index.d.ts +17 -0
- package/build/esm/editor/utils/index.d.ts +11 -0
- package/build/esm/editor/utils/index.js +6 -0
- package/build/esm/grid/Col/Col.d.ts +1 -1
- package/build/esm/hooks/useMetrika.js +0 -7
- package/build/esm/internal-typings/global.d.ts +18 -16
- package/build/esm/models/constructor-items/blocks.d.ts +1 -11
- package/build/esm/models/constructor-items/blocks.js +0 -2
- package/build/esm/models/constructor-items/common.d.ts +3 -3
- package/build/esm/models/constructor.d.ts +4 -1
- package/build/esm/models/customization.d.ts +9 -0
- package/build/esm/models/index.d.ts +1 -0
- package/build/esm/models/index.js +1 -0
- package/build/esm/sub-blocks/HubspotForm/HubspotFormContainer.d.ts +2 -1
- package/build/esm/sub-blocks/HubspotForm/HubspotFormContainer.js +6 -3
- package/build/esm/sub-blocks/HubspotForm/index.d.ts +1 -1
- package/build/esm/sub-blocks/HubspotForm/index.js +7 -6
- package/build/esm/utils/blocks.d.ts +4 -1
- package/build/esm/utils/blocks.js +7 -0
- package/package.json +4 -3
- package/server/models/constructor-items/blocks.d.ts +1 -11
- package/server/models/constructor-items/blocks.js +0 -2
- package/server/models/constructor-items/common.d.ts +3 -3
- package/server/models/constructor.d.ts +4 -1
- package/server/models/customization.d.ts +9 -0
- package/server/models/customization.js +2 -0
- package/server/models/index.d.ts +1 -0
- package/server/models/index.js +1 -0
- package/server/utils/blocks.d.ts +4 -1
- package/server/utils/blocks.js +11 -1
- package/build/cjs/components/Anchor/__tests__/Anchor.test.js +0 -21
- package/build/cjs/components/AnimateBlock/__tests__/AnimateBlock.test.js +0 -36
- package/build/cjs/components/Author/__tests__/Author.test.d.ts +0 -1
- package/build/cjs/components/Author/__tests__/Author.test.js +0 -49
- package/build/cjs/components/BackLink/__tests__/BackLink.test.d.ts +0 -1
- package/build/cjs/components/BackLink/__tests__/BackLink.test.js +0 -63
- package/build/cjs/components/BlockBase/__tests__/BlockBase.test.d.ts +0 -1
- package/build/cjs/components/BlockBase/__tests__/BlockBase.test.js +0 -44
- package/build/cjs/components/Button/__tests__/Button.test.d.ts +0 -1
- package/build/cjs/components/Button/__tests__/Button.test.js +0 -91
- package/build/cjs/components/ButtonTabs/__tests__/ButtonTabs.test.d.ts +0 -1
- package/build/cjs/components/ButtonTabs/__tests__/ButtonTabs.test.js +0 -58
- package/build/esm/components/Anchor/__tests__/Anchor.test.d.ts +0 -1
- package/build/esm/components/Anchor/__tests__/Anchor.test.js +0 -18
- package/build/esm/components/AnimateBlock/__tests__/AnimateBlock.test.d.ts +0 -1
- package/build/esm/components/AnimateBlock/__tests__/AnimateBlock.test.js +0 -33
- package/build/esm/components/Author/__tests__/Author.test.d.ts +0 -1
- package/build/esm/components/Author/__tests__/Author.test.js +0 -46
- package/build/esm/components/BackLink/__tests__/BackLink.test.d.ts +0 -1
- package/build/esm/components/BackLink/__tests__/BackLink.test.js +0 -60
- package/build/esm/components/BlockBase/__tests__/BlockBase.test.d.ts +0 -1
- package/build/esm/components/BlockBase/__tests__/BlockBase.test.js +0 -41
- package/build/esm/components/Button/__tests__/Button.test.d.ts +0 -1
- package/build/esm/components/Button/__tests__/Button.test.js +0 -88
- package/build/esm/components/ButtonTabs/__tests__/ButtonTabs.test.d.ts +0 -1
- package/build/esm/components/ButtonTabs/__tests__/ButtonTabs.test.js +0 -55
- /package/build/{cjs/components/Anchor/__tests__/Anchor.test.d.ts → esm/editor/types/index.js} +0 -0
- /package/build/{cjs/components/AnimateBlock/__tests__/AnimateBlock.test.d.ts → esm/models/customization.js} +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
+
const svg_1 = require("../../../utils/svg");
|
|
6
|
+
const DefaultPreview = (props) => (react_1.default.createElement("svg", Object.assign({ width: "150", height: "76", viewBox: "0 0 150 76", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, svg_1.a11yHiddenSvgProps, props),
|
|
7
|
+
react_1.default.createElement("rect", { x: "1", y: "1", width: "148", height: "74", rx: "8", fill: "white" }),
|
|
8
|
+
react_1.default.createElement("rect", { x: "14.7674", y: "21.6512", width: "28.3953", height: "6.88372", rx: "0.860465", fill: "#E7E7E7" }),
|
|
9
|
+
react_1.default.createElement("rect", { x: "43.1628", y: "21.6512", width: "28.3953", height: "6.88372", rx: "0.860465", fill: "white" }),
|
|
10
|
+
react_1.default.createElement("rect", { x: "14.7674", y: "31.9767", width: "56.7907", height: "3.44186", rx: "0.860465", fill: "#E7E7E7" }),
|
|
11
|
+
react_1.default.createElement("rect", { x: "14.7675", y: "37.1395", width: "56.7907", height: "3.44186", rx: "0.860465", fill: "#E7E7E7" }),
|
|
12
|
+
react_1.default.createElement("rect", { x: "14.7675", y: "42.3023", width: "56.7907", height: "3.44186", rx: "0.860465", fill: "#E7E7E7" }),
|
|
13
|
+
react_1.default.createElement("rect", { x: "14.7674", y: "49.186", width: "18.9302", height: "5.16279", rx: "0.860465", fill: "#E7E7E7" }),
|
|
14
|
+
react_1.default.createElement("rect", { x: "33.6977", y: "49.186", width: "18.9302", height: "5.16279", rx: "0.860465", fill: "white" }),
|
|
15
|
+
react_1.default.createElement("rect", { x: "52.6279", y: "49.186", width: "18.9302", height: "5.16279", rx: "0.860465", fill: "white" }),
|
|
16
|
+
react_1.default.createElement("rect", { x: "78.4418", y: "9.60464", width: "56.7907", height: "56.7907", rx: "5.16279", fill: "#A967FF" }),
|
|
17
|
+
react_1.default.createElement("rect", { x: "0.5", y: "0.5", width: "149", height: "75", rx: "8.5", stroke: "black", strokeOpacity: "0.1" })));
|
|
18
|
+
exports.default = DefaultPreview;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
+
const svg_1 = require("../../../utils/svg");
|
|
6
|
+
const Header = (props) => (react_1.default.createElement("svg", Object.assign({ width: "150", height: "76", viewBox: "0 0 150 76", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, svg_1.a11yHiddenSvgProps, props),
|
|
7
|
+
react_1.default.createElement("rect", { x: "1", y: "1", width: "148", height: "74", rx: "8", fill: "white" }),
|
|
8
|
+
react_1.default.createElement("rect", { x: "4.44174", y: "9.60464", width: "141.116", height: "56.7907", rx: "5.16279", fill: "#A967FF" }),
|
|
9
|
+
react_1.default.createElement("rect", { x: "14.7674", y: "21.6512", width: "28.3953", height: "6.88372", rx: "0.860465", fill: "white" }),
|
|
10
|
+
react_1.default.createElement("rect", { x: "43.1628", y: "21.6512", width: "28.3953", height: "6.88372", rx: "0.860465", fill: "#A967FF" }),
|
|
11
|
+
react_1.default.createElement("rect", { x: "14.7674", y: "31.9767", width: "56.7907", height: "3.44186", rx: "0.860465", fill: "white" }),
|
|
12
|
+
react_1.default.createElement("rect", { x: "14.7674", y: "37.1395", width: "56.7907", height: "3.44186", rx: "0.860465", fill: "white" }),
|
|
13
|
+
react_1.default.createElement("rect", { x: "14.7674", y: "42.3023", width: "56.7907", height: "3.44186", rx: "0.860465", fill: "white" }),
|
|
14
|
+
react_1.default.createElement("rect", { x: "14.7674", y: "49.186", width: "18.9302", height: "5.16279", rx: "0.860465", fill: "white" }),
|
|
15
|
+
react_1.default.createElement("rect", { x: "33.6976", y: "49.186", width: "18.9302", height: "5.16279", rx: "0.860465", fill: "#A967FF" }),
|
|
16
|
+
react_1.default.createElement("rect", { x: "52.6279", y: "49.186", width: "18.9302", height: "5.16279", rx: "0.860465", fill: "#A967FF" }),
|
|
17
|
+
react_1.default.createElement("rect", { x: "78.4418", y: "9.60464", width: "56.7907", height: "56.7907", rx: "5.16279", fill: "#A967FF" }),
|
|
18
|
+
react_1.default.createElement("rect", { x: "0.5", y: "0.5", width: "149", height: "75", rx: "8.5", stroke: "black", strokeOpacity: "0.1" })));
|
|
19
|
+
exports.default = Header;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Editor = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
var Editor_1 = require("./Containers/Editor");
|
|
6
|
+
Object.defineProperty(exports, "Editor", { enumerable: true, get: function () { return Editor_1.Editor; } });
|
|
7
|
+
tslib_1.__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Block } from '../../models';
|
|
2
|
+
import { EditorProps } from '../types';
|
|
3
|
+
export type EditorBlockId = number | string;
|
|
4
|
+
export declare function useEditorState({ content: intialContent, custom }: Omit<EditorProps, 'children'>): {
|
|
5
|
+
content: import("../../models").PageContent;
|
|
6
|
+
editControlsProps: {
|
|
7
|
+
activeBlockId: import("./reducer").EditorBlockId;
|
|
8
|
+
orderedBlocksCount: number;
|
|
9
|
+
onDelete: (id: EditorBlockId) => void;
|
|
10
|
+
onSelect: (id: EditorBlockId) => void;
|
|
11
|
+
onCopy: (index: number) => void;
|
|
12
|
+
onOrderChange: (oldIndex: number, newIndex: number) => void;
|
|
13
|
+
};
|
|
14
|
+
onAdd: (block: Block) => void;
|
|
15
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useEditorState = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
const utils_1 = require("../../utils");
|
|
7
|
+
const reducer_1 = require("./reducer");
|
|
8
|
+
const utils_2 = require("./utils");
|
|
9
|
+
function useEditorState({ content: intialContent, custom }) {
|
|
10
|
+
const headerBlockTypes = (0, react_1.useMemo)(() => [...models_1.HeaderBlockTypes, ...(0, utils_1.getCustomHeaderTypes)(custom)], [custom]);
|
|
11
|
+
const reducer = (0, react_1.useMemo)(() => (0, reducer_1.getReducer)(headerBlockTypes), [headerBlockTypes]);
|
|
12
|
+
const [{ activeBlockId, content, orderedBlocksCount }, dispatch] = (0, react_1.useReducer)(reducer, {
|
|
13
|
+
activeBlockId: 0,
|
|
14
|
+
orderedBlocksCount: (0, utils_1.getOrderedBlocks)(intialContent.blocks, headerBlockTypes).length,
|
|
15
|
+
content: (0, utils_2.addEditorProps)(intialContent),
|
|
16
|
+
});
|
|
17
|
+
return (0, react_1.useMemo)(() => {
|
|
18
|
+
return {
|
|
19
|
+
content,
|
|
20
|
+
editControlsProps: {
|
|
21
|
+
activeBlockId,
|
|
22
|
+
orderedBlocksCount,
|
|
23
|
+
onDelete: (id) => dispatch({ type: reducer_1.DELETE_BLOCK, payload: id }),
|
|
24
|
+
onSelect: (id) => dispatch({ type: reducer_1.SELECT_BLOCK, payload: id }),
|
|
25
|
+
onCopy: (index) => dispatch({ type: reducer_1.COPY_BLOCK, payload: index }),
|
|
26
|
+
onOrderChange: (oldIndex, newIndex) => dispatch({ type: reducer_1.ORDER_BLOCK, payload: { oldIndex, newIndex } }),
|
|
27
|
+
},
|
|
28
|
+
onAdd: (block) => dispatch({ type: reducer_1.ADD_BLOCK, payload: block }),
|
|
29
|
+
};
|
|
30
|
+
}, [content, activeBlockId, orderedBlocksCount]);
|
|
31
|
+
}
|
|
32
|
+
exports.useEditorState = useEditorState;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Block, CustomConfig, PageContent } from '../../models';
|
|
2
|
+
export type EditorBlockId = number | string;
|
|
3
|
+
interface EditorState {
|
|
4
|
+
content: PageContent;
|
|
5
|
+
activeBlockId: EditorBlockId;
|
|
6
|
+
orderedBlocksCount: number;
|
|
7
|
+
custom?: CustomConfig;
|
|
8
|
+
}
|
|
9
|
+
interface OrderBlockParams {
|
|
10
|
+
oldIndex: number;
|
|
11
|
+
newIndex: number;
|
|
12
|
+
}
|
|
13
|
+
export declare const SELECT_BLOCK = "SELECT_BLOCK";
|
|
14
|
+
export declare const DELETE_BLOCK = "DELETE_BLOCK";
|
|
15
|
+
export declare const COPY_BLOCK = "COPY_BLOCK";
|
|
16
|
+
export declare const ADD_BLOCK = "ADD_BLOCK";
|
|
17
|
+
export declare const SET_REGION = "SET_REGION";
|
|
18
|
+
export declare const ORDER_BLOCK = "ORDER_BLOCK";
|
|
19
|
+
interface SelectBlock {
|
|
20
|
+
type: typeof SELECT_BLOCK;
|
|
21
|
+
payload: EditorBlockId;
|
|
22
|
+
}
|
|
23
|
+
interface DeleteBlock {
|
|
24
|
+
type: typeof DELETE_BLOCK;
|
|
25
|
+
payload: EditorBlockId;
|
|
26
|
+
}
|
|
27
|
+
interface CopyBlock {
|
|
28
|
+
type: typeof COPY_BLOCK;
|
|
29
|
+
payload: number;
|
|
30
|
+
}
|
|
31
|
+
interface AddBlock {
|
|
32
|
+
type: typeof ADD_BLOCK;
|
|
33
|
+
payload: Block;
|
|
34
|
+
}
|
|
35
|
+
interface OrderBlock {
|
|
36
|
+
type: typeof ORDER_BLOCK;
|
|
37
|
+
payload: OrderBlockParams;
|
|
38
|
+
}
|
|
39
|
+
export type EditorAction = SelectBlock | DeleteBlock | CopyBlock | AddBlock | OrderBlock;
|
|
40
|
+
export declare const getReducer: (headerBlockTypes: string[]) => (state: EditorState, action: EditorAction) => EditorState;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getReducer = exports.ORDER_BLOCK = exports.SET_REGION = exports.ADD_BLOCK = exports.COPY_BLOCK = exports.DELETE_BLOCK = exports.SELECT_BLOCK = void 0;
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
5
|
+
const utils_2 = require("./utils");
|
|
6
|
+
// actions
|
|
7
|
+
exports.SELECT_BLOCK = 'SELECT_BLOCK';
|
|
8
|
+
exports.DELETE_BLOCK = 'DELETE_BLOCK';
|
|
9
|
+
exports.COPY_BLOCK = 'COPY_BLOCK';
|
|
10
|
+
exports.ADD_BLOCK = 'ADD_BLOCK';
|
|
11
|
+
exports.SET_REGION = 'SET_REGION';
|
|
12
|
+
exports.ORDER_BLOCK = 'ORDER_BLOCK';
|
|
13
|
+
// reducer
|
|
14
|
+
const getReducer = (headerBlockTypes) => (state, action) => {
|
|
15
|
+
const { content } = state;
|
|
16
|
+
const header = (0, utils_1.getHeaderBlock)(content.blocks, headerBlockTypes);
|
|
17
|
+
const orderedBlocks = (0, utils_1.getOrderedBlocks)(content.blocks, headerBlockTypes);
|
|
18
|
+
const withHeader = (blocks) => [header, ...blocks].filter(Boolean);
|
|
19
|
+
const getNewState = (blocks, activeBlockId) => (Object.assign(Object.assign({}, state), { content: Object.assign(Object.assign({}, content), { blocks }), activeBlockId, orderedBlocksCount: orderedBlocks.length }));
|
|
20
|
+
switch (action.type) {
|
|
21
|
+
case exports.SELECT_BLOCK:
|
|
22
|
+
return getNewState(content.blocks, action.payload);
|
|
23
|
+
case exports.DELETE_BLOCK: {
|
|
24
|
+
const blockId = action.payload;
|
|
25
|
+
return getNewState(typeof blockId === 'string'
|
|
26
|
+
? content.blocks.filter(({ type }) => type !== blockId)
|
|
27
|
+
: withHeader(orderedBlocks.filter((_block, index) => index !== blockId)), -1);
|
|
28
|
+
}
|
|
29
|
+
case exports.COPY_BLOCK: {
|
|
30
|
+
const index = action.payload;
|
|
31
|
+
return getNewState(withHeader((0, utils_2.duplicateBlock)(orderedBlocks, index)), index + 1);
|
|
32
|
+
}
|
|
33
|
+
case exports.ADD_BLOCK: {
|
|
34
|
+
let blocks;
|
|
35
|
+
let activeBlockId;
|
|
36
|
+
const block = action.payload;
|
|
37
|
+
if (headerBlockTypes.includes(block.type)) {
|
|
38
|
+
blocks = header ? blocks : [block, ...orderedBlocks];
|
|
39
|
+
activeBlockId = block.type;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
const newBlockIndex = (0, utils_2.getNewBlockIndex)(state.activeBlockId, orderedBlocks.length);
|
|
43
|
+
blocks = withHeader((0, utils_2.addBlock)(orderedBlocks, block, newBlockIndex));
|
|
44
|
+
activeBlockId = newBlockIndex;
|
|
45
|
+
}
|
|
46
|
+
if (blocks) {
|
|
47
|
+
return getNewState(blocks, activeBlockId);
|
|
48
|
+
}
|
|
49
|
+
return state;
|
|
50
|
+
}
|
|
51
|
+
case exports.ORDER_BLOCK: {
|
|
52
|
+
const { oldIndex, newIndex } = action.payload;
|
|
53
|
+
return getNewState(withHeader((0, utils_2.changeBlocksOrder)(orderedBlocks, oldIndex, newIndex)), newIndex);
|
|
54
|
+
}
|
|
55
|
+
default:
|
|
56
|
+
return state;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
exports.getReducer = getReducer;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Block, PageContent } from '../../models';
|
|
2
|
+
import { EditorBlockId } from './reducer';
|
|
3
|
+
export declare const changeBlocksOrder: (array: Block[], oldIndex: number, newIndex: number) => Block[];
|
|
4
|
+
export declare const duplicateBlock: (array: Block[], index: number) => Block[];
|
|
5
|
+
export declare const getNewBlockIndex: (id: EditorBlockId, orderedBlocksCount: number) => number;
|
|
6
|
+
export declare const addBlock: (array: Block[], block: Block, index: number) => Block[];
|
|
7
|
+
export declare const addEditorProps: (content: PageContent) => {
|
|
8
|
+
animated: boolean;
|
|
9
|
+
blocks: Block[];
|
|
10
|
+
menu?: import("../../models").Menu | undefined;
|
|
11
|
+
background?: import("../../models").ThemedMediaProps | undefined;
|
|
12
|
+
footnotes?: string[] | undefined;
|
|
13
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addEditorProps = exports.addBlock = exports.getNewBlockIndex = exports.duplicateBlock = exports.changeBlocksOrder = void 0;
|
|
4
|
+
const changeBlocksOrder = (array, oldIndex, newIndex) => {
|
|
5
|
+
const result = [...array];
|
|
6
|
+
const element = result.splice(oldIndex, 1)[0];
|
|
7
|
+
result.splice(newIndex, 0, element);
|
|
8
|
+
return result;
|
|
9
|
+
};
|
|
10
|
+
exports.changeBlocksOrder = changeBlocksOrder;
|
|
11
|
+
const duplicateBlock = (array, index) => {
|
|
12
|
+
const result = [...array];
|
|
13
|
+
result.splice(index + 1, 0, result[index]);
|
|
14
|
+
return result;
|
|
15
|
+
};
|
|
16
|
+
exports.duplicateBlock = duplicateBlock;
|
|
17
|
+
const getNewBlockIndex = (id, orderedBlocksCount) => {
|
|
18
|
+
if (id === -1) {
|
|
19
|
+
return orderedBlocksCount;
|
|
20
|
+
}
|
|
21
|
+
// id === 'string' - header block
|
|
22
|
+
return typeof id === 'string' ? 0 : id + 1;
|
|
23
|
+
};
|
|
24
|
+
exports.getNewBlockIndex = getNewBlockIndex;
|
|
25
|
+
const addBlock = (array, block, index) => {
|
|
26
|
+
const result = [...array];
|
|
27
|
+
result.splice(index, 0, block);
|
|
28
|
+
return result;
|
|
29
|
+
};
|
|
30
|
+
exports.addBlock = addBlock;
|
|
31
|
+
const addEditorProps = (content) => {
|
|
32
|
+
return Object.assign(Object.assign({}, content), { animated: false });
|
|
33
|
+
};
|
|
34
|
+
exports.addEditorProps = addEditorProps;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PageConstructorProps } from '../../containers/PageConstructor';
|
|
3
|
+
import { BlockDecoratorProps, PageData } from '../../models';
|
|
4
|
+
export type EditorBlockId = number | string;
|
|
5
|
+
export interface EditorProps extends Required<Pick<PageConstructorProps, 'content'>>, Partial<Omit<PageConstructorProps, 'content'>> {
|
|
6
|
+
children: (props: Partial<PageConstructorProps>) => React.ReactNode;
|
|
7
|
+
onChange?: (data: PageData) => void;
|
|
8
|
+
}
|
|
9
|
+
export interface EditBlockEditorProps {
|
|
10
|
+
activeBlockId: EditorBlockId;
|
|
11
|
+
orderedBlocksCount: number;
|
|
12
|
+
onSelect: (index: EditorBlockId) => void;
|
|
13
|
+
onDelete: (index: EditorBlockId) => void;
|
|
14
|
+
onCopy: (index: number) => void;
|
|
15
|
+
onOrderChange: (index: number, newIndex: number) => void;
|
|
16
|
+
}
|
|
17
|
+
export type EditBlockProps = EditBlockEditorProps & BlockDecoratorProps;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BlockDecorator, CustomConfig } from '../../models';
|
|
2
|
+
export declare const formatBlockName: (name: string) => string;
|
|
3
|
+
export declare const addCustomDecorator: (decorator: BlockDecorator, custom?: CustomConfig) => {
|
|
4
|
+
decorators: {
|
|
5
|
+
block: ((props: import("../../models").BlockDecoratorProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>)[];
|
|
6
|
+
};
|
|
7
|
+
blocks?: import("../../models").CustomItems | undefined;
|
|
8
|
+
subBlocks?: import("../../models").CustomItems | undefined;
|
|
9
|
+
headers?: import("../../models").CustomItems | undefined;
|
|
10
|
+
loadable?: import("../../models").LoadableConfig | undefined;
|
|
11
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addCustomDecorator = exports.formatBlockName = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
6
|
+
const formatBlockName = (name) => lodash_1.default.capitalize(name).replace(/(block|-)/g, ' ');
|
|
7
|
+
exports.formatBlockName = formatBlockName;
|
|
8
|
+
const addCustomDecorator = (decorator, custom = {}) => {
|
|
9
|
+
const decorators = custom.decorators || {};
|
|
10
|
+
return Object.assign(Object.assign({}, custom), { decorators: Object.assign(Object.assign({}, decorators), { block: [...(decorators.block || []), decorator] }) });
|
|
11
|
+
};
|
|
12
|
+
exports.addCustomDecorator = addCustomDecorator;
|
|
@@ -7,4 +7,4 @@ export interface GridColumnProps extends GridColumnClassParams, Refable<HTMLDivE
|
|
|
7
7
|
dataQa?: string;
|
|
8
8
|
children?: React.ReactNode;
|
|
9
9
|
}
|
|
10
|
-
export declare const Col: React.ForwardRefExoticComponent<Pick<WithChildren<GridColumnProps>, "style" | "children" | "className" | "
|
|
10
|
+
export declare const Col: React.ForwardRefExoticComponent<Pick<WithChildren<GridColumnProps>, "style" | "children" | "className" | "reset" | "visible" | "sizes" | "offsets" | "orders" | "hidden" | "alignSelf" | "justifyContent" | "dataQa"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useMetrika = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const metrikaContext_1 = require("../context/metrikaContext");
|
|
6
|
-
const models_1 = require("../models");
|
|
7
6
|
const guards_1 = require("../models/guards");
|
|
8
7
|
// eslint-disable-next-line valid-jsdoc
|
|
9
8
|
/**
|
|
@@ -29,12 +28,6 @@ const useMetrika = () => {
|
|
|
29
28
|
else {
|
|
30
29
|
metrika.reachGoals(metrikaGoals);
|
|
31
30
|
}
|
|
32
|
-
if (!pixelEvents && pixel) {
|
|
33
|
-
pixel.trackStandard(models_1.PixelEventType.SubmitApplication, {
|
|
34
|
-
content_category: 'custom',
|
|
35
|
-
content_ids: Array.isArray(metrikaGoals) ? metrikaGoals : [metrikaGoals],
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
31
|
}
|
|
39
32
|
if (pixel && pixelEvents) {
|
|
40
33
|
if (isButtonPixel(pixelEvents)) {
|
|
@@ -10,22 +10,17 @@ declare module '*.svg' {
|
|
|
10
10
|
export default path;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
portalId: string;
|
|
15
|
-
formId: string;
|
|
16
|
-
region?: string;
|
|
17
|
-
target?: string;
|
|
18
|
-
cssClass?: string;
|
|
19
|
-
formInstanceId?: string;
|
|
20
|
-
}
|
|
13
|
+
declare module '*.md';
|
|
21
14
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
declare namespace Hbspt {
|
|
16
|
+
interface CreateFormProps {
|
|
17
|
+
portalId: string;
|
|
18
|
+
formId: string;
|
|
19
|
+
region?: string;
|
|
20
|
+
target?: string;
|
|
21
|
+
cssClass?: string;
|
|
22
|
+
formInstanceId?: string;
|
|
23
|
+
}
|
|
29
24
|
}
|
|
30
25
|
|
|
31
26
|
declare namespace Ymaps {
|
|
@@ -63,4 +58,11 @@ declare namespace Ymaps {
|
|
|
63
58
|
}
|
|
64
59
|
}
|
|
65
60
|
|
|
66
|
-
|
|
61
|
+
interface Window {
|
|
62
|
+
hbspt?: {
|
|
63
|
+
forms: {
|
|
64
|
+
create: (args: Hbspt.CreateFormProps) => unknown;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
ymaps: Ymaps;
|
|
68
|
+
}
|
|
@@ -8,8 +8,6 @@ export declare enum BlockType {
|
|
|
8
8
|
PromoFeaturesBlock = "promo-features-block",
|
|
9
9
|
ExtendedFeaturesBlock = "extended-features-block",
|
|
10
10
|
SliderBlock = "slider-block",
|
|
11
|
-
CalculatorBlock = "calculator-block",
|
|
12
|
-
ServiceDemoBlock = "service-demo-block",
|
|
13
11
|
QuestionsBlock = "questions-block",
|
|
14
12
|
BannerBlock = "banner-block",
|
|
15
13
|
CompaniesBlock = "companies-block",
|
|
@@ -52,7 +50,6 @@ export interface LoadableProps {
|
|
|
52
50
|
export interface LoadableChildren {
|
|
53
51
|
loadable?: LoadableProps;
|
|
54
52
|
}
|
|
55
|
-
export type ServiceDemoProps = Animatable;
|
|
56
53
|
export declare enum SliderBreakpointNames {
|
|
57
54
|
Sm = "sm",
|
|
58
55
|
Md = "md",
|
|
@@ -114,7 +111,6 @@ export interface HeaderBlockProps {
|
|
|
114
111
|
breadcrumbs?: HeaderBreadCrumbsProps;
|
|
115
112
|
status?: JSX.Element;
|
|
116
113
|
}
|
|
117
|
-
export type CalculatorProps = Animatable;
|
|
118
114
|
export interface SimpleBlockProps extends Animatable, Childable {
|
|
119
115
|
title: TitleBaseProps;
|
|
120
116
|
description: string;
|
|
@@ -317,15 +313,9 @@ export interface ShareBlockProps {
|
|
|
317
313
|
export type HeaderBlockModel = {
|
|
318
314
|
type: BlockType.HeaderBlock;
|
|
319
315
|
} & HeaderBlockProps;
|
|
320
|
-
export type CalculatorBlockModel = {
|
|
321
|
-
type: BlockType.CalculatorBlock;
|
|
322
|
-
} & CalculatorProps;
|
|
323
316
|
export type SliderBlockModel = {
|
|
324
317
|
type: BlockType.SliderBlock;
|
|
325
318
|
} & SliderProps;
|
|
326
|
-
export type ServiceDemoBlockModel = {
|
|
327
|
-
type: BlockType.ServiceDemoBlock;
|
|
328
|
-
} & ServiceDemoProps;
|
|
329
319
|
export type ExtendedFeaturesBlockModel = {
|
|
330
320
|
type: BlockType.ExtendedFeaturesBlock;
|
|
331
321
|
} & ExtendedFeaturesProps;
|
|
@@ -386,6 +376,6 @@ export type ContentLayoutBlockModel = {
|
|
|
386
376
|
export type ShareBLockModel = {
|
|
387
377
|
type: BlockType.ShareBlock;
|
|
388
378
|
} & ShareBlockProps;
|
|
389
|
-
type BlockModels = SliderBlockModel |
|
|
379
|
+
type BlockModels = SliderBlockModel | ExtendedFeaturesBlockModel | PromoFeaturesBlockModel | QuestionsBlockModel | BannerBlockModel | CompaniesBlockModel | MediaBlockModel | MapBlockModel | InfoBlockModel | SecurityBlockModel | TableBlockModel | TabsBlockModel | SimpleBlockModel | LinkTableBlockModel | HeaderBlockModel | PreviewBlockModel | IconsBlockModel | HeaderSliderBlockModel | CardLayoutBlockModel | ContentLayoutBlockModel | ShareBLockModel | FilterBlockModel;
|
|
390
380
|
export type Block = BlockModels & BlockBaseProps;
|
|
391
381
|
export {};
|
|
@@ -6,8 +6,6 @@ var BlockType;
|
|
|
6
6
|
BlockType["PromoFeaturesBlock"] = "promo-features-block";
|
|
7
7
|
BlockType["ExtendedFeaturesBlock"] = "extended-features-block";
|
|
8
8
|
BlockType["SliderBlock"] = "slider-block";
|
|
9
|
-
BlockType["CalculatorBlock"] = "calculator-block";
|
|
10
|
-
BlockType["ServiceDemoBlock"] = "service-demo-block";
|
|
11
9
|
BlockType["QuestionsBlock"] = "questions-block";
|
|
12
10
|
BlockType["BannerBlock"] = "banner-block";
|
|
13
11
|
BlockType["CompaniesBlock"] = "companies-block";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ButtonView, ButtonProps as UikitButtonProps } from '@gravity-ui/uikit';
|
|
3
3
|
import { ThemeSupporting } from '../../utils/theme';
|
|
4
4
|
import { AnalyticsEventsBase, ClassNameProps, PixelEventType } from '../common';
|
|
5
5
|
export declare enum AuthorType {
|
|
@@ -99,6 +99,7 @@ export interface BackgroundImageProps extends React.HTMLProps<HTMLDivElement>, P
|
|
|
99
99
|
style?: CSSProperties;
|
|
100
100
|
imageClassName?: string;
|
|
101
101
|
hide?: boolean;
|
|
102
|
+
qa?: string;
|
|
102
103
|
}
|
|
103
104
|
export interface MediaVideoProps extends AnalyticsEventsBase {
|
|
104
105
|
src: string[];
|
|
@@ -131,11 +132,10 @@ export interface FileLinkProps extends ClassNameProps {
|
|
|
131
132
|
onClick?: () => void;
|
|
132
133
|
}
|
|
133
134
|
export type ButtonTheme = ButtonView | 'github' | 'app-store' | 'google-play' | 'scale' | 'monochrome';
|
|
134
|
-
export interface ButtonProps extends AnalyticsEventsBase {
|
|
135
|
+
export interface ButtonProps extends AnalyticsEventsBase, Pick<UikitButtonProps, 'size' | 'width'> {
|
|
135
136
|
text: string;
|
|
136
137
|
url: string;
|
|
137
138
|
primary?: boolean;
|
|
138
|
-
size?: ButtonSize;
|
|
139
139
|
theme?: ButtonTheme;
|
|
140
140
|
img?: ButtonImageProps | string;
|
|
141
141
|
metrikaGoals?: MetrikaGoal;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from 'react';
|
|
2
|
-
import { Animatable, Block, ConstructorItem, ThemedMediaProps, WithChildren } from './';
|
|
2
|
+
import { Animatable, Block, BlockDecoratorProps, ConstructorItem, ThemedMediaProps, WithChildren } from './';
|
|
3
3
|
export interface PageData {
|
|
4
4
|
content: PageContent;
|
|
5
5
|
}
|
|
@@ -41,5 +41,8 @@ export interface CustomConfig {
|
|
|
41
41
|
subBlocks?: CustomItems;
|
|
42
42
|
headers?: CustomItems;
|
|
43
43
|
loadable?: LoadableConfig;
|
|
44
|
+
decorators?: {
|
|
45
|
+
block?: ((props: BlockDecoratorProps) => React.ReactElement)[];
|
|
46
|
+
};
|
|
44
47
|
}
|
|
45
48
|
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
export interface BlockDecorationProps extends PropsWithChildren {
|
|
3
|
+
id?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface BlockDecoratorProps extends PropsWithChildren {
|
|
6
|
+
id: string | number;
|
|
7
|
+
isHeader?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export type BlockDecorator = (props: BlockDecoratorProps) => React.ReactElement;
|
|
@@ -8,3 +8,4 @@ tslib_1.__exportStar(require("./components"), exports);
|
|
|
8
8
|
tslib_1.__exportStar(require("./guards"), exports);
|
|
9
9
|
tslib_1.__exportStar(require("./react"), exports);
|
|
10
10
|
tslib_1.__exportStar(require("./navigation"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./customization"), exports);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { HubspotFormProps } from '../../models';
|
|
2
3
|
type HubspotFormContainerPropsKeys = 'className' | 'formId' | 'formInstanceId' | 'portalId' | 'region' | 'formClassName' | 'createDOMElement';
|
|
3
4
|
type HubspotFormContainerProps = Pick<HubspotFormProps, HubspotFormContainerPropsKeys>;
|
|
4
|
-
declare const HubspotFormContainer:
|
|
5
|
+
declare const HubspotFormContainer: React.ForwardRefExoticComponent<HubspotFormContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
5
6
|
export default HubspotFormContainer;
|
|
@@ -4,10 +4,12 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const hooks_1 = require("../../hooks");
|
|
6
6
|
const loadHubspotScript_1 = tslib_1.__importDefault(require("./loadHubspotScript"));
|
|
7
|
-
const HubspotFormContainer = (props) => {
|
|
7
|
+
const HubspotFormContainer = (0, react_1.forwardRef)((props, ref) => {
|
|
8
8
|
const { className, formId, formInstanceId, portalId, region, formClassName, createDOMElement, } = props;
|
|
9
9
|
const containerRef = (0, react_1.useRef)(null);
|
|
10
10
|
const hsContainerRef = (0, react_1.useRef)();
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
12
|
+
(0, react_1.useImperativeHandle)(ref, () => containerRef.current);
|
|
11
13
|
const containerId = formInstanceId
|
|
12
14
|
? `hubspot-form-${formId}-${formInstanceId}`
|
|
13
15
|
: `hubspot-form-${formId}`;
|
|
@@ -45,5 +47,6 @@ const HubspotFormContainer = (props) => {
|
|
|
45
47
|
};
|
|
46
48
|
});
|
|
47
49
|
return react_1.default.createElement("div", { className: className, id: containerId, ref: containerRef });
|
|
48
|
-
};
|
|
50
|
+
});
|
|
51
|
+
HubspotFormContainer.displayName = 'HubspotFormContainer';
|
|
49
52
|
exports.default = HubspotFormContainer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { HubspotFormProps } from '../../models';
|
|
3
|
-
declare const HubspotForm: React.
|
|
3
|
+
declare const HubspotForm: React.ForwardRefExoticComponent<HubspotFormProps & React.RefAttributes<HTMLDivElement>>;
|
|
4
4
|
export default HubspotForm;
|
|
@@ -10,7 +10,7 @@ const models_1 = require("../../models");
|
|
|
10
10
|
const utils_1 = require("../../utils");
|
|
11
11
|
const HubspotFormContainer_1 = tslib_1.__importDefault(require("./HubspotFormContainer"));
|
|
12
12
|
const b = (0, utils_1.block)('hubspot-form');
|
|
13
|
-
const HubspotForm = (props) => {
|
|
13
|
+
const HubspotForm = (0, react_1.forwardRef)((props, ref) => {
|
|
14
14
|
const { className, theme: themeProp, isMobile: isMobileProp, formId, formInstanceId, portalId, region, formClassName, pixelEvents,
|
|
15
15
|
// hubspotEvents, // TODO: decide how to handle them
|
|
16
16
|
analyticsEvents, onBeforeSubmit, onSubmit, onBeforeLoad, onLoad, createDOMElement, onSubmitError, } = props;
|
|
@@ -25,10 +25,10 @@ const HubspotForm = (props) => {
|
|
|
25
25
|
onBeforeSubmit,
|
|
26
26
|
onLoad,
|
|
27
27
|
onSubmitError,
|
|
28
|
-
onSubmit: (
|
|
28
|
+
onSubmit: (event) => {
|
|
29
29
|
handleMetrika === null || handleMetrika === void 0 ? void 0 : handleMetrika({ pixelEvents });
|
|
30
30
|
handleAnalytics(analyticsEvents);
|
|
31
|
-
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(
|
|
31
|
+
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(event);
|
|
32
32
|
},
|
|
33
33
|
}), [
|
|
34
34
|
onBeforeLoad,
|
|
@@ -42,6 +42,7 @@ const HubspotForm = (props) => {
|
|
|
42
42
|
onSubmitError,
|
|
43
43
|
]);
|
|
44
44
|
(0, hooks_1.useHandleHubspotEvents)(handlers, formId);
|
|
45
|
-
return (react_1.default.createElement(HubspotFormContainer_1.default, { createDOMElement: createDOMElement, key: [formClassName, formId, formInstanceId, portalId, region].join(), className: b({ theme, mobile }, className), formClassName: formClassName, formId: formId, portalId: portalId, formInstanceId: formInstanceId, region: region }));
|
|
46
|
-
};
|
|
45
|
+
return (react_1.default.createElement(HubspotFormContainer_1.default, { createDOMElement: createDOMElement, key: [formClassName, formId, formInstanceId, portalId, region].join(), className: b({ theme, mobile }, className), formClassName: formClassName, formId: formId, portalId: portalId, formInstanceId: formInstanceId, region: region, ref: ref }));
|
|
46
|
+
});
|
|
47
|
+
HubspotForm.displayName = 'HubspotForm';
|
|
47
48
|
exports.default = HubspotForm;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CustomConfig, PCShareSocialNetwork, TextSize } from '../models';
|
|
1
|
+
import { Block, CustomConfig, PCShareSocialNetwork, TextSize } from '../models';
|
|
2
2
|
import { ConstructorBlock } from '../models/constructor';
|
|
3
3
|
export declare function getHeaderTag(size: TextSize): "h1" | "h2" | "h4" | "h5";
|
|
4
4
|
export declare function getBlockKey(block: ConstructorBlock, index: number): string;
|
|
@@ -8,4 +8,7 @@ export declare const getCustomItems: ({ blocks, headers, subBlocks }?: CustomCon
|
|
|
8
8
|
};
|
|
9
9
|
export declare const getCustomSubBlockTypes: (customBlocks?: CustomConfig) => string[];
|
|
10
10
|
export declare const getCustomHeaderTypes: (customBlocks?: CustomConfig) => string[];
|
|
11
|
+
export declare const getOrderedBlocks: (blocks: Block[], headerBlockTypes?: string[]) => Block[];
|
|
12
|
+
export declare const getHeaderBlock: (blocks: Block[], headerBlockTypes?: string[]) => Block | undefined;
|
|
11
13
|
export declare const getShareLink: (url: string, type: PCShareSocialNetwork, title?: string, text?: string) => string | undefined;
|
|
14
|
+
export declare const getBlockIndexFromId: (blockId?: string) => number;
|