PluginProbe
HubSpot All-In-One Marketing – Forms, Popups, Live Chat / 11.0.56
HubSpot All-In-One Marketing – Forms, Popups, Live Chat v11.0.56
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 / shared / Meeting / PreviewMeeting.tsx

PreviewMeeting.tsx in HubSpot All-In-One Marketing – Forms, Popups, Live Chat 11.0.56, at scripts/shared/Meeting/PreviewMeeting.tsx

32 lines 1014 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import React, { Fragment, useEffect, useRef } from 'react';
2 import UIOverlay from '../UIComponents/UIOverlay';
3 import useMeetingsScript from './hooks/useMeetingsScript';
4
5 interface IPreviewForm {
6 url: string;
7 }
8
9 export default function PreviewForm({ url }: IPreviewForm) {
10 const ready = useMeetingsScript();
11 const inputEl = useRef<HTMLDivElement>(null);
12
13 useEffect(() => {
14 if (!ready) {
15 return;
16 }
17 if (inputEl.current) {
18 inputEl.current.innerHTML = '';
19 const container = document.createElement('div');
20 container.dataset.src = `${url}?embed=true`;
21 container.classList.add('meetings-iframe-container');
22 inputEl.current.appendChild(container);
23 const embedScript = document.createElement('script');
24 embedScript.innerHTML =
25 'hbspt.meetings.create(".meetings-iframe-container");';
26 inputEl.current.appendChild(embedScript);
27 }
28 }, [url, ready, inputEl]);
29
30 return <Fragment>{url && <UIOverlay ref={inputEl}></UIOverlay>}</Fragment>;
31 }
32