diff --git a/gulp.d/tasks/build.js b/gulp.d/tasks/build.js index e009376b..95682349 100644 --- a/gulp.d/tasks/build.js +++ b/gulp.d/tasks/build.js @@ -30,7 +30,7 @@ module.exports = (src, dest, preview) => () => { .reduce((accum, { file: depPath, type }) => (type === 'dependency' ? accum.concat(depPath) : accum), []) .map((importedPath) => fs.stat(importedPath).then(({ mtime }) => mtime)) ).then((mtimes) => { - const newestMtime = mtimes.reduce((max, curr) => + const newestMtime = mtimes.reduce((max, curr) => (!max || curr > max ? curr : max), 0) if (newestMtime > file.stat.mtime) file.stat.mtimeMs = +(file.stat.mtime = newestMtime) }), @@ -61,7 +61,7 @@ module.exports = (src, dest, preview) => () => { // NOTE concat already uses stat from newest combined file .pipe(concat('js/site.js')), vfs - .src('js/vendor/*.js', { ...opts, read: false }) + .src('js/vendor/+([^.])?(.bundle).js', { ...opts, read: false }) .pipe( // see https://gulpjs.org/recipes/browserify-multiple-destination.html map((file, enc, next) => { @@ -92,6 +92,9 @@ module.exports = (src, dest, preview) => () => { ) .pipe(buffer()) .pipe(uglify({ output: { comments: /^!/ } })), + vfs + .src('js/vendor/*.min.js', opts) + .pipe(map((file, enc, next) => next(null, Object.assign(file, { extname: '' }, { extname: '.js' })))), vfs.src(require.resolve('jquery/dist/jquery.min.js'), opts).pipe(concat('js/vendor/jquery.js')), vfs .src(['css/site.css', 'css/vendor/docsearch.css'], { ...opts, sourcemaps }) diff --git a/gulpfile.js b/gulpfile.js index 1f6e31f0..62bf61e9 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -21,7 +21,7 @@ const task = require('./gulp.d/tasks') const glob = { all: [srcDir, previewSrcDir], css: `${srcDir}/css/**/*.css`, - js: ['gulpfile.js', 'gulp.d/**/*.js', `${srcDir}/{helpers,js}/**/*.js`], + js: ['gulpfile.js', 'gulp.d/**/*.js', `${srcDir}/helpers/**/*.js`, `${srcDir}/js/**/+([^.])?(.bundle).js`], } const cleanTask = createTask({ @@ -66,8 +66,7 @@ const buildTask = createTask({ const bundleBuildTask = createTask({ name: 'bundle:build', - // call: series(cleanTask, lintTask, buildTask), - call: series(cleanTask, buildTask), + call: series(cleanTask, lintTask, buildTask), }) const bundlePackTask = createTask({ diff --git a/src/css/chatbot.css b/src/css/chatbot.css index 3cb25e35..d74cab32 100644 --- a/src/css/chatbot.css +++ b/src/css/chatbot.css @@ -1,7 +1,7 @@ .lex-web-ui-iframe { bottom: 1.5rem; display: none; /* hidden by default changed once iframe is loaded */ - margin-bottom: 0px; + margin-bottom: 0; margin-left: 2px; margin-right: 3vw; margin-top: 2px; @@ -15,6 +15,9 @@ .lex-web-ui-iframe iframe { border-radius: 8px 8px 10px 10px; + overflow: hidden; + width: 100%; + height: 100%; } .lex-web-ui-iframe--show { @@ -34,7 +37,6 @@ min-width: calc(55vw - 3vw) !important; } - /* disable box shadow when minimized */ .lex-web-ui-iframe.lex-web-ui-iframe--minimize iframe { box-shadow: none; @@ -42,11 +44,9 @@ } /* hide on very small resolutions */ -@media only screen and (max-width: 240px), -only screen and (max-height: 256px) -{ +@media only screen and (max-width: 240px), only screen and (max-height: 256px) { .lex-web-ui-iframe { - display: none!important; + display: none !important; } .lex-web-ui-iframe--minimize { @@ -54,10 +54,9 @@ only screen and (max-height: 256px) max-height: 185px !important; } } + /* take most space on small resolutions (smart phones) */ -@media only screen -and (min-width: 241px) -and (max-width: 480px) { +@media only screen and (min-width: 241px) and (max-width: 480px) { .lex-web-ui-iframe { min-width: 85vw !important; height: 84vh; @@ -70,13 +69,10 @@ and (max-width: 480px) { height: 90vh; /* dynamically changed on iframe maximize/minimize */ min-width: 96vw !important; } - } /* adjust down on medium resolutions */ -@media only screen -and (min-width: 481px) -and (max-width: 960px) { +@media only screen and (min-width: 481px) and (max-width: 960px) { .lex-web-ui-iframe { max-width: 55vw; height: 80vh; /* dynamically changed on iframe maximize/minimize */ @@ -96,9 +92,3 @@ and (max-width: 960px) { min-width: 230px !important; } } - -.lex-web-ui-iframe iframe { - overflow: hidden; - width: 100%; - height: 100%; -} diff --git a/src/css/site.css b/src/css/site.css index 0979986b..39b3e3e2 100644 --- a/src/css/site.css +++ b/src/css/site.css @@ -45,5 +45,4 @@ @import "table.css"; @import "tabs.css"; @import "terminal.css"; - -@import "chatbot.css"; \ No newline at end of file +@import "chatbot.css"; diff --git a/src/js/06-page-rating.js b/src/js/06-page-rating.js index bb30331c..34458644 100644 --- a/src/js/06-page-rating.js +++ b/src/js/06-page-rating.js @@ -65,7 +65,7 @@ // }) $.ajax({ - 'url': 'https://couchbasecommunity.atlassian.net/s/d41d8cd98f00b204e9800998ecf8427e-T/tod1zk/b/4/b0105d975e9e59f24a3230a22972a71a/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector-embededjs/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector-embededjs.js?locale=en-GB&collectorId=a3b807e8', + 'url': 'https://couchbasecommunity.atlassian.net/s/d41d8cd98f00b204e9800998ecf8427e-T/tod1zk/b/4/b0105d975e9e59f24a3230a22972a71a/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector-embededjs/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector-embededjs.js?locale=en-GB&collectorId=a3b807e8', // eslint-disable-line max-len 'type': 'get', 'cache': true, 'dataType': 'script', diff --git a/src/js/12-chatbox.js b/src/js/12-chatbox.js new file mode 100644 index 00000000..495aa95b --- /dev/null +++ b/src/js/12-chatbox.js @@ -0,0 +1,45 @@ +;(function () { + var iframeLoader = new window.ChatBotUiLoader.IframeLoader() + + var chatbotUiconfig = { + ui: { + parentOrigin: 'https://preview.docs-test.couchbase.com', + toolbarTitle: 'Couchbase', + toolbarLogo: 'https://www.couchbase.com/wp-content/uploads/sites/3/2023/10/SDKs_Ottoman.svg', + positiveFeedbackIntent: 'Thumbs up', + negativeFeedbackIntent: 'Thumbs down', + helpIntent: 'Help', + enableLogin: false, + forceLogin: false, + AllowSuperDangerousHTMLInMessage: true, + shouldDisplayResponseCardTitle: false, + saveHistory: false, + minButtonContent: '', + hideInputFieldsForButtonResponse: false, + pushInitialTextOnRestart: false, + directFocusToBotInput: false, + showDialogStateIcon: false, + backButton: false, + messageMenu: true, + hideButtonMessageBubble: false, + enableLiveChat: false, + }, + iframe: { + iframeOrigin: 'https://d2sozpdiqok6m4.cloudfront.net', + shouldLoadIframeMinimized: true, + iframeSrcPath: '/#/?lexWebUiEmbed=true', + }, + } + + // load the iframe + iframeLoader + .load(chatbotUiconfig) + .then(function () { + iframeLoader.api.ping() + // perform actions on the parent dependent on the chatbot loading. + document.getElementById('send-intent').setAttribute('disabled', false) + }) + .catch(function (error) { + console.error('chatbot UI failed to load', error) + }) +})() diff --git a/src/js/13-chatbot.js b/src/js/13-chatbot.js deleted file mode 100644 index 59cc112c..00000000 --- a/src/js/13-chatbot.js +++ /dev/null @@ -1,45 +0,0 @@ -var iframeLoader = new ChatBotUiLoader.IframeLoader(); - -var chatbotUiconfig = { - ui: { - parentOrigin: "https://preview.docs-test.couchbase.com", - toolbarTitle: "Couchbase", - toolbarLogo: - "https://www.couchbase.com/wp-content/uploads/sites/3/2023/10/SDKs_Ottoman.svg", - positiveFeedbackIntent: "Thumbs up", - negativeFeedbackIntent: "Thumbs down", - helpIntent: "Help", - enableLogin: false, - forceLogin: false, - AllowSuperDangerousHTMLInMessage: true, - shouldDisplayResponseCardTitle: false, - saveHistory: false, - minButtonContent: "", - hideInputFieldsForButtonResponse: false, - pushInitialTextOnRestart: false, - directFocusToBotInput: false, - showDialogStateIcon: false, - backButton: false, - messageMenu: true, - hideButtonMessageBubble: false, - enableLiveChat: false, - }, - iframe: { - iframeOrigin: "https://d2sozpdiqok6m4.cloudfront.net", - shouldLoadIframeMinimized: true, - iframeSrcPath: "/#/?lexWebUiEmbed=true", - }, - }; - -// load the iframe -iframeLoader - .load(chatbotUiconfig) - .then(function () { - iframeLoader.api.ping(); - // perform actions on the parent dependent on the chatbot loading. - $("#send-intent").prop("disabled", false); - }) - .catch(function (error) { - console.error("chatbot UI failed to load", error); - }); -console.log("DONE") diff --git a/src/js/12-chatbot-ui.js b/src/js/vendor/chatbox-ui.min.js similarity index 100% rename from src/js/12-chatbot-ui.js rename to src/js/vendor/chatbox-ui.min.js diff --git a/src/js/vendor/docsearch.bundle.js b/src/js/vendor/docsearch.bundle.js index 7da17585..0e7f695b 100644 --- a/src/js/vendor/docsearch.bundle.js +++ b/src/js/vendor/docsearch.bundle.js @@ -324,7 +324,8 @@ return { name: hit.component, version: hit.cversion, - title: hit.component_title } + title: hit.component_title, + } } function renderFilters (components, filters) { diff --git a/src/partials/footer-scripts.hbs b/src/partials/footer-scripts.hbs index 77db24b2..2ce15a2f 100644 --- a/src/partials/footer-scripts.hbs +++ b/src/partials/footer-scripts.hbs @@ -10,7 +10,7 @@ - + {{#with page.attributes.content-scripts}} @@ -47,7 +47,5 @@ MathJax.Hub.Register.StartupHook("AsciiMath Jax Ready", function () { {{/if}} {{#if (eq env.SHOW_FEEDBACK_BUTTON 'true')}} - + {{/if}} -