@karpeleslab/klbfw 0.1.7 → 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 +2 -2
- package/package.json +1 -1
- package/rest.js +1 -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
|
@@ -43,7 +43,7 @@ function rest_url(path, with_token, context) {
|
|
|
43
43
|
if (fwWrapper.getCallUrlPrefix()) call_url = fwWrapper.getCallUrlPrefix() + call_url;
|
|
44
44
|
|
|
45
45
|
// copy context, proceed with overload then add to url
|
|
46
|
-
var ctx_final =
|
|
46
|
+
var ctx_final = fwWrapper.getContext();
|
|
47
47
|
for (var i in context) ctx_final[i] = context[i];
|
|
48
48
|
for (var i in ctx_final) {
|
|
49
49
|
if (i == "_") continue;
|
|
@@ -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
|
@@ -7,7 +7,7 @@ const fwWrapper = require('./fw-wrapper');
|
|
|
7
7
|
module.exports.rest = (name, verb, params, context) => {
|
|
8
8
|
if (typeof __platformAsyncRest !== "undefined") {
|
|
9
9
|
context = context || {};
|
|
10
|
-
var ctx_final =
|
|
10
|
+
var ctx_final = fwWrapper.getContext();
|
|
11
11
|
for (var i in context) ctx_final[i] = context[i];
|
|
12
12
|
return __platformAsyncRest(name, verb, params, ctx_final);
|
|
13
13
|
}
|