@bringg/dashboard-sdk 8.20.0-pre.2 → 8.21.0-pre

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 (70) hide show
  1. package/dist/BringgDashboardSDK.d.ts +2 -0
  2. package/dist/BringgDashboardSDK.js +3 -1
  3. package/dist/BringgDashboardSDK.js.map +1 -1
  4. package/dist/Chat/Chat.d.ts +1 -1
  5. package/dist/Chat/Chat.js.map +1 -1
  6. package/dist/Chat/Service/Chat.service.d.ts +1 -1
  7. package/dist/Core/BaseStore.js +1 -1
  8. package/dist/Core/BaseStore.js.map +1 -1
  9. package/dist/Customer/v2/customers-api.d.ts +4 -5
  10. package/dist/Customer/v2/customers-api.js +8 -12
  11. package/dist/Customer/v2/customers-api.js.map +1 -1
  12. package/dist/OptimizationResult/optimization-result-api.d.ts +2 -2
  13. package/dist/OptimizationResult/optimization-result-api.js +2 -2
  14. package/dist/OptimizationResult/optimization-result-api.js.map +1 -1
  15. package/dist/OptimizationResult/optimization-result-service.d.ts +2 -2
  16. package/dist/OptimizationResult/optimization-result-service.js +10 -5
  17. package/dist/OptimizationResult/optimization-result-service.js.map +1 -1
  18. package/dist/RouteOptimization/RouteOptimizationApi.d.ts +3 -1
  19. package/dist/RouteOptimization/RouteOptimizationApi.js +9 -0
  20. package/dist/RouteOptimization/RouteOptimizationApi.js.map +1 -1
  21. package/dist/Run/Service/runs.service.d.ts +5 -5
  22. package/dist/Run/Service/runs.service.js +44 -25
  23. package/dist/Run/Service/runs.service.js.map +1 -1
  24. package/dist/Run/Store/RunStore.js +1 -0
  25. package/dist/Run/Store/RunStore.js.map +1 -1
  26. package/dist/Run/runs.consts.d.ts +0 -3
  27. package/dist/Run/runs.consts.js +1 -5
  28. package/dist/Run/runs.consts.js.map +1 -1
  29. package/dist/Run/runs.d.ts +2 -2
  30. package/dist/Run/runs.js +2 -2
  31. package/dist/Run/runs.js.map +1 -1
  32. package/dist/Run/v2/runs-api.d.ts +5 -28
  33. package/dist/Run/v2/runs-api.js +30 -180
  34. package/dist/Run/v2/runs-api.js.map +1 -1
  35. package/dist/Services/ServiceRequest.js +1 -1
  36. package/dist/Task/v2/task-realtime-subscriptions.d.ts +13 -7
  37. package/dist/Task/v2/task-realtime-subscriptions.js +122 -61
  38. package/dist/Task/v2/task-realtime-subscriptions.js.map +1 -1
  39. package/dist/Task/v2/tasks-api.d.ts +5 -5
  40. package/dist/TasksExplorer/Services/tasks-explorer-service.d.ts +8 -0
  41. package/dist/TasksExplorer/Services/tasks-explorer-service.js +61 -0
  42. package/dist/TasksExplorer/Services/tasks-explorer-service.js.map +1 -0
  43. package/dist/TasksExplorer/v2/tasks-explorer-api.d.ts +8 -0
  44. package/dist/TasksExplorer/v2/tasks-explorer-api.js +55 -0
  45. package/dist/TasksExplorer/v2/tasks-explorer-api.js.map +1 -0
  46. package/dist/Vehicle/v2/vehicles-api.d.ts +7 -5
  47. package/dist/Vehicle/v2/vehicles-api.js +29 -11
  48. package/dist/Vehicle/v2/vehicles-api.js.map +1 -1
  49. package/dist/bringg-dashboard-sdk-cjs2.js +586 -663
  50. package/dist/bringg-dashboard-sdk-cjs2.js.map +1 -1
  51. package/dist/bringg-dashboard-sdk.js +127 -61
  52. package/dist/bringg-dashboard-sdk.min.js +1 -1
  53. package/dist/bringg-dashboard-sdk.min.js.map +1 -1
  54. package/dist/data-entity.d.ts +1 -1
  55. package/dist/index.d.ts +1 -0
  56. package/dist/index.js +3 -1
  57. package/dist/index.js.map +1 -1
  58. package/dist/storable-data-service.d.ts +2 -2
  59. package/dist/storable-data-service.js +6 -17
  60. package/dist/storable-data-service.js.map +1 -1
  61. package/package.json +2 -2
  62. package/dist/Data/storable-realtime-subscriptions.d.ts +0 -18
  63. package/dist/Data/storable-realtime-subscriptions.js +0 -144
  64. package/dist/Data/storable-realtime-subscriptions.js.map +0 -1
  65. package/dist/Data/storable-types.d.ts +0 -19
  66. package/dist/Data/storable-types.js +0 -3
  67. package/dist/Data/storable-types.js.map +0 -1
  68. package/dist/Run/v2/run-realtime-subscriptions.d.ts +0 -25
  69. package/dist/Run/v2/run-realtime-subscriptions.js +0 -152
  70. package/dist/Run/v2/run-realtime-subscriptions.js.map +0 -1
@@ -2416,6 +2416,7 @@ var TaskConfiguration_1 = __webpack_require__(15127);
2416
2416
  var TaskInventory_1 = __webpack_require__(92448);
2417
2417
  var TaskManagedAttributes_1 = __webpack_require__(26931);
2418
2418
  var task_reject_reasons_api_1 = __webpack_require__(62954);
2419
+ var tasks_explorer_api_1 = __webpack_require__(66845);
2419
2420
  var TeamApi_1 = __webpack_require__(10879);
2420
2421
  var TeamConfigurationApi_1 = __webpack_require__(37565);
2421
2422
  var TeamServiceAreaApi_1 = __webpack_require__(2847);
@@ -2693,7 +2694,8 @@ function init(session) {
2693
2694
  deliveryWindows: new delivery_windows_api_1.default(session),
2694
2695
  taskManagedAttributes: new TaskManagedAttributes_1.TaskManagedAttributesApi(session),
2695
2696
  chat: new Chat_1.default(session),
2696
- optimizationKpi: new OptimizationKpiApi_1.default(session)
2697
+ optimizationKpi: new OptimizationKpiApi_1.default(session),
2698
+ tasksExplorer: new tasks_explorer_api_1.default(session)
2697
2699
  };
2698
2700
  bringg.application = new ApplicationApi_1.default(session);
2699
2701
  bringg.chat = new ChatConversationApi_1.default(session);
@@ -3763,7 +3765,7 @@ var BaseStore = /** @class */ (function () {
3763
3765
  };
3764
3766
  this.getItemsByIds = function (ids) {
3765
3767
  var idsSet = new Set(ids);
3766
- return _this.getItems().filter(function (item) { return idsSet.has(item.id); });
3768
+ return _this.getItems().filter(function (runModel) { return idsSet.has(runModel.id); });
3767
3769
  };
3768
3770
  this.getItemsMap = function () {
3769
3771
  return _this._items;
@@ -6264,9 +6266,9 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
6264
6266
  Object.defineProperty(exports, "__esModule", ({ value: true }));
6265
6267
  var _ = __webpack_require__(96486);
6266
6268
  var merge_mapper_1 = __webpack_require__(59200);
6267
- var storable_realtime_subscriptions_1 = __webpack_require__(1227);
6268
6269
  var data_entity_1 = __webpack_require__(91083);
6269
6270
  var data_store_1 = __webpack_require__(73135);
6271
+ var realtime_subscriptions_1 = __webpack_require__(47985);
6270
6272
  var storable_data_service_1 = __webpack_require__(45297);
6271
6273
  var array_utils_1 = __webpack_require__(43052);
6272
6274
  var Customer_consts_1 = __webpack_require__(85240);
@@ -6279,19 +6281,15 @@ var CustomersApi = /** @class */ (function () {
6279
6281
  this.storableDataService = new storable_data_service_1.default(this.customersStore, function (customer) {
6280
6282
  return merge_mapper_1.mergeMapper.mergeIntoExisting(_this.customersStore, customer);
6281
6283
  });
6282
- this.storableRealtimeSubscriptions = new storable_realtime_subscriptions_1.default(session, this.customersStore, this.storableDataService);
6283
- this.storableRealtimeSubscriptions.updateStoreOnEvents([
6284
- { name: Customer_consts_1.RealtimeEvents.Created, isDelete: false },
6285
- { name: Customer_consts_1.RealtimeEvents.Updated, isDelete: false },
6286
- {
6287
- name: Customer_consts_1.RealtimeEvents.Deleted,
6288
- isDelete: true,
6289
- itemExtractor: function (payload) { return ({ id: payload.customer_id }); }
6290
- }
6291
- ]);
6284
+ this.realtimeSubscriptions = new realtime_subscriptions_1.default(session);
6285
+ this.realtimeSubscriptions.subscribe(Customer_consts_1.RealtimeEvents.Created, this.storableDataService.updateInStores.bind(this.storableDataService));
6286
+ this.realtimeSubscriptions.subscribe(Customer_consts_1.RealtimeEvents.Updated, this.storableDataService.updateInStores.bind(this.storableDataService));
6287
+ this.realtimeSubscriptions.subscribe(Customer_consts_1.RealtimeEvents.Deleted, function (data) {
6288
+ return _this.storableDataService.removeFromStores(data.customer_id);
6289
+ });
6292
6290
  }
6293
6291
  CustomersApi.prototype.onCreate = function (callback) {
6294
- return this.storableRealtimeSubscriptions.onEvent(Customer_consts_1.RealtimeEvents.Created, function (item) { return callback(item.current); });
6292
+ this.realtimeSubscriptions.subscribe(Customer_consts_1.RealtimeEvents.Created, callback);
6295
6293
  };
6296
6294
  CustomersApi.prototype.add = function (customer) {
6297
6295
  return this.storableDataService.updateInStores(customer);
@@ -7305,157 +7303,6 @@ exports.objectMerger = { deepMerge: deepMerge };
7305
7303
 
7306
7304
  /***/ }),
7307
7305
 
7308
- /***/ 1227:
7309
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
7310
-
7311
- "use strict";
7312
-
7313
- var __values = (this && this.__values) || function(o) {
7314
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
7315
- if (m) return m.call(o);
7316
- if (o && typeof o.length === "number") return {
7317
- next: function () {
7318
- if (o && i >= o.length) o = void 0;
7319
- return { value: o && o[i++], done: !o };
7320
- }
7321
- };
7322
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
7323
- };
7324
- Object.defineProperty(exports, "__esModule", ({ value: true }));
7325
- var realtime_subscriptions_1 = __webpack_require__(47985);
7326
- var object_merger_1 = __webpack_require__(7262);
7327
- var StorableRealtimeSubscriptions = /** @class */ (function () {
7328
- function StorableRealtimeSubscriptions(session, dataStore, storableDataService) {
7329
- this.realtimeSubscriptions = new realtime_subscriptions_1.default(session);
7330
- this.dataStore = dataStore;
7331
- this.storableDataService = storableDataService;
7332
- this.eventCallbacks = {};
7333
- }
7334
- StorableRealtimeSubscriptions.prototype.updateStoreOnEvents = function (events, subEntityEvents) {
7335
- var e_1, _a, e_2, _b;
7336
- var _this = this;
7337
- if (subEntityEvents === void 0) { subEntityEvents = []; }
7338
- var _loop_1 = function (event_1) {
7339
- this_1.realtimeSubscriptions.subscribe(event_1.name, function (item) {
7340
- item = event_1.itemExtractor ? event_1.itemExtractor(item) : item;
7341
- var data = event_1.extraDataFunc && event_1.extraDataFunc(item);
7342
- if (data === null || data === void 0 ? void 0 : data.ignore) {
7343
- return;
7344
- }
7345
- if (event_1.isDelete) {
7346
- var deletedItem = _this.storableDataService.removeFromStores(item.id);
7347
- _this.runEventCallbacks(event_1.name, { diff: deletedItem });
7348
- }
7349
- else {
7350
- var mappedStorableItem = _this.storableDataService.updateInStores(item, undefined, undefined, data === null || data === void 0 ? void 0 : data.params);
7351
- _this.runEventCallbacks(event_1.name, mappedStorableItem);
7352
- }
7353
- });
7354
- };
7355
- var this_1 = this;
7356
- try {
7357
- for (var events_1 = __values(events), events_1_1 = events_1.next(); !events_1_1.done; events_1_1 = events_1.next()) {
7358
- var event_1 = events_1_1.value;
7359
- _loop_1(event_1);
7360
- }
7361
- }
7362
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
7363
- finally {
7364
- try {
7365
- if (events_1_1 && !events_1_1.done && (_a = events_1.return)) _a.call(events_1);
7366
- }
7367
- finally { if (e_1) throw e_1.error; }
7368
- }
7369
- var _loop_2 = function (subEntityEvent) {
7370
- this_2.realtimeSubscriptions.subscribe(subEntityEvent.name, function (subEntity) {
7371
- subEntityEvent.ignoreFields.forEach(function (field) { return delete subEntity[field]; });
7372
- var eventChangeData = _this.changeSubEntity(subEntity, subEntityEvent.parentField, subEntityEvent.field, subEntityEvent.isDelete);
7373
- if (eventChangeData.current) {
7374
- _this.runEventCallbacks(subEntityEvent.eventToRaise, eventChangeData);
7375
- }
7376
- });
7377
- };
7378
- var this_2 = this;
7379
- try {
7380
- for (var subEntityEvents_1 = __values(subEntityEvents), subEntityEvents_1_1 = subEntityEvents_1.next(); !subEntityEvents_1_1.done; subEntityEvents_1_1 = subEntityEvents_1.next()) {
7381
- var subEntityEvent = subEntityEvents_1_1.value;
7382
- _loop_2(subEntityEvent);
7383
- }
7384
- }
7385
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
7386
- finally {
7387
- try {
7388
- if (subEntityEvents_1_1 && !subEntityEvents_1_1.done && (_b = subEntityEvents_1.return)) _b.call(subEntityEvents_1);
7389
- }
7390
- finally { if (e_2) throw e_2.error; }
7391
- }
7392
- };
7393
- StorableRealtimeSubscriptions.prototype.onAnyEvent = function (event, callback) {
7394
- return this.realtimeSubscriptions.subscribe(event, callback);
7395
- };
7396
- StorableRealtimeSubscriptions.prototype.onEvent = function (event, callback) {
7397
- var _this = this;
7398
- if (!this.eventCallbacks[event]) {
7399
- this.eventCallbacks[event] = [];
7400
- }
7401
- this.eventCallbacks[event].push(callback);
7402
- return function () {
7403
- var indexOfCallback = _this.eventCallbacks[event].indexOf(callback);
7404
- _this.eventCallbacks[event].splice(indexOfCallback, 1);
7405
- };
7406
- };
7407
- StorableRealtimeSubscriptions.prototype.runEventCallbacks = function (event, data) {
7408
- (this.eventCallbacks[event] || []).forEach(function (callback) { return callback(data); });
7409
- };
7410
- StorableRealtimeSubscriptions.prototype.changeSubEntity = function (subEntity, parentField, containerField, isDelete) {
7411
- var _a, _b, _c;
7412
- var current = this.dataStore.get(subEntity[parentField]);
7413
- var diff;
7414
- if (current) {
7415
- if (!current[containerField]) {
7416
- current[containerField] = [];
7417
- }
7418
- var existingIndex = current[containerField].findIndex(function (taskSubEntity) { return taskSubEntity.id === subEntity.id; });
7419
- if (existingIndex > -1) {
7420
- if (isDelete) {
7421
- diff = (_a = { id: current.id }, _a[containerField] = this.createArrayOfEmptyObjects(existingIndex), _a);
7422
- for (var i = existingIndex + 1; i < current[containerField].length; i++) {
7423
- diff[containerField].push(current[containerField][i]);
7424
- }
7425
- current[containerField].splice(existingIndex, 1);
7426
- }
7427
- else {
7428
- var subEntityDiff = object_merger_1.objectMerger.deepMerge(current[containerField][existingIndex], subEntity);
7429
- diff = (_b = {
7430
- id: current.id
7431
- },
7432
- _b[containerField] = this.createArrayOfEmptyObjects(current[containerField].length),
7433
- _b);
7434
- diff[containerField][existingIndex] = subEntityDiff;
7435
- }
7436
- }
7437
- else if (!isDelete) {
7438
- diff = (_c = {
7439
- id: current.id
7440
- },
7441
- _c[containerField] = this.createArrayOfEmptyObjects(current[containerField].length),
7442
- _c);
7443
- diff[containerField].push(subEntity);
7444
- current[containerField].push(subEntity);
7445
- }
7446
- }
7447
- return { current: current, diff: diff };
7448
- };
7449
- StorableRealtimeSubscriptions.prototype.createArrayOfEmptyObjects = function (length) {
7450
- return Array.from({ length: length }, function () { return ({}); });
7451
- };
7452
- return StorableRealtimeSubscriptions;
7453
- }());
7454
- exports["default"] = StorableRealtimeSubscriptions;
7455
- //# sourceMappingURL=storable-realtime-subscriptions.js.map
7456
-
7457
- /***/ }),
7458
-
7459
7306
  /***/ 27774:
7460
7307
  /***/ ((__unused_webpack_module, exports) => {
7461
7308
 
@@ -14238,8 +14085,8 @@ var OptimizationResultApi = /** @class */ (function () {
14238
14085
  OptimizationResultApi.prototype.load = function (teamId, requestUuid) {
14239
14086
  return this.optimizationResultService.load(teamId, requestUuid);
14240
14087
  };
14241
- OptimizationResultApi.prototype.loadAll = function (teamId, startTime, sortDirection, pageSize) {
14242
- return this.optimizationResultService.loadAll(teamId, startTime, sortDirection, pageSize);
14088
+ OptimizationResultApi.prototype.loadAll = function (request) {
14089
+ return this.optimizationResultService.loadAll(request);
14243
14090
  };
14244
14091
  return OptimizationResultApi;
14245
14092
  }());
@@ -14316,7 +14163,7 @@ var OptimizationResultService = /** @class */ (function () {
14316
14163
  });
14317
14164
  });
14318
14165
  };
14319
- OptimizationResultService.prototype.loadAll = function (teamId, startTime, sortDirection, pageSize) {
14166
+ OptimizationResultService.prototype.loadAll = function (request) {
14320
14167
  return __awaiter(this, void 0, void 0, function () {
14321
14168
  return __generator(this, function (_a) {
14322
14169
  switch (_a.label) {
@@ -14324,10 +14171,15 @@ var OptimizationResultService = /** @class */ (function () {
14324
14171
  .get(exports.Routes.GET_ALL)
14325
14172
  .setException('failed to load optimization results')
14326
14173
  .withQueryString({
14327
- team_id: teamId,
14328
- start_time: startTime,
14329
- sort_direction: sortDirection,
14330
- page_size: pageSize
14174
+ team_id: request.team_id,
14175
+ start_time: request.start_time,
14176
+ end_time: request.end_time,
14177
+ page_size: request.page_size,
14178
+ page_number: request.page_number,
14179
+ origin: request.origin,
14180
+ user_ids: request.user_ids,
14181
+ sort_column: request.sort_column,
14182
+ sort_direction: request.sort_direction
14331
14183
  })
14332
14184
  .invoke()];
14333
14185
  case 1: return [2 /*return*/, _a.sent()];
@@ -16724,6 +16576,7 @@ var RouteOptimizationApi = /** @class */ (function (_super) {
16724
16576
  _this.update_user_modified_data = new Route_1.Route('/route_optimizations/update_user_modified_data', 1 /* HttpMethod.POST */);
16725
16577
  _this.update_user_modified_data_v2 = new Route_1.Route('/own-fleet-optimization-service/route_optimization/update_user_modified_data', 1 /* HttpMethod.POST */);
16726
16578
  _this.assign_user_manual_optimization = new Route_1.Route('/route_optimizations/assign_user_manual_optimization', 1 /* HttpMethod.POST */);
16579
+ _this.calculate_planned_eta = new Route_1.Route('/own-fleet-optimization-service/route_optimization/calculate_planned_eta', 1 /* HttpMethod.POST */);
16727
16580
  return _this;
16728
16581
  }
16729
16582
  RouteOptimizationApi.prototype.cancelRequests = function (requestUuids, v2) {
@@ -16780,6 +16633,14 @@ var RouteOptimizationApi = /** @class */ (function (_super) {
16780
16633
  timeout: fiveMinutesInMs
16781
16634
  });
16782
16635
  };
16636
+ RouteOptimizationApi.prototype.calculatePlannedEta = function (route) {
16637
+ return this.handleAuthorizedRequest({
16638
+ route: this.calculate_planned_eta,
16639
+ extractor: RouteGenerator_1.defaultExtractor,
16640
+ exceptionProducer: BringgException_1.BringgException.serviceException('Failed to calculate planned eta'),
16641
+ payload: __assign({}, route)
16642
+ });
16643
+ };
16783
16644
  return RouteOptimizationApi;
16784
16645
  }(SessionBasedService_1.SessionBasedService));
16785
16646
  exports["default"] = RouteOptimizationApi;
@@ -17041,6 +16902,21 @@ exports["default"] = Rules;
17041
16902
 
17042
16903
  "use strict";
17043
16904
 
16905
+ var __extends = (this && this.__extends) || (function () {
16906
+ var extendStatics = function (d, b) {
16907
+ extendStatics = Object.setPrototypeOf ||
16908
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
16909
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
16910
+ return extendStatics(d, b);
16911
+ };
16912
+ return function (d, b) {
16913
+ if (typeof b !== "function" && b !== null)
16914
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
16915
+ extendStatics(d, b);
16916
+ function __() { this.constructor = d; }
16917
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
16918
+ };
16919
+ })();
17044
16920
  var __assign = (this && this.__assign) || function () {
17045
16921
  __assign = Object.assign || function(t) {
17046
16922
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -17091,8 +16967,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
17091
16967
  Object.defineProperty(exports, "__esModule", ({ value: true }));
17092
16968
  exports.RunsService = exports.Routes = void 0;
17093
16969
  var BringgException_1 = __webpack_require__(43605);
17094
- var CrudService_1 = __webpack_require__(14809);
17095
16970
  var Route_1 = __webpack_require__(92641);
16971
+ var SessionBasedService_1 = __webpack_require__(27826);
17096
16972
  var array_utils_1 = __webpack_require__(43052);
17097
16973
  var runs_consts_1 = __webpack_require__(4669);
17098
16974
  exports.Routes = {
@@ -17111,23 +16987,27 @@ exports.Routes = {
17111
16987
  ASSIGN_VEHICLES: new Route_1.Route('/runs/{:id}/vehicles_assignment', 3 /* HttpMethod.PATCH */),
17112
16988
  UNASSIGN_VEHICLES: new Route_1.Route('/runs/{:id}/vehicles_assignment', 4 /* HttpMethod.DELETE */)
17113
16989
  };
17114
- var RunsService = /** @class */ (function () {
16990
+ var RunsService = /** @class */ (function (_super) {
16991
+ __extends(RunsService, _super);
17115
16992
  function RunsService(session) {
17116
- this.service = new CrudService_1.default(session, 'runs');
16993
+ return _super.call(this, session.config.getApiEndpoint(), session) || this;
17117
16994
  }
17118
16995
  RunsService.prototype.getAll = function (options, _a) {
17119
16996
  var _b = _a === void 0 ? {} : _a, signal = _b.signal;
17120
16997
  return __awaiter(this, void 0, void 0, function () {
16998
+ var runsResponse;
17121
16999
  return __generator(this, function (_c) {
17122
17000
  switch (_c.label) {
17123
- case 0: return [4 /*yield*/, this.service.handleAuthorizedRequest({
17001
+ case 0: return [4 /*yield*/, this.handleAuthorizedRequest({
17124
17002
  route: exports.Routes.GET_RUNS,
17125
17003
  extractor: runs_consts_1.defaultExtractor,
17126
17004
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to get Runs'),
17127
17005
  queryString: options,
17128
17006
  signal: signal
17129
17007
  })];
17130
- case 1: return [2 /*return*/, _c.sent()];
17008
+ case 1:
17009
+ runsResponse = _c.sent();
17010
+ return [2 /*return*/, runsResponse];
17131
17011
  }
17132
17012
  });
17133
17013
  });
@@ -17137,7 +17017,7 @@ var RunsService = /** @class */ (function () {
17137
17017
  return __awaiter(this, void 0, void 0, function () {
17138
17018
  return __generator(this, function (_c) {
17139
17019
  switch (_c.label) {
17140
- case 0: return [4 /*yield*/, this.service.handleAuthorizedRequest({
17020
+ case 0: return [4 /*yield*/, this.handleAuthorizedRequest({
17141
17021
  route: exports.Routes.GET_RUN_DATA,
17142
17022
  extractor: runs_consts_1.defaultExtractor,
17143
17023
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to get routes data'),
@@ -17212,19 +17092,22 @@ var RunsService = /** @class */ (function () {
17212
17092
  });
17213
17093
  });
17214
17094
  };
17215
- RunsService.prototype.load = function (id, _a) {
17095
+ RunsService.prototype.get = function (id, _a) {
17216
17096
  var _b = _a === void 0 ? {} : _a, signal = _b.signal;
17217
17097
  return __awaiter(this, void 0, void 0, function () {
17098
+ var run;
17218
17099
  return __generator(this, function (_c) {
17219
17100
  switch (_c.label) {
17220
- case 0: return [4 /*yield*/, this.service.handleAuthorizedRequest({
17101
+ case 0: return [4 /*yield*/, this.handleAuthorizedRequest({
17221
17102
  route: exports.Routes.GET_RUN,
17222
17103
  extractor: runs_consts_1.runExtractor,
17223
17104
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to get Run'),
17224
17105
  routeParams: { id: id },
17225
17106
  signal: signal
17226
17107
  })];
17227
- case 1: return [2 /*return*/, _c.sent()];
17108
+ case 1:
17109
+ run = _c.sent();
17110
+ return [2 /*return*/, run];
17228
17111
  }
17229
17112
  });
17230
17113
  });
@@ -17232,10 +17115,9 @@ var RunsService = /** @class */ (function () {
17232
17115
  RunsService.prototype.update = function (id, options, _a) {
17233
17116
  var _b = _a === void 0 ? {} : _a, signal = _b.signal;
17234
17117
  return __awaiter(this, void 0, void 0, function () {
17235
- var response;
17236
17118
  return __generator(this, function (_c) {
17237
17119
  switch (_c.label) {
17238
- case 0: return [4 /*yield*/, this.service.handleAuthorizedRequest({
17120
+ case 0: return [4 /*yield*/, this.handleAuthorizedRequest({
17239
17121
  route: exports.Routes.UPDATE_RUN,
17240
17122
  extractor: runs_consts_1.defaultExtractor,
17241
17123
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to update Run'),
@@ -17243,9 +17125,7 @@ var RunsService = /** @class */ (function () {
17243
17125
  routeParams: { id: id },
17244
17126
  signal: signal
17245
17127
  })];
17246
- case 1:
17247
- response = _c.sent();
17248
- return [2 /*return*/, response.run];
17128
+ case 1: return [2 /*return*/, _c.sent()];
17249
17129
  }
17250
17130
  });
17251
17131
  });
@@ -17256,7 +17136,7 @@ var RunsService = /** @class */ (function () {
17256
17136
  var runHistory;
17257
17137
  return __generator(this, function (_c) {
17258
17138
  switch (_c.label) {
17259
- case 0: return [4 /*yield*/, this.service.handleAuthorizedRequest({
17139
+ case 0: return [4 /*yield*/, this.handleAuthorizedRequest({
17260
17140
  route: exports.Routes.GET_RUN_HISTORY,
17261
17141
  extractor: runs_consts_1.runsHistoryExtractor,
17262
17142
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to get run history'),
@@ -17276,7 +17156,7 @@ var RunsService = /** @class */ (function () {
17276
17156
  var runLocations;
17277
17157
  return __generator(this, function (_c) {
17278
17158
  switch (_c.label) {
17279
- case 0: return [4 /*yield*/, this.service.handleAuthorizedRequest({
17159
+ case 0: return [4 /*yield*/, this.handleAuthorizedRequest({
17280
17160
  route: exports.Routes.GET_RUN_LOCATIONS,
17281
17161
  extractor: runs_consts_1.runsLocationsExtractor,
17282
17162
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to get run locations'),
@@ -17296,7 +17176,7 @@ var RunsService = /** @class */ (function () {
17296
17176
  var runLocations;
17297
17177
  return __generator(this, function (_c) {
17298
17178
  switch (_c.label) {
17299
- case 0: return [4 /*yield*/, this.service.handleAuthorizedRequest({
17179
+ case 0: return [4 /*yield*/, this.handleAuthorizedRequest({
17300
17180
  route: exports.Routes.GET_RUN_CASHOUT,
17301
17181
  extractor: runs_consts_1.runCashoutExtractor,
17302
17182
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to get run cashout'),
@@ -17316,7 +17196,7 @@ var RunsService = /** @class */ (function () {
17316
17196
  var response;
17317
17197
  return __generator(this, function (_c) {
17318
17198
  switch (_c.label) {
17319
- case 0: return [4 /*yield*/, this.service.handleAuthorizedRequest({
17199
+ case 0: return [4 /*yield*/, this.handleAuthorizedRequest({
17320
17200
  route: exports.Routes.ASSIGN_DRIVER,
17321
17201
  extractor: runs_consts_1.defaultExtractor,
17322
17202
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to assign driver to run'),
@@ -17337,7 +17217,7 @@ var RunsService = /** @class */ (function () {
17337
17217
  var response;
17338
17218
  return __generator(this, function (_c) {
17339
17219
  switch (_c.label) {
17340
- case 0: return [4 /*yield*/, this.service.handleAuthorizedRequest({
17220
+ case 0: return [4 /*yield*/, this.handleAuthorizedRequest({
17341
17221
  route: exports.Routes.UNASSIGN_DRIVER,
17342
17222
  extractor: runs_consts_1.defaultExtractor,
17343
17223
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to assign driver to run'),
@@ -17358,7 +17238,7 @@ var RunsService = /** @class */ (function () {
17358
17238
  var response;
17359
17239
  return __generator(this, function (_c) {
17360
17240
  switch (_c.label) {
17361
- case 0: return [4 /*yield*/, this.service.handleAuthorizedRequest({
17241
+ case 0: return [4 /*yield*/, this.handleAuthorizedRequest({
17362
17242
  route: exports.Routes.ASSIGN_VEHICLES,
17363
17243
  extractor: runs_consts_1.defaultExtractor,
17364
17244
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to assign vehicles to run'),
@@ -17379,7 +17259,7 @@ var RunsService = /** @class */ (function () {
17379
17259
  var response;
17380
17260
  return __generator(this, function (_c) {
17381
17261
  switch (_c.label) {
17382
- case 0: return [4 /*yield*/, this.service.handleAuthorizedRequest({
17262
+ case 0: return [4 /*yield*/, this.handleAuthorizedRequest({
17383
17263
  route: exports.Routes.UNASSIGN_VEHICLES,
17384
17264
  extractor: runs_consts_1.defaultExtractor,
17385
17265
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to unassign vehicles from run'),
@@ -17400,7 +17280,7 @@ var RunsService = /** @class */ (function () {
17400
17280
  var runBulkClose;
17401
17281
  return __generator(this, function (_c) {
17402
17282
  switch (_c.label) {
17403
- case 0: return [4 /*yield*/, this.service.handleAuthorizedRequest({
17283
+ case 0: return [4 /*yield*/, this.handleAuthorizedRequest({
17404
17284
  route: exports.Routes.BULK_CLOSE,
17405
17285
  extractor: runs_consts_1.defaultExtractor,
17406
17286
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to bulk close runs'),
@@ -17420,7 +17300,7 @@ var RunsService = /** @class */ (function () {
17420
17300
  var markDonePlanning;
17421
17301
  return __generator(this, function (_c) {
17422
17302
  switch (_c.label) {
17423
- case 0: return [4 /*yield*/, this.service.handleAuthorizedRequest({
17303
+ case 0: return [4 /*yield*/, this.handleAuthorizedRequest({
17424
17304
  route: exports.Routes.MARK_DONE_PLANNING,
17425
17305
  extractor: runs_consts_1.defaultExtractor,
17426
17306
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to mark done planning for runs'),
@@ -17440,7 +17320,7 @@ var RunsService = /** @class */ (function () {
17440
17320
  var actualBreaksByRunIdResponse;
17441
17321
  return __generator(this, function (_c) {
17442
17322
  switch (_c.label) {
17443
- case 0: return [4 /*yield*/, this.service.handleAuthorizedRequest({
17323
+ case 0: return [4 /*yield*/, this.handleAuthorizedRequest({
17444
17324
  route: exports.Routes.GET_ACTUAL_BREAKS,
17445
17325
  extractor: runs_consts_1.defaultExtractor,
17446
17326
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to get actual breaks of runs'),
@@ -17457,7 +17337,7 @@ var RunsService = /** @class */ (function () {
17457
17337
  });
17458
17338
  };
17459
17339
  return RunsService;
17460
- }());
17340
+ }(SessionBasedService_1.SessionBasedService));
17461
17341
  exports.RunsService = RunsService;
17462
17342
  //# sourceMappingURL=runs.service.js.map
17463
17343
 
@@ -17508,6 +17388,7 @@ var RunStore = /** @class */ (function (_super) {
17508
17388
  _this.updateRun = function (payload) {
17509
17389
  return _this.createOrUpdateRun(payload, _this.onUpdate.bind(_this));
17510
17390
  };
17391
+ // eslint-disable-next-line @typescript-eslint/ban-types
17511
17392
  _this.createOrUpdateRun = function (payload, callback) {
17512
17393
  var existingRunModel = _this.store.getItem(payload.run.id);
17513
17394
  var updatedRunModel = { id: payload.run.id, run: payload.run, taskIds: undefined };
@@ -17643,7 +17524,7 @@ exports["default"] = RunStore;
17643
17524
  "use strict";
17644
17525
 
17645
17526
  Object.defineProperty(exports, "__esModule", ({ value: true }));
17646
- exports.GetAllChunkSize = exports.defaultExtractor = exports.runCashoutExtractor = exports.runsLocationsExtractor = exports.runsHistoryExtractor = exports.runExtractor = exports.RunGroupTypes = exports.RunEvents = exports.RunStatus = void 0;
17527
+ exports.GetAllChunkSize = exports.defaultExtractor = exports.runCashoutExtractor = exports.runsLocationsExtractor = exports.runsHistoryExtractor = exports.runExtractor = exports.RunEvents = exports.RunStatus = void 0;
17647
17528
  var RunStatus;
17648
17529
  (function (RunStatus) {
17649
17530
  RunStatus["ALL"] = "all";
@@ -17656,10 +17537,6 @@ var RunEvents;
17656
17537
  RunEvents["DELETED"] = "run deleted";
17657
17538
  RunEvents["CREATED"] = "run created";
17658
17539
  })(RunEvents = exports.RunEvents || (exports.RunEvents = {}));
17659
- var RunGroupTypes;
17660
- (function (RunGroupTypes) {
17661
- RunGroupTypes["TaskIds"] = "taskIds";
17662
- })(RunGroupTypes = exports.RunGroupTypes || (exports.RunGroupTypes = {}));
17663
17540
  var runExtractor = function (response) { return response.run; };
17664
17541
  exports.runExtractor = runExtractor;
17665
17542
  var runsHistoryExtractor = function (response) { return response; };
@@ -17807,7 +17684,7 @@ var Runs = /** @class */ (function () {
17807
17684
  var run;
17808
17685
  return __generator(this, function (_a) {
17809
17686
  switch (_a.label) {
17810
- case 0: return [4 /*yield*/, this.runsService.load(id, commonOptions)];
17687
+ case 0: return [4 /*yield*/, this.runsService.get(id, commonOptions)];
17811
17688
  case 1:
17812
17689
  run = _a.sent();
17813
17690
  return [2 /*return*/, this.runStore.set(run)];
@@ -17820,7 +17697,7 @@ var Runs = /** @class */ (function () {
17820
17697
  return __awaiter(this, void 0, void 0, function () {
17821
17698
  return __generator(this, function (_a) {
17822
17699
  switch (_a.label) {
17823
- case 0: return [4 /*yield*/, this.runsService.load(id, commonOptions)];
17700
+ case 0: return [4 /*yield*/, this.runsService.get(id, commonOptions)];
17824
17701
  case 1: return [2 /*return*/, _a.sent()];
17825
17702
  }
17826
17703
  });
@@ -17965,165 +17842,6 @@ exports["default"] = Runs;
17965
17842
 
17966
17843
  /***/ }),
17967
17844
 
17968
- /***/ 30196:
17969
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
17970
-
17971
- "use strict";
17972
-
17973
- var __read = (this && this.__read) || function (o, n) {
17974
- var m = typeof Symbol === "function" && o[Symbol.iterator];
17975
- if (!m) return o;
17976
- var i = m.call(o), r, ar = [], e;
17977
- try {
17978
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
17979
- }
17980
- catch (error) { e = { error: error }; }
17981
- finally {
17982
- try {
17983
- if (r && !r.done && (m = i["return"])) m.call(i);
17984
- }
17985
- finally { if (e) throw e.error; }
17986
- }
17987
- return ar;
17988
- };
17989
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
17990
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
17991
- if (ar || !(i in from)) {
17992
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17993
- ar[i] = from[i];
17994
- }
17995
- }
17996
- return to.concat(ar || Array.prototype.slice.call(from));
17997
- };
17998
- Object.defineProperty(exports, "__esModule", ({ value: true }));
17999
- var storable_realtime_subscriptions_1 = __webpack_require__(1227);
18000
- var Tasks_consts_1 = __webpack_require__(24976);
18001
- var runs_consts_1 = __webpack_require__(4669);
18002
- var RunRealtimeSubscriptions = /** @class */ (function () {
18003
- function RunRealtimeSubscriptions(session, runsStore, storableDataService) {
18004
- var _this = this;
18005
- this.runsStore = runsStore;
18006
- this.storableDataService = storableDataService;
18007
- this.updateTaskIdsOnDelete = function (task) {
18008
- var existingRun = _this.runsStore.get(task.run_id);
18009
- if (!existingRun) {
18010
- return;
18011
- }
18012
- var updatedTaskIds = new Set(existingRun.task_ids);
18013
- updatedTaskIds.delete(task.id);
18014
- _this.updateRunInStore(existingRun, updatedTaskIds);
18015
- };
18016
- this.storableRealtimeSubscriptions = new storable_realtime_subscriptions_1.default(session, runsStore, storableDataService);
18017
- this.taskIdsWaitingForRun = new Map();
18018
- }
18019
- RunRealtimeSubscriptions.prototype.updateStoreOnEvents = function () {
18020
- var runExtractor = function (_a) {
18021
- var run = _a.run;
18022
- return run;
18023
- };
18024
- this.storableRealtimeSubscriptions.updateStoreOnEvents([
18025
- {
18026
- name: runs_consts_1.RunEvents.CREATED,
18027
- isDelete: false,
18028
- extraDataFunc: this.addTaskIdsOnCreateOrUpdate.bind(this),
18029
- itemExtractor: runExtractor
18030
- },
18031
- {
18032
- name: runs_consts_1.RunEvents.UPDATED,
18033
- isDelete: false,
18034
- extraDataFunc: this.addTaskIdsOnCreateOrUpdate.bind(this),
18035
- itemExtractor: runExtractor
18036
- },
18037
- { name: runs_consts_1.RunEvents.DELETED, isDelete: true }
18038
- ]);
18039
- this.storableRealtimeSubscriptions.onAnyEvent(Tasks_consts_1.TaskRealTimeEvents.TASK_DELETED, this.updateTaskIdsOnDelete.bind(this));
18040
- this.storableRealtimeSubscriptions.onAnyEvent(Tasks_consts_1.TaskRealTimeEvents.TASK_UPDATE, this.updateTaskIds.bind(this));
18041
- this.storableRealtimeSubscriptions.onAnyEvent(Tasks_consts_1.TaskRealTimeEvents.NEW_TASK, this.updateTaskIds.bind(this));
18042
- };
18043
- RunRealtimeSubscriptions.prototype.onUpdate = function (callback) {
18044
- return this.storableRealtimeSubscriptions.onEvent(runs_consts_1.RunEvents.UPDATED, callback);
18045
- };
18046
- RunRealtimeSubscriptions.prototype.onDelete = function (callback) {
18047
- return this.storableRealtimeSubscriptions.onEvent(runs_consts_1.RunEvents.DELETED, callback);
18048
- };
18049
- RunRealtimeSubscriptions.prototype.onCreate = function (callback) {
18050
- return this.storableRealtimeSubscriptions.onEvent(runs_consts_1.RunEvents.CREATED, callback);
18051
- };
18052
- RunRealtimeSubscriptions.prototype.addTaskIdsOnCreateOrUpdate = function (run) {
18053
- if (run.task_ids || run.tasks) {
18054
- return;
18055
- }
18056
- var existingRun = this.runsStore.get(run.id);
18057
- var taskIdsWaitingForRun = this.taskIdsWaitingForRun.get(run.id) || new Set();
18058
- var taskIds = existingRun
18059
- ? Array.from(new Set(__spreadArray(__spreadArray([], __read(existingRun.task_ids), false), __read(taskIdsWaitingForRun), false)))
18060
- : Array.from(taskIdsWaitingForRun);
18061
- this.taskIdsWaitingForRun.delete(run.id);
18062
- return { params: { taskIds: taskIds } };
18063
- };
18064
- RunRealtimeSubscriptions.prototype.updateTaskIds = function (task) {
18065
- var existingRun = this.runsStore.getGroup(runs_consts_1.RunGroupTypes.TaskIds, task.id)[0];
18066
- if (task.run_id) {
18067
- var newRun = this.runsStore.get(task.run_id);
18068
- if (!newRun) {
18069
- this.backupTasksUntilRunIsCreated(task);
18070
- }
18071
- else if (this.taskAddedToRun(task, newRun)) {
18072
- var updatedTaskIds = new Set(newRun.task_ids);
18073
- updatedTaskIds.add(task.id);
18074
- this.updateRunInStore(newRun, updatedTaskIds);
18075
- }
18076
- }
18077
- else if (this.taskRemovedFromRun(task, existingRun)) {
18078
- var updatedTaskIds = new Set(existingRun.task_ids);
18079
- updatedTaskIds.delete(task.id);
18080
- this.updateRunInStore(existingRun, updatedTaskIds);
18081
- }
18082
- this.updatePreviousRun(task, existingRun === null || existingRun === void 0 ? void 0 : existingRun.id);
18083
- };
18084
- RunRealtimeSubscriptions.prototype.updatePreviousRun = function (task, previousRunId) {
18085
- if (previousRunId && previousRunId != task.run_id) {
18086
- if (this.taskIdsWaitingForRun.has(previousRunId)) {
18087
- this.taskIdsWaitingForRun.get(previousRunId).delete(task.id);
18088
- }
18089
- var previousRunOfTask = this.runsStore.get(previousRunId);
18090
- if (previousRunOfTask) {
18091
- var updatedTaskIds = new Set(previousRunOfTask.task_ids);
18092
- updatedTaskIds.delete(task.id);
18093
- this.updateRunInStore(previousRunOfTask, updatedTaskIds);
18094
- }
18095
- }
18096
- };
18097
- RunRealtimeSubscriptions.prototype.updateRunInStore = function (newRun, taskIds) {
18098
- var mappedItem = this.storableDataService.updateInStores(newRun, undefined, undefined, {
18099
- taskIds: Array.from(taskIds)
18100
- });
18101
- this.storableRealtimeSubscriptions.runEventCallbacks(runs_consts_1.RunEvents.UPDATED, mappedItem);
18102
- };
18103
- RunRealtimeSubscriptions.prototype.taskRemovedFromRun = function (task, existingRun) {
18104
- var _a;
18105
- return !task.run_id && ((_a = existingRun === null || existingRun === void 0 ? void 0 : existingRun.task_ids) === null || _a === void 0 ? void 0 : _a.includes(task.id));
18106
- };
18107
- RunRealtimeSubscriptions.prototype.taskAddedToRun = function (task, existingRun) {
18108
- var _a;
18109
- return task.run_id && !((_a = existingRun.task_ids) === null || _a === void 0 ? void 0 : _a.includes(task.id));
18110
- };
18111
- RunRealtimeSubscriptions.prototype.backupTasksUntilRunIsCreated = function (task) {
18112
- if (!task.run_id) {
18113
- return;
18114
- }
18115
- if (!this.taskIdsWaitingForRun.has(task.run_id)) {
18116
- this.taskIdsWaitingForRun.set(task.run_id, new Set());
18117
- }
18118
- this.taskIdsWaitingForRun.get(task.run_id).add(task.id);
18119
- };
18120
- return RunRealtimeSubscriptions;
18121
- }());
18122
- exports["default"] = RunRealtimeSubscriptions;
18123
- //# sourceMappingURL=run-realtime-subscriptions.js.map
18124
-
18125
- /***/ }),
18126
-
18127
17845
  /***/ 83582:
18128
17846
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
18129
17847
 
@@ -18177,215 +17895,65 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
18177
17895
  }
18178
17896
  };
18179
17897
  Object.defineProperty(exports, "__esModule", ({ value: true }));
18180
- var BringgDashboardSDK_1 = __webpack_require__(5655);
18181
- var data_entity_1 = __webpack_require__(91083);
18182
17898
  var data_store_1 = __webpack_require__(73135);
18183
- var storable_data_service_1 = __webpack_require__(45297);
17899
+ var realtime_subscriptions_1 = __webpack_require__(47985);
18184
17900
  var runs_consts_1 = __webpack_require__(4669);
18185
17901
  var runs_service_1 = __webpack_require__(34075);
18186
- var run_realtime_subscriptions_1 = __webpack_require__(30196);
18187
17902
  var RunsApi = /** @class */ (function () {
18188
17903
  function RunsApi(session) {
18189
17904
  var _this = this;
18190
- this.onUpdate = function (callback) {
18191
- return _this.realtimeSubscriptions.onUpdate(callback);
17905
+ this.createOrUpdateRun = function (payload) {
17906
+ _this.runsStore.set(payload.run);
18192
17907
  };
18193
- this.onDelete = function (callback) {
18194
- return _this.realtimeSubscriptions.onDelete(callback);
18195
- };
18196
- this.onCreate = function (callback) {
18197
- return _this.realtimeSubscriptions.onCreate(callback);
17908
+ this.deleteRun = function (payload) {
17909
+ _this.runsStore.remove(payload.id);
18198
17910
  };
18199
- this.runsStore = new data_store_1.default([
18200
- {
18201
- groupType: runs_consts_1.RunGroupTypes.TaskIds,
18202
- keyFunc: function (runModel) { return runModel.task_ids; }
18203
- }
18204
- ]);
17911
+ this.runsStore = new data_store_1.default();
18205
17912
  this.runsService = new runs_service_1.RunsService(session);
18206
- var mapper = function (run, params) {
18207
- var existing = _this.runsStore.get(run.id);
18208
- var taskIds;
18209
- if (params.taskIds || run.task_ids || run.tasks) {
18210
- taskIds = params.taskIds || run.task_ids || run.tasks.map(function (task) { return task.id; });
18211
- }
18212
- if (existing) {
18213
- var previous = (0, BringgDashboardSDK_1.getGlobals)().mobx.toJS(existing);
18214
- run.task_ids = taskIds || existing.task_ids;
18215
- return { current: run, previous: previous };
18216
- }
18217
- else {
18218
- run.task_ids = taskIds || [];
18219
- return { current: run };
18220
- }
18221
- };
18222
- this.storableDataService = new storable_data_service_1.default(this.runsStore, mapper);
18223
- this.realtimeSubscriptions = new run_realtime_subscriptions_1.default(session, this.runsStore, this.storableDataService);
17913
+ this.realtimeSubscriptions = new realtime_subscriptions_1.default(session);
17914
+ this.realtimeSubscriptions.subscribe(runs_consts_1.RunEvents.CREATED, this.createOrUpdateRun);
17915
+ this.realtimeSubscriptions.subscribe(runs_consts_1.RunEvents.UPDATED, this.createOrUpdateRun);
17916
+ this.realtimeSubscriptions.subscribe(runs_consts_1.RunEvents.DELETED, this.deleteRun);
18224
17917
  }
18225
- RunsApi.prototype.updateStoreOnEvents = function () {
18226
- this.realtimeSubscriptions.updateStoreOnEvents();
18227
- };
18228
- RunsApi.prototype.get = function (id) {
18229
- return this.runsStore.get(id);
18230
- };
18231
17918
  RunsApi.prototype.getAll = function () {
18232
17919
  return this.runsStore.getAll();
18233
17920
  };
18234
- RunsApi.prototype.getAllMap = function () {
18235
- return this.runsStore.getAllById();
18236
- };
18237
17921
  RunsApi.prototype.getByIds = function (ids) {
18238
17922
  var _this = this;
18239
- return ids.map(function (runId) { return _this.runsStore.get(runId); }).filter(Boolean);
18240
- };
18241
- RunsApi.prototype.add = function (run) {
18242
- return this.storableDataService.updateInStores(run);
18243
- };
18244
- RunsApi.prototype.remove = function (id) {
18245
- return this.storableDataService.removeFromStores(id);
18246
- };
18247
- RunsApi.prototype.loadMany = function (queryParams, options, commonOptions) {
18248
- if (options === void 0) { options = data_entity_1.DEFAULT_OPTIONS; }
18249
- if (commonOptions === void 0) { commonOptions = {}; }
18250
- return __awaiter(this, void 0, void 0, function () {
18251
- var _this = this;
18252
- return __generator(this, function (_a) {
18253
- return [2 /*return*/, this.storableDataService.loadMany('loadMany', function (idsToLoad) {
18254
- return _this.runsService.loadAll(__assign(__assign({}, options), { ids: idsToLoad }), commonOptions);
18255
- }, queryParams.ids, options)];
18256
- });
18257
- });
18258
- };
18259
- RunsApi.prototype.loadRunsData = function (payload, commonOptions) {
18260
- if (commonOptions === void 0) { commonOptions = {}; }
18261
- return __awaiter(this, void 0, void 0, function () {
18262
- return __generator(this, function (_a) {
18263
- switch (_a.label) {
18264
- case 0: return [4 /*yield*/, this.runsService.loadRunsData(payload, commonOptions)];
18265
- case 1: return [2 /*return*/, _a.sent()];
18266
- }
18267
- });
18268
- });
18269
- };
18270
- RunsApi.prototype.load = function (id, options) {
18271
- var _this = this;
18272
- if (options === void 0) { options = data_entity_1.DEFAULT_OPTIONS; }
18273
- return this.storableDataService.load('load', function () { return _this.runsService.load(id); }, id, options);
17923
+ return ids.map(function (runId) { return _this.runsStore.get(runId); });
18274
17924
  };
18275
- RunsApi.prototype.update = function (id, options, commonOptions) {
17925
+ RunsApi.prototype.loadAll = function (options, commonOptions) {
18276
17926
  if (commonOptions === void 0) { commonOptions = {}; }
18277
17927
  return __awaiter(this, void 0, void 0, function () {
17928
+ var idsToFetch, runs_1, runs;
18278
17929
  var _this = this;
18279
- return __generator(this, function (_a) {
18280
- return [2 /*return*/, this.storableDataService.modify('update', function () { return _this.runsService.update(id, options, commonOptions); })];
18281
- });
18282
- });
18283
- };
18284
- RunsApi.prototype.getHistory = function (id, commonOptions) {
18285
- if (commonOptions === void 0) { commonOptions = {}; }
18286
- return __awaiter(this, void 0, void 0, function () {
18287
- return __generator(this, function (_a) {
18288
- switch (_a.label) {
18289
- case 0: return [4 /*yield*/, this.runsService.getHistory(id, commonOptions)];
18290
- case 1: return [2 /*return*/, _a.sent()];
18291
- }
18292
- });
18293
- });
18294
- };
18295
- RunsApi.prototype.getLocations = function (id, commonOptions) {
18296
- if (commonOptions === void 0) { commonOptions = {}; }
18297
- return __awaiter(this, void 0, void 0, function () {
18298
- return __generator(this, function (_a) {
18299
- switch (_a.label) {
18300
- case 0: return [4 /*yield*/, this.runsService.getLocations(id, commonOptions)];
18301
- case 1: return [2 /*return*/, _a.sent()];
18302
- }
18303
- });
18304
- });
18305
- };
18306
- RunsApi.prototype.getCashout = function (id, commonOptions) {
18307
- if (commonOptions === void 0) { commonOptions = {}; }
18308
- return __awaiter(this, void 0, void 0, function () {
18309
- return __generator(this, function (_a) {
18310
- switch (_a.label) {
18311
- case 0: return [4 /*yield*/, this.runsService.getCashout(id, commonOptions)];
18312
- case 1: return [2 /*return*/, _a.sent()];
18313
- }
18314
- });
18315
- });
18316
- };
18317
- RunsApi.prototype.assignDriver = function (id, userId, targetRun, commonOptions) {
18318
- if (commonOptions === void 0) { commonOptions = {}; }
18319
- return __awaiter(this, void 0, void 0, function () {
18320
- return __generator(this, function (_a) {
18321
- switch (_a.label) {
18322
- case 0: return [4 /*yield*/, this.runsService.assignDriver(id, userId, targetRun, commonOptions)];
18323
- case 1: return [2 /*return*/, _a.sent()];
18324
- }
18325
- });
18326
- });
18327
- };
18328
- RunsApi.prototype.unassignDriver = function (id, userId, commonOptions) {
18329
- if (commonOptions === void 0) { commonOptions = {}; }
18330
- return __awaiter(this, void 0, void 0, function () {
18331
- return __generator(this, function (_a) {
18332
- switch (_a.label) {
18333
- case 0: return [4 /*yield*/, this.runsService.unassignDriver(id, userId, commonOptions)];
18334
- case 1: return [2 /*return*/, _a.sent()];
18335
- }
18336
- });
18337
- });
18338
- };
18339
- RunsApi.prototype.assignVehicles = function (id, vehicleId, tasks, commonOptions) {
18340
- if (commonOptions === void 0) { commonOptions = {}; }
18341
- return __awaiter(this, void 0, void 0, function () {
18342
- return __generator(this, function (_a) {
18343
- switch (_a.label) {
18344
- case 0: return [4 /*yield*/, this.runsService.assignVehicles(id, vehicleId, tasks, commonOptions)];
18345
- case 1: return [2 /*return*/, _a.sent()];
18346
- }
18347
- });
18348
- });
18349
- };
18350
- RunsApi.prototype.unassignVehicles = function (id, commonOptions) {
18351
- if (commonOptions === void 0) { commonOptions = {}; }
18352
- return __awaiter(this, void 0, void 0, function () {
18353
- return __generator(this, function (_a) {
18354
- switch (_a.label) {
18355
- case 0: return [4 /*yield*/, this.runsService.unassignVehicles(id, commonOptions)];
18356
- case 1: return [2 /*return*/, _a.sent()];
18357
- }
18358
- });
18359
- });
18360
- };
18361
- RunsApi.prototype.bulkClose = function (runIds, commonOptions) {
18362
- if (commonOptions === void 0) { commonOptions = {}; }
18363
- return __awaiter(this, void 0, void 0, function () {
18364
- return __generator(this, function (_a) {
18365
- switch (_a.label) {
18366
- case 0: return [4 /*yield*/, this.runsService.bulkClose(runIds, commonOptions)];
18367
- case 1: return [2 /*return*/, _a.sent()];
18368
- }
18369
- });
18370
- });
18371
- };
18372
- RunsApi.prototype.markDonePlanning = function (runIds, commonOptions) {
18373
- if (commonOptions === void 0) { commonOptions = {}; }
18374
- return __awaiter(this, void 0, void 0, function () {
18375
17930
  return __generator(this, function (_a) {
18376
17931
  switch (_a.label) {
18377
- case 0: return [4 /*yield*/, this.runsService.markDonePlanning(runIds, commonOptions)];
18378
- case 1: return [2 /*return*/, _a.sent()];
17932
+ case 0:
17933
+ if (!options.ids) return [3 /*break*/, 3];
17934
+ idsToFetch = options.ids.filter(function (id) { return !_this.runsStore.get(id); });
17935
+ if (!idsToFetch.length) return [3 /*break*/, 2];
17936
+ return [4 /*yield*/, this.runsService.loadAll(__assign(__assign({}, options), { ids: idsToFetch }), commonOptions)];
17937
+ case 1:
17938
+ runs_1 = _a.sent();
17939
+ this.runsStore.setMany(runs_1.map(function (run) { return ({ current: run }); }));
17940
+ _a.label = 2;
17941
+ case 2: return [2 /*return*/, this.getByIds(options.ids)];
17942
+ case 3: return [4 /*yield*/, this.runsService.loadAll(options, commonOptions)];
17943
+ case 4:
17944
+ runs = _a.sent();
17945
+ this.runsStore.setAll(runs.map(function (run) { return ({ current: run }); }));
17946
+ return [2 /*return*/, runs];
18379
17947
  }
18380
17948
  });
18381
17949
  });
18382
17950
  };
18383
- RunsApi.prototype.getActualBreaks = function (runIds, commonOptions) {
17951
+ RunsApi.prototype.loadRunsData = function (payload, commonOptions) {
18384
17952
  if (commonOptions === void 0) { commonOptions = {}; }
18385
17953
  return __awaiter(this, void 0, void 0, function () {
18386
17954
  return __generator(this, function (_a) {
18387
17955
  switch (_a.label) {
18388
- case 0: return [4 /*yield*/, this.runsService.getActualBreaks(runIds, commonOptions)];
17956
+ case 0: return [4 /*yield*/, this.runsService.loadRunsData(payload, commonOptions)];
18389
17957
  case 1: return [2 /*return*/, _a.sent()];
18390
17958
  }
18391
17959
  });
@@ -20654,7 +20222,7 @@ var lodash_1 = __webpack_require__(96486);
20654
20222
  var BringgException_1 = __webpack_require__(43605);
20655
20223
  var Logger_1 = __webpack_require__(55860);
20656
20224
  var abort_1 = __webpack_require__(34179);
20657
- var version = '8.20.0-pre.2';
20225
+ var version = '8.21.0-pre';
20658
20226
  function logErrorResponse(response) {
20659
20227
  var data = response.data, status = response.status;
20660
20228
  try {
@@ -22937,90 +22505,151 @@ exports.Routes = {
22937
22505
  /***/ }),
22938
22506
 
22939
22507
  /***/ 52131:
22940
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
22508
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
22941
22509
 
22942
22510
  "use strict";
22943
22511
 
22512
+ var __values = (this && this.__values) || function(o) {
22513
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
22514
+ if (m) return m.call(o);
22515
+ if (o && typeof o.length === "number") return {
22516
+ next: function () {
22517
+ if (o && i >= o.length) o = void 0;
22518
+ return { value: o && o[i++], done: !o };
22519
+ }
22520
+ };
22521
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
22522
+ };
22944
22523
  Object.defineProperty(exports, "__esModule", ({ value: true }));
22945
- var storable_realtime_subscriptions_1 = __webpack_require__(1227);
22524
+ var object_merger_1 = __webpack_require__(7262);
22525
+ var realtime_subscriptions_1 = __webpack_require__(47985);
22946
22526
  var Tasks_consts_1 = __webpack_require__(24976);
22947
22527
  var TaskRealtimeSubscriptions = /** @class */ (function () {
22948
22528
  function TaskRealtimeSubscriptions(session, tasksStore, storableDataService) {
22529
+ this.realtimeSubscriptions = new realtime_subscriptions_1.default(session);
22949
22530
  this.tasksStore = tasksStore;
22950
- this.storableRealtimeSubscriptions = new storable_realtime_subscriptions_1.default(session, tasksStore, storableDataService);
22531
+ this.storableDataService = storableDataService;
22532
+ this.eventCallbacks = {};
22951
22533
  }
22952
22534
  TaskRealtimeSubscriptions.prototype.updateStoreOnEvents = function () {
22953
22535
  var _this = this;
22954
- var events = [
22955
- {
22956
- name: Tasks_consts_1.TaskRealTimeEvents.TASK_UPDATE,
22957
- isDelete: false,
22958
- extraDataFunc: function (task) {
22959
- var isPartialUpdate = !task.hasOwnProperty('status');
22960
- return { ignore: isPartialUpdate && !_this.tasksStore.get(task.id) };
22961
- }
22962
- },
22963
- { name: Tasks_consts_1.TaskRealTimeEvents.NEW_TASK, isDelete: false },
22964
- { name: Tasks_consts_1.TaskRealTimeEvents.TASK_DELETED, isDelete: true }
22965
- ];
22966
- var subEntityEvents = [
22967
- {
22968
- name: Tasks_consts_1.TaskRealTimeEvents.NEW_SCAN,
22969
- eventToRaise: Tasks_consts_1.TaskRealTimeEvents.TASK_UPDATE,
22970
- parentField: 'task_id',
22971
- field: 'scans',
22972
- ignoreFields: ['way_points'],
22973
- isDelete: false
22974
- },
22975
- {
22976
- name: Tasks_consts_1.TaskRealTimeEvents.NEW_NOTE,
22977
- eventToRaise: Tasks_consts_1.TaskRealTimeEvents.TASK_UPDATE,
22978
- parentField: 'task_id',
22979
- field: 'task_notes',
22980
- ignoreFields: ['way_points'],
22981
- isDelete: false
22982
- },
22983
- {
22984
- name: Tasks_consts_1.TaskRealTimeEvents.WAYPOINT_ADDED,
22985
- eventToRaise: Tasks_consts_1.TaskRealTimeEvents.TASK_UPDATE,
22986
- parentField: 'task_id',
22987
- field: 'way_points',
22988
- ignoreFields: ['way_points'],
22989
- isDelete: false
22990
- },
22991
- {
22992
- name: Tasks_consts_1.TaskRealTimeEvents.WAYPOINT_UPDATED,
22993
- eventToRaise: Tasks_consts_1.TaskRealTimeEvents.TASK_UPDATE,
22994
- parentField: 'task_id',
22995
- field: 'way_points',
22996
- ignoreFields: ['way_points'],
22997
- isDelete: false
22998
- },
22999
- {
23000
- name: Tasks_consts_1.TaskRealTimeEvents.WAYPOINT_DELETED,
23001
- eventToRaise: Tasks_consts_1.TaskRealTimeEvents.TASK_UPDATE,
23002
- parentField: 'task_id',
23003
- field: 'way_points',
23004
- ignoreFields: ['way_points'],
23005
- isDelete: true
22536
+ var ignoreFields = ['way_points'];
22537
+ this.realtimeSubscriptions.subscribe(Tasks_consts_1.TaskRealTimeEvents.TASK_UPDATE, function (task) {
22538
+ var isPartialUpdate = !task.hasOwnProperty('status');
22539
+ if (isPartialUpdate && !_this.tasksStore.get(task.id)) {
22540
+ return;
23006
22541
  }
23007
- ];
23008
- this.storableRealtimeSubscriptions.updateStoreOnEvents(events, subEntityEvents);
22542
+ var mappedStorableItem = _this.storableDataService.updateInStores(task);
22543
+ _this.runEventCallbacks(Tasks_consts_1.TaskRealTimeEvents.TASK_UPDATE, mappedStorableItem);
22544
+ });
22545
+ this.realtimeSubscriptions.subscribe(Tasks_consts_1.TaskRealTimeEvents.NEW_TASK, function (task) {
22546
+ var mappedStorableItem = _this.storableDataService.updateInStores(task);
22547
+ _this.runEventCallbacks(Tasks_consts_1.TaskRealTimeEvents.NEW_TASK, mappedStorableItem);
22548
+ });
22549
+ this.realtimeSubscriptions.subscribe(Tasks_consts_1.TaskRealTimeEvents.TASK_DELETED, function (task) {
22550
+ var deletedTasks = _this.storableDataService.removeFromStores(task.id);
22551
+ _this.runEventCallbacks(Tasks_consts_1.TaskRealTimeEvents.TASK_DELETED, { diff: deletedTasks });
22552
+ });
22553
+ [
22554
+ { event: Tasks_consts_1.TaskRealTimeEvents.NEW_SCAN, field: 'scans', isDelete: false },
22555
+ { event: Tasks_consts_1.TaskRealTimeEvents.NEW_NOTE, field: 'task_notes', isDelete: false },
22556
+ { event: Tasks_consts_1.TaskRealTimeEvents.WAYPOINT_ADDED, field: 'way_points', isDelete: false },
22557
+ { event: Tasks_consts_1.TaskRealTimeEvents.WAYPOINT_UPDATED, field: 'way_points', isDelete: false },
22558
+ { event: Tasks_consts_1.TaskRealTimeEvents.WAYPOINT_DELETED, field: 'way_points', isDelete: true }
22559
+ ].forEach(function (eventData) {
22560
+ _this.realtimeSubscriptions.subscribe(eventData.event, function (subEntity) {
22561
+ ignoreFields.forEach(function (field) { return delete subEntity[field]; });
22562
+ var eventChangeData = _this.changeSubEntity(subEntity, eventData.field, eventData.isDelete);
22563
+ if (eventChangeData.current) {
22564
+ _this.runEventCallbacks(Tasks_consts_1.TaskRealTimeEvents.TASK_UPDATE, eventChangeData);
22565
+ }
22566
+ });
22567
+ });
23009
22568
  };
23010
22569
  TaskRealtimeSubscriptions.prototype.onCreate = function (callback) {
23011
- return this.storableRealtimeSubscriptions.onEvent(Tasks_consts_1.TaskRealTimeEvents.NEW_TASK, callback);
22570
+ return this.onEvent(Tasks_consts_1.TaskRealTimeEvents.NEW_TASK, callback);
23012
22571
  };
23013
22572
  TaskRealtimeSubscriptions.prototype.onDelete = function (callback) {
23014
- return this.storableRealtimeSubscriptions.onEvent(Tasks_consts_1.TaskRealTimeEvents.TASK_DELETED, callback);
22573
+ return this.onEvent(Tasks_consts_1.TaskRealTimeEvents.TASK_DELETED, callback);
23015
22574
  };
23016
22575
  TaskRealtimeSubscriptions.prototype.onWayPointUpdate = function (callback) {
23017
- return this.storableRealtimeSubscriptions.onEvent(Tasks_consts_1.TaskRealTimeEvents.WAYPOINT_UPDATED, callback);
22576
+ return this.onEvent(Tasks_consts_1.TaskRealTimeEvents.WAYPOINT_UPDATED, callback);
23018
22577
  };
23019
22578
  TaskRealtimeSubscriptions.prototype.onWayPointDelete = function (callback) {
23020
- return this.storableRealtimeSubscriptions.onEvent(Tasks_consts_1.TaskRealTimeEvents.WAYPOINT_DELETED, callback);
22579
+ return this.onEvent(Tasks_consts_1.TaskRealTimeEvents.WAYPOINT_DELETED, callback);
23021
22580
  };
23022
22581
  TaskRealtimeSubscriptions.prototype.onUpdate = function (callback) {
23023
- return this.storableRealtimeSubscriptions.onEvent(Tasks_consts_1.TaskRealTimeEvents.TASK_UPDATE, callback);
22582
+ var subscriptions = [];
22583
+ subscriptions.push(this.onEvent(Tasks_consts_1.TaskRealTimeEvents.TASK_UPDATE, callback));
22584
+ return function () {
22585
+ var e_1, _a;
22586
+ try {
22587
+ for (var subscriptions_1 = __values(subscriptions), subscriptions_1_1 = subscriptions_1.next(); !subscriptions_1_1.done; subscriptions_1_1 = subscriptions_1.next()) {
22588
+ var subscription = subscriptions_1_1.value;
22589
+ subscription();
22590
+ }
22591
+ }
22592
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
22593
+ finally {
22594
+ try {
22595
+ if (subscriptions_1_1 && !subscriptions_1_1.done && (_a = subscriptions_1.return)) _a.call(subscriptions_1);
22596
+ }
22597
+ finally { if (e_1) throw e_1.error; }
22598
+ }
22599
+ };
22600
+ };
22601
+ TaskRealtimeSubscriptions.prototype.onEvent = function (event, callback) {
22602
+ var _this = this;
22603
+ if (!this.eventCallbacks[event]) {
22604
+ this.eventCallbacks[event] = [];
22605
+ }
22606
+ this.eventCallbacks[event].push(callback);
22607
+ return function () {
22608
+ var indexOfCallback = _this.eventCallbacks[event].indexOf(callback);
22609
+ _this.eventCallbacks[event].splice(indexOfCallback, 1);
22610
+ };
22611
+ };
22612
+ TaskRealtimeSubscriptions.prototype.runEventCallbacks = function (event, data) {
22613
+ (this.eventCallbacks[event] || []).forEach(function (callback) { return callback(data); });
22614
+ };
22615
+ TaskRealtimeSubscriptions.prototype.changeSubEntity = function (subEntity, containerField, isDelete) {
22616
+ var _a, _b, _c;
22617
+ if (isDelete === void 0) { isDelete = false; }
22618
+ var task = this.tasksStore.get(subEntity.task_id);
22619
+ var diff;
22620
+ if (task) {
22621
+ if (!task[containerField]) {
22622
+ task[containerField] = [];
22623
+ }
22624
+ var existingIndex = task[containerField].findIndex(function (taskSubEntity) { return taskSubEntity.id === subEntity.id; });
22625
+ if (existingIndex > -1) {
22626
+ if (isDelete) {
22627
+ diff = (_a = { id: task.id }, _a[containerField] = this.createArrayOfEmptyObjects(existingIndex), _a);
22628
+ for (var i = existingIndex + 1; i < task[containerField].length; i++) {
22629
+ diff[containerField].push(task[containerField][i]);
22630
+ }
22631
+ task[containerField].splice(existingIndex, 1);
22632
+ }
22633
+ else {
22634
+ var subEntityDiff = object_merger_1.objectMerger.deepMerge(task[containerField][existingIndex], subEntity);
22635
+ diff = (_b = {
22636
+ id: task.id
22637
+ },
22638
+ _b[containerField] = this.createArrayOfEmptyObjects(task[containerField].length),
22639
+ _b);
22640
+ diff[containerField][existingIndex] = subEntityDiff;
22641
+ }
22642
+ }
22643
+ else if (!isDelete) {
22644
+ diff = (_c = { id: task.id }, _c[containerField] = this.createArrayOfEmptyObjects(task[containerField].length), _c);
22645
+ diff[containerField].push(subEntity);
22646
+ task[containerField].push(subEntity);
22647
+ }
22648
+ }
22649
+ return { current: task, diff: diff };
22650
+ };
22651
+ TaskRealtimeSubscriptions.prototype.createArrayOfEmptyObjects = function (length) {
22652
+ return Array.from({ length: length }, function () { return ({}); });
23024
22653
  };
23025
22654
  return TaskRealtimeSubscriptions;
23026
22655
  }());
@@ -24482,6 +24111,136 @@ exports["default"] = TaskRejectReasonsService;
24482
24111
 
24483
24112
  /***/ }),
24484
24113
 
24114
+ /***/ 5880:
24115
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
24116
+
24117
+ "use strict";
24118
+
24119
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
24120
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
24121
+ return new (P || (P = Promise))(function (resolve, reject) {
24122
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
24123
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
24124
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
24125
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24126
+ });
24127
+ };
24128
+ var __generator = (this && this.__generator) || function (thisArg, body) {
24129
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24130
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24131
+ function verb(n) { return function (v) { return step([n, v]); }; }
24132
+ function step(op) {
24133
+ if (f) throw new TypeError("Generator is already executing.");
24134
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
24135
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
24136
+ if (y = 0, t) op = [op[0] & 2, t.value];
24137
+ switch (op[0]) {
24138
+ case 0: case 1: t = op; break;
24139
+ case 4: _.label++; return { value: op[1], done: false };
24140
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24141
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24142
+ default:
24143
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
24144
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
24145
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
24146
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
24147
+ if (t[2]) _.ops.pop();
24148
+ _.trys.pop(); continue;
24149
+ }
24150
+ op = body.call(thisArg, _);
24151
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
24152
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
24153
+ }
24154
+ };
24155
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
24156
+ var CrudService_1 = __webpack_require__(14809);
24157
+ var baseUrl = 'data-query-service';
24158
+ var entityName = 'tasks-explorer';
24159
+ var TasksExplorerService = /** @class */ (function () {
24160
+ function TasksExplorerService(session) {
24161
+ this.service = new CrudService_1.default(session, entityName);
24162
+ }
24163
+ TasksExplorerService.prototype.getAll = function (req, commonOptions) {
24164
+ return __awaiter(this, void 0, void 0, function () {
24165
+ return __generator(this, function (_a) {
24166
+ return [2 /*return*/, this.service.routeGenerator
24167
+ .post("/".concat(baseUrl, "/").concat(entityName))
24168
+ .withPayload(req)
24169
+ .setException("failed to fetch tasks")
24170
+ .withCommonOptions(commonOptions)
24171
+ .invoke()];
24172
+ });
24173
+ });
24174
+ };
24175
+ return TasksExplorerService;
24176
+ }());
24177
+ exports["default"] = TasksExplorerService;
24178
+ //# sourceMappingURL=tasks-explorer-service.js.map
24179
+
24180
+ /***/ }),
24181
+
24182
+ /***/ 66845:
24183
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
24184
+
24185
+ "use strict";
24186
+
24187
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
24188
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
24189
+ return new (P || (P = Promise))(function (resolve, reject) {
24190
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
24191
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
24192
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
24193
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24194
+ });
24195
+ };
24196
+ var __generator = (this && this.__generator) || function (thisArg, body) {
24197
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24198
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24199
+ function verb(n) { return function (v) { return step([n, v]); }; }
24200
+ function step(op) {
24201
+ if (f) throw new TypeError("Generator is already executing.");
24202
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
24203
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
24204
+ if (y = 0, t) op = [op[0] & 2, t.value];
24205
+ switch (op[0]) {
24206
+ case 0: case 1: t = op; break;
24207
+ case 4: _.label++; return { value: op[1], done: false };
24208
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24209
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24210
+ default:
24211
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
24212
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
24213
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
24214
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
24215
+ if (t[2]) _.ops.pop();
24216
+ _.trys.pop(); continue;
24217
+ }
24218
+ op = body.call(thisArg, _);
24219
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
24220
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
24221
+ }
24222
+ };
24223
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
24224
+ var tasks_explorer_service_1 = __webpack_require__(5880);
24225
+ var TasksExplorerApi = /** @class */ (function () {
24226
+ function TasksExplorerApi(session) {
24227
+ this.tasksExplorerService = new tasks_explorer_service_1.default(session);
24228
+ }
24229
+ TasksExplorerApi.prototype.getAll = function (req, commonOptions) {
24230
+ if (commonOptions === void 0) { commonOptions = {}; }
24231
+ return __awaiter(this, void 0, void 0, function () {
24232
+ return __generator(this, function (_a) {
24233
+ return [2 /*return*/, this.tasksExplorerService.getAll(req, commonOptions)];
24234
+ });
24235
+ });
24236
+ };
24237
+ return TasksExplorerApi;
24238
+ }());
24239
+ exports["default"] = TasksExplorerApi;
24240
+ //# sourceMappingURL=tasks-explorer-api.js.map
24241
+
24242
+ /***/ }),
24243
+
24485
24244
  /***/ 29722:
24486
24245
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
24487
24246
 
@@ -27930,8 +27689,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
27930
27689
  }
27931
27690
  };
27932
27691
  Object.defineProperty(exports, "__esModule", ({ value: true }));
27933
- var storable_realtime_subscriptions_1 = __webpack_require__(1227);
27934
27692
  var data_store_1 = __webpack_require__(73135);
27693
+ var realtime_subscriptions_1 = __webpack_require__(47985);
27935
27694
  var storable_data_service_1 = __webpack_require__(45297);
27936
27695
  var Vehicle_consts_1 = __webpack_require__(84010);
27937
27696
  var vehicles_service_1 = __webpack_require__(87386);
@@ -27941,10 +27700,11 @@ var VehiclesApi = /** @class */ (function () {
27941
27700
  { groupType: Vehicle_consts_1.VehicleGroup.Team, keyFunc: function (vehicle) { return vehicle.team_id; } },
27942
27701
  { groupType: Vehicle_consts_1.VehicleGroup.IsTrailer, keyFunc: function (vehicle) { return !!vehicle.is_trailer; } }
27943
27702
  ];
27703
+ this.eventCallbacks = {};
27944
27704
  this.vehiclesStore = new data_store_1.default(groupFilters);
27945
27705
  this.vehiclesService = new vehicles_service_1.default(session);
27946
27706
  this.storableDataService = new storable_data_service_1.default(this.vehiclesStore);
27947
- this.storableRealtimeSubscriptions = new storable_realtime_subscriptions_1.default(session, this.vehiclesStore, this.storableDataService);
27707
+ this.realtimeSubscriptions = new realtime_subscriptions_1.default(session);
27948
27708
  }
27949
27709
  VehiclesApi.prototype.load = function (id, options) {
27950
27710
  var _this = this;
@@ -27971,21 +27731,24 @@ var VehiclesApi = /** @class */ (function () {
27971
27731
  return this.storableDataService.modify('create', function () { return _this.vehiclesService.create(vehicleData); });
27972
27732
  };
27973
27733
  VehiclesApi.prototype.updateStoreOnEvents = function () {
27974
- this.storableRealtimeSubscriptions.updateStoreOnEvents([
27975
- { name: Vehicle_consts_1.REAL_TIME_EVENTS.VEHICLE_UPDATE, isDelete: false },
27976
- { name: Vehicle_consts_1.REAL_TIME_EVENTS.VEHICLE_DELETE, isDelete: true }
27977
- ]);
27734
+ var _this = this;
27735
+ this.realtimeSubscriptions.subscribe(Vehicle_consts_1.REAL_TIME_EVENTS.VEHICLE_UPDATE, function (vehicle) {
27736
+ _this.storableDataService.updateInStores(vehicle);
27737
+ _this.runEventCallbacks(Vehicle_consts_1.REAL_TIME_EVENTS.VEHICLE_UPDATE, vehicle);
27738
+ });
27739
+ this.realtimeSubscriptions.subscribe(Vehicle_consts_1.REAL_TIME_EVENTS.VEHICLE_DELETE, function (vehicle) {
27740
+ _this.storableDataService.removeFromStores(vehicle.id);
27741
+ _this.runEventCallbacks(Vehicle_consts_1.REAL_TIME_EVENTS.VEHICLE_DELETE, vehicle);
27742
+ });
27978
27743
  };
27979
27744
  VehiclesApi.prototype.onUpdate = function (callback) {
27980
- return this.storableRealtimeSubscriptions.onEvent(Vehicle_consts_1.REAL_TIME_EVENTS.VEHICLE_UPDATE, function (item) { return callback(item.current); });
27745
+ return this.onEvent(Vehicle_consts_1.REAL_TIME_EVENTS.VEHICLE_UPDATE, callback);
27981
27746
  };
27982
27747
  VehiclesApi.prototype.onDelete = function (callback) {
27983
- return this.storableRealtimeSubscriptions.onEvent(Vehicle_consts_1.REAL_TIME_EVENTS.VEHICLE_DELETE, function (item) { return callback(item.current); });
27748
+ return this.onEvent(Vehicle_consts_1.REAL_TIME_EVENTS.VEHICLE_DELETE, callback);
27984
27749
  };
27985
27750
  VehiclesApi.prototype.onUnassigned = function (callback) {
27986
- return this.storableRealtimeSubscriptions.onAnyEvent(Vehicle_consts_1.REAL_TIME_EVENTS.VEHICLE_UNASSIGNED, function (vehicle) {
27987
- return callback(vehicle);
27988
- });
27751
+ return this.realtimeSubscriptions.subscribe(Vehicle_consts_1.REAL_TIME_EVENTS.VEHICLE_UNASSIGNED, callback);
27989
27752
  };
27990
27753
  VehiclesApi.prototype.get = function (id) {
27991
27754
  return this.vehiclesStore.get(id);
@@ -28025,6 +27788,20 @@ var VehiclesApi = /** @class */ (function () {
28025
27788
  });
28026
27789
  });
28027
27790
  };
27791
+ VehiclesApi.prototype.runEventCallbacks = function (event, data) {
27792
+ (this.eventCallbacks[event] || []).forEach(function (callback) { return callback(data); });
27793
+ };
27794
+ VehiclesApi.prototype.onEvent = function (event, callback) {
27795
+ var _this = this;
27796
+ if (!this.eventCallbacks[event]) {
27797
+ this.eventCallbacks[event] = [];
27798
+ }
27799
+ this.eventCallbacks[event].push(callback);
27800
+ return function () {
27801
+ var indexOfCallback = _this.eventCallbacks[event].indexOf(callback);
27802
+ _this.eventCallbacks[event].splice(indexOfCallback, 1);
27803
+ };
27804
+ };
28028
27805
  return VehiclesApi;
28029
27806
  }());
28030
27807
  exports["default"] = VehiclesApi;
@@ -29515,7 +29292,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
29515
29292
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
29516
29293
  };
29517
29294
  Object.defineProperty(exports, "__esModule", ({ value: true }));
29518
- exports.WorkflowsApi = exports.VehicleTypeConsts = exports.VehicleCategoryConsts = exports.VehicleGroup = exports.VehiclesApi = exports.AbortUtils = exports.UploadApi = exports.UploadConsts = exports.TaskRejectReasonsApi = exports.TaskInventoryConsts = exports.TasksApi = exports.TaskGroupValues = exports.TaskGroupTypes = exports.TagConsts = exports.ServiceAreaApi = exports.ServiceAreaFilterGroups = exports.RunsApi = exports.RunStatus = exports.RunConsts = exports.ResourceUploadType = exports.ReasonToChangeInventory = exports.PlannedRoutesConsts = exports.PlannedDeliveryWindowsApi = exports.RecurrenceType = exports.PlannedDeliveryWindowsFilterGroups = exports.OptimizationResultApi = exports.NotificationTypesConsts = exports.NotificationTemplateConsts = exports.LookupConsts = exports.LanguageConsts = exports.ExclusionWindowApiV2 = exports.ExclusionWindowsFilterGroups = exports.DeliveryWindowsApi = exports.DeliveryBlockConsts = exports.DashboardConsts = exports.CrewConsts = exports.Responses = exports.ChatMessageConsts = exports.ChatConversationConsts = exports.BringgDashboardSDK = void 0;
29295
+ exports.WorkflowsApi = exports.VehicleTypeConsts = exports.VehicleCategoryConsts = exports.VehicleGroup = exports.VehiclesApi = exports.AbortUtils = exports.UploadApi = exports.UploadConsts = exports.TasksExplorerApi = exports.TaskRejectReasonsApi = exports.TaskInventoryConsts = exports.TasksApi = exports.TaskGroupValues = exports.TaskGroupTypes = exports.TagConsts = exports.ServiceAreaApi = exports.ServiceAreaFilterGroups = exports.RunsApi = exports.RunStatus = exports.RunConsts = exports.ResourceUploadType = exports.ReasonToChangeInventory = exports.PlannedRoutesConsts = exports.PlannedDeliveryWindowsApi = exports.RecurrenceType = exports.PlannedDeliveryWindowsFilterGroups = exports.OptimizationResultApi = exports.NotificationTypesConsts = exports.NotificationTemplateConsts = exports.LookupConsts = exports.LanguageConsts = exports.ExclusionWindowApiV2 = exports.ExclusionWindowsFilterGroups = exports.DeliveryWindowsApi = exports.DeliveryBlockConsts = exports.DashboardConsts = exports.CrewConsts = exports.Responses = exports.ChatMessageConsts = exports.ChatConversationConsts = exports.BringgDashboardSDK = void 0;
29519
29296
  __exportStar(__webpack_require__(37360), exports);
29520
29297
  __exportStar(__webpack_require__(5655), exports);
29521
29298
  var BringgDashboardSDK_1 = __webpack_require__(5655);
@@ -29567,6 +29344,8 @@ exports.TaskInventoryConsts = __webpack_require__(31289);
29567
29344
  __exportStar(__webpack_require__(26931), exports);
29568
29345
  var task_reject_reasons_api_1 = __webpack_require__(62954);
29569
29346
  Object.defineProperty(exports, "TaskRejectReasonsApi", ({ enumerable: true, get: function () { return task_reject_reasons_api_1.default; } }));
29347
+ var tasks_explorer_api_1 = __webpack_require__(66845);
29348
+ Object.defineProperty(exports, "TasksExplorerApi", ({ enumerable: true, get: function () { return tasks_explorer_api_1.default; } }));
29570
29349
  exports.UploadConsts = __webpack_require__(30875);
29571
29350
  var upload_api_1 = __webpack_require__(61488);
29572
29351
  Object.defineProperty(exports, "UploadApi", ({ enumerable: true, get: function () { return upload_api_1.default; } }));
@@ -29723,17 +29502,6 @@ exports["default"] = { build: build };
29723
29502
 
29724
29503
  "use strict";
29725
29504
 
29726
- var __assign = (this && this.__assign) || function () {
29727
- __assign = Object.assign || function(t) {
29728
- for (var s, i = 1, n = arguments.length; i < n; i++) {
29729
- s = arguments[i];
29730
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
29731
- t[p] = s[p];
29732
- }
29733
- return t;
29734
- };
29735
- return __assign.apply(this, arguments);
29736
- };
29737
29505
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29738
29506
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
29739
29507
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -29807,7 +29575,7 @@ var StorableDataService = /** @class */ (function () {
29807
29575
  return [4 /*yield*/, loadFunc(loadFnIdsParams)];
29808
29576
  case 1:
29809
29577
  items = _a.sent();
29810
- mappedItems_1 = items.map(function (item) { return _this.mapper(item, { action: action }); });
29578
+ mappedItems_1 = items.map(function (item) { return _this.mapper(item, action); });
29811
29579
  if (options.groupType) {
29812
29580
  this.dataStore.setGroup(options.groupType, groupValue, mappedItems_1);
29813
29581
  }
@@ -29835,7 +29603,7 @@ var StorableDataService = /** @class */ (function () {
29835
29603
  return [4 /*yield*/, loadFunc(ids)];
29836
29604
  case 1:
29837
29605
  items = _a.sent();
29838
- mappedItems_2 = items.map(function (item) { return _this.mapper(item, { action: action }); });
29606
+ mappedItems_2 = items.map(function (item) { return _this.mapper(item, action); });
29839
29607
  this.dataStore.setMany(mappedItems_2);
29840
29608
  this.extraDataStores.forEach(function (dataStore) { return dataStore.setMany(mappedItems_2, options.fields); });
29841
29609
  return [2 /*return*/, mappedItems_2.map(function (mappedItems) { return mappedItems.current; })];
@@ -29917,13 +29685,13 @@ var StorableDataService = /** @class */ (function () {
29917
29685
  });
29918
29686
  });
29919
29687
  };
29920
- StorableDataService.prototype.updateInStores = function (item, action, fields, extraMapperParams) {
29921
- return this.updateManyInStores([item], action, fields, extraMapperParams)[0];
29688
+ StorableDataService.prototype.updateInStores = function (item, action, fields) {
29689
+ return this.updateManyInStores([item], action, fields)[0];
29922
29690
  };
29923
- StorableDataService.prototype.updateManyInStores = function (items, action, fields, extraMapperParams) {
29691
+ StorableDataService.prototype.updateManyInStores = function (items, action, fields) {
29924
29692
  var _this = this;
29925
29693
  return (0, BringgDashboardSDK_1.getGlobals)().mobx.runInAction(function () {
29926
- var clientItems = items.map(function (item) { return _this.mapper(item, __assign({ action: action }, extraMapperParams)); });
29694
+ var clientItems = items.map(function (item) { return _this.mapper(item, action); });
29927
29695
  _this.dataStore.setMany(clientItems);
29928
29696
  _this.extraDataStores.forEach(function (dataStore) { return dataStore.setMany(clientItems, fields); });
29929
29697
  return clientItems;
@@ -31358,6 +31126,7 @@ __exportStar(__webpack_require__(52462), exports);
31358
31126
  __exportStar(__webpack_require__(77673), exports);
31359
31127
  __exportStar(__webpack_require__(32918), exports);
31360
31128
  __exportStar(__webpack_require__(12073), exports);
31129
+ __exportStar(__webpack_require__(98719), exports);
31361
31130
  __exportStar(__webpack_require__(17050), exports);
31362
31131
  __exportStar(__webpack_require__(656), exports);
31363
31132
  __exportStar(__webpack_require__(68270), exports);
@@ -31389,13 +31158,13 @@ __exportStar(__webpack_require__(56628), exports);
31389
31158
  __exportStar(__webpack_require__(69424), exports);
31390
31159
  __exportStar(__webpack_require__(70879), exports);
31391
31160
  __exportStar(__webpack_require__(24079), exports);
31392
- __exportStar(__webpack_require__(55009), exports);
31393
31161
  __exportStar(__webpack_require__(53569), exports);
31394
31162
  __exportStar(__webpack_require__(78623), exports);
31395
31163
  __exportStar(__webpack_require__(48967), exports);
31396
31164
  __exportStar(__webpack_require__(81381), exports);
31397
31165
  __exportStar(__webpack_require__(14801), exports);
31398
31166
  __exportStar(__webpack_require__(37022), exports);
31167
+ __exportStar(__webpack_require__(69786), exports);
31399
31168
  __exportStar(__webpack_require__(52632), exports);
31400
31169
  __exportStar(__webpack_require__(87907), exports);
31401
31170
  __exportStar(__webpack_require__(97868), exports);
@@ -31450,6 +31219,7 @@ __exportStar(__webpack_require__(51851), exports);
31450
31219
  __exportStar(__webpack_require__(81075), exports);
31451
31220
  __exportStar(__webpack_require__(73918), exports);
31452
31221
  __exportStar(__webpack_require__(74116), exports);
31222
+ __exportStar(__webpack_require__(61036), exports);
31453
31223
  __exportStar(__webpack_require__(30200), exports);
31454
31224
  __exportStar(__webpack_require__(76581), exports);
31455
31225
  __exportStar(__webpack_require__(11035), exports);
@@ -31709,6 +31479,22 @@ var AlertDisplayCategory;
31709
31479
  "use strict";
31710
31480
 
31711
31481
  Object.defineProperty(exports, "__esModule", ({ value: true }));
31482
+ exports.API_KEY_HEADER_NAME = exports.AnalyticsParentAppToTargetSystemMap = exports.AnalyticsTargetSystem = exports.AnalyticsParentApp = void 0;
31483
+ var AnalyticsParentApp;
31484
+ (function (AnalyticsParentApp) {
31485
+ AnalyticsParentApp["OwnFleet"] = "own-fleet";
31486
+ AnalyticsParentApp["DeliveryHub"] = "delivery-hub";
31487
+ })(AnalyticsParentApp || (exports.AnalyticsParentApp = AnalyticsParentApp = {}));
31488
+ var AnalyticsTargetSystem;
31489
+ (function (AnalyticsTargetSystem) {
31490
+ AnalyticsTargetSystem[AnalyticsTargetSystem["OwnFleet"] = 0] = "OwnFleet";
31491
+ AnalyticsTargetSystem[AnalyticsTargetSystem["DeliveryHub"] = 1] = "DeliveryHub";
31492
+ })(AnalyticsTargetSystem || (exports.AnalyticsTargetSystem = AnalyticsTargetSystem = {}));
31493
+ exports.AnalyticsParentAppToTargetSystemMap = new Map([
31494
+ [AnalyticsParentApp.OwnFleet, AnalyticsTargetSystem.OwnFleet],
31495
+ [AnalyticsParentApp.DeliveryHub, AnalyticsTargetSystem.DeliveryHub]
31496
+ ]);
31497
+ exports.API_KEY_HEADER_NAME = 'x-api-key';
31712
31498
  //# sourceMappingURL=common.js.map
31713
31499
 
31714
31500
  /***/ }),
@@ -31735,17 +31521,17 @@ var SharedEntityAccessLevel;
31735
31521
  "use strict";
31736
31522
 
31737
31523
  Object.defineProperty(exports, "__esModule", ({ value: true }));
31738
- exports.CubeDataSource = exports.CubeClientIds = void 0;
31739
- var CubeClientIds;
31740
- (function (CubeClientIds) {
31741
- CubeClientIds["OwnFleet"] = "own-fleet";
31742
- CubeClientIds["DeliveryHub"] = "delivery-hub";
31743
- })(CubeClientIds || (exports.CubeClientIds = CubeClientIds = {}));
31524
+ exports.CubeClientIds = exports.CubeDataSource = void 0;
31744
31525
  var CubeDataSource;
31745
31526
  (function (CubeDataSource) {
31746
31527
  CubeDataSource["Presto"] = "prestodb";
31747
31528
  CubeDataSource["Druid"] = "druid";
31748
31529
  })(CubeDataSource || (exports.CubeDataSource = CubeDataSource = {}));
31530
+ var CubeClientIds;
31531
+ (function (CubeClientIds) {
31532
+ CubeClientIds["OwnFleet"] = "own-fleet";
31533
+ CubeClientIds["DeliveryHub"] = "delivery-hub";
31534
+ })(CubeClientIds || (exports.CubeClientIds = CubeClientIds = {}));
31749
31535
  //# sourceMappingURL=cubejs.js.map
31750
31536
 
31751
31537
  /***/ }),
@@ -32168,7 +31954,6 @@ var ApplicationUuid;
32168
31954
  ApplicationUuid["StoreAppApp"] = "b4152c59-70a3-415e-b414-ce419550782e";
32169
31955
  ApplicationUuid["TowNow"] = "cd52a2c2-193d-4f92-bf01-3412194e18b2";
32170
31956
  ApplicationUuid["TasksETL"] = "3043914f-9be6-43c6-b1d8-e249410c79bc";
32171
- ApplicationUuid["TaskScanner"] = "255ef1ae-0012-448a-ad55-7dbfec3f1223";
32172
31957
  ApplicationUuid["TaskSchedulingApp"] = "779d22c8-e18a-4723-9fd9-b5475178c244";
32173
31958
  ApplicationUuid["TaskSkillsApp"] = "b6dbfed4-d416-48eb-9552-610b15ff5748";
32174
31959
  ApplicationUuid["TaskTimesPredictions"] = "6c573459-dad9-4486-bdaa-b7ff32bd3019";
@@ -32256,6 +32041,28 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
32256
32041
 
32257
32042
  /***/ }),
32258
32043
 
32044
+ /***/ 60327:
32045
+ /***/ ((__unused_webpack_module, exports) => {
32046
+
32047
+ "use strict";
32048
+
32049
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
32050
+ exports.ChatErrorCodes = void 0;
32051
+ var ChatErrorCodes;
32052
+ (function (ChatErrorCodes) {
32053
+ ChatErrorCodes[ChatErrorCodes["BRINGG_USERS_NOT_FOUND"] = 100] = "BRINGG_USERS_NOT_FOUND";
32054
+ ChatErrorCodes[ChatErrorCodes["FAILED_TO_CREATE_CHAT_USER"] = 101] = "FAILED_TO_CREATE_CHAT_USER";
32055
+ ChatErrorCodes[ChatErrorCodes["FAILED_TO_CREATE_SENDBIRD_USER"] = 102] = "FAILED_TO_CREATE_SENDBIRD_USER";
32056
+ ChatErrorCodes[ChatErrorCodes["BRINGG_USER_NOT_FOUND"] = 103] = "BRINGG_USER_NOT_FOUND";
32057
+ ChatErrorCodes[ChatErrorCodes["CHAT_MERCHANT_APP_NOT_FOUND"] = 104] = "CHAT_MERCHANT_APP_NOT_FOUND";
32058
+ ChatErrorCodes[ChatErrorCodes["CHAT_MERCHANT_APP_ALREADY_EXIST"] = 105] = "CHAT_MERCHANT_APP_ALREADY_EXIST";
32059
+ ChatErrorCodes[ChatErrorCodes["CHAT_MERCHANT_APP_IS_NOT_CREATED_YET"] = 106] = "CHAT_MERCHANT_APP_IS_NOT_CREATED_YET";
32060
+ ChatErrorCodes[ChatErrorCodes["MERCHANT_CONFIGURATION_NOT_FOUND"] = 107] = "MERCHANT_CONFIGURATION_NOT_FOUND";
32061
+ })(ChatErrorCodes || (exports.ChatErrorCodes = ChatErrorCodes = {}));
32062
+ //# sourceMappingURL=error_codes.js.map
32063
+
32064
+ /***/ }),
32065
+
32259
32066
  /***/ 68734:
32260
32067
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
32261
32068
 
@@ -32279,6 +32086,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
32279
32086
  __exportStar(__webpack_require__(52311), exports);
32280
32087
  __exportStar(__webpack_require__(43720), exports);
32281
32088
  __exportStar(__webpack_require__(89572), exports);
32089
+ __exportStar(__webpack_require__(60327), exports);
32282
32090
  //# sourceMappingURL=index.js.map
32283
32091
 
32284
32092
  /***/ }),
@@ -32971,6 +32779,16 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
32971
32779
 
32972
32780
  /***/ }),
32973
32781
 
32782
+ /***/ 98719:
32783
+ /***/ ((__unused_webpack_module, exports) => {
32784
+
32785
+ "use strict";
32786
+
32787
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
32788
+ //# sourceMappingURL=index.js.map
32789
+
32790
+ /***/ }),
32791
+
32974
32792
  /***/ 17050:
32975
32793
  /***/ ((__unused_webpack_module, exports) => {
32976
32794
 
@@ -33819,7 +33637,17 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
33819
33637
  "use strict";
33820
33638
 
33821
33639
  Object.defineProperty(exports, "__esModule", ({ value: true }));
33822
- exports.OptimizationEntityType = void 0;
33640
+ exports.OptimizationEntityType = exports.OptimizationResultsSortColumn = void 0;
33641
+ var OptimizationResultsSortColumn;
33642
+ (function (OptimizationResultsSortColumn) {
33643
+ OptimizationResultsSortColumn[OptimizationResultsSortColumn["created_at"] = 0] = "created_at";
33644
+ OptimizationResultsSortColumn[OptimizationResultsSortColumn["stops_per_hour"] = 1] = "stops_per_hour";
33645
+ OptimizationResultsSortColumn[OptimizationResultsSortColumn["intersections"] = 2] = "intersections";
33646
+ OptimizationResultsSortColumn[OptimizationResultsSortColumn["total_route_duration"] = 3] = "total_route_duration";
33647
+ OptimizationResultsSortColumn[OptimizationResultsSortColumn["total_route_distance"] = 4] = "total_route_distance";
33648
+ OptimizationResultsSortColumn[OptimizationResultsSortColumn["total_routes"] = 5] = "total_routes";
33649
+ OptimizationResultsSortColumn[OptimizationResultsSortColumn["total_assigned_orders"] = 6] = "total_assigned_orders";
33650
+ })(OptimizationResultsSortColumn || (exports.OptimizationResultsSortColumn = OptimizationResultsSortColumn = {}));
33823
33651
  var OptimizationEntityType;
33824
33652
  (function (OptimizationEntityType) {
33825
33653
  OptimizationEntityType["Task"] = "task";
@@ -33832,22 +33660,6 @@ var OptimizationEntityType;
33832
33660
 
33833
33661
  /***/ }),
33834
33662
 
33835
- /***/ 55009:
33836
- /***/ ((__unused_webpack_module, exports) => {
33837
-
33838
- "use strict";
33839
-
33840
- Object.defineProperty(exports, "__esModule", ({ value: true }));
33841
- exports.OriginOptions = void 0;
33842
- var OriginOptions;
33843
- (function (OriginOptions) {
33844
- OriginOptions[OriginOptions["Manual"] = 0] = "Manual";
33845
- OriginOptions[OriginOptions["Automation"] = 1] = "Automation";
33846
- })(OriginOptions || (exports.OriginOptions = OriginOptions = {}));
33847
- //# sourceMappingURL=optimization_simulator.js.map
33848
-
33849
- /***/ }),
33850
-
33851
33663
  /***/ 53569:
33852
33664
  /***/ ((__unused_webpack_module, exports) => {
33853
33665
 
@@ -33953,6 +33765,66 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
33953
33765
 
33954
33766
  /***/ }),
33955
33767
 
33768
+ /***/ 69786:
33769
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
33770
+
33771
+ "use strict";
33772
+
33773
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
33774
+ if (k2 === undefined) k2 = k;
33775
+ var desc = Object.getOwnPropertyDescriptor(m, k);
33776
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
33777
+ desc = { enumerable: true, get: function() { return m[k]; } };
33778
+ }
33779
+ Object.defineProperty(o, k2, desc);
33780
+ }) : (function(o, m, k, k2) {
33781
+ if (k2 === undefined) k2 = k;
33782
+ o[k2] = m[k];
33783
+ }));
33784
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
33785
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
33786
+ };
33787
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
33788
+ __exportStar(__webpack_require__(9579), exports);
33789
+ __exportStar(__webpack_require__(71034), exports);
33790
+ //# sourceMappingURL=index.js.map
33791
+
33792
+ /***/ }),
33793
+
33794
+ /***/ 9579:
33795
+ /***/ ((__unused_webpack_module, exports) => {
33796
+
33797
+ "use strict";
33798
+
33799
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
33800
+ exports.PresetViewScope = exports.PresetViewSupportedView = void 0;
33801
+ var PresetViewSupportedView;
33802
+ (function (PresetViewSupportedView) {
33803
+ PresetViewSupportedView[PresetViewSupportedView["Dispatch"] = 0] = "Dispatch";
33804
+ PresetViewSupportedView[PresetViewSupportedView["Planning"] = 1] = "Planning";
33805
+ PresetViewSupportedView[PresetViewSupportedView["OrderAlerts"] = 2] = "OrderAlerts";
33806
+ PresetViewSupportedView[PresetViewSupportedView["DriverAlerts"] = 3] = "DriverAlerts";
33807
+ PresetViewSupportedView[PresetViewSupportedView["OptimisationAlerts"] = 4] = "OptimisationAlerts";
33808
+ })(PresetViewSupportedView || (exports.PresetViewSupportedView = PresetViewSupportedView = {}));
33809
+ var PresetViewScope;
33810
+ (function (PresetViewScope) {
33811
+ PresetViewScope["Merchant"] = "merchant";
33812
+ PresetViewScope["User"] = "user";
33813
+ })(PresetViewScope || (exports.PresetViewScope = PresetViewScope = {}));
33814
+ //# sourceMappingURL=preset_view.js.map
33815
+
33816
+ /***/ }),
33817
+
33818
+ /***/ 71034:
33819
+ /***/ ((__unused_webpack_module, exports) => {
33820
+
33821
+ "use strict";
33822
+
33823
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
33824
+ //# sourceMappingURL=user_preset_view.js.map
33825
+
33826
+ /***/ }),
33827
+
33956
33828
  /***/ 52632:
33957
33829
  /***/ ((__unused_webpack_module, exports) => {
33958
33830
 
@@ -34240,6 +34112,7 @@ var ReasonToCancelTaskType;
34240
34112
  ReasonToCancelTaskType["RESERVATION_EXPIRED"] = "reservation_expired";
34241
34113
  ReasonToCancelTaskType["CUSTOM"] = "custom";
34242
34114
  ReasonToCancelTaskType["PRIMARY_ORDER_CANCELLED"] = "primary_order_cancelled";
34115
+ ReasonToCancelTaskType["RESCHEDULE"] = "reschedule";
34243
34116
  })(ReasonToCancelTaskType || (exports.ReasonToCancelTaskType = ReasonToCancelTaskType = {}));
34244
34117
  //# sourceMappingURL=reason_to_cancel_task.js.map
34245
34118
 
@@ -34621,7 +34494,7 @@ var SharedLocationDisplayType;
34621
34494
  "use strict";
34622
34495
 
34623
34496
  Object.defineProperty(exports, "__esModule", ({ value: true }));
34624
- exports.ShiftRule = exports.ShiftNoteType = void 0;
34497
+ exports.ShiftEndedOrigin = exports.ShiftRule = exports.ShiftNoteType = void 0;
34625
34498
  var ShiftNoteType;
34626
34499
  (function (ShiftNoteType) {
34627
34500
  ShiftNoteType["ShiftForm"] = "ShiftForm";
@@ -34635,6 +34508,13 @@ var ShiftRule;
34635
34508
  ShiftRule[ShiftRule["start_shift"] = 0] = "start_shift";
34636
34509
  ShiftRule[ShiftRule["end_shift"] = 1] = "end_shift";
34637
34510
  })(ShiftRule || (exports.ShiftRule = ShiftRule = {}));
34511
+ var ShiftEndedOrigin;
34512
+ (function (ShiftEndedOrigin) {
34513
+ ShiftEndedOrigin[ShiftEndedOrigin["MANUAL_FROM_APP"] = 2] = "MANUAL_FROM_APP";
34514
+ ShiftEndedOrigin[ShiftEndedOrigin["FROM_DASHBOARD"] = 3] = "FROM_DASHBOARD";
34515
+ ShiftEndedOrigin[ShiftEndedOrigin["FROM_API"] = 4] = "FROM_API";
34516
+ ShiftEndedOrigin[ShiftEndedOrigin["AUTOMATIC_FROM_BRINGG"] = 5] = "AUTOMATIC_FROM_BRINGG";
34517
+ })(ShiftEndedOrigin || (exports.ShiftEndedOrigin = ShiftEndedOrigin = {}));
34638
34518
  //# sourceMappingURL=shift.js.map
34639
34519
 
34640
34520
  /***/ }),
@@ -35182,7 +35062,6 @@ exports.TemplateRpcActions = exports.TemplateContentType = exports.TemplateTypeE
35182
35062
  var TemplateTypeEnum;
35183
35063
  (function (TemplateTypeEnum) {
35184
35064
  TemplateTypeEnum["package_label"] = "package_label";
35185
- TemplateTypeEnum["workflow_email"] = "workflow_email";
35186
35065
  TemplateTypeEnum["customer_notification_email"] = "customer_notification_email";
35187
35066
  })(TemplateTypeEnum || (exports.TemplateTypeEnum = TemplateTypeEnum = {}));
35188
35067
  var TemplateContentType;
@@ -35217,6 +35096,31 @@ var TenderNotifyStatus;
35217
35096
 
35218
35097
  /***/ }),
35219
35098
 
35099
+ /***/ 61036:
35100
+ /***/ ((__unused_webpack_module, exports) => {
35101
+
35102
+ "use strict";
35103
+
35104
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
35105
+ exports.TimeWindowChangeOrigin = void 0;
35106
+ var TimeWindowChangeOrigin;
35107
+ (function (TimeWindowChangeOrigin) {
35108
+ TimeWindowChangeOrigin["ORDER_CREATION_API"] = "order_creation_api";
35109
+ TimeWindowChangeOrigin["ORDER_CREATION_CSV"] = "order_creation_csv";
35110
+ TimeWindowChangeOrigin["ORDER_CREATION_WEB"] = "order_creation_web";
35111
+ TimeWindowChangeOrigin["CUSTOMER_EXPERIENCE_WEB_USER_RESCHEDULED"] = "customer_experience_web_user_rescheduled";
35112
+ TimeWindowChangeOrigin["CUSTOMER_EXPERIENCE_CUSTOMER_RESCHEDULED"] = "customer_experience_customer_rescheduled";
35113
+ TimeWindowChangeOrigin["QUOTES_FOR_FIRST_AVAILABILITY"] = "quotes_for_first_availability";
35114
+ TimeWindowChangeOrigin["PLANNED_DELIVERY_WINDOW_WITHOUT_QUOTES"] = "planned_delivery_window_without_quotes";
35115
+ TimeWindowChangeOrigin["NARROW_TIME_WINDOW"] = "narrow_time_window";
35116
+ TimeWindowChangeOrigin["ORDER_UPDATE_API"] = "order_update_api";
35117
+ TimeWindowChangeOrigin["ORDER_UPDATE_WEB"] = "order_update_web";
35118
+ TimeWindowChangeOrigin["AUTOMATION_PLATFORM"] = "automation_platform";
35119
+ })(TimeWindowChangeOrigin || (exports.TimeWindowChangeOrigin = TimeWindowChangeOrigin = {}));
35120
+ //# sourceMappingURL=time-window-change-origin.js.map
35121
+
35122
+ /***/ }),
35123
+
35220
35124
  /***/ 30200:
35221
35125
  /***/ ((__unused_webpack_module, exports) => {
35222
35126
 
@@ -35544,6 +35448,22 @@ var action_1 = __webpack_require__(82285);
35544
35448
 
35545
35449
  /***/ }),
35546
35450
 
35451
+ /***/ 44866:
35452
+ /***/ ((__unused_webpack_module, exports) => {
35453
+
35454
+ "use strict";
35455
+
35456
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
35457
+ exports.ConnectedEntitiesIdentifier = void 0;
35458
+ var ConnectedEntitiesIdentifier;
35459
+ (function (ConnectedEntitiesIdentifier) {
35460
+ ConnectedEntitiesIdentifier["driver"] = "driver";
35461
+ ConnectedEntitiesIdentifier["linkedTask"] = "linkedTask";
35462
+ })(ConnectedEntitiesIdentifier || (exports.ConnectedEntitiesIdentifier = ConnectedEntitiesIdentifier = {}));
35463
+ //# sourceMappingURL=connected-entities.js.map
35464
+
35465
+ /***/ }),
35466
+
35547
35467
  /***/ 46849:
35548
35468
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
35549
35469
 
@@ -35590,6 +35510,7 @@ __exportStar(__webpack_require__(47085), exports);
35590
35510
  __exportStar(__webpack_require__(97390), exports);
35591
35511
  __exportStar(__webpack_require__(99848), exports);
35592
35512
  __exportStar(__webpack_require__(73360), exports);
35513
+ __exportStar(__webpack_require__(44866), exports);
35593
35514
  __exportStar(__webpack_require__(46849), exports);
35594
35515
  __exportStar(__webpack_require__(72973), exports);
35595
35516
  __exportStar(__webpack_require__(96365), exports);
@@ -35694,16 +35615,18 @@ var ArrayType;
35694
35615
  })(ArrayType || (exports.ArrayType = ArrayType = {}));
35695
35616
  var RuleCategory;
35696
35617
  (function (RuleCategory) {
35697
- RuleCategory[RuleCategory["FleetRouter"] = 0] = "FleetRouter";
35618
+ RuleCategory[RuleCategory["FleetRouterDeliveryTerm"] = 0] = "FleetRouterDeliveryTerm";
35698
35619
  RuleCategory[RuleCategory["Alert"] = 1] = "Alert";
35699
35620
  RuleCategory[RuleCategory["Rate"] = 2] = "Rate";
35700
35621
  RuleCategory[RuleCategory["Workflow"] = 3] = "Workflow";
35622
+ RuleCategory[RuleCategory["FleetRouterRulePolicy"] = 4] = "FleetRouterRulePolicy";
35701
35623
  })(RuleCategory || (exports.RuleCategory = RuleCategory = {}));
35702
35624
  var Entity;
35703
35625
  (function (Entity) {
35704
35626
  Entity["Fleet"] = "fleet";
35705
35627
  Entity["DeliveryProvider"] = "delivery_provider";
35706
35628
  Entity["Action"] = "action";
35629
+ Entity["FleetRouterRulePolicy"] = "fleet_router_rule_policy";
35707
35630
  })(Entity || (exports.Entity = Entity = {}));
35708
35631
  var FactType;
35709
35632
  (function (FactType) {