diff --git a/.gitignore b/.gitignore index ed1bf778..4b93265d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ out/ node_modules/ +.idea/ diff --git a/README.md b/README.md index 4392402a..4e04b3bf 100755 --- a/README.md +++ b/README.md @@ -314,7 +314,7 @@ page](#stand-alone-page) section. // as a JSON file or events. The configUrl variable in the // loaderOptions above can be used to put these config values in a file // instead of explicitly passing it as an argument. - var chatbotUiconfig = { + var chatbotUiConfig = { ui: { // origin of the parent site where you are including the chatbot UI // set to window.location.origin since hosting on same site @@ -337,7 +337,7 @@ page](#stand-alone-page) section. // Call the load function which returns a promise that is resolved // once the component is loaded or is rejected if there is an error - iframeLoader.load(chabotUiConfig) + iframeLoader.load(chatbotUiConfig) .then(function () { console.log('iframe loaded'); }) diff --git a/src/lex-web-ui-loader/css/lex-web-ui-iframe.css b/src/lex-web-ui-loader/css/lex-web-ui-iframe.css index b5e7ec57..4acc2f6e 100644 --- a/src/lex-web-ui-loader/css/lex-web-ui-iframe.css +++ b/src/lex-web-ui-loader/css/lex-web-ui-iframe.css @@ -44,7 +44,7 @@ and (max-width: 480px) { margin-right: 2vw; align-self: center; } - .lex-web-ui-ifame--minimize { + .lex-web-ui-iframe--minimize { min-width: 60vw; height: 48px; } diff --git a/src/lex-web-ui-loader/js/defaults/lex-web-ui.js b/src/lex-web-ui-loader/js/defaults/lex-web-ui.js index 4e0cb359..dad5f405 100644 --- a/src/lex-web-ui-loader/js/defaults/lex-web-ui.js +++ b/src/lex-web-ui-loader/js/defaults/lex-web-ui.js @@ -27,7 +27,6 @@ export const configBase = { iframe: { iframeOrigin: '', iframeSrcPath: '', - shouldLoadIframeMinimized: true, }, }; diff --git a/src/lex-web-ui-loader/js/index.js b/src/lex-web-ui-loader/js/index.js index 29a1f36e..550e919a 100644 --- a/src/lex-web-ui-loader/js/index.js +++ b/src/lex-web-ui-loader/js/index.js @@ -157,13 +157,16 @@ export class IframeLoader extends Loader { } load(configParam = {}) { - this.config.iframe = this.config.iframe || {}; - this.config.iframe.iframeSrcPath = this.mergeSrcPath(configParam); - return super.load(configParam) .then(() => { // assign API to this object to make calls more succint this.api = this.compLoader.api; + // make sure iframe and iframeSrcPath are set to values if not + // configured by standard mechanisms. At this point, default + // values from ./defaults/loader.js will be used. + this.config.iframe = this.config.iframe || {}; + this.config.iframe.iframeSrcPath = this.config.iframe.iframeSrcPath || + this.mergeSrcPath(configParam); }); } diff --git a/src/lex-web-ui-loader/js/lib/iframe-component-loader.js b/src/lex-web-ui-loader/js/lib/iframe-component-loader.js index 392ea802..a9472da2 100644 --- a/src/lex-web-ui-loader/js/lib/iframe-component-loader.js +++ b/src/lex-web-ui-loader/js/lib/iframe-component-loader.js @@ -61,6 +61,9 @@ export class IframeComponentLoader { this.config.iframe.iframeOrigin = this.config.parentOrigin || window.location.origin; } + if (iframeConfig.shouldLoadIframeMinimized === undefined) { + this.config.iframe.shouldLoadIframeMinimized = true; + } // assign parentOrigin if not found in config if (!(this.config.parentOrigin)) { this.config.parentOrigin = @@ -102,6 +105,11 @@ export class IframeComponentLoader { console.error('missing parentOrigin config field'); return false; } + if (!('shouldLoadIframeMinimized' in iframeConfig)) { + console.error('missing shouldLoadIframeMinimized config field'); + return false; + } + return true; }