kameleoon-client-javascript
Advanced tools
Comparing version 2.1.0 to 2.1.1
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.HttpMethod = void 0; | ||
var node_fetch_1 = __importStar(require("node-fetch")); | ||
var constants_1 = require("./constants"); | ||
var VERSION = "2.1.0"; | ||
var VERSION = "2.1.1"; | ||
var KameleoonUtils = /** @class */ (function () { | ||
@@ -34,14 +54,20 @@ function KameleoonUtils() { | ||
else { | ||
var xhr_1 = new XMLHttpRequest(); | ||
xhr_1.onreadystatechange = function () { | ||
if (xhr_1.readyState === 4) { | ||
callback && callback(xhr_1.response); | ||
} | ||
}; | ||
xhr_1.open(method, url, true); | ||
xhr_1.setRequestHeader("content-type", "application/x-www-form-urlencoded"); | ||
addKameleoonClientHeader && | ||
xhr_1.setRequestHeader("Kameleoon-Client", "sdk/js/" + VERSION); | ||
userAgent && xhr_1.setRequestHeader("User-Agent", userAgent.value); | ||
xhr_1.send(data ? data : null); | ||
var headers = new node_fetch_1.Headers({ | ||
"Content-Type": "application/x-www-form-urlencoded", | ||
}); | ||
if (addKameleoonClientHeader) { | ||
headers.append("Kameleoon-Client", "sdk/js/".concat(VERSION)); | ||
} | ||
if (userAgent) { | ||
headers.append("User-Agent", userAgent.value); | ||
} | ||
var eventRequest = new node_fetch_1.Request(url, { | ||
method: method, | ||
body: data !== null && data !== void 0 ? data : null, | ||
headers: headers, | ||
}); | ||
(0, node_fetch_1.default)(eventRequest) | ||
.then(function (response) { return response.text(); }) | ||
.then(function (responseText) { return callback && callback(responseText); }) | ||
.catch(function (err) { return console.log(err); }); | ||
} | ||
@@ -48,0 +74,0 @@ }; |
{ | ||
"name": "kameleoon-client-javascript", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "JavaScript SDK client", | ||
@@ -20,2 +20,3 @@ "main": "dist/kameleoonClient.js", | ||
"@types/node": "^14.17.5", | ||
"@types/node-fetch": "^2.6.2", | ||
"@typescript-eslint/eslint-plugin": "^5.4.0", | ||
@@ -29,3 +30,6 @@ "@typescript-eslint/parser": "^5.4.0", | ||
}, | ||
"typings": "dist/kameleoonClient.d.ts" | ||
"typings": "dist/kameleoonClient.d.ts", | ||
"dependencies": { | ||
"node-fetch": "^2.6.9" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
142261
3156
1
10
+ Addednode-fetch@^2.6.9
+ Addednode-fetch@2.7.0(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)