@@ -203,7 +203,7 @@ var mParticle = (function () {
203203 Base64: Base64$1
204204 };
205205
206- var version = "2.46 .0";
206+ var version = "2.47 .0";
207207
208208 var Constants = {
209209 sdkVersion: version,
@@ -409,6 +409,13 @@ var mParticle = (function () {
409409 var HTTP_OK = 200;
410410 var HTTP_ACCEPTED = 202;
411411 var HTTP_BAD_REQUEST = 400;
412+ var StoragePrivacyMap = {
413+ SDKState: 'functional',
414+ Products: 'targeting',
415+ OfflineEvents: 'functional',
416+ IdentityCache: 'functional',
417+ TimeOnSite: 'targeting'
418+ };
412419
413420 /******************************************************************************
414421 Copyright (c) Microsoft Corporation.
@@ -2179,6 +2186,22 @@ var mParticle = (function () {
21792186 }
21802187 return SessionStorageVault;
21812188 }(BaseVault);
2189+ // DisabledVault is used when persistence is disabled by privacy flags.
2190+ var DisabledVault = /** @class */function (_super) {
2191+ __extends(DisabledVault, _super);
2192+ function DisabledVault(storageKey, options) {
2193+ var _this = _super.call(this, storageKey, window.localStorage, options) || this;
2194+ _this.contents = null;
2195+ return _this;
2196+ }
2197+ DisabledVault.prototype.store = function (_item) {
2198+ this.contents = null;
2199+ };
2200+ DisabledVault.prototype.retrieve = function () {
2201+ return this.contents;
2202+ };
2203+ return DisabledVault;
2204+ }(BaseVault);
21822205
21832206 var AsyncUploader = /** @class */function () {
21842207 function AsyncUploader(url) {
@@ -2358,7 +2381,7 @@ var mParticle = (function () {
23582381 this.batchesQueuedForProcessing = [];
23592382 // Cache Offline Storage Availability boolean
23602383 // so that we don't have to check it every time
2361- this.offlineStorageEnabled = this.isOfflineStorageAvailable();
2384+ this.offlineStorageEnabled = this.isOfflineStorageAvailable() && !mpInstance._Store.getPrivacyFlag('OfflineEvents') ;
23622385 if (this.offlineStorageEnabled) {
23632386 this.eventVault = new SessionStorageVault("".concat(mpInstance._Store.storageName, "-events"), {
23642387 logger: mpInstance.Logger
@@ -4626,6 +4649,16 @@ var mParticle = (function () {
46264649 this.setNoTargeting = function (noTargeting) {
46274650 _this.noTargeting = noTargeting;
46284651 };
4652+ this.getPrivacyFlag = function (storageType) {
4653+ var privacyControl = StoragePrivacyMap[storageType];
4654+ if (privacyControl === 'functional') {
4655+ return _this.getNoFunctional();
4656+ }
4657+ if (privacyControl === 'targeting') {
4658+ return _this.getNoTargeting();
4659+ }
4660+ return false;
4661+ };
46294662 this.getDeviceId = function () {
46304663 return _this.deviceId;
46314664 };
@@ -4706,6 +4739,7 @@ var mParticle = (function () {
47064739 mpInstance._Persistence.update();
47074740 };
47084741 this.processConfig = function (config) {
4742+ var _a;
47094743 var workspaceToken = config.workspaceToken,
47104744 requiredWebviewBridgeName = config.requiredWebviewBridgeName;
47114745 // We should reprocess the flags and baseUrls in case they have changed when we request an updated config
@@ -4716,22 +4750,26 @@ var mParticle = (function () {
47164750 for (var baseUrlKeys in baseUrls) {
47174751 _this.SDKConfig[baseUrlKeys] = baseUrls[baseUrlKeys];
47184752 }
4753+ var _b = (_a = config === null || config === void 0 ? void 0 : config.launcherOptions) !== null && _a !== void 0 ? _a : {},
4754+ noFunctional = _b.noFunctional,
4755+ noTargeting = _b.noTargeting;
4756+ if (noFunctional != null) {
4757+ _this.setNoFunctional(noFunctional);
4758+ }
4759+ if (noTargeting != null) {
4760+ _this.setNoTargeting(noTargeting);
4761+ }
47194762 if (workspaceToken) {
47204763 _this.SDKConfig.workspaceToken = workspaceToken;
4721- mpInstance._timeOnSiteTimer = new ForegroundTimeTracker(workspaceToken);
4764+ if (!_this.getPrivacyFlag('TimeOnSite')) {
4765+ mpInstance._timeOnSiteTimer = new ForegroundTimeTracker(workspaceToken);
4766+ }
47224767 } else {
47234768 mpInstance.Logger.warning('You should have a workspaceToken on your config object for security purposes.');
47244769 }
47254770 // add a new function to apply items to the store that require config to be returned
47264771 _this.storageName = createMainStorageName(workspaceToken);
47274772 _this.prodStorageName = createProductStorageName(workspaceToken);
4728- // Extract privacy flags directly from config into Store
4729- if (config.hasOwnProperty('noFunctional')) {
4730- _this.setNoFunctional(config.noFunctional);
4731- }
4732- if (config.hasOwnProperty('noTargeting')) {
4733- _this.setNoTargeting(config.noTargeting);
4734- }
47354773 _this.SDKConfig.requiredWebviewBridgeName = requiredWebviewBridgeName || workspaceToken;
47364774 _this.webviewBridgeEnabled = isWebviewEnabled(_this.SDKConfig.requiredWebviewBridgeName, _this.SDKConfig.minWebviewBridgeVersion);
47374775 _this.configurationLoaded = true;
@@ -4911,6 +4949,9 @@ var mParticle = (function () {
49114949 } else {
49124950 mpInstance._Store.isFirstRun = false;
49134951 }
4952+ if (mpInstance._Store.getPrivacyFlag('SDKState')) {
4953+ return;
4954+ }
49144955
49154956 // https://go.mparticle.com/work/SQDSDKS-6045
49164957 if (!mpInstance._Store.isLocalStorageAvailable) {
@@ -4996,7 +5037,7 @@ var mParticle = (function () {
49965037 }
49975038 };
49985039 this.update = function () {
4999- if (!mpInstance._Store.webviewBridgeEnabled) {
5040+ if (!mpInstance._Store.webviewBridgeEnabled && !mpInstance._Store.getPrivacyFlag('SDKState') ) {
50005041 if (mpInstance._Store.SDKConfig.useCookieStorage) {
50015042 self.setCookie();
50025043 }
@@ -5567,6 +5608,9 @@ var mParticle = (function () {
55675608
55685609 // https://go.mparticle.com/work/SQDSDKS-6021
55695610 this.savePersistence = function (persistence) {
5611+ if (mpInstance._Store.getPrivacyFlag('SDKState')) {
5612+ return;
5613+ }
55705614 var encodedPersistence = self.encodePersistence(JSON.stringify(persistence)),
55715615 date = new Date(),
55725616 key = mpInstance._Store.storageName,
@@ -5588,6 +5632,9 @@ var mParticle = (function () {
55885632 }
55895633 };
55905634 this.getPersistence = function () {
5635+ if (mpInstance._Store.getPrivacyFlag('SDKState')) {
5636+ return null;
5637+ }
55915638 var persistence = this.useLocalStorage() ? this.getLocalStorage() : this.getCookie();
55925639 return persistence;
55935640 };
@@ -10040,20 +10087,22 @@ var mParticle = (function () {
1004010087 (_a = this.logger) === null || _a === void 0 ? void 0 : _a.verbose("RoktManager: Processing ".concat(this.messageQueue.size, " queued messages"));
1004110088 this.messageQueue.forEach(function (message) {
1004210089 var _a, _b, _c;
10043- if (!(message.methodName in _this.kit ) || !isFunction(_this.kit [message.methodName])) {
10044- (_a = _this.logger) === null || _a === void 0 ? void 0 : _a.error("RoktManager: Method ".concat(message.methodName, " not found in kit "));
10090+ if (!(message.methodName in _this) || !isFunction(_this[message.methodName])) {
10091+ (_a = _this.logger) === null || _a === void 0 ? void 0 : _a.error("RoktManager: Method ".concat(message.methodName, " not found"));
1004510092 return;
1004610093 }
1004710094 (_b = _this.logger) === null || _b === void 0 ? void 0 : _b.verbose("RoktManager: Processing queued message: ".concat(message.methodName, " with payload: ").concat(JSON.stringify(message.payload)));
1004810095 try {
10049- var result = _this.kit [message.methodName](message.payload);
10096+ var result = _this[message.methodName](message.payload);
1005010097 _this.completePendingPromise(message.messageId, result);
1005110098 } catch (error) {
1005210099 var errorMessage = error instanceof Error ? error.message : String(error);
1005310100 (_c = _this.logger) === null || _c === void 0 ? void 0 : _c.error("RoktManager: Error processing message '".concat(message.methodName, "': ").concat(errorMessage));
1005410101 _this.completePendingPromise(message.messageId, Promise.reject(error));
1005510102 }
1005610103 });
10104+ // Clear the queue after processing all messages
10105+ this.messageQueue.clear();
1005710106 };
1005810107 RoktManager.prototype.queueMessage = function (message) {
1005910108 this.messageQueue.set(message.messageId, message);
@@ -11165,7 +11214,13 @@ var mParticle = (function () {
1116511214 return kitBlocker;
1116611215 }
1116711216 function createIdentityCache(mpInstance) {
11168- return new LocalStorageVault("".concat(mpInstance._Store.storageName, "-id-cache"), {
11217+ var cacheKey = "".concat(mpInstance._Store.storageName, "-id-cache");
11218+ if (mpInstance._Store.getPrivacyFlag('IdentityCache')) {
11219+ return new DisabledVault(cacheKey, {
11220+ logger: mpInstance.Logger
11221+ });
11222+ }
11223+ return new LocalStorageVault(cacheKey, {
1116911224 logger: mpInstance.Logger
1117011225 });
1117111226 }
0 commit comments