@overmap-ai/core 1.0.53-component-asset-renames.4 → 1.0.53-component-asset-renames.6

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.
@@ -5,8 +5,8 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  (function(global2, factory) {
8
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("react/jsx-runtime"), require("@overmap-ai/blocks"), require("dependency-graph"), require("@redux-offline/redux-offline"), require("@redux-offline/redux-offline/lib/defaults"), require("localforage"), require("redux-persist-migrate"), require("@reduxjs/toolkit"), require("superagent"), require("react-redux"), require("file-saver"), require("uuid"), require("color"), require("jwt-decode"), require("@redux-offline/redux-offline/lib/constants"), require("idb"), require("formik"), require("react-dom"), require("lodash.get"), require("linkify-react"), require("@hello-pangea/dnd"), require("qr-scanner"), require("xlsx"), require("react-pdf"), require("react-pdf/dist/Page/AnnotationLayer.css"), require("react-pdf/dist/Page/TextLayer.css"), require("react-sketch-canvas"), require("lodash.set"), require("lodash.clonedeep")) : typeof define === "function" && define.amd ? define(["exports", "react", "react/jsx-runtime", "@overmap-ai/blocks", "dependency-graph", "@redux-offline/redux-offline", "@redux-offline/redux-offline/lib/defaults", "localforage", "redux-persist-migrate", "@reduxjs/toolkit", "superagent", "react-redux", "file-saver", "uuid", "color", "jwt-decode", "@redux-offline/redux-offline/lib/constants", "idb", "formik", "react-dom", "lodash.get", "linkify-react", "@hello-pangea/dnd", "qr-scanner", "xlsx", "react-pdf", "react-pdf/dist/Page/AnnotationLayer.css", "react-pdf/dist/Page/TextLayer.css", "react-sketch-canvas", "lodash.set", "lodash.clonedeep"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2["overmap-core"] = {}, global2.React, global2.jsxRuntime, global2.blocks, global2.dependencyGraph, global2.reduxOffline, global2.offlineConfig, global2.localforage, global2.createMigration, global2.toolkit, global2.request, global2.reactRedux, global2.saveAs, global2.uuid, global2.ColorCls, global2.jwtDecode, global2.constants, global2.idb, global2.formik, global2.ReactDOM, global2.get, global2.Linkify, global2.dnd, global2.QrScannerAPI, global2.xlsx, global2.reactPdf, null, null, global2.reactSketchCanvas, global2.set, global2.cloneDeep));
9
- })(this, function(exports2, React, jsxRuntime, blocks, dependencyGraph, reduxOffline, offlineConfig, localforage, createMigration, toolkit, request, reactRedux, saveAs, uuid, ColorCls, jwtDecode, constants, idb, formik, ReactDOM, get, Linkify, dnd, QrScannerAPI, xlsx, reactPdf, AnnotationLayer_css, TextLayer_css, reactSketchCanvas, set, cloneDeep) {
8
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("react/jsx-runtime"), require("@overmap-ai/blocks"), require("dependency-graph"), require("file-saver"), require("@redux-offline/redux-offline"), require("@redux-offline/redux-offline/lib/defaults"), require("localforage"), require("redux-persist-migrate"), require("@reduxjs/toolkit"), require("superagent"), require("react-redux"), require("uuid"), require("color"), require("jwt-decode"), require("@redux-offline/redux-offline/lib/constants"), require("idb"), require("formik"), require("react-dom"), require("lodash.get"), require("linkify-react"), require("@hello-pangea/dnd"), require("qr-scanner"), require("xlsx"), require("react-pdf"), require("react-pdf/dist/Page/AnnotationLayer.css"), require("react-pdf/dist/Page/TextLayer.css"), require("react-sketch-canvas"), require("lodash.set"), require("lodash.clonedeep")) : typeof define === "function" && define.amd ? define(["exports", "react", "react/jsx-runtime", "@overmap-ai/blocks", "dependency-graph", "file-saver", "@redux-offline/redux-offline", "@redux-offline/redux-offline/lib/defaults", "localforage", "redux-persist-migrate", "@reduxjs/toolkit", "superagent", "react-redux", "uuid", "color", "jwt-decode", "@redux-offline/redux-offline/lib/constants", "idb", "formik", "react-dom", "lodash.get", "linkify-react", "@hello-pangea/dnd", "qr-scanner", "xlsx", "react-pdf", "react-pdf/dist/Page/AnnotationLayer.css", "react-pdf/dist/Page/TextLayer.css", "react-sketch-canvas", "lodash.set", "lodash.clonedeep"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2["overmap-core"] = {}, global2.React, global2.jsxRuntime, global2.blocks, global2.dependencyGraph, global2.saveAs, global2.reduxOffline, global2.offlineConfig, global2.localforage, global2.createMigration, global2.toolkit, global2.request, global2.reactRedux, global2.uuid, global2.ColorCls, global2.jwtDecode, global2.constants, global2.idb, global2.formik, global2.ReactDOM, global2.get, global2.Linkify, global2.dnd, global2.QrScannerAPI, global2.xlsx, global2.reactPdf, null, null, global2.reactSketchCanvas, global2.set, global2.cloneDeep));
9
+ })(this, function(exports2, React, jsxRuntime, blocks, dependencyGraph, saveAs, reduxOffline, offlineConfig, localforage, createMigration, toolkit, request, reactRedux, uuid, ColorCls, jwtDecode, constants, idb, formik, ReactDOM, get, Linkify, dnd, QrScannerAPI, xlsx, reactPdf, AnnotationLayer_css, TextLayer_css, reactSketchCanvas, set, cloneDeep) {
10
10
  var _a;
11
11
  "use strict";
12
12
  function _interopNamespaceDefault(e) {
@@ -36,7 +36,7 @@ var __publicField = (obj, key, value) => {
36
36
  /**
37
37
  * Used when the app is loaded. Reconstructs the dependency graph based on an outbox from the redux-offline store.
38
38
  */
39
- static fromOutbox(outbox) {
39
+ static _fromOutbox(outbox) {
40
40
  const ret = new OutboxCoordinator();
41
41
  for (let i = 0; i < outbox.length; i++) {
42
42
  const outboxItem = outbox[i];
@@ -268,46 +268,112 @@ var __publicField = (obj, key, value) => {
268
268
  this.options = options;
269
269
  }
270
270
  }
271
- class DeferredPromise {
272
- constructor() {
273
- __publicField(this, _a, "Promise");
274
- __publicField(this, "_promise");
275
- __publicField(this, "_resolve");
276
- __publicField(this, "_reject");
277
- __publicField(this, "_state", "pending");
278
- this._resolve = null;
279
- this._reject = null;
280
- this._promise = new Promise((resolve, reject) => {
281
- this._resolve = resolve;
282
- this._reject = reject;
283
- });
284
- }
285
- get state() {
286
- return this._state;
271
+ class BaseApiService {
272
+ constructor(sdk) {
273
+ __publicField(this, "client");
274
+ this.client = sdk;
287
275
  }
288
- then(onFulfilled, onRejected) {
289
- return this._promise.then(onFulfilled, onRejected);
276
+ }
277
+ function hex(buffer) {
278
+ const hashArray = new Uint8Array(buffer);
279
+ return hashArray.reduce((data, byte) => data + byte.toString(16).padStart(2, "0"), "");
280
+ }
281
+ const getFileS3Key = async (file, hash) => {
282
+ if (!hash) {
283
+ hash = await hashFile(file);
290
284
  }
291
- catch(onRejected) {
292
- return this._promise.catch(onRejected);
285
+ let fileType = file.type;
286
+ if (fileType.includes("/")) {
287
+ fileType = fileType.split("/")[1];
293
288
  }
294
- resolve(value) {
295
- if (!this._resolve)
296
- throw new Error("No resolve callback");
297
- this._resolve(value);
298
- this._state = "fulfilled";
289
+ if (!fileType) {
290
+ throw new Error(`Could not extract file type from ${file.type}`);
299
291
  }
300
- reject(reason) {
301
- if (!this._reject)
302
- throw reason;
303
- this._reject(reason);
304
- this._state = "rejected";
292
+ return `${hash}.${fileType}`;
293
+ };
294
+ function hashFile(file) {
295
+ return new Promise((resolve, reject) => {
296
+ const reader = new FileReader();
297
+ reader.onload = () => {
298
+ const fileResult = reader.result;
299
+ if (!fileResult) {
300
+ reject();
301
+ return;
302
+ }
303
+ void crypto.subtle.digest("SHA-1", fileResult).then((hash) => {
304
+ const sha1result = hex(hash);
305
+ resolve(sha1result);
306
+ });
307
+ };
308
+ reader.readAsArrayBuffer(file);
309
+ });
310
+ }
311
+ function getFileIdentifier(file) {
312
+ if (!file.name || !file.type || !file.size) {
313
+ const message = "File has no name, type, and/or size";
314
+ console.error(`${message}`, file);
315
+ throw new Error(`${message}.`);
305
316
  }
306
- finally(_onFinally) {
307
- throw new Error("`finally` not implemented");
317
+ return `${file.name}&${file.type}${file.size}`;
318
+ }
319
+ function getRenamedFile(file, newName) {
320
+ return new File([file], newName, { type: file.type });
321
+ }
322
+ function downloadInMemoryFile(filename, text) {
323
+ const element = document.createElement("a");
324
+ element.setAttribute("href", "data:text/plain;charset=utf-8," + encodeURIComponent(text));
325
+ element.setAttribute("download", filename);
326
+ element.style.display = "none";
327
+ document.body.appendChild(element);
328
+ element.click();
329
+ document.body.removeChild(element);
330
+ }
331
+ const constructUploadedFilePayloads = async (files) => {
332
+ const filePayloads = {};
333
+ for (const file of files) {
334
+ const sha1 = await hashFile(file);
335
+ filePayloads[sha1] = {
336
+ sha1,
337
+ extension: file.name.split(".").pop() || "",
338
+ file_type: file.type,
339
+ size: file.size
340
+ };
308
341
  }
342
+ return Object.values(filePayloads);
343
+ };
344
+ const fileToBlob = async (dataUrl) => {
345
+ return (await fetch(dataUrl)).blob();
346
+ };
347
+ const blobToBase64 = (blob) => {
348
+ return new Promise((resolve, _) => {
349
+ const reader = new FileReader();
350
+ reader.onloadend = () => {
351
+ var _a2;
352
+ resolve(((_a2 = reader.result) == null ? void 0 : _a2.toString()) || "");
353
+ };
354
+ reader.readAsDataURL(blob);
355
+ });
356
+ };
357
+ const useFileSrc = (props) => {
358
+ const { file, fileSha1, placeholder } = props;
359
+ const [src, setSrc] = React.useState(placeholder);
360
+ const { sdk } = useSDK();
361
+ React.useEffect(() => {
362
+ if (!fileSha1 || !file)
363
+ return;
364
+ sdk.files.fetchFileFromUrl(file, fileSha1).then((file2) => {
365
+ setSrc(URL.createObjectURL(file2));
366
+ }).catch((reason) => {
367
+ console.error(`Failed to fetch file ${file} (${fileSha1}):
368
+ `, reason);
369
+ });
370
+ }, [file, fileSha1, sdk.files]);
371
+ return src;
372
+ };
373
+ function downloadFile(file) {
374
+ const blob = new Blob([file]);
375
+ saveAs.saveAs(blob, file.name);
309
376
  }
310
- _a = Symbol.toStringTag;
311
377
  const global$1 = typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
312
378
  function defaultSetTimout() {
313
379
  throw new Error("setTimeout has not been defined");
@@ -787,106 +853,6 @@ var __publicField = (obj, key, value) => {
787
853
  }
788
854
  return classes.join(" ");
789
855
  }
790
- function hex(buffer) {
791
- const hashArray = new Uint8Array(buffer);
792
- return hashArray.reduce((data, byte) => data + byte.toString(16).padStart(2, "0"), "");
793
- }
794
- const getFileS3Key = async (file, hash) => {
795
- if (!hash) {
796
- hash = await hashFile(file);
797
- }
798
- let fileType = file.type;
799
- if (fileType.includes("/")) {
800
- fileType = fileType.split("/")[1];
801
- }
802
- if (!fileType) {
803
- throw new Error(`Could not extract file type from ${file.type}`);
804
- }
805
- return `${hash}.${fileType}`;
806
- };
807
- function hashFile(file) {
808
- return new Promise((resolve, reject) => {
809
- const reader = new FileReader();
810
- reader.onload = () => {
811
- const fileResult = reader.result;
812
- if (!fileResult) {
813
- reject();
814
- return;
815
- }
816
- void crypto.subtle.digest("SHA-1", fileResult).then((hash) => {
817
- const sha1result = hex(hash);
818
- resolve(sha1result);
819
- });
820
- };
821
- reader.readAsArrayBuffer(file);
822
- });
823
- }
824
- function getFileIdentifier(file) {
825
- if (!file.name || !file.type || !file.size) {
826
- const message = "File has no name, type, and/or size";
827
- console.error(`${message}`, file);
828
- throw new Error(`${message}.`);
829
- }
830
- return `${file.name}&${file.type}${file.size}`;
831
- }
832
- function getRenamedFile(file, newName) {
833
- return new File([file], newName, { type: file.type });
834
- }
835
- function downloadInMemoryFile(filename, text) {
836
- const element = document.createElement("a");
837
- element.setAttribute("href", "data:text/plain;charset=utf-8," + encodeURIComponent(text));
838
- element.setAttribute("download", filename);
839
- element.style.display = "none";
840
- document.body.appendChild(element);
841
- element.click();
842
- document.body.removeChild(element);
843
- }
844
- const constructUploadedFilePayloads = async (files) => {
845
- const filePayloads = {};
846
- for (const file of files) {
847
- const sha1 = await hashFile(file);
848
- filePayloads[sha1] = {
849
- sha1,
850
- extension: file.name.split(".").pop() || "",
851
- file_type: file.type,
852
- size: file.size
853
- };
854
- }
855
- return Object.values(filePayloads);
856
- };
857
- const fileToBlob = async (dataUrl) => {
858
- return (await fetch(dataUrl)).blob();
859
- };
860
- const blobToBase64 = (blob) => {
861
- return new Promise((resolve, _) => {
862
- const reader = new FileReader();
863
- reader.onloadend = () => {
864
- var _a2;
865
- resolve(((_a2 = reader.result) == null ? void 0 : _a2.toString()) || "");
866
- };
867
- reader.readAsDataURL(blob);
868
- });
869
- };
870
- const useFileSrc = (props) => {
871
- const { file, fileSha1, placeholder } = props;
872
- const [src, setSrc] = React.useState(placeholder);
873
- const { sdk } = useSDK();
874
- React.useEffect(() => {
875
- if (!fileSha1 || !file)
876
- return;
877
- sdk.files.fetchFileFromUrl(file, fileSha1).then((file2) => {
878
- setSrc(URL.createObjectURL(file2));
879
- }).catch((reason) => {
880
- console.error(`Failed to fetch file ${file} (${fileSha1}):
881
- `, reason);
882
- });
883
- }, [file, fileSha1, sdk.files]);
884
- return src;
885
- };
886
- function downloadFile(file) {
887
- const blob = new Blob([file]);
888
- saveAs.saveAs(blob, file.name);
889
- }
890
856
  const logCache = {};
891
857
  function logOnlyOnce(logId, objId, level, ...args) {
892
858
  const thisLogIdCache = logCache[logId];
@@ -4629,11 +4595,19 @@ var __publicField = (obj, key, value) => {
4629
4595
  return overmapReducer(mutatedState, action);
4630
4596
  };
4631
4597
  let __OUTBOX_COORDINATOR = null;
4632
- function _getOutboxCoordinator() {
4633
- if (!__OUTBOX_COORDINATOR) {
4634
- __OUTBOX_COORDINATOR = new OutboxCoordinator();
4598
+ function getOutboxCoordinator() {
4599
+ const clientStore2 = getClientStore();
4600
+ if (!clientStore2) {
4601
+ console.warn("Client store not set; cannot get outbox coordinator yet.");
4602
+ return null;
4603
+ }
4604
+ if (__OUTBOX_COORDINATOR) {
4605
+ return __OUTBOX_COORDINATOR;
4635
4606
  }
4636
- return __OUTBOX_COORDINATOR;
4607
+ const outbox = clientStore2.getState().offline.outbox;
4608
+ const coordinator = OutboxCoordinator._fromOutbox(outbox);
4609
+ __OUTBOX_COORDINATOR = coordinator;
4610
+ return coordinator;
4637
4611
  }
4638
4612
  const persistCallback = (err) => {
4639
4613
  if (err)
@@ -4646,12 +4620,20 @@ var __publicField = (obj, key, value) => {
4646
4620
  }
4647
4621
  };
4648
4622
  const enqueue = (_array, item, _context) => {
4649
- const coordinator = _getOutboxCoordinator();
4623
+ const coordinator = getOutboxCoordinator();
4624
+ if (!coordinator) {
4625
+ console.warn("Outbox coordinator not set; cannot enqueue request yet.");
4626
+ return [];
4627
+ }
4650
4628
  coordinator.addRequest(item);
4651
4629
  return coordinator.getQueue();
4652
4630
  };
4653
4631
  const dequeue = (_array, item, _context) => {
4654
- const coordinator = _getOutboxCoordinator();
4632
+ const coordinator = getOutboxCoordinator();
4633
+ if (!coordinator) {
4634
+ console.warn("Outbox coordinator not set; cannot dequeue request yet.");
4635
+ return [];
4636
+ }
4655
4637
  const meta = item.meta;
4656
4638
  const uuid2 = meta.offlineAction.payload.uuid;
4657
4639
  coordinator.remove(uuid2);
@@ -4735,7 +4717,6 @@ var __publicField = (obj, key, value) => {
4735
4717
  }
4736
4718
  }
4737
4719
  }
4738
- console.debug("Done checking tokens");
4739
4720
  const defaultSettings = {
4740
4721
  queryParams: "",
4741
4722
  isAuthNeeded: true
@@ -4879,7 +4860,7 @@ var __publicField = (obj, key, value) => {
4879
4860
  if (this.next) {
4880
4861
  return this.next.run(action);
4881
4862
  } else {
4882
- console.debug(`All middleware finished with ${this.constructor.name}, performing request:`, action);
4863
+ console.debug("Middleware finished. Performing request:", action);
4883
4864
  const baseUrl = action.meta.offline.effect.BASE_URL;
4884
4865
  const clientStore2 = getClientStore();
4885
4866
  if (!clientStore2)
@@ -4943,7 +4924,11 @@ var __publicField = (obj, key, value) => {
4943
4924
  const uuid2 = action.payload.uuid;
4944
4925
  function rollbackAndThrow() {
4945
4926
  clientStore2.dispatch(markAsDeleted(uuid2));
4946
- _getOutboxCoordinator().remove(action.payload.uuid);
4927
+ const coordinator2 = getOutboxCoordinator();
4928
+ if (!coordinator2) {
4929
+ throw new Error("Outbox coordinator not set");
4930
+ }
4931
+ coordinator2.remove(action.payload.uuid);
4947
4932
  const rollbackAction = action.meta.offline.rollback;
4948
4933
  if (rollbackAction) {
4949
4934
  console.warn("Rolling back request due to SDK error:", action);
@@ -4974,17 +4959,26 @@ var __publicField = (obj, key, value) => {
4974
4959
  console.error(`Could not display toast for status ${status} because there is no toast handle.`);
4975
4960
  }
4976
4961
  }
4977
- _getOutboxCoordinator().remove(action.payload.uuid);
4962
+ const coordinator2 = getOutboxCoordinator();
4963
+ if (!coordinator2) {
4964
+ throw new Error("Outbox coordinator not set");
4965
+ }
4966
+ coordinator2.remove(action.payload.uuid);
4978
4967
  reason.options.discard = true;
4979
4968
  rollbackAndThrow();
4980
4969
  }
4981
4970
  }
4982
4971
  console.debug("Registering a retry for request:", action.payload.uuid);
4983
- _getOutboxCoordinator().registerRetry(action.payload.uuid);
4972
+ const coordinator = getOutboxCoordinator();
4973
+ if (!coordinator) {
4974
+ throw new Error("Outbox coordinator not set");
4975
+ }
4976
+ coordinator.registerRetry(action.payload.uuid);
4984
4977
  return false;
4985
4978
  }
4986
4979
  function peek(_array, _item, _context) {
4987
- return _getOutboxCoordinator().peek();
4980
+ var _a2;
4981
+ return (_a2 = getOutboxCoordinator()) == null ? void 0 : _a2.peek();
4988
4982
  }
4989
4983
  function retry(_action, _retries) {
4990
4984
  getClientStore().dispatch(_setLatestRetryTime((/* @__PURE__ */ new Date()).getTime()));
@@ -4992,94 +4986,6 @@ var __publicField = (obj, key, value) => {
4992
4986
  }
4993
4987
  const useAppDispatch = () => reactRedux.useDispatch();
4994
4988
  const useAppSelector = reactRedux.useSelector;
4995
- class BaseApiService {
4996
- constructor(sdk) {
4997
- __publicField(this, "client");
4998
- this.client = sdk;
4999
- }
5000
- /**
5001
- * Enqueues an API request to the offline outbox.
5002
- * @param requestDetails An SDKRequest object containing the details of the request.
5003
- * @protected
5004
- */
5005
- async enqueueRequest(requestDetails) {
5006
- return this._enqueueRequest(requestDetails).then((result) => {
5007
- if (result instanceof APIError) {
5008
- throw result;
5009
- }
5010
- return result;
5011
- });
5012
- }
5013
- /**
5014
- * Enqueues an API request to the Redux Offline outbox
5015
- * @protected
5016
- */
5017
- _enqueueRequest(requestDetails) {
5018
- const promise = new DeferredPromise();
5019
- const requestDetailsWithBaseUrl = { ...requestDetails, BASE_URL: this.client.API_URL };
5020
- const { store } = this.client;
5021
- if (requestDetails.immediate) {
5022
- const requestWithUuid = {
5023
- ...requestDetailsWithBaseUrl,
5024
- uuid: requestDetails.uuid ?? uuid.v4()
5025
- };
5026
- const fullOfflineAction = {
5027
- payload: requestWithUuid,
5028
- type: "",
5029
- meta: {
5030
- offline: {
5031
- effect: {
5032
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
5033
- request: requestWithUuid,
5034
- BASE_URL: this.client.API_URL
5035
- }
5036
- }
5037
- }
5038
- };
5039
- performRequest(fullOfflineAction, this.client).then((result) => {
5040
- promise.resolve(result.body);
5041
- }).catch((error2) => {
5042
- discard(error2, fullOfflineAction);
5043
- promise.reject(error2);
5044
- });
5045
- } else {
5046
- const innerPromise = store.dispatch(
5047
- enqueueRequest(requestDetailsWithBaseUrl)
5048
- );
5049
- const successOrUndefinedHandler = (response) => {
5050
- if (response) {
5051
- promise.resolve(response.body);
5052
- } else {
5053
- const error2 = new APIError({
5054
- message: "Could not get a response from the server.",
5055
- response,
5056
- discard: true
5057
- });
5058
- promise.reject(error2);
5059
- }
5060
- };
5061
- const errorHandler = (error2) => {
5062
- if (error2 instanceof APIError) {
5063
- error2.options.discard = true;
5064
- } else {
5065
- console.error(
5066
- "Received an unexpected error while processing a request:",
5067
- error2,
5068
- "\nConverting error to APIError and discarding."
5069
- );
5070
- error2 = new APIError({
5071
- message: "An error occurred while processing the request.",
5072
- innerError: error2,
5073
- discard: true
5074
- });
5075
- }
5076
- promise.reject(error2);
5077
- };
5078
- innerPromise.then(successOrUndefinedHandler, errorHandler);
5079
- }
5080
- return promise;
5081
- }
5082
- }
5083
4989
  const EXPIRING_SOON_THRESHOLD = 1800;
5084
4990
  function parseTokens(response) {
5085
4991
  if (!response.access)
@@ -5106,7 +5012,7 @@ var __publicField = (obj, key, value) => {
5106
5012
  */
5107
5013
  __publicField(this, "_getTokenPair", (credentials, logoutOnFailure = true) => {
5108
5014
  const uuid$1 = uuid.v4();
5109
- const responsePromise = this.enqueueRequest({
5015
+ const responsePromise = this.client.enqueueRequest({
5110
5016
  uuid: uuid$1,
5111
5017
  description: "Get token pair",
5112
5018
  method: HttpMethod.POST,
@@ -5131,7 +5037,7 @@ var __publicField = (obj, key, value) => {
5131
5037
  * @returns {Promise<TokenPair>} The new access and refresh tokens
5132
5038
  */
5133
5039
  __publicField(this, "_getRenewedTokens", async (refreshToken) => {
5134
- const promise = this.enqueueRequest({
5040
+ const promise = this.client.enqueueRequest({
5135
5041
  description: "Get renewed tokens",
5136
5042
  method: HttpMethod.POST,
5137
5043
  url: "/api/token/refresh/",
@@ -5244,7 +5150,7 @@ var __publicField = (obj, key, value) => {
5244
5150
  * Register a new user
5245
5151
  */
5246
5152
  register(payload) {
5247
- return this.enqueueRequest({
5153
+ return this.client.enqueueRequest({
5248
5154
  description: "Register",
5249
5155
  method: HttpMethod.POST,
5250
5156
  url: "/authentication/users/register/",
@@ -5255,7 +5161,7 @@ var __publicField = (obj, key, value) => {
5255
5161
  });
5256
5162
  }
5257
5163
  async resetPassword(email) {
5258
- return this.enqueueRequest({
5164
+ return this.client.enqueueRequest({
5259
5165
  description: "Reset password",
5260
5166
  method: HttpMethod.PATCH,
5261
5167
  url: "/authentication/users/reset-password/",
@@ -5292,7 +5198,7 @@ var __publicField = (obj, key, value) => {
5292
5198
  const { store } = this.client;
5293
5199
  const [fileProps] = await this.client.files.uploadFileToS3(hash);
5294
5200
  store.dispatch(setProfilePicture({ file: `/files/${fileProps.file}`, file_sha1: hash }));
5295
- return this.enqueueRequest({
5201
+ return this.client.enqueueRequest({
5296
5202
  description: "Replace profile picture",
5297
5203
  method: HttpMethod.PATCH,
5298
5204
  url: "/authentication/users/profile-details/",
@@ -5303,7 +5209,7 @@ var __publicField = (obj, key, value) => {
5303
5209
  }
5304
5210
  async addFavouriteProjectId(projectId) {
5305
5211
  this.client.store.dispatch(addFavouriteProjectId(projectId));
5306
- return this.enqueueRequest({
5212
+ return this.client.enqueueRequest({
5307
5213
  description: "Add favourite project",
5308
5214
  method: HttpMethod.POST,
5309
5215
  url: `/authentication/users/favourite-project/${projectId}/`,
@@ -5313,7 +5219,7 @@ var __publicField = (obj, key, value) => {
5313
5219
  }
5314
5220
  async removeFavouriteProjectId(projectId) {
5315
5221
  this.client.store.dispatch(removeFavouriteProjectId(projectId));
5316
- return this.enqueueRequest({
5222
+ return this.client.enqueueRequest({
5317
5223
  description: "Add favourite project",
5318
5224
  method: HttpMethod.POST,
5319
5225
  url: `/authentication/users/unfavourite-project/${projectId}/`,
@@ -5326,7 +5232,7 @@ var __publicField = (obj, key, value) => {
5326
5232
  const currentStep = this.client.store.getState().userReducer.currentUser.profile.tour_step;
5327
5233
  if (currentStep === stepIndex)
5328
5234
  return Promise.resolve(void 0);
5329
- return this.enqueueRequest({
5235
+ return this.client.enqueueRequest({
5330
5236
  description: "Set tour step",
5331
5237
  method: HttpMethod.PATCH,
5332
5238
  url: "/authentication/users/profile-details/",
@@ -5338,7 +5244,7 @@ var __publicField = (obj, key, value) => {
5338
5244
  });
5339
5245
  }
5340
5246
  async joinApplication(projectInviteId, verification_code, username, password) {
5341
- return this.enqueueRequest({
5247
+ return this.client.enqueueRequest({
5342
5248
  description: "Join application",
5343
5249
  method: HttpMethod.PATCH,
5344
5250
  url: `/authentication/join-app/${projectInviteId}/${verification_code}/`,
@@ -5357,7 +5263,7 @@ var __publicField = (obj, key, value) => {
5357
5263
  const offlineCategory = offline(category);
5358
5264
  const categoryWithWorkspace = { ...offlineCategory, workspace: workspaceId };
5359
5265
  this.client.store.dispatch(addCategory(categoryWithWorkspace));
5360
- const promise = this.enqueueRequest({
5266
+ const promise = this.client.enqueueRequest({
5361
5267
  description: "Create Category",
5362
5268
  method: HttpMethod.POST,
5363
5269
  url: "/categories/",
@@ -5371,7 +5277,7 @@ var __publicField = (obj, key, value) => {
5371
5277
  return [categoryWithWorkspace, promise];
5372
5278
  }
5373
5279
  fetchAll(projectId) {
5374
- const promise = this.enqueueRequest({
5280
+ const promise = this.client.enqueueRequest({
5375
5281
  description: "Get categories",
5376
5282
  method: HttpMethod.GET,
5377
5283
  url: `/projects/${projectId}/categories/`,
@@ -5388,7 +5294,7 @@ var __publicField = (obj, key, value) => {
5388
5294
  }
5389
5295
  this.client.store.dispatch(patchCategory(category));
5390
5296
  const optimisticCategory = { ...existingCategory, ...category };
5391
- const promise = this.enqueueRequest({
5297
+ const promise = this.client.enqueueRequest({
5392
5298
  description: "Edit Category",
5393
5299
  method: HttpMethod.PATCH,
5394
5300
  url: `/categories/${category.offline_id}/`,
@@ -5403,7 +5309,7 @@ var __publicField = (obj, key, value) => {
5403
5309
  }
5404
5310
  remove(category, workspaceId) {
5405
5311
  this.client.store.dispatch(removeCategory(category.offline_id));
5406
- return this.enqueueRequest({
5312
+ return this.client.enqueueRequest({
5407
5313
  description: "Delete Category",
5408
5314
  method: HttpMethod.DELETE,
5409
5315
  url: `/categories/${category.offline_id}/`,
@@ -5449,7 +5355,7 @@ var __publicField = (obj, key, value) => {
5449
5355
  add(asset, workspaceId) {
5450
5356
  const offlineAsset = offline(asset);
5451
5357
  this.client.store.dispatch(addAsset(offlineAsset));
5452
- const promise = this.enqueueRequest({
5358
+ const promise = this.client.enqueueRequest({
5453
5359
  description: "Create asset",
5454
5360
  method: HttpMethod.POST,
5455
5361
  url: `/assets/types/${offlineAsset.asset_type}/add-assets/`,
@@ -5464,7 +5370,7 @@ var __publicField = (obj, key, value) => {
5464
5370
  }
5465
5371
  update(asset, workspaceId) {
5466
5372
  this.client.store.dispatch(updateAsset(asset));
5467
- const promise = this.enqueueRequest({
5373
+ const promise = this.client.enqueueRequest({
5468
5374
  description: "Edit asset",
5469
5375
  method: HttpMethod.PATCH,
5470
5376
  url: `/assets/${asset.offline_id}/`,
@@ -5488,7 +5394,7 @@ var __publicField = (obj, key, value) => {
5488
5394
  const attachmentsOfAssetIds = attachmentsOfAssets.map(({ offline_id }) => offline_id);
5489
5395
  store.dispatch(removeAssetAttachments(attachmentsOfAssetIds));
5490
5396
  }
5491
- return this.enqueueRequest({
5397
+ return this.client.enqueueRequest({
5492
5398
  description: "Delete asset",
5493
5399
  method: HttpMethod.DELETE,
5494
5400
  url: `/assets/${assetId}/`,
@@ -5507,7 +5413,7 @@ var __publicField = (obj, key, value) => {
5507
5413
  const allAssetsOfAssetTypeIds = (allAssetsOfAssetType || []).map((c) => c.offline_id);
5508
5414
  const affectedOfflineIds = [assetTypeId, ...allAssetsOfAssetTypeIds];
5509
5415
  store.dispatch(removeAllAssetsOfType(assetTypeId));
5510
- return this.enqueueRequest({
5416
+ return this.client.enqueueRequest({
5511
5417
  description: "Delete all assets of asset type",
5512
5418
  method: HttpMethod.DELETE,
5513
5419
  url: `/assets/types/${assetTypeId}/delete-all-of-type/`,
@@ -5526,7 +5432,7 @@ var __publicField = (obj, key, value) => {
5526
5432
  });
5527
5433
  const { store } = this.client;
5528
5434
  store.dispatch(addAssetsInBatches(fullAssets));
5529
- const promise = this.enqueueRequest({
5435
+ const promise = this.client.enqueueRequest({
5530
5436
  description: "Batch create assets",
5531
5437
  method: HttpMethod.POST,
5532
5438
  url: `/assets/types/${assetTypeId}/add-assets/`,
@@ -5553,7 +5459,7 @@ var __publicField = (obj, key, value) => {
5553
5459
  }
5554
5460
  async refreshStore() {
5555
5461
  const { store } = this.client;
5556
- const result = await this.enqueueRequest({
5462
+ const result = await this.client.enqueueRequest({
5557
5463
  description: "Get assets",
5558
5464
  method: HttpMethod.GET,
5559
5465
  url: `/projects/${store.getState().projectReducer.activeProjectId}/assets/`,
@@ -5576,7 +5482,7 @@ var __publicField = (obj, key, value) => {
5576
5482
  stage: stageId
5577
5483
  });
5578
5484
  store.dispatch(addStageCompletion(offlineStageCompletion));
5579
- const promise = this.enqueueRequest({
5485
+ const promise = this.client.enqueueRequest({
5580
5486
  description: "Complete stage",
5581
5487
  method: HttpMethod.POST,
5582
5488
  url: `/assets/types/${assetTypeId}/complete-stages/`,
@@ -5589,7 +5495,7 @@ var __publicField = (obj, key, value) => {
5589
5495
  }
5590
5496
  async refreshStore() {
5591
5497
  const { store } = this.client;
5592
- const result = await this.enqueueRequest({
5498
+ const result = await this.client.enqueueRequest({
5593
5499
  description: "Get stage completions",
5594
5500
  method: HttpMethod.GET,
5595
5501
  url: `/projects/${store.getState().projectReducer.activeProjectId}/asset-stage-completions/`,
@@ -5616,7 +5522,7 @@ var __publicField = (obj, key, value) => {
5616
5522
  asMapping[completion.asset] = stageToCompletionDateMapping;
5617
5523
  }
5618
5524
  this.client.store.dispatch(addStageCompletions(asMapping));
5619
- await this.enqueueRequest({
5525
+ await this.client.enqueueRequest({
5620
5526
  description: "Bulk complete stages",
5621
5527
  method: HttpMethod.POST,
5622
5528
  url: `/assets/types/${assetTypeId}/complete-stages/`,
@@ -5635,7 +5541,7 @@ var __publicField = (obj, key, value) => {
5635
5541
  };
5636
5542
  });
5637
5543
  this.client.store.dispatch(removeStageCompletions(stageCompletionsToRemove));
5638
- return this.enqueueRequest({
5544
+ return this.client.enqueueRequest({
5639
5545
  description: `Undo stage for ${assetIds.length} assets(s)`,
5640
5546
  // TODO: Rename to setCompletedStages
5641
5547
  method: HttpMethod.DELETE,
@@ -5657,7 +5563,7 @@ var __publicField = (obj, key, value) => {
5657
5563
  return { ...stage, asset_type: assetTypeId };
5658
5564
  });
5659
5565
  this.client.store.dispatch(addStages(fullStages));
5660
- return this.enqueueRequest({
5566
+ return this.client.enqueueRequest({
5661
5567
  description: "Add asset stages",
5662
5568
  method: HttpMethod.POST,
5663
5569
  url: `/assets/types/${assetTypeId}/add-stages/`,
@@ -5681,7 +5587,7 @@ var __publicField = (obj, key, value) => {
5681
5587
  throw new Error("Could not find the desired stages to update within the store");
5682
5588
  }
5683
5589
  store.dispatch(updateStages(stagesToUpdate));
5684
- return this.enqueueRequest({
5590
+ return this.client.enqueueRequest({
5685
5591
  description: "Edit asset stages",
5686
5592
  method: HttpMethod.PATCH,
5687
5593
  url: `/assets/types/${assetTypeId}/bulk-update-stages/`,
@@ -5697,7 +5603,7 @@ var __publicField = (obj, key, value) => {
5697
5603
  }
5698
5604
  async bulkDelete(idsToDelete) {
5699
5605
  this.client.store.dispatch(removeStages(idsToDelete));
5700
- return this.enqueueRequest({
5606
+ return this.client.enqueueRequest({
5701
5607
  description: "Delete asset stages",
5702
5608
  method: HttpMethod.DELETE,
5703
5609
  url: "/assets/stages/bulk-delete/",
@@ -5710,7 +5616,7 @@ var __publicField = (obj, key, value) => {
5710
5616
  }
5711
5617
  async update(assetStage) {
5712
5618
  this.client.store.dispatch(addStages([assetStage]));
5713
- return this.enqueueRequest({
5619
+ return this.client.enqueueRequest({
5714
5620
  description: "Update asset stage",
5715
5621
  method: HttpMethod.PATCH,
5716
5622
  url: `/assets/stages/${assetStage.offline_id}/`,
@@ -5723,7 +5629,7 @@ var __publicField = (obj, key, value) => {
5723
5629
  const { store } = this.client;
5724
5630
  store.dispatch(linkStageToForm({ stageId, formId: formId2 }));
5725
5631
  try {
5726
- await this.enqueueRequest({
5632
+ await this.client.enqueueRequest({
5727
5633
  description: "Link asset stage to form",
5728
5634
  method: HttpMethod.POST,
5729
5635
  url: `/assets/stages/${stageId}/associate-with-form/`,
@@ -5740,7 +5646,7 @@ var __publicField = (obj, key, value) => {
5740
5646
  const { store } = this.client;
5741
5647
  store.dispatch(unlinkStageToForm({ stageId }));
5742
5648
  try {
5743
- await this.enqueueRequest({
5649
+ await this.client.enqueueRequest({
5744
5650
  description: "Unlink asset stage from form",
5745
5651
  method: HttpMethod.DELETE,
5746
5652
  url: `/assets/stages/${stageId}/associate-with-form/`,
@@ -5754,7 +5660,7 @@ var __publicField = (obj, key, value) => {
5754
5660
  }
5755
5661
  async refreshStore() {
5756
5662
  const { store } = this.client;
5757
- const result = await this.enqueueRequest({
5663
+ const result = await this.client.enqueueRequest({
5758
5664
  description: "Get asset stages",
5759
5665
  method: HttpMethod.GET,
5760
5666
  url: `/projects/${store.getState().projectReducer.activeProjectId}/asset-stages/`,
@@ -5820,7 +5726,7 @@ var __publicField = (obj, key, value) => {
5820
5726
  }
5821
5727
  processPresignedUrls(presignedUrls) {
5822
5728
  for (const [sha1, presignedUrl] of Object.entries(presignedUrls)) {
5823
- void this.enqueueRequest({
5729
+ void this.client.enqueueRequest({
5824
5730
  url: presignedUrl.url,
5825
5731
  description: "Upload file to S3",
5826
5732
  method: HttpMethod.POST,
@@ -5840,7 +5746,7 @@ var __publicField = (obj, key, value) => {
5840
5746
  const { store } = this.client;
5841
5747
  const activeProjectId = store.getState().projectReducer.activeProjectId;
5842
5748
  const meta = AttachmentModelMeta[this.attachmentModel];
5843
- const result = await this.enqueueRequest({
5749
+ const result = await this.client.enqueueRequest({
5844
5750
  description: `Get ${meta.name} attachments`,
5845
5751
  method: HttpMethod.GET,
5846
5752
  url: `/projects/${activeProjectId}${meta.fetchUrlPostfix}/`,
@@ -5885,7 +5791,7 @@ var __publicField = (obj, key, value) => {
5885
5791
  }
5886
5792
  store.dispatch(actions.addAttachments(offlineAttachments));
5887
5793
  const meta = AttachmentModelMeta[this.attachmentModel];
5888
- const promise = this.enqueueRequest({
5794
+ const promise = this.client.enqueueRequest({
5889
5795
  description: `Attach files to ${meta.name}`,
5890
5796
  method: HttpMethod.POST,
5891
5797
  url: `${meta.attachUrlPrefix}/${modelId}/attach/`,
@@ -5915,7 +5821,7 @@ var __publicField = (obj, key, value) => {
5915
5821
  }
5916
5822
  store.dispatch(actions.removeAttachment(attachment.offline_id));
5917
5823
  const meta = AttachmentModelMeta[this.attachmentModel];
5918
- const promise = this.enqueueRequest({
5824
+ const promise = this.client.enqueueRequest({
5919
5825
  description: "Delete attachment",
5920
5826
  method: HttpMethod.DELETE,
5921
5827
  url: `${meta.deleteUrlPrefix}/attachments/${attachmendId}/`,
@@ -5980,7 +5886,7 @@ var __publicField = (obj, key, value) => {
5980
5886
  const { store } = this.client;
5981
5887
  const activeProjectId = store.getState().projectReducer.activeProjectId;
5982
5888
  store.dispatch(addAssetType(offlineAssetType));
5983
- const promise = this.enqueueRequest({
5889
+ const promise = this.client.enqueueRequest({
5984
5890
  description: "Create asset type",
5985
5891
  method: HttpMethod.POST,
5986
5892
  url: `/projects/${activeProjectId}/asset-types/`,
@@ -5992,7 +5898,7 @@ var __publicField = (obj, key, value) => {
5992
5898
  }
5993
5899
  update(assetType) {
5994
5900
  this.client.store.dispatch(addAssetType(assetType));
5995
- return this.enqueueRequest({
5901
+ return this.client.enqueueRequest({
5996
5902
  description: "Update asset type",
5997
5903
  method: HttpMethod.PATCH,
5998
5904
  url: `/assets/types/${assetType.offline_id}/`,
@@ -6019,7 +5925,7 @@ var __publicField = (obj, key, value) => {
6019
5925
  const attachmentsOfAssetTypeIds = attachmentsOfAssetType.map(({ offline_id }) => offline_id);
6020
5926
  store.dispatch(removeAssetTypeAttachments(attachmentsOfAssetTypeIds));
6021
5927
  }
6022
- return this.enqueueRequest({
5928
+ return this.client.enqueueRequest({
6023
5929
  description: "Delete asset type",
6024
5930
  method: HttpMethod.DELETE,
6025
5931
  url: `/assets/types/${assetTypeId}/`,
@@ -6034,7 +5940,7 @@ var __publicField = (obj, key, value) => {
6034
5940
  }
6035
5941
  async refreshStore() {
6036
5942
  const { store } = this.client;
6037
- const result = await this.enqueueRequest({
5943
+ const result = await this.client.enqueueRequest({
6038
5944
  description: "Get asset types",
6039
5945
  method: HttpMethod.GET,
6040
5946
  url: `/projects/${store.getState().projectReducer.activeProjectId}/asset-types/`,
@@ -6101,7 +6007,7 @@ var __publicField = (obj, key, value) => {
6101
6007
  submitted_at: (/* @__PURE__ */ new Date()).toISOString()
6102
6008
  });
6103
6009
  store.dispatch(addIssueComment(offlineComment));
6104
- const promise = this.enqueueRequest({
6010
+ const promise = this.client.enqueueRequest({
6105
6011
  description: `${truncate(comment.content, 80)}`,
6106
6012
  method: HttpMethod.POST,
6107
6013
  url: `/issues/${comment.issue}/comment/`,
@@ -6121,7 +6027,7 @@ var __publicField = (obj, key, value) => {
6121
6027
  throw new Error(`Comment with offline_id ${comment.offline_id} not found in store`);
6122
6028
  }
6123
6029
  store.dispatch(setIssueComment(comment));
6124
- const promise = this.enqueueRequest({
6030
+ const promise = this.client.enqueueRequest({
6125
6031
  description: `Edit comment: ${truncate(comment.content, 80)}`,
6126
6032
  method: HttpMethod.PATCH,
6127
6033
  url: `/issues/comments/${comment.offline_id}/`,
@@ -6140,7 +6046,7 @@ var __publicField = (obj, key, value) => {
6140
6046
  throw new Error(`Comment with offline_id ${offline_id} not found in store`);
6141
6047
  }
6142
6048
  this.client.store.dispatch(removeIssueComment(offline_id));
6143
- const promise = this.enqueueRequest({
6049
+ const promise = this.client.enqueueRequest({
6144
6050
  description: "Delete comment",
6145
6051
  method: HttpMethod.DELETE,
6146
6052
  url: `/issues/comments/${offline_id}/`,
@@ -6154,7 +6060,7 @@ var __publicField = (obj, key, value) => {
6154
6060
  }
6155
6061
  async refreshStore() {
6156
6062
  const { store } = this.client;
6157
- const result = await this.enqueueRequest({
6063
+ const result = await this.client.enqueueRequest({
6158
6064
  description: "Get comments",
6159
6065
  method: HttpMethod.GET,
6160
6066
  // TODO: Choose between /issues/comments/in-project/${projectId}/ and /projects/${projectId}/issue-comments/
@@ -6168,7 +6074,7 @@ var __publicField = (obj, key, value) => {
6168
6074
  class IssueUpdateService extends BaseApiService {
6169
6075
  async refreshStore() {
6170
6076
  const { store } = this.client;
6171
- const result = await this.enqueueRequest({
6077
+ const result = await this.client.enqueueRequest({
6172
6078
  description: "Get issue updates",
6173
6079
  method: HttpMethod.GET,
6174
6080
  url: `/projects/${store.getState().projectReducer.activeProjectId}/issues/updates/`,
@@ -6254,7 +6160,7 @@ var __publicField = (obj, key, value) => {
6254
6160
  store.dispatch(addIssue(issuePayload));
6255
6161
  store.dispatch(addToRecentIssues(issuePayload.offline_id));
6256
6162
  store.dispatch(addActiveProjectIssuesCount(1));
6257
- const promise = this.enqueueRequest({
6163
+ const promise = this.client.enqueueRequest({
6258
6164
  description: "Create issue",
6259
6165
  method: HttpMethod.POST,
6260
6166
  url: "/issues/",
@@ -6289,7 +6195,7 @@ var __publicField = (obj, key, value) => {
6289
6195
  return [issuePayload, promise];
6290
6196
  }
6291
6197
  fetchAll(projectId) {
6292
- const promise = this.enqueueRequest({
6198
+ const promise = this.client.enqueueRequest({
6293
6199
  description: "Get issues",
6294
6200
  method: HttpMethod.GET,
6295
6201
  url: `/projects/${projectId}/issues/`,
@@ -6386,7 +6292,7 @@ var __publicField = (obj, key, value) => {
6386
6292
  changes
6387
6293
  });
6388
6294
  this.client.store.dispatch(addIssueUpdate(offlineIssueUpdate));
6389
- const promise = this.enqueueRequest({
6295
+ const promise = this.client.enqueueRequest({
6390
6296
  description: "Edit issue",
6391
6297
  method: HttpMethod.PATCH,
6392
6298
  url: `/issues/${issue.offline_id}/`,
@@ -6419,7 +6325,7 @@ var __publicField = (obj, key, value) => {
6419
6325
  if (updatesOfIssue.length > 0)
6420
6326
  dispatch(removeIssueUpdates(updatesOfIssue.map(({ offline_id }) => offline_id)));
6421
6327
  try {
6422
- return await this.enqueueRequest({
6328
+ return await this.client.enqueueRequest({
6423
6329
  description: "Delete issue",
6424
6330
  method: HttpMethod.DELETE,
6425
6331
  url: `/issues/${id}/`,
@@ -6461,7 +6367,7 @@ var __publicField = (obj, key, value) => {
6461
6367
  organization: activeOrganizationId
6462
6368
  });
6463
6369
  store.dispatch(addIssueType(offlineIssueType));
6464
- const promise = this.enqueueRequest({
6370
+ const promise = this.client.enqueueRequest({
6465
6371
  method: HttpMethod.POST,
6466
6372
  url: `/organizations/${activeOrganizationId}/issue-types/`,
6467
6373
  // Sending only whats needed here
@@ -6494,7 +6400,7 @@ var __publicField = (obj, key, value) => {
6494
6400
  ...issueTypeFields
6495
6401
  };
6496
6402
  store.dispatch(updateIssueType(offlineUpdatedIssueType));
6497
- const promise = this.enqueueRequest({
6403
+ const promise = this.client.enqueueRequest({
6498
6404
  method: HttpMethod.PATCH,
6499
6405
  url: `/issues/types/${issueTypeFields.offline_id}/`,
6500
6406
  payload: issueTypeFields,
@@ -6518,7 +6424,7 @@ var __publicField = (obj, key, value) => {
6518
6424
  const issuesOfIssueType = selectIssuesOfIssueType(issueTypeId)(state) ?? [];
6519
6425
  store.dispatch(removeIssueType(issueTypeId));
6520
6426
  store.dispatch(removeIssues(issuesOfIssueType.map((issue) => issue.offline_id)));
6521
- const promise = this.enqueueRequest({
6427
+ const promise = this.client.enqueueRequest({
6522
6428
  method: HttpMethod.DELETE,
6523
6429
  url: `/issues/types/${issueTypeId}/`,
6524
6430
  blockers: [issueTypeId],
@@ -6536,7 +6442,7 @@ var __publicField = (obj, key, value) => {
6536
6442
  if (!activeOrganizationId) {
6537
6443
  throw new Error(`No active organization, got ${activeOrganizationId} for activeOrganizationId.`);
6538
6444
  }
6539
- const result = await this.enqueueRequest({
6445
+ const result = await this.client.enqueueRequest({
6540
6446
  method: HttpMethod.GET,
6541
6447
  url: `/organizations/${activeOrganizationId}/issue-types/`,
6542
6448
  blockers: [],
@@ -6550,7 +6456,7 @@ var __publicField = (obj, key, value) => {
6550
6456
  if (replaceExisting) {
6551
6457
  this.client.store.dispatch(setIsFetchingInitialData(true));
6552
6458
  }
6553
- const result = await this.enqueueRequest({
6459
+ const result = await this.client.enqueueRequest({
6554
6460
  uuid: uuid2,
6555
6461
  description: "Get initial data",
6556
6462
  method: HttpMethod.GET,
@@ -6564,7 +6470,7 @@ var __publicField = (obj, key, value) => {
6564
6470
  }
6565
6471
  async fetchProjectUsers() {
6566
6472
  const projectId = this.client.store.getState().projectReducer.activeProjectId;
6567
- return this.enqueueRequest({
6473
+ return this.client.enqueueRequest({
6568
6474
  description: "Fetch users",
6569
6475
  method: HttpMethod.GET,
6570
6476
  url: `/projects/${projectId}/users/`,
@@ -6576,7 +6482,7 @@ var __publicField = (obj, key, value) => {
6576
6482
  });
6577
6483
  }
6578
6484
  async fetchOrganizationUsers(orgId) {
6579
- return this.enqueueRequest({
6485
+ return this.client.enqueueRequest({
6580
6486
  description: "Fetch organization users",
6581
6487
  method: HttpMethod.GET,
6582
6488
  url: `/organizations/${orgId}/users/`,
@@ -6717,7 +6623,7 @@ var __publicField = (obj, key, value) => {
6717
6623
  }
6718
6624
  class ProjectAccessService extends BaseApiService {
6719
6625
  async fetchAll(projectId) {
6720
- return this.enqueueRequest({
6626
+ return this.client.enqueueRequest({
6721
6627
  description: "Get project accesses",
6722
6628
  method: HttpMethod.GET,
6723
6629
  url: `/projects/${projectId}/access/`,
@@ -6727,7 +6633,7 @@ var __publicField = (obj, key, value) => {
6727
6633
  }
6728
6634
  async update(projectAccess) {
6729
6635
  this.client.store.dispatch(updateProjectAccess(projectAccess));
6730
- return this.enqueueRequest({
6636
+ return this.client.enqueueRequest({
6731
6637
  description: "Edit project access",
6732
6638
  method: HttpMethod.PATCH,
6733
6639
  url: `/access/${projectAccess.offline_id}/`,
@@ -6740,7 +6646,7 @@ var __publicField = (obj, key, value) => {
6740
6646
  async remove(projectAccess) {
6741
6647
  const { store } = this.client;
6742
6648
  store.dispatch(removeProjectAccess(projectAccess));
6743
- return this.enqueueRequest({
6649
+ return this.client.enqueueRequest({
6744
6650
  description: "Delete project access",
6745
6651
  method: HttpMethod.DELETE,
6746
6652
  url: `/access/${projectAccess.offline_id}/`,
@@ -6763,7 +6669,7 @@ var __publicField = (obj, key, value) => {
6763
6669
  class ProjectFileService extends BaseApiService {
6764
6670
  async refreshStore() {
6765
6671
  const { store } = this.client;
6766
- const result = await this.enqueueRequest({
6672
+ const result = await this.client.enqueueRequest({
6767
6673
  description: "Get project files",
6768
6674
  method: HttpMethod.GET,
6769
6675
  url: `/projects/${store.getState().projectReducer.activeProjectId}/files/`,
@@ -6780,7 +6686,7 @@ var __publicField = (obj, key, value) => {
6780
6686
  }
6781
6687
  const editableData = { ...file };
6782
6688
  delete editableData.file;
6783
- const promise = this.enqueueRequest({
6689
+ const promise = this.client.enqueueRequest({
6784
6690
  method: HttpMethod.PATCH,
6785
6691
  url: `/projects/files/${file.offline_id}/`,
6786
6692
  payload: editableData,
@@ -6838,7 +6744,7 @@ var __publicField = (obj, key, value) => {
6838
6744
  });
6839
6745
  }
6840
6746
  const promise = Promise.resolve(requestDetails).then((requestDetails2) => {
6841
- return this.enqueueRequest(requestDetails2);
6747
+ return this.client.enqueueRequest(requestDetails2);
6842
6748
  });
6843
6749
  void promise.then((result) => {
6844
6750
  store.dispatch(addOrReplaceProjectFile(result));
@@ -6850,7 +6756,7 @@ var __publicField = (obj, key, value) => {
6850
6756
  }
6851
6757
  delete(projectFileId) {
6852
6758
  this.client.store.dispatch(removeProjectFile(projectFileId));
6853
- return this.enqueueRequest({
6759
+ return this.client.enqueueRequest({
6854
6760
  method: HttpMethod.DELETE,
6855
6761
  url: `/projects/files/${projectFileId}`,
6856
6762
  blockers: [projectFileId],
@@ -6921,7 +6827,7 @@ var __publicField = (obj, key, value) => {
6921
6827
  }
6922
6828
  const url = isOrganizationProject ? `/organizations/${project.owner_organization}/projects/` : "/projects/";
6923
6829
  const projectType = isOrganizationProject ? { organization_owner: project.owner_organization } : { user_owner: project.owner_user };
6924
- const result = await this.enqueueRequest({
6830
+ const result = await this.client.enqueueRequest({
6925
6831
  description: "Create project",
6926
6832
  method: HttpMethod.POST,
6927
6833
  url,
@@ -6945,7 +6851,7 @@ var __publicField = (obj, key, value) => {
6945
6851
  throw new Error("Project bounds were not set before trying to create a project");
6946
6852
  }
6947
6853
  store.dispatch(updateOrCreateProject(project));
6948
- return await this.enqueueRequest({
6854
+ return await this.client.enqueueRequest({
6949
6855
  description: "Update project",
6950
6856
  method: HttpMethod.PATCH,
6951
6857
  url: `/projects/${project.id}/`,
@@ -6985,7 +6891,7 @@ var __publicField = (obj, key, value) => {
6985
6891
  store.dispatch(updateLicense({ ...license, project: null }));
6986
6892
  }
6987
6893
  try {
6988
- await this.enqueueRequest({
6894
+ await this.client.enqueueRequest({
6989
6895
  description: "Delete project",
6990
6896
  method: HttpMethod.DELETE,
6991
6897
  url: `/projects/${projectId}/`,
@@ -7008,7 +6914,7 @@ var __publicField = (obj, key, value) => {
7008
6914
  }
7009
6915
  invite(projectId, email) {
7010
6916
  const offline_id = uuid.v4();
7011
- return this.enqueueRequest({
6917
+ return this.client.enqueueRequest({
7012
6918
  description: "Invite user to project",
7013
6919
  method: HttpMethod.POST,
7014
6920
  url: `/projects/${projectId}/invite/${email}/`,
@@ -7020,7 +6926,7 @@ var __publicField = (obj, key, value) => {
7020
6926
  });
7021
6927
  }
7022
6928
  joinProject(projectId, userId, inviteCode) {
7023
- return this.enqueueRequest({
6929
+ return this.client.enqueueRequest({
7024
6930
  description: "Join project",
7025
6931
  method: HttpMethod.GET,
7026
6932
  url: `/projects/${projectId}/join-project/${userId}/${inviteCode}/`,
@@ -7030,7 +6936,7 @@ var __publicField = (obj, key, value) => {
7030
6936
  });
7031
6937
  }
7032
6938
  async acceptInvite(projectId) {
7033
- return this.enqueueRequest({
6939
+ return this.client.enqueueRequest({
7034
6940
  description: "Accept project invite",
7035
6941
  method: HttpMethod.PATCH,
7036
6942
  url: `/projects/${projectId}/accept-invite/`,
@@ -7089,7 +6995,7 @@ var __publicField = (obj, key, value) => {
7089
6995
  revision: offlineRevisionId,
7090
6996
  field_identifier: key
7091
6997
  });
7092
- const attach = await this.enqueueRequest({
6998
+ const attach = await this.client.enqueueRequest({
7093
6999
  description: "Attach image to form revision field",
7094
7000
  method: HttpMethod.POST,
7095
7001
  url: `/forms/revisions/${offlineRevisionId}/attachments/`,
@@ -7140,7 +7046,7 @@ var __publicField = (obj, key, value) => {
7140
7046
  const { store } = this.client;
7141
7047
  store.dispatch(addForm(retForm));
7142
7048
  store.dispatch(addFormRevision(retRevision));
7143
- const formPromise = this.enqueueRequest({
7049
+ const formPromise = this.client.enqueueRequest({
7144
7050
  description: "Create form",
7145
7051
  method: HttpMethod.POST,
7146
7052
  url,
@@ -7212,7 +7118,7 @@ var __publicField = (obj, key, value) => {
7212
7118
  submitted_at: (/* @__PURE__ */ new Date()).toISOString()
7213
7119
  };
7214
7120
  store.dispatch(addFormRevision(fullRevision));
7215
- const promise = this.enqueueRequest({
7121
+ const promise = this.client.enqueueRequest({
7216
7122
  description: "Create form revision",
7217
7123
  method: HttpMethod.PATCH,
7218
7124
  url: `/forms/${formId2}/`,
@@ -7237,7 +7143,7 @@ var __publicField = (obj, key, value) => {
7237
7143
  const activeProjectId = store.getState().projectReducer.activeProjectId;
7238
7144
  store.dispatch(favoriteForm({ formId: formId2 }));
7239
7145
  try {
7240
- await this.enqueueRequest({
7146
+ await this.client.enqueueRequest({
7241
7147
  description: "Favorite form",
7242
7148
  method: HttpMethod.POST,
7243
7149
  url: `/forms/${formId2}/favorite/${activeProjectId}/`,
@@ -7254,7 +7160,7 @@ var __publicField = (obj, key, value) => {
7254
7160
  const activeProjectId = store.getState().projectReducer.activeProjectId;
7255
7161
  store.dispatch(unfavoriteForm({ formId: formId2 }));
7256
7162
  try {
7257
- return await this.enqueueRequest({
7163
+ return await this.client.enqueueRequest({
7258
7164
  description: "Unfavorite form",
7259
7165
  method: HttpMethod.DELETE,
7260
7166
  url: `/forms/${formId2}/unfavorite/${activeProjectId}/`,
@@ -7283,7 +7189,7 @@ var __publicField = (obj, key, value) => {
7283
7189
  }
7284
7190
  store.dispatch(deleteForm(formId2));
7285
7191
  try {
7286
- return await this.enqueueRequest({
7192
+ return await this.client.enqueueRequest({
7287
7193
  description: "Delete form",
7288
7194
  method: HttpMethod.DELETE,
7289
7195
  url: `/forms/${formId2}/`,
@@ -7303,7 +7209,7 @@ var __publicField = (obj, key, value) => {
7303
7209
  }
7304
7210
  async refreshStore() {
7305
7211
  const { store } = this.client;
7306
- const result = await this.enqueueRequest({
7212
+ const result = await this.client.enqueueRequest({
7307
7213
  description: "Fetch user forms",
7308
7214
  method: HttpMethod.GET,
7309
7215
  url: `/forms/in-project/${store.getState().projectReducer.activeProjectId}/forms/`,
@@ -7352,7 +7258,7 @@ var __publicField = (obj, key, value) => {
7352
7258
  submission: submission.offline_id,
7353
7259
  field_identifier: key
7354
7260
  });
7355
- const attach = await this.enqueueRequest({
7261
+ const attach = await this.client.enqueueRequest({
7356
7262
  description: "Attach file to form submission",
7357
7263
  method: HttpMethod.POST,
7358
7264
  url: `/forms/submission/${submission.offline_id}/attachments/`,
@@ -7390,7 +7296,7 @@ var __publicField = (obj, key, value) => {
7390
7296
  created_by: state.userReducer.currentUser.id,
7391
7297
  submitted_at: (/* @__PURE__ */ new Date()).toISOString()
7392
7298
  };
7393
- const promise = this.enqueueRequest({
7299
+ const promise = this.client.enqueueRequest({
7394
7300
  description: "Respond to form",
7395
7301
  method: HttpMethod.POST,
7396
7302
  url: `/forms/revisions/${payload.form_revision}/respond/`,
@@ -7471,7 +7377,7 @@ var __publicField = (obj, key, value) => {
7471
7377
  }
7472
7378
  store.dispatch(addFormSubmissions(offlineSubmissions));
7473
7379
  store.dispatch(addFormSubmissionAttachments(offlineAttachments));
7474
- const promise = this.enqueueRequest({
7380
+ const promise = this.client.enqueueRequest({
7475
7381
  description: "Bulk add form submissions",
7476
7382
  method: HttpMethod.POST,
7477
7383
  url: `/forms/revisions/${formRevision}/bulk-respond/`,
@@ -7492,7 +7398,7 @@ var __publicField = (obj, key, value) => {
7492
7398
  const file = filesRecord[sha1];
7493
7399
  if (!file)
7494
7400
  continue;
7495
- void this.enqueueRequest({
7401
+ void this.client.enqueueRequest({
7496
7402
  url: presigned_url.url,
7497
7403
  description: "Upload file",
7498
7404
  method: HttpMethod.POST,
@@ -7520,7 +7426,7 @@ var __publicField = (obj, key, value) => {
7520
7426
  };
7521
7427
  const submissionToBeUpdated = store.getState().formSubmissionReducer.formSubmissions[submission.offline_id];
7522
7428
  store.dispatch(updateFormSubmission(offlineSubmission));
7523
- const promise = this.enqueueRequest({
7429
+ const promise = this.client.enqueueRequest({
7524
7430
  description: "Patch form submission",
7525
7431
  method: HttpMethod.PATCH,
7526
7432
  url: `/forms/submissions/${submission.offline_id}/`,
@@ -7546,7 +7452,7 @@ var __publicField = (obj, key, value) => {
7546
7452
  store.dispatch(addActiveProjectFormSubmissionsCount(-1));
7547
7453
  store.dispatch(deleteFormSubmissionAttachments(submissionAttachments.map((x) => x.offline_id)));
7548
7454
  try {
7549
- return await this.enqueueRequest({
7455
+ return await this.client.enqueueRequest({
7550
7456
  description: "Delete user form submissions",
7551
7457
  method: HttpMethod.DELETE,
7552
7458
  url: `/forms/submissions/${submissionId}/`,
@@ -7563,7 +7469,7 @@ var __publicField = (obj, key, value) => {
7563
7469
  async refreshStore() {
7564
7470
  const { store } = this.client;
7565
7471
  const projectId = store.getState().projectReducer.activeProjectId;
7566
- const submissions = await this.enqueueRequest({
7472
+ const submissions = await this.client.enqueueRequest({
7567
7473
  description: "Fetch form submissions",
7568
7474
  method: HttpMethod.GET,
7569
7475
  url: `/forms/in-project/${projectId}/submissions/`,
@@ -7571,7 +7477,7 @@ var __publicField = (obj, key, value) => {
7571
7477
  blocks: []
7572
7478
  });
7573
7479
  store.dispatch(setFormSubmissions(submissions));
7574
- const attachments = await this.enqueueRequest({
7480
+ const attachments = await this.client.enqueueRequest({
7575
7481
  description: "Fetch form attachments",
7576
7482
  method: HttpMethod.GET,
7577
7483
  url: `/forms/in-project/${projectId}/attachments/`,
@@ -7586,7 +7492,7 @@ var __publicField = (obj, key, value) => {
7586
7492
  const { store } = this.client;
7587
7493
  const offlineWorkspace = offline(workspace);
7588
7494
  store.dispatch(addWorkspace(offlineWorkspace));
7589
- const promise = this.enqueueRequest({
7495
+ const promise = this.client.enqueueRequest({
7590
7496
  description: "Create Workspace",
7591
7497
  method: HttpMethod.POST,
7592
7498
  url: `/projects/${store.getState().projectReducer.activeProjectId}/workspaces/`,
@@ -7604,7 +7510,7 @@ var __publicField = (obj, key, value) => {
7604
7510
  update(workspace) {
7605
7511
  const { store } = this.client;
7606
7512
  store.dispatch(addOrReplaceWorkspaces({ [workspace.offline_id]: workspace }));
7607
- const promise = this.enqueueRequest({
7513
+ const promise = this.client.enqueueRequest({
7608
7514
  description: "Update Workspace",
7609
7515
  method: HttpMethod.PATCH,
7610
7516
  url: `/workspaces/${workspace.offline_id}/`,
@@ -7616,7 +7522,7 @@ var __publicField = (obj, key, value) => {
7616
7522
  }
7617
7523
  delete(workspaceId) {
7618
7524
  const { store } = this.client;
7619
- const promise = this.enqueueRequest({
7525
+ const promise = this.client.enqueueRequest({
7620
7526
  description: "Delete Workspace",
7621
7527
  method: HttpMethod.DELETE,
7622
7528
  url: `/workspaces/${workspaceId}/`,
@@ -7638,7 +7544,7 @@ var __publicField = (obj, key, value) => {
7638
7544
  }
7639
7545
  class OrganizationAccessService extends BaseApiService {
7640
7546
  async update(organizationAccess) {
7641
- const promise = this.enqueueRequest({
7547
+ const promise = this.client.enqueueRequest({
7642
7548
  description: "Edit organization access",
7643
7549
  method: HttpMethod.PATCH,
7644
7550
  url: `/organizations/${organizationAccess.organization}/access/${organizationAccess.offline_id}/`,
@@ -7654,7 +7560,7 @@ var __publicField = (obj, key, value) => {
7654
7560
  async remove(organizationAccess) {
7655
7561
  this.client.store.dispatch(removeOrganizationAccess(organizationAccess));
7656
7562
  this.client.store.dispatch(removeUser(organizationAccess.user));
7657
- return this.enqueueRequest({
7563
+ return this.client.enqueueRequest({
7658
7564
  description: "Remove organization access",
7659
7565
  method: HttpMethod.DELETE,
7660
7566
  url: `/organizations/${organizationAccess.organization}/access/${organizationAccess.offline_id}/`,
@@ -7669,7 +7575,7 @@ var __publicField = (obj, key, value) => {
7669
7575
  if (!organizationId) {
7670
7576
  return;
7671
7577
  }
7672
- const result = await this.enqueueRequest({
7578
+ const result = await this.client.enqueueRequest({
7673
7579
  description: "Get organization accesses",
7674
7580
  method: HttpMethod.GET,
7675
7581
  url: `/organizations/${organizationId}/access/`,
@@ -7701,7 +7607,7 @@ var __publicField = (obj, key, value) => {
7701
7607
  if (!file)
7702
7608
  throw new Error(`File with sha1 ${sha1} not found in cache`);
7703
7609
  const key = await getFileS3Key(file, sha1);
7704
- const s3UploadUrl = await this.enqueueRequest({
7610
+ const s3UploadUrl = await this.client.enqueueRequest({
7705
7611
  description: "Get S3 URL",
7706
7612
  method: HttpMethod.GET,
7707
7613
  url: "/authentication/files/presigned-upload-url/",
@@ -7785,7 +7691,7 @@ var __publicField = (obj, key, value) => {
7785
7691
  throw new Error(fileUploadUrlResponse.warning);
7786
7692
  }
7787
7693
  const url = fileUploadUrlResponse.url;
7788
- const promise = this.enqueueRequest({
7694
+ const promise = this.client.enqueueRequest({
7789
7695
  url,
7790
7696
  description: "Upload file",
7791
7697
  method: HttpMethod.POST,
@@ -7827,7 +7733,7 @@ var __publicField = (obj, key, value) => {
7827
7733
  let isFirstRequest = true;
7828
7734
  if (!promise) {
7829
7735
  promise = new Promise((resolve) => {
7830
- void this.enqueueRequest({
7736
+ void this.client.enqueueRequest({
7831
7737
  description: "Download file",
7832
7738
  method: HttpMethod.GET,
7833
7739
  url,
@@ -7895,7 +7801,7 @@ var __publicField = (obj, key, value) => {
7895
7801
  blockers: [],
7896
7802
  blocks: []
7897
7803
  };
7898
- return this.enqueueRequest(requestDetails);
7804
+ return this.client.enqueueRequest(requestDetails);
7899
7805
  }
7900
7806
  validateVerificationCode(verificationCode, payload = void 0) {
7901
7807
  const requestDetails = {
@@ -7907,12 +7813,12 @@ var __publicField = (obj, key, value) => {
7907
7813
  blockers: [],
7908
7814
  blocks: []
7909
7815
  };
7910
- return this.enqueueRequest(requestDetails);
7816
+ return this.client.enqueueRequest(requestDetails);
7911
7817
  }
7912
7818
  }
7913
7819
  class EmailDomainsService extends BaseApiService {
7914
7820
  async fetchAll(orgId) {
7915
- return this.enqueueRequest({
7821
+ return this.client.enqueueRequest({
7916
7822
  description: "Fetch email domains for organization",
7917
7823
  method: HttpMethod.GET,
7918
7824
  url: `/organizations/${orgId}/email-domains/`,
@@ -7921,7 +7827,7 @@ var __publicField = (obj, key, value) => {
7921
7827
  });
7922
7828
  }
7923
7829
  async add(orgId, email) {
7924
- return this.enqueueRequest({
7830
+ return this.client.enqueueRequest({
7925
7831
  description: "Add email domain to organization",
7926
7832
  method: HttpMethod.POST,
7927
7833
  url: `/organizations/${orgId}/email-domains/`,
@@ -7932,7 +7838,7 @@ var __publicField = (obj, key, value) => {
7932
7838
  }
7933
7839
  async remove(emailDomain) {
7934
7840
  this.client.store.dispatch(removeEmailDomain(emailDomain));
7935
- return this.enqueueRequest({
7841
+ return this.client.enqueueRequest({
7936
7842
  description: "Remove email domain from organization",
7937
7843
  method: HttpMethod.DELETE,
7938
7844
  url: `/organizations/${emailDomain.organization}/email-domains/${emailDomain.offline_id}/`,
@@ -7958,7 +7864,7 @@ var __publicField = (obj, key, value) => {
7958
7864
  if (showLoading) {
7959
7865
  this.client.store.dispatch(setIsFetchingInitialData(true));
7960
7866
  }
7961
- return this.enqueueRequest({
7867
+ return this.client.enqueueRequest({
7962
7868
  description: "Get initial organization data",
7963
7869
  method: HttpMethod.GET,
7964
7870
  url: `/organizations/${organizationId}/initial-data/`,
@@ -7986,7 +7892,7 @@ var __publicField = (obj, key, value) => {
7986
7892
  }
7987
7893
  }
7988
7894
  async create(name) {
7989
- const result = await this.enqueueRequest({
7895
+ const result = await this.client.enqueueRequest({
7990
7896
  description: "Create organization",
7991
7897
  method: HttpMethod.POST,
7992
7898
  url: "/organizations/",
@@ -7998,7 +7904,7 @@ var __publicField = (obj, key, value) => {
7998
7904
  return result;
7999
7905
  }
8000
7906
  async update(organization) {
8001
- const promise = this.enqueueRequest({
7907
+ const promise = this.client.enqueueRequest({
8002
7908
  description: "Edit organization",
8003
7909
  method: HttpMethod.PATCH,
8004
7910
  url: `/organizations/${organization.id}/`,
@@ -8012,7 +7918,7 @@ var __publicField = (obj, key, value) => {
8012
7918
  });
8013
7919
  }
8014
7920
  async invite(organizationId, email) {
8015
- return this.enqueueRequest({
7921
+ return this.client.enqueueRequest({
8016
7922
  description: "Invite user to organization",
8017
7923
  method: HttpMethod.POST,
8018
7924
  url: `/organizations/${organizationId}/invite/${email}/`,
@@ -8026,7 +7932,7 @@ var __publicField = (obj, key, value) => {
8026
7932
  if (showLoading) {
8027
7933
  this.client.store.dispatch(setIsFetchingInitialData(true));
8028
7934
  }
8029
- const result = await this.enqueueRequest({
7935
+ const result = await this.client.enqueueRequest({
8030
7936
  description: "Get licenses",
8031
7937
  method: HttpMethod.GET,
8032
7938
  url: `/organizations/${organizationId}/licenses/`,
@@ -8041,7 +7947,7 @@ var __publicField = (obj, key, value) => {
8041
7947
  return result;
8042
7948
  }
8043
7949
  async getLicense(license) {
8044
- const result = await this.enqueueRequest({
7950
+ const result = await this.client.enqueueRequest({
8045
7951
  description: "Get license",
8046
7952
  method: HttpMethod.GET,
8047
7953
  url: `/billing/${license.offline_id}/`,
@@ -8055,7 +7961,7 @@ var __publicField = (obj, key, value) => {
8055
7961
  return result;
8056
7962
  }
8057
7963
  async pauseLicense(license) {
8058
- const result = await this.enqueueRequest({
7964
+ const result = await this.client.enqueueRequest({
8059
7965
  description: "Pause license",
8060
7966
  method: HttpMethod.DELETE,
8061
7967
  url: `/billing/${license.offline_id}/suspend/`,
@@ -8069,7 +7975,7 @@ var __publicField = (obj, key, value) => {
8069
7975
  return result;
8070
7976
  }
8071
7977
  async resumeLicense(license) {
8072
- const result = await this.enqueueRequest({
7978
+ const result = await this.client.enqueueRequest({
8073
7979
  description: "Resume license",
8074
7980
  method: HttpMethod.PATCH,
8075
7981
  url: `/billing/${license.offline_id}/suspend/`,
@@ -8083,7 +7989,7 @@ var __publicField = (obj, key, value) => {
8083
7989
  return result;
8084
7990
  }
8085
7991
  async cancelLicense(license) {
8086
- const result = await this.enqueueRequest({
7992
+ const result = await this.client.enqueueRequest({
8087
7993
  description: "Cancel license",
8088
7994
  method: HttpMethod.DELETE,
8089
7995
  url: `/billing/${license.offline_id}/`,
@@ -8097,7 +8003,7 @@ var __publicField = (obj, key, value) => {
8097
8003
  return result;
8098
8004
  }
8099
8005
  async attachLicenseToProject(license, project) {
8100
- const result = await this.enqueueRequest({
8006
+ const result = await this.client.enqueueRequest({
8101
8007
  description: "Attach license",
8102
8008
  method: HttpMethod.PATCH,
8103
8009
  url: `/billing/${license.offline_id}/project/`,
@@ -8113,7 +8019,7 @@ var __publicField = (obj, key, value) => {
8113
8019
  return result;
8114
8020
  }
8115
8021
  async detachLicenseFromProject(license) {
8116
- const result = await this.enqueueRequest({
8022
+ const result = await this.client.enqueueRequest({
8117
8023
  description: "Detach license",
8118
8024
  method: HttpMethod.DELETE,
8119
8025
  url: `/billing/${license.offline_id}/project/`,
@@ -8127,7 +8033,7 @@ var __publicField = (obj, key, value) => {
8127
8033
  return result;
8128
8034
  }
8129
8035
  async getLatestTransaction(license) {
8130
- return await this.enqueueRequest({
8036
+ return await this.client.enqueueRequest({
8131
8037
  description: "Get latest transaction",
8132
8038
  method: HttpMethod.GET,
8133
8039
  url: `/billing/${license.offline_id}/transaction/`,
@@ -8155,7 +8061,7 @@ var __publicField = (obj, key, value) => {
8155
8061
  children_documents: []
8156
8062
  };
8157
8063
  store.dispatch(addDocuments([submittedDocument]));
8158
- const promise = this.enqueueRequest({
8064
+ const promise = this.client.enqueueRequest({
8159
8065
  description: "Create Document",
8160
8066
  method: HttpMethod.POST,
8161
8067
  url: `/projects/${activeProjectId}/documents/`,
@@ -8181,7 +8087,7 @@ var __publicField = (obj, key, value) => {
8181
8087
  );
8182
8088
  }
8183
8089
  store.dispatch(updateDocuments([document2]));
8184
- const promise = this.enqueueRequest({
8090
+ const promise = this.client.enqueueRequest({
8185
8091
  description: "Update Document",
8186
8092
  method: HttpMethod.PATCH,
8187
8093
  url: `/documents/${document2.offline_id}/`,
@@ -8222,7 +8128,7 @@ var __publicField = (obj, key, value) => {
8222
8128
  }
8223
8129
  }
8224
8130
  store.dispatch(moveDocument({ documentId, targetDocumentId, position }));
8225
- const promise = this.enqueueRequest({
8131
+ const promise = this.client.enqueueRequest({
8226
8132
  description: "Move Document",
8227
8133
  method: HttpMethod.PATCH,
8228
8134
  url: `/documents/${documentId}/move/`,
@@ -8251,7 +8157,7 @@ var __publicField = (obj, key, value) => {
8251
8157
  }
8252
8158
  const parentDocument = documentToBeDeleted.parent_document ? documentsMapping[documentToBeDeleted.parent_document] : void 0;
8253
8159
  store.dispatch(removeDocuments([documentId]));
8254
- const promise = this.enqueueRequest({
8160
+ const promise = this.client.enqueueRequest({
8255
8161
  description: "Delete Document",
8256
8162
  method: HttpMethod.DELETE,
8257
8163
  url: `/documents/${documentId}/`,
@@ -8272,7 +8178,7 @@ var __publicField = (obj, key, value) => {
8272
8178
  const { store } = this.client;
8273
8179
  const state = store.getState();
8274
8180
  const activeProjectId = state.projectReducer.activeProjectId;
8275
- const projectDocumentsPromise = this.enqueueRequest({
8181
+ const projectDocumentsPromise = this.client.enqueueRequest({
8276
8182
  description: "Get project documents",
8277
8183
  method: HttpMethod.GET,
8278
8184
  url: `/projects/${activeProjectId}/documents/`,
@@ -8280,7 +8186,7 @@ var __publicField = (obj, key, value) => {
8280
8186
  blocks: []
8281
8187
  });
8282
8188
  const activeOrganizationId = state.organizationReducer.activeOrganizationId;
8283
- const organizationDocumentsPromise = this.enqueueRequest({
8189
+ const organizationDocumentsPromise = this.client.enqueueRequest({
8284
8190
  description: "Get organization documents",
8285
8191
  method: HttpMethod.GET,
8286
8192
  url: `/organizations/${activeOrganizationId}/documents/`,
@@ -8336,7 +8242,7 @@ var __publicField = (obj, key, value) => {
8336
8242
  class AgentService extends BaseApiService {
8337
8243
  async startConversation(prompt) {
8338
8244
  const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
8339
- return this.enqueueRequest({
8245
+ return this.client.enqueueRequest({
8340
8246
  description: "Start agent conversation",
8341
8247
  method: HttpMethod.POST,
8342
8248
  url: "/agents/prompt/",
@@ -8362,7 +8268,7 @@ var __publicField = (obj, key, value) => {
8362
8268
  async continueConversation(prompt, conversationId) {
8363
8269
  const { store } = this.client;
8364
8270
  const activeProjectId = store.getState().projectReducer.activeProjectId;
8365
- return this.enqueueRequest({
8271
+ return this.client.enqueueRequest({
8366
8272
  description: "Prompt agent",
8367
8273
  method: HttpMethod.POST,
8368
8274
  url: "/agents/prompt/",
@@ -8390,7 +8296,7 @@ var __publicField = (obj, key, value) => {
8390
8296
  });
8391
8297
  }
8392
8298
  async fetchDetails(conversationId) {
8393
- return this.enqueueRequest({
8299
+ return this.client.enqueueRequest({
8394
8300
  description: "Get agent conversation",
8395
8301
  method: HttpMethod.GET,
8396
8302
  url: `/agents/conversations/${conversationId}/`,
@@ -8401,7 +8307,7 @@ var __publicField = (obj, key, value) => {
8401
8307
  });
8402
8308
  }
8403
8309
  async rate(responseId, rating) {
8404
- return this.enqueueRequest({
8310
+ return this.client.enqueueRequest({
8405
8311
  description: "Rate agent response",
8406
8312
  method: HttpMethod.PUT,
8407
8313
  url: `/agents/responses/${responseId}/rate/`,
@@ -8413,7 +8319,7 @@ var __publicField = (obj, key, value) => {
8413
8319
  async refreshStore() {
8414
8320
  const { store } = this.client;
8415
8321
  const activeProject = store.getState().projectReducer.activeProjectId;
8416
- const result = await this.enqueueRequest({
8322
+ const result = await this.client.enqueueRequest({
8417
8323
  description: "Get agent conversation history",
8418
8324
  method: HttpMethod.GET,
8419
8325
  url: `/projects/${activeProject}/agent-conversations/`,
@@ -8439,7 +8345,7 @@ var __publicField = (obj, key, value) => {
8439
8345
  // created_by: state.userReducer.currentUser.id,
8440
8346
  });
8441
8347
  store.dispatch(addTeam(offlineTeam));
8442
- const promise = this.enqueueRequest({
8348
+ const promise = this.client.enqueueRequest({
8443
8349
  description: "Create team",
8444
8350
  method: HttpMethod.POST,
8445
8351
  url: `/organizations/${activeOrganizationId}/teams/`,
@@ -8464,7 +8370,7 @@ var __publicField = (obj, key, value) => {
8464
8370
  ...team
8465
8371
  };
8466
8372
  store.dispatch(updateTeam(offlineUpdatedTeam));
8467
- const promise = this.enqueueRequest({
8373
+ const promise = this.client.enqueueRequest({
8468
8374
  description: "Update team",
8469
8375
  method: HttpMethod.PATCH,
8470
8376
  url: `/organizations/teams/${team.offline_id}/`,
@@ -8488,7 +8394,7 @@ var __publicField = (obj, key, value) => {
8488
8394
  }
8489
8395
  store.dispatch(deleteTeam(teamId));
8490
8396
  try {
8491
- return await this.enqueueRequest({
8397
+ return await this.client.enqueueRequest({
8492
8398
  description: "Delete team",
8493
8399
  method: HttpMethod.DELETE,
8494
8400
  url: `/organizations/teams/${teamId}/`,
@@ -8510,7 +8416,7 @@ var __publicField = (obj, key, value) => {
8510
8416
  throw new Error("Duplicate members found in the list");
8511
8417
  }
8512
8418
  store.dispatch(updateTeam({ ...team, members }));
8513
- const promise = this.enqueueRequest({
8419
+ const promise = this.client.enqueueRequest({
8514
8420
  description: "Set team members",
8515
8421
  method: HttpMethod.PUT,
8516
8422
  url: `/organizations/teams/${teamId}/set-members/`,
@@ -8549,7 +8455,7 @@ var __publicField = (obj, key, value) => {
8549
8455
  if (!activeOrganizationId) {
8550
8456
  throw new Error(`Expected active organization to be set, got ${activeOrganizationId}`);
8551
8457
  }
8552
- const result = await this.enqueueRequest({
8458
+ const result = await this.client.enqueueRequest({
8553
8459
  description: "Fetch teams",
8554
8460
  method: HttpMethod.GET,
8555
8461
  url: `/organizations/${activeOrganizationId}/teams/`,
@@ -8559,6 +8465,46 @@ var __publicField = (obj, key, value) => {
8559
8465
  store.dispatch(setTeams(result));
8560
8466
  }
8561
8467
  }
8468
+ class DeferredPromise {
8469
+ constructor() {
8470
+ __publicField(this, _a, "Promise");
8471
+ __publicField(this, "_promise");
8472
+ __publicField(this, "_resolve");
8473
+ __publicField(this, "_reject");
8474
+ __publicField(this, "_state", "pending");
8475
+ this._resolve = null;
8476
+ this._reject = null;
8477
+ this._promise = new Promise((resolve, reject) => {
8478
+ this._resolve = resolve;
8479
+ this._reject = reject;
8480
+ });
8481
+ }
8482
+ get state() {
8483
+ return this._state;
8484
+ }
8485
+ then(onFulfilled, onRejected) {
8486
+ return this._promise.then(onFulfilled, onRejected);
8487
+ }
8488
+ catch(onRejected) {
8489
+ return this._promise.catch(onRejected);
8490
+ }
8491
+ resolve(value) {
8492
+ if (!this._resolve)
8493
+ throw new Error("No resolve callback");
8494
+ this._resolve(value);
8495
+ this._state = "fulfilled";
8496
+ }
8497
+ reject(reason) {
8498
+ if (!this._reject)
8499
+ throw reason;
8500
+ this._reject(reason);
8501
+ this._state = "rejected";
8502
+ }
8503
+ finally(_onFinally) {
8504
+ throw new Error("`finally` not implemented");
8505
+ }
8506
+ }
8507
+ _a = Symbol.toStringTag;
8562
8508
  class OvermapSDK {
8563
8509
  constructor(apiUrl, store) {
8564
8510
  __publicField(this, "API_URL");
@@ -8597,6 +8543,87 @@ var __publicField = (obj, key, value) => {
8597
8543
  this.API_URL = apiUrl;
8598
8544
  this.store = store;
8599
8545
  }
8546
+ /**
8547
+ * Enqueues an API request to the offline outbox.
8548
+ * @param requestDetails An SDKRequest object containing the details of the request.
8549
+ * @protected
8550
+ */
8551
+ async enqueueRequest(requestDetails) {
8552
+ return this._enqueueRequest(requestDetails).then((result) => {
8553
+ if (result instanceof APIError) {
8554
+ throw result;
8555
+ }
8556
+ return result;
8557
+ });
8558
+ }
8559
+ /**
8560
+ * Enqueues an API request to the Redux Offline outbox
8561
+ * @protected
8562
+ */
8563
+ _enqueueRequest(requestDetails) {
8564
+ const promise = new DeferredPromise();
8565
+ const requestDetailsWithBaseUrl = { ...requestDetails, BASE_URL: this.API_URL };
8566
+ if (requestDetails.immediate) {
8567
+ const requestWithUuid = {
8568
+ ...requestDetailsWithBaseUrl,
8569
+ uuid: requestDetails.uuid ?? uuid.v4()
8570
+ };
8571
+ const fullOfflineAction = {
8572
+ payload: requestWithUuid,
8573
+ type: "",
8574
+ meta: {
8575
+ offline: {
8576
+ effect: {
8577
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
8578
+ request: requestWithUuid,
8579
+ BASE_URL: this.API_URL
8580
+ }
8581
+ }
8582
+ }
8583
+ };
8584
+ performRequest(fullOfflineAction, this).then((result) => {
8585
+ promise.resolve(result.body);
8586
+ }).catch((error2) => {
8587
+ discard(error2, fullOfflineAction);
8588
+ promise.reject(error2);
8589
+ });
8590
+ } else {
8591
+ const innerPromise = this.store.dispatch(
8592
+ enqueueRequest(requestDetailsWithBaseUrl)
8593
+ );
8594
+ const successOrUndefinedHandler = (response) => {
8595
+ if (response) {
8596
+ promise.resolve(response.body);
8597
+ } else {
8598
+ const error2 = new APIError({
8599
+ message: "Could not get a response from the server.",
8600
+ response,
8601
+ discard: true
8602
+ });
8603
+ promise.reject(error2);
8604
+ }
8605
+ };
8606
+ const errorHandler = (error2) => {
8607
+ if (error2 instanceof APIError) {
8608
+ error2.options.discard = true;
8609
+ } else {
8610
+ console.error(
8611
+ "Received an unexpected error while processing a request:",
8612
+ error2,
8613
+ "\nConverting error to APIError and discarding."
8614
+ );
8615
+ error2 = new APIError({
8616
+ message: "An error occurred while processing the request.",
8617
+ innerError: error2,
8618
+ discard: true
8619
+ });
8620
+ }
8621
+ promise.reject(error2);
8622
+ };
8623
+ innerPromise.then(successOrUndefinedHandler, errorHandler);
8624
+ }
8625
+ return promise;
8626
+ }
8600
8627
  }
8601
8628
  const makeClient = (apiUrl, store) => new OvermapSDK(apiUrl, store);
8602
8629
  const SDKContext = React.createContext({});
@@ -15647,7 +15674,7 @@ var __publicField = (obj, key, value) => {
15647
15674
  const formId = "form-builder";
15648
15675
  const fieldsToChoose = [
15649
15676
  ["string", "text"],
15650
- ["select", "multi-select", "upload"],
15677
+ ["select", "multi-select", "upload", "qr"],
15651
15678
  ["boolean", "date", "number", "multi-string"]
15652
15679
  ];
15653
15680
  const CompleteFieldTypeToClsMapping = {