@times-components/ssr 2.59.38-b75a9effaef61c0e6e158c7da67c7b2543d193b4.3 → 2.59.38-ead701343e666ee07c63d76a718327484fe4d06e.0

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@times-components/ssr",
3
3
  "main": "src",
4
- "version": "2.59.38-b75a9effaef61c0e6e158c7da67c7b2543d193b4.3+b75a9effae",
4
+ "version": "2.59.38-ead701343e666ee07c63d76a718327484fe4d06e.0+ead701343e",
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": "b75a9effaef61c0e6e158c7da67c7b2543d193b4"
83
+ "gitHead": "ead701343e666ee07c63d76a718327484fe4d06e"
84
84
  }
@@ -1,26 +1,25 @@
1
- // eslint-disable-next-line no-unused-vars
2
1
  const { flowRight } = require("lodash");
3
- /* const { publisherId } = require("../constants/affiliate-links-validation"); */
2
+ const { publisherId } = require("../constants/affiliate-links-validation");
4
3
 
5
- /* const getSecondLevelDomain = str => str.replace(/^(https?:\/\/)?www\./, "");
4
+ const getSecondLevelDomain = str => str.replace(/^(https?:\/\/)?www\./, "");
6
5
 
7
6
  const trim = str => str.trim();
8
7
 
9
8
  const removeTrailingSlash = str => str.replace(/\/$/, "");
10
9
 
11
- const stringifyArg = str => (typeof str === "string" ? str : ""); */
10
+ const stringifyArg = str => (typeof str === "string" ? str : "");
12
11
 
13
12
  /**
14
13
  * Removes http scheme, `www.`, and trailing slash from the string
15
14
  * @param str
16
15
  * @returns Domain name without www
17
16
  */
18
- /* const sanitizeDomainName = flowRight(
17
+ const sanitizeDomainName = flowRight(
19
18
  removeTrailingSlash,
20
19
  getSecondLevelDomain,
21
20
  trim,
22
21
  stringifyArg
23
- ); */
22
+ );
24
23
 
25
24
  const fetchSkimlinksDomains = async () => {
26
25
  const response = await fetch(
@@ -41,17 +40,17 @@ const fetchSkimlinksDomains = async () => {
41
40
  * @param domains List of domains
42
41
  * @returns Array of just retailer domains
43
42
  */
44
- /* const filterDomains = domains =>
43
+ const filterDomains = domains =>
45
44
  Array.isArray(domains)
46
45
  ? domains.map(retailer => retailer.domain).map(sanitizeDomainName)
47
- : []; */
46
+ : [];
48
47
 
49
- /* const createDomainRegex = domains => {
48
+ const createDomainRegex = domains => {
50
49
  const domainRegexString = domains.join("|");
51
50
  const skimlinksRegex = new RegExp(domainRegexString);
52
51
 
53
52
  return skimlinksRegex;
54
- }; */
53
+ };
55
54
 
56
55
  /**
57
56
  *
@@ -59,25 +58,22 @@ const fetchSkimlinksDomains = async () => {
59
58
  * @param contentPageUrl The referring page
60
59
  * @returns Skimlinks url
61
60
  */
62
- /* const constructSkimlinksUrl = (merchantUrl, contentPageUrl) => {
61
+ const constructSkimlinksUrl = (merchantUrl, contentPageUrl) => {
63
62
  const skimlinksWrapper = `https://go.skimresources.com/?id=${publisherId}&url=${encodeURIComponent(
64
63
  merchantUrl
65
64
  )}&sref=${encodeURIComponent(contentPageUrl)}`;
66
65
 
67
66
  return skimlinksWrapper;
68
- }; */
67
+ };
69
68
 
70
- const wrapSkimlinks = async url => {
69
+ const wrapSkimlinks = async (url, contentPageUrl) => {
71
70
  const data = await fetchSkimlinksDomains();
72
-
73
- // eslint-disable-next-line no-console
74
- console.log("data: ", data);
75
- /* const filteredDomains = filterDomains(data);
71
+ const filteredDomains = filterDomains(data);
76
72
  const skimlinksRegex = createDomainRegex(filteredDomains);
77
73
 
78
74
  if (skimlinksRegex.test(url)) {
79
75
  return constructSkimlinksUrl(url, contentPageUrl);
80
- } */
76
+ }
81
77
 
82
78
  return url;
83
79
  };