diff --git a/src/constants.ts b/src/constants.ts index 43a697a27..11880ca94 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -236,10 +236,9 @@ export const HTTP_SERVER_ERROR = 500 as const; export type PrivacyControl = 'functional' | 'targeting'; -export type StorageTypes = 'SDKState' | 'OfflineEvents' | 'IdentityCache' | 'TimeOnSite'; +export type StorageTypes = 'OfflineEvents' | 'IdentityCache' | 'TimeOnSite'; export const StoragePrivacyMap: Record = { - SDKState: 'functional', OfflineEvents: 'functional', IdentityCache: 'functional', TimeOnSite: 'targeting', diff --git a/src/persistence.js b/src/persistence.js index fb0aec710..dca7bd16d 100644 --- a/src/persistence.js +++ b/src/persistence.js @@ -25,7 +25,6 @@ export default function _Persistence(mpInstance) { localStorageData = self.getLocalStorage(), cookies = self.getCookie(), allData; - // https://go.mparticle.com/work/SQDSDKS-6045 // Determine if there is any data in cookies or localStorage to figure out if it is the first time the browser is loading mParticle if (!localStorageData && !cookies) { @@ -35,10 +34,6 @@ export default function _Persistence(mpInstance) { mpInstance._Store.isFirstRun = false; } - if (mpInstance._Store.getPrivacyFlag('SDKState')) { - return; - } - // https://go.mparticle.com/work/SQDSDKS-6045 if (!mpInstance._Store.isLocalStorageAvailable) { mpInstance._Store.SDKConfig.useCookieStorage = true; @@ -117,10 +112,7 @@ export default function _Persistence(mpInstance) { }; this.update = function() { - if ( - !mpInstance._Store.webviewBridgeEnabled && - !mpInstance._Store.getPrivacyFlag('SDKState') - ) { + if (!mpInstance._Store.webviewBridgeEnabled) { if (mpInstance._Store.SDKConfig.useCookieStorage) { self.setCookie(); } @@ -810,9 +802,6 @@ export default function _Persistence(mpInstance) { // https://go.mparticle.com/work/SQDSDKS-6021 this.savePersistence = function(persistence) { - if (mpInstance._Store.getPrivacyFlag('SDKState')) { - return; - } var encodedPersistence = self.encodePersistence( JSON.stringify(persistence) ), @@ -857,9 +846,6 @@ export default function _Persistence(mpInstance) { }; this.getPersistence = function() { - if (mpInstance._Store.getPrivacyFlag('SDKState')) { - return null; - } var persistence = this.useLocalStorage() ? this.getLocalStorage() : this.getCookie(); diff --git a/test/jest/persistence.spec.ts b/test/jest/persistence.spec.ts index c1f7e8610..76a270beb 100644 --- a/test/jest/persistence.spec.ts +++ b/test/jest/persistence.spec.ts @@ -39,36 +39,12 @@ describe('Persistence', () => { }); describe('#update', () => { - describe('noFunctional privacy flag set to true', () => { - beforeEach(() => { - store.setNoFunctional(true); - store.webviewBridgeEnabled = false; - }); - - it('should NOT write to cookie and localStorage when useCookieStorage is true', () => { - store.SDKConfig.useCookieStorage = true; - - const setCookieSpy = jest.spyOn(persistence, 'setCookie'); - const setLocalStorageSpy = jest.spyOn(persistence, 'setLocalStorage'); - - persistence.update(); - - expect(setCookieSpy).not.toHaveBeenCalled(); - expect(setLocalStorageSpy).not.toHaveBeenCalled(); - }); - - it('should NOT write to localStorage when useCookieStorage is false', () => { - store.SDKConfig.useCookieStorage = false; - - const setCookieSpy = jest.spyOn(persistence, 'setCookie'); - const setLocalStorageSpy = jest.spyOn(persistence, 'setLocalStorage'); - - persistence.update(); - - expect(setCookieSpy).not.toHaveBeenCalled(); - expect(setLocalStorageSpy).not.toHaveBeenCalled(); - }); - }); + // describe('noFunctional privacy flag set to true', () => { + // beforeEach(() => { + // store.setNoFunctional(true); + // store.webviewBridgeEnabled = false; + // }); + // }); describe('noFunctional privacy flag set to false', () => { beforeEach(() => { diff --git a/test/src/tests-persistence.ts b/test/src/tests-persistence.ts index 045ff7f71..72bd265f0 100644 --- a/test/src/tests-persistence.ts +++ b/test/src/tests-persistence.ts @@ -1882,28 +1882,6 @@ describe('persistence', () => { beforeEach(() => { mParticle.config.launcherOptions = { noFunctional: true }; }); - - it('should NOT store cookie when useCookieStorage = true', async () => { - mParticle.config.useCookieStorage = true; - - mParticle.init(apiKey, mParticle.config); - await waitForCondition(hasIdentifyReturned); - - mParticle.getInstance()._Persistence.update(); - - expect(findCookie()).to.not.be.ok; - }); - - it('should NOT write localStorage when useCookieStorage = false', async () => { - mParticle.config.useCookieStorage = false; - - mParticle.init(apiKey, mParticle.config); - await waitForCondition(hasIdentifyReturned); - - mParticle.getInstance()._Persistence.update(); - - expect(getLocalStorage()).to.not.be.ok; - }); }); describe('set to false', () => {