Skip to content

Commit e2ed1a7

Browse files
committed
lmendoza/onetrust2
1 parent 3c55b3a commit e2ed1a7

File tree

6 files changed

+16
-95
lines changed

6 files changed

+16
-95
lines changed

scripts/build-info.postbuild.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ export function buildInfo(indexHtml, options): string {
77
} catch (err) {}
88

99
const config = `
10-
<!--${options.languageCode}${
11-
options.environment ? '-' + options.environment : ''
10+
<!--${options.languageCode} ''
1211
} ${new Date().toJSON()}-->
1312
${
1413
gitInfo ? '<!--' + gitInfo.abbreviatedSha + '/' + gitInfo.lastTag + '-->' : ''

scripts/new-relic.postbuild.ts

Lines changed: 0 additions & 64 deletions
This file was deleted.

scripts/onetrust.postbuild.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export function addOneTrustNotAutoBlockForAppScripts(data) {
2+
// This regex does the following:
3+
// - `<script\b` matches the literal "<script" followed by a word boundary.
4+
// - `(?![^>]*\bdata-ot-ignore\b)` is a negative lookahead ensuring that the attribute isn't already present.
5+
// - `([^>]*)` captures any other attributes inside the tag (until the closing '>').
6+
//
7+
// The replacement inserts "data-ot-ignore" into the tag.
8+
return data.replace(
9+
/<script\b(?![^>]*\bdata-ot-ignore\b)([^>]*)>/gi,
10+
'<script data-ot-ignore$1>'
11+
)
12+
}

scripts/postbuild.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
import { getOptionsObjet, save } from './utils'
99
import { renameSync, readFileSync } from 'fs'
1010
import { createShareAssetsFolder } from './moveToShareFolder.postbuild'
11+
import { addOneTrustNotAutoBlockForAppScripts } from './onetrust.postbuild'
1112

1213
const glob = require('glob')
1314
// Run updates on index.html files across languages
@@ -16,12 +17,10 @@ glob
1617
.forEach((file) => {
1718
const options = getOptionsObjet(file)
1819
let data = readFileSync(file, 'utf8')
19-
// data = uniqueLength(data, options) DISABLED unique leght for now, as migth not be required anymore
2020
data = buildInfo(data, options)
21-
// data = newRelic(data, options) TEMPORALLY DISABLE NEW RELIC
22-
2321
// Replace all the `*.js` references to match updated JS file names with the language code.
2422
data = addLanguageCodeToHashesOnToHTMLFiles(data, options)
23+
data = addOneTrustNotAutoBlockForAppScripts(data)
2524
// data = robotsMetadata(data, options) DISABLE robots headers, as those will be handle via nginx
2625
save(data, options)
2726
})
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
// tslint:disable-next-line: max-line-length
2-
export const BROWSERLIST_REGEXP =
3-
/((CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS)[ +]+(13[_.]4|13[_.]([5-9]|\d{2,})|13[_.]7|13[_.]([8-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})[_.]\d+|14[_.]0|14[_.]([1-9]|\d{2,})|14[_.]4|14[_.]([5-9]|\d{2,})|14[_.]8|14[_.](9|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})[_.]\d+|15[_.]0|15[_.]([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})[_.]\d+|16[_.]0|16[_.]([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})[_.]\d+|17[_.]0|17[_.]([1-9]|\d{2,})|(1[8-9]|[2-9]\d|\d{3,})[_.]\d+)(?:[_.]\d+)?)|((?:Chrome).*OPR\/(74|(7[5-9]|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Edge\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))(?:\.\d+)?)|((Chromium|Chrome)\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))\.\d+(?:\.\d+)?)|(Version\/(13\.1|13\.([2-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})\.\d+|14\.0|14\.([1-9]|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})\.\d+|15\.0|15\.([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})\.\d+|16\.0|16\.([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})\.\d+|17\.0|17\.([1-9]|\d{2,})|(1[8-9]|[2-9]\d|\d{3,})\.\d+)(?:\.\d+)? Safari\/)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+(pre|[ab]\d+[a-z]*)?)/
2+
export const BROWSERLIST_REGEXP = /((CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS)[ +]+(13[_.]4|13[_.]([5-9]|\d{2,})|13[_.]7|13[_.]([8-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})[_.]\d+|14[_.]0|14[_.]([1-9]|\d{2,})|14[_.]4|14[_.]([5-9]|\d{2,})|14[_.]8|14[_.](9|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})[_.]\d+|15[_.]0|15[_.]([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})[_.]\d+|16[_.]0|16[_.]([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})[_.]\d+|17[_.]0|17[_.]([1-9]|\d{2,})|(1[8-9]|[2-9]\d|\d{3,})[_.]\d+)(?:[_.]\d+)?)|((?:Chrome).*OPR\/(74|(7[5-9]|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Edge\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))(?:\.\d+)?)|((Chromium|Chrome)\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))\.\d+(?:\.\d+)?)|(Version\/(13\.1|13\.([2-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})\.\d+|14\.0|14\.([1-9]|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})\.\d+|15\.0|15\.([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})\.\d+|16\.0|16\.([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})\.\d+|17\.0|17\.([1-9]|\d{2,})|(1[8-9]|[2-9]\d|\d{3,})\.\d+)(?:\.\d+)? Safari\/)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+(pre|[ab]\d+[a-z]*)?)/

src/index.html

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<meta name="viewport" content="width=device-width, initial-scale=1" />
1010

1111
<link rel="icon" type="image/x-icon" href="./assets/icons/favicon.ico" />
12-
<!-- NEW_RELIC_PLACEHOLDER -->
1312
<link
1413
href="https://fonts.googleapis.com/icon?family=Material+Icons"
1514
rel="stylesheet"
@@ -19,29 +18,6 @@
1918
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,600,0,0"
2019
/>
2120
<meta name="theme-color" content="#1976d2" />
22-
<script
23-
type="text/javascript"
24-
src="https://cdn.cookielaw.org/consent/5a6d60d3-b085-4e48-8afa-d707c7afc419-test/OtAutoBlock.js"
25-
></script>
26-
<script
27-
type="text/javascript"
28-
src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js"
29-
charset="UTF-8"
30-
data-document-language="true"
31-
data-domain-script="5a6d60d3-b085-4e48-8afa-d707c7afc419-test"
32-
></script>
33-
<script type="text/javascript">
34-
function OptanonWrapper() {
35-
const oneTrust = window.document.getElementById('onetrust-consent-sdk')
36-
if (window.location !== window.parent.location && oneTrust) {
37-
oneTrust.style.display = 'none'
38-
}
39-
40-
window.document
41-
.getElementById('onetrust-consent-sdk')
42-
?.setAttribute('data-nosnippet', 'true')
43-
}
44-
</script>
4521
<script
4622
id="ze-snippet"
4723
src="https://static.zdassets.com/ekr/snippet.js?key=b8313acd-6439-4894-b431-8c5a2ae9e7cb"

0 commit comments

Comments
 (0)