Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -898,9 +898,56 @@
return menu;
});
},
handleButtonClick: function() {
getFlexBannerUrl: function() {
let defaultFlexUrl = 'https://flex.countly.com?utm_source=countly_lite_banner'; //fallback

return new Promise((resolve) => {
try {
if (!window.Countly) {
CountlyHelpers.notify({
title: "Error",
message: "Countly SDK is not available",
type: "error"
});
return resolve(defaultFlexUrl);
}

let CountlySDK;
if (window.Countly.present_feedback_widget) {
CountlySDK = window.Countly;
}
else {
CountlySDK = window.Countly.init({
app_key: countlyGlobal.frontend_app,
url: countlyGlobal.frontend_server,
device_id: window.Countly.device_id || window.location.hostname,
remote_config: true
});
}

if (CountlySDK.fetch_remote_config) {
CountlySDK.fetch_remote_config(function(err, conf) {
if (err) {
resolve(defaultFlexUrl);
}
else {
resolve(conf.flex_banner_url || defaultFlexUrl);
}
});
}
else {
resolve(defaultFlexUrl);
}
}
catch {
resolve(defaultFlexUrl);
}
});
},
handleButtonClick: async function() {
const flexRedirectUrl = await this.getFlexBannerUrl();
CountlyHelpers.goTo({
url: "https://flex.countly.com",
url: flexRedirectUrl,
isExternalLink: true
});
}
Expand Down
Loading