sfc-utils 1.4.106 → 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.
- package/package.json +1 -1
- package/personalize.js +7 -14
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");
|