New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

countly-sdk-web

Package Overview
Dependencies
Maintainers
3
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

countly-sdk-web - npm Package Compare versions

Comparing version 24.4.1 to 24.11.0

cypress.config.js

13

CHANGELOG.md

@@ -0,1 +1,14 @@

## 24.11.0
- Mitigated an issue where SDK could try to send old stored offline mode data during init if `clear_stored_id` was true
- Mitigated an issue where the SDK could stayed on offline mode after the first init with `offline_mode` set to true
- Mitigated an issue where old Rating widget stickers were not cleared when a new one was presented
- Improved view tracking logic
- Default request method is now set to "POST"
- Healtchecks won't be sent in offline mode anymore
- Added a new interface 'feedback' which includes convenience methods to show feedback widgets:
- showNPS([String nameIDorTag]) - for displaying the first available NPS widget or one with the given name, Tag or ID value
- showSurvey([String nameIDorTag]) - for displaying the first available Survey widget or one with the given name, Tag or ID value
- showRating([String nameIDorTag]) - for displaying the first available Rating widget or one with the given name, Tag or ID value
## 24.4.1

@@ -2,0 +15,0 @@ - Added types for the SDK

8

cypress/support/commands.js

@@ -84,7 +84,7 @@ import "./index";

else if (!isSessionEnd) {
expect(queueObject.session_duration).to.be.within(duration - 5, duration + 5);
expect(queueObject.session_duration).to.be.within(duration, duration + 2);
}
else {
expect(queueObject.end_session).to.equal(1);
expect(queueObject.session_duration).to.be.within(duration - 5, duration + 5);
expect(queueObject.session_duration).to.be.within(duration, duration + 1);
}

@@ -166,3 +166,5 @@ cy.check_request_commons(queueObject, appKey);

}
expect(queueObject.segmentation.name).to.equal(name);
if (!name.startsWith("/__cypress/iframes/")) { // changes depending on cypress env
expect(queueObject.segmentation.name).to.equal(name);
}
cy.check_commons(queueObject);

@@ -169,0 +171,0 @@ });

@@ -71,17 +71,28 @@ var Countly = require("../../lib/countly");

/**
* This intercepts the request the SDK makes and returns the request parameters to the callback function
* @param {String} requestType - GET, POST, PUT, DELETE
* @param {String} requestUrl - request url (https://your.domain.countly)
* @param {String} endPoint - endpoint (/i)
* @param {String} requestParams - request parameters (?begin_session=**)
* Intercepts SDK requests and returns request parameters to the callback function.
* @param {String} requestType - GET or POST
* @param {String} requestUrl - base URL (e.g., https://your.domain.count.ly)
* @param {String} endPoint - endpoint (e.g., /i)
* @param {String} aliasParam - parameter to match in requests (e.g., "hc", "begin_session")
* @param {String} alias - alias for the request
* @param {Function} callback - callback function
* @param {Function} callback - callback function for parsed parameters
*/
function interceptAndCheckRequests(requestType, requestUrl, endPoint, requestParams, alias, callback) {
requestUrl = requestUrl || "https://your.domain.countly"; // TODO: might be needed in the future but not yet
function interceptAndCheckRequests(requestType, requestUrl, endPoint, aliasParam, alias, callback) {
requestType = requestType || "GET";
requestUrl = requestUrl || "https://your.domain.count.ly";
endPoint = endPoint || "/i";
requestParams = requestParams || "?**";
alias = alias || "getXhr";
cy.intercept(requestUrl + endPoint + requestParams, (req) => {
// Intercept requests
cy.intercept(requestType, requestUrl + endPoint + "*", (req) => {
if (requestType === "POST" && req.body) {
// Parse URL-encoded body for POST requests
const params = new URLSearchParams(req.body);
callback(params);
} else {
// Parse URL parameters for GET requests
const url = new URL(req.url);
const params = url.searchParams;
callback(params);
}
req.reply(200, { result: "Success" }, {

@@ -91,6 +102,9 @@ "x-countly-rr": "2"

}).as(alias);
// Wait for the request alias to be triggered
cy.wait("@" + alias).then((xhr) => {
const url = new URL(xhr.request.url);
const searchParams = url.searchParams;
callback(searchParams);
const params = requestType === "POST" && xhr.request.body
? new URLSearchParams(xhr.request.body)
: new URL(xhr.request.url).searchParams;
callback(params);
});

@@ -97,0 +111,0 @@ }

import "./commands";
import "../../lib/countly";
import "../../lib/countly.js";

@@ -460,2 +460,29 @@ declare module "countly-sdk-web" {

/**
* Feedback interface with convenience methods for feedback widgets:
* - showNPS([nameIDorTag]) - shows an NPS widget by name, id, or tag, or a random one if not provided
* - showSurvey([nameIDorTag]) - shows a Survey widget by name, id, or tag, or a random one if not provided
* - showRating([nameIDorTag]) - shows a Rating widget by name, id, or tag, or a random one if not provided
*/
const feedback: Feedback;
interface Feedback {
/**
* Displays the first available NPS widget or the one with the provided name, id, or tag.
* @param nameIDorTag - Optional name, id, or tag of the NPS widget to display.
*/
showNPS(nameIDorTag?: string): void;
/**
* Displays the first available Survey widget or the one with the provided name, id, or tag.
* @param nameIDorTag - Optional name, id, or tag of the Survey widget to display.
*/
showSurvey(nameIDorTag?: string): void;
/**
* Displays the first available Rating widget or the one with the provided name, id, or tag.
* @param nameIDorTag - Optional name, id, or tag of the Rating widget to display.
*/
showRating(nameIDorTag?: string): void;
}
/**
* This function retrieves all associated widget information (IDs, type, name etc in an array/list of objects) of your app

@@ -462,0 +489,0 @@ * @param {Function} callback - Callback function with two parameters, 1st for returned list, 2nd for error

{
"name": "countly-sdk-web",
"version": "24.4.1",
"version": "24.11.0",
"description": "Countly Web SDK",

@@ -37,4 +37,4 @@ "main": "lib/countly.js",

"devDependencies": {
"cypress": "^9.5.0",
"cypress-localstorage-commands": "^1.7.0",
"cypress": "^13.6.0",
"cypress-localstorage-commands": "^2.2.5",
"eslint": "^8.37.0",

@@ -41,0 +41,0 @@ "eslint-config-airbnb": "^19.0.4",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc