@mparticle/web-sdk
Advanced tools
Comparing version 2.12.1 to 2.12.2
@@ -5,2 +5,7 @@ ## Releases | ||
#### 2.12.2 - 2020-11-12 | ||
- Bugfix - Fix data plan options API | ||
- Bugfix - Add try/catch to cookie searching | ||
#### 2.12.1 - 2020-11-11 | ||
@@ -7,0 +12,0 @@ |
{ | ||
"name": "@mparticle/web-sdk", | ||
"version": "2.12.1", | ||
"version": "2.12.2", | ||
"description": "mParticle core SDK for web applications", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
var Constants = { | ||
sdkVersion: '2.12.1', | ||
sdkVersion: '2.12.2', | ||
sdkVendor: 'mparticle', | ||
@@ -4,0 +4,0 @@ platform: 'web', |
import { convertEvent } from './sdkToEventsApiConverter'; | ||
import { SDKEvent, MParticleWebSDK } from './sdkRuntimeModels'; | ||
import { SDKEvent, MParticleWebSDK, KitBlockerDataPlan } from './sdkRuntimeModels'; | ||
import { BaseEvent, EventTypeEnum, CommerceEvent, ScreenViewEvent, CustomEvent } from '@mparticle/event-models'; | ||
@@ -46,3 +46,3 @@ import Types from './types' | ||
constructor(dataPlan: any, mpInstance: MParticleWebSDK) { | ||
constructor(dataPlan: KitBlockerDataPlan, mpInstance: MParticleWebSDK) { | ||
// if data plan is not requested, the data plan is {document: null} | ||
@@ -49,0 +49,0 @@ if (dataPlan && !dataPlan.document) { |
@@ -53,5 +53,11 @@ import Constants from './constants'; | ||
for (i = 0, l = cookies.length; i < l; i++) { | ||
parts = cookies[i].split('='); | ||
name = mpInstance._Helpers.decoded(parts.shift()); | ||
cookie = mpInstance._Helpers.decoded(parts.join('=')); | ||
try { | ||
parts = cookies[i].split('='); | ||
name = mpInstance._Helpers.decoded(parts.shift()); | ||
cookie = mpInstance._Helpers.decoded(parts.join('=')); | ||
} catch (e) { | ||
mpInstance.Logger.verbose( | ||
'Unable to parse cookie: ' + name + '. Skipping.' | ||
); | ||
} | ||
@@ -58,0 +64,0 @@ //most recent version needs no migration |
@@ -458,5 +458,11 @@ import Constants from './constants'; | ||
for (i = 0, l = cookies.length; i < l; i++) { | ||
parts = cookies[i].split('='); | ||
name = mpInstance._Helpers.decoded(parts.shift()); | ||
cookie = mpInstance._Helpers.decoded(parts.join('=')); | ||
try { | ||
parts = cookies[i].split('='); | ||
name = mpInstance._Helpers.decoded(parts.shift()); | ||
cookie = mpInstance._Helpers.decoded(parts.join('=')); | ||
} catch (e) { | ||
mpInstance.Logger.verbose( | ||
'Unable to parse cookie: ' + name + '. Skipping.' | ||
); | ||
} | ||
@@ -463,0 +469,0 @@ if (key && key === name) { |
import * as EventsApi from '@mparticle/event-models'; | ||
import { DataPlanVersion } from '@mparticle/data-planning-models'; | ||
import { DataPlanVersion, DataPlan } from '@mparticle/data-planning-models'; | ||
@@ -157,3 +157,4 @@ export interface SDKEvent { | ||
requestConfig: boolean; | ||
dataPlanOptions: KitBlockerOptions | ||
dataPlanOptions: KitBlockerOptions // when the user provides their own data plan | ||
dataPlanResult?: DataPlanResult // when the data plan comes from the server via /config | ||
} | ||
@@ -164,3 +165,3 @@ | ||
planVersion?: number; | ||
document?: any | ||
document?: DataPlanResult // when the data plan comes from the server via /mparticle.js | ||
} | ||
@@ -255,3 +256,3 @@ | ||
export interface KitBlockerOptions { | ||
dataPlanVersion: any; | ||
dataPlanVersion: DataPlanVersion; | ||
blockUserAttributes: boolean; | ||
@@ -263,2 +264,18 @@ blockEventAttributes: boolean; | ||
export interface KitBlockerDataPlan { | ||
document: DataPlanResult | ||
} | ||
export interface DataPlanResult { | ||
dtpn?: { | ||
vers: DataPlanVersion; | ||
blok: { | ||
ev: boolean; | ||
ea: boolean; | ||
ua: boolean; | ||
id: boolean; | ||
}; | ||
}; | ||
error_message?: string | ||
} | ||
export enum SDKIdentityTypeEnum { | ||
@@ -287,2 +304,2 @@ other = "other", | ||
phoneNumber3 = "phone_number_3" | ||
} | ||
} |
@@ -250,11 +250,12 @@ import Constants from './constants'; | ||
if (config.hasOwnProperty('dataPlanOptions')) { | ||
const dataPlanOptions = config.dataPlanOptions; | ||
if ( | ||
!config.dataPlanOptions.hasOwnProperty('dataPlanVersion') || | ||
!config.dataPlanOptions.hasOwnProperty('blockUserAttributes') || | ||
!config.dataPlanOptions.hasOwnProperty('blockEventAttribute') || | ||
!config.dataPlanOptions.hasOwnProperty('blockEvents') || | ||
!config.dataPlanOptions.hasOwnProperty('blockIdentities') | ||
!dataPlanOptions.hasOwnProperty('dataPlanVersion') || | ||
!dataPlanOptions.hasOwnProperty('blockUserAttributes') || | ||
!dataPlanOptions.hasOwnProperty('blockEventAttributes') || | ||
!dataPlanOptions.hasOwnProperty('blockEvents') || | ||
!dataPlanOptions.hasOwnProperty('blockUserIdentities') | ||
) { | ||
mpInstance.Logger.error( | ||
'Ensure your config.dataPlanOptions object has the following keys: a "dataPlanVersion" object, and "blockUserAttributes", "blockEventAttribute", "blockEvents", "blockIdentities" booleans' | ||
'Ensure your config.dataPlanOptions object has the following keys: a "dataPlanVersion" object, and "blockUserAttributes", "blockEventAttributes", "blockEvents", "blockUserIdentities" booleans' | ||
); | ||
@@ -261,0 +262,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
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
1514154
27441