@overmap-ai/core 1.0.49-update-presigned-url-payload.1 → 1.0.50-bulk-form-submission.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/dist/forms/renderer/FormSubmissionBrowser/FormSubmissionBrowser.d.ts +5 -5
- package/dist/forms/renderer/FormSubmissionViewer/FormSubmissionViewer.d.ts +3 -3
- package/dist/overmap-core.js +889 -455
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +889 -455
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/services/AttachmentService.d.ts +9 -7
- package/dist/sdk/services/UserFormSubmissionService.d.ts +9 -2
- package/dist/store/slices/categorySlice.d.ts +3 -1
- package/dist/store/slices/componentSlice.d.ts +1 -0
- package/dist/store/slices/componentTypeSlice.d.ts +1 -0
- package/dist/store/slices/documentSlice.d.ts +38 -3
- package/dist/store/slices/formRevisionSlice.d.ts +73 -0
- package/dist/store/slices/formSlice.d.ts +118 -0
- package/dist/store/slices/formSubmissionSlice.d.ts +47 -0
- package/dist/store/slices/index.d.ts +3 -1
- package/dist/store/slices/issueSlice.d.ts +13 -2
- package/dist/store/slices/projectFileSlice.d.ts +3 -1
- package/dist/store/slices/utils.d.ts +1 -0
- package/dist/store/slices/workspaceSlice.d.ts +3 -1
- package/dist/store/store.d.ts +10 -4
- package/dist/typings/files.d.ts +11 -1
- package/dist/typings/models/attachments.d.ts +11 -10
- package/dist/typings/models/base.d.ts +7 -0
- package/dist/typings/models/forms.d.ts +6 -11
- package/dist/utils/file.d.ts +2 -0
- package/package.json +1 -1
- package/dist/store/slices/userFormSlice.d.ts +0 -145
|
@@ -622,15 +622,15 @@ var __publicField = (obj, key, value) => {
|
|
|
622
622
|
};
|
|
623
623
|
const migrations = [initialVersioning, signOut, signOut, createOutboxState];
|
|
624
624
|
const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
|
|
625
|
-
const initialState$
|
|
625
|
+
const initialState$p = {
|
|
626
626
|
accessToken: "",
|
|
627
627
|
refreshToken: "",
|
|
628
628
|
isLoggedIn: false
|
|
629
629
|
};
|
|
630
630
|
const authSlice = toolkit.createSlice({
|
|
631
631
|
name: "auth",
|
|
632
|
-
initialState: initialState$
|
|
633
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
632
|
+
initialState: initialState$p,
|
|
633
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
|
|
634
634
|
reducers: {
|
|
635
635
|
setTokens: (state, action) => {
|
|
636
636
|
state.accessToken = action.payload.accessToken;
|
|
@@ -795,6 +795,19 @@ var __publicField = (obj, key, value) => {
|
|
|
795
795
|
element.click();
|
|
796
796
|
document.body.removeChild(element);
|
|
797
797
|
}
|
|
798
|
+
const constructUploadedFilePayloads = async (files) => {
|
|
799
|
+
const filePayloads = {};
|
|
800
|
+
for (const file of files) {
|
|
801
|
+
const sha1 = await hashFile(file);
|
|
802
|
+
filePayloads[sha1] = {
|
|
803
|
+
sha1,
|
|
804
|
+
extension: file.name.split(".").pop() || "",
|
|
805
|
+
file_type: file.type,
|
|
806
|
+
size: file.size
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
return Object.values(filePayloads);
|
|
810
|
+
};
|
|
798
811
|
const fileToBlob = async (dataUrl) => {
|
|
799
812
|
return (await fetch(dataUrl)).blob();
|
|
800
813
|
};
|
|
@@ -1361,7 +1374,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1361
1374
|
return getLocalDateString(date);
|
|
1362
1375
|
return relative.format(days, "days");
|
|
1363
1376
|
});
|
|
1364
|
-
const initialState$
|
|
1377
|
+
const initialState$o = {
|
|
1365
1378
|
categories: {},
|
|
1366
1379
|
usedCategoryColors: [],
|
|
1367
1380
|
categoryVisibility: {
|
|
@@ -1371,8 +1384,8 @@ var __publicField = (obj, key, value) => {
|
|
|
1371
1384
|
};
|
|
1372
1385
|
const categorySlice = toolkit.createSlice({
|
|
1373
1386
|
name: "categories",
|
|
1374
|
-
initialState: initialState$
|
|
1375
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1387
|
+
initialState: initialState$o,
|
|
1388
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
|
|
1376
1389
|
reducers: {
|
|
1377
1390
|
setCategories: (state, action) => {
|
|
1378
1391
|
if (!Array.isArray(action.payload))
|
|
@@ -1506,6 +1519,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1506
1519
|
};
|
|
1507
1520
|
const categoryReducer = categorySlice.reducer;
|
|
1508
1521
|
function setAttachments(state, action) {
|
|
1522
|
+
state.attachments = {};
|
|
1509
1523
|
for (const attachment of action.payload) {
|
|
1510
1524
|
state.attachments[attachment.offline_id] = attachment;
|
|
1511
1525
|
}
|
|
@@ -1528,6 +1542,15 @@ var __publicField = (obj, key, value) => {
|
|
|
1528
1542
|
throw new Error(`Attachment ${action.payload.offline_id} does not exist.`);
|
|
1529
1543
|
}
|
|
1530
1544
|
}
|
|
1545
|
+
function updateAttachments(state, action) {
|
|
1546
|
+
for (const attachment of action.payload) {
|
|
1547
|
+
if (attachment.offline_id in state.attachments) {
|
|
1548
|
+
state.attachments[attachment.offline_id] = attachment;
|
|
1549
|
+
} else {
|
|
1550
|
+
throw new Error(`Attachment ${attachment.offline_id} does not exist.`);
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1531
1554
|
function removeAttachment(state, action) {
|
|
1532
1555
|
if (action.payload in state.attachments) {
|
|
1533
1556
|
delete state.attachments[action.payload];
|
|
@@ -1540,14 +1563,14 @@ var __publicField = (obj, key, value) => {
|
|
|
1540
1563
|
delete state.attachments[attachmentId];
|
|
1541
1564
|
}
|
|
1542
1565
|
}
|
|
1543
|
-
const initialState$
|
|
1566
|
+
const initialState$n = {
|
|
1544
1567
|
components: {},
|
|
1545
1568
|
attachments: {}
|
|
1546
1569
|
};
|
|
1547
1570
|
const componentSlice = toolkit.createSlice({
|
|
1548
1571
|
name: "components",
|
|
1549
|
-
initialState: initialState$
|
|
1550
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1572
|
+
initialState: initialState$n,
|
|
1573
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
|
|
1551
1574
|
reducers: {
|
|
1552
1575
|
addComponent: (state, action) => {
|
|
1553
1576
|
state.components[action.payload.offline_id] = action.payload;
|
|
@@ -1660,6 +1683,9 @@ var __publicField = (obj, key, value) => {
|
|
|
1660
1683
|
[selectComponentAttachmentMapping],
|
|
1661
1684
|
(mapping) => Object.values(mapping)
|
|
1662
1685
|
);
|
|
1686
|
+
const selectComponentAttachment = (attachmentId) => (state) => {
|
|
1687
|
+
return state.componentReducer.attachments[attachmentId];
|
|
1688
|
+
};
|
|
1663
1689
|
const selectAttachmentsOfComponent = restructureCreateSelectorWithArgs(
|
|
1664
1690
|
toolkit.createSelector(
|
|
1665
1691
|
[selectAllComponentAttachments, (_state, componentId) => componentId],
|
|
@@ -1700,13 +1726,13 @@ var __publicField = (obj, key, value) => {
|
|
|
1700
1726
|
removeAllComponentsOfType
|
|
1701
1727
|
} = componentSlice.actions;
|
|
1702
1728
|
const componentReducer = componentSlice.reducer;
|
|
1703
|
-
const initialState$
|
|
1729
|
+
const initialState$m = {
|
|
1704
1730
|
completionsByComponentId: {}
|
|
1705
1731
|
};
|
|
1706
1732
|
const componentStageCompletionSlice = toolkit.createSlice({
|
|
1707
1733
|
name: "componentStageCompletions",
|
|
1708
|
-
initialState: initialState$
|
|
1709
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1734
|
+
initialState: initialState$m,
|
|
1735
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
|
|
1710
1736
|
reducers: {
|
|
1711
1737
|
addStageCompletion: (state, action) => {
|
|
1712
1738
|
let stageToCompletionDateMapping = state.completionsByComponentId[action.payload.component];
|
|
@@ -1757,13 +1783,13 @@ var __publicField = (obj, key, value) => {
|
|
|
1757
1783
|
return Object.keys(state.componentStageCompletionReducer.completionsByComponentId[component.offline_id] ?? {});
|
|
1758
1784
|
};
|
|
1759
1785
|
const componentStageCompletionReducer = componentStageCompletionSlice.reducer;
|
|
1760
|
-
const initialState$
|
|
1786
|
+
const initialState$l = {
|
|
1761
1787
|
stages: {}
|
|
1762
1788
|
};
|
|
1763
1789
|
const componentStageSlice = toolkit.createSlice({
|
|
1764
1790
|
name: "componentStages",
|
|
1765
|
-
initialState: initialState$
|
|
1766
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1791
|
+
initialState: initialState$l,
|
|
1792
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
|
|
1767
1793
|
reducers: {
|
|
1768
1794
|
addStages: (state, action) => {
|
|
1769
1795
|
Object.assign(state.stages, toOfflineIdRecord(action.payload));
|
|
@@ -1873,15 +1899,15 @@ var __publicField = (obj, key, value) => {
|
|
|
1873
1899
|
);
|
|
1874
1900
|
const { addStages, updateStages, removeStages, linkStageToForm, unlinkStageToForm } = componentStageSlice.actions;
|
|
1875
1901
|
const componentStageReducer = componentStageSlice.reducer;
|
|
1876
|
-
const initialState$
|
|
1902
|
+
const initialState$k = {
|
|
1877
1903
|
componentTypes: {},
|
|
1878
1904
|
hiddenComponentTypeIds: {},
|
|
1879
1905
|
attachments: {}
|
|
1880
1906
|
};
|
|
1881
1907
|
const componentTypeSlice = toolkit.createSlice({
|
|
1882
1908
|
name: "componentTypes",
|
|
1883
|
-
initialState: initialState$
|
|
1884
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1909
|
+
initialState: initialState$k,
|
|
1910
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
|
|
1885
1911
|
reducers: {
|
|
1886
1912
|
addComponentType: (state, action) => {
|
|
1887
1913
|
state.componentTypes[action.payload.offline_id] = action.payload;
|
|
@@ -1949,6 +1975,9 @@ var __publicField = (obj, key, value) => {
|
|
|
1949
1975
|
[selectComponentTypeAttachmentMapping],
|
|
1950
1976
|
(mapping) => Object.values(mapping)
|
|
1951
1977
|
);
|
|
1978
|
+
const selectComponentTypeAttachment = (attachmentId) => (state) => {
|
|
1979
|
+
return state.componentTypeReducer.attachments[attachmentId];
|
|
1980
|
+
};
|
|
1952
1981
|
const selectAttachmentsOfComponentType = restructureCreateSelectorWithArgs(
|
|
1953
1982
|
toolkit.createSelector(
|
|
1954
1983
|
[selectAllComponentTypeAttachments, (_state, componentTypeId) => componentTypeId],
|
|
@@ -1989,13 +2018,13 @@ var __publicField = (obj, key, value) => {
|
|
|
1989
2018
|
deleteComponentType
|
|
1990
2019
|
} = componentTypeSlice.actions;
|
|
1991
2020
|
const componentTypeReducer = componentTypeSlice.reducer;
|
|
1992
|
-
const initialState$
|
|
2021
|
+
const initialState$j = {
|
|
1993
2022
|
workspaces: {},
|
|
1994
2023
|
activeWorkspaceId: null
|
|
1995
2024
|
};
|
|
1996
2025
|
const workspaceSlice = toolkit.createSlice({
|
|
1997
2026
|
name: "workspace",
|
|
1998
|
-
initialState: initialState$
|
|
2027
|
+
initialState: initialState$j,
|
|
1999
2028
|
// The `reducers` field lets us define reducers and generate associated actions
|
|
2000
2029
|
reducers: {
|
|
2001
2030
|
setWorkspaces: (state, action) => {
|
|
@@ -2052,7 +2081,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2052
2081
|
);
|
|
2053
2082
|
const workspaceReducer = workspaceSlice.reducer;
|
|
2054
2083
|
const maxRecentIssues = 10;
|
|
2055
|
-
const initialState$
|
|
2084
|
+
const initialState$i = {
|
|
2056
2085
|
issues: {},
|
|
2057
2086
|
attachments: {},
|
|
2058
2087
|
comments: {},
|
|
@@ -2064,9 +2093,9 @@ var __publicField = (obj, key, value) => {
|
|
|
2064
2093
|
};
|
|
2065
2094
|
const issueSlice = toolkit.createSlice({
|
|
2066
2095
|
name: "issues",
|
|
2067
|
-
initialState: initialState$
|
|
2096
|
+
initialState: initialState$i,
|
|
2068
2097
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
2069
|
-
Object.assign(state, initialState$
|
|
2098
|
+
Object.assign(state, initialState$i);
|
|
2070
2099
|
}),
|
|
2071
2100
|
reducers: {
|
|
2072
2101
|
setIssues: (state, action) => {
|
|
@@ -2121,6 +2150,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2121
2150
|
}
|
|
2122
2151
|
},
|
|
2123
2152
|
updateIssueAttachment: updateAttachment,
|
|
2153
|
+
updateIssueAttachments: updateAttachments,
|
|
2124
2154
|
removeIssue: (state, action) => {
|
|
2125
2155
|
if (action.payload in state.issues) {
|
|
2126
2156
|
delete state.issues[action.payload];
|
|
@@ -2129,6 +2159,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2129
2159
|
}
|
|
2130
2160
|
},
|
|
2131
2161
|
removeIssueAttachment: removeAttachment,
|
|
2162
|
+
removeIssueAttachments: removeAttachments,
|
|
2132
2163
|
removeIssueUpdate: (state, action) => {
|
|
2133
2164
|
if (action.payload in state.updates) {
|
|
2134
2165
|
delete state.updates[action.payload];
|
|
@@ -2238,6 +2269,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2238
2269
|
addToRecentIssues,
|
|
2239
2270
|
cleanRecentIssues,
|
|
2240
2271
|
removeIssueAttachment,
|
|
2272
|
+
removeIssueAttachments,
|
|
2241
2273
|
removeAttachmentsOfIssue,
|
|
2242
2274
|
removeIssue,
|
|
2243
2275
|
removeIssueUpdate,
|
|
@@ -2251,6 +2283,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2251
2283
|
setVisibleStatuses,
|
|
2252
2284
|
setVisibleUserIds,
|
|
2253
2285
|
updateIssueAttachment,
|
|
2286
|
+
updateIssueAttachments,
|
|
2254
2287
|
updateIssue,
|
|
2255
2288
|
// Commments
|
|
2256
2289
|
addIssueComment,
|
|
@@ -2343,6 +2376,9 @@ var __publicField = (obj, key, value) => {
|
|
|
2343
2376
|
}
|
|
2344
2377
|
)
|
|
2345
2378
|
);
|
|
2379
|
+
const selectIssueAttachment = (attachmentId) => (root) => {
|
|
2380
|
+
return root.issueReducer.attachments[attachmentId];
|
|
2381
|
+
};
|
|
2346
2382
|
const selectAttachmentsOfIssueByType = restructureCreateSelectorWithArgs(
|
|
2347
2383
|
toolkit.createSelector(
|
|
2348
2384
|
[selectIssueAttachments, (_state, issueId) => issueId],
|
|
@@ -2471,15 +2507,15 @@ var __publicField = (obj, key, value) => {
|
|
|
2471
2507
|
}
|
|
2472
2508
|
);
|
|
2473
2509
|
const issueReducer = issueSlice.reducer;
|
|
2474
|
-
const initialState$
|
|
2510
|
+
const initialState$h = {
|
|
2475
2511
|
s3Urls: {}
|
|
2476
2512
|
};
|
|
2477
2513
|
const msPerHour = 1e3 * 60 * 60;
|
|
2478
2514
|
const msPerWeek = msPerHour * 24 * 7;
|
|
2479
2515
|
const fileSlice = toolkit.createSlice({
|
|
2480
2516
|
name: "file",
|
|
2481
|
-
initialState: initialState$
|
|
2482
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2517
|
+
initialState: initialState$h,
|
|
2518
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
|
|
2483
2519
|
reducers: {
|
|
2484
2520
|
setUploadUrl: (state, action) => {
|
|
2485
2521
|
const { url, fields, sha1 } = action.payload;
|
|
@@ -2506,7 +2542,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2506
2542
|
return url;
|
|
2507
2543
|
};
|
|
2508
2544
|
const fileReducer = fileSlice.reducer;
|
|
2509
|
-
const initialState$
|
|
2545
|
+
const initialState$g = {
|
|
2510
2546
|
// TODO: Change first MapStyle.SATELLITE to MaptStyle.None when project creation map is fixed
|
|
2511
2547
|
mapStyle: MapStyle.SATELLITE,
|
|
2512
2548
|
showTooltips: false,
|
|
@@ -2514,8 +2550,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2514
2550
|
};
|
|
2515
2551
|
const mapSlice = toolkit.createSlice({
|
|
2516
2552
|
name: "map",
|
|
2517
|
-
initialState: initialState$
|
|
2518
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2553
|
+
initialState: initialState$g,
|
|
2554
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
|
|
2519
2555
|
reducers: {
|
|
2520
2556
|
setMapStyle: (state, action) => {
|
|
2521
2557
|
state.mapStyle = action.payload;
|
|
@@ -2584,7 +2620,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2584
2620
|
LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
|
|
2585
2621
|
return LicenseStatus2;
|
|
2586
2622
|
})(LicenseStatus || {});
|
|
2587
|
-
const initialState$
|
|
2623
|
+
const initialState$f = {
|
|
2588
2624
|
users: {},
|
|
2589
2625
|
currentUser: {
|
|
2590
2626
|
id: 0,
|
|
@@ -2595,8 +2631,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2595
2631
|
};
|
|
2596
2632
|
const userSlice = toolkit.createSlice({
|
|
2597
2633
|
name: "users",
|
|
2598
|
-
initialState: initialState$
|
|
2599
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2634
|
+
initialState: initialState$f,
|
|
2635
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
|
|
2600
2636
|
reducers: {
|
|
2601
2637
|
setUsers: (state, action) => {
|
|
2602
2638
|
const usersMapping = {};
|
|
@@ -2658,13 +2694,13 @@ var __publicField = (obj, key, value) => {
|
|
|
2658
2694
|
const selectUsersAsMapping = (state) => state.userReducer.users;
|
|
2659
2695
|
const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
|
|
2660
2696
|
const userReducer = userSlice.reducer;
|
|
2661
|
-
const initialState$
|
|
2697
|
+
const initialState$e = {
|
|
2662
2698
|
organizationAccesses: {}
|
|
2663
2699
|
};
|
|
2664
2700
|
const organizationAccessSlice = toolkit.createSlice({
|
|
2665
2701
|
name: "organizationAccess",
|
|
2666
|
-
initialState: initialState$
|
|
2667
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2702
|
+
initialState: initialState$e,
|
|
2703
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
|
|
2668
2704
|
reducers: {
|
|
2669
2705
|
setOrganizationAccesses: (state, action) => {
|
|
2670
2706
|
if (!Array.isArray(action.payload))
|
|
@@ -2727,13 +2763,13 @@ var __publicField = (obj, key, value) => {
|
|
|
2727
2763
|
return organizationAccesses;
|
|
2728
2764
|
};
|
|
2729
2765
|
const organizationAccessReducer = organizationAccessSlice.reducer;
|
|
2730
|
-
const initialState$
|
|
2766
|
+
const initialState$d = {
|
|
2731
2767
|
licenses: {}
|
|
2732
2768
|
};
|
|
2733
2769
|
const licenseSlice = toolkit.createSlice({
|
|
2734
2770
|
name: "license",
|
|
2735
|
-
initialState: initialState$
|
|
2736
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2771
|
+
initialState: initialState$d,
|
|
2772
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
|
|
2737
2773
|
reducers: {
|
|
2738
2774
|
setLicenses: (state, action) => {
|
|
2739
2775
|
if (!Array.isArray(action.payload))
|
|
@@ -2778,13 +2814,13 @@ var __publicField = (obj, key, value) => {
|
|
|
2778
2814
|
(licenses) => Object.values(licenses).filter((license) => license.project).reduce((accum, license) => ({ ...accum, [license.project]: license }), {})
|
|
2779
2815
|
);
|
|
2780
2816
|
const licenseReducer = licenseSlice.reducer;
|
|
2781
|
-
const initialState$
|
|
2817
|
+
const initialState$c = {
|
|
2782
2818
|
projectAccesses: {}
|
|
2783
2819
|
};
|
|
2784
2820
|
const projectAccessSlice = toolkit.createSlice({
|
|
2785
2821
|
name: "projectAccess",
|
|
2786
|
-
initialState: initialState$
|
|
2787
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2822
|
+
initialState: initialState$c,
|
|
2823
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
|
|
2788
2824
|
reducers: {
|
|
2789
2825
|
setProjectAccesses: (state, action) => {
|
|
2790
2826
|
if (!Array.isArray(action.payload))
|
|
@@ -2852,7 +2888,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2852
2888
|
return projectAccesses;
|
|
2853
2889
|
};
|
|
2854
2890
|
const projectAccessReducer = projectAccessSlice.reducer;
|
|
2855
|
-
const initialState$
|
|
2891
|
+
const initialState$b = {
|
|
2856
2892
|
projects: {},
|
|
2857
2893
|
activeProjectId: null,
|
|
2858
2894
|
recentProjectIds: [],
|
|
@@ -2862,7 +2898,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2862
2898
|
};
|
|
2863
2899
|
const projectSlice = toolkit.createSlice({
|
|
2864
2900
|
name: "projects",
|
|
2865
|
-
initialState: initialState$
|
|
2901
|
+
initialState: initialState$b,
|
|
2866
2902
|
reducers: {
|
|
2867
2903
|
setProjects: (state, action) => {
|
|
2868
2904
|
const projectsMap = {};
|
|
@@ -3049,14 +3085,14 @@ var __publicField = (obj, key, value) => {
|
|
|
3049
3085
|
}
|
|
3050
3086
|
)
|
|
3051
3087
|
);
|
|
3052
|
-
const initialState$
|
|
3088
|
+
const initialState$a = {
|
|
3053
3089
|
organizations: {},
|
|
3054
3090
|
activeOrganizationId: null
|
|
3055
3091
|
};
|
|
3056
3092
|
const organizationSlice = toolkit.createSlice({
|
|
3057
3093
|
name: "organizations",
|
|
3058
|
-
initialState: initialState$
|
|
3059
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3094
|
+
initialState: initialState$a,
|
|
3095
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
|
|
3060
3096
|
reducers: {
|
|
3061
3097
|
setOrganizations: (state, action) => {
|
|
3062
3098
|
for (const org of action.payload) {
|
|
@@ -3175,14 +3211,14 @@ var __publicField = (obj, key, value) => {
|
|
|
3175
3211
|
}
|
|
3176
3212
|
};
|
|
3177
3213
|
};
|
|
3178
|
-
const initialState$
|
|
3214
|
+
const initialState$9 = {
|
|
3179
3215
|
deletedRequests: [],
|
|
3180
3216
|
latestRetryTime: 0
|
|
3181
3217
|
};
|
|
3182
3218
|
const outboxSlice = toolkit.createSlice({
|
|
3183
3219
|
name: "outbox",
|
|
3184
|
-
initialState: initialState$
|
|
3185
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3220
|
+
initialState: initialState$9,
|
|
3221
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$9)),
|
|
3186
3222
|
reducers: {
|
|
3187
3223
|
// enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
|
|
3188
3224
|
// Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
|
|
@@ -3214,7 +3250,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3214
3250
|
const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
|
|
3215
3251
|
const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
|
|
3216
3252
|
const outboxReducer = outboxSlice.reducer;
|
|
3217
|
-
const initialState$
|
|
3253
|
+
const initialState$8 = {
|
|
3218
3254
|
projectFiles: {},
|
|
3219
3255
|
activeProjectFileId: null,
|
|
3220
3256
|
isImportingProjectFile: false,
|
|
@@ -3222,8 +3258,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3222
3258
|
};
|
|
3223
3259
|
const projectFileSlice = toolkit.createSlice({
|
|
3224
3260
|
name: "projectFiles",
|
|
3225
|
-
initialState: initialState$
|
|
3226
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3261
|
+
initialState: initialState$8,
|
|
3262
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
|
|
3227
3263
|
reducers: {
|
|
3228
3264
|
addOrReplaceProjectFiles: (state, action) => {
|
|
3229
3265
|
for (let fileObj of action.payload) {
|
|
@@ -3324,12 +3360,12 @@ var __publicField = (obj, key, value) => {
|
|
|
3324
3360
|
const selectActiveProjectFileId = (state) => state.projectFileReducer.activeProjectFileId;
|
|
3325
3361
|
const selectIsImportingProjectFile = (state) => state.projectFileReducer.isImportingProjectFile;
|
|
3326
3362
|
const projectFileReducer = projectFileSlice.reducer;
|
|
3327
|
-
const initialState$
|
|
3363
|
+
const initialState$7 = {
|
|
3328
3364
|
isRehydrated: false
|
|
3329
3365
|
};
|
|
3330
3366
|
const rehydratedSlice = toolkit.createSlice({
|
|
3331
3367
|
name: "rehydrated",
|
|
3332
|
-
initialState: initialState$
|
|
3368
|
+
initialState: initialState$7,
|
|
3333
3369
|
// The `reducers` field lets us define reducers and generate associated actions
|
|
3334
3370
|
reducers: {
|
|
3335
3371
|
setRehydrated: (state, action) => {
|
|
@@ -3339,7 +3375,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3339
3375
|
});
|
|
3340
3376
|
const selectRehydrated = (state) => state.rehydratedReducer.isRehydrated;
|
|
3341
3377
|
const rehydratedReducer = rehydratedSlice.reducer;
|
|
3342
|
-
const initialState$
|
|
3378
|
+
const initialState$6 = {
|
|
3343
3379
|
useIssueTemplate: false,
|
|
3344
3380
|
placementMode: false,
|
|
3345
3381
|
enableClustering: false,
|
|
@@ -3356,8 +3392,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3356
3392
|
};
|
|
3357
3393
|
const settingSlice = toolkit.createSlice({
|
|
3358
3394
|
name: "settings",
|
|
3359
|
-
initialState: initialState$
|
|
3360
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3395
|
+
initialState: initialState$6,
|
|
3396
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
|
|
3361
3397
|
reducers: {
|
|
3362
3398
|
setEnableDuplicateIssues: (state, action) => {
|
|
3363
3399
|
state.useIssueTemplate = action.payload;
|
|
@@ -3403,146 +3439,248 @@ var __publicField = (obj, key, value) => {
|
|
|
3403
3439
|
const settingReducer = settingSlice.reducer;
|
|
3404
3440
|
const selectIsFetchingInitialData = (state) => state.settingReducer.isFetchingInitialData;
|
|
3405
3441
|
const selectIsLoading = (state) => state.settingReducer.isLoading;
|
|
3406
|
-
const
|
|
3407
|
-
function
|
|
3442
|
+
const LATEST_FORM_REVISION_CACHE = {};
|
|
3443
|
+
function considerCachingFormRevision(formRevision, formId2, preferPending = false) {
|
|
3408
3444
|
var _a2;
|
|
3409
|
-
if (!
|
|
3445
|
+
if (!formRevision) {
|
|
3410
3446
|
if (!formId2) {
|
|
3411
|
-
throw new Error("If revision is null, formId is required.");
|
|
3447
|
+
throw new Error("If form revision is null, formId is required.");
|
|
3412
3448
|
}
|
|
3413
|
-
const
|
|
3414
|
-
if (
|
|
3449
|
+
const currentLatestFormRevision = getLatestFormRevisionFromCache(formId2);
|
|
3450
|
+
if (currentLatestFormRevision)
|
|
3415
3451
|
return;
|
|
3416
|
-
|
|
3452
|
+
LATEST_FORM_REVISION_CACHE[formId2] = null;
|
|
3417
3453
|
return;
|
|
3418
3454
|
}
|
|
3419
|
-
if (
|
|
3455
|
+
if (formRevision.revision === "Pending") {
|
|
3420
3456
|
if (preferPending) {
|
|
3421
|
-
|
|
3457
|
+
LATEST_FORM_REVISION_CACHE[formRevision.form] = formRevision;
|
|
3422
3458
|
}
|
|
3423
3459
|
return;
|
|
3424
3460
|
}
|
|
3425
|
-
const
|
|
3426
|
-
if (
|
|
3427
|
-
|
|
3461
|
+
const cachedFormRevision = (_a2 = LATEST_FORM_REVISION_CACHE[formRevision.form]) == null ? void 0 : _a2.revision;
|
|
3462
|
+
if (formRevision.revision > (typeof cachedFormRevision === "number" ? cachedFormRevision : -1)) {
|
|
3463
|
+
LATEST_FORM_REVISION_CACHE[formRevision.form] = formRevision;
|
|
3428
3464
|
}
|
|
3429
3465
|
}
|
|
3430
|
-
function
|
|
3431
|
-
return
|
|
3466
|
+
function getLatestFormRevisionFromCache(formId2) {
|
|
3467
|
+
return LATEST_FORM_REVISION_CACHE[formId2];
|
|
3432
3468
|
}
|
|
3433
|
-
const initialState$
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
name: "userForms",
|
|
3442
|
-
initialState: initialState$3,
|
|
3443
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
|
|
3469
|
+
const initialState$5 = {
|
|
3470
|
+
formRevisions: {},
|
|
3471
|
+
attachments: {}
|
|
3472
|
+
};
|
|
3473
|
+
const formRevisionsSlice = toolkit.createSlice({
|
|
3474
|
+
name: "formRevisions",
|
|
3475
|
+
initialState: initialState$5,
|
|
3476
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
|
|
3444
3477
|
reducers: {
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
action.payload.
|
|
3448
|
-
|
|
3449
|
-
});
|
|
3450
|
-
},
|
|
3451
|
-
addUserForm: (state, action) => {
|
|
3452
|
-
state.userForms[action.payload.offline_id] = action.payload;
|
|
3478
|
+
// revision related actions
|
|
3479
|
+
setFormRevision: (state, action) => {
|
|
3480
|
+
state.formRevisions[action.payload.offline_id] = action.payload;
|
|
3481
|
+
considerCachingFormRevision(action.payload);
|
|
3453
3482
|
},
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
action.payload.forEach((userFormRevision) => {
|
|
3461
|
-
state.revisions[userFormRevision.offline_id] = userFormRevision;
|
|
3462
|
-
considerCachingRevision(userFormRevision);
|
|
3463
|
-
});
|
|
3464
|
-
},
|
|
3465
|
-
addUserFormRevision: (state, action) => {
|
|
3466
|
-
state.revisions[action.payload.offline_id] = action.payload;
|
|
3467
|
-
considerCachingRevision(action.payload);
|
|
3483
|
+
setFormRevisions: (state, action) => {
|
|
3484
|
+
state.formRevisions = {};
|
|
3485
|
+
for (const revision of action.payload) {
|
|
3486
|
+
state.formRevisions[revision.offline_id] = revision;
|
|
3487
|
+
considerCachingFormRevision(revision);
|
|
3488
|
+
}
|
|
3468
3489
|
},
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3490
|
+
addFormRevision: (state, action) => {
|
|
3491
|
+
if (state.formRevisions[action.payload.offline_id] !== void 0) {
|
|
3492
|
+
throw new Error(`Revision with offline_id ${action.payload.offline_id} already exists`);
|
|
3493
|
+
}
|
|
3494
|
+
state.formRevisions[action.payload.offline_id] = action.payload;
|
|
3495
|
+
considerCachingFormRevision(action.payload);
|
|
3472
3496
|
},
|
|
3473
|
-
|
|
3497
|
+
// TODO: @Audiopolis / Magnus - do we want to standardize using PayloadAction?
|
|
3498
|
+
addFormRevisions: (state, action) => {
|
|
3474
3499
|
for (const userFormRevision of action.payload) {
|
|
3475
|
-
|
|
3476
|
-
|
|
3500
|
+
if (state.formRevisions[userFormRevision.offline_id] !== void 0) {
|
|
3501
|
+
throw new Error(`Revision with offline_id ${userFormRevision.offline_id} already exists`);
|
|
3502
|
+
}
|
|
3503
|
+
}
|
|
3504
|
+
for (const userFormRevision of action.payload) {
|
|
3505
|
+
state.formRevisions[userFormRevision.offline_id] = userFormRevision;
|
|
3506
|
+
considerCachingFormRevision(userFormRevision);
|
|
3477
3507
|
}
|
|
3478
3508
|
},
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
const submissionId = action.payload.submission;
|
|
3484
|
-
const submissionAttachments = state.submissionAttachments[submissionId];
|
|
3485
|
-
if (submissionAttachments) {
|
|
3486
|
-
submissionAttachments.push(action.payload);
|
|
3487
|
-
} else {
|
|
3488
|
-
state.submissionAttachments[submissionId] = [action.payload];
|
|
3509
|
+
// UserFormRevisions do not get updated
|
|
3510
|
+
deleteFormRevision: (state, action) => {
|
|
3511
|
+
if (state.formRevisions[action.payload] === void 0) {
|
|
3512
|
+
throw new Error(`Revision with offline_id ${action.payload} does not exist`);
|
|
3489
3513
|
}
|
|
3514
|
+
delete state.formRevisions[action.payload];
|
|
3515
|
+
delete LATEST_FORM_REVISION_CACHE[action.payload];
|
|
3490
3516
|
},
|
|
3491
|
-
|
|
3492
|
-
const
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
}
|
|
3497
|
-
|
|
3517
|
+
deleteFormRevisions: (state, action) => {
|
|
3518
|
+
for (const offlineId of action.payload) {
|
|
3519
|
+
if (state.formRevisions[offlineId] === void 0) {
|
|
3520
|
+
throw new Error(`Revision with offline_id ${offlineId} does not exist`);
|
|
3521
|
+
}
|
|
3522
|
+
}
|
|
3523
|
+
for (const offlineId of action.payload) {
|
|
3524
|
+
delete state.formRevisions[offlineId];
|
|
3525
|
+
delete LATEST_FORM_REVISION_CACHE[offlineId];
|
|
3498
3526
|
}
|
|
3499
3527
|
},
|
|
3500
|
-
|
|
3501
|
-
|
|
3528
|
+
// attachment related actions
|
|
3529
|
+
setFormRevisionAttachments: (state, action) => {
|
|
3530
|
+
state.attachments = {};
|
|
3502
3531
|
for (const attachment of action.payload) {
|
|
3503
|
-
|
|
3504
|
-
const submissionAttachments = state.submissionAttachments[submissionId];
|
|
3505
|
-
if (submissionAttachments) {
|
|
3506
|
-
submissionAttachments.push(attachment);
|
|
3507
|
-
} else {
|
|
3508
|
-
state.submissionAttachments[submissionId] = [attachment];
|
|
3509
|
-
}
|
|
3532
|
+
state.attachments[attachment.offline_id] = attachment;
|
|
3510
3533
|
}
|
|
3511
3534
|
},
|
|
3512
|
-
|
|
3513
|
-
state.
|
|
3535
|
+
addFormRevisionAttachment: (state, action) => {
|
|
3536
|
+
if (state.attachments[action.payload.offline_id] !== void 0) {
|
|
3537
|
+
throw new Error(`Attachment with offline_id ${action.payload.offline_id} already exists`);
|
|
3538
|
+
}
|
|
3539
|
+
state.attachments[action.payload.offline_id] = action.payload;
|
|
3540
|
+
},
|
|
3541
|
+
addFormRevisionAttachments: (state, action) => {
|
|
3514
3542
|
for (const attachment of action.payload) {
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
if (revisionAttachments) {
|
|
3518
|
-
revisionAttachments.push(attachment);
|
|
3519
|
-
} else {
|
|
3520
|
-
state.revisionAttachments[revisionId] = [attachment];
|
|
3543
|
+
if (state.attachments[attachment.offline_id] !== void 0) {
|
|
3544
|
+
throw new Error(`Attachment with offline_id ${attachment.offline_id} already exists`);
|
|
3521
3545
|
}
|
|
3522
3546
|
}
|
|
3547
|
+
for (const attachment of action.payload) {
|
|
3548
|
+
state.attachments[attachment.offline_id] = attachment;
|
|
3549
|
+
}
|
|
3523
3550
|
},
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
deleteUserFormSubmissions: (state, action) => {
|
|
3528
|
-
for (const userFormSubmission of action.payload) {
|
|
3529
|
-
delete state.submissions[userFormSubmission.offline_id];
|
|
3551
|
+
deleteFormRevisionAttachment: (state, action) => {
|
|
3552
|
+
if (state.attachments[action.payload] === void 0) {
|
|
3553
|
+
throw new Error(`Attachment with offline_id ${action.payload} does not exist`);
|
|
3530
3554
|
}
|
|
3555
|
+
delete state.attachments[action.payload];
|
|
3531
3556
|
},
|
|
3532
|
-
|
|
3533
|
-
for (const
|
|
3534
|
-
state.
|
|
3557
|
+
deleteFormRevisionAttachments: (state, action) => {
|
|
3558
|
+
for (const offlineId of action.payload) {
|
|
3559
|
+
if (state.attachments[offlineId] === void 0) {
|
|
3560
|
+
throw new Error(`Attachment with offline_id ${offlineId} does not exist`);
|
|
3561
|
+
}
|
|
3535
3562
|
}
|
|
3563
|
+
for (const offlineId of action.payload) {
|
|
3564
|
+
delete state.attachments[offlineId];
|
|
3565
|
+
}
|
|
3566
|
+
}
|
|
3567
|
+
}
|
|
3568
|
+
});
|
|
3569
|
+
const {
|
|
3570
|
+
setFormRevision,
|
|
3571
|
+
setFormRevisions,
|
|
3572
|
+
addFormRevision,
|
|
3573
|
+
addFormRevisions,
|
|
3574
|
+
deleteFormRevision,
|
|
3575
|
+
deleteFormRevisions,
|
|
3576
|
+
setFormRevisionAttachments,
|
|
3577
|
+
addFormRevisionAttachment,
|
|
3578
|
+
addFormRevisionAttachments,
|
|
3579
|
+
deleteFormRevisionAttachment,
|
|
3580
|
+
deleteFormRevisionAttachments
|
|
3581
|
+
} = formRevisionsSlice.actions;
|
|
3582
|
+
const selectFormRevisionMapping = (state) => state.formRevisionReducer.formRevisions;
|
|
3583
|
+
const selectFormRevisions = toolkit.createSelector(
|
|
3584
|
+
[selectFormRevisionMapping],
|
|
3585
|
+
(formRevisions) => Object.values(formRevisions)
|
|
3586
|
+
);
|
|
3587
|
+
const selectFormRevision = (formRevisionId) => (state) => {
|
|
3588
|
+
return state.formRevisionReducer.formRevisions[formRevisionId];
|
|
3589
|
+
};
|
|
3590
|
+
const _selectLatestFormRevision = (formRevisions, formId2) => {
|
|
3591
|
+
let ret = null;
|
|
3592
|
+
for (const candidate of Object.values(formRevisions)) {
|
|
3593
|
+
if (candidate.form === formId2 && (!ret || ret.revision < candidate.revision)) {
|
|
3594
|
+
ret = candidate;
|
|
3595
|
+
}
|
|
3596
|
+
}
|
|
3597
|
+
if (!ret) {
|
|
3598
|
+
throw new Error("No form revision found for form " + formId2);
|
|
3599
|
+
}
|
|
3600
|
+
return ret;
|
|
3601
|
+
};
|
|
3602
|
+
const selectLatestFormRevisionOfForm = restructureCreateSelectorWithArgs(
|
|
3603
|
+
toolkit.createSelector([selectFormRevisionMapping, (_state, formId2) => formId2], (revisions, formId2) => {
|
|
3604
|
+
if (!formId2) {
|
|
3605
|
+
throw new Error("formId is required");
|
|
3606
|
+
}
|
|
3607
|
+
return _selectLatestFormRevision(revisions, formId2);
|
|
3608
|
+
})
|
|
3609
|
+
);
|
|
3610
|
+
const selectFormRevisionsOfForm = restructureCreateSelectorWithArgs(
|
|
3611
|
+
toolkit.createSelector([selectFormRevisions, (_state, formId2) => formId2], (revisions, formId2) => {
|
|
3612
|
+
return revisions.filter((revision) => {
|
|
3613
|
+
return revision.form === formId2;
|
|
3614
|
+
});
|
|
3615
|
+
})
|
|
3616
|
+
);
|
|
3617
|
+
const selectLatestFormRevisionsOfComponentTypes = restructureCreateSelectorWithArgs(
|
|
3618
|
+
toolkit.createSelector(
|
|
3619
|
+
[
|
|
3620
|
+
(state) => state.formReducer.forms,
|
|
3621
|
+
selectFormRevisionMapping,
|
|
3622
|
+
(_state, componentTypeIds) => componentTypeIds
|
|
3623
|
+
],
|
|
3624
|
+
(userForms, revisions, componentTypeIds) => {
|
|
3625
|
+
const componentTypeIdsSet = new Set(componentTypeIds);
|
|
3626
|
+
const ret = {};
|
|
3627
|
+
for (const form of Object.values(userForms)) {
|
|
3628
|
+
if (form.component_type && componentTypeIdsSet.has(form.component_type)) {
|
|
3629
|
+
ret[form.component_type] = _selectLatestFormRevision(revisions, form.offline_id);
|
|
3630
|
+
}
|
|
3631
|
+
}
|
|
3632
|
+
return ret;
|
|
3633
|
+
}
|
|
3634
|
+
)
|
|
3635
|
+
);
|
|
3636
|
+
const selectLatestFormRevisionByForm = toolkit.createSelector([selectFormRevisionMapping], (revisions) => {
|
|
3637
|
+
const latestRevisions = {};
|
|
3638
|
+
for (const revision of Object.values(revisions)) {
|
|
3639
|
+
const formId2 = revision.form;
|
|
3640
|
+
const currentLatestRevision = latestRevisions[formId2];
|
|
3641
|
+
if (!currentLatestRevision || currentLatestRevision.revision < revision.revision) {
|
|
3642
|
+
latestRevisions[formId2] = revision;
|
|
3643
|
+
}
|
|
3644
|
+
}
|
|
3645
|
+
return latestRevisions;
|
|
3646
|
+
});
|
|
3647
|
+
const selectUserFormRevisionAttachmentsMapping = (state) => {
|
|
3648
|
+
return state.formRevisionReducer.attachments;
|
|
3649
|
+
};
|
|
3650
|
+
const selectAttachmentsOfFormRevision = restructureCreateSelectorWithArgs(
|
|
3651
|
+
toolkit.createSelector(
|
|
3652
|
+
[selectUserFormRevisionAttachmentsMapping, (_state, revisionId) => revisionId],
|
|
3653
|
+
(attachments, revisionId) => {
|
|
3654
|
+
return Object.values(attachments).filter((attachment) => attachment.revision === revisionId);
|
|
3655
|
+
}
|
|
3656
|
+
)
|
|
3657
|
+
);
|
|
3658
|
+
const formRevisionReducer = formRevisionsSlice.reducer;
|
|
3659
|
+
const initialState$4 = {
|
|
3660
|
+
forms: {}
|
|
3661
|
+
};
|
|
3662
|
+
const formSlice = toolkit.createSlice({
|
|
3663
|
+
name: "forms",
|
|
3664
|
+
initialState: initialState$4,
|
|
3665
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
|
|
3666
|
+
reducers: {
|
|
3667
|
+
setForms: (state, action) => {
|
|
3668
|
+
state.forms = {};
|
|
3669
|
+
action.payload.forEach((userForm) => {
|
|
3670
|
+
state.forms[userForm.offline_id] = userForm;
|
|
3671
|
+
});
|
|
3536
3672
|
},
|
|
3537
|
-
|
|
3538
|
-
state.
|
|
3539
|
-
|
|
3540
|
-
|
|
3673
|
+
addForm: (state, action) => {
|
|
3674
|
+
state.forms[action.payload.offline_id] = action.payload;
|
|
3675
|
+
},
|
|
3676
|
+
addForms: (state, action) => {
|
|
3677
|
+
action.payload.forEach((userForm) => {
|
|
3678
|
+
state.forms[userForm.offline_id] = userForm;
|
|
3541
3679
|
});
|
|
3542
3680
|
},
|
|
3543
3681
|
favoriteForm: (state, action) => {
|
|
3544
3682
|
const { formId: formId2 } = action.payload;
|
|
3545
|
-
const form = state.
|
|
3683
|
+
const form = state.forms[formId2];
|
|
3546
3684
|
if (!form) {
|
|
3547
3685
|
throw new Error("No form exists with the id " + formId2);
|
|
3548
3686
|
}
|
|
@@ -3550,48 +3688,23 @@ var __publicField = (obj, key, value) => {
|
|
|
3550
3688
|
},
|
|
3551
3689
|
unfavoriteForm: (state, action) => {
|
|
3552
3690
|
const { formId: formId2 } = action.payload;
|
|
3553
|
-
const form = state.
|
|
3691
|
+
const form = state.forms[formId2];
|
|
3554
3692
|
if (!form) {
|
|
3555
3693
|
throw new Error("No form exists with the id " + formId2);
|
|
3556
3694
|
}
|
|
3557
3695
|
form.favorite = false;
|
|
3558
3696
|
},
|
|
3559
|
-
|
|
3560
|
-
delete state.
|
|
3697
|
+
deleteForm: (state, action) => {
|
|
3698
|
+
delete state.forms[action.payload];
|
|
3561
3699
|
}
|
|
3562
3700
|
}
|
|
3563
3701
|
});
|
|
3564
|
-
const {
|
|
3565
|
-
|
|
3566
|
-
addUserForms,
|
|
3567
|
-
addUserFormRevisions,
|
|
3568
|
-
updateOrCreateUserFormSubmission,
|
|
3569
|
-
addUserFormSubmissions,
|
|
3570
|
-
deleteUserFormSubmission,
|
|
3571
|
-
deleteUserFormSubmissions,
|
|
3572
|
-
favoriteForm,
|
|
3573
|
-
unfavoriteForm,
|
|
3574
|
-
deleteUserForm,
|
|
3575
|
-
deleteUserFormRevision,
|
|
3576
|
-
deleteUserFormRevisions,
|
|
3577
|
-
setUserFormSubmissions,
|
|
3578
|
-
addUserFormRevision,
|
|
3579
|
-
addUserFormSubmissionAttachment,
|
|
3580
|
-
addUserFormRevisionAttachment,
|
|
3581
|
-
setUserFormSubmissionAttachments,
|
|
3582
|
-
setUserFormRevisionAttachments
|
|
3583
|
-
} = userFormSlice.actions;
|
|
3584
|
-
const selectSubmissionAttachments = (submissionId) => (state) => {
|
|
3585
|
-
return state.userFormReducer.submissionAttachments[submissionId] || [];
|
|
3586
|
-
};
|
|
3587
|
-
const selectRevisionAttachments = (revisionId) => (state) => {
|
|
3588
|
-
return state.userFormReducer.revisionAttachments[revisionId] || [];
|
|
3589
|
-
};
|
|
3590
|
-
const selectFilteredUserForms = restructureCreateSelectorWithArgs(
|
|
3702
|
+
const { setForms, addForm, addForms, favoriteForm, unfavoriteForm, deleteForm } = formSlice.actions;
|
|
3703
|
+
const selectFilteredForms = restructureCreateSelectorWithArgs(
|
|
3591
3704
|
toolkit.createSelector(
|
|
3592
3705
|
[
|
|
3593
|
-
(state) => state.
|
|
3594
|
-
(state) => state.
|
|
3706
|
+
(state) => state.formReducer.forms,
|
|
3707
|
+
(state) => state.formRevisionReducer.formRevisions,
|
|
3595
3708
|
(_state, search) => search
|
|
3596
3709
|
],
|
|
3597
3710
|
(userForms, revisions, search) => {
|
|
@@ -3625,63 +3738,188 @@ var __publicField = (obj, key, value) => {
|
|
|
3625
3738
|
{ memoizeOptions: { equalityCheck: reactRedux.shallowEqual } }
|
|
3626
3739
|
)
|
|
3627
3740
|
);
|
|
3628
|
-
const
|
|
3629
|
-
return state.
|
|
3741
|
+
const selectForm = (formId2) => (state) => {
|
|
3742
|
+
return state.formReducer.forms[formId2];
|
|
3630
3743
|
};
|
|
3631
|
-
const
|
|
3632
|
-
|
|
3633
|
-
for (const candidate of Object.values(revisions)) {
|
|
3634
|
-
if (candidate.form === formId2 && (!ret || ret.revision < candidate.revision)) {
|
|
3635
|
-
ret = candidate;
|
|
3636
|
-
}
|
|
3637
|
-
}
|
|
3638
|
-
if (!ret) {
|
|
3639
|
-
throw new Error("No revision found for form " + formId2);
|
|
3640
|
-
}
|
|
3641
|
-
return ret;
|
|
3744
|
+
const selectFormMapping = (state) => {
|
|
3745
|
+
return state.formReducer.forms;
|
|
3642
3746
|
};
|
|
3643
|
-
const
|
|
3747
|
+
const selectFormOfComponentType = restructureCreateSelectorWithArgs(
|
|
3644
3748
|
toolkit.createSelector(
|
|
3645
|
-
[
|
|
3646
|
-
(
|
|
3647
|
-
|
|
3648
|
-
throw new Error("formId is required");
|
|
3649
|
-
}
|
|
3650
|
-
return _selectLatestFormRevision(revisions, formId2);
|
|
3749
|
+
[selectFormMapping, (_state, componentTypeId) => componentTypeId],
|
|
3750
|
+
(userForms, componentTypeId) => {
|
|
3751
|
+
return Object.values(userForms).find((userForm) => userForm.component_type === componentTypeId);
|
|
3651
3752
|
}
|
|
3652
3753
|
)
|
|
3653
3754
|
);
|
|
3654
|
-
const
|
|
3655
|
-
return
|
|
3656
|
-
};
|
|
3657
|
-
const
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
const
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3755
|
+
const selectFormsCount = toolkit.createSelector([selectFormMapping], (userForms) => {
|
|
3756
|
+
return Object.keys(userForms).length;
|
|
3757
|
+
});
|
|
3758
|
+
const selectGeneralFormCount = toolkit.createSelector([selectFormMapping], (userForms) => {
|
|
3759
|
+
return Object.values(userForms).filter((form) => !form.component_type).length;
|
|
3760
|
+
});
|
|
3761
|
+
const formReducer = formSlice.reducer;
|
|
3762
|
+
const initialState$3 = {
|
|
3763
|
+
formSubmissions: {},
|
|
3764
|
+
attachments: {}
|
|
3765
|
+
};
|
|
3766
|
+
const formSubmissionSlice = toolkit.createSlice({
|
|
3767
|
+
name: "formSubmissions",
|
|
3768
|
+
initialState: initialState$3,
|
|
3769
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
|
|
3770
|
+
reducers: {
|
|
3771
|
+
setFormSubmission: (state, action) => {
|
|
3772
|
+
state.formSubmissions[action.payload.offline_id] = action.payload;
|
|
3773
|
+
},
|
|
3774
|
+
setFormSubmissions: (state, action) => {
|
|
3775
|
+
state.formSubmissions = {};
|
|
3776
|
+
for (const submission of action.payload) {
|
|
3777
|
+
state.formSubmissions[submission.offline_id] = submission;
|
|
3778
|
+
}
|
|
3779
|
+
},
|
|
3780
|
+
addFormSubmission: (state, action) => {
|
|
3781
|
+
if (state.formSubmissions[action.payload.offline_id] !== void 0) {
|
|
3782
|
+
throw new Error(`Submission with offline_id ${action.payload.offline_id} already exists`);
|
|
3783
|
+
}
|
|
3784
|
+
state.formSubmissions[action.payload.offline_id] = action.payload;
|
|
3785
|
+
},
|
|
3786
|
+
addFormSubmissions: (state, action) => {
|
|
3787
|
+
for (const submission of action.payload) {
|
|
3788
|
+
if (state.formSubmissions[submission.offline_id] !== void 0) {
|
|
3789
|
+
throw new Error(`Submission with offline_id ${submission.offline_id} already exists`);
|
|
3790
|
+
}
|
|
3791
|
+
}
|
|
3792
|
+
for (const submission of action.payload) {
|
|
3793
|
+
state.formSubmissions[submission.offline_id] = submission;
|
|
3794
|
+
}
|
|
3795
|
+
},
|
|
3796
|
+
updateFormSubmission: (state, action) => {
|
|
3797
|
+
if (state.formSubmissions[action.payload.offline_id] === void 0) {
|
|
3798
|
+
throw new Error(`Submission with offline_id ${action.payload.offline_id} does not exist`);
|
|
3799
|
+
}
|
|
3800
|
+
state.formSubmissions[action.payload.offline_id] = action.payload;
|
|
3801
|
+
},
|
|
3802
|
+
updateFormSubmissions: (state, action) => {
|
|
3803
|
+
for (const submission of action.payload) {
|
|
3804
|
+
if (state.formSubmissions[submission.offline_id] === void 0) {
|
|
3805
|
+
throw new Error(`Submission with offline_id ${submission.offline_id} does not exist`);
|
|
3806
|
+
}
|
|
3807
|
+
}
|
|
3808
|
+
for (const submission of action.payload) {
|
|
3809
|
+
state.formSubmissions[submission.offline_id] = submission;
|
|
3810
|
+
}
|
|
3811
|
+
},
|
|
3812
|
+
deleteFormSubmission: (state, action) => {
|
|
3813
|
+
if (state.formSubmissions[action.payload] === void 0) {
|
|
3814
|
+
throw new Error(`Submission with offline_id ${action.payload} does not exist`);
|
|
3815
|
+
}
|
|
3816
|
+
delete state.formSubmissions[action.payload];
|
|
3817
|
+
},
|
|
3818
|
+
deleteFormSubmissions: (state, action) => {
|
|
3819
|
+
for (const offlineId of action.payload) {
|
|
3820
|
+
if (state.formSubmissions[offlineId] === void 0) {
|
|
3821
|
+
throw new Error(`Submission with offline_id ${offlineId} does not exist`);
|
|
3822
|
+
}
|
|
3823
|
+
delete state.formSubmissions[offlineId];
|
|
3824
|
+
}
|
|
3825
|
+
for (const offlineId of action.payload) {
|
|
3826
|
+
delete state.formSubmissions[offlineId];
|
|
3827
|
+
}
|
|
3828
|
+
},
|
|
3829
|
+
// Attachments
|
|
3830
|
+
addFormSubmissionAttachment: (state, action) => {
|
|
3831
|
+
if (state.attachments[action.payload.offline_id] !== void 0) {
|
|
3832
|
+
throw new Error(`Attachment with offline_id ${action.payload.offline_id} already exists`);
|
|
3833
|
+
}
|
|
3834
|
+
state.attachments[action.payload.offline_id] = action.payload;
|
|
3835
|
+
},
|
|
3836
|
+
addFormSubmissionAttachments: (state, action) => {
|
|
3837
|
+
for (const attachment of action.payload) {
|
|
3838
|
+
if (state.attachments[attachment.offline_id] !== void 0) {
|
|
3839
|
+
throw new Error(`Attachment with offline_id ${attachment.offline_id} already exists`);
|
|
3840
|
+
}
|
|
3841
|
+
}
|
|
3842
|
+
for (const attachment of action.payload) {
|
|
3843
|
+
state.attachments[attachment.offline_id] = attachment;
|
|
3844
|
+
}
|
|
3845
|
+
},
|
|
3846
|
+
// We only need a multi set for attachments because they are not updated, only added and deleted
|
|
3847
|
+
setFormSubmissionAttachments: (state, action) => {
|
|
3848
|
+
state.attachments = {};
|
|
3849
|
+
for (const attachment of action.payload) {
|
|
3850
|
+
state.attachments[attachment.offline_id] = attachment;
|
|
3851
|
+
}
|
|
3852
|
+
},
|
|
3853
|
+
updateFormSubmissionAttachments: (state, action) => {
|
|
3854
|
+
for (const attachment of action.payload) {
|
|
3855
|
+
if (state.attachments[attachment.offline_id] === void 0) {
|
|
3856
|
+
throw new Error(`Attachment with offline_id ${attachment.offline_id} does not exist`);
|
|
3857
|
+
}
|
|
3858
|
+
}
|
|
3859
|
+
for (const attachment of action.payload) {
|
|
3860
|
+
state.attachments[attachment.offline_id] = attachment;
|
|
3861
|
+
}
|
|
3862
|
+
},
|
|
3863
|
+
// The delete actions for UserFormSubmissionAttachments are not used in the app, but are included for completeness
|
|
3864
|
+
// Could be used if editing a submission is ever supported, will be applicable for supporting tip tap content in submissions
|
|
3865
|
+
deleteFormSubmissionAttachment: (state, action) => {
|
|
3866
|
+
if (state.attachments[action.payload] === void 0) {
|
|
3867
|
+
throw new Error(`Attachment with offline_id ${action.payload} does not exist`);
|
|
3868
|
+
}
|
|
3869
|
+
delete state.attachments[action.payload];
|
|
3870
|
+
},
|
|
3871
|
+
deleteFormSubmissionAttachments: (state, action) => {
|
|
3872
|
+
for (const offlineId of action.payload) {
|
|
3873
|
+
if (state.attachments[offlineId] === void 0) {
|
|
3874
|
+
throw new Error(`Attachment with offline_id ${offlineId} does not exist`);
|
|
3875
|
+
}
|
|
3876
|
+
delete state.attachments[offlineId];
|
|
3877
|
+
}
|
|
3878
|
+
}
|
|
3879
|
+
}
|
|
3880
|
+
});
|
|
3881
|
+
const {
|
|
3882
|
+
setFormSubmission,
|
|
3883
|
+
setFormSubmissions,
|
|
3884
|
+
addFormSubmission,
|
|
3885
|
+
addFormSubmissions,
|
|
3886
|
+
updateFormSubmission,
|
|
3887
|
+
updateFormSubmissions,
|
|
3888
|
+
deleteFormSubmission,
|
|
3889
|
+
deleteFormSubmissions,
|
|
3890
|
+
addFormSubmissionAttachment,
|
|
3891
|
+
addFormSubmissionAttachments,
|
|
3892
|
+
setFormSubmissionAttachments,
|
|
3893
|
+
updateFormSubmissionAttachments,
|
|
3894
|
+
deleteFormSubmissionAttachment,
|
|
3895
|
+
deleteFormSubmissionAttachments
|
|
3896
|
+
} = formSubmissionSlice.actions;
|
|
3897
|
+
const selectFormSubmissionsMapping = (state) => {
|
|
3898
|
+
return state.formSubmissionReducer.formSubmissions;
|
|
3899
|
+
};
|
|
3900
|
+
const selectFormSubmissions = toolkit.createSelector(
|
|
3901
|
+
[selectFormSubmissionsMapping],
|
|
3902
|
+
(submissions) => {
|
|
3903
|
+
return Object.values(submissions);
|
|
3904
|
+
}
|
|
3670
3905
|
);
|
|
3671
|
-
const
|
|
3906
|
+
const selectFormSubmission = (submissionId) => (state) => {
|
|
3907
|
+
return state.formSubmissionReducer.formSubmissions[submissionId];
|
|
3908
|
+
};
|
|
3909
|
+
const selectFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
|
|
3672
3910
|
toolkit.createSelector(
|
|
3673
|
-
[
|
|
3911
|
+
[selectFormSubmissions, selectFormRevisionMapping, (_state, formId2) => formId2],
|
|
3674
3912
|
(submissions, revisionMapping, formId2) => {
|
|
3675
|
-
return
|
|
3913
|
+
return submissions.filter((submission) => {
|
|
3676
3914
|
const revision = revisionMapping[submission.form_revision];
|
|
3677
3915
|
return (revision == null ? void 0 : revision.form) === formId2;
|
|
3678
3916
|
});
|
|
3679
3917
|
}
|
|
3680
3918
|
)
|
|
3681
3919
|
);
|
|
3682
|
-
const
|
|
3920
|
+
const selectFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
3683
3921
|
toolkit.createSelector(
|
|
3684
|
-
[
|
|
3922
|
+
[selectFormSubmissions, (_state, issueId) => issueId],
|
|
3685
3923
|
(submissions, issueId) => {
|
|
3686
3924
|
return Object.values(submissions).filter((submission) => {
|
|
3687
3925
|
return submission.issue === issueId;
|
|
@@ -3689,9 +3927,9 @@ var __publicField = (obj, key, value) => {
|
|
|
3689
3927
|
}
|
|
3690
3928
|
)
|
|
3691
3929
|
);
|
|
3692
|
-
const
|
|
3930
|
+
const selectFormSubmissionsOfComponent = restructureCreateSelectorWithArgs(
|
|
3693
3931
|
toolkit.createSelector(
|
|
3694
|
-
[
|
|
3932
|
+
[selectFormSubmissions, (_state, componentId) => componentId],
|
|
3695
3933
|
(submissions, componentId) => {
|
|
3696
3934
|
return submissions.filter((submission) => {
|
|
3697
3935
|
return submission.component === componentId;
|
|
@@ -3699,8 +3937,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3699
3937
|
}
|
|
3700
3938
|
)
|
|
3701
3939
|
);
|
|
3702
|
-
const
|
|
3703
|
-
[
|
|
3940
|
+
const selectFormSubmissionsByComponents = toolkit.createSelector(
|
|
3941
|
+
[selectFormSubmissionsMapping, selectComponentsMapping],
|
|
3704
3942
|
(submissions, components) => {
|
|
3705
3943
|
var _a2;
|
|
3706
3944
|
const componentSubmissionMapping = {};
|
|
@@ -3716,54 +3954,18 @@ var __publicField = (obj, key, value) => {
|
|
|
3716
3954
|
return componentSubmissionMapping;
|
|
3717
3955
|
}
|
|
3718
3956
|
);
|
|
3719
|
-
const
|
|
3720
|
-
return state.
|
|
3957
|
+
const selectFormSubmissionAttachmentsMapping = (state) => {
|
|
3958
|
+
return state.formSubmissionReducer.attachments;
|
|
3721
3959
|
};
|
|
3722
|
-
const
|
|
3723
|
-
toolkit.createSelector(
|
|
3724
|
-
[selectUserFormMapping, (_state, componentTypeId) => componentTypeId],
|
|
3725
|
-
(userForms, componentTypeId) => {
|
|
3726
|
-
return Object.values(userForms).find((userForm) => userForm.component_type === componentTypeId);
|
|
3727
|
-
}
|
|
3728
|
-
)
|
|
3729
|
-
);
|
|
3730
|
-
const selectLatestRevisionsFromComponentTypeIds = restructureCreateSelectorWithArgs(
|
|
3960
|
+
const selectAttachmentsOfFormSubmission = restructureCreateSelectorWithArgs(
|
|
3731
3961
|
toolkit.createSelector(
|
|
3732
|
-
[
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
(_state, componentTypeIds) => componentTypeIds
|
|
3736
|
-
],
|
|
3737
|
-
(userForms, revisions, componentTypeIds) => {
|
|
3738
|
-
const componentTypeIdsSet = new Set(componentTypeIds);
|
|
3739
|
-
const ret = {};
|
|
3740
|
-
for (const form of Object.values(userForms)) {
|
|
3741
|
-
if (form.component_type && componentTypeIdsSet.has(form.component_type)) {
|
|
3742
|
-
ret[form.component_type] = _selectLatestFormRevision(revisions, form.offline_id);
|
|
3743
|
-
}
|
|
3744
|
-
}
|
|
3745
|
-
return ret;
|
|
3962
|
+
[selectFormSubmissionAttachmentsMapping, (_state, submissionId) => submissionId],
|
|
3963
|
+
(attachmentsMapping, submissionId) => {
|
|
3964
|
+
return Object.values(attachmentsMapping).filter((attachment) => attachment.submission === submissionId);
|
|
3746
3965
|
}
|
|
3747
3966
|
)
|
|
3748
3967
|
);
|
|
3749
|
-
const
|
|
3750
|
-
const latestRevisions = {};
|
|
3751
|
-
for (const revision of Object.values(revisions)) {
|
|
3752
|
-
const formId2 = revision.form;
|
|
3753
|
-
const currentLatestRevision = latestRevisions[formId2];
|
|
3754
|
-
if (!currentLatestRevision || currentLatestRevision.revision < revision.revision) {
|
|
3755
|
-
latestRevisions[formId2] = revision;
|
|
3756
|
-
}
|
|
3757
|
-
}
|
|
3758
|
-
return latestRevisions;
|
|
3759
|
-
});
|
|
3760
|
-
const selectNumberOfUserForms = toolkit.createSelector([selectUserFormMapping], (userForms) => {
|
|
3761
|
-
return Object.keys(userForms).length;
|
|
3762
|
-
});
|
|
3763
|
-
const selectNumberOfGeneralUserForms = toolkit.createSelector([selectUserFormMapping], (userForms) => {
|
|
3764
|
-
return Object.values(userForms).filter((form) => !form.component_type).length;
|
|
3765
|
-
});
|
|
3766
|
-
const userFormReducer = userFormSlice.reducer;
|
|
3968
|
+
const formSubmissionReducer = formSubmissionSlice.reducer;
|
|
3767
3969
|
const initialState$2 = {
|
|
3768
3970
|
emailDomains: {}
|
|
3769
3971
|
};
|
|
@@ -3797,7 +3999,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3797
3999
|
);
|
|
3798
4000
|
const emailDomainsReducer = emailDomainsSlice.reducer;
|
|
3799
4001
|
const initialState$1 = {
|
|
3800
|
-
documents: {}
|
|
4002
|
+
documents: {},
|
|
4003
|
+
attachments: {}
|
|
3801
4004
|
};
|
|
3802
4005
|
const documentSlice = toolkit.createSlice({
|
|
3803
4006
|
name: "documents",
|
|
@@ -3934,10 +4137,28 @@ var __publicField = (obj, key, value) => {
|
|
|
3934
4137
|
}
|
|
3935
4138
|
delete state.documents[documentId];
|
|
3936
4139
|
}
|
|
3937
|
-
}
|
|
4140
|
+
},
|
|
4141
|
+
setDocumentAttachments: setAttachments,
|
|
4142
|
+
addDocumentAttachment: addAttachment,
|
|
4143
|
+
addDocumentAttachments: addAttachments,
|
|
4144
|
+
updateDocumentAttachment: updateAttachment,
|
|
4145
|
+
removeDocumentAttachment: removeAttachment,
|
|
4146
|
+
removeDocumentAttachments: removeAttachments
|
|
3938
4147
|
}
|
|
3939
4148
|
});
|
|
3940
|
-
const {
|
|
4149
|
+
const {
|
|
4150
|
+
setDocuments,
|
|
4151
|
+
addDocuments,
|
|
4152
|
+
updateDocuments,
|
|
4153
|
+
moveDocument,
|
|
4154
|
+
removeDocuments,
|
|
4155
|
+
setDocumentAttachments,
|
|
4156
|
+
addDocumentAttachment,
|
|
4157
|
+
addDocumentAttachments,
|
|
4158
|
+
updateDocumentAttachment,
|
|
4159
|
+
removeDocumentAttachment,
|
|
4160
|
+
removeDocumentAttachments
|
|
4161
|
+
} = documentSlice.actions;
|
|
3941
4162
|
const selectDocumentsMapping = (state) => state.documentsReducer.documents;
|
|
3942
4163
|
const selectDocuments = toolkit.createSelector(
|
|
3943
4164
|
[selectDocumentsMapping],
|
|
@@ -3967,6 +4188,39 @@ var __publicField = (obj, key, value) => {
|
|
|
3967
4188
|
[selectDocuments],
|
|
3968
4189
|
(documents) => documents.filter((document2) => !document2.parent_document)
|
|
3969
4190
|
);
|
|
4191
|
+
const selectDocumentAttachmentMapping = (state) => state.documentsReducer.attachments;
|
|
4192
|
+
const selectAllDocumentAttachments = toolkit.createSelector(
|
|
4193
|
+
[selectDocumentAttachmentMapping],
|
|
4194
|
+
(mapping) => Object.values(mapping)
|
|
4195
|
+
);
|
|
4196
|
+
const selectDocumentAttachment = (attachmentId) => (state) => {
|
|
4197
|
+
return state.documentsReducer.attachments[attachmentId];
|
|
4198
|
+
};
|
|
4199
|
+
const selectAttachmentsOfDocument = restructureCreateSelectorWithArgs(
|
|
4200
|
+
toolkit.createSelector(
|
|
4201
|
+
[selectAllDocumentAttachments, (_state, documentId) => documentId],
|
|
4202
|
+
(attachments, documentId) => {
|
|
4203
|
+
return attachments.filter(({ document: document2 }) => documentId === document2);
|
|
4204
|
+
}
|
|
4205
|
+
)
|
|
4206
|
+
);
|
|
4207
|
+
const selectAttachmentsOfDocumentByType = restructureCreateSelectorWithArgs(
|
|
4208
|
+
toolkit.createSelector(
|
|
4209
|
+
[selectAllDocumentAttachments, (_state, documentId) => documentId],
|
|
4210
|
+
(attachments, documentId) => {
|
|
4211
|
+
const attachmentsOfProject = attachments.filter(({ document: document2 }) => documentId === document2);
|
|
4212
|
+
const fileAttachments = attachmentsOfProject.filter(
|
|
4213
|
+
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
4214
|
+
({ file_type }) => !file_type || !file_type.startsWith("image/")
|
|
4215
|
+
);
|
|
4216
|
+
const imageAttachments = attachmentsOfProject.filter(
|
|
4217
|
+
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
4218
|
+
({ file_type }) => file_type && file_type.startsWith("image/")
|
|
4219
|
+
);
|
|
4220
|
+
return { fileAttachments, imageAttachments };
|
|
4221
|
+
}
|
|
4222
|
+
)
|
|
4223
|
+
);
|
|
3970
4224
|
const documentsReducer = documentSlice.reducer;
|
|
3971
4225
|
const initialState = {
|
|
3972
4226
|
version: 0
|
|
@@ -4009,7 +4263,9 @@ var __publicField = (obj, key, value) => {
|
|
|
4009
4263
|
projectFileReducer,
|
|
4010
4264
|
rehydratedReducer,
|
|
4011
4265
|
settingReducer,
|
|
4012
|
-
|
|
4266
|
+
formReducer,
|
|
4267
|
+
formRevisionReducer,
|
|
4268
|
+
formSubmissionReducer,
|
|
4013
4269
|
userReducer,
|
|
4014
4270
|
workspaceReducer,
|
|
4015
4271
|
emailDomainsReducer,
|
|
@@ -4062,9 +4318,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4062
4318
|
throw new Error(`Failed to update index_workspace of issue ${issue.offline_id} to main workspace`);
|
|
4063
4319
|
}
|
|
4064
4320
|
}
|
|
4065
|
-
const indexedForms = Object.values(draft.
|
|
4066
|
-
(form) => form.index_workspace === workspaceId
|
|
4067
|
-
);
|
|
4321
|
+
const indexedForms = Object.values(draft.formReducer.forms).filter((form) => form.index_workspace === workspaceId);
|
|
4068
4322
|
for (const form of indexedForms) {
|
|
4069
4323
|
form.index_workspace = mainWorkspace.offline_id;
|
|
4070
4324
|
}
|
|
@@ -4542,6 +4796,22 @@ var __publicField = (obj, key, value) => {
|
|
|
4542
4796
|
}
|
|
4543
4797
|
}
|
|
4544
4798
|
class AttachmentService extends BaseApiService {
|
|
4799
|
+
processPresignedUrls(presignedUrls) {
|
|
4800
|
+
for (const [sha1, presignedUrl] of Object.entries(presignedUrls)) {
|
|
4801
|
+
void this.enqueueRequest({
|
|
4802
|
+
url: presignedUrl.url,
|
|
4803
|
+
description: "Upload file",
|
|
4804
|
+
method: HttpMethod.POST,
|
|
4805
|
+
isExternalUrl: true,
|
|
4806
|
+
isAuthNeeded: false,
|
|
4807
|
+
attachmentHash: sha1,
|
|
4808
|
+
// TODO: can we use the sha1 as the blocker?
|
|
4809
|
+
blockers: [`s3-${sha1}`],
|
|
4810
|
+
blocks: [sha1],
|
|
4811
|
+
s3url: presignedUrl
|
|
4812
|
+
});
|
|
4813
|
+
}
|
|
4814
|
+
}
|
|
4545
4815
|
fetchAll(projectId) {
|
|
4546
4816
|
const promise = this.enqueueRequest({
|
|
4547
4817
|
description: "Fetch attachments",
|
|
@@ -4555,7 +4825,8 @@ var __publicField = (obj, key, value) => {
|
|
|
4555
4825
|
issue_attachments: Object.values(state.issueReducer.attachments),
|
|
4556
4826
|
component_attachments: Object.values(state.componentReducer.attachments),
|
|
4557
4827
|
component_type_attachments: Object.values(state.componentTypeReducer.attachments),
|
|
4558
|
-
project_attachments: Object.values(state.projectReducer.attachments)
|
|
4828
|
+
project_attachments: Object.values(state.projectReducer.attachments),
|
|
4829
|
+
document_attachments: Object.values(state.documentsReducer.attachments)
|
|
4559
4830
|
};
|
|
4560
4831
|
return [allAttachments, promise];
|
|
4561
4832
|
}
|
|
@@ -4567,6 +4838,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4567
4838
|
}
|
|
4568
4839
|
const offlineAttachment = {
|
|
4569
4840
|
...attachmentPayload,
|
|
4841
|
+
// TODO: just handle creating the objectURL in here, then the front end doesn't need to worry about it
|
|
4570
4842
|
file: attachmentPayload.file.objectURL,
|
|
4571
4843
|
file_name: attachmentPayload.file.name,
|
|
4572
4844
|
file_type: attachmentPayload.file.type,
|
|
@@ -4600,6 +4872,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4600
4872
|
}
|
|
4601
4873
|
const offlineAttachment = {
|
|
4602
4874
|
...attachmentPayload,
|
|
4875
|
+
// TODO: just handle creating the objectURL in here, then the front end doesn't need to worry about it
|
|
4603
4876
|
file: attachmentPayload.file.objectURL,
|
|
4604
4877
|
file_name: attachmentPayload.file.name,
|
|
4605
4878
|
file_type: attachmentPayload.file.type,
|
|
@@ -4633,6 +4906,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4633
4906
|
}
|
|
4634
4907
|
const offlineAttachment = {
|
|
4635
4908
|
...attachmentPayload,
|
|
4909
|
+
// TODO: just handle creating the objectURL in here, then the front end doesn't need to worry about it
|
|
4636
4910
|
file: attachmentPayload.file.objectURL,
|
|
4637
4911
|
file_name: attachmentPayload.file.name,
|
|
4638
4912
|
file_type: attachmentPayload.file.type,
|
|
@@ -4659,8 +4933,8 @@ var __publicField = (obj, key, value) => {
|
|
|
4659
4933
|
});
|
|
4660
4934
|
return [offlineAttachment, promise];
|
|
4661
4935
|
}
|
|
4662
|
-
async
|
|
4663
|
-
const { description: description2,
|
|
4936
|
+
async addDocumentAttachment(attachmentPayload) {
|
|
4937
|
+
const { description: description2, document: document2, file_sha1, offline_id } = attachmentPayload;
|
|
4664
4938
|
if (!attachmentPayload.file.objectURL) {
|
|
4665
4939
|
throw new Error("Expected attachmentPayload.file.objectURL to be defined.");
|
|
4666
4940
|
}
|
|
@@ -4673,24 +4947,24 @@ var __publicField = (obj, key, value) => {
|
|
|
4673
4947
|
created_by: this.client.store.getState().userReducer.currentUser.id
|
|
4674
4948
|
};
|
|
4675
4949
|
await this.client.files.addCache(attachmentPayload.file, file_sha1);
|
|
4676
|
-
this.client.store.dispatch(
|
|
4950
|
+
this.client.store.dispatch(addDocumentAttachment(offlineAttachment));
|
|
4677
4951
|
const [fileProps] = await this.client.files.uploadFileToS3(file_sha1);
|
|
4678
4952
|
const promise = this.enqueueRequest({
|
|
4679
4953
|
description: "Create attachment",
|
|
4680
4954
|
method: HttpMethod.POST,
|
|
4681
|
-
url: `/
|
|
4682
|
-
blocks: [offline_id,
|
|
4955
|
+
url: `/documents/${document2}/attach/`,
|
|
4956
|
+
blocks: [offline_id, document2],
|
|
4683
4957
|
blockers: [file_sha1],
|
|
4684
4958
|
payload: {
|
|
4685
4959
|
offline_id,
|
|
4686
|
-
|
|
4960
|
+
document: document2,
|
|
4687
4961
|
description: description2 ?? "",
|
|
4688
4962
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4689
4963
|
...fileProps
|
|
4690
4964
|
}
|
|
4691
4965
|
});
|
|
4692
4966
|
promise.catch((error2) => {
|
|
4693
|
-
this.client.store.dispatch(
|
|
4967
|
+
this.client.store.dispatch(removeDocumentAttachment(offlineAttachment.offline_id));
|
|
4694
4968
|
throw error2;
|
|
4695
4969
|
});
|
|
4696
4970
|
return [offlineAttachment, promise];
|
|
@@ -4698,26 +4972,54 @@ var __publicField = (obj, key, value) => {
|
|
|
4698
4972
|
/** the outer Promise is needed to await the hashing of each file, which is required before offline use. If wanting to
|
|
4699
4973
|
* attach promise handlers to the request to add the attachment in the backend, apply it on the promise returned from the
|
|
4700
4974
|
* OptimisticModelResult. */
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
};
|
|
4719
|
-
|
|
4975
|
+
// note the method is only marked as async since files needs to be hashed
|
|
4976
|
+
async attachFilesToIssue(files, issueId) {
|
|
4977
|
+
const { store } = this.client;
|
|
4978
|
+
const offlineAttachments = [];
|
|
4979
|
+
const attachmentsPayload = [];
|
|
4980
|
+
const currentUser = store.getState().userReducer.currentUser;
|
|
4981
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4982
|
+
for (const file of files) {
|
|
4983
|
+
const attachment = offline({
|
|
4984
|
+
file: URL.createObjectURL(file),
|
|
4985
|
+
file_name: file.name,
|
|
4986
|
+
file_type: file.type,
|
|
4987
|
+
file_sha1: await hashFile(file),
|
|
4988
|
+
description: "",
|
|
4989
|
+
submitted_at: submittedAt,
|
|
4990
|
+
created_by: currentUser.id,
|
|
4991
|
+
issue: issueId
|
|
4992
|
+
});
|
|
4993
|
+
attachmentsPayload.push({
|
|
4994
|
+
offline_id: attachment.offline_id,
|
|
4995
|
+
name: attachment.file_name,
|
|
4996
|
+
sha1: attachment.file_sha1,
|
|
4997
|
+
description: attachment.description,
|
|
4998
|
+
created_by: attachment.created_by,
|
|
4999
|
+
issue_id: attachment.issue
|
|
5000
|
+
});
|
|
5001
|
+
offlineAttachments.push(attachment);
|
|
5002
|
+
}
|
|
5003
|
+
store.dispatch(addIssueAttachments(offlineAttachments));
|
|
5004
|
+
const promise = this.enqueueRequest({
|
|
5005
|
+
description: "Attach files to issue",
|
|
5006
|
+
method: HttpMethod.POST,
|
|
5007
|
+
url: `/issues/${issueId}/attach/`,
|
|
5008
|
+
payload: {
|
|
5009
|
+
submitted_at: submittedAt,
|
|
5010
|
+
attachments: attachmentsPayload,
|
|
5011
|
+
files: await constructUploadedFilePayloads(files)
|
|
5012
|
+
},
|
|
5013
|
+
blocks: offlineAttachments.map((attachment) => attachment.offline_id),
|
|
5014
|
+
blockers: offlineAttachments.map((attachment) => attachment.file_sha1)
|
|
4720
5015
|
});
|
|
5016
|
+
promise.then(({ attachments, presigned_urls }) => {
|
|
5017
|
+
store.dispatch(updateIssueAttachments(attachments));
|
|
5018
|
+
this.processPresignedUrls(presigned_urls);
|
|
5019
|
+
}).catch(() => {
|
|
5020
|
+
store.dispatch(removeIssueAttachments(offlineAttachments.map((attachment) => attachment.offline_id)));
|
|
5021
|
+
});
|
|
5022
|
+
return [offlineAttachments, promise.then(({ attachments }) => attachments)];
|
|
4721
5023
|
}
|
|
4722
5024
|
attachFilesToComponent(filesToSubmit, componentId) {
|
|
4723
5025
|
return filesToSubmit.map((file) => {
|
|
@@ -4761,7 +5063,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4761
5063
|
return photoAttachmentPromise(file);
|
|
4762
5064
|
});
|
|
4763
5065
|
}
|
|
4764
|
-
|
|
5066
|
+
attachFilesToDocument(filesToSubmit, documentId) {
|
|
4765
5067
|
return filesToSubmit.map((file) => {
|
|
4766
5068
|
if (!(file instanceof File)) {
|
|
4767
5069
|
throw new Error("Expected a File instance.");
|
|
@@ -4772,12 +5074,12 @@ var __publicField = (obj, key, value) => {
|
|
|
4772
5074
|
file: file2,
|
|
4773
5075
|
file_name: file2.name,
|
|
4774
5076
|
file_type: file2.type,
|
|
4775
|
-
|
|
5077
|
+
document: documentId,
|
|
4776
5078
|
file_sha1: hash,
|
|
4777
5079
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4778
5080
|
created_by: this.client.store.getState().userReducer.currentUser.id
|
|
4779
5081
|
});
|
|
4780
|
-
return this.
|
|
5082
|
+
return this.addDocumentAttachment(attachment);
|
|
4781
5083
|
};
|
|
4782
5084
|
return photoAttachmentPromise(file);
|
|
4783
5085
|
});
|
|
@@ -4957,9 +5259,9 @@ var __publicField = (obj, key, value) => {
|
|
|
4957
5259
|
const promise = performRequest2();
|
|
4958
5260
|
return [offlineAttachment, promise];
|
|
4959
5261
|
}
|
|
4960
|
-
async
|
|
5262
|
+
async replaceDocumentAttachmentFile(attachmentId, newFile) {
|
|
4961
5263
|
const { store } = this.client;
|
|
4962
|
-
const attachment = store.getState().
|
|
5264
|
+
const attachment = store.getState().documentsReducer.attachments[attachmentId];
|
|
4963
5265
|
if (!attachment)
|
|
4964
5266
|
throw new Error(`Attachment ${attachmentId} not found`);
|
|
4965
5267
|
let oldFile = void 0;
|
|
@@ -4973,7 +5275,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4973
5275
|
throw new Error(`newFile["objectURL"] is unexpectedly ${newFile.objectURL}`);
|
|
4974
5276
|
}
|
|
4975
5277
|
store.dispatch(
|
|
4976
|
-
|
|
5278
|
+
updateDocumentAttachment({
|
|
4977
5279
|
...attachment,
|
|
4978
5280
|
file_sha1: newSha1,
|
|
4979
5281
|
file: URL.createObjectURL(newFile)
|
|
@@ -4981,13 +5283,13 @@ var __publicField = (obj, key, value) => {
|
|
|
4981
5283
|
);
|
|
4982
5284
|
await this.client.files.addCache(newFile, newSha1);
|
|
4983
5285
|
const [fileProps] = await this.client.files.uploadFileToS3(newSha1).catch((e) => {
|
|
4984
|
-
store.dispatch(
|
|
5286
|
+
store.dispatch(updateDocumentAttachment(attachment));
|
|
4985
5287
|
throw e;
|
|
4986
5288
|
});
|
|
4987
5289
|
const promise2 = this.enqueueRequest({
|
|
4988
5290
|
description: "Edit attachment",
|
|
4989
5291
|
method: HttpMethod.PATCH,
|
|
4990
|
-
url: `/attachments/
|
|
5292
|
+
url: `/attachments/documents/${attachment.offline_id}/`,
|
|
4991
5293
|
isResponseBlob: false,
|
|
4992
5294
|
payload: fileProps,
|
|
4993
5295
|
blockers: [attachmentId, newSha1],
|
|
@@ -5000,7 +5302,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5000
5302
|
} catch (e) {
|
|
5001
5303
|
if (oldFile) {
|
|
5002
5304
|
store.dispatch(
|
|
5003
|
-
|
|
5305
|
+
updateDocumentAttachment({
|
|
5004
5306
|
...attachment,
|
|
5005
5307
|
file_sha1: attachment.file_sha1,
|
|
5006
5308
|
file: URL.createObjectURL(oldFile)
|
|
@@ -5070,20 +5372,20 @@ var __publicField = (obj, key, value) => {
|
|
|
5070
5372
|
blocks: [componentTypeAttachmentId]
|
|
5071
5373
|
});
|
|
5072
5374
|
}
|
|
5073
|
-
|
|
5375
|
+
deleteDocumentAttachment(documentAttachmentId) {
|
|
5074
5376
|
const { store } = this.client;
|
|
5075
|
-
const attachment =
|
|
5377
|
+
const attachment = store.getState().documentsReducer.attachments[documentAttachmentId];
|
|
5076
5378
|
if (!attachment) {
|
|
5077
|
-
throw new Error(`Attachment ${
|
|
5379
|
+
throw new Error(`Attachment ${documentAttachmentId} not found`);
|
|
5078
5380
|
}
|
|
5079
|
-
store.dispatch(
|
|
5381
|
+
store.dispatch(removeDocumentAttachment(documentAttachmentId));
|
|
5080
5382
|
void this.client.files.removeCache(attachment.file_sha1);
|
|
5081
5383
|
return this.enqueueRequest({
|
|
5082
|
-
description: "Delete attachment",
|
|
5384
|
+
description: "Delete document attachment",
|
|
5083
5385
|
method: HttpMethod.DELETE,
|
|
5084
|
-
url: `/attachments/
|
|
5085
|
-
blockers: [
|
|
5086
|
-
blocks: [
|
|
5386
|
+
url: `/attachments/documents/${documentAttachmentId}/`,
|
|
5387
|
+
blockers: [documentAttachmentId],
|
|
5388
|
+
blocks: [documentAttachmentId]
|
|
5087
5389
|
});
|
|
5088
5390
|
}
|
|
5089
5391
|
}
|
|
@@ -6321,11 +6623,18 @@ var __publicField = (obj, key, value) => {
|
|
|
6321
6623
|
if (currentProjectId) {
|
|
6322
6624
|
const [_offlineAttachments, promise] = this.client.attachments.fetchAll(currentProjectId);
|
|
6323
6625
|
void promise.then((result) => {
|
|
6324
|
-
const {
|
|
6626
|
+
const {
|
|
6627
|
+
issue_attachments,
|
|
6628
|
+
component_type_attachments,
|
|
6629
|
+
component_attachments,
|
|
6630
|
+
project_attachments,
|
|
6631
|
+
document_attachments
|
|
6632
|
+
} = result;
|
|
6325
6633
|
store.dispatch(setIssueAttachments(issue_attachments));
|
|
6326
6634
|
store.dispatch(setComponentAttachments(component_attachments));
|
|
6327
6635
|
store.dispatch(setComponentTypeAttachments(component_type_attachments));
|
|
6328
6636
|
store.dispatch(setProjectAttachments(project_attachments));
|
|
6637
|
+
store.dispatch(setDocumentAttachments(document_attachments));
|
|
6329
6638
|
});
|
|
6330
6639
|
void this.client.documents.refreshStore();
|
|
6331
6640
|
void this.client.issueUpdates.refreshStore();
|
|
@@ -6693,7 +7002,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6693
7002
|
...revisionAttachmentPayload,
|
|
6694
7003
|
file: URL.createObjectURL(image)
|
|
6695
7004
|
};
|
|
6696
|
-
store.dispatch(
|
|
7005
|
+
store.dispatch(addFormRevisionAttachment(offlinePayload));
|
|
6697
7006
|
return attach;
|
|
6698
7007
|
});
|
|
6699
7008
|
});
|
|
@@ -6727,8 +7036,8 @@ var __publicField = (obj, key, value) => {
|
|
|
6727
7036
|
revision: 0
|
|
6728
7037
|
};
|
|
6729
7038
|
const { store } = this.client;
|
|
6730
|
-
store.dispatch(
|
|
6731
|
-
store.dispatch(
|
|
7039
|
+
store.dispatch(addForm(retForm));
|
|
7040
|
+
store.dispatch(addFormRevision(retRevision));
|
|
6732
7041
|
const formPromise = this.enqueueRequest({
|
|
6733
7042
|
description: "Create form",
|
|
6734
7043
|
method: HttpMethod.POST,
|
|
@@ -6746,8 +7055,8 @@ var __publicField = (obj, key, value) => {
|
|
|
6746
7055
|
});
|
|
6747
7056
|
const attachImagesPromises = this.getAttachImagePromises(images, offlineRevisionPayload.offline_id);
|
|
6748
7057
|
void formPromise.catch((e) => {
|
|
6749
|
-
store.dispatch(
|
|
6750
|
-
store.dispatch(
|
|
7058
|
+
store.dispatch(deleteForm(retForm.offline_id));
|
|
7059
|
+
store.dispatch(deleteFormRevision(retRevision.offline_id));
|
|
6751
7060
|
throw e;
|
|
6752
7061
|
});
|
|
6753
7062
|
const settledPromise = Promise.all([formPromise, ...attachImagesPromises]).then(() => formPromise);
|
|
@@ -6789,7 +7098,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6789
7098
|
revision: "Pending",
|
|
6790
7099
|
form: formId2
|
|
6791
7100
|
};
|
|
6792
|
-
store.dispatch(
|
|
7101
|
+
store.dispatch(addFormRevision(fullRevision));
|
|
6793
7102
|
const promise = this.enqueueRequest({
|
|
6794
7103
|
description: "Create form revision",
|
|
6795
7104
|
method: HttpMethod.PATCH,
|
|
@@ -6803,9 +7112,9 @@ var __publicField = (obj, key, value) => {
|
|
|
6803
7112
|
});
|
|
6804
7113
|
const attachImagesPromises = this.getAttachImagePromises(images, offlineRevision.offline_id);
|
|
6805
7114
|
void promise.then((result) => {
|
|
6806
|
-
store.dispatch(
|
|
7115
|
+
store.dispatch(setFormRevision(result));
|
|
6807
7116
|
}).catch(() => {
|
|
6808
|
-
store.dispatch(
|
|
7117
|
+
store.dispatch(deleteFormRevision(fullRevision.offline_id));
|
|
6809
7118
|
});
|
|
6810
7119
|
const settledPromise = Promise.all([promise, ...attachImagesPromises]).then(() => promise);
|
|
6811
7120
|
return [fullRevision, settledPromise];
|
|
@@ -6847,19 +7156,19 @@ var __publicField = (obj, key, value) => {
|
|
|
6847
7156
|
async delete(formId2) {
|
|
6848
7157
|
const { store } = this.client;
|
|
6849
7158
|
const state = store.getState();
|
|
6850
|
-
const userForm =
|
|
7159
|
+
const userForm = selectForm(formId2)(state);
|
|
6851
7160
|
if (!userForm) {
|
|
6852
7161
|
throw new Error("Expected userForm to exist");
|
|
6853
7162
|
}
|
|
6854
|
-
const userFormSubmissions =
|
|
7163
|
+
const userFormSubmissions = selectFormSubmissionsOfForm(formId2)(state);
|
|
6855
7164
|
if (userFormSubmissions && userFormSubmissions.length > 0) {
|
|
6856
|
-
store.dispatch(
|
|
7165
|
+
store.dispatch(deleteFormSubmissions(userFormSubmissions.map(({ offline_id }) => offline_id)));
|
|
6857
7166
|
}
|
|
6858
|
-
const userFormRevisions =
|
|
7167
|
+
const userFormRevisions = selectFormRevisionsOfForm(formId2)(state);
|
|
6859
7168
|
if (userFormRevisions && userFormRevisions.length > 0) {
|
|
6860
|
-
store.dispatch(
|
|
7169
|
+
store.dispatch(deleteFormRevisions(userFormRevisions.map(({ offline_id }) => offline_id)));
|
|
6861
7170
|
}
|
|
6862
|
-
store.dispatch(
|
|
7171
|
+
store.dispatch(deleteForm(formId2));
|
|
6863
7172
|
try {
|
|
6864
7173
|
return await this.enqueueRequest({
|
|
6865
7174
|
description: "Delete form",
|
|
@@ -6869,12 +7178,12 @@ var __publicField = (obj, key, value) => {
|
|
|
6869
7178
|
blocks: []
|
|
6870
7179
|
});
|
|
6871
7180
|
} catch (e) {
|
|
6872
|
-
store.dispatch(
|
|
7181
|
+
store.dispatch(addForm(userForm));
|
|
6873
7182
|
if (userFormRevisions && userFormRevisions.length > 0) {
|
|
6874
|
-
store.dispatch(
|
|
7183
|
+
store.dispatch(addFormRevisions(userFormRevisions));
|
|
6875
7184
|
}
|
|
6876
7185
|
if (userFormSubmissions && userFormSubmissions.length > 0) {
|
|
6877
|
-
store.dispatch(
|
|
7186
|
+
store.dispatch(addFormSubmissions(userFormSubmissions));
|
|
6878
7187
|
}
|
|
6879
7188
|
throw e;
|
|
6880
7189
|
}
|
|
@@ -6888,16 +7197,15 @@ var __publicField = (obj, key, value) => {
|
|
|
6888
7197
|
blockers: [],
|
|
6889
7198
|
blocks: []
|
|
6890
7199
|
});
|
|
6891
|
-
store.dispatch(
|
|
6892
|
-
store.dispatch(
|
|
6893
|
-
store.dispatch(
|
|
7200
|
+
store.dispatch(setForms(Object.values(result.forms)));
|
|
7201
|
+
store.dispatch(setFormRevisions(Object.values(result.revisions)));
|
|
7202
|
+
store.dispatch(setFormRevisionAttachments(Object.values(result.attachments)));
|
|
6894
7203
|
}
|
|
6895
7204
|
}
|
|
6896
7205
|
const isArrayOfFiles = (value) => {
|
|
6897
7206
|
return Array.isArray(value) && value[0] instanceof File;
|
|
6898
7207
|
};
|
|
6899
|
-
const separateFilesFromValues = (
|
|
6900
|
-
const { values } = payload;
|
|
7208
|
+
const separateFilesFromValues = (values) => {
|
|
6901
7209
|
const files = {};
|
|
6902
7210
|
const newValues = {};
|
|
6903
7211
|
for (const key in values) {
|
|
@@ -6912,17 +7220,13 @@ var __publicField = (obj, key, value) => {
|
|
|
6912
7220
|
newValues[key] = value;
|
|
6913
7221
|
}
|
|
6914
7222
|
}
|
|
6915
|
-
|
|
6916
|
-
...payload,
|
|
6917
|
-
values: newValues
|
|
6918
|
-
};
|
|
6919
|
-
return { payloadWithoutFiles, files };
|
|
7223
|
+
return { values: newValues, files };
|
|
6920
7224
|
};
|
|
6921
7225
|
class UserFormSubmissionService extends BaseApiService {
|
|
6922
7226
|
constructor() {
|
|
6923
7227
|
super(...arguments);
|
|
6924
7228
|
// Attach files to submission, after uploading them to S3
|
|
6925
|
-
__publicField(this, "getAttachFilesPromises", (files,
|
|
7229
|
+
__publicField(this, "getAttachFilesPromises", (files, submission) => {
|
|
6926
7230
|
const { store } = this.client;
|
|
6927
7231
|
return Object.entries(files).map(async ([key, fileArray]) => {
|
|
6928
7232
|
const attachResults = [];
|
|
@@ -6932,24 +7236,27 @@ var __publicField = (obj, key, value) => {
|
|
|
6932
7236
|
const [fileProps] = await this.client.files.uploadFileToS3(sha1);
|
|
6933
7237
|
const submissionAttachmentPayload = offline({
|
|
6934
7238
|
...fileProps,
|
|
6935
|
-
submission:
|
|
7239
|
+
submission: submission.offline_id,
|
|
6936
7240
|
field_identifier: key
|
|
6937
7241
|
});
|
|
6938
7242
|
const attach = await this.enqueueRequest({
|
|
6939
7243
|
description: "Attach file to form submission",
|
|
6940
7244
|
method: HttpMethod.POST,
|
|
6941
|
-
url: `/forms/submission/${
|
|
7245
|
+
url: `/forms/submission/${submission.offline_id}/attachments/`,
|
|
6942
7246
|
payload: submissionAttachmentPayload,
|
|
6943
|
-
blockers: [
|
|
6944
|
-
|
|
6945
|
-
|
|
7247
|
+
blockers: [
|
|
7248
|
+
submission.component,
|
|
7249
|
+
submission.component_stage,
|
|
7250
|
+
submission.issue,
|
|
7251
|
+
submission.form_revision
|
|
7252
|
+
].filter((x) => x !== void 0),
|
|
6946
7253
|
blocks: [submissionAttachmentPayload.offline_id]
|
|
6947
7254
|
});
|
|
6948
7255
|
const offlinePayload = {
|
|
6949
7256
|
...submissionAttachmentPayload,
|
|
6950
7257
|
file: URL.createObjectURL(file)
|
|
6951
7258
|
};
|
|
6952
|
-
store.dispatch(
|
|
7259
|
+
store.dispatch(addFormSubmissionAttachment(offlinePayload));
|
|
6953
7260
|
attachResults.push(attach);
|
|
6954
7261
|
}
|
|
6955
7262
|
return attachResults;
|
|
@@ -6963,70 +7270,165 @@ var __publicField = (obj, key, value) => {
|
|
|
6963
7270
|
if (!activeProjectId) {
|
|
6964
7271
|
throw new Error("Expected an active project");
|
|
6965
7272
|
}
|
|
6966
|
-
const {
|
|
7273
|
+
const { values, files } = separateFilesFromValues(payload.values);
|
|
7274
|
+
const offlineSubmission = {
|
|
7275
|
+
...payload,
|
|
7276
|
+
values,
|
|
7277
|
+
created_by: state.userReducer.currentUser.id,
|
|
7278
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7279
|
+
};
|
|
6967
7280
|
const promise = this.enqueueRequest({
|
|
6968
7281
|
description: "Respond to form",
|
|
6969
7282
|
method: HttpMethod.POST,
|
|
6970
7283
|
url: `/forms/revisions/${payload.form_revision}/respond/`,
|
|
6971
|
-
payload: { ...
|
|
7284
|
+
payload: { ...offlineSubmission, project: activeProjectId },
|
|
6972
7285
|
blockers: [payload.issue, payload.component, payload.component_stage, "add-form-entry"].filter(
|
|
6973
7286
|
(x) => x !== void 0
|
|
6974
7287
|
),
|
|
6975
7288
|
blocks: [payload.offline_id]
|
|
6976
7289
|
});
|
|
6977
|
-
const attachFilesPromises = this.getAttachFilesPromises(files,
|
|
6978
|
-
|
|
6979
|
-
const fullOfflineResult = {
|
|
6980
|
-
...payload,
|
|
6981
|
-
created_by: state.userReducer.currentUser.id,
|
|
6982
|
-
created_at: now,
|
|
6983
|
-
updated_at: now
|
|
6984
|
-
};
|
|
6985
|
-
const offlineResultWithoutFiles = {
|
|
6986
|
-
...fullOfflineResult,
|
|
6987
|
-
...payloadWithoutFiles
|
|
6988
|
-
};
|
|
6989
|
-
store.dispatch(updateOrCreateUserFormSubmission(offlineResultWithoutFiles));
|
|
7290
|
+
const attachFilesPromises = this.getAttachFilesPromises(files, offlineSubmission);
|
|
7291
|
+
store.dispatch(addFormSubmission(offlineSubmission));
|
|
6990
7292
|
void promise.then((result) => {
|
|
6991
7293
|
store.dispatch(addActiveProjectFormSubmissionsCount(1));
|
|
6992
|
-
store.dispatch(
|
|
7294
|
+
store.dispatch(setFormSubmission(result));
|
|
6993
7295
|
return result;
|
|
6994
7296
|
}).catch(() => {
|
|
6995
|
-
store.dispatch(
|
|
7297
|
+
store.dispatch(deleteFormSubmission(payload.offline_id));
|
|
6996
7298
|
store.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
6997
7299
|
});
|
|
6998
7300
|
const settledPromise = Promise.all([promise, ...attachFilesPromises]).then(() => promise);
|
|
6999
|
-
return [
|
|
7301
|
+
return [offlineSubmission, settledPromise];
|
|
7000
7302
|
}
|
|
7001
|
-
|
|
7303
|
+
// Note currently the bulkAdd method is specific to form submissions for components
|
|
7304
|
+
// TODO: adapt the support bulk adding to any model type
|
|
7305
|
+
async bulkAdd(args) {
|
|
7306
|
+
const { form_revision, values: argsValues, componentOfflineIds } = args;
|
|
7002
7307
|
const { store } = this.client;
|
|
7003
|
-
const
|
|
7004
|
-
|
|
7005
|
-
|
|
7308
|
+
const offlineSubmissions = [];
|
|
7309
|
+
const offlineAttachments = [];
|
|
7310
|
+
const submissionOfflineIds = [];
|
|
7311
|
+
const submissionsPayload = [];
|
|
7312
|
+
const attachmentsPayload = [];
|
|
7313
|
+
const { values, files } = separateFilesFromValues(argsValues);
|
|
7314
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7315
|
+
const createdBy = store.getState().userReducer.currentUser.id;
|
|
7316
|
+
for (const component_id of componentOfflineIds) {
|
|
7317
|
+
const submission = offline({
|
|
7318
|
+
form_revision,
|
|
7319
|
+
values,
|
|
7320
|
+
created_by: createdBy,
|
|
7321
|
+
submitted_at: submittedAt,
|
|
7322
|
+
component: component_id
|
|
7323
|
+
});
|
|
7324
|
+
submissionOfflineIds.push(submission.offline_id);
|
|
7325
|
+
submissionsPayload.push({ offline_id: submission.offline_id, component_id });
|
|
7326
|
+
offlineSubmissions.push(submission);
|
|
7327
|
+
for (const [fieldIdentifier, fileArray] of Object.entries(files)) {
|
|
7328
|
+
for (const file of fileArray) {
|
|
7329
|
+
const sha1 = await hashFile(file);
|
|
7330
|
+
await this.client.files.addCache(file, sha1);
|
|
7331
|
+
const offlineAttachment = offline({
|
|
7332
|
+
file_name: file.name,
|
|
7333
|
+
file_sha1: sha1,
|
|
7334
|
+
file: URL.createObjectURL(file),
|
|
7335
|
+
submission: submission.offline_id,
|
|
7336
|
+
field_identifier: fieldIdentifier
|
|
7337
|
+
});
|
|
7338
|
+
offlineAttachments.push(offlineAttachment);
|
|
7339
|
+
attachmentsPayload.push({
|
|
7340
|
+
offline_id: offlineAttachment.offline_id,
|
|
7341
|
+
submission_id: submission.offline_id,
|
|
7342
|
+
sha1,
|
|
7343
|
+
name: file.name,
|
|
7344
|
+
field_identifier: fieldIdentifier
|
|
7345
|
+
});
|
|
7346
|
+
}
|
|
7347
|
+
}
|
|
7348
|
+
}
|
|
7349
|
+
const filesRecord = {};
|
|
7350
|
+
for (const file of Object.values(files).flat()) {
|
|
7351
|
+
const sha1 = await hashFile(file);
|
|
7352
|
+
filesRecord[sha1] = {
|
|
7353
|
+
sha1,
|
|
7354
|
+
extension: file.name.split(".").pop() || "",
|
|
7355
|
+
file_type: file.type,
|
|
7356
|
+
size: file.size
|
|
7357
|
+
};
|
|
7006
7358
|
}
|
|
7359
|
+
store.dispatch(addFormSubmissions(offlineSubmissions));
|
|
7360
|
+
store.dispatch(addFormSubmissionAttachments(offlineAttachments));
|
|
7361
|
+
const promise = this.enqueueRequest({
|
|
7362
|
+
description: "Bulk add form submissions",
|
|
7363
|
+
method: HttpMethod.POST,
|
|
7364
|
+
url: `/forms/revisions/${form_revision}/bulk-respond/`,
|
|
7365
|
+
payload: {
|
|
7366
|
+
form_data: values,
|
|
7367
|
+
submitted_at: submittedAt,
|
|
7368
|
+
submissions: submissionsPayload,
|
|
7369
|
+
attachments: attachmentsPayload,
|
|
7370
|
+
files: Object.values(filesRecord)
|
|
7371
|
+
},
|
|
7372
|
+
blockers: componentOfflineIds,
|
|
7373
|
+
blocks: submissionOfflineIds
|
|
7374
|
+
});
|
|
7375
|
+
promise.then(({ submissions, attachments, presigned_urls }) => {
|
|
7376
|
+
store.dispatch(updateFormSubmissions(submissions));
|
|
7377
|
+
store.dispatch(updateFormSubmissionAttachments(attachments));
|
|
7378
|
+
for (const [sha1, presigned_url] of Object.entries(presigned_urls)) {
|
|
7379
|
+
const file = filesRecord[sha1];
|
|
7380
|
+
if (!file)
|
|
7381
|
+
continue;
|
|
7382
|
+
void this.enqueueRequest({
|
|
7383
|
+
url: presigned_url.url,
|
|
7384
|
+
description: "Upload file",
|
|
7385
|
+
method: HttpMethod.POST,
|
|
7386
|
+
isExternalUrl: true,
|
|
7387
|
+
isAuthNeeded: false,
|
|
7388
|
+
attachmentHash: sha1,
|
|
7389
|
+
blockers: [`s3-${file.sha1}.${file.extension}`],
|
|
7390
|
+
blocks: [sha1],
|
|
7391
|
+
s3url: presigned_url
|
|
7392
|
+
});
|
|
7393
|
+
}
|
|
7394
|
+
}).catch(() => {
|
|
7395
|
+
store.dispatch(deleteFormSubmissions(submissionOfflineIds));
|
|
7396
|
+
store.dispatch(deleteFormSubmissionAttachments(offlineAttachments.map((x) => x.offline_id)));
|
|
7397
|
+
});
|
|
7398
|
+
return [offlineSubmissions, promise.then(({ submissions }) => submissions)];
|
|
7399
|
+
}
|
|
7400
|
+
update(submission) {
|
|
7401
|
+
const { store } = this.client;
|
|
7402
|
+
const { values, files } = separateFilesFromValues(submission.values);
|
|
7007
7403
|
const attachFilesPromises = this.getAttachFilesPromises(files, submission);
|
|
7008
|
-
const
|
|
7009
|
-
...
|
|
7010
|
-
|
|
7404
|
+
const offlineSubmission = {
|
|
7405
|
+
...submission,
|
|
7406
|
+
values
|
|
7011
7407
|
};
|
|
7012
|
-
store.
|
|
7408
|
+
const submissionToBeUpdated = store.getState().formSubmissionReducer.formSubmissions[submission.offline_id];
|
|
7409
|
+
store.dispatch(updateFormSubmission(offlineSubmission));
|
|
7013
7410
|
const promise = this.enqueueRequest({
|
|
7014
7411
|
description: "Patch form submission",
|
|
7015
7412
|
method: HttpMethod.PATCH,
|
|
7016
7413
|
url: `/forms/submissions/${submission.offline_id}/`,
|
|
7017
|
-
payload:
|
|
7018
|
-
blockers: [
|
|
7414
|
+
payload: offlineSubmission,
|
|
7415
|
+
blockers: [offlineSubmission.issue, offlineSubmission.component, offlineSubmission.component_stage].filter(
|
|
7019
7416
|
(x) => x !== void 0
|
|
7020
7417
|
),
|
|
7021
|
-
blocks: [
|
|
7418
|
+
blocks: [offlineSubmission.offline_id]
|
|
7419
|
+
});
|
|
7420
|
+
promise.then((createdSubmission) => {
|
|
7421
|
+
store.dispatch(setFormSubmission(createdSubmission));
|
|
7422
|
+
}).catch(() => {
|
|
7423
|
+
store.dispatch(setFormSubmission(submissionToBeUpdated));
|
|
7022
7424
|
});
|
|
7023
|
-
return Promise.all([promise, ...attachFilesPromises]).then(() => promise);
|
|
7425
|
+
return [offlineSubmission, Promise.all([promise, ...attachFilesPromises]).then(() => promise)];
|
|
7024
7426
|
}
|
|
7025
7427
|
async delete(submissionId) {
|
|
7026
7428
|
const { store } = this.client;
|
|
7027
7429
|
const state = store.getState();
|
|
7028
|
-
const submission = state.
|
|
7029
|
-
store.dispatch(
|
|
7430
|
+
const submission = state.formSubmissionReducer.formSubmissions[submissionId];
|
|
7431
|
+
store.dispatch(deleteFormSubmission(submissionId));
|
|
7030
7432
|
store.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
7031
7433
|
try {
|
|
7032
7434
|
return await this.enqueueRequest({
|
|
@@ -7037,10 +7439,8 @@ var __publicField = (obj, key, value) => {
|
|
|
7037
7439
|
blocks: []
|
|
7038
7440
|
});
|
|
7039
7441
|
} catch (e) {
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
store.dispatch(updateOrCreateUserFormSubmission(submission));
|
|
7043
|
-
}
|
|
7442
|
+
store.dispatch(addActiveProjectFormSubmissionsCount(1));
|
|
7443
|
+
store.dispatch(addFormSubmission(submission));
|
|
7044
7444
|
throw e;
|
|
7045
7445
|
}
|
|
7046
7446
|
}
|
|
@@ -7054,7 +7454,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7054
7454
|
blockers: [],
|
|
7055
7455
|
blocks: []
|
|
7056
7456
|
});
|
|
7057
|
-
store.dispatch(
|
|
7457
|
+
store.dispatch(setFormSubmissions(submissions));
|
|
7058
7458
|
const attachments = await this.enqueueRequest({
|
|
7059
7459
|
description: "Fetch form attachments",
|
|
7060
7460
|
method: HttpMethod.GET,
|
|
@@ -7062,7 +7462,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7062
7462
|
blockers: [],
|
|
7063
7463
|
blocks: []
|
|
7064
7464
|
});
|
|
7065
|
-
store.dispatch(
|
|
7465
|
+
store.dispatch(setFormSubmissionAttachments(attachments));
|
|
7066
7466
|
}
|
|
7067
7467
|
}
|
|
7068
7468
|
class WorkspaceService extends BaseApiService {
|
|
@@ -7276,7 +7676,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7276
7676
|
method: HttpMethod.POST,
|
|
7277
7677
|
isExternalUrl: true,
|
|
7278
7678
|
isAuthNeeded: false,
|
|
7279
|
-
attachmentHash:
|
|
7679
|
+
attachmentHash: sha1,
|
|
7280
7680
|
blockers: [`s3-${key}`],
|
|
7281
7681
|
blocks: [sha1],
|
|
7282
7682
|
s3url: fileUploadUrlResponse
|
|
@@ -13921,7 +14321,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13921
14321
|
};
|
|
13922
14322
|
const useAttachImagesToFormRevisionFields = (revision) => {
|
|
13923
14323
|
const { sdk } = useSDK();
|
|
13924
|
-
const attachments = useAppSelector(
|
|
14324
|
+
const attachments = useAppSelector(selectAttachmentsOfFormRevision((revision == null ? void 0 : revision.offline_id) ?? ""));
|
|
13925
14325
|
return React.useMemo(() => {
|
|
13926
14326
|
if (!revision || !attachments)
|
|
13927
14327
|
return revision;
|
|
@@ -14018,7 +14418,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14018
14418
|
return formRevisionToSchema(revisionWithImages, { readonly: true });
|
|
14019
14419
|
}, [revisionWithImages]);
|
|
14020
14420
|
const submissionValuesWithAttachments = React.useMemo(() => {
|
|
14021
|
-
const attachments =
|
|
14421
|
+
const attachments = selectAttachmentsOfFormSubmission(submission.offline_id)(sdk.store.getState()) ?? [];
|
|
14022
14422
|
const downloadedAttachments = {};
|
|
14023
14423
|
for (const attachment of attachments) {
|
|
14024
14424
|
const promise = sdk.files.fetchFileFromUrl(attachment.file, attachment.file_sha1, attachment.file_name);
|
|
@@ -14068,8 +14468,8 @@ var __publicField = (obj, key, value) => {
|
|
|
14068
14468
|
}
|
|
14069
14469
|
return ret;
|
|
14070
14470
|
}, [filter, maxResults, ownerFilter]);
|
|
14071
|
-
const userForms = useAppSelector(
|
|
14072
|
-
const userFormMapping = useAppSelector(
|
|
14471
|
+
const userForms = useAppSelector(selectFilteredForms(ownerFilterOptions)) ?? [];
|
|
14472
|
+
const userFormMapping = useAppSelector(selectFormMapping);
|
|
14073
14473
|
const attachableUserForms = userForms.filter((form) => !form.component_type);
|
|
14074
14474
|
const attachableUserFormMapping = Object.values(userFormMapping).filter(
|
|
14075
14475
|
(form) => !form.component_type
|
|
@@ -14102,7 +14502,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14102
14502
|
const handleChange = React.useCallback((e) => {
|
|
14103
14503
|
setFilter(e.currentTarget.value);
|
|
14104
14504
|
}, []);
|
|
14105
|
-
const numberOfForms = useAppSelector(
|
|
14505
|
+
const numberOfForms = useAppSelector(selectGeneralFormCount) || 0;
|
|
14106
14506
|
const numberOfHiddenForms = numberOfForms - attachableUserForms.length;
|
|
14107
14507
|
const overflowMessage = attachableUserForms.length == maxResults && numberOfHiddenForms > 0 ? `Only the first ${maxResults} results are shown (${numberOfHiddenForms} hidden)` : numberOfHiddenForms > 0 && `${numberOfHiddenForms} hidden forms`;
|
|
14108
14508
|
return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { ref, direction: "column", gap: "2", children: [
|
|
@@ -14196,16 +14596,13 @@ var __publicField = (obj, key, value) => {
|
|
|
14196
14596
|
const { submission, onSubmissionClick, compact, labelType, rowDecorator } = props;
|
|
14197
14597
|
const currentUser = useAppSelector(selectCurrentUser);
|
|
14198
14598
|
const createdBy = useAppSelector(selectUser("created_by" in submission ? submission.created_by : currentUser.id));
|
|
14199
|
-
const dateToUse =
|
|
14200
|
-
const formattedDateTime =
|
|
14201
|
-
hour: "2-digit",
|
|
14202
|
-
minute: "2-digit"
|
|
14203
|
-
}) : getLocalDateString(dateToUse);
|
|
14599
|
+
const dateToUse = submission.submitted_at;
|
|
14600
|
+
const formattedDateTime = getLocalDateString(dateToUse);
|
|
14204
14601
|
const revision = useAppSelector(selectFormRevision(submission.form_revision));
|
|
14205
14602
|
if (!revision) {
|
|
14206
14603
|
throw new Error(`Could not find revision ${submission.form_revision} for submission ${submission.offline_id}.`);
|
|
14207
14604
|
}
|
|
14208
|
-
const latestRevisionNumber = (_a2 = useAppSelector(
|
|
14605
|
+
const latestRevisionNumber = (_a2 = useAppSelector(selectLatestFormRevisionOfForm(revision.form))) == null ? void 0 : _a2.revision;
|
|
14209
14606
|
const creatorProfileSrc = useFileSrc({
|
|
14210
14607
|
file: (createdBy == null ? void 0 : createdBy.profile.file) ?? null,
|
|
14211
14608
|
fileSha1: (createdBy == null ? void 0 : createdBy.profile.file_sha1) ?? null
|
|
@@ -14236,10 +14633,6 @@ var __publicField = (obj, key, value) => {
|
|
|
14236
14633
|
return row;
|
|
14237
14634
|
});
|
|
14238
14635
|
FormSubmissionBrowserEntry.displayName = "FormSubmissionBrowserEntry";
|
|
14239
|
-
const getCreatedAtOrSubmittedAtDate = (submission) => {
|
|
14240
|
-
const date = "created_at" in submission ? submission.created_at : submission.submitted_at;
|
|
14241
|
-
return new Date(date);
|
|
14242
|
-
};
|
|
14243
14636
|
const FormSubmissionBrowser = React.memo((props) => {
|
|
14244
14637
|
const {
|
|
14245
14638
|
formId: formId2,
|
|
@@ -14253,10 +14646,10 @@ var __publicField = (obj, key, value) => {
|
|
|
14253
14646
|
if (!!formId2 === !!propSubmissions) {
|
|
14254
14647
|
throw new Error("Either formId or submissions must be provided, but not both.");
|
|
14255
14648
|
}
|
|
14256
|
-
const submissions = useAppSelector(propSubmissions ? () => propSubmissions :
|
|
14649
|
+
const submissions = useAppSelector(propSubmissions ? () => propSubmissions : selectFormSubmissionsOfForm(formId2));
|
|
14257
14650
|
const sortedSubmissions = React.useMemo(
|
|
14258
14651
|
() => submissions == null ? void 0 : submissions.sort((a, b) => {
|
|
14259
|
-
return
|
|
14652
|
+
return a.submitted_at.localeCompare(b.submitted_at);
|
|
14260
14653
|
}),
|
|
14261
14654
|
[submissions]
|
|
14262
14655
|
);
|
|
@@ -15573,6 +15966,7 @@ var __publicField = (obj, key, value) => {
|
|
|
15573
15966
|
exports2.VerificationCodeType = VerificationCodeType;
|
|
15574
15967
|
exports2.WorkspaceService = WorkspaceService;
|
|
15575
15968
|
exports2.YELLOW = YELLOW;
|
|
15969
|
+
exports2._selectLatestFormRevision = _selectLatestFormRevision;
|
|
15576
15970
|
exports2._setLatestRetryTime = _setLatestRetryTime;
|
|
15577
15971
|
exports2.acceptProjectInvite = acceptProjectInvite;
|
|
15578
15972
|
exports2.addActiveProjectFormSubmissionsCount = addActiveProjectFormSubmissionsCount;
|
|
@@ -15585,9 +15979,21 @@ var __publicField = (obj, key, value) => {
|
|
|
15585
15979
|
exports2.addComponentTypeAttachment = addComponentTypeAttachment;
|
|
15586
15980
|
exports2.addComponentTypeAttachments = addComponentTypeAttachments;
|
|
15587
15981
|
exports2.addComponentsInBatches = addComponentsInBatches;
|
|
15982
|
+
exports2.addDocumentAttachment = addDocumentAttachment;
|
|
15983
|
+
exports2.addDocumentAttachments = addDocumentAttachments;
|
|
15588
15984
|
exports2.addDocuments = addDocuments;
|
|
15589
15985
|
exports2.addEmailDomain = addEmailDomain;
|
|
15590
15986
|
exports2.addFavouriteProjectId = addFavouriteProjectId;
|
|
15987
|
+
exports2.addForm = addForm;
|
|
15988
|
+
exports2.addFormRevision = addFormRevision;
|
|
15989
|
+
exports2.addFormRevisionAttachment = addFormRevisionAttachment;
|
|
15990
|
+
exports2.addFormRevisionAttachments = addFormRevisionAttachments;
|
|
15991
|
+
exports2.addFormRevisions = addFormRevisions;
|
|
15992
|
+
exports2.addFormSubmission = addFormSubmission;
|
|
15993
|
+
exports2.addFormSubmissionAttachment = addFormSubmissionAttachment;
|
|
15994
|
+
exports2.addFormSubmissionAttachments = addFormSubmissionAttachments;
|
|
15995
|
+
exports2.addFormSubmissions = addFormSubmissions;
|
|
15996
|
+
exports2.addForms = addForms;
|
|
15591
15997
|
exports2.addIssue = addIssue;
|
|
15592
15998
|
exports2.addIssueAttachment = addIssueAttachment;
|
|
15593
15999
|
exports2.addIssueAttachments = addIssueAttachments;
|
|
@@ -15608,13 +16014,6 @@ var __publicField = (obj, key, value) => {
|
|
|
15608
16014
|
exports2.addStageCompletions = addStageCompletions;
|
|
15609
16015
|
exports2.addStages = addStages;
|
|
15610
16016
|
exports2.addToRecentIssues = addToRecentIssues;
|
|
15611
|
-
exports2.addUserForm = addUserForm;
|
|
15612
|
-
exports2.addUserFormRevision = addUserFormRevision;
|
|
15613
|
-
exports2.addUserFormRevisionAttachment = addUserFormRevisionAttachment;
|
|
15614
|
-
exports2.addUserFormRevisions = addUserFormRevisions;
|
|
15615
|
-
exports2.addUserFormSubmissionAttachment = addUserFormSubmissionAttachment;
|
|
15616
|
-
exports2.addUserFormSubmissions = addUserFormSubmissions;
|
|
15617
|
-
exports2.addUserForms = addUserForms;
|
|
15618
16017
|
exports2.addUsers = addUsers;
|
|
15619
16018
|
exports2.addWorkspace = addWorkspace;
|
|
15620
16019
|
exports2.areArraysEqual = areArraysEqual;
|
|
@@ -15635,6 +16034,7 @@ var __publicField = (obj, key, value) => {
|
|
|
15635
16034
|
exports2.componentStageSlice = componentStageSlice;
|
|
15636
16035
|
exports2.componentTypeReducer = componentTypeReducer;
|
|
15637
16036
|
exports2.componentTypeSlice = componentTypeSlice;
|
|
16037
|
+
exports2.constructUploadedFilePayloads = constructUploadedFilePayloads;
|
|
15638
16038
|
exports2.coordinatesAreEqual = coordinatesAreEqual;
|
|
15639
16039
|
exports2.coordinatesToLiteral = coordinatesToLiteral;
|
|
15640
16040
|
exports2.coordinatesToPointGeometry = coordinatesToPointGeometry;
|
|
@@ -15645,12 +16045,16 @@ var __publicField = (obj, key, value) => {
|
|
|
15645
16045
|
exports2.defaultBadgeColor = defaultBadgeColor;
|
|
15646
16046
|
exports2.defaultStore = defaultStore;
|
|
15647
16047
|
exports2.deleteComponentType = deleteComponentType;
|
|
16048
|
+
exports2.deleteForm = deleteForm;
|
|
16049
|
+
exports2.deleteFormRevision = deleteFormRevision;
|
|
16050
|
+
exports2.deleteFormRevisionAttachment = deleteFormRevisionAttachment;
|
|
16051
|
+
exports2.deleteFormRevisionAttachments = deleteFormRevisionAttachments;
|
|
16052
|
+
exports2.deleteFormRevisions = deleteFormRevisions;
|
|
16053
|
+
exports2.deleteFormSubmission = deleteFormSubmission;
|
|
16054
|
+
exports2.deleteFormSubmissionAttachment = deleteFormSubmissionAttachment;
|
|
16055
|
+
exports2.deleteFormSubmissionAttachments = deleteFormSubmissionAttachments;
|
|
16056
|
+
exports2.deleteFormSubmissions = deleteFormSubmissions;
|
|
15648
16057
|
exports2.deleteProject = deleteProject;
|
|
15649
|
-
exports2.deleteUserForm = deleteUserForm;
|
|
15650
|
-
exports2.deleteUserFormRevision = deleteUserFormRevision;
|
|
15651
|
-
exports2.deleteUserFormRevisions = deleteUserFormRevisions;
|
|
15652
|
-
exports2.deleteUserFormSubmission = deleteUserFormSubmission;
|
|
15653
|
-
exports2.deleteUserFormSubmissions = deleteUserFormSubmissions;
|
|
15654
16058
|
exports2.dequeue = dequeue;
|
|
15655
16059
|
exports2.deserialize = deserialize;
|
|
15656
16060
|
exports2.deserializeField = deserializeField;
|
|
@@ -15679,7 +16083,13 @@ var __publicField = (obj, key, value) => {
|
|
|
15679
16083
|
exports2.fileSlice = fileSlice;
|
|
15680
16084
|
exports2.fileToBlob = fileToBlob;
|
|
15681
16085
|
exports2.flipCoordinates = flipCoordinates;
|
|
16086
|
+
exports2.formReducer = formReducer;
|
|
16087
|
+
exports2.formRevisionReducer = formRevisionReducer;
|
|
15682
16088
|
exports2.formRevisionToSchema = formRevisionToSchema;
|
|
16089
|
+
exports2.formRevisionsSlice = formRevisionsSlice;
|
|
16090
|
+
exports2.formSlice = formSlice;
|
|
16091
|
+
exports2.formSubmissionReducer = formSubmissionReducer;
|
|
16092
|
+
exports2.formSubmissionSlice = formSubmissionSlice;
|
|
15683
16093
|
exports2.forms = index;
|
|
15684
16094
|
exports2.fullComponentMarkerSize = fullComponentMarkerSize;
|
|
15685
16095
|
exports2.generateBadgeColors = generateBadgeColors;
|
|
@@ -15748,11 +16158,14 @@ var __publicField = (obj, key, value) => {
|
|
|
15748
16158
|
exports2.removeComponentAttachments = removeComponentAttachments;
|
|
15749
16159
|
exports2.removeComponentTypeAttachment = removeComponentTypeAttachment;
|
|
15750
16160
|
exports2.removeComponentTypeAttachments = removeComponentTypeAttachments;
|
|
16161
|
+
exports2.removeDocumentAttachment = removeDocumentAttachment;
|
|
16162
|
+
exports2.removeDocumentAttachments = removeDocumentAttachments;
|
|
15751
16163
|
exports2.removeDocuments = removeDocuments;
|
|
15752
16164
|
exports2.removeEmailDomain = removeEmailDomain;
|
|
15753
16165
|
exports2.removeFavouriteProjectId = removeFavouriteProjectId;
|
|
15754
16166
|
exports2.removeIssue = removeIssue;
|
|
15755
16167
|
exports2.removeIssueAttachment = removeIssueAttachment;
|
|
16168
|
+
exports2.removeIssueAttachments = removeIssueAttachments;
|
|
15756
16169
|
exports2.removeIssueComment = removeIssueComment;
|
|
15757
16170
|
exports2.removeIssueComments = removeIssueComments;
|
|
15758
16171
|
exports2.removeIssueUpdate = removeIssueUpdate;
|
|
@@ -15795,6 +16208,7 @@ var __publicField = (obj, key, value) => {
|
|
|
15795
16208
|
exports2.selectAllAttachments = selectAllAttachments;
|
|
15796
16209
|
exports2.selectAllComponentAttachments = selectAllComponentAttachments;
|
|
15797
16210
|
exports2.selectAllComponentTypeAttachments = selectAllComponentTypeAttachments;
|
|
16211
|
+
exports2.selectAllDocumentAttachments = selectAllDocumentAttachments;
|
|
15798
16212
|
exports2.selectAllProjectAttachments = selectAllProjectAttachments;
|
|
15799
16213
|
exports2.selectAncestorIdsOfDocument = selectAncestorIdsOfDocument;
|
|
15800
16214
|
exports2.selectAppearance = selectAppearance;
|
|
@@ -15802,6 +16216,10 @@ var __publicField = (obj, key, value) => {
|
|
|
15802
16216
|
exports2.selectAttachmentsOfComponentByType = selectAttachmentsOfComponentByType;
|
|
15803
16217
|
exports2.selectAttachmentsOfComponentType = selectAttachmentsOfComponentType;
|
|
15804
16218
|
exports2.selectAttachmentsOfComponentTypeByType = selectAttachmentsOfComponentTypeByType;
|
|
16219
|
+
exports2.selectAttachmentsOfDocument = selectAttachmentsOfDocument;
|
|
16220
|
+
exports2.selectAttachmentsOfDocumentByType = selectAttachmentsOfDocumentByType;
|
|
16221
|
+
exports2.selectAttachmentsOfFormRevision = selectAttachmentsOfFormRevision;
|
|
16222
|
+
exports2.selectAttachmentsOfFormSubmission = selectAttachmentsOfFormSubmission;
|
|
15805
16223
|
exports2.selectAttachmentsOfIssue = selectAttachmentsOfIssue;
|
|
15806
16224
|
exports2.selectAttachmentsOfIssueByType = selectAttachmentsOfIssueByType;
|
|
15807
16225
|
exports2.selectAttachmentsOfProject = selectAttachmentsOfProject;
|
|
@@ -15817,11 +16235,11 @@ var __publicField = (obj, key, value) => {
|
|
|
15817
16235
|
exports2.selectCompletedStageIdsForComponent = selectCompletedStageIdsForComponent;
|
|
15818
16236
|
exports2.selectCompletedStages = selectCompletedStages;
|
|
15819
16237
|
exports2.selectComponent = selectComponent;
|
|
16238
|
+
exports2.selectComponentAttachment = selectComponentAttachment;
|
|
15820
16239
|
exports2.selectComponentAttachmentMapping = selectComponentAttachmentMapping;
|
|
15821
|
-
exports2.selectComponentSubmissionMapping = selectComponentSubmissionMapping;
|
|
15822
16240
|
exports2.selectComponentType = selectComponentType;
|
|
16241
|
+
exports2.selectComponentTypeAttachment = selectComponentTypeAttachment;
|
|
15823
16242
|
exports2.selectComponentTypeAttachmentMapping = selectComponentTypeAttachmentMapping;
|
|
15824
|
-
exports2.selectComponentTypeForm = selectComponentTypeForm;
|
|
15825
16243
|
exports2.selectComponentTypeFromComponent = selectComponentTypeFromComponent;
|
|
15826
16244
|
exports2.selectComponentTypeFromComponents = selectComponentTypeFromComponents;
|
|
15827
16245
|
exports2.selectComponentTypeStagesMapping = selectComponentTypeStagesMapping;
|
|
@@ -15837,6 +16255,8 @@ var __publicField = (obj, key, value) => {
|
|
|
15837
16255
|
exports2.selectCurrentUser = selectCurrentUser;
|
|
15838
16256
|
exports2.selectDeletedRequests = selectDeletedRequests;
|
|
15839
16257
|
exports2.selectDocument = selectDocument;
|
|
16258
|
+
exports2.selectDocumentAttachment = selectDocumentAttachment;
|
|
16259
|
+
exports2.selectDocumentAttachmentMapping = selectDocumentAttachmentMapping;
|
|
15840
16260
|
exports2.selectDocuments = selectDocuments;
|
|
15841
16261
|
exports2.selectDocumentsMapping = selectDocumentsMapping;
|
|
15842
16262
|
exports2.selectEmailDomainsAsMapping = selectEmailDomainsAsMapping;
|
|
@@ -15849,8 +16269,24 @@ var __publicField = (obj, key, value) => {
|
|
|
15849
16269
|
exports2.selectExpandedSections = selectExpandedSections;
|
|
15850
16270
|
exports2.selectFavouriteProjects = selectFavouriteProjects;
|
|
15851
16271
|
exports2.selectFileAttachmentsOfIssue = selectFileAttachmentsOfIssue;
|
|
15852
|
-
exports2.
|
|
16272
|
+
exports2.selectFilteredForms = selectFilteredForms;
|
|
16273
|
+
exports2.selectForm = selectForm;
|
|
16274
|
+
exports2.selectFormMapping = selectFormMapping;
|
|
16275
|
+
exports2.selectFormOfComponentType = selectFormOfComponentType;
|
|
15853
16276
|
exports2.selectFormRevision = selectFormRevision;
|
|
16277
|
+
exports2.selectFormRevisionMapping = selectFormRevisionMapping;
|
|
16278
|
+
exports2.selectFormRevisions = selectFormRevisions;
|
|
16279
|
+
exports2.selectFormRevisionsOfForm = selectFormRevisionsOfForm;
|
|
16280
|
+
exports2.selectFormSubmission = selectFormSubmission;
|
|
16281
|
+
exports2.selectFormSubmissionAttachmentsMapping = selectFormSubmissionAttachmentsMapping;
|
|
16282
|
+
exports2.selectFormSubmissions = selectFormSubmissions;
|
|
16283
|
+
exports2.selectFormSubmissionsByComponents = selectFormSubmissionsByComponents;
|
|
16284
|
+
exports2.selectFormSubmissionsMapping = selectFormSubmissionsMapping;
|
|
16285
|
+
exports2.selectFormSubmissionsOfComponent = selectFormSubmissionsOfComponent;
|
|
16286
|
+
exports2.selectFormSubmissionsOfForm = selectFormSubmissionsOfForm;
|
|
16287
|
+
exports2.selectFormSubmissionsOfIssue = selectFormSubmissionsOfIssue;
|
|
16288
|
+
exports2.selectFormsCount = selectFormsCount;
|
|
16289
|
+
exports2.selectGeneralFormCount = selectGeneralFormCount;
|
|
15854
16290
|
exports2.selectHiddenCategoryCount = selectHiddenCategoryCount;
|
|
15855
16291
|
exports2.selectHiddenComponentTypeIds = selectHiddenComponentTypeIds;
|
|
15856
16292
|
exports2.selectIsFetchingInitialData = selectIsFetchingInitialData;
|
|
@@ -15858,16 +16294,17 @@ var __publicField = (obj, key, value) => {
|
|
|
15858
16294
|
exports2.selectIsLoading = selectIsLoading;
|
|
15859
16295
|
exports2.selectIsLoggedIn = selectIsLoggedIn;
|
|
15860
16296
|
exports2.selectIssue = selectIssue;
|
|
16297
|
+
exports2.selectIssueAttachment = selectIssueAttachment;
|
|
15861
16298
|
exports2.selectIssueAttachmentMapping = selectIssueAttachmentMapping;
|
|
15862
16299
|
exports2.selectIssueAttachments = selectIssueAttachments;
|
|
15863
16300
|
exports2.selectIssueMapping = selectIssueMapping;
|
|
15864
16301
|
exports2.selectIssueUpdateMapping = selectIssueUpdateMapping;
|
|
15865
16302
|
exports2.selectIssueUpdatesOfIssue = selectIssueUpdatesOfIssue;
|
|
15866
16303
|
exports2.selectIssues = selectIssues;
|
|
15867
|
-
exports2.
|
|
16304
|
+
exports2.selectLatestFormRevisionByForm = selectLatestFormRevisionByForm;
|
|
16305
|
+
exports2.selectLatestFormRevisionOfForm = selectLatestFormRevisionOfForm;
|
|
16306
|
+
exports2.selectLatestFormRevisionsOfComponentTypes = selectLatestFormRevisionsOfComponentTypes;
|
|
15868
16307
|
exports2.selectLatestRetryTime = selectLatestRetryTime;
|
|
15869
|
-
exports2.selectLatestRevisionByFormId = selectLatestRevisionByFormId;
|
|
15870
|
-
exports2.selectLatestRevisionsFromComponentTypeIds = selectLatestRevisionsFromComponentTypeIds;
|
|
15871
16308
|
exports2.selectLicense = selectLicense;
|
|
15872
16309
|
exports2.selectLicenseForProject = selectLicenseForProject;
|
|
15873
16310
|
exports2.selectLicenses = selectLicenses;
|
|
@@ -15876,8 +16313,6 @@ var __publicField = (obj, key, value) => {
|
|
|
15876
16313
|
exports2.selectMapStyle = selectMapStyle;
|
|
15877
16314
|
exports2.selectNumberOfComponentTypesMatchingCaseInsensitiveName = selectNumberOfComponentTypesMatchingCaseInsensitiveName;
|
|
15878
16315
|
exports2.selectNumberOfComponentsOfComponentType = selectNumberOfComponentsOfComponentType;
|
|
15879
|
-
exports2.selectNumberOfGeneralUserForms = selectNumberOfGeneralUserForms;
|
|
15880
|
-
exports2.selectNumberOfUserForms = selectNumberOfUserForms;
|
|
15881
16316
|
exports2.selectOrganization = selectOrganization;
|
|
15882
16317
|
exports2.selectOrganizationAccess = selectOrganizationAccess;
|
|
15883
16318
|
exports2.selectOrganizationAccessForUser = selectOrganizationAccessForUser;
|
|
@@ -15905,8 +16340,6 @@ var __publicField = (obj, key, value) => {
|
|
|
15905
16340
|
exports2.selectRecentIssuesAsSearchResults = selectRecentIssuesAsSearchResults;
|
|
15906
16341
|
exports2.selectRecentProjects = selectRecentProjects;
|
|
15907
16342
|
exports2.selectRehydrated = selectRehydrated;
|
|
15908
|
-
exports2.selectRevisionAttachments = selectRevisionAttachments;
|
|
15909
|
-
exports2.selectRevisionsForForm = selectRevisionsForForm;
|
|
15910
16343
|
exports2.selectRootDocuments = selectRootDocuments;
|
|
15911
16344
|
exports2.selectShowTooltips = selectShowTooltips;
|
|
15912
16345
|
exports2.selectSortedEmailDomains = selectSortedEmailDomains;
|
|
@@ -15921,16 +16354,10 @@ var __publicField = (obj, key, value) => {
|
|
|
15921
16354
|
exports2.selectStagesFromComponentType = selectStagesFromComponentType;
|
|
15922
16355
|
exports2.selectStagesFromComponentTypeIds = selectStagesFromComponentTypeIds;
|
|
15923
16356
|
exports2.selectStagesFromStageIds = selectStagesFromStageIds;
|
|
15924
|
-
exports2.selectSubmissionAttachments = selectSubmissionAttachments;
|
|
15925
|
-
exports2.selectSubmissionsForComponent = selectSubmissionsForComponent;
|
|
15926
|
-
exports2.selectSubmissionsForForm = selectSubmissionsForForm;
|
|
15927
|
-
exports2.selectSubmissionsForIssue = selectSubmissionsForIssue;
|
|
15928
16357
|
exports2.selectUploadUrl = selectUploadUrl;
|
|
15929
16358
|
exports2.selectUsedColors = selectUsedColors;
|
|
15930
16359
|
exports2.selectUser = selectUser;
|
|
15931
|
-
exports2.
|
|
15932
|
-
exports2.selectUserFormMapping = selectUserFormMapping;
|
|
15933
|
-
exports2.selectUserFormSubmission = selectUserFormSubmission;
|
|
16360
|
+
exports2.selectUserFormRevisionAttachmentsMapping = selectUserFormRevisionAttachmentsMapping;
|
|
15934
16361
|
exports2.selectUsersAsMapping = selectUsersAsMapping;
|
|
15935
16362
|
exports2.selectVisibleStatuses = selectVisibleStatuses;
|
|
15936
16363
|
exports2.selectVisibleUserIds = selectVisibleUserIds;
|
|
@@ -15951,11 +16378,19 @@ var __publicField = (obj, key, value) => {
|
|
|
15951
16378
|
exports2.setComponents = setComponents;
|
|
15952
16379
|
exports2.setCreateProjectType = setCreateProjectType;
|
|
15953
16380
|
exports2.setCurrentUser = setCurrentUser;
|
|
16381
|
+
exports2.setDocumentAttachments = setDocumentAttachments;
|
|
15954
16382
|
exports2.setDocuments = setDocuments;
|
|
15955
16383
|
exports2.setEmailDomains = setEmailDomains;
|
|
15956
16384
|
exports2.setEnableClustering = setEnableClustering;
|
|
15957
16385
|
exports2.setEnableDuplicateIssues = setEnableDuplicateIssues;
|
|
15958
16386
|
exports2.setEnablePlacementMode = setEnablePlacementMode;
|
|
16387
|
+
exports2.setFormRevision = setFormRevision;
|
|
16388
|
+
exports2.setFormRevisionAttachments = setFormRevisionAttachments;
|
|
16389
|
+
exports2.setFormRevisions = setFormRevisions;
|
|
16390
|
+
exports2.setFormSubmission = setFormSubmission;
|
|
16391
|
+
exports2.setFormSubmissionAttachments = setFormSubmissionAttachments;
|
|
16392
|
+
exports2.setFormSubmissions = setFormSubmissions;
|
|
16393
|
+
exports2.setForms = setForms;
|
|
15959
16394
|
exports2.setIsFetchingInitialData = setIsFetchingInitialData;
|
|
15960
16395
|
exports2.setIsImportingProjectFile = setIsImportingProjectFile;
|
|
15961
16396
|
exports2.setIsLoading = setIsLoading;
|
|
@@ -15980,9 +16415,6 @@ var __publicField = (obj, key, value) => {
|
|
|
15980
16415
|
exports2.setTokens = setTokens;
|
|
15981
16416
|
exports2.setTourStep = setTourStep;
|
|
15982
16417
|
exports2.setUploadUrl = setUploadUrl;
|
|
15983
|
-
exports2.setUserFormRevisionAttachments = setUserFormRevisionAttachments;
|
|
15984
|
-
exports2.setUserFormSubmissionAttachments = setUserFormSubmissionAttachments;
|
|
15985
|
-
exports2.setUserFormSubmissions = setUserFormSubmissions;
|
|
15986
16418
|
exports2.setUsers = setUsers;
|
|
15987
16419
|
exports2.setVisibleStatuses = setVisibleStatuses;
|
|
15988
16420
|
exports2.setVisibleUserIds = setVisibleUserIds;
|
|
@@ -16005,12 +16437,16 @@ var __publicField = (obj, key, value) => {
|
|
|
16005
16437
|
exports2.updateComponent = updateComponent;
|
|
16006
16438
|
exports2.updateComponentAttachment = updateComponentAttachment;
|
|
16007
16439
|
exports2.updateComponentTypeAttachment = updateComponentTypeAttachment;
|
|
16440
|
+
exports2.updateDocumentAttachment = updateDocumentAttachment;
|
|
16008
16441
|
exports2.updateDocuments = updateDocuments;
|
|
16442
|
+
exports2.updateFormSubmission = updateFormSubmission;
|
|
16443
|
+
exports2.updateFormSubmissionAttachments = updateFormSubmissionAttachments;
|
|
16444
|
+
exports2.updateFormSubmissions = updateFormSubmissions;
|
|
16009
16445
|
exports2.updateIssue = updateIssue;
|
|
16010
16446
|
exports2.updateIssueAttachment = updateIssueAttachment;
|
|
16447
|
+
exports2.updateIssueAttachments = updateIssueAttachments;
|
|
16011
16448
|
exports2.updateLicense = updateLicense;
|
|
16012
16449
|
exports2.updateOrCreateProject = updateOrCreateProject;
|
|
16013
|
-
exports2.updateOrCreateUserFormSubmission = updateOrCreateUserFormSubmission;
|
|
16014
16450
|
exports2.updateOrganizationAccess = updateOrganizationAccess;
|
|
16015
16451
|
exports2.updateProjectAccess = updateProjectAccess;
|
|
16016
16452
|
exports2.updateProjectAttachment = updateProjectAttachment;
|
|
@@ -16024,8 +16460,6 @@ var __publicField = (obj, key, value) => {
|
|
|
16024
16460
|
exports2.useFormikInput = useFormikInput;
|
|
16025
16461
|
exports2.useMemoCompare = useMemoCompare;
|
|
16026
16462
|
exports2.useSDK = useSDK;
|
|
16027
|
-
exports2.userFormReducer = userFormReducer;
|
|
16028
|
-
exports2.userFormSlice = userFormSlice;
|
|
16029
16463
|
exports2.userReducer = userReducer;
|
|
16030
16464
|
exports2.userSlice = userSlice;
|
|
16031
16465
|
exports2.valueIsFile = valueIsFile;
|