@overmap-ai/core 1.0.53-component-asset-renames.2 → 1.0.53-fix-outbox.0
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/constants/ui.d.ts +1 -1
- package/dist/enums/ui.d.ts +1 -1
- package/dist/overmap-core.js +967 -913
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +968 -914
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/sdk.d.ts +20 -8
- package/dist/sdk/services/BaseApiService.d.ts +0 -12
- package/dist/sdk/services/ComponentAttachmentService.d.ts +10 -0
- package/dist/sdk/services/ComponentService.d.ts +11 -0
- package/dist/sdk/services/ComponentStageCompletionService.d.ts +17 -0
- package/dist/sdk/services/ComponentStageService.d.ts +11 -0
- package/dist/sdk/services/ComponentTypeAttachmentService.d.ts +10 -0
- package/dist/sdk/services/ComponentTypeService.d.ts +9 -0
- package/dist/sdk/services/UserFormService.d.ts +2 -2
- package/dist/sdk/services/UserFormSubmissionService.d.ts +1 -1
- package/dist/sdk/services/index.d.ts +6 -6
- package/dist/store/slices/ComponentStageCompletionSlice.d.ts +27 -0
- package/dist/store/slices/categorySlice.d.ts +4 -4
- package/dist/store/slices/componentSlice.d.ts +73 -0
- package/dist/store/slices/componentStageSlice.d.ts +42 -0
- package/dist/store/slices/componentTypeSlice.d.ts +75 -0
- package/dist/store/slices/documentSlice.d.ts +7 -6
- package/dist/store/slices/formRevisionSlice.d.ts +5 -5
- package/dist/store/slices/formSlice.d.ts +7 -7
- package/dist/store/slices/formSubmissionSlice.d.ts +2 -2
- package/dist/store/slices/index.d.ts +4 -4
- package/dist/store/slices/issueSlice.d.ts +4 -4
- package/dist/store/slices/projectFileSlice.d.ts +4 -4
- package/dist/store/slices/workspaceSlice.d.ts +4 -4
- package/dist/store/store.d.ts +13 -13
- package/dist/typings/models/attachments.d.ts +6 -6
- package/dist/typings/models/components.d.ts +7 -11
- package/dist/typings/models/forms.d.ts +3 -3
- package/dist/utils/colors.d.ts +1 -1
- package/package.json +153 -153
- package/dist/sdk/services/AssetAttachmentService.d.ts +0 -10
- package/dist/sdk/services/AssetService.d.ts +0 -11
- package/dist/sdk/services/AssetStageCompletionService.d.ts +0 -16
- package/dist/sdk/services/AssetStageService.d.ts +0 -11
- package/dist/sdk/services/AssetTypeAttachmentService.d.ts +0 -10
- package/dist/sdk/services/AssetTypeService.d.ts +0 -9
- package/dist/store/slices/assetSlice.d.ts +0 -63
- package/dist/store/slices/assetStageCompletionSlice.d.ts +0 -15
- package/dist/store/slices/assetStageSlice.d.ts +0 -32
- package/dist/store/slices/assetTypeSlice.d.ts +0 -74
package/dist/overmap-core.js
CHANGED
|
@@ -10,6 +10,7 @@ import React__default, { useState, useEffect, useRef, memo, useMemo, useCallback
|
|
|
10
10
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
11
11
|
import { unsafeShowToast, AlertDialogProvider, ToastProvider, DefaultTheme, Flex as Flex$1, IconButton, RiIcon, Text as Text$1, useSeverityColor, TextArea, Select, useToast, Badge, MultiSelect, Overlay, Button, Spinner, useViewportSize, ButtonGroup, IconColorUtility, Tooltip, Popover, useSize, ToggleButton, Separator, OvermapItem, ButtonList, divButtonProps, OvermapDropdownMenu, Checkbox as Checkbox$1, Input, useAlertDialog } from "@overmap-ai/blocks";
|
|
12
12
|
import { DepGraph } from "dependency-graph";
|
|
13
|
+
import saveAs$1, { saveAs } from "file-saver";
|
|
13
14
|
import { offline as offline$1 } from "@redux-offline/redux-offline";
|
|
14
15
|
import offlineConfig from "@redux-offline/redux-offline/lib/defaults";
|
|
15
16
|
import localforage from "localforage";
|
|
@@ -17,7 +18,6 @@ import createMigration from "redux-persist-migrate";
|
|
|
17
18
|
import { createSlice, createSelector, combineReducers, configureStore, createNextState } from "@reduxjs/toolkit";
|
|
18
19
|
import request from "superagent";
|
|
19
20
|
import { shallowEqual as shallowEqual$1, useDispatch, useSelector } from "react-redux";
|
|
20
|
-
import saveAs$1, { saveAs } from "file-saver";
|
|
21
21
|
import { v4 } from "uuid";
|
|
22
22
|
import ColorCls from "color";
|
|
23
23
|
import jwtDecode from "jwt-decode";
|
|
@@ -278,46 +278,112 @@ class APIError extends Error {
|
|
|
278
278
|
this.options = options;
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
|
-
class
|
|
282
|
-
constructor() {
|
|
283
|
-
__publicField(this,
|
|
284
|
-
|
|
285
|
-
__publicField(this, "_resolve");
|
|
286
|
-
__publicField(this, "_reject");
|
|
287
|
-
__publicField(this, "_state", "pending");
|
|
288
|
-
this._resolve = null;
|
|
289
|
-
this._reject = null;
|
|
290
|
-
this._promise = new Promise((resolve, reject) => {
|
|
291
|
-
this._resolve = resolve;
|
|
292
|
-
this._reject = reject;
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
get state() {
|
|
296
|
-
return this._state;
|
|
281
|
+
class BaseApiService {
|
|
282
|
+
constructor(sdk) {
|
|
283
|
+
__publicField(this, "client");
|
|
284
|
+
this.client = sdk;
|
|
297
285
|
}
|
|
298
|
-
|
|
299
|
-
|
|
286
|
+
}
|
|
287
|
+
function hex(buffer) {
|
|
288
|
+
const hashArray = new Uint8Array(buffer);
|
|
289
|
+
return hashArray.reduce((data, byte) => data + byte.toString(16).padStart(2, "0"), "");
|
|
290
|
+
}
|
|
291
|
+
const getFileS3Key = async (file, hash) => {
|
|
292
|
+
if (!hash) {
|
|
293
|
+
hash = await hashFile(file);
|
|
300
294
|
}
|
|
301
|
-
|
|
302
|
-
|
|
295
|
+
let fileType = file.type;
|
|
296
|
+
if (fileType.includes("/")) {
|
|
297
|
+
fileType = fileType.split("/")[1];
|
|
303
298
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
throw new Error("No resolve callback");
|
|
307
|
-
this._resolve(value);
|
|
308
|
-
this._state = "fulfilled";
|
|
299
|
+
if (!fileType) {
|
|
300
|
+
throw new Error(`Could not extract file type from ${file.type}`);
|
|
309
301
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
302
|
+
return `${hash}.${fileType}`;
|
|
303
|
+
};
|
|
304
|
+
function hashFile(file) {
|
|
305
|
+
return new Promise((resolve, reject) => {
|
|
306
|
+
const reader = new FileReader();
|
|
307
|
+
reader.onload = () => {
|
|
308
|
+
const fileResult = reader.result;
|
|
309
|
+
if (!fileResult) {
|
|
310
|
+
reject();
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
void crypto.subtle.digest("SHA-1", fileResult).then((hash) => {
|
|
314
|
+
const sha1result = hex(hash);
|
|
315
|
+
resolve(sha1result);
|
|
316
|
+
});
|
|
317
|
+
};
|
|
318
|
+
reader.readAsArrayBuffer(file);
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
function getFileIdentifier(file) {
|
|
322
|
+
if (!file.name || !file.type || !file.size) {
|
|
323
|
+
const message = "File has no name, type, and/or size";
|
|
324
|
+
console.error(`${message}`, file);
|
|
325
|
+
throw new Error(`${message}.`);
|
|
315
326
|
}
|
|
316
|
-
|
|
317
|
-
|
|
327
|
+
return `${file.name}&${file.type}${file.size}`;
|
|
328
|
+
}
|
|
329
|
+
function getRenamedFile(file, newName) {
|
|
330
|
+
return new File([file], newName, { type: file.type });
|
|
331
|
+
}
|
|
332
|
+
function downloadInMemoryFile(filename, text) {
|
|
333
|
+
const element = document.createElement("a");
|
|
334
|
+
element.setAttribute("href", "data:text/plain;charset=utf-8," + encodeURIComponent(text));
|
|
335
|
+
element.setAttribute("download", filename);
|
|
336
|
+
element.style.display = "none";
|
|
337
|
+
document.body.appendChild(element);
|
|
338
|
+
element.click();
|
|
339
|
+
document.body.removeChild(element);
|
|
340
|
+
}
|
|
341
|
+
const constructUploadedFilePayloads = async (files) => {
|
|
342
|
+
const filePayloads = {};
|
|
343
|
+
for (const file of files) {
|
|
344
|
+
const sha1 = await hashFile(file);
|
|
345
|
+
filePayloads[sha1] = {
|
|
346
|
+
sha1,
|
|
347
|
+
extension: file.name.split(".").pop() || "",
|
|
348
|
+
file_type: file.type,
|
|
349
|
+
size: file.size
|
|
350
|
+
};
|
|
318
351
|
}
|
|
352
|
+
return Object.values(filePayloads);
|
|
353
|
+
};
|
|
354
|
+
const fileToBlob = async (dataUrl) => {
|
|
355
|
+
return (await fetch(dataUrl)).blob();
|
|
356
|
+
};
|
|
357
|
+
const blobToBase64 = (blob) => {
|
|
358
|
+
return new Promise((resolve, _) => {
|
|
359
|
+
const reader = new FileReader();
|
|
360
|
+
reader.onloadend = () => {
|
|
361
|
+
var _a2;
|
|
362
|
+
resolve(((_a2 = reader.result) == null ? void 0 : _a2.toString()) || "");
|
|
363
|
+
};
|
|
364
|
+
reader.readAsDataURL(blob);
|
|
365
|
+
});
|
|
366
|
+
};
|
|
367
|
+
const useFileSrc = (props) => {
|
|
368
|
+
const { file, fileSha1, placeholder } = props;
|
|
369
|
+
const [src, setSrc] = useState(placeholder);
|
|
370
|
+
const { sdk } = useSDK();
|
|
371
|
+
useEffect(() => {
|
|
372
|
+
if (!fileSha1 || !file)
|
|
373
|
+
return;
|
|
374
|
+
sdk.files.fetchFileFromUrl(file, fileSha1).then((file2) => {
|
|
375
|
+
setSrc(URL.createObjectURL(file2));
|
|
376
|
+
}).catch((reason) => {
|
|
377
|
+
console.error(`Failed to fetch file ${file} (${fileSha1}):
|
|
378
|
+
`, reason);
|
|
379
|
+
});
|
|
380
|
+
}, [file, fileSha1, sdk.files]);
|
|
381
|
+
return src;
|
|
382
|
+
};
|
|
383
|
+
function downloadFile(file) {
|
|
384
|
+
const blob = new Blob([file]);
|
|
385
|
+
saveAs(blob, file.name);
|
|
319
386
|
}
|
|
320
|
-
_a = Symbol.toStringTag;
|
|
321
387
|
const global$1 = typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
|
|
322
388
|
function defaultSetTimout() {
|
|
323
389
|
throw new Error("setTimeout has not been defined");
|
|
@@ -797,106 +863,6 @@ function classNames$1(...args) {
|
|
|
797
863
|
}
|
|
798
864
|
return classes.join(" ");
|
|
799
865
|
}
|
|
800
|
-
function hex(buffer) {
|
|
801
|
-
const hashArray = new Uint8Array(buffer);
|
|
802
|
-
return hashArray.reduce((data, byte) => data + byte.toString(16).padStart(2, "0"), "");
|
|
803
|
-
}
|
|
804
|
-
const getFileS3Key = async (file, hash) => {
|
|
805
|
-
if (!hash) {
|
|
806
|
-
hash = await hashFile(file);
|
|
807
|
-
}
|
|
808
|
-
let fileType = file.type;
|
|
809
|
-
if (fileType.includes("/")) {
|
|
810
|
-
fileType = fileType.split("/")[1];
|
|
811
|
-
}
|
|
812
|
-
if (!fileType) {
|
|
813
|
-
throw new Error(`Could not extract file type from ${file.type}`);
|
|
814
|
-
}
|
|
815
|
-
return `${hash}.${fileType}`;
|
|
816
|
-
};
|
|
817
|
-
function hashFile(file) {
|
|
818
|
-
return new Promise((resolve, reject) => {
|
|
819
|
-
const reader = new FileReader();
|
|
820
|
-
reader.onload = () => {
|
|
821
|
-
const fileResult = reader.result;
|
|
822
|
-
if (!fileResult) {
|
|
823
|
-
reject();
|
|
824
|
-
return;
|
|
825
|
-
}
|
|
826
|
-
void crypto.subtle.digest("SHA-1", fileResult).then((hash) => {
|
|
827
|
-
const sha1result = hex(hash);
|
|
828
|
-
resolve(sha1result);
|
|
829
|
-
});
|
|
830
|
-
};
|
|
831
|
-
reader.readAsArrayBuffer(file);
|
|
832
|
-
});
|
|
833
|
-
}
|
|
834
|
-
function getFileIdentifier(file) {
|
|
835
|
-
if (!file.name || !file.type || !file.size) {
|
|
836
|
-
const message = "File has no name, type, and/or size";
|
|
837
|
-
console.error(`${message}`, file);
|
|
838
|
-
throw new Error(`${message}.`);
|
|
839
|
-
}
|
|
840
|
-
return `${file.name}&${file.type}${file.size}`;
|
|
841
|
-
}
|
|
842
|
-
function getRenamedFile(file, newName) {
|
|
843
|
-
return new File([file], newName, { type: file.type });
|
|
844
|
-
}
|
|
845
|
-
function downloadInMemoryFile(filename, text) {
|
|
846
|
-
const element = document.createElement("a");
|
|
847
|
-
element.setAttribute("href", "data:text/plain;charset=utf-8," + encodeURIComponent(text));
|
|
848
|
-
element.setAttribute("download", filename);
|
|
849
|
-
element.style.display = "none";
|
|
850
|
-
document.body.appendChild(element);
|
|
851
|
-
element.click();
|
|
852
|
-
document.body.removeChild(element);
|
|
853
|
-
}
|
|
854
|
-
const constructUploadedFilePayloads = async (files) => {
|
|
855
|
-
const filePayloads = {};
|
|
856
|
-
for (const file of files) {
|
|
857
|
-
const sha1 = await hashFile(file);
|
|
858
|
-
filePayloads[sha1] = {
|
|
859
|
-
sha1,
|
|
860
|
-
extension: file.name.split(".").pop() || "",
|
|
861
|
-
file_type: file.type,
|
|
862
|
-
size: file.size
|
|
863
|
-
};
|
|
864
|
-
}
|
|
865
|
-
return Object.values(filePayloads);
|
|
866
|
-
};
|
|
867
|
-
const fileToBlob = async (dataUrl) => {
|
|
868
|
-
return (await fetch(dataUrl)).blob();
|
|
869
|
-
};
|
|
870
|
-
const blobToBase64 = (blob) => {
|
|
871
|
-
return new Promise((resolve, _) => {
|
|
872
|
-
const reader = new FileReader();
|
|
873
|
-
reader.onloadend = () => {
|
|
874
|
-
var _a2;
|
|
875
|
-
resolve(((_a2 = reader.result) == null ? void 0 : _a2.toString()) || "");
|
|
876
|
-
};
|
|
877
|
-
reader.readAsDataURL(blob);
|
|
878
|
-
});
|
|
879
|
-
};
|
|
880
|
-
const useFileSrc = (props) => {
|
|
881
|
-
const { file, fileSha1, placeholder } = props;
|
|
882
|
-
const [src, setSrc] = useState(placeholder);
|
|
883
|
-
const { sdk } = useSDK();
|
|
884
|
-
useEffect(() => {
|
|
885
|
-
if (!fileSha1 || !file)
|
|
886
|
-
return;
|
|
887
|
-
sdk.files.fetchFileFromUrl(file, fileSha1).then((file2) => {
|
|
888
|
-
setSrc(URL.createObjectURL(file2));
|
|
889
|
-
}).catch((reason) => {
|
|
890
|
-
console.error(`Failed to fetch file ${file} (${fileSha1}):
|
|
891
|
-
`, reason);
|
|
892
|
-
});
|
|
893
|
-
}, [file, fileSha1, sdk.files]);
|
|
894
|
-
return src;
|
|
895
|
-
};
|
|
896
|
-
function downloadFile(file) {
|
|
897
|
-
const blob = new Blob([file]);
|
|
898
|
-
saveAs(blob, file.name);
|
|
899
|
-
}
|
|
900
866
|
const logCache = {};
|
|
901
867
|
function logOnlyOnce(logId, objId, level, ...args) {
|
|
902
868
|
const thisLogIdCache = logCache[logId];
|
|
@@ -1384,7 +1350,7 @@ const ColorsToString = {
|
|
|
1384
1350
|
[mint.mint9]: "mint",
|
|
1385
1351
|
[sky.sky9]: "sky"
|
|
1386
1352
|
};
|
|
1387
|
-
const
|
|
1353
|
+
const ComponentStageColors = {
|
|
1388
1354
|
indigo: indigo.indigo9,
|
|
1389
1355
|
red: red.red9,
|
|
1390
1356
|
violet: violet.violet9,
|
|
@@ -1406,7 +1372,7 @@ const generateBadgeColors = (rawColor) => {
|
|
|
1406
1372
|
return { backgroundColor, textColor };
|
|
1407
1373
|
};
|
|
1408
1374
|
function getStageColor(index2) {
|
|
1409
|
-
return Object.values(
|
|
1375
|
+
return Object.values(ComponentStageColors)[index2 % Object.keys(ComponentStageColors).length];
|
|
1410
1376
|
}
|
|
1411
1377
|
const getLocalDateString = memoize((date) => {
|
|
1412
1378
|
if (!date)
|
|
@@ -1626,115 +1592,122 @@ function removeAttachments(state, action) {
|
|
|
1626
1592
|
}
|
|
1627
1593
|
}
|
|
1628
1594
|
const initialState$q = {
|
|
1629
|
-
|
|
1630
|
-
|
|
1595
|
+
componentTypes: {},
|
|
1596
|
+
hiddenComponentTypeIds: {},
|
|
1631
1597
|
attachments: {}
|
|
1632
1598
|
};
|
|
1633
|
-
const
|
|
1634
|
-
name: "
|
|
1599
|
+
const componentTypeSlice = createSlice({
|
|
1600
|
+
name: "componentTypes",
|
|
1635
1601
|
initialState: initialState$q,
|
|
1636
1602
|
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
|
|
1637
1603
|
reducers: {
|
|
1638
|
-
|
|
1639
|
-
state.
|
|
1604
|
+
addComponentType: (state, action) => {
|
|
1605
|
+
state.componentTypes[action.payload.offline_id] = action.payload;
|
|
1640
1606
|
},
|
|
1641
|
-
|
|
1642
|
-
state.
|
|
1607
|
+
setComponentTypes: (state, action) => {
|
|
1608
|
+
state.componentTypes = toOfflineIdRecord(action.payload);
|
|
1643
1609
|
},
|
|
1644
|
-
|
|
1645
|
-
state.
|
|
1610
|
+
toggleComponentTypeVisibility: (state, action) => {
|
|
1611
|
+
state.hiddenComponentTypeIds[action.payload] = !state.hiddenComponentTypeIds[action.payload];
|
|
1646
1612
|
},
|
|
1647
|
-
|
|
1648
|
-
delete state.
|
|
1613
|
+
deleteComponentType: (state, action) => {
|
|
1614
|
+
delete state.componentTypes[action.payload];
|
|
1649
1615
|
},
|
|
1650
1616
|
// Attachments
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1617
|
+
setComponentTypeAttachment: setAttachment,
|
|
1618
|
+
setComponentTypeAttachments: setAttachments,
|
|
1619
|
+
addComponentTypeAttachment: addAttachment,
|
|
1620
|
+
addComponentTypeAttachments: addAttachments,
|
|
1621
|
+
updateComponentTypeAttachment: updateAttachment,
|
|
1622
|
+
updateComponentTypeAttachments: updateAttachments,
|
|
1623
|
+
removeComponentTypeAttachment: removeAttachment,
|
|
1624
|
+
removeComponentTypeAttachments: removeAttachments
|
|
1659
1625
|
}
|
|
1660
1626
|
});
|
|
1661
1627
|
const {
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1628
|
+
addComponentType,
|
|
1629
|
+
setComponentTypes,
|
|
1630
|
+
toggleComponentTypeVisibility,
|
|
1631
|
+
deleteComponentType,
|
|
1666
1632
|
// Attachmet
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
} =
|
|
1676
|
-
const
|
|
1677
|
-
const
|
|
1678
|
-
[
|
|
1633
|
+
setComponentTypeAttachment,
|
|
1634
|
+
setComponentTypeAttachments,
|
|
1635
|
+
addComponentTypeAttachment,
|
|
1636
|
+
addComponentTypeAttachments,
|
|
1637
|
+
updateComponentTypeAttachment,
|
|
1638
|
+
updateComponentTypeAttachments,
|
|
1639
|
+
removeComponentTypeAttachment,
|
|
1640
|
+
removeComponentTypeAttachments
|
|
1641
|
+
} = componentTypeSlice.actions;
|
|
1642
|
+
const selectComponentTypesMapping = (state) => state.componentTypeReducer.componentTypes;
|
|
1643
|
+
const selectComponentTypes = createSelector(
|
|
1644
|
+
[selectComponentTypesMapping],
|
|
1679
1645
|
(mapping) => Object.values(mapping)
|
|
1680
1646
|
);
|
|
1681
|
-
const
|
|
1682
|
-
createSelector(
|
|
1683
|
-
[selectAssetTypesMapping, (_state, assetTypeId) => assetTypeId],
|
|
1684
|
-
(mapping, assetTypeId) => mapping[assetTypeId]
|
|
1685
|
-
)
|
|
1647
|
+
const selectComponentType = restructureCreateSelectorWithArgs(
|
|
1648
|
+
createSelector([selectComponentTypesMapping, (_state, id) => id], (mapping, id) => mapping[id])
|
|
1686
1649
|
);
|
|
1687
|
-
const
|
|
1650
|
+
const selectNumberOfComponentTypesMatchingCaseInsensitiveName = restructureCreateSelectorWithArgs(
|
|
1688
1651
|
createSelector(
|
|
1689
|
-
[
|
|
1652
|
+
[
|
|
1653
|
+
selectComponentTypesMapping,
|
|
1654
|
+
(_state, args) => args
|
|
1655
|
+
],
|
|
1690
1656
|
(mapping, args) => {
|
|
1691
1657
|
var _a2;
|
|
1692
1658
|
const name = ((_a2 = args.name) == null ? void 0 : _a2.toLowerCase()) ?? null;
|
|
1693
1659
|
return Object.values(mapping).filter(
|
|
1694
|
-
(
|
|
1660
|
+
(componentType) => {
|
|
1695
1661
|
var _a3;
|
|
1696
|
-
return (((_a3 =
|
|
1662
|
+
return (((_a3 = componentType.name) == null ? void 0 : _a3.toLowerCase()) ?? null) === name && componentType.offline_id !== args.componentTypeId;
|
|
1697
1663
|
}
|
|
1698
1664
|
).length;
|
|
1699
1665
|
}
|
|
1700
1666
|
)
|
|
1701
1667
|
);
|
|
1702
|
-
const
|
|
1703
|
-
createSelector(
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
return (
|
|
1708
|
-
|
|
1709
|
-
|
|
1668
|
+
const selectComponentTypesByName = restructureCreateSelectorWithArgs(
|
|
1669
|
+
createSelector(
|
|
1670
|
+
[selectComponentTypesMapping, (_state, name) => name],
|
|
1671
|
+
(mapping, name) => {
|
|
1672
|
+
name = (name == null ? void 0 : name.toLowerCase()) ?? null;
|
|
1673
|
+
return Object.values(mapping).filter(
|
|
1674
|
+
(componentType) => {
|
|
1675
|
+
var _a2;
|
|
1676
|
+
return (((_a2 = componentType.name) == null ? void 0 : _a2.toLowerCase()) ?? null) === name;
|
|
1677
|
+
}
|
|
1678
|
+
);
|
|
1679
|
+
}
|
|
1680
|
+
)
|
|
1710
1681
|
);
|
|
1711
|
-
const
|
|
1712
|
-
const
|
|
1713
|
-
const
|
|
1714
|
-
[
|
|
1682
|
+
const selectHiddenComponentTypeIds = (state) => state.componentTypeReducer.hiddenComponentTypeIds;
|
|
1683
|
+
const selectComponentTypeAttachmentMapping = (state) => state.componentTypeReducer.attachments;
|
|
1684
|
+
const selectAllComponentTypeAttachments = createSelector(
|
|
1685
|
+
[selectComponentTypeAttachmentMapping],
|
|
1715
1686
|
(mapping) => Object.values(mapping)
|
|
1716
1687
|
);
|
|
1717
|
-
const
|
|
1718
|
-
return state.
|
|
1688
|
+
const selectComponentTypeAttachment = (attachmentId) => (state) => {
|
|
1689
|
+
return state.componentTypeReducer.attachments[attachmentId];
|
|
1719
1690
|
};
|
|
1720
|
-
const
|
|
1691
|
+
const selectAttachmentsOfComponentType = restructureCreateSelectorWithArgs(
|
|
1721
1692
|
createSelector(
|
|
1722
|
-
[
|
|
1723
|
-
(attachments,
|
|
1724
|
-
return attachments.filter(({
|
|
1693
|
+
[selectAllComponentTypeAttachments, (_state, componentTypeId) => componentTypeId],
|
|
1694
|
+
(attachments, componentTypeId) => {
|
|
1695
|
+
return attachments.filter(({ component_type }) => componentTypeId === component_type);
|
|
1725
1696
|
}
|
|
1726
1697
|
)
|
|
1727
1698
|
);
|
|
1728
|
-
const
|
|
1699
|
+
const selectAttachmentsOfComponentTypeByType = restructureCreateSelectorWithArgs(
|
|
1729
1700
|
createSelector(
|
|
1730
|
-
[
|
|
1731
|
-
(attachments,
|
|
1732
|
-
const
|
|
1733
|
-
|
|
1701
|
+
[selectAllComponentTypeAttachments, (_state, componentTypeId) => componentTypeId],
|
|
1702
|
+
(attachments, componentTypeId) => {
|
|
1703
|
+
const attachmentsOfComponent = attachments.filter(
|
|
1704
|
+
({ component_type }) => component_type === componentTypeId
|
|
1705
|
+
);
|
|
1706
|
+
const fileAttachments = attachmentsOfComponent.filter(
|
|
1734
1707
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1735
1708
|
({ file_type }) => !file_type || !file_type.startsWith("image/")
|
|
1736
1709
|
);
|
|
1737
|
-
const imageAttachments =
|
|
1710
|
+
const imageAttachments = attachmentsOfComponent.filter(
|
|
1738
1711
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1739
1712
|
({ file_type }) => file_type && file_type.startsWith("image/")
|
|
1740
1713
|
);
|
|
@@ -1742,157 +1715,173 @@ const selectAttachmentsOfAssetTypeByType = restructureCreateSelectorWithArgs(
|
|
|
1742
1715
|
}
|
|
1743
1716
|
)
|
|
1744
1717
|
);
|
|
1745
|
-
const
|
|
1718
|
+
const componentTypeReducer = componentTypeSlice.reducer;
|
|
1746
1719
|
const initialState$p = {
|
|
1747
|
-
|
|
1720
|
+
components: {},
|
|
1748
1721
|
attachments: {}
|
|
1749
1722
|
};
|
|
1750
|
-
const
|
|
1751
|
-
name: "
|
|
1723
|
+
const componentSlice = createSlice({
|
|
1724
|
+
name: "components",
|
|
1752
1725
|
initialState: initialState$p,
|
|
1753
1726
|
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
|
|
1754
1727
|
reducers: {
|
|
1755
|
-
|
|
1756
|
-
state.
|
|
1757
|
-
|
|
1728
|
+
addComponent: (state, action) => {
|
|
1729
|
+
state.components[action.payload.offline_id] = action.payload;
|
|
1730
|
+
prevComponents = null;
|
|
1758
1731
|
},
|
|
1759
|
-
|
|
1760
|
-
Object.assign(state.
|
|
1761
|
-
|
|
1732
|
+
addComponentsInBatches: (state, action) => {
|
|
1733
|
+
Object.assign(state.components, toOfflineIdRecord(action.payload));
|
|
1734
|
+
prevComponents = null;
|
|
1762
1735
|
},
|
|
1763
|
-
|
|
1764
|
-
state.
|
|
1765
|
-
|
|
1736
|
+
setComponents: (state, action) => {
|
|
1737
|
+
state.components = toOfflineIdRecord(action.payload);
|
|
1738
|
+
prevComponents = null;
|
|
1766
1739
|
},
|
|
1767
|
-
|
|
1768
|
-
if (action.payload.offline_id in state.
|
|
1769
|
-
state.
|
|
1740
|
+
updateComponent: (state, action) => {
|
|
1741
|
+
if (action.payload.offline_id in state.components) {
|
|
1742
|
+
state.components[action.payload.offline_id] = action.payload;
|
|
1770
1743
|
} else {
|
|
1771
|
-
throw new Error(`Tried to update
|
|
1744
|
+
throw new Error(`Tried to update component with ID that doesn't exist: ${action.payload.offline_id}`);
|
|
1772
1745
|
}
|
|
1773
|
-
|
|
1746
|
+
prevComponents = null;
|
|
1774
1747
|
},
|
|
1775
|
-
|
|
1776
|
-
if (action.payload in state.
|
|
1777
|
-
delete state.
|
|
1748
|
+
removeComponent: (state, action) => {
|
|
1749
|
+
if (action.payload in state.components) {
|
|
1750
|
+
delete state.components[action.payload];
|
|
1778
1751
|
} else {
|
|
1779
|
-
throw new Error(`Failed to remove
|
|
1752
|
+
throw new Error(`Failed to remove component because ID doesn't exist: ${action.payload}`);
|
|
1780
1753
|
}
|
|
1781
|
-
|
|
1754
|
+
prevComponents = null;
|
|
1782
1755
|
},
|
|
1783
|
-
|
|
1756
|
+
removeAllComponentsOfType: (state, action) => {
|
|
1784
1757
|
var _a2;
|
|
1785
|
-
for (const componentId in state.
|
|
1786
|
-
if (((_a2 = state.
|
|
1787
|
-
delete state.
|
|
1758
|
+
for (const componentId in state.components) {
|
|
1759
|
+
if (((_a2 = state.components[componentId]) == null ? void 0 : _a2.component_type) === action.payload) {
|
|
1760
|
+
delete state.components[componentId];
|
|
1788
1761
|
}
|
|
1789
1762
|
}
|
|
1790
|
-
|
|
1763
|
+
prevComponents = null;
|
|
1791
1764
|
},
|
|
1792
1765
|
// Attachments
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1766
|
+
setComponentAttachment: setAttachment,
|
|
1767
|
+
setComponentAttachments: setAttachments,
|
|
1768
|
+
addComponentAttachment: addAttachment,
|
|
1769
|
+
addComponentAttachments: addAttachments,
|
|
1770
|
+
updateComponentAttachment: updateAttachment,
|
|
1771
|
+
updateComponentAttachments: updateAttachments,
|
|
1772
|
+
removeComponentAttachment: removeAttachment,
|
|
1773
|
+
removeComponentAttachments: removeAttachments
|
|
1801
1774
|
}
|
|
1802
1775
|
});
|
|
1803
1776
|
const {
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1777
|
+
addComponent,
|
|
1778
|
+
updateComponent,
|
|
1779
|
+
removeComponent,
|
|
1780
|
+
addComponentsInBatches,
|
|
1781
|
+
setComponents,
|
|
1782
|
+
removeAllComponentsOfType,
|
|
1810
1783
|
// Attachments
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
} =
|
|
1820
|
-
let
|
|
1821
|
-
const
|
|
1822
|
-
if (!
|
|
1823
|
-
|
|
1824
|
-
}
|
|
1825
|
-
return
|
|
1784
|
+
setComponentAttachment,
|
|
1785
|
+
setComponentAttachments,
|
|
1786
|
+
addComponentAttachment,
|
|
1787
|
+
addComponentAttachments,
|
|
1788
|
+
updateComponentAttachment,
|
|
1789
|
+
updateComponentAttachments,
|
|
1790
|
+
removeComponentAttachment,
|
|
1791
|
+
removeComponentAttachments
|
|
1792
|
+
} = componentSlice.actions;
|
|
1793
|
+
let prevComponents = null;
|
|
1794
|
+
const selectComponents = (state) => {
|
|
1795
|
+
if (!prevComponents) {
|
|
1796
|
+
prevComponents = Object.values(state.componentReducer.components);
|
|
1797
|
+
}
|
|
1798
|
+
return prevComponents;
|
|
1826
1799
|
};
|
|
1827
|
-
const
|
|
1828
|
-
const
|
|
1829
|
-
createSelector(
|
|
1830
|
-
|
|
1831
|
-
|
|
1800
|
+
const selectComponentsMapping = (state) => state.componentReducer.components;
|
|
1801
|
+
const selectComponentsFromComponentType = restructureCreateSelectorWithArgs(
|
|
1802
|
+
createSelector(
|
|
1803
|
+
[selectComponents, (_state, componentTypeId) => componentTypeId],
|
|
1804
|
+
(components, componentTypeId) => {
|
|
1805
|
+
if (!componentTypeId)
|
|
1806
|
+
return [];
|
|
1807
|
+
return components.filter((component) => component.component_type === componentTypeId);
|
|
1808
|
+
}
|
|
1809
|
+
)
|
|
1832
1810
|
);
|
|
1833
|
-
const
|
|
1834
|
-
return state.
|
|
1811
|
+
const selectComponent = (componentId) => (state) => {
|
|
1812
|
+
return state.componentReducer.components[componentId];
|
|
1813
|
+
};
|
|
1814
|
+
const selectComponentTypeFromComponent = (componentTypeId) => (state) => {
|
|
1815
|
+
return state.componentTypeReducer.componentTypes[componentTypeId];
|
|
1835
1816
|
};
|
|
1836
|
-
const
|
|
1837
|
-
[
|
|
1838
|
-
(
|
|
1817
|
+
const selectComponentTypeFromComponents = createSelector(
|
|
1818
|
+
[selectComponents, selectComponentTypesMapping],
|
|
1819
|
+
(components, componentTypeMapping) => {
|
|
1839
1820
|
const ret = {};
|
|
1840
|
-
for (const
|
|
1841
|
-
const
|
|
1842
|
-
if (!
|
|
1821
|
+
for (const component of components) {
|
|
1822
|
+
const componentType = componentTypeMapping[component.component_type];
|
|
1823
|
+
if (!componentType) {
|
|
1843
1824
|
console.error(
|
|
1844
|
-
`
|
|
1845
|
-
Expected all referenced
|
|
1825
|
+
`Component type with ID ${component.component_type} not found.
|
|
1826
|
+
Expected all referenced component types to be populated.
|
|
1846
1827
|
Returning empty object to avoid fatal errors.`
|
|
1847
1828
|
);
|
|
1848
1829
|
return {};
|
|
1849
1830
|
}
|
|
1850
|
-
ret[
|
|
1831
|
+
ret[component.offline_id] = componentType;
|
|
1851
1832
|
}
|
|
1852
1833
|
return ret;
|
|
1853
1834
|
}
|
|
1854
1835
|
);
|
|
1855
|
-
const
|
|
1836
|
+
const selectComponentsByType = restructureCreateSelectorWithArgs(
|
|
1837
|
+
createSelector(
|
|
1838
|
+
[selectComponents, (_state, componentTypeId) => componentTypeId],
|
|
1839
|
+
(components, componentTypeId) => {
|
|
1840
|
+
return components.filter((component) => component.component_type === componentTypeId);
|
|
1841
|
+
}
|
|
1842
|
+
)
|
|
1843
|
+
);
|
|
1844
|
+
const selectNumberOfComponentsOfComponentType = (componentTypeId) => (state) => {
|
|
1856
1845
|
var _a2;
|
|
1857
|
-
if (!
|
|
1846
|
+
if (!componentTypeId)
|
|
1858
1847
|
return 0;
|
|
1859
|
-
return (_a2 =
|
|
1848
|
+
return (_a2 = selectComponentsByType(componentTypeId)(state)) == null ? void 0 : _a2.length;
|
|
1860
1849
|
};
|
|
1861
|
-
const
|
|
1862
|
-
return
|
|
1863
|
-
const
|
|
1864
|
-
if (
|
|
1865
|
-
acc.push(
|
|
1850
|
+
const selectComponentTypesFromIds = (componentTypeIds) => (state) => {
|
|
1851
|
+
return componentTypeIds.reduce((acc, componentTypeId) => {
|
|
1852
|
+
const componentType = state.componentTypeReducer.componentTypes[componentTypeId];
|
|
1853
|
+
if (componentType) {
|
|
1854
|
+
acc.push(componentType);
|
|
1866
1855
|
}
|
|
1867
1856
|
return acc;
|
|
1868
1857
|
}, []);
|
|
1869
1858
|
};
|
|
1870
|
-
const
|
|
1871
|
-
const
|
|
1872
|
-
[
|
|
1859
|
+
const selectComponentAttachmentMapping = (state) => state.componentReducer.attachments;
|
|
1860
|
+
const selectAllComponentAttachments = createSelector(
|
|
1861
|
+
[selectComponentAttachmentMapping],
|
|
1873
1862
|
(mapping) => Object.values(mapping)
|
|
1874
1863
|
);
|
|
1875
|
-
const
|
|
1876
|
-
return state.
|
|
1864
|
+
const selectComponentAttachment = (attachmentId) => (state) => {
|
|
1865
|
+
return state.componentReducer.attachments[attachmentId];
|
|
1877
1866
|
};
|
|
1878
|
-
const
|
|
1867
|
+
const selectAttachmentsOfComponent = restructureCreateSelectorWithArgs(
|
|
1879
1868
|
createSelector(
|
|
1880
|
-
[
|
|
1881
|
-
(attachments,
|
|
1882
|
-
return attachments.filter(({
|
|
1869
|
+
[selectAllComponentAttachments, (_state, componentId) => componentId],
|
|
1870
|
+
(attachments, componentId) => {
|
|
1871
|
+
return attachments.filter(({ component }) => componentId === component);
|
|
1883
1872
|
}
|
|
1884
1873
|
)
|
|
1885
1874
|
);
|
|
1886
|
-
const
|
|
1875
|
+
const selectAttachmentsOfComponentByType = restructureCreateSelectorWithArgs(
|
|
1887
1876
|
createSelector(
|
|
1888
|
-
[
|
|
1889
|
-
(attachments,
|
|
1890
|
-
const
|
|
1891
|
-
const fileAttachments =
|
|
1877
|
+
[selectAllComponentAttachments, (_state, componentId) => componentId],
|
|
1878
|
+
(attachments, componentId) => {
|
|
1879
|
+
const attachmentsOfComponent = attachments.filter(({ component }) => componentId === component);
|
|
1880
|
+
const fileAttachments = attachmentsOfComponent.filter(
|
|
1892
1881
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1893
1882
|
({ file_type }) => !file_type || !file_type.startsWith("image/")
|
|
1894
1883
|
);
|
|
1895
|
-
const imageAttachments =
|
|
1884
|
+
const imageAttachments = attachmentsOfComponent.filter(
|
|
1896
1885
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1897
1886
|
({ file_type }) => file_type && file_type.startsWith("image/")
|
|
1898
1887
|
);
|
|
@@ -1900,67 +1889,69 @@ const selectAttachmentsOfAssetsByType = restructureCreateSelectorWithArgs(
|
|
|
1900
1889
|
}
|
|
1901
1890
|
)
|
|
1902
1891
|
);
|
|
1903
|
-
const
|
|
1892
|
+
const componentReducer = componentSlice.reducer;
|
|
1904
1893
|
const initialState$o = {
|
|
1905
|
-
|
|
1894
|
+
completionsByComponentId: {}
|
|
1906
1895
|
};
|
|
1907
|
-
const
|
|
1908
|
-
name: "
|
|
1896
|
+
const componentStageCompletionSlice = createSlice({
|
|
1897
|
+
name: "componentStageCompletions",
|
|
1909
1898
|
initialState: initialState$o,
|
|
1910
1899
|
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
|
|
1911
1900
|
reducers: {
|
|
1912
1901
|
addStageCompletion: (state, action) => {
|
|
1913
|
-
let stageToCompletionDateMapping = state.
|
|
1902
|
+
let stageToCompletionDateMapping = state.completionsByComponentId[action.payload.component];
|
|
1914
1903
|
if (!stageToCompletionDateMapping) {
|
|
1915
1904
|
stageToCompletionDateMapping = {};
|
|
1916
|
-
state.
|
|
1905
|
+
state.completionsByComponentId[action.payload.component] = stageToCompletionDateMapping;
|
|
1917
1906
|
}
|
|
1918
1907
|
stageToCompletionDateMapping[action.payload.stage] = (/* @__PURE__ */ new Date()).toISOString();
|
|
1919
1908
|
},
|
|
1920
1909
|
addStageCompletions: (state, action) => {
|
|
1921
|
-
for (const [
|
|
1910
|
+
for (const [componentId, stageIdToCompletionDateMapping] of Object.entries(action.payload)) {
|
|
1922
1911
|
if (Object.keys(stageIdToCompletionDateMapping).length === 0)
|
|
1923
|
-
throw new Error(
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1912
|
+
throw new Error(
|
|
1913
|
+
`Encountered empty stageIdToCompletionDateMapping argument for component ${componentId}`
|
|
1914
|
+
);
|
|
1915
|
+
let thisComponentCompletions = state.completionsByComponentId[componentId];
|
|
1916
|
+
if (thisComponentCompletions === void 0) {
|
|
1917
|
+
thisComponentCompletions = {};
|
|
1927
1918
|
}
|
|
1928
1919
|
for (const [stageId, completionDate] of Object.entries(stageIdToCompletionDateMapping)) {
|
|
1929
|
-
|
|
1920
|
+
thisComponentCompletions[stageId] = completionDate;
|
|
1930
1921
|
}
|
|
1931
|
-
state.
|
|
1922
|
+
state.completionsByComponentId[componentId] = thisComponentCompletions;
|
|
1932
1923
|
}
|
|
1933
1924
|
},
|
|
1934
1925
|
removeStageCompletions: (state, action) => {
|
|
1935
1926
|
for (const completion of action.payload) {
|
|
1936
|
-
const
|
|
1937
|
-
if (!
|
|
1927
|
+
const thisComponentCompletions = state.completionsByComponentId[completion.component];
|
|
1928
|
+
if (!thisComponentCompletions || !(completion.stage in thisComponentCompletions)) {
|
|
1938
1929
|
console.warn(
|
|
1939
1930
|
"Skipping removal of uncompleted stage. This message indicates completion objects are created unnecessarily."
|
|
1940
1931
|
);
|
|
1941
1932
|
continue;
|
|
1942
1933
|
}
|
|
1943
|
-
delete
|
|
1934
|
+
delete thisComponentCompletions[completion.stage];
|
|
1944
1935
|
}
|
|
1945
1936
|
},
|
|
1946
1937
|
setStageCompletions: (state, action) => {
|
|
1947
|
-
state.
|
|
1938
|
+
state.completionsByComponentId = action.payload;
|
|
1948
1939
|
}
|
|
1949
1940
|
}
|
|
1950
1941
|
});
|
|
1951
|
-
const { addStageCompletion, addStageCompletions, removeStageCompletions, setStageCompletions } =
|
|
1942
|
+
const { addStageCompletion, addStageCompletions, removeStageCompletions, setStageCompletions } = componentStageCompletionSlice.actions;
|
|
1952
1943
|
const selectCompletedStages = (state) => {
|
|
1953
|
-
return state.
|
|
1944
|
+
return state.componentStageCompletionReducer.completionsByComponentId;
|
|
1954
1945
|
};
|
|
1955
|
-
const
|
|
1956
|
-
return Object.keys(state.
|
|
1946
|
+
const selectCompletedStageIdsForComponent = (component) => (state) => {
|
|
1947
|
+
return Object.keys(state.componentStageCompletionReducer.completionsByComponentId[component.offline_id] ?? {});
|
|
1957
1948
|
};
|
|
1958
|
-
const
|
|
1949
|
+
const componentStageCompletionReducer = componentStageCompletionSlice.reducer;
|
|
1959
1950
|
const initialState$n = {
|
|
1960
1951
|
stages: {}
|
|
1961
1952
|
};
|
|
1962
|
-
const
|
|
1963
|
-
name: "
|
|
1953
|
+
const componentStageSlice = createSlice({
|
|
1954
|
+
name: "componentStages",
|
|
1964
1955
|
initialState: initialState$n,
|
|
1965
1956
|
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
|
|
1966
1957
|
reducers: {
|
|
@@ -1995,48 +1986,60 @@ const assetStageSlice = createSlice({
|
|
|
1995
1986
|
}
|
|
1996
1987
|
}
|
|
1997
1988
|
});
|
|
1998
|
-
const selectStageMapping = (state) => state.
|
|
1989
|
+
const selectStageMapping = (state) => state.componentStageReducer.stages;
|
|
1999
1990
|
const selectStage = restructureCreateSelectorWithArgs(
|
|
2000
1991
|
createSelector([selectStageMapping, (_state, stageId) => stageId], (stageMapping, stageId) => {
|
|
2001
1992
|
return stageMapping[stageId];
|
|
2002
1993
|
})
|
|
2003
1994
|
);
|
|
2004
|
-
const selectStages = createSelector(
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
1995
|
+
const selectStages = createSelector(
|
|
1996
|
+
[selectStageMapping],
|
|
1997
|
+
(stageMapping) => {
|
|
1998
|
+
return Object.values(stageMapping);
|
|
1999
|
+
}
|
|
2000
|
+
);
|
|
2001
|
+
const selectStagesFromComponentTypeIds = restructureCreateSelectorWithArgs(
|
|
2002
|
+
createSelector(
|
|
2003
|
+
[selectStages, (_state, componentTypeIds) => componentTypeIds],
|
|
2004
|
+
(stages, componentTypeIds) => {
|
|
2005
|
+
const componentTypeIdsSet = new Set(componentTypeIds);
|
|
2006
|
+
const ret = {};
|
|
2007
|
+
for (const stage of stages) {
|
|
2008
|
+
if (componentTypeIdsSet.has(stage.component_type)) {
|
|
2009
|
+
if (!ret[stage.component_type]) {
|
|
2010
|
+
ret[stage.component_type] = [];
|
|
2011
|
+
}
|
|
2012
|
+
ret[stage.component_type].push(stage);
|
|
2015
2013
|
}
|
|
2016
|
-
ret[stage.asset_type].push(stage);
|
|
2017
2014
|
}
|
|
2015
|
+
for (const key in ret) {
|
|
2016
|
+
ret[key] = ret[key].sort((a, b) => a.priority - b.priority);
|
|
2017
|
+
}
|
|
2018
|
+
return ret;
|
|
2018
2019
|
}
|
|
2019
|
-
|
|
2020
|
-
ret[key] = ret[key].sort((a, b) => a.priority - b.priority);
|
|
2021
|
-
}
|
|
2022
|
-
return ret;
|
|
2023
|
-
})
|
|
2020
|
+
)
|
|
2024
2021
|
);
|
|
2025
|
-
const
|
|
2026
|
-
createSelector(
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2022
|
+
const selectComponentTypeStagesMapping = restructureCreateSelectorWithArgs(
|
|
2023
|
+
createSelector(
|
|
2024
|
+
[selectStageMapping, (_state, componentTypeId) => componentTypeId],
|
|
2025
|
+
(stagesMapping, componentTypeId) => {
|
|
2026
|
+
const componentTypeStagesMapping = {};
|
|
2027
|
+
for (const [stageId, stage] of Object.entries(stagesMapping)) {
|
|
2028
|
+
if (stage.component_type === componentTypeId) {
|
|
2029
|
+
componentTypeStagesMapping[stageId] = stage;
|
|
2030
|
+
}
|
|
2031
2031
|
}
|
|
2032
|
+
return componentTypeStagesMapping;
|
|
2032
2033
|
}
|
|
2033
|
-
|
|
2034
|
-
})
|
|
2034
|
+
)
|
|
2035
2035
|
);
|
|
2036
|
-
const
|
|
2037
|
-
createSelector(
|
|
2038
|
-
|
|
2039
|
-
|
|
2036
|
+
const selectStagesFromComponentType = restructureCreateSelectorWithArgs(
|
|
2037
|
+
createSelector(
|
|
2038
|
+
[selectStages, (_state, componentTypeId) => componentTypeId],
|
|
2039
|
+
(stages, componentTypeId) => {
|
|
2040
|
+
return stages.filter((stage) => stage.component_type === componentTypeId).sort((a, b) => a.priority - b.priority);
|
|
2041
|
+
}
|
|
2042
|
+
)
|
|
2040
2043
|
);
|
|
2041
2044
|
const selectStagesFromStageIds = restructureCreateSelectorWithArgs(
|
|
2042
2045
|
createSelector([selectStageMapping, (_state, stageIds) => stageIds], (stageMapping, stageIds) => {
|
|
@@ -2058,8 +2061,8 @@ const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
|
|
|
2058
2061
|
return ret;
|
|
2059
2062
|
})
|
|
2060
2063
|
);
|
|
2061
|
-
const { addStages, updateStages, removeStages, linkStageToForm, unlinkStageToForm } =
|
|
2062
|
-
const
|
|
2064
|
+
const { addStages, updateStages, removeStages, linkStageToForm, unlinkStageToForm } = componentStageSlice.actions;
|
|
2065
|
+
const componentStageReducer = componentStageSlice.reducer;
|
|
2063
2066
|
const initialState$m = {
|
|
2064
2067
|
workspaces: {},
|
|
2065
2068
|
activeWorkspaceId: null
|
|
@@ -2718,8 +2721,8 @@ var OrganizationAccessLevel = /* @__PURE__ */ ((OrganizationAccessLevel2) => {
|
|
|
2718
2721
|
})(OrganizationAccessLevel || {});
|
|
2719
2722
|
var AttachmentModel = /* @__PURE__ */ ((AttachmentModel2) => {
|
|
2720
2723
|
AttachmentModel2["Issue"] = "issue";
|
|
2721
|
-
AttachmentModel2["
|
|
2722
|
-
AttachmentModel2["
|
|
2724
|
+
AttachmentModel2["Component"] = "component";
|
|
2725
|
+
AttachmentModel2["ComponentType"] = "component_type";
|
|
2723
2726
|
AttachmentModel2["Project"] = "project";
|
|
2724
2727
|
AttachmentModel2["Document"] = "document";
|
|
2725
2728
|
return AttachmentModel2;
|
|
@@ -3532,7 +3535,6 @@ const initialState$8 = {
|
|
|
3532
3535
|
placementMode: false,
|
|
3533
3536
|
enableClustering: false,
|
|
3534
3537
|
svgLayout: false,
|
|
3535
|
-
// TODO: this is no longer used
|
|
3536
3538
|
expandedSections: {
|
|
3537
3539
|
Issues: true,
|
|
3538
3540
|
"Map Layers": false,
|
|
@@ -3743,27 +3745,27 @@ const selectFormRevisionsOfForm = restructureCreateSelectorWithArgs(
|
|
|
3743
3745
|
});
|
|
3744
3746
|
})
|
|
3745
3747
|
);
|
|
3746
|
-
const
|
|
3748
|
+
const selectLatestFormRevisionsOfComponentTypes = restructureCreateSelectorWithArgs(
|
|
3747
3749
|
createSelector(
|
|
3748
3750
|
[
|
|
3749
3751
|
(state) => state.formReducer.forms,
|
|
3750
3752
|
selectFormRevisionMapping,
|
|
3751
|
-
(_state,
|
|
3753
|
+
(_state, componentTypeIds) => componentTypeIds
|
|
3752
3754
|
],
|
|
3753
|
-
(userForms, revisions,
|
|
3754
|
-
const
|
|
3755
|
-
const
|
|
3755
|
+
(userForms, revisions, componentTypeIds) => {
|
|
3756
|
+
const componentTypeIdsSet = new Set(componentTypeIds);
|
|
3757
|
+
const formsOfComponentTypes = {};
|
|
3756
3758
|
const ret = {};
|
|
3757
3759
|
for (const form of Object.values(userForms)) {
|
|
3758
|
-
if (form.
|
|
3759
|
-
|
|
3760
|
+
if (form.component_type && componentTypeIdsSet.has(form.component_type)) {
|
|
3761
|
+
formsOfComponentTypes[form.offline_id] = form;
|
|
3760
3762
|
}
|
|
3761
3763
|
}
|
|
3762
3764
|
for (const revision of Object.values(revisions)) {
|
|
3763
|
-
const form =
|
|
3764
|
-
if (!form || !form.
|
|
3765
|
+
const form = formsOfComponentTypes[revision.form];
|
|
3766
|
+
if (!form || !form.component_type || ret[form.component_type] && formRevisionSortFn(ret[form.component_type], revision) > 0)
|
|
3765
3767
|
continue;
|
|
3766
|
-
ret[form.
|
|
3768
|
+
ret[form.component_type] = revision;
|
|
3767
3769
|
}
|
|
3768
3770
|
return ret;
|
|
3769
3771
|
}
|
|
@@ -3880,11 +3882,11 @@ const selectForm = (formId2) => (state) => {
|
|
|
3880
3882
|
const selectFormMapping = (state) => {
|
|
3881
3883
|
return state.formReducer.forms;
|
|
3882
3884
|
};
|
|
3883
|
-
const
|
|
3885
|
+
const selectFormOfComponentType = restructureCreateSelectorWithArgs(
|
|
3884
3886
|
createSelector(
|
|
3885
|
-
[selectFormMapping, (_state,
|
|
3886
|
-
(userForms,
|
|
3887
|
-
return Object.values(userForms).find((userForm) => userForm.
|
|
3887
|
+
[selectFormMapping, (_state, componentTypeId) => componentTypeId],
|
|
3888
|
+
(userForms, componentTypeId) => {
|
|
3889
|
+
return Object.values(userForms).find((userForm) => userForm.component_type === componentTypeId);
|
|
3888
3890
|
}
|
|
3889
3891
|
)
|
|
3890
3892
|
);
|
|
@@ -3900,7 +3902,7 @@ const selectFormsCount = createSelector([selectFormMapping], (userForms) => {
|
|
|
3900
3902
|
return Object.keys(userForms).length;
|
|
3901
3903
|
});
|
|
3902
3904
|
const selectGeneralFormCount = createSelector([selectFormMapping], (userForms) => {
|
|
3903
|
-
return Object.values(userForms).filter((form) => !form.
|
|
3905
|
+
return Object.values(userForms).filter((form) => !form.component_type).length;
|
|
3904
3906
|
});
|
|
3905
3907
|
const formReducer = formSlice.reducer;
|
|
3906
3908
|
const initialState$5 = {
|
|
@@ -4108,31 +4110,31 @@ const selectFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
|
4108
4110
|
}
|
|
4109
4111
|
)
|
|
4110
4112
|
);
|
|
4111
|
-
const
|
|
4113
|
+
const selectFormSubmissionsOfComponent = restructureCreateSelectorWithArgs(
|
|
4112
4114
|
createSelector(
|
|
4113
|
-
[selectFormSubmissions, (_state,
|
|
4114
|
-
(submissions,
|
|
4115
|
+
[selectFormSubmissions, (_state, componentId) => componentId],
|
|
4116
|
+
(submissions, componentId) => {
|
|
4115
4117
|
return submissions.filter((submission) => {
|
|
4116
|
-
return submission.
|
|
4118
|
+
return submission.component === componentId;
|
|
4117
4119
|
});
|
|
4118
4120
|
}
|
|
4119
4121
|
)
|
|
4120
4122
|
);
|
|
4121
|
-
const
|
|
4122
|
-
[selectFormSubmissionsMapping,
|
|
4123
|
-
(submissions,
|
|
4123
|
+
const selectFormSubmissionsByComponents = createSelector(
|
|
4124
|
+
[selectFormSubmissionsMapping, selectComponentsMapping],
|
|
4125
|
+
(submissions, components) => {
|
|
4124
4126
|
var _a2;
|
|
4125
|
-
const
|
|
4126
|
-
for (const
|
|
4127
|
-
|
|
4127
|
+
const componentSubmissionMapping = {};
|
|
4128
|
+
for (const componentId in components) {
|
|
4129
|
+
componentSubmissionMapping[componentId] = [];
|
|
4128
4130
|
}
|
|
4129
4131
|
for (const submissionId in submissions) {
|
|
4130
4132
|
const submission = submissions[submissionId];
|
|
4131
|
-
if (submission.
|
|
4132
|
-
(_a2 =
|
|
4133
|
+
if (submission.component) {
|
|
4134
|
+
(_a2 = componentSubmissionMapping[submission.component]) == null ? void 0 : _a2.push(submission);
|
|
4133
4135
|
}
|
|
4134
4136
|
}
|
|
4135
|
-
return
|
|
4137
|
+
return componentSubmissionMapping;
|
|
4136
4138
|
}
|
|
4137
4139
|
);
|
|
4138
4140
|
const selectFormSubmissionAttachmentsMapping = (state) => {
|
|
@@ -4531,7 +4533,7 @@ const versioningSlice = createSlice({
|
|
|
4531
4533
|
reducers: {}
|
|
4532
4534
|
});
|
|
4533
4535
|
const versioningReducer = versioningSlice.reducer;
|
|
4534
|
-
const
|
|
4536
|
+
const fullComponentMarkerSize = 45;
|
|
4535
4537
|
const DEFAULT_ISSUE_STATUS = IssueStatus.BACKLOG;
|
|
4536
4538
|
const DEFAULT_ISSUE_PRIORITY = IssuePriority.MEDIUM;
|
|
4537
4539
|
const OUTBOX_RETRY_DELAY = 5e3;
|
|
@@ -4549,10 +4551,10 @@ const overmapReducers = {
|
|
|
4549
4551
|
fileReducer,
|
|
4550
4552
|
authReducer,
|
|
4551
4553
|
categoryReducer,
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4554
|
+
componentReducer,
|
|
4555
|
+
componentStageCompletionReducer,
|
|
4556
|
+
componentStageReducer,
|
|
4557
|
+
componentTypeReducer,
|
|
4556
4558
|
issueReducer,
|
|
4557
4559
|
issueTypeReducer,
|
|
4558
4560
|
mapReducer,
|
|
@@ -4994,7 +4996,11 @@ function discard(reason, action, retries = 0) {
|
|
|
4994
4996
|
return false;
|
|
4995
4997
|
}
|
|
4996
4998
|
function peek(_array, _item, _context) {
|
|
4997
|
-
|
|
4999
|
+
const ret = _getOutboxCoordinator().peek();
|
|
5000
|
+
if (!ret) {
|
|
5001
|
+
throw new Error(`Peek returned ${ret}`);
|
|
5002
|
+
}
|
|
5003
|
+
return ret;
|
|
4998
5004
|
}
|
|
4999
5005
|
function retry(_action, _retries) {
|
|
5000
5006
|
getClientStore().dispatch(_setLatestRetryTime((/* @__PURE__ */ new Date()).getTime()));
|
|
@@ -5002,94 +5008,6 @@ function retry(_action, _retries) {
|
|
|
5002
5008
|
}
|
|
5003
5009
|
const useAppDispatch = () => useDispatch();
|
|
5004
5010
|
const useAppSelector = useSelector;
|
|
5005
|
-
class BaseApiService {
|
|
5006
|
-
constructor(sdk) {
|
|
5007
|
-
__publicField(this, "client");
|
|
5008
|
-
this.client = sdk;
|
|
5009
|
-
}
|
|
5010
|
-
/**
|
|
5011
|
-
* Enqueues an API request to the offline outbox.
|
|
5012
|
-
* @param requestDetails An SDKRequest object containing the details of the request.
|
|
5013
|
-
* @protected
|
|
5014
|
-
*/
|
|
5015
|
-
async enqueueRequest(requestDetails) {
|
|
5016
|
-
return this._enqueueRequest(requestDetails).then((result) => {
|
|
5017
|
-
if (result instanceof APIError) {
|
|
5018
|
-
throw result;
|
|
5019
|
-
}
|
|
5020
|
-
return result;
|
|
5021
|
-
});
|
|
5022
|
-
}
|
|
5023
|
-
/**
|
|
5024
|
-
* Enqueues an API request to the Redux Offline outbox
|
|
5025
|
-
* @protected
|
|
5026
|
-
*/
|
|
5027
|
-
_enqueueRequest(requestDetails) {
|
|
5028
|
-
const promise = new DeferredPromise();
|
|
5029
|
-
const requestDetailsWithBaseUrl = { ...requestDetails, BASE_URL: this.client.API_URL };
|
|
5030
|
-
const { store } = this.client;
|
|
5031
|
-
if (requestDetails.immediate) {
|
|
5032
|
-
const requestWithUuid = {
|
|
5033
|
-
...requestDetailsWithBaseUrl,
|
|
5034
|
-
uuid: requestDetails.uuid ?? v4()
|
|
5035
|
-
};
|
|
5036
|
-
const fullOfflineAction = {
|
|
5037
|
-
payload: requestWithUuid,
|
|
5038
|
-
type: "",
|
|
5039
|
-
meta: {
|
|
5040
|
-
offline: {
|
|
5041
|
-
effect: {
|
|
5042
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5043
|
-
request: requestWithUuid,
|
|
5044
|
-
BASE_URL: this.client.API_URL
|
|
5045
|
-
}
|
|
5046
|
-
}
|
|
5047
|
-
}
|
|
5048
|
-
};
|
|
5049
|
-
performRequest(fullOfflineAction, this.client).then((result) => {
|
|
5050
|
-
promise.resolve(result.body);
|
|
5051
|
-
}).catch((error2) => {
|
|
5052
|
-
discard(error2, fullOfflineAction);
|
|
5053
|
-
promise.reject(error2);
|
|
5054
|
-
});
|
|
5055
|
-
} else {
|
|
5056
|
-
const innerPromise = store.dispatch(
|
|
5057
|
-
enqueueRequest(requestDetailsWithBaseUrl)
|
|
5058
|
-
);
|
|
5059
|
-
const successOrUndefinedHandler = (response) => {
|
|
5060
|
-
if (response) {
|
|
5061
|
-
promise.resolve(response.body);
|
|
5062
|
-
} else {
|
|
5063
|
-
const error2 = new APIError({
|
|
5064
|
-
message: "Could not get a response from the server.",
|
|
5065
|
-
response,
|
|
5066
|
-
discard: true
|
|
5067
|
-
});
|
|
5068
|
-
promise.reject(error2);
|
|
5069
|
-
}
|
|
5070
|
-
};
|
|
5071
|
-
const errorHandler = (error2) => {
|
|
5072
|
-
if (error2 instanceof APIError) {
|
|
5073
|
-
error2.options.discard = true;
|
|
5074
|
-
} else {
|
|
5075
|
-
console.error(
|
|
5076
|
-
"Received an unexpected error while processing a request:",
|
|
5077
|
-
error2,
|
|
5078
|
-
"\nConverting error to APIError and discarding."
|
|
5079
|
-
);
|
|
5080
|
-
error2 = new APIError({
|
|
5081
|
-
message: "An error occurred while processing the request.",
|
|
5082
|
-
innerError: error2,
|
|
5083
|
-
discard: true
|
|
5084
|
-
});
|
|
5085
|
-
}
|
|
5086
|
-
promise.reject(error2);
|
|
5087
|
-
};
|
|
5088
|
-
innerPromise.then(successOrUndefinedHandler, errorHandler);
|
|
5089
|
-
}
|
|
5090
|
-
return promise;
|
|
5091
|
-
}
|
|
5092
|
-
}
|
|
5093
5011
|
const EXPIRING_SOON_THRESHOLD = 1800;
|
|
5094
5012
|
function parseTokens(response) {
|
|
5095
5013
|
if (!response.access)
|
|
@@ -5116,7 +5034,7 @@ class AuthService extends BaseApiService {
|
|
|
5116
5034
|
*/
|
|
5117
5035
|
__publicField(this, "_getTokenPair", (credentials, logoutOnFailure = true) => {
|
|
5118
5036
|
const uuid = v4();
|
|
5119
|
-
const responsePromise = this.enqueueRequest({
|
|
5037
|
+
const responsePromise = this.client.enqueueRequest({
|
|
5120
5038
|
uuid,
|
|
5121
5039
|
description: "Get token pair",
|
|
5122
5040
|
method: HttpMethod.POST,
|
|
@@ -5141,7 +5059,7 @@ class AuthService extends BaseApiService {
|
|
|
5141
5059
|
* @returns {Promise<TokenPair>} The new access and refresh tokens
|
|
5142
5060
|
*/
|
|
5143
5061
|
__publicField(this, "_getRenewedTokens", async (refreshToken) => {
|
|
5144
|
-
const promise = this.enqueueRequest({
|
|
5062
|
+
const promise = this.client.enqueueRequest({
|
|
5145
5063
|
description: "Get renewed tokens",
|
|
5146
5064
|
method: HttpMethod.POST,
|
|
5147
5065
|
url: "/api/token/refresh/",
|
|
@@ -5254,7 +5172,7 @@ class AuthService extends BaseApiService {
|
|
|
5254
5172
|
* Register a new user
|
|
5255
5173
|
*/
|
|
5256
5174
|
register(payload) {
|
|
5257
|
-
return this.enqueueRequest({
|
|
5175
|
+
return this.client.enqueueRequest({
|
|
5258
5176
|
description: "Register",
|
|
5259
5177
|
method: HttpMethod.POST,
|
|
5260
5178
|
url: "/authentication/users/register/",
|
|
@@ -5265,7 +5183,7 @@ class AuthService extends BaseApiService {
|
|
|
5265
5183
|
});
|
|
5266
5184
|
}
|
|
5267
5185
|
async resetPassword(email) {
|
|
5268
|
-
return this.enqueueRequest({
|
|
5186
|
+
return this.client.enqueueRequest({
|
|
5269
5187
|
description: "Reset password",
|
|
5270
5188
|
method: HttpMethod.PATCH,
|
|
5271
5189
|
url: "/authentication/users/reset-password/",
|
|
@@ -5302,7 +5220,7 @@ class AuthService extends BaseApiService {
|
|
|
5302
5220
|
const { store } = this.client;
|
|
5303
5221
|
const [fileProps] = await this.client.files.uploadFileToS3(hash);
|
|
5304
5222
|
store.dispatch(setProfilePicture({ file: `/files/${fileProps.file}`, file_sha1: hash }));
|
|
5305
|
-
return this.enqueueRequest({
|
|
5223
|
+
return this.client.enqueueRequest({
|
|
5306
5224
|
description: "Replace profile picture",
|
|
5307
5225
|
method: HttpMethod.PATCH,
|
|
5308
5226
|
url: "/authentication/users/profile-details/",
|
|
@@ -5313,7 +5231,7 @@ class AuthService extends BaseApiService {
|
|
|
5313
5231
|
}
|
|
5314
5232
|
async addFavouriteProjectId(projectId) {
|
|
5315
5233
|
this.client.store.dispatch(addFavouriteProjectId(projectId));
|
|
5316
|
-
return this.enqueueRequest({
|
|
5234
|
+
return this.client.enqueueRequest({
|
|
5317
5235
|
description: "Add favourite project",
|
|
5318
5236
|
method: HttpMethod.POST,
|
|
5319
5237
|
url: `/authentication/users/favourite-project/${projectId}/`,
|
|
@@ -5323,7 +5241,7 @@ class AuthService extends BaseApiService {
|
|
|
5323
5241
|
}
|
|
5324
5242
|
async removeFavouriteProjectId(projectId) {
|
|
5325
5243
|
this.client.store.dispatch(removeFavouriteProjectId(projectId));
|
|
5326
|
-
return this.enqueueRequest({
|
|
5244
|
+
return this.client.enqueueRequest({
|
|
5327
5245
|
description: "Add favourite project",
|
|
5328
5246
|
method: HttpMethod.POST,
|
|
5329
5247
|
url: `/authentication/users/unfavourite-project/${projectId}/`,
|
|
@@ -5336,7 +5254,7 @@ class AuthService extends BaseApiService {
|
|
|
5336
5254
|
const currentStep = this.client.store.getState().userReducer.currentUser.profile.tour_step;
|
|
5337
5255
|
if (currentStep === stepIndex)
|
|
5338
5256
|
return Promise.resolve(void 0);
|
|
5339
|
-
return this.enqueueRequest({
|
|
5257
|
+
return this.client.enqueueRequest({
|
|
5340
5258
|
description: "Set tour step",
|
|
5341
5259
|
method: HttpMethod.PATCH,
|
|
5342
5260
|
url: "/authentication/users/profile-details/",
|
|
@@ -5348,7 +5266,7 @@ class AuthService extends BaseApiService {
|
|
|
5348
5266
|
});
|
|
5349
5267
|
}
|
|
5350
5268
|
async joinApplication(projectInviteId, verification_code, username, password) {
|
|
5351
|
-
return this.enqueueRequest({
|
|
5269
|
+
return this.client.enqueueRequest({
|
|
5352
5270
|
description: "Join application",
|
|
5353
5271
|
method: HttpMethod.PATCH,
|
|
5354
5272
|
url: `/authentication/join-app/${projectInviteId}/${verification_code}/`,
|
|
@@ -5367,7 +5285,7 @@ class CategoryService extends BaseApiService {
|
|
|
5367
5285
|
const offlineCategory = offline(category);
|
|
5368
5286
|
const categoryWithWorkspace = { ...offlineCategory, workspace: workspaceId };
|
|
5369
5287
|
this.client.store.dispatch(addCategory(categoryWithWorkspace));
|
|
5370
|
-
const promise = this.enqueueRequest({
|
|
5288
|
+
const promise = this.client.enqueueRequest({
|
|
5371
5289
|
description: "Create Category",
|
|
5372
5290
|
method: HttpMethod.POST,
|
|
5373
5291
|
url: "/categories/",
|
|
@@ -5381,7 +5299,7 @@ class CategoryService extends BaseApiService {
|
|
|
5381
5299
|
return [categoryWithWorkspace, promise];
|
|
5382
5300
|
}
|
|
5383
5301
|
fetchAll(projectId) {
|
|
5384
|
-
const promise = this.enqueueRequest({
|
|
5302
|
+
const promise = this.client.enqueueRequest({
|
|
5385
5303
|
description: "Get categories",
|
|
5386
5304
|
method: HttpMethod.GET,
|
|
5387
5305
|
url: `/projects/${projectId}/categories/`,
|
|
@@ -5398,7 +5316,7 @@ class CategoryService extends BaseApiService {
|
|
|
5398
5316
|
}
|
|
5399
5317
|
this.client.store.dispatch(patchCategory(category));
|
|
5400
5318
|
const optimisticCategory = { ...existingCategory, ...category };
|
|
5401
|
-
const promise = this.enqueueRequest({
|
|
5319
|
+
const promise = this.client.enqueueRequest({
|
|
5402
5320
|
description: "Edit Category",
|
|
5403
5321
|
method: HttpMethod.PATCH,
|
|
5404
5322
|
url: `/categories/${category.offline_id}/`,
|
|
@@ -5413,7 +5331,7 @@ class CategoryService extends BaseApiService {
|
|
|
5413
5331
|
}
|
|
5414
5332
|
remove(category, workspaceId) {
|
|
5415
5333
|
this.client.store.dispatch(removeCategory(category.offline_id));
|
|
5416
|
-
return this.enqueueRequest({
|
|
5334
|
+
return this.client.enqueueRequest({
|
|
5417
5335
|
description: "Delete Category",
|
|
5418
5336
|
method: HttpMethod.DELETE,
|
|
5419
5337
|
url: `/categories/${category.offline_id}/`,
|
|
@@ -5454,108 +5372,110 @@ class CategoryService extends BaseApiService {
|
|
|
5454
5372
|
store.dispatch(setCategories(result));
|
|
5455
5373
|
}
|
|
5456
5374
|
}
|
|
5457
|
-
class
|
|
5375
|
+
class ComponentService extends BaseApiService {
|
|
5458
5376
|
// Basic CRUD functions
|
|
5459
|
-
add(
|
|
5460
|
-
const
|
|
5461
|
-
this.client.store.dispatch(
|
|
5462
|
-
const promise = this.enqueueRequest({
|
|
5463
|
-
description: "Create
|
|
5377
|
+
add(component, workspaceId) {
|
|
5378
|
+
const offlineComponent = offline(component);
|
|
5379
|
+
this.client.store.dispatch(addComponent(offlineComponent));
|
|
5380
|
+
const promise = this.client.enqueueRequest({
|
|
5381
|
+
description: "Create Component",
|
|
5464
5382
|
method: HttpMethod.POST,
|
|
5465
|
-
url: `/
|
|
5383
|
+
url: `/components/types/${offlineComponent.component_type}/add-components/`,
|
|
5466
5384
|
queryParams: {
|
|
5467
5385
|
workspace_id: workspaceId.toString()
|
|
5468
5386
|
},
|
|
5469
|
-
payload: {
|
|
5387
|
+
payload: { components: [offlineComponent] },
|
|
5470
5388
|
blockers: [],
|
|
5471
|
-
blocks: [
|
|
5389
|
+
blocks: [offlineComponent.offline_id]
|
|
5472
5390
|
});
|
|
5473
|
-
return [
|
|
5391
|
+
return [offlineComponent, promise];
|
|
5474
5392
|
}
|
|
5475
|
-
update(
|
|
5476
|
-
this.client.store.dispatch(
|
|
5477
|
-
const promise = this.enqueueRequest({
|
|
5478
|
-
description: "Edit
|
|
5393
|
+
update(component, workspaceId) {
|
|
5394
|
+
this.client.store.dispatch(updateComponent(component));
|
|
5395
|
+
const promise = this.client.enqueueRequest({
|
|
5396
|
+
description: "Edit component",
|
|
5479
5397
|
method: HttpMethod.PATCH,
|
|
5480
|
-
url: `/
|
|
5398
|
+
url: `/components/${component.offline_id}/`,
|
|
5481
5399
|
queryParams: {
|
|
5482
5400
|
workspace_id: workspaceId.toString()
|
|
5483
5401
|
},
|
|
5484
|
-
payload:
|
|
5485
|
-
blockers: [
|
|
5486
|
-
blocks: [
|
|
5402
|
+
payload: component,
|
|
5403
|
+
blockers: [component.offline_id],
|
|
5404
|
+
blocks: [component.offline_id]
|
|
5487
5405
|
});
|
|
5488
|
-
return [
|
|
5406
|
+
return [component, promise];
|
|
5489
5407
|
}
|
|
5490
|
-
async remove(
|
|
5408
|
+
async remove(id) {
|
|
5491
5409
|
const { store } = this.client;
|
|
5492
|
-
const
|
|
5493
|
-
if (!
|
|
5494
|
-
throw new Error(`No
|
|
5495
|
-
const
|
|
5496
|
-
store.dispatch(
|
|
5497
|
-
if (
|
|
5498
|
-
const
|
|
5499
|
-
store.dispatch(
|
|
5500
|
-
}
|
|
5501
|
-
return this.enqueueRequest({
|
|
5502
|
-
description: "Delete
|
|
5410
|
+
const backupComponent = selectComponent(id)(store.getState());
|
|
5411
|
+
if (!backupComponent)
|
|
5412
|
+
throw new Error(`No component with id ${id} found in the store`);
|
|
5413
|
+
const attachmentsOfComponent = selectAttachmentsOfComponent(id)(store.getState());
|
|
5414
|
+
store.dispatch(removeComponent(id));
|
|
5415
|
+
if (attachmentsOfComponent.length > 0) {
|
|
5416
|
+
const attachmentsOfComponentIds = attachmentsOfComponent.map(({ offline_id }) => offline_id);
|
|
5417
|
+
store.dispatch(removeComponentAttachments(attachmentsOfComponentIds));
|
|
5418
|
+
}
|
|
5419
|
+
return this.client.enqueueRequest({
|
|
5420
|
+
description: "Delete issue",
|
|
5503
5421
|
method: HttpMethod.DELETE,
|
|
5504
|
-
url: `/
|
|
5505
|
-
blockers: [
|
|
5422
|
+
url: `/components/${id}/`,
|
|
5423
|
+
blockers: [id],
|
|
5506
5424
|
blocks: []
|
|
5507
5425
|
}).catch((err) => {
|
|
5508
|
-
store.dispatch(
|
|
5509
|
-
store.dispatch(
|
|
5426
|
+
store.dispatch(addComponent(backupComponent));
|
|
5427
|
+
store.dispatch(addComponentAttachments(attachmentsOfComponent));
|
|
5510
5428
|
throw err;
|
|
5511
5429
|
});
|
|
5512
5430
|
}
|
|
5513
|
-
async
|
|
5431
|
+
async deleteAllByComponentType(componentTypeId) {
|
|
5432
|
+
const clientStore2 = this.client.store;
|
|
5433
|
+
const allComponentsOfType = selectComponentsFromComponentType(componentTypeId)(clientStore2.getState());
|
|
5434
|
+
const affectedComponentIds = (allComponentsOfType || []).map((c) => c.offline_id);
|
|
5435
|
+
const affectedOfflineIds = [componentTypeId, ...affectedComponentIds];
|
|
5514
5436
|
const { store } = this.client;
|
|
5515
5437
|
const state = store.getState();
|
|
5516
|
-
const
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
return this.enqueueRequest({
|
|
5521
|
-
description: "Delete all assets of asset type",
|
|
5438
|
+
const componentsOfThisType = selectComponentsByType(componentTypeId)(state);
|
|
5439
|
+
store.dispatch(removeAllComponentsOfType(componentTypeId));
|
|
5440
|
+
return this.client.enqueueRequest({
|
|
5441
|
+
description: "Batch delete components by component type",
|
|
5522
5442
|
method: HttpMethod.DELETE,
|
|
5523
|
-
url: `/
|
|
5443
|
+
url: `/components/types/${componentTypeId}/delete-all-of-type/`,
|
|
5524
5444
|
blockers: affectedOfflineIds,
|
|
5525
5445
|
blocks: affectedOfflineIds
|
|
5526
5446
|
}).catch((err) => {
|
|
5527
|
-
if (
|
|
5528
|
-
store.dispatch(
|
|
5447
|
+
if (componentsOfThisType) {
|
|
5448
|
+
store.dispatch(addComponentsInBatches(componentsOfThisType));
|
|
5529
5449
|
}
|
|
5530
5450
|
throw err;
|
|
5531
5451
|
});
|
|
5532
5452
|
}
|
|
5533
|
-
async addBatch(
|
|
5534
|
-
const
|
|
5535
|
-
return { ...offline(
|
|
5453
|
+
async addBatch(componentsToCreate, workspaceId, componentTypeId) {
|
|
5454
|
+
const fullComponents = componentsToCreate.map((component) => {
|
|
5455
|
+
return { ...offline(component), submitted_at: (/* @__PURE__ */ new Date()).toISOString() };
|
|
5536
5456
|
});
|
|
5537
5457
|
const { store } = this.client;
|
|
5538
|
-
store.dispatch(
|
|
5539
|
-
const promise = this.enqueueRequest({
|
|
5540
|
-
description: "Batch create
|
|
5458
|
+
store.dispatch(addComponentsInBatches(fullComponents));
|
|
5459
|
+
const promise = this.client.enqueueRequest({
|
|
5460
|
+
description: "Batch create components",
|
|
5541
5461
|
method: HttpMethod.POST,
|
|
5542
|
-
url: `/
|
|
5462
|
+
url: `/components/types/${componentTypeId}/add-components/`,
|
|
5543
5463
|
queryParams: {
|
|
5544
5464
|
workspace_id: workspaceId.toString()
|
|
5545
5465
|
},
|
|
5546
5466
|
payload: {
|
|
5547
|
-
|
|
5467
|
+
components: fullComponents
|
|
5548
5468
|
},
|
|
5549
|
-
blockers: [
|
|
5550
|
-
blocks:
|
|
5469
|
+
blockers: [componentTypeId],
|
|
5470
|
+
blocks: fullComponents.map((c) => c.offline_id)
|
|
5551
5471
|
});
|
|
5552
5472
|
void promise.then((result) => {
|
|
5553
|
-
for (const
|
|
5554
|
-
store.dispatch(
|
|
5473
|
+
for (const component of Object.values(result)) {
|
|
5474
|
+
store.dispatch(updateComponent(component));
|
|
5555
5475
|
}
|
|
5556
5476
|
}).catch((e) => {
|
|
5557
|
-
for (const
|
|
5558
|
-
store.dispatch(
|
|
5477
|
+
for (const component of fullComponents) {
|
|
5478
|
+
store.dispatch(removeComponent(component.offline_id));
|
|
5559
5479
|
}
|
|
5560
5480
|
throw e;
|
|
5561
5481
|
});
|
|
@@ -5563,125 +5483,129 @@ class AssetService extends BaseApiService {
|
|
|
5563
5483
|
}
|
|
5564
5484
|
async refreshStore() {
|
|
5565
5485
|
const { store } = this.client;
|
|
5566
|
-
const result = await this.enqueueRequest({
|
|
5567
|
-
description: "Get
|
|
5486
|
+
const result = await this.client.enqueueRequest({
|
|
5487
|
+
description: "Get components",
|
|
5568
5488
|
method: HttpMethod.GET,
|
|
5569
|
-
url: `/projects/${store.getState().projectReducer.activeProjectId}/
|
|
5489
|
+
url: `/projects/${store.getState().projectReducer.activeProjectId}/components/`,
|
|
5570
5490
|
blockers: [],
|
|
5571
5491
|
blocks: []
|
|
5572
5492
|
});
|
|
5573
|
-
store.dispatch(
|
|
5493
|
+
store.dispatch(setComponents(result));
|
|
5574
5494
|
}
|
|
5575
5495
|
}
|
|
5576
|
-
class
|
|
5577
|
-
add(
|
|
5496
|
+
class ComponentStageCompletionService extends BaseApiService {
|
|
5497
|
+
add(componentId, stageId) {
|
|
5578
5498
|
var _a2;
|
|
5579
5499
|
const { store } = this.client;
|
|
5580
|
-
const
|
|
5581
|
-
if (!
|
|
5582
|
-
throw new Error(`
|
|
5500
|
+
const componentType = (_a2 = store.getState().componentReducer.components[componentId]) == null ? void 0 : _a2.component_type;
|
|
5501
|
+
if (!componentType) {
|
|
5502
|
+
throw new Error(`Component ${componentId} not found`);
|
|
5583
5503
|
}
|
|
5584
|
-
const
|
|
5585
|
-
|
|
5504
|
+
const offlineCompletion = offline({
|
|
5505
|
+
component: componentId,
|
|
5586
5506
|
stage: stageId
|
|
5587
5507
|
});
|
|
5588
|
-
store.dispatch(addStageCompletion(
|
|
5589
|
-
const promise = this.enqueueRequest({
|
|
5590
|
-
description: "
|
|
5508
|
+
store.dispatch(addStageCompletion(offlineCompletion));
|
|
5509
|
+
const promise = this.client.enqueueRequest({
|
|
5510
|
+
description: "Mark stage as completed",
|
|
5591
5511
|
method: HttpMethod.POST,
|
|
5592
|
-
url: `/
|
|
5512
|
+
url: `/components/types/${componentType}/complete-stages/`,
|
|
5593
5513
|
// TODO: Add submitted_at to model
|
|
5594
|
-
payload: { completions: [{ ...
|
|
5595
|
-
blockers: [
|
|
5596
|
-
blocks: [
|
|
5514
|
+
payload: { completions: [{ ...offlineCompletion, submitted_at: (/* @__PURE__ */ new Date()).getTime() / 1e3 }] },
|
|
5515
|
+
blockers: [componentId, stageId],
|
|
5516
|
+
blocks: [offlineCompletion.offline_id]
|
|
5597
5517
|
});
|
|
5598
|
-
return [
|
|
5518
|
+
return [offlineCompletion, promise];
|
|
5599
5519
|
}
|
|
5600
5520
|
async refreshStore() {
|
|
5601
5521
|
const { store } = this.client;
|
|
5602
|
-
const result = await this.enqueueRequest({
|
|
5603
|
-
description: "Get
|
|
5522
|
+
const result = await this.client.enqueueRequest({
|
|
5523
|
+
description: "Get completed stages",
|
|
5604
5524
|
method: HttpMethod.GET,
|
|
5605
|
-
url: `/projects/${store.getState().projectReducer.activeProjectId}/
|
|
5525
|
+
url: `/projects/${store.getState().projectReducer.activeProjectId}/component-stage-completions/`,
|
|
5606
5526
|
blockers: [],
|
|
5607
5527
|
blocks: []
|
|
5608
5528
|
});
|
|
5609
5529
|
store.dispatch(addStageCompletions(result));
|
|
5610
5530
|
}
|
|
5611
5531
|
/**
|
|
5612
|
-
* Creates a collection of
|
|
5613
|
-
*
|
|
5614
|
-
* @param
|
|
5615
|
-
* stages for one
|
|
5532
|
+
* Creates a collection of ComponentStageCompletions, marking the referenced stages as completed for the referenced
|
|
5533
|
+
* components. It's REQUIRED that all components referenced all have the SAME component type.
|
|
5534
|
+
* @param componentTypeId The ID of the component type for which we are completing stages (we can only complete
|
|
5535
|
+
* stages for one component type at a time)
|
|
5616
5536
|
* @param stageCompletions
|
|
5617
5537
|
*/
|
|
5618
|
-
async bulkAdd(
|
|
5619
|
-
const
|
|
5538
|
+
async bulkAdd(componentTypeId, stageCompletions) {
|
|
5539
|
+
const offlineStagesCompletions = stageCompletions.map((completion) => {
|
|
5620
5540
|
return offline(completion);
|
|
5621
5541
|
});
|
|
5622
5542
|
const asMapping = {};
|
|
5623
5543
|
for (const completion of stageCompletions) {
|
|
5624
|
-
const stageToCompletionDateMapping = asMapping[completion.
|
|
5544
|
+
const stageToCompletionDateMapping = asMapping[completion.component] || {};
|
|
5625
5545
|
stageToCompletionDateMapping[completion.stage] = (/* @__PURE__ */ new Date()).toISOString();
|
|
5626
|
-
asMapping[completion.
|
|
5546
|
+
asMapping[completion.component] = stageToCompletionDateMapping;
|
|
5627
5547
|
}
|
|
5628
5548
|
this.client.store.dispatch(addStageCompletions(asMapping));
|
|
5629
|
-
await this.enqueueRequest({
|
|
5630
|
-
description: "
|
|
5549
|
+
await this.client.enqueueRequest({
|
|
5550
|
+
description: "Mark multiple stage as completed",
|
|
5631
5551
|
method: HttpMethod.POST,
|
|
5632
|
-
url: `/
|
|
5552
|
+
url: `/components/types/${componentTypeId}/complete-stages/`,
|
|
5633
5553
|
payload: {
|
|
5634
|
-
completions:
|
|
5554
|
+
completions: offlineStagesCompletions
|
|
5635
5555
|
},
|
|
5636
|
-
blockers: [
|
|
5637
|
-
|
|
5556
|
+
blockers: [
|
|
5557
|
+
componentTypeId,
|
|
5558
|
+
...stageCompletions.map((c) => c.component),
|
|
5559
|
+
...stageCompletions.map((c) => c.stage)
|
|
5560
|
+
],
|
|
5561
|
+
blocks: offlineStagesCompletions.map((c) => c.offline_id)
|
|
5638
5562
|
});
|
|
5639
5563
|
}
|
|
5640
|
-
bulkDelete(stageId,
|
|
5641
|
-
const
|
|
5564
|
+
bulkDelete(stageId, componentIds) {
|
|
5565
|
+
const completionsToRemove = componentIds.map((componentId) => {
|
|
5642
5566
|
return {
|
|
5643
|
-
|
|
5567
|
+
component: componentId,
|
|
5644
5568
|
stage: stageId
|
|
5645
5569
|
};
|
|
5646
5570
|
});
|
|
5647
|
-
this.client.store.dispatch(removeStageCompletions(
|
|
5648
|
-
return this.enqueueRequest({
|
|
5649
|
-
description: `Undo stage for ${
|
|
5571
|
+
this.client.store.dispatch(removeStageCompletions(completionsToRemove));
|
|
5572
|
+
return this.client.enqueueRequest({
|
|
5573
|
+
description: `Undo stage for ${componentIds.length} component(s)`,
|
|
5650
5574
|
// TODO: Rename to setCompletedStages
|
|
5651
5575
|
method: HttpMethod.DELETE,
|
|
5652
|
-
url: `/
|
|
5576
|
+
url: `/components/stages/${stageId}/undo-stages/`,
|
|
5653
5577
|
payload: {
|
|
5654
|
-
|
|
5578
|
+
components: componentIds
|
|
5655
5579
|
},
|
|
5656
|
-
blockers: [stageId, ...
|
|
5580
|
+
blockers: [stageId, ...componentIds],
|
|
5657
5581
|
blocks: []
|
|
5658
5582
|
});
|
|
5659
5583
|
}
|
|
5660
5584
|
}
|
|
5661
|
-
class
|
|
5662
|
-
async bulkCreateStages(stagesToSubmit,
|
|
5585
|
+
class ComponentStageService extends BaseApiService {
|
|
5586
|
+
async bulkCreateStages(stagesToSubmit, componentTypeId, workspaceId) {
|
|
5663
5587
|
const payload = stagesToSubmit.map((stage) => {
|
|
5664
5588
|
return offline(stage);
|
|
5665
5589
|
});
|
|
5666
5590
|
const fullStages = payload.map((stage) => {
|
|
5667
|
-
return { ...stage,
|
|
5591
|
+
return { ...stage, component_type: componentTypeId };
|
|
5668
5592
|
});
|
|
5669
5593
|
this.client.store.dispatch(addStages(fullStages));
|
|
5670
|
-
return this.enqueueRequest({
|
|
5671
|
-
description: "Add
|
|
5594
|
+
return this.client.enqueueRequest({
|
|
5595
|
+
description: "Add component stages",
|
|
5672
5596
|
method: HttpMethod.POST,
|
|
5673
|
-
url: `/
|
|
5597
|
+
url: `/components/types/${componentTypeId}/add-stages/`,
|
|
5674
5598
|
payload: {
|
|
5675
5599
|
stages: payload
|
|
5676
5600
|
},
|
|
5677
5601
|
queryParams: {
|
|
5678
5602
|
workspace_id: workspaceId.toString()
|
|
5679
5603
|
},
|
|
5680
|
-
blockers: [
|
|
5604
|
+
blockers: [componentTypeId, workspaceId],
|
|
5681
5605
|
blocks: payload.map(({ offline_id }) => offline_id)
|
|
5682
5606
|
});
|
|
5683
5607
|
}
|
|
5684
|
-
async bulkUpdateStages(stagesToUpdate,
|
|
5608
|
+
async bulkUpdateStages(stagesToUpdate, componentTypeId) {
|
|
5685
5609
|
const store = this.client.store;
|
|
5686
5610
|
const state = store.getState();
|
|
5687
5611
|
const prevStages = selectStagesFromStageIds(
|
|
@@ -5691,14 +5615,14 @@ class AssetStageService extends BaseApiService {
|
|
|
5691
5615
|
throw new Error("Could not find the desired stages to update within the store");
|
|
5692
5616
|
}
|
|
5693
5617
|
store.dispatch(updateStages(stagesToUpdate));
|
|
5694
|
-
return this.enqueueRequest({
|
|
5695
|
-
description: "Edit
|
|
5618
|
+
return this.client.enqueueRequest({
|
|
5619
|
+
description: "Edit component stages",
|
|
5696
5620
|
method: HttpMethod.PATCH,
|
|
5697
|
-
url: `/
|
|
5621
|
+
url: `/components/types/${componentTypeId}/bulk-update-stages/`,
|
|
5698
5622
|
payload: {
|
|
5699
5623
|
stages: stagesToUpdate
|
|
5700
5624
|
},
|
|
5701
|
-
blockers: [
|
|
5625
|
+
blockers: [componentTypeId],
|
|
5702
5626
|
blocks: stagesToUpdate.map(({ offline_id }) => offline_id)
|
|
5703
5627
|
}).catch((e) => {
|
|
5704
5628
|
store.dispatch(updateStages(prevStages));
|
|
@@ -5707,10 +5631,10 @@ class AssetStageService extends BaseApiService {
|
|
|
5707
5631
|
}
|
|
5708
5632
|
async bulkDelete(idsToDelete) {
|
|
5709
5633
|
this.client.store.dispatch(removeStages(idsToDelete));
|
|
5710
|
-
return this.enqueueRequest({
|
|
5711
|
-
description: "Delete
|
|
5634
|
+
return this.client.enqueueRequest({
|
|
5635
|
+
description: "Delete component stages",
|
|
5712
5636
|
method: HttpMethod.DELETE,
|
|
5713
|
-
url: "/
|
|
5637
|
+
url: "/components/stages/bulk-delete/",
|
|
5714
5638
|
payload: {
|
|
5715
5639
|
stage_ids: idsToDelete
|
|
5716
5640
|
},
|
|
@@ -5718,25 +5642,25 @@ class AssetStageService extends BaseApiService {
|
|
|
5718
5642
|
blocks: []
|
|
5719
5643
|
});
|
|
5720
5644
|
}
|
|
5721
|
-
async update(
|
|
5722
|
-
this.client.store.dispatch(addStages([
|
|
5723
|
-
return this.enqueueRequest({
|
|
5724
|
-
description: "Update
|
|
5645
|
+
async update(componentStage) {
|
|
5646
|
+
this.client.store.dispatch(addStages([componentStage]));
|
|
5647
|
+
return this.client.enqueueRequest({
|
|
5648
|
+
description: "Update component stage",
|
|
5725
5649
|
method: HttpMethod.PATCH,
|
|
5726
|
-
url: `/
|
|
5727
|
-
payload:
|
|
5728
|
-
blockers: [
|
|
5729
|
-
blocks: [
|
|
5650
|
+
url: `/components/stages/${componentStage.offline_id}/`,
|
|
5651
|
+
payload: componentStage,
|
|
5652
|
+
blockers: [componentStage.offline_id],
|
|
5653
|
+
blocks: [componentStage.offline_id]
|
|
5730
5654
|
});
|
|
5731
5655
|
}
|
|
5732
5656
|
async linkForm(stageId, formId2) {
|
|
5733
5657
|
const { store } = this.client;
|
|
5734
5658
|
store.dispatch(linkStageToForm({ stageId, formId: formId2 }));
|
|
5735
5659
|
try {
|
|
5736
|
-
await this.enqueueRequest({
|
|
5737
|
-
description: "Link
|
|
5660
|
+
await this.client.enqueueRequest({
|
|
5661
|
+
description: "Link component stage to form",
|
|
5738
5662
|
method: HttpMethod.POST,
|
|
5739
|
-
url: `/
|
|
5663
|
+
url: `/components/stages/${stageId}/associate-with-form/`,
|
|
5740
5664
|
payload: { user_form: formId2 },
|
|
5741
5665
|
blockers: [stageId, formId2],
|
|
5742
5666
|
blocks: [stageId]
|
|
@@ -5750,10 +5674,10 @@ class AssetStageService extends BaseApiService {
|
|
|
5750
5674
|
const { store } = this.client;
|
|
5751
5675
|
store.dispatch(unlinkStageToForm({ stageId }));
|
|
5752
5676
|
try {
|
|
5753
|
-
await this.enqueueRequest({
|
|
5754
|
-
description: "Unlink
|
|
5677
|
+
await this.client.enqueueRequest({
|
|
5678
|
+
description: "Unlink component stage from form",
|
|
5755
5679
|
method: HttpMethod.DELETE,
|
|
5756
|
-
url: `/
|
|
5680
|
+
url: `/components/stages/${stageId}/associate-with-form/`,
|
|
5757
5681
|
blockers: [stageId, formId2],
|
|
5758
5682
|
blocks: [stageId]
|
|
5759
5683
|
});
|
|
@@ -5764,10 +5688,10 @@ class AssetStageService extends BaseApiService {
|
|
|
5764
5688
|
}
|
|
5765
5689
|
async refreshStore() {
|
|
5766
5690
|
const { store } = this.client;
|
|
5767
|
-
const result = await this.enqueueRequest({
|
|
5768
|
-
description: "Get
|
|
5691
|
+
const result = await this.client.enqueueRequest({
|
|
5692
|
+
description: "Get component stages",
|
|
5769
5693
|
method: HttpMethod.GET,
|
|
5770
|
-
url: `/projects/${store.getState().projectReducer.activeProjectId}/
|
|
5694
|
+
url: `/projects/${store.getState().projectReducer.activeProjectId}/component-stages/`,
|
|
5771
5695
|
blockers: [],
|
|
5772
5696
|
blocks: []
|
|
5773
5697
|
});
|
|
@@ -5781,20 +5705,20 @@ const AttachmentModelMeta = {
|
|
|
5781
5705
|
deleteUrlPrefix: "/issues",
|
|
5782
5706
|
fetchUrlPostfix: "/issue-attachments"
|
|
5783
5707
|
},
|
|
5784
|
-
[AttachmentModel.
|
|
5785
|
-
name: "
|
|
5786
|
-
attachUrlPrefix: "/
|
|
5787
|
-
deleteUrlPrefix: "/
|
|
5788
|
-
fetchUrlPostfix: "/
|
|
5708
|
+
[AttachmentModel.Component]: {
|
|
5709
|
+
name: "component",
|
|
5710
|
+
attachUrlPrefix: "/components",
|
|
5711
|
+
deleteUrlPrefix: "/components",
|
|
5712
|
+
fetchUrlPostfix: "/component-attachments"
|
|
5789
5713
|
},
|
|
5790
|
-
[AttachmentModel.
|
|
5791
|
-
name: "
|
|
5792
|
-
attachUrlPrefix: "/
|
|
5793
|
-
deleteUrlPrefix: "/
|
|
5794
|
-
fetchUrlPostfix: "/
|
|
5714
|
+
[AttachmentModel.ComponentType]: {
|
|
5715
|
+
name: "component type",
|
|
5716
|
+
attachUrlPrefix: "/components/types",
|
|
5717
|
+
deleteUrlPrefix: "/components/types",
|
|
5718
|
+
fetchUrlPostfix: "/component-type-attachments"
|
|
5795
5719
|
},
|
|
5796
5720
|
[AttachmentModel.Project]: {
|
|
5797
|
-
name: "project",
|
|
5721
|
+
name: "component project",
|
|
5798
5722
|
attachUrlPrefix: "/projects",
|
|
5799
5723
|
deleteUrlPrefix: "/projects",
|
|
5800
5724
|
fetchUrlPostfix: "/attachments"
|
|
@@ -5810,8 +5734,8 @@ class BaseAttachmentService extends BaseApiService {
|
|
|
5810
5734
|
getNumberOfAttachmentsWithSha1(sha1) {
|
|
5811
5735
|
const {
|
|
5812
5736
|
issueReducer: issueReducer2,
|
|
5813
|
-
|
|
5814
|
-
|
|
5737
|
+
componentReducer: componentReducer2,
|
|
5738
|
+
componentTypeReducer: componentTypeReducer2,
|
|
5815
5739
|
documentsReducer: documentsReducer2,
|
|
5816
5740
|
projectReducer: projectReducer2,
|
|
5817
5741
|
formSubmissionReducer: formSubmissionReducer2,
|
|
@@ -5819,8 +5743,8 @@ class BaseAttachmentService extends BaseApiService {
|
|
|
5819
5743
|
} = this.client.store.getState();
|
|
5820
5744
|
const objectsWithSha1 = [].concat(
|
|
5821
5745
|
Object.values(issueReducer2.attachments),
|
|
5822
|
-
Object.values(
|
|
5823
|
-
Object.values(
|
|
5746
|
+
Object.values(componentReducer2.attachments),
|
|
5747
|
+
Object.values(componentTypeReducer2.attachments),
|
|
5824
5748
|
Object.values(documentsReducer2.attachments),
|
|
5825
5749
|
Object.values(projectReducer2.attachments),
|
|
5826
5750
|
Object.values(formRevisionReducer2.attachments),
|
|
@@ -5830,7 +5754,7 @@ class BaseAttachmentService extends BaseApiService {
|
|
|
5830
5754
|
}
|
|
5831
5755
|
processPresignedUrls(presignedUrls) {
|
|
5832
5756
|
for (const [sha1, presignedUrl] of Object.entries(presignedUrls)) {
|
|
5833
|
-
void this.enqueueRequest({
|
|
5757
|
+
void this.client.enqueueRequest({
|
|
5834
5758
|
url: presignedUrl.url,
|
|
5835
5759
|
description: "Upload file to S3",
|
|
5836
5760
|
method: HttpMethod.POST,
|
|
@@ -5850,7 +5774,7 @@ class BaseAttachmentService extends BaseApiService {
|
|
|
5850
5774
|
const { store } = this.client;
|
|
5851
5775
|
const activeProjectId = store.getState().projectReducer.activeProjectId;
|
|
5852
5776
|
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
5853
|
-
const result = await this.enqueueRequest({
|
|
5777
|
+
const result = await this.client.enqueueRequest({
|
|
5854
5778
|
description: `Get ${meta.name} attachments`,
|
|
5855
5779
|
method: HttpMethod.GET,
|
|
5856
5780
|
url: `/projects/${activeProjectId}${meta.fetchUrlPostfix}/`,
|
|
@@ -5895,7 +5819,7 @@ class BaseAttachmentService extends BaseApiService {
|
|
|
5895
5819
|
}
|
|
5896
5820
|
store.dispatch(actions.addAttachments(offlineAttachments));
|
|
5897
5821
|
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
5898
|
-
const promise = this.enqueueRequest({
|
|
5822
|
+
const promise = this.client.enqueueRequest({
|
|
5899
5823
|
description: `Attach files to ${meta.name}`,
|
|
5900
5824
|
method: HttpMethod.POST,
|
|
5901
5825
|
url: `${meta.attachUrlPrefix}/${modelId}/attach/`,
|
|
@@ -5925,7 +5849,7 @@ class BaseAttachmentService extends BaseApiService {
|
|
|
5925
5849
|
}
|
|
5926
5850
|
store.dispatch(actions.removeAttachment(attachment.offline_id));
|
|
5927
5851
|
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
5928
|
-
const promise = this.enqueueRequest({
|
|
5852
|
+
const promise = this.client.enqueueRequest({
|
|
5929
5853
|
description: "Delete attachment",
|
|
5930
5854
|
method: HttpMethod.DELETE,
|
|
5931
5855
|
url: `${meta.deleteUrlPrefix}/attachments/${attachmendId}/`,
|
|
@@ -5942,10 +5866,10 @@ class BaseAttachmentService extends BaseApiService {
|
|
|
5942
5866
|
return promise;
|
|
5943
5867
|
}
|
|
5944
5868
|
}
|
|
5945
|
-
class
|
|
5869
|
+
class ComponentAttachmentService extends BaseAttachmentService {
|
|
5946
5870
|
constructor() {
|
|
5947
5871
|
super(...arguments);
|
|
5948
|
-
__publicField(this, "attachmentModel", AttachmentModel.
|
|
5872
|
+
__publicField(this, "attachmentModel", AttachmentModel.Component);
|
|
5949
5873
|
}
|
|
5950
5874
|
buildOfflineAttachment(data) {
|
|
5951
5875
|
return offline({
|
|
@@ -5956,108 +5880,115 @@ class AssetAttachmentService extends BaseAttachmentService {
|
|
|
5956
5880
|
file_type: data.file.type,
|
|
5957
5881
|
submitted_at: data.submittedAt,
|
|
5958
5882
|
description: data.description,
|
|
5959
|
-
|
|
5883
|
+
component: data.modelId
|
|
5960
5884
|
});
|
|
5961
5885
|
}
|
|
5962
|
-
async
|
|
5963
|
-
return this.attachFiles(
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5886
|
+
async attachFilesToComponent(files, componentId) {
|
|
5887
|
+
return this.attachFiles(
|
|
5888
|
+
files,
|
|
5889
|
+
componentId,
|
|
5890
|
+
this.buildOfflineAttachment.bind(this),
|
|
5891
|
+
{
|
|
5892
|
+
addAttachments: addComponentAttachments,
|
|
5893
|
+
updateAttachments: updateComponentAttachments,
|
|
5894
|
+
removeAttachments: removeComponentAttachments
|
|
5895
|
+
}
|
|
5896
|
+
);
|
|
5968
5897
|
}
|
|
5969
|
-
|
|
5898
|
+
deleteComponentAttachment(attachmentId) {
|
|
5970
5899
|
return this.deleteAttachment(
|
|
5971
5900
|
attachmentId,
|
|
5972
5901
|
{
|
|
5973
|
-
setAttachment:
|
|
5974
|
-
removeAttachment:
|
|
5902
|
+
setAttachment: setComponentAttachment,
|
|
5903
|
+
removeAttachment: removeComponentAttachment
|
|
5975
5904
|
},
|
|
5976
5905
|
{
|
|
5977
|
-
selectAttachment:
|
|
5906
|
+
selectAttachment: selectComponentAttachment
|
|
5978
5907
|
}
|
|
5979
5908
|
);
|
|
5980
5909
|
}
|
|
5981
5910
|
async refreshStore() {
|
|
5982
5911
|
return this.getAttachments({
|
|
5983
|
-
setAttachments:
|
|
5912
|
+
setAttachments: setComponentAttachments
|
|
5984
5913
|
});
|
|
5985
5914
|
}
|
|
5986
5915
|
}
|
|
5987
|
-
class
|
|
5988
|
-
add(
|
|
5989
|
-
const
|
|
5916
|
+
class ComponentTypeService extends BaseApiService {
|
|
5917
|
+
add(componentType) {
|
|
5918
|
+
const offlineComponentType = offline(componentType);
|
|
5990
5919
|
const { store } = this.client;
|
|
5991
5920
|
const activeProjectId = store.getState().projectReducer.activeProjectId;
|
|
5992
|
-
store.dispatch(
|
|
5993
|
-
const promise = this.enqueueRequest({
|
|
5994
|
-
description: "Create
|
|
5921
|
+
store.dispatch(addComponentType(offlineComponentType));
|
|
5922
|
+
const promise = this.client.enqueueRequest({
|
|
5923
|
+
description: "Create ComponentType",
|
|
5995
5924
|
method: HttpMethod.POST,
|
|
5996
|
-
url: `/projects/${activeProjectId}/
|
|
5997
|
-
payload: { ...
|
|
5925
|
+
url: `/projects/${activeProjectId}/component-types/`,
|
|
5926
|
+
payload: { ...offlineComponentType },
|
|
5998
5927
|
blockers: [],
|
|
5999
|
-
blocks: [
|
|
5928
|
+
blocks: [offlineComponentType.offline_id]
|
|
6000
5929
|
});
|
|
6001
|
-
return [
|
|
5930
|
+
return [offlineComponentType, promise];
|
|
6002
5931
|
}
|
|
6003
|
-
update(
|
|
6004
|
-
this.client.store.dispatch(
|
|
6005
|
-
return this.enqueueRequest({
|
|
6006
|
-
description: "Update
|
|
5932
|
+
update(componentType) {
|
|
5933
|
+
this.client.store.dispatch(addComponentType(componentType));
|
|
5934
|
+
return this.client.enqueueRequest({
|
|
5935
|
+
description: "Update ComponentType",
|
|
6007
5936
|
method: HttpMethod.PATCH,
|
|
6008
|
-
url: `/
|
|
6009
|
-
payload:
|
|
6010
|
-
blockers: [
|
|
6011
|
-
blocks: [
|
|
5937
|
+
url: `/components/types/${componentType.offline_id}/`,
|
|
5938
|
+
payload: componentType,
|
|
5939
|
+
blockers: [componentType.offline_id],
|
|
5940
|
+
blocks: [componentType.offline_id]
|
|
6012
5941
|
});
|
|
6013
5942
|
}
|
|
6014
|
-
async delete(
|
|
5943
|
+
async delete(componentTypeId) {
|
|
6015
5944
|
const { store } = this.client;
|
|
6016
5945
|
const state = store.getState();
|
|
6017
|
-
const
|
|
6018
|
-
if (!
|
|
6019
|
-
throw new Error(
|
|
6020
|
-
}
|
|
6021
|
-
const
|
|
6022
|
-
const
|
|
6023
|
-
store.dispatch(
|
|
6024
|
-
if (
|
|
6025
|
-
const
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
5946
|
+
const componentType = selectComponentType(componentTypeId)(state);
|
|
5947
|
+
if (!componentType) {
|
|
5948
|
+
throw new Error("Expected componentType to exist");
|
|
5949
|
+
}
|
|
5950
|
+
const stagesOfComponentType = selectStagesFromComponentType(componentTypeId)(state) ?? [];
|
|
5951
|
+
const attachmentsOfComponentType = selectAttachmentsOfComponentType(componentTypeId)(state);
|
|
5952
|
+
store.dispatch(deleteComponentType(componentTypeId));
|
|
5953
|
+
if (stagesOfComponentType.length > 0) {
|
|
5954
|
+
const stagesOfComponentTypeIds = stagesOfComponentType.map(
|
|
5955
|
+
(componentTypeStage) => componentTypeStage.offline_id
|
|
5956
|
+
);
|
|
5957
|
+
store.dispatch(removeStages(stagesOfComponentTypeIds));
|
|
5958
|
+
}
|
|
5959
|
+
if (attachmentsOfComponentType.length > 0) {
|
|
5960
|
+
const attachmentsOfComponentTypeIds = attachmentsOfComponentType.map(({ offline_id }) => offline_id);
|
|
5961
|
+
store.dispatch(removeComponentTypeAttachments(attachmentsOfComponentTypeIds));
|
|
5962
|
+
}
|
|
5963
|
+
return this.client.enqueueRequest({
|
|
5964
|
+
description: "Delete ComponentType",
|
|
6034
5965
|
method: HttpMethod.DELETE,
|
|
6035
|
-
url: `/
|
|
6036
|
-
blockers: [
|
|
5966
|
+
url: `/components/types/${componentTypeId}/`,
|
|
5967
|
+
blockers: [componentTypeId],
|
|
6037
5968
|
blocks: []
|
|
6038
5969
|
}).catch((e) => {
|
|
6039
|
-
store.dispatch(
|
|
6040
|
-
store.dispatch(addStages(
|
|
6041
|
-
store.dispatch(
|
|
5970
|
+
store.dispatch(addComponentType(componentType));
|
|
5971
|
+
store.dispatch(addStages(stagesOfComponentType));
|
|
5972
|
+
store.dispatch(addComponentTypeAttachments(attachmentsOfComponentType));
|
|
6042
5973
|
throw e;
|
|
6043
5974
|
});
|
|
6044
5975
|
}
|
|
6045
5976
|
async refreshStore() {
|
|
6046
5977
|
const { store } = this.client;
|
|
6047
|
-
const result = await this.enqueueRequest({
|
|
6048
|
-
description: "Get
|
|
5978
|
+
const result = await this.client.enqueueRequest({
|
|
5979
|
+
description: "Get component types",
|
|
6049
5980
|
method: HttpMethod.GET,
|
|
6050
|
-
url: `/projects/${store.getState().projectReducer.activeProjectId}/
|
|
5981
|
+
url: `/projects/${store.getState().projectReducer.activeProjectId}/component-types/`,
|
|
6051
5982
|
blockers: [],
|
|
6052
5983
|
blocks: []
|
|
6053
5984
|
});
|
|
6054
|
-
store.dispatch(
|
|
5985
|
+
store.dispatch(setComponentTypes(result));
|
|
6055
5986
|
}
|
|
6056
5987
|
}
|
|
6057
|
-
class
|
|
5988
|
+
class ComponentTypeAttachmentService extends BaseAttachmentService {
|
|
6058
5989
|
constructor() {
|
|
6059
5990
|
super(...arguments);
|
|
6060
|
-
__publicField(this, "attachmentModel", AttachmentModel.
|
|
5991
|
+
__publicField(this, "attachmentModel", AttachmentModel.ComponentType);
|
|
6061
5992
|
}
|
|
6062
5993
|
buildOfflineAttachment(data) {
|
|
6063
5994
|
return offline({
|
|
@@ -6068,36 +5999,36 @@ class AssetTypeAttachmentService extends BaseAttachmentService {
|
|
|
6068
5999
|
file_type: data.file.type,
|
|
6069
6000
|
submitted_at: data.submittedAt,
|
|
6070
6001
|
description: data.description,
|
|
6071
|
-
|
|
6002
|
+
component_type: data.modelId
|
|
6072
6003
|
});
|
|
6073
6004
|
}
|
|
6074
|
-
async
|
|
6005
|
+
async attachFilesToComponentType(files, componentTypeId) {
|
|
6075
6006
|
return this.attachFiles(
|
|
6076
6007
|
files,
|
|
6077
|
-
|
|
6008
|
+
componentTypeId,
|
|
6078
6009
|
this.buildOfflineAttachment.bind(this),
|
|
6079
6010
|
{
|
|
6080
|
-
addAttachments:
|
|
6081
|
-
updateAttachments:
|
|
6082
|
-
removeAttachments:
|
|
6011
|
+
addAttachments: addComponentTypeAttachments,
|
|
6012
|
+
updateAttachments: updateComponentTypeAttachments,
|
|
6013
|
+
removeAttachments: removeComponentTypeAttachments
|
|
6083
6014
|
}
|
|
6084
6015
|
);
|
|
6085
6016
|
}
|
|
6086
|
-
|
|
6017
|
+
deleteComponentTypeAttachment(attachmentId) {
|
|
6087
6018
|
return this.deleteAttachment(
|
|
6088
6019
|
attachmentId,
|
|
6089
6020
|
{
|
|
6090
|
-
setAttachment:
|
|
6091
|
-
removeAttachment:
|
|
6021
|
+
setAttachment: setComponentTypeAttachment,
|
|
6022
|
+
removeAttachment: removeComponentTypeAttachment
|
|
6092
6023
|
},
|
|
6093
6024
|
{
|
|
6094
|
-
selectAttachment:
|
|
6025
|
+
selectAttachment: selectComponentTypeAttachment
|
|
6095
6026
|
}
|
|
6096
6027
|
);
|
|
6097
6028
|
}
|
|
6098
6029
|
async refreshStore() {
|
|
6099
6030
|
return this.getAttachments({
|
|
6100
|
-
setAttachments:
|
|
6031
|
+
setAttachments: setComponentTypeAttachments
|
|
6101
6032
|
});
|
|
6102
6033
|
}
|
|
6103
6034
|
}
|
|
@@ -6111,7 +6042,7 @@ class IssueCommentService extends BaseApiService {
|
|
|
6111
6042
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
6112
6043
|
});
|
|
6113
6044
|
store.dispatch(addIssueComment(offlineComment));
|
|
6114
|
-
const promise = this.enqueueRequest({
|
|
6045
|
+
const promise = this.client.enqueueRequest({
|
|
6115
6046
|
description: `${truncate(comment.content, 80)}`,
|
|
6116
6047
|
method: HttpMethod.POST,
|
|
6117
6048
|
url: `/issues/${comment.issue}/comment/`,
|
|
@@ -6131,7 +6062,7 @@ class IssueCommentService extends BaseApiService {
|
|
|
6131
6062
|
throw new Error(`Comment with offline_id ${comment.offline_id} not found in store`);
|
|
6132
6063
|
}
|
|
6133
6064
|
store.dispatch(setIssueComment(comment));
|
|
6134
|
-
const promise = this.enqueueRequest({
|
|
6065
|
+
const promise = this.client.enqueueRequest({
|
|
6135
6066
|
description: `Edit comment: ${truncate(comment.content, 80)}`,
|
|
6136
6067
|
method: HttpMethod.PATCH,
|
|
6137
6068
|
url: `/issues/comments/${comment.offline_id}/`,
|
|
@@ -6150,7 +6081,7 @@ class IssueCommentService extends BaseApiService {
|
|
|
6150
6081
|
throw new Error(`Comment with offline_id ${offline_id} not found in store`);
|
|
6151
6082
|
}
|
|
6152
6083
|
this.client.store.dispatch(removeIssueComment(offline_id));
|
|
6153
|
-
const promise = this.enqueueRequest({
|
|
6084
|
+
const promise = this.client.enqueueRequest({
|
|
6154
6085
|
description: "Delete comment",
|
|
6155
6086
|
method: HttpMethod.DELETE,
|
|
6156
6087
|
url: `/issues/comments/${offline_id}/`,
|
|
@@ -6164,7 +6095,7 @@ class IssueCommentService extends BaseApiService {
|
|
|
6164
6095
|
}
|
|
6165
6096
|
async refreshStore() {
|
|
6166
6097
|
const { store } = this.client;
|
|
6167
|
-
const result = await this.enqueueRequest({
|
|
6098
|
+
const result = await this.client.enqueueRequest({
|
|
6168
6099
|
description: "Get comments",
|
|
6169
6100
|
method: HttpMethod.GET,
|
|
6170
6101
|
// TODO: Choose between /issues/comments/in-project/${projectId}/ and /projects/${projectId}/issue-comments/
|
|
@@ -6178,7 +6109,7 @@ class IssueCommentService extends BaseApiService {
|
|
|
6178
6109
|
class IssueUpdateService extends BaseApiService {
|
|
6179
6110
|
async refreshStore() {
|
|
6180
6111
|
const { store } = this.client;
|
|
6181
|
-
const result = await this.enqueueRequest({
|
|
6112
|
+
const result = await this.client.enqueueRequest({
|
|
6182
6113
|
description: "Get issue updates",
|
|
6183
6114
|
method: HttpMethod.GET,
|
|
6184
6115
|
url: `/projects/${store.getState().projectReducer.activeProjectId}/issues/updates/`,
|
|
@@ -6264,7 +6195,7 @@ class IssueService extends BaseApiService {
|
|
|
6264
6195
|
store.dispatch(addIssue(issuePayload));
|
|
6265
6196
|
store.dispatch(addToRecentIssues(issuePayload.offline_id));
|
|
6266
6197
|
store.dispatch(addActiveProjectIssuesCount(1));
|
|
6267
|
-
const promise = this.enqueueRequest({
|
|
6198
|
+
const promise = this.client.enqueueRequest({
|
|
6268
6199
|
description: "Create issue",
|
|
6269
6200
|
method: HttpMethod.POST,
|
|
6270
6201
|
url: "/issues/",
|
|
@@ -6299,7 +6230,7 @@ class IssueService extends BaseApiService {
|
|
|
6299
6230
|
return [issuePayload, promise];
|
|
6300
6231
|
}
|
|
6301
6232
|
fetchAll(projectId) {
|
|
6302
|
-
const promise = this.enqueueRequest({
|
|
6233
|
+
const promise = this.client.enqueueRequest({
|
|
6303
6234
|
description: "Get issues",
|
|
6304
6235
|
method: HttpMethod.GET,
|
|
6305
6236
|
url: `/projects/${projectId}/issues/`,
|
|
@@ -6396,7 +6327,7 @@ class IssueService extends BaseApiService {
|
|
|
6396
6327
|
changes
|
|
6397
6328
|
});
|
|
6398
6329
|
this.client.store.dispatch(addIssueUpdate(offlineIssueUpdate));
|
|
6399
|
-
const promise = this.enqueueRequest({
|
|
6330
|
+
const promise = this.client.enqueueRequest({
|
|
6400
6331
|
description: "Edit issue",
|
|
6401
6332
|
method: HttpMethod.PATCH,
|
|
6402
6333
|
url: `/issues/${issue.offline_id}/`,
|
|
@@ -6429,7 +6360,7 @@ class IssueService extends BaseApiService {
|
|
|
6429
6360
|
if (updatesOfIssue.length > 0)
|
|
6430
6361
|
dispatch(removeIssueUpdates(updatesOfIssue.map(({ offline_id }) => offline_id)));
|
|
6431
6362
|
try {
|
|
6432
|
-
return await this.enqueueRequest({
|
|
6363
|
+
return await this.client.enqueueRequest({
|
|
6433
6364
|
description: "Delete issue",
|
|
6434
6365
|
method: HttpMethod.DELETE,
|
|
6435
6366
|
url: `/issues/${id}/`,
|
|
@@ -6471,7 +6402,7 @@ class IssueTypeService extends BaseApiService {
|
|
|
6471
6402
|
organization: activeOrganizationId
|
|
6472
6403
|
});
|
|
6473
6404
|
store.dispatch(addIssueType(offlineIssueType));
|
|
6474
|
-
const promise = this.enqueueRequest({
|
|
6405
|
+
const promise = this.client.enqueueRequest({
|
|
6475
6406
|
method: HttpMethod.POST,
|
|
6476
6407
|
url: `/organizations/${activeOrganizationId}/issue-types/`,
|
|
6477
6408
|
// Sending only whats needed here
|
|
@@ -6504,7 +6435,7 @@ class IssueTypeService extends BaseApiService {
|
|
|
6504
6435
|
...issueTypeFields
|
|
6505
6436
|
};
|
|
6506
6437
|
store.dispatch(updateIssueType(offlineUpdatedIssueType));
|
|
6507
|
-
const promise = this.enqueueRequest({
|
|
6438
|
+
const promise = this.client.enqueueRequest({
|
|
6508
6439
|
method: HttpMethod.PATCH,
|
|
6509
6440
|
url: `/issues/types/${issueTypeFields.offline_id}/`,
|
|
6510
6441
|
payload: issueTypeFields,
|
|
@@ -6528,7 +6459,7 @@ class IssueTypeService extends BaseApiService {
|
|
|
6528
6459
|
const issuesOfIssueType = selectIssuesOfIssueType(issueTypeId)(state) ?? [];
|
|
6529
6460
|
store.dispatch(removeIssueType(issueTypeId));
|
|
6530
6461
|
store.dispatch(removeIssues(issuesOfIssueType.map((issue) => issue.offline_id)));
|
|
6531
|
-
const promise = this.enqueueRequest({
|
|
6462
|
+
const promise = this.client.enqueueRequest({
|
|
6532
6463
|
method: HttpMethod.DELETE,
|
|
6533
6464
|
url: `/issues/types/${issueTypeId}/`,
|
|
6534
6465
|
blockers: [issueTypeId],
|
|
@@ -6546,7 +6477,7 @@ class IssueTypeService extends BaseApiService {
|
|
|
6546
6477
|
if (!activeOrganizationId) {
|
|
6547
6478
|
throw new Error(`No active organization, got ${activeOrganizationId} for activeOrganizationId.`);
|
|
6548
6479
|
}
|
|
6549
|
-
const result = await this.enqueueRequest({
|
|
6480
|
+
const result = await this.client.enqueueRequest({
|
|
6550
6481
|
method: HttpMethod.GET,
|
|
6551
6482
|
url: `/organizations/${activeOrganizationId}/issue-types/`,
|
|
6552
6483
|
blockers: [],
|
|
@@ -6560,7 +6491,7 @@ class MainService extends BaseApiService {
|
|
|
6560
6491
|
if (replaceExisting) {
|
|
6561
6492
|
this.client.store.dispatch(setIsFetchingInitialData(true));
|
|
6562
6493
|
}
|
|
6563
|
-
const result = await this.enqueueRequest({
|
|
6494
|
+
const result = await this.client.enqueueRequest({
|
|
6564
6495
|
uuid,
|
|
6565
6496
|
description: "Get initial data",
|
|
6566
6497
|
method: HttpMethod.GET,
|
|
@@ -6574,7 +6505,7 @@ class MainService extends BaseApiService {
|
|
|
6574
6505
|
}
|
|
6575
6506
|
async fetchProjectUsers() {
|
|
6576
6507
|
const projectId = this.client.store.getState().projectReducer.activeProjectId;
|
|
6577
|
-
return this.enqueueRequest({
|
|
6508
|
+
return this.client.enqueueRequest({
|
|
6578
6509
|
description: "Fetch users",
|
|
6579
6510
|
method: HttpMethod.GET,
|
|
6580
6511
|
url: `/projects/${projectId}/users/`,
|
|
@@ -6586,7 +6517,7 @@ class MainService extends BaseApiService {
|
|
|
6586
6517
|
});
|
|
6587
6518
|
}
|
|
6588
6519
|
async fetchOrganizationUsers(orgId) {
|
|
6589
|
-
return this.enqueueRequest({
|
|
6520
|
+
return this.client.enqueueRequest({
|
|
6590
6521
|
description: "Fetch organization users",
|
|
6591
6522
|
method: HttpMethod.GET,
|
|
6592
6523
|
url: `/organizations/${orgId}/users/`,
|
|
@@ -6595,8 +6526,8 @@ class MainService extends BaseApiService {
|
|
|
6595
6526
|
});
|
|
6596
6527
|
}
|
|
6597
6528
|
// TODO:
|
|
6598
|
-
// Don't accept updateStore in
|
|
6599
|
-
// overwrite, use
|
|
6529
|
+
// Don't accept updateStore in ComponentService.list. Just return the offline objects and promise. Here, if
|
|
6530
|
+
// overwrite, use setComponents. Otherwise, use bulkAddComponents.
|
|
6600
6531
|
// TODO: This needs major cleanup. Send less in the initial data: Only the basic project info and anything needed
|
|
6601
6532
|
// literally immediately.
|
|
6602
6533
|
async _processInitialData(data, overwrite) {
|
|
@@ -6701,10 +6632,10 @@ class MainService extends BaseApiService {
|
|
|
6701
6632
|
} finally {
|
|
6702
6633
|
store.dispatch(setIsFetchingInitialData(false));
|
|
6703
6634
|
}
|
|
6704
|
-
void this.client.
|
|
6705
|
-
void this.client.
|
|
6706
|
-
void this.client.
|
|
6707
|
-
void this.client.
|
|
6635
|
+
void this.client.componentTypes.refreshStore();
|
|
6636
|
+
void this.client.componentStages.refreshStore();
|
|
6637
|
+
void this.client.components.refreshStore();
|
|
6638
|
+
void this.client.componentStageCompletions.refreshStore();
|
|
6708
6639
|
void this.client.categories.refreshStore();
|
|
6709
6640
|
void this.client.issueTypes.refreshStore();
|
|
6710
6641
|
void this.client.issues.refreshStore();
|
|
@@ -6719,15 +6650,15 @@ class MainService extends BaseApiService {
|
|
|
6719
6650
|
void this.client.issueUpdates.refreshStore();
|
|
6720
6651
|
void this.client.projectAccesses.refreshStore();
|
|
6721
6652
|
void this.client.projectAttachments.refreshStore();
|
|
6722
|
-
void this.client.
|
|
6723
|
-
void this.client.
|
|
6653
|
+
void this.client.componentTypeAttachments.refreshStore();
|
|
6654
|
+
void this.client.componentAttachments.refreshStore();
|
|
6724
6655
|
}
|
|
6725
6656
|
void this.client.teams.refreshStore();
|
|
6726
6657
|
}
|
|
6727
6658
|
}
|
|
6728
6659
|
class ProjectAccessService extends BaseApiService {
|
|
6729
6660
|
async fetchAll(projectId) {
|
|
6730
|
-
return this.enqueueRequest({
|
|
6661
|
+
return this.client.enqueueRequest({
|
|
6731
6662
|
description: "Get project accesses",
|
|
6732
6663
|
method: HttpMethod.GET,
|
|
6733
6664
|
url: `/projects/${projectId}/access/`,
|
|
@@ -6737,7 +6668,7 @@ class ProjectAccessService extends BaseApiService {
|
|
|
6737
6668
|
}
|
|
6738
6669
|
async update(projectAccess) {
|
|
6739
6670
|
this.client.store.dispatch(updateProjectAccess(projectAccess));
|
|
6740
|
-
return this.enqueueRequest({
|
|
6671
|
+
return this.client.enqueueRequest({
|
|
6741
6672
|
description: "Edit project access",
|
|
6742
6673
|
method: HttpMethod.PATCH,
|
|
6743
6674
|
url: `/access/${projectAccess.offline_id}/`,
|
|
@@ -6750,7 +6681,7 @@ class ProjectAccessService extends BaseApiService {
|
|
|
6750
6681
|
async remove(projectAccess) {
|
|
6751
6682
|
const { store } = this.client;
|
|
6752
6683
|
store.dispatch(removeProjectAccess(projectAccess));
|
|
6753
|
-
return this.enqueueRequest({
|
|
6684
|
+
return this.client.enqueueRequest({
|
|
6754
6685
|
description: "Delete project access",
|
|
6755
6686
|
method: HttpMethod.DELETE,
|
|
6756
6687
|
url: `/access/${projectAccess.offline_id}/`,
|
|
@@ -6773,7 +6704,7 @@ class ProjectAccessService extends BaseApiService {
|
|
|
6773
6704
|
class ProjectFileService extends BaseApiService {
|
|
6774
6705
|
async refreshStore() {
|
|
6775
6706
|
const { store } = this.client;
|
|
6776
|
-
const result = await this.enqueueRequest({
|
|
6707
|
+
const result = await this.client.enqueueRequest({
|
|
6777
6708
|
description: "Get project files",
|
|
6778
6709
|
method: HttpMethod.GET,
|
|
6779
6710
|
url: `/projects/${store.getState().projectReducer.activeProjectId}/files/`,
|
|
@@ -6790,7 +6721,7 @@ class ProjectFileService extends BaseApiService {
|
|
|
6790
6721
|
}
|
|
6791
6722
|
const editableData = { ...file };
|
|
6792
6723
|
delete editableData.file;
|
|
6793
|
-
const promise = this.enqueueRequest({
|
|
6724
|
+
const promise = this.client.enqueueRequest({
|
|
6794
6725
|
method: HttpMethod.PATCH,
|
|
6795
6726
|
url: `/projects/files/${file.offline_id}/`,
|
|
6796
6727
|
payload: editableData,
|
|
@@ -6848,7 +6779,7 @@ class ProjectFileService extends BaseApiService {
|
|
|
6848
6779
|
});
|
|
6849
6780
|
}
|
|
6850
6781
|
const promise = Promise.resolve(requestDetails).then((requestDetails2) => {
|
|
6851
|
-
return this.enqueueRequest(requestDetails2);
|
|
6782
|
+
return this.client.enqueueRequest(requestDetails2);
|
|
6852
6783
|
});
|
|
6853
6784
|
void promise.then((result) => {
|
|
6854
6785
|
store.dispatch(addOrReplaceProjectFile(result));
|
|
@@ -6860,7 +6791,7 @@ class ProjectFileService extends BaseApiService {
|
|
|
6860
6791
|
}
|
|
6861
6792
|
delete(projectFileId) {
|
|
6862
6793
|
this.client.store.dispatch(removeProjectFile(projectFileId));
|
|
6863
|
-
return this.enqueueRequest({
|
|
6794
|
+
return this.client.enqueueRequest({
|
|
6864
6795
|
method: HttpMethod.DELETE,
|
|
6865
6796
|
url: `/projects/files/${projectFileId}`,
|
|
6866
6797
|
blockers: [projectFileId],
|
|
@@ -6931,7 +6862,7 @@ class ProjectService extends BaseApiService {
|
|
|
6931
6862
|
}
|
|
6932
6863
|
const url = isOrganizationProject ? `/organizations/${project.owner_organization}/projects/` : "/projects/";
|
|
6933
6864
|
const projectType = isOrganizationProject ? { organization_owner: project.owner_organization } : { user_owner: project.owner_user };
|
|
6934
|
-
const result = await this.enqueueRequest({
|
|
6865
|
+
const result = await this.client.enqueueRequest({
|
|
6935
6866
|
description: "Create project",
|
|
6936
6867
|
method: HttpMethod.POST,
|
|
6937
6868
|
url,
|
|
@@ -6955,7 +6886,7 @@ class ProjectService extends BaseApiService {
|
|
|
6955
6886
|
throw new Error("Project bounds were not set before trying to create a project");
|
|
6956
6887
|
}
|
|
6957
6888
|
store.dispatch(updateOrCreateProject(project));
|
|
6958
|
-
return await this.enqueueRequest({
|
|
6889
|
+
return await this.client.enqueueRequest({
|
|
6959
6890
|
description: "Update project",
|
|
6960
6891
|
method: HttpMethod.PATCH,
|
|
6961
6892
|
url: `/projects/${project.id}/`,
|
|
@@ -6995,7 +6926,7 @@ class ProjectService extends BaseApiService {
|
|
|
6995
6926
|
store.dispatch(updateLicense({ ...license, project: null }));
|
|
6996
6927
|
}
|
|
6997
6928
|
try {
|
|
6998
|
-
await this.enqueueRequest({
|
|
6929
|
+
await this.client.enqueueRequest({
|
|
6999
6930
|
description: "Delete project",
|
|
7000
6931
|
method: HttpMethod.DELETE,
|
|
7001
6932
|
url: `/projects/${projectId}/`,
|
|
@@ -7018,7 +6949,7 @@ class ProjectService extends BaseApiService {
|
|
|
7018
6949
|
}
|
|
7019
6950
|
invite(projectId, email) {
|
|
7020
6951
|
const offline_id = v4();
|
|
7021
|
-
return this.enqueueRequest({
|
|
6952
|
+
return this.client.enqueueRequest({
|
|
7022
6953
|
description: "Invite user to project",
|
|
7023
6954
|
method: HttpMethod.POST,
|
|
7024
6955
|
url: `/projects/${projectId}/invite/${email}/`,
|
|
@@ -7030,7 +6961,7 @@ class ProjectService extends BaseApiService {
|
|
|
7030
6961
|
});
|
|
7031
6962
|
}
|
|
7032
6963
|
joinProject(projectId, userId, inviteCode) {
|
|
7033
|
-
return this.enqueueRequest({
|
|
6964
|
+
return this.client.enqueueRequest({
|
|
7034
6965
|
description: "Join project",
|
|
7035
6966
|
method: HttpMethod.GET,
|
|
7036
6967
|
url: `/projects/${projectId}/join-project/${userId}/${inviteCode}/`,
|
|
@@ -7040,7 +6971,7 @@ class ProjectService extends BaseApiService {
|
|
|
7040
6971
|
});
|
|
7041
6972
|
}
|
|
7042
6973
|
async acceptInvite(projectId) {
|
|
7043
|
-
return this.enqueueRequest({
|
|
6974
|
+
return this.client.enqueueRequest({
|
|
7044
6975
|
description: "Accept project invite",
|
|
7045
6976
|
method: HttpMethod.PATCH,
|
|
7046
6977
|
url: `/projects/${projectId}/accept-invite/`,
|
|
@@ -7099,7 +7030,7 @@ class UserFormService extends BaseApiService {
|
|
|
7099
7030
|
revision: offlineRevisionId,
|
|
7100
7031
|
field_identifier: key
|
|
7101
7032
|
});
|
|
7102
|
-
const attach = await this.enqueueRequest({
|
|
7033
|
+
const attach = await this.client.enqueueRequest({
|
|
7103
7034
|
description: "Attach image to form revision field",
|
|
7104
7035
|
method: HttpMethod.POST,
|
|
7105
7036
|
url: `/forms/revisions/${offlineRevisionId}/attachments/`,
|
|
@@ -7116,7 +7047,7 @@ class UserFormService extends BaseApiService {
|
|
|
7116
7047
|
});
|
|
7117
7048
|
});
|
|
7118
7049
|
}
|
|
7119
|
-
async add(state, initialRevision, url, ownerUser, ownerOrganization,
|
|
7050
|
+
async add(state, initialRevision, url, ownerUser, ownerOrganization, componentTypeId, issueTypeId) {
|
|
7120
7051
|
if (!!ownerUser === !!ownerOrganization) {
|
|
7121
7052
|
throw new Error("Exactly one of ownerUser and ownerOrganization must be defined.");
|
|
7122
7053
|
}
|
|
@@ -7135,7 +7066,7 @@ class UserFormService extends BaseApiService {
|
|
|
7135
7066
|
favorite: true,
|
|
7136
7067
|
submitted_at: submittedAt,
|
|
7137
7068
|
created_by: currentUser.id,
|
|
7138
|
-
...
|
|
7069
|
+
...componentTypeId && { component_type: componentTypeId },
|
|
7139
7070
|
...issueTypeId && { issue_type: issueTypeId },
|
|
7140
7071
|
...ownerAttrs
|
|
7141
7072
|
};
|
|
@@ -7150,7 +7081,7 @@ class UserFormService extends BaseApiService {
|
|
|
7150
7081
|
const { store } = this.client;
|
|
7151
7082
|
store.dispatch(addForm(retForm));
|
|
7152
7083
|
store.dispatch(addFormRevision(retRevision));
|
|
7153
|
-
const formPromise = this.enqueueRequest({
|
|
7084
|
+
const formPromise = this.client.enqueueRequest({
|
|
7154
7085
|
description: "Create form",
|
|
7155
7086
|
method: HttpMethod.POST,
|
|
7156
7087
|
url,
|
|
@@ -7159,11 +7090,11 @@ class UserFormService extends BaseApiService {
|
|
|
7159
7090
|
} : void 0,
|
|
7160
7091
|
payload: {
|
|
7161
7092
|
...offlineFormPayload,
|
|
7162
|
-
...
|
|
7093
|
+
...componentTypeId && { component_type: componentTypeId },
|
|
7163
7094
|
...issueTypeId && { issue_type: issueTypeId },
|
|
7164
7095
|
initial_revision: payloadWithoutImage
|
|
7165
7096
|
},
|
|
7166
|
-
blockers:
|
|
7097
|
+
blockers: componentTypeId ? [componentTypeId] : issueTypeId ? [issueTypeId] : [],
|
|
7167
7098
|
blocks: [offlineFormPayload.offline_id, payloadWithoutImage.offline_id]
|
|
7168
7099
|
});
|
|
7169
7100
|
const attachImagesPromises = this.getAttachImagePromises(images, offlineRevisionPayload.offline_id);
|
|
@@ -7187,7 +7118,7 @@ class UserFormService extends BaseApiService {
|
|
|
7187
7118
|
`/forms/in-organization/${activeOrganizationId}/`,
|
|
7188
7119
|
void 0,
|
|
7189
7120
|
activeOrganizationId,
|
|
7190
|
-
attachedTo && "
|
|
7121
|
+
attachedTo && "componentTypeId" in attachedTo ? attachedTo.componentTypeId : void 0,
|
|
7191
7122
|
attachedTo && "issueTypeId" in attachedTo ? attachedTo.issueTypeId : void 0
|
|
7192
7123
|
);
|
|
7193
7124
|
}
|
|
@@ -7200,7 +7131,7 @@ class UserFormService extends BaseApiService {
|
|
|
7200
7131
|
"/forms/my-forms/",
|
|
7201
7132
|
currentUser.id,
|
|
7202
7133
|
void 0,
|
|
7203
|
-
attachedTo && "
|
|
7134
|
+
attachedTo && "componentTypeId" in attachedTo ? attachedTo.componentTypeId : void 0,
|
|
7204
7135
|
attachedTo && "issueTypeId" in attachedTo ? attachedTo.issueTypeId : void 0
|
|
7205
7136
|
);
|
|
7206
7137
|
}
|
|
@@ -7222,7 +7153,7 @@ class UserFormService extends BaseApiService {
|
|
|
7222
7153
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7223
7154
|
};
|
|
7224
7155
|
store.dispatch(addFormRevision(fullRevision));
|
|
7225
|
-
const promise = this.enqueueRequest({
|
|
7156
|
+
const promise = this.client.enqueueRequest({
|
|
7226
7157
|
description: "Create form revision",
|
|
7227
7158
|
method: HttpMethod.PATCH,
|
|
7228
7159
|
url: `/forms/${formId2}/`,
|
|
@@ -7247,7 +7178,7 @@ class UserFormService extends BaseApiService {
|
|
|
7247
7178
|
const activeProjectId = store.getState().projectReducer.activeProjectId;
|
|
7248
7179
|
store.dispatch(favoriteForm({ formId: formId2 }));
|
|
7249
7180
|
try {
|
|
7250
|
-
await this.enqueueRequest({
|
|
7181
|
+
await this.client.enqueueRequest({
|
|
7251
7182
|
description: "Favorite form",
|
|
7252
7183
|
method: HttpMethod.POST,
|
|
7253
7184
|
url: `/forms/${formId2}/favorite/${activeProjectId}/`,
|
|
@@ -7264,7 +7195,7 @@ class UserFormService extends BaseApiService {
|
|
|
7264
7195
|
const activeProjectId = store.getState().projectReducer.activeProjectId;
|
|
7265
7196
|
store.dispatch(unfavoriteForm({ formId: formId2 }));
|
|
7266
7197
|
try {
|
|
7267
|
-
return await this.enqueueRequest({
|
|
7198
|
+
return await this.client.enqueueRequest({
|
|
7268
7199
|
description: "Unfavorite form",
|
|
7269
7200
|
method: HttpMethod.DELETE,
|
|
7270
7201
|
url: `/forms/${formId2}/unfavorite/${activeProjectId}/`,
|
|
@@ -7293,7 +7224,7 @@ class UserFormService extends BaseApiService {
|
|
|
7293
7224
|
}
|
|
7294
7225
|
store.dispatch(deleteForm(formId2));
|
|
7295
7226
|
try {
|
|
7296
|
-
return await this.enqueueRequest({
|
|
7227
|
+
return await this.client.enqueueRequest({
|
|
7297
7228
|
description: "Delete form",
|
|
7298
7229
|
method: HttpMethod.DELETE,
|
|
7299
7230
|
url: `/forms/${formId2}/`,
|
|
@@ -7313,7 +7244,7 @@ class UserFormService extends BaseApiService {
|
|
|
7313
7244
|
}
|
|
7314
7245
|
async refreshStore() {
|
|
7315
7246
|
const { store } = this.client;
|
|
7316
|
-
const result = await this.enqueueRequest({
|
|
7247
|
+
const result = await this.client.enqueueRequest({
|
|
7317
7248
|
description: "Fetch user forms",
|
|
7318
7249
|
method: HttpMethod.GET,
|
|
7319
7250
|
url: `/forms/in-project/${store.getState().projectReducer.activeProjectId}/forms/`,
|
|
@@ -7362,14 +7293,14 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7362
7293
|
submission: submission.offline_id,
|
|
7363
7294
|
field_identifier: key
|
|
7364
7295
|
});
|
|
7365
|
-
const attach = await this.enqueueRequest({
|
|
7296
|
+
const attach = await this.client.enqueueRequest({
|
|
7366
7297
|
description: "Attach file to form submission",
|
|
7367
7298
|
method: HttpMethod.POST,
|
|
7368
7299
|
url: `/forms/submission/${submission.offline_id}/attachments/`,
|
|
7369
7300
|
payload: submissionAttachmentPayload,
|
|
7370
7301
|
blockers: [
|
|
7371
|
-
submission.
|
|
7372
|
-
submission.
|
|
7302
|
+
submission.component,
|
|
7303
|
+
submission.component_stage,
|
|
7373
7304
|
submission.issue,
|
|
7374
7305
|
submission.form_revision
|
|
7375
7306
|
].filter((x) => x !== void 0),
|
|
@@ -7400,12 +7331,12 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7400
7331
|
created_by: state.userReducer.currentUser.id,
|
|
7401
7332
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7402
7333
|
};
|
|
7403
|
-
const promise = this.enqueueRequest({
|
|
7334
|
+
const promise = this.client.enqueueRequest({
|
|
7404
7335
|
description: "Respond to form",
|
|
7405
7336
|
method: HttpMethod.POST,
|
|
7406
7337
|
url: `/forms/revisions/${payload.form_revision}/respond/`,
|
|
7407
7338
|
payload: { ...offlineSubmission, project: activeProjectId },
|
|
7408
|
-
blockers: [payload.issue, payload.
|
|
7339
|
+
blockers: [payload.issue, payload.component, payload.component_stage, "add-form-entry"].filter(
|
|
7409
7340
|
(x) => x !== void 0
|
|
7410
7341
|
),
|
|
7411
7342
|
blocks: [payload.offline_id]
|
|
@@ -7423,10 +7354,10 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7423
7354
|
const settledPromise = Promise.all([promise, ...attachFilesPromises]).then(() => promise);
|
|
7424
7355
|
return [offlineSubmission, settledPromise];
|
|
7425
7356
|
}
|
|
7426
|
-
// Note currently the bulkAdd method is specific to form submissions for
|
|
7357
|
+
// Note currently the bulkAdd method is specific to form submissions for components
|
|
7427
7358
|
// TODO: adapt the support bulk adding to any model type
|
|
7428
7359
|
async bulkAdd(args) {
|
|
7429
|
-
const { formRevision, values: argsValues,
|
|
7360
|
+
const { formRevision, values: argsValues, componentOfflineIds } = args;
|
|
7430
7361
|
const { store } = this.client;
|
|
7431
7362
|
const offlineSubmissions = [];
|
|
7432
7363
|
const offlineAttachments = [];
|
|
@@ -7436,16 +7367,16 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7436
7367
|
const { values, files } = separateFilesFromValues(argsValues);
|
|
7437
7368
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7438
7369
|
const createdBy = store.getState().userReducer.currentUser.id;
|
|
7439
|
-
for (const
|
|
7370
|
+
for (const component_id of componentOfflineIds) {
|
|
7440
7371
|
const submission = offline({
|
|
7441
7372
|
form_revision: formRevision,
|
|
7442
7373
|
values,
|
|
7443
7374
|
created_by: createdBy,
|
|
7444
7375
|
submitted_at: submittedAt,
|
|
7445
|
-
|
|
7376
|
+
component: component_id
|
|
7446
7377
|
});
|
|
7447
7378
|
submissionOfflineIds.push(submission.offline_id);
|
|
7448
|
-
submissionsPayload.push({ offline_id: submission.offline_id,
|
|
7379
|
+
submissionsPayload.push({ offline_id: submission.offline_id, component_id });
|
|
7449
7380
|
offlineSubmissions.push(submission);
|
|
7450
7381
|
for (const [fieldIdentifier, fileArray] of Object.entries(files)) {
|
|
7451
7382
|
for (const file of fileArray) {
|
|
@@ -7481,7 +7412,7 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7481
7412
|
}
|
|
7482
7413
|
store.dispatch(addFormSubmissions(offlineSubmissions));
|
|
7483
7414
|
store.dispatch(addFormSubmissionAttachments(offlineAttachments));
|
|
7484
|
-
const promise = this.enqueueRequest({
|
|
7415
|
+
const promise = this.client.enqueueRequest({
|
|
7485
7416
|
description: "Bulk add form submissions",
|
|
7486
7417
|
method: HttpMethod.POST,
|
|
7487
7418
|
url: `/forms/revisions/${formRevision}/bulk-respond/`,
|
|
@@ -7492,7 +7423,7 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7492
7423
|
attachments: attachmentsPayload,
|
|
7493
7424
|
files: Object.values(filesRecord)
|
|
7494
7425
|
},
|
|
7495
|
-
blockers:
|
|
7426
|
+
blockers: componentOfflineIds,
|
|
7496
7427
|
blocks: submissionOfflineIds
|
|
7497
7428
|
});
|
|
7498
7429
|
promise.then(({ submissions, attachments, presigned_urls }) => {
|
|
@@ -7502,7 +7433,7 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7502
7433
|
const file = filesRecord[sha1];
|
|
7503
7434
|
if (!file)
|
|
7504
7435
|
continue;
|
|
7505
|
-
void this.enqueueRequest({
|
|
7436
|
+
void this.client.enqueueRequest({
|
|
7506
7437
|
url: presigned_url.url,
|
|
7507
7438
|
description: "Upload file",
|
|
7508
7439
|
method: HttpMethod.POST,
|
|
@@ -7530,12 +7461,12 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7530
7461
|
};
|
|
7531
7462
|
const submissionToBeUpdated = store.getState().formSubmissionReducer.formSubmissions[submission.offline_id];
|
|
7532
7463
|
store.dispatch(updateFormSubmission(offlineSubmission));
|
|
7533
|
-
const promise = this.enqueueRequest({
|
|
7464
|
+
const promise = this.client.enqueueRequest({
|
|
7534
7465
|
description: "Patch form submission",
|
|
7535
7466
|
method: HttpMethod.PATCH,
|
|
7536
7467
|
url: `/forms/submissions/${submission.offline_id}/`,
|
|
7537
7468
|
payload: offlineSubmission,
|
|
7538
|
-
blockers: [offlineSubmission.issue, offlineSubmission.
|
|
7469
|
+
blockers: [offlineSubmission.issue, offlineSubmission.component, offlineSubmission.component_stage].filter(
|
|
7539
7470
|
(x) => x !== void 0
|
|
7540
7471
|
),
|
|
7541
7472
|
blocks: [offlineSubmission.offline_id]
|
|
@@ -7556,7 +7487,7 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7556
7487
|
store.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
7557
7488
|
store.dispatch(deleteFormSubmissionAttachments(submissionAttachments.map((x) => x.offline_id)));
|
|
7558
7489
|
try {
|
|
7559
|
-
return await this.enqueueRequest({
|
|
7490
|
+
return await this.client.enqueueRequest({
|
|
7560
7491
|
description: "Delete user form submissions",
|
|
7561
7492
|
method: HttpMethod.DELETE,
|
|
7562
7493
|
url: `/forms/submissions/${submissionId}/`,
|
|
@@ -7573,7 +7504,7 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7573
7504
|
async refreshStore() {
|
|
7574
7505
|
const { store } = this.client;
|
|
7575
7506
|
const projectId = store.getState().projectReducer.activeProjectId;
|
|
7576
|
-
const submissions = await this.enqueueRequest({
|
|
7507
|
+
const submissions = await this.client.enqueueRequest({
|
|
7577
7508
|
description: "Fetch form submissions",
|
|
7578
7509
|
method: HttpMethod.GET,
|
|
7579
7510
|
url: `/forms/in-project/${projectId}/submissions/`,
|
|
@@ -7581,7 +7512,7 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7581
7512
|
blocks: []
|
|
7582
7513
|
});
|
|
7583
7514
|
store.dispatch(setFormSubmissions(submissions));
|
|
7584
|
-
const attachments = await this.enqueueRequest({
|
|
7515
|
+
const attachments = await this.client.enqueueRequest({
|
|
7585
7516
|
description: "Fetch form attachments",
|
|
7586
7517
|
method: HttpMethod.GET,
|
|
7587
7518
|
url: `/forms/in-project/${projectId}/attachments/`,
|
|
@@ -7596,7 +7527,7 @@ class WorkspaceService extends BaseApiService {
|
|
|
7596
7527
|
const { store } = this.client;
|
|
7597
7528
|
const offlineWorkspace = offline(workspace);
|
|
7598
7529
|
store.dispatch(addWorkspace(offlineWorkspace));
|
|
7599
|
-
const promise = this.enqueueRequest({
|
|
7530
|
+
const promise = this.client.enqueueRequest({
|
|
7600
7531
|
description: "Create Workspace",
|
|
7601
7532
|
method: HttpMethod.POST,
|
|
7602
7533
|
url: `/projects/${store.getState().projectReducer.activeProjectId}/workspaces/`,
|
|
@@ -7614,7 +7545,7 @@ class WorkspaceService extends BaseApiService {
|
|
|
7614
7545
|
update(workspace) {
|
|
7615
7546
|
const { store } = this.client;
|
|
7616
7547
|
store.dispatch(addOrReplaceWorkspaces({ [workspace.offline_id]: workspace }));
|
|
7617
|
-
const promise = this.enqueueRequest({
|
|
7548
|
+
const promise = this.client.enqueueRequest({
|
|
7618
7549
|
description: "Update Workspace",
|
|
7619
7550
|
method: HttpMethod.PATCH,
|
|
7620
7551
|
url: `/workspaces/${workspace.offline_id}/`,
|
|
@@ -7626,7 +7557,7 @@ class WorkspaceService extends BaseApiService {
|
|
|
7626
7557
|
}
|
|
7627
7558
|
delete(workspaceId) {
|
|
7628
7559
|
const { store } = this.client;
|
|
7629
|
-
const promise = this.enqueueRequest({
|
|
7560
|
+
const promise = this.client.enqueueRequest({
|
|
7630
7561
|
description: "Delete Workspace",
|
|
7631
7562
|
method: HttpMethod.DELETE,
|
|
7632
7563
|
url: `/workspaces/${workspaceId}/`,
|
|
@@ -7648,7 +7579,7 @@ class WorkspaceService extends BaseApiService {
|
|
|
7648
7579
|
}
|
|
7649
7580
|
class OrganizationAccessService extends BaseApiService {
|
|
7650
7581
|
async update(organizationAccess) {
|
|
7651
|
-
const promise = this.enqueueRequest({
|
|
7582
|
+
const promise = this.client.enqueueRequest({
|
|
7652
7583
|
description: "Edit organization access",
|
|
7653
7584
|
method: HttpMethod.PATCH,
|
|
7654
7585
|
url: `/organizations/${organizationAccess.organization}/access/${organizationAccess.offline_id}/`,
|
|
@@ -7664,7 +7595,7 @@ class OrganizationAccessService extends BaseApiService {
|
|
|
7664
7595
|
async remove(organizationAccess) {
|
|
7665
7596
|
this.client.store.dispatch(removeOrganizationAccess(organizationAccess));
|
|
7666
7597
|
this.client.store.dispatch(removeUser(organizationAccess.user));
|
|
7667
|
-
return this.enqueueRequest({
|
|
7598
|
+
return this.client.enqueueRequest({
|
|
7668
7599
|
description: "Remove organization access",
|
|
7669
7600
|
method: HttpMethod.DELETE,
|
|
7670
7601
|
url: `/organizations/${organizationAccess.organization}/access/${organizationAccess.offline_id}/`,
|
|
@@ -7679,7 +7610,7 @@ class OrganizationAccessService extends BaseApiService {
|
|
|
7679
7610
|
if (!organizationId) {
|
|
7680
7611
|
return;
|
|
7681
7612
|
}
|
|
7682
|
-
const result = await this.enqueueRequest({
|
|
7613
|
+
const result = await this.client.enqueueRequest({
|
|
7683
7614
|
description: "Get organization accesses",
|
|
7684
7615
|
method: HttpMethod.GET,
|
|
7685
7616
|
url: `/organizations/${organizationId}/access/`,
|
|
@@ -7711,7 +7642,7 @@ class FileService extends BaseApiService {
|
|
|
7711
7642
|
if (!file)
|
|
7712
7643
|
throw new Error(`File with sha1 ${sha1} not found in cache`);
|
|
7713
7644
|
const key = await getFileS3Key(file, sha1);
|
|
7714
|
-
const s3UploadUrl = await this.enqueueRequest({
|
|
7645
|
+
const s3UploadUrl = await this.client.enqueueRequest({
|
|
7715
7646
|
description: "Get S3 URL",
|
|
7716
7647
|
method: HttpMethod.GET,
|
|
7717
7648
|
url: "/authentication/files/presigned-upload-url/",
|
|
@@ -7795,7 +7726,7 @@ class FileService extends BaseApiService {
|
|
|
7795
7726
|
throw new Error(fileUploadUrlResponse.warning);
|
|
7796
7727
|
}
|
|
7797
7728
|
const url = fileUploadUrlResponse.url;
|
|
7798
|
-
const promise = this.enqueueRequest({
|
|
7729
|
+
const promise = this.client.enqueueRequest({
|
|
7799
7730
|
url,
|
|
7800
7731
|
description: "Upload file",
|
|
7801
7732
|
method: HttpMethod.POST,
|
|
@@ -7837,7 +7768,7 @@ class FileService extends BaseApiService {
|
|
|
7837
7768
|
let isFirstRequest = true;
|
|
7838
7769
|
if (!promise) {
|
|
7839
7770
|
promise = new Promise((resolve) => {
|
|
7840
|
-
void this.enqueueRequest({
|
|
7771
|
+
void this.client.enqueueRequest({
|
|
7841
7772
|
description: "Download file",
|
|
7842
7773
|
method: HttpMethod.GET,
|
|
7843
7774
|
url,
|
|
@@ -7905,7 +7836,7 @@ class EmailVerificationService extends BaseApiService {
|
|
|
7905
7836
|
blockers: [],
|
|
7906
7837
|
blocks: []
|
|
7907
7838
|
};
|
|
7908
|
-
return this.enqueueRequest(requestDetails);
|
|
7839
|
+
return this.client.enqueueRequest(requestDetails);
|
|
7909
7840
|
}
|
|
7910
7841
|
validateVerificationCode(verificationCode, payload = void 0) {
|
|
7911
7842
|
const requestDetails = {
|
|
@@ -7917,12 +7848,12 @@ class EmailVerificationService extends BaseApiService {
|
|
|
7917
7848
|
blockers: [],
|
|
7918
7849
|
blocks: []
|
|
7919
7850
|
};
|
|
7920
|
-
return this.enqueueRequest(requestDetails);
|
|
7851
|
+
return this.client.enqueueRequest(requestDetails);
|
|
7921
7852
|
}
|
|
7922
7853
|
}
|
|
7923
7854
|
class EmailDomainsService extends BaseApiService {
|
|
7924
7855
|
async fetchAll(orgId) {
|
|
7925
|
-
return this.enqueueRequest({
|
|
7856
|
+
return this.client.enqueueRequest({
|
|
7926
7857
|
description: "Fetch email domains for organization",
|
|
7927
7858
|
method: HttpMethod.GET,
|
|
7928
7859
|
url: `/organizations/${orgId}/email-domains/`,
|
|
@@ -7931,7 +7862,7 @@ class EmailDomainsService extends BaseApiService {
|
|
|
7931
7862
|
});
|
|
7932
7863
|
}
|
|
7933
7864
|
async add(orgId, email) {
|
|
7934
|
-
return this.enqueueRequest({
|
|
7865
|
+
return this.client.enqueueRequest({
|
|
7935
7866
|
description: "Add email domain to organization",
|
|
7936
7867
|
method: HttpMethod.POST,
|
|
7937
7868
|
url: `/organizations/${orgId}/email-domains/`,
|
|
@@ -7942,7 +7873,7 @@ class EmailDomainsService extends BaseApiService {
|
|
|
7942
7873
|
}
|
|
7943
7874
|
async remove(emailDomain) {
|
|
7944
7875
|
this.client.store.dispatch(removeEmailDomain(emailDomain));
|
|
7945
|
-
return this.enqueueRequest({
|
|
7876
|
+
return this.client.enqueueRequest({
|
|
7946
7877
|
description: "Remove email domain from organization",
|
|
7947
7878
|
method: HttpMethod.DELETE,
|
|
7948
7879
|
url: `/organizations/${emailDomain.organization}/email-domains/${emailDomain.offline_id}/`,
|
|
@@ -7968,7 +7899,7 @@ class OrganizationService extends BaseApiService {
|
|
|
7968
7899
|
if (showLoading) {
|
|
7969
7900
|
this.client.store.dispatch(setIsFetchingInitialData(true));
|
|
7970
7901
|
}
|
|
7971
|
-
return this.enqueueRequest({
|
|
7902
|
+
return this.client.enqueueRequest({
|
|
7972
7903
|
description: "Get initial organization data",
|
|
7973
7904
|
method: HttpMethod.GET,
|
|
7974
7905
|
url: `/organizations/${organizationId}/initial-data/`,
|
|
@@ -7996,7 +7927,7 @@ class OrganizationService extends BaseApiService {
|
|
|
7996
7927
|
}
|
|
7997
7928
|
}
|
|
7998
7929
|
async create(name) {
|
|
7999
|
-
const result = await this.enqueueRequest({
|
|
7930
|
+
const result = await this.client.enqueueRequest({
|
|
8000
7931
|
description: "Create organization",
|
|
8001
7932
|
method: HttpMethod.POST,
|
|
8002
7933
|
url: "/organizations/",
|
|
@@ -8008,7 +7939,7 @@ class OrganizationService extends BaseApiService {
|
|
|
8008
7939
|
return result;
|
|
8009
7940
|
}
|
|
8010
7941
|
async update(organization) {
|
|
8011
|
-
const promise = this.enqueueRequest({
|
|
7942
|
+
const promise = this.client.enqueueRequest({
|
|
8012
7943
|
description: "Edit organization",
|
|
8013
7944
|
method: HttpMethod.PATCH,
|
|
8014
7945
|
url: `/organizations/${organization.id}/`,
|
|
@@ -8022,7 +7953,7 @@ class OrganizationService extends BaseApiService {
|
|
|
8022
7953
|
});
|
|
8023
7954
|
}
|
|
8024
7955
|
async invite(organizationId, email) {
|
|
8025
|
-
return this.enqueueRequest({
|
|
7956
|
+
return this.client.enqueueRequest({
|
|
8026
7957
|
description: "Invite user to organization",
|
|
8027
7958
|
method: HttpMethod.POST,
|
|
8028
7959
|
url: `/organizations/${organizationId}/invite/${email}/`,
|
|
@@ -8036,7 +7967,7 @@ class LicenseService extends BaseApiService {
|
|
|
8036
7967
|
if (showLoading) {
|
|
8037
7968
|
this.client.store.dispatch(setIsFetchingInitialData(true));
|
|
8038
7969
|
}
|
|
8039
|
-
const result = await this.enqueueRequest({
|
|
7970
|
+
const result = await this.client.enqueueRequest({
|
|
8040
7971
|
description: "Get licenses",
|
|
8041
7972
|
method: HttpMethod.GET,
|
|
8042
7973
|
url: `/organizations/${organizationId}/licenses/`,
|
|
@@ -8051,7 +7982,7 @@ class LicenseService extends BaseApiService {
|
|
|
8051
7982
|
return result;
|
|
8052
7983
|
}
|
|
8053
7984
|
async getLicense(license) {
|
|
8054
|
-
const result = await this.enqueueRequest({
|
|
7985
|
+
const result = await this.client.enqueueRequest({
|
|
8055
7986
|
description: "Get license",
|
|
8056
7987
|
method: HttpMethod.GET,
|
|
8057
7988
|
url: `/billing/${license.offline_id}/`,
|
|
@@ -8065,7 +7996,7 @@ class LicenseService extends BaseApiService {
|
|
|
8065
7996
|
return result;
|
|
8066
7997
|
}
|
|
8067
7998
|
async pauseLicense(license) {
|
|
8068
|
-
const result = await this.enqueueRequest({
|
|
7999
|
+
const result = await this.client.enqueueRequest({
|
|
8069
8000
|
description: "Pause license",
|
|
8070
8001
|
method: HttpMethod.DELETE,
|
|
8071
8002
|
url: `/billing/${license.offline_id}/suspend/`,
|
|
@@ -8079,7 +8010,7 @@ class LicenseService extends BaseApiService {
|
|
|
8079
8010
|
return result;
|
|
8080
8011
|
}
|
|
8081
8012
|
async resumeLicense(license) {
|
|
8082
|
-
const result = await this.enqueueRequest({
|
|
8013
|
+
const result = await this.client.enqueueRequest({
|
|
8083
8014
|
description: "Resume license",
|
|
8084
8015
|
method: HttpMethod.PATCH,
|
|
8085
8016
|
url: `/billing/${license.offline_id}/suspend/`,
|
|
@@ -8093,7 +8024,7 @@ class LicenseService extends BaseApiService {
|
|
|
8093
8024
|
return result;
|
|
8094
8025
|
}
|
|
8095
8026
|
async cancelLicense(license) {
|
|
8096
|
-
const result = await this.enqueueRequest({
|
|
8027
|
+
const result = await this.client.enqueueRequest({
|
|
8097
8028
|
description: "Cancel license",
|
|
8098
8029
|
method: HttpMethod.DELETE,
|
|
8099
8030
|
url: `/billing/${license.offline_id}/`,
|
|
@@ -8107,7 +8038,7 @@ class LicenseService extends BaseApiService {
|
|
|
8107
8038
|
return result;
|
|
8108
8039
|
}
|
|
8109
8040
|
async attachLicenseToProject(license, project) {
|
|
8110
|
-
const result = await this.enqueueRequest({
|
|
8041
|
+
const result = await this.client.enqueueRequest({
|
|
8111
8042
|
description: "Attach license",
|
|
8112
8043
|
method: HttpMethod.PATCH,
|
|
8113
8044
|
url: `/billing/${license.offline_id}/project/`,
|
|
@@ -8123,7 +8054,7 @@ class LicenseService extends BaseApiService {
|
|
|
8123
8054
|
return result;
|
|
8124
8055
|
}
|
|
8125
8056
|
async detachLicenseFromProject(license) {
|
|
8126
|
-
const result = await this.enqueueRequest({
|
|
8057
|
+
const result = await this.client.enqueueRequest({
|
|
8127
8058
|
description: "Detach license",
|
|
8128
8059
|
method: HttpMethod.DELETE,
|
|
8129
8060
|
url: `/billing/${license.offline_id}/project/`,
|
|
@@ -8137,7 +8068,7 @@ class LicenseService extends BaseApiService {
|
|
|
8137
8068
|
return result;
|
|
8138
8069
|
}
|
|
8139
8070
|
async getLatestTransaction(license) {
|
|
8140
|
-
return await this.enqueueRequest({
|
|
8071
|
+
return await this.client.enqueueRequest({
|
|
8141
8072
|
description: "Get latest transaction",
|
|
8142
8073
|
method: HttpMethod.GET,
|
|
8143
8074
|
url: `/billing/${license.offline_id}/transaction/`,
|
|
@@ -8165,7 +8096,7 @@ class DocumentService extends BaseApiService {
|
|
|
8165
8096
|
children_documents: []
|
|
8166
8097
|
};
|
|
8167
8098
|
store.dispatch(addDocuments([submittedDocument]));
|
|
8168
|
-
const promise = this.enqueueRequest({
|
|
8099
|
+
const promise = this.client.enqueueRequest({
|
|
8169
8100
|
description: "Create Document",
|
|
8170
8101
|
method: HttpMethod.POST,
|
|
8171
8102
|
url: `/projects/${activeProjectId}/documents/`,
|
|
@@ -8191,7 +8122,7 @@ class DocumentService extends BaseApiService {
|
|
|
8191
8122
|
);
|
|
8192
8123
|
}
|
|
8193
8124
|
store.dispatch(updateDocuments([document2]));
|
|
8194
|
-
const promise = this.enqueueRequest({
|
|
8125
|
+
const promise = this.client.enqueueRequest({
|
|
8195
8126
|
description: "Update Document",
|
|
8196
8127
|
method: HttpMethod.PATCH,
|
|
8197
8128
|
url: `/documents/${document2.offline_id}/`,
|
|
@@ -8232,7 +8163,7 @@ class DocumentService extends BaseApiService {
|
|
|
8232
8163
|
}
|
|
8233
8164
|
}
|
|
8234
8165
|
store.dispatch(moveDocument({ documentId, targetDocumentId, position }));
|
|
8235
|
-
const promise = this.enqueueRequest({
|
|
8166
|
+
const promise = this.client.enqueueRequest({
|
|
8236
8167
|
description: "Move Document",
|
|
8237
8168
|
method: HttpMethod.PATCH,
|
|
8238
8169
|
url: `/documents/${documentId}/move/`,
|
|
@@ -8261,7 +8192,7 @@ class DocumentService extends BaseApiService {
|
|
|
8261
8192
|
}
|
|
8262
8193
|
const parentDocument = documentToBeDeleted.parent_document ? documentsMapping[documentToBeDeleted.parent_document] : void 0;
|
|
8263
8194
|
store.dispatch(removeDocuments([documentId]));
|
|
8264
|
-
const promise = this.enqueueRequest({
|
|
8195
|
+
const promise = this.client.enqueueRequest({
|
|
8265
8196
|
description: "Delete Document",
|
|
8266
8197
|
method: HttpMethod.DELETE,
|
|
8267
8198
|
url: `/documents/${documentId}/`,
|
|
@@ -8282,7 +8213,7 @@ class DocumentService extends BaseApiService {
|
|
|
8282
8213
|
const { store } = this.client;
|
|
8283
8214
|
const state = store.getState();
|
|
8284
8215
|
const activeProjectId = state.projectReducer.activeProjectId;
|
|
8285
|
-
const projectDocumentsPromise = this.enqueueRequest({
|
|
8216
|
+
const projectDocumentsPromise = this.client.enqueueRequest({
|
|
8286
8217
|
description: "Get project documents",
|
|
8287
8218
|
method: HttpMethod.GET,
|
|
8288
8219
|
url: `/projects/${activeProjectId}/documents/`,
|
|
@@ -8290,7 +8221,7 @@ class DocumentService extends BaseApiService {
|
|
|
8290
8221
|
blocks: []
|
|
8291
8222
|
});
|
|
8292
8223
|
const activeOrganizationId = state.organizationReducer.activeOrganizationId;
|
|
8293
|
-
const organizationDocumentsPromise = this.enqueueRequest({
|
|
8224
|
+
const organizationDocumentsPromise = this.client.enqueueRequest({
|
|
8294
8225
|
description: "Get organization documents",
|
|
8295
8226
|
method: HttpMethod.GET,
|
|
8296
8227
|
url: `/organizations/${activeOrganizationId}/documents/`,
|
|
@@ -8346,7 +8277,7 @@ class DocumentAttachmentService extends BaseAttachmentService {
|
|
|
8346
8277
|
class AgentService extends BaseApiService {
|
|
8347
8278
|
async startConversation(prompt) {
|
|
8348
8279
|
const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
|
|
8349
|
-
return this.enqueueRequest({
|
|
8280
|
+
return this.client.enqueueRequest({
|
|
8350
8281
|
description: "Start agent conversation",
|
|
8351
8282
|
method: HttpMethod.POST,
|
|
8352
8283
|
url: "/agents/prompt/",
|
|
@@ -8372,7 +8303,7 @@ class AgentService extends BaseApiService {
|
|
|
8372
8303
|
async continueConversation(prompt, conversationId) {
|
|
8373
8304
|
const { store } = this.client;
|
|
8374
8305
|
const activeProjectId = store.getState().projectReducer.activeProjectId;
|
|
8375
|
-
return this.enqueueRequest({
|
|
8306
|
+
return this.client.enqueueRequest({
|
|
8376
8307
|
description: "Prompt agent",
|
|
8377
8308
|
method: HttpMethod.POST,
|
|
8378
8309
|
url: "/agents/prompt/",
|
|
@@ -8400,7 +8331,7 @@ class AgentService extends BaseApiService {
|
|
|
8400
8331
|
});
|
|
8401
8332
|
}
|
|
8402
8333
|
async fetchDetails(conversationId) {
|
|
8403
|
-
return this.enqueueRequest({
|
|
8334
|
+
return this.client.enqueueRequest({
|
|
8404
8335
|
description: "Get agent conversation",
|
|
8405
8336
|
method: HttpMethod.GET,
|
|
8406
8337
|
url: `/agents/conversations/${conversationId}/`,
|
|
@@ -8411,7 +8342,7 @@ class AgentService extends BaseApiService {
|
|
|
8411
8342
|
});
|
|
8412
8343
|
}
|
|
8413
8344
|
async rate(responseId, rating) {
|
|
8414
|
-
return this.enqueueRequest({
|
|
8345
|
+
return this.client.enqueueRequest({
|
|
8415
8346
|
description: "Rate agent response",
|
|
8416
8347
|
method: HttpMethod.PUT,
|
|
8417
8348
|
url: `/agents/responses/${responseId}/rate/`,
|
|
@@ -8423,7 +8354,7 @@ class AgentService extends BaseApiService {
|
|
|
8423
8354
|
async refreshStore() {
|
|
8424
8355
|
const { store } = this.client;
|
|
8425
8356
|
const activeProject = store.getState().projectReducer.activeProjectId;
|
|
8426
|
-
const result = await this.enqueueRequest({
|
|
8357
|
+
const result = await this.client.enqueueRequest({
|
|
8427
8358
|
description: "Get agent conversation history",
|
|
8428
8359
|
method: HttpMethod.GET,
|
|
8429
8360
|
url: `/projects/${activeProject}/agent-conversations/`,
|
|
@@ -8449,7 +8380,7 @@ class TeamService extends BaseApiService {
|
|
|
8449
8380
|
// created_by: state.userReducer.currentUser.id,
|
|
8450
8381
|
});
|
|
8451
8382
|
store.dispatch(addTeam(offlineTeam));
|
|
8452
|
-
const promise = this.enqueueRequest({
|
|
8383
|
+
const promise = this.client.enqueueRequest({
|
|
8453
8384
|
description: "Create team",
|
|
8454
8385
|
method: HttpMethod.POST,
|
|
8455
8386
|
url: `/organizations/${activeOrganizationId}/teams/`,
|
|
@@ -8474,7 +8405,7 @@ class TeamService extends BaseApiService {
|
|
|
8474
8405
|
...team
|
|
8475
8406
|
};
|
|
8476
8407
|
store.dispatch(updateTeam(offlineUpdatedTeam));
|
|
8477
|
-
const promise = this.enqueueRequest({
|
|
8408
|
+
const promise = this.client.enqueueRequest({
|
|
8478
8409
|
description: "Update team",
|
|
8479
8410
|
method: HttpMethod.PATCH,
|
|
8480
8411
|
url: `/organizations/teams/${team.offline_id}/`,
|
|
@@ -8498,7 +8429,7 @@ class TeamService extends BaseApiService {
|
|
|
8498
8429
|
}
|
|
8499
8430
|
store.dispatch(deleteTeam(teamId));
|
|
8500
8431
|
try {
|
|
8501
|
-
return await this.enqueueRequest({
|
|
8432
|
+
return await this.client.enqueueRequest({
|
|
8502
8433
|
description: "Delete team",
|
|
8503
8434
|
method: HttpMethod.DELETE,
|
|
8504
8435
|
url: `/organizations/teams/${teamId}/`,
|
|
@@ -8520,7 +8451,7 @@ class TeamService extends BaseApiService {
|
|
|
8520
8451
|
throw new Error("Duplicate members found in the list");
|
|
8521
8452
|
}
|
|
8522
8453
|
store.dispatch(updateTeam({ ...team, members }));
|
|
8523
|
-
const promise = this.enqueueRequest({
|
|
8454
|
+
const promise = this.client.enqueueRequest({
|
|
8524
8455
|
description: "Set team members",
|
|
8525
8456
|
method: HttpMethod.PUT,
|
|
8526
8457
|
url: `/organizations/teams/${teamId}/set-members/`,
|
|
@@ -8559,7 +8490,7 @@ class TeamService extends BaseApiService {
|
|
|
8559
8490
|
if (!activeOrganizationId) {
|
|
8560
8491
|
throw new Error(`Expected active organization to be set, got ${activeOrganizationId}`);
|
|
8561
8492
|
}
|
|
8562
|
-
const result = await this.enqueueRequest({
|
|
8493
|
+
const result = await this.client.enqueueRequest({
|
|
8563
8494
|
description: "Fetch teams",
|
|
8564
8495
|
method: HttpMethod.GET,
|
|
8565
8496
|
url: `/organizations/${activeOrganizationId}/teams/`,
|
|
@@ -8569,6 +8500,46 @@ class TeamService extends BaseApiService {
|
|
|
8569
8500
|
store.dispatch(setTeams(result));
|
|
8570
8501
|
}
|
|
8571
8502
|
}
|
|
8503
|
+
class DeferredPromise {
|
|
8504
|
+
constructor() {
|
|
8505
|
+
__publicField(this, _a, "Promise");
|
|
8506
|
+
__publicField(this, "_promise");
|
|
8507
|
+
__publicField(this, "_resolve");
|
|
8508
|
+
__publicField(this, "_reject");
|
|
8509
|
+
__publicField(this, "_state", "pending");
|
|
8510
|
+
this._resolve = null;
|
|
8511
|
+
this._reject = null;
|
|
8512
|
+
this._promise = new Promise((resolve, reject) => {
|
|
8513
|
+
this._resolve = resolve;
|
|
8514
|
+
this._reject = reject;
|
|
8515
|
+
});
|
|
8516
|
+
}
|
|
8517
|
+
get state() {
|
|
8518
|
+
return this._state;
|
|
8519
|
+
}
|
|
8520
|
+
then(onFulfilled, onRejected) {
|
|
8521
|
+
return this._promise.then(onFulfilled, onRejected);
|
|
8522
|
+
}
|
|
8523
|
+
catch(onRejected) {
|
|
8524
|
+
return this._promise.catch(onRejected);
|
|
8525
|
+
}
|
|
8526
|
+
resolve(value) {
|
|
8527
|
+
if (!this._resolve)
|
|
8528
|
+
throw new Error("No resolve callback");
|
|
8529
|
+
this._resolve(value);
|
|
8530
|
+
this._state = "fulfilled";
|
|
8531
|
+
}
|
|
8532
|
+
reject(reason) {
|
|
8533
|
+
if (!this._reject)
|
|
8534
|
+
throw reason;
|
|
8535
|
+
this._reject(reason);
|
|
8536
|
+
this._state = "rejected";
|
|
8537
|
+
}
|
|
8538
|
+
finally(_onFinally) {
|
|
8539
|
+
throw new Error("`finally` not implemented");
|
|
8540
|
+
}
|
|
8541
|
+
}
|
|
8542
|
+
_a = Symbol.toStringTag;
|
|
8572
8543
|
class OvermapSDK {
|
|
8573
8544
|
constructor(apiUrl, store) {
|
|
8574
8545
|
__publicField(this, "API_URL");
|
|
@@ -8587,12 +8558,12 @@ class OvermapSDK {
|
|
|
8587
8558
|
__publicField(this, "issueAttachments", new IssueAttachmentService(this));
|
|
8588
8559
|
__publicField(this, "workspaces", new WorkspaceService(this));
|
|
8589
8560
|
__publicField(this, "main", new MainService(this));
|
|
8590
|
-
__publicField(this, "
|
|
8591
|
-
__publicField(this, "
|
|
8592
|
-
__publicField(this, "
|
|
8593
|
-
__publicField(this, "
|
|
8594
|
-
__publicField(this, "
|
|
8595
|
-
__publicField(this, "
|
|
8561
|
+
__publicField(this, "components", new ComponentService(this));
|
|
8562
|
+
__publicField(this, "componentAttachments", new ComponentAttachmentService(this));
|
|
8563
|
+
__publicField(this, "componentTypes", new ComponentTypeService(this));
|
|
8564
|
+
__publicField(this, "componentTypeAttachments", new ComponentTypeAttachmentService(this));
|
|
8565
|
+
__publicField(this, "componentStages", new ComponentStageService(this));
|
|
8566
|
+
__publicField(this, "componentStageCompletions", new ComponentStageCompletionService(this));
|
|
8596
8567
|
__publicField(this, "userForms", new UserFormService(this));
|
|
8597
8568
|
__publicField(this, "userFormSubmissions", new UserFormSubmissionService(this));
|
|
8598
8569
|
__publicField(this, "projects", new ProjectService(this));
|
|
@@ -8607,6 +8578,87 @@ class OvermapSDK {
|
|
|
8607
8578
|
this.API_URL = apiUrl;
|
|
8608
8579
|
this.store = store;
|
|
8609
8580
|
}
|
|
8581
|
+
/**
|
|
8582
|
+
* Enqueues an API request to the offline outbox.
|
|
8583
|
+
* @param requestDetails An SDKRequest object containing the details of the request.
|
|
8584
|
+
* @protected
|
|
8585
|
+
*/
|
|
8586
|
+
async enqueueRequest(requestDetails) {
|
|
8587
|
+
return this._enqueueRequest(requestDetails).then((result) => {
|
|
8588
|
+
if (result instanceof APIError) {
|
|
8589
|
+
throw result;
|
|
8590
|
+
}
|
|
8591
|
+
return result;
|
|
8592
|
+
});
|
|
8593
|
+
}
|
|
8594
|
+
/**
|
|
8595
|
+
* Enqueues an API request to the Redux Offline outbox
|
|
8596
|
+
* @protected
|
|
8597
|
+
*/
|
|
8598
|
+
_enqueueRequest(requestDetails) {
|
|
8599
|
+
const promise = new DeferredPromise();
|
|
8600
|
+
const requestDetailsWithBaseUrl = { ...requestDetails, BASE_URL: this.API_URL };
|
|
8601
|
+
if (requestDetails.immediate) {
|
|
8602
|
+
const requestWithUuid = {
|
|
8603
|
+
...requestDetailsWithBaseUrl,
|
|
8604
|
+
uuid: requestDetails.uuid ?? v4()
|
|
8605
|
+
};
|
|
8606
|
+
const fullOfflineAction = {
|
|
8607
|
+
payload: requestWithUuid,
|
|
8608
|
+
type: "",
|
|
8609
|
+
meta: {
|
|
8610
|
+
offline: {
|
|
8611
|
+
effect: {
|
|
8612
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
8613
|
+
request: requestWithUuid,
|
|
8614
|
+
BASE_URL: this.API_URL
|
|
8615
|
+
}
|
|
8616
|
+
}
|
|
8617
|
+
}
|
|
8618
|
+
};
|
|
8619
|
+
performRequest(fullOfflineAction, this).then((result) => {
|
|
8620
|
+
promise.resolve(result.body);
|
|
8621
|
+
}).catch((error2) => {
|
|
8622
|
+
discard(error2, fullOfflineAction);
|
|
8623
|
+
promise.reject(error2);
|
|
8624
|
+
});
|
|
8625
|
+
} else {
|
|
8626
|
+
const innerPromise = this.store.dispatch(
|
|
8627
|
+
enqueueRequest(requestDetailsWithBaseUrl)
|
|
8628
|
+
);
|
|
8629
|
+
const successOrUndefinedHandler = (response) => {
|
|
8630
|
+
if (response) {
|
|
8631
|
+
promise.resolve(response.body);
|
|
8632
|
+
} else {
|
|
8633
|
+
const error2 = new APIError({
|
|
8634
|
+
message: "Could not get a response from the server.",
|
|
8635
|
+
response,
|
|
8636
|
+
discard: true
|
|
8637
|
+
});
|
|
8638
|
+
promise.reject(error2);
|
|
8639
|
+
}
|
|
8640
|
+
};
|
|
8641
|
+
const errorHandler = (error2) => {
|
|
8642
|
+
if (error2 instanceof APIError) {
|
|
8643
|
+
error2.options.discard = true;
|
|
8644
|
+
} else {
|
|
8645
|
+
console.error(
|
|
8646
|
+
"Received an unexpected error while processing a request:",
|
|
8647
|
+
error2,
|
|
8648
|
+
"\nConverting error to APIError and discarding."
|
|
8649
|
+
);
|
|
8650
|
+
error2 = new APIError({
|
|
8651
|
+
message: "An error occurred while processing the request.",
|
|
8652
|
+
innerError: error2,
|
|
8653
|
+
discard: true
|
|
8654
|
+
});
|
|
8655
|
+
}
|
|
8656
|
+
promise.reject(error2);
|
|
8657
|
+
};
|
|
8658
|
+
innerPromise.then(successOrUndefinedHandler, errorHandler);
|
|
8659
|
+
}
|
|
8660
|
+
return promise;
|
|
8661
|
+
}
|
|
8610
8662
|
}
|
|
8611
8663
|
const makeClient = (apiUrl, store) => new OvermapSDK(apiUrl, store);
|
|
8612
8664
|
const SDKContext = React__default.createContext({});
|
|
@@ -15223,9 +15275,9 @@ const FormBrowser = memo(
|
|
|
15223
15275
|
}, [filter, maxResults, ownerFilter]);
|
|
15224
15276
|
const userForms = useAppSelector(selectFilteredForms(ownerFilterOptions)) ?? [];
|
|
15225
15277
|
const userFormMapping = useAppSelector(selectFormMapping);
|
|
15226
|
-
const attachableUserForms = userForms.filter((form) => !form.
|
|
15278
|
+
const attachableUserForms = userForms.filter((form) => !form.component_type && !form.issue_type);
|
|
15227
15279
|
const attachableUserFormMapping = Object.values(userFormMapping).filter(
|
|
15228
|
-
(form) => !form.
|
|
15280
|
+
(form) => !form.component_type
|
|
15229
15281
|
);
|
|
15230
15282
|
const handleToggleFavorite = useCallback(
|
|
15231
15283
|
(form) => {
|
|
@@ -16630,13 +16682,6 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
16630
16682
|
export {
|
|
16631
16683
|
APIError,
|
|
16632
16684
|
AgentService,
|
|
16633
|
-
AssetAttachmentService,
|
|
16634
|
-
AssetService,
|
|
16635
|
-
AssetStageColors,
|
|
16636
|
-
AssetStageCompletionService,
|
|
16637
|
-
AssetStageService,
|
|
16638
|
-
AssetTypeAttachmentService,
|
|
16639
|
-
AssetTypeService,
|
|
16640
16685
|
AttachmentModel,
|
|
16641
16686
|
AuthService,
|
|
16642
16687
|
BaseApiService,
|
|
@@ -16648,6 +16693,13 @@ export {
|
|
|
16648
16693
|
ColorPicker,
|
|
16649
16694
|
Colors,
|
|
16650
16695
|
ColorsToString,
|
|
16696
|
+
ComponentAttachmentService,
|
|
16697
|
+
ComponentService,
|
|
16698
|
+
ComponentStageColors,
|
|
16699
|
+
ComponentStageCompletionService,
|
|
16700
|
+
ComponentStageService,
|
|
16701
|
+
ComponentTypeAttachmentService,
|
|
16702
|
+
ComponentTypeService,
|
|
16651
16703
|
DEFAULT_ISSUE_PRIORITY,
|
|
16652
16704
|
DEFAULT_ISSUE_STATUS,
|
|
16653
16705
|
DateField,
|
|
@@ -16739,14 +16791,14 @@ export {
|
|
|
16739
16791
|
acceptProjectInvite,
|
|
16740
16792
|
addActiveProjectFormSubmissionsCount,
|
|
16741
16793
|
addActiveProjectIssuesCount,
|
|
16742
|
-
addAsset,
|
|
16743
|
-
addAssetAttachment,
|
|
16744
|
-
addAssetAttachments,
|
|
16745
|
-
addAssetType,
|
|
16746
|
-
addAssetTypeAttachment,
|
|
16747
|
-
addAssetTypeAttachments,
|
|
16748
|
-
addAssetsInBatches,
|
|
16749
16794
|
addCategory,
|
|
16795
|
+
addComponent,
|
|
16796
|
+
addComponentAttachment,
|
|
16797
|
+
addComponentAttachments,
|
|
16798
|
+
addComponentType,
|
|
16799
|
+
addComponentTypeAttachment,
|
|
16800
|
+
addComponentTypeAttachments,
|
|
16801
|
+
addComponentsInBatches,
|
|
16750
16802
|
addConversation,
|
|
16751
16803
|
addDocumentAttachment,
|
|
16752
16804
|
addDocumentAttachments,
|
|
@@ -16791,14 +16843,6 @@ export {
|
|
|
16791
16843
|
agentsReducer,
|
|
16792
16844
|
agentsSlice,
|
|
16793
16845
|
areArraysEqual,
|
|
16794
|
-
assetReducer,
|
|
16795
|
-
assetSlice,
|
|
16796
|
-
assetStageCompletionReducer,
|
|
16797
|
-
assetStageCompletionSlice,
|
|
16798
|
-
assetStageReducer,
|
|
16799
|
-
assetStageSlice,
|
|
16800
|
-
assetTypeReducer,
|
|
16801
|
-
assetTypeSlice,
|
|
16802
16846
|
authReducer,
|
|
16803
16847
|
authSlice,
|
|
16804
16848
|
blobToBase64,
|
|
@@ -16808,6 +16852,14 @@ export {
|
|
|
16808
16852
|
classNames$1 as classNames,
|
|
16809
16853
|
cleanRecentIssues,
|
|
16810
16854
|
clearTokens,
|
|
16855
|
+
componentReducer,
|
|
16856
|
+
componentSlice,
|
|
16857
|
+
componentStageCompletionReducer,
|
|
16858
|
+
componentStageCompletionSlice,
|
|
16859
|
+
componentStageReducer,
|
|
16860
|
+
componentStageSlice,
|
|
16861
|
+
componentTypeReducer,
|
|
16862
|
+
componentTypeSlice,
|
|
16811
16863
|
constructUploadedFilePayloads,
|
|
16812
16864
|
coordinatesAreEqual,
|
|
16813
16865
|
coordinatesToLiteral,
|
|
@@ -16818,7 +16870,7 @@ export {
|
|
|
16818
16870
|
createPointMarker,
|
|
16819
16871
|
defaultBadgeColor,
|
|
16820
16872
|
defaultStore,
|
|
16821
|
-
|
|
16873
|
+
deleteComponentType,
|
|
16822
16874
|
deleteForm,
|
|
16823
16875
|
deleteFormRevision,
|
|
16824
16876
|
deleteFormRevisionAttachment,
|
|
@@ -16867,7 +16919,7 @@ export {
|
|
|
16867
16919
|
formSubmissionReducer,
|
|
16868
16920
|
formSubmissionSlice,
|
|
16869
16921
|
index as forms,
|
|
16870
|
-
|
|
16922
|
+
fullComponentMarkerSize,
|
|
16871
16923
|
generateBadgeColors,
|
|
16872
16924
|
genericMemo,
|
|
16873
16925
|
getFileIdentifier,
|
|
@@ -16927,15 +16979,15 @@ export {
|
|
|
16927
16979
|
projectSlice,
|
|
16928
16980
|
rehydratedReducer,
|
|
16929
16981
|
rehydratedSlice,
|
|
16930
|
-
|
|
16931
|
-
removeAsset,
|
|
16932
|
-
removeAssetAttachment,
|
|
16933
|
-
removeAssetAttachments,
|
|
16934
|
-
removeAssetTypeAttachment,
|
|
16935
|
-
removeAssetTypeAttachments,
|
|
16982
|
+
removeAllComponentsOfType,
|
|
16936
16983
|
removeAttachmentsOfIssue,
|
|
16937
16984
|
removeCategory,
|
|
16938
16985
|
removeColor,
|
|
16986
|
+
removeComponent,
|
|
16987
|
+
removeComponentAttachment,
|
|
16988
|
+
removeComponentAttachments,
|
|
16989
|
+
removeComponentTypeAttachment,
|
|
16990
|
+
removeComponentTypeAttachments,
|
|
16939
16991
|
removeDocumentAttachment,
|
|
16940
16992
|
removeDocumentAttachments,
|
|
16941
16993
|
removeDocuments,
|
|
@@ -16986,31 +17038,16 @@ export {
|
|
|
16986
17038
|
selectActiveWorkspace,
|
|
16987
17039
|
selectActiveWorkspaceId,
|
|
16988
17040
|
selectAllAttachments,
|
|
17041
|
+
selectAllComponentAttachments,
|
|
17042
|
+
selectAllComponentTypeAttachments,
|
|
16989
17043
|
selectAllDocumentAttachments,
|
|
16990
17044
|
selectAllProjectAttachments,
|
|
16991
17045
|
selectAncestorIdsOfDocument,
|
|
16992
17046
|
selectAppearance,
|
|
16993
|
-
|
|
16994
|
-
|
|
16995
|
-
|
|
16996
|
-
|
|
16997
|
-
selectAssetToAssetTypeMapping,
|
|
16998
|
-
selectAssetType,
|
|
16999
|
-
selectAssetTypeAttachment,
|
|
17000
|
-
selectAssetTypeAttachmentMapping,
|
|
17001
|
-
selectAssetTypeAttachments,
|
|
17002
|
-
selectAssetTypeStagesMapping,
|
|
17003
|
-
selectAssetTypes,
|
|
17004
|
-
selectAssetTypesByName,
|
|
17005
|
-
selectAssetTypesFromIds,
|
|
17006
|
-
selectAssetTypesMapping,
|
|
17007
|
-
selectAssets,
|
|
17008
|
-
selectAssetsMapping,
|
|
17009
|
-
selectAssetsOfAssetType,
|
|
17010
|
-
selectAttachmentsOfAsset,
|
|
17011
|
-
selectAttachmentsOfAssetType,
|
|
17012
|
-
selectAttachmentsOfAssetTypeByType,
|
|
17013
|
-
selectAttachmentsOfAssetsByType,
|
|
17047
|
+
selectAttachmentsOfComponent,
|
|
17048
|
+
selectAttachmentsOfComponentByType,
|
|
17049
|
+
selectAttachmentsOfComponentType,
|
|
17050
|
+
selectAttachmentsOfComponentTypeByType,
|
|
17014
17051
|
selectAttachmentsOfDocument,
|
|
17015
17052
|
selectAttachmentsOfDocumentByType,
|
|
17016
17053
|
selectAttachmentsOfFormRevision,
|
|
@@ -17027,8 +17064,25 @@ export {
|
|
|
17027
17064
|
selectCenterMapToProject,
|
|
17028
17065
|
selectCommentMapping,
|
|
17029
17066
|
selectCommentsOfIssue,
|
|
17030
|
-
|
|
17067
|
+
selectCompletedStageIdsForComponent,
|
|
17031
17068
|
selectCompletedStages,
|
|
17069
|
+
selectComponent,
|
|
17070
|
+
selectComponentAttachment,
|
|
17071
|
+
selectComponentAttachmentMapping,
|
|
17072
|
+
selectComponentType,
|
|
17073
|
+
selectComponentTypeAttachment,
|
|
17074
|
+
selectComponentTypeAttachmentMapping,
|
|
17075
|
+
selectComponentTypeFromComponent,
|
|
17076
|
+
selectComponentTypeFromComponents,
|
|
17077
|
+
selectComponentTypeStagesMapping,
|
|
17078
|
+
selectComponentTypes,
|
|
17079
|
+
selectComponentTypesByName,
|
|
17080
|
+
selectComponentTypesFromIds,
|
|
17081
|
+
selectComponentTypesMapping,
|
|
17082
|
+
selectComponents,
|
|
17083
|
+
selectComponentsByType,
|
|
17084
|
+
selectComponentsFromComponentType,
|
|
17085
|
+
selectComponentsMapping,
|
|
17032
17086
|
selectConversation,
|
|
17033
17087
|
selectConversationMapping,
|
|
17034
17088
|
selectConversations,
|
|
@@ -17053,7 +17107,7 @@ export {
|
|
|
17053
17107
|
selectFilteredForms,
|
|
17054
17108
|
selectForm,
|
|
17055
17109
|
selectFormMapping,
|
|
17056
|
-
|
|
17110
|
+
selectFormOfComponentType,
|
|
17057
17111
|
selectFormOfIssueType,
|
|
17058
17112
|
selectFormRevision,
|
|
17059
17113
|
selectFormRevisionMapping,
|
|
@@ -17062,16 +17116,16 @@ export {
|
|
|
17062
17116
|
selectFormSubmission,
|
|
17063
17117
|
selectFormSubmissionAttachmentsMapping,
|
|
17064
17118
|
selectFormSubmissions,
|
|
17065
|
-
|
|
17119
|
+
selectFormSubmissionsByComponents,
|
|
17066
17120
|
selectFormSubmissionsByFormRevisions,
|
|
17067
17121
|
selectFormSubmissionsMapping,
|
|
17068
|
-
|
|
17122
|
+
selectFormSubmissionsOfComponent,
|
|
17069
17123
|
selectFormSubmissionsOfForm,
|
|
17070
17124
|
selectFormSubmissionsOfIssue,
|
|
17071
17125
|
selectFormsCount,
|
|
17072
17126
|
selectGeneralFormCount,
|
|
17073
|
-
selectHiddenAssetTypeIds,
|
|
17074
17127
|
selectHiddenCategoryCount,
|
|
17128
|
+
selectHiddenComponentTypeIds,
|
|
17075
17129
|
selectIsFetchingInitialData,
|
|
17076
17130
|
selectIsImportingProjectFile,
|
|
17077
17131
|
selectIsLoading,
|
|
@@ -17093,7 +17147,7 @@ export {
|
|
|
17093
17147
|
selectIssuesOfIssueTypeCount,
|
|
17094
17148
|
selectLatestFormRevisionByForm,
|
|
17095
17149
|
selectLatestFormRevisionOfForm,
|
|
17096
|
-
|
|
17150
|
+
selectLatestFormRevisionsOfComponentTypes,
|
|
17097
17151
|
selectLatestRetryTime,
|
|
17098
17152
|
selectLicense,
|
|
17099
17153
|
selectLicenseForProject,
|
|
@@ -17101,8 +17155,8 @@ export {
|
|
|
17101
17155
|
selectLicensesForProjectsMapping,
|
|
17102
17156
|
selectMainWorkspace,
|
|
17103
17157
|
selectMapStyle,
|
|
17104
|
-
|
|
17105
|
-
|
|
17158
|
+
selectNumberOfComponentTypesMatchingCaseInsensitiveName,
|
|
17159
|
+
selectNumberOfComponentsOfComponentType,
|
|
17106
17160
|
selectOrganization,
|
|
17107
17161
|
selectOrganizationAccess,
|
|
17108
17162
|
selectOrganizationAccessForUser,
|
|
@@ -17143,9 +17197,9 @@ export {
|
|
|
17143
17197
|
selectStageFormIdsFromStageIds,
|
|
17144
17198
|
selectStageMapping,
|
|
17145
17199
|
selectStages,
|
|
17146
|
-
|
|
17200
|
+
selectStagesFromComponentType,
|
|
17201
|
+
selectStagesFromComponentTypeIds,
|
|
17147
17202
|
selectStagesFromStageIds,
|
|
17148
|
-
selectStagesOfAssetType,
|
|
17149
17203
|
selectTeam,
|
|
17150
17204
|
selectTeams,
|
|
17151
17205
|
selectTeamsMapping,
|
|
@@ -17167,14 +17221,14 @@ export {
|
|
|
17167
17221
|
setActiveProjectId,
|
|
17168
17222
|
setActiveWorkspaceId,
|
|
17169
17223
|
setAppearance,
|
|
17170
|
-
setAssetAttachment,
|
|
17171
|
-
setAssetAttachments,
|
|
17172
|
-
setAssetTypeAttachment,
|
|
17173
|
-
setAssetTypeAttachments,
|
|
17174
|
-
setAssetTypes,
|
|
17175
|
-
setAssets,
|
|
17176
17224
|
setCategories,
|
|
17177
17225
|
setCenterMapToProject,
|
|
17226
|
+
setComponentAttachment,
|
|
17227
|
+
setComponentAttachments,
|
|
17228
|
+
setComponentTypeAttachment,
|
|
17229
|
+
setComponentTypeAttachments,
|
|
17230
|
+
setComponentTypes,
|
|
17231
|
+
setComponents,
|
|
17178
17232
|
setConversation,
|
|
17179
17233
|
setConversations,
|
|
17180
17234
|
setCreateProjectType,
|
|
@@ -17237,18 +17291,18 @@ export {
|
|
|
17237
17291
|
teamSlice,
|
|
17238
17292
|
toFileNameSafeString,
|
|
17239
17293
|
toOfflineIdRecord,
|
|
17240
|
-
|
|
17294
|
+
toggleComponentTypeVisibility,
|
|
17241
17295
|
truncate,
|
|
17242
17296
|
unfavoriteForm,
|
|
17243
17297
|
unhideAllCategories,
|
|
17244
17298
|
unhideCategory,
|
|
17245
17299
|
unlinkStageToForm,
|
|
17246
17300
|
updateActiveOrganization,
|
|
17247
|
-
|
|
17248
|
-
|
|
17249
|
-
|
|
17250
|
-
|
|
17251
|
-
|
|
17301
|
+
updateComponent,
|
|
17302
|
+
updateComponentAttachment,
|
|
17303
|
+
updateComponentAttachments,
|
|
17304
|
+
updateComponentTypeAttachment,
|
|
17305
|
+
updateComponentTypeAttachments,
|
|
17252
17306
|
updateConversation,
|
|
17253
17307
|
updateDocumentAttachment,
|
|
17254
17308
|
updateDocumentAttachments,
|