20 lines
710 B
JavaScript
20 lines
710 B
JavaScript
import { reactive } from "vue";
|
|
|
|
// state encapsulated and managed by the composable
|
|
const webchatGlobalNonpersistedState = reactive({
|
|
showWebchatButton: false,
|
|
shouldLaunchSierra: false,
|
|
});
|
|
|
|
export const webchatHelper = () => {
|
|
function launchWebchat() {
|
|
webchatGlobalNonpersistedState.showWebchatButton = false;
|
|
if (webchatGlobalNonpersistedState.shouldLaunchSierra) {
|
|
window.dispatchEvent(new CustomEvent("launch-sierra-webchat")); // launches the sierra chat
|
|
} else {
|
|
window.embeddedservice_bootstrap.utilAPI.launchChat(); // launches the salesForce prechat form
|
|
}
|
|
}
|
|
|
|
return { webchatGlobalNonpersistedState, launchWebchat };
|
|
};
|