diff --git a/src/app/components/utils/index.js b/src/app/components/utils/index.js index 68a6332..9cacc81 100644 --- a/src/app/components/utils/index.js +++ b/src/app/components/utils/index.js @@ -4,6 +4,7 @@ import WtIconBtn from './wt-icon-btn.vue'; import WtInput from './wt-input.vue'; import WtLabel from './wt-label.vue'; import WtTextarea from './wt-textarea.vue'; +import WtSnackBar from './wt-snack-bar.vue'; const Components = { WtButton, @@ -11,6 +12,7 @@ const Components = { WtInput, WtLabel, WtTextarea, + WtSnackBar, }; Object.keys(Components).forEach((name) => { diff --git a/src/app/components/utils/wt-snack-bar.vue b/src/app/components/utils/wt-snack-bar.vue new file mode 100644 index 0000000..874304a --- /dev/null +++ b/src/app/components/utils/wt-snack-bar.vue @@ -0,0 +1,141 @@ + + + + + diff --git a/src/app/components/wt-omni-widget-popup/wt-omni-widget-popup.vue b/src/app/components/wt-omni-widget-popup/wt-omni-widget-popup.vue index 54c236c..fa13160 100644 --- a/src/app/components/wt-omni-widget-popup/wt-omni-widget-popup.vue +++ b/src/app/components/wt-omni-widget-popup/wt-omni-widget-popup.vue @@ -2,6 +2,7 @@ diff --git a/src/modules/call/components/wt-omni-widget-call-start.vue b/src/modules/call/components/wt-omni-widget-call-start.vue index da8281f..db116f5 100644 --- a/src/modules/call/components/wt-omni-widget-call-start.vue +++ b/src/modules/call/components/wt-omni-widget-call-start.vue @@ -22,7 +22,7 @@ icon="call" icon-size="sm" color="success" - @click="() => makeCall({ initWithMuted })" + @click="call" > @@ -31,6 +31,8 @@ diff --git a/src/modules/chat/components/wt-omni-widget-chat-wrapper.vue b/src/modules/chat/components/wt-omni-widget-chat-wrapper.vue index 0abccea..d7fa0d1 100644 --- a/src/modules/chat/components/wt-omni-widget-chat-wrapper.vue +++ b/src/modules/chat/components/wt-omni-widget-chat-wrapper.vue @@ -25,6 +25,7 @@ import WidgetChannel from '../../../app/enums/WidgetChannel.enum'; import MessageClient from '../../../app/websocket/MessageClient'; import ChatContent from './wt-omni-widget-chat-content/wt-omni-widget-window-content.vue'; import ChatFooter from './wt-omni-widget-chat-footer/wt-omni-widget-window-footer.vue'; +import reCAPTCHify from '../../reCAPTCHA-verification/scripts/reCAPTCHify'; export default { name: 'wt-omni-widget-chat-wrapper', @@ -42,7 +43,7 @@ export default { }, computed: { ...mapState('chat', { - client: state => state.messageClient, + client: (state) => state.messageClient, }), }, methods: { @@ -54,15 +55,30 @@ export default { listenOnMessage: 'LISTEN_ON_MESSAGE', onMessage: 'ON_MESSAGE', }), - initSession() { + async initSession() { if (this.client) return; // prevent reinitialization, but should be refactored - const workerSupport = false && !!window.SharedWorker && !!window.BroadcastChannel; // FIXME - const messageClient = new MessageClient({ - url: this.config.chat.url, - workerSupport, - }); - this.initializeSession({ messageClient }); - this.setOnMessageListener(); + try { + (await reCAPTCHify(() => { + const workerSupport = false && !!window.SharedWorker && !!window.BroadcastChannel; // FIXME + const messageClient = new MessageClient({ + url: this.config.chat.url, + workerSupport, + }); + this.initializeSession({ messageClient }); + this.setOnMessageListener(); + + window.addEventListener('beforeunload', async (e) => { + await this.closeSession(); + delete e.returnValue; // page will always reload + }); + }))(); + } catch (err) { + eventBus.$emit('snack', { + type: 'error', + text: this.$t('captcha.error.text'), + }); + throw err; + } }, initPreviewMode() { const messages = [ @@ -92,15 +108,15 @@ export default { created() { if (this.isPreviewMode) { this.initPreviewMode(); - } else { - this.initSession(); - window.addEventListener('beforeunload', async (e) => { - await this.closeSession(); - delete e.returnValue; // page will always reload - }); + } + }, + activated() { + if (!this.isPreviewMode) { + this.initSession(); // try to init, if didn't init on created (note: initSession() has this.client check!!!) } }, }; +