@bringg/dashboard-sdk 9.18.0 → 9.19.0-pre.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.
@@ -7724,10 +7724,10 @@ var StorableRealtimeSubscriptions = /** @class */ (function () {
7724
7724
  finally { if (e_1) throw e_1.error; }
7725
7725
  }
7726
7726
  var _loop_2 = function (subEntityEvent) {
7727
- this_2.realtimeSubscriptions.subscribe(subEntityEvent.name, function (subEntity) {
7728
- subEntityEvent.ignoreFields.forEach(function (field) { return delete subEntity[field]; });
7729
- var eventChangeData = _this.changeSubEntity(subEntity, subEntityEvent.parentField, subEntityEvent.field, subEntityEvent.isDelete);
7730
- if (eventChangeData.current) {
7727
+ this_2.realtimeSubscriptions.subscribe(subEntityEvent.name, function (subEntityEventData) {
7728
+ subEntityEvent.ignoreFields.forEach(function (field) { return delete subEntityEventData[field]; });
7729
+ var eventChangeData = _this.changeSubEntity(subEntityEventData, subEntityEvent.idField || 'id', subEntityEvent.parentField, subEntityEvent.field, subEntityEvent.isDelete);
7730
+ if (eventChangeData === null || eventChangeData === void 0 ? void 0 : eventChangeData.current) {
7731
7731
  _this.runEventCallbacks(subEntityEvent.eventToRaise, eventChangeData);
7732
7732
  }
7733
7733
  });
@@ -7764,44 +7764,44 @@ var StorableRealtimeSubscriptions = /** @class */ (function () {
7764
7764
  StorableRealtimeSubscriptions.prototype.runEventCallbacks = function (event, data) {
7765
7765
  (this.eventCallbacks[event] || []).forEach(function (callback) { return callback(data); });
7766
7766
  };
7767
- StorableRealtimeSubscriptions.prototype.changeSubEntity = function (subEntity, parentField, containerField, isDelete) {
7767
+ StorableRealtimeSubscriptions.prototype.changeSubEntity = function (subEntity, idField, parentField, containerField, isDelete) {
7768
7768
  var _a, _b, _c;
7769
7769
  var current = this.dataStore.get(subEntity[parentField]);
7770
7770
  var diff;
7771
7771
  if (current) {
7772
- if (!current[containerField]) {
7773
- current[containerField] = [];
7774
- }
7775
- var existingIndex = current[containerField].findIndex(function (taskSubEntity) { return taskSubEntity.id === subEntity.id; });
7772
+ var existingIndex = current[containerField]
7773
+ ? current[containerField].findIndex(function (taskSubEntity) { return taskSubEntity.id === subEntity[idField]; })
7774
+ : -1;
7776
7775
  if (existingIndex > -1) {
7777
7776
  if (isDelete) {
7778
- diff = (_a = { id: current.id }, _a[containerField] = this.createArrayOfEmptyObjects(existingIndex), _a);
7779
- for (var i = existingIndex + 1; i < current[containerField].length; i++) {
7777
+ diff = (_a = {}, _a[containerField] = this.createArrayOfEmptyObjects(existingIndex), _a);
7778
+ for (var i = existingIndex; i < current[containerField].length; i++) {
7780
7779
  diff[containerField].push(current[containerField][i]);
7781
7780
  }
7782
7781
  current[containerField].splice(existingIndex, 1);
7783
7782
  }
7784
7783
  else {
7785
7784
  var subEntityDiff = object_merger_1.objectMerger.deepMerge(current[containerField][existingIndex], subEntity);
7786
- diff = (_b = {
7787
- id: current.id
7788
- },
7785
+ diff = (_b = {},
7789
7786
  _b[containerField] = this.createArrayOfEmptyObjects(current[containerField].length),
7790
7787
  _b);
7791
7788
  diff[containerField][existingIndex] = subEntityDiff;
7792
7789
  }
7793
7790
  }
7794
7791
  else if (!isDelete) {
7795
- diff = (_c = {
7796
- id: current.id
7797
- },
7792
+ if (!current[containerField]) {
7793
+ current[containerField] = [];
7794
+ }
7795
+ diff = (_c = {},
7798
7796
  _c[containerField] = this.createArrayOfEmptyObjects(current[containerField].length),
7799
7797
  _c);
7800
7798
  diff[containerField].push(subEntity);
7801
7799
  current[containerField].push(subEntity);
7802
7800
  }
7803
7801
  }
7804
- return { current: current, diff: diff };
7802
+ if (diff) {
7803
+ return { current: current, diff: diff };
7804
+ }
7805
7805
  };
7806
7806
  StorableRealtimeSubscriptions.prototype.createArrayOfEmptyObjects = function (length) {
7807
7807
  return Array.from({ length: length }, function () { return ({}); });
@@ -11632,12 +11632,26 @@ var Lookup = /** @class */ (function () {
11632
11632
  });
11633
11633
  });
11634
11634
  };
11635
+ /**
11636
+ * @deprecated Please use the getTasksByExternalIds method instead
11637
+ */
11635
11638
  Lookup.prototype.getTasks = function (query, commonOptions) {
11636
11639
  if (commonOptions === void 0) { commonOptions = {}; }
11637
11640
  return __awaiter(this, void 0, void 0, function () {
11638
11641
  return __generator(this, function (_a) {
11639
11642
  switch (_a.label) {
11640
- case 0: return [4 /*yield*/, this.lookUpEntity.getTasks(query, commonOptions)];
11643
+ case 0: return [4 /*yield*/, this.lookUpEntity.getTasksByExternalId(query, commonOptions)];
11644
+ case 1: return [2 /*return*/, _a.sent()];
11645
+ }
11646
+ });
11647
+ });
11648
+ };
11649
+ Lookup.prototype.getTasksByExternalIds = function (query, commonOptions) {
11650
+ if (commonOptions === void 0) { commonOptions = {}; }
11651
+ return __awaiter(this, void 0, void 0, function () {
11652
+ return __generator(this, function (_a) {
11653
+ switch (_a.label) {
11654
+ case 0: return [4 /*yield*/, this.lookUpEntity.getTasksByExternalId(query, commonOptions)];
11641
11655
  case 1: return [2 /*return*/, _a.sent()];
11642
11656
  }
11643
11657
  });
@@ -11665,6 +11679,74 @@ var Lookup = /** @class */ (function () {
11665
11679
  });
11666
11680
  });
11667
11681
  };
11682
+ // ----- WayPoint
11683
+ Lookup.prototype.getWaypointZipcodes = function (query, commonOptions) {
11684
+ if (commonOptions === void 0) { commonOptions = {}; }
11685
+ return __awaiter(this, void 0, void 0, function () {
11686
+ return __generator(this, function (_a) {
11687
+ switch (_a.label) {
11688
+ case 0: return [4 /*yield*/, this.lookUpEntity.getWaypointZipcodes(query, commonOptions)];
11689
+ case 1: return [2 /*return*/, _a.sent()];
11690
+ }
11691
+ });
11692
+ });
11693
+ };
11694
+ Lookup.prototype.getWaypointAddresses = function (query, commonOptions) {
11695
+ if (commonOptions === void 0) { commonOptions = {}; }
11696
+ return __awaiter(this, void 0, void 0, function () {
11697
+ return __generator(this, function (_a) {
11698
+ switch (_a.label) {
11699
+ case 0: return [4 /*yield*/, this.lookUpEntity.getWaypointAddresses(query, commonOptions)];
11700
+ case 1: return [2 /*return*/, _a.sent()];
11701
+ }
11702
+ });
11703
+ });
11704
+ };
11705
+ Lookup.prototype.getWaypointCities = function (query, commonOptions) {
11706
+ if (commonOptions === void 0) { commonOptions = {}; }
11707
+ return __awaiter(this, void 0, void 0, function () {
11708
+ return __generator(this, function (_a) {
11709
+ switch (_a.label) {
11710
+ case 0: return [4 /*yield*/, this.lookUpEntity.getWaypointCities(query, commonOptions)];
11711
+ case 1: return [2 /*return*/, _a.sent()];
11712
+ }
11713
+ });
11714
+ });
11715
+ };
11716
+ // ----- Customer
11717
+ Lookup.prototype.getCustomerNames = function (query, commonOptions) {
11718
+ if (commonOptions === void 0) { commonOptions = {}; }
11719
+ return __awaiter(this, void 0, void 0, function () {
11720
+ return __generator(this, function (_a) {
11721
+ switch (_a.label) {
11722
+ case 0: return [4 /*yield*/, this.lookUpEntity.getCustomerNames(query, commonOptions)];
11723
+ case 1: return [2 /*return*/, _a.sent()];
11724
+ }
11725
+ });
11726
+ });
11727
+ };
11728
+ Lookup.prototype.getCustomerPhones = function (query, commonOptions) {
11729
+ if (commonOptions === void 0) { commonOptions = {}; }
11730
+ return __awaiter(this, void 0, void 0, function () {
11731
+ return __generator(this, function (_a) {
11732
+ switch (_a.label) {
11733
+ case 0: return [4 /*yield*/, this.lookUpEntity.getCustomerPhones(query, commonOptions)];
11734
+ case 1: return [2 /*return*/, _a.sent()];
11735
+ }
11736
+ });
11737
+ });
11738
+ };
11739
+ Lookup.prototype.getCustomerOriginalPhones = function (query, commonOptions) {
11740
+ if (commonOptions === void 0) { commonOptions = {}; }
11741
+ return __awaiter(this, void 0, void 0, function () {
11742
+ return __generator(this, function (_a) {
11743
+ switch (_a.label) {
11744
+ case 0: return [4 /*yield*/, this.lookUpEntity.getCustomerOriginalPhones(query, commonOptions)];
11745
+ case 1: return [2 /*return*/, _a.sent()];
11746
+ }
11747
+ });
11748
+ });
11749
+ };
11668
11750
  return Lookup;
11669
11751
  }());
11670
11752
  exports["default"] = Lookup;
@@ -11723,9 +11805,15 @@ var baseRoute = '/lookup-service';
11723
11805
  exports.Routes = {
11724
11806
  GET_USERS: "".concat(baseRoute, "/user"),
11725
11807
  GET_RUNS: "".concat(baseRoute, "/run"),
11726
- GET_TASKS: "".concat(baseRoute, "/task"),
11808
+ GET_TASKS_BY_EXTERNAL_ID: "".concat(baseRoute, "/task/external-id"),
11727
11809
  GET_PLANNED_ROUTES: "".concat(baseRoute, "/planned-route"),
11728
- GET_TEAMS: "".concat(baseRoute, "/team")
11810
+ GET_TEAMS: "".concat(baseRoute, "/team"),
11811
+ GET_WAYPOINT_ZIPCODE: "".concat(baseRoute, "/waypoint/zipcode"),
11812
+ GET_WAYPOINT_ADDRESS: "".concat(baseRoute, "/waypoint/address"),
11813
+ GET_WAYPOINT_CITY: "".concat(baseRoute, "/waypoint/city"),
11814
+ GET_CUSTOMER_NAMES: "".concat(baseRoute, "/customer/name"),
11815
+ GET_CUSTOMER_PHONES: "".concat(baseRoute, "/customer/phone"),
11816
+ GET_CUSTOMER_ORIGINAL_PHONES: "".concat(baseRoute, "/customer/original-phone-number")
11729
11817
  };
11730
11818
  var LookupService = /** @class */ (function () {
11731
11819
  function LookupService(session) {
@@ -11755,11 +11843,11 @@ var LookupService = /** @class */ (function () {
11755
11843
  });
11756
11844
  });
11757
11845
  };
11758
- LookupService.prototype.getTasks = function (query, commonOptions) {
11846
+ LookupService.prototype.getTasksByExternalId = function (query, commonOptions) {
11759
11847
  return __awaiter(this, void 0, void 0, function () {
11760
11848
  return __generator(this, function (_a) {
11761
11849
  return [2 /*return*/, this.service.routeGenerator
11762
- .get(exports.Routes.GET_TASKS)
11850
+ .get(exports.Routes.GET_TASKS_BY_EXTERNAL_ID)
11763
11851
  .withQueryString(query)
11764
11852
  .setException('Failed to get tasks from lookup service')
11765
11853
  .withCommonOptions(commonOptions)
@@ -11791,6 +11879,80 @@ var LookupService = /** @class */ (function () {
11791
11879
  });
11792
11880
  });
11793
11881
  };
11882
+ // ---- Waypoints
11883
+ LookupService.prototype.getWaypointZipcodes = function (query, commonOptions) {
11884
+ return __awaiter(this, void 0, void 0, function () {
11885
+ return __generator(this, function (_a) {
11886
+ return [2 /*return*/, this.service.routeGenerator
11887
+ .get(exports.Routes.GET_WAYPOINT_ZIPCODE)
11888
+ .withQueryString(query)
11889
+ .setException('Failed to get waypoint zipcodes from lookup service')
11890
+ .withCommonOptions(commonOptions)
11891
+ .invoke()];
11892
+ });
11893
+ });
11894
+ };
11895
+ LookupService.prototype.getWaypointAddresses = function (query, commonOptions) {
11896
+ return __awaiter(this, void 0, void 0, function () {
11897
+ return __generator(this, function (_a) {
11898
+ return [2 /*return*/, this.service.routeGenerator
11899
+ .get(exports.Routes.GET_WAYPOINT_ADDRESS)
11900
+ .withQueryString(query)
11901
+ .setException('Failed to get waypoint addresses from lookup service')
11902
+ .withCommonOptions(commonOptions)
11903
+ .invoke()];
11904
+ });
11905
+ });
11906
+ };
11907
+ LookupService.prototype.getWaypointCities = function (query, commonOptions) {
11908
+ return __awaiter(this, void 0, void 0, function () {
11909
+ return __generator(this, function (_a) {
11910
+ return [2 /*return*/, this.service.routeGenerator
11911
+ .get(exports.Routes.GET_WAYPOINT_CITY)
11912
+ .withQueryString(query)
11913
+ .setException('Failed to get waypoint cities from lookup service')
11914
+ .withCommonOptions(commonOptions)
11915
+ .invoke()];
11916
+ });
11917
+ });
11918
+ };
11919
+ // ---- Customer
11920
+ LookupService.prototype.getCustomerNames = function (query, commonOptions) {
11921
+ return __awaiter(this, void 0, void 0, function () {
11922
+ return __generator(this, function (_a) {
11923
+ return [2 /*return*/, this.service.routeGenerator
11924
+ .get(exports.Routes.GET_CUSTOMER_NAMES)
11925
+ .withQueryString(query)
11926
+ .setException('Failed to get customer names from lookup service')
11927
+ .withCommonOptions(commonOptions)
11928
+ .invoke()];
11929
+ });
11930
+ });
11931
+ };
11932
+ LookupService.prototype.getCustomerPhones = function (query, commonOptions) {
11933
+ return __awaiter(this, void 0, void 0, function () {
11934
+ return __generator(this, function (_a) {
11935
+ return [2 /*return*/, this.service.routeGenerator
11936
+ .get(exports.Routes.GET_CUSTOMER_PHONES)
11937
+ .withQueryString(query)
11938
+ .setException('Failed to get customer phones from lookup service')
11939
+ .withCommonOptions(commonOptions)
11940
+ .invoke()];
11941
+ });
11942
+ });
11943
+ };
11944
+ LookupService.prototype.getCustomerOriginalPhones = function (query, commonOptions) {
11945
+ return __awaiter(this, void 0, void 0, function () {
11946
+ return __generator(this, function (_a) {
11947
+ return [2 /*return*/, this.service.routeGenerator
11948
+ .get(exports.Routes.GET_CUSTOMER_ORIGINAL_PHONES)
11949
+ .withQueryString(query)
11950
+ .setException('Failed to get customer original phones from lookup service')
11951
+ .withCommonOptions(commonOptions)
11952
+ .invoke()];
11953
+ });
11954
+ });
11955
+ };
11794
11956
  return LookupService;
11795
11957
  }());
11796
11958
  exports["default"] = LookupService;
@@ -22361,7 +22523,7 @@ var lodash_1 = __webpack_require__(96486);
22361
22523
  var BringgException_1 = __webpack_require__(43605);
22362
22524
  var Logger_1 = __importDefault(__webpack_require__(55860));
22363
22525
  var abort_1 = __webpack_require__(34179);
22364
- var version = '9.18.0';
22526
+ var version = '9.19.0-pre.0';
22365
22527
  function logErrorResponse(response) {
22366
22528
  var data = response.data, status = response.status;
22367
22529
  try {
@@ -25156,6 +25318,7 @@ var TaskRealtimeSubscriptions = /** @class */ (function () {
25156
25318
  {
25157
25319
  name: Tasks_consts_1.TaskRealTimeEvents.WAYPOINT_DELETED,
25158
25320
  eventToRaise: Tasks_consts_1.TaskRealTimeEvents.TASK_UPDATE,
25321
+ idField: 'way_point_id',
25159
25322
  parentField: 'task_id',
25160
25323
  field: 'way_points',
25161
25324
  ignoreFields: ['way_points'],