@overmap-ai/core 1.0.51-bulk-form-submission.0 → 1.0.51

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.
@@ -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$p = {
671
+ const initialState$n = {
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$p,
679
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
678
+ initialState: initialState$n,
679
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
680
680
  reducers: {
681
681
  setTokens: (state, action) => {
682
682
  state.accessToken = action.payload.accessToken;
@@ -841,19 +841,6 @@ 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
- };
857
844
  const fileToBlob = async (dataUrl) => {
858
845
  return (await fetch(dataUrl)).blob();
859
846
  };
@@ -1420,7 +1407,7 @@ var __publicField = (obj, key, value) => {
1420
1407
  return getLocalDateString(date);
1421
1408
  return relative.format(days, "days");
1422
1409
  });
1423
- const initialState$o = {
1410
+ const initialState$m = {
1424
1411
  categories: {},
1425
1412
  usedCategoryColors: [],
1426
1413
  categoryVisibility: {
@@ -1430,8 +1417,8 @@ var __publicField = (obj, key, value) => {
1430
1417
  };
1431
1418
  const categorySlice = toolkit.createSlice({
1432
1419
  name: "categories",
1433
- initialState: initialState$o,
1434
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
1420
+ initialState: initialState$m,
1421
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
1435
1422
  reducers: {
1436
1423
  setCategories: (state, action) => {
1437
1424
  if (!Array.isArray(action.payload))
@@ -1600,14 +1587,14 @@ var __publicField = (obj, key, value) => {
1600
1587
  delete state.attachments[attachmentId];
1601
1588
  }
1602
1589
  }
1603
- const initialState$n = {
1590
+ const initialState$l = {
1604
1591
  components: {},
1605
1592
  attachments: {}
1606
1593
  };
1607
1594
  const componentSlice = toolkit.createSlice({
1608
1595
  name: "components",
1609
- initialState: initialState$n,
1610
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
1596
+ initialState: initialState$l,
1597
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
1611
1598
  reducers: {
1612
1599
  addComponent: (state, action) => {
1613
1600
  state.components[action.payload.offline_id] = action.payload;
@@ -1763,13 +1750,13 @@ var __publicField = (obj, key, value) => {
1763
1750
  removeAllComponentsOfType
1764
1751
  } = componentSlice.actions;
1765
1752
  const componentReducer = componentSlice.reducer;
1766
- const initialState$m = {
1753
+ const initialState$k = {
1767
1754
  completionsByComponentId: {}
1768
1755
  };
1769
1756
  const componentStageCompletionSlice = toolkit.createSlice({
1770
1757
  name: "componentStageCompletions",
1771
- initialState: initialState$m,
1772
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
1758
+ initialState: initialState$k,
1759
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
1773
1760
  reducers: {
1774
1761
  addStageCompletion: (state, action) => {
1775
1762
  let stageToCompletionDateMapping = state.completionsByComponentId[action.payload.component];
@@ -1820,13 +1807,13 @@ var __publicField = (obj, key, value) => {
1820
1807
  return Object.keys(state.componentStageCompletionReducer.completionsByComponentId[component.offline_id] ?? {});
1821
1808
  };
1822
1809
  const componentStageCompletionReducer = componentStageCompletionSlice.reducer;
1823
- const initialState$l = {
1810
+ const initialState$j = {
1824
1811
  stages: {}
1825
1812
  };
1826
1813
  const componentStageSlice = toolkit.createSlice({
1827
1814
  name: "componentStages",
1828
- initialState: initialState$l,
1829
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
1815
+ initialState: initialState$j,
1816
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
1830
1817
  reducers: {
1831
1818
  addStages: (state, action) => {
1832
1819
  Object.assign(state.stages, toOfflineIdRecord(action.payload));
@@ -1936,15 +1923,15 @@ var __publicField = (obj, key, value) => {
1936
1923
  );
1937
1924
  const { addStages, updateStages, removeStages, linkStageToForm, unlinkStageToForm } = componentStageSlice.actions;
1938
1925
  const componentStageReducer = componentStageSlice.reducer;
1939
- const initialState$k = {
1926
+ const initialState$i = {
1940
1927
  componentTypes: {},
1941
1928
  hiddenComponentTypeIds: {},
1942
1929
  attachments: {}
1943
1930
  };
1944
1931
  const componentTypeSlice = toolkit.createSlice({
1945
1932
  name: "componentTypes",
1946
- initialState: initialState$k,
1947
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
1933
+ initialState: initialState$i,
1934
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
1948
1935
  reducers: {
1949
1936
  addComponentType: (state, action) => {
1950
1937
  state.componentTypes[action.payload.offline_id] = action.payload;
@@ -2055,13 +2042,13 @@ var __publicField = (obj, key, value) => {
2055
2042
  deleteComponentType
2056
2043
  } = componentTypeSlice.actions;
2057
2044
  const componentTypeReducer = componentTypeSlice.reducer;
2058
- const initialState$j = {
2045
+ const initialState$h = {
2059
2046
  workspaces: {},
2060
2047
  activeWorkspaceId: null
2061
2048
  };
2062
2049
  const workspaceSlice = toolkit.createSlice({
2063
2050
  name: "workspace",
2064
- initialState: initialState$j,
2051
+ initialState: initialState$h,
2065
2052
  // The `reducers` field lets us define reducers and generate associated actions
2066
2053
  reducers: {
2067
2054
  setWorkspaces: (state, action) => {
@@ -2118,7 +2105,7 @@ var __publicField = (obj, key, value) => {
2118
2105
  );
2119
2106
  const workspaceReducer = workspaceSlice.reducer;
2120
2107
  const maxRecentIssues = 10;
2121
- const initialState$i = {
2108
+ const initialState$g = {
2122
2109
  issues: {},
2123
2110
  attachments: {},
2124
2111
  comments: {},
@@ -2130,9 +2117,9 @@ var __publicField = (obj, key, value) => {
2130
2117
  };
2131
2118
  const issueSlice = toolkit.createSlice({
2132
2119
  name: "issues",
2133
- initialState: initialState$i,
2120
+ initialState: initialState$g,
2134
2121
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
2135
- Object.assign(state, initialState$i);
2122
+ Object.assign(state, initialState$g);
2136
2123
  }),
2137
2124
  reducers: {
2138
2125
  setIssues: (state, action) => {
@@ -2540,15 +2527,15 @@ var __publicField = (obj, key, value) => {
2540
2527
  }
2541
2528
  );
2542
2529
  const issueReducer = issueSlice.reducer;
2543
- const initialState$h = {
2530
+ const initialState$f = {
2544
2531
  s3Urls: {}
2545
2532
  };
2546
2533
  const msPerHour = 1e3 * 60 * 60;
2547
2534
  const msPerWeek = msPerHour * 24 * 7;
2548
2535
  const fileSlice = toolkit.createSlice({
2549
2536
  name: "file",
2550
- initialState: initialState$h,
2551
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
2537
+ initialState: initialState$f,
2538
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
2552
2539
  reducers: {
2553
2540
  setUploadUrl: (state, action) => {
2554
2541
  const { url, fields, sha1 } = action.payload;
@@ -2575,7 +2562,7 @@ var __publicField = (obj, key, value) => {
2575
2562
  return url;
2576
2563
  };
2577
2564
  const fileReducer = fileSlice.reducer;
2578
- const initialState$g = {
2565
+ const initialState$e = {
2579
2566
  // TODO: Change first MapStyle.SATELLITE to MaptStyle.None when project creation map is fixed
2580
2567
  mapStyle: MapStyle.SATELLITE,
2581
2568
  showTooltips: false,
@@ -2583,8 +2570,8 @@ var __publicField = (obj, key, value) => {
2583
2570
  };
2584
2571
  const mapSlice = toolkit.createSlice({
2585
2572
  name: "map",
2586
- initialState: initialState$g,
2587
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
2573
+ initialState: initialState$e,
2574
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
2588
2575
  reducers: {
2589
2576
  setMapStyle: (state, action) => {
2590
2577
  state.mapStyle = action.payload;
@@ -2653,7 +2640,7 @@ var __publicField = (obj, key, value) => {
2653
2640
  LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
2654
2641
  return LicenseStatus2;
2655
2642
  })(LicenseStatus || {});
2656
- const initialState$f = {
2643
+ const initialState$d = {
2657
2644
  users: {},
2658
2645
  currentUser: {
2659
2646
  id: 0,
@@ -2664,8 +2651,8 @@ var __publicField = (obj, key, value) => {
2664
2651
  };
2665
2652
  const userSlice = toolkit.createSlice({
2666
2653
  name: "users",
2667
- initialState: initialState$f,
2668
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
2654
+ initialState: initialState$d,
2655
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
2669
2656
  reducers: {
2670
2657
  setUsers: (state, action) => {
2671
2658
  const usersMapping = {};
@@ -2727,13 +2714,13 @@ var __publicField = (obj, key, value) => {
2727
2714
  const selectUsersAsMapping = (state) => state.userReducer.users;
2728
2715
  const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
2729
2716
  const userReducer = userSlice.reducer;
2730
- const initialState$e = {
2717
+ const initialState$c = {
2731
2718
  organizationAccesses: {}
2732
2719
  };
2733
2720
  const organizationAccessSlice = toolkit.createSlice({
2734
2721
  name: "organizationAccess",
2735
- initialState: initialState$e,
2736
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
2722
+ initialState: initialState$c,
2723
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
2737
2724
  reducers: {
2738
2725
  setOrganizationAccesses: (state, action) => {
2739
2726
  if (!Array.isArray(action.payload))
@@ -2796,13 +2783,13 @@ var __publicField = (obj, key, value) => {
2796
2783
  return organizationAccesses;
2797
2784
  };
2798
2785
  const organizationAccessReducer = organizationAccessSlice.reducer;
2799
- const initialState$d = {
2786
+ const initialState$b = {
2800
2787
  licenses: {}
2801
2788
  };
2802
2789
  const licenseSlice = toolkit.createSlice({
2803
2790
  name: "license",
2804
- initialState: initialState$d,
2805
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
2791
+ initialState: initialState$b,
2792
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
2806
2793
  reducers: {
2807
2794
  setLicenses: (state, action) => {
2808
2795
  if (!Array.isArray(action.payload))
@@ -2847,13 +2834,13 @@ var __publicField = (obj, key, value) => {
2847
2834
  (licenses) => Object.values(licenses).filter((license) => license.project).reduce((accum, license) => ({ ...accum, [license.project]: license }), {})
2848
2835
  );
2849
2836
  const licenseReducer = licenseSlice.reducer;
2850
- const initialState$c = {
2837
+ const initialState$a = {
2851
2838
  projectAccesses: {}
2852
2839
  };
2853
2840
  const projectAccessSlice = toolkit.createSlice({
2854
2841
  name: "projectAccess",
2855
- initialState: initialState$c,
2856
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
2842
+ initialState: initialState$a,
2843
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
2857
2844
  reducers: {
2858
2845
  setProjectAccesses: (state, action) => {
2859
2846
  if (!Array.isArray(action.payload))
@@ -2921,7 +2908,7 @@ var __publicField = (obj, key, value) => {
2921
2908
  return projectAccesses;
2922
2909
  };
2923
2910
  const projectAccessReducer = projectAccessSlice.reducer;
2924
- const initialState$b = {
2911
+ const initialState$9 = {
2925
2912
  projects: {},
2926
2913
  activeProjectId: null,
2927
2914
  recentProjectIds: [],
@@ -2931,7 +2918,7 @@ var __publicField = (obj, key, value) => {
2931
2918
  };
2932
2919
  const projectSlice = toolkit.createSlice({
2933
2920
  name: "projects",
2934
- initialState: initialState$b,
2921
+ initialState: initialState$9,
2935
2922
  reducers: {
2936
2923
  setProjects: (state, action) => {
2937
2924
  const projectsMap = {};
@@ -3118,14 +3105,14 @@ var __publicField = (obj, key, value) => {
3118
3105
  }
3119
3106
  )
3120
3107
  );
3121
- const initialState$a = {
3108
+ const initialState$8 = {
3122
3109
  organizations: {},
3123
3110
  activeOrganizationId: null
3124
3111
  };
3125
3112
  const organizationSlice = toolkit.createSlice({
3126
3113
  name: "organizations",
3127
- initialState: initialState$a,
3128
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
3114
+ initialState: initialState$8,
3115
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
3129
3116
  reducers: {
3130
3117
  setOrganizations: (state, action) => {
3131
3118
  for (const org of action.payload) {
@@ -3244,14 +3231,14 @@ var __publicField = (obj, key, value) => {
3244
3231
  }
3245
3232
  };
3246
3233
  };
3247
- const initialState$9 = {
3234
+ const initialState$7 = {
3248
3235
  deletedRequests: [],
3249
3236
  latestRetryTime: 0
3250
3237
  };
3251
3238
  const outboxSlice = toolkit.createSlice({
3252
3239
  name: "outbox",
3253
- initialState: initialState$9,
3254
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$9)),
3240
+ initialState: initialState$7,
3241
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
3255
3242
  reducers: {
3256
3243
  // enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
3257
3244
  // Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
@@ -3283,7 +3270,7 @@ var __publicField = (obj, key, value) => {
3283
3270
  const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
3284
3271
  const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
3285
3272
  const outboxReducer = outboxSlice.reducer;
3286
- const initialState$8 = {
3273
+ const initialState$6 = {
3287
3274
  projectFiles: {},
3288
3275
  activeProjectFileId: null,
3289
3276
  isImportingProjectFile: false,
@@ -3291,8 +3278,8 @@ var __publicField = (obj, key, value) => {
3291
3278
  };
3292
3279
  const projectFileSlice = toolkit.createSlice({
3293
3280
  name: "projectFiles",
3294
- initialState: initialState$8,
3295
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
3281
+ initialState: initialState$6,
3282
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
3296
3283
  reducers: {
3297
3284
  addOrReplaceProjectFiles: (state, action) => {
3298
3285
  for (let fileObj of action.payload) {
@@ -3393,12 +3380,12 @@ var __publicField = (obj, key, value) => {
3393
3380
  const selectActiveProjectFileId = (state) => state.projectFileReducer.activeProjectFileId;
3394
3381
  const selectIsImportingProjectFile = (state) => state.projectFileReducer.isImportingProjectFile;
3395
3382
  const projectFileReducer = projectFileSlice.reducer;
3396
- const initialState$7 = {
3383
+ const initialState$5 = {
3397
3384
  isRehydrated: false
3398
3385
  };
3399
3386
  const rehydratedSlice = toolkit.createSlice({
3400
3387
  name: "rehydrated",
3401
- initialState: initialState$7,
3388
+ initialState: initialState$5,
3402
3389
  // The `reducers` field lets us define reducers and generate associated actions
3403
3390
  reducers: {
3404
3391
  setRehydrated: (state, action) => {
@@ -3408,7 +3395,7 @@ var __publicField = (obj, key, value) => {
3408
3395
  });
3409
3396
  const selectRehydrated = (state) => state.rehydratedReducer.isRehydrated;
3410
3397
  const rehydratedReducer = rehydratedSlice.reducer;
3411
- const initialState$6 = {
3398
+ const initialState$4 = {
3412
3399
  useIssueTemplate: false,
3413
3400
  placementMode: false,
3414
3401
  enableClustering: false,
@@ -3425,8 +3412,8 @@ var __publicField = (obj, key, value) => {
3425
3412
  };
3426
3413
  const settingSlice = toolkit.createSlice({
3427
3414
  name: "settings",
3428
- initialState: initialState$6,
3429
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
3415
+ initialState: initialState$4,
3416
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
3430
3417
  reducers: {
3431
3418
  setEnableDuplicateIssues: (state, action) => {
3432
3419
  state.useIssueTemplate = action.payload;
@@ -3472,248 +3459,146 @@ var __publicField = (obj, key, value) => {
3472
3459
  const settingReducer = settingSlice.reducer;
3473
3460
  const selectIsFetchingInitialData = (state) => state.settingReducer.isFetchingInitialData;
3474
3461
  const selectIsLoading = (state) => state.settingReducer.isLoading;
3475
- const LATEST_FORM_REVISION_CACHE = {};
3476
- function considerCachingFormRevision(formRevision, formId2, preferPending = false) {
3462
+ const LATEST_REVISION_CACHE = {};
3463
+ function considerCachingRevision(revision, formId2, preferPending = false) {
3477
3464
  var _a2;
3478
- if (!formRevision) {
3465
+ if (!revision) {
3479
3466
  if (!formId2) {
3480
- throw new Error("If form revision is null, formId is required.");
3467
+ throw new Error("If revision is null, formId is required.");
3481
3468
  }
3482
- const currentLatestFormRevision = getLatestFormRevisionFromCache(formId2);
3483
- if (currentLatestFormRevision)
3469
+ const currentLatestRevision = getLatestRevisionFromCache(formId2);
3470
+ if (currentLatestRevision)
3484
3471
  return;
3485
- LATEST_FORM_REVISION_CACHE[formId2] = null;
3472
+ LATEST_REVISION_CACHE[formId2] = null;
3486
3473
  return;
3487
3474
  }
3488
- if (formRevision.revision === "Pending") {
3475
+ if (revision.revision === "Pending") {
3489
3476
  if (preferPending) {
3490
- LATEST_FORM_REVISION_CACHE[formRevision.form] = formRevision;
3477
+ LATEST_REVISION_CACHE[revision.form] = revision;
3491
3478
  }
3492
3479
  return;
3493
3480
  }
3494
- const cachedFormRevision = (_a2 = LATEST_FORM_REVISION_CACHE[formRevision.form]) == null ? void 0 : _a2.revision;
3495
- if (formRevision.revision > (typeof cachedFormRevision === "number" ? cachedFormRevision : -1)) {
3496
- LATEST_FORM_REVISION_CACHE[formRevision.form] = formRevision;
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;
3497
3484
  }
3498
3485
  }
3499
- function getLatestFormRevisionFromCache(formId2) {
3500
- return LATEST_FORM_REVISION_CACHE[formId2];
3486
+ function getLatestRevisionFromCache(formId2) {
3487
+ return LATEST_REVISION_CACHE[formId2];
3501
3488
  }
3502
- const initialState$5 = {
3503
- formRevisions: {},
3504
- attachments: {}
3505
- };
3506
- const formRevisionsSlice = toolkit.createSlice({
3507
- name: "formRevisions",
3508
- initialState: initialState$5,
3509
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
3489
+ const initialState$3 = {
3490
+ userForms: {},
3491
+ revisions: {},
3492
+ submissions: {},
3493
+ submissionAttachments: {},
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)),
3510
3500
  reducers: {
3511
- // revision related actions
3512
- setFormRevision: (state, action) => {
3513
- state.formRevisions[action.payload.offline_id] = action.payload;
3514
- considerCachingFormRevision(action.payload);
3501
+ setUserForms: (state, action) => {
3502
+ state.userForms = {};
3503
+ action.payload.forEach((userForm) => {
3504
+ state.userForms[userForm.offline_id] = userForm;
3505
+ });
3515
3506
  },
3516
- setFormRevisions: (state, action) => {
3517
- state.formRevisions = {};
3518
- for (const revision of action.payload) {
3519
- state.formRevisions[revision.offline_id] = revision;
3520
- considerCachingFormRevision(revision);
3521
- }
3507
+ addUserForm: (state, action) => {
3508
+ state.userForms[action.payload.offline_id] = action.payload;
3522
3509
  },
3523
- addFormRevision: (state, action) => {
3524
- if (state.formRevisions[action.payload.offline_id] !== void 0) {
3525
- throw new Error(`Revision with offline_id ${action.payload.offline_id} already exists`);
3526
- }
3527
- state.formRevisions[action.payload.offline_id] = action.payload;
3528
- considerCachingFormRevision(action.payload);
3510
+ addUserForms: (state, action) => {
3511
+ action.payload.forEach((userForm) => {
3512
+ state.userForms[userForm.offline_id] = userForm;
3513
+ });
3529
3514
  },
3530
- // TODO: @Audiopolis / Magnus - do we want to standardize using PayloadAction?
3531
- addFormRevisions: (state, action) => {
3532
- for (const userFormRevision of action.payload) {
3533
- if (state.formRevisions[userFormRevision.offline_id] !== void 0) {
3534
- throw new Error(`Revision with offline_id ${userFormRevision.offline_id} already exists`);
3535
- }
3536
- }
3537
- for (const userFormRevision of action.payload) {
3538
- state.formRevisions[userFormRevision.offline_id] = userFormRevision;
3539
- considerCachingFormRevision(userFormRevision);
3540
- }
3515
+ addUserFormRevisions: (state, action) => {
3516
+ action.payload.forEach((userFormRevision) => {
3517
+ state.revisions[userFormRevision.offline_id] = userFormRevision;
3518
+ considerCachingRevision(userFormRevision);
3519
+ });
3541
3520
  },
3542
- // UserFormRevisions do not get updated
3543
- deleteFormRevision: (state, action) => {
3544
- if (state.formRevisions[action.payload] === void 0) {
3545
- throw new Error(`Revision with offline_id ${action.payload} does not exist`);
3546
- }
3547
- delete state.formRevisions[action.payload];
3548
- delete LATEST_FORM_REVISION_CACHE[action.payload];
3521
+ addUserFormRevision: (state, action) => {
3522
+ state.revisions[action.payload.offline_id] = action.payload;
3523
+ considerCachingRevision(action.payload);
3549
3524
  },
3550
- deleteFormRevisions: (state, action) => {
3551
- for (const offlineId of action.payload) {
3552
- if (state.formRevisions[offlineId] === void 0) {
3553
- throw new Error(`Revision with offline_id ${offlineId} does not exist`);
3554
- }
3555
- }
3556
- for (const offlineId of action.payload) {
3557
- delete state.formRevisions[offlineId];
3558
- delete LATEST_FORM_REVISION_CACHE[offlineId];
3525
+ deleteUserFormRevision: (state, action) => {
3526
+ delete state.revisions[action.payload];
3527
+ delete LATEST_REVISION_CACHE[action.payload];
3528
+ },
3529
+ deleteUserFormRevisions: (state, action) => {
3530
+ for (const userFormRevision of action.payload) {
3531
+ delete state.revisions[userFormRevision.offline_id];
3532
+ delete LATEST_REVISION_CACHE[userFormRevision.offline_id];
3559
3533
  }
3560
3534
  },
3561
- // attachment related actions
3562
- setFormRevisionAttachments: (state, action) => {
3563
- state.attachments = {};
3564
- for (const attachment of action.payload) {
3565
- state.attachments[attachment.offline_id] = attachment;
3535
+ updateOrCreateUserFormSubmission: (state, action) => {
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];
3566
3545
  }
3567
3546
  },
3568
- addFormRevisionAttachment: (state, action) => {
3569
- if (state.attachments[action.payload.offline_id] !== void 0) {
3570
- throw new Error(`Attachment with offline_id ${action.payload.offline_id} already exists`);
3547
+ addUserFormRevisionAttachment: (state, action) => {
3548
+ const revisionId = action.payload.revision;
3549
+ const revisionAttachments = state.revisionAttachments[revisionId];
3550
+ if (revisionAttachments) {
3551
+ revisionAttachments.push(action.payload);
3552
+ } else {
3553
+ state.revisionAttachments[revisionId] = [action.payload];
3571
3554
  }
3572
- state.attachments[action.payload.offline_id] = action.payload;
3573
3555
  },
3574
- addFormRevisionAttachments: (state, action) => {
3556
+ setUserFormSubmissionAttachments: (state, action) => {
3557
+ state.submissionAttachments = {};
3575
3558
  for (const attachment of action.payload) {
3576
- if (state.attachments[attachment.offline_id] !== void 0) {
3577
- throw new Error(`Attachment with offline_id ${attachment.offline_id} already exists`);
3559
+ const submissionId = attachment.submission;
3560
+ const submissionAttachments = state.submissionAttachments[submissionId];
3561
+ if (submissionAttachments) {
3562
+ submissionAttachments.push(attachment);
3563
+ } else {
3564
+ state.submissionAttachments[submissionId] = [attachment];
3578
3565
  }
3579
3566
  }
3567
+ },
3568
+ setUserFormRevisionAttachments: (state, action) => {
3569
+ state.revisionAttachments = {};
3580
3570
  for (const attachment of action.payload) {
3581
- state.attachments[attachment.offline_id] = attachment;
3571
+ const revisionId = attachment.revision;
3572
+ const revisionAttachments = state.revisionAttachments[revisionId];
3573
+ if (revisionAttachments) {
3574
+ revisionAttachments.push(attachment);
3575
+ } else {
3576
+ state.revisionAttachments[revisionId] = [attachment];
3577
+ }
3582
3578
  }
3583
3579
  },
3584
- deleteFormRevisionAttachment: (state, action) => {
3585
- if (state.attachments[action.payload] === void 0) {
3586
- throw new Error(`Attachment with offline_id ${action.payload} does not exist`);
3587
- }
3588
- delete state.attachments[action.payload];
3580
+ deleteUserFormSubmission: (state, action) => {
3581
+ delete state.submissions[action.payload];
3589
3582
  },
3590
- deleteFormRevisionAttachments: (state, action) => {
3591
- for (const offlineId of action.payload) {
3592
- if (state.attachments[offlineId] === void 0) {
3593
- throw new Error(`Attachment with offline_id ${offlineId} does not exist`);
3594
- }
3583
+ deleteUserFormSubmissions: (state, action) => {
3584
+ for (const userFormSubmission of action.payload) {
3585
+ delete state.submissions[userFormSubmission.offline_id];
3595
3586
  }
3596
- for (const offlineId of action.payload) {
3597
- delete state.attachments[offlineId];
3598
- }
3599
- }
3600
- }
3601
- });
3602
- const {
3603
- setFormRevision,
3604
- setFormRevisions,
3605
- addFormRevision,
3606
- addFormRevisions,
3607
- deleteFormRevision,
3608
- deleteFormRevisions,
3609
- setFormRevisionAttachments,
3610
- addFormRevisionAttachment,
3611
- addFormRevisionAttachments,
3612
- deleteFormRevisionAttachment,
3613
- deleteFormRevisionAttachments
3614
- } = formRevisionsSlice.actions;
3615
- const selectFormRevisionMapping = (state) => state.formRevisionReducer.formRevisions;
3616
- const selectFormRevisions = toolkit.createSelector(
3617
- [selectFormRevisionMapping],
3618
- (formRevisions) => Object.values(formRevisions)
3619
- );
3620
- const selectFormRevision = (formRevisionId) => (state) => {
3621
- return state.formRevisionReducer.formRevisions[formRevisionId];
3622
- };
3623
- const _selectLatestFormRevision = (formRevisions, formId2) => {
3624
- let ret = null;
3625
- for (const candidate of Object.values(formRevisions)) {
3626
- if (candidate.form === formId2 && (!ret || ret.revision < candidate.revision)) {
3627
- ret = candidate;
3628
- }
3629
- }
3630
- if (!ret) {
3631
- throw new Error("No form revision found for form " + formId2);
3632
- }
3633
- return ret;
3634
- };
3635
- const selectLatestFormRevisionOfForm = restructureCreateSelectorWithArgs(
3636
- toolkit.createSelector([selectFormRevisionMapping, (_state, formId2) => formId2], (revisions, formId2) => {
3637
- if (!formId2) {
3638
- throw new Error("formId is required");
3639
- }
3640
- return _selectLatestFormRevision(revisions, formId2);
3641
- })
3642
- );
3643
- const selectFormRevisionsOfForm = restructureCreateSelectorWithArgs(
3644
- toolkit.createSelector([selectFormRevisions, (_state, formId2) => formId2], (revisions, formId2) => {
3645
- return revisions.filter((revision) => {
3646
- return revision.form === formId2;
3647
- });
3648
- })
3649
- );
3650
- const selectLatestFormRevisionsOfComponentTypes = restructureCreateSelectorWithArgs(
3651
- toolkit.createSelector(
3652
- [
3653
- (state) => state.formReducer.forms,
3654
- selectFormRevisionMapping,
3655
- (_state, componentTypeIds) => componentTypeIds
3656
- ],
3657
- (userForms, revisions, componentTypeIds) => {
3658
- const componentTypeIdsSet = new Set(componentTypeIds);
3659
- const ret = {};
3660
- for (const form of Object.values(userForms)) {
3661
- if (form.component_type && componentTypeIdsSet.has(form.component_type)) {
3662
- ret[form.component_type] = _selectLatestFormRevision(revisions, form.offline_id);
3663
- }
3664
- }
3665
- return ret;
3666
- }
3667
- )
3668
- );
3669
- const selectLatestFormRevisionByForm = toolkit.createSelector([selectFormRevisionMapping], (revisions) => {
3670
- const latestRevisions = {};
3671
- for (const revision of Object.values(revisions)) {
3672
- const formId2 = revision.form;
3673
- const currentLatestRevision = latestRevisions[formId2];
3674
- if (!currentLatestRevision || currentLatestRevision.revision < revision.revision) {
3675
- latestRevisions[formId2] = revision;
3676
- }
3677
- }
3678
- return latestRevisions;
3679
- });
3680
- const selectUserFormRevisionAttachmentsMapping = (state) => {
3681
- return state.formRevisionReducer.attachments;
3682
- };
3683
- const selectAttachmentsOfFormRevision = restructureCreateSelectorWithArgs(
3684
- toolkit.createSelector(
3685
- [selectUserFormRevisionAttachmentsMapping, (_state, revisionId) => revisionId],
3686
- (attachments, revisionId) => {
3687
- return Object.values(attachments).filter((attachment) => attachment.revision === revisionId);
3688
- }
3689
- )
3690
- );
3691
- const formRevisionReducer = formRevisionsSlice.reducer;
3692
- const initialState$4 = {
3693
- forms: {}
3694
- };
3695
- const formSlice = toolkit.createSlice({
3696
- name: "forms",
3697
- initialState: initialState$4,
3698
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
3699
- reducers: {
3700
- setForms: (state, action) => {
3701
- state.forms = {};
3702
- action.payload.forEach((userForm) => {
3703
- state.forms[userForm.offline_id] = userForm;
3704
- });
3705
3587
  },
3706
- addForm: (state, action) => {
3707
- state.forms[action.payload.offline_id] = action.payload;
3588
+ addUserFormSubmissions: (state, action) => {
3589
+ for (const submission of action.payload) {
3590
+ state.submissions[submission.offline_id] = submission;
3591
+ }
3708
3592
  },
3709
- addForms: (state, action) => {
3710
- action.payload.forEach((userForm) => {
3711
- state.forms[userForm.offline_id] = userForm;
3593
+ setUserFormSubmissions: (state, action) => {
3594
+ state.submissions = {};
3595
+ action.payload.forEach((submission) => {
3596
+ state.submissions[submission.offline_id] = submission;
3712
3597
  });
3713
3598
  },
3714
3599
  favoriteForm: (state, action) => {
3715
3600
  const { formId: formId2 } = action.payload;
3716
- const form = state.forms[formId2];
3601
+ const form = state.userForms[formId2];
3717
3602
  if (!form) {
3718
3603
  throw new Error("No form exists with the id " + formId2);
3719
3604
  }
@@ -3721,23 +3606,48 @@ var __publicField = (obj, key, value) => {
3721
3606
  },
3722
3607
  unfavoriteForm: (state, action) => {
3723
3608
  const { formId: formId2 } = action.payload;
3724
- const form = state.forms[formId2];
3609
+ const form = state.userForms[formId2];
3725
3610
  if (!form) {
3726
3611
  throw new Error("No form exists with the id " + formId2);
3727
3612
  }
3728
3613
  form.favorite = false;
3729
3614
  },
3730
- deleteForm: (state, action) => {
3731
- delete state.forms[action.payload];
3615
+ deleteUserForm: (state, action) => {
3616
+ delete state.userForms[action.payload];
3732
3617
  }
3733
3618
  }
3734
3619
  });
3735
- const { setForms, addForm, addForms, favoriteForm, unfavoriteForm, deleteForm } = formSlice.actions;
3736
- const selectFilteredForms = restructureCreateSelectorWithArgs(
3620
+ const {
3621
+ addUserForm,
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(
3737
3647
  toolkit.createSelector(
3738
3648
  [
3739
- (state) => state.formReducer.forms,
3740
- (state) => state.formRevisionReducer.formRevisions,
3649
+ (state) => state.userFormReducer.userForms,
3650
+ (state) => state.userFormReducer.revisions,
3741
3651
  (_state, search) => search
3742
3652
  ],
3743
3653
  (userForms, revisions, search) => {
@@ -3771,188 +3681,63 @@ var __publicField = (obj, key, value) => {
3771
3681
  { memoizeOptions: { equalityCheck: reactRedux.shallowEqual } }
3772
3682
  )
3773
3683
  );
3774
- const selectForm = (formId2) => (state) => {
3775
- return state.formReducer.forms[formId2];
3684
+ const selectFormRevision = (revisionId) => (state) => {
3685
+ return state.userFormReducer.revisions[revisionId];
3776
3686
  };
3777
- const selectFormMapping = (state) => {
3778
- return state.formReducer.forms;
3687
+ const _selectLatestFormRevision = (revisions, formId2) => {
3688
+ let ret = null;
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;
3779
3698
  };
3780
- const selectFormOfComponentType = restructureCreateSelectorWithArgs(
3699
+ const selectLatestFormRevision = restructureCreateSelectorWithArgs(
3781
3700
  toolkit.createSelector(
3782
- [selectFormMapping, (_state, componentTypeId) => componentTypeId],
3783
- (userForms, componentTypeId) => {
3784
- return Object.values(userForms).find((userForm) => userForm.component_type === componentTypeId);
3701
+ [(state) => state.userFormReducer.revisions, (_state, formId2) => formId2],
3702
+ (revisions, formId2) => {
3703
+ if (!formId2) {
3704
+ throw new Error("formId is required");
3705
+ }
3706
+ return _selectLatestFormRevision(revisions, formId2);
3785
3707
  }
3786
3708
  )
3787
3709
  );
3788
- const selectFormsCount = toolkit.createSelector([selectFormMapping], (userForms) => {
3789
- return Object.keys(userForms).length;
3790
- });
3791
- const selectGeneralFormCount = toolkit.createSelector([selectFormMapping], (userForms) => {
3792
- return Object.values(userForms).filter((form) => !form.component_type).length;
3793
- });
3794
- const formReducer = formSlice.reducer;
3795
- const initialState$3 = {
3796
- formSubmissions: {},
3797
- attachments: {}
3798
- };
3799
- const formSubmissionSlice = toolkit.createSlice({
3800
- name: "formSubmissions",
3801
- initialState: initialState$3,
3802
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
3803
- reducers: {
3804
- setFormSubmission: (state, action) => {
3805
- state.formSubmissions[action.payload.offline_id] = action.payload;
3806
- },
3807
- setFormSubmissions: (state, action) => {
3808
- state.formSubmissions = {};
3809
- for (const submission of action.payload) {
3810
- state.formSubmissions[submission.offline_id] = submission;
3811
- }
3812
- },
3813
- addFormSubmission: (state, action) => {
3814
- if (state.formSubmissions[action.payload.offline_id] !== void 0) {
3815
- throw new Error(`Submission with offline_id ${action.payload.offline_id} already exists`);
3816
- }
3817
- state.formSubmissions[action.payload.offline_id] = action.payload;
3818
- },
3819
- addFormSubmissions: (state, action) => {
3820
- for (const submission of action.payload) {
3821
- if (state.formSubmissions[submission.offline_id] !== void 0) {
3822
- throw new Error(`Submission with offline_id ${submission.offline_id} already exists`);
3823
- }
3824
- }
3825
- for (const submission of action.payload) {
3826
- state.formSubmissions[submission.offline_id] = submission;
3827
- }
3828
- },
3829
- updateFormSubmission: (state, action) => {
3830
- if (state.formSubmissions[action.payload.offline_id] === void 0) {
3831
- throw new Error(`Submission with offline_id ${action.payload.offline_id} does not exist`);
3832
- }
3833
- state.formSubmissions[action.payload.offline_id] = action.payload;
3834
- },
3835
- updateFormSubmissions: (state, action) => {
3836
- for (const submission of action.payload) {
3837
- if (state.formSubmissions[submission.offline_id] === void 0) {
3838
- throw new Error(`Submission with offline_id ${submission.offline_id} does not exist`);
3839
- }
3840
- }
3841
- for (const submission of action.payload) {
3842
- state.formSubmissions[submission.offline_id] = submission;
3843
- }
3844
- },
3845
- deleteFormSubmission: (state, action) => {
3846
- if (state.formSubmissions[action.payload] === void 0) {
3847
- throw new Error(`Submission with offline_id ${action.payload} does not exist`);
3848
- }
3849
- delete state.formSubmissions[action.payload];
3850
- },
3851
- deleteFormSubmissions: (state, action) => {
3852
- for (const offlineId of action.payload) {
3853
- if (state.formSubmissions[offlineId] === void 0) {
3854
- throw new Error(`Submission with offline_id ${offlineId} does not exist`);
3855
- }
3856
- delete state.formSubmissions[offlineId];
3857
- }
3858
- for (const offlineId of action.payload) {
3859
- delete state.formSubmissions[offlineId];
3860
- }
3861
- },
3862
- // Attachments
3863
- addFormSubmissionAttachment: (state, action) => {
3864
- if (state.attachments[action.payload.offline_id] !== void 0) {
3865
- throw new Error(`Attachment with offline_id ${action.payload.offline_id} already exists`);
3866
- }
3867
- state.attachments[action.payload.offline_id] = action.payload;
3868
- },
3869
- addFormSubmissionAttachments: (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} already exists`);
3873
- }
3874
- }
3875
- for (const attachment of action.payload) {
3876
- state.attachments[attachment.offline_id] = attachment;
3877
- }
3878
- },
3879
- // We only need a multi set for attachments because they are not updated, only added and deleted
3880
- setFormSubmissionAttachments: (state, action) => {
3881
- state.attachments = {};
3882
- for (const attachment of action.payload) {
3883
- state.attachments[attachment.offline_id] = attachment;
3884
- }
3885
- },
3886
- updateFormSubmissionAttachments: (state, action) => {
3887
- for (const attachment of action.payload) {
3888
- if (state.attachments[attachment.offline_id] === void 0) {
3889
- throw new Error(`Attachment with offline_id ${attachment.offline_id} does not exist`);
3890
- }
3891
- }
3892
- for (const attachment of action.payload) {
3893
- state.attachments[attachment.offline_id] = attachment;
3894
- }
3895
- },
3896
- // The delete actions for UserFormSubmissionAttachments are not used in the app, but are included for completeness
3897
- // Could be used if editing a submission is ever supported, will be applicable for supporting tip tap content in submissions
3898
- deleteFormSubmissionAttachment: (state, action) => {
3899
- if (state.attachments[action.payload] === void 0) {
3900
- throw new Error(`Attachment with offline_id ${action.payload} does not exist`);
3901
- }
3902
- delete state.attachments[action.payload];
3903
- },
3904
- deleteFormSubmissionAttachments: (state, action) => {
3905
- for (const offlineId of action.payload) {
3906
- if (state.attachments[offlineId] === void 0) {
3907
- throw new Error(`Attachment with offline_id ${offlineId} does not exist`);
3908
- }
3909
- delete state.attachments[offlineId];
3910
- }
3911
- }
3912
- }
3913
- });
3914
- const {
3915
- setFormSubmission,
3916
- setFormSubmissions,
3917
- addFormSubmission,
3918
- addFormSubmissions,
3919
- updateFormSubmission,
3920
- updateFormSubmissions,
3921
- deleteFormSubmission,
3922
- deleteFormSubmissions,
3923
- addFormSubmissionAttachment,
3924
- addFormSubmissionAttachments,
3925
- setFormSubmissionAttachments,
3926
- updateFormSubmissionAttachments,
3927
- deleteFormSubmissionAttachment,
3928
- deleteFormSubmissionAttachments
3929
- } = formSubmissionSlice.actions;
3930
- const selectFormSubmissionsMapping = (state) => {
3931
- return state.formSubmissionReducer.formSubmissions;
3932
- };
3933
- const selectFormSubmissions = toolkit.createSelector(
3934
- [selectFormSubmissionsMapping],
3935
- (submissions) => {
3936
- return Object.values(submissions);
3937
- }
3710
+ const selectUserForm = (formId2) => (state) => {
3711
+ return state.userFormReducer.userForms[formId2];
3712
+ };
3713
+ const selectSubmissionMapping = (state) => state.userFormReducer.submissions;
3714
+ const selectUserFormSubmission = (submissionId) => (state) => {
3715
+ return state.userFormReducer.submissions[submissionId];
3716
+ };
3717
+ const selectSubmissions = toolkit.createSelector([selectSubmissionMapping], (submissions) => Object.values(submissions));
3718
+ const selectRevisionMapping = (state) => state.userFormReducer.revisions;
3719
+ const selectRevisions = toolkit.createSelector([selectRevisionMapping], (revisions) => Object.values(revisions));
3720
+ const selectRevisionsForForm = restructureCreateSelectorWithArgs(
3721
+ toolkit.createSelector([selectRevisions, (_state, formId2) => formId2], (revisions, formId2) => {
3722
+ return revisions.filter((revision) => {
3723
+ return revision.form === formId2;
3724
+ });
3725
+ })
3938
3726
  );
3939
- const selectFormSubmission = (submissionId) => (state) => {
3940
- return state.formSubmissionReducer.formSubmissions[submissionId];
3941
- };
3942
- const selectFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
3727
+ const selectSubmissionsForForm = restructureCreateSelectorWithArgs(
3943
3728
  toolkit.createSelector(
3944
- [selectFormSubmissions, selectFormRevisionMapping, (_state, formId2) => formId2],
3729
+ [selectSubmissions, selectRevisionMapping, (_state, formId2) => formId2],
3945
3730
  (submissions, revisionMapping, formId2) => {
3946
- return submissions.filter((submission) => {
3731
+ return Object.values(submissions).filter((submission) => {
3947
3732
  const revision = revisionMapping[submission.form_revision];
3948
3733
  return (revision == null ? void 0 : revision.form) === formId2;
3949
3734
  });
3950
3735
  }
3951
3736
  )
3952
3737
  );
3953
- const selectFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
3738
+ const selectSubmissionsForIssue = restructureCreateSelectorWithArgs(
3954
3739
  toolkit.createSelector(
3955
- [selectFormSubmissions, (_state, issueId) => issueId],
3740
+ [(state) => state.userFormReducer.submissions, (_state, issueId) => issueId],
3956
3741
  (submissions, issueId) => {
3957
3742
  return Object.values(submissions).filter((submission) => {
3958
3743
  return submission.issue === issueId;
@@ -3960,9 +3745,9 @@ var __publicField = (obj, key, value) => {
3960
3745
  }
3961
3746
  )
3962
3747
  );
3963
- const selectFormSubmissionsOfComponent = restructureCreateSelectorWithArgs(
3748
+ const selectSubmissionsForComponent = restructureCreateSelectorWithArgs(
3964
3749
  toolkit.createSelector(
3965
- [selectFormSubmissions, (_state, componentId) => componentId],
3750
+ [selectSubmissions, (_state, componentId) => componentId],
3966
3751
  (submissions, componentId) => {
3967
3752
  return submissions.filter((submission) => {
3968
3753
  return submission.component === componentId;
@@ -3970,8 +3755,8 @@ var __publicField = (obj, key, value) => {
3970
3755
  }
3971
3756
  )
3972
3757
  );
3973
- const selectFormSubmissionsByComponents = toolkit.createSelector(
3974
- [selectFormSubmissionsMapping, selectComponentsMapping],
3758
+ const selectComponentSubmissionMapping = toolkit.createSelector(
3759
+ [selectSubmissionMapping, selectComponentsMapping],
3975
3760
  (submissions, components) => {
3976
3761
  var _a2;
3977
3762
  const componentSubmissionMapping = {};
@@ -3987,18 +3772,54 @@ var __publicField = (obj, key, value) => {
3987
3772
  return componentSubmissionMapping;
3988
3773
  }
3989
3774
  );
3990
- const selectFormSubmissionAttachmentsMapping = (state) => {
3991
- return state.formSubmissionReducer.attachments;
3775
+ const selectUserFormMapping = (state) => {
3776
+ return state.userFormReducer.userForms;
3992
3777
  };
3993
- const selectAttachmentsOfFormSubmission = restructureCreateSelectorWithArgs(
3778
+ const selectComponentTypeForm = restructureCreateSelectorWithArgs(
3994
3779
  toolkit.createSelector(
3995
- [selectFormSubmissionAttachmentsMapping, (_state, submissionId) => submissionId],
3996
- (attachmentsMapping, submissionId) => {
3997
- return Object.values(attachmentsMapping).filter((attachment) => attachment.submission === submissionId);
3780
+ [selectUserFormMapping, (_state, componentTypeId) => componentTypeId],
3781
+ (userForms, componentTypeId) => {
3782
+ return Object.values(userForms).find((userForm) => userForm.component_type === componentTypeId);
3783
+ }
3784
+ )
3785
+ );
3786
+ const selectLatestRevisionsFromComponentTypeIds = restructureCreateSelectorWithArgs(
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;
3998
3802
  }
3999
3803
  )
4000
3804
  );
4001
- const formSubmissionReducer = formSubmissionSlice.reducer;
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;
4002
3823
  const initialState$2 = {
4003
3824
  emailDomains: {}
4004
3825
  };
@@ -4296,9 +4117,7 @@ var __publicField = (obj, key, value) => {
4296
4117
  projectFileReducer,
4297
4118
  rehydratedReducer,
4298
4119
  settingReducer,
4299
- formReducer,
4300
- formRevisionReducer,
4301
- formSubmissionReducer,
4120
+ userFormReducer,
4302
4121
  userReducer,
4303
4122
  workspaceReducer,
4304
4123
  emailDomainsReducer,
@@ -4351,7 +4170,9 @@ var __publicField = (obj, key, value) => {
4351
4170
  throw new Error(`Failed to update index_workspace of issue ${issue.offline_id} to main workspace`);
4352
4171
  }
4353
4172
  }
4354
- const indexedForms = Object.values(draft.formReducer.forms).filter((form) => form.index_workspace === workspaceId);
4173
+ const indexedForms = Object.values(draft.userFormReducer.userForms).filter(
4174
+ (form) => form.index_workspace === workspaceId
4175
+ );
4355
4176
  for (const form of indexedForms) {
4356
4177
  form.index_workspace = mainWorkspace.offline_id;
4357
4178
  }
@@ -6979,7 +6800,7 @@ var __publicField = (obj, key, value) => {
6979
6800
  ...revisionAttachmentPayload,
6980
6801
  file: URL.createObjectURL(image)
6981
6802
  };
6982
- store.dispatch(addFormRevisionAttachment(offlinePayload));
6803
+ store.dispatch(addUserFormRevisionAttachment(offlinePayload));
6983
6804
  return attach;
6984
6805
  });
6985
6806
  });
@@ -7013,8 +6834,8 @@ var __publicField = (obj, key, value) => {
7013
6834
  revision: 0
7014
6835
  };
7015
6836
  const { store } = this.client;
7016
- store.dispatch(addForm(retForm));
7017
- store.dispatch(addFormRevision(retRevision));
6837
+ store.dispatch(addUserForm(retForm));
6838
+ store.dispatch(addUserFormRevision(retRevision));
7018
6839
  const formPromise = this.enqueueRequest({
7019
6840
  description: "Create form",
7020
6841
  method: HttpMethod.POST,
@@ -7032,8 +6853,8 @@ var __publicField = (obj, key, value) => {
7032
6853
  });
7033
6854
  const attachImagesPromises = this.getAttachImagePromises(images, offlineRevisionPayload.offline_id);
7034
6855
  void formPromise.catch((e) => {
7035
- store.dispatch(deleteForm(retForm.offline_id));
7036
- store.dispatch(deleteFormRevision(retRevision.offline_id));
6856
+ store.dispatch(deleteUserForm(retForm.offline_id));
6857
+ store.dispatch(deleteUserFormRevision(retRevision.offline_id));
7037
6858
  throw e;
7038
6859
  });
7039
6860
  const settledPromise = Promise.all([formPromise, ...attachImagesPromises]).then(() => formPromise);
@@ -7075,7 +6896,7 @@ var __publicField = (obj, key, value) => {
7075
6896
  revision: "Pending",
7076
6897
  form: formId2
7077
6898
  };
7078
- store.dispatch(addFormRevision(fullRevision));
6899
+ store.dispatch(addUserFormRevision(fullRevision));
7079
6900
  const promise = this.enqueueRequest({
7080
6901
  description: "Create form revision",
7081
6902
  method: HttpMethod.PATCH,
@@ -7089,9 +6910,9 @@ var __publicField = (obj, key, value) => {
7089
6910
  });
7090
6911
  const attachImagesPromises = this.getAttachImagePromises(images, offlineRevision.offline_id);
7091
6912
  void promise.then((result) => {
7092
- store.dispatch(setFormRevision(result));
6913
+ store.dispatch(addUserFormRevision(result));
7093
6914
  }).catch(() => {
7094
- store.dispatch(deleteFormRevision(fullRevision.offline_id));
6915
+ store.dispatch(deleteUserFormRevision(fullRevision.offline_id));
7095
6916
  });
7096
6917
  const settledPromise = Promise.all([promise, ...attachImagesPromises]).then(() => promise);
7097
6918
  return [fullRevision, settledPromise];
@@ -7133,19 +6954,19 @@ var __publicField = (obj, key, value) => {
7133
6954
  async delete(formId2) {
7134
6955
  const { store } = this.client;
7135
6956
  const state = store.getState();
7136
- const userForm = selectForm(formId2)(state);
6957
+ const userForm = selectUserForm(formId2)(state);
7137
6958
  if (!userForm) {
7138
6959
  throw new Error("Expected userForm to exist");
7139
6960
  }
7140
- const userFormSubmissions = selectFormSubmissionsOfForm(formId2)(state);
6961
+ const userFormSubmissions = selectSubmissionsForForm(formId2)(state);
7141
6962
  if (userFormSubmissions && userFormSubmissions.length > 0) {
7142
- store.dispatch(deleteFormSubmissions(userFormSubmissions.map(({ offline_id }) => offline_id)));
6963
+ store.dispatch(deleteUserFormSubmissions(userFormSubmissions));
7143
6964
  }
7144
- const userFormRevisions = selectFormRevisionsOfForm(formId2)(state);
6965
+ const userFormRevisions = selectRevisionsForForm(formId2)(state);
7145
6966
  if (userFormRevisions && userFormRevisions.length > 0) {
7146
- store.dispatch(deleteFormRevisions(userFormRevisions.map(({ offline_id }) => offline_id)));
6967
+ store.dispatch(deleteUserFormRevisions(userFormRevisions));
7147
6968
  }
7148
- store.dispatch(deleteForm(formId2));
6969
+ store.dispatch(deleteUserForm(formId2));
7149
6970
  try {
7150
6971
  return await this.enqueueRequest({
7151
6972
  description: "Delete form",
@@ -7155,12 +6976,12 @@ var __publicField = (obj, key, value) => {
7155
6976
  blocks: []
7156
6977
  });
7157
6978
  } catch (e) {
7158
- store.dispatch(addForm(userForm));
6979
+ store.dispatch(addUserForm(userForm));
7159
6980
  if (userFormRevisions && userFormRevisions.length > 0) {
7160
- store.dispatch(addFormRevisions(userFormRevisions));
6981
+ store.dispatch(addUserFormRevisions(userFormRevisions));
7161
6982
  }
7162
6983
  if (userFormSubmissions && userFormSubmissions.length > 0) {
7163
- store.dispatch(addFormSubmissions(userFormSubmissions));
6984
+ store.dispatch(addUserFormSubmissions(userFormSubmissions));
7164
6985
  }
7165
6986
  throw e;
7166
6987
  }
@@ -7174,15 +6995,16 @@ var __publicField = (obj, key, value) => {
7174
6995
  blockers: [],
7175
6996
  blocks: []
7176
6997
  });
7177
- store.dispatch(setForms(Object.values(result.forms)));
7178
- store.dispatch(setFormRevisions(Object.values(result.revisions)));
7179
- store.dispatch(setFormRevisionAttachments(Object.values(result.attachments)));
6998
+ store.dispatch(addUserForms(Object.values(result.forms)));
6999
+ store.dispatch(addUserFormRevisions(Object.values(result.revisions)));
7000
+ store.dispatch(setUserFormRevisionAttachments(Object.values(result.attachments)));
7180
7001
  }
7181
7002
  }
7182
7003
  const isArrayOfFiles = (value) => {
7183
7004
  return Array.isArray(value) && value[0] instanceof File;
7184
7005
  };
7185
- const separateFilesFromValues = (values) => {
7006
+ const separateFilesFromValues = (payload) => {
7007
+ const { values } = payload;
7186
7008
  const files = {};
7187
7009
  const newValues = {};
7188
7010
  for (const key in values) {
@@ -7197,13 +7019,17 @@ var __publicField = (obj, key, value) => {
7197
7019
  newValues[key] = value;
7198
7020
  }
7199
7021
  }
7200
- return { values: newValues, files };
7022
+ const payloadWithoutFiles = {
7023
+ ...payload,
7024
+ values: newValues
7025
+ };
7026
+ return { payloadWithoutFiles, files };
7201
7027
  };
7202
7028
  class UserFormSubmissionService extends BaseApiService {
7203
7029
  constructor() {
7204
7030
  super(...arguments);
7205
7031
  // Attach files to submission, after uploading them to S3
7206
- __publicField(this, "getAttachFilesPromises", (files, submission) => {
7032
+ __publicField(this, "getAttachFilesPromises", (files, payload) => {
7207
7033
  const { store } = this.client;
7208
7034
  return Object.entries(files).map(async ([key, fileArray]) => {
7209
7035
  const attachResults = [];
@@ -7213,27 +7039,24 @@ var __publicField = (obj, key, value) => {
7213
7039
  const [fileProps] = await this.client.files.uploadFileToS3(sha1);
7214
7040
  const submissionAttachmentPayload = offline({
7215
7041
  ...fileProps,
7216
- submission: submission.offline_id,
7042
+ submission: payload.offline_id,
7217
7043
  field_identifier: key
7218
7044
  });
7219
7045
  const attach = await this.enqueueRequest({
7220
7046
  description: "Attach file to form submission",
7221
7047
  method: HttpMethod.POST,
7222
- url: `/forms/submission/${submission.offline_id}/attachments/`,
7048
+ url: `/forms/submission/${payload.offline_id}/attachments/`,
7223
7049
  payload: submissionAttachmentPayload,
7224
- blockers: [
7225
- submission.component,
7226
- submission.component_stage,
7227
- submission.issue,
7228
- submission.form_revision
7229
- ].filter((x) => x !== void 0),
7050
+ blockers: [payload.component, payload.component_stage, payload.issue, payload.form_revision].filter(
7051
+ (x) => x !== void 0
7052
+ ),
7230
7053
  blocks: [submissionAttachmentPayload.offline_id]
7231
7054
  });
7232
7055
  const offlinePayload = {
7233
7056
  ...submissionAttachmentPayload,
7234
7057
  file: URL.createObjectURL(file)
7235
7058
  };
7236
- store.dispatch(addFormSubmissionAttachment(offlinePayload));
7059
+ store.dispatch(addUserFormSubmissionAttachment(offlinePayload));
7237
7060
  attachResults.push(attach);
7238
7061
  }
7239
7062
  return attachResults;
@@ -7247,165 +7070,70 @@ var __publicField = (obj, key, value) => {
7247
7070
  if (!activeProjectId) {
7248
7071
  throw new Error("Expected an active project");
7249
7072
  }
7250
- const { values, files } = separateFilesFromValues(payload.values);
7251
- const offlineSubmission = {
7252
- ...payload,
7253
- values,
7254
- created_by: state.userReducer.currentUser.id,
7255
- submitted_at: (/* @__PURE__ */ new Date()).toISOString()
7256
- };
7073
+ const { payloadWithoutFiles, files } = separateFilesFromValues(payload);
7257
7074
  const promise = this.enqueueRequest({
7258
7075
  description: "Respond to form",
7259
7076
  method: HttpMethod.POST,
7260
7077
  url: `/forms/revisions/${payload.form_revision}/respond/`,
7261
- payload: { ...offlineSubmission, project: activeProjectId },
7078
+ payload: { ...payloadWithoutFiles, project: activeProjectId },
7262
7079
  blockers: [payload.issue, payload.component, payload.component_stage, "add-form-entry"].filter(
7263
7080
  (x) => x !== void 0
7264
7081
  ),
7265
7082
  blocks: [payload.offline_id]
7266
7083
  });
7267
- const attachFilesPromises = this.getAttachFilesPromises(files, offlineSubmission);
7268
- store.dispatch(addFormSubmission(offlineSubmission));
7084
+ const attachFilesPromises = this.getAttachFilesPromises(files, payload);
7085
+ const now = (/* @__PURE__ */ new Date()).toISOString();
7086
+ const fullOfflineResult = {
7087
+ ...payload,
7088
+ created_by: state.userReducer.currentUser.id,
7089
+ created_at: now,
7090
+ updated_at: now
7091
+ };
7092
+ const offlineResultWithoutFiles = {
7093
+ ...fullOfflineResult,
7094
+ ...payloadWithoutFiles
7095
+ };
7096
+ store.dispatch(updateOrCreateUserFormSubmission(offlineResultWithoutFiles));
7269
7097
  void promise.then((result) => {
7270
7098
  store.dispatch(addActiveProjectFormSubmissionsCount(1));
7271
- store.dispatch(setFormSubmission(result));
7099
+ store.dispatch(updateOrCreateUserFormSubmission(result));
7272
7100
  return result;
7273
7101
  }).catch(() => {
7274
- store.dispatch(deleteFormSubmission(payload.offline_id));
7102
+ store.dispatch(deleteUserFormSubmission(payload.offline_id));
7275
7103
  store.dispatch(addActiveProjectFormSubmissionsCount(-1));
7276
7104
  });
7277
7105
  const settledPromise = Promise.all([promise, ...attachFilesPromises]).then(() => promise);
7278
- return [offlineSubmission, settledPromise];
7279
- }
7280
- // Note currently the bulkAdd method is specific to form submissions for components
7281
- // TODO: adapt the support bulk adding to any model type
7282
- async bulkAdd(args) {
7283
- const { form_revision, values: argsValues, componentOfflineIds } = args;
7284
- const { store } = this.client;
7285
- const offlineSubmissions = [];
7286
- const offlineAttachments = [];
7287
- const submissionOfflineIds = [];
7288
- const submissionsPayload = [];
7289
- const attachmentsPayload = [];
7290
- const { values, files } = separateFilesFromValues(argsValues);
7291
- const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7292
- const createdBy = store.getState().userReducer.currentUser.id;
7293
- for (const component_id of componentOfflineIds) {
7294
- const submission = offline({
7295
- form_revision,
7296
- values,
7297
- created_by: createdBy,
7298
- submitted_at: submittedAt,
7299
- component: component_id
7300
- });
7301
- submissionOfflineIds.push(submission.offline_id);
7302
- submissionsPayload.push({ offline_id: submission.offline_id, component_id });
7303
- offlineSubmissions.push(submission);
7304
- for (const [fieldIdentifier, fileArray] of Object.entries(files)) {
7305
- for (const file of fileArray) {
7306
- const sha1 = await hashFile(file);
7307
- await this.client.files.addCache(file, sha1);
7308
- const offlineAttachment = offline({
7309
- file_name: file.name,
7310
- file_sha1: sha1,
7311
- file: URL.createObjectURL(file),
7312
- submission: submission.offline_id,
7313
- field_identifier: fieldIdentifier
7314
- });
7315
- offlineAttachments.push(offlineAttachment);
7316
- attachmentsPayload.push({
7317
- offline_id: offlineAttachment.offline_id,
7318
- submission_id: submission.offline_id,
7319
- sha1,
7320
- name: file.name,
7321
- field_identifier: fieldIdentifier
7322
- });
7323
- }
7324
- }
7325
- }
7326
- const filesRecord = {};
7327
- for (const file of Object.values(files).flat()) {
7328
- const sha1 = await hashFile(file);
7329
- filesRecord[sha1] = {
7330
- sha1,
7331
- extension: file.name.split(".").pop() || "",
7332
- file_type: file.type,
7333
- size: file.size
7334
- };
7335
- }
7336
- store.dispatch(addFormSubmissions(offlineSubmissions));
7337
- store.dispatch(addFormSubmissionAttachments(offlineAttachments));
7338
- const promise = this.enqueueRequest({
7339
- description: "Bulk add form submissions",
7340
- method: HttpMethod.POST,
7341
- url: `/forms/revisions/${form_revision}/bulk-respond/`,
7342
- payload: {
7343
- form_data: values,
7344
- submitted_at: submittedAt,
7345
- submissions: submissionsPayload,
7346
- attachments: attachmentsPayload,
7347
- files: Object.values(filesRecord)
7348
- },
7349
- blockers: componentOfflineIds,
7350
- blocks: submissionOfflineIds
7351
- });
7352
- promise.then(({ submissions, attachments, presigned_urls }) => {
7353
- store.dispatch(updateFormSubmissions(submissions));
7354
- store.dispatch(updateFormSubmissionAttachments(attachments));
7355
- for (const [sha1, presigned_url] of Object.entries(presigned_urls)) {
7356
- const file = filesRecord[sha1];
7357
- if (!file)
7358
- continue;
7359
- void this.enqueueRequest({
7360
- url: presigned_url.url,
7361
- description: "Upload file",
7362
- method: HttpMethod.POST,
7363
- isExternalUrl: true,
7364
- isAuthNeeded: false,
7365
- attachmentHash: sha1,
7366
- blockers: [`s3-${file.sha1}.${file.extension}`],
7367
- blocks: [sha1],
7368
- s3url: presigned_url
7369
- });
7370
- }
7371
- }).catch(() => {
7372
- store.dispatch(deleteFormSubmissions(submissionOfflineIds));
7373
- store.dispatch(deleteFormSubmissionAttachments(offlineAttachments.map((x) => x.offline_id)));
7374
- });
7375
- return [offlineSubmissions, promise.then(({ submissions }) => submissions)];
7106
+ return [fullOfflineResult, settledPromise];
7376
7107
  }
7377
7108
  update(submission) {
7378
7109
  const { store } = this.client;
7379
- const { values, files } = separateFilesFromValues(submission.values);
7110
+ const { payloadWithoutFiles, files } = separateFilesFromValues(submission);
7111
+ if (!("created_by" in payloadWithoutFiles) || !("created_at" in payloadWithoutFiles)) {
7112
+ throw new Error("Expected payloadWithoutFiles to have created_by and created_at fields.");
7113
+ }
7380
7114
  const attachFilesPromises = this.getAttachFilesPromises(files, submission);
7381
- const offlineSubmission = {
7382
- ...submission,
7383
- values
7115
+ const fullResult = {
7116
+ ...payloadWithoutFiles,
7117
+ updated_at: (/* @__PURE__ */ new Date()).toISOString()
7384
7118
  };
7385
- const submissionToBeUpdated = store.getState().formSubmissionReducer.formSubmissions[submission.offline_id];
7386
- store.dispatch(updateFormSubmission(offlineSubmission));
7119
+ store.dispatch(updateOrCreateUserFormSubmission(fullResult));
7387
7120
  const promise = this.enqueueRequest({
7388
7121
  description: "Patch form submission",
7389
7122
  method: HttpMethod.PATCH,
7390
7123
  url: `/forms/submissions/${submission.offline_id}/`,
7391
- payload: offlineSubmission,
7392
- blockers: [offlineSubmission.issue, offlineSubmission.component, offlineSubmission.component_stage].filter(
7124
+ payload: fullResult,
7125
+ blockers: [fullResult.issue, fullResult.component, fullResult.component_stage].filter(
7393
7126
  (x) => x !== void 0
7394
7127
  ),
7395
- blocks: [offlineSubmission.offline_id]
7128
+ blocks: [fullResult.offline_id]
7396
7129
  });
7397
- promise.then((createdSubmission) => {
7398
- store.dispatch(setFormSubmission(createdSubmission));
7399
- }).catch(() => {
7400
- store.dispatch(setFormSubmission(submissionToBeUpdated));
7401
- });
7402
- return [offlineSubmission, Promise.all([promise, ...attachFilesPromises]).then(() => promise)];
7130
+ return Promise.all([promise, ...attachFilesPromises]).then(() => promise);
7403
7131
  }
7404
7132
  async delete(submissionId) {
7405
7133
  const { store } = this.client;
7406
7134
  const state = store.getState();
7407
- const submission = state.formSubmissionReducer.formSubmissions[submissionId];
7408
- store.dispatch(deleteFormSubmission(submissionId));
7135
+ const submission = state.userFormReducer.submissions[submissionId];
7136
+ store.dispatch(deleteUserFormSubmission(submissionId));
7409
7137
  store.dispatch(addActiveProjectFormSubmissionsCount(-1));
7410
7138
  try {
7411
7139
  return await this.enqueueRequest({
@@ -7416,8 +7144,10 @@ var __publicField = (obj, key, value) => {
7416
7144
  blocks: []
7417
7145
  });
7418
7146
  } catch (e) {
7419
- store.dispatch(addActiveProjectFormSubmissionsCount(1));
7420
- store.dispatch(addFormSubmission(submission));
7147
+ if (submission) {
7148
+ store.dispatch(addActiveProjectFormSubmissionsCount(1));
7149
+ store.dispatch(updateOrCreateUserFormSubmission(submission));
7150
+ }
7421
7151
  throw e;
7422
7152
  }
7423
7153
  }
@@ -7431,7 +7161,7 @@ var __publicField = (obj, key, value) => {
7431
7161
  blockers: [],
7432
7162
  blocks: []
7433
7163
  });
7434
- store.dispatch(setFormSubmissions(submissions));
7164
+ store.dispatch(setUserFormSubmissions(submissions));
7435
7165
  const attachments = await this.enqueueRequest({
7436
7166
  description: "Fetch form attachments",
7437
7167
  method: HttpMethod.GET,
@@ -7439,7 +7169,7 @@ var __publicField = (obj, key, value) => {
7439
7169
  blockers: [],
7440
7170
  blocks: []
7441
7171
  });
7442
- store.dispatch(setFormSubmissionAttachments(attachments));
7172
+ store.dispatch(setUserFormSubmissionAttachments(attachments));
7443
7173
  }
7444
7174
  }
7445
7175
  class WorkspaceService extends BaseApiService {
@@ -14297,7 +14027,7 @@ var __publicField = (obj, key, value) => {
14297
14027
  };
14298
14028
  const useAttachImagesToFormRevisionFields = (revision) => {
14299
14029
  const { sdk } = useSDK();
14300
- const attachments = useAppSelector(selectAttachmentsOfFormRevision((revision == null ? void 0 : revision.offline_id) ?? ""));
14030
+ const attachments = useAppSelector(selectRevisionAttachments((revision == null ? void 0 : revision.offline_id) ?? ""));
14301
14031
  return React.useMemo(() => {
14302
14032
  if (!revision || !attachments)
14303
14033
  return revision;
@@ -14394,7 +14124,7 @@ var __publicField = (obj, key, value) => {
14394
14124
  return formRevisionToSchema(revisionWithImages, { readonly: true });
14395
14125
  }, [revisionWithImages]);
14396
14126
  const submissionValuesWithAttachments = React.useMemo(() => {
14397
- const attachments = selectAttachmentsOfFormSubmission(submission.offline_id)(sdk.store.getState()) ?? [];
14127
+ const attachments = selectSubmissionAttachments(submission.offline_id)(sdk.store.getState()) ?? [];
14398
14128
  const downloadedAttachments = {};
14399
14129
  for (const attachment of attachments) {
14400
14130
  const promise = sdk.files.fetchFileFromUrl(attachment.file, attachment.file_sha1, attachment.file_name);
@@ -14444,8 +14174,8 @@ var __publicField = (obj, key, value) => {
14444
14174
  }
14445
14175
  return ret;
14446
14176
  }, [filter, maxResults, ownerFilter]);
14447
- const userForms = useAppSelector(selectFilteredForms(ownerFilterOptions)) ?? [];
14448
- const userFormMapping = useAppSelector(selectFormMapping);
14177
+ const userForms = useAppSelector(selectFilteredUserForms(ownerFilterOptions)) ?? [];
14178
+ const userFormMapping = useAppSelector(selectUserFormMapping);
14449
14179
  const attachableUserForms = userForms.filter((form) => !form.component_type);
14450
14180
  const attachableUserFormMapping = Object.values(userFormMapping).filter(
14451
14181
  (form) => !form.component_type
@@ -14478,7 +14208,7 @@ var __publicField = (obj, key, value) => {
14478
14208
  const handleChange = React.useCallback((e) => {
14479
14209
  setFilter(e.currentTarget.value);
14480
14210
  }, []);
14481
- const numberOfForms = useAppSelector(selectGeneralFormCount) || 0;
14211
+ const numberOfForms = useAppSelector(selectNumberOfGeneralUserForms) || 0;
14482
14212
  const numberOfHiddenForms = numberOfForms - attachableUserForms.length;
14483
14213
  const overflowMessage = attachableUserForms.length == maxResults && numberOfHiddenForms > 0 ? `Only the first ${maxResults} results are shown (${numberOfHiddenForms} hidden)` : numberOfHiddenForms > 0 && `${numberOfHiddenForms} hidden forms`;
14484
14214
  return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { ref, direction: "column", gap: "2", children: [
@@ -14572,13 +14302,16 @@ var __publicField = (obj, key, value) => {
14572
14302
  const { submission, onSubmissionClick, compact, labelType, rowDecorator } = props;
14573
14303
  const currentUser = useAppSelector(selectCurrentUser);
14574
14304
  const createdBy = useAppSelector(selectUser("created_by" in submission ? submission.created_by : currentUser.id));
14575
- const dateToUse = submission.submitted_at;
14576
- const formattedDateTime = getLocalDateString(dateToUse);
14305
+ const dateToUse = getCreatedAtOrSubmittedAtDate(submission);
14306
+ const formattedDateTime = isToday(dateToUse) ? dateToUse.toLocaleTimeString([], {
14307
+ hour: "2-digit",
14308
+ minute: "2-digit"
14309
+ }) : getLocalDateString(dateToUse);
14577
14310
  const revision = useAppSelector(selectFormRevision(submission.form_revision));
14578
14311
  if (!revision) {
14579
14312
  throw new Error(`Could not find revision ${submission.form_revision} for submission ${submission.offline_id}.`);
14580
14313
  }
14581
- const latestRevisionNumber = (_a2 = useAppSelector(selectLatestFormRevisionOfForm(revision.form))) == null ? void 0 : _a2.revision;
14314
+ const latestRevisionNumber = (_a2 = useAppSelector(selectLatestFormRevision(revision.form))) == null ? void 0 : _a2.revision;
14582
14315
  const creatorProfileSrc = useFileSrc({
14583
14316
  file: (createdBy == null ? void 0 : createdBy.profile.file) ?? null,
14584
14317
  fileSha1: (createdBy == null ? void 0 : createdBy.profile.file_sha1) ?? null
@@ -14609,6 +14342,10 @@ var __publicField = (obj, key, value) => {
14609
14342
  return row;
14610
14343
  });
14611
14344
  FormSubmissionBrowserEntry.displayName = "FormSubmissionBrowserEntry";
14345
+ const getCreatedAtOrSubmittedAtDate = (submission) => {
14346
+ const date = "created_at" in submission ? submission.created_at : submission.submitted_at;
14347
+ return new Date(date);
14348
+ };
14612
14349
  const FormSubmissionBrowser = React.memo((props) => {
14613
14350
  const {
14614
14351
  formId: formId2,
@@ -14622,10 +14359,10 @@ var __publicField = (obj, key, value) => {
14622
14359
  if (!!formId2 === !!propSubmissions) {
14623
14360
  throw new Error("Either formId or submissions must be provided, but not both.");
14624
14361
  }
14625
- const submissions = useAppSelector(propSubmissions ? () => propSubmissions : selectFormSubmissionsOfForm(formId2));
14362
+ const submissions = useAppSelector(propSubmissions ? () => propSubmissions : selectSubmissionsForForm(formId2));
14626
14363
  const sortedSubmissions = React.useMemo(
14627
14364
  () => submissions == null ? void 0 : submissions.sort((a, b) => {
14628
- return a.submitted_at.localeCompare(b.submitted_at);
14365
+ return getCreatedAtOrSubmittedAtDate(b).getTime() - getCreatedAtOrSubmittedAtDate(a).getTime();
14629
14366
  }),
14630
14367
  [submissions]
14631
14368
  );
@@ -15942,7 +15679,6 @@ var __publicField = (obj, key, value) => {
15942
15679
  exports2.VerificationCodeType = VerificationCodeType;
15943
15680
  exports2.WorkspaceService = WorkspaceService;
15944
15681
  exports2.YELLOW = YELLOW;
15945
- exports2._selectLatestFormRevision = _selectLatestFormRevision;
15946
15682
  exports2._setLatestRetryTime = _setLatestRetryTime;
15947
15683
  exports2.acceptProjectInvite = acceptProjectInvite;
15948
15684
  exports2.addActiveProjectFormSubmissionsCount = addActiveProjectFormSubmissionsCount;
@@ -15960,16 +15696,6 @@ var __publicField = (obj, key, value) => {
15960
15696
  exports2.addDocuments = addDocuments;
15961
15697
  exports2.addEmailDomain = addEmailDomain;
15962
15698
  exports2.addFavouriteProjectId = addFavouriteProjectId;
15963
- exports2.addForm = addForm;
15964
- exports2.addFormRevision = addFormRevision;
15965
- exports2.addFormRevisionAttachment = addFormRevisionAttachment;
15966
- exports2.addFormRevisionAttachments = addFormRevisionAttachments;
15967
- exports2.addFormRevisions = addFormRevisions;
15968
- exports2.addFormSubmission = addFormSubmission;
15969
- exports2.addFormSubmissionAttachment = addFormSubmissionAttachment;
15970
- exports2.addFormSubmissionAttachments = addFormSubmissionAttachments;
15971
- exports2.addFormSubmissions = addFormSubmissions;
15972
- exports2.addForms = addForms;
15973
15699
  exports2.addIssue = addIssue;
15974
15700
  exports2.addIssueAttachment = addIssueAttachment;
15975
15701
  exports2.addIssueAttachments = addIssueAttachments;
@@ -15990,6 +15716,13 @@ var __publicField = (obj, key, value) => {
15990
15716
  exports2.addStageCompletions = addStageCompletions;
15991
15717
  exports2.addStages = addStages;
15992
15718
  exports2.addToRecentIssues = addToRecentIssues;
15719
+ exports2.addUserForm = addUserForm;
15720
+ exports2.addUserFormRevision = addUserFormRevision;
15721
+ exports2.addUserFormRevisionAttachment = addUserFormRevisionAttachment;
15722
+ exports2.addUserFormRevisions = addUserFormRevisions;
15723
+ exports2.addUserFormSubmissionAttachment = addUserFormSubmissionAttachment;
15724
+ exports2.addUserFormSubmissions = addUserFormSubmissions;
15725
+ exports2.addUserForms = addUserForms;
15993
15726
  exports2.addUsers = addUsers;
15994
15727
  exports2.addWorkspace = addWorkspace;
15995
15728
  exports2.areArraysEqual = areArraysEqual;
@@ -16010,7 +15743,6 @@ var __publicField = (obj, key, value) => {
16010
15743
  exports2.componentStageSlice = componentStageSlice;
16011
15744
  exports2.componentTypeReducer = componentTypeReducer;
16012
15745
  exports2.componentTypeSlice = componentTypeSlice;
16013
- exports2.constructUploadedFilePayloads = constructUploadedFilePayloads;
16014
15746
  exports2.coordinatesAreEqual = coordinatesAreEqual;
16015
15747
  exports2.coordinatesToLiteral = coordinatesToLiteral;
16016
15748
  exports2.coordinatesToPointGeometry = coordinatesToPointGeometry;
@@ -16021,16 +15753,12 @@ var __publicField = (obj, key, value) => {
16021
15753
  exports2.defaultBadgeColor = defaultBadgeColor;
16022
15754
  exports2.defaultStore = defaultStore;
16023
15755
  exports2.deleteComponentType = deleteComponentType;
16024
- exports2.deleteForm = deleteForm;
16025
- exports2.deleteFormRevision = deleteFormRevision;
16026
- exports2.deleteFormRevisionAttachment = deleteFormRevisionAttachment;
16027
- exports2.deleteFormRevisionAttachments = deleteFormRevisionAttachments;
16028
- exports2.deleteFormRevisions = deleteFormRevisions;
16029
- exports2.deleteFormSubmission = deleteFormSubmission;
16030
- exports2.deleteFormSubmissionAttachment = deleteFormSubmissionAttachment;
16031
- exports2.deleteFormSubmissionAttachments = deleteFormSubmissionAttachments;
16032
- exports2.deleteFormSubmissions = deleteFormSubmissions;
16033
15756
  exports2.deleteProject = deleteProject;
15757
+ exports2.deleteUserForm = deleteUserForm;
15758
+ exports2.deleteUserFormRevision = deleteUserFormRevision;
15759
+ exports2.deleteUserFormRevisions = deleteUserFormRevisions;
15760
+ exports2.deleteUserFormSubmission = deleteUserFormSubmission;
15761
+ exports2.deleteUserFormSubmissions = deleteUserFormSubmissions;
16034
15762
  exports2.dequeue = dequeue;
16035
15763
  exports2.deserialize = deserialize;
16036
15764
  exports2.deserializeField = deserializeField;
@@ -16059,13 +15787,7 @@ var __publicField = (obj, key, value) => {
16059
15787
  exports2.fileSlice = fileSlice;
16060
15788
  exports2.fileToBlob = fileToBlob;
16061
15789
  exports2.flipCoordinates = flipCoordinates;
16062
- exports2.formReducer = formReducer;
16063
- exports2.formRevisionReducer = formRevisionReducer;
16064
15790
  exports2.formRevisionToSchema = formRevisionToSchema;
16065
- exports2.formRevisionsSlice = formRevisionsSlice;
16066
- exports2.formSlice = formSlice;
16067
- exports2.formSubmissionReducer = formSubmissionReducer;
16068
- exports2.formSubmissionSlice = formSubmissionSlice;
16069
15791
  exports2.forms = index;
16070
15792
  exports2.fullComponentMarkerSize = fullComponentMarkerSize;
16071
15793
  exports2.generateBadgeColors = generateBadgeColors;
@@ -16193,8 +15915,6 @@ var __publicField = (obj, key, value) => {
16193
15915
  exports2.selectAttachmentsOfComponentTypeByType = selectAttachmentsOfComponentTypeByType;
16194
15916
  exports2.selectAttachmentsOfDocument = selectAttachmentsOfDocument;
16195
15917
  exports2.selectAttachmentsOfDocumentByType = selectAttachmentsOfDocumentByType;
16196
- exports2.selectAttachmentsOfFormRevision = selectAttachmentsOfFormRevision;
16197
- exports2.selectAttachmentsOfFormSubmission = selectAttachmentsOfFormSubmission;
16198
15918
  exports2.selectAttachmentsOfIssue = selectAttachmentsOfIssue;
16199
15919
  exports2.selectAttachmentsOfIssueByType = selectAttachmentsOfIssueByType;
16200
15920
  exports2.selectAttachmentsOfProject = selectAttachmentsOfProject;
@@ -16212,9 +15932,11 @@ var __publicField = (obj, key, value) => {
16212
15932
  exports2.selectComponent = selectComponent;
16213
15933
  exports2.selectComponentAttachment = selectComponentAttachment;
16214
15934
  exports2.selectComponentAttachmentMapping = selectComponentAttachmentMapping;
15935
+ exports2.selectComponentSubmissionMapping = selectComponentSubmissionMapping;
16215
15936
  exports2.selectComponentType = selectComponentType;
16216
15937
  exports2.selectComponentTypeAttachment = selectComponentTypeAttachment;
16217
15938
  exports2.selectComponentTypeAttachmentMapping = selectComponentTypeAttachmentMapping;
15939
+ exports2.selectComponentTypeForm = selectComponentTypeForm;
16218
15940
  exports2.selectComponentTypeFromComponent = selectComponentTypeFromComponent;
16219
15941
  exports2.selectComponentTypeFromComponents = selectComponentTypeFromComponents;
16220
15942
  exports2.selectComponentTypeStagesMapping = selectComponentTypeStagesMapping;
@@ -16244,24 +15966,8 @@ var __publicField = (obj, key, value) => {
16244
15966
  exports2.selectExpandedSections = selectExpandedSections;
16245
15967
  exports2.selectFavouriteProjects = selectFavouriteProjects;
16246
15968
  exports2.selectFileAttachmentsOfIssue = selectFileAttachmentsOfIssue;
16247
- exports2.selectFilteredForms = selectFilteredForms;
16248
- exports2.selectForm = selectForm;
16249
- exports2.selectFormMapping = selectFormMapping;
16250
- exports2.selectFormOfComponentType = selectFormOfComponentType;
15969
+ exports2.selectFilteredUserForms = selectFilteredUserForms;
16251
15970
  exports2.selectFormRevision = selectFormRevision;
16252
- exports2.selectFormRevisionMapping = selectFormRevisionMapping;
16253
- exports2.selectFormRevisions = selectFormRevisions;
16254
- exports2.selectFormRevisionsOfForm = selectFormRevisionsOfForm;
16255
- exports2.selectFormSubmission = selectFormSubmission;
16256
- exports2.selectFormSubmissionAttachmentsMapping = selectFormSubmissionAttachmentsMapping;
16257
- exports2.selectFormSubmissions = selectFormSubmissions;
16258
- exports2.selectFormSubmissionsByComponents = selectFormSubmissionsByComponents;
16259
- exports2.selectFormSubmissionsMapping = selectFormSubmissionsMapping;
16260
- exports2.selectFormSubmissionsOfComponent = selectFormSubmissionsOfComponent;
16261
- exports2.selectFormSubmissionsOfForm = selectFormSubmissionsOfForm;
16262
- exports2.selectFormSubmissionsOfIssue = selectFormSubmissionsOfIssue;
16263
- exports2.selectFormsCount = selectFormsCount;
16264
- exports2.selectGeneralFormCount = selectGeneralFormCount;
16265
15971
  exports2.selectHiddenCategoryCount = selectHiddenCategoryCount;
16266
15972
  exports2.selectHiddenComponentTypeIds = selectHiddenComponentTypeIds;
16267
15973
  exports2.selectIsFetchingInitialData = selectIsFetchingInitialData;
@@ -16276,10 +15982,10 @@ var __publicField = (obj, key, value) => {
16276
15982
  exports2.selectIssueUpdateMapping = selectIssueUpdateMapping;
16277
15983
  exports2.selectIssueUpdatesOfIssue = selectIssueUpdatesOfIssue;
16278
15984
  exports2.selectIssues = selectIssues;
16279
- exports2.selectLatestFormRevisionByForm = selectLatestFormRevisionByForm;
16280
- exports2.selectLatestFormRevisionOfForm = selectLatestFormRevisionOfForm;
16281
- exports2.selectLatestFormRevisionsOfComponentTypes = selectLatestFormRevisionsOfComponentTypes;
15985
+ exports2.selectLatestFormRevision = selectLatestFormRevision;
16282
15986
  exports2.selectLatestRetryTime = selectLatestRetryTime;
15987
+ exports2.selectLatestRevisionByFormId = selectLatestRevisionByFormId;
15988
+ exports2.selectLatestRevisionsFromComponentTypeIds = selectLatestRevisionsFromComponentTypeIds;
16283
15989
  exports2.selectLicense = selectLicense;
16284
15990
  exports2.selectLicenseForProject = selectLicenseForProject;
16285
15991
  exports2.selectLicenses = selectLicenses;
@@ -16288,6 +15994,8 @@ var __publicField = (obj, key, value) => {
16288
15994
  exports2.selectMapStyle = selectMapStyle;
16289
15995
  exports2.selectNumberOfComponentTypesMatchingCaseInsensitiveName = selectNumberOfComponentTypesMatchingCaseInsensitiveName;
16290
15996
  exports2.selectNumberOfComponentsOfComponentType = selectNumberOfComponentsOfComponentType;
15997
+ exports2.selectNumberOfGeneralUserForms = selectNumberOfGeneralUserForms;
15998
+ exports2.selectNumberOfUserForms = selectNumberOfUserForms;
16291
15999
  exports2.selectOrganization = selectOrganization;
16292
16000
  exports2.selectOrganizationAccess = selectOrganizationAccess;
16293
16001
  exports2.selectOrganizationAccessForUser = selectOrganizationAccessForUser;
@@ -16315,6 +16023,8 @@ var __publicField = (obj, key, value) => {
16315
16023
  exports2.selectRecentIssuesAsSearchResults = selectRecentIssuesAsSearchResults;
16316
16024
  exports2.selectRecentProjects = selectRecentProjects;
16317
16025
  exports2.selectRehydrated = selectRehydrated;
16026
+ exports2.selectRevisionAttachments = selectRevisionAttachments;
16027
+ exports2.selectRevisionsForForm = selectRevisionsForForm;
16318
16028
  exports2.selectRootDocuments = selectRootDocuments;
16319
16029
  exports2.selectShowTooltips = selectShowTooltips;
16320
16030
  exports2.selectSortedEmailDomains = selectSortedEmailDomains;
@@ -16329,10 +16039,16 @@ var __publicField = (obj, key, value) => {
16329
16039
  exports2.selectStagesFromComponentType = selectStagesFromComponentType;
16330
16040
  exports2.selectStagesFromComponentTypeIds = selectStagesFromComponentTypeIds;
16331
16041
  exports2.selectStagesFromStageIds = selectStagesFromStageIds;
16042
+ exports2.selectSubmissionAttachments = selectSubmissionAttachments;
16043
+ exports2.selectSubmissionsForComponent = selectSubmissionsForComponent;
16044
+ exports2.selectSubmissionsForForm = selectSubmissionsForForm;
16045
+ exports2.selectSubmissionsForIssue = selectSubmissionsForIssue;
16332
16046
  exports2.selectUploadUrl = selectUploadUrl;
16333
16047
  exports2.selectUsedColors = selectUsedColors;
16334
16048
  exports2.selectUser = selectUser;
16335
- exports2.selectUserFormRevisionAttachmentsMapping = selectUserFormRevisionAttachmentsMapping;
16049
+ exports2.selectUserForm = selectUserForm;
16050
+ exports2.selectUserFormMapping = selectUserFormMapping;
16051
+ exports2.selectUserFormSubmission = selectUserFormSubmission;
16336
16052
  exports2.selectUsersAsMapping = selectUsersAsMapping;
16337
16053
  exports2.selectVisibleStatuses = selectVisibleStatuses;
16338
16054
  exports2.selectVisibleUserIds = selectVisibleUserIds;
@@ -16359,13 +16075,6 @@ var __publicField = (obj, key, value) => {
16359
16075
  exports2.setEnableClustering = setEnableClustering;
16360
16076
  exports2.setEnableDuplicateIssues = setEnableDuplicateIssues;
16361
16077
  exports2.setEnablePlacementMode = setEnablePlacementMode;
16362
- exports2.setFormRevision = setFormRevision;
16363
- exports2.setFormRevisionAttachments = setFormRevisionAttachments;
16364
- exports2.setFormRevisions = setFormRevisions;
16365
- exports2.setFormSubmission = setFormSubmission;
16366
- exports2.setFormSubmissionAttachments = setFormSubmissionAttachments;
16367
- exports2.setFormSubmissions = setFormSubmissions;
16368
- exports2.setForms = setForms;
16369
16078
  exports2.setIsFetchingInitialData = setIsFetchingInitialData;
16370
16079
  exports2.setIsImportingProjectFile = setIsImportingProjectFile;
16371
16080
  exports2.setIsLoading = setIsLoading;
@@ -16390,6 +16099,9 @@ var __publicField = (obj, key, value) => {
16390
16099
  exports2.setTokens = setTokens;
16391
16100
  exports2.setTourStep = setTourStep;
16392
16101
  exports2.setUploadUrl = setUploadUrl;
16102
+ exports2.setUserFormRevisionAttachments = setUserFormRevisionAttachments;
16103
+ exports2.setUserFormSubmissionAttachments = setUserFormSubmissionAttachments;
16104
+ exports2.setUserFormSubmissions = setUserFormSubmissions;
16393
16105
  exports2.setUsers = setUsers;
16394
16106
  exports2.setVisibleStatuses = setVisibleStatuses;
16395
16107
  exports2.setVisibleUserIds = setVisibleUserIds;
@@ -16414,13 +16126,11 @@ var __publicField = (obj, key, value) => {
16414
16126
  exports2.updateComponentTypeAttachment = updateComponentTypeAttachment;
16415
16127
  exports2.updateDocumentAttachment = updateDocumentAttachment;
16416
16128
  exports2.updateDocuments = updateDocuments;
16417
- exports2.updateFormSubmission = updateFormSubmission;
16418
- exports2.updateFormSubmissionAttachments = updateFormSubmissionAttachments;
16419
- exports2.updateFormSubmissions = updateFormSubmissions;
16420
16129
  exports2.updateIssue = updateIssue;
16421
16130
  exports2.updateIssueAttachment = updateIssueAttachment;
16422
16131
  exports2.updateLicense = updateLicense;
16423
16132
  exports2.updateOrCreateProject = updateOrCreateProject;
16133
+ exports2.updateOrCreateUserFormSubmission = updateOrCreateUserFormSubmission;
16424
16134
  exports2.updateOrganizationAccess = updateOrganizationAccess;
16425
16135
  exports2.updateProjectAccess = updateProjectAccess;
16426
16136
  exports2.updateProjectAttachment = updateProjectAttachment;
@@ -16434,6 +16144,8 @@ var __publicField = (obj, key, value) => {
16434
16144
  exports2.useFormikInput = useFormikInput;
16435
16145
  exports2.useMemoCompare = useMemoCompare;
16436
16146
  exports2.useSDK = useSDK;
16147
+ exports2.userFormReducer = userFormReducer;
16148
+ exports2.userFormSlice = userFormSlice;
16437
16149
  exports2.userReducer = userReducer;
16438
16150
  exports2.userSlice = userSlice;
16439
16151
  exports2.valueIsFile = valueIsFile;