@bringg/dashboard-sdk 8.27.0 → 8.29.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.
@@ -2754,6 +2754,7 @@ var BringgDashboardSDK = /** @class */ (function () {
2754
2754
  this.vehicleTypes = null;
2755
2755
  this.vehicles = null;
2756
2756
  this.session = session;
2757
+ this.session.sdk = this;
2757
2758
  }
2758
2759
  BringgDashboardSDK.setConfigurations = function (apiEndpointURL, monitorEndpointURL, generalEnvApiEndpoint) {
2759
2760
  configurationProvider.getApiEndpoint = function () { return apiEndpointURL; };
@@ -17682,21 +17683,6 @@ var OptimizationEvents;
17682
17683
 
17683
17684
  "use strict";
17684
17685
 
17685
- var __extends = (this && this.__extends) || (function () {
17686
- var extendStatics = function (d, b) {
17687
- extendStatics = Object.setPrototypeOf ||
17688
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
17689
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
17690
- return extendStatics(d, b);
17691
- };
17692
- return function (d, b) {
17693
- if (typeof b !== "function" && b !== null)
17694
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
17695
- extendStatics(d, b);
17696
- function __() { this.constructor = d; }
17697
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
17698
- };
17699
- })();
17700
17686
  var __assign = (this && this.__assign) || function () {
17701
17687
  __assign = Object.assign || function(t) {
17702
17688
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -17708,30 +17694,78 @@ var __assign = (this && this.__assign) || function () {
17708
17694
  };
17709
17695
  return __assign.apply(this, arguments);
17710
17696
  };
17697
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17698
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17699
+ return new (P || (P = Promise))(function (resolve, reject) {
17700
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17701
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17702
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17703
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
17704
+ });
17705
+ };
17706
+ var __generator = (this && this.__generator) || function (thisArg, body) {
17707
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
17708
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
17709
+ function verb(n) { return function (v) { return step([n, v]); }; }
17710
+ function step(op) {
17711
+ if (f) throw new TypeError("Generator is already executing.");
17712
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17713
+ 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;
17714
+ if (y = 0, t) op = [op[0] & 2, t.value];
17715
+ switch (op[0]) {
17716
+ case 0: case 1: t = op; break;
17717
+ case 4: _.label++; return { value: op[1], done: false };
17718
+ case 5: _.label++; y = op[1]; op = [0]; continue;
17719
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
17720
+ default:
17721
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
17722
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
17723
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
17724
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
17725
+ if (t[2]) _.ops.pop();
17726
+ _.trys.pop(); continue;
17727
+ }
17728
+ op = body.call(thisArg, _);
17729
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
17730
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
17731
+ }
17732
+ };
17733
+ var __rest = (this && this.__rest) || function (s, e) {
17734
+ var t = {};
17735
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
17736
+ t[p] = s[p];
17737
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17738
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17739
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
17740
+ t[p[i]] = s[p[i]];
17741
+ }
17742
+ return t;
17743
+ };
17744
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17745
+ return (mod && mod.__esModule) ? mod : { "default": mod };
17746
+ };
17711
17747
  Object.defineProperty(exports, "__esModule", ({ value: true }));
17712
17748
  var BringgException_1 = __webpack_require__(43605);
17749
+ var CrudService_1 = __importDefault(__webpack_require__(14809));
17713
17750
  var RouteGenerator_1 = __webpack_require__(84075);
17714
17751
  var Route_1 = __webpack_require__(92641);
17715
- var SessionBasedService_1 = __webpack_require__(27826);
17716
- var RouteOptimizationApi = /** @class */ (function (_super) {
17717
- __extends(RouteOptimizationApi, _super);
17752
+ var RouteOptimizationApi = /** @class */ (function () {
17718
17753
  function RouteOptimizationApi(session) {
17719
- var _this = _super.call(this, session.config.getApiEndpoint(), session) || this;
17720
- _this.optimization = new Route_1.Route('/route_optimizations/optimize', 1 /* HttpMethod.POST */);
17721
- _this.optimization_v2 = new Route_1.Route('/own-fleet-optimization-service/route_optimization/optimize', 1 /* HttpMethod.POST */);
17722
- _this.get_optimization_result = new Route_1.Route('/route_optimizations/get_optimization_result/{:request_uuid}', 0 /* HttpMethod.GET */);
17723
- _this.get_optimization_result_v2 = new Route_1.Route('/own-fleet-optimization-service/route_optimization/get_optimization_result/{:request_uuid}', 0 /* HttpMethod.GET */);
17724
- _this.cancel_requests = new Route_1.Route('/route_optimizations/optimization', 4 /* HttpMethod.DELETE */);
17725
- _this.cancel_requests_v2 = new Route_1.Route('/own-fleet-optimization-service/route_optimization/optimization', 4 /* HttpMethod.DELETE */);
17726
- _this.assign_users_by_ids = new Route_1.Route('/route_optimizations/assign_users_by_ids', 1 /* HttpMethod.POST */);
17727
- _this.update_user_modified_data = new Route_1.Route('/route_optimizations/update_user_modified_data', 1 /* HttpMethod.POST */);
17728
- _this.update_user_modified_data_v2 = new Route_1.Route('/own-fleet-optimization-service/route_optimization/update_user_modified_data', 1 /* HttpMethod.POST */);
17729
- _this.assign_user_manual_optimization = new Route_1.Route('/route_optimizations/assign_user_manual_optimization', 1 /* HttpMethod.POST */);
17730
- return _this;
17754
+ this.optimization = new Route_1.Route('/route_optimizations/optimize', 1 /* HttpMethod.POST */);
17755
+ this.optimization_v2 = new Route_1.Route('/own-fleet-optimization-service/route_optimization/optimize', 1 /* HttpMethod.POST */);
17756
+ this.get_optimization_result = new Route_1.Route('/route_optimizations/get_optimization_result/{:request_uuid}', 0 /* HttpMethod.GET */);
17757
+ this.get_optimization_result_v2 = new Route_1.Route('/own-fleet-optimization-service/route_optimization/get_optimization_result/{:request_uuid}', 0 /* HttpMethod.GET */);
17758
+ this.cancel_requests = new Route_1.Route('/route_optimizations/optimization', 4 /* HttpMethod.DELETE */);
17759
+ this.cancel_requests_v2 = new Route_1.Route('/own-fleet-optimization-service/route_optimization/optimization', 4 /* HttpMethod.DELETE */);
17760
+ this.assign_users_by_ids = new Route_1.Route('/route_optimizations/assign_users_by_ids', 1 /* HttpMethod.POST */);
17761
+ this.update_user_modified_data = new Route_1.Route('/route_optimizations/update_user_modified_data', 1 /* HttpMethod.POST */);
17762
+ this.update_user_modified_data_v2 = new Route_1.Route('/own-fleet-optimization-service/route_optimization/update_user_modified_data', 1 /* HttpMethod.POST */);
17763
+ this.assign_user_manual_optimization = new Route_1.Route('/route_optimizations/assign_user_manual_optimization', 1 /* HttpMethod.POST */);
17764
+ this.service = new CrudService_1.default(session, '');
17731
17765
  }
17732
17766
  RouteOptimizationApi.prototype.cancelRequests = function (requestUuids, v2) {
17733
17767
  if (v2 === void 0) { v2 = false; }
17734
- return this.handleAuthorizedRequest({
17768
+ return this.service.handleAuthorizedRequest({
17735
17769
  route: v2 ? this.cancel_requests_v2 : this.cancel_requests,
17736
17770
  extractor: RouteGenerator_1.defaultExtractor,
17737
17771
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to call cancel optimization requests'),
@@ -17740,7 +17774,7 @@ var RouteOptimizationApi = /** @class */ (function (_super) {
17740
17774
  };
17741
17775
  RouteOptimizationApi.prototype.optimize = function (optimizationProps, v2) {
17742
17776
  if (v2 === void 0) { v2 = false; }
17743
- return this.handleAuthorizedRequest({
17777
+ return this.service.handleAuthorizedRequest({
17744
17778
  route: v2 ? this.optimization_v2 : this.optimization,
17745
17779
  extractor: RouteGenerator_1.defaultExtractor,
17746
17780
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to call optimization requests'),
@@ -17749,7 +17783,7 @@ var RouteOptimizationApi = /** @class */ (function (_super) {
17749
17783
  };
17750
17784
  RouteOptimizationApi.prototype.optimizationResult = function (request_uuid, v2) {
17751
17785
  if (v2 === void 0) { v2 = false; }
17752
- return this.handleAuthorizedRequest({
17786
+ return this.service.handleAuthorizedRequest({
17753
17787
  route: v2 ? this.get_optimization_result_v2 : this.get_optimization_result,
17754
17788
  extractor: RouteGenerator_1.defaultExtractor,
17755
17789
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to get optimization results'),
@@ -17757,7 +17791,7 @@ var RouteOptimizationApi = /** @class */ (function (_super) {
17757
17791
  });
17758
17792
  };
17759
17793
  RouteOptimizationApi.prototype.assignUsersByIds = function (teams) {
17760
- return this.handleAuthorizedRequest({
17794
+ return this.service.handleAuthorizedRequest({
17761
17795
  route: this.assign_users_by_ids,
17762
17796
  extractor: RouteGenerator_1.defaultExtractor,
17763
17797
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to assign users by id'),
@@ -17766,7 +17800,7 @@ var RouteOptimizationApi = /** @class */ (function (_super) {
17766
17800
  };
17767
17801
  RouteOptimizationApi.prototype.updateOptimizationModifiedData = function (updateData, v2) {
17768
17802
  if (v2 === void 0) { v2 = false; }
17769
- return this.handleAuthorizedRequest({
17803
+ return this.service.handleAuthorizedRequest({
17770
17804
  route: v2 ? this.update_user_modified_data_v2 : this.update_user_modified_data,
17771
17805
  extractor: RouteGenerator_1.defaultExtractor,
17772
17806
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to update optimization user data'),
@@ -17775,7 +17809,7 @@ var RouteOptimizationApi = /** @class */ (function (_super) {
17775
17809
  };
17776
17810
  RouteOptimizationApi.prototype.assignUserManualOptimization = function (updateData) {
17777
17811
  var fiveMinutesInMs = 1000 * 60 * 5;
17778
- return this.handleAuthorizedRequest({
17812
+ return this.service.handleAuthorizedRequest({
17779
17813
  route: this.assign_user_manual_optimization,
17780
17814
  extractor: RouteGenerator_1.defaultExtractor,
17781
17815
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to assign user manual optimization data'),
@@ -17783,8 +17817,40 @@ var RouteOptimizationApi = /** @class */ (function (_super) {
17783
17817
  timeout: fiveMinutesInMs
17784
17818
  });
17785
17819
  };
17820
+ RouteOptimizationApi.prototype.calculatePlannedEta = function (data, _a) {
17821
+ if (_a === void 0) { _a = {}; }
17822
+ var _b = _a.timeout, timeout = _b === void 0 ? 100000 : _b, options = __rest(_a, ["timeout"]);
17823
+ return __awaiter(this, void 0, void 0, function () {
17824
+ var payload, result, asyncResult;
17825
+ return __generator(this, function (_c) {
17826
+ switch (_c.label) {
17827
+ case 0:
17828
+ payload = {
17829
+ team_id: data.team_id,
17830
+ data: __assign(__assign({}, data), { apply: true, deadline: Date.now() + timeout })
17831
+ };
17832
+ return [4 /*yield*/, this.service.routeGenerator
17833
+ .post('/own-fleet-optimization-service/route_optimization/calculate_planned_eta')
17834
+ .withPayload(payload)
17835
+ .setException('Failed to calculate planned eta')
17836
+ .withCommonOptions(options)
17837
+ .invoke()];
17838
+ case 1:
17839
+ result = _c.sent();
17840
+ return [4 /*yield*/, this.service.session.sdk.asyncOperationStatus.waitForResponse({
17841
+ requestId: result.uuid,
17842
+ timeoutInMs: timeout,
17843
+ signal: options.signal
17844
+ })];
17845
+ case 2:
17846
+ asyncResult = _c.sent();
17847
+ return [2 /*return*/, asyncResult.data];
17848
+ }
17849
+ });
17850
+ });
17851
+ };
17786
17852
  return RouteOptimizationApi;
17787
- }(SessionBasedService_1.SessionBasedService));
17853
+ }());
17788
17854
  exports["default"] = RouteOptimizationApi;
17789
17855
  //# sourceMappingURL=RouteOptimizationApi.js.map
17790
17856
 
@@ -21495,7 +21561,7 @@ var lodash_1 = __webpack_require__(96486);
21495
21561
  var BringgException_1 = __webpack_require__(43605);
21496
21562
  var Logger_1 = __importDefault(__webpack_require__(55860));
21497
21563
  var abort_1 = __webpack_require__(34179);
21498
- var version = '8.27.0';
21564
+ var version = '8.29.0-pre';
21499
21565
  function logErrorResponse(response) {
21500
21566
  var data = response.data, status = response.status;
21501
21567
  try {
@@ -34776,7 +34842,18 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
34776
34842
  "use strict";
34777
34843
 
34778
34844
  Object.defineProperty(exports, "__esModule", ({ value: true }));
34779
- exports.PlannedTasksFilterOptions = exports.UnassignedFilterOptions = exports.ReadyForPickupFilterOptions = void 0;
34845
+ exports.PlannedTasksFilterOptions = exports.UnassignedFilterOptions = exports.ReadyForPickupFilterOptions = exports.GroupMode = void 0;
34846
+ var GroupMode;
34847
+ (function (GroupMode) {
34848
+ GroupMode["Driver"] = "Driver";
34849
+ GroupMode["Fleet"] = "Fleet";
34850
+ GroupMode["FleetTeam"] = "FleetTeam";
34851
+ GroupMode["None"] = "None";
34852
+ GroupMode["Route"] = "Route";
34853
+ GroupMode["Team"] = "Team";
34854
+ GroupMode["TeamDriver"] = "TeamDriver";
34855
+ GroupMode["TeamRoute"] = "TeamRoute";
34856
+ })(GroupMode || (exports.GroupMode = GroupMode = {}));
34780
34857
  var ReadyForPickupFilterOptions;
34781
34858
  (function (ReadyForPickupFilterOptions) {
34782
34859
  ReadyForPickupFilterOptions[ReadyForPickupFilterOptions["NOT_READY_FOR_PICKUP"] = 1] = "NOT_READY_FOR_PICKUP";