@nuskin/ns-util 4.3.4 → 4.4.1
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/src/googleMapsAPILoader.js +19 -13
- package/src/nuskin.util.js +1 -1
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {getConfiguration} from "@nuskin/configuration-sdk";
|
|
2
2
|
import URLService from "./urlService";
|
|
3
3
|
|
|
4
4
|
const GOOGLE_MAPS_API_URL = "https://maps.googleapis.com/maps/api/js";
|
|
@@ -29,18 +29,24 @@ export default {
|
|
|
29
29
|
function load() {
|
|
30
30
|
if (!apiLoadingPromise) {
|
|
31
31
|
apiLoadingPromise = new Promise((resolve, reject) => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
32
|
+
getConfiguration(['Url'])
|
|
33
|
+
.then(({Url: urlCfg}) => {
|
|
34
|
+
const $script = document.createElement("script");
|
|
35
|
+
$script.setAttribute("type", "text/javascript");
|
|
36
|
+
$script.setAttribute("async", "true");
|
|
37
|
+
$script.onload = () => resolve();
|
|
38
|
+
$script.onerror = () =>
|
|
39
|
+
reject(new Error("Google Maps API script failed to load"));
|
|
40
|
+
const src = `${GOOGLE_MAPS_API_URL}?${URLService.toQueryString({
|
|
41
|
+
key: urlCfg.googleMapsApiKey,
|
|
42
|
+
libraries: ["places"]
|
|
43
|
+
})}`;
|
|
44
|
+
$script.setAttribute("src", src);
|
|
45
|
+
document.body.appendChild($script);
|
|
46
|
+
})
|
|
47
|
+
.catch((err) => {
|
|
48
|
+
reject(new Error(err));
|
|
49
|
+
});
|
|
44
50
|
});
|
|
45
51
|
}
|
|
46
52
|
return apiLoadingPromise;
|
package/src/nuskin.util.js
CHANGED
|
@@ -75,7 +75,7 @@ function Initializer() {
|
|
|
75
75
|
initFunctions[x].initFunction();
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
equinoxLocalStorage.setLocalStorageFlag()
|
|
79
79
|
console.log("Initialized system");
|
|
80
80
|
};
|
|
81
81
|
|