@overmap-ai/core 1.0.38-projects-licensing.1 → 1.0.38
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 +190 -466
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +190 -466
- 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 +4 -2
- 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/settingsSlice.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 +2 -2
- package/dist/sdk/services/LicenseService.d.ts +0 -10
- package/dist/store/slices/licenseSlice.d.ts +0 -25
- package/dist/typings/models/license.d.ts +0 -24
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,20 +1852,21 @@ 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: {},
|
|
1859
1859
|
visibleStatuses: [IssueStatus.BACKLOG, IssueStatus.SELECTED],
|
|
1860
|
+
isFetchingInitialData: false,
|
|
1860
1861
|
visibleUserIds: null,
|
|
1861
1862
|
recentIssueIds: [],
|
|
1862
1863
|
activeIssueId: null
|
|
1863
1864
|
};
|
|
1864
1865
|
const issueSlice = createSlice({
|
|
1865
1866
|
name: "issues",
|
|
1866
|
-
initialState: initialState$
|
|
1867
|
+
initialState: initialState$e,
|
|
1867
1868
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
1868
|
-
Object.assign(state, initialState$
|
|
1869
|
+
Object.assign(state, initialState$e);
|
|
1869
1870
|
}),
|
|
1870
1871
|
reducers: {
|
|
1871
1872
|
setIssues: (state, action) => {
|
|
@@ -1944,6 +1945,9 @@ const issueSlice = createSlice({
|
|
|
1944
1945
|
setVisibleStatuses: (state, action) => {
|
|
1945
1946
|
state.visibleStatuses = action.payload;
|
|
1946
1947
|
},
|
|
1948
|
+
setIsFetchingInitialData: (state, action) => {
|
|
1949
|
+
state.isFetchingInitialData = action.payload;
|
|
1950
|
+
},
|
|
1947
1951
|
setVisibleUserIds: (state, action) => {
|
|
1948
1952
|
state.visibleUserIds = [...new Set(action.payload)];
|
|
1949
1953
|
},
|
|
@@ -2002,6 +2006,7 @@ const {
|
|
|
2002
2006
|
resetRecentIssues,
|
|
2003
2007
|
setActiveIssueId,
|
|
2004
2008
|
setAttachments,
|
|
2009
|
+
setIsFetchingInitialData,
|
|
2005
2010
|
setIssueComments,
|
|
2006
2011
|
setIssues,
|
|
2007
2012
|
setVisibleStatuses,
|
|
@@ -2100,6 +2105,7 @@ const selectIssue = restructureCreateSelectorWithArgs(
|
|
|
2100
2105
|
return mapping[id];
|
|
2101
2106
|
})
|
|
2102
2107
|
);
|
|
2108
|
+
const selectIsFetchingInitialData = (state) => state.issueReducer.isFetchingInitialData;
|
|
2103
2109
|
const selectAllAttachments = createSelector([selectIssueAttachmentMapping], (mapping) => Object.values(mapping));
|
|
2104
2110
|
const searchIssues = restructureCreateSelectorWithArgs(
|
|
2105
2111
|
createSelector(
|
|
@@ -2191,15 +2197,15 @@ const selectRecentIssuesAsSearchResults = createSelector(
|
|
|
2191
2197
|
}
|
|
2192
2198
|
);
|
|
2193
2199
|
const issueReducer = issueSlice.reducer;
|
|
2194
|
-
const initialState$
|
|
2200
|
+
const initialState$d = {
|
|
2195
2201
|
s3Urls: {}
|
|
2196
2202
|
};
|
|
2197
2203
|
const msPerHour = 1e3 * 60 * 60;
|
|
2198
2204
|
const msPerWeek = msPerHour * 24 * 7;
|
|
2199
2205
|
const fileSlice = createSlice({
|
|
2200
2206
|
name: "file",
|
|
2201
|
-
initialState: initialState$
|
|
2202
|
-
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)),
|
|
2203
2209
|
reducers: {
|
|
2204
2210
|
setUploadUrl: (state, action) => {
|
|
2205
2211
|
const { url, fields, sha1 } = action.payload;
|
|
@@ -2226,7 +2232,7 @@ const selectUploadUrl = (sha1) => (state) => {
|
|
|
2226
2232
|
return url;
|
|
2227
2233
|
};
|
|
2228
2234
|
const fileReducer = fileSlice.reducer;
|
|
2229
|
-
const initialState$
|
|
2235
|
+
const initialState$c = {
|
|
2230
2236
|
// TODO: Change first MapStyle.SATELLITE to MaptStyle.None when project creation map is fixed
|
|
2231
2237
|
mapStyle: MapStyle.SATELLITE,
|
|
2232
2238
|
showTooltips: false,
|
|
@@ -2234,8 +2240,8 @@ const initialState$d = {
|
|
|
2234
2240
|
};
|
|
2235
2241
|
const mapSlice = createSlice({
|
|
2236
2242
|
name: "map",
|
|
2237
|
-
initialState: initialState$
|
|
2238
|
-
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)),
|
|
2239
2245
|
reducers: {
|
|
2240
2246
|
setMapStyle: (state, action) => {
|
|
2241
2247
|
state.mapStyle = action.payload;
|
|
@@ -2277,23 +2283,7 @@ var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
|
|
|
2277
2283
|
VerificationCodeType2[VerificationCodeType2["RESET_PASSWORD"] = 10] = "RESET_PASSWORD";
|
|
2278
2284
|
return VerificationCodeType2;
|
|
2279
2285
|
})(VerificationCodeType || {});
|
|
2280
|
-
|
|
2281
|
-
PaddleCheckoutEvent2["COMPLETED"] = "checkout.completed";
|
|
2282
|
-
PaddleCheckoutEvent2["CLOSED"] = "checkout.closed";
|
|
2283
|
-
return PaddleCheckoutEvent2;
|
|
2284
|
-
})(PaddleCheckoutEvent || {});
|
|
2285
|
-
var LicenseLevel = /* @__PURE__ */ ((LicenseLevel2) => {
|
|
2286
|
-
LicenseLevel2[LicenseLevel2["PRO"] = 0] = "PRO";
|
|
2287
|
-
return LicenseLevel2;
|
|
2288
|
-
})(LicenseLevel || {});
|
|
2289
|
-
var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
|
|
2290
|
-
LicenseStatus2[LicenseStatus2["ACTIVE"] = 0] = "ACTIVE";
|
|
2291
|
-
LicenseStatus2[LicenseStatus2["PAUSED"] = 2] = "PAUSED";
|
|
2292
|
-
LicenseStatus2[LicenseStatus2["CANCELLED"] = 4] = "CANCELLED";
|
|
2293
|
-
LicenseStatus2[LicenseStatus2["INACTIVE"] = 6] = "INACTIVE";
|
|
2294
|
-
return LicenseStatus2;
|
|
2295
|
-
})(LicenseStatus || {});
|
|
2296
|
-
const initialState$c = {
|
|
2286
|
+
const initialState$b = {
|
|
2297
2287
|
users: {},
|
|
2298
2288
|
currentUser: {
|
|
2299
2289
|
id: 0,
|
|
@@ -2304,8 +2294,8 @@ const initialState$c = {
|
|
|
2304
2294
|
};
|
|
2305
2295
|
const userSlice = createSlice({
|
|
2306
2296
|
name: "users",
|
|
2307
|
-
initialState: initialState$
|
|
2308
|
-
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)),
|
|
2309
2299
|
reducers: {
|
|
2310
2300
|
setUsers: (state, action) => {
|
|
2311
2301
|
const usersMapping = {};
|
|
@@ -2367,13 +2357,13 @@ const selectUser = (userId) => (state) => {
|
|
|
2367
2357
|
const selectUsersAsMapping = (state) => state.userReducer.users;
|
|
2368
2358
|
const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
|
|
2369
2359
|
const userReducer = userSlice.reducer;
|
|
2370
|
-
const initialState$
|
|
2360
|
+
const initialState$a = {
|
|
2371
2361
|
organizationAccesses: {}
|
|
2372
2362
|
};
|
|
2373
2363
|
const organizationAccessSlice = createSlice({
|
|
2374
2364
|
name: "organizationAccess",
|
|
2375
|
-
initialState: initialState$
|
|
2376
|
-
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)),
|
|
2377
2367
|
reducers: {
|
|
2378
2368
|
setOrganizationAccesses: (state, action) => {
|
|
2379
2369
|
if (!Array.isArray(action.payload))
|
|
@@ -2436,13 +2426,151 @@ const selectOrganizationAccessUserMapping = (state) => {
|
|
|
2436
2426
|
return organizationAccesses;
|
|
2437
2427
|
};
|
|
2438
2428
|
const organizationAccessReducer = organizationAccessSlice.reducer;
|
|
2439
|
-
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 = {
|
|
2440
2568
|
projectAccesses: {}
|
|
2441
2569
|
};
|
|
2442
2570
|
const projectAccessSlice = createSlice({
|
|
2443
2571
|
name: "projectAccess",
|
|
2444
|
-
initialState: initialState$
|
|
2445
|
-
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)),
|
|
2446
2574
|
reducers: {
|
|
2447
2575
|
setProjectAccesses: (state, action) => {
|
|
2448
2576
|
if (!Array.isArray(action.payload))
|
|
@@ -2510,7 +2638,7 @@ const selectProjectAccessUserMapping = (state) => {
|
|
|
2510
2638
|
return projectAccesses;
|
|
2511
2639
|
};
|
|
2512
2640
|
const projectAccessReducer = projectAccessSlice.reducer;
|
|
2513
|
-
const initialState$
|
|
2641
|
+
const initialState$6 = {
|
|
2514
2642
|
projects: {},
|
|
2515
2643
|
activeProjectId: null,
|
|
2516
2644
|
recentProjectIds: [],
|
|
@@ -2519,7 +2647,7 @@ const initialState$9 = {
|
|
|
2519
2647
|
};
|
|
2520
2648
|
const projectSlice = createSlice({
|
|
2521
2649
|
name: "projects",
|
|
2522
|
-
initialState: initialState$
|
|
2650
|
+
initialState: initialState$6,
|
|
2523
2651
|
reducers: {
|
|
2524
2652
|
setProjects: (state, action) => {
|
|
2525
2653
|
const projectsMap = {};
|
|
@@ -2565,28 +2693,6 @@ const projectSlice = createSlice({
|
|
|
2565
2693
|
} else {
|
|
2566
2694
|
throw new Error("Accept project invite: user is not in this project");
|
|
2567
2695
|
}
|
|
2568
|
-
},
|
|
2569
|
-
updateActiveProjectIssuesCount: (state, action) => {
|
|
2570
|
-
if (state.activeProjectId && state.activeProjectId in state.projects) {
|
|
2571
|
-
if (!state.projects[state.activeProjectId].issues_count) {
|
|
2572
|
-
state.projects[state.activeProjectId].issues_count = action.payload;
|
|
2573
|
-
} else {
|
|
2574
|
-
state.projects[state.activeProjectId].issues_count += action.payload;
|
|
2575
|
-
}
|
|
2576
|
-
} else {
|
|
2577
|
-
throw new Error("Update issues count: no active project");
|
|
2578
|
-
}
|
|
2579
|
-
},
|
|
2580
|
-
updateActiveProjectFormSubmissionsCount: (state, action) => {
|
|
2581
|
-
if (state.activeProjectId && state.activeProjectId in state.projects) {
|
|
2582
|
-
if (!state.projects[state.activeProjectId].form_submissions_count) {
|
|
2583
|
-
state.projects[state.activeProjectId].form_submissions_count = action.payload;
|
|
2584
|
-
} else {
|
|
2585
|
-
state.projects[state.activeProjectId].form_submissions_count += action.payload;
|
|
2586
|
-
}
|
|
2587
|
-
} else {
|
|
2588
|
-
throw new Error("Update form submissions count: no active project");
|
|
2589
|
-
}
|
|
2590
2696
|
}
|
|
2591
2697
|
}
|
|
2592
2698
|
});
|
|
@@ -2597,9 +2703,7 @@ const {
|
|
|
2597
2703
|
setActiveProjectId,
|
|
2598
2704
|
setCreateProjectType,
|
|
2599
2705
|
deleteProject,
|
|
2600
|
-
acceptProjectInvite
|
|
2601
|
-
updateActiveProjectIssuesCount,
|
|
2602
|
-
updateActiveProjectFormSubmissionsCount
|
|
2706
|
+
acceptProjectInvite
|
|
2603
2707
|
} = projectSlice.actions;
|
|
2604
2708
|
const selectProjects = (state) => state.projectReducer.projects;
|
|
2605
2709
|
const selectActiveProjectId = (state) => state.projectReducer.activeProjectId;
|
|
@@ -2663,231 +2767,6 @@ const selectSortedProjectUsers = createSelector(
|
|
|
2663
2767
|
});
|
|
2664
2768
|
}
|
|
2665
2769
|
);
|
|
2666
|
-
const initialState$8 = {
|
|
2667
|
-
licenses: {}
|
|
2668
|
-
};
|
|
2669
|
-
const licenseSlice = createSlice({
|
|
2670
|
-
name: "license",
|
|
2671
|
-
initialState: initialState$8,
|
|
2672
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
|
|
2673
|
-
reducers: {
|
|
2674
|
-
setLicenses: (state, action) => {
|
|
2675
|
-
if (!Array.isArray(action.payload))
|
|
2676
|
-
throw new Error("Expected an array of Licenses");
|
|
2677
|
-
if (action.payload.filter(onlyUniqueOfflineIds).length !== action.payload.length) {
|
|
2678
|
-
throw new Error("Tried to use setLicenses reducer with duplicate ID's");
|
|
2679
|
-
}
|
|
2680
|
-
const licenses = {};
|
|
2681
|
-
for (const license of action.payload) {
|
|
2682
|
-
licenses[license.offline_id] = license;
|
|
2683
|
-
}
|
|
2684
|
-
state.licenses = licenses;
|
|
2685
|
-
},
|
|
2686
|
-
addLicenses: (state, action) => {
|
|
2687
|
-
for (const license of action.payload) {
|
|
2688
|
-
state.licenses[license.offline_id] = license;
|
|
2689
|
-
}
|
|
2690
|
-
},
|
|
2691
|
-
updateLicense: (state, action) => {
|
|
2692
|
-
if (!(action.payload.offline_id in state.licenses)) {
|
|
2693
|
-
throw new Error("Tried to update license that does not exist.");
|
|
2694
|
-
}
|
|
2695
|
-
state.licenses[action.payload.offline_id] = action.payload;
|
|
2696
|
-
}
|
|
2697
|
-
}
|
|
2698
|
-
});
|
|
2699
|
-
const { setLicenses, addLicenses, updateLicense } = licenseSlice.actions;
|
|
2700
|
-
const selectLicenses = (state) => {
|
|
2701
|
-
return state.licenseReducer.licenses;
|
|
2702
|
-
};
|
|
2703
|
-
const selectLicense = (licenseId) => (state) => state.licenseReducer.licenses[licenseId];
|
|
2704
|
-
const selectActiveLicense = createSelector(
|
|
2705
|
-
[selectLicenses, selectActiveProjectId],
|
|
2706
|
-
(licenses, activeProjectId) => {
|
|
2707
|
-
const activeLicense = Object.values(licenses).find((license) => license.project === activeProjectId);
|
|
2708
|
-
return activeLicense ?? null;
|
|
2709
|
-
}
|
|
2710
|
-
);
|
|
2711
|
-
const selectLicenseForProject = restructureCreateSelectorWithArgs(
|
|
2712
|
-
createSelector(
|
|
2713
|
-
[selectLicenses, (_state, projectId) => projectId],
|
|
2714
|
-
(licenses, projectId) => Object.values(licenses).find((license) => license.project === projectId) ?? null
|
|
2715
|
-
)
|
|
2716
|
-
);
|
|
2717
|
-
const selectActiveStatusLicenses = createSelector(
|
|
2718
|
-
[selectLicenses],
|
|
2719
|
-
(licenses) => Object.values(licenses).filter((license) => license.is_active)
|
|
2720
|
-
);
|
|
2721
|
-
const selectLicencesMapping = createSelector(
|
|
2722
|
-
[selectLicenses],
|
|
2723
|
-
(licenses) => Object.values(licenses).filter((license) => license.project).reduce((accum, license) => ({ ...accum, [license.project]: license }), {})
|
|
2724
|
-
);
|
|
2725
|
-
const licenseReducer = licenseSlice.reducer;
|
|
2726
|
-
const initialState$7 = {
|
|
2727
|
-
organizations: {},
|
|
2728
|
-
activeOrganizationId: null
|
|
2729
|
-
};
|
|
2730
|
-
const organizationSlice = createSlice({
|
|
2731
|
-
name: "organizations",
|
|
2732
|
-
initialState: initialState$7,
|
|
2733
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
|
|
2734
|
-
reducers: {
|
|
2735
|
-
setOrganizations: (state, action) => {
|
|
2736
|
-
for (const org of action.payload) {
|
|
2737
|
-
state.organizations[org.id] = org;
|
|
2738
|
-
}
|
|
2739
|
-
},
|
|
2740
|
-
updateActiveOrganization: (state, action) => {
|
|
2741
|
-
if (!state.activeOrganizationId) {
|
|
2742
|
-
throw new Error("Cannot update name of active organization. Active organization ID does not exist");
|
|
2743
|
-
}
|
|
2744
|
-
if (state.activeOrganizationId !== action.payload.id) {
|
|
2745
|
-
throw new Error("Tried updating active organization with different organization");
|
|
2746
|
-
}
|
|
2747
|
-
state.organizations[state.activeOrganizationId] = action.payload;
|
|
2748
|
-
},
|
|
2749
|
-
setActiveOrganizationId: (state, action) => {
|
|
2750
|
-
state.activeOrganizationId = action.payload;
|
|
2751
|
-
}
|
|
2752
|
-
}
|
|
2753
|
-
});
|
|
2754
|
-
const { setOrganizations, setActiveOrganizationId, updateActiveOrganization } = organizationSlice.actions;
|
|
2755
|
-
const selectActiveOrganizationId = (state) => {
|
|
2756
|
-
return state.organizationReducer.activeOrganizationId;
|
|
2757
|
-
};
|
|
2758
|
-
const selectOrganizations = (state) => {
|
|
2759
|
-
return Object.values(state.organizationReducer.organizations);
|
|
2760
|
-
};
|
|
2761
|
-
const selectOrganizationsMapping = (state) => {
|
|
2762
|
-
return state.organizationReducer.organizations;
|
|
2763
|
-
};
|
|
2764
|
-
const selectOrganizationsWithAccess = createSelector(
|
|
2765
|
-
[selectOrganizations],
|
|
2766
|
-
(organizations) => Object.values(organizations).filter((organization) => organization.has_access)
|
|
2767
|
-
);
|
|
2768
|
-
const selectActiveOrganization = (state) => {
|
|
2769
|
-
const id = selectActiveOrganizationId(state);
|
|
2770
|
-
if (!id) {
|
|
2771
|
-
return null;
|
|
2772
|
-
}
|
|
2773
|
-
const organization = state.organizationReducer.organizations[id];
|
|
2774
|
-
if (!organization) {
|
|
2775
|
-
return null;
|
|
2776
|
-
}
|
|
2777
|
-
return organization;
|
|
2778
|
-
};
|
|
2779
|
-
const selectOrganizationUsersIds = createSelector(
|
|
2780
|
-
[selectOrganizationAccesses],
|
|
2781
|
-
(organizationAccesses) => Object.values(organizationAccesses).map((organizationAccess) => organizationAccess.user)
|
|
2782
|
-
);
|
|
2783
|
-
const selectActiveOrganizationProjects = createSelector(
|
|
2784
|
-
[selectProjects, selectActiveOrganizationId],
|
|
2785
|
-
(projects, activeOrganizationId) => activeOrganizationId ? Object.values(projects).filter((project) => project.owner_organization === activeOrganizationId) : []
|
|
2786
|
-
);
|
|
2787
|
-
const selectActiveOrganizationLicenses = createSelector(
|
|
2788
|
-
[selectActiveOrganizationId, selectLicenses],
|
|
2789
|
-
(activeOrganizationId, licenses) => !activeOrganizationId ? [] : Object.values(licenses).filter((license) => license.organization_owner === activeOrganizationId)
|
|
2790
|
-
);
|
|
2791
|
-
const selectSortedOrganizationLicenses = createSelector(
|
|
2792
|
-
[selectActiveOrganizationLicenses, selectProjects],
|
|
2793
|
-
(licences, projects) => licences.sort((licenseA, licenseB) => {
|
|
2794
|
-
if (!licenseA.project) {
|
|
2795
|
-
return 1;
|
|
2796
|
-
}
|
|
2797
|
-
if (!licenseB.project) {
|
|
2798
|
-
return -1;
|
|
2799
|
-
}
|
|
2800
|
-
return projects[licenseA.project].name.toLowerCase().localeCompare(
|
|
2801
|
-
projects[licenseB.project].name.toLowerCase(),
|
|
2802
|
-
void 0,
|
|
2803
|
-
{ numeric: true }
|
|
2804
|
-
);
|
|
2805
|
-
})
|
|
2806
|
-
);
|
|
2807
|
-
const selectOrganizationUsersAsMapping = createSelector(
|
|
2808
|
-
[selectOrganizationUsersIds, selectUsersAsMapping],
|
|
2809
|
-
(organizationUserIds, users) => organizationUserIds.reduce((accum, userId) => ({ ...accum, [userId]: users[userId] }), {})
|
|
2810
|
-
);
|
|
2811
|
-
const selectSortedOrganizationUsers = createSelector(
|
|
2812
|
-
[selectCurrentUser, selectOrganizationUsersAsMapping, selectOrganizationAccessUserMapping],
|
|
2813
|
-
(currentUser, userMapping, organizationAccessMapping) => {
|
|
2814
|
-
return Object.values(userMapping).sort((userA, userB) => {
|
|
2815
|
-
if (userA.id === currentUser.id) {
|
|
2816
|
-
return -1;
|
|
2817
|
-
} else if (userB.id === currentUser.id) {
|
|
2818
|
-
return 1;
|
|
2819
|
-
}
|
|
2820
|
-
const organizationAccessesA = organizationAccessMapping[userA.id];
|
|
2821
|
-
const organizationAccessesB = organizationAccessMapping[userB.id];
|
|
2822
|
-
if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === (organizationAccessesB == null ? void 0 : organizationAccessesB.access_level)) {
|
|
2823
|
-
return userA.username.localeCompare(userB.username);
|
|
2824
|
-
}
|
|
2825
|
-
if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === OrganizationAccessLevel.ADMIN) {
|
|
2826
|
-
return -1;
|
|
2827
|
-
}
|
|
2828
|
-
return 1;
|
|
2829
|
-
});
|
|
2830
|
-
}
|
|
2831
|
-
);
|
|
2832
|
-
const selectOrganization = (id) => (state) => {
|
|
2833
|
-
return state.organizationReducer.organizations[id];
|
|
2834
|
-
};
|
|
2835
|
-
const organizationReducer = organizationSlice.reducer;
|
|
2836
|
-
const createOfflineAction = (request2, baseUrl) => {
|
|
2837
|
-
const requestWithUuid = request2.uuid ? request2 : { ...request2, uuid: v4() };
|
|
2838
|
-
return {
|
|
2839
|
-
payload: requestWithUuid,
|
|
2840
|
-
type: "",
|
|
2841
|
-
meta: {
|
|
2842
|
-
offline: {
|
|
2843
|
-
effect: {
|
|
2844
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2845
|
-
request: requestWithUuid,
|
|
2846
|
-
BASE_URL: baseUrl
|
|
2847
|
-
}
|
|
2848
|
-
}
|
|
2849
|
-
}
|
|
2850
|
-
};
|
|
2851
|
-
};
|
|
2852
|
-
const initialState$6 = {
|
|
2853
|
-
deletedRequests: [],
|
|
2854
|
-
latestRetryTime: 0
|
|
2855
|
-
};
|
|
2856
|
-
const outboxSlice = createSlice({
|
|
2857
|
-
name: "outbox",
|
|
2858
|
-
initialState: initialState$6,
|
|
2859
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
|
|
2860
|
-
reducers: {
|
|
2861
|
-
// enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
|
|
2862
|
-
// Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
|
|
2863
|
-
// Then this reducer enqueueRequest() is responsible for adding the actual request data to the outbox
|
|
2864
|
-
enqueueRequest: {
|
|
2865
|
-
reducer: (state, _action) => {
|
|
2866
|
-
return state;
|
|
2867
|
-
},
|
|
2868
|
-
prepare: (payload) => {
|
|
2869
|
-
console.debug("Preparing to enqueue request", payload);
|
|
2870
|
-
const { BASE_URL, ...rest } = payload;
|
|
2871
|
-
return createOfflineAction(rest, BASE_URL);
|
|
2872
|
-
}
|
|
2873
|
-
},
|
|
2874
|
-
markForDeletion(state, action) {
|
|
2875
|
-
state.deletedRequests.push(action.payload);
|
|
2876
|
-
},
|
|
2877
|
-
markAsDeleted(state, action) {
|
|
2878
|
-
const index2 = state.deletedRequests.indexOf(action.payload);
|
|
2879
|
-
if (index2 !== -1)
|
|
2880
|
-
state.deletedRequests.splice(index2, 1);
|
|
2881
|
-
},
|
|
2882
|
-
_setLatestRetryTime: (state, action) => {
|
|
2883
|
-
state.latestRetryTime = action.payload;
|
|
2884
|
-
}
|
|
2885
|
-
}
|
|
2886
|
-
});
|
|
2887
|
-
const selectDeletedRequests = (state) => state.outboxReducer.deletedRequests;
|
|
2888
|
-
const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
|
|
2889
|
-
const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
|
|
2890
|
-
const outboxReducer = outboxSlice.reducer;
|
|
2891
2770
|
const initialState$5 = {
|
|
2892
2771
|
projectFiles: {},
|
|
2893
2772
|
activeProjectFileId: null,
|
|
@@ -3024,9 +2903,7 @@ const initialState$3 = {
|
|
|
3024
2903
|
Components: false,
|
|
3025
2904
|
Experimental: false
|
|
3026
2905
|
},
|
|
3027
|
-
appearance: "dark"
|
|
3028
|
-
isFetchingInitialData: false,
|
|
3029
|
-
isLoading: false
|
|
2906
|
+
appearance: "dark"
|
|
3030
2907
|
};
|
|
3031
2908
|
const settingSlice = createSlice({
|
|
3032
2909
|
name: "settings",
|
|
@@ -3050,12 +2927,6 @@ const settingSlice = createSlice({
|
|
|
3050
2927
|
},
|
|
3051
2928
|
setAppearance: (state, action) => {
|
|
3052
2929
|
state.appearance = action.payload;
|
|
3053
|
-
},
|
|
3054
|
-
setIsFetchingInitialData: (state, action) => {
|
|
3055
|
-
state.isFetchingInitialData = action.payload;
|
|
3056
|
-
},
|
|
3057
|
-
setIsLoading: (state, action) => {
|
|
3058
|
-
state.isLoading = action.payload;
|
|
3059
2930
|
}
|
|
3060
2931
|
}
|
|
3061
2932
|
});
|
|
@@ -3064,9 +2935,7 @@ const {
|
|
|
3064
2935
|
setEnablePlacementMode,
|
|
3065
2936
|
setSectionExpanded,
|
|
3066
2937
|
setEnableClustering,
|
|
3067
|
-
setAppearance
|
|
3068
|
-
setIsFetchingInitialData,
|
|
3069
|
-
setIsLoading
|
|
2938
|
+
setAppearance
|
|
3070
2939
|
} = settingSlice.actions;
|
|
3071
2940
|
const selectEnablePlacementMode = (state) => state.settingReducer.placementMode;
|
|
3072
2941
|
const selectEnableDuplicateIssues = (state) => state.settingReducer.useIssueTemplate;
|
|
@@ -3075,8 +2944,6 @@ const selectExpandedSections = (state) => state.settingReducer.expandedSections;
|
|
|
3075
2944
|
const selectEnableClustering = (state) => state.settingReducer.enableClustering;
|
|
3076
2945
|
const selectAppearance = (state) => state.settingReducer.appearance;
|
|
3077
2946
|
const settingReducer = settingSlice.reducer;
|
|
3078
|
-
const selectIsFetchingInitialData = (state) => state.settingReducer.isFetchingInitialData;
|
|
3079
|
-
const selectIsLoading = (state) => state.settingReducer.isLoading;
|
|
3080
2947
|
const LATEST_REVISION_CACHE = {};
|
|
3081
2948
|
function considerCachingRevision(revision, formId2, preferPending = false) {
|
|
3082
2949
|
var _a2;
|
|
@@ -3478,8 +3345,7 @@ const overmapReducers = {
|
|
|
3478
3345
|
userFormReducer,
|
|
3479
3346
|
userReducer,
|
|
3480
3347
|
workspaceReducer,
|
|
3481
|
-
emailDomainsReducer
|
|
3482
|
-
licenseReducer
|
|
3348
|
+
emailDomainsReducer
|
|
3483
3349
|
};
|
|
3484
3350
|
const overmapReducer = combineReducers(overmapReducers);
|
|
3485
3351
|
const resetStore = "RESET";
|
|
@@ -4933,7 +4799,6 @@ class IssueService extends BaseApiService {
|
|
|
4933
4799
|
});
|
|
4934
4800
|
store.dispatch(addIssue(issuePayload));
|
|
4935
4801
|
store.dispatch(addToRecentIssues(issuePayload.offline_id));
|
|
4936
|
-
store.dispatch(updateActiveProjectIssuesCount(1));
|
|
4937
4802
|
const promise = this.enqueueRequest({
|
|
4938
4803
|
description: "Create issue",
|
|
4939
4804
|
method: HttpMethod.POST,
|
|
@@ -4960,7 +4825,6 @@ class IssueService extends BaseApiService {
|
|
|
4960
4825
|
});
|
|
4961
4826
|
}
|
|
4962
4827
|
store.dispatch(removeIssue(issuePayload.offline_id));
|
|
4963
|
-
store.dispatch(updateActiveProjectIssuesCount(-1));
|
|
4964
4828
|
throw error2;
|
|
4965
4829
|
});
|
|
4966
4830
|
return [issuePayload, promise];
|
|
@@ -4999,8 +4863,7 @@ class IssueService extends BaseApiService {
|
|
|
4999
4863
|
return [fullIssue, promise];
|
|
5000
4864
|
}
|
|
5001
4865
|
async remove(id) {
|
|
5002
|
-
const
|
|
5003
|
-
const state = store.getState();
|
|
4866
|
+
const state = this.client.store.getState();
|
|
5004
4867
|
const backup = state.issueReducer.issues[id];
|
|
5005
4868
|
if (!backup) {
|
|
5006
4869
|
throw new Error(`No issue with id ${id} found in the store`);
|
|
@@ -5008,7 +4871,6 @@ class IssueService extends BaseApiService {
|
|
|
5008
4871
|
const attachments = Object.values(state.issueReducer.attachments).filter((a) => a.issue_id === id);
|
|
5009
4872
|
const attachmentsOfIssue = selectPhotoAttachmentsOfIssue(id)(state);
|
|
5010
4873
|
this.client.store.dispatch(removeIssue(id));
|
|
5011
|
-
store.dispatch(updateActiveProjectIssuesCount(-1));
|
|
5012
4874
|
if (attachmentsOfIssue) {
|
|
5013
4875
|
this.client.store.dispatch(removeAttachmentsOfIssue(id));
|
|
5014
4876
|
}
|
|
@@ -5023,7 +4885,6 @@ class IssueService extends BaseApiService {
|
|
|
5023
4885
|
} catch (e) {
|
|
5024
4886
|
this.client.store.dispatch(addIssue(backup));
|
|
5025
4887
|
this.client.store.dispatch(addAttachments(attachments));
|
|
5026
|
-
store.dispatch(updateActiveProjectIssuesCount(1));
|
|
5027
4888
|
throw e;
|
|
5028
4889
|
}
|
|
5029
4890
|
}
|
|
@@ -5099,9 +4960,7 @@ class MainService extends BaseApiService {
|
|
|
5099
4960
|
owner_organization: projectData.organization_owner,
|
|
5100
4961
|
owner_user: projectData.user_owner,
|
|
5101
4962
|
bounds: projectData.bounds,
|
|
5102
|
-
invited: projectData.invited || false
|
|
5103
|
-
issues_count: projectData.issues_count,
|
|
5104
|
-
form_submissions_count: projectData.form_submissions_count
|
|
4963
|
+
invited: projectData.invited || false
|
|
5105
4964
|
});
|
|
5106
4965
|
if (currentProjectId === projectData.id && !projectData.invited) {
|
|
5107
4966
|
isProjectIdValid = true;
|
|
@@ -5119,7 +4978,6 @@ class MainService extends BaseApiService {
|
|
|
5119
4978
|
}
|
|
5120
4979
|
store.dispatch(setCurrentUser(data.user));
|
|
5121
4980
|
store.dispatch(addUsers(data.project_owners));
|
|
5122
|
-
store.dispatch(setLicenses(data.licenses));
|
|
5123
4981
|
const organizationsData = data.organizations;
|
|
5124
4982
|
store.dispatch(setOrganizations(organizationsData));
|
|
5125
4983
|
const validProjects = projects.filter((project) => !project.invited);
|
|
@@ -5432,7 +5290,6 @@ class ProjectService extends BaseApiService {
|
|
|
5432
5290
|
if (!project) {
|
|
5433
5291
|
throw new Error("Expected project to exist");
|
|
5434
5292
|
}
|
|
5435
|
-
const license = selectLicenseForProject(project.id);
|
|
5436
5293
|
const activeProjectId = state.projectReducer.activeProjectId;
|
|
5437
5294
|
if (activeProjectId === projectId) {
|
|
5438
5295
|
store.dispatch({ type: "project/setActiveProjectId", payload: null });
|
|
@@ -5443,9 +5300,6 @@ class ProjectService extends BaseApiService {
|
|
|
5443
5300
|
store.dispatch(removeProjectAccessesOfProject(project.id));
|
|
5444
5301
|
store.dispatch({ type: "rehydrated/setRehydrated", payload: false });
|
|
5445
5302
|
store.dispatch(deleteProject(project));
|
|
5446
|
-
if (license) {
|
|
5447
|
-
store.dispatch(updateLicense({ ...license, project: null }));
|
|
5448
|
-
}
|
|
5449
5303
|
try {
|
|
5450
5304
|
await this.enqueueRequest({
|
|
5451
5305
|
description: "Delete project",
|
|
@@ -5461,9 +5315,6 @@ class ProjectService extends BaseApiService {
|
|
|
5461
5315
|
store.dispatch(addOrReplaceProjectFiles(filesToDelete));
|
|
5462
5316
|
store.dispatch(setActiveProjectId(activeProjectId));
|
|
5463
5317
|
store.dispatch({ type: "rehydrated/setRehydrated", payload: true });
|
|
5464
|
-
if (license) {
|
|
5465
|
-
store.dispatch(updateLicense({ ...license, project: project.id }));
|
|
5466
|
-
}
|
|
5467
5318
|
throw e;
|
|
5468
5319
|
}
|
|
5469
5320
|
}
|
|
@@ -5840,11 +5691,9 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
5840
5691
|
store.dispatch(addUserFormSubmission(offlineResultWithoutFiles));
|
|
5841
5692
|
void promise.then((result) => {
|
|
5842
5693
|
store.dispatch(addUserFormSubmission(result));
|
|
5843
|
-
store.dispatch(updateActiveProjectFormSubmissionsCount(1));
|
|
5844
5694
|
return result;
|
|
5845
5695
|
}).catch(() => {
|
|
5846
5696
|
store.dispatch(deleteUserFormSubmission(payload.offline_id));
|
|
5847
|
-
store.dispatch(updateActiveProjectFormSubmissionsCount(-1));
|
|
5848
5697
|
});
|
|
5849
5698
|
const settledPromise = Promise.all([promise, ...attachFilesPromises]).then(() => promise);
|
|
5850
5699
|
return [fullOfflineResult, settledPromise];
|
|
@@ -5854,7 +5703,6 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
5854
5703
|
const state = store.getState();
|
|
5855
5704
|
const submission = state.userFormReducer.submissions[submissionId];
|
|
5856
5705
|
store.dispatch(deleteUserFormSubmission(submissionId));
|
|
5857
|
-
store.dispatch(updateActiveProjectFormSubmissionsCount(-1));
|
|
5858
5706
|
try {
|
|
5859
5707
|
return await this.enqueueRequest({
|
|
5860
5708
|
description: "Delete user form submissions",
|
|
@@ -5866,7 +5714,6 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
5866
5714
|
} catch (e) {
|
|
5867
5715
|
if (submission) {
|
|
5868
5716
|
store.dispatch(addUserFormSubmission(submission));
|
|
5869
|
-
store.dispatch(updateActiveProjectFormSubmissionsCount(1));
|
|
5870
5717
|
}
|
|
5871
5718
|
throw e;
|
|
5872
5719
|
}
|
|
@@ -6279,12 +6126,10 @@ class OrganizationService extends BaseApiService {
|
|
|
6279
6126
|
const organizationAccesses = data.organization_accesses;
|
|
6280
6127
|
const emailDomains = data.email_domains;
|
|
6281
6128
|
const users = data.users;
|
|
6282
|
-
const licenses = data.licenses;
|
|
6283
6129
|
store.dispatch(addUsers(users));
|
|
6284
6130
|
store.dispatch(setActiveOrganizationId(activeOrganization.id));
|
|
6285
6131
|
store.dispatch(setOrganizationAccesses(organizationAccesses));
|
|
6286
6132
|
store.dispatch(setEmailDomains(emailDomains));
|
|
6287
|
-
store.dispatch(addLicenses(licenses));
|
|
6288
6133
|
if (showLoading) {
|
|
6289
6134
|
store.dispatch(setIsFetchingInitialData(false));
|
|
6290
6135
|
}
|
|
@@ -6325,103 +6170,6 @@ class OrganizationService extends BaseApiService {
|
|
|
6325
6170
|
});
|
|
6326
6171
|
}
|
|
6327
6172
|
}
|
|
6328
|
-
class LicenseService extends BaseApiService {
|
|
6329
|
-
async getLicensesForOrganization(organizationId, showLoading = false) {
|
|
6330
|
-
if (showLoading) {
|
|
6331
|
-
this.client.store.dispatch(setIsFetchingInitialData(true));
|
|
6332
|
-
}
|
|
6333
|
-
return this.enqueueRequest({
|
|
6334
|
-
description: "Get licenses",
|
|
6335
|
-
method: HttpMethod.GET,
|
|
6336
|
-
url: `/organizations/${organizationId}/licenses/`,
|
|
6337
|
-
isAuthNeeded: true,
|
|
6338
|
-
blockers: [organizationId.toString()],
|
|
6339
|
-
blocks: []
|
|
6340
|
-
}).then((result) => {
|
|
6341
|
-
if (showLoading) {
|
|
6342
|
-
this.client.store.dispatch(setIsFetchingInitialData(false));
|
|
6343
|
-
}
|
|
6344
|
-
return result;
|
|
6345
|
-
});
|
|
6346
|
-
}
|
|
6347
|
-
async pauseLicense(license) {
|
|
6348
|
-
return this.enqueueRequest({
|
|
6349
|
-
description: "Pause license",
|
|
6350
|
-
method: HttpMethod.DELETE,
|
|
6351
|
-
url: `/billing/${license.offline_id}/suspend/`,
|
|
6352
|
-
isAuthNeeded: true,
|
|
6353
|
-
blockers: [
|
|
6354
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6355
|
-
],
|
|
6356
|
-
blocks: []
|
|
6357
|
-
}).then((result) => {
|
|
6358
|
-
this.client.store.dispatch(updateLicense(result));
|
|
6359
|
-
return result;
|
|
6360
|
-
});
|
|
6361
|
-
}
|
|
6362
|
-
async resumeLicense(license) {
|
|
6363
|
-
return this.enqueueRequest({
|
|
6364
|
-
description: "Resume license",
|
|
6365
|
-
method: HttpMethod.PATCH,
|
|
6366
|
-
url: `/billing/${license.offline_id}/suspend/`,
|
|
6367
|
-
isAuthNeeded: true,
|
|
6368
|
-
blockers: [
|
|
6369
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6370
|
-
],
|
|
6371
|
-
blocks: []
|
|
6372
|
-
}).then((result) => {
|
|
6373
|
-
this.client.store.dispatch(updateLicense(result));
|
|
6374
|
-
return result;
|
|
6375
|
-
});
|
|
6376
|
-
}
|
|
6377
|
-
async cancelLicense(license) {
|
|
6378
|
-
return this.enqueueRequest({
|
|
6379
|
-
description: "Cancel license",
|
|
6380
|
-
method: HttpMethod.DELETE,
|
|
6381
|
-
url: `/billing/${license.offline_id}/`,
|
|
6382
|
-
isAuthNeeded: true,
|
|
6383
|
-
blockers: [
|
|
6384
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6385
|
-
],
|
|
6386
|
-
blocks: []
|
|
6387
|
-
}).then((result) => {
|
|
6388
|
-
this.client.store.dispatch(updateLicense(result));
|
|
6389
|
-
return result;
|
|
6390
|
-
});
|
|
6391
|
-
}
|
|
6392
|
-
async attachLicenseToProject(license, project) {
|
|
6393
|
-
return this.enqueueRequest({
|
|
6394
|
-
description: "Attach license",
|
|
6395
|
-
method: HttpMethod.PATCH,
|
|
6396
|
-
url: `/billing/${license.offline_id}/project/`,
|
|
6397
|
-
isAuthNeeded: true,
|
|
6398
|
-
payload: { project: project.id },
|
|
6399
|
-
blockers: [
|
|
6400
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : "",
|
|
6401
|
-
project.id ? project.id.toString() : ""
|
|
6402
|
-
],
|
|
6403
|
-
blocks: []
|
|
6404
|
-
}).then((result) => {
|
|
6405
|
-
this.client.store.dispatch(updateLicense(result));
|
|
6406
|
-
return result;
|
|
6407
|
-
});
|
|
6408
|
-
}
|
|
6409
|
-
async detachLicenseFromProject(license) {
|
|
6410
|
-
return this.enqueueRequest({
|
|
6411
|
-
description: "Detach license",
|
|
6412
|
-
method: HttpMethod.DELETE,
|
|
6413
|
-
url: `/billing/${license.offline_id}/project/`,
|
|
6414
|
-
isAuthNeeded: true,
|
|
6415
|
-
blockers: [
|
|
6416
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6417
|
-
],
|
|
6418
|
-
blocks: []
|
|
6419
|
-
}).then((result) => {
|
|
6420
|
-
this.client.store.dispatch(updateLicense(result));
|
|
6421
|
-
return result;
|
|
6422
|
-
});
|
|
6423
|
-
}
|
|
6424
|
-
}
|
|
6425
6173
|
class OvermapSDK {
|
|
6426
6174
|
constructor(apiUrl, store) {
|
|
6427
6175
|
__publicField(this, "API_URL");
|
|
@@ -6447,7 +6195,6 @@ class OvermapSDK {
|
|
|
6447
6195
|
__publicField(this, "projectFiles", new ProjectFileService(this));
|
|
6448
6196
|
__publicField(this, "emailVerification", new EmailVerificationService(this));
|
|
6449
6197
|
__publicField(this, "emailDomains", new EmailDomainsService(this));
|
|
6450
|
-
__publicField(this, "licenses", new LicenseService(this));
|
|
6451
6198
|
this.API_URL = apiUrl;
|
|
6452
6199
|
this.store = store;
|
|
6453
6200
|
}
|
|
@@ -12013,9 +11760,6 @@ export {
|
|
|
12013
11760
|
IssuePriority,
|
|
12014
11761
|
IssueService,
|
|
12015
11762
|
IssueStatus,
|
|
12016
|
-
LicenseLevel,
|
|
12017
|
-
LicenseService,
|
|
12018
|
-
LicenseStatus,
|
|
12019
11763
|
MainService,
|
|
12020
11764
|
MapStyle,
|
|
12021
11765
|
MultiSelectField,
|
|
@@ -12032,7 +11776,6 @@ export {
|
|
|
12032
11776
|
OvermapContext,
|
|
12033
11777
|
OvermapProvider,
|
|
12034
11778
|
OvermapSDK,
|
|
12035
|
-
PaddleCheckoutEvent,
|
|
12036
11779
|
PatchField,
|
|
12037
11780
|
PatchFormProvider,
|
|
12038
11781
|
ProjectAccessLevel,
|
|
@@ -12064,7 +11807,6 @@ export {
|
|
|
12064
11807
|
addEmailDomain,
|
|
12065
11808
|
addFavouriteProjectId,
|
|
12066
11809
|
addIssue,
|
|
12067
|
-
addLicenses,
|
|
12068
11810
|
addOrReplaceCategories,
|
|
12069
11811
|
addOrReplaceIssueComment,
|
|
12070
11812
|
addOrReplaceProjectFile,
|
|
@@ -12164,8 +11906,6 @@ export {
|
|
|
12164
11906
|
issueReducer,
|
|
12165
11907
|
issueSlice,
|
|
12166
11908
|
issueToSearchResult,
|
|
12167
|
-
licenseReducer,
|
|
12168
|
-
licenseSlice,
|
|
12169
11909
|
literalToCoordinates,
|
|
12170
11910
|
logOnlyOnce,
|
|
12171
11911
|
makeClient,
|
|
@@ -12232,17 +11972,13 @@ export {
|
|
|
12232
11972
|
searchIssues,
|
|
12233
11973
|
selectAccessToken,
|
|
12234
11974
|
selectActiveIssueId,
|
|
12235
|
-
selectActiveLicense,
|
|
12236
11975
|
selectActiveOrganization,
|
|
12237
11976
|
selectActiveOrganizationAccess,
|
|
12238
11977
|
selectActiveOrganizationId,
|
|
12239
|
-
selectActiveOrganizationLicenses,
|
|
12240
|
-
selectActiveOrganizationProjects,
|
|
12241
11978
|
selectActiveProject,
|
|
12242
11979
|
selectActiveProjectAccess,
|
|
12243
11980
|
selectActiveProjectFileId,
|
|
12244
11981
|
selectActiveProjectId,
|
|
12245
|
-
selectActiveStatusLicenses,
|
|
12246
11982
|
selectActiveWorkspace,
|
|
12247
11983
|
selectActiveWorkspaceId,
|
|
12248
11984
|
selectAllAttachments,
|
|
@@ -12288,7 +12024,6 @@ export {
|
|
|
12288
12024
|
selectHiddenComponentTypeIds,
|
|
12289
12025
|
selectIsFetchingInitialData,
|
|
12290
12026
|
selectIsImportingProjectFile,
|
|
12291
|
-
selectIsLoading,
|
|
12292
12027
|
selectIsLoggedIn,
|
|
12293
12028
|
selectIssue,
|
|
12294
12029
|
selectIssueAttachmentMapping,
|
|
@@ -12298,10 +12033,6 @@ export {
|
|
|
12298
12033
|
selectLatestFormRevision,
|
|
12299
12034
|
selectLatestRetryTime,
|
|
12300
12035
|
selectLatestRevisionByFormId,
|
|
12301
|
-
selectLicencesMapping,
|
|
12302
|
-
selectLicense,
|
|
12303
|
-
selectLicenseForProject,
|
|
12304
|
-
selectLicenses,
|
|
12305
12036
|
selectMainWorkspace,
|
|
12306
12037
|
selectMapStyle,
|
|
12307
12038
|
selectNumberOfComponentTypesMatchingCaseInsensitiveName,
|
|
@@ -12315,7 +12046,6 @@ export {
|
|
|
12315
12046
|
selectOrganizationUsersAsMapping,
|
|
12316
12047
|
selectOrganizationUsersIds,
|
|
12317
12048
|
selectOrganizations,
|
|
12318
|
-
selectOrganizationsMapping,
|
|
12319
12049
|
selectOrganizationsWithAccess,
|
|
12320
12050
|
selectPermittedWorkspaceIds,
|
|
12321
12051
|
selectPhotoAttachmentsOfIssue,
|
|
@@ -12337,7 +12067,6 @@ export {
|
|
|
12337
12067
|
selectRevisionsForForm,
|
|
12338
12068
|
selectShowTooltips,
|
|
12339
12069
|
selectSortedEmailDomains,
|
|
12340
|
-
selectSortedOrganizationLicenses,
|
|
12341
12070
|
selectSortedOrganizationUsers,
|
|
12342
12071
|
selectSortedProjectUsers,
|
|
12343
12072
|
selectSortedProjects,
|
|
@@ -12380,10 +12109,8 @@ export {
|
|
|
12380
12109
|
setEnablePlacementMode,
|
|
12381
12110
|
setIsFetchingInitialData,
|
|
12382
12111
|
setIsImportingProjectFile,
|
|
12383
|
-
setIsLoading,
|
|
12384
12112
|
setIssueComments,
|
|
12385
12113
|
setIssues,
|
|
12386
|
-
setLicenses,
|
|
12387
12114
|
setLoggedIn,
|
|
12388
12115
|
setMapStyle,
|
|
12389
12116
|
setOrganizationAccesses,
|
|
@@ -12419,12 +12146,9 @@ export {
|
|
|
12419
12146
|
unhideAllCategories,
|
|
12420
12147
|
unhideCategory,
|
|
12421
12148
|
updateActiveOrganization,
|
|
12422
|
-
updateActiveProjectFormSubmissionsCount,
|
|
12423
|
-
updateActiveProjectIssuesCount,
|
|
12424
12149
|
updateAttachment,
|
|
12425
12150
|
updateComponent,
|
|
12426
12151
|
updateIssue,
|
|
12427
|
-
updateLicense,
|
|
12428
12152
|
updateOrCreateProject,
|
|
12429
12153
|
updateOrganizationAccess,
|
|
12430
12154
|
updateProjectAccess,
|