Embed: Strictly type the codebase and fixes a few bugs found (#7536)

* Add strict types

* Make it array

* Make api consistent and support calOrigin in floatingPopup and modal

* Support calOrigin everywhere and fix branding config issue

* Fix styles not being uniformly applied across components

* Fix unused code
This commit is contained in:
Hariom Balhara authored and GitHub committed 2023-03-28 11:17:40 -07:00
1 parent 4f590ebbf7
commit 5fceee27fe
21 files changed
+1034 -769

No files matched your search

+2 -2
View File
@@ -11,7 +11,7 @@ type CalProps = {
debug?: boolean;
uiDebug?: boolean;
};
config?: any;
config?: Record<string, string>;
embedJsUrl?: string;
} & React.HTMLAttributes<HTMLDivElement>;
@@ -24,7 +24,7 @@ const Cal = function Cal(props: CalProps) {
const Cal = useEmbed(embedJsUrl);
const ref = useRef<HTMLDivElement>(null);
useEffect(() => {
if (!Cal || initializedRef.current) {
if (!Cal || initializedRef.current || !ref.current) {
return;
}
initializedRef.current = true;
+2 -2
View File
@@ -5,9 +5,9 @@ import EmbedSnippet from "@calcom/embed-snippet";
import Cal from "./Cal";
export const getCalApi = (): Promise<GlobalCal> =>
export const getCalApi = (embedJsUrl?: string): Promise<GlobalCal> =>
new Promise(function tryReadingFromWindow(resolve) {
EmbedSnippet();
EmbedSnippet(embedJsUrl);
const api = window.Cal;
if (!api) {
setTimeout(() => {