Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions src/consent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,6 @@ export interface IConsentRules {
values: IConsentRulesValues[];
}

// TODO: Remove this if we can safely deprecate `removeCCPAState`
export interface IConsentState extends ConsentState {
removeCCPAState: () => ConsentState;
}

// Represents Actual Interface for Consent Module
// TODO: Should eventually consolidate with SDKConsentStateApi
export interface IConsent {
Expand Down Expand Up @@ -325,7 +320,7 @@ export default function Consent(this: IConsent, mpInstance: IMParticleWebSDKInst
this.createConsentState = function(
this: ConsentState,
consentState?: ConsentState
): IConsentState {
): ConsentState {
let gdpr = {};
let ccpa = {};

Expand All @@ -338,8 +333,7 @@ export default function Consent(this: IConsent, mpInstance: IMParticleWebSDKInst
consentState.getCCPAConsentState()
);

// TODO: Remove casting once `removeCCPAState` is removed;
return consentStateCopy as IConsentState;
return consentStateCopy;
}

function canonicalizeForDeduplication(purpose: string): string {
Expand Down Expand Up @@ -503,23 +497,13 @@ 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,
setCCPAConsentState,
getCCPAConsentState,
getGDPRConsentState,
removeGDPRConsentState,
removeCCPAState, // TODO: Can we remove? This is deprecated
removeCCPAConsentState,
};
};
Expand Down
35 changes: 0 additions & 35 deletions test/src/tests-consent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
});
});
Loading