@bringg/dashboard-sdk 9.50.13-pre.2 → 9.50.13-pre.3

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.
@@ -22401,7 +22401,7 @@ var lodash_1 = __webpack_require__(96486);
22401
22401
  var BringgException_1 = __webpack_require__(43605);
22402
22402
  var Logger_1 = __importDefault(__webpack_require__(55860));
22403
22403
  var abort_1 = __webpack_require__(34179);
22404
- var version = '9.50.13-pre.2';
22404
+ var version = '9.50.13-pre.3';
22405
22405
  function logErrorResponse(response) {
22406
22406
  var data = response.data, status = response.status;
22407
22407
  try {
@@ -25113,18 +25113,42 @@ exports.taskDefaultFields = [
25113
25113
  /***/ }),
25114
25114
 
25115
25115
  /***/ 3892:
25116
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
25116
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
25117
25117
 
25118
25118
  "use strict";
25119
25119
 
25120
+ var __rest = (this && this.__rest) || function (s, e) {
25121
+ var t = {};
25122
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
25123
+ t[p] = s[p];
25124
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
25125
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
25126
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
25127
+ t[p[i]] = s[p[i]];
25128
+ }
25129
+ return t;
25130
+ };
25120
25131
  Object.defineProperty(exports, "__esModule", ({ value: true }));
25121
25132
  exports.taskMerger = void 0;
25122
25133
  var merge_mapper_1 = __webpack_require__(59200);
25123
- function mergeTaskIntoExisting(tasksStore, task) {
25134
+ function mergeTaskIntoExisting(tasksStore, task, shouldRemoveInventories) {
25135
+ if (shouldRemoveInventories === void 0) { shouldRemoveInventories = false; }
25124
25136
  var way_points = task.way_points;
25125
25137
  if (way_points) {
25126
25138
  way_points.sort(function (wp1, wp2) { return wp1.position - wp2.position; });
25127
25139
  }
25140
+ if (shouldRemoveInventories) {
25141
+ var taskInventories = task.task_inventories;
25142
+ var task_inventories = task.task_inventories, taskWithoutInventories = __rest(task, ["task_inventories"]);
25143
+ var result = merge_mapper_1.mergeMapper.mergeIntoExisting(tasksStore, taskWithoutInventories);
25144
+ if (taskInventories !== undefined && result.diff) {
25145
+ result.diff.task_inventories = taskInventories;
25146
+ }
25147
+ if (result.current && result.current.task_inventories) {
25148
+ delete result.current.task_inventories;
25149
+ }
25150
+ return result;
25151
+ }
25128
25152
  return merge_mapper_1.mergeMapper.mergeIntoExisting(tasksStore, task);
25129
25153
  }
25130
25154
  exports.taskMerger = { mergeTaskIntoExisting: mergeTaskIntoExisting };
@@ -25137,17 +25161,6 @@ exports.taskMerger = { mergeTaskIntoExisting: mergeTaskIntoExisting };
25137
25161
 
25138
25162
  "use strict";
25139
25163
 
25140
- var __rest = (this && this.__rest) || function (s, e) {
25141
- var t = {};
25142
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
25143
- t[p] = s[p];
25144
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
25145
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
25146
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
25147
- t[p[i]] = s[p[i]];
25148
- }
25149
- return t;
25150
- };
25151
25164
  var __values = (this && this.__values) || function(o) {
25152
25165
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
25153
25166
  if (m) return m.call(o);
@@ -25167,10 +25180,8 @@ var storable_realtime_subscriptions_1 = __importDefault(__webpack_require__(1227
25167
25180
  var Tasks_consts_1 = __webpack_require__(24976);
25168
25181
  var TaskRealtimeSubscriptions = /** @class */ (function () {
25169
25182
  function TaskRealtimeSubscriptions(session, tasksStore, storableDataService) {
25170
- var _a;
25171
25183
  this.tasksStore = tasksStore;
25172
25184
  this.storableRealtimeSubscriptions = new storable_realtime_subscriptions_1.default(session, tasksStore, storableDataService);
25173
- this.shouldRemoveInventories = !!((_a = session.user.feature_flags) === null || _a === void 0 ? void 0 : _a.omit_task_inventories_in_realtime_events);
25174
25185
  }
25175
25186
  TaskRealtimeSubscriptions.prototype.updateStoreOnEvents = function () {
25176
25187
  var _this = this;
@@ -25178,13 +25189,6 @@ var TaskRealtimeSubscriptions = /** @class */ (function () {
25178
25189
  {
25179
25190
  name: Tasks_consts_1.TaskRealTimeEvents.TASK_UPDATE,
25180
25191
  isDelete: false,
25181
- itemExtractor: function (task) {
25182
- if (_this.shouldRemoveInventories) {
25183
- var task_inventories = task.task_inventories, taskWithoutInventories = __rest(task, ["task_inventories"]);
25184
- return taskWithoutInventories;
25185
- }
25186
- return task;
25187
- },
25188
25192
  extraDataFunc: function (task) {
25189
25193
  var isPartialUpdate = !Object.prototype.hasOwnProperty.call(task, 'status');
25190
25194
  return { ignore: isPartialUpdate && !_this.tasksStore.get(task.id) };
@@ -25192,14 +25196,7 @@ var TaskRealtimeSubscriptions = /** @class */ (function () {
25192
25196
  },
25193
25197
  {
25194
25198
  name: Tasks_consts_1.TaskRealTimeEvents.NEW_TASK,
25195
- isDelete: false,
25196
- itemExtractor: function (task) {
25197
- if (_this.shouldRemoveInventories) {
25198
- var task_inventories = task.task_inventories, taskWithoutInventories = __rest(task, ["task_inventories"]);
25199
- return taskWithoutInventories;
25200
- }
25201
- return task;
25202
- }
25199
+ isDelete: false
25203
25200
  },
25204
25201
  { name: Tasks_consts_1.TaskRealTimeEvents.TASK_DELETED, isDelete: true }
25205
25202
  ];
@@ -25386,6 +25383,8 @@ var READY_TO_EXECUTE_FIELDS = ['ready_to_execute'];
25386
25383
  var TasksApi = /** @class */ (function () {
25387
25384
  function TasksApi(session) {
25388
25385
  var _this = this;
25386
+ var _a;
25387
+ this.shouldRemoveInventories = !!((_a = session.user.feature_flags) === null || _a === void 0 ? void 0 : _a.omit_task_inventories_in_realtime_events);
25389
25388
  var groupFilters = [
25390
25389
  {
25391
25390
  groupType: Tasks_consts_1.TaskGroupTypes.Main,
@@ -25418,7 +25417,7 @@ var TasksApi = /** @class */ (function () {
25418
25417
  this.tasksStore = new data_store_1.default(groupFilters, { shallow: true });
25419
25418
  this.tasksService = new tasks_service_1.default(session);
25420
25419
  var lightDataStore = new light_data_store_1.default();
25421
- this.storableDataService = new storable_data_service_1.default(this.tasksStore, function (task) { return task_merger_1.taskMerger.mergeTaskIntoExisting(_this.tasksStore, task); }, [lightDataStore]);
25420
+ this.storableDataService = new storable_data_service_1.default(this.tasksStore, function (task) { return task_merger_1.taskMerger.mergeTaskIntoExisting(_this.tasksStore, task, _this.shouldRemoveInventories); }, [lightDataStore]);
25422
25421
  this.taskRealtimeSubscriptions = new task_realtime_subscriptions_1.default(session, this.tasksStore, this.storableDataService);
25423
25422
  }
25424
25423
  TasksApi.prototype.updateStoreOnEvents = function () {