Skip to content

Commit

Permalink
Community - add trustarc for cookies (#4865)
Browse files Browse the repository at this point in the history
* community - add trustarc

Issue: AAH-2163

* switch trustarc to prod version
  • Loading branch information
himdel authored Mar 25, 2024
1 parent d5c9540 commit 5c0d635
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES/2163.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
community - add trustarc
1 change: 1 addition & 0 deletions community/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ WORKDIR /workspace/
RUN mkdir -p /workspace/ && \
apk add --no-cache git
COPY . /workspace/
COPY community/index.html /workspace/src/index.html
RUN npm ci && \
npm run gettext:extract && \
npm run gettext:compile && \
Expand Down
25 changes: 25 additions & 0 deletions community/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8" />
<title><%= htmlWebpackPlugin.options.applicationName %></title>

<script
id="trustarc"
type="text/javascript"
src="//static.redhat.com/libs/redhat/marketing/latest/trustarc/trustarc.js"
defer
data-domain="redhat2.com"
data-debug=""
></script>
</head>
<body>
<div id="root"></div>

<footer style="display: none">
<span id="teconsent">
<!-- trustarc -->
</span>
</footer>
</body>
</html>
13 changes: 13 additions & 0 deletions src/containers/landing/landing-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ export class LandingPage extends Component<RouteProps, IState> {
<ListItem>
<ExternalLink href='https://www.redhat.com/en/about/digital-accessibility'>{t`Digital accessibility`}</ExternalLink>
</ListItem>
<ListItem>
<a
onClick={this.cookiePreferences}
>{t`Cookie preferences`}</a>
</ListItem>
</List>
}
/>
Expand All @@ -208,6 +213,14 @@ export class LandingPage extends Component<RouteProps, IState> {
alerts: [...this.state.alerts, alert],
});
}

private cookiePreferences() {
(
window.document.querySelector(
'#teconsent > a',
) as HTMLAnchorElement | null
)?.click();
}
}

export default withRouter(LandingPage);

0 comments on commit 5c0d635

Please sign in to comment.