quiq-chat
Advanced tools
Comparing version 1.23.0 to 1.23.1
@@ -323,3 +323,3 @@ 'use strict'; | ||
var version = "1.23.0"; | ||
var version = "1.23.1"; | ||
@@ -1159,2 +1159,12 @@ function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
// This temporary code was borrowed from | ||
// http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript | ||
var createGuid = function createGuid() { | ||
function s4() { | ||
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); | ||
} | ||
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); | ||
}; | ||
var quiqFetch = function quiqFetch(url, overrides) { | ||
@@ -1174,2 +1184,3 @@ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { | ||
var correlationId = createGuid(); | ||
// Only append this data to a non-cached endpoint so we don't cache bust. | ||
@@ -1180,2 +1191,3 @@ var parsedUrl = options.cached ? url : formatQueryParams(url, { | ||
}); | ||
parsedUrl = parsedUrl + '#correlationId=' + correlationId; | ||
@@ -1191,3 +1203,4 @@ var request = { | ||
'X-Quiq-Client-Id': 'Quiq-Chat-Client', | ||
'X-Quiq-Client-Version': version | ||
'X-Quiq-Client-Version': version, | ||
'x-centricient-correlation-id': correlationId | ||
} | ||
@@ -1194,0 +1207,0 @@ }; |
{ | ||
"name": "quiq-chat", | ||
"version": "1.23.0", | ||
"version": "1.23.1", | ||
"description": | ||
@@ -5,0 +5,0 @@ "Library to help with network requests to create a webchat client for Quiq Messaging", |
@@ -23,3 +23,3 @@ // @flow | ||
quiqFetch('someUrl'); | ||
expect(mockFetch.mock.calls[0][0]).toBe('someUrl'); | ||
expect(mockFetch.mock.calls[0][0].split('#')[0]).toBe('someUrl'); | ||
expect(mockFetch.mock.calls[0][1].mode).toBe('cors'); | ||
@@ -26,0 +26,0 @@ expect(mockFetch.mock.calls[0][1].method).toBe('GET'); |
@@ -12,2 +12,14 @@ // @flow | ||
// This temporary code was borrowed from | ||
// http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript | ||
const createGuid = (): string => { | ||
function s4() { | ||
return Math.floor((1 + Math.random()) * 0x10000) | ||
.toString(16) | ||
.substring(1); | ||
} | ||
return `${s4() + s4()}-${s4()}-${s4()}-${s4()}-${s4()}${s4()}${s4()}`; | ||
}; | ||
const quiqFetch = ( | ||
@@ -34,4 +46,5 @@ url: string, | ||
const correlationId = createGuid(); | ||
// Only append this data to a non-cached endpoint so we don't cache bust. | ||
const parsedUrl = options.cached | ||
let parsedUrl = options.cached | ||
? url | ||
@@ -42,2 +55,3 @@ : formatQueryParams(url, { | ||
}); | ||
parsedUrl = `${parsedUrl}#correlationId=${correlationId}`; | ||
@@ -54,2 +68,3 @@ let request: RequestOptions = { | ||
'X-Quiq-Client-Version': version, | ||
'x-centricient-correlation-id': correlationId, | ||
}, | ||
@@ -56,0 +71,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
1394467
109
6594