sfc-utils 1.4.85 → 1.4.86
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 +35 -0
package/package.json
CHANGED
package/personalize.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//
|
|
2
|
+
// NOTE: This will only work on a deployed URL!
|
|
3
|
+
const getProfileProperty = (property) => {
|
|
4
|
+
if (window) {
|
|
5
|
+
if (window.blueConicClient) {
|
|
6
|
+
const profile = window.blueConicClient.profile.getProfile();
|
|
7
|
+
const properties = [property];
|
|
8
|
+
profile.loadValues(properties, this, function () {
|
|
9
|
+
var value = profile.getValue(property);
|
|
10
|
+
// Return a valid result or null
|
|
11
|
+
value = value || null;
|
|
12
|
+
return value;
|
|
13
|
+
});
|
|
14
|
+
} else {
|
|
15
|
+
return "Personalize: No BlueConic client found";
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const setProfileProperty = (property, value) => {
|
|
21
|
+
if (window) {
|
|
22
|
+
if (window.blueConicClient) {
|
|
23
|
+
const profile = window.blueConicClient.profile.getProfile();
|
|
24
|
+
const properties = [property];
|
|
25
|
+
profile.loadValues(properties, this, function () {
|
|
26
|
+
profile.setValue(property, value);
|
|
27
|
+
return true;
|
|
28
|
+
});
|
|
29
|
+
} else {
|
|
30
|
+
return "Personalize: No BlueConic client found";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
module.exports = { getProfileProperty, setProfileProperty };
|