@mparticle/web-sdk 2.46.0 → 2.47.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mparticle.common.js +71 -79
- package/dist/mparticle.esm.js +71 -79
- package/dist/mparticle.js +98 -247
- package/package.json +1 -1
- package/src/batchUploader.ts +3 -1
- package/src/constants.ts +14 -2
- package/src/helpers.js +0 -10
- package/src/identity-user-interfaces.ts +2 -2
- package/src/identity.interfaces.ts +1 -1
- package/src/identity.js +29 -138
- package/src/mp-instance.ts +25 -30
- package/src/persistence.interfaces.ts +0 -5
- package/src/persistence.js +15 -166
- package/src/roktManager.ts +6 -3
- package/src/sdkRuntimeModels.ts +0 -1
- package/src/sessionManager.ts +1 -1
- package/src/store.ts +26 -15
- package/src/utils.ts +16 -9
- package/src/vault.ts +16 -0
package/src/store.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
UserIdentities,
|
|
9
9
|
} from '@mparticle/web-sdk';
|
|
10
10
|
import { IKitConfigs } from './configAPIClient';
|
|
11
|
-
import Constants from './constants';
|
|
11
|
+
import Constants, { PrivacyControl, StoragePrivacyMap, StorageTypes } from './constants';
|
|
12
12
|
import {
|
|
13
13
|
DataPlanResult,
|
|
14
14
|
KitBlockerOptions,
|
|
@@ -194,7 +194,6 @@ export interface IStore {
|
|
|
194
194
|
requireDelay: boolean;
|
|
195
195
|
isLocalStorageAvailable: boolean | null;
|
|
196
196
|
storageName: string | null;
|
|
197
|
-
prodStorageName: string | null;
|
|
198
197
|
activeForwarders: ConfiguredKit[];
|
|
199
198
|
kits: Dictionary<MPForwarder>;
|
|
200
199
|
sideloadedKits: MPForwarder[];
|
|
@@ -216,6 +215,7 @@ export interface IStore {
|
|
|
216
215
|
setNoFunctional?(noFunctional: boolean): void;
|
|
217
216
|
getNoTargeting?(): boolean;
|
|
218
217
|
setNoTargeting?(noTargeting: boolean): void;
|
|
218
|
+
getPrivacyFlag?(storageType: StorageTypes): boolean;
|
|
219
219
|
|
|
220
220
|
getDeviceId?(): string;
|
|
221
221
|
setDeviceId?(deviceId: string): void;
|
|
@@ -246,7 +246,6 @@ export default function Store(
|
|
|
246
246
|
) {
|
|
247
247
|
const {
|
|
248
248
|
createMainStorageName,
|
|
249
|
-
createProductStorageName,
|
|
250
249
|
} = mpInstance._Helpers;
|
|
251
250
|
|
|
252
251
|
const { isWebviewEnabled } = mpInstance._NativeSdkHelpers;
|
|
@@ -286,7 +285,6 @@ export default function Store(
|
|
|
286
285
|
requireDelay: true,
|
|
287
286
|
isLocalStorageAvailable: null,
|
|
288
287
|
storageName: null,
|
|
289
|
-
prodStorageName: null,
|
|
290
288
|
activeForwarders: [],
|
|
291
289
|
kits: {},
|
|
292
290
|
sideloadedKits: [],
|
|
@@ -608,6 +606,17 @@ export default function Store(
|
|
|
608
606
|
this.noTargeting = noTargeting;
|
|
609
607
|
};
|
|
610
608
|
|
|
609
|
+
this.getPrivacyFlag = (storageType: StorageTypes): boolean => {
|
|
610
|
+
const privacyControl: PrivacyControl = StoragePrivacyMap[storageType];
|
|
611
|
+
if (privacyControl === 'functional') {
|
|
612
|
+
return this.getNoFunctional();
|
|
613
|
+
}
|
|
614
|
+
if (privacyControl === 'targeting') {
|
|
615
|
+
return this.getNoTargeting();
|
|
616
|
+
}
|
|
617
|
+
return false;
|
|
618
|
+
};
|
|
619
|
+
|
|
611
620
|
this.getDeviceId = () => this.deviceId;
|
|
612
621
|
this.setDeviceId = (deviceId: string) => {
|
|
613
622
|
this.deviceId = deviceId;
|
|
@@ -728,9 +737,21 @@ export default function Store(
|
|
|
728
737
|
this.SDKConfig[baseUrlKeys] = baseUrls[baseUrlKeys];
|
|
729
738
|
}
|
|
730
739
|
|
|
740
|
+
const { noFunctional, noTargeting } = config?.launcherOptions ?? {};
|
|
741
|
+
|
|
742
|
+
if (noFunctional != null) {
|
|
743
|
+
this.setNoFunctional(noFunctional);
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
if (noTargeting != null) {
|
|
747
|
+
this.setNoTargeting(noTargeting);
|
|
748
|
+
}
|
|
749
|
+
|
|
731
750
|
if (workspaceToken) {
|
|
732
751
|
this.SDKConfig.workspaceToken = workspaceToken;
|
|
733
|
-
|
|
752
|
+
if (!this.getPrivacyFlag('TimeOnSite')) {
|
|
753
|
+
mpInstance._timeOnSiteTimer = new ForegroundTimer(workspaceToken);
|
|
754
|
+
}
|
|
734
755
|
} else {
|
|
735
756
|
mpInstance.Logger.warning(
|
|
736
757
|
'You should have a workspaceToken on your config object for security purposes.'
|
|
@@ -738,16 +759,6 @@ export default function Store(
|
|
|
738
759
|
}
|
|
739
760
|
// add a new function to apply items to the store that require config to be returned
|
|
740
761
|
this.storageName = createMainStorageName(workspaceToken);
|
|
741
|
-
this.prodStorageName = createProductStorageName(workspaceToken);
|
|
742
|
-
|
|
743
|
-
// Extract privacy flags directly from config into Store
|
|
744
|
-
if (config.hasOwnProperty('noFunctional')) {
|
|
745
|
-
this.setNoFunctional(config.noFunctional);
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
if (config.hasOwnProperty('noTargeting')) {
|
|
749
|
-
this.setNoTargeting(config.noTargeting);
|
|
750
|
-
}
|
|
751
762
|
|
|
752
763
|
this.SDKConfig.requiredWebviewBridgeName =
|
|
753
764
|
requiredWebviewBridgeName || workspaceToken;
|
package/src/utils.ts
CHANGED
|
@@ -57,18 +57,25 @@ const findKeyInObject = (obj: any, key: string): string => {
|
|
|
57
57
|
|
|
58
58
|
const generateDeprecationMessage = (
|
|
59
59
|
methodName: string,
|
|
60
|
-
|
|
60
|
+
isDeprecated?: boolean,
|
|
61
|
+
alternateMethod?: string,
|
|
62
|
+
docsUrl?: string,
|
|
61
63
|
): string => {
|
|
62
|
-
const messageArray: string[] = [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
const messageArray: string[] = [methodName];
|
|
65
|
+
|
|
66
|
+
if (isDeprecated) {
|
|
67
|
+
messageArray.push(Messages.DeprecationMessages.MethodHasBeenDeprecated);
|
|
68
|
+
} else {
|
|
69
|
+
messageArray.push(Messages.DeprecationMessages.MethodMarkedForDeprecationPostfix);
|
|
70
|
+
}
|
|
66
71
|
|
|
67
72
|
if (alternateMethod) {
|
|
68
|
-
messageArray.push(
|
|
69
|
-
messageArray.push(
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
messageArray.push(Messages.DeprecationMessages.AlternativeMethodPrefix);
|
|
74
|
+
messageArray.push(alternateMethod + ".");
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (docsUrl) {
|
|
78
|
+
messageArray.push("See - " + docsUrl);
|
|
72
79
|
}
|
|
73
80
|
|
|
74
81
|
return messageArray.join(' ');
|
package/src/vault.ts
CHANGED
|
@@ -102,4 +102,20 @@ export class SessionStorageVault<StorableItem> extends BaseVault<StorableItem> {
|
|
|
102
102
|
constructor(storageKey: string, options?: IVaultOptions) {
|
|
103
103
|
super(storageKey, window.sessionStorage, options);
|
|
104
104
|
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// DisabledVault is used when persistence is disabled by privacy flags.
|
|
108
|
+
export class DisabledVault<StorableItem> extends BaseVault<StorableItem> {
|
|
109
|
+
constructor(storageKey: string, options?: IVaultOptions) {
|
|
110
|
+
super(storageKey, window.localStorage, options);
|
|
111
|
+
this.contents = null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
public store(_item: StorableItem): void {
|
|
115
|
+
this.contents = null;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
public retrieve(): StorableItem | null {
|
|
119
|
+
return this.contents;
|
|
120
|
+
}
|
|
105
121
|
}
|