Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
out/
node_modules/
.idea/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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');
})
Expand Down
2 changes: 1 addition & 1 deletion src/lex-web-ui-loader/css/lex-web-ui-iframe.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 0 additions & 1 deletion src/lex-web-ui-loader/js/defaults/lex-web-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export const configBase = {
iframe: {
iframeOrigin: '',
iframeSrcPath: '',
shouldLoadIframeMinimized: true,
},
};

Expand Down
9 changes: 6 additions & 3 deletions src/lex-web-ui-loader/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}

Expand Down
8 changes: 8 additions & 0 deletions src/lex-web-ui-loader/js/lib/iframe-component-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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;
}

Expand Down