@mparticle/web-sdk
Advanced tools
Comparing version 2.9.9-rc.1 to 2.9.10-rc.1
## Releases | ||
-- | ||
#### 2.9.10 - 2019-08-21 | ||
* Add integration tests for bundlers (webpack, browserify, rollup) | ||
* Bugfix - Make getCartProducts more robust | ||
* Bugfix - Fix immediate logging for self hosting | ||
* Feat - Feat - add session start to server DTO | ||
* Bugfix - update modify old_value | ||
#### 2.9.9 - 2019-08-07 | ||
@@ -5,0 +12,0 @@ * Bugfix - Check all event attributes when forwarding rules are set |
{ | ||
"name": "@mparticle/web-sdk", | ||
"version": "2.9.9-rc.1", | ||
"version": "2.9.10-rc.1", | ||
"description": "mParticle core SDK for web applications", | ||
@@ -21,6 +21,18 @@ "license": "Apache-2.0", | ||
"test:debug": "DEBUG=true karma start test/karma.config.js", | ||
"test:integration": "npm run test:requirejs", | ||
"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:requirejs": "npm run test:requirejs:before && npm run test:requirejs:after", | ||
"test:requirejs:before": "FILE_ORDER=before_mp karma start test/karma.requirejs.config.js", | ||
"test:requirejs:after": "FILE_ORDER=after_mp karma start test/karma.requirejs.config.js", | ||
"test:requirejs:before": "FILE_ORDER=before_mp karma start test/integrations/requirejs/karma.requirejs.config.js", | ||
"test:requirejs:after": "FILE_ORDER=after_mp karma start test/integrations/requirejs/karma.requirejs.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", | ||
"test:karma:webpack:cjs": "BUNDLER=webpack karma start test/integrations/cjs/karma.webpack.config.js", | ||
"test:karma:browserify:cjs": "BUNDLER=browserify karma start test/integrations/cjs/karma.browserify.config.js", | ||
"test:karma:rollup:cjs": "BUNDLER=rollup karma start test/integrations/cjs/karma.rollup.config.js", | ||
"test:karma:webpack:module": "BUNDLER=webpack karma start test/integrations/module/karma.webpack.config.js", | ||
"test:karma:rollup:module": "BUNDLER=rollup karma start test/integrations/module/karma.rollup.config.js", | ||
"build": "ENVIRONMENT=prod rollup --config rollup.config.js", | ||
@@ -40,2 +52,3 @@ "build:dev": "ENVIRONMENT=dev rollup --config rollup.config.js", | ||
"browser-sync": "^2.26.3", | ||
"browserify": "^16.3.0", | ||
"chai": "^4.2.0", | ||
@@ -55,12 +68,13 @@ "eslint": "^6.1.0", | ||
"pre-commit": "^1.2.2", | ||
"rollup": "^1.16.7", | ||
"rollup-plugin-commonjs": "^10.0.1", | ||
"rollup": "^1.19.4", | ||
"rollup-plugin-commonjs": "^10.0.2", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"shelljs": "^0.7.8", | ||
"should": "^7.1.0", | ||
"sinon": "^4.1.2", | ||
"sinon-browser-only": "^1.12.1", | ||
"sinon": "^7.4.1", | ||
"uglify-js": "^3.4.9", | ||
"webpack": "^4.39.1", | ||
"webpack-cli": "^3.3.6", | ||
"yuidocjs": "^0.10.2" | ||
} | ||
} |
@@ -47,4 +47,4 @@ import Helpers from './helpers'; | ||
// We queue events if there is no MPID (MPID is null, or === 0), or there are integrations that that require this to stall because integration attributes | ||
// need to be set, and so require delaying events | ||
if (!mpid || mParticle.Store.requireDelay) { | ||
// need to be set, or if we are still fetching the config (self hosted only), and so require delaying events | ||
if (!mpid || mParticle.Store.requireDelay || !mParticle.Store.configurationLoaded) { | ||
mParticle.Logger.verbose('Event was added to eventQueue. eventQueue will be processed once a valid MPID is returned or there is no more integration imposed delay.'); | ||
@@ -54,3 +54,2 @@ mParticle.Store.eventQueue.push(event); | ||
Helpers.processQueuedEvents(mParticle.Store.eventQueue, mpid, !mParticle.Store.requiredDelay, sendEventToServer, sendEventToForwarders, parseEventResponse); | ||
if (!event) { | ||
@@ -57,0 +56,0 @@ mParticle.Logger.error(Messages.ErrorMessages.EventEmpty); |
var Constants = { | ||
sdkVersion: '2.9.9', | ||
sdkVersion: '2.9.10', | ||
sdkVendor: 'mparticle', | ||
@@ -4,0 +4,0 @@ platform: 'web', |
@@ -107,3 +107,3 @@ import Helpers from './helpers'; | ||
identityChanges.push({ | ||
old_value: previousIdentities[Types.IdentityType.getIdentityType(key)] || null, | ||
old_value: previousIdentities[key] || null, | ||
new_value: newIdentities[key], | ||
@@ -948,3 +948,3 @@ identity_type: key | ||
try { | ||
mParticle.Logger.verbose('Parsing identity response from server'); | ||
mParticle.Logger.verbose('Parsing "' + method + '" identity response from server'); | ||
if (xhr.responseText) { | ||
@@ -995,5 +995,3 @@ identityApiResult = JSON.parse(xhr.responseText); | ||
checkIdentitySwap(previousMPID, identityApiResult.mpid, mParticle.Store.currentSessionMPIDs); | ||
Helpers.processQueuedEvents(mParticle.Store.eventQueue, identityApiResult.mpid, !mParticle.Store.requireDelay, ApiClient.sendEventToServer, sendEventToForwarders, Events.parseEventResponse); | ||
//if there is any previous migration data | ||
@@ -1040,2 +1038,4 @@ if (Object.keys(mParticle.Store.migrationData).length) { | ||
} | ||
Helpers.processQueuedEvents(mParticle.Store.eventQueue, identityApiResult.mpid, !mParticle.Store.requireDelay, ApiClient.sendEventToServer, sendEventToForwarders, Events.parseEventResponse); | ||
} | ||
@@ -1042,0 +1042,0 @@ |
@@ -99,3 +99,6 @@ // | ||
} | ||
// Fetch config when requestConfig = true, otherwise, proceed with SDKInitialization | ||
runPreConfigFetchInitialization(apiKey, config); | ||
// /config code - Fetch config when requestConfig = true, otherwise, proceed with SDKInitialization | ||
// Since fetching the configuration is asynchronous, we must pass completeSDKInitialization | ||
@@ -747,8 +750,3 @@ // to it for it to be run after fetched | ||
function completeSDKInitialization(apiKey, config) { | ||
mParticle.Logger = new Logger(config); | ||
mParticle.Store = new Store(config, mParticle.Logger); | ||
mParticle.Store.webviewBridgeEnabled = NativeSdkHelpers.isWebviewEnabled(mParticle.Store.SDKConfig.requiredWebviewBridgeName, mParticle.Store.SDKConfig.minWebviewBridgeVersion); | ||
mParticle.Store.configurationLoaded = true; | ||
if (mParticle.Store.webviewBridgeEnabled) { | ||
@@ -762,13 +760,2 @@ NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.SetSessionAttribute, JSON.stringify({ key: '$src_env', value: 'webview' })); | ||
mParticle.Store.devToken = apiKey || null; | ||
mParticle.Logger.verbose(Messages.InformationMessages.StartingInitialization); | ||
//check to see if localStorage is available for migrating purposes | ||
mParticle.Store.isLocalStorageAvailable = Persistence.determineLocalStorageAvailability(window.localStorage); | ||
// Migrate any cookies from previous versions to current cookie version | ||
Migrations.migrate(); | ||
// Load any settings/identities/attributes from cookie or localStorage | ||
Persistence.initializeStorage(); | ||
// If no initialIdentityRequest is passed in, we set the user identities to what is currently in cookies for the identify request | ||
@@ -835,3 +822,2 @@ if ((Helpers.isObject(mParticle.Store.SDKConfig.identifyRequest) && Helpers.isObject(mParticle.Store.SDKConfig.identifyRequest.userIdentities) && | ||
Events.logAST(); | ||
} | ||
@@ -857,2 +843,22 @@ // Call any functions that are waiting for the library to be initialized | ||
function runPreConfigFetchInitialization(apiKey, config) { | ||
mParticle.Logger = new Logger(config); | ||
mParticle.Store = new Store(config, mParticle.Logger); | ||
mParticle.Store.devToken = apiKey || null; | ||
mParticle.Logger.verbose(Messages.InformationMessages.StartingInitialization); | ||
//check to see if localStorage is available for migrating purposes | ||
mParticle.Store.isLocalStorageAvailable = Persistence.determineLocalStorageAvailability(window.localStorage); | ||
mParticle.Store.webviewBridgeEnabled = NativeSdkHelpers.isWebviewEnabled(mParticle.Store.SDKConfig.requiredWebviewBridgeName, mParticle.Store.SDKConfig.minWebviewBridgeVersion); | ||
if (!mParticle.Store.webviewBridgeEnabled) { | ||
// Migrate any cookies from previous versions to current cookie version | ||
Migrations.migrate(); | ||
// Load any settings/identities/attributes from cookie or localStorage | ||
Persistence.initializeStorage(); | ||
} | ||
} | ||
function processPreloadedItem(readyQueueItem) { | ||
@@ -859,0 +865,0 @@ var currentUser, |
@@ -757,8 +757,12 @@ import Helpers from './helpers'; | ||
function getCartProducts(mpid) { | ||
var allCartProducts = JSON.parse(Base64.decode(localStorage.getItem(mParticle.Store.prodStorageName))); | ||
if (allCartProducts && allCartProducts[mpid] && allCartProducts[mpid].cp) { | ||
return allCartProducts[mpid].cp; | ||
} else { | ||
return []; | ||
var allCartProducts, | ||
cartProductsString = localStorage.getItem(mParticle.Store.prodStorageName); | ||
if (cartProductsString) { | ||
allCartProducts = JSON.parse(Base64.decode(cartProductsString)); | ||
if (allCartProducts && allCartProducts[mpid] && allCartProducts[mpid].cp) { | ||
return allCartProducts[mpid].cp; | ||
} | ||
} | ||
return []; | ||
} | ||
@@ -765,0 +769,0 @@ |
@@ -126,2 +126,3 @@ import Types from './types'; | ||
SessionId: mParticle.Store.sessionId, | ||
SessionStartDate: mParticle.Store.sessionStartDate ? mParticle.Store.sessionStartDate.getTime() : null, | ||
EventDataType: messageType, | ||
@@ -147,2 +148,3 @@ Debug: mParticle.Store.SDKConfig.isDevelopmentMode, | ||
mParticle.Store.currentSessionMPIDs = []; | ||
mParticle.Store.sessionStartDate = null; | ||
} | ||
@@ -170,2 +172,3 @@ | ||
sl: event.SessionLength, | ||
ssd: event.SessionStartDate, | ||
dt: event.EventDataType, | ||
@@ -172,0 +175,0 @@ dbg: event.Debug, |
@@ -52,2 +52,3 @@ import Constants from './constants'; | ||
context: '', | ||
configurationLoaded: false, | ||
identityCallInFlight: false, | ||
@@ -54,0 +55,0 @@ SDKConfig: {}, |
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
565085
12824
26