@bringg/dashboard-sdk 9.62.0 → 9.62.1-pre.1

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.
@@ -3,10 +3,13 @@ import Session from '../Services/Identity/Session';
3
3
  export default class GeocodingApi {
4
4
  private geocodingEntity;
5
5
  private realTime;
6
+ private eventHandlers;
7
+ private isGeocodingChangedSubscribed;
8
+ private onGeocodingChanged;
6
9
  constructor(session: Session);
7
10
  autoComplete(address: string): Promise<AutoCompleteResponse>;
8
11
  getPlaceDetails(placeId: string): Promise<GetPlaceDetailsResponse>;
9
12
  reverseGeocode(lat: number, lng: number): Promise<BringgReverseGeocodedAddress>;
10
- subscribeToEvent(eventHandle: any): void;
11
- unsubscribeToEvent(eventHandle: any): void;
13
+ subscribeToEvent(eventHandle: (event: unknown) => void): void;
14
+ unsubscribeToEvent(eventHandle: (event: unknown) => void): void;
12
15
  }
@@ -8,6 +8,12 @@ var Geocoding_1 = __importDefault(require("./Entity/Geocoding"));
8
8
  var Geocoding_consts_1 = require("./Geocoding.consts");
9
9
  var GeocodingApi = /** @class */ (function () {
10
10
  function GeocodingApi(session) {
11
+ var _this = this;
12
+ this.eventHandlers = new Set();
13
+ this.isGeocodingChangedSubscribed = false;
14
+ this.onGeocodingChanged = function (event) {
15
+ _this.eventHandlers.forEach(function (handler) { return handler(event); });
16
+ };
11
17
  this.geocodingEntity = new Geocoding_1.default(session);
12
18
  this.realTime = new StoreEntity_1.RealTimeHandler(session.persistentConnection);
13
19
  }
@@ -21,10 +27,14 @@ var GeocodingApi = /** @class */ (function () {
21
27
  return this.geocodingEntity.reverseGeocode(lat, lng);
22
28
  };
23
29
  GeocodingApi.prototype.subscribeToEvent = function (eventHandle) {
24
- return this.realTime.on(Geocoding_consts_1.RealTimeGeocodingEvents.GEOCODING_CHANGED, eventHandle);
30
+ this.eventHandlers.add(eventHandle);
31
+ if (!this.isGeocodingChangedSubscribed) {
32
+ this.realTime.on(Geocoding_consts_1.RealTimeGeocodingEvents.GEOCODING_CHANGED, this.onGeocodingChanged);
33
+ this.isGeocodingChangedSubscribed = true;
34
+ }
25
35
  };
26
36
  GeocodingApi.prototype.unsubscribeToEvent = function (eventHandle) {
27
- this.realTime.off(Geocoding_consts_1.RealTimeGeocodingEvents.GEOCODING_CHANGED, eventHandle);
37
+ this.eventHandlers.delete(eventHandle);
28
38
  };
29
39
  return GeocodingApi;
30
40
  }());
@@ -1 +1 @@
1
- {"version":3,"file":"GeocodingApi.js","sourceRoot":"","sources":["../../src/Geocoding/GeocodingApi.ts"],"names":[],"mappings":";;;;;AAEA,mDAAsD;AAEtD,iEAA2C;AAC3C,uDAA6D;AAE7D;IAIC,sBAAY,OAAgB;QAC3B,IAAI,CAAC,eAAe,GAAG,IAAI,mBAAS,CAAC,OAAO,CAAC,CAAC;QAC9C,IAAI,CAAC,QAAQ,GAAG,IAAI,6BAAe,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACnE,CAAC;IAEM,mCAAY,GAAnB,UAAoB,OAAe;QAClC,OAAO,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACnD,CAAC;IAEM,sCAAe,GAAtB,UAAuB,OAAe;QACrC,OAAO,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;IAEM,qCAAc,GAArB,UAAsB,GAAW,EAAE,GAAW;QAC7C,OAAO,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACtD,CAAC;IAEM,uCAAgB,GAAvB,UAAwB,WAAgB;QACvC,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,0CAAuB,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;IACjF,CAAC;IAEM,yCAAkB,GAAzB,UAA0B,WAAgB;QACzC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,0CAAuB,CAAC,iBAAiB,EAAE,WAAW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CAAC,kBAAkB,CAAC,CAAC;YACrF,IAAI,CAAC,4BAA4B,GAAG,IAAI,CAAC;SACzC;IACF,CAAC;IAEM,yCAAkB,GAAzB,UAA0B,WAAqC;QAC9D,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACxC,CAAC;IACF,mBAAC;AAAD,CAAC,AAvCD,IAuCC"}
@@ -56,7 +56,7 @@ var lodash_1 = require("lodash");
56
56
  var BringgException_1 = require("../Core/BringgException");
57
57
  var Logger_1 = __importDefault(require("../Core/Logger"));
58
58
  var abort_1 = require("../utils/abort");
59
- var version = '9.62.0';
59
+ var version = '9.62.1-pre.1';
60
60
  function logErrorResponse(response) {
61
61
  var data = response.data, status = response.status;
62
62
  try {
@@ -11221,6 +11221,12 @@ var Geocoding_1 = __importDefault(__webpack_require__(84431));
11221
11221
  var Geocoding_consts_1 = __webpack_require__(29091);
11222
11222
  var GeocodingApi = /** @class */ (function () {
11223
11223
  function GeocodingApi(session) {
11224
+ var _this = this;
11225
+ this.eventHandlers = new Set();
11226
+ this.isGeocodingChangedSubscribed = false;
11227
+ this.onGeocodingChanged = function (event) {
11228
+ _this.eventHandlers.forEach(function (handler) { return handler(event); });
11229
+ };
11224
11230
  this.geocodingEntity = new Geocoding_1.default(session);
11225
11231
  this.realTime = new StoreEntity_1.RealTimeHandler(session.persistentConnection);
11226
11232
  }
@@ -11234,10 +11240,14 @@ var GeocodingApi = /** @class */ (function () {
11234
11240
  return this.geocodingEntity.reverseGeocode(lat, lng);
11235
11241
  };
11236
11242
  GeocodingApi.prototype.subscribeToEvent = function (eventHandle) {
11237
- return this.realTime.on(Geocoding_consts_1.RealTimeGeocodingEvents.GEOCODING_CHANGED, eventHandle);
11243
+ this.eventHandlers.add(eventHandle);
11244
+ if (!this.isGeocodingChangedSubscribed) {
11245
+ this.realTime.on(Geocoding_consts_1.RealTimeGeocodingEvents.GEOCODING_CHANGED, this.onGeocodingChanged);
11246
+ this.isGeocodingChangedSubscribed = true;
11247
+ }
11238
11248
  };
11239
11249
  GeocodingApi.prototype.unsubscribeToEvent = function (eventHandle) {
11240
- this.realTime.off(Geocoding_consts_1.RealTimeGeocodingEvents.GEOCODING_CHANGED, eventHandle);
11250
+ this.eventHandlers.delete(eventHandle);
11241
11251
  };
11242
11252
  return GeocodingApi;
11243
11253
  }());
@@ -23291,7 +23301,7 @@ var lodash_1 = __webpack_require__(96486);
23291
23301
  var BringgException_1 = __webpack_require__(43605);
23292
23302
  var Logger_1 = __importDefault(__webpack_require__(55860));
23293
23303
  var abort_1 = __webpack_require__(34179);
23294
- var version = '9.62.0';
23304
+ var version = '9.62.1-pre.1';
23295
23305
  function logErrorResponse(response) {
23296
23306
  var data = response.data, status = response.status;
23297
23307
  try {