CASH-2262 | Fix for the button showing up when it shouldn't

This commit is contained in:
scottkiener-at-safelite 2026-02-05 09:52:04 -05:00
parent 035de450ba
commit f2385c16f7
2 changed files with 8 additions and 8 deletions

View file

@ -7,10 +7,15 @@ import analyticsMixin from "@/mixins/analytics-mixin";
import store from "@/store";
import { routeData } from "@/router/constants/routes";
import { deepClone } from "@/helpers/object-helper";
import { webchatHelper } from "@/helpers/webchat-helper";
export default {
name: "sierraWebchat",
mixins: [analyticsMixin],
setup() {
const { webchatGlobalNonpersistedState, launchWebchat } = webchatHelper();
return { webchatGlobalNonpersistedState, launchWebchat };
},
methods: {
openSierraChatModal() {
const sierra = window.sierraChat || window.sierra || window.SierraChat;
@ -152,15 +157,9 @@ export default {
LastName: transfer.data.last_name,
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);

View file

@ -8,6 +8,7 @@ const webchatGlobalNonpersistedState = reactive({
export const webchatHelper = () => {
function launchWebchat() {
webchatGlobalNonpersistedState.showWebchatButton = false;
if (webchatGlobalNonpersistedState.shouldLaunchSierra) {
window.dispatchEvent(new CustomEvent("launch-sierra-webchat")); // launches the sierra chat
} else {