PluginProbe
HubSpot All-In-One Marketing – Forms, Popups, Live Chat / 11.3.75
HubSpot All-In-One Marketing – Forms, Popups, Live Chat v11.3.75
11.3.75 11.3.73 11.3.71 11.3.70 11.3.69 11.3.64 11.3.65 11.3.62 11.3.61 11.3.56 11.3.58 11.0.31 11.0.52 11.0.54 11.0.56 11.0.58 11.0.7 11.1.10 11.1.11 11.1.13 11.1.14 11.1.15 11.1.2 11.1.20 11.1.21 All 73 releases
leadin / scripts / elementor / FormWidget / registerFormWidget.ts

registerFormWidget.ts in HubSpot All-In-One Marketing – Forms, Popups, Live Chat 11.3.75, at scripts/elementor/FormWidget/registerFormWidget.ts

46 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import ReactDOM from 'react-dom';
2 import FormControlController from './FormControlController';
3 import FormWidgetController from './FormWidgetController';
4
5 export interface IFormAttributes {
6 formId: string;
7 formName: string;
8 portalId: string;
9 embedVersion: string;
10 }
11
12 export default class registerFormWidget {
13 widgetContainer: Element;
14 attributes: IFormAttributes;
15 controlContainer: Element;
16 setValue: Function;
17
18 constructor(controlContainer: any, widgetContainer: any, setValue: Function) {
19 const attributes = widgetContainer.dataset.attributes
20 ? JSON.parse(widgetContainer.dataset.attributes)
21 : {};
22
23 this.widgetContainer = widgetContainer;
24 this.controlContainer = controlContainer;
25 this.setValue = setValue;
26 this.attributes = attributes;
27 }
28
29 render() {
30 ReactDOM.render(
31 FormWidgetController(this.attributes, this.setValue)(),
32 this.widgetContainer
33 );
34
35 ReactDOM.render(
36 FormControlController(this.attributes, this.setValue)(),
37 this.controlContainer
38 );
39 }
40
41 done() {
42 ReactDOM.unmountComponentAtNode(this.widgetContainer);
43 ReactDOM.unmountComponentAtNode(this.controlContainer);
44 }
45 }
46