sfc-utils 1.4.177 → 1.4.179
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/blueconic.js +126 -50
- package/brands3.js +17 -0
- package/components/geocoder.mjs +1 -0
- package/components/helpers/utilfunctions.mjs +1 -1
- package/components/layout/layouthelmet.mjs +3 -0
- package/example/gatsby-config.js +31 -25
- package/footer.js +876 -702
- package/index.js +4 -0
- package/package.json +1 -1
package/blueconic.js
CHANGED
|
@@ -1,58 +1,134 @@
|
|
|
1
|
-
|
|
2
1
|
// Handle returning the right blueconic URL given the domain
|
|
3
|
-
let getBlueconic = function(domain){
|
|
4
|
-
let blueconicURL = "https://cdn.blueconic.net/hearst.js" // Default, but it's not what we want
|
|
5
|
-
let subdomain = ""
|
|
2
|
+
let getBlueconic = function (domain) {
|
|
3
|
+
let blueconicURL = "https://cdn.blueconic.net/hearst.js"; // Default, but it's not what we want
|
|
4
|
+
let subdomain = "";
|
|
6
5
|
|
|
7
6
|
// Set subdomain based on URL
|
|
8
|
-
let apex = domain.replace(
|
|
9
|
-
apex = apex.replace(
|
|
10
|
-
switch(apex){
|
|
11
|
-
case "sfchronicle.com":
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
case "
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
case "
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
case "
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
case "
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
case "
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
case "
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
case "
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
case "
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
case "
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
case "
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
case "
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
case "
|
|
7
|
+
let apex = domain.replace("https://", "");
|
|
8
|
+
apex = apex.replace("www.", "");
|
|
9
|
+
switch (apex) {
|
|
10
|
+
case "sfchronicle.com":
|
|
11
|
+
subdomain = "q777";
|
|
12
|
+
break;
|
|
13
|
+
case "beaumontenterprise.com":
|
|
14
|
+
subdomain = "z680";
|
|
15
|
+
break;
|
|
16
|
+
case "chron.com":
|
|
17
|
+
subdomain = "u566";
|
|
18
|
+
break;
|
|
19
|
+
case "ctinsider.com":
|
|
20
|
+
subdomain = "z492";
|
|
21
|
+
break;
|
|
22
|
+
case "ctpost.com":
|
|
23
|
+
subdomain = "t810";
|
|
24
|
+
break;
|
|
25
|
+
case "darientimes.com":
|
|
26
|
+
subdomain = "y820";
|
|
27
|
+
break;
|
|
28
|
+
case "expressnews.com":
|
|
29
|
+
subdomain = "l936";
|
|
30
|
+
break;
|
|
31
|
+
case "fairfieldcitizenonline.com":
|
|
32
|
+
subdomain = "z590";
|
|
33
|
+
break;
|
|
34
|
+
case "fuelfix.com":
|
|
35
|
+
subdomain = "z929";
|
|
36
|
+
break;
|
|
37
|
+
case "greenwichtime.com":
|
|
38
|
+
subdomain = "y900";
|
|
39
|
+
break;
|
|
40
|
+
case "hearstmediact.com":
|
|
41
|
+
subdomain = "j158";
|
|
42
|
+
break;
|
|
43
|
+
case "hearstmediatx.com":
|
|
44
|
+
subdomain = "f857";
|
|
45
|
+
break;
|
|
46
|
+
case "houstonchronicle.com":
|
|
47
|
+
subdomain = "r541";
|
|
48
|
+
break;
|
|
49
|
+
case "lmtonline.com":
|
|
50
|
+
subdomain = "l997";
|
|
51
|
+
break;
|
|
52
|
+
case "middletownpress.com":
|
|
53
|
+
subdomain = "w982";
|
|
54
|
+
break;
|
|
55
|
+
case "milfordmirror.com":
|
|
56
|
+
subdomain = "y752";
|
|
57
|
+
break;
|
|
58
|
+
case "mrt.com":
|
|
59
|
+
subdomain = "x822";
|
|
60
|
+
break;
|
|
61
|
+
case "myplainview.com":
|
|
62
|
+
subdomain = "u652";
|
|
63
|
+
break;
|
|
64
|
+
case "mysanantonio.com":
|
|
65
|
+
subdomain = "d810";
|
|
66
|
+
break;
|
|
67
|
+
case "ncadvertiser.com":
|
|
68
|
+
subdomain = "h353";
|
|
69
|
+
break;
|
|
70
|
+
case "newmilfordspectrum.com":
|
|
71
|
+
subdomain = "w020";
|
|
72
|
+
break;
|
|
73
|
+
case "newstimes.com":
|
|
74
|
+
subdomain = "w740";
|
|
75
|
+
break;
|
|
76
|
+
case "ourmidland.com":
|
|
77
|
+
subdomain = "d276";
|
|
78
|
+
break;
|
|
79
|
+
case "registercitizen.com":
|
|
80
|
+
subdomain = "j198";
|
|
81
|
+
break;
|
|
82
|
+
case "seattlepi.com":
|
|
83
|
+
subdomain = "p593";
|
|
84
|
+
break;
|
|
85
|
+
case "sfgate.com":
|
|
86
|
+
subdomain = "u927";
|
|
87
|
+
break;
|
|
88
|
+
case "sheltonherald.com":
|
|
89
|
+
subdomain = "f164";
|
|
90
|
+
break;
|
|
91
|
+
case "stamfordadvocate.com":
|
|
92
|
+
subdomain = "h559";
|
|
93
|
+
break;
|
|
94
|
+
case "thehour.com":
|
|
95
|
+
subdomain = "f775";
|
|
96
|
+
break;
|
|
97
|
+
case "theintelligencer.com":
|
|
98
|
+
subdomain = "s232";
|
|
99
|
+
break;
|
|
100
|
+
case "theridgefieldpress.com":
|
|
101
|
+
subdomain = "y653";
|
|
102
|
+
break;
|
|
103
|
+
case "timesunion.com":
|
|
104
|
+
subdomain = "n730";
|
|
105
|
+
break;
|
|
106
|
+
case "trumbulltimes.com":
|
|
107
|
+
subdomain = "o398";
|
|
108
|
+
break;
|
|
109
|
+
case "westport-news.com":
|
|
110
|
+
subdomain = "c993";
|
|
111
|
+
break;
|
|
112
|
+
case "wiltonbulletin.com":
|
|
113
|
+
subdomain = "t570";
|
|
114
|
+
break;
|
|
115
|
+
case "yourconroenews.com":
|
|
116
|
+
subdomain = "z211";
|
|
117
|
+
break;
|
|
118
|
+
case "nhregister.com":
|
|
119
|
+
subdomain = "y738";
|
|
120
|
+
break;
|
|
121
|
+
case "statesman.com":
|
|
122
|
+
subdomain = "t235";
|
|
123
|
+
break;
|
|
48
124
|
}
|
|
49
|
-
|
|
125
|
+
|
|
50
126
|
// If we found a subdomain, swap in the new script
|
|
51
|
-
if (subdomain){
|
|
52
|
-
blueconicURL = `https://${subdomain}.${apex}/script.js
|
|
127
|
+
if (subdomain) {
|
|
128
|
+
blueconicURL = `https://${subdomain}.${apex}/script.js`;
|
|
53
129
|
}
|
|
54
130
|
|
|
55
|
-
return blueconicURL
|
|
56
|
-
}
|
|
131
|
+
return blueconicURL;
|
|
132
|
+
};
|
|
57
133
|
|
|
58
|
-
module.exports = { getBlueconic }
|
|
134
|
+
module.exports = { getBlueconic };
|
package/brands3.js
CHANGED
|
@@ -199,6 +199,23 @@ let getBrands3 = function (market) {
|
|
|
199
199
|
siteId: 20,
|
|
200
200
|
},
|
|
201
201
|
},
|
|
202
|
+
Austin: {
|
|
203
|
+
styles: {
|
|
204
|
+
"@brand": "#1665CF",
|
|
205
|
+
"@brand-secondary": "#303030",
|
|
206
|
+
},
|
|
207
|
+
attributes: {
|
|
208
|
+
marketPrefix: "statesman",
|
|
209
|
+
siteName: "Austin American-Statesman",
|
|
210
|
+
twitter: "statesman",
|
|
211
|
+
invert: true,
|
|
212
|
+
gaAccount: "UA-1616916-99",
|
|
213
|
+
subscribeLink: "https://subscription.statesman.com/checkout/",
|
|
214
|
+
sailCustomer: "fa8760dbd3762de6fd3247e7362c70af",
|
|
215
|
+
sailSiteName: "statesman",
|
|
216
|
+
siteId: 100,
|
|
217
|
+
},
|
|
218
|
+
},
|
|
202
219
|
/* Misc */
|
|
203
220
|
TK: {
|
|
204
221
|
styles: {
|
package/components/geocoder.mjs
CHANGED
|
@@ -216,7 +216,7 @@ function trackEvent(
|
|
|
216
216
|
|
|
217
217
|
if (window.dataLayer) {
|
|
218
218
|
// this is NOT an embed, so push to the dataLayer
|
|
219
|
-
const urlHash = window.HDN.dataLayer
|
|
219
|
+
const urlHash = window.HDN.dataLayer?.visit?.urlHash;
|
|
220
220
|
|
|
221
221
|
window.dataLayer.push({
|
|
222
222
|
event: event, //REQUIRED; Fixed value
|
|
@@ -121,6 +121,9 @@ const LayoutHelmet = ({
|
|
|
121
121
|
// TODO: Fill this in when the sites get swapped
|
|
122
122
|
} else if (MARKET_KEY === "Midcom") {
|
|
123
123
|
// TODO: Fill this in when the sites get swapped
|
|
124
|
+
} else if (MARKET_KEY === "Austin") {
|
|
125
|
+
favHref =
|
|
126
|
+
"https://www.statesman.com/sites/statesman/apple-touch-icon-196x196.png";
|
|
124
127
|
}
|
|
125
128
|
|
|
126
129
|
// Set section with fallback
|
package/example/gatsby-config.js
CHANGED
|
@@ -1,49 +1,55 @@
|
|
|
1
1
|
// Add SFC utils
|
|
2
2
|
const { getBrands3 } = require('../index')
|
|
3
3
|
const { getSettings } = require('./tempsettings')
|
|
4
|
-
const { DateTime } = require('luxon')
|
|
4
|
+
const { DateTime } = require('luxon')
|
|
5
5
|
|
|
6
6
|
let settings = getSettings()
|
|
7
7
|
|
|
8
8
|
let marketKeyArray = [
|
|
9
|
-
{
|
|
10
|
-
{
|
|
11
|
-
|
|
9
|
+
{ markets: ['SFC'], zone: 'America/Los_Angeles' },
|
|
10
|
+
{
|
|
11
|
+
markets: ['Houston', 'SanAntonio', 'Texcom', 'Austin'],
|
|
12
|
+
zone: 'America/Chicago',
|
|
13
|
+
},
|
|
14
|
+
{ markets: ['Albany', 'CT', 'Midcom'], zone: 'America/New_York' },
|
|
12
15
|
]
|
|
13
16
|
|
|
14
17
|
let currentZone
|
|
15
18
|
// Find the current market in the array
|
|
16
|
-
for (let region in marketKeyArray){
|
|
19
|
+
for (let region in marketKeyArray) {
|
|
17
20
|
let thisRegion = marketKeyArray[region]
|
|
18
|
-
if (thisRegion.markets.includes(settings.PROJECT.MARKET_KEY)){
|
|
21
|
+
if (thisRegion.markets.includes(settings.PROJECT.MARKET_KEY)) {
|
|
19
22
|
currentZone = thisRegion.zone
|
|
20
23
|
}
|
|
21
24
|
}
|
|
22
25
|
// If we don't have a match, that means we have an invalid market key
|
|
23
|
-
if (!currentZone){
|
|
24
|
-
console.error(
|
|
26
|
+
if (!currentZone) {
|
|
27
|
+
console.error(
|
|
28
|
+
'Invalid or undefined MARKET_KEY! See the _key_explainer in project-config to see valid values.'
|
|
29
|
+
)
|
|
25
30
|
process.exit(1)
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
// Create computer pub and mod dates
|
|
29
|
-
const dt = DateTime.fromFormat(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
{zone: currentZone}
|
|
33
|
-
)
|
|
34
|
+
const dt = DateTime.fromFormat(settings.PROJECT.DATE, 'MMMM d, y h:mm a', {
|
|
35
|
+
zone: currentZone,
|
|
36
|
+
})
|
|
34
37
|
// Convert date to computer-readable time
|
|
35
38
|
const computerPubDate = dt.toISO()
|
|
36
39
|
settings.PROJECT.ISO_PUBDATE = computerPubDate
|
|
37
40
|
|
|
38
41
|
// If MOD_DATE does not exist, set var to pubdate
|
|
39
|
-
let computerModDate =
|
|
40
|
-
if (
|
|
42
|
+
let computerModDate = ''
|
|
43
|
+
if (
|
|
44
|
+
typeof settings.PROJECT.MOD_DATE !== 'undefined' &&
|
|
45
|
+
settings.PROJECT.MOD_DATE
|
|
46
|
+
) {
|
|
41
47
|
const dt2 = DateTime.fromFormat(
|
|
42
48
|
settings.PROJECT.MOD_DATE,
|
|
43
49
|
'MMMM d, y h:mm a',
|
|
44
|
-
{zone: currentZone}
|
|
50
|
+
{ zone: currentZone }
|
|
45
51
|
)
|
|
46
|
-
|
|
52
|
+
computerModDate = dt2.toISO()
|
|
47
53
|
} else {
|
|
48
54
|
// Fallback to creation date
|
|
49
55
|
computerModDate = computerPubDate
|
|
@@ -56,9 +62,9 @@ console.log('Current environment: ' + currentEnv)
|
|
|
56
62
|
|
|
57
63
|
// Handle test prefix
|
|
58
64
|
// TODO: Once we embrace the new URL, we can delete this check and hardcode /projects
|
|
59
|
-
let projectsPrefix =
|
|
60
|
-
if (settings.PROJECT.SUBFOLDER.toString().indexOf(
|
|
61
|
-
projectsPrefix =
|
|
65
|
+
let projectsPrefix = ''
|
|
66
|
+
if (settings.PROJECT.SUBFOLDER.toString().indexOf('projects/') === 0) {
|
|
67
|
+
projectsPrefix = '/projects'
|
|
62
68
|
}
|
|
63
69
|
// Set the path prefix for the given deploy (ignored for dev)
|
|
64
70
|
let pathPrefix = '/projects/test-proj/' + settings.PROJECT.SLUG
|
|
@@ -115,17 +121,17 @@ let plugins = [
|
|
|
115
121
|
]
|
|
116
122
|
|
|
117
123
|
// Enable preact for the prod build
|
|
118
|
-
if (currentEnv !==
|
|
119
|
-
plugins.push(
|
|
124
|
+
if (currentEnv !== 'development') {
|
|
125
|
+
plugins.push('gatsby-plugin-preact')
|
|
120
126
|
}
|
|
121
127
|
|
|
122
128
|
// TK builds get weird redirect loops with htaccess plugin, so don't use it
|
|
123
|
-
if (settings.PROJECT.MARKET_KEY !==
|
|
124
|
-
plugins.push(
|
|
129
|
+
if (settings.PROJECT.MARKET_KEY !== 'TK') {
|
|
130
|
+
plugins.push('gatsby-plugin-htaccess')
|
|
125
131
|
}
|
|
126
132
|
|
|
127
133
|
module.exports = {
|
|
128
134
|
siteMetadata: settings,
|
|
129
135
|
pathPrefix: pathPrefix,
|
|
130
|
-
plugins: plugins
|
|
136
|
+
plugins: plugins,
|
|
131
137
|
}
|