@overmap-ai/core 1.0.35-projects-licensing.15 → 1.0.35
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/forms/renderer/PatchForm/Provider.d.ts +4 -0
- package/dist/overmap-core.js +229 -429
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +229 -429
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/sdk.d.ts +1 -2
- package/dist/sdk/services/MainService.d.ts +1 -2
- package/dist/sdk/services/ProjectService.d.ts +3 -2
- package/dist/sdk/services/index.d.ts +0 -1
- package/dist/store/slices/categorySlice.d.ts +0 -1
- package/dist/store/slices/index.d.ts +0 -1
- package/dist/store/slices/issueSlice.d.ts +0 -1
- package/dist/store/slices/organizationSlice.d.ts +1 -5
- package/dist/store/slices/projectFileSlice.d.ts +0 -1
- package/dist/store/slices/projectSlice.d.ts +1 -7
- package/dist/store/slices/workspaceSlice.d.ts +0 -1
- package/dist/store/store.d.ts +1 -4
- package/dist/typings/models/base.d.ts +0 -4
- package/dist/typings/models/index.d.ts +0 -1
- package/dist/typings/models/organizations.d.ts +0 -2
- package/dist/typings/models/projects.d.ts +0 -2
- package/package.json +1 -1
- package/dist/sdk/services/LicenseService.d.ts +0 -9
- package/dist/store/slices/licenseSlice.d.ts +0 -25
- package/dist/typings/models/license.d.ts +0 -19
package/dist/overmap-core.js
CHANGED
|
@@ -626,15 +626,15 @@ const wrapMigration = (migrator) => (state) => {
|
|
|
626
626
|
};
|
|
627
627
|
const migrations = [initialVersioning, signOut, signOut, createOutboxState];
|
|
628
628
|
const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
|
|
629
|
-
const initialState$
|
|
629
|
+
const initialState$l = {
|
|
630
630
|
accessToken: "",
|
|
631
631
|
refreshToken: "",
|
|
632
632
|
isLoggedIn: false
|
|
633
633
|
};
|
|
634
634
|
const authSlice = createSlice({
|
|
635
635
|
name: "auth",
|
|
636
|
-
initialState: initialState$
|
|
637
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
636
|
+
initialState: initialState$l,
|
|
637
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
|
|
638
638
|
reducers: {
|
|
639
639
|
setTokens: (state, action) => {
|
|
640
640
|
state.accessToken = action.payload.accessToken;
|
|
@@ -1338,7 +1338,7 @@ const getLocalRelativeDateString = memoize((date, min, max) => {
|
|
|
1338
1338
|
return getLocalDateString(date);
|
|
1339
1339
|
return relative.format(days, "days");
|
|
1340
1340
|
});
|
|
1341
|
-
const initialState$
|
|
1341
|
+
const initialState$k = {
|
|
1342
1342
|
categories: {},
|
|
1343
1343
|
usedCategoryColors: [],
|
|
1344
1344
|
categoryVisibility: {
|
|
@@ -1348,8 +1348,8 @@ const initialState$l = {
|
|
|
1348
1348
|
};
|
|
1349
1349
|
const categorySlice = createSlice({
|
|
1350
1350
|
name: "categories",
|
|
1351
|
-
initialState: initialState$
|
|
1352
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1351
|
+
initialState: initialState$k,
|
|
1352
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
|
|
1353
1353
|
reducers: {
|
|
1354
1354
|
setCategories: (state, action) => {
|
|
1355
1355
|
if (!Array.isArray(action.payload))
|
|
@@ -1482,13 +1482,13 @@ const selectHiddenCategoryCount = (state) => {
|
|
|
1482
1482
|
return hiddenCategoryCount;
|
|
1483
1483
|
};
|
|
1484
1484
|
const categoryReducer = categorySlice.reducer;
|
|
1485
|
-
const initialState$
|
|
1485
|
+
const initialState$j = {
|
|
1486
1486
|
components: {}
|
|
1487
1487
|
};
|
|
1488
1488
|
const componentSlice = createSlice({
|
|
1489
1489
|
name: "components",
|
|
1490
|
-
initialState: initialState$
|
|
1491
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1490
|
+
initialState: initialState$j,
|
|
1491
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
|
|
1492
1492
|
reducers: {
|
|
1493
1493
|
addComponent: (state, action) => {
|
|
1494
1494
|
state.components[action.payload.offline_id] = action.payload;
|
|
@@ -1600,13 +1600,13 @@ const {
|
|
|
1600
1600
|
removeAllComponentsOfType
|
|
1601
1601
|
} = componentSlice.actions;
|
|
1602
1602
|
const componentReducer = componentSlice.reducer;
|
|
1603
|
-
const initialState$
|
|
1603
|
+
const initialState$i = {
|
|
1604
1604
|
completionsByComponentId: {}
|
|
1605
1605
|
};
|
|
1606
1606
|
const componentStageCompletionSlice = createSlice({
|
|
1607
1607
|
name: "componentStageCompletions",
|
|
1608
|
-
initialState: initialState$
|
|
1609
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1608
|
+
initialState: initialState$i,
|
|
1609
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
|
|
1610
1610
|
reducers: {
|
|
1611
1611
|
addStageCompletion: (state, action) => {
|
|
1612
1612
|
let stageToCompletionDateMapping = state.completionsByComponentId[action.payload.component];
|
|
@@ -1657,13 +1657,13 @@ const selectCompletedStageIdsForComponent = (component) => (state) => {
|
|
|
1657
1657
|
return Object.keys(state.componentStageCompletionReducer.completionsByComponentId[component.offline_id] ?? {});
|
|
1658
1658
|
};
|
|
1659
1659
|
const componentStageCompletionReducer = componentStageCompletionSlice.reducer;
|
|
1660
|
-
const initialState$
|
|
1660
|
+
const initialState$h = {
|
|
1661
1661
|
stages: {}
|
|
1662
1662
|
};
|
|
1663
1663
|
const componentStageSlice = createSlice({
|
|
1664
1664
|
name: "componentStages",
|
|
1665
|
-
initialState: initialState$
|
|
1666
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1665
|
+
initialState: initialState$h,
|
|
1666
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
|
|
1667
1667
|
reducers: {
|
|
1668
1668
|
addStages: (state, action) => {
|
|
1669
1669
|
Object.assign(state.stages, toOfflineIdRecord(action.payload));
|
|
@@ -1723,14 +1723,14 @@ const selectStagesFromStageIds = restructureCreateSelectorWithArgs(
|
|
|
1723
1723
|
);
|
|
1724
1724
|
const { addStages, updateStages, removeStages } = componentStageSlice.actions;
|
|
1725
1725
|
const componentStageReducer = componentStageSlice.reducer;
|
|
1726
|
-
const initialState$
|
|
1726
|
+
const initialState$g = {
|
|
1727
1727
|
componentTypes: {},
|
|
1728
1728
|
hiddenComponentTypeIds: {}
|
|
1729
1729
|
};
|
|
1730
1730
|
const componentTypeSlice = createSlice({
|
|
1731
1731
|
name: "componentTypes",
|
|
1732
|
-
initialState: initialState$
|
|
1733
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1732
|
+
initialState: initialState$g,
|
|
1733
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
|
|
1734
1734
|
reducers: {
|
|
1735
1735
|
addComponentType: (state, action) => {
|
|
1736
1736
|
state.componentTypes[action.payload.offline_id] = action.payload;
|
|
@@ -1789,13 +1789,13 @@ const selectComponentTypesByName = restructureCreateSelectorWithArgs(
|
|
|
1789
1789
|
const selectHiddenComponentTypeIds = (state) => state.componentTypeReducer.hiddenComponentTypeIds;
|
|
1790
1790
|
const { addComponentType, setComponentTypes, toggleComponentTypeVisibility, deleteComponentType } = componentTypeSlice.actions;
|
|
1791
1791
|
const componentTypeReducer = componentTypeSlice.reducer;
|
|
1792
|
-
const initialState$
|
|
1792
|
+
const initialState$f = {
|
|
1793
1793
|
workspaces: {},
|
|
1794
1794
|
activeWorkspaceId: null
|
|
1795
1795
|
};
|
|
1796
1796
|
const workspaceSlice = createSlice({
|
|
1797
1797
|
name: "workspace",
|
|
1798
|
-
initialState: initialState$
|
|
1798
|
+
initialState: initialState$f,
|
|
1799
1799
|
// The `reducers` field lets us define reducers and generate associated actions
|
|
1800
1800
|
reducers: {
|
|
1801
1801
|
setWorkspaces: (state, action) => {
|
|
@@ -1852,7 +1852,7 @@ const selectPermittedWorkspaceIds = createSelector(
|
|
|
1852
1852
|
);
|
|
1853
1853
|
const workspaceReducer = workspaceSlice.reducer;
|
|
1854
1854
|
const maxRecentIssues = 10;
|
|
1855
|
-
const initialState$
|
|
1855
|
+
const initialState$e = {
|
|
1856
1856
|
issues: {},
|
|
1857
1857
|
attachments: {},
|
|
1858
1858
|
comments: {},
|
|
@@ -1864,9 +1864,9 @@ const initialState$f = {
|
|
|
1864
1864
|
};
|
|
1865
1865
|
const issueSlice = createSlice({
|
|
1866
1866
|
name: "issues",
|
|
1867
|
-
initialState: initialState$
|
|
1867
|
+
initialState: initialState$e,
|
|
1868
1868
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
1869
|
-
Object.assign(state, initialState$
|
|
1869
|
+
Object.assign(state, initialState$e);
|
|
1870
1870
|
}),
|
|
1871
1871
|
reducers: {
|
|
1872
1872
|
setIssues: (state, action) => {
|
|
@@ -2197,15 +2197,15 @@ const selectRecentIssuesAsSearchResults = createSelector(
|
|
|
2197
2197
|
}
|
|
2198
2198
|
);
|
|
2199
2199
|
const issueReducer = issueSlice.reducer;
|
|
2200
|
-
const initialState$
|
|
2200
|
+
const initialState$d = {
|
|
2201
2201
|
s3Urls: {}
|
|
2202
2202
|
};
|
|
2203
2203
|
const msPerHour = 1e3 * 60 * 60;
|
|
2204
2204
|
const msPerWeek = msPerHour * 24 * 7;
|
|
2205
2205
|
const fileSlice = createSlice({
|
|
2206
2206
|
name: "file",
|
|
2207
|
-
initialState: initialState$
|
|
2208
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2207
|
+
initialState: initialState$d,
|
|
2208
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
|
|
2209
2209
|
reducers: {
|
|
2210
2210
|
setUploadUrl: (state, action) => {
|
|
2211
2211
|
const { url, fields, sha1 } = action.payload;
|
|
@@ -2232,7 +2232,7 @@ const selectUploadUrl = (sha1) => (state) => {
|
|
|
2232
2232
|
return url;
|
|
2233
2233
|
};
|
|
2234
2234
|
const fileReducer = fileSlice.reducer;
|
|
2235
|
-
const initialState$
|
|
2235
|
+
const initialState$c = {
|
|
2236
2236
|
// TODO: Change first MapStyle.SATELLITE to MaptStyle.None when project creation map is fixed
|
|
2237
2237
|
mapStyle: MapStyle.SATELLITE,
|
|
2238
2238
|
showTooltips: false,
|
|
@@ -2240,8 +2240,8 @@ const initialState$d = {
|
|
|
2240
2240
|
};
|
|
2241
2241
|
const mapSlice = createSlice({
|
|
2242
2242
|
name: "map",
|
|
2243
|
-
initialState: initialState$
|
|
2244
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2243
|
+
initialState: initialState$c,
|
|
2244
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
|
|
2245
2245
|
reducers: {
|
|
2246
2246
|
setMapStyle: (state, action) => {
|
|
2247
2247
|
state.mapStyle = action.payload;
|
|
@@ -2283,18 +2283,7 @@ var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
|
|
|
2283
2283
|
VerificationCodeType2[VerificationCodeType2["RESET_PASSWORD"] = 10] = "RESET_PASSWORD";
|
|
2284
2284
|
return VerificationCodeType2;
|
|
2285
2285
|
})(VerificationCodeType || {});
|
|
2286
|
-
|
|
2287
|
-
LicenseLevel2[LicenseLevel2["PRO"] = 0] = "PRO";
|
|
2288
|
-
return LicenseLevel2;
|
|
2289
|
-
})(LicenseLevel || {});
|
|
2290
|
-
var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
|
|
2291
|
-
LicenseStatus2[LicenseStatus2["ACTIVE"] = 0] = "ACTIVE";
|
|
2292
|
-
LicenseStatus2[LicenseStatus2["PAUSED"] = 2] = "PAUSED";
|
|
2293
|
-
LicenseStatus2[LicenseStatus2["CANCELED"] = 4] = "CANCELED";
|
|
2294
|
-
LicenseStatus2[LicenseStatus2["INACTIVE"] = 6] = "INACTIVE";
|
|
2295
|
-
return LicenseStatus2;
|
|
2296
|
-
})(LicenseStatus || {});
|
|
2297
|
-
const initialState$c = {
|
|
2286
|
+
const initialState$b = {
|
|
2298
2287
|
users: {},
|
|
2299
2288
|
currentUser: {
|
|
2300
2289
|
id: 0,
|
|
@@ -2305,8 +2294,8 @@ const initialState$c = {
|
|
|
2305
2294
|
};
|
|
2306
2295
|
const userSlice = createSlice({
|
|
2307
2296
|
name: "users",
|
|
2308
|
-
initialState: initialState$
|
|
2309
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2297
|
+
initialState: initialState$b,
|
|
2298
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
|
|
2310
2299
|
reducers: {
|
|
2311
2300
|
setUsers: (state, action) => {
|
|
2312
2301
|
const usersMapping = {};
|
|
@@ -2368,13 +2357,13 @@ const selectUser = (userId) => (state) => {
|
|
|
2368
2357
|
const selectUsersAsMapping = (state) => state.userReducer.users;
|
|
2369
2358
|
const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
|
|
2370
2359
|
const userReducer = userSlice.reducer;
|
|
2371
|
-
const initialState$
|
|
2360
|
+
const initialState$a = {
|
|
2372
2361
|
organizationAccesses: {}
|
|
2373
2362
|
};
|
|
2374
2363
|
const organizationAccessSlice = createSlice({
|
|
2375
2364
|
name: "organizationAccess",
|
|
2376
|
-
initialState: initialState$
|
|
2377
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2365
|
+
initialState: initialState$a,
|
|
2366
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
|
|
2378
2367
|
reducers: {
|
|
2379
2368
|
setOrganizationAccesses: (state, action) => {
|
|
2380
2369
|
if (!Array.isArray(action.payload))
|
|
@@ -2437,13 +2426,151 @@ const selectOrganizationAccessUserMapping = (state) => {
|
|
|
2437
2426
|
return organizationAccesses;
|
|
2438
2427
|
};
|
|
2439
2428
|
const organizationAccessReducer = organizationAccessSlice.reducer;
|
|
2440
|
-
const initialState$
|
|
2429
|
+
const initialState$9 = {
|
|
2430
|
+
organizations: {},
|
|
2431
|
+
activeOrganizationId: null
|
|
2432
|
+
};
|
|
2433
|
+
const organizationSlice = createSlice({
|
|
2434
|
+
name: "organizations",
|
|
2435
|
+
initialState: initialState$9,
|
|
2436
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$9)),
|
|
2437
|
+
reducers: {
|
|
2438
|
+
setOrganizations: (state, action) => {
|
|
2439
|
+
for (const org of action.payload) {
|
|
2440
|
+
state.organizations[org.id] = org;
|
|
2441
|
+
}
|
|
2442
|
+
},
|
|
2443
|
+
updateActiveOrganization: (state, action) => {
|
|
2444
|
+
if (!state.activeOrganizationId) {
|
|
2445
|
+
throw new Error("Cannot update name of active organization. Active organization ID does not exist");
|
|
2446
|
+
}
|
|
2447
|
+
if (state.activeOrganizationId !== action.payload.id) {
|
|
2448
|
+
throw new Error("Tried updating active organization with different organization");
|
|
2449
|
+
}
|
|
2450
|
+
state.organizations[state.activeOrganizationId] = action.payload;
|
|
2451
|
+
},
|
|
2452
|
+
setActiveOrganizationId: (state, action) => {
|
|
2453
|
+
state.activeOrganizationId = action.payload;
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
});
|
|
2457
|
+
const { setOrganizations, setActiveOrganizationId, updateActiveOrganization } = organizationSlice.actions;
|
|
2458
|
+
const selectActiveOrganizationId = (state) => {
|
|
2459
|
+
return state.organizationReducer.activeOrganizationId;
|
|
2460
|
+
};
|
|
2461
|
+
const selectOrganizations = (state) => {
|
|
2462
|
+
return Object.values(state.organizationReducer.organizations);
|
|
2463
|
+
};
|
|
2464
|
+
const selectOrganizationsWithAccess = createSelector(
|
|
2465
|
+
[selectOrganizations],
|
|
2466
|
+
(organizations) => Object.values(organizations).filter((organization) => organization.has_access)
|
|
2467
|
+
);
|
|
2468
|
+
const selectActiveOrganization = (state) => {
|
|
2469
|
+
const id = selectActiveOrganizationId(state);
|
|
2470
|
+
if (!id) {
|
|
2471
|
+
return null;
|
|
2472
|
+
}
|
|
2473
|
+
const organization = state.organizationReducer.organizations[id];
|
|
2474
|
+
if (!organization) {
|
|
2475
|
+
return null;
|
|
2476
|
+
}
|
|
2477
|
+
return organization;
|
|
2478
|
+
};
|
|
2479
|
+
const selectOrganizationUsersIds = createSelector(
|
|
2480
|
+
[selectOrganizationAccesses],
|
|
2481
|
+
(organizationAccesses) => Object.values(organizationAccesses).map((organizationAccess) => organizationAccess.user)
|
|
2482
|
+
);
|
|
2483
|
+
const selectOrganizationUsersAsMapping = createSelector(
|
|
2484
|
+
[selectOrganizationUsersIds, selectUsersAsMapping],
|
|
2485
|
+
(organizationUserIds, users) => organizationUserIds.reduce((accum, userId) => ({ ...accum, [userId]: users[userId] }), {})
|
|
2486
|
+
);
|
|
2487
|
+
const selectSortedOrganizationUsers = createSelector(
|
|
2488
|
+
[selectCurrentUser, selectOrganizationUsersAsMapping, selectOrganizationAccessUserMapping],
|
|
2489
|
+
(currentUser, userMapping, organizationAccessMapping) => {
|
|
2490
|
+
return Object.values(userMapping).sort((userA, userB) => {
|
|
2491
|
+
if (userA.id === currentUser.id) {
|
|
2492
|
+
return -1;
|
|
2493
|
+
} else if (userB.id === currentUser.id) {
|
|
2494
|
+
return 1;
|
|
2495
|
+
}
|
|
2496
|
+
const organizationAccessesA = organizationAccessMapping[userA.id];
|
|
2497
|
+
const organizationAccessesB = organizationAccessMapping[userB.id];
|
|
2498
|
+
if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === (organizationAccessesB == null ? void 0 : organizationAccessesB.access_level)) {
|
|
2499
|
+
return userA.username.localeCompare(userB.username);
|
|
2500
|
+
}
|
|
2501
|
+
if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === OrganizationAccessLevel.ADMIN) {
|
|
2502
|
+
return -1;
|
|
2503
|
+
}
|
|
2504
|
+
return 1;
|
|
2505
|
+
});
|
|
2506
|
+
}
|
|
2507
|
+
);
|
|
2508
|
+
const selectOrganization = (id) => (state) => {
|
|
2509
|
+
return state.organizationReducer.organizations[id];
|
|
2510
|
+
};
|
|
2511
|
+
const organizationReducer = organizationSlice.reducer;
|
|
2512
|
+
const createOfflineAction = (request2, baseUrl) => {
|
|
2513
|
+
const requestWithUuid = request2.uuid ? request2 : { ...request2, uuid: v4() };
|
|
2514
|
+
return {
|
|
2515
|
+
payload: requestWithUuid,
|
|
2516
|
+
type: "",
|
|
2517
|
+
meta: {
|
|
2518
|
+
offline: {
|
|
2519
|
+
effect: {
|
|
2520
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2521
|
+
request: requestWithUuid,
|
|
2522
|
+
BASE_URL: baseUrl
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
};
|
|
2527
|
+
};
|
|
2528
|
+
const initialState$8 = {
|
|
2529
|
+
deletedRequests: [],
|
|
2530
|
+
latestRetryTime: 0
|
|
2531
|
+
};
|
|
2532
|
+
const outboxSlice = createSlice({
|
|
2533
|
+
name: "outbox",
|
|
2534
|
+
initialState: initialState$8,
|
|
2535
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
|
|
2536
|
+
reducers: {
|
|
2537
|
+
// enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
|
|
2538
|
+
// Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
|
|
2539
|
+
// Then this reducer enqueueRequest() is responsible for adding the actual request data to the outbox
|
|
2540
|
+
enqueueRequest: {
|
|
2541
|
+
reducer: (state, _action) => {
|
|
2542
|
+
return state;
|
|
2543
|
+
},
|
|
2544
|
+
prepare: (payload) => {
|
|
2545
|
+
console.debug("Preparing to enqueue request", payload);
|
|
2546
|
+
const { BASE_URL, ...rest } = payload;
|
|
2547
|
+
return createOfflineAction(rest, BASE_URL);
|
|
2548
|
+
}
|
|
2549
|
+
},
|
|
2550
|
+
markForDeletion(state, action) {
|
|
2551
|
+
state.deletedRequests.push(action.payload);
|
|
2552
|
+
},
|
|
2553
|
+
markAsDeleted(state, action) {
|
|
2554
|
+
const index2 = state.deletedRequests.indexOf(action.payload);
|
|
2555
|
+
if (index2 !== -1)
|
|
2556
|
+
state.deletedRequests.splice(index2, 1);
|
|
2557
|
+
},
|
|
2558
|
+
_setLatestRetryTime: (state, action) => {
|
|
2559
|
+
state.latestRetryTime = action.payload;
|
|
2560
|
+
}
|
|
2561
|
+
}
|
|
2562
|
+
});
|
|
2563
|
+
const selectDeletedRequests = (state) => state.outboxReducer.deletedRequests;
|
|
2564
|
+
const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
|
|
2565
|
+
const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
|
|
2566
|
+
const outboxReducer = outboxSlice.reducer;
|
|
2567
|
+
const initialState$7 = {
|
|
2441
2568
|
projectAccesses: {}
|
|
2442
2569
|
};
|
|
2443
2570
|
const projectAccessSlice = createSlice({
|
|
2444
2571
|
name: "projectAccess",
|
|
2445
|
-
initialState: initialState$
|
|
2446
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2572
|
+
initialState: initialState$7,
|
|
2573
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
|
|
2447
2574
|
reducers: {
|
|
2448
2575
|
setProjectAccesses: (state, action) => {
|
|
2449
2576
|
if (!Array.isArray(action.payload))
|
|
@@ -2511,7 +2638,7 @@ const selectProjectAccessUserMapping = (state) => {
|
|
|
2511
2638
|
return projectAccesses;
|
|
2512
2639
|
};
|
|
2513
2640
|
const projectAccessReducer = projectAccessSlice.reducer;
|
|
2514
|
-
const initialState$
|
|
2641
|
+
const initialState$6 = {
|
|
2515
2642
|
projects: {},
|
|
2516
2643
|
activeProjectId: null,
|
|
2517
2644
|
recentProjectIds: [],
|
|
@@ -2520,7 +2647,7 @@ const initialState$9 = {
|
|
|
2520
2647
|
};
|
|
2521
2648
|
const projectSlice = createSlice({
|
|
2522
2649
|
name: "projects",
|
|
2523
|
-
initialState: initialState$
|
|
2650
|
+
initialState: initialState$6,
|
|
2524
2651
|
reducers: {
|
|
2525
2652
|
setProjects: (state, action) => {
|
|
2526
2653
|
const projectsMap = {};
|
|
@@ -2566,20 +2693,6 @@ const projectSlice = createSlice({
|
|
|
2566
2693
|
} else {
|
|
2567
2694
|
throw new Error("Accept project invite: user is not in this project");
|
|
2568
2695
|
}
|
|
2569
|
-
},
|
|
2570
|
-
updateActiveProjectIssuesCount: (state, action) => {
|
|
2571
|
-
if (state.activeProjectId) {
|
|
2572
|
-
state.projects[state.activeProjectId].issues_count += action.payload;
|
|
2573
|
-
} else {
|
|
2574
|
-
throw new Error("Update issues count: no active project");
|
|
2575
|
-
}
|
|
2576
|
-
},
|
|
2577
|
-
updateActiveProjectFormSubmissionsCount: (state, action) => {
|
|
2578
|
-
if (state.activeProjectId) {
|
|
2579
|
-
state.projects[state.activeProjectId].form_submissions_count += action.payload;
|
|
2580
|
-
} else {
|
|
2581
|
-
throw new Error("Update form submissions count: no active project");
|
|
2582
|
-
}
|
|
2583
2696
|
}
|
|
2584
2697
|
}
|
|
2585
2698
|
});
|
|
@@ -2590,9 +2703,7 @@ const {
|
|
|
2590
2703
|
setActiveProjectId,
|
|
2591
2704
|
setCreateProjectType,
|
|
2592
2705
|
deleteProject,
|
|
2593
|
-
acceptProjectInvite
|
|
2594
|
-
updateActiveProjectIssuesCount,
|
|
2595
|
-
updateActiveProjectFormSubmissionsCount
|
|
2706
|
+
acceptProjectInvite
|
|
2596
2707
|
} = projectSlice.actions;
|
|
2597
2708
|
const selectProjects = (state) => state.projectReducer.projects;
|
|
2598
2709
|
const selectActiveProjectId = (state) => state.projectReducer.activeProjectId;
|
|
@@ -2656,231 +2767,6 @@ const selectSortedProjectUsers = createSelector(
|
|
|
2656
2767
|
});
|
|
2657
2768
|
}
|
|
2658
2769
|
);
|
|
2659
|
-
const initialState$8 = {
|
|
2660
|
-
licenses: {}
|
|
2661
|
-
};
|
|
2662
|
-
const licenseSlice = createSlice({
|
|
2663
|
-
name: "license",
|
|
2664
|
-
initialState: initialState$8,
|
|
2665
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
|
|
2666
|
-
reducers: {
|
|
2667
|
-
setLicenses: (state, action) => {
|
|
2668
|
-
if (!Array.isArray(action.payload))
|
|
2669
|
-
throw new Error("Expected an array of Licenses");
|
|
2670
|
-
if (action.payload.filter(onlyUniqueOfflineIds).length !== action.payload.length) {
|
|
2671
|
-
throw new Error("Tried to use setLicenses reducer with duplicate ID's");
|
|
2672
|
-
}
|
|
2673
|
-
const licenses = {};
|
|
2674
|
-
for (const license of action.payload) {
|
|
2675
|
-
licenses[license.offline_id] = license;
|
|
2676
|
-
}
|
|
2677
|
-
state.licenses = licenses;
|
|
2678
|
-
},
|
|
2679
|
-
addLicenses: (state, action) => {
|
|
2680
|
-
for (const license of action.payload) {
|
|
2681
|
-
state.licenses[license.offline_id] = license;
|
|
2682
|
-
}
|
|
2683
|
-
},
|
|
2684
|
-
updateLicense: (state, action) => {
|
|
2685
|
-
if (!(action.payload.offline_id in state.licenses)) {
|
|
2686
|
-
throw new Error("Tried to update license that does not exist.");
|
|
2687
|
-
}
|
|
2688
|
-
state.licenses[action.payload.offline_id] = action.payload;
|
|
2689
|
-
}
|
|
2690
|
-
}
|
|
2691
|
-
});
|
|
2692
|
-
const { setLicenses, addLicenses, updateLicense } = licenseSlice.actions;
|
|
2693
|
-
const selectLicenses = (state) => {
|
|
2694
|
-
return state.licenseReducer.licenses;
|
|
2695
|
-
};
|
|
2696
|
-
const selectLicense = (licenseId) => (state) => state.licenseReducer.licenses[licenseId];
|
|
2697
|
-
const selectActiveLicense = createSelector(
|
|
2698
|
-
[selectLicenses, selectActiveProjectId],
|
|
2699
|
-
(licenses, activeProjectId) => {
|
|
2700
|
-
const activeLicense = Object.values(licenses).find((license) => license.project === activeProjectId);
|
|
2701
|
-
return activeLicense ?? null;
|
|
2702
|
-
}
|
|
2703
|
-
);
|
|
2704
|
-
const selectLicenseForProject = restructureCreateSelectorWithArgs(
|
|
2705
|
-
createSelector(
|
|
2706
|
-
[selectLicenses, (_state, projectId) => projectId],
|
|
2707
|
-
(licenses, projectId) => Object.values(licenses).find((license) => license.project === projectId) ?? null
|
|
2708
|
-
)
|
|
2709
|
-
);
|
|
2710
|
-
const selectActiveStatusLicenses = createSelector(
|
|
2711
|
-
[selectLicenses],
|
|
2712
|
-
(licenses) => Object.values(licenses).filter((license) => license.is_active)
|
|
2713
|
-
);
|
|
2714
|
-
const selectLicencesMapping = createSelector(
|
|
2715
|
-
[selectLicenses],
|
|
2716
|
-
(licenses) => Object.values(licenses).filter((license) => license.project).reduce((accum, license) => ({ ...accum, [license.project]: license }), {})
|
|
2717
|
-
);
|
|
2718
|
-
const licenseReducer = licenseSlice.reducer;
|
|
2719
|
-
const initialState$7 = {
|
|
2720
|
-
organizations: {},
|
|
2721
|
-
activeOrganizationId: null
|
|
2722
|
-
};
|
|
2723
|
-
const organizationSlice = createSlice({
|
|
2724
|
-
name: "organizations",
|
|
2725
|
-
initialState: initialState$7,
|
|
2726
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
|
|
2727
|
-
reducers: {
|
|
2728
|
-
setOrganizations: (state, action) => {
|
|
2729
|
-
for (const org of action.payload) {
|
|
2730
|
-
state.organizations[org.id] = org;
|
|
2731
|
-
}
|
|
2732
|
-
},
|
|
2733
|
-
updateActiveOrganization: (state, action) => {
|
|
2734
|
-
if (!state.activeOrganizationId) {
|
|
2735
|
-
throw new Error("Cannot update name of active organization. Active organization ID does not exist");
|
|
2736
|
-
}
|
|
2737
|
-
if (state.activeOrganizationId !== action.payload.id) {
|
|
2738
|
-
throw new Error("Tried updating active organization with different organization");
|
|
2739
|
-
}
|
|
2740
|
-
state.organizations[state.activeOrganizationId] = action.payload;
|
|
2741
|
-
},
|
|
2742
|
-
setActiveOrganizationId: (state, action) => {
|
|
2743
|
-
state.activeOrganizationId = action.payload;
|
|
2744
|
-
}
|
|
2745
|
-
}
|
|
2746
|
-
});
|
|
2747
|
-
const { setOrganizations, setActiveOrganizationId, updateActiveOrganization } = organizationSlice.actions;
|
|
2748
|
-
const selectActiveOrganizationId = (state) => {
|
|
2749
|
-
return state.organizationReducer.activeOrganizationId;
|
|
2750
|
-
};
|
|
2751
|
-
const selectOrganizations = (state) => {
|
|
2752
|
-
return Object.values(state.organizationReducer.organizations);
|
|
2753
|
-
};
|
|
2754
|
-
const selectOrganizationsMapping = (state) => {
|
|
2755
|
-
return state.organizationReducer.organizations;
|
|
2756
|
-
};
|
|
2757
|
-
const selectOrganizationsWithAccess = createSelector(
|
|
2758
|
-
[selectOrganizations],
|
|
2759
|
-
(organizations) => Object.values(organizations).filter((organization) => organization.has_access)
|
|
2760
|
-
);
|
|
2761
|
-
const selectActiveOrganization = (state) => {
|
|
2762
|
-
const id = selectActiveOrganizationId(state);
|
|
2763
|
-
if (!id) {
|
|
2764
|
-
return null;
|
|
2765
|
-
}
|
|
2766
|
-
const organization = state.organizationReducer.organizations[id];
|
|
2767
|
-
if (!organization) {
|
|
2768
|
-
return null;
|
|
2769
|
-
}
|
|
2770
|
-
return organization;
|
|
2771
|
-
};
|
|
2772
|
-
const selectOrganizationUsersIds = createSelector(
|
|
2773
|
-
[selectOrganizationAccesses],
|
|
2774
|
-
(organizationAccesses) => Object.values(organizationAccesses).map((organizationAccess) => organizationAccess.user)
|
|
2775
|
-
);
|
|
2776
|
-
const selectActiveOrganizationProjects = createSelector(
|
|
2777
|
-
[selectProjects, selectActiveOrganizationId],
|
|
2778
|
-
(projects, activeOrganizationId) => activeOrganizationId ? Object.values(projects).filter((project) => project.owner_organization === activeOrganizationId) : []
|
|
2779
|
-
);
|
|
2780
|
-
const selectActiveOrganizationLicenses = createSelector(
|
|
2781
|
-
[selectActiveOrganizationId, selectLicenses],
|
|
2782
|
-
(activeOrganizationId, licenses) => !activeOrganizationId ? [] : Object.values(licenses).filter((license) => license.organization_owner === activeOrganizationId)
|
|
2783
|
-
);
|
|
2784
|
-
const selectSortedOrganizationLicenses = createSelector(
|
|
2785
|
-
[selectActiveOrganizationLicenses, selectProjects],
|
|
2786
|
-
(licences, projects) => licences.sort((licenseA, licenseB) => {
|
|
2787
|
-
if (!licenseA.project) {
|
|
2788
|
-
return 1;
|
|
2789
|
-
}
|
|
2790
|
-
if (!licenseB.project) {
|
|
2791
|
-
return -1;
|
|
2792
|
-
}
|
|
2793
|
-
return projects[licenseA.project].name.toLowerCase().localeCompare(
|
|
2794
|
-
projects[licenseB.project].name.toLowerCase(),
|
|
2795
|
-
void 0,
|
|
2796
|
-
{ numeric: true }
|
|
2797
|
-
);
|
|
2798
|
-
})
|
|
2799
|
-
);
|
|
2800
|
-
const selectOrganizationUsersAsMapping = createSelector(
|
|
2801
|
-
[selectOrganizationUsersIds, selectUsersAsMapping],
|
|
2802
|
-
(organizationUserIds, users) => organizationUserIds.reduce((accum, userId) => ({ ...accum, [userId]: users[userId] }), {})
|
|
2803
|
-
);
|
|
2804
|
-
const selectSortedOrganizationUsers = createSelector(
|
|
2805
|
-
[selectCurrentUser, selectOrganizationUsersAsMapping, selectOrganizationAccessUserMapping],
|
|
2806
|
-
(currentUser, userMapping, organizationAccessMapping) => {
|
|
2807
|
-
return Object.values(userMapping).sort((userA, userB) => {
|
|
2808
|
-
if (userA.id === currentUser.id) {
|
|
2809
|
-
return -1;
|
|
2810
|
-
} else if (userB.id === currentUser.id) {
|
|
2811
|
-
return 1;
|
|
2812
|
-
}
|
|
2813
|
-
const organizationAccessesA = organizationAccessMapping[userA.id];
|
|
2814
|
-
const organizationAccessesB = organizationAccessMapping[userB.id];
|
|
2815
|
-
if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === (organizationAccessesB == null ? void 0 : organizationAccessesB.access_level)) {
|
|
2816
|
-
return userA.username.localeCompare(userB.username);
|
|
2817
|
-
}
|
|
2818
|
-
if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === OrganizationAccessLevel.ADMIN) {
|
|
2819
|
-
return -1;
|
|
2820
|
-
}
|
|
2821
|
-
return 1;
|
|
2822
|
-
});
|
|
2823
|
-
}
|
|
2824
|
-
);
|
|
2825
|
-
const selectOrganization = (id) => (state) => {
|
|
2826
|
-
return state.organizationReducer.organizations[id];
|
|
2827
|
-
};
|
|
2828
|
-
const organizationReducer = organizationSlice.reducer;
|
|
2829
|
-
const createOfflineAction = (request2, baseUrl) => {
|
|
2830
|
-
const requestWithUuid = request2.uuid ? request2 : { ...request2, uuid: v4() };
|
|
2831
|
-
return {
|
|
2832
|
-
payload: requestWithUuid,
|
|
2833
|
-
type: "",
|
|
2834
|
-
meta: {
|
|
2835
|
-
offline: {
|
|
2836
|
-
effect: {
|
|
2837
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2838
|
-
request: requestWithUuid,
|
|
2839
|
-
BASE_URL: baseUrl
|
|
2840
|
-
}
|
|
2841
|
-
}
|
|
2842
|
-
}
|
|
2843
|
-
};
|
|
2844
|
-
};
|
|
2845
|
-
const initialState$6 = {
|
|
2846
|
-
deletedRequests: [],
|
|
2847
|
-
latestRetryTime: 0
|
|
2848
|
-
};
|
|
2849
|
-
const outboxSlice = createSlice({
|
|
2850
|
-
name: "outbox",
|
|
2851
|
-
initialState: initialState$6,
|
|
2852
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
|
|
2853
|
-
reducers: {
|
|
2854
|
-
// enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
|
|
2855
|
-
// Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
|
|
2856
|
-
// Then this reducer enqueueRequest() is responsible for adding the actual request data to the outbox
|
|
2857
|
-
enqueueRequest: {
|
|
2858
|
-
reducer: (state, _action) => {
|
|
2859
|
-
return state;
|
|
2860
|
-
},
|
|
2861
|
-
prepare: (payload) => {
|
|
2862
|
-
console.debug("Preparing to enqueue request", payload);
|
|
2863
|
-
const { BASE_URL, ...rest } = payload;
|
|
2864
|
-
return createOfflineAction(rest, BASE_URL);
|
|
2865
|
-
}
|
|
2866
|
-
},
|
|
2867
|
-
markForDeletion(state, action) {
|
|
2868
|
-
state.deletedRequests.push(action.payload);
|
|
2869
|
-
},
|
|
2870
|
-
markAsDeleted(state, action) {
|
|
2871
|
-
const index2 = state.deletedRequests.indexOf(action.payload);
|
|
2872
|
-
if (index2 !== -1)
|
|
2873
|
-
state.deletedRequests.splice(index2, 1);
|
|
2874
|
-
},
|
|
2875
|
-
_setLatestRetryTime: (state, action) => {
|
|
2876
|
-
state.latestRetryTime = action.payload;
|
|
2877
|
-
}
|
|
2878
|
-
}
|
|
2879
|
-
});
|
|
2880
|
-
const selectDeletedRequests = (state) => state.outboxReducer.deletedRequests;
|
|
2881
|
-
const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
|
|
2882
|
-
const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
|
|
2883
|
-
const outboxReducer = outboxSlice.reducer;
|
|
2884
2770
|
const initialState$5 = {
|
|
2885
2771
|
projectFiles: {},
|
|
2886
2772
|
activeProjectFileId: null,
|
|
@@ -3418,8 +3304,7 @@ const overmapReducers = {
|
|
|
3418
3304
|
userFormReducer,
|
|
3419
3305
|
userReducer,
|
|
3420
3306
|
workspaceReducer,
|
|
3421
|
-
emailDomainsReducer
|
|
3422
|
-
licenseReducer
|
|
3307
|
+
emailDomainsReducer
|
|
3423
3308
|
};
|
|
3424
3309
|
const overmapReducer = combineReducers(overmapReducers);
|
|
3425
3310
|
const resetStore = "RESET";
|
|
@@ -3580,6 +3465,19 @@ function extractErrorMessage(errorRes, err) {
|
|
|
3580
3465
|
return errorRes.body.error;
|
|
3581
3466
|
if (typeof errorRes.body.message === "string")
|
|
3582
3467
|
return errorRes.body.message;
|
|
3468
|
+
try {
|
|
3469
|
+
return Object.entries(errorRes.body).map(([key, value]) => {
|
|
3470
|
+
if (typeof value === "string") {
|
|
3471
|
+
return `${key}: ${value}`;
|
|
3472
|
+
}
|
|
3473
|
+
if (Array.isArray(value)) {
|
|
3474
|
+
return value.map((v) => `${key}: ${v}`).join("\n");
|
|
3475
|
+
}
|
|
3476
|
+
return `${key}: ${JSON.stringify(value)}`;
|
|
3477
|
+
}).join("\n");
|
|
3478
|
+
} catch (e) {
|
|
3479
|
+
console.error("Failed to extract error message from response body", e);
|
|
3480
|
+
}
|
|
3583
3481
|
} else if (typeof errorRes.body === "string")
|
|
3584
3482
|
return errorRes.body;
|
|
3585
3483
|
} else if (errorRes == null ? void 0 : errorRes.text) {
|
|
@@ -4120,7 +4018,7 @@ class AuthService extends BaseApiService {
|
|
|
4120
4018
|
* @returns {Promise<TokenPair>} The new access and refresh tokens
|
|
4121
4019
|
*/
|
|
4122
4020
|
__publicField(this, "_getRenewedTokens", async (refreshToken) => {
|
|
4123
|
-
const
|
|
4021
|
+
const promise = this.enqueueRequest({
|
|
4124
4022
|
description: "Get renewed tokens",
|
|
4125
4023
|
method: HttpMethod.POST,
|
|
4126
4024
|
url: "/api/token/refresh/",
|
|
@@ -4133,6 +4031,14 @@ class AuthService extends BaseApiService {
|
|
|
4133
4031
|
// Don't wait for other requests to finish, or we might end up in a deadlock.
|
|
4134
4032
|
immediate: true
|
|
4135
4033
|
});
|
|
4034
|
+
let response = void 0;
|
|
4035
|
+
try {
|
|
4036
|
+
response = await promise;
|
|
4037
|
+
} catch (e) {
|
|
4038
|
+
await this.logout();
|
|
4039
|
+
}
|
|
4040
|
+
if (!response)
|
|
4041
|
+
throw new Error("No response");
|
|
4136
4042
|
if (!response.access)
|
|
4137
4043
|
throw new Error("Missing access token");
|
|
4138
4044
|
if (!response.refresh)
|
|
@@ -4852,7 +4758,6 @@ class IssueService extends BaseApiService {
|
|
|
4852
4758
|
});
|
|
4853
4759
|
store.dispatch(addIssue(issuePayload));
|
|
4854
4760
|
store.dispatch(addToRecentIssues(issuePayload.offline_id));
|
|
4855
|
-
store.dispatch(updateActiveProjectIssuesCount(1));
|
|
4856
4761
|
const promise = this.enqueueRequest({
|
|
4857
4762
|
description: "Create issue",
|
|
4858
4763
|
method: HttpMethod.POST,
|
|
@@ -4879,7 +4784,6 @@ class IssueService extends BaseApiService {
|
|
|
4879
4784
|
});
|
|
4880
4785
|
}
|
|
4881
4786
|
store.dispatch(removeIssue(issuePayload.offline_id));
|
|
4882
|
-
store.dispatch(updateActiveProjectIssuesCount(-1));
|
|
4883
4787
|
throw error2;
|
|
4884
4788
|
});
|
|
4885
4789
|
return [issuePayload, promise];
|
|
@@ -4918,8 +4822,7 @@ class IssueService extends BaseApiService {
|
|
|
4918
4822
|
return [fullIssue, promise];
|
|
4919
4823
|
}
|
|
4920
4824
|
async remove(id) {
|
|
4921
|
-
const
|
|
4922
|
-
const state = store.getState();
|
|
4825
|
+
const state = this.client.store.getState();
|
|
4923
4826
|
const backup = state.issueReducer.issues[id];
|
|
4924
4827
|
if (!backup) {
|
|
4925
4828
|
throw new Error(`No issue with id ${id} found in the store`);
|
|
@@ -4927,7 +4830,6 @@ class IssueService extends BaseApiService {
|
|
|
4927
4830
|
const attachments = Object.values(state.issueReducer.attachments).filter((a) => a.issue_id === id);
|
|
4928
4831
|
const attachmentsOfIssue = selectPhotoAttachmentsOfIssue(id)(state);
|
|
4929
4832
|
this.client.store.dispatch(removeIssue(id));
|
|
4930
|
-
store.dispatch(updateActiveProjectIssuesCount(-1));
|
|
4931
4833
|
if (attachmentsOfIssue) {
|
|
4932
4834
|
this.client.store.dispatch(removeAttachmentsOfIssue(id));
|
|
4933
4835
|
}
|
|
@@ -4942,7 +4844,6 @@ class IssueService extends BaseApiService {
|
|
|
4942
4844
|
} catch (e) {
|
|
4943
4845
|
this.client.store.dispatch(addIssue(backup));
|
|
4944
4846
|
this.client.store.dispatch(addAttachments(attachments));
|
|
4945
|
-
store.dispatch(updateActiveProjectIssuesCount(1));
|
|
4946
4847
|
throw e;
|
|
4947
4848
|
}
|
|
4948
4849
|
}
|
|
@@ -5018,9 +4919,7 @@ class MainService extends BaseApiService {
|
|
|
5018
4919
|
owner_organization: projectData.organization_owner,
|
|
5019
4920
|
owner_user: projectData.user_owner,
|
|
5020
4921
|
bounds: projectData.bounds,
|
|
5021
|
-
invited: projectData.invited || false
|
|
5022
|
-
issues_count: projectData.issues_count,
|
|
5023
|
-
form_submissions_count: projectData.form_submissions_count
|
|
4922
|
+
invited: projectData.invited || false
|
|
5024
4923
|
});
|
|
5025
4924
|
if (currentProjectId === projectData.id && !projectData.invited) {
|
|
5026
4925
|
isProjectIdValid = true;
|
|
@@ -5038,7 +4937,6 @@ class MainService extends BaseApiService {
|
|
|
5038
4937
|
}
|
|
5039
4938
|
store.dispatch(setCurrentUser(data.user));
|
|
5040
4939
|
store.dispatch(addUsers(data.project_owners));
|
|
5041
|
-
store.dispatch(setLicenses(data.licenses));
|
|
5042
4940
|
const organizationsData = data.organizations;
|
|
5043
4941
|
store.dispatch(setOrganizations(organizationsData));
|
|
5044
4942
|
const validProjects = projects.filter((project) => !project.invited);
|
|
@@ -5351,7 +5249,6 @@ class ProjectService extends BaseApiService {
|
|
|
5351
5249
|
if (!project) {
|
|
5352
5250
|
throw new Error("Expected project to exist");
|
|
5353
5251
|
}
|
|
5354
|
-
const license = selectLicenseForProject(project.id);
|
|
5355
5252
|
const activeProjectId = state.projectReducer.activeProjectId;
|
|
5356
5253
|
if (activeProjectId === projectId) {
|
|
5357
5254
|
store.dispatch({ type: "project/setActiveProjectId", payload: null });
|
|
@@ -5362,9 +5259,6 @@ class ProjectService extends BaseApiService {
|
|
|
5362
5259
|
store.dispatch(removeProjectAccessesOfProject(project.id));
|
|
5363
5260
|
store.dispatch({ type: "rehydrated/setRehydrated", payload: false });
|
|
5364
5261
|
store.dispatch(deleteProject(project));
|
|
5365
|
-
if (license) {
|
|
5366
|
-
store.dispatch(updateLicense({ ...license, project: null }));
|
|
5367
|
-
}
|
|
5368
5262
|
try {
|
|
5369
5263
|
await this.enqueueRequest({
|
|
5370
5264
|
description: "Delete project",
|
|
@@ -5380,9 +5274,6 @@ class ProjectService extends BaseApiService {
|
|
|
5380
5274
|
store.dispatch(addOrReplaceProjectFiles(filesToDelete));
|
|
5381
5275
|
store.dispatch(setActiveProjectId(activeProjectId));
|
|
5382
5276
|
store.dispatch({ type: "rehydrated/setRehydrated", payload: true });
|
|
5383
|
-
if (license) {
|
|
5384
|
-
store.dispatch(updateLicense({ ...license, project: project.id }));
|
|
5385
|
-
}
|
|
5386
5277
|
throw e;
|
|
5387
5278
|
}
|
|
5388
5279
|
}
|
|
@@ -5688,11 +5579,9 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
5688
5579
|
store.dispatch(addUserFormSubmission(offlineResultWithoutFiles));
|
|
5689
5580
|
void promise.then((result) => {
|
|
5690
5581
|
store.dispatch(addUserFormSubmission(result));
|
|
5691
|
-
store.dispatch(updateActiveProjectFormSubmissionsCount(1));
|
|
5692
5582
|
return result;
|
|
5693
5583
|
}).catch(() => {
|
|
5694
5584
|
store.dispatch(deleteUserFormSubmission(payload.offline_id));
|
|
5695
|
-
store.dispatch(updateActiveProjectFormSubmissionsCount(-1));
|
|
5696
5585
|
});
|
|
5697
5586
|
const settledPromise = Promise.all([promise, ...attachFilesPromises]).then(() => promise);
|
|
5698
5587
|
return [fullOfflineResult, settledPromise];
|
|
@@ -5702,7 +5591,6 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
5702
5591
|
const state = store.getState();
|
|
5703
5592
|
const submission = state.userFormReducer.submissions[submissionId];
|
|
5704
5593
|
store.dispatch(deleteUserFormSubmission(submissionId));
|
|
5705
|
-
store.dispatch(updateActiveProjectFormSubmissionsCount(-1));
|
|
5706
5594
|
try {
|
|
5707
5595
|
return await this.enqueueRequest({
|
|
5708
5596
|
description: "Delete user form submissions",
|
|
@@ -5714,7 +5602,6 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
5714
5602
|
} catch (e) {
|
|
5715
5603
|
if (submission) {
|
|
5716
5604
|
store.dispatch(addUserFormSubmission(submission));
|
|
5717
|
-
store.dispatch(updateActiveProjectFormSubmissionsCount(1));
|
|
5718
5605
|
}
|
|
5719
5606
|
throw e;
|
|
5720
5607
|
}
|
|
@@ -6127,12 +6014,10 @@ class OrganizationService extends BaseApiService {
|
|
|
6127
6014
|
const organizationAccesses = data.organization_accesses;
|
|
6128
6015
|
const emailDomains = data.email_domains;
|
|
6129
6016
|
const users = data.users;
|
|
6130
|
-
const licenses = data.licenses;
|
|
6131
6017
|
store.dispatch(addUsers(users));
|
|
6132
6018
|
store.dispatch(setActiveOrganizationId(activeOrganization.id));
|
|
6133
6019
|
store.dispatch(setOrganizationAccesses(organizationAccesses));
|
|
6134
6020
|
store.dispatch(setEmailDomains(emailDomains));
|
|
6135
|
-
store.dispatch(addLicenses(licenses));
|
|
6136
6021
|
if (showLoading) {
|
|
6137
6022
|
store.dispatch(setIsFetchingInitialData(false));
|
|
6138
6023
|
}
|
|
@@ -6173,89 +6058,6 @@ class OrganizationService extends BaseApiService {
|
|
|
6173
6058
|
});
|
|
6174
6059
|
}
|
|
6175
6060
|
}
|
|
6176
|
-
class LicenseService extends BaseApiService {
|
|
6177
|
-
async pauseLicense(license) {
|
|
6178
|
-
this.client.store.dispatch(setIsFetchingInitialData(true));
|
|
6179
|
-
return this.enqueueRequest({
|
|
6180
|
-
description: "Pause license",
|
|
6181
|
-
method: HttpMethod.DELETE,
|
|
6182
|
-
url: `/billing/${license.offline_id}/suspend/`,
|
|
6183
|
-
isAuthNeeded: true,
|
|
6184
|
-
blockers: [
|
|
6185
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6186
|
-
],
|
|
6187
|
-
blocks: []
|
|
6188
|
-
}).then((result) => {
|
|
6189
|
-
this.client.store.dispatch(updateLicense(result));
|
|
6190
|
-
this.client.store.dispatch(setIsFetchingInitialData(false));
|
|
6191
|
-
return result;
|
|
6192
|
-
});
|
|
6193
|
-
}
|
|
6194
|
-
async resumeLicense(license) {
|
|
6195
|
-
this.client.store.dispatch(setIsFetchingInitialData(true));
|
|
6196
|
-
return this.enqueueRequest({
|
|
6197
|
-
description: "Resume license",
|
|
6198
|
-
method: HttpMethod.PATCH,
|
|
6199
|
-
url: `/billing/${license.offline_id}/suspend/`,
|
|
6200
|
-
isAuthNeeded: true,
|
|
6201
|
-
blockers: [
|
|
6202
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6203
|
-
],
|
|
6204
|
-
blocks: []
|
|
6205
|
-
}).then((result) => {
|
|
6206
|
-
this.client.store.dispatch(updateLicense(result));
|
|
6207
|
-
return result;
|
|
6208
|
-
});
|
|
6209
|
-
}
|
|
6210
|
-
async cancelLicense(license) {
|
|
6211
|
-
this.client.store.dispatch(setIsFetchingInitialData(true));
|
|
6212
|
-
return this.enqueueRequest({
|
|
6213
|
-
description: "Cancel license",
|
|
6214
|
-
method: HttpMethod.DELETE,
|
|
6215
|
-
url: `/billing/${license.offline_id}/`,
|
|
6216
|
-
isAuthNeeded: true,
|
|
6217
|
-
blockers: [
|
|
6218
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6219
|
-
],
|
|
6220
|
-
blocks: []
|
|
6221
|
-
}).then((result) => {
|
|
6222
|
-
this.client.store.dispatch(updateLicense(result));
|
|
6223
|
-
return result;
|
|
6224
|
-
});
|
|
6225
|
-
}
|
|
6226
|
-
async attachLicenseToProject(license, project) {
|
|
6227
|
-
return this.enqueueRequest({
|
|
6228
|
-
description: "Attach license",
|
|
6229
|
-
method: HttpMethod.PATCH,
|
|
6230
|
-
url: `/billing/${license.offline_id}/project/`,
|
|
6231
|
-
isAuthNeeded: true,
|
|
6232
|
-
payload: { project: project.id },
|
|
6233
|
-
blockers: [
|
|
6234
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : "",
|
|
6235
|
-
project.id ? project.id.toString() : ""
|
|
6236
|
-
],
|
|
6237
|
-
blocks: []
|
|
6238
|
-
}).then((result) => {
|
|
6239
|
-
this.client.store.dispatch(updateLicense(result));
|
|
6240
|
-
return result;
|
|
6241
|
-
});
|
|
6242
|
-
}
|
|
6243
|
-
async detachLicenseFromProject(license) {
|
|
6244
|
-
return this.enqueueRequest({
|
|
6245
|
-
description: "Detach license",
|
|
6246
|
-
method: HttpMethod.DELETE,
|
|
6247
|
-
url: `/billing/${license.offline_id}/project/`,
|
|
6248
|
-
isAuthNeeded: true,
|
|
6249
|
-
blockers: [
|
|
6250
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6251
|
-
],
|
|
6252
|
-
blocks: []
|
|
6253
|
-
}).then((result) => {
|
|
6254
|
-
this.client.store.dispatch(updateLicense(result));
|
|
6255
|
-
return result;
|
|
6256
|
-
});
|
|
6257
|
-
}
|
|
6258
|
-
}
|
|
6259
6061
|
class OvermapSDK {
|
|
6260
6062
|
constructor(apiUrl, store) {
|
|
6261
6063
|
__publicField(this, "API_URL");
|
|
@@ -6281,7 +6083,6 @@ class OvermapSDK {
|
|
|
6281
6083
|
__publicField(this, "projectFiles", new ProjectFileService(this));
|
|
6282
6084
|
__publicField(this, "emailVerification", new EmailVerificationService(this));
|
|
6283
6085
|
__publicField(this, "emailDomains", new EmailDomainsService(this));
|
|
6284
|
-
__publicField(this, "licenses", new LicenseService(this));
|
|
6285
6086
|
this.API_URL = apiUrl;
|
|
6286
6087
|
this.store = store;
|
|
6287
6088
|
}
|
|
@@ -10428,9 +10229,9 @@ const PatchField = memo((props) => {
|
|
|
10428
10229
|
PatchField.displayName = "PatchField";
|
|
10429
10230
|
const PatchFormProvider = memo(
|
|
10430
10231
|
forwardRef((props, ref) => {
|
|
10431
|
-
const { children, schema, values, onPatch, onError, ...rest } = props;
|
|
10232
|
+
const { children, schema, values, onPatch, onError, requiresDiff = true, onDirtyChange, ...rest } = props;
|
|
10432
10233
|
const initialValues2 = useMemo(() => initialFormValues(schema.fields, values), [schema.fields, values]);
|
|
10433
|
-
const
|
|
10234
|
+
const getDiff = useCallback(
|
|
10434
10235
|
(values2) => {
|
|
10435
10236
|
const diff = {};
|
|
10436
10237
|
for (const key in values2) {
|
|
@@ -10439,11 +10240,18 @@ const PatchFormProvider = memo(
|
|
|
10439
10240
|
diff[key] = value;
|
|
10440
10241
|
}
|
|
10441
10242
|
}
|
|
10442
|
-
|
|
10243
|
+
return diff;
|
|
10244
|
+
},
|
|
10245
|
+
[initialValues2]
|
|
10246
|
+
);
|
|
10247
|
+
const handlePatch = useCallback(
|
|
10248
|
+
(values2) => {
|
|
10249
|
+
const diff = getDiff(values2);
|
|
10250
|
+
if (requiresDiff && !hasKeys(diff))
|
|
10443
10251
|
return;
|
|
10444
10252
|
onPatch(diff);
|
|
10445
10253
|
},
|
|
10446
|
-
[
|
|
10254
|
+
[getDiff, onPatch, requiresDiff]
|
|
10447
10255
|
);
|
|
10448
10256
|
const validate = useCallback(
|
|
10449
10257
|
(form) => {
|
|
@@ -10451,9 +10259,13 @@ const PatchFormProvider = memo(
|
|
|
10451
10259
|
if (error2) {
|
|
10452
10260
|
onError(error2);
|
|
10453
10261
|
}
|
|
10262
|
+
if (onDirtyChange) {
|
|
10263
|
+
const diff = getDiff(form);
|
|
10264
|
+
onDirtyChange(hasKeys(diff));
|
|
10265
|
+
}
|
|
10454
10266
|
return error2;
|
|
10455
10267
|
},
|
|
10456
|
-
[schema, onError]
|
|
10268
|
+
[schema, onDirtyChange, onError, getDiff]
|
|
10457
10269
|
);
|
|
10458
10270
|
const formik = useFormik({
|
|
10459
10271
|
initialValues: initialValues2,
|
|
@@ -10463,13 +10275,21 @@ const PatchFormProvider = memo(
|
|
|
10463
10275
|
validateOnBlur: false,
|
|
10464
10276
|
validateOnChange: false
|
|
10465
10277
|
});
|
|
10278
|
+
const handleChange = useCallback(() => {
|
|
10279
|
+
if (onDirtyChange) {
|
|
10280
|
+
const diff = getDiff(formik.values);
|
|
10281
|
+
if (hasKeys(diff)) {
|
|
10282
|
+
onDirtyChange(true);
|
|
10283
|
+
}
|
|
10284
|
+
}
|
|
10285
|
+
}, [formik.values, getDiff, onDirtyChange]);
|
|
10466
10286
|
const { errors, resetForm } = formik;
|
|
10467
10287
|
useEffect(() => {
|
|
10468
10288
|
if (hasKeys(errors)) {
|
|
10469
10289
|
resetForm({ values: initialValues2, errors: {} });
|
|
10470
10290
|
}
|
|
10471
10291
|
}, [errors, initialValues2, resetForm]);
|
|
10472
|
-
return /* @__PURE__ */ jsx(FormikProvider, { value: formik, children: /* @__PURE__ */ jsx("form", { ...rest, ref, onSubmit: formik.handleSubmit, children }) });
|
|
10292
|
+
return /* @__PURE__ */ jsx(FormikProvider, { value: formik, children: /* @__PURE__ */ jsx("form", { ...rest, ref, onSubmit: formik.handleSubmit, onChange: handleChange, children }) });
|
|
10473
10293
|
})
|
|
10474
10294
|
);
|
|
10475
10295
|
const typeBadge$1 = "_typeBadge_an5ff_1";
|
|
@@ -11470,9 +11290,6 @@ export {
|
|
|
11470
11290
|
IssuePriority,
|
|
11471
11291
|
IssueService,
|
|
11472
11292
|
IssueStatus,
|
|
11473
|
-
LicenseLevel,
|
|
11474
|
-
LicenseService,
|
|
11475
|
-
LicenseStatus,
|
|
11476
11293
|
MainService,
|
|
11477
11294
|
MapStyle,
|
|
11478
11295
|
MultiSelectField,
|
|
@@ -11520,7 +11337,6 @@ export {
|
|
|
11520
11337
|
addEmailDomain,
|
|
11521
11338
|
addFavouriteProjectId,
|
|
11522
11339
|
addIssue,
|
|
11523
|
-
addLicenses,
|
|
11524
11340
|
addOrReplaceCategories,
|
|
11525
11341
|
addOrReplaceIssueComment,
|
|
11526
11342
|
addOrReplaceProjectFile,
|
|
@@ -11619,8 +11435,6 @@ export {
|
|
|
11619
11435
|
issueReducer,
|
|
11620
11436
|
issueSlice,
|
|
11621
11437
|
issueToSearchResult,
|
|
11622
|
-
licenseReducer,
|
|
11623
|
-
licenseSlice,
|
|
11624
11438
|
literalToCoordinates,
|
|
11625
11439
|
logOnlyOnce,
|
|
11626
11440
|
makeClient,
|
|
@@ -11687,17 +11501,13 @@ export {
|
|
|
11687
11501
|
searchIssues,
|
|
11688
11502
|
selectAccessToken,
|
|
11689
11503
|
selectActiveIssueId,
|
|
11690
|
-
selectActiveLicense,
|
|
11691
11504
|
selectActiveOrganization,
|
|
11692
11505
|
selectActiveOrganizationAccess,
|
|
11693
11506
|
selectActiveOrganizationId,
|
|
11694
|
-
selectActiveOrganizationLicenses,
|
|
11695
|
-
selectActiveOrganizationProjects,
|
|
11696
11507
|
selectActiveProject,
|
|
11697
11508
|
selectActiveProjectAccess,
|
|
11698
11509
|
selectActiveProjectFileId,
|
|
11699
11510
|
selectActiveProjectId,
|
|
11700
|
-
selectActiveStatusLicenses,
|
|
11701
11511
|
selectActiveWorkspace,
|
|
11702
11512
|
selectActiveWorkspaceId,
|
|
11703
11513
|
selectAllAttachments,
|
|
@@ -11751,10 +11561,6 @@ export {
|
|
|
11751
11561
|
selectLatestFormRevision,
|
|
11752
11562
|
selectLatestRetryTime,
|
|
11753
11563
|
selectLatestRevisionByFormId,
|
|
11754
|
-
selectLicencesMapping,
|
|
11755
|
-
selectLicense,
|
|
11756
|
-
selectLicenseForProject,
|
|
11757
|
-
selectLicenses,
|
|
11758
11564
|
selectMainWorkspace,
|
|
11759
11565
|
selectMapStyle,
|
|
11760
11566
|
selectNumberOfComponentTypesMatchingCaseInsensitiveName,
|
|
@@ -11768,7 +11574,6 @@ export {
|
|
|
11768
11574
|
selectOrganizationUsersAsMapping,
|
|
11769
11575
|
selectOrganizationUsersIds,
|
|
11770
11576
|
selectOrganizations,
|
|
11771
|
-
selectOrganizationsMapping,
|
|
11772
11577
|
selectOrganizationsWithAccess,
|
|
11773
11578
|
selectPermittedWorkspaceIds,
|
|
11774
11579
|
selectPhotoAttachmentsOfIssue,
|
|
@@ -11789,7 +11594,6 @@ export {
|
|
|
11789
11594
|
selectRevisionsForForm,
|
|
11790
11595
|
selectShowTooltips,
|
|
11791
11596
|
selectSortedEmailDomains,
|
|
11792
|
-
selectSortedOrganizationLicenses,
|
|
11793
11597
|
selectSortedOrganizationUsers,
|
|
11794
11598
|
selectSortedProjectUsers,
|
|
11795
11599
|
selectSortedProjects,
|
|
@@ -11834,7 +11638,6 @@ export {
|
|
|
11834
11638
|
setIsImportingProjectFile,
|
|
11835
11639
|
setIssueComments,
|
|
11836
11640
|
setIssues,
|
|
11837
|
-
setLicenses,
|
|
11838
11641
|
setLoggedIn,
|
|
11839
11642
|
setMapStyle,
|
|
11840
11643
|
setOrganizationAccesses,
|
|
@@ -11869,12 +11672,9 @@ export {
|
|
|
11869
11672
|
unhideAllCategories,
|
|
11870
11673
|
unhideCategory,
|
|
11871
11674
|
updateActiveOrganization,
|
|
11872
|
-
updateActiveProjectFormSubmissionsCount,
|
|
11873
|
-
updateActiveProjectIssuesCount,
|
|
11874
11675
|
updateAttachment,
|
|
11875
11676
|
updateComponent,
|
|
11876
11677
|
updateIssue,
|
|
11877
|
-
updateLicense,
|
|
11878
11678
|
updateOrCreateProject,
|
|
11879
11679
|
updateOrganizationAccess,
|
|
11880
11680
|
updateProjectAccess,
|