@overmap-ai/core 1.0.29-org-switcher-and-bug-fixes.6 → 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 -60
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +37 -60
- 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/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) {
|
|
@@ -4018,6 +4017,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4018
4017
|
store.dispatch(setLoggedIn(false));
|
|
4019
4018
|
store.dispatch(clearTokens());
|
|
4020
4019
|
store.dispatch(setActiveProjectId(null));
|
|
4020
|
+
store.dispatch(setActiveOrganizationAccessId(null));
|
|
4021
4021
|
store.dispatch(setActiveWorkspaceId(null));
|
|
4022
4022
|
store.dispatch({ type: constants.RESET_STATE });
|
|
4023
4023
|
store.dispatch({ type: resetStore });
|
|
@@ -4860,26 +4860,25 @@ var __publicField = (obj, key, value) => {
|
|
|
4860
4860
|
}
|
|
4861
4861
|
}
|
|
4862
4862
|
store.dispatch(setCurrentUser(data.user));
|
|
4863
|
-
store.dispatch(addUsers(data.project_owners));
|
|
4864
4863
|
const organizationsData = data.organizations;
|
|
4865
4864
|
store.dispatch(setOrganizations(organizationsData));
|
|
4866
|
-
const
|
|
4867
|
-
const firstOrg = organizationsData.find((organization) => organization.has_access);
|
|
4865
|
+
const firstOrg = organizationsData[0];
|
|
4868
4866
|
const currProjObj = projects.find((project) => project.id === currentProjectId);
|
|
4869
4867
|
const isOrgProject = !!(currProjObj == null ? void 0 : currProjObj.owner_organization);
|
|
4870
|
-
const userIsInProjectOrg = isOrgProject && organizationsData.some(
|
|
4871
|
-
(organization) => organization.has_access && organization.id === currProjObj.owner_organization
|
|
4872
|
-
);
|
|
4868
|
+
const userIsInProjectOrg = isOrgProject && organizationsData.some((organization) => organization.id === currProjObj.owner_organization);
|
|
4873
4869
|
let currentOrgId = null;
|
|
4874
|
-
if (
|
|
4875
|
-
currentOrgId = activeOrganizationId;
|
|
4876
|
-
} else if (userIsInProjectOrg) {
|
|
4870
|
+
if (userIsInProjectOrg) {
|
|
4877
4871
|
currentOrgId = currProjObj.owner_organization;
|
|
4878
4872
|
} else if (firstOrg) {
|
|
4879
4873
|
currentOrgId = firstOrg.id;
|
|
4880
4874
|
}
|
|
4881
4875
|
if (currentOrgId) {
|
|
4882
|
-
|
|
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));
|
|
4883
4882
|
}
|
|
4884
4883
|
if (!isProjectIdValid) {
|
|
4885
4884
|
if (projects.length !== 0) {
|
|
@@ -4932,6 +4931,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4932
4931
|
void this.client.userForms.refreshStore().then(() => {
|
|
4933
4932
|
void this.client.userFormSubmissions.refreshStore().then();
|
|
4934
4933
|
});
|
|
4934
|
+
void this.client.emailDomains.refreshStore().then();
|
|
4935
4935
|
}
|
|
4936
4936
|
if (currentProjectId) {
|
|
4937
4937
|
const [_offlineAttachments, promise] = this.client.attachments.fetchAll(currentProjectId);
|
|
@@ -5632,8 +5632,16 @@ var __publicField = (obj, key, value) => {
|
|
|
5632
5632
|
blockers: [],
|
|
5633
5633
|
blocks: []
|
|
5634
5634
|
});
|
|
5635
|
+
const currentUser = state.userReducer.currentUser;
|
|
5635
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
|
+
}
|
|
5636
5643
|
store.dispatch(setOrganizationAccesses(organizationAccesses));
|
|
5644
|
+
store.dispatch(setActiveOrganizationAccessId(activeOrganizationAccess.offline_id));
|
|
5637
5645
|
}
|
|
5638
5646
|
}
|
|
5639
5647
|
const cachedRequestPromises = {};
|
|
@@ -5901,37 +5909,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5901
5909
|
}
|
|
5902
5910
|
}
|
|
5903
5911
|
class OrganizationService extends BaseApiService {
|
|
5904
|
-
async fetchInitialOrganizationData(organization_id, showLoading) {
|
|
5905
|
-
if (showLoading) {
|
|
5906
|
-
this.client.store.dispatch(setIsFetchingInitialData(true));
|
|
5907
|
-
}
|
|
5908
|
-
return this.enqueueRequest({
|
|
5909
|
-
description: "Get initial organization data",
|
|
5910
|
-
method: HttpMethod.GET,
|
|
5911
|
-
url: `/organizations/${organization_id}/initial-data/`,
|
|
5912
|
-
payload: {},
|
|
5913
|
-
isAuthNeeded: true,
|
|
5914
|
-
blockers: [],
|
|
5915
|
-
blocks: []
|
|
5916
|
-
}).then((result) => {
|
|
5917
|
-
this._processInitialOrganizationData(result, showLoading);
|
|
5918
|
-
return result;
|
|
5919
|
-
});
|
|
5920
|
-
}
|
|
5921
|
-
_processInitialOrganizationData(data, showLoading) {
|
|
5922
|
-
const { store } = this.client;
|
|
5923
|
-
const activeOrganization = data.organization;
|
|
5924
|
-
const organizationAccesses = data.organization_accesses;
|
|
5925
|
-
const email_domains = data.email_domains;
|
|
5926
|
-
const users = data.users;
|
|
5927
|
-
store.dispatch(addUsers(users));
|
|
5928
|
-
store.dispatch(setActiveOrganizationId(activeOrganization.id));
|
|
5929
|
-
store.dispatch(setOrganizationAccesses(organizationAccesses));
|
|
5930
|
-
store.dispatch(setEmailDomains(email_domains));
|
|
5931
|
-
if (showLoading) {
|
|
5932
|
-
store.dispatch(setIsFetchingInitialData(false));
|
|
5933
|
-
}
|
|
5934
|
-
}
|
|
5935
5912
|
async create(name) {
|
|
5936
5913
|
const result = await this.enqueueRequest({
|
|
5937
5914
|
description: "Create organization",
|
|
@@ -6298,7 +6275,6 @@ var __publicField = (obj, key, value) => {
|
|
|
6298
6275
|
exports2.selectOrganizationUsersAsMapping = selectOrganizationUsersAsMapping;
|
|
6299
6276
|
exports2.selectOrganizationUsersIds = selectOrganizationUsersIds;
|
|
6300
6277
|
exports2.selectOrganizations = selectOrganizations;
|
|
6301
|
-
exports2.selectOrganizationsWithAccess = selectOrganizationsWithAccess;
|
|
6302
6278
|
exports2.selectPermittedWorkspaceIds = selectPermittedWorkspaceIds;
|
|
6303
6279
|
exports2.selectPhotoAttachmentsOfIssue = selectPhotoAttachmentsOfIssue;
|
|
6304
6280
|
exports2.selectProjectAccess = selectProjectAccess;
|
|
@@ -6340,6 +6316,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6340
6316
|
exports2.selectWorkspaceMapping = selectWorkspaceMapping;
|
|
6341
6317
|
exports2.selectWorkspaces = selectWorkspaces;
|
|
6342
6318
|
exports2.setActiveIssueId = setActiveIssueId;
|
|
6319
|
+
exports2.setActiveOrganizationAccessId = setActiveOrganizationAccessId;
|
|
6343
6320
|
exports2.setActiveOrganizationId = setActiveOrganizationId;
|
|
6344
6321
|
exports2.setActiveProjectFileId = setActiveProjectFileId;
|
|
6345
6322
|
exports2.setActiveProjectId = setActiveProjectId;
|