Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mparticle/web-sdk

Package Overview
Dependencies
Maintainers
10
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mparticle/web-sdk - npm Package Compare versions

Comparing version 2.21.0 to 2.21.1

31

package.json
{
"name": "@mparticle/web-sdk",
"version": "2.21.0",
"version": "2.21.1",
"description": "mParticle core SDK for web applications",

@@ -32,7 +32,7 @@ "license": "Apache-2.0",

"build:test-bundle": "cross-env TESTTYPE=main ENVIRONMENT=prod rollup --config rollup.test.config.js",
"build:browserify:cjs": "browserify test/integrations/cjs/browserify/index.js -o test/integrations/cjs/dist/browserify-output.js && npm run test:karma:browserify:cjs",
"build:rollup:cjs": "rollup --config test/integrations/cjs/rollup/rollup.config.js && npm run test:karma:rollup:cjs",
"build:webpack:cjs": "webpack --config test/integrations/cjs/webpack/webpack.config.js && npm run test:karma:webpack:cjs",
"build:rollup:module": "rollup --config test/integrations/module/rollup/rollup.config.js && npm run test:karma:rollup:module",
"build:webpack:module": "webpack --config test/integrations/module/webpack/webpack.config.js && npm run test:karma:webpack:module",
"build:browserify:cjs": "browserify test/integrations/cjs/browserify/index.js -o test/integrations/cjs/dist/browserify-output.js",
"build:rollup:cjs": "rollup --config test/integrations/cjs/rollup/rollup.config.js",
"build:webpack:cjs": "webpack --config test/integrations/cjs/webpack/webpack.config.js",
"build:rollup:module": "rollup --config test/integrations/module/rollup/rollup.config.js",
"build:webpack:module": "webpack --config test/integrations/module/webpack/webpack.config.js",
"build:ts": "tsc -p .",

@@ -43,4 +43,9 @@ "test": "npm run build && npm run build:test-bundle && cross-env DEBUG=false karma start test/karma.config.js",

"test:integrations": "npm run test:requirejs && npm run test:integrations:cjs && npm run test:integrations:module",
"test:integrations:cjs": "npm run build:browserify:cjs && npm run build:webpack:cjs && npm run build:rollup:cjs",
"test:integrations:module": "npm run build:webpack:module && npm run build:rollup:module",
"test:integrations:cjs": "npm run test:integrations:cjs:browserfy && npm run test:integrations:cjs:webpack && npm run test:integrations:cjs:rollup",
"test:integrations:cjs:browserfy": "npm run build:browserify:cjs && npm run test:karma:browserify:cjs",
"test:integrations:cjs:webpack": "npm run build:webpack:cjs && npm run test:karma:webpack:cjs",
"test:integrations:cjs:rollup": "npm run build:rollup:cjs && npm run test:karma:rollup:cjs",
"test:integrations:module": "npm run test:integrations:module:webpack && npm run test:integrations:module:rollup",
"test:integrations:module:webpack": "npm run build:webpack:module && npm run test:karma:webpack:module",
"test:integrations:module:rollup": "npm run build:rollup:module && npm run test:karma:rollup:module",
"test:requirejs": "npm run test:requirejs:before && npm run test:requirejs:after",

@@ -54,2 +59,4 @@ "test:requirejs:before": "cross-env FILE_ORDER=before_mp karma start test/integrations/requirejs/karma.requirejs.config.js",

"test:karma:rollup:module": "cross-env BUNDLER=rollup karma start test/integrations/module/karma.rollup.config.js",
"test:jest": "jest --config jest.config.js",
"test:jest:watch": "jest --config jest.config.js --watch",
"watch": "cross-env ENVIRONMENT=dev BUILD=iife rollup --config rollup.config.js -w",

@@ -82,7 +89,7 @@ "watch:all": "cross-env ENVIRONMENT=prod BUILDALL=true rollup --config rollup.config.js -w",

"@mparticle/event-models": "^1.1.6",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-typescript": "^8.3.3",
"@rollup/plugin-babel": "6.0.3",
"@rollup/plugin-commonjs": "22.0.2",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "13.3.0",
"@rollup/plugin-typescript": "^8.3.3",
"@semantic-release/changelog": "^5.0.1",

@@ -92,2 +99,4 @@ "@semantic-release/exec": "^5.0.0",

"@types/chai": "^4.2.3",
"@types/jest": "^29.5.1",
"@types/jest-expect-message": "^1.1.0",
"@types/mocha": "^9.0.0",

@@ -106,2 +115,3 @@ "@types/mparticle__web-sdk": "^2.16.1",

"gts": "^3.1.0",
"jest": "^29.5.0",
"karma": "^6.3.2",

@@ -124,2 +134,3 @@ "karma-chai": "^0.1.0",

"sinon": "^11.0.0",
"ts-jest": "^29.1.0",
"tslib": "^2.1.0",

@@ -126,0 +137,0 @@ "typescript": "^5.0.2",

@@ -9,3 +9,3 @@ // This file is used ONLY for the mParticle ESLint plugin. It should NOT be used otherwise!

const mockFunction = function () {
const mockFunction = function() {
return null;

@@ -18,8 +18,8 @@ };

_Helpers: {
sanitizeAttributes:
window.mParticle.getInstance()._Helpers.sanitizeAttributes,
generateHash: function () {
sanitizeAttributes: window.mParticle.getInstance()._Helpers
.sanitizeAttributes,
generateHash: function() {
return 'mockHash';
},
generateUniqueId: function () {
generateUniqueId: function() {
return 'mockId';

@@ -55,3 +55,2 @@ },

deviceId: null,
migrationData: {},
serverSettings: {},

@@ -70,3 +69,2 @@ dateLastEventSent: null,

identityCallInFlight: false,
migratingToIDSyncCookies: false,
nonCurrentUserMPIDs: {},

@@ -135,3 +133,3 @@ identifyCalled: false,

const sdkEvents: SDKEvent[] = Array.isArray(events)
? events.map((event) => this.createSDKEventFunction(event))
? events.map(event => this.createSDKEventFunction(event))
: [this.createSDKEventFunction(events)];

@@ -138,0 +136,0 @@

@@ -31,3 +31,2 @@ //

import Events from './events';
import Migrations from './migrations';
import Forwarders from './forwarders';

@@ -63,3 +62,2 @@ import ServerModel from './serverModel';

this._NativeSdkHelpers = new NativeSdkHelpers(this);
this._Migrations = new Migrations(this);
this._SessionManager = new SessionManager(this);

@@ -1350,5 +1348,2 @@ this._Persistence = new Persistence(this);

if (!mpInstance._Store.webviewBridgeEnabled) {
// Migrate any cookies from previous versions to current cookie version
mpInstance._Migrations.migrate();
// Load any settings/identities/attributes from cookie or localStorage

@@ -1404,11 +1399,2 @@ mpInstance._Persistence.initializeStorage();

// If migrating from pre-IDSync to IDSync, a sessionID will exist and an identify request will not have been fired, so we need this check
if (mpInstance._Store.migratingToIDSyncCookies) {
mpInstance.Identity.identify(
mpInstance._Store.SDKConfig.identifyRequest,
mpInstance._Store.SDKConfig.identityCallback
);
mpInstance._Store.migratingToIDSyncCookies = false;
}
currentUser = mpInstance.Identity.getCurrentUser();

@@ -1563,3 +1549,5 @@

//check to see if localStorage is available for migrating purposes
// Check to see if localStorage is available before main configuration runs
// since we will need this for the current implementation of user persistence
// TODO: Refactor this when we refactor User Identity Persistence
try {

@@ -1566,0 +1554,0 @@ mpInstance._Store.isLocalStorageAvailable = mpInstance._Persistence.determineLocalStorageAvailability(

@@ -101,12 +101,6 @@ import { Context } from '@mparticle/event-models';

maxCookieSize: number
): void;
): string;
findPrevCookiesBasedOnUI(identityApiData: IdentityApiData): void;
encodePersistence(persistance: IPersistenceMinified): string;
decodePersistence(persistance: IPersistenceMinified): string;
replaceCommasWithPipes(string: string): string;
replacePipesWithCommas(string: string): string;
replaceApostrophesWithQuotes(string: string): string;
replaceQuotesWithApostrophes(string: string): string;
createCookieString(string: string): string;
revertCookieString(string: string): string;
encodePersistence(persistence: IPersistenceMinified): string;
decodePersistence(persistenceString: string): string;
getCookieDomain(): string;

@@ -113,0 +107,0 @@ getDomain(doc: string, locationHostname: string): string;

import Constants from './constants';
import Polyfill from './polyfill';
import * as Utils from './utils';

@@ -763,9 +764,11 @@ var Base64 = Polyfill.Base64,

return self.createCookieString(JSON.stringify(persistence));
return Utils.createCookieString(JSON.stringify(persistence));
};
// TODO: This should actually be decodePersistenceString or
// we should refactor this to take a string and return an object
this.decodePersistence = function(persistence) {
try {
if (persistence) {
persistence = JSON.parse(self.revertCookieString(persistence));
persistence = JSON.parse(Utils.revertCookieString(persistence));
if (

@@ -821,30 +824,2 @@ mpInstance._Helpers.isObject(persistence) &&

this.replaceCommasWithPipes = function(string) {
return string.replace(/,/g, '|');
};
this.replacePipesWithCommas = function(string) {
return string.replace(/\|/g, ',');
};
this.replaceApostrophesWithQuotes = function(string) {
return string.replace(/\'/g, '"');
};
this.replaceQuotesWithApostrophes = function(string) {
return string.replace(/\"/g, "'");
};
this.createCookieString = function(string) {
return self.replaceCommasWithPipes(
self.replaceQuotesWithApostrophes(string)
);
};
this.revertCookieString = function(string) {
return self.replacePipesWithCommas(
self.replaceApostrophesWithQuotes(string)
);
};
this.getCookieDomain = function() {

@@ -851,0 +826,0 @@ if (mpInstance._Store.SDKConfig.cookieDomain) {

@@ -145,3 +145,7 @@ import * as EventsApi from '@mparticle/event-models';

_preInit: any; // TODO: Set up API
_resetForTests(MPConfig?: SDKInitConfig): void;
_resetForTests(
MPConfig?: SDKInitConfig,
keepPersistence?: boolean,
instance?: MParticleWebSDK
): void;
init(apiKey: string, config: SDKInitConfig, instanceName?: string): void;

@@ -148,0 +152,0 @@ getAppName(): string;

@@ -100,5 +100,5 @@ import { Batch } from '@mparticle/event-models';

// TODO: Placeholder Types, MigrationData is temporary and will be removed in the future to reduce SDK size
// TODO: Placeholder Types to be filled in as we migrate more modules
// to TypeScript
export type PixelConfiguration = Dictionary;
export type MigrationData = Dictionary;
export type ServerSettings = Dictionary;

@@ -126,3 +126,2 @@ export type SessionAttributes = Dictionary;

devToken: string | null;
migrationData: MigrationData;
serverSettings: ServerSettings;

@@ -142,3 +141,2 @@ dateLastEventSent: Date;

SDKConfig: Partial<SDKConfig>;
migratingToIDSyncCookies: boolean; // TODO: Remove when we archive Web SDK v1
nonCurrentUserMPIDs: Record<MPID, Dictionary>;

@@ -179,3 +177,2 @@ identifyCalled: boolean;

devToken: null,
migrationData: {},
serverSettings: {},

@@ -195,3 +192,2 @@ dateLastEventSent: null,

SDKConfig: {},
migratingToIDSyncCookies: false,
nonCurrentUserMPIDs: {},

@@ -231,6 +227,5 @@ identifyCalled: false,

if (config.hasOwnProperty('isDevelopmentMode')) {
this.SDKConfig.isDevelopmentMode =
mpInstance._Helpers.returnConvertedBoolean(
config.isDevelopmentMode
);
this.SDKConfig.isDevelopmentMode = mpInstance._Helpers.returnConvertedBoolean(
config.isDevelopmentMode
);
} else {

@@ -237,0 +232,0 @@ this.SDKConfig.isDevelopmentMode = false;

@@ -8,2 +8,8 @@ import slugify from 'slugify';

const createCookieString = (value: string): string =>
replaceCommasWithPipes(replaceQuotesWithApostrophes(value));
const revertCookieString = (value: string): string =>
replacePipesWithCommas(replaceApostrophesWithQuotes(value));
const inArray = (items: any[], name: string): boolean => {

@@ -138,2 +144,12 @@ let i = 0;

const replaceCommasWithPipes = (value: string): string => value.replace(/,/g, '|');
const replacePipesWithCommas = (value: string): string => value.replace(/\|/g, ',');
const replaceApostrophesWithQuotes = (value: string): string =>
value.replace(/\'/g, '"');
const replaceQuotesWithApostrophes = (value: string): string =>
value.replace(/\"/g, "'");
// FIXME: REFACTOR for V3

@@ -177,2 +193,4 @@ // only used in store.js to sanitize server-side formatting of

export {
createCookieString,
revertCookieString,
valueof,

@@ -190,2 +208,6 @@ converted,

parseStringOrNumber,
replaceCommasWithPipes,
replacePipesWithCommas,
replaceApostrophesWithQuotes,
replaceQuotesWithApostrophes,
returnConvertedBoolean,

@@ -192,0 +214,0 @@ isString,

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

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

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