From 58cc85166ff197783a9a1d274d296185eb7fd8e1 Mon Sep 17 00:00:00 2001 From: Peter Joles Date: Thu, 29 Oct 2020 11:55:01 -0500 Subject: [PATCH] :sparkles: feat: On mobile devices display button that minimizes chat for responses that return URLs --- public/static/embed-leopard.js | 2 +- src/App.vue | 15 +++++----- src/components/ChatTeneoResponse.vue | 38 +++++++++++++++++++++++++- src/components/Modal.vue | 2 +- src/store.js | 7 ++++- src/views/About.vue | 2 +- src/views/Chat.vue | 41 ++++++++++++++++------------ src/views/Help.vue | 11 ++++++-- 8 files changed, 87 insertions(+), 31 deletions(-) diff --git a/public/static/embed-leopard.js b/public/static/embed-leopard.js index dfae4402..d4e4a17c 100644 --- a/public/static/embed-leopard.js +++ b/public/static/embed-leopard.js @@ -97,7 +97,7 @@ var leopardChatUi = (function () { border: 0px; transition: none 0s ease 0s !important; } - @media only screen and (max-width: 480px) { + @media only screen and (max-width: 464px) { .teneo-chat-widget { z-index: 10000; top: 0; diff --git a/src/App.vue b/src/App.vue index f08c2b28..66853077 100644 --- a/src/App.vue +++ b/src/App.vue @@ -617,6 +617,7 @@ export default { if (delay) { setTimeout(() => { this.minimizeChat(); + this.$store.commit("MINIMIZE_DELAY_REMOVE"); }, delay * 1000); } }, @@ -747,7 +748,7 @@ export default { } // this.toggleChat(); // will automatically open the chat window on load if (!this.showButtonOnly) { - if (window.innerWidth <= 480 || this.embed) { + if (window.innerWidth <= 464 || this.embed) { this.onResizeOrEmbed(); } this.$store.dispatch("setUserInformation"); @@ -1212,7 +1213,7 @@ export default { } if ( - (window.innerWidth <= 480 && + (window.innerWidth <= 464 && !this.loginPerformed && !this.embed && this.dialogs.length === 0) || @@ -1243,10 +1244,10 @@ export default { return; } if ( - (window.innerWidth <= 480 && !this.embed) || + (window.innerWidth <= 464 && !this.embed) || (this.embed && this.isChatOpenLocalStorage()) ) { - logger.debug(`window.innerWidth <= 480 && !this.embed`); + logger.debug(`window.innerWidth <= 464 && !this.embed`); this.$store.commit("HIDE_CHAT_BUTTON"); this.$store.commit("SHOW_CHAT_WINDOW"); // show the chat window //animate the IFrame @@ -1280,7 +1281,7 @@ export default { }.bind(this), 400 ); - } else if (window.innerWidth > 480 && this.isChatOpen) { + } else if (window.innerWidth > 464 && this.isChatOpen) { this.$store.commit("SHOW_CHAT_BUTTON"); } }, @@ -1941,7 +1942,7 @@ iframe#site-frame { padding-left: 1.5em; } -@media only screen and (max-height: 480px) { +@media only screen and (max-height: 464px) { .leopard-alternative-views { overflow-x: hidden; overflow-y: auto; @@ -1992,7 +1993,7 @@ iframe#site-frame { } } -@media only screen and (max-width: 480px) { +@media only screen and (max-width: 464px) { .leopard-alternative-views { overflow-x: hidden; overflow-y: auto; diff --git a/src/components/ChatTeneoResponse.vue b/src/components/ChatTeneoResponse.vue index d43b48c9..4a61edea 100644 --- a/src/components/ChatTeneoResponse.vue +++ b/src/components/ChatTeneoResponse.vue @@ -305,6 +305,32 @@ + + + + + mdi-page-previous-outline + Page + + +
state.browser.isMobile, + isSimulatedMobileDevice: state => state.browser.isSimulatedMobile, socialAuthEnabled: state => (state.auth.firebase ? true : false), lastReplyItem: state => { return state.conversation.dialog @@ -1339,6 +1341,9 @@ function storeSetup(vuetify) { DISABLE_LIVE_CHAT(state) { state.liveAgent.enableLiveChat = false; }, + MINIMIZE_NOW(state) { + state.ui.minimize = 0.1; + }, MINIMIZE_DELAY(state, delaySeconds) { state.ui.minimize = delaySeconds; }, diff --git a/src/views/About.vue b/src/views/About.vue index 1d44349d..e28067b1 100644 --- a/src/views/About.vue +++ b/src/views/About.vue @@ -75,7 +75,7 @@ export default { width: 360px; } -@media only screen and (max-width: 480px) { +@media only screen and (max-width: 464px) { .teneo-about-card { width: 100vw !important; } diff --git a/src/views/Chat.vue b/src/views/Chat.vue index 10a3d196..f4f8d5dc 100644 --- a/src/views/Chat.vue +++ b/src/views/Chat.vue @@ -38,7 +38,11 @@ > - + - {{ $t('pickers.cancel') }} - {{ $t('pickers.ok') }} + {{ + $t("pickers.cancel") + }} + {{ $t("pickers.ok") }} @@ -130,8 +136,10 @@ > - {{ $t('pickers.cancel') }} - {{ $t('pickers.ok') }} + {{ + $t("pickers.cancel") + }} + {{ $t("pickers.ok") }} @@ -155,7 +163,7 @@ import ChatInput from "@/components/ChatInput"; import { mapGetters } from "vuex"; if (window.Element && !Element.prototype.closest) { - Element.prototype.closest = function(s) { + Element.prototype.closest = function (s) { let matches = (this.document || this.ownerDocument).querySelectorAll(s), i, el = this; @@ -204,30 +212,30 @@ export default { }; }, watch: { - showLiveChatProcessing: function() { + showLiveChatProcessing: function () { // console.log(`SHOW LIVE CHAT PROCESSING`, val); setTimeout(() => { this.mustScroll = true; this.scrollToBottom(); }, 8000); }, - date: function(newDate) { + date: function (newDate) { if (newDate !== "") { this.updateInputBox(dayjs(newDate).format("D MMMM YYYY")); } }, - storeUserInput: debounce(function(userInputStore) { + storeUserInput: debounce(function (userInputStore) { if (this.userInput !== userInputStore) { this.userInput = userInputStore; } }, 500), - dialog: function(newDialog) { + dialog: function (newDialog) { if (newDialog.length !== this.oldDialogLength) { this.mustScroll = true; this.oldDialogLength = newDialog.length; } }, - showLiveChatProcessing: debounce(function(isLiveChatPersonTyping) { + showLiveChatProcessing: debounce(function (isLiveChatPersonTyping) { if (isLiveChatPersonTyping) { this.mustScroll = true; } @@ -271,7 +279,7 @@ export default { ]), getNarrowMobile() { - if (window.innerWidth <= 480) { + if (window.innerWidth <= 464) { return "min-height: calc(var(--vh, 1vh) * 80 - 130px);"; } else { return ""; @@ -296,7 +304,7 @@ export default { } } }, - updated: debounce(function() { + updated: debounce(function () { try { if (this.mustScroll) { this.mustScroll = false; @@ -349,7 +357,6 @@ export default { logger.debug("Scroll to bottom"); const endChatTarget = this.$refs.endChat; if (endChatTarget) { - this.isScrolling = true; let scrollToElement = document.getElementById("teneo-chat-scroll"); const options = { @@ -617,7 +624,7 @@ span.teneo-reply ul { 0px -3px 0px 0px rgba(0, 0, 0, 0.04); } -@media only screen and (max-height: 480px) { +@media only screen and (max-height: 464px) { .chat-responses, .chat-responses-float { min-height: calc(100vh - 130px); @@ -629,7 +636,7 @@ span.teneo-reply ul { } } -@media only screen and (max-width: 480px) { +@media only screen and (max-width: 464px) { .v-footer, .chat-container, .teneo-dialog, diff --git a/src/views/Help.vue b/src/views/Help.vue index abdfd0e8..7313185e 100644 --- a/src/views/Help.vue +++ b/src/views/Help.vue @@ -11,7 +11,14 @@