From ff0b9fe1d10fe722219d6569dad6af9766024319 Mon Sep 17 00:00:00 2001 From: Scott Kiener Date: Fri, 16 May 2025 10:53:59 -0400 Subject: [PATCH] CASH-313 | Utilize composable and move webchat to app.vue Also removed an unused reference to experiment-mixin in index.js --- src/App.vue | 3 + .../salesforce-helper-qa.js | 21 ++++++- .../salesforce-webchat/salesforce-webchat.vue | 58 +++++++++---------- .../funnel-header/funnel-header.vue | 36 ++++++++++-- src/helpers/webchat-helper.js | 20 +++++++ src/store/index.js | 1 - 6 files changed, 98 insertions(+), 41 deletions(-) create mode 100644 src/helpers/webchat-helper.js diff --git a/src/App.vue b/src/App.vue index 422ae2893..3d7d6dd2f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -7,6 +7,7 @@ + diff --git a/src/helpers/webchat-helper.js b/src/helpers/webchat-helper.js new file mode 100644 index 000000000..c2cbdecbf --- /dev/null +++ b/src/helpers/webchat-helper.js @@ -0,0 +1,20 @@ +import { reactive } from "vue"; + +// state encapsulated and managed by the composable +const webchatGlobalNonpersistedState = reactive({ + showWebchatButton: false, + shouldLaunchSierra: false, +}); + +export const webchatHelper = () => { + + function launchWebchat() { + if (webchatGlobalNonpersistedState.shouldLaunchSierra) { + // do sierra logic here + } else { + window.embedded_svc.bootstrapEmbeddedService(); // launches the salesForce prechat form + } + } + + return { webchatGlobalNonpersistedState, launchWebchat }; +}; diff --git a/src/store/index.js b/src/store/index.js index 753d8509b..88fa12baf 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -55,7 +55,6 @@ import { } from "@/helpers/recal-helper"; import { externalParameterStatus } from "@/constants/external-parameters"; import { experimentSettings } from "@/constants/experiments"; -import experimentMixin from "@/mixins/experiment-mixin.js"; // Export State const getDefaultState = () => {