@overmap-ai/core 1.0.65-mapbox.1 → 1.0.65-procedures.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 (89) hide show
  1. package/dist/constants/offline.d.ts +1 -1
  2. package/dist/enums/access.d.ts +8 -0
  3. package/dist/enums/attachments.d.ts +7 -0
  4. package/dist/enums/index.d.ts +3 -0
  5. package/dist/enums/issue.d.ts +9 -0
  6. package/dist/enums/licenses.d.ts +14 -0
  7. package/dist/overmap-core.js +1359 -647
  8. package/dist/overmap-core.js.map +1 -1
  9. package/dist/overmap-core.umd.cjs +1355 -643
  10. package/dist/overmap-core.umd.cjs.map +1 -1
  11. package/dist/sdk/base.d.ts +1 -1
  12. package/dist/sdk/globals.d.ts +2 -2
  13. package/dist/sdk/sdk.d.ts +3 -3
  14. package/dist/sdk/services/AgentService.d.ts +1 -1
  15. package/dist/sdk/services/AssetAttachmentService.d.ts +3 -2
  16. package/dist/sdk/services/AssetProcedureCompletionService.d.ts +11 -0
  17. package/dist/sdk/services/AssetProcedureInstanceService.d.ts +10 -0
  18. package/dist/sdk/services/AssetProcedureService.d.ts +10 -0
  19. package/dist/sdk/services/AssetService.d.ts +5 -6
  20. package/dist/sdk/services/AssetStageCompletionService.d.ts +6 -12
  21. package/dist/sdk/services/AssetStageService.d.ts +6 -5
  22. package/dist/sdk/services/AssetTypeAttachmentService.d.ts +3 -2
  23. package/dist/sdk/services/AssetTypeService.d.ts +4 -4
  24. package/dist/sdk/services/BaseApiService.d.ts +1 -1
  25. package/dist/sdk/services/BaseAttachmentService.d.ts +3 -2
  26. package/dist/sdk/services/BaseAuthService.d.ts +1 -1
  27. package/dist/sdk/services/BaseService.d.ts +2 -2
  28. package/dist/sdk/services/BaseUploadService.d.ts +2 -2
  29. package/dist/sdk/services/CategoryService.d.ts +2 -2
  30. package/dist/sdk/services/DocumentAttachmentService.d.ts +3 -2
  31. package/dist/sdk/services/DocumentService.d.ts +2 -2
  32. package/dist/sdk/services/EmailDomainsService.d.ts +1 -1
  33. package/dist/sdk/services/EmailVerificationService.d.ts +1 -1
  34. package/dist/sdk/services/FileService.d.ts +1 -1
  35. package/dist/sdk/services/FormService.d.ts +1 -2
  36. package/dist/sdk/services/FormSubmissionService.d.ts +2 -3
  37. package/dist/sdk/services/GeoImageService.d.ts +2 -2
  38. package/dist/sdk/services/IssueAttachmentService.d.ts +3 -2
  39. package/dist/sdk/services/IssueCommentService.d.ts +2 -2
  40. package/dist/sdk/services/IssueService.d.ts +2 -2
  41. package/dist/sdk/services/IssueTypeService.d.ts +2 -2
  42. package/dist/sdk/services/IssueUpdateService.d.ts +1 -1
  43. package/dist/sdk/services/JWTAuthService.d.ts +2 -2
  44. package/dist/sdk/services/LicenseService.d.ts +1 -1
  45. package/dist/sdk/services/OrganizationAccessService.d.ts +1 -1
  46. package/dist/sdk/services/OrganizationService.d.ts +1 -1
  47. package/dist/sdk/services/ProjectAccessService.d.ts +1 -1
  48. package/dist/sdk/services/ProjectAttachmentService.d.ts +3 -2
  49. package/dist/sdk/services/ProjectFileService.d.ts +2 -3
  50. package/dist/sdk/services/ProjectService.d.ts +1 -2
  51. package/dist/sdk/services/TeamService.d.ts +2 -2
  52. package/dist/sdk/services/UserService.d.ts +2 -2
  53. package/dist/sdk/services/WorkspaceService.d.ts +2 -4
  54. package/dist/sdk/services/index.d.ts +3 -0
  55. package/dist/store/slices/assetProcedureCompletionSlice.d.ts +54 -0
  56. package/dist/store/slices/assetProcedureInstanceSlice.d.ts +54 -0
  57. package/dist/store/slices/assetProcedureSlice.d.ts +53 -0
  58. package/dist/store/slices/assetStageCompletionSlice.d.ts +42 -12
  59. package/dist/store/slices/assetStageSlice.d.ts +22 -11
  60. package/dist/store/slices/assetTypeSlice.d.ts +27 -3
  61. package/dist/store/slices/index.d.ts +3 -0
  62. package/dist/store/slices/userSlice.d.ts +13 -33
  63. package/dist/store/store.d.ts +4 -1
  64. package/dist/typings/models/access.d.ts +2 -9
  65. package/dist/typings/models/agents.d.ts +1 -1
  66. package/dist/typings/models/assets.d.ts +26 -15
  67. package/dist/typings/models/attachments.d.ts +2 -9
  68. package/dist/typings/models/base.d.ts +2 -2
  69. package/dist/typings/models/categories.d.ts +2 -2
  70. package/dist/typings/models/documents.d.ts +1 -1
  71. package/dist/typings/models/emailDomain.d.ts +1 -1
  72. package/dist/typings/models/emailVerification.d.ts +2 -2
  73. package/dist/typings/models/forms.d.ts +2 -2
  74. package/dist/typings/models/geo.d.ts +3 -3
  75. package/dist/typings/models/geoImages.d.ts +3 -3
  76. package/dist/typings/models/issueTypes.d.ts +2 -2
  77. package/dist/typings/models/issues.d.ts +1 -10
  78. package/dist/typings/models/license.d.ts +2 -15
  79. package/dist/typings/models/organizations.d.ts +1 -1
  80. package/dist/typings/models/projects.d.ts +3 -3
  81. package/dist/typings/models/store.d.ts +4 -1
  82. package/dist/typings/models/teams.d.ts +3 -3
  83. package/dist/typings/models/users.d.ts +1 -1
  84. package/dist/typings/models/workspace.d.ts +1 -1
  85. package/dist/typings/store.d.ts +1 -1
  86. package/dist/utils/colors.d.ts +0 -2
  87. package/dist/utils/coordinates.d.ts +18 -4
  88. package/dist/utils/utils.d.ts +7 -1
  89. package/package.json +5 -2
@@ -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("@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) {
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("@overmap-ai/blocks"), require("@redux-offline/redux-offline/lib/constants"), require("jwt-decode"), require("idb")) : 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", "@overmap-ai/blocks", "@redux-offline/redux-offline/lib/constants", "jwt-decode", "idb"], 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.blocks, global.constants, global.jwtDecode, global.idb));
9
+ })(this, function(exports2, dependencyGraph, uuid, fileSaver, React, ColorCls, colors, reduxOffline, offlineConfig, localforage, createMigration, toolkit, request, blocks, constants, jwtDecode, idb) {
10
10
  var _a;
11
11
  "use strict";
12
12
  var HttpMethod = /* @__PURE__ */ ((HttpMethod2) => {
@@ -17,6 +17,14 @@ 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 || {});
20
28
  var IssuePriority = /* @__PURE__ */ ((IssuePriority2) => {
21
29
  IssuePriority2[IssuePriority2["LOWEST"] = 0] = "LOWEST";
22
30
  IssuePriority2[IssuePriority2["LOW"] = 2] = "LOW";
@@ -31,6 +39,43 @@ var __publicField = (obj, key, value) => {
31
39
  IssueStatus2[IssueStatus2["DONE"] = 4] = "DONE";
32
40
  return IssueStatus2;
33
41
  })(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 || {});
34
79
  class OutboxCoordinator {
35
80
  constructor() {
36
81
  __publicField(this, "graph");
@@ -273,145 +318,70 @@ var __publicField = (obj, key, value) => {
273
318
  this.options = options;
274
319
  }
275
320
  }
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({});
321
+ const coordinatesToLiteral = (coordinates) => {
322
+ return { lng: coordinates[0], lat: coordinates[1] };
352
323
  };
353
- const createOutboxState = (state) => {
354
- if (state.outboxReducer) {
355
- state.outboxReducer.deletedRequests = [];
356
- }
357
- return state;
324
+ const literalToCoordinates = (literal) => {
325
+ return [literal.lng, literal.lat];
358
326
  };
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);
327
+ const flipCoordinates = (coordinates) => {
328
+ return [coordinates[1], coordinates[0]];
367
329
  };
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
330
+ const flipBounds = (bounds) => {
331
+ return [flipCoordinates(bounds[0]), flipCoordinates(bounds[1])];
374
332
  };
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;
400
- const createPointGeometry = (position) => {
333
+ function offsetPositionByMeters(originalPosition, latMeters, lngMeters) {
334
+ const { lat, lng } = originalPosition;
335
+ const earthRadius = 6378137;
336
+ const metersPerDegree = 2 * Math.PI * earthRadius / 360;
337
+ const newLng = lng + lngMeters / metersPerDegree / Math.cos(lat * Math.PI / 180);
338
+ const newLat = lat - latMeters / metersPerDegree;
339
+ return { lat: newLat, lng: newLng };
340
+ }
341
+ const createPointGeometry = (coordinates) => {
401
342
  return {
402
343
  type: "Point",
403
- coordinates: position
344
+ coordinates
404
345
  };
405
346
  };
347
+ const coordinatesAreEqual = (a, b) => {
348
+ return a[0] === b[0] && a[1] === b[1];
349
+ };
350
+ const coordinatesToText = (coordinates, decimalPlaces) => {
351
+ if (!coordinates)
352
+ return "(No Location)";
353
+ const { lat, lng } = coordinatesToLiteral(coordinates);
354
+ if (decimalPlaces)
355
+ return `${lat.toFixed(decimalPlaces)}, ${lng.toFixed(decimalPlaces)}`;
356
+ return `${lat}, ${lng}`;
357
+ };
358
+ const coordinatesToUrlText = (coordinates) => {
359
+ const { lat, lng } = coordinatesToLiteral(coordinates);
360
+ return `${lat}%2C${lng}`;
361
+ };
362
+ const openCoordsInGoogleMaps = (coordinates) => {
363
+ const url = `https://www.google.com/maps/search/?api=1&query=${coordinatesToUrlText(coordinates)}`;
364
+ window.open(url);
365
+ };
366
+ const openDirectionsInGoogleMaps = (startingPoint, destination) => {
367
+ const startingPointUrl = coordinatesToUrlText(startingPoint);
368
+ const destinationUrl = coordinatesToUrlText(destination);
369
+ const url = `https://www.google.com/maps/dir/?api=1&origin=${startingPointUrl}&destination=${destinationUrl}`;
370
+ window.open(url);
371
+ };
372
+ const worldBounds = {
373
+ type: "MultiPoint",
374
+ coordinates: [
375
+ [90, -180],
376
+ [-90, 180]
377
+ ]
378
+ };
406
379
  const createMultiPointGeometry = (coordinates) => {
407
380
  return {
408
381
  type: "MultiPoint",
409
382
  coordinates
410
383
  };
411
384
  };
412
- const coordinatesAreEqual = (a, b) => {
413
- return a[0] === b[0] && a[1] === b[1];
414
- };
415
385
  function classNames(...args) {
416
386
  const classes = [];
417
387
  for (const arg of args) {
@@ -589,11 +559,14 @@ var __publicField = (obj, key, value) => {
589
559
  return v.file_sha1 === value.file_sha1;
590
560
  }) === index;
591
561
  }
562
+ function boundsContainPoint(bounds, coordinates) {
563
+ return bounds[0][0] > coordinates[0] && bounds[1][0] < coordinates[0] && bounds[0][1] > coordinates[1] && bounds[1][1] < coordinates[1];
564
+ }
592
565
  const emailRegex = /^.+@.+\..+$/;
593
566
  const fullAssetMarkerSize = 45;
594
567
  const DEFAULT_ISSUE_STATUS = IssueStatus.BACKLOG;
595
568
  const DEFAULT_ISSUE_PRIORITY = IssuePriority.MEDIUM;
596
- const OUTBOX_RETRY_DELAY = 5e3;
569
+ const OUTBOX_RETRY_DELAY = 6e4;
597
570
  const EMPTY_ARRAY = Object.freeze([]);
598
571
  let debug = false;
599
572
  const REACT_APP_DEBUG_MEMOIZATION = {}.REACT_APP_DEBUG_MEMOIZATION || "";
@@ -689,19 +662,6 @@ var __publicField = (obj, key, value) => {
689
662
  mint: colors.mint.mint9,
690
663
  sky: colors.sky.sky9
691
664
  };
692
- const AssetStageColors = {
693
- indigo: colors.indigo.indigo9,
694
- red: colors.red.red9,
695
- violet: colors.violet.violet9,
696
- yellow: colors.yellow.yellow9,
697
- jade: colors.jade.jade9,
698
- cyan: colors.cyan.cyan9,
699
- gold: colors.gold.gold9,
700
- orange: colors.orange.orange9,
701
- lime: colors.lime.lime9,
702
- sky: colors.sky.sky9,
703
- pink: colors.pink.pink9
704
- };
705
665
  const defaultBadgeColor = "#868686";
706
666
  const generateBadgeColors = (rawColor) => {
707
667
  const color = ColorCls(rawColor);
@@ -710,9 +670,6 @@ var __publicField = (obj, key, value) => {
710
670
  const textColor = color.hex() === safety.hex() ? "#000000" : "#FFFFFF";
711
671
  return { backgroundColor, textColor };
712
672
  };
713
- function getStageColor(index) {
714
- return Object.values(AssetStageColors)[index % Object.keys(AssetStageColors).length];
715
- }
716
673
  const getLocalDateString = memoize((date) => {
717
674
  if (!date)
718
675
  return "";
@@ -735,6 +692,158 @@ var __publicField = (obj, key, value) => {
735
692
  return getLocalDateString(date);
736
693
  return relative.format(days, "days");
737
694
  });
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
+ let clientStore;
790
+ function setClientStore(store) {
791
+ clientStore = store;
792
+ }
793
+ function getClientStore() {
794
+ return clientStore;
795
+ }
796
+ let clientSDK;
797
+ function setClientSDK(sdkCtor) {
798
+ clientSDK = sdkCtor;
799
+ }
800
+ function getClientSDK() {
801
+ return clientSDK;
802
+ }
803
+ const CLASS_NAME_TO_SERVICE = {};
804
+ class BaseService {
805
+ constructor(sdk) {
806
+ __publicField(this, "client");
807
+ CLASS_NAME_TO_SERVICE[this.constructor.name] = this;
808
+ this.client = sdk;
809
+ }
810
+ async enqueueRequest(requestDetails) {
811
+ return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
812
+ }
813
+ dispatch(action) {
814
+ this.client.store.dispatch(action);
815
+ }
816
+ }
817
+ const initialState$E = {
818
+ accessToken: "",
819
+ refreshToken: "",
820
+ isLoggedIn: false
821
+ };
822
+ const authSlice = toolkit.createSlice({
823
+ name: "auth",
824
+ initialState: initialState$E,
825
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$E)),
826
+ reducers: {
827
+ setTokens: (state, action) => {
828
+ state.accessToken = action.payload.accessToken;
829
+ state.refreshToken = action.payload.refreshToken;
830
+ },
831
+ clearTokens: (state) => {
832
+ state.accessToken = "";
833
+ state.refreshToken = "";
834
+ },
835
+ setLoggedIn: (state, action) => {
836
+ if (!action.payload) {
837
+ authSlice.caseReducers.clearTokens(state);
838
+ }
839
+ state.isLoggedIn = action.payload;
840
+ }
841
+ }
842
+ });
843
+ const { setTokens, clearTokens, setLoggedIn } = authSlice.actions;
844
+ const selectAccessToken = (state) => state.authReducer.accessToken;
845
+ const selectIsLoggedIn = (state) => state.authReducer.isLoggedIn;
846
+ const authReducer = authSlice.reducer;
738
847
  function createModelAdapter(computeModelId) {
739
848
  const addOne = (state, action) => {
740
849
  const id = computeModelId(action.payload);
@@ -801,11 +910,11 @@ var __publicField = (obj, key, value) => {
801
910
  };
802
911
  }
803
912
  const categoryAdapter = createModelAdapter((category) => category.offline_id);
804
- const initialState$A = categoryAdapter.getInitialState({});
913
+ const initialState$D = categoryAdapter.getInitialState({});
805
914
  const categorySlice = toolkit.createSlice({
806
915
  name: "categories",
807
- initialState: initialState$A,
808
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$A)),
916
+ initialState: initialState$D,
917
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$D)),
809
918
  reducers: {
810
919
  initializeCategories: categoryAdapter.initialize,
811
920
  addCategory: categoryAdapter.addOne,
@@ -849,11 +958,11 @@ var __publicField = (obj, key, value) => {
849
958
  };
850
959
  const categoryReducer = categorySlice.reducer;
851
960
  const assetAdapter = createModelAdapter((asset) => asset.offline_id);
852
- const initialState$z = assetAdapter.getInitialState({});
961
+ const initialState$C = assetAdapter.getInitialState({});
853
962
  const assetSlice = toolkit.createSlice({
854
963
  name: "assets",
855
- initialState: initialState$z,
856
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
964
+ initialState: initialState$C,
965
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$C)),
857
966
  reducers: {
858
967
  initializeAssets: assetAdapter.initialize,
859
968
  addAsset: assetAdapter.addOne,
@@ -905,11 +1014,11 @@ var __publicField = (obj, key, value) => {
905
1014
  };
906
1015
  const assetReducer = assetSlice.reducer;
907
1016
  const assetAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
908
- const initialState$y = assetAttachmentAdapter.getInitialState({});
1017
+ const initialState$B = assetAttachmentAdapter.getInitialState({});
909
1018
  const assetAttachmentSlice = toolkit.createSlice({
910
1019
  name: "assetAttachments",
911
- initialState: initialState$y,
912
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
1020
+ initialState: initialState$B,
1021
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$B)),
913
1022
  reducers: {
914
1023
  initializeAssetAttachments: assetAttachmentAdapter.initialize,
915
1024
  addAssetAttachment: assetAttachmentAdapter.addOne,
@@ -967,78 +1076,98 @@ var __publicField = (obj, key, value) => {
967
1076
  )
968
1077
  );
969
1078
  const assetAttachmentReducer = assetAttachmentSlice.reducer;
970
- const initialState$x = {
971
- completionsByAssetId: {}
972
- };
1079
+ const assetStageCompletionAdapter = createModelAdapter(
1080
+ (stageCompletion) => stageCompletion.offline_id
1081
+ );
1082
+ const initialState$A = assetStageCompletionAdapter.getInitialState({});
973
1083
  const assetStageCompletionSlice = toolkit.createSlice({
974
1084
  name: "assetStageCompletions",
975
- initialState: initialState$x,
976
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
1085
+ initialState: initialState$A,
1086
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$A)),
977
1087
  reducers: {
978
- addStageCompletion: (state, action) => {
979
- let stageToCompletionDateMapping = state.completionsByAssetId[action.payload.asset];
980
- if (!stageToCompletionDateMapping) {
981
- stageToCompletionDateMapping = {};
982
- state.completionsByAssetId[action.payload.asset] = stageToCompletionDateMapping;
983
- }
984
- stageToCompletionDateMapping[action.payload.stage] = (/* @__PURE__ */ new Date()).toISOString();
985
- },
986
- addStageCompletions: (state, action) => {
987
- for (const [assetId, stageIdToCompletionDateMapping] of Object.entries(action.payload)) {
988
- if (Object.keys(stageIdToCompletionDateMapping).length === 0)
989
- throw new Error(`Encountered empty stageIdToCompletionDateMapping argument for asset ${assetId}`);
990
- let thisAssetCompletions = state.completionsByAssetId[assetId];
991
- if (thisAssetCompletions === void 0) {
992
- thisAssetCompletions = {};
993
- }
994
- for (const [stageId, completionDate] of Object.entries(stageIdToCompletionDateMapping)) {
995
- thisAssetCompletions[stageId] = completionDate;
996
- }
997
- state.completionsByAssetId[assetId] = thisAssetCompletions;
998
- }
999
- },
1000
- removeStageCompletions: (state, action) => {
1001
- for (const completion of action.payload) {
1002
- const thisAssetCompletions = state.completionsByAssetId[completion.asset];
1003
- if (!thisAssetCompletions || !(completion.stage in thisAssetCompletions)) {
1004
- console.warn(
1005
- "Skipping removal of uncompleted stage. This message indicates completion objects are created unnecessarily."
1006
- );
1007
- continue;
1008
- }
1009
- delete thisAssetCompletions[completion.stage];
1010
- }
1011
- },
1012
- setStageCompletions: (state, action) => {
1013
- state.completionsByAssetId = action.payload;
1014
- }
1088
+ initializeAssetStageCompletions: assetStageCompletionAdapter.initialize,
1089
+ addAssetStageCompletion: assetStageCompletionAdapter.addOne,
1090
+ addAssetStageCompletions: assetStageCompletionAdapter.addMany,
1091
+ updateAssetStageCompletion: assetStageCompletionAdapter.updateOne,
1092
+ updateAssetStageCompletions: assetStageCompletionAdapter.updateMany,
1093
+ deleteAssetStageCompletion: assetStageCompletionAdapter.deleteOne,
1094
+ deleteAssetStageCompletions: assetStageCompletionAdapter.deleteMany
1015
1095
  }
1016
1096
  });
1017
- const { addStageCompletion, addStageCompletions, removeStageCompletions, setStageCompletions } = assetStageCompletionSlice.actions;
1018
- const selectCompletedStages = (state) => {
1019
- return state.assetStageCompletionReducer.completionsByAssetId;
1097
+ const {
1098
+ initializeAssetStageCompletions,
1099
+ addAssetStageCompletion,
1100
+ addAssetStageCompletions,
1101
+ updateAssetStageCompletion,
1102
+ updateAssetStageCompletions,
1103
+ deleteAssetStageCompletion,
1104
+ deleteAssetStageCompletions
1105
+ } = assetStageCompletionSlice.actions;
1106
+ const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
1107
+ const selectAssetStageCompletionMapping = (state) => {
1108
+ return state.assetStageCompletionReducer.instances;
1020
1109
  };
1021
- const selectCompletedStageIdsForAsset = restructureCreateSelectorWithArgs(
1022
- toolkit.createSelector([selectCompletedStages, (_state, asset) => asset], (completedStages, asset) => {
1023
- return Object.keys(completedStages[asset.offline_id] ?? {});
1110
+ const selectCompletedStagesByAssetProcedureCompletion = toolkit.createSelector(
1111
+ [selectAssetStageCompletionMapping],
1112
+ (completedStagesMapping) => {
1113
+ const completedStagesByAsset = {};
1114
+ for (const stageCompletion of Object.values(completedStagesMapping)) {
1115
+ const { asset_procedure_completion, stage, submitted_at } = stageCompletion;
1116
+ if (!completedStagesByAsset[asset_procedure_completion])
1117
+ completedStagesByAsset[asset_procedure_completion] = {};
1118
+ completedStagesByAsset[asset_procedure_completion][stage] = submitted_at;
1119
+ }
1120
+ return completedStagesByAsset;
1121
+ }
1122
+ );
1123
+ const selectCompletedStageIdsOfAssetProcedureCompletion = restructureCreateSelectorWithArgs(
1124
+ toolkit.createSelector([selectAssetStageCompletionMapping, (_state, id) => id], (completedStages, id) => {
1125
+ return Object.keys(completedStages[id] ?? {});
1126
+ })
1127
+ );
1128
+ const selectAssetStageCompletionById = (id) => (state) => {
1129
+ return state.assetStageCompletionReducer.instances[id];
1130
+ };
1131
+ const selectAssetStageCompletionsByIds = restructureCreateSelectorWithArgs(
1132
+ toolkit.createSelector([selectAssetStageCompletionMapping, (_, ids) => ids], (stageCompletionMapping, ids) => {
1133
+ const stageCompletionIdsSet = new Set(ids);
1134
+ return fallbackToEmptyArray(
1135
+ Object.values(stageCompletionMapping).filter(
1136
+ (stageCompletion) => stageCompletionIdsSet.has(stageCompletion.offline_id)
1137
+ )
1138
+ );
1024
1139
  })
1025
1140
  );
1026
- const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
1027
1141
  const assetStageAdapter = createModelAdapter((assetStage) => assetStage.offline_id);
1028
- const initialState$w = assetStageAdapter.getInitialState({});
1142
+ const initialState$z = assetStageAdapter.getInitialState({});
1029
1143
  const assetStageSlice = toolkit.createSlice({
1030
1144
  name: "assetStages",
1031
- initialState: initialState$w,
1032
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
1145
+ initialState: initialState$z,
1146
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
1033
1147
  reducers: {
1034
- initializeStages: assetStageAdapter.initialize,
1035
- setStage: assetStageAdapter.setOne,
1036
- addStages: assetStageAdapter.addMany,
1037
- updateStage: assetStageAdapter.updateOne,
1038
- updateStages: assetStageAdapter.updateMany,
1039
- removeStages: assetStageAdapter.deleteMany
1148
+ initializeAssetStages: assetStageAdapter.initialize,
1149
+ setAssetStage: assetStageAdapter.setOne,
1150
+ setAssetStages: assetStageAdapter.setMany,
1151
+ addAssetStage: assetStageAdapter.addOne,
1152
+ addAssetStages: assetStageAdapter.addMany,
1153
+ updateAssetStage: assetStageAdapter.updateOne,
1154
+ updateAssetStages: assetStageAdapter.updateMany,
1155
+ deleteAssetStage: assetStageAdapter.deleteOne,
1156
+ deleteAssetStages: assetStageAdapter.deleteMany
1040
1157
  }
1041
1158
  });
1159
+ const {
1160
+ initializeAssetStages,
1161
+ setAssetStage,
1162
+ setAssetStages,
1163
+ addAssetStage,
1164
+ addAssetStages,
1165
+ updateAssetStage,
1166
+ updateAssetStages,
1167
+ deleteAssetStage,
1168
+ deleteAssetStages
1169
+ } = assetStageSlice.actions;
1170
+ const assetStageReducer = assetStageSlice.reducer;
1042
1171
  const selectStageMapping = (state) => state.assetStageReducer.instances;
1043
1172
  const selectAssetStageById = (id) => (state) => {
1044
1173
  return state.assetStageReducer.instances[id];
@@ -1046,40 +1175,20 @@ var __publicField = (obj, key, value) => {
1046
1175
  const selectAssetStages = toolkit.createSelector([selectStageMapping], (stageMapping) => {
1047
1176
  return Object.values(stageMapping);
1048
1177
  });
1049
- const selectStagesFromAssetTypeIds = restructureCreateSelectorWithArgs(
1050
- toolkit.createSelector([selectAssetStages, (_state, assetTypeIds) => assetTypeIds], (stages, assetTypeIds) => {
1051
- const assetTypeIdsSet = new Set(assetTypeIds);
1052
- const ret = {};
1053
- for (const stage of stages) {
1054
- if (assetTypeIdsSet.has(stage.asset_type)) {
1055
- if (!ret[stage.asset_type]) {
1056
- ret[stage.asset_type] = [];
1057
- }
1058
- ret[stage.asset_type].push(stage);
1059
- }
1060
- }
1061
- for (const key in ret) {
1062
- ret[key] = ret[key].sort((a, b) => a.priority - b.priority);
1063
- }
1064
- return ret;
1065
- })
1066
- );
1067
- const selectAssetTypeStagesMapping = restructureCreateSelectorWithArgs(
1068
- toolkit.createSelector([selectStageMapping, (_state, assetTypeId) => assetTypeId], (stagesMapping, assetTypeId) => {
1069
- const assetTypeStagesMapping = {};
1178
+ const selectAssetStagesMappingOfAssetProcedure = restructureCreateSelectorWithArgs(
1179
+ toolkit.createSelector([selectStageMapping, (_state, id) => id], (stagesMapping, id) => {
1180
+ const assetStageMapping = {};
1070
1181
  for (const [stageId, stage] of Object.entries(stagesMapping)) {
1071
- if (stage.asset_type === assetTypeId) {
1072
- assetTypeStagesMapping[stageId] = stage;
1182
+ if (stage.asset_procedure === id) {
1183
+ assetStageMapping[stageId] = stage;
1073
1184
  }
1074
1185
  }
1075
- return assetTypeStagesMapping;
1186
+ return assetStageMapping;
1076
1187
  })
1077
1188
  );
1078
- const selectStagesOfAssetType = restructureCreateSelectorWithArgs(
1079
- toolkit.createSelector([selectAssetStages, (_state, assetTypeId) => assetTypeId], (stages, assetTypeId) => {
1080
- return fallbackToEmptyArray(
1081
- stages.filter((stage) => stage.asset_type === assetTypeId).sort((a, b) => a.priority - b.priority)
1082
- );
1189
+ const selectAssetStagesOfAssetProcedure = restructureCreateSelectorWithArgs(
1190
+ toolkit.createSelector([selectAssetStages, (_state, id) => id], (stages, id) => {
1191
+ return fallbackToEmptyArray(stages.filter((stage) => stage.asset_procedure === id));
1083
1192
  })
1084
1193
  );
1085
1194
  const selectAssetStagesByIds = restructureCreateSelectorWithArgs(
@@ -1111,21 +1220,35 @@ var __publicField = (obj, key, value) => {
1111
1220
  return ret;
1112
1221
  })
1113
1222
  );
1114
- const { initializeStages, setStage, addStages, updateStages, removeStages, updateStage } = assetStageSlice.actions;
1115
- const assetStageReducer = assetStageSlice.reducer;
1116
1223
  const assetTypeAdapter = createModelAdapter((assetType) => assetType.offline_id);
1117
- const initialState$v = assetTypeAdapter.getInitialState({});
1224
+ const initialState$y = assetTypeAdapter.getInitialState({});
1118
1225
  const assetTypeSlice = toolkit.createSlice({
1119
1226
  name: "assetTypes",
1120
- initialState: initialState$v,
1121
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
1227
+ initialState: initialState$y,
1228
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
1122
1229
  reducers: {
1123
1230
  initializeAssetTypes: assetTypeAdapter.initialize,
1231
+ setAssetType: assetTypeAdapter.setOne,
1232
+ setAssetTypes: assetTypeAdapter.setMany,
1124
1233
  addAssetType: assetTypeAdapter.addOne,
1125
- deleteAssetType: assetTypeAdapter.deleteOne
1234
+ addAssetTypes: assetTypeAdapter.addMany,
1235
+ updateAssetType: assetTypeAdapter.updateOne,
1236
+ updateAssetTypes: assetTypeAdapter.updateMany,
1237
+ deleteAssetType: assetTypeAdapter.deleteOne,
1238
+ deleteAssetTypes: assetTypeAdapter.deleteMany
1126
1239
  }
1127
1240
  });
1128
- const { addAssetType, initializeAssetTypes, deleteAssetType } = assetTypeSlice.actions;
1241
+ const {
1242
+ initializeAssetTypes,
1243
+ setAssetType,
1244
+ setAssetTypes,
1245
+ addAssetType,
1246
+ addAssetTypes,
1247
+ updateAssetType,
1248
+ updateAssetTypes,
1249
+ deleteAssetType,
1250
+ deleteAssetTypes
1251
+ } = assetTypeSlice.actions;
1129
1252
  const selectAssetTypesMapping = (state) => state.assetTypeReducer.instances;
1130
1253
  const selectAssetTypes = toolkit.createSelector(
1131
1254
  [selectAssetTypesMapping],
@@ -1155,11 +1278,11 @@ var __publicField = (obj, key, value) => {
1155
1278
  const assetTypeAttachmentAdapter = createModelAdapter(
1156
1279
  (attachment) => attachment.offline_id
1157
1280
  );
1158
- const initialState$u = assetTypeAttachmentAdapter.getInitialState({});
1281
+ const initialState$x = assetTypeAttachmentAdapter.getInitialState({});
1159
1282
  const assetTypeAttachmentSlice = toolkit.createSlice({
1160
1283
  name: "assetTypeAttachments",
1161
- initialState: initialState$u,
1162
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$u)),
1284
+ initialState: initialState$x,
1285
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
1163
1286
  reducers: {
1164
1287
  initializeAssetTypeAttachments: assetTypeAttachmentAdapter.initialize,
1165
1288
  addAssetTypeAttachment: assetTypeAttachmentAdapter.addOne,
@@ -1218,10 +1341,10 @@ var __publicField = (obj, key, value) => {
1218
1341
  );
1219
1342
  const assetTypeAttachmentReducer = assetTypeAttachmentSlice.reducer;
1220
1343
  const workspaceAdapter = createModelAdapter((workspace) => workspace.offline_id);
1221
- const initialState$t = workspaceAdapter.getInitialState({});
1344
+ const initialState$w = workspaceAdapter.getInitialState({});
1222
1345
  const workspaceSlice = toolkit.createSlice({
1223
1346
  name: "workspace",
1224
- initialState: initialState$t,
1347
+ initialState: initialState$w,
1225
1348
  reducers: {
1226
1349
  initializeWorkspaces: workspaceAdapter.initialize,
1227
1350
  setWorkspaces: workspaceAdapter.setMany,
@@ -1253,14 +1376,14 @@ var __publicField = (obj, key, value) => {
1253
1376
  const workspaceReducer = workspaceSlice.reducer;
1254
1377
  const maxRecentIssues = 10;
1255
1378
  const issueAdapter = createModelAdapter((issue) => issue.offline_id);
1256
- const initialState$s = issueAdapter.getInitialState({
1379
+ const initialState$v = issueAdapter.getInitialState({
1257
1380
  recentIssueIds: []
1258
1381
  });
1259
1382
  const issueSlice = toolkit.createSlice({
1260
1383
  name: "issues",
1261
- initialState: initialState$s,
1384
+ initialState: initialState$v,
1262
1385
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
1263
- Object.assign(state, initialState$s);
1386
+ Object.assign(state, initialState$v);
1264
1387
  }),
1265
1388
  reducers: {
1266
1389
  initializeIssues: issueAdapter.initialize,
@@ -1416,12 +1539,12 @@ var __publicField = (obj, key, value) => {
1416
1539
  );
1417
1540
  const issueReducer = issueSlice.reducer;
1418
1541
  const issueTypeAdapter = createModelAdapter((issueType) => issueType.offline_id);
1419
- const initialState$r = issueTypeAdapter.getInitialState({});
1542
+ const initialState$u = issueTypeAdapter.getInitialState({});
1420
1543
  const issueTypeSlice = toolkit.createSlice({
1421
1544
  name: "issueTypes",
1422
- initialState: initialState$r,
1545
+ initialState: initialState$u,
1423
1546
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
1424
- Object.assign(state, initialState$r);
1547
+ Object.assign(state, initialState$u);
1425
1548
  }),
1426
1549
  reducers: {
1427
1550
  initializeIssueTypes: issueTypeAdapter.initialize,
@@ -1478,15 +1601,15 @@ var __publicField = (obj, key, value) => {
1478
1601
  return selectIssuesOfIssueType(issueTypeId)(state).length;
1479
1602
  };
1480
1603
  const issueTypeReducer = issueTypeSlice.reducer;
1481
- const initialState$q = {
1604
+ const initialState$t = {
1482
1605
  s3Urls: {}
1483
1606
  };
1484
1607
  const msPerHour = 1e3 * 60 * 60;
1485
1608
  const msPerWeek = msPerHour * 24 * 7;
1486
1609
  const fileSlice = toolkit.createSlice({
1487
1610
  name: "file",
1488
- initialState: initialState$q,
1489
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
1611
+ initialState: initialState$t,
1612
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$t)),
1490
1613
  reducers: {
1491
1614
  setUploadUrl: (state, action) => {
1492
1615
  const { url, fields, sha1 } = action.payload;
@@ -1513,73 +1636,14 @@ var __publicField = (obj, key, value) => {
1513
1636
  return url;
1514
1637
  };
1515
1638
  const fileReducer = fileSlice.reducer;
1516
- var ProjectAccessLevel = /* @__PURE__ */ ((ProjectAccessLevel2) => {
1517
- ProjectAccessLevel2[ProjectAccessLevel2["BASIC"] = 0] = "BASIC";
1518
- ProjectAccessLevel2[ProjectAccessLevel2["ADMIN"] = 2] = "ADMIN";
1519
- return ProjectAccessLevel2;
1520
- })(ProjectAccessLevel || {});
1521
- var OrganizationAccessLevel = /* @__PURE__ */ ((OrganizationAccessLevel2) => {
1522
- OrganizationAccessLevel2[OrganizationAccessLevel2["BASIC"] = 0] = "BASIC";
1523
- OrganizationAccessLevel2[OrganizationAccessLevel2["ADMIN"] = 2] = "ADMIN";
1524
- return OrganizationAccessLevel2;
1525
- })(OrganizationAccessLevel || {});
1526
- var AttachmentModel = /* @__PURE__ */ ((AttachmentModel2) => {
1527
- AttachmentModel2["Issue"] = "issue";
1528
- AttachmentModel2["Asset"] = "asset";
1529
- AttachmentModel2["AssetType"] = "asset_type";
1530
- AttachmentModel2["Project"] = "project";
1531
- AttachmentModel2["Document"] = "document";
1532
- return AttachmentModel2;
1533
- })(AttachmentModel || {});
1534
- var IssueUpdateChange = /* @__PURE__ */ ((IssueUpdateChange2) => {
1535
- IssueUpdateChange2["STATUS"] = "status";
1536
- IssueUpdateChange2["PRIORITY"] = "priority";
1537
- IssueUpdateChange2["CATEGORY"] = "category";
1538
- IssueUpdateChange2["DESCRIPTION"] = "description";
1539
- IssueUpdateChange2["TITLE"] = "title";
1540
- IssueUpdateChange2["ASSIGNED_TO"] = "assigned_to";
1541
- IssueUpdateChange2["DUE_DATE"] = "due_date";
1542
- return IssueUpdateChange2;
1543
- })(IssueUpdateChange || {});
1544
- var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
1545
- VerificationCodeType2[VerificationCodeType2["USER_REGISTRATION"] = 0] = "USER_REGISTRATION";
1546
- VerificationCodeType2[VerificationCodeType2["APPLICATION_INVITE"] = 2] = "APPLICATION_INVITE";
1547
- VerificationCodeType2[VerificationCodeType2["PROJECT_INVITE"] = 4] = "PROJECT_INVITE";
1548
- VerificationCodeType2[VerificationCodeType2["ORGANIZATION_INVITE"] = 6] = "ORGANIZATION_INVITE";
1549
- VerificationCodeType2[VerificationCodeType2["ADD_EMAIL_DOMAIN"] = 8] = "ADD_EMAIL_DOMAIN";
1550
- VerificationCodeType2[VerificationCodeType2["RESET_PASSWORD"] = 10] = "RESET_PASSWORD";
1551
- return VerificationCodeType2;
1552
- })(VerificationCodeType || {});
1553
- var PaddleCheckoutEvent = /* @__PURE__ */ ((PaddleCheckoutEvent2) => {
1554
- PaddleCheckoutEvent2["COMPLETED"] = "checkout.completed";
1555
- PaddleCheckoutEvent2["CLOSED"] = "checkout.closed";
1556
- return PaddleCheckoutEvent2;
1557
- })(PaddleCheckoutEvent || {});
1558
- var LicenseLevel = /* @__PURE__ */ ((LicenseLevel2) => {
1559
- LicenseLevel2[LicenseLevel2["PRO"] = 0] = "PRO";
1560
- return LicenseLevel2;
1561
- })(LicenseLevel || {});
1562
- var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
1563
- LicenseStatus2[LicenseStatus2["ACTIVE"] = 0] = "ACTIVE";
1564
- LicenseStatus2[LicenseStatus2["PAUSED"] = 2] = "PAUSED";
1565
- LicenseStatus2[LicenseStatus2["CANCELLED"] = 4] = "CANCELLED";
1566
- LicenseStatus2[LicenseStatus2["INACTIVE"] = 6] = "INACTIVE";
1567
- LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
1568
- return LicenseStatus2;
1569
- })(LicenseStatus || {});
1570
- const initialState$p = {
1639
+ const initialState$s = {
1571
1640
  users: {},
1572
- currentUser: {
1573
- id: 0,
1574
- username: "",
1575
- email: "",
1576
- profile: { file: null, file_sha1: null, favourite_project_ids: [], tour_step: -1 }
1577
- }
1641
+ currentUser: null
1578
1642
  };
1579
1643
  const userSlice = toolkit.createSlice({
1580
1644
  name: "users",
1581
- initialState: initialState$p,
1582
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
1645
+ initialState: initialState$s,
1646
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$s)),
1583
1647
  reducers: {
1584
1648
  setUsers: (state, action) => {
1585
1649
  const usersMapping = {};
@@ -1597,6 +1661,8 @@ var __publicField = (obj, key, value) => {
1597
1661
  state.currentUser = action.payload;
1598
1662
  },
1599
1663
  setProfilePicture: (state, action) => {
1664
+ if (!state.currentUser)
1665
+ return;
1600
1666
  state.currentUser.profile.file = action.payload.file ?? null;
1601
1667
  state.currentUser.profile.file_sha1 = action.payload.file_sha1 ?? null;
1602
1668
  const currentUser = state.users[state.currentUser.id];
@@ -1606,32 +1672,12 @@ var __publicField = (obj, key, value) => {
1606
1672
  currentUser.profile.file = action.payload.file ?? null;
1607
1673
  currentUser.profile.file_sha1 = action.payload.file_sha1 ?? null;
1608
1674
  },
1609
- addFavouriteProjectId: (state, action) => {
1610
- state.currentUser.profile.favourite_project_ids.push(action.payload);
1611
- },
1612
- removeFavouriteProjectId: (state, action) => {
1613
- state.currentUser.profile.favourite_project_ids = state.currentUser.profile.favourite_project_ids.filter(
1614
- (id) => id !== action.payload
1615
- );
1616
- },
1617
- setTourStep: (state, action) => {
1618
- state.currentUser.profile.tour_step = action.payload;
1619
- },
1620
1675
  removeUser: (state, action) => {
1621
1676
  delete state.users[action.payload];
1622
1677
  }
1623
1678
  }
1624
1679
  });
1625
- const {
1626
- setCurrentUser,
1627
- setProfilePicture,
1628
- setUsers,
1629
- addUsers,
1630
- addFavouriteProjectId,
1631
- removeFavouriteProjectId,
1632
- setTourStep,
1633
- removeUser
1634
- } = userSlice.actions;
1680
+ const { setCurrentUser, setProfilePicture, setUsers, addUsers, removeUser } = userSlice.actions;
1635
1681
  const userReducer = userSlice.reducer;
1636
1682
  const selectCurrentUser = (state) => state.userReducer.currentUser;
1637
1683
  const selectUsersMapping = (state) => state.userReducer.users;
@@ -1652,15 +1698,14 @@ var __publicField = (obj, key, value) => {
1652
1698
  return fallbackToEmptyArray(users);
1653
1699
  })
1654
1700
  );
1655
- const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
1656
1701
  const organizationAccessAdapter = createModelAdapter(
1657
1702
  (organizationAccess) => organizationAccess.offline_id
1658
1703
  );
1659
- const initialState$o = organizationAccessAdapter.getInitialState({});
1704
+ const initialState$r = organizationAccessAdapter.getInitialState({});
1660
1705
  const organizationAccessSlice = toolkit.createSlice({
1661
1706
  name: "organizationAccess",
1662
- initialState: initialState$o,
1663
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
1707
+ initialState: initialState$r,
1708
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$r)),
1664
1709
  reducers: {
1665
1710
  initializeOrganizationAccesses: organizationAccessAdapter.initialize,
1666
1711
  updateOrganizationAccess: organizationAccessAdapter.updateOne,
@@ -1678,7 +1723,7 @@ var __publicField = (obj, key, value) => {
1678
1723
  [selectCurrentUser, selectOrganizationAccesses],
1679
1724
  (currentUser, organizationAccesses) => {
1680
1725
  const activeOrganizationAccess = Object.values(organizationAccesses).find(
1681
- (organizationAccess) => organizationAccess.user === currentUser.id
1726
+ (organizationAccess) => organizationAccess.user === (currentUser == null ? void 0 : currentUser.id)
1682
1727
  );
1683
1728
  return activeOrganizationAccess ?? null;
1684
1729
  }
@@ -1697,11 +1742,11 @@ var __publicField = (obj, key, value) => {
1697
1742
  };
1698
1743
  const organizationAccessReducer = organizationAccessSlice.reducer;
1699
1744
  const licenseAdapter = createModelAdapter((license) => license.offline_id);
1700
- const initialState$n = licenseAdapter.getInitialState({});
1745
+ const initialState$q = licenseAdapter.getInitialState({});
1701
1746
  const licenseSlice = toolkit.createSlice({
1702
1747
  name: "license",
1703
- initialState: initialState$n,
1704
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
1748
+ initialState: initialState$q,
1749
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
1705
1750
  reducers: {
1706
1751
  initializeLicences: licenseAdapter.initialize,
1707
1752
  addLicenses: licenseAdapter.addMany,
@@ -1726,11 +1771,11 @@ var __publicField = (obj, key, value) => {
1726
1771
  );
1727
1772
  const licenseReducer = licenseSlice.reducer;
1728
1773
  const projectAccessAdapter = createModelAdapter((projectAccess) => projectAccess.offline_id);
1729
- const initialState$m = projectAccessAdapter.getInitialState({});
1774
+ const initialState$p = projectAccessAdapter.getInitialState({});
1730
1775
  const projectAccessSlice = toolkit.createSlice({
1731
1776
  name: "projectAccess",
1732
- initialState: initialState$m,
1733
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
1777
+ initialState: initialState$p,
1778
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
1734
1779
  reducers: {
1735
1780
  initializeProjectAccesses: projectAccessAdapter.initialize,
1736
1781
  updateProjectAccess: projectAccessAdapter.updateOne,
@@ -1771,14 +1816,14 @@ var __publicField = (obj, key, value) => {
1771
1816
  return projectAccesses;
1772
1817
  };
1773
1818
  const projectAccessReducer = projectAccessSlice.reducer;
1774
- const initialState$l = {
1819
+ const initialState$o = {
1775
1820
  projects: {},
1776
1821
  activeProjectId: null
1777
1822
  };
1778
1823
  const projectSlice = toolkit.createSlice({
1779
1824
  name: "projects",
1780
- initialState: initialState$l,
1781
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
1825
+ initialState: initialState$o,
1826
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
1782
1827
  reducers: {
1783
1828
  setProjects: (state, action) => {
1784
1829
  const projectsMap = {};
@@ -1868,9 +1913,9 @@ var __publicField = (obj, key, value) => {
1868
1913
  [selectCurrentUser, selectProjectUsersAsMapping, selectProjectAccessUserMapping],
1869
1914
  (currentUser, userMapping, projectAccessMapping) => {
1870
1915
  return Object.values(userMapping).sort((userA, userB) => {
1871
- if (userA.id === currentUser.id) {
1916
+ if (userA.id === (currentUser == null ? void 0 : currentUser.id)) {
1872
1917
  return -1;
1873
- } else if (userB.id === currentUser.id) {
1918
+ } else if (userB.id === (currentUser == null ? void 0 : currentUser.id)) {
1874
1919
  return 1;
1875
1920
  }
1876
1921
  const projectAccessesA = projectAccessMapping[userA.id];
@@ -1885,13 +1930,13 @@ var __publicField = (obj, key, value) => {
1885
1930
  });
1886
1931
  }
1887
1932
  );
1888
- const initialState$k = {
1933
+ const initialState$n = {
1889
1934
  organizations: {}
1890
1935
  };
1891
1936
  const organizationSlice = toolkit.createSlice({
1892
1937
  name: "organizations",
1893
- initialState: initialState$k,
1894
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
1938
+ initialState: initialState$n,
1939
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
1895
1940
  reducers: {
1896
1941
  setOrganizations: (state, action) => {
1897
1942
  for (const org of action.payload) {
@@ -1947,9 +1992,9 @@ var __publicField = (obj, key, value) => {
1947
1992
  [selectCurrentUser, selectOrganizationUsersAsMapping, selectOrganizationAccessUserMapping],
1948
1993
  (currentUser, userMapping, organizationAccessMapping) => {
1949
1994
  return Object.values(userMapping).sort((userA, userB) => {
1950
- if (userA.id === currentUser.id) {
1995
+ if (userA.id === (currentUser == null ? void 0 : currentUser.id)) {
1951
1996
  return -1;
1952
- } else if (userB.id === currentUser.id) {
1997
+ } else if (userB.id === (currentUser == null ? void 0 : currentUser.id)) {
1953
1998
  return 1;
1954
1999
  }
1955
2000
  const organizationAccessesA = organizationAccessMapping[userA.id];
@@ -1982,14 +2027,14 @@ var __publicField = (obj, key, value) => {
1982
2027
  }
1983
2028
  };
1984
2029
  };
1985
- const initialState$j = {
2030
+ const initialState$m = {
1986
2031
  deletedRequests: [],
1987
2032
  latestRetryTime: 0
1988
2033
  };
1989
2034
  const outboxSlice = toolkit.createSlice({
1990
2035
  name: "outbox",
1991
- initialState: initialState$j,
1992
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
2036
+ initialState: initialState$m,
2037
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
1993
2038
  reducers: {
1994
2039
  // enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
1995
2040
  // Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
@@ -2021,15 +2066,15 @@ var __publicField = (obj, key, value) => {
2021
2066
  const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
2022
2067
  const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
2023
2068
  const outboxReducer = outboxSlice.reducer;
2024
- const initialState$i = {
2069
+ const initialState$l = {
2025
2070
  projectFiles: {},
2026
2071
  activeProjectFileId: null,
2027
2072
  isImportingProjectFile: false
2028
2073
  };
2029
2074
  const projectFileSlice = toolkit.createSlice({
2030
2075
  name: "projectFiles",
2031
- initialState: initialState$i,
2032
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
2076
+ initialState: initialState$l,
2077
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
2033
2078
  reducers: {
2034
2079
  addOrReplaceProjectFiles: (state, action) => {
2035
2080
  for (let fileObj of action.payload) {
@@ -2116,11 +2161,11 @@ var __publicField = (obj, key, value) => {
2116
2161
  };
2117
2162
  const projectFileReducer = projectFileSlice.reducer;
2118
2163
  const projectAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
2119
- const initialState$h = projectAttachmentAdapter.getInitialState({});
2164
+ const initialState$k = projectAttachmentAdapter.getInitialState({});
2120
2165
  const projectAttachmentSlice = toolkit.createSlice({
2121
2166
  name: "projectAttachments",
2122
- initialState: initialState$h,
2123
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
2167
+ initialState: initialState$k,
2168
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
2124
2169
  reducers: {
2125
2170
  initializeProjectAttachments: projectAttachmentAdapter.initialize,
2126
2171
  addProjectAttachment: projectAttachmentAdapter.addOne,
@@ -2175,12 +2220,12 @@ var __publicField = (obj, key, value) => {
2175
2220
  )
2176
2221
  );
2177
2222
  const projectAttachmentReducer = projectAttachmentSlice.reducer;
2178
- const initialState$g = {
2223
+ const initialState$j = {
2179
2224
  isRehydrated: false
2180
2225
  };
2181
2226
  const rehydratedSlice = toolkit.createSlice({
2182
2227
  name: "rehydrated",
2183
- initialState: initialState$g,
2228
+ initialState: initialState$j,
2184
2229
  // The `reducers` field lets us define reducers and generate associated actions
2185
2230
  reducers: {
2186
2231
  setRehydrated: (state, action) => {
@@ -2205,11 +2250,11 @@ var __publicField = (obj, key, value) => {
2205
2250
  }
2206
2251
  };
2207
2252
  const formRevisionAdapter = createModelAdapter((revision) => revision.offline_id);
2208
- const initialState$f = formRevisionAdapter.getInitialState({});
2253
+ const initialState$i = formRevisionAdapter.getInitialState({});
2209
2254
  const formRevisionsSlice = toolkit.createSlice({
2210
2255
  name: "formRevisions",
2211
- initialState: initialState$f,
2212
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
2256
+ initialState: initialState$i,
2257
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
2213
2258
  reducers: {
2214
2259
  initializeFormRevisions: formRevisionAdapter.initialize,
2215
2260
  setFormRevision: formRevisionAdapter.setOne,
@@ -2281,11 +2326,11 @@ var __publicField = (obj, key, value) => {
2281
2326
  });
2282
2327
  const formRevisionReducer = formRevisionsSlice.reducer;
2283
2328
  const formAdapter = createModelAdapter((form) => form.offline_id);
2284
- const initialState$e = formAdapter.getInitialState({});
2329
+ const initialState$h = formAdapter.getInitialState({});
2285
2330
  const formSlice = toolkit.createSlice({
2286
2331
  name: "forms",
2287
- initialState: initialState$e,
2288
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
2332
+ initialState: initialState$h,
2333
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
2289
2334
  reducers: {
2290
2335
  initializeForms: formAdapter.initialize,
2291
2336
  setForm: formAdapter.setOne,
@@ -2365,11 +2410,11 @@ var __publicField = (obj, key, value) => {
2365
2410
  return Object.values(formsMapping).filter((form) => !form.asset_type).length;
2366
2411
  });
2367
2412
  const submissionAdapter = createModelAdapter((submission) => submission.offline_id);
2368
- const initialState$d = submissionAdapter.getInitialState({});
2413
+ const initialState$g = submissionAdapter.getInitialState({});
2369
2414
  const formSubmissionSlice = toolkit.createSlice({
2370
2415
  name: "formSubmissions",
2371
- initialState: initialState$d,
2372
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
2416
+ initialState: initialState$g,
2417
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
2373
2418
  reducers: {
2374
2419
  initializeFormSubmissions: submissionAdapter.initialize,
2375
2420
  setFormSubmission: submissionAdapter.setOne,
@@ -2581,11 +2626,11 @@ var __publicField = (obj, key, value) => {
2581
2626
  const formSubmissionAttachmentAdapter = createModelAdapter(
2582
2627
  (attachment) => attachment.offline_id
2583
2628
  );
2584
- const initialState$c = formSubmissionAttachmentAdapter.getInitialState({});
2629
+ const initialState$f = formSubmissionAttachmentAdapter.getInitialState({});
2585
2630
  const formSubmissionAttachmentSlice = toolkit.createSlice({
2586
2631
  name: "formSubmissionAttachments",
2587
- initialState: initialState$c,
2588
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
2632
+ initialState: initialState$f,
2633
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
2589
2634
  reducers: {
2590
2635
  initializeFormSubmissionAttachments: formSubmissionAttachmentAdapter.initialize,
2591
2636
  addFormSubmissionAttachment: formSubmissionAttachmentAdapter.addOne,
@@ -2637,11 +2682,11 @@ var __publicField = (obj, key, value) => {
2637
2682
  const formRevisionAttachmentAdapter = createModelAdapter(
2638
2683
  (attachment) => attachment.offline_id
2639
2684
  );
2640
- const initialState$b = formRevisionAttachmentAdapter.getInitialState({});
2685
+ const initialState$e = formRevisionAttachmentAdapter.getInitialState({});
2641
2686
  const formRevisionAttachmentSlice = toolkit.createSlice({
2642
2687
  name: "formRevisionAttachments",
2643
- initialState: initialState$b,
2644
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
2688
+ initialState: initialState$e,
2689
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
2645
2690
  reducers: {
2646
2691
  initializeFormRevisionAttachments: formRevisionAttachmentAdapter.initialize,
2647
2692
  addFormRevisionAttachment: formRevisionAttachmentAdapter.addOne,
@@ -2680,10 +2725,10 @@ var __publicField = (obj, key, value) => {
2680
2725
  );
2681
2726
  const formRevisionAttachmentReducer = formRevisionAttachmentSlice.reducer;
2682
2727
  const emailDomainAdapter = createModelAdapter((emailDomain) => emailDomain.offline_id);
2683
- const initialState$a = emailDomainAdapter.getInitialState({});
2728
+ const initialState$d = emailDomainAdapter.getInitialState({});
2684
2729
  const emailDomainsSlice = toolkit.createSlice({
2685
2730
  name: "emailDomains",
2686
- initialState: initialState$a,
2731
+ initialState: initialState$d,
2687
2732
  reducers: {
2688
2733
  initializeEmailDomains: emailDomainAdapter.initialize,
2689
2734
  addEmailDomain: emailDomainAdapter.addOne,
@@ -2704,14 +2749,14 @@ var __publicField = (obj, key, value) => {
2704
2749
  )
2705
2750
  );
2706
2751
  const emailDomainsReducer = emailDomainsSlice.reducer;
2707
- const initialState$9 = {
2752
+ const initialState$c = {
2708
2753
  documents: {}
2709
2754
  };
2710
2755
  const documentSlice = toolkit.createSlice({
2711
2756
  name: "documents",
2712
- initialState: initialState$9,
2757
+ initialState: initialState$c,
2713
2758
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
2714
- Object.assign(state, initialState$9);
2759
+ Object.assign(state, initialState$c);
2715
2760
  }),
2716
2761
  reducers: {
2717
2762
  setDocuments: (state, action) => {
@@ -2900,11 +2945,11 @@ var __publicField = (obj, key, value) => {
2900
2945
  );
2901
2946
  const documentsReducer = documentSlice.reducer;
2902
2947
  const documentAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
2903
- const initialState$8 = documentAttachmentAdapter.getInitialState({});
2948
+ const initialState$b = documentAttachmentAdapter.getInitialState({});
2904
2949
  const documentAttachmentSlice = toolkit.createSlice({
2905
2950
  name: "documentAttachments",
2906
- initialState: initialState$8,
2907
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
2951
+ initialState: initialState$b,
2952
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
2908
2953
  reducers: {
2909
2954
  initializeDocumentAttachments: documentAttachmentAdapter.initialize,
2910
2955
  addDocumentAttachment: documentAttachmentAdapter.addOne,
@@ -2963,11 +3008,11 @@ var __publicField = (obj, key, value) => {
2963
3008
  );
2964
3009
  const documentAttachmentReducer = documentAttachmentSlice.reducer;
2965
3010
  const teamAdapter = createModelAdapter((team) => team.offline_id);
2966
- const initialState$7 = teamAdapter.getInitialState({});
3011
+ const initialState$a = teamAdapter.getInitialState({});
2967
3012
  const teamSlice = toolkit.createSlice({
2968
3013
  name: "teams",
2969
- initialState: initialState$7,
2970
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
3014
+ initialState: initialState$a,
3015
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
2971
3016
  reducers: {
2972
3017
  setTeam: teamAdapter.setOne,
2973
3018
  initializeTeams: teamAdapter.initialize,
@@ -3018,11 +3063,11 @@ var __publicField = (obj, key, value) => {
3018
3063
  const agentUserConversationAdapter = createModelAdapter(
3019
3064
  (conversation) => conversation.offline_id
3020
3065
  );
3021
- const initialState$6 = agentUserConversationAdapter.getInitialState({});
3066
+ const initialState$9 = agentUserConversationAdapter.getInitialState({});
3022
3067
  const agentsSlice = toolkit.createSlice({
3023
3068
  name: "agents",
3024
- initialState: initialState$6,
3025
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
3069
+ initialState: initialState$9,
3070
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$9)),
3026
3071
  reducers: {
3027
3072
  initializeConversations: agentUserConversationAdapter.initialize,
3028
3073
  addConversation: agentUserConversationAdapter.addOne,
@@ -3044,11 +3089,11 @@ var __publicField = (obj, key, value) => {
3044
3089
  );
3045
3090
  const agentsReducer = agentsSlice.reducer;
3046
3091
  const issueCommentAdapter = createModelAdapter((comment) => comment.offline_id);
3047
- const initialState$5 = issueCommentAdapter.getInitialState({});
3092
+ const initialState$8 = issueCommentAdapter.getInitialState({});
3048
3093
  const issueCommentSlice = toolkit.createSlice({
3049
3094
  name: "issueComments",
3050
- initialState: initialState$5,
3051
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
3095
+ initialState: initialState$8,
3096
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
3052
3097
  reducers: {
3053
3098
  addIssueComment: issueCommentAdapter.addOne,
3054
3099
  addIssueComments: issueCommentAdapter.addMany,
@@ -3077,11 +3122,11 @@ var __publicField = (obj, key, value) => {
3077
3122
  );
3078
3123
  const issueCommentReducer = issueCommentSlice.reducer;
3079
3124
  const issueUpdateAdapter = createModelAdapter((issueUpdate) => issueUpdate.offline_id);
3080
- const initialState$4 = issueUpdateAdapter.getInitialState({});
3125
+ const initialState$7 = issueUpdateAdapter.getInitialState({});
3081
3126
  const issueUpdateSlice = toolkit.createSlice({
3082
3127
  name: "issueUpdates",
3083
- initialState: initialState$4,
3084
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
3128
+ initialState: initialState$7,
3129
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
3085
3130
  reducers: {
3086
3131
  initializeIssueUpdates: issueUpdateAdapter.setMany,
3087
3132
  setIssueUpdate: issueUpdateAdapter.setOne,
@@ -3110,11 +3155,11 @@ var __publicField = (obj, key, value) => {
3110
3155
  );
3111
3156
  const issueUpdateReducer = issueUpdateSlice.reducer;
3112
3157
  const issueAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
3113
- const initialState$3 = issueAttachmentAdapter.getInitialState({});
3158
+ const initialState$6 = issueAttachmentAdapter.getInitialState({});
3114
3159
  const issueAttachmentSlice = toolkit.createSlice({
3115
3160
  name: "issueAttachments",
3116
- initialState: initialState$3,
3117
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
3161
+ initialState: initialState$6,
3162
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
3118
3163
  reducers: {
3119
3164
  initializeIssueAttachments: issueAttachmentAdapter.initialize,
3120
3165
  addIssueAttachment: issueAttachmentAdapter.addOne,
@@ -3172,23 +3217,23 @@ var __publicField = (obj, key, value) => {
3172
3217
  )
3173
3218
  );
3174
3219
  const issueAttachmentReducer = issueAttachmentSlice.reducer;
3175
- const initialState$2 = {
3220
+ const initialState$5 = {
3176
3221
  version: 0
3177
3222
  };
3178
3223
  const versioningSlice = toolkit.createSlice({
3179
3224
  name: "versioning",
3180
- initialState: initialState$2,
3225
+ initialState: initialState$5,
3181
3226
  reducers: {}
3182
3227
  });
3183
3228
  const versioningReducer = versioningSlice.reducer;
3184
3229
  const geoImageAdapter = createModelAdapter((model) => model.offline_id);
3185
- const initialState$1 = geoImageAdapter.getInitialState({});
3230
+ const initialState$4 = geoImageAdapter.getInitialState({});
3186
3231
  const geoImageSlice = toolkit.createSlice({
3187
3232
  name: "geoImages",
3188
- initialState: initialState$1,
3233
+ initialState: initialState$4,
3189
3234
  extraReducers: (builder) => {
3190
3235
  builder.addCase("RESET", (state) => {
3191
- Object.assign(state, initialState$1);
3236
+ Object.assign(state, initialState$4);
3192
3237
  });
3193
3238
  },
3194
3239
  reducers: {
@@ -3226,11 +3271,11 @@ var __publicField = (obj, key, value) => {
3226
3271
  );
3227
3272
  const geoImageReducer = geoImageSlice.reducer;
3228
3273
  const issueAssociationAdapter = createModelAdapter((assoc) => assoc.offline_id);
3229
- const initialState = issueAssociationAdapter.getInitialState({});
3274
+ const initialState$3 = issueAssociationAdapter.getInitialState({});
3230
3275
  const issueAssociationSlice = toolkit.createSlice({
3231
3276
  name: "issueAssociations",
3232
- initialState,
3233
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState)),
3277
+ initialState: initialState$3,
3278
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
3234
3279
  reducers: {
3235
3280
  initializeIssueAssociations: issueAssociationAdapter.initialize,
3236
3281
  addIssueAssociation: issueAssociationAdapter.addOne,
@@ -3288,34 +3333,224 @@ var __publicField = (obj, key, value) => {
3288
3333
  )
3289
3334
  );
3290
3335
  const issueAssociationReducer = issueAssociationSlice.reducer;
3291
- let clientStore;
3292
- function setClientStore(store) {
3293
- clientStore = store;
3294
- }
3295
- function getClientStore() {
3296
- return clientStore;
3297
- }
3298
- let clientSDK;
3299
- function setClientSDK(sdkCtor) {
3300
- clientSDK = sdkCtor;
3301
- }
3302
- function getClientSDK() {
3303
- return clientSDK;
3304
- }
3305
- const CLASS_NAME_TO_SERVICE = {};
3306
- class BaseService {
3307
- constructor(sdk) {
3308
- __publicField(this, "client");
3309
- CLASS_NAME_TO_SERVICE[this.constructor.name] = this;
3310
- this.client = sdk;
3336
+ const assetProcedureAdapter = createModelAdapter((assetProcedure) => assetProcedure.offline_id);
3337
+ const initialState$2 = assetProcedureAdapter.getInitialState({});
3338
+ const assetProcedureSlice = toolkit.createSlice({
3339
+ name: "assetProcedures",
3340
+ initialState: initialState$2,
3341
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$2)),
3342
+ reducers: {
3343
+ initializeAssetProcedures: assetProcedureAdapter.initialize,
3344
+ addAssetProcedure: assetProcedureAdapter.addOne,
3345
+ addAssetProcedures: assetProcedureAdapter.addMany,
3346
+ setAssetProcedure: assetProcedureAdapter.setOne,
3347
+ setAssetProcedures: assetProcedureAdapter.setMany,
3348
+ updateAssetProcedure: assetProcedureAdapter.updateOne,
3349
+ updateAssetProcedures: assetProcedureAdapter.updateMany,
3350
+ deleteAssetProcedure: assetProcedureAdapter.deleteOne,
3351
+ deleteAssetProcedures: assetProcedureAdapter.deleteMany
3311
3352
  }
3312
- async enqueueRequest(requestDetails) {
3313
- return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
3353
+ });
3354
+ const {
3355
+ initializeAssetProcedures,
3356
+ addAssetProcedure,
3357
+ addAssetProcedures,
3358
+ updateAssetProcedure,
3359
+ updateAssetProcedures,
3360
+ deleteAssetProcedure,
3361
+ deleteAssetProcedures,
3362
+ setAssetProcedure,
3363
+ setAssetProcedures
3364
+ } = assetProcedureSlice.actions;
3365
+ const selectAssetProceduresMapping = (state) => state.assetProcedureReducer.instances;
3366
+ const selectAssetProcedures = toolkit.createSelector([selectAssetProceduresMapping], (assetProceduresMapping) => {
3367
+ return Object.values(assetProceduresMapping);
3368
+ });
3369
+ const selectAssetProceduresOfOrganization = restructureCreateSelectorWithArgs(
3370
+ toolkit.createSelector(
3371
+ [selectAssetProcedures, (_state, organizationId) => organizationId],
3372
+ (assetProcedures, organizationId) => {
3373
+ return fallbackToEmptyArray(
3374
+ assetProcedures.filter((assetProcedure) => assetProcedure.organization === organizationId)
3375
+ );
3376
+ }
3377
+ )
3378
+ );
3379
+ const selectAssetProcedureById = (assetProcedureId) => (state) => {
3380
+ return state.assetProcedureReducer.instances[assetProcedureId];
3381
+ };
3382
+ const selectAssetProceduresByIds = restructureCreateSelectorWithArgs(
3383
+ toolkit.createSelector(
3384
+ [selectAssetProceduresMapping, (_, assetProcedureIds) => assetProcedureIds],
3385
+ (assetProceduresMapping, assetProcedureIds) => {
3386
+ const assetProcedures = [];
3387
+ for (const assetProcedureId of assetProcedureIds) {
3388
+ const assetProcedure = assetProceduresMapping[assetProcedureId];
3389
+ if (assetProcedure)
3390
+ assetProcedures.push(assetProcedure);
3391
+ }
3392
+ return fallbackToEmptyArray(assetProcedures);
3393
+ }
3394
+ )
3395
+ );
3396
+ const assetProcedureReducer = assetProcedureSlice.reducer;
3397
+ const assetProcedureInstanceAdapter = createModelAdapter(
3398
+ (assetProcedureInstance) => assetProcedureInstance.offline_id
3399
+ );
3400
+ const initialState$1 = assetProcedureInstanceAdapter.getInitialState({});
3401
+ const assetProcedureInstanceSlice = toolkit.createSlice({
3402
+ name: "assetProcedureInstances",
3403
+ initialState: initialState$1,
3404
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$1)),
3405
+ reducers: {
3406
+ initializeAssetProcedureInstances: assetProcedureInstanceAdapter.initialize,
3407
+ addAssetProcedureInstance: assetProcedureInstanceAdapter.addOne,
3408
+ addAssetProcedureInstances: assetProcedureInstanceAdapter.addMany,
3409
+ setAssetProcedureInstance: assetProcedureInstanceAdapter.setOne,
3410
+ setAssetProcedureInstances: assetProcedureInstanceAdapter.setMany,
3411
+ updateAssetProcedureInstance: assetProcedureInstanceAdapter.updateOne,
3412
+ updateAssetProcedureInstances: assetProcedureInstanceAdapter.updateMany,
3413
+ deleteAssetProcedureInstance: assetProcedureInstanceAdapter.deleteOne,
3414
+ deleteAssetProcedureInstances: assetProcedureInstanceAdapter.deleteMany
3314
3415
  }
3315
- dispatch(action) {
3316
- this.client.store.dispatch(action);
3416
+ });
3417
+ const {
3418
+ initializeAssetProcedureInstances,
3419
+ addAssetProcedureInstance,
3420
+ addAssetProcedureInstances,
3421
+ updateAssetProcedureInstance,
3422
+ updateAssetProcedureInstances,
3423
+ deleteAssetProcedureInstance,
3424
+ deleteAssetProcedureInstances,
3425
+ setAssetProcedureInstance,
3426
+ setAssetProcedureInstances
3427
+ } = assetProcedureInstanceSlice.actions;
3428
+ const selectAssetProcedureInstancesMapping = (state) => state.assetProcedureInstanceReducer.instances;
3429
+ const selectAssetProcedureInstances = toolkit.createSelector(
3430
+ [selectAssetProcedureInstancesMapping],
3431
+ (assetProcedureInstancesMapping) => {
3432
+ return Object.values(assetProcedureInstancesMapping);
3317
3433
  }
3318
- }
3434
+ );
3435
+ const selectAssetProcedureInstancesOfAssetProcedure = restructureCreateSelectorWithArgs(
3436
+ toolkit.createSelector(
3437
+ [selectAssetProcedureInstances, (_state, assetProcedureId) => assetProcedureId],
3438
+ (assetProcedureInstances, assetProcedureId) => {
3439
+ return fallbackToEmptyArray(
3440
+ assetProcedureInstances.filter(
3441
+ (assetProcedureInstance) => assetProcedureInstance.asset_procedure === assetProcedureId
3442
+ )
3443
+ );
3444
+ }
3445
+ )
3446
+ );
3447
+ const selectAssetProcedureInstancesOfAssetType = restructureCreateSelectorWithArgs(
3448
+ toolkit.createSelector(
3449
+ [selectAssetProcedureInstances, (_state, assetTypeId) => assetTypeId],
3450
+ (assetProcedureInstances, assetTypeId) => {
3451
+ return fallbackToEmptyArray(
3452
+ assetProcedureInstances.filter(
3453
+ (assetProcedureInstance) => assetProcedureInstance.asset_type === assetTypeId
3454
+ )
3455
+ );
3456
+ }
3457
+ )
3458
+ );
3459
+ const selectAssetProcedureInstanceById = (assetProcedureInstanceId) => (state) => {
3460
+ return state.assetProcedureInstanceReducer.instances[assetProcedureInstanceId];
3461
+ };
3462
+ const selectAssetProcedureInstancesByIds = restructureCreateSelectorWithArgs(
3463
+ toolkit.createSelector(
3464
+ [selectAssetProcedureInstancesMapping, (_, assetProcedureInstanceIds) => assetProcedureInstanceIds],
3465
+ (assetProcedureInstancesMapping, assetProcedureInstanceIds) => {
3466
+ const assetProcedureInstances = [];
3467
+ for (const assetProcedureInstanceId of assetProcedureInstanceIds) {
3468
+ const assetProcedureInstance = assetProcedureInstancesMapping[assetProcedureInstanceId];
3469
+ if (assetProcedureInstance)
3470
+ assetProcedureInstances.push(assetProcedureInstance);
3471
+ }
3472
+ return fallbackToEmptyArray(assetProcedureInstances);
3473
+ }
3474
+ )
3475
+ );
3476
+ const assetProcedureInstanceReducer = assetProcedureInstanceSlice.reducer;
3477
+ const assetProcedureCompletionAdapter = createModelAdapter(
3478
+ (assetProcedureCompletion) => assetProcedureCompletion.offline_id
3479
+ );
3480
+ const initialState = assetProcedureCompletionAdapter.getInitialState({});
3481
+ const assetProcedureCompletionSlice = toolkit.createSlice({
3482
+ name: "assetProcedureCompletions",
3483
+ initialState,
3484
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState)),
3485
+ reducers: {
3486
+ initializeAssetProcedureCompletions: assetProcedureCompletionAdapter.initialize,
3487
+ addAssetProcedureCompletion: assetProcedureCompletionAdapter.addOne,
3488
+ addAssetProcedureCompletions: assetProcedureCompletionAdapter.addMany,
3489
+ setAssetProcedureCompletion: assetProcedureCompletionAdapter.setOne,
3490
+ setAssetProcedureCompletions: assetProcedureCompletionAdapter.setMany,
3491
+ updateAssetProcedureCompletion: assetProcedureCompletionAdapter.updateOne,
3492
+ updateAssetProcedureCompletions: assetProcedureCompletionAdapter.updateMany,
3493
+ deleteAssetProcedureCompletion: assetProcedureCompletionAdapter.deleteOne,
3494
+ deleteAssetProcedureCompletions: assetProcedureCompletionAdapter.deleteMany
3495
+ }
3496
+ });
3497
+ const {
3498
+ initializeAssetProcedureCompletions,
3499
+ addAssetProcedureCompletion,
3500
+ addAssetProcedureCompletions,
3501
+ updateAssetProcedureCompletion,
3502
+ updateAssetProcedureCompletions,
3503
+ deleteAssetProcedureCompletion,
3504
+ deleteAssetProcedureCompletions,
3505
+ setAssetProcedureCompletion,
3506
+ setAssetProcedureCompletions
3507
+ } = assetProcedureCompletionSlice.actions;
3508
+ const assetProcedureCompletionReducer = assetProcedureCompletionSlice.reducer;
3509
+ const selectAssetProcedureCompletionsMapping = (state) => state.assetProcedureCompletionReducer.instances;
3510
+ const selectAssetProcedureCompletions = toolkit.createSelector(
3511
+ [selectAssetProcedureCompletionsMapping],
3512
+ (assetProcedureCompletionsMapping) => {
3513
+ return Object.values(assetProcedureCompletionsMapping);
3514
+ }
3515
+ );
3516
+ const selectAssetProcedureCompletionsOfAsset = restructureCreateSelectorWithArgs(
3517
+ toolkit.createSelector(
3518
+ [selectAssetProcedureCompletions, (_state, id) => id],
3519
+ (assetProcedureCompletions, id) => {
3520
+ return fallbackToEmptyArray(
3521
+ assetProcedureCompletions.filter(
3522
+ (assetProcedureCompletion) => assetProcedureCompletion.asset === id
3523
+ )
3524
+ );
3525
+ }
3526
+ )
3527
+ );
3528
+ const selectAssetProcedureCompletionsOfAssetProcedureInstance = restructureCreateSelectorWithArgs(
3529
+ toolkit.createSelector([selectAssetProcedureCompletions, (_state, id) => id], (assetProcedureCompletions, id) => {
3530
+ return fallbackToEmptyArray(
3531
+ assetProcedureCompletions.filter(
3532
+ (assetProcedureCompletion) => assetProcedureCompletion.asset_procedure_instance === id
3533
+ )
3534
+ );
3535
+ })
3536
+ );
3537
+ const selectAssetProcedureCompletionById = (assetProcedureCompletionId) => (state) => {
3538
+ return state.assetProcedureCompletionReducer.instances[assetProcedureCompletionId];
3539
+ };
3540
+ const selectAssetProcedureCompletionsByIds = restructureCreateSelectorWithArgs(
3541
+ toolkit.createSelector(
3542
+ [selectAssetProcedureCompletionsMapping, (_, ids) => ids],
3543
+ (assetProcedureCompletionsMapping, ids) => {
3544
+ const assetProcedureCompletions = [];
3545
+ for (const assetProcedureCompletionId of ids) {
3546
+ const assetProcedureCompletion = assetProcedureCompletionsMapping[assetProcedureCompletionId];
3547
+ if (assetProcedureCompletion)
3548
+ assetProcedureCompletions.push(assetProcedureCompletion);
3549
+ }
3550
+ return fallbackToEmptyArray(assetProcedureCompletions);
3551
+ }
3552
+ )
3553
+ );
3319
3554
  const VERSION_REDUCER_KEY = "versioning";
3320
3555
  const overmapReducers = {
3321
3556
  // TODO: attachmentReducer,
@@ -4107,43 +4342,70 @@ var __publicField = (obj, key, value) => {
4107
4342
  return chunks;
4108
4343
  }
4109
4344
  class AssetService extends BaseApiService {
4110
- // Basic CRUD functions
4111
- add(asset, workspaceId) {
4112
- if (!asset.canvas_marker && !asset.geo_marker) {
4345
+ add(payload) {
4346
+ const { store } = this.client;
4347
+ if (!payload.canvas_marker && !payload.geo_marker) {
4113
4348
  throw new Error("Asset must have either a canvas_marker or geo_marker");
4114
4349
  }
4115
- const offlineAsset = offline(asset);
4350
+ const createdBy = store.getState().userReducer.currentUser.id;
4351
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4352
+ const offlineAsset = offline({
4353
+ ...payload,
4354
+ created_by: createdBy,
4355
+ submitted_at: submittedAt
4356
+ });
4116
4357
  this.dispatch(addAsset(offlineAsset));
4117
4358
  const promise = this.enqueueRequest({
4118
4359
  description: "Create asset",
4119
4360
  method: HttpMethod.POST,
4120
- url: `/assets/types/${offlineAsset.asset_type}/add-assets/`,
4121
- queryParams: {
4122
- workspace_id: workspaceId.toString()
4361
+ url: "/assets/",
4362
+ payload: {
4363
+ offline_id: offlineAsset.offline_id,
4364
+ submitted_at: offlineAsset.submitted_at,
4365
+ geo_marker: offlineAsset.geo_marker,
4366
+ canvas_marker: offlineAsset.canvas_marker,
4367
+ label: offlineAsset.label,
4368
+ description: offlineAsset.description,
4369
+ asset_type: offlineAsset.asset_type
4123
4370
  },
4124
- payload: { assets: [offlineAsset] },
4125
- blockers: [],
4371
+ blockers: [offlineAsset.asset_type],
4126
4372
  blocks: [offlineAsset.offline_id]
4127
4373
  });
4374
+ promise.then((createdAsset) => {
4375
+ this.dispatch(updateAsset(createdAsset));
4376
+ }).catch(() => {
4377
+ this.dispatch(deleteAsset(offlineAsset.offline_id));
4378
+ });
4128
4379
  return [offlineAsset, promise];
4129
4380
  }
4130
- update(asset, workspaceId) {
4131
- if (!asset.canvas_marker && !asset.geo_marker) {
4381
+ update(payload) {
4382
+ const { store } = this.client;
4383
+ if (!payload.canvas_marker && !payload.geo_marker) {
4132
4384
  throw new Error("Asset must have either a canvas_marker or geo_marker");
4133
4385
  }
4134
- this.client.store.dispatch(updateAsset(asset));
4386
+ const asset = selectAssetById(payload.offline_id)(store.getState());
4387
+ if (!asset) {
4388
+ throw new Error(`No asset with id ${payload.offline_id} found in the store`);
4389
+ }
4390
+ const updatedAsset = {
4391
+ ...asset,
4392
+ ...payload
4393
+ };
4394
+ this.dispatch(updateAsset(updatedAsset));
4135
4395
  const promise = this.enqueueRequest({
4136
4396
  description: "Edit asset",
4137
4397
  method: HttpMethod.PATCH,
4138
- url: `/assets/${asset.offline_id}/`,
4139
- queryParams: {
4140
- workspace_id: workspaceId.toString()
4141
- },
4142
- payload: asset,
4143
- blockers: [asset.offline_id],
4144
- blocks: [asset.offline_id]
4398
+ url: `/assets/${payload.offline_id}/`,
4399
+ payload,
4400
+ blockers: [payload.offline_id],
4401
+ blocks: [payload.offline_id]
4402
+ });
4403
+ promise.then((result) => {
4404
+ this.dispatch(updateAsset(result));
4405
+ }).catch(() => {
4406
+ this.dispatch(updateAsset(asset));
4145
4407
  });
4146
- return [asset, promise];
4408
+ return [updatedAsset, promise];
4147
4409
  }
4148
4410
  async remove(assetId) {
4149
4411
  const { store } = this.client;
@@ -4181,39 +4443,17 @@ var __publicField = (obj, key, value) => {
4181
4443
  throw err;
4182
4444
  });
4183
4445
  }
4184
- async deleteAllAssetsOfAssetType(assetTypeId) {
4185
- const { store } = this.client;
4186
- const state = store.getState();
4187
- const allAssetsOfAssetType = selectAssetsOfAssetType(assetTypeId)(state);
4188
- const allAssetsOfAssetTypeIds = allAssetsOfAssetType.map((c) => c.offline_id);
4189
- const affectedOfflineIds = [assetTypeId, ...allAssetsOfAssetTypeIds];
4190
- store.dispatch(deleteAssets(allAssetsOfAssetTypeIds));
4191
- return this.enqueueRequest({
4192
- description: "Delete all assets of asset type",
4193
- method: HttpMethod.DELETE,
4194
- url: `/assets/types/${assetTypeId}/delete-all-of-type/`,
4195
- blockers: affectedOfflineIds,
4196
- blocks: affectedOfflineIds
4197
- }).catch((err) => {
4198
- store.dispatch(addAssets(allAssetsOfAssetType));
4199
- throw err;
4200
- });
4201
- }
4202
- // TODO: payload does not require asset_type
4203
- bulkAdd(assetsToCreate, workspaceId, assetTypeId, batchSize) {
4446
+ bulkAdd(payloads, assetTypeId, batchSize) {
4204
4447
  const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4205
4448
  const transactionId = uuid.v4();
4206
- const assetBatches = chunkArray(assetsToCreate, batchSize).map((assetBatch) => {
4207
- const assetPayloads = assetBatch.map((assetPayload) => {
4208
- return offline({
4209
- ...assetPayload,
4210
- submitted_at: submittedAt
4211
- });
4212
- });
4449
+ const assetBatches = chunkArray(payloads, batchSize).map((assetBatch) => {
4450
+ const assetPayloads = assetBatch.map((assetPayload) => offline(assetPayload));
4213
4451
  return {
4214
4452
  batchId: uuid.v4(),
4215
4453
  payload: {
4216
4454
  transaction_id: transactionId,
4455
+ submitted_at: submittedAt,
4456
+ asset_type: assetTypeId,
4217
4457
  assets: assetPayloads
4218
4458
  }
4219
4459
  };
@@ -4231,10 +4471,7 @@ var __publicField = (obj, key, value) => {
4231
4471
  const promise = this.enqueueRequest({
4232
4472
  description: "Batch create assets",
4233
4473
  method: HttpMethod.POST,
4234
- url: `/assets/types/${assetTypeId}/add-assets/`,
4235
- queryParams: {
4236
- workspace_id: workspaceId.toString()
4237
- },
4474
+ url: "/assets/bulk/",
4238
4475
  payload,
4239
4476
  blockers,
4240
4477
  blocks: blocks2
@@ -4252,7 +4489,10 @@ var __publicField = (obj, key, value) => {
4252
4489
  const result = await this.enqueueRequest({
4253
4490
  description: "Get assets",
4254
4491
  method: HttpMethod.GET,
4255
- url: `/projects/${projectId}/assets/`,
4492
+ url: "/assets/",
4493
+ queryParams: {
4494
+ project_id: projectId.toString()
4495
+ },
4256
4496
  blockers: [],
4257
4497
  blocks: []
4258
4498
  });
@@ -4260,154 +4500,217 @@ var __publicField = (obj, key, value) => {
4260
4500
  }
4261
4501
  }
4262
4502
  class AssetStageCompletionService extends BaseApiService {
4263
- add(assetId, stageId) {
4264
- var _a2;
4503
+ add(payload) {
4265
4504
  const { store } = this.client;
4266
- const assetTypeId = (_a2 = selectAssetById(assetId)(store.getState())) == null ? void 0 : _a2.asset_type;
4267
- if (!assetTypeId) {
4268
- throw new Error(`Asset with offline_id ${assetId} not found`);
4269
- }
4505
+ const createdBy = store.getState().userReducer.currentUser.id;
4506
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4270
4507
  const offlineStageCompletion = offline({
4271
- asset: assetId,
4272
- stage: stageId
4508
+ ...payload,
4509
+ created_by: createdBy,
4510
+ submitted_at: submittedAt
4273
4511
  });
4274
- this.dispatch(addStageCompletion(offlineStageCompletion));
4512
+ this.dispatch(addAssetStageCompletion(offlineStageCompletion));
4275
4513
  const promise = this.enqueueRequest({
4276
- description: "Complete stage",
4514
+ description: "Add asset stage completion",
4277
4515
  method: HttpMethod.POST,
4278
- url: `/assets/types/${assetTypeId}/complete-stages/`,
4279
- // TODO: Add submitted_at to model
4280
- payload: { completions: [{ ...offlineStageCompletion, submitted_at: (/* @__PURE__ */ new Date()).getTime() / 1e3 }] },
4281
- blockers: [assetId, stageId],
4516
+ url: "/asset-stage-completions/",
4517
+ payload: {
4518
+ offline_id: offlineStageCompletion.offline_id,
4519
+ submitted_at: submittedAt,
4520
+ asset_procedure_completion: payload.asset_procedure_completion,
4521
+ stage: payload.stage
4522
+ },
4523
+ blockers: [payload.asset_procedure_completion, payload.stage],
4282
4524
  blocks: [offlineStageCompletion.offline_id]
4283
4525
  });
4526
+ promise.then((result) => {
4527
+ this.dispatch(updateAssetStageCompletion(result));
4528
+ }).catch(() => {
4529
+ this.dispatch(deleteAssetStageCompletion(offlineStageCompletion.offline_id));
4530
+ });
4284
4531
  return [offlineStageCompletion, promise];
4285
4532
  }
4286
- async refreshStore(projectId) {
4287
- const result = await this.enqueueRequest({
4288
- description: "Get stage completions",
4289
- method: HttpMethod.GET,
4290
- url: `/projects/${projectId}/asset-stage-completions/`,
4291
- blockers: [],
4533
+ delete(id) {
4534
+ const { store } = this.client;
4535
+ const assetStageCompletion = selectAssetStageCompletionById(id)(store.getState());
4536
+ if (!assetStageCompletion) {
4537
+ throw new Error(`Expected asset stage completion with id ${id} to exist`);
4538
+ }
4539
+ this.dispatch(deleteAssetStageCompletion(id));
4540
+ const promise = this.enqueueRequest({
4541
+ description: "Delete asset stage completion",
4542
+ method: HttpMethod.DELETE,
4543
+ url: `/asset-stage-completions/${id}/`,
4544
+ blockers: [id],
4292
4545
  blocks: []
4293
4546
  });
4294
- this.dispatch(addStageCompletions(result));
4547
+ promise.catch(() => {
4548
+ this.dispatch(addAssetStageCompletion(assetStageCompletion));
4549
+ });
4550
+ return promise;
4295
4551
  }
4296
- /**
4297
- * Creates a collection of AssetStageCompletions, marking the referenced stages as completed for the referenced
4298
- * assets. It's REQUIRED that all assets referenced all have the SAME asset type.
4299
- * @param assetTypeId The ID of the asset type for which we are completing stages (we can only complete
4300
- * stages for one asset type at a time)
4301
- * @param stageCompletions
4302
- */
4303
- async bulkAdd(assetTypeId, stageCompletions) {
4304
- const offlineStageCompletions = stageCompletions.map((completion) => {
4305
- return offline(completion);
4306
- });
4307
- const asMapping = {};
4308
- for (const completion of stageCompletions) {
4309
- const stageToCompletionDateMapping = asMapping[completion.asset] || {};
4310
- stageToCompletionDateMapping[completion.stage] = (/* @__PURE__ */ new Date()).toISOString();
4311
- asMapping[completion.asset] = stageToCompletionDateMapping;
4312
- }
4313
- this.dispatch(addStageCompletions(asMapping));
4314
- await this.enqueueRequest({
4315
- description: "Bulk complete stages",
4552
+ bulkAdd(payloads) {
4553
+ const { store } = this.client;
4554
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4555
+ const createdBy = store.getState().userReducer.currentUser.id;
4556
+ const payload = payloads.map((payload2) => offline(payload2));
4557
+ const offlineStageCompletions = payload.map((completion) => {
4558
+ return {
4559
+ ...completion,
4560
+ created_by: createdBy,
4561
+ submitted_at: submittedAt
4562
+ };
4563
+ });
4564
+ const offlineIds = offlineStageCompletions.map(({ offline_id }) => offline_id);
4565
+ this.dispatch(addAssetStageCompletions(offlineStageCompletions));
4566
+ const promise = this.enqueueRequest({
4567
+ description: "Bulk create asset stage completions",
4316
4568
  method: HttpMethod.POST,
4317
- url: `/assets/types/${assetTypeId}/complete-stages/`,
4569
+ url: "/asset-stage-completions/bulk/",
4570
+ payload: {
4571
+ submitted_at: submittedAt,
4572
+ completions: payload
4573
+ },
4574
+ blockers: [...payloads.map((c) => c.asset_procedure_completion), ...payloads.map((c) => c.stage)],
4575
+ blocks: offlineIds
4576
+ });
4577
+ promise.then((result) => {
4578
+ this.dispatch(updateAssetStageCompletions(result));
4579
+ }).catch(() => {
4580
+ this.dispatch(deleteAssetStageCompletions(offlineIds));
4581
+ });
4582
+ return [offlineStageCompletions, promise];
4583
+ }
4584
+ bulkDelete(ids) {
4585
+ const { store } = this.client;
4586
+ const assetStageCompletions = selectAssetStageCompletionsByIds(ids)(store.getState());
4587
+ this.dispatch(deleteAssetStageCompletions(ids));
4588
+ const promise = this.enqueueRequest({
4589
+ description: "Deleting asset stage completions",
4590
+ method: HttpMethod.DELETE,
4591
+ url: "/asset-stage-completions/bulk/",
4318
4592
  payload: {
4319
- completions: offlineStageCompletions
4593
+ completion_ids: ids
4320
4594
  },
4321
- blockers: [assetTypeId, ...stageCompletions.map((c) => c.asset), ...stageCompletions.map((c) => c.stage)],
4322
- blocks: offlineStageCompletions.map((c) => c.offline_id)
4595
+ blockers: ids,
4596
+ blocks: []
4323
4597
  });
4324
- }
4325
- bulkDelete(stageId, assetIds) {
4326
- const stageCompletionsToRemove = assetIds.map((assetId) => {
4327
- return {
4328
- asset: assetId,
4329
- stage: stageId
4330
- };
4598
+ promise.catch(() => {
4599
+ this.dispatch(addAssetStageCompletions(assetStageCompletions));
4331
4600
  });
4332
- this.dispatch(removeStageCompletions(stageCompletionsToRemove));
4333
- return this.enqueueRequest({
4334
- description: `Undo stage for ${assetIds.length} assets(s)`,
4335
- // TODO: Rename to setCompletedStages
4336
- method: HttpMethod.DELETE,
4337
- url: `/assets/stages/${stageId}/undo-stages/`,
4338
- payload: {
4339
- assets: assetIds
4601
+ return promise;
4602
+ }
4603
+ async refreshStore(projectId) {
4604
+ const result = await this.enqueueRequest({
4605
+ description: "Get asset stage completions",
4606
+ method: HttpMethod.GET,
4607
+ url: "/asset-stage-completions/",
4608
+ queryParams: {
4609
+ project_id: projectId.toString()
4340
4610
  },
4341
- blockers: [stageId, ...assetIds],
4611
+ blockers: [],
4342
4612
  blocks: []
4343
4613
  });
4614
+ this.dispatch(initializeAssetStageCompletions(result));
4344
4615
  }
4345
4616
  }
4346
4617
  class AssetStageService extends BaseApiService {
4347
- async bulkCreateStages(stagesToSubmit, assetTypeId, workspaceId) {
4618
+ bulkAdd(stagesToSubmit, assetProcedureId) {
4619
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4620
+ const createdBy = this.client.store.getState().userReducer.currentUser.id;
4348
4621
  const payload = stagesToSubmit.map((stage) => {
4349
4622
  return offline(stage);
4350
4623
  });
4351
- const fullStages = payload.map((stage) => {
4352
- return { ...stage, asset_type: assetTypeId };
4624
+ const offlineStages = payload.map((stage) => {
4625
+ return { ...stage, asset_procedure: assetProcedureId, created_by: createdBy, submitted_at: submittedAt };
4353
4626
  });
4354
- this.dispatch(addStages(fullStages));
4355
- return this.enqueueRequest({
4627
+ this.dispatch(addAssetStages(offlineStages));
4628
+ const promise = this.enqueueRequest({
4356
4629
  description: "Add asset stages",
4357
4630
  method: HttpMethod.POST,
4358
- url: `/assets/types/${assetTypeId}/add-stages/`,
4631
+ url: "/asset-stages/bulk/",
4359
4632
  payload: {
4633
+ submitted_at: submittedAt,
4634
+ asset_procedure: assetProcedureId,
4360
4635
  stages: payload
4361
4636
  },
4362
- queryParams: {
4363
- workspace_id: workspaceId.toString()
4364
- },
4365
- blockers: [assetTypeId, workspaceId],
4637
+ blockers: [assetProcedureId],
4366
4638
  blocks: payload.map(({ offline_id }) => offline_id)
4367
4639
  });
4640
+ promise.then((result) => {
4641
+ this.dispatch(updateAssetStages(result));
4642
+ }).catch(() => {
4643
+ this.dispatch(deleteAssetStages(offlineStages.map(({ offline_id }) => offline_id)));
4644
+ });
4645
+ return [offlineStages, promise];
4368
4646
  }
4369
- async bulkUpdateStages(stagesToUpdate, assetTypeId) {
4647
+ async bulkUpdate(stagesToUpdate, assetProcedureId) {
4370
4648
  const store = this.client.store;
4371
4649
  const state = store.getState();
4372
4650
  const prevStages = selectAssetStagesByIds(stagesToUpdate.map(({ offline_id }) => offline_id))(state);
4373
- this.dispatch(updateStages(stagesToUpdate));
4651
+ this.dispatch(updateAssetStages(stagesToUpdate));
4374
4652
  return this.enqueueRequest({
4375
4653
  description: "Edit asset stages",
4376
4654
  method: HttpMethod.PATCH,
4377
- url: `/assets/types/${assetTypeId}/bulk-update-stages/`,
4655
+ url: `/asset-procedures/${assetProcedureId}/bulk-update-stages/`,
4378
4656
  payload: {
4379
4657
  stages: stagesToUpdate
4380
4658
  },
4381
- blockers: [assetTypeId],
4659
+ blockers: [assetProcedureId],
4382
4660
  blocks: stagesToUpdate.map(({ offline_id }) => offline_id)
4383
4661
  }).catch((e) => {
4384
- store.dispatch(updateStages(prevStages));
4662
+ this.dispatch(updateAssetStages(prevStages));
4385
4663
  throw e;
4386
4664
  });
4387
4665
  }
4388
4666
  async bulkDelete(idsToDelete) {
4389
- this.dispatch(removeStages(idsToDelete));
4390
- return this.enqueueRequest({
4667
+ const { store } = this.client;
4668
+ const assetStages = selectAssetStagesByIds(idsToDelete)(store.getState());
4669
+ this.dispatch(deleteAssetStages(idsToDelete));
4670
+ const promise = this.enqueueRequest({
4391
4671
  description: "Delete asset stages",
4392
4672
  method: HttpMethod.DELETE,
4393
- url: "/assets/stages/bulk-delete/",
4673
+ url: "/asset-stages/bulk/",
4394
4674
  payload: {
4395
4675
  stage_ids: idsToDelete
4396
4676
  },
4397
4677
  blockers: idsToDelete,
4398
4678
  blocks: []
4399
4679
  });
4680
+ promise.catch(() => {
4681
+ this.dispatch(addAssetStages(assetStages));
4682
+ });
4683
+ return promise;
4400
4684
  }
4401
- async update(assetStage) {
4402
- this.dispatch(addStages([assetStage]));
4403
- return this.enqueueRequest({
4685
+ update(payload) {
4686
+ const { store } = this.client;
4687
+ const assetStage = selectAssetStageById(payload.offline_id)(store.getState());
4688
+ if (!assetStage)
4689
+ throw new Error(`No asset stage with id ${payload.offline_id} found in the store`);
4690
+ const updatedAssetStage = {
4691
+ ...assetStage,
4692
+ ...payload
4693
+ };
4694
+ this.dispatch(updateAssetStage(updatedAssetStage));
4695
+ const promise = this.enqueueRequest({
4404
4696
  description: "Update asset stage",
4405
4697
  method: HttpMethod.PATCH,
4406
- url: `/assets/stages/${assetStage.offline_id}/`,
4407
- payload: assetStage,
4698
+ url: `/asset-stages/${assetStage.offline_id}/`,
4699
+ payload: {
4700
+ name: payload.name,
4701
+ description: payload.description,
4702
+ priority: payload.priority,
4703
+ color: payload.color
4704
+ },
4408
4705
  blockers: [assetStage.offline_id],
4409
4706
  blocks: [assetStage.offline_id]
4410
4707
  });
4708
+ promise.then((result) => {
4709
+ this.dispatch(updateAssetStage(result));
4710
+ }).catch(() => {
4711
+ this.dispatch(setAssetStage(assetStage));
4712
+ });
4713
+ return [updatedAssetStage, promise];
4411
4714
  }
4412
4715
  async linkForm(stageId, formId) {
4413
4716
  const { store } = this.client;
@@ -4415,18 +4718,18 @@ var __publicField = (obj, key, value) => {
4415
4718
  if (!stage) {
4416
4719
  throw new Error(`No asset stage with id ${stageId} found in the store`);
4417
4720
  }
4418
- this.dispatch(updateStage({ ...stage, form: formId }));
4721
+ this.dispatch(updateAssetStage({ ...stage, form: formId }));
4419
4722
  try {
4420
4723
  await this.enqueueRequest({
4421
4724
  description: "Link asset stage to form",
4422
4725
  method: HttpMethod.POST,
4423
- url: `/assets/stages/${stageId}/associate-with-form/`,
4726
+ url: `/asset-stages/${stageId}/associate-with-form/`,
4424
4727
  payload: { form: formId },
4425
4728
  blockers: [stageId, formId],
4426
4729
  blocks: [stageId]
4427
4730
  });
4428
4731
  } catch (e) {
4429
- this.dispatch(setStage(stage));
4732
+ this.dispatch(setAssetStage(stage));
4430
4733
  throw e;
4431
4734
  }
4432
4735
  }
@@ -4436,29 +4739,32 @@ var __publicField = (obj, key, value) => {
4436
4739
  if (!stage) {
4437
4740
  throw new Error(`No asset stage with id ${stageId} found in the store`);
4438
4741
  }
4439
- this.dispatch(updateStage({ ...stage, form: void 0 }));
4742
+ this.dispatch(updateAssetStage({ ...stage, form: void 0 }));
4440
4743
  try {
4441
4744
  await this.enqueueRequest({
4442
4745
  description: "Unlink asset stage from form",
4443
4746
  method: HttpMethod.DELETE,
4444
- url: `/assets/stages/${stageId}/associate-with-form/`,
4747
+ url: `/asset-stages/${stageId}/associate-with-form/`,
4445
4748
  blockers: [stageId, formId],
4446
4749
  blocks: [stageId]
4447
4750
  });
4448
4751
  } catch (e) {
4449
- this.dispatch(setStage(stage));
4752
+ this.dispatch(setAssetStage(stage));
4450
4753
  throw e;
4451
4754
  }
4452
4755
  }
4453
- async refreshStore(projectId) {
4756
+ async refreshStore(organizationId) {
4454
4757
  const result = await this.enqueueRequest({
4455
4758
  description: "Get asset stages",
4456
4759
  method: HttpMethod.GET,
4457
- url: `/projects/${projectId}/asset-stages/`,
4760
+ url: "/asset-stages/",
4761
+ queryParams: {
4762
+ organization_id: organizationId.toString()
4763
+ },
4458
4764
  blockers: [],
4459
4765
  blocks: []
4460
4766
  });
4461
- this.dispatch(initializeStages(result));
4767
+ this.dispatch(initializeAssetStages(result));
4462
4768
  }
4463
4769
  }
4464
4770
  class BaseUploadService extends BaseApiService {
@@ -4665,29 +4971,64 @@ var __publicField = (obj, key, value) => {
4665
4971
  }
4666
4972
  }
4667
4973
  class AssetTypeService extends BaseApiService {
4668
- add(assetType) {
4669
- const offlineAssetType = offline(assetType);
4974
+ add(payload) {
4975
+ const { store } = this.client;
4976
+ const createdBy = store.getState().userReducer.currentUser.id;
4977
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4978
+ const offlineAssetType = offline({
4979
+ ...payload,
4980
+ created_by: createdBy,
4981
+ submitted_at: submittedAt
4982
+ });
4670
4983
  this.dispatch(addAssetType(offlineAssetType));
4671
4984
  const promise = this.enqueueRequest({
4672
4985
  description: "Create asset type",
4673
4986
  method: HttpMethod.POST,
4674
- url: `/projects/${assetType.project}/asset-types/`,
4987
+ url: "/asset-types/",
4988
+ queryParams: {
4989
+ project_id: payload.project.toString()
4990
+ },
4675
4991
  payload: { ...offlineAssetType },
4676
4992
  blockers: [],
4677
4993
  blocks: [offlineAssetType.offline_id]
4678
4994
  });
4995
+ promise.then((result) => {
4996
+ this.dispatch(updateAssetType(result));
4997
+ }).catch(() => {
4998
+ this.dispatch(deleteAssetType(offlineAssetType.offline_id));
4999
+ });
4679
5000
  return [offlineAssetType, promise];
4680
5001
  }
4681
- update(assetType) {
4682
- this.dispatch(addAssetType(assetType));
4683
- return this.enqueueRequest({
5002
+ update(payload) {
5003
+ const { store } = this.client;
5004
+ const assetType = selectAssetTypeById(payload.offline_id)(store.getState());
5005
+ if (!assetType) {
5006
+ throw new Error(`Expected asset type with offline_id ${payload.offline_id} to exist`);
5007
+ }
5008
+ const updatedAssetType = {
5009
+ ...assetType,
5010
+ ...payload
5011
+ };
5012
+ this.dispatch(updateAssetType(updatedAssetType));
5013
+ const promise = this.enqueueRequest({
4684
5014
  description: "Update asset type",
4685
5015
  method: HttpMethod.PATCH,
4686
- url: `/assets/types/${assetType.offline_id}/`,
4687
- payload: assetType,
5016
+ url: `/asset-types/${payload.offline_id}/`,
5017
+ payload: {
5018
+ icon: payload.icon,
5019
+ color: payload.color,
5020
+ name: payload.name,
5021
+ description: payload.description
5022
+ },
4688
5023
  blockers: [assetType.offline_id],
4689
5024
  blocks: [assetType.offline_id]
4690
5025
  });
5026
+ promise.then((result) => {
5027
+ this.dispatch(updateAssetType(result));
5028
+ }).catch(() => {
5029
+ this.dispatch(updateAssetType(assetType));
5030
+ });
5031
+ return [updatedAssetType, promise];
4691
5032
  }
4692
5033
  async delete(assetTypeId) {
4693
5034
  const { store } = this.client;
@@ -4696,26 +5037,23 @@ var __publicField = (obj, key, value) => {
4696
5037
  if (!assetType) {
4697
5038
  throw new Error(`Expected asset type with offline_id ${assetTypeId} to exist`);
4698
5039
  }
4699
- const stagesOfAssetType = selectStagesOfAssetType(assetTypeId)(state);
5040
+ const assetsOfAssetType = selectAssetsOfAssetType(assetTypeId)(state);
5041
+ const stagesOfAssetType = selectAssetStagesOfAssetProcedure(assetTypeId)(state);
4700
5042
  const attachmentsOfAssetType = selectAttachmentsOfAssetType(assetTypeId)(state);
4701
5043
  this.dispatch(deleteAssetType(assetTypeId));
4702
- if (stagesOfAssetType.length > 0) {
4703
- const stagesOfAssetTypeIds = stagesOfAssetType.map((assetStage) => assetStage.offline_id);
4704
- this.dispatch(removeStages(stagesOfAssetTypeIds));
4705
- }
4706
- if (attachmentsOfAssetType.length > 0) {
4707
- const attachmentsOfAssetTypeIds = attachmentsOfAssetType.map(({ offline_id }) => offline_id);
4708
- this.dispatch(deleteAssetTypeAttachments(attachmentsOfAssetTypeIds));
4709
- }
5044
+ this.dispatch(deleteAssets(assetsOfAssetType.map((asset) => asset.offline_id)));
5045
+ this.dispatch(deleteAssetStages(stagesOfAssetType.map((assetStage) => assetStage.offline_id)));
5046
+ this.dispatch(deleteAssetTypeAttachments(attachmentsOfAssetType.map(({ offline_id }) => offline_id)));
4710
5047
  return this.enqueueRequest({
4711
5048
  description: "Delete asset type",
4712
5049
  method: HttpMethod.DELETE,
4713
- url: `/assets/types/${assetTypeId}/`,
5050
+ url: `/asset-types/${assetTypeId}/`,
4714
5051
  blockers: [assetTypeId],
4715
5052
  blocks: []
4716
5053
  }).catch((e) => {
4717
5054
  this.dispatch(addAssetType(assetType));
4718
- this.dispatch(addStages(stagesOfAssetType));
5055
+ this.dispatch(addAssets(assetsOfAssetType));
5056
+ this.dispatch(addAssetStages(stagesOfAssetType));
4719
5057
  this.dispatch(addAssetTypeAttachments(attachmentsOfAssetType));
4720
5058
  throw e;
4721
5059
  });
@@ -4724,7 +5062,10 @@ var __publicField = (obj, key, value) => {
4724
5062
  const result = await this.enqueueRequest({
4725
5063
  description: "Get asset types",
4726
5064
  method: HttpMethod.GET,
4727
- url: `/projects/${projectId}/asset-types/`,
5065
+ url: "/asset-types/",
5066
+ queryParams: {
5067
+ project_id: projectId.toString()
5068
+ },
4728
5069
  blockers: [],
4729
5070
  blocks: []
4730
5071
  });
@@ -4929,15 +5270,6 @@ var __publicField = (obj, key, value) => {
4929
5270
  void promise.then((result) => {
4930
5271
  this.dispatch(updateIssue(result));
4931
5272
  }).catch((error) => {
4932
- var _a2;
4933
- console.error(error);
4934
- if (error instanceof APIError) {
4935
- (_a2 = blocks.unsafeShowToast) == null ? void 0 : _a2.call(blocks, {
4936
- title: "Could not create issue",
4937
- description: error.message,
4938
- accentColor: "red"
4939
- });
4940
- }
4941
5273
  this.dispatch(deleteIssue(issuePayload.offline_id));
4942
5274
  this.dispatch(addActiveProjectIssuesCount(-1));
4943
5275
  throw error;
@@ -7493,11 +7825,321 @@ var __publicField = (obj, key, value) => {
7493
7825
  this.dispatch(initializeIssueAssociations(issueAssociations));
7494
7826
  }
7495
7827
  }
7828
+ class AssetProcedureCompletionService extends BaseApiService {
7829
+ add(payload) {
7830
+ const { store } = this.client;
7831
+ const createdBy = store.getState().userReducer.currentUser.id;
7832
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7833
+ const offlineProcedureCompletion = offline({
7834
+ ...payload,
7835
+ created_by: createdBy,
7836
+ submitted_at: submittedAt
7837
+ });
7838
+ this.dispatch(addAssetProcedureCompletion(offlineProcedureCompletion));
7839
+ const promise = this.enqueueRequest({
7840
+ description: "Add asset procedure completion",
7841
+ method: HttpMethod.POST,
7842
+ url: "/asset-procedure-completions/",
7843
+ payload: {
7844
+ offline_id: offlineProcedureCompletion.offline_id,
7845
+ submitted_at: submittedAt,
7846
+ asset: payload.asset,
7847
+ asset_procedure_instance: payload.asset_procedure_instance
7848
+ },
7849
+ blockers: [payload.asset, payload.asset_procedure_instance],
7850
+ blocks: [offlineProcedureCompletion.offline_id]
7851
+ });
7852
+ promise.then((result) => {
7853
+ this.dispatch(updateAssetProcedureCompletion(result));
7854
+ }).catch(() => {
7855
+ this.dispatch(deleteAssetProcedureCompletion(offlineProcedureCompletion.offline_id));
7856
+ });
7857
+ return [offlineProcedureCompletion, promise];
7858
+ }
7859
+ bulkAdd(payloads) {
7860
+ const { store } = this.client;
7861
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7862
+ const createdBy = store.getState().userReducer.currentUser.id;
7863
+ const completionPayloads = payloads.map((payload) => offline(payload));
7864
+ const offlineProcedureCompletions = completionPayloads.map((completion) => {
7865
+ return {
7866
+ ...completion,
7867
+ created_by: createdBy,
7868
+ submitted_at: submittedAt
7869
+ };
7870
+ });
7871
+ const offlineIds = offlineProcedureCompletions.map(({ offline_id }) => offline_id);
7872
+ this.dispatch(addAssetProcedureCompletions(offlineProcedureCompletions));
7873
+ const promise = this.enqueueRequest({
7874
+ description: "Bulk create asset procedure completions",
7875
+ method: HttpMethod.POST,
7876
+ url: "/asset-procedure-completions/bulk/",
7877
+ payload: {
7878
+ submitted_at: submittedAt,
7879
+ asset_procedure_completions: completionPayloads
7880
+ },
7881
+ blockers: [...payloads.map((c) => c.asset), ...payloads.map((c) => c.asset_procedure_instance)],
7882
+ blocks: offlineIds
7883
+ });
7884
+ promise.then((result) => {
7885
+ this.dispatch(updateAssetProcedureCompletions(result));
7886
+ }).catch(() => {
7887
+ this.dispatch(deleteAssetProcedureCompletions(offlineIds));
7888
+ });
7889
+ return [offlineProcedureCompletions, promise];
7890
+ }
7891
+ async delete(id) {
7892
+ const { store } = this.client;
7893
+ const assetProcedureCompletion = selectAssetProcedureCompletionById(id)(store.getState());
7894
+ if (!assetProcedureCompletion) {
7895
+ throw new Error(`Expected asset procedure completion with id ${id} to exist`);
7896
+ }
7897
+ this.dispatch(deleteAssetProcedureCompletion(id));
7898
+ const promise = this.enqueueRequest({
7899
+ description: "Delete asset procedure completion",
7900
+ method: HttpMethod.DELETE,
7901
+ url: `/asset-procedure-completions/${id}/`,
7902
+ blockers: [id],
7903
+ blocks: []
7904
+ });
7905
+ promise.catch(() => {
7906
+ this.dispatch(addAssetProcedureCompletion(assetProcedureCompletion));
7907
+ });
7908
+ return promise;
7909
+ }
7910
+ async bulkDelete(ids) {
7911
+ const { store } = this.client;
7912
+ const assetProcedureCompletions = selectAssetProcedureCompletionsByIds(ids)(store.getState());
7913
+ this.dispatch(deleteAssetProcedureCompletions(ids));
7914
+ const promise = this.enqueueRequest({
7915
+ description: "Deleting asset procedure completions",
7916
+ method: HttpMethod.DELETE,
7917
+ url: "/asset-procedure-completions/bulk/",
7918
+ payload: {
7919
+ completion_ids: ids
7920
+ },
7921
+ blockers: ids,
7922
+ blocks: []
7923
+ });
7924
+ promise.catch(() => {
7925
+ this.dispatch(addAssetProcedureCompletions(assetProcedureCompletions));
7926
+ });
7927
+ return promise;
7928
+ }
7929
+ async refreshStore(projectId) {
7930
+ const result = await this.enqueueRequest({
7931
+ description: "Get asset procedure completions",
7932
+ method: HttpMethod.GET,
7933
+ url: "/asset-procedure-completions/",
7934
+ queryParams: {
7935
+ project_id: projectId.toString()
7936
+ },
7937
+ blockers: [],
7938
+ blocks: []
7939
+ });
7940
+ this.dispatch(initializeAssetProcedureCompletions(result));
7941
+ }
7942
+ }
7943
+ class AssetProcedureInstanceService extends BaseApiService {
7944
+ add(payload) {
7945
+ const { store } = this.client;
7946
+ const createdBy = store.getState().userReducer.currentUser.id;
7947
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7948
+ const offlineAssetProcedureInstance = offline({
7949
+ ...payload,
7950
+ created_by: createdBy,
7951
+ submitted_at: submittedAt
7952
+ });
7953
+ this.dispatch(addAssetProcedureInstance(offlineAssetProcedureInstance));
7954
+ const promise = this.enqueueRequest({
7955
+ description: "Create asset procedure instance",
7956
+ method: HttpMethod.POST,
7957
+ url: "/asset-procedure-instances/",
7958
+ payload: { ...offlineAssetProcedureInstance },
7959
+ blockers: [payload.asset_procedure, payload.asset_type],
7960
+ blocks: [offlineAssetProcedureInstance.offline_id]
7961
+ });
7962
+ promise.then((result) => {
7963
+ this.dispatch(updateAssetProcedureInstance(result));
7964
+ }).catch(() => {
7965
+ this.dispatch(deleteAssetProcedureInstance(offlineAssetProcedureInstance.offline_id));
7966
+ });
7967
+ return [offlineAssetProcedureInstance, promise];
7968
+ }
7969
+ update(payload) {
7970
+ const { store } = this.client;
7971
+ const assetProcedureInstance = selectAssetProcedureInstanceById(payload.offline_id)(store.getState());
7972
+ if (!assetProcedureInstance) {
7973
+ throw new Error(`Expected asset procedure instance with offline_id ${payload.offline_id} to exist`);
7974
+ }
7975
+ const updatedAssetProcedureInstance = {
7976
+ ...assetProcedureInstance,
7977
+ ...payload
7978
+ };
7979
+ this.dispatch(updateAssetProcedureInstance(updatedAssetProcedureInstance));
7980
+ const promise = this.enqueueRequest({
7981
+ description: "Update asset procedure instance",
7982
+ method: HttpMethod.PATCH,
7983
+ url: `/asset-procedure-instances/${payload.offline_id}/`,
7984
+ payload: {
7985
+ asset_procedure: payload.asset_procedure,
7986
+ asset_type: payload.asset_type
7987
+ },
7988
+ blockers: [assetProcedureInstance.offline_id],
7989
+ blocks: [assetProcedureInstance.offline_id]
7990
+ });
7991
+ promise.then((result) => {
7992
+ this.dispatch(updateAssetProcedureInstance(result));
7993
+ }).catch(() => {
7994
+ this.dispatch(updateAssetProcedureInstance(assetProcedureInstance));
7995
+ });
7996
+ return [updatedAssetProcedureInstance, promise];
7997
+ }
7998
+ async remove(assetProcedureInstanceId) {
7999
+ const { store } = this.client;
8000
+ const state = store.getState();
8001
+ const assetProcedureInstance = selectAssetProcedureInstanceById(assetProcedureInstanceId)(state);
8002
+ if (!assetProcedureInstance) {
8003
+ throw new Error(`Expected asset procedure instance with offline_id ${assetProcedureInstanceId} to exist`);
8004
+ }
8005
+ this.dispatch(deleteAssetProcedureInstance(assetProcedureInstanceId));
8006
+ return this.enqueueRequest({
8007
+ description: "Delete asset procedure instance",
8008
+ method: HttpMethod.DELETE,
8009
+ url: `/asset-procedure-instances/${assetProcedureInstanceId}/`,
8010
+ blockers: [assetProcedureInstanceId],
8011
+ blocks: []
8012
+ }).catch((e) => {
8013
+ this.dispatch(addAssetProcedureInstance(assetProcedureInstance));
8014
+ throw e;
8015
+ });
8016
+ }
8017
+ async refreshStore(projectId) {
8018
+ const result = await this.enqueueRequest({
8019
+ description: "Get asset procedure instances",
8020
+ method: HttpMethod.GET,
8021
+ url: "/asset-procedure-instances/",
8022
+ queryParams: {
8023
+ project_id: projectId.toString()
8024
+ },
8025
+ blockers: [],
8026
+ blocks: []
8027
+ });
8028
+ this.dispatch(initializeAssetProcedureInstances(result));
8029
+ }
8030
+ }
8031
+ class AssetProcedureService extends BaseApiService {
8032
+ add(payload) {
8033
+ const { store } = this.client;
8034
+ const createdBy = store.getState().userReducer.currentUser.id;
8035
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
8036
+ const offlineAssetProcedure = offline({
8037
+ ...payload,
8038
+ created_by: createdBy,
8039
+ submitted_at: submittedAt
8040
+ });
8041
+ this.dispatch(addAssetProcedure(offlineAssetProcedure));
8042
+ const promise = this.enqueueRequest({
8043
+ description: "Create asset procedure",
8044
+ method: HttpMethod.POST,
8045
+ url: "/asset-procedures/",
8046
+ queryParams: {
8047
+ organization_id: payload.organization.toString()
8048
+ },
8049
+ payload: { ...offlineAssetProcedure },
8050
+ blockers: [],
8051
+ blocks: [offlineAssetProcedure.offline_id]
8052
+ });
8053
+ promise.then((result) => {
8054
+ this.dispatch(updateAssetProcedure(result));
8055
+ }).catch(() => {
8056
+ this.dispatch(deleteAssetProcedure(offlineAssetProcedure.offline_id));
8057
+ });
8058
+ return [offlineAssetProcedure, promise];
8059
+ }
8060
+ update(payload) {
8061
+ const { store } = this.client;
8062
+ const assetProcedure = selectAssetProcedureById(payload.offline_id)(store.getState());
8063
+ if (!assetProcedure) {
8064
+ throw new Error(`Expected asset procedure with offline_id ${payload.offline_id} to exist`);
8065
+ }
8066
+ const updatedAssetProcedure = {
8067
+ ...assetProcedure,
8068
+ ...payload
8069
+ };
8070
+ this.dispatch(updateAssetProcedure(updatedAssetProcedure));
8071
+ const promise = this.enqueueRequest({
8072
+ description: "Update asset procedure",
8073
+ method: HttpMethod.PATCH,
8074
+ url: `/asset-procedures/${payload.offline_id}/`,
8075
+ payload: {
8076
+ icon: payload.icon,
8077
+ color: payload.color,
8078
+ name: payload.name,
8079
+ description: payload.description
8080
+ },
8081
+ blockers: [assetProcedure.offline_id],
8082
+ blocks: [assetProcedure.offline_id]
8083
+ });
8084
+ promise.then((result) => {
8085
+ this.dispatch(updateAssetProcedure(result));
8086
+ }).catch(() => {
8087
+ this.dispatch(updateAssetProcedure(assetProcedure));
8088
+ });
8089
+ return [updatedAssetProcedure, promise];
8090
+ }
8091
+ async remove(assetProcedureId) {
8092
+ const { store } = this.client;
8093
+ const state = store.getState();
8094
+ const assetProcedure = selectAssetProcedureById(assetProcedureId)(state);
8095
+ if (!assetProcedure) {
8096
+ throw new Error(`Expected asset procedure with offline_id ${assetProcedureId} to exist`);
8097
+ }
8098
+ const instancesOfAssetProcedure = selectAssetProcedureInstancesOfAssetProcedure(assetProcedureId)(state);
8099
+ this.dispatch(deleteAssetProcedure(assetProcedureId));
8100
+ this.dispatch(deleteAssetProcedureInstances(instancesOfAssetProcedure.map((instance) => instance.offline_id)));
8101
+ return this.enqueueRequest({
8102
+ description: "Delete asset procedure",
8103
+ method: HttpMethod.DELETE,
8104
+ url: `/asset-procedures/${assetProcedureId}/`,
8105
+ blockers: [assetProcedureId],
8106
+ blocks: []
8107
+ }).catch((e) => {
8108
+ this.dispatch(addAssetProcedure(assetProcedure));
8109
+ this.dispatch(addAssetProcedureInstances(instancesOfAssetProcedure));
8110
+ throw e;
8111
+ });
8112
+ }
8113
+ async refreshStore(organizationId) {
8114
+ const result = await this.enqueueRequest({
8115
+ description: "Get asset procedures",
8116
+ method: HttpMethod.GET,
8117
+ url: "/asset-procedures/",
8118
+ queryParams: {
8119
+ organization_id: organizationId.toString()
8120
+ },
8121
+ blockers: [],
8122
+ blocks: []
8123
+ });
8124
+ this.dispatch(initializeAssetProcedures(result));
8125
+ }
8126
+ }
8127
+ var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
8128
+ VerificationCodeType2[VerificationCodeType2["USER_REGISTRATION"] = 0] = "USER_REGISTRATION";
8129
+ VerificationCodeType2[VerificationCodeType2["APPLICATION_INVITE"] = 2] = "APPLICATION_INVITE";
8130
+ VerificationCodeType2[VerificationCodeType2["PROJECT_INVITE"] = 4] = "PROJECT_INVITE";
8131
+ VerificationCodeType2[VerificationCodeType2["ORGANIZATION_INVITE"] = 6] = "ORGANIZATION_INVITE";
8132
+ VerificationCodeType2[VerificationCodeType2["ADD_EMAIL_DOMAIN"] = 8] = "ADD_EMAIL_DOMAIN";
8133
+ VerificationCodeType2[VerificationCodeType2["RESET_PASSWORD"] = 10] = "RESET_PASSWORD";
8134
+ return VerificationCodeType2;
8135
+ })(VerificationCodeType || {});
7496
8136
  exports2.APIError = APIError;
7497
8137
  exports2.AgentService = AgentService;
7498
8138
  exports2.AssetAttachmentService = AssetAttachmentService;
8139
+ exports2.AssetProcedureCompletionService = AssetProcedureCompletionService;
8140
+ exports2.AssetProcedureInstanceService = AssetProcedureInstanceService;
8141
+ exports2.AssetProcedureService = AssetProcedureService;
7499
8142
  exports2.AssetService = AssetService;
7500
- exports2.AssetStageColors = AssetStageColors;
7501
8143
  exports2.AssetStageCompletionService = AssetStageCompletionService;
7502
8144
  exports2.AssetStageService = AssetStageService;
7503
8145
  exports2.AssetTypeAttachmentService = AssetTypeAttachmentService;
@@ -7559,9 +8201,20 @@ var __publicField = (obj, key, value) => {
7559
8201
  exports2.addAsset = addAsset;
7560
8202
  exports2.addAssetAttachment = addAssetAttachment;
7561
8203
  exports2.addAssetAttachments = addAssetAttachments;
8204
+ exports2.addAssetProcedure = addAssetProcedure;
8205
+ exports2.addAssetProcedureCompletion = addAssetProcedureCompletion;
8206
+ exports2.addAssetProcedureCompletions = addAssetProcedureCompletions;
8207
+ exports2.addAssetProcedureInstance = addAssetProcedureInstance;
8208
+ exports2.addAssetProcedureInstances = addAssetProcedureInstances;
8209
+ exports2.addAssetProcedures = addAssetProcedures;
8210
+ exports2.addAssetStage = addAssetStage;
8211
+ exports2.addAssetStageCompletion = addAssetStageCompletion;
8212
+ exports2.addAssetStageCompletions = addAssetStageCompletions;
8213
+ exports2.addAssetStages = addAssetStages;
7562
8214
  exports2.addAssetType = addAssetType;
7563
8215
  exports2.addAssetTypeAttachment = addAssetTypeAttachment;
7564
8216
  exports2.addAssetTypeAttachments = addAssetTypeAttachments;
8217
+ exports2.addAssetTypes = addAssetTypes;
7565
8218
  exports2.addAssets = addAssets;
7566
8219
  exports2.addCategory = addCategory;
7567
8220
  exports2.addConversation = addConversation;
@@ -7569,7 +8222,6 @@ var __publicField = (obj, key, value) => {
7569
8222
  exports2.addDocumentAttachments = addDocumentAttachments;
7570
8223
  exports2.addDocuments = addDocuments;
7571
8224
  exports2.addEmailDomain = addEmailDomain;
7572
- exports2.addFavouriteProjectId = addFavouriteProjectId;
7573
8225
  exports2.addForm = addForm;
7574
8226
  exports2.addFormRevision = addFormRevision;
7575
8227
  exports2.addFormRevisionAttachment = addFormRevisionAttachment;
@@ -7599,9 +8251,6 @@ var __publicField = (obj, key, value) => {
7599
8251
  exports2.addOrReplaceProjects = addOrReplaceProjects;
7600
8252
  exports2.addProjectAttachment = addProjectAttachment;
7601
8253
  exports2.addProjectAttachments = addProjectAttachments;
7602
- exports2.addStageCompletion = addStageCompletion;
7603
- exports2.addStageCompletions = addStageCompletions;
7604
- exports2.addStages = addStages;
7605
8254
  exports2.addTeam = addTeam;
7606
8255
  exports2.addToRecentIssues = addToRecentIssues;
7607
8256
  exports2.addUsers = addUsers;
@@ -7611,6 +8260,12 @@ var __publicField = (obj, key, value) => {
7611
8260
  exports2.areArraysEqual = areArraysEqual;
7612
8261
  exports2.assetAttachmentReducer = assetAttachmentReducer;
7613
8262
  exports2.assetAttachmentSlice = assetAttachmentSlice;
8263
+ exports2.assetProcedureCompletionReducer = assetProcedureCompletionReducer;
8264
+ exports2.assetProcedureCompletionSlice = assetProcedureCompletionSlice;
8265
+ exports2.assetProcedureInstanceReducer = assetProcedureInstanceReducer;
8266
+ exports2.assetProcedureInstanceSlice = assetProcedureInstanceSlice;
8267
+ exports2.assetProcedureReducer = assetProcedureReducer;
8268
+ exports2.assetProcedureSlice = assetProcedureSlice;
7614
8269
  exports2.assetReducer = assetReducer;
7615
8270
  exports2.assetSlice = assetSlice;
7616
8271
  exports2.assetStageCompletionReducer = assetStageCompletionReducer;
@@ -7624,6 +8279,7 @@ var __publicField = (obj, key, value) => {
7624
8279
  exports2.authReducer = authReducer;
7625
8280
  exports2.authSlice = authSlice;
7626
8281
  exports2.blobToBase64 = blobToBase64;
8282
+ exports2.boundsContainPoint = boundsContainPoint;
7627
8283
  exports2.categoryReducer = categoryReducer;
7628
8284
  exports2.categorySlice = categorySlice;
7629
8285
  exports2.classNames = classNames;
@@ -7631,6 +8287,9 @@ var __publicField = (obj, key, value) => {
7631
8287
  exports2.clearTokens = clearTokens;
7632
8288
  exports2.constructUploadedFilePayloads = constructUploadedFilePayloads;
7633
8289
  exports2.coordinatesAreEqual = coordinatesAreEqual;
8290
+ exports2.coordinatesToLiteral = coordinatesToLiteral;
8291
+ exports2.coordinatesToText = coordinatesToText;
8292
+ exports2.coordinatesToUrlText = coordinatesToUrlText;
7634
8293
  exports2.createMultiPointGeometry = createMultiPointGeometry;
7635
8294
  exports2.createOfflineAction = createOfflineAction;
7636
8295
  exports2.createPointGeometry = createPointGeometry;
@@ -7638,9 +8297,20 @@ var __publicField = (obj, key, value) => {
7638
8297
  exports2.deleteAsset = deleteAsset;
7639
8298
  exports2.deleteAssetAttachment = deleteAssetAttachment;
7640
8299
  exports2.deleteAssetAttachments = deleteAssetAttachments;
8300
+ exports2.deleteAssetProcedure = deleteAssetProcedure;
8301
+ exports2.deleteAssetProcedureCompletion = deleteAssetProcedureCompletion;
8302
+ exports2.deleteAssetProcedureCompletions = deleteAssetProcedureCompletions;
8303
+ exports2.deleteAssetProcedureInstance = deleteAssetProcedureInstance;
8304
+ exports2.deleteAssetProcedureInstances = deleteAssetProcedureInstances;
8305
+ exports2.deleteAssetProcedures = deleteAssetProcedures;
8306
+ exports2.deleteAssetStage = deleteAssetStage;
8307
+ exports2.deleteAssetStageCompletion = deleteAssetStageCompletion;
8308
+ exports2.deleteAssetStageCompletions = deleteAssetStageCompletions;
8309
+ exports2.deleteAssetStages = deleteAssetStages;
7641
8310
  exports2.deleteAssetType = deleteAssetType;
7642
8311
  exports2.deleteAssetTypeAttachment = deleteAssetTypeAttachment;
7643
8312
  exports2.deleteAssetTypeAttachments = deleteAssetTypeAttachments;
8313
+ exports2.deleteAssetTypes = deleteAssetTypes;
7644
8314
  exports2.deleteAssets = deleteAssets;
7645
8315
  exports2.deleteCategory = deleteCategory;
7646
8316
  exports2.deleteDocumentAttachment = deleteDocumentAttachment;
@@ -7693,6 +8363,8 @@ var __publicField = (obj, key, value) => {
7693
8363
  exports2.fileReducer = fileReducer;
7694
8364
  exports2.fileSlice = fileSlice;
7695
8365
  exports2.fileToBlob = fileToBlob;
8366
+ exports2.flipBounds = flipBounds;
8367
+ exports2.flipCoordinates = flipCoordinates;
7696
8368
  exports2.formReducer = formReducer;
7697
8369
  exports2.formRevisionAttachmentReducer = formRevisionAttachmentReducer;
7698
8370
  exports2.formRevisionAttachmentSlice = formRevisionAttachmentSlice;
@@ -7714,10 +8386,14 @@ var __publicField = (obj, key, value) => {
7714
8386
  exports2.getLocalRelativeDateString = getLocalRelativeDateString;
7715
8387
  exports2.getOutboxCoordinator = getOutboxCoordinator;
7716
8388
  exports2.getRenamedFile = getRenamedFile;
7717
- exports2.getStageColor = getStageColor;
7718
8389
  exports2.hashFile = hashFile;
7719
8390
  exports2.initSDK = initSDK;
7720
8391
  exports2.initializeAssetAttachments = initializeAssetAttachments;
8392
+ exports2.initializeAssetProcedureCompletions = initializeAssetProcedureCompletions;
8393
+ exports2.initializeAssetProcedureInstances = initializeAssetProcedureInstances;
8394
+ exports2.initializeAssetProcedures = initializeAssetProcedures;
8395
+ exports2.initializeAssetStageCompletions = initializeAssetStageCompletions;
8396
+ exports2.initializeAssetStages = initializeAssetStages;
7721
8397
  exports2.initializeAssetTypeAttachments = initializeAssetTypeAttachments;
7722
8398
  exports2.initializeAssetTypes = initializeAssetTypes;
7723
8399
  exports2.initializeAssets = initializeAssets;
@@ -7740,7 +8416,6 @@ var __publicField = (obj, key, value) => {
7740
8416
  exports2.initializeOrganizationAccesses = initializeOrganizationAccesses;
7741
8417
  exports2.initializeProjectAccesses = initializeProjectAccesses;
7742
8418
  exports2.initializeProjectAttachments = initializeProjectAttachments;
7743
- exports2.initializeStages = initializeStages;
7744
8419
  exports2.initializeTeams = initializeTeams;
7745
8420
  exports2.initializeWorkspaces = initializeWorkspaces;
7746
8421
  exports2.isToday = isToday;
@@ -7759,14 +8434,18 @@ var __publicField = (obj, key, value) => {
7759
8434
  exports2.issueUpdateSlice = issueUpdateSlice;
7760
8435
  exports2.licenseReducer = licenseReducer;
7761
8436
  exports2.licenseSlice = licenseSlice;
8437
+ exports2.literalToCoordinates = literalToCoordinates;
7762
8438
  exports2.logOnlyOnce = logOnlyOnce;
7763
8439
  exports2.markAsDeleted = markAsDeleted;
7764
8440
  exports2.markForDeletion = markForDeletion;
7765
8441
  exports2.memoize = memoize;
7766
8442
  exports2.moveDocument = moveDocument;
7767
8443
  exports2.offline = offline;
8444
+ exports2.offsetPositionByMeters = offsetPositionByMeters;
7768
8445
  exports2.onlyUniqueHashes = onlyUniqueHashes;
7769
8446
  exports2.onlyUniqueOfflineIds = onlyUniqueOfflineIds;
8447
+ exports2.openCoordsInGoogleMaps = openCoordsInGoogleMaps;
8448
+ exports2.openDirectionsInGoogleMaps = openDirectionsInGoogleMaps;
7770
8449
  exports2.organizationAccessReducer = organizationAccessReducer;
7771
8450
  exports2.organizationAccessSlice = organizationAccessSlice;
7772
8451
  exports2.organizationReducer = organizationReducer;
@@ -7789,13 +8468,10 @@ var __publicField = (obj, key, value) => {
7789
8468
  exports2.rehydratedReducer = rehydratedReducer;
7790
8469
  exports2.rehydratedSlice = rehydratedSlice;
7791
8470
  exports2.removeDocuments = removeDocuments;
7792
- exports2.removeFavouriteProjectId = removeFavouriteProjectId;
7793
8471
  exports2.removeIssueType = removeIssueType;
7794
8472
  exports2.removeProjectFile = removeProjectFile;
7795
8473
  exports2.removeProjectFilesOfProject = removeProjectFilesOfProject;
7796
8474
  exports2.removeRecentIssue = removeRecentIssue;
7797
- exports2.removeStageCompletions = removeStageCompletions;
7798
- exports2.removeStages = removeStages;
7799
8475
  exports2.removeUser = removeUser;
7800
8476
  exports2.resetProjectFileObjectUrls = resetProjectFileObjectUrls;
7801
8477
  exports2.resetRecentIssues = resetRecentIssues;
@@ -7817,14 +8493,35 @@ var __publicField = (obj, key, value) => {
7817
8493
  exports2.selectAssetAttachmentMapping = selectAssetAttachmentMapping;
7818
8494
  exports2.selectAssetAttachments = selectAssetAttachments;
7819
8495
  exports2.selectAssetById = selectAssetById;
8496
+ exports2.selectAssetProcedureById = selectAssetProcedureById;
8497
+ exports2.selectAssetProcedureCompletionById = selectAssetProcedureCompletionById;
8498
+ exports2.selectAssetProcedureCompletions = selectAssetProcedureCompletions;
8499
+ exports2.selectAssetProcedureCompletionsByIds = selectAssetProcedureCompletionsByIds;
8500
+ exports2.selectAssetProcedureCompletionsMapping = selectAssetProcedureCompletionsMapping;
8501
+ exports2.selectAssetProcedureCompletionsOfAsset = selectAssetProcedureCompletionsOfAsset;
8502
+ exports2.selectAssetProcedureCompletionsOfAssetProcedureInstance = selectAssetProcedureCompletionsOfAssetProcedureInstance;
8503
+ exports2.selectAssetProcedureInstanceById = selectAssetProcedureInstanceById;
8504
+ exports2.selectAssetProcedureInstances = selectAssetProcedureInstances;
8505
+ exports2.selectAssetProcedureInstancesByIds = selectAssetProcedureInstancesByIds;
8506
+ exports2.selectAssetProcedureInstancesMapping = selectAssetProcedureInstancesMapping;
8507
+ exports2.selectAssetProcedureInstancesOfAssetProcedure = selectAssetProcedureInstancesOfAssetProcedure;
8508
+ exports2.selectAssetProcedureInstancesOfAssetType = selectAssetProcedureInstancesOfAssetType;
8509
+ exports2.selectAssetProcedures = selectAssetProcedures;
8510
+ exports2.selectAssetProceduresByIds = selectAssetProceduresByIds;
8511
+ exports2.selectAssetProceduresMapping = selectAssetProceduresMapping;
8512
+ exports2.selectAssetProceduresOfOrganization = selectAssetProceduresOfOrganization;
7820
8513
  exports2.selectAssetStageById = selectAssetStageById;
8514
+ exports2.selectAssetStageCompletionById = selectAssetStageCompletionById;
8515
+ exports2.selectAssetStageCompletionMapping = selectAssetStageCompletionMapping;
8516
+ exports2.selectAssetStageCompletionsByIds = selectAssetStageCompletionsByIds;
7821
8517
  exports2.selectAssetStages = selectAssetStages;
7822
8518
  exports2.selectAssetStagesByIds = selectAssetStagesByIds;
8519
+ exports2.selectAssetStagesMappingOfAssetProcedure = selectAssetStagesMappingOfAssetProcedure;
8520
+ exports2.selectAssetStagesOfAssetProcedure = selectAssetStagesOfAssetProcedure;
7823
8521
  exports2.selectAssetTypeAttachmentById = selectAssetTypeAttachmentById;
7824
8522
  exports2.selectAssetTypeAttachmentMapping = selectAssetTypeAttachmentMapping;
7825
8523
  exports2.selectAssetTypeAttachments = selectAssetTypeAttachments;
7826
8524
  exports2.selectAssetTypeById = selectAssetTypeById;
7827
- exports2.selectAssetTypeStagesMapping = selectAssetTypeStagesMapping;
7828
8525
  exports2.selectAssetTypes = selectAssetTypes;
7829
8526
  exports2.selectAssetTypesByIds = selectAssetTypesByIds;
7830
8527
  exports2.selectAssetTypesMapping = selectAssetTypesMapping;
@@ -7852,8 +8549,8 @@ var __publicField = (obj, key, value) => {
7852
8549
  exports2.selectCategoryById = selectCategoryById;
7853
8550
  exports2.selectCategoryMapping = selectCategoryMapping;
7854
8551
  exports2.selectCommentsOfIssue = selectCommentsOfIssue;
7855
- exports2.selectCompletedStageIdsForAsset = selectCompletedStageIdsForAsset;
7856
- exports2.selectCompletedStages = selectCompletedStages;
8552
+ exports2.selectCompletedStageIdsOfAssetProcedureCompletion = selectCompletedStageIdsOfAssetProcedureCompletion;
8553
+ exports2.selectCompletedStagesByAssetProcedureCompletion = selectCompletedStagesByAssetProcedureCompletion;
7857
8554
  exports2.selectConversation = selectConversation;
7858
8555
  exports2.selectConversationMapping = selectConversationMapping;
7859
8556
  exports2.selectConversations = selectConversations;
@@ -7868,7 +8565,6 @@ var __publicField = (obj, key, value) => {
7868
8565
  exports2.selectEmailDomains = selectEmailDomains;
7869
8566
  exports2.selectEmailDomainsAsMapping = selectEmailDomainsAsMapping;
7870
8567
  exports2.selectEmailDomainsOfOrganization = selectEmailDomainsOfOrganization;
7871
- exports2.selectFavouriteProjects = selectFavouriteProjects;
7872
8568
  exports2.selectFilteredForms = selectFilteredForms;
7873
8569
  exports2.selectFormById = selectFormById;
7874
8570
  exports2.selectFormMapping = selectFormMapping;
@@ -7967,8 +8663,6 @@ var __publicField = (obj, key, value) => {
7967
8663
  exports2.selectSortedProjectUsers = selectSortedProjectUsers;
7968
8664
  exports2.selectStageFormIdsFromStageIds = selectStageFormIdsFromStageIds;
7969
8665
  exports2.selectStageMapping = selectStageMapping;
7970
- exports2.selectStagesFromAssetTypeIds = selectStagesFromAssetTypeIds;
7971
- exports2.selectStagesOfAssetType = selectStagesOfAssetType;
7972
8666
  exports2.selectTeamById = selectTeamById;
7973
8667
  exports2.selectTeams = selectTeams;
7974
8668
  exports2.selectTeamsByIds = selectTeamsByIds;
@@ -7987,8 +8681,18 @@ var __publicField = (obj, key, value) => {
7987
8681
  exports2.setAsset = setAsset;
7988
8682
  exports2.setAssetAttachment = setAssetAttachment;
7989
8683
  exports2.setAssetAttachments = setAssetAttachments;
8684
+ exports2.setAssetProcedure = setAssetProcedure;
8685
+ exports2.setAssetProcedureCompletion = setAssetProcedureCompletion;
8686
+ exports2.setAssetProcedureCompletions = setAssetProcedureCompletions;
8687
+ exports2.setAssetProcedureInstance = setAssetProcedureInstance;
8688
+ exports2.setAssetProcedureInstances = setAssetProcedureInstances;
8689
+ exports2.setAssetProcedures = setAssetProcedures;
8690
+ exports2.setAssetStage = setAssetStage;
8691
+ exports2.setAssetStages = setAssetStages;
8692
+ exports2.setAssetType = setAssetType;
7990
8693
  exports2.setAssetTypeAttachment = setAssetTypeAttachment;
7991
8694
  exports2.setAssetTypeAttachments = setAssetTypeAttachments;
8695
+ exports2.setAssetTypes = setAssetTypes;
7992
8696
  exports2.setAssets = setAssets;
7993
8697
  exports2.setConversation = setConversation;
7994
8698
  exports2.setCurrentUser = setCurrentUser;
@@ -8021,11 +8725,8 @@ var __publicField = (obj, key, value) => {
8021
8725
  exports2.setProjectAttachments = setProjectAttachments;
8022
8726
  exports2.setProjects = setProjects;
8023
8727
  exports2.setRehydrated = setRehydrated;
8024
- exports2.setStage = setStage;
8025
- exports2.setStageCompletions = setStageCompletions;
8026
8728
  exports2.setTeam = setTeam;
8027
8729
  exports2.setTokens = setTokens;
8028
- exports2.setTourStep = setTourStep;
8029
8730
  exports2.setUploadUrl = setUploadUrl;
8030
8731
  exports2.setUsers = setUsers;
8031
8732
  exports2.setWorkspaces = setWorkspaces;
@@ -8041,8 +8742,20 @@ var __publicField = (obj, key, value) => {
8041
8742
  exports2.updateAsset = updateAsset;
8042
8743
  exports2.updateAssetAttachment = updateAssetAttachment;
8043
8744
  exports2.updateAssetAttachments = updateAssetAttachments;
8745
+ exports2.updateAssetProcedure = updateAssetProcedure;
8746
+ exports2.updateAssetProcedureCompletion = updateAssetProcedureCompletion;
8747
+ exports2.updateAssetProcedureCompletions = updateAssetProcedureCompletions;
8748
+ exports2.updateAssetProcedureInstance = updateAssetProcedureInstance;
8749
+ exports2.updateAssetProcedureInstances = updateAssetProcedureInstances;
8750
+ exports2.updateAssetProcedures = updateAssetProcedures;
8751
+ exports2.updateAssetStage = updateAssetStage;
8752
+ exports2.updateAssetStageCompletion = updateAssetStageCompletion;
8753
+ exports2.updateAssetStageCompletions = updateAssetStageCompletions;
8754
+ exports2.updateAssetStages = updateAssetStages;
8755
+ exports2.updateAssetType = updateAssetType;
8044
8756
  exports2.updateAssetTypeAttachment = updateAssetTypeAttachment;
8045
8757
  exports2.updateAssetTypeAttachments = updateAssetTypeAttachments;
8758
+ exports2.updateAssetTypes = updateAssetTypes;
8046
8759
  exports2.updateAssets = updateAssets;
8047
8760
  exports2.updateCategory = updateCategory;
8048
8761
  exports2.updateConversation = updateConversation;
@@ -8070,8 +8783,6 @@ var __publicField = (obj, key, value) => {
8070
8783
  exports2.updateProjectAccess = updateProjectAccess;
8071
8784
  exports2.updateProjectAttachment = updateProjectAttachment;
8072
8785
  exports2.updateProjectAttachments = updateProjectAttachments;
8073
- exports2.updateStage = updateStage;
8074
- exports2.updateStages = updateStages;
8075
8786
  exports2.updateTeam = updateTeam;
8076
8787
  exports2.updateWorkspace = updateWorkspace;
8077
8788
  exports2.useMemoCompare = useMemoCompare;
@@ -8082,6 +8793,7 @@ var __publicField = (obj, key, value) => {
8082
8793
  exports2.warningColor = warningColor;
8083
8794
  exports2.workspaceReducer = workspaceReducer;
8084
8795
  exports2.workspaceSlice = workspaceSlice;
8796
+ exports2.worldBounds = worldBounds;
8085
8797
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
8086
8798
  });
8087
8799
  //# sourceMappingURL=overmap-core.umd.cjs.map