Embed: Documentation TS errors Fix, IFrame Communication Tests, Updated documentation (#2432)

This commit is contained in:
Hariom Balhara authored and GitHub committed 2022-04-08 16:59:08 +00:00
1 parent eceba51020
commit df4a41127f
10 files changed
+132 -14

No files matched your search

@@ -198,6 +198,12 @@ function getNamespace() {
const isEmbed = () => {
const namespace = getNamespace();
const _isValidNamespace = isValidNamespace(namespace);
if (parent !== window && !_isValidNamespace) {
log(
"Looks like you have iframed cal.com but not using Embed Snippet. Directly using an iframe isn't recommended."
);
}
return isValidNamespace(namespace);
};
@@ -288,7 +294,7 @@ function keepParentInformedAboutDimensionChanges() {
return;
}
if (!embedStore.windowLoadEventFired) {
sdkActionManager?.fire("windowLoadComplete", {});
sdkActionManager?.fire("__windowLoadComplete", {});
}
embedStore.windowLoadEventFired = true;
@@ -308,7 +314,7 @@ function keepParentInformedAboutDimensionChanges() {
knownIframeHeight = iframeHeight;
numDimensionChanges++;
// FIXME: This event shouldn't be subscribable by the user. Only by the SDK.
sdkActionManager?.fire("dimension-changed", {
sdkActionManager?.fire("__dimensionChanged", {
iframeHeight,
iframeWidth,
isFirstTime,
@@ -357,7 +363,7 @@ if (isBrowser) {
if (!pageStatus || pageStatus == "200") {
keepParentInformedAboutDimensionChanges();
sdkActionManager?.fire("iframeReady", {});
sdkActionManager?.fire("__iframeReady", {});
} else
sdkActionManager?.fire("linkFailed", {
code: pageStatus,
+2 -2
View File
@@ -330,7 +330,7 @@ export class Cal {
// 1. Initial iframe width and height would be according to 100% value of the parent element
// 2. Once webpage inside iframe renders, it would tell how much iframe height should be increased so that my entire content is visible without iframe scroll
// 3. Parent window would check what iframe height can be set according to parent Element
this.actionManager.on("dimension-changed", (e) => {
this.actionManager.on("__dimensionChanged", (e) => {
const { data } = e.detail;
const iframe = this.iframe!;
@@ -347,7 +347,7 @@ export class Cal {
}
});
this.actionManager.on("iframeReady", (e) => {
this.actionManager.on("__iframeReady", (e) => {
this.iframeReady = true;
this.doInIframe({ method: "parentKnowsIframeReady", arg: undefined });
this.iframeDoQueue.forEach(({ method, arg }) => {