sfc-utils 1.3.25 → 1.3.26
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/accountswap.js +3 -2
- package/css/nav2.less +1 -1
- package/example/.prettierrc +5 -0
- package/example/README.md +8 -0
- package/example/gatsby-config.js +131 -0
- package/example/gatsby-node.js +45 -0
- package/example/package-lock.json +13418 -0
- package/example/package.json +71 -0
- package/example/project-config.json +42 -0
- package/example/src/components/layout.js +236 -0
- package/example/src/components/sfc/ad.js +47 -0
- package/example/src/components/sfc/ai2html/ai2html_template.ai +1369 -4
- package/example/src/components/sfc/button.js +40 -0
- package/example/src/components/sfc/byline.js +42 -0
- package/example/src/components/sfc/component-helpers/customhooks.js +17 -0
- package/example/src/components/sfc/component-helpers/datehelpers.js +55 -0
- package/example/src/components/sfc/component-helpers/newsletterhelpers.js +89 -0
- package/example/src/components/sfc/component-helpers/requesthelpers.js +7 -0
- package/example/src/components/sfc/component-helpers/scrolldownhelpers.js +11 -0
- package/example/src/components/sfc/component-helpers/utilfunctions.js +68 -0
- package/example/src/components/sfc/creditline.js +35 -0
- package/example/src/components/sfc/credits.js +17 -0
- package/example/src/components/sfc/creditssection.js +47 -0
- package/example/src/components/sfc/dropcap.js +15 -0
- package/example/src/components/sfc/footer.js +36 -0
- package/example/src/components/sfc/geocoder.js +148 -0
- package/example/src/components/sfc/misccredit.js +17 -0
- package/example/src/components/sfc/navtop.js +121 -0
- package/example/src/components/sfc/newsletter.js +157 -0
- package/example/src/components/sfc/relatedlink.js +23 -0
- package/example/src/components/sfc/relatedrow.js +23 -0
- package/example/src/components/sfc/relatedsection.js +27 -0
- package/example/src/components/sfc/safelink.js +86 -0
- package/example/src/components/sfc/scrolldown.js +22 -0
- package/example/src/components/sfc/sharebuttons.js +93 -0
- package/example/src/components/sfc/topper.js +88 -0
- package/example/src/components/sfc/video.js +74 -0
- package/example/src/components/sfc/wcmimage.js +131 -0
- package/example/src/data/sfc/images/react.gif +0 -0
- package/example/src/data/sfc/related_links.json +17 -0
- package/example/src/html.js +41 -0
- package/example/src/pages/index.js +143 -0
- package/example/src/styles/defaults.less +99 -0
- package/example/src/styles/footer.less +345 -0
- package/example/src/styles/modules/ad.module.less +21 -0
- package/example/src/styles/modules/ai2html.module.less +19 -0
- package/example/src/styles/modules/button.module.less +94 -0
- package/example/src/styles/modules/byline.module.less +11 -0
- package/example/src/styles/modules/creditline.module.less +12 -0
- package/example/src/styles/modules/credits.module.less +7 -0
- package/example/src/styles/modules/creditssection.module.less +17 -0
- package/example/src/styles/modules/dropcap.module.less +18 -0
- package/example/src/styles/modules/geocoder.module.less +79 -0
- package/example/src/styles/modules/newsletter.module.less +147 -0
- package/example/src/styles/modules/relatedlink.module.less +28 -0
- package/example/src/styles/modules/relatedrow.module.less +8 -0
- package/example/src/styles/modules/relatedsection.module.less +19 -0
- package/example/src/styles/modules/scrolldown.module.less +31 -0
- package/example/src/styles/modules/share.module.less +22 -0
- package/example/src/styles/modules/topper.module.less +63 -0
- package/example/src/styles/modules/video.module.less +27 -0
- package/example/src/styles/modules/wcmimage.module.less +20 -0
- package/example/src/styles/nav.less +187 -0
- package/example/src/styles/project.less +1 -0
- package/example/src/styles/reset.css +95 -0
- package/example/src/styles/seed.less +5 -0
- package/example/src/styles/typography.css +168 -0
- package/example/src/styles/values.less +74 -0
- package/example/static/manifest.webmanifest +1 -0
- package/example/tasks/create-c2p-sheet.js +6 -0
- package/example/tasks/deploy-addon.py +14 -0
- package/example/tasks/google-docs.js +16 -0
- package/example/tasks/google-sheets.js +17 -0
- package/example/tasks/node-helpers.js +81 -0
- package/example/tasks/post-build.sh +7 -0
- package/example/tasks/pre-build.sh +18 -0
- package/example/tempsettings.js +28 -0
- package/package.json +1 -1
- package/settings.js +1 -1
package/accountswap.js
CHANGED
|
@@ -12,9 +12,10 @@ const pollForAccount = function(i){
|
|
|
12
12
|
if (window && window.treg && window.treg.identity && window.treg.identity.id){
|
|
13
13
|
// We got a valid entitlement! Let's see if the button exists and swap our new one in
|
|
14
14
|
const subButton = document.querySelector('#nav2-sub-box')
|
|
15
|
+
const subButtonText = subButton.querySelector('div')
|
|
15
16
|
if (subButton){
|
|
16
17
|
subButton.setAttribute("href", accountURL)
|
|
17
|
-
|
|
18
|
+
subButtonText.innerText = "Account"
|
|
18
19
|
}
|
|
19
20
|
} else {
|
|
20
21
|
if (i > 10){
|
|
@@ -26,4 +27,4 @@ const pollForAccount = function(i){
|
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
module.exports = { pollForAccount }
|
|
30
|
+
module.exports = { pollForAccount }
|
package/css/nav2.less
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# {%= app_slug %}
|
|
2
|
+
|
|
3
|
+
{%= github_desc %}
|
|
4
|
+
|
|
5
|
+
View the live project: [{%= project_url %}]({%= project_url %})
|
|
6
|
+
|
|
7
|
+
This project was built with the SFC Newsapp template. For instructions on how to use this template, refer to [the template README](https://github.com/sfchronicle/gatsby-newsapp))
|
|
8
|
+
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// Add SFC utils
|
|
2
|
+
const { getBrands, getNav, getFooter } = require('../index')
|
|
3
|
+
const { getSettings } = require('./tempsettings')
|
|
4
|
+
const { DateTime } = require('luxon');
|
|
5
|
+
|
|
6
|
+
let settings = getSettings()
|
|
7
|
+
|
|
8
|
+
let marketKeyArray = [
|
|
9
|
+
{"markets": ["SFC"], "zone": "America/Los_Angeles"},
|
|
10
|
+
{"markets": ["Houston","SanAntonio","Texcom"], "zone": "America/Chicago"},
|
|
11
|
+
{"markets": ["Albany","CT","Midcom"], "zone": "America/New_York"},
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
let currentZone
|
|
15
|
+
// Find the current market in the array
|
|
16
|
+
for (let region in marketKeyArray){
|
|
17
|
+
let thisRegion = marketKeyArray[region]
|
|
18
|
+
if (thisRegion.markets.includes(settings.PROJECT.MARKET_KEY)){
|
|
19
|
+
currentZone = thisRegion.zone
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
// If we don't have a match, that means we have an invalid market key
|
|
23
|
+
if (!currentZone){
|
|
24
|
+
console.error("Invalid or undefined MARKET_KEY! See the _key_explainer in project-config to see valid values.")
|
|
25
|
+
process.exit(1)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Create computer pub and mod dates
|
|
29
|
+
const dt = DateTime.fromFormat(
|
|
30
|
+
settings.PROJECT.DATE,
|
|
31
|
+
'MMMM d, y h:mm a',
|
|
32
|
+
{zone: currentZone}
|
|
33
|
+
)
|
|
34
|
+
// Convert date to computer-readable time
|
|
35
|
+
const computerPubDate = dt.toISO()
|
|
36
|
+
settings.PROJECT.ISO_PUBDATE = computerPubDate
|
|
37
|
+
|
|
38
|
+
// If MOD_DATE does not exist, set var to pubdate
|
|
39
|
+
let computerModDate = ""
|
|
40
|
+
if (typeof settings.PROJECT.MOD_DATE !== 'undefined' && settings.PROJECT.MOD_DATE) {
|
|
41
|
+
const dt2 = DateTime.fromFormat(
|
|
42
|
+
settings.PROJECT.MOD_DATE,
|
|
43
|
+
'MMMM d, y h:mm a',
|
|
44
|
+
{zone: currentZone}
|
|
45
|
+
)
|
|
46
|
+
computerModDate = dt2.toISO()
|
|
47
|
+
} else {
|
|
48
|
+
// Fallback to creation date
|
|
49
|
+
computerModDate = computerPubDate
|
|
50
|
+
}
|
|
51
|
+
settings.PROJECT.ISO_MODDATE = computerModDate
|
|
52
|
+
|
|
53
|
+
//Set get the current env var
|
|
54
|
+
const currentEnv = process.env.GATSBY_DEPLOY_ENV
|
|
55
|
+
console.log('Current environment: ' + currentEnv)
|
|
56
|
+
|
|
57
|
+
// Handle test prefix
|
|
58
|
+
// 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("projects/") === 0){
|
|
61
|
+
projectsPrefix = "/projects"
|
|
62
|
+
}
|
|
63
|
+
// Set the path prefix for the given deploy (ignored for dev)
|
|
64
|
+
let pathPrefix = '/projects/test-proj/' + settings.PROJECT.SLUG
|
|
65
|
+
if (currentEnv === 'development') {
|
|
66
|
+
pathPrefix = '/'
|
|
67
|
+
}
|
|
68
|
+
if (currentEnv === 'app') {
|
|
69
|
+
pathPrefix = projectsPrefix + '/app/' + settings.PROJECT.SLUG
|
|
70
|
+
}
|
|
71
|
+
if (currentEnv === 'production') {
|
|
72
|
+
pathPrefix =
|
|
73
|
+
'/' +
|
|
74
|
+
settings.PROJECT.SUBFOLDER +
|
|
75
|
+
settings.PROJECT.OPT_SLASH +
|
|
76
|
+
settings.PROJECT.SLUG
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let plugins = [
|
|
80
|
+
'gatsby-plugin-react-helmet',
|
|
81
|
+
'gatsby-transformer-json',
|
|
82
|
+
{
|
|
83
|
+
resolve: 'gatsby-plugin-less',
|
|
84
|
+
options: {
|
|
85
|
+
lessOptions: {
|
|
86
|
+
modifyVars: getBrands(settings.PROJECT.MARKET_KEY).styles,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
resolve: 'gatsby-plugin-html-attributes',
|
|
92
|
+
options: {
|
|
93
|
+
lang: 'en',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
resolve: `gatsby-source-filesystem`,
|
|
98
|
+
options: {
|
|
99
|
+
name: `projectData`,
|
|
100
|
+
path: `${__dirname}/src/data/`,
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
resolve: 'gatsby-plugin-webpack-bundle-analyser-v2',
|
|
105
|
+
options: {
|
|
106
|
+
production: true,
|
|
107
|
+
disable: !process.env.ANALYZE_BUNDLE_SIZE,
|
|
108
|
+
generateStatsFile: true,
|
|
109
|
+
analyzerMode: 'static',
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
// this (optional) plugin enables Progressive Web App + Offline functionality
|
|
113
|
+
// To learn more, visit: https://gatsby.app/offline
|
|
114
|
+
// 'gatsby-plugin-offline',
|
|
115
|
+
]
|
|
116
|
+
|
|
117
|
+
// Enable preact for the prod build
|
|
118
|
+
if (currentEnv !== "development"){
|
|
119
|
+
plugins.push("gatsby-plugin-preact")
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// TK builds get weird redirect loops with htaccess plugin, so don't use it
|
|
123
|
+
if (settings.PROJECT.MARKET_KEY !== "TK"){
|
|
124
|
+
plugins.push("gatsby-plugin-htaccess")
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
module.exports = {
|
|
128
|
+
siteMetadata: settings,
|
|
129
|
+
pathPrefix: pathPrefix,
|
|
130
|
+
plugins: plugins
|
|
131
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implement Gatsby's Node APIs in this file.
|
|
3
|
+
*
|
|
4
|
+
* See: https://www.gatsbyjs.org/docs/node-apis/
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
var {requestImage} = require("./tasks/node-helpers");
|
|
8
|
+
|
|
9
|
+
// Import all the WCM photos you'd like to use in this project
|
|
10
|
+
// NOTE: Leave this as an empty array if you aren't importing any WCM photos, but you won't be able to use the WCMImage component
|
|
11
|
+
const wcmPhotos = [20374215]
|
|
12
|
+
|
|
13
|
+
// Create nodes so GraphQL can access
|
|
14
|
+
exports.sourceNodes = async ({
|
|
15
|
+
actions,
|
|
16
|
+
createNodeId,
|
|
17
|
+
createContentDigest,
|
|
18
|
+
}) => {
|
|
19
|
+
const { createNode } = actions
|
|
20
|
+
|
|
21
|
+
// Request and push photo data into an array
|
|
22
|
+
const photoData = [];
|
|
23
|
+
wcmPhotos.forEach((url) => {
|
|
24
|
+
photoData.push(requestImage(url))
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
// Take the ratios/ids turn them into graphql nodes
|
|
28
|
+
await Promise.all(photoData).then((values) => {
|
|
29
|
+
values.forEach((photo) => {
|
|
30
|
+
const type = "wcmPhotos";
|
|
31
|
+
createNode({
|
|
32
|
+
photo,
|
|
33
|
+
id: createNodeId(`${type}${photo.wcmid}`),
|
|
34
|
+
parent: null,
|
|
35
|
+
children: [],
|
|
36
|
+
internal: {
|
|
37
|
+
contentDigest: createContentDigest(photo),
|
|
38
|
+
type,
|
|
39
|
+
},
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
return
|
|
43
|
+
})
|
|
44
|
+
return
|
|
45
|
+
}
|