Skip to content

Commit

Permalink
fix logic
Browse files Browse the repository at this point in the history
  • Loading branch information
zikaari committed Dec 7, 2023
1 parent e6bc91a commit 8740748
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/core/src/plugins/ConsentPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,14 @@ export class ConsentPlugin extends Plugin {
if (this.isDestinationPlugin(plugin)) {
plugin.add(
new ConsentFilterPlugin((event) => {
const allCategories =
this.analytics?.consentSettings.get()?.allCategories || [];
const settings = this.analytics?.settings.get() || {};
const preferences = event.context?.consent?.categoryPreferences || {};

if (plugin.key === SEGMENT_DESTINATION_KEY) {
const noneConsented = Object.values(preferences).every(
(consented) => !consented
const noneConsented = allCategories.every(
(category) => !preferences[category]
);

return (
Expand Down

0 comments on commit 8740748

Please sign in to comment.