@overmap-ai/core 1.0.44-tiptap.8 → 1.0.44

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$l = {
625
+ const initialState$m = {
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$l,
633
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
632
+ initialState: initialState$m,
633
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
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$k = {
1364
+ const initialState$l = {
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$k,
1375
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
1374
+ initialState: initialState$l,
1375
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
1376
1376
  reducers: {
1377
1377
  setCategories: (state, action) => {
1378
1378
  if (!Array.isArray(action.payload))
@@ -1540,14 +1540,14 @@ var __publicField = (obj, key, value) => {
1540
1540
  delete state.attachments[attachmentId];
1541
1541
  }
1542
1542
  }
1543
- const initialState$j = {
1543
+ const initialState$k = {
1544
1544
  components: {},
1545
1545
  attachments: {}
1546
1546
  };
1547
1547
  const componentSlice = toolkit.createSlice({
1548
1548
  name: "components",
1549
- initialState: initialState$j,
1550
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
1549
+ initialState: initialState$k,
1550
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
1551
1551
  reducers: {
1552
1552
  addComponent: (state, action) => {
1553
1553
  state.components[action.payload.offline_id] = action.payload;
@@ -1665,7 +1665,7 @@ var __publicField = (obj, key, value) => {
1665
1665
  toolkit.createSelector(
1666
1666
  [selectAllComponentAttachments, (_state, componentId) => componentId],
1667
1667
  (attachments, componentId) => {
1668
- return attachments.filter(({ component_id }) => componentId === component_id);
1668
+ return attachments.filter(({ component }) => componentId === component);
1669
1669
  }
1670
1670
  )
1671
1671
  );
@@ -1673,7 +1673,7 @@ var __publicField = (obj, key, value) => {
1673
1673
  toolkit.createSelector(
1674
1674
  [selectAllComponentAttachments, (_state, componentId) => componentId],
1675
1675
  (attachments, componentId) => {
1676
- const attachmentsOfComponent = attachments.filter(({ component_id }) => componentId === component_id);
1676
+ const attachmentsOfComponent = attachments.filter(({ component }) => componentId === component);
1677
1677
  const fileAttachments = attachmentsOfComponent.filter(
1678
1678
  // this null check here is necessary, there are cases where file_type is null or undefined
1679
1679
  ({ file_type }) => !file_type || !file_type.startsWith("image/")
@@ -1701,13 +1701,13 @@ var __publicField = (obj, key, value) => {
1701
1701
  removeAllComponentsOfType
1702
1702
  } = componentSlice.actions;
1703
1703
  const componentReducer = componentSlice.reducer;
1704
- const initialState$i = {
1704
+ const initialState$j = {
1705
1705
  completionsByComponentId: {}
1706
1706
  };
1707
1707
  const componentStageCompletionSlice = toolkit.createSlice({
1708
1708
  name: "componentStageCompletions",
1709
- initialState: initialState$i,
1710
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
1709
+ initialState: initialState$j,
1710
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
1711
1711
  reducers: {
1712
1712
  addStageCompletion: (state, action) => {
1713
1713
  let stageToCompletionDateMapping = state.completionsByComponentId[action.payload.component];
@@ -1758,13 +1758,13 @@ var __publicField = (obj, key, value) => {
1758
1758
  return Object.keys(state.componentStageCompletionReducer.completionsByComponentId[component.offline_id] ?? {});
1759
1759
  };
1760
1760
  const componentStageCompletionReducer = componentStageCompletionSlice.reducer;
1761
- const initialState$h = {
1761
+ const initialState$i = {
1762
1762
  stages: {}
1763
1763
  };
1764
1764
  const componentStageSlice = toolkit.createSlice({
1765
1765
  name: "componentStages",
1766
- initialState: initialState$h,
1767
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
1766
+ initialState: initialState$i,
1767
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
1768
1768
  reducers: {
1769
1769
  addStages: (state, action) => {
1770
1770
  Object.assign(state.stages, toOfflineIdRecord(action.payload));
@@ -1855,15 +1855,15 @@ var __publicField = (obj, key, value) => {
1855
1855
  );
1856
1856
  const { addStages, updateStages, removeStages, linkStageToForm, unlinkStageToForm } = componentStageSlice.actions;
1857
1857
  const componentStageReducer = componentStageSlice.reducer;
1858
- const initialState$g = {
1858
+ const initialState$h = {
1859
1859
  componentTypes: {},
1860
1860
  hiddenComponentTypeIds: {},
1861
1861
  attachments: {}
1862
1862
  };
1863
1863
  const componentTypeSlice = toolkit.createSlice({
1864
1864
  name: "componentTypes",
1865
- initialState: initialState$g,
1866
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
1865
+ initialState: initialState$h,
1866
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
1867
1867
  reducers: {
1868
1868
  addComponentType: (state, action) => {
1869
1869
  state.componentTypes[action.payload.offline_id] = action.payload;
@@ -1935,7 +1935,7 @@ var __publicField = (obj, key, value) => {
1935
1935
  toolkit.createSelector(
1936
1936
  [selectAllComponentTypeAttachments, (_state, componentTypeId) => componentTypeId],
1937
1937
  (attachments, componentTypeId) => {
1938
- return attachments.filter(({ component_type_id }) => componentTypeId === component_type_id);
1938
+ return attachments.filter(({ component_type }) => componentTypeId === component_type);
1939
1939
  }
1940
1940
  )
1941
1941
  );
@@ -1944,7 +1944,7 @@ var __publicField = (obj, key, value) => {
1944
1944
  [selectAllComponentTypeAttachments, (_state, componentTypeId) => componentTypeId],
1945
1945
  (attachments, componentTypeId) => {
1946
1946
  const attachmentsOfComponent = attachments.filter(
1947
- ({ component_type_id }) => component_type_id === componentTypeId
1947
+ ({ component_type }) => component_type === componentTypeId
1948
1948
  );
1949
1949
  const fileAttachments = attachmentsOfComponent.filter(
1950
1950
  // this null check here is necessary, there are cases where file_type is null or undefined
@@ -1971,13 +1971,13 @@ var __publicField = (obj, key, value) => {
1971
1971
  deleteComponentType
1972
1972
  } = componentTypeSlice.actions;
1973
1973
  const componentTypeReducer = componentTypeSlice.reducer;
1974
- const initialState$f = {
1974
+ const initialState$g = {
1975
1975
  workspaces: {},
1976
1976
  activeWorkspaceId: null
1977
1977
  };
1978
1978
  const workspaceSlice = toolkit.createSlice({
1979
1979
  name: "workspace",
1980
- initialState: initialState$f,
1980
+ initialState: initialState$g,
1981
1981
  // The `reducers` field lets us define reducers and generate associated actions
1982
1982
  reducers: {
1983
1983
  setWorkspaces: (state, action) => {
@@ -2034,21 +2034,20 @@ var __publicField = (obj, key, value) => {
2034
2034
  );
2035
2035
  const workspaceReducer = workspaceSlice.reducer;
2036
2036
  const maxRecentIssues = 10;
2037
- const initialState$e = {
2037
+ const initialState$f = {
2038
2038
  issues: {},
2039
2039
  attachments: {},
2040
2040
  comments: {},
2041
2041
  visibleStatuses: [IssueStatus.BACKLOG, IssueStatus.SELECTED],
2042
- isFetchingInitialData: false,
2043
2042
  visibleUserIds: null,
2044
2043
  recentIssueIds: [],
2045
2044
  activeIssueId: null
2046
2045
  };
2047
2046
  const issueSlice = toolkit.createSlice({
2048
2047
  name: "issues",
2049
- initialState: initialState$e,
2048
+ initialState: initialState$f,
2050
2049
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
2051
- Object.assign(state, initialState$e);
2050
+ Object.assign(state, initialState$f);
2052
2051
  }),
2053
2052
  reducers: {
2054
2053
  setIssues: (state, action) => {
@@ -2094,7 +2093,7 @@ var __publicField = (obj, key, value) => {
2094
2093
  },
2095
2094
  removeIssueAttachment: removeAttachment,
2096
2095
  removeAttachmentsOfIssue: (state, action) => {
2097
- const attachments = Object.values(state.attachments).filter((a) => a.issue_id === action.payload);
2096
+ const attachments = Object.values(state.attachments).filter((a) => a.issue === action.payload);
2098
2097
  for (const attachment of attachments) {
2099
2098
  delete state.attachments[attachment.offline_id];
2100
2099
  }
@@ -2102,9 +2101,6 @@ var __publicField = (obj, key, value) => {
2102
2101
  setVisibleStatuses: (state, action) => {
2103
2102
  state.visibleStatuses = action.payload;
2104
2103
  },
2105
- setIsFetchingInitialData: (state, action) => {
2106
- state.isFetchingInitialData = action.payload;
2107
- },
2108
2104
  setVisibleUserIds: (state, action) => {
2109
2105
  state.visibleUserIds = [...new Set(action.payload)];
2110
2106
  },
@@ -2163,7 +2159,6 @@ var __publicField = (obj, key, value) => {
2163
2159
  resetRecentIssues,
2164
2160
  setActiveIssueId,
2165
2161
  setIssueAttachments,
2166
- setIsFetchingInitialData,
2167
2162
  setIssueComments,
2168
2163
  setIssues,
2169
2164
  setVisibleStatuses,
@@ -2229,7 +2224,7 @@ var __publicField = (obj, key, value) => {
2229
2224
  [selectIssueAttachmentMapping, (_state, issueId) => issueId],
2230
2225
  (attachmentMapping, issueId) => {
2231
2226
  return Object.values(attachmentMapping).filter(
2232
- (attachment) => attachment.issue_id === issueId && attachment.file_type && attachment.file_type.startsWith("image/")
2227
+ (attachment) => attachment.issue === issueId && attachment.file_type && attachment.file_type.startsWith("image/")
2233
2228
  );
2234
2229
  }
2235
2230
  )
@@ -2244,7 +2239,7 @@ var __publicField = (obj, key, value) => {
2244
2239
  toolkit.createSelector(
2245
2240
  [selectIssueAttachments, (_state, issueId) => issueId],
2246
2241
  (attachments, issueId) => {
2247
- return attachments.filter(({ issue_id }) => issueId === issue_id);
2242
+ return attachments.filter(({ issue }) => issueId === issue);
2248
2243
  }
2249
2244
  )
2250
2245
  );
@@ -2252,12 +2247,12 @@ var __publicField = (obj, key, value) => {
2252
2247
  toolkit.createSelector(
2253
2248
  [selectIssueAttachments, (_state, issueId) => issueId],
2254
2249
  (attachments, issueId) => {
2255
- const attachmentsOfComponent = attachments.filter(({ issue_id }) => issue_id === issueId);
2256
- const fileAttachments = attachmentsOfComponent.filter(
2250
+ const attachmentsOfIssue = attachments.filter(({ issue }) => issue === issueId);
2251
+ const fileAttachments = attachmentsOfIssue.filter(
2257
2252
  // this null check here is necessary, there are cases where file_type is null or undefined
2258
2253
  ({ file_type }) => !file_type || !file_type.startsWith("image/")
2259
2254
  );
2260
- const imageAttachments = attachmentsOfComponent.filter(
2255
+ const imageAttachments = attachmentsOfIssue.filter(
2261
2256
  // this null check here is necessary, there are cases where file_type is null or undefined
2262
2257
  ({ file_type }) => file_type && file_type.startsWith("image/")
2263
2258
  );
@@ -2274,7 +2269,7 @@ var __publicField = (obj, key, value) => {
2274
2269
  return Object.values(attachmentMapping).filter(
2275
2270
  (attachment) => (
2276
2271
  // Files with file_type that is null or not an image file
2277
- attachment.issue_id === issueId && (!attachment.file_type || !attachment.file_type.startsWith("image/"))
2272
+ attachment.issue === issueId && (!attachment.file_type || !attachment.file_type.startsWith("image/"))
2278
2273
  )
2279
2274
  );
2280
2275
  }
@@ -2285,7 +2280,6 @@ var __publicField = (obj, key, value) => {
2285
2280
  return mapping[id];
2286
2281
  })
2287
2282
  );
2288
- const selectIsFetchingInitialData = (state) => state.issueReducer.isFetchingInitialData;
2289
2283
  const selectAllAttachments = toolkit.createSelector([selectIssueAttachmentMapping], (mapping) => Object.values(mapping));
2290
2284
  const searchIssues = restructureCreateSelectorWithArgs(
2291
2285
  toolkit.createSelector(
@@ -2377,15 +2371,15 @@ var __publicField = (obj, key, value) => {
2377
2371
  }
2378
2372
  );
2379
2373
  const issueReducer = issueSlice.reducer;
2380
- const initialState$d = {
2374
+ const initialState$e = {
2381
2375
  s3Urls: {}
2382
2376
  };
2383
2377
  const msPerHour = 1e3 * 60 * 60;
2384
2378
  const msPerWeek = msPerHour * 24 * 7;
2385
2379
  const fileSlice = toolkit.createSlice({
2386
2380
  name: "file",
2387
- initialState: initialState$d,
2388
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
2381
+ initialState: initialState$e,
2382
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
2389
2383
  reducers: {
2390
2384
  setUploadUrl: (state, action) => {
2391
2385
  const { url, fields, sha1 } = action.payload;
@@ -2412,7 +2406,7 @@ var __publicField = (obj, key, value) => {
2412
2406
  return url;
2413
2407
  };
2414
2408
  const fileReducer = fileSlice.reducer;
2415
- const initialState$c = {
2409
+ const initialState$d = {
2416
2410
  // TODO: Change first MapStyle.SATELLITE to MaptStyle.None when project creation map is fixed
2417
2411
  mapStyle: MapStyle.SATELLITE,
2418
2412
  showTooltips: false,
@@ -2420,8 +2414,8 @@ var __publicField = (obj, key, value) => {
2420
2414
  };
2421
2415
  const mapSlice = toolkit.createSlice({
2422
2416
  name: "map",
2423
- initialState: initialState$c,
2424
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
2417
+ initialState: initialState$d,
2418
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
2425
2419
  reducers: {
2426
2420
  setMapStyle: (state, action) => {
2427
2421
  state.mapStyle = action.payload;
@@ -2463,7 +2457,24 @@ var __publicField = (obj, key, value) => {
2463
2457
  VerificationCodeType2[VerificationCodeType2["RESET_PASSWORD"] = 10] = "RESET_PASSWORD";
2464
2458
  return VerificationCodeType2;
2465
2459
  })(VerificationCodeType || {});
2466
- const initialState$b = {
2460
+ var PaddleCheckoutEvent = /* @__PURE__ */ ((PaddleCheckoutEvent2) => {
2461
+ PaddleCheckoutEvent2["COMPLETED"] = "checkout.completed";
2462
+ PaddleCheckoutEvent2["CLOSED"] = "checkout.closed";
2463
+ return PaddleCheckoutEvent2;
2464
+ })(PaddleCheckoutEvent || {});
2465
+ var LicenseLevel = /* @__PURE__ */ ((LicenseLevel2) => {
2466
+ LicenseLevel2[LicenseLevel2["PRO"] = 0] = "PRO";
2467
+ return LicenseLevel2;
2468
+ })(LicenseLevel || {});
2469
+ var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
2470
+ LicenseStatus2[LicenseStatus2["ACTIVE"] = 0] = "ACTIVE";
2471
+ LicenseStatus2[LicenseStatus2["PAUSED"] = 2] = "PAUSED";
2472
+ LicenseStatus2[LicenseStatus2["CANCELLED"] = 4] = "CANCELLED";
2473
+ LicenseStatus2[LicenseStatus2["INACTIVE"] = 6] = "INACTIVE";
2474
+ LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
2475
+ return LicenseStatus2;
2476
+ })(LicenseStatus || {});
2477
+ const initialState$c = {
2467
2478
  users: {},
2468
2479
  currentUser: {
2469
2480
  id: 0,
@@ -2474,8 +2485,8 @@ var __publicField = (obj, key, value) => {
2474
2485
  };
2475
2486
  const userSlice = toolkit.createSlice({
2476
2487
  name: "users",
2477
- initialState: initialState$b,
2478
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
2488
+ initialState: initialState$c,
2489
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
2479
2490
  reducers: {
2480
2491
  setUsers: (state, action) => {
2481
2492
  const usersMapping = {};
@@ -2537,13 +2548,13 @@ var __publicField = (obj, key, value) => {
2537
2548
  const selectUsersAsMapping = (state) => state.userReducer.users;
2538
2549
  const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
2539
2550
  const userReducer = userSlice.reducer;
2540
- const initialState$a = {
2551
+ const initialState$b = {
2541
2552
  organizationAccesses: {}
2542
2553
  };
2543
2554
  const organizationAccessSlice = toolkit.createSlice({
2544
2555
  name: "organizationAccess",
2545
- initialState: initialState$a,
2546
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
2556
+ initialState: initialState$b,
2557
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
2547
2558
  reducers: {
2548
2559
  setOrganizationAccesses: (state, action) => {
2549
2560
  if (!Array.isArray(action.payload))
@@ -2606,151 +2617,64 @@ var __publicField = (obj, key, value) => {
2606
2617
  return organizationAccesses;
2607
2618
  };
2608
2619
  const organizationAccessReducer = organizationAccessSlice.reducer;
2609
- const initialState$9 = {
2610
- organizations: {},
2611
- activeOrganizationId: null
2620
+ const initialState$a = {
2621
+ licenses: {}
2612
2622
  };
2613
- const organizationSlice = toolkit.createSlice({
2614
- name: "organizations",
2615
- initialState: initialState$9,
2616
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$9)),
2623
+ const licenseSlice = toolkit.createSlice({
2624
+ name: "license",
2625
+ initialState: initialState$a,
2626
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
2617
2627
  reducers: {
2618
- setOrganizations: (state, action) => {
2619
- for (const org of action.payload) {
2620
- state.organizations[org.id] = org;
2628
+ setLicenses: (state, action) => {
2629
+ if (!Array.isArray(action.payload))
2630
+ throw new Error("Expected an array of Licenses");
2631
+ if (action.payload.filter(onlyUniqueOfflineIds).length !== action.payload.length) {
2632
+ throw new Error("Tried to use setLicenses reducer with duplicate ID's");
2621
2633
  }
2622
- },
2623
- updateActiveOrganization: (state, action) => {
2624
- if (!state.activeOrganizationId) {
2625
- throw new Error("Cannot update name of active organization. Active organization ID does not exist");
2634
+ const licenses = {};
2635
+ for (const license of action.payload) {
2636
+ licenses[license.offline_id] = license;
2626
2637
  }
2627
- if (state.activeOrganizationId !== action.payload.id) {
2628
- throw new Error("Tried updating active organization with different organization");
2638
+ state.licenses = licenses;
2639
+ },
2640
+ addLicenses: (state, action) => {
2641
+ for (const license of action.payload) {
2642
+ state.licenses[license.offline_id] = license;
2629
2643
  }
2630
- state.organizations[state.activeOrganizationId] = action.payload;
2631
2644
  },
2632
- setActiveOrganizationId: (state, action) => {
2633
- state.activeOrganizationId = action.payload;
2645
+ updateLicense: (state, action) => {
2646
+ if (!(action.payload.offline_id in state.licenses)) {
2647
+ throw new Error("Tried to update license that does not exist.");
2648
+ }
2649
+ state.licenses[action.payload.offline_id] = action.payload;
2634
2650
  }
2635
2651
  }
2636
2652
  });
2637
- const { setOrganizations, setActiveOrganizationId, updateActiveOrganization } = organizationSlice.actions;
2638
- const selectActiveOrganizationId = (state) => {
2639
- return state.organizationReducer.activeOrganizationId;
2640
- };
2641
- const selectOrganizations = (state) => {
2642
- return Object.values(state.organizationReducer.organizations);
2653
+ const { setLicenses, addLicenses, updateLicense } = licenseSlice.actions;
2654
+ const selectLicenses = (state) => {
2655
+ return state.licenseReducer.licenses;
2643
2656
  };
2644
- const selectOrganizationsWithAccess = toolkit.createSelector(
2645
- [selectOrganizations],
2646
- (organizations) => Object.values(organizations).filter((organization) => organization.has_access)
2657
+ const selectLicense = (licenseId) => (state) => state.licenseReducer.licenses[licenseId];
2658
+ const selectActiveLicense = (state) => Object.values(state.licenseReducer.licenses).find(
2659
+ (license) => license.project === state.projectReducer.activeProjectId
2660
+ ) ?? null;
2661
+ const selectLicenseForProject = (projectId) => (state) => Object.values(state.licenseReducer.licenses).find((license) => license.project === projectId);
2662
+ const selectActiveStatusLicenses = toolkit.createSelector(
2663
+ [selectLicenses],
2664
+ (licenses) => Object.values(licenses).filter((license) => license.is_active)
2647
2665
  );
2648
- const selectActiveOrganization = (state) => {
2649
- const id = selectActiveOrganizationId(state);
2650
- if (!id) {
2651
- return null;
2652
- }
2653
- const organization = state.organizationReducer.organizations[id];
2654
- if (!organization) {
2655
- return null;
2656
- }
2657
- return organization;
2658
- };
2659
- const selectOrganizationUsersIds = toolkit.createSelector(
2660
- [selectOrganizationAccesses],
2661
- (organizationAccesses) => Object.values(organizationAccesses).map((organizationAccess) => organizationAccess.user)
2662
- );
2663
- const selectOrganizationUsersAsMapping = toolkit.createSelector(
2664
- [selectOrganizationUsersIds, selectUsersAsMapping],
2665
- (organizationUserIds, users) => organizationUserIds.reduce((accum, userId) => ({ ...accum, [userId]: users[userId] }), {})
2666
- );
2667
- const selectSortedOrganizationUsers = toolkit.createSelector(
2668
- [selectCurrentUser, selectOrganizationUsersAsMapping, selectOrganizationAccessUserMapping],
2669
- (currentUser, userMapping, organizationAccessMapping) => {
2670
- return Object.values(userMapping).sort((userA, userB) => {
2671
- if (userA.id === currentUser.id) {
2672
- return -1;
2673
- } else if (userB.id === currentUser.id) {
2674
- return 1;
2675
- }
2676
- const organizationAccessesA = organizationAccessMapping[userA.id];
2677
- const organizationAccessesB = organizationAccessMapping[userB.id];
2678
- if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === (organizationAccessesB == null ? void 0 : organizationAccessesB.access_level)) {
2679
- return userA.username.localeCompare(userB.username);
2680
- }
2681
- if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === OrganizationAccessLevel.ADMIN) {
2682
- return -1;
2683
- }
2684
- return 1;
2685
- });
2686
- }
2666
+ const selectLicensesForProjectsMapping = toolkit.createSelector(
2667
+ [selectLicenses],
2668
+ (licenses) => Object.values(licenses).filter((license) => license.project).reduce((accum, license) => ({ ...accum, [license.project]: license }), {})
2687
2669
  );
2688
- const selectOrganization = (id) => (state) => {
2689
- return state.organizationReducer.organizations[id];
2690
- };
2691
- const organizationReducer = organizationSlice.reducer;
2692
- const createOfflineAction = (request2, baseUrl) => {
2693
- const requestWithUuid = request2.uuid ? request2 : { ...request2, uuid: uuid.v4() };
2694
- return {
2695
- payload: requestWithUuid,
2696
- type: "",
2697
- meta: {
2698
- offline: {
2699
- effect: {
2700
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
2701
- request: requestWithUuid,
2702
- BASE_URL: baseUrl
2703
- }
2704
- }
2705
- }
2706
- };
2707
- };
2708
- const initialState$8 = {
2709
- deletedRequests: [],
2710
- latestRetryTime: 0
2711
- };
2712
- const outboxSlice = toolkit.createSlice({
2713
- name: "outbox",
2714
- initialState: initialState$8,
2715
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
2716
- reducers: {
2717
- // enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
2718
- // Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
2719
- // Then this reducer enqueueRequest() is responsible for adding the actual request data to the outbox
2720
- enqueueRequest: {
2721
- reducer: (state, _action) => {
2722
- return state;
2723
- },
2724
- prepare: (payload) => {
2725
- console.debug("Preparing to enqueue request", payload);
2726
- const { BASE_URL, ...rest } = payload;
2727
- return createOfflineAction(rest, BASE_URL);
2728
- }
2729
- },
2730
- markForDeletion(state, action) {
2731
- state.deletedRequests.push(action.payload);
2732
- },
2733
- markAsDeleted(state, action) {
2734
- const index2 = state.deletedRequests.indexOf(action.payload);
2735
- if (index2 !== -1)
2736
- state.deletedRequests.splice(index2, 1);
2737
- },
2738
- _setLatestRetryTime: (state, action) => {
2739
- state.latestRetryTime = action.payload;
2740
- }
2741
- }
2742
- });
2743
- const selectDeletedRequests = (state) => state.outboxReducer.deletedRequests;
2744
- const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
2745
- const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
2746
- const outboxReducer = outboxSlice.reducer;
2747
- const initialState$7 = {
2670
+ const licenseReducer = licenseSlice.reducer;
2671
+ const initialState$9 = {
2748
2672
  projectAccesses: {}
2749
2673
  };
2750
2674
  const projectAccessSlice = toolkit.createSlice({
2751
2675
  name: "projectAccess",
2752
- initialState: initialState$7,
2753
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
2676
+ initialState: initialState$9,
2677
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$9)),
2754
2678
  reducers: {
2755
2679
  setProjectAccesses: (state, action) => {
2756
2680
  if (!Array.isArray(action.payload))
@@ -2818,7 +2742,7 @@ var __publicField = (obj, key, value) => {
2818
2742
  return projectAccesses;
2819
2743
  };
2820
2744
  const projectAccessReducer = projectAccessSlice.reducer;
2821
- const initialState$6 = {
2745
+ const initialState$8 = {
2822
2746
  projects: {},
2823
2747
  activeProjectId: null,
2824
2748
  recentProjectIds: [],
@@ -2827,7 +2751,7 @@ var __publicField = (obj, key, value) => {
2827
2751
  };
2828
2752
  const projectSlice = toolkit.createSlice({
2829
2753
  name: "projects",
2830
- initialState: initialState$6,
2754
+ initialState: initialState$8,
2831
2755
  reducers: {
2832
2756
  setProjects: (state, action) => {
2833
2757
  const projectsMap = {};
@@ -2873,6 +2797,27 @@ var __publicField = (obj, key, value) => {
2873
2797
  } else {
2874
2798
  throw new Error("Accept project invite: user is not in this project");
2875
2799
  }
2800
+ },
2801
+ addActiveProjectIssuesCount: (state, action) => {
2802
+ if (!state.activeProjectId || !(state.activeProjectId in state.projects)) {
2803
+ throw new Error("Update issues count: no active project");
2804
+ }
2805
+ if (!state.projects[state.activeProjectId].issues_count) {
2806
+ state.projects[state.activeProjectId].issues_count = action.payload;
2807
+ } else {
2808
+ state.projects[state.activeProjectId].issues_count += action.payload;
2809
+ }
2810
+ },
2811
+ addActiveProjectFormSubmissionsCount: (state, action) => {
2812
+ if (state.activeProjectId && state.activeProjectId in state.projects) {
2813
+ if (!state.projects[state.activeProjectId].form_submissions_count) {
2814
+ state.projects[state.activeProjectId].form_submissions_count = action.payload;
2815
+ } else {
2816
+ state.projects[state.activeProjectId].form_submissions_count += action.payload;
2817
+ }
2818
+ } else {
2819
+ throw new Error("Update form submissions count: no active project");
2820
+ }
2876
2821
  }
2877
2822
  }
2878
2823
  });
@@ -2883,7 +2828,9 @@ var __publicField = (obj, key, value) => {
2883
2828
  setActiveProjectId,
2884
2829
  setCreateProjectType,
2885
2830
  deleteProject,
2886
- acceptProjectInvite
2831
+ acceptProjectInvite,
2832
+ addActiveProjectIssuesCount,
2833
+ addActiveProjectFormSubmissionsCount
2887
2834
  } = projectSlice.actions;
2888
2835
  const selectProjects = (state) => state.projectReducer.projects;
2889
2836
  const selectActiveProjectId = (state) => state.projectReducer.activeProjectId;
@@ -2947,6 +2894,171 @@ var __publicField = (obj, key, value) => {
2947
2894
  });
2948
2895
  }
2949
2896
  );
2897
+ const initialState$7 = {
2898
+ organizations: {},
2899
+ activeOrganizationId: null
2900
+ };
2901
+ const organizationSlice = toolkit.createSlice({
2902
+ name: "organizations",
2903
+ initialState: initialState$7,
2904
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
2905
+ reducers: {
2906
+ setOrganizations: (state, action) => {
2907
+ for (const org of action.payload) {
2908
+ state.organizations[org.id] = org;
2909
+ }
2910
+ },
2911
+ updateActiveOrganization: (state, action) => {
2912
+ if (!state.activeOrganizationId) {
2913
+ throw new Error("Cannot update name of active organization. Active organization ID does not exist");
2914
+ }
2915
+ if (state.activeOrganizationId !== action.payload.id) {
2916
+ throw new Error("Tried updating active organization with different organization");
2917
+ }
2918
+ state.organizations[state.activeOrganizationId] = action.payload;
2919
+ },
2920
+ setActiveOrganizationId: (state, action) => {
2921
+ state.activeOrganizationId = action.payload;
2922
+ }
2923
+ }
2924
+ });
2925
+ const { setOrganizations, setActiveOrganizationId, updateActiveOrganization } = organizationSlice.actions;
2926
+ const selectActiveOrganizationId = (state) => {
2927
+ return state.organizationReducer.activeOrganizationId;
2928
+ };
2929
+ const selectOrganizations = (state) => {
2930
+ return Object.values(state.organizationReducer.organizations);
2931
+ };
2932
+ const selectOrganizationsMapping = (state) => {
2933
+ return state.organizationReducer.organizations;
2934
+ };
2935
+ const selectOrganizationsWithAccess = toolkit.createSelector(
2936
+ [selectOrganizations],
2937
+ (organizations) => Object.values(organizations).filter((organization) => organization.has_access)
2938
+ );
2939
+ const selectActiveOrganization = (state) => {
2940
+ const id = selectActiveOrganizationId(state);
2941
+ if (!id) {
2942
+ return null;
2943
+ }
2944
+ const organization = state.organizationReducer.organizations[id];
2945
+ if (!organization) {
2946
+ return null;
2947
+ }
2948
+ return organization;
2949
+ };
2950
+ const selectOrganizationUsersIds = toolkit.createSelector(
2951
+ [selectOrganizationAccesses],
2952
+ (organizationAccesses) => Object.values(organizationAccesses).map((organizationAccess) => organizationAccess.user)
2953
+ );
2954
+ const selectActiveOrganizationProjects = toolkit.createSelector(
2955
+ [selectProjects, selectActiveOrganizationId],
2956
+ (projects, activeOrganizationId) => activeOrganizationId ? Object.values(projects).filter((project) => project.owner_organization === activeOrganizationId) : []
2957
+ );
2958
+ const selectActiveOrganizationLicenses = toolkit.createSelector(
2959
+ [selectActiveOrganizationId, selectLicenses],
2960
+ (activeOrganizationId, licenses) => !activeOrganizationId ? [] : Object.values(licenses).filter((license) => license.organization_owner === activeOrganizationId)
2961
+ );
2962
+ const selectSortedOrganizationLicenses = toolkit.createSelector(
2963
+ [selectActiveOrganizationLicenses, selectProjects],
2964
+ (licences, projects) => licences.sort((licenseA, licenseB) => {
2965
+ if (!licenseA.project) {
2966
+ return 1;
2967
+ }
2968
+ if (!licenseB.project) {
2969
+ return -1;
2970
+ }
2971
+ return projects[licenseA.project].name.toLowerCase().localeCompare(
2972
+ projects[licenseB.project].name.toLowerCase(),
2973
+ void 0,
2974
+ { numeric: true }
2975
+ );
2976
+ })
2977
+ );
2978
+ const selectOrganizationUsersAsMapping = toolkit.createSelector(
2979
+ [selectOrganizationUsersIds, selectUsersAsMapping],
2980
+ (organizationUserIds, users) => organizationUserIds.reduce((accum, userId) => ({ ...accum, [userId]: users[userId] }), {})
2981
+ );
2982
+ const selectSortedOrganizationUsers = toolkit.createSelector(
2983
+ [selectCurrentUser, selectOrganizationUsersAsMapping, selectOrganizationAccessUserMapping],
2984
+ (currentUser, userMapping, organizationAccessMapping) => {
2985
+ return Object.values(userMapping).sort((userA, userB) => {
2986
+ if (userA.id === currentUser.id) {
2987
+ return -1;
2988
+ } else if (userB.id === currentUser.id) {
2989
+ return 1;
2990
+ }
2991
+ const organizationAccessesA = organizationAccessMapping[userA.id];
2992
+ const organizationAccessesB = organizationAccessMapping[userB.id];
2993
+ if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === (organizationAccessesB == null ? void 0 : organizationAccessesB.access_level)) {
2994
+ return userA.username.localeCompare(userB.username);
2995
+ }
2996
+ if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === OrganizationAccessLevel.ADMIN) {
2997
+ return -1;
2998
+ }
2999
+ return 1;
3000
+ });
3001
+ }
3002
+ );
3003
+ const selectOrganization = (id) => (state) => {
3004
+ return state.organizationReducer.organizations[id];
3005
+ };
3006
+ const organizationReducer = organizationSlice.reducer;
3007
+ const createOfflineAction = (request2, baseUrl) => {
3008
+ const requestWithUuid = request2.uuid ? request2 : { ...request2, uuid: uuid.v4() };
3009
+ return {
3010
+ payload: requestWithUuid,
3011
+ type: "",
3012
+ meta: {
3013
+ offline: {
3014
+ effect: {
3015
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
3016
+ request: requestWithUuid,
3017
+ BASE_URL: baseUrl
3018
+ }
3019
+ }
3020
+ }
3021
+ };
3022
+ };
3023
+ const initialState$6 = {
3024
+ deletedRequests: [],
3025
+ latestRetryTime: 0
3026
+ };
3027
+ const outboxSlice = toolkit.createSlice({
3028
+ name: "outbox",
3029
+ initialState: initialState$6,
3030
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
3031
+ reducers: {
3032
+ // enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
3033
+ // Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
3034
+ // Then this reducer enqueueRequest() is responsible for adding the actual request data to the outbox
3035
+ enqueueRequest: {
3036
+ reducer: (state, _action) => {
3037
+ return state;
3038
+ },
3039
+ prepare: (payload) => {
3040
+ console.debug("Preparing to enqueue request", payload);
3041
+ const { BASE_URL, ...rest } = payload;
3042
+ return createOfflineAction(rest, BASE_URL);
3043
+ }
3044
+ },
3045
+ markForDeletion(state, action) {
3046
+ state.deletedRequests.push(action.payload);
3047
+ },
3048
+ markAsDeleted(state, action) {
3049
+ const index2 = state.deletedRequests.indexOf(action.payload);
3050
+ if (index2 !== -1)
3051
+ state.deletedRequests.splice(index2, 1);
3052
+ },
3053
+ _setLatestRetryTime: (state, action) => {
3054
+ state.latestRetryTime = action.payload;
3055
+ }
3056
+ }
3057
+ });
3058
+ const selectDeletedRequests = (state) => state.outboxReducer.deletedRequests;
3059
+ const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
3060
+ const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
3061
+ const outboxReducer = outboxSlice.reducer;
2950
3062
  const initialState$5 = {
2951
3063
  projectFiles: {},
2952
3064
  activeProjectFileId: null,
@@ -3083,7 +3195,9 @@ var __publicField = (obj, key, value) => {
3083
3195
  Components: false,
3084
3196
  Experimental: false
3085
3197
  },
3086
- appearance: "dark"
3198
+ appearance: "dark",
3199
+ isFetchingInitialData: false,
3200
+ isLoading: false
3087
3201
  };
3088
3202
  const settingSlice = toolkit.createSlice({
3089
3203
  name: "settings",
@@ -3107,6 +3221,12 @@ var __publicField = (obj, key, value) => {
3107
3221
  },
3108
3222
  setAppearance: (state, action) => {
3109
3223
  state.appearance = action.payload;
3224
+ },
3225
+ setIsFetchingInitialData: (state, action) => {
3226
+ state.isFetchingInitialData = action.payload;
3227
+ },
3228
+ setIsLoading: (state, action) => {
3229
+ state.isLoading = action.payload;
3110
3230
  }
3111
3231
  }
3112
3232
  });
@@ -3115,7 +3235,9 @@ var __publicField = (obj, key, value) => {
3115
3235
  setEnablePlacementMode,
3116
3236
  setSectionExpanded,
3117
3237
  setEnableClustering,
3118
- setAppearance
3238
+ setAppearance,
3239
+ setIsFetchingInitialData,
3240
+ setIsLoading
3119
3241
  } = settingSlice.actions;
3120
3242
  const selectEnablePlacementMode = (state) => state.settingReducer.placementMode;
3121
3243
  const selectEnableDuplicateIssues = (state) => state.settingReducer.useIssueTemplate;
@@ -3124,6 +3246,8 @@ var __publicField = (obj, key, value) => {
3124
3246
  const selectEnableClustering = (state) => state.settingReducer.enableClustering;
3125
3247
  const selectAppearance = (state) => state.settingReducer.appearance;
3126
3248
  const settingReducer = settingSlice.reducer;
3249
+ const selectIsFetchingInitialData = (state) => state.settingReducer.isFetchingInitialData;
3250
+ const selectIsLoading = (state) => state.settingReducer.isLoading;
3127
3251
  const LATEST_REVISION_CACHE = {};
3128
3252
  function considerCachingRevision(revision, formId2, preferPending = false) {
3129
3253
  var _a2;
@@ -3542,7 +3666,8 @@ var __publicField = (obj, key, value) => {
3542
3666
  userFormReducer,
3543
3667
  userReducer,
3544
3668
  workspaceReducer,
3545
- emailDomainsReducer
3669
+ emailDomainsReducer,
3670
+ licenseReducer
3546
3671
  };
3547
3672
  const overmapReducer = toolkit.combineReducers(overmapReducers);
3548
3673
  const resetStore = "RESET";
@@ -4082,7 +4207,7 @@ var __publicField = (obj, key, value) => {
4082
4207
  }
4083
4208
  // Attachments aren't models, so we use the OptimisticGenericResult type instead
4084
4209
  async addIssueAttachment(attachmentPayload) {
4085
- const { description: description2, issue_id, file_sha1, offline_id } = attachmentPayload;
4210
+ const { description: description2, issue, file_sha1, offline_id } = attachmentPayload;
4086
4211
  if (!attachmentPayload.file.objectURL) {
4087
4212
  throw new Error("Expected attachmentPayload.file.objectURL to be defined.");
4088
4213
  }
@@ -4098,12 +4223,12 @@ var __publicField = (obj, key, value) => {
4098
4223
  const promise = this.enqueueRequest({
4099
4224
  description: "Create attachment",
4100
4225
  method: HttpMethod.POST,
4101
- url: `/issues/${issue_id}/attach/`,
4102
- blocks: [offline_id, issue_id],
4226
+ url: `/issues/${issue}/attach/`,
4227
+ blocks: [offline_id, issue],
4103
4228
  blockers: [file_sha1],
4104
4229
  payload: {
4105
4230
  offline_id,
4106
- issue: issue_id,
4231
+ issue,
4107
4232
  description: description2 ?? "",
4108
4233
  submitted_at: (/* @__PURE__ */ new Date()).getTime() / 1e3,
4109
4234
  ...fileProps
@@ -4116,7 +4241,7 @@ var __publicField = (obj, key, value) => {
4116
4241
  return [offlineAttachment, promise];
4117
4242
  }
4118
4243
  async addComponentAttachment(attachmentPayload) {
4119
- const { description: description2, component_id, file_sha1, offline_id } = attachmentPayload;
4244
+ const { description: description2, component, file_sha1, offline_id } = attachmentPayload;
4120
4245
  if (!attachmentPayload.file.objectURL) {
4121
4246
  throw new Error("Expected attachmentPayload.file.objectURL to be defined.");
4122
4247
  }
@@ -4132,12 +4257,12 @@ var __publicField = (obj, key, value) => {
4132
4257
  const promise = this.enqueueRequest({
4133
4258
  description: "Create attachment",
4134
4259
  method: HttpMethod.POST,
4135
- url: `/components/${component_id}/attach/`,
4136
- blocks: [offline_id, component_id],
4260
+ url: `/components/${component}/attach/`,
4261
+ blocks: [offline_id, component],
4137
4262
  blockers: [file_sha1],
4138
4263
  payload: {
4139
4264
  offline_id,
4140
- component: component_id,
4265
+ component,
4141
4266
  description: description2 ?? "",
4142
4267
  submitted_at: (/* @__PURE__ */ new Date()).getTime() / 1e3,
4143
4268
  ...fileProps
@@ -4150,7 +4275,7 @@ var __publicField = (obj, key, value) => {
4150
4275
  return [offlineAttachment, promise];
4151
4276
  }
4152
4277
  async addComponentTypeAttachment(attachmentPayload) {
4153
- const { description: description2, component_type_id, file_sha1, offline_id } = attachmentPayload;
4278
+ const { description: description2, component_type, file_sha1, offline_id } = attachmentPayload;
4154
4279
  if (!attachmentPayload.file.objectURL) {
4155
4280
  throw new Error("Expected attachmentPayload.file.objectURL to be defined.");
4156
4281
  }
@@ -4166,12 +4291,12 @@ var __publicField = (obj, key, value) => {
4166
4291
  const promise = this.enqueueRequest({
4167
4292
  description: "Create attachment",
4168
4293
  method: HttpMethod.POST,
4169
- url: `/components/types/${component_type_id}/attach/`,
4170
- blocks: [offline_id, component_type_id],
4294
+ url: `/components/types/${component_type}/attach/`,
4295
+ blocks: [offline_id, component_type],
4171
4296
  blockers: [file_sha1],
4172
4297
  payload: {
4173
4298
  offline_id,
4174
- component_type: component_type_id,
4299
+ component_type,
4175
4300
  description: description2 ?? "",
4176
4301
  submitted_at: (/* @__PURE__ */ new Date()).getTime() / 1e3,
4177
4302
  ...fileProps
@@ -4197,7 +4322,7 @@ var __publicField = (obj, key, value) => {
4197
4322
  file: file2,
4198
4323
  file_name: file2.name,
4199
4324
  file_type: file2.type,
4200
- issue_id: issueId,
4325
+ issue: issueId,
4201
4326
  file_sha1: hash
4202
4327
  });
4203
4328
  return this.addIssueAttachment(attachment);
@@ -4216,7 +4341,7 @@ var __publicField = (obj, key, value) => {
4216
4341
  file: file2,
4217
4342
  file_name: file2.name,
4218
4343
  file_type: file2.type,
4219
- component_id: componentId,
4344
+ component: componentId,
4220
4345
  file_sha1: hash
4221
4346
  });
4222
4347
  return this.addComponentAttachment(attachment);
@@ -4235,7 +4360,7 @@ var __publicField = (obj, key, value) => {
4235
4360
  file: file2,
4236
4361
  file_name: file2.name,
4237
4362
  file_type: file2.type,
4238
- component_type_id: componentTypeId,
4363
+ component_type: componentTypeId,
4239
4364
  file_sha1: hash
4240
4365
  });
4241
4366
  return this.addComponentTypeAttachment(attachment);
@@ -5316,6 +5441,7 @@ var __publicField = (obj, key, value) => {
5316
5441
  });
5317
5442
  store.dispatch(addIssue(issuePayload));
5318
5443
  store.dispatch(addToRecentIssues(issuePayload.offline_id));
5444
+ store.dispatch(addActiveProjectIssuesCount(1));
5319
5445
  const promise = this.enqueueRequest({
5320
5446
  description: "Create issue",
5321
5447
  method: HttpMethod.POST,
@@ -5325,6 +5451,7 @@ var __publicField = (obj, key, value) => {
5325
5451
  },
5326
5452
  payload: issuePayload,
5327
5453
  blockers: [
5454
+ "add-issue",
5328
5455
  ...issuePayload.index_workspace ? [issuePayload.index_workspace] : [],
5329
5456
  ...issuePayload.visible_in_workspaces
5330
5457
  ],
@@ -5342,6 +5469,7 @@ var __publicField = (obj, key, value) => {
5342
5469
  });
5343
5470
  }
5344
5471
  store.dispatch(removeIssue(issuePayload.offline_id));
5472
+ store.dispatch(addActiveProjectIssuesCount(-1));
5345
5473
  throw error2;
5346
5474
  });
5347
5475
  return [issuePayload, promise];
@@ -5380,14 +5508,16 @@ var __publicField = (obj, key, value) => {
5380
5508
  return [fullIssue, promise];
5381
5509
  }
5382
5510
  async remove(id) {
5383
- const state = this.client.store.getState();
5511
+ const { store } = this.client;
5512
+ const state = store.getState();
5384
5513
  const backup = state.issueReducer.issues[id];
5385
5514
  if (!backup) {
5386
5515
  throw new Error(`No issue with id ${id} found in the store`);
5387
5516
  }
5388
- const attachments = Object.values(state.issueReducer.attachments).filter((a) => a.issue_id === id);
5517
+ const attachments = Object.values(state.issueReducer.attachments).filter((a) => a.issue === id);
5389
5518
  const attachmentsOfIssue = selectAttachmentsOfIssue(id)(state);
5390
5519
  this.client.store.dispatch(removeIssue(id));
5520
+ store.dispatch(addActiveProjectIssuesCount(-1));
5391
5521
  if (attachmentsOfIssue.length > 0) {
5392
5522
  this.client.store.dispatch(removeAttachmentsOfIssue(id));
5393
5523
  }
@@ -5402,6 +5532,7 @@ var __publicField = (obj, key, value) => {
5402
5532
  } catch (e) {
5403
5533
  this.client.store.dispatch(addIssue(backup));
5404
5534
  this.client.store.dispatch(addIssueAttachments(attachments));
5535
+ store.dispatch(addActiveProjectIssuesCount(1));
5405
5536
  throw e;
5406
5537
  }
5407
5538
  }
@@ -5477,7 +5608,9 @@ var __publicField = (obj, key, value) => {
5477
5608
  owner_organization: projectData.organization_owner,
5478
5609
  owner_user: projectData.user_owner,
5479
5610
  bounds: projectData.bounds,
5480
- invited: projectData.invited || false
5611
+ invited: projectData.invited || false,
5612
+ issues_count: projectData.issues_count,
5613
+ form_submissions_count: projectData.form_submissions_count
5481
5614
  });
5482
5615
  if (currentProjectId === projectData.id && !projectData.invited) {
5483
5616
  isProjectIdValid = true;
@@ -5495,6 +5628,7 @@ var __publicField = (obj, key, value) => {
5495
5628
  }
5496
5629
  store.dispatch(setCurrentUser(data.user));
5497
5630
  store.dispatch(addUsers(data.project_owners));
5631
+ store.dispatch(setLicenses(data.licenses));
5498
5632
  const organizationsData = data.organizations;
5499
5633
  store.dispatch(setOrganizations(organizationsData));
5500
5634
  const validProjects = projects.filter((project) => !project.invited);
@@ -5611,7 +5745,7 @@ var __publicField = (obj, key, value) => {
5611
5745
  method: HttpMethod.PATCH,
5612
5746
  url: `/access/${projectAccess.offline_id}/`,
5613
5747
  payload: projectAccess,
5614
- blockers: [projectAccess.offline_id],
5748
+ blockers: [projectAccess.offline_id, "change-access-level"],
5615
5749
  blocks: [projectAccess.offline_id]
5616
5750
  });
5617
5751
  }
@@ -5820,6 +5954,11 @@ var __publicField = (obj, key, value) => {
5820
5954
  store.dispatch(removeProjectAccessesOfProject(project.id));
5821
5955
  store.dispatch({ type: "rehydrated/setRehydrated", payload: false });
5822
5956
  store.dispatch(deleteProject(project));
5957
+ const licenseSelector = selectLicenseForProject(project.id);
5958
+ const license = licenseSelector(state);
5959
+ if (license) {
5960
+ store.dispatch(updateLicense({ ...license, project: null }));
5961
+ }
5823
5962
  try {
5824
5963
  await this.enqueueRequest({
5825
5964
  description: "Delete project",
@@ -5835,6 +5974,9 @@ var __publicField = (obj, key, value) => {
5835
5974
  store.dispatch(addOrReplaceProjectFiles(filesToDelete));
5836
5975
  store.dispatch(setActiveProjectId(activeProjectId));
5837
5976
  store.dispatch({ type: "rehydrated/setRehydrated", payload: true });
5977
+ if (license) {
5978
+ store.dispatch(updateLicense({ ...license, project: project.id }));
5979
+ }
5838
5980
  throw e;
5839
5981
  }
5840
5982
  }
@@ -6209,7 +6351,7 @@ var __publicField = (obj, key, value) => {
6209
6351
  method: HttpMethod.POST,
6210
6352
  url: `/forms/revisions/${payload.form_revision}/respond/`,
6211
6353
  payload: { ...payloadWithoutFiles, project: activeProjectId },
6212
- blockers: [payload.issue, payload.component, payload.component_stage].filter(
6354
+ blockers: [payload.issue, payload.component, payload.component_stage, "add-form-entry"].filter(
6213
6355
  (x) => x !== void 0
6214
6356
  ),
6215
6357
  blocks: [payload.offline_id]
@@ -6228,10 +6370,12 @@ var __publicField = (obj, key, value) => {
6228
6370
  };
6229
6371
  store.dispatch(updateOrCreateUserFormSubmission(offlineResultWithoutFiles));
6230
6372
  void promise.then((result) => {
6373
+ store.dispatch(addActiveProjectFormSubmissionsCount(1));
6231
6374
  store.dispatch(updateOrCreateUserFormSubmission(result));
6232
6375
  return result;
6233
6376
  }).catch(() => {
6234
6377
  store.dispatch(deleteUserFormSubmission(payload.offline_id));
6378
+ store.dispatch(addActiveProjectFormSubmissionsCount(-1));
6235
6379
  });
6236
6380
  const settledPromise = Promise.all([promise, ...attachFilesPromises]).then(() => promise);
6237
6381
  return [fullOfflineResult, settledPromise];
@@ -6265,6 +6409,7 @@ var __publicField = (obj, key, value) => {
6265
6409
  const state = store.getState();
6266
6410
  const submission = state.userFormReducer.submissions[submissionId];
6267
6411
  store.dispatch(deleteUserFormSubmission(submissionId));
6412
+ store.dispatch(addActiveProjectFormSubmissionsCount(-1));
6268
6413
  try {
6269
6414
  return await this.enqueueRequest({
6270
6415
  description: "Delete user form submissions",
@@ -6275,6 +6420,7 @@ var __publicField = (obj, key, value) => {
6275
6420
  });
6276
6421
  } catch (e) {
6277
6422
  if (submission) {
6423
+ store.dispatch(addActiveProjectFormSubmissionsCount(1));
6278
6424
  store.dispatch(updateOrCreateUserFormSubmission(submission));
6279
6425
  }
6280
6426
  throw e;
@@ -6311,7 +6457,7 @@ var __publicField = (obj, key, value) => {
6311
6457
  method: HttpMethod.POST,
6312
6458
  url: `/projects/${store.getState().projectReducer.activeProjectId}/workspaces/`,
6313
6459
  payload: offlineWorkspace,
6314
- blockers: [],
6460
+ blockers: ["add-workspace"],
6315
6461
  blocks: [offlineWorkspace.offline_id]
6316
6462
  });
6317
6463
  void promise.then((result) => {
@@ -6737,6 +6883,122 @@ var __publicField = (obj, key, value) => {
6737
6883
  });
6738
6884
  }
6739
6885
  }
6886
+ class LicenseService extends BaseApiService {
6887
+ async fetchLicensesForOrganization(organizationId, showLoading = false) {
6888
+ if (showLoading) {
6889
+ this.client.store.dispatch(setIsFetchingInitialData(true));
6890
+ }
6891
+ const result = await this.enqueueRequest({
6892
+ description: "Get licenses",
6893
+ method: HttpMethod.GET,
6894
+ url: `/organizations/${organizationId}/licenses/`,
6895
+ isAuthNeeded: true,
6896
+ blockers: [organizationId.toString()],
6897
+ blocks: ["add-issue", "add-form-entry", "change-access-level", "add-workspace"]
6898
+ });
6899
+ if (showLoading) {
6900
+ this.client.store.dispatch(setIsFetchingInitialData(false));
6901
+ }
6902
+ this.client.store.dispatch(addLicenses(result));
6903
+ return result;
6904
+ }
6905
+ async getLicense(license) {
6906
+ const result = await this.enqueueRequest({
6907
+ description: "Get license",
6908
+ method: HttpMethod.GET,
6909
+ url: `/billing/${license.offline_id}/`,
6910
+ isAuthNeeded: true,
6911
+ blockers: [
6912
+ license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
6913
+ ],
6914
+ blocks: []
6915
+ });
6916
+ this.client.store.dispatch(updateLicense(result));
6917
+ return result;
6918
+ }
6919
+ async pauseLicense(license) {
6920
+ const result = await this.enqueueRequest({
6921
+ description: "Pause license",
6922
+ method: HttpMethod.DELETE,
6923
+ url: `/billing/${license.offline_id}/suspend/`,
6924
+ isAuthNeeded: true,
6925
+ blockers: [
6926
+ license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
6927
+ ],
6928
+ blocks: []
6929
+ });
6930
+ this.client.store.dispatch(updateLicense(result));
6931
+ return result;
6932
+ }
6933
+ async resumeLicense(license) {
6934
+ const result = await this.enqueueRequest({
6935
+ description: "Resume license",
6936
+ method: HttpMethod.PATCH,
6937
+ url: `/billing/${license.offline_id}/suspend/`,
6938
+ isAuthNeeded: true,
6939
+ blockers: [
6940
+ license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
6941
+ ],
6942
+ blocks: []
6943
+ });
6944
+ this.client.store.dispatch(updateLicense(result));
6945
+ return result;
6946
+ }
6947
+ async cancelLicense(license) {
6948
+ const result = await this.enqueueRequest({
6949
+ description: "Cancel license",
6950
+ method: HttpMethod.DELETE,
6951
+ url: `/billing/${license.offline_id}/`,
6952
+ isAuthNeeded: true,
6953
+ blockers: [
6954
+ license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
6955
+ ],
6956
+ blocks: []
6957
+ });
6958
+ this.client.store.dispatch(updateLicense(result));
6959
+ return result;
6960
+ }
6961
+ async attachLicenseToProject(license, project) {
6962
+ const result = await this.enqueueRequest({
6963
+ description: "Attach license",
6964
+ method: HttpMethod.PATCH,
6965
+ url: `/billing/${license.offline_id}/project/`,
6966
+ isAuthNeeded: true,
6967
+ payload: { project: project.id },
6968
+ blockers: [
6969
+ license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : "",
6970
+ project.id ? project.id.toString() : ""
6971
+ ],
6972
+ blocks: ["add-issue", "add-form-entry", "change-access-level", "add-workspace"]
6973
+ });
6974
+ this.client.store.dispatch(updateLicense(result));
6975
+ return result;
6976
+ }
6977
+ async detachLicenseFromProject(license) {
6978
+ const result = await this.enqueueRequest({
6979
+ description: "Detach license",
6980
+ method: HttpMethod.DELETE,
6981
+ url: `/billing/${license.offline_id}/project/`,
6982
+ isAuthNeeded: true,
6983
+ blockers: [
6984
+ license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
6985
+ ],
6986
+ blocks: ["add-issue", "add-form-entry", "change-access-level", "add-workspace"]
6987
+ });
6988
+ this.client.store.dispatch(updateLicense(result));
6989
+ return result;
6990
+ }
6991
+ async getLatestTransaction(license) {
6992
+ return await this.enqueueRequest({
6993
+ description: "Get latest transaction",
6994
+ method: HttpMethod.GET,
6995
+ url: `/billing/${license.offline_id}/transaction/`,
6996
+ isAuthNeeded: true,
6997
+ blockers: [license.offline_id],
6998
+ blocks: [license.offline_id]
6999
+ });
7000
+ }
7001
+ }
6740
7002
  class OvermapSDK {
6741
7003
  constructor(apiUrl, store) {
6742
7004
  __publicField(this, "API_URL");
@@ -6762,6 +7024,7 @@ var __publicField = (obj, key, value) => {
6762
7024
  __publicField(this, "projectFiles", new ProjectFileService(this));
6763
7025
  __publicField(this, "emailVerification", new EmailVerificationService(this));
6764
7026
  __publicField(this, "emailDomains", new EmailDomainsService(this));
7027
+ __publicField(this, "licenses", new LicenseService(this));
6765
7028
  this.API_URL = apiUrl;
6766
7029
  this.store = store;
6767
7030
  }
@@ -6846,8 +7109,8 @@ var __publicField = (obj, key, value) => {
6846
7109
  }
6847
7110
  }
6848
7111
  const emptyBaseField = {
6849
- label: "Question",
6850
- description: "Optional description",
7112
+ label: "",
7113
+ description: "",
6851
7114
  required: false
6852
7115
  };
6853
7116
  class BaseField extends BaseFormElement {
@@ -13643,14 +13906,16 @@ var __publicField = (obj, key, value) => {
13643
13906
  key: "duplicate",
13644
13907
  text: "Duplicate",
13645
13908
  buttonProps: { onClick: duplicate }
13646
- },
13647
- {
13909
+ }
13910
+ ];
13911
+ if (index2 !== 0) {
13912
+ actions2.push({
13648
13913
  Icon: TrashIcon,
13649
13914
  key: "delete",
13650
13915
  text: "Delete",
13651
13916
  buttonProps: { onClick: remove2 }
13652
- }
13653
- ];
13917
+ });
13918
+ }
13654
13919
  if (type !== "section") {
13655
13920
  actions2.unshift({
13656
13921
  Icon: ImageIcon,
@@ -14774,6 +15039,9 @@ var __publicField = (obj, key, value) => {
14774
15039
  exports2.IssuePriority = IssuePriority;
14775
15040
  exports2.IssueService = IssueService;
14776
15041
  exports2.IssueStatus = IssueStatus;
15042
+ exports2.LicenseLevel = LicenseLevel;
15043
+ exports2.LicenseService = LicenseService;
15044
+ exports2.LicenseStatus = LicenseStatus;
14777
15045
  exports2.MainService = MainService;
14778
15046
  exports2.MapStyle = MapStyle;
14779
15047
  exports2.MultiSelectField = MultiSelectField;
@@ -14791,6 +15059,7 @@ var __publicField = (obj, key, value) => {
14791
15059
  exports2.OvermapProvider = OvermapProvider;
14792
15060
  exports2.OvermapSDK = OvermapSDK;
14793
15061
  exports2.PDFViewer = PDFViewer;
15062
+ exports2.PaddleCheckoutEvent = PaddleCheckoutEvent;
14794
15063
  exports2.PatchField = PatchField;
14795
15064
  exports2.PatchFormProvider = PatchFormProvider;
14796
15065
  exports2.ProjectAccessLevel = ProjectAccessLevel;
@@ -14817,6 +15086,8 @@ var __publicField = (obj, key, value) => {
14817
15086
  exports2.YELLOW = YELLOW;
14818
15087
  exports2._setLatestRetryTime = _setLatestRetryTime;
14819
15088
  exports2.acceptProjectInvite = acceptProjectInvite;
15089
+ exports2.addActiveProjectFormSubmissionsCount = addActiveProjectFormSubmissionsCount;
15090
+ exports2.addActiveProjectIssuesCount = addActiveProjectIssuesCount;
14820
15091
  exports2.addCategory = addCategory;
14821
15092
  exports2.addComponent = addComponent;
14822
15093
  exports2.addComponentAttachment = addComponentAttachment;
@@ -14830,6 +15101,7 @@ var __publicField = (obj, key, value) => {
14830
15101
  exports2.addIssue = addIssue;
14831
15102
  exports2.addIssueAttachment = addIssueAttachment;
14832
15103
  exports2.addIssueAttachments = addIssueAttachments;
15104
+ exports2.addLicenses = addLicenses;
14833
15105
  exports2.addOrReplaceCategories = addOrReplaceCategories;
14834
15106
  exports2.addOrReplaceIssueComment = addOrReplaceIssueComment;
14835
15107
  exports2.addOrReplaceProjectFile = addOrReplaceProjectFile;
@@ -14929,6 +15201,8 @@ var __publicField = (obj, key, value) => {
14929
15201
  exports2.issueReducer = issueReducer;
14930
15202
  exports2.issueSlice = issueSlice;
14931
15203
  exports2.issueToSearchResult = issueToSearchResult;
15204
+ exports2.licenseReducer = licenseReducer;
15205
+ exports2.licenseSlice = licenseSlice;
14932
15206
  exports2.linkStageToForm = linkStageToForm;
14933
15207
  exports2.literalToCoordinates = literalToCoordinates;
14934
15208
  exports2.logOnlyOnce = logOnlyOnce;
@@ -15000,13 +15274,17 @@ var __publicField = (obj, key, value) => {
15000
15274
  exports2.searchIssues = searchIssues;
15001
15275
  exports2.selectAccessToken = selectAccessToken;
15002
15276
  exports2.selectActiveIssueId = selectActiveIssueId;
15277
+ exports2.selectActiveLicense = selectActiveLicense;
15003
15278
  exports2.selectActiveOrganization = selectActiveOrganization;
15004
15279
  exports2.selectActiveOrganizationAccess = selectActiveOrganizationAccess;
15005
15280
  exports2.selectActiveOrganizationId = selectActiveOrganizationId;
15281
+ exports2.selectActiveOrganizationLicenses = selectActiveOrganizationLicenses;
15282
+ exports2.selectActiveOrganizationProjects = selectActiveOrganizationProjects;
15006
15283
  exports2.selectActiveProject = selectActiveProject;
15007
15284
  exports2.selectActiveProjectAccess = selectActiveProjectAccess;
15008
15285
  exports2.selectActiveProjectFileId = selectActiveProjectFileId;
15009
15286
  exports2.selectActiveProjectId = selectActiveProjectId;
15287
+ exports2.selectActiveStatusLicenses = selectActiveStatusLicenses;
15010
15288
  exports2.selectActiveWorkspace = selectActiveWorkspace;
15011
15289
  exports2.selectActiveWorkspaceId = selectActiveWorkspaceId;
15012
15290
  exports2.selectAllAttachments = selectAllAttachments;
@@ -15062,6 +15340,7 @@ var __publicField = (obj, key, value) => {
15062
15340
  exports2.selectHiddenComponentTypeIds = selectHiddenComponentTypeIds;
15063
15341
  exports2.selectIsFetchingInitialData = selectIsFetchingInitialData;
15064
15342
  exports2.selectIsImportingProjectFile = selectIsImportingProjectFile;
15343
+ exports2.selectIsLoading = selectIsLoading;
15065
15344
  exports2.selectIsLoggedIn = selectIsLoggedIn;
15066
15345
  exports2.selectIssue = selectIssue;
15067
15346
  exports2.selectIssueAttachmentMapping = selectIssueAttachmentMapping;
@@ -15072,6 +15351,10 @@ var __publicField = (obj, key, value) => {
15072
15351
  exports2.selectLatestRetryTime = selectLatestRetryTime;
15073
15352
  exports2.selectLatestRevisionByFormId = selectLatestRevisionByFormId;
15074
15353
  exports2.selectLatestRevisionsFromComponentTypeIds = selectLatestRevisionsFromComponentTypeIds;
15354
+ exports2.selectLicense = selectLicense;
15355
+ exports2.selectLicenseForProject = selectLicenseForProject;
15356
+ exports2.selectLicenses = selectLicenses;
15357
+ exports2.selectLicensesForProjectsMapping = selectLicensesForProjectsMapping;
15075
15358
  exports2.selectMainWorkspace = selectMainWorkspace;
15076
15359
  exports2.selectMapStyle = selectMapStyle;
15077
15360
  exports2.selectNumberOfComponentTypesMatchingCaseInsensitiveName = selectNumberOfComponentTypesMatchingCaseInsensitiveName;
@@ -15086,6 +15369,7 @@ var __publicField = (obj, key, value) => {
15086
15369
  exports2.selectOrganizationUsersAsMapping = selectOrganizationUsersAsMapping;
15087
15370
  exports2.selectOrganizationUsersIds = selectOrganizationUsersIds;
15088
15371
  exports2.selectOrganizations = selectOrganizations;
15372
+ exports2.selectOrganizationsMapping = selectOrganizationsMapping;
15089
15373
  exports2.selectOrganizationsWithAccess = selectOrganizationsWithAccess;
15090
15374
  exports2.selectPermittedWorkspaceIds = selectPermittedWorkspaceIds;
15091
15375
  exports2.selectPhotoAttachmentsOfIssue = selectPhotoAttachmentsOfIssue;
@@ -15107,6 +15391,7 @@ var __publicField = (obj, key, value) => {
15107
15391
  exports2.selectRevisionsForForm = selectRevisionsForForm;
15108
15392
  exports2.selectShowTooltips = selectShowTooltips;
15109
15393
  exports2.selectSortedEmailDomains = selectSortedEmailDomains;
15394
+ exports2.selectSortedOrganizationLicenses = selectSortedOrganizationLicenses;
15110
15395
  exports2.selectSortedOrganizationUsers = selectSortedOrganizationUsers;
15111
15396
  exports2.selectSortedProjectUsers = selectSortedProjectUsers;
15112
15397
  exports2.selectSortedProjects = selectSortedProjects;
@@ -15151,9 +15436,11 @@ var __publicField = (obj, key, value) => {
15151
15436
  exports2.setEnablePlacementMode = setEnablePlacementMode;
15152
15437
  exports2.setIsFetchingInitialData = setIsFetchingInitialData;
15153
15438
  exports2.setIsImportingProjectFile = setIsImportingProjectFile;
15439
+ exports2.setIsLoading = setIsLoading;
15154
15440
  exports2.setIssueAttachments = setIssueAttachments;
15155
15441
  exports2.setIssueComments = setIssueComments;
15156
15442
  exports2.setIssues = setIssues;
15443
+ exports2.setLicenses = setLicenses;
15157
15444
  exports2.setLoggedIn = setLoggedIn;
15158
15445
  exports2.setMapStyle = setMapStyle;
15159
15446
  exports2.setOrganizationAccesses = setOrganizationAccesses;
@@ -15195,6 +15482,7 @@ var __publicField = (obj, key, value) => {
15195
15482
  exports2.updateComponentTypeAttachment = updateComponentTypeAttachment;
15196
15483
  exports2.updateIssue = updateIssue;
15197
15484
  exports2.updateIssueAttachment = updateIssueAttachment;
15485
+ exports2.updateLicense = updateLicense;
15198
15486
  exports2.updateOrCreateProject = updateOrCreateProject;
15199
15487
  exports2.updateOrCreateUserFormSubmission = updateOrCreateUserFormSubmission;
15200
15488
  exports2.updateOrganizationAccess = updateOrganizationAccess;