Skip to content

Commit c1895d4

Browse files
committed
Update underlying packages for Olark, Crisp, Tawkto, and Hotjar
1 parent 0605d86 commit c1895d4

File tree

3 files changed

+88
-1027
lines changed

3 files changed

+88
-1027
lines changed

gatsby-config.js

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// loading env
2-
const activeEnv = process.env.NODE_ENV || 'development'
3-
console.log(`Using environment config: '${activeEnv}'`)
2+
const activeEnv = process.env.NODE_ENV || "development";
3+
console.log(`Using environment config: '${activeEnv}'`);
44
require("dotenv").config({
55
path: `.env.${activeEnv}`,
6-
})
6+
});
77

88
let siteConfig;
99
let wordpressConfig;
@@ -16,11 +16,16 @@ try {
1616
}
1717

1818
console.log(typeof process.env.WP_HOSTING_WPCOM);
19-
const hostingWPCOM = process.env.WP_HOSTING_WPCOM && process.env.WP_HOSTING_WPCOM === "true" ? true: false;
19+
const hostingWPCOM =
20+
process.env.WP_HOSTING_WPCOM && process.env.WP_HOSTING_WPCOM === "true"
21+
? true
22+
: false;
2023

2124
if (process.env.WP_BASE_URL) {
22-
wordpressConfig.baseUrl = process.env.WP_BASE_URL;
23-
wordpressConfig.protocol = process.env.WP_PROTOCOL ? process.env.WP_PROTOCOL : "https";
25+
wordpressConfig.baseUrl = process.env.WP_BASE_URL;
26+
wordpressConfig.protocol = process.env.WP_PROTOCOL
27+
? process.env.WP_PROTOCOL
28+
: "https";
2429
if (hostingWPCOM) {
2530
wordpressConfig.hostingWPCOM = true;
2631
wordpressConfig.auth = {};
@@ -68,23 +73,24 @@ if (process.env.GA) {
6873
}
6974

7075
if (process.env.GATSBY_MIXPANEL_TOKEN) {
71-
gatsbyPlugins.unshift({
76+
gatsbyPlugins.push({
7277
resolve: `gatsby-plugin-mixpanel`,
7378
options: {
7479
apiToken: process.env.GATSBY_MIXPANEL_TOKEN,
7580
enableOnDevMode: true,
76-
pageViews: 'all'
81+
pageViews: "all",
7782
},
7883
});
7984
}
8085

8186
if (process.env.GATSBY_HOTJAR_ID) {
82-
gatsbyPlugins.unshift({
83-
resolve: `gatsby-plugin-hotjar`,
87+
gatsbyPlugins.push({
88+
resolve: `@draftbox-co/gatsby-plugin-hotjar-lazy`,
8489
options: {
8590
id: process.env.GATSBY_HOTJAR_ID,
86-
sv: 6
87-
}
91+
sv: 6,
92+
optimize: true,
93+
},
8894
});
8995
}
9096

@@ -93,36 +99,39 @@ if (process.env.GATSBY_GTAG_MANAGER_ID) {
9399
resolve: `gatsby-plugin-google-tagmanager`,
94100
options: {
95101
id: process.env.GATSBY_GTAG_MANAGER_ID,
96-
includeInDevelopment: true
102+
includeInDevelopment: true,
97103
},
98104
});
99105
}
100106

101107
if (process.env.GATSBY_TAWK_ID) {
102-
gatsbyPlugins.unshift({
103-
resolve: `gatsby-plugin-tawk`,
108+
gatsbyPlugins.push({
109+
resolve: `@draftbox-co/gatsby-plugin-tawk-lazy`,
104110
options: {
105111
tawkId: process.env.GATSBY_TAWK_ID,
106-
}
112+
optimize: true,
113+
},
107114
});
108115
}
109116

110117
if (process.env.GATSBY_CRISP_ID) {
111-
gatsbyPlugins.unshift({
112-
resolve: `gatsby-plugin-crisp-chat`,
118+
gatsbyPlugins.push({
119+
resolve: `@draftbox-co/gatsby-plugin-crisp-chat-lazy`,
113120
options: {
114121
websiteId: process.env.GATSBY_CRISP_ID,
115-
enableDuringDevelop: true
116-
}
122+
enableDuringDevelop: true,
123+
optimize: true,
124+
},
117125
});
118126
}
119127

120128
if (process.env.GATSBY_OLARK_ID) {
121-
gatsbyPlugins.unshift({
122-
resolve: `gatsby-plugin-olark`,
129+
gatsbyPlugins.push({
130+
resolve: `@draftbox-co/gatsby-plugin-olark-lazy`,
123131
options: {
124132
olarkSiteID: process.env.GATSBY_OLARK_ID,
125-
}
133+
optimize: true,
134+
},
126135
});
127136
}
128137

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818
"@draftbox-co/gatsby-wordpress-theme-libre": "^1.0.40",
1919
"dotenv": "^8.2.0",
2020
"gatsby": "2.20.24",
21-
"gatsby-plugin-crisp-chat": "^3.2.2",
2221
"gatsby-plugin-disqus": "^1.1.4",
2322
"gatsby-plugin-google-analytics": "^2.2.2",
2423
"gatsby-plugin-google-tagmanager": "^2.3.5",
25-
"gatsby-plugin-hotjar": "^1.0.1",
24+
"@draftbox-co/gatsby-plugin-crisp-chat-lazy": "^0.0.3",
25+
"@draftbox-co/gatsby-plugin-hotjar-lazy": "^0.0.1",
26+
"@draftbox-co/gatsby-plugin-olark-lazy": "^0.0.1",
27+
"@draftbox-co/gatsby-plugin-tawk-lazy": "^0.0.1",
2628
"gatsby-plugin-mailchimp": "^5.1.2",
2729
"gatsby-plugin-mixpanel": "^3.1.6",
28-
"gatsby-plugin-olark": "^1.0.0",
2930
"gatsby-plugin-segment-js": "^3.1.0",
30-
"gatsby-plugin-tawk": "^1.0.0",
3131
"react": "^16.13.0",
3232
"react-dom": "^16.13.0",
3333
"react-facebook": "^8.1.4"

0 commit comments

Comments
 (0)