Skip to content

Commit

Permalink
fix: update temo script
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuzhy-Deriv committed Oct 11, 2024
1 parent 776b8a0 commit abf25ab
Showing 1 changed file with 27 additions and 28 deletions.
55 changes: 27 additions & 28 deletions public/scripts/freshchat-temp.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,35 +123,34 @@ class FreshChat {
this.callDerivWS
);
}
if (jwt) {
window.fcWidget?.user?.setProperties({
cf_user_jwt: jwt,
});
} else {
let fcScript = document.getElementById("fc-script");
if (fcScript) {
document.body.removeChild(fcScript);
}
// Call Customer backend and get the signature for userReferenceId
window.fcWidgetMessengerConfig = {
// locale: this.locale,
meta: {
cf_user_jwt: jwt,
},
config: {
headerProperty: {
hideChatButton: this.hideButton,
},
},
};

// Append the CRM Tracking Code Dynamically
var script = document.createElement("script");
script.src = "https://uae.fw-cdn.com/40116340/63296.js";
script.setAttribute("chat", "true");
script.id = "fc-script";
document.body.appendChild(script);

let fcScript = document.getElementById("fc-script");
if (fcScript) {
document.body.removeChild(fcScript);
}

// Append the CRM Tracking Code Dynamically
var script = document.createElement("script");
script.src = "https://uae.fw-cdn.com/40116340/63296.js";
script.setAttribute("chat", "true");
script.id = "fc-script";
document.body.appendChild(script);

window.fcWidgetMessengerConfig = {
config: {
headerProperty: {
hideChatButton: this.hideButton,
},
},
};

script.onload = function () {
if (jwt) {
window.fcWidget?.user?.setProperties({
cf_user_jwt: jwt,
});
}
};
};

getTokenForWS = async () => {
Expand Down

0 comments on commit abf25ab

Please sign in to comment.