Skip to content

Commit

Permalink
fix(analytics): remove analytics API consent dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
ruifcnunes authored and talbertosilva committed Sep 13, 2023
1 parent 7f6b637 commit 91b030e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,18 @@ import {
import { isArray, omit } from 'lodash-es';

export default class AnalyticsAPI extends integrations.Integration<AnalyticsApiIntegrationOptions> {
static override [utils.CONSENT_CATEGORIES_PROPERTY] =
utils.DefaultConsentKeys.Marketing;
private debugMode: boolean | undefined;
private whitelisted: Array<string> | undefined;

/**
* Method to check if the integration is ready to be loaded.
*
* @returns If the integration is ready to be loaded.
*/
static override shouldLoad() {
return true;
}

/**
* Creates an instance of Analytics Api integration.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@ describe('AnalyticsApi Integration', () => {
expect(AnalyticsApi.prototype).toBeInstanceOf(integrations.Integration);
});

it('`shouldLoad` should return false if there is no user consent', () => {
expect(AnalyticsApi.shouldLoad({ marketing: false }, {})).toBe(false);
expect(AnalyticsApi.shouldLoad({}, {})).toBe(false);
});

it('`shouldLoad` should return true if there is user consent', () => {
it('`shouldLoad` should return always true', () => {
expect(AnalyticsApi.shouldLoad()).toBe(true);
// @ts-expect-error
expect(AnalyticsApi.shouldLoad({}, {})).toBe(true);
// @ts-expect-error
expect(AnalyticsApi.shouldLoad({ marketing: true }, {})).toBe(true);
// @ts-expect-error
expect(AnalyticsApi.shouldLoad({ marketing: false }, {})).toBe(true);
});

describe('AnalyticsApi Instance', () => {
Expand Down

0 comments on commit 91b030e

Please sign in to comment.