@overmap-ai/core 1.0.58-form-improvements.2 → 1.0.58-map-images.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -734,15 +734,15 @@ var __publicField = (obj, key, value) => {
734
734
  };
735
735
  const migrations = [initialVersioning, signOut, signOut, createOutboxState];
736
736
  const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
737
- const initialState$s = {
737
+ const initialState$t = {
738
738
  accessToken: "",
739
739
  refreshToken: "",
740
740
  isLoggedIn: false
741
741
  };
742
742
  const authSlice = toolkit.createSlice({
743
743
  name: "auth",
744
- initialState: initialState$s,
745
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$s)),
744
+ initialState: initialState$t,
745
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$t)),
746
746
  reducers: {
747
747
  setTokens: (state, action) => {
748
748
  state.accessToken = action.payload.accessToken;
@@ -1386,7 +1386,7 @@ var __publicField = (obj, key, value) => {
1386
1386
  return getLocalDateString(date);
1387
1387
  return relative.format(days, "days");
1388
1388
  });
1389
- const initialState$r = {
1389
+ const initialState$s = {
1390
1390
  categories: {},
1391
1391
  usedCategoryColors: [],
1392
1392
  categoryVisibility: {
@@ -1396,8 +1396,8 @@ var __publicField = (obj, key, value) => {
1396
1396
  };
1397
1397
  const categorySlice = toolkit.createSlice({
1398
1398
  name: "categories",
1399
- initialState: initialState$r,
1400
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$r)),
1399
+ initialState: initialState$s,
1400
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$s)),
1401
1401
  reducers: {
1402
1402
  setCategories: (state, action) => {
1403
1403
  if (!Array.isArray(action.payload))
@@ -1581,15 +1581,15 @@ var __publicField = (obj, key, value) => {
1581
1581
  delete state.attachments[attachmentId];
1582
1582
  }
1583
1583
  }
1584
- const initialState$q = {
1584
+ const initialState$r = {
1585
1585
  assetTypes: {},
1586
1586
  hiddenAssetTypeIds: {},
1587
1587
  attachments: {}
1588
1588
  };
1589
1589
  const assetTypeSlice = toolkit.createSlice({
1590
1590
  name: "assetTypes",
1591
- initialState: initialState$q,
1592
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
1591
+ initialState: initialState$r,
1592
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$r)),
1593
1593
  reducers: {
1594
1594
  addAssetType: (state, action) => {
1595
1595
  state.assetTypes[action.payload.offline_id] = action.payload;
@@ -1699,14 +1699,14 @@ var __publicField = (obj, key, value) => {
1699
1699
  )
1700
1700
  );
1701
1701
  const assetTypeReducer = assetTypeSlice.reducer;
1702
- const initialState$p = {
1702
+ const initialState$q = {
1703
1703
  assets: {},
1704
1704
  attachments: {}
1705
1705
  };
1706
1706
  const assetSlice = toolkit.createSlice({
1707
1707
  name: "assets",
1708
- initialState: initialState$p,
1709
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
1708
+ initialState: initialState$q,
1709
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
1710
1710
  reducers: {
1711
1711
  addAsset: (state, action) => {
1712
1712
  state.assets[action.payload.offline_id] = action.payload;
@@ -1879,13 +1879,13 @@ var __publicField = (obj, key, value) => {
1879
1879
  )
1880
1880
  );
1881
1881
  const assetReducer = assetSlice.reducer;
1882
- const initialState$o = {
1882
+ const initialState$p = {
1883
1883
  completionsByAssetId: {}
1884
1884
  };
1885
1885
  const assetStageCompletionSlice = toolkit.createSlice({
1886
1886
  name: "assetStageCompletions",
1887
- initialState: initialState$o,
1888
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
1887
+ initialState: initialState$p,
1888
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
1889
1889
  reducers: {
1890
1890
  addStageCompletion: (state, action) => {
1891
1891
  let stageToCompletionDateMapping = state.completionsByAssetId[action.payload.asset];
@@ -1934,13 +1934,13 @@ var __publicField = (obj, key, value) => {
1934
1934
  return Object.keys(state.assetStageCompletionReducer.completionsByAssetId[asset.offline_id] ?? {});
1935
1935
  };
1936
1936
  const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
1937
- const initialState$n = {
1937
+ const initialState$o = {
1938
1938
  stages: {}
1939
1939
  };
1940
1940
  const assetStageSlice = toolkit.createSlice({
1941
1941
  name: "assetStages",
1942
- initialState: initialState$n,
1943
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
1942
+ initialState: initialState$o,
1943
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
1944
1944
  reducers: {
1945
1945
  addStages: (state, action) => {
1946
1946
  Object.assign(state.stages, toOfflineIdRecord(action.payload));
@@ -2038,13 +2038,13 @@ var __publicField = (obj, key, value) => {
2038
2038
  );
2039
2039
  const { addStages, updateStages, removeStages, linkStageToForm, unlinkStageToForm } = assetStageSlice.actions;
2040
2040
  const assetStageReducer = assetStageSlice.reducer;
2041
- const initialState$m = {
2041
+ const initialState$n = {
2042
2042
  workspaces: {},
2043
2043
  activeWorkspaceId: null
2044
2044
  };
2045
2045
  const workspaceSlice = toolkit.createSlice({
2046
2046
  name: "workspace",
2047
- initialState: initialState$m,
2047
+ initialState: initialState$n,
2048
2048
  // The `reducers` field lets us define reducers and generate associated actions
2049
2049
  reducers: {
2050
2050
  setWorkspaces: (state, action) => {
@@ -2101,7 +2101,7 @@ var __publicField = (obj, key, value) => {
2101
2101
  );
2102
2102
  const workspaceReducer = workspaceSlice.reducer;
2103
2103
  const maxRecentIssues = 10;
2104
- const initialState$l = {
2104
+ const initialState$m = {
2105
2105
  issues: {},
2106
2106
  attachments: {},
2107
2107
  comments: {},
@@ -2113,9 +2113,9 @@ var __publicField = (obj, key, value) => {
2113
2113
  };
2114
2114
  const issueSlice = toolkit.createSlice({
2115
2115
  name: "issues",
2116
- initialState: initialState$l,
2116
+ initialState: initialState$m,
2117
2117
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
2118
- Object.assign(state, initialState$l);
2118
+ Object.assign(state, initialState$m);
2119
2119
  }),
2120
2120
  reducers: {
2121
2121
  setIssues: (state, action) => {
@@ -2548,14 +2548,14 @@ var __publicField = (obj, key, value) => {
2548
2548
  }
2549
2549
  );
2550
2550
  const issueReducer = issueSlice.reducer;
2551
- const initialState$k = {
2551
+ const initialState$l = {
2552
2552
  issueTypes: {}
2553
2553
  };
2554
2554
  const issueTypeSlice = toolkit.createSlice({
2555
2555
  name: "issueTypes",
2556
- initialState: initialState$k,
2556
+ initialState: initialState$l,
2557
2557
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
2558
- Object.assign(state, initialState$k);
2558
+ Object.assign(state, initialState$l);
2559
2559
  }),
2560
2560
  reducers: {
2561
2561
  setIssueTypes: (state, action) => {
@@ -2622,15 +2622,15 @@ var __publicField = (obj, key, value) => {
2622
2622
  return ((_a2 = selectIssuesOfIssueType(issueTypeId)(state)) == null ? void 0 : _a2.length) ?? 0;
2623
2623
  };
2624
2624
  const issueTypeReducer = issueTypeSlice.reducer;
2625
- const initialState$j = {
2625
+ const initialState$k = {
2626
2626
  s3Urls: {}
2627
2627
  };
2628
2628
  const msPerHour = 1e3 * 60 * 60;
2629
2629
  const msPerWeek = msPerHour * 24 * 7;
2630
2630
  const fileSlice = toolkit.createSlice({
2631
2631
  name: "file",
2632
- initialState: initialState$j,
2633
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
2632
+ initialState: initialState$k,
2633
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
2634
2634
  reducers: {
2635
2635
  setUploadUrl: (state, action) => {
2636
2636
  const { url, fields, sha1 } = action.payload;
@@ -2657,7 +2657,7 @@ var __publicField = (obj, key, value) => {
2657
2657
  return url;
2658
2658
  };
2659
2659
  const fileReducer = fileSlice.reducer;
2660
- const initialState$i = {
2660
+ const initialState$j = {
2661
2661
  // TODO: Change first MapStyle.SATELLITE to MaptStyle.None when project creation map is fixed
2662
2662
  mapStyle: MapStyle.SATELLITE,
2663
2663
  showTooltips: false,
@@ -2665,8 +2665,8 @@ var __publicField = (obj, key, value) => {
2665
2665
  };
2666
2666
  const mapSlice = toolkit.createSlice({
2667
2667
  name: "map",
2668
- initialState: initialState$i,
2669
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
2668
+ initialState: initialState$j,
2669
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
2670
2670
  reducers: {
2671
2671
  setMapStyle: (state, action) => {
2672
2672
  state.mapStyle = action.payload;
@@ -2743,7 +2743,7 @@ var __publicField = (obj, key, value) => {
2743
2743
  LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
2744
2744
  return LicenseStatus2;
2745
2745
  })(LicenseStatus || {});
2746
- const initialState$h = {
2746
+ const initialState$i = {
2747
2747
  users: {},
2748
2748
  currentUser: {
2749
2749
  id: 0,
@@ -2754,8 +2754,8 @@ var __publicField = (obj, key, value) => {
2754
2754
  };
2755
2755
  const userSlice = toolkit.createSlice({
2756
2756
  name: "users",
2757
- initialState: initialState$h,
2758
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
2757
+ initialState: initialState$i,
2758
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
2759
2759
  reducers: {
2760
2760
  setUsers: (state, action) => {
2761
2761
  const usersMapping = {};
@@ -2817,13 +2817,13 @@ var __publicField = (obj, key, value) => {
2817
2817
  const selectUsersAsMapping = (state) => state.userReducer.users;
2818
2818
  const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
2819
2819
  const userReducer = userSlice.reducer;
2820
- const initialState$g = {
2820
+ const initialState$h = {
2821
2821
  organizationAccesses: {}
2822
2822
  };
2823
2823
  const organizationAccessSlice = toolkit.createSlice({
2824
2824
  name: "organizationAccess",
2825
- initialState: initialState$g,
2826
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
2825
+ initialState: initialState$h,
2826
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
2827
2827
  reducers: {
2828
2828
  setOrganizationAccesses: (state, action) => {
2829
2829
  if (!Array.isArray(action.payload))
@@ -2886,13 +2886,13 @@ var __publicField = (obj, key, value) => {
2886
2886
  return organizationAccesses;
2887
2887
  };
2888
2888
  const organizationAccessReducer = organizationAccessSlice.reducer;
2889
- const initialState$f = {
2889
+ const initialState$g = {
2890
2890
  licenses: {}
2891
2891
  };
2892
2892
  const licenseSlice = toolkit.createSlice({
2893
2893
  name: "license",
2894
- initialState: initialState$f,
2895
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
2894
+ initialState: initialState$g,
2895
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
2896
2896
  reducers: {
2897
2897
  setLicenses: (state, action) => {
2898
2898
  if (!Array.isArray(action.payload))
@@ -2937,13 +2937,13 @@ var __publicField = (obj, key, value) => {
2937
2937
  (licenses) => Object.values(licenses).filter((license) => license.project).reduce((accum, license) => ({ ...accum, [license.project]: license }), {})
2938
2938
  );
2939
2939
  const licenseReducer = licenseSlice.reducer;
2940
- const initialState$e = {
2940
+ const initialState$f = {
2941
2941
  projectAccesses: {}
2942
2942
  };
2943
2943
  const projectAccessSlice = toolkit.createSlice({
2944
2944
  name: "projectAccess",
2945
- initialState: initialState$e,
2946
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
2945
+ initialState: initialState$f,
2946
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
2947
2947
  reducers: {
2948
2948
  setProjectAccesses: (state, action) => {
2949
2949
  if (!Array.isArray(action.payload))
@@ -3011,7 +3011,7 @@ var __publicField = (obj, key, value) => {
3011
3011
  return projectAccesses;
3012
3012
  };
3013
3013
  const projectAccessReducer = projectAccessSlice.reducer;
3014
- const initialState$d = {
3014
+ const initialState$e = {
3015
3015
  projects: {},
3016
3016
  activeProjectId: null,
3017
3017
  recentProjectIds: [],
@@ -3021,7 +3021,7 @@ var __publicField = (obj, key, value) => {
3021
3021
  };
3022
3022
  const projectSlice = toolkit.createSlice({
3023
3023
  name: "projects",
3024
- initialState: initialState$d,
3024
+ initialState: initialState$e,
3025
3025
  reducers: {
3026
3026
  setProjects: (state, action) => {
3027
3027
  const projectsMap = {};
@@ -3215,14 +3215,14 @@ var __publicField = (obj, key, value) => {
3215
3215
  }
3216
3216
  )
3217
3217
  );
3218
- const initialState$c = {
3218
+ const initialState$d = {
3219
3219
  organizations: {},
3220
3220
  activeOrganizationId: null
3221
3221
  };
3222
3222
  const organizationSlice = toolkit.createSlice({
3223
3223
  name: "organizations",
3224
- initialState: initialState$c,
3225
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
3224
+ initialState: initialState$d,
3225
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
3226
3226
  reducers: {
3227
3227
  setOrganizations: (state, action) => {
3228
3228
  for (const org of action.payload) {
@@ -3341,14 +3341,14 @@ var __publicField = (obj, key, value) => {
3341
3341
  }
3342
3342
  };
3343
3343
  };
3344
- const initialState$b = {
3344
+ const initialState$c = {
3345
3345
  deletedRequests: [],
3346
3346
  latestRetryTime: 0
3347
3347
  };
3348
3348
  const outboxSlice = toolkit.createSlice({
3349
3349
  name: "outbox",
3350
- initialState: initialState$b,
3351
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
3350
+ initialState: initialState$c,
3351
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
3352
3352
  reducers: {
3353
3353
  // enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
3354
3354
  // Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
@@ -3380,7 +3380,7 @@ var __publicField = (obj, key, value) => {
3380
3380
  const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
3381
3381
  const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
3382
3382
  const outboxReducer = outboxSlice.reducer;
3383
- const initialState$a = {
3383
+ const initialState$b = {
3384
3384
  projectFiles: {},
3385
3385
  activeProjectFileId: null,
3386
3386
  isImportingProjectFile: false,
@@ -3388,8 +3388,8 @@ var __publicField = (obj, key, value) => {
3388
3388
  };
3389
3389
  const projectFileSlice = toolkit.createSlice({
3390
3390
  name: "projectFiles",
3391
- initialState: initialState$a,
3392
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
3391
+ initialState: initialState$b,
3392
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
3393
3393
  reducers: {
3394
3394
  addOrReplaceProjectFiles: (state, action) => {
3395
3395
  for (let fileObj of action.payload) {
@@ -3490,12 +3490,12 @@ var __publicField = (obj, key, value) => {
3490
3490
  const selectActiveProjectFileId = (state) => state.projectFileReducer.activeProjectFileId;
3491
3491
  const selectIsImportingProjectFile = (state) => state.projectFileReducer.isImportingProjectFile;
3492
3492
  const projectFileReducer = projectFileSlice.reducer;
3493
- const initialState$9 = {
3493
+ const initialState$a = {
3494
3494
  isRehydrated: false
3495
3495
  };
3496
3496
  const rehydratedSlice = toolkit.createSlice({
3497
3497
  name: "rehydrated",
3498
- initialState: initialState$9,
3498
+ initialState: initialState$a,
3499
3499
  // The `reducers` field lets us define reducers and generate associated actions
3500
3500
  reducers: {
3501
3501
  setRehydrated: (state, action) => {
@@ -3505,7 +3505,7 @@ var __publicField = (obj, key, value) => {
3505
3505
  });
3506
3506
  const selectRehydrated = (state) => state.rehydratedReducer.isRehydrated;
3507
3507
  const rehydratedReducer = rehydratedSlice.reducer;
3508
- const initialState$8 = {
3508
+ const initialState$9 = {
3509
3509
  useIssueTemplate: false,
3510
3510
  placementMode: false,
3511
3511
  enableClustering: false,
@@ -3523,8 +3523,8 @@ var __publicField = (obj, key, value) => {
3523
3523
  };
3524
3524
  const settingSlice = toolkit.createSlice({
3525
3525
  name: "settings",
3526
- initialState: initialState$8,
3527
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
3526
+ initialState: initialState$9,
3527
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$9)),
3528
3528
  reducers: {
3529
3529
  setEnableDuplicateIssues: (state, action) => {
3530
3530
  state.useIssueTemplate = action.payload;
@@ -3583,14 +3583,14 @@ var __publicField = (obj, key, value) => {
3583
3583
  return revisionA < revisionB ? -1 : 1;
3584
3584
  }
3585
3585
  };
3586
- const initialState$7 = {
3586
+ const initialState$8 = {
3587
3587
  formRevisions: {},
3588
3588
  attachments: {}
3589
3589
  };
3590
3590
  const formRevisionsSlice = toolkit.createSlice({
3591
3591
  name: "formRevisions",
3592
- initialState: initialState$7,
3593
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
3592
+ initialState: initialState$8,
3593
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
3594
3594
  reducers: {
3595
3595
  // revision related actions
3596
3596
  setFormRevision: (state, action) => {
@@ -3770,13 +3770,13 @@ var __publicField = (obj, key, value) => {
3770
3770
  )
3771
3771
  );
3772
3772
  const formRevisionReducer = formRevisionsSlice.reducer;
3773
- const initialState$6 = {
3773
+ const initialState$7 = {
3774
3774
  forms: {}
3775
3775
  };
3776
3776
  const formSlice = toolkit.createSlice({
3777
3777
  name: "forms",
3778
- initialState: initialState$6,
3779
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
3778
+ initialState: initialState$7,
3779
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
3780
3780
  reducers: {
3781
3781
  setForms: (state, action) => {
3782
3782
  state.forms = {};
@@ -3879,14 +3879,14 @@ var __publicField = (obj, key, value) => {
3879
3879
  return Object.values(userForms).filter((form) => !form.asset_type).length;
3880
3880
  });
3881
3881
  const formReducer = formSlice.reducer;
3882
- const initialState$5 = {
3882
+ const initialState$6 = {
3883
3883
  formSubmissions: {},
3884
3884
  attachments: {}
3885
3885
  };
3886
3886
  const formSubmissionSlice = toolkit.createSlice({
3887
3887
  name: "formSubmissions",
3888
- initialState: initialState$5,
3889
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
3888
+ initialState: initialState$6,
3889
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
3890
3890
  reducers: {
3891
3891
  setFormSubmission: (state, action) => {
3892
3892
  state.formSubmissions[action.payload.offline_id] = action.payload;
@@ -4141,12 +4141,12 @@ var __publicField = (obj, key, value) => {
4141
4141
  )
4142
4142
  );
4143
4143
  const formSubmissionReducer = formSubmissionSlice.reducer;
4144
- const initialState$4 = {
4144
+ const initialState$5 = {
4145
4145
  emailDomains: {}
4146
4146
  };
4147
4147
  const emailDomainsSlice = toolkit.createSlice({
4148
4148
  name: "emailDomains",
4149
- initialState: initialState$4,
4149
+ initialState: initialState$5,
4150
4150
  reducers: {
4151
4151
  setEmailDomains: (state, action) => {
4152
4152
  const emailDomains = {};
@@ -4173,15 +4173,15 @@ var __publicField = (obj, key, value) => {
4173
4173
  (ed1, ed2) => ed1.domain.localeCompare(ed2.domain)
4174
4174
  );
4175
4175
  const emailDomainsReducer = emailDomainsSlice.reducer;
4176
- const initialState$3 = {
4176
+ const initialState$4 = {
4177
4177
  documents: {},
4178
4178
  attachments: {}
4179
4179
  };
4180
4180
  const documentSlice = toolkit.createSlice({
4181
4181
  name: "documents",
4182
- initialState: initialState$3,
4182
+ initialState: initialState$4,
4183
4183
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
4184
- Object.assign(state, initialState$3);
4184
+ Object.assign(state, initialState$4);
4185
4185
  }),
4186
4186
  reducers: {
4187
4187
  setDocuments: (state, action) => {
@@ -4412,13 +4412,13 @@ var __publicField = (obj, key, value) => {
4412
4412
  )
4413
4413
  );
4414
4414
  const documentsReducer = documentSlice.reducer;
4415
- const initialState$2 = {
4415
+ const initialState$3 = {
4416
4416
  teams: {}
4417
4417
  };
4418
4418
  const teamSlice = toolkit.createSlice({
4419
4419
  name: "teams",
4420
- initialState: initialState$2,
4421
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$2)),
4420
+ initialState: initialState$3,
4421
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
4422
4422
  reducers: {
4423
4423
  setTeam: (state, action) => {
4424
4424
  state.teams[action.payload.offline_id] = action.payload;
@@ -4468,13 +4468,13 @@ var __publicField = (obj, key, value) => {
4468
4468
  })
4469
4469
  );
4470
4470
  const teamReducer = teamSlice.reducer;
4471
- const initialState$1 = {
4471
+ const initialState$2 = {
4472
4472
  conversations: {}
4473
4473
  };
4474
4474
  const agentsSlice = toolkit.createSlice({
4475
4475
  name: "agents",
4476
- initialState: initialState$1,
4477
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$1)),
4476
+ initialState: initialState$2,
4477
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$2)),
4478
4478
  reducers: {
4479
4479
  setConversations: (state, action) => {
4480
4480
  state.conversations = {};
@@ -4516,6 +4516,105 @@ var __publicField = (obj, key, value) => {
4516
4516
  )
4517
4517
  );
4518
4518
  const agentsReducer = agentsSlice.reducer;
4519
+ function createModelAdapter(computeModelId) {
4520
+ const addOne = (state, action) => {
4521
+ const id = computeModelId(action.payload);
4522
+ state.models[id] = action.payload;
4523
+ };
4524
+ const addMany = (state, action) => {
4525
+ for (const model of action.payload) {
4526
+ const id = computeModelId(model);
4527
+ state.models[id] = model;
4528
+ }
4529
+ };
4530
+ const setOne = (state, action) => {
4531
+ const id = computeModelId(action.payload);
4532
+ state.models[id] = action.payload;
4533
+ };
4534
+ const setMany = (state, action) => {
4535
+ for (const model of action.payload) {
4536
+ const id = computeModelId(model);
4537
+ state.models[id] = model;
4538
+ }
4539
+ };
4540
+ const updateOne = (state, action) => {
4541
+ const id = computeModelId(action.payload);
4542
+ state.models[id] = action.payload;
4543
+ };
4544
+ const updateMany = (state, action) => {
4545
+ for (const model of action.payload) {
4546
+ const id = computeModelId(model);
4547
+ state.models[id] = model;
4548
+ }
4549
+ };
4550
+ const deleteOne = (state, action) => {
4551
+ delete state.models[action.payload];
4552
+ };
4553
+ const deleteMany = (state, action) => {
4554
+ for (const id of action.payload) {
4555
+ delete state.models[id];
4556
+ }
4557
+ };
4558
+ const getInitialState = (state) => {
4559
+ return {
4560
+ ...state,
4561
+ models: {}
4562
+ };
4563
+ };
4564
+ return {
4565
+ addOne,
4566
+ addMany,
4567
+ setOne,
4568
+ setMany,
4569
+ updateOne,
4570
+ updateMany,
4571
+ deleteOne,
4572
+ deleteMany,
4573
+ getInitialState
4574
+ };
4575
+ }
4576
+ const initialState$1 = {
4577
+ models: {}
4578
+ };
4579
+ const mapImageAdapter = createModelAdapter((model) => model.offline_id);
4580
+ const mapImageSlice = toolkit.createSlice({
4581
+ name: "mapImages",
4582
+ initialState: initialState$1,
4583
+ extraReducers: (builder) => {
4584
+ builder.addCase("RESET", (state) => {
4585
+ Object.assign(state, initialState$1);
4586
+ });
4587
+ },
4588
+ reducers: {
4589
+ setMapImage: mapImageAdapter.setOne,
4590
+ setMapImages: mapImageAdapter.setMany,
4591
+ addMapImage: mapImageAdapter.addOne,
4592
+ addMapImages: mapImageAdapter.addMany,
4593
+ updateMapImage: mapImageAdapter.updateOne,
4594
+ updateMapImages: mapImageAdapter.updateMany,
4595
+ deleteMapImage: mapImageAdapter.deleteOne,
4596
+ deleteMapImages: mapImageAdapter.deleteMany
4597
+ }
4598
+ });
4599
+ const {
4600
+ setMapImage,
4601
+ setMapImages,
4602
+ addMapImage,
4603
+ addMapImages,
4604
+ updateMapImage,
4605
+ updateMapImages,
4606
+ deleteMapImage,
4607
+ deleteMapImages
4608
+ } = mapImageSlice.actions;
4609
+ const selectMapImageMapping = (state) => state.models;
4610
+ const selectMapImages = (state) => Object.values(state.models);
4611
+ const selectMapImageById = (id) => (state) => state.models[id];
4612
+ const selectMapImagesOfProject = restructureCreateSelectorWithArgs(
4613
+ toolkit.createSelector([selectMapImages, (_, projectId) => projectId], (mapImages, projectId) => {
4614
+ return mapImages.filter((mapImage) => mapImage.project === projectId);
4615
+ })
4616
+ );
4617
+ const mapImageReducer = mapImageSlice.reducer;
4519
4618
  const initialState = {
4520
4619
  version: 0
4521
4620
  };
@@ -4567,7 +4666,8 @@ var __publicField = (obj, key, value) => {
4567
4666
  licenseReducer,
4568
4667
  documentsReducer,
4569
4668
  teamReducer,
4570
- agentsReducer
4669
+ agentsReducer,
4670
+ mapImageReducer
4571
4671
  };
4572
4672
  const overmapReducer = toolkit.combineReducers(overmapReducers);
4573
4673
  const resetStore = "RESET";
@@ -5732,39 +5832,7 @@ var __publicField = (obj, key, value) => {
5732
5832
  store.dispatch(addStages(result));
5733
5833
  }
5734
5834
  }
5735
- const AttachmentModelMeta = {
5736
- [AttachmentModel.Issue]: {
5737
- name: "issue",
5738
- attachUrlPrefix: "/issues",
5739
- deleteUrlPrefix: "/issues",
5740
- fetchUrlPostfix: "/issue-attachments"
5741
- },
5742
- [AttachmentModel.Asset]: {
5743
- name: "asset",
5744
- attachUrlPrefix: "/assets",
5745
- deleteUrlPrefix: "/assets",
5746
- fetchUrlPostfix: "/asset-attachments"
5747
- },
5748
- [AttachmentModel.AssetType]: {
5749
- name: "asset type",
5750
- attachUrlPrefix: "/assets/types",
5751
- deleteUrlPrefix: "/assets/types",
5752
- fetchUrlPostfix: "/asset-type-attachments"
5753
- },
5754
- [AttachmentModel.Project]: {
5755
- name: "project",
5756
- attachUrlPrefix: "/projects",
5757
- deleteUrlPrefix: "/projects",
5758
- fetchUrlPostfix: "/attachments"
5759
- },
5760
- [AttachmentModel.Document]: {
5761
- name: "document",
5762
- attachUrlPrefix: "/documents",
5763
- deleteUrlPrefix: "/documents",
5764
- fetchUrlPostfix: "/document-attachments"
5765
- }
5766
- };
5767
- class BaseAttachmentService extends BaseApiService {
5835
+ class BaseFileUploadService extends BaseApiService {
5768
5836
  getNumberOfAttachmentsWithSha1(sha1) {
5769
5837
  const {
5770
5838
  issueReducer: issueReducer2,
@@ -5773,7 +5841,8 @@ var __publicField = (obj, key, value) => {
5773
5841
  documentsReducer: documentsReducer2,
5774
5842
  projectReducer: projectReducer2,
5775
5843
  formSubmissionReducer: formSubmissionReducer2,
5776
- formRevisionReducer: formRevisionReducer2
5844
+ formRevisionReducer: formRevisionReducer2,
5845
+ mapImageReducer: mapImageReducer2
5777
5846
  } = this.client.store.getState();
5778
5847
  const objectsWithSha1 = [].concat(
5779
5848
  Object.values(issueReducer2.attachments),
@@ -5782,7 +5851,8 @@ var __publicField = (obj, key, value) => {
5782
5851
  Object.values(documentsReducer2.attachments),
5783
5852
  Object.values(projectReducer2.attachments),
5784
5853
  Object.values(formRevisionReducer2.attachments),
5785
- Object.values(formSubmissionReducer2.attachments)
5854
+ Object.values(formSubmissionReducer2.attachments),
5855
+ Object.values(mapImageReducer2.models)
5786
5856
  );
5787
5857
  return objectsWithSha1.filter((object) => object.file_sha1 === sha1).length;
5788
5858
  }
@@ -5802,6 +5872,40 @@ var __publicField = (obj, key, value) => {
5802
5872
  });
5803
5873
  }
5804
5874
  }
5875
+ }
5876
+ const AttachmentModelMeta = {
5877
+ [AttachmentModel.Issue]: {
5878
+ name: "issue",
5879
+ attachUrlPrefix: "/issues",
5880
+ deleteUrlPrefix: "/issues",
5881
+ fetchUrlPostfix: "/issue-attachments"
5882
+ },
5883
+ [AttachmentModel.Asset]: {
5884
+ name: "asset",
5885
+ attachUrlPrefix: "/assets",
5886
+ deleteUrlPrefix: "/assets",
5887
+ fetchUrlPostfix: "/asset-attachments"
5888
+ },
5889
+ [AttachmentModel.AssetType]: {
5890
+ name: "asset type",
5891
+ attachUrlPrefix: "/assets/types",
5892
+ deleteUrlPrefix: "/assets/types",
5893
+ fetchUrlPostfix: "/asset-type-attachments"
5894
+ },
5895
+ [AttachmentModel.Project]: {
5896
+ name: "project",
5897
+ attachUrlPrefix: "/projects",
5898
+ deleteUrlPrefix: "/projects",
5899
+ fetchUrlPostfix: "/attachments"
5900
+ },
5901
+ [AttachmentModel.Document]: {
5902
+ name: "document",
5903
+ attachUrlPrefix: "/documents",
5904
+ deleteUrlPrefix: "/documents",
5905
+ fetchUrlPostfix: "/document-attachments"
5906
+ }
5907
+ };
5908
+ class BaseAttachmentService extends BaseFileUploadService {
5805
5909
  // Note that currently the fetching of attachments for all models dependds on the active projectId. This may change in the future. And
5806
5910
  // so for some attachment model services, this method will have to be overridden.
5807
5911
  async getAttachments(actions) {
@@ -6663,6 +6767,7 @@ var __publicField = (obj, key, value) => {
6663
6767
  void this.client.assetStages.refreshStore();
6664
6768
  void this.client.assets.refreshStore();
6665
6769
  void this.client.assetStageCompletions.refreshStore();
6770
+ await this.client.mapImages.refreshStore();
6666
6771
  void this.client.categories.refreshStore();
6667
6772
  void this.client.issueTypes.refreshStore();
6668
6773
  void this.client.issues.refreshStore();
@@ -8594,6 +8699,180 @@ var __publicField = (obj, key, value) => {
8594
8699
  store.dispatch(setTeams(result));
8595
8700
  }
8596
8701
  }
8702
+ class MapImageService extends BaseFileUploadService {
8703
+ async add(mapImagePayload, file, projectId) {
8704
+ const { store } = this.client;
8705
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
8706
+ const currentUser = store.getState().userReducer.currentUser;
8707
+ const sha1 = await hashFile(file);
8708
+ const filePayload = {
8709
+ sha1,
8710
+ file_type: file.type,
8711
+ extension: file.name.split(".").pop(),
8712
+ size: file.size
8713
+ };
8714
+ const offlineMapImage = offline({
8715
+ ...mapImagePayload,
8716
+ file_name: file.name,
8717
+ file_sha1: sha1,
8718
+ file: URL.createObjectURL(file),
8719
+ project: projectId,
8720
+ submitted_at: submittedAt,
8721
+ created_by: currentUser.id
8722
+ });
8723
+ store.dispatch(addMapImage(offlineMapImage));
8724
+ const promise = this.client.enqueueRequest({
8725
+ description: "Add map image",
8726
+ method: HttpMethod.POST,
8727
+ url: `/projects/${projectId}/map-images/bulk-create/`,
8728
+ payload: {
8729
+ submitted_at: submittedAt,
8730
+ map_images: [
8731
+ {
8732
+ offline_id: offlineMapImage.offline_id,
8733
+ title: offlineMapImage.title,
8734
+ description: offlineMapImage.description,
8735
+ marker: offlineMapImage.marker,
8736
+ sha1: offlineMapImage.file_sha1,
8737
+ file_name: offlineMapImage.file_name,
8738
+ direction: offlineMapImage.direction,
8739
+ original_date: offlineMapImage.original_date
8740
+ }
8741
+ ],
8742
+ files: [filePayload]
8743
+ },
8744
+ blocks: [projectId.toString()],
8745
+ blockers: [projectId.toString()]
8746
+ });
8747
+ promise.then((result) => {
8748
+ this.processPresignedUrls(result.presigned_urls);
8749
+ store.dispatch(setMapImages(result.map_images));
8750
+ }).catch(() => {
8751
+ store.dispatch(deleteMapImage(offlineMapImage.offline_id));
8752
+ });
8753
+ return [offlineMapImage, promise.then((result) => result.map_images[0])];
8754
+ }
8755
+ async bulkAdd(payloadAndFiles, projectId) {
8756
+ const { store } = this.client;
8757
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
8758
+ const currentUser = store.getState().userReducer.currentUser;
8759
+ const offlineMapImages = [];
8760
+ const mapImageOfflineIds = [];
8761
+ const mapImagePayloads = [];
8762
+ const filePayloadRecord = {};
8763
+ for (const payloadAndFile of payloadAndFiles) {
8764
+ const { payload, file } = payloadAndFile;
8765
+ const sha1 = await hashFile(file);
8766
+ if (!(sha1 in filePayloadRecord)) {
8767
+ filePayloadRecord[sha1] = {
8768
+ sha1,
8769
+ file_type: file.type,
8770
+ extension: file.name.split(".").pop(),
8771
+ size: file.size
8772
+ };
8773
+ await this.client.files.addCache(file, sha1);
8774
+ }
8775
+ const offlineMapImage = offline({
8776
+ ...payload,
8777
+ file_name: file.name,
8778
+ file_sha1: sha1,
8779
+ file: URL.createObjectURL(file),
8780
+ submitted_at: submittedAt,
8781
+ created_by: currentUser.id,
8782
+ project: projectId
8783
+ });
8784
+ offlineMapImages.push(offlineMapImage);
8785
+ mapImageOfflineIds.push(offlineMapImage.offline_id);
8786
+ mapImagePayloads.push({
8787
+ offline_id: offlineMapImage.offline_id,
8788
+ title: offlineMapImage.title,
8789
+ description: offlineMapImage.description,
8790
+ marker: offlineMapImage.marker,
8791
+ sha1: offlineMapImage.file_sha1,
8792
+ file_name: offlineMapImage.file_name,
8793
+ direction: offlineMapImage.direction,
8794
+ original_date: offlineMapImage.original_date
8795
+ });
8796
+ }
8797
+ store.dispatch(addMapImages(offlineMapImages));
8798
+ const promise = this.client.enqueueRequest({
8799
+ description: "Bulk add map images",
8800
+ method: HttpMethod.POST,
8801
+ url: `/projects/${projectId}/map-images/bulk-create/`,
8802
+ payload: {
8803
+ submitted_at: submittedAt,
8804
+ map_images: mapImagePayloads,
8805
+ files: Object.values(filePayloadRecord)
8806
+ },
8807
+ blocks: [projectId.toString()],
8808
+ blockers: mapImageOfflineIds
8809
+ });
8810
+ promise.then((result) => {
8811
+ this.processPresignedUrls(result.presigned_urls);
8812
+ store.dispatch(setMapImages(result.map_images));
8813
+ }).catch(() => {
8814
+ store.dispatch(deleteMapImages(mapImageOfflineIds));
8815
+ });
8816
+ return [offlineMapImages, promise.then((result) => result.map_images)];
8817
+ }
8818
+ update(mapImagePayload) {
8819
+ const { store } = this.client;
8820
+ const mapImageToUpdate = store.getState().mapImageReducer.models[mapImagePayload.offline_id];
8821
+ if (!mapImageToUpdate) {
8822
+ throw new Error(`Map image with offline_id ${mapImagePayload.offline_id} does not exist in the store`);
8823
+ }
8824
+ const updatedMapImage = { ...mapImageToUpdate, ...mapImagePayload };
8825
+ store.dispatch(updateMapImage(updatedMapImage));
8826
+ const promise = this.client.enqueueRequest({
8827
+ description: "Update map image",
8828
+ method: HttpMethod.PUT,
8829
+ url: `/projects/map-images/${mapImagePayload.offline_id}/`,
8830
+ payload: mapImagePayload,
8831
+ blocks: [mapImagePayload.offline_id],
8832
+ blockers: [mapImagePayload.offline_id]
8833
+ });
8834
+ promise.then((result) => {
8835
+ store.dispatch(setMapImage(result));
8836
+ }).catch(() => {
8837
+ store.dispatch(setMapImage(mapImageToUpdate));
8838
+ });
8839
+ return [updatedMapImage, promise];
8840
+ }
8841
+ async delete(mapImageId) {
8842
+ const { store } = this.client;
8843
+ const mapImageToDelete = store.getState().mapImageReducer.models[mapImageId];
8844
+ if (!mapImageToDelete) {
8845
+ throw new Error(`Map image with offline_id ${mapImageId} does not exist in the store`);
8846
+ }
8847
+ store.dispatch(deleteMapImage(mapImageId));
8848
+ const promise = this.client.enqueueRequest({
8849
+ description: "Delete map image",
8850
+ method: HttpMethod.DELETE,
8851
+ url: `/projects/map-images/${mapImageId}/`,
8852
+ blocks: [mapImageId],
8853
+ blockers: [mapImageId]
8854
+ });
8855
+ promise.catch(() => {
8856
+ store.dispatch(setMapImage(mapImageToDelete));
8857
+ });
8858
+ return promise;
8859
+ }
8860
+ async refreshStore() {
8861
+ const { store } = this.client;
8862
+ const activeProjectId = store.getState().projectReducer.activeProjectId;
8863
+ if (!activeProjectId) {
8864
+ throw new Error("No active project");
8865
+ }
8866
+ const result = await this.client.enqueueRequest({
8867
+ description: "Get map images",
8868
+ method: HttpMethod.GET,
8869
+ url: `/projects/${activeProjectId}/map-images/`,
8870
+ blocks: [activeProjectId.toString()],
8871
+ blockers: []
8872
+ });
8873
+ store.dispatch(setMapImages(result));
8874
+ }
8875
+ }
8597
8876
  class DeferredPromise {
8598
8877
  constructor() {
8599
8878
  __publicField(this, _a, "Promise");
@@ -8669,6 +8948,7 @@ var __publicField = (obj, key, value) => {
8669
8948
  __publicField(this, "documents", new DocumentService(this));
8670
8949
  __publicField(this, "teams", new TeamService(this));
8671
8950
  __publicField(this, "documentAttachments", new DocumentAttachmentService(this));
8951
+ __publicField(this, "mapImages", new MapImageService(this));
8672
8952
  this.API_URL = apiUrl;
8673
8953
  this.store = store;
8674
8954
  }
@@ -16871,6 +17151,7 @@ var __publicField = (obj, key, value) => {
16871
17151
  exports2.LicenseService = LicenseService;
16872
17152
  exports2.LicenseStatus = LicenseStatus;
16873
17153
  exports2.MainService = MainService;
17154
+ exports2.MapImageService = MapImageService;
16874
17155
  exports2.MapStyle = MapStyle;
16875
17156
  exports2.MultiSelectField = MultiSelectField;
16876
17157
  exports2.MultiSelectInput = MultiSelectInput;
@@ -16956,6 +17237,8 @@ var __publicField = (obj, key, value) => {
16956
17237
  exports2.addIssueUpdates = addIssueUpdates;
16957
17238
  exports2.addIssues = addIssues;
16958
17239
  exports2.addLicenses = addLicenses;
17240
+ exports2.addMapImage = addMapImage;
17241
+ exports2.addMapImages = addMapImages;
16959
17242
  exports2.addOrReplaceCategories = addOrReplaceCategories;
16960
17243
  exports2.addOrReplaceIssueComment = addOrReplaceIssueComment;
16961
17244
  exports2.addOrReplaceProjectFile = addOrReplaceProjectFile;
@@ -17012,6 +17295,8 @@ var __publicField = (obj, key, value) => {
17012
17295
  exports2.deleteFormSubmissionAttachment = deleteFormSubmissionAttachment;
17013
17296
  exports2.deleteFormSubmissionAttachments = deleteFormSubmissionAttachments;
17014
17297
  exports2.deleteFormSubmissions = deleteFormSubmissions;
17298
+ exports2.deleteMapImage = deleteMapImage;
17299
+ exports2.deleteMapImages = deleteMapImages;
17015
17300
  exports2.deleteProject = deleteProject;
17016
17301
  exports2.deleteTeam = deleteTeam;
17017
17302
  exports2.dequeue = dequeue;
@@ -17081,6 +17366,8 @@ var __publicField = (obj, key, value) => {
17081
17366
  exports2.literalToCoordinates = literalToCoordinates;
17082
17367
  exports2.logOnlyOnce = logOnlyOnce;
17083
17368
  exports2.makeClient = makeClient;
17369
+ exports2.mapImageReducer = mapImageReducer;
17370
+ exports2.mapImageSlice = mapImageSlice;
17084
17371
  exports2.mapReducer = mapReducer;
17085
17372
  exports2.mapSlice = mapSlice;
17086
17373
  exports2.markAsDeleted = markAsDeleted;
@@ -17290,6 +17577,10 @@ var __publicField = (obj, key, value) => {
17290
17577
  exports2.selectLicenses = selectLicenses;
17291
17578
  exports2.selectLicensesForProjectsMapping = selectLicensesForProjectsMapping;
17292
17579
  exports2.selectMainWorkspace = selectMainWorkspace;
17580
+ exports2.selectMapImageById = selectMapImageById;
17581
+ exports2.selectMapImageMapping = selectMapImageMapping;
17582
+ exports2.selectMapImages = selectMapImages;
17583
+ exports2.selectMapImagesOfProject = selectMapImagesOfProject;
17293
17584
  exports2.selectMapStyle = selectMapStyle;
17294
17585
  exports2.selectNumberOfAssetTypesMatchingCaseInsensitiveName = selectNumberOfAssetTypesMatchingCaseInsensitiveName;
17295
17586
  exports2.selectNumberOfAssetsOfAssetType = selectNumberOfAssetsOfAssetType;
@@ -17396,6 +17687,8 @@ var __publicField = (obj, key, value) => {
17396
17687
  exports2.setIssues = setIssues;
17397
17688
  exports2.setLicenses = setLicenses;
17398
17689
  exports2.setLoggedIn = setLoggedIn;
17690
+ exports2.setMapImage = setMapImage;
17691
+ exports2.setMapImages = setMapImages;
17399
17692
  exports2.setMapStyle = setMapStyle;
17400
17693
  exports2.setOrganizationAccesses = setOrganizationAccesses;
17401
17694
  exports2.setOrganizations = setOrganizations;
@@ -17452,6 +17745,8 @@ var __publicField = (obj, key, value) => {
17452
17745
  exports2.updateIssueAttachments = updateIssueAttachments;
17453
17746
  exports2.updateIssueType = updateIssueType;
17454
17747
  exports2.updateLicense = updateLicense;
17748
+ exports2.updateMapImage = updateMapImage;
17749
+ exports2.updateMapImages = updateMapImages;
17455
17750
  exports2.updateOrCreateProject = updateOrCreateProject;
17456
17751
  exports2.updateOrganizationAccess = updateOrganizationAccess;
17457
17752
  exports2.updateProjectAccess = updateProjectAccess;