@overmap-ai/core 1.0.43-projects-licensing.3 → 1.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -622,15 +622,15 @@ var __publicField = (obj, key, value) => {
622
622
  };
623
623
  const migrations = [initialVersioning, signOut, signOut, createOutboxState];
624
624
  const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
625
- const initialState$m = {
625
+ const initialState$l = {
626
626
  accessToken: "",
627
627
  refreshToken: "",
628
628
  isLoggedIn: false
629
629
  };
630
630
  const authSlice = toolkit.createSlice({
631
631
  name: "auth",
632
- initialState: initialState$m,
633
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
632
+ initialState: initialState$l,
633
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
634
634
  reducers: {
635
635
  setTokens: (state, action) => {
636
636
  state.accessToken = action.payload.accessToken;
@@ -1361,7 +1361,7 @@ var __publicField = (obj, key, value) => {
1361
1361
  return getLocalDateString(date);
1362
1362
  return relative.format(days, "days");
1363
1363
  });
1364
- const initialState$l = {
1364
+ const initialState$k = {
1365
1365
  categories: {},
1366
1366
  usedCategoryColors: [],
1367
1367
  categoryVisibility: {
@@ -1371,8 +1371,8 @@ var __publicField = (obj, key, value) => {
1371
1371
  };
1372
1372
  const categorySlice = toolkit.createSlice({
1373
1373
  name: "categories",
1374
- initialState: initialState$l,
1375
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
1374
+ initialState: initialState$k,
1375
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
1376
1376
  reducers: {
1377
1377
  setCategories: (state, action) => {
1378
1378
  if (!Array.isArray(action.payload))
@@ -1505,13 +1505,49 @@ var __publicField = (obj, key, value) => {
1505
1505
  return hiddenCategoryCount;
1506
1506
  };
1507
1507
  const categoryReducer = categorySlice.reducer;
1508
- const initialState$k = {
1509
- components: {}
1508
+ function setAttachments(state, action) {
1509
+ for (const attachment of action.payload) {
1510
+ state.attachments[attachment.offline_id] = attachment;
1511
+ }
1512
+ }
1513
+ function addAttachment(state, action) {
1514
+ if (action.payload.offline_id in state.attachments) {
1515
+ throw new Error(`Attachment ${action.payload.offline_id} already exists.`);
1516
+ }
1517
+ state.attachments[action.payload.offline_id] = action.payload;
1518
+ }
1519
+ function addAttachments(state, action) {
1520
+ for (const attachment of action.payload) {
1521
+ state.attachments[attachment.offline_id] = attachment;
1522
+ }
1523
+ }
1524
+ function updateAttachment(state, action) {
1525
+ if (action.payload.offline_id in state.attachments) {
1526
+ state.attachments[action.payload.offline_id] = action.payload;
1527
+ } else {
1528
+ throw new Error(`Attachment ${action.payload.offline_id} does not exist.`);
1529
+ }
1530
+ }
1531
+ function removeAttachment(state, action) {
1532
+ if (action.payload in state.attachments) {
1533
+ delete state.attachments[action.payload];
1534
+ } else {
1535
+ throw new Error(`Attachment ${action.payload} does not exist.`);
1536
+ }
1537
+ }
1538
+ function removeAttachments(state, action) {
1539
+ for (const attachmentId of action.payload) {
1540
+ delete state.attachments[attachmentId];
1541
+ }
1542
+ }
1543
+ const initialState$j = {
1544
+ components: {},
1545
+ attachments: {}
1510
1546
  };
1511
1547
  const componentSlice = toolkit.createSlice({
1512
1548
  name: "components",
1513
- initialState: initialState$k,
1514
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
1549
+ initialState: initialState$j,
1550
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
1515
1551
  reducers: {
1516
1552
  addComponent: (state, action) => {
1517
1553
  state.components[action.payload.offline_id] = action.payload;
@@ -1525,6 +1561,12 @@ var __publicField = (obj, key, value) => {
1525
1561
  state.components = toOfflineIdRecord(action.payload);
1526
1562
  prevComponents = null;
1527
1563
  },
1564
+ setComponentAttachments: setAttachments,
1565
+ addComponentAttachment: addAttachment,
1566
+ addComponentAttachments: addAttachments,
1567
+ updateComponentAttachment: updateAttachment,
1568
+ removeComponentAttachment: removeAttachment,
1569
+ removeComponentAttachments: removeAttachments,
1528
1570
  updateComponent: (state, action) => {
1529
1571
  if (action.payload.offline_id in state.components) {
1530
1572
  state.components[action.payload.offline_id] = action.payload;
@@ -1614,22 +1656,41 @@ var __publicField = (obj, key, value) => {
1614
1656
  return acc;
1615
1657
  }, []);
1616
1658
  };
1659
+ const selectComponentAttachmentMapping = (state) => state.componentReducer.attachments;
1660
+ const selectAllComponentAttachments = toolkit.createSelector(
1661
+ [selectComponentAttachmentMapping],
1662
+ (mapping) => Object.values(mapping)
1663
+ );
1664
+ const selectAttachmentsOfComponent = restructureCreateSelectorWithArgs(
1665
+ toolkit.createSelector(
1666
+ [selectAllComponentAttachments, (_state, componentId) => componentId],
1667
+ (attachments, componentId) => {
1668
+ return attachments.filter(({ component_id }) => componentId === component_id);
1669
+ }
1670
+ )
1671
+ );
1617
1672
  const {
1618
1673
  addComponent,
1619
1674
  updateComponent,
1620
1675
  removeComponent,
1621
1676
  addComponentsInBatches,
1622
1677
  setComponents,
1678
+ setComponentAttachments,
1679
+ addComponentAttachment,
1680
+ addComponentAttachments,
1681
+ updateComponentAttachment,
1682
+ removeComponentAttachment,
1683
+ removeComponentAttachments,
1623
1684
  removeAllComponentsOfType
1624
1685
  } = componentSlice.actions;
1625
1686
  const componentReducer = componentSlice.reducer;
1626
- const initialState$j = {
1687
+ const initialState$i = {
1627
1688
  completionsByComponentId: {}
1628
1689
  };
1629
1690
  const componentStageCompletionSlice = toolkit.createSlice({
1630
1691
  name: "componentStageCompletions",
1631
- initialState: initialState$j,
1632
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
1692
+ initialState: initialState$i,
1693
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
1633
1694
  reducers: {
1634
1695
  addStageCompletion: (state, action) => {
1635
1696
  let stageToCompletionDateMapping = state.completionsByComponentId[action.payload.component];
@@ -1680,13 +1741,13 @@ var __publicField = (obj, key, value) => {
1680
1741
  return Object.keys(state.componentStageCompletionReducer.completionsByComponentId[component.offline_id] ?? {});
1681
1742
  };
1682
1743
  const componentStageCompletionReducer = componentStageCompletionSlice.reducer;
1683
- const initialState$i = {
1744
+ const initialState$h = {
1684
1745
  stages: {}
1685
1746
  };
1686
1747
  const componentStageSlice = toolkit.createSlice({
1687
1748
  name: "componentStages",
1688
- initialState: initialState$i,
1689
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
1749
+ initialState: initialState$h,
1750
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
1690
1751
  reducers: {
1691
1752
  addStages: (state, action) => {
1692
1753
  Object.assign(state.stages, toOfflineIdRecord(action.payload));
@@ -1777,14 +1838,15 @@ var __publicField = (obj, key, value) => {
1777
1838
  );
1778
1839
  const { addStages, updateStages, removeStages, linkStageToForm, unlinkStageToForm } = componentStageSlice.actions;
1779
1840
  const componentStageReducer = componentStageSlice.reducer;
1780
- const initialState$h = {
1841
+ const initialState$g = {
1781
1842
  componentTypes: {},
1782
- hiddenComponentTypeIds: {}
1843
+ hiddenComponentTypeIds: {},
1844
+ attachments: {}
1783
1845
  };
1784
1846
  const componentTypeSlice = toolkit.createSlice({
1785
1847
  name: "componentTypes",
1786
- initialState: initialState$h,
1787
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
1848
+ initialState: initialState$g,
1849
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
1788
1850
  reducers: {
1789
1851
  addComponentType: (state, action) => {
1790
1852
  state.componentTypes[action.payload.offline_id] = action.payload;
@@ -1792,6 +1854,12 @@ var __publicField = (obj, key, value) => {
1792
1854
  setComponentTypes: (state, action) => {
1793
1855
  state.componentTypes = toOfflineIdRecord(action.payload);
1794
1856
  },
1857
+ setComponentTypeAttachments: setAttachments,
1858
+ addComponentTypeAttachment: addAttachment,
1859
+ addComponentTypeAttachments: addAttachments,
1860
+ updateComponentTypeAttachment: updateAttachment,
1861
+ removeComponentTypeAttachment: removeAttachment,
1862
+ removeComponentTypeAttachments: removeAttachments,
1795
1863
  toggleComponentTypeVisibility: (state, action) => {
1796
1864
  state.hiddenComponentTypeIds[action.payload] = !state.hiddenComponentTypeIds[action.payload];
1797
1865
  },
@@ -1841,15 +1909,39 @@ var __publicField = (obj, key, value) => {
1841
1909
  )
1842
1910
  );
1843
1911
  const selectHiddenComponentTypeIds = (state) => state.componentTypeReducer.hiddenComponentTypeIds;
1844
- const { addComponentType, setComponentTypes, toggleComponentTypeVisibility, deleteComponentType } = componentTypeSlice.actions;
1912
+ const selectComponentTypeAttachmentMapping = (state) => state.componentTypeReducer.attachments;
1913
+ const selectAllComponentTypeAttachments = toolkit.createSelector(
1914
+ [selectComponentTypeAttachmentMapping],
1915
+ (mapping) => Object.values(mapping)
1916
+ );
1917
+ const selectAttachmentsOfComponentType = restructureCreateSelectorWithArgs(
1918
+ toolkit.createSelector(
1919
+ [selectAllComponentTypeAttachments, (_state, componentTypeId) => componentTypeId],
1920
+ (attachments, componentTypeId) => {
1921
+ return attachments.filter(({ component_type_id }) => componentTypeId === component_type_id);
1922
+ }
1923
+ )
1924
+ );
1925
+ const {
1926
+ addComponentType,
1927
+ setComponentTypes,
1928
+ setComponentTypeAttachments,
1929
+ addComponentTypeAttachment,
1930
+ addComponentTypeAttachments,
1931
+ updateComponentTypeAttachment,
1932
+ removeComponentTypeAttachment,
1933
+ removeComponentTypeAttachments,
1934
+ toggleComponentTypeVisibility,
1935
+ deleteComponentType
1936
+ } = componentTypeSlice.actions;
1845
1937
  const componentTypeReducer = componentTypeSlice.reducer;
1846
- const initialState$g = {
1938
+ const initialState$f = {
1847
1939
  workspaces: {},
1848
1940
  activeWorkspaceId: null
1849
1941
  };
1850
1942
  const workspaceSlice = toolkit.createSlice({
1851
1943
  name: "workspace",
1852
- initialState: initialState$g,
1944
+ initialState: initialState$f,
1853
1945
  // The `reducers` field lets us define reducers and generate associated actions
1854
1946
  reducers: {
1855
1947
  setWorkspaces: (state, action) => {
@@ -1906,20 +1998,21 @@ var __publicField = (obj, key, value) => {
1906
1998
  );
1907
1999
  const workspaceReducer = workspaceSlice.reducer;
1908
2000
  const maxRecentIssues = 10;
1909
- const initialState$f = {
2001
+ const initialState$e = {
1910
2002
  issues: {},
1911
2003
  attachments: {},
1912
2004
  comments: {},
1913
2005
  visibleStatuses: [IssueStatus.BACKLOG, IssueStatus.SELECTED],
2006
+ isFetchingInitialData: false,
1914
2007
  visibleUserIds: null,
1915
2008
  recentIssueIds: [],
1916
2009
  activeIssueId: null
1917
2010
  };
1918
2011
  const issueSlice = toolkit.createSlice({
1919
2012
  name: "issues",
1920
- initialState: initialState$f,
2013
+ initialState: initialState$e,
1921
2014
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
1922
- Object.assign(state, initialState$f);
2015
+ Object.assign(state, initialState$e);
1923
2016
  }),
1924
2017
  reducers: {
1925
2018
  setIssues: (state, action) => {
@@ -1931,11 +2024,7 @@ var __publicField = (obj, key, value) => {
1931
2024
  });
1932
2025
  },
1933
2026
  // TODO: Reusable function
1934
- setAttachments: (state, action) => {
1935
- for (const attachment of action.payload) {
1936
- state.attachments[attachment.offline_id] = attachment;
1937
- }
1938
- },
2027
+ setIssueAttachments: setAttachments,
1939
2028
  setActiveIssueId: (state, action) => {
1940
2029
  state.activeIssueId = action.payload;
1941
2030
  },
@@ -1946,17 +2035,8 @@ var __publicField = (obj, key, value) => {
1946
2035
  state.issues[action.payload.offline_id] = action.payload;
1947
2036
  },
1948
2037
  // TODO: Reusable function
1949
- addAttachment: (state, action) => {
1950
- if (action.payload.offline_id in state.attachments) {
1951
- throw new Error(`Attachment ${action.payload.offline_id} already exists.`);
1952
- }
1953
- state.attachments[action.payload.offline_id] = action.payload;
1954
- },
1955
- addAttachments: (state, action) => {
1956
- for (const attachment of action.payload) {
1957
- state.attachments[attachment.offline_id] = attachment;
1958
- }
1959
- },
2038
+ addIssueAttachment: addAttachment,
2039
+ addIssueAttachments: addAttachments,
1960
2040
  updateIssue: (state, action) => {
1961
2041
  if (action.payload.offline_id in state.issues) {
1962
2042
  state.issues[action.payload.offline_id] = {
@@ -1968,13 +2048,7 @@ var __publicField = (obj, key, value) => {
1968
2048
  }
1969
2049
  },
1970
2050
  // TODO: Reusable function
1971
- updateAttachment: (state, action) => {
1972
- if (action.payload.offline_id in state.attachments) {
1973
- state.attachments[action.payload.offline_id] = action.payload;
1974
- } else {
1975
- throw new Error(`Attachment ${action.payload.offline_id} does not exist.`);
1976
- }
1977
- },
2051
+ updateIssueAttachment: updateAttachment,
1978
2052
  removeIssue: (state, action) => {
1979
2053
  if (action.payload in state.issues) {
1980
2054
  delete state.issues[action.payload];
@@ -1982,13 +2056,7 @@ var __publicField = (obj, key, value) => {
1982
2056
  throw new Error(`Failed to remove issue because ID doesn't exist: ${action.payload}`);
1983
2057
  }
1984
2058
  },
1985
- removeAttachment: (state, action) => {
1986
- if (action.payload in state.attachments) {
1987
- delete state.attachments[action.payload];
1988
- } else {
1989
- throw new Error(`Attachment ${action.payload} does not exist.`);
1990
- }
1991
- },
2059
+ removeIssueAttachment: removeAttachment,
1992
2060
  removeAttachmentsOfIssue: (state, action) => {
1993
2061
  const attachments = Object.values(state.attachments).filter((a) => a.issue_id === action.payload);
1994
2062
  for (const attachment of attachments) {
@@ -1998,6 +2066,9 @@ var __publicField = (obj, key, value) => {
1998
2066
  setVisibleStatuses: (state, action) => {
1999
2067
  state.visibleStatuses = action.payload;
2000
2068
  },
2069
+ setIsFetchingInitialData: (state, action) => {
2070
+ state.isFetchingInitialData = action.payload;
2071
+ },
2001
2072
  setVisibleUserIds: (state, action) => {
2002
2073
  state.visibleUserIds = [...new Set(action.payload)];
2003
2074
  },
@@ -2042,25 +2113,26 @@ var __publicField = (obj, key, value) => {
2042
2113
  }
2043
2114
  });
2044
2115
  const {
2045
- addAttachment,
2046
- addAttachments,
2116
+ addIssueAttachment,
2117
+ addIssueAttachments,
2047
2118
  addIssue,
2048
2119
  addOrReplaceIssueComment,
2049
2120
  addToRecentIssues,
2050
2121
  cleanRecentIssues,
2051
- removeAttachment,
2122
+ removeIssueAttachment,
2052
2123
  removeAttachmentsOfIssue,
2053
2124
  removeIssue,
2054
2125
  removeIssueComment,
2055
2126
  removeRecentIssue,
2056
2127
  resetRecentIssues,
2057
2128
  setActiveIssueId,
2058
- setAttachments,
2129
+ setIssueAttachments,
2130
+ setIsFetchingInitialData,
2059
2131
  setIssueComments,
2060
2132
  setIssues,
2061
2133
  setVisibleStatuses,
2062
2134
  setVisibleUserIds,
2063
- updateAttachment,
2135
+ updateIssueAttachment,
2064
2136
  updateIssue
2065
2137
  } = issueSlice.actions;
2066
2138
  const selectIssueMapping = (state) => state.issueReducer.issues;
@@ -2120,8 +2192,6 @@ var __publicField = (obj, key, value) => {
2120
2192
  toolkit.createSelector(
2121
2193
  [selectIssueAttachmentMapping, (_state, issueId) => issueId],
2122
2194
  (attachmentMapping, issueId) => {
2123
- if (!issueId)
2124
- return void 0;
2125
2195
  return Object.values(attachmentMapping).filter(
2126
2196
  (attachment) => attachment.issue_id === issueId && attachment.file_type && attachment.file_type.startsWith("image/")
2127
2197
  );
@@ -2154,6 +2224,7 @@ var __publicField = (obj, key, value) => {
2154
2224
  return mapping[id];
2155
2225
  })
2156
2226
  );
2227
+ const selectIsFetchingInitialData = (state) => state.issueReducer.isFetchingInitialData;
2157
2228
  const selectAllAttachments = toolkit.createSelector([selectIssueAttachmentMapping], (mapping) => Object.values(mapping));
2158
2229
  const searchIssues = restructureCreateSelectorWithArgs(
2159
2230
  toolkit.createSelector(
@@ -2245,15 +2316,15 @@ var __publicField = (obj, key, value) => {
2245
2316
  }
2246
2317
  );
2247
2318
  const issueReducer = issueSlice.reducer;
2248
- const initialState$e = {
2319
+ const initialState$d = {
2249
2320
  s3Urls: {}
2250
2321
  };
2251
2322
  const msPerHour = 1e3 * 60 * 60;
2252
2323
  const msPerWeek = msPerHour * 24 * 7;
2253
2324
  const fileSlice = toolkit.createSlice({
2254
2325
  name: "file",
2255
- initialState: initialState$e,
2256
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
2326
+ initialState: initialState$d,
2327
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
2257
2328
  reducers: {
2258
2329
  setUploadUrl: (state, action) => {
2259
2330
  const { url, fields, sha1 } = action.payload;
@@ -2280,7 +2351,7 @@ var __publicField = (obj, key, value) => {
2280
2351
  return url;
2281
2352
  };
2282
2353
  const fileReducer = fileSlice.reducer;
2283
- const initialState$d = {
2354
+ const initialState$c = {
2284
2355
  // TODO: Change first MapStyle.SATELLITE to MaptStyle.None when project creation map is fixed
2285
2356
  mapStyle: MapStyle.SATELLITE,
2286
2357
  showTooltips: false,
@@ -2288,8 +2359,8 @@ var __publicField = (obj, key, value) => {
2288
2359
  };
2289
2360
  const mapSlice = toolkit.createSlice({
2290
2361
  name: "map",
2291
- initialState: initialState$d,
2292
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
2362
+ initialState: initialState$c,
2363
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
2293
2364
  reducers: {
2294
2365
  setMapStyle: (state, action) => {
2295
2366
  state.mapStyle = action.payload;
@@ -2331,24 +2402,7 @@ var __publicField = (obj, key, value) => {
2331
2402
  VerificationCodeType2[VerificationCodeType2["RESET_PASSWORD"] = 10] = "RESET_PASSWORD";
2332
2403
  return VerificationCodeType2;
2333
2404
  })(VerificationCodeType || {});
2334
- var PaddleCheckoutEvent = /* @__PURE__ */ ((PaddleCheckoutEvent2) => {
2335
- PaddleCheckoutEvent2["COMPLETED"] = "checkout.completed";
2336
- PaddleCheckoutEvent2["CLOSED"] = "checkout.closed";
2337
- return PaddleCheckoutEvent2;
2338
- })(PaddleCheckoutEvent || {});
2339
- var LicenseLevel = /* @__PURE__ */ ((LicenseLevel2) => {
2340
- LicenseLevel2[LicenseLevel2["PRO"] = 0] = "PRO";
2341
- return LicenseLevel2;
2342
- })(LicenseLevel || {});
2343
- var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
2344
- LicenseStatus2[LicenseStatus2["ACTIVE"] = 0] = "ACTIVE";
2345
- LicenseStatus2[LicenseStatus2["PAUSED"] = 2] = "PAUSED";
2346
- LicenseStatus2[LicenseStatus2["CANCELLED"] = 4] = "CANCELLED";
2347
- LicenseStatus2[LicenseStatus2["INACTIVE"] = 6] = "INACTIVE";
2348
- LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
2349
- return LicenseStatus2;
2350
- })(LicenseStatus || {});
2351
- const initialState$c = {
2405
+ const initialState$b = {
2352
2406
  users: {},
2353
2407
  currentUser: {
2354
2408
  id: 0,
@@ -2359,8 +2413,8 @@ var __publicField = (obj, key, value) => {
2359
2413
  };
2360
2414
  const userSlice = toolkit.createSlice({
2361
2415
  name: "users",
2362
- initialState: initialState$c,
2363
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
2416
+ initialState: initialState$b,
2417
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
2364
2418
  reducers: {
2365
2419
  setUsers: (state, action) => {
2366
2420
  const usersMapping = {};
@@ -2422,13 +2476,13 @@ var __publicField = (obj, key, value) => {
2422
2476
  const selectUsersAsMapping = (state) => state.userReducer.users;
2423
2477
  const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
2424
2478
  const userReducer = userSlice.reducer;
2425
- const initialState$b = {
2479
+ const initialState$a = {
2426
2480
  organizationAccesses: {}
2427
2481
  };
2428
2482
  const organizationAccessSlice = toolkit.createSlice({
2429
2483
  name: "organizationAccess",
2430
- initialState: initialState$b,
2431
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
2484
+ initialState: initialState$a,
2485
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
2432
2486
  reducers: {
2433
2487
  setOrganizationAccesses: (state, action) => {
2434
2488
  if (!Array.isArray(action.payload))
@@ -2491,64 +2545,151 @@ var __publicField = (obj, key, value) => {
2491
2545
  return organizationAccesses;
2492
2546
  };
2493
2547
  const organizationAccessReducer = organizationAccessSlice.reducer;
2494
- const initialState$a = {
2495
- licenses: {}
2548
+ const initialState$9 = {
2549
+ organizations: {},
2550
+ activeOrganizationId: null
2496
2551
  };
2497
- const licenseSlice = toolkit.createSlice({
2498
- name: "license",
2499
- initialState: initialState$a,
2500
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
2552
+ const organizationSlice = toolkit.createSlice({
2553
+ name: "organizations",
2554
+ initialState: initialState$9,
2555
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$9)),
2501
2556
  reducers: {
2502
- setLicenses: (state, action) => {
2503
- if (!Array.isArray(action.payload))
2504
- throw new Error("Expected an array of Licenses");
2505
- if (action.payload.filter(onlyUniqueOfflineIds).length !== action.payload.length) {
2506
- throw new Error("Tried to use setLicenses reducer with duplicate ID's");
2507
- }
2508
- const licenses = {};
2509
- for (const license of action.payload) {
2510
- licenses[license.offline_id] = license;
2557
+ setOrganizations: (state, action) => {
2558
+ for (const org of action.payload) {
2559
+ state.organizations[org.id] = org;
2511
2560
  }
2512
- state.licenses = licenses;
2513
2561
  },
2514
- addLicenses: (state, action) => {
2515
- for (const license of action.payload) {
2516
- state.licenses[license.offline_id] = license;
2562
+ updateActiveOrganization: (state, action) => {
2563
+ if (!state.activeOrganizationId) {
2564
+ throw new Error("Cannot update name of active organization. Active organization ID does not exist");
2517
2565
  }
2518
- },
2519
- updateLicense: (state, action) => {
2520
- if (!(action.payload.offline_id in state.licenses)) {
2521
- throw new Error("Tried to update license that does not exist.");
2566
+ if (state.activeOrganizationId !== action.payload.id) {
2567
+ throw new Error("Tried updating active organization with different organization");
2522
2568
  }
2523
- state.licenses[action.payload.offline_id] = action.payload;
2569
+ state.organizations[state.activeOrganizationId] = action.payload;
2570
+ },
2571
+ setActiveOrganizationId: (state, action) => {
2572
+ state.activeOrganizationId = action.payload;
2524
2573
  }
2525
2574
  }
2526
2575
  });
2527
- const { setLicenses, addLicenses, updateLicense } = licenseSlice.actions;
2528
- const selectLicenses = (state) => {
2529
- return state.licenseReducer.licenses;
2576
+ const { setOrganizations, setActiveOrganizationId, updateActiveOrganization } = organizationSlice.actions;
2577
+ const selectActiveOrganizationId = (state) => {
2578
+ return state.organizationReducer.activeOrganizationId;
2579
+ };
2580
+ const selectOrganizations = (state) => {
2581
+ return Object.values(state.organizationReducer.organizations);
2530
2582
  };
2531
- const selectLicense = (licenseId) => (state) => state.licenseReducer.licenses[licenseId];
2532
- const selectActiveLicense = (state) => Object.values(state.licenseReducer.licenses).find(
2533
- (license) => license.project === state.projectReducer.activeProjectId
2534
- ) ?? null;
2535
- const selectLicenseForProject = (projectId) => (state) => Object.values(state.licenseReducer.licenses).find((license) => license.project === projectId);
2536
- const selectActiveStatusLicenses = toolkit.createSelector(
2537
- [selectLicenses],
2538
- (licenses) => Object.values(licenses).filter((license) => license.is_active)
2583
+ const selectOrganizationsWithAccess = toolkit.createSelector(
2584
+ [selectOrganizations],
2585
+ (organizations) => Object.values(organizations).filter((organization) => organization.has_access)
2586
+ );
2587
+ const selectActiveOrganization = (state) => {
2588
+ const id = selectActiveOrganizationId(state);
2589
+ if (!id) {
2590
+ return null;
2591
+ }
2592
+ const organization = state.organizationReducer.organizations[id];
2593
+ if (!organization) {
2594
+ return null;
2595
+ }
2596
+ return organization;
2597
+ };
2598
+ const selectOrganizationUsersIds = toolkit.createSelector(
2599
+ [selectOrganizationAccesses],
2600
+ (organizationAccesses) => Object.values(organizationAccesses).map((organizationAccess) => organizationAccess.user)
2539
2601
  );
2540
- const selectLicensesForProjectsMapping = toolkit.createSelector(
2541
- [selectLicenses],
2542
- (licenses) => Object.values(licenses).filter((license) => license.project).reduce((accum, license) => ({ ...accum, [license.project]: license }), {})
2602
+ const selectOrganizationUsersAsMapping = toolkit.createSelector(
2603
+ [selectOrganizationUsersIds, selectUsersAsMapping],
2604
+ (organizationUserIds, users) => organizationUserIds.reduce((accum, userId) => ({ ...accum, [userId]: users[userId] }), {})
2543
2605
  );
2544
- const licenseReducer = licenseSlice.reducer;
2545
- const initialState$9 = {
2606
+ const selectSortedOrganizationUsers = toolkit.createSelector(
2607
+ [selectCurrentUser, selectOrganizationUsersAsMapping, selectOrganizationAccessUserMapping],
2608
+ (currentUser, userMapping, organizationAccessMapping) => {
2609
+ return Object.values(userMapping).sort((userA, userB) => {
2610
+ if (userA.id === currentUser.id) {
2611
+ return -1;
2612
+ } else if (userB.id === currentUser.id) {
2613
+ return 1;
2614
+ }
2615
+ const organizationAccessesA = organizationAccessMapping[userA.id];
2616
+ const organizationAccessesB = organizationAccessMapping[userB.id];
2617
+ if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === (organizationAccessesB == null ? void 0 : organizationAccessesB.access_level)) {
2618
+ return userA.username.localeCompare(userB.username);
2619
+ }
2620
+ if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === OrganizationAccessLevel.ADMIN) {
2621
+ return -1;
2622
+ }
2623
+ return 1;
2624
+ });
2625
+ }
2626
+ );
2627
+ const selectOrganization = (id) => (state) => {
2628
+ return state.organizationReducer.organizations[id];
2629
+ };
2630
+ const organizationReducer = organizationSlice.reducer;
2631
+ const createOfflineAction = (request2, baseUrl) => {
2632
+ const requestWithUuid = request2.uuid ? request2 : { ...request2, uuid: uuid.v4() };
2633
+ return {
2634
+ payload: requestWithUuid,
2635
+ type: "",
2636
+ meta: {
2637
+ offline: {
2638
+ effect: {
2639
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
2640
+ request: requestWithUuid,
2641
+ BASE_URL: baseUrl
2642
+ }
2643
+ }
2644
+ }
2645
+ };
2646
+ };
2647
+ const initialState$8 = {
2648
+ deletedRequests: [],
2649
+ latestRetryTime: 0
2650
+ };
2651
+ const outboxSlice = toolkit.createSlice({
2652
+ name: "outbox",
2653
+ initialState: initialState$8,
2654
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
2655
+ reducers: {
2656
+ // enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
2657
+ // Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
2658
+ // Then this reducer enqueueRequest() is responsible for adding the actual request data to the outbox
2659
+ enqueueRequest: {
2660
+ reducer: (state, _action) => {
2661
+ return state;
2662
+ },
2663
+ prepare: (payload) => {
2664
+ console.debug("Preparing to enqueue request", payload);
2665
+ const { BASE_URL, ...rest } = payload;
2666
+ return createOfflineAction(rest, BASE_URL);
2667
+ }
2668
+ },
2669
+ markForDeletion(state, action) {
2670
+ state.deletedRequests.push(action.payload);
2671
+ },
2672
+ markAsDeleted(state, action) {
2673
+ const index2 = state.deletedRequests.indexOf(action.payload);
2674
+ if (index2 !== -1)
2675
+ state.deletedRequests.splice(index2, 1);
2676
+ },
2677
+ _setLatestRetryTime: (state, action) => {
2678
+ state.latestRetryTime = action.payload;
2679
+ }
2680
+ }
2681
+ });
2682
+ const selectDeletedRequests = (state) => state.outboxReducer.deletedRequests;
2683
+ const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
2684
+ const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
2685
+ const outboxReducer = outboxSlice.reducer;
2686
+ const initialState$7 = {
2546
2687
  projectAccesses: {}
2547
2688
  };
2548
2689
  const projectAccessSlice = toolkit.createSlice({
2549
2690
  name: "projectAccess",
2550
- initialState: initialState$9,
2551
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$9)),
2691
+ initialState: initialState$7,
2692
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
2552
2693
  reducers: {
2553
2694
  setProjectAccesses: (state, action) => {
2554
2695
  if (!Array.isArray(action.payload))
@@ -2616,7 +2757,7 @@ var __publicField = (obj, key, value) => {
2616
2757
  return projectAccesses;
2617
2758
  };
2618
2759
  const projectAccessReducer = projectAccessSlice.reducer;
2619
- const initialState$8 = {
2760
+ const initialState$6 = {
2620
2761
  projects: {},
2621
2762
  activeProjectId: null,
2622
2763
  recentProjectIds: [],
@@ -2625,7 +2766,7 @@ var __publicField = (obj, key, value) => {
2625
2766
  };
2626
2767
  const projectSlice = toolkit.createSlice({
2627
2768
  name: "projects",
2628
- initialState: initialState$8,
2769
+ initialState: initialState$6,
2629
2770
  reducers: {
2630
2771
  setProjects: (state, action) => {
2631
2772
  const projectsMap = {};
@@ -2671,27 +2812,6 @@ var __publicField = (obj, key, value) => {
2671
2812
  } else {
2672
2813
  throw new Error("Accept project invite: user is not in this project");
2673
2814
  }
2674
- },
2675
- addActiveProjectIssuesCount: (state, action) => {
2676
- if (!state.activeProjectId || !(state.activeProjectId in state.projects)) {
2677
- throw new Error("Update issues count: no active project");
2678
- }
2679
- if (!state.projects[state.activeProjectId].issues_count) {
2680
- state.projects[state.activeProjectId].issues_count = action.payload;
2681
- } else {
2682
- state.projects[state.activeProjectId].issues_count += action.payload;
2683
- }
2684
- },
2685
- addActiveProjectFormSubmissionsCount: (state, action) => {
2686
- if (state.activeProjectId && state.activeProjectId in state.projects) {
2687
- if (!state.projects[state.activeProjectId].form_submissions_count) {
2688
- state.projects[state.activeProjectId].form_submissions_count = action.payload;
2689
- } else {
2690
- state.projects[state.activeProjectId].form_submissions_count += action.payload;
2691
- }
2692
- } else {
2693
- throw new Error("Update form submissions count: no active project");
2694
- }
2695
2815
  }
2696
2816
  }
2697
2817
  });
@@ -2702,9 +2822,7 @@ var __publicField = (obj, key, value) => {
2702
2822
  setActiveProjectId,
2703
2823
  setCreateProjectType,
2704
2824
  deleteProject,
2705
- acceptProjectInvite,
2706
- addActiveProjectIssuesCount,
2707
- addActiveProjectFormSubmissionsCount
2825
+ acceptProjectInvite
2708
2826
  } = projectSlice.actions;
2709
2827
  const selectProjects = (state) => state.projectReducer.projects;
2710
2828
  const selectActiveProjectId = (state) => state.projectReducer.activeProjectId;
@@ -2768,171 +2886,6 @@ var __publicField = (obj, key, value) => {
2768
2886
  });
2769
2887
  }
2770
2888
  );
2771
- const initialState$7 = {
2772
- organizations: {},
2773
- activeOrganizationId: null
2774
- };
2775
- const organizationSlice = toolkit.createSlice({
2776
- name: "organizations",
2777
- initialState: initialState$7,
2778
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
2779
- reducers: {
2780
- setOrganizations: (state, action) => {
2781
- for (const org of action.payload) {
2782
- state.organizations[org.id] = org;
2783
- }
2784
- },
2785
- updateActiveOrganization: (state, action) => {
2786
- if (!state.activeOrganizationId) {
2787
- throw new Error("Cannot update name of active organization. Active organization ID does not exist");
2788
- }
2789
- if (state.activeOrganizationId !== action.payload.id) {
2790
- throw new Error("Tried updating active organization with different organization");
2791
- }
2792
- state.organizations[state.activeOrganizationId] = action.payload;
2793
- },
2794
- setActiveOrganizationId: (state, action) => {
2795
- state.activeOrganizationId = action.payload;
2796
- }
2797
- }
2798
- });
2799
- const { setOrganizations, setActiveOrganizationId, updateActiveOrganization } = organizationSlice.actions;
2800
- const selectActiveOrganizationId = (state) => {
2801
- return state.organizationReducer.activeOrganizationId;
2802
- };
2803
- const selectOrganizations = (state) => {
2804
- return Object.values(state.organizationReducer.organizations);
2805
- };
2806
- const selectOrganizationsMapping = (state) => {
2807
- return state.organizationReducer.organizations;
2808
- };
2809
- const selectOrganizationsWithAccess = toolkit.createSelector(
2810
- [selectOrganizations],
2811
- (organizations) => Object.values(organizations).filter((organization) => organization.has_access)
2812
- );
2813
- const selectActiveOrganization = (state) => {
2814
- const id = selectActiveOrganizationId(state);
2815
- if (!id) {
2816
- return null;
2817
- }
2818
- const organization = state.organizationReducer.organizations[id];
2819
- if (!organization) {
2820
- return null;
2821
- }
2822
- return organization;
2823
- };
2824
- const selectOrganizationUsersIds = toolkit.createSelector(
2825
- [selectOrganizationAccesses],
2826
- (organizationAccesses) => Object.values(organizationAccesses).map((organizationAccess) => organizationAccess.user)
2827
- );
2828
- const selectActiveOrganizationProjects = toolkit.createSelector(
2829
- [selectProjects, selectActiveOrganizationId],
2830
- (projects, activeOrganizationId) => activeOrganizationId ? Object.values(projects).filter((project) => project.owner_organization === activeOrganizationId) : []
2831
- );
2832
- const selectActiveOrganizationLicenses = toolkit.createSelector(
2833
- [selectActiveOrganizationId, selectLicenses],
2834
- (activeOrganizationId, licenses) => !activeOrganizationId ? [] : Object.values(licenses).filter((license) => license.organization_owner === activeOrganizationId)
2835
- );
2836
- const selectSortedOrganizationLicenses = toolkit.createSelector(
2837
- [selectActiveOrganizationLicenses, selectProjects],
2838
- (licences, projects) => licences.sort((licenseA, licenseB) => {
2839
- if (!licenseA.project) {
2840
- return 1;
2841
- }
2842
- if (!licenseB.project) {
2843
- return -1;
2844
- }
2845
- return projects[licenseA.project].name.toLowerCase().localeCompare(
2846
- projects[licenseB.project].name.toLowerCase(),
2847
- void 0,
2848
- { numeric: true }
2849
- );
2850
- })
2851
- );
2852
- const selectOrganizationUsersAsMapping = toolkit.createSelector(
2853
- [selectOrganizationUsersIds, selectUsersAsMapping],
2854
- (organizationUserIds, users) => organizationUserIds.reduce((accum, userId) => ({ ...accum, [userId]: users[userId] }), {})
2855
- );
2856
- const selectSortedOrganizationUsers = toolkit.createSelector(
2857
- [selectCurrentUser, selectOrganizationUsersAsMapping, selectOrganizationAccessUserMapping],
2858
- (currentUser, userMapping, organizationAccessMapping) => {
2859
- return Object.values(userMapping).sort((userA, userB) => {
2860
- if (userA.id === currentUser.id) {
2861
- return -1;
2862
- } else if (userB.id === currentUser.id) {
2863
- return 1;
2864
- }
2865
- const organizationAccessesA = organizationAccessMapping[userA.id];
2866
- const organizationAccessesB = organizationAccessMapping[userB.id];
2867
- if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === (organizationAccessesB == null ? void 0 : organizationAccessesB.access_level)) {
2868
- return userA.username.localeCompare(userB.username);
2869
- }
2870
- if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === OrganizationAccessLevel.ADMIN) {
2871
- return -1;
2872
- }
2873
- return 1;
2874
- });
2875
- }
2876
- );
2877
- const selectOrganization = (id) => (state) => {
2878
- return state.organizationReducer.organizations[id];
2879
- };
2880
- const organizationReducer = organizationSlice.reducer;
2881
- const createOfflineAction = (request2, baseUrl) => {
2882
- const requestWithUuid = request2.uuid ? request2 : { ...request2, uuid: uuid.v4() };
2883
- return {
2884
- payload: requestWithUuid,
2885
- type: "",
2886
- meta: {
2887
- offline: {
2888
- effect: {
2889
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
2890
- request: requestWithUuid,
2891
- BASE_URL: baseUrl
2892
- }
2893
- }
2894
- }
2895
- };
2896
- };
2897
- const initialState$6 = {
2898
- deletedRequests: [],
2899
- latestRetryTime: 0
2900
- };
2901
- const outboxSlice = toolkit.createSlice({
2902
- name: "outbox",
2903
- initialState: initialState$6,
2904
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
2905
- reducers: {
2906
- // enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
2907
- // Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
2908
- // Then this reducer enqueueRequest() is responsible for adding the actual request data to the outbox
2909
- enqueueRequest: {
2910
- reducer: (state, _action) => {
2911
- return state;
2912
- },
2913
- prepare: (payload) => {
2914
- console.debug("Preparing to enqueue request", payload);
2915
- const { BASE_URL, ...rest } = payload;
2916
- return createOfflineAction(rest, BASE_URL);
2917
- }
2918
- },
2919
- markForDeletion(state, action) {
2920
- state.deletedRequests.push(action.payload);
2921
- },
2922
- markAsDeleted(state, action) {
2923
- const index2 = state.deletedRequests.indexOf(action.payload);
2924
- if (index2 !== -1)
2925
- state.deletedRequests.splice(index2, 1);
2926
- },
2927
- _setLatestRetryTime: (state, action) => {
2928
- state.latestRetryTime = action.payload;
2929
- }
2930
- }
2931
- });
2932
- const selectDeletedRequests = (state) => state.outboxReducer.deletedRequests;
2933
- const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
2934
- const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
2935
- const outboxReducer = outboxSlice.reducer;
2936
2889
  const initialState$5 = {
2937
2890
  projectFiles: {},
2938
2891
  activeProjectFileId: null,
@@ -3069,9 +3022,7 @@ var __publicField = (obj, key, value) => {
3069
3022
  Components: false,
3070
3023
  Experimental: false
3071
3024
  },
3072
- appearance: "dark",
3073
- isFetchingInitialData: false,
3074
- isLoading: false
3025
+ appearance: "dark"
3075
3026
  };
3076
3027
  const settingSlice = toolkit.createSlice({
3077
3028
  name: "settings",
@@ -3095,12 +3046,6 @@ var __publicField = (obj, key, value) => {
3095
3046
  },
3096
3047
  setAppearance: (state, action) => {
3097
3048
  state.appearance = action.payload;
3098
- },
3099
- setIsFetchingInitialData: (state, action) => {
3100
- state.isFetchingInitialData = action.payload;
3101
- },
3102
- setIsLoading: (state, action) => {
3103
- state.isLoading = action.payload;
3104
3049
  }
3105
3050
  }
3106
3051
  });
@@ -3109,9 +3054,7 @@ var __publicField = (obj, key, value) => {
3109
3054
  setEnablePlacementMode,
3110
3055
  setSectionExpanded,
3111
3056
  setEnableClustering,
3112
- setAppearance,
3113
- setIsFetchingInitialData,
3114
- setIsLoading
3057
+ setAppearance
3115
3058
  } = settingSlice.actions;
3116
3059
  const selectEnablePlacementMode = (state) => state.settingReducer.placementMode;
3117
3060
  const selectEnableDuplicateIssues = (state) => state.settingReducer.useIssueTemplate;
@@ -3120,8 +3063,6 @@ var __publicField = (obj, key, value) => {
3120
3063
  const selectEnableClustering = (state) => state.settingReducer.enableClustering;
3121
3064
  const selectAppearance = (state) => state.settingReducer.appearance;
3122
3065
  const settingReducer = settingSlice.reducer;
3123
- const selectIsFetchingInitialData = (state) => state.settingReducer.isFetchingInitialData;
3124
- const selectIsLoading = (state) => state.settingReducer.isLoading;
3125
3066
  const LATEST_REVISION_CACHE = {};
3126
3067
  function considerCachingRevision(revision, formId2, preferPending = false) {
3127
3068
  var _a2;
@@ -3540,8 +3481,7 @@ var __publicField = (obj, key, value) => {
3540
3481
  userFormReducer,
3541
3482
  userReducer,
3542
3483
  workspaceReducer,
3543
- emailDomainsReducer,
3544
- licenseReducer
3484
+ emailDomainsReducer
3545
3485
  };
3546
3486
  const overmapReducer = toolkit.combineReducers(overmapReducers);
3547
3487
  const resetStore = "RESET";
@@ -4062,22 +4002,86 @@ var __publicField = (obj, key, value) => {
4062
4002
  }
4063
4003
  return promise;
4064
4004
  }
4065
- }
4066
- class AttachmentService extends BaseApiService {
4067
- fetchAll(projectId) {
4005
+ }
4006
+ class AttachmentService extends BaseApiService {
4007
+ fetchAll(projectId) {
4008
+ const promise = this.enqueueRequest({
4009
+ description: "Fetch attachments",
4010
+ method: HttpMethod.GET,
4011
+ url: `/attachments/${projectId}/`,
4012
+ blocks: [],
4013
+ blockers: []
4014
+ });
4015
+ const allAttachments = {
4016
+ issue_attachments: Object.values(this.client.store.getState().issueReducer.attachments),
4017
+ component_attachments: Object.values(this.client.store.getState().componentReducer.attachments),
4018
+ component_type_attachments: Object.values(this.client.store.getState().componentTypeReducer.attachments)
4019
+ };
4020
+ return [allAttachments, promise];
4021
+ }
4022
+ // Attachments aren't models, so we use the OptimisticGenericResult type instead
4023
+ async addIssueAttachment(attachmentPayload) {
4024
+ const { description: description2, issue_id, file_sha1, offline_id } = attachmentPayload;
4025
+ if (!attachmentPayload.file.objectURL) {
4026
+ throw new Error("Expected attachmentPayload.file.objectURL to be defined.");
4027
+ }
4028
+ const offlineAttachment = {
4029
+ ...attachmentPayload,
4030
+ file: attachmentPayload.file.objectURL,
4031
+ file_name: attachmentPayload.file.name,
4032
+ file_type: attachmentPayload.file.type
4033
+ };
4034
+ await this.client.files.addCache(attachmentPayload.file, file_sha1);
4035
+ this.client.store.dispatch(addIssueAttachment(offlineAttachment));
4036
+ const [fileProps] = await this.client.files.uploadFileToS3(file_sha1);
4037
+ const promise = this.enqueueRequest({
4038
+ description: "Create attachment",
4039
+ method: HttpMethod.POST,
4040
+ url: `/issues/${issue_id}/attach/`,
4041
+ blocks: [offline_id, issue_id],
4042
+ blockers: [file_sha1],
4043
+ payload: {
4044
+ offline_id,
4045
+ issue: issue_id,
4046
+ description: description2 ?? "",
4047
+ submitted_at: (/* @__PURE__ */ new Date()).getTime() / 1e3,
4048
+ ...fileProps
4049
+ }
4050
+ });
4051
+ return [offlineAttachment, promise];
4052
+ }
4053
+ async addComponentAttachment(attachmentPayload) {
4054
+ const { description: description2, component_id, file_sha1, offline_id } = attachmentPayload;
4055
+ if (!attachmentPayload.file.objectURL) {
4056
+ throw new Error("Expected attachmentPayload.file.objectURL to be defined.");
4057
+ }
4058
+ const offlineAttachment = {
4059
+ ...attachmentPayload,
4060
+ file: attachmentPayload.file.objectURL,
4061
+ file_name: attachmentPayload.file.name,
4062
+ file_type: attachmentPayload.file.type
4063
+ };
4064
+ await this.client.files.addCache(attachmentPayload.file, file_sha1);
4065
+ this.client.store.dispatch(addComponentAttachment(offlineAttachment));
4066
+ const [fileProps] = await this.client.files.uploadFileToS3(file_sha1);
4068
4067
  const promise = this.enqueueRequest({
4069
- description: "Fetch attachments",
4070
- method: HttpMethod.GET,
4071
- url: `/attachments/${projectId}/`,
4072
- blocks: [],
4073
- blockers: []
4068
+ description: "Create attachment",
4069
+ method: HttpMethod.POST,
4070
+ url: `/components/${component_id}/attach/`,
4071
+ blocks: [offline_id, component_id],
4072
+ blockers: [file_sha1],
4073
+ payload: {
4074
+ offline_id,
4075
+ component: component_id,
4076
+ description: description2 ?? "",
4077
+ submitted_at: (/* @__PURE__ */ new Date()).getTime() / 1e3,
4078
+ ...fileProps
4079
+ }
4074
4080
  });
4075
- const allAttachments = Object.values(this.client.store.getState().issueReducer.attachments);
4076
- return [allAttachments, promise];
4081
+ return [offlineAttachment, promise];
4077
4082
  }
4078
- // Attachments aren't models, so we use the OptimisticGenericResult type instead
4079
- async add(attachmentPayload) {
4080
- const { description: description2, issue_id, file_sha1, offline_id } = attachmentPayload;
4083
+ async addComponentTypeAttachment(attachmentPayload) {
4084
+ const { description: description2, component_type_id, file_sha1, offline_id } = attachmentPayload;
4081
4085
  if (!attachmentPayload.file.objectURL) {
4082
4086
  throw new Error("Expected attachmentPayload.file.objectURL to be defined.");
4083
4087
  }
@@ -4088,17 +4092,17 @@ var __publicField = (obj, key, value) => {
4088
4092
  file_type: attachmentPayload.file.type
4089
4093
  };
4090
4094
  await this.client.files.addCache(attachmentPayload.file, file_sha1);
4091
- this.client.store.dispatch(addAttachment(offlineAttachment));
4095
+ this.client.store.dispatch(addComponentTypeAttachment(offlineAttachment));
4092
4096
  const [fileProps] = await this.client.files.uploadFileToS3(file_sha1);
4093
4097
  const promise = this.enqueueRequest({
4094
4098
  description: "Create attachment",
4095
4099
  method: HttpMethod.POST,
4096
- url: `/issues/${issue_id}/attach/`,
4097
- blocks: [offline_id, issue_id],
4100
+ url: `/component_types/${component_type_id}/attach/`,
4101
+ blocks: [offline_id, component_type_id],
4098
4102
  blockers: [file_sha1],
4099
4103
  payload: {
4100
4104
  offline_id,
4101
- issue: issue_id,
4105
+ component_type: component_type_id,
4102
4106
  description: description2 ?? "",
4103
4107
  submitted_at: (/* @__PURE__ */ new Date()).getTime() / 1e3,
4104
4108
  ...fileProps
@@ -4106,27 +4110,67 @@ var __publicField = (obj, key, value) => {
4106
4110
  });
4107
4111
  return [offlineAttachment, promise];
4108
4112
  }
4109
- async attachFilesToIssue(filesToSubmit, issueId) {
4110
- return Promise.allSettled(
4111
- filesToSubmit.map((file) => {
4112
- if (!(file instanceof File)) {
4113
- throw new Error("Expected a File instance.");
4114
- }
4115
- const photoAttachmentPromise = async (file2) => {
4116
- const hash = await hashFile(file2);
4117
- const attachment = offline({
4118
- file: file2,
4119
- // No description for now
4120
- issue_id: issueId,
4121
- file_sha1: hash
4122
- });
4123
- return await this.add(attachment);
4124
- };
4125
- return photoAttachmentPromise(file);
4126
- })
4127
- );
4113
+ /** the outer Promise is needed to await the hashing of each file, which is required before offline use. If wanting to
4114
+ * attach promise handlers to the request to add the attachment in the backend, apply it on the promise returned from the
4115
+ * OptimisticModelResult. */
4116
+ attachFilesToIssue(filesToSubmit, issueId) {
4117
+ return filesToSubmit.map((file) => {
4118
+ if (!(file instanceof File)) {
4119
+ throw new Error("Expected a File instance.");
4120
+ }
4121
+ const photoAttachmentPromise = async (file2) => {
4122
+ const hash = await hashFile(file2);
4123
+ const attachment = offline({
4124
+ file: file2,
4125
+ file_name: file2.name,
4126
+ file_type: file2.type,
4127
+ issue_id: issueId,
4128
+ file_sha1: hash
4129
+ });
4130
+ return this.addIssueAttachment(attachment);
4131
+ };
4132
+ return photoAttachmentPromise(file);
4133
+ });
4134
+ }
4135
+ attachFilesToComponent(filesToSubmit, componentId) {
4136
+ return filesToSubmit.map((file) => {
4137
+ if (!(file instanceof File)) {
4138
+ throw new Error("Expected a File instance.");
4139
+ }
4140
+ const photoAttachmentPromise = async (file2) => {
4141
+ const hash = await hashFile(file2);
4142
+ const attachment = offline({
4143
+ file: file2,
4144
+ file_name: file2.name,
4145
+ file_type: file2.type,
4146
+ component_id: componentId,
4147
+ file_sha1: hash
4148
+ });
4149
+ return this.addComponentAttachment(attachment);
4150
+ };
4151
+ return photoAttachmentPromise(file);
4152
+ });
4153
+ }
4154
+ attachFilesToComponentType(filesToSubmit, componentTypeId) {
4155
+ return filesToSubmit.map((file) => {
4156
+ if (!(file instanceof File)) {
4157
+ throw new Error("Expected a File instance.");
4158
+ }
4159
+ const photoAttachmentPromise = async (file2) => {
4160
+ const hash = await hashFile(file2);
4161
+ const attachment = offline({
4162
+ file: file2,
4163
+ file_name: file2.name,
4164
+ file_type: file2.type,
4165
+ component_type_id: componentTypeId,
4166
+ file_sha1: hash
4167
+ });
4168
+ return this.addComponentTypeAttachment(attachment);
4169
+ };
4170
+ return photoAttachmentPromise(file);
4171
+ });
4128
4172
  }
4129
- async replaceFile(attachmentId, newFile) {
4173
+ async replaceIssueAttachmentFile(attachmentId, newFile) {
4130
4174
  const { store } = this.client;
4131
4175
  const attachment = store.getState().issueReducer.attachments[attachmentId];
4132
4176
  if (!attachment)
@@ -4141,16 +4185,136 @@ var __publicField = (obj, key, value) => {
4141
4185
  if (!newFile.objectURL) {
4142
4186
  throw new Error(`newFile["objectURL"] is unexpectedly ${newFile.objectURL}`);
4143
4187
  }
4144
- store.dispatch(updateAttachment({ ...attachment, file_sha1: newSha1, file: URL.createObjectURL(newFile) }));
4188
+ store.dispatch(
4189
+ updateIssueAttachment({ ...attachment, file_sha1: newSha1, file: URL.createObjectURL(newFile) })
4190
+ );
4191
+ await this.client.files.addCache(newFile, newSha1);
4192
+ const [fileProps] = await this.client.files.uploadFileToS3(newSha1).catch((e) => {
4193
+ store.dispatch(updateIssueAttachment(attachment));
4194
+ throw e;
4195
+ });
4196
+ const promise2 = this.enqueueRequest({
4197
+ description: "Edit attachment",
4198
+ method: HttpMethod.PATCH,
4199
+ url: `/attachments/issues/${attachment.offline_id}/`,
4200
+ isResponseBlob: false,
4201
+ payload: fileProps,
4202
+ blockers: [attachmentId, newSha1],
4203
+ blocks: [attachmentId, newSha1]
4204
+ });
4205
+ try {
4206
+ const result = await promise2;
4207
+ void this.client.files.removeCache(attachment.file_sha1);
4208
+ return result;
4209
+ } catch (e) {
4210
+ if (oldFile) {
4211
+ store.dispatch(
4212
+ updateIssueAttachment({
4213
+ ...attachment,
4214
+ file_sha1: attachment.file_sha1,
4215
+ file: URL.createObjectURL(oldFile)
4216
+ })
4217
+ );
4218
+ }
4219
+ throw e;
4220
+ }
4221
+ };
4222
+ const offlineAttachment = {
4223
+ ...attachment,
4224
+ file_sha1: newSha1,
4225
+ file: URL.createObjectURL(newFile)
4226
+ };
4227
+ const promise = performRequest2();
4228
+ return [offlineAttachment, promise];
4229
+ }
4230
+ async replaceComponentAttachmentFile(attachmentId, newFile) {
4231
+ const { store } = this.client;
4232
+ const attachment = store.getState().componentReducer.attachments[attachmentId];
4233
+ if (!attachment)
4234
+ throw new Error(`Attachment ${attachmentId} not found`);
4235
+ let oldFile = void 0;
4236
+ const newSha1 = await hashFile(newFile);
4237
+ const performRequest2 = async () => {
4238
+ oldFile = await this.client.files.fetchCache(attachment.file_sha1);
4239
+ if (!oldFile) {
4240
+ console.error(`Failed to fetch old file from cache for sha1 ${attachment.file_sha1}.`);
4241
+ }
4242
+ if (!newFile.objectURL) {
4243
+ throw new Error(`newFile["objectURL"] is unexpectedly ${newFile.objectURL}`);
4244
+ }
4245
+ store.dispatch(
4246
+ updateComponentAttachment({ ...attachment, file_sha1: newSha1, file: URL.createObjectURL(newFile) })
4247
+ );
4248
+ await this.client.files.addCache(newFile, newSha1);
4249
+ const [fileProps] = await this.client.files.uploadFileToS3(newSha1).catch((e) => {
4250
+ store.dispatch(updateComponentAttachment(attachment));
4251
+ throw e;
4252
+ });
4253
+ const promise2 = this.enqueueRequest({
4254
+ description: "Edit attachment",
4255
+ method: HttpMethod.PATCH,
4256
+ url: `/attachments/components/${attachment.offline_id}/`,
4257
+ isResponseBlob: false,
4258
+ payload: fileProps,
4259
+ blockers: [attachmentId, newSha1],
4260
+ blocks: [attachmentId, newSha1]
4261
+ });
4262
+ try {
4263
+ const result = await promise2;
4264
+ void this.client.files.removeCache(attachment.file_sha1);
4265
+ return result;
4266
+ } catch (e) {
4267
+ if (oldFile) {
4268
+ store.dispatch(
4269
+ updateComponentAttachment({
4270
+ ...attachment,
4271
+ file_sha1: attachment.file_sha1,
4272
+ file: URL.createObjectURL(oldFile)
4273
+ })
4274
+ );
4275
+ }
4276
+ throw e;
4277
+ }
4278
+ };
4279
+ const offlineAttachment = {
4280
+ ...attachment,
4281
+ file_sha1: newSha1,
4282
+ file: URL.createObjectURL(newFile)
4283
+ };
4284
+ const promise = performRequest2();
4285
+ return [offlineAttachment, promise];
4286
+ }
4287
+ async replaceComponentTypeAttachmentFile(attachmentId, newFile) {
4288
+ const { store } = this.client;
4289
+ const attachment = store.getState().componentTypeReducer.attachments[attachmentId];
4290
+ if (!attachment)
4291
+ throw new Error(`Attachment ${attachmentId} not found`);
4292
+ let oldFile = void 0;
4293
+ const newSha1 = await hashFile(newFile);
4294
+ const performRequest2 = async () => {
4295
+ oldFile = await this.client.files.fetchCache(attachment.file_sha1);
4296
+ if (!oldFile) {
4297
+ console.error(`Failed to fetch old file from cache for sha1 ${attachment.file_sha1}.`);
4298
+ }
4299
+ if (!newFile.objectURL) {
4300
+ throw new Error(`newFile["objectURL"] is unexpectedly ${newFile.objectURL}`);
4301
+ }
4302
+ store.dispatch(
4303
+ updateComponentTypeAttachment({
4304
+ ...attachment,
4305
+ file_sha1: newSha1,
4306
+ file: URL.createObjectURL(newFile)
4307
+ })
4308
+ );
4145
4309
  await this.client.files.addCache(newFile, newSha1);
4146
4310
  const [fileProps] = await this.client.files.uploadFileToS3(newSha1).catch((e) => {
4147
- store.dispatch(updateAttachment(attachment));
4311
+ store.dispatch(updateComponentTypeAttachment(attachment));
4148
4312
  throw e;
4149
4313
  });
4150
4314
  const promise2 = this.enqueueRequest({
4151
4315
  description: "Edit attachment",
4152
4316
  method: HttpMethod.PATCH,
4153
- url: `/attachments/${attachment.offline_id}/`,
4317
+ url: `/attachments/component_types/${attachment.offline_id}/`,
4154
4318
  isResponseBlob: false,
4155
4319
  payload: fileProps,
4156
4320
  blockers: [attachmentId, newSha1],
@@ -4163,7 +4327,7 @@ var __publicField = (obj, key, value) => {
4163
4327
  } catch (e) {
4164
4328
  if (oldFile) {
4165
4329
  store.dispatch(
4166
- updateAttachment({
4330
+ updateComponentTypeAttachment({
4167
4331
  ...attachment,
4168
4332
  file_sha1: attachment.file_sha1,
4169
4333
  file: URL.createObjectURL(oldFile)
@@ -4183,23 +4347,54 @@ var __publicField = (obj, key, value) => {
4183
4347
  }
4184
4348
  /**
4185
4349
  * Deletes an attachment and associated data in the cloud, in the Redux store and the cache.
4186
- * @param attachmentId
4350
+ * @param issueAttachmentId
4187
4351
  */
4188
- delete(attachmentId) {
4352
+ deleteIssueAttachment(issueAttachmentId) {
4189
4353
  const { store } = this.client;
4190
- const storeStateIssueReducer = store.getState().issueReducer;
4191
- const attachment = storeStateIssueReducer.attachments[attachmentId];
4354
+ const attachment = selectIssueAttachmentMapping(store.getState())[issueAttachmentId];
4192
4355
  if (!attachment) {
4193
- throw new Error(`Attachment ${attachmentId} not found`);
4356
+ throw new Error(`Attachment ${issueAttachmentId} not found`);
4357
+ }
4358
+ store.dispatch(removeIssueAttachment(issueAttachmentId));
4359
+ void this.client.files.removeCache(attachment.file_sha1);
4360
+ return this.enqueueRequest({
4361
+ description: "Delete attachment",
4362
+ method: HttpMethod.DELETE,
4363
+ url: `/attachments/issues/${issueAttachmentId}/`,
4364
+ blockers: [issueAttachmentId],
4365
+ blocks: [issueAttachmentId]
4366
+ });
4367
+ }
4368
+ deleteComponentAttachment(componentAttachmentId) {
4369
+ const { store } = this.client;
4370
+ const attachment = selectComponentAttachmentMapping(store.getState())[componentAttachmentId];
4371
+ if (!attachment) {
4372
+ throw new Error(`Attachment ${componentAttachmentId} not found`);
4373
+ }
4374
+ store.dispatch(removeIssueAttachment(componentAttachmentId));
4375
+ void this.client.files.removeCache(attachment.file_sha1);
4376
+ return this.enqueueRequest({
4377
+ description: "Delete attachment",
4378
+ method: HttpMethod.DELETE,
4379
+ url: `/attachments/components/${componentAttachmentId}/`,
4380
+ blockers: [componentAttachmentId],
4381
+ blocks: [componentAttachmentId]
4382
+ });
4383
+ }
4384
+ deleteComponentTypeAttachment(componentTypeAttachmentId) {
4385
+ const { store } = this.client;
4386
+ const attachment = selectComponentTypeAttachmentMapping(store.getState())[componentTypeAttachmentId];
4387
+ if (!attachment) {
4388
+ throw new Error(`Attachment ${componentTypeAttachmentId} not found`);
4194
4389
  }
4195
- store.dispatch(removeAttachment(attachmentId));
4390
+ store.dispatch(removeIssueAttachment(componentTypeAttachmentId));
4196
4391
  void this.client.files.removeCache(attachment.file_sha1);
4197
4392
  return this.enqueueRequest({
4198
4393
  description: "Delete attachment",
4199
4394
  method: HttpMethod.DELETE,
4200
- url: `/attachments/${attachmentId}/`,
4201
- blockers: [attachmentId],
4202
- blocks: [attachmentId]
4395
+ url: `/attachments/component_types/${componentTypeAttachmentId}/`,
4396
+ blockers: [componentTypeAttachmentId],
4397
+ blocks: [componentTypeAttachmentId]
4203
4398
  });
4204
4399
  }
4205
4400
  }
@@ -4591,13 +4786,26 @@ var __publicField = (obj, key, value) => {
4591
4786
  return [component, promise];
4592
4787
  }
4593
4788
  async remove(id) {
4594
- this.client.store.dispatch(removeComponent(id));
4789
+ const { store } = this.client;
4790
+ const backupComponent = selectComponent(id)(store.getState());
4791
+ if (!backupComponent)
4792
+ throw new Error(`No component with id ${id} found in the store`);
4793
+ const attachmentsOfComponent = selectAttachmentsOfComponent(id)(store.getState());
4794
+ store.dispatch(removeComponent(id));
4795
+ if (attachmentsOfComponent.length > 0) {
4796
+ const attachmentsOfComponentIds = attachmentsOfComponent.map(({ offline_id }) => offline_id);
4797
+ store.dispatch(removeComponentAttachments(attachmentsOfComponentIds));
4798
+ }
4595
4799
  return this.enqueueRequest({
4596
4800
  description: "Delete issue",
4597
4801
  method: HttpMethod.DELETE,
4598
4802
  url: `/components/${id}/`,
4599
4803
  blockers: [id],
4600
4804
  blocks: []
4805
+ }).catch((err) => {
4806
+ store.dispatch(addComponent(backupComponent));
4807
+ store.dispatch(addComponentAttachments(attachmentsOfComponent));
4808
+ throw err;
4601
4809
  });
4602
4810
  }
4603
4811
  async deleteAllByComponentType(componentTypeId) {
@@ -4908,13 +5116,19 @@ var __publicField = (obj, key, value) => {
4908
5116
  if (!componentType) {
4909
5117
  throw new Error("Expected componentType to exist");
4910
5118
  }
4911
- const componentTypeStages = selectStagesFromComponentType(componentTypeId)(state) ?? [];
4912
- store.dispatch(
4913
- removeStages(
4914
- componentTypeStages.map((componentTypeStage) => componentTypeStage.offline_id)
4915
- )
4916
- );
5119
+ const stagesOfComponentType = selectStagesFromComponentType(componentTypeId)(state) ?? [];
5120
+ const attachmentsOfComponentType = selectAttachmentsOfComponentType(componentTypeId)(state);
4917
5121
  store.dispatch(deleteComponentType(componentTypeId));
5122
+ if (stagesOfComponentType.length > 0) {
5123
+ const stagesOfComponentTypeIds = stagesOfComponentType.map(
5124
+ (componentTypeStage) => componentTypeStage.offline_id
5125
+ );
5126
+ store.dispatch(removeStages(stagesOfComponentTypeIds));
5127
+ }
5128
+ if (attachmentsOfComponentType.length > 0) {
5129
+ const attachmentsOfComponentTypeIds = attachmentsOfComponentType.map(({ offline_id }) => offline_id);
5130
+ store.dispatch(removeComponentTypeAttachments(attachmentsOfComponentTypeIds));
5131
+ }
4918
5132
  return this.enqueueRequest({
4919
5133
  description: "Delete ComponentType",
4920
5134
  method: HttpMethod.DELETE,
@@ -4923,7 +5137,8 @@ var __publicField = (obj, key, value) => {
4923
5137
  blocks: []
4924
5138
  }).catch((e) => {
4925
5139
  store.dispatch(addComponentType(componentType));
4926
- store.dispatch(addStages(componentTypeStages));
5140
+ store.dispatch(addStages(stagesOfComponentType));
5141
+ store.dispatch(addComponentTypeAttachments(attachmentsOfComponentType));
4927
5142
  throw e;
4928
5143
  });
4929
5144
  }
@@ -5028,7 +5243,6 @@ var __publicField = (obj, key, value) => {
5028
5243
  });
5029
5244
  store.dispatch(addIssue(issuePayload));
5030
5245
  store.dispatch(addToRecentIssues(issuePayload.offline_id));
5031
- store.dispatch(addActiveProjectIssuesCount(1));
5032
5246
  const promise = this.enqueueRequest({
5033
5247
  description: "Create issue",
5034
5248
  method: HttpMethod.POST,
@@ -5038,7 +5252,6 @@ var __publicField = (obj, key, value) => {
5038
5252
  },
5039
5253
  payload: issuePayload,
5040
5254
  blockers: [
5041
- "add-issue",
5042
5255
  ...issuePayload.index_workspace ? [issuePayload.index_workspace] : [],
5043
5256
  ...issuePayload.visible_in_workspaces
5044
5257
  ],
@@ -5056,7 +5269,6 @@ var __publicField = (obj, key, value) => {
5056
5269
  });
5057
5270
  }
5058
5271
  store.dispatch(removeIssue(issuePayload.offline_id));
5059
- store.dispatch(addActiveProjectIssuesCount(-1));
5060
5272
  throw error2;
5061
5273
  });
5062
5274
  return [issuePayload, promise];
@@ -5095,18 +5307,16 @@ var __publicField = (obj, key, value) => {
5095
5307
  return [fullIssue, promise];
5096
5308
  }
5097
5309
  async remove(id) {
5098
- const { store } = this.client;
5099
- const state = store.getState();
5310
+ const state = this.client.store.getState();
5100
5311
  const backup = state.issueReducer.issues[id];
5101
5312
  if (!backup) {
5102
5313
  throw new Error(`No issue with id ${id} found in the store`);
5103
5314
  }
5104
5315
  const attachments = Object.values(state.issueReducer.attachments).filter((a) => a.issue_id === id);
5105
5316
  const attachmentsOfIssue = selectPhotoAttachmentsOfIssue(id)(state);
5106
- store.dispatch(removeIssue(id));
5107
- store.dispatch(addActiveProjectIssuesCount(-1));
5317
+ this.client.store.dispatch(removeIssue(id));
5108
5318
  if (attachmentsOfIssue) {
5109
- store.dispatch(removeAttachmentsOfIssue(id));
5319
+ this.client.store.dispatch(removeAttachmentsOfIssue(id));
5110
5320
  }
5111
5321
  try {
5112
5322
  return await this.enqueueRequest({
@@ -5117,9 +5327,8 @@ var __publicField = (obj, key, value) => {
5117
5327
  blocks: []
5118
5328
  });
5119
5329
  } catch (e) {
5120
- store.dispatch(addIssue(backup));
5121
- store.dispatch(addAttachments(attachments));
5122
- store.dispatch(addActiveProjectIssuesCount(1));
5330
+ this.client.store.dispatch(addIssue(backup));
5331
+ this.client.store.dispatch(addIssueAttachments(attachments));
5123
5332
  throw e;
5124
5333
  }
5125
5334
  }
@@ -5195,9 +5404,7 @@ var __publicField = (obj, key, value) => {
5195
5404
  owner_organization: projectData.organization_owner,
5196
5405
  owner_user: projectData.user_owner,
5197
5406
  bounds: projectData.bounds,
5198
- invited: projectData.invited || false,
5199
- issues_count: projectData.issues_count,
5200
- form_submissions_count: projectData.form_submissions_count
5407
+ invited: projectData.invited || false
5201
5408
  });
5202
5409
  if (currentProjectId === projectData.id && !projectData.invited) {
5203
5410
  isProjectIdValid = true;
@@ -5215,7 +5422,6 @@ var __publicField = (obj, key, value) => {
5215
5422
  }
5216
5423
  store.dispatch(setCurrentUser(data.user));
5217
5424
  store.dispatch(addUsers(data.project_owners));
5218
- store.dispatch(setLicenses(data.licenses));
5219
5425
  const organizationsData = data.organizations;
5220
5426
  store.dispatch(setOrganizations(organizationsData));
5221
5427
  const validProjects = projects.filter((project) => !project.invited);
@@ -5294,7 +5500,10 @@ var __publicField = (obj, key, value) => {
5294
5500
  if (currentProjectId) {
5295
5501
  const [_offlineAttachments, promise] = this.client.attachments.fetchAll(currentProjectId);
5296
5502
  void promise.then((result) => {
5297
- store.dispatch(setAttachments(result));
5503
+ const { issue_attachments, component_type_attachments, component_attachments } = result;
5504
+ store.dispatch(setIssueAttachments(issue_attachments));
5505
+ store.dispatch(setComponentAttachments(component_attachments));
5506
+ store.dispatch(setComponentTypeAttachments(component_type_attachments));
5298
5507
  });
5299
5508
  }
5300
5509
  store.dispatch(setIsFetchingInitialData(false));
@@ -5329,7 +5538,7 @@ var __publicField = (obj, key, value) => {
5329
5538
  method: HttpMethod.PATCH,
5330
5539
  url: `/access/${projectAccess.offline_id}/`,
5331
5540
  payload: projectAccess,
5332
- blockers: [projectAccess.offline_id, "change-access-level"],
5541
+ blockers: [projectAccess.offline_id],
5333
5542
  blocks: [projectAccess.offline_id]
5334
5543
  });
5335
5544
  }
@@ -5538,11 +5747,6 @@ var __publicField = (obj, key, value) => {
5538
5747
  store.dispatch(removeProjectAccessesOfProject(project.id));
5539
5748
  store.dispatch({ type: "rehydrated/setRehydrated", payload: false });
5540
5749
  store.dispatch(deleteProject(project));
5541
- const licenseSelector = selectLicenseForProject(project.id);
5542
- const license = licenseSelector(state);
5543
- if (license) {
5544
- store.dispatch(updateLicense({ ...license, project: null }));
5545
- }
5546
5750
  try {
5547
5751
  await this.enqueueRequest({
5548
5752
  description: "Delete project",
@@ -5558,9 +5762,6 @@ var __publicField = (obj, key, value) => {
5558
5762
  store.dispatch(addOrReplaceProjectFiles(filesToDelete));
5559
5763
  store.dispatch(setActiveProjectId(activeProjectId));
5560
5764
  store.dispatch({ type: "rehydrated/setRehydrated", payload: true });
5561
- if (license) {
5562
- store.dispatch(updateLicense({ ...license, project: project.id }));
5563
- }
5564
5765
  throw e;
5565
5766
  }
5566
5767
  }
@@ -5935,7 +6136,7 @@ var __publicField = (obj, key, value) => {
5935
6136
  method: HttpMethod.POST,
5936
6137
  url: `/forms/revisions/${payload.form_revision}/respond/`,
5937
6138
  payload: { ...payloadWithoutFiles, project: activeProjectId },
5938
- blockers: [payload.issue, payload.component, payload.component_stage, "add-form-entry"].filter(
6139
+ blockers: [payload.issue, payload.component, payload.component_stage].filter(
5939
6140
  (x) => x !== void 0
5940
6141
  ),
5941
6142
  blocks: [payload.offline_id]
@@ -5954,12 +6155,10 @@ var __publicField = (obj, key, value) => {
5954
6155
  };
5955
6156
  store.dispatch(updateOrCreateUserFormSubmission(offlineResultWithoutFiles));
5956
6157
  void promise.then((result) => {
5957
- store.dispatch(addActiveProjectFormSubmissionsCount(1));
5958
6158
  store.dispatch(updateOrCreateUserFormSubmission(result));
5959
6159
  return result;
5960
6160
  }).catch(() => {
5961
6161
  store.dispatch(deleteUserFormSubmission(payload.offline_id));
5962
- store.dispatch(addActiveProjectFormSubmissionsCount(-1));
5963
6162
  });
5964
6163
  const settledPromise = Promise.all([promise, ...attachFilesPromises]).then(() => promise);
5965
6164
  return [fullOfflineResult, settledPromise];
@@ -5993,7 +6192,6 @@ var __publicField = (obj, key, value) => {
5993
6192
  const state = store.getState();
5994
6193
  const submission = state.userFormReducer.submissions[submissionId];
5995
6194
  store.dispatch(deleteUserFormSubmission(submissionId));
5996
- store.dispatch(addActiveProjectFormSubmissionsCount(-1));
5997
6195
  try {
5998
6196
  return await this.enqueueRequest({
5999
6197
  description: "Delete user form submissions",
@@ -6004,7 +6202,6 @@ var __publicField = (obj, key, value) => {
6004
6202
  });
6005
6203
  } catch (e) {
6006
6204
  if (submission) {
6007
- store.dispatch(addActiveProjectFormSubmissionsCount(1));
6008
6205
  store.dispatch(updateOrCreateUserFormSubmission(submission));
6009
6206
  }
6010
6207
  throw e;
@@ -6041,7 +6238,7 @@ var __publicField = (obj, key, value) => {
6041
6238
  method: HttpMethod.POST,
6042
6239
  url: `/projects/${store.getState().projectReducer.activeProjectId}/workspaces/`,
6043
6240
  payload: offlineWorkspace,
6044
- blockers: ["add-workspace"],
6241
+ blockers: [],
6045
6242
  blocks: [offlineWorkspace.offline_id]
6046
6243
  });
6047
6244
  void promise.then((result) => {
@@ -6462,121 +6659,6 @@ var __publicField = (obj, key, value) => {
6462
6659
  });
6463
6660
  }
6464
6661
  }
6465
- class LicenseService extends BaseApiService {
6466
- async fetchLicensesForOrganization(organizationId, showLoading = false) {
6467
- if (showLoading) {
6468
- this.client.store.dispatch(setIsFetchingInitialData(true));
6469
- }
6470
- const result = await this.enqueueRequest({
6471
- description: "Get licenses",
6472
- method: HttpMethod.GET,
6473
- url: `/organizations/${organizationId}/licenses/`,
6474
- isAuthNeeded: true,
6475
- blockers: [organizationId.toString()],
6476
- blocks: ["add-issue", "add-form-entry", "change-access-level", "add-workspace"]
6477
- });
6478
- if (showLoading) {
6479
- this.client.store.dispatch(setIsFetchingInitialData(false));
6480
- }
6481
- return result;
6482
- }
6483
- async getLicense(license) {
6484
- const result = await this.enqueueRequest({
6485
- description: "Get license",
6486
- method: HttpMethod.GET,
6487
- url: `/billing/${license.offline_id}/`,
6488
- isAuthNeeded: true,
6489
- blockers: [
6490
- license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
6491
- ],
6492
- blocks: []
6493
- });
6494
- this.client.store.dispatch(updateLicense(result));
6495
- return result;
6496
- }
6497
- async pauseLicense(license) {
6498
- const result = await this.enqueueRequest({
6499
- description: "Pause license",
6500
- method: HttpMethod.DELETE,
6501
- url: `/billing/${license.offline_id}/suspend/`,
6502
- isAuthNeeded: true,
6503
- blockers: [
6504
- license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
6505
- ],
6506
- blocks: []
6507
- });
6508
- this.client.store.dispatch(updateLicense(result));
6509
- return result;
6510
- }
6511
- async resumeLicense(license) {
6512
- const result = await this.enqueueRequest({
6513
- description: "Resume license",
6514
- method: HttpMethod.PATCH,
6515
- url: `/billing/${license.offline_id}/suspend/`,
6516
- isAuthNeeded: true,
6517
- blockers: [
6518
- license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
6519
- ],
6520
- blocks: []
6521
- });
6522
- this.client.store.dispatch(updateLicense(result));
6523
- return result;
6524
- }
6525
- async cancelLicense(license) {
6526
- const result = await this.enqueueRequest({
6527
- description: "Cancel license",
6528
- method: HttpMethod.DELETE,
6529
- url: `/billing/${license.offline_id}/`,
6530
- isAuthNeeded: true,
6531
- blockers: [
6532
- license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
6533
- ],
6534
- blocks: []
6535
- });
6536
- this.client.store.dispatch(updateLicense(result));
6537
- return result;
6538
- }
6539
- async attachLicenseToProject(license, project) {
6540
- const result = await this.enqueueRequest({
6541
- description: "Attach license",
6542
- method: HttpMethod.PATCH,
6543
- url: `/billing/${license.offline_id}/project/`,
6544
- isAuthNeeded: true,
6545
- payload: { project: project.id },
6546
- blockers: [
6547
- license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : "",
6548
- project.id ? project.id.toString() : ""
6549
- ],
6550
- blocks: ["add-issue", "add-form-entry", "change-access-level", "add-workspace"]
6551
- });
6552
- this.client.store.dispatch(updateLicense(result));
6553
- return result;
6554
- }
6555
- async detachLicenseFromProject(license) {
6556
- const result = await this.enqueueRequest({
6557
- description: "Detach license",
6558
- method: HttpMethod.DELETE,
6559
- url: `/billing/${license.offline_id}/project/`,
6560
- isAuthNeeded: true,
6561
- blockers: [
6562
- license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
6563
- ],
6564
- blocks: ["add-issue", "add-form-entry", "change-access-level", "add-workspace"]
6565
- });
6566
- this.client.store.dispatch(updateLicense(result));
6567
- return result;
6568
- }
6569
- async getLatestTransaction(license) {
6570
- return await this.enqueueRequest({
6571
- description: "Get latest transaction",
6572
- method: HttpMethod.GET,
6573
- url: `/billing/${license.offline_id}/transaction/`,
6574
- isAuthNeeded: true,
6575
- blockers: [license.offline_id],
6576
- blocks: [license.offline_id]
6577
- });
6578
- }
6579
- }
6580
6662
  class OvermapSDK {
6581
6663
  constructor(apiUrl, store) {
6582
6664
  __publicField(this, "API_URL");
@@ -6602,7 +6684,6 @@ var __publicField = (obj, key, value) => {
6602
6684
  __publicField(this, "projectFiles", new ProjectFileService(this));
6603
6685
  __publicField(this, "emailVerification", new EmailVerificationService(this));
6604
6686
  __publicField(this, "emailDomains", new EmailDomainsService(this));
6605
- __publicField(this, "licenses", new LicenseService(this));
6606
6687
  this.API_URL = apiUrl;
6607
6688
  this.store = store;
6608
6689
  }
@@ -14615,9 +14696,6 @@ var __publicField = (obj, key, value) => {
14615
14696
  exports2.IssuePriority = IssuePriority;
14616
14697
  exports2.IssueService = IssueService;
14617
14698
  exports2.IssueStatus = IssueStatus;
14618
- exports2.LicenseLevel = LicenseLevel;
14619
- exports2.LicenseService = LicenseService;
14620
- exports2.LicenseStatus = LicenseStatus;
14621
14699
  exports2.MainService = MainService;
14622
14700
  exports2.MapStyle = MapStyle;
14623
14701
  exports2.MultiSelectField = MultiSelectField;
@@ -14635,7 +14713,6 @@ var __publicField = (obj, key, value) => {
14635
14713
  exports2.OvermapProvider = OvermapProvider;
14636
14714
  exports2.OvermapSDK = OvermapSDK;
14637
14715
  exports2.PDFViewer = PDFViewer;
14638
- exports2.PaddleCheckoutEvent = PaddleCheckoutEvent;
14639
14716
  exports2.PatchField = PatchField;
14640
14717
  exports2.PatchFormProvider = PatchFormProvider;
14641
14718
  exports2.ProjectAccessLevel = ProjectAccessLevel;
@@ -14662,18 +14739,19 @@ var __publicField = (obj, key, value) => {
14662
14739
  exports2.YELLOW = YELLOW;
14663
14740
  exports2._setLatestRetryTime = _setLatestRetryTime;
14664
14741
  exports2.acceptProjectInvite = acceptProjectInvite;
14665
- exports2.addActiveProjectFormSubmissionsCount = addActiveProjectFormSubmissionsCount;
14666
- exports2.addActiveProjectIssuesCount = addActiveProjectIssuesCount;
14667
- exports2.addAttachment = addAttachment;
14668
- exports2.addAttachments = addAttachments;
14669
14742
  exports2.addCategory = addCategory;
14670
14743
  exports2.addComponent = addComponent;
14744
+ exports2.addComponentAttachment = addComponentAttachment;
14745
+ exports2.addComponentAttachments = addComponentAttachments;
14671
14746
  exports2.addComponentType = addComponentType;
14747
+ exports2.addComponentTypeAttachment = addComponentTypeAttachment;
14748
+ exports2.addComponentTypeAttachments = addComponentTypeAttachments;
14672
14749
  exports2.addComponentsInBatches = addComponentsInBatches;
14673
14750
  exports2.addEmailDomain = addEmailDomain;
14674
14751
  exports2.addFavouriteProjectId = addFavouriteProjectId;
14675
14752
  exports2.addIssue = addIssue;
14676
- exports2.addLicenses = addLicenses;
14753
+ exports2.addIssueAttachment = addIssueAttachment;
14754
+ exports2.addIssueAttachments = addIssueAttachments;
14677
14755
  exports2.addOrReplaceCategories = addOrReplaceCategories;
14678
14756
  exports2.addOrReplaceIssueComment = addOrReplaceIssueComment;
14679
14757
  exports2.addOrReplaceProjectFile = addOrReplaceProjectFile;
@@ -14773,8 +14851,6 @@ var __publicField = (obj, key, value) => {
14773
14851
  exports2.issueReducer = issueReducer;
14774
14852
  exports2.issueSlice = issueSlice;
14775
14853
  exports2.issueToSearchResult = issueToSearchResult;
14776
- exports2.licenseReducer = licenseReducer;
14777
- exports2.licenseSlice = licenseSlice;
14778
14854
  exports2.linkStageToForm = linkStageToForm;
14779
14855
  exports2.literalToCoordinates = literalToCoordinates;
14780
14856
  exports2.logOnlyOnce = logOnlyOnce;
@@ -14813,14 +14889,18 @@ var __publicField = (obj, key, value) => {
14813
14889
  exports2.rehydratedReducer = rehydratedReducer;
14814
14890
  exports2.rehydratedSlice = rehydratedSlice;
14815
14891
  exports2.removeAllComponentsOfType = removeAllComponentsOfType;
14816
- exports2.removeAttachment = removeAttachment;
14817
14892
  exports2.removeAttachmentsOfIssue = removeAttachmentsOfIssue;
14818
14893
  exports2.removeCategory = removeCategory;
14819
14894
  exports2.removeColor = removeColor;
14820
14895
  exports2.removeComponent = removeComponent;
14896
+ exports2.removeComponentAttachment = removeComponentAttachment;
14897
+ exports2.removeComponentAttachments = removeComponentAttachments;
14898
+ exports2.removeComponentTypeAttachment = removeComponentTypeAttachment;
14899
+ exports2.removeComponentTypeAttachments = removeComponentTypeAttachments;
14821
14900
  exports2.removeEmailDomain = removeEmailDomain;
14822
14901
  exports2.removeFavouriteProjectId = removeFavouriteProjectId;
14823
14902
  exports2.removeIssue = removeIssue;
14903
+ exports2.removeIssueAttachment = removeIssueAttachment;
14824
14904
  exports2.removeIssueComment = removeIssueComment;
14825
14905
  exports2.removeOrganizationAccess = removeOrganizationAccess;
14826
14906
  exports2.removeProjectAccess = removeProjectAccess;
@@ -14842,21 +14922,21 @@ var __publicField = (obj, key, value) => {
14842
14922
  exports2.searchIssues = searchIssues;
14843
14923
  exports2.selectAccessToken = selectAccessToken;
14844
14924
  exports2.selectActiveIssueId = selectActiveIssueId;
14845
- exports2.selectActiveLicense = selectActiveLicense;
14846
14925
  exports2.selectActiveOrganization = selectActiveOrganization;
14847
14926
  exports2.selectActiveOrganizationAccess = selectActiveOrganizationAccess;
14848
14927
  exports2.selectActiveOrganizationId = selectActiveOrganizationId;
14849
- exports2.selectActiveOrganizationLicenses = selectActiveOrganizationLicenses;
14850
- exports2.selectActiveOrganizationProjects = selectActiveOrganizationProjects;
14851
14928
  exports2.selectActiveProject = selectActiveProject;
14852
14929
  exports2.selectActiveProjectAccess = selectActiveProjectAccess;
14853
14930
  exports2.selectActiveProjectFileId = selectActiveProjectFileId;
14854
14931
  exports2.selectActiveProjectId = selectActiveProjectId;
14855
- exports2.selectActiveStatusLicenses = selectActiveStatusLicenses;
14856
14932
  exports2.selectActiveWorkspace = selectActiveWorkspace;
14857
14933
  exports2.selectActiveWorkspaceId = selectActiveWorkspaceId;
14858
14934
  exports2.selectAllAttachments = selectAllAttachments;
14935
+ exports2.selectAllComponentAttachments = selectAllComponentAttachments;
14936
+ exports2.selectAllComponentTypeAttachments = selectAllComponentTypeAttachments;
14859
14937
  exports2.selectAppearance = selectAppearance;
14938
+ exports2.selectAttachmentsOfComponent = selectAttachmentsOfComponent;
14939
+ exports2.selectAttachmentsOfComponentType = selectAttachmentsOfComponentType;
14860
14940
  exports2.selectCategories = selectCategories;
14861
14941
  exports2.selectCategoriesOfWorkspace = selectCategoriesOfWorkspace;
14862
14942
  exports2.selectCategory = selectCategory;
@@ -14868,7 +14948,9 @@ var __publicField = (obj, key, value) => {
14868
14948
  exports2.selectCompletedStageIdsForComponent = selectCompletedStageIdsForComponent;
14869
14949
  exports2.selectCompletedStages = selectCompletedStages;
14870
14950
  exports2.selectComponent = selectComponent;
14951
+ exports2.selectComponentAttachmentMapping = selectComponentAttachmentMapping;
14871
14952
  exports2.selectComponentType = selectComponentType;
14953
+ exports2.selectComponentTypeAttachmentMapping = selectComponentTypeAttachmentMapping;
14872
14954
  exports2.selectComponentTypeForm = selectComponentTypeForm;
14873
14955
  exports2.selectComponentTypeFromComponent = selectComponentTypeFromComponent;
14874
14956
  exports2.selectComponentTypeFromComponents = selectComponentTypeFromComponents;
@@ -14898,7 +14980,6 @@ var __publicField = (obj, key, value) => {
14898
14980
  exports2.selectHiddenComponentTypeIds = selectHiddenComponentTypeIds;
14899
14981
  exports2.selectIsFetchingInitialData = selectIsFetchingInitialData;
14900
14982
  exports2.selectIsImportingProjectFile = selectIsImportingProjectFile;
14901
- exports2.selectIsLoading = selectIsLoading;
14902
14983
  exports2.selectIsLoggedIn = selectIsLoggedIn;
14903
14984
  exports2.selectIssue = selectIssue;
14904
14985
  exports2.selectIssueAttachmentMapping = selectIssueAttachmentMapping;
@@ -14909,10 +14990,6 @@ var __publicField = (obj, key, value) => {
14909
14990
  exports2.selectLatestRetryTime = selectLatestRetryTime;
14910
14991
  exports2.selectLatestRevisionByFormId = selectLatestRevisionByFormId;
14911
14992
  exports2.selectLatestRevisionsFromComponentTypeIds = selectLatestRevisionsFromComponentTypeIds;
14912
- exports2.selectLicense = selectLicense;
14913
- exports2.selectLicenseForProject = selectLicenseForProject;
14914
- exports2.selectLicenses = selectLicenses;
14915
- exports2.selectLicensesForProjectsMapping = selectLicensesForProjectsMapping;
14916
14993
  exports2.selectMainWorkspace = selectMainWorkspace;
14917
14994
  exports2.selectMapStyle = selectMapStyle;
14918
14995
  exports2.selectNumberOfComponentTypesMatchingCaseInsensitiveName = selectNumberOfComponentTypesMatchingCaseInsensitiveName;
@@ -14927,7 +15004,6 @@ var __publicField = (obj, key, value) => {
14927
15004
  exports2.selectOrganizationUsersAsMapping = selectOrganizationUsersAsMapping;
14928
15005
  exports2.selectOrganizationUsersIds = selectOrganizationUsersIds;
14929
15006
  exports2.selectOrganizations = selectOrganizations;
14930
- exports2.selectOrganizationsMapping = selectOrganizationsMapping;
14931
15007
  exports2.selectOrganizationsWithAccess = selectOrganizationsWithAccess;
14932
15008
  exports2.selectPermittedWorkspaceIds = selectPermittedWorkspaceIds;
14933
15009
  exports2.selectPhotoAttachmentsOfIssue = selectPhotoAttachmentsOfIssue;
@@ -14949,7 +15025,6 @@ var __publicField = (obj, key, value) => {
14949
15025
  exports2.selectRevisionsForForm = selectRevisionsForForm;
14950
15026
  exports2.selectShowTooltips = selectShowTooltips;
14951
15027
  exports2.selectSortedEmailDomains = selectSortedEmailDomains;
14952
- exports2.selectSortedOrganizationLicenses = selectSortedOrganizationLicenses;
14953
15028
  exports2.selectSortedOrganizationUsers = selectSortedOrganizationUsers;
14954
15029
  exports2.selectSortedProjectUsers = selectSortedProjectUsers;
14955
15030
  exports2.selectSortedProjects = selectSortedProjects;
@@ -14980,9 +15055,10 @@ var __publicField = (obj, key, value) => {
14980
15055
  exports2.setActiveProjectId = setActiveProjectId;
14981
15056
  exports2.setActiveWorkspaceId = setActiveWorkspaceId;
14982
15057
  exports2.setAppearance = setAppearance;
14983
- exports2.setAttachments = setAttachments;
14984
15058
  exports2.setCategories = setCategories;
14985
15059
  exports2.setCenterMapToProject = setCenterMapToProject;
15060
+ exports2.setComponentAttachments = setComponentAttachments;
15061
+ exports2.setComponentTypeAttachments = setComponentTypeAttachments;
14986
15062
  exports2.setComponentTypes = setComponentTypes;
14987
15063
  exports2.setComponents = setComponents;
14988
15064
  exports2.setCreateProjectType = setCreateProjectType;
@@ -14993,10 +15069,9 @@ var __publicField = (obj, key, value) => {
14993
15069
  exports2.setEnablePlacementMode = setEnablePlacementMode;
14994
15070
  exports2.setIsFetchingInitialData = setIsFetchingInitialData;
14995
15071
  exports2.setIsImportingProjectFile = setIsImportingProjectFile;
14996
- exports2.setIsLoading = setIsLoading;
15072
+ exports2.setIssueAttachments = setIssueAttachments;
14997
15073
  exports2.setIssueComments = setIssueComments;
14998
15074
  exports2.setIssues = setIssues;
14999
- exports2.setLicenses = setLicenses;
15000
15075
  exports2.setLoggedIn = setLoggedIn;
15001
15076
  exports2.setMapStyle = setMapStyle;
15002
15077
  exports2.setOrganizationAccesses = setOrganizationAccesses;
@@ -15033,10 +15108,11 @@ var __publicField = (obj, key, value) => {
15033
15108
  exports2.unhideCategory = unhideCategory;
15034
15109
  exports2.unlinkStageToForm = unlinkStageToForm;
15035
15110
  exports2.updateActiveOrganization = updateActiveOrganization;
15036
- exports2.updateAttachment = updateAttachment;
15037
15111
  exports2.updateComponent = updateComponent;
15112
+ exports2.updateComponentAttachment = updateComponentAttachment;
15113
+ exports2.updateComponentTypeAttachment = updateComponentTypeAttachment;
15038
15114
  exports2.updateIssue = updateIssue;
15039
- exports2.updateLicense = updateLicense;
15115
+ exports2.updateIssueAttachment = updateIssueAttachment;
15040
15116
  exports2.updateOrCreateProject = updateOrCreateProject;
15041
15117
  exports2.updateOrCreateUserFormSubmission = updateOrCreateUserFormSubmission;
15042
15118
  exports2.updateOrganizationAccess = updateOrganizationAccess;