@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.
Files changed (76) hide show
  1. package/dist/enums/index.d.ts +0 -3
  2. package/dist/enums/issue.d.ts +0 -9
  3. package/dist/overmap-core.js +456 -585
  4. package/dist/overmap-core.js.map +1 -1
  5. package/dist/overmap-core.umd.cjs +453 -582
  6. package/dist/overmap-core.umd.cjs.map +1 -1
  7. package/dist/sdk/base.d.ts +1 -1
  8. package/dist/sdk/globals.d.ts +2 -2
  9. package/dist/sdk/sdk.d.ts +3 -3
  10. package/dist/sdk/services/AgentService.d.ts +1 -1
  11. package/dist/sdk/services/AssetAttachmentService.d.ts +2 -3
  12. package/dist/sdk/services/AssetService.d.ts +6 -5
  13. package/dist/sdk/services/AssetStageCompletionService.d.ts +12 -6
  14. package/dist/sdk/services/AssetStageService.d.ts +4 -5
  15. package/dist/sdk/services/AssetTypeAttachmentService.d.ts +2 -3
  16. package/dist/sdk/services/AssetTypeService.d.ts +4 -4
  17. package/dist/sdk/services/BaseApiService.d.ts +1 -1
  18. package/dist/sdk/services/BaseAttachmentService.d.ts +2 -3
  19. package/dist/sdk/services/BaseAuthService.d.ts +1 -1
  20. package/dist/sdk/services/BaseService.d.ts +2 -2
  21. package/dist/sdk/services/BaseUploadService.d.ts +2 -2
  22. package/dist/sdk/services/CategoryService.d.ts +2 -2
  23. package/dist/sdk/services/DocumentAttachmentService.d.ts +2 -3
  24. package/dist/sdk/services/DocumentService.d.ts +2 -2
  25. package/dist/sdk/services/EmailDomainsService.d.ts +1 -1
  26. package/dist/sdk/services/EmailVerificationService.d.ts +1 -1
  27. package/dist/sdk/services/FileService.d.ts +1 -1
  28. package/dist/sdk/services/FormService.d.ts +2 -1
  29. package/dist/sdk/services/FormSubmissionService.d.ts +3 -2
  30. package/dist/sdk/services/GeoImageService.d.ts +2 -2
  31. package/dist/sdk/services/IssueAttachmentService.d.ts +2 -3
  32. package/dist/sdk/services/IssueCommentService.d.ts +2 -2
  33. package/dist/sdk/services/IssueService.d.ts +2 -2
  34. package/dist/sdk/services/IssueTypeService.d.ts +2 -2
  35. package/dist/sdk/services/IssueUpdateService.d.ts +1 -1
  36. package/dist/sdk/services/JWTAuthService.d.ts +2 -2
  37. package/dist/sdk/services/LicenseService.d.ts +1 -1
  38. package/dist/sdk/services/OrganizationAccessService.d.ts +1 -1
  39. package/dist/sdk/services/OrganizationService.d.ts +1 -1
  40. package/dist/sdk/services/ProjectAccessService.d.ts +1 -1
  41. package/dist/sdk/services/ProjectAttachmentService.d.ts +2 -3
  42. package/dist/sdk/services/ProjectFileService.d.ts +3 -2
  43. package/dist/sdk/services/ProjectService.d.ts +2 -1
  44. package/dist/sdk/services/TeamService.d.ts +2 -2
  45. package/dist/sdk/services/UserService.d.ts +2 -2
  46. package/dist/sdk/services/WorkspaceService.d.ts +4 -2
  47. package/dist/store/slices/assetStageCompletionSlice.d.ts +11 -41
  48. package/dist/store/slices/assetStageSlice.d.ts +9 -20
  49. package/dist/store/slices/assetTypeSlice.d.ts +3 -27
  50. package/dist/store/slices/userSlice.d.ts +13 -33
  51. package/dist/typings/models/access.d.ts +9 -2
  52. package/dist/typings/models/agents.d.ts +1 -1
  53. package/dist/typings/models/assets.d.ts +9 -8
  54. package/dist/typings/models/attachments.d.ts +9 -2
  55. package/dist/typings/models/base.d.ts +2 -2
  56. package/dist/typings/models/categories.d.ts +2 -2
  57. package/dist/typings/models/documents.d.ts +1 -1
  58. package/dist/typings/models/emailDomain.d.ts +1 -1
  59. package/dist/typings/models/emailVerification.d.ts +2 -2
  60. package/dist/typings/models/forms.d.ts +2 -2
  61. package/dist/typings/models/geoImages.d.ts +3 -3
  62. package/dist/typings/models/issueTypes.d.ts +2 -2
  63. package/dist/typings/models/issues.d.ts +10 -1
  64. package/dist/typings/models/license.d.ts +15 -2
  65. package/dist/typings/models/organizations.d.ts +1 -1
  66. package/dist/typings/models/projects.d.ts +3 -3
  67. package/dist/typings/models/store.d.ts +1 -1
  68. package/dist/typings/models/teams.d.ts +3 -3
  69. package/dist/typings/models/users.d.ts +1 -1
  70. package/dist/typings/models/workspace.d.ts +1 -1
  71. package/dist/typings/store.d.ts +1 -1
  72. package/dist/utils/colors.d.ts +2 -0
  73. package/package.json +1 -1
  74. package/dist/enums/access.d.ts +0 -8
  75. package/dist/enums/attachments.d.ts +0 -7
  76. package/dist/enums/licenses.d.ts +0 -14
@@ -5,8 +5,8 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  (function(global, factory) {
8
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("dependency-graph"), require("uuid"), require("file-saver"), require("react"), require("color"), require("@radix-ui/colors"), require("@redux-offline/redux-offline"), require("@redux-offline/redux-offline/lib/defaults"), require("localforage"), require("redux-persist-migrate"), require("@reduxjs/toolkit"), require("superagent"), require("@redux-offline/redux-offline/lib/constants"), require("jwt-decode"), require("idb"), require("@overmap-ai/blocks")) : typeof define === "function" && define.amd ? define(["exports", "dependency-graph", "uuid", "file-saver", "react", "color", "@radix-ui/colors", "@redux-offline/redux-offline", "@redux-offline/redux-offline/lib/defaults", "localforage", "redux-persist-migrate", "@reduxjs/toolkit", "superagent", "@redux-offline/redux-offline/lib/constants", "jwt-decode", "idb", "@overmap-ai/blocks"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["overmap-core"] = {}, global.dependencyGraph, global.uuid, global.fileSaver, global.React, global.ColorCls, global.colors, global.reduxOffline, global.offlineConfig, global.localforage, global.createMigration, global.toolkit, global.request, global.constants, global.jwtDecode, global.idb, global.blocks));
9
- })(this, function(exports2, dependencyGraph, uuid, fileSaver, React, ColorCls, colors, reduxOffline, offlineConfig, localforage, createMigration, toolkit, request, constants, jwtDecode, idb, blocks) {
8
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("dependency-graph"), require("uuid"), require("@redux-offline/redux-offline"), require("@redux-offline/redux-offline/lib/defaults"), require("localforage"), require("redux-persist-migrate"), require("@reduxjs/toolkit"), require("superagent"), require("file-saver"), require("react"), require("color"), require("@radix-ui/colors"), require("@redux-offline/redux-offline/lib/constants"), require("jwt-decode"), require("@overmap-ai/blocks"), require("idb")) : typeof define === "function" && define.amd ? define(["exports", "dependency-graph", "uuid", "@redux-offline/redux-offline", "@redux-offline/redux-offline/lib/defaults", "localforage", "redux-persist-migrate", "@reduxjs/toolkit", "superagent", "file-saver", "react", "color", "@radix-ui/colors", "@redux-offline/redux-offline/lib/constants", "jwt-decode", "@overmap-ai/blocks", "idb"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["overmap-core"] = {}, global.dependencyGraph, global.uuid, global.reduxOffline, global.offlineConfig, global.localforage, global.createMigration, global.toolkit, global.request, global.fileSaver, global.React, global.ColorCls, global.colors, global.constants, global.jwtDecode, global.blocks, global.idb));
9
+ })(this, function(exports2, dependencyGraph, uuid, reduxOffline, offlineConfig, localforage, createMigration, toolkit, request, fileSaver, React, ColorCls, colors, constants, jwtDecode, blocks, idb) {
10
10
  var _a;
11
11
  "use strict";
12
12
  var HttpMethod = /* @__PURE__ */ ((HttpMethod2) => {
@@ -17,14 +17,6 @@ var __publicField = (obj, key, value) => {
17
17
  HttpMethod2["DELETE"] = "DELETE";
18
18
  return HttpMethod2;
19
19
  })(HttpMethod || {});
20
- var AttachmentModel = /* @__PURE__ */ ((AttachmentModel2) => {
21
- AttachmentModel2["Issue"] = "issue";
22
- AttachmentModel2["Asset"] = "asset";
23
- AttachmentModel2["AssetType"] = "asset_type";
24
- AttachmentModel2["Project"] = "project";
25
- AttachmentModel2["Document"] = "document";
26
- return AttachmentModel2;
27
- })(AttachmentModel || {});
28
20
  var IssuePriority = /* @__PURE__ */ ((IssuePriority2) => {
29
21
  IssuePriority2[IssuePriority2["LOWEST"] = 0] = "LOWEST";
30
22
  IssuePriority2[IssuePriority2["LOW"] = 2] = "LOW";
@@ -39,43 +31,6 @@ var __publicField = (obj, key, value) => {
39
31
  IssueStatus2[IssueStatus2["DONE"] = 4] = "DONE";
40
32
  return IssueStatus2;
41
33
  })(IssueStatus || {});
42
- var IssueUpdateChange = /* @__PURE__ */ ((IssueUpdateChange2) => {
43
- IssueUpdateChange2["STATUS"] = "status";
44
- IssueUpdateChange2["PRIORITY"] = "priority";
45
- IssueUpdateChange2["CATEGORY"] = "category";
46
- IssueUpdateChange2["DESCRIPTION"] = "description";
47
- IssueUpdateChange2["TITLE"] = "title";
48
- IssueUpdateChange2["ASSIGNED_TO"] = "assigned_to";
49
- IssueUpdateChange2["DUE_DATE"] = "due_date";
50
- return IssueUpdateChange2;
51
- })(IssueUpdateChange || {});
52
- var ProjectAccessLevel = /* @__PURE__ */ ((ProjectAccessLevel2) => {
53
- ProjectAccessLevel2[ProjectAccessLevel2["BASIC"] = 0] = "BASIC";
54
- ProjectAccessLevel2[ProjectAccessLevel2["ADMIN"] = 2] = "ADMIN";
55
- return ProjectAccessLevel2;
56
- })(ProjectAccessLevel || {});
57
- var OrganizationAccessLevel = /* @__PURE__ */ ((OrganizationAccessLevel2) => {
58
- OrganizationAccessLevel2[OrganizationAccessLevel2["BASIC"] = 0] = "BASIC";
59
- OrganizationAccessLevel2[OrganizationAccessLevel2["ADMIN"] = 2] = "ADMIN";
60
- return OrganizationAccessLevel2;
61
- })(OrganizationAccessLevel || {});
62
- var PaddleCheckoutEvent = /* @__PURE__ */ ((PaddleCheckoutEvent2) => {
63
- PaddleCheckoutEvent2["COMPLETED"] = "checkout.completed";
64
- PaddleCheckoutEvent2["CLOSED"] = "checkout.closed";
65
- return PaddleCheckoutEvent2;
66
- })(PaddleCheckoutEvent || {});
67
- var LicenseLevel = /* @__PURE__ */ ((LicenseLevel2) => {
68
- LicenseLevel2[LicenseLevel2["PRO"] = 0] = "PRO";
69
- return LicenseLevel2;
70
- })(LicenseLevel || {});
71
- var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
72
- LicenseStatus2[LicenseStatus2["ACTIVE"] = 0] = "ACTIVE";
73
- LicenseStatus2[LicenseStatus2["PAUSED"] = 2] = "PAUSED";
74
- LicenseStatus2[LicenseStatus2["CANCELLED"] = 4] = "CANCELLED";
75
- LicenseStatus2[LicenseStatus2["INACTIVE"] = 6] = "INACTIVE";
76
- LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
77
- return LicenseStatus2;
78
- })(LicenseStatus || {});
79
34
  class OutboxCoordinator {
80
35
  constructor() {
81
36
  __publicField(this, "graph");
@@ -318,6 +273,130 @@ var __publicField = (obj, key, value) => {
318
273
  this.options = options;
319
274
  }
320
275
  }
276
+ class DeferredPromise {
277
+ constructor() {
278
+ __publicField(this, _a, "Promise");
279
+ __publicField(this, "_promise");
280
+ __publicField(this, "_resolve");
281
+ __publicField(this, "_reject");
282
+ __publicField(this, "_state", "pending");
283
+ this._resolve = null;
284
+ this._reject = null;
285
+ this._promise = new Promise((resolve, reject) => {
286
+ this._resolve = resolve;
287
+ this._reject = reject;
288
+ });
289
+ }
290
+ get state() {
291
+ return this._state;
292
+ }
293
+ then(onFulfilled, onRejected) {
294
+ return this._promise.then(onFulfilled, onRejected);
295
+ }
296
+ catch(onRejected) {
297
+ return this._promise.catch(onRejected);
298
+ }
299
+ resolve(value) {
300
+ if (!this._resolve)
301
+ throw new Error("No resolve callback");
302
+ this._resolve(value);
303
+ this._state = "fulfilled";
304
+ }
305
+ reject(reason) {
306
+ if (!this._reject)
307
+ throw reason;
308
+ this._reject(reason);
309
+ this._state = "rejected";
310
+ }
311
+ finally(_onFinally) {
312
+ throw new Error("`finally` not implemented");
313
+ }
314
+ }
315
+ _a = Symbol.toStringTag;
316
+ var randomString = function randomString2() {
317
+ return Math.random().toString(36).substring(7).split("").join(".");
318
+ };
319
+ ({
320
+ INIT: "@@redux/INIT" + randomString(),
321
+ REPLACE: "@@redux/REPLACE" + randomString(),
322
+ PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
323
+ return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
324
+ }
325
+ });
326
+ function compose() {
327
+ for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
328
+ funcs[_key] = arguments[_key];
329
+ }
330
+ if (funcs.length === 0) {
331
+ return function(arg) {
332
+ return arg;
333
+ };
334
+ }
335
+ if (funcs.length === 1) {
336
+ return funcs[0];
337
+ }
338
+ return funcs.reduce(function(a, b) {
339
+ return function() {
340
+ return a(b.apply(void 0, arguments));
341
+ };
342
+ });
343
+ }
344
+ const VERSION_REDUCER_KEY$1 = "versioning";
345
+ const latestVersion = () => migrations.length - 1;
346
+ const initialVersioning = (state) => {
347
+ state[VERSION_REDUCER_KEY$1] = { version: latestVersion() };
348
+ return state;
349
+ };
350
+ const signOut = () => {
351
+ return initialVersioning({});
352
+ };
353
+ const createOutboxState = (state) => {
354
+ if (state.outboxReducer) {
355
+ state.outboxReducer.deletedRequests = [];
356
+ }
357
+ return state;
358
+ };
359
+ const wrapMigration = (migrator) => (state) => {
360
+ var _a2;
361
+ if (state === void 0) {
362
+ state = {};
363
+ }
364
+ if (((_a2 = state[VERSION_REDUCER_KEY$1]) == null ? void 0 : _a2.version) === latestVersion())
365
+ return state;
366
+ return migrator(state);
367
+ };
368
+ const migrations = [initialVersioning, signOut, signOut, createOutboxState];
369
+ const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
370
+ const initialState$B = {
371
+ accessToken: "",
372
+ refreshToken: "",
373
+ isLoggedIn: false
374
+ };
375
+ const authSlice = toolkit.createSlice({
376
+ name: "auth",
377
+ initialState: initialState$B,
378
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$B)),
379
+ reducers: {
380
+ setTokens: (state, action) => {
381
+ state.accessToken = action.payload.accessToken;
382
+ state.refreshToken = action.payload.refreshToken;
383
+ },
384
+ clearTokens: (state) => {
385
+ state.accessToken = "";
386
+ state.refreshToken = "";
387
+ },
388
+ setLoggedIn: (state, action) => {
389
+ if (!action.payload) {
390
+ authSlice.caseReducers.clearTokens(state);
391
+ }
392
+ state.isLoggedIn = action.payload;
393
+ }
394
+ }
395
+ });
396
+ const { setTokens, clearTokens, setLoggedIn } = authSlice.actions;
397
+ const selectAccessToken = (state) => state.authReducer.accessToken;
398
+ const selectIsLoggedIn = (state) => state.authReducer.isLoggedIn;
399
+ const authReducer = authSlice.reducer;
321
400
  const coordinatesToLiteral = (coordinates) => {
322
401
  return { lng: coordinates[0], lat: coordinates[1] };
323
402
  };
@@ -662,6 +741,19 @@ var __publicField = (obj, key, value) => {
662
741
  mint: colors.mint.mint9,
663
742
  sky: colors.sky.sky9
664
743
  };
744
+ const AssetStageColors = {
745
+ indigo: colors.indigo.indigo9,
746
+ red: colors.red.red9,
747
+ violet: colors.violet.violet9,
748
+ yellow: colors.yellow.yellow9,
749
+ jade: colors.jade.jade9,
750
+ cyan: colors.cyan.cyan9,
751
+ gold: colors.gold.gold9,
752
+ orange: colors.orange.orange9,
753
+ lime: colors.lime.lime9,
754
+ sky: colors.sky.sky9,
755
+ pink: colors.pink.pink9
756
+ };
665
757
  const defaultBadgeColor = "#868686";
666
758
  const generateBadgeColors = (rawColor) => {
667
759
  const color = ColorCls(rawColor);
@@ -670,6 +762,9 @@ var __publicField = (obj, key, value) => {
670
762
  const textColor = color.hex() === safety.hex() ? "#000000" : "#FFFFFF";
671
763
  return { backgroundColor, textColor };
672
764
  };
765
+ function getStageColor(index) {
766
+ return Object.values(AssetStageColors)[index % Object.keys(AssetStageColors).length];
767
+ }
673
768
  const getLocalDateString = memoize((date) => {
674
769
  if (!date)
675
770
  return "";
@@ -692,130 +787,6 @@ var __publicField = (obj, key, value) => {
692
787
  return getLocalDateString(date);
693
788
  return relative.format(days, "days");
694
789
  });
695
- class DeferredPromise {
696
- constructor() {
697
- __publicField(this, _a, "Promise");
698
- __publicField(this, "_promise");
699
- __publicField(this, "_resolve");
700
- __publicField(this, "_reject");
701
- __publicField(this, "_state", "pending");
702
- this._resolve = null;
703
- this._reject = null;
704
- this._promise = new Promise((resolve, reject) => {
705
- this._resolve = resolve;
706
- this._reject = reject;
707
- });
708
- }
709
- get state() {
710
- return this._state;
711
- }
712
- then(onFulfilled, onRejected) {
713
- return this._promise.then(onFulfilled, onRejected);
714
- }
715
- catch(onRejected) {
716
- return this._promise.catch(onRejected);
717
- }
718
- resolve(value) {
719
- if (!this._resolve)
720
- throw new Error("No resolve callback");
721
- this._resolve(value);
722
- this._state = "fulfilled";
723
- }
724
- reject(reason) {
725
- if (!this._reject)
726
- throw reason;
727
- this._reject(reason);
728
- this._state = "rejected";
729
- }
730
- finally(_onFinally) {
731
- throw new Error("`finally` not implemented");
732
- }
733
- }
734
- _a = Symbol.toStringTag;
735
- var randomString = function randomString2() {
736
- return Math.random().toString(36).substring(7).split("").join(".");
737
- };
738
- ({
739
- INIT: "@@redux/INIT" + randomString(),
740
- REPLACE: "@@redux/REPLACE" + randomString(),
741
- PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
742
- return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
743
- }
744
- });
745
- function compose() {
746
- for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
747
- funcs[_key] = arguments[_key];
748
- }
749
- if (funcs.length === 0) {
750
- return function(arg) {
751
- return arg;
752
- };
753
- }
754
- if (funcs.length === 1) {
755
- return funcs[0];
756
- }
757
- return funcs.reduce(function(a, b) {
758
- return function() {
759
- return a(b.apply(void 0, arguments));
760
- };
761
- });
762
- }
763
- const VERSION_REDUCER_KEY$1 = "versioning";
764
- const latestVersion = () => migrations.length - 1;
765
- const initialVersioning = (state) => {
766
- state[VERSION_REDUCER_KEY$1] = { version: latestVersion() };
767
- return state;
768
- };
769
- const signOut = () => {
770
- return initialVersioning({});
771
- };
772
- const createOutboxState = (state) => {
773
- if (state.outboxReducer) {
774
- state.outboxReducer.deletedRequests = [];
775
- }
776
- return state;
777
- };
778
- const wrapMigration = (migrator) => (state) => {
779
- var _a2;
780
- if (state === void 0) {
781
- state = {};
782
- }
783
- if (((_a2 = state[VERSION_REDUCER_KEY$1]) == null ? void 0 : _a2.version) === latestVersion())
784
- return state;
785
- return migrator(state);
786
- };
787
- const migrations = [initialVersioning, signOut, signOut, createOutboxState];
788
- const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
789
- const initialState$B = {
790
- accessToken: "",
791
- refreshToken: "",
792
- isLoggedIn: false
793
- };
794
- const authSlice = toolkit.createSlice({
795
- name: "auth",
796
- initialState: initialState$B,
797
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$B)),
798
- reducers: {
799
- setTokens: (state, action) => {
800
- state.accessToken = action.payload.accessToken;
801
- state.refreshToken = action.payload.refreshToken;
802
- },
803
- clearTokens: (state) => {
804
- state.accessToken = "";
805
- state.refreshToken = "";
806
- },
807
- setLoggedIn: (state, action) => {
808
- if (!action.payload) {
809
- authSlice.caseReducers.clearTokens(state);
810
- }
811
- state.isLoggedIn = action.payload;
812
- }
813
- }
814
- });
815
- const { setTokens, clearTokens, setLoggedIn } = authSlice.actions;
816
- const selectAccessToken = (state) => state.authReducer.accessToken;
817
- const selectIsLoggedIn = (state) => state.authReducer.isLoggedIn;
818
- const authReducer = authSlice.reducer;
819
790
  function createModelAdapter(computeModelId) {
820
791
  const addOne = (state, action) => {
821
792
  const id = computeModelId(action.payload);
@@ -1048,72 +1019,61 @@ var __publicField = (obj, key, value) => {
1048
1019
  )
1049
1020
  );
1050
1021
  const assetAttachmentReducer = assetAttachmentSlice.reducer;
1051
- const assetStageCompletionAdapter = createModelAdapter(
1052
- (stageCompletion) => stageCompletion.offline_id
1053
- );
1054
- const initialState$x = assetStageCompletionAdapter.getInitialState({});
1022
+ const initialState$x = {
1023
+ completionsByAssetId: {}
1024
+ };
1055
1025
  const assetStageCompletionSlice = toolkit.createSlice({
1056
1026
  name: "assetStageCompletions",
1057
1027
  initialState: initialState$x,
1058
1028
  extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
1059
1029
  reducers: {
1060
- initializeAssetStageCompletions: assetStageCompletionAdapter.initialize,
1061
- addAssetStageCompletion: assetStageCompletionAdapter.addOne,
1062
- addAssetStageCompletions: assetStageCompletionAdapter.addMany,
1063
- updateAssetStageCompletion: assetStageCompletionAdapter.updateOne,
1064
- updateAssetStageCompletions: assetStageCompletionAdapter.updateMany,
1065
- deleteAssetStageCompletion: assetStageCompletionAdapter.deleteOne,
1066
- deleteAssetStageCompletions: assetStageCompletionAdapter.deleteMany
1030
+ addStageCompletion: (state, action) => {
1031
+ let stageToCompletionDateMapping = state.completionsByAssetId[action.payload.asset];
1032
+ if (!stageToCompletionDateMapping) {
1033
+ stageToCompletionDateMapping = {};
1034
+ state.completionsByAssetId[action.payload.asset] = stageToCompletionDateMapping;
1035
+ }
1036
+ stageToCompletionDateMapping[action.payload.stage] = (/* @__PURE__ */ new Date()).toISOString();
1037
+ },
1038
+ addStageCompletions: (state, action) => {
1039
+ for (const [assetId, stageIdToCompletionDateMapping] of Object.entries(action.payload)) {
1040
+ if (Object.keys(stageIdToCompletionDateMapping).length === 0)
1041
+ throw new Error(`Encountered empty stageIdToCompletionDateMapping argument for asset ${assetId}`);
1042
+ let thisAssetCompletions = state.completionsByAssetId[assetId];
1043
+ if (thisAssetCompletions === void 0) {
1044
+ thisAssetCompletions = {};
1045
+ }
1046
+ for (const [stageId, completionDate] of Object.entries(stageIdToCompletionDateMapping)) {
1047
+ thisAssetCompletions[stageId] = completionDate;
1048
+ }
1049
+ state.completionsByAssetId[assetId] = thisAssetCompletions;
1050
+ }
1051
+ },
1052
+ removeStageCompletions: (state, action) => {
1053
+ for (const completion of action.payload) {
1054
+ const thisAssetCompletions = state.completionsByAssetId[completion.asset];
1055
+ if (!thisAssetCompletions || !(completion.stage in thisAssetCompletions)) {
1056
+ console.warn(
1057
+ "Skipping removal of uncompleted stage. This message indicates completion objects are created unnecessarily."
1058
+ );
1059
+ continue;
1060
+ }
1061
+ delete thisAssetCompletions[completion.stage];
1062
+ }
1063
+ },
1064
+ setStageCompletions: (state, action) => {
1065
+ state.completionsByAssetId = action.payload;
1066
+ }
1067
1067
  }
1068
1068
  });
1069
- const {
1070
- initializeAssetStageCompletions,
1071
- addAssetStageCompletion,
1072
- addAssetStageCompletions,
1073
- updateAssetStageCompletion,
1074
- updateAssetStageCompletions,
1075
- deleteAssetStageCompletion,
1076
- deleteAssetStageCompletions
1077
- } = assetStageCompletionSlice.actions;
1078
- const selectAssetStageCompletionMapping = (state) => {
1079
- return state.assetStageCompletionReducer.instances;
1069
+ const { addStageCompletion, addStageCompletions, removeStageCompletions, setStageCompletions } = assetStageCompletionSlice.actions;
1070
+ const selectCompletedStages = (state) => {
1071
+ return state.assetStageCompletionReducer.completionsByAssetId;
1080
1072
  };
1081
- const selectCompletedStagesByAsset = toolkit.createSelector(
1082
- [selectAssetStageCompletionMapping],
1083
- (completedStagesMapping) => {
1084
- const completedStagesByAsset = {};
1085
- for (const stageCompletion of Object.values(completedStagesMapping)) {
1086
- const { asset, stage, submitted_at } = stageCompletion;
1087
- if (!completedStagesByAsset[asset])
1088
- completedStagesByAsset[asset] = {};
1089
- completedStagesByAsset[asset][stage] = submitted_at;
1090
- }
1091
- return completedStagesByAsset;
1092
- }
1093
- );
1094
1073
  const selectCompletedStageIdsForAsset = restructureCreateSelectorWithArgs(
1095
- toolkit.createSelector(
1096
- [selectAssetStageCompletionMapping, (_state, asset) => asset],
1097
- (completedStages, asset) => {
1098
- return Object.keys(completedStages[asset.offline_id] ?? {});
1099
- }
1100
- )
1101
- );
1102
- const selectAssetStageCompletionById = (id) => (state) => {
1103
- return state.assetStageCompletionReducer.instances[id];
1104
- };
1105
- const selectAssetStageCompletionsByIds = restructureCreateSelectorWithArgs(
1106
- toolkit.createSelector(
1107
- [selectAssetStageCompletionMapping, (_, stageCompletionIds) => stageCompletionIds],
1108
- (stageCompletionMapping, stageCompletionIds) => {
1109
- const stageCompletionIdsSet = new Set(stageCompletionIds);
1110
- return fallbackToEmptyArray(
1111
- Object.values(stageCompletionMapping).filter(
1112
- (stageCompletion) => stageCompletionIdsSet.has(stageCompletion.offline_id)
1113
- )
1114
- );
1115
- }
1116
- )
1074
+ toolkit.createSelector([selectCompletedStages, (_state, asset) => asset], (completedStages, asset) => {
1075
+ return Object.keys(completedStages[asset.offline_id] ?? {});
1076
+ })
1117
1077
  );
1118
1078
  const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
1119
1079
  const assetStageAdapter = createModelAdapter((assetStage) => assetStage.offline_id);
@@ -1123,29 +1083,14 @@ var __publicField = (obj, key, value) => {
1123
1083
  initialState: initialState$w,
1124
1084
  extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
1125
1085
  reducers: {
1126
- initializeAssetStages: assetStageAdapter.initialize,
1127
- setAssetStage: assetStageAdapter.setOne,
1128
- setAssetStages: assetStageAdapter.setMany,
1129
- addAssetStage: assetStageAdapter.addOne,
1130
- addAssetStages: assetStageAdapter.addMany,
1131
- updateAssetStage: assetStageAdapter.updateOne,
1132
- updateAssetStages: assetStageAdapter.updateMany,
1133
- deleteAssetStage: assetStageAdapter.deleteOne,
1134
- deleteAssetStages: assetStageAdapter.deleteMany
1086
+ initializeStages: assetStageAdapter.initialize,
1087
+ setStage: assetStageAdapter.setOne,
1088
+ addStages: assetStageAdapter.addMany,
1089
+ updateStage: assetStageAdapter.updateOne,
1090
+ updateStages: assetStageAdapter.updateMany,
1091
+ removeStages: assetStageAdapter.deleteMany
1135
1092
  }
1136
1093
  });
1137
- const {
1138
- initializeAssetStages,
1139
- setAssetStage,
1140
- setAssetStages,
1141
- addAssetStage,
1142
- addAssetStages,
1143
- updateAssetStage,
1144
- updateAssetStages,
1145
- deleteAssetStage,
1146
- deleteAssetStages
1147
- } = assetStageSlice.actions;
1148
- const assetStageReducer = assetStageSlice.reducer;
1149
1094
  const selectStageMapping = (state) => state.assetStageReducer.instances;
1150
1095
  const selectAssetStageById = (id) => (state) => {
1151
1096
  return state.assetStageReducer.instances[id];
@@ -1153,6 +1098,24 @@ var __publicField = (obj, key, value) => {
1153
1098
  const selectAssetStages = toolkit.createSelector([selectStageMapping], (stageMapping) => {
1154
1099
  return Object.values(stageMapping);
1155
1100
  });
1101
+ const selectStagesFromAssetTypeIds = restructureCreateSelectorWithArgs(
1102
+ toolkit.createSelector([selectAssetStages, (_state, assetTypeIds) => assetTypeIds], (stages, assetTypeIds) => {
1103
+ const assetTypeIdsSet = new Set(assetTypeIds);
1104
+ const ret = {};
1105
+ for (const stage of stages) {
1106
+ if (assetTypeIdsSet.has(stage.asset_type)) {
1107
+ if (!ret[stage.asset_type]) {
1108
+ ret[stage.asset_type] = [];
1109
+ }
1110
+ ret[stage.asset_type].push(stage);
1111
+ }
1112
+ }
1113
+ for (const key in ret) {
1114
+ ret[key] = ret[key].sort((a, b) => a.priority - b.priority);
1115
+ }
1116
+ return ret;
1117
+ })
1118
+ );
1156
1119
  const selectAssetTypeStagesMapping = restructureCreateSelectorWithArgs(
1157
1120
  toolkit.createSelector([selectStageMapping, (_state, assetTypeId) => assetTypeId], (stagesMapping, assetTypeId) => {
1158
1121
  const assetTypeStagesMapping = {};
@@ -1200,6 +1163,8 @@ var __publicField = (obj, key, value) => {
1200
1163
  return ret;
1201
1164
  })
1202
1165
  );
1166
+ const { initializeStages, setStage, addStages, updateStages, removeStages, updateStage } = assetStageSlice.actions;
1167
+ const assetStageReducer = assetStageSlice.reducer;
1203
1168
  const assetTypeAdapter = createModelAdapter((assetType) => assetType.offline_id);
1204
1169
  const initialState$v = assetTypeAdapter.getInitialState({});
1205
1170
  const assetTypeSlice = toolkit.createSlice({
@@ -1208,27 +1173,11 @@ var __publicField = (obj, key, value) => {
1208
1173
  extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
1209
1174
  reducers: {
1210
1175
  initializeAssetTypes: assetTypeAdapter.initialize,
1211
- setAssetType: assetTypeAdapter.setOne,
1212
- setAssetTypes: assetTypeAdapter.setMany,
1213
1176
  addAssetType: assetTypeAdapter.addOne,
1214
- addAssetTypes: assetTypeAdapter.addMany,
1215
- updateAssetType: assetTypeAdapter.updateOne,
1216
- updateAssetTypes: assetTypeAdapter.updateMany,
1217
- deleteAssetType: assetTypeAdapter.deleteOne,
1218
- deleteAssetTypes: assetTypeAdapter.deleteMany
1177
+ deleteAssetType: assetTypeAdapter.deleteOne
1219
1178
  }
1220
1179
  });
1221
- const {
1222
- initializeAssetTypes,
1223
- setAssetType,
1224
- setAssetTypes,
1225
- addAssetType,
1226
- addAssetTypes,
1227
- updateAssetType,
1228
- updateAssetTypes,
1229
- deleteAssetType,
1230
- deleteAssetTypes
1231
- } = assetTypeSlice.actions;
1180
+ const { addAssetType, initializeAssetTypes, deleteAssetType } = assetTypeSlice.actions;
1232
1181
  const selectAssetTypesMapping = (state) => state.assetTypeReducer.instances;
1233
1182
  const selectAssetTypes = toolkit.createSelector(
1234
1183
  [selectAssetTypesMapping],
@@ -1616,14 +1565,63 @@ var __publicField = (obj, key, value) => {
1616
1565
  return url;
1617
1566
  };
1618
1567
  const fileReducer = fileSlice.reducer;
1568
+ var ProjectAccessLevel = /* @__PURE__ */ ((ProjectAccessLevel2) => {
1569
+ ProjectAccessLevel2[ProjectAccessLevel2["BASIC"] = 0] = "BASIC";
1570
+ ProjectAccessLevel2[ProjectAccessLevel2["ADMIN"] = 2] = "ADMIN";
1571
+ return ProjectAccessLevel2;
1572
+ })(ProjectAccessLevel || {});
1573
+ var OrganizationAccessLevel = /* @__PURE__ */ ((OrganizationAccessLevel2) => {
1574
+ OrganizationAccessLevel2[OrganizationAccessLevel2["BASIC"] = 0] = "BASIC";
1575
+ OrganizationAccessLevel2[OrganizationAccessLevel2["ADMIN"] = 2] = "ADMIN";
1576
+ return OrganizationAccessLevel2;
1577
+ })(OrganizationAccessLevel || {});
1578
+ var AttachmentModel = /* @__PURE__ */ ((AttachmentModel2) => {
1579
+ AttachmentModel2["Issue"] = "issue";
1580
+ AttachmentModel2["Asset"] = "asset";
1581
+ AttachmentModel2["AssetType"] = "asset_type";
1582
+ AttachmentModel2["Project"] = "project";
1583
+ AttachmentModel2["Document"] = "document";
1584
+ return AttachmentModel2;
1585
+ })(AttachmentModel || {});
1586
+ var IssueUpdateChange = /* @__PURE__ */ ((IssueUpdateChange2) => {
1587
+ IssueUpdateChange2["STATUS"] = "status";
1588
+ IssueUpdateChange2["PRIORITY"] = "priority";
1589
+ IssueUpdateChange2["CATEGORY"] = "category";
1590
+ IssueUpdateChange2["DESCRIPTION"] = "description";
1591
+ IssueUpdateChange2["TITLE"] = "title";
1592
+ IssueUpdateChange2["ASSIGNED_TO"] = "assigned_to";
1593
+ IssueUpdateChange2["DUE_DATE"] = "due_date";
1594
+ return IssueUpdateChange2;
1595
+ })(IssueUpdateChange || {});
1596
+ var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
1597
+ VerificationCodeType2[VerificationCodeType2["USER_REGISTRATION"] = 0] = "USER_REGISTRATION";
1598
+ VerificationCodeType2[VerificationCodeType2["APPLICATION_INVITE"] = 2] = "APPLICATION_INVITE";
1599
+ VerificationCodeType2[VerificationCodeType2["PROJECT_INVITE"] = 4] = "PROJECT_INVITE";
1600
+ VerificationCodeType2[VerificationCodeType2["ORGANIZATION_INVITE"] = 6] = "ORGANIZATION_INVITE";
1601
+ VerificationCodeType2[VerificationCodeType2["ADD_EMAIL_DOMAIN"] = 8] = "ADD_EMAIL_DOMAIN";
1602
+ VerificationCodeType2[VerificationCodeType2["RESET_PASSWORD"] = 10] = "RESET_PASSWORD";
1603
+ return VerificationCodeType2;
1604
+ })(VerificationCodeType || {});
1605
+ var PaddleCheckoutEvent = /* @__PURE__ */ ((PaddleCheckoutEvent2) => {
1606
+ PaddleCheckoutEvent2["COMPLETED"] = "checkout.completed";
1607
+ PaddleCheckoutEvent2["CLOSED"] = "checkout.closed";
1608
+ return PaddleCheckoutEvent2;
1609
+ })(PaddleCheckoutEvent || {});
1610
+ var LicenseLevel = /* @__PURE__ */ ((LicenseLevel2) => {
1611
+ LicenseLevel2[LicenseLevel2["PRO"] = 0] = "PRO";
1612
+ return LicenseLevel2;
1613
+ })(LicenseLevel || {});
1614
+ var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
1615
+ LicenseStatus2[LicenseStatus2["ACTIVE"] = 0] = "ACTIVE";
1616
+ LicenseStatus2[LicenseStatus2["PAUSED"] = 2] = "PAUSED";
1617
+ LicenseStatus2[LicenseStatus2["CANCELLED"] = 4] = "CANCELLED";
1618
+ LicenseStatus2[LicenseStatus2["INACTIVE"] = 6] = "INACTIVE";
1619
+ LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
1620
+ return LicenseStatus2;
1621
+ })(LicenseStatus || {});
1619
1622
  const initialState$p = {
1620
1623
  users: {},
1621
- currentUser: {
1622
- id: 0,
1623
- username: "",
1624
- email: "",
1625
- profile: { file: null, file_sha1: null, favourite_project_ids: [], tour_step: -1 }
1626
- }
1624
+ currentUser: null
1627
1625
  };
1628
1626
  const userSlice = toolkit.createSlice({
1629
1627
  name: "users",
@@ -1646,6 +1644,8 @@ var __publicField = (obj, key, value) => {
1646
1644
  state.currentUser = action.payload;
1647
1645
  },
1648
1646
  setProfilePicture: (state, action) => {
1647
+ if (!state.currentUser)
1648
+ return;
1649
1649
  state.currentUser.profile.file = action.payload.file ?? null;
1650
1650
  state.currentUser.profile.file_sha1 = action.payload.file_sha1 ?? null;
1651
1651
  const currentUser = state.users[state.currentUser.id];
@@ -1655,32 +1655,12 @@ var __publicField = (obj, key, value) => {
1655
1655
  currentUser.profile.file = action.payload.file ?? null;
1656
1656
  currentUser.profile.file_sha1 = action.payload.file_sha1 ?? null;
1657
1657
  },
1658
- addFavouriteProjectId: (state, action) => {
1659
- state.currentUser.profile.favourite_project_ids.push(action.payload);
1660
- },
1661
- removeFavouriteProjectId: (state, action) => {
1662
- state.currentUser.profile.favourite_project_ids = state.currentUser.profile.favourite_project_ids.filter(
1663
- (id) => id !== action.payload
1664
- );
1665
- },
1666
- setTourStep: (state, action) => {
1667
- state.currentUser.profile.tour_step = action.payload;
1668
- },
1669
1658
  removeUser: (state, action) => {
1670
1659
  delete state.users[action.payload];
1671
1660
  }
1672
1661
  }
1673
1662
  });
1674
- const {
1675
- setCurrentUser,
1676
- setProfilePicture,
1677
- setUsers,
1678
- addUsers,
1679
- addFavouriteProjectId,
1680
- removeFavouriteProjectId,
1681
- setTourStep,
1682
- removeUser
1683
- } = userSlice.actions;
1663
+ const { setCurrentUser, setProfilePicture, setUsers, addUsers, removeUser } = userSlice.actions;
1684
1664
  const userReducer = userSlice.reducer;
1685
1665
  const selectCurrentUser = (state) => state.userReducer.currentUser;
1686
1666
  const selectUsersMapping = (state) => state.userReducer.users;
@@ -1701,7 +1681,6 @@ var __publicField = (obj, key, value) => {
1701
1681
  return fallbackToEmptyArray(users);
1702
1682
  })
1703
1683
  );
1704
- const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
1705
1684
  const organizationAccessAdapter = createModelAdapter(
1706
1685
  (organizationAccess) => organizationAccess.offline_id
1707
1686
  );
@@ -1727,7 +1706,7 @@ var __publicField = (obj, key, value) => {
1727
1706
  [selectCurrentUser, selectOrganizationAccesses],
1728
1707
  (currentUser, organizationAccesses) => {
1729
1708
  const activeOrganizationAccess = Object.values(organizationAccesses).find(
1730
- (organizationAccess) => organizationAccess.user === currentUser.id
1709
+ (organizationAccess) => organizationAccess.user === (currentUser == null ? void 0 : currentUser.id)
1731
1710
  );
1732
1711
  return activeOrganizationAccess ?? null;
1733
1712
  }
@@ -1917,9 +1896,9 @@ var __publicField = (obj, key, value) => {
1917
1896
  [selectCurrentUser, selectProjectUsersAsMapping, selectProjectAccessUserMapping],
1918
1897
  (currentUser, userMapping, projectAccessMapping) => {
1919
1898
  return Object.values(userMapping).sort((userA, userB) => {
1920
- if (userA.id === currentUser.id) {
1899
+ if (userA.id === (currentUser == null ? void 0 : currentUser.id)) {
1921
1900
  return -1;
1922
- } else if (userB.id === currentUser.id) {
1901
+ } else if (userB.id === (currentUser == null ? void 0 : currentUser.id)) {
1923
1902
  return 1;
1924
1903
  }
1925
1904
  const projectAccessesA = projectAccessMapping[userA.id];
@@ -1996,9 +1975,9 @@ var __publicField = (obj, key, value) => {
1996
1975
  [selectCurrentUser, selectOrganizationUsersAsMapping, selectOrganizationAccessUserMapping],
1997
1976
  (currentUser, userMapping, organizationAccessMapping) => {
1998
1977
  return Object.values(userMapping).sort((userA, userB) => {
1999
- if (userA.id === currentUser.id) {
1978
+ if (userA.id === (currentUser == null ? void 0 : currentUser.id)) {
2000
1979
  return -1;
2001
- } else if (userB.id === currentUser.id) {
1980
+ } else if (userB.id === (currentUser == null ? void 0 : currentUser.id)) {
2002
1981
  return 1;
2003
1982
  }
2004
1983
  const organizationAccessesA = organizationAccessMapping[userA.id];
@@ -4157,70 +4136,42 @@ var __publicField = (obj, key, value) => {
4157
4136
  }
4158
4137
  class AssetService extends BaseApiService {
4159
4138
  // Basic CRUD functions
4160
- add(payload) {
4161
- const { store } = this.client;
4162
- if (!payload.canvas_marker && !payload.geo_marker) {
4139
+ add(asset, workspaceId) {
4140
+ if (!asset.canvas_marker && !asset.geo_marker) {
4163
4141
  throw new Error("Asset must have either a canvas_marker or geo_marker");
4164
4142
  }
4165
- const createdBy = store.getState().userReducer.currentUser.id;
4166
- const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4167
- const offlineAsset = offline({
4168
- ...payload,
4169
- created_by: createdBy,
4170
- submitted_at: submittedAt
4171
- });
4143
+ const offlineAsset = offline(asset);
4172
4144
  this.dispatch(addAsset(offlineAsset));
4173
4145
  const promise = this.enqueueRequest({
4174
4146
  description: "Create asset",
4175
4147
  method: HttpMethod.POST,
4176
- url: "/assets/",
4177
- payload: {
4178
- offline_id: offlineAsset.offline_id,
4179
- submitted_at: offlineAsset.submitted_at,
4180
- geo_marker: offlineAsset.geo_marker,
4181
- canvas_marker: offlineAsset.canvas_marker,
4182
- label: offlineAsset.label,
4183
- description: offlineAsset.description,
4184
- asset_type: offlineAsset.asset_type
4148
+ url: `/assets/types/${offlineAsset.asset_type}/add-assets/`,
4149
+ queryParams: {
4150
+ workspace_id: workspaceId.toString()
4185
4151
  },
4186
- blockers: [offlineAsset.asset_type],
4152
+ payload: { assets: [offlineAsset] },
4153
+ blockers: [],
4187
4154
  blocks: [offlineAsset.offline_id]
4188
4155
  });
4189
- promise.then((createdAsset) => {
4190
- this.dispatch(updateAsset(createdAsset));
4191
- }).catch(() => {
4192
- this.dispatch(deleteAsset(offlineAsset.offline_id));
4193
- });
4194
4156
  return [offlineAsset, promise];
4195
4157
  }
4196
- update(payload) {
4197
- const { store } = this.client;
4198
- if (!payload.canvas_marker && !payload.geo_marker) {
4158
+ update(asset, workspaceId) {
4159
+ if (!asset.canvas_marker && !asset.geo_marker) {
4199
4160
  throw new Error("Asset must have either a canvas_marker or geo_marker");
4200
4161
  }
4201
- const asset = selectAssetById(payload.offline_id)(store.getState());
4202
- if (!asset) {
4203
- throw new Error(`No asset with id ${payload.offline_id} found in the store`);
4204
- }
4205
- const updatedAsset = {
4206
- ...asset,
4207
- ...payload
4208
- };
4209
- this.dispatch(updateAsset(updatedAsset));
4162
+ this.client.store.dispatch(updateAsset(asset));
4210
4163
  const promise = this.enqueueRequest({
4211
4164
  description: "Edit asset",
4212
4165
  method: HttpMethod.PATCH,
4213
- url: `/assets/${payload.offline_id}/`,
4214
- payload,
4215
- blockers: [payload.offline_id],
4216
- blocks: [payload.offline_id]
4217
- });
4218
- promise.then((result) => {
4219
- this.dispatch(updateAsset(result));
4220
- }).catch(() => {
4221
- this.dispatch(updateAsset(asset));
4166
+ url: `/assets/${asset.offline_id}/`,
4167
+ queryParams: {
4168
+ workspace_id: workspaceId.toString()
4169
+ },
4170
+ payload: asset,
4171
+ blockers: [asset.offline_id],
4172
+ blocks: [asset.offline_id]
4222
4173
  });
4223
- return [updatedAsset, promise];
4174
+ return [asset, promise];
4224
4175
  }
4225
4176
  async remove(assetId) {
4226
4177
  const { store } = this.client;
@@ -4258,17 +4209,39 @@ var __publicField = (obj, key, value) => {
4258
4209
  throw err;
4259
4210
  });
4260
4211
  }
4261
- bulkAdd(payloads, assetTypeId, batchSize) {
4212
+ async deleteAllAssetsOfAssetType(assetTypeId) {
4213
+ const { store } = this.client;
4214
+ const state = store.getState();
4215
+ const allAssetsOfAssetType = selectAssetsOfAssetType(assetTypeId)(state);
4216
+ const allAssetsOfAssetTypeIds = allAssetsOfAssetType.map((c) => c.offline_id);
4217
+ const affectedOfflineIds = [assetTypeId, ...allAssetsOfAssetTypeIds];
4218
+ store.dispatch(deleteAssets(allAssetsOfAssetTypeIds));
4219
+ return this.enqueueRequest({
4220
+ description: "Delete all assets of asset type",
4221
+ method: HttpMethod.DELETE,
4222
+ url: `/assets/types/${assetTypeId}/delete-all-of-type/`,
4223
+ blockers: affectedOfflineIds,
4224
+ blocks: affectedOfflineIds
4225
+ }).catch((err) => {
4226
+ store.dispatch(addAssets(allAssetsOfAssetType));
4227
+ throw err;
4228
+ });
4229
+ }
4230
+ // TODO: payload does not require asset_type
4231
+ bulkAdd(assetsToCreate, workspaceId, assetTypeId, batchSize) {
4262
4232
  const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4263
4233
  const transactionId = uuid.v4();
4264
- const assetBatches = chunkArray(payloads, batchSize).map((assetBatch) => {
4265
- const assetPayloads = assetBatch.map((assetPayload) => offline(assetPayload));
4234
+ const assetBatches = chunkArray(assetsToCreate, batchSize).map((assetBatch) => {
4235
+ const assetPayloads = assetBatch.map((assetPayload) => {
4236
+ return offline({
4237
+ ...assetPayload,
4238
+ submitted_at: submittedAt
4239
+ });
4240
+ });
4266
4241
  return {
4267
4242
  batchId: uuid.v4(),
4268
4243
  payload: {
4269
4244
  transaction_id: transactionId,
4270
- submitted_at: submittedAt,
4271
- asset_type: assetTypeId,
4272
4245
  assets: assetPayloads
4273
4246
  }
4274
4247
  };
@@ -4286,7 +4259,10 @@ var __publicField = (obj, key, value) => {
4286
4259
  const promise = this.enqueueRequest({
4287
4260
  description: "Batch create assets",
4288
4261
  method: HttpMethod.POST,
4289
- url: "/assets/bulk/",
4262
+ url: `/assets/types/${assetTypeId}/add-assets/`,
4263
+ queryParams: {
4264
+ workspace_id: workspaceId.toString()
4265
+ },
4290
4266
  payload,
4291
4267
  blockers,
4292
4268
  blocks: blocks2
@@ -4312,152 +4288,117 @@ var __publicField = (obj, key, value) => {
4312
4288
  }
4313
4289
  }
4314
4290
  class AssetStageCompletionService extends BaseApiService {
4315
- add(payload) {
4291
+ add(assetId, stageId) {
4292
+ var _a2;
4316
4293
  const { store } = this.client;
4317
- const createdBy = store.getState().userReducer.currentUser.id;
4318
- const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4294
+ const assetTypeId = (_a2 = selectAssetById(assetId)(store.getState())) == null ? void 0 : _a2.asset_type;
4295
+ if (!assetTypeId) {
4296
+ throw new Error(`Asset with offline_id ${assetId} not found`);
4297
+ }
4319
4298
  const offlineStageCompletion = offline({
4320
- ...payload,
4321
- created_by: createdBy,
4322
- submitted_at: submittedAt
4299
+ asset: assetId,
4300
+ stage: stageId
4323
4301
  });
4324
- this.dispatch(addAssetStageCompletion(offlineStageCompletion));
4302
+ this.dispatch(addStageCompletion(offlineStageCompletion));
4325
4303
  const promise = this.enqueueRequest({
4326
- description: "Add asset stage completion",
4304
+ description: "Complete stage",
4327
4305
  method: HttpMethod.POST,
4328
- url: "/assets/completions/",
4329
- payload: {
4330
- offline_id: offlineStageCompletion.offline_id,
4331
- submitted_at: submittedAt,
4332
- asset: payload.asset,
4333
- stage: payload.stage
4334
- },
4335
- blockers: [payload.asset, payload.stage],
4306
+ url: `/assets/types/${assetTypeId}/complete-stages/`,
4307
+ // TODO: Add submitted_at to model
4308
+ payload: { completions: [{ ...offlineStageCompletion, submitted_at: (/* @__PURE__ */ new Date()).getTime() / 1e3 }] },
4309
+ blockers: [assetId, stageId],
4336
4310
  blocks: [offlineStageCompletion.offline_id]
4337
4311
  });
4338
- promise.then((result) => {
4339
- this.dispatch(updateAssetStageCompletion(result));
4340
- }).catch(() => {
4341
- this.dispatch(deleteAssetStageCompletion(offlineStageCompletion.offline_id));
4342
- });
4343
4312
  return [offlineStageCompletion, promise];
4344
4313
  }
4345
- delete(id) {
4346
- const { store } = this.client;
4347
- const assetStageCompletion = selectAssetStageCompletionById(id)(store.getState());
4348
- if (!assetStageCompletion) {
4349
- throw new Error(`Expected asset stage completion with id ${id} to exist`);
4350
- }
4351
- this.dispatch(deleteAssetStageCompletion(id));
4352
- const promise = this.enqueueRequest({
4353
- description: "Delete asset stage completion",
4354
- method: HttpMethod.DELETE,
4355
- url: `/assets/completions/${id}/`,
4356
- blockers: [id],
4314
+ async refreshStore(projectId) {
4315
+ const result = await this.enqueueRequest({
4316
+ description: "Get stage completions",
4317
+ method: HttpMethod.GET,
4318
+ url: `/projects/${projectId}/asset-stage-completions/`,
4319
+ blockers: [],
4357
4320
  blocks: []
4358
4321
  });
4359
- promise.catch(() => {
4360
- this.dispatch(addAssetStageCompletion(assetStageCompletion));
4361
- });
4362
- return promise;
4322
+ this.dispatch(addStageCompletions(result));
4363
4323
  }
4364
- bulkAdd(payloads) {
4365
- const { store } = this.client;
4366
- const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4367
- const createdBy = store.getState().userReducer.currentUser.id;
4368
- const payload = payloads.map((payload2) => offline(payload2));
4369
- const offlineStageCompletions = payload.map((completion) => {
4370
- return {
4371
- ...completion,
4372
- created_by: createdBy,
4373
- submitted_at: submittedAt
4374
- };
4375
- });
4376
- const offlineIds = offlineStageCompletions.map(({ offline_id }) => offline_id);
4377
- this.dispatch(addAssetStageCompletions(offlineStageCompletions));
4378
- const promise = this.enqueueRequest({
4379
- description: "Bulk create asset stage completions",
4324
+ /**
4325
+ * Creates a collection of AssetStageCompletions, marking the referenced stages as completed for the referenced
4326
+ * assets. It's REQUIRED that all assets referenced all have the SAME asset type.
4327
+ * @param assetTypeId The ID of the asset type for which we are completing stages (we can only complete
4328
+ * stages for one asset type at a time)
4329
+ * @param stageCompletions
4330
+ */
4331
+ async bulkAdd(assetTypeId, stageCompletions) {
4332
+ const offlineStageCompletions = stageCompletions.map((completion) => {
4333
+ return offline(completion);
4334
+ });
4335
+ const asMapping = {};
4336
+ for (const completion of stageCompletions) {
4337
+ const stageToCompletionDateMapping = asMapping[completion.asset] || {};
4338
+ stageToCompletionDateMapping[completion.stage] = (/* @__PURE__ */ new Date()).toISOString();
4339
+ asMapping[completion.asset] = stageToCompletionDateMapping;
4340
+ }
4341
+ this.dispatch(addStageCompletions(asMapping));
4342
+ await this.enqueueRequest({
4343
+ description: "Bulk complete stages",
4380
4344
  method: HttpMethod.POST,
4381
- url: "/assets/completions/bulk/",
4345
+ url: `/assets/types/${assetTypeId}/complete-stages/`,
4382
4346
  payload: {
4383
- submitted_at: submittedAt,
4384
- completions: payload
4347
+ completions: offlineStageCompletions
4385
4348
  },
4386
- blockers: [...payloads.map((c) => c.asset), ...payloads.map((c) => c.stage)],
4387
- blocks: offlineIds
4388
- });
4389
- promise.then((result) => {
4390
- this.dispatch(updateAssetStageCompletions(result));
4391
- }).catch(() => {
4392
- this.dispatch(deleteAssetStageCompletions(offlineIds));
4349
+ blockers: [assetTypeId, ...stageCompletions.map((c) => c.asset), ...stageCompletions.map((c) => c.stage)],
4350
+ blocks: offlineStageCompletions.map((c) => c.offline_id)
4393
4351
  });
4394
- return [offlineStageCompletions, promise];
4395
4352
  }
4396
- bulkDelete(ids) {
4397
- const { store } = this.client;
4398
- const assetStageCompletions = selectAssetStageCompletionsByIds(ids)(store.getState());
4399
- this.dispatch(deleteAssetStageCompletions(ids));
4400
- const promise = this.enqueueRequest({
4401
- description: "Deleting asset stage completions",
4353
+ bulkDelete(stageId, assetIds) {
4354
+ const stageCompletionsToRemove = assetIds.map((assetId) => {
4355
+ return {
4356
+ asset: assetId,
4357
+ stage: stageId
4358
+ };
4359
+ });
4360
+ this.dispatch(removeStageCompletions(stageCompletionsToRemove));
4361
+ return this.enqueueRequest({
4362
+ description: `Undo stage for ${assetIds.length} assets(s)`,
4363
+ // TODO: Rename to setCompletedStages
4402
4364
  method: HttpMethod.DELETE,
4403
- url: "/assets/completions/bulk/",
4365
+ url: `/assets/stages/${stageId}/undo-stages/`,
4404
4366
  payload: {
4405
- completion_ids: ids
4367
+ assets: assetIds
4406
4368
  },
4407
- blockers: ids,
4408
- blocks: []
4409
- });
4410
- promise.catch(() => {
4411
- this.dispatch(addAssetStageCompletions(assetStageCompletions));
4412
- });
4413
- return promise;
4414
- }
4415
- async refreshStore(projectId) {
4416
- const result = await this.enqueueRequest({
4417
- description: "Get asset stage completions",
4418
- method: HttpMethod.GET,
4419
- url: `/projects/${projectId}/asset-stage-completions/`,
4420
- blockers: [],
4369
+ blockers: [stageId, ...assetIds],
4421
4370
  blocks: []
4422
4371
  });
4423
- this.dispatch(initializeAssetStageCompletions(result));
4424
4372
  }
4425
4373
  }
4426
4374
  class AssetStageService extends BaseApiService {
4427
- bulkAdd(stagesToSubmit, assetTypeId) {
4428
- const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4429
- const createdBy = this.client.store.getState().userReducer.currentUser.id;
4375
+ async bulkCreateStages(stagesToSubmit, assetTypeId, workspaceId) {
4430
4376
  const payload = stagesToSubmit.map((stage) => {
4431
4377
  return offline(stage);
4432
4378
  });
4433
- const offlineStages = payload.map((stage) => {
4434
- return { ...stage, asset_type: assetTypeId, created_by: createdBy, submitted_at: submittedAt };
4379
+ const fullStages = payload.map((stage) => {
4380
+ return { ...stage, asset_type: assetTypeId };
4435
4381
  });
4436
- this.dispatch(addAssetStages(offlineStages));
4437
- const promise = this.enqueueRequest({
4382
+ this.dispatch(addStages(fullStages));
4383
+ return this.enqueueRequest({
4438
4384
  description: "Add asset stages",
4439
4385
  method: HttpMethod.POST,
4440
- url: "/assets/stages/bulk/",
4386
+ url: `/assets/types/${assetTypeId}/add-stages/`,
4441
4387
  payload: {
4442
- submitted_at: submittedAt,
4443
- asset_type: assetTypeId,
4444
4388
  stages: payload
4445
4389
  },
4446
- blockers: [assetTypeId],
4390
+ queryParams: {
4391
+ workspace_id: workspaceId.toString()
4392
+ },
4393
+ blockers: [assetTypeId, workspaceId],
4447
4394
  blocks: payload.map(({ offline_id }) => offline_id)
4448
4395
  });
4449
- promise.then((result) => {
4450
- this.dispatch(updateAssetStages(result));
4451
- }).catch(() => {
4452
- this.dispatch(deleteAssetStages(offlineStages.map(({ offline_id }) => offline_id)));
4453
- });
4454
- return [offlineStages, promise];
4455
4396
  }
4456
- async bulkUpdate(stagesToUpdate, assetTypeId) {
4397
+ async bulkUpdateStages(stagesToUpdate, assetTypeId) {
4457
4398
  const store = this.client.store;
4458
4399
  const state = store.getState();
4459
4400
  const prevStages = selectAssetStagesByIds(stagesToUpdate.map(({ offline_id }) => offline_id))(state);
4460
- this.dispatch(updateAssetStages(stagesToUpdate));
4401
+ this.dispatch(updateStages(stagesToUpdate));
4461
4402
  return this.enqueueRequest({
4462
4403
  description: "Edit asset stages",
4463
4404
  method: HttpMethod.PATCH,
@@ -4468,58 +4409,33 @@ var __publicField = (obj, key, value) => {
4468
4409
  blockers: [assetTypeId],
4469
4410
  blocks: stagesToUpdate.map(({ offline_id }) => offline_id)
4470
4411
  }).catch((e) => {
4471
- this.dispatch(updateAssetStages(prevStages));
4412
+ store.dispatch(updateStages(prevStages));
4472
4413
  throw e;
4473
4414
  });
4474
4415
  }
4475
4416
  async bulkDelete(idsToDelete) {
4476
- const { store } = this.client;
4477
- const assetStages = selectAssetStagesByIds(idsToDelete)(store.getState());
4478
- this.dispatch(deleteAssetStages(idsToDelete));
4479
- const promise = this.enqueueRequest({
4417
+ this.dispatch(removeStages(idsToDelete));
4418
+ return this.enqueueRequest({
4480
4419
  description: "Delete asset stages",
4481
4420
  method: HttpMethod.DELETE,
4482
- url: "/assets/stages/bulk/",
4421
+ url: "/assets/stages/bulk-delete/",
4483
4422
  payload: {
4484
4423
  stage_ids: idsToDelete
4485
4424
  },
4486
4425
  blockers: idsToDelete,
4487
4426
  blocks: []
4488
4427
  });
4489
- promise.catch(() => {
4490
- this.dispatch(addAssetStages(assetStages));
4491
- });
4492
- return promise;
4493
4428
  }
4494
- update(payload) {
4495
- const { store } = this.client;
4496
- const assetStage = selectAssetStageById(payload.offline_id)(store.getState());
4497
- if (!assetStage)
4498
- throw new Error(`No asset stage with id ${payload.offline_id} found in the store`);
4499
- const updatedAssetStage = {
4500
- ...assetStage,
4501
- ...payload
4502
- };
4503
- this.dispatch(updateAssetStage(updatedAssetStage));
4504
- const promise = this.enqueueRequest({
4429
+ async update(assetStage) {
4430
+ this.dispatch(addStages([assetStage]));
4431
+ return this.enqueueRequest({
4505
4432
  description: "Update asset stage",
4506
4433
  method: HttpMethod.PATCH,
4507
4434
  url: `/assets/stages/${assetStage.offline_id}/`,
4508
- payload: {
4509
- name: payload.name,
4510
- description: payload.description,
4511
- priority: payload.priority,
4512
- color: payload.color
4513
- },
4435
+ payload: assetStage,
4514
4436
  blockers: [assetStage.offline_id],
4515
4437
  blocks: [assetStage.offline_id]
4516
4438
  });
4517
- promise.then((result) => {
4518
- this.dispatch(updateAssetStage(result));
4519
- }).catch(() => {
4520
- this.dispatch(setAssetStage(assetStage));
4521
- });
4522
- return [updatedAssetStage, promise];
4523
4439
  }
4524
4440
  async linkForm(stageId, formId) {
4525
4441
  const { store } = this.client;
@@ -4527,7 +4443,7 @@ var __publicField = (obj, key, value) => {
4527
4443
  if (!stage) {
4528
4444
  throw new Error(`No asset stage with id ${stageId} found in the store`);
4529
4445
  }
4530
- this.dispatch(updateAssetStage({ ...stage, form: formId }));
4446
+ this.dispatch(updateStage({ ...stage, form: formId }));
4531
4447
  try {
4532
4448
  await this.enqueueRequest({
4533
4449
  description: "Link asset stage to form",
@@ -4538,7 +4454,7 @@ var __publicField = (obj, key, value) => {
4538
4454
  blocks: [stageId]
4539
4455
  });
4540
4456
  } catch (e) {
4541
- this.dispatch(setAssetStage(stage));
4457
+ this.dispatch(setStage(stage));
4542
4458
  throw e;
4543
4459
  }
4544
4460
  }
@@ -4548,7 +4464,7 @@ var __publicField = (obj, key, value) => {
4548
4464
  if (!stage) {
4549
4465
  throw new Error(`No asset stage with id ${stageId} found in the store`);
4550
4466
  }
4551
- this.dispatch(updateAssetStage({ ...stage, form: void 0 }));
4467
+ this.dispatch(updateStage({ ...stage, form: void 0 }));
4552
4468
  try {
4553
4469
  await this.enqueueRequest({
4554
4470
  description: "Unlink asset stage from form",
@@ -4558,7 +4474,7 @@ var __publicField = (obj, key, value) => {
4558
4474
  blocks: [stageId]
4559
4475
  });
4560
4476
  } catch (e) {
4561
- this.dispatch(setAssetStage(stage));
4477
+ this.dispatch(setStage(stage));
4562
4478
  throw e;
4563
4479
  }
4564
4480
  }
@@ -4570,7 +4486,7 @@ var __publicField = (obj, key, value) => {
4570
4486
  blockers: [],
4571
4487
  blocks: []
4572
4488
  });
4573
- this.dispatch(initializeAssetStages(result));
4489
+ this.dispatch(initializeStages(result));
4574
4490
  }
4575
4491
  }
4576
4492
  class BaseUploadService extends BaseApiService {
@@ -4777,61 +4693,29 @@ var __publicField = (obj, key, value) => {
4777
4693
  }
4778
4694
  }
4779
4695
  class AssetTypeService extends BaseApiService {
4780
- add(payload) {
4781
- const { store } = this.client;
4782
- const createdBy = store.getState().userReducer.currentUser.id;
4783
- const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4784
- const offlineAssetType = offline({
4785
- ...payload,
4786
- created_by: createdBy,
4787
- submitted_at: submittedAt
4788
- });
4696
+ add(assetType) {
4697
+ const offlineAssetType = offline(assetType);
4789
4698
  this.dispatch(addAssetType(offlineAssetType));
4790
4699
  const promise = this.enqueueRequest({
4791
4700
  description: "Create asset type",
4792
4701
  method: HttpMethod.POST,
4793
- url: `/projects/${payload.project}/asset-types/`,
4702
+ url: `/projects/${assetType.project}/asset-types/`,
4794
4703
  payload: { ...offlineAssetType },
4795
4704
  blockers: [],
4796
4705
  blocks: [offlineAssetType.offline_id]
4797
4706
  });
4798
- promise.then((result) => {
4799
- this.dispatch(updateAssetType(result));
4800
- }).catch(() => {
4801
- this.dispatch(deleteAssetType(offlineAssetType.offline_id));
4802
- });
4803
4707
  return [offlineAssetType, promise];
4804
4708
  }
4805
- update(payload) {
4806
- const { store } = this.client;
4807
- const assetType = selectAssetTypeById(payload.offline_id)(store.getState());
4808
- if (!assetType) {
4809
- throw new Error(`Expected asset type with offline_id ${payload.offline_id} to exist`);
4810
- }
4811
- const updatedAssetType = {
4812
- ...assetType,
4813
- ...payload
4814
- };
4815
- this.dispatch(updateAssetType(updatedAssetType));
4816
- const promise = this.enqueueRequest({
4709
+ update(assetType) {
4710
+ this.dispatch(addAssetType(assetType));
4711
+ return this.enqueueRequest({
4817
4712
  description: "Update asset type",
4818
4713
  method: HttpMethod.PATCH,
4819
- url: `/assets/types/${payload.offline_id}/`,
4820
- payload: {
4821
- icon: payload.icon,
4822
- color: payload.color,
4823
- name: payload.name,
4824
- description: payload.description
4825
- },
4714
+ url: `/assets/types/${assetType.offline_id}/`,
4715
+ payload: assetType,
4826
4716
  blockers: [assetType.offline_id],
4827
4717
  blocks: [assetType.offline_id]
4828
4718
  });
4829
- promise.then((result) => {
4830
- this.dispatch(updateAssetType(result));
4831
- }).catch(() => {
4832
- this.dispatch(updateAssetType(assetType));
4833
- });
4834
- return [updatedAssetType, promise];
4835
4719
  }
4836
4720
  async delete(assetTypeId) {
4837
4721
  const { store } = this.client;
@@ -4840,13 +4724,17 @@ var __publicField = (obj, key, value) => {
4840
4724
  if (!assetType) {
4841
4725
  throw new Error(`Expected asset type with offline_id ${assetTypeId} to exist`);
4842
4726
  }
4843
- const assetsOfAssetType = selectAssetsOfAssetType(assetTypeId)(state);
4844
4727
  const stagesOfAssetType = selectStagesOfAssetType(assetTypeId)(state);
4845
4728
  const attachmentsOfAssetType = selectAttachmentsOfAssetType(assetTypeId)(state);
4846
4729
  this.dispatch(deleteAssetType(assetTypeId));
4847
- this.dispatch(deleteAssets(assetsOfAssetType.map((asset) => asset.offline_id)));
4848
- this.dispatch(deleteAssetStages(stagesOfAssetType.map((assetStage) => assetStage.offline_id)));
4849
- this.dispatch(deleteAssetTypeAttachments(attachmentsOfAssetType.map(({ offline_id }) => offline_id)));
4730
+ if (stagesOfAssetType.length > 0) {
4731
+ const stagesOfAssetTypeIds = stagesOfAssetType.map((assetStage) => assetStage.offline_id);
4732
+ this.dispatch(removeStages(stagesOfAssetTypeIds));
4733
+ }
4734
+ if (attachmentsOfAssetType.length > 0) {
4735
+ const attachmentsOfAssetTypeIds = attachmentsOfAssetType.map(({ offline_id }) => offline_id);
4736
+ this.dispatch(deleteAssetTypeAttachments(attachmentsOfAssetTypeIds));
4737
+ }
4850
4738
  return this.enqueueRequest({
4851
4739
  description: "Delete asset type",
4852
4740
  method: HttpMethod.DELETE,
@@ -4855,8 +4743,7 @@ var __publicField = (obj, key, value) => {
4855
4743
  blocks: []
4856
4744
  }).catch((e) => {
4857
4745
  this.dispatch(addAssetType(assetType));
4858
- this.dispatch(addAssets(assetsOfAssetType));
4859
- this.dispatch(addAssetStages(stagesOfAssetType));
4746
+ this.dispatch(addStages(stagesOfAssetType));
4860
4747
  this.dispatch(addAssetTypeAttachments(attachmentsOfAssetType));
4861
4748
  throw e;
4862
4749
  });
@@ -5070,6 +4957,15 @@ var __publicField = (obj, key, value) => {
5070
4957
  void promise.then((result) => {
5071
4958
  this.dispatch(updateIssue(result));
5072
4959
  }).catch((error) => {
4960
+ var _a2;
4961
+ console.error(error);
4962
+ if (error instanceof APIError) {
4963
+ (_a2 = blocks.unsafeShowToast) == null ? void 0 : _a2.call(blocks, {
4964
+ title: "Could not create issue",
4965
+ description: error.message,
4966
+ accentColor: "red"
4967
+ });
4968
+ }
5073
4969
  this.dispatch(deleteIssue(issuePayload.offline_id));
5074
4970
  this.dispatch(addActiveProjectIssuesCount(-1));
5075
4971
  throw error;
@@ -7625,19 +7521,11 @@ var __publicField = (obj, key, value) => {
7625
7521
  this.dispatch(initializeIssueAssociations(issueAssociations));
7626
7522
  }
7627
7523
  }
7628
- var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
7629
- VerificationCodeType2[VerificationCodeType2["USER_REGISTRATION"] = 0] = "USER_REGISTRATION";
7630
- VerificationCodeType2[VerificationCodeType2["APPLICATION_INVITE"] = 2] = "APPLICATION_INVITE";
7631
- VerificationCodeType2[VerificationCodeType2["PROJECT_INVITE"] = 4] = "PROJECT_INVITE";
7632
- VerificationCodeType2[VerificationCodeType2["ORGANIZATION_INVITE"] = 6] = "ORGANIZATION_INVITE";
7633
- VerificationCodeType2[VerificationCodeType2["ADD_EMAIL_DOMAIN"] = 8] = "ADD_EMAIL_DOMAIN";
7634
- VerificationCodeType2[VerificationCodeType2["RESET_PASSWORD"] = 10] = "RESET_PASSWORD";
7635
- return VerificationCodeType2;
7636
- })(VerificationCodeType || {});
7637
7524
  exports2.APIError = APIError;
7638
7525
  exports2.AgentService = AgentService;
7639
7526
  exports2.AssetAttachmentService = AssetAttachmentService;
7640
7527
  exports2.AssetService = AssetService;
7528
+ exports2.AssetStageColors = AssetStageColors;
7641
7529
  exports2.AssetStageCompletionService = AssetStageCompletionService;
7642
7530
  exports2.AssetStageService = AssetStageService;
7643
7531
  exports2.AssetTypeAttachmentService = AssetTypeAttachmentService;
@@ -7699,14 +7587,9 @@ var __publicField = (obj, key, value) => {
7699
7587
  exports2.addAsset = addAsset;
7700
7588
  exports2.addAssetAttachment = addAssetAttachment;
7701
7589
  exports2.addAssetAttachments = addAssetAttachments;
7702
- exports2.addAssetStage = addAssetStage;
7703
- exports2.addAssetStageCompletion = addAssetStageCompletion;
7704
- exports2.addAssetStageCompletions = addAssetStageCompletions;
7705
- exports2.addAssetStages = addAssetStages;
7706
7590
  exports2.addAssetType = addAssetType;
7707
7591
  exports2.addAssetTypeAttachment = addAssetTypeAttachment;
7708
7592
  exports2.addAssetTypeAttachments = addAssetTypeAttachments;
7709
- exports2.addAssetTypes = addAssetTypes;
7710
7593
  exports2.addAssets = addAssets;
7711
7594
  exports2.addCategory = addCategory;
7712
7595
  exports2.addConversation = addConversation;
@@ -7714,7 +7597,6 @@ var __publicField = (obj, key, value) => {
7714
7597
  exports2.addDocumentAttachments = addDocumentAttachments;
7715
7598
  exports2.addDocuments = addDocuments;
7716
7599
  exports2.addEmailDomain = addEmailDomain;
7717
- exports2.addFavouriteProjectId = addFavouriteProjectId;
7718
7600
  exports2.addForm = addForm;
7719
7601
  exports2.addFormRevision = addFormRevision;
7720
7602
  exports2.addFormRevisionAttachment = addFormRevisionAttachment;
@@ -7744,6 +7626,9 @@ var __publicField = (obj, key, value) => {
7744
7626
  exports2.addOrReplaceProjects = addOrReplaceProjects;
7745
7627
  exports2.addProjectAttachment = addProjectAttachment;
7746
7628
  exports2.addProjectAttachments = addProjectAttachments;
7629
+ exports2.addStageCompletion = addStageCompletion;
7630
+ exports2.addStageCompletions = addStageCompletions;
7631
+ exports2.addStages = addStages;
7747
7632
  exports2.addTeam = addTeam;
7748
7633
  exports2.addToRecentIssues = addToRecentIssues;
7749
7634
  exports2.addUsers = addUsers;
@@ -7784,14 +7669,9 @@ var __publicField = (obj, key, value) => {
7784
7669
  exports2.deleteAsset = deleteAsset;
7785
7670
  exports2.deleteAssetAttachment = deleteAssetAttachment;
7786
7671
  exports2.deleteAssetAttachments = deleteAssetAttachments;
7787
- exports2.deleteAssetStage = deleteAssetStage;
7788
- exports2.deleteAssetStageCompletion = deleteAssetStageCompletion;
7789
- exports2.deleteAssetStageCompletions = deleteAssetStageCompletions;
7790
- exports2.deleteAssetStages = deleteAssetStages;
7791
7672
  exports2.deleteAssetType = deleteAssetType;
7792
7673
  exports2.deleteAssetTypeAttachment = deleteAssetTypeAttachment;
7793
7674
  exports2.deleteAssetTypeAttachments = deleteAssetTypeAttachments;
7794
- exports2.deleteAssetTypes = deleteAssetTypes;
7795
7675
  exports2.deleteAssets = deleteAssets;
7796
7676
  exports2.deleteCategory = deleteCategory;
7797
7677
  exports2.deleteDocumentAttachment = deleteDocumentAttachment;
@@ -7867,11 +7747,10 @@ var __publicField = (obj, key, value) => {
7867
7747
  exports2.getLocalRelativeDateString = getLocalRelativeDateString;
7868
7748
  exports2.getOutboxCoordinator = getOutboxCoordinator;
7869
7749
  exports2.getRenamedFile = getRenamedFile;
7750
+ exports2.getStageColor = getStageColor;
7870
7751
  exports2.hashFile = hashFile;
7871
7752
  exports2.initSDK = initSDK;
7872
7753
  exports2.initializeAssetAttachments = initializeAssetAttachments;
7873
- exports2.initializeAssetStageCompletions = initializeAssetStageCompletions;
7874
- exports2.initializeAssetStages = initializeAssetStages;
7875
7754
  exports2.initializeAssetTypeAttachments = initializeAssetTypeAttachments;
7876
7755
  exports2.initializeAssetTypes = initializeAssetTypes;
7877
7756
  exports2.initializeAssets = initializeAssets;
@@ -7894,6 +7773,7 @@ var __publicField = (obj, key, value) => {
7894
7773
  exports2.initializeOrganizationAccesses = initializeOrganizationAccesses;
7895
7774
  exports2.initializeProjectAccesses = initializeProjectAccesses;
7896
7775
  exports2.initializeProjectAttachments = initializeProjectAttachments;
7776
+ exports2.initializeStages = initializeStages;
7897
7777
  exports2.initializeTeams = initializeTeams;
7898
7778
  exports2.initializeWorkspaces = initializeWorkspaces;
7899
7779
  exports2.isToday = isToday;
@@ -7946,11 +7826,12 @@ var __publicField = (obj, key, value) => {
7946
7826
  exports2.rehydratedReducer = rehydratedReducer;
7947
7827
  exports2.rehydratedSlice = rehydratedSlice;
7948
7828
  exports2.removeDocuments = removeDocuments;
7949
- exports2.removeFavouriteProjectId = removeFavouriteProjectId;
7950
7829
  exports2.removeIssueType = removeIssueType;
7951
7830
  exports2.removeProjectFile = removeProjectFile;
7952
7831
  exports2.removeProjectFilesOfProject = removeProjectFilesOfProject;
7953
7832
  exports2.removeRecentIssue = removeRecentIssue;
7833
+ exports2.removeStageCompletions = removeStageCompletions;
7834
+ exports2.removeStages = removeStages;
7954
7835
  exports2.removeUser = removeUser;
7955
7836
  exports2.resetProjectFileObjectUrls = resetProjectFileObjectUrls;
7956
7837
  exports2.resetRecentIssues = resetRecentIssues;
@@ -7973,9 +7854,6 @@ var __publicField = (obj, key, value) => {
7973
7854
  exports2.selectAssetAttachments = selectAssetAttachments;
7974
7855
  exports2.selectAssetById = selectAssetById;
7975
7856
  exports2.selectAssetStageById = selectAssetStageById;
7976
- exports2.selectAssetStageCompletionById = selectAssetStageCompletionById;
7977
- exports2.selectAssetStageCompletionMapping = selectAssetStageCompletionMapping;
7978
- exports2.selectAssetStageCompletionsByIds = selectAssetStageCompletionsByIds;
7979
7857
  exports2.selectAssetStages = selectAssetStages;
7980
7858
  exports2.selectAssetStagesByIds = selectAssetStagesByIds;
7981
7859
  exports2.selectAssetTypeAttachmentById = selectAssetTypeAttachmentById;
@@ -8011,7 +7889,7 @@ var __publicField = (obj, key, value) => {
8011
7889
  exports2.selectCategoryMapping = selectCategoryMapping;
8012
7890
  exports2.selectCommentsOfIssue = selectCommentsOfIssue;
8013
7891
  exports2.selectCompletedStageIdsForAsset = selectCompletedStageIdsForAsset;
8014
- exports2.selectCompletedStagesByAsset = selectCompletedStagesByAsset;
7892
+ exports2.selectCompletedStages = selectCompletedStages;
8015
7893
  exports2.selectConversation = selectConversation;
8016
7894
  exports2.selectConversationMapping = selectConversationMapping;
8017
7895
  exports2.selectConversations = selectConversations;
@@ -8026,7 +7904,6 @@ var __publicField = (obj, key, value) => {
8026
7904
  exports2.selectEmailDomains = selectEmailDomains;
8027
7905
  exports2.selectEmailDomainsAsMapping = selectEmailDomainsAsMapping;
8028
7906
  exports2.selectEmailDomainsOfOrganization = selectEmailDomainsOfOrganization;
8029
- exports2.selectFavouriteProjects = selectFavouriteProjects;
8030
7907
  exports2.selectFilteredForms = selectFilteredForms;
8031
7908
  exports2.selectFormById = selectFormById;
8032
7909
  exports2.selectFormMapping = selectFormMapping;
@@ -8125,6 +8002,7 @@ var __publicField = (obj, key, value) => {
8125
8002
  exports2.selectSortedProjectUsers = selectSortedProjectUsers;
8126
8003
  exports2.selectStageFormIdsFromStageIds = selectStageFormIdsFromStageIds;
8127
8004
  exports2.selectStageMapping = selectStageMapping;
8005
+ exports2.selectStagesFromAssetTypeIds = selectStagesFromAssetTypeIds;
8128
8006
  exports2.selectStagesOfAssetType = selectStagesOfAssetType;
8129
8007
  exports2.selectTeamById = selectTeamById;
8130
8008
  exports2.selectTeams = selectTeams;
@@ -8144,12 +8022,8 @@ var __publicField = (obj, key, value) => {
8144
8022
  exports2.setAsset = setAsset;
8145
8023
  exports2.setAssetAttachment = setAssetAttachment;
8146
8024
  exports2.setAssetAttachments = setAssetAttachments;
8147
- exports2.setAssetStage = setAssetStage;
8148
- exports2.setAssetStages = setAssetStages;
8149
- exports2.setAssetType = setAssetType;
8150
8025
  exports2.setAssetTypeAttachment = setAssetTypeAttachment;
8151
8026
  exports2.setAssetTypeAttachments = setAssetTypeAttachments;
8152
- exports2.setAssetTypes = setAssetTypes;
8153
8027
  exports2.setAssets = setAssets;
8154
8028
  exports2.setConversation = setConversation;
8155
8029
  exports2.setCurrentUser = setCurrentUser;
@@ -8182,9 +8056,10 @@ var __publicField = (obj, key, value) => {
8182
8056
  exports2.setProjectAttachments = setProjectAttachments;
8183
8057
  exports2.setProjects = setProjects;
8184
8058
  exports2.setRehydrated = setRehydrated;
8059
+ exports2.setStage = setStage;
8060
+ exports2.setStageCompletions = setStageCompletions;
8185
8061
  exports2.setTeam = setTeam;
8186
8062
  exports2.setTokens = setTokens;
8187
- exports2.setTourStep = setTourStep;
8188
8063
  exports2.setUploadUrl = setUploadUrl;
8189
8064
  exports2.setUsers = setUsers;
8190
8065
  exports2.setWorkspaces = setWorkspaces;
@@ -8200,14 +8075,8 @@ var __publicField = (obj, key, value) => {
8200
8075
  exports2.updateAsset = updateAsset;
8201
8076
  exports2.updateAssetAttachment = updateAssetAttachment;
8202
8077
  exports2.updateAssetAttachments = updateAssetAttachments;
8203
- exports2.updateAssetStage = updateAssetStage;
8204
- exports2.updateAssetStageCompletion = updateAssetStageCompletion;
8205
- exports2.updateAssetStageCompletions = updateAssetStageCompletions;
8206
- exports2.updateAssetStages = updateAssetStages;
8207
- exports2.updateAssetType = updateAssetType;
8208
8078
  exports2.updateAssetTypeAttachment = updateAssetTypeAttachment;
8209
8079
  exports2.updateAssetTypeAttachments = updateAssetTypeAttachments;
8210
- exports2.updateAssetTypes = updateAssetTypes;
8211
8080
  exports2.updateAssets = updateAssets;
8212
8081
  exports2.updateCategory = updateCategory;
8213
8082
  exports2.updateConversation = updateConversation;
@@ -8235,6 +8104,8 @@ var __publicField = (obj, key, value) => {
8235
8104
  exports2.updateProjectAccess = updateProjectAccess;
8236
8105
  exports2.updateProjectAttachment = updateProjectAttachment;
8237
8106
  exports2.updateProjectAttachments = updateProjectAttachments;
8107
+ exports2.updateStage = updateStage;
8108
+ exports2.updateStages = updateStages;
8238
8109
  exports2.updateTeam = updateTeam;
8239
8110
  exports2.updateWorkspace = updateWorkspace;
8240
8111
  exports2.useMemoCompare = useMemoCompare;