CASH-1527 | Initial attempt at updating salesforce
Apparently it does not work in localhost.
This commit is contained in:
parent
39f9fb9cc4
commit
c6ec570f4c
5 changed files with 35 additions and 69 deletions
|
|
@ -7,9 +7,9 @@ function setupCustomSettings(
|
|||
onWebchatCloseCallback
|
||||
) {
|
||||
modifyEmbeddedSvcCallback();
|
||||
embedded_svc.addEventHandler("onSettingsCallCompleted", finishedLoadingCallback);
|
||||
embedded_svc.addEventHandler("afterMaximize", onWebchatOpenCallback);
|
||||
embedded_svc.addEventHandler("afterDestroy", onWebchatCloseCallback);
|
||||
embeddedservice_bootstrap.addEventHandler("onSettingsCallCompleted", finishedLoadingCallback);
|
||||
embeddedservice_bootstrap.addEventHandler("afterMaximize", onWebchatOpenCallback);
|
||||
embeddedservice_bootstrap.addEventHandler("afterDestroy", onWebchatCloseCallback);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -36,24 +36,6 @@ export function initializeSalesforceWebchatForDev(
|
|||
onWebchatCloseCallback
|
||||
) {
|
||||
var initESW = function (gslbBaseURL) {
|
||||
embedded_svc.settings.displayHelpButton = true; //Or false
|
||||
embedded_svc.settings.language = ""; //For example, enter 'en' or 'en-US'
|
||||
//embedded_svc.settings.defaultMinimizedText = '...'; //(Defaults to Chat with an Expert)
|
||||
//embedded_svc.settings.disabledMinimizedText = '...'; //(Defaults to Agent Offline)
|
||||
//embedded_svc.settings.loadingText = ''; //(Defaults to Loading)
|
||||
//embedded_svc.settings.storageDomain = 'yourdomain.com'; //(Sets the domain for your deployment so that visitors can navigate subdomains during a chat session)
|
||||
// Settings for Chat
|
||||
//embedded_svc.settings.directToButtonRouting = function(prechatFormData) {
|
||||
// Dynamically changes the button ID based on what the visitor enters in the pre-chat form.
|
||||
// Returns a valid button ID.
|
||||
//};
|
||||
//embedded_svc.settings.prepopulatedPrechatFields = {}; //Sets the auto-population of pre-chat form fields
|
||||
//embedded_svc.settings.fallbackRouting = []; //An array of button IDs, user IDs, or userId_buttonId
|
||||
//embedded_svc.settings.offlineSupportMinimizedText = '...'; //(Defaults to Contact Us)
|
||||
|
||||
embedded_svc.settings.enabledFeatures = ["LiveAgent"];
|
||||
embedded_svc.settings.entryFeature = "LiveAgent";
|
||||
|
||||
setupCustomSettings(
|
||||
modifyEmbeddedSvcCallback,
|
||||
finishedLoadingCallback,
|
||||
|
|
@ -61,36 +43,19 @@ export function initializeSalesforceWebchatForDev(
|
|||
onWebchatCloseCallback
|
||||
);
|
||||
|
||||
embedded_svc.init(
|
||||
"https://safelite2--dev.sandbox.my.salesforce.com",
|
||||
"https://safelite2--dev.sandbox.my.salesforce-sites.com/chat",
|
||||
gslbBaseURL,
|
||||
"00D6s0000008r6A",
|
||||
"Sales_Central_Snap_in",
|
||||
{
|
||||
baseLiveAgentContentURL:
|
||||
"https://c.la12s-core1.sfdc-8tgtt5.salesforceliveagent.com/content",
|
||||
deploymentId: "572Wr0000017xKX",
|
||||
buttonId: "573Wr000000CpgH",
|
||||
baseLiveAgentURL: "https://d.la12s-core1.sfdc-8tgtt5.salesforceliveagent.com/chat",
|
||||
eswLiveAgentDevName:
|
||||
"EmbeddedServiceLiveAgent_Parent04IWr000003yKq9MAE_1961681659a",
|
||||
isOfflineSupportEnabled: false,
|
||||
}
|
||||
);
|
||||
};
|
||||
try {
|
||||
embeddedservice_bootstrap.settings.language = "en_US"; // For example, enter 'en' or 'en-US'
|
||||
|
||||
if (!window.embedded_svc) {
|
||||
var s = document.createElement("script");
|
||||
s.setAttribute(
|
||||
"src",
|
||||
"https://safelite2--dev.sandbox.my.salesforce.com/embeddedservice/5.0/esw.min.js"
|
||||
);
|
||||
s.onload = function () {
|
||||
initESW(null);
|
||||
};
|
||||
document.body.appendChild(s);
|
||||
} else {
|
||||
initESW("https://service.force.com");
|
||||
}
|
||||
embeddedservice_bootstrap.init(
|
||||
"00D6s0000008r6A",
|
||||
"Sales_Central_TFN",
|
||||
"https://safelite2--dev.sandbox.my.site.com/ESWSalesCentralTFN1755660094477",
|
||||
{
|
||||
scrt2URL: "https://safelite2--dev.sandbox.my.salesforce-scrt.com",
|
||||
}
|
||||
);
|
||||
} catch (err) {
|
||||
console.error("Error loading Embedded Messaging: ", err);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ export default {
|
|||
mounted() {
|
||||
// Load in script from salesforce CDN
|
||||
const script = document.createElement("script");
|
||||
script.src = "https://service.force.com/embeddedservice/5.0/esw.min.js";
|
||||
script.src =
|
||||
"https://safelite2--dev.sandbox.my.site.com/ESWSalesCentralTFN1755660094477/assets/js/bootstrap.min.js";
|
||||
script.onload = this.initializeSalesforceWebchat;
|
||||
document.body.appendChild(script);
|
||||
|
||||
|
|
@ -92,11 +93,11 @@ export default {
|
|||
}
|
||||
},
|
||||
modifyEmbeddedSvcCallback() {
|
||||
window.embedded_svc.settings.avatarImgURL = require("@/assets/img/salesforce-webchat/avatar_webchat.png");
|
||||
window.embedded_svc.settings.prechatBackgroundImgURL = require("@/assets/img/salesforce-webchat/safelite_logo_webchat.png");
|
||||
window.embedded_svc.settings.smallCompanyLogoImgURL = require("@/assets/img/salesforce-webchat/minimized_chat_bubble_webchat.png");
|
||||
window.embedded_svc.settings.displayHelpButton = false;
|
||||
window.embedded_svc.addEventHandler("onChatEstablished", () => {
|
||||
window.embeddedservice_bootstrap.settings.avatarImgURL = require("@/assets/img/salesforce-webchat/avatar_webchat.png");
|
||||
window.embeddedservice_bootstrap.settings.prechatBackgroundImgURL = require("@/assets/img/salesforce-webchat/safelite_logo_webchat.png");
|
||||
window.embeddedservice_bootstrap.settings.smallCompanyLogoImgURL = require("@/assets/img/salesforce-webchat/minimized_chat_bubble_webchat.png");
|
||||
window.embeddedservice_bootstrap.settings.displayHelpButton = false;
|
||||
window.embeddedservice_bootstrap.addEventHandler("onChatEstablished", () => {
|
||||
this.pushEventForChatsToGA("support_chat", "chat_opened", "Live Agent", true);
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -139,8 +139,8 @@ export default {
|
|||
// Pass data to Salesforce chat if available
|
||||
const transfer = event.detail;
|
||||
if (
|
||||
window.embedded_svc &&
|
||||
typeof window.embedded_svc.bootstrapEmbeddedService === "function"
|
||||
window.embeddedservice_bootstrap &&
|
||||
typeof window.embeddedservice_bootstrap.bootstrapEmbeddedService === "function"
|
||||
) {
|
||||
if (
|
||||
transfer &&
|
||||
|
|
@ -149,13 +149,13 @@ export default {
|
|||
transfer.data.last_name &&
|
||||
transfer.data.email
|
||||
) {
|
||||
window.embedded_svc.settings.prepopulatedPrechatFields = {
|
||||
window.embeddedservice_bootstrap.settings.prepopulatedPrechatFields = {
|
||||
FirstName: transfer.data.first_name,
|
||||
LastName: transfer.data.last_name,
|
||||
Email: transfer.data.email,
|
||||
Subject: transfer.data.chat_summary,
|
||||
};
|
||||
window.embedded_svc.settings.extraPrechatFormDetails = [
|
||||
window.embeddedservice_bootstrap.settings.extraPrechatFormDetails = [
|
||||
{
|
||||
label: "Scarlett AI Summary",
|
||||
value: transfer.data.chat_summary,
|
||||
|
|
@ -164,14 +164,14 @@ export default {
|
|||
},
|
||||
];
|
||||
if (
|
||||
window.embedded_svc.liveAgentAPI &&
|
||||
typeof window.embedded_svc.liveAgentAPI.startChat === "function"
|
||||
window.embeddedservice_bootstrap.liveAgentAPI &&
|
||||
typeof window.embeddedservice_bootstrap.liveAgentAPI.startChat === "function"
|
||||
) {
|
||||
window.embedded_svc.liveAgentAPI.startChat();
|
||||
window.embeddedservice_bootstrap.liveAgentAPI.startChat();
|
||||
return;
|
||||
}
|
||||
}
|
||||
window.embedded_svc.bootstrapEmbeddedService();
|
||||
window.embeddedservice_bootstrap.bootstrapEmbeddedService();
|
||||
}
|
||||
};
|
||||
window.addEventListener("sierra-chat-transfer", this._handleSierraTransfer);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ export const webchatHelper = () => {
|
|||
if (webchatGlobalNonpersistedState.shouldLaunchSierra) {
|
||||
window.dispatchEvent(new CustomEvent("launch-sierra-webchat")); // launches the sierra chat
|
||||
} else {
|
||||
window.embedded_svc.bootstrapEmbeddedService(); // launches the salesForce prechat form
|
||||
window.embeddedservice_bootstrap.bootstrapEmbeddedService(); // launches the salesForce prechat form
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -123,8 +123,8 @@ $body-color: $gray-600;
|
|||
|
||||
//Fonts
|
||||
$font-family-sans-serif: UrbanistRegular, Arial, Helvetica, sans-serif;
|
||||
$font-family-monospace: UrbanistRegular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
|
||||
monospace;
|
||||
$font-family-monospace:
|
||||
UrbanistRegular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||
// stylelint-enable value-keyword-case
|
||||
$font-family-base: $font-family-sans-serif;
|
||||
$font-family-code: $font-family-monospace;
|
||||
|
|
|
|||
Loading…
Reference in a new issue