@overmap-ai/core 1.0.51-add-submitted-at-to-form-revisions.1 → 1.0.51-add-teams.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/forms/builder/constants.d.ts +1 -0
  2. package/dist/forms/builder/utils.d.ts +1 -1
  3. package/dist/forms/fields/QrField/QrField.d.ts +21 -0
  4. package/dist/forms/fields/QrField/QrInput.d.ts +10 -0
  5. package/dist/forms/fields/QrField/index.d.ts +2 -0
  6. package/dist/forms/fields/constants.d.ts +8 -0
  7. package/dist/forms/fields/index.d.ts +1 -0
  8. package/dist/forms/renderer/FormSubmissionBrowser/FormSubmissionBrowser.d.ts +5 -5
  9. package/dist/forms/renderer/FormSubmissionViewer/FormSubmissionViewer.d.ts +3 -3
  10. package/dist/forms/typings.d.ts +5 -2
  11. package/dist/overmap-core.js +1119 -457
  12. package/dist/overmap-core.js.map +1 -1
  13. package/dist/overmap-core.umd.cjs +1120 -459
  14. package/dist/overmap-core.umd.cjs.map +1 -1
  15. package/dist/sdk/sdk.d.ts +2 -1
  16. package/dist/sdk/services/TeamService.d.ts +12 -0
  17. package/dist/sdk/services/UserFormSubmissionService.d.ts +9 -2
  18. package/dist/sdk/services/index.d.ts +1 -0
  19. package/dist/store/slices/categorySlice.d.ts +4 -1
  20. package/dist/store/slices/documentSlice.d.ts +4 -1
  21. package/dist/store/slices/formRevisionSlice.d.ts +66 -0
  22. package/dist/store/slices/formSlice.d.ts +110 -0
  23. package/dist/store/slices/formSubmissionSlice.d.ts +47 -0
  24. package/dist/store/slices/index.d.ts +4 -1
  25. package/dist/store/slices/issueSlice.d.ts +4 -1
  26. package/dist/store/slices/projectFileSlice.d.ts +4 -1
  27. package/dist/store/slices/teamSlice.d.ts +19 -0
  28. package/dist/store/slices/utils.d.ts +1 -0
  29. package/dist/store/slices/workspaceSlice.d.ts +4 -1
  30. package/dist/store/store.d.ts +13 -4
  31. package/dist/style.css +5 -0
  32. package/dist/typings/files.d.ts +11 -1
  33. package/dist/typings/models/attachments.d.ts +8 -11
  34. package/dist/typings/models/base.d.ts +10 -0
  35. package/dist/typings/models/forms.d.ts +6 -11
  36. package/dist/typings/models/index.d.ts +1 -0
  37. package/dist/typings/models/teams.d.ts +10 -0
  38. package/dist/utils/file.d.ts +2 -0
  39. package/dist/utils/forms.d.ts +2 -0
  40. package/package.json +2 -1
  41. package/dist/store/slices/userFormSlice.d.ts +0 -145
@@ -5,8 +5,8 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  (function(global2, factory) {
8
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("react/jsx-runtime"), require("@overmap-ai/blocks"), require("dependency-graph"), require("@redux-offline/redux-offline"), require("@redux-offline/redux-offline/lib/defaults"), require("localforage"), require("redux-persist-migrate"), require("@reduxjs/toolkit"), require("superagent"), require("react-redux"), require("file-saver"), require("uuid"), require("color"), require("jwt-decode"), require("@redux-offline/redux-offline/lib/constants"), require("idb"), require("formik"), require("lodash.get"), require("linkify-react"), require("@hello-pangea/dnd"), require("xlsx"), require("react-pdf"), require("react-pdf/dist/Page/AnnotationLayer.css"), require("react-pdf/dist/Page/TextLayer.css"), require("react-dom"), require("react-sketch-canvas"), require("lodash.set"), require("lodash.clonedeep")) : typeof define === "function" && define.amd ? define(["exports", "react", "react/jsx-runtime", "@overmap-ai/blocks", "dependency-graph", "@redux-offline/redux-offline", "@redux-offline/redux-offline/lib/defaults", "localforage", "redux-persist-migrate", "@reduxjs/toolkit", "superagent", "react-redux", "file-saver", "uuid", "color", "jwt-decode", "@redux-offline/redux-offline/lib/constants", "idb", "formik", "lodash.get", "linkify-react", "@hello-pangea/dnd", "xlsx", "react-pdf", "react-pdf/dist/Page/AnnotationLayer.css", "react-pdf/dist/Page/TextLayer.css", "react-dom", "react-sketch-canvas", "lodash.set", "lodash.clonedeep"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2["overmap-core"] = {}, global2.React, global2.jsxRuntime, global2.blocks, global2.dependencyGraph, global2.reduxOffline, global2.offlineConfig, global2.localforage, global2.createMigration, global2.toolkit, global2.request, global2.reactRedux, global2.saveAs, global2.uuid, global2.ColorCls, global2.jwtDecode, global2.constants, global2.idb, global2.formik, global2.get, global2.Linkify, global2.dnd, global2.xlsx, global2.reactPdf, null, null, global2.ReactDOM, global2.reactSketchCanvas, global2.set, global2.cloneDeep));
9
- })(this, function(exports2, React, jsxRuntime, blocks, dependencyGraph, reduxOffline, offlineConfig, localforage, createMigration, toolkit, request, reactRedux, saveAs, uuid, ColorCls, jwtDecode, constants, idb, formik, get, Linkify, dnd, xlsx, reactPdf, AnnotationLayer_css, TextLayer_css, ReactDOM, reactSketchCanvas, set, cloneDeep) {
8
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("react/jsx-runtime"), require("@overmap-ai/blocks"), require("dependency-graph"), require("@redux-offline/redux-offline"), require("@redux-offline/redux-offline/lib/defaults"), require("localforage"), require("redux-persist-migrate"), require("@reduxjs/toolkit"), require("superagent"), require("react-redux"), require("file-saver"), require("uuid"), require("color"), require("jwt-decode"), require("@redux-offline/redux-offline/lib/constants"), require("idb"), require("formik"), require("lodash.get"), require("linkify-react"), require("@hello-pangea/dnd"), require("qr-scanner"), require("xlsx"), require("react-pdf"), require("react-pdf/dist/Page/AnnotationLayer.css"), require("react-pdf/dist/Page/TextLayer.css"), require("react-dom"), require("react-sketch-canvas"), require("lodash.set"), require("lodash.clonedeep")) : typeof define === "function" && define.amd ? define(["exports", "react", "react/jsx-runtime", "@overmap-ai/blocks", "dependency-graph", "@redux-offline/redux-offline", "@redux-offline/redux-offline/lib/defaults", "localforage", "redux-persist-migrate", "@reduxjs/toolkit", "superagent", "react-redux", "file-saver", "uuid", "color", "jwt-decode", "@redux-offline/redux-offline/lib/constants", "idb", "formik", "lodash.get", "linkify-react", "@hello-pangea/dnd", "qr-scanner", "xlsx", "react-pdf", "react-pdf/dist/Page/AnnotationLayer.css", "react-pdf/dist/Page/TextLayer.css", "react-dom", "react-sketch-canvas", "lodash.set", "lodash.clonedeep"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2["overmap-core"] = {}, global2.React, global2.jsxRuntime, global2.blocks, global2.dependencyGraph, global2.reduxOffline, global2.offlineConfig, global2.localforage, global2.createMigration, global2.toolkit, global2.request, global2.reactRedux, global2.saveAs, global2.uuid, global2.ColorCls, global2.jwtDecode, global2.constants, global2.idb, global2.formik, global2.get, global2.Linkify, global2.dnd, global2.QrScannerAPI, global2.xlsx, global2.reactPdf, null, null, global2.ReactDOM, global2.reactSketchCanvas, global2.set, global2.cloneDeep));
9
+ })(this, function(exports2, React, jsxRuntime, blocks, dependencyGraph, reduxOffline, offlineConfig, localforage, createMigration, toolkit, request, reactRedux, saveAs, uuid, ColorCls, jwtDecode, constants, idb, formik, get, Linkify, dnd, QrScannerAPI, xlsx, reactPdf, AnnotationLayer_css, TextLayer_css, ReactDOM, reactSketchCanvas, set, cloneDeep) {
10
10
  var _a;
11
11
  "use strict";
12
12
  function _interopNamespaceDefault(e) {
@@ -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$n = {
671
+ const initialState$q = {
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$n,
679
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
678
+ initialState: initialState$q,
679
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
680
680
  reducers: {
681
681
  setTokens: (state, action) => {
682
682
  state.accessToken = action.payload.accessToken;
@@ -841,6 +841,19 @@ var __publicField = (obj, key, value) => {
841
841
  element.click();
842
842
  document.body.removeChild(element);
843
843
  }
844
+ const constructUploadedFilePayloads = async (files) => {
845
+ const filePayloads = {};
846
+ for (const file of files) {
847
+ const sha1 = await hashFile(file);
848
+ filePayloads[sha1] = {
849
+ sha1,
850
+ extension: file.name.split(".").pop() || "",
851
+ file_type: file.type,
852
+ size: file.size
853
+ };
854
+ }
855
+ return Object.values(filePayloads);
856
+ };
844
857
  const fileToBlob = async (dataUrl) => {
845
858
  return (await fetch(dataUrl)).blob();
846
859
  };
@@ -1407,7 +1420,7 @@ var __publicField = (obj, key, value) => {
1407
1420
  return getLocalDateString(date);
1408
1421
  return relative.format(days, "days");
1409
1422
  });
1410
- const initialState$m = {
1423
+ const initialState$p = {
1411
1424
  categories: {},
1412
1425
  usedCategoryColors: [],
1413
1426
  categoryVisibility: {
@@ -1417,8 +1430,8 @@ var __publicField = (obj, key, value) => {
1417
1430
  };
1418
1431
  const categorySlice = toolkit.createSlice({
1419
1432
  name: "categories",
1420
- initialState: initialState$m,
1421
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
1433
+ initialState: initialState$p,
1434
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
1422
1435
  reducers: {
1423
1436
  setCategories: (state, action) => {
1424
1437
  if (!Array.isArray(action.payload))
@@ -1587,14 +1600,14 @@ var __publicField = (obj, key, value) => {
1587
1600
  delete state.attachments[attachmentId];
1588
1601
  }
1589
1602
  }
1590
- const initialState$l = {
1603
+ const initialState$o = {
1591
1604
  components: {},
1592
1605
  attachments: {}
1593
1606
  };
1594
1607
  const componentSlice = toolkit.createSlice({
1595
1608
  name: "components",
1596
- initialState: initialState$l,
1597
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
1609
+ initialState: initialState$o,
1610
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
1598
1611
  reducers: {
1599
1612
  addComponent: (state, action) => {
1600
1613
  state.components[action.payload.offline_id] = action.payload;
@@ -1750,13 +1763,13 @@ var __publicField = (obj, key, value) => {
1750
1763
  removeAllComponentsOfType
1751
1764
  } = componentSlice.actions;
1752
1765
  const componentReducer = componentSlice.reducer;
1753
- const initialState$k = {
1766
+ const initialState$n = {
1754
1767
  completionsByComponentId: {}
1755
1768
  };
1756
1769
  const componentStageCompletionSlice = toolkit.createSlice({
1757
1770
  name: "componentStageCompletions",
1758
- initialState: initialState$k,
1759
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
1771
+ initialState: initialState$n,
1772
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
1760
1773
  reducers: {
1761
1774
  addStageCompletion: (state, action) => {
1762
1775
  let stageToCompletionDateMapping = state.completionsByComponentId[action.payload.component];
@@ -1807,13 +1820,13 @@ var __publicField = (obj, key, value) => {
1807
1820
  return Object.keys(state.componentStageCompletionReducer.completionsByComponentId[component.offline_id] ?? {});
1808
1821
  };
1809
1822
  const componentStageCompletionReducer = componentStageCompletionSlice.reducer;
1810
- const initialState$j = {
1823
+ const initialState$m = {
1811
1824
  stages: {}
1812
1825
  };
1813
1826
  const componentStageSlice = toolkit.createSlice({
1814
1827
  name: "componentStages",
1815
- initialState: initialState$j,
1816
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
1828
+ initialState: initialState$m,
1829
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
1817
1830
  reducers: {
1818
1831
  addStages: (state, action) => {
1819
1832
  Object.assign(state.stages, toOfflineIdRecord(action.payload));
@@ -1923,15 +1936,15 @@ var __publicField = (obj, key, value) => {
1923
1936
  );
1924
1937
  const { addStages, updateStages, removeStages, linkStageToForm, unlinkStageToForm } = componentStageSlice.actions;
1925
1938
  const componentStageReducer = componentStageSlice.reducer;
1926
- const initialState$i = {
1939
+ const initialState$l = {
1927
1940
  componentTypes: {},
1928
1941
  hiddenComponentTypeIds: {},
1929
1942
  attachments: {}
1930
1943
  };
1931
1944
  const componentTypeSlice = toolkit.createSlice({
1932
1945
  name: "componentTypes",
1933
- initialState: initialState$i,
1934
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
1946
+ initialState: initialState$l,
1947
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
1935
1948
  reducers: {
1936
1949
  addComponentType: (state, action) => {
1937
1950
  state.componentTypes[action.payload.offline_id] = action.payload;
@@ -2042,13 +2055,13 @@ var __publicField = (obj, key, value) => {
2042
2055
  deleteComponentType
2043
2056
  } = componentTypeSlice.actions;
2044
2057
  const componentTypeReducer = componentTypeSlice.reducer;
2045
- const initialState$h = {
2058
+ const initialState$k = {
2046
2059
  workspaces: {},
2047
2060
  activeWorkspaceId: null
2048
2061
  };
2049
2062
  const workspaceSlice = toolkit.createSlice({
2050
2063
  name: "workspace",
2051
- initialState: initialState$h,
2064
+ initialState: initialState$k,
2052
2065
  // The `reducers` field lets us define reducers and generate associated actions
2053
2066
  reducers: {
2054
2067
  setWorkspaces: (state, action) => {
@@ -2105,7 +2118,7 @@ var __publicField = (obj, key, value) => {
2105
2118
  );
2106
2119
  const workspaceReducer = workspaceSlice.reducer;
2107
2120
  const maxRecentIssues = 10;
2108
- const initialState$g = {
2121
+ const initialState$j = {
2109
2122
  issues: {},
2110
2123
  attachments: {},
2111
2124
  comments: {},
@@ -2117,9 +2130,9 @@ var __publicField = (obj, key, value) => {
2117
2130
  };
2118
2131
  const issueSlice = toolkit.createSlice({
2119
2132
  name: "issues",
2120
- initialState: initialState$g,
2133
+ initialState: initialState$j,
2121
2134
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
2122
- Object.assign(state, initialState$g);
2135
+ Object.assign(state, initialState$j);
2123
2136
  }),
2124
2137
  reducers: {
2125
2138
  setIssues: (state, action) => {
@@ -2527,15 +2540,15 @@ var __publicField = (obj, key, value) => {
2527
2540
  }
2528
2541
  );
2529
2542
  const issueReducer = issueSlice.reducer;
2530
- const initialState$f = {
2543
+ const initialState$i = {
2531
2544
  s3Urls: {}
2532
2545
  };
2533
2546
  const msPerHour = 1e3 * 60 * 60;
2534
2547
  const msPerWeek = msPerHour * 24 * 7;
2535
2548
  const fileSlice = toolkit.createSlice({
2536
2549
  name: "file",
2537
- initialState: initialState$f,
2538
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
2550
+ initialState: initialState$i,
2551
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
2539
2552
  reducers: {
2540
2553
  setUploadUrl: (state, action) => {
2541
2554
  const { url, fields, sha1 } = action.payload;
@@ -2562,7 +2575,7 @@ var __publicField = (obj, key, value) => {
2562
2575
  return url;
2563
2576
  };
2564
2577
  const fileReducer = fileSlice.reducer;
2565
- const initialState$e = {
2578
+ const initialState$h = {
2566
2579
  // TODO: Change first MapStyle.SATELLITE to MaptStyle.None when project creation map is fixed
2567
2580
  mapStyle: MapStyle.SATELLITE,
2568
2581
  showTooltips: false,
@@ -2570,8 +2583,8 @@ var __publicField = (obj, key, value) => {
2570
2583
  };
2571
2584
  const mapSlice = toolkit.createSlice({
2572
2585
  name: "map",
2573
- initialState: initialState$e,
2574
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
2586
+ initialState: initialState$h,
2587
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
2575
2588
  reducers: {
2576
2589
  setMapStyle: (state, action) => {
2577
2590
  state.mapStyle = action.payload;
@@ -2640,7 +2653,7 @@ var __publicField = (obj, key, value) => {
2640
2653
  LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
2641
2654
  return LicenseStatus2;
2642
2655
  })(LicenseStatus || {});
2643
- const initialState$d = {
2656
+ const initialState$g = {
2644
2657
  users: {},
2645
2658
  currentUser: {
2646
2659
  id: 0,
@@ -2651,8 +2664,8 @@ var __publicField = (obj, key, value) => {
2651
2664
  };
2652
2665
  const userSlice = toolkit.createSlice({
2653
2666
  name: "users",
2654
- initialState: initialState$d,
2655
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
2667
+ initialState: initialState$g,
2668
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
2656
2669
  reducers: {
2657
2670
  setUsers: (state, action) => {
2658
2671
  const usersMapping = {};
@@ -2714,13 +2727,13 @@ var __publicField = (obj, key, value) => {
2714
2727
  const selectUsersAsMapping = (state) => state.userReducer.users;
2715
2728
  const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
2716
2729
  const userReducer = userSlice.reducer;
2717
- const initialState$c = {
2730
+ const initialState$f = {
2718
2731
  organizationAccesses: {}
2719
2732
  };
2720
2733
  const organizationAccessSlice = toolkit.createSlice({
2721
2734
  name: "organizationAccess",
2722
- initialState: initialState$c,
2723
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
2735
+ initialState: initialState$f,
2736
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
2724
2737
  reducers: {
2725
2738
  setOrganizationAccesses: (state, action) => {
2726
2739
  if (!Array.isArray(action.payload))
@@ -2783,13 +2796,13 @@ var __publicField = (obj, key, value) => {
2783
2796
  return organizationAccesses;
2784
2797
  };
2785
2798
  const organizationAccessReducer = organizationAccessSlice.reducer;
2786
- const initialState$b = {
2799
+ const initialState$e = {
2787
2800
  licenses: {}
2788
2801
  };
2789
2802
  const licenseSlice = toolkit.createSlice({
2790
2803
  name: "license",
2791
- initialState: initialState$b,
2792
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
2804
+ initialState: initialState$e,
2805
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
2793
2806
  reducers: {
2794
2807
  setLicenses: (state, action) => {
2795
2808
  if (!Array.isArray(action.payload))
@@ -2834,13 +2847,13 @@ var __publicField = (obj, key, value) => {
2834
2847
  (licenses) => Object.values(licenses).filter((license) => license.project).reduce((accum, license) => ({ ...accum, [license.project]: license }), {})
2835
2848
  );
2836
2849
  const licenseReducer = licenseSlice.reducer;
2837
- const initialState$a = {
2850
+ const initialState$d = {
2838
2851
  projectAccesses: {}
2839
2852
  };
2840
2853
  const projectAccessSlice = toolkit.createSlice({
2841
2854
  name: "projectAccess",
2842
- initialState: initialState$a,
2843
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
2855
+ initialState: initialState$d,
2856
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
2844
2857
  reducers: {
2845
2858
  setProjectAccesses: (state, action) => {
2846
2859
  if (!Array.isArray(action.payload))
@@ -2908,7 +2921,7 @@ var __publicField = (obj, key, value) => {
2908
2921
  return projectAccesses;
2909
2922
  };
2910
2923
  const projectAccessReducer = projectAccessSlice.reducer;
2911
- const initialState$9 = {
2924
+ const initialState$c = {
2912
2925
  projects: {},
2913
2926
  activeProjectId: null,
2914
2927
  recentProjectIds: [],
@@ -2918,7 +2931,7 @@ var __publicField = (obj, key, value) => {
2918
2931
  };
2919
2932
  const projectSlice = toolkit.createSlice({
2920
2933
  name: "projects",
2921
- initialState: initialState$9,
2934
+ initialState: initialState$c,
2922
2935
  reducers: {
2923
2936
  setProjects: (state, action) => {
2924
2937
  const projectsMap = {};
@@ -3105,14 +3118,14 @@ var __publicField = (obj, key, value) => {
3105
3118
  }
3106
3119
  )
3107
3120
  );
3108
- const initialState$8 = {
3121
+ const initialState$b = {
3109
3122
  organizations: {},
3110
3123
  activeOrganizationId: null
3111
3124
  };
3112
3125
  const organizationSlice = toolkit.createSlice({
3113
3126
  name: "organizations",
3114
- initialState: initialState$8,
3115
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
3127
+ initialState: initialState$b,
3128
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
3116
3129
  reducers: {
3117
3130
  setOrganizations: (state, action) => {
3118
3131
  for (const org of action.payload) {
@@ -3231,14 +3244,14 @@ var __publicField = (obj, key, value) => {
3231
3244
  }
3232
3245
  };
3233
3246
  };
3234
- const initialState$7 = {
3247
+ const initialState$a = {
3235
3248
  deletedRequests: [],
3236
3249
  latestRetryTime: 0
3237
3250
  };
3238
3251
  const outboxSlice = toolkit.createSlice({
3239
3252
  name: "outbox",
3240
- initialState: initialState$7,
3241
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
3253
+ initialState: initialState$a,
3254
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
3242
3255
  reducers: {
3243
3256
  // enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
3244
3257
  // Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
@@ -3270,7 +3283,7 @@ var __publicField = (obj, key, value) => {
3270
3283
  const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
3271
3284
  const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
3272
3285
  const outboxReducer = outboxSlice.reducer;
3273
- const initialState$6 = {
3286
+ const initialState$9 = {
3274
3287
  projectFiles: {},
3275
3288
  activeProjectFileId: null,
3276
3289
  isImportingProjectFile: false,
@@ -3278,8 +3291,8 @@ var __publicField = (obj, key, value) => {
3278
3291
  };
3279
3292
  const projectFileSlice = toolkit.createSlice({
3280
3293
  name: "projectFiles",
3281
- initialState: initialState$6,
3282
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
3294
+ initialState: initialState$9,
3295
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$9)),
3283
3296
  reducers: {
3284
3297
  addOrReplaceProjectFiles: (state, action) => {
3285
3298
  for (let fileObj of action.payload) {
@@ -3380,12 +3393,12 @@ var __publicField = (obj, key, value) => {
3380
3393
  const selectActiveProjectFileId = (state) => state.projectFileReducer.activeProjectFileId;
3381
3394
  const selectIsImportingProjectFile = (state) => state.projectFileReducer.isImportingProjectFile;
3382
3395
  const projectFileReducer = projectFileSlice.reducer;
3383
- const initialState$5 = {
3396
+ const initialState$8 = {
3384
3397
  isRehydrated: false
3385
3398
  };
3386
3399
  const rehydratedSlice = toolkit.createSlice({
3387
3400
  name: "rehydrated",
3388
- initialState: initialState$5,
3401
+ initialState: initialState$8,
3389
3402
  // The `reducers` field lets us define reducers and generate associated actions
3390
3403
  reducers: {
3391
3404
  setRehydrated: (state, action) => {
@@ -3395,7 +3408,7 @@ var __publicField = (obj, key, value) => {
3395
3408
  });
3396
3409
  const selectRehydrated = (state) => state.rehydratedReducer.isRehydrated;
3397
3410
  const rehydratedReducer = rehydratedSlice.reducer;
3398
- const initialState$4 = {
3411
+ const initialState$7 = {
3399
3412
  useIssueTemplate: false,
3400
3413
  placementMode: false,
3401
3414
  enableClustering: false,
@@ -3412,8 +3425,8 @@ var __publicField = (obj, key, value) => {
3412
3425
  };
3413
3426
  const settingSlice = toolkit.createSlice({
3414
3427
  name: "settings",
3415
- initialState: initialState$4,
3416
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
3428
+ initialState: initialState$7,
3429
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
3417
3430
  reducers: {
3418
3431
  setEnableDuplicateIssues: (state, action) => {
3419
3432
  state.useIssueTemplate = action.payload;
@@ -3459,146 +3472,231 @@ var __publicField = (obj, key, value) => {
3459
3472
  const settingReducer = settingSlice.reducer;
3460
3473
  const selectIsFetchingInitialData = (state) => state.settingReducer.isFetchingInitialData;
3461
3474
  const selectIsLoading = (state) => state.settingReducer.isLoading;
3462
- const LATEST_REVISION_CACHE = {};
3463
- function considerCachingRevision(revision, formId2, preferPending = false) {
3464
- var _a2;
3465
- if (!revision) {
3466
- if (!formId2) {
3467
- throw new Error("If revision is null, formId is required.");
3468
- }
3469
- const currentLatestRevision = getLatestRevisionFromCache(formId2);
3470
- if (currentLatestRevision)
3471
- return;
3472
- LATEST_REVISION_CACHE[formId2] = null;
3473
- return;
3474
- }
3475
- if (revision.revision === "Pending") {
3476
- if (preferPending) {
3477
- LATEST_REVISION_CACHE[revision.form] = revision;
3478
- }
3479
- return;
3480
- }
3481
- const cachedRevision = (_a2 = LATEST_REVISION_CACHE[revision.form]) == null ? void 0 : _a2.revision;
3482
- if (revision.revision > (typeof cachedRevision === "number" ? cachedRevision : -1)) {
3483
- LATEST_REVISION_CACHE[revision.form] = revision;
3475
+ const formRevisionSortFn = (formRevisionA, formRevisionB) => {
3476
+ const revisionA = formRevisionA.revision;
3477
+ const revisionB = formRevisionB.revision;
3478
+ if (revisionA === "Pending" && revisionB === "Pending") {
3479
+ return formRevisionA.submitted_at < formRevisionB.submitted_at ? -1 : 1;
3480
+ } else if (revisionA === "Pending") {
3481
+ return 1;
3482
+ } else if (revisionB === "Pending") {
3483
+ return -1;
3484
+ } else {
3485
+ return revisionA < revisionB ? -1 : 1;
3484
3486
  }
3485
- }
3486
- function getLatestRevisionFromCache(formId2) {
3487
- return LATEST_REVISION_CACHE[formId2];
3488
- }
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)),
3487
+ };
3488
+ const initialState$6 = {
3489
+ formRevisions: {},
3490
+ attachments: {}
3491
+ };
3492
+ const formRevisionsSlice = toolkit.createSlice({
3493
+ name: "formRevisions",
3494
+ initialState: initialState$6,
3495
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
3500
3496
  reducers: {
3501
- setUserForms: (state, action) => {
3502
- state.userForms = {};
3503
- action.payload.forEach((userForm) => {
3504
- state.userForms[userForm.offline_id] = userForm;
3505
- });
3506
- },
3507
- addUserForm: (state, action) => {
3508
- state.userForms[action.payload.offline_id] = action.payload;
3497
+ // revision related actions
3498
+ setFormRevision: (state, action) => {
3499
+ state.formRevisions[action.payload.offline_id] = action.payload;
3509
3500
  },
3510
- addUserForms: (state, action) => {
3511
- action.payload.forEach((userForm) => {
3512
- state.userForms[userForm.offline_id] = userForm;
3513
- });
3514
- },
3515
- addUserFormRevisions: (state, action) => {
3516
- action.payload.forEach((userFormRevision) => {
3517
- state.revisions[userFormRevision.offline_id] = userFormRevision;
3518
- considerCachingRevision(userFormRevision);
3519
- });
3520
- },
3521
- addUserFormRevision: (state, action) => {
3522
- state.revisions[action.payload.offline_id] = action.payload;
3523
- considerCachingRevision(action.payload);
3501
+ setFormRevisions: (state, action) => {
3502
+ state.formRevisions = {};
3503
+ for (const revision of action.payload) {
3504
+ state.formRevisions[revision.offline_id] = revision;
3505
+ }
3524
3506
  },
3525
- deleteUserFormRevision: (state, action) => {
3526
- delete state.revisions[action.payload];
3527
- delete LATEST_REVISION_CACHE[action.payload];
3507
+ addFormRevision: (state, action) => {
3508
+ if (state.formRevisions[action.payload.offline_id] !== void 0) {
3509
+ throw new Error(`Revision with offline_id ${action.payload.offline_id} already exists`);
3510
+ }
3511
+ state.formRevisions[action.payload.offline_id] = action.payload;
3528
3512
  },
3529
- deleteUserFormRevisions: (state, action) => {
3513
+ addFormRevisions: (state, action) => {
3530
3514
  for (const userFormRevision of action.payload) {
3531
- delete state.revisions[userFormRevision.offline_id];
3532
- delete LATEST_REVISION_CACHE[userFormRevision.offline_id];
3515
+ if (state.formRevisions[userFormRevision.offline_id] !== void 0) {
3516
+ throw new Error(`Revision with offline_id ${userFormRevision.offline_id} already exists`);
3517
+ }
3533
3518
  }
3534
- },
3535
- 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];
3519
+ for (const userFormRevision of action.payload) {
3520
+ state.formRevisions[userFormRevision.offline_id] = userFormRevision;
3545
3521
  }
3546
3522
  },
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];
3523
+ // UserFormRevisions do not get updated
3524
+ deleteFormRevision: (state, action) => {
3525
+ if (state.formRevisions[action.payload] === void 0) {
3526
+ throw new Error(`Revision with offline_id ${action.payload} does not exist`);
3554
3527
  }
3528
+ delete state.formRevisions[action.payload];
3555
3529
  },
3556
- setUserFormSubmissionAttachments: (state, action) => {
3557
- state.submissionAttachments = {};
3558
- for (const attachment of action.payload) {
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];
3530
+ deleteFormRevisions: (state, action) => {
3531
+ for (const offlineId of action.payload) {
3532
+ if (state.formRevisions[offlineId] === void 0) {
3533
+ throw new Error(`Revision with offline_id ${offlineId} does not exist`);
3565
3534
  }
3566
3535
  }
3536
+ for (const offlineId of action.payload) {
3537
+ delete state.formRevisions[offlineId];
3538
+ }
3567
3539
  },
3568
- setUserFormRevisionAttachments: (state, action) => {
3569
- state.revisionAttachments = {};
3540
+ // attachment related actions
3541
+ setFormRevisionAttachments: (state, action) => {
3542
+ state.attachments = {};
3570
3543
  for (const attachment of action.payload) {
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
- }
3544
+ state.attachments[attachment.offline_id] = attachment;
3578
3545
  }
3579
3546
  },
3580
- deleteUserFormSubmission: (state, action) => {
3581
- delete state.submissions[action.payload];
3547
+ addFormRevisionAttachment: (state, action) => {
3548
+ if (state.attachments[action.payload.offline_id] !== void 0) {
3549
+ throw new Error(`Attachment with offline_id ${action.payload.offline_id} already exists`);
3550
+ }
3551
+ state.attachments[action.payload.offline_id] = action.payload;
3582
3552
  },
3583
- deleteUserFormSubmissions: (state, action) => {
3584
- for (const userFormSubmission of action.payload) {
3585
- delete state.submissions[userFormSubmission.offline_id];
3553
+ addFormRevisionAttachments: (state, action) => {
3554
+ for (const attachment of action.payload) {
3555
+ if (state.attachments[attachment.offline_id] !== void 0) {
3556
+ throw new Error(`Attachment with offline_id ${attachment.offline_id} already exists`);
3557
+ }
3558
+ }
3559
+ for (const attachment of action.payload) {
3560
+ state.attachments[attachment.offline_id] = attachment;
3586
3561
  }
3587
3562
  },
3588
- addUserFormSubmissions: (state, action) => {
3589
- for (const submission of action.payload) {
3590
- state.submissions[submission.offline_id] = submission;
3563
+ deleteFormRevisionAttachment: (state, action) => {
3564
+ if (state.attachments[action.payload] === void 0) {
3565
+ throw new Error(`Attachment with offline_id ${action.payload} does not exist`);
3591
3566
  }
3567
+ delete state.attachments[action.payload];
3592
3568
  },
3593
- setUserFormSubmissions: (state, action) => {
3594
- state.submissions = {};
3595
- action.payload.forEach((submission) => {
3596
- state.submissions[submission.offline_id] = submission;
3569
+ deleteFormRevisionAttachments: (state, action) => {
3570
+ for (const offlineId of action.payload) {
3571
+ if (state.attachments[offlineId] === void 0) {
3572
+ throw new Error(`Attachment with offline_id ${offlineId} does not exist`);
3573
+ }
3574
+ }
3575
+ for (const offlineId of action.payload) {
3576
+ delete state.attachments[offlineId];
3577
+ }
3578
+ }
3579
+ }
3580
+ });
3581
+ const {
3582
+ setFormRevision,
3583
+ setFormRevisions,
3584
+ addFormRevision,
3585
+ addFormRevisions,
3586
+ deleteFormRevision,
3587
+ deleteFormRevisions,
3588
+ setFormRevisionAttachments,
3589
+ addFormRevisionAttachment,
3590
+ addFormRevisionAttachments,
3591
+ deleteFormRevisionAttachment,
3592
+ deleteFormRevisionAttachments
3593
+ } = formRevisionsSlice.actions;
3594
+ const selectFormRevisionMapping = (state) => state.formRevisionReducer.formRevisions;
3595
+ const selectFormRevisions = toolkit.createSelector(
3596
+ [selectFormRevisionMapping],
3597
+ (formRevisions) => Object.values(formRevisions)
3598
+ );
3599
+ const selectFormRevision = (formRevisionId) => (state) => {
3600
+ return state.formRevisionReducer.formRevisions[formRevisionId];
3601
+ };
3602
+ const _selectLatestFormRevision = (formRevisions, formId2) => {
3603
+ let ret = null;
3604
+ for (const candidate of Object.values(formRevisions)) {
3605
+ if (candidate.form === formId2 && (!ret || ret.revision < candidate.revision)) {
3606
+ ret = candidate;
3607
+ }
3608
+ }
3609
+ if (!ret) {
3610
+ throw new Error("No form revision found for form " + formId2);
3611
+ }
3612
+ return ret;
3613
+ };
3614
+ const selectLatestFormRevisionOfForm = restructureCreateSelectorWithArgs(
3615
+ toolkit.createSelector([selectFormRevisions, (_state, formId2) => formId2], (revisions, formId2) => {
3616
+ return revisions.filter((revision) => revision.form === formId2).sort(formRevisionSortFn).pop();
3617
+ })
3618
+ );
3619
+ const selectFormRevisionsOfForm = restructureCreateSelectorWithArgs(
3620
+ toolkit.createSelector([selectFormRevisions, (_state, formId2) => formId2], (revisions, formId2) => {
3621
+ return revisions.filter((revision) => {
3622
+ return revision.form === formId2;
3623
+ });
3624
+ })
3625
+ );
3626
+ const selectLatestFormRevisionsOfComponentTypes = restructureCreateSelectorWithArgs(
3627
+ toolkit.createSelector(
3628
+ [
3629
+ (state) => state.formReducer.forms,
3630
+ selectFormRevisionMapping,
3631
+ (_state, componentTypeIds) => componentTypeIds
3632
+ ],
3633
+ (userForms, revisions, componentTypeIds) => {
3634
+ const componentTypeIdsSet = new Set(componentTypeIds);
3635
+ const formsOfComponentTypes = {};
3636
+ const ret = {};
3637
+ for (const form of Object.values(userForms)) {
3638
+ if (form.component_type && componentTypeIdsSet.has(form.component_type)) {
3639
+ formsOfComponentTypes[form.offline_id] = form;
3640
+ }
3641
+ }
3642
+ for (const revision of Object.values(revisions)) {
3643
+ const form = formsOfComponentTypes[revision.form];
3644
+ if (!form || !form.component_type || ret[form.component_type] && formRevisionSortFn(ret[form.component_type], revision) > 0)
3645
+ continue;
3646
+ ret[form.component_type] = revision;
3647
+ }
3648
+ return ret;
3649
+ }
3650
+ )
3651
+ );
3652
+ const selectLatestFormRevisionByForm = toolkit.createSelector([selectFormRevisionMapping], (revisions) => {
3653
+ const latestRevisions = {};
3654
+ for (const revision of Object.values(revisions)) {
3655
+ const formId2 = revision.form;
3656
+ const currentLatestRevision = latestRevisions[formId2];
3657
+ if (!currentLatestRevision || currentLatestRevision.revision < revision.revision) {
3658
+ latestRevisions[formId2] = revision;
3659
+ }
3660
+ }
3661
+ return latestRevisions;
3662
+ });
3663
+ const selectUserFormRevisionAttachmentsMapping = (state) => {
3664
+ return state.formRevisionReducer.attachments;
3665
+ };
3666
+ const selectAttachmentsOfFormRevision = restructureCreateSelectorWithArgs(
3667
+ toolkit.createSelector(
3668
+ [selectUserFormRevisionAttachmentsMapping, (_state, revisionId) => revisionId],
3669
+ (attachments, revisionId) => {
3670
+ return Object.values(attachments).filter((attachment) => attachment.revision === revisionId);
3671
+ }
3672
+ )
3673
+ );
3674
+ const formRevisionReducer = formRevisionsSlice.reducer;
3675
+ const initialState$5 = {
3676
+ forms: {}
3677
+ };
3678
+ const formSlice = toolkit.createSlice({
3679
+ name: "forms",
3680
+ initialState: initialState$5,
3681
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
3682
+ reducers: {
3683
+ setForms: (state, action) => {
3684
+ state.forms = {};
3685
+ action.payload.forEach((userForm) => {
3686
+ state.forms[userForm.offline_id] = userForm;
3597
3687
  });
3598
3688
  },
3689
+ addForm: (state, action) => {
3690
+ state.forms[action.payload.offline_id] = action.payload;
3691
+ },
3692
+ addForms: (state, action) => {
3693
+ for (const userForm of action.payload) {
3694
+ state.forms[userForm.offline_id] = userForm;
3695
+ }
3696
+ },
3599
3697
  favoriteForm: (state, action) => {
3600
3698
  const { formId: formId2 } = action.payload;
3601
- const form = state.userForms[formId2];
3699
+ const form = state.forms[formId2];
3602
3700
  if (!form) {
3603
3701
  throw new Error("No form exists with the id " + formId2);
3604
3702
  }
@@ -3606,48 +3704,23 @@ var __publicField = (obj, key, value) => {
3606
3704
  },
3607
3705
  unfavoriteForm: (state, action) => {
3608
3706
  const { formId: formId2 } = action.payload;
3609
- const form = state.userForms[formId2];
3707
+ const form = state.forms[formId2];
3610
3708
  if (!form) {
3611
3709
  throw new Error("No form exists with the id " + formId2);
3612
3710
  }
3613
3711
  form.favorite = false;
3614
3712
  },
3615
- deleteUserForm: (state, action) => {
3616
- delete state.userForms[action.payload];
3713
+ deleteForm: (state, action) => {
3714
+ delete state.forms[action.payload];
3617
3715
  }
3618
3716
  }
3619
3717
  });
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(
3718
+ const { setForms, addForm, addForms, favoriteForm, unfavoriteForm, deleteForm } = formSlice.actions;
3719
+ const selectFilteredForms = restructureCreateSelectorWithArgs(
3647
3720
  toolkit.createSelector(
3648
3721
  [
3649
- (state) => state.userFormReducer.userForms,
3650
- (state) => state.userFormReducer.revisions,
3722
+ (state) => state.formReducer.forms,
3723
+ (state) => state.formRevisionReducer.formRevisions,
3651
3724
  (_state, search) => search
3652
3725
  ],
3653
3726
  (userForms, revisions, search) => {
@@ -3681,63 +3754,188 @@ var __publicField = (obj, key, value) => {
3681
3754
  { memoizeOptions: { equalityCheck: reactRedux.shallowEqual } }
3682
3755
  )
3683
3756
  );
3684
- const selectFormRevision = (revisionId) => (state) => {
3685
- return state.userFormReducer.revisions[revisionId];
3757
+ const selectForm = (formId2) => (state) => {
3758
+ return state.formReducer.forms[formId2];
3686
3759
  };
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;
3760
+ const selectFormMapping = (state) => {
3761
+ return state.formReducer.forms;
3698
3762
  };
3699
- const selectLatestFormRevision = restructureCreateSelectorWithArgs(
3763
+ const selectFormOfComponentType = restructureCreateSelectorWithArgs(
3700
3764
  toolkit.createSelector(
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);
3765
+ [selectFormMapping, (_state, componentTypeId) => componentTypeId],
3766
+ (userForms, componentTypeId) => {
3767
+ return Object.values(userForms).find((userForm) => userForm.component_type === componentTypeId);
3707
3768
  }
3708
3769
  )
3709
3770
  );
3710
- const 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
- })
3771
+ const selectFormsCount = toolkit.createSelector([selectFormMapping], (userForms) => {
3772
+ return Object.keys(userForms).length;
3773
+ });
3774
+ const selectGeneralFormCount = toolkit.createSelector([selectFormMapping], (userForms) => {
3775
+ return Object.values(userForms).filter((form) => !form.component_type).length;
3776
+ });
3777
+ const formReducer = formSlice.reducer;
3778
+ const initialState$4 = {
3779
+ formSubmissions: {},
3780
+ attachments: {}
3781
+ };
3782
+ const formSubmissionSlice = toolkit.createSlice({
3783
+ name: "formSubmissions",
3784
+ initialState: initialState$4,
3785
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
3786
+ reducers: {
3787
+ setFormSubmission: (state, action) => {
3788
+ state.formSubmissions[action.payload.offline_id] = action.payload;
3789
+ },
3790
+ setFormSubmissions: (state, action) => {
3791
+ state.formSubmissions = {};
3792
+ for (const submission of action.payload) {
3793
+ state.formSubmissions[submission.offline_id] = submission;
3794
+ }
3795
+ },
3796
+ addFormSubmission: (state, action) => {
3797
+ if (action.payload.offline_id in state.formSubmissions) {
3798
+ throw new Error(`Submission with offline_id ${action.payload.offline_id} already exists`);
3799
+ }
3800
+ state.formSubmissions[action.payload.offline_id] = action.payload;
3801
+ },
3802
+ addFormSubmissions: (state, action) => {
3803
+ for (const submission of action.payload) {
3804
+ if (state.formSubmissions[submission.offline_id] !== void 0) {
3805
+ throw new Error(`Submission with offline_id ${submission.offline_id} already exists`);
3806
+ }
3807
+ }
3808
+ for (const submission of action.payload) {
3809
+ state.formSubmissions[submission.offline_id] = submission;
3810
+ }
3811
+ },
3812
+ updateFormSubmission: (state, action) => {
3813
+ if (state.formSubmissions[action.payload.offline_id] === void 0) {
3814
+ throw new Error(`Submission with offline_id ${action.payload.offline_id} does not exist`);
3815
+ }
3816
+ state.formSubmissions[action.payload.offline_id] = action.payload;
3817
+ },
3818
+ updateFormSubmissions: (state, action) => {
3819
+ for (const submission of action.payload) {
3820
+ if (state.formSubmissions[submission.offline_id] === void 0) {
3821
+ throw new Error(`Submission with offline_id ${submission.offline_id} does not exist`);
3822
+ }
3823
+ }
3824
+ for (const submission of action.payload) {
3825
+ state.formSubmissions[submission.offline_id] = submission;
3826
+ }
3827
+ },
3828
+ deleteFormSubmission: (state, action) => {
3829
+ if (state.formSubmissions[action.payload] === void 0) {
3830
+ throw new Error(`Submission with offline_id ${action.payload} does not exist`);
3831
+ }
3832
+ delete state.formSubmissions[action.payload];
3833
+ },
3834
+ deleteFormSubmissions: (state, action) => {
3835
+ for (const offlineId of action.payload) {
3836
+ if (state.formSubmissions[offlineId] === void 0) {
3837
+ throw new Error(`Submission with offline_id ${offlineId} does not exist`);
3838
+ }
3839
+ delete state.formSubmissions[offlineId];
3840
+ }
3841
+ for (const offlineId of action.payload) {
3842
+ delete state.formSubmissions[offlineId];
3843
+ }
3844
+ },
3845
+ // Attachments
3846
+ addFormSubmissionAttachment: (state, action) => {
3847
+ if (state.attachments[action.payload.offline_id] !== void 0) {
3848
+ throw new Error(`Attachment with offline_id ${action.payload.offline_id} already exists`);
3849
+ }
3850
+ state.attachments[action.payload.offline_id] = action.payload;
3851
+ },
3852
+ addFormSubmissionAttachments: (state, action) => {
3853
+ for (const attachment of action.payload) {
3854
+ if (state.attachments[attachment.offline_id] !== void 0) {
3855
+ throw new Error(`Attachment with offline_id ${attachment.offline_id} already exists`);
3856
+ }
3857
+ }
3858
+ for (const attachment of action.payload) {
3859
+ state.attachments[attachment.offline_id] = attachment;
3860
+ }
3861
+ },
3862
+ // We only need a multi set for attachments because they are not updated, only added and deleted
3863
+ setFormSubmissionAttachments: (state, action) => {
3864
+ state.attachments = {};
3865
+ for (const attachment of action.payload) {
3866
+ state.attachments[attachment.offline_id] = attachment;
3867
+ }
3868
+ },
3869
+ updateFormSubmissionAttachments: (state, action) => {
3870
+ for (const attachment of action.payload) {
3871
+ if (state.attachments[attachment.offline_id] === void 0) {
3872
+ throw new Error(`Attachment with offline_id ${attachment.offline_id} does not exist`);
3873
+ }
3874
+ }
3875
+ for (const attachment of action.payload) {
3876
+ state.attachments[attachment.offline_id] = attachment;
3877
+ }
3878
+ },
3879
+ // The delete actions for UserFormSubmissionAttachments are not used in the app, but are included for completeness
3880
+ // Could be used if editing a submission is ever supported, will be applicable for supporting tip tap content in submissions
3881
+ deleteFormSubmissionAttachment: (state, action) => {
3882
+ if (state.attachments[action.payload] === void 0) {
3883
+ throw new Error(`Attachment with offline_id ${action.payload} does not exist`);
3884
+ }
3885
+ delete state.attachments[action.payload];
3886
+ },
3887
+ deleteFormSubmissionAttachments: (state, action) => {
3888
+ for (const offlineId of action.payload) {
3889
+ if (state.attachments[offlineId] === void 0) {
3890
+ throw new Error(`Attachment with offline_id ${offlineId} does not exist`);
3891
+ }
3892
+ delete state.attachments[offlineId];
3893
+ }
3894
+ }
3895
+ }
3896
+ });
3897
+ const {
3898
+ setFormSubmission,
3899
+ setFormSubmissions,
3900
+ addFormSubmission,
3901
+ addFormSubmissions,
3902
+ updateFormSubmission,
3903
+ updateFormSubmissions,
3904
+ deleteFormSubmission,
3905
+ deleteFormSubmissions,
3906
+ addFormSubmissionAttachment,
3907
+ addFormSubmissionAttachments,
3908
+ setFormSubmissionAttachments,
3909
+ updateFormSubmissionAttachments,
3910
+ deleteFormSubmissionAttachment,
3911
+ deleteFormSubmissionAttachments
3912
+ } = formSubmissionSlice.actions;
3913
+ const selectFormSubmissionsMapping = (state) => {
3914
+ return state.formSubmissionReducer.formSubmissions;
3915
+ };
3916
+ const selectFormSubmissions = toolkit.createSelector(
3917
+ [selectFormSubmissionsMapping],
3918
+ (submissions) => {
3919
+ return Object.values(submissions);
3920
+ }
3726
3921
  );
3727
- const selectSubmissionsForForm = restructureCreateSelectorWithArgs(
3922
+ const selectFormSubmission = (submissionId) => (state) => {
3923
+ return state.formSubmissionReducer.formSubmissions[submissionId];
3924
+ };
3925
+ const selectFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
3728
3926
  toolkit.createSelector(
3729
- [selectSubmissions, selectRevisionMapping, (_state, formId2) => formId2],
3927
+ [selectFormSubmissions, selectFormRevisionMapping, (_state, formId2) => formId2],
3730
3928
  (submissions, revisionMapping, formId2) => {
3731
- return Object.values(submissions).filter((submission) => {
3929
+ return submissions.filter((submission) => {
3732
3930
  const revision = revisionMapping[submission.form_revision];
3733
3931
  return (revision == null ? void 0 : revision.form) === formId2;
3734
3932
  });
3735
3933
  }
3736
3934
  )
3737
3935
  );
3738
- const selectSubmissionsForIssue = restructureCreateSelectorWithArgs(
3936
+ const selectFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
3739
3937
  toolkit.createSelector(
3740
- [(state) => state.userFormReducer.submissions, (_state, issueId) => issueId],
3938
+ [selectFormSubmissions, (_state, issueId) => issueId],
3741
3939
  (submissions, issueId) => {
3742
3940
  return Object.values(submissions).filter((submission) => {
3743
3941
  return submission.issue === issueId;
@@ -3745,9 +3943,9 @@ var __publicField = (obj, key, value) => {
3745
3943
  }
3746
3944
  )
3747
3945
  );
3748
- const selectSubmissionsForComponent = restructureCreateSelectorWithArgs(
3946
+ const selectFormSubmissionsOfComponent = restructureCreateSelectorWithArgs(
3749
3947
  toolkit.createSelector(
3750
- [selectSubmissions, (_state, componentId) => componentId],
3948
+ [selectFormSubmissions, (_state, componentId) => componentId],
3751
3949
  (submissions, componentId) => {
3752
3950
  return submissions.filter((submission) => {
3753
3951
  return submission.component === componentId;
@@ -3755,8 +3953,8 @@ var __publicField = (obj, key, value) => {
3755
3953
  }
3756
3954
  )
3757
3955
  );
3758
- const selectComponentSubmissionMapping = toolkit.createSelector(
3759
- [selectSubmissionMapping, selectComponentsMapping],
3956
+ const selectFormSubmissionsByComponents = toolkit.createSelector(
3957
+ [selectFormSubmissionsMapping, selectComponentsMapping],
3760
3958
  (submissions, components) => {
3761
3959
  var _a2;
3762
3960
  const componentSubmissionMapping = {};
@@ -3769,63 +3967,27 @@ var __publicField = (obj, key, value) => {
3769
3967
  (_a2 = componentSubmissionMapping[submission.component]) == null ? void 0 : _a2.push(submission);
3770
3968
  }
3771
3969
  }
3772
- return componentSubmissionMapping;
3773
- }
3774
- );
3775
- const selectUserFormMapping = (state) => {
3776
- return state.userFormReducer.userForms;
3777
- };
3778
- const selectComponentTypeForm = restructureCreateSelectorWithArgs(
3779
- toolkit.createSelector(
3780
- [selectUserFormMapping, (_state, componentTypeId) => componentTypeId],
3781
- (userForms, componentTypeId) => {
3782
- return Object.values(userForms).find((userForm) => userForm.component_type === componentTypeId);
3783
- }
3784
- )
3970
+ return componentSubmissionMapping;
3971
+ }
3785
3972
  );
3786
- const selectLatestRevisionsFromComponentTypeIds = restructureCreateSelectorWithArgs(
3973
+ const selectFormSubmissionAttachmentsMapping = (state) => {
3974
+ return state.formSubmissionReducer.attachments;
3975
+ };
3976
+ const selectAttachmentsOfFormSubmission = restructureCreateSelectorWithArgs(
3787
3977
  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;
3978
+ [selectFormSubmissionAttachmentsMapping, (_state, submissionId) => submissionId],
3979
+ (attachmentsMapping, submissionId) => {
3980
+ return Object.values(attachmentsMapping).filter((attachment) => attachment.submission === submissionId);
3802
3981
  }
3803
3982
  )
3804
3983
  );
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;
3823
- const initialState$2 = {
3984
+ const formSubmissionReducer = formSubmissionSlice.reducer;
3985
+ const initialState$3 = {
3824
3986
  emailDomains: {}
3825
3987
  };
3826
3988
  const emailDomainsSlice = toolkit.createSlice({
3827
3989
  name: "emailDomains",
3828
- initialState: initialState$2,
3990
+ initialState: initialState$3,
3829
3991
  reducers: {
3830
3992
  setEmailDomains: (state, action) => {
3831
3993
  const emailDomains = {};
@@ -3852,15 +4014,15 @@ var __publicField = (obj, key, value) => {
3852
4014
  (ed1, ed2) => ed1.domain.localeCompare(ed2.domain)
3853
4015
  );
3854
4016
  const emailDomainsReducer = emailDomainsSlice.reducer;
3855
- const initialState$1 = {
4017
+ const initialState$2 = {
3856
4018
  documents: {},
3857
4019
  attachments: {}
3858
4020
  };
3859
4021
  const documentSlice = toolkit.createSlice({
3860
4022
  name: "documents",
3861
- initialState: initialState$1,
4023
+ initialState: initialState$2,
3862
4024
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
3863
- Object.assign(state, initialState$1);
4025
+ Object.assign(state, initialState$2);
3864
4026
  }),
3865
4027
  reducers: {
3866
4028
  setDocuments: (state, action) => {
@@ -4076,6 +4238,62 @@ var __publicField = (obj, key, value) => {
4076
4238
  )
4077
4239
  );
4078
4240
  const documentsReducer = documentSlice.reducer;
4241
+ const initialState$1 = {
4242
+ teams: {}
4243
+ };
4244
+ const teamSlice = toolkit.createSlice({
4245
+ name: "teams",
4246
+ initialState: initialState$1,
4247
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$1)),
4248
+ reducers: {
4249
+ setTeam: (state, action) => {
4250
+ state.teams[action.payload.offline_id] = action.payload;
4251
+ },
4252
+ setTeams: (state, action) => {
4253
+ state.teams = {};
4254
+ for (const team of action.payload) {
4255
+ state.teams[team.offline_id] = team;
4256
+ }
4257
+ },
4258
+ addTeam: (state, action) => {
4259
+ if (state.teams[action.payload.offline_id]) {
4260
+ throw new Error(`Team with offline_id ${action.payload.offline_id} already exists`);
4261
+ }
4262
+ state.teams[action.payload.offline_id] = action.payload;
4263
+ },
4264
+ updateTeam: (state, action) => {
4265
+ if (!state.teams[action.payload.offline_id]) {
4266
+ throw new Error(`Team with offline_id ${action.payload.offline_id} does not exist`);
4267
+ }
4268
+ state.teams[action.payload.offline_id] = action.payload;
4269
+ },
4270
+ deleteTeam: (state, action) => {
4271
+ delete state.teams[action.payload];
4272
+ }
4273
+ }
4274
+ });
4275
+ const { setTeam, setTeams, addTeam, updateTeam, deleteTeam } = teamSlice.actions;
4276
+ const selectTeamsMapping = (state) => state.teamReducer.teams;
4277
+ const selectTeams = toolkit.createSelector([selectTeamsMapping], (teams) => {
4278
+ return Object.values(teams);
4279
+ });
4280
+ const selectTeam = (teamId) => (state) => {
4281
+ return state.teamReducer.teams[teamId];
4282
+ };
4283
+ const selectTeamsOfOrganization = restructureCreateSelectorWithArgs(
4284
+ toolkit.createSelector(
4285
+ [selectTeams, (_state, organizationId) => organizationId],
4286
+ (teams, organizationId) => {
4287
+ return teams.filter((team) => team.organization === organizationId);
4288
+ }
4289
+ )
4290
+ );
4291
+ const selectTeamsOfUser = restructureCreateSelectorWithArgs(
4292
+ toolkit.createSelector([selectTeams, (_state, userId) => userId], (teams, userId) => {
4293
+ return teams.filter((team) => team.members.includes(userId));
4294
+ })
4295
+ );
4296
+ const teamReducer = teamSlice.reducer;
4079
4297
  const initialState = {
4080
4298
  version: 0
4081
4299
  };
@@ -4117,12 +4335,15 @@ var __publicField = (obj, key, value) => {
4117
4335
  projectFileReducer,
4118
4336
  rehydratedReducer,
4119
4337
  settingReducer,
4120
- userFormReducer,
4338
+ formReducer,
4339
+ formRevisionReducer,
4340
+ formSubmissionReducer,
4121
4341
  userReducer,
4122
4342
  workspaceReducer,
4123
4343
  emailDomainsReducer,
4124
4344
  licenseReducer,
4125
- documentsReducer
4345
+ documentsReducer,
4346
+ teamReducer
4126
4347
  };
4127
4348
  const overmapReducer = toolkit.combineReducers(overmapReducers);
4128
4349
  const resetStore = "RESET";
@@ -4170,9 +4391,7 @@ var __publicField = (obj, key, value) => {
4170
4391
  throw new Error(`Failed to update index_workspace of issue ${issue.offline_id} to main workspace`);
4171
4392
  }
4172
4393
  }
4173
- const indexedForms = Object.values(draft.userFormReducer.userForms).filter(
4174
- (form) => form.index_workspace === workspaceId
4175
- );
4394
+ const indexedForms = Object.values(draft.formReducer.forms).filter((form) => form.index_workspace === workspaceId);
4176
4395
  for (const form of indexedForms) {
4177
4396
  form.index_workspace = mainWorkspace.offline_id;
4178
4397
  }
@@ -6363,6 +6582,7 @@ var __publicField = (obj, key, value) => {
6363
6582
  }
6364
6583
  if (currentOrgId) {
6365
6584
  await this.client.organizations.fetchInitialOrganizationData(currentOrgId, false);
6585
+ void this.client.teams.refreshStore();
6366
6586
  }
6367
6587
  if (!isProjectIdValid) {
6368
6588
  if (validProjects.length !== 0) {
@@ -6800,7 +7020,7 @@ var __publicField = (obj, key, value) => {
6800
7020
  ...revisionAttachmentPayload,
6801
7021
  file: URL.createObjectURL(image)
6802
7022
  };
6803
- store.dispatch(addUserFormRevisionAttachment(offlinePayload));
7023
+ store.dispatch(addFormRevisionAttachment(offlinePayload));
6804
7024
  return attach;
6805
7025
  });
6806
7026
  });
@@ -6836,8 +7056,8 @@ var __publicField = (obj, key, value) => {
6836
7056
  submitted_at: submittedAt
6837
7057
  };
6838
7058
  const { store } = this.client;
6839
- store.dispatch(addUserForm(retForm));
6840
- store.dispatch(addUserFormRevision(retRevision));
7059
+ store.dispatch(addForm(retForm));
7060
+ store.dispatch(addFormRevision(retRevision));
6841
7061
  const formPromise = this.enqueueRequest({
6842
7062
  description: "Create form",
6843
7063
  method: HttpMethod.POST,
@@ -6855,8 +7075,8 @@ var __publicField = (obj, key, value) => {
6855
7075
  });
6856
7076
  const attachImagesPromises = this.getAttachImagePromises(images, offlineRevisionPayload.offline_id);
6857
7077
  void formPromise.catch((e) => {
6858
- store.dispatch(deleteUserForm(retForm.offline_id));
6859
- store.dispatch(deleteUserFormRevision(retRevision.offline_id));
7078
+ store.dispatch(deleteForm(retForm.offline_id));
7079
+ store.dispatch(deleteFormRevision(retRevision.offline_id));
6860
7080
  throw e;
6861
7081
  });
6862
7082
  const settledPromise = Promise.all([formPromise, ...attachImagesPromises]).then(() => formPromise);
@@ -6899,7 +7119,7 @@ var __publicField = (obj, key, value) => {
6899
7119
  form: formId2,
6900
7120
  submitted_at: (/* @__PURE__ */ new Date()).toISOString()
6901
7121
  };
6902
- store.dispatch(addUserFormRevision(fullRevision));
7122
+ store.dispatch(addFormRevision(fullRevision));
6903
7123
  const promise = this.enqueueRequest({
6904
7124
  description: "Create form revision",
6905
7125
  method: HttpMethod.PATCH,
@@ -6913,9 +7133,9 @@ var __publicField = (obj, key, value) => {
6913
7133
  });
6914
7134
  const attachImagesPromises = this.getAttachImagePromises(images, offlineRevision.offline_id);
6915
7135
  void promise.then((result) => {
6916
- store.dispatch(addUserFormRevision(result));
7136
+ store.dispatch(setFormRevision(result));
6917
7137
  }).catch(() => {
6918
- store.dispatch(deleteUserFormRevision(fullRevision.offline_id));
7138
+ store.dispatch(deleteFormRevision(fullRevision.offline_id));
6919
7139
  });
6920
7140
  const settledPromise = Promise.all([promise, ...attachImagesPromises]).then(() => promise);
6921
7141
  return [fullRevision, settledPromise];
@@ -6957,19 +7177,19 @@ var __publicField = (obj, key, value) => {
6957
7177
  async delete(formId2) {
6958
7178
  const { store } = this.client;
6959
7179
  const state = store.getState();
6960
- const userForm = selectUserForm(formId2)(state);
7180
+ const userForm = selectForm(formId2)(state);
6961
7181
  if (!userForm) {
6962
7182
  throw new Error("Expected userForm to exist");
6963
7183
  }
6964
- const userFormSubmissions = selectSubmissionsForForm(formId2)(state);
7184
+ const userFormSubmissions = selectFormSubmissionsOfForm(formId2)(state);
6965
7185
  if (userFormSubmissions && userFormSubmissions.length > 0) {
6966
- store.dispatch(deleteUserFormSubmissions(userFormSubmissions));
7186
+ store.dispatch(deleteFormSubmissions(userFormSubmissions.map(({ offline_id }) => offline_id)));
6967
7187
  }
6968
- const userFormRevisions = selectRevisionsForForm(formId2)(state);
7188
+ const userFormRevisions = selectFormRevisionsOfForm(formId2)(state);
6969
7189
  if (userFormRevisions && userFormRevisions.length > 0) {
6970
- store.dispatch(deleteUserFormRevisions(userFormRevisions));
7190
+ store.dispatch(deleteFormRevisions(userFormRevisions.map(({ offline_id }) => offline_id)));
6971
7191
  }
6972
- store.dispatch(deleteUserForm(formId2));
7192
+ store.dispatch(deleteForm(formId2));
6973
7193
  try {
6974
7194
  return await this.enqueueRequest({
6975
7195
  description: "Delete form",
@@ -6979,12 +7199,12 @@ var __publicField = (obj, key, value) => {
6979
7199
  blocks: []
6980
7200
  });
6981
7201
  } catch (e) {
6982
- store.dispatch(addUserForm(userForm));
7202
+ store.dispatch(addForm(userForm));
6983
7203
  if (userFormRevisions && userFormRevisions.length > 0) {
6984
- store.dispatch(addUserFormRevisions(userFormRevisions));
7204
+ store.dispatch(addFormRevisions(userFormRevisions));
6985
7205
  }
6986
7206
  if (userFormSubmissions && userFormSubmissions.length > 0) {
6987
- store.dispatch(addUserFormSubmissions(userFormSubmissions));
7207
+ store.dispatch(addFormSubmissions(userFormSubmissions));
6988
7208
  }
6989
7209
  throw e;
6990
7210
  }
@@ -6998,16 +7218,15 @@ var __publicField = (obj, key, value) => {
6998
7218
  blockers: [],
6999
7219
  blocks: []
7000
7220
  });
7001
- store.dispatch(addUserForms(Object.values(result.forms)));
7002
- store.dispatch(addUserFormRevisions(Object.values(result.revisions)));
7003
- store.dispatch(setUserFormRevisionAttachments(Object.values(result.attachments)));
7221
+ store.dispatch(setForms(Object.values(result.forms)));
7222
+ store.dispatch(setFormRevisions(Object.values(result.revisions)));
7223
+ store.dispatch(setFormRevisionAttachments(Object.values(result.attachments)));
7004
7224
  }
7005
7225
  }
7006
7226
  const isArrayOfFiles = (value) => {
7007
7227
  return Array.isArray(value) && value[0] instanceof File;
7008
7228
  };
7009
- const separateFilesFromValues = (payload) => {
7010
- const { values } = payload;
7229
+ const separateFilesFromValues = (values) => {
7011
7230
  const files = {};
7012
7231
  const newValues = {};
7013
7232
  for (const key in values) {
@@ -7022,17 +7241,13 @@ var __publicField = (obj, key, value) => {
7022
7241
  newValues[key] = value;
7023
7242
  }
7024
7243
  }
7025
- const payloadWithoutFiles = {
7026
- ...payload,
7027
- values: newValues
7028
- };
7029
- return { payloadWithoutFiles, files };
7244
+ return { values: newValues, files };
7030
7245
  };
7031
7246
  class UserFormSubmissionService extends BaseApiService {
7032
7247
  constructor() {
7033
7248
  super(...arguments);
7034
7249
  // Attach files to submission, after uploading them to S3
7035
- __publicField(this, "getAttachFilesPromises", (files, payload) => {
7250
+ __publicField(this, "getAttachFilesPromises", (files, submission) => {
7036
7251
  const { store } = this.client;
7037
7252
  return Object.entries(files).map(async ([key, fileArray]) => {
7038
7253
  const attachResults = [];
@@ -7042,24 +7257,27 @@ var __publicField = (obj, key, value) => {
7042
7257
  const [fileProps] = await this.client.files.uploadFileToS3(sha1);
7043
7258
  const submissionAttachmentPayload = offline({
7044
7259
  ...fileProps,
7045
- submission: payload.offline_id,
7260
+ submission: submission.offline_id,
7046
7261
  field_identifier: key
7047
7262
  });
7048
7263
  const attach = await this.enqueueRequest({
7049
7264
  description: "Attach file to form submission",
7050
7265
  method: HttpMethod.POST,
7051
- url: `/forms/submission/${payload.offline_id}/attachments/`,
7266
+ url: `/forms/submission/${submission.offline_id}/attachments/`,
7052
7267
  payload: submissionAttachmentPayload,
7053
- blockers: [payload.component, payload.component_stage, payload.issue, payload.form_revision].filter(
7054
- (x) => x !== void 0
7055
- ),
7268
+ blockers: [
7269
+ submission.component,
7270
+ submission.component_stage,
7271
+ submission.issue,
7272
+ submission.form_revision
7273
+ ].filter((x) => x !== void 0),
7056
7274
  blocks: [submissionAttachmentPayload.offline_id]
7057
7275
  });
7058
7276
  const offlinePayload = {
7059
7277
  ...submissionAttachmentPayload,
7060
7278
  file: URL.createObjectURL(file)
7061
7279
  };
7062
- store.dispatch(addUserFormSubmissionAttachment(offlinePayload));
7280
+ store.dispatch(addFormSubmissionAttachment(offlinePayload));
7063
7281
  attachResults.push(attach);
7064
7282
  }
7065
7283
  return attachResults;
@@ -7073,71 +7291,168 @@ var __publicField = (obj, key, value) => {
7073
7291
  if (!activeProjectId) {
7074
7292
  throw new Error("Expected an active project");
7075
7293
  }
7076
- const { payloadWithoutFiles, files } = separateFilesFromValues(payload);
7294
+ const { values, files } = separateFilesFromValues(payload.values);
7295
+ const offlineSubmission = {
7296
+ ...payload,
7297
+ values,
7298
+ created_by: state.userReducer.currentUser.id,
7299
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString()
7300
+ };
7077
7301
  const promise = this.enqueueRequest({
7078
7302
  description: "Respond to form",
7079
7303
  method: HttpMethod.POST,
7080
7304
  url: `/forms/revisions/${payload.form_revision}/respond/`,
7081
- payload: { ...payloadWithoutFiles, project: activeProjectId },
7305
+ payload: { ...offlineSubmission, project: activeProjectId },
7082
7306
  blockers: [payload.issue, payload.component, payload.component_stage, "add-form-entry"].filter(
7083
7307
  (x) => x !== void 0
7084
7308
  ),
7085
7309
  blocks: [payload.offline_id]
7086
7310
  });
7087
- const attachFilesPromises = this.getAttachFilesPromises(files, payload);
7088
- const now = (/* @__PURE__ */ new Date()).toISOString();
7089
- const fullOfflineResult = {
7090
- ...payload,
7091
- created_by: state.userReducer.currentUser.id,
7092
- created_at: now,
7093
- updated_at: now
7094
- };
7095
- const offlineResultWithoutFiles = {
7096
- ...fullOfflineResult,
7097
- ...payloadWithoutFiles
7098
- };
7099
- store.dispatch(updateOrCreateUserFormSubmission(offlineResultWithoutFiles));
7311
+ const attachFilesPromises = this.getAttachFilesPromises(files, offlineSubmission);
7312
+ store.dispatch(addFormSubmission(offlineSubmission));
7100
7313
  void promise.then((result) => {
7101
7314
  store.dispatch(addActiveProjectFormSubmissionsCount(1));
7102
- store.dispatch(updateOrCreateUserFormSubmission(result));
7315
+ store.dispatch(setFormSubmission(result));
7103
7316
  return result;
7104
7317
  }).catch(() => {
7105
- store.dispatch(deleteUserFormSubmission(payload.offline_id));
7318
+ store.dispatch(deleteFormSubmission(payload.offline_id));
7106
7319
  store.dispatch(addActiveProjectFormSubmissionsCount(-1));
7107
7320
  });
7108
7321
  const settledPromise = Promise.all([promise, ...attachFilesPromises]).then(() => promise);
7109
- return [fullOfflineResult, settledPromise];
7322
+ return [offlineSubmission, settledPromise];
7110
7323
  }
7111
- update(submission) {
7324
+ // Note currently the bulkAdd method is specific to form submissions for components
7325
+ // TODO: adapt the support bulk adding to any model type
7326
+ async bulkAdd(args) {
7327
+ const { formRevision, values: argsValues, componentOfflineIds } = args;
7112
7328
  const { store } = this.client;
7113
- const { payloadWithoutFiles, files } = separateFilesFromValues(submission);
7114
- if (!("created_by" in payloadWithoutFiles) || !("created_at" in payloadWithoutFiles)) {
7115
- throw new Error("Expected payloadWithoutFiles to have created_by and created_at fields.");
7329
+ const offlineSubmissions = [];
7330
+ const offlineAttachments = [];
7331
+ const submissionOfflineIds = [];
7332
+ const submissionsPayload = [];
7333
+ const attachmentsPayload = [];
7334
+ const { values, files } = separateFilesFromValues(argsValues);
7335
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7336
+ const createdBy = store.getState().userReducer.currentUser.id;
7337
+ for (const component_id of componentOfflineIds) {
7338
+ const submission = offline({
7339
+ form_revision: formRevision,
7340
+ values,
7341
+ created_by: createdBy,
7342
+ submitted_at: submittedAt,
7343
+ component: component_id
7344
+ });
7345
+ submissionOfflineIds.push(submission.offline_id);
7346
+ submissionsPayload.push({ offline_id: submission.offline_id, component_id });
7347
+ offlineSubmissions.push(submission);
7348
+ for (const [fieldIdentifier, fileArray] of Object.entries(files)) {
7349
+ for (const file of fileArray) {
7350
+ const sha1 = await hashFile(file);
7351
+ await this.client.files.addCache(file, sha1);
7352
+ const offlineAttachment = offline({
7353
+ file_name: file.name,
7354
+ file_sha1: sha1,
7355
+ file: URL.createObjectURL(file),
7356
+ submission: submission.offline_id,
7357
+ field_identifier: fieldIdentifier
7358
+ });
7359
+ offlineAttachments.push(offlineAttachment);
7360
+ attachmentsPayload.push({
7361
+ offline_id: offlineAttachment.offline_id,
7362
+ submission_id: submission.offline_id,
7363
+ sha1,
7364
+ name: file.name,
7365
+ field_identifier: fieldIdentifier
7366
+ });
7367
+ }
7368
+ }
7369
+ }
7370
+ const filesRecord = {};
7371
+ for (const file of Object.values(files).flat()) {
7372
+ const sha1 = await hashFile(file);
7373
+ filesRecord[sha1] = {
7374
+ sha1,
7375
+ extension: file.name.split(".").pop() || "",
7376
+ file_type: file.type,
7377
+ size: file.size
7378
+ };
7116
7379
  }
7380
+ store.dispatch(addFormSubmissions(offlineSubmissions));
7381
+ store.dispatch(addFormSubmissionAttachments(offlineAttachments));
7382
+ const promise = this.enqueueRequest({
7383
+ description: "Bulk add form submissions",
7384
+ method: HttpMethod.POST,
7385
+ url: `/forms/revisions/${formRevision}/bulk-respond/`,
7386
+ payload: {
7387
+ form_data: values,
7388
+ submitted_at: submittedAt,
7389
+ submissions: submissionsPayload,
7390
+ attachments: attachmentsPayload,
7391
+ files: Object.values(filesRecord)
7392
+ },
7393
+ blockers: componentOfflineIds,
7394
+ blocks: submissionOfflineIds
7395
+ });
7396
+ promise.then(({ submissions, attachments, presigned_urls }) => {
7397
+ store.dispatch(updateFormSubmissions(submissions));
7398
+ store.dispatch(updateFormSubmissionAttachments(attachments));
7399
+ for (const [sha1, presigned_url] of Object.entries(presigned_urls)) {
7400
+ const file = filesRecord[sha1];
7401
+ if (!file)
7402
+ continue;
7403
+ void this.enqueueRequest({
7404
+ url: presigned_url.url,
7405
+ description: "Upload file",
7406
+ method: HttpMethod.POST,
7407
+ isExternalUrl: true,
7408
+ isAuthNeeded: false,
7409
+ attachmentHash: sha1,
7410
+ blockers: [`s3-${file.sha1}.${file.extension}`],
7411
+ blocks: [sha1],
7412
+ s3url: presigned_url
7413
+ });
7414
+ }
7415
+ }).catch(() => {
7416
+ store.dispatch(deleteFormSubmissions(submissionOfflineIds));
7417
+ store.dispatch(deleteFormSubmissionAttachments(offlineAttachments.map((x) => x.offline_id)));
7418
+ });
7419
+ return [offlineSubmissions, promise.then(({ submissions }) => submissions)];
7420
+ }
7421
+ update(submission) {
7422
+ const { store } = this.client;
7423
+ const { values, files } = separateFilesFromValues(submission.values);
7117
7424
  const attachFilesPromises = this.getAttachFilesPromises(files, submission);
7118
- const fullResult = {
7119
- ...payloadWithoutFiles,
7120
- updated_at: (/* @__PURE__ */ new Date()).toISOString()
7425
+ const offlineSubmission = {
7426
+ ...submission,
7427
+ values
7121
7428
  };
7122
- store.dispatch(updateOrCreateUserFormSubmission(fullResult));
7429
+ const submissionToBeUpdated = store.getState().formSubmissionReducer.formSubmissions[submission.offline_id];
7430
+ store.dispatch(updateFormSubmission(offlineSubmission));
7123
7431
  const promise = this.enqueueRequest({
7124
7432
  description: "Patch form submission",
7125
7433
  method: HttpMethod.PATCH,
7126
7434
  url: `/forms/submissions/${submission.offline_id}/`,
7127
- payload: fullResult,
7128
- blockers: [fullResult.issue, fullResult.component, fullResult.component_stage].filter(
7435
+ payload: offlineSubmission,
7436
+ blockers: [offlineSubmission.issue, offlineSubmission.component, offlineSubmission.component_stage].filter(
7129
7437
  (x) => x !== void 0
7130
7438
  ),
7131
- blocks: [fullResult.offline_id]
7439
+ blocks: [offlineSubmission.offline_id]
7440
+ });
7441
+ promise.then((createdSubmission) => {
7442
+ store.dispatch(setFormSubmission(createdSubmission));
7443
+ }).catch(() => {
7444
+ store.dispatch(setFormSubmission(submissionToBeUpdated));
7132
7445
  });
7133
- return Promise.all([promise, ...attachFilesPromises]).then(() => promise);
7446
+ return [offlineSubmission, Promise.all([promise, ...attachFilesPromises]).then(() => promise)];
7134
7447
  }
7135
7448
  async delete(submissionId) {
7136
7449
  const { store } = this.client;
7137
7450
  const state = store.getState();
7138
- const submission = state.userFormReducer.submissions[submissionId];
7139
- store.dispatch(deleteUserFormSubmission(submissionId));
7451
+ const submission = state.formSubmissionReducer.formSubmissions[submissionId];
7452
+ const submissionAttachments = selectAttachmentsOfFormSubmission(submissionId)(state);
7453
+ store.dispatch(deleteFormSubmission(submissionId));
7140
7454
  store.dispatch(addActiveProjectFormSubmissionsCount(-1));
7455
+ store.dispatch(deleteFormSubmissionAttachments(submissionAttachments.map((x) => x.offline_id)));
7141
7456
  try {
7142
7457
  return await this.enqueueRequest({
7143
7458
  description: "Delete user form submissions",
@@ -7147,10 +7462,9 @@ var __publicField = (obj, key, value) => {
7147
7462
  blocks: []
7148
7463
  });
7149
7464
  } catch (e) {
7150
- if (submission) {
7151
- store.dispatch(addActiveProjectFormSubmissionsCount(1));
7152
- store.dispatch(updateOrCreateUserFormSubmission(submission));
7153
- }
7465
+ store.dispatch(addActiveProjectFormSubmissionsCount(1));
7466
+ store.dispatch(addFormSubmission(submission));
7467
+ store.dispatch(addFormSubmissionAttachments(submissionAttachments));
7154
7468
  throw e;
7155
7469
  }
7156
7470
  }
@@ -7164,7 +7478,7 @@ var __publicField = (obj, key, value) => {
7164
7478
  blockers: [],
7165
7479
  blocks: []
7166
7480
  });
7167
- store.dispatch(setUserFormSubmissions(submissions));
7481
+ store.dispatch(setFormSubmissions(submissions));
7168
7482
  const attachments = await this.enqueueRequest({
7169
7483
  description: "Fetch form attachments",
7170
7484
  method: HttpMethod.GET,
@@ -7172,7 +7486,7 @@ var __publicField = (obj, key, value) => {
7172
7486
  blockers: [],
7173
7487
  blocks: []
7174
7488
  });
7175
- store.dispatch(setUserFormSubmissionAttachments(attachments));
7489
+ store.dispatch(setFormSubmissionAttachments(attachments));
7176
7490
  }
7177
7491
  }
7178
7492
  class WorkspaceService extends BaseApiService {
@@ -7896,6 +8210,142 @@ var __publicField = (obj, key, value) => {
7896
8210
  });
7897
8211
  }
7898
8212
  }
8213
+ class TeamService extends BaseApiService {
8214
+ add(teamPayload) {
8215
+ const { store } = this.client;
8216
+ const state = store.getState();
8217
+ const activeOrganizationId = state.organizationReducer.activeOrganizationId;
8218
+ if (!activeOrganizationId) {
8219
+ throw new Error(`Expected active organization to be set, got ${activeOrganizationId}`);
8220
+ }
8221
+ const offlineTeam = offline({
8222
+ ...teamPayload,
8223
+ organization: activeOrganizationId,
8224
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString()
8225
+ // TODO: uncomment once supported
8226
+ // created_by: state.userReducer.currentUser.id,
8227
+ });
8228
+ store.dispatch(addTeam(offlineTeam));
8229
+ const promise = this.enqueueRequest({
8230
+ description: "Create team",
8231
+ method: HttpMethod.POST,
8232
+ url: `/organizations/${activeOrganizationId}/teams/`,
8233
+ payload: offlineTeam,
8234
+ // No blocks since users and organizations are not offline
8235
+ blockers: [],
8236
+ blocks: [offlineTeam.offline_id]
8237
+ });
8238
+ promise.then((createdTeam) => {
8239
+ store.dispatch(setTeam(createdTeam));
8240
+ }).catch(() => {
8241
+ store.dispatch(deleteTeam(offlineTeam.offline_id));
8242
+ });
8243
+ return [offlineTeam, promise];
8244
+ }
8245
+ // TODO: @Audiopolis / Magnus - should we pass a offline_id as one arg and a UpdatedTeamProps as a second arg instead of this set up?
8246
+ update(team) {
8247
+ const { store } = this.client;
8248
+ const teamToBeUpdated = store.getState().teamReducer.teams[team.offline_id];
8249
+ const offlineUpdatedTeam = {
8250
+ ...teamToBeUpdated,
8251
+ ...team
8252
+ };
8253
+ store.dispatch(updateTeam(offlineUpdatedTeam));
8254
+ const promise = this.enqueueRequest({
8255
+ description: "Update team",
8256
+ method: HttpMethod.PATCH,
8257
+ url: `/organizations/teams/${team.offline_id}/`,
8258
+ payload: offlineUpdatedTeam,
8259
+ blockers: [team.offline_id],
8260
+ blocks: [team.offline_id]
8261
+ });
8262
+ promise.then((updatedTeam) => {
8263
+ store.dispatch(setTeam(updatedTeam));
8264
+ }).catch(() => {
8265
+ store.dispatch(setTeam(teamToBeUpdated));
8266
+ });
8267
+ return [offlineUpdatedTeam, promise];
8268
+ }
8269
+ async delete(teamId) {
8270
+ const { store } = this.client;
8271
+ const state = store.getState();
8272
+ const team = state.teamReducer.teams[teamId];
8273
+ if (!team) {
8274
+ throw new Error(`Expected team with id ${teamId} to exist`);
8275
+ }
8276
+ store.dispatch(deleteTeam(teamId));
8277
+ try {
8278
+ return await this.enqueueRequest({
8279
+ description: "Delete team",
8280
+ method: HttpMethod.DELETE,
8281
+ url: `/organizations/teams/${teamId}/`,
8282
+ blockers: [teamId],
8283
+ blocks: [teamId]
8284
+ });
8285
+ } catch (e) {
8286
+ store.dispatch(setTeam(team));
8287
+ throw e;
8288
+ }
8289
+ }
8290
+ async setMembers(teamId, members) {
8291
+ const { store } = this.client;
8292
+ const team = store.getState().teamReducer.teams[teamId];
8293
+ if (!team) {
8294
+ throw new Error(`Expected team with id ${teamId} to exist`);
8295
+ }
8296
+ if (members.length !== new Set(members).size) {
8297
+ throw new Error("Duplicate members found in the list");
8298
+ }
8299
+ store.dispatch(updateTeam({ ...team, members }));
8300
+ const promise = this.enqueueRequest({
8301
+ description: "Set team members",
8302
+ method: HttpMethod.PUT,
8303
+ url: `/organizations/teams/${teamId}/set-members/`,
8304
+ payload: {
8305
+ users: members
8306
+ },
8307
+ blockers: [teamId],
8308
+ blocks: [teamId]
8309
+ });
8310
+ promise.catch(() => {
8311
+ store.dispatch(setTeam(team));
8312
+ });
8313
+ return promise;
8314
+ }
8315
+ async addMembers(teamId, members) {
8316
+ const { store } = this.client;
8317
+ const team = store.getState().teamReducer.teams[teamId];
8318
+ if (!team) {
8319
+ throw new Error(`Expected team with id ${teamId} to exist`);
8320
+ }
8321
+ const newMembers = [...team.members, ...members];
8322
+ return this.setMembers(teamId, newMembers);
8323
+ }
8324
+ async removeMembers(teamId, members) {
8325
+ const { store } = this.client;
8326
+ const team = store.getState().teamReducer.teams[teamId];
8327
+ if (!team) {
8328
+ throw new Error(`Expected team with id ${teamId} to exist`);
8329
+ }
8330
+ const newMembers = team.members.filter((member) => !members.includes(member));
8331
+ return this.setMembers(teamId, newMembers);
8332
+ }
8333
+ async refreshStore() {
8334
+ const { store } = this.client;
8335
+ const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
8336
+ if (!activeOrganizationId) {
8337
+ throw new Error(`Expected active organization to be set, got ${activeOrganizationId}`);
8338
+ }
8339
+ const result = await this.enqueueRequest({
8340
+ description: "Fetch teams",
8341
+ method: HttpMethod.GET,
8342
+ url: `/organizations/${activeOrganizationId}/teams/`,
8343
+ blockers: [],
8344
+ blocks: []
8345
+ });
8346
+ store.dispatch(setTeams(result));
8347
+ }
8348
+ }
7899
8349
  class OvermapSDK {
7900
8350
  constructor(apiUrl, store) {
7901
8351
  __publicField(this, "API_URL");
@@ -7925,6 +8375,7 @@ var __publicField = (obj, key, value) => {
7925
8375
  __publicField(this, "emailDomains", new EmailDomainsService(this));
7926
8376
  __publicField(this, "licenses", new LicenseService(this));
7927
8377
  __publicField(this, "documents", new DocumentService(this));
8378
+ __publicField(this, "teams", new TeamService(this));
7928
8379
  this.API_URL = apiUrl;
7929
8380
  this.store = store;
7930
8381
  }
@@ -7966,7 +8417,7 @@ var __publicField = (obj, key, value) => {
7966
8417
  const patchfieldBorder = "_patchfieldBorder_1w0fq_73";
7967
8418
  const title = "_title_1w0fq_73";
7968
8419
  const error = "_error_1w0fq_89";
7969
- const styles$c = {
8420
+ const styles$d = {
7970
8421
  description: description$2,
7971
8422
  floatingButtonContainer: floatingButtonContainer$2,
7972
8423
  FullScreenImageContainer: FullScreenImageContainer$2,
@@ -8087,7 +8538,7 @@ var __publicField = (obj, key, value) => {
8087
8538
  const longIconButton$1 = "_longIconButton_10o76_36";
8088
8539
  const previewImage$1 = "_previewImage_10o76_42";
8089
8540
  const FullScreenImage$1 = "_FullScreenImage_10o76_12";
8090
- const styles$b = {
8541
+ const styles$c = {
8091
8542
  description: description$1,
8092
8543
  floatingButtonContainer: floatingButtonContainer$1,
8093
8544
  FullScreenImageContainer: FullScreenImageContainer$1,
@@ -8111,7 +8562,7 @@ var __publicField = (obj, key, value) => {
8111
8562
  /* @__PURE__ */ jsxRuntime.jsx(
8112
8563
  "button",
8113
8564
  {
8114
- className: styles$b.FullScreenImageContainer,
8565
+ className: styles$c.FullScreenImageContainer,
8115
8566
  type: "button",
8116
8567
  onClick: () => {
8117
8568
  setShowPreview(false);
@@ -8119,7 +8570,7 @@ var __publicField = (obj, key, value) => {
8119
8570
  children: /* @__PURE__ */ jsxRuntime.jsx(
8120
8571
  "img",
8121
8572
  {
8122
- className: styles$b.FullScreenImage,
8573
+ className: styles$c.FullScreenImage,
8123
8574
  src: url,
8124
8575
  alt: name,
8125
8576
  onClick: (e) => {
@@ -8129,11 +8580,11 @@ var __publicField = (obj, key, value) => {
8129
8580
  )
8130
8581
  }
8131
8582
  ),
8132
- /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { className: styles$b.TopBarContainer, align: "center", children: [
8583
+ /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { className: styles$c.TopBarContainer, align: "center", children: [
8133
8584
  /* @__PURE__ */ jsxRuntime.jsx(
8134
8585
  blocks.IconButton,
8135
8586
  {
8136
- className: styles$b.longIconButton,
8587
+ className: styles$c.longIconButton,
8137
8588
  variant: "soft",
8138
8589
  "aria-label": "Exit preview",
8139
8590
  onClick: () => {
@@ -8142,11 +8593,11 @@ var __publicField = (obj, key, value) => {
8142
8593
  children: /* @__PURE__ */ jsxRuntime.jsx(blocks.RiIcon, { icon: "RiArrowLeftLine" })
8143
8594
  }
8144
8595
  ),
8145
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { className: styles$b.fileName, children: name }),
8596
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { className: styles$c.fileName, children: name }),
8146
8597
  /* @__PURE__ */ jsxRuntime.jsx(
8147
8598
  blocks.IconButton,
8148
8599
  {
8149
- className: styles$b.longIconButton,
8600
+ className: styles$c.longIconButton,
8150
8601
  variant: "soft",
8151
8602
  "aria-label": `Download ${name}`,
8152
8603
  onClick: handleDownload,
@@ -8174,7 +8625,7 @@ var __publicField = (obj, key, value) => {
8174
8625
  /* @__PURE__ */ jsxRuntime.jsx(
8175
8626
  "img",
8176
8627
  {
8177
- className: styles$b.previewImage,
8628
+ className: styles$c.previewImage,
8178
8629
  src: resolvedImageURL,
8179
8630
  alt: resolvedImage.name,
8180
8631
  onClick: () => {
@@ -8202,7 +8653,7 @@ var __publicField = (obj, key, value) => {
8202
8653
  const { helpText, children, severity } = props;
8203
8654
  return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { direction: "column", gap: "1", children: [
8204
8655
  children,
8205
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Flex, { direction: "column", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { size: "1", severity, className: styles$b.description, children: helpText }) })
8656
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Flex, { direction: "column", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { size: "1", severity, className: styles$c.description, children: helpText }) })
8206
8657
  ] });
8207
8658
  };
8208
8659
  const InputWithLabelAndHelpText = (props) => {
@@ -8436,6 +8887,9 @@ var __publicField = (obj, key, value) => {
8436
8887
  function RiCalendarLine(props) {
8437
8888
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M9 1V3H15V1H17V3H21C21.5523 3 22 3.44772 22 4V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V4C2 3.44772 2.44772 3 3 3H7V1H9ZM20 11H4V19H20V11ZM7 5H4V9H20V5H17V7H15V5H9V7H7V5Z" }, "child": [] }] })(props);
8438
8889
  }
8890
+ function RiQrCodeLine(props) {
8891
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M16 17V16H13V13H16V15H18V17H17V19H15V21H13V18H15V17H16ZM21 21H17V19H19V17H21V21ZM3 3H11V11H3V3ZM5 5V9H9V5H5ZM13 3H21V11H13V3ZM15 5V9H19V5H15ZM3 13H11V21H3V13ZM5 15V19H9V15H5ZM18 13H21V15H18V13ZM6 6H8V8H6V6ZM6 16H8V18H6V16ZM16 6H18V8H16V6Z" }, "child": [] }] })(props);
8892
+ }
8439
8893
  function RiFileCopyLine(props) {
8440
8894
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M6.9998 6V3C6.9998 2.44772 7.44752 2 7.9998 2H19.9998C20.5521 2 20.9998 2.44772 20.9998 3V17C20.9998 17.5523 20.5521 18 19.9998 18H16.9998V20.9991C16.9998 21.5519 16.5499 22 15.993 22H4.00666C3.45059 22 3 21.5554 3 20.9991L3.0026 7.00087C3.0027 6.44811 3.45264 6 4.00942 6H6.9998ZM5.00242 8L5.00019 20H14.9998V8H5.00242ZM8.9998 6H16.9998V16H18.9998V4H8.9998V6Z" }, "child": [] }] })(props);
8441
8895
  }
@@ -9339,9 +9793,9 @@ var __publicField = (obj, key, value) => {
9339
9793
  return React__namespace.createElement("div", { ...insetProps, ref: forwardedRef, className: classNames("rt-Inset", className, withBreakpoints(side, "rt-r-side"), withBreakpoints(clip, "rt-r-clip"), withBreakpoints(p, "rt-r-p"), withBreakpoints(px, "rt-r-px"), withBreakpoints(py, "rt-r-py"), withBreakpoints(pt, "rt-r-pt"), withBreakpoints(pr, "rt-r-pr"), withBreakpoints(pb, "rt-r-pb"), withBreakpoints(pl, "rt-r-pl"), withMarginProps(marginProps)) });
9340
9794
  });
9341
9795
  Inset.displayName = "Inset";
9342
- const sizes$7 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
9796
+ const sizes$8 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
9343
9797
  const headingPropDefs = {
9344
- size: { type: "enum", values: sizes$7, default: "6", responsive: true },
9798
+ size: { type: "enum", values: sizes$8, default: "6", responsive: true },
9345
9799
  weight: { ...weightProp, default: "bold" },
9346
9800
  align: alignProp,
9347
9801
  trim: trimProp,
@@ -9354,9 +9808,9 @@ var __publicField = (obj, key, value) => {
9354
9808
  return React__namespace.createElement($5e63c961fc1ce211$export$8c6ed5c666ac1360, { "data-accent-color": color, ...headingProps, ref: forwardedRef, className: classNames("rt-Heading", className, withBreakpoints(size, "rt-r-size"), withBreakpoints(weight, "rt-r-weight"), withBreakpoints(align, "rt-r-ta"), withBreakpoints(trim, "rt-r-lt"), { "rt-high-contrast": highContrast }, withMarginProps(marginProps)) }, asChild ? children : React__namespace.createElement(Tag, null, children));
9355
9809
  });
9356
9810
  Heading.displayName = "Heading";
9357
- const sizes$6 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
9811
+ const sizes$7 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
9358
9812
  const textPropDefs = {
9359
- size: { type: "enum", values: sizes$6, default: void 0, responsive: true },
9813
+ size: { type: "enum", values: sizes$7, default: void 0, responsive: true },
9360
9814
  weight: weightProp,
9361
9815
  align: alignProp,
9362
9816
  trim: trimProp,
@@ -9369,6 +9823,21 @@ var __publicField = (obj, key, value) => {
9369
9823
  return React__namespace.createElement($5e63c961fc1ce211$export$8c6ed5c666ac1360, { "data-accent-color": color, ...textProps, ref: forwardedRef, className: classNames("rt-Text", className, withBreakpoints(size, "rt-r-size"), withBreakpoints(weight, "rt-r-weight"), withBreakpoints(align, "rt-r-ta"), withBreakpoints(trim, "rt-r-lt"), { "rt-high-contrast": highContrast }, withMarginProps(marginProps)) }, asChild ? children : React__namespace.createElement(Tag, null, children));
9370
9824
  });
9371
9825
  Text.displayName = "Text";
9826
+ const sizes$6 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
9827
+ const variants$4 = ["solid", "soft", "outline", "ghost"];
9828
+ const codePropDefs = {
9829
+ size: { type: "enum", values: sizes$6, default: void 0, responsive: true },
9830
+ variant: { type: "enum", values: variants$4, default: "soft" },
9831
+ weight: weightProp,
9832
+ color: colorProp,
9833
+ highContrast: highContrastProp
9834
+ };
9835
+ const Code = React__namespace.forwardRef((props, forwardedRef) => {
9836
+ const { rest: marginRest, ...marginProps } = extractMarginProps(props);
9837
+ const { className, size = codePropDefs.size.default, variant = codePropDefs.variant.default, weight = codePropDefs.weight.default, color = codePropDefs.color.default, highContrast = codePropDefs.highContrast.default, ...codeProps } = marginRest;
9838
+ return React__namespace.createElement("code", { "data-accent-color": color, ...codeProps, ref: forwardedRef, className: classNames("rt-Code", className, withBreakpoints(size, "rt-r-size"), `rt-variant-${variant}`, withBreakpoints(weight, "rt-r-weight"), { "rt-high-contrast": highContrast }, withMarginProps(marginProps)) });
9839
+ });
9840
+ Code.displayName = "Code";
9372
9841
  const Em = React__namespace.forwardRef((props, forwardedRef) => React__namespace.createElement("em", { ...props, ref: forwardedRef, className: classNames("rt-Em", props.className) }));
9373
9842
  Em.displayName = "Em";
9374
9843
  const Strong = React__namespace.forwardRef((props, forwardedRef) => React__namespace.createElement("strong", { ...props, ref: forwardedRef, className: classNames("rt-Strong", props.className) }));
@@ -11759,7 +12228,7 @@ var __publicField = (obj, key, value) => {
11759
12228
  });
11760
12229
  const clickableLinkContainer = "_clickableLinkContainer_1ace7_1";
11761
12230
  const TextFieldInputCopy = "_TextFieldInputCopy_1ace7_5";
11762
- const styles$a = {
12231
+ const styles$b = {
11763
12232
  clickableLinkContainer,
11764
12233
  TextFieldInputCopy
11765
12234
  };
@@ -11788,13 +12257,13 @@ var __publicField = (obj, key, value) => {
11788
12257
  placeholder: field.placeholder,
11789
12258
  color
11790
12259
  }
11791
- ) : /* @__PURE__ */ jsxRuntime.jsxs(TextField$1.Root, { className: styles$a.clickableLinkContainer, children: [
12260
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(TextField$1.Root, { className: styles$b.clickableLinkContainer, children: [
11792
12261
  /* @__PURE__ */ jsxRuntime.jsx(
11793
12262
  "div",
11794
12263
  {
11795
12264
  className: classNames$1(
11796
12265
  "rt-TextFieldInput rt-r-size-2 rt-variant-surface",
11797
- styles$a.TextFieldInputCopy
12266
+ styles$b.TextFieldInputCopy
11798
12267
  ),
11799
12268
  children: /* @__PURE__ */ jsxRuntime.jsx(
11800
12269
  Linkify,
@@ -12366,8 +12835,7 @@ var __publicField = (obj, key, value) => {
12366
12835
  description: "List possible options for the user to select from.",
12367
12836
  required: true,
12368
12837
  identifier: `${path}options`,
12369
- minimum_length: 2,
12370
- maximum_length: 20
12838
+ minimum_length: 2
12371
12839
  }),
12372
12840
  showDirectly: true
12373
12841
  }
@@ -12486,6 +12954,158 @@ var __publicField = (obj, key, value) => {
12486
12954
  __publicField(_MultiSelectField, "fieldTypeDescription", "Allows the user to select a multiple options from a list of options.");
12487
12955
  __publicField(_MultiSelectField, "Icon", RiCheckboxLine);
12488
12956
  let MultiSelectField = _MultiSelectField;
12957
+ const QrScannerWrapper = "_QrScannerWrapper_1puz3_1";
12958
+ const styles$a = {
12959
+ QrScannerWrapper
12960
+ };
12961
+ const QrInput = React.memo((props) => {
12962
+ const [{ inputId, labelId, label, helpText, size, severity, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
12963
+ const [showQrScanner, setShowQrScanner] = React.useState(false);
12964
+ const value = fieldProps.value;
12965
+ const handleQrScan = React.useCallback(
12966
+ (data) => {
12967
+ fieldProps.onChange({ target: { value: data } });
12968
+ setShowQrScanner(false);
12969
+ },
12970
+ [fieldProps]
12971
+ );
12972
+ const handleClearScanResult = React.useCallback(() => {
12973
+ fieldProps.onChange({ target: { value: "" } });
12974
+ }, [fieldProps]);
12975
+ const handleScanButtonClicked = React.useCallback(() => {
12976
+ setShowQrScanner(true);
12977
+ }, []);
12978
+ const handleQrScannerClose = React.useCallback(() => {
12979
+ setShowQrScanner(false);
12980
+ }, []);
12981
+ return /* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsxRuntime.jsxs(
12982
+ InputWithLabel,
12983
+ {
12984
+ size,
12985
+ severity,
12986
+ inputId,
12987
+ labelId,
12988
+ label: showInputOnly ? label : "",
12989
+ image: showInputOnly ? void 0 : field.image,
12990
+ flexProps: { direction: "column", justify: "start", align: "start", gap: "1" },
12991
+ children: [
12992
+ /* @__PURE__ */ jsxRuntime.jsx(
12993
+ blocks.Overlay,
12994
+ {
12995
+ open: showQrScanner,
12996
+ content: () => /* @__PURE__ */ jsxRuntime.jsx(QrScanner, { onQrScan: handleQrScan, onClose: handleQrScannerClose }),
12997
+ onOpenChange: setShowQrScanner
12998
+ }
12999
+ ),
13000
+ /* @__PURE__ */ jsxRuntime.jsxs(Flex, { width: "max-content", gap: "1", align: "center", children: [
13001
+ /* @__PURE__ */ jsxRuntime.jsxs(blocks.Button, { ...rest, variant: "soft", onClick: handleScanButtonClicked, children: [
13002
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.RiIcon, { icon: "RiQrCodeLine" }),
13003
+ "Scan"
13004
+ ] }),
13005
+ value && /* @__PURE__ */ jsxRuntime.jsx(Text, { color: "jade", size: "1", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.RiIcon, { icon: "RiCheckLine", style: { verticalAlign: "bottom" } }) })
13006
+ ] }),
13007
+ value && /* @__PURE__ */ jsxRuntime.jsx(Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(Flex, { width: "max-content", gap: "2", align: "center", children: [
13008
+ /* @__PURE__ */ jsxRuntime.jsx(Code, { color: "gray", highContrast: true, children: value }),
13009
+ /* @__PURE__ */ jsxRuntime.jsx(
13010
+ blocks.IconButton,
13011
+ {
13012
+ severity: "info",
13013
+ variant: "ghost",
13014
+ "aria-label": "delete",
13015
+ size: "small",
13016
+ onClick: handleClearScanResult,
13017
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.RiIcon, { icon: "RiCloseLine" })
13018
+ }
13019
+ )
13020
+ ] }) })
13021
+ ]
13022
+ }
13023
+ ) });
13024
+ });
13025
+ QrInput.displayName = "QrInput";
13026
+ const QrScanner = React.memo((props) => {
13027
+ const { onQrScan, onClose } = props;
13028
+ const videoRef = React.useRef(null);
13029
+ const [isScannerLoading, setIsScannerLoading] = React.useState(false);
13030
+ React.useEffect(() => {
13031
+ if (!videoRef.current)
13032
+ return;
13033
+ const qrScanner = new QrScannerAPI(
13034
+ videoRef.current,
13035
+ (result) => {
13036
+ const data = result.data;
13037
+ onQrScan(data);
13038
+ qrScanner.destroy();
13039
+ },
13040
+ {
13041
+ highlightCodeOutline: true,
13042
+ highlightScanRegion: true,
13043
+ maxScansPerSecond: 1
13044
+ }
13045
+ );
13046
+ setIsScannerLoading(true);
13047
+ qrScanner.start().then(() => {
13048
+ setIsScannerLoading(false);
13049
+ }).catch(() => {
13050
+ setIsScannerLoading(false);
13051
+ });
13052
+ }, [onQrScan]);
13053
+ return /* @__PURE__ */ jsxRuntime.jsxs(
13054
+ Flex,
13055
+ {
13056
+ className: styles$a.QrScannerWrapper,
13057
+ width: "100%",
13058
+ height: "100%",
13059
+ direction: "column",
13060
+ gap: "2",
13061
+ justify: "center",
13062
+ position: "relative",
13063
+ children: [
13064
+ /* @__PURE__ */ jsxRuntime.jsx(Flex, { width: "100%", position: "absolute", top: "0", p: "2", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { "aria-label": "close", variant: "soft", severity: "info", highContrast: true, onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.RiIcon, { icon: "RiCloseLine" }) }) }),
13065
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { style: { maxWidth: "100%", maxHeight: "100%" }, position: "relative", children: [
13066
+ /* @__PURE__ */ jsxRuntime.jsx("video", { ref: videoRef, style: { width: "100%", height: "100%" } }),
13067
+ isScannerLoading && /* @__PURE__ */ jsxRuntime.jsx(
13068
+ Flex,
13069
+ {
13070
+ position: "absolute",
13071
+ inset: "0",
13072
+ style: { background: "var(--color-background)" },
13073
+ justify: "center",
13074
+ align: "center",
13075
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Spinner, {})
13076
+ }
13077
+ )
13078
+ ] })
13079
+ ]
13080
+ }
13081
+ );
13082
+ });
13083
+ QrScanner.displayName = "QrScanner";
13084
+ const emptyQrField = {
13085
+ ...emptyBaseField,
13086
+ type: "qr"
13087
+ };
13088
+ const _QrField = class _QrField extends BaseField {
13089
+ constructor(options) {
13090
+ super({ ...options, type: "qr" });
13091
+ __publicField(this, "onlyValidateAfterTouched", false);
13092
+ }
13093
+ serialize() {
13094
+ return super._serialize();
13095
+ }
13096
+ static deserialize(data) {
13097
+ if (data.type !== "qr")
13098
+ throw new Error("Type mismatch.");
13099
+ return new _QrField(data);
13100
+ }
13101
+ getInput(props) {
13102
+ return /* @__PURE__ */ jsxRuntime.jsx(QrInput, { ...props, field: this });
13103
+ }
13104
+ };
13105
+ __publicField(_QrField, "fieldTypeName", "QR");
13106
+ __publicField(_QrField, "fieldTypeDescription", "Used for scanning/reading QR codes.");
13107
+ __publicField(_QrField, "Icon", RiQrCodeLine);
13108
+ let QrField = _QrField;
12489
13109
  const FieldInputCloner = React.memo((props) => {
12490
13110
  const { field, ...rest } = props;
12491
13111
  const [{ value: identifier }] = formik.useField(field.options.clonedFieldIdentifier);
@@ -13743,6 +14363,7 @@ var __publicField = (obj, key, value) => {
13743
14363
  text: TextField,
13744
14364
  custom: CustomField,
13745
14365
  upload: UploadField,
14366
+ qr: QrField,
13746
14367
  // TODO: Underscore
13747
14368
  "multi-string": MultiStringField,
13748
14369
  "multi-select": MultiSelectField
@@ -13756,6 +14377,7 @@ var __publicField = (obj, key, value) => {
13756
14377
  text: emptyTextField,
13757
14378
  custom: emptyCustomField,
13758
14379
  upload: emptyUploadField,
14380
+ qr: emptyQrField,
13759
14381
  // TODO: Underscore
13760
14382
  "multi-string": emptyMultiStringField,
13761
14383
  "multi-select": emptyMultiSelectField
@@ -13843,7 +14465,7 @@ var __publicField = (obj, key, value) => {
13843
14465
  return /* @__PURE__ */ jsxRuntime.jsx(Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { direction: "column", gap: "3", children: [
13844
14466
  /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { direction: "column", children: [
13845
14467
  /* @__PURE__ */ jsxRuntime.jsx(Heading, { as: "h3", size: "3", children: label }),
13846
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { className: styles$b.description, children: description2 })
14468
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { className: styles$c.description, children: description2 })
13847
14469
  ] }),
13848
14470
  inputs
13849
14471
  ] }) });
@@ -14030,7 +14652,7 @@ var __publicField = (obj, key, value) => {
14030
14652
  };
14031
14653
  const useAttachImagesToFormRevisionFields = (revision) => {
14032
14654
  const { sdk } = useSDK();
14033
- const attachments = useAppSelector(selectRevisionAttachments((revision == null ? void 0 : revision.offline_id) ?? ""));
14655
+ const attachments = useAppSelector(selectAttachmentsOfFormRevision((revision == null ? void 0 : revision.offline_id) ?? ""));
14034
14656
  return React.useMemo(() => {
14035
14657
  if (!revision || !attachments)
14036
14658
  return revision;
@@ -14086,7 +14708,7 @@ var __publicField = (obj, key, value) => {
14086
14708
  [schema.title]
14087
14709
  );
14088
14710
  const Description = React.useMemo(
14089
- () => typeof schema.description === "string" ? /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { className: styles$b.description, children: schema.description }) : schema.description,
14711
+ () => typeof schema.description === "string" ? /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { className: styles$c.description, children: schema.description }) : schema.description,
14090
14712
  [schema.description]
14091
14713
  );
14092
14714
  const inputs = useFieldInputs(schema.fields, { formId: formId2, disabled: readonly });
@@ -14102,7 +14724,7 @@ var __publicField = (obj, key, value) => {
14102
14724
  !hideDescription && Description
14103
14725
  ] }) }),
14104
14726
  inputs,
14105
- !readonly && /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { className: styles$b.floatingButtonContainer, align: "center", justify: "end", gap: "2", children: [
14727
+ !readonly && /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { className: styles$c.floatingButtonContainer, align: "center", justify: "end", gap: "2", children: [
14106
14728
  cancelText && /* @__PURE__ */ jsxRuntime.jsx(blocks.Button, { severity: "info", ...buttonProps, type: "button", onClick: onCancel, children: cancelText }),
14107
14729
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Button, { ...buttonProps, type: "submit", disabled: !formik$1.isValid, children: submitText })
14108
14730
  ] })
@@ -14127,7 +14749,7 @@ var __publicField = (obj, key, value) => {
14127
14749
  return formRevisionToSchema(revisionWithImages, { readonly: true });
14128
14750
  }, [revisionWithImages]);
14129
14751
  const submissionValuesWithAttachments = React.useMemo(() => {
14130
- const attachments = selectSubmissionAttachments(submission.offline_id)(sdk.store.getState()) ?? [];
14752
+ const attachments = selectAttachmentsOfFormSubmission(submission.offline_id)(sdk.store.getState()) ?? [];
14131
14753
  const downloadedAttachments = {};
14132
14754
  for (const attachment of attachments) {
14133
14755
  const promise = sdk.files.fetchFileFromUrl(attachment.file, attachment.file_sha1, attachment.file_name);
@@ -14177,8 +14799,8 @@ var __publicField = (obj, key, value) => {
14177
14799
  }
14178
14800
  return ret;
14179
14801
  }, [filter, maxResults, ownerFilter]);
14180
- const userForms = useAppSelector(selectFilteredUserForms(ownerFilterOptions)) ?? [];
14181
- const userFormMapping = useAppSelector(selectUserFormMapping);
14802
+ const userForms = useAppSelector(selectFilteredForms(ownerFilterOptions)) ?? [];
14803
+ const userFormMapping = useAppSelector(selectFormMapping);
14182
14804
  const attachableUserForms = userForms.filter((form) => !form.component_type);
14183
14805
  const attachableUserFormMapping = Object.values(userFormMapping).filter(
14184
14806
  (form) => !form.component_type
@@ -14211,7 +14833,7 @@ var __publicField = (obj, key, value) => {
14211
14833
  const handleChange = React.useCallback((e) => {
14212
14834
  setFilter(e.currentTarget.value);
14213
14835
  }, []);
14214
- const numberOfForms = useAppSelector(selectNumberOfGeneralUserForms) || 0;
14836
+ const numberOfForms = useAppSelector(selectGeneralFormCount) || 0;
14215
14837
  const numberOfHiddenForms = numberOfForms - attachableUserForms.length;
14216
14838
  const overflowMessage = attachableUserForms.length == maxResults && numberOfHiddenForms > 0 ? `Only the first ${maxResults} results are shown (${numberOfHiddenForms} hidden)` : numberOfHiddenForms > 0 && `${numberOfHiddenForms} hidden forms`;
14217
14839
  return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { ref, direction: "column", gap: "2", children: [
@@ -14305,16 +14927,13 @@ var __publicField = (obj, key, value) => {
14305
14927
  const { submission, onSubmissionClick, compact, labelType, rowDecorator } = props;
14306
14928
  const currentUser = useAppSelector(selectCurrentUser);
14307
14929
  const createdBy = useAppSelector(selectUser("created_by" in submission ? submission.created_by : currentUser.id));
14308
- const dateToUse = getCreatedAtOrSubmittedAtDate(submission);
14309
- const formattedDateTime = isToday(dateToUse) ? dateToUse.toLocaleTimeString([], {
14310
- hour: "2-digit",
14311
- minute: "2-digit"
14312
- }) : getLocalDateString(dateToUse);
14930
+ const dateToUse = submission.submitted_at;
14931
+ const formattedDateTime = getLocalDateString(dateToUse);
14313
14932
  const revision = useAppSelector(selectFormRevision(submission.form_revision));
14314
14933
  if (!revision) {
14315
14934
  throw new Error(`Could not find revision ${submission.form_revision} for submission ${submission.offline_id}.`);
14316
14935
  }
14317
- const latestRevisionNumber = (_a2 = useAppSelector(selectLatestFormRevision(revision.form))) == null ? void 0 : _a2.revision;
14936
+ const latestRevisionNumber = (_a2 = useAppSelector(selectLatestFormRevisionOfForm(revision.form))) == null ? void 0 : _a2.revision;
14318
14937
  const creatorProfileSrc = useFileSrc({
14319
14938
  file: (createdBy == null ? void 0 : createdBy.profile.file) ?? null,
14320
14939
  fileSha1: (createdBy == null ? void 0 : createdBy.profile.file_sha1) ?? null
@@ -14345,10 +14964,6 @@ var __publicField = (obj, key, value) => {
14345
14964
  return row;
14346
14965
  });
14347
14966
  FormSubmissionBrowserEntry.displayName = "FormSubmissionBrowserEntry";
14348
- const getCreatedAtOrSubmittedAtDate = (submission) => {
14349
- const date = "created_at" in submission ? submission.created_at : submission.submitted_at;
14350
- return new Date(date);
14351
- };
14352
14967
  const FormSubmissionBrowser = React.memo((props) => {
14353
14968
  const {
14354
14969
  formId: formId2,
@@ -14362,10 +14977,10 @@ var __publicField = (obj, key, value) => {
14362
14977
  if (!!formId2 === !!propSubmissions) {
14363
14978
  throw new Error("Either formId or submissions must be provided, but not both.");
14364
14979
  }
14365
- const submissions = useAppSelector(propSubmissions ? () => propSubmissions : selectSubmissionsForForm(formId2));
14980
+ const submissions = useAppSelector(propSubmissions ? () => propSubmissions : selectFormSubmissionsOfForm(formId2));
14366
14981
  const sortedSubmissions = React.useMemo(
14367
14982
  () => submissions == null ? void 0 : submissions.sort((a, b) => {
14368
- return getCreatedAtOrSubmittedAtDate(b).getTime() - getCreatedAtOrSubmittedAtDate(a).getTime();
14983
+ return a.submitted_at.localeCompare(b.submitted_at);
14369
14984
  }),
14370
14985
  [submissions]
14371
14986
  );
@@ -15457,12 +16072,12 @@ var __publicField = (obj, key, value) => {
15457
16072
  });
15458
16073
  const previewSchema = React.useMemo(() => formRevisionToSchema(formik$1.values), [formik$1.values]);
15459
16074
  return /* @__PURE__ */ jsxRuntime.jsx(Tabs.Root, { ref, defaultValue: "edit", children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { direction: "column", gap: "2", children: [
15460
- showTabs && /* @__PURE__ */ jsxRuntime.jsxs(Tabs.List, { className: classNames$1(styles$c.tabsList, tabsListClassName), children: [
15461
- /* @__PURE__ */ jsxRuntime.jsx(Tabs.Trigger, { className: styles$c.tabTrigger, value: "edit", children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { align: "center", gap: "2", children: [
16075
+ showTabs && /* @__PURE__ */ jsxRuntime.jsxs(Tabs.List, { className: classNames$1(styles$d.tabsList, tabsListClassName), children: [
16076
+ /* @__PURE__ */ jsxRuntime.jsx(Tabs.Trigger, { className: styles$d.tabTrigger, value: "edit", children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { align: "center", gap: "2", children: [
15462
16077
  /* @__PURE__ */ jsxRuntime.jsx(blocks.RiIcon, { icon: "RiPencilLine" }),
15463
16078
  "Edit"
15464
16079
  ] }) }),
15465
- /* @__PURE__ */ jsxRuntime.jsx(Tabs.Trigger, { className: styles$c.tabTrigger, value: "preview", children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { align: "center", gap: "2", children: [
16080
+ /* @__PURE__ */ jsxRuntime.jsx(Tabs.Trigger, { className: styles$d.tabTrigger, value: "preview", children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { align: "center", gap: "2", children: [
15466
16081
  /* @__PURE__ */ jsxRuntime.jsx(blocks.RiIcon, { icon: "RiEyeLine" }),
15467
16082
  "Preview"
15468
16083
  ] }) })
@@ -15486,8 +16101,8 @@ var __publicField = (obj, key, value) => {
15486
16101
  render: ({ setValue, value, meta }) => /* @__PURE__ */ jsxRuntime.jsx(InputWithHelpText, { severity: "danger", helpText: meta.error ?? null, children: /* @__PURE__ */ jsxRuntime.jsx(
15487
16102
  blocks.Input,
15488
16103
  {
15489
- className: classNames$1(styles$c.title, {
15490
- [styles$c.error]: meta.error
16104
+ className: classNames$1(styles$d.title, {
16105
+ [styles$d.error]: meta.error
15491
16106
  }),
15492
16107
  placeholder: "Form title",
15493
16108
  value,
@@ -15509,7 +16124,7 @@ var __publicField = (obj, key, value) => {
15509
16124
  render: ({ setValue, value }) => /* @__PURE__ */ jsxRuntime.jsx(
15510
16125
  blocks.TextArea,
15511
16126
  {
15512
- className: styles$c.description,
16127
+ className: styles$d.description,
15513
16128
  placeholder: "Explain the purpose of this form",
15514
16129
  value,
15515
16130
  onChange: (event) => {
@@ -15527,7 +16142,7 @@ var __publicField = (obj, key, value) => {
15527
16142
  /* @__PURE__ */ jsxRuntime.jsx(FieldsEditor, { fieldsOnly }),
15528
16143
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { severity: "danger", size: "1", children: typeof formik$1.errors.fields === "string" && formik$1.errors.fields })
15529
16144
  ] }),
15530
- /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { className: styles$c.floatingButtonContainer, align: "center", justify: "end", gap: "2", children: [
16145
+ /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { className: styles$d.floatingButtonContainer, align: "center", justify: "end", gap: "2", children: [
15531
16146
  onCancel && /* @__PURE__ */ jsxRuntime.jsx(blocks.Button, { type: "button", variant: "solid", severity: "info", onClick: onCancel, children: "Cancel" }),
15532
16147
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Button, { type: "submit", children: "Save form" })
15533
16148
  ] })
@@ -15562,6 +16177,9 @@ var __publicField = (obj, key, value) => {
15562
16177
  NumberInput,
15563
16178
  PatchField,
15564
16179
  PatchFormProvider,
16180
+ QrField,
16181
+ QrInput,
16182
+ QrScanner,
15565
16183
  SelectField,
15566
16184
  SelectInput,
15567
16185
  StringField,
@@ -15576,6 +16194,7 @@ var __publicField = (obj, key, value) => {
15576
16194
  emptyMultiSelectField,
15577
16195
  emptyMultiStringField,
15578
16196
  emptyNumberField,
16197
+ emptyQrField,
15579
16198
  emptySelectField,
15580
16199
  emptyStringField,
15581
16200
  emptyTextField,
@@ -15665,6 +16284,9 @@ var __publicField = (obj, key, value) => {
15665
16284
  exports2.ProjectFileService = ProjectFileService;
15666
16285
  exports2.ProjectService = ProjectService;
15667
16286
  exports2.ProjectType = ProjectType;
16287
+ exports2.QrField = QrField;
16288
+ exports2.QrInput = QrInput;
16289
+ exports2.QrScanner = QrScanner;
15668
16290
  exports2.SDKContext = SDKContext;
15669
16291
  exports2.SDKProvider = SDKProvider;
15670
16292
  exports2.SUPPORTED_IMAGE_FILE_TYPES = SUPPORTED_IMAGE_FILE_TYPES;
@@ -15675,6 +16297,7 @@ var __publicField = (obj, key, value) => {
15675
16297
  exports2.SpreadsheetViewer = SpreadsheetViewer;
15676
16298
  exports2.StringField = StringField;
15677
16299
  exports2.StringInput = StringInput;
16300
+ exports2.TeamService = TeamService;
15678
16301
  exports2.TextField = TextField;
15679
16302
  exports2.TextInput = TextInput;
15680
16303
  exports2.UserFormService = UserFormService;
@@ -15682,6 +16305,7 @@ var __publicField = (obj, key, value) => {
15682
16305
  exports2.VerificationCodeType = VerificationCodeType;
15683
16306
  exports2.WorkspaceService = WorkspaceService;
15684
16307
  exports2.YELLOW = YELLOW;
16308
+ exports2._selectLatestFormRevision = _selectLatestFormRevision;
15685
16309
  exports2._setLatestRetryTime = _setLatestRetryTime;
15686
16310
  exports2.acceptProjectInvite = acceptProjectInvite;
15687
16311
  exports2.addActiveProjectFormSubmissionsCount = addActiveProjectFormSubmissionsCount;
@@ -15699,6 +16323,16 @@ var __publicField = (obj, key, value) => {
15699
16323
  exports2.addDocuments = addDocuments;
15700
16324
  exports2.addEmailDomain = addEmailDomain;
15701
16325
  exports2.addFavouriteProjectId = addFavouriteProjectId;
16326
+ exports2.addForm = addForm;
16327
+ exports2.addFormRevision = addFormRevision;
16328
+ exports2.addFormRevisionAttachment = addFormRevisionAttachment;
16329
+ exports2.addFormRevisionAttachments = addFormRevisionAttachments;
16330
+ exports2.addFormRevisions = addFormRevisions;
16331
+ exports2.addFormSubmission = addFormSubmission;
16332
+ exports2.addFormSubmissionAttachment = addFormSubmissionAttachment;
16333
+ exports2.addFormSubmissionAttachments = addFormSubmissionAttachments;
16334
+ exports2.addFormSubmissions = addFormSubmissions;
16335
+ exports2.addForms = addForms;
15702
16336
  exports2.addIssue = addIssue;
15703
16337
  exports2.addIssueAttachment = addIssueAttachment;
15704
16338
  exports2.addIssueAttachments = addIssueAttachments;
@@ -15718,14 +16352,8 @@ var __publicField = (obj, key, value) => {
15718
16352
  exports2.addStageCompletion = addStageCompletion;
15719
16353
  exports2.addStageCompletions = addStageCompletions;
15720
16354
  exports2.addStages = addStages;
16355
+ exports2.addTeam = addTeam;
15721
16356
  exports2.addToRecentIssues = addToRecentIssues;
15722
- exports2.addUserForm = addUserForm;
15723
- exports2.addUserFormRevision = addUserFormRevision;
15724
- exports2.addUserFormRevisionAttachment = addUserFormRevisionAttachment;
15725
- exports2.addUserFormRevisions = addUserFormRevisions;
15726
- exports2.addUserFormSubmissionAttachment = addUserFormSubmissionAttachment;
15727
- exports2.addUserFormSubmissions = addUserFormSubmissions;
15728
- exports2.addUserForms = addUserForms;
15729
16357
  exports2.addUsers = addUsers;
15730
16358
  exports2.addWorkspace = addWorkspace;
15731
16359
  exports2.areArraysEqual = areArraysEqual;
@@ -15746,6 +16374,7 @@ var __publicField = (obj, key, value) => {
15746
16374
  exports2.componentStageSlice = componentStageSlice;
15747
16375
  exports2.componentTypeReducer = componentTypeReducer;
15748
16376
  exports2.componentTypeSlice = componentTypeSlice;
16377
+ exports2.constructUploadedFilePayloads = constructUploadedFilePayloads;
15749
16378
  exports2.coordinatesAreEqual = coordinatesAreEqual;
15750
16379
  exports2.coordinatesToLiteral = coordinatesToLiteral;
15751
16380
  exports2.coordinatesToPointGeometry = coordinatesToPointGeometry;
@@ -15756,12 +16385,17 @@ var __publicField = (obj, key, value) => {
15756
16385
  exports2.defaultBadgeColor = defaultBadgeColor;
15757
16386
  exports2.defaultStore = defaultStore;
15758
16387
  exports2.deleteComponentType = deleteComponentType;
16388
+ exports2.deleteForm = deleteForm;
16389
+ exports2.deleteFormRevision = deleteFormRevision;
16390
+ exports2.deleteFormRevisionAttachment = deleteFormRevisionAttachment;
16391
+ exports2.deleteFormRevisionAttachments = deleteFormRevisionAttachments;
16392
+ exports2.deleteFormRevisions = deleteFormRevisions;
16393
+ exports2.deleteFormSubmission = deleteFormSubmission;
16394
+ exports2.deleteFormSubmissionAttachment = deleteFormSubmissionAttachment;
16395
+ exports2.deleteFormSubmissionAttachments = deleteFormSubmissionAttachments;
16396
+ exports2.deleteFormSubmissions = deleteFormSubmissions;
15759
16397
  exports2.deleteProject = deleteProject;
15760
- exports2.deleteUserForm = deleteUserForm;
15761
- exports2.deleteUserFormRevision = deleteUserFormRevision;
15762
- exports2.deleteUserFormRevisions = deleteUserFormRevisions;
15763
- exports2.deleteUserFormSubmission = deleteUserFormSubmission;
15764
- exports2.deleteUserFormSubmissions = deleteUserFormSubmissions;
16398
+ exports2.deleteTeam = deleteTeam;
15765
16399
  exports2.dequeue = dequeue;
15766
16400
  exports2.deserialize = deserialize;
15767
16401
  exports2.deserializeField = deserializeField;
@@ -15779,6 +16413,7 @@ var __publicField = (obj, key, value) => {
15779
16413
  exports2.emptyMultiSelectField = emptyMultiSelectField;
15780
16414
  exports2.emptyMultiStringField = emptyMultiStringField;
15781
16415
  exports2.emptyNumberField = emptyNumberField;
16416
+ exports2.emptyQrField = emptyQrField;
15782
16417
  exports2.emptySelectField = emptySelectField;
15783
16418
  exports2.emptyStringField = emptyStringField;
15784
16419
  exports2.emptyTextField = emptyTextField;
@@ -15790,7 +16425,13 @@ var __publicField = (obj, key, value) => {
15790
16425
  exports2.fileSlice = fileSlice;
15791
16426
  exports2.fileToBlob = fileToBlob;
15792
16427
  exports2.flipCoordinates = flipCoordinates;
16428
+ exports2.formReducer = formReducer;
16429
+ exports2.formRevisionReducer = formRevisionReducer;
15793
16430
  exports2.formRevisionToSchema = formRevisionToSchema;
16431
+ exports2.formRevisionsSlice = formRevisionsSlice;
16432
+ exports2.formSlice = formSlice;
16433
+ exports2.formSubmissionReducer = formSubmissionReducer;
16434
+ exports2.formSubmissionSlice = formSubmissionSlice;
15794
16435
  exports2.forms = index;
15795
16436
  exports2.fullComponentMarkerSize = fullComponentMarkerSize;
15796
16437
  exports2.generateBadgeColors = generateBadgeColors;
@@ -15918,6 +16559,8 @@ var __publicField = (obj, key, value) => {
15918
16559
  exports2.selectAttachmentsOfComponentTypeByType = selectAttachmentsOfComponentTypeByType;
15919
16560
  exports2.selectAttachmentsOfDocument = selectAttachmentsOfDocument;
15920
16561
  exports2.selectAttachmentsOfDocumentByType = selectAttachmentsOfDocumentByType;
16562
+ exports2.selectAttachmentsOfFormRevision = selectAttachmentsOfFormRevision;
16563
+ exports2.selectAttachmentsOfFormSubmission = selectAttachmentsOfFormSubmission;
15921
16564
  exports2.selectAttachmentsOfIssue = selectAttachmentsOfIssue;
15922
16565
  exports2.selectAttachmentsOfIssueByType = selectAttachmentsOfIssueByType;
15923
16566
  exports2.selectAttachmentsOfProject = selectAttachmentsOfProject;
@@ -15935,11 +16578,9 @@ var __publicField = (obj, key, value) => {
15935
16578
  exports2.selectComponent = selectComponent;
15936
16579
  exports2.selectComponentAttachment = selectComponentAttachment;
15937
16580
  exports2.selectComponentAttachmentMapping = selectComponentAttachmentMapping;
15938
- exports2.selectComponentSubmissionMapping = selectComponentSubmissionMapping;
15939
16581
  exports2.selectComponentType = selectComponentType;
15940
16582
  exports2.selectComponentTypeAttachment = selectComponentTypeAttachment;
15941
16583
  exports2.selectComponentTypeAttachmentMapping = selectComponentTypeAttachmentMapping;
15942
- exports2.selectComponentTypeForm = selectComponentTypeForm;
15943
16584
  exports2.selectComponentTypeFromComponent = selectComponentTypeFromComponent;
15944
16585
  exports2.selectComponentTypeFromComponents = selectComponentTypeFromComponents;
15945
16586
  exports2.selectComponentTypeStagesMapping = selectComponentTypeStagesMapping;
@@ -15969,8 +16610,24 @@ var __publicField = (obj, key, value) => {
15969
16610
  exports2.selectExpandedSections = selectExpandedSections;
15970
16611
  exports2.selectFavouriteProjects = selectFavouriteProjects;
15971
16612
  exports2.selectFileAttachmentsOfIssue = selectFileAttachmentsOfIssue;
15972
- exports2.selectFilteredUserForms = selectFilteredUserForms;
16613
+ exports2.selectFilteredForms = selectFilteredForms;
16614
+ exports2.selectForm = selectForm;
16615
+ exports2.selectFormMapping = selectFormMapping;
16616
+ exports2.selectFormOfComponentType = selectFormOfComponentType;
15973
16617
  exports2.selectFormRevision = selectFormRevision;
16618
+ exports2.selectFormRevisionMapping = selectFormRevisionMapping;
16619
+ exports2.selectFormRevisions = selectFormRevisions;
16620
+ exports2.selectFormRevisionsOfForm = selectFormRevisionsOfForm;
16621
+ exports2.selectFormSubmission = selectFormSubmission;
16622
+ exports2.selectFormSubmissionAttachmentsMapping = selectFormSubmissionAttachmentsMapping;
16623
+ exports2.selectFormSubmissions = selectFormSubmissions;
16624
+ exports2.selectFormSubmissionsByComponents = selectFormSubmissionsByComponents;
16625
+ exports2.selectFormSubmissionsMapping = selectFormSubmissionsMapping;
16626
+ exports2.selectFormSubmissionsOfComponent = selectFormSubmissionsOfComponent;
16627
+ exports2.selectFormSubmissionsOfForm = selectFormSubmissionsOfForm;
16628
+ exports2.selectFormSubmissionsOfIssue = selectFormSubmissionsOfIssue;
16629
+ exports2.selectFormsCount = selectFormsCount;
16630
+ exports2.selectGeneralFormCount = selectGeneralFormCount;
15974
16631
  exports2.selectHiddenCategoryCount = selectHiddenCategoryCount;
15975
16632
  exports2.selectHiddenComponentTypeIds = selectHiddenComponentTypeIds;
15976
16633
  exports2.selectIsFetchingInitialData = selectIsFetchingInitialData;
@@ -15985,10 +16642,10 @@ var __publicField = (obj, key, value) => {
15985
16642
  exports2.selectIssueUpdateMapping = selectIssueUpdateMapping;
15986
16643
  exports2.selectIssueUpdatesOfIssue = selectIssueUpdatesOfIssue;
15987
16644
  exports2.selectIssues = selectIssues;
15988
- exports2.selectLatestFormRevision = selectLatestFormRevision;
16645
+ exports2.selectLatestFormRevisionByForm = selectLatestFormRevisionByForm;
16646
+ exports2.selectLatestFormRevisionOfForm = selectLatestFormRevisionOfForm;
16647
+ exports2.selectLatestFormRevisionsOfComponentTypes = selectLatestFormRevisionsOfComponentTypes;
15989
16648
  exports2.selectLatestRetryTime = selectLatestRetryTime;
15990
- exports2.selectLatestRevisionByFormId = selectLatestRevisionByFormId;
15991
- exports2.selectLatestRevisionsFromComponentTypeIds = selectLatestRevisionsFromComponentTypeIds;
15992
16649
  exports2.selectLicense = selectLicense;
15993
16650
  exports2.selectLicenseForProject = selectLicenseForProject;
15994
16651
  exports2.selectLicenses = selectLicenses;
@@ -15997,8 +16654,6 @@ var __publicField = (obj, key, value) => {
15997
16654
  exports2.selectMapStyle = selectMapStyle;
15998
16655
  exports2.selectNumberOfComponentTypesMatchingCaseInsensitiveName = selectNumberOfComponentTypesMatchingCaseInsensitiveName;
15999
16656
  exports2.selectNumberOfComponentsOfComponentType = selectNumberOfComponentsOfComponentType;
16000
- exports2.selectNumberOfGeneralUserForms = selectNumberOfGeneralUserForms;
16001
- exports2.selectNumberOfUserForms = selectNumberOfUserForms;
16002
16657
  exports2.selectOrganization = selectOrganization;
16003
16658
  exports2.selectOrganizationAccess = selectOrganizationAccess;
16004
16659
  exports2.selectOrganizationAccessForUser = selectOrganizationAccessForUser;
@@ -16026,8 +16681,6 @@ var __publicField = (obj, key, value) => {
16026
16681
  exports2.selectRecentIssuesAsSearchResults = selectRecentIssuesAsSearchResults;
16027
16682
  exports2.selectRecentProjects = selectRecentProjects;
16028
16683
  exports2.selectRehydrated = selectRehydrated;
16029
- exports2.selectRevisionAttachments = selectRevisionAttachments;
16030
- exports2.selectRevisionsForForm = selectRevisionsForForm;
16031
16684
  exports2.selectRootDocuments = selectRootDocuments;
16032
16685
  exports2.selectShowTooltips = selectShowTooltips;
16033
16686
  exports2.selectSortedEmailDomains = selectSortedEmailDomains;
@@ -16042,16 +16695,15 @@ var __publicField = (obj, key, value) => {
16042
16695
  exports2.selectStagesFromComponentType = selectStagesFromComponentType;
16043
16696
  exports2.selectStagesFromComponentTypeIds = selectStagesFromComponentTypeIds;
16044
16697
  exports2.selectStagesFromStageIds = selectStagesFromStageIds;
16045
- exports2.selectSubmissionAttachments = selectSubmissionAttachments;
16046
- exports2.selectSubmissionsForComponent = selectSubmissionsForComponent;
16047
- exports2.selectSubmissionsForForm = selectSubmissionsForForm;
16048
- exports2.selectSubmissionsForIssue = selectSubmissionsForIssue;
16698
+ exports2.selectTeam = selectTeam;
16699
+ exports2.selectTeams = selectTeams;
16700
+ exports2.selectTeamsMapping = selectTeamsMapping;
16701
+ exports2.selectTeamsOfOrganization = selectTeamsOfOrganization;
16702
+ exports2.selectTeamsOfUser = selectTeamsOfUser;
16049
16703
  exports2.selectUploadUrl = selectUploadUrl;
16050
16704
  exports2.selectUsedColors = selectUsedColors;
16051
16705
  exports2.selectUser = selectUser;
16052
- exports2.selectUserForm = selectUserForm;
16053
- exports2.selectUserFormMapping = selectUserFormMapping;
16054
- exports2.selectUserFormSubmission = selectUserFormSubmission;
16706
+ exports2.selectUserFormRevisionAttachmentsMapping = selectUserFormRevisionAttachmentsMapping;
16055
16707
  exports2.selectUsersAsMapping = selectUsersAsMapping;
16056
16708
  exports2.selectVisibleStatuses = selectVisibleStatuses;
16057
16709
  exports2.selectVisibleUserIds = selectVisibleUserIds;
@@ -16078,6 +16730,13 @@ var __publicField = (obj, key, value) => {
16078
16730
  exports2.setEnableClustering = setEnableClustering;
16079
16731
  exports2.setEnableDuplicateIssues = setEnableDuplicateIssues;
16080
16732
  exports2.setEnablePlacementMode = setEnablePlacementMode;
16733
+ exports2.setFormRevision = setFormRevision;
16734
+ exports2.setFormRevisionAttachments = setFormRevisionAttachments;
16735
+ exports2.setFormRevisions = setFormRevisions;
16736
+ exports2.setFormSubmission = setFormSubmission;
16737
+ exports2.setFormSubmissionAttachments = setFormSubmissionAttachments;
16738
+ exports2.setFormSubmissions = setFormSubmissions;
16739
+ exports2.setForms = setForms;
16081
16740
  exports2.setIsFetchingInitialData = setIsFetchingInitialData;
16082
16741
  exports2.setIsImportingProjectFile = setIsImportingProjectFile;
16083
16742
  exports2.setIsLoading = setIsLoading;
@@ -16099,12 +16758,11 @@ var __publicField = (obj, key, value) => {
16099
16758
  exports2.setSectionExpanded = setSectionExpanded;
16100
16759
  exports2.setShowTooltips = setShowTooltips;
16101
16760
  exports2.setStageCompletions = setStageCompletions;
16761
+ exports2.setTeam = setTeam;
16762
+ exports2.setTeams = setTeams;
16102
16763
  exports2.setTokens = setTokens;
16103
16764
  exports2.setTourStep = setTourStep;
16104
16765
  exports2.setUploadUrl = setUploadUrl;
16105
- exports2.setUserFormRevisionAttachments = setUserFormRevisionAttachments;
16106
- exports2.setUserFormSubmissionAttachments = setUserFormSubmissionAttachments;
16107
- exports2.setUserFormSubmissions = setUserFormSubmissions;
16108
16766
  exports2.setUsers = setUsers;
16109
16767
  exports2.setVisibleStatuses = setVisibleStatuses;
16110
16768
  exports2.setVisibleUserIds = setVisibleUserIds;
@@ -16115,6 +16773,8 @@ var __publicField = (obj, key, value) => {
16115
16773
  exports2.slugify = slugify;
16116
16774
  exports2.spacesToDashesLower = spacesToDashesLower;
16117
16775
  exports2.successColor = successColor;
16776
+ exports2.teamReducer = teamReducer;
16777
+ exports2.teamSlice = teamSlice;
16118
16778
  exports2.toFileNameSafeString = toFileNameSafeString;
16119
16779
  exports2.toOfflineIdRecord = toOfflineIdRecord;
16120
16780
  exports2.toggleComponentTypeVisibility = toggleComponentTypeVisibility;
@@ -16129,15 +16789,18 @@ var __publicField = (obj, key, value) => {
16129
16789
  exports2.updateComponentTypeAttachment = updateComponentTypeAttachment;
16130
16790
  exports2.updateDocumentAttachment = updateDocumentAttachment;
16131
16791
  exports2.updateDocuments = updateDocuments;
16792
+ exports2.updateFormSubmission = updateFormSubmission;
16793
+ exports2.updateFormSubmissionAttachments = updateFormSubmissionAttachments;
16794
+ exports2.updateFormSubmissions = updateFormSubmissions;
16132
16795
  exports2.updateIssue = updateIssue;
16133
16796
  exports2.updateIssueAttachment = updateIssueAttachment;
16134
16797
  exports2.updateLicense = updateLicense;
16135
16798
  exports2.updateOrCreateProject = updateOrCreateProject;
16136
- exports2.updateOrCreateUserFormSubmission = updateOrCreateUserFormSubmission;
16137
16799
  exports2.updateOrganizationAccess = updateOrganizationAccess;
16138
16800
  exports2.updateProjectAccess = updateProjectAccess;
16139
16801
  exports2.updateProjectAttachment = updateProjectAttachment;
16140
16802
  exports2.updateStages = updateStages;
16803
+ exports2.updateTeam = updateTeam;
16141
16804
  exports2.useAppDispatch = useAppDispatch;
16142
16805
  exports2.useAppSelector = useAppSelector;
16143
16806
  exports2.useFieldInput = useFieldInput;
@@ -16147,8 +16810,6 @@ var __publicField = (obj, key, value) => {
16147
16810
  exports2.useFormikInput = useFormikInput;
16148
16811
  exports2.useMemoCompare = useMemoCompare;
16149
16812
  exports2.useSDK = useSDK;
16150
- exports2.userFormReducer = userFormReducer;
16151
- exports2.userFormSlice = userFormSlice;
16152
16813
  exports2.userReducer = userReducer;
16153
16814
  exports2.userSlice = userSlice;
16154
16815
  exports2.valueIsFile = valueIsFile;