@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
@@ -7,19 +7,19 @@ var __publicField = (obj, key, value) => {
7
7
  var _a;
8
8
  import { DepGraph } from "dependency-graph";
9
9
  import { v4 } from "uuid";
10
+ import { saveAs } from "file-saver";
11
+ import React, { useRef, useEffect } from "react";
12
+ import ColorCls from "color";
13
+ import { gray, gold, brown, yellow, amber, orange, red, crimson, pink, plum, purple, violet, iris, indigo, blue, cyan, jade, grass, lime, mint, sky } from "@radix-ui/colors";
10
14
  import { offline as offline$1 } from "@redux-offline/redux-offline";
11
15
  import offlineConfig from "@redux-offline/redux-offline/lib/defaults";
12
16
  import localforage from "localforage";
13
17
  import createMigration from "redux-persist-migrate";
14
18
  import { createSlice, createSelector, combineReducers, createNextState } from "@reduxjs/toolkit";
15
19
  import request from "superagent";
16
- import { saveAs } from "file-saver";
17
- import React, { useRef, useEffect } from "react";
18
- import ColorCls from "color";
19
- import { gray, gold, brown, yellow, amber, orange, red, crimson, pink, plum, purple, violet, iris, indigo, blue, cyan, jade, grass, lime, mint, sky } from "@radix-ui/colors";
20
+ import { unsafeShowToast } from "@overmap-ai/blocks";
20
21
  import { RESET_STATE } from "@redux-offline/redux-offline/lib/constants";
21
22
  import jwtDecode from "jwt-decode";
22
- import { unsafeShowToast } from "@overmap-ai/blocks";
23
23
  import { openDB } from "idb";
24
24
  var HttpMethod = /* @__PURE__ */ ((HttpMethod2) => {
25
25
  HttpMethod2["GET"] = "GET";
@@ -29,6 +29,14 @@ var HttpMethod = /* @__PURE__ */ ((HttpMethod2) => {
29
29
  HttpMethod2["DELETE"] = "DELETE";
30
30
  return HttpMethod2;
31
31
  })(HttpMethod || {});
32
+ var AttachmentModel = /* @__PURE__ */ ((AttachmentModel2) => {
33
+ AttachmentModel2["Issue"] = "issue";
34
+ AttachmentModel2["Asset"] = "asset";
35
+ AttachmentModel2["AssetType"] = "asset_type";
36
+ AttachmentModel2["Project"] = "project";
37
+ AttachmentModel2["Document"] = "document";
38
+ return AttachmentModel2;
39
+ })(AttachmentModel || {});
32
40
  var IssuePriority = /* @__PURE__ */ ((IssuePriority2) => {
33
41
  IssuePriority2[IssuePriority2["LOWEST"] = 0] = "LOWEST";
34
42
  IssuePriority2[IssuePriority2["LOW"] = 2] = "LOW";
@@ -43,6 +51,43 @@ var IssueStatus = /* @__PURE__ */ ((IssueStatus2) => {
43
51
  IssueStatus2[IssueStatus2["DONE"] = 4] = "DONE";
44
52
  return IssueStatus2;
45
53
  })(IssueStatus || {});
54
+ var IssueUpdateChange = /* @__PURE__ */ ((IssueUpdateChange2) => {
55
+ IssueUpdateChange2["STATUS"] = "status";
56
+ IssueUpdateChange2["PRIORITY"] = "priority";
57
+ IssueUpdateChange2["CATEGORY"] = "category";
58
+ IssueUpdateChange2["DESCRIPTION"] = "description";
59
+ IssueUpdateChange2["TITLE"] = "title";
60
+ IssueUpdateChange2["ASSIGNED_TO"] = "assigned_to";
61
+ IssueUpdateChange2["DUE_DATE"] = "due_date";
62
+ return IssueUpdateChange2;
63
+ })(IssueUpdateChange || {});
64
+ var ProjectAccessLevel = /* @__PURE__ */ ((ProjectAccessLevel2) => {
65
+ ProjectAccessLevel2[ProjectAccessLevel2["BASIC"] = 0] = "BASIC";
66
+ ProjectAccessLevel2[ProjectAccessLevel2["ADMIN"] = 2] = "ADMIN";
67
+ return ProjectAccessLevel2;
68
+ })(ProjectAccessLevel || {});
69
+ var OrganizationAccessLevel = /* @__PURE__ */ ((OrganizationAccessLevel2) => {
70
+ OrganizationAccessLevel2[OrganizationAccessLevel2["BASIC"] = 0] = "BASIC";
71
+ OrganizationAccessLevel2[OrganizationAccessLevel2["ADMIN"] = 2] = "ADMIN";
72
+ return OrganizationAccessLevel2;
73
+ })(OrganizationAccessLevel || {});
74
+ var PaddleCheckoutEvent = /* @__PURE__ */ ((PaddleCheckoutEvent2) => {
75
+ PaddleCheckoutEvent2["COMPLETED"] = "checkout.completed";
76
+ PaddleCheckoutEvent2["CLOSED"] = "checkout.closed";
77
+ return PaddleCheckoutEvent2;
78
+ })(PaddleCheckoutEvent || {});
79
+ var LicenseLevel = /* @__PURE__ */ ((LicenseLevel2) => {
80
+ LicenseLevel2[LicenseLevel2["PRO"] = 0] = "PRO";
81
+ return LicenseLevel2;
82
+ })(LicenseLevel || {});
83
+ var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
84
+ LicenseStatus2[LicenseStatus2["ACTIVE"] = 0] = "ACTIVE";
85
+ LicenseStatus2[LicenseStatus2["PAUSED"] = 2] = "PAUSED";
86
+ LicenseStatus2[LicenseStatus2["CANCELLED"] = 4] = "CANCELLED";
87
+ LicenseStatus2[LicenseStatus2["INACTIVE"] = 6] = "INACTIVE";
88
+ LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
89
+ return LicenseStatus2;
90
+ })(LicenseStatus || {});
46
91
  class OutboxCoordinator {
47
92
  constructor() {
48
93
  __publicField(this, "graph");
@@ -285,145 +330,70 @@ class APIError extends Error {
285
330
  this.options = options;
286
331
  }
287
332
  }
288
- class DeferredPromise {
289
- constructor() {
290
- __publicField(this, _a, "Promise");
291
- __publicField(this, "_promise");
292
- __publicField(this, "_resolve");
293
- __publicField(this, "_reject");
294
- __publicField(this, "_state", "pending");
295
- this._resolve = null;
296
- this._reject = null;
297
- this._promise = new Promise((resolve, reject) => {
298
- this._resolve = resolve;
299
- this._reject = reject;
300
- });
301
- }
302
- get state() {
303
- return this._state;
304
- }
305
- then(onFulfilled, onRejected) {
306
- return this._promise.then(onFulfilled, onRejected);
307
- }
308
- catch(onRejected) {
309
- return this._promise.catch(onRejected);
310
- }
311
- resolve(value) {
312
- if (!this._resolve)
313
- throw new Error("No resolve callback");
314
- this._resolve(value);
315
- this._state = "fulfilled";
316
- }
317
- reject(reason) {
318
- if (!this._reject)
319
- throw reason;
320
- this._reject(reason);
321
- this._state = "rejected";
322
- }
323
- finally(_onFinally) {
324
- throw new Error("`finally` not implemented");
325
- }
326
- }
327
- _a = Symbol.toStringTag;
328
- var randomString = function randomString2() {
329
- return Math.random().toString(36).substring(7).split("").join(".");
330
- };
331
- ({
332
- INIT: "@@redux/INIT" + randomString(),
333
- REPLACE: "@@redux/REPLACE" + randomString(),
334
- PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
335
- return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
336
- }
337
- });
338
- function compose() {
339
- for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
340
- funcs[_key] = arguments[_key];
341
- }
342
- if (funcs.length === 0) {
343
- return function(arg) {
344
- return arg;
345
- };
346
- }
347
- if (funcs.length === 1) {
348
- return funcs[0];
349
- }
350
- return funcs.reduce(function(a, b) {
351
- return function() {
352
- return a(b.apply(void 0, arguments));
353
- };
354
- });
355
- }
356
- const VERSION_REDUCER_KEY$1 = "versioning";
357
- const latestVersion = () => migrations.length - 1;
358
- const initialVersioning = (state) => {
359
- state[VERSION_REDUCER_KEY$1] = { version: latestVersion() };
360
- return state;
333
+ const coordinatesToLiteral = (coordinates) => {
334
+ return { lng: coordinates[0], lat: coordinates[1] };
361
335
  };
362
- const signOut = () => {
363
- return initialVersioning({});
336
+ const literalToCoordinates = (literal) => {
337
+ return [literal.lng, literal.lat];
364
338
  };
365
- const createOutboxState = (state) => {
366
- if (state.outboxReducer) {
367
- state.outboxReducer.deletedRequests = [];
368
- }
369
- return state;
339
+ const flipCoordinates = (coordinates) => {
340
+ return [coordinates[1], coordinates[0]];
370
341
  };
371
- const wrapMigration = (migrator) => (state) => {
372
- var _a2;
373
- if (state === void 0) {
374
- state = {};
375
- }
376
- if (((_a2 = state[VERSION_REDUCER_KEY$1]) == null ? void 0 : _a2.version) === latestVersion())
377
- return state;
378
- return migrator(state);
342
+ const flipBounds = (bounds) => {
343
+ return [flipCoordinates(bounds[0]), flipCoordinates(bounds[1])];
379
344
  };
380
- const migrations = [initialVersioning, signOut, signOut, createOutboxState];
381
- const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
382
- const initialState$B = {
383
- accessToken: "",
384
- refreshToken: "",
385
- isLoggedIn: false
386
- };
387
- const authSlice = createSlice({
388
- name: "auth",
389
- initialState: initialState$B,
390
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$B)),
391
- reducers: {
392
- setTokens: (state, action) => {
393
- state.accessToken = action.payload.accessToken;
394
- state.refreshToken = action.payload.refreshToken;
395
- },
396
- clearTokens: (state) => {
397
- state.accessToken = "";
398
- state.refreshToken = "";
399
- },
400
- setLoggedIn: (state, action) => {
401
- if (!action.payload) {
402
- authSlice.caseReducers.clearTokens(state);
403
- }
404
- state.isLoggedIn = action.payload;
405
- }
406
- }
407
- });
408
- const { setTokens, clearTokens, setLoggedIn } = authSlice.actions;
409
- const selectAccessToken = (state) => state.authReducer.accessToken;
410
- const selectIsLoggedIn = (state) => state.authReducer.isLoggedIn;
411
- const authReducer = authSlice.reducer;
412
- const createPointGeometry = (position) => {
345
+ function offsetPositionByMeters(originalPosition, latMeters, lngMeters) {
346
+ const { lat, lng } = originalPosition;
347
+ const earthRadius = 6378137;
348
+ const metersPerDegree = 2 * Math.PI * earthRadius / 360;
349
+ const newLng = lng + lngMeters / metersPerDegree / Math.cos(lat * Math.PI / 180);
350
+ const newLat = lat - latMeters / metersPerDegree;
351
+ return { lat: newLat, lng: newLng };
352
+ }
353
+ const createPointGeometry = (coordinates) => {
413
354
  return {
414
355
  type: "Point",
415
- coordinates: position
356
+ coordinates
416
357
  };
417
358
  };
359
+ const coordinatesAreEqual = (a, b) => {
360
+ return a[0] === b[0] && a[1] === b[1];
361
+ };
362
+ const coordinatesToText = (coordinates, decimalPlaces) => {
363
+ if (!coordinates)
364
+ return "(No Location)";
365
+ const { lat, lng } = coordinatesToLiteral(coordinates);
366
+ if (decimalPlaces)
367
+ return `${lat.toFixed(decimalPlaces)}, ${lng.toFixed(decimalPlaces)}`;
368
+ return `${lat}, ${lng}`;
369
+ };
370
+ const coordinatesToUrlText = (coordinates) => {
371
+ const { lat, lng } = coordinatesToLiteral(coordinates);
372
+ return `${lat}%2C${lng}`;
373
+ };
374
+ const openCoordsInGoogleMaps = (coordinates) => {
375
+ const url = `https://www.google.com/maps/search/?api=1&query=${coordinatesToUrlText(coordinates)}`;
376
+ window.open(url);
377
+ };
378
+ const openDirectionsInGoogleMaps = (startingPoint, destination) => {
379
+ const startingPointUrl = coordinatesToUrlText(startingPoint);
380
+ const destinationUrl = coordinatesToUrlText(destination);
381
+ const url = `https://www.google.com/maps/dir/?api=1&origin=${startingPointUrl}&destination=${destinationUrl}`;
382
+ window.open(url);
383
+ };
384
+ const worldBounds = {
385
+ type: "MultiPoint",
386
+ coordinates: [
387
+ [90, -180],
388
+ [-90, 180]
389
+ ]
390
+ };
418
391
  const createMultiPointGeometry = (coordinates) => {
419
392
  return {
420
393
  type: "MultiPoint",
421
394
  coordinates
422
395
  };
423
396
  };
424
- const coordinatesAreEqual = (a, b) => {
425
- return a[0] === b[0] && a[1] === b[1];
426
- };
427
397
  function classNames(...args) {
428
398
  const classes = [];
429
399
  for (const arg of args) {
@@ -601,11 +571,14 @@ function onlyUniqueHashes(value, index, self) {
601
571
  return v.file_sha1 === value.file_sha1;
602
572
  }) === index;
603
573
  }
574
+ function boundsContainPoint(bounds, coordinates) {
575
+ return bounds[0][0] > coordinates[0] && bounds[1][0] < coordinates[0] && bounds[0][1] > coordinates[1] && bounds[1][1] < coordinates[1];
576
+ }
604
577
  const emailRegex = /^.+@.+\..+$/;
605
578
  const fullAssetMarkerSize = 45;
606
579
  const DEFAULT_ISSUE_STATUS = IssueStatus.BACKLOG;
607
580
  const DEFAULT_ISSUE_PRIORITY = IssuePriority.MEDIUM;
608
- const OUTBOX_RETRY_DELAY = 5e3;
581
+ const OUTBOX_RETRY_DELAY = 6e4;
609
582
  const EMPTY_ARRAY = Object.freeze([]);
610
583
  let debug = false;
611
584
  const REACT_APP_DEBUG_MEMOIZATION = {}.REACT_APP_DEBUG_MEMOIZATION || "";
@@ -701,19 +674,6 @@ const Colors = {
701
674
  mint: mint.mint9,
702
675
  sky: sky.sky9
703
676
  };
704
- const AssetStageColors = {
705
- indigo: indigo.indigo9,
706
- red: red.red9,
707
- violet: violet.violet9,
708
- yellow: yellow.yellow9,
709
- jade: jade.jade9,
710
- cyan: cyan.cyan9,
711
- gold: gold.gold9,
712
- orange: orange.orange9,
713
- lime: lime.lime9,
714
- sky: sky.sky9,
715
- pink: pink.pink9
716
- };
717
677
  const defaultBadgeColor = "#868686";
718
678
  const generateBadgeColors = (rawColor) => {
719
679
  const color = ColorCls(rawColor);
@@ -722,9 +682,6 @@ const generateBadgeColors = (rawColor) => {
722
682
  const textColor = color.hex() === safety.hex() ? "#000000" : "#FFFFFF";
723
683
  return { backgroundColor, textColor };
724
684
  };
725
- function getStageColor(index) {
726
- return Object.values(AssetStageColors)[index % Object.keys(AssetStageColors).length];
727
- }
728
685
  const getLocalDateString = memoize((date) => {
729
686
  if (!date)
730
687
  return "";
@@ -747,6 +704,158 @@ const getLocalRelativeDateString = memoize((date, min, max) => {
747
704
  return getLocalDateString(date);
748
705
  return relative.format(days, "days");
749
706
  });
707
+ class DeferredPromise {
708
+ constructor() {
709
+ __publicField(this, _a, "Promise");
710
+ __publicField(this, "_promise");
711
+ __publicField(this, "_resolve");
712
+ __publicField(this, "_reject");
713
+ __publicField(this, "_state", "pending");
714
+ this._resolve = null;
715
+ this._reject = null;
716
+ this._promise = new Promise((resolve, reject) => {
717
+ this._resolve = resolve;
718
+ this._reject = reject;
719
+ });
720
+ }
721
+ get state() {
722
+ return this._state;
723
+ }
724
+ then(onFulfilled, onRejected) {
725
+ return this._promise.then(onFulfilled, onRejected);
726
+ }
727
+ catch(onRejected) {
728
+ return this._promise.catch(onRejected);
729
+ }
730
+ resolve(value) {
731
+ if (!this._resolve)
732
+ throw new Error("No resolve callback");
733
+ this._resolve(value);
734
+ this._state = "fulfilled";
735
+ }
736
+ reject(reason) {
737
+ if (!this._reject)
738
+ throw reason;
739
+ this._reject(reason);
740
+ this._state = "rejected";
741
+ }
742
+ finally(_onFinally) {
743
+ throw new Error("`finally` not implemented");
744
+ }
745
+ }
746
+ _a = Symbol.toStringTag;
747
+ var randomString = function randomString2() {
748
+ return Math.random().toString(36).substring(7).split("").join(".");
749
+ };
750
+ ({
751
+ INIT: "@@redux/INIT" + randomString(),
752
+ REPLACE: "@@redux/REPLACE" + randomString(),
753
+ PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
754
+ return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
755
+ }
756
+ });
757
+ function compose() {
758
+ for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
759
+ funcs[_key] = arguments[_key];
760
+ }
761
+ if (funcs.length === 0) {
762
+ return function(arg) {
763
+ return arg;
764
+ };
765
+ }
766
+ if (funcs.length === 1) {
767
+ return funcs[0];
768
+ }
769
+ return funcs.reduce(function(a, b) {
770
+ return function() {
771
+ return a(b.apply(void 0, arguments));
772
+ };
773
+ });
774
+ }
775
+ const VERSION_REDUCER_KEY$1 = "versioning";
776
+ const latestVersion = () => migrations.length - 1;
777
+ const initialVersioning = (state) => {
778
+ state[VERSION_REDUCER_KEY$1] = { version: latestVersion() };
779
+ return state;
780
+ };
781
+ const signOut = () => {
782
+ return initialVersioning({});
783
+ };
784
+ const createOutboxState = (state) => {
785
+ if (state.outboxReducer) {
786
+ state.outboxReducer.deletedRequests = [];
787
+ }
788
+ return state;
789
+ };
790
+ const wrapMigration = (migrator) => (state) => {
791
+ var _a2;
792
+ if (state === void 0) {
793
+ state = {};
794
+ }
795
+ if (((_a2 = state[VERSION_REDUCER_KEY$1]) == null ? void 0 : _a2.version) === latestVersion())
796
+ return state;
797
+ return migrator(state);
798
+ };
799
+ const migrations = [initialVersioning, signOut, signOut, createOutboxState];
800
+ const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
801
+ let clientStore;
802
+ function setClientStore(store) {
803
+ clientStore = store;
804
+ }
805
+ function getClientStore() {
806
+ return clientStore;
807
+ }
808
+ let clientSDK;
809
+ function setClientSDK(sdkCtor) {
810
+ clientSDK = sdkCtor;
811
+ }
812
+ function getClientSDK() {
813
+ return clientSDK;
814
+ }
815
+ const CLASS_NAME_TO_SERVICE = {};
816
+ class BaseService {
817
+ constructor(sdk) {
818
+ __publicField(this, "client");
819
+ CLASS_NAME_TO_SERVICE[this.constructor.name] = this;
820
+ this.client = sdk;
821
+ }
822
+ async enqueueRequest(requestDetails) {
823
+ return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
824
+ }
825
+ dispatch(action) {
826
+ this.client.store.dispatch(action);
827
+ }
828
+ }
829
+ const initialState$E = {
830
+ accessToken: "",
831
+ refreshToken: "",
832
+ isLoggedIn: false
833
+ };
834
+ const authSlice = createSlice({
835
+ name: "auth",
836
+ initialState: initialState$E,
837
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$E)),
838
+ reducers: {
839
+ setTokens: (state, action) => {
840
+ state.accessToken = action.payload.accessToken;
841
+ state.refreshToken = action.payload.refreshToken;
842
+ },
843
+ clearTokens: (state) => {
844
+ state.accessToken = "";
845
+ state.refreshToken = "";
846
+ },
847
+ setLoggedIn: (state, action) => {
848
+ if (!action.payload) {
849
+ authSlice.caseReducers.clearTokens(state);
850
+ }
851
+ state.isLoggedIn = action.payload;
852
+ }
853
+ }
854
+ });
855
+ const { setTokens, clearTokens, setLoggedIn } = authSlice.actions;
856
+ const selectAccessToken = (state) => state.authReducer.accessToken;
857
+ const selectIsLoggedIn = (state) => state.authReducer.isLoggedIn;
858
+ const authReducer = authSlice.reducer;
750
859
  function createModelAdapter(computeModelId) {
751
860
  const addOne = (state, action) => {
752
861
  const id = computeModelId(action.payload);
@@ -813,11 +922,11 @@ function createModelAdapter(computeModelId) {
813
922
  };
814
923
  }
815
924
  const categoryAdapter = createModelAdapter((category) => category.offline_id);
816
- const initialState$A = categoryAdapter.getInitialState({});
925
+ const initialState$D = categoryAdapter.getInitialState({});
817
926
  const categorySlice = createSlice({
818
927
  name: "categories",
819
- initialState: initialState$A,
820
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$A)),
928
+ initialState: initialState$D,
929
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$D)),
821
930
  reducers: {
822
931
  initializeCategories: categoryAdapter.initialize,
823
932
  addCategory: categoryAdapter.addOne,
@@ -861,11 +970,11 @@ const selectIssueCountOfCategory = (categoryId) => (state) => {
861
970
  };
862
971
  const categoryReducer = categorySlice.reducer;
863
972
  const assetAdapter = createModelAdapter((asset) => asset.offline_id);
864
- const initialState$z = assetAdapter.getInitialState({});
973
+ const initialState$C = assetAdapter.getInitialState({});
865
974
  const assetSlice = createSlice({
866
975
  name: "assets",
867
- initialState: initialState$z,
868
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
976
+ initialState: initialState$C,
977
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$C)),
869
978
  reducers: {
870
979
  initializeAssets: assetAdapter.initialize,
871
980
  addAsset: assetAdapter.addOne,
@@ -917,11 +1026,11 @@ const selectNumberOfAssetsOfAssetType = (assetTypeId) => (state) => {
917
1026
  };
918
1027
  const assetReducer = assetSlice.reducer;
919
1028
  const assetAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
920
- const initialState$y = assetAttachmentAdapter.getInitialState({});
1029
+ const initialState$B = assetAttachmentAdapter.getInitialState({});
921
1030
  const assetAttachmentSlice = createSlice({
922
1031
  name: "assetAttachments",
923
- initialState: initialState$y,
924
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
1032
+ initialState: initialState$B,
1033
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$B)),
925
1034
  reducers: {
926
1035
  initializeAssetAttachments: assetAttachmentAdapter.initialize,
927
1036
  addAssetAttachment: assetAttachmentAdapter.addOne,
@@ -979,78 +1088,98 @@ const selectAttachmentsOfAssetByType = restructureCreateSelectorWithArgs(
979
1088
  )
980
1089
  );
981
1090
  const assetAttachmentReducer = assetAttachmentSlice.reducer;
982
- const initialState$x = {
983
- completionsByAssetId: {}
984
- };
1091
+ const assetStageCompletionAdapter = createModelAdapter(
1092
+ (stageCompletion) => stageCompletion.offline_id
1093
+ );
1094
+ const initialState$A = assetStageCompletionAdapter.getInitialState({});
985
1095
  const assetStageCompletionSlice = createSlice({
986
1096
  name: "assetStageCompletions",
987
- initialState: initialState$x,
988
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
1097
+ initialState: initialState$A,
1098
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$A)),
989
1099
  reducers: {
990
- addStageCompletion: (state, action) => {
991
- let stageToCompletionDateMapping = state.completionsByAssetId[action.payload.asset];
992
- if (!stageToCompletionDateMapping) {
993
- stageToCompletionDateMapping = {};
994
- state.completionsByAssetId[action.payload.asset] = stageToCompletionDateMapping;
995
- }
996
- stageToCompletionDateMapping[action.payload.stage] = (/* @__PURE__ */ new Date()).toISOString();
997
- },
998
- addStageCompletions: (state, action) => {
999
- for (const [assetId, stageIdToCompletionDateMapping] of Object.entries(action.payload)) {
1000
- if (Object.keys(stageIdToCompletionDateMapping).length === 0)
1001
- throw new Error(`Encountered empty stageIdToCompletionDateMapping argument for asset ${assetId}`);
1002
- let thisAssetCompletions = state.completionsByAssetId[assetId];
1003
- if (thisAssetCompletions === void 0) {
1004
- thisAssetCompletions = {};
1005
- }
1006
- for (const [stageId, completionDate] of Object.entries(stageIdToCompletionDateMapping)) {
1007
- thisAssetCompletions[stageId] = completionDate;
1008
- }
1009
- state.completionsByAssetId[assetId] = thisAssetCompletions;
1010
- }
1011
- },
1012
- removeStageCompletions: (state, action) => {
1013
- for (const completion of action.payload) {
1014
- const thisAssetCompletions = state.completionsByAssetId[completion.asset];
1015
- if (!thisAssetCompletions || !(completion.stage in thisAssetCompletions)) {
1016
- console.warn(
1017
- "Skipping removal of uncompleted stage. This message indicates completion objects are created unnecessarily."
1018
- );
1019
- continue;
1020
- }
1021
- delete thisAssetCompletions[completion.stage];
1022
- }
1023
- },
1024
- setStageCompletions: (state, action) => {
1025
- state.completionsByAssetId = action.payload;
1026
- }
1100
+ initializeAssetStageCompletions: assetStageCompletionAdapter.initialize,
1101
+ addAssetStageCompletion: assetStageCompletionAdapter.addOne,
1102
+ addAssetStageCompletions: assetStageCompletionAdapter.addMany,
1103
+ updateAssetStageCompletion: assetStageCompletionAdapter.updateOne,
1104
+ updateAssetStageCompletions: assetStageCompletionAdapter.updateMany,
1105
+ deleteAssetStageCompletion: assetStageCompletionAdapter.deleteOne,
1106
+ deleteAssetStageCompletions: assetStageCompletionAdapter.deleteMany
1027
1107
  }
1028
1108
  });
1029
- const { addStageCompletion, addStageCompletions, removeStageCompletions, setStageCompletions } = assetStageCompletionSlice.actions;
1030
- const selectCompletedStages = (state) => {
1031
- return state.assetStageCompletionReducer.completionsByAssetId;
1109
+ const {
1110
+ initializeAssetStageCompletions,
1111
+ addAssetStageCompletion,
1112
+ addAssetStageCompletions,
1113
+ updateAssetStageCompletion,
1114
+ updateAssetStageCompletions,
1115
+ deleteAssetStageCompletion,
1116
+ deleteAssetStageCompletions
1117
+ } = assetStageCompletionSlice.actions;
1118
+ const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
1119
+ const selectAssetStageCompletionMapping = (state) => {
1120
+ return state.assetStageCompletionReducer.instances;
1032
1121
  };
1033
- const selectCompletedStageIdsForAsset = restructureCreateSelectorWithArgs(
1034
- createSelector([selectCompletedStages, (_state, asset) => asset], (completedStages, asset) => {
1035
- return Object.keys(completedStages[asset.offline_id] ?? {});
1122
+ const selectCompletedStagesByAssetProcedureCompletion = createSelector(
1123
+ [selectAssetStageCompletionMapping],
1124
+ (completedStagesMapping) => {
1125
+ const completedStagesByAsset = {};
1126
+ for (const stageCompletion of Object.values(completedStagesMapping)) {
1127
+ const { asset_procedure_completion, stage, submitted_at } = stageCompletion;
1128
+ if (!completedStagesByAsset[asset_procedure_completion])
1129
+ completedStagesByAsset[asset_procedure_completion] = {};
1130
+ completedStagesByAsset[asset_procedure_completion][stage] = submitted_at;
1131
+ }
1132
+ return completedStagesByAsset;
1133
+ }
1134
+ );
1135
+ const selectCompletedStageIdsOfAssetProcedureCompletion = restructureCreateSelectorWithArgs(
1136
+ createSelector([selectAssetStageCompletionMapping, (_state, id) => id], (completedStages, id) => {
1137
+ return Object.keys(completedStages[id] ?? {});
1138
+ })
1139
+ );
1140
+ const selectAssetStageCompletionById = (id) => (state) => {
1141
+ return state.assetStageCompletionReducer.instances[id];
1142
+ };
1143
+ const selectAssetStageCompletionsByIds = restructureCreateSelectorWithArgs(
1144
+ createSelector([selectAssetStageCompletionMapping, (_, ids) => ids], (stageCompletionMapping, ids) => {
1145
+ const stageCompletionIdsSet = new Set(ids);
1146
+ return fallbackToEmptyArray(
1147
+ Object.values(stageCompletionMapping).filter(
1148
+ (stageCompletion) => stageCompletionIdsSet.has(stageCompletion.offline_id)
1149
+ )
1150
+ );
1036
1151
  })
1037
1152
  );
1038
- const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
1039
1153
  const assetStageAdapter = createModelAdapter((assetStage) => assetStage.offline_id);
1040
- const initialState$w = assetStageAdapter.getInitialState({});
1154
+ const initialState$z = assetStageAdapter.getInitialState({});
1041
1155
  const assetStageSlice = createSlice({
1042
1156
  name: "assetStages",
1043
- initialState: initialState$w,
1044
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
1157
+ initialState: initialState$z,
1158
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
1045
1159
  reducers: {
1046
- initializeStages: assetStageAdapter.initialize,
1047
- setStage: assetStageAdapter.setOne,
1048
- addStages: assetStageAdapter.addMany,
1049
- updateStage: assetStageAdapter.updateOne,
1050
- updateStages: assetStageAdapter.updateMany,
1051
- removeStages: assetStageAdapter.deleteMany
1160
+ initializeAssetStages: assetStageAdapter.initialize,
1161
+ setAssetStage: assetStageAdapter.setOne,
1162
+ setAssetStages: assetStageAdapter.setMany,
1163
+ addAssetStage: assetStageAdapter.addOne,
1164
+ addAssetStages: assetStageAdapter.addMany,
1165
+ updateAssetStage: assetStageAdapter.updateOne,
1166
+ updateAssetStages: assetStageAdapter.updateMany,
1167
+ deleteAssetStage: assetStageAdapter.deleteOne,
1168
+ deleteAssetStages: assetStageAdapter.deleteMany
1052
1169
  }
1053
1170
  });
1171
+ const {
1172
+ initializeAssetStages,
1173
+ setAssetStage,
1174
+ setAssetStages,
1175
+ addAssetStage,
1176
+ addAssetStages,
1177
+ updateAssetStage,
1178
+ updateAssetStages,
1179
+ deleteAssetStage,
1180
+ deleteAssetStages
1181
+ } = assetStageSlice.actions;
1182
+ const assetStageReducer = assetStageSlice.reducer;
1054
1183
  const selectStageMapping = (state) => state.assetStageReducer.instances;
1055
1184
  const selectAssetStageById = (id) => (state) => {
1056
1185
  return state.assetStageReducer.instances[id];
@@ -1058,40 +1187,20 @@ const selectAssetStageById = (id) => (state) => {
1058
1187
  const selectAssetStages = createSelector([selectStageMapping], (stageMapping) => {
1059
1188
  return Object.values(stageMapping);
1060
1189
  });
1061
- const selectStagesFromAssetTypeIds = restructureCreateSelectorWithArgs(
1062
- createSelector([selectAssetStages, (_state, assetTypeIds) => assetTypeIds], (stages, assetTypeIds) => {
1063
- const assetTypeIdsSet = new Set(assetTypeIds);
1064
- const ret = {};
1065
- for (const stage of stages) {
1066
- if (assetTypeIdsSet.has(stage.asset_type)) {
1067
- if (!ret[stage.asset_type]) {
1068
- ret[stage.asset_type] = [];
1069
- }
1070
- ret[stage.asset_type].push(stage);
1071
- }
1072
- }
1073
- for (const key in ret) {
1074
- ret[key] = ret[key].sort((a, b) => a.priority - b.priority);
1075
- }
1076
- return ret;
1077
- })
1078
- );
1079
- const selectAssetTypeStagesMapping = restructureCreateSelectorWithArgs(
1080
- createSelector([selectStageMapping, (_state, assetTypeId) => assetTypeId], (stagesMapping, assetTypeId) => {
1081
- const assetTypeStagesMapping = {};
1190
+ const selectAssetStagesMappingOfAssetProcedure = restructureCreateSelectorWithArgs(
1191
+ createSelector([selectStageMapping, (_state, id) => id], (stagesMapping, id) => {
1192
+ const assetStageMapping = {};
1082
1193
  for (const [stageId, stage] of Object.entries(stagesMapping)) {
1083
- if (stage.asset_type === assetTypeId) {
1084
- assetTypeStagesMapping[stageId] = stage;
1194
+ if (stage.asset_procedure === id) {
1195
+ assetStageMapping[stageId] = stage;
1085
1196
  }
1086
1197
  }
1087
- return assetTypeStagesMapping;
1198
+ return assetStageMapping;
1088
1199
  })
1089
1200
  );
1090
- const selectStagesOfAssetType = restructureCreateSelectorWithArgs(
1091
- createSelector([selectAssetStages, (_state, assetTypeId) => assetTypeId], (stages, assetTypeId) => {
1092
- return fallbackToEmptyArray(
1093
- stages.filter((stage) => stage.asset_type === assetTypeId).sort((a, b) => a.priority - b.priority)
1094
- );
1201
+ const selectAssetStagesOfAssetProcedure = restructureCreateSelectorWithArgs(
1202
+ createSelector([selectAssetStages, (_state, id) => id], (stages, id) => {
1203
+ return fallbackToEmptyArray(stages.filter((stage) => stage.asset_procedure === id));
1095
1204
  })
1096
1205
  );
1097
1206
  const selectAssetStagesByIds = restructureCreateSelectorWithArgs(
@@ -1123,21 +1232,35 @@ const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
1123
1232
  return ret;
1124
1233
  })
1125
1234
  );
1126
- const { initializeStages, setStage, addStages, updateStages, removeStages, updateStage } = assetStageSlice.actions;
1127
- const assetStageReducer = assetStageSlice.reducer;
1128
1235
  const assetTypeAdapter = createModelAdapter((assetType) => assetType.offline_id);
1129
- const initialState$v = assetTypeAdapter.getInitialState({});
1236
+ const initialState$y = assetTypeAdapter.getInitialState({});
1130
1237
  const assetTypeSlice = createSlice({
1131
1238
  name: "assetTypes",
1132
- initialState: initialState$v,
1133
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
1239
+ initialState: initialState$y,
1240
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
1134
1241
  reducers: {
1135
1242
  initializeAssetTypes: assetTypeAdapter.initialize,
1243
+ setAssetType: assetTypeAdapter.setOne,
1244
+ setAssetTypes: assetTypeAdapter.setMany,
1136
1245
  addAssetType: assetTypeAdapter.addOne,
1137
- deleteAssetType: assetTypeAdapter.deleteOne
1246
+ addAssetTypes: assetTypeAdapter.addMany,
1247
+ updateAssetType: assetTypeAdapter.updateOne,
1248
+ updateAssetTypes: assetTypeAdapter.updateMany,
1249
+ deleteAssetType: assetTypeAdapter.deleteOne,
1250
+ deleteAssetTypes: assetTypeAdapter.deleteMany
1138
1251
  }
1139
1252
  });
1140
- const { addAssetType, initializeAssetTypes, deleteAssetType } = assetTypeSlice.actions;
1253
+ const {
1254
+ initializeAssetTypes,
1255
+ setAssetType,
1256
+ setAssetTypes,
1257
+ addAssetType,
1258
+ addAssetTypes,
1259
+ updateAssetType,
1260
+ updateAssetTypes,
1261
+ deleteAssetType,
1262
+ deleteAssetTypes
1263
+ } = assetTypeSlice.actions;
1141
1264
  const selectAssetTypesMapping = (state) => state.assetTypeReducer.instances;
1142
1265
  const selectAssetTypes = createSelector(
1143
1266
  [selectAssetTypesMapping],
@@ -1167,11 +1290,11 @@ const assetTypeReducer = assetTypeSlice.reducer;
1167
1290
  const assetTypeAttachmentAdapter = createModelAdapter(
1168
1291
  (attachment) => attachment.offline_id
1169
1292
  );
1170
- const initialState$u = assetTypeAttachmentAdapter.getInitialState({});
1293
+ const initialState$x = assetTypeAttachmentAdapter.getInitialState({});
1171
1294
  const assetTypeAttachmentSlice = createSlice({
1172
1295
  name: "assetTypeAttachments",
1173
- initialState: initialState$u,
1174
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$u)),
1296
+ initialState: initialState$x,
1297
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
1175
1298
  reducers: {
1176
1299
  initializeAssetTypeAttachments: assetTypeAttachmentAdapter.initialize,
1177
1300
  addAssetTypeAttachment: assetTypeAttachmentAdapter.addOne,
@@ -1230,10 +1353,10 @@ const selectAttachmentsOfAssetTypeByType = restructureCreateSelectorWithArgs(
1230
1353
  );
1231
1354
  const assetTypeAttachmentReducer = assetTypeAttachmentSlice.reducer;
1232
1355
  const workspaceAdapter = createModelAdapter((workspace) => workspace.offline_id);
1233
- const initialState$t = workspaceAdapter.getInitialState({});
1356
+ const initialState$w = workspaceAdapter.getInitialState({});
1234
1357
  const workspaceSlice = createSlice({
1235
1358
  name: "workspace",
1236
- initialState: initialState$t,
1359
+ initialState: initialState$w,
1237
1360
  reducers: {
1238
1361
  initializeWorkspaces: workspaceAdapter.initialize,
1239
1362
  setWorkspaces: workspaceAdapter.setMany,
@@ -1265,14 +1388,14 @@ const selectPermittedWorkspaceIds = createSelector(
1265
1388
  const workspaceReducer = workspaceSlice.reducer;
1266
1389
  const maxRecentIssues = 10;
1267
1390
  const issueAdapter = createModelAdapter((issue) => issue.offline_id);
1268
- const initialState$s = issueAdapter.getInitialState({
1391
+ const initialState$v = issueAdapter.getInitialState({
1269
1392
  recentIssueIds: []
1270
1393
  });
1271
1394
  const issueSlice = createSlice({
1272
1395
  name: "issues",
1273
- initialState: initialState$s,
1396
+ initialState: initialState$v,
1274
1397
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
1275
- Object.assign(state, initialState$s);
1398
+ Object.assign(state, initialState$v);
1276
1399
  }),
1277
1400
  reducers: {
1278
1401
  initializeIssues: issueAdapter.initialize,
@@ -1428,12 +1551,12 @@ const selectRecentIssuesAsSearchResults = createSelector(
1428
1551
  );
1429
1552
  const issueReducer = issueSlice.reducer;
1430
1553
  const issueTypeAdapter = createModelAdapter((issueType) => issueType.offline_id);
1431
- const initialState$r = issueTypeAdapter.getInitialState({});
1554
+ const initialState$u = issueTypeAdapter.getInitialState({});
1432
1555
  const issueTypeSlice = createSlice({
1433
1556
  name: "issueTypes",
1434
- initialState: initialState$r,
1557
+ initialState: initialState$u,
1435
1558
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
1436
- Object.assign(state, initialState$r);
1559
+ Object.assign(state, initialState$u);
1437
1560
  }),
1438
1561
  reducers: {
1439
1562
  initializeIssueTypes: issueTypeAdapter.initialize,
@@ -1490,15 +1613,15 @@ const selectIssuesOfIssueTypeCount = (issueTypeId) => (state) => {
1490
1613
  return selectIssuesOfIssueType(issueTypeId)(state).length;
1491
1614
  };
1492
1615
  const issueTypeReducer = issueTypeSlice.reducer;
1493
- const initialState$q = {
1616
+ const initialState$t = {
1494
1617
  s3Urls: {}
1495
1618
  };
1496
1619
  const msPerHour = 1e3 * 60 * 60;
1497
1620
  const msPerWeek = msPerHour * 24 * 7;
1498
1621
  const fileSlice = createSlice({
1499
1622
  name: "file",
1500
- initialState: initialState$q,
1501
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
1623
+ initialState: initialState$t,
1624
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$t)),
1502
1625
  reducers: {
1503
1626
  setUploadUrl: (state, action) => {
1504
1627
  const { url, fields, sha1 } = action.payload;
@@ -1525,73 +1648,14 @@ const selectUploadUrl = (sha1) => (state) => {
1525
1648
  return url;
1526
1649
  };
1527
1650
  const fileReducer = fileSlice.reducer;
1528
- var ProjectAccessLevel = /* @__PURE__ */ ((ProjectAccessLevel2) => {
1529
- ProjectAccessLevel2[ProjectAccessLevel2["BASIC"] = 0] = "BASIC";
1530
- ProjectAccessLevel2[ProjectAccessLevel2["ADMIN"] = 2] = "ADMIN";
1531
- return ProjectAccessLevel2;
1532
- })(ProjectAccessLevel || {});
1533
- var OrganizationAccessLevel = /* @__PURE__ */ ((OrganizationAccessLevel2) => {
1534
- OrganizationAccessLevel2[OrganizationAccessLevel2["BASIC"] = 0] = "BASIC";
1535
- OrganizationAccessLevel2[OrganizationAccessLevel2["ADMIN"] = 2] = "ADMIN";
1536
- return OrganizationAccessLevel2;
1537
- })(OrganizationAccessLevel || {});
1538
- var AttachmentModel = /* @__PURE__ */ ((AttachmentModel2) => {
1539
- AttachmentModel2["Issue"] = "issue";
1540
- AttachmentModel2["Asset"] = "asset";
1541
- AttachmentModel2["AssetType"] = "asset_type";
1542
- AttachmentModel2["Project"] = "project";
1543
- AttachmentModel2["Document"] = "document";
1544
- return AttachmentModel2;
1545
- })(AttachmentModel || {});
1546
- var IssueUpdateChange = /* @__PURE__ */ ((IssueUpdateChange2) => {
1547
- IssueUpdateChange2["STATUS"] = "status";
1548
- IssueUpdateChange2["PRIORITY"] = "priority";
1549
- IssueUpdateChange2["CATEGORY"] = "category";
1550
- IssueUpdateChange2["DESCRIPTION"] = "description";
1551
- IssueUpdateChange2["TITLE"] = "title";
1552
- IssueUpdateChange2["ASSIGNED_TO"] = "assigned_to";
1553
- IssueUpdateChange2["DUE_DATE"] = "due_date";
1554
- return IssueUpdateChange2;
1555
- })(IssueUpdateChange || {});
1556
- var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
1557
- VerificationCodeType2[VerificationCodeType2["USER_REGISTRATION"] = 0] = "USER_REGISTRATION";
1558
- VerificationCodeType2[VerificationCodeType2["APPLICATION_INVITE"] = 2] = "APPLICATION_INVITE";
1559
- VerificationCodeType2[VerificationCodeType2["PROJECT_INVITE"] = 4] = "PROJECT_INVITE";
1560
- VerificationCodeType2[VerificationCodeType2["ORGANIZATION_INVITE"] = 6] = "ORGANIZATION_INVITE";
1561
- VerificationCodeType2[VerificationCodeType2["ADD_EMAIL_DOMAIN"] = 8] = "ADD_EMAIL_DOMAIN";
1562
- VerificationCodeType2[VerificationCodeType2["RESET_PASSWORD"] = 10] = "RESET_PASSWORD";
1563
- return VerificationCodeType2;
1564
- })(VerificationCodeType || {});
1565
- var PaddleCheckoutEvent = /* @__PURE__ */ ((PaddleCheckoutEvent2) => {
1566
- PaddleCheckoutEvent2["COMPLETED"] = "checkout.completed";
1567
- PaddleCheckoutEvent2["CLOSED"] = "checkout.closed";
1568
- return PaddleCheckoutEvent2;
1569
- })(PaddleCheckoutEvent || {});
1570
- var LicenseLevel = /* @__PURE__ */ ((LicenseLevel2) => {
1571
- LicenseLevel2[LicenseLevel2["PRO"] = 0] = "PRO";
1572
- return LicenseLevel2;
1573
- })(LicenseLevel || {});
1574
- var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
1575
- LicenseStatus2[LicenseStatus2["ACTIVE"] = 0] = "ACTIVE";
1576
- LicenseStatus2[LicenseStatus2["PAUSED"] = 2] = "PAUSED";
1577
- LicenseStatus2[LicenseStatus2["CANCELLED"] = 4] = "CANCELLED";
1578
- LicenseStatus2[LicenseStatus2["INACTIVE"] = 6] = "INACTIVE";
1579
- LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
1580
- return LicenseStatus2;
1581
- })(LicenseStatus || {});
1582
- const initialState$p = {
1651
+ const initialState$s = {
1583
1652
  users: {},
1584
- currentUser: {
1585
- id: 0,
1586
- username: "",
1587
- email: "",
1588
- profile: { file: null, file_sha1: null, favourite_project_ids: [], tour_step: -1 }
1589
- }
1653
+ currentUser: null
1590
1654
  };
1591
1655
  const userSlice = createSlice({
1592
1656
  name: "users",
1593
- initialState: initialState$p,
1594
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
1657
+ initialState: initialState$s,
1658
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$s)),
1595
1659
  reducers: {
1596
1660
  setUsers: (state, action) => {
1597
1661
  const usersMapping = {};
@@ -1609,6 +1673,8 @@ const userSlice = createSlice({
1609
1673
  state.currentUser = action.payload;
1610
1674
  },
1611
1675
  setProfilePicture: (state, action) => {
1676
+ if (!state.currentUser)
1677
+ return;
1612
1678
  state.currentUser.profile.file = action.payload.file ?? null;
1613
1679
  state.currentUser.profile.file_sha1 = action.payload.file_sha1 ?? null;
1614
1680
  const currentUser = state.users[state.currentUser.id];
@@ -1618,32 +1684,12 @@ const userSlice = createSlice({
1618
1684
  currentUser.profile.file = action.payload.file ?? null;
1619
1685
  currentUser.profile.file_sha1 = action.payload.file_sha1 ?? null;
1620
1686
  },
1621
- addFavouriteProjectId: (state, action) => {
1622
- state.currentUser.profile.favourite_project_ids.push(action.payload);
1623
- },
1624
- removeFavouriteProjectId: (state, action) => {
1625
- state.currentUser.profile.favourite_project_ids = state.currentUser.profile.favourite_project_ids.filter(
1626
- (id) => id !== action.payload
1627
- );
1628
- },
1629
- setTourStep: (state, action) => {
1630
- state.currentUser.profile.tour_step = action.payload;
1631
- },
1632
1687
  removeUser: (state, action) => {
1633
1688
  delete state.users[action.payload];
1634
1689
  }
1635
1690
  }
1636
1691
  });
1637
- const {
1638
- setCurrentUser,
1639
- setProfilePicture,
1640
- setUsers,
1641
- addUsers,
1642
- addFavouriteProjectId,
1643
- removeFavouriteProjectId,
1644
- setTourStep,
1645
- removeUser
1646
- } = userSlice.actions;
1692
+ const { setCurrentUser, setProfilePicture, setUsers, addUsers, removeUser } = userSlice.actions;
1647
1693
  const userReducer = userSlice.reducer;
1648
1694
  const selectCurrentUser = (state) => state.userReducer.currentUser;
1649
1695
  const selectUsersMapping = (state) => state.userReducer.users;
@@ -1664,15 +1710,14 @@ const selectUsersByIds = restructureCreateSelectorWithArgs(
1664
1710
  return fallbackToEmptyArray(users);
1665
1711
  })
1666
1712
  );
1667
- const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
1668
1713
  const organizationAccessAdapter = createModelAdapter(
1669
1714
  (organizationAccess) => organizationAccess.offline_id
1670
1715
  );
1671
- const initialState$o = organizationAccessAdapter.getInitialState({});
1716
+ const initialState$r = organizationAccessAdapter.getInitialState({});
1672
1717
  const organizationAccessSlice = createSlice({
1673
1718
  name: "organizationAccess",
1674
- initialState: initialState$o,
1675
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
1719
+ initialState: initialState$r,
1720
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$r)),
1676
1721
  reducers: {
1677
1722
  initializeOrganizationAccesses: organizationAccessAdapter.initialize,
1678
1723
  updateOrganizationAccess: organizationAccessAdapter.updateOne,
@@ -1690,7 +1735,7 @@ const selectActiveOrganizationAccess = createSelector(
1690
1735
  [selectCurrentUser, selectOrganizationAccesses],
1691
1736
  (currentUser, organizationAccesses) => {
1692
1737
  const activeOrganizationAccess = Object.values(organizationAccesses).find(
1693
- (organizationAccess) => organizationAccess.user === currentUser.id
1738
+ (organizationAccess) => organizationAccess.user === (currentUser == null ? void 0 : currentUser.id)
1694
1739
  );
1695
1740
  return activeOrganizationAccess ?? null;
1696
1741
  }
@@ -1709,11 +1754,11 @@ const selectOrganizationAccessUserMapping = (state) => {
1709
1754
  };
1710
1755
  const organizationAccessReducer = organizationAccessSlice.reducer;
1711
1756
  const licenseAdapter = createModelAdapter((license) => license.offline_id);
1712
- const initialState$n = licenseAdapter.getInitialState({});
1757
+ const initialState$q = licenseAdapter.getInitialState({});
1713
1758
  const licenseSlice = createSlice({
1714
1759
  name: "license",
1715
- initialState: initialState$n,
1716
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
1760
+ initialState: initialState$q,
1761
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
1717
1762
  reducers: {
1718
1763
  initializeLicences: licenseAdapter.initialize,
1719
1764
  addLicenses: licenseAdapter.addMany,
@@ -1738,11 +1783,11 @@ const selectLicensesForProjectsMapping = createSelector(
1738
1783
  );
1739
1784
  const licenseReducer = licenseSlice.reducer;
1740
1785
  const projectAccessAdapter = createModelAdapter((projectAccess) => projectAccess.offline_id);
1741
- const initialState$m = projectAccessAdapter.getInitialState({});
1786
+ const initialState$p = projectAccessAdapter.getInitialState({});
1742
1787
  const projectAccessSlice = createSlice({
1743
1788
  name: "projectAccess",
1744
- initialState: initialState$m,
1745
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
1789
+ initialState: initialState$p,
1790
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
1746
1791
  reducers: {
1747
1792
  initializeProjectAccesses: projectAccessAdapter.initialize,
1748
1793
  updateProjectAccess: projectAccessAdapter.updateOne,
@@ -1783,14 +1828,14 @@ const selectProjectAccessUserMapping = (state) => {
1783
1828
  return projectAccesses;
1784
1829
  };
1785
1830
  const projectAccessReducer = projectAccessSlice.reducer;
1786
- const initialState$l = {
1831
+ const initialState$o = {
1787
1832
  projects: {},
1788
1833
  activeProjectId: null
1789
1834
  };
1790
1835
  const projectSlice = createSlice({
1791
1836
  name: "projects",
1792
- initialState: initialState$l,
1793
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
1837
+ initialState: initialState$o,
1838
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
1794
1839
  reducers: {
1795
1840
  setProjects: (state, action) => {
1796
1841
  const projectsMap = {};
@@ -1880,9 +1925,9 @@ const selectSortedProjectUsers = createSelector(
1880
1925
  [selectCurrentUser, selectProjectUsersAsMapping, selectProjectAccessUserMapping],
1881
1926
  (currentUser, userMapping, projectAccessMapping) => {
1882
1927
  return Object.values(userMapping).sort((userA, userB) => {
1883
- if (userA.id === currentUser.id) {
1928
+ if (userA.id === (currentUser == null ? void 0 : currentUser.id)) {
1884
1929
  return -1;
1885
- } else if (userB.id === currentUser.id) {
1930
+ } else if (userB.id === (currentUser == null ? void 0 : currentUser.id)) {
1886
1931
  return 1;
1887
1932
  }
1888
1933
  const projectAccessesA = projectAccessMapping[userA.id];
@@ -1897,13 +1942,13 @@ const selectSortedProjectUsers = createSelector(
1897
1942
  });
1898
1943
  }
1899
1944
  );
1900
- const initialState$k = {
1945
+ const initialState$n = {
1901
1946
  organizations: {}
1902
1947
  };
1903
1948
  const organizationSlice = createSlice({
1904
1949
  name: "organizations",
1905
- initialState: initialState$k,
1906
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
1950
+ initialState: initialState$n,
1951
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
1907
1952
  reducers: {
1908
1953
  setOrganizations: (state, action) => {
1909
1954
  for (const org of action.payload) {
@@ -1959,9 +2004,9 @@ const selectSortedOrganizationUsers = createSelector(
1959
2004
  [selectCurrentUser, selectOrganizationUsersAsMapping, selectOrganizationAccessUserMapping],
1960
2005
  (currentUser, userMapping, organizationAccessMapping) => {
1961
2006
  return Object.values(userMapping).sort((userA, userB) => {
1962
- if (userA.id === currentUser.id) {
2007
+ if (userA.id === (currentUser == null ? void 0 : currentUser.id)) {
1963
2008
  return -1;
1964
- } else if (userB.id === currentUser.id) {
2009
+ } else if (userB.id === (currentUser == null ? void 0 : currentUser.id)) {
1965
2010
  return 1;
1966
2011
  }
1967
2012
  const organizationAccessesA = organizationAccessMapping[userA.id];
@@ -1994,14 +2039,14 @@ const createOfflineAction = (request2, baseUrl, serviceName) => {
1994
2039
  }
1995
2040
  };
1996
2041
  };
1997
- const initialState$j = {
2042
+ const initialState$m = {
1998
2043
  deletedRequests: [],
1999
2044
  latestRetryTime: 0
2000
2045
  };
2001
2046
  const outboxSlice = createSlice({
2002
2047
  name: "outbox",
2003
- initialState: initialState$j,
2004
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
2048
+ initialState: initialState$m,
2049
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
2005
2050
  reducers: {
2006
2051
  // enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
2007
2052
  // Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
@@ -2033,15 +2078,15 @@ const selectDeletedRequests = (state) => state.outboxReducer.deletedRequests;
2033
2078
  const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
2034
2079
  const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
2035
2080
  const outboxReducer = outboxSlice.reducer;
2036
- const initialState$i = {
2081
+ const initialState$l = {
2037
2082
  projectFiles: {},
2038
2083
  activeProjectFileId: null,
2039
2084
  isImportingProjectFile: false
2040
2085
  };
2041
2086
  const projectFileSlice = createSlice({
2042
2087
  name: "projectFiles",
2043
- initialState: initialState$i,
2044
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
2088
+ initialState: initialState$l,
2089
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
2045
2090
  reducers: {
2046
2091
  addOrReplaceProjectFiles: (state, action) => {
2047
2092
  for (let fileObj of action.payload) {
@@ -2128,11 +2173,11 @@ const selectProjectFileById = (id) => (state) => {
2128
2173
  };
2129
2174
  const projectFileReducer = projectFileSlice.reducer;
2130
2175
  const projectAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
2131
- const initialState$h = projectAttachmentAdapter.getInitialState({});
2176
+ const initialState$k = projectAttachmentAdapter.getInitialState({});
2132
2177
  const projectAttachmentSlice = createSlice({
2133
2178
  name: "projectAttachments",
2134
- initialState: initialState$h,
2135
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
2179
+ initialState: initialState$k,
2180
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
2136
2181
  reducers: {
2137
2182
  initializeProjectAttachments: projectAttachmentAdapter.initialize,
2138
2183
  addProjectAttachment: projectAttachmentAdapter.addOne,
@@ -2187,12 +2232,12 @@ const selectAttachmentsOfProjectByType = restructureCreateSelectorWithArgs(
2187
2232
  )
2188
2233
  );
2189
2234
  const projectAttachmentReducer = projectAttachmentSlice.reducer;
2190
- const initialState$g = {
2235
+ const initialState$j = {
2191
2236
  isRehydrated: false
2192
2237
  };
2193
2238
  const rehydratedSlice = createSlice({
2194
2239
  name: "rehydrated",
2195
- initialState: initialState$g,
2240
+ initialState: initialState$j,
2196
2241
  // The `reducers` field lets us define reducers and generate associated actions
2197
2242
  reducers: {
2198
2243
  setRehydrated: (state, action) => {
@@ -2217,11 +2262,11 @@ const formRevisionSortFn = (formRevisionA, formRevisionB) => {
2217
2262
  }
2218
2263
  };
2219
2264
  const formRevisionAdapter = createModelAdapter((revision) => revision.offline_id);
2220
- const initialState$f = formRevisionAdapter.getInitialState({});
2265
+ const initialState$i = formRevisionAdapter.getInitialState({});
2221
2266
  const formRevisionsSlice = createSlice({
2222
2267
  name: "formRevisions",
2223
- initialState: initialState$f,
2224
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
2268
+ initialState: initialState$i,
2269
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
2225
2270
  reducers: {
2226
2271
  initializeFormRevisions: formRevisionAdapter.initialize,
2227
2272
  setFormRevision: formRevisionAdapter.setOne,
@@ -2293,11 +2338,11 @@ const selectLatestFormRevisionByForm = createSelector([selectFormRevisionMapping
2293
2338
  });
2294
2339
  const formRevisionReducer = formRevisionsSlice.reducer;
2295
2340
  const formAdapter = createModelAdapter((form) => form.offline_id);
2296
- const initialState$e = formAdapter.getInitialState({});
2341
+ const initialState$h = formAdapter.getInitialState({});
2297
2342
  const formSlice = createSlice({
2298
2343
  name: "forms",
2299
- initialState: initialState$e,
2300
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
2344
+ initialState: initialState$h,
2345
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
2301
2346
  reducers: {
2302
2347
  initializeForms: formAdapter.initialize,
2303
2348
  setForm: formAdapter.setOne,
@@ -2377,11 +2422,11 @@ const selectGeneralFormCount = createSelector([selectFormMapping], (formsMapping
2377
2422
  return Object.values(formsMapping).filter((form) => !form.asset_type).length;
2378
2423
  });
2379
2424
  const submissionAdapter = createModelAdapter((submission) => submission.offline_id);
2380
- const initialState$d = submissionAdapter.getInitialState({});
2425
+ const initialState$g = submissionAdapter.getInitialState({});
2381
2426
  const formSubmissionSlice = createSlice({
2382
2427
  name: "formSubmissions",
2383
- initialState: initialState$d,
2384
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
2428
+ initialState: initialState$g,
2429
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
2385
2430
  reducers: {
2386
2431
  initializeFormSubmissions: submissionAdapter.initialize,
2387
2432
  setFormSubmission: submissionAdapter.setOne,
@@ -2593,11 +2638,11 @@ const formSubmissionReducer = formSubmissionSlice.reducer;
2593
2638
  const formSubmissionAttachmentAdapter = createModelAdapter(
2594
2639
  (attachment) => attachment.offline_id
2595
2640
  );
2596
- const initialState$c = formSubmissionAttachmentAdapter.getInitialState({});
2641
+ const initialState$f = formSubmissionAttachmentAdapter.getInitialState({});
2597
2642
  const formSubmissionAttachmentSlice = createSlice({
2598
2643
  name: "formSubmissionAttachments",
2599
- initialState: initialState$c,
2600
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
2644
+ initialState: initialState$f,
2645
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
2601
2646
  reducers: {
2602
2647
  initializeFormSubmissionAttachments: formSubmissionAttachmentAdapter.initialize,
2603
2648
  addFormSubmissionAttachment: formSubmissionAttachmentAdapter.addOne,
@@ -2649,11 +2694,11 @@ const formSubmissionAttachmentReducer = formSubmissionAttachmentSlice.reducer;
2649
2694
  const formRevisionAttachmentAdapter = createModelAdapter(
2650
2695
  (attachment) => attachment.offline_id
2651
2696
  );
2652
- const initialState$b = formRevisionAttachmentAdapter.getInitialState({});
2697
+ const initialState$e = formRevisionAttachmentAdapter.getInitialState({});
2653
2698
  const formRevisionAttachmentSlice = createSlice({
2654
2699
  name: "formRevisionAttachments",
2655
- initialState: initialState$b,
2656
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
2700
+ initialState: initialState$e,
2701
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
2657
2702
  reducers: {
2658
2703
  initializeFormRevisionAttachments: formRevisionAttachmentAdapter.initialize,
2659
2704
  addFormRevisionAttachment: formRevisionAttachmentAdapter.addOne,
@@ -2692,10 +2737,10 @@ const selectAttachmentsOfFormRevision = restructureCreateSelectorWithArgs(
2692
2737
  );
2693
2738
  const formRevisionAttachmentReducer = formRevisionAttachmentSlice.reducer;
2694
2739
  const emailDomainAdapter = createModelAdapter((emailDomain) => emailDomain.offline_id);
2695
- const initialState$a = emailDomainAdapter.getInitialState({});
2740
+ const initialState$d = emailDomainAdapter.getInitialState({});
2696
2741
  const emailDomainsSlice = createSlice({
2697
2742
  name: "emailDomains",
2698
- initialState: initialState$a,
2743
+ initialState: initialState$d,
2699
2744
  reducers: {
2700
2745
  initializeEmailDomains: emailDomainAdapter.initialize,
2701
2746
  addEmailDomain: emailDomainAdapter.addOne,
@@ -2716,14 +2761,14 @@ const selectEmailDomainsOfOrganization = restructureCreateSelectorWithArgs(
2716
2761
  )
2717
2762
  );
2718
2763
  const emailDomainsReducer = emailDomainsSlice.reducer;
2719
- const initialState$9 = {
2764
+ const initialState$c = {
2720
2765
  documents: {}
2721
2766
  };
2722
2767
  const documentSlice = createSlice({
2723
2768
  name: "documents",
2724
- initialState: initialState$9,
2769
+ initialState: initialState$c,
2725
2770
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
2726
- Object.assign(state, initialState$9);
2771
+ Object.assign(state, initialState$c);
2727
2772
  }),
2728
2773
  reducers: {
2729
2774
  setDocuments: (state, action) => {
@@ -2912,11 +2957,11 @@ const selectRootDocuments = createSelector(
2912
2957
  );
2913
2958
  const documentsReducer = documentSlice.reducer;
2914
2959
  const documentAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
2915
- const initialState$8 = documentAttachmentAdapter.getInitialState({});
2960
+ const initialState$b = documentAttachmentAdapter.getInitialState({});
2916
2961
  const documentAttachmentSlice = createSlice({
2917
2962
  name: "documentAttachments",
2918
- initialState: initialState$8,
2919
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
2963
+ initialState: initialState$b,
2964
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
2920
2965
  reducers: {
2921
2966
  initializeDocumentAttachments: documentAttachmentAdapter.initialize,
2922
2967
  addDocumentAttachment: documentAttachmentAdapter.addOne,
@@ -2975,11 +3020,11 @@ const selectAttachmentsOfDocumentByType = restructureCreateSelectorWithArgs(
2975
3020
  );
2976
3021
  const documentAttachmentReducer = documentAttachmentSlice.reducer;
2977
3022
  const teamAdapter = createModelAdapter((team) => team.offline_id);
2978
- const initialState$7 = teamAdapter.getInitialState({});
3023
+ const initialState$a = teamAdapter.getInitialState({});
2979
3024
  const teamSlice = createSlice({
2980
3025
  name: "teams",
2981
- initialState: initialState$7,
2982
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
3026
+ initialState: initialState$a,
3027
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
2983
3028
  reducers: {
2984
3029
  setTeam: teamAdapter.setOne,
2985
3030
  initializeTeams: teamAdapter.initialize,
@@ -3030,11 +3075,11 @@ const teamReducer = teamSlice.reducer;
3030
3075
  const agentUserConversationAdapter = createModelAdapter(
3031
3076
  (conversation) => conversation.offline_id
3032
3077
  );
3033
- const initialState$6 = agentUserConversationAdapter.getInitialState({});
3078
+ const initialState$9 = agentUserConversationAdapter.getInitialState({});
3034
3079
  const agentsSlice = createSlice({
3035
3080
  name: "agents",
3036
- initialState: initialState$6,
3037
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
3081
+ initialState: initialState$9,
3082
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$9)),
3038
3083
  reducers: {
3039
3084
  initializeConversations: agentUserConversationAdapter.initialize,
3040
3085
  addConversation: agentUserConversationAdapter.addOne,
@@ -3056,11 +3101,11 @@ const selectConversation = restructureCreateSelectorWithArgs(
3056
3101
  );
3057
3102
  const agentsReducer = agentsSlice.reducer;
3058
3103
  const issueCommentAdapter = createModelAdapter((comment) => comment.offline_id);
3059
- const initialState$5 = issueCommentAdapter.getInitialState({});
3104
+ const initialState$8 = issueCommentAdapter.getInitialState({});
3060
3105
  const issueCommentSlice = createSlice({
3061
3106
  name: "issueComments",
3062
- initialState: initialState$5,
3063
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
3107
+ initialState: initialState$8,
3108
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
3064
3109
  reducers: {
3065
3110
  addIssueComment: issueCommentAdapter.addOne,
3066
3111
  addIssueComments: issueCommentAdapter.addMany,
@@ -3089,11 +3134,11 @@ const selectCommentsOfIssue = restructureCreateSelectorWithArgs(
3089
3134
  );
3090
3135
  const issueCommentReducer = issueCommentSlice.reducer;
3091
3136
  const issueUpdateAdapter = createModelAdapter((issueUpdate) => issueUpdate.offline_id);
3092
- const initialState$4 = issueUpdateAdapter.getInitialState({});
3137
+ const initialState$7 = issueUpdateAdapter.getInitialState({});
3093
3138
  const issueUpdateSlice = createSlice({
3094
3139
  name: "issueUpdates",
3095
- initialState: initialState$4,
3096
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
3140
+ initialState: initialState$7,
3141
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
3097
3142
  reducers: {
3098
3143
  initializeIssueUpdates: issueUpdateAdapter.setMany,
3099
3144
  setIssueUpdate: issueUpdateAdapter.setOne,
@@ -3122,11 +3167,11 @@ const selectIssueUpdatesOfIssue = restructureCreateSelectorWithArgs(
3122
3167
  );
3123
3168
  const issueUpdateReducer = issueUpdateSlice.reducer;
3124
3169
  const issueAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
3125
- const initialState$3 = issueAttachmentAdapter.getInitialState({});
3170
+ const initialState$6 = issueAttachmentAdapter.getInitialState({});
3126
3171
  const issueAttachmentSlice = createSlice({
3127
3172
  name: "issueAttachments",
3128
- initialState: initialState$3,
3129
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
3173
+ initialState: initialState$6,
3174
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
3130
3175
  reducers: {
3131
3176
  initializeIssueAttachments: issueAttachmentAdapter.initialize,
3132
3177
  addIssueAttachment: issueAttachmentAdapter.addOne,
@@ -3184,23 +3229,23 @@ const selectAttachmentsOfIssueByType = restructureCreateSelectorWithArgs(
3184
3229
  )
3185
3230
  );
3186
3231
  const issueAttachmentReducer = issueAttachmentSlice.reducer;
3187
- const initialState$2 = {
3232
+ const initialState$5 = {
3188
3233
  version: 0
3189
3234
  };
3190
3235
  const versioningSlice = createSlice({
3191
3236
  name: "versioning",
3192
- initialState: initialState$2,
3237
+ initialState: initialState$5,
3193
3238
  reducers: {}
3194
3239
  });
3195
3240
  const versioningReducer = versioningSlice.reducer;
3196
3241
  const geoImageAdapter = createModelAdapter((model) => model.offline_id);
3197
- const initialState$1 = geoImageAdapter.getInitialState({});
3242
+ const initialState$4 = geoImageAdapter.getInitialState({});
3198
3243
  const geoImageSlice = createSlice({
3199
3244
  name: "geoImages",
3200
- initialState: initialState$1,
3245
+ initialState: initialState$4,
3201
3246
  extraReducers: (builder) => {
3202
3247
  builder.addCase("RESET", (state) => {
3203
- Object.assign(state, initialState$1);
3248
+ Object.assign(state, initialState$4);
3204
3249
  });
3205
3250
  },
3206
3251
  reducers: {
@@ -3238,11 +3283,11 @@ const selectGeoImagesOfProject = restructureCreateSelectorWithArgs(
3238
3283
  );
3239
3284
  const geoImageReducer = geoImageSlice.reducer;
3240
3285
  const issueAssociationAdapter = createModelAdapter((assoc) => assoc.offline_id);
3241
- const initialState = issueAssociationAdapter.getInitialState({});
3286
+ const initialState$3 = issueAssociationAdapter.getInitialState({});
3242
3287
  const issueAssociationSlice = createSlice({
3243
3288
  name: "issueAssociations",
3244
- initialState,
3245
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState)),
3289
+ initialState: initialState$3,
3290
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
3246
3291
  reducers: {
3247
3292
  initializeIssueAssociations: issueAssociationAdapter.initialize,
3248
3293
  addIssueAssociation: issueAssociationAdapter.addOne,
@@ -3300,34 +3345,224 @@ const selectIssueAssociationsOfAsset = restructureCreateSelectorWithArgs(
3300
3345
  )
3301
3346
  );
3302
3347
  const issueAssociationReducer = issueAssociationSlice.reducer;
3303
- let clientStore;
3304
- function setClientStore(store) {
3305
- clientStore = store;
3306
- }
3307
- function getClientStore() {
3308
- return clientStore;
3309
- }
3310
- let clientSDK;
3311
- function setClientSDK(sdkCtor) {
3312
- clientSDK = sdkCtor;
3313
- }
3314
- function getClientSDK() {
3315
- return clientSDK;
3316
- }
3317
- const CLASS_NAME_TO_SERVICE = {};
3318
- class BaseService {
3319
- constructor(sdk) {
3320
- __publicField(this, "client");
3321
- CLASS_NAME_TO_SERVICE[this.constructor.name] = this;
3322
- this.client = sdk;
3348
+ const assetProcedureAdapter = createModelAdapter((assetProcedure) => assetProcedure.offline_id);
3349
+ const initialState$2 = assetProcedureAdapter.getInitialState({});
3350
+ const assetProcedureSlice = createSlice({
3351
+ name: "assetProcedures",
3352
+ initialState: initialState$2,
3353
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$2)),
3354
+ reducers: {
3355
+ initializeAssetProcedures: assetProcedureAdapter.initialize,
3356
+ addAssetProcedure: assetProcedureAdapter.addOne,
3357
+ addAssetProcedures: assetProcedureAdapter.addMany,
3358
+ setAssetProcedure: assetProcedureAdapter.setOne,
3359
+ setAssetProcedures: assetProcedureAdapter.setMany,
3360
+ updateAssetProcedure: assetProcedureAdapter.updateOne,
3361
+ updateAssetProcedures: assetProcedureAdapter.updateMany,
3362
+ deleteAssetProcedure: assetProcedureAdapter.deleteOne,
3363
+ deleteAssetProcedures: assetProcedureAdapter.deleteMany
3323
3364
  }
3324
- async enqueueRequest(requestDetails) {
3325
- return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
3365
+ });
3366
+ const {
3367
+ initializeAssetProcedures,
3368
+ addAssetProcedure,
3369
+ addAssetProcedures,
3370
+ updateAssetProcedure,
3371
+ updateAssetProcedures,
3372
+ deleteAssetProcedure,
3373
+ deleteAssetProcedures,
3374
+ setAssetProcedure,
3375
+ setAssetProcedures
3376
+ } = assetProcedureSlice.actions;
3377
+ const selectAssetProceduresMapping = (state) => state.assetProcedureReducer.instances;
3378
+ const selectAssetProcedures = createSelector([selectAssetProceduresMapping], (assetProceduresMapping) => {
3379
+ return Object.values(assetProceduresMapping);
3380
+ });
3381
+ const selectAssetProceduresOfOrganization = restructureCreateSelectorWithArgs(
3382
+ createSelector(
3383
+ [selectAssetProcedures, (_state, organizationId) => organizationId],
3384
+ (assetProcedures, organizationId) => {
3385
+ return fallbackToEmptyArray(
3386
+ assetProcedures.filter((assetProcedure) => assetProcedure.organization === organizationId)
3387
+ );
3388
+ }
3389
+ )
3390
+ );
3391
+ const selectAssetProcedureById = (assetProcedureId) => (state) => {
3392
+ return state.assetProcedureReducer.instances[assetProcedureId];
3393
+ };
3394
+ const selectAssetProceduresByIds = restructureCreateSelectorWithArgs(
3395
+ createSelector(
3396
+ [selectAssetProceduresMapping, (_, assetProcedureIds) => assetProcedureIds],
3397
+ (assetProceduresMapping, assetProcedureIds) => {
3398
+ const assetProcedures = [];
3399
+ for (const assetProcedureId of assetProcedureIds) {
3400
+ const assetProcedure = assetProceduresMapping[assetProcedureId];
3401
+ if (assetProcedure)
3402
+ assetProcedures.push(assetProcedure);
3403
+ }
3404
+ return fallbackToEmptyArray(assetProcedures);
3405
+ }
3406
+ )
3407
+ );
3408
+ const assetProcedureReducer = assetProcedureSlice.reducer;
3409
+ const assetProcedureInstanceAdapter = createModelAdapter(
3410
+ (assetProcedureInstance) => assetProcedureInstance.offline_id
3411
+ );
3412
+ const initialState$1 = assetProcedureInstanceAdapter.getInitialState({});
3413
+ const assetProcedureInstanceSlice = createSlice({
3414
+ name: "assetProcedureInstances",
3415
+ initialState: initialState$1,
3416
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$1)),
3417
+ reducers: {
3418
+ initializeAssetProcedureInstances: assetProcedureInstanceAdapter.initialize,
3419
+ addAssetProcedureInstance: assetProcedureInstanceAdapter.addOne,
3420
+ addAssetProcedureInstances: assetProcedureInstanceAdapter.addMany,
3421
+ setAssetProcedureInstance: assetProcedureInstanceAdapter.setOne,
3422
+ setAssetProcedureInstances: assetProcedureInstanceAdapter.setMany,
3423
+ updateAssetProcedureInstance: assetProcedureInstanceAdapter.updateOne,
3424
+ updateAssetProcedureInstances: assetProcedureInstanceAdapter.updateMany,
3425
+ deleteAssetProcedureInstance: assetProcedureInstanceAdapter.deleteOne,
3426
+ deleteAssetProcedureInstances: assetProcedureInstanceAdapter.deleteMany
3326
3427
  }
3327
- dispatch(action) {
3328
- this.client.store.dispatch(action);
3428
+ });
3429
+ const {
3430
+ initializeAssetProcedureInstances,
3431
+ addAssetProcedureInstance,
3432
+ addAssetProcedureInstances,
3433
+ updateAssetProcedureInstance,
3434
+ updateAssetProcedureInstances,
3435
+ deleteAssetProcedureInstance,
3436
+ deleteAssetProcedureInstances,
3437
+ setAssetProcedureInstance,
3438
+ setAssetProcedureInstances
3439
+ } = assetProcedureInstanceSlice.actions;
3440
+ const selectAssetProcedureInstancesMapping = (state) => state.assetProcedureInstanceReducer.instances;
3441
+ const selectAssetProcedureInstances = createSelector(
3442
+ [selectAssetProcedureInstancesMapping],
3443
+ (assetProcedureInstancesMapping) => {
3444
+ return Object.values(assetProcedureInstancesMapping);
3329
3445
  }
3330
- }
3446
+ );
3447
+ const selectAssetProcedureInstancesOfAssetProcedure = restructureCreateSelectorWithArgs(
3448
+ createSelector(
3449
+ [selectAssetProcedureInstances, (_state, assetProcedureId) => assetProcedureId],
3450
+ (assetProcedureInstances, assetProcedureId) => {
3451
+ return fallbackToEmptyArray(
3452
+ assetProcedureInstances.filter(
3453
+ (assetProcedureInstance) => assetProcedureInstance.asset_procedure === assetProcedureId
3454
+ )
3455
+ );
3456
+ }
3457
+ )
3458
+ );
3459
+ const selectAssetProcedureInstancesOfAssetType = restructureCreateSelectorWithArgs(
3460
+ createSelector(
3461
+ [selectAssetProcedureInstances, (_state, assetTypeId) => assetTypeId],
3462
+ (assetProcedureInstances, assetTypeId) => {
3463
+ return fallbackToEmptyArray(
3464
+ assetProcedureInstances.filter(
3465
+ (assetProcedureInstance) => assetProcedureInstance.asset_type === assetTypeId
3466
+ )
3467
+ );
3468
+ }
3469
+ )
3470
+ );
3471
+ const selectAssetProcedureInstanceById = (assetProcedureInstanceId) => (state) => {
3472
+ return state.assetProcedureInstanceReducer.instances[assetProcedureInstanceId];
3473
+ };
3474
+ const selectAssetProcedureInstancesByIds = restructureCreateSelectorWithArgs(
3475
+ createSelector(
3476
+ [selectAssetProcedureInstancesMapping, (_, assetProcedureInstanceIds) => assetProcedureInstanceIds],
3477
+ (assetProcedureInstancesMapping, assetProcedureInstanceIds) => {
3478
+ const assetProcedureInstances = [];
3479
+ for (const assetProcedureInstanceId of assetProcedureInstanceIds) {
3480
+ const assetProcedureInstance = assetProcedureInstancesMapping[assetProcedureInstanceId];
3481
+ if (assetProcedureInstance)
3482
+ assetProcedureInstances.push(assetProcedureInstance);
3483
+ }
3484
+ return fallbackToEmptyArray(assetProcedureInstances);
3485
+ }
3486
+ )
3487
+ );
3488
+ const assetProcedureInstanceReducer = assetProcedureInstanceSlice.reducer;
3489
+ const assetProcedureCompletionAdapter = createModelAdapter(
3490
+ (assetProcedureCompletion) => assetProcedureCompletion.offline_id
3491
+ );
3492
+ const initialState = assetProcedureCompletionAdapter.getInitialState({});
3493
+ const assetProcedureCompletionSlice = createSlice({
3494
+ name: "assetProcedureCompletions",
3495
+ initialState,
3496
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState)),
3497
+ reducers: {
3498
+ initializeAssetProcedureCompletions: assetProcedureCompletionAdapter.initialize,
3499
+ addAssetProcedureCompletion: assetProcedureCompletionAdapter.addOne,
3500
+ addAssetProcedureCompletions: assetProcedureCompletionAdapter.addMany,
3501
+ setAssetProcedureCompletion: assetProcedureCompletionAdapter.setOne,
3502
+ setAssetProcedureCompletions: assetProcedureCompletionAdapter.setMany,
3503
+ updateAssetProcedureCompletion: assetProcedureCompletionAdapter.updateOne,
3504
+ updateAssetProcedureCompletions: assetProcedureCompletionAdapter.updateMany,
3505
+ deleteAssetProcedureCompletion: assetProcedureCompletionAdapter.deleteOne,
3506
+ deleteAssetProcedureCompletions: assetProcedureCompletionAdapter.deleteMany
3507
+ }
3508
+ });
3509
+ const {
3510
+ initializeAssetProcedureCompletions,
3511
+ addAssetProcedureCompletion,
3512
+ addAssetProcedureCompletions,
3513
+ updateAssetProcedureCompletion,
3514
+ updateAssetProcedureCompletions,
3515
+ deleteAssetProcedureCompletion,
3516
+ deleteAssetProcedureCompletions,
3517
+ setAssetProcedureCompletion,
3518
+ setAssetProcedureCompletions
3519
+ } = assetProcedureCompletionSlice.actions;
3520
+ const assetProcedureCompletionReducer = assetProcedureCompletionSlice.reducer;
3521
+ const selectAssetProcedureCompletionsMapping = (state) => state.assetProcedureCompletionReducer.instances;
3522
+ const selectAssetProcedureCompletions = createSelector(
3523
+ [selectAssetProcedureCompletionsMapping],
3524
+ (assetProcedureCompletionsMapping) => {
3525
+ return Object.values(assetProcedureCompletionsMapping);
3526
+ }
3527
+ );
3528
+ const selectAssetProcedureCompletionsOfAsset = restructureCreateSelectorWithArgs(
3529
+ createSelector(
3530
+ [selectAssetProcedureCompletions, (_state, id) => id],
3531
+ (assetProcedureCompletions, id) => {
3532
+ return fallbackToEmptyArray(
3533
+ assetProcedureCompletions.filter(
3534
+ (assetProcedureCompletion) => assetProcedureCompletion.asset === id
3535
+ )
3536
+ );
3537
+ }
3538
+ )
3539
+ );
3540
+ const selectAssetProcedureCompletionsOfAssetProcedureInstance = restructureCreateSelectorWithArgs(
3541
+ createSelector([selectAssetProcedureCompletions, (_state, id) => id], (assetProcedureCompletions, id) => {
3542
+ return fallbackToEmptyArray(
3543
+ assetProcedureCompletions.filter(
3544
+ (assetProcedureCompletion) => assetProcedureCompletion.asset_procedure_instance === id
3545
+ )
3546
+ );
3547
+ })
3548
+ );
3549
+ const selectAssetProcedureCompletionById = (assetProcedureCompletionId) => (state) => {
3550
+ return state.assetProcedureCompletionReducer.instances[assetProcedureCompletionId];
3551
+ };
3552
+ const selectAssetProcedureCompletionsByIds = restructureCreateSelectorWithArgs(
3553
+ createSelector(
3554
+ [selectAssetProcedureCompletionsMapping, (_, ids) => ids],
3555
+ (assetProcedureCompletionsMapping, ids) => {
3556
+ const assetProcedureCompletions = [];
3557
+ for (const assetProcedureCompletionId of ids) {
3558
+ const assetProcedureCompletion = assetProcedureCompletionsMapping[assetProcedureCompletionId];
3559
+ if (assetProcedureCompletion)
3560
+ assetProcedureCompletions.push(assetProcedureCompletion);
3561
+ }
3562
+ return fallbackToEmptyArray(assetProcedureCompletions);
3563
+ }
3564
+ )
3565
+ );
3331
3566
  const VERSION_REDUCER_KEY = "versioning";
3332
3567
  const overmapReducers = {
3333
3568
  // TODO: attachmentReducer,
@@ -4119,43 +4354,70 @@ function chunkArray(arr, chunkSize) {
4119
4354
  return chunks;
4120
4355
  }
4121
4356
  class AssetService extends BaseApiService {
4122
- // Basic CRUD functions
4123
- add(asset, workspaceId) {
4124
- if (!asset.canvas_marker && !asset.geo_marker) {
4357
+ add(payload) {
4358
+ const { store } = this.client;
4359
+ if (!payload.canvas_marker && !payload.geo_marker) {
4125
4360
  throw new Error("Asset must have either a canvas_marker or geo_marker");
4126
4361
  }
4127
- const offlineAsset = offline(asset);
4362
+ const createdBy = store.getState().userReducer.currentUser.id;
4363
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4364
+ const offlineAsset = offline({
4365
+ ...payload,
4366
+ created_by: createdBy,
4367
+ submitted_at: submittedAt
4368
+ });
4128
4369
  this.dispatch(addAsset(offlineAsset));
4129
4370
  const promise = this.enqueueRequest({
4130
4371
  description: "Create asset",
4131
4372
  method: HttpMethod.POST,
4132
- url: `/assets/types/${offlineAsset.asset_type}/add-assets/`,
4133
- queryParams: {
4134
- workspace_id: workspaceId.toString()
4373
+ url: "/assets/",
4374
+ payload: {
4375
+ offline_id: offlineAsset.offline_id,
4376
+ submitted_at: offlineAsset.submitted_at,
4377
+ geo_marker: offlineAsset.geo_marker,
4378
+ canvas_marker: offlineAsset.canvas_marker,
4379
+ label: offlineAsset.label,
4380
+ description: offlineAsset.description,
4381
+ asset_type: offlineAsset.asset_type
4135
4382
  },
4136
- payload: { assets: [offlineAsset] },
4137
- blockers: [],
4383
+ blockers: [offlineAsset.asset_type],
4138
4384
  blocks: [offlineAsset.offline_id]
4139
4385
  });
4386
+ promise.then((createdAsset) => {
4387
+ this.dispatch(updateAsset(createdAsset));
4388
+ }).catch(() => {
4389
+ this.dispatch(deleteAsset(offlineAsset.offline_id));
4390
+ });
4140
4391
  return [offlineAsset, promise];
4141
4392
  }
4142
- update(asset, workspaceId) {
4143
- if (!asset.canvas_marker && !asset.geo_marker) {
4393
+ update(payload) {
4394
+ const { store } = this.client;
4395
+ if (!payload.canvas_marker && !payload.geo_marker) {
4144
4396
  throw new Error("Asset must have either a canvas_marker or geo_marker");
4145
4397
  }
4146
- this.client.store.dispatch(updateAsset(asset));
4398
+ const asset = selectAssetById(payload.offline_id)(store.getState());
4399
+ if (!asset) {
4400
+ throw new Error(`No asset with id ${payload.offline_id} found in the store`);
4401
+ }
4402
+ const updatedAsset = {
4403
+ ...asset,
4404
+ ...payload
4405
+ };
4406
+ this.dispatch(updateAsset(updatedAsset));
4147
4407
  const promise = this.enqueueRequest({
4148
4408
  description: "Edit asset",
4149
4409
  method: HttpMethod.PATCH,
4150
- url: `/assets/${asset.offline_id}/`,
4151
- queryParams: {
4152
- workspace_id: workspaceId.toString()
4153
- },
4154
- payload: asset,
4155
- blockers: [asset.offline_id],
4156
- blocks: [asset.offline_id]
4410
+ url: `/assets/${payload.offline_id}/`,
4411
+ payload,
4412
+ blockers: [payload.offline_id],
4413
+ blocks: [payload.offline_id]
4414
+ });
4415
+ promise.then((result) => {
4416
+ this.dispatch(updateAsset(result));
4417
+ }).catch(() => {
4418
+ this.dispatch(updateAsset(asset));
4157
4419
  });
4158
- return [asset, promise];
4420
+ return [updatedAsset, promise];
4159
4421
  }
4160
4422
  async remove(assetId) {
4161
4423
  const { store } = this.client;
@@ -4193,39 +4455,17 @@ class AssetService extends BaseApiService {
4193
4455
  throw err;
4194
4456
  });
4195
4457
  }
4196
- async deleteAllAssetsOfAssetType(assetTypeId) {
4197
- const { store } = this.client;
4198
- const state = store.getState();
4199
- const allAssetsOfAssetType = selectAssetsOfAssetType(assetTypeId)(state);
4200
- const allAssetsOfAssetTypeIds = allAssetsOfAssetType.map((c) => c.offline_id);
4201
- const affectedOfflineIds = [assetTypeId, ...allAssetsOfAssetTypeIds];
4202
- store.dispatch(deleteAssets(allAssetsOfAssetTypeIds));
4203
- return this.enqueueRequest({
4204
- description: "Delete all assets of asset type",
4205
- method: HttpMethod.DELETE,
4206
- url: `/assets/types/${assetTypeId}/delete-all-of-type/`,
4207
- blockers: affectedOfflineIds,
4208
- blocks: affectedOfflineIds
4209
- }).catch((err) => {
4210
- store.dispatch(addAssets(allAssetsOfAssetType));
4211
- throw err;
4212
- });
4213
- }
4214
- // TODO: payload does not require asset_type
4215
- bulkAdd(assetsToCreate, workspaceId, assetTypeId, batchSize) {
4458
+ bulkAdd(payloads, assetTypeId, batchSize) {
4216
4459
  const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4217
4460
  const transactionId = v4();
4218
- const assetBatches = chunkArray(assetsToCreate, batchSize).map((assetBatch) => {
4219
- const assetPayloads = assetBatch.map((assetPayload) => {
4220
- return offline({
4221
- ...assetPayload,
4222
- submitted_at: submittedAt
4223
- });
4224
- });
4461
+ const assetBatches = chunkArray(payloads, batchSize).map((assetBatch) => {
4462
+ const assetPayloads = assetBatch.map((assetPayload) => offline(assetPayload));
4225
4463
  return {
4226
4464
  batchId: v4(),
4227
4465
  payload: {
4228
4466
  transaction_id: transactionId,
4467
+ submitted_at: submittedAt,
4468
+ asset_type: assetTypeId,
4229
4469
  assets: assetPayloads
4230
4470
  }
4231
4471
  };
@@ -4243,10 +4483,7 @@ class AssetService extends BaseApiService {
4243
4483
  const promise = this.enqueueRequest({
4244
4484
  description: "Batch create assets",
4245
4485
  method: HttpMethod.POST,
4246
- url: `/assets/types/${assetTypeId}/add-assets/`,
4247
- queryParams: {
4248
- workspace_id: workspaceId.toString()
4249
- },
4486
+ url: "/assets/bulk/",
4250
4487
  payload,
4251
4488
  blockers,
4252
4489
  blocks
@@ -4264,7 +4501,10 @@ class AssetService extends BaseApiService {
4264
4501
  const result = await this.enqueueRequest({
4265
4502
  description: "Get assets",
4266
4503
  method: HttpMethod.GET,
4267
- url: `/projects/${projectId}/assets/`,
4504
+ url: "/assets/",
4505
+ queryParams: {
4506
+ project_id: projectId.toString()
4507
+ },
4268
4508
  blockers: [],
4269
4509
  blocks: []
4270
4510
  });
@@ -4272,154 +4512,217 @@ class AssetService extends BaseApiService {
4272
4512
  }
4273
4513
  }
4274
4514
  class AssetStageCompletionService extends BaseApiService {
4275
- add(assetId, stageId) {
4276
- var _a2;
4515
+ add(payload) {
4277
4516
  const { store } = this.client;
4278
- const assetTypeId = (_a2 = selectAssetById(assetId)(store.getState())) == null ? void 0 : _a2.asset_type;
4279
- if (!assetTypeId) {
4280
- throw new Error(`Asset with offline_id ${assetId} not found`);
4281
- }
4517
+ const createdBy = store.getState().userReducer.currentUser.id;
4518
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4282
4519
  const offlineStageCompletion = offline({
4283
- asset: assetId,
4284
- stage: stageId
4520
+ ...payload,
4521
+ created_by: createdBy,
4522
+ submitted_at: submittedAt
4285
4523
  });
4286
- this.dispatch(addStageCompletion(offlineStageCompletion));
4524
+ this.dispatch(addAssetStageCompletion(offlineStageCompletion));
4287
4525
  const promise = this.enqueueRequest({
4288
- description: "Complete stage",
4526
+ description: "Add asset stage completion",
4289
4527
  method: HttpMethod.POST,
4290
- url: `/assets/types/${assetTypeId}/complete-stages/`,
4291
- // TODO: Add submitted_at to model
4292
- payload: { completions: [{ ...offlineStageCompletion, submitted_at: (/* @__PURE__ */ new Date()).getTime() / 1e3 }] },
4293
- blockers: [assetId, stageId],
4528
+ url: "/asset-stage-completions/",
4529
+ payload: {
4530
+ offline_id: offlineStageCompletion.offline_id,
4531
+ submitted_at: submittedAt,
4532
+ asset_procedure_completion: payload.asset_procedure_completion,
4533
+ stage: payload.stage
4534
+ },
4535
+ blockers: [payload.asset_procedure_completion, payload.stage],
4294
4536
  blocks: [offlineStageCompletion.offline_id]
4295
4537
  });
4538
+ promise.then((result) => {
4539
+ this.dispatch(updateAssetStageCompletion(result));
4540
+ }).catch(() => {
4541
+ this.dispatch(deleteAssetStageCompletion(offlineStageCompletion.offline_id));
4542
+ });
4296
4543
  return [offlineStageCompletion, promise];
4297
4544
  }
4298
- async refreshStore(projectId) {
4299
- const result = await this.enqueueRequest({
4300
- description: "Get stage completions",
4301
- method: HttpMethod.GET,
4302
- url: `/projects/${projectId}/asset-stage-completions/`,
4303
- blockers: [],
4545
+ delete(id) {
4546
+ const { store } = this.client;
4547
+ const assetStageCompletion = selectAssetStageCompletionById(id)(store.getState());
4548
+ if (!assetStageCompletion) {
4549
+ throw new Error(`Expected asset stage completion with id ${id} to exist`);
4550
+ }
4551
+ this.dispatch(deleteAssetStageCompletion(id));
4552
+ const promise = this.enqueueRequest({
4553
+ description: "Delete asset stage completion",
4554
+ method: HttpMethod.DELETE,
4555
+ url: `/asset-stage-completions/${id}/`,
4556
+ blockers: [id],
4304
4557
  blocks: []
4305
4558
  });
4306
- this.dispatch(addStageCompletions(result));
4559
+ promise.catch(() => {
4560
+ this.dispatch(addAssetStageCompletion(assetStageCompletion));
4561
+ });
4562
+ return promise;
4307
4563
  }
4308
- /**
4309
- * Creates a collection of AssetStageCompletions, marking the referenced stages as completed for the referenced
4310
- * assets. It's REQUIRED that all assets referenced all have the SAME asset type.
4311
- * @param assetTypeId The ID of the asset type for which we are completing stages (we can only complete
4312
- * stages for one asset type at a time)
4313
- * @param stageCompletions
4314
- */
4315
- async bulkAdd(assetTypeId, stageCompletions) {
4316
- const offlineStageCompletions = stageCompletions.map((completion) => {
4317
- return offline(completion);
4318
- });
4319
- const asMapping = {};
4320
- for (const completion of stageCompletions) {
4321
- const stageToCompletionDateMapping = asMapping[completion.asset] || {};
4322
- stageToCompletionDateMapping[completion.stage] = (/* @__PURE__ */ new Date()).toISOString();
4323
- asMapping[completion.asset] = stageToCompletionDateMapping;
4324
- }
4325
- this.dispatch(addStageCompletions(asMapping));
4326
- await this.enqueueRequest({
4327
- description: "Bulk complete stages",
4564
+ bulkAdd(payloads) {
4565
+ const { store } = this.client;
4566
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4567
+ const createdBy = store.getState().userReducer.currentUser.id;
4568
+ const payload = payloads.map((payload2) => offline(payload2));
4569
+ const offlineStageCompletions = payload.map((completion) => {
4570
+ return {
4571
+ ...completion,
4572
+ created_by: createdBy,
4573
+ submitted_at: submittedAt
4574
+ };
4575
+ });
4576
+ const offlineIds = offlineStageCompletions.map(({ offline_id }) => offline_id);
4577
+ this.dispatch(addAssetStageCompletions(offlineStageCompletions));
4578
+ const promise = this.enqueueRequest({
4579
+ description: "Bulk create asset stage completions",
4328
4580
  method: HttpMethod.POST,
4329
- url: `/assets/types/${assetTypeId}/complete-stages/`,
4581
+ url: "/asset-stage-completions/bulk/",
4582
+ payload: {
4583
+ submitted_at: submittedAt,
4584
+ completions: payload
4585
+ },
4586
+ blockers: [...payloads.map((c) => c.asset_procedure_completion), ...payloads.map((c) => c.stage)],
4587
+ blocks: offlineIds
4588
+ });
4589
+ promise.then((result) => {
4590
+ this.dispatch(updateAssetStageCompletions(result));
4591
+ }).catch(() => {
4592
+ this.dispatch(deleteAssetStageCompletions(offlineIds));
4593
+ });
4594
+ return [offlineStageCompletions, promise];
4595
+ }
4596
+ bulkDelete(ids) {
4597
+ const { store } = this.client;
4598
+ const assetStageCompletions = selectAssetStageCompletionsByIds(ids)(store.getState());
4599
+ this.dispatch(deleteAssetStageCompletions(ids));
4600
+ const promise = this.enqueueRequest({
4601
+ description: "Deleting asset stage completions",
4602
+ method: HttpMethod.DELETE,
4603
+ url: "/asset-stage-completions/bulk/",
4330
4604
  payload: {
4331
- completions: offlineStageCompletions
4605
+ completion_ids: ids
4332
4606
  },
4333
- blockers: [assetTypeId, ...stageCompletions.map((c) => c.asset), ...stageCompletions.map((c) => c.stage)],
4334
- blocks: offlineStageCompletions.map((c) => c.offline_id)
4607
+ blockers: ids,
4608
+ blocks: []
4335
4609
  });
4336
- }
4337
- bulkDelete(stageId, assetIds) {
4338
- const stageCompletionsToRemove = assetIds.map((assetId) => {
4339
- return {
4340
- asset: assetId,
4341
- stage: stageId
4342
- };
4610
+ promise.catch(() => {
4611
+ this.dispatch(addAssetStageCompletions(assetStageCompletions));
4343
4612
  });
4344
- this.dispatch(removeStageCompletions(stageCompletionsToRemove));
4345
- return this.enqueueRequest({
4346
- description: `Undo stage for ${assetIds.length} assets(s)`,
4347
- // TODO: Rename to setCompletedStages
4348
- method: HttpMethod.DELETE,
4349
- url: `/assets/stages/${stageId}/undo-stages/`,
4350
- payload: {
4351
- assets: assetIds
4613
+ return promise;
4614
+ }
4615
+ async refreshStore(projectId) {
4616
+ const result = await this.enqueueRequest({
4617
+ description: "Get asset stage completions",
4618
+ method: HttpMethod.GET,
4619
+ url: "/asset-stage-completions/",
4620
+ queryParams: {
4621
+ project_id: projectId.toString()
4352
4622
  },
4353
- blockers: [stageId, ...assetIds],
4623
+ blockers: [],
4354
4624
  blocks: []
4355
4625
  });
4626
+ this.dispatch(initializeAssetStageCompletions(result));
4356
4627
  }
4357
4628
  }
4358
4629
  class AssetStageService extends BaseApiService {
4359
- async bulkCreateStages(stagesToSubmit, assetTypeId, workspaceId) {
4630
+ bulkAdd(stagesToSubmit, assetProcedureId) {
4631
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4632
+ const createdBy = this.client.store.getState().userReducer.currentUser.id;
4360
4633
  const payload = stagesToSubmit.map((stage) => {
4361
4634
  return offline(stage);
4362
4635
  });
4363
- const fullStages = payload.map((stage) => {
4364
- return { ...stage, asset_type: assetTypeId };
4636
+ const offlineStages = payload.map((stage) => {
4637
+ return { ...stage, asset_procedure: assetProcedureId, created_by: createdBy, submitted_at: submittedAt };
4365
4638
  });
4366
- this.dispatch(addStages(fullStages));
4367
- return this.enqueueRequest({
4639
+ this.dispatch(addAssetStages(offlineStages));
4640
+ const promise = this.enqueueRequest({
4368
4641
  description: "Add asset stages",
4369
4642
  method: HttpMethod.POST,
4370
- url: `/assets/types/${assetTypeId}/add-stages/`,
4643
+ url: "/asset-stages/bulk/",
4371
4644
  payload: {
4645
+ submitted_at: submittedAt,
4646
+ asset_procedure: assetProcedureId,
4372
4647
  stages: payload
4373
4648
  },
4374
- queryParams: {
4375
- workspace_id: workspaceId.toString()
4376
- },
4377
- blockers: [assetTypeId, workspaceId],
4649
+ blockers: [assetProcedureId],
4378
4650
  blocks: payload.map(({ offline_id }) => offline_id)
4379
4651
  });
4652
+ promise.then((result) => {
4653
+ this.dispatch(updateAssetStages(result));
4654
+ }).catch(() => {
4655
+ this.dispatch(deleteAssetStages(offlineStages.map(({ offline_id }) => offline_id)));
4656
+ });
4657
+ return [offlineStages, promise];
4380
4658
  }
4381
- async bulkUpdateStages(stagesToUpdate, assetTypeId) {
4659
+ async bulkUpdate(stagesToUpdate, assetProcedureId) {
4382
4660
  const store = this.client.store;
4383
4661
  const state = store.getState();
4384
4662
  const prevStages = selectAssetStagesByIds(stagesToUpdate.map(({ offline_id }) => offline_id))(state);
4385
- this.dispatch(updateStages(stagesToUpdate));
4663
+ this.dispatch(updateAssetStages(stagesToUpdate));
4386
4664
  return this.enqueueRequest({
4387
4665
  description: "Edit asset stages",
4388
4666
  method: HttpMethod.PATCH,
4389
- url: `/assets/types/${assetTypeId}/bulk-update-stages/`,
4667
+ url: `/asset-procedures/${assetProcedureId}/bulk-update-stages/`,
4390
4668
  payload: {
4391
4669
  stages: stagesToUpdate
4392
4670
  },
4393
- blockers: [assetTypeId],
4671
+ blockers: [assetProcedureId],
4394
4672
  blocks: stagesToUpdate.map(({ offline_id }) => offline_id)
4395
4673
  }).catch((e) => {
4396
- store.dispatch(updateStages(prevStages));
4674
+ this.dispatch(updateAssetStages(prevStages));
4397
4675
  throw e;
4398
4676
  });
4399
4677
  }
4400
4678
  async bulkDelete(idsToDelete) {
4401
- this.dispatch(removeStages(idsToDelete));
4402
- return this.enqueueRequest({
4679
+ const { store } = this.client;
4680
+ const assetStages = selectAssetStagesByIds(idsToDelete)(store.getState());
4681
+ this.dispatch(deleteAssetStages(idsToDelete));
4682
+ const promise = this.enqueueRequest({
4403
4683
  description: "Delete asset stages",
4404
4684
  method: HttpMethod.DELETE,
4405
- url: "/assets/stages/bulk-delete/",
4685
+ url: "/asset-stages/bulk/",
4406
4686
  payload: {
4407
4687
  stage_ids: idsToDelete
4408
4688
  },
4409
4689
  blockers: idsToDelete,
4410
4690
  blocks: []
4411
4691
  });
4692
+ promise.catch(() => {
4693
+ this.dispatch(addAssetStages(assetStages));
4694
+ });
4695
+ return promise;
4412
4696
  }
4413
- async update(assetStage) {
4414
- this.dispatch(addStages([assetStage]));
4415
- return this.enqueueRequest({
4697
+ update(payload) {
4698
+ const { store } = this.client;
4699
+ const assetStage = selectAssetStageById(payload.offline_id)(store.getState());
4700
+ if (!assetStage)
4701
+ throw new Error(`No asset stage with id ${payload.offline_id} found in the store`);
4702
+ const updatedAssetStage = {
4703
+ ...assetStage,
4704
+ ...payload
4705
+ };
4706
+ this.dispatch(updateAssetStage(updatedAssetStage));
4707
+ const promise = this.enqueueRequest({
4416
4708
  description: "Update asset stage",
4417
4709
  method: HttpMethod.PATCH,
4418
- url: `/assets/stages/${assetStage.offline_id}/`,
4419
- payload: assetStage,
4710
+ url: `/asset-stages/${assetStage.offline_id}/`,
4711
+ payload: {
4712
+ name: payload.name,
4713
+ description: payload.description,
4714
+ priority: payload.priority,
4715
+ color: payload.color
4716
+ },
4420
4717
  blockers: [assetStage.offline_id],
4421
4718
  blocks: [assetStage.offline_id]
4422
4719
  });
4720
+ promise.then((result) => {
4721
+ this.dispatch(updateAssetStage(result));
4722
+ }).catch(() => {
4723
+ this.dispatch(setAssetStage(assetStage));
4724
+ });
4725
+ return [updatedAssetStage, promise];
4423
4726
  }
4424
4727
  async linkForm(stageId, formId) {
4425
4728
  const { store } = this.client;
@@ -4427,18 +4730,18 @@ class AssetStageService extends BaseApiService {
4427
4730
  if (!stage) {
4428
4731
  throw new Error(`No asset stage with id ${stageId} found in the store`);
4429
4732
  }
4430
- this.dispatch(updateStage({ ...stage, form: formId }));
4733
+ this.dispatch(updateAssetStage({ ...stage, form: formId }));
4431
4734
  try {
4432
4735
  await this.enqueueRequest({
4433
4736
  description: "Link asset stage to form",
4434
4737
  method: HttpMethod.POST,
4435
- url: `/assets/stages/${stageId}/associate-with-form/`,
4738
+ url: `/asset-stages/${stageId}/associate-with-form/`,
4436
4739
  payload: { form: formId },
4437
4740
  blockers: [stageId, formId],
4438
4741
  blocks: [stageId]
4439
4742
  });
4440
4743
  } catch (e) {
4441
- this.dispatch(setStage(stage));
4744
+ this.dispatch(setAssetStage(stage));
4442
4745
  throw e;
4443
4746
  }
4444
4747
  }
@@ -4448,29 +4751,32 @@ class AssetStageService extends BaseApiService {
4448
4751
  if (!stage) {
4449
4752
  throw new Error(`No asset stage with id ${stageId} found in the store`);
4450
4753
  }
4451
- this.dispatch(updateStage({ ...stage, form: void 0 }));
4754
+ this.dispatch(updateAssetStage({ ...stage, form: void 0 }));
4452
4755
  try {
4453
4756
  await this.enqueueRequest({
4454
4757
  description: "Unlink asset stage from form",
4455
4758
  method: HttpMethod.DELETE,
4456
- url: `/assets/stages/${stageId}/associate-with-form/`,
4759
+ url: `/asset-stages/${stageId}/associate-with-form/`,
4457
4760
  blockers: [stageId, formId],
4458
4761
  blocks: [stageId]
4459
4762
  });
4460
4763
  } catch (e) {
4461
- this.dispatch(setStage(stage));
4764
+ this.dispatch(setAssetStage(stage));
4462
4765
  throw e;
4463
4766
  }
4464
4767
  }
4465
- async refreshStore(projectId) {
4768
+ async refreshStore(organizationId) {
4466
4769
  const result = await this.enqueueRequest({
4467
4770
  description: "Get asset stages",
4468
4771
  method: HttpMethod.GET,
4469
- url: `/projects/${projectId}/asset-stages/`,
4772
+ url: "/asset-stages/",
4773
+ queryParams: {
4774
+ organization_id: organizationId.toString()
4775
+ },
4470
4776
  blockers: [],
4471
4777
  blocks: []
4472
4778
  });
4473
- this.dispatch(initializeStages(result));
4779
+ this.dispatch(initializeAssetStages(result));
4474
4780
  }
4475
4781
  }
4476
4782
  class BaseUploadService extends BaseApiService {
@@ -4677,29 +4983,64 @@ class AssetAttachmentService extends BaseAttachmentService {
4677
4983
  }
4678
4984
  }
4679
4985
  class AssetTypeService extends BaseApiService {
4680
- add(assetType) {
4681
- const offlineAssetType = offline(assetType);
4986
+ add(payload) {
4987
+ const { store } = this.client;
4988
+ const createdBy = store.getState().userReducer.currentUser.id;
4989
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4990
+ const offlineAssetType = offline({
4991
+ ...payload,
4992
+ created_by: createdBy,
4993
+ submitted_at: submittedAt
4994
+ });
4682
4995
  this.dispatch(addAssetType(offlineAssetType));
4683
4996
  const promise = this.enqueueRequest({
4684
4997
  description: "Create asset type",
4685
4998
  method: HttpMethod.POST,
4686
- url: `/projects/${assetType.project}/asset-types/`,
4999
+ url: "/asset-types/",
5000
+ queryParams: {
5001
+ project_id: payload.project.toString()
5002
+ },
4687
5003
  payload: { ...offlineAssetType },
4688
5004
  blockers: [],
4689
5005
  blocks: [offlineAssetType.offline_id]
4690
5006
  });
5007
+ promise.then((result) => {
5008
+ this.dispatch(updateAssetType(result));
5009
+ }).catch(() => {
5010
+ this.dispatch(deleteAssetType(offlineAssetType.offline_id));
5011
+ });
4691
5012
  return [offlineAssetType, promise];
4692
5013
  }
4693
- update(assetType) {
4694
- this.dispatch(addAssetType(assetType));
4695
- return this.enqueueRequest({
5014
+ update(payload) {
5015
+ const { store } = this.client;
5016
+ const assetType = selectAssetTypeById(payload.offline_id)(store.getState());
5017
+ if (!assetType) {
5018
+ throw new Error(`Expected asset type with offline_id ${payload.offline_id} to exist`);
5019
+ }
5020
+ const updatedAssetType = {
5021
+ ...assetType,
5022
+ ...payload
5023
+ };
5024
+ this.dispatch(updateAssetType(updatedAssetType));
5025
+ const promise = this.enqueueRequest({
4696
5026
  description: "Update asset type",
4697
5027
  method: HttpMethod.PATCH,
4698
- url: `/assets/types/${assetType.offline_id}/`,
4699
- payload: assetType,
5028
+ url: `/asset-types/${payload.offline_id}/`,
5029
+ payload: {
5030
+ icon: payload.icon,
5031
+ color: payload.color,
5032
+ name: payload.name,
5033
+ description: payload.description
5034
+ },
4700
5035
  blockers: [assetType.offline_id],
4701
5036
  blocks: [assetType.offline_id]
4702
5037
  });
5038
+ promise.then((result) => {
5039
+ this.dispatch(updateAssetType(result));
5040
+ }).catch(() => {
5041
+ this.dispatch(updateAssetType(assetType));
5042
+ });
5043
+ return [updatedAssetType, promise];
4703
5044
  }
4704
5045
  async delete(assetTypeId) {
4705
5046
  const { store } = this.client;
@@ -4708,26 +5049,23 @@ class AssetTypeService extends BaseApiService {
4708
5049
  if (!assetType) {
4709
5050
  throw new Error(`Expected asset type with offline_id ${assetTypeId} to exist`);
4710
5051
  }
4711
- const stagesOfAssetType = selectStagesOfAssetType(assetTypeId)(state);
5052
+ const assetsOfAssetType = selectAssetsOfAssetType(assetTypeId)(state);
5053
+ const stagesOfAssetType = selectAssetStagesOfAssetProcedure(assetTypeId)(state);
4712
5054
  const attachmentsOfAssetType = selectAttachmentsOfAssetType(assetTypeId)(state);
4713
5055
  this.dispatch(deleteAssetType(assetTypeId));
4714
- if (stagesOfAssetType.length > 0) {
4715
- const stagesOfAssetTypeIds = stagesOfAssetType.map((assetStage) => assetStage.offline_id);
4716
- this.dispatch(removeStages(stagesOfAssetTypeIds));
4717
- }
4718
- if (attachmentsOfAssetType.length > 0) {
4719
- const attachmentsOfAssetTypeIds = attachmentsOfAssetType.map(({ offline_id }) => offline_id);
4720
- this.dispatch(deleteAssetTypeAttachments(attachmentsOfAssetTypeIds));
4721
- }
5056
+ this.dispatch(deleteAssets(assetsOfAssetType.map((asset) => asset.offline_id)));
5057
+ this.dispatch(deleteAssetStages(stagesOfAssetType.map((assetStage) => assetStage.offline_id)));
5058
+ this.dispatch(deleteAssetTypeAttachments(attachmentsOfAssetType.map(({ offline_id }) => offline_id)));
4722
5059
  return this.enqueueRequest({
4723
5060
  description: "Delete asset type",
4724
5061
  method: HttpMethod.DELETE,
4725
- url: `/assets/types/${assetTypeId}/`,
5062
+ url: `/asset-types/${assetTypeId}/`,
4726
5063
  blockers: [assetTypeId],
4727
5064
  blocks: []
4728
5065
  }).catch((e) => {
4729
5066
  this.dispatch(addAssetType(assetType));
4730
- this.dispatch(addStages(stagesOfAssetType));
5067
+ this.dispatch(addAssets(assetsOfAssetType));
5068
+ this.dispatch(addAssetStages(stagesOfAssetType));
4731
5069
  this.dispatch(addAssetTypeAttachments(attachmentsOfAssetType));
4732
5070
  throw e;
4733
5071
  });
@@ -4736,7 +5074,10 @@ class AssetTypeService extends BaseApiService {
4736
5074
  const result = await this.enqueueRequest({
4737
5075
  description: "Get asset types",
4738
5076
  method: HttpMethod.GET,
4739
- url: `/projects/${projectId}/asset-types/`,
5077
+ url: "/asset-types/",
5078
+ queryParams: {
5079
+ project_id: projectId.toString()
5080
+ },
4740
5081
  blockers: [],
4741
5082
  blocks: []
4742
5083
  });
@@ -4941,15 +5282,6 @@ class IssueService extends BaseApiService {
4941
5282
  void promise.then((result) => {
4942
5283
  this.dispatch(updateIssue(result));
4943
5284
  }).catch((error) => {
4944
- var _a2;
4945
- console.error(error);
4946
- if (error instanceof APIError) {
4947
- (_a2 = unsafeShowToast) == null ? void 0 : _a2({
4948
- title: "Could not create issue",
4949
- description: error.message,
4950
- accentColor: "red"
4951
- });
4952
- }
4953
5285
  this.dispatch(deleteIssue(issuePayload.offline_id));
4954
5286
  this.dispatch(addActiveProjectIssuesCount(-1));
4955
5287
  throw error;
@@ -7505,12 +7837,322 @@ class IssueAssociationService extends BaseUploadService {
7505
7837
  this.dispatch(initializeIssueAssociations(issueAssociations));
7506
7838
  }
7507
7839
  }
7840
+ class AssetProcedureCompletionService extends BaseApiService {
7841
+ add(payload) {
7842
+ const { store } = this.client;
7843
+ const createdBy = store.getState().userReducer.currentUser.id;
7844
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7845
+ const offlineProcedureCompletion = offline({
7846
+ ...payload,
7847
+ created_by: createdBy,
7848
+ submitted_at: submittedAt
7849
+ });
7850
+ this.dispatch(addAssetProcedureCompletion(offlineProcedureCompletion));
7851
+ const promise = this.enqueueRequest({
7852
+ description: "Add asset procedure completion",
7853
+ method: HttpMethod.POST,
7854
+ url: "/asset-procedure-completions/",
7855
+ payload: {
7856
+ offline_id: offlineProcedureCompletion.offline_id,
7857
+ submitted_at: submittedAt,
7858
+ asset: payload.asset,
7859
+ asset_procedure_instance: payload.asset_procedure_instance
7860
+ },
7861
+ blockers: [payload.asset, payload.asset_procedure_instance],
7862
+ blocks: [offlineProcedureCompletion.offline_id]
7863
+ });
7864
+ promise.then((result) => {
7865
+ this.dispatch(updateAssetProcedureCompletion(result));
7866
+ }).catch(() => {
7867
+ this.dispatch(deleteAssetProcedureCompletion(offlineProcedureCompletion.offline_id));
7868
+ });
7869
+ return [offlineProcedureCompletion, promise];
7870
+ }
7871
+ bulkAdd(payloads) {
7872
+ const { store } = this.client;
7873
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7874
+ const createdBy = store.getState().userReducer.currentUser.id;
7875
+ const completionPayloads = payloads.map((payload) => offline(payload));
7876
+ const offlineProcedureCompletions = completionPayloads.map((completion) => {
7877
+ return {
7878
+ ...completion,
7879
+ created_by: createdBy,
7880
+ submitted_at: submittedAt
7881
+ };
7882
+ });
7883
+ const offlineIds = offlineProcedureCompletions.map(({ offline_id }) => offline_id);
7884
+ this.dispatch(addAssetProcedureCompletions(offlineProcedureCompletions));
7885
+ const promise = this.enqueueRequest({
7886
+ description: "Bulk create asset procedure completions",
7887
+ method: HttpMethod.POST,
7888
+ url: "/asset-procedure-completions/bulk/",
7889
+ payload: {
7890
+ submitted_at: submittedAt,
7891
+ asset_procedure_completions: completionPayloads
7892
+ },
7893
+ blockers: [...payloads.map((c) => c.asset), ...payloads.map((c) => c.asset_procedure_instance)],
7894
+ blocks: offlineIds
7895
+ });
7896
+ promise.then((result) => {
7897
+ this.dispatch(updateAssetProcedureCompletions(result));
7898
+ }).catch(() => {
7899
+ this.dispatch(deleteAssetProcedureCompletions(offlineIds));
7900
+ });
7901
+ return [offlineProcedureCompletions, promise];
7902
+ }
7903
+ async delete(id) {
7904
+ const { store } = this.client;
7905
+ const assetProcedureCompletion = selectAssetProcedureCompletionById(id)(store.getState());
7906
+ if (!assetProcedureCompletion) {
7907
+ throw new Error(`Expected asset procedure completion with id ${id} to exist`);
7908
+ }
7909
+ this.dispatch(deleteAssetProcedureCompletion(id));
7910
+ const promise = this.enqueueRequest({
7911
+ description: "Delete asset procedure completion",
7912
+ method: HttpMethod.DELETE,
7913
+ url: `/asset-procedure-completions/${id}/`,
7914
+ blockers: [id],
7915
+ blocks: []
7916
+ });
7917
+ promise.catch(() => {
7918
+ this.dispatch(addAssetProcedureCompletion(assetProcedureCompletion));
7919
+ });
7920
+ return promise;
7921
+ }
7922
+ async bulkDelete(ids) {
7923
+ const { store } = this.client;
7924
+ const assetProcedureCompletions = selectAssetProcedureCompletionsByIds(ids)(store.getState());
7925
+ this.dispatch(deleteAssetProcedureCompletions(ids));
7926
+ const promise = this.enqueueRequest({
7927
+ description: "Deleting asset procedure completions",
7928
+ method: HttpMethod.DELETE,
7929
+ url: "/asset-procedure-completions/bulk/",
7930
+ payload: {
7931
+ completion_ids: ids
7932
+ },
7933
+ blockers: ids,
7934
+ blocks: []
7935
+ });
7936
+ promise.catch(() => {
7937
+ this.dispatch(addAssetProcedureCompletions(assetProcedureCompletions));
7938
+ });
7939
+ return promise;
7940
+ }
7941
+ async refreshStore(projectId) {
7942
+ const result = await this.enqueueRequest({
7943
+ description: "Get asset procedure completions",
7944
+ method: HttpMethod.GET,
7945
+ url: "/asset-procedure-completions/",
7946
+ queryParams: {
7947
+ project_id: projectId.toString()
7948
+ },
7949
+ blockers: [],
7950
+ blocks: []
7951
+ });
7952
+ this.dispatch(initializeAssetProcedureCompletions(result));
7953
+ }
7954
+ }
7955
+ class AssetProcedureInstanceService extends BaseApiService {
7956
+ add(payload) {
7957
+ const { store } = this.client;
7958
+ const createdBy = store.getState().userReducer.currentUser.id;
7959
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7960
+ const offlineAssetProcedureInstance = offline({
7961
+ ...payload,
7962
+ created_by: createdBy,
7963
+ submitted_at: submittedAt
7964
+ });
7965
+ this.dispatch(addAssetProcedureInstance(offlineAssetProcedureInstance));
7966
+ const promise = this.enqueueRequest({
7967
+ description: "Create asset procedure instance",
7968
+ method: HttpMethod.POST,
7969
+ url: "/asset-procedure-instances/",
7970
+ payload: { ...offlineAssetProcedureInstance },
7971
+ blockers: [payload.asset_procedure, payload.asset_type],
7972
+ blocks: [offlineAssetProcedureInstance.offline_id]
7973
+ });
7974
+ promise.then((result) => {
7975
+ this.dispatch(updateAssetProcedureInstance(result));
7976
+ }).catch(() => {
7977
+ this.dispatch(deleteAssetProcedureInstance(offlineAssetProcedureInstance.offline_id));
7978
+ });
7979
+ return [offlineAssetProcedureInstance, promise];
7980
+ }
7981
+ update(payload) {
7982
+ const { store } = this.client;
7983
+ const assetProcedureInstance = selectAssetProcedureInstanceById(payload.offline_id)(store.getState());
7984
+ if (!assetProcedureInstance) {
7985
+ throw new Error(`Expected asset procedure instance with offline_id ${payload.offline_id} to exist`);
7986
+ }
7987
+ const updatedAssetProcedureInstance = {
7988
+ ...assetProcedureInstance,
7989
+ ...payload
7990
+ };
7991
+ this.dispatch(updateAssetProcedureInstance(updatedAssetProcedureInstance));
7992
+ const promise = this.enqueueRequest({
7993
+ description: "Update asset procedure instance",
7994
+ method: HttpMethod.PATCH,
7995
+ url: `/asset-procedure-instances/${payload.offline_id}/`,
7996
+ payload: {
7997
+ asset_procedure: payload.asset_procedure,
7998
+ asset_type: payload.asset_type
7999
+ },
8000
+ blockers: [assetProcedureInstance.offline_id],
8001
+ blocks: [assetProcedureInstance.offline_id]
8002
+ });
8003
+ promise.then((result) => {
8004
+ this.dispatch(updateAssetProcedureInstance(result));
8005
+ }).catch(() => {
8006
+ this.dispatch(updateAssetProcedureInstance(assetProcedureInstance));
8007
+ });
8008
+ return [updatedAssetProcedureInstance, promise];
8009
+ }
8010
+ async remove(assetProcedureInstanceId) {
8011
+ const { store } = this.client;
8012
+ const state = store.getState();
8013
+ const assetProcedureInstance = selectAssetProcedureInstanceById(assetProcedureInstanceId)(state);
8014
+ if (!assetProcedureInstance) {
8015
+ throw new Error(`Expected asset procedure instance with offline_id ${assetProcedureInstanceId} to exist`);
8016
+ }
8017
+ this.dispatch(deleteAssetProcedureInstance(assetProcedureInstanceId));
8018
+ return this.enqueueRequest({
8019
+ description: "Delete asset procedure instance",
8020
+ method: HttpMethod.DELETE,
8021
+ url: `/asset-procedure-instances/${assetProcedureInstanceId}/`,
8022
+ blockers: [assetProcedureInstanceId],
8023
+ blocks: []
8024
+ }).catch((e) => {
8025
+ this.dispatch(addAssetProcedureInstance(assetProcedureInstance));
8026
+ throw e;
8027
+ });
8028
+ }
8029
+ async refreshStore(projectId) {
8030
+ const result = await this.enqueueRequest({
8031
+ description: "Get asset procedure instances",
8032
+ method: HttpMethod.GET,
8033
+ url: "/asset-procedure-instances/",
8034
+ queryParams: {
8035
+ project_id: projectId.toString()
8036
+ },
8037
+ blockers: [],
8038
+ blocks: []
8039
+ });
8040
+ this.dispatch(initializeAssetProcedureInstances(result));
8041
+ }
8042
+ }
8043
+ class AssetProcedureService extends BaseApiService {
8044
+ add(payload) {
8045
+ const { store } = this.client;
8046
+ const createdBy = store.getState().userReducer.currentUser.id;
8047
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
8048
+ const offlineAssetProcedure = offline({
8049
+ ...payload,
8050
+ created_by: createdBy,
8051
+ submitted_at: submittedAt
8052
+ });
8053
+ this.dispatch(addAssetProcedure(offlineAssetProcedure));
8054
+ const promise = this.enqueueRequest({
8055
+ description: "Create asset procedure",
8056
+ method: HttpMethod.POST,
8057
+ url: "/asset-procedures/",
8058
+ queryParams: {
8059
+ organization_id: payload.organization.toString()
8060
+ },
8061
+ payload: { ...offlineAssetProcedure },
8062
+ blockers: [],
8063
+ blocks: [offlineAssetProcedure.offline_id]
8064
+ });
8065
+ promise.then((result) => {
8066
+ this.dispatch(updateAssetProcedure(result));
8067
+ }).catch(() => {
8068
+ this.dispatch(deleteAssetProcedure(offlineAssetProcedure.offline_id));
8069
+ });
8070
+ return [offlineAssetProcedure, promise];
8071
+ }
8072
+ update(payload) {
8073
+ const { store } = this.client;
8074
+ const assetProcedure = selectAssetProcedureById(payload.offline_id)(store.getState());
8075
+ if (!assetProcedure) {
8076
+ throw new Error(`Expected asset procedure with offline_id ${payload.offline_id} to exist`);
8077
+ }
8078
+ const updatedAssetProcedure = {
8079
+ ...assetProcedure,
8080
+ ...payload
8081
+ };
8082
+ this.dispatch(updateAssetProcedure(updatedAssetProcedure));
8083
+ const promise = this.enqueueRequest({
8084
+ description: "Update asset procedure",
8085
+ method: HttpMethod.PATCH,
8086
+ url: `/asset-procedures/${payload.offline_id}/`,
8087
+ payload: {
8088
+ icon: payload.icon,
8089
+ color: payload.color,
8090
+ name: payload.name,
8091
+ description: payload.description
8092
+ },
8093
+ blockers: [assetProcedure.offline_id],
8094
+ blocks: [assetProcedure.offline_id]
8095
+ });
8096
+ promise.then((result) => {
8097
+ this.dispatch(updateAssetProcedure(result));
8098
+ }).catch(() => {
8099
+ this.dispatch(updateAssetProcedure(assetProcedure));
8100
+ });
8101
+ return [updatedAssetProcedure, promise];
8102
+ }
8103
+ async remove(assetProcedureId) {
8104
+ const { store } = this.client;
8105
+ const state = store.getState();
8106
+ const assetProcedure = selectAssetProcedureById(assetProcedureId)(state);
8107
+ if (!assetProcedure) {
8108
+ throw new Error(`Expected asset procedure with offline_id ${assetProcedureId} to exist`);
8109
+ }
8110
+ const instancesOfAssetProcedure = selectAssetProcedureInstancesOfAssetProcedure(assetProcedureId)(state);
8111
+ this.dispatch(deleteAssetProcedure(assetProcedureId));
8112
+ this.dispatch(deleteAssetProcedureInstances(instancesOfAssetProcedure.map((instance) => instance.offline_id)));
8113
+ return this.enqueueRequest({
8114
+ description: "Delete asset procedure",
8115
+ method: HttpMethod.DELETE,
8116
+ url: `/asset-procedures/${assetProcedureId}/`,
8117
+ blockers: [assetProcedureId],
8118
+ blocks: []
8119
+ }).catch((e) => {
8120
+ this.dispatch(addAssetProcedure(assetProcedure));
8121
+ this.dispatch(addAssetProcedureInstances(instancesOfAssetProcedure));
8122
+ throw e;
8123
+ });
8124
+ }
8125
+ async refreshStore(organizationId) {
8126
+ const result = await this.enqueueRequest({
8127
+ description: "Get asset procedures",
8128
+ method: HttpMethod.GET,
8129
+ url: "/asset-procedures/",
8130
+ queryParams: {
8131
+ organization_id: organizationId.toString()
8132
+ },
8133
+ blockers: [],
8134
+ blocks: []
8135
+ });
8136
+ this.dispatch(initializeAssetProcedures(result));
8137
+ }
8138
+ }
8139
+ var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
8140
+ VerificationCodeType2[VerificationCodeType2["USER_REGISTRATION"] = 0] = "USER_REGISTRATION";
8141
+ VerificationCodeType2[VerificationCodeType2["APPLICATION_INVITE"] = 2] = "APPLICATION_INVITE";
8142
+ VerificationCodeType2[VerificationCodeType2["PROJECT_INVITE"] = 4] = "PROJECT_INVITE";
8143
+ VerificationCodeType2[VerificationCodeType2["ORGANIZATION_INVITE"] = 6] = "ORGANIZATION_INVITE";
8144
+ VerificationCodeType2[VerificationCodeType2["ADD_EMAIL_DOMAIN"] = 8] = "ADD_EMAIL_DOMAIN";
8145
+ VerificationCodeType2[VerificationCodeType2["RESET_PASSWORD"] = 10] = "RESET_PASSWORD";
8146
+ return VerificationCodeType2;
8147
+ })(VerificationCodeType || {});
7508
8148
  export {
7509
8149
  APIError,
7510
8150
  AgentService,
7511
8151
  AssetAttachmentService,
8152
+ AssetProcedureCompletionService,
8153
+ AssetProcedureInstanceService,
8154
+ AssetProcedureService,
7512
8155
  AssetService,
7513
- AssetStageColors,
7514
8156
  AssetStageCompletionService,
7515
8157
  AssetStageService,
7516
8158
  AssetTypeAttachmentService,
@@ -7572,9 +8214,20 @@ export {
7572
8214
  addAsset,
7573
8215
  addAssetAttachment,
7574
8216
  addAssetAttachments,
8217
+ addAssetProcedure,
8218
+ addAssetProcedureCompletion,
8219
+ addAssetProcedureCompletions,
8220
+ addAssetProcedureInstance,
8221
+ addAssetProcedureInstances,
8222
+ addAssetProcedures,
8223
+ addAssetStage,
8224
+ addAssetStageCompletion,
8225
+ addAssetStageCompletions,
8226
+ addAssetStages,
7575
8227
  addAssetType,
7576
8228
  addAssetTypeAttachment,
7577
8229
  addAssetTypeAttachments,
8230
+ addAssetTypes,
7578
8231
  addAssets,
7579
8232
  addCategory,
7580
8233
  addConversation,
@@ -7582,7 +8235,6 @@ export {
7582
8235
  addDocumentAttachments,
7583
8236
  addDocuments,
7584
8237
  addEmailDomain,
7585
- addFavouriteProjectId,
7586
8238
  addForm,
7587
8239
  addFormRevision,
7588
8240
  addFormRevisionAttachment,
@@ -7612,9 +8264,6 @@ export {
7612
8264
  addOrReplaceProjects,
7613
8265
  addProjectAttachment,
7614
8266
  addProjectAttachments,
7615
- addStageCompletion,
7616
- addStageCompletions,
7617
- addStages,
7618
8267
  addTeam,
7619
8268
  addToRecentIssues,
7620
8269
  addUsers,
@@ -7624,6 +8273,12 @@ export {
7624
8273
  areArraysEqual,
7625
8274
  assetAttachmentReducer,
7626
8275
  assetAttachmentSlice,
8276
+ assetProcedureCompletionReducer,
8277
+ assetProcedureCompletionSlice,
8278
+ assetProcedureInstanceReducer,
8279
+ assetProcedureInstanceSlice,
8280
+ assetProcedureReducer,
8281
+ assetProcedureSlice,
7627
8282
  assetReducer,
7628
8283
  assetSlice,
7629
8284
  assetStageCompletionReducer,
@@ -7637,6 +8292,7 @@ export {
7637
8292
  authReducer,
7638
8293
  authSlice,
7639
8294
  blobToBase64,
8295
+ boundsContainPoint,
7640
8296
  categoryReducer,
7641
8297
  categorySlice,
7642
8298
  classNames,
@@ -7644,6 +8300,9 @@ export {
7644
8300
  clearTokens,
7645
8301
  constructUploadedFilePayloads,
7646
8302
  coordinatesAreEqual,
8303
+ coordinatesToLiteral,
8304
+ coordinatesToText,
8305
+ coordinatesToUrlText,
7647
8306
  createMultiPointGeometry,
7648
8307
  createOfflineAction,
7649
8308
  createPointGeometry,
@@ -7651,9 +8310,20 @@ export {
7651
8310
  deleteAsset,
7652
8311
  deleteAssetAttachment,
7653
8312
  deleteAssetAttachments,
8313
+ deleteAssetProcedure,
8314
+ deleteAssetProcedureCompletion,
8315
+ deleteAssetProcedureCompletions,
8316
+ deleteAssetProcedureInstance,
8317
+ deleteAssetProcedureInstances,
8318
+ deleteAssetProcedures,
8319
+ deleteAssetStage,
8320
+ deleteAssetStageCompletion,
8321
+ deleteAssetStageCompletions,
8322
+ deleteAssetStages,
7654
8323
  deleteAssetType,
7655
8324
  deleteAssetTypeAttachment,
7656
8325
  deleteAssetTypeAttachments,
8326
+ deleteAssetTypes,
7657
8327
  deleteAssets,
7658
8328
  deleteCategory,
7659
8329
  deleteDocumentAttachment,
@@ -7706,6 +8376,8 @@ export {
7706
8376
  fileReducer,
7707
8377
  fileSlice,
7708
8378
  fileToBlob,
8379
+ flipBounds,
8380
+ flipCoordinates,
7709
8381
  formReducer,
7710
8382
  formRevisionAttachmentReducer,
7711
8383
  formRevisionAttachmentSlice,
@@ -7727,10 +8399,14 @@ export {
7727
8399
  getLocalRelativeDateString,
7728
8400
  getOutboxCoordinator,
7729
8401
  getRenamedFile,
7730
- getStageColor,
7731
8402
  hashFile,
7732
8403
  initSDK,
7733
8404
  initializeAssetAttachments,
8405
+ initializeAssetProcedureCompletions,
8406
+ initializeAssetProcedureInstances,
8407
+ initializeAssetProcedures,
8408
+ initializeAssetStageCompletions,
8409
+ initializeAssetStages,
7734
8410
  initializeAssetTypeAttachments,
7735
8411
  initializeAssetTypes,
7736
8412
  initializeAssets,
@@ -7753,7 +8429,6 @@ export {
7753
8429
  initializeOrganizationAccesses,
7754
8430
  initializeProjectAccesses,
7755
8431
  initializeProjectAttachments,
7756
- initializeStages,
7757
8432
  initializeTeams,
7758
8433
  initializeWorkspaces,
7759
8434
  isToday,
@@ -7772,14 +8447,18 @@ export {
7772
8447
  issueUpdateSlice,
7773
8448
  licenseReducer,
7774
8449
  licenseSlice,
8450
+ literalToCoordinates,
7775
8451
  logOnlyOnce,
7776
8452
  markAsDeleted,
7777
8453
  markForDeletion,
7778
8454
  memoize,
7779
8455
  moveDocument,
7780
8456
  offline,
8457
+ offsetPositionByMeters,
7781
8458
  onlyUniqueHashes,
7782
8459
  onlyUniqueOfflineIds,
8460
+ openCoordsInGoogleMaps,
8461
+ openDirectionsInGoogleMaps,
7783
8462
  organizationAccessReducer,
7784
8463
  organizationAccessSlice,
7785
8464
  organizationReducer,
@@ -7802,13 +8481,10 @@ export {
7802
8481
  rehydratedReducer,
7803
8482
  rehydratedSlice,
7804
8483
  removeDocuments,
7805
- removeFavouriteProjectId,
7806
8484
  removeIssueType,
7807
8485
  removeProjectFile,
7808
8486
  removeProjectFilesOfProject,
7809
8487
  removeRecentIssue,
7810
- removeStageCompletions,
7811
- removeStages,
7812
8488
  removeUser,
7813
8489
  resetProjectFileObjectUrls,
7814
8490
  resetRecentIssues,
@@ -7830,14 +8506,35 @@ export {
7830
8506
  selectAssetAttachmentMapping,
7831
8507
  selectAssetAttachments,
7832
8508
  selectAssetById,
8509
+ selectAssetProcedureById,
8510
+ selectAssetProcedureCompletionById,
8511
+ selectAssetProcedureCompletions,
8512
+ selectAssetProcedureCompletionsByIds,
8513
+ selectAssetProcedureCompletionsMapping,
8514
+ selectAssetProcedureCompletionsOfAsset,
8515
+ selectAssetProcedureCompletionsOfAssetProcedureInstance,
8516
+ selectAssetProcedureInstanceById,
8517
+ selectAssetProcedureInstances,
8518
+ selectAssetProcedureInstancesByIds,
8519
+ selectAssetProcedureInstancesMapping,
8520
+ selectAssetProcedureInstancesOfAssetProcedure,
8521
+ selectAssetProcedureInstancesOfAssetType,
8522
+ selectAssetProcedures,
8523
+ selectAssetProceduresByIds,
8524
+ selectAssetProceduresMapping,
8525
+ selectAssetProceduresOfOrganization,
7833
8526
  selectAssetStageById,
8527
+ selectAssetStageCompletionById,
8528
+ selectAssetStageCompletionMapping,
8529
+ selectAssetStageCompletionsByIds,
7834
8530
  selectAssetStages,
7835
8531
  selectAssetStagesByIds,
8532
+ selectAssetStagesMappingOfAssetProcedure,
8533
+ selectAssetStagesOfAssetProcedure,
7836
8534
  selectAssetTypeAttachmentById,
7837
8535
  selectAssetTypeAttachmentMapping,
7838
8536
  selectAssetTypeAttachments,
7839
8537
  selectAssetTypeById,
7840
- selectAssetTypeStagesMapping,
7841
8538
  selectAssetTypes,
7842
8539
  selectAssetTypesByIds,
7843
8540
  selectAssetTypesMapping,
@@ -7865,8 +8562,8 @@ export {
7865
8562
  selectCategoryById,
7866
8563
  selectCategoryMapping,
7867
8564
  selectCommentsOfIssue,
7868
- selectCompletedStageIdsForAsset,
7869
- selectCompletedStages,
8565
+ selectCompletedStageIdsOfAssetProcedureCompletion,
8566
+ selectCompletedStagesByAssetProcedureCompletion,
7870
8567
  selectConversation,
7871
8568
  selectConversationMapping,
7872
8569
  selectConversations,
@@ -7881,7 +8578,6 @@ export {
7881
8578
  selectEmailDomains,
7882
8579
  selectEmailDomainsAsMapping,
7883
8580
  selectEmailDomainsOfOrganization,
7884
- selectFavouriteProjects,
7885
8581
  selectFilteredForms,
7886
8582
  selectFormById,
7887
8583
  selectFormMapping,
@@ -7980,8 +8676,6 @@ export {
7980
8676
  selectSortedProjectUsers,
7981
8677
  selectStageFormIdsFromStageIds,
7982
8678
  selectStageMapping,
7983
- selectStagesFromAssetTypeIds,
7984
- selectStagesOfAssetType,
7985
8679
  selectTeamById,
7986
8680
  selectTeams,
7987
8681
  selectTeamsByIds,
@@ -8000,8 +8694,18 @@ export {
8000
8694
  setAsset,
8001
8695
  setAssetAttachment,
8002
8696
  setAssetAttachments,
8697
+ setAssetProcedure,
8698
+ setAssetProcedureCompletion,
8699
+ setAssetProcedureCompletions,
8700
+ setAssetProcedureInstance,
8701
+ setAssetProcedureInstances,
8702
+ setAssetProcedures,
8703
+ setAssetStage,
8704
+ setAssetStages,
8705
+ setAssetType,
8003
8706
  setAssetTypeAttachment,
8004
8707
  setAssetTypeAttachments,
8708
+ setAssetTypes,
8005
8709
  setAssets,
8006
8710
  setConversation,
8007
8711
  setCurrentUser,
@@ -8034,11 +8738,8 @@ export {
8034
8738
  setProjectAttachments,
8035
8739
  setProjects,
8036
8740
  setRehydrated,
8037
- setStage,
8038
- setStageCompletions,
8039
8741
  setTeam,
8040
8742
  setTokens,
8041
- setTourStep,
8042
8743
  setUploadUrl,
8043
8744
  setUsers,
8044
8745
  setWorkspaces,
@@ -8054,8 +8755,20 @@ export {
8054
8755
  updateAsset,
8055
8756
  updateAssetAttachment,
8056
8757
  updateAssetAttachments,
8758
+ updateAssetProcedure,
8759
+ updateAssetProcedureCompletion,
8760
+ updateAssetProcedureCompletions,
8761
+ updateAssetProcedureInstance,
8762
+ updateAssetProcedureInstances,
8763
+ updateAssetProcedures,
8764
+ updateAssetStage,
8765
+ updateAssetStageCompletion,
8766
+ updateAssetStageCompletions,
8767
+ updateAssetStages,
8768
+ updateAssetType,
8057
8769
  updateAssetTypeAttachment,
8058
8770
  updateAssetTypeAttachments,
8771
+ updateAssetTypes,
8059
8772
  updateAssets,
8060
8773
  updateCategory,
8061
8774
  updateConversation,
@@ -8083,8 +8796,6 @@ export {
8083
8796
  updateProjectAccess,
8084
8797
  updateProjectAttachment,
8085
8798
  updateProjectAttachments,
8086
- updateStage,
8087
- updateStages,
8088
8799
  updateTeam,
8089
8800
  updateWorkspace,
8090
8801
  useMemoCompare,
@@ -8094,6 +8805,7 @@ export {
8094
8805
  versioningSlice,
8095
8806
  warningColor,
8096
8807
  workspaceReducer,
8097
- workspaceSlice
8808
+ workspaceSlice,
8809
+ worldBounds
8098
8810
  };
8099
8811
  //# sourceMappingURL=overmap-core.js.map