Skip to content

Commit b2049ff

Browse files
committed
remove AdStatisticsLink feature toggle
1 parent e161715 commit b2049ff

File tree

4 files changed

+3
-57
lines changed

4 files changed

+3
-57
lines changed

package-lock.json

Lines changed: 0 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
"request-promise": "^4.2.6",
4848
"ua-parser-js": "^0.7.24",
4949
"universal-cookie": "^4.0.4",
50-
"unleash-client": "^3.4.0",
5150
"whatwg-fetch": "^2.0.4"
5251
},
5352
"devDependencies": {

server/server.js

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const compression = require('compression');
99
const searchApiConsumer = require('./api/searchApiConsumer');
1010
const htmlMeta = require('./common/htmlMeta');
1111
const locationApiConsumer = require('./api/locationApiConsumer');
12-
const { initialize } = require('unleash-client');
1312

1413
/* eslint no-console: 0 */
1514

@@ -130,38 +129,18 @@ const renderSok = (htmlPages) => (
130129
})
131130
);
132131

133-
const unleash = initialize({
134-
url: fasitProperties.UNLEASH_URL,
135-
appName: 'pam-stillingsok'
136-
})
137-
138-
const oneWeek = 604800;
139-
const newCvRollbackFeatureToggle = `pam-cv.new-cv-rollback${process.env.NAIS_CLUSTER_NAME.includes('dev') ? '-dev' : ''}`;
140-
const showAdStatisticsLinkToggle = `pam-stillingsok.show-add-statistics-link${process.env.NAIS_CLUSTER_NAME.includes('dev') ? '-dev' : ''}`;
141-
142-
143132
const startServer = (htmlPages) => {
144133
writeEnvironmentVariablesToFile();
145-
146134
server.use((req, res, next) => {
135+
const oneWeek = 604800;
136+
147137
if (req.path.includes('internal')) {
148138
return next();
149139
}
140+
150141
if ((req && req.headers.cookie && !req.headers.cookie.includes('amplitudeIsEnabled')) || !req.headers.cookie){
151142
res.cookie('amplitudeIsEnabled', true, { maxAge: oneWeek * 2, domain: '.nav.no' });
152143
}
153-
if ((req && req.headers.cookie && !req.headers.cookie.includes('showAdStatisticsLink'))) {
154-
res.cookie('showAdStatisticsLink', unleash.isEnabled(showAdStatisticsLinkToggle, {}), { maxAge: oneWeek * 4, domain: '.nav.no' });
155-
}
156-
157-
if ((req && req.headers.cookie
158-
&& req.headers.cookie.includes('newCvRolloutGroup'))
159-
// NOTE: Using pam-cv's feature toggle, since the rollback happens on both apps.
160-
&& unleash.isEnabled(newCvRollbackFeatureToggle, {})) {
161-
162-
res.cookie('newCvRolloutGroup', false, { maxAge: oneWeek * 4, domain: '.nav.no' });
163-
res.cookie('useNewCv', false, { maxAge: oneWeek * 4, domain: '.nav.no' })
164-
}
165144
next();
166145
});
167146

src/common/components/AdStatisticsLink.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
import * as React from "react";
22
import './AdStatisticsLink.less';
33
import logAmplitudeEvent from "../../amplitudeTracker";
4-
import {useEffect, useState} from "react";
5-
import Cookies from "universal-cookie";
64

75
const AD_STATISTICS_URL = 'https://data.nav.no/datapakke/703bc2e74c271ee895609ebd93c52460';
86

97
const AdStatisticsLink = () => {
10-
const [showAdStatistics, setShowAdStatistics] = useState(false);
11-
12-
useEffect(() => {
13-
const cookies = new Cookies();
14-
setShowAdStatistics(cookies.get('showAdStatisticsLink') === 'true')
15-
}, []);
168

179
const logAmplitudeEventAndRedirect = (event) => {
1810
event.preventDefault();
@@ -22,10 +14,6 @@ const AdStatisticsLink = () => {
2214
window.open(AD_STATISTICS_URL, "_blank")
2315
};
2416

25-
if (!showAdStatistics) {
26-
return null;
27-
}
28-
2917
return (<a
3018
href={AD_STATISTICS_URL}
3119
className="AdStatisticsLink"

0 commit comments

Comments
 (0)