@overmap-ai/core 1.0.35-projects-licensing.15 → 1.0.35

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;
@@ -1334,7 +1334,7 @@ var __publicField = (obj, key, value) => {
1334
1334
  return getLocalDateString(date);
1335
1335
  return relative.format(days, "days");
1336
1336
  });
1337
- const initialState$l = {
1337
+ const initialState$k = {
1338
1338
  categories: {},
1339
1339
  usedCategoryColors: [],
1340
1340
  categoryVisibility: {
@@ -1344,8 +1344,8 @@ var __publicField = (obj, key, value) => {
1344
1344
  };
1345
1345
  const categorySlice = toolkit.createSlice({
1346
1346
  name: "categories",
1347
- initialState: initialState$l,
1348
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
1347
+ initialState: initialState$k,
1348
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
1349
1349
  reducers: {
1350
1350
  setCategories: (state, action) => {
1351
1351
  if (!Array.isArray(action.payload))
@@ -1478,13 +1478,13 @@ var __publicField = (obj, key, value) => {
1478
1478
  return hiddenCategoryCount;
1479
1479
  };
1480
1480
  const categoryReducer = categorySlice.reducer;
1481
- const initialState$k = {
1481
+ const initialState$j = {
1482
1482
  components: {}
1483
1483
  };
1484
1484
  const componentSlice = toolkit.createSlice({
1485
1485
  name: "components",
1486
- initialState: initialState$k,
1487
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
1486
+ initialState: initialState$j,
1487
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
1488
1488
  reducers: {
1489
1489
  addComponent: (state, action) => {
1490
1490
  state.components[action.payload.offline_id] = action.payload;
@@ -1596,13 +1596,13 @@ var __publicField = (obj, key, value) => {
1596
1596
  removeAllComponentsOfType
1597
1597
  } = componentSlice.actions;
1598
1598
  const componentReducer = componentSlice.reducer;
1599
- const initialState$j = {
1599
+ const initialState$i = {
1600
1600
  completionsByComponentId: {}
1601
1601
  };
1602
1602
  const componentStageCompletionSlice = toolkit.createSlice({
1603
1603
  name: "componentStageCompletions",
1604
- initialState: initialState$j,
1605
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
1604
+ initialState: initialState$i,
1605
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
1606
1606
  reducers: {
1607
1607
  addStageCompletion: (state, action) => {
1608
1608
  let stageToCompletionDateMapping = state.completionsByComponentId[action.payload.component];
@@ -1653,13 +1653,13 @@ var __publicField = (obj, key, value) => {
1653
1653
  return Object.keys(state.componentStageCompletionReducer.completionsByComponentId[component.offline_id] ?? {});
1654
1654
  };
1655
1655
  const componentStageCompletionReducer = componentStageCompletionSlice.reducer;
1656
- const initialState$i = {
1656
+ const initialState$h = {
1657
1657
  stages: {}
1658
1658
  };
1659
1659
  const componentStageSlice = toolkit.createSlice({
1660
1660
  name: "componentStages",
1661
- initialState: initialState$i,
1662
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
1661
+ initialState: initialState$h,
1662
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
1663
1663
  reducers: {
1664
1664
  addStages: (state, action) => {
1665
1665
  Object.assign(state.stages, toOfflineIdRecord(action.payload));
@@ -1719,14 +1719,14 @@ var __publicField = (obj, key, value) => {
1719
1719
  );
1720
1720
  const { addStages, updateStages, removeStages } = componentStageSlice.actions;
1721
1721
  const componentStageReducer = componentStageSlice.reducer;
1722
- const initialState$h = {
1722
+ const initialState$g = {
1723
1723
  componentTypes: {},
1724
1724
  hiddenComponentTypeIds: {}
1725
1725
  };
1726
1726
  const componentTypeSlice = toolkit.createSlice({
1727
1727
  name: "componentTypes",
1728
- initialState: initialState$h,
1729
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
1728
+ initialState: initialState$g,
1729
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
1730
1730
  reducers: {
1731
1731
  addComponentType: (state, action) => {
1732
1732
  state.componentTypes[action.payload.offline_id] = action.payload;
@@ -1785,13 +1785,13 @@ var __publicField = (obj, key, value) => {
1785
1785
  const selectHiddenComponentTypeIds = (state) => state.componentTypeReducer.hiddenComponentTypeIds;
1786
1786
  const { addComponentType, setComponentTypes, toggleComponentTypeVisibility, deleteComponentType } = componentTypeSlice.actions;
1787
1787
  const componentTypeReducer = componentTypeSlice.reducer;
1788
- const initialState$g = {
1788
+ const initialState$f = {
1789
1789
  workspaces: {},
1790
1790
  activeWorkspaceId: null
1791
1791
  };
1792
1792
  const workspaceSlice = toolkit.createSlice({
1793
1793
  name: "workspace",
1794
- initialState: initialState$g,
1794
+ initialState: initialState$f,
1795
1795
  // The `reducers` field lets us define reducers and generate associated actions
1796
1796
  reducers: {
1797
1797
  setWorkspaces: (state, action) => {
@@ -1848,7 +1848,7 @@ var __publicField = (obj, key, value) => {
1848
1848
  );
1849
1849
  const workspaceReducer = workspaceSlice.reducer;
1850
1850
  const maxRecentIssues = 10;
1851
- const initialState$f = {
1851
+ const initialState$e = {
1852
1852
  issues: {},
1853
1853
  attachments: {},
1854
1854
  comments: {},
@@ -1860,9 +1860,9 @@ var __publicField = (obj, key, value) => {
1860
1860
  };
1861
1861
  const issueSlice = toolkit.createSlice({
1862
1862
  name: "issues",
1863
- initialState: initialState$f,
1863
+ initialState: initialState$e,
1864
1864
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
1865
- Object.assign(state, initialState$f);
1865
+ Object.assign(state, initialState$e);
1866
1866
  }),
1867
1867
  reducers: {
1868
1868
  setIssues: (state, action) => {
@@ -2193,15 +2193,15 @@ var __publicField = (obj, key, value) => {
2193
2193
  }
2194
2194
  );
2195
2195
  const issueReducer = issueSlice.reducer;
2196
- const initialState$e = {
2196
+ const initialState$d = {
2197
2197
  s3Urls: {}
2198
2198
  };
2199
2199
  const msPerHour = 1e3 * 60 * 60;
2200
2200
  const msPerWeek = msPerHour * 24 * 7;
2201
2201
  const fileSlice = toolkit.createSlice({
2202
2202
  name: "file",
2203
- initialState: initialState$e,
2204
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
2203
+ initialState: initialState$d,
2204
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
2205
2205
  reducers: {
2206
2206
  setUploadUrl: (state, action) => {
2207
2207
  const { url, fields, sha1 } = action.payload;
@@ -2228,7 +2228,7 @@ var __publicField = (obj, key, value) => {
2228
2228
  return url;
2229
2229
  };
2230
2230
  const fileReducer = fileSlice.reducer;
2231
- const initialState$d = {
2231
+ const initialState$c = {
2232
2232
  // TODO: Change first MapStyle.SATELLITE to MaptStyle.None when project creation map is fixed
2233
2233
  mapStyle: MapStyle.SATELLITE,
2234
2234
  showTooltips: false,
@@ -2236,8 +2236,8 @@ var __publicField = (obj, key, value) => {
2236
2236
  };
2237
2237
  const mapSlice = toolkit.createSlice({
2238
2238
  name: "map",
2239
- initialState: initialState$d,
2240
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
2239
+ initialState: initialState$c,
2240
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
2241
2241
  reducers: {
2242
2242
  setMapStyle: (state, action) => {
2243
2243
  state.mapStyle = action.payload;
@@ -2279,18 +2279,7 @@ var __publicField = (obj, key, value) => {
2279
2279
  VerificationCodeType2[VerificationCodeType2["RESET_PASSWORD"] = 10] = "RESET_PASSWORD";
2280
2280
  return VerificationCodeType2;
2281
2281
  })(VerificationCodeType || {});
2282
- var LicenseLevel = /* @__PURE__ */ ((LicenseLevel2) => {
2283
- LicenseLevel2[LicenseLevel2["PRO"] = 0] = "PRO";
2284
- return LicenseLevel2;
2285
- })(LicenseLevel || {});
2286
- var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
2287
- LicenseStatus2[LicenseStatus2["ACTIVE"] = 0] = "ACTIVE";
2288
- LicenseStatus2[LicenseStatus2["PAUSED"] = 2] = "PAUSED";
2289
- LicenseStatus2[LicenseStatus2["CANCELED"] = 4] = "CANCELED";
2290
- LicenseStatus2[LicenseStatus2["INACTIVE"] = 6] = "INACTIVE";
2291
- return LicenseStatus2;
2292
- })(LicenseStatus || {});
2293
- const initialState$c = {
2282
+ const initialState$b = {
2294
2283
  users: {},
2295
2284
  currentUser: {
2296
2285
  id: 0,
@@ -2301,8 +2290,8 @@ var __publicField = (obj, key, value) => {
2301
2290
  };
2302
2291
  const userSlice = toolkit.createSlice({
2303
2292
  name: "users",
2304
- initialState: initialState$c,
2305
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
2293
+ initialState: initialState$b,
2294
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
2306
2295
  reducers: {
2307
2296
  setUsers: (state, action) => {
2308
2297
  const usersMapping = {};
@@ -2364,13 +2353,13 @@ var __publicField = (obj, key, value) => {
2364
2353
  const selectUsersAsMapping = (state) => state.userReducer.users;
2365
2354
  const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
2366
2355
  const userReducer = userSlice.reducer;
2367
- const initialState$b = {
2356
+ const initialState$a = {
2368
2357
  organizationAccesses: {}
2369
2358
  };
2370
2359
  const organizationAccessSlice = toolkit.createSlice({
2371
2360
  name: "organizationAccess",
2372
- initialState: initialState$b,
2373
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
2361
+ initialState: initialState$a,
2362
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
2374
2363
  reducers: {
2375
2364
  setOrganizationAccesses: (state, action) => {
2376
2365
  if (!Array.isArray(action.payload))
@@ -2433,13 +2422,151 @@ var __publicField = (obj, key, value) => {
2433
2422
  return organizationAccesses;
2434
2423
  };
2435
2424
  const organizationAccessReducer = organizationAccessSlice.reducer;
2436
- const initialState$a = {
2425
+ const initialState$9 = {
2426
+ organizations: {},
2427
+ activeOrganizationId: null
2428
+ };
2429
+ const organizationSlice = toolkit.createSlice({
2430
+ name: "organizations",
2431
+ initialState: initialState$9,
2432
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$9)),
2433
+ reducers: {
2434
+ setOrganizations: (state, action) => {
2435
+ for (const org of action.payload) {
2436
+ state.organizations[org.id] = org;
2437
+ }
2438
+ },
2439
+ updateActiveOrganization: (state, action) => {
2440
+ if (!state.activeOrganizationId) {
2441
+ throw new Error("Cannot update name of active organization. Active organization ID does not exist");
2442
+ }
2443
+ if (state.activeOrganizationId !== action.payload.id) {
2444
+ throw new Error("Tried updating active organization with different organization");
2445
+ }
2446
+ state.organizations[state.activeOrganizationId] = action.payload;
2447
+ },
2448
+ setActiveOrganizationId: (state, action) => {
2449
+ state.activeOrganizationId = action.payload;
2450
+ }
2451
+ }
2452
+ });
2453
+ const { setOrganizations, setActiveOrganizationId, updateActiveOrganization } = organizationSlice.actions;
2454
+ const selectActiveOrganizationId = (state) => {
2455
+ return state.organizationReducer.activeOrganizationId;
2456
+ };
2457
+ const selectOrganizations = (state) => {
2458
+ return Object.values(state.organizationReducer.organizations);
2459
+ };
2460
+ const selectOrganizationsWithAccess = toolkit.createSelector(
2461
+ [selectOrganizations],
2462
+ (organizations) => Object.values(organizations).filter((organization) => organization.has_access)
2463
+ );
2464
+ const selectActiveOrganization = (state) => {
2465
+ const id = selectActiveOrganizationId(state);
2466
+ if (!id) {
2467
+ return null;
2468
+ }
2469
+ const organization = state.organizationReducer.organizations[id];
2470
+ if (!organization) {
2471
+ return null;
2472
+ }
2473
+ return organization;
2474
+ };
2475
+ const selectOrganizationUsersIds = toolkit.createSelector(
2476
+ [selectOrganizationAccesses],
2477
+ (organizationAccesses) => Object.values(organizationAccesses).map((organizationAccess) => organizationAccess.user)
2478
+ );
2479
+ const selectOrganizationUsersAsMapping = toolkit.createSelector(
2480
+ [selectOrganizationUsersIds, selectUsersAsMapping],
2481
+ (organizationUserIds, users) => organizationUserIds.reduce((accum, userId) => ({ ...accum, [userId]: users[userId] }), {})
2482
+ );
2483
+ const selectSortedOrganizationUsers = toolkit.createSelector(
2484
+ [selectCurrentUser, selectOrganizationUsersAsMapping, selectOrganizationAccessUserMapping],
2485
+ (currentUser, userMapping, organizationAccessMapping) => {
2486
+ return Object.values(userMapping).sort((userA, userB) => {
2487
+ if (userA.id === currentUser.id) {
2488
+ return -1;
2489
+ } else if (userB.id === currentUser.id) {
2490
+ return 1;
2491
+ }
2492
+ const organizationAccessesA = organizationAccessMapping[userA.id];
2493
+ const organizationAccessesB = organizationAccessMapping[userB.id];
2494
+ if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === (organizationAccessesB == null ? void 0 : organizationAccessesB.access_level)) {
2495
+ return userA.username.localeCompare(userB.username);
2496
+ }
2497
+ if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === OrganizationAccessLevel.ADMIN) {
2498
+ return -1;
2499
+ }
2500
+ return 1;
2501
+ });
2502
+ }
2503
+ );
2504
+ const selectOrganization = (id) => (state) => {
2505
+ return state.organizationReducer.organizations[id];
2506
+ };
2507
+ const organizationReducer = organizationSlice.reducer;
2508
+ const createOfflineAction = (request2, baseUrl) => {
2509
+ const requestWithUuid = request2.uuid ? request2 : { ...request2, uuid: uuid.v4() };
2510
+ return {
2511
+ payload: requestWithUuid,
2512
+ type: "",
2513
+ meta: {
2514
+ offline: {
2515
+ effect: {
2516
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
2517
+ request: requestWithUuid,
2518
+ BASE_URL: baseUrl
2519
+ }
2520
+ }
2521
+ }
2522
+ };
2523
+ };
2524
+ const initialState$8 = {
2525
+ deletedRequests: [],
2526
+ latestRetryTime: 0
2527
+ };
2528
+ const outboxSlice = toolkit.createSlice({
2529
+ name: "outbox",
2530
+ initialState: initialState$8,
2531
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
2532
+ reducers: {
2533
+ // enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
2534
+ // Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
2535
+ // Then this reducer enqueueRequest() is responsible for adding the actual request data to the outbox
2536
+ enqueueRequest: {
2537
+ reducer: (state, _action) => {
2538
+ return state;
2539
+ },
2540
+ prepare: (payload) => {
2541
+ console.debug("Preparing to enqueue request", payload);
2542
+ const { BASE_URL, ...rest } = payload;
2543
+ return createOfflineAction(rest, BASE_URL);
2544
+ }
2545
+ },
2546
+ markForDeletion(state, action) {
2547
+ state.deletedRequests.push(action.payload);
2548
+ },
2549
+ markAsDeleted(state, action) {
2550
+ const index2 = state.deletedRequests.indexOf(action.payload);
2551
+ if (index2 !== -1)
2552
+ state.deletedRequests.splice(index2, 1);
2553
+ },
2554
+ _setLatestRetryTime: (state, action) => {
2555
+ state.latestRetryTime = action.payload;
2556
+ }
2557
+ }
2558
+ });
2559
+ const selectDeletedRequests = (state) => state.outboxReducer.deletedRequests;
2560
+ const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
2561
+ const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
2562
+ const outboxReducer = outboxSlice.reducer;
2563
+ const initialState$7 = {
2437
2564
  projectAccesses: {}
2438
2565
  };
2439
2566
  const projectAccessSlice = toolkit.createSlice({
2440
2567
  name: "projectAccess",
2441
- initialState: initialState$a,
2442
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
2568
+ initialState: initialState$7,
2569
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
2443
2570
  reducers: {
2444
2571
  setProjectAccesses: (state, action) => {
2445
2572
  if (!Array.isArray(action.payload))
@@ -2507,7 +2634,7 @@ var __publicField = (obj, key, value) => {
2507
2634
  return projectAccesses;
2508
2635
  };
2509
2636
  const projectAccessReducer = projectAccessSlice.reducer;
2510
- const initialState$9 = {
2637
+ const initialState$6 = {
2511
2638
  projects: {},
2512
2639
  activeProjectId: null,
2513
2640
  recentProjectIds: [],
@@ -2516,7 +2643,7 @@ var __publicField = (obj, key, value) => {
2516
2643
  };
2517
2644
  const projectSlice = toolkit.createSlice({
2518
2645
  name: "projects",
2519
- initialState: initialState$9,
2646
+ initialState: initialState$6,
2520
2647
  reducers: {
2521
2648
  setProjects: (state, action) => {
2522
2649
  const projectsMap = {};
@@ -2562,20 +2689,6 @@ var __publicField = (obj, key, value) => {
2562
2689
  } else {
2563
2690
  throw new Error("Accept project invite: user is not in this project");
2564
2691
  }
2565
- },
2566
- updateActiveProjectIssuesCount: (state, action) => {
2567
- if (state.activeProjectId) {
2568
- state.projects[state.activeProjectId].issues_count += action.payload;
2569
- } else {
2570
- throw new Error("Update issues count: no active project");
2571
- }
2572
- },
2573
- updateActiveProjectFormSubmissionsCount: (state, action) => {
2574
- if (state.activeProjectId) {
2575
- state.projects[state.activeProjectId].form_submissions_count += action.payload;
2576
- } else {
2577
- throw new Error("Update form submissions count: no active project");
2578
- }
2579
2692
  }
2580
2693
  }
2581
2694
  });
@@ -2586,9 +2699,7 @@ var __publicField = (obj, key, value) => {
2586
2699
  setActiveProjectId,
2587
2700
  setCreateProjectType,
2588
2701
  deleteProject,
2589
- acceptProjectInvite,
2590
- updateActiveProjectIssuesCount,
2591
- updateActiveProjectFormSubmissionsCount
2702
+ acceptProjectInvite
2592
2703
  } = projectSlice.actions;
2593
2704
  const selectProjects = (state) => state.projectReducer.projects;
2594
2705
  const selectActiveProjectId = (state) => state.projectReducer.activeProjectId;
@@ -2652,231 +2763,6 @@ var __publicField = (obj, key, value) => {
2652
2763
  });
2653
2764
  }
2654
2765
  );
2655
- const initialState$8 = {
2656
- licenses: {}
2657
- };
2658
- const licenseSlice = toolkit.createSlice({
2659
- name: "license",
2660
- initialState: initialState$8,
2661
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
2662
- reducers: {
2663
- setLicenses: (state, action) => {
2664
- if (!Array.isArray(action.payload))
2665
- throw new Error("Expected an array of Licenses");
2666
- if (action.payload.filter(onlyUniqueOfflineIds).length !== action.payload.length) {
2667
- throw new Error("Tried to use setLicenses reducer with duplicate ID's");
2668
- }
2669
- const licenses = {};
2670
- for (const license of action.payload) {
2671
- licenses[license.offline_id] = license;
2672
- }
2673
- state.licenses = licenses;
2674
- },
2675
- addLicenses: (state, action) => {
2676
- for (const license of action.payload) {
2677
- state.licenses[license.offline_id] = license;
2678
- }
2679
- },
2680
- updateLicense: (state, action) => {
2681
- if (!(action.payload.offline_id in state.licenses)) {
2682
- throw new Error("Tried to update license that does not exist.");
2683
- }
2684
- state.licenses[action.payload.offline_id] = action.payload;
2685
- }
2686
- }
2687
- });
2688
- const { setLicenses, addLicenses, updateLicense } = licenseSlice.actions;
2689
- const selectLicenses = (state) => {
2690
- return state.licenseReducer.licenses;
2691
- };
2692
- const selectLicense = (licenseId) => (state) => state.licenseReducer.licenses[licenseId];
2693
- const selectActiveLicense = toolkit.createSelector(
2694
- [selectLicenses, selectActiveProjectId],
2695
- (licenses, activeProjectId) => {
2696
- const activeLicense = Object.values(licenses).find((license) => license.project === activeProjectId);
2697
- return activeLicense ?? null;
2698
- }
2699
- );
2700
- const selectLicenseForProject = restructureCreateSelectorWithArgs(
2701
- toolkit.createSelector(
2702
- [selectLicenses, (_state, projectId) => projectId],
2703
- (licenses, projectId) => Object.values(licenses).find((license) => license.project === projectId) ?? null
2704
- )
2705
- );
2706
- const selectActiveStatusLicenses = toolkit.createSelector(
2707
- [selectLicenses],
2708
- (licenses) => Object.values(licenses).filter((license) => license.is_active)
2709
- );
2710
- const selectLicencesMapping = toolkit.createSelector(
2711
- [selectLicenses],
2712
- (licenses) => Object.values(licenses).filter((license) => license.project).reduce((accum, license) => ({ ...accum, [license.project]: license }), {})
2713
- );
2714
- const licenseReducer = licenseSlice.reducer;
2715
- const initialState$7 = {
2716
- organizations: {},
2717
- activeOrganizationId: null
2718
- };
2719
- const organizationSlice = toolkit.createSlice({
2720
- name: "organizations",
2721
- initialState: initialState$7,
2722
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
2723
- reducers: {
2724
- setOrganizations: (state, action) => {
2725
- for (const org of action.payload) {
2726
- state.organizations[org.id] = org;
2727
- }
2728
- },
2729
- updateActiveOrganization: (state, action) => {
2730
- if (!state.activeOrganizationId) {
2731
- throw new Error("Cannot update name of active organization. Active organization ID does not exist");
2732
- }
2733
- if (state.activeOrganizationId !== action.payload.id) {
2734
- throw new Error("Tried updating active organization with different organization");
2735
- }
2736
- state.organizations[state.activeOrganizationId] = action.payload;
2737
- },
2738
- setActiveOrganizationId: (state, action) => {
2739
- state.activeOrganizationId = action.payload;
2740
- }
2741
- }
2742
- });
2743
- const { setOrganizations, setActiveOrganizationId, updateActiveOrganization } = organizationSlice.actions;
2744
- const selectActiveOrganizationId = (state) => {
2745
- return state.organizationReducer.activeOrganizationId;
2746
- };
2747
- const selectOrganizations = (state) => {
2748
- return Object.values(state.organizationReducer.organizations);
2749
- };
2750
- const selectOrganizationsMapping = (state) => {
2751
- return state.organizationReducer.organizations;
2752
- };
2753
- const selectOrganizationsWithAccess = toolkit.createSelector(
2754
- [selectOrganizations],
2755
- (organizations) => Object.values(organizations).filter((organization) => organization.has_access)
2756
- );
2757
- const selectActiveOrganization = (state) => {
2758
- const id = selectActiveOrganizationId(state);
2759
- if (!id) {
2760
- return null;
2761
- }
2762
- const organization = state.organizationReducer.organizations[id];
2763
- if (!organization) {
2764
- return null;
2765
- }
2766
- return organization;
2767
- };
2768
- const selectOrganizationUsersIds = toolkit.createSelector(
2769
- [selectOrganizationAccesses],
2770
- (organizationAccesses) => Object.values(organizationAccesses).map((organizationAccess) => organizationAccess.user)
2771
- );
2772
- const selectActiveOrganizationProjects = toolkit.createSelector(
2773
- [selectProjects, selectActiveOrganizationId],
2774
- (projects, activeOrganizationId) => activeOrganizationId ? Object.values(projects).filter((project) => project.owner_organization === activeOrganizationId) : []
2775
- );
2776
- const selectActiveOrganizationLicenses = toolkit.createSelector(
2777
- [selectActiveOrganizationId, selectLicenses],
2778
- (activeOrganizationId, licenses) => !activeOrganizationId ? [] : Object.values(licenses).filter((license) => license.organization_owner === activeOrganizationId)
2779
- );
2780
- const selectSortedOrganizationLicenses = toolkit.createSelector(
2781
- [selectActiveOrganizationLicenses, selectProjects],
2782
- (licences, projects) => licences.sort((licenseA, licenseB) => {
2783
- if (!licenseA.project) {
2784
- return 1;
2785
- }
2786
- if (!licenseB.project) {
2787
- return -1;
2788
- }
2789
- return projects[licenseA.project].name.toLowerCase().localeCompare(
2790
- projects[licenseB.project].name.toLowerCase(),
2791
- void 0,
2792
- { numeric: true }
2793
- );
2794
- })
2795
- );
2796
- const selectOrganizationUsersAsMapping = toolkit.createSelector(
2797
- [selectOrganizationUsersIds, selectUsersAsMapping],
2798
- (organizationUserIds, users) => organizationUserIds.reduce((accum, userId) => ({ ...accum, [userId]: users[userId] }), {})
2799
- );
2800
- const selectSortedOrganizationUsers = toolkit.createSelector(
2801
- [selectCurrentUser, selectOrganizationUsersAsMapping, selectOrganizationAccessUserMapping],
2802
- (currentUser, userMapping, organizationAccessMapping) => {
2803
- return Object.values(userMapping).sort((userA, userB) => {
2804
- if (userA.id === currentUser.id) {
2805
- return -1;
2806
- } else if (userB.id === currentUser.id) {
2807
- return 1;
2808
- }
2809
- const organizationAccessesA = organizationAccessMapping[userA.id];
2810
- const organizationAccessesB = organizationAccessMapping[userB.id];
2811
- if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === (organizationAccessesB == null ? void 0 : organizationAccessesB.access_level)) {
2812
- return userA.username.localeCompare(userB.username);
2813
- }
2814
- if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === OrganizationAccessLevel.ADMIN) {
2815
- return -1;
2816
- }
2817
- return 1;
2818
- });
2819
- }
2820
- );
2821
- const selectOrganization = (id) => (state) => {
2822
- return state.organizationReducer.organizations[id];
2823
- };
2824
- const organizationReducer = organizationSlice.reducer;
2825
- const createOfflineAction = (request2, baseUrl) => {
2826
- const requestWithUuid = request2.uuid ? request2 : { ...request2, uuid: uuid.v4() };
2827
- return {
2828
- payload: requestWithUuid,
2829
- type: "",
2830
- meta: {
2831
- offline: {
2832
- effect: {
2833
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
2834
- request: requestWithUuid,
2835
- BASE_URL: baseUrl
2836
- }
2837
- }
2838
- }
2839
- };
2840
- };
2841
- const initialState$6 = {
2842
- deletedRequests: [],
2843
- latestRetryTime: 0
2844
- };
2845
- const outboxSlice = toolkit.createSlice({
2846
- name: "outbox",
2847
- initialState: initialState$6,
2848
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
2849
- reducers: {
2850
- // enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
2851
- // Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
2852
- // Then this reducer enqueueRequest() is responsible for adding the actual request data to the outbox
2853
- enqueueRequest: {
2854
- reducer: (state, _action) => {
2855
- return state;
2856
- },
2857
- prepare: (payload) => {
2858
- console.debug("Preparing to enqueue request", payload);
2859
- const { BASE_URL, ...rest } = payload;
2860
- return createOfflineAction(rest, BASE_URL);
2861
- }
2862
- },
2863
- markForDeletion(state, action) {
2864
- state.deletedRequests.push(action.payload);
2865
- },
2866
- markAsDeleted(state, action) {
2867
- const index2 = state.deletedRequests.indexOf(action.payload);
2868
- if (index2 !== -1)
2869
- state.deletedRequests.splice(index2, 1);
2870
- },
2871
- _setLatestRetryTime: (state, action) => {
2872
- state.latestRetryTime = action.payload;
2873
- }
2874
- }
2875
- });
2876
- const selectDeletedRequests = (state) => state.outboxReducer.deletedRequests;
2877
- const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
2878
- const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
2879
- const outboxReducer = outboxSlice.reducer;
2880
2766
  const initialState$5 = {
2881
2767
  projectFiles: {},
2882
2768
  activeProjectFileId: null,
@@ -3414,8 +3300,7 @@ var __publicField = (obj, key, value) => {
3414
3300
  userFormReducer,
3415
3301
  userReducer,
3416
3302
  workspaceReducer,
3417
- emailDomainsReducer,
3418
- licenseReducer
3303
+ emailDomainsReducer
3419
3304
  };
3420
3305
  const overmapReducer = toolkit.combineReducers(overmapReducers);
3421
3306
  const resetStore = "RESET";
@@ -3576,6 +3461,19 @@ var __publicField = (obj, key, value) => {
3576
3461
  return errorRes.body.error;
3577
3462
  if (typeof errorRes.body.message === "string")
3578
3463
  return errorRes.body.message;
3464
+ try {
3465
+ return Object.entries(errorRes.body).map(([key, value]) => {
3466
+ if (typeof value === "string") {
3467
+ return `${key}: ${value}`;
3468
+ }
3469
+ if (Array.isArray(value)) {
3470
+ return value.map((v) => `${key}: ${v}`).join("\n");
3471
+ }
3472
+ return `${key}: ${JSON.stringify(value)}`;
3473
+ }).join("\n");
3474
+ } catch (e) {
3475
+ console.error("Failed to extract error message from response body", e);
3476
+ }
3579
3477
  } else if (typeof errorRes.body === "string")
3580
3478
  return errorRes.body;
3581
3479
  } else if (errorRes == null ? void 0 : errorRes.text) {
@@ -4116,7 +4014,7 @@ var __publicField = (obj, key, value) => {
4116
4014
  * @returns {Promise<TokenPair>} The new access and refresh tokens
4117
4015
  */
4118
4016
  __publicField(this, "_getRenewedTokens", async (refreshToken) => {
4119
- const response = await this.enqueueRequest({
4017
+ const promise = this.enqueueRequest({
4120
4018
  description: "Get renewed tokens",
4121
4019
  method: HttpMethod.POST,
4122
4020
  url: "/api/token/refresh/",
@@ -4129,6 +4027,14 @@ var __publicField = (obj, key, value) => {
4129
4027
  // Don't wait for other requests to finish, or we might end up in a deadlock.
4130
4028
  immediate: true
4131
4029
  });
4030
+ let response = void 0;
4031
+ try {
4032
+ response = await promise;
4033
+ } catch (e) {
4034
+ await this.logout();
4035
+ }
4036
+ if (!response)
4037
+ throw new Error("No response");
4132
4038
  if (!response.access)
4133
4039
  throw new Error("Missing access token");
4134
4040
  if (!response.refresh)
@@ -4848,7 +4754,6 @@ var __publicField = (obj, key, value) => {
4848
4754
  });
4849
4755
  store.dispatch(addIssue(issuePayload));
4850
4756
  store.dispatch(addToRecentIssues(issuePayload.offline_id));
4851
- store.dispatch(updateActiveProjectIssuesCount(1));
4852
4757
  const promise = this.enqueueRequest({
4853
4758
  description: "Create issue",
4854
4759
  method: HttpMethod.POST,
@@ -4875,7 +4780,6 @@ var __publicField = (obj, key, value) => {
4875
4780
  });
4876
4781
  }
4877
4782
  store.dispatch(removeIssue(issuePayload.offline_id));
4878
- store.dispatch(updateActiveProjectIssuesCount(-1));
4879
4783
  throw error2;
4880
4784
  });
4881
4785
  return [issuePayload, promise];
@@ -4914,8 +4818,7 @@ var __publicField = (obj, key, value) => {
4914
4818
  return [fullIssue, promise];
4915
4819
  }
4916
4820
  async remove(id) {
4917
- const { store } = this.client;
4918
- const state = store.getState();
4821
+ const state = this.client.store.getState();
4919
4822
  const backup = state.issueReducer.issues[id];
4920
4823
  if (!backup) {
4921
4824
  throw new Error(`No issue with id ${id} found in the store`);
@@ -4923,7 +4826,6 @@ var __publicField = (obj, key, value) => {
4923
4826
  const attachments = Object.values(state.issueReducer.attachments).filter((a) => a.issue_id === id);
4924
4827
  const attachmentsOfIssue = selectPhotoAttachmentsOfIssue(id)(state);
4925
4828
  this.client.store.dispatch(removeIssue(id));
4926
- store.dispatch(updateActiveProjectIssuesCount(-1));
4927
4829
  if (attachmentsOfIssue) {
4928
4830
  this.client.store.dispatch(removeAttachmentsOfIssue(id));
4929
4831
  }
@@ -4938,7 +4840,6 @@ var __publicField = (obj, key, value) => {
4938
4840
  } catch (e) {
4939
4841
  this.client.store.dispatch(addIssue(backup));
4940
4842
  this.client.store.dispatch(addAttachments(attachments));
4941
- store.dispatch(updateActiveProjectIssuesCount(1));
4942
4843
  throw e;
4943
4844
  }
4944
4845
  }
@@ -5014,9 +4915,7 @@ var __publicField = (obj, key, value) => {
5014
4915
  owner_organization: projectData.organization_owner,
5015
4916
  owner_user: projectData.user_owner,
5016
4917
  bounds: projectData.bounds,
5017
- invited: projectData.invited || false,
5018
- issues_count: projectData.issues_count,
5019
- form_submissions_count: projectData.form_submissions_count
4918
+ invited: projectData.invited || false
5020
4919
  });
5021
4920
  if (currentProjectId === projectData.id && !projectData.invited) {
5022
4921
  isProjectIdValid = true;
@@ -5034,7 +4933,6 @@ var __publicField = (obj, key, value) => {
5034
4933
  }
5035
4934
  store.dispatch(setCurrentUser(data.user));
5036
4935
  store.dispatch(addUsers(data.project_owners));
5037
- store.dispatch(setLicenses(data.licenses));
5038
4936
  const organizationsData = data.organizations;
5039
4937
  store.dispatch(setOrganizations(organizationsData));
5040
4938
  const validProjects = projects.filter((project) => !project.invited);
@@ -5347,7 +5245,6 @@ var __publicField = (obj, key, value) => {
5347
5245
  if (!project) {
5348
5246
  throw new Error("Expected project to exist");
5349
5247
  }
5350
- const license = selectLicenseForProject(project.id);
5351
5248
  const activeProjectId = state.projectReducer.activeProjectId;
5352
5249
  if (activeProjectId === projectId) {
5353
5250
  store.dispatch({ type: "project/setActiveProjectId", payload: null });
@@ -5358,9 +5255,6 @@ var __publicField = (obj, key, value) => {
5358
5255
  store.dispatch(removeProjectAccessesOfProject(project.id));
5359
5256
  store.dispatch({ type: "rehydrated/setRehydrated", payload: false });
5360
5257
  store.dispatch(deleteProject(project));
5361
- if (license) {
5362
- store.dispatch(updateLicense({ ...license, project: null }));
5363
- }
5364
5258
  try {
5365
5259
  await this.enqueueRequest({
5366
5260
  description: "Delete project",
@@ -5376,9 +5270,6 @@ var __publicField = (obj, key, value) => {
5376
5270
  store.dispatch(addOrReplaceProjectFiles(filesToDelete));
5377
5271
  store.dispatch(setActiveProjectId(activeProjectId));
5378
5272
  store.dispatch({ type: "rehydrated/setRehydrated", payload: true });
5379
- if (license) {
5380
- store.dispatch(updateLicense({ ...license, project: project.id }));
5381
- }
5382
5273
  throw e;
5383
5274
  }
5384
5275
  }
@@ -5684,11 +5575,9 @@ var __publicField = (obj, key, value) => {
5684
5575
  store.dispatch(addUserFormSubmission(offlineResultWithoutFiles));
5685
5576
  void promise.then((result) => {
5686
5577
  store.dispatch(addUserFormSubmission(result));
5687
- store.dispatch(updateActiveProjectFormSubmissionsCount(1));
5688
5578
  return result;
5689
5579
  }).catch(() => {
5690
5580
  store.dispatch(deleteUserFormSubmission(payload.offline_id));
5691
- store.dispatch(updateActiveProjectFormSubmissionsCount(-1));
5692
5581
  });
5693
5582
  const settledPromise = Promise.all([promise, ...attachFilesPromises]).then(() => promise);
5694
5583
  return [fullOfflineResult, settledPromise];
@@ -5698,7 +5587,6 @@ var __publicField = (obj, key, value) => {
5698
5587
  const state = store.getState();
5699
5588
  const submission = state.userFormReducer.submissions[submissionId];
5700
5589
  store.dispatch(deleteUserFormSubmission(submissionId));
5701
- store.dispatch(updateActiveProjectFormSubmissionsCount(-1));
5702
5590
  try {
5703
5591
  return await this.enqueueRequest({
5704
5592
  description: "Delete user form submissions",
@@ -5710,7 +5598,6 @@ var __publicField = (obj, key, value) => {
5710
5598
  } catch (e) {
5711
5599
  if (submission) {
5712
5600
  store.dispatch(addUserFormSubmission(submission));
5713
- store.dispatch(updateActiveProjectFormSubmissionsCount(1));
5714
5601
  }
5715
5602
  throw e;
5716
5603
  }
@@ -6123,12 +6010,10 @@ var __publicField = (obj, key, value) => {
6123
6010
  const organizationAccesses = data.organization_accesses;
6124
6011
  const emailDomains = data.email_domains;
6125
6012
  const users = data.users;
6126
- const licenses = data.licenses;
6127
6013
  store.dispatch(addUsers(users));
6128
6014
  store.dispatch(setActiveOrganizationId(activeOrganization.id));
6129
6015
  store.dispatch(setOrganizationAccesses(organizationAccesses));
6130
6016
  store.dispatch(setEmailDomains(emailDomains));
6131
- store.dispatch(addLicenses(licenses));
6132
6017
  if (showLoading) {
6133
6018
  store.dispatch(setIsFetchingInitialData(false));
6134
6019
  }
@@ -6169,89 +6054,6 @@ var __publicField = (obj, key, value) => {
6169
6054
  });
6170
6055
  }
6171
6056
  }
6172
- class LicenseService extends BaseApiService {
6173
- async pauseLicense(license) {
6174
- this.client.store.dispatch(setIsFetchingInitialData(true));
6175
- return this.enqueueRequest({
6176
- description: "Pause license",
6177
- method: HttpMethod.DELETE,
6178
- url: `/billing/${license.offline_id}/suspend/`,
6179
- isAuthNeeded: true,
6180
- blockers: [
6181
- license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
6182
- ],
6183
- blocks: []
6184
- }).then((result) => {
6185
- this.client.store.dispatch(updateLicense(result));
6186
- this.client.store.dispatch(setIsFetchingInitialData(false));
6187
- return result;
6188
- });
6189
- }
6190
- async resumeLicense(license) {
6191
- this.client.store.dispatch(setIsFetchingInitialData(true));
6192
- return this.enqueueRequest({
6193
- description: "Resume license",
6194
- method: HttpMethod.PATCH,
6195
- url: `/billing/${license.offline_id}/suspend/`,
6196
- isAuthNeeded: true,
6197
- blockers: [
6198
- license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
6199
- ],
6200
- blocks: []
6201
- }).then((result) => {
6202
- this.client.store.dispatch(updateLicense(result));
6203
- return result;
6204
- });
6205
- }
6206
- async cancelLicense(license) {
6207
- this.client.store.dispatch(setIsFetchingInitialData(true));
6208
- return this.enqueueRequest({
6209
- description: "Cancel license",
6210
- method: HttpMethod.DELETE,
6211
- url: `/billing/${license.offline_id}/`,
6212
- isAuthNeeded: true,
6213
- blockers: [
6214
- license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
6215
- ],
6216
- blocks: []
6217
- }).then((result) => {
6218
- this.client.store.dispatch(updateLicense(result));
6219
- return result;
6220
- });
6221
- }
6222
- async attachLicenseToProject(license, project) {
6223
- return this.enqueueRequest({
6224
- description: "Attach license",
6225
- method: HttpMethod.PATCH,
6226
- url: `/billing/${license.offline_id}/project/`,
6227
- isAuthNeeded: true,
6228
- payload: { project: project.id },
6229
- blockers: [
6230
- license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : "",
6231
- project.id ? project.id.toString() : ""
6232
- ],
6233
- blocks: []
6234
- }).then((result) => {
6235
- this.client.store.dispatch(updateLicense(result));
6236
- return result;
6237
- });
6238
- }
6239
- async detachLicenseFromProject(license) {
6240
- return this.enqueueRequest({
6241
- description: "Detach license",
6242
- method: HttpMethod.DELETE,
6243
- url: `/billing/${license.offline_id}/project/`,
6244
- isAuthNeeded: true,
6245
- blockers: [
6246
- license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
6247
- ],
6248
- blocks: []
6249
- }).then((result) => {
6250
- this.client.store.dispatch(updateLicense(result));
6251
- return result;
6252
- });
6253
- }
6254
- }
6255
6057
  class OvermapSDK {
6256
6058
  constructor(apiUrl, store) {
6257
6059
  __publicField(this, "API_URL");
@@ -6277,7 +6079,6 @@ var __publicField = (obj, key, value) => {
6277
6079
  __publicField(this, "projectFiles", new ProjectFileService(this));
6278
6080
  __publicField(this, "emailVerification", new EmailVerificationService(this));
6279
6081
  __publicField(this, "emailDomains", new EmailDomainsService(this));
6280
- __publicField(this, "licenses", new LicenseService(this));
6281
6082
  this.API_URL = apiUrl;
6282
6083
  this.store = store;
6283
6084
  }
@@ -10424,9 +10225,9 @@ var __publicField = (obj, key, value) => {
10424
10225
  PatchField.displayName = "PatchField";
10425
10226
  const PatchFormProvider = React.memo(
10426
10227
  React.forwardRef((props, ref) => {
10427
- const { children, schema, values, onPatch, onError, ...rest } = props;
10228
+ const { children, schema, values, onPatch, onError, requiresDiff = true, onDirtyChange, ...rest } = props;
10428
10229
  const initialValues2 = React.useMemo(() => initialFormValues(schema.fields, values), [schema.fields, values]);
10429
- const handlePatch = React.useCallback(
10230
+ const getDiff = React.useCallback(
10430
10231
  (values2) => {
10431
10232
  const diff = {};
10432
10233
  for (const key in values2) {
@@ -10435,11 +10236,18 @@ var __publicField = (obj, key, value) => {
10435
10236
  diff[key] = value;
10436
10237
  }
10437
10238
  }
10438
- if (!hasKeys(diff))
10239
+ return diff;
10240
+ },
10241
+ [initialValues2]
10242
+ );
10243
+ const handlePatch = React.useCallback(
10244
+ (values2) => {
10245
+ const diff = getDiff(values2);
10246
+ if (requiresDiff && !hasKeys(diff))
10439
10247
  return;
10440
10248
  onPatch(diff);
10441
10249
  },
10442
- [initialValues2, onPatch]
10250
+ [getDiff, onPatch, requiresDiff]
10443
10251
  );
10444
10252
  const validate = React.useCallback(
10445
10253
  (form) => {
@@ -10447,9 +10255,13 @@ var __publicField = (obj, key, value) => {
10447
10255
  if (error2) {
10448
10256
  onError(error2);
10449
10257
  }
10258
+ if (onDirtyChange) {
10259
+ const diff = getDiff(form);
10260
+ onDirtyChange(hasKeys(diff));
10261
+ }
10450
10262
  return error2;
10451
10263
  },
10452
- [schema, onError]
10264
+ [schema, onDirtyChange, onError, getDiff]
10453
10265
  );
10454
10266
  const formik$1 = formik.useFormik({
10455
10267
  initialValues: initialValues2,
@@ -10459,13 +10271,21 @@ var __publicField = (obj, key, value) => {
10459
10271
  validateOnBlur: false,
10460
10272
  validateOnChange: false
10461
10273
  });
10274
+ const handleChange = React.useCallback(() => {
10275
+ if (onDirtyChange) {
10276
+ const diff = getDiff(formik$1.values);
10277
+ if (hasKeys(diff)) {
10278
+ onDirtyChange(true);
10279
+ }
10280
+ }
10281
+ }, [formik$1.values, getDiff, onDirtyChange]);
10462
10282
  const { errors, resetForm } = formik$1;
10463
10283
  React.useEffect(() => {
10464
10284
  if (hasKeys(errors)) {
10465
10285
  resetForm({ values: initialValues2, errors: {} });
10466
10286
  }
10467
10287
  }, [errors, initialValues2, resetForm]);
10468
- return /* @__PURE__ */ jsxRuntime.jsx(formik.FormikProvider, { value: formik$1, children: /* @__PURE__ */ jsxRuntime.jsx("form", { ...rest, ref, onSubmit: formik$1.handleSubmit, children }) });
10288
+ return /* @__PURE__ */ jsxRuntime.jsx(formik.FormikProvider, { value: formik$1, children: /* @__PURE__ */ jsxRuntime.jsx("form", { ...rest, ref, onSubmit: formik$1.handleSubmit, onChange: handleChange, children }) });
10469
10289
  })
10470
10290
  );
10471
10291
  const typeBadge$1 = "_typeBadge_an5ff_1";
@@ -11465,9 +11285,6 @@ var __publicField = (obj, key, value) => {
11465
11285
  exports2.IssuePriority = IssuePriority;
11466
11286
  exports2.IssueService = IssueService;
11467
11287
  exports2.IssueStatus = IssueStatus;
11468
- exports2.LicenseLevel = LicenseLevel;
11469
- exports2.LicenseService = LicenseService;
11470
- exports2.LicenseStatus = LicenseStatus;
11471
11288
  exports2.MainService = MainService;
11472
11289
  exports2.MapStyle = MapStyle;
11473
11290
  exports2.MultiSelectField = MultiSelectField;
@@ -11515,7 +11332,6 @@ var __publicField = (obj, key, value) => {
11515
11332
  exports2.addEmailDomain = addEmailDomain;
11516
11333
  exports2.addFavouriteProjectId = addFavouriteProjectId;
11517
11334
  exports2.addIssue = addIssue;
11518
- exports2.addLicenses = addLicenses;
11519
11335
  exports2.addOrReplaceCategories = addOrReplaceCategories;
11520
11336
  exports2.addOrReplaceIssueComment = addOrReplaceIssueComment;
11521
11337
  exports2.addOrReplaceProjectFile = addOrReplaceProjectFile;
@@ -11614,8 +11430,6 @@ var __publicField = (obj, key, value) => {
11614
11430
  exports2.issueReducer = issueReducer;
11615
11431
  exports2.issueSlice = issueSlice;
11616
11432
  exports2.issueToSearchResult = issueToSearchResult;
11617
- exports2.licenseReducer = licenseReducer;
11618
- exports2.licenseSlice = licenseSlice;
11619
11433
  exports2.literalToCoordinates = literalToCoordinates;
11620
11434
  exports2.logOnlyOnce = logOnlyOnce;
11621
11435
  exports2.makeClient = makeClient;
@@ -11682,17 +11496,13 @@ var __publicField = (obj, key, value) => {
11682
11496
  exports2.searchIssues = searchIssues;
11683
11497
  exports2.selectAccessToken = selectAccessToken;
11684
11498
  exports2.selectActiveIssueId = selectActiveIssueId;
11685
- exports2.selectActiveLicense = selectActiveLicense;
11686
11499
  exports2.selectActiveOrganization = selectActiveOrganization;
11687
11500
  exports2.selectActiveOrganizationAccess = selectActiveOrganizationAccess;
11688
11501
  exports2.selectActiveOrganizationId = selectActiveOrganizationId;
11689
- exports2.selectActiveOrganizationLicenses = selectActiveOrganizationLicenses;
11690
- exports2.selectActiveOrganizationProjects = selectActiveOrganizationProjects;
11691
11502
  exports2.selectActiveProject = selectActiveProject;
11692
11503
  exports2.selectActiveProjectAccess = selectActiveProjectAccess;
11693
11504
  exports2.selectActiveProjectFileId = selectActiveProjectFileId;
11694
11505
  exports2.selectActiveProjectId = selectActiveProjectId;
11695
- exports2.selectActiveStatusLicenses = selectActiveStatusLicenses;
11696
11506
  exports2.selectActiveWorkspace = selectActiveWorkspace;
11697
11507
  exports2.selectActiveWorkspaceId = selectActiveWorkspaceId;
11698
11508
  exports2.selectAllAttachments = selectAllAttachments;
@@ -11746,10 +11556,6 @@ var __publicField = (obj, key, value) => {
11746
11556
  exports2.selectLatestFormRevision = selectLatestFormRevision;
11747
11557
  exports2.selectLatestRetryTime = selectLatestRetryTime;
11748
11558
  exports2.selectLatestRevisionByFormId = selectLatestRevisionByFormId;
11749
- exports2.selectLicencesMapping = selectLicencesMapping;
11750
- exports2.selectLicense = selectLicense;
11751
- exports2.selectLicenseForProject = selectLicenseForProject;
11752
- exports2.selectLicenses = selectLicenses;
11753
11559
  exports2.selectMainWorkspace = selectMainWorkspace;
11754
11560
  exports2.selectMapStyle = selectMapStyle;
11755
11561
  exports2.selectNumberOfComponentTypesMatchingCaseInsensitiveName = selectNumberOfComponentTypesMatchingCaseInsensitiveName;
@@ -11763,7 +11569,6 @@ var __publicField = (obj, key, value) => {
11763
11569
  exports2.selectOrganizationUsersAsMapping = selectOrganizationUsersAsMapping;
11764
11570
  exports2.selectOrganizationUsersIds = selectOrganizationUsersIds;
11765
11571
  exports2.selectOrganizations = selectOrganizations;
11766
- exports2.selectOrganizationsMapping = selectOrganizationsMapping;
11767
11572
  exports2.selectOrganizationsWithAccess = selectOrganizationsWithAccess;
11768
11573
  exports2.selectPermittedWorkspaceIds = selectPermittedWorkspaceIds;
11769
11574
  exports2.selectPhotoAttachmentsOfIssue = selectPhotoAttachmentsOfIssue;
@@ -11784,7 +11589,6 @@ var __publicField = (obj, key, value) => {
11784
11589
  exports2.selectRevisionsForForm = selectRevisionsForForm;
11785
11590
  exports2.selectShowTooltips = selectShowTooltips;
11786
11591
  exports2.selectSortedEmailDomains = selectSortedEmailDomains;
11787
- exports2.selectSortedOrganizationLicenses = selectSortedOrganizationLicenses;
11788
11592
  exports2.selectSortedOrganizationUsers = selectSortedOrganizationUsers;
11789
11593
  exports2.selectSortedProjectUsers = selectSortedProjectUsers;
11790
11594
  exports2.selectSortedProjects = selectSortedProjects;
@@ -11829,7 +11633,6 @@ var __publicField = (obj, key, value) => {
11829
11633
  exports2.setIsImportingProjectFile = setIsImportingProjectFile;
11830
11634
  exports2.setIssueComments = setIssueComments;
11831
11635
  exports2.setIssues = setIssues;
11832
- exports2.setLicenses = setLicenses;
11833
11636
  exports2.setLoggedIn = setLoggedIn;
11834
11637
  exports2.setMapStyle = setMapStyle;
11835
11638
  exports2.setOrganizationAccesses = setOrganizationAccesses;
@@ -11864,12 +11667,9 @@ var __publicField = (obj, key, value) => {
11864
11667
  exports2.unhideAllCategories = unhideAllCategories;
11865
11668
  exports2.unhideCategory = unhideCategory;
11866
11669
  exports2.updateActiveOrganization = updateActiveOrganization;
11867
- exports2.updateActiveProjectFormSubmissionsCount = updateActiveProjectFormSubmissionsCount;
11868
- exports2.updateActiveProjectIssuesCount = updateActiveProjectIssuesCount;
11869
11670
  exports2.updateAttachment = updateAttachment;
11870
11671
  exports2.updateComponent = updateComponent;
11871
11672
  exports2.updateIssue = updateIssue;
11872
- exports2.updateLicense = updateLicense;
11873
11673
  exports2.updateOrCreateProject = updateOrCreateProject;
11874
11674
  exports2.updateOrganizationAccess = updateOrganizationAccess;
11875
11675
  exports2.updateProjectAccess = updateProjectAccess;