@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
|
@@ -2336,7 +2336,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2336
2336
|
const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
|
|
2337
2337
|
const userReducer = userSlice.reducer;
|
|
2338
2338
|
const initialState$a = {
|
|
2339
|
-
organizationAccesses: {}
|
|
2339
|
+
organizationAccesses: {},
|
|
2340
|
+
activeOrganizationAccessId: null
|
|
2340
2341
|
};
|
|
2341
2342
|
const organizationAccessSlice = toolkit.createSlice({
|
|
2342
2343
|
name: "organizationAccess",
|
|
@@ -2372,28 +2373,31 @@ var __publicField = (obj, key, value) => {
|
|
|
2372
2373
|
`Tried to remove organization access with ID that doesn't exist: ${action.payload.offline_id}`
|
|
2373
2374
|
);
|
|
2374
2375
|
}
|
|
2376
|
+
},
|
|
2377
|
+
setActiveOrganizationAccessId: (state, action) => {
|
|
2378
|
+
state.activeOrganizationAccessId = action.payload;
|
|
2375
2379
|
}
|
|
2376
2380
|
}
|
|
2377
2381
|
});
|
|
2378
|
-
const {
|
|
2382
|
+
const {
|
|
2383
|
+
setOrganizationAccesses,
|
|
2384
|
+
updateOrganizationAccess,
|
|
2385
|
+
removeOrganizationAccess,
|
|
2386
|
+
setActiveOrganizationAccessId
|
|
2387
|
+
} = organizationAccessSlice.actions;
|
|
2379
2388
|
const selectOrganizationAccesses = (state) => {
|
|
2380
2389
|
return state.organizationAccessReducer.organizationAccesses;
|
|
2381
2390
|
};
|
|
2382
2391
|
const selectOrganizationAccess = (organizationAccessId) => (state) => {
|
|
2383
2392
|
return state.organizationAccessReducer.organizationAccesses[organizationAccessId];
|
|
2384
2393
|
};
|
|
2385
|
-
const selectActiveOrganizationAccess =
|
|
2386
|
-
|
|
2387
|
-
(
|
|
2388
|
-
|
|
2389
|
-
(organizationAccess) => organizationAccess.user === currentUser.id
|
|
2390
|
-
);
|
|
2391
|
-
if (!activeOrganizationAccess) {
|
|
2392
|
-
return null;
|
|
2393
|
-
}
|
|
2394
|
-
return activeOrganizationAccess;
|
|
2394
|
+
const selectActiveOrganizationAccess = (state) => {
|
|
2395
|
+
const activeOrganizationAccessId = state.organizationAccessReducer.activeOrganizationAccessId;
|
|
2396
|
+
if (!activeOrganizationAccessId) {
|
|
2397
|
+
return null;
|
|
2395
2398
|
}
|
|
2396
|
-
|
|
2399
|
+
return state.organizationAccessReducer.organizationAccesses[activeOrganizationAccessId] ?? null;
|
|
2400
|
+
};
|
|
2397
2401
|
const selectOrganizationAccessForUser = (user) => (state) => {
|
|
2398
2402
|
return Object.values(state.organizationAccessReducer.organizationAccesses).find(
|
|
2399
2403
|
(organizationAccess) => organizationAccess.user === user.id
|
|
@@ -2442,11 +2446,6 @@ var __publicField = (obj, key, value) => {
|
|
|
2442
2446
|
const selectOrganizations = (state) => {
|
|
2443
2447
|
return Object.values(state.organizationReducer.organizations);
|
|
2444
2448
|
};
|
|
2445
|
-
const selectOrganizationsWithAccess = (state) => {
|
|
2446
|
-
return Object.values(state.organizationReducer.organizations).filter(
|
|
2447
|
-
(organization) => organization.has_access
|
|
2448
|
-
);
|
|
2449
|
-
};
|
|
2450
2449
|
const selectActiveOrganization = (state) => {
|
|
2451
2450
|
const id = selectActiveOrganizationId(state);
|
|
2452
2451
|
if (!id) {
|
|
@@ -2691,21 +2690,6 @@ var __publicField = (obj, key, value) => {
|
|
|
2691
2690
|
const selectRecentProjects = (state) => {
|
|
2692
2691
|
return state.projectReducer.recentProjectIds;
|
|
2693
2692
|
};
|
|
2694
|
-
const selectSortedProjects = toolkit.createSelector(
|
|
2695
|
-
[selectActiveProject, selectProjects],
|
|
2696
|
-
(activeProject, projects) => {
|
|
2697
|
-
return Object.values(projects).sort((projectA, projectB) => {
|
|
2698
|
-
if (activeProject) {
|
|
2699
|
-
if (activeProject.id === projectA.id) {
|
|
2700
|
-
return -1;
|
|
2701
|
-
} else if (activeProject.id === projectB.id) {
|
|
2702
|
-
return 1;
|
|
2703
|
-
}
|
|
2704
|
-
}
|
|
2705
|
-
return projectA.name.toLowerCase().localeCompare(projectB.name.toLowerCase(), void 0, { numeric: true });
|
|
2706
|
-
});
|
|
2707
|
-
}
|
|
2708
|
-
);
|
|
2709
2693
|
const selectCreateProjectType = (state) => state.projectReducer.createProjectType;
|
|
2710
2694
|
const projectReducer = projectSlice.reducer;
|
|
2711
2695
|
const selectProjectUsersIds = toolkit.createSelector(
|
|
@@ -4033,6 +4017,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4033
4017
|
store.dispatch(setLoggedIn(false));
|
|
4034
4018
|
store.dispatch(clearTokens());
|
|
4035
4019
|
store.dispatch(setActiveProjectId(null));
|
|
4020
|
+
store.dispatch(setActiveOrganizationAccessId(null));
|
|
4036
4021
|
store.dispatch(setActiveWorkspaceId(null));
|
|
4037
4022
|
store.dispatch({ type: constants.RESET_STATE });
|
|
4038
4023
|
store.dispatch({ type: resetStore });
|
|
@@ -4875,26 +4860,25 @@ var __publicField = (obj, key, value) => {
|
|
|
4875
4860
|
}
|
|
4876
4861
|
}
|
|
4877
4862
|
store.dispatch(setCurrentUser(data.user));
|
|
4878
|
-
store.dispatch(addUsers(data.project_owners));
|
|
4879
4863
|
const organizationsData = data.organizations;
|
|
4880
4864
|
store.dispatch(setOrganizations(organizationsData));
|
|
4881
|
-
const
|
|
4882
|
-
const firstOrg = organizationsData.find((organization) => organization.has_access);
|
|
4865
|
+
const firstOrg = organizationsData[0];
|
|
4883
4866
|
const currProjObj = projects.find((project) => project.id === currentProjectId);
|
|
4884
4867
|
const isOrgProject = !!(currProjObj == null ? void 0 : currProjObj.owner_organization);
|
|
4885
|
-
const userIsInProjectOrg = isOrgProject && organizationsData.some(
|
|
4886
|
-
(organization) => organization.has_access && organization.id === currProjObj.owner_organization
|
|
4887
|
-
);
|
|
4868
|
+
const userIsInProjectOrg = isOrgProject && organizationsData.some((organization) => organization.id === currProjObj.owner_organization);
|
|
4888
4869
|
let currentOrgId = null;
|
|
4889
|
-
if (
|
|
4890
|
-
currentOrgId = activeOrganizationId;
|
|
4891
|
-
} else if (userIsInProjectOrg) {
|
|
4870
|
+
if (userIsInProjectOrg) {
|
|
4892
4871
|
currentOrgId = currProjObj.owner_organization;
|
|
4893
4872
|
} else if (firstOrg) {
|
|
4894
4873
|
currentOrgId = firstOrg.id;
|
|
4895
4874
|
}
|
|
4896
4875
|
if (currentOrgId) {
|
|
4897
|
-
|
|
4876
|
+
store.dispatch(setActiveOrganizationId(currentOrgId));
|
|
4877
|
+
const orgUsersResultPromise = this.fetchOrganizationUsers(currentOrgId);
|
|
4878
|
+
const organizationAccessRefreshPromise = this.client.organizationAccess.refreshStore();
|
|
4879
|
+
const orgUsersResult = await orgUsersResultPromise;
|
|
4880
|
+
await organizationAccessRefreshPromise;
|
|
4881
|
+
store.dispatch(addUsers(orgUsersResult));
|
|
4898
4882
|
}
|
|
4899
4883
|
if (!isProjectIdValid) {
|
|
4900
4884
|
if (projects.length !== 0) {
|
|
@@ -4947,6 +4931,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4947
4931
|
void this.client.userForms.refreshStore().then(() => {
|
|
4948
4932
|
void this.client.userFormSubmissions.refreshStore().then();
|
|
4949
4933
|
});
|
|
4934
|
+
void this.client.emailDomains.refreshStore().then();
|
|
4950
4935
|
}
|
|
4951
4936
|
if (currentProjectId) {
|
|
4952
4937
|
const [_offlineAttachments, promise] = this.client.attachments.fetchAll(currentProjectId);
|
|
@@ -5647,8 +5632,16 @@ var __publicField = (obj, key, value) => {
|
|
|
5647
5632
|
blockers: [],
|
|
5648
5633
|
blocks: []
|
|
5649
5634
|
});
|
|
5635
|
+
const currentUser = state.userReducer.currentUser;
|
|
5650
5636
|
const organizationAccesses = result;
|
|
5637
|
+
const activeOrganizationAccess = organizationAccesses.find(
|
|
5638
|
+
(organizationAccess) => organizationAccess.user === currentUser.id
|
|
5639
|
+
);
|
|
5640
|
+
if (!activeOrganizationAccess) {
|
|
5641
|
+
throw new Error("Current user does not have an organization access instance");
|
|
5642
|
+
}
|
|
5651
5643
|
store.dispatch(setOrganizationAccesses(organizationAccesses));
|
|
5644
|
+
store.dispatch(setActiveOrganizationAccessId(activeOrganizationAccess.offline_id));
|
|
5652
5645
|
}
|
|
5653
5646
|
}
|
|
5654
5647
|
const cachedRequestPromises = {};
|
|
@@ -5916,37 +5909,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5916
5909
|
}
|
|
5917
5910
|
}
|
|
5918
5911
|
class OrganizationService extends BaseApiService {
|
|
5919
|
-
async fetchInitialOrganizationData(organization_id, showLoading) {
|
|
5920
|
-
if (showLoading) {
|
|
5921
|
-
this.client.store.dispatch(setIsFetchingInitialData(true));
|
|
5922
|
-
}
|
|
5923
|
-
return this.enqueueRequest({
|
|
5924
|
-
description: "Get initial organization data",
|
|
5925
|
-
method: HttpMethod.GET,
|
|
5926
|
-
url: `/organizations/${organization_id}/initial-data/`,
|
|
5927
|
-
payload: {},
|
|
5928
|
-
isAuthNeeded: true,
|
|
5929
|
-
blockers: [],
|
|
5930
|
-
blocks: []
|
|
5931
|
-
}).then((result) => {
|
|
5932
|
-
this._processInitialOrganizationData(result, showLoading);
|
|
5933
|
-
return result;
|
|
5934
|
-
});
|
|
5935
|
-
}
|
|
5936
|
-
_processInitialOrganizationData(data, showLoading) {
|
|
5937
|
-
const { store } = this.client;
|
|
5938
|
-
const activeOrganization = data.organization;
|
|
5939
|
-
const organizationAccesses = data.organization_accesses;
|
|
5940
|
-
const email_domains = data.email_domains;
|
|
5941
|
-
const users = data.users;
|
|
5942
|
-
store.dispatch(addUsers(users));
|
|
5943
|
-
store.dispatch(setActiveOrganizationId(activeOrganization.id));
|
|
5944
|
-
store.dispatch(setOrganizationAccesses(organizationAccesses));
|
|
5945
|
-
store.dispatch(setEmailDomains(email_domains));
|
|
5946
|
-
if (showLoading) {
|
|
5947
|
-
store.dispatch(setIsFetchingInitialData(false));
|
|
5948
|
-
}
|
|
5949
|
-
}
|
|
5950
5912
|
async create(name) {
|
|
5951
5913
|
const result = await this.enqueueRequest({
|
|
5952
5914
|
description: "Create organization",
|
|
@@ -6313,7 +6275,6 @@ var __publicField = (obj, key, value) => {
|
|
|
6313
6275
|
exports2.selectOrganizationUsersAsMapping = selectOrganizationUsersAsMapping;
|
|
6314
6276
|
exports2.selectOrganizationUsersIds = selectOrganizationUsersIds;
|
|
6315
6277
|
exports2.selectOrganizations = selectOrganizations;
|
|
6316
|
-
exports2.selectOrganizationsWithAccess = selectOrganizationsWithAccess;
|
|
6317
6278
|
exports2.selectPermittedWorkspaceIds = selectPermittedWorkspaceIds;
|
|
6318
6279
|
exports2.selectPhotoAttachmentsOfIssue = selectPhotoAttachmentsOfIssue;
|
|
6319
6280
|
exports2.selectProjectAccess = selectProjectAccess;
|
|
@@ -6334,7 +6295,6 @@ var __publicField = (obj, key, value) => {
|
|
|
6334
6295
|
exports2.selectSortedEmailDomains = selectSortedEmailDomains;
|
|
6335
6296
|
exports2.selectSortedOrganizationUsers = selectSortedOrganizationUsers;
|
|
6336
6297
|
exports2.selectSortedProjectUsers = selectSortedProjectUsers;
|
|
6337
|
-
exports2.selectSortedProjects = selectSortedProjects;
|
|
6338
6298
|
exports2.selectStageMapping = selectStageMapping;
|
|
6339
6299
|
exports2.selectStages = selectStages;
|
|
6340
6300
|
exports2.selectStagesFromComponentType = selectStagesFromComponentType;
|
|
@@ -6356,6 +6316,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6356
6316
|
exports2.selectWorkspaceMapping = selectWorkspaceMapping;
|
|
6357
6317
|
exports2.selectWorkspaces = selectWorkspaces;
|
|
6358
6318
|
exports2.setActiveIssueId = setActiveIssueId;
|
|
6319
|
+
exports2.setActiveOrganizationAccessId = setActiveOrganizationAccessId;
|
|
6359
6320
|
exports2.setActiveOrganizationId = setActiveOrganizationId;
|
|
6360
6321
|
exports2.setActiveProjectFileId = setActiveProjectFileId;
|
|
6361
6322
|
exports2.setActiveProjectId = setActiveProjectId;
|