Skip to content

Commit

Permalink
OneTrust_CookieConesnt_Changes: Addressed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchiramoitra committed Dec 22, 2021
1 parent 187b976 commit 02cf227
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 25 deletions.
20 changes: 7 additions & 13 deletions analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,19 +195,13 @@ class Analytics {

// If cookie consent object is return we filter according to consents given by user
// else we do not consider any filtering for cookie consent.
if (this.cookieConsent) {
this.clientIntegrations = this.clientIntegrations.filter((intg) => {
return (
// remove from the list which don't have support yet in SDK
integrations[intg.name] != undefined &&
this.cookieConsent.isEnabled(intg.config)
);
});
} else {
this.clientIntegrations = this.clientIntegrations.filter((intg) => {
return integrations[intg.name] != undefined;
});
}
this.clientIntegrations = this.clientIntegrations.filter((intg) => {
return (
integrations[intg.name] != undefined &&
(!this.cookieConsent ||
(this.cookieConsent && this.cookieConsent.isEnabled(intg.config)))
);
});
this.init(this.clientIntegrations);
} catch (error) {
handleError(error);
Expand Down
14 changes: 3 additions & 11 deletions cookieConsent/CookieConsentFactory.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import * as OneTrust from "./OneTrust";
import { OneTrust } from "./OneTrust";

const cookieConsent = {
OneTrust: OneTrust.default,
};
class CookieConsentFactory {
static initialize(sourceConfig, options) {
/**
Expand All @@ -15,19 +12,14 @@ class CookieConsentFactory {
*
*/

if (
options.cookieConsentManager &&
options.cookieConsentManager.oneTrust &&
options.cookieConsentManager.oneTrust.enabled
) {
if (options.cookieConsentManager?.oneTrust?.enabled) {
// This is P1. When we have an ui in source side to turn on/off of cookie consent
// if (sourceConfig &&
// sourceConfig.cookieConsentManager &&
// sourceConfig.cookieConsentManager.oneTrust &&
// sourceConfig.cookieConsentManager.oneTrustenabled) {

const CookieConsentClass = cookieConsent.OneTrust;
return new CookieConsentClass();
return new OneTrust();

// }
}
Expand Down
2 changes: 1 addition & 1 deletion cookieConsent/OneTrust/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import OneTrust from "./browser";

export default OneTrust;
export { OneTrust };

0 comments on commit 02cf227

Please sign in to comment.