sfc-utils 1.4.166 → 1.4.168
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,7 +1,7 @@
|
|
|
1
1
|
import { getBlueconic } from "../../blueconic";
|
|
2
2
|
import { getBrands3 } from "../../brands3";
|
|
3
3
|
import { appCheck, blendHDN, getSettings } from "../../index";
|
|
4
|
-
import systemSettings from "../../../../src/data/system_settings.sheet.json";
|
|
4
|
+
import systemSettings from "../../../../src/data/system_settings.sheet.json";
|
|
5
5
|
|
|
6
6
|
const currentEnv = process.env.GATSBY_DEPLOY_ENV;
|
|
7
7
|
|
|
@@ -202,11 +202,9 @@ function trackEvent(
|
|
|
202
202
|
elementContent = null,
|
|
203
203
|
elementText = null
|
|
204
204
|
) {
|
|
205
|
-
console.log(systemSettings);
|
|
206
205
|
const storySettings = getSettings();
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
const elementVariant = `${systemSettings.Repo}|${systemSettings.Project_Type}`;
|
|
206
|
+
const systemSettingsObj = systemSettings[0];
|
|
207
|
+
const elementVariant = `${systemSettingsObj.Repo}|${systemSettingsObj.Project_Type}`;
|
|
210
208
|
const linkUrl = `${storySettings.PROJECT.SUBFOLDER}/${storySettings.PROJECT.SLUG}`;
|
|
211
209
|
const urlHash = window.HDN.dataLayer.visit.urlHash;
|
|
212
210
|
|
|
@@ -234,4 +232,53 @@ function trackEvent(
|
|
|
234
232
|
});
|
|
235
233
|
}
|
|
236
234
|
|
|
237
|
-
|
|
235
|
+
const trackEmbedEvent = (
|
|
236
|
+
eventType,
|
|
237
|
+
elementName = null,
|
|
238
|
+
elementContent = null,
|
|
239
|
+
elementText = null
|
|
240
|
+
) => {
|
|
241
|
+
const storySettings = getSettings();
|
|
242
|
+
const systemSettingsObj = systemSettings[0];
|
|
243
|
+
const elementVariant = `${systemSettingsObj.Repo}|${systemSettingsObj.Project_Type}`;
|
|
244
|
+
const linkUrl = `${storySettings.Year}/${storySettings.Slug}`;
|
|
245
|
+
|
|
246
|
+
let event;
|
|
247
|
+
if (eventType === "Click") {
|
|
248
|
+
event = "hnp_click";
|
|
249
|
+
} else if (eventType === "Impression") {
|
|
250
|
+
event = "hnp_impression";
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
var embed_event = {
|
|
254
|
+
event: event, //REQUIRED; Fixed value
|
|
255
|
+
element_name: elementName, //REQUIRED; One of a list of tags/types of elements on the page (e.g. Button, Map, Tooltip, ToggleButton, Dropdown). TO DO: create a consistent list of this
|
|
256
|
+
element_content: elementContent, //REQUIRED; One of a list of subtypes of element types (e.g. Button) on the page (e.g. Geocoder, Searchbar, Prev/Next). TO DO: create a consistent list of this, maybe
|
|
257
|
+
element_variant: elementVariant, //REQUIRED; Template type (e.g. custom-repo-name|gatsby) (top-list|plat)
|
|
258
|
+
element_text: elementText, //REQUIRED; What was the actual text or alt-text of the thing that was clicked (InnerHTML or id specific to that element)
|
|
259
|
+
component_type: null, //OPTIONAL; If BC components uses Storybook components: Organism or molecule from storybook (whatever the highest level component from storybook that the clicked on item belongs to)
|
|
260
|
+
component_subtype: null, //OPTIONAL; If BC components uses Storybook components: Variant of the component_type from storybook
|
|
261
|
+
component_detail: null, //OPTIONAL; If BC components uses Storybook components: WCM TITLE|Position|Atom from storybook. This pipe-delimited structure is required. When values are not available for a given position, leave the position blank so the order of information doesn't change. e.g. something|| or something||something_else
|
|
262
|
+
zone: null, // OPTIONAL; For WCM components. The WCM zone the component was displayed in.
|
|
263
|
+
link_url: linkUrl, //REQUIRED; What is the slug of the project?
|
|
264
|
+
outbound: false, //REQUIRED; Boolean indicating whether the link that was clicked took the user to a different domain.
|
|
265
|
+
source_system: "devhub", //REQUIRED; What platform powered the element? One of cookie, blueconic, realm, castle, devhub, treg, legacy obits, sailthru, casper, wordpress, hnp-jwplayer, event_data_service (other options required discussion with BI/DE)
|
|
266
|
+
iframe_event: true,
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
if (typeof window !== "undefined") {
|
|
270
|
+
window.parent.postMessage(embed_event, "*"); // Sends event to parent page
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
//TO TEST: I think this needs to go directly into the iframe embed code?
|
|
274
|
+
//window.addEventListener("message", (message) => {if (message.data.iframe_event) {var event = message.data;dataLayer.push(event);}});
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
export {
|
|
278
|
+
debounce,
|
|
279
|
+
appendLayoutScripts,
|
|
280
|
+
formatHDN,
|
|
281
|
+
getFigureWidth,
|
|
282
|
+
trackEvent,
|
|
283
|
+
trackEmbedEvent,
|
|
284
|
+
};
|
package/copy/sheets.js
CHANGED
|
@@ -166,6 +166,10 @@ const processSheetData = async (
|
|
|
166
166
|
majorDimension: "ROWS",
|
|
167
167
|
});
|
|
168
168
|
var { values } = response.data;
|
|
169
|
+
if (!values || !values.length) {
|
|
170
|
+
console.log("No data found in sheet", sheet.properties.title);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
169
173
|
var header = values.shift();
|
|
170
174
|
var swapIndexes = [];
|
|
171
175
|
console.log("Swap type:", typeof languageSwap);
|