primarycare-binder 1.1.15 → 1.1.16

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.
Files changed (2) hide show
  1. package/dist/index.cjs.js +85 -18
  2. package/package.json +1 -1
package/dist/index.cjs.js CHANGED
@@ -13656,6 +13656,49 @@ var practitionerReducer$1 = practitionerReducer.reducer;
13656
13656
 
13657
13657
  var _extraReducers$x;
13658
13658
 
13659
+ var getLocationInfo$1 = /*#__PURE__*/function () {
13660
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(myLocation, city) {
13661
+ var obj,
13662
+ lat,
13663
+ _long,
13664
+ info,
13665
+ _args = arguments;
13666
+
13667
+ return regeneratorRuntime.wrap(function _callee$(_context) {
13668
+ while (1) {
13669
+ switch (_context.prev = _context.next) {
13670
+ case 0:
13671
+ obj = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
13672
+
13673
+ if (obj[city]) {
13674
+ _context.next = 7;
13675
+ break;
13676
+ }
13677
+
13678
+ lat = myLocation.lat, _long = myLocation["long"];
13679
+ _context.next = 5;
13680
+ return getLatLong(city);
13681
+
13682
+ case 5:
13683
+ info = _context.sent;
13684
+
13685
+ if (info.lat && info["long"]) {
13686
+ obj[city] = getDisctanceFromLatLonInKm(info.lat, info["long"], lat, _long);
13687
+ }
13688
+
13689
+ case 7:
13690
+ case "end":
13691
+ return _context.stop();
13692
+ }
13693
+ }
13694
+ }, _callee);
13695
+ }));
13696
+
13697
+ return function getLocationInfo(_x, _x2) {
13698
+ return _ref.apply(this, arguments);
13699
+ };
13700
+ }(); // DOCTER_LISTING
13701
+
13659
13702
 
13660
13703
  var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
13661
13704
  var payload,
@@ -13675,6 +13718,11 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13675
13718
  returnData,
13676
13719
  allLangs,
13677
13720
  allCities,
13721
+ _yield$getCurrentPosi,
13722
+ myLat,
13723
+ myLong,
13724
+ locationInfo,
13725
+ promArr,
13678
13726
  _args2 = arguments;
13679
13727
 
13680
13728
  return regeneratorRuntime.wrap(function _callee2$(_context2) {
@@ -13755,7 +13803,7 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13755
13803
  restData = _objectWithoutProperties(record, ["OrgType", "id", "_id", "displayresource"]);
13756
13804
 
13757
13805
  if (displayresource) {
13758
- var _OrgType$some, _restData$address, _restData$address$, _restData$hospital2, _restData$hospital2$a, _restData$hospital2$a2, _restData$locationID, _restData$hospital3, _OrgType$, _restData$hospital4, _restData$hospital4$O, _restData$hospital5;
13806
+ var _OrgType$some, _restData$address, _restData$address$cit, _restData$hospital2, _restData$hospital2$a, _restData$hospital2$a2, _restData$locationID, _restData$hospital3, _OrgType$, _restData$hospital4, _restData$hospital4$O, _restData$hospital5;
13759
13807
 
13760
13808
  var resourceInfo = {
13761
13809
  resourcetype: "",
@@ -13807,7 +13855,7 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13807
13855
  // isClinic,
13808
13856
  // );
13809
13857
 
13810
- var city = (restData === null || restData === void 0 ? void 0 : (_restData$address = restData.address) === null || _restData$address === void 0 ? void 0 : (_restData$address$ = _restData$address[0]) === null || _restData$address$ === void 0 ? void 0 : _restData$address$.city) || (restData === null || restData === void 0 ? void 0 : (_restData$hospital2 = restData.hospital) === null || _restData$hospital2 === void 0 ? void 0 : (_restData$hospital2$a = _restData$hospital2.address) === null || _restData$hospital2$a === void 0 ? void 0 : (_restData$hospital2$a2 = _restData$hospital2$a[0]) === null || _restData$hospital2$a2 === void 0 ? void 0 : _restData$hospital2$a2.city) || "";
13858
+ var city = (restData === null || restData === void 0 ? void 0 : (_restData$address = restData.address) === null || _restData$address === void 0 ? void 0 : (_restData$address$cit = _restData$address.city) === null || _restData$address$cit === void 0 ? void 0 : _restData$address$cit.geogLevelName) || (restData === null || restData === void 0 ? void 0 : (_restData$hospital2 = restData.hospital) === null || _restData$hospital2 === void 0 ? void 0 : (_restData$hospital2$a = _restData$hospital2.address) === null || _restData$hospital2$a === void 0 ? void 0 : (_restData$hospital2$a2 = _restData$hospital2$a.city) === null || _restData$hospital2$a2 === void 0 ? void 0 : _restData$hospital2$a2.geogLevelName) || "";
13811
13859
  allCities.add(city);
13812
13860
  var info = {
13813
13861
  clinicId: (restData === null || restData === void 0 ? void 0 : (_restData$locationID = restData.locationID) === null || _restData$locationID === void 0 ? void 0 : _restData$locationID.id) || 0,
@@ -13941,39 +13989,58 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13941
13989
  }
13942
13990
  }
13943
13991
  });
13944
- } // const {
13945
- // lat: myLat,
13946
- // long: myLong,
13947
- // } = getCurrentPosition();
13948
- // const locationInfo = {};
13949
- // if (myLat && myLong) {
13950
- // const promArr = [...allCities].map(city => getLocationInfo({lat: myLat, long: myLong}, city, locationInfo));
13951
- // await Promise.all(promArr);
13952
- // returnData.forEach(d => {
13953
- // d.kms = locationInfo[d.city] || "0 Kms";
13954
- // })
13955
- // }
13992
+ }
13993
+
13994
+ _context2.next = 19;
13995
+ return getCurrentPosition();
13996
+
13997
+ case 19:
13998
+ _yield$getCurrentPosi = _context2.sent;
13999
+ myLat = _yield$getCurrentPosi.lat;
14000
+ myLong = _yield$getCurrentPosi["long"];
14001
+ locationInfo = {};
13956
14002
 
14003
+ if (!(myLat && myLong)) {
14004
+ _context2.next = 28;
14005
+ break;
14006
+ }
13957
14007
 
14008
+ promArr = _toConsumableArray(allCities).filter(function (c) {
14009
+ return !!c;
14010
+ }).map(function (city) {
14011
+ return getLocationInfo$1({
14012
+ lat: myLat,
14013
+ "long": myLong
14014
+ }, city, locationInfo);
14015
+ });
14016
+ _context2.next = 27;
14017
+ return es6Promise.Promise.all(promArr);
14018
+
14019
+ case 27:
14020
+ returnData.forEach(function (d) {
14021
+ d.kms = locationInfo[d.city] || "0 Kms";
14022
+ });
14023
+
14024
+ case 28:
13958
14025
  return _context2.abrupt("return", _objectSpread2(_objectSpread2({}, defaultState.Info), {}, {
13959
14026
  data: returnData,
13960
14027
  allLangs: _toConsumableArray(allLangs)
13961
14028
  }));
13962
14029
 
13963
- case 20:
13964
- _context2.prev = 20;
14030
+ case 31:
14031
+ _context2.prev = 31;
13965
14032
  _context2.t0 = _context2["catch"](2);
13966
14033
  console.log(_context2.t0);
13967
14034
  return _context2.abrupt("return", rejectWithValue(_objectSpread2(_objectSpread2({}, defaultReject), {}, {
13968
14035
  message: _context2.t0.message
13969
14036
  })));
13970
14037
 
13971
- case 24:
14038
+ case 35:
13972
14039
  case "end":
13973
14040
  return _context2.stop();
13974
14041
  }
13975
14042
  }
13976
- }, _callee2, null, [[2, 20]]);
14043
+ }, _callee2, null, [[2, 31]]);
13977
14044
  }))); // end
13978
14045
  // FUZZY SEARCH CREATE INITIALSTATE
13979
14046
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primarycare-binder",
3
- "version": "1.1.15",
3
+ "version": "1.1.16",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",