@overmap-ai/core 1.0.51-add-submitted-at-to-form-revisions.1 → 1.0.51-bulk-form-submission.1
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 +693 -419
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +693 -419
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/services/UserFormSubmissionService.d.ts +9 -2
- package/dist/store/slices/categorySlice.d.ts +3 -1
- package/dist/store/slices/documentSlice.d.ts +3 -1
- package/dist/store/slices/formRevisionSlice.d.ts +65 -0
- package/dist/store/slices/formSlice.d.ts +110 -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 +3 -1
- 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 +8 -11
- 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/dist/utils/forms.d.ts +2 -0
- package/package.json +1 -1
- package/dist/store/slices/userFormSlice.d.ts +0 -145
|
@@ -668,15 +668,15 @@ var __publicField = (obj, key, value) => {
|
|
|
668
668
|
};
|
|
669
669
|
const migrations = [initialVersioning, signOut, signOut, createOutboxState];
|
|
670
670
|
const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
|
|
671
|
-
const initialState$
|
|
671
|
+
const initialState$p = {
|
|
672
672
|
accessToken: "",
|
|
673
673
|
refreshToken: "",
|
|
674
674
|
isLoggedIn: false
|
|
675
675
|
};
|
|
676
676
|
const authSlice = toolkit.createSlice({
|
|
677
677
|
name: "auth",
|
|
678
|
-
initialState: initialState$
|
|
679
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
678
|
+
initialState: initialState$p,
|
|
679
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
|
|
680
680
|
reducers: {
|
|
681
681
|
setTokens: (state, action) => {
|
|
682
682
|
state.accessToken = action.payload.accessToken;
|
|
@@ -841,6 +841,19 @@ var __publicField = (obj, key, value) => {
|
|
|
841
841
|
element.click();
|
|
842
842
|
document.body.removeChild(element);
|
|
843
843
|
}
|
|
844
|
+
const constructUploadedFilePayloads = async (files) => {
|
|
845
|
+
const filePayloads = {};
|
|
846
|
+
for (const file of files) {
|
|
847
|
+
const sha1 = await hashFile(file);
|
|
848
|
+
filePayloads[sha1] = {
|
|
849
|
+
sha1,
|
|
850
|
+
extension: file.name.split(".").pop() || "",
|
|
851
|
+
file_type: file.type,
|
|
852
|
+
size: file.size
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
return Object.values(filePayloads);
|
|
856
|
+
};
|
|
844
857
|
const fileToBlob = async (dataUrl) => {
|
|
845
858
|
return (await fetch(dataUrl)).blob();
|
|
846
859
|
};
|
|
@@ -1407,7 +1420,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1407
1420
|
return getLocalDateString(date);
|
|
1408
1421
|
return relative.format(days, "days");
|
|
1409
1422
|
});
|
|
1410
|
-
const initialState$
|
|
1423
|
+
const initialState$o = {
|
|
1411
1424
|
categories: {},
|
|
1412
1425
|
usedCategoryColors: [],
|
|
1413
1426
|
categoryVisibility: {
|
|
@@ -1417,8 +1430,8 @@ var __publicField = (obj, key, value) => {
|
|
|
1417
1430
|
};
|
|
1418
1431
|
const categorySlice = toolkit.createSlice({
|
|
1419
1432
|
name: "categories",
|
|
1420
|
-
initialState: initialState$
|
|
1421
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1433
|
+
initialState: initialState$o,
|
|
1434
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
|
|
1422
1435
|
reducers: {
|
|
1423
1436
|
setCategories: (state, action) => {
|
|
1424
1437
|
if (!Array.isArray(action.payload))
|
|
@@ -1587,14 +1600,14 @@ var __publicField = (obj, key, value) => {
|
|
|
1587
1600
|
delete state.attachments[attachmentId];
|
|
1588
1601
|
}
|
|
1589
1602
|
}
|
|
1590
|
-
const initialState$
|
|
1603
|
+
const initialState$n = {
|
|
1591
1604
|
components: {},
|
|
1592
1605
|
attachments: {}
|
|
1593
1606
|
};
|
|
1594
1607
|
const componentSlice = toolkit.createSlice({
|
|
1595
1608
|
name: "components",
|
|
1596
|
-
initialState: initialState$
|
|
1597
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1609
|
+
initialState: initialState$n,
|
|
1610
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
|
|
1598
1611
|
reducers: {
|
|
1599
1612
|
addComponent: (state, action) => {
|
|
1600
1613
|
state.components[action.payload.offline_id] = action.payload;
|
|
@@ -1750,13 +1763,13 @@ var __publicField = (obj, key, value) => {
|
|
|
1750
1763
|
removeAllComponentsOfType
|
|
1751
1764
|
} = componentSlice.actions;
|
|
1752
1765
|
const componentReducer = componentSlice.reducer;
|
|
1753
|
-
const initialState$
|
|
1766
|
+
const initialState$m = {
|
|
1754
1767
|
completionsByComponentId: {}
|
|
1755
1768
|
};
|
|
1756
1769
|
const componentStageCompletionSlice = toolkit.createSlice({
|
|
1757
1770
|
name: "componentStageCompletions",
|
|
1758
|
-
initialState: initialState$
|
|
1759
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1771
|
+
initialState: initialState$m,
|
|
1772
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
|
|
1760
1773
|
reducers: {
|
|
1761
1774
|
addStageCompletion: (state, action) => {
|
|
1762
1775
|
let stageToCompletionDateMapping = state.completionsByComponentId[action.payload.component];
|
|
@@ -1807,13 +1820,13 @@ var __publicField = (obj, key, value) => {
|
|
|
1807
1820
|
return Object.keys(state.componentStageCompletionReducer.completionsByComponentId[component.offline_id] ?? {});
|
|
1808
1821
|
};
|
|
1809
1822
|
const componentStageCompletionReducer = componentStageCompletionSlice.reducer;
|
|
1810
|
-
const initialState$
|
|
1823
|
+
const initialState$l = {
|
|
1811
1824
|
stages: {}
|
|
1812
1825
|
};
|
|
1813
1826
|
const componentStageSlice = toolkit.createSlice({
|
|
1814
1827
|
name: "componentStages",
|
|
1815
|
-
initialState: initialState$
|
|
1816
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1828
|
+
initialState: initialState$l,
|
|
1829
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
|
|
1817
1830
|
reducers: {
|
|
1818
1831
|
addStages: (state, action) => {
|
|
1819
1832
|
Object.assign(state.stages, toOfflineIdRecord(action.payload));
|
|
@@ -1923,15 +1936,15 @@ var __publicField = (obj, key, value) => {
|
|
|
1923
1936
|
);
|
|
1924
1937
|
const { addStages, updateStages, removeStages, linkStageToForm, unlinkStageToForm } = componentStageSlice.actions;
|
|
1925
1938
|
const componentStageReducer = componentStageSlice.reducer;
|
|
1926
|
-
const initialState$
|
|
1939
|
+
const initialState$k = {
|
|
1927
1940
|
componentTypes: {},
|
|
1928
1941
|
hiddenComponentTypeIds: {},
|
|
1929
1942
|
attachments: {}
|
|
1930
1943
|
};
|
|
1931
1944
|
const componentTypeSlice = toolkit.createSlice({
|
|
1932
1945
|
name: "componentTypes",
|
|
1933
|
-
initialState: initialState$
|
|
1934
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1946
|
+
initialState: initialState$k,
|
|
1947
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
|
|
1935
1948
|
reducers: {
|
|
1936
1949
|
addComponentType: (state, action) => {
|
|
1937
1950
|
state.componentTypes[action.payload.offline_id] = action.payload;
|
|
@@ -2042,13 +2055,13 @@ var __publicField = (obj, key, value) => {
|
|
|
2042
2055
|
deleteComponentType
|
|
2043
2056
|
} = componentTypeSlice.actions;
|
|
2044
2057
|
const componentTypeReducer = componentTypeSlice.reducer;
|
|
2045
|
-
const initialState$
|
|
2058
|
+
const initialState$j = {
|
|
2046
2059
|
workspaces: {},
|
|
2047
2060
|
activeWorkspaceId: null
|
|
2048
2061
|
};
|
|
2049
2062
|
const workspaceSlice = toolkit.createSlice({
|
|
2050
2063
|
name: "workspace",
|
|
2051
|
-
initialState: initialState$
|
|
2064
|
+
initialState: initialState$j,
|
|
2052
2065
|
// The `reducers` field lets us define reducers and generate associated actions
|
|
2053
2066
|
reducers: {
|
|
2054
2067
|
setWorkspaces: (state, action) => {
|
|
@@ -2105,7 +2118,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2105
2118
|
);
|
|
2106
2119
|
const workspaceReducer = workspaceSlice.reducer;
|
|
2107
2120
|
const maxRecentIssues = 10;
|
|
2108
|
-
const initialState$
|
|
2121
|
+
const initialState$i = {
|
|
2109
2122
|
issues: {},
|
|
2110
2123
|
attachments: {},
|
|
2111
2124
|
comments: {},
|
|
@@ -2117,9 +2130,9 @@ var __publicField = (obj, key, value) => {
|
|
|
2117
2130
|
};
|
|
2118
2131
|
const issueSlice = toolkit.createSlice({
|
|
2119
2132
|
name: "issues",
|
|
2120
|
-
initialState: initialState$
|
|
2133
|
+
initialState: initialState$i,
|
|
2121
2134
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
2122
|
-
Object.assign(state, initialState$
|
|
2135
|
+
Object.assign(state, initialState$i);
|
|
2123
2136
|
}),
|
|
2124
2137
|
reducers: {
|
|
2125
2138
|
setIssues: (state, action) => {
|
|
@@ -2527,15 +2540,15 @@ var __publicField = (obj, key, value) => {
|
|
|
2527
2540
|
}
|
|
2528
2541
|
);
|
|
2529
2542
|
const issueReducer = issueSlice.reducer;
|
|
2530
|
-
const initialState$
|
|
2543
|
+
const initialState$h = {
|
|
2531
2544
|
s3Urls: {}
|
|
2532
2545
|
};
|
|
2533
2546
|
const msPerHour = 1e3 * 60 * 60;
|
|
2534
2547
|
const msPerWeek = msPerHour * 24 * 7;
|
|
2535
2548
|
const fileSlice = toolkit.createSlice({
|
|
2536
2549
|
name: "file",
|
|
2537
|
-
initialState: initialState$
|
|
2538
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2550
|
+
initialState: initialState$h,
|
|
2551
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
|
|
2539
2552
|
reducers: {
|
|
2540
2553
|
setUploadUrl: (state, action) => {
|
|
2541
2554
|
const { url, fields, sha1 } = action.payload;
|
|
@@ -2562,7 +2575,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2562
2575
|
return url;
|
|
2563
2576
|
};
|
|
2564
2577
|
const fileReducer = fileSlice.reducer;
|
|
2565
|
-
const initialState$
|
|
2578
|
+
const initialState$g = {
|
|
2566
2579
|
// TODO: Change first MapStyle.SATELLITE to MaptStyle.None when project creation map is fixed
|
|
2567
2580
|
mapStyle: MapStyle.SATELLITE,
|
|
2568
2581
|
showTooltips: false,
|
|
@@ -2570,8 +2583,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2570
2583
|
};
|
|
2571
2584
|
const mapSlice = toolkit.createSlice({
|
|
2572
2585
|
name: "map",
|
|
2573
|
-
initialState: initialState$
|
|
2574
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2586
|
+
initialState: initialState$g,
|
|
2587
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
|
|
2575
2588
|
reducers: {
|
|
2576
2589
|
setMapStyle: (state, action) => {
|
|
2577
2590
|
state.mapStyle = action.payload;
|
|
@@ -2640,7 +2653,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2640
2653
|
LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
|
|
2641
2654
|
return LicenseStatus2;
|
|
2642
2655
|
})(LicenseStatus || {});
|
|
2643
|
-
const initialState$
|
|
2656
|
+
const initialState$f = {
|
|
2644
2657
|
users: {},
|
|
2645
2658
|
currentUser: {
|
|
2646
2659
|
id: 0,
|
|
@@ -2651,8 +2664,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2651
2664
|
};
|
|
2652
2665
|
const userSlice = toolkit.createSlice({
|
|
2653
2666
|
name: "users",
|
|
2654
|
-
initialState: initialState$
|
|
2655
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2667
|
+
initialState: initialState$f,
|
|
2668
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
|
|
2656
2669
|
reducers: {
|
|
2657
2670
|
setUsers: (state, action) => {
|
|
2658
2671
|
const usersMapping = {};
|
|
@@ -2714,13 +2727,13 @@ var __publicField = (obj, key, value) => {
|
|
|
2714
2727
|
const selectUsersAsMapping = (state) => state.userReducer.users;
|
|
2715
2728
|
const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
|
|
2716
2729
|
const userReducer = userSlice.reducer;
|
|
2717
|
-
const initialState$
|
|
2730
|
+
const initialState$e = {
|
|
2718
2731
|
organizationAccesses: {}
|
|
2719
2732
|
};
|
|
2720
2733
|
const organizationAccessSlice = toolkit.createSlice({
|
|
2721
2734
|
name: "organizationAccess",
|
|
2722
|
-
initialState: initialState$
|
|
2723
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2735
|
+
initialState: initialState$e,
|
|
2736
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
|
|
2724
2737
|
reducers: {
|
|
2725
2738
|
setOrganizationAccesses: (state, action) => {
|
|
2726
2739
|
if (!Array.isArray(action.payload))
|
|
@@ -2783,13 +2796,13 @@ var __publicField = (obj, key, value) => {
|
|
|
2783
2796
|
return organizationAccesses;
|
|
2784
2797
|
};
|
|
2785
2798
|
const organizationAccessReducer = organizationAccessSlice.reducer;
|
|
2786
|
-
const initialState$
|
|
2799
|
+
const initialState$d = {
|
|
2787
2800
|
licenses: {}
|
|
2788
2801
|
};
|
|
2789
2802
|
const licenseSlice = toolkit.createSlice({
|
|
2790
2803
|
name: "license",
|
|
2791
|
-
initialState: initialState$
|
|
2792
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2804
|
+
initialState: initialState$d,
|
|
2805
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
|
|
2793
2806
|
reducers: {
|
|
2794
2807
|
setLicenses: (state, action) => {
|
|
2795
2808
|
if (!Array.isArray(action.payload))
|
|
@@ -2834,13 +2847,13 @@ var __publicField = (obj, key, value) => {
|
|
|
2834
2847
|
(licenses) => Object.values(licenses).filter((license) => license.project).reduce((accum, license) => ({ ...accum, [license.project]: license }), {})
|
|
2835
2848
|
);
|
|
2836
2849
|
const licenseReducer = licenseSlice.reducer;
|
|
2837
|
-
const initialState$
|
|
2850
|
+
const initialState$c = {
|
|
2838
2851
|
projectAccesses: {}
|
|
2839
2852
|
};
|
|
2840
2853
|
const projectAccessSlice = toolkit.createSlice({
|
|
2841
2854
|
name: "projectAccess",
|
|
2842
|
-
initialState: initialState$
|
|
2843
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2855
|
+
initialState: initialState$c,
|
|
2856
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
|
|
2844
2857
|
reducers: {
|
|
2845
2858
|
setProjectAccesses: (state, action) => {
|
|
2846
2859
|
if (!Array.isArray(action.payload))
|
|
@@ -2908,7 +2921,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2908
2921
|
return projectAccesses;
|
|
2909
2922
|
};
|
|
2910
2923
|
const projectAccessReducer = projectAccessSlice.reducer;
|
|
2911
|
-
const initialState$
|
|
2924
|
+
const initialState$b = {
|
|
2912
2925
|
projects: {},
|
|
2913
2926
|
activeProjectId: null,
|
|
2914
2927
|
recentProjectIds: [],
|
|
@@ -2918,7 +2931,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2918
2931
|
};
|
|
2919
2932
|
const projectSlice = toolkit.createSlice({
|
|
2920
2933
|
name: "projects",
|
|
2921
|
-
initialState: initialState$
|
|
2934
|
+
initialState: initialState$b,
|
|
2922
2935
|
reducers: {
|
|
2923
2936
|
setProjects: (state, action) => {
|
|
2924
2937
|
const projectsMap = {};
|
|
@@ -3105,14 +3118,14 @@ var __publicField = (obj, key, value) => {
|
|
|
3105
3118
|
}
|
|
3106
3119
|
)
|
|
3107
3120
|
);
|
|
3108
|
-
const initialState$
|
|
3121
|
+
const initialState$a = {
|
|
3109
3122
|
organizations: {},
|
|
3110
3123
|
activeOrganizationId: null
|
|
3111
3124
|
};
|
|
3112
3125
|
const organizationSlice = toolkit.createSlice({
|
|
3113
3126
|
name: "organizations",
|
|
3114
|
-
initialState: initialState$
|
|
3115
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3127
|
+
initialState: initialState$a,
|
|
3128
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
|
|
3116
3129
|
reducers: {
|
|
3117
3130
|
setOrganizations: (state, action) => {
|
|
3118
3131
|
for (const org of action.payload) {
|
|
@@ -3231,14 +3244,14 @@ var __publicField = (obj, key, value) => {
|
|
|
3231
3244
|
}
|
|
3232
3245
|
};
|
|
3233
3246
|
};
|
|
3234
|
-
const initialState$
|
|
3247
|
+
const initialState$9 = {
|
|
3235
3248
|
deletedRequests: [],
|
|
3236
3249
|
latestRetryTime: 0
|
|
3237
3250
|
};
|
|
3238
3251
|
const outboxSlice = toolkit.createSlice({
|
|
3239
3252
|
name: "outbox",
|
|
3240
|
-
initialState: initialState$
|
|
3241
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3253
|
+
initialState: initialState$9,
|
|
3254
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$9)),
|
|
3242
3255
|
reducers: {
|
|
3243
3256
|
// enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
|
|
3244
3257
|
// Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
|
|
@@ -3270,7 +3283,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3270
3283
|
const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
|
|
3271
3284
|
const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
|
|
3272
3285
|
const outboxReducer = outboxSlice.reducer;
|
|
3273
|
-
const initialState$
|
|
3286
|
+
const initialState$8 = {
|
|
3274
3287
|
projectFiles: {},
|
|
3275
3288
|
activeProjectFileId: null,
|
|
3276
3289
|
isImportingProjectFile: false,
|
|
@@ -3278,8 +3291,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3278
3291
|
};
|
|
3279
3292
|
const projectFileSlice = toolkit.createSlice({
|
|
3280
3293
|
name: "projectFiles",
|
|
3281
|
-
initialState: initialState$
|
|
3282
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3294
|
+
initialState: initialState$8,
|
|
3295
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
|
|
3283
3296
|
reducers: {
|
|
3284
3297
|
addOrReplaceProjectFiles: (state, action) => {
|
|
3285
3298
|
for (let fileObj of action.payload) {
|
|
@@ -3380,12 +3393,12 @@ var __publicField = (obj, key, value) => {
|
|
|
3380
3393
|
const selectActiveProjectFileId = (state) => state.projectFileReducer.activeProjectFileId;
|
|
3381
3394
|
const selectIsImportingProjectFile = (state) => state.projectFileReducer.isImportingProjectFile;
|
|
3382
3395
|
const projectFileReducer = projectFileSlice.reducer;
|
|
3383
|
-
const initialState$
|
|
3396
|
+
const initialState$7 = {
|
|
3384
3397
|
isRehydrated: false
|
|
3385
3398
|
};
|
|
3386
3399
|
const rehydratedSlice = toolkit.createSlice({
|
|
3387
3400
|
name: "rehydrated",
|
|
3388
|
-
initialState: initialState$
|
|
3401
|
+
initialState: initialState$7,
|
|
3389
3402
|
// The `reducers` field lets us define reducers and generate associated actions
|
|
3390
3403
|
reducers: {
|
|
3391
3404
|
setRehydrated: (state, action) => {
|
|
@@ -3395,7 +3408,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3395
3408
|
});
|
|
3396
3409
|
const selectRehydrated = (state) => state.rehydratedReducer.isRehydrated;
|
|
3397
3410
|
const rehydratedReducer = rehydratedSlice.reducer;
|
|
3398
|
-
const initialState$
|
|
3411
|
+
const initialState$6 = {
|
|
3399
3412
|
useIssueTemplate: false,
|
|
3400
3413
|
placementMode: false,
|
|
3401
3414
|
enableClustering: false,
|
|
@@ -3412,8 +3425,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3412
3425
|
};
|
|
3413
3426
|
const settingSlice = toolkit.createSlice({
|
|
3414
3427
|
name: "settings",
|
|
3415
|
-
initialState: initialState$
|
|
3416
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3428
|
+
initialState: initialState$6,
|
|
3429
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
|
|
3417
3430
|
reducers: {
|
|
3418
3431
|
setEnableDuplicateIssues: (state, action) => {
|
|
3419
3432
|
state.useIssueTemplate = action.payload;
|
|
@@ -3459,146 +3472,231 @@ var __publicField = (obj, key, value) => {
|
|
|
3459
3472
|
const settingReducer = settingSlice.reducer;
|
|
3460
3473
|
const selectIsFetchingInitialData = (state) => state.settingReducer.isFetchingInitialData;
|
|
3461
3474
|
const selectIsLoading = (state) => state.settingReducer.isLoading;
|
|
3462
|
-
const
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
if (
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
return;
|
|
3474
|
-
}
|
|
3475
|
-
if (revision.revision === "Pending") {
|
|
3476
|
-
if (preferPending) {
|
|
3477
|
-
LATEST_REVISION_CACHE[revision.form] = revision;
|
|
3478
|
-
}
|
|
3479
|
-
return;
|
|
3480
|
-
}
|
|
3481
|
-
const cachedRevision = (_a2 = LATEST_REVISION_CACHE[revision.form]) == null ? void 0 : _a2.revision;
|
|
3482
|
-
if (revision.revision > (typeof cachedRevision === "number" ? cachedRevision : -1)) {
|
|
3483
|
-
LATEST_REVISION_CACHE[revision.form] = revision;
|
|
3475
|
+
const formRevisionSortFn = (formRevisionA, formRevisionB) => {
|
|
3476
|
+
const revisionA = formRevisionA.revision;
|
|
3477
|
+
const revisionB = formRevisionB.revision;
|
|
3478
|
+
if (revisionA === "Pending" && revisionB === "Pending") {
|
|
3479
|
+
return formRevisionA.submitted_at < formRevisionB.submitted_at ? 1 : -1;
|
|
3480
|
+
} else if (revisionA === "Pending") {
|
|
3481
|
+
return -1;
|
|
3482
|
+
} else if (revisionB === "Pending") {
|
|
3483
|
+
return 1;
|
|
3484
|
+
} else {
|
|
3485
|
+
return revisionA < revisionB ? 1 : -1;
|
|
3484
3486
|
}
|
|
3485
|
-
}
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
revisionAttachments: {}
|
|
3495
|
-
};
|
|
3496
|
-
const userFormSlice = toolkit.createSlice({
|
|
3497
|
-
name: "userForms",
|
|
3498
|
-
initialState: initialState$3,
|
|
3499
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
|
|
3487
|
+
};
|
|
3488
|
+
const initialState$5 = {
|
|
3489
|
+
formRevisions: {},
|
|
3490
|
+
attachments: {}
|
|
3491
|
+
};
|
|
3492
|
+
const formRevisionsSlice = toolkit.createSlice({
|
|
3493
|
+
name: "formRevisions",
|
|
3494
|
+
initialState: initialState$5,
|
|
3495
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
|
|
3500
3496
|
reducers: {
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
action.payload.
|
|
3504
|
-
state.userForms[userForm.offline_id] = userForm;
|
|
3505
|
-
});
|
|
3506
|
-
},
|
|
3507
|
-
addUserForm: (state, action) => {
|
|
3508
|
-
state.userForms[action.payload.offline_id] = action.payload;
|
|
3509
|
-
},
|
|
3510
|
-
addUserForms: (state, action) => {
|
|
3511
|
-
action.payload.forEach((userForm) => {
|
|
3512
|
-
state.userForms[userForm.offline_id] = userForm;
|
|
3513
|
-
});
|
|
3514
|
-
},
|
|
3515
|
-
addUserFormRevisions: (state, action) => {
|
|
3516
|
-
action.payload.forEach((userFormRevision) => {
|
|
3517
|
-
state.revisions[userFormRevision.offline_id] = userFormRevision;
|
|
3518
|
-
considerCachingRevision(userFormRevision);
|
|
3519
|
-
});
|
|
3497
|
+
// revision related actions
|
|
3498
|
+
setFormRevision: (state, action) => {
|
|
3499
|
+
state.formRevisions[action.payload.offline_id] = action.payload;
|
|
3520
3500
|
},
|
|
3521
|
-
|
|
3522
|
-
state.
|
|
3523
|
-
|
|
3501
|
+
setFormRevisions: (state, action) => {
|
|
3502
|
+
state.formRevisions = {};
|
|
3503
|
+
for (const revision of action.payload) {
|
|
3504
|
+
state.formRevisions[revision.offline_id] = revision;
|
|
3505
|
+
}
|
|
3524
3506
|
},
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3507
|
+
addFormRevision: (state, action) => {
|
|
3508
|
+
if (state.formRevisions[action.payload.offline_id] !== void 0) {
|
|
3509
|
+
throw new Error(`Revision with offline_id ${action.payload.offline_id} already exists`);
|
|
3510
|
+
}
|
|
3511
|
+
state.formRevisions[action.payload.offline_id] = action.payload;
|
|
3528
3512
|
},
|
|
3529
|
-
|
|
3513
|
+
addFormRevisions: (state, action) => {
|
|
3530
3514
|
for (const userFormRevision of action.payload) {
|
|
3531
|
-
|
|
3532
|
-
|
|
3515
|
+
if (state.formRevisions[userFormRevision.offline_id] !== void 0) {
|
|
3516
|
+
throw new Error(`Revision with offline_id ${userFormRevision.offline_id} already exists`);
|
|
3517
|
+
}
|
|
3533
3518
|
}
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
state.submissions[action.payload.offline_id] = action.payload;
|
|
3537
|
-
},
|
|
3538
|
-
addUserFormSubmissionAttachment: (state, action) => {
|
|
3539
|
-
const submissionId = action.payload.submission;
|
|
3540
|
-
const submissionAttachments = state.submissionAttachments[submissionId];
|
|
3541
|
-
if (submissionAttachments) {
|
|
3542
|
-
submissionAttachments.push(action.payload);
|
|
3543
|
-
} else {
|
|
3544
|
-
state.submissionAttachments[submissionId] = [action.payload];
|
|
3519
|
+
for (const userFormRevision of action.payload) {
|
|
3520
|
+
state.formRevisions[userFormRevision.offline_id] = userFormRevision;
|
|
3545
3521
|
}
|
|
3546
3522
|
},
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
revisionAttachments.push(action.payload);
|
|
3552
|
-
} else {
|
|
3553
|
-
state.revisionAttachments[revisionId] = [action.payload];
|
|
3523
|
+
// UserFormRevisions do not get updated
|
|
3524
|
+
deleteFormRevision: (state, action) => {
|
|
3525
|
+
if (state.formRevisions[action.payload] === void 0) {
|
|
3526
|
+
throw new Error(`Revision with offline_id ${action.payload} does not exist`);
|
|
3554
3527
|
}
|
|
3528
|
+
delete state.formRevisions[action.payload];
|
|
3555
3529
|
},
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
const submissionAttachments = state.submissionAttachments[submissionId];
|
|
3561
|
-
if (submissionAttachments) {
|
|
3562
|
-
submissionAttachments.push(attachment);
|
|
3563
|
-
} else {
|
|
3564
|
-
state.submissionAttachments[submissionId] = [attachment];
|
|
3530
|
+
deleteFormRevisions: (state, action) => {
|
|
3531
|
+
for (const offlineId of action.payload) {
|
|
3532
|
+
if (state.formRevisions[offlineId] === void 0) {
|
|
3533
|
+
throw new Error(`Revision with offline_id ${offlineId} does not exist`);
|
|
3565
3534
|
}
|
|
3566
3535
|
}
|
|
3536
|
+
for (const offlineId of action.payload) {
|
|
3537
|
+
delete state.formRevisions[offlineId];
|
|
3538
|
+
}
|
|
3567
3539
|
},
|
|
3568
|
-
|
|
3569
|
-
|
|
3540
|
+
// attachment related actions
|
|
3541
|
+
setFormRevisionAttachments: (state, action) => {
|
|
3542
|
+
state.attachments = {};
|
|
3570
3543
|
for (const attachment of action.payload) {
|
|
3571
|
-
|
|
3572
|
-
const revisionAttachments = state.revisionAttachments[revisionId];
|
|
3573
|
-
if (revisionAttachments) {
|
|
3574
|
-
revisionAttachments.push(attachment);
|
|
3575
|
-
} else {
|
|
3576
|
-
state.revisionAttachments[revisionId] = [attachment];
|
|
3577
|
-
}
|
|
3544
|
+
state.attachments[attachment.offline_id] = attachment;
|
|
3578
3545
|
}
|
|
3579
3546
|
},
|
|
3580
|
-
|
|
3581
|
-
|
|
3547
|
+
addFormRevisionAttachment: (state, action) => {
|
|
3548
|
+
if (state.attachments[action.payload.offline_id] !== void 0) {
|
|
3549
|
+
throw new Error(`Attachment with offline_id ${action.payload.offline_id} already exists`);
|
|
3550
|
+
}
|
|
3551
|
+
state.attachments[action.payload.offline_id] = action.payload;
|
|
3582
3552
|
},
|
|
3583
|
-
|
|
3584
|
-
for (const
|
|
3585
|
-
|
|
3553
|
+
addFormRevisionAttachments: (state, action) => {
|
|
3554
|
+
for (const attachment of action.payload) {
|
|
3555
|
+
if (state.attachments[attachment.offline_id] !== void 0) {
|
|
3556
|
+
throw new Error(`Attachment with offline_id ${attachment.offline_id} already exists`);
|
|
3557
|
+
}
|
|
3558
|
+
}
|
|
3559
|
+
for (const attachment of action.payload) {
|
|
3560
|
+
state.attachments[attachment.offline_id] = attachment;
|
|
3586
3561
|
}
|
|
3587
3562
|
},
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3563
|
+
deleteFormRevisionAttachment: (state, action) => {
|
|
3564
|
+
if (state.attachments[action.payload] === void 0) {
|
|
3565
|
+
throw new Error(`Attachment with offline_id ${action.payload} does not exist`);
|
|
3591
3566
|
}
|
|
3567
|
+
delete state.attachments[action.payload];
|
|
3592
3568
|
},
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3569
|
+
deleteFormRevisionAttachments: (state, action) => {
|
|
3570
|
+
for (const offlineId of action.payload) {
|
|
3571
|
+
if (state.attachments[offlineId] === void 0) {
|
|
3572
|
+
throw new Error(`Attachment with offline_id ${offlineId} does not exist`);
|
|
3573
|
+
}
|
|
3574
|
+
}
|
|
3575
|
+
for (const offlineId of action.payload) {
|
|
3576
|
+
delete state.attachments[offlineId];
|
|
3577
|
+
}
|
|
3578
|
+
}
|
|
3579
|
+
}
|
|
3580
|
+
});
|
|
3581
|
+
const {
|
|
3582
|
+
setFormRevision,
|
|
3583
|
+
setFormRevisions,
|
|
3584
|
+
addFormRevision,
|
|
3585
|
+
addFormRevisions,
|
|
3586
|
+
deleteFormRevision,
|
|
3587
|
+
deleteFormRevisions,
|
|
3588
|
+
setFormRevisionAttachments,
|
|
3589
|
+
addFormRevisionAttachment,
|
|
3590
|
+
addFormRevisionAttachments,
|
|
3591
|
+
deleteFormRevisionAttachment,
|
|
3592
|
+
deleteFormRevisionAttachments
|
|
3593
|
+
} = formRevisionsSlice.actions;
|
|
3594
|
+
const selectFormRevisionMapping = (state) => state.formRevisionReducer.formRevisions;
|
|
3595
|
+
const selectFormRevisions = toolkit.createSelector(
|
|
3596
|
+
[selectFormRevisionMapping],
|
|
3597
|
+
(formRevisions) => Object.values(formRevisions)
|
|
3598
|
+
);
|
|
3599
|
+
const selectFormRevision = (formRevisionId) => (state) => {
|
|
3600
|
+
return state.formRevisionReducer.formRevisions[formRevisionId];
|
|
3601
|
+
};
|
|
3602
|
+
const _selectLatestFormRevision = (formRevisions, formId2) => {
|
|
3603
|
+
let ret = null;
|
|
3604
|
+
for (const candidate of Object.values(formRevisions)) {
|
|
3605
|
+
if (candidate.form === formId2 && (!ret || ret.revision < candidate.revision)) {
|
|
3606
|
+
ret = candidate;
|
|
3607
|
+
}
|
|
3608
|
+
}
|
|
3609
|
+
if (!ret) {
|
|
3610
|
+
throw new Error("No form revision found for form " + formId2);
|
|
3611
|
+
}
|
|
3612
|
+
return ret;
|
|
3613
|
+
};
|
|
3614
|
+
const selectLatestFormRevisionOfForm = restructureCreateSelectorWithArgs(
|
|
3615
|
+
toolkit.createSelector([selectFormRevisions, (_state, formId2) => formId2], (revisions, formId2) => {
|
|
3616
|
+
return revisions.filter((revision) => revision.form === formId2).sort(formRevisionSortFn).pop();
|
|
3617
|
+
})
|
|
3618
|
+
);
|
|
3619
|
+
const selectFormRevisionsOfForm = restructureCreateSelectorWithArgs(
|
|
3620
|
+
toolkit.createSelector([selectFormRevisions, (_state, formId2) => formId2], (revisions, formId2) => {
|
|
3621
|
+
return revisions.filter((revision) => {
|
|
3622
|
+
return revision.form === formId2;
|
|
3623
|
+
});
|
|
3624
|
+
})
|
|
3625
|
+
);
|
|
3626
|
+
const selectLatestFormRevisionsOfComponentTypes = restructureCreateSelectorWithArgs(
|
|
3627
|
+
toolkit.createSelector(
|
|
3628
|
+
[
|
|
3629
|
+
(state) => state.formReducer.forms,
|
|
3630
|
+
selectFormRevisionMapping,
|
|
3631
|
+
(_state, componentTypeIds) => componentTypeIds
|
|
3632
|
+
],
|
|
3633
|
+
(userForms, revisions, componentTypeIds) => {
|
|
3634
|
+
const componentTypeIdsSet = new Set(componentTypeIds);
|
|
3635
|
+
const formsOfComponentTypes = {};
|
|
3636
|
+
const ret = {};
|
|
3637
|
+
for (const form of Object.values(userForms)) {
|
|
3638
|
+
if (form.component_type && componentTypeIdsSet.has(form.component_type)) {
|
|
3639
|
+
formsOfComponentTypes[form.component_type] = form;
|
|
3640
|
+
}
|
|
3641
|
+
}
|
|
3642
|
+
for (const revision of Object.values(revisions)) {
|
|
3643
|
+
const form = formsOfComponentTypes[revision.form];
|
|
3644
|
+
if (!form || !form.component_type || !ret[form.component_type] || formRevisionSortFn(ret[form.component_type], revision) < 0)
|
|
3645
|
+
continue;
|
|
3646
|
+
ret[form.component_type] = revision;
|
|
3647
|
+
}
|
|
3648
|
+
return ret;
|
|
3649
|
+
}
|
|
3650
|
+
)
|
|
3651
|
+
);
|
|
3652
|
+
const selectLatestFormRevisionByForm = toolkit.createSelector([selectFormRevisionMapping], (revisions) => {
|
|
3653
|
+
const latestRevisions = {};
|
|
3654
|
+
for (const revision of Object.values(revisions)) {
|
|
3655
|
+
const formId2 = revision.form;
|
|
3656
|
+
const currentLatestRevision = latestRevisions[formId2];
|
|
3657
|
+
if (!currentLatestRevision || currentLatestRevision.revision < revision.revision) {
|
|
3658
|
+
latestRevisions[formId2] = revision;
|
|
3659
|
+
}
|
|
3660
|
+
}
|
|
3661
|
+
return latestRevisions;
|
|
3662
|
+
});
|
|
3663
|
+
const selectUserFormRevisionAttachmentsMapping = (state) => {
|
|
3664
|
+
return state.formRevisionReducer.attachments;
|
|
3665
|
+
};
|
|
3666
|
+
const selectAttachmentsOfFormRevision = restructureCreateSelectorWithArgs(
|
|
3667
|
+
toolkit.createSelector(
|
|
3668
|
+
[selectUserFormRevisionAttachmentsMapping, (_state, revisionId) => revisionId],
|
|
3669
|
+
(attachments, revisionId) => {
|
|
3670
|
+
return Object.values(attachments).filter((attachment) => attachment.revision === revisionId);
|
|
3671
|
+
}
|
|
3672
|
+
)
|
|
3673
|
+
);
|
|
3674
|
+
const formRevisionReducer = formRevisionsSlice.reducer;
|
|
3675
|
+
const initialState$4 = {
|
|
3676
|
+
forms: {}
|
|
3677
|
+
};
|
|
3678
|
+
const formSlice = toolkit.createSlice({
|
|
3679
|
+
name: "forms",
|
|
3680
|
+
initialState: initialState$4,
|
|
3681
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
|
|
3682
|
+
reducers: {
|
|
3683
|
+
setForms: (state, action) => {
|
|
3684
|
+
state.forms = {};
|
|
3685
|
+
action.payload.forEach((userForm) => {
|
|
3686
|
+
state.forms[userForm.offline_id] = userForm;
|
|
3597
3687
|
});
|
|
3598
3688
|
},
|
|
3689
|
+
addForm: (state, action) => {
|
|
3690
|
+
state.forms[action.payload.offline_id] = action.payload;
|
|
3691
|
+
},
|
|
3692
|
+
addForms: (state, action) => {
|
|
3693
|
+
for (const userForm of action.payload) {
|
|
3694
|
+
state.forms[userForm.offline_id] = userForm;
|
|
3695
|
+
}
|
|
3696
|
+
},
|
|
3599
3697
|
favoriteForm: (state, action) => {
|
|
3600
3698
|
const { formId: formId2 } = action.payload;
|
|
3601
|
-
const form = state.
|
|
3699
|
+
const form = state.forms[formId2];
|
|
3602
3700
|
if (!form) {
|
|
3603
3701
|
throw new Error("No form exists with the id " + formId2);
|
|
3604
3702
|
}
|
|
@@ -3606,48 +3704,23 @@ var __publicField = (obj, key, value) => {
|
|
|
3606
3704
|
},
|
|
3607
3705
|
unfavoriteForm: (state, action) => {
|
|
3608
3706
|
const { formId: formId2 } = action.payload;
|
|
3609
|
-
const form = state.
|
|
3707
|
+
const form = state.forms[formId2];
|
|
3610
3708
|
if (!form) {
|
|
3611
3709
|
throw new Error("No form exists with the id " + formId2);
|
|
3612
3710
|
}
|
|
3613
3711
|
form.favorite = false;
|
|
3614
3712
|
},
|
|
3615
|
-
|
|
3616
|
-
delete state.
|
|
3713
|
+
deleteForm: (state, action) => {
|
|
3714
|
+
delete state.forms[action.payload];
|
|
3617
3715
|
}
|
|
3618
3716
|
}
|
|
3619
3717
|
});
|
|
3620
|
-
const {
|
|
3621
|
-
|
|
3622
|
-
addUserForms,
|
|
3623
|
-
addUserFormRevisions,
|
|
3624
|
-
updateOrCreateUserFormSubmission,
|
|
3625
|
-
addUserFormSubmissions,
|
|
3626
|
-
deleteUserFormSubmission,
|
|
3627
|
-
deleteUserFormSubmissions,
|
|
3628
|
-
favoriteForm,
|
|
3629
|
-
unfavoriteForm,
|
|
3630
|
-
deleteUserForm,
|
|
3631
|
-
deleteUserFormRevision,
|
|
3632
|
-
deleteUserFormRevisions,
|
|
3633
|
-
setUserFormSubmissions,
|
|
3634
|
-
addUserFormRevision,
|
|
3635
|
-
addUserFormSubmissionAttachment,
|
|
3636
|
-
addUserFormRevisionAttachment,
|
|
3637
|
-
setUserFormSubmissionAttachments,
|
|
3638
|
-
setUserFormRevisionAttachments
|
|
3639
|
-
} = userFormSlice.actions;
|
|
3640
|
-
const selectSubmissionAttachments = (submissionId) => (state) => {
|
|
3641
|
-
return state.userFormReducer.submissionAttachments[submissionId] || [];
|
|
3642
|
-
};
|
|
3643
|
-
const selectRevisionAttachments = (revisionId) => (state) => {
|
|
3644
|
-
return state.userFormReducer.revisionAttachments[revisionId] || [];
|
|
3645
|
-
};
|
|
3646
|
-
const selectFilteredUserForms = restructureCreateSelectorWithArgs(
|
|
3718
|
+
const { setForms, addForm, addForms, favoriteForm, unfavoriteForm, deleteForm } = formSlice.actions;
|
|
3719
|
+
const selectFilteredForms = restructureCreateSelectorWithArgs(
|
|
3647
3720
|
toolkit.createSelector(
|
|
3648
3721
|
[
|
|
3649
|
-
(state) => state.
|
|
3650
|
-
(state) => state.
|
|
3722
|
+
(state) => state.formReducer.forms,
|
|
3723
|
+
(state) => state.formRevisionReducer.formRevisions,
|
|
3651
3724
|
(_state, search) => search
|
|
3652
3725
|
],
|
|
3653
3726
|
(userForms, revisions, search) => {
|
|
@@ -3681,63 +3754,188 @@ var __publicField = (obj, key, value) => {
|
|
|
3681
3754
|
{ memoizeOptions: { equalityCheck: reactRedux.shallowEqual } }
|
|
3682
3755
|
)
|
|
3683
3756
|
);
|
|
3684
|
-
const
|
|
3685
|
-
return state.
|
|
3757
|
+
const selectForm = (formId2) => (state) => {
|
|
3758
|
+
return state.formReducer.forms[formId2];
|
|
3686
3759
|
};
|
|
3687
|
-
const
|
|
3688
|
-
|
|
3689
|
-
for (const candidate of Object.values(revisions)) {
|
|
3690
|
-
if (candidate.form === formId2 && (!ret || ret.revision < candidate.revision)) {
|
|
3691
|
-
ret = candidate;
|
|
3692
|
-
}
|
|
3693
|
-
}
|
|
3694
|
-
if (!ret) {
|
|
3695
|
-
throw new Error("No revision found for form " + formId2);
|
|
3696
|
-
}
|
|
3697
|
-
return ret;
|
|
3760
|
+
const selectFormMapping = (state) => {
|
|
3761
|
+
return state.formReducer.forms;
|
|
3698
3762
|
};
|
|
3699
|
-
const
|
|
3763
|
+
const selectFormOfComponentType = restructureCreateSelectorWithArgs(
|
|
3700
3764
|
toolkit.createSelector(
|
|
3701
|
-
[
|
|
3702
|
-
(
|
|
3703
|
-
|
|
3704
|
-
throw new Error("formId is required");
|
|
3705
|
-
}
|
|
3706
|
-
return _selectLatestFormRevision(revisions, formId2);
|
|
3765
|
+
[selectFormMapping, (_state, componentTypeId) => componentTypeId],
|
|
3766
|
+
(userForms, componentTypeId) => {
|
|
3767
|
+
return Object.values(userForms).find((userForm) => userForm.component_type === componentTypeId);
|
|
3707
3768
|
}
|
|
3708
3769
|
)
|
|
3709
3770
|
);
|
|
3710
|
-
const
|
|
3711
|
-
return
|
|
3712
|
-
};
|
|
3713
|
-
const
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
const
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3771
|
+
const selectFormsCount = toolkit.createSelector([selectFormMapping], (userForms) => {
|
|
3772
|
+
return Object.keys(userForms).length;
|
|
3773
|
+
});
|
|
3774
|
+
const selectGeneralFormCount = toolkit.createSelector([selectFormMapping], (userForms) => {
|
|
3775
|
+
return Object.values(userForms).filter((form) => !form.component_type).length;
|
|
3776
|
+
});
|
|
3777
|
+
const formReducer = formSlice.reducer;
|
|
3778
|
+
const initialState$3 = {
|
|
3779
|
+
formSubmissions: {},
|
|
3780
|
+
attachments: {}
|
|
3781
|
+
};
|
|
3782
|
+
const formSubmissionSlice = toolkit.createSlice({
|
|
3783
|
+
name: "formSubmissions",
|
|
3784
|
+
initialState: initialState$3,
|
|
3785
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
|
|
3786
|
+
reducers: {
|
|
3787
|
+
setFormSubmission: (state, action) => {
|
|
3788
|
+
state.formSubmissions[action.payload.offline_id] = action.payload;
|
|
3789
|
+
},
|
|
3790
|
+
setFormSubmissions: (state, action) => {
|
|
3791
|
+
state.formSubmissions = {};
|
|
3792
|
+
for (const submission of action.payload) {
|
|
3793
|
+
state.formSubmissions[submission.offline_id] = submission;
|
|
3794
|
+
}
|
|
3795
|
+
},
|
|
3796
|
+
addFormSubmission: (state, action) => {
|
|
3797
|
+
if (action.payload.offline_id in state.formSubmissions) {
|
|
3798
|
+
throw new Error(`Submission with offline_id ${action.payload.offline_id} already exists`);
|
|
3799
|
+
}
|
|
3800
|
+
state.formSubmissions[action.payload.offline_id] = action.payload;
|
|
3801
|
+
},
|
|
3802
|
+
addFormSubmissions: (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} already exists`);
|
|
3806
|
+
}
|
|
3807
|
+
}
|
|
3808
|
+
for (const submission of action.payload) {
|
|
3809
|
+
state.formSubmissions[submission.offline_id] = submission;
|
|
3810
|
+
}
|
|
3811
|
+
},
|
|
3812
|
+
updateFormSubmission: (state, action) => {
|
|
3813
|
+
if (state.formSubmissions[action.payload.offline_id] === void 0) {
|
|
3814
|
+
throw new Error(`Submission with offline_id ${action.payload.offline_id} does not exist`);
|
|
3815
|
+
}
|
|
3816
|
+
state.formSubmissions[action.payload.offline_id] = action.payload;
|
|
3817
|
+
},
|
|
3818
|
+
updateFormSubmissions: (state, action) => {
|
|
3819
|
+
for (const submission of action.payload) {
|
|
3820
|
+
if (state.formSubmissions[submission.offline_id] === void 0) {
|
|
3821
|
+
throw new Error(`Submission with offline_id ${submission.offline_id} does not exist`);
|
|
3822
|
+
}
|
|
3823
|
+
}
|
|
3824
|
+
for (const submission of action.payload) {
|
|
3825
|
+
state.formSubmissions[submission.offline_id] = submission;
|
|
3826
|
+
}
|
|
3827
|
+
},
|
|
3828
|
+
deleteFormSubmission: (state, action) => {
|
|
3829
|
+
if (state.formSubmissions[action.payload] === void 0) {
|
|
3830
|
+
throw new Error(`Submission with offline_id ${action.payload} does not exist`);
|
|
3831
|
+
}
|
|
3832
|
+
delete state.formSubmissions[action.payload];
|
|
3833
|
+
},
|
|
3834
|
+
deleteFormSubmissions: (state, action) => {
|
|
3835
|
+
for (const offlineId of action.payload) {
|
|
3836
|
+
if (state.formSubmissions[offlineId] === void 0) {
|
|
3837
|
+
throw new Error(`Submission with offline_id ${offlineId} does not exist`);
|
|
3838
|
+
}
|
|
3839
|
+
delete state.formSubmissions[offlineId];
|
|
3840
|
+
}
|
|
3841
|
+
for (const offlineId of action.payload) {
|
|
3842
|
+
delete state.formSubmissions[offlineId];
|
|
3843
|
+
}
|
|
3844
|
+
},
|
|
3845
|
+
// Attachments
|
|
3846
|
+
addFormSubmissionAttachment: (state, action) => {
|
|
3847
|
+
if (state.attachments[action.payload.offline_id] !== void 0) {
|
|
3848
|
+
throw new Error(`Attachment with offline_id ${action.payload.offline_id} already exists`);
|
|
3849
|
+
}
|
|
3850
|
+
state.attachments[action.payload.offline_id] = action.payload;
|
|
3851
|
+
},
|
|
3852
|
+
addFormSubmissionAttachments: (state, action) => {
|
|
3853
|
+
for (const attachment of action.payload) {
|
|
3854
|
+
if (state.attachments[attachment.offline_id] !== void 0) {
|
|
3855
|
+
throw new Error(`Attachment with offline_id ${attachment.offline_id} already exists`);
|
|
3856
|
+
}
|
|
3857
|
+
}
|
|
3858
|
+
for (const attachment of action.payload) {
|
|
3859
|
+
state.attachments[attachment.offline_id] = attachment;
|
|
3860
|
+
}
|
|
3861
|
+
},
|
|
3862
|
+
// We only need a multi set for attachments because they are not updated, only added and deleted
|
|
3863
|
+
setFormSubmissionAttachments: (state, action) => {
|
|
3864
|
+
state.attachments = {};
|
|
3865
|
+
for (const attachment of action.payload) {
|
|
3866
|
+
state.attachments[attachment.offline_id] = attachment;
|
|
3867
|
+
}
|
|
3868
|
+
},
|
|
3869
|
+
updateFormSubmissionAttachments: (state, action) => {
|
|
3870
|
+
for (const attachment of action.payload) {
|
|
3871
|
+
if (state.attachments[attachment.offline_id] === void 0) {
|
|
3872
|
+
throw new Error(`Attachment with offline_id ${attachment.offline_id} does not exist`);
|
|
3873
|
+
}
|
|
3874
|
+
}
|
|
3875
|
+
for (const attachment of action.payload) {
|
|
3876
|
+
state.attachments[attachment.offline_id] = attachment;
|
|
3877
|
+
}
|
|
3878
|
+
},
|
|
3879
|
+
// The delete actions for UserFormSubmissionAttachments are not used in the app, but are included for completeness
|
|
3880
|
+
// Could be used if editing a submission is ever supported, will be applicable for supporting tip tap content in submissions
|
|
3881
|
+
deleteFormSubmissionAttachment: (state, action) => {
|
|
3882
|
+
if (state.attachments[action.payload] === void 0) {
|
|
3883
|
+
throw new Error(`Attachment with offline_id ${action.payload} does not exist`);
|
|
3884
|
+
}
|
|
3885
|
+
delete state.attachments[action.payload];
|
|
3886
|
+
},
|
|
3887
|
+
deleteFormSubmissionAttachments: (state, action) => {
|
|
3888
|
+
for (const offlineId of action.payload) {
|
|
3889
|
+
if (state.attachments[offlineId] === void 0) {
|
|
3890
|
+
throw new Error(`Attachment with offline_id ${offlineId} does not exist`);
|
|
3891
|
+
}
|
|
3892
|
+
delete state.attachments[offlineId];
|
|
3893
|
+
}
|
|
3894
|
+
}
|
|
3895
|
+
}
|
|
3896
|
+
});
|
|
3897
|
+
const {
|
|
3898
|
+
setFormSubmission,
|
|
3899
|
+
setFormSubmissions,
|
|
3900
|
+
addFormSubmission,
|
|
3901
|
+
addFormSubmissions,
|
|
3902
|
+
updateFormSubmission,
|
|
3903
|
+
updateFormSubmissions,
|
|
3904
|
+
deleteFormSubmission,
|
|
3905
|
+
deleteFormSubmissions,
|
|
3906
|
+
addFormSubmissionAttachment,
|
|
3907
|
+
addFormSubmissionAttachments,
|
|
3908
|
+
setFormSubmissionAttachments,
|
|
3909
|
+
updateFormSubmissionAttachments,
|
|
3910
|
+
deleteFormSubmissionAttachment,
|
|
3911
|
+
deleteFormSubmissionAttachments
|
|
3912
|
+
} = formSubmissionSlice.actions;
|
|
3913
|
+
const selectFormSubmissionsMapping = (state) => {
|
|
3914
|
+
return state.formSubmissionReducer.formSubmissions;
|
|
3915
|
+
};
|
|
3916
|
+
const selectFormSubmissions = toolkit.createSelector(
|
|
3917
|
+
[selectFormSubmissionsMapping],
|
|
3918
|
+
(submissions) => {
|
|
3919
|
+
return Object.values(submissions);
|
|
3920
|
+
}
|
|
3726
3921
|
);
|
|
3727
|
-
const
|
|
3922
|
+
const selectFormSubmission = (submissionId) => (state) => {
|
|
3923
|
+
return state.formSubmissionReducer.formSubmissions[submissionId];
|
|
3924
|
+
};
|
|
3925
|
+
const selectFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
|
|
3728
3926
|
toolkit.createSelector(
|
|
3729
|
-
[
|
|
3927
|
+
[selectFormSubmissions, selectFormRevisionMapping, (_state, formId2) => formId2],
|
|
3730
3928
|
(submissions, revisionMapping, formId2) => {
|
|
3731
|
-
return
|
|
3929
|
+
return submissions.filter((submission) => {
|
|
3732
3930
|
const revision = revisionMapping[submission.form_revision];
|
|
3733
3931
|
return (revision == null ? void 0 : revision.form) === formId2;
|
|
3734
3932
|
});
|
|
3735
3933
|
}
|
|
3736
3934
|
)
|
|
3737
3935
|
);
|
|
3738
|
-
const
|
|
3936
|
+
const selectFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
3739
3937
|
toolkit.createSelector(
|
|
3740
|
-
[
|
|
3938
|
+
[selectFormSubmissions, (_state, issueId) => issueId],
|
|
3741
3939
|
(submissions, issueId) => {
|
|
3742
3940
|
return Object.values(submissions).filter((submission) => {
|
|
3743
3941
|
return submission.issue === issueId;
|
|
@@ -3745,9 +3943,9 @@ var __publicField = (obj, key, value) => {
|
|
|
3745
3943
|
}
|
|
3746
3944
|
)
|
|
3747
3945
|
);
|
|
3748
|
-
const
|
|
3946
|
+
const selectFormSubmissionsOfComponent = restructureCreateSelectorWithArgs(
|
|
3749
3947
|
toolkit.createSelector(
|
|
3750
|
-
[
|
|
3948
|
+
[selectFormSubmissions, (_state, componentId) => componentId],
|
|
3751
3949
|
(submissions, componentId) => {
|
|
3752
3950
|
return submissions.filter((submission) => {
|
|
3753
3951
|
return submission.component === componentId;
|
|
@@ -3755,8 +3953,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3755
3953
|
}
|
|
3756
3954
|
)
|
|
3757
3955
|
);
|
|
3758
|
-
const
|
|
3759
|
-
[
|
|
3956
|
+
const selectFormSubmissionsByComponents = toolkit.createSelector(
|
|
3957
|
+
[selectFormSubmissionsMapping, selectComponentsMapping],
|
|
3760
3958
|
(submissions, components) => {
|
|
3761
3959
|
var _a2;
|
|
3762
3960
|
const componentSubmissionMapping = {};
|
|
@@ -3772,54 +3970,18 @@ var __publicField = (obj, key, value) => {
|
|
|
3772
3970
|
return componentSubmissionMapping;
|
|
3773
3971
|
}
|
|
3774
3972
|
);
|
|
3775
|
-
const
|
|
3776
|
-
return state.
|
|
3973
|
+
const selectFormSubmissionAttachmentsMapping = (state) => {
|
|
3974
|
+
return state.formSubmissionReducer.attachments;
|
|
3777
3975
|
};
|
|
3778
|
-
const
|
|
3976
|
+
const selectAttachmentsOfFormSubmission = restructureCreateSelectorWithArgs(
|
|
3779
3977
|
toolkit.createSelector(
|
|
3780
|
-
[
|
|
3781
|
-
(
|
|
3782
|
-
return Object.values(
|
|
3978
|
+
[selectFormSubmissionAttachmentsMapping, (_state, submissionId) => submissionId],
|
|
3979
|
+
(attachmentsMapping, submissionId) => {
|
|
3980
|
+
return Object.values(attachmentsMapping).filter((attachment) => attachment.submission === submissionId);
|
|
3783
3981
|
}
|
|
3784
3982
|
)
|
|
3785
3983
|
);
|
|
3786
|
-
const
|
|
3787
|
-
toolkit.createSelector(
|
|
3788
|
-
[
|
|
3789
|
-
selectUserFormMapping,
|
|
3790
|
-
selectRevisionMapping,
|
|
3791
|
-
(_state, componentTypeIds) => componentTypeIds
|
|
3792
|
-
],
|
|
3793
|
-
(userForms, revisions, componentTypeIds) => {
|
|
3794
|
-
const componentTypeIdsSet = new Set(componentTypeIds);
|
|
3795
|
-
const ret = {};
|
|
3796
|
-
for (const form of Object.values(userForms)) {
|
|
3797
|
-
if (form.component_type && componentTypeIdsSet.has(form.component_type)) {
|
|
3798
|
-
ret[form.component_type] = _selectLatestFormRevision(revisions, form.offline_id);
|
|
3799
|
-
}
|
|
3800
|
-
}
|
|
3801
|
-
return ret;
|
|
3802
|
-
}
|
|
3803
|
-
)
|
|
3804
|
-
);
|
|
3805
|
-
const selectLatestRevisionByFormId = toolkit.createSelector([selectRevisionMapping], (revisions) => {
|
|
3806
|
-
const latestRevisions = {};
|
|
3807
|
-
for (const revision of Object.values(revisions)) {
|
|
3808
|
-
const formId2 = revision.form;
|
|
3809
|
-
const currentLatestRevision = latestRevisions[formId2];
|
|
3810
|
-
if (!currentLatestRevision || currentLatestRevision.revision < revision.revision) {
|
|
3811
|
-
latestRevisions[formId2] = revision;
|
|
3812
|
-
}
|
|
3813
|
-
}
|
|
3814
|
-
return latestRevisions;
|
|
3815
|
-
});
|
|
3816
|
-
const selectNumberOfUserForms = toolkit.createSelector([selectUserFormMapping], (userForms) => {
|
|
3817
|
-
return Object.keys(userForms).length;
|
|
3818
|
-
});
|
|
3819
|
-
const selectNumberOfGeneralUserForms = toolkit.createSelector([selectUserFormMapping], (userForms) => {
|
|
3820
|
-
return Object.values(userForms).filter((form) => !form.component_type).length;
|
|
3821
|
-
});
|
|
3822
|
-
const userFormReducer = userFormSlice.reducer;
|
|
3984
|
+
const formSubmissionReducer = formSubmissionSlice.reducer;
|
|
3823
3985
|
const initialState$2 = {
|
|
3824
3986
|
emailDomains: {}
|
|
3825
3987
|
};
|
|
@@ -4117,7 +4279,9 @@ var __publicField = (obj, key, value) => {
|
|
|
4117
4279
|
projectFileReducer,
|
|
4118
4280
|
rehydratedReducer,
|
|
4119
4281
|
settingReducer,
|
|
4120
|
-
|
|
4282
|
+
formReducer,
|
|
4283
|
+
formRevisionReducer,
|
|
4284
|
+
formSubmissionReducer,
|
|
4121
4285
|
userReducer,
|
|
4122
4286
|
workspaceReducer,
|
|
4123
4287
|
emailDomainsReducer,
|
|
@@ -4170,9 +4334,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4170
4334
|
throw new Error(`Failed to update index_workspace of issue ${issue.offline_id} to main workspace`);
|
|
4171
4335
|
}
|
|
4172
4336
|
}
|
|
4173
|
-
const indexedForms = Object.values(draft.
|
|
4174
|
-
(form) => form.index_workspace === workspaceId
|
|
4175
|
-
);
|
|
4337
|
+
const indexedForms = Object.values(draft.formReducer.forms).filter((form) => form.index_workspace === workspaceId);
|
|
4176
4338
|
for (const form of indexedForms) {
|
|
4177
4339
|
form.index_workspace = mainWorkspace.offline_id;
|
|
4178
4340
|
}
|
|
@@ -6800,7 +6962,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6800
6962
|
...revisionAttachmentPayload,
|
|
6801
6963
|
file: URL.createObjectURL(image)
|
|
6802
6964
|
};
|
|
6803
|
-
store.dispatch(
|
|
6965
|
+
store.dispatch(addFormRevisionAttachment(offlinePayload));
|
|
6804
6966
|
return attach;
|
|
6805
6967
|
});
|
|
6806
6968
|
});
|
|
@@ -6836,8 +6998,8 @@ var __publicField = (obj, key, value) => {
|
|
|
6836
6998
|
submitted_at: submittedAt
|
|
6837
6999
|
};
|
|
6838
7000
|
const { store } = this.client;
|
|
6839
|
-
store.dispatch(
|
|
6840
|
-
store.dispatch(
|
|
7001
|
+
store.dispatch(addForm(retForm));
|
|
7002
|
+
store.dispatch(addFormRevision(retRevision));
|
|
6841
7003
|
const formPromise = this.enqueueRequest({
|
|
6842
7004
|
description: "Create form",
|
|
6843
7005
|
method: HttpMethod.POST,
|
|
@@ -6855,8 +7017,8 @@ var __publicField = (obj, key, value) => {
|
|
|
6855
7017
|
});
|
|
6856
7018
|
const attachImagesPromises = this.getAttachImagePromises(images, offlineRevisionPayload.offline_id);
|
|
6857
7019
|
void formPromise.catch((e) => {
|
|
6858
|
-
store.dispatch(
|
|
6859
|
-
store.dispatch(
|
|
7020
|
+
store.dispatch(deleteForm(retForm.offline_id));
|
|
7021
|
+
store.dispatch(deleteFormRevision(retRevision.offline_id));
|
|
6860
7022
|
throw e;
|
|
6861
7023
|
});
|
|
6862
7024
|
const settledPromise = Promise.all([formPromise, ...attachImagesPromises]).then(() => formPromise);
|
|
@@ -6899,7 +7061,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6899
7061
|
form: formId2,
|
|
6900
7062
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
6901
7063
|
};
|
|
6902
|
-
store.dispatch(
|
|
7064
|
+
store.dispatch(addFormRevision(fullRevision));
|
|
6903
7065
|
const promise = this.enqueueRequest({
|
|
6904
7066
|
description: "Create form revision",
|
|
6905
7067
|
method: HttpMethod.PATCH,
|
|
@@ -6913,9 +7075,9 @@ var __publicField = (obj, key, value) => {
|
|
|
6913
7075
|
});
|
|
6914
7076
|
const attachImagesPromises = this.getAttachImagePromises(images, offlineRevision.offline_id);
|
|
6915
7077
|
void promise.then((result) => {
|
|
6916
|
-
store.dispatch(
|
|
7078
|
+
store.dispatch(setFormRevision(result));
|
|
6917
7079
|
}).catch(() => {
|
|
6918
|
-
store.dispatch(
|
|
7080
|
+
store.dispatch(deleteFormRevision(fullRevision.offline_id));
|
|
6919
7081
|
});
|
|
6920
7082
|
const settledPromise = Promise.all([promise, ...attachImagesPromises]).then(() => promise);
|
|
6921
7083
|
return [fullRevision, settledPromise];
|
|
@@ -6957,19 +7119,19 @@ var __publicField = (obj, key, value) => {
|
|
|
6957
7119
|
async delete(formId2) {
|
|
6958
7120
|
const { store } = this.client;
|
|
6959
7121
|
const state = store.getState();
|
|
6960
|
-
const userForm =
|
|
7122
|
+
const userForm = selectForm(formId2)(state);
|
|
6961
7123
|
if (!userForm) {
|
|
6962
7124
|
throw new Error("Expected userForm to exist");
|
|
6963
7125
|
}
|
|
6964
|
-
const userFormSubmissions =
|
|
7126
|
+
const userFormSubmissions = selectFormSubmissionsOfForm(formId2)(state);
|
|
6965
7127
|
if (userFormSubmissions && userFormSubmissions.length > 0) {
|
|
6966
|
-
store.dispatch(
|
|
7128
|
+
store.dispatch(deleteFormSubmissions(userFormSubmissions.map(({ offline_id }) => offline_id)));
|
|
6967
7129
|
}
|
|
6968
|
-
const userFormRevisions =
|
|
7130
|
+
const userFormRevisions = selectFormRevisionsOfForm(formId2)(state);
|
|
6969
7131
|
if (userFormRevisions && userFormRevisions.length > 0) {
|
|
6970
|
-
store.dispatch(
|
|
7132
|
+
store.dispatch(deleteFormRevisions(userFormRevisions.map(({ offline_id }) => offline_id)));
|
|
6971
7133
|
}
|
|
6972
|
-
store.dispatch(
|
|
7134
|
+
store.dispatch(deleteForm(formId2));
|
|
6973
7135
|
try {
|
|
6974
7136
|
return await this.enqueueRequest({
|
|
6975
7137
|
description: "Delete form",
|
|
@@ -6979,12 +7141,12 @@ var __publicField = (obj, key, value) => {
|
|
|
6979
7141
|
blocks: []
|
|
6980
7142
|
});
|
|
6981
7143
|
} catch (e) {
|
|
6982
|
-
store.dispatch(
|
|
7144
|
+
store.dispatch(addForm(userForm));
|
|
6983
7145
|
if (userFormRevisions && userFormRevisions.length > 0) {
|
|
6984
|
-
store.dispatch(
|
|
7146
|
+
store.dispatch(addFormRevisions(userFormRevisions));
|
|
6985
7147
|
}
|
|
6986
7148
|
if (userFormSubmissions && userFormSubmissions.length > 0) {
|
|
6987
|
-
store.dispatch(
|
|
7149
|
+
store.dispatch(addFormSubmissions(userFormSubmissions));
|
|
6988
7150
|
}
|
|
6989
7151
|
throw e;
|
|
6990
7152
|
}
|
|
@@ -6998,16 +7160,15 @@ var __publicField = (obj, key, value) => {
|
|
|
6998
7160
|
blockers: [],
|
|
6999
7161
|
blocks: []
|
|
7000
7162
|
});
|
|
7001
|
-
store.dispatch(
|
|
7002
|
-
store.dispatch(
|
|
7003
|
-
store.dispatch(
|
|
7163
|
+
store.dispatch(setForms(Object.values(result.forms)));
|
|
7164
|
+
store.dispatch(setFormRevisions(Object.values(result.revisions)));
|
|
7165
|
+
store.dispatch(setFormRevisionAttachments(Object.values(result.attachments)));
|
|
7004
7166
|
}
|
|
7005
7167
|
}
|
|
7006
7168
|
const isArrayOfFiles = (value) => {
|
|
7007
7169
|
return Array.isArray(value) && value[0] instanceof File;
|
|
7008
7170
|
};
|
|
7009
|
-
const separateFilesFromValues = (
|
|
7010
|
-
const { values } = payload;
|
|
7171
|
+
const separateFilesFromValues = (values) => {
|
|
7011
7172
|
const files = {};
|
|
7012
7173
|
const newValues = {};
|
|
7013
7174
|
for (const key in values) {
|
|
@@ -7022,17 +7183,13 @@ var __publicField = (obj, key, value) => {
|
|
|
7022
7183
|
newValues[key] = value;
|
|
7023
7184
|
}
|
|
7024
7185
|
}
|
|
7025
|
-
|
|
7026
|
-
...payload,
|
|
7027
|
-
values: newValues
|
|
7028
|
-
};
|
|
7029
|
-
return { payloadWithoutFiles, files };
|
|
7186
|
+
return { values: newValues, files };
|
|
7030
7187
|
};
|
|
7031
7188
|
class UserFormSubmissionService extends BaseApiService {
|
|
7032
7189
|
constructor() {
|
|
7033
7190
|
super(...arguments);
|
|
7034
7191
|
// Attach files to submission, after uploading them to S3
|
|
7035
|
-
__publicField(this, "getAttachFilesPromises", (files,
|
|
7192
|
+
__publicField(this, "getAttachFilesPromises", (files, submission) => {
|
|
7036
7193
|
const { store } = this.client;
|
|
7037
7194
|
return Object.entries(files).map(async ([key, fileArray]) => {
|
|
7038
7195
|
const attachResults = [];
|
|
@@ -7042,24 +7199,27 @@ var __publicField = (obj, key, value) => {
|
|
|
7042
7199
|
const [fileProps] = await this.client.files.uploadFileToS3(sha1);
|
|
7043
7200
|
const submissionAttachmentPayload = offline({
|
|
7044
7201
|
...fileProps,
|
|
7045
|
-
submission:
|
|
7202
|
+
submission: submission.offline_id,
|
|
7046
7203
|
field_identifier: key
|
|
7047
7204
|
});
|
|
7048
7205
|
const attach = await this.enqueueRequest({
|
|
7049
7206
|
description: "Attach file to form submission",
|
|
7050
7207
|
method: HttpMethod.POST,
|
|
7051
|
-
url: `/forms/submission/${
|
|
7208
|
+
url: `/forms/submission/${submission.offline_id}/attachments/`,
|
|
7052
7209
|
payload: submissionAttachmentPayload,
|
|
7053
|
-
blockers: [
|
|
7054
|
-
|
|
7055
|
-
|
|
7210
|
+
blockers: [
|
|
7211
|
+
submission.component,
|
|
7212
|
+
submission.component_stage,
|
|
7213
|
+
submission.issue,
|
|
7214
|
+
submission.form_revision
|
|
7215
|
+
].filter((x) => x !== void 0),
|
|
7056
7216
|
blocks: [submissionAttachmentPayload.offline_id]
|
|
7057
7217
|
});
|
|
7058
7218
|
const offlinePayload = {
|
|
7059
7219
|
...submissionAttachmentPayload,
|
|
7060
7220
|
file: URL.createObjectURL(file)
|
|
7061
7221
|
};
|
|
7062
|
-
store.dispatch(
|
|
7222
|
+
store.dispatch(addFormSubmissionAttachment(offlinePayload));
|
|
7063
7223
|
attachResults.push(attach);
|
|
7064
7224
|
}
|
|
7065
7225
|
return attachResults;
|
|
@@ -7073,71 +7233,168 @@ var __publicField = (obj, key, value) => {
|
|
|
7073
7233
|
if (!activeProjectId) {
|
|
7074
7234
|
throw new Error("Expected an active project");
|
|
7075
7235
|
}
|
|
7076
|
-
const {
|
|
7236
|
+
const { values, files } = separateFilesFromValues(payload.values);
|
|
7237
|
+
const offlineSubmission = {
|
|
7238
|
+
...payload,
|
|
7239
|
+
values,
|
|
7240
|
+
created_by: state.userReducer.currentUser.id,
|
|
7241
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7242
|
+
};
|
|
7077
7243
|
const promise = this.enqueueRequest({
|
|
7078
7244
|
description: "Respond to form",
|
|
7079
7245
|
method: HttpMethod.POST,
|
|
7080
7246
|
url: `/forms/revisions/${payload.form_revision}/respond/`,
|
|
7081
|
-
payload: { ...
|
|
7247
|
+
payload: { ...offlineSubmission, project: activeProjectId },
|
|
7082
7248
|
blockers: [payload.issue, payload.component, payload.component_stage, "add-form-entry"].filter(
|
|
7083
7249
|
(x) => x !== void 0
|
|
7084
7250
|
),
|
|
7085
7251
|
blocks: [payload.offline_id]
|
|
7086
7252
|
});
|
|
7087
|
-
const attachFilesPromises = this.getAttachFilesPromises(files,
|
|
7088
|
-
|
|
7089
|
-
const fullOfflineResult = {
|
|
7090
|
-
...payload,
|
|
7091
|
-
created_by: state.userReducer.currentUser.id,
|
|
7092
|
-
created_at: now,
|
|
7093
|
-
updated_at: now
|
|
7094
|
-
};
|
|
7095
|
-
const offlineResultWithoutFiles = {
|
|
7096
|
-
...fullOfflineResult,
|
|
7097
|
-
...payloadWithoutFiles
|
|
7098
|
-
};
|
|
7099
|
-
store.dispatch(updateOrCreateUserFormSubmission(offlineResultWithoutFiles));
|
|
7253
|
+
const attachFilesPromises = this.getAttachFilesPromises(files, offlineSubmission);
|
|
7254
|
+
store.dispatch(addFormSubmission(offlineSubmission));
|
|
7100
7255
|
void promise.then((result) => {
|
|
7101
7256
|
store.dispatch(addActiveProjectFormSubmissionsCount(1));
|
|
7102
|
-
store.dispatch(
|
|
7257
|
+
store.dispatch(setFormSubmission(result));
|
|
7103
7258
|
return result;
|
|
7104
7259
|
}).catch(() => {
|
|
7105
|
-
store.dispatch(
|
|
7260
|
+
store.dispatch(deleteFormSubmission(payload.offline_id));
|
|
7106
7261
|
store.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
7107
7262
|
});
|
|
7108
7263
|
const settledPromise = Promise.all([promise, ...attachFilesPromises]).then(() => promise);
|
|
7109
|
-
return [
|
|
7264
|
+
return [offlineSubmission, settledPromise];
|
|
7110
7265
|
}
|
|
7111
|
-
|
|
7266
|
+
// Note currently the bulkAdd method is specific to form submissions for components
|
|
7267
|
+
// TODO: adapt the support bulk adding to any model type
|
|
7268
|
+
async bulkAdd(args) {
|
|
7269
|
+
const { formRevision, values: argsValues, componentOfflineIds } = args;
|
|
7112
7270
|
const { store } = this.client;
|
|
7113
|
-
const
|
|
7114
|
-
|
|
7115
|
-
|
|
7271
|
+
const offlineSubmissions = [];
|
|
7272
|
+
const offlineAttachments = [];
|
|
7273
|
+
const submissionOfflineIds = [];
|
|
7274
|
+
const submissionsPayload = [];
|
|
7275
|
+
const attachmentsPayload = [];
|
|
7276
|
+
const { values, files } = separateFilesFromValues(argsValues);
|
|
7277
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7278
|
+
const createdBy = store.getState().userReducer.currentUser.id;
|
|
7279
|
+
for (const component_id of componentOfflineIds) {
|
|
7280
|
+
const submission = offline({
|
|
7281
|
+
form_revision: formRevision,
|
|
7282
|
+
values,
|
|
7283
|
+
created_by: createdBy,
|
|
7284
|
+
submitted_at: submittedAt,
|
|
7285
|
+
component: component_id
|
|
7286
|
+
});
|
|
7287
|
+
submissionOfflineIds.push(submission.offline_id);
|
|
7288
|
+
submissionsPayload.push({ offline_id: submission.offline_id, component_id });
|
|
7289
|
+
offlineSubmissions.push(submission);
|
|
7290
|
+
for (const [fieldIdentifier, fileArray] of Object.entries(files)) {
|
|
7291
|
+
for (const file of fileArray) {
|
|
7292
|
+
const sha1 = await hashFile(file);
|
|
7293
|
+
await this.client.files.addCache(file, sha1);
|
|
7294
|
+
const offlineAttachment = offline({
|
|
7295
|
+
file_name: file.name,
|
|
7296
|
+
file_sha1: sha1,
|
|
7297
|
+
file: URL.createObjectURL(file),
|
|
7298
|
+
submission: submission.offline_id,
|
|
7299
|
+
field_identifier: fieldIdentifier
|
|
7300
|
+
});
|
|
7301
|
+
offlineAttachments.push(offlineAttachment);
|
|
7302
|
+
attachmentsPayload.push({
|
|
7303
|
+
offline_id: offlineAttachment.offline_id,
|
|
7304
|
+
submission_id: submission.offline_id,
|
|
7305
|
+
sha1,
|
|
7306
|
+
name: file.name,
|
|
7307
|
+
field_identifier: fieldIdentifier
|
|
7308
|
+
});
|
|
7309
|
+
}
|
|
7310
|
+
}
|
|
7116
7311
|
}
|
|
7312
|
+
const filesRecord = {};
|
|
7313
|
+
for (const file of Object.values(files).flat()) {
|
|
7314
|
+
const sha1 = await hashFile(file);
|
|
7315
|
+
filesRecord[sha1] = {
|
|
7316
|
+
sha1,
|
|
7317
|
+
extension: file.name.split(".").pop() || "",
|
|
7318
|
+
file_type: file.type,
|
|
7319
|
+
size: file.size
|
|
7320
|
+
};
|
|
7321
|
+
}
|
|
7322
|
+
store.dispatch(addFormSubmissions(offlineSubmissions));
|
|
7323
|
+
store.dispatch(addFormSubmissionAttachments(offlineAttachments));
|
|
7324
|
+
const promise = this.enqueueRequest({
|
|
7325
|
+
description: "Bulk add form submissions",
|
|
7326
|
+
method: HttpMethod.POST,
|
|
7327
|
+
url: `/forms/revisions/${formRevision}/bulk-respond/`,
|
|
7328
|
+
payload: {
|
|
7329
|
+
form_data: values,
|
|
7330
|
+
submitted_at: submittedAt,
|
|
7331
|
+
submissions: submissionsPayload,
|
|
7332
|
+
attachments: attachmentsPayload,
|
|
7333
|
+
files: Object.values(filesRecord)
|
|
7334
|
+
},
|
|
7335
|
+
blockers: componentOfflineIds,
|
|
7336
|
+
blocks: submissionOfflineIds
|
|
7337
|
+
});
|
|
7338
|
+
promise.then(({ submissions, attachments, presigned_urls }) => {
|
|
7339
|
+
store.dispatch(updateFormSubmissions(submissions));
|
|
7340
|
+
store.dispatch(updateFormSubmissionAttachments(attachments));
|
|
7341
|
+
for (const [sha1, presigned_url] of Object.entries(presigned_urls)) {
|
|
7342
|
+
const file = filesRecord[sha1];
|
|
7343
|
+
if (!file)
|
|
7344
|
+
continue;
|
|
7345
|
+
void this.enqueueRequest({
|
|
7346
|
+
url: presigned_url.url,
|
|
7347
|
+
description: "Upload file",
|
|
7348
|
+
method: HttpMethod.POST,
|
|
7349
|
+
isExternalUrl: true,
|
|
7350
|
+
isAuthNeeded: false,
|
|
7351
|
+
attachmentHash: sha1,
|
|
7352
|
+
blockers: [`s3-${file.sha1}.${file.extension}`],
|
|
7353
|
+
blocks: [sha1],
|
|
7354
|
+
s3url: presigned_url
|
|
7355
|
+
});
|
|
7356
|
+
}
|
|
7357
|
+
}).catch(() => {
|
|
7358
|
+
store.dispatch(deleteFormSubmissions(submissionOfflineIds));
|
|
7359
|
+
store.dispatch(deleteFormSubmissionAttachments(offlineAttachments.map((x) => x.offline_id)));
|
|
7360
|
+
});
|
|
7361
|
+
return [offlineSubmissions, promise.then(({ submissions }) => submissions)];
|
|
7362
|
+
}
|
|
7363
|
+
update(submission) {
|
|
7364
|
+
const { store } = this.client;
|
|
7365
|
+
const { values, files } = separateFilesFromValues(submission.values);
|
|
7117
7366
|
const attachFilesPromises = this.getAttachFilesPromises(files, submission);
|
|
7118
|
-
const
|
|
7119
|
-
...
|
|
7120
|
-
|
|
7367
|
+
const offlineSubmission = {
|
|
7368
|
+
...submission,
|
|
7369
|
+
values
|
|
7121
7370
|
};
|
|
7122
|
-
store.
|
|
7371
|
+
const submissionToBeUpdated = store.getState().formSubmissionReducer.formSubmissions[submission.offline_id];
|
|
7372
|
+
store.dispatch(updateFormSubmission(offlineSubmission));
|
|
7123
7373
|
const promise = this.enqueueRequest({
|
|
7124
7374
|
description: "Patch form submission",
|
|
7125
7375
|
method: HttpMethod.PATCH,
|
|
7126
7376
|
url: `/forms/submissions/${submission.offline_id}/`,
|
|
7127
|
-
payload:
|
|
7128
|
-
blockers: [
|
|
7377
|
+
payload: offlineSubmission,
|
|
7378
|
+
blockers: [offlineSubmission.issue, offlineSubmission.component, offlineSubmission.component_stage].filter(
|
|
7129
7379
|
(x) => x !== void 0
|
|
7130
7380
|
),
|
|
7131
|
-
blocks: [
|
|
7381
|
+
blocks: [offlineSubmission.offline_id]
|
|
7132
7382
|
});
|
|
7133
|
-
|
|
7383
|
+
promise.then((createdSubmission) => {
|
|
7384
|
+
store.dispatch(setFormSubmission(createdSubmission));
|
|
7385
|
+
}).catch(() => {
|
|
7386
|
+
store.dispatch(setFormSubmission(submissionToBeUpdated));
|
|
7387
|
+
});
|
|
7388
|
+
return [offlineSubmission, Promise.all([promise, ...attachFilesPromises]).then(() => promise)];
|
|
7134
7389
|
}
|
|
7135
7390
|
async delete(submissionId) {
|
|
7136
7391
|
const { store } = this.client;
|
|
7137
7392
|
const state = store.getState();
|
|
7138
|
-
const submission = state.
|
|
7139
|
-
|
|
7393
|
+
const submission = state.formSubmissionReducer.formSubmissions[submissionId];
|
|
7394
|
+
const submissionAttachments = selectAttachmentsOfFormSubmission(submissionId)(state);
|
|
7395
|
+
store.dispatch(deleteFormSubmission(submissionId));
|
|
7140
7396
|
store.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
7397
|
+
store.dispatch(deleteFormSubmissionAttachments(submissionAttachments.map((x) => x.offline_id)));
|
|
7141
7398
|
try {
|
|
7142
7399
|
return await this.enqueueRequest({
|
|
7143
7400
|
description: "Delete user form submissions",
|
|
@@ -7147,10 +7404,9 @@ var __publicField = (obj, key, value) => {
|
|
|
7147
7404
|
blocks: []
|
|
7148
7405
|
});
|
|
7149
7406
|
} catch (e) {
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
}
|
|
7407
|
+
store.dispatch(addActiveProjectFormSubmissionsCount(1));
|
|
7408
|
+
store.dispatch(addFormSubmission(submission));
|
|
7409
|
+
store.dispatch(addFormSubmissionAttachments(submissionAttachments));
|
|
7154
7410
|
throw e;
|
|
7155
7411
|
}
|
|
7156
7412
|
}
|
|
@@ -7164,7 +7420,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7164
7420
|
blockers: [],
|
|
7165
7421
|
blocks: []
|
|
7166
7422
|
});
|
|
7167
|
-
store.dispatch(
|
|
7423
|
+
store.dispatch(setFormSubmissions(submissions));
|
|
7168
7424
|
const attachments = await this.enqueueRequest({
|
|
7169
7425
|
description: "Fetch form attachments",
|
|
7170
7426
|
method: HttpMethod.GET,
|
|
@@ -7172,7 +7428,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7172
7428
|
blockers: [],
|
|
7173
7429
|
blocks: []
|
|
7174
7430
|
});
|
|
7175
|
-
store.dispatch(
|
|
7431
|
+
store.dispatch(setFormSubmissionAttachments(attachments));
|
|
7176
7432
|
}
|
|
7177
7433
|
}
|
|
7178
7434
|
class WorkspaceService extends BaseApiService {
|
|
@@ -14030,7 +14286,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14030
14286
|
};
|
|
14031
14287
|
const useAttachImagesToFormRevisionFields = (revision) => {
|
|
14032
14288
|
const { sdk } = useSDK();
|
|
14033
|
-
const attachments = useAppSelector(
|
|
14289
|
+
const attachments = useAppSelector(selectAttachmentsOfFormRevision((revision == null ? void 0 : revision.offline_id) ?? ""));
|
|
14034
14290
|
return React.useMemo(() => {
|
|
14035
14291
|
if (!revision || !attachments)
|
|
14036
14292
|
return revision;
|
|
@@ -14127,7 +14383,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14127
14383
|
return formRevisionToSchema(revisionWithImages, { readonly: true });
|
|
14128
14384
|
}, [revisionWithImages]);
|
|
14129
14385
|
const submissionValuesWithAttachments = React.useMemo(() => {
|
|
14130
|
-
const attachments =
|
|
14386
|
+
const attachments = selectAttachmentsOfFormSubmission(submission.offline_id)(sdk.store.getState()) ?? [];
|
|
14131
14387
|
const downloadedAttachments = {};
|
|
14132
14388
|
for (const attachment of attachments) {
|
|
14133
14389
|
const promise = sdk.files.fetchFileFromUrl(attachment.file, attachment.file_sha1, attachment.file_name);
|
|
@@ -14177,8 +14433,8 @@ var __publicField = (obj, key, value) => {
|
|
|
14177
14433
|
}
|
|
14178
14434
|
return ret;
|
|
14179
14435
|
}, [filter, maxResults, ownerFilter]);
|
|
14180
|
-
const userForms = useAppSelector(
|
|
14181
|
-
const userFormMapping = useAppSelector(
|
|
14436
|
+
const userForms = useAppSelector(selectFilteredForms(ownerFilterOptions)) ?? [];
|
|
14437
|
+
const userFormMapping = useAppSelector(selectFormMapping);
|
|
14182
14438
|
const attachableUserForms = userForms.filter((form) => !form.component_type);
|
|
14183
14439
|
const attachableUserFormMapping = Object.values(userFormMapping).filter(
|
|
14184
14440
|
(form) => !form.component_type
|
|
@@ -14211,7 +14467,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14211
14467
|
const handleChange = React.useCallback((e) => {
|
|
14212
14468
|
setFilter(e.currentTarget.value);
|
|
14213
14469
|
}, []);
|
|
14214
|
-
const numberOfForms = useAppSelector(
|
|
14470
|
+
const numberOfForms = useAppSelector(selectGeneralFormCount) || 0;
|
|
14215
14471
|
const numberOfHiddenForms = numberOfForms - attachableUserForms.length;
|
|
14216
14472
|
const overflowMessage = attachableUserForms.length == maxResults && numberOfHiddenForms > 0 ? `Only the first ${maxResults} results are shown (${numberOfHiddenForms} hidden)` : numberOfHiddenForms > 0 && `${numberOfHiddenForms} hidden forms`;
|
|
14217
14473
|
return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { ref, direction: "column", gap: "2", children: [
|
|
@@ -14305,16 +14561,13 @@ var __publicField = (obj, key, value) => {
|
|
|
14305
14561
|
const { submission, onSubmissionClick, compact, labelType, rowDecorator } = props;
|
|
14306
14562
|
const currentUser = useAppSelector(selectCurrentUser);
|
|
14307
14563
|
const createdBy = useAppSelector(selectUser("created_by" in submission ? submission.created_by : currentUser.id));
|
|
14308
|
-
const dateToUse =
|
|
14309
|
-
const formattedDateTime =
|
|
14310
|
-
hour: "2-digit",
|
|
14311
|
-
minute: "2-digit"
|
|
14312
|
-
}) : getLocalDateString(dateToUse);
|
|
14564
|
+
const dateToUse = submission.submitted_at;
|
|
14565
|
+
const formattedDateTime = getLocalDateString(dateToUse);
|
|
14313
14566
|
const revision = useAppSelector(selectFormRevision(submission.form_revision));
|
|
14314
14567
|
if (!revision) {
|
|
14315
14568
|
throw new Error(`Could not find revision ${submission.form_revision} for submission ${submission.offline_id}.`);
|
|
14316
14569
|
}
|
|
14317
|
-
const latestRevisionNumber = (_a2 = useAppSelector(
|
|
14570
|
+
const latestRevisionNumber = (_a2 = useAppSelector(selectLatestFormRevisionOfForm(revision.form))) == null ? void 0 : _a2.revision;
|
|
14318
14571
|
const creatorProfileSrc = useFileSrc({
|
|
14319
14572
|
file: (createdBy == null ? void 0 : createdBy.profile.file) ?? null,
|
|
14320
14573
|
fileSha1: (createdBy == null ? void 0 : createdBy.profile.file_sha1) ?? null
|
|
@@ -14345,10 +14598,6 @@ var __publicField = (obj, key, value) => {
|
|
|
14345
14598
|
return row;
|
|
14346
14599
|
});
|
|
14347
14600
|
FormSubmissionBrowserEntry.displayName = "FormSubmissionBrowserEntry";
|
|
14348
|
-
const getCreatedAtOrSubmittedAtDate = (submission) => {
|
|
14349
|
-
const date = "created_at" in submission ? submission.created_at : submission.submitted_at;
|
|
14350
|
-
return new Date(date);
|
|
14351
|
-
};
|
|
14352
14601
|
const FormSubmissionBrowser = React.memo((props) => {
|
|
14353
14602
|
const {
|
|
14354
14603
|
formId: formId2,
|
|
@@ -14362,10 +14611,10 @@ var __publicField = (obj, key, value) => {
|
|
|
14362
14611
|
if (!!formId2 === !!propSubmissions) {
|
|
14363
14612
|
throw new Error("Either formId or submissions must be provided, but not both.");
|
|
14364
14613
|
}
|
|
14365
|
-
const submissions = useAppSelector(propSubmissions ? () => propSubmissions :
|
|
14614
|
+
const submissions = useAppSelector(propSubmissions ? () => propSubmissions : selectFormSubmissionsOfForm(formId2));
|
|
14366
14615
|
const sortedSubmissions = React.useMemo(
|
|
14367
14616
|
() => submissions == null ? void 0 : submissions.sort((a, b) => {
|
|
14368
|
-
return
|
|
14617
|
+
return a.submitted_at.localeCompare(b.submitted_at);
|
|
14369
14618
|
}),
|
|
14370
14619
|
[submissions]
|
|
14371
14620
|
);
|
|
@@ -15682,6 +15931,7 @@ var __publicField = (obj, key, value) => {
|
|
|
15682
15931
|
exports2.VerificationCodeType = VerificationCodeType;
|
|
15683
15932
|
exports2.WorkspaceService = WorkspaceService;
|
|
15684
15933
|
exports2.YELLOW = YELLOW;
|
|
15934
|
+
exports2._selectLatestFormRevision = _selectLatestFormRevision;
|
|
15685
15935
|
exports2._setLatestRetryTime = _setLatestRetryTime;
|
|
15686
15936
|
exports2.acceptProjectInvite = acceptProjectInvite;
|
|
15687
15937
|
exports2.addActiveProjectFormSubmissionsCount = addActiveProjectFormSubmissionsCount;
|
|
@@ -15699,6 +15949,16 @@ var __publicField = (obj, key, value) => {
|
|
|
15699
15949
|
exports2.addDocuments = addDocuments;
|
|
15700
15950
|
exports2.addEmailDomain = addEmailDomain;
|
|
15701
15951
|
exports2.addFavouriteProjectId = addFavouriteProjectId;
|
|
15952
|
+
exports2.addForm = addForm;
|
|
15953
|
+
exports2.addFormRevision = addFormRevision;
|
|
15954
|
+
exports2.addFormRevisionAttachment = addFormRevisionAttachment;
|
|
15955
|
+
exports2.addFormRevisionAttachments = addFormRevisionAttachments;
|
|
15956
|
+
exports2.addFormRevisions = addFormRevisions;
|
|
15957
|
+
exports2.addFormSubmission = addFormSubmission;
|
|
15958
|
+
exports2.addFormSubmissionAttachment = addFormSubmissionAttachment;
|
|
15959
|
+
exports2.addFormSubmissionAttachments = addFormSubmissionAttachments;
|
|
15960
|
+
exports2.addFormSubmissions = addFormSubmissions;
|
|
15961
|
+
exports2.addForms = addForms;
|
|
15702
15962
|
exports2.addIssue = addIssue;
|
|
15703
15963
|
exports2.addIssueAttachment = addIssueAttachment;
|
|
15704
15964
|
exports2.addIssueAttachments = addIssueAttachments;
|
|
@@ -15719,13 +15979,6 @@ var __publicField = (obj, key, value) => {
|
|
|
15719
15979
|
exports2.addStageCompletions = addStageCompletions;
|
|
15720
15980
|
exports2.addStages = addStages;
|
|
15721
15981
|
exports2.addToRecentIssues = addToRecentIssues;
|
|
15722
|
-
exports2.addUserForm = addUserForm;
|
|
15723
|
-
exports2.addUserFormRevision = addUserFormRevision;
|
|
15724
|
-
exports2.addUserFormRevisionAttachment = addUserFormRevisionAttachment;
|
|
15725
|
-
exports2.addUserFormRevisions = addUserFormRevisions;
|
|
15726
|
-
exports2.addUserFormSubmissionAttachment = addUserFormSubmissionAttachment;
|
|
15727
|
-
exports2.addUserFormSubmissions = addUserFormSubmissions;
|
|
15728
|
-
exports2.addUserForms = addUserForms;
|
|
15729
15982
|
exports2.addUsers = addUsers;
|
|
15730
15983
|
exports2.addWorkspace = addWorkspace;
|
|
15731
15984
|
exports2.areArraysEqual = areArraysEqual;
|
|
@@ -15746,6 +15999,7 @@ var __publicField = (obj, key, value) => {
|
|
|
15746
15999
|
exports2.componentStageSlice = componentStageSlice;
|
|
15747
16000
|
exports2.componentTypeReducer = componentTypeReducer;
|
|
15748
16001
|
exports2.componentTypeSlice = componentTypeSlice;
|
|
16002
|
+
exports2.constructUploadedFilePayloads = constructUploadedFilePayloads;
|
|
15749
16003
|
exports2.coordinatesAreEqual = coordinatesAreEqual;
|
|
15750
16004
|
exports2.coordinatesToLiteral = coordinatesToLiteral;
|
|
15751
16005
|
exports2.coordinatesToPointGeometry = coordinatesToPointGeometry;
|
|
@@ -15756,12 +16010,16 @@ var __publicField = (obj, key, value) => {
|
|
|
15756
16010
|
exports2.defaultBadgeColor = defaultBadgeColor;
|
|
15757
16011
|
exports2.defaultStore = defaultStore;
|
|
15758
16012
|
exports2.deleteComponentType = deleteComponentType;
|
|
16013
|
+
exports2.deleteForm = deleteForm;
|
|
16014
|
+
exports2.deleteFormRevision = deleteFormRevision;
|
|
16015
|
+
exports2.deleteFormRevisionAttachment = deleteFormRevisionAttachment;
|
|
16016
|
+
exports2.deleteFormRevisionAttachments = deleteFormRevisionAttachments;
|
|
16017
|
+
exports2.deleteFormRevisions = deleteFormRevisions;
|
|
16018
|
+
exports2.deleteFormSubmission = deleteFormSubmission;
|
|
16019
|
+
exports2.deleteFormSubmissionAttachment = deleteFormSubmissionAttachment;
|
|
16020
|
+
exports2.deleteFormSubmissionAttachments = deleteFormSubmissionAttachments;
|
|
16021
|
+
exports2.deleteFormSubmissions = deleteFormSubmissions;
|
|
15759
16022
|
exports2.deleteProject = deleteProject;
|
|
15760
|
-
exports2.deleteUserForm = deleteUserForm;
|
|
15761
|
-
exports2.deleteUserFormRevision = deleteUserFormRevision;
|
|
15762
|
-
exports2.deleteUserFormRevisions = deleteUserFormRevisions;
|
|
15763
|
-
exports2.deleteUserFormSubmission = deleteUserFormSubmission;
|
|
15764
|
-
exports2.deleteUserFormSubmissions = deleteUserFormSubmissions;
|
|
15765
16023
|
exports2.dequeue = dequeue;
|
|
15766
16024
|
exports2.deserialize = deserialize;
|
|
15767
16025
|
exports2.deserializeField = deserializeField;
|
|
@@ -15790,7 +16048,13 @@ var __publicField = (obj, key, value) => {
|
|
|
15790
16048
|
exports2.fileSlice = fileSlice;
|
|
15791
16049
|
exports2.fileToBlob = fileToBlob;
|
|
15792
16050
|
exports2.flipCoordinates = flipCoordinates;
|
|
16051
|
+
exports2.formReducer = formReducer;
|
|
16052
|
+
exports2.formRevisionReducer = formRevisionReducer;
|
|
15793
16053
|
exports2.formRevisionToSchema = formRevisionToSchema;
|
|
16054
|
+
exports2.formRevisionsSlice = formRevisionsSlice;
|
|
16055
|
+
exports2.formSlice = formSlice;
|
|
16056
|
+
exports2.formSubmissionReducer = formSubmissionReducer;
|
|
16057
|
+
exports2.formSubmissionSlice = formSubmissionSlice;
|
|
15794
16058
|
exports2.forms = index;
|
|
15795
16059
|
exports2.fullComponentMarkerSize = fullComponentMarkerSize;
|
|
15796
16060
|
exports2.generateBadgeColors = generateBadgeColors;
|
|
@@ -15918,6 +16182,8 @@ var __publicField = (obj, key, value) => {
|
|
|
15918
16182
|
exports2.selectAttachmentsOfComponentTypeByType = selectAttachmentsOfComponentTypeByType;
|
|
15919
16183
|
exports2.selectAttachmentsOfDocument = selectAttachmentsOfDocument;
|
|
15920
16184
|
exports2.selectAttachmentsOfDocumentByType = selectAttachmentsOfDocumentByType;
|
|
16185
|
+
exports2.selectAttachmentsOfFormRevision = selectAttachmentsOfFormRevision;
|
|
16186
|
+
exports2.selectAttachmentsOfFormSubmission = selectAttachmentsOfFormSubmission;
|
|
15921
16187
|
exports2.selectAttachmentsOfIssue = selectAttachmentsOfIssue;
|
|
15922
16188
|
exports2.selectAttachmentsOfIssueByType = selectAttachmentsOfIssueByType;
|
|
15923
16189
|
exports2.selectAttachmentsOfProject = selectAttachmentsOfProject;
|
|
@@ -15935,11 +16201,9 @@ var __publicField = (obj, key, value) => {
|
|
|
15935
16201
|
exports2.selectComponent = selectComponent;
|
|
15936
16202
|
exports2.selectComponentAttachment = selectComponentAttachment;
|
|
15937
16203
|
exports2.selectComponentAttachmentMapping = selectComponentAttachmentMapping;
|
|
15938
|
-
exports2.selectComponentSubmissionMapping = selectComponentSubmissionMapping;
|
|
15939
16204
|
exports2.selectComponentType = selectComponentType;
|
|
15940
16205
|
exports2.selectComponentTypeAttachment = selectComponentTypeAttachment;
|
|
15941
16206
|
exports2.selectComponentTypeAttachmentMapping = selectComponentTypeAttachmentMapping;
|
|
15942
|
-
exports2.selectComponentTypeForm = selectComponentTypeForm;
|
|
15943
16207
|
exports2.selectComponentTypeFromComponent = selectComponentTypeFromComponent;
|
|
15944
16208
|
exports2.selectComponentTypeFromComponents = selectComponentTypeFromComponents;
|
|
15945
16209
|
exports2.selectComponentTypeStagesMapping = selectComponentTypeStagesMapping;
|
|
@@ -15969,8 +16233,24 @@ var __publicField = (obj, key, value) => {
|
|
|
15969
16233
|
exports2.selectExpandedSections = selectExpandedSections;
|
|
15970
16234
|
exports2.selectFavouriteProjects = selectFavouriteProjects;
|
|
15971
16235
|
exports2.selectFileAttachmentsOfIssue = selectFileAttachmentsOfIssue;
|
|
15972
|
-
exports2.
|
|
16236
|
+
exports2.selectFilteredForms = selectFilteredForms;
|
|
16237
|
+
exports2.selectForm = selectForm;
|
|
16238
|
+
exports2.selectFormMapping = selectFormMapping;
|
|
16239
|
+
exports2.selectFormOfComponentType = selectFormOfComponentType;
|
|
15973
16240
|
exports2.selectFormRevision = selectFormRevision;
|
|
16241
|
+
exports2.selectFormRevisionMapping = selectFormRevisionMapping;
|
|
16242
|
+
exports2.selectFormRevisions = selectFormRevisions;
|
|
16243
|
+
exports2.selectFormRevisionsOfForm = selectFormRevisionsOfForm;
|
|
16244
|
+
exports2.selectFormSubmission = selectFormSubmission;
|
|
16245
|
+
exports2.selectFormSubmissionAttachmentsMapping = selectFormSubmissionAttachmentsMapping;
|
|
16246
|
+
exports2.selectFormSubmissions = selectFormSubmissions;
|
|
16247
|
+
exports2.selectFormSubmissionsByComponents = selectFormSubmissionsByComponents;
|
|
16248
|
+
exports2.selectFormSubmissionsMapping = selectFormSubmissionsMapping;
|
|
16249
|
+
exports2.selectFormSubmissionsOfComponent = selectFormSubmissionsOfComponent;
|
|
16250
|
+
exports2.selectFormSubmissionsOfForm = selectFormSubmissionsOfForm;
|
|
16251
|
+
exports2.selectFormSubmissionsOfIssue = selectFormSubmissionsOfIssue;
|
|
16252
|
+
exports2.selectFormsCount = selectFormsCount;
|
|
16253
|
+
exports2.selectGeneralFormCount = selectGeneralFormCount;
|
|
15974
16254
|
exports2.selectHiddenCategoryCount = selectHiddenCategoryCount;
|
|
15975
16255
|
exports2.selectHiddenComponentTypeIds = selectHiddenComponentTypeIds;
|
|
15976
16256
|
exports2.selectIsFetchingInitialData = selectIsFetchingInitialData;
|
|
@@ -15985,10 +16265,10 @@ var __publicField = (obj, key, value) => {
|
|
|
15985
16265
|
exports2.selectIssueUpdateMapping = selectIssueUpdateMapping;
|
|
15986
16266
|
exports2.selectIssueUpdatesOfIssue = selectIssueUpdatesOfIssue;
|
|
15987
16267
|
exports2.selectIssues = selectIssues;
|
|
15988
|
-
exports2.
|
|
16268
|
+
exports2.selectLatestFormRevisionByForm = selectLatestFormRevisionByForm;
|
|
16269
|
+
exports2.selectLatestFormRevisionOfForm = selectLatestFormRevisionOfForm;
|
|
16270
|
+
exports2.selectLatestFormRevisionsOfComponentTypes = selectLatestFormRevisionsOfComponentTypes;
|
|
15989
16271
|
exports2.selectLatestRetryTime = selectLatestRetryTime;
|
|
15990
|
-
exports2.selectLatestRevisionByFormId = selectLatestRevisionByFormId;
|
|
15991
|
-
exports2.selectLatestRevisionsFromComponentTypeIds = selectLatestRevisionsFromComponentTypeIds;
|
|
15992
16272
|
exports2.selectLicense = selectLicense;
|
|
15993
16273
|
exports2.selectLicenseForProject = selectLicenseForProject;
|
|
15994
16274
|
exports2.selectLicenses = selectLicenses;
|
|
@@ -15997,8 +16277,6 @@ var __publicField = (obj, key, value) => {
|
|
|
15997
16277
|
exports2.selectMapStyle = selectMapStyle;
|
|
15998
16278
|
exports2.selectNumberOfComponentTypesMatchingCaseInsensitiveName = selectNumberOfComponentTypesMatchingCaseInsensitiveName;
|
|
15999
16279
|
exports2.selectNumberOfComponentsOfComponentType = selectNumberOfComponentsOfComponentType;
|
|
16000
|
-
exports2.selectNumberOfGeneralUserForms = selectNumberOfGeneralUserForms;
|
|
16001
|
-
exports2.selectNumberOfUserForms = selectNumberOfUserForms;
|
|
16002
16280
|
exports2.selectOrganization = selectOrganization;
|
|
16003
16281
|
exports2.selectOrganizationAccess = selectOrganizationAccess;
|
|
16004
16282
|
exports2.selectOrganizationAccessForUser = selectOrganizationAccessForUser;
|
|
@@ -16026,8 +16304,6 @@ var __publicField = (obj, key, value) => {
|
|
|
16026
16304
|
exports2.selectRecentIssuesAsSearchResults = selectRecentIssuesAsSearchResults;
|
|
16027
16305
|
exports2.selectRecentProjects = selectRecentProjects;
|
|
16028
16306
|
exports2.selectRehydrated = selectRehydrated;
|
|
16029
|
-
exports2.selectRevisionAttachments = selectRevisionAttachments;
|
|
16030
|
-
exports2.selectRevisionsForForm = selectRevisionsForForm;
|
|
16031
16307
|
exports2.selectRootDocuments = selectRootDocuments;
|
|
16032
16308
|
exports2.selectShowTooltips = selectShowTooltips;
|
|
16033
16309
|
exports2.selectSortedEmailDomains = selectSortedEmailDomains;
|
|
@@ -16042,16 +16318,10 @@ var __publicField = (obj, key, value) => {
|
|
|
16042
16318
|
exports2.selectStagesFromComponentType = selectStagesFromComponentType;
|
|
16043
16319
|
exports2.selectStagesFromComponentTypeIds = selectStagesFromComponentTypeIds;
|
|
16044
16320
|
exports2.selectStagesFromStageIds = selectStagesFromStageIds;
|
|
16045
|
-
exports2.selectSubmissionAttachments = selectSubmissionAttachments;
|
|
16046
|
-
exports2.selectSubmissionsForComponent = selectSubmissionsForComponent;
|
|
16047
|
-
exports2.selectSubmissionsForForm = selectSubmissionsForForm;
|
|
16048
|
-
exports2.selectSubmissionsForIssue = selectSubmissionsForIssue;
|
|
16049
16321
|
exports2.selectUploadUrl = selectUploadUrl;
|
|
16050
16322
|
exports2.selectUsedColors = selectUsedColors;
|
|
16051
16323
|
exports2.selectUser = selectUser;
|
|
16052
|
-
exports2.
|
|
16053
|
-
exports2.selectUserFormMapping = selectUserFormMapping;
|
|
16054
|
-
exports2.selectUserFormSubmission = selectUserFormSubmission;
|
|
16324
|
+
exports2.selectUserFormRevisionAttachmentsMapping = selectUserFormRevisionAttachmentsMapping;
|
|
16055
16325
|
exports2.selectUsersAsMapping = selectUsersAsMapping;
|
|
16056
16326
|
exports2.selectVisibleStatuses = selectVisibleStatuses;
|
|
16057
16327
|
exports2.selectVisibleUserIds = selectVisibleUserIds;
|
|
@@ -16078,6 +16348,13 @@ var __publicField = (obj, key, value) => {
|
|
|
16078
16348
|
exports2.setEnableClustering = setEnableClustering;
|
|
16079
16349
|
exports2.setEnableDuplicateIssues = setEnableDuplicateIssues;
|
|
16080
16350
|
exports2.setEnablePlacementMode = setEnablePlacementMode;
|
|
16351
|
+
exports2.setFormRevision = setFormRevision;
|
|
16352
|
+
exports2.setFormRevisionAttachments = setFormRevisionAttachments;
|
|
16353
|
+
exports2.setFormRevisions = setFormRevisions;
|
|
16354
|
+
exports2.setFormSubmission = setFormSubmission;
|
|
16355
|
+
exports2.setFormSubmissionAttachments = setFormSubmissionAttachments;
|
|
16356
|
+
exports2.setFormSubmissions = setFormSubmissions;
|
|
16357
|
+
exports2.setForms = setForms;
|
|
16081
16358
|
exports2.setIsFetchingInitialData = setIsFetchingInitialData;
|
|
16082
16359
|
exports2.setIsImportingProjectFile = setIsImportingProjectFile;
|
|
16083
16360
|
exports2.setIsLoading = setIsLoading;
|
|
@@ -16102,9 +16379,6 @@ var __publicField = (obj, key, value) => {
|
|
|
16102
16379
|
exports2.setTokens = setTokens;
|
|
16103
16380
|
exports2.setTourStep = setTourStep;
|
|
16104
16381
|
exports2.setUploadUrl = setUploadUrl;
|
|
16105
|
-
exports2.setUserFormRevisionAttachments = setUserFormRevisionAttachments;
|
|
16106
|
-
exports2.setUserFormSubmissionAttachments = setUserFormSubmissionAttachments;
|
|
16107
|
-
exports2.setUserFormSubmissions = setUserFormSubmissions;
|
|
16108
16382
|
exports2.setUsers = setUsers;
|
|
16109
16383
|
exports2.setVisibleStatuses = setVisibleStatuses;
|
|
16110
16384
|
exports2.setVisibleUserIds = setVisibleUserIds;
|
|
@@ -16129,11 +16403,13 @@ var __publicField = (obj, key, value) => {
|
|
|
16129
16403
|
exports2.updateComponentTypeAttachment = updateComponentTypeAttachment;
|
|
16130
16404
|
exports2.updateDocumentAttachment = updateDocumentAttachment;
|
|
16131
16405
|
exports2.updateDocuments = updateDocuments;
|
|
16406
|
+
exports2.updateFormSubmission = updateFormSubmission;
|
|
16407
|
+
exports2.updateFormSubmissionAttachments = updateFormSubmissionAttachments;
|
|
16408
|
+
exports2.updateFormSubmissions = updateFormSubmissions;
|
|
16132
16409
|
exports2.updateIssue = updateIssue;
|
|
16133
16410
|
exports2.updateIssueAttachment = updateIssueAttachment;
|
|
16134
16411
|
exports2.updateLicense = updateLicense;
|
|
16135
16412
|
exports2.updateOrCreateProject = updateOrCreateProject;
|
|
16136
|
-
exports2.updateOrCreateUserFormSubmission = updateOrCreateUserFormSubmission;
|
|
16137
16413
|
exports2.updateOrganizationAccess = updateOrganizationAccess;
|
|
16138
16414
|
exports2.updateProjectAccess = updateProjectAccess;
|
|
16139
16415
|
exports2.updateProjectAttachment = updateProjectAttachment;
|
|
@@ -16147,8 +16423,6 @@ var __publicField = (obj, key, value) => {
|
|
|
16147
16423
|
exports2.useFormikInput = useFormikInput;
|
|
16148
16424
|
exports2.useMemoCompare = useMemoCompare;
|
|
16149
16425
|
exports2.useSDK = useSDK;
|
|
16150
|
-
exports2.userFormReducer = userFormReducer;
|
|
16151
|
-
exports2.userFormSlice = userFormSlice;
|
|
16152
16426
|
exports2.userReducer = userReducer;
|
|
16153
16427
|
exports2.userSlice = userSlice;
|
|
16154
16428
|
exports2.valueIsFile = valueIsFile;
|