sfc-utils 1.4.86 → 1.4.87
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.
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { getBlueconic } from "../../blueconic"
|
|
2
|
-
import { getBrands3 } from "../../brands3"
|
|
3
|
-
import { appCheck, blendHDN } from "../../index"
|
|
1
|
+
import { getBlueconic } from "../../blueconic";
|
|
2
|
+
import { getBrands3 } from "../../brands3";
|
|
3
|
+
import { appCheck, blendHDN } from "../../index";
|
|
4
4
|
|
|
5
5
|
/** Used for resizing the WCM Image */
|
|
6
6
|
function debounce(fn, ms) {
|
|
7
|
-
let timer
|
|
8
|
-
return _ => {
|
|
9
|
-
clearTimeout(timer)
|
|
10
|
-
timer = setTimeout(_ => {
|
|
11
|
-
timer = null
|
|
12
|
-
fn.apply(this, arguments)
|
|
13
|
-
}, ms)
|
|
14
|
-
}
|
|
7
|
+
let timer;
|
|
8
|
+
return (_) => {
|
|
9
|
+
clearTimeout(timer);
|
|
10
|
+
timer = setTimeout((_) => {
|
|
11
|
+
timer = null;
|
|
12
|
+
fn.apply(this, arguments);
|
|
13
|
+
}, ms);
|
|
14
|
+
};
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
function appendLayoutScripts(isEmbedded, isAdRemoved, marketKey) {
|
|
@@ -20,41 +20,44 @@ function appendLayoutScripts(isEmbedded, isAdRemoved, marketKey) {
|
|
|
20
20
|
// React Helmet is actually terrible and runs these scripts twice, so we are including them async ourselves
|
|
21
21
|
// Run analytics and resizing scripts right away so we take care of that
|
|
22
22
|
if (!isEmbedded) {
|
|
23
|
-
let script = document.createElement(
|
|
24
|
-
script.type =
|
|
25
|
-
script.src =
|
|
23
|
+
let script = document.createElement("script");
|
|
24
|
+
script.type = "text/javascript";
|
|
25
|
+
script.src = "https://nexus.ensighten.com/hearst/news/Bootstrap.js";
|
|
26
26
|
document.body.appendChild(script);
|
|
27
27
|
} else {
|
|
28
|
-
let script = document.createElement(
|
|
29
|
-
script.type =
|
|
30
|
-
script.src =
|
|
28
|
+
let script = document.createElement("script");
|
|
29
|
+
script.type = "text/javascript";
|
|
30
|
+
script.src =
|
|
31
|
+
"https://projects.sfchronicle.com/shared/js/responsive-child.js";
|
|
31
32
|
document.body.appendChild(script);
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
if (!isEmbedded && !isAdRemoved) {
|
|
35
|
-
let script = document.createElement(
|
|
36
|
-
script.type =
|
|
37
|
-
script.id =
|
|
38
|
-
script.src =
|
|
36
|
+
let script = document.createElement("script");
|
|
37
|
+
script.type = "text/javascript";
|
|
38
|
+
script.id = "adPositionManagerScriptTag";
|
|
39
|
+
script.src = "https://aps.hearstnp.com/Scripts/loadAds.js";
|
|
39
40
|
document.body.appendChild(script);
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
// Wait a beat, then add to body so it doesn't mess with the head (which Helmet seems to want to manage)
|
|
43
44
|
setTimeout(() => {
|
|
44
45
|
if (!isEmbedded && !isApp) {
|
|
45
|
-
let blueconicURL = getBlueconic(window.location.origin)
|
|
46
|
-
let script = document.createElement(
|
|
47
|
-
script.type =
|
|
48
|
-
script.defer = true
|
|
49
|
-
script.src = blueconicURL
|
|
50
|
-
document.body.appendChild(script)
|
|
46
|
+
let blueconicURL = getBlueconic(window.location.origin);
|
|
47
|
+
let script = document.createElement("script");
|
|
48
|
+
script.type = "text/javascript";
|
|
49
|
+
script.defer = true;
|
|
50
|
+
script.src = blueconicURL;
|
|
51
|
+
document.body.appendChild(script);
|
|
51
52
|
|
|
52
53
|
// Init sailthru
|
|
53
54
|
if (window && window.Sailthru && marketKey) {
|
|
54
|
-
window.Sailthru.init({
|
|
55
|
+
window.Sailthru.init({
|
|
56
|
+
customerId: getBrands3(marketKey).attributes.sailCustomer,
|
|
57
|
+
});
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
|
-
},
|
|
60
|
+
}, 1000);
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
function formatHDN(isEmbedded, url_add, meta) {
|
|
@@ -62,21 +65,21 @@ function formatHDN(isEmbedded, url_add, meta) {
|
|
|
62
65
|
const thisBrand = getBrands3(meta.PROJECT.MARKET_KEY);
|
|
63
66
|
|
|
64
67
|
// Combine our settings with what Hearst puts on page
|
|
65
|
-
let stringHDN =
|
|
68
|
+
let stringHDN = "";
|
|
66
69
|
if (!isEmbedded) {
|
|
67
70
|
// Put url_add into a new meta object to pass in
|
|
68
|
-
const metaHDN = Object.assign({}, meta)
|
|
69
|
-
metaHDN.URL_ADD = url_add
|
|
71
|
+
const metaHDN = Object.assign({}, meta);
|
|
72
|
+
metaHDN.URL_ADD = url_add;
|
|
70
73
|
// Add sailthru var
|
|
71
74
|
metaHDN.SAIL_CUST = thisBrand.attributes.sailCustomer;
|
|
72
75
|
// Make sure this is free on app
|
|
73
76
|
if (isApp) {
|
|
74
|
-
metaHDN.PAYWALL_SETTING = "free"
|
|
77
|
+
metaHDN.PAYWALL_SETTING = "free";
|
|
75
78
|
}
|
|
76
79
|
// Allow gift button to appear next to sharebuttons
|
|
77
|
-
metaHDN.GIFT_ENABLED = true
|
|
78
|
-
let blended = blendHDN(metaHDN)
|
|
79
|
-
stringHDN = blended.stringHDN
|
|
80
|
+
metaHDN.GIFT_ENABLED = true;
|
|
81
|
+
let blended = blendHDN(metaHDN);
|
|
82
|
+
stringHDN = blended.stringHDN;
|
|
80
83
|
}
|
|
81
84
|
return stringHDN;
|
|
82
85
|
}
|
|
@@ -102,4 +105,4 @@ function getFigureWidth(maxWidth) {
|
|
|
102
105
|
}
|
|
103
106
|
}
|
|
104
107
|
|
|
105
|
-
export { debounce, appendLayoutScripts, formatHDN, getFigureWidth }
|
|
108
|
+
export { debounce, appendLayoutScripts, formatHDN, getFigureWidth };
|