@openreplay/tracker 9.0.2 → 9.0.4

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
- # 9.0.2
1
+ # 9.0.2 & 9.0.3 & 9.0.4
2
2
 
3
- - fix "setSessionTokenHeader" method
3
+ - fixes for "setSessionTokenHeader" method
4
4
 
5
5
  # 9.0.1
6
6
 
package/cjs/app/index.js CHANGED
@@ -35,7 +35,7 @@ class App {
35
35
  this.stopCallbacks = [];
36
36
  this.commitCallbacks = [];
37
37
  this.activityState = ActivityState.NotActive;
38
- this.version = '9.0.2'; // TODO: version compatability check inside each plugin.
38
+ this.version = '9.0.4'; // TODO: version compatability check inside each plugin.
39
39
  this.compressionThreshold = 24 * 1000;
40
40
  this.restartAttempts = 0;
41
41
  this.bc = null;
package/cjs/index.js CHANGED
@@ -153,7 +153,7 @@ class API {
153
153
  // no-cors issue only with text/plain or not-set Content-Type
154
154
  // req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
155
155
  req.send(JSON.stringify({
156
- trackerVersion: '9.0.2',
156
+ trackerVersion: '9.0.4',
157
157
  projectKey: options.projectKey,
158
158
  doNotTrack,
159
159
  // TODO: add precise reason (an exact API missing)
@@ -125,8 +125,23 @@ class FetchProxyHandler {
125
125
  const item = new networkMessage_js_1.default(this.ignoredHeaders, this.setSessionTokenHeader, this.sanitize);
126
126
  this.beforeFetch(item, input, init);
127
127
  this.setSessionTokenHeader((name, value) => {
128
- var _a;
129
- argsList[1] = Object.assign(Object.assign({}, argsList[1]), { headers: Object.assign(Object.assign({}, (_a = argsList[1]) === null || _a === void 0 ? void 0 : _a.headers), { [name]: value }) });
128
+ if (argsList[1] === undefined && argsList[0] instanceof Request) {
129
+ return argsList[0].headers.append(name, value);
130
+ }
131
+ else {
132
+ if (argsList[1].headers === undefined) {
133
+ argsList[1].headers = {};
134
+ }
135
+ if (argsList[1].headers instanceof Headers) {
136
+ argsList[1].headers.append(name, value);
137
+ }
138
+ else if (Array.isArray(argsList[1].headers)) {
139
+ argsList[1].headers.push([name, value]);
140
+ }
141
+ else {
142
+ argsList[1].headers[name] = value;
143
+ }
144
+ }
130
145
  });
131
146
  return target.apply(window, argsList)
132
147
  .then(this.afterFetch(item))
package/lib/app/index.js CHANGED
@@ -32,7 +32,7 @@ export default class App {
32
32
  this.stopCallbacks = [];
33
33
  this.commitCallbacks = [];
34
34
  this.activityState = ActivityState.NotActive;
35
- this.version = '9.0.2'; // TODO: version compatability check inside each plugin.
35
+ this.version = '9.0.4'; // TODO: version compatability check inside each plugin.
36
36
  this.compressionThreshold = 24 * 1000;
37
37
  this.restartAttempts = 0;
38
38
  this.bc = null;
package/lib/index.js CHANGED
@@ -148,7 +148,7 @@ export default class API {
148
148
  // no-cors issue only with text/plain or not-set Content-Type
149
149
  // req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
150
150
  req.send(JSON.stringify({
151
- trackerVersion: '9.0.2',
151
+ trackerVersion: '9.0.4',
152
152
  projectKey: options.projectKey,
153
153
  doNotTrack,
154
154
  // TODO: add precise reason (an exact API missing)
@@ -121,8 +121,23 @@ export class FetchProxyHandler {
121
121
  const item = new NetworkMessage(this.ignoredHeaders, this.setSessionTokenHeader, this.sanitize);
122
122
  this.beforeFetch(item, input, init);
123
123
  this.setSessionTokenHeader((name, value) => {
124
- var _a;
125
- argsList[1] = Object.assign(Object.assign({}, argsList[1]), { headers: Object.assign(Object.assign({}, (_a = argsList[1]) === null || _a === void 0 ? void 0 : _a.headers), { [name]: value }) });
124
+ if (argsList[1] === undefined && argsList[0] instanceof Request) {
125
+ return argsList[0].headers.append(name, value);
126
+ }
127
+ else {
128
+ if (argsList[1].headers === undefined) {
129
+ argsList[1].headers = {};
130
+ }
131
+ if (argsList[1].headers instanceof Headers) {
132
+ argsList[1].headers.append(name, value);
133
+ }
134
+ else if (Array.isArray(argsList[1].headers)) {
135
+ argsList[1].headers.push([name, value]);
136
+ }
137
+ else {
138
+ argsList[1].headers[name] = value;
139
+ }
140
+ }
126
141
  });
127
142
  return target.apply(window, argsList)
128
143
  .then(this.afterFetch(item))
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@openreplay/tracker",
3
3
  "description": "The OpenReplay tracker main package",
4
- "version": "9.0.2",
4
+ "version": "9.0.4",
5
5
  "keywords": [
6
6
  "logging",
7
7
  "replay"