Skip to content

Commit 169271b

Browse files
authored
Merge pull request #97 from aws-samples/master
merge master config fixes to development
2 parents 7dcefb0 + c4ef587 commit 169271b

File tree

6 files changed

+18
-7
lines changed

6 files changed

+18
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
out/
22
node_modules/
3+
.idea/

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ page](#stand-alone-page) section.
314314
// as a JSON file or events. The configUrl variable in the
315315
// loaderOptions above can be used to put these config values in a file
316316
// instead of explicitly passing it as an argument.
317-
var chatbotUiconfig = {
317+
var chatbotUiConfig = {
318318
ui: {
319319
// origin of the parent site where you are including the chatbot UI
320320
// set to window.location.origin since hosting on same site
@@ -337,7 +337,7 @@ page](#stand-alone-page) section.
337337
338338
// Call the load function which returns a promise that is resolved
339339
// once the component is loaded or is rejected if there is an error
340-
iframeLoader.load(chabotUiConfig)
340+
iframeLoader.load(chatbotUiConfig)
341341
.then(function () {
342342
console.log('iframe loaded');
343343
})

src/lex-web-ui-loader/css/lex-web-ui-iframe.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ and (max-width: 480px) {
4444
margin-right: 2vw;
4545
align-self: center;
4646
}
47-
.lex-web-ui-ifame--minimize {
47+
.lex-web-ui-iframe--minimize {
4848
min-width: 60vw;
4949
height: 48px;
5050
}

src/lex-web-ui-loader/js/defaults/lex-web-ui.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export const configBase = {
2727
iframe: {
2828
iframeOrigin: '',
2929
iframeSrcPath: '',
30-
shouldLoadIframeMinimized: true,
3130
},
3231
};
3332

src/lex-web-ui-loader/js/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,16 @@ export class IframeLoader extends Loader {
157157
}
158158

159159
load(configParam = {}) {
160-
this.config.iframe = this.config.iframe || {};
161-
this.config.iframe.iframeSrcPath = this.mergeSrcPath(configParam);
162-
163160
return super.load(configParam)
164161
.then(() => {
165162
// assign API to this object to make calls more succint
166163
this.api = this.compLoader.api;
164+
// make sure iframe and iframeSrcPath are set to values if not
165+
// configured by standard mechanisms. At this point, default
166+
// values from ./defaults/loader.js will be used.
167+
this.config.iframe = this.config.iframe || {};
168+
this.config.iframe.iframeSrcPath = this.config.iframe.iframeSrcPath ||
169+
this.mergeSrcPath(configParam);
167170
});
168171
}
169172

src/lex-web-ui-loader/js/lib/iframe-component-loader.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ export class IframeComponentLoader {
6161
this.config.iframe.iframeOrigin =
6262
this.config.parentOrigin || window.location.origin;
6363
}
64+
if (iframeConfig.shouldLoadIframeMinimized === undefined) {
65+
this.config.iframe.shouldLoadIframeMinimized = true;
66+
}
6467
// assign parentOrigin if not found in config
6568
if (!(this.config.parentOrigin)) {
6669
this.config.parentOrigin =
@@ -102,6 +105,11 @@ export class IframeComponentLoader {
102105
console.error('missing parentOrigin config field');
103106
return false;
104107
}
108+
if (!('shouldLoadIframeMinimized' in iframeConfig)) {
109+
console.error('missing shouldLoadIframeMinimized config field');
110+
return false;
111+
}
112+
105113
return true;
106114
}
107115

0 commit comments

Comments
 (0)