-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GPC indication on fides-js overlay (#3673)
- Loading branch information
1 parent
0337c66
commit dd7ebfa
Showing
21 changed files
with
372 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { h } from "preact"; | ||
import { GpcStatus, PrivacyNotice } from "../lib/consent-types"; | ||
import { getConsentContext } from "../lib/consent-context"; | ||
import { getGpcStatusFromNotice } from "../lib/consent-utils"; | ||
|
||
export const GpcBadge = ({ | ||
label, | ||
status, | ||
}: { | ||
label: string; | ||
status: string; | ||
}) => ( | ||
<span className="fides-gpc-label"> | ||
{label}{" "} | ||
<span className={`fides-gpc-badge fides-gpc-badge-${status}`}> | ||
{status} | ||
</span> | ||
</span> | ||
); | ||
|
||
export const GpcBadgeForNotice = ({ | ||
value, | ||
notice, | ||
}: { | ||
value: boolean; | ||
notice: PrivacyNotice; | ||
}) => { | ||
const consentContext = getConsentContext(); | ||
const status = getGpcStatusFromNotice({ value, notice, consentContext }); | ||
|
||
if (status === GpcStatus.NONE) { | ||
return null; | ||
} | ||
|
||
return <GpcBadge label="Global Privacy Control" status={status.valueOf()} />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { h } from "preact"; | ||
import WarningIcon from "./WarningIcon"; | ||
import { getConsentContext } from "../lib/consent-context"; | ||
|
||
const GpcInfo = () => { | ||
const context = getConsentContext(); | ||
|
||
if (!context.globalPrivacyControl) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className="fides-gpc-banner"> | ||
<div className="fides-gpc-warning"> | ||
<WarningIcon /> | ||
</div> | ||
<div> | ||
<p className="fides-gpc-header">Global Privacy Control detected</p> | ||
<p> | ||
Your global privacy control preference has been honored. You have been | ||
automatically opted out of data uses cases which adhere to global | ||
privacy control. | ||
</p> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default GpcInfo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { h } from "preact"; | ||
|
||
const WarningIcon = () => ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="18" | ||
height="18" | ||
fill="currentColor" | ||
> | ||
<path d="M9 12.05a.68.68 0 0 0-.68.7c0 .39.32.7.68.7.39 0 .68-.31.68-.7a.66.66 0 0 0-.68-.7Zm0-1.18c.26 0 .44-.2.44-.46V6.19c0-.26-.2-.47-.44-.47a.49.49 0 0 0-.47.47v4.22c0 .25.21.46.47.46Zm7.27 2.27-5.85-9.9c-.3-.5-.83-.8-1.42-.8-.6 0-1.12.3-1.42.8l-5.86 9.9c-.3.5-.3 1.1-.01 1.6.3.51.83.82 1.43.82h11.72c.6 0 1.13-.3 1.43-.82.29-.5.28-1.1-.02-1.6Zm-.82 1.1c-.1.25-.33.38-.62.38H3.14a.7.7 0 0 1-.61-.35.64.64 0 0 1 0-.65l5.86-9.9A.7.7 0 0 1 9 3.37a.7.7 0 0 1 .61.35l5.86 9.9c.1.2.12.44-.02.63Z" /> | ||
</svg> | ||
); | ||
|
||
export default WarningIcon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.