Skip to content

Commit

Permalink
fixing some conflicts from rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
eastandwestwind committed May 8, 2023
1 parent ee22baa commit 06e46cb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 25 deletions.
2 changes: 1 addition & 1 deletion clients/fides-js/src/fides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const init = async (config: FidesConfig) => {
await initFidesConsent(defaults, config.bannerOptions);
// Initialize the window.Fides object
_Fides.consent = cookie.consent;
_Fides.getBannerOptions = getBannerOptions();
_Fides.getBannerOptions = getBannerOptions;
_Fides.fides_meta = cookie.fides_meta;
_Fides.identity = cookie.identity;

Expand Down
8 changes: 1 addition & 7 deletions clients/fides-js/src/lib/consent-banner.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {h, Component, VNode} from "preact";
import {useState, useEffect} from "preact/hooks";
import {CookieKeyConsent, hasSavedConsentCookie, setConsentCookieAcceptAll, setConsentCookieRejectAll} from "./cookie";
import {CookieKeyConsent, setConsentCookieAcceptAll, setConsentCookieRejectAll} from "./cookie";
import {ButtonType, ConsentBannerOptions} from "./consent-types";
import debugLog from "./consent-utils";
import ConsentBannerButton from "./ConsentBannerButton";
Expand Down Expand Up @@ -111,12 +111,6 @@ class ConsentBanner extends Component<BannerProps, BannerState> {
render(): VNode | null {
let bannerBuild = null;
try {
if (hasSavedConsentCookie()) {
debugLog(
"Fides consent cookie already exists, skipping banner initialization!"
);
return null;
}
debugLog(
"Fides consent banner should be shown! Building banner elements & styles..."
);
Expand Down
10 changes: 1 addition & 9 deletions clients/fides-js/src/lib/consent-link.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { h, Component, VNode } from "preact";
import { CookieKeyConsent, hasSavedConsentCookie } from "./cookie";
import { CookieKeyConsent } from "./cookie";
import debugLog, { getBannerOptions } from "./consent-utils";
import { ConsentBannerOptions } from "./consent-types";

Expand Down Expand Up @@ -30,14 +30,6 @@ class ConsentLink extends Component<LinkProps> {
let linkBuild = null;
// If the user provides any extra options, override the defaults
try {
if (hasSavedConsentCookie()) {
// todo- check for device id too
// also does the existence of a device id prevent links from rendering too, or just banners?
debugLog(
"Fides consent cookie already exists, skipping banner initialization!"
);
return null;
}
debugLog(
"Fides consent link should be shown! Building banner elements & styles..."
);
Expand Down
6 changes: 4 additions & 2 deletions clients/fides-js/src/lib/cookie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ export const setConsentCookieAcceptAll = (defaults: CookieKeyConsent): void => {
// Override all consent values to true and save the cookie
const entries: [string, boolean][] = Object.keys(defaults).map((key) => [key, true]);
const cookieKeyConsent = Object.fromEntries(entries);
setConsentCookie(cookieKeyConsent);
const cookie: FidesCookie = getOrMakeFidesCookie(cookieKeyConsent);
saveFidesCookie(cookie);
};

export const setConsentCookieRejectAll = (defaults: CookieKeyConsent): void => {
Expand All @@ -241,5 +242,6 @@ export const setConsentCookieRejectAll = (defaults: CookieKeyConsent): void => {
// Override all consent values to false and save the cookie
const entries: [string, boolean][] = Object.keys(defaults).map((key) => [key, false]);
const cookieKeyConsent = Object.fromEntries(entries);
setConsentCookie(cookieKeyConsent);
const cookie: FidesCookie = getOrMakeFidesCookie(cookieKeyConsent);
saveFidesCookie(cookie);
};
6 changes: 0 additions & 6 deletions clients/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 06e46cb

Please sign in to comment.