kameleoon-client-javascript
Advanced tools
Comparing version 2.1.1 to 3.0.0
@@ -123,4 +123,4 @@ /// <reference types="node" /> | ||
configDataFile?: ConfigurationAPIInterface; | ||
fetchCallback?: any; | ||
dispatchEvent?: any; | ||
} | ||
export {}; |
@@ -35,3 +35,3 @@ import Configuration from "./configurations/configuration"; | ||
private configDataFile?; | ||
private fetchCallback?; | ||
private dispatchEvent?; | ||
constructor(siteCode: string, configuration?: SDKConfiguration, integration?: IntegrationInterface); | ||
@@ -38,0 +38,0 @@ private updateCampaignConfiguration; |
@@ -225,3 +225,3 @@ "use strict"; | ||
userAgent: _this.getUserAgent(visitorCode), | ||
fetchCallback: _this.fetchCallback, | ||
dispatchEvent: _this.dispatchEvent, | ||
}); | ||
@@ -267,3 +267,3 @@ } | ||
userAgent: _this.getUserAgent(visitorCode), | ||
fetchCallback: _this.fetchCallback, | ||
dispatchEvent: _this.dispatchEvent, | ||
}); | ||
@@ -317,3 +317,3 @@ } | ||
userAgent: _this.getUserAgent(visitorCode), | ||
fetchCallback: _this.fetchCallback, | ||
dispatchEvent: _this.dispatchEvent, | ||
}); | ||
@@ -423,3 +423,3 @@ result = variationId != 0; | ||
userAgent: _this.getUserAgent(visitorCode), | ||
fetchCallback: _this.fetchCallback, | ||
dispatchEvent: _this.dispatchEvent, | ||
}); | ||
@@ -635,3 +635,3 @@ } | ||
}, | ||
fetchCallback: _this.fetchCallback, | ||
dispatchEvent: _this.dispatchEvent, | ||
}); | ||
@@ -737,3 +737,3 @@ })]; | ||
this.configDataFile = integration === null || integration === void 0 ? void 0 : integration.configDataFile; | ||
this.fetchCallback = integration === null || integration === void 0 ? void 0 : integration.fetchCallback; | ||
this.dispatchEvent = integration === null || integration === void 0 ? void 0 : integration.dispatchEvent; | ||
if (configuration) { | ||
@@ -740,0 +740,0 @@ if (configuration.visitor_data_maximum_size) { |
import { TypeFetchRequestParams } from "./types"; | ||
declare class KameleoonUtils { | ||
doRequest: ({ url, method, data, callback, addKameleoonClientHeader, userAgent, fetchCallback, }: TypeFetchRequestParams) => void; | ||
doRequest: ({ url, method, data, callback, addKameleoonClientHeader, userAgent, dispatchEvent, }: TypeFetchRequestParams) => void; | ||
computeStringSha256: (string: string) => string; | ||
@@ -5,0 +5,0 @@ encodeUTF8: (string: string) => string; |
@@ -24,4 +24,3 @@ "use strict"; | ||
var node_fetch_1 = __importStar(require("node-fetch")); | ||
var constants_1 = require("./constants"); | ||
var VERSION = "2.1.1"; | ||
var VERSION = "3.0.0"; | ||
var KameleoonUtils = /** @class */ (function () { | ||
@@ -31,5 +30,4 @@ function KameleoonUtils() { | ||
this.doRequest = function (_a) { | ||
var url = _a.url, method = _a.method, data = _a.data, callback = _a.callback, _b = _a.addKameleoonClientHeader, addKameleoonClientHeader = _b === void 0 ? true : _b, userAgent = _a.userAgent, fetchCallback = _a.fetchCallback; | ||
if (fetchCallback) { | ||
var isTracking = url.includes(constants_1.API_SSX_URL); | ||
var url = _a.url, method = _a.method, data = _a.data, callback = _a.callback, _b = _a.addKameleoonClientHeader, addKameleoonClientHeader = _b === void 0 ? true : _b, userAgent = _a.userAgent, dispatchEvent = _a.dispatchEvent; | ||
if (dispatchEvent) { | ||
var headers = new Headers({ | ||
@@ -44,10 +42,3 @@ "Content-Type": "application/x-www-form-urlencoded", | ||
} | ||
var eventRequest = new Request(url, { | ||
method: method, | ||
body: data !== null && data !== void 0 ? data : null, | ||
headers: headers, | ||
}); | ||
fetchCallback(eventRequest, { | ||
backend: isTracking ? "kameleoontracking" : "kameleoondata", | ||
}) | ||
dispatchEvent({ url: url, method: method, headers: headers, data: data !== null && data !== void 0 ? data : null }) | ||
.then(function (response) { return response.text(); }) | ||
@@ -54,0 +45,0 @@ .then(function (responseText) { return callback && callback(responseText); }); |
@@ -14,4 +14,4 @@ import { HttpMethod } from "./kameleoonUtils"; | ||
userAgent?: UserAgent; | ||
fetchCallback?: any; | ||
dispatchEvent?: any; | ||
}; | ||
export {}; |
{ | ||
"name": "kameleoon-client-javascript", | ||
"version": "2.1.1", | ||
"version": "3.0.0", | ||
"description": "JavaScript SDK client", | ||
@@ -5,0 +5,0 @@ "main": "dist/kameleoonClient.js", |
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
141911
3147