Socket
Socket
Sign inDemoInstall

@mparticle/web-sdk

Package Overview
Dependencies
Maintainers
10
Versions
108
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.1 to 2.21.2

5

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

@@ -49,3 +49,3 @@ "license": "Apache-2.0",

"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",
"test:requirejs": "npm run build && npm run test:requirejs:before && npm run test:requirejs:after",
"test:requirejs:before": "cross-env FILE_ORDER=before_mp karma start test/integrations/requirejs/karma.requirejs.config.js",

@@ -112,2 +112,3 @@ "test:requirejs:after": "cross-env FILE_ORDER=after_mp karma start test/integrations/requirejs/karma.requirejs.config.js",

"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"karma": "^6.3.2",

@@ -114,0 +115,0 @@ "karma-chai": "^0.1.0",

79

src/apiClient.ts

@@ -11,7 +11,5 @@ import Constants from './constants';

import KitBlocker from './kitBlocking';
import { Dictionary, getRampNumber } from './utils';
import { Dictionary, getRampNumber, isEmpty } from './utils';
import { IUploadObject } from './serverModel';
const Messages = Constants.Messages;
export type ForwardingStatsData = Dictionary<any>;

@@ -22,3 +20,2 @@

queueEventForBatchUpload: (event: SDKEvent) => void;
shouldEnableBatching: () => boolean;
processQueuedEvents: () => void;

@@ -60,18 +57,2 @@ appendUserInfoToEvents: (user: MParticleUser, events: SDKEvent[]) => void;

this.shouldEnableBatching = function() {
// Returns a string of a number that must be parsed
// Invalid strings will be parsed to NaN which is falsey
const eventsV3Percentage = parseInt(
mpInstance._Helpers.getFeatureFlag(Constants.FeatureFlags.EventsV3),
10
);
if (!eventsV3Percentage) {
return false;
}
const rampNumber = getRampNumber(mpInstance._Store.deviceId);
return eventsV3Percentage >= rampNumber;
};
this.processQueuedEvents = function() {

@@ -141,11 +122,11 @@ let mpid,

if (event && options.shouldUploadEvent) {
if (this.shouldEnableBatching()) {
this.queueEventForBatchUpload(event);
} else {
this.sendSingleEventToServer(event);
}
if (isEmpty(event)) {
return;
}
if (event && event.EventName !== Types.MessageType.AppStateTransition) {
if (options.shouldUploadEvent) {
this.queueEventForBatchUpload(event);
}
if (event.EventName !== Types.MessageType.AppStateTransition) {
if (kitBlocker && kitBlocker.kitBlockingEnabled) {

@@ -163,46 +144,2 @@ event = kitBlocker.createBlockedEvent(event);

this.sendSingleEventToServer = function(event) {
if (event.EventDataType === Types.MessageType.Media) {
return;
}
let xhr,
xhrCallback = function() {
if (xhr.readyState === 4) {
mpInstance.Logger.verbose(
'Received ' + xhr.statusText + ' from server'
);
mpInstance._Persistence.update();
}
};
if (!event) {
mpInstance.Logger.error(Messages.ErrorMessages.EventEmpty);
return;
}
mpInstance.Logger.verbose(Messages.InformationMessages.SendHttp);
xhr = mpInstance._Helpers.createXHR(xhrCallback);
if (xhr) {
try {
xhr.open(
'post',
mpInstance._Helpers.createServiceUrl(
mpInstance._Store.SDKConfig.v2SecureServiceUrl,
mpInstance._Store.devToken
) + '/Events'
);
xhr.send(
JSON.stringify(
mpInstance._ServerModel.convertEventToV2DTO(
event as IUploadObject
)
)
);
} catch (e) {
mpInstance.Logger.error(
'Error sending event to mParticle servers. ' + e
);
}
}
};
this.sendBatchForwardingStatsToServer = function(forwardingStatsData, xhr) {

@@ -209,0 +146,0 @@ let url;

@@ -162,3 +162,2 @@ import { version } from '../package.json';

ReportBatching: 'reportBatching',
EventsV3: 'eventsV3',
EventBatchingIntervalMillis: 'eventBatchingIntervalMillis',

@@ -165,0 +164,0 @@ OfflineStorage: 'offlineStorage',

@@ -1291,14 +1291,2 @@ //

if (config.flags) {
if (config.flags.hasOwnProperty(Constants.FeatureFlags.EventsV3)) {
// TODO: Remove this after 8/12/2022
if (config.flags[Constants.FeatureFlags.EventsV3] !== '100') {
var message =
'mParticle will be enabling Event Batching for all customers on July 12, 2022. ' +
'For more details, please see our docs: https://docs.mparticle.com/developers/sdk/web/getting-started/';
mpInstance.Logger.warning(message);
}
mpInstance._Store.SDKConfig.flags[Constants.FeatureFlags.EventsV3] =
config.flags[Constants.FeatureFlags.EventsV3];
}
if (

@@ -1305,0 +1293,0 @@ config.flags.hasOwnProperty(

@@ -421,9 +421,2 @@ import { Batch } from '@mparticle/event-models';

!this.SDKConfig.flags.hasOwnProperty(
Constants.FeatureFlags.EventsV3
)
) {
this.SDKConfig.flags[Constants.FeatureFlags.EventsV3] = 0;
}
if (
!this.SDKConfig.flags.hasOwnProperty(
Constants.FeatureFlags.EventBatchingIntervalMillis

@@ -430,0 +423,0 @@ )

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