@karpeleslab/klbfw 0.1.5 → 0.1.8
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/fw-wrapper.js +1 -1
- package/internal.js +1 -1
- package/package.json +1 -1
- package/rest.js +5 -1
package/fw-wrapper.js
CHANGED
|
@@ -5,7 +5,7 @@ module.exports.getLocale = () => (typeof FW !== "undefined") ? FW.Locale : "en-U
|
|
|
5
5
|
module.exports.getPath = () => (typeof FW !== "undefined") ? FW.path : window.location.pathname;
|
|
6
6
|
module.exports.getHostname = () => (typeof FW !== "undefined") ? FW.hostname : window.location.hostname;
|
|
7
7
|
module.exports.getCurrency = () => (typeof FW !== "undefined") ? FW.Context.c : "USD";
|
|
8
|
-
module.exports.getContext = () => (typeof FW !== "undefined") ? FW.Context : {};
|
|
8
|
+
module.exports.getContext = () => (typeof FW !== "undefined") ? Object.assign({}, FW.Context) : {};
|
|
9
9
|
module.exports.setContext = (k, v) => { if (typeof FW !== "undefined") FW.Context[k] = v; };
|
|
10
10
|
module.exports.getToken = () => (typeof FW !== "undefined") ? FW.token : undefined;
|
|
11
11
|
module.exports.getRegistry = () => (typeof FW !== "undefined") ? FW.Registry : undefined;
|
package/internal.js
CHANGED
|
@@ -132,7 +132,7 @@ function responseParse(response, resolve, reject) {
|
|
|
132
132
|
function (json) {
|
|
133
133
|
// check for gtag
|
|
134
134
|
if ((json.gtag) && (typeof window !== "undefined") && (window.gtag)) {
|
|
135
|
-
json.gtag.map((item)
|
|
135
|
+
json.gtag.map(function (item) { window.gtag.apply(null, item); });
|
|
136
136
|
}
|
|
137
137
|
// check for result
|
|
138
138
|
if (json.result != "success" && json.result != "redirect") {
|
package/package.json
CHANGED
package/rest.js
CHANGED
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
// vim: et:ts=4:sw=4
|
|
3
3
|
|
|
4
4
|
const internal = require('./internal');
|
|
5
|
+
const fwWrapper = require('./fw-wrapper');
|
|
5
6
|
|
|
6
7
|
module.exports.rest = (name, verb, params, context) => {
|
|
7
8
|
if (typeof __platformAsyncRest !== "undefined") {
|
|
8
|
-
|
|
9
|
+
context = context || {};
|
|
10
|
+
var ctx_final = fwWrapper.getContext();
|
|
11
|
+
for (var i in context) ctx_final[i] = context[i];
|
|
12
|
+
return __platformAsyncRest(name, verb, params, ctx_final);
|
|
9
13
|
}
|
|
10
14
|
if (typeof __platformRest !== "undefined") {
|
|
11
15
|
// direct SSR-mode call to rest api
|