@overmap-ai/core 1.0.58-form-improvements.2 → 1.0.58-map-images.1
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.
- package/dist/overmap-core.js +411 -116
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +411 -116
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/sdk.d.ts +2 -1
- package/dist/sdk/services/BaseAttachmentService.d.ts +8 -4
- package/dist/sdk/services/BaseFileUploadService.d.ts +6 -0
- package/dist/sdk/services/MapImageService.d.ts +13 -0
- package/dist/sdk/services/index.d.ts +1 -0
- package/dist/store/modelAdapter.d.ts +20 -0
- package/dist/store/slices/categorySlice.d.ts +1 -0
- package/dist/store/slices/documentSlice.d.ts +1 -0
- package/dist/store/slices/formRevisionSlice.d.ts +1 -0
- package/dist/store/slices/index.d.ts +1 -0
- package/dist/store/slices/issueSlice.d.ts +1 -0
- package/dist/store/slices/mapImageSlice.d.ts +44 -0
- package/dist/store/slices/projectFileSlice.d.ts +1 -0
- package/dist/store/slices/workspaceSlice.d.ts +1 -0
- package/dist/store/store.d.ts +4 -1
- package/dist/store/typings.d.ts +3 -0
- package/dist/typings/models/index.d.ts +1 -0
- package/dist/typings/models/mapImage.d.ts +12 -0
- package/package.json +1 -1
package/dist/overmap-core.js
CHANGED
|
@@ -744,15 +744,15 @@ const wrapMigration = (migrator) => (state) => {
|
|
|
744
744
|
};
|
|
745
745
|
const migrations = [initialVersioning, signOut, signOut, createOutboxState];
|
|
746
746
|
const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
|
|
747
|
-
const initialState$
|
|
747
|
+
const initialState$t = {
|
|
748
748
|
accessToken: "",
|
|
749
749
|
refreshToken: "",
|
|
750
750
|
isLoggedIn: false
|
|
751
751
|
};
|
|
752
752
|
const authSlice = createSlice({
|
|
753
753
|
name: "auth",
|
|
754
|
-
initialState: initialState$
|
|
755
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
754
|
+
initialState: initialState$t,
|
|
755
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$t)),
|
|
756
756
|
reducers: {
|
|
757
757
|
setTokens: (state, action) => {
|
|
758
758
|
state.accessToken = action.payload.accessToken;
|
|
@@ -1396,7 +1396,7 @@ const getLocalRelativeDateString = memoize((date, min, max) => {
|
|
|
1396
1396
|
return getLocalDateString(date);
|
|
1397
1397
|
return relative.format(days, "days");
|
|
1398
1398
|
});
|
|
1399
|
-
const initialState$
|
|
1399
|
+
const initialState$s = {
|
|
1400
1400
|
categories: {},
|
|
1401
1401
|
usedCategoryColors: [],
|
|
1402
1402
|
categoryVisibility: {
|
|
@@ -1406,8 +1406,8 @@ const initialState$r = {
|
|
|
1406
1406
|
};
|
|
1407
1407
|
const categorySlice = createSlice({
|
|
1408
1408
|
name: "categories",
|
|
1409
|
-
initialState: initialState$
|
|
1410
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1409
|
+
initialState: initialState$s,
|
|
1410
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$s)),
|
|
1411
1411
|
reducers: {
|
|
1412
1412
|
setCategories: (state, action) => {
|
|
1413
1413
|
if (!Array.isArray(action.payload))
|
|
@@ -1591,15 +1591,15 @@ function removeAttachments(state, action) {
|
|
|
1591
1591
|
delete state.attachments[attachmentId];
|
|
1592
1592
|
}
|
|
1593
1593
|
}
|
|
1594
|
-
const initialState$
|
|
1594
|
+
const initialState$r = {
|
|
1595
1595
|
assetTypes: {},
|
|
1596
1596
|
hiddenAssetTypeIds: {},
|
|
1597
1597
|
attachments: {}
|
|
1598
1598
|
};
|
|
1599
1599
|
const assetTypeSlice = createSlice({
|
|
1600
1600
|
name: "assetTypes",
|
|
1601
|
-
initialState: initialState$
|
|
1602
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1601
|
+
initialState: initialState$r,
|
|
1602
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$r)),
|
|
1603
1603
|
reducers: {
|
|
1604
1604
|
addAssetType: (state, action) => {
|
|
1605
1605
|
state.assetTypes[action.payload.offline_id] = action.payload;
|
|
@@ -1709,14 +1709,14 @@ const selectAttachmentsOfAssetTypeByType = restructureCreateSelectorWithArgs(
|
|
|
1709
1709
|
)
|
|
1710
1710
|
);
|
|
1711
1711
|
const assetTypeReducer = assetTypeSlice.reducer;
|
|
1712
|
-
const initialState$
|
|
1712
|
+
const initialState$q = {
|
|
1713
1713
|
assets: {},
|
|
1714
1714
|
attachments: {}
|
|
1715
1715
|
};
|
|
1716
1716
|
const assetSlice = createSlice({
|
|
1717
1717
|
name: "assets",
|
|
1718
|
-
initialState: initialState$
|
|
1719
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1718
|
+
initialState: initialState$q,
|
|
1719
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
|
|
1720
1720
|
reducers: {
|
|
1721
1721
|
addAsset: (state, action) => {
|
|
1722
1722
|
state.assets[action.payload.offline_id] = action.payload;
|
|
@@ -1889,13 +1889,13 @@ const selectAttachmentsOfAssetByType = restructureCreateSelectorWithArgs(
|
|
|
1889
1889
|
)
|
|
1890
1890
|
);
|
|
1891
1891
|
const assetReducer = assetSlice.reducer;
|
|
1892
|
-
const initialState$
|
|
1892
|
+
const initialState$p = {
|
|
1893
1893
|
completionsByAssetId: {}
|
|
1894
1894
|
};
|
|
1895
1895
|
const assetStageCompletionSlice = createSlice({
|
|
1896
1896
|
name: "assetStageCompletions",
|
|
1897
|
-
initialState: initialState$
|
|
1898
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1897
|
+
initialState: initialState$p,
|
|
1898
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
|
|
1899
1899
|
reducers: {
|
|
1900
1900
|
addStageCompletion: (state, action) => {
|
|
1901
1901
|
let stageToCompletionDateMapping = state.completionsByAssetId[action.payload.asset];
|
|
@@ -1944,13 +1944,13 @@ const selectCompletedStageIdsForAsset = (asset) => (state) => {
|
|
|
1944
1944
|
return Object.keys(state.assetStageCompletionReducer.completionsByAssetId[asset.offline_id] ?? {});
|
|
1945
1945
|
};
|
|
1946
1946
|
const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
|
|
1947
|
-
const initialState$
|
|
1947
|
+
const initialState$o = {
|
|
1948
1948
|
stages: {}
|
|
1949
1949
|
};
|
|
1950
1950
|
const assetStageSlice = createSlice({
|
|
1951
1951
|
name: "assetStages",
|
|
1952
|
-
initialState: initialState$
|
|
1953
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1952
|
+
initialState: initialState$o,
|
|
1953
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
|
|
1954
1954
|
reducers: {
|
|
1955
1955
|
addStages: (state, action) => {
|
|
1956
1956
|
Object.assign(state.stages, toOfflineIdRecord(action.payload));
|
|
@@ -2048,13 +2048,13 @@ const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
|
|
|
2048
2048
|
);
|
|
2049
2049
|
const { addStages, updateStages, removeStages, linkStageToForm, unlinkStageToForm } = assetStageSlice.actions;
|
|
2050
2050
|
const assetStageReducer = assetStageSlice.reducer;
|
|
2051
|
-
const initialState$
|
|
2051
|
+
const initialState$n = {
|
|
2052
2052
|
workspaces: {},
|
|
2053
2053
|
activeWorkspaceId: null
|
|
2054
2054
|
};
|
|
2055
2055
|
const workspaceSlice = createSlice({
|
|
2056
2056
|
name: "workspace",
|
|
2057
|
-
initialState: initialState$
|
|
2057
|
+
initialState: initialState$n,
|
|
2058
2058
|
// The `reducers` field lets us define reducers and generate associated actions
|
|
2059
2059
|
reducers: {
|
|
2060
2060
|
setWorkspaces: (state, action) => {
|
|
@@ -2111,7 +2111,7 @@ const selectPermittedWorkspaceIds = createSelector(
|
|
|
2111
2111
|
);
|
|
2112
2112
|
const workspaceReducer = workspaceSlice.reducer;
|
|
2113
2113
|
const maxRecentIssues = 10;
|
|
2114
|
-
const initialState$
|
|
2114
|
+
const initialState$m = {
|
|
2115
2115
|
issues: {},
|
|
2116
2116
|
attachments: {},
|
|
2117
2117
|
comments: {},
|
|
@@ -2123,9 +2123,9 @@ const initialState$l = {
|
|
|
2123
2123
|
};
|
|
2124
2124
|
const issueSlice = createSlice({
|
|
2125
2125
|
name: "issues",
|
|
2126
|
-
initialState: initialState$
|
|
2126
|
+
initialState: initialState$m,
|
|
2127
2127
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
2128
|
-
Object.assign(state, initialState$
|
|
2128
|
+
Object.assign(state, initialState$m);
|
|
2129
2129
|
}),
|
|
2130
2130
|
reducers: {
|
|
2131
2131
|
setIssues: (state, action) => {
|
|
@@ -2558,14 +2558,14 @@ const selectRecentIssuesAsSearchResults = createSelector(
|
|
|
2558
2558
|
}
|
|
2559
2559
|
);
|
|
2560
2560
|
const issueReducer = issueSlice.reducer;
|
|
2561
|
-
const initialState$
|
|
2561
|
+
const initialState$l = {
|
|
2562
2562
|
issueTypes: {}
|
|
2563
2563
|
};
|
|
2564
2564
|
const issueTypeSlice = createSlice({
|
|
2565
2565
|
name: "issueTypes",
|
|
2566
|
-
initialState: initialState$
|
|
2566
|
+
initialState: initialState$l,
|
|
2567
2567
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
2568
|
-
Object.assign(state, initialState$
|
|
2568
|
+
Object.assign(state, initialState$l);
|
|
2569
2569
|
}),
|
|
2570
2570
|
reducers: {
|
|
2571
2571
|
setIssueTypes: (state, action) => {
|
|
@@ -2632,15 +2632,15 @@ const selectIssuesOfIssueTypeCount = (issueTypeId) => (state) => {
|
|
|
2632
2632
|
return ((_a2 = selectIssuesOfIssueType(issueTypeId)(state)) == null ? void 0 : _a2.length) ?? 0;
|
|
2633
2633
|
};
|
|
2634
2634
|
const issueTypeReducer = issueTypeSlice.reducer;
|
|
2635
|
-
const initialState$
|
|
2635
|
+
const initialState$k = {
|
|
2636
2636
|
s3Urls: {}
|
|
2637
2637
|
};
|
|
2638
2638
|
const msPerHour = 1e3 * 60 * 60;
|
|
2639
2639
|
const msPerWeek = msPerHour * 24 * 7;
|
|
2640
2640
|
const fileSlice = createSlice({
|
|
2641
2641
|
name: "file",
|
|
2642
|
-
initialState: initialState$
|
|
2643
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2642
|
+
initialState: initialState$k,
|
|
2643
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
|
|
2644
2644
|
reducers: {
|
|
2645
2645
|
setUploadUrl: (state, action) => {
|
|
2646
2646
|
const { url, fields, sha1 } = action.payload;
|
|
@@ -2667,7 +2667,7 @@ const selectUploadUrl = (sha1) => (state) => {
|
|
|
2667
2667
|
return url;
|
|
2668
2668
|
};
|
|
2669
2669
|
const fileReducer = fileSlice.reducer;
|
|
2670
|
-
const initialState$
|
|
2670
|
+
const initialState$j = {
|
|
2671
2671
|
// TODO: Change first MapStyle.SATELLITE to MaptStyle.None when project creation map is fixed
|
|
2672
2672
|
mapStyle: MapStyle.SATELLITE,
|
|
2673
2673
|
showTooltips: false,
|
|
@@ -2675,8 +2675,8 @@ const initialState$i = {
|
|
|
2675
2675
|
};
|
|
2676
2676
|
const mapSlice = createSlice({
|
|
2677
2677
|
name: "map",
|
|
2678
|
-
initialState: initialState$
|
|
2679
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2678
|
+
initialState: initialState$j,
|
|
2679
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
|
|
2680
2680
|
reducers: {
|
|
2681
2681
|
setMapStyle: (state, action) => {
|
|
2682
2682
|
state.mapStyle = action.payload;
|
|
@@ -2753,7 +2753,7 @@ var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
|
|
|
2753
2753
|
LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
|
|
2754
2754
|
return LicenseStatus2;
|
|
2755
2755
|
})(LicenseStatus || {});
|
|
2756
|
-
const initialState$
|
|
2756
|
+
const initialState$i = {
|
|
2757
2757
|
users: {},
|
|
2758
2758
|
currentUser: {
|
|
2759
2759
|
id: 0,
|
|
@@ -2764,8 +2764,8 @@ const initialState$h = {
|
|
|
2764
2764
|
};
|
|
2765
2765
|
const userSlice = createSlice({
|
|
2766
2766
|
name: "users",
|
|
2767
|
-
initialState: initialState$
|
|
2768
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2767
|
+
initialState: initialState$i,
|
|
2768
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
|
|
2769
2769
|
reducers: {
|
|
2770
2770
|
setUsers: (state, action) => {
|
|
2771
2771
|
const usersMapping = {};
|
|
@@ -2827,13 +2827,13 @@ const selectUser = (userId) => (state) => {
|
|
|
2827
2827
|
const selectUsersAsMapping = (state) => state.userReducer.users;
|
|
2828
2828
|
const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
|
|
2829
2829
|
const userReducer = userSlice.reducer;
|
|
2830
|
-
const initialState$
|
|
2830
|
+
const initialState$h = {
|
|
2831
2831
|
organizationAccesses: {}
|
|
2832
2832
|
};
|
|
2833
2833
|
const organizationAccessSlice = createSlice({
|
|
2834
2834
|
name: "organizationAccess",
|
|
2835
|
-
initialState: initialState$
|
|
2836
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2835
|
+
initialState: initialState$h,
|
|
2836
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
|
|
2837
2837
|
reducers: {
|
|
2838
2838
|
setOrganizationAccesses: (state, action) => {
|
|
2839
2839
|
if (!Array.isArray(action.payload))
|
|
@@ -2896,13 +2896,13 @@ const selectOrganizationAccessUserMapping = (state) => {
|
|
|
2896
2896
|
return organizationAccesses;
|
|
2897
2897
|
};
|
|
2898
2898
|
const organizationAccessReducer = organizationAccessSlice.reducer;
|
|
2899
|
-
const initialState$
|
|
2899
|
+
const initialState$g = {
|
|
2900
2900
|
licenses: {}
|
|
2901
2901
|
};
|
|
2902
2902
|
const licenseSlice = createSlice({
|
|
2903
2903
|
name: "license",
|
|
2904
|
-
initialState: initialState$
|
|
2905
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2904
|
+
initialState: initialState$g,
|
|
2905
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
|
|
2906
2906
|
reducers: {
|
|
2907
2907
|
setLicenses: (state, action) => {
|
|
2908
2908
|
if (!Array.isArray(action.payload))
|
|
@@ -2947,13 +2947,13 @@ const selectLicensesForProjectsMapping = createSelector(
|
|
|
2947
2947
|
(licenses) => Object.values(licenses).filter((license) => license.project).reduce((accum, license) => ({ ...accum, [license.project]: license }), {})
|
|
2948
2948
|
);
|
|
2949
2949
|
const licenseReducer = licenseSlice.reducer;
|
|
2950
|
-
const initialState$
|
|
2950
|
+
const initialState$f = {
|
|
2951
2951
|
projectAccesses: {}
|
|
2952
2952
|
};
|
|
2953
2953
|
const projectAccessSlice = createSlice({
|
|
2954
2954
|
name: "projectAccess",
|
|
2955
|
-
initialState: initialState$
|
|
2956
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2955
|
+
initialState: initialState$f,
|
|
2956
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
|
|
2957
2957
|
reducers: {
|
|
2958
2958
|
setProjectAccesses: (state, action) => {
|
|
2959
2959
|
if (!Array.isArray(action.payload))
|
|
@@ -3021,7 +3021,7 @@ const selectProjectAccessUserMapping = (state) => {
|
|
|
3021
3021
|
return projectAccesses;
|
|
3022
3022
|
};
|
|
3023
3023
|
const projectAccessReducer = projectAccessSlice.reducer;
|
|
3024
|
-
const initialState$
|
|
3024
|
+
const initialState$e = {
|
|
3025
3025
|
projects: {},
|
|
3026
3026
|
activeProjectId: null,
|
|
3027
3027
|
recentProjectIds: [],
|
|
@@ -3031,7 +3031,7 @@ const initialState$d = {
|
|
|
3031
3031
|
};
|
|
3032
3032
|
const projectSlice = createSlice({
|
|
3033
3033
|
name: "projects",
|
|
3034
|
-
initialState: initialState$
|
|
3034
|
+
initialState: initialState$e,
|
|
3035
3035
|
reducers: {
|
|
3036
3036
|
setProjects: (state, action) => {
|
|
3037
3037
|
const projectsMap = {};
|
|
@@ -3225,14 +3225,14 @@ const selectAttachmentsOfProjectByType = restructureCreateSelectorWithArgs(
|
|
|
3225
3225
|
}
|
|
3226
3226
|
)
|
|
3227
3227
|
);
|
|
3228
|
-
const initialState$
|
|
3228
|
+
const initialState$d = {
|
|
3229
3229
|
organizations: {},
|
|
3230
3230
|
activeOrganizationId: null
|
|
3231
3231
|
};
|
|
3232
3232
|
const organizationSlice = createSlice({
|
|
3233
3233
|
name: "organizations",
|
|
3234
|
-
initialState: initialState$
|
|
3235
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3234
|
+
initialState: initialState$d,
|
|
3235
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
|
|
3236
3236
|
reducers: {
|
|
3237
3237
|
setOrganizations: (state, action) => {
|
|
3238
3238
|
for (const org of action.payload) {
|
|
@@ -3351,14 +3351,14 @@ const createOfflineAction = (request2, baseUrl) => {
|
|
|
3351
3351
|
}
|
|
3352
3352
|
};
|
|
3353
3353
|
};
|
|
3354
|
-
const initialState$
|
|
3354
|
+
const initialState$c = {
|
|
3355
3355
|
deletedRequests: [],
|
|
3356
3356
|
latestRetryTime: 0
|
|
3357
3357
|
};
|
|
3358
3358
|
const outboxSlice = createSlice({
|
|
3359
3359
|
name: "outbox",
|
|
3360
|
-
initialState: initialState$
|
|
3361
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3360
|
+
initialState: initialState$c,
|
|
3361
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
|
|
3362
3362
|
reducers: {
|
|
3363
3363
|
// enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
|
|
3364
3364
|
// Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
|
|
@@ -3390,7 +3390,7 @@ const selectDeletedRequests = (state) => state.outboxReducer.deletedRequests;
|
|
|
3390
3390
|
const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
|
|
3391
3391
|
const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
|
|
3392
3392
|
const outboxReducer = outboxSlice.reducer;
|
|
3393
|
-
const initialState$
|
|
3393
|
+
const initialState$b = {
|
|
3394
3394
|
projectFiles: {},
|
|
3395
3395
|
activeProjectFileId: null,
|
|
3396
3396
|
isImportingProjectFile: false,
|
|
@@ -3398,8 +3398,8 @@ const initialState$a = {
|
|
|
3398
3398
|
};
|
|
3399
3399
|
const projectFileSlice = createSlice({
|
|
3400
3400
|
name: "projectFiles",
|
|
3401
|
-
initialState: initialState$
|
|
3402
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3401
|
+
initialState: initialState$b,
|
|
3402
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
|
|
3403
3403
|
reducers: {
|
|
3404
3404
|
addOrReplaceProjectFiles: (state, action) => {
|
|
3405
3405
|
for (let fileObj of action.payload) {
|
|
@@ -3500,12 +3500,12 @@ const selectProjectFiles = createSelector(
|
|
|
3500
3500
|
const selectActiveProjectFileId = (state) => state.projectFileReducer.activeProjectFileId;
|
|
3501
3501
|
const selectIsImportingProjectFile = (state) => state.projectFileReducer.isImportingProjectFile;
|
|
3502
3502
|
const projectFileReducer = projectFileSlice.reducer;
|
|
3503
|
-
const initialState$
|
|
3503
|
+
const initialState$a = {
|
|
3504
3504
|
isRehydrated: false
|
|
3505
3505
|
};
|
|
3506
3506
|
const rehydratedSlice = createSlice({
|
|
3507
3507
|
name: "rehydrated",
|
|
3508
|
-
initialState: initialState$
|
|
3508
|
+
initialState: initialState$a,
|
|
3509
3509
|
// The `reducers` field lets us define reducers and generate associated actions
|
|
3510
3510
|
reducers: {
|
|
3511
3511
|
setRehydrated: (state, action) => {
|
|
@@ -3515,7 +3515,7 @@ const rehydratedSlice = createSlice({
|
|
|
3515
3515
|
});
|
|
3516
3516
|
const selectRehydrated = (state) => state.rehydratedReducer.isRehydrated;
|
|
3517
3517
|
const rehydratedReducer = rehydratedSlice.reducer;
|
|
3518
|
-
const initialState$
|
|
3518
|
+
const initialState$9 = {
|
|
3519
3519
|
useIssueTemplate: false,
|
|
3520
3520
|
placementMode: false,
|
|
3521
3521
|
enableClustering: false,
|
|
@@ -3533,8 +3533,8 @@ const initialState$8 = {
|
|
|
3533
3533
|
};
|
|
3534
3534
|
const settingSlice = createSlice({
|
|
3535
3535
|
name: "settings",
|
|
3536
|
-
initialState: initialState$
|
|
3537
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3536
|
+
initialState: initialState$9,
|
|
3537
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$9)),
|
|
3538
3538
|
reducers: {
|
|
3539
3539
|
setEnableDuplicateIssues: (state, action) => {
|
|
3540
3540
|
state.useIssueTemplate = action.payload;
|
|
@@ -3593,14 +3593,14 @@ const formRevisionSortFn = (formRevisionA, formRevisionB) => {
|
|
|
3593
3593
|
return revisionA < revisionB ? -1 : 1;
|
|
3594
3594
|
}
|
|
3595
3595
|
};
|
|
3596
|
-
const initialState$
|
|
3596
|
+
const initialState$8 = {
|
|
3597
3597
|
formRevisions: {},
|
|
3598
3598
|
attachments: {}
|
|
3599
3599
|
};
|
|
3600
3600
|
const formRevisionsSlice = createSlice({
|
|
3601
3601
|
name: "formRevisions",
|
|
3602
|
-
initialState: initialState$
|
|
3603
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3602
|
+
initialState: initialState$8,
|
|
3603
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
|
|
3604
3604
|
reducers: {
|
|
3605
3605
|
// revision related actions
|
|
3606
3606
|
setFormRevision: (state, action) => {
|
|
@@ -3780,13 +3780,13 @@ const selectAttachmentsOfFormRevision = restructureCreateSelectorWithArgs(
|
|
|
3780
3780
|
)
|
|
3781
3781
|
);
|
|
3782
3782
|
const formRevisionReducer = formRevisionsSlice.reducer;
|
|
3783
|
-
const initialState$
|
|
3783
|
+
const initialState$7 = {
|
|
3784
3784
|
forms: {}
|
|
3785
3785
|
};
|
|
3786
3786
|
const formSlice = createSlice({
|
|
3787
3787
|
name: "forms",
|
|
3788
|
-
initialState: initialState$
|
|
3789
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3788
|
+
initialState: initialState$7,
|
|
3789
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
|
|
3790
3790
|
reducers: {
|
|
3791
3791
|
setForms: (state, action) => {
|
|
3792
3792
|
state.forms = {};
|
|
@@ -3889,14 +3889,14 @@ const selectGeneralFormCount = createSelector([selectFormMapping], (userForms) =
|
|
|
3889
3889
|
return Object.values(userForms).filter((form) => !form.asset_type).length;
|
|
3890
3890
|
});
|
|
3891
3891
|
const formReducer = formSlice.reducer;
|
|
3892
|
-
const initialState$
|
|
3892
|
+
const initialState$6 = {
|
|
3893
3893
|
formSubmissions: {},
|
|
3894
3894
|
attachments: {}
|
|
3895
3895
|
};
|
|
3896
3896
|
const formSubmissionSlice = createSlice({
|
|
3897
3897
|
name: "formSubmissions",
|
|
3898
|
-
initialState: initialState$
|
|
3899
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3898
|
+
initialState: initialState$6,
|
|
3899
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
|
|
3900
3900
|
reducers: {
|
|
3901
3901
|
setFormSubmission: (state, action) => {
|
|
3902
3902
|
state.formSubmissions[action.payload.offline_id] = action.payload;
|
|
@@ -4151,12 +4151,12 @@ const selectAttachmentsOfFormSubmission = restructureCreateSelectorWithArgs(
|
|
|
4151
4151
|
)
|
|
4152
4152
|
);
|
|
4153
4153
|
const formSubmissionReducer = formSubmissionSlice.reducer;
|
|
4154
|
-
const initialState$
|
|
4154
|
+
const initialState$5 = {
|
|
4155
4155
|
emailDomains: {}
|
|
4156
4156
|
};
|
|
4157
4157
|
const emailDomainsSlice = createSlice({
|
|
4158
4158
|
name: "emailDomains",
|
|
4159
|
-
initialState: initialState$
|
|
4159
|
+
initialState: initialState$5,
|
|
4160
4160
|
reducers: {
|
|
4161
4161
|
setEmailDomains: (state, action) => {
|
|
4162
4162
|
const emailDomains = {};
|
|
@@ -4183,15 +4183,15 @@ const selectSortedEmailDomains = (state) => Object.values(state.emailDomainsRedu
|
|
|
4183
4183
|
(ed1, ed2) => ed1.domain.localeCompare(ed2.domain)
|
|
4184
4184
|
);
|
|
4185
4185
|
const emailDomainsReducer = emailDomainsSlice.reducer;
|
|
4186
|
-
const initialState$
|
|
4186
|
+
const initialState$4 = {
|
|
4187
4187
|
documents: {},
|
|
4188
4188
|
attachments: {}
|
|
4189
4189
|
};
|
|
4190
4190
|
const documentSlice = createSlice({
|
|
4191
4191
|
name: "documents",
|
|
4192
|
-
initialState: initialState$
|
|
4192
|
+
initialState: initialState$4,
|
|
4193
4193
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
4194
|
-
Object.assign(state, initialState$
|
|
4194
|
+
Object.assign(state, initialState$4);
|
|
4195
4195
|
}),
|
|
4196
4196
|
reducers: {
|
|
4197
4197
|
setDocuments: (state, action) => {
|
|
@@ -4422,13 +4422,13 @@ const selectAttachmentsOfDocumentByType = restructureCreateSelectorWithArgs(
|
|
|
4422
4422
|
)
|
|
4423
4423
|
);
|
|
4424
4424
|
const documentsReducer = documentSlice.reducer;
|
|
4425
|
-
const initialState$
|
|
4425
|
+
const initialState$3 = {
|
|
4426
4426
|
teams: {}
|
|
4427
4427
|
};
|
|
4428
4428
|
const teamSlice = createSlice({
|
|
4429
4429
|
name: "teams",
|
|
4430
|
-
initialState: initialState$
|
|
4431
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
4430
|
+
initialState: initialState$3,
|
|
4431
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
|
|
4432
4432
|
reducers: {
|
|
4433
4433
|
setTeam: (state, action) => {
|
|
4434
4434
|
state.teams[action.payload.offline_id] = action.payload;
|
|
@@ -4478,13 +4478,13 @@ const selectTeamsOfUser = restructureCreateSelectorWithArgs(
|
|
|
4478
4478
|
})
|
|
4479
4479
|
);
|
|
4480
4480
|
const teamReducer = teamSlice.reducer;
|
|
4481
|
-
const initialState$
|
|
4481
|
+
const initialState$2 = {
|
|
4482
4482
|
conversations: {}
|
|
4483
4483
|
};
|
|
4484
4484
|
const agentsSlice = createSlice({
|
|
4485
4485
|
name: "agents",
|
|
4486
|
-
initialState: initialState$
|
|
4487
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
4486
|
+
initialState: initialState$2,
|
|
4487
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$2)),
|
|
4488
4488
|
reducers: {
|
|
4489
4489
|
setConversations: (state, action) => {
|
|
4490
4490
|
state.conversations = {};
|
|
@@ -4526,6 +4526,105 @@ const selectConversation = restructureCreateSelectorWithArgs(
|
|
|
4526
4526
|
)
|
|
4527
4527
|
);
|
|
4528
4528
|
const agentsReducer = agentsSlice.reducer;
|
|
4529
|
+
function createModelAdapter(computeModelId) {
|
|
4530
|
+
const addOne = (state, action) => {
|
|
4531
|
+
const id = computeModelId(action.payload);
|
|
4532
|
+
state.models[id] = action.payload;
|
|
4533
|
+
};
|
|
4534
|
+
const addMany = (state, action) => {
|
|
4535
|
+
for (const model of action.payload) {
|
|
4536
|
+
const id = computeModelId(model);
|
|
4537
|
+
state.models[id] = model;
|
|
4538
|
+
}
|
|
4539
|
+
};
|
|
4540
|
+
const setOne = (state, action) => {
|
|
4541
|
+
const id = computeModelId(action.payload);
|
|
4542
|
+
state.models[id] = action.payload;
|
|
4543
|
+
};
|
|
4544
|
+
const setMany = (state, action) => {
|
|
4545
|
+
for (const model of action.payload) {
|
|
4546
|
+
const id = computeModelId(model);
|
|
4547
|
+
state.models[id] = model;
|
|
4548
|
+
}
|
|
4549
|
+
};
|
|
4550
|
+
const updateOne = (state, action) => {
|
|
4551
|
+
const id = computeModelId(action.payload);
|
|
4552
|
+
state.models[id] = action.payload;
|
|
4553
|
+
};
|
|
4554
|
+
const updateMany = (state, action) => {
|
|
4555
|
+
for (const model of action.payload) {
|
|
4556
|
+
const id = computeModelId(model);
|
|
4557
|
+
state.models[id] = model;
|
|
4558
|
+
}
|
|
4559
|
+
};
|
|
4560
|
+
const deleteOne = (state, action) => {
|
|
4561
|
+
delete state.models[action.payload];
|
|
4562
|
+
};
|
|
4563
|
+
const deleteMany = (state, action) => {
|
|
4564
|
+
for (const id of action.payload) {
|
|
4565
|
+
delete state.models[id];
|
|
4566
|
+
}
|
|
4567
|
+
};
|
|
4568
|
+
const getInitialState = (state) => {
|
|
4569
|
+
return {
|
|
4570
|
+
...state,
|
|
4571
|
+
models: {}
|
|
4572
|
+
};
|
|
4573
|
+
};
|
|
4574
|
+
return {
|
|
4575
|
+
addOne,
|
|
4576
|
+
addMany,
|
|
4577
|
+
setOne,
|
|
4578
|
+
setMany,
|
|
4579
|
+
updateOne,
|
|
4580
|
+
updateMany,
|
|
4581
|
+
deleteOne,
|
|
4582
|
+
deleteMany,
|
|
4583
|
+
getInitialState
|
|
4584
|
+
};
|
|
4585
|
+
}
|
|
4586
|
+
const initialState$1 = {
|
|
4587
|
+
models: {}
|
|
4588
|
+
};
|
|
4589
|
+
const mapImageAdapter = createModelAdapter((model) => model.offline_id);
|
|
4590
|
+
const mapImageSlice = createSlice({
|
|
4591
|
+
name: "mapImages",
|
|
4592
|
+
initialState: initialState$1,
|
|
4593
|
+
extraReducers: (builder) => {
|
|
4594
|
+
builder.addCase("RESET", (state) => {
|
|
4595
|
+
Object.assign(state, initialState$1);
|
|
4596
|
+
});
|
|
4597
|
+
},
|
|
4598
|
+
reducers: {
|
|
4599
|
+
setMapImage: mapImageAdapter.setOne,
|
|
4600
|
+
setMapImages: mapImageAdapter.setMany,
|
|
4601
|
+
addMapImage: mapImageAdapter.addOne,
|
|
4602
|
+
addMapImages: mapImageAdapter.addMany,
|
|
4603
|
+
updateMapImage: mapImageAdapter.updateOne,
|
|
4604
|
+
updateMapImages: mapImageAdapter.updateMany,
|
|
4605
|
+
deleteMapImage: mapImageAdapter.deleteOne,
|
|
4606
|
+
deleteMapImages: mapImageAdapter.deleteMany
|
|
4607
|
+
}
|
|
4608
|
+
});
|
|
4609
|
+
const {
|
|
4610
|
+
setMapImage,
|
|
4611
|
+
setMapImages,
|
|
4612
|
+
addMapImage,
|
|
4613
|
+
addMapImages,
|
|
4614
|
+
updateMapImage,
|
|
4615
|
+
updateMapImages,
|
|
4616
|
+
deleteMapImage,
|
|
4617
|
+
deleteMapImages
|
|
4618
|
+
} = mapImageSlice.actions;
|
|
4619
|
+
const selectMapImageMapping = (state) => state.models;
|
|
4620
|
+
const selectMapImages = (state) => Object.values(state.models);
|
|
4621
|
+
const selectMapImageById = (id) => (state) => state.models[id];
|
|
4622
|
+
const selectMapImagesOfProject = restructureCreateSelectorWithArgs(
|
|
4623
|
+
createSelector([selectMapImages, (_, projectId) => projectId], (mapImages, projectId) => {
|
|
4624
|
+
return mapImages.filter((mapImage) => mapImage.project === projectId);
|
|
4625
|
+
})
|
|
4626
|
+
);
|
|
4627
|
+
const mapImageReducer = mapImageSlice.reducer;
|
|
4529
4628
|
const initialState = {
|
|
4530
4629
|
version: 0
|
|
4531
4630
|
};
|
|
@@ -4577,7 +4676,8 @@ const overmapReducers = {
|
|
|
4577
4676
|
licenseReducer,
|
|
4578
4677
|
documentsReducer,
|
|
4579
4678
|
teamReducer,
|
|
4580
|
-
agentsReducer
|
|
4679
|
+
agentsReducer,
|
|
4680
|
+
mapImageReducer
|
|
4581
4681
|
};
|
|
4582
4682
|
const overmapReducer = combineReducers(overmapReducers);
|
|
4583
4683
|
const resetStore = "RESET";
|
|
@@ -5742,39 +5842,7 @@ class AssetStageService extends BaseApiService {
|
|
|
5742
5842
|
store.dispatch(addStages(result));
|
|
5743
5843
|
}
|
|
5744
5844
|
}
|
|
5745
|
-
|
|
5746
|
-
[AttachmentModel.Issue]: {
|
|
5747
|
-
name: "issue",
|
|
5748
|
-
attachUrlPrefix: "/issues",
|
|
5749
|
-
deleteUrlPrefix: "/issues",
|
|
5750
|
-
fetchUrlPostfix: "/issue-attachments"
|
|
5751
|
-
},
|
|
5752
|
-
[AttachmentModel.Asset]: {
|
|
5753
|
-
name: "asset",
|
|
5754
|
-
attachUrlPrefix: "/assets",
|
|
5755
|
-
deleteUrlPrefix: "/assets",
|
|
5756
|
-
fetchUrlPostfix: "/asset-attachments"
|
|
5757
|
-
},
|
|
5758
|
-
[AttachmentModel.AssetType]: {
|
|
5759
|
-
name: "asset type",
|
|
5760
|
-
attachUrlPrefix: "/assets/types",
|
|
5761
|
-
deleteUrlPrefix: "/assets/types",
|
|
5762
|
-
fetchUrlPostfix: "/asset-type-attachments"
|
|
5763
|
-
},
|
|
5764
|
-
[AttachmentModel.Project]: {
|
|
5765
|
-
name: "project",
|
|
5766
|
-
attachUrlPrefix: "/projects",
|
|
5767
|
-
deleteUrlPrefix: "/projects",
|
|
5768
|
-
fetchUrlPostfix: "/attachments"
|
|
5769
|
-
},
|
|
5770
|
-
[AttachmentModel.Document]: {
|
|
5771
|
-
name: "document",
|
|
5772
|
-
attachUrlPrefix: "/documents",
|
|
5773
|
-
deleteUrlPrefix: "/documents",
|
|
5774
|
-
fetchUrlPostfix: "/document-attachments"
|
|
5775
|
-
}
|
|
5776
|
-
};
|
|
5777
|
-
class BaseAttachmentService extends BaseApiService {
|
|
5845
|
+
class BaseFileUploadService extends BaseApiService {
|
|
5778
5846
|
getNumberOfAttachmentsWithSha1(sha1) {
|
|
5779
5847
|
const {
|
|
5780
5848
|
issueReducer: issueReducer2,
|
|
@@ -5783,7 +5851,8 @@ class BaseAttachmentService extends BaseApiService {
|
|
|
5783
5851
|
documentsReducer: documentsReducer2,
|
|
5784
5852
|
projectReducer: projectReducer2,
|
|
5785
5853
|
formSubmissionReducer: formSubmissionReducer2,
|
|
5786
|
-
formRevisionReducer: formRevisionReducer2
|
|
5854
|
+
formRevisionReducer: formRevisionReducer2,
|
|
5855
|
+
mapImageReducer: mapImageReducer2
|
|
5787
5856
|
} = this.client.store.getState();
|
|
5788
5857
|
const objectsWithSha1 = [].concat(
|
|
5789
5858
|
Object.values(issueReducer2.attachments),
|
|
@@ -5792,7 +5861,8 @@ class BaseAttachmentService extends BaseApiService {
|
|
|
5792
5861
|
Object.values(documentsReducer2.attachments),
|
|
5793
5862
|
Object.values(projectReducer2.attachments),
|
|
5794
5863
|
Object.values(formRevisionReducer2.attachments),
|
|
5795
|
-
Object.values(formSubmissionReducer2.attachments)
|
|
5864
|
+
Object.values(formSubmissionReducer2.attachments),
|
|
5865
|
+
Object.values(mapImageReducer2.models)
|
|
5796
5866
|
);
|
|
5797
5867
|
return objectsWithSha1.filter((object) => object.file_sha1 === sha1).length;
|
|
5798
5868
|
}
|
|
@@ -5812,6 +5882,40 @@ class BaseAttachmentService extends BaseApiService {
|
|
|
5812
5882
|
});
|
|
5813
5883
|
}
|
|
5814
5884
|
}
|
|
5885
|
+
}
|
|
5886
|
+
const AttachmentModelMeta = {
|
|
5887
|
+
[AttachmentModel.Issue]: {
|
|
5888
|
+
name: "issue",
|
|
5889
|
+
attachUrlPrefix: "/issues",
|
|
5890
|
+
deleteUrlPrefix: "/issues",
|
|
5891
|
+
fetchUrlPostfix: "/issue-attachments"
|
|
5892
|
+
},
|
|
5893
|
+
[AttachmentModel.Asset]: {
|
|
5894
|
+
name: "asset",
|
|
5895
|
+
attachUrlPrefix: "/assets",
|
|
5896
|
+
deleteUrlPrefix: "/assets",
|
|
5897
|
+
fetchUrlPostfix: "/asset-attachments"
|
|
5898
|
+
},
|
|
5899
|
+
[AttachmentModel.AssetType]: {
|
|
5900
|
+
name: "asset type",
|
|
5901
|
+
attachUrlPrefix: "/assets/types",
|
|
5902
|
+
deleteUrlPrefix: "/assets/types",
|
|
5903
|
+
fetchUrlPostfix: "/asset-type-attachments"
|
|
5904
|
+
},
|
|
5905
|
+
[AttachmentModel.Project]: {
|
|
5906
|
+
name: "project",
|
|
5907
|
+
attachUrlPrefix: "/projects",
|
|
5908
|
+
deleteUrlPrefix: "/projects",
|
|
5909
|
+
fetchUrlPostfix: "/attachments"
|
|
5910
|
+
},
|
|
5911
|
+
[AttachmentModel.Document]: {
|
|
5912
|
+
name: "document",
|
|
5913
|
+
attachUrlPrefix: "/documents",
|
|
5914
|
+
deleteUrlPrefix: "/documents",
|
|
5915
|
+
fetchUrlPostfix: "/document-attachments"
|
|
5916
|
+
}
|
|
5917
|
+
};
|
|
5918
|
+
class BaseAttachmentService extends BaseFileUploadService {
|
|
5815
5919
|
// Note that currently the fetching of attachments for all models dependds on the active projectId. This may change in the future. And
|
|
5816
5920
|
// so for some attachment model services, this method will have to be overridden.
|
|
5817
5921
|
async getAttachments(actions) {
|
|
@@ -6673,6 +6777,7 @@ class MainService extends BaseApiService {
|
|
|
6673
6777
|
void this.client.assetStages.refreshStore();
|
|
6674
6778
|
void this.client.assets.refreshStore();
|
|
6675
6779
|
void this.client.assetStageCompletions.refreshStore();
|
|
6780
|
+
await this.client.mapImages.refreshStore();
|
|
6676
6781
|
void this.client.categories.refreshStore();
|
|
6677
6782
|
void this.client.issueTypes.refreshStore();
|
|
6678
6783
|
void this.client.issues.refreshStore();
|
|
@@ -8604,6 +8709,180 @@ class TeamService extends BaseApiService {
|
|
|
8604
8709
|
store.dispatch(setTeams(result));
|
|
8605
8710
|
}
|
|
8606
8711
|
}
|
|
8712
|
+
class MapImageService extends BaseFileUploadService {
|
|
8713
|
+
async add(mapImagePayload, file, projectId) {
|
|
8714
|
+
const { store } = this.client;
|
|
8715
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
8716
|
+
const currentUser = store.getState().userReducer.currentUser;
|
|
8717
|
+
const sha1 = await hashFile(file);
|
|
8718
|
+
const filePayload = {
|
|
8719
|
+
sha1,
|
|
8720
|
+
file_type: file.type,
|
|
8721
|
+
extension: file.name.split(".").pop(),
|
|
8722
|
+
size: file.size
|
|
8723
|
+
};
|
|
8724
|
+
const offlineMapImage = offline({
|
|
8725
|
+
...mapImagePayload,
|
|
8726
|
+
file_name: file.name,
|
|
8727
|
+
file_sha1: sha1,
|
|
8728
|
+
file: URL.createObjectURL(file),
|
|
8729
|
+
project: projectId,
|
|
8730
|
+
submitted_at: submittedAt,
|
|
8731
|
+
created_by: currentUser.id
|
|
8732
|
+
});
|
|
8733
|
+
store.dispatch(addMapImage(offlineMapImage));
|
|
8734
|
+
const promise = this.client.enqueueRequest({
|
|
8735
|
+
description: "Add map image",
|
|
8736
|
+
method: HttpMethod.POST,
|
|
8737
|
+
url: `/projects/${projectId}/map-images/bulk-create/`,
|
|
8738
|
+
payload: {
|
|
8739
|
+
submitted_at: submittedAt,
|
|
8740
|
+
map_images: [
|
|
8741
|
+
{
|
|
8742
|
+
offline_id: offlineMapImage.offline_id,
|
|
8743
|
+
title: offlineMapImage.title,
|
|
8744
|
+
description: offlineMapImage.description,
|
|
8745
|
+
marker: offlineMapImage.marker,
|
|
8746
|
+
sha1: offlineMapImage.file_sha1,
|
|
8747
|
+
file_name: offlineMapImage.file_name,
|
|
8748
|
+
direction: offlineMapImage.direction,
|
|
8749
|
+
original_date: offlineMapImage.original_date
|
|
8750
|
+
}
|
|
8751
|
+
],
|
|
8752
|
+
files: [filePayload]
|
|
8753
|
+
},
|
|
8754
|
+
blocks: [projectId.toString()],
|
|
8755
|
+
blockers: [projectId.toString()]
|
|
8756
|
+
});
|
|
8757
|
+
promise.then((result) => {
|
|
8758
|
+
this.processPresignedUrls(result.presigned_urls);
|
|
8759
|
+
store.dispatch(setMapImages(result.map_images));
|
|
8760
|
+
}).catch(() => {
|
|
8761
|
+
store.dispatch(deleteMapImage(offlineMapImage.offline_id));
|
|
8762
|
+
});
|
|
8763
|
+
return [offlineMapImage, promise.then((result) => result.map_images[0])];
|
|
8764
|
+
}
|
|
8765
|
+
async bulkAdd(payloadAndFiles, projectId) {
|
|
8766
|
+
const { store } = this.client;
|
|
8767
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
8768
|
+
const currentUser = store.getState().userReducer.currentUser;
|
|
8769
|
+
const offlineMapImages = [];
|
|
8770
|
+
const mapImageOfflineIds = [];
|
|
8771
|
+
const mapImagePayloads = [];
|
|
8772
|
+
const filePayloadRecord = {};
|
|
8773
|
+
for (const payloadAndFile of payloadAndFiles) {
|
|
8774
|
+
const { payload, file } = payloadAndFile;
|
|
8775
|
+
const sha1 = await hashFile(file);
|
|
8776
|
+
if (!(sha1 in filePayloadRecord)) {
|
|
8777
|
+
filePayloadRecord[sha1] = {
|
|
8778
|
+
sha1,
|
|
8779
|
+
file_type: file.type,
|
|
8780
|
+
extension: file.name.split(".").pop(),
|
|
8781
|
+
size: file.size
|
|
8782
|
+
};
|
|
8783
|
+
await this.client.files.addCache(file, sha1);
|
|
8784
|
+
}
|
|
8785
|
+
const offlineMapImage = offline({
|
|
8786
|
+
...payload,
|
|
8787
|
+
file_name: file.name,
|
|
8788
|
+
file_sha1: sha1,
|
|
8789
|
+
file: URL.createObjectURL(file),
|
|
8790
|
+
submitted_at: submittedAt,
|
|
8791
|
+
created_by: currentUser.id,
|
|
8792
|
+
project: projectId
|
|
8793
|
+
});
|
|
8794
|
+
offlineMapImages.push(offlineMapImage);
|
|
8795
|
+
mapImageOfflineIds.push(offlineMapImage.offline_id);
|
|
8796
|
+
mapImagePayloads.push({
|
|
8797
|
+
offline_id: offlineMapImage.offline_id,
|
|
8798
|
+
title: offlineMapImage.title,
|
|
8799
|
+
description: offlineMapImage.description,
|
|
8800
|
+
marker: offlineMapImage.marker,
|
|
8801
|
+
sha1: offlineMapImage.file_sha1,
|
|
8802
|
+
file_name: offlineMapImage.file_name,
|
|
8803
|
+
direction: offlineMapImage.direction,
|
|
8804
|
+
original_date: offlineMapImage.original_date
|
|
8805
|
+
});
|
|
8806
|
+
}
|
|
8807
|
+
store.dispatch(addMapImages(offlineMapImages));
|
|
8808
|
+
const promise = this.client.enqueueRequest({
|
|
8809
|
+
description: "Bulk add map images",
|
|
8810
|
+
method: HttpMethod.POST,
|
|
8811
|
+
url: `/projects/${projectId}/map-images/bulk-create/`,
|
|
8812
|
+
payload: {
|
|
8813
|
+
submitted_at: submittedAt,
|
|
8814
|
+
map_images: mapImagePayloads,
|
|
8815
|
+
files: Object.values(filePayloadRecord)
|
|
8816
|
+
},
|
|
8817
|
+
blocks: [projectId.toString()],
|
|
8818
|
+
blockers: mapImageOfflineIds
|
|
8819
|
+
});
|
|
8820
|
+
promise.then((result) => {
|
|
8821
|
+
this.processPresignedUrls(result.presigned_urls);
|
|
8822
|
+
store.dispatch(setMapImages(result.map_images));
|
|
8823
|
+
}).catch(() => {
|
|
8824
|
+
store.dispatch(deleteMapImages(mapImageOfflineIds));
|
|
8825
|
+
});
|
|
8826
|
+
return [offlineMapImages, promise.then((result) => result.map_images)];
|
|
8827
|
+
}
|
|
8828
|
+
update(mapImagePayload) {
|
|
8829
|
+
const { store } = this.client;
|
|
8830
|
+
const mapImageToUpdate = store.getState().mapImageReducer.models[mapImagePayload.offline_id];
|
|
8831
|
+
if (!mapImageToUpdate) {
|
|
8832
|
+
throw new Error(`Map image with offline_id ${mapImagePayload.offline_id} does not exist in the store`);
|
|
8833
|
+
}
|
|
8834
|
+
const updatedMapImage = { ...mapImageToUpdate, ...mapImagePayload };
|
|
8835
|
+
store.dispatch(updateMapImage(updatedMapImage));
|
|
8836
|
+
const promise = this.client.enqueueRequest({
|
|
8837
|
+
description: "Update map image",
|
|
8838
|
+
method: HttpMethod.PUT,
|
|
8839
|
+
url: `/projects/map-images/${mapImagePayload.offline_id}/`,
|
|
8840
|
+
payload: mapImagePayload,
|
|
8841
|
+
blocks: [mapImagePayload.offline_id],
|
|
8842
|
+
blockers: [mapImagePayload.offline_id]
|
|
8843
|
+
});
|
|
8844
|
+
promise.then((result) => {
|
|
8845
|
+
store.dispatch(setMapImage(result));
|
|
8846
|
+
}).catch(() => {
|
|
8847
|
+
store.dispatch(setMapImage(mapImageToUpdate));
|
|
8848
|
+
});
|
|
8849
|
+
return [updatedMapImage, promise];
|
|
8850
|
+
}
|
|
8851
|
+
async delete(mapImageId) {
|
|
8852
|
+
const { store } = this.client;
|
|
8853
|
+
const mapImageToDelete = store.getState().mapImageReducer.models[mapImageId];
|
|
8854
|
+
if (!mapImageToDelete) {
|
|
8855
|
+
throw new Error(`Map image with offline_id ${mapImageId} does not exist in the store`);
|
|
8856
|
+
}
|
|
8857
|
+
store.dispatch(deleteMapImage(mapImageId));
|
|
8858
|
+
const promise = this.client.enqueueRequest({
|
|
8859
|
+
description: "Delete map image",
|
|
8860
|
+
method: HttpMethod.DELETE,
|
|
8861
|
+
url: `/projects/map-images/${mapImageId}/`,
|
|
8862
|
+
blocks: [mapImageId],
|
|
8863
|
+
blockers: [mapImageId]
|
|
8864
|
+
});
|
|
8865
|
+
promise.catch(() => {
|
|
8866
|
+
store.dispatch(setMapImage(mapImageToDelete));
|
|
8867
|
+
});
|
|
8868
|
+
return promise;
|
|
8869
|
+
}
|
|
8870
|
+
async refreshStore() {
|
|
8871
|
+
const { store } = this.client;
|
|
8872
|
+
const activeProjectId = store.getState().projectReducer.activeProjectId;
|
|
8873
|
+
if (!activeProjectId) {
|
|
8874
|
+
throw new Error("No active project");
|
|
8875
|
+
}
|
|
8876
|
+
const result = await this.client.enqueueRequest({
|
|
8877
|
+
description: "Get map images",
|
|
8878
|
+
method: HttpMethod.GET,
|
|
8879
|
+
url: `/projects/${activeProjectId}/map-images/`,
|
|
8880
|
+
blocks: [activeProjectId.toString()],
|
|
8881
|
+
blockers: []
|
|
8882
|
+
});
|
|
8883
|
+
store.dispatch(setMapImages(result));
|
|
8884
|
+
}
|
|
8885
|
+
}
|
|
8607
8886
|
class DeferredPromise {
|
|
8608
8887
|
constructor() {
|
|
8609
8888
|
__publicField(this, _a, "Promise");
|
|
@@ -8679,6 +8958,7 @@ class OvermapSDK {
|
|
|
8679
8958
|
__publicField(this, "documents", new DocumentService(this));
|
|
8680
8959
|
__publicField(this, "teams", new TeamService(this));
|
|
8681
8960
|
__publicField(this, "documentAttachments", new DocumentAttachmentService(this));
|
|
8961
|
+
__publicField(this, "mapImages", new MapImageService(this));
|
|
8682
8962
|
this.API_URL = apiUrl;
|
|
8683
8963
|
this.store = store;
|
|
8684
8964
|
}
|
|
@@ -16882,6 +17162,7 @@ export {
|
|
|
16882
17162
|
LicenseService,
|
|
16883
17163
|
LicenseStatus,
|
|
16884
17164
|
MainService,
|
|
17165
|
+
MapImageService,
|
|
16885
17166
|
MapStyle,
|
|
16886
17167
|
MultiSelectField,
|
|
16887
17168
|
MultiSelectInput,
|
|
@@ -16967,6 +17248,8 @@ export {
|
|
|
16967
17248
|
addIssueUpdates,
|
|
16968
17249
|
addIssues,
|
|
16969
17250
|
addLicenses,
|
|
17251
|
+
addMapImage,
|
|
17252
|
+
addMapImages,
|
|
16970
17253
|
addOrReplaceCategories,
|
|
16971
17254
|
addOrReplaceIssueComment,
|
|
16972
17255
|
addOrReplaceProjectFile,
|
|
@@ -17023,6 +17306,8 @@ export {
|
|
|
17023
17306
|
deleteFormSubmissionAttachment,
|
|
17024
17307
|
deleteFormSubmissionAttachments,
|
|
17025
17308
|
deleteFormSubmissions,
|
|
17309
|
+
deleteMapImage,
|
|
17310
|
+
deleteMapImages,
|
|
17026
17311
|
deleteProject,
|
|
17027
17312
|
deleteTeam,
|
|
17028
17313
|
dequeue,
|
|
@@ -17092,6 +17377,8 @@ export {
|
|
|
17092
17377
|
literalToCoordinates,
|
|
17093
17378
|
logOnlyOnce,
|
|
17094
17379
|
makeClient,
|
|
17380
|
+
mapImageReducer,
|
|
17381
|
+
mapImageSlice,
|
|
17095
17382
|
mapReducer,
|
|
17096
17383
|
mapSlice,
|
|
17097
17384
|
markAsDeleted,
|
|
@@ -17301,6 +17588,10 @@ export {
|
|
|
17301
17588
|
selectLicenses,
|
|
17302
17589
|
selectLicensesForProjectsMapping,
|
|
17303
17590
|
selectMainWorkspace,
|
|
17591
|
+
selectMapImageById,
|
|
17592
|
+
selectMapImageMapping,
|
|
17593
|
+
selectMapImages,
|
|
17594
|
+
selectMapImagesOfProject,
|
|
17304
17595
|
selectMapStyle,
|
|
17305
17596
|
selectNumberOfAssetTypesMatchingCaseInsensitiveName,
|
|
17306
17597
|
selectNumberOfAssetsOfAssetType,
|
|
@@ -17407,6 +17698,8 @@ export {
|
|
|
17407
17698
|
setIssues,
|
|
17408
17699
|
setLicenses,
|
|
17409
17700
|
setLoggedIn,
|
|
17701
|
+
setMapImage,
|
|
17702
|
+
setMapImages,
|
|
17410
17703
|
setMapStyle,
|
|
17411
17704
|
setOrganizationAccesses,
|
|
17412
17705
|
setOrganizations,
|
|
@@ -17463,6 +17756,8 @@ export {
|
|
|
17463
17756
|
updateIssueAttachments,
|
|
17464
17757
|
updateIssueType,
|
|
17465
17758
|
updateLicense,
|
|
17759
|
+
updateMapImage,
|
|
17760
|
+
updateMapImages,
|
|
17466
17761
|
updateOrCreateProject,
|
|
17467
17762
|
updateOrganizationAccess,
|
|
17468
17763
|
updateProjectAccess,
|