@mparticle/web-sdk
Advanced tools
Comparing version 2.23.2 to 2.23.3
{ | ||
"name": "@mparticle/web-sdk", | ||
"version": "2.23.2", | ||
"version": "2.23.3", | ||
"description": "mParticle core SDK for web applications", | ||
@@ -87,5 +87,5 @@ "license": "Apache-2.0", | ||
"@rollup/plugin-babel": "6.0.3", | ||
"@rollup/plugin-commonjs": "25.0.2", | ||
"@rollup/plugin-json": "^4.1.0", | ||
"@rollup/plugin-node-resolve": "15.1.0", | ||
"@rollup/plugin-commonjs": "25.0.4", | ||
"@rollup/plugin-json": "^5.0.2", | ||
"@rollup/plugin-node-resolve": "15.2.1", | ||
"@rollup/plugin-typescript": "^11.1.0", | ||
@@ -107,6 +107,6 @@ "@semantic-release/changelog": "^5.0.1", | ||
"eslint": "^8.36.0", | ||
"eslint-config-prettier": "8.8.0", | ||
"eslint-config-prettier": "9.0.0", | ||
"eslint-plugin-prettier": "3.4.1", | ||
"fetch-mock": "^7.5.1", | ||
"gts": "^3.1.0", | ||
"gts": "^5.0.1", | ||
"jest": "^29.5.0", | ||
@@ -113,0 +113,0 @@ "jest-environment-jsdom": "^29.5.0", |
@@ -8,2 +8,7 @@ import { version } from '../package.json'; | ||
Messages: { | ||
DeprecationMessages: { | ||
MethodIsDeprecatedPostfix: | ||
'is a deprecated method and will be removed in future releases', | ||
AlternativeMethodPrefix: 'Please use the alternate method:', | ||
}, | ||
ErrorMessages: { | ||
@@ -167,5 +172,5 @@ NoToken: 'A token must be specified.', | ||
DefaultInstance: 'default_instance', | ||
CCPAPurpose: 'data_sale_opt_out' | ||
CCPAPurpose: 'data_sale_opt_out', | ||
} as const; | ||
export default Constants; |
@@ -37,2 +37,3 @@ // This file is used ONLY for the mParticle ESLint plugin. It should NOT be used otherwise! | ||
_Consent: null, | ||
_Events: null, | ||
_Forwarders: null, | ||
@@ -39,0 +40,0 @@ _NativeSdkHelpers: null, |
@@ -12,2 +12,4 @@ import * as EventsApi from '@mparticle/event-models'; | ||
import { IMPSideloadedKit } from './sideloadedKit'; | ||
import { ISessionManager } from './sessionManager'; | ||
// TODO: Resolve this with version in @mparticle/web-sdk | ||
@@ -130,2 +132,7 @@ export type SDKEventCustomFlags = Dictionary<any>; | ||
// Temporary Interfaces for Events Module | ||
interface IEvents { | ||
logEvent?(event: BaseEvent): void; | ||
} | ||
export interface MParticleWebSDK { | ||
@@ -140,5 +147,6 @@ addForwarder(mockForwarder: MPForwarder): void; | ||
_Helpers: SDKHelpersApi; | ||
_Events: IEvents; | ||
config: SDKInitConfig; | ||
_ServerModel: IServerModel; | ||
_SessionManager: any; // TODO: Set up Session Manager | ||
_SessionManager: ISessionManager; | ||
_Consent: SDKConsentApi; | ||
@@ -237,2 +245,3 @@ Consent: SDKConsentApi; | ||
export interface SDKHelpersApi { | ||
canLog?(): boolean; | ||
createServiceUrl(arg0: string, arg1: string): void; | ||
@@ -313,3 +322,3 @@ createXHR?(cb: () => void): XMLHttpRequest; | ||
messageType: number; | ||
name: string; | ||
name?: string; | ||
eventType?: number; | ||
@@ -316,0 +325,0 @@ data?: { [key: string]: string }; |
import slugify from 'slugify'; | ||
import Constants from './constants'; | ||
const { Messages } = Constants; | ||
type valueof<T> = T[keyof T]; | ||
@@ -45,2 +48,21 @@ | ||
const generateDeprecationMessage = ( | ||
methodName: string, | ||
alternateMethod: string | ||
): string => { | ||
const messageArray: string[] = [ | ||
methodName, | ||
Messages.DeprecationMessages.MethodIsDeprecatedPostfix, | ||
]; | ||
if (alternateMethod) { | ||
messageArray.push(alternateMethod); | ||
messageArray.push( | ||
Messages.DeprecationMessages.MethodIsDeprecatedPostfix | ||
); | ||
} | ||
return messageArray.join(' '); | ||
}; | ||
function generateHash(name: string): number { | ||
@@ -57,3 +79,3 @@ let hash: number = 0; | ||
if (Array.prototype.reduce) { | ||
return name.split('').reduce(function (a: number, b: string) { | ||
return name.split('').reduce(function(a: number, b: string) { | ||
a = (a << 5) - a + b.charCodeAt(0); | ||
@@ -145,5 +167,7 @@ return a & a; | ||
const replaceCommasWithPipes = (value: string): string => value.replace(/,/g, '|'); | ||
const replaceCommasWithPipes = (value: string): string => | ||
value.replace(/,/g, '|'); | ||
const replacePipesWithCommas = (value: string): string => value.replace(/\|/g, ','); | ||
const replacePipesWithCommas = (value: string): string => | ||
value.replace(/\|/g, ','); | ||
@@ -173,3 +197,6 @@ const replaceApostrophesWithQuotes = (value: string): string => | ||
if (s.indexOf('"') === 0) { | ||
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); | ||
s = s | ||
.slice(1, -1) | ||
.replace(/\\"/g, '"') | ||
.replace(/\\\\/g, '\\'); | ||
} | ||
@@ -201,2 +228,3 @@ | ||
findKeyInObject, | ||
generateDeprecationMessage, | ||
generateHash, | ||
@@ -203,0 +231,0 @@ generateUniqueId, |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1488798
26409
0