Skip to content

Commit f918493

Browse files
authored
Merge pull request #161 from SupahNickie/160-company-name-field
add companyName to configuration options
2 parents 39e75ca + b77a099 commit f918493

File tree

6 files changed

+85
-2
lines changed

6 files changed

+85
-2
lines changed

spec/configuration.spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,16 @@ describe('different configurations', () => {
100100
});
101101
});
102102

103+
describe('Company Name', () => {
104+
beforeEach(() => {
105+
browser.get("/e2e/company_name.html");
106+
browser.sleep(300);
107+
});
108+
109+
it('title contains the company name specified in the config', () => {
110+
const el = element.all(by.css('[class^=intro_title]')).first();
111+
expect(el.getText()).toContain("Roadrunner and Coyote Enterprises");
112+
});
113+
});
114+
103115
});

src/components/popup/intro/intro.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ export default class Intro extends Component {
4040
}
4141
<div class={style.title + " primaryText"}>
4242
<LocalLabel providedValue={localization && localization.intro ? localization.intro.title : ''} localizeKey='title'>Thanks for visiting </LocalLabel>
43-
<LocalLabel providedValue={localization && localization.intro ? localization.intro.domain : ''} localizeKey='domain'></LocalLabel>
43+
{config && config.companyName &&
44+
<span>{config.companyName}</span>
45+
}
4446
</div>
4547
<div class={style.description + " primaryText"}>
4648
<LocalLabel providedValue={localization && localization.intro ? localization.intro.description : ''} localizeKey='description'>Ads help us run this site. When you use our site selected companies may access and use information on your device for various purposes including to serve relevant ads or personalised content.</LocalLabel>

src/components/popup/intro/introV2.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ export default class IntroV2 extends Component {
4141
}
4242
<div class={config.logoUrl ? style.title + " " + style.imagePadding : style.title}>
4343
<LocalLabel providedValue={localization && localization.intro ? localization.intro.title : ''} localizeKey='title'>Thanks for visiting </LocalLabel>
44-
<LocalLabel providedValue={localization && localization.intro ? localization.intro.domain : ''} localizeKey='domain'></LocalLabel>
44+
{config && config.companyName &&
45+
<span>{config.companyName}</span>
46+
}
4547
</div>
4648
</div>
4749
<div class={style.description + " primaryText"}>

src/e2e/company_name.html

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>GDPR Documentation</title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimal-ui">
7+
<meta name="apple-mobile-web-app-capable" content="yes">
8+
<script>
9+
(function(window) {
10+
window.__cmp = (function() {
11+
window.addEventListener('message', function(event) {
12+
window.__cmp.receiveMessage(event);
13+
});
14+
15+
var commandQueue = [];
16+
var cmp = function(command, parameter, callback) {
17+
commandQueue.push({
18+
command: command,
19+
parameter: parameter,
20+
callback: callback
21+
});
22+
};
23+
cmp.commandQueue = commandQueue;
24+
cmp.receiveMessage = function(event) {
25+
var data = event && event.data && event.data.__cmpCall;
26+
if (data) {
27+
commandQueue.push({
28+
callId: data.callId,
29+
command: data.command,
30+
parameter: data.parameter,
31+
event: event
32+
});
33+
}
34+
};
35+
cmp.config = {
36+
companyName: "Roadrunner and Coyote Enterprises",
37+
customPurposeListLocation: '../../docs/purposes.json',
38+
globalVendorListLocation: '../../docs/vendors.json',
39+
globalConsentLocation: '../../docs/portal.html',
40+
storeConsentGlobally: false,
41+
storePublisherConsentGlobally: false,
42+
storePublisherData: true,
43+
logging: "debug",
44+
blockBrowsing: false,
45+
forceLocale: 'en',
46+
testingMode: 'always show',
47+
showFooterAfterSubmit: true,
48+
};
49+
return cmp;
50+
}());
51+
})(window);
52+
53+
window.__cmp('renderCmpIfNeeded');
54+
</script>
55+
</head>
56+
<body>
57+
<a href="#">Some Link</a>
58+
<div><p>Some Text</p></div>
59+
<script type="text/javascript" src="../../cmp.bundle.js"></script></body>
60+
</body>
61+
</html>

src/lib/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import log from './log';
22
const metadata = require('../../metadata.json');
33
const defaultConfig = {
4+
companyName: null,
45
storePublisherData: true,
56
customPurposeListLocation: null,
67
storeConsentGlobally: true,

webpack.config.babel.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,11 @@ module.exports = [
203203
template: 'e2e/layout-thin.html',
204204
chunks: ['e2e']
205205
}),
206+
new HtmlWebpackPlugin({
207+
filename: 'e2e/company_name.html',
208+
template: 'e2e/company_name.html',
209+
chunks: ['e2e']
210+
}),
206211
// Static assets copy
207212
new CopyWebpackPlugin([
208213
{ from: './geoip.json' }

0 commit comments

Comments
 (0)