From 6edde161e1ddad8ee016a9162b3891dd892cf524 Mon Sep 17 00:00:00 2001 From: Robert Ing Date: Fri, 3 Apr 2026 09:46:20 -0400 Subject: [PATCH 1/3] breaking: remove deprecated removeCCPAState method Remove the deprecated `removeCCPAState` method and associated code/tests. Users should use `removeCCPAConsentState` instead. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/consent.ts | 16 +--------------- test/src/tests-consent.ts | 35 ----------------------------------- 2 files changed, 1 insertion(+), 50 deletions(-) diff --git a/src/consent.ts b/src/consent.ts index 81ae944cd..19745bc89 100644 --- a/src/consent.ts +++ b/src/consent.ts @@ -97,10 +97,7 @@ export interface IConsentRules { values: IConsentRulesValues[]; } -// TODO: Remove this if we can safely deprecate `removeCCPAState` -export interface IConsentState extends ConsentState { - removeCCPAState: () => ConsentState; -} +export interface IConsentState extends ConsentState {} // Represents Actual Interface for Consent Module // TODO: Should eventually consolidate with SDKConsentStateApi @@ -338,7 +335,6 @@ export default function Consent(this: IConsent, mpInstance: IMParticleWebSDKInst consentState.getCCPAConsentState() ); - // TODO: Remove casting once `removeCCPAState` is removed; return consentStateCopy as IConsentState; } @@ -503,15 +499,6 @@ export default function Consent(this: IConsent, mpInstance: IMParticleWebSDKInst return this; } - // TODO: Can we remove this? It is deprecated. - function removeCCPAState(this: ConsentState) { - mpInstance.Logger.warning( - 'removeCCPAState is deprecated and will be removed in a future release; use removeCCPAConsentState instead' - ); - // @ts-ignore - return removeCCPAConsentState(); - } - return { setGDPRConsentState, addGDPRConsentState, @@ -519,7 +506,6 @@ export default function Consent(this: IConsent, mpInstance: IMParticleWebSDKInst getCCPAConsentState, getGDPRConsentState, removeGDPRConsentState, - removeCCPAState, // TODO: Can we remove? This is deprecated removeCCPAConsentState, }; }; diff --git a/test/src/tests-consent.ts b/test/src/tests-consent.ts index ad76e2ebe..c0e7d0bc9 100644 --- a/test/src/tests-consent.ts +++ b/test/src/tests-consent.ts @@ -660,39 +660,4 @@ describe('Consent', function() { testEvent.consent_state.gdpr['test purpose'].should.have.property('hardware_id', 'hardware'); }); - // TODO: Deprecate in next major version - it('Should log deprecated message when using removeCCPAState', () => { - const bond = sinon.spy(mParticle.getInstance().Logger, 'warning'); - const consentState = mParticle - .getInstance() - .Consent.createConsentState(); - expect(consentState).to.be.ok; - - consentState.setCCPAConsentState( - mParticle.Consent.createCCPAConsent(false) - ); - - expect(consentState.getCCPAConsentState()).to.have.property( - 'Consented' - ); - expect(consentState.getCCPAConsentState()).to.have.property( - 'ConsentDocument' - ); - expect(consentState.getCCPAConsentState()).to.have.property( - 'HardwareId' - ); - expect(consentState.getCCPAConsentState()).to.have.property('Location'); - expect(consentState.getCCPAConsentState()).to.have.property( - 'Timestamp' - ); - - // FIXME: Remove when deprecating removeCCPAState - ((consentState as unknown) as any).removeCCPAState(); - (consentState.getCCPAConsentState() === undefined).should.equal(true); - - bond.called.should.eql(true); - bond.getCalls()[0].args[0].should.eql( - 'removeCCPAState is deprecated and will be removed in a future release; use removeCCPAConsentState instead' - ); - }); }); \ No newline at end of file From ff2674392d23e56fc16745b924bb3fc3aa891788 Mon Sep 17 00:00:00 2001 From: Robert Ing Date: Fri, 3 Apr 2026 14:18:56 -0400 Subject: [PATCH 2/3] refactor: remove redundant IConsentState interface IConsentState was an empty extension of ConsentState that added no properties. Replace usages with ConsentState directly. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/consent.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/consent.ts b/src/consent.ts index 19745bc89..41c3db028 100644 --- a/src/consent.ts +++ b/src/consent.ts @@ -97,8 +97,6 @@ export interface IConsentRules { values: IConsentRulesValues[]; } -export interface IConsentState extends ConsentState {} - // Represents Actual Interface for Consent Module // TODO: Should eventually consolidate with SDKConsentStateApi export interface IConsent { @@ -322,7 +320,7 @@ export default function Consent(this: IConsent, mpInstance: IMParticleWebSDKInst this.createConsentState = function( this: ConsentState, consentState?: ConsentState - ): IConsentState { + ): ConsentState { let gdpr = {}; let ccpa = {}; @@ -335,7 +333,7 @@ export default function Consent(this: IConsent, mpInstance: IMParticleWebSDKInst consentState.getCCPAConsentState() ); - return consentStateCopy as IConsentState; + return consentStateCopy as ConsentState; } function canonicalizeForDeduplication(purpose: string): string { From 8f70c582d0225300dec34fdd9e621df34b5030cf Mon Sep 17 00:00:00 2001 From: Robert Ing Date: Fri, 3 Apr 2026 15:21:17 -0400 Subject: [PATCH 3/3] refactor: remove unnecessary cast in createConsentState The TODO indicated this cast should be removed once removeCCPAState was removed. Since removeCCPAState is being removed in this PR, the cast is no longer needed. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/consent.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/consent.ts b/src/consent.ts index 41c3db028..1a0059ee6 100644 --- a/src/consent.ts +++ b/src/consent.ts @@ -333,7 +333,7 @@ export default function Consent(this: IConsent, mpInstance: IMParticleWebSDKInst consentState.getCCPAConsentState() ); - return consentStateCopy as ConsentState; + return consentStateCopy; } function canonicalizeForDeduplication(purpose: string): string {