sfc-utils 1.4.91 → 1.4.92
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 +28 -13
package/package.json
CHANGED
package/personalize.js
CHANGED
|
@@ -2,19 +2,34 @@
|
|
|
2
2
|
const getProfileProperty = (property) => {
|
|
3
3
|
return new Promise((resolve, reject) => {
|
|
4
4
|
if (window) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
let attempts = 0;
|
|
6
|
+
const checkForBlueConic = (innerResolve) => {
|
|
7
|
+
if (window.blueConicClient) {
|
|
8
|
+
const profile = window.blueConicClient.profile.getProfile();
|
|
9
|
+
const properties = [property];
|
|
10
|
+
profile.loadValues(properties, this, function () {
|
|
11
|
+
var value = profile.getValue(property);
|
|
12
|
+
// Return a valid result or null
|
|
13
|
+
value = value || null;
|
|
14
|
+
console.log("getProfileProperty VAL", value);
|
|
15
|
+
innerResolve(value);
|
|
16
|
+
});
|
|
17
|
+
} else {
|
|
18
|
+
attempts++;
|
|
19
|
+
if (attempts < 20) {
|
|
20
|
+
// Check for BlueConic every second
|
|
21
|
+
setTimeout(() => {
|
|
22
|
+
checkForBlueConic(innerResolve);
|
|
23
|
+
}, 1000);
|
|
24
|
+
} else {
|
|
25
|
+
innerResolve(
|
|
26
|
+
"Personalize: No BlueConic client found after many attempts"
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
// Kick off check
|
|
32
|
+
checkForBlueConic(resolve);
|
|
18
33
|
} else {
|
|
19
34
|
resolve("Personalize: No window found");
|
|
20
35
|
}
|