@overmap-ai/core 1.0.29-org-switcher-and-bug-fixes.7 → 1.0.29
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 +37 -76
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +37 -76
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/classes/OutboxCoordinator.d.ts +1 -0
- package/dist/sdk/services/MainService.d.ts +0 -1
- package/dist/sdk/services/OrganizationService.d.ts +1 -3
- package/dist/store/slices/categorySlice.d.ts +21 -21
- package/dist/store/slices/issueSlice.d.ts +19 -19
- package/dist/store/slices/organizationAccessSlice.d.ts +5 -1
- package/dist/store/slices/organizationSlice.d.ts +0 -1
- package/dist/store/slices/projectFileSlice.d.ts +20 -20
- package/dist/store/slices/projectSlice.d.ts +0 -1
- package/dist/store/slices/userFormSlice.d.ts +10 -10
- package/dist/store/slices/workspaceSlice.d.ts +21 -21
- package/dist/store/store.d.ts +64 -63
- package/dist/typings/models/organizations.d.ts +0 -10
- package/dist/typings/models/store.d.ts +1 -0
- package/package.json +1 -1
package/dist/overmap-core.js
CHANGED
|
@@ -2348,7 +2348,8 @@ const selectUsersAsMapping = (state) => state.userReducer.users;
|
|
|
2348
2348
|
const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
|
|
2349
2349
|
const userReducer = userSlice.reducer;
|
|
2350
2350
|
const initialState$a = {
|
|
2351
|
-
organizationAccesses: {}
|
|
2351
|
+
organizationAccesses: {},
|
|
2352
|
+
activeOrganizationAccessId: null
|
|
2352
2353
|
};
|
|
2353
2354
|
const organizationAccessSlice = createSlice({
|
|
2354
2355
|
name: "organizationAccess",
|
|
@@ -2384,28 +2385,31 @@ const organizationAccessSlice = createSlice({
|
|
|
2384
2385
|
`Tried to remove organization access with ID that doesn't exist: ${action.payload.offline_id}`
|
|
2385
2386
|
);
|
|
2386
2387
|
}
|
|
2388
|
+
},
|
|
2389
|
+
setActiveOrganizationAccessId: (state, action) => {
|
|
2390
|
+
state.activeOrganizationAccessId = action.payload;
|
|
2387
2391
|
}
|
|
2388
2392
|
}
|
|
2389
2393
|
});
|
|
2390
|
-
const {
|
|
2394
|
+
const {
|
|
2395
|
+
setOrganizationAccesses,
|
|
2396
|
+
updateOrganizationAccess,
|
|
2397
|
+
removeOrganizationAccess,
|
|
2398
|
+
setActiveOrganizationAccessId
|
|
2399
|
+
} = organizationAccessSlice.actions;
|
|
2391
2400
|
const selectOrganizationAccesses = (state) => {
|
|
2392
2401
|
return state.organizationAccessReducer.organizationAccesses;
|
|
2393
2402
|
};
|
|
2394
2403
|
const selectOrganizationAccess = (organizationAccessId) => (state) => {
|
|
2395
2404
|
return state.organizationAccessReducer.organizationAccesses[organizationAccessId];
|
|
2396
2405
|
};
|
|
2397
|
-
const selectActiveOrganizationAccess =
|
|
2398
|
-
|
|
2399
|
-
(
|
|
2400
|
-
|
|
2401
|
-
(organizationAccess) => organizationAccess.user === currentUser.id
|
|
2402
|
-
);
|
|
2403
|
-
if (!activeOrganizationAccess) {
|
|
2404
|
-
return null;
|
|
2405
|
-
}
|
|
2406
|
-
return activeOrganizationAccess;
|
|
2406
|
+
const selectActiveOrganizationAccess = (state) => {
|
|
2407
|
+
const activeOrganizationAccessId = state.organizationAccessReducer.activeOrganizationAccessId;
|
|
2408
|
+
if (!activeOrganizationAccessId) {
|
|
2409
|
+
return null;
|
|
2407
2410
|
}
|
|
2408
|
-
|
|
2411
|
+
return state.organizationAccessReducer.organizationAccesses[activeOrganizationAccessId] ?? null;
|
|
2412
|
+
};
|
|
2409
2413
|
const selectOrganizationAccessForUser = (user) => (state) => {
|
|
2410
2414
|
return Object.values(state.organizationAccessReducer.organizationAccesses).find(
|
|
2411
2415
|
(organizationAccess) => organizationAccess.user === user.id
|
|
@@ -2454,11 +2458,6 @@ const selectActiveOrganizationId = (state) => {
|
|
|
2454
2458
|
const selectOrganizations = (state) => {
|
|
2455
2459
|
return Object.values(state.organizationReducer.organizations);
|
|
2456
2460
|
};
|
|
2457
|
-
const selectOrganizationsWithAccess = (state) => {
|
|
2458
|
-
return Object.values(state.organizationReducer.organizations).filter(
|
|
2459
|
-
(organization) => organization.has_access
|
|
2460
|
-
);
|
|
2461
|
-
};
|
|
2462
2461
|
const selectActiveOrganization = (state) => {
|
|
2463
2462
|
const id = selectActiveOrganizationId(state);
|
|
2464
2463
|
if (!id) {
|
|
@@ -2703,21 +2702,6 @@ const selectActiveProject = (state) => {
|
|
|
2703
2702
|
const selectRecentProjects = (state) => {
|
|
2704
2703
|
return state.projectReducer.recentProjectIds;
|
|
2705
2704
|
};
|
|
2706
|
-
const selectSortedProjects = createSelector(
|
|
2707
|
-
[selectActiveProject, selectProjects],
|
|
2708
|
-
(activeProject, projects) => {
|
|
2709
|
-
return Object.values(projects).sort((projectA, projectB) => {
|
|
2710
|
-
if (activeProject) {
|
|
2711
|
-
if (activeProject.id === projectA.id) {
|
|
2712
|
-
return -1;
|
|
2713
|
-
} else if (activeProject.id === projectB.id) {
|
|
2714
|
-
return 1;
|
|
2715
|
-
}
|
|
2716
|
-
}
|
|
2717
|
-
return projectA.name.toLowerCase().localeCompare(projectB.name.toLowerCase(), void 0, { numeric: true });
|
|
2718
|
-
});
|
|
2719
|
-
}
|
|
2720
|
-
);
|
|
2721
2705
|
const selectCreateProjectType = (state) => state.projectReducer.createProjectType;
|
|
2722
2706
|
const projectReducer = projectSlice.reducer;
|
|
2723
2707
|
const selectProjectUsersIds = createSelector(
|
|
@@ -4045,6 +4029,7 @@ class AuthService extends BaseApiService {
|
|
|
4045
4029
|
store.dispatch(setLoggedIn(false));
|
|
4046
4030
|
store.dispatch(clearTokens());
|
|
4047
4031
|
store.dispatch(setActiveProjectId(null));
|
|
4032
|
+
store.dispatch(setActiveOrganizationAccessId(null));
|
|
4048
4033
|
store.dispatch(setActiveWorkspaceId(null));
|
|
4049
4034
|
store.dispatch({ type: RESET_STATE });
|
|
4050
4035
|
store.dispatch({ type: resetStore });
|
|
@@ -4887,26 +4872,25 @@ class MainService extends BaseApiService {
|
|
|
4887
4872
|
}
|
|
4888
4873
|
}
|
|
4889
4874
|
store.dispatch(setCurrentUser(data.user));
|
|
4890
|
-
store.dispatch(addUsers(data.project_owners));
|
|
4891
4875
|
const organizationsData = data.organizations;
|
|
4892
4876
|
store.dispatch(setOrganizations(organizationsData));
|
|
4893
|
-
const
|
|
4894
|
-
const firstOrg = organizationsData.find((organization) => organization.has_access);
|
|
4877
|
+
const firstOrg = organizationsData[0];
|
|
4895
4878
|
const currProjObj = projects.find((project) => project.id === currentProjectId);
|
|
4896
4879
|
const isOrgProject = !!(currProjObj == null ? void 0 : currProjObj.owner_organization);
|
|
4897
|
-
const userIsInProjectOrg = isOrgProject && organizationsData.some(
|
|
4898
|
-
(organization) => organization.has_access && organization.id === currProjObj.owner_organization
|
|
4899
|
-
);
|
|
4880
|
+
const userIsInProjectOrg = isOrgProject && organizationsData.some((organization) => organization.id === currProjObj.owner_organization);
|
|
4900
4881
|
let currentOrgId = null;
|
|
4901
|
-
if (
|
|
4902
|
-
currentOrgId = activeOrganizationId;
|
|
4903
|
-
} else if (userIsInProjectOrg) {
|
|
4882
|
+
if (userIsInProjectOrg) {
|
|
4904
4883
|
currentOrgId = currProjObj.owner_organization;
|
|
4905
4884
|
} else if (firstOrg) {
|
|
4906
4885
|
currentOrgId = firstOrg.id;
|
|
4907
4886
|
}
|
|
4908
4887
|
if (currentOrgId) {
|
|
4909
|
-
|
|
4888
|
+
store.dispatch(setActiveOrganizationId(currentOrgId));
|
|
4889
|
+
const orgUsersResultPromise = this.fetchOrganizationUsers(currentOrgId);
|
|
4890
|
+
const organizationAccessRefreshPromise = this.client.organizationAccess.refreshStore();
|
|
4891
|
+
const orgUsersResult = await orgUsersResultPromise;
|
|
4892
|
+
await organizationAccessRefreshPromise;
|
|
4893
|
+
store.dispatch(addUsers(orgUsersResult));
|
|
4910
4894
|
}
|
|
4911
4895
|
if (!isProjectIdValid) {
|
|
4912
4896
|
if (projects.length !== 0) {
|
|
@@ -4959,6 +4943,7 @@ class MainService extends BaseApiService {
|
|
|
4959
4943
|
void this.client.userForms.refreshStore().then(() => {
|
|
4960
4944
|
void this.client.userFormSubmissions.refreshStore().then();
|
|
4961
4945
|
});
|
|
4946
|
+
void this.client.emailDomains.refreshStore().then();
|
|
4962
4947
|
}
|
|
4963
4948
|
if (currentProjectId) {
|
|
4964
4949
|
const [_offlineAttachments, promise] = this.client.attachments.fetchAll(currentProjectId);
|
|
@@ -5659,8 +5644,16 @@ class OrganizationAccessService extends BaseApiService {
|
|
|
5659
5644
|
blockers: [],
|
|
5660
5645
|
blocks: []
|
|
5661
5646
|
});
|
|
5647
|
+
const currentUser = state.userReducer.currentUser;
|
|
5662
5648
|
const organizationAccesses = result;
|
|
5649
|
+
const activeOrganizationAccess = organizationAccesses.find(
|
|
5650
|
+
(organizationAccess) => organizationAccess.user === currentUser.id
|
|
5651
|
+
);
|
|
5652
|
+
if (!activeOrganizationAccess) {
|
|
5653
|
+
throw new Error("Current user does not have an organization access instance");
|
|
5654
|
+
}
|
|
5663
5655
|
store.dispatch(setOrganizationAccesses(organizationAccesses));
|
|
5656
|
+
store.dispatch(setActiveOrganizationAccessId(activeOrganizationAccess.offline_id));
|
|
5664
5657
|
}
|
|
5665
5658
|
}
|
|
5666
5659
|
const cachedRequestPromises = {};
|
|
@@ -5928,37 +5921,6 @@ class EmailDomainsService extends BaseApiService {
|
|
|
5928
5921
|
}
|
|
5929
5922
|
}
|
|
5930
5923
|
class OrganizationService extends BaseApiService {
|
|
5931
|
-
async fetchInitialOrganizationData(organization_id, showLoading) {
|
|
5932
|
-
if (showLoading) {
|
|
5933
|
-
this.client.store.dispatch(setIsFetchingInitialData(true));
|
|
5934
|
-
}
|
|
5935
|
-
return this.enqueueRequest({
|
|
5936
|
-
description: "Get initial organization data",
|
|
5937
|
-
method: HttpMethod.GET,
|
|
5938
|
-
url: `/organizations/${organization_id}/initial-data/`,
|
|
5939
|
-
payload: {},
|
|
5940
|
-
isAuthNeeded: true,
|
|
5941
|
-
blockers: [],
|
|
5942
|
-
blocks: []
|
|
5943
|
-
}).then((result) => {
|
|
5944
|
-
this._processInitialOrganizationData(result, showLoading);
|
|
5945
|
-
return result;
|
|
5946
|
-
});
|
|
5947
|
-
}
|
|
5948
|
-
_processInitialOrganizationData(data, showLoading) {
|
|
5949
|
-
const { store } = this.client;
|
|
5950
|
-
const activeOrganization = data.organization;
|
|
5951
|
-
const organizationAccesses = data.organization_accesses;
|
|
5952
|
-
const email_domains = data.email_domains;
|
|
5953
|
-
const users = data.users;
|
|
5954
|
-
store.dispatch(addUsers(users));
|
|
5955
|
-
store.dispatch(setActiveOrganizationId(activeOrganization.id));
|
|
5956
|
-
store.dispatch(setOrganizationAccesses(organizationAccesses));
|
|
5957
|
-
store.dispatch(setEmailDomains(email_domains));
|
|
5958
|
-
if (showLoading) {
|
|
5959
|
-
store.dispatch(setIsFetchingInitialData(false));
|
|
5960
|
-
}
|
|
5961
|
-
}
|
|
5962
5924
|
async create(name) {
|
|
5963
5925
|
const result = await this.enqueueRequest({
|
|
5964
5926
|
description: "Create organization",
|
|
@@ -6327,7 +6289,6 @@ export {
|
|
|
6327
6289
|
selectOrganizationUsersAsMapping,
|
|
6328
6290
|
selectOrganizationUsersIds,
|
|
6329
6291
|
selectOrganizations,
|
|
6330
|
-
selectOrganizationsWithAccess,
|
|
6331
6292
|
selectPermittedWorkspaceIds,
|
|
6332
6293
|
selectPhotoAttachmentsOfIssue,
|
|
6333
6294
|
selectProjectAccess,
|
|
@@ -6348,7 +6309,6 @@ export {
|
|
|
6348
6309
|
selectSortedEmailDomains,
|
|
6349
6310
|
selectSortedOrganizationUsers,
|
|
6350
6311
|
selectSortedProjectUsers,
|
|
6351
|
-
selectSortedProjects,
|
|
6352
6312
|
selectStageMapping,
|
|
6353
6313
|
selectStages,
|
|
6354
6314
|
selectStagesFromComponentType,
|
|
@@ -6370,6 +6330,7 @@ export {
|
|
|
6370
6330
|
selectWorkspaceMapping,
|
|
6371
6331
|
selectWorkspaces,
|
|
6372
6332
|
setActiveIssueId,
|
|
6333
|
+
setActiveOrganizationAccessId,
|
|
6373
6334
|
setActiveOrganizationId,
|
|
6374
6335
|
setActiveProjectFileId,
|
|
6375
6336
|
setActiveProjectId,
|