@mparticle/web-sdk
Advanced tools
Comparing version 2.12.9 to 2.13.0
@@ -0,1 +1,8 @@ | ||
# [2.13.0](https://github.com/mParticle/mparticle-web-sdk/compare/v2.12.9...v2.13.0) (2021-07-29) | ||
### Features | ||
* Bypass functionality when a specific config option is passed ([#159](https://github.com/mParticle/mparticle-web-sdk/issues/159)) ([2727a43](https://github.com/mParticle/mparticle-web-sdk/commit/2727a437a6d0a25481c9120b3c93fd23fb520f37)) | ||
## [2.12.9](https://github.com/mParticle/mparticle-web-sdk/compare/v2.12.8...v2.12.9) (2021-06-23) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "@mparticle/web-sdk", | ||
"version": "2.12.9", | ||
"version": "2.13.0", | ||
"description": "mParticle core SDK for web applications", | ||
@@ -77,4 +77,4 @@ "license": "Apache-2.0", | ||
"@types/chai": "^4.2.3", | ||
"@types/mocha": "^8.2.2", | ||
"@types/node": "^15.0.1", | ||
"@types/mocha": "^9.0.0", | ||
"@types/node": "^16.0.0", | ||
"babel-eslint": "^10.0.3", | ||
@@ -81,0 +81,0 @@ "babel-preset-minify": "^0.5.1", |
@@ -62,3 +62,8 @@ import Constants from './constants'; | ||
this.sendEventToServer = function(event) { | ||
this.sendEventToServer = function(event, _options) { | ||
var defaultOptions = { | ||
shouldUploadEvent: true, | ||
}; | ||
var options = mpInstance._Helpers.extend(defaultOptions, _options); | ||
if (mpInstance._Store.webviewBridgeEnabled) { | ||
@@ -98,6 +103,8 @@ mpInstance._NativeSdkHelpers.sendToNative( | ||
if (this.shouldEnableBatching()) { | ||
this.queueEventForBatchUpload(event); | ||
} else { | ||
this.sendSingleEventToServer(event); | ||
if (event && options.shouldUploadEvent) { | ||
if (this.shouldEnableBatching()) { | ||
this.queueEventForBatchUpload(event); | ||
} else { | ||
this.sendSingleEventToServer(event); | ||
} | ||
} | ||
@@ -109,2 +116,5 @@ | ||
} | ||
// We need to check event again, because kitblocking | ||
// can nullify the event | ||
if (event) { | ||
@@ -111,0 +121,0 @@ mpInstance._Forwarders.sendEventToForwarders(event); |
@@ -8,3 +8,3 @@ import Types from './types'; | ||
var self = this; | ||
this.logEvent = function(event) { | ||
this.logEvent = function(event, options) { | ||
mpInstance.Logger.verbose( | ||
@@ -15,3 +15,3 @@ Messages.InformationMessages.StartingLogEvent + ': ' + event.name | ||
var uploadObject = mpInstance._ServerModel.createEventObject(event); | ||
mpInstance._APIClient.sendEventToServer(uploadObject); | ||
mpInstance._APIClient.sendEventToServer(uploadObject, options); | ||
} else { | ||
@@ -130,3 +130,4 @@ mpInstance.Logger.verbose( | ||
customFlags, | ||
transactionAttributes | ||
transactionAttributes, | ||
options | ||
) { | ||
@@ -185,3 +186,3 @@ var event = mpInstance._Ecommerce.createCommerceEventObject( | ||
self.logCommerceEvent(event, customAttrs); | ||
self.logCommerceEvent(event, customAttrs, options); | ||
} | ||
@@ -263,3 +264,4 @@ }; | ||
attrs, | ||
customFlags | ||
customFlags, | ||
eventOptions | ||
) { | ||
@@ -282,7 +284,12 @@ var event = mpInstance._Ecommerce.createCommerceEventObject( | ||
self.logCommerceEvent(event, attrs); | ||
self.logCommerceEvent(event, attrs, eventOptions); | ||
} | ||
}; | ||
this.logImpressionEvent = function(impression, attrs, customFlags) { | ||
this.logImpressionEvent = function( | ||
impression, | ||
attrs, | ||
customFlags, | ||
options | ||
) { | ||
var event = mpInstance._Ecommerce.createCommerceEventObject( | ||
@@ -310,7 +317,7 @@ customFlags | ||
self.logCommerceEvent(event, attrs); | ||
self.logCommerceEvent(event, attrs, options); | ||
} | ||
}; | ||
this.logCommerceEvent = function(commerceEvent, attrs) { | ||
this.logCommerceEvent = function(commerceEvent, attrs, options) { | ||
mpInstance.Logger.verbose( | ||
@@ -335,3 +342,3 @@ Messages.InformationMessages.StartingLogCommerceEvent | ||
mpInstance._APIClient.sendEventToServer(commerceEvent); | ||
mpInstance._APIClient.sendEventToServer(commerceEvent, options); | ||
mpInstance._Persistence.update(); | ||
@@ -338,0 +345,0 @@ } else { |
@@ -288,7 +288,8 @@ // | ||
* @param {Object} event Base Event Object | ||
* @param {Object} [eventOptions] For Event-level Configuration Options | ||
*/ | ||
this.logBaseEvent = function(event) { | ||
this.logBaseEvent = function(event, eventOptions) { | ||
if (!self._Store.isInitialized) { | ||
self.ready(function() { | ||
self.logBaseEvent(event); | ||
self.logBaseEvent(event, eventOptions); | ||
}); | ||
@@ -312,3 +313,3 @@ return; | ||
self._Events.logEvent(event); | ||
self._Events.logEvent(event, eventOptions); | ||
}; | ||
@@ -322,7 +323,20 @@ /** | ||
* @param {Object} [customFlags] Additional customFlags | ||
* @param {Object} [eventOptions] For Event-level Configuration Options | ||
*/ | ||
this.logEvent = function(eventName, eventType, eventInfo, customFlags) { | ||
this.logEvent = function( | ||
eventName, | ||
eventType, | ||
eventInfo, | ||
customFlags, | ||
eventOptions | ||
) { | ||
if (!self._Store.isInitialized) { | ||
self.ready(function() { | ||
self.logEvent(eventName, eventType, eventInfo, customFlags); | ||
self.logEvent( | ||
eventName, | ||
eventType, | ||
eventInfo, | ||
customFlags, | ||
eventOptions | ||
); | ||
}); | ||
@@ -356,9 +370,12 @@ return; | ||
self._Events.logEvent({ | ||
messageType: Types.MessageType.PageEvent, | ||
name: eventName, | ||
data: eventInfo, | ||
eventType: eventType, | ||
customFlags: customFlags, | ||
}); | ||
self._Events.logEvent( | ||
{ | ||
messageType: Types.MessageType.PageEvent, | ||
name: eventName, | ||
data: eventInfo, | ||
eventType: eventType, | ||
customFlags: customFlags, | ||
}, | ||
eventOptions | ||
); | ||
}; | ||
@@ -450,7 +467,8 @@ /** | ||
* @param {Object} [customFlags] Custom flags for the event | ||
* @param {Object} [eventOptions] For Event-level Configuration Options | ||
*/ | ||
this.logPageView = function(eventName, attrs, customFlags) { | ||
this.logPageView = function(eventName, attrs, customFlags, eventOptions) { | ||
if (!self._Store.isInitialized) { | ||
self.ready(function() { | ||
self.logPageView(eventName, attrs, customFlags); | ||
self.logPageView(eventName, attrs, customFlags, eventOptions); | ||
}); | ||
@@ -488,9 +506,12 @@ return; | ||
self._Events.logEvent({ | ||
messageType: Types.MessageType.PageView, | ||
name: eventName, | ||
data: attrs, | ||
eventType: Types.EventType.Unknown, | ||
customFlags: customFlags, | ||
}); | ||
self._Events.logEvent( | ||
{ | ||
messageType: Types.MessageType.PageView, | ||
name: eventName, | ||
data: attrs, | ||
eventType: Types.EventType.Unknown, | ||
customFlags: customFlags, | ||
}, | ||
eventOptions | ||
); | ||
}; | ||
@@ -774,2 +795,3 @@ /** | ||
* @param {Object} [transactionAttributes] Transaction Attributes for the event | ||
* @param {Object} [eventOptions] For Event-level Configuration Options | ||
*/ | ||
@@ -781,3 +803,4 @@ logProductAction: function( | ||
customFlags, | ||
transactionAttributes | ||
transactionAttributes, | ||
eventOptions | ||
) { | ||
@@ -791,3 +814,4 @@ if (!self._Store.isInitialized) { | ||
customFlags, | ||
transactionAttributes | ||
transactionAttributes, | ||
eventOptions | ||
); | ||
@@ -803,3 +827,4 @@ }); | ||
customFlags, | ||
transactionAttributes | ||
transactionAttributes, | ||
eventOptions | ||
); | ||
@@ -860,4 +885,11 @@ }, | ||
* @param {Object} [customFlags] Custom flags for the event | ||
* @param {Object} [eventOptions] For Event-level Configuration Options | ||
*/ | ||
logPromotion: function(type, promotion, attrs, customFlags) { | ||
logPromotion: function( | ||
type, | ||
promotion, | ||
attrs, | ||
customFlags, | ||
eventOptions | ||
) { | ||
if (!self._Store.isInitialized) { | ||
@@ -869,3 +901,4 @@ self.ready(function() { | ||
attrs, | ||
customFlags | ||
customFlags, | ||
eventOptions | ||
); | ||
@@ -876,3 +909,9 @@ }); | ||
self._SessionManager.resetSessionTimer(); | ||
self._Events.logPromotionEvent(type, promotion, attrs, customFlags); | ||
self._Events.logPromotionEvent( | ||
type, | ||
promotion, | ||
attrs, | ||
customFlags, | ||
eventOptions | ||
); | ||
}, | ||
@@ -886,4 +925,5 @@ /** | ||
* @param {Object} [customFlags] Custom flags for the event | ||
* @param {Object} [eventOptions] For Event-level Configuration Options | ||
*/ | ||
logImpression: function(impression, attrs, customFlags) { | ||
logImpression: function(impression, attrs, customFlags, eventOptions) { | ||
if (!self._Store.isInitialized) { | ||
@@ -894,3 +934,4 @@ self.ready(function() { | ||
attrs, | ||
customFlags | ||
customFlags, | ||
eventOptions | ||
); | ||
@@ -901,3 +942,8 @@ }); | ||
self._SessionManager.resetSessionTimer(); | ||
self._Events.logImpressionEvent(impression, attrs, customFlags); | ||
self._Events.logImpressionEvent( | ||
impression, | ||
attrs, | ||
customFlags, | ||
eventOptions | ||
); | ||
}, | ||
@@ -904,0 +950,0 @@ /** |
@@ -140,6 +140,12 @@ import Polyfill from './polyfill'; | ||
}; | ||
this.logBaseEvent = function(event) { | ||
self.getInstance().logBaseEvent(event); | ||
this.logBaseEvent = function(event, eventOptions) { | ||
self.getInstance().logBaseEvent(event, eventOptions); | ||
}; | ||
this.logEvent = function(eventName, eventType, eventInfo, customFlags) { | ||
this.logEvent = function( | ||
eventName, | ||
eventType, | ||
eventInfo, | ||
customFlags, | ||
eventOptions | ||
) { | ||
self.getInstance().logEvent( | ||
@@ -149,3 +155,4 @@ eventName, | ||
eventInfo, | ||
customFlags | ||
customFlags, | ||
eventOptions | ||
); | ||
@@ -162,4 +169,9 @@ }; | ||
}; | ||
this.logPageView = function(eventName, attrs, customFlags) { | ||
self.getInstance().logPageView(eventName, attrs, customFlags); | ||
this.logPageView = function(eventName, attrs, customFlags, eventOptions) { | ||
self.getInstance().logPageView( | ||
eventName, | ||
attrs, | ||
customFlags, | ||
eventOptions | ||
); | ||
}; | ||
@@ -254,3 +266,4 @@ this.upload = function() { | ||
customFlags, | ||
transactionAttributes | ||
transactionAttributes, | ||
eventOptions | ||
) { | ||
@@ -262,3 +275,4 @@ self.getInstance().eCommerce.logProductAction( | ||
customFlags, | ||
transactionAttributes | ||
transactionAttributes, | ||
eventOptions | ||
); | ||
@@ -281,3 +295,9 @@ }, | ||
}, | ||
logPromotion: function(type, promotion, attrs, customFlags) { | ||
logPromotion: function( | ||
type, | ||
promotion, | ||
attrs, | ||
customFlags, | ||
eventOptions | ||
) { | ||
self.getInstance().eCommerce.logPromotion( | ||
@@ -287,10 +307,12 @@ type, | ||
attrs, | ||
customFlags | ||
customFlags, | ||
eventOptions | ||
); | ||
}, | ||
logImpression: function(impression, attrs, customFlags) { | ||
logImpression: function(impression, attrs, customFlags, eventOptions) { | ||
self.getInstance().eCommerce.logImpression( | ||
impression, | ||
attrs, | ||
customFlags | ||
customFlags, | ||
eventOptions | ||
); | ||
@@ -297,0 +319,0 @@ }, |
@@ -162,2 +162,3 @@ import Types from './types'; | ||
var eventObject = {}; | ||
var optOut = | ||
@@ -164,0 +165,0 @@ event.messageType === Types.MessageType.OptOut |
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
1544246
27831
0