diff --git a/CHANGELOG.md b/CHANGELOG.md index 0936e9a..bbb3448 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ! Minor breaking change ! For implementations using `salt` the browser compatability is tied to SubtleCrypto's `digest` method support * Added the `salt` init config flag to add checksums to requests (for secure contexts only) +* Added support for Feedback Widgets' terms and conditions ## 23.12.6 diff --git a/cypress/e2e/health_check.cy.js b/cypress/e2e/health_check.cy.js index 131bb7d..0d2fc4e 100644 --- a/cypress/e2e/health_check.cy.js +++ b/cypress/e2e/health_check.cy.js @@ -21,7 +21,7 @@ describe("Health Check tests ", () => { // Test the 'hc' parameter const hcParam = url.searchParams.get("hc"); const hcParamObj = JSON.parse(hcParam); - expect(hcParamObj).to.eql({ el: 0, wl: 0, sc: -1, em: "\"\"" }); + expect(hcParamObj).to.eql({ el: 0, wl: 0, sc: -1, em: "" }); // Test the 'metrics' parameter const metricsParam = url.searchParams.get("metrics"); diff --git a/modules/CountlyClass.js b/modules/CountlyClass.js index b7396df..fa2cd55 100644 --- a/modules/CountlyClass.js +++ b/modules/CountlyClass.js @@ -3065,11 +3065,12 @@ class CountlyClass { url += "&platform=" + this.platform; url += "&app_version=" + this.app_version; url += "&sdk_version=" + sdkVersion; + var customObjectToSendWithTheWidget = {}; + customObjectToSendWithTheWidget.tc = 1; // indicates SDK supports opening links from the widget in a new tab if (feedbackWidgetSegmentation) { - var customObjectToSendWithTheWidget = {}; customObjectToSendWithTheWidget.sg = feedbackWidgetSegmentation; - url += "&custom=" + JSON.stringify(customObjectToSendWithTheWidget); } + url += "&custom=" + JSON.stringify(customObjectToSendWithTheWidget); // Origin is passed to the popup so that it passes it back in the postMessage event // Only web SDK passes origin and web url += "&origin=" + passedOrigin; @@ -4762,12 +4763,16 @@ class CountlyClass { function sendInstantHCRequest() { // truncate error message to 1000 characters var curbedMessage = truncateSingleValue(self.hcErrorMessage, 1000, "healthCheck", log); + // due to some server issues we pass empty string as is + if (curbedMessage !== "") { + curbedMessage = JSON.stringify(curbedMessage); + } // prepare hc object var hc = { el: self.hcErrorCount, wl: self.hcWarningCount, sc: self.hcStatusCode, - em: JSON.stringify(curbedMessage) + em: curbedMessage }; // prepare request var request = {