@overmap-ai/core 1.0.65-asset-models-improvements.3 → 1.0.65-error-message-fix.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 +460 -556
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +449 -545
- 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/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");
|
|
@@ -274,13 +229,16 @@ const UNKNOWN_ERROR_MESSAGE = "An unknown error occurred";
|
|
|
274
229
|
const MAX_ERROR_MESSAGE_LENGTH = 500;
|
|
275
230
|
const _SPECIAL_KEYS = ["non_field_errors", "detail"];
|
|
276
231
|
function extractErrorMessage(errorRes, err) {
|
|
232
|
+
console.debug("extracting error message from response", errorRes, err);
|
|
277
233
|
let ret;
|
|
278
234
|
if (errorRes == null ? void 0 : errorRes.body) {
|
|
279
235
|
if (typeof errorRes.body === "object") {
|
|
280
236
|
const responseBody = errorRes.body;
|
|
281
237
|
if (typeof responseBody.error === "string") {
|
|
238
|
+
console.debug("body.error is string", responseBody.error);
|
|
282
239
|
ret = responseBody.error;
|
|
283
240
|
} else if (typeof responseBody.message === "string") {
|
|
241
|
+
console.debug("body.message is string", responseBody.message);
|
|
284
242
|
ret = responseBody.message;
|
|
285
243
|
} else if (responseBody.body) {
|
|
286
244
|
try {
|
|
@@ -297,11 +255,13 @@ function extractErrorMessage(errorRes, err) {
|
|
|
297
255
|
}
|
|
298
256
|
return `${key}: ${JSON.stringify(value)}`;
|
|
299
257
|
}).join("\n");
|
|
258
|
+
console.debug("parsing error body", ret);
|
|
300
259
|
} catch (e) {
|
|
301
260
|
console.error("Failed to extract error message from response body", e);
|
|
302
261
|
}
|
|
303
262
|
}
|
|
304
263
|
} else if (typeof errorRes.body === "string") {
|
|
264
|
+
console.debug("error body is string", errorRes.body);
|
|
305
265
|
ret = errorRes.body;
|
|
306
266
|
}
|
|
307
267
|
} else if (errorRes == null ? void 0 : errorRes.text) {
|
|
@@ -330,6 +290,130 @@ class APIError extends Error {
|
|
|
330
290
|
this.options = options;
|
|
331
291
|
}
|
|
332
292
|
}
|
|
293
|
+
class DeferredPromise {
|
|
294
|
+
constructor() {
|
|
295
|
+
__publicField(this, _a, "Promise");
|
|
296
|
+
__publicField(this, "_promise");
|
|
297
|
+
__publicField(this, "_resolve");
|
|
298
|
+
__publicField(this, "_reject");
|
|
299
|
+
__publicField(this, "_state", "pending");
|
|
300
|
+
this._resolve = null;
|
|
301
|
+
this._reject = null;
|
|
302
|
+
this._promise = new Promise((resolve, reject) => {
|
|
303
|
+
this._resolve = resolve;
|
|
304
|
+
this._reject = reject;
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
get state() {
|
|
308
|
+
return this._state;
|
|
309
|
+
}
|
|
310
|
+
then(onFulfilled, onRejected) {
|
|
311
|
+
return this._promise.then(onFulfilled, onRejected);
|
|
312
|
+
}
|
|
313
|
+
catch(onRejected) {
|
|
314
|
+
return this._promise.catch(onRejected);
|
|
315
|
+
}
|
|
316
|
+
resolve(value) {
|
|
317
|
+
if (!this._resolve)
|
|
318
|
+
throw new Error("No resolve callback");
|
|
319
|
+
this._resolve(value);
|
|
320
|
+
this._state = "fulfilled";
|
|
321
|
+
}
|
|
322
|
+
reject(reason) {
|
|
323
|
+
if (!this._reject)
|
|
324
|
+
throw reason;
|
|
325
|
+
this._reject(reason);
|
|
326
|
+
this._state = "rejected";
|
|
327
|
+
}
|
|
328
|
+
finally(_onFinally) {
|
|
329
|
+
throw new Error("`finally` not implemented");
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
_a = Symbol.toStringTag;
|
|
333
|
+
var randomString = function randomString2() {
|
|
334
|
+
return Math.random().toString(36).substring(7).split("").join(".");
|
|
335
|
+
};
|
|
336
|
+
({
|
|
337
|
+
INIT: "@@redux/INIT" + randomString(),
|
|
338
|
+
REPLACE: "@@redux/REPLACE" + randomString(),
|
|
339
|
+
PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
|
|
340
|
+
return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
function compose() {
|
|
344
|
+
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
345
|
+
funcs[_key] = arguments[_key];
|
|
346
|
+
}
|
|
347
|
+
if (funcs.length === 0) {
|
|
348
|
+
return function(arg) {
|
|
349
|
+
return arg;
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
if (funcs.length === 1) {
|
|
353
|
+
return funcs[0];
|
|
354
|
+
}
|
|
355
|
+
return funcs.reduce(function(a, b) {
|
|
356
|
+
return function() {
|
|
357
|
+
return a(b.apply(void 0, arguments));
|
|
358
|
+
};
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
const VERSION_REDUCER_KEY$1 = "versioning";
|
|
362
|
+
const latestVersion = () => migrations.length - 1;
|
|
363
|
+
const initialVersioning = (state) => {
|
|
364
|
+
state[VERSION_REDUCER_KEY$1] = { version: latestVersion() };
|
|
365
|
+
return state;
|
|
366
|
+
};
|
|
367
|
+
const signOut = () => {
|
|
368
|
+
return initialVersioning({});
|
|
369
|
+
};
|
|
370
|
+
const createOutboxState = (state) => {
|
|
371
|
+
if (state.outboxReducer) {
|
|
372
|
+
state.outboxReducer.deletedRequests = [];
|
|
373
|
+
}
|
|
374
|
+
return state;
|
|
375
|
+
};
|
|
376
|
+
const wrapMigration = (migrator) => (state) => {
|
|
377
|
+
var _a2;
|
|
378
|
+
if (state === void 0) {
|
|
379
|
+
state = {};
|
|
380
|
+
}
|
|
381
|
+
if (((_a2 = state[VERSION_REDUCER_KEY$1]) == null ? void 0 : _a2.version) === latestVersion())
|
|
382
|
+
return state;
|
|
383
|
+
return migrator(state);
|
|
384
|
+
};
|
|
385
|
+
const migrations = [initialVersioning, signOut, signOut, createOutboxState];
|
|
386
|
+
const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
|
|
387
|
+
const initialState$B = {
|
|
388
|
+
accessToken: "",
|
|
389
|
+
refreshToken: "",
|
|
390
|
+
isLoggedIn: false
|
|
391
|
+
};
|
|
392
|
+
const authSlice = createSlice({
|
|
393
|
+
name: "auth",
|
|
394
|
+
initialState: initialState$B,
|
|
395
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$B)),
|
|
396
|
+
reducers: {
|
|
397
|
+
setTokens: (state, action) => {
|
|
398
|
+
state.accessToken = action.payload.accessToken;
|
|
399
|
+
state.refreshToken = action.payload.refreshToken;
|
|
400
|
+
},
|
|
401
|
+
clearTokens: (state) => {
|
|
402
|
+
state.accessToken = "";
|
|
403
|
+
state.refreshToken = "";
|
|
404
|
+
},
|
|
405
|
+
setLoggedIn: (state, action) => {
|
|
406
|
+
if (!action.payload) {
|
|
407
|
+
authSlice.caseReducers.clearTokens(state);
|
|
408
|
+
}
|
|
409
|
+
state.isLoggedIn = action.payload;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
const { setTokens, clearTokens, setLoggedIn } = authSlice.actions;
|
|
414
|
+
const selectAccessToken = (state) => state.authReducer.accessToken;
|
|
415
|
+
const selectIsLoggedIn = (state) => state.authReducer.isLoggedIn;
|
|
416
|
+
const authReducer = authSlice.reducer;
|
|
333
417
|
const coordinatesToLiteral = (coordinates) => {
|
|
334
418
|
return { lng: coordinates[0], lat: coordinates[1] };
|
|
335
419
|
};
|
|
@@ -674,6 +758,19 @@ const Colors = {
|
|
|
674
758
|
mint: mint.mint9,
|
|
675
759
|
sky: sky.sky9
|
|
676
760
|
};
|
|
761
|
+
const AssetStageColors = {
|
|
762
|
+
indigo: indigo.indigo9,
|
|
763
|
+
red: red.red9,
|
|
764
|
+
violet: violet.violet9,
|
|
765
|
+
yellow: yellow.yellow9,
|
|
766
|
+
jade: jade.jade9,
|
|
767
|
+
cyan: cyan.cyan9,
|
|
768
|
+
gold: gold.gold9,
|
|
769
|
+
orange: orange.orange9,
|
|
770
|
+
lime: lime.lime9,
|
|
771
|
+
sky: sky.sky9,
|
|
772
|
+
pink: pink.pink9
|
|
773
|
+
};
|
|
677
774
|
const defaultBadgeColor = "#868686";
|
|
678
775
|
const generateBadgeColors = (rawColor) => {
|
|
679
776
|
const color = ColorCls(rawColor);
|
|
@@ -682,6 +779,9 @@ const generateBadgeColors = (rawColor) => {
|
|
|
682
779
|
const textColor = color.hex() === safety.hex() ? "#000000" : "#FFFFFF";
|
|
683
780
|
return { backgroundColor, textColor };
|
|
684
781
|
};
|
|
782
|
+
function getStageColor(index) {
|
|
783
|
+
return Object.values(AssetStageColors)[index % Object.keys(AssetStageColors).length];
|
|
784
|
+
}
|
|
685
785
|
const getLocalDateString = memoize((date) => {
|
|
686
786
|
if (!date)
|
|
687
787
|
return "";
|
|
@@ -704,130 +804,6 @@ const getLocalRelativeDateString = memoize((date, min, max) => {
|
|
|
704
804
|
return getLocalDateString(date);
|
|
705
805
|
return relative.format(days, "days");
|
|
706
806
|
});
|
|
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
807
|
function createModelAdapter(computeModelId) {
|
|
832
808
|
const addOne = (state, action) => {
|
|
833
809
|
const id = computeModelId(action.payload);
|
|
@@ -1057,75 +1033,64 @@ const selectAttachmentsOfAssetByType = restructureCreateSelectorWithArgs(
|
|
|
1057
1033
|
);
|
|
1058
1034
|
return { fileAttachments, imageAttachments };
|
|
1059
1035
|
}
|
|
1060
|
-
)
|
|
1061
|
-
);
|
|
1062
|
-
const assetAttachmentReducer = assetAttachmentSlice.reducer;
|
|
1063
|
-
const
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
const
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1036
|
+
)
|
|
1037
|
+
);
|
|
1038
|
+
const assetAttachmentReducer = assetAttachmentSlice.reducer;
|
|
1039
|
+
const initialState$x = {
|
|
1040
|
+
completionsByAssetId: {}
|
|
1041
|
+
};
|
|
1042
|
+
const assetStageCompletionSlice = createSlice({
|
|
1043
|
+
name: "assetStageCompletions",
|
|
1044
|
+
initialState: initialState$x,
|
|
1045
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
|
|
1046
|
+
reducers: {
|
|
1047
|
+
addStageCompletion: (state, action) => {
|
|
1048
|
+
let stageToCompletionDateMapping = state.completionsByAssetId[action.payload.asset];
|
|
1049
|
+
if (!stageToCompletionDateMapping) {
|
|
1050
|
+
stageToCompletionDateMapping = {};
|
|
1051
|
+
state.completionsByAssetId[action.payload.asset] = stageToCompletionDateMapping;
|
|
1052
|
+
}
|
|
1053
|
+
stageToCompletionDateMapping[action.payload.stage] = (/* @__PURE__ */ new Date()).toISOString();
|
|
1054
|
+
},
|
|
1055
|
+
addStageCompletions: (state, action) => {
|
|
1056
|
+
for (const [assetId, stageIdToCompletionDateMapping] of Object.entries(action.payload)) {
|
|
1057
|
+
if (Object.keys(stageIdToCompletionDateMapping).length === 0)
|
|
1058
|
+
throw new Error(`Encountered empty stageIdToCompletionDateMapping argument for asset ${assetId}`);
|
|
1059
|
+
let thisAssetCompletions = state.completionsByAssetId[assetId];
|
|
1060
|
+
if (thisAssetCompletions === void 0) {
|
|
1061
|
+
thisAssetCompletions = {};
|
|
1062
|
+
}
|
|
1063
|
+
for (const [stageId, completionDate] of Object.entries(stageIdToCompletionDateMapping)) {
|
|
1064
|
+
thisAssetCompletions[stageId] = completionDate;
|
|
1065
|
+
}
|
|
1066
|
+
state.completionsByAssetId[assetId] = thisAssetCompletions;
|
|
1067
|
+
}
|
|
1068
|
+
},
|
|
1069
|
+
removeStageCompletions: (state, action) => {
|
|
1070
|
+
for (const completion of action.payload) {
|
|
1071
|
+
const thisAssetCompletions = state.completionsByAssetId[completion.asset];
|
|
1072
|
+
if (!thisAssetCompletions || !(completion.stage in thisAssetCompletions)) {
|
|
1073
|
+
console.warn(
|
|
1074
|
+
"Skipping removal of uncompleted stage. This message indicates completion objects are created unnecessarily."
|
|
1075
|
+
);
|
|
1076
|
+
continue;
|
|
1077
|
+
}
|
|
1078
|
+
delete thisAssetCompletions[completion.stage];
|
|
1079
|
+
}
|
|
1080
|
+
},
|
|
1081
|
+
setStageCompletions: (state, action) => {
|
|
1082
|
+
state.completionsByAssetId = action.payload;
|
|
1083
|
+
}
|
|
1079
1084
|
}
|
|
1080
1085
|
});
|
|
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;
|
|
1086
|
+
const { addStageCompletion, addStageCompletions, removeStageCompletions, setStageCompletions } = assetStageCompletionSlice.actions;
|
|
1087
|
+
const selectCompletedStages = (state) => {
|
|
1088
|
+
return state.assetStageCompletionReducer.completionsByAssetId;
|
|
1092
1089
|
};
|
|
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
1090
|
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
|
-
)
|
|
1091
|
+
createSelector([selectCompletedStages, (_state, asset) => asset], (completedStages, asset) => {
|
|
1092
|
+
return Object.keys(completedStages[asset.offline_id] ?? {});
|
|
1093
|
+
})
|
|
1129
1094
|
);
|
|
1130
1095
|
const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
|
|
1131
1096
|
const assetStageAdapter = createModelAdapter((assetStage) => assetStage.offline_id);
|
|
@@ -1135,29 +1100,14 @@ const assetStageSlice = createSlice({
|
|
|
1135
1100
|
initialState: initialState$w,
|
|
1136
1101
|
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
|
|
1137
1102
|
reducers: {
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
updateAssetStages: assetStageAdapter.updateMany,
|
|
1145
|
-
deleteAssetStage: assetStageAdapter.deleteOne,
|
|
1146
|
-
deleteAssetStages: assetStageAdapter.deleteMany
|
|
1103
|
+
initializeStages: assetStageAdapter.initialize,
|
|
1104
|
+
setStage: assetStageAdapter.setOne,
|
|
1105
|
+
addStages: assetStageAdapter.addMany,
|
|
1106
|
+
updateStage: assetStageAdapter.updateOne,
|
|
1107
|
+
updateStages: assetStageAdapter.updateMany,
|
|
1108
|
+
removeStages: assetStageAdapter.deleteMany
|
|
1147
1109
|
}
|
|
1148
1110
|
});
|
|
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
1111
|
const selectStageMapping = (state) => state.assetStageReducer.instances;
|
|
1162
1112
|
const selectAssetStageById = (id) => (state) => {
|
|
1163
1113
|
return state.assetStageReducer.instances[id];
|
|
@@ -1165,6 +1115,24 @@ const selectAssetStageById = (id) => (state) => {
|
|
|
1165
1115
|
const selectAssetStages = createSelector([selectStageMapping], (stageMapping) => {
|
|
1166
1116
|
return Object.values(stageMapping);
|
|
1167
1117
|
});
|
|
1118
|
+
const selectStagesFromAssetTypeIds = restructureCreateSelectorWithArgs(
|
|
1119
|
+
createSelector([selectAssetStages, (_state, assetTypeIds) => assetTypeIds], (stages, assetTypeIds) => {
|
|
1120
|
+
const assetTypeIdsSet = new Set(assetTypeIds);
|
|
1121
|
+
const ret = {};
|
|
1122
|
+
for (const stage of stages) {
|
|
1123
|
+
if (assetTypeIdsSet.has(stage.asset_type)) {
|
|
1124
|
+
if (!ret[stage.asset_type]) {
|
|
1125
|
+
ret[stage.asset_type] = [];
|
|
1126
|
+
}
|
|
1127
|
+
ret[stage.asset_type].push(stage);
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
for (const key in ret) {
|
|
1131
|
+
ret[key] = ret[key].sort((a, b) => a.priority - b.priority);
|
|
1132
|
+
}
|
|
1133
|
+
return ret;
|
|
1134
|
+
})
|
|
1135
|
+
);
|
|
1168
1136
|
const selectAssetTypeStagesMapping = restructureCreateSelectorWithArgs(
|
|
1169
1137
|
createSelector([selectStageMapping, (_state, assetTypeId) => assetTypeId], (stagesMapping, assetTypeId) => {
|
|
1170
1138
|
const assetTypeStagesMapping = {};
|
|
@@ -1212,6 +1180,8 @@ const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
|
|
|
1212
1180
|
return ret;
|
|
1213
1181
|
})
|
|
1214
1182
|
);
|
|
1183
|
+
const { initializeStages, setStage, addStages, updateStages, removeStages, updateStage } = assetStageSlice.actions;
|
|
1184
|
+
const assetStageReducer = assetStageSlice.reducer;
|
|
1215
1185
|
const assetTypeAdapter = createModelAdapter((assetType) => assetType.offline_id);
|
|
1216
1186
|
const initialState$v = assetTypeAdapter.getInitialState({});
|
|
1217
1187
|
const assetTypeSlice = createSlice({
|
|
@@ -1220,27 +1190,11 @@ const assetTypeSlice = createSlice({
|
|
|
1220
1190
|
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
|
|
1221
1191
|
reducers: {
|
|
1222
1192
|
initializeAssetTypes: assetTypeAdapter.initialize,
|
|
1223
|
-
setAssetType: assetTypeAdapter.setOne,
|
|
1224
|
-
setAssetTypes: assetTypeAdapter.setMany,
|
|
1225
1193
|
addAssetType: assetTypeAdapter.addOne,
|
|
1226
|
-
|
|
1227
|
-
updateAssetType: assetTypeAdapter.updateOne,
|
|
1228
|
-
updateAssetTypes: assetTypeAdapter.updateMany,
|
|
1229
|
-
deleteAssetType: assetTypeAdapter.deleteOne,
|
|
1230
|
-
deleteAssetTypes: assetTypeAdapter.deleteMany
|
|
1194
|
+
deleteAssetType: assetTypeAdapter.deleteOne
|
|
1231
1195
|
}
|
|
1232
1196
|
});
|
|
1233
|
-
const {
|
|
1234
|
-
initializeAssetTypes,
|
|
1235
|
-
setAssetType,
|
|
1236
|
-
setAssetTypes,
|
|
1237
|
-
addAssetType,
|
|
1238
|
-
addAssetTypes,
|
|
1239
|
-
updateAssetType,
|
|
1240
|
-
updateAssetTypes,
|
|
1241
|
-
deleteAssetType,
|
|
1242
|
-
deleteAssetTypes
|
|
1243
|
-
} = assetTypeSlice.actions;
|
|
1197
|
+
const { addAssetType, initializeAssetTypes, deleteAssetType } = assetTypeSlice.actions;
|
|
1244
1198
|
const selectAssetTypesMapping = (state) => state.assetTypeReducer.instances;
|
|
1245
1199
|
const selectAssetTypes = createSelector(
|
|
1246
1200
|
[selectAssetTypesMapping],
|
|
@@ -1628,6 +1582,60 @@ const selectUploadUrl = (sha1) => (state) => {
|
|
|
1628
1582
|
return url;
|
|
1629
1583
|
};
|
|
1630
1584
|
const fileReducer = fileSlice.reducer;
|
|
1585
|
+
var ProjectAccessLevel = /* @__PURE__ */ ((ProjectAccessLevel2) => {
|
|
1586
|
+
ProjectAccessLevel2[ProjectAccessLevel2["BASIC"] = 0] = "BASIC";
|
|
1587
|
+
ProjectAccessLevel2[ProjectAccessLevel2["ADMIN"] = 2] = "ADMIN";
|
|
1588
|
+
return ProjectAccessLevel2;
|
|
1589
|
+
})(ProjectAccessLevel || {});
|
|
1590
|
+
var OrganizationAccessLevel = /* @__PURE__ */ ((OrganizationAccessLevel2) => {
|
|
1591
|
+
OrganizationAccessLevel2[OrganizationAccessLevel2["BASIC"] = 0] = "BASIC";
|
|
1592
|
+
OrganizationAccessLevel2[OrganizationAccessLevel2["ADMIN"] = 2] = "ADMIN";
|
|
1593
|
+
return OrganizationAccessLevel2;
|
|
1594
|
+
})(OrganizationAccessLevel || {});
|
|
1595
|
+
var AttachmentModel = /* @__PURE__ */ ((AttachmentModel2) => {
|
|
1596
|
+
AttachmentModel2["Issue"] = "issue";
|
|
1597
|
+
AttachmentModel2["Asset"] = "asset";
|
|
1598
|
+
AttachmentModel2["AssetType"] = "asset_type";
|
|
1599
|
+
AttachmentModel2["Project"] = "project";
|
|
1600
|
+
AttachmentModel2["Document"] = "document";
|
|
1601
|
+
return AttachmentModel2;
|
|
1602
|
+
})(AttachmentModel || {});
|
|
1603
|
+
var IssueUpdateChange = /* @__PURE__ */ ((IssueUpdateChange2) => {
|
|
1604
|
+
IssueUpdateChange2["STATUS"] = "status";
|
|
1605
|
+
IssueUpdateChange2["PRIORITY"] = "priority";
|
|
1606
|
+
IssueUpdateChange2["CATEGORY"] = "category";
|
|
1607
|
+
IssueUpdateChange2["DESCRIPTION"] = "description";
|
|
1608
|
+
IssueUpdateChange2["TITLE"] = "title";
|
|
1609
|
+
IssueUpdateChange2["ASSIGNED_TO"] = "assigned_to";
|
|
1610
|
+
IssueUpdateChange2["DUE_DATE"] = "due_date";
|
|
1611
|
+
return IssueUpdateChange2;
|
|
1612
|
+
})(IssueUpdateChange || {});
|
|
1613
|
+
var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
|
|
1614
|
+
VerificationCodeType2[VerificationCodeType2["USER_REGISTRATION"] = 0] = "USER_REGISTRATION";
|
|
1615
|
+
VerificationCodeType2[VerificationCodeType2["APPLICATION_INVITE"] = 2] = "APPLICATION_INVITE";
|
|
1616
|
+
VerificationCodeType2[VerificationCodeType2["PROJECT_INVITE"] = 4] = "PROJECT_INVITE";
|
|
1617
|
+
VerificationCodeType2[VerificationCodeType2["ORGANIZATION_INVITE"] = 6] = "ORGANIZATION_INVITE";
|
|
1618
|
+
VerificationCodeType2[VerificationCodeType2["ADD_EMAIL_DOMAIN"] = 8] = "ADD_EMAIL_DOMAIN";
|
|
1619
|
+
VerificationCodeType2[VerificationCodeType2["RESET_PASSWORD"] = 10] = "RESET_PASSWORD";
|
|
1620
|
+
return VerificationCodeType2;
|
|
1621
|
+
})(VerificationCodeType || {});
|
|
1622
|
+
var PaddleCheckoutEvent = /* @__PURE__ */ ((PaddleCheckoutEvent2) => {
|
|
1623
|
+
PaddleCheckoutEvent2["COMPLETED"] = "checkout.completed";
|
|
1624
|
+
PaddleCheckoutEvent2["CLOSED"] = "checkout.closed";
|
|
1625
|
+
return PaddleCheckoutEvent2;
|
|
1626
|
+
})(PaddleCheckoutEvent || {});
|
|
1627
|
+
var LicenseLevel = /* @__PURE__ */ ((LicenseLevel2) => {
|
|
1628
|
+
LicenseLevel2[LicenseLevel2["PRO"] = 0] = "PRO";
|
|
1629
|
+
return LicenseLevel2;
|
|
1630
|
+
})(LicenseLevel || {});
|
|
1631
|
+
var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
|
|
1632
|
+
LicenseStatus2[LicenseStatus2["ACTIVE"] = 0] = "ACTIVE";
|
|
1633
|
+
LicenseStatus2[LicenseStatus2["PAUSED"] = 2] = "PAUSED";
|
|
1634
|
+
LicenseStatus2[LicenseStatus2["CANCELLED"] = 4] = "CANCELLED";
|
|
1635
|
+
LicenseStatus2[LicenseStatus2["INACTIVE"] = 6] = "INACTIVE";
|
|
1636
|
+
LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
|
|
1637
|
+
return LicenseStatus2;
|
|
1638
|
+
})(LicenseStatus || {});
|
|
1631
1639
|
const initialState$p = {
|
|
1632
1640
|
users: {},
|
|
1633
1641
|
currentUser: {
|
|
@@ -4169,70 +4177,42 @@ function chunkArray(arr, chunkSize) {
|
|
|
4169
4177
|
}
|
|
4170
4178
|
class AssetService extends BaseApiService {
|
|
4171
4179
|
// Basic CRUD functions
|
|
4172
|
-
add(
|
|
4173
|
-
|
|
4174
|
-
if (!payload.canvas_marker && !payload.geo_marker) {
|
|
4180
|
+
add(asset, workspaceId) {
|
|
4181
|
+
if (!asset.canvas_marker && !asset.geo_marker) {
|
|
4175
4182
|
throw new Error("Asset must have either a canvas_marker or geo_marker");
|
|
4176
4183
|
}
|
|
4177
|
-
const
|
|
4178
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4179
|
-
const offlineAsset = offline({
|
|
4180
|
-
...payload,
|
|
4181
|
-
created_by: createdBy,
|
|
4182
|
-
submitted_at: submittedAt
|
|
4183
|
-
});
|
|
4184
|
+
const offlineAsset = offline(asset);
|
|
4184
4185
|
this.dispatch(addAsset(offlineAsset));
|
|
4185
4186
|
const promise = this.enqueueRequest({
|
|
4186
4187
|
description: "Create asset",
|
|
4187
4188
|
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
|
|
4189
|
+
url: `/assets/types/${offlineAsset.asset_type}/add-assets/`,
|
|
4190
|
+
queryParams: {
|
|
4191
|
+
workspace_id: workspaceId.toString()
|
|
4197
4192
|
},
|
|
4198
|
-
|
|
4193
|
+
payload: { assets: [offlineAsset] },
|
|
4194
|
+
blockers: [],
|
|
4199
4195
|
blocks: [offlineAsset.offline_id]
|
|
4200
4196
|
});
|
|
4201
|
-
promise.then((createdAsset) => {
|
|
4202
|
-
this.dispatch(updateAsset(createdAsset));
|
|
4203
|
-
}).catch(() => {
|
|
4204
|
-
this.dispatch(deleteAsset(offlineAsset.offline_id));
|
|
4205
|
-
});
|
|
4206
4197
|
return [offlineAsset, promise];
|
|
4207
4198
|
}
|
|
4208
|
-
update(
|
|
4209
|
-
|
|
4210
|
-
if (!payload.canvas_marker && !payload.geo_marker) {
|
|
4199
|
+
update(asset, workspaceId) {
|
|
4200
|
+
if (!asset.canvas_marker && !asset.geo_marker) {
|
|
4211
4201
|
throw new Error("Asset must have either a canvas_marker or geo_marker");
|
|
4212
4202
|
}
|
|
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));
|
|
4203
|
+
this.client.store.dispatch(updateAsset(asset));
|
|
4222
4204
|
const promise = this.enqueueRequest({
|
|
4223
4205
|
description: "Edit asset",
|
|
4224
4206
|
method: HttpMethod.PATCH,
|
|
4225
|
-
url: `/assets/${
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
}).catch(() => {
|
|
4233
|
-
this.dispatch(updateAsset(asset));
|
|
4207
|
+
url: `/assets/${asset.offline_id}/`,
|
|
4208
|
+
queryParams: {
|
|
4209
|
+
workspace_id: workspaceId.toString()
|
|
4210
|
+
},
|
|
4211
|
+
payload: asset,
|
|
4212
|
+
blockers: [asset.offline_id],
|
|
4213
|
+
blocks: [asset.offline_id]
|
|
4234
4214
|
});
|
|
4235
|
-
return [
|
|
4215
|
+
return [asset, promise];
|
|
4236
4216
|
}
|
|
4237
4217
|
async remove(assetId) {
|
|
4238
4218
|
const { store } = this.client;
|
|
@@ -4270,17 +4250,39 @@ class AssetService extends BaseApiService {
|
|
|
4270
4250
|
throw err;
|
|
4271
4251
|
});
|
|
4272
4252
|
}
|
|
4273
|
-
|
|
4253
|
+
async deleteAllAssetsOfAssetType(assetTypeId) {
|
|
4254
|
+
const { store } = this.client;
|
|
4255
|
+
const state = store.getState();
|
|
4256
|
+
const allAssetsOfAssetType = selectAssetsOfAssetType(assetTypeId)(state);
|
|
4257
|
+
const allAssetsOfAssetTypeIds = allAssetsOfAssetType.map((c) => c.offline_id);
|
|
4258
|
+
const affectedOfflineIds = [assetTypeId, ...allAssetsOfAssetTypeIds];
|
|
4259
|
+
store.dispatch(deleteAssets(allAssetsOfAssetTypeIds));
|
|
4260
|
+
return this.enqueueRequest({
|
|
4261
|
+
description: "Delete all assets of asset type",
|
|
4262
|
+
method: HttpMethod.DELETE,
|
|
4263
|
+
url: `/assets/types/${assetTypeId}/delete-all-of-type/`,
|
|
4264
|
+
blockers: affectedOfflineIds,
|
|
4265
|
+
blocks: affectedOfflineIds
|
|
4266
|
+
}).catch((err) => {
|
|
4267
|
+
store.dispatch(addAssets(allAssetsOfAssetType));
|
|
4268
|
+
throw err;
|
|
4269
|
+
});
|
|
4270
|
+
}
|
|
4271
|
+
// TODO: payload does not require asset_type
|
|
4272
|
+
bulkAdd(assetsToCreate, workspaceId, assetTypeId, batchSize) {
|
|
4274
4273
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4275
4274
|
const transactionId = v4();
|
|
4276
|
-
const assetBatches = chunkArray(
|
|
4277
|
-
const assetPayloads = assetBatch.map((assetPayload) =>
|
|
4275
|
+
const assetBatches = chunkArray(assetsToCreate, batchSize).map((assetBatch) => {
|
|
4276
|
+
const assetPayloads = assetBatch.map((assetPayload) => {
|
|
4277
|
+
return offline({
|
|
4278
|
+
...assetPayload,
|
|
4279
|
+
submitted_at: submittedAt
|
|
4280
|
+
});
|
|
4281
|
+
});
|
|
4278
4282
|
return {
|
|
4279
4283
|
batchId: v4(),
|
|
4280
4284
|
payload: {
|
|
4281
4285
|
transaction_id: transactionId,
|
|
4282
|
-
submitted_at: submittedAt,
|
|
4283
|
-
asset_type: assetTypeId,
|
|
4284
4286
|
assets: assetPayloads
|
|
4285
4287
|
}
|
|
4286
4288
|
};
|
|
@@ -4298,7 +4300,10 @@ class AssetService extends BaseApiService {
|
|
|
4298
4300
|
const promise = this.enqueueRequest({
|
|
4299
4301
|
description: "Batch create assets",
|
|
4300
4302
|
method: HttpMethod.POST,
|
|
4301
|
-
url:
|
|
4303
|
+
url: `/assets/types/${assetTypeId}/add-assets/`,
|
|
4304
|
+
queryParams: {
|
|
4305
|
+
workspace_id: workspaceId.toString()
|
|
4306
|
+
},
|
|
4302
4307
|
payload,
|
|
4303
4308
|
blockers,
|
|
4304
4309
|
blocks
|
|
@@ -4324,152 +4329,117 @@ class AssetService extends BaseApiService {
|
|
|
4324
4329
|
}
|
|
4325
4330
|
}
|
|
4326
4331
|
class AssetStageCompletionService extends BaseApiService {
|
|
4327
|
-
add(
|
|
4332
|
+
add(assetId, stageId) {
|
|
4333
|
+
var _a2;
|
|
4328
4334
|
const { store } = this.client;
|
|
4329
|
-
const
|
|
4330
|
-
|
|
4335
|
+
const assetTypeId = (_a2 = selectAssetById(assetId)(store.getState())) == null ? void 0 : _a2.asset_type;
|
|
4336
|
+
if (!assetTypeId) {
|
|
4337
|
+
throw new Error(`Asset with offline_id ${assetId} not found`);
|
|
4338
|
+
}
|
|
4331
4339
|
const offlineStageCompletion = offline({
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
submitted_at: submittedAt
|
|
4340
|
+
asset: assetId,
|
|
4341
|
+
stage: stageId
|
|
4335
4342
|
});
|
|
4336
|
-
this.dispatch(
|
|
4343
|
+
this.dispatch(addStageCompletion(offlineStageCompletion));
|
|
4337
4344
|
const promise = this.enqueueRequest({
|
|
4338
|
-
description: "
|
|
4345
|
+
description: "Complete stage",
|
|
4339
4346
|
method: HttpMethod.POST,
|
|
4340
|
-
url:
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
asset: payload.asset,
|
|
4345
|
-
stage: payload.stage
|
|
4346
|
-
},
|
|
4347
|
-
blockers: [payload.asset, payload.stage],
|
|
4347
|
+
url: `/assets/types/${assetTypeId}/complete-stages/`,
|
|
4348
|
+
// TODO: Add submitted_at to model
|
|
4349
|
+
payload: { completions: [{ ...offlineStageCompletion, submitted_at: (/* @__PURE__ */ new Date()).getTime() / 1e3 }] },
|
|
4350
|
+
blockers: [assetId, stageId],
|
|
4348
4351
|
blocks: [offlineStageCompletion.offline_id]
|
|
4349
4352
|
});
|
|
4350
|
-
promise.then((result) => {
|
|
4351
|
-
this.dispatch(updateAssetStageCompletion(result));
|
|
4352
|
-
}).catch(() => {
|
|
4353
|
-
this.dispatch(deleteAssetStageCompletion(offlineStageCompletion.offline_id));
|
|
4354
|
-
});
|
|
4355
4353
|
return [offlineStageCompletion, promise];
|
|
4356
4354
|
}
|
|
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],
|
|
4355
|
+
async refreshStore(projectId) {
|
|
4356
|
+
const result = await this.enqueueRequest({
|
|
4357
|
+
description: "Get stage completions",
|
|
4358
|
+
method: HttpMethod.GET,
|
|
4359
|
+
url: `/projects/${projectId}/asset-stage-completions/`,
|
|
4360
|
+
blockers: [],
|
|
4369
4361
|
blocks: []
|
|
4370
4362
|
});
|
|
4371
|
-
|
|
4372
|
-
this.dispatch(addAssetStageCompletion(assetStageCompletion));
|
|
4373
|
-
});
|
|
4374
|
-
return promise;
|
|
4363
|
+
this.dispatch(addStageCompletions(result));
|
|
4375
4364
|
}
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
}
|
|
4388
|
-
const
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4365
|
+
/**
|
|
4366
|
+
* Creates a collection of AssetStageCompletions, marking the referenced stages as completed for the referenced
|
|
4367
|
+
* assets. It's REQUIRED that all assets referenced all have the SAME asset type.
|
|
4368
|
+
* @param assetTypeId The ID of the asset type for which we are completing stages (we can only complete
|
|
4369
|
+
* stages for one asset type at a time)
|
|
4370
|
+
* @param stageCompletions
|
|
4371
|
+
*/
|
|
4372
|
+
async bulkAdd(assetTypeId, stageCompletions) {
|
|
4373
|
+
const offlineStageCompletions = stageCompletions.map((completion) => {
|
|
4374
|
+
return offline(completion);
|
|
4375
|
+
});
|
|
4376
|
+
const asMapping = {};
|
|
4377
|
+
for (const completion of stageCompletions) {
|
|
4378
|
+
const stageToCompletionDateMapping = asMapping[completion.asset] || {};
|
|
4379
|
+
stageToCompletionDateMapping[completion.stage] = (/* @__PURE__ */ new Date()).toISOString();
|
|
4380
|
+
asMapping[completion.asset] = stageToCompletionDateMapping;
|
|
4381
|
+
}
|
|
4382
|
+
this.dispatch(addStageCompletions(asMapping));
|
|
4383
|
+
await this.enqueueRequest({
|
|
4384
|
+
description: "Bulk complete stages",
|
|
4392
4385
|
method: HttpMethod.POST,
|
|
4393
|
-
url:
|
|
4386
|
+
url: `/assets/types/${assetTypeId}/complete-stages/`,
|
|
4394
4387
|
payload: {
|
|
4395
|
-
|
|
4396
|
-
completions: payload
|
|
4388
|
+
completions: offlineStageCompletions
|
|
4397
4389
|
},
|
|
4398
|
-
blockers: [...
|
|
4399
|
-
blocks:
|
|
4400
|
-
});
|
|
4401
|
-
promise.then((result) => {
|
|
4402
|
-
this.dispatch(updateAssetStageCompletions(result));
|
|
4403
|
-
}).catch(() => {
|
|
4404
|
-
this.dispatch(deleteAssetStageCompletions(offlineIds));
|
|
4390
|
+
blockers: [assetTypeId, ...stageCompletions.map((c) => c.asset), ...stageCompletions.map((c) => c.stage)],
|
|
4391
|
+
blocks: offlineStageCompletions.map((c) => c.offline_id)
|
|
4405
4392
|
});
|
|
4406
|
-
return [offlineStageCompletions, promise];
|
|
4407
4393
|
}
|
|
4408
|
-
bulkDelete(
|
|
4409
|
-
const
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4394
|
+
bulkDelete(stageId, assetIds) {
|
|
4395
|
+
const stageCompletionsToRemove = assetIds.map((assetId) => {
|
|
4396
|
+
return {
|
|
4397
|
+
asset: assetId,
|
|
4398
|
+
stage: stageId
|
|
4399
|
+
};
|
|
4400
|
+
});
|
|
4401
|
+
this.dispatch(removeStageCompletions(stageCompletionsToRemove));
|
|
4402
|
+
return this.enqueueRequest({
|
|
4403
|
+
description: `Undo stage for ${assetIds.length} assets(s)`,
|
|
4404
|
+
// TODO: Rename to setCompletedStages
|
|
4414
4405
|
method: HttpMethod.DELETE,
|
|
4415
|
-
url:
|
|
4406
|
+
url: `/assets/stages/${stageId}/undo-stages/`,
|
|
4416
4407
|
payload: {
|
|
4417
|
-
|
|
4408
|
+
assets: assetIds
|
|
4418
4409
|
},
|
|
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: [],
|
|
4410
|
+
blockers: [stageId, ...assetIds],
|
|
4433
4411
|
blocks: []
|
|
4434
4412
|
});
|
|
4435
|
-
this.dispatch(initializeAssetStageCompletions(result));
|
|
4436
4413
|
}
|
|
4437
4414
|
}
|
|
4438
4415
|
class AssetStageService extends BaseApiService {
|
|
4439
|
-
|
|
4440
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4441
|
-
const createdBy = this.client.store.getState().userReducer.currentUser.id;
|
|
4416
|
+
async bulkCreateStages(stagesToSubmit, assetTypeId, workspaceId) {
|
|
4442
4417
|
const payload = stagesToSubmit.map((stage) => {
|
|
4443
4418
|
return offline(stage);
|
|
4444
4419
|
});
|
|
4445
|
-
const
|
|
4446
|
-
return { ...stage, asset_type: assetTypeId
|
|
4420
|
+
const fullStages = payload.map((stage) => {
|
|
4421
|
+
return { ...stage, asset_type: assetTypeId };
|
|
4447
4422
|
});
|
|
4448
|
-
this.dispatch(
|
|
4449
|
-
|
|
4423
|
+
this.dispatch(addStages(fullStages));
|
|
4424
|
+
return this.enqueueRequest({
|
|
4450
4425
|
description: "Add asset stages",
|
|
4451
4426
|
method: HttpMethod.POST,
|
|
4452
|
-
url:
|
|
4427
|
+
url: `/assets/types/${assetTypeId}/add-stages/`,
|
|
4453
4428
|
payload: {
|
|
4454
|
-
submitted_at: submittedAt,
|
|
4455
|
-
asset_type: assetTypeId,
|
|
4456
4429
|
stages: payload
|
|
4457
4430
|
},
|
|
4458
|
-
|
|
4431
|
+
queryParams: {
|
|
4432
|
+
workspace_id: workspaceId.toString()
|
|
4433
|
+
},
|
|
4434
|
+
blockers: [assetTypeId, workspaceId],
|
|
4459
4435
|
blocks: payload.map(({ offline_id }) => offline_id)
|
|
4460
4436
|
});
|
|
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
4437
|
}
|
|
4468
|
-
async
|
|
4438
|
+
async bulkUpdateStages(stagesToUpdate, assetTypeId) {
|
|
4469
4439
|
const store = this.client.store;
|
|
4470
4440
|
const state = store.getState();
|
|
4471
4441
|
const prevStages = selectAssetStagesByIds(stagesToUpdate.map(({ offline_id }) => offline_id))(state);
|
|
4472
|
-
this.dispatch(
|
|
4442
|
+
this.dispatch(updateStages(stagesToUpdate));
|
|
4473
4443
|
return this.enqueueRequest({
|
|
4474
4444
|
description: "Edit asset stages",
|
|
4475
4445
|
method: HttpMethod.PATCH,
|
|
@@ -4480,58 +4450,33 @@ class AssetStageService extends BaseApiService {
|
|
|
4480
4450
|
blockers: [assetTypeId],
|
|
4481
4451
|
blocks: stagesToUpdate.map(({ offline_id }) => offline_id)
|
|
4482
4452
|
}).catch((e) => {
|
|
4483
|
-
|
|
4453
|
+
store.dispatch(updateStages(prevStages));
|
|
4484
4454
|
throw e;
|
|
4485
4455
|
});
|
|
4486
4456
|
}
|
|
4487
4457
|
async bulkDelete(idsToDelete) {
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
this.dispatch(deleteAssetStages(idsToDelete));
|
|
4491
|
-
const promise = this.enqueueRequest({
|
|
4458
|
+
this.dispatch(removeStages(idsToDelete));
|
|
4459
|
+
return this.enqueueRequest({
|
|
4492
4460
|
description: "Delete asset stages",
|
|
4493
4461
|
method: HttpMethod.DELETE,
|
|
4494
|
-
url: "/assets/stages/bulk/",
|
|
4462
|
+
url: "/assets/stages/bulk-delete/",
|
|
4495
4463
|
payload: {
|
|
4496
4464
|
stage_ids: idsToDelete
|
|
4497
4465
|
},
|
|
4498
4466
|
blockers: idsToDelete,
|
|
4499
4467
|
blocks: []
|
|
4500
4468
|
});
|
|
4501
|
-
promise.catch(() => {
|
|
4502
|
-
this.dispatch(addAssetStages(assetStages));
|
|
4503
|
-
});
|
|
4504
|
-
return promise;
|
|
4505
4469
|
}
|
|
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({
|
|
4470
|
+
async update(assetStage) {
|
|
4471
|
+
this.dispatch(addStages([assetStage]));
|
|
4472
|
+
return this.enqueueRequest({
|
|
4517
4473
|
description: "Update asset stage",
|
|
4518
4474
|
method: HttpMethod.PATCH,
|
|
4519
4475
|
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
|
-
},
|
|
4476
|
+
payload: assetStage,
|
|
4526
4477
|
blockers: [assetStage.offline_id],
|
|
4527
4478
|
blocks: [assetStage.offline_id]
|
|
4528
4479
|
});
|
|
4529
|
-
promise.then((result) => {
|
|
4530
|
-
this.dispatch(updateAssetStage(result));
|
|
4531
|
-
}).catch(() => {
|
|
4532
|
-
this.dispatch(setAssetStage(assetStage));
|
|
4533
|
-
});
|
|
4534
|
-
return [updatedAssetStage, promise];
|
|
4535
4480
|
}
|
|
4536
4481
|
async linkForm(stageId, formId) {
|
|
4537
4482
|
const { store } = this.client;
|
|
@@ -4539,7 +4484,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4539
4484
|
if (!stage) {
|
|
4540
4485
|
throw new Error(`No asset stage with id ${stageId} found in the store`);
|
|
4541
4486
|
}
|
|
4542
|
-
this.dispatch(
|
|
4487
|
+
this.dispatch(updateStage({ ...stage, form: formId }));
|
|
4543
4488
|
try {
|
|
4544
4489
|
await this.enqueueRequest({
|
|
4545
4490
|
description: "Link asset stage to form",
|
|
@@ -4550,7 +4495,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4550
4495
|
blocks: [stageId]
|
|
4551
4496
|
});
|
|
4552
4497
|
} catch (e) {
|
|
4553
|
-
this.dispatch(
|
|
4498
|
+
this.dispatch(setStage(stage));
|
|
4554
4499
|
throw e;
|
|
4555
4500
|
}
|
|
4556
4501
|
}
|
|
@@ -4560,7 +4505,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4560
4505
|
if (!stage) {
|
|
4561
4506
|
throw new Error(`No asset stage with id ${stageId} found in the store`);
|
|
4562
4507
|
}
|
|
4563
|
-
this.dispatch(
|
|
4508
|
+
this.dispatch(updateStage({ ...stage, form: void 0 }));
|
|
4564
4509
|
try {
|
|
4565
4510
|
await this.enqueueRequest({
|
|
4566
4511
|
description: "Unlink asset stage from form",
|
|
@@ -4570,7 +4515,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4570
4515
|
blocks: [stageId]
|
|
4571
4516
|
});
|
|
4572
4517
|
} catch (e) {
|
|
4573
|
-
this.dispatch(
|
|
4518
|
+
this.dispatch(setStage(stage));
|
|
4574
4519
|
throw e;
|
|
4575
4520
|
}
|
|
4576
4521
|
}
|
|
@@ -4582,7 +4527,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4582
4527
|
blockers: [],
|
|
4583
4528
|
blocks: []
|
|
4584
4529
|
});
|
|
4585
|
-
this.dispatch(
|
|
4530
|
+
this.dispatch(initializeStages(result));
|
|
4586
4531
|
}
|
|
4587
4532
|
}
|
|
4588
4533
|
class BaseUploadService extends BaseApiService {
|
|
@@ -4789,61 +4734,29 @@ class AssetAttachmentService extends BaseAttachmentService {
|
|
|
4789
4734
|
}
|
|
4790
4735
|
}
|
|
4791
4736
|
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
|
-
});
|
|
4737
|
+
add(assetType) {
|
|
4738
|
+
const offlineAssetType = offline(assetType);
|
|
4801
4739
|
this.dispatch(addAssetType(offlineAssetType));
|
|
4802
4740
|
const promise = this.enqueueRequest({
|
|
4803
4741
|
description: "Create asset type",
|
|
4804
4742
|
method: HttpMethod.POST,
|
|
4805
|
-
url: `/projects/${
|
|
4743
|
+
url: `/projects/${assetType.project}/asset-types/`,
|
|
4806
4744
|
payload: { ...offlineAssetType },
|
|
4807
4745
|
blockers: [],
|
|
4808
4746
|
blocks: [offlineAssetType.offline_id]
|
|
4809
4747
|
});
|
|
4810
|
-
promise.then((result) => {
|
|
4811
|
-
this.dispatch(updateAssetType(result));
|
|
4812
|
-
}).catch(() => {
|
|
4813
|
-
this.dispatch(deleteAssetType(offlineAssetType.offline_id));
|
|
4814
|
-
});
|
|
4815
4748
|
return [offlineAssetType, promise];
|
|
4816
4749
|
}
|
|
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({
|
|
4750
|
+
update(assetType) {
|
|
4751
|
+
this.dispatch(addAssetType(assetType));
|
|
4752
|
+
return this.enqueueRequest({
|
|
4829
4753
|
description: "Update asset type",
|
|
4830
4754
|
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
|
-
},
|
|
4755
|
+
url: `/assets/types/${assetType.offline_id}/`,
|
|
4756
|
+
payload: assetType,
|
|
4838
4757
|
blockers: [assetType.offline_id],
|
|
4839
4758
|
blocks: [assetType.offline_id]
|
|
4840
4759
|
});
|
|
4841
|
-
promise.then((result) => {
|
|
4842
|
-
this.dispatch(updateAssetType(result));
|
|
4843
|
-
}).catch(() => {
|
|
4844
|
-
this.dispatch(updateAssetType(assetType));
|
|
4845
|
-
});
|
|
4846
|
-
return [updatedAssetType, promise];
|
|
4847
4760
|
}
|
|
4848
4761
|
async delete(assetTypeId) {
|
|
4849
4762
|
const { store } = this.client;
|
|
@@ -4852,13 +4765,17 @@ class AssetTypeService extends BaseApiService {
|
|
|
4852
4765
|
if (!assetType) {
|
|
4853
4766
|
throw new Error(`Expected asset type with offline_id ${assetTypeId} to exist`);
|
|
4854
4767
|
}
|
|
4855
|
-
const assetsOfAssetType = selectAssetsOfAssetType(assetTypeId)(state);
|
|
4856
4768
|
const stagesOfAssetType = selectStagesOfAssetType(assetTypeId)(state);
|
|
4857
4769
|
const attachmentsOfAssetType = selectAttachmentsOfAssetType(assetTypeId)(state);
|
|
4858
4770
|
this.dispatch(deleteAssetType(assetTypeId));
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4771
|
+
if (stagesOfAssetType.length > 0) {
|
|
4772
|
+
const stagesOfAssetTypeIds = stagesOfAssetType.map((assetStage) => assetStage.offline_id);
|
|
4773
|
+
this.dispatch(removeStages(stagesOfAssetTypeIds));
|
|
4774
|
+
}
|
|
4775
|
+
if (attachmentsOfAssetType.length > 0) {
|
|
4776
|
+
const attachmentsOfAssetTypeIds = attachmentsOfAssetType.map(({ offline_id }) => offline_id);
|
|
4777
|
+
this.dispatch(deleteAssetTypeAttachments(attachmentsOfAssetTypeIds));
|
|
4778
|
+
}
|
|
4862
4779
|
return this.enqueueRequest({
|
|
4863
4780
|
description: "Delete asset type",
|
|
4864
4781
|
method: HttpMethod.DELETE,
|
|
@@ -4867,8 +4784,7 @@ class AssetTypeService extends BaseApiService {
|
|
|
4867
4784
|
blocks: []
|
|
4868
4785
|
}).catch((e) => {
|
|
4869
4786
|
this.dispatch(addAssetType(assetType));
|
|
4870
|
-
this.dispatch(
|
|
4871
|
-
this.dispatch(addAssetStages(stagesOfAssetType));
|
|
4787
|
+
this.dispatch(addStages(stagesOfAssetType));
|
|
4872
4788
|
this.dispatch(addAssetTypeAttachments(attachmentsOfAssetType));
|
|
4873
4789
|
throw e;
|
|
4874
4790
|
});
|
|
@@ -5082,6 +4998,15 @@ class IssueService extends BaseApiService {
|
|
|
5082
4998
|
void promise.then((result) => {
|
|
5083
4999
|
this.dispatch(updateIssue(result));
|
|
5084
5000
|
}).catch((error) => {
|
|
5001
|
+
var _a2;
|
|
5002
|
+
console.error(error);
|
|
5003
|
+
if (error instanceof APIError) {
|
|
5004
|
+
(_a2 = unsafeShowToast) == null ? void 0 : _a2({
|
|
5005
|
+
title: "Could not create issue",
|
|
5006
|
+
description: error.message,
|
|
5007
|
+
accentColor: "red"
|
|
5008
|
+
});
|
|
5009
|
+
}
|
|
5085
5010
|
this.dispatch(deleteIssue(issuePayload.offline_id));
|
|
5086
5011
|
this.dispatch(addActiveProjectIssuesCount(-1));
|
|
5087
5012
|
throw error;
|
|
@@ -7637,20 +7562,12 @@ class IssueAssociationService extends BaseUploadService {
|
|
|
7637
7562
|
this.dispatch(initializeIssueAssociations(issueAssociations));
|
|
7638
7563
|
}
|
|
7639
7564
|
}
|
|
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
7565
|
export {
|
|
7650
7566
|
APIError,
|
|
7651
7567
|
AgentService,
|
|
7652
7568
|
AssetAttachmentService,
|
|
7653
7569
|
AssetService,
|
|
7570
|
+
AssetStageColors,
|
|
7654
7571
|
AssetStageCompletionService,
|
|
7655
7572
|
AssetStageService,
|
|
7656
7573
|
AssetTypeAttachmentService,
|
|
@@ -7712,14 +7629,9 @@ export {
|
|
|
7712
7629
|
addAsset,
|
|
7713
7630
|
addAssetAttachment,
|
|
7714
7631
|
addAssetAttachments,
|
|
7715
|
-
addAssetStage,
|
|
7716
|
-
addAssetStageCompletion,
|
|
7717
|
-
addAssetStageCompletions,
|
|
7718
|
-
addAssetStages,
|
|
7719
7632
|
addAssetType,
|
|
7720
7633
|
addAssetTypeAttachment,
|
|
7721
7634
|
addAssetTypeAttachments,
|
|
7722
|
-
addAssetTypes,
|
|
7723
7635
|
addAssets,
|
|
7724
7636
|
addCategory,
|
|
7725
7637
|
addConversation,
|
|
@@ -7757,6 +7669,9 @@ export {
|
|
|
7757
7669
|
addOrReplaceProjects,
|
|
7758
7670
|
addProjectAttachment,
|
|
7759
7671
|
addProjectAttachments,
|
|
7672
|
+
addStageCompletion,
|
|
7673
|
+
addStageCompletions,
|
|
7674
|
+
addStages,
|
|
7760
7675
|
addTeam,
|
|
7761
7676
|
addToRecentIssues,
|
|
7762
7677
|
addUsers,
|
|
@@ -7797,14 +7712,9 @@ export {
|
|
|
7797
7712
|
deleteAsset,
|
|
7798
7713
|
deleteAssetAttachment,
|
|
7799
7714
|
deleteAssetAttachments,
|
|
7800
|
-
deleteAssetStage,
|
|
7801
|
-
deleteAssetStageCompletion,
|
|
7802
|
-
deleteAssetStageCompletions,
|
|
7803
|
-
deleteAssetStages,
|
|
7804
7715
|
deleteAssetType,
|
|
7805
7716
|
deleteAssetTypeAttachment,
|
|
7806
7717
|
deleteAssetTypeAttachments,
|
|
7807
|
-
deleteAssetTypes,
|
|
7808
7718
|
deleteAssets,
|
|
7809
7719
|
deleteCategory,
|
|
7810
7720
|
deleteDocumentAttachment,
|
|
@@ -7880,11 +7790,10 @@ export {
|
|
|
7880
7790
|
getLocalRelativeDateString,
|
|
7881
7791
|
getOutboxCoordinator,
|
|
7882
7792
|
getRenamedFile,
|
|
7793
|
+
getStageColor,
|
|
7883
7794
|
hashFile,
|
|
7884
7795
|
initSDK,
|
|
7885
7796
|
initializeAssetAttachments,
|
|
7886
|
-
initializeAssetStageCompletions,
|
|
7887
|
-
initializeAssetStages,
|
|
7888
7797
|
initializeAssetTypeAttachments,
|
|
7889
7798
|
initializeAssetTypes,
|
|
7890
7799
|
initializeAssets,
|
|
@@ -7907,6 +7816,7 @@ export {
|
|
|
7907
7816
|
initializeOrganizationAccesses,
|
|
7908
7817
|
initializeProjectAccesses,
|
|
7909
7818
|
initializeProjectAttachments,
|
|
7819
|
+
initializeStages,
|
|
7910
7820
|
initializeTeams,
|
|
7911
7821
|
initializeWorkspaces,
|
|
7912
7822
|
isToday,
|
|
@@ -7964,6 +7874,8 @@ export {
|
|
|
7964
7874
|
removeProjectFile,
|
|
7965
7875
|
removeProjectFilesOfProject,
|
|
7966
7876
|
removeRecentIssue,
|
|
7877
|
+
removeStageCompletions,
|
|
7878
|
+
removeStages,
|
|
7967
7879
|
removeUser,
|
|
7968
7880
|
resetProjectFileObjectUrls,
|
|
7969
7881
|
resetRecentIssues,
|
|
@@ -7986,9 +7898,6 @@ export {
|
|
|
7986
7898
|
selectAssetAttachments,
|
|
7987
7899
|
selectAssetById,
|
|
7988
7900
|
selectAssetStageById,
|
|
7989
|
-
selectAssetStageCompletionById,
|
|
7990
|
-
selectAssetStageCompletionMapping,
|
|
7991
|
-
selectAssetStageCompletionsByIds,
|
|
7992
7901
|
selectAssetStages,
|
|
7993
7902
|
selectAssetStagesByIds,
|
|
7994
7903
|
selectAssetTypeAttachmentById,
|
|
@@ -8024,7 +7933,7 @@ export {
|
|
|
8024
7933
|
selectCategoryMapping,
|
|
8025
7934
|
selectCommentsOfIssue,
|
|
8026
7935
|
selectCompletedStageIdsForAsset,
|
|
8027
|
-
|
|
7936
|
+
selectCompletedStages,
|
|
8028
7937
|
selectConversation,
|
|
8029
7938
|
selectConversationMapping,
|
|
8030
7939
|
selectConversations,
|
|
@@ -8138,6 +8047,7 @@ export {
|
|
|
8138
8047
|
selectSortedProjectUsers,
|
|
8139
8048
|
selectStageFormIdsFromStageIds,
|
|
8140
8049
|
selectStageMapping,
|
|
8050
|
+
selectStagesFromAssetTypeIds,
|
|
8141
8051
|
selectStagesOfAssetType,
|
|
8142
8052
|
selectTeamById,
|
|
8143
8053
|
selectTeams,
|
|
@@ -8157,12 +8067,8 @@ export {
|
|
|
8157
8067
|
setAsset,
|
|
8158
8068
|
setAssetAttachment,
|
|
8159
8069
|
setAssetAttachments,
|
|
8160
|
-
setAssetStage,
|
|
8161
|
-
setAssetStages,
|
|
8162
|
-
setAssetType,
|
|
8163
8070
|
setAssetTypeAttachment,
|
|
8164
8071
|
setAssetTypeAttachments,
|
|
8165
|
-
setAssetTypes,
|
|
8166
8072
|
setAssets,
|
|
8167
8073
|
setConversation,
|
|
8168
8074
|
setCurrentUser,
|
|
@@ -8195,6 +8101,8 @@ export {
|
|
|
8195
8101
|
setProjectAttachments,
|
|
8196
8102
|
setProjects,
|
|
8197
8103
|
setRehydrated,
|
|
8104
|
+
setStage,
|
|
8105
|
+
setStageCompletions,
|
|
8198
8106
|
setTeam,
|
|
8199
8107
|
setTokens,
|
|
8200
8108
|
setTourStep,
|
|
@@ -8213,14 +8121,8 @@ export {
|
|
|
8213
8121
|
updateAsset,
|
|
8214
8122
|
updateAssetAttachment,
|
|
8215
8123
|
updateAssetAttachments,
|
|
8216
|
-
updateAssetStage,
|
|
8217
|
-
updateAssetStageCompletion,
|
|
8218
|
-
updateAssetStageCompletions,
|
|
8219
|
-
updateAssetStages,
|
|
8220
|
-
updateAssetType,
|
|
8221
8124
|
updateAssetTypeAttachment,
|
|
8222
8125
|
updateAssetTypeAttachments,
|
|
8223
|
-
updateAssetTypes,
|
|
8224
8126
|
updateAssets,
|
|
8225
8127
|
updateCategory,
|
|
8226
8128
|
updateConversation,
|
|
@@ -8248,6 +8150,8 @@ export {
|
|
|
8248
8150
|
updateProjectAccess,
|
|
8249
8151
|
updateProjectAttachment,
|
|
8250
8152
|
updateProjectAttachments,
|
|
8153
|
+
updateStage,
|
|
8154
|
+
updateStages,
|
|
8251
8155
|
updateTeam,
|
|
8252
8156
|
updateWorkspace,
|
|
8253
8157
|
useMemoCompare,
|