sfc-utils 1.4.105 → 1.4.107
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.
|
@@ -20,10 +20,15 @@ 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
|
+
// Add new md5 script
|
|
23
24
|
let script = document.createElement("script");
|
|
24
25
|
script.type = "text/javascript";
|
|
25
|
-
script.src = "https://
|
|
26
|
+
script.src = "https://projects.sfchronicle.com/shared/js/md5.js";
|
|
26
27
|
document.body.appendChild(script);
|
|
28
|
+
let script2 = document.createElement("script");
|
|
29
|
+
script2.type = "text/javascript";
|
|
30
|
+
script2.src = "https://nexus.ensighten.com/hearst/news/Bootstrap.js";
|
|
31
|
+
document.body.appendChild(script2);
|
|
27
32
|
} else {
|
|
28
33
|
let script = document.createElement("script");
|
|
29
34
|
script.type = "text/javascript";
|
package/package.json
CHANGED
package/personalize.js
CHANGED
|
@@ -12,7 +12,7 @@ const getProfileProperty = (property) => {
|
|
|
12
12
|
// Return a valid result or null
|
|
13
13
|
value = value || null;
|
|
14
14
|
console.log("getProfileProperty VAL", value);
|
|
15
|
-
innerResolve(value);
|
|
15
|
+
innerResolve({ existingValue: value, profile: profile });
|
|
16
16
|
});
|
|
17
17
|
} else {
|
|
18
18
|
attempts++;
|
|
@@ -41,15 +41,12 @@ const setProfileProperty = (property, value, merge = false) => {
|
|
|
41
41
|
if (window) {
|
|
42
42
|
if (window.blueConicClient) {
|
|
43
43
|
// Prepare merging (note: this only handles objects, not arrays or other types)
|
|
44
|
-
|
|
45
|
-
if (merge && typeof value === "object") {
|
|
46
|
-
conditionalPromise = getProfileProperty(property);
|
|
47
|
-
}
|
|
44
|
+
const thisPromise = getProfileProperty(property);
|
|
48
45
|
|
|
49
|
-
|
|
46
|
+
thisPromise.then(({ existingValue, profile }) => {
|
|
47
|
+
console.log("Output data", existingValue, profile);
|
|
50
48
|
// Finish merging
|
|
51
49
|
if (merge && typeof value === "object") {
|
|
52
|
-
console.log("Merging values...", JSON.parse(existingValue), value);
|
|
53
50
|
value = JSON.stringify(
|
|
54
51
|
Object.assign({}, JSON.parse(existingValue), value)
|
|
55
52
|
);
|
|
@@ -62,13 +59,9 @@ const setProfileProperty = (property, value, merge = false) => {
|
|
|
62
59
|
} else if (typeof value === "boolean" || typeof value === "number") {
|
|
63
60
|
value = value.toString();
|
|
64
61
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
profile.loadValues(properties, this, function () {
|
|
69
|
-
profile.setValue(property, value);
|
|
70
|
-
resolve(true);
|
|
71
|
-
});
|
|
62
|
+
// Profile is already loaded from the getProfileProperty call
|
|
63
|
+
profile.setValue(property, value);
|
|
64
|
+
resolve(true);
|
|
72
65
|
});
|
|
73
66
|
} else {
|
|
74
67
|
resolve("Personalize: No BlueConic client found");
|