@overmap-ai/core 1.0.50-bulk-form-submission.3 → 1.0.50-document-attachments.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.
@@ -622,15 +622,15 @@ var __publicField = (obj, key, value) => {
622
622
  };
623
623
  const migrations = [initialVersioning, signOut, signOut, createOutboxState];
624
624
  const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
625
- const initialState$p = {
625
+ const initialState$n = {
626
626
  accessToken: "",
627
627
  refreshToken: "",
628
628
  isLoggedIn: false
629
629
  };
630
630
  const authSlice = toolkit.createSlice({
631
631
  name: "auth",
632
- initialState: initialState$p,
633
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
632
+ initialState: initialState$n,
633
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
634
634
  reducers: {
635
635
  setTokens: (state, action) => {
636
636
  state.accessToken = action.payload.accessToken;
@@ -795,19 +795,6 @@ var __publicField = (obj, key, value) => {
795
795
  element.click();
796
796
  document.body.removeChild(element);
797
797
  }
798
- const constructUploadedFilePayloads = async (files) => {
799
- const filePayloads = {};
800
- for (const file of files) {
801
- const sha1 = await hashFile(file);
802
- filePayloads[sha1] = {
803
- sha1,
804
- extension: file.name.split(".").pop() || "",
805
- file_type: file.type,
806
- size: file.size
807
- };
808
- }
809
- return Object.values(filePayloads);
810
- };
811
798
  const fileToBlob = async (dataUrl) => {
812
799
  return (await fetch(dataUrl)).blob();
813
800
  };
@@ -1374,7 +1361,7 @@ var __publicField = (obj, key, value) => {
1374
1361
  return getLocalDateString(date);
1375
1362
  return relative.format(days, "days");
1376
1363
  });
1377
- const initialState$o = {
1364
+ const initialState$m = {
1378
1365
  categories: {},
1379
1366
  usedCategoryColors: [],
1380
1367
  categoryVisibility: {
@@ -1384,8 +1371,8 @@ var __publicField = (obj, key, value) => {
1384
1371
  };
1385
1372
  const categorySlice = toolkit.createSlice({
1386
1373
  name: "categories",
1387
- initialState: initialState$o,
1388
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
1374
+ initialState: initialState$m,
1375
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
1389
1376
  reducers: {
1390
1377
  setCategories: (state, action) => {
1391
1378
  if (!Array.isArray(action.payload))
@@ -1554,14 +1541,14 @@ var __publicField = (obj, key, value) => {
1554
1541
  delete state.attachments[attachmentId];
1555
1542
  }
1556
1543
  }
1557
- const initialState$n = {
1544
+ const initialState$l = {
1558
1545
  components: {},
1559
1546
  attachments: {}
1560
1547
  };
1561
1548
  const componentSlice = toolkit.createSlice({
1562
1549
  name: "components",
1563
- initialState: initialState$n,
1564
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
1550
+ initialState: initialState$l,
1551
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
1565
1552
  reducers: {
1566
1553
  addComponent: (state, action) => {
1567
1554
  state.components[action.payload.offline_id] = action.payload;
@@ -1717,13 +1704,13 @@ var __publicField = (obj, key, value) => {
1717
1704
  removeAllComponentsOfType
1718
1705
  } = componentSlice.actions;
1719
1706
  const componentReducer = componentSlice.reducer;
1720
- const initialState$m = {
1707
+ const initialState$k = {
1721
1708
  completionsByComponentId: {}
1722
1709
  };
1723
1710
  const componentStageCompletionSlice = toolkit.createSlice({
1724
1711
  name: "componentStageCompletions",
1725
- initialState: initialState$m,
1726
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
1712
+ initialState: initialState$k,
1713
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
1727
1714
  reducers: {
1728
1715
  addStageCompletion: (state, action) => {
1729
1716
  let stageToCompletionDateMapping = state.completionsByComponentId[action.payload.component];
@@ -1774,13 +1761,13 @@ var __publicField = (obj, key, value) => {
1774
1761
  return Object.keys(state.componentStageCompletionReducer.completionsByComponentId[component.offline_id] ?? {});
1775
1762
  };
1776
1763
  const componentStageCompletionReducer = componentStageCompletionSlice.reducer;
1777
- const initialState$l = {
1764
+ const initialState$j = {
1778
1765
  stages: {}
1779
1766
  };
1780
1767
  const componentStageSlice = toolkit.createSlice({
1781
1768
  name: "componentStages",
1782
- initialState: initialState$l,
1783
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
1769
+ initialState: initialState$j,
1770
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
1784
1771
  reducers: {
1785
1772
  addStages: (state, action) => {
1786
1773
  Object.assign(state.stages, toOfflineIdRecord(action.payload));
@@ -1890,15 +1877,15 @@ var __publicField = (obj, key, value) => {
1890
1877
  );
1891
1878
  const { addStages, updateStages, removeStages, linkStageToForm, unlinkStageToForm } = componentStageSlice.actions;
1892
1879
  const componentStageReducer = componentStageSlice.reducer;
1893
- const initialState$k = {
1880
+ const initialState$i = {
1894
1881
  componentTypes: {},
1895
1882
  hiddenComponentTypeIds: {},
1896
1883
  attachments: {}
1897
1884
  };
1898
1885
  const componentTypeSlice = toolkit.createSlice({
1899
1886
  name: "componentTypes",
1900
- initialState: initialState$k,
1901
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
1887
+ initialState: initialState$i,
1888
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
1902
1889
  reducers: {
1903
1890
  addComponentType: (state, action) => {
1904
1891
  state.componentTypes[action.payload.offline_id] = action.payload;
@@ -1966,9 +1953,6 @@ var __publicField = (obj, key, value) => {
1966
1953
  [selectComponentTypeAttachmentMapping],
1967
1954
  (mapping) => Object.values(mapping)
1968
1955
  );
1969
- const selectComponentTypeAttachment = (attachmentId) => (state) => {
1970
- return state.componentTypeReducer.attachments[attachmentId];
1971
- };
1972
1956
  const selectAttachmentsOfComponentType = restructureCreateSelectorWithArgs(
1973
1957
  toolkit.createSelector(
1974
1958
  [selectAllComponentTypeAttachments, (_state, componentTypeId) => componentTypeId],
@@ -2009,13 +1993,13 @@ var __publicField = (obj, key, value) => {
2009
1993
  deleteComponentType
2010
1994
  } = componentTypeSlice.actions;
2011
1995
  const componentTypeReducer = componentTypeSlice.reducer;
2012
- const initialState$j = {
1996
+ const initialState$h = {
2013
1997
  workspaces: {},
2014
1998
  activeWorkspaceId: null
2015
1999
  };
2016
2000
  const workspaceSlice = toolkit.createSlice({
2017
2001
  name: "workspace",
2018
- initialState: initialState$j,
2002
+ initialState: initialState$h,
2019
2003
  // The `reducers` field lets us define reducers and generate associated actions
2020
2004
  reducers: {
2021
2005
  setWorkspaces: (state, action) => {
@@ -2072,7 +2056,7 @@ var __publicField = (obj, key, value) => {
2072
2056
  );
2073
2057
  const workspaceReducer = workspaceSlice.reducer;
2074
2058
  const maxRecentIssues = 10;
2075
- const initialState$i = {
2059
+ const initialState$g = {
2076
2060
  issues: {},
2077
2061
  attachments: {},
2078
2062
  comments: {},
@@ -2084,9 +2068,9 @@ var __publicField = (obj, key, value) => {
2084
2068
  };
2085
2069
  const issueSlice = toolkit.createSlice({
2086
2070
  name: "issues",
2087
- initialState: initialState$i,
2071
+ initialState: initialState$g,
2088
2072
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
2089
- Object.assign(state, initialState$i);
2073
+ Object.assign(state, initialState$g);
2090
2074
  }),
2091
2075
  reducers: {
2092
2076
  setIssues: (state, action) => {
@@ -2494,15 +2478,15 @@ var __publicField = (obj, key, value) => {
2494
2478
  }
2495
2479
  );
2496
2480
  const issueReducer = issueSlice.reducer;
2497
- const initialState$h = {
2481
+ const initialState$f = {
2498
2482
  s3Urls: {}
2499
2483
  };
2500
2484
  const msPerHour = 1e3 * 60 * 60;
2501
2485
  const msPerWeek = msPerHour * 24 * 7;
2502
2486
  const fileSlice = toolkit.createSlice({
2503
2487
  name: "file",
2504
- initialState: initialState$h,
2505
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
2488
+ initialState: initialState$f,
2489
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
2506
2490
  reducers: {
2507
2491
  setUploadUrl: (state, action) => {
2508
2492
  const { url, fields, sha1 } = action.payload;
@@ -2529,7 +2513,7 @@ var __publicField = (obj, key, value) => {
2529
2513
  return url;
2530
2514
  };
2531
2515
  const fileReducer = fileSlice.reducer;
2532
- const initialState$g = {
2516
+ const initialState$e = {
2533
2517
  // TODO: Change first MapStyle.SATELLITE to MaptStyle.None when project creation map is fixed
2534
2518
  mapStyle: MapStyle.SATELLITE,
2535
2519
  showTooltips: false,
@@ -2537,8 +2521,8 @@ var __publicField = (obj, key, value) => {
2537
2521
  };
2538
2522
  const mapSlice = toolkit.createSlice({
2539
2523
  name: "map",
2540
- initialState: initialState$g,
2541
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
2524
+ initialState: initialState$e,
2525
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
2542
2526
  reducers: {
2543
2527
  setMapStyle: (state, action) => {
2544
2528
  state.mapStyle = action.payload;
@@ -2607,7 +2591,7 @@ var __publicField = (obj, key, value) => {
2607
2591
  LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
2608
2592
  return LicenseStatus2;
2609
2593
  })(LicenseStatus || {});
2610
- const initialState$f = {
2594
+ const initialState$d = {
2611
2595
  users: {},
2612
2596
  currentUser: {
2613
2597
  id: 0,
@@ -2618,8 +2602,8 @@ var __publicField = (obj, key, value) => {
2618
2602
  };
2619
2603
  const userSlice = toolkit.createSlice({
2620
2604
  name: "users",
2621
- initialState: initialState$f,
2622
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
2605
+ initialState: initialState$d,
2606
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
2623
2607
  reducers: {
2624
2608
  setUsers: (state, action) => {
2625
2609
  const usersMapping = {};
@@ -2681,13 +2665,13 @@ var __publicField = (obj, key, value) => {
2681
2665
  const selectUsersAsMapping = (state) => state.userReducer.users;
2682
2666
  const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
2683
2667
  const userReducer = userSlice.reducer;
2684
- const initialState$e = {
2668
+ const initialState$c = {
2685
2669
  organizationAccesses: {}
2686
2670
  };
2687
2671
  const organizationAccessSlice = toolkit.createSlice({
2688
2672
  name: "organizationAccess",
2689
- initialState: initialState$e,
2690
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
2673
+ initialState: initialState$c,
2674
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
2691
2675
  reducers: {
2692
2676
  setOrganizationAccesses: (state, action) => {
2693
2677
  if (!Array.isArray(action.payload))
@@ -2750,13 +2734,13 @@ var __publicField = (obj, key, value) => {
2750
2734
  return organizationAccesses;
2751
2735
  };
2752
2736
  const organizationAccessReducer = organizationAccessSlice.reducer;
2753
- const initialState$d = {
2737
+ const initialState$b = {
2754
2738
  licenses: {}
2755
2739
  };
2756
2740
  const licenseSlice = toolkit.createSlice({
2757
2741
  name: "license",
2758
- initialState: initialState$d,
2759
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
2742
+ initialState: initialState$b,
2743
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
2760
2744
  reducers: {
2761
2745
  setLicenses: (state, action) => {
2762
2746
  if (!Array.isArray(action.payload))
@@ -2801,13 +2785,13 @@ var __publicField = (obj, key, value) => {
2801
2785
  (licenses) => Object.values(licenses).filter((license) => license.project).reduce((accum, license) => ({ ...accum, [license.project]: license }), {})
2802
2786
  );
2803
2787
  const licenseReducer = licenseSlice.reducer;
2804
- const initialState$c = {
2788
+ const initialState$a = {
2805
2789
  projectAccesses: {}
2806
2790
  };
2807
2791
  const projectAccessSlice = toolkit.createSlice({
2808
2792
  name: "projectAccess",
2809
- initialState: initialState$c,
2810
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
2793
+ initialState: initialState$a,
2794
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
2811
2795
  reducers: {
2812
2796
  setProjectAccesses: (state, action) => {
2813
2797
  if (!Array.isArray(action.payload))
@@ -2875,7 +2859,7 @@ var __publicField = (obj, key, value) => {
2875
2859
  return projectAccesses;
2876
2860
  };
2877
2861
  const projectAccessReducer = projectAccessSlice.reducer;
2878
- const initialState$b = {
2862
+ const initialState$9 = {
2879
2863
  projects: {},
2880
2864
  activeProjectId: null,
2881
2865
  recentProjectIds: [],
@@ -2885,7 +2869,7 @@ var __publicField = (obj, key, value) => {
2885
2869
  };
2886
2870
  const projectSlice = toolkit.createSlice({
2887
2871
  name: "projects",
2888
- initialState: initialState$b,
2872
+ initialState: initialState$9,
2889
2873
  reducers: {
2890
2874
  setProjects: (state, action) => {
2891
2875
  const projectsMap = {};
@@ -3072,14 +3056,14 @@ var __publicField = (obj, key, value) => {
3072
3056
  }
3073
3057
  )
3074
3058
  );
3075
- const initialState$a = {
3059
+ const initialState$8 = {
3076
3060
  organizations: {},
3077
3061
  activeOrganizationId: null
3078
3062
  };
3079
3063
  const organizationSlice = toolkit.createSlice({
3080
3064
  name: "organizations",
3081
- initialState: initialState$a,
3082
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
3065
+ initialState: initialState$8,
3066
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
3083
3067
  reducers: {
3084
3068
  setOrganizations: (state, action) => {
3085
3069
  for (const org of action.payload) {
@@ -3198,14 +3182,14 @@ var __publicField = (obj, key, value) => {
3198
3182
  }
3199
3183
  };
3200
3184
  };
3201
- const initialState$9 = {
3185
+ const initialState$7 = {
3202
3186
  deletedRequests: [],
3203
3187
  latestRetryTime: 0
3204
3188
  };
3205
3189
  const outboxSlice = toolkit.createSlice({
3206
3190
  name: "outbox",
3207
- initialState: initialState$9,
3208
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$9)),
3191
+ initialState: initialState$7,
3192
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
3209
3193
  reducers: {
3210
3194
  // enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
3211
3195
  // Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
@@ -3237,7 +3221,7 @@ var __publicField = (obj, key, value) => {
3237
3221
  const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
3238
3222
  const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
3239
3223
  const outboxReducer = outboxSlice.reducer;
3240
- const initialState$8 = {
3224
+ const initialState$6 = {
3241
3225
  projectFiles: {},
3242
3226
  activeProjectFileId: null,
3243
3227
  isImportingProjectFile: false,
@@ -3245,8 +3229,8 @@ var __publicField = (obj, key, value) => {
3245
3229
  };
3246
3230
  const projectFileSlice = toolkit.createSlice({
3247
3231
  name: "projectFiles",
3248
- initialState: initialState$8,
3249
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
3232
+ initialState: initialState$6,
3233
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
3250
3234
  reducers: {
3251
3235
  addOrReplaceProjectFiles: (state, action) => {
3252
3236
  for (let fileObj of action.payload) {
@@ -3347,12 +3331,12 @@ var __publicField = (obj, key, value) => {
3347
3331
  const selectActiveProjectFileId = (state) => state.projectFileReducer.activeProjectFileId;
3348
3332
  const selectIsImportingProjectFile = (state) => state.projectFileReducer.isImportingProjectFile;
3349
3333
  const projectFileReducer = projectFileSlice.reducer;
3350
- const initialState$7 = {
3334
+ const initialState$5 = {
3351
3335
  isRehydrated: false
3352
3336
  };
3353
3337
  const rehydratedSlice = toolkit.createSlice({
3354
3338
  name: "rehydrated",
3355
- initialState: initialState$7,
3339
+ initialState: initialState$5,
3356
3340
  // The `reducers` field lets us define reducers and generate associated actions
3357
3341
  reducers: {
3358
3342
  setRehydrated: (state, action) => {
@@ -3362,7 +3346,7 @@ var __publicField = (obj, key, value) => {
3362
3346
  });
3363
3347
  const selectRehydrated = (state) => state.rehydratedReducer.isRehydrated;
3364
3348
  const rehydratedReducer = rehydratedSlice.reducer;
3365
- const initialState$6 = {
3349
+ const initialState$4 = {
3366
3350
  useIssueTemplate: false,
3367
3351
  placementMode: false,
3368
3352
  enableClustering: false,
@@ -3379,8 +3363,8 @@ var __publicField = (obj, key, value) => {
3379
3363
  };
3380
3364
  const settingSlice = toolkit.createSlice({
3381
3365
  name: "settings",
3382
- initialState: initialState$6,
3383
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
3366
+ initialState: initialState$4,
3367
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
3384
3368
  reducers: {
3385
3369
  setEnableDuplicateIssues: (state, action) => {
3386
3370
  state.useIssueTemplate = action.payload;
@@ -3426,248 +3410,146 @@ var __publicField = (obj, key, value) => {
3426
3410
  const settingReducer = settingSlice.reducer;
3427
3411
  const selectIsFetchingInitialData = (state) => state.settingReducer.isFetchingInitialData;
3428
3412
  const selectIsLoading = (state) => state.settingReducer.isLoading;
3429
- const LATEST_FORM_REVISION_CACHE = {};
3430
- function considerCachingFormRevision(formRevision, formId2, preferPending = false) {
3413
+ const LATEST_REVISION_CACHE = {};
3414
+ function considerCachingRevision(revision, formId2, preferPending = false) {
3431
3415
  var _a2;
3432
- if (!formRevision) {
3416
+ if (!revision) {
3433
3417
  if (!formId2) {
3434
- throw new Error("If form revision is null, formId is required.");
3418
+ throw new Error("If revision is null, formId is required.");
3435
3419
  }
3436
- const currentLatestFormRevision = getLatestFormRevisionFromCache(formId2);
3437
- if (currentLatestFormRevision)
3420
+ const currentLatestRevision = getLatestRevisionFromCache(formId2);
3421
+ if (currentLatestRevision)
3438
3422
  return;
3439
- LATEST_FORM_REVISION_CACHE[formId2] = null;
3423
+ LATEST_REVISION_CACHE[formId2] = null;
3440
3424
  return;
3441
3425
  }
3442
- if (formRevision.revision === "Pending") {
3426
+ if (revision.revision === "Pending") {
3443
3427
  if (preferPending) {
3444
- LATEST_FORM_REVISION_CACHE[formRevision.form] = formRevision;
3428
+ LATEST_REVISION_CACHE[revision.form] = revision;
3445
3429
  }
3446
3430
  return;
3447
3431
  }
3448
- const cachedFormRevision = (_a2 = LATEST_FORM_REVISION_CACHE[formRevision.form]) == null ? void 0 : _a2.revision;
3449
- if (formRevision.revision > (typeof cachedFormRevision === "number" ? cachedFormRevision : -1)) {
3450
- LATEST_FORM_REVISION_CACHE[formRevision.form] = formRevision;
3432
+ const cachedRevision = (_a2 = LATEST_REVISION_CACHE[revision.form]) == null ? void 0 : _a2.revision;
3433
+ if (revision.revision > (typeof cachedRevision === "number" ? cachedRevision : -1)) {
3434
+ LATEST_REVISION_CACHE[revision.form] = revision;
3451
3435
  }
3452
3436
  }
3453
- function getLatestFormRevisionFromCache(formId2) {
3454
- return LATEST_FORM_REVISION_CACHE[formId2];
3437
+ function getLatestRevisionFromCache(formId2) {
3438
+ return LATEST_REVISION_CACHE[formId2];
3455
3439
  }
3456
- const initialState$5 = {
3457
- formRevisions: {},
3458
- attachments: {}
3459
- };
3460
- const formRevisionsSlice = toolkit.createSlice({
3461
- name: "formRevisions",
3462
- initialState: initialState$5,
3463
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
3440
+ const initialState$3 = {
3441
+ userForms: {},
3442
+ revisions: {},
3443
+ submissions: {},
3444
+ submissionAttachments: {},
3445
+ revisionAttachments: {}
3446
+ };
3447
+ const userFormSlice = toolkit.createSlice({
3448
+ name: "userForms",
3449
+ initialState: initialState$3,
3450
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
3464
3451
  reducers: {
3465
- // revision related actions
3466
- setFormRevision: (state, action) => {
3467
- state.formRevisions[action.payload.offline_id] = action.payload;
3468
- considerCachingFormRevision(action.payload);
3452
+ setUserForms: (state, action) => {
3453
+ state.userForms = {};
3454
+ action.payload.forEach((userForm) => {
3455
+ state.userForms[userForm.offline_id] = userForm;
3456
+ });
3469
3457
  },
3470
- setFormRevisions: (state, action) => {
3471
- state.formRevisions = {};
3472
- for (const revision of action.payload) {
3473
- state.formRevisions[revision.offline_id] = revision;
3474
- considerCachingFormRevision(revision);
3475
- }
3458
+ addUserForm: (state, action) => {
3459
+ state.userForms[action.payload.offline_id] = action.payload;
3476
3460
  },
3477
- addFormRevision: (state, action) => {
3478
- if (state.formRevisions[action.payload.offline_id] !== void 0) {
3479
- throw new Error(`Revision with offline_id ${action.payload.offline_id} already exists`);
3480
- }
3481
- state.formRevisions[action.payload.offline_id] = action.payload;
3482
- considerCachingFormRevision(action.payload);
3461
+ addUserForms: (state, action) => {
3462
+ action.payload.forEach((userForm) => {
3463
+ state.userForms[userForm.offline_id] = userForm;
3464
+ });
3483
3465
  },
3484
- // TODO: @Audiopolis / Magnus - do we want to standardize using PayloadAction?
3485
- addFormRevisions: (state, action) => {
3486
- for (const userFormRevision of action.payload) {
3487
- if (state.formRevisions[userFormRevision.offline_id] !== void 0) {
3488
- throw new Error(`Revision with offline_id ${userFormRevision.offline_id} already exists`);
3489
- }
3490
- }
3491
- for (const userFormRevision of action.payload) {
3492
- state.formRevisions[userFormRevision.offline_id] = userFormRevision;
3493
- considerCachingFormRevision(userFormRevision);
3494
- }
3466
+ addUserFormRevisions: (state, action) => {
3467
+ action.payload.forEach((userFormRevision) => {
3468
+ state.revisions[userFormRevision.offline_id] = userFormRevision;
3469
+ considerCachingRevision(userFormRevision);
3470
+ });
3495
3471
  },
3496
- // UserFormRevisions do not get updated
3497
- deleteFormRevision: (state, action) => {
3498
- if (state.formRevisions[action.payload] === void 0) {
3499
- throw new Error(`Revision with offline_id ${action.payload} does not exist`);
3500
- }
3501
- delete state.formRevisions[action.payload];
3502
- delete LATEST_FORM_REVISION_CACHE[action.payload];
3472
+ addUserFormRevision: (state, action) => {
3473
+ state.revisions[action.payload.offline_id] = action.payload;
3474
+ considerCachingRevision(action.payload);
3503
3475
  },
3504
- deleteFormRevisions: (state, action) => {
3505
- for (const offlineId of action.payload) {
3506
- if (state.formRevisions[offlineId] === void 0) {
3507
- throw new Error(`Revision with offline_id ${offlineId} does not exist`);
3508
- }
3509
- }
3510
- for (const offlineId of action.payload) {
3511
- delete state.formRevisions[offlineId];
3512
- delete LATEST_FORM_REVISION_CACHE[offlineId];
3476
+ deleteUserFormRevision: (state, action) => {
3477
+ delete state.revisions[action.payload];
3478
+ delete LATEST_REVISION_CACHE[action.payload];
3479
+ },
3480
+ deleteUserFormRevisions: (state, action) => {
3481
+ for (const userFormRevision of action.payload) {
3482
+ delete state.revisions[userFormRevision.offline_id];
3483
+ delete LATEST_REVISION_CACHE[userFormRevision.offline_id];
3513
3484
  }
3514
3485
  },
3515
- // attachment related actions
3516
- setFormRevisionAttachments: (state, action) => {
3517
- state.attachments = {};
3518
- for (const attachment of action.payload) {
3519
- state.attachments[attachment.offline_id] = attachment;
3486
+ updateOrCreateUserFormSubmission: (state, action) => {
3487
+ state.submissions[action.payload.offline_id] = action.payload;
3488
+ },
3489
+ addUserFormSubmissionAttachment: (state, action) => {
3490
+ const submissionId = action.payload.submission;
3491
+ const submissionAttachments = state.submissionAttachments[submissionId];
3492
+ if (submissionAttachments) {
3493
+ submissionAttachments.push(action.payload);
3494
+ } else {
3495
+ state.submissionAttachments[submissionId] = [action.payload];
3520
3496
  }
3521
3497
  },
3522
- addFormRevisionAttachment: (state, action) => {
3523
- if (state.attachments[action.payload.offline_id] !== void 0) {
3524
- throw new Error(`Attachment with offline_id ${action.payload.offline_id} already exists`);
3498
+ addUserFormRevisionAttachment: (state, action) => {
3499
+ const revisionId = action.payload.revision;
3500
+ const revisionAttachments = state.revisionAttachments[revisionId];
3501
+ if (revisionAttachments) {
3502
+ revisionAttachments.push(action.payload);
3503
+ } else {
3504
+ state.revisionAttachments[revisionId] = [action.payload];
3525
3505
  }
3526
- state.attachments[action.payload.offline_id] = action.payload;
3527
3506
  },
3528
- addFormRevisionAttachments: (state, action) => {
3507
+ setUserFormSubmissionAttachments: (state, action) => {
3508
+ state.submissionAttachments = {};
3529
3509
  for (const attachment of action.payload) {
3530
- if (state.attachments[attachment.offline_id] !== void 0) {
3531
- throw new Error(`Attachment with offline_id ${attachment.offline_id} already exists`);
3510
+ const submissionId = attachment.submission;
3511
+ const submissionAttachments = state.submissionAttachments[submissionId];
3512
+ if (submissionAttachments) {
3513
+ submissionAttachments.push(attachment);
3514
+ } else {
3515
+ state.submissionAttachments[submissionId] = [attachment];
3532
3516
  }
3533
3517
  }
3518
+ },
3519
+ setUserFormRevisionAttachments: (state, action) => {
3520
+ state.revisionAttachments = {};
3534
3521
  for (const attachment of action.payload) {
3535
- state.attachments[attachment.offline_id] = attachment;
3522
+ const revisionId = attachment.revision;
3523
+ const revisionAttachments = state.revisionAttachments[revisionId];
3524
+ if (revisionAttachments) {
3525
+ revisionAttachments.push(attachment);
3526
+ } else {
3527
+ state.revisionAttachments[revisionId] = [attachment];
3528
+ }
3536
3529
  }
3537
3530
  },
3538
- deleteFormRevisionAttachment: (state, action) => {
3539
- if (state.attachments[action.payload] === void 0) {
3540
- throw new Error(`Attachment with offline_id ${action.payload} does not exist`);
3541
- }
3542
- delete state.attachments[action.payload];
3531
+ deleteUserFormSubmission: (state, action) => {
3532
+ delete state.submissions[action.payload];
3543
3533
  },
3544
- deleteFormRevisionAttachments: (state, action) => {
3545
- for (const offlineId of action.payload) {
3546
- if (state.attachments[offlineId] === void 0) {
3547
- throw new Error(`Attachment with offline_id ${offlineId} does not exist`);
3548
- }
3534
+ deleteUserFormSubmissions: (state, action) => {
3535
+ for (const userFormSubmission of action.payload) {
3536
+ delete state.submissions[userFormSubmission.offline_id];
3549
3537
  }
3550
- for (const offlineId of action.payload) {
3551
- delete state.attachments[offlineId];
3552
- }
3553
- }
3554
- }
3555
- });
3556
- const {
3557
- setFormRevision,
3558
- setFormRevisions,
3559
- addFormRevision,
3560
- addFormRevisions,
3561
- deleteFormRevision,
3562
- deleteFormRevisions,
3563
- setFormRevisionAttachments,
3564
- addFormRevisionAttachment,
3565
- addFormRevisionAttachments,
3566
- deleteFormRevisionAttachment,
3567
- deleteFormRevisionAttachments
3568
- } = formRevisionsSlice.actions;
3569
- const selectFormRevisionMapping = (state) => state.formRevisionReducer.formRevisions;
3570
- const selectFormRevisions = toolkit.createSelector(
3571
- [selectFormRevisionMapping],
3572
- (formRevisions) => Object.values(formRevisions)
3573
- );
3574
- const selectFormRevision = (formRevisionId) => (state) => {
3575
- return state.formRevisionReducer.formRevisions[formRevisionId];
3576
- };
3577
- const _selectLatestFormRevision = (formRevisions, formId2) => {
3578
- let ret = null;
3579
- for (const candidate of Object.values(formRevisions)) {
3580
- if (candidate.form === formId2 && (!ret || ret.revision < candidate.revision)) {
3581
- ret = candidate;
3582
- }
3583
- }
3584
- if (!ret) {
3585
- throw new Error("No form revision found for form " + formId2);
3586
- }
3587
- return ret;
3588
- };
3589
- const selectLatestFormRevisionOfForm = restructureCreateSelectorWithArgs(
3590
- toolkit.createSelector([selectFormRevisionMapping, (_state, formId2) => formId2], (revisions, formId2) => {
3591
- if (!formId2) {
3592
- throw new Error("formId is required");
3593
- }
3594
- return _selectLatestFormRevision(revisions, formId2);
3595
- })
3596
- );
3597
- const selectFormRevisionsOfForm = restructureCreateSelectorWithArgs(
3598
- toolkit.createSelector([selectFormRevisions, (_state, formId2) => formId2], (revisions, formId2) => {
3599
- return revisions.filter((revision) => {
3600
- return revision.form === formId2;
3601
- });
3602
- })
3603
- );
3604
- const selectLatestFormRevisionsOfComponentTypes = restructureCreateSelectorWithArgs(
3605
- toolkit.createSelector(
3606
- [
3607
- (state) => state.formReducer.forms,
3608
- selectFormRevisionMapping,
3609
- (_state, componentTypeIds) => componentTypeIds
3610
- ],
3611
- (userForms, revisions, componentTypeIds) => {
3612
- const componentTypeIdsSet = new Set(componentTypeIds);
3613
- const ret = {};
3614
- for (const form of Object.values(userForms)) {
3615
- if (form.component_type && componentTypeIdsSet.has(form.component_type)) {
3616
- ret[form.component_type] = _selectLatestFormRevision(revisions, form.offline_id);
3617
- }
3618
- }
3619
- return ret;
3620
- }
3621
- )
3622
- );
3623
- const selectLatestFormRevisionByForm = toolkit.createSelector([selectFormRevisionMapping], (revisions) => {
3624
- const latestRevisions = {};
3625
- for (const revision of Object.values(revisions)) {
3626
- const formId2 = revision.form;
3627
- const currentLatestRevision = latestRevisions[formId2];
3628
- if (!currentLatestRevision || currentLatestRevision.revision < revision.revision) {
3629
- latestRevisions[formId2] = revision;
3630
- }
3631
- }
3632
- return latestRevisions;
3633
- });
3634
- const selectUserFormRevisionAttachmentsMapping = (state) => {
3635
- return state.formRevisionReducer.attachments;
3636
- };
3637
- const selectAttachmentsOfFormRevision = restructureCreateSelectorWithArgs(
3638
- toolkit.createSelector(
3639
- [selectUserFormRevisionAttachmentsMapping, (_state, revisionId) => revisionId],
3640
- (attachments, revisionId) => {
3641
- return Object.values(attachments).filter((attachment) => attachment.revision === revisionId);
3642
- }
3643
- )
3644
- );
3645
- const formRevisionReducer = formRevisionsSlice.reducer;
3646
- const initialState$4 = {
3647
- forms: {}
3648
- };
3649
- const formSlice = toolkit.createSlice({
3650
- name: "forms",
3651
- initialState: initialState$4,
3652
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
3653
- reducers: {
3654
- setForms: (state, action) => {
3655
- state.forms = {};
3656
- action.payload.forEach((userForm) => {
3657
- state.forms[userForm.offline_id] = userForm;
3658
- });
3659
3538
  },
3660
- addForm: (state, action) => {
3661
- state.forms[action.payload.offline_id] = action.payload;
3539
+ addUserFormSubmissions: (state, action) => {
3540
+ for (const submission of action.payload) {
3541
+ state.submissions[submission.offline_id] = submission;
3542
+ }
3662
3543
  },
3663
- addForms: (state, action) => {
3664
- action.payload.forEach((userForm) => {
3665
- state.forms[userForm.offline_id] = userForm;
3544
+ setUserFormSubmissions: (state, action) => {
3545
+ state.submissions = {};
3546
+ action.payload.forEach((submission) => {
3547
+ state.submissions[submission.offline_id] = submission;
3666
3548
  });
3667
3549
  },
3668
3550
  favoriteForm: (state, action) => {
3669
3551
  const { formId: formId2 } = action.payload;
3670
- const form = state.forms[formId2];
3552
+ const form = state.userForms[formId2];
3671
3553
  if (!form) {
3672
3554
  throw new Error("No form exists with the id " + formId2);
3673
3555
  }
@@ -3675,23 +3557,48 @@ var __publicField = (obj, key, value) => {
3675
3557
  },
3676
3558
  unfavoriteForm: (state, action) => {
3677
3559
  const { formId: formId2 } = action.payload;
3678
- const form = state.forms[formId2];
3560
+ const form = state.userForms[formId2];
3679
3561
  if (!form) {
3680
3562
  throw new Error("No form exists with the id " + formId2);
3681
3563
  }
3682
3564
  form.favorite = false;
3683
3565
  },
3684
- deleteForm: (state, action) => {
3685
- delete state.forms[action.payload];
3566
+ deleteUserForm: (state, action) => {
3567
+ delete state.userForms[action.payload];
3686
3568
  }
3687
3569
  }
3688
3570
  });
3689
- const { setForms, addForm, addForms, favoriteForm, unfavoriteForm, deleteForm } = formSlice.actions;
3690
- const selectFilteredForms = restructureCreateSelectorWithArgs(
3571
+ const {
3572
+ addUserForm,
3573
+ addUserForms,
3574
+ addUserFormRevisions,
3575
+ updateOrCreateUserFormSubmission,
3576
+ addUserFormSubmissions,
3577
+ deleteUserFormSubmission,
3578
+ deleteUserFormSubmissions,
3579
+ favoriteForm,
3580
+ unfavoriteForm,
3581
+ deleteUserForm,
3582
+ deleteUserFormRevision,
3583
+ deleteUserFormRevisions,
3584
+ setUserFormSubmissions,
3585
+ addUserFormRevision,
3586
+ addUserFormSubmissionAttachment,
3587
+ addUserFormRevisionAttachment,
3588
+ setUserFormSubmissionAttachments,
3589
+ setUserFormRevisionAttachments
3590
+ } = userFormSlice.actions;
3591
+ const selectSubmissionAttachments = (submissionId) => (state) => {
3592
+ return state.userFormReducer.submissionAttachments[submissionId] || [];
3593
+ };
3594
+ const selectRevisionAttachments = (revisionId) => (state) => {
3595
+ return state.userFormReducer.revisionAttachments[revisionId] || [];
3596
+ };
3597
+ const selectFilteredUserForms = restructureCreateSelectorWithArgs(
3691
3598
  toolkit.createSelector(
3692
3599
  [
3693
- (state) => state.formReducer.forms,
3694
- (state) => state.formRevisionReducer.formRevisions,
3600
+ (state) => state.userFormReducer.userForms,
3601
+ (state) => state.userFormReducer.revisions,
3695
3602
  (_state, search) => search
3696
3603
  ],
3697
3604
  (userForms, revisions, search) => {
@@ -3725,188 +3632,63 @@ var __publicField = (obj, key, value) => {
3725
3632
  { memoizeOptions: { equalityCheck: reactRedux.shallowEqual } }
3726
3633
  )
3727
3634
  );
3728
- const selectForm = (formId2) => (state) => {
3729
- return state.formReducer.forms[formId2];
3635
+ const selectFormRevision = (revisionId) => (state) => {
3636
+ return state.userFormReducer.revisions[revisionId];
3730
3637
  };
3731
- const selectFormMapping = (state) => {
3732
- return state.formReducer.forms;
3638
+ const _selectLatestFormRevision = (revisions, formId2) => {
3639
+ let ret = null;
3640
+ for (const candidate of Object.values(revisions)) {
3641
+ if (candidate.form === formId2 && (!ret || ret.revision < candidate.revision)) {
3642
+ ret = candidate;
3643
+ }
3644
+ }
3645
+ if (!ret) {
3646
+ throw new Error("No revision found for form " + formId2);
3647
+ }
3648
+ return ret;
3733
3649
  };
3734
- const selectFormOfComponentType = restructureCreateSelectorWithArgs(
3650
+ const selectLatestFormRevision = restructureCreateSelectorWithArgs(
3735
3651
  toolkit.createSelector(
3736
- [selectFormMapping, (_state, componentTypeId) => componentTypeId],
3737
- (userForms, componentTypeId) => {
3738
- return Object.values(userForms).find((userForm) => userForm.component_type === componentTypeId);
3652
+ [(state) => state.userFormReducer.revisions, (_state, formId2) => formId2],
3653
+ (revisions, formId2) => {
3654
+ if (!formId2) {
3655
+ throw new Error("formId is required");
3656
+ }
3657
+ return _selectLatestFormRevision(revisions, formId2);
3739
3658
  }
3740
3659
  )
3741
3660
  );
3742
- const selectFormsCount = toolkit.createSelector([selectFormMapping], (userForms) => {
3743
- return Object.keys(userForms).length;
3744
- });
3745
- const selectGeneralFormCount = toolkit.createSelector([selectFormMapping], (userForms) => {
3746
- return Object.values(userForms).filter((form) => !form.component_type).length;
3747
- });
3748
- const formReducer = formSlice.reducer;
3749
- const initialState$3 = {
3750
- formSubmissions: {},
3751
- attachments: {}
3752
- };
3753
- const formSubmissionSlice = toolkit.createSlice({
3754
- name: "formSubmissions",
3755
- initialState: initialState$3,
3756
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
3757
- reducers: {
3758
- setFormSubmission: (state, action) => {
3759
- state.formSubmissions[action.payload.offline_id] = action.payload;
3760
- },
3761
- setFormSubmissions: (state, action) => {
3762
- state.formSubmissions = {};
3763
- for (const submission of action.payload) {
3764
- state.formSubmissions[submission.offline_id] = submission;
3765
- }
3766
- },
3767
- addFormSubmission: (state, action) => {
3768
- if (state.formSubmissions[action.payload.offline_id] !== void 0) {
3769
- throw new Error(`Submission with offline_id ${action.payload.offline_id} already exists`);
3770
- }
3771
- state.formSubmissions[action.payload.offline_id] = action.payload;
3772
- },
3773
- addFormSubmissions: (state, action) => {
3774
- for (const submission of action.payload) {
3775
- if (state.formSubmissions[submission.offline_id] !== void 0) {
3776
- throw new Error(`Submission with offline_id ${submission.offline_id} already exists`);
3777
- }
3778
- }
3779
- for (const submission of action.payload) {
3780
- state.formSubmissions[submission.offline_id] = submission;
3781
- }
3782
- },
3783
- updateFormSubmission: (state, action) => {
3784
- if (state.formSubmissions[action.payload.offline_id] === void 0) {
3785
- throw new Error(`Submission with offline_id ${action.payload.offline_id} does not exist`);
3786
- }
3787
- state.formSubmissions[action.payload.offline_id] = action.payload;
3788
- },
3789
- updateFormSubmissions: (state, action) => {
3790
- for (const submission of action.payload) {
3791
- if (state.formSubmissions[submission.offline_id] === void 0) {
3792
- throw new Error(`Submission with offline_id ${submission.offline_id} does not exist`);
3793
- }
3794
- }
3795
- for (const submission of action.payload) {
3796
- state.formSubmissions[submission.offline_id] = submission;
3797
- }
3798
- },
3799
- deleteFormSubmission: (state, action) => {
3800
- if (state.formSubmissions[action.payload] === void 0) {
3801
- throw new Error(`Submission with offline_id ${action.payload} does not exist`);
3802
- }
3803
- delete state.formSubmissions[action.payload];
3804
- },
3805
- deleteFormSubmissions: (state, action) => {
3806
- for (const offlineId of action.payload) {
3807
- if (state.formSubmissions[offlineId] === void 0) {
3808
- throw new Error(`Submission with offline_id ${offlineId} does not exist`);
3809
- }
3810
- delete state.formSubmissions[offlineId];
3811
- }
3812
- for (const offlineId of action.payload) {
3813
- delete state.formSubmissions[offlineId];
3814
- }
3815
- },
3816
- // Attachments
3817
- addFormSubmissionAttachment: (state, action) => {
3818
- if (state.attachments[action.payload.offline_id] !== void 0) {
3819
- throw new Error(`Attachment with offline_id ${action.payload.offline_id} already exists`);
3820
- }
3821
- state.attachments[action.payload.offline_id] = action.payload;
3822
- },
3823
- addFormSubmissionAttachments: (state, action) => {
3824
- for (const attachment of action.payload) {
3825
- if (state.attachments[attachment.offline_id] !== void 0) {
3826
- throw new Error(`Attachment with offline_id ${attachment.offline_id} already exists`);
3827
- }
3828
- }
3829
- for (const attachment of action.payload) {
3830
- state.attachments[attachment.offline_id] = attachment;
3831
- }
3832
- },
3833
- // We only need a multi set for attachments because they are not updated, only added and deleted
3834
- setFormSubmissionAttachments: (state, action) => {
3835
- state.attachments = {};
3836
- for (const attachment of action.payload) {
3837
- state.attachments[attachment.offline_id] = attachment;
3838
- }
3839
- },
3840
- updateFormSubmissionAttachments: (state, action) => {
3841
- for (const attachment of action.payload) {
3842
- if (state.attachments[attachment.offline_id] === void 0) {
3843
- throw new Error(`Attachment with offline_id ${attachment.offline_id} does not exist`);
3844
- }
3845
- }
3846
- for (const attachment of action.payload) {
3847
- state.attachments[attachment.offline_id] = attachment;
3848
- }
3849
- },
3850
- // The delete actions for UserFormSubmissionAttachments are not used in the app, but are included for completeness
3851
- // Could be used if editing a submission is ever supported, will be applicable for supporting tip tap content in submissions
3852
- deleteFormSubmissionAttachment: (state, action) => {
3853
- if (state.attachments[action.payload] === void 0) {
3854
- throw new Error(`Attachment with offline_id ${action.payload} does not exist`);
3855
- }
3856
- delete state.attachments[action.payload];
3857
- },
3858
- deleteFormSubmissionAttachments: (state, action) => {
3859
- for (const offlineId of action.payload) {
3860
- if (state.attachments[offlineId] === void 0) {
3861
- throw new Error(`Attachment with offline_id ${offlineId} does not exist`);
3862
- }
3863
- delete state.attachments[offlineId];
3864
- }
3865
- }
3866
- }
3867
- });
3868
- const {
3869
- setFormSubmission,
3870
- setFormSubmissions,
3871
- addFormSubmission,
3872
- addFormSubmissions,
3873
- updateFormSubmission,
3874
- updateFormSubmissions,
3875
- deleteFormSubmission,
3876
- deleteFormSubmissions,
3877
- addFormSubmissionAttachment,
3878
- addFormSubmissionAttachments,
3879
- setFormSubmissionAttachments,
3880
- updateFormSubmissionAttachments,
3881
- deleteFormSubmissionAttachment,
3882
- deleteFormSubmissionAttachments
3883
- } = formSubmissionSlice.actions;
3884
- const selectFormSubmissionsMapping = (state) => {
3885
- return state.formSubmissionReducer.formSubmissions;
3886
- };
3887
- const selectFormSubmissions = toolkit.createSelector(
3888
- [selectFormSubmissionsMapping],
3889
- (submissions) => {
3890
- return Object.values(submissions);
3891
- }
3661
+ const selectUserForm = (formId2) => (state) => {
3662
+ return state.userFormReducer.userForms[formId2];
3663
+ };
3664
+ const selectSubmissionMapping = (state) => state.userFormReducer.submissions;
3665
+ const selectUserFormSubmission = (submissionId) => (state) => {
3666
+ return state.userFormReducer.submissions[submissionId];
3667
+ };
3668
+ const selectSubmissions = toolkit.createSelector([selectSubmissionMapping], (submissions) => Object.values(submissions));
3669
+ const selectRevisionMapping = (state) => state.userFormReducer.revisions;
3670
+ const selectRevisions = toolkit.createSelector([selectRevisionMapping], (revisions) => Object.values(revisions));
3671
+ const selectRevisionsForForm = restructureCreateSelectorWithArgs(
3672
+ toolkit.createSelector([selectRevisions, (_state, formId2) => formId2], (revisions, formId2) => {
3673
+ return revisions.filter((revision) => {
3674
+ return revision.form === formId2;
3675
+ });
3676
+ })
3892
3677
  );
3893
- const selectFormSubmission = (submissionId) => (state) => {
3894
- return state.formSubmissionReducer.formSubmissions[submissionId];
3895
- };
3896
- const selectFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
3678
+ const selectSubmissionsForForm = restructureCreateSelectorWithArgs(
3897
3679
  toolkit.createSelector(
3898
- [selectFormSubmissions, selectFormRevisionMapping, (_state, formId2) => formId2],
3680
+ [selectSubmissions, selectRevisionMapping, (_state, formId2) => formId2],
3899
3681
  (submissions, revisionMapping, formId2) => {
3900
- return submissions.filter((submission) => {
3682
+ return Object.values(submissions).filter((submission) => {
3901
3683
  const revision = revisionMapping[submission.form_revision];
3902
3684
  return (revision == null ? void 0 : revision.form) === formId2;
3903
3685
  });
3904
3686
  }
3905
3687
  )
3906
3688
  );
3907
- const selectFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
3689
+ const selectSubmissionsForIssue = restructureCreateSelectorWithArgs(
3908
3690
  toolkit.createSelector(
3909
- [selectFormSubmissions, (_state, issueId) => issueId],
3691
+ [(state) => state.userFormReducer.submissions, (_state, issueId) => issueId],
3910
3692
  (submissions, issueId) => {
3911
3693
  return Object.values(submissions).filter((submission) => {
3912
3694
  return submission.issue === issueId;
@@ -3914,9 +3696,9 @@ var __publicField = (obj, key, value) => {
3914
3696
  }
3915
3697
  )
3916
3698
  );
3917
- const selectFormSubmissionsOfComponent = restructureCreateSelectorWithArgs(
3699
+ const selectSubmissionsForComponent = restructureCreateSelectorWithArgs(
3918
3700
  toolkit.createSelector(
3919
- [selectFormSubmissions, (_state, componentId) => componentId],
3701
+ [selectSubmissions, (_state, componentId) => componentId],
3920
3702
  (submissions, componentId) => {
3921
3703
  return submissions.filter((submission) => {
3922
3704
  return submission.component === componentId;
@@ -3924,8 +3706,8 @@ var __publicField = (obj, key, value) => {
3924
3706
  }
3925
3707
  )
3926
3708
  );
3927
- const selectFormSubmissionsByComponents = toolkit.createSelector(
3928
- [selectFormSubmissionsMapping, selectComponentsMapping],
3709
+ const selectComponentSubmissionMapping = toolkit.createSelector(
3710
+ [selectSubmissionMapping, selectComponentsMapping],
3929
3711
  (submissions, components) => {
3930
3712
  var _a2;
3931
3713
  const componentSubmissionMapping = {};
@@ -3941,18 +3723,54 @@ var __publicField = (obj, key, value) => {
3941
3723
  return componentSubmissionMapping;
3942
3724
  }
3943
3725
  );
3944
- const selectFormSubmissionAttachmentsMapping = (state) => {
3945
- return state.formSubmissionReducer.attachments;
3726
+ const selectUserFormMapping = (state) => {
3727
+ return state.userFormReducer.userForms;
3946
3728
  };
3947
- const selectAttachmentsOfFormSubmission = restructureCreateSelectorWithArgs(
3729
+ const selectComponentTypeForm = restructureCreateSelectorWithArgs(
3948
3730
  toolkit.createSelector(
3949
- [selectFormSubmissionAttachmentsMapping, (_state, submissionId) => submissionId],
3950
- (attachmentsMapping, submissionId) => {
3951
- return Object.values(attachmentsMapping).filter((attachment) => attachment.submission === submissionId);
3731
+ [selectUserFormMapping, (_state, componentTypeId) => componentTypeId],
3732
+ (userForms, componentTypeId) => {
3733
+ return Object.values(userForms).find((userForm) => userForm.component_type === componentTypeId);
3734
+ }
3735
+ )
3736
+ );
3737
+ const selectLatestRevisionsFromComponentTypeIds = restructureCreateSelectorWithArgs(
3738
+ toolkit.createSelector(
3739
+ [
3740
+ selectUserFormMapping,
3741
+ selectRevisionMapping,
3742
+ (_state, componentTypeIds) => componentTypeIds
3743
+ ],
3744
+ (userForms, revisions, componentTypeIds) => {
3745
+ const componentTypeIdsSet = new Set(componentTypeIds);
3746
+ const ret = {};
3747
+ for (const form of Object.values(userForms)) {
3748
+ if (form.component_type && componentTypeIdsSet.has(form.component_type)) {
3749
+ ret[form.component_type] = _selectLatestFormRevision(revisions, form.offline_id);
3750
+ }
3751
+ }
3752
+ return ret;
3952
3753
  }
3953
3754
  )
3954
3755
  );
3955
- const formSubmissionReducer = formSubmissionSlice.reducer;
3756
+ const selectLatestRevisionByFormId = toolkit.createSelector([selectRevisionMapping], (revisions) => {
3757
+ const latestRevisions = {};
3758
+ for (const revision of Object.values(revisions)) {
3759
+ const formId2 = revision.form;
3760
+ const currentLatestRevision = latestRevisions[formId2];
3761
+ if (!currentLatestRevision || currentLatestRevision.revision < revision.revision) {
3762
+ latestRevisions[formId2] = revision;
3763
+ }
3764
+ }
3765
+ return latestRevisions;
3766
+ });
3767
+ const selectNumberOfUserForms = toolkit.createSelector([selectUserFormMapping], (userForms) => {
3768
+ return Object.keys(userForms).length;
3769
+ });
3770
+ const selectNumberOfGeneralUserForms = toolkit.createSelector([selectUserFormMapping], (userForms) => {
3771
+ return Object.values(userForms).filter((form) => !form.component_type).length;
3772
+ });
3773
+ const userFormReducer = userFormSlice.reducer;
3956
3774
  const initialState$2 = {
3957
3775
  emailDomains: {}
3958
3776
  };
@@ -4250,9 +4068,7 @@ var __publicField = (obj, key, value) => {
4250
4068
  projectFileReducer,
4251
4069
  rehydratedReducer,
4252
4070
  settingReducer,
4253
- formReducer,
4254
- formRevisionReducer,
4255
- formSubmissionReducer,
4071
+ userFormReducer,
4256
4072
  userReducer,
4257
4073
  workspaceReducer,
4258
4074
  emailDomainsReducer,
@@ -4305,7 +4121,9 @@ var __publicField = (obj, key, value) => {
4305
4121
  throw new Error(`Failed to update index_workspace of issue ${issue.offline_id} to main workspace`);
4306
4122
  }
4307
4123
  }
4308
- const indexedForms = Object.values(draft.formReducer.forms).filter((form) => form.index_workspace === workspaceId);
4124
+ const indexedForms = Object.values(draft.userFormReducer.userForms).filter(
4125
+ (form) => form.index_workspace === workspaceId
4126
+ );
4309
4127
  for (const form of indexedForms) {
4310
4128
  form.index_workspace = mainWorkspace.offline_id;
4311
4129
  }
@@ -6942,7 +6760,7 @@ var __publicField = (obj, key, value) => {
6942
6760
  ...revisionAttachmentPayload,
6943
6761
  file: URL.createObjectURL(image)
6944
6762
  };
6945
- store.dispatch(addFormRevisionAttachment(offlinePayload));
6763
+ store.dispatch(addUserFormRevisionAttachment(offlinePayload));
6946
6764
  return attach;
6947
6765
  });
6948
6766
  });
@@ -6976,8 +6794,8 @@ var __publicField = (obj, key, value) => {
6976
6794
  revision: 0
6977
6795
  };
6978
6796
  const { store } = this.client;
6979
- store.dispatch(addForm(retForm));
6980
- store.dispatch(addFormRevision(retRevision));
6797
+ store.dispatch(addUserForm(retForm));
6798
+ store.dispatch(addUserFormRevision(retRevision));
6981
6799
  const formPromise = this.enqueueRequest({
6982
6800
  description: "Create form",
6983
6801
  method: HttpMethod.POST,
@@ -6995,8 +6813,8 @@ var __publicField = (obj, key, value) => {
6995
6813
  });
6996
6814
  const attachImagesPromises = this.getAttachImagePromises(images, offlineRevisionPayload.offline_id);
6997
6815
  void formPromise.catch((e) => {
6998
- store.dispatch(deleteForm(retForm.offline_id));
6999
- store.dispatch(deleteFormRevision(retRevision.offline_id));
6816
+ store.dispatch(deleteUserForm(retForm.offline_id));
6817
+ store.dispatch(deleteUserFormRevision(retRevision.offline_id));
7000
6818
  throw e;
7001
6819
  });
7002
6820
  const settledPromise = Promise.all([formPromise, ...attachImagesPromises]).then(() => formPromise);
@@ -7038,7 +6856,7 @@ var __publicField = (obj, key, value) => {
7038
6856
  revision: "Pending",
7039
6857
  form: formId2
7040
6858
  };
7041
- store.dispatch(addFormRevision(fullRevision));
6859
+ store.dispatch(addUserFormRevision(fullRevision));
7042
6860
  const promise = this.enqueueRequest({
7043
6861
  description: "Create form revision",
7044
6862
  method: HttpMethod.PATCH,
@@ -7052,9 +6870,9 @@ var __publicField = (obj, key, value) => {
7052
6870
  });
7053
6871
  const attachImagesPromises = this.getAttachImagePromises(images, offlineRevision.offline_id);
7054
6872
  void promise.then((result) => {
7055
- store.dispatch(setFormRevision(result));
6873
+ store.dispatch(addUserFormRevision(result));
7056
6874
  }).catch(() => {
7057
- store.dispatch(deleteFormRevision(fullRevision.offline_id));
6875
+ store.dispatch(deleteUserFormRevision(fullRevision.offline_id));
7058
6876
  });
7059
6877
  const settledPromise = Promise.all([promise, ...attachImagesPromises]).then(() => promise);
7060
6878
  return [fullRevision, settledPromise];
@@ -7096,19 +6914,19 @@ var __publicField = (obj, key, value) => {
7096
6914
  async delete(formId2) {
7097
6915
  const { store } = this.client;
7098
6916
  const state = store.getState();
7099
- const userForm = selectForm(formId2)(state);
6917
+ const userForm = selectUserForm(formId2)(state);
7100
6918
  if (!userForm) {
7101
6919
  throw new Error("Expected userForm to exist");
7102
6920
  }
7103
- const userFormSubmissions = selectFormSubmissionsOfForm(formId2)(state);
6921
+ const userFormSubmissions = selectSubmissionsForForm(formId2)(state);
7104
6922
  if (userFormSubmissions && userFormSubmissions.length > 0) {
7105
- store.dispatch(deleteFormSubmissions(userFormSubmissions.map(({ offline_id }) => offline_id)));
6923
+ store.dispatch(deleteUserFormSubmissions(userFormSubmissions));
7106
6924
  }
7107
- const userFormRevisions = selectFormRevisionsOfForm(formId2)(state);
6925
+ const userFormRevisions = selectRevisionsForForm(formId2)(state);
7108
6926
  if (userFormRevisions && userFormRevisions.length > 0) {
7109
- store.dispatch(deleteFormRevisions(userFormRevisions.map(({ offline_id }) => offline_id)));
6927
+ store.dispatch(deleteUserFormRevisions(userFormRevisions));
7110
6928
  }
7111
- store.dispatch(deleteForm(formId2));
6929
+ store.dispatch(deleteUserForm(formId2));
7112
6930
  try {
7113
6931
  return await this.enqueueRequest({
7114
6932
  description: "Delete form",
@@ -7118,12 +6936,12 @@ var __publicField = (obj, key, value) => {
7118
6936
  blocks: []
7119
6937
  });
7120
6938
  } catch (e) {
7121
- store.dispatch(addForm(userForm));
6939
+ store.dispatch(addUserForm(userForm));
7122
6940
  if (userFormRevisions && userFormRevisions.length > 0) {
7123
- store.dispatch(addFormRevisions(userFormRevisions));
6941
+ store.dispatch(addUserFormRevisions(userFormRevisions));
7124
6942
  }
7125
6943
  if (userFormSubmissions && userFormSubmissions.length > 0) {
7126
- store.dispatch(addFormSubmissions(userFormSubmissions));
6944
+ store.dispatch(addUserFormSubmissions(userFormSubmissions));
7127
6945
  }
7128
6946
  throw e;
7129
6947
  }
@@ -7137,15 +6955,16 @@ var __publicField = (obj, key, value) => {
7137
6955
  blockers: [],
7138
6956
  blocks: []
7139
6957
  });
7140
- store.dispatch(setForms(Object.values(result.forms)));
7141
- store.dispatch(setFormRevisions(Object.values(result.revisions)));
7142
- store.dispatch(setFormRevisionAttachments(Object.values(result.attachments)));
6958
+ store.dispatch(addUserForms(Object.values(result.forms)));
6959
+ store.dispatch(addUserFormRevisions(Object.values(result.revisions)));
6960
+ store.dispatch(setUserFormRevisionAttachments(Object.values(result.attachments)));
7143
6961
  }
7144
6962
  }
7145
6963
  const isArrayOfFiles = (value) => {
7146
6964
  return Array.isArray(value) && value[0] instanceof File;
7147
6965
  };
7148
- const separateFilesFromValues = (values) => {
6966
+ const separateFilesFromValues = (payload) => {
6967
+ const { values } = payload;
7149
6968
  const files = {};
7150
6969
  const newValues = {};
7151
6970
  for (const key in values) {
@@ -7160,13 +6979,17 @@ var __publicField = (obj, key, value) => {
7160
6979
  newValues[key] = value;
7161
6980
  }
7162
6981
  }
7163
- return { values: newValues, files };
6982
+ const payloadWithoutFiles = {
6983
+ ...payload,
6984
+ values: newValues
6985
+ };
6986
+ return { payloadWithoutFiles, files };
7164
6987
  };
7165
6988
  class UserFormSubmissionService extends BaseApiService {
7166
6989
  constructor() {
7167
6990
  super(...arguments);
7168
6991
  // Attach files to submission, after uploading them to S3
7169
- __publicField(this, "getAttachFilesPromises", (files, submission) => {
6992
+ __publicField(this, "getAttachFilesPromises", (files, payload) => {
7170
6993
  const { store } = this.client;
7171
6994
  return Object.entries(files).map(async ([key, fileArray]) => {
7172
6995
  const attachResults = [];
@@ -7176,27 +6999,24 @@ var __publicField = (obj, key, value) => {
7176
6999
  const [fileProps] = await this.client.files.uploadFileToS3(sha1);
7177
7000
  const submissionAttachmentPayload = offline({
7178
7001
  ...fileProps,
7179
- submission: submission.offline_id,
7002
+ submission: payload.offline_id,
7180
7003
  field_identifier: key
7181
7004
  });
7182
7005
  const attach = await this.enqueueRequest({
7183
7006
  description: "Attach file to form submission",
7184
7007
  method: HttpMethod.POST,
7185
- url: `/forms/submission/${submission.offline_id}/attachments/`,
7008
+ url: `/forms/submission/${payload.offline_id}/attachments/`,
7186
7009
  payload: submissionAttachmentPayload,
7187
- blockers: [
7188
- submission.component,
7189
- submission.component_stage,
7190
- submission.issue,
7191
- submission.form_revision
7192
- ].filter((x) => x !== void 0),
7010
+ blockers: [payload.component, payload.component_stage, payload.issue, payload.form_revision].filter(
7011
+ (x) => x !== void 0
7012
+ ),
7193
7013
  blocks: [submissionAttachmentPayload.offline_id]
7194
7014
  });
7195
7015
  const offlinePayload = {
7196
7016
  ...submissionAttachmentPayload,
7197
7017
  file: URL.createObjectURL(file)
7198
7018
  };
7199
- store.dispatch(addFormSubmissionAttachment(offlinePayload));
7019
+ store.dispatch(addUserFormSubmissionAttachment(offlinePayload));
7200
7020
  attachResults.push(attach);
7201
7021
  }
7202
7022
  return attachResults;
@@ -7210,165 +7030,70 @@ var __publicField = (obj, key, value) => {
7210
7030
  if (!activeProjectId) {
7211
7031
  throw new Error("Expected an active project");
7212
7032
  }
7213
- const { values, files } = separateFilesFromValues(payload.values);
7214
- const offlineSubmission = {
7215
- ...payload,
7216
- values,
7217
- created_by: state.userReducer.currentUser.id,
7218
- submitted_at: (/* @__PURE__ */ new Date()).toISOString()
7219
- };
7033
+ const { payloadWithoutFiles, files } = separateFilesFromValues(payload);
7220
7034
  const promise = this.enqueueRequest({
7221
7035
  description: "Respond to form",
7222
7036
  method: HttpMethod.POST,
7223
7037
  url: `/forms/revisions/${payload.form_revision}/respond/`,
7224
- payload: { ...offlineSubmission, project: activeProjectId },
7038
+ payload: { ...payloadWithoutFiles, project: activeProjectId },
7225
7039
  blockers: [payload.issue, payload.component, payload.component_stage, "add-form-entry"].filter(
7226
7040
  (x) => x !== void 0
7227
7041
  ),
7228
7042
  blocks: [payload.offline_id]
7229
7043
  });
7230
- const attachFilesPromises = this.getAttachFilesPromises(files, offlineSubmission);
7231
- store.dispatch(addFormSubmission(offlineSubmission));
7044
+ const attachFilesPromises = this.getAttachFilesPromises(files, payload);
7045
+ const now = (/* @__PURE__ */ new Date()).toISOString();
7046
+ const fullOfflineResult = {
7047
+ ...payload,
7048
+ created_by: state.userReducer.currentUser.id,
7049
+ created_at: now,
7050
+ updated_at: now
7051
+ };
7052
+ const offlineResultWithoutFiles = {
7053
+ ...fullOfflineResult,
7054
+ ...payloadWithoutFiles
7055
+ };
7056
+ store.dispatch(updateOrCreateUserFormSubmission(offlineResultWithoutFiles));
7232
7057
  void promise.then((result) => {
7233
7058
  store.dispatch(addActiveProjectFormSubmissionsCount(1));
7234
- store.dispatch(setFormSubmission(result));
7059
+ store.dispatch(updateOrCreateUserFormSubmission(result));
7235
7060
  return result;
7236
7061
  }).catch(() => {
7237
- store.dispatch(deleteFormSubmission(payload.offline_id));
7062
+ store.dispatch(deleteUserFormSubmission(payload.offline_id));
7238
7063
  store.dispatch(addActiveProjectFormSubmissionsCount(-1));
7239
7064
  });
7240
7065
  const settledPromise = Promise.all([promise, ...attachFilesPromises]).then(() => promise);
7241
- return [offlineSubmission, settledPromise];
7242
- }
7243
- // Note currently the bulkAdd method is specific to form submissions for components
7244
- // TODO: adapt the support bulk adding to any model type
7245
- async bulkAdd(args) {
7246
- const { form_revision, values: argsValues, componentOfflineIds } = args;
7247
- const { store } = this.client;
7248
- const offlineSubmissions = [];
7249
- const offlineAttachments = [];
7250
- const submissionOfflineIds = [];
7251
- const submissionsPayload = [];
7252
- const attachmentsPayload = [];
7253
- const { values, files } = separateFilesFromValues(argsValues);
7254
- const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7255
- const createdBy = store.getState().userReducer.currentUser.id;
7256
- for (const component_id of componentOfflineIds) {
7257
- const submission = offline({
7258
- form_revision,
7259
- values,
7260
- created_by: createdBy,
7261
- submitted_at: submittedAt,
7262
- component: component_id
7263
- });
7264
- submissionOfflineIds.push(submission.offline_id);
7265
- submissionsPayload.push({ offline_id: submission.offline_id, component_id });
7266
- offlineSubmissions.push(submission);
7267
- for (const [fieldIdentifier, fileArray] of Object.entries(files)) {
7268
- for (const file of fileArray) {
7269
- const sha1 = await hashFile(file);
7270
- await this.client.files.addCache(file, sha1);
7271
- const offlineAttachment = offline({
7272
- file_name: file.name,
7273
- file_sha1: sha1,
7274
- file: URL.createObjectURL(file),
7275
- submission: submission.offline_id,
7276
- field_identifier: fieldIdentifier
7277
- });
7278
- offlineAttachments.push(offlineAttachment);
7279
- attachmentsPayload.push({
7280
- offline_id: offlineAttachment.offline_id,
7281
- submission_id: submission.offline_id,
7282
- sha1,
7283
- name: file.name,
7284
- field_identifier: fieldIdentifier
7285
- });
7286
- }
7287
- }
7288
- }
7289
- const filesRecord = {};
7290
- for (const file of Object.values(files).flat()) {
7291
- const sha1 = await hashFile(file);
7292
- filesRecord[sha1] = {
7293
- sha1,
7294
- extension: file.name.split(".").pop() || "",
7295
- file_type: file.type,
7296
- size: file.size
7297
- };
7298
- }
7299
- store.dispatch(addFormSubmissions(offlineSubmissions));
7300
- store.dispatch(addFormSubmissionAttachments(offlineAttachments));
7301
- const promise = this.enqueueRequest({
7302
- description: "Bulk add form submissions",
7303
- method: HttpMethod.POST,
7304
- url: `/forms/revisions/${form_revision}/bulk-respond/`,
7305
- payload: {
7306
- form_data: values,
7307
- submitted_at: submittedAt,
7308
- submissions: submissionsPayload,
7309
- attachments: attachmentsPayload,
7310
- files: Object.values(filesRecord)
7311
- },
7312
- blockers: componentOfflineIds,
7313
- blocks: submissionOfflineIds
7314
- });
7315
- promise.then(({ submissions, attachments, presigned_urls }) => {
7316
- store.dispatch(updateFormSubmissions(submissions));
7317
- store.dispatch(updateFormSubmissionAttachments(attachments));
7318
- for (const [sha1, presigned_url] of Object.entries(presigned_urls)) {
7319
- const file = filesRecord[sha1];
7320
- if (!file)
7321
- continue;
7322
- void this.enqueueRequest({
7323
- url: presigned_url.url,
7324
- description: "Upload file",
7325
- method: HttpMethod.POST,
7326
- isExternalUrl: true,
7327
- isAuthNeeded: false,
7328
- attachmentHash: sha1,
7329
- blockers: [`s3-${file.sha1}.${file.extension}`],
7330
- blocks: [sha1],
7331
- s3url: presigned_url
7332
- });
7333
- }
7334
- }).catch(() => {
7335
- store.dispatch(deleteFormSubmissions(submissionOfflineIds));
7336
- store.dispatch(deleteFormSubmissionAttachments(offlineAttachments.map((x) => x.offline_id)));
7337
- });
7338
- return [offlineSubmissions, promise.then(({ submissions }) => submissions)];
7066
+ return [fullOfflineResult, settledPromise];
7339
7067
  }
7340
7068
  update(submission) {
7341
7069
  const { store } = this.client;
7342
- const { values, files } = separateFilesFromValues(submission.values);
7070
+ const { payloadWithoutFiles, files } = separateFilesFromValues(submission);
7071
+ if (!("created_by" in payloadWithoutFiles) || !("created_at" in payloadWithoutFiles)) {
7072
+ throw new Error("Expected payloadWithoutFiles to have created_by and created_at fields.");
7073
+ }
7343
7074
  const attachFilesPromises = this.getAttachFilesPromises(files, submission);
7344
- const offlineSubmission = {
7345
- ...submission,
7346
- values
7075
+ const fullResult = {
7076
+ ...payloadWithoutFiles,
7077
+ updated_at: (/* @__PURE__ */ new Date()).toISOString()
7347
7078
  };
7348
- const submissionToBeUpdated = store.getState().formSubmissionReducer.formSubmissions[submission.offline_id];
7349
- store.dispatch(updateFormSubmission(offlineSubmission));
7079
+ store.dispatch(updateOrCreateUserFormSubmission(fullResult));
7350
7080
  const promise = this.enqueueRequest({
7351
7081
  description: "Patch form submission",
7352
7082
  method: HttpMethod.PATCH,
7353
7083
  url: `/forms/submissions/${submission.offline_id}/`,
7354
- payload: offlineSubmission,
7355
- blockers: [offlineSubmission.issue, offlineSubmission.component, offlineSubmission.component_stage].filter(
7084
+ payload: fullResult,
7085
+ blockers: [fullResult.issue, fullResult.component, fullResult.component_stage].filter(
7356
7086
  (x) => x !== void 0
7357
7087
  ),
7358
- blocks: [offlineSubmission.offline_id]
7088
+ blocks: [fullResult.offline_id]
7359
7089
  });
7360
- promise.then((createdSubmission) => {
7361
- store.dispatch(setFormSubmission(createdSubmission));
7362
- }).catch(() => {
7363
- store.dispatch(setFormSubmission(submissionToBeUpdated));
7364
- });
7365
- return [offlineSubmission, Promise.all([promise, ...attachFilesPromises]).then(() => promise)];
7090
+ return Promise.all([promise, ...attachFilesPromises]).then(() => promise);
7366
7091
  }
7367
7092
  async delete(submissionId) {
7368
7093
  const { store } = this.client;
7369
7094
  const state = store.getState();
7370
- const submission = state.formSubmissionReducer.formSubmissions[submissionId];
7371
- store.dispatch(deleteFormSubmission(submissionId));
7095
+ const submission = state.userFormReducer.submissions[submissionId];
7096
+ store.dispatch(deleteUserFormSubmission(submissionId));
7372
7097
  store.dispatch(addActiveProjectFormSubmissionsCount(-1));
7373
7098
  try {
7374
7099
  return await this.enqueueRequest({
@@ -7379,8 +7104,10 @@ var __publicField = (obj, key, value) => {
7379
7104
  blocks: []
7380
7105
  });
7381
7106
  } catch (e) {
7382
- store.dispatch(addActiveProjectFormSubmissionsCount(1));
7383
- store.dispatch(addFormSubmission(submission));
7107
+ if (submission) {
7108
+ store.dispatch(addActiveProjectFormSubmissionsCount(1));
7109
+ store.dispatch(updateOrCreateUserFormSubmission(submission));
7110
+ }
7384
7111
  throw e;
7385
7112
  }
7386
7113
  }
@@ -7394,7 +7121,7 @@ var __publicField = (obj, key, value) => {
7394
7121
  blockers: [],
7395
7122
  blocks: []
7396
7123
  });
7397
- store.dispatch(setFormSubmissions(submissions));
7124
+ store.dispatch(setUserFormSubmissions(submissions));
7398
7125
  const attachments = await this.enqueueRequest({
7399
7126
  description: "Fetch form attachments",
7400
7127
  method: HttpMethod.GET,
@@ -7402,7 +7129,7 @@ var __publicField = (obj, key, value) => {
7402
7129
  blockers: [],
7403
7130
  blocks: []
7404
7131
  });
7405
- store.dispatch(setFormSubmissionAttachments(attachments));
7132
+ store.dispatch(setUserFormSubmissionAttachments(attachments));
7406
7133
  }
7407
7134
  }
7408
7135
  class WorkspaceService extends BaseApiService {
@@ -14261,7 +13988,7 @@ var __publicField = (obj, key, value) => {
14261
13988
  };
14262
13989
  const useAttachImagesToFormRevisionFields = (revision) => {
14263
13990
  const { sdk } = useSDK();
14264
- const attachments = useAppSelector(selectAttachmentsOfFormRevision((revision == null ? void 0 : revision.offline_id) ?? ""));
13991
+ const attachments = useAppSelector(selectRevisionAttachments((revision == null ? void 0 : revision.offline_id) ?? ""));
14265
13992
  return React.useMemo(() => {
14266
13993
  if (!revision || !attachments)
14267
13994
  return revision;
@@ -14358,7 +14085,7 @@ var __publicField = (obj, key, value) => {
14358
14085
  return formRevisionToSchema(revisionWithImages, { readonly: true });
14359
14086
  }, [revisionWithImages]);
14360
14087
  const submissionValuesWithAttachments = React.useMemo(() => {
14361
- const attachments = selectAttachmentsOfFormSubmission(submission.offline_id)(sdk.store.getState()) ?? [];
14088
+ const attachments = selectSubmissionAttachments(submission.offline_id)(sdk.store.getState()) ?? [];
14362
14089
  const downloadedAttachments = {};
14363
14090
  for (const attachment of attachments) {
14364
14091
  const promise = sdk.files.fetchFileFromUrl(attachment.file, attachment.file_sha1, attachment.file_name);
@@ -14408,8 +14135,8 @@ var __publicField = (obj, key, value) => {
14408
14135
  }
14409
14136
  return ret;
14410
14137
  }, [filter, maxResults, ownerFilter]);
14411
- const userForms = useAppSelector(selectFilteredForms(ownerFilterOptions)) ?? [];
14412
- const userFormMapping = useAppSelector(selectFormMapping);
14138
+ const userForms = useAppSelector(selectFilteredUserForms(ownerFilterOptions)) ?? [];
14139
+ const userFormMapping = useAppSelector(selectUserFormMapping);
14413
14140
  const attachableUserForms = userForms.filter((form) => !form.component_type);
14414
14141
  const attachableUserFormMapping = Object.values(userFormMapping).filter(
14415
14142
  (form) => !form.component_type
@@ -14442,7 +14169,7 @@ var __publicField = (obj, key, value) => {
14442
14169
  const handleChange = React.useCallback((e) => {
14443
14170
  setFilter(e.currentTarget.value);
14444
14171
  }, []);
14445
- const numberOfForms = useAppSelector(selectGeneralFormCount) || 0;
14172
+ const numberOfForms = useAppSelector(selectNumberOfGeneralUserForms) || 0;
14446
14173
  const numberOfHiddenForms = numberOfForms - attachableUserForms.length;
14447
14174
  const overflowMessage = attachableUserForms.length == maxResults && numberOfHiddenForms > 0 ? `Only the first ${maxResults} results are shown (${numberOfHiddenForms} hidden)` : numberOfHiddenForms > 0 && `${numberOfHiddenForms} hidden forms`;
14448
14175
  return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { ref, direction: "column", gap: "2", children: [
@@ -14536,13 +14263,16 @@ var __publicField = (obj, key, value) => {
14536
14263
  const { submission, onSubmissionClick, compact, labelType, rowDecorator } = props;
14537
14264
  const currentUser = useAppSelector(selectCurrentUser);
14538
14265
  const createdBy = useAppSelector(selectUser("created_by" in submission ? submission.created_by : currentUser.id));
14539
- const dateToUse = submission.submitted_at;
14540
- const formattedDateTime = getLocalDateString(dateToUse);
14266
+ const dateToUse = getCreatedAtOrSubmittedAtDate(submission);
14267
+ const formattedDateTime = isToday(dateToUse) ? dateToUse.toLocaleTimeString([], {
14268
+ hour: "2-digit",
14269
+ minute: "2-digit"
14270
+ }) : getLocalDateString(dateToUse);
14541
14271
  const revision = useAppSelector(selectFormRevision(submission.form_revision));
14542
14272
  if (!revision) {
14543
14273
  throw new Error(`Could not find revision ${submission.form_revision} for submission ${submission.offline_id}.`);
14544
14274
  }
14545
- const latestRevisionNumber = (_a2 = useAppSelector(selectLatestFormRevisionOfForm(revision.form))) == null ? void 0 : _a2.revision;
14275
+ const latestRevisionNumber = (_a2 = useAppSelector(selectLatestFormRevision(revision.form))) == null ? void 0 : _a2.revision;
14546
14276
  const creatorProfileSrc = useFileSrc({
14547
14277
  file: (createdBy == null ? void 0 : createdBy.profile.file) ?? null,
14548
14278
  fileSha1: (createdBy == null ? void 0 : createdBy.profile.file_sha1) ?? null
@@ -14573,6 +14303,10 @@ var __publicField = (obj, key, value) => {
14573
14303
  return row;
14574
14304
  });
14575
14305
  FormSubmissionBrowserEntry.displayName = "FormSubmissionBrowserEntry";
14306
+ const getCreatedAtOrSubmittedAtDate = (submission) => {
14307
+ const date = "created_at" in submission ? submission.created_at : submission.submitted_at;
14308
+ return new Date(date);
14309
+ };
14576
14310
  const FormSubmissionBrowser = React.memo((props) => {
14577
14311
  const {
14578
14312
  formId: formId2,
@@ -14586,10 +14320,10 @@ var __publicField = (obj, key, value) => {
14586
14320
  if (!!formId2 === !!propSubmissions) {
14587
14321
  throw new Error("Either formId or submissions must be provided, but not both.");
14588
14322
  }
14589
- const submissions = useAppSelector(propSubmissions ? () => propSubmissions : selectFormSubmissionsOfForm(formId2));
14323
+ const submissions = useAppSelector(propSubmissions ? () => propSubmissions : selectSubmissionsForForm(formId2));
14590
14324
  const sortedSubmissions = React.useMemo(
14591
14325
  () => submissions == null ? void 0 : submissions.sort((a, b) => {
14592
- return a.submitted_at.localeCompare(b.submitted_at);
14326
+ return getCreatedAtOrSubmittedAtDate(b).getTime() - getCreatedAtOrSubmittedAtDate(a).getTime();
14593
14327
  }),
14594
14328
  [submissions]
14595
14329
  );
@@ -15906,7 +15640,6 @@ var __publicField = (obj, key, value) => {
15906
15640
  exports2.VerificationCodeType = VerificationCodeType;
15907
15641
  exports2.WorkspaceService = WorkspaceService;
15908
15642
  exports2.YELLOW = YELLOW;
15909
- exports2._selectLatestFormRevision = _selectLatestFormRevision;
15910
15643
  exports2._setLatestRetryTime = _setLatestRetryTime;
15911
15644
  exports2.acceptProjectInvite = acceptProjectInvite;
15912
15645
  exports2.addActiveProjectFormSubmissionsCount = addActiveProjectFormSubmissionsCount;
@@ -15924,16 +15657,6 @@ var __publicField = (obj, key, value) => {
15924
15657
  exports2.addDocuments = addDocuments;
15925
15658
  exports2.addEmailDomain = addEmailDomain;
15926
15659
  exports2.addFavouriteProjectId = addFavouriteProjectId;
15927
- exports2.addForm = addForm;
15928
- exports2.addFormRevision = addFormRevision;
15929
- exports2.addFormRevisionAttachment = addFormRevisionAttachment;
15930
- exports2.addFormRevisionAttachments = addFormRevisionAttachments;
15931
- exports2.addFormRevisions = addFormRevisions;
15932
- exports2.addFormSubmission = addFormSubmission;
15933
- exports2.addFormSubmissionAttachment = addFormSubmissionAttachment;
15934
- exports2.addFormSubmissionAttachments = addFormSubmissionAttachments;
15935
- exports2.addFormSubmissions = addFormSubmissions;
15936
- exports2.addForms = addForms;
15937
15660
  exports2.addIssue = addIssue;
15938
15661
  exports2.addIssueAttachment = addIssueAttachment;
15939
15662
  exports2.addIssueAttachments = addIssueAttachments;
@@ -15954,6 +15677,13 @@ var __publicField = (obj, key, value) => {
15954
15677
  exports2.addStageCompletions = addStageCompletions;
15955
15678
  exports2.addStages = addStages;
15956
15679
  exports2.addToRecentIssues = addToRecentIssues;
15680
+ exports2.addUserForm = addUserForm;
15681
+ exports2.addUserFormRevision = addUserFormRevision;
15682
+ exports2.addUserFormRevisionAttachment = addUserFormRevisionAttachment;
15683
+ exports2.addUserFormRevisions = addUserFormRevisions;
15684
+ exports2.addUserFormSubmissionAttachment = addUserFormSubmissionAttachment;
15685
+ exports2.addUserFormSubmissions = addUserFormSubmissions;
15686
+ exports2.addUserForms = addUserForms;
15957
15687
  exports2.addUsers = addUsers;
15958
15688
  exports2.addWorkspace = addWorkspace;
15959
15689
  exports2.areArraysEqual = areArraysEqual;
@@ -15974,7 +15704,6 @@ var __publicField = (obj, key, value) => {
15974
15704
  exports2.componentStageSlice = componentStageSlice;
15975
15705
  exports2.componentTypeReducer = componentTypeReducer;
15976
15706
  exports2.componentTypeSlice = componentTypeSlice;
15977
- exports2.constructUploadedFilePayloads = constructUploadedFilePayloads;
15978
15707
  exports2.coordinatesAreEqual = coordinatesAreEqual;
15979
15708
  exports2.coordinatesToLiteral = coordinatesToLiteral;
15980
15709
  exports2.coordinatesToPointGeometry = coordinatesToPointGeometry;
@@ -15985,16 +15714,12 @@ var __publicField = (obj, key, value) => {
15985
15714
  exports2.defaultBadgeColor = defaultBadgeColor;
15986
15715
  exports2.defaultStore = defaultStore;
15987
15716
  exports2.deleteComponentType = deleteComponentType;
15988
- exports2.deleteForm = deleteForm;
15989
- exports2.deleteFormRevision = deleteFormRevision;
15990
- exports2.deleteFormRevisionAttachment = deleteFormRevisionAttachment;
15991
- exports2.deleteFormRevisionAttachments = deleteFormRevisionAttachments;
15992
- exports2.deleteFormRevisions = deleteFormRevisions;
15993
- exports2.deleteFormSubmission = deleteFormSubmission;
15994
- exports2.deleteFormSubmissionAttachment = deleteFormSubmissionAttachment;
15995
- exports2.deleteFormSubmissionAttachments = deleteFormSubmissionAttachments;
15996
- exports2.deleteFormSubmissions = deleteFormSubmissions;
15997
15717
  exports2.deleteProject = deleteProject;
15718
+ exports2.deleteUserForm = deleteUserForm;
15719
+ exports2.deleteUserFormRevision = deleteUserFormRevision;
15720
+ exports2.deleteUserFormRevisions = deleteUserFormRevisions;
15721
+ exports2.deleteUserFormSubmission = deleteUserFormSubmission;
15722
+ exports2.deleteUserFormSubmissions = deleteUserFormSubmissions;
15998
15723
  exports2.dequeue = dequeue;
15999
15724
  exports2.deserialize = deserialize;
16000
15725
  exports2.deserializeField = deserializeField;
@@ -16023,13 +15748,7 @@ var __publicField = (obj, key, value) => {
16023
15748
  exports2.fileSlice = fileSlice;
16024
15749
  exports2.fileToBlob = fileToBlob;
16025
15750
  exports2.flipCoordinates = flipCoordinates;
16026
- exports2.formReducer = formReducer;
16027
- exports2.formRevisionReducer = formRevisionReducer;
16028
15751
  exports2.formRevisionToSchema = formRevisionToSchema;
16029
- exports2.formRevisionsSlice = formRevisionsSlice;
16030
- exports2.formSlice = formSlice;
16031
- exports2.formSubmissionReducer = formSubmissionReducer;
16032
- exports2.formSubmissionSlice = formSubmissionSlice;
16033
15752
  exports2.forms = index;
16034
15753
  exports2.fullComponentMarkerSize = fullComponentMarkerSize;
16035
15754
  exports2.generateBadgeColors = generateBadgeColors;
@@ -16157,8 +15876,6 @@ var __publicField = (obj, key, value) => {
16157
15876
  exports2.selectAttachmentsOfComponentTypeByType = selectAttachmentsOfComponentTypeByType;
16158
15877
  exports2.selectAttachmentsOfDocument = selectAttachmentsOfDocument;
16159
15878
  exports2.selectAttachmentsOfDocumentByType = selectAttachmentsOfDocumentByType;
16160
- exports2.selectAttachmentsOfFormRevision = selectAttachmentsOfFormRevision;
16161
- exports2.selectAttachmentsOfFormSubmission = selectAttachmentsOfFormSubmission;
16162
15879
  exports2.selectAttachmentsOfIssue = selectAttachmentsOfIssue;
16163
15880
  exports2.selectAttachmentsOfIssueByType = selectAttachmentsOfIssueByType;
16164
15881
  exports2.selectAttachmentsOfProject = selectAttachmentsOfProject;
@@ -16176,9 +15893,10 @@ var __publicField = (obj, key, value) => {
16176
15893
  exports2.selectComponent = selectComponent;
16177
15894
  exports2.selectComponentAttachment = selectComponentAttachment;
16178
15895
  exports2.selectComponentAttachmentMapping = selectComponentAttachmentMapping;
15896
+ exports2.selectComponentSubmissionMapping = selectComponentSubmissionMapping;
16179
15897
  exports2.selectComponentType = selectComponentType;
16180
- exports2.selectComponentTypeAttachment = selectComponentTypeAttachment;
16181
15898
  exports2.selectComponentTypeAttachmentMapping = selectComponentTypeAttachmentMapping;
15899
+ exports2.selectComponentTypeForm = selectComponentTypeForm;
16182
15900
  exports2.selectComponentTypeFromComponent = selectComponentTypeFromComponent;
16183
15901
  exports2.selectComponentTypeFromComponents = selectComponentTypeFromComponents;
16184
15902
  exports2.selectComponentTypeStagesMapping = selectComponentTypeStagesMapping;
@@ -16208,24 +15926,8 @@ var __publicField = (obj, key, value) => {
16208
15926
  exports2.selectExpandedSections = selectExpandedSections;
16209
15927
  exports2.selectFavouriteProjects = selectFavouriteProjects;
16210
15928
  exports2.selectFileAttachmentsOfIssue = selectFileAttachmentsOfIssue;
16211
- exports2.selectFilteredForms = selectFilteredForms;
16212
- exports2.selectForm = selectForm;
16213
- exports2.selectFormMapping = selectFormMapping;
16214
- exports2.selectFormOfComponentType = selectFormOfComponentType;
15929
+ exports2.selectFilteredUserForms = selectFilteredUserForms;
16215
15930
  exports2.selectFormRevision = selectFormRevision;
16216
- exports2.selectFormRevisionMapping = selectFormRevisionMapping;
16217
- exports2.selectFormRevisions = selectFormRevisions;
16218
- exports2.selectFormRevisionsOfForm = selectFormRevisionsOfForm;
16219
- exports2.selectFormSubmission = selectFormSubmission;
16220
- exports2.selectFormSubmissionAttachmentsMapping = selectFormSubmissionAttachmentsMapping;
16221
- exports2.selectFormSubmissions = selectFormSubmissions;
16222
- exports2.selectFormSubmissionsByComponents = selectFormSubmissionsByComponents;
16223
- exports2.selectFormSubmissionsMapping = selectFormSubmissionsMapping;
16224
- exports2.selectFormSubmissionsOfComponent = selectFormSubmissionsOfComponent;
16225
- exports2.selectFormSubmissionsOfForm = selectFormSubmissionsOfForm;
16226
- exports2.selectFormSubmissionsOfIssue = selectFormSubmissionsOfIssue;
16227
- exports2.selectFormsCount = selectFormsCount;
16228
- exports2.selectGeneralFormCount = selectGeneralFormCount;
16229
15931
  exports2.selectHiddenCategoryCount = selectHiddenCategoryCount;
16230
15932
  exports2.selectHiddenComponentTypeIds = selectHiddenComponentTypeIds;
16231
15933
  exports2.selectIsFetchingInitialData = selectIsFetchingInitialData;
@@ -16240,10 +15942,10 @@ var __publicField = (obj, key, value) => {
16240
15942
  exports2.selectIssueUpdateMapping = selectIssueUpdateMapping;
16241
15943
  exports2.selectIssueUpdatesOfIssue = selectIssueUpdatesOfIssue;
16242
15944
  exports2.selectIssues = selectIssues;
16243
- exports2.selectLatestFormRevisionByForm = selectLatestFormRevisionByForm;
16244
- exports2.selectLatestFormRevisionOfForm = selectLatestFormRevisionOfForm;
16245
- exports2.selectLatestFormRevisionsOfComponentTypes = selectLatestFormRevisionsOfComponentTypes;
15945
+ exports2.selectLatestFormRevision = selectLatestFormRevision;
16246
15946
  exports2.selectLatestRetryTime = selectLatestRetryTime;
15947
+ exports2.selectLatestRevisionByFormId = selectLatestRevisionByFormId;
15948
+ exports2.selectLatestRevisionsFromComponentTypeIds = selectLatestRevisionsFromComponentTypeIds;
16247
15949
  exports2.selectLicense = selectLicense;
16248
15950
  exports2.selectLicenseForProject = selectLicenseForProject;
16249
15951
  exports2.selectLicenses = selectLicenses;
@@ -16252,6 +15954,8 @@ var __publicField = (obj, key, value) => {
16252
15954
  exports2.selectMapStyle = selectMapStyle;
16253
15955
  exports2.selectNumberOfComponentTypesMatchingCaseInsensitiveName = selectNumberOfComponentTypesMatchingCaseInsensitiveName;
16254
15956
  exports2.selectNumberOfComponentsOfComponentType = selectNumberOfComponentsOfComponentType;
15957
+ exports2.selectNumberOfGeneralUserForms = selectNumberOfGeneralUserForms;
15958
+ exports2.selectNumberOfUserForms = selectNumberOfUserForms;
16255
15959
  exports2.selectOrganization = selectOrganization;
16256
15960
  exports2.selectOrganizationAccess = selectOrganizationAccess;
16257
15961
  exports2.selectOrganizationAccessForUser = selectOrganizationAccessForUser;
@@ -16279,6 +15983,8 @@ var __publicField = (obj, key, value) => {
16279
15983
  exports2.selectRecentIssuesAsSearchResults = selectRecentIssuesAsSearchResults;
16280
15984
  exports2.selectRecentProjects = selectRecentProjects;
16281
15985
  exports2.selectRehydrated = selectRehydrated;
15986
+ exports2.selectRevisionAttachments = selectRevisionAttachments;
15987
+ exports2.selectRevisionsForForm = selectRevisionsForForm;
16282
15988
  exports2.selectRootDocuments = selectRootDocuments;
16283
15989
  exports2.selectShowTooltips = selectShowTooltips;
16284
15990
  exports2.selectSortedEmailDomains = selectSortedEmailDomains;
@@ -16293,10 +15999,16 @@ var __publicField = (obj, key, value) => {
16293
15999
  exports2.selectStagesFromComponentType = selectStagesFromComponentType;
16294
16000
  exports2.selectStagesFromComponentTypeIds = selectStagesFromComponentTypeIds;
16295
16001
  exports2.selectStagesFromStageIds = selectStagesFromStageIds;
16002
+ exports2.selectSubmissionAttachments = selectSubmissionAttachments;
16003
+ exports2.selectSubmissionsForComponent = selectSubmissionsForComponent;
16004
+ exports2.selectSubmissionsForForm = selectSubmissionsForForm;
16005
+ exports2.selectSubmissionsForIssue = selectSubmissionsForIssue;
16296
16006
  exports2.selectUploadUrl = selectUploadUrl;
16297
16007
  exports2.selectUsedColors = selectUsedColors;
16298
16008
  exports2.selectUser = selectUser;
16299
- exports2.selectUserFormRevisionAttachmentsMapping = selectUserFormRevisionAttachmentsMapping;
16009
+ exports2.selectUserForm = selectUserForm;
16010
+ exports2.selectUserFormMapping = selectUserFormMapping;
16011
+ exports2.selectUserFormSubmission = selectUserFormSubmission;
16300
16012
  exports2.selectUsersAsMapping = selectUsersAsMapping;
16301
16013
  exports2.selectVisibleStatuses = selectVisibleStatuses;
16302
16014
  exports2.selectVisibleUserIds = selectVisibleUserIds;
@@ -16323,13 +16035,6 @@ var __publicField = (obj, key, value) => {
16323
16035
  exports2.setEnableClustering = setEnableClustering;
16324
16036
  exports2.setEnableDuplicateIssues = setEnableDuplicateIssues;
16325
16037
  exports2.setEnablePlacementMode = setEnablePlacementMode;
16326
- exports2.setFormRevision = setFormRevision;
16327
- exports2.setFormRevisionAttachments = setFormRevisionAttachments;
16328
- exports2.setFormRevisions = setFormRevisions;
16329
- exports2.setFormSubmission = setFormSubmission;
16330
- exports2.setFormSubmissionAttachments = setFormSubmissionAttachments;
16331
- exports2.setFormSubmissions = setFormSubmissions;
16332
- exports2.setForms = setForms;
16333
16038
  exports2.setIsFetchingInitialData = setIsFetchingInitialData;
16334
16039
  exports2.setIsImportingProjectFile = setIsImportingProjectFile;
16335
16040
  exports2.setIsLoading = setIsLoading;
@@ -16354,6 +16059,9 @@ var __publicField = (obj, key, value) => {
16354
16059
  exports2.setTokens = setTokens;
16355
16060
  exports2.setTourStep = setTourStep;
16356
16061
  exports2.setUploadUrl = setUploadUrl;
16062
+ exports2.setUserFormRevisionAttachments = setUserFormRevisionAttachments;
16063
+ exports2.setUserFormSubmissionAttachments = setUserFormSubmissionAttachments;
16064
+ exports2.setUserFormSubmissions = setUserFormSubmissions;
16357
16065
  exports2.setUsers = setUsers;
16358
16066
  exports2.setVisibleStatuses = setVisibleStatuses;
16359
16067
  exports2.setVisibleUserIds = setVisibleUserIds;
@@ -16378,13 +16086,11 @@ var __publicField = (obj, key, value) => {
16378
16086
  exports2.updateComponentTypeAttachment = updateComponentTypeAttachment;
16379
16087
  exports2.updateDocumentAttachment = updateDocumentAttachment;
16380
16088
  exports2.updateDocuments = updateDocuments;
16381
- exports2.updateFormSubmission = updateFormSubmission;
16382
- exports2.updateFormSubmissionAttachments = updateFormSubmissionAttachments;
16383
- exports2.updateFormSubmissions = updateFormSubmissions;
16384
16089
  exports2.updateIssue = updateIssue;
16385
16090
  exports2.updateIssueAttachment = updateIssueAttachment;
16386
16091
  exports2.updateLicense = updateLicense;
16387
16092
  exports2.updateOrCreateProject = updateOrCreateProject;
16093
+ exports2.updateOrCreateUserFormSubmission = updateOrCreateUserFormSubmission;
16388
16094
  exports2.updateOrganizationAccess = updateOrganizationAccess;
16389
16095
  exports2.updateProjectAccess = updateProjectAccess;
16390
16096
  exports2.updateProjectAttachment = updateProjectAttachment;
@@ -16398,6 +16104,8 @@ var __publicField = (obj, key, value) => {
16398
16104
  exports2.useFormikInput = useFormikInput;
16399
16105
  exports2.useMemoCompare = useMemoCompare;
16400
16106
  exports2.useSDK = useSDK;
16107
+ exports2.userFormReducer = userFormReducer;
16108
+ exports2.userFormSlice = userFormSlice;
16401
16109
  exports2.userReducer = userReducer;
16402
16110
  exports2.userSlice = userSlice;
16403
16111
  exports2.valueIsFile = valueIsFile;