@bringg/dashboard-sdk 9.14.0-pre → 9.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2676,6 +2676,7 @@ var SkillsApi_1 = __importDefault(__webpack_require__(28855));
2676
2676
  var SpeedFactor_1 = __importDefault(__webpack_require__(89808));
2677
2677
  var SupportTicketApi_1 = __importDefault(__webpack_require__(28002));
2678
2678
  var Tag_1 = __importDefault(__webpack_require__(78847));
2679
+ var tags_api_1 = __importDefault(__webpack_require__(40244));
2679
2680
  var TagCustomerConfiguration_1 = __importDefault(__webpack_require__(87798));
2680
2681
  var TagMerchantConfiguration_1 = __importDefault(__webpack_require__(2889));
2681
2682
  var TaskApi_1 = __importDefault(__webpack_require__(41550));
@@ -2938,6 +2939,7 @@ function init(session) {
2938
2939
  bringg.v2 = {
2939
2940
  vehicles: new vehicles_api_1.default(session),
2940
2941
  tasks: new tasks_api_1.default(session),
2942
+ tags: new tags_api_1.default(session),
2941
2943
  customers: new customers_api_1.default(session),
2942
2944
  plannedDeliveryWindows: new planned_delivery_windows_api_1.default(session),
2943
2945
  optimizationResultApi: new optimization_result_api_1.default(session),
@@ -22367,7 +22369,7 @@ var lodash_1 = __webpack_require__(96486);
22367
22369
  var BringgException_1 = __webpack_require__(43605);
22368
22370
  var Logger_1 = __importDefault(__webpack_require__(55860));
22369
22371
  var abort_1 = __webpack_require__(34179);
22370
- var version = '9.14.0-pre';
22372
+ var version = '9.14.0';
22371
22373
  function logErrorResponse(response) {
22372
22374
  var data = response.data, status = response.status;
22373
22375
  try {
@@ -23568,6 +23570,230 @@ exports["default"] = Tag;
23568
23570
 
23569
23571
  /***/ }),
23570
23572
 
23573
+ /***/ 40244:
23574
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
23575
+
23576
+ "use strict";
23577
+
23578
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
23579
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23580
+ return new (P || (P = Promise))(function (resolve, reject) {
23581
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
23582
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
23583
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23584
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
23585
+ });
23586
+ };
23587
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23588
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23589
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
23590
+ function verb(n) { return function (v) { return step([n, v]); }; }
23591
+ function step(op) {
23592
+ if (f) throw new TypeError("Generator is already executing.");
23593
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
23594
+ 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;
23595
+ if (y = 0, t) op = [op[0] & 2, t.value];
23596
+ switch (op[0]) {
23597
+ case 0: case 1: t = op; break;
23598
+ case 4: _.label++; return { value: op[1], done: false };
23599
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23600
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
23601
+ default:
23602
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
23603
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
23604
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
23605
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
23606
+ if (t[2]) _.ops.pop();
23607
+ _.trys.pop(); continue;
23608
+ }
23609
+ op = body.call(thisArg, _);
23610
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
23611
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
23612
+ }
23613
+ };
23614
+ var __rest = (this && this.__rest) || function (s, e) {
23615
+ var t = {};
23616
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
23617
+ t[p] = s[p];
23618
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
23619
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
23620
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
23621
+ t[p[i]] = s[p[i]];
23622
+ }
23623
+ return t;
23624
+ };
23625
+ var __importDefault = (this && this.__importDefault) || function (mod) {
23626
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23627
+ };
23628
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
23629
+ var BringgDashboardSDK_1 = __webpack_require__(5655);
23630
+ var object_merger_1 = __webpack_require__(7262);
23631
+ var data_store_1 = __importDefault(__webpack_require__(73135));
23632
+ var storable_data_service_1 = __importDefault(__webpack_require__(45297));
23633
+ var TagEntity_1 = __importDefault(__webpack_require__(94415));
23634
+ var tagIdGroup = 'tagIds';
23635
+ var TagsApi = /** @class */ (function () {
23636
+ function TagsApi(session) {
23637
+ var _this = this;
23638
+ this.updateConfigurationStore = function (store, tagId, configuration) {
23639
+ if (configuration) {
23640
+ store.set(configuration);
23641
+ }
23642
+ else {
23643
+ _this.removeConfigurationByTagId(store, tagId);
23644
+ }
23645
+ };
23646
+ this.removeAllConfigurationsByTagId = function (tagId) {
23647
+ [
23648
+ _this.tagMerchantConfigurationsStore,
23649
+ _this.tagCustomerConfigurationsStore,
23650
+ _this.tagRulesConfigurationsStore
23651
+ ].forEach(function (store) {
23652
+ _this.removeConfigurationByTagId(store, tagId);
23653
+ });
23654
+ };
23655
+ this.removeConfigurationByTagId = function (store, tagId) {
23656
+ store.getGroup(tagIdGroup, tagId).forEach(function (_a) {
23657
+ var id = _a.id;
23658
+ return store.remove(id);
23659
+ });
23660
+ };
23661
+ this.tagsEntity = new TagEntity_1.default(session);
23662
+ this.tagsStore = new data_store_1.default();
23663
+ this.tagMerchantConfigurationsStore = new data_store_1.default([
23664
+ {
23665
+ groupType: tagIdGroup,
23666
+ keyFunc: function (tagMerchantConfiguration) { return tagMerchantConfiguration.tag_id; }
23667
+ }
23668
+ ]);
23669
+ this.tagCustomerConfigurationsStore = new data_store_1.default([
23670
+ {
23671
+ groupType: tagIdGroup,
23672
+ keyFunc: function (tagCustomerConfiguration) { return tagCustomerConfiguration.tag_id; }
23673
+ }
23674
+ ]);
23675
+ this.tagRulesConfigurationsStore = new data_store_1.default([
23676
+ {
23677
+ groupType: tagIdGroup,
23678
+ keyFunc: function (tagRulesConfiguration) { return tagRulesConfiguration.tag_id; }
23679
+ }
23680
+ ]);
23681
+ var mapper = function (tagConfiguration) {
23682
+ var tagMerchantConfiguration = tagConfiguration.tag_merchant_configuration, tagCustomerConfiguration = tagConfiguration.tag_customer_configuration, tagRulesConfiguration = tagConfiguration.tag_rules_configuration, tagStoreContent = __rest(tagConfiguration, ["tag_merchant_configuration", "tag_customer_configuration", "tag_rules_configuration"]);
23683
+ var existing = _this.tagsStore.get(tagStoreContent.id);
23684
+ _this.updateConfigurationStore(_this.tagMerchantConfigurationsStore, tagStoreContent.id, tagMerchantConfiguration);
23685
+ _this.updateConfigurationStore(_this.tagCustomerConfigurationsStore, tagStoreContent.id, tagCustomerConfiguration);
23686
+ _this.updateConfigurationStore(_this.tagRulesConfigurationsStore, tagStoreContent.id, tagRulesConfiguration);
23687
+ if (existing) {
23688
+ var previous = (0, BringgDashboardSDK_1.getGlobals)().mobx.toJS(existing);
23689
+ var diff = object_merger_1.objectMerger.deepMerge(previous, tagStoreContent);
23690
+ return { current: tagStoreContent, diff: diff };
23691
+ }
23692
+ else {
23693
+ return { current: tagStoreContent };
23694
+ }
23695
+ };
23696
+ this.tagsStorableDataService = new storable_data_service_1.default(this.tagsStore, mapper);
23697
+ }
23698
+ TagsApi.prototype.getTag = function (id) {
23699
+ return this.tagsStore.get(id);
23700
+ };
23701
+ TagsApi.prototype.getTagMerchantConfiguration = function (tagId) {
23702
+ var _a;
23703
+ return (_a = this.tagMerchantConfigurationsStore.getGroup(tagIdGroup, tagId)) === null || _a === void 0 ? void 0 : _a[0];
23704
+ };
23705
+ TagsApi.prototype.getTagCustomerConfiguration = function (tagId) {
23706
+ var _a;
23707
+ return (_a = this.tagCustomerConfigurationsStore.getGroup(tagIdGroup, tagId)) === null || _a === void 0 ? void 0 : _a[0];
23708
+ };
23709
+ TagsApi.prototype.getTagRulesConfiguration = function (tagId) {
23710
+ var _a;
23711
+ return (_a = this.tagRulesConfigurationsStore.getGroup(tagIdGroup, tagId)) === null || _a === void 0 ? void 0 : _a[0];
23712
+ };
23713
+ TagsApi.prototype.loadAll = function () {
23714
+ return __awaiter(this, void 0, void 0, function () {
23715
+ var _this = this;
23716
+ return __generator(this, function (_a) {
23717
+ switch (_a.label) {
23718
+ case 0: return [4 /*yield*/, this.tagsStorableDataService.loadAll('loadAll', function () { return __awaiter(_this, void 0, void 0, function () {
23719
+ var response;
23720
+ return __generator(this, function (_a) {
23721
+ switch (_a.label) {
23722
+ case 0: return [4 /*yield*/, this.tagsEntity.service.getAll()];
23723
+ case 1:
23724
+ response = _a.sent();
23725
+ return [2 /*return*/, response.tags];
23726
+ }
23727
+ });
23728
+ }); })];
23729
+ case 1: return [2 /*return*/, _a.sent()];
23730
+ }
23731
+ });
23732
+ });
23733
+ };
23734
+ TagsApi.prototype.update = function (id, options) {
23735
+ return __awaiter(this, void 0, void 0, function () {
23736
+ var _this = this;
23737
+ return __generator(this, function (_a) {
23738
+ switch (_a.label) {
23739
+ case 0: return [4 /*yield*/, this.tagsStorableDataService.modify('update', function () { return __awaiter(_this, void 0, void 0, function () {
23740
+ var response;
23741
+ return __generator(this, function (_a) {
23742
+ switch (_a.label) {
23743
+ case 0: return [4 /*yield*/, this.tagsEntity.service.update(id, options)];
23744
+ case 1:
23745
+ response = _a.sent();
23746
+ return [2 /*return*/, response.tag];
23747
+ }
23748
+ });
23749
+ }); })];
23750
+ case 1: return [2 /*return*/, _a.sent()];
23751
+ }
23752
+ });
23753
+ });
23754
+ };
23755
+ TagsApi.prototype.create = function (options) {
23756
+ return __awaiter(this, void 0, void 0, function () {
23757
+ var _this = this;
23758
+ return __generator(this, function (_a) {
23759
+ switch (_a.label) {
23760
+ case 0: return [4 /*yield*/, this.tagsStorableDataService.modify('create', function () { return __awaiter(_this, void 0, void 0, function () {
23761
+ var response;
23762
+ return __generator(this, function (_a) {
23763
+ switch (_a.label) {
23764
+ case 0: return [4 /*yield*/, this.tagsEntity.service.create(options)];
23765
+ case 1:
23766
+ response = _a.sent();
23767
+ return [2 /*return*/, response.tag];
23768
+ }
23769
+ });
23770
+ }); })];
23771
+ case 1: return [2 /*return*/, _a.sent()];
23772
+ }
23773
+ });
23774
+ });
23775
+ };
23776
+ TagsApi.prototype.delete = function (id) {
23777
+ return __awaiter(this, void 0, void 0, function () {
23778
+ var _this = this;
23779
+ return __generator(this, function (_a) {
23780
+ switch (_a.label) {
23781
+ case 0: return [4 /*yield*/, this.tagsStorableDataService.delete('delete', function () { return _this.tagsEntity.service.delete(id); }, id)];
23782
+ case 1:
23783
+ _a.sent();
23784
+ this.removeAllConfigurationsByTagId(id);
23785
+ return [2 /*return*/];
23786
+ }
23787
+ });
23788
+ });
23789
+ };
23790
+ return TagsApi;
23791
+ }());
23792
+ exports["default"] = TagsApi;
23793
+ //# sourceMappingURL=tags-api.js.map
23794
+
23795
+ /***/ }),
23796
+
23571
23797
  /***/ 31450:
23572
23798
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
23573
23799
 
@@ -24700,7 +24926,7 @@ var __values = (this && this.__values) || function(o) {
24700
24926
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
24701
24927
  };
24702
24928
  Object.defineProperty(exports, "__esModule", ({ value: true }));
24703
- exports.taskDefaultFields = exports.Routes = exports.baseRoute = exports.TaskRealTimeEvents = exports.quotesExtractor = exports.formExtractor = exports.taskIdsExtractor = exports.scanCodeExtractor = exports.locationExtractor = exports.childTasksExtractor = exports.tasksExtractor = exports.successExtractor = exports.taskExtractor = exports.defaultExtractor = exports.noteTypes = exports.taskToGroupMapper = exports.groupFilter = exports.TaskGroupTypes = exports.GROUP_VALUES = exports.DONE_TASK_STATUES = exports.OPEN_TASK_STATUES = void 0;
24929
+ exports.Routes = exports.baseRoute = exports.TaskRealTimeEvents = exports.quotesExtractor = exports.formExtractor = exports.taskIdsExtractor = exports.scanCodeExtractor = exports.locationExtractor = exports.childTasksExtractor = exports.tasksExtractor = exports.successExtractor = exports.taskExtractor = exports.defaultExtractor = exports.noteTypes = exports.taskToGroupMapper = exports.groupFilter = exports.TaskGroupTypes = exports.GROUP_VALUES = exports.DONE_TASK_STATUES = exports.OPEN_TASK_STATUES = void 0;
24704
24930
  var types_1 = __webpack_require__(63127);
24705
24931
  var TaskHelpers_1 = __webpack_require__(73119);
24706
24932
  exports.OPEN_TASK_STATUES = [
@@ -24834,38 +25060,10 @@ exports.Routes = {
24834
25060
  // keep this here in case we need, all this data is required by frontend currently
24835
25061
  //const PLANNING_DEFAULT_PARAMS_REQUEST = "first_way_point_has_to_leave_by,active_way_point_id,status,id,way_points.all.position,group_leader_id,priority,late,customer_id,way_points.all.customer_id,way_points.all.id,payment_type_name,task_inventories.all.id,task_inventories.all.way_point_id,task_inventories.all.pending,task_inventories.all.inventory,task_inventories.all.original_quantity,ready_to_execute,virtual_task,done_planning,task_type_id,rogue_reasons,invalidated,automatically_assigned,external_id,title,tag_id,created_at,user_id,way_points.all.late,way_points.all.done,way_points.all.address,planning_done,scheduled_at,way_points.first.address,way_points.last.address,total_price,fleet_id,lat,lng,way_points.all.lat,way_points.all.lng,way_points.all.scheduled_at,team_ids,way_points.all.customer,way_points.all.eta,route_name,run,dispatcher_id,preparation_status,preparation_start_time_planned,preparation_end_time_planned,preparation_ready_for_pickup_time_planned,payment_method,preparation_external_id,fleet_delivery_external_id";
24836
25062
  //const OPEN_DEFAULT_PARAMS_REQUEST = "first_way_point_has_to_leave_by,active_way_point_id,status,id,way_points.all.position,group_leader_id,priority,late,customer_id,way_points.all.customer_id,way_points.all.id,payment_type_name,task_inventories.all.id,task_inventories.all.way_point_id,task_inventories.all.pending,task_inventories.all.inventory,task_inventories.all.original_quantity,ready_to_execute,virtual_task,done_planning,task_type_id,rogue_reasons,invalidated,automatically_assigned,external_id,title,tag_id,created_at,user_id,way_points.all.late,way_points.all.done,way_points.all.address,planning_done,scheduled_at,way_points.first.address,way_points.last.address,total_price,fleet_id,lat,lng,way_points.all.lat,way_points.all.lng,way_points.all.scheduled_at,team_ids,way_points.all.customer,way_points.all.eta,route_name,run,dispatcher_id,preparation_status,preparation_start_time_planned,preparation_end_time_planned,preparation_ready_for_pickup_time_planned,payment_method,preparation_external_id,fleet_delivery_external_id";
24837
- exports.taskDefaultFields = [
24838
- 'id',
24839
- 'status',
24840
- 'invalidated',
24841
- 'group_leader_id',
24842
- 'ready_to_execute',
24843
- { way_points: ['position'] }
24844
- ];
24845
25063
  //# sourceMappingURL=Tasks.consts.js.map
24846
25064
 
24847
25065
  /***/ }),
24848
25066
 
24849
- /***/ 3892:
24850
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
24851
-
24852
- "use strict";
24853
-
24854
- Object.defineProperty(exports, "__esModule", ({ value: true }));
24855
- exports.taskMerger = void 0;
24856
- var merge_mapper_1 = __webpack_require__(59200);
24857
- function mergeTaskIntoExisting(tasksStore, task) {
24858
- var way_points = task.way_points;
24859
- if (way_points) {
24860
- way_points.sort(function (wp1, wp2) { return wp1.position - wp2.position; });
24861
- }
24862
- return merge_mapper_1.mergeMapper.mergeIntoExisting(tasksStore, task);
24863
- }
24864
- exports.taskMerger = { mergeTaskIntoExisting: mergeTaskIntoExisting };
24865
- //# sourceMappingURL=task-merger.js.map
24866
-
24867
- /***/ }),
24868
-
24869
25067
  /***/ 52131:
24870
25068
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
24871
25069
 
@@ -25045,12 +25243,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
25045
25243
  Object.defineProperty(exports, "__esModule", ({ value: true }));
25046
25244
  var types_1 = __webpack_require__(63127);
25047
25245
  var light_data_store_1 = __importDefault(__webpack_require__(93670));
25246
+ var merge_mapper_1 = __webpack_require__(59200);
25048
25247
  var data_entity_1 = __webpack_require__(91083);
25049
25248
  var data_store_1 = __importDefault(__webpack_require__(73135));
25050
25249
  var storable_data_service_1 = __importDefault(__webpack_require__(45297));
25051
25250
  var keyset_pagination_consts_1 = __webpack_require__(92400);
25052
25251
  var Tasks_consts_1 = __webpack_require__(24976);
25053
- var task_merger_1 = __webpack_require__(3892);
25054
25252
  var task_realtime_subscriptions_1 = __importDefault(__webpack_require__(52131));
25055
25253
  var tasks_service_1 = __importDefault(__webpack_require__(8159));
25056
25254
  // hard coded fields to take advantage of the light data store cache
@@ -25090,7 +25288,7 @@ var TasksApi = /** @class */ (function () {
25090
25288
  this.tasksStore = new data_store_1.default(groupFilters, { shallow: true });
25091
25289
  this.tasksService = new tasks_service_1.default(session);
25092
25290
  var lightDataStore = new light_data_store_1.default();
25093
- this.storableDataService = new storable_data_service_1.default(this.tasksStore, function (task) { return task_merger_1.taskMerger.mergeTaskIntoExisting(_this.tasksStore, task); }, [lightDataStore]);
25291
+ this.storableDataService = new storable_data_service_1.default(this.tasksStore, function (task) { return merge_mapper_1.mergeMapper.mergeIntoExisting(_this.tasksStore, task); }, [lightDataStore]);
25094
25292
  this.taskRealtimeSubscriptions = new task_realtime_subscriptions_1.default(session, this.tasksStore, this.storableDataService);
25095
25293
  }
25096
25294
  TasksApi.prototype.updateStoreOnEvents = function () {
@@ -25333,20 +25531,8 @@ var TasksApi = /** @class */ (function () {
25333
25531
  fields = fields.split(',');
25334
25532
  }
25335
25533
  var allFields = __spreadArray([], __read(fields), false);
25336
- Tasks_consts_1.taskDefaultFields.forEach(function (field) {
25337
- if (typeof field === 'object') {
25338
- if (field['way_points']) {
25339
- var wayPointsIndex = allFields.findIndex(function (field) { return typeof field === 'object' && field['way_points']; });
25340
- var wayPointsFields_1 = wayPointsIndex > -1 ? allFields.splice(wayPointsIndex, 1)[0]['way_points'] : [];
25341
- field['way_points'].forEach(function (wayPointField) {
25342
- if (!wayPointsFields_1.includes(wayPointField)) {
25343
- wayPointsFields_1.push(wayPointField);
25344
- }
25345
- });
25346
- allFields.push({ way_points: wayPointsFields_1 });
25347
- }
25348
- }
25349
- else if (!fields.includes(field)) {
25534
+ ['status', 'invalidated', 'group_leader_id', 'id', 'ready_to_execute'].forEach(function (field) {
25535
+ if (!fields.includes(field)) {
25350
25536
  allFields.push(field);
25351
25537
  }
25352
25538
  });