@overmap-ai/core 1.0.17 → 1.0.18-fix-misc-issues.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
CHANGED
|
@@ -803,7 +803,8 @@ const useFileSrc = (props) => {
|
|
|
803
803
|
useEffect(() => {
|
|
804
804
|
if (!fileSha1 || !file)
|
|
805
805
|
return;
|
|
806
|
-
|
|
806
|
+
const encodedUrl = encodeURI(file);
|
|
807
|
+
sdk.files.fetchFileFromUrl(encodedUrl, fileSha1).then((file2) => {
|
|
807
808
|
setSrc(URL.createObjectURL(file2));
|
|
808
809
|
}).catch((reason) => {
|
|
809
810
|
console.error(`Failed to fetch file ${file} (${fileSha1}):
|
|
@@ -2339,8 +2340,7 @@ const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
|
|
|
2339
2340
|
const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
|
|
2340
2341
|
const outboxReducer = outboxSlice.reducer;
|
|
2341
2342
|
const initialState$8 = {
|
|
2342
|
-
projectAccesses: {}
|
|
2343
|
-
activeProjectAccessId: null
|
|
2343
|
+
projectAccesses: {}
|
|
2344
2344
|
};
|
|
2345
2345
|
const projectAccessSlice = createSlice({
|
|
2346
2346
|
name: "projectAccess",
|
|
@@ -2383,19 +2383,10 @@ const projectAccessSlice = createSlice({
|
|
|
2383
2383
|
delete state.projectAccesses[projectAccess.offline_id];
|
|
2384
2384
|
}
|
|
2385
2385
|
}
|
|
2386
|
-
},
|
|
2387
|
-
setActiveProjectAccessId: (state, action) => {
|
|
2388
|
-
state.activeProjectAccessId = action.payload;
|
|
2389
2386
|
}
|
|
2390
2387
|
}
|
|
2391
2388
|
});
|
|
2392
|
-
const {
|
|
2393
|
-
setProjectAccesses,
|
|
2394
|
-
updateProjectAccess,
|
|
2395
|
-
removeProjectAccess,
|
|
2396
|
-
removeProjectAccessesOfProject,
|
|
2397
|
-
setActiveProjectAccessId
|
|
2398
|
-
} = projectAccessSlice.actions;
|
|
2389
|
+
const { setProjectAccesses, updateProjectAccess, removeProjectAccess, removeProjectAccessesOfProject } = projectAccessSlice.actions;
|
|
2399
2390
|
const selectProjectAccesses = (state) => {
|
|
2400
2391
|
return state.projectAccessReducer.projectAccesses;
|
|
2401
2392
|
};
|
|
@@ -2403,11 +2394,11 @@ const selectProjectAccess = (projectAccessId) => (state) => {
|
|
|
2403
2394
|
return state.projectAccessReducer.projectAccesses[projectAccessId];
|
|
2404
2395
|
};
|
|
2405
2396
|
const selectActiveProjectAccess = (state) => {
|
|
2406
|
-
const
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2397
|
+
const currentUser = state.userReducer.currentUser;
|
|
2398
|
+
const activeProjectId = state.projectReducer.activeProjectId;
|
|
2399
|
+
return Object.values(state.projectAccessReducer.projectAccesses).find((projectAccess) => {
|
|
2400
|
+
return projectAccess.user === currentUser.id && projectAccess.project === activeProjectId;
|
|
2401
|
+
}) ?? null;
|
|
2411
2402
|
};
|
|
2412
2403
|
const selectProjectAccessForUser = (user) => (state) => {
|
|
2413
2404
|
return Object.values(state.projectAccessReducer.projectAccesses).find(
|
|
@@ -3828,7 +3819,7 @@ class AuthService extends BaseApiService {
|
|
|
3828
3819
|
return [responsePromise.then(parseTokens), uuid];
|
|
3829
3820
|
} catch (e) {
|
|
3830
3821
|
if (logoutOnFailure) {
|
|
3831
|
-
this.logout();
|
|
3822
|
+
void this.logout().then();
|
|
3832
3823
|
}
|
|
3833
3824
|
throw e;
|
|
3834
3825
|
}
|
|
@@ -3903,16 +3894,16 @@ class AuthService extends BaseApiService {
|
|
|
3903
3894
|
/**
|
|
3904
3895
|
* Logs the user out
|
|
3905
3896
|
*/
|
|
3906
|
-
logout() {
|
|
3897
|
+
async logout() {
|
|
3907
3898
|
const { store } = this.client;
|
|
3908
3899
|
store.dispatch(setLoggedIn(false));
|
|
3909
3900
|
store.dispatch(clearTokens());
|
|
3910
3901
|
store.dispatch(setActiveProjectId(null));
|
|
3911
|
-
store.dispatch(setActiveProjectAccessId(null));
|
|
3912
3902
|
store.dispatch(setActiveOrganizationAccessId(null));
|
|
3913
3903
|
store.dispatch(setActiveWorkspaceId(null));
|
|
3914
3904
|
store.dispatch({ type: RESET_STATE });
|
|
3915
3905
|
store.dispatch({ type: resetStore });
|
|
3906
|
+
await localforage.clear();
|
|
3916
3907
|
window.location.reload();
|
|
3917
3908
|
}
|
|
3918
3909
|
/**
|
|
@@ -3930,7 +3921,7 @@ class AuthService extends BaseApiService {
|
|
|
3930
3921
|
store.dispatch(setTokens({ accessToken, refreshToken }));
|
|
3931
3922
|
} catch (e) {
|
|
3932
3923
|
console.error("Could not renew tokens; logging out.");
|
|
3933
|
-
this.logout();
|
|
3924
|
+
await this.logout();
|
|
3934
3925
|
throw e;
|
|
3935
3926
|
}
|
|
3936
3927
|
}
|
|
@@ -4870,7 +4861,6 @@ class ProjectAccessService extends BaseApiService {
|
|
|
4870
4861
|
throw new Error("Current user does not have a project access instance");
|
|
4871
4862
|
}
|
|
4872
4863
|
store.dispatch(setProjectAccesses(result));
|
|
4873
|
-
store.dispatch(setActiveProjectAccessId(activeProjectAccess.offline_id));
|
|
4874
4864
|
}
|
|
4875
4865
|
}
|
|
4876
4866
|
class ProjectFileService extends BaseApiService {
|
|
@@ -5666,7 +5656,11 @@ class FileService extends BaseApiService {
|
|
|
5666
5656
|
external URLs and therefore not prepended with VITE_API_URL.`;
|
|
5667
5657
|
throw new Error(message);
|
|
5668
5658
|
}
|
|
5669
|
-
const
|
|
5659
|
+
const extension = file.type.split("/")[1];
|
|
5660
|
+
if (!extension) {
|
|
5661
|
+
throw new Error("File has no extension");
|
|
5662
|
+
}
|
|
5663
|
+
const fileName = downloadedName ?? actualSha1 + "." + extension;
|
|
5670
5664
|
file = getRenamedFile(file, fileName);
|
|
5671
5665
|
if (!file.name) {
|
|
5672
5666
|
throw new Error("Failed to set file's name");
|
|
@@ -6063,7 +6057,6 @@ export {
|
|
|
6063
6057
|
setActiveIssueId,
|
|
6064
6058
|
setActiveOrganizationAccessId,
|
|
6065
6059
|
setActiveOrganizationId,
|
|
6066
|
-
setActiveProjectAccessId,
|
|
6067
6060
|
setActiveProjectFileId,
|
|
6068
6061
|
setActiveProjectId,
|
|
6069
6062
|
setActiveWorkspaceId,
|