@times-components/ssr 2.59.38-8c13d97039c1ee721b5b9dbe12709bb98cd93d3d.2 → 2.59.38-b75a9effaef61c0e6e158c7da67c7b2543d193b4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/article.react.bundle.js +12 -4
- package/dist/article.react.bundle.js.map +1 -1
- package/dist/author-profile.react.bundle.js +1 -1
- package/dist/author-profile.react.bundle.js.map +1 -1
- package/dist/common.react.bundle.js +6 -6
- package/dist/common.react.bundle.js.map +1 -1
- package/package.json +2 -2
- package/src/lib/affiliate-links-validation.js +4 -4
- package/src/lib/skimlinks-wrapping.js +18 -14
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@times-components/ssr",
|
|
3
3
|
"main": "src",
|
|
4
|
-
"version": "2.59.38-
|
|
4
|
+
"version": "2.59.38-b75a9effaef61c0e6e158c7da67c7b2543d193b4.3+b75a9effae",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"bundle:dev": "yarn cleanup-dist && webpack --config=webpack.config.js",
|
|
7
7
|
"bundle:prod": "yarn cleanup-dist && NODE_ENV=production webpack --config=webpack.config.js -p",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"publishConfig": {
|
|
81
81
|
"access": "public"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "b75a9effaef61c0e6e158c7da67c7b2543d193b4"
|
|
84
84
|
}
|
|
@@ -3,11 +3,11 @@ const {
|
|
|
3
3
|
travelSiteCode,
|
|
4
4
|
trackonomicsRegex
|
|
5
5
|
} = require("../constants/affiliate-links-validation");
|
|
6
|
-
|
|
6
|
+
const { wrapSkimlinks } = require("./skimlinks-wrapping");
|
|
7
7
|
|
|
8
8
|
const isAffiliateLink = url => trackonomicsRegex.test(url);
|
|
9
9
|
|
|
10
|
-
const wrapAffiliateLink = (
|
|
10
|
+
const wrapAffiliateLink = (affiliateLink, contentPageUrl) => {
|
|
11
11
|
const wrapTrackonomics = trackonomicsUrl => {
|
|
12
12
|
if (!isAffiliateLink(trackonomicsUrl)) {
|
|
13
13
|
return trackonomicsUrl;
|
|
@@ -25,8 +25,8 @@ const wrapAffiliateLink = (affiliateUrl, contentPageUrl) => {
|
|
|
25
25
|
return affiliateWrapper;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
return wrapTrackonomics(
|
|
28
|
+
const skimlinksUrl = wrapSkimlinks(affiliateLink, contentPageUrl);
|
|
29
|
+
return wrapTrackonomics(skimlinksUrl);
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
module.exports.affiliateLinksValidation = (children, articleDataFromRender) => {
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
+
// eslint-disable-next-line no-unused-vars
|
|
1
2
|
const { flowRight } = require("lodash");
|
|
2
|
-
const { publisherId } = require("../constants/affiliate-links-validation");
|
|
3
|
+
/* const { publisherId } = require("../constants/affiliate-links-validation"); */
|
|
3
4
|
|
|
4
|
-
const getSecondLevelDomain = str => str.replace(/^(https?:\/\/)?www\./, "");
|
|
5
|
+
/* const getSecondLevelDomain = str => str.replace(/^(https?:\/\/)?www\./, "");
|
|
5
6
|
|
|
6
7
|
const trim = str => str.trim();
|
|
7
8
|
|
|
8
9
|
const removeTrailingSlash = str => str.replace(/\/$/, "");
|
|
9
10
|
|
|
10
|
-
const stringifyArg = str => (typeof str === "string" ? str : "");
|
|
11
|
+
const stringifyArg = str => (typeof str === "string" ? str : ""); */
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Removes http scheme, `www.`, and trailing slash from the string
|
|
14
15
|
* @param str
|
|
15
16
|
* @returns Domain name without www
|
|
16
17
|
*/
|
|
17
|
-
const sanitizeDomainName = flowRight(
|
|
18
|
+
/* const sanitizeDomainName = flowRight(
|
|
18
19
|
removeTrailingSlash,
|
|
19
20
|
getSecondLevelDomain,
|
|
20
21
|
trim,
|
|
21
22
|
stringifyArg
|
|
22
|
-
);
|
|
23
|
+
); */
|
|
23
24
|
|
|
24
25
|
const fetchSkimlinksDomains = async () => {
|
|
25
26
|
const response = await fetch(
|
|
@@ -40,17 +41,17 @@ const fetchSkimlinksDomains = async () => {
|
|
|
40
41
|
* @param domains List of domains
|
|
41
42
|
* @returns Array of just retailer domains
|
|
42
43
|
*/
|
|
43
|
-
const filterDomains = domains =>
|
|
44
|
+
/* const filterDomains = domains =>
|
|
44
45
|
Array.isArray(domains)
|
|
45
46
|
? domains.map(retailer => retailer.domain).map(sanitizeDomainName)
|
|
46
|
-
: [];
|
|
47
|
+
: []; */
|
|
47
48
|
|
|
48
|
-
const createDomainRegex = domains => {
|
|
49
|
+
/* const createDomainRegex = domains => {
|
|
49
50
|
const domainRegexString = domains.join("|");
|
|
50
51
|
const skimlinksRegex = new RegExp(domainRegexString);
|
|
51
52
|
|
|
52
53
|
return skimlinksRegex;
|
|
53
|
-
};
|
|
54
|
+
}; */
|
|
54
55
|
|
|
55
56
|
/**
|
|
56
57
|
*
|
|
@@ -58,22 +59,25 @@ const createDomainRegex = domains => {
|
|
|
58
59
|
* @param contentPageUrl The referring page
|
|
59
60
|
* @returns Skimlinks url
|
|
60
61
|
*/
|
|
61
|
-
const constructSkimlinksUrl = (merchantUrl, contentPageUrl) => {
|
|
62
|
+
/* const constructSkimlinksUrl = (merchantUrl, contentPageUrl) => {
|
|
62
63
|
const skimlinksWrapper = `https://go.skimresources.com/?id=${publisherId}&url=${encodeURIComponent(
|
|
63
64
|
merchantUrl
|
|
64
65
|
)}&sref=${encodeURIComponent(contentPageUrl)}`;
|
|
65
66
|
|
|
66
67
|
return skimlinksWrapper;
|
|
67
|
-
};
|
|
68
|
+
}; */
|
|
68
69
|
|
|
69
|
-
const wrapSkimlinks = async
|
|
70
|
+
const wrapSkimlinks = async url => {
|
|
70
71
|
const data = await fetchSkimlinksDomains();
|
|
71
|
-
|
|
72
|
+
|
|
73
|
+
// eslint-disable-next-line no-console
|
|
74
|
+
console.log("data: ", data);
|
|
75
|
+
/* const filteredDomains = filterDomains(data);
|
|
72
76
|
const skimlinksRegex = createDomainRegex(filteredDomains);
|
|
73
77
|
|
|
74
78
|
if (skimlinksRegex.test(url)) {
|
|
75
79
|
return constructSkimlinksUrl(url, contentPageUrl);
|
|
76
|
-
}
|
|
80
|
+
} */
|
|
77
81
|
|
|
78
82
|
return url;
|
|
79
83
|
};
|