@overmap-ai/core 1.0.65-asset-models-improvements.3 → 1.0.65-current-user-cleaup.0
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/enums/index.d.ts +0 -3
- package/dist/enums/issue.d.ts +0 -9
- package/dist/overmap-core.js +456 -585
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +453 -582
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/base.d.ts +1 -1
- package/dist/sdk/globals.d.ts +2 -2
- package/dist/sdk/sdk.d.ts +3 -3
- package/dist/sdk/services/AgentService.d.ts +1 -1
- package/dist/sdk/services/AssetAttachmentService.d.ts +2 -3
- package/dist/sdk/services/AssetService.d.ts +6 -5
- package/dist/sdk/services/AssetStageCompletionService.d.ts +12 -6
- package/dist/sdk/services/AssetStageService.d.ts +4 -5
- package/dist/sdk/services/AssetTypeAttachmentService.d.ts +2 -3
- package/dist/sdk/services/AssetTypeService.d.ts +4 -4
- package/dist/sdk/services/BaseApiService.d.ts +1 -1
- package/dist/sdk/services/BaseAttachmentService.d.ts +2 -3
- package/dist/sdk/services/BaseAuthService.d.ts +1 -1
- package/dist/sdk/services/BaseService.d.ts +2 -2
- package/dist/sdk/services/BaseUploadService.d.ts +2 -2
- package/dist/sdk/services/CategoryService.d.ts +2 -2
- package/dist/sdk/services/DocumentAttachmentService.d.ts +2 -3
- package/dist/sdk/services/DocumentService.d.ts +2 -2
- package/dist/sdk/services/EmailDomainsService.d.ts +1 -1
- package/dist/sdk/services/EmailVerificationService.d.ts +1 -1
- package/dist/sdk/services/FileService.d.ts +1 -1
- package/dist/sdk/services/FormService.d.ts +2 -1
- package/dist/sdk/services/FormSubmissionService.d.ts +3 -2
- package/dist/sdk/services/GeoImageService.d.ts +2 -2
- package/dist/sdk/services/IssueAttachmentService.d.ts +2 -3
- package/dist/sdk/services/IssueCommentService.d.ts +2 -2
- package/dist/sdk/services/IssueService.d.ts +2 -2
- package/dist/sdk/services/IssueTypeService.d.ts +2 -2
- package/dist/sdk/services/IssueUpdateService.d.ts +1 -1
- package/dist/sdk/services/JWTAuthService.d.ts +2 -2
- package/dist/sdk/services/LicenseService.d.ts +1 -1
- package/dist/sdk/services/OrganizationAccessService.d.ts +1 -1
- package/dist/sdk/services/OrganizationService.d.ts +1 -1
- package/dist/sdk/services/ProjectAccessService.d.ts +1 -1
- package/dist/sdk/services/ProjectAttachmentService.d.ts +2 -3
- package/dist/sdk/services/ProjectFileService.d.ts +3 -2
- package/dist/sdk/services/ProjectService.d.ts +2 -1
- package/dist/sdk/services/TeamService.d.ts +2 -2
- package/dist/sdk/services/UserService.d.ts +2 -2
- package/dist/sdk/services/WorkspaceService.d.ts +4 -2
- package/dist/store/slices/assetStageCompletionSlice.d.ts +11 -41
- package/dist/store/slices/assetStageSlice.d.ts +9 -20
- package/dist/store/slices/assetTypeSlice.d.ts +3 -27
- package/dist/store/slices/userSlice.d.ts +13 -33
- package/dist/typings/models/access.d.ts +9 -2
- package/dist/typings/models/agents.d.ts +1 -1
- package/dist/typings/models/assets.d.ts +9 -8
- package/dist/typings/models/attachments.d.ts +9 -2
- package/dist/typings/models/base.d.ts +2 -2
- package/dist/typings/models/categories.d.ts +2 -2
- package/dist/typings/models/documents.d.ts +1 -1
- package/dist/typings/models/emailDomain.d.ts +1 -1
- package/dist/typings/models/emailVerification.d.ts +2 -2
- package/dist/typings/models/forms.d.ts +2 -2
- package/dist/typings/models/geoImages.d.ts +3 -3
- package/dist/typings/models/issueTypes.d.ts +2 -2
- package/dist/typings/models/issues.d.ts +10 -1
- package/dist/typings/models/license.d.ts +15 -2
- package/dist/typings/models/organizations.d.ts +1 -1
- package/dist/typings/models/projects.d.ts +3 -3
- package/dist/typings/models/store.d.ts +1 -1
- package/dist/typings/models/teams.d.ts +3 -3
- package/dist/typings/models/users.d.ts +1 -1
- package/dist/typings/models/workspace.d.ts +1 -1
- package/dist/typings/store.d.ts +1 -1
- package/dist/utils/colors.d.ts +2 -0
- package/package.json +1 -1
- package/dist/enums/access.d.ts +0 -8
- package/dist/enums/attachments.d.ts +0 -7
- package/dist/enums/licenses.d.ts +0 -14
package/dist/overmap-core.js
CHANGED
|
@@ -7,20 +7,20 @@ var __publicField = (obj, key, value) => {
|
|
|
7
7
|
var _a;
|
|
8
8
|
import { DepGraph } from "dependency-graph";
|
|
9
9
|
import { v4 } from "uuid";
|
|
10
|
-
import { saveAs } from "file-saver";
|
|
11
|
-
import React, { useRef, useEffect } from "react";
|
|
12
|
-
import ColorCls from "color";
|
|
13
|
-
import { gray, gold, brown, yellow, amber, orange, red, crimson, pink, plum, purple, violet, iris, indigo, blue, cyan, jade, grass, lime, mint, sky } from "@radix-ui/colors";
|
|
14
10
|
import { offline as offline$1 } from "@redux-offline/redux-offline";
|
|
15
11
|
import offlineConfig from "@redux-offline/redux-offline/lib/defaults";
|
|
16
12
|
import localforage from "localforage";
|
|
17
13
|
import createMigration from "redux-persist-migrate";
|
|
18
14
|
import { createSlice, createSelector, combineReducers, createNextState } from "@reduxjs/toolkit";
|
|
19
15
|
import request from "superagent";
|
|
16
|
+
import { saveAs } from "file-saver";
|
|
17
|
+
import React, { useRef, useEffect } from "react";
|
|
18
|
+
import ColorCls from "color";
|
|
19
|
+
import { gray, gold, brown, yellow, amber, orange, red, crimson, pink, plum, purple, violet, iris, indigo, blue, cyan, jade, grass, lime, mint, sky } from "@radix-ui/colors";
|
|
20
20
|
import { RESET_STATE } from "@redux-offline/redux-offline/lib/constants";
|
|
21
21
|
import jwtDecode from "jwt-decode";
|
|
22
|
-
import { openDB } from "idb";
|
|
23
22
|
import { unsafeShowToast } from "@overmap-ai/blocks";
|
|
23
|
+
import { openDB } from "idb";
|
|
24
24
|
var HttpMethod = /* @__PURE__ */ ((HttpMethod2) => {
|
|
25
25
|
HttpMethod2["GET"] = "GET";
|
|
26
26
|
HttpMethod2["POST"] = "POST";
|
|
@@ -29,14 +29,6 @@ var HttpMethod = /* @__PURE__ */ ((HttpMethod2) => {
|
|
|
29
29
|
HttpMethod2["DELETE"] = "DELETE";
|
|
30
30
|
return HttpMethod2;
|
|
31
31
|
})(HttpMethod || {});
|
|
32
|
-
var AttachmentModel = /* @__PURE__ */ ((AttachmentModel2) => {
|
|
33
|
-
AttachmentModel2["Issue"] = "issue";
|
|
34
|
-
AttachmentModel2["Asset"] = "asset";
|
|
35
|
-
AttachmentModel2["AssetType"] = "asset_type";
|
|
36
|
-
AttachmentModel2["Project"] = "project";
|
|
37
|
-
AttachmentModel2["Document"] = "document";
|
|
38
|
-
return AttachmentModel2;
|
|
39
|
-
})(AttachmentModel || {});
|
|
40
32
|
var IssuePriority = /* @__PURE__ */ ((IssuePriority2) => {
|
|
41
33
|
IssuePriority2[IssuePriority2["LOWEST"] = 0] = "LOWEST";
|
|
42
34
|
IssuePriority2[IssuePriority2["LOW"] = 2] = "LOW";
|
|
@@ -51,43 +43,6 @@ var IssueStatus = /* @__PURE__ */ ((IssueStatus2) => {
|
|
|
51
43
|
IssueStatus2[IssueStatus2["DONE"] = 4] = "DONE";
|
|
52
44
|
return IssueStatus2;
|
|
53
45
|
})(IssueStatus || {});
|
|
54
|
-
var IssueUpdateChange = /* @__PURE__ */ ((IssueUpdateChange2) => {
|
|
55
|
-
IssueUpdateChange2["STATUS"] = "status";
|
|
56
|
-
IssueUpdateChange2["PRIORITY"] = "priority";
|
|
57
|
-
IssueUpdateChange2["CATEGORY"] = "category";
|
|
58
|
-
IssueUpdateChange2["DESCRIPTION"] = "description";
|
|
59
|
-
IssueUpdateChange2["TITLE"] = "title";
|
|
60
|
-
IssueUpdateChange2["ASSIGNED_TO"] = "assigned_to";
|
|
61
|
-
IssueUpdateChange2["DUE_DATE"] = "due_date";
|
|
62
|
-
return IssueUpdateChange2;
|
|
63
|
-
})(IssueUpdateChange || {});
|
|
64
|
-
var ProjectAccessLevel = /* @__PURE__ */ ((ProjectAccessLevel2) => {
|
|
65
|
-
ProjectAccessLevel2[ProjectAccessLevel2["BASIC"] = 0] = "BASIC";
|
|
66
|
-
ProjectAccessLevel2[ProjectAccessLevel2["ADMIN"] = 2] = "ADMIN";
|
|
67
|
-
return ProjectAccessLevel2;
|
|
68
|
-
})(ProjectAccessLevel || {});
|
|
69
|
-
var OrganizationAccessLevel = /* @__PURE__ */ ((OrganizationAccessLevel2) => {
|
|
70
|
-
OrganizationAccessLevel2[OrganizationAccessLevel2["BASIC"] = 0] = "BASIC";
|
|
71
|
-
OrganizationAccessLevel2[OrganizationAccessLevel2["ADMIN"] = 2] = "ADMIN";
|
|
72
|
-
return OrganizationAccessLevel2;
|
|
73
|
-
})(OrganizationAccessLevel || {});
|
|
74
|
-
var PaddleCheckoutEvent = /* @__PURE__ */ ((PaddleCheckoutEvent2) => {
|
|
75
|
-
PaddleCheckoutEvent2["COMPLETED"] = "checkout.completed";
|
|
76
|
-
PaddleCheckoutEvent2["CLOSED"] = "checkout.closed";
|
|
77
|
-
return PaddleCheckoutEvent2;
|
|
78
|
-
})(PaddleCheckoutEvent || {});
|
|
79
|
-
var LicenseLevel = /* @__PURE__ */ ((LicenseLevel2) => {
|
|
80
|
-
LicenseLevel2[LicenseLevel2["PRO"] = 0] = "PRO";
|
|
81
|
-
return LicenseLevel2;
|
|
82
|
-
})(LicenseLevel || {});
|
|
83
|
-
var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
|
|
84
|
-
LicenseStatus2[LicenseStatus2["ACTIVE"] = 0] = "ACTIVE";
|
|
85
|
-
LicenseStatus2[LicenseStatus2["PAUSED"] = 2] = "PAUSED";
|
|
86
|
-
LicenseStatus2[LicenseStatus2["CANCELLED"] = 4] = "CANCELLED";
|
|
87
|
-
LicenseStatus2[LicenseStatus2["INACTIVE"] = 6] = "INACTIVE";
|
|
88
|
-
LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
|
|
89
|
-
return LicenseStatus2;
|
|
90
|
-
})(LicenseStatus || {});
|
|
91
46
|
class OutboxCoordinator {
|
|
92
47
|
constructor() {
|
|
93
48
|
__publicField(this, "graph");
|
|
@@ -330,6 +285,130 @@ class APIError extends Error {
|
|
|
330
285
|
this.options = options;
|
|
331
286
|
}
|
|
332
287
|
}
|
|
288
|
+
class DeferredPromise {
|
|
289
|
+
constructor() {
|
|
290
|
+
__publicField(this, _a, "Promise");
|
|
291
|
+
__publicField(this, "_promise");
|
|
292
|
+
__publicField(this, "_resolve");
|
|
293
|
+
__publicField(this, "_reject");
|
|
294
|
+
__publicField(this, "_state", "pending");
|
|
295
|
+
this._resolve = null;
|
|
296
|
+
this._reject = null;
|
|
297
|
+
this._promise = new Promise((resolve, reject) => {
|
|
298
|
+
this._resolve = resolve;
|
|
299
|
+
this._reject = reject;
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
get state() {
|
|
303
|
+
return this._state;
|
|
304
|
+
}
|
|
305
|
+
then(onFulfilled, onRejected) {
|
|
306
|
+
return this._promise.then(onFulfilled, onRejected);
|
|
307
|
+
}
|
|
308
|
+
catch(onRejected) {
|
|
309
|
+
return this._promise.catch(onRejected);
|
|
310
|
+
}
|
|
311
|
+
resolve(value) {
|
|
312
|
+
if (!this._resolve)
|
|
313
|
+
throw new Error("No resolve callback");
|
|
314
|
+
this._resolve(value);
|
|
315
|
+
this._state = "fulfilled";
|
|
316
|
+
}
|
|
317
|
+
reject(reason) {
|
|
318
|
+
if (!this._reject)
|
|
319
|
+
throw reason;
|
|
320
|
+
this._reject(reason);
|
|
321
|
+
this._state = "rejected";
|
|
322
|
+
}
|
|
323
|
+
finally(_onFinally) {
|
|
324
|
+
throw new Error("`finally` not implemented");
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
_a = Symbol.toStringTag;
|
|
328
|
+
var randomString = function randomString2() {
|
|
329
|
+
return Math.random().toString(36).substring(7).split("").join(".");
|
|
330
|
+
};
|
|
331
|
+
({
|
|
332
|
+
INIT: "@@redux/INIT" + randomString(),
|
|
333
|
+
REPLACE: "@@redux/REPLACE" + randomString(),
|
|
334
|
+
PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
|
|
335
|
+
return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
function compose() {
|
|
339
|
+
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
340
|
+
funcs[_key] = arguments[_key];
|
|
341
|
+
}
|
|
342
|
+
if (funcs.length === 0) {
|
|
343
|
+
return function(arg) {
|
|
344
|
+
return arg;
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
if (funcs.length === 1) {
|
|
348
|
+
return funcs[0];
|
|
349
|
+
}
|
|
350
|
+
return funcs.reduce(function(a, b) {
|
|
351
|
+
return function() {
|
|
352
|
+
return a(b.apply(void 0, arguments));
|
|
353
|
+
};
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
const VERSION_REDUCER_KEY$1 = "versioning";
|
|
357
|
+
const latestVersion = () => migrations.length - 1;
|
|
358
|
+
const initialVersioning = (state) => {
|
|
359
|
+
state[VERSION_REDUCER_KEY$1] = { version: latestVersion() };
|
|
360
|
+
return state;
|
|
361
|
+
};
|
|
362
|
+
const signOut = () => {
|
|
363
|
+
return initialVersioning({});
|
|
364
|
+
};
|
|
365
|
+
const createOutboxState = (state) => {
|
|
366
|
+
if (state.outboxReducer) {
|
|
367
|
+
state.outboxReducer.deletedRequests = [];
|
|
368
|
+
}
|
|
369
|
+
return state;
|
|
370
|
+
};
|
|
371
|
+
const wrapMigration = (migrator) => (state) => {
|
|
372
|
+
var _a2;
|
|
373
|
+
if (state === void 0) {
|
|
374
|
+
state = {};
|
|
375
|
+
}
|
|
376
|
+
if (((_a2 = state[VERSION_REDUCER_KEY$1]) == null ? void 0 : _a2.version) === latestVersion())
|
|
377
|
+
return state;
|
|
378
|
+
return migrator(state);
|
|
379
|
+
};
|
|
380
|
+
const migrations = [initialVersioning, signOut, signOut, createOutboxState];
|
|
381
|
+
const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
|
|
382
|
+
const initialState$B = {
|
|
383
|
+
accessToken: "",
|
|
384
|
+
refreshToken: "",
|
|
385
|
+
isLoggedIn: false
|
|
386
|
+
};
|
|
387
|
+
const authSlice = createSlice({
|
|
388
|
+
name: "auth",
|
|
389
|
+
initialState: initialState$B,
|
|
390
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$B)),
|
|
391
|
+
reducers: {
|
|
392
|
+
setTokens: (state, action) => {
|
|
393
|
+
state.accessToken = action.payload.accessToken;
|
|
394
|
+
state.refreshToken = action.payload.refreshToken;
|
|
395
|
+
},
|
|
396
|
+
clearTokens: (state) => {
|
|
397
|
+
state.accessToken = "";
|
|
398
|
+
state.refreshToken = "";
|
|
399
|
+
},
|
|
400
|
+
setLoggedIn: (state, action) => {
|
|
401
|
+
if (!action.payload) {
|
|
402
|
+
authSlice.caseReducers.clearTokens(state);
|
|
403
|
+
}
|
|
404
|
+
state.isLoggedIn = action.payload;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
const { setTokens, clearTokens, setLoggedIn } = authSlice.actions;
|
|
409
|
+
const selectAccessToken = (state) => state.authReducer.accessToken;
|
|
410
|
+
const selectIsLoggedIn = (state) => state.authReducer.isLoggedIn;
|
|
411
|
+
const authReducer = authSlice.reducer;
|
|
333
412
|
const coordinatesToLiteral = (coordinates) => {
|
|
334
413
|
return { lng: coordinates[0], lat: coordinates[1] };
|
|
335
414
|
};
|
|
@@ -674,6 +753,19 @@ const Colors = {
|
|
|
674
753
|
mint: mint.mint9,
|
|
675
754
|
sky: sky.sky9
|
|
676
755
|
};
|
|
756
|
+
const AssetStageColors = {
|
|
757
|
+
indigo: indigo.indigo9,
|
|
758
|
+
red: red.red9,
|
|
759
|
+
violet: violet.violet9,
|
|
760
|
+
yellow: yellow.yellow9,
|
|
761
|
+
jade: jade.jade9,
|
|
762
|
+
cyan: cyan.cyan9,
|
|
763
|
+
gold: gold.gold9,
|
|
764
|
+
orange: orange.orange9,
|
|
765
|
+
lime: lime.lime9,
|
|
766
|
+
sky: sky.sky9,
|
|
767
|
+
pink: pink.pink9
|
|
768
|
+
};
|
|
677
769
|
const defaultBadgeColor = "#868686";
|
|
678
770
|
const generateBadgeColors = (rawColor) => {
|
|
679
771
|
const color = ColorCls(rawColor);
|
|
@@ -682,6 +774,9 @@ const generateBadgeColors = (rawColor) => {
|
|
|
682
774
|
const textColor = color.hex() === safety.hex() ? "#000000" : "#FFFFFF";
|
|
683
775
|
return { backgroundColor, textColor };
|
|
684
776
|
};
|
|
777
|
+
function getStageColor(index) {
|
|
778
|
+
return Object.values(AssetStageColors)[index % Object.keys(AssetStageColors).length];
|
|
779
|
+
}
|
|
685
780
|
const getLocalDateString = memoize((date) => {
|
|
686
781
|
if (!date)
|
|
687
782
|
return "";
|
|
@@ -704,130 +799,6 @@ const getLocalRelativeDateString = memoize((date, min, max) => {
|
|
|
704
799
|
return getLocalDateString(date);
|
|
705
800
|
return relative.format(days, "days");
|
|
706
801
|
});
|
|
707
|
-
class DeferredPromise {
|
|
708
|
-
constructor() {
|
|
709
|
-
__publicField(this, _a, "Promise");
|
|
710
|
-
__publicField(this, "_promise");
|
|
711
|
-
__publicField(this, "_resolve");
|
|
712
|
-
__publicField(this, "_reject");
|
|
713
|
-
__publicField(this, "_state", "pending");
|
|
714
|
-
this._resolve = null;
|
|
715
|
-
this._reject = null;
|
|
716
|
-
this._promise = new Promise((resolve, reject) => {
|
|
717
|
-
this._resolve = resolve;
|
|
718
|
-
this._reject = reject;
|
|
719
|
-
});
|
|
720
|
-
}
|
|
721
|
-
get state() {
|
|
722
|
-
return this._state;
|
|
723
|
-
}
|
|
724
|
-
then(onFulfilled, onRejected) {
|
|
725
|
-
return this._promise.then(onFulfilled, onRejected);
|
|
726
|
-
}
|
|
727
|
-
catch(onRejected) {
|
|
728
|
-
return this._promise.catch(onRejected);
|
|
729
|
-
}
|
|
730
|
-
resolve(value) {
|
|
731
|
-
if (!this._resolve)
|
|
732
|
-
throw new Error("No resolve callback");
|
|
733
|
-
this._resolve(value);
|
|
734
|
-
this._state = "fulfilled";
|
|
735
|
-
}
|
|
736
|
-
reject(reason) {
|
|
737
|
-
if (!this._reject)
|
|
738
|
-
throw reason;
|
|
739
|
-
this._reject(reason);
|
|
740
|
-
this._state = "rejected";
|
|
741
|
-
}
|
|
742
|
-
finally(_onFinally) {
|
|
743
|
-
throw new Error("`finally` not implemented");
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
_a = Symbol.toStringTag;
|
|
747
|
-
var randomString = function randomString2() {
|
|
748
|
-
return Math.random().toString(36).substring(7).split("").join(".");
|
|
749
|
-
};
|
|
750
|
-
({
|
|
751
|
-
INIT: "@@redux/INIT" + randomString(),
|
|
752
|
-
REPLACE: "@@redux/REPLACE" + randomString(),
|
|
753
|
-
PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
|
|
754
|
-
return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
|
|
755
|
-
}
|
|
756
|
-
});
|
|
757
|
-
function compose() {
|
|
758
|
-
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
759
|
-
funcs[_key] = arguments[_key];
|
|
760
|
-
}
|
|
761
|
-
if (funcs.length === 0) {
|
|
762
|
-
return function(arg) {
|
|
763
|
-
return arg;
|
|
764
|
-
};
|
|
765
|
-
}
|
|
766
|
-
if (funcs.length === 1) {
|
|
767
|
-
return funcs[0];
|
|
768
|
-
}
|
|
769
|
-
return funcs.reduce(function(a, b) {
|
|
770
|
-
return function() {
|
|
771
|
-
return a(b.apply(void 0, arguments));
|
|
772
|
-
};
|
|
773
|
-
});
|
|
774
|
-
}
|
|
775
|
-
const VERSION_REDUCER_KEY$1 = "versioning";
|
|
776
|
-
const latestVersion = () => migrations.length - 1;
|
|
777
|
-
const initialVersioning = (state) => {
|
|
778
|
-
state[VERSION_REDUCER_KEY$1] = { version: latestVersion() };
|
|
779
|
-
return state;
|
|
780
|
-
};
|
|
781
|
-
const signOut = () => {
|
|
782
|
-
return initialVersioning({});
|
|
783
|
-
};
|
|
784
|
-
const createOutboxState = (state) => {
|
|
785
|
-
if (state.outboxReducer) {
|
|
786
|
-
state.outboxReducer.deletedRequests = [];
|
|
787
|
-
}
|
|
788
|
-
return state;
|
|
789
|
-
};
|
|
790
|
-
const wrapMigration = (migrator) => (state) => {
|
|
791
|
-
var _a2;
|
|
792
|
-
if (state === void 0) {
|
|
793
|
-
state = {};
|
|
794
|
-
}
|
|
795
|
-
if (((_a2 = state[VERSION_REDUCER_KEY$1]) == null ? void 0 : _a2.version) === latestVersion())
|
|
796
|
-
return state;
|
|
797
|
-
return migrator(state);
|
|
798
|
-
};
|
|
799
|
-
const migrations = [initialVersioning, signOut, signOut, createOutboxState];
|
|
800
|
-
const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
|
|
801
|
-
const initialState$B = {
|
|
802
|
-
accessToken: "",
|
|
803
|
-
refreshToken: "",
|
|
804
|
-
isLoggedIn: false
|
|
805
|
-
};
|
|
806
|
-
const authSlice = createSlice({
|
|
807
|
-
name: "auth",
|
|
808
|
-
initialState: initialState$B,
|
|
809
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$B)),
|
|
810
|
-
reducers: {
|
|
811
|
-
setTokens: (state, action) => {
|
|
812
|
-
state.accessToken = action.payload.accessToken;
|
|
813
|
-
state.refreshToken = action.payload.refreshToken;
|
|
814
|
-
},
|
|
815
|
-
clearTokens: (state) => {
|
|
816
|
-
state.accessToken = "";
|
|
817
|
-
state.refreshToken = "";
|
|
818
|
-
},
|
|
819
|
-
setLoggedIn: (state, action) => {
|
|
820
|
-
if (!action.payload) {
|
|
821
|
-
authSlice.caseReducers.clearTokens(state);
|
|
822
|
-
}
|
|
823
|
-
state.isLoggedIn = action.payload;
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
});
|
|
827
|
-
const { setTokens, clearTokens, setLoggedIn } = authSlice.actions;
|
|
828
|
-
const selectAccessToken = (state) => state.authReducer.accessToken;
|
|
829
|
-
const selectIsLoggedIn = (state) => state.authReducer.isLoggedIn;
|
|
830
|
-
const authReducer = authSlice.reducer;
|
|
831
802
|
function createModelAdapter(computeModelId) {
|
|
832
803
|
const addOne = (state, action) => {
|
|
833
804
|
const id = computeModelId(action.payload);
|
|
@@ -1060,72 +1031,61 @@ const selectAttachmentsOfAssetByType = restructureCreateSelectorWithArgs(
|
|
|
1060
1031
|
)
|
|
1061
1032
|
);
|
|
1062
1033
|
const assetAttachmentReducer = assetAttachmentSlice.reducer;
|
|
1063
|
-
const
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
const initialState$x = assetStageCompletionAdapter.getInitialState({});
|
|
1034
|
+
const initialState$x = {
|
|
1035
|
+
completionsByAssetId: {}
|
|
1036
|
+
};
|
|
1067
1037
|
const assetStageCompletionSlice = createSlice({
|
|
1068
1038
|
name: "assetStageCompletions",
|
|
1069
1039
|
initialState: initialState$x,
|
|
1070
1040
|
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
|
|
1071
1041
|
reducers: {
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1042
|
+
addStageCompletion: (state, action) => {
|
|
1043
|
+
let stageToCompletionDateMapping = state.completionsByAssetId[action.payload.asset];
|
|
1044
|
+
if (!stageToCompletionDateMapping) {
|
|
1045
|
+
stageToCompletionDateMapping = {};
|
|
1046
|
+
state.completionsByAssetId[action.payload.asset] = stageToCompletionDateMapping;
|
|
1047
|
+
}
|
|
1048
|
+
stageToCompletionDateMapping[action.payload.stage] = (/* @__PURE__ */ new Date()).toISOString();
|
|
1049
|
+
},
|
|
1050
|
+
addStageCompletions: (state, action) => {
|
|
1051
|
+
for (const [assetId, stageIdToCompletionDateMapping] of Object.entries(action.payload)) {
|
|
1052
|
+
if (Object.keys(stageIdToCompletionDateMapping).length === 0)
|
|
1053
|
+
throw new Error(`Encountered empty stageIdToCompletionDateMapping argument for asset ${assetId}`);
|
|
1054
|
+
let thisAssetCompletions = state.completionsByAssetId[assetId];
|
|
1055
|
+
if (thisAssetCompletions === void 0) {
|
|
1056
|
+
thisAssetCompletions = {};
|
|
1057
|
+
}
|
|
1058
|
+
for (const [stageId, completionDate] of Object.entries(stageIdToCompletionDateMapping)) {
|
|
1059
|
+
thisAssetCompletions[stageId] = completionDate;
|
|
1060
|
+
}
|
|
1061
|
+
state.completionsByAssetId[assetId] = thisAssetCompletions;
|
|
1062
|
+
}
|
|
1063
|
+
},
|
|
1064
|
+
removeStageCompletions: (state, action) => {
|
|
1065
|
+
for (const completion of action.payload) {
|
|
1066
|
+
const thisAssetCompletions = state.completionsByAssetId[completion.asset];
|
|
1067
|
+
if (!thisAssetCompletions || !(completion.stage in thisAssetCompletions)) {
|
|
1068
|
+
console.warn(
|
|
1069
|
+
"Skipping removal of uncompleted stage. This message indicates completion objects are created unnecessarily."
|
|
1070
|
+
);
|
|
1071
|
+
continue;
|
|
1072
|
+
}
|
|
1073
|
+
delete thisAssetCompletions[completion.stage];
|
|
1074
|
+
}
|
|
1075
|
+
},
|
|
1076
|
+
setStageCompletions: (state, action) => {
|
|
1077
|
+
state.completionsByAssetId = action.payload;
|
|
1078
|
+
}
|
|
1079
1079
|
}
|
|
1080
1080
|
});
|
|
1081
|
-
const {
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
addAssetStageCompletions,
|
|
1085
|
-
updateAssetStageCompletion,
|
|
1086
|
-
updateAssetStageCompletions,
|
|
1087
|
-
deleteAssetStageCompletion,
|
|
1088
|
-
deleteAssetStageCompletions
|
|
1089
|
-
} = assetStageCompletionSlice.actions;
|
|
1090
|
-
const selectAssetStageCompletionMapping = (state) => {
|
|
1091
|
-
return state.assetStageCompletionReducer.instances;
|
|
1081
|
+
const { addStageCompletion, addStageCompletions, removeStageCompletions, setStageCompletions } = assetStageCompletionSlice.actions;
|
|
1082
|
+
const selectCompletedStages = (state) => {
|
|
1083
|
+
return state.assetStageCompletionReducer.completionsByAssetId;
|
|
1092
1084
|
};
|
|
1093
|
-
const selectCompletedStagesByAsset = createSelector(
|
|
1094
|
-
[selectAssetStageCompletionMapping],
|
|
1095
|
-
(completedStagesMapping) => {
|
|
1096
|
-
const completedStagesByAsset = {};
|
|
1097
|
-
for (const stageCompletion of Object.values(completedStagesMapping)) {
|
|
1098
|
-
const { asset, stage, submitted_at } = stageCompletion;
|
|
1099
|
-
if (!completedStagesByAsset[asset])
|
|
1100
|
-
completedStagesByAsset[asset] = {};
|
|
1101
|
-
completedStagesByAsset[asset][stage] = submitted_at;
|
|
1102
|
-
}
|
|
1103
|
-
return completedStagesByAsset;
|
|
1104
|
-
}
|
|
1105
|
-
);
|
|
1106
1085
|
const selectCompletedStageIdsForAsset = restructureCreateSelectorWithArgs(
|
|
1107
|
-
createSelector(
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
return Object.keys(completedStages[asset.offline_id] ?? {});
|
|
1111
|
-
}
|
|
1112
|
-
)
|
|
1113
|
-
);
|
|
1114
|
-
const selectAssetStageCompletionById = (id) => (state) => {
|
|
1115
|
-
return state.assetStageCompletionReducer.instances[id];
|
|
1116
|
-
};
|
|
1117
|
-
const selectAssetStageCompletionsByIds = restructureCreateSelectorWithArgs(
|
|
1118
|
-
createSelector(
|
|
1119
|
-
[selectAssetStageCompletionMapping, (_, stageCompletionIds) => stageCompletionIds],
|
|
1120
|
-
(stageCompletionMapping, stageCompletionIds) => {
|
|
1121
|
-
const stageCompletionIdsSet = new Set(stageCompletionIds);
|
|
1122
|
-
return fallbackToEmptyArray(
|
|
1123
|
-
Object.values(stageCompletionMapping).filter(
|
|
1124
|
-
(stageCompletion) => stageCompletionIdsSet.has(stageCompletion.offline_id)
|
|
1125
|
-
)
|
|
1126
|
-
);
|
|
1127
|
-
}
|
|
1128
|
-
)
|
|
1086
|
+
createSelector([selectCompletedStages, (_state, asset) => asset], (completedStages, asset) => {
|
|
1087
|
+
return Object.keys(completedStages[asset.offline_id] ?? {});
|
|
1088
|
+
})
|
|
1129
1089
|
);
|
|
1130
1090
|
const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
|
|
1131
1091
|
const assetStageAdapter = createModelAdapter((assetStage) => assetStage.offline_id);
|
|
@@ -1135,29 +1095,14 @@ const assetStageSlice = createSlice({
|
|
|
1135
1095
|
initialState: initialState$w,
|
|
1136
1096
|
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
|
|
1137
1097
|
reducers: {
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
updateAssetStages: assetStageAdapter.updateMany,
|
|
1145
|
-
deleteAssetStage: assetStageAdapter.deleteOne,
|
|
1146
|
-
deleteAssetStages: assetStageAdapter.deleteMany
|
|
1098
|
+
initializeStages: assetStageAdapter.initialize,
|
|
1099
|
+
setStage: assetStageAdapter.setOne,
|
|
1100
|
+
addStages: assetStageAdapter.addMany,
|
|
1101
|
+
updateStage: assetStageAdapter.updateOne,
|
|
1102
|
+
updateStages: assetStageAdapter.updateMany,
|
|
1103
|
+
removeStages: assetStageAdapter.deleteMany
|
|
1147
1104
|
}
|
|
1148
1105
|
});
|
|
1149
|
-
const {
|
|
1150
|
-
initializeAssetStages,
|
|
1151
|
-
setAssetStage,
|
|
1152
|
-
setAssetStages,
|
|
1153
|
-
addAssetStage,
|
|
1154
|
-
addAssetStages,
|
|
1155
|
-
updateAssetStage,
|
|
1156
|
-
updateAssetStages,
|
|
1157
|
-
deleteAssetStage,
|
|
1158
|
-
deleteAssetStages
|
|
1159
|
-
} = assetStageSlice.actions;
|
|
1160
|
-
const assetStageReducer = assetStageSlice.reducer;
|
|
1161
1106
|
const selectStageMapping = (state) => state.assetStageReducer.instances;
|
|
1162
1107
|
const selectAssetStageById = (id) => (state) => {
|
|
1163
1108
|
return state.assetStageReducer.instances[id];
|
|
@@ -1165,6 +1110,24 @@ const selectAssetStageById = (id) => (state) => {
|
|
|
1165
1110
|
const selectAssetStages = createSelector([selectStageMapping], (stageMapping) => {
|
|
1166
1111
|
return Object.values(stageMapping);
|
|
1167
1112
|
});
|
|
1113
|
+
const selectStagesFromAssetTypeIds = restructureCreateSelectorWithArgs(
|
|
1114
|
+
createSelector([selectAssetStages, (_state, assetTypeIds) => assetTypeIds], (stages, assetTypeIds) => {
|
|
1115
|
+
const assetTypeIdsSet = new Set(assetTypeIds);
|
|
1116
|
+
const ret = {};
|
|
1117
|
+
for (const stage of stages) {
|
|
1118
|
+
if (assetTypeIdsSet.has(stage.asset_type)) {
|
|
1119
|
+
if (!ret[stage.asset_type]) {
|
|
1120
|
+
ret[stage.asset_type] = [];
|
|
1121
|
+
}
|
|
1122
|
+
ret[stage.asset_type].push(stage);
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
for (const key in ret) {
|
|
1126
|
+
ret[key] = ret[key].sort((a, b) => a.priority - b.priority);
|
|
1127
|
+
}
|
|
1128
|
+
return ret;
|
|
1129
|
+
})
|
|
1130
|
+
);
|
|
1168
1131
|
const selectAssetTypeStagesMapping = restructureCreateSelectorWithArgs(
|
|
1169
1132
|
createSelector([selectStageMapping, (_state, assetTypeId) => assetTypeId], (stagesMapping, assetTypeId) => {
|
|
1170
1133
|
const assetTypeStagesMapping = {};
|
|
@@ -1212,6 +1175,8 @@ const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
|
|
|
1212
1175
|
return ret;
|
|
1213
1176
|
})
|
|
1214
1177
|
);
|
|
1178
|
+
const { initializeStages, setStage, addStages, updateStages, removeStages, updateStage } = assetStageSlice.actions;
|
|
1179
|
+
const assetStageReducer = assetStageSlice.reducer;
|
|
1215
1180
|
const assetTypeAdapter = createModelAdapter((assetType) => assetType.offline_id);
|
|
1216
1181
|
const initialState$v = assetTypeAdapter.getInitialState({});
|
|
1217
1182
|
const assetTypeSlice = createSlice({
|
|
@@ -1220,27 +1185,11 @@ const assetTypeSlice = createSlice({
|
|
|
1220
1185
|
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
|
|
1221
1186
|
reducers: {
|
|
1222
1187
|
initializeAssetTypes: assetTypeAdapter.initialize,
|
|
1223
|
-
setAssetType: assetTypeAdapter.setOne,
|
|
1224
|
-
setAssetTypes: assetTypeAdapter.setMany,
|
|
1225
1188
|
addAssetType: assetTypeAdapter.addOne,
|
|
1226
|
-
|
|
1227
|
-
updateAssetType: assetTypeAdapter.updateOne,
|
|
1228
|
-
updateAssetTypes: assetTypeAdapter.updateMany,
|
|
1229
|
-
deleteAssetType: assetTypeAdapter.deleteOne,
|
|
1230
|
-
deleteAssetTypes: assetTypeAdapter.deleteMany
|
|
1189
|
+
deleteAssetType: assetTypeAdapter.deleteOne
|
|
1231
1190
|
}
|
|
1232
1191
|
});
|
|
1233
|
-
const {
|
|
1234
|
-
initializeAssetTypes,
|
|
1235
|
-
setAssetType,
|
|
1236
|
-
setAssetTypes,
|
|
1237
|
-
addAssetType,
|
|
1238
|
-
addAssetTypes,
|
|
1239
|
-
updateAssetType,
|
|
1240
|
-
updateAssetTypes,
|
|
1241
|
-
deleteAssetType,
|
|
1242
|
-
deleteAssetTypes
|
|
1243
|
-
} = assetTypeSlice.actions;
|
|
1192
|
+
const { addAssetType, initializeAssetTypes, deleteAssetType } = assetTypeSlice.actions;
|
|
1244
1193
|
const selectAssetTypesMapping = (state) => state.assetTypeReducer.instances;
|
|
1245
1194
|
const selectAssetTypes = createSelector(
|
|
1246
1195
|
[selectAssetTypesMapping],
|
|
@@ -1628,14 +1577,63 @@ const selectUploadUrl = (sha1) => (state) => {
|
|
|
1628
1577
|
return url;
|
|
1629
1578
|
};
|
|
1630
1579
|
const fileReducer = fileSlice.reducer;
|
|
1580
|
+
var ProjectAccessLevel = /* @__PURE__ */ ((ProjectAccessLevel2) => {
|
|
1581
|
+
ProjectAccessLevel2[ProjectAccessLevel2["BASIC"] = 0] = "BASIC";
|
|
1582
|
+
ProjectAccessLevel2[ProjectAccessLevel2["ADMIN"] = 2] = "ADMIN";
|
|
1583
|
+
return ProjectAccessLevel2;
|
|
1584
|
+
})(ProjectAccessLevel || {});
|
|
1585
|
+
var OrganizationAccessLevel = /* @__PURE__ */ ((OrganizationAccessLevel2) => {
|
|
1586
|
+
OrganizationAccessLevel2[OrganizationAccessLevel2["BASIC"] = 0] = "BASIC";
|
|
1587
|
+
OrganizationAccessLevel2[OrganizationAccessLevel2["ADMIN"] = 2] = "ADMIN";
|
|
1588
|
+
return OrganizationAccessLevel2;
|
|
1589
|
+
})(OrganizationAccessLevel || {});
|
|
1590
|
+
var AttachmentModel = /* @__PURE__ */ ((AttachmentModel2) => {
|
|
1591
|
+
AttachmentModel2["Issue"] = "issue";
|
|
1592
|
+
AttachmentModel2["Asset"] = "asset";
|
|
1593
|
+
AttachmentModel2["AssetType"] = "asset_type";
|
|
1594
|
+
AttachmentModel2["Project"] = "project";
|
|
1595
|
+
AttachmentModel2["Document"] = "document";
|
|
1596
|
+
return AttachmentModel2;
|
|
1597
|
+
})(AttachmentModel || {});
|
|
1598
|
+
var IssueUpdateChange = /* @__PURE__ */ ((IssueUpdateChange2) => {
|
|
1599
|
+
IssueUpdateChange2["STATUS"] = "status";
|
|
1600
|
+
IssueUpdateChange2["PRIORITY"] = "priority";
|
|
1601
|
+
IssueUpdateChange2["CATEGORY"] = "category";
|
|
1602
|
+
IssueUpdateChange2["DESCRIPTION"] = "description";
|
|
1603
|
+
IssueUpdateChange2["TITLE"] = "title";
|
|
1604
|
+
IssueUpdateChange2["ASSIGNED_TO"] = "assigned_to";
|
|
1605
|
+
IssueUpdateChange2["DUE_DATE"] = "due_date";
|
|
1606
|
+
return IssueUpdateChange2;
|
|
1607
|
+
})(IssueUpdateChange || {});
|
|
1608
|
+
var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
|
|
1609
|
+
VerificationCodeType2[VerificationCodeType2["USER_REGISTRATION"] = 0] = "USER_REGISTRATION";
|
|
1610
|
+
VerificationCodeType2[VerificationCodeType2["APPLICATION_INVITE"] = 2] = "APPLICATION_INVITE";
|
|
1611
|
+
VerificationCodeType2[VerificationCodeType2["PROJECT_INVITE"] = 4] = "PROJECT_INVITE";
|
|
1612
|
+
VerificationCodeType2[VerificationCodeType2["ORGANIZATION_INVITE"] = 6] = "ORGANIZATION_INVITE";
|
|
1613
|
+
VerificationCodeType2[VerificationCodeType2["ADD_EMAIL_DOMAIN"] = 8] = "ADD_EMAIL_DOMAIN";
|
|
1614
|
+
VerificationCodeType2[VerificationCodeType2["RESET_PASSWORD"] = 10] = "RESET_PASSWORD";
|
|
1615
|
+
return VerificationCodeType2;
|
|
1616
|
+
})(VerificationCodeType || {});
|
|
1617
|
+
var PaddleCheckoutEvent = /* @__PURE__ */ ((PaddleCheckoutEvent2) => {
|
|
1618
|
+
PaddleCheckoutEvent2["COMPLETED"] = "checkout.completed";
|
|
1619
|
+
PaddleCheckoutEvent2["CLOSED"] = "checkout.closed";
|
|
1620
|
+
return PaddleCheckoutEvent2;
|
|
1621
|
+
})(PaddleCheckoutEvent || {});
|
|
1622
|
+
var LicenseLevel = /* @__PURE__ */ ((LicenseLevel2) => {
|
|
1623
|
+
LicenseLevel2[LicenseLevel2["PRO"] = 0] = "PRO";
|
|
1624
|
+
return LicenseLevel2;
|
|
1625
|
+
})(LicenseLevel || {});
|
|
1626
|
+
var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
|
|
1627
|
+
LicenseStatus2[LicenseStatus2["ACTIVE"] = 0] = "ACTIVE";
|
|
1628
|
+
LicenseStatus2[LicenseStatus2["PAUSED"] = 2] = "PAUSED";
|
|
1629
|
+
LicenseStatus2[LicenseStatus2["CANCELLED"] = 4] = "CANCELLED";
|
|
1630
|
+
LicenseStatus2[LicenseStatus2["INACTIVE"] = 6] = "INACTIVE";
|
|
1631
|
+
LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
|
|
1632
|
+
return LicenseStatus2;
|
|
1633
|
+
})(LicenseStatus || {});
|
|
1631
1634
|
const initialState$p = {
|
|
1632
1635
|
users: {},
|
|
1633
|
-
currentUser:
|
|
1634
|
-
id: 0,
|
|
1635
|
-
username: "",
|
|
1636
|
-
email: "",
|
|
1637
|
-
profile: { file: null, file_sha1: null, favourite_project_ids: [], tour_step: -1 }
|
|
1638
|
-
}
|
|
1636
|
+
currentUser: null
|
|
1639
1637
|
};
|
|
1640
1638
|
const userSlice = createSlice({
|
|
1641
1639
|
name: "users",
|
|
@@ -1658,6 +1656,8 @@ const userSlice = createSlice({
|
|
|
1658
1656
|
state.currentUser = action.payload;
|
|
1659
1657
|
},
|
|
1660
1658
|
setProfilePicture: (state, action) => {
|
|
1659
|
+
if (!state.currentUser)
|
|
1660
|
+
return;
|
|
1661
1661
|
state.currentUser.profile.file = action.payload.file ?? null;
|
|
1662
1662
|
state.currentUser.profile.file_sha1 = action.payload.file_sha1 ?? null;
|
|
1663
1663
|
const currentUser = state.users[state.currentUser.id];
|
|
@@ -1667,32 +1667,12 @@ const userSlice = createSlice({
|
|
|
1667
1667
|
currentUser.profile.file = action.payload.file ?? null;
|
|
1668
1668
|
currentUser.profile.file_sha1 = action.payload.file_sha1 ?? null;
|
|
1669
1669
|
},
|
|
1670
|
-
addFavouriteProjectId: (state, action) => {
|
|
1671
|
-
state.currentUser.profile.favourite_project_ids.push(action.payload);
|
|
1672
|
-
},
|
|
1673
|
-
removeFavouriteProjectId: (state, action) => {
|
|
1674
|
-
state.currentUser.profile.favourite_project_ids = state.currentUser.profile.favourite_project_ids.filter(
|
|
1675
|
-
(id) => id !== action.payload
|
|
1676
|
-
);
|
|
1677
|
-
},
|
|
1678
|
-
setTourStep: (state, action) => {
|
|
1679
|
-
state.currentUser.profile.tour_step = action.payload;
|
|
1680
|
-
},
|
|
1681
1670
|
removeUser: (state, action) => {
|
|
1682
1671
|
delete state.users[action.payload];
|
|
1683
1672
|
}
|
|
1684
1673
|
}
|
|
1685
1674
|
});
|
|
1686
|
-
const {
|
|
1687
|
-
setCurrentUser,
|
|
1688
|
-
setProfilePicture,
|
|
1689
|
-
setUsers,
|
|
1690
|
-
addUsers,
|
|
1691
|
-
addFavouriteProjectId,
|
|
1692
|
-
removeFavouriteProjectId,
|
|
1693
|
-
setTourStep,
|
|
1694
|
-
removeUser
|
|
1695
|
-
} = userSlice.actions;
|
|
1675
|
+
const { setCurrentUser, setProfilePicture, setUsers, addUsers, removeUser } = userSlice.actions;
|
|
1696
1676
|
const userReducer = userSlice.reducer;
|
|
1697
1677
|
const selectCurrentUser = (state) => state.userReducer.currentUser;
|
|
1698
1678
|
const selectUsersMapping = (state) => state.userReducer.users;
|
|
@@ -1713,7 +1693,6 @@ const selectUsersByIds = restructureCreateSelectorWithArgs(
|
|
|
1713
1693
|
return fallbackToEmptyArray(users);
|
|
1714
1694
|
})
|
|
1715
1695
|
);
|
|
1716
|
-
const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
|
|
1717
1696
|
const organizationAccessAdapter = createModelAdapter(
|
|
1718
1697
|
(organizationAccess) => organizationAccess.offline_id
|
|
1719
1698
|
);
|
|
@@ -1739,7 +1718,7 @@ const selectActiveOrganizationAccess = createSelector(
|
|
|
1739
1718
|
[selectCurrentUser, selectOrganizationAccesses],
|
|
1740
1719
|
(currentUser, organizationAccesses) => {
|
|
1741
1720
|
const activeOrganizationAccess = Object.values(organizationAccesses).find(
|
|
1742
|
-
(organizationAccess) => organizationAccess.user === currentUser.id
|
|
1721
|
+
(organizationAccess) => organizationAccess.user === (currentUser == null ? void 0 : currentUser.id)
|
|
1743
1722
|
);
|
|
1744
1723
|
return activeOrganizationAccess ?? null;
|
|
1745
1724
|
}
|
|
@@ -1929,9 +1908,9 @@ const selectSortedProjectUsers = createSelector(
|
|
|
1929
1908
|
[selectCurrentUser, selectProjectUsersAsMapping, selectProjectAccessUserMapping],
|
|
1930
1909
|
(currentUser, userMapping, projectAccessMapping) => {
|
|
1931
1910
|
return Object.values(userMapping).sort((userA, userB) => {
|
|
1932
|
-
if (userA.id === currentUser.id) {
|
|
1911
|
+
if (userA.id === (currentUser == null ? void 0 : currentUser.id)) {
|
|
1933
1912
|
return -1;
|
|
1934
|
-
} else if (userB.id === currentUser.id) {
|
|
1913
|
+
} else if (userB.id === (currentUser == null ? void 0 : currentUser.id)) {
|
|
1935
1914
|
return 1;
|
|
1936
1915
|
}
|
|
1937
1916
|
const projectAccessesA = projectAccessMapping[userA.id];
|
|
@@ -2008,9 +1987,9 @@ const selectSortedOrganizationUsers = createSelector(
|
|
|
2008
1987
|
[selectCurrentUser, selectOrganizationUsersAsMapping, selectOrganizationAccessUserMapping],
|
|
2009
1988
|
(currentUser, userMapping, organizationAccessMapping) => {
|
|
2010
1989
|
return Object.values(userMapping).sort((userA, userB) => {
|
|
2011
|
-
if (userA.id === currentUser.id) {
|
|
1990
|
+
if (userA.id === (currentUser == null ? void 0 : currentUser.id)) {
|
|
2012
1991
|
return -1;
|
|
2013
|
-
} else if (userB.id === currentUser.id) {
|
|
1992
|
+
} else if (userB.id === (currentUser == null ? void 0 : currentUser.id)) {
|
|
2014
1993
|
return 1;
|
|
2015
1994
|
}
|
|
2016
1995
|
const organizationAccessesA = organizationAccessMapping[userA.id];
|
|
@@ -4169,70 +4148,42 @@ function chunkArray(arr, chunkSize) {
|
|
|
4169
4148
|
}
|
|
4170
4149
|
class AssetService extends BaseApiService {
|
|
4171
4150
|
// Basic CRUD functions
|
|
4172
|
-
add(
|
|
4173
|
-
|
|
4174
|
-
if (!payload.canvas_marker && !payload.geo_marker) {
|
|
4151
|
+
add(asset, workspaceId) {
|
|
4152
|
+
if (!asset.canvas_marker && !asset.geo_marker) {
|
|
4175
4153
|
throw new Error("Asset must have either a canvas_marker or geo_marker");
|
|
4176
4154
|
}
|
|
4177
|
-
const
|
|
4178
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4179
|
-
const offlineAsset = offline({
|
|
4180
|
-
...payload,
|
|
4181
|
-
created_by: createdBy,
|
|
4182
|
-
submitted_at: submittedAt
|
|
4183
|
-
});
|
|
4155
|
+
const offlineAsset = offline(asset);
|
|
4184
4156
|
this.dispatch(addAsset(offlineAsset));
|
|
4185
4157
|
const promise = this.enqueueRequest({
|
|
4186
4158
|
description: "Create asset",
|
|
4187
4159
|
method: HttpMethod.POST,
|
|
4188
|
-
url:
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
submitted_at: offlineAsset.submitted_at,
|
|
4192
|
-
geo_marker: offlineAsset.geo_marker,
|
|
4193
|
-
canvas_marker: offlineAsset.canvas_marker,
|
|
4194
|
-
label: offlineAsset.label,
|
|
4195
|
-
description: offlineAsset.description,
|
|
4196
|
-
asset_type: offlineAsset.asset_type
|
|
4160
|
+
url: `/assets/types/${offlineAsset.asset_type}/add-assets/`,
|
|
4161
|
+
queryParams: {
|
|
4162
|
+
workspace_id: workspaceId.toString()
|
|
4197
4163
|
},
|
|
4198
|
-
|
|
4164
|
+
payload: { assets: [offlineAsset] },
|
|
4165
|
+
blockers: [],
|
|
4199
4166
|
blocks: [offlineAsset.offline_id]
|
|
4200
4167
|
});
|
|
4201
|
-
promise.then((createdAsset) => {
|
|
4202
|
-
this.dispatch(updateAsset(createdAsset));
|
|
4203
|
-
}).catch(() => {
|
|
4204
|
-
this.dispatch(deleteAsset(offlineAsset.offline_id));
|
|
4205
|
-
});
|
|
4206
4168
|
return [offlineAsset, promise];
|
|
4207
4169
|
}
|
|
4208
|
-
update(
|
|
4209
|
-
|
|
4210
|
-
if (!payload.canvas_marker && !payload.geo_marker) {
|
|
4170
|
+
update(asset, workspaceId) {
|
|
4171
|
+
if (!asset.canvas_marker && !asset.geo_marker) {
|
|
4211
4172
|
throw new Error("Asset must have either a canvas_marker or geo_marker");
|
|
4212
4173
|
}
|
|
4213
|
-
|
|
4214
|
-
if (!asset) {
|
|
4215
|
-
throw new Error(`No asset with id ${payload.offline_id} found in the store`);
|
|
4216
|
-
}
|
|
4217
|
-
const updatedAsset = {
|
|
4218
|
-
...asset,
|
|
4219
|
-
...payload
|
|
4220
|
-
};
|
|
4221
|
-
this.dispatch(updateAsset(updatedAsset));
|
|
4174
|
+
this.client.store.dispatch(updateAsset(asset));
|
|
4222
4175
|
const promise = this.enqueueRequest({
|
|
4223
4176
|
description: "Edit asset",
|
|
4224
4177
|
method: HttpMethod.PATCH,
|
|
4225
|
-
url: `/assets/${
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
}).catch(() => {
|
|
4233
|
-
this.dispatch(updateAsset(asset));
|
|
4178
|
+
url: `/assets/${asset.offline_id}/`,
|
|
4179
|
+
queryParams: {
|
|
4180
|
+
workspace_id: workspaceId.toString()
|
|
4181
|
+
},
|
|
4182
|
+
payload: asset,
|
|
4183
|
+
blockers: [asset.offline_id],
|
|
4184
|
+
blocks: [asset.offline_id]
|
|
4234
4185
|
});
|
|
4235
|
-
return [
|
|
4186
|
+
return [asset, promise];
|
|
4236
4187
|
}
|
|
4237
4188
|
async remove(assetId) {
|
|
4238
4189
|
const { store } = this.client;
|
|
@@ -4270,17 +4221,39 @@ class AssetService extends BaseApiService {
|
|
|
4270
4221
|
throw err;
|
|
4271
4222
|
});
|
|
4272
4223
|
}
|
|
4273
|
-
|
|
4224
|
+
async deleteAllAssetsOfAssetType(assetTypeId) {
|
|
4225
|
+
const { store } = this.client;
|
|
4226
|
+
const state = store.getState();
|
|
4227
|
+
const allAssetsOfAssetType = selectAssetsOfAssetType(assetTypeId)(state);
|
|
4228
|
+
const allAssetsOfAssetTypeIds = allAssetsOfAssetType.map((c) => c.offline_id);
|
|
4229
|
+
const affectedOfflineIds = [assetTypeId, ...allAssetsOfAssetTypeIds];
|
|
4230
|
+
store.dispatch(deleteAssets(allAssetsOfAssetTypeIds));
|
|
4231
|
+
return this.enqueueRequest({
|
|
4232
|
+
description: "Delete all assets of asset type",
|
|
4233
|
+
method: HttpMethod.DELETE,
|
|
4234
|
+
url: `/assets/types/${assetTypeId}/delete-all-of-type/`,
|
|
4235
|
+
blockers: affectedOfflineIds,
|
|
4236
|
+
blocks: affectedOfflineIds
|
|
4237
|
+
}).catch((err) => {
|
|
4238
|
+
store.dispatch(addAssets(allAssetsOfAssetType));
|
|
4239
|
+
throw err;
|
|
4240
|
+
});
|
|
4241
|
+
}
|
|
4242
|
+
// TODO: payload does not require asset_type
|
|
4243
|
+
bulkAdd(assetsToCreate, workspaceId, assetTypeId, batchSize) {
|
|
4274
4244
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4275
4245
|
const transactionId = v4();
|
|
4276
|
-
const assetBatches = chunkArray(
|
|
4277
|
-
const assetPayloads = assetBatch.map((assetPayload) =>
|
|
4246
|
+
const assetBatches = chunkArray(assetsToCreate, batchSize).map((assetBatch) => {
|
|
4247
|
+
const assetPayloads = assetBatch.map((assetPayload) => {
|
|
4248
|
+
return offline({
|
|
4249
|
+
...assetPayload,
|
|
4250
|
+
submitted_at: submittedAt
|
|
4251
|
+
});
|
|
4252
|
+
});
|
|
4278
4253
|
return {
|
|
4279
4254
|
batchId: v4(),
|
|
4280
4255
|
payload: {
|
|
4281
4256
|
transaction_id: transactionId,
|
|
4282
|
-
submitted_at: submittedAt,
|
|
4283
|
-
asset_type: assetTypeId,
|
|
4284
4257
|
assets: assetPayloads
|
|
4285
4258
|
}
|
|
4286
4259
|
};
|
|
@@ -4298,7 +4271,10 @@ class AssetService extends BaseApiService {
|
|
|
4298
4271
|
const promise = this.enqueueRequest({
|
|
4299
4272
|
description: "Batch create assets",
|
|
4300
4273
|
method: HttpMethod.POST,
|
|
4301
|
-
url:
|
|
4274
|
+
url: `/assets/types/${assetTypeId}/add-assets/`,
|
|
4275
|
+
queryParams: {
|
|
4276
|
+
workspace_id: workspaceId.toString()
|
|
4277
|
+
},
|
|
4302
4278
|
payload,
|
|
4303
4279
|
blockers,
|
|
4304
4280
|
blocks
|
|
@@ -4324,152 +4300,117 @@ class AssetService extends BaseApiService {
|
|
|
4324
4300
|
}
|
|
4325
4301
|
}
|
|
4326
4302
|
class AssetStageCompletionService extends BaseApiService {
|
|
4327
|
-
add(
|
|
4303
|
+
add(assetId, stageId) {
|
|
4304
|
+
var _a2;
|
|
4328
4305
|
const { store } = this.client;
|
|
4329
|
-
const
|
|
4330
|
-
|
|
4306
|
+
const assetTypeId = (_a2 = selectAssetById(assetId)(store.getState())) == null ? void 0 : _a2.asset_type;
|
|
4307
|
+
if (!assetTypeId) {
|
|
4308
|
+
throw new Error(`Asset with offline_id ${assetId} not found`);
|
|
4309
|
+
}
|
|
4331
4310
|
const offlineStageCompletion = offline({
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
submitted_at: submittedAt
|
|
4311
|
+
asset: assetId,
|
|
4312
|
+
stage: stageId
|
|
4335
4313
|
});
|
|
4336
|
-
this.dispatch(
|
|
4314
|
+
this.dispatch(addStageCompletion(offlineStageCompletion));
|
|
4337
4315
|
const promise = this.enqueueRequest({
|
|
4338
|
-
description: "
|
|
4316
|
+
description: "Complete stage",
|
|
4339
4317
|
method: HttpMethod.POST,
|
|
4340
|
-
url:
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
asset: payload.asset,
|
|
4345
|
-
stage: payload.stage
|
|
4346
|
-
},
|
|
4347
|
-
blockers: [payload.asset, payload.stage],
|
|
4318
|
+
url: `/assets/types/${assetTypeId}/complete-stages/`,
|
|
4319
|
+
// TODO: Add submitted_at to model
|
|
4320
|
+
payload: { completions: [{ ...offlineStageCompletion, submitted_at: (/* @__PURE__ */ new Date()).getTime() / 1e3 }] },
|
|
4321
|
+
blockers: [assetId, stageId],
|
|
4348
4322
|
blocks: [offlineStageCompletion.offline_id]
|
|
4349
4323
|
});
|
|
4350
|
-
promise.then((result) => {
|
|
4351
|
-
this.dispatch(updateAssetStageCompletion(result));
|
|
4352
|
-
}).catch(() => {
|
|
4353
|
-
this.dispatch(deleteAssetStageCompletion(offlineStageCompletion.offline_id));
|
|
4354
|
-
});
|
|
4355
4324
|
return [offlineStageCompletion, promise];
|
|
4356
4325
|
}
|
|
4357
|
-
|
|
4358
|
-
const
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
this.dispatch(deleteAssetStageCompletion(id));
|
|
4364
|
-
const promise = this.enqueueRequest({
|
|
4365
|
-
description: "Delete asset stage completion",
|
|
4366
|
-
method: HttpMethod.DELETE,
|
|
4367
|
-
url: `/assets/completions/${id}/`,
|
|
4368
|
-
blockers: [id],
|
|
4326
|
+
async refreshStore(projectId) {
|
|
4327
|
+
const result = await this.enqueueRequest({
|
|
4328
|
+
description: "Get stage completions",
|
|
4329
|
+
method: HttpMethod.GET,
|
|
4330
|
+
url: `/projects/${projectId}/asset-stage-completions/`,
|
|
4331
|
+
blockers: [],
|
|
4369
4332
|
blocks: []
|
|
4370
4333
|
});
|
|
4371
|
-
|
|
4372
|
-
this.dispatch(addAssetStageCompletion(assetStageCompletion));
|
|
4373
|
-
});
|
|
4374
|
-
return promise;
|
|
4334
|
+
this.dispatch(addStageCompletions(result));
|
|
4375
4335
|
}
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
}
|
|
4388
|
-
const
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4336
|
+
/**
|
|
4337
|
+
* Creates a collection of AssetStageCompletions, marking the referenced stages as completed for the referenced
|
|
4338
|
+
* assets. It's REQUIRED that all assets referenced all have the SAME asset type.
|
|
4339
|
+
* @param assetTypeId The ID of the asset type for which we are completing stages (we can only complete
|
|
4340
|
+
* stages for one asset type at a time)
|
|
4341
|
+
* @param stageCompletions
|
|
4342
|
+
*/
|
|
4343
|
+
async bulkAdd(assetTypeId, stageCompletions) {
|
|
4344
|
+
const offlineStageCompletions = stageCompletions.map((completion) => {
|
|
4345
|
+
return offline(completion);
|
|
4346
|
+
});
|
|
4347
|
+
const asMapping = {};
|
|
4348
|
+
for (const completion of stageCompletions) {
|
|
4349
|
+
const stageToCompletionDateMapping = asMapping[completion.asset] || {};
|
|
4350
|
+
stageToCompletionDateMapping[completion.stage] = (/* @__PURE__ */ new Date()).toISOString();
|
|
4351
|
+
asMapping[completion.asset] = stageToCompletionDateMapping;
|
|
4352
|
+
}
|
|
4353
|
+
this.dispatch(addStageCompletions(asMapping));
|
|
4354
|
+
await this.enqueueRequest({
|
|
4355
|
+
description: "Bulk complete stages",
|
|
4392
4356
|
method: HttpMethod.POST,
|
|
4393
|
-
url:
|
|
4357
|
+
url: `/assets/types/${assetTypeId}/complete-stages/`,
|
|
4394
4358
|
payload: {
|
|
4395
|
-
|
|
4396
|
-
completions: payload
|
|
4359
|
+
completions: offlineStageCompletions
|
|
4397
4360
|
},
|
|
4398
|
-
blockers: [...
|
|
4399
|
-
blocks:
|
|
4400
|
-
});
|
|
4401
|
-
promise.then((result) => {
|
|
4402
|
-
this.dispatch(updateAssetStageCompletions(result));
|
|
4403
|
-
}).catch(() => {
|
|
4404
|
-
this.dispatch(deleteAssetStageCompletions(offlineIds));
|
|
4361
|
+
blockers: [assetTypeId, ...stageCompletions.map((c) => c.asset), ...stageCompletions.map((c) => c.stage)],
|
|
4362
|
+
blocks: offlineStageCompletions.map((c) => c.offline_id)
|
|
4405
4363
|
});
|
|
4406
|
-
return [offlineStageCompletions, promise];
|
|
4407
4364
|
}
|
|
4408
|
-
bulkDelete(
|
|
4409
|
-
const
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4365
|
+
bulkDelete(stageId, assetIds) {
|
|
4366
|
+
const stageCompletionsToRemove = assetIds.map((assetId) => {
|
|
4367
|
+
return {
|
|
4368
|
+
asset: assetId,
|
|
4369
|
+
stage: stageId
|
|
4370
|
+
};
|
|
4371
|
+
});
|
|
4372
|
+
this.dispatch(removeStageCompletions(stageCompletionsToRemove));
|
|
4373
|
+
return this.enqueueRequest({
|
|
4374
|
+
description: `Undo stage for ${assetIds.length} assets(s)`,
|
|
4375
|
+
// TODO: Rename to setCompletedStages
|
|
4414
4376
|
method: HttpMethod.DELETE,
|
|
4415
|
-
url:
|
|
4377
|
+
url: `/assets/stages/${stageId}/undo-stages/`,
|
|
4416
4378
|
payload: {
|
|
4417
|
-
|
|
4379
|
+
assets: assetIds
|
|
4418
4380
|
},
|
|
4419
|
-
blockers:
|
|
4420
|
-
blocks: []
|
|
4421
|
-
});
|
|
4422
|
-
promise.catch(() => {
|
|
4423
|
-
this.dispatch(addAssetStageCompletions(assetStageCompletions));
|
|
4424
|
-
});
|
|
4425
|
-
return promise;
|
|
4426
|
-
}
|
|
4427
|
-
async refreshStore(projectId) {
|
|
4428
|
-
const result = await this.enqueueRequest({
|
|
4429
|
-
description: "Get asset stage completions",
|
|
4430
|
-
method: HttpMethod.GET,
|
|
4431
|
-
url: `/projects/${projectId}/asset-stage-completions/`,
|
|
4432
|
-
blockers: [],
|
|
4381
|
+
blockers: [stageId, ...assetIds],
|
|
4433
4382
|
blocks: []
|
|
4434
4383
|
});
|
|
4435
|
-
this.dispatch(initializeAssetStageCompletions(result));
|
|
4436
4384
|
}
|
|
4437
4385
|
}
|
|
4438
4386
|
class AssetStageService extends BaseApiService {
|
|
4439
|
-
|
|
4440
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4441
|
-
const createdBy = this.client.store.getState().userReducer.currentUser.id;
|
|
4387
|
+
async bulkCreateStages(stagesToSubmit, assetTypeId, workspaceId) {
|
|
4442
4388
|
const payload = stagesToSubmit.map((stage) => {
|
|
4443
4389
|
return offline(stage);
|
|
4444
4390
|
});
|
|
4445
|
-
const
|
|
4446
|
-
return { ...stage, asset_type: assetTypeId
|
|
4391
|
+
const fullStages = payload.map((stage) => {
|
|
4392
|
+
return { ...stage, asset_type: assetTypeId };
|
|
4447
4393
|
});
|
|
4448
|
-
this.dispatch(
|
|
4449
|
-
|
|
4394
|
+
this.dispatch(addStages(fullStages));
|
|
4395
|
+
return this.enqueueRequest({
|
|
4450
4396
|
description: "Add asset stages",
|
|
4451
4397
|
method: HttpMethod.POST,
|
|
4452
|
-
url:
|
|
4398
|
+
url: `/assets/types/${assetTypeId}/add-stages/`,
|
|
4453
4399
|
payload: {
|
|
4454
|
-
submitted_at: submittedAt,
|
|
4455
|
-
asset_type: assetTypeId,
|
|
4456
4400
|
stages: payload
|
|
4457
4401
|
},
|
|
4458
|
-
|
|
4402
|
+
queryParams: {
|
|
4403
|
+
workspace_id: workspaceId.toString()
|
|
4404
|
+
},
|
|
4405
|
+
blockers: [assetTypeId, workspaceId],
|
|
4459
4406
|
blocks: payload.map(({ offline_id }) => offline_id)
|
|
4460
4407
|
});
|
|
4461
|
-
promise.then((result) => {
|
|
4462
|
-
this.dispatch(updateAssetStages(result));
|
|
4463
|
-
}).catch(() => {
|
|
4464
|
-
this.dispatch(deleteAssetStages(offlineStages.map(({ offline_id }) => offline_id)));
|
|
4465
|
-
});
|
|
4466
|
-
return [offlineStages, promise];
|
|
4467
4408
|
}
|
|
4468
|
-
async
|
|
4409
|
+
async bulkUpdateStages(stagesToUpdate, assetTypeId) {
|
|
4469
4410
|
const store = this.client.store;
|
|
4470
4411
|
const state = store.getState();
|
|
4471
4412
|
const prevStages = selectAssetStagesByIds(stagesToUpdate.map(({ offline_id }) => offline_id))(state);
|
|
4472
|
-
this.dispatch(
|
|
4413
|
+
this.dispatch(updateStages(stagesToUpdate));
|
|
4473
4414
|
return this.enqueueRequest({
|
|
4474
4415
|
description: "Edit asset stages",
|
|
4475
4416
|
method: HttpMethod.PATCH,
|
|
@@ -4480,58 +4421,33 @@ class AssetStageService extends BaseApiService {
|
|
|
4480
4421
|
blockers: [assetTypeId],
|
|
4481
4422
|
blocks: stagesToUpdate.map(({ offline_id }) => offline_id)
|
|
4482
4423
|
}).catch((e) => {
|
|
4483
|
-
|
|
4424
|
+
store.dispatch(updateStages(prevStages));
|
|
4484
4425
|
throw e;
|
|
4485
4426
|
});
|
|
4486
4427
|
}
|
|
4487
4428
|
async bulkDelete(idsToDelete) {
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
this.dispatch(deleteAssetStages(idsToDelete));
|
|
4491
|
-
const promise = this.enqueueRequest({
|
|
4429
|
+
this.dispatch(removeStages(idsToDelete));
|
|
4430
|
+
return this.enqueueRequest({
|
|
4492
4431
|
description: "Delete asset stages",
|
|
4493
4432
|
method: HttpMethod.DELETE,
|
|
4494
|
-
url: "/assets/stages/bulk/",
|
|
4433
|
+
url: "/assets/stages/bulk-delete/",
|
|
4495
4434
|
payload: {
|
|
4496
4435
|
stage_ids: idsToDelete
|
|
4497
4436
|
},
|
|
4498
4437
|
blockers: idsToDelete,
|
|
4499
4438
|
blocks: []
|
|
4500
4439
|
});
|
|
4501
|
-
promise.catch(() => {
|
|
4502
|
-
this.dispatch(addAssetStages(assetStages));
|
|
4503
|
-
});
|
|
4504
|
-
return promise;
|
|
4505
4440
|
}
|
|
4506
|
-
update(
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
if (!assetStage)
|
|
4510
|
-
throw new Error(`No asset stage with id ${payload.offline_id} found in the store`);
|
|
4511
|
-
const updatedAssetStage = {
|
|
4512
|
-
...assetStage,
|
|
4513
|
-
...payload
|
|
4514
|
-
};
|
|
4515
|
-
this.dispatch(updateAssetStage(updatedAssetStage));
|
|
4516
|
-
const promise = this.enqueueRequest({
|
|
4441
|
+
async update(assetStage) {
|
|
4442
|
+
this.dispatch(addStages([assetStage]));
|
|
4443
|
+
return this.enqueueRequest({
|
|
4517
4444
|
description: "Update asset stage",
|
|
4518
4445
|
method: HttpMethod.PATCH,
|
|
4519
4446
|
url: `/assets/stages/${assetStage.offline_id}/`,
|
|
4520
|
-
payload:
|
|
4521
|
-
name: payload.name,
|
|
4522
|
-
description: payload.description,
|
|
4523
|
-
priority: payload.priority,
|
|
4524
|
-
color: payload.color
|
|
4525
|
-
},
|
|
4447
|
+
payload: assetStage,
|
|
4526
4448
|
blockers: [assetStage.offline_id],
|
|
4527
4449
|
blocks: [assetStage.offline_id]
|
|
4528
4450
|
});
|
|
4529
|
-
promise.then((result) => {
|
|
4530
|
-
this.dispatch(updateAssetStage(result));
|
|
4531
|
-
}).catch(() => {
|
|
4532
|
-
this.dispatch(setAssetStage(assetStage));
|
|
4533
|
-
});
|
|
4534
|
-
return [updatedAssetStage, promise];
|
|
4535
4451
|
}
|
|
4536
4452
|
async linkForm(stageId, formId) {
|
|
4537
4453
|
const { store } = this.client;
|
|
@@ -4539,7 +4455,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4539
4455
|
if (!stage) {
|
|
4540
4456
|
throw new Error(`No asset stage with id ${stageId} found in the store`);
|
|
4541
4457
|
}
|
|
4542
|
-
this.dispatch(
|
|
4458
|
+
this.dispatch(updateStage({ ...stage, form: formId }));
|
|
4543
4459
|
try {
|
|
4544
4460
|
await this.enqueueRequest({
|
|
4545
4461
|
description: "Link asset stage to form",
|
|
@@ -4550,7 +4466,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4550
4466
|
blocks: [stageId]
|
|
4551
4467
|
});
|
|
4552
4468
|
} catch (e) {
|
|
4553
|
-
this.dispatch(
|
|
4469
|
+
this.dispatch(setStage(stage));
|
|
4554
4470
|
throw e;
|
|
4555
4471
|
}
|
|
4556
4472
|
}
|
|
@@ -4560,7 +4476,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4560
4476
|
if (!stage) {
|
|
4561
4477
|
throw new Error(`No asset stage with id ${stageId} found in the store`);
|
|
4562
4478
|
}
|
|
4563
|
-
this.dispatch(
|
|
4479
|
+
this.dispatch(updateStage({ ...stage, form: void 0 }));
|
|
4564
4480
|
try {
|
|
4565
4481
|
await this.enqueueRequest({
|
|
4566
4482
|
description: "Unlink asset stage from form",
|
|
@@ -4570,7 +4486,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4570
4486
|
blocks: [stageId]
|
|
4571
4487
|
});
|
|
4572
4488
|
} catch (e) {
|
|
4573
|
-
this.dispatch(
|
|
4489
|
+
this.dispatch(setStage(stage));
|
|
4574
4490
|
throw e;
|
|
4575
4491
|
}
|
|
4576
4492
|
}
|
|
@@ -4582,7 +4498,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4582
4498
|
blockers: [],
|
|
4583
4499
|
blocks: []
|
|
4584
4500
|
});
|
|
4585
|
-
this.dispatch(
|
|
4501
|
+
this.dispatch(initializeStages(result));
|
|
4586
4502
|
}
|
|
4587
4503
|
}
|
|
4588
4504
|
class BaseUploadService extends BaseApiService {
|
|
@@ -4789,61 +4705,29 @@ class AssetAttachmentService extends BaseAttachmentService {
|
|
|
4789
4705
|
}
|
|
4790
4706
|
}
|
|
4791
4707
|
class AssetTypeService extends BaseApiService {
|
|
4792
|
-
add(
|
|
4793
|
-
const
|
|
4794
|
-
const createdBy = store.getState().userReducer.currentUser.id;
|
|
4795
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4796
|
-
const offlineAssetType = offline({
|
|
4797
|
-
...payload,
|
|
4798
|
-
created_by: createdBy,
|
|
4799
|
-
submitted_at: submittedAt
|
|
4800
|
-
});
|
|
4708
|
+
add(assetType) {
|
|
4709
|
+
const offlineAssetType = offline(assetType);
|
|
4801
4710
|
this.dispatch(addAssetType(offlineAssetType));
|
|
4802
4711
|
const promise = this.enqueueRequest({
|
|
4803
4712
|
description: "Create asset type",
|
|
4804
4713
|
method: HttpMethod.POST,
|
|
4805
|
-
url: `/projects/${
|
|
4714
|
+
url: `/projects/${assetType.project}/asset-types/`,
|
|
4806
4715
|
payload: { ...offlineAssetType },
|
|
4807
4716
|
blockers: [],
|
|
4808
4717
|
blocks: [offlineAssetType.offline_id]
|
|
4809
4718
|
});
|
|
4810
|
-
promise.then((result) => {
|
|
4811
|
-
this.dispatch(updateAssetType(result));
|
|
4812
|
-
}).catch(() => {
|
|
4813
|
-
this.dispatch(deleteAssetType(offlineAssetType.offline_id));
|
|
4814
|
-
});
|
|
4815
4719
|
return [offlineAssetType, promise];
|
|
4816
4720
|
}
|
|
4817
|
-
update(
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
if (!assetType) {
|
|
4821
|
-
throw new Error(`Expected asset type with offline_id ${payload.offline_id} to exist`);
|
|
4822
|
-
}
|
|
4823
|
-
const updatedAssetType = {
|
|
4824
|
-
...assetType,
|
|
4825
|
-
...payload
|
|
4826
|
-
};
|
|
4827
|
-
this.dispatch(updateAssetType(updatedAssetType));
|
|
4828
|
-
const promise = this.enqueueRequest({
|
|
4721
|
+
update(assetType) {
|
|
4722
|
+
this.dispatch(addAssetType(assetType));
|
|
4723
|
+
return this.enqueueRequest({
|
|
4829
4724
|
description: "Update asset type",
|
|
4830
4725
|
method: HttpMethod.PATCH,
|
|
4831
|
-
url: `/assets/types/${
|
|
4832
|
-
payload:
|
|
4833
|
-
icon: payload.icon,
|
|
4834
|
-
color: payload.color,
|
|
4835
|
-
name: payload.name,
|
|
4836
|
-
description: payload.description
|
|
4837
|
-
},
|
|
4726
|
+
url: `/assets/types/${assetType.offline_id}/`,
|
|
4727
|
+
payload: assetType,
|
|
4838
4728
|
blockers: [assetType.offline_id],
|
|
4839
4729
|
blocks: [assetType.offline_id]
|
|
4840
4730
|
});
|
|
4841
|
-
promise.then((result) => {
|
|
4842
|
-
this.dispatch(updateAssetType(result));
|
|
4843
|
-
}).catch(() => {
|
|
4844
|
-
this.dispatch(updateAssetType(assetType));
|
|
4845
|
-
});
|
|
4846
|
-
return [updatedAssetType, promise];
|
|
4847
4731
|
}
|
|
4848
4732
|
async delete(assetTypeId) {
|
|
4849
4733
|
const { store } = this.client;
|
|
@@ -4852,13 +4736,17 @@ class AssetTypeService extends BaseApiService {
|
|
|
4852
4736
|
if (!assetType) {
|
|
4853
4737
|
throw new Error(`Expected asset type with offline_id ${assetTypeId} to exist`);
|
|
4854
4738
|
}
|
|
4855
|
-
const assetsOfAssetType = selectAssetsOfAssetType(assetTypeId)(state);
|
|
4856
4739
|
const stagesOfAssetType = selectStagesOfAssetType(assetTypeId)(state);
|
|
4857
4740
|
const attachmentsOfAssetType = selectAttachmentsOfAssetType(assetTypeId)(state);
|
|
4858
4741
|
this.dispatch(deleteAssetType(assetTypeId));
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4742
|
+
if (stagesOfAssetType.length > 0) {
|
|
4743
|
+
const stagesOfAssetTypeIds = stagesOfAssetType.map((assetStage) => assetStage.offline_id);
|
|
4744
|
+
this.dispatch(removeStages(stagesOfAssetTypeIds));
|
|
4745
|
+
}
|
|
4746
|
+
if (attachmentsOfAssetType.length > 0) {
|
|
4747
|
+
const attachmentsOfAssetTypeIds = attachmentsOfAssetType.map(({ offline_id }) => offline_id);
|
|
4748
|
+
this.dispatch(deleteAssetTypeAttachments(attachmentsOfAssetTypeIds));
|
|
4749
|
+
}
|
|
4862
4750
|
return this.enqueueRequest({
|
|
4863
4751
|
description: "Delete asset type",
|
|
4864
4752
|
method: HttpMethod.DELETE,
|
|
@@ -4867,8 +4755,7 @@ class AssetTypeService extends BaseApiService {
|
|
|
4867
4755
|
blocks: []
|
|
4868
4756
|
}).catch((e) => {
|
|
4869
4757
|
this.dispatch(addAssetType(assetType));
|
|
4870
|
-
this.dispatch(
|
|
4871
|
-
this.dispatch(addAssetStages(stagesOfAssetType));
|
|
4758
|
+
this.dispatch(addStages(stagesOfAssetType));
|
|
4872
4759
|
this.dispatch(addAssetTypeAttachments(attachmentsOfAssetType));
|
|
4873
4760
|
throw e;
|
|
4874
4761
|
});
|
|
@@ -5082,6 +4969,15 @@ class IssueService extends BaseApiService {
|
|
|
5082
4969
|
void promise.then((result) => {
|
|
5083
4970
|
this.dispatch(updateIssue(result));
|
|
5084
4971
|
}).catch((error) => {
|
|
4972
|
+
var _a2;
|
|
4973
|
+
console.error(error);
|
|
4974
|
+
if (error instanceof APIError) {
|
|
4975
|
+
(_a2 = unsafeShowToast) == null ? void 0 : _a2({
|
|
4976
|
+
title: "Could not create issue",
|
|
4977
|
+
description: error.message,
|
|
4978
|
+
accentColor: "red"
|
|
4979
|
+
});
|
|
4980
|
+
}
|
|
5085
4981
|
this.dispatch(deleteIssue(issuePayload.offline_id));
|
|
5086
4982
|
this.dispatch(addActiveProjectIssuesCount(-1));
|
|
5087
4983
|
throw error;
|
|
@@ -7637,20 +7533,12 @@ class IssueAssociationService extends BaseUploadService {
|
|
|
7637
7533
|
this.dispatch(initializeIssueAssociations(issueAssociations));
|
|
7638
7534
|
}
|
|
7639
7535
|
}
|
|
7640
|
-
var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
|
|
7641
|
-
VerificationCodeType2[VerificationCodeType2["USER_REGISTRATION"] = 0] = "USER_REGISTRATION";
|
|
7642
|
-
VerificationCodeType2[VerificationCodeType2["APPLICATION_INVITE"] = 2] = "APPLICATION_INVITE";
|
|
7643
|
-
VerificationCodeType2[VerificationCodeType2["PROJECT_INVITE"] = 4] = "PROJECT_INVITE";
|
|
7644
|
-
VerificationCodeType2[VerificationCodeType2["ORGANIZATION_INVITE"] = 6] = "ORGANIZATION_INVITE";
|
|
7645
|
-
VerificationCodeType2[VerificationCodeType2["ADD_EMAIL_DOMAIN"] = 8] = "ADD_EMAIL_DOMAIN";
|
|
7646
|
-
VerificationCodeType2[VerificationCodeType2["RESET_PASSWORD"] = 10] = "RESET_PASSWORD";
|
|
7647
|
-
return VerificationCodeType2;
|
|
7648
|
-
})(VerificationCodeType || {});
|
|
7649
7536
|
export {
|
|
7650
7537
|
APIError,
|
|
7651
7538
|
AgentService,
|
|
7652
7539
|
AssetAttachmentService,
|
|
7653
7540
|
AssetService,
|
|
7541
|
+
AssetStageColors,
|
|
7654
7542
|
AssetStageCompletionService,
|
|
7655
7543
|
AssetStageService,
|
|
7656
7544
|
AssetTypeAttachmentService,
|
|
@@ -7712,14 +7600,9 @@ export {
|
|
|
7712
7600
|
addAsset,
|
|
7713
7601
|
addAssetAttachment,
|
|
7714
7602
|
addAssetAttachments,
|
|
7715
|
-
addAssetStage,
|
|
7716
|
-
addAssetStageCompletion,
|
|
7717
|
-
addAssetStageCompletions,
|
|
7718
|
-
addAssetStages,
|
|
7719
7603
|
addAssetType,
|
|
7720
7604
|
addAssetTypeAttachment,
|
|
7721
7605
|
addAssetTypeAttachments,
|
|
7722
|
-
addAssetTypes,
|
|
7723
7606
|
addAssets,
|
|
7724
7607
|
addCategory,
|
|
7725
7608
|
addConversation,
|
|
@@ -7727,7 +7610,6 @@ export {
|
|
|
7727
7610
|
addDocumentAttachments,
|
|
7728
7611
|
addDocuments,
|
|
7729
7612
|
addEmailDomain,
|
|
7730
|
-
addFavouriteProjectId,
|
|
7731
7613
|
addForm,
|
|
7732
7614
|
addFormRevision,
|
|
7733
7615
|
addFormRevisionAttachment,
|
|
@@ -7757,6 +7639,9 @@ export {
|
|
|
7757
7639
|
addOrReplaceProjects,
|
|
7758
7640
|
addProjectAttachment,
|
|
7759
7641
|
addProjectAttachments,
|
|
7642
|
+
addStageCompletion,
|
|
7643
|
+
addStageCompletions,
|
|
7644
|
+
addStages,
|
|
7760
7645
|
addTeam,
|
|
7761
7646
|
addToRecentIssues,
|
|
7762
7647
|
addUsers,
|
|
@@ -7797,14 +7682,9 @@ export {
|
|
|
7797
7682
|
deleteAsset,
|
|
7798
7683
|
deleteAssetAttachment,
|
|
7799
7684
|
deleteAssetAttachments,
|
|
7800
|
-
deleteAssetStage,
|
|
7801
|
-
deleteAssetStageCompletion,
|
|
7802
|
-
deleteAssetStageCompletions,
|
|
7803
|
-
deleteAssetStages,
|
|
7804
7685
|
deleteAssetType,
|
|
7805
7686
|
deleteAssetTypeAttachment,
|
|
7806
7687
|
deleteAssetTypeAttachments,
|
|
7807
|
-
deleteAssetTypes,
|
|
7808
7688
|
deleteAssets,
|
|
7809
7689
|
deleteCategory,
|
|
7810
7690
|
deleteDocumentAttachment,
|
|
@@ -7880,11 +7760,10 @@ export {
|
|
|
7880
7760
|
getLocalRelativeDateString,
|
|
7881
7761
|
getOutboxCoordinator,
|
|
7882
7762
|
getRenamedFile,
|
|
7763
|
+
getStageColor,
|
|
7883
7764
|
hashFile,
|
|
7884
7765
|
initSDK,
|
|
7885
7766
|
initializeAssetAttachments,
|
|
7886
|
-
initializeAssetStageCompletions,
|
|
7887
|
-
initializeAssetStages,
|
|
7888
7767
|
initializeAssetTypeAttachments,
|
|
7889
7768
|
initializeAssetTypes,
|
|
7890
7769
|
initializeAssets,
|
|
@@ -7907,6 +7786,7 @@ export {
|
|
|
7907
7786
|
initializeOrganizationAccesses,
|
|
7908
7787
|
initializeProjectAccesses,
|
|
7909
7788
|
initializeProjectAttachments,
|
|
7789
|
+
initializeStages,
|
|
7910
7790
|
initializeTeams,
|
|
7911
7791
|
initializeWorkspaces,
|
|
7912
7792
|
isToday,
|
|
@@ -7959,11 +7839,12 @@ export {
|
|
|
7959
7839
|
rehydratedReducer,
|
|
7960
7840
|
rehydratedSlice,
|
|
7961
7841
|
removeDocuments,
|
|
7962
|
-
removeFavouriteProjectId,
|
|
7963
7842
|
removeIssueType,
|
|
7964
7843
|
removeProjectFile,
|
|
7965
7844
|
removeProjectFilesOfProject,
|
|
7966
7845
|
removeRecentIssue,
|
|
7846
|
+
removeStageCompletions,
|
|
7847
|
+
removeStages,
|
|
7967
7848
|
removeUser,
|
|
7968
7849
|
resetProjectFileObjectUrls,
|
|
7969
7850
|
resetRecentIssues,
|
|
@@ -7986,9 +7867,6 @@ export {
|
|
|
7986
7867
|
selectAssetAttachments,
|
|
7987
7868
|
selectAssetById,
|
|
7988
7869
|
selectAssetStageById,
|
|
7989
|
-
selectAssetStageCompletionById,
|
|
7990
|
-
selectAssetStageCompletionMapping,
|
|
7991
|
-
selectAssetStageCompletionsByIds,
|
|
7992
7870
|
selectAssetStages,
|
|
7993
7871
|
selectAssetStagesByIds,
|
|
7994
7872
|
selectAssetTypeAttachmentById,
|
|
@@ -8024,7 +7902,7 @@ export {
|
|
|
8024
7902
|
selectCategoryMapping,
|
|
8025
7903
|
selectCommentsOfIssue,
|
|
8026
7904
|
selectCompletedStageIdsForAsset,
|
|
8027
|
-
|
|
7905
|
+
selectCompletedStages,
|
|
8028
7906
|
selectConversation,
|
|
8029
7907
|
selectConversationMapping,
|
|
8030
7908
|
selectConversations,
|
|
@@ -8039,7 +7917,6 @@ export {
|
|
|
8039
7917
|
selectEmailDomains,
|
|
8040
7918
|
selectEmailDomainsAsMapping,
|
|
8041
7919
|
selectEmailDomainsOfOrganization,
|
|
8042
|
-
selectFavouriteProjects,
|
|
8043
7920
|
selectFilteredForms,
|
|
8044
7921
|
selectFormById,
|
|
8045
7922
|
selectFormMapping,
|
|
@@ -8138,6 +8015,7 @@ export {
|
|
|
8138
8015
|
selectSortedProjectUsers,
|
|
8139
8016
|
selectStageFormIdsFromStageIds,
|
|
8140
8017
|
selectStageMapping,
|
|
8018
|
+
selectStagesFromAssetTypeIds,
|
|
8141
8019
|
selectStagesOfAssetType,
|
|
8142
8020
|
selectTeamById,
|
|
8143
8021
|
selectTeams,
|
|
@@ -8157,12 +8035,8 @@ export {
|
|
|
8157
8035
|
setAsset,
|
|
8158
8036
|
setAssetAttachment,
|
|
8159
8037
|
setAssetAttachments,
|
|
8160
|
-
setAssetStage,
|
|
8161
|
-
setAssetStages,
|
|
8162
|
-
setAssetType,
|
|
8163
8038
|
setAssetTypeAttachment,
|
|
8164
8039
|
setAssetTypeAttachments,
|
|
8165
|
-
setAssetTypes,
|
|
8166
8040
|
setAssets,
|
|
8167
8041
|
setConversation,
|
|
8168
8042
|
setCurrentUser,
|
|
@@ -8195,9 +8069,10 @@ export {
|
|
|
8195
8069
|
setProjectAttachments,
|
|
8196
8070
|
setProjects,
|
|
8197
8071
|
setRehydrated,
|
|
8072
|
+
setStage,
|
|
8073
|
+
setStageCompletions,
|
|
8198
8074
|
setTeam,
|
|
8199
8075
|
setTokens,
|
|
8200
|
-
setTourStep,
|
|
8201
8076
|
setUploadUrl,
|
|
8202
8077
|
setUsers,
|
|
8203
8078
|
setWorkspaces,
|
|
@@ -8213,14 +8088,8 @@ export {
|
|
|
8213
8088
|
updateAsset,
|
|
8214
8089
|
updateAssetAttachment,
|
|
8215
8090
|
updateAssetAttachments,
|
|
8216
|
-
updateAssetStage,
|
|
8217
|
-
updateAssetStageCompletion,
|
|
8218
|
-
updateAssetStageCompletions,
|
|
8219
|
-
updateAssetStages,
|
|
8220
|
-
updateAssetType,
|
|
8221
8091
|
updateAssetTypeAttachment,
|
|
8222
8092
|
updateAssetTypeAttachments,
|
|
8223
|
-
updateAssetTypes,
|
|
8224
8093
|
updateAssets,
|
|
8225
8094
|
updateCategory,
|
|
8226
8095
|
updateConversation,
|
|
@@ -8248,6 +8117,8 @@ export {
|
|
|
8248
8117
|
updateProjectAccess,
|
|
8249
8118
|
updateProjectAttachment,
|
|
8250
8119
|
updateProjectAttachments,
|
|
8120
|
+
updateStage,
|
|
8121
|
+
updateStages,
|
|
8251
8122
|
updateTeam,
|
|
8252
8123
|
updateWorkspace,
|
|
8253
8124
|
useMemoCompare,
|