@constructor-io/constructorio-client-javascript 2.25.3 → 2.25.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.
@@ -78,16 +78,16 @@ var RequestQueue = /*#__PURE__*/function () {
78
78
  var _nextInQueue = nextInQueue,
79
79
  networkParameters = _nextInQueue.networkParameters;
80
80
  var signal;
81
+ RequestQueue.set(queue);
81
82
 
82
83
  if (networkParameters) {
83
84
  var controller = new AbortController();
84
85
  signal = controller.signal;
85
86
  helpers.applyNetworkTimeout(this.options, networkParameters, controller);
86
- }
87
-
88
- RequestQueue.set(queue); // Backwards compatibility with versions <= 2.0.0, can be removed in future
87
+ } // Backwards compatibility with versions <= 2.0.0, can be removed in future
89
88
  // - Request queue entries used to be strings with 'GET' method assumed
90
89
 
90
+
91
91
  if (typeof nextInQueue === 'string') {
92
92
  nextInQueue = {
93
93
  url: nextInQueue,
@@ -177,7 +177,26 @@ var RequestQueue = /*#__PURE__*/function () {
177
177
  }, {
178
178
  key: "set",
179
179
  value: function set(queue) {
180
- store.local.set(storageKey, queue);
180
+ // If queue length is zero, remove entry entirely
181
+ if (queue && queue.length === 0) {
182
+ RequestQueue.remove();
183
+ } else {
184
+ store.local.set(storageKey, queue);
185
+ }
186
+
187
+ var localStorageQueue = RequestQueue.get(); // Ensure storage queue was set correctly in storage by checking length
188
+ // - Otherwise remove all pending requests as preventative measure
189
+ // - Firefox seeing identical events being transmitted multiple times
190
+
191
+ if (Array.isArray(localStorageQueue) && localStorageQueue.length !== queue.length) {
192
+ RequestQueue.remove();
193
+ }
194
+ } // Remove current request queue key
195
+
196
+ }, {
197
+ key: "remove",
198
+ value: function remove() {
199
+ store.local.remove(storageKey);
181
200
  }
182
201
  }]);
183
202
  return RequestQueue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-client-javascript",
3
- "version": "2.25.3",
3
+ "version": "2.25.4",
4
4
  "description": "Constructor.io JavaScript client",
5
5
  "main": "lib/constructorio.js",
6
6
  "scripts": {