CASH-2262 | Fix for the button showing up when it shouldn't
This commit is contained in:
parent
d7defe9b76
commit
fac3a8258b
2 changed files with 8 additions and 8 deletions
|
|
@ -7,10 +7,15 @@ import analyticsMixin from "@/mixins/analytics-mixin";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import { routeData } from "@/router/constants/routes";
|
import { routeData } from "@/router/constants/routes";
|
||||||
import { deepClone } from "@/helpers/object-helper";
|
import { deepClone } from "@/helpers/object-helper";
|
||||||
|
import { webchatHelper } from "@/helpers/webchat-helper";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "sierraWebchat",
|
name: "sierraWebchat",
|
||||||
mixins: [analyticsMixin],
|
mixins: [analyticsMixin],
|
||||||
|
setup() {
|
||||||
|
const { webchatGlobalNonpersistedState, launchWebchat } = webchatHelper();
|
||||||
|
return { webchatGlobalNonpersistedState, launchWebchat };
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
openSierraChatModal() {
|
openSierraChatModal() {
|
||||||
const sierra = window.sierraChat || window.sierra || window.SierraChat;
|
const sierra = window.sierraChat || window.sierra || window.SierraChat;
|
||||||
|
|
@ -152,15 +157,9 @@ export default {
|
||||||
LastName: transfer.data.last_name,
|
LastName: transfer.data.last_name,
|
||||||
Email: transfer.data.email,
|
Email: transfer.data.email,
|
||||||
});
|
});
|
||||||
if (
|
|
||||||
window.embeddedservice_bootstrap.utilAPI &&
|
|
||||||
typeof window.embeddedservice_bootstrap.utilAPI.launchChat === "function"
|
|
||||||
) {
|
|
||||||
window.embeddedservice_bootstrap.utilAPI.launchChat();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
window.embeddedservice_bootstrap.utilAPI.launchChat();
|
this.webchatGlobalNonpersistedState.shouldLaunchSierra = false;
|
||||||
|
this.launchWebchat();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
window.addEventListener("sierra-chat-transfer", this._handleSierraTransfer);
|
window.addEventListener("sierra-chat-transfer", this._handleSierraTransfer);
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ const webchatGlobalNonpersistedState = reactive({
|
||||||
|
|
||||||
export const webchatHelper = () => {
|
export const webchatHelper = () => {
|
||||||
function launchWebchat() {
|
function launchWebchat() {
|
||||||
|
webchatGlobalNonpersistedState.showWebchatButton = false;
|
||||||
if (webchatGlobalNonpersistedState.shouldLaunchSierra) {
|
if (webchatGlobalNonpersistedState.shouldLaunchSierra) {
|
||||||
window.dispatchEvent(new CustomEvent("launch-sierra-webchat")); // launches the sierra chat
|
window.dispatchEvent(new CustomEvent("launch-sierra-webchat")); // launches the sierra chat
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue