Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(analytics): remove analytics API consent dependency #864

Merged
merged 1 commit into from
Sep 13, 2023
Merged
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
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