Fix legacy createApp factory to not override targetDomain

This commit is contained in:
Lukasz Ostrowski 2022-08-29 09:01:16 +02:00
parent 6de0675784
commit 915f6496f1
2 changed files with 8 additions and 1 deletions

View file

@ -95,6 +95,12 @@ export class AppBridge {
console.warn("document.referrer is empty");
}
if (!this.combinedOptions.targetDomain) {
console.error(
"No domain set, ensure ?domain param in iframe exist or provide in AppBridge constructor"
);
}
this.setInitialState();
this.listenOnMessages();
}

View file

@ -9,5 +9,6 @@ export * from "./types";
/**
* @deprecated use new AppBridge(), createApp will be removed
*/
export const createApp = (targetDomain?: string) => new AppBridge({ targetDomain });
export const createApp = (targetDomain?: string) =>
new AppBridge(targetDomain ? { targetDomain } : undefined);
export default createApp;