@overmap-ai/core 1.0.54 → 1.0.56
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/README.md +4 -4
- package/dist/overmap-core.js +835 -714
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +839 -718
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/classes/OutboxCoordinator.d.ts +1 -1
- package/dist/sdk/sdk.d.ts +14 -2
- package/dist/sdk/services/AgentService.d.ts +6 -13
- package/dist/sdk/services/BaseApiService.d.ts +0 -12
- package/dist/sdk/services/ComponentService.d.ts +1 -1
- package/dist/sdk/services/MainService.d.ts +4 -11
- package/dist/store/slices/agentsSlice.d.ts +16 -0
- package/dist/store/slices/categorySlice.d.ts +1 -0
- package/dist/store/slices/componentSlice.d.ts +1 -1
- package/dist/store/slices/documentSlice.d.ts +1 -0
- package/dist/store/slices/formRevisionSlice.d.ts +1 -0
- package/dist/store/slices/index.d.ts +1 -0
- package/dist/store/slices/issueSlice.d.ts +1 -0
- package/dist/store/slices/projectFileSlice.d.ts +1 -0
- package/dist/store/slices/workspaceSlice.d.ts +1 -0
- package/dist/store/store.d.ts +6 -2
- package/dist/typings/models/agents.d.ts +26 -0
- package/dist/typings/models/base.d.ts +5 -0
- package/dist/typings/models/index.d.ts +1 -0
- package/package.json +153 -153
|
@@ -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("
|
|
9
|
-
})(this, function(exports2, React, jsxRuntime, blocks, dependencyGraph, reduxOffline, offlineConfig, localforage, createMigration, toolkit, request, reactRedux,
|
|
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
|
|
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
|
|
272
|
-
constructor() {
|
|
273
|
-
__publicField(this,
|
|
274
|
-
|
|
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
|
-
|
|
289
|
-
|
|
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
|
-
|
|
292
|
-
|
|
285
|
+
let fileType = file.type;
|
|
286
|
+
if (fileType.includes("/")) {
|
|
287
|
+
fileType = fileType.split("/")[1];
|
|
293
288
|
}
|
|
294
|
-
|
|
295
|
-
|
|
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
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
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
|
-
|
|
307
|
-
|
|
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");
|
|
@@ -668,15 +734,15 @@ var __publicField = (obj, key, value) => {
|
|
|
668
734
|
};
|
|
669
735
|
const migrations = [initialVersioning, signOut, signOut, createOutboxState];
|
|
670
736
|
const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
|
|
671
|
-
const initialState$
|
|
737
|
+
const initialState$s = {
|
|
672
738
|
accessToken: "",
|
|
673
739
|
refreshToken: "",
|
|
674
740
|
isLoggedIn: false
|
|
675
741
|
};
|
|
676
742
|
const authSlice = toolkit.createSlice({
|
|
677
743
|
name: "auth",
|
|
678
|
-
initialState: initialState$
|
|
679
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
744
|
+
initialState: initialState$s,
|
|
745
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$s)),
|
|
680
746
|
reducers: {
|
|
681
747
|
setTokens: (state, action) => {
|
|
682
748
|
state.accessToken = action.payload.accessToken;
|
|
@@ -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];
|
|
@@ -1420,7 +1386,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1420
1386
|
return getLocalDateString(date);
|
|
1421
1387
|
return relative.format(days, "days");
|
|
1422
1388
|
});
|
|
1423
|
-
const initialState$
|
|
1389
|
+
const initialState$r = {
|
|
1424
1390
|
categories: {},
|
|
1425
1391
|
usedCategoryColors: [],
|
|
1426
1392
|
categoryVisibility: {
|
|
@@ -1430,8 +1396,8 @@ var __publicField = (obj, key, value) => {
|
|
|
1430
1396
|
};
|
|
1431
1397
|
const categorySlice = toolkit.createSlice({
|
|
1432
1398
|
name: "categories",
|
|
1433
|
-
initialState: initialState$
|
|
1434
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1399
|
+
initialState: initialState$r,
|
|
1400
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$r)),
|
|
1435
1401
|
reducers: {
|
|
1436
1402
|
setCategories: (state, action) => {
|
|
1437
1403
|
if (!Array.isArray(action.payload))
|
|
@@ -1615,17 +1581,142 @@ var __publicField = (obj, key, value) => {
|
|
|
1615
1581
|
delete state.attachments[attachmentId];
|
|
1616
1582
|
}
|
|
1617
1583
|
}
|
|
1618
|
-
const initialState$
|
|
1619
|
-
|
|
1584
|
+
const initialState$q = {
|
|
1585
|
+
componentTypes: {},
|
|
1586
|
+
hiddenComponentTypeIds: {},
|
|
1620
1587
|
attachments: {}
|
|
1621
1588
|
};
|
|
1622
|
-
const
|
|
1623
|
-
name: "
|
|
1624
|
-
initialState: initialState$
|
|
1625
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1589
|
+
const componentTypeSlice = toolkit.createSlice({
|
|
1590
|
+
name: "componentTypes",
|
|
1591
|
+
initialState: initialState$q,
|
|
1592
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
|
|
1626
1593
|
reducers: {
|
|
1627
|
-
|
|
1628
|
-
state.
|
|
1594
|
+
addComponentType: (state, action) => {
|
|
1595
|
+
state.componentTypes[action.payload.offline_id] = action.payload;
|
|
1596
|
+
},
|
|
1597
|
+
setComponentTypes: (state, action) => {
|
|
1598
|
+
state.componentTypes = toOfflineIdRecord(action.payload);
|
|
1599
|
+
},
|
|
1600
|
+
toggleComponentTypeVisibility: (state, action) => {
|
|
1601
|
+
state.hiddenComponentTypeIds[action.payload] = !state.hiddenComponentTypeIds[action.payload];
|
|
1602
|
+
},
|
|
1603
|
+
deleteComponentType: (state, action) => {
|
|
1604
|
+
delete state.componentTypes[action.payload];
|
|
1605
|
+
},
|
|
1606
|
+
// Attachments
|
|
1607
|
+
setComponentTypeAttachment: setAttachment,
|
|
1608
|
+
setComponentTypeAttachments: setAttachments,
|
|
1609
|
+
addComponentTypeAttachment: addAttachment,
|
|
1610
|
+
addComponentTypeAttachments: addAttachments,
|
|
1611
|
+
updateComponentTypeAttachment: updateAttachment,
|
|
1612
|
+
updateComponentTypeAttachments: updateAttachments,
|
|
1613
|
+
removeComponentTypeAttachment: removeAttachment,
|
|
1614
|
+
removeComponentTypeAttachments: removeAttachments
|
|
1615
|
+
}
|
|
1616
|
+
});
|
|
1617
|
+
const {
|
|
1618
|
+
addComponentType,
|
|
1619
|
+
setComponentTypes,
|
|
1620
|
+
toggleComponentTypeVisibility,
|
|
1621
|
+
deleteComponentType,
|
|
1622
|
+
// Attachmet
|
|
1623
|
+
setComponentTypeAttachment,
|
|
1624
|
+
setComponentTypeAttachments,
|
|
1625
|
+
addComponentTypeAttachment,
|
|
1626
|
+
addComponentTypeAttachments,
|
|
1627
|
+
updateComponentTypeAttachment,
|
|
1628
|
+
updateComponentTypeAttachments,
|
|
1629
|
+
removeComponentTypeAttachment,
|
|
1630
|
+
removeComponentTypeAttachments
|
|
1631
|
+
} = componentTypeSlice.actions;
|
|
1632
|
+
const selectComponentTypesMapping = (state) => state.componentTypeReducer.componentTypes;
|
|
1633
|
+
const selectComponentTypes = toolkit.createSelector(
|
|
1634
|
+
[selectComponentTypesMapping],
|
|
1635
|
+
(mapping) => Object.values(mapping)
|
|
1636
|
+
);
|
|
1637
|
+
const selectComponentType = restructureCreateSelectorWithArgs(
|
|
1638
|
+
toolkit.createSelector([selectComponentTypesMapping, (_state, id) => id], (mapping, id) => mapping[id])
|
|
1639
|
+
);
|
|
1640
|
+
const selectNumberOfComponentTypesMatchingCaseInsensitiveName = restructureCreateSelectorWithArgs(
|
|
1641
|
+
toolkit.createSelector(
|
|
1642
|
+
[
|
|
1643
|
+
selectComponentTypesMapping,
|
|
1644
|
+
(_state, args) => args
|
|
1645
|
+
],
|
|
1646
|
+
(mapping, args) => {
|
|
1647
|
+
var _a2;
|
|
1648
|
+
const name = ((_a2 = args.name) == null ? void 0 : _a2.toLowerCase()) ?? null;
|
|
1649
|
+
return Object.values(mapping).filter(
|
|
1650
|
+
(componentType) => {
|
|
1651
|
+
var _a3;
|
|
1652
|
+
return (((_a3 = componentType.name) == null ? void 0 : _a3.toLowerCase()) ?? null) === name && componentType.offline_id !== args.componentTypeId;
|
|
1653
|
+
}
|
|
1654
|
+
).length;
|
|
1655
|
+
}
|
|
1656
|
+
)
|
|
1657
|
+
);
|
|
1658
|
+
const selectComponentTypesByName = restructureCreateSelectorWithArgs(
|
|
1659
|
+
toolkit.createSelector(
|
|
1660
|
+
[selectComponentTypesMapping, (_state, name) => name],
|
|
1661
|
+
(mapping, name) => {
|
|
1662
|
+
name = (name == null ? void 0 : name.toLowerCase()) ?? null;
|
|
1663
|
+
return Object.values(mapping).filter(
|
|
1664
|
+
(componentType) => {
|
|
1665
|
+
var _a2;
|
|
1666
|
+
return (((_a2 = componentType.name) == null ? void 0 : _a2.toLowerCase()) ?? null) === name;
|
|
1667
|
+
}
|
|
1668
|
+
);
|
|
1669
|
+
}
|
|
1670
|
+
)
|
|
1671
|
+
);
|
|
1672
|
+
const selectHiddenComponentTypeIds = (state) => state.componentTypeReducer.hiddenComponentTypeIds;
|
|
1673
|
+
const selectComponentTypeAttachmentMapping = (state) => state.componentTypeReducer.attachments;
|
|
1674
|
+
const selectAllComponentTypeAttachments = toolkit.createSelector(
|
|
1675
|
+
[selectComponentTypeAttachmentMapping],
|
|
1676
|
+
(mapping) => Object.values(mapping)
|
|
1677
|
+
);
|
|
1678
|
+
const selectComponentTypeAttachment = (attachmentId) => (state) => {
|
|
1679
|
+
return state.componentTypeReducer.attachments[attachmentId];
|
|
1680
|
+
};
|
|
1681
|
+
const selectAttachmentsOfComponentType = restructureCreateSelectorWithArgs(
|
|
1682
|
+
toolkit.createSelector(
|
|
1683
|
+
[selectAllComponentTypeAttachments, (_state, componentTypeId) => componentTypeId],
|
|
1684
|
+
(attachments, componentTypeId) => {
|
|
1685
|
+
return attachments.filter(({ component_type }) => componentTypeId === component_type);
|
|
1686
|
+
}
|
|
1687
|
+
)
|
|
1688
|
+
);
|
|
1689
|
+
const selectAttachmentsOfComponentTypeByType = restructureCreateSelectorWithArgs(
|
|
1690
|
+
toolkit.createSelector(
|
|
1691
|
+
[selectAllComponentTypeAttachments, (_state, componentTypeId) => componentTypeId],
|
|
1692
|
+
(attachments, componentTypeId) => {
|
|
1693
|
+
const attachmentsOfComponent = attachments.filter(
|
|
1694
|
+
({ component_type }) => component_type === componentTypeId
|
|
1695
|
+
);
|
|
1696
|
+
const fileAttachments = attachmentsOfComponent.filter(
|
|
1697
|
+
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1698
|
+
({ file_type }) => !file_type || !file_type.startsWith("image/")
|
|
1699
|
+
);
|
|
1700
|
+
const imageAttachments = attachmentsOfComponent.filter(
|
|
1701
|
+
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1702
|
+
({ file_type }) => file_type && file_type.startsWith("image/")
|
|
1703
|
+
);
|
|
1704
|
+
return { fileAttachments, imageAttachments };
|
|
1705
|
+
}
|
|
1706
|
+
)
|
|
1707
|
+
);
|
|
1708
|
+
const componentTypeReducer = componentTypeSlice.reducer;
|
|
1709
|
+
const initialState$p = {
|
|
1710
|
+
components: {},
|
|
1711
|
+
attachments: {}
|
|
1712
|
+
};
|
|
1713
|
+
const componentSlice = toolkit.createSlice({
|
|
1714
|
+
name: "components",
|
|
1715
|
+
initialState: initialState$p,
|
|
1716
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
|
|
1717
|
+
reducers: {
|
|
1718
|
+
addComponent: (state, action) => {
|
|
1719
|
+
state.components[action.payload.offline_id] = action.payload;
|
|
1629
1720
|
prevComponents = null;
|
|
1630
1721
|
},
|
|
1631
1722
|
addComponentsInBatches: (state, action) => {
|
|
@@ -1697,36 +1788,41 @@ var __publicField = (obj, key, value) => {
|
|
|
1697
1788
|
return prevComponents;
|
|
1698
1789
|
};
|
|
1699
1790
|
const selectComponentsMapping = (state) => state.componentReducer.components;
|
|
1700
|
-
const selectComponentsFromComponentType = (
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1791
|
+
const selectComponentsFromComponentType = restructureCreateSelectorWithArgs(
|
|
1792
|
+
toolkit.createSelector(
|
|
1793
|
+
[selectComponents, (_state, componentTypeId) => componentTypeId],
|
|
1794
|
+
(components, componentTypeId) => {
|
|
1795
|
+
if (!componentTypeId)
|
|
1796
|
+
return [];
|
|
1797
|
+
return components.filter((component) => component.component_type === componentTypeId);
|
|
1798
|
+
}
|
|
1799
|
+
)
|
|
1800
|
+
);
|
|
1706
1801
|
const selectComponent = (componentId) => (state) => {
|
|
1707
1802
|
return state.componentReducer.components[componentId];
|
|
1708
1803
|
};
|
|
1709
1804
|
const selectComponentTypeFromComponent = (componentTypeId) => (state) => {
|
|
1710
1805
|
return state.componentTypeReducer.componentTypes[componentTypeId];
|
|
1711
1806
|
};
|
|
1712
|
-
const selectComponentTypeFromComponents = (
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1807
|
+
const selectComponentTypeFromComponents = toolkit.createSelector(
|
|
1808
|
+
[selectComponents, selectComponentTypesMapping],
|
|
1809
|
+
(components, componentTypeMapping) => {
|
|
1810
|
+
const ret = {};
|
|
1811
|
+
for (const component of components) {
|
|
1812
|
+
const componentType = componentTypeMapping[component.component_type];
|
|
1813
|
+
if (!componentType) {
|
|
1814
|
+
console.error(
|
|
1815
|
+
`Component type with ID ${component.component_type} not found.
|
|
1721
1816
|
Expected all referenced component types to be populated.
|
|
1722
1817
|
Returning empty object to avoid fatal errors.`
|
|
1723
|
-
|
|
1724
|
-
|
|
1818
|
+
);
|
|
1819
|
+
return {};
|
|
1820
|
+
}
|
|
1821
|
+
ret[component.offline_id] = componentType;
|
|
1725
1822
|
}
|
|
1726
|
-
ret
|
|
1823
|
+
return ret;
|
|
1727
1824
|
}
|
|
1728
|
-
|
|
1729
|
-
};
|
|
1825
|
+
);
|
|
1730
1826
|
const selectComponentsByType = restructureCreateSelectorWithArgs(
|
|
1731
1827
|
toolkit.createSelector(
|
|
1732
1828
|
[selectComponents, (_state, componentTypeId) => componentTypeId],
|
|
@@ -1875,220 +1971,95 @@ var __publicField = (obj, key, value) => {
|
|
|
1875
1971
|
const stage = state.stages[stageId];
|
|
1876
1972
|
if (!stage) {
|
|
1877
1973
|
throw new Error("No stage exists with the id " + stageId);
|
|
1878
|
-
}
|
|
1879
|
-
delete stage.user_form;
|
|
1880
|
-
}
|
|
1881
|
-
}
|
|
1882
|
-
});
|
|
1883
|
-
const selectStageMapping = (state) => state.componentStageReducer.stages;
|
|
1884
|
-
const selectStage = restructureCreateSelectorWithArgs(
|
|
1885
|
-
toolkit.createSelector([selectStageMapping, (_state, stageId) => stageId], (stageMapping, stageId) => {
|
|
1886
|
-
return stageMapping[stageId];
|
|
1887
|
-
})
|
|
1888
|
-
);
|
|
1889
|
-
const selectStages = toolkit.createSelector(
|
|
1890
|
-
[selectStageMapping],
|
|
1891
|
-
(stageMapping) => {
|
|
1892
|
-
return Object.values(stageMapping);
|
|
1893
|
-
}
|
|
1894
|
-
);
|
|
1895
|
-
const selectStagesFromComponentTypeIds = restructureCreateSelectorWithArgs(
|
|
1896
|
-
toolkit.createSelector(
|
|
1897
|
-
[selectStages, (_state, componentTypeIds) => componentTypeIds],
|
|
1898
|
-
(stages, componentTypeIds) => {
|
|
1899
|
-
const componentTypeIdsSet = new Set(componentTypeIds);
|
|
1900
|
-
const ret = {};
|
|
1901
|
-
for (const stage of stages) {
|
|
1902
|
-
if (componentTypeIdsSet.has(stage.component_type)) {
|
|
1903
|
-
if (!ret[stage.component_type]) {
|
|
1904
|
-
ret[stage.component_type] = [];
|
|
1905
|
-
}
|
|
1906
|
-
ret[stage.component_type].push(stage);
|
|
1907
|
-
}
|
|
1908
|
-
}
|
|
1909
|
-
for (const key in ret) {
|
|
1910
|
-
ret[key] = ret[key].sort((a, b) => a.priority - b.priority);
|
|
1911
|
-
}
|
|
1912
|
-
return ret;
|
|
1913
|
-
}
|
|
1914
|
-
)
|
|
1915
|
-
);
|
|
1916
|
-
const selectComponentTypeStagesMapping = restructureCreateSelectorWithArgs(
|
|
1917
|
-
toolkit.createSelector(
|
|
1918
|
-
[selectStageMapping, (_state, componentTypeId) => componentTypeId],
|
|
1919
|
-
(stagesMapping, componentTypeId) => {
|
|
1920
|
-
const componentTypeStagesMapping = {};
|
|
1921
|
-
for (const [stageId, stage] of Object.entries(stagesMapping)) {
|
|
1922
|
-
if (stage.component_type === componentTypeId) {
|
|
1923
|
-
componentTypeStagesMapping[stageId] = stage;
|
|
1924
|
-
}
|
|
1925
|
-
}
|
|
1926
|
-
return componentTypeStagesMapping;
|
|
1927
|
-
}
|
|
1928
|
-
)
|
|
1929
|
-
);
|
|
1930
|
-
const selectStagesFromComponentType = restructureCreateSelectorWithArgs(
|
|
1931
|
-
toolkit.createSelector(
|
|
1932
|
-
[selectStages, (_state, componentTypeId) => componentTypeId],
|
|
1933
|
-
(stages, componentTypeId) => {
|
|
1934
|
-
return stages.filter((stage) => stage.component_type === componentTypeId).sort((a, b) => a.priority - b.priority);
|
|
1935
|
-
}
|
|
1936
|
-
)
|
|
1937
|
-
);
|
|
1938
|
-
const selectStagesFromStageIds = restructureCreateSelectorWithArgs(
|
|
1939
|
-
toolkit.createSelector([selectStageMapping, (_state, stageIds) => stageIds], (stageMapping, stageIds) => {
|
|
1940
|
-
return stageIds.map((offline_id) => stageMapping[offline_id]).filter((stage) => !!stage);
|
|
1941
|
-
})
|
|
1942
|
-
);
|
|
1943
|
-
const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
|
|
1944
|
-
toolkit.createSelector([selectStageMapping, (_state, stageIds) => stageIds], (stageMapping, stageIds) => {
|
|
1945
|
-
const ret = {};
|
|
1946
|
-
for (const stageId of stageIds) {
|
|
1947
|
-
const stage = stageMapping[stageId];
|
|
1948
|
-
if (!stage) {
|
|
1949
|
-
throw new Error("No stage exists with the id " + stageId);
|
|
1950
|
-
}
|
|
1951
|
-
if (stage.user_form) {
|
|
1952
|
-
ret[stageId] = stage.user_form;
|
|
1953
|
-
}
|
|
1954
|
-
}
|
|
1955
|
-
return ret;
|
|
1956
|
-
})
|
|
1957
|
-
);
|
|
1958
|
-
const { addStages, updateStages, removeStages, linkStageToForm, unlinkStageToForm } = componentStageSlice.actions;
|
|
1959
|
-
const componentStageReducer = componentStageSlice.reducer;
|
|
1960
|
-
const initialState$m = {
|
|
1961
|
-
componentTypes: {},
|
|
1962
|
-
hiddenComponentTypeIds: {},
|
|
1963
|
-
attachments: {}
|
|
1964
|
-
};
|
|
1965
|
-
const componentTypeSlice = toolkit.createSlice({
|
|
1966
|
-
name: "componentTypes",
|
|
1967
|
-
initialState: initialState$m,
|
|
1968
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
|
|
1969
|
-
reducers: {
|
|
1970
|
-
addComponentType: (state, action) => {
|
|
1971
|
-
state.componentTypes[action.payload.offline_id] = action.payload;
|
|
1972
|
-
},
|
|
1973
|
-
setComponentTypes: (state, action) => {
|
|
1974
|
-
state.componentTypes = toOfflineIdRecord(action.payload);
|
|
1975
|
-
},
|
|
1976
|
-
toggleComponentTypeVisibility: (state, action) => {
|
|
1977
|
-
state.hiddenComponentTypeIds[action.payload] = !state.hiddenComponentTypeIds[action.payload];
|
|
1978
|
-
},
|
|
1979
|
-
deleteComponentType: (state, action) => {
|
|
1980
|
-
delete state.componentTypes[action.payload];
|
|
1981
|
-
},
|
|
1982
|
-
// Attachments
|
|
1983
|
-
setComponentTypeAttachment: setAttachment,
|
|
1984
|
-
setComponentTypeAttachments: setAttachments,
|
|
1985
|
-
addComponentTypeAttachment: addAttachment,
|
|
1986
|
-
addComponentTypeAttachments: addAttachments,
|
|
1987
|
-
updateComponentTypeAttachment: updateAttachment,
|
|
1988
|
-
updateComponentTypeAttachments: updateAttachments,
|
|
1989
|
-
removeComponentTypeAttachment: removeAttachment,
|
|
1990
|
-
removeComponentTypeAttachments: removeAttachments
|
|
1991
|
-
}
|
|
1992
|
-
});
|
|
1993
|
-
const {
|
|
1994
|
-
addComponentType,
|
|
1995
|
-
setComponentTypes,
|
|
1996
|
-
toggleComponentTypeVisibility,
|
|
1997
|
-
deleteComponentType,
|
|
1998
|
-
// Attachmet
|
|
1999
|
-
setComponentTypeAttachment,
|
|
2000
|
-
setComponentTypeAttachments,
|
|
2001
|
-
addComponentTypeAttachment,
|
|
2002
|
-
addComponentTypeAttachments,
|
|
2003
|
-
updateComponentTypeAttachment,
|
|
2004
|
-
updateComponentTypeAttachments,
|
|
2005
|
-
removeComponentTypeAttachment,
|
|
2006
|
-
removeComponentTypeAttachments
|
|
2007
|
-
} = componentTypeSlice.actions;
|
|
2008
|
-
const selectComponentTypesMapping = (state) => state.componentTypeReducer.componentTypes;
|
|
2009
|
-
const selectComponentTypes = toolkit.createSelector(
|
|
2010
|
-
[selectComponentTypesMapping],
|
|
2011
|
-
(mapping) => Object.values(mapping)
|
|
1974
|
+
}
|
|
1975
|
+
delete stage.user_form;
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
});
|
|
1979
|
+
const selectStageMapping = (state) => state.componentStageReducer.stages;
|
|
1980
|
+
const selectStage = restructureCreateSelectorWithArgs(
|
|
1981
|
+
toolkit.createSelector([selectStageMapping, (_state, stageId) => stageId], (stageMapping, stageId) => {
|
|
1982
|
+
return stageMapping[stageId];
|
|
1983
|
+
})
|
|
2012
1984
|
);
|
|
2013
|
-
const
|
|
2014
|
-
|
|
1985
|
+
const selectStages = toolkit.createSelector(
|
|
1986
|
+
[selectStageMapping],
|
|
1987
|
+
(stageMapping) => {
|
|
1988
|
+
return Object.values(stageMapping);
|
|
1989
|
+
}
|
|
2015
1990
|
);
|
|
2016
|
-
const
|
|
1991
|
+
const selectStagesFromComponentTypeIds = restructureCreateSelectorWithArgs(
|
|
2017
1992
|
toolkit.createSelector(
|
|
2018
|
-
[
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
return (((_a3 = componentType.name) == null ? void 0 : _a3.toLowerCase()) ?? null) === name && componentType.offline_id !== args.componentTypeId;
|
|
1993
|
+
[selectStages, (_state, componentTypeIds) => componentTypeIds],
|
|
1994
|
+
(stages, componentTypeIds) => {
|
|
1995
|
+
const componentTypeIdsSet = new Set(componentTypeIds);
|
|
1996
|
+
const ret = {};
|
|
1997
|
+
for (const stage of stages) {
|
|
1998
|
+
if (componentTypeIdsSet.has(stage.component_type)) {
|
|
1999
|
+
if (!ret[stage.component_type]) {
|
|
2000
|
+
ret[stage.component_type] = [];
|
|
2001
|
+
}
|
|
2002
|
+
ret[stage.component_type].push(stage);
|
|
2029
2003
|
}
|
|
2030
|
-
|
|
2004
|
+
}
|
|
2005
|
+
for (const key in ret) {
|
|
2006
|
+
ret[key] = ret[key].sort((a, b) => a.priority - b.priority);
|
|
2007
|
+
}
|
|
2008
|
+
return ret;
|
|
2031
2009
|
}
|
|
2032
2010
|
)
|
|
2033
2011
|
);
|
|
2034
|
-
const
|
|
2012
|
+
const selectComponentTypeStagesMapping = restructureCreateSelectorWithArgs(
|
|
2035
2013
|
toolkit.createSelector(
|
|
2036
|
-
[
|
|
2037
|
-
(
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
(
|
|
2041
|
-
|
|
2042
|
-
return (((_a2 = componentType.name) == null ? void 0 : _a2.toLowerCase()) ?? null) === name;
|
|
2014
|
+
[selectStageMapping, (_state, componentTypeId) => componentTypeId],
|
|
2015
|
+
(stagesMapping, componentTypeId) => {
|
|
2016
|
+
const componentTypeStagesMapping = {};
|
|
2017
|
+
for (const [stageId, stage] of Object.entries(stagesMapping)) {
|
|
2018
|
+
if (stage.component_type === componentTypeId) {
|
|
2019
|
+
componentTypeStagesMapping[stageId] = stage;
|
|
2043
2020
|
}
|
|
2044
|
-
|
|
2021
|
+
}
|
|
2022
|
+
return componentTypeStagesMapping;
|
|
2045
2023
|
}
|
|
2046
2024
|
)
|
|
2047
2025
|
);
|
|
2048
|
-
const
|
|
2049
|
-
const selectComponentTypeAttachmentMapping = (state) => state.componentTypeReducer.attachments;
|
|
2050
|
-
const selectAllComponentTypeAttachments = toolkit.createSelector(
|
|
2051
|
-
[selectComponentTypeAttachmentMapping],
|
|
2052
|
-
(mapping) => Object.values(mapping)
|
|
2053
|
-
);
|
|
2054
|
-
const selectComponentTypeAttachment = (attachmentId) => (state) => {
|
|
2055
|
-
return state.componentTypeReducer.attachments[attachmentId];
|
|
2056
|
-
};
|
|
2057
|
-
const selectAttachmentsOfComponentType = restructureCreateSelectorWithArgs(
|
|
2026
|
+
const selectStagesFromComponentType = restructureCreateSelectorWithArgs(
|
|
2058
2027
|
toolkit.createSelector(
|
|
2059
|
-
[
|
|
2060
|
-
(
|
|
2061
|
-
return
|
|
2028
|
+
[selectStages, (_state, componentTypeId) => componentTypeId],
|
|
2029
|
+
(stages, componentTypeId) => {
|
|
2030
|
+
return stages.filter((stage) => stage.component_type === componentTypeId).sort((a, b) => a.priority - b.priority);
|
|
2062
2031
|
}
|
|
2063
2032
|
)
|
|
2064
2033
|
);
|
|
2065
|
-
const
|
|
2066
|
-
toolkit.createSelector(
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
)
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2034
|
+
const selectStagesFromStageIds = restructureCreateSelectorWithArgs(
|
|
2035
|
+
toolkit.createSelector([selectStageMapping, (_state, stageIds) => stageIds], (stageMapping, stageIds) => {
|
|
2036
|
+
return stageIds.map((offline_id) => stageMapping[offline_id]).filter((stage) => !!stage);
|
|
2037
|
+
})
|
|
2038
|
+
);
|
|
2039
|
+
const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
|
|
2040
|
+
toolkit.createSelector([selectStageMapping, (_state, stageIds) => stageIds], (stageMapping, stageIds) => {
|
|
2041
|
+
const ret = {};
|
|
2042
|
+
for (const stageId of stageIds) {
|
|
2043
|
+
const stage = stageMapping[stageId];
|
|
2044
|
+
if (!stage) {
|
|
2045
|
+
throw new Error("No stage exists with the id " + stageId);
|
|
2046
|
+
}
|
|
2047
|
+
if (stage.user_form) {
|
|
2048
|
+
ret[stageId] = stage.user_form;
|
|
2049
|
+
}
|
|
2081
2050
|
}
|
|
2082
|
-
|
|
2051
|
+
return ret;
|
|
2052
|
+
})
|
|
2083
2053
|
);
|
|
2084
|
-
const
|
|
2085
|
-
const
|
|
2054
|
+
const { addStages, updateStages, removeStages, linkStageToForm, unlinkStageToForm } = componentStageSlice.actions;
|
|
2055
|
+
const componentStageReducer = componentStageSlice.reducer;
|
|
2056
|
+
const initialState$m = {
|
|
2086
2057
|
workspaces: {},
|
|
2087
2058
|
activeWorkspaceId: null
|
|
2088
2059
|
};
|
|
2089
2060
|
const workspaceSlice = toolkit.createSlice({
|
|
2090
2061
|
name: "workspace",
|
|
2091
|
-
initialState: initialState$
|
|
2062
|
+
initialState: initialState$m,
|
|
2092
2063
|
// The `reducers` field lets us define reducers and generate associated actions
|
|
2093
2064
|
reducers: {
|
|
2094
2065
|
setWorkspaces: (state, action) => {
|
|
@@ -2145,7 +2116,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2145
2116
|
);
|
|
2146
2117
|
const workspaceReducer = workspaceSlice.reducer;
|
|
2147
2118
|
const maxRecentIssues = 10;
|
|
2148
|
-
const initialState$
|
|
2119
|
+
const initialState$l = {
|
|
2149
2120
|
issues: {},
|
|
2150
2121
|
attachments: {},
|
|
2151
2122
|
comments: {},
|
|
@@ -2157,9 +2128,9 @@ var __publicField = (obj, key, value) => {
|
|
|
2157
2128
|
};
|
|
2158
2129
|
const issueSlice = toolkit.createSlice({
|
|
2159
2130
|
name: "issues",
|
|
2160
|
-
initialState: initialState$
|
|
2131
|
+
initialState: initialState$l,
|
|
2161
2132
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
2162
|
-
Object.assign(state, initialState$
|
|
2133
|
+
Object.assign(state, initialState$l);
|
|
2163
2134
|
}),
|
|
2164
2135
|
reducers: {
|
|
2165
2136
|
setIssues: (state, action) => {
|
|
@@ -2592,14 +2563,14 @@ var __publicField = (obj, key, value) => {
|
|
|
2592
2563
|
}
|
|
2593
2564
|
);
|
|
2594
2565
|
const issueReducer = issueSlice.reducer;
|
|
2595
|
-
const initialState$
|
|
2566
|
+
const initialState$k = {
|
|
2596
2567
|
issueTypes: {}
|
|
2597
2568
|
};
|
|
2598
2569
|
const issueTypeSlice = toolkit.createSlice({
|
|
2599
2570
|
name: "issueTypes",
|
|
2600
|
-
initialState: initialState$
|
|
2571
|
+
initialState: initialState$k,
|
|
2601
2572
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
2602
|
-
Object.assign(state, initialState$
|
|
2573
|
+
Object.assign(state, initialState$k);
|
|
2603
2574
|
}),
|
|
2604
2575
|
reducers: {
|
|
2605
2576
|
setIssueTypes: (state, action) => {
|
|
@@ -2666,15 +2637,15 @@ var __publicField = (obj, key, value) => {
|
|
|
2666
2637
|
return ((_a2 = selectIssuesOfIssueType(issueTypeId)(state)) == null ? void 0 : _a2.length) ?? 0;
|
|
2667
2638
|
};
|
|
2668
2639
|
const issueTypeReducer = issueTypeSlice.reducer;
|
|
2669
|
-
const initialState$
|
|
2640
|
+
const initialState$j = {
|
|
2670
2641
|
s3Urls: {}
|
|
2671
2642
|
};
|
|
2672
2643
|
const msPerHour = 1e3 * 60 * 60;
|
|
2673
2644
|
const msPerWeek = msPerHour * 24 * 7;
|
|
2674
2645
|
const fileSlice = toolkit.createSlice({
|
|
2675
2646
|
name: "file",
|
|
2676
|
-
initialState: initialState$
|
|
2677
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2647
|
+
initialState: initialState$j,
|
|
2648
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
|
|
2678
2649
|
reducers: {
|
|
2679
2650
|
setUploadUrl: (state, action) => {
|
|
2680
2651
|
const { url, fields, sha1 } = action.payload;
|
|
@@ -2701,7 +2672,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2701
2672
|
return url;
|
|
2702
2673
|
};
|
|
2703
2674
|
const fileReducer = fileSlice.reducer;
|
|
2704
|
-
const initialState$
|
|
2675
|
+
const initialState$i = {
|
|
2705
2676
|
// TODO: Change first MapStyle.SATELLITE to MaptStyle.None when project creation map is fixed
|
|
2706
2677
|
mapStyle: MapStyle.SATELLITE,
|
|
2707
2678
|
showTooltips: false,
|
|
@@ -2709,8 +2680,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2709
2680
|
};
|
|
2710
2681
|
const mapSlice = toolkit.createSlice({
|
|
2711
2682
|
name: "map",
|
|
2712
|
-
initialState: initialState$
|
|
2713
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2683
|
+
initialState: initialState$i,
|
|
2684
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
|
|
2714
2685
|
reducers: {
|
|
2715
2686
|
setMapStyle: (state, action) => {
|
|
2716
2687
|
state.mapStyle = action.payload;
|
|
@@ -2787,7 +2758,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2787
2758
|
LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
|
|
2788
2759
|
return LicenseStatus2;
|
|
2789
2760
|
})(LicenseStatus || {});
|
|
2790
|
-
const initialState$
|
|
2761
|
+
const initialState$h = {
|
|
2791
2762
|
users: {},
|
|
2792
2763
|
currentUser: {
|
|
2793
2764
|
id: 0,
|
|
@@ -2798,8 +2769,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2798
2769
|
};
|
|
2799
2770
|
const userSlice = toolkit.createSlice({
|
|
2800
2771
|
name: "users",
|
|
2801
|
-
initialState: initialState$
|
|
2802
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2772
|
+
initialState: initialState$h,
|
|
2773
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
|
|
2803
2774
|
reducers: {
|
|
2804
2775
|
setUsers: (state, action) => {
|
|
2805
2776
|
const usersMapping = {};
|
|
@@ -2861,13 +2832,13 @@ var __publicField = (obj, key, value) => {
|
|
|
2861
2832
|
const selectUsersAsMapping = (state) => state.userReducer.users;
|
|
2862
2833
|
const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
|
|
2863
2834
|
const userReducer = userSlice.reducer;
|
|
2864
|
-
const initialState$
|
|
2835
|
+
const initialState$g = {
|
|
2865
2836
|
organizationAccesses: {}
|
|
2866
2837
|
};
|
|
2867
2838
|
const organizationAccessSlice = toolkit.createSlice({
|
|
2868
2839
|
name: "organizationAccess",
|
|
2869
|
-
initialState: initialState$
|
|
2870
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2840
|
+
initialState: initialState$g,
|
|
2841
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
|
|
2871
2842
|
reducers: {
|
|
2872
2843
|
setOrganizationAccesses: (state, action) => {
|
|
2873
2844
|
if (!Array.isArray(action.payload))
|
|
@@ -2930,13 +2901,13 @@ var __publicField = (obj, key, value) => {
|
|
|
2930
2901
|
return organizationAccesses;
|
|
2931
2902
|
};
|
|
2932
2903
|
const organizationAccessReducer = organizationAccessSlice.reducer;
|
|
2933
|
-
const initialState$
|
|
2904
|
+
const initialState$f = {
|
|
2934
2905
|
licenses: {}
|
|
2935
2906
|
};
|
|
2936
2907
|
const licenseSlice = toolkit.createSlice({
|
|
2937
2908
|
name: "license",
|
|
2938
|
-
initialState: initialState$
|
|
2939
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2909
|
+
initialState: initialState$f,
|
|
2910
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
|
|
2940
2911
|
reducers: {
|
|
2941
2912
|
setLicenses: (state, action) => {
|
|
2942
2913
|
if (!Array.isArray(action.payload))
|
|
@@ -2981,13 +2952,13 @@ var __publicField = (obj, key, value) => {
|
|
|
2981
2952
|
(licenses) => Object.values(licenses).filter((license) => license.project).reduce((accum, license) => ({ ...accum, [license.project]: license }), {})
|
|
2982
2953
|
);
|
|
2983
2954
|
const licenseReducer = licenseSlice.reducer;
|
|
2984
|
-
const initialState$
|
|
2955
|
+
const initialState$e = {
|
|
2985
2956
|
projectAccesses: {}
|
|
2986
2957
|
};
|
|
2987
2958
|
const projectAccessSlice = toolkit.createSlice({
|
|
2988
2959
|
name: "projectAccess",
|
|
2989
|
-
initialState: initialState$
|
|
2990
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2960
|
+
initialState: initialState$e,
|
|
2961
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
|
|
2991
2962
|
reducers: {
|
|
2992
2963
|
setProjectAccesses: (state, action) => {
|
|
2993
2964
|
if (!Array.isArray(action.payload))
|
|
@@ -3055,7 +3026,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3055
3026
|
return projectAccesses;
|
|
3056
3027
|
};
|
|
3057
3028
|
const projectAccessReducer = projectAccessSlice.reducer;
|
|
3058
|
-
const initialState$
|
|
3029
|
+
const initialState$d = {
|
|
3059
3030
|
projects: {},
|
|
3060
3031
|
activeProjectId: null,
|
|
3061
3032
|
recentProjectIds: [],
|
|
@@ -3065,7 +3036,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3065
3036
|
};
|
|
3066
3037
|
const projectSlice = toolkit.createSlice({
|
|
3067
3038
|
name: "projects",
|
|
3068
|
-
initialState: initialState$
|
|
3039
|
+
initialState: initialState$d,
|
|
3069
3040
|
reducers: {
|
|
3070
3041
|
setProjects: (state, action) => {
|
|
3071
3042
|
const projectsMap = {};
|
|
@@ -3259,14 +3230,14 @@ var __publicField = (obj, key, value) => {
|
|
|
3259
3230
|
}
|
|
3260
3231
|
)
|
|
3261
3232
|
);
|
|
3262
|
-
const initialState$
|
|
3233
|
+
const initialState$c = {
|
|
3263
3234
|
organizations: {},
|
|
3264
3235
|
activeOrganizationId: null
|
|
3265
3236
|
};
|
|
3266
3237
|
const organizationSlice = toolkit.createSlice({
|
|
3267
3238
|
name: "organizations",
|
|
3268
|
-
initialState: initialState$
|
|
3269
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3239
|
+
initialState: initialState$c,
|
|
3240
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
|
|
3270
3241
|
reducers: {
|
|
3271
3242
|
setOrganizations: (state, action) => {
|
|
3272
3243
|
for (const org of action.payload) {
|
|
@@ -3385,14 +3356,14 @@ var __publicField = (obj, key, value) => {
|
|
|
3385
3356
|
}
|
|
3386
3357
|
};
|
|
3387
3358
|
};
|
|
3388
|
-
const initialState$
|
|
3359
|
+
const initialState$b = {
|
|
3389
3360
|
deletedRequests: [],
|
|
3390
3361
|
latestRetryTime: 0
|
|
3391
3362
|
};
|
|
3392
3363
|
const outboxSlice = toolkit.createSlice({
|
|
3393
3364
|
name: "outbox",
|
|
3394
|
-
initialState: initialState$
|
|
3395
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3365
|
+
initialState: initialState$b,
|
|
3366
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
|
|
3396
3367
|
reducers: {
|
|
3397
3368
|
// enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
|
|
3398
3369
|
// Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
|
|
@@ -3424,7 +3395,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3424
3395
|
const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
|
|
3425
3396
|
const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
|
|
3426
3397
|
const outboxReducer = outboxSlice.reducer;
|
|
3427
|
-
const initialState$
|
|
3398
|
+
const initialState$a = {
|
|
3428
3399
|
projectFiles: {},
|
|
3429
3400
|
activeProjectFileId: null,
|
|
3430
3401
|
isImportingProjectFile: false,
|
|
@@ -3432,8 +3403,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3432
3403
|
};
|
|
3433
3404
|
const projectFileSlice = toolkit.createSlice({
|
|
3434
3405
|
name: "projectFiles",
|
|
3435
|
-
initialState: initialState$
|
|
3436
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3406
|
+
initialState: initialState$a,
|
|
3407
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
|
|
3437
3408
|
reducers: {
|
|
3438
3409
|
addOrReplaceProjectFiles: (state, action) => {
|
|
3439
3410
|
for (let fileObj of action.payload) {
|
|
@@ -3534,12 +3505,12 @@ var __publicField = (obj, key, value) => {
|
|
|
3534
3505
|
const selectActiveProjectFileId = (state) => state.projectFileReducer.activeProjectFileId;
|
|
3535
3506
|
const selectIsImportingProjectFile = (state) => state.projectFileReducer.isImportingProjectFile;
|
|
3536
3507
|
const projectFileReducer = projectFileSlice.reducer;
|
|
3537
|
-
const initialState$
|
|
3508
|
+
const initialState$9 = {
|
|
3538
3509
|
isRehydrated: false
|
|
3539
3510
|
};
|
|
3540
3511
|
const rehydratedSlice = toolkit.createSlice({
|
|
3541
3512
|
name: "rehydrated",
|
|
3542
|
-
initialState: initialState$
|
|
3513
|
+
initialState: initialState$9,
|
|
3543
3514
|
// The `reducers` field lets us define reducers and generate associated actions
|
|
3544
3515
|
reducers: {
|
|
3545
3516
|
setRehydrated: (state, action) => {
|
|
@@ -3549,7 +3520,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3549
3520
|
});
|
|
3550
3521
|
const selectRehydrated = (state) => state.rehydratedReducer.isRehydrated;
|
|
3551
3522
|
const rehydratedReducer = rehydratedSlice.reducer;
|
|
3552
|
-
const initialState$
|
|
3523
|
+
const initialState$8 = {
|
|
3553
3524
|
useIssueTemplate: false,
|
|
3554
3525
|
placementMode: false,
|
|
3555
3526
|
enableClustering: false,
|
|
@@ -3566,8 +3537,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3566
3537
|
};
|
|
3567
3538
|
const settingSlice = toolkit.createSlice({
|
|
3568
3539
|
name: "settings",
|
|
3569
|
-
initialState: initialState$
|
|
3570
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3540
|
+
initialState: initialState$8,
|
|
3541
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
|
|
3571
3542
|
reducers: {
|
|
3572
3543
|
setEnableDuplicateIssues: (state, action) => {
|
|
3573
3544
|
state.useIssueTemplate = action.payload;
|
|
@@ -3626,14 +3597,14 @@ var __publicField = (obj, key, value) => {
|
|
|
3626
3597
|
return revisionA < revisionB ? -1 : 1;
|
|
3627
3598
|
}
|
|
3628
3599
|
};
|
|
3629
|
-
const initialState$
|
|
3600
|
+
const initialState$7 = {
|
|
3630
3601
|
formRevisions: {},
|
|
3631
3602
|
attachments: {}
|
|
3632
3603
|
};
|
|
3633
3604
|
const formRevisionsSlice = toolkit.createSlice({
|
|
3634
3605
|
name: "formRevisions",
|
|
3635
|
-
initialState: initialState$
|
|
3636
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3606
|
+
initialState: initialState$7,
|
|
3607
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
|
|
3637
3608
|
reducers: {
|
|
3638
3609
|
// revision related actions
|
|
3639
3610
|
setFormRevision: (state, action) => {
|
|
@@ -3813,13 +3784,13 @@ var __publicField = (obj, key, value) => {
|
|
|
3813
3784
|
)
|
|
3814
3785
|
);
|
|
3815
3786
|
const formRevisionReducer = formRevisionsSlice.reducer;
|
|
3816
|
-
const initialState$
|
|
3787
|
+
const initialState$6 = {
|
|
3817
3788
|
forms: {}
|
|
3818
3789
|
};
|
|
3819
3790
|
const formSlice = toolkit.createSlice({
|
|
3820
3791
|
name: "forms",
|
|
3821
|
-
initialState: initialState$
|
|
3822
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3792
|
+
initialState: initialState$6,
|
|
3793
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
|
|
3823
3794
|
reducers: {
|
|
3824
3795
|
setForms: (state, action) => {
|
|
3825
3796
|
state.forms = {};
|
|
@@ -3924,14 +3895,14 @@ var __publicField = (obj, key, value) => {
|
|
|
3924
3895
|
return Object.values(userForms).filter((form) => !form.component_type).length;
|
|
3925
3896
|
});
|
|
3926
3897
|
const formReducer = formSlice.reducer;
|
|
3927
|
-
const initialState$
|
|
3898
|
+
const initialState$5 = {
|
|
3928
3899
|
formSubmissions: {},
|
|
3929
3900
|
attachments: {}
|
|
3930
3901
|
};
|
|
3931
3902
|
const formSubmissionSlice = toolkit.createSlice({
|
|
3932
3903
|
name: "formSubmissions",
|
|
3933
|
-
initialState: initialState$
|
|
3934
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3904
|
+
initialState: initialState$5,
|
|
3905
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
|
|
3935
3906
|
reducers: {
|
|
3936
3907
|
setFormSubmission: (state, action) => {
|
|
3937
3908
|
state.formSubmissions[action.payload.offline_id] = action.payload;
|
|
@@ -4168,12 +4139,12 @@ var __publicField = (obj, key, value) => {
|
|
|
4168
4139
|
)
|
|
4169
4140
|
);
|
|
4170
4141
|
const formSubmissionReducer = formSubmissionSlice.reducer;
|
|
4171
|
-
const initialState$
|
|
4142
|
+
const initialState$4 = {
|
|
4172
4143
|
emailDomains: {}
|
|
4173
4144
|
};
|
|
4174
4145
|
const emailDomainsSlice = toolkit.createSlice({
|
|
4175
4146
|
name: "emailDomains",
|
|
4176
|
-
initialState: initialState$
|
|
4147
|
+
initialState: initialState$4,
|
|
4177
4148
|
reducers: {
|
|
4178
4149
|
setEmailDomains: (state, action) => {
|
|
4179
4150
|
const emailDomains = {};
|
|
@@ -4200,15 +4171,15 @@ var __publicField = (obj, key, value) => {
|
|
|
4200
4171
|
(ed1, ed2) => ed1.domain.localeCompare(ed2.domain)
|
|
4201
4172
|
);
|
|
4202
4173
|
const emailDomainsReducer = emailDomainsSlice.reducer;
|
|
4203
|
-
const initialState$
|
|
4174
|
+
const initialState$3 = {
|
|
4204
4175
|
documents: {},
|
|
4205
4176
|
attachments: {}
|
|
4206
4177
|
};
|
|
4207
4178
|
const documentSlice = toolkit.createSlice({
|
|
4208
4179
|
name: "documents",
|
|
4209
|
-
initialState: initialState$
|
|
4180
|
+
initialState: initialState$3,
|
|
4210
4181
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
4211
|
-
Object.assign(state, initialState$
|
|
4182
|
+
Object.assign(state, initialState$3);
|
|
4212
4183
|
}),
|
|
4213
4184
|
reducers: {
|
|
4214
4185
|
setDocuments: (state, action) => {
|
|
@@ -4439,13 +4410,13 @@ var __publicField = (obj, key, value) => {
|
|
|
4439
4410
|
)
|
|
4440
4411
|
);
|
|
4441
4412
|
const documentsReducer = documentSlice.reducer;
|
|
4442
|
-
const initialState$
|
|
4413
|
+
const initialState$2 = {
|
|
4443
4414
|
teams: {}
|
|
4444
4415
|
};
|
|
4445
4416
|
const teamSlice = toolkit.createSlice({
|
|
4446
4417
|
name: "teams",
|
|
4447
|
-
initialState: initialState$
|
|
4448
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
4418
|
+
initialState: initialState$2,
|
|
4419
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$2)),
|
|
4449
4420
|
reducers: {
|
|
4450
4421
|
setTeam: (state, action) => {
|
|
4451
4422
|
state.teams[action.payload.offline_id] = action.payload;
|
|
@@ -4495,6 +4466,54 @@ var __publicField = (obj, key, value) => {
|
|
|
4495
4466
|
})
|
|
4496
4467
|
);
|
|
4497
4468
|
const teamReducer = teamSlice.reducer;
|
|
4469
|
+
const initialState$1 = {
|
|
4470
|
+
conversations: {}
|
|
4471
|
+
};
|
|
4472
|
+
const agentsSlice = toolkit.createSlice({
|
|
4473
|
+
name: "agents",
|
|
4474
|
+
initialState: initialState$1,
|
|
4475
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$1)),
|
|
4476
|
+
reducers: {
|
|
4477
|
+
setConversations: (state, action) => {
|
|
4478
|
+
state.conversations = {};
|
|
4479
|
+
for (const conversation of action.payload) {
|
|
4480
|
+
state.conversations[conversation.offline_id] = conversation;
|
|
4481
|
+
}
|
|
4482
|
+
},
|
|
4483
|
+
addConversation: (state, action) => {
|
|
4484
|
+
if (action.payload.offline_id in state.conversations) {
|
|
4485
|
+
throw new Error("Conversation already exists in history");
|
|
4486
|
+
}
|
|
4487
|
+
state.conversations[action.payload.offline_id] = action.payload;
|
|
4488
|
+
},
|
|
4489
|
+
setConversation: (state, action) => {
|
|
4490
|
+
if (!(action.payload.offline_id in state.conversations)) {
|
|
4491
|
+
throw new Error("Conversation does not exist in history");
|
|
4492
|
+
}
|
|
4493
|
+
state.conversations[action.payload.offline_id] = action.payload;
|
|
4494
|
+
},
|
|
4495
|
+
updateConversation: (state, action) => {
|
|
4496
|
+
const existing = state.conversations[action.payload.offline_id];
|
|
4497
|
+
if (!existing) {
|
|
4498
|
+
throw new Error("Conversation does not exist in history");
|
|
4499
|
+
}
|
|
4500
|
+
state.conversations[action.payload.offline_id] = { ...existing, ...action.payload };
|
|
4501
|
+
}
|
|
4502
|
+
}
|
|
4503
|
+
});
|
|
4504
|
+
const { setConversations, addConversation, setConversation, updateConversation } = agentsSlice.actions;
|
|
4505
|
+
const selectConversationMapping = (state) => state.agentsReducer.conversations;
|
|
4506
|
+
const selectConversations = toolkit.createSelector(
|
|
4507
|
+
[selectConversationMapping],
|
|
4508
|
+
(conversationMapping) => Object.values(conversationMapping)
|
|
4509
|
+
);
|
|
4510
|
+
const selectConversation = restructureCreateSelectorWithArgs(
|
|
4511
|
+
toolkit.createSelector(
|
|
4512
|
+
[selectConversationMapping, (_state, conversationId) => conversationId],
|
|
4513
|
+
(conversationMapping, conversationId) => conversationMapping[conversationId]
|
|
4514
|
+
)
|
|
4515
|
+
);
|
|
4516
|
+
const agentsReducer = agentsSlice.reducer;
|
|
4498
4517
|
const initialState = {
|
|
4499
4518
|
version: 0
|
|
4500
4519
|
};
|
|
@@ -4545,7 +4564,8 @@ var __publicField = (obj, key, value) => {
|
|
|
4545
4564
|
emailDomainsReducer,
|
|
4546
4565
|
licenseReducer,
|
|
4547
4566
|
documentsReducer,
|
|
4548
|
-
teamReducer
|
|
4567
|
+
teamReducer,
|
|
4568
|
+
agentsReducer
|
|
4549
4569
|
};
|
|
4550
4570
|
const overmapReducer = toolkit.combineReducers(overmapReducers);
|
|
4551
4571
|
const resetStore = "RESET";
|
|
@@ -4611,11 +4631,19 @@ var __publicField = (obj, key, value) => {
|
|
|
4611
4631
|
return overmapReducer(mutatedState, action);
|
|
4612
4632
|
};
|
|
4613
4633
|
let __OUTBOX_COORDINATOR = null;
|
|
4614
|
-
function
|
|
4615
|
-
|
|
4616
|
-
|
|
4634
|
+
function getOutboxCoordinator() {
|
|
4635
|
+
const clientStore2 = getClientStore();
|
|
4636
|
+
if (!clientStore2) {
|
|
4637
|
+
console.warn("Client store not set; cannot get outbox coordinator yet.");
|
|
4638
|
+
return null;
|
|
4639
|
+
}
|
|
4640
|
+
if (__OUTBOX_COORDINATOR) {
|
|
4641
|
+
return __OUTBOX_COORDINATOR;
|
|
4617
4642
|
}
|
|
4618
|
-
|
|
4643
|
+
const outbox = clientStore2.getState().offline.outbox;
|
|
4644
|
+
const coordinator = OutboxCoordinator._fromOutbox(outbox);
|
|
4645
|
+
__OUTBOX_COORDINATOR = coordinator;
|
|
4646
|
+
return coordinator;
|
|
4619
4647
|
}
|
|
4620
4648
|
const persistCallback = (err) => {
|
|
4621
4649
|
if (err)
|
|
@@ -4628,12 +4656,20 @@ var __publicField = (obj, key, value) => {
|
|
|
4628
4656
|
}
|
|
4629
4657
|
};
|
|
4630
4658
|
const enqueue = (_array, item, _context) => {
|
|
4631
|
-
const coordinator =
|
|
4659
|
+
const coordinator = getOutboxCoordinator();
|
|
4660
|
+
if (!coordinator) {
|
|
4661
|
+
console.warn("Outbox coordinator not set; cannot enqueue request yet.");
|
|
4662
|
+
return [];
|
|
4663
|
+
}
|
|
4632
4664
|
coordinator.addRequest(item);
|
|
4633
4665
|
return coordinator.getQueue();
|
|
4634
4666
|
};
|
|
4635
4667
|
const dequeue = (_array, item, _context) => {
|
|
4636
|
-
const coordinator =
|
|
4668
|
+
const coordinator = getOutboxCoordinator();
|
|
4669
|
+
if (!coordinator) {
|
|
4670
|
+
console.warn("Outbox coordinator not set; cannot dequeue request yet.");
|
|
4671
|
+
return [];
|
|
4672
|
+
}
|
|
4637
4673
|
const meta = item.meta;
|
|
4638
4674
|
const uuid2 = meta.offlineAction.payload.uuid;
|
|
4639
4675
|
coordinator.remove(uuid2);
|
|
@@ -4717,7 +4753,6 @@ var __publicField = (obj, key, value) => {
|
|
|
4717
4753
|
}
|
|
4718
4754
|
}
|
|
4719
4755
|
}
|
|
4720
|
-
console.debug("Done checking tokens");
|
|
4721
4756
|
const defaultSettings = {
|
|
4722
4757
|
queryParams: "",
|
|
4723
4758
|
isAuthNeeded: true
|
|
@@ -4861,7 +4896,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4861
4896
|
if (this.next) {
|
|
4862
4897
|
return this.next.run(action);
|
|
4863
4898
|
} else {
|
|
4864
|
-
console.debug(
|
|
4899
|
+
console.debug("Middleware finished. Performing request:", action);
|
|
4865
4900
|
const baseUrl = action.meta.offline.effect.BASE_URL;
|
|
4866
4901
|
const clientStore2 = getClientStore();
|
|
4867
4902
|
if (!clientStore2)
|
|
@@ -4925,7 +4960,11 @@ var __publicField = (obj, key, value) => {
|
|
|
4925
4960
|
const uuid2 = action.payload.uuid;
|
|
4926
4961
|
function rollbackAndThrow() {
|
|
4927
4962
|
clientStore2.dispatch(markAsDeleted(uuid2));
|
|
4928
|
-
|
|
4963
|
+
const coordinator2 = getOutboxCoordinator();
|
|
4964
|
+
if (!coordinator2) {
|
|
4965
|
+
throw new Error("Outbox coordinator not set");
|
|
4966
|
+
}
|
|
4967
|
+
coordinator2.remove(action.payload.uuid);
|
|
4929
4968
|
const rollbackAction = action.meta.offline.rollback;
|
|
4930
4969
|
if (rollbackAction) {
|
|
4931
4970
|
console.warn("Rolling back request due to SDK error:", action);
|
|
@@ -4956,17 +4995,26 @@ var __publicField = (obj, key, value) => {
|
|
|
4956
4995
|
console.error(`Could not display toast for status ${status} because there is no toast handle.`);
|
|
4957
4996
|
}
|
|
4958
4997
|
}
|
|
4959
|
-
|
|
4998
|
+
const coordinator2 = getOutboxCoordinator();
|
|
4999
|
+
if (!coordinator2) {
|
|
5000
|
+
throw new Error("Outbox coordinator not set");
|
|
5001
|
+
}
|
|
5002
|
+
coordinator2.remove(action.payload.uuid);
|
|
4960
5003
|
reason.options.discard = true;
|
|
4961
5004
|
rollbackAndThrow();
|
|
4962
5005
|
}
|
|
4963
5006
|
}
|
|
4964
5007
|
console.debug("Registering a retry for request:", action.payload.uuid);
|
|
4965
|
-
|
|
5008
|
+
const coordinator = getOutboxCoordinator();
|
|
5009
|
+
if (!coordinator) {
|
|
5010
|
+
throw new Error("Outbox coordinator not set");
|
|
5011
|
+
}
|
|
5012
|
+
coordinator.registerRetry(action.payload.uuid);
|
|
4966
5013
|
return false;
|
|
4967
5014
|
}
|
|
4968
5015
|
function peek(_array, _item, _context) {
|
|
4969
|
-
|
|
5016
|
+
var _a2;
|
|
5017
|
+
return (_a2 = getOutboxCoordinator()) == null ? void 0 : _a2.peek();
|
|
4970
5018
|
}
|
|
4971
5019
|
function retry(_action, _retries) {
|
|
4972
5020
|
getClientStore().dispatch(_setLatestRetryTime((/* @__PURE__ */ new Date()).getTime()));
|
|
@@ -4974,94 +5022,6 @@ var __publicField = (obj, key, value) => {
|
|
|
4974
5022
|
}
|
|
4975
5023
|
const useAppDispatch = () => reactRedux.useDispatch();
|
|
4976
5024
|
const useAppSelector = reactRedux.useSelector;
|
|
4977
|
-
class BaseApiService {
|
|
4978
|
-
constructor(sdk) {
|
|
4979
|
-
__publicField(this, "client");
|
|
4980
|
-
this.client = sdk;
|
|
4981
|
-
}
|
|
4982
|
-
/**
|
|
4983
|
-
* Enqueues an API request to the offline outbox.
|
|
4984
|
-
* @param requestDetails An SDKRequest object containing the details of the request.
|
|
4985
|
-
* @protected
|
|
4986
|
-
*/
|
|
4987
|
-
async enqueueRequest(requestDetails) {
|
|
4988
|
-
return this._enqueueRequest(requestDetails).then((result) => {
|
|
4989
|
-
if (result instanceof APIError) {
|
|
4990
|
-
throw result;
|
|
4991
|
-
}
|
|
4992
|
-
return result;
|
|
4993
|
-
});
|
|
4994
|
-
}
|
|
4995
|
-
/**
|
|
4996
|
-
* Enqueues an API request to the Redux Offline outbox
|
|
4997
|
-
* @protected
|
|
4998
|
-
*/
|
|
4999
|
-
_enqueueRequest(requestDetails) {
|
|
5000
|
-
const promise = new DeferredPromise();
|
|
5001
|
-
const requestDetailsWithBaseUrl = { ...requestDetails, BASE_URL: this.client.API_URL };
|
|
5002
|
-
const { store } = this.client;
|
|
5003
|
-
if (requestDetails.immediate) {
|
|
5004
|
-
const requestWithUuid = {
|
|
5005
|
-
...requestDetailsWithBaseUrl,
|
|
5006
|
-
uuid: requestDetails.uuid ?? uuid.v4()
|
|
5007
|
-
};
|
|
5008
|
-
const fullOfflineAction = {
|
|
5009
|
-
payload: requestWithUuid,
|
|
5010
|
-
type: "",
|
|
5011
|
-
meta: {
|
|
5012
|
-
offline: {
|
|
5013
|
-
effect: {
|
|
5014
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5015
|
-
request: requestWithUuid,
|
|
5016
|
-
BASE_URL: this.client.API_URL
|
|
5017
|
-
}
|
|
5018
|
-
}
|
|
5019
|
-
}
|
|
5020
|
-
};
|
|
5021
|
-
performRequest(fullOfflineAction, this.client).then((result) => {
|
|
5022
|
-
promise.resolve(result.body);
|
|
5023
|
-
}).catch((error2) => {
|
|
5024
|
-
discard(error2, fullOfflineAction);
|
|
5025
|
-
promise.reject(error2);
|
|
5026
|
-
});
|
|
5027
|
-
} else {
|
|
5028
|
-
const innerPromise = store.dispatch(
|
|
5029
|
-
enqueueRequest(requestDetailsWithBaseUrl)
|
|
5030
|
-
);
|
|
5031
|
-
const successOrUndefinedHandler = (response) => {
|
|
5032
|
-
if (response) {
|
|
5033
|
-
promise.resolve(response.body);
|
|
5034
|
-
} else {
|
|
5035
|
-
const error2 = new APIError({
|
|
5036
|
-
message: "Could not get a response from the server.",
|
|
5037
|
-
response,
|
|
5038
|
-
discard: true
|
|
5039
|
-
});
|
|
5040
|
-
promise.reject(error2);
|
|
5041
|
-
}
|
|
5042
|
-
};
|
|
5043
|
-
const errorHandler = (error2) => {
|
|
5044
|
-
if (error2 instanceof APIError) {
|
|
5045
|
-
error2.options.discard = true;
|
|
5046
|
-
} else {
|
|
5047
|
-
console.error(
|
|
5048
|
-
"Received an unexpected error while processing a request:",
|
|
5049
|
-
error2,
|
|
5050
|
-
"\nConverting error to APIError and discarding."
|
|
5051
|
-
);
|
|
5052
|
-
error2 = new APIError({
|
|
5053
|
-
message: "An error occurred while processing the request.",
|
|
5054
|
-
innerError: error2,
|
|
5055
|
-
discard: true
|
|
5056
|
-
});
|
|
5057
|
-
}
|
|
5058
|
-
promise.reject(error2);
|
|
5059
|
-
};
|
|
5060
|
-
innerPromise.then(successOrUndefinedHandler, errorHandler);
|
|
5061
|
-
}
|
|
5062
|
-
return promise;
|
|
5063
|
-
}
|
|
5064
|
-
}
|
|
5065
5025
|
const EXPIRING_SOON_THRESHOLD = 1800;
|
|
5066
5026
|
function parseTokens(response) {
|
|
5067
5027
|
if (!response.access)
|
|
@@ -5088,7 +5048,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5088
5048
|
*/
|
|
5089
5049
|
__publicField(this, "_getTokenPair", (credentials, logoutOnFailure = true) => {
|
|
5090
5050
|
const uuid$1 = uuid.v4();
|
|
5091
|
-
const responsePromise = this.enqueueRequest({
|
|
5051
|
+
const responsePromise = this.client.enqueueRequest({
|
|
5092
5052
|
uuid: uuid$1,
|
|
5093
5053
|
description: "Get token pair",
|
|
5094
5054
|
method: HttpMethod.POST,
|
|
@@ -5113,7 +5073,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5113
5073
|
* @returns {Promise<TokenPair>} The new access and refresh tokens
|
|
5114
5074
|
*/
|
|
5115
5075
|
__publicField(this, "_getRenewedTokens", async (refreshToken) => {
|
|
5116
|
-
const promise = this.enqueueRequest({
|
|
5076
|
+
const promise = this.client.enqueueRequest({
|
|
5117
5077
|
description: "Get renewed tokens",
|
|
5118
5078
|
method: HttpMethod.POST,
|
|
5119
5079
|
url: "/api/token/refresh/",
|
|
@@ -5226,7 +5186,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5226
5186
|
* Register a new user
|
|
5227
5187
|
*/
|
|
5228
5188
|
register(payload) {
|
|
5229
|
-
return this.enqueueRequest({
|
|
5189
|
+
return this.client.enqueueRequest({
|
|
5230
5190
|
description: "Register",
|
|
5231
5191
|
method: HttpMethod.POST,
|
|
5232
5192
|
url: "/authentication/users/register/",
|
|
@@ -5237,7 +5197,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5237
5197
|
});
|
|
5238
5198
|
}
|
|
5239
5199
|
async resetPassword(email) {
|
|
5240
|
-
return this.enqueueRequest({
|
|
5200
|
+
return this.client.enqueueRequest({
|
|
5241
5201
|
description: "Reset password",
|
|
5242
5202
|
method: HttpMethod.PATCH,
|
|
5243
5203
|
url: "/authentication/users/reset-password/",
|
|
@@ -5274,7 +5234,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5274
5234
|
const { store } = this.client;
|
|
5275
5235
|
const [fileProps] = await this.client.files.uploadFileToS3(hash);
|
|
5276
5236
|
store.dispatch(setProfilePicture({ file: `/files/${fileProps.file}`, file_sha1: hash }));
|
|
5277
|
-
return this.enqueueRequest({
|
|
5237
|
+
return this.client.enqueueRequest({
|
|
5278
5238
|
description: "Replace profile picture",
|
|
5279
5239
|
method: HttpMethod.PATCH,
|
|
5280
5240
|
url: "/authentication/users/profile-details/",
|
|
@@ -5285,7 +5245,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5285
5245
|
}
|
|
5286
5246
|
async addFavouriteProjectId(projectId) {
|
|
5287
5247
|
this.client.store.dispatch(addFavouriteProjectId(projectId));
|
|
5288
|
-
return this.enqueueRequest({
|
|
5248
|
+
return this.client.enqueueRequest({
|
|
5289
5249
|
description: "Add favourite project",
|
|
5290
5250
|
method: HttpMethod.POST,
|
|
5291
5251
|
url: `/authentication/users/favourite-project/${projectId}/`,
|
|
@@ -5295,7 +5255,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5295
5255
|
}
|
|
5296
5256
|
async removeFavouriteProjectId(projectId) {
|
|
5297
5257
|
this.client.store.dispatch(removeFavouriteProjectId(projectId));
|
|
5298
|
-
return this.enqueueRequest({
|
|
5258
|
+
return this.client.enqueueRequest({
|
|
5299
5259
|
description: "Add favourite project",
|
|
5300
5260
|
method: HttpMethod.POST,
|
|
5301
5261
|
url: `/authentication/users/unfavourite-project/${projectId}/`,
|
|
@@ -5305,7 +5265,10 @@ var __publicField = (obj, key, value) => {
|
|
|
5305
5265
|
}
|
|
5306
5266
|
async setTourStep(stepIndex) {
|
|
5307
5267
|
this.client.store.dispatch(setTourStep(stepIndex));
|
|
5308
|
-
|
|
5268
|
+
const currentStep = this.client.store.getState().userReducer.currentUser.profile.tour_step;
|
|
5269
|
+
if (currentStep === stepIndex)
|
|
5270
|
+
return Promise.resolve(void 0);
|
|
5271
|
+
return this.client.enqueueRequest({
|
|
5309
5272
|
description: "Set tour step",
|
|
5310
5273
|
method: HttpMethod.PATCH,
|
|
5311
5274
|
url: "/authentication/users/profile-details/",
|
|
@@ -5317,7 +5280,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5317
5280
|
});
|
|
5318
5281
|
}
|
|
5319
5282
|
async joinApplication(projectInviteId, verification_code, username, password) {
|
|
5320
|
-
return this.enqueueRequest({
|
|
5283
|
+
return this.client.enqueueRequest({
|
|
5321
5284
|
description: "Join application",
|
|
5322
5285
|
method: HttpMethod.PATCH,
|
|
5323
5286
|
url: `/authentication/join-app/${projectInviteId}/${verification_code}/`,
|
|
@@ -5336,7 +5299,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5336
5299
|
const offlineCategory = offline(category);
|
|
5337
5300
|
const categoryWithWorkspace = { ...offlineCategory, workspace: workspaceId };
|
|
5338
5301
|
this.client.store.dispatch(addCategory(categoryWithWorkspace));
|
|
5339
|
-
const promise = this.enqueueRequest({
|
|
5302
|
+
const promise = this.client.enqueueRequest({
|
|
5340
5303
|
description: "Create Category",
|
|
5341
5304
|
method: HttpMethod.POST,
|
|
5342
5305
|
url: "/categories/",
|
|
@@ -5350,7 +5313,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5350
5313
|
return [categoryWithWorkspace, promise];
|
|
5351
5314
|
}
|
|
5352
5315
|
fetchAll(projectId) {
|
|
5353
|
-
const promise = this.enqueueRequest({
|
|
5316
|
+
const promise = this.client.enqueueRequest({
|
|
5354
5317
|
description: "Get categories",
|
|
5355
5318
|
method: HttpMethod.GET,
|
|
5356
5319
|
url: `/projects/${projectId}/categories/`,
|
|
@@ -5367,7 +5330,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5367
5330
|
}
|
|
5368
5331
|
this.client.store.dispatch(patchCategory(category));
|
|
5369
5332
|
const optimisticCategory = { ...existingCategory, ...category };
|
|
5370
|
-
const promise = this.enqueueRequest({
|
|
5333
|
+
const promise = this.client.enqueueRequest({
|
|
5371
5334
|
description: "Edit Category",
|
|
5372
5335
|
method: HttpMethod.PATCH,
|
|
5373
5336
|
url: `/categories/${category.offline_id}/`,
|
|
@@ -5382,7 +5345,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5382
5345
|
}
|
|
5383
5346
|
remove(category, workspaceId) {
|
|
5384
5347
|
this.client.store.dispatch(removeCategory(category.offline_id));
|
|
5385
|
-
return this.enqueueRequest({
|
|
5348
|
+
return this.client.enqueueRequest({
|
|
5386
5349
|
description: "Delete Category",
|
|
5387
5350
|
method: HttpMethod.DELETE,
|
|
5388
5351
|
url: `/categories/${category.offline_id}/`,
|
|
@@ -5428,7 +5391,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5428
5391
|
add(component, workspaceId) {
|
|
5429
5392
|
const offlineComponent = offline(component);
|
|
5430
5393
|
this.client.store.dispatch(addComponent(offlineComponent));
|
|
5431
|
-
const promise = this.enqueueRequest({
|
|
5394
|
+
const promise = this.client.enqueueRequest({
|
|
5432
5395
|
description: "Create Component",
|
|
5433
5396
|
method: HttpMethod.POST,
|
|
5434
5397
|
url: `/components/types/${offlineComponent.component_type}/add-components/`,
|
|
@@ -5443,7 +5406,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5443
5406
|
}
|
|
5444
5407
|
update(component, workspaceId) {
|
|
5445
5408
|
this.client.store.dispatch(updateComponent(component));
|
|
5446
|
-
const promise = this.enqueueRequest({
|
|
5409
|
+
const promise = this.client.enqueueRequest({
|
|
5447
5410
|
description: "Edit component",
|
|
5448
5411
|
method: HttpMethod.PATCH,
|
|
5449
5412
|
url: `/components/${component.offline_id}/`,
|
|
@@ -5467,7 +5430,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5467
5430
|
const attachmentsOfComponentIds = attachmentsOfComponent.map(({ offline_id }) => offline_id);
|
|
5468
5431
|
store.dispatch(removeComponentAttachments(attachmentsOfComponentIds));
|
|
5469
5432
|
}
|
|
5470
|
-
return this.enqueueRequest({
|
|
5433
|
+
return this.client.enqueueRequest({
|
|
5471
5434
|
description: "Delete issue",
|
|
5472
5435
|
method: HttpMethod.DELETE,
|
|
5473
5436
|
url: `/components/${id}/`,
|
|
@@ -5488,7 +5451,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5488
5451
|
const state = store.getState();
|
|
5489
5452
|
const componentsOfThisType = selectComponentsByType(componentTypeId)(state);
|
|
5490
5453
|
store.dispatch(removeAllComponentsOfType(componentTypeId));
|
|
5491
|
-
return this.enqueueRequest({
|
|
5454
|
+
return this.client.enqueueRequest({
|
|
5492
5455
|
description: "Batch delete components by component type",
|
|
5493
5456
|
method: HttpMethod.DELETE,
|
|
5494
5457
|
url: `/components/types/${componentTypeId}/delete-all-of-type/`,
|
|
@@ -5507,7 +5470,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5507
5470
|
});
|
|
5508
5471
|
const { store } = this.client;
|
|
5509
5472
|
store.dispatch(addComponentsInBatches(fullComponents));
|
|
5510
|
-
const promise = this.enqueueRequest({
|
|
5473
|
+
const promise = this.client.enqueueRequest({
|
|
5511
5474
|
description: "Batch create components",
|
|
5512
5475
|
method: HttpMethod.POST,
|
|
5513
5476
|
url: `/components/types/${componentTypeId}/add-components/`,
|
|
@@ -5532,20 +5495,16 @@ var __publicField = (obj, key, value) => {
|
|
|
5532
5495
|
});
|
|
5533
5496
|
return promise;
|
|
5534
5497
|
}
|
|
5535
|
-
async refreshStore(
|
|
5498
|
+
async refreshStore() {
|
|
5536
5499
|
const { store } = this.client;
|
|
5537
|
-
const result = await this.enqueueRequest({
|
|
5500
|
+
const result = await this.client.enqueueRequest({
|
|
5538
5501
|
description: "Get components",
|
|
5539
5502
|
method: HttpMethod.GET,
|
|
5540
5503
|
url: `/projects/${store.getState().projectReducer.activeProjectId}/components/`,
|
|
5541
5504
|
blockers: [],
|
|
5542
5505
|
blocks: []
|
|
5543
5506
|
});
|
|
5544
|
-
|
|
5545
|
-
store.dispatch(setComponents(result));
|
|
5546
|
-
} else {
|
|
5547
|
-
store.dispatch(addComponentsInBatches(result));
|
|
5548
|
-
}
|
|
5507
|
+
store.dispatch(setComponents(result));
|
|
5549
5508
|
}
|
|
5550
5509
|
}
|
|
5551
5510
|
class ComponentStageCompletionService extends BaseApiService {
|
|
@@ -5561,7 +5520,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5561
5520
|
stage: stageId
|
|
5562
5521
|
});
|
|
5563
5522
|
store.dispatch(addStageCompletion(offlineCompletion));
|
|
5564
|
-
const promise = this.enqueueRequest({
|
|
5523
|
+
const promise = this.client.enqueueRequest({
|
|
5565
5524
|
description: "Mark stage as completed",
|
|
5566
5525
|
method: HttpMethod.POST,
|
|
5567
5526
|
url: `/components/types/${componentType}/complete-stages/`,
|
|
@@ -5574,7 +5533,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5574
5533
|
}
|
|
5575
5534
|
async refreshStore() {
|
|
5576
5535
|
const { store } = this.client;
|
|
5577
|
-
const result = await this.enqueueRequest({
|
|
5536
|
+
const result = await this.client.enqueueRequest({
|
|
5578
5537
|
description: "Get completed stages",
|
|
5579
5538
|
method: HttpMethod.GET,
|
|
5580
5539
|
url: `/projects/${store.getState().projectReducer.activeProjectId}/component-stage-completions/`,
|
|
@@ -5601,7 +5560,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5601
5560
|
asMapping[completion.component] = stageToCompletionDateMapping;
|
|
5602
5561
|
}
|
|
5603
5562
|
this.client.store.dispatch(addStageCompletions(asMapping));
|
|
5604
|
-
await this.enqueueRequest({
|
|
5563
|
+
await this.client.enqueueRequest({
|
|
5605
5564
|
description: "Mark multiple stage as completed",
|
|
5606
5565
|
method: HttpMethod.POST,
|
|
5607
5566
|
url: `/components/types/${componentTypeId}/complete-stages/`,
|
|
@@ -5624,7 +5583,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5624
5583
|
};
|
|
5625
5584
|
});
|
|
5626
5585
|
this.client.store.dispatch(removeStageCompletions(completionsToRemove));
|
|
5627
|
-
return this.enqueueRequest({
|
|
5586
|
+
return this.client.enqueueRequest({
|
|
5628
5587
|
description: `Undo stage for ${componentIds.length} component(s)`,
|
|
5629
5588
|
// TODO: Rename to setCompletedStages
|
|
5630
5589
|
method: HttpMethod.DELETE,
|
|
@@ -5646,7 +5605,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5646
5605
|
return { ...stage, component_type: componentTypeId };
|
|
5647
5606
|
});
|
|
5648
5607
|
this.client.store.dispatch(addStages(fullStages));
|
|
5649
|
-
return this.enqueueRequest({
|
|
5608
|
+
return this.client.enqueueRequest({
|
|
5650
5609
|
description: "Add component stages",
|
|
5651
5610
|
method: HttpMethod.POST,
|
|
5652
5611
|
url: `/components/types/${componentTypeId}/add-stages/`,
|
|
@@ -5670,7 +5629,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5670
5629
|
throw new Error("Could not find the desired stages to update within the store");
|
|
5671
5630
|
}
|
|
5672
5631
|
store.dispatch(updateStages(stagesToUpdate));
|
|
5673
|
-
return this.enqueueRequest({
|
|
5632
|
+
return this.client.enqueueRequest({
|
|
5674
5633
|
description: "Edit component stages",
|
|
5675
5634
|
method: HttpMethod.PATCH,
|
|
5676
5635
|
url: `/components/types/${componentTypeId}/bulk-update-stages/`,
|
|
@@ -5686,7 +5645,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5686
5645
|
}
|
|
5687
5646
|
async bulkDelete(idsToDelete) {
|
|
5688
5647
|
this.client.store.dispatch(removeStages(idsToDelete));
|
|
5689
|
-
return this.enqueueRequest({
|
|
5648
|
+
return this.client.enqueueRequest({
|
|
5690
5649
|
description: "Delete component stages",
|
|
5691
5650
|
method: HttpMethod.DELETE,
|
|
5692
5651
|
url: "/components/stages/bulk-delete/",
|
|
@@ -5699,7 +5658,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5699
5658
|
}
|
|
5700
5659
|
async update(componentStage) {
|
|
5701
5660
|
this.client.store.dispatch(addStages([componentStage]));
|
|
5702
|
-
return this.enqueueRequest({
|
|
5661
|
+
return this.client.enqueueRequest({
|
|
5703
5662
|
description: "Update component stage",
|
|
5704
5663
|
method: HttpMethod.PATCH,
|
|
5705
5664
|
url: `/components/stages/${componentStage.offline_id}/`,
|
|
@@ -5712,7 +5671,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5712
5671
|
const { store } = this.client;
|
|
5713
5672
|
store.dispatch(linkStageToForm({ stageId, formId: formId2 }));
|
|
5714
5673
|
try {
|
|
5715
|
-
await this.enqueueRequest({
|
|
5674
|
+
await this.client.enqueueRequest({
|
|
5716
5675
|
description: "Link component stage to form",
|
|
5717
5676
|
method: HttpMethod.POST,
|
|
5718
5677
|
url: `/components/stages/${stageId}/associate-with-form/`,
|
|
@@ -5729,7 +5688,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5729
5688
|
const { store } = this.client;
|
|
5730
5689
|
store.dispatch(unlinkStageToForm({ stageId }));
|
|
5731
5690
|
try {
|
|
5732
|
-
await this.enqueueRequest({
|
|
5691
|
+
await this.client.enqueueRequest({
|
|
5733
5692
|
description: "Unlink component stage from form",
|
|
5734
5693
|
method: HttpMethod.DELETE,
|
|
5735
5694
|
url: `/components/stages/${stageId}/associate-with-form/`,
|
|
@@ -5743,7 +5702,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5743
5702
|
}
|
|
5744
5703
|
async refreshStore() {
|
|
5745
5704
|
const { store } = this.client;
|
|
5746
|
-
const result = await this.enqueueRequest({
|
|
5705
|
+
const result = await this.client.enqueueRequest({
|
|
5747
5706
|
description: "Get component stages",
|
|
5748
5707
|
method: HttpMethod.GET,
|
|
5749
5708
|
url: `/projects/${store.getState().projectReducer.activeProjectId}/component-stages/`,
|
|
@@ -5809,7 +5768,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5809
5768
|
}
|
|
5810
5769
|
processPresignedUrls(presignedUrls) {
|
|
5811
5770
|
for (const [sha1, presignedUrl] of Object.entries(presignedUrls)) {
|
|
5812
|
-
void this.enqueueRequest({
|
|
5771
|
+
void this.client.enqueueRequest({
|
|
5813
5772
|
url: presignedUrl.url,
|
|
5814
5773
|
description: "Upload file to S3",
|
|
5815
5774
|
method: HttpMethod.POST,
|
|
@@ -5829,7 +5788,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5829
5788
|
const { store } = this.client;
|
|
5830
5789
|
const activeProjectId = store.getState().projectReducer.activeProjectId;
|
|
5831
5790
|
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
5832
|
-
const result = await this.enqueueRequest({
|
|
5791
|
+
const result = await this.client.enqueueRequest({
|
|
5833
5792
|
description: `Get ${meta.name} attachments`,
|
|
5834
5793
|
method: HttpMethod.GET,
|
|
5835
5794
|
url: `/projects/${activeProjectId}${meta.fetchUrlPostfix}/`,
|
|
@@ -5874,7 +5833,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5874
5833
|
}
|
|
5875
5834
|
store.dispatch(actions.addAttachments(offlineAttachments));
|
|
5876
5835
|
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
5877
|
-
const promise = this.enqueueRequest({
|
|
5836
|
+
const promise = this.client.enqueueRequest({
|
|
5878
5837
|
description: `Attach files to ${meta.name}`,
|
|
5879
5838
|
method: HttpMethod.POST,
|
|
5880
5839
|
url: `${meta.attachUrlPrefix}/${modelId}/attach/`,
|
|
@@ -5904,7 +5863,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5904
5863
|
}
|
|
5905
5864
|
store.dispatch(actions.removeAttachment(attachment.offline_id));
|
|
5906
5865
|
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
5907
|
-
const promise = this.enqueueRequest({
|
|
5866
|
+
const promise = this.client.enqueueRequest({
|
|
5908
5867
|
description: "Delete attachment",
|
|
5909
5868
|
method: HttpMethod.DELETE,
|
|
5910
5869
|
url: `${meta.deleteUrlPrefix}/attachments/${attachmendId}/`,
|
|
@@ -5974,7 +5933,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5974
5933
|
const { store } = this.client;
|
|
5975
5934
|
const activeProjectId = store.getState().projectReducer.activeProjectId;
|
|
5976
5935
|
store.dispatch(addComponentType(offlineComponentType));
|
|
5977
|
-
const promise = this.enqueueRequest({
|
|
5936
|
+
const promise = this.client.enqueueRequest({
|
|
5978
5937
|
description: "Create ComponentType",
|
|
5979
5938
|
method: HttpMethod.POST,
|
|
5980
5939
|
url: `/projects/${activeProjectId}/component-types/`,
|
|
@@ -5986,7 +5945,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5986
5945
|
}
|
|
5987
5946
|
update(componentType) {
|
|
5988
5947
|
this.client.store.dispatch(addComponentType(componentType));
|
|
5989
|
-
return this.enqueueRequest({
|
|
5948
|
+
return this.client.enqueueRequest({
|
|
5990
5949
|
description: "Update ComponentType",
|
|
5991
5950
|
method: HttpMethod.PATCH,
|
|
5992
5951
|
url: `/components/types/${componentType.offline_id}/`,
|
|
@@ -6015,7 +5974,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6015
5974
|
const attachmentsOfComponentTypeIds = attachmentsOfComponentType.map(({ offline_id }) => offline_id);
|
|
6016
5975
|
store.dispatch(removeComponentTypeAttachments(attachmentsOfComponentTypeIds));
|
|
6017
5976
|
}
|
|
6018
|
-
return this.enqueueRequest({
|
|
5977
|
+
return this.client.enqueueRequest({
|
|
6019
5978
|
description: "Delete ComponentType",
|
|
6020
5979
|
method: HttpMethod.DELETE,
|
|
6021
5980
|
url: `/components/types/${componentTypeId}/`,
|
|
@@ -6030,7 +5989,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6030
5989
|
}
|
|
6031
5990
|
async refreshStore() {
|
|
6032
5991
|
const { store } = this.client;
|
|
6033
|
-
const result = await this.enqueueRequest({
|
|
5992
|
+
const result = await this.client.enqueueRequest({
|
|
6034
5993
|
description: "Get component types",
|
|
6035
5994
|
method: HttpMethod.GET,
|
|
6036
5995
|
url: `/projects/${store.getState().projectReducer.activeProjectId}/component-types/`,
|
|
@@ -6097,7 +6056,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6097
6056
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
6098
6057
|
});
|
|
6099
6058
|
store.dispatch(addIssueComment(offlineComment));
|
|
6100
|
-
const promise = this.enqueueRequest({
|
|
6059
|
+
const promise = this.client.enqueueRequest({
|
|
6101
6060
|
description: `${truncate(comment.content, 80)}`,
|
|
6102
6061
|
method: HttpMethod.POST,
|
|
6103
6062
|
url: `/issues/${comment.issue}/comment/`,
|
|
@@ -6117,7 +6076,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6117
6076
|
throw new Error(`Comment with offline_id ${comment.offline_id} not found in store`);
|
|
6118
6077
|
}
|
|
6119
6078
|
store.dispatch(setIssueComment(comment));
|
|
6120
|
-
const promise = this.enqueueRequest({
|
|
6079
|
+
const promise = this.client.enqueueRequest({
|
|
6121
6080
|
description: `Edit comment: ${truncate(comment.content, 80)}`,
|
|
6122
6081
|
method: HttpMethod.PATCH,
|
|
6123
6082
|
url: `/issues/comments/${comment.offline_id}/`,
|
|
@@ -6136,7 +6095,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6136
6095
|
throw new Error(`Comment with offline_id ${offline_id} not found in store`);
|
|
6137
6096
|
}
|
|
6138
6097
|
this.client.store.dispatch(removeIssueComment(offline_id));
|
|
6139
|
-
const promise = this.enqueueRequest({
|
|
6098
|
+
const promise = this.client.enqueueRequest({
|
|
6140
6099
|
description: "Delete comment",
|
|
6141
6100
|
method: HttpMethod.DELETE,
|
|
6142
6101
|
url: `/issues/comments/${offline_id}/`,
|
|
@@ -6150,7 +6109,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6150
6109
|
}
|
|
6151
6110
|
async refreshStore() {
|
|
6152
6111
|
const { store } = this.client;
|
|
6153
|
-
const result = await this.enqueueRequest({
|
|
6112
|
+
const result = await this.client.enqueueRequest({
|
|
6154
6113
|
description: "Get comments",
|
|
6155
6114
|
method: HttpMethod.GET,
|
|
6156
6115
|
// TODO: Choose between /issues/comments/in-project/${projectId}/ and /projects/${projectId}/issue-comments/
|
|
@@ -6164,7 +6123,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6164
6123
|
class IssueUpdateService extends BaseApiService {
|
|
6165
6124
|
async refreshStore() {
|
|
6166
6125
|
const { store } = this.client;
|
|
6167
|
-
const result = await this.enqueueRequest({
|
|
6126
|
+
const result = await this.client.enqueueRequest({
|
|
6168
6127
|
description: "Get issue updates",
|
|
6169
6128
|
method: HttpMethod.GET,
|
|
6170
6129
|
url: `/projects/${store.getState().projectReducer.activeProjectId}/issues/updates/`,
|
|
@@ -6250,7 +6209,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6250
6209
|
store.dispatch(addIssue(issuePayload));
|
|
6251
6210
|
store.dispatch(addToRecentIssues(issuePayload.offline_id));
|
|
6252
6211
|
store.dispatch(addActiveProjectIssuesCount(1));
|
|
6253
|
-
const promise = this.enqueueRequest({
|
|
6212
|
+
const promise = this.client.enqueueRequest({
|
|
6254
6213
|
description: "Create issue",
|
|
6255
6214
|
method: HttpMethod.POST,
|
|
6256
6215
|
url: "/issues/",
|
|
@@ -6274,7 +6233,8 @@ var __publicField = (obj, key, value) => {
|
|
|
6274
6233
|
if (error2 instanceof APIError) {
|
|
6275
6234
|
(_a2 = blocks.unsafeShowToast) == null ? void 0 : _a2.call(blocks, {
|
|
6276
6235
|
title: "Could not create issue",
|
|
6277
|
-
description:
|
|
6236
|
+
description: error2.message,
|
|
6237
|
+
severity: "danger"
|
|
6278
6238
|
});
|
|
6279
6239
|
}
|
|
6280
6240
|
store.dispatch(removeIssue(issuePayload.offline_id));
|
|
@@ -6284,7 +6244,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6284
6244
|
return [issuePayload, promise];
|
|
6285
6245
|
}
|
|
6286
6246
|
fetchAll(projectId) {
|
|
6287
|
-
const promise = this.enqueueRequest({
|
|
6247
|
+
const promise = this.client.enqueueRequest({
|
|
6288
6248
|
description: "Get issues",
|
|
6289
6249
|
method: HttpMethod.GET,
|
|
6290
6250
|
url: `/projects/${projectId}/issues/`,
|
|
@@ -6381,7 +6341,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6381
6341
|
changes
|
|
6382
6342
|
});
|
|
6383
6343
|
this.client.store.dispatch(addIssueUpdate(offlineIssueUpdate));
|
|
6384
|
-
const promise = this.enqueueRequest({
|
|
6344
|
+
const promise = this.client.enqueueRequest({
|
|
6385
6345
|
description: "Edit issue",
|
|
6386
6346
|
method: HttpMethod.PATCH,
|
|
6387
6347
|
url: `/issues/${issue.offline_id}/`,
|
|
@@ -6414,7 +6374,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6414
6374
|
if (updatesOfIssue.length > 0)
|
|
6415
6375
|
dispatch(removeIssueUpdates(updatesOfIssue.map(({ offline_id }) => offline_id)));
|
|
6416
6376
|
try {
|
|
6417
|
-
return await this.enqueueRequest({
|
|
6377
|
+
return await this.client.enqueueRequest({
|
|
6418
6378
|
description: "Delete issue",
|
|
6419
6379
|
method: HttpMethod.DELETE,
|
|
6420
6380
|
url: `/issues/${id}/`,
|
|
@@ -6456,7 +6416,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6456
6416
|
organization: activeOrganizationId
|
|
6457
6417
|
});
|
|
6458
6418
|
store.dispatch(addIssueType(offlineIssueType));
|
|
6459
|
-
const promise = this.enqueueRequest({
|
|
6419
|
+
const promise = this.client.enqueueRequest({
|
|
6460
6420
|
method: HttpMethod.POST,
|
|
6461
6421
|
url: `/organizations/${activeOrganizationId}/issue-types/`,
|
|
6462
6422
|
// Sending only whats needed here
|
|
@@ -6489,7 +6449,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6489
6449
|
...issueTypeFields
|
|
6490
6450
|
};
|
|
6491
6451
|
store.dispatch(updateIssueType(offlineUpdatedIssueType));
|
|
6492
|
-
const promise = this.enqueueRequest({
|
|
6452
|
+
const promise = this.client.enqueueRequest({
|
|
6493
6453
|
method: HttpMethod.PATCH,
|
|
6494
6454
|
url: `/issues/types/${issueTypeFields.offline_id}/`,
|
|
6495
6455
|
payload: issueTypeFields,
|
|
@@ -6513,7 +6473,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6513
6473
|
const issuesOfIssueType = selectIssuesOfIssueType(issueTypeId)(state) ?? [];
|
|
6514
6474
|
store.dispatch(removeIssueType(issueTypeId));
|
|
6515
6475
|
store.dispatch(removeIssues(issuesOfIssueType.map((issue) => issue.offline_id)));
|
|
6516
|
-
const promise = this.enqueueRequest({
|
|
6476
|
+
const promise = this.client.enqueueRequest({
|
|
6517
6477
|
method: HttpMethod.DELETE,
|
|
6518
6478
|
url: `/issues/types/${issueTypeId}/`,
|
|
6519
6479
|
blockers: [issueTypeId],
|
|
@@ -6531,7 +6491,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6531
6491
|
if (!activeOrganizationId) {
|
|
6532
6492
|
throw new Error(`No active organization, got ${activeOrganizationId} for activeOrganizationId.`);
|
|
6533
6493
|
}
|
|
6534
|
-
const result = await this.enqueueRequest({
|
|
6494
|
+
const result = await this.client.enqueueRequest({
|
|
6535
6495
|
method: HttpMethod.GET,
|
|
6536
6496
|
url: `/organizations/${activeOrganizationId}/issue-types/`,
|
|
6537
6497
|
blockers: [],
|
|
@@ -6545,7 +6505,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6545
6505
|
if (replaceExisting) {
|
|
6546
6506
|
this.client.store.dispatch(setIsFetchingInitialData(true));
|
|
6547
6507
|
}
|
|
6548
|
-
|
|
6508
|
+
const result = await this.client.enqueueRequest({
|
|
6549
6509
|
uuid: uuid2,
|
|
6550
6510
|
description: "Get initial data",
|
|
6551
6511
|
method: HttpMethod.GET,
|
|
@@ -6554,22 +6514,24 @@ var __publicField = (obj, key, value) => {
|
|
|
6554
6514
|
isAuthNeeded: true,
|
|
6555
6515
|
blockers: [],
|
|
6556
6516
|
blocks: []
|
|
6557
|
-
}).then((result) => {
|
|
6558
|
-
void this._processInitialData(result, replaceExisting);
|
|
6559
|
-
return result;
|
|
6560
6517
|
});
|
|
6518
|
+
void this._processInitialData(result, replaceExisting);
|
|
6561
6519
|
}
|
|
6562
|
-
async fetchProjectUsers(
|
|
6563
|
-
|
|
6520
|
+
async fetchProjectUsers() {
|
|
6521
|
+
const projectId = this.client.store.getState().projectReducer.activeProjectId;
|
|
6522
|
+
return this.client.enqueueRequest({
|
|
6564
6523
|
description: "Fetch users",
|
|
6565
6524
|
method: HttpMethod.GET,
|
|
6566
6525
|
url: `/projects/${projectId}/users/`,
|
|
6567
6526
|
blockers: [],
|
|
6568
6527
|
blocks: []
|
|
6528
|
+
}).then((users) => {
|
|
6529
|
+
this.client.store.dispatch(addUsers(users));
|
|
6530
|
+
return users;
|
|
6569
6531
|
});
|
|
6570
6532
|
}
|
|
6571
6533
|
async fetchOrganizationUsers(orgId) {
|
|
6572
|
-
return this.enqueueRequest({
|
|
6534
|
+
return this.client.enqueueRequest({
|
|
6573
6535
|
description: "Fetch organization users",
|
|
6574
6536
|
method: HttpMethod.GET,
|
|
6575
6537
|
url: `/organizations/${orgId}/users/`,
|
|
@@ -6580,11 +6542,12 @@ var __publicField = (obj, key, value) => {
|
|
|
6580
6542
|
// TODO:
|
|
6581
6543
|
// Don't accept updateStore in ComponentService.list. Just return the offline objects and promise. Here, if
|
|
6582
6544
|
// overwrite, use setComponents. Otherwise, use bulkAddComponents.
|
|
6545
|
+
// TODO: This needs major cleanup. Send less in the initial data: Only the basic project info and anything needed
|
|
6546
|
+
// literally immediately.
|
|
6583
6547
|
async _processInitialData(data, overwrite) {
|
|
6584
6548
|
var _a2, _b, _c;
|
|
6585
6549
|
const workspaces = {};
|
|
6586
6550
|
const projects = [];
|
|
6587
|
-
const categories = [];
|
|
6588
6551
|
const projectsData = data.projects;
|
|
6589
6552
|
const { store } = this.client;
|
|
6590
6553
|
const oldProjectId = (_a2 = projectsData.find(
|
|
@@ -6608,18 +6571,11 @@ var __publicField = (obj, key, value) => {
|
|
|
6608
6571
|
isProjectIdValid = true;
|
|
6609
6572
|
for (const workspaceData of projectData.workspaces) {
|
|
6610
6573
|
const workspace = { ...workspaceData, project: projectData.id };
|
|
6611
|
-
if (workspace.categories) {
|
|
6612
|
-
for (const category of workspace.categories) {
|
|
6613
|
-
categories.push(category);
|
|
6614
|
-
}
|
|
6615
|
-
}
|
|
6616
|
-
delete workspace.categories;
|
|
6617
6574
|
workspaces[workspace.offline_id] = workspace;
|
|
6618
6575
|
}
|
|
6619
6576
|
}
|
|
6620
6577
|
}
|
|
6621
6578
|
store.dispatch(setCurrentUser(data.user));
|
|
6622
|
-
store.dispatch(addUsers(data.project_owners));
|
|
6623
6579
|
store.dispatch(setLicenses(data.licenses));
|
|
6624
6580
|
const organizationsData = data.organizations;
|
|
6625
6581
|
store.dispatch(setOrganizations(organizationsData));
|
|
@@ -6640,8 +6596,11 @@ var __publicField = (obj, key, value) => {
|
|
|
6640
6596
|
currentOrgId = firstOrg.id;
|
|
6641
6597
|
}
|
|
6642
6598
|
if (currentOrgId) {
|
|
6643
|
-
await this.client.organizations.fetchInitialOrganizationData(currentOrgId, false);
|
|
6644
|
-
|
|
6599
|
+
const initialOrgData = await this.client.organizations.fetchInitialOrganizationData(currentOrgId, false);
|
|
6600
|
+
currentOrgId = initialOrgData.organization.id;
|
|
6601
|
+
}
|
|
6602
|
+
if (!currentOrgId) {
|
|
6603
|
+
throw new Error("No organization found");
|
|
6645
6604
|
}
|
|
6646
6605
|
if (!isProjectIdValid) {
|
|
6647
6606
|
if (validProjects.length !== 0) {
|
|
@@ -6651,12 +6610,6 @@ var __publicField = (obj, key, value) => {
|
|
|
6651
6610
|
if (projectData) {
|
|
6652
6611
|
for (const workspaceData of projectData.workspaces) {
|
|
6653
6612
|
const workspace = { ...workspaceData, project: projectData.id };
|
|
6654
|
-
if (workspace.categories) {
|
|
6655
|
-
for (const category of workspace.categories) {
|
|
6656
|
-
categories.push(category);
|
|
6657
|
-
}
|
|
6658
|
-
}
|
|
6659
|
-
delete workspace.categories;
|
|
6660
6613
|
workspaces[workspace.offline_id] = workspace;
|
|
6661
6614
|
}
|
|
6662
6615
|
}
|
|
@@ -6665,14 +6618,6 @@ var __publicField = (obj, key, value) => {
|
|
|
6665
6618
|
store.dispatch(setActiveProjectId(currentProjectId));
|
|
6666
6619
|
}
|
|
6667
6620
|
}
|
|
6668
|
-
if (currentProjectId) {
|
|
6669
|
-
const usersResultPromise = this.fetchProjectUsers(currentProjectId);
|
|
6670
|
-
const projectAccessRefreshPromise = this.client.projectAccesses.refreshStore();
|
|
6671
|
-
const usersResult = await usersResultPromise;
|
|
6672
|
-
await projectAccessRefreshPromise;
|
|
6673
|
-
store.dispatch(addUsers(usersResult));
|
|
6674
|
-
void this.client.projectAttachments.refreshStore();
|
|
6675
|
-
}
|
|
6676
6621
|
let currentWorkspaceId;
|
|
6677
6622
|
const oldWorkspaceId = this.client.store.getState().workspaceReducer.activeWorkspaceId;
|
|
6678
6623
|
if (overwrite || !oldWorkspaceId) {
|
|
@@ -6680,56 +6625,54 @@ var __publicField = (obj, key, value) => {
|
|
|
6680
6625
|
} else {
|
|
6681
6626
|
currentWorkspaceId = oldWorkspaceId;
|
|
6682
6627
|
}
|
|
6683
|
-
if (currentWorkspaceId
|
|
6628
|
+
if (currentWorkspaceId) {
|
|
6684
6629
|
store.dispatch(setActiveWorkspaceId(currentWorkspaceId));
|
|
6685
|
-
void this.client.categories.refreshStore().then(() => {
|
|
6686
|
-
void this.client.issues.refreshStore().then(() => {
|
|
6687
|
-
void this.client.issueAttachments.refreshStore().then();
|
|
6688
|
-
void this.client.issueComments.refreshStore().then();
|
|
6689
|
-
void this.client.issueUpdates.refreshStore().then();
|
|
6690
|
-
});
|
|
6691
|
-
});
|
|
6692
|
-
void this.client.projectFiles.refreshStore().then();
|
|
6693
|
-
void this.client.componentTypes.refreshStore().then(() => {
|
|
6694
|
-
void this.client.componentTypeAttachments.refreshStore().then(() => {
|
|
6695
|
-
void this.client.componentStages.refreshStore().then(() => {
|
|
6696
|
-
void this.client.components.refreshStore(overwrite).then(() => {
|
|
6697
|
-
void this.client.componentAttachments.refreshStore().then();
|
|
6698
|
-
});
|
|
6699
|
-
});
|
|
6700
|
-
void this.client.componentStageCompletions.refreshStore().then();
|
|
6701
|
-
});
|
|
6702
|
-
});
|
|
6703
|
-
void this.client.userForms.refreshStore().then(() => {
|
|
6704
|
-
void this.client.userFormSubmissions.refreshStore().then();
|
|
6705
|
-
});
|
|
6706
|
-
}
|
|
6707
|
-
if (currentProjectId) {
|
|
6708
|
-
void this.client.documents.refreshStore().then(() => {
|
|
6709
|
-
void this.client.documentAttachments.refreshStore().then();
|
|
6710
|
-
});
|
|
6711
|
-
void this.client.documents.refreshStore();
|
|
6712
|
-
void this.client.issueUpdates.refreshStore();
|
|
6713
|
-
void this.client.issueTypes.refreshStore();
|
|
6714
6630
|
}
|
|
6715
|
-
store.dispatch(setIsFetchingInitialData(false));
|
|
6716
6631
|
if (overwrite) {
|
|
6717
6632
|
console.log("Overwriting data");
|
|
6718
6633
|
store.dispatch(setProjects(projects));
|
|
6719
6634
|
store.dispatch(setWorkspaces(workspaces));
|
|
6720
|
-
store.dispatch(setCategories(categories));
|
|
6721
6635
|
store.dispatch(resetRecentIssues());
|
|
6722
6636
|
} else {
|
|
6723
6637
|
console.log("Updating data (collisions will be replaced)");
|
|
6724
6638
|
store.dispatch(addOrReplaceProjects(projects));
|
|
6725
6639
|
store.dispatch(addOrReplaceWorkspaces(workspaces));
|
|
6726
|
-
store.dispatch(addOrReplaceCategories(categories));
|
|
6727
6640
|
}
|
|
6641
|
+
if (!currentProjectId) {
|
|
6642
|
+
store.dispatch(setIsFetchingInitialData(false));
|
|
6643
|
+
} else {
|
|
6644
|
+
try {
|
|
6645
|
+
await this.client.projectFiles.refreshStore();
|
|
6646
|
+
} finally {
|
|
6647
|
+
store.dispatch(setIsFetchingInitialData(false));
|
|
6648
|
+
}
|
|
6649
|
+
void this.client.componentTypes.refreshStore();
|
|
6650
|
+
void this.client.componentStages.refreshStore();
|
|
6651
|
+
void this.client.components.refreshStore();
|
|
6652
|
+
void this.client.componentStageCompletions.refreshStore();
|
|
6653
|
+
void this.client.categories.refreshStore();
|
|
6654
|
+
void this.client.issueTypes.refreshStore();
|
|
6655
|
+
void this.client.issues.refreshStore();
|
|
6656
|
+
void this.fetchProjectUsers();
|
|
6657
|
+
void this.client.documents.refreshStore();
|
|
6658
|
+
void this.client.userForms.refreshStore();
|
|
6659
|
+
void this.client.documentAttachments.refreshStore();
|
|
6660
|
+
void this.client.userFormSubmissions.refreshStore();
|
|
6661
|
+
void this.client.agent.refreshStore();
|
|
6662
|
+
void this.client.issueAttachments.refreshStore();
|
|
6663
|
+
void this.client.issueComments.refreshStore();
|
|
6664
|
+
void this.client.issueUpdates.refreshStore();
|
|
6665
|
+
void this.client.projectAccesses.refreshStore();
|
|
6666
|
+
void this.client.projectAttachments.refreshStore();
|
|
6667
|
+
void this.client.componentTypeAttachments.refreshStore();
|
|
6668
|
+
void this.client.componentAttachments.refreshStore();
|
|
6669
|
+
}
|
|
6670
|
+
void this.client.teams.refreshStore();
|
|
6728
6671
|
}
|
|
6729
6672
|
}
|
|
6730
6673
|
class ProjectAccessService extends BaseApiService {
|
|
6731
6674
|
async fetchAll(projectId) {
|
|
6732
|
-
return this.enqueueRequest({
|
|
6675
|
+
return this.client.enqueueRequest({
|
|
6733
6676
|
description: "Get project accesses",
|
|
6734
6677
|
method: HttpMethod.GET,
|
|
6735
6678
|
url: `/projects/${projectId}/access/`,
|
|
@@ -6739,7 +6682,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6739
6682
|
}
|
|
6740
6683
|
async update(projectAccess) {
|
|
6741
6684
|
this.client.store.dispatch(updateProjectAccess(projectAccess));
|
|
6742
|
-
return this.enqueueRequest({
|
|
6685
|
+
return this.client.enqueueRequest({
|
|
6743
6686
|
description: "Edit project access",
|
|
6744
6687
|
method: HttpMethod.PATCH,
|
|
6745
6688
|
url: `/access/${projectAccess.offline_id}/`,
|
|
@@ -6752,7 +6695,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6752
6695
|
async remove(projectAccess) {
|
|
6753
6696
|
const { store } = this.client;
|
|
6754
6697
|
store.dispatch(removeProjectAccess(projectAccess));
|
|
6755
|
-
return this.enqueueRequest({
|
|
6698
|
+
return this.client.enqueueRequest({
|
|
6756
6699
|
description: "Delete project access",
|
|
6757
6700
|
method: HttpMethod.DELETE,
|
|
6758
6701
|
url: `/access/${projectAccess.offline_id}/`,
|
|
@@ -6764,23 +6707,18 @@ var __publicField = (obj, key, value) => {
|
|
|
6764
6707
|
const { store } = this.client;
|
|
6765
6708
|
const state = store.getState();
|
|
6766
6709
|
const projectId = state.projectReducer.activeProjectId;
|
|
6767
|
-
const currentUser = state.userReducer.currentUser;
|
|
6768
6710
|
if (!projectId) {
|
|
6769
6711
|
throw new Error("No active project");
|
|
6770
6712
|
}
|
|
6771
6713
|
const promise = this.fetchAll(projectId);
|
|
6772
6714
|
const result = await promise;
|
|
6773
|
-
const activeProjectAccess = result.find((projectAccess) => projectAccess.user === currentUser.id);
|
|
6774
|
-
if (!activeProjectAccess) {
|
|
6775
|
-
throw new Error("Current user does not have a project access instance");
|
|
6776
|
-
}
|
|
6777
6715
|
store.dispatch(setProjectAccesses(result));
|
|
6778
6716
|
}
|
|
6779
6717
|
}
|
|
6780
6718
|
class ProjectFileService extends BaseApiService {
|
|
6781
6719
|
async refreshStore() {
|
|
6782
6720
|
const { store } = this.client;
|
|
6783
|
-
const result = await this.enqueueRequest({
|
|
6721
|
+
const result = await this.client.enqueueRequest({
|
|
6784
6722
|
description: "Get project files",
|
|
6785
6723
|
method: HttpMethod.GET,
|
|
6786
6724
|
url: `/projects/${store.getState().projectReducer.activeProjectId}/files/`,
|
|
@@ -6797,7 +6735,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6797
6735
|
}
|
|
6798
6736
|
const editableData = { ...file };
|
|
6799
6737
|
delete editableData.file;
|
|
6800
|
-
const promise = this.enqueueRequest({
|
|
6738
|
+
const promise = this.client.enqueueRequest({
|
|
6801
6739
|
method: HttpMethod.PATCH,
|
|
6802
6740
|
url: `/projects/files/${file.offline_id}/`,
|
|
6803
6741
|
payload: editableData,
|
|
@@ -6855,7 +6793,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6855
6793
|
});
|
|
6856
6794
|
}
|
|
6857
6795
|
const promise = Promise.resolve(requestDetails).then((requestDetails2) => {
|
|
6858
|
-
return this.enqueueRequest(requestDetails2);
|
|
6796
|
+
return this.client.enqueueRequest(requestDetails2);
|
|
6859
6797
|
});
|
|
6860
6798
|
void promise.then((result) => {
|
|
6861
6799
|
store.dispatch(addOrReplaceProjectFile(result));
|
|
@@ -6867,7 +6805,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6867
6805
|
}
|
|
6868
6806
|
delete(projectFileId) {
|
|
6869
6807
|
this.client.store.dispatch(removeProjectFile(projectFileId));
|
|
6870
|
-
return this.enqueueRequest({
|
|
6808
|
+
return this.client.enqueueRequest({
|
|
6871
6809
|
method: HttpMethod.DELETE,
|
|
6872
6810
|
url: `/projects/files/${projectFileId}`,
|
|
6873
6811
|
blockers: [projectFileId],
|
|
@@ -6938,7 +6876,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6938
6876
|
}
|
|
6939
6877
|
const url = isOrganizationProject ? `/organizations/${project.owner_organization}/projects/` : "/projects/";
|
|
6940
6878
|
const projectType = isOrganizationProject ? { organization_owner: project.owner_organization } : { user_owner: project.owner_user };
|
|
6941
|
-
const result = await this.enqueueRequest({
|
|
6879
|
+
const result = await this.client.enqueueRequest({
|
|
6942
6880
|
description: "Create project",
|
|
6943
6881
|
method: HttpMethod.POST,
|
|
6944
6882
|
url,
|
|
@@ -6962,7 +6900,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6962
6900
|
throw new Error("Project bounds were not set before trying to create a project");
|
|
6963
6901
|
}
|
|
6964
6902
|
store.dispatch(updateOrCreateProject(project));
|
|
6965
|
-
return await this.enqueueRequest({
|
|
6903
|
+
return await this.client.enqueueRequest({
|
|
6966
6904
|
description: "Update project",
|
|
6967
6905
|
method: HttpMethod.PATCH,
|
|
6968
6906
|
url: `/projects/${project.id}/`,
|
|
@@ -7002,7 +6940,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7002
6940
|
store.dispatch(updateLicense({ ...license, project: null }));
|
|
7003
6941
|
}
|
|
7004
6942
|
try {
|
|
7005
|
-
await this.enqueueRequest({
|
|
6943
|
+
await this.client.enqueueRequest({
|
|
7006
6944
|
description: "Delete project",
|
|
7007
6945
|
method: HttpMethod.DELETE,
|
|
7008
6946
|
url: `/projects/${projectId}/`,
|
|
@@ -7025,7 +6963,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7025
6963
|
}
|
|
7026
6964
|
invite(projectId, email) {
|
|
7027
6965
|
const offline_id = uuid.v4();
|
|
7028
|
-
return this.enqueueRequest({
|
|
6966
|
+
return this.client.enqueueRequest({
|
|
7029
6967
|
description: "Invite user to project",
|
|
7030
6968
|
method: HttpMethod.POST,
|
|
7031
6969
|
url: `/projects/${projectId}/invite/${email}/`,
|
|
@@ -7037,7 +6975,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7037
6975
|
});
|
|
7038
6976
|
}
|
|
7039
6977
|
joinProject(projectId, userId, inviteCode) {
|
|
7040
|
-
return this.enqueueRequest({
|
|
6978
|
+
return this.client.enqueueRequest({
|
|
7041
6979
|
description: "Join project",
|
|
7042
6980
|
method: HttpMethod.GET,
|
|
7043
6981
|
url: `/projects/${projectId}/join-project/${userId}/${inviteCode}/`,
|
|
@@ -7047,7 +6985,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7047
6985
|
});
|
|
7048
6986
|
}
|
|
7049
6987
|
async acceptInvite(projectId) {
|
|
7050
|
-
return this.enqueueRequest({
|
|
6988
|
+
return this.client.enqueueRequest({
|
|
7051
6989
|
description: "Accept project invite",
|
|
7052
6990
|
method: HttpMethod.PATCH,
|
|
7053
6991
|
url: `/projects/${projectId}/accept-invite/`,
|
|
@@ -7106,7 +7044,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7106
7044
|
revision: offlineRevisionId,
|
|
7107
7045
|
field_identifier: key
|
|
7108
7046
|
});
|
|
7109
|
-
const attach = await this.enqueueRequest({
|
|
7047
|
+
const attach = await this.client.enqueueRequest({
|
|
7110
7048
|
description: "Attach image to form revision field",
|
|
7111
7049
|
method: HttpMethod.POST,
|
|
7112
7050
|
url: `/forms/revisions/${offlineRevisionId}/attachments/`,
|
|
@@ -7157,7 +7095,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7157
7095
|
const { store } = this.client;
|
|
7158
7096
|
store.dispatch(addForm(retForm));
|
|
7159
7097
|
store.dispatch(addFormRevision(retRevision));
|
|
7160
|
-
const formPromise = this.enqueueRequest({
|
|
7098
|
+
const formPromise = this.client.enqueueRequest({
|
|
7161
7099
|
description: "Create form",
|
|
7162
7100
|
method: HttpMethod.POST,
|
|
7163
7101
|
url,
|
|
@@ -7229,7 +7167,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7229
7167
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7230
7168
|
};
|
|
7231
7169
|
store.dispatch(addFormRevision(fullRevision));
|
|
7232
|
-
const promise = this.enqueueRequest({
|
|
7170
|
+
const promise = this.client.enqueueRequest({
|
|
7233
7171
|
description: "Create form revision",
|
|
7234
7172
|
method: HttpMethod.PATCH,
|
|
7235
7173
|
url: `/forms/${formId2}/`,
|
|
@@ -7254,7 +7192,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7254
7192
|
const activeProjectId = store.getState().projectReducer.activeProjectId;
|
|
7255
7193
|
store.dispatch(favoriteForm({ formId: formId2 }));
|
|
7256
7194
|
try {
|
|
7257
|
-
await this.enqueueRequest({
|
|
7195
|
+
await this.client.enqueueRequest({
|
|
7258
7196
|
description: "Favorite form",
|
|
7259
7197
|
method: HttpMethod.POST,
|
|
7260
7198
|
url: `/forms/${formId2}/favorite/${activeProjectId}/`,
|
|
@@ -7271,7 +7209,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7271
7209
|
const activeProjectId = store.getState().projectReducer.activeProjectId;
|
|
7272
7210
|
store.dispatch(unfavoriteForm({ formId: formId2 }));
|
|
7273
7211
|
try {
|
|
7274
|
-
return await this.enqueueRequest({
|
|
7212
|
+
return await this.client.enqueueRequest({
|
|
7275
7213
|
description: "Unfavorite form",
|
|
7276
7214
|
method: HttpMethod.DELETE,
|
|
7277
7215
|
url: `/forms/${formId2}/unfavorite/${activeProjectId}/`,
|
|
@@ -7300,7 +7238,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7300
7238
|
}
|
|
7301
7239
|
store.dispatch(deleteForm(formId2));
|
|
7302
7240
|
try {
|
|
7303
|
-
return await this.enqueueRequest({
|
|
7241
|
+
return await this.client.enqueueRequest({
|
|
7304
7242
|
description: "Delete form",
|
|
7305
7243
|
method: HttpMethod.DELETE,
|
|
7306
7244
|
url: `/forms/${formId2}/`,
|
|
@@ -7320,7 +7258,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7320
7258
|
}
|
|
7321
7259
|
async refreshStore() {
|
|
7322
7260
|
const { store } = this.client;
|
|
7323
|
-
const result = await this.enqueueRequest({
|
|
7261
|
+
const result = await this.client.enqueueRequest({
|
|
7324
7262
|
description: "Fetch user forms",
|
|
7325
7263
|
method: HttpMethod.GET,
|
|
7326
7264
|
url: `/forms/in-project/${store.getState().projectReducer.activeProjectId}/forms/`,
|
|
@@ -7369,7 +7307,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7369
7307
|
submission: submission.offline_id,
|
|
7370
7308
|
field_identifier: key
|
|
7371
7309
|
});
|
|
7372
|
-
const attach = await this.enqueueRequest({
|
|
7310
|
+
const attach = await this.client.enqueueRequest({
|
|
7373
7311
|
description: "Attach file to form submission",
|
|
7374
7312
|
method: HttpMethod.POST,
|
|
7375
7313
|
url: `/forms/submission/${submission.offline_id}/attachments/`,
|
|
@@ -7407,7 +7345,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7407
7345
|
created_by: state.userReducer.currentUser.id,
|
|
7408
7346
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7409
7347
|
};
|
|
7410
|
-
const promise = this.enqueueRequest({
|
|
7348
|
+
const promise = this.client.enqueueRequest({
|
|
7411
7349
|
description: "Respond to form",
|
|
7412
7350
|
method: HttpMethod.POST,
|
|
7413
7351
|
url: `/forms/revisions/${payload.form_revision}/respond/`,
|
|
@@ -7488,7 +7426,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7488
7426
|
}
|
|
7489
7427
|
store.dispatch(addFormSubmissions(offlineSubmissions));
|
|
7490
7428
|
store.dispatch(addFormSubmissionAttachments(offlineAttachments));
|
|
7491
|
-
const promise = this.enqueueRequest({
|
|
7429
|
+
const promise = this.client.enqueueRequest({
|
|
7492
7430
|
description: "Bulk add form submissions",
|
|
7493
7431
|
method: HttpMethod.POST,
|
|
7494
7432
|
url: `/forms/revisions/${formRevision}/bulk-respond/`,
|
|
@@ -7509,7 +7447,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7509
7447
|
const file = filesRecord[sha1];
|
|
7510
7448
|
if (!file)
|
|
7511
7449
|
continue;
|
|
7512
|
-
void this.enqueueRequest({
|
|
7450
|
+
void this.client.enqueueRequest({
|
|
7513
7451
|
url: presigned_url.url,
|
|
7514
7452
|
description: "Upload file",
|
|
7515
7453
|
method: HttpMethod.POST,
|
|
@@ -7537,7 +7475,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7537
7475
|
};
|
|
7538
7476
|
const submissionToBeUpdated = store.getState().formSubmissionReducer.formSubmissions[submission.offline_id];
|
|
7539
7477
|
store.dispatch(updateFormSubmission(offlineSubmission));
|
|
7540
|
-
const promise = this.enqueueRequest({
|
|
7478
|
+
const promise = this.client.enqueueRequest({
|
|
7541
7479
|
description: "Patch form submission",
|
|
7542
7480
|
method: HttpMethod.PATCH,
|
|
7543
7481
|
url: `/forms/submissions/${submission.offline_id}/`,
|
|
@@ -7563,7 +7501,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7563
7501
|
store.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
7564
7502
|
store.dispatch(deleteFormSubmissionAttachments(submissionAttachments.map((x) => x.offline_id)));
|
|
7565
7503
|
try {
|
|
7566
|
-
return await this.enqueueRequest({
|
|
7504
|
+
return await this.client.enqueueRequest({
|
|
7567
7505
|
description: "Delete user form submissions",
|
|
7568
7506
|
method: HttpMethod.DELETE,
|
|
7569
7507
|
url: `/forms/submissions/${submissionId}/`,
|
|
@@ -7580,7 +7518,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7580
7518
|
async refreshStore() {
|
|
7581
7519
|
const { store } = this.client;
|
|
7582
7520
|
const projectId = store.getState().projectReducer.activeProjectId;
|
|
7583
|
-
const submissions = await this.enqueueRequest({
|
|
7521
|
+
const submissions = await this.client.enqueueRequest({
|
|
7584
7522
|
description: "Fetch form submissions",
|
|
7585
7523
|
method: HttpMethod.GET,
|
|
7586
7524
|
url: `/forms/in-project/${projectId}/submissions/`,
|
|
@@ -7588,7 +7526,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7588
7526
|
blocks: []
|
|
7589
7527
|
});
|
|
7590
7528
|
store.dispatch(setFormSubmissions(submissions));
|
|
7591
|
-
const attachments = await this.enqueueRequest({
|
|
7529
|
+
const attachments = await this.client.enqueueRequest({
|
|
7592
7530
|
description: "Fetch form attachments",
|
|
7593
7531
|
method: HttpMethod.GET,
|
|
7594
7532
|
url: `/forms/in-project/${projectId}/attachments/`,
|
|
@@ -7603,7 +7541,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7603
7541
|
const { store } = this.client;
|
|
7604
7542
|
const offlineWorkspace = offline(workspace);
|
|
7605
7543
|
store.dispatch(addWorkspace(offlineWorkspace));
|
|
7606
|
-
const promise = this.enqueueRequest({
|
|
7544
|
+
const promise = this.client.enqueueRequest({
|
|
7607
7545
|
description: "Create Workspace",
|
|
7608
7546
|
method: HttpMethod.POST,
|
|
7609
7547
|
url: `/projects/${store.getState().projectReducer.activeProjectId}/workspaces/`,
|
|
@@ -7621,7 +7559,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7621
7559
|
update(workspace) {
|
|
7622
7560
|
const { store } = this.client;
|
|
7623
7561
|
store.dispatch(addOrReplaceWorkspaces({ [workspace.offline_id]: workspace }));
|
|
7624
|
-
const promise = this.enqueueRequest({
|
|
7562
|
+
const promise = this.client.enqueueRequest({
|
|
7625
7563
|
description: "Update Workspace",
|
|
7626
7564
|
method: HttpMethod.PATCH,
|
|
7627
7565
|
url: `/workspaces/${workspace.offline_id}/`,
|
|
@@ -7633,7 +7571,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7633
7571
|
}
|
|
7634
7572
|
delete(workspaceId) {
|
|
7635
7573
|
const { store } = this.client;
|
|
7636
|
-
const promise = this.enqueueRequest({
|
|
7574
|
+
const promise = this.client.enqueueRequest({
|
|
7637
7575
|
description: "Delete Workspace",
|
|
7638
7576
|
method: HttpMethod.DELETE,
|
|
7639
7577
|
url: `/workspaces/${workspaceId}/`,
|
|
@@ -7655,7 +7593,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7655
7593
|
}
|
|
7656
7594
|
class OrganizationAccessService extends BaseApiService {
|
|
7657
7595
|
async update(organizationAccess) {
|
|
7658
|
-
const promise = this.enqueueRequest({
|
|
7596
|
+
const promise = this.client.enqueueRequest({
|
|
7659
7597
|
description: "Edit organization access",
|
|
7660
7598
|
method: HttpMethod.PATCH,
|
|
7661
7599
|
url: `/organizations/${organizationAccess.organization}/access/${organizationAccess.offline_id}/`,
|
|
@@ -7671,7 +7609,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7671
7609
|
async remove(organizationAccess) {
|
|
7672
7610
|
this.client.store.dispatch(removeOrganizationAccess(organizationAccess));
|
|
7673
7611
|
this.client.store.dispatch(removeUser(organizationAccess.user));
|
|
7674
|
-
return this.enqueueRequest({
|
|
7612
|
+
return this.client.enqueueRequest({
|
|
7675
7613
|
description: "Remove organization access",
|
|
7676
7614
|
method: HttpMethod.DELETE,
|
|
7677
7615
|
url: `/organizations/${organizationAccess.organization}/access/${organizationAccess.offline_id}/`,
|
|
@@ -7686,7 +7624,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7686
7624
|
if (!organizationId) {
|
|
7687
7625
|
return;
|
|
7688
7626
|
}
|
|
7689
|
-
const result = await this.enqueueRequest({
|
|
7627
|
+
const result = await this.client.enqueueRequest({
|
|
7690
7628
|
description: "Get organization accesses",
|
|
7691
7629
|
method: HttpMethod.GET,
|
|
7692
7630
|
url: `/organizations/${organizationId}/access/`,
|
|
@@ -7718,7 +7656,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7718
7656
|
if (!file)
|
|
7719
7657
|
throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
7720
7658
|
const key = await getFileS3Key(file, sha1);
|
|
7721
|
-
const s3UploadUrl = await this.enqueueRequest({
|
|
7659
|
+
const s3UploadUrl = await this.client.enqueueRequest({
|
|
7722
7660
|
description: "Get S3 URL",
|
|
7723
7661
|
method: HttpMethod.GET,
|
|
7724
7662
|
url: "/authentication/files/presigned-upload-url/",
|
|
@@ -7802,7 +7740,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7802
7740
|
throw new Error(fileUploadUrlResponse.warning);
|
|
7803
7741
|
}
|
|
7804
7742
|
const url = fileUploadUrlResponse.url;
|
|
7805
|
-
const promise = this.enqueueRequest({
|
|
7743
|
+
const promise = this.client.enqueueRequest({
|
|
7806
7744
|
url,
|
|
7807
7745
|
description: "Upload file",
|
|
7808
7746
|
method: HttpMethod.POST,
|
|
@@ -7844,7 +7782,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7844
7782
|
let isFirstRequest = true;
|
|
7845
7783
|
if (!promise) {
|
|
7846
7784
|
promise = new Promise((resolve) => {
|
|
7847
|
-
void this.enqueueRequest({
|
|
7785
|
+
void this.client.enqueueRequest({
|
|
7848
7786
|
description: "Download file",
|
|
7849
7787
|
method: HttpMethod.GET,
|
|
7850
7788
|
url,
|
|
@@ -7912,7 +7850,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7912
7850
|
blockers: [],
|
|
7913
7851
|
blocks: []
|
|
7914
7852
|
};
|
|
7915
|
-
return this.enqueueRequest(requestDetails);
|
|
7853
|
+
return this.client.enqueueRequest(requestDetails);
|
|
7916
7854
|
}
|
|
7917
7855
|
validateVerificationCode(verificationCode, payload = void 0) {
|
|
7918
7856
|
const requestDetails = {
|
|
@@ -7924,12 +7862,12 @@ var __publicField = (obj, key, value) => {
|
|
|
7924
7862
|
blockers: [],
|
|
7925
7863
|
blocks: []
|
|
7926
7864
|
};
|
|
7927
|
-
return this.enqueueRequest(requestDetails);
|
|
7865
|
+
return this.client.enqueueRequest(requestDetails);
|
|
7928
7866
|
}
|
|
7929
7867
|
}
|
|
7930
7868
|
class EmailDomainsService extends BaseApiService {
|
|
7931
7869
|
async fetchAll(orgId) {
|
|
7932
|
-
return this.enqueueRequest({
|
|
7870
|
+
return this.client.enqueueRequest({
|
|
7933
7871
|
description: "Fetch email domains for organization",
|
|
7934
7872
|
method: HttpMethod.GET,
|
|
7935
7873
|
url: `/organizations/${orgId}/email-domains/`,
|
|
@@ -7938,7 +7876,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7938
7876
|
});
|
|
7939
7877
|
}
|
|
7940
7878
|
async add(orgId, email) {
|
|
7941
|
-
return this.enqueueRequest({
|
|
7879
|
+
return this.client.enqueueRequest({
|
|
7942
7880
|
description: "Add email domain to organization",
|
|
7943
7881
|
method: HttpMethod.POST,
|
|
7944
7882
|
url: `/organizations/${orgId}/email-domains/`,
|
|
@@ -7949,7 +7887,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7949
7887
|
}
|
|
7950
7888
|
async remove(emailDomain) {
|
|
7951
7889
|
this.client.store.dispatch(removeEmailDomain(emailDomain));
|
|
7952
|
-
return this.enqueueRequest({
|
|
7890
|
+
return this.client.enqueueRequest({
|
|
7953
7891
|
description: "Remove email domain from organization",
|
|
7954
7892
|
method: HttpMethod.DELETE,
|
|
7955
7893
|
url: `/organizations/${emailDomain.organization}/email-domains/${emailDomain.offline_id}/`,
|
|
@@ -7975,7 +7913,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7975
7913
|
if (showLoading) {
|
|
7976
7914
|
this.client.store.dispatch(setIsFetchingInitialData(true));
|
|
7977
7915
|
}
|
|
7978
|
-
return this.enqueueRequest({
|
|
7916
|
+
return this.client.enqueueRequest({
|
|
7979
7917
|
description: "Get initial organization data",
|
|
7980
7918
|
method: HttpMethod.GET,
|
|
7981
7919
|
url: `/organizations/${organizationId}/initial-data/`,
|
|
@@ -8003,7 +7941,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8003
7941
|
}
|
|
8004
7942
|
}
|
|
8005
7943
|
async create(name) {
|
|
8006
|
-
const result = await this.enqueueRequest({
|
|
7944
|
+
const result = await this.client.enqueueRequest({
|
|
8007
7945
|
description: "Create organization",
|
|
8008
7946
|
method: HttpMethod.POST,
|
|
8009
7947
|
url: "/organizations/",
|
|
@@ -8015,7 +7953,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8015
7953
|
return result;
|
|
8016
7954
|
}
|
|
8017
7955
|
async update(organization) {
|
|
8018
|
-
const promise = this.enqueueRequest({
|
|
7956
|
+
const promise = this.client.enqueueRequest({
|
|
8019
7957
|
description: "Edit organization",
|
|
8020
7958
|
method: HttpMethod.PATCH,
|
|
8021
7959
|
url: `/organizations/${organization.id}/`,
|
|
@@ -8029,7 +7967,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8029
7967
|
});
|
|
8030
7968
|
}
|
|
8031
7969
|
async invite(organizationId, email) {
|
|
8032
|
-
return this.enqueueRequest({
|
|
7970
|
+
return this.client.enqueueRequest({
|
|
8033
7971
|
description: "Invite user to organization",
|
|
8034
7972
|
method: HttpMethod.POST,
|
|
8035
7973
|
url: `/organizations/${organizationId}/invite/${email}/`,
|
|
@@ -8043,7 +7981,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8043
7981
|
if (showLoading) {
|
|
8044
7982
|
this.client.store.dispatch(setIsFetchingInitialData(true));
|
|
8045
7983
|
}
|
|
8046
|
-
const result = await this.enqueueRequest({
|
|
7984
|
+
const result = await this.client.enqueueRequest({
|
|
8047
7985
|
description: "Get licenses",
|
|
8048
7986
|
method: HttpMethod.GET,
|
|
8049
7987
|
url: `/organizations/${organizationId}/licenses/`,
|
|
@@ -8058,7 +7996,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8058
7996
|
return result;
|
|
8059
7997
|
}
|
|
8060
7998
|
async getLicense(license) {
|
|
8061
|
-
const result = await this.enqueueRequest({
|
|
7999
|
+
const result = await this.client.enqueueRequest({
|
|
8062
8000
|
description: "Get license",
|
|
8063
8001
|
method: HttpMethod.GET,
|
|
8064
8002
|
url: `/billing/${license.offline_id}/`,
|
|
@@ -8072,7 +8010,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8072
8010
|
return result;
|
|
8073
8011
|
}
|
|
8074
8012
|
async pauseLicense(license) {
|
|
8075
|
-
const result = await this.enqueueRequest({
|
|
8013
|
+
const result = await this.client.enqueueRequest({
|
|
8076
8014
|
description: "Pause license",
|
|
8077
8015
|
method: HttpMethod.DELETE,
|
|
8078
8016
|
url: `/billing/${license.offline_id}/suspend/`,
|
|
@@ -8086,7 +8024,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8086
8024
|
return result;
|
|
8087
8025
|
}
|
|
8088
8026
|
async resumeLicense(license) {
|
|
8089
|
-
const result = await this.enqueueRequest({
|
|
8027
|
+
const result = await this.client.enqueueRequest({
|
|
8090
8028
|
description: "Resume license",
|
|
8091
8029
|
method: HttpMethod.PATCH,
|
|
8092
8030
|
url: `/billing/${license.offline_id}/suspend/`,
|
|
@@ -8100,7 +8038,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8100
8038
|
return result;
|
|
8101
8039
|
}
|
|
8102
8040
|
async cancelLicense(license) {
|
|
8103
|
-
const result = await this.enqueueRequest({
|
|
8041
|
+
const result = await this.client.enqueueRequest({
|
|
8104
8042
|
description: "Cancel license",
|
|
8105
8043
|
method: HttpMethod.DELETE,
|
|
8106
8044
|
url: `/billing/${license.offline_id}/`,
|
|
@@ -8114,7 +8052,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8114
8052
|
return result;
|
|
8115
8053
|
}
|
|
8116
8054
|
async attachLicenseToProject(license, project) {
|
|
8117
|
-
const result = await this.enqueueRequest({
|
|
8055
|
+
const result = await this.client.enqueueRequest({
|
|
8118
8056
|
description: "Attach license",
|
|
8119
8057
|
method: HttpMethod.PATCH,
|
|
8120
8058
|
url: `/billing/${license.offline_id}/project/`,
|
|
@@ -8130,7 +8068,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8130
8068
|
return result;
|
|
8131
8069
|
}
|
|
8132
8070
|
async detachLicenseFromProject(license) {
|
|
8133
|
-
const result = await this.enqueueRequest({
|
|
8071
|
+
const result = await this.client.enqueueRequest({
|
|
8134
8072
|
description: "Detach license",
|
|
8135
8073
|
method: HttpMethod.DELETE,
|
|
8136
8074
|
url: `/billing/${license.offline_id}/project/`,
|
|
@@ -8144,7 +8082,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8144
8082
|
return result;
|
|
8145
8083
|
}
|
|
8146
8084
|
async getLatestTransaction(license) {
|
|
8147
|
-
return await this.enqueueRequest({
|
|
8085
|
+
return await this.client.enqueueRequest({
|
|
8148
8086
|
description: "Get latest transaction",
|
|
8149
8087
|
method: HttpMethod.GET,
|
|
8150
8088
|
url: `/billing/${license.offline_id}/transaction/`,
|
|
@@ -8172,7 +8110,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8172
8110
|
children_documents: []
|
|
8173
8111
|
};
|
|
8174
8112
|
store.dispatch(addDocuments([submittedDocument]));
|
|
8175
|
-
const promise = this.enqueueRequest({
|
|
8113
|
+
const promise = this.client.enqueueRequest({
|
|
8176
8114
|
description: "Create Document",
|
|
8177
8115
|
method: HttpMethod.POST,
|
|
8178
8116
|
url: `/projects/${activeProjectId}/documents/`,
|
|
@@ -8198,7 +8136,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8198
8136
|
);
|
|
8199
8137
|
}
|
|
8200
8138
|
store.dispatch(updateDocuments([document2]));
|
|
8201
|
-
const promise = this.enqueueRequest({
|
|
8139
|
+
const promise = this.client.enqueueRequest({
|
|
8202
8140
|
description: "Update Document",
|
|
8203
8141
|
method: HttpMethod.PATCH,
|
|
8204
8142
|
url: `/documents/${document2.offline_id}/`,
|
|
@@ -8239,7 +8177,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8239
8177
|
}
|
|
8240
8178
|
}
|
|
8241
8179
|
store.dispatch(moveDocument({ documentId, targetDocumentId, position }));
|
|
8242
|
-
const promise = this.enqueueRequest({
|
|
8180
|
+
const promise = this.client.enqueueRequest({
|
|
8243
8181
|
description: "Move Document",
|
|
8244
8182
|
method: HttpMethod.PATCH,
|
|
8245
8183
|
url: `/documents/${documentId}/move/`,
|
|
@@ -8268,7 +8206,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8268
8206
|
}
|
|
8269
8207
|
const parentDocument = documentToBeDeleted.parent_document ? documentsMapping[documentToBeDeleted.parent_document] : void 0;
|
|
8270
8208
|
store.dispatch(removeDocuments([documentId]));
|
|
8271
|
-
const promise = this.enqueueRequest({
|
|
8209
|
+
const promise = this.client.enqueueRequest({
|
|
8272
8210
|
description: "Delete Document",
|
|
8273
8211
|
method: HttpMethod.DELETE,
|
|
8274
8212
|
url: `/documents/${documentId}/`,
|
|
@@ -8289,7 +8227,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8289
8227
|
const { store } = this.client;
|
|
8290
8228
|
const state = store.getState();
|
|
8291
8229
|
const activeProjectId = state.projectReducer.activeProjectId;
|
|
8292
|
-
const projectDocumentsPromise = this.enqueueRequest({
|
|
8230
|
+
const projectDocumentsPromise = this.client.enqueueRequest({
|
|
8293
8231
|
description: "Get project documents",
|
|
8294
8232
|
method: HttpMethod.GET,
|
|
8295
8233
|
url: `/projects/${activeProjectId}/documents/`,
|
|
@@ -8297,7 +8235,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8297
8235
|
blocks: []
|
|
8298
8236
|
});
|
|
8299
8237
|
const activeOrganizationId = state.organizationReducer.activeOrganizationId;
|
|
8300
|
-
const organizationDocumentsPromise = this.enqueueRequest({
|
|
8238
|
+
const organizationDocumentsPromise = this.client.enqueueRequest({
|
|
8301
8239
|
description: "Get organization documents",
|
|
8302
8240
|
method: HttpMethod.GET,
|
|
8303
8241
|
url: `/organizations/${activeOrganizationId}/documents/`,
|
|
@@ -8351,28 +8289,68 @@ var __publicField = (obj, key, value) => {
|
|
|
8351
8289
|
}
|
|
8352
8290
|
}
|
|
8353
8291
|
class AgentService extends BaseApiService {
|
|
8292
|
+
async startConversation(prompt) {
|
|
8293
|
+
const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
|
|
8294
|
+
return this.client.enqueueRequest({
|
|
8295
|
+
description: "Start agent conversation",
|
|
8296
|
+
method: HttpMethod.POST,
|
|
8297
|
+
url: "/agents/prompt/",
|
|
8298
|
+
payload: {
|
|
8299
|
+
prompt,
|
|
8300
|
+
active_project: activeProjectId
|
|
8301
|
+
},
|
|
8302
|
+
blockers: ["prompt"],
|
|
8303
|
+
blocks: ["prompt"]
|
|
8304
|
+
}).then((response) => {
|
|
8305
|
+
this.client.store.dispatch(addConversation(response));
|
|
8306
|
+
return response;
|
|
8307
|
+
});
|
|
8308
|
+
}
|
|
8354
8309
|
/**
|
|
8355
8310
|
* Prompt the agent with a message.
|
|
8356
|
-
* @param
|
|
8311
|
+
* @param prompt The message to prompt the agent with.
|
|
8357
8312
|
* @param conversationId If continuing an existing message, the UUID of that conversation.
|
|
8358
8313
|
*/
|
|
8359
|
-
async prompt
|
|
8360
|
-
const
|
|
8361
|
-
|
|
8314
|
+
async continueConversation(prompt, conversationId) {
|
|
8315
|
+
const { store } = this.client;
|
|
8316
|
+
const activeProjectId = store.getState().projectReducer.activeProjectId;
|
|
8317
|
+
return this.client.enqueueRequest({
|
|
8362
8318
|
description: "Prompt agent",
|
|
8363
8319
|
method: HttpMethod.POST,
|
|
8364
8320
|
url: "/agents/prompt/",
|
|
8365
8321
|
payload: {
|
|
8366
|
-
prompt
|
|
8322
|
+
prompt,
|
|
8367
8323
|
active_project: activeProjectId
|
|
8368
8324
|
},
|
|
8369
8325
|
blockers: ["prompt"],
|
|
8370
8326
|
blocks: ["prompt"],
|
|
8371
|
-
queryParams:
|
|
8327
|
+
queryParams: { conversation_id: conversationId }
|
|
8328
|
+
}).then((response) => {
|
|
8329
|
+
const conversation = store.getState().agentsReducer.conversations[conversationId];
|
|
8330
|
+
if (!conversation) {
|
|
8331
|
+
throw new Error("Conversation not found");
|
|
8332
|
+
}
|
|
8333
|
+
store.dispatch(
|
|
8334
|
+
updateConversation({
|
|
8335
|
+
offline_id: conversationId,
|
|
8336
|
+
tiptap_content: [...conversation.tiptap_content || [], response.response]
|
|
8337
|
+
})
|
|
8338
|
+
);
|
|
8339
|
+
});
|
|
8340
|
+
}
|
|
8341
|
+
async fetchDetails(conversationId) {
|
|
8342
|
+
return this.client.enqueueRequest({
|
|
8343
|
+
description: "Get agent conversation",
|
|
8344
|
+
method: HttpMethod.GET,
|
|
8345
|
+
url: `/agents/conversations/${conversationId}/`,
|
|
8346
|
+
blockers: ["conversation"],
|
|
8347
|
+
blocks: ["conversation"]
|
|
8348
|
+
}).then((response) => {
|
|
8349
|
+
this.client.store.dispatch(setConversation(response));
|
|
8372
8350
|
});
|
|
8373
8351
|
}
|
|
8374
8352
|
async rate(responseId, rating) {
|
|
8375
|
-
return this.enqueueRequest({
|
|
8353
|
+
return this.client.enqueueRequest({
|
|
8376
8354
|
description: "Rate agent response",
|
|
8377
8355
|
method: HttpMethod.PUT,
|
|
8378
8356
|
url: `/agents/responses/${responseId}/rate/`,
|
|
@@ -8381,6 +8359,18 @@ var __publicField = (obj, key, value) => {
|
|
|
8381
8359
|
blocks: ["rate"]
|
|
8382
8360
|
});
|
|
8383
8361
|
}
|
|
8362
|
+
async refreshStore() {
|
|
8363
|
+
const { store } = this.client;
|
|
8364
|
+
const activeProject = store.getState().projectReducer.activeProjectId;
|
|
8365
|
+
const result = await this.client.enqueueRequest({
|
|
8366
|
+
description: "Get agent conversation history",
|
|
8367
|
+
method: HttpMethod.GET,
|
|
8368
|
+
url: `/projects/${activeProject}/agent-conversations/`,
|
|
8369
|
+
blockers: ["agent-conversations"],
|
|
8370
|
+
blocks: ["agent-conversations"]
|
|
8371
|
+
});
|
|
8372
|
+
store.dispatch(setConversations(result));
|
|
8373
|
+
}
|
|
8384
8374
|
}
|
|
8385
8375
|
class TeamService extends BaseApiService {
|
|
8386
8376
|
add(teamPayload) {
|
|
@@ -8398,7 +8388,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8398
8388
|
// created_by: state.userReducer.currentUser.id,
|
|
8399
8389
|
});
|
|
8400
8390
|
store.dispatch(addTeam(offlineTeam));
|
|
8401
|
-
const promise = this.enqueueRequest({
|
|
8391
|
+
const promise = this.client.enqueueRequest({
|
|
8402
8392
|
description: "Create team",
|
|
8403
8393
|
method: HttpMethod.POST,
|
|
8404
8394
|
url: `/organizations/${activeOrganizationId}/teams/`,
|
|
@@ -8423,7 +8413,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8423
8413
|
...team
|
|
8424
8414
|
};
|
|
8425
8415
|
store.dispatch(updateTeam(offlineUpdatedTeam));
|
|
8426
|
-
const promise = this.enqueueRequest({
|
|
8416
|
+
const promise = this.client.enqueueRequest({
|
|
8427
8417
|
description: "Update team",
|
|
8428
8418
|
method: HttpMethod.PATCH,
|
|
8429
8419
|
url: `/organizations/teams/${team.offline_id}/`,
|
|
@@ -8447,7 +8437,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8447
8437
|
}
|
|
8448
8438
|
store.dispatch(deleteTeam(teamId));
|
|
8449
8439
|
try {
|
|
8450
|
-
return await this.enqueueRequest({
|
|
8440
|
+
return await this.client.enqueueRequest({
|
|
8451
8441
|
description: "Delete team",
|
|
8452
8442
|
method: HttpMethod.DELETE,
|
|
8453
8443
|
url: `/organizations/teams/${teamId}/`,
|
|
@@ -8469,7 +8459,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8469
8459
|
throw new Error("Duplicate members found in the list");
|
|
8470
8460
|
}
|
|
8471
8461
|
store.dispatch(updateTeam({ ...team, members }));
|
|
8472
|
-
const promise = this.enqueueRequest({
|
|
8462
|
+
const promise = this.client.enqueueRequest({
|
|
8473
8463
|
description: "Set team members",
|
|
8474
8464
|
method: HttpMethod.PUT,
|
|
8475
8465
|
url: `/organizations/teams/${teamId}/set-members/`,
|
|
@@ -8508,7 +8498,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8508
8498
|
if (!activeOrganizationId) {
|
|
8509
8499
|
throw new Error(`Expected active organization to be set, got ${activeOrganizationId}`);
|
|
8510
8500
|
}
|
|
8511
|
-
const result = await this.enqueueRequest({
|
|
8501
|
+
const result = await this.client.enqueueRequest({
|
|
8512
8502
|
description: "Fetch teams",
|
|
8513
8503
|
method: HttpMethod.GET,
|
|
8514
8504
|
url: `/organizations/${activeOrganizationId}/teams/`,
|
|
@@ -8518,6 +8508,46 @@ var __publicField = (obj, key, value) => {
|
|
|
8518
8508
|
store.dispatch(setTeams(result));
|
|
8519
8509
|
}
|
|
8520
8510
|
}
|
|
8511
|
+
class DeferredPromise {
|
|
8512
|
+
constructor() {
|
|
8513
|
+
__publicField(this, _a, "Promise");
|
|
8514
|
+
__publicField(this, "_promise");
|
|
8515
|
+
__publicField(this, "_resolve");
|
|
8516
|
+
__publicField(this, "_reject");
|
|
8517
|
+
__publicField(this, "_state", "pending");
|
|
8518
|
+
this._resolve = null;
|
|
8519
|
+
this._reject = null;
|
|
8520
|
+
this._promise = new Promise((resolve, reject) => {
|
|
8521
|
+
this._resolve = resolve;
|
|
8522
|
+
this._reject = reject;
|
|
8523
|
+
});
|
|
8524
|
+
}
|
|
8525
|
+
get state() {
|
|
8526
|
+
return this._state;
|
|
8527
|
+
}
|
|
8528
|
+
then(onFulfilled, onRejected) {
|
|
8529
|
+
return this._promise.then(onFulfilled, onRejected);
|
|
8530
|
+
}
|
|
8531
|
+
catch(onRejected) {
|
|
8532
|
+
return this._promise.catch(onRejected);
|
|
8533
|
+
}
|
|
8534
|
+
resolve(value) {
|
|
8535
|
+
if (!this._resolve)
|
|
8536
|
+
throw new Error("No resolve callback");
|
|
8537
|
+
this._resolve(value);
|
|
8538
|
+
this._state = "fulfilled";
|
|
8539
|
+
}
|
|
8540
|
+
reject(reason) {
|
|
8541
|
+
if (!this._reject)
|
|
8542
|
+
throw reason;
|
|
8543
|
+
this._reject(reason);
|
|
8544
|
+
this._state = "rejected";
|
|
8545
|
+
}
|
|
8546
|
+
finally(_onFinally) {
|
|
8547
|
+
throw new Error("`finally` not implemented");
|
|
8548
|
+
}
|
|
8549
|
+
}
|
|
8550
|
+
_a = Symbol.toStringTag;
|
|
8521
8551
|
class OvermapSDK {
|
|
8522
8552
|
constructor(apiUrl, store) {
|
|
8523
8553
|
__publicField(this, "API_URL");
|
|
@@ -8556,6 +8586,87 @@ var __publicField = (obj, key, value) => {
|
|
|
8556
8586
|
this.API_URL = apiUrl;
|
|
8557
8587
|
this.store = store;
|
|
8558
8588
|
}
|
|
8589
|
+
/**
|
|
8590
|
+
* Enqueues an API request to the offline outbox.
|
|
8591
|
+
* @param requestDetails An SDKRequest object containing the details of the request.
|
|
8592
|
+
* @protected
|
|
8593
|
+
*/
|
|
8594
|
+
async enqueueRequest(requestDetails) {
|
|
8595
|
+
return this._enqueueRequest(requestDetails).then((result) => {
|
|
8596
|
+
if (result instanceof APIError) {
|
|
8597
|
+
throw result;
|
|
8598
|
+
}
|
|
8599
|
+
return result;
|
|
8600
|
+
});
|
|
8601
|
+
}
|
|
8602
|
+
/**
|
|
8603
|
+
* Enqueues an API request to the Redux Offline outbox
|
|
8604
|
+
* @protected
|
|
8605
|
+
*/
|
|
8606
|
+
_enqueueRequest(requestDetails) {
|
|
8607
|
+
const promise = new DeferredPromise();
|
|
8608
|
+
const requestDetailsWithBaseUrl = { ...requestDetails, BASE_URL: this.API_URL };
|
|
8609
|
+
if (requestDetails.immediate) {
|
|
8610
|
+
const requestWithUuid = {
|
|
8611
|
+
...requestDetailsWithBaseUrl,
|
|
8612
|
+
uuid: requestDetails.uuid ?? uuid.v4()
|
|
8613
|
+
};
|
|
8614
|
+
const fullOfflineAction = {
|
|
8615
|
+
payload: requestWithUuid,
|
|
8616
|
+
type: "",
|
|
8617
|
+
meta: {
|
|
8618
|
+
offline: {
|
|
8619
|
+
effect: {
|
|
8620
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
8621
|
+
request: requestWithUuid,
|
|
8622
|
+
BASE_URL: this.API_URL
|
|
8623
|
+
}
|
|
8624
|
+
}
|
|
8625
|
+
}
|
|
8626
|
+
};
|
|
8627
|
+
performRequest(fullOfflineAction, this).then((result) => {
|
|
8628
|
+
promise.resolve(result.body);
|
|
8629
|
+
}).catch((error2) => {
|
|
8630
|
+
discard(error2, fullOfflineAction);
|
|
8631
|
+
promise.reject(error2);
|
|
8632
|
+
});
|
|
8633
|
+
} else {
|
|
8634
|
+
const innerPromise = this.store.dispatch(
|
|
8635
|
+
enqueueRequest(requestDetailsWithBaseUrl)
|
|
8636
|
+
);
|
|
8637
|
+
const successOrUndefinedHandler = (response) => {
|
|
8638
|
+
if (response) {
|
|
8639
|
+
promise.resolve(response.body);
|
|
8640
|
+
} else {
|
|
8641
|
+
const error2 = new APIError({
|
|
8642
|
+
message: "Could not get a response from the server.",
|
|
8643
|
+
response,
|
|
8644
|
+
discard: true
|
|
8645
|
+
});
|
|
8646
|
+
promise.reject(error2);
|
|
8647
|
+
}
|
|
8648
|
+
};
|
|
8649
|
+
const errorHandler = (error2) => {
|
|
8650
|
+
if (error2 instanceof APIError) {
|
|
8651
|
+
error2.options.discard = true;
|
|
8652
|
+
} else {
|
|
8653
|
+
console.error(
|
|
8654
|
+
"Received an unexpected error while processing a request:",
|
|
8655
|
+
error2,
|
|
8656
|
+
"\nConverting error to APIError and discarding."
|
|
8657
|
+
);
|
|
8658
|
+
error2 = new APIError({
|
|
8659
|
+
message: "An error occurred while processing the request.",
|
|
8660
|
+
innerError: error2,
|
|
8661
|
+
discard: true
|
|
8662
|
+
});
|
|
8663
|
+
}
|
|
8664
|
+
promise.reject(error2);
|
|
8665
|
+
};
|
|
8666
|
+
innerPromise.then(successOrUndefinedHandler, errorHandler);
|
|
8667
|
+
}
|
|
8668
|
+
return promise;
|
|
8669
|
+
}
|
|
8559
8670
|
}
|
|
8560
8671
|
const makeClient = (apiUrl, store) => new OvermapSDK(apiUrl, store);
|
|
8561
8672
|
const SDKContext = React.createContext({});
|
|
@@ -16695,6 +16806,7 @@ var __publicField = (obj, key, value) => {
|
|
|
16695
16806
|
exports2.addComponentTypeAttachment = addComponentTypeAttachment;
|
|
16696
16807
|
exports2.addComponentTypeAttachments = addComponentTypeAttachments;
|
|
16697
16808
|
exports2.addComponentsInBatches = addComponentsInBatches;
|
|
16809
|
+
exports2.addConversation = addConversation;
|
|
16698
16810
|
exports2.addDocumentAttachment = addDocumentAttachment;
|
|
16699
16811
|
exports2.addDocumentAttachments = addDocumentAttachments;
|
|
16700
16812
|
exports2.addDocuments = addDocuments;
|
|
@@ -16735,6 +16847,8 @@ var __publicField = (obj, key, value) => {
|
|
|
16735
16847
|
exports2.addToRecentIssues = addToRecentIssues;
|
|
16736
16848
|
exports2.addUsers = addUsers;
|
|
16737
16849
|
exports2.addWorkspace = addWorkspace;
|
|
16850
|
+
exports2.agentsReducer = agentsReducer;
|
|
16851
|
+
exports2.agentsSlice = agentsSlice;
|
|
16738
16852
|
exports2.areArraysEqual = areArraysEqual;
|
|
16739
16853
|
exports2.authReducer = authReducer;
|
|
16740
16854
|
exports2.authSlice = authSlice;
|
|
@@ -16820,6 +16934,7 @@ var __publicField = (obj, key, value) => {
|
|
|
16820
16934
|
exports2.getLocalDateString = getLocalDateString;
|
|
16821
16935
|
exports2.getLocalRelativeDateString = getLocalRelativeDateString;
|
|
16822
16936
|
exports2.getMarkerCoordinates = getMarkerCoordinates;
|
|
16937
|
+
exports2.getOutboxCoordinator = getOutboxCoordinator;
|
|
16823
16938
|
exports2.getRenamedFile = getRenamedFile;
|
|
16824
16939
|
exports2.getStageColor = getStageColor;
|
|
16825
16940
|
exports2.hashFile = hashFile;
|
|
@@ -16976,6 +17091,9 @@ var __publicField = (obj, key, value) => {
|
|
|
16976
17091
|
exports2.selectComponentsByType = selectComponentsByType;
|
|
16977
17092
|
exports2.selectComponentsFromComponentType = selectComponentsFromComponentType;
|
|
16978
17093
|
exports2.selectComponentsMapping = selectComponentsMapping;
|
|
17094
|
+
exports2.selectConversation = selectConversation;
|
|
17095
|
+
exports2.selectConversationMapping = selectConversationMapping;
|
|
17096
|
+
exports2.selectConversations = selectConversations;
|
|
16979
17097
|
exports2.selectCreateProjectType = selectCreateProjectType;
|
|
16980
17098
|
exports2.selectCurrentUser = selectCurrentUser;
|
|
16981
17099
|
exports2.selectDeletedRequests = selectDeletedRequests;
|
|
@@ -17119,6 +17237,8 @@ var __publicField = (obj, key, value) => {
|
|
|
17119
17237
|
exports2.setComponentTypeAttachments = setComponentTypeAttachments;
|
|
17120
17238
|
exports2.setComponentTypes = setComponentTypes;
|
|
17121
17239
|
exports2.setComponents = setComponents;
|
|
17240
|
+
exports2.setConversation = setConversation;
|
|
17241
|
+
exports2.setConversations = setConversations;
|
|
17122
17242
|
exports2.setCreateProjectType = setCreateProjectType;
|
|
17123
17243
|
exports2.setCurrentUser = setCurrentUser;
|
|
17124
17244
|
exports2.setDocumentAttachment = setDocumentAttachment;
|
|
@@ -17191,6 +17311,7 @@ var __publicField = (obj, key, value) => {
|
|
|
17191
17311
|
exports2.updateComponentAttachments = updateComponentAttachments;
|
|
17192
17312
|
exports2.updateComponentTypeAttachment = updateComponentTypeAttachment;
|
|
17193
17313
|
exports2.updateComponentTypeAttachments = updateComponentTypeAttachments;
|
|
17314
|
+
exports2.updateConversation = updateConversation;
|
|
17194
17315
|
exports2.updateDocumentAttachment = updateDocumentAttachment;
|
|
17195
17316
|
exports2.updateDocumentAttachments = updateDocumentAttachments;
|
|
17196
17317
|
exports2.updateDocuments = updateDocuments;
|