Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prince/Freshchat update #2044

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 31 additions & 27 deletions public/scripts/freshchat.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,35 +123,39 @@ 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: {

// 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);

script.onload = function () {
if (jwt) {
window.fcWidget?.user?.setProperties({
cf_user_jwt: jwt,
},
config: {
headerProperty: {
hideChatButton: this.hideButton,
});
} 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,
},
},
};

// 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);
}
config: {
headerProperty: {
hideChatButton: this.hideButton,
},
},
};
}
};
};

getTokenForWS = async () => {
Expand Down
Loading