primarycare-binder 1.1.41 → 1.1.42

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 +551 -477
  2. package/package.json +1 -1
package/dist/index.cjs.js CHANGED
@@ -8391,6 +8391,271 @@ var urls = (_urls = {
8391
8391
  get_hospitals_locality: "/api/v1/getHospitalBasedonLocality"
8392
8392
  }, _defineProperty(_urls, "get_cities", "/api/v1/getCityFromHospital"), _defineProperty(_urls, "get_symptoms", "/api/v1/getSymptoms"), _defineProperty(_urls, "get_speciality", "/api/v1/getSpeciality"), _defineProperty(_urls, "upsert_service", "/api/v1/upsertService"), _defineProperty(_urls, "read_service", "/api/v1/readService"), _defineProperty(_urls, "delete_service", "/api/v1/deleteService"), _defineProperty(_urls, "upsert_slot", "/api/v1/upsertSlot"), _defineProperty(_urls, "read_slot", "api/v1/readSlot"), _defineProperty(_urls, "delete_slot", "api/v1/deleteSlot"), _defineProperty(_urls, "slot_availability", "api/v1/readAvailibalityChecking"), _defineProperty(_urls, "upsert_task", "api/v1/upsertTask"), _defineProperty(_urls, "read_task", "api/v1/readTask"), _defineProperty(_urls, "delete_task", "api/v1/deleteTask"), _defineProperty(_urls, "upsert_schedule", "api/v1/upsertSchedule"), _defineProperty(_urls, "read_schedule", "api/v1/readSchedule"), _defineProperty(_urls, "delete_schedule", "api/v1/deleteSchedule"), _defineProperty(_urls, "upsert_person", "api/v1/upsertPerson"), _defineProperty(_urls, "read_person", "api/v1/readPerson"), _defineProperty(_urls, "delete_person", "api/v1/deletePerson"), _defineProperty(_urls, "upsert_practitioner_role", "api/v1/upsertPractitionerRole"), _defineProperty(_urls, "read_practitioner_role", "api/v1/readPractitionerRole"), _defineProperty(_urls, "delete_practitioner_role", "api/v1/deletePractitionerRole"), _defineProperty(_urls, "get_user_info", "api/v1/getUserInfo"), _defineProperty(_urls, "oraganization_registration", "api/v1/orgUserRegistration"), _defineProperty(_urls, "oraganization_siginIn", "".concat(__keyClockLogin__, "/api/v1/orgUserSignIn")), _defineProperty(_urls, "oraganization_registet_patient", "api/v1/upsert_document"), _urls);
8393
8393
 
8394
+ var makeName = function makeName() {
8395
+ var _prefix$coding, _prefix$coding$, _suffix$coding, _suffix$coding$;
8396
+
8397
+ var nameObj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8398
+ var _nameObj$prefix = nameObj.prefix,
8399
+ prefix = _nameObj$prefix === void 0 ? "" : _nameObj$prefix,
8400
+ _nameObj$text = nameObj.text,
8401
+ text = _nameObj$text === void 0 ? "" : _nameObj$text,
8402
+ _nameObj$given = nameObj.given,
8403
+ given = _nameObj$given === void 0 ? "" : _nameObj$given,
8404
+ _nameObj$family = nameObj.family,
8405
+ family = _nameObj$family === void 0 ? "" : _nameObj$family,
8406
+ _nameObj$suffix = nameObj.suffix,
8407
+ suffix = _nameObj$suffix === void 0 ? "" : _nameObj$suffix;
8408
+ var prefixVal = (prefix === null || prefix === void 0 ? void 0 : (_prefix$coding = prefix.coding) === null || _prefix$coding === void 0 ? void 0 : (_prefix$coding$ = _prefix$coding[0]) === null || _prefix$coding$ === void 0 ? void 0 : _prefix$coding$.display) || "";
8409
+ var suffixVal = (suffix === null || suffix === void 0 ? void 0 : (_suffix$coding = suffix.coding) === null || _suffix$coding === void 0 ? void 0 : (_suffix$coding$ = _suffix$coding[0]) === null || _suffix$coding$ === void 0 ? void 0 : _suffix$coding$.display) || "";
8410
+ return "".concat(prefixVal && prefixVal + ".").concat(text && text + " ").concat(given && given + " ").concat(family && family + " ").concat(suffixVal && suffixVal);
8411
+ };
8412
+
8413
+ var fetchData$3 = /*#__PURE__*/function () {
8414
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(input) {
8415
+ var url,
8416
+ __options,
8417
+ res,
8418
+ data,
8419
+ _args = arguments;
8420
+
8421
+ return regeneratorRuntime.wrap(function _callee$(_context) {
8422
+ while (1) {
8423
+ switch (_context.prev = _context.next) {
8424
+ case 0:
8425
+ url = _args.length > 1 && _args[1] !== undefined ? _args[1] : __baseUrl__;
8426
+ __options = {
8427
+ method: "POST",
8428
+ headers: {
8429
+ "Content-Type": "application/json"
8430
+ },
8431
+ body: {}
8432
+ };
8433
+ _context.next = 4;
8434
+ return fetch(url, _objectSpread2(_objectSpread2({}, __options), input));
8435
+
8436
+ case 4:
8437
+ res = _context.sent;
8438
+ _context.next = 7;
8439
+ return res.json();
8440
+
8441
+ case 7:
8442
+ data = _context.sent;
8443
+ return _context.abrupt("return", data);
8444
+
8445
+ case 9:
8446
+ case "end":
8447
+ return _context.stop();
8448
+ }
8449
+ }
8450
+ }, _callee);
8451
+ }));
8452
+
8453
+ return function fetchData(_x) {
8454
+ return _ref3.apply(this, arguments);
8455
+ };
8456
+ }();
8457
+
8458
+ var getImgUrl = function getImgUrl(fileId) {
8459
+ return fileId ? "".concat(__imgdownloadBaseUrl__).concat(fileId) : "";
8460
+ };
8461
+
8462
+ var getUtcTime = function getUtcTime(date) {
8463
+ if (date) {
8464
+ return moment.utc(date).unix();
8465
+ } else {
8466
+ return moment.utc().unix();
8467
+ }
8468
+ };
8469
+
8470
+ var utcTOLocal$1 = function utcTOLocal(date, format) {
8471
+ var Ndate = new Date();
8472
+
8473
+ if (typeof date === "number") {
8474
+ Ndate = moment.unix(date);
8475
+ } else {
8476
+ Ndate = moment(date);
8477
+ }
8478
+
8479
+ var fmt = format ? format : "DD-MM-YYYY";
8480
+ return moment.utc(Ndate).local().format(fmt);
8481
+ }; // const getUtcTime = (date) => {
8482
+ // let a = null
8483
+ // if (date) {
8484
+ // a = new Date(date)
8485
+ // } else {
8486
+ // a = new Date()
8487
+ // }
8488
+ // a = a.toUTCString()
8489
+ // return ((new Date(a).getTime())/1000)
8490
+ // };
8491
+ // const utcTOLocal = (date, format) => {
8492
+ // let Ndate = new Date(date * 1000);
8493
+ // let fmt = format ? format : "DD-MM-YYYY"
8494
+ // if (format) {
8495
+ // return moment(Ndate).format(fmt);
8496
+ // } else {
8497
+ // return moment(Ndate)
8498
+ // }
8499
+ // };
8500
+
8501
+
8502
+ var deg2rad = function deg2rad(deg) {
8503
+ return deg * (Math.PI / 180);
8504
+ };
8505
+
8506
+ var getDisctanceFromLatLonInKm = function getDisctanceFromLatLonInKm(lat1, lon1, lat2, lon2) {
8507
+ var R = 6371; // Radius of the earth in km
8508
+
8509
+ var dLat = deg2rad(lat2 - lat1); // deg2rad below
8510
+
8511
+ var dLon = deg2rad(lon2 - lon1);
8512
+ var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
8513
+ var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
8514
+ var d = R * c; // Distance in km
8515
+
8516
+ return parseFloat(d).toFixed(2);
8517
+ };
8518
+
8519
+ var getLocation = function getLocation() {
8520
+ return new es6Promise.Promise(function (resolve, reject) {
8521
+ navigator.geolocation.getCurrentPosition(function (position) {
8522
+ var lat = position.coords.latitude;
8523
+ var _long = position.coords.longitude;
8524
+ resolve([false, {
8525
+ lat: lat,
8526
+ "long": _long
8527
+ }]);
8528
+ }, function (error) {
8529
+ resolve([true, error]);
8530
+ });
8531
+ });
8532
+ };
8533
+
8534
+ var getCurrentPosition = /*#__PURE__*/function () {
8535
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
8536
+ var permission, lat, _long2, _yield$getLocation, _yield$getLocation2, err, currLocation;
8537
+
8538
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
8539
+ while (1) {
8540
+ switch (_context2.prev = _context2.next) {
8541
+ case 0:
8542
+ _context2.next = 2;
8543
+ return navigator.permissions.query({
8544
+ name: 'geolocation'
8545
+ })["catch"](function (err) {
8546
+ return {
8547
+ state: 'denied'
8548
+ };
8549
+ });
8550
+
8551
+ case 2:
8552
+ permission = _context2.sent;
8553
+
8554
+ if (!(permission.state !== 'denied')) {
8555
+ _context2.next = 11;
8556
+ break;
8557
+ }
8558
+
8559
+ _context2.next = 6;
8560
+ return getLocation();
8561
+
8562
+ case 6:
8563
+ _yield$getLocation = _context2.sent;
8564
+ _yield$getLocation2 = _slicedToArray(_yield$getLocation, 2);
8565
+ err = _yield$getLocation2[0];
8566
+ currLocation = _yield$getLocation2[1];
8567
+
8568
+ if (!err) {
8569
+ lat = currLocation.lat;
8570
+ _long2 = currLocation["long"];
8571
+ }
8572
+
8573
+ case 11:
8574
+ return _context2.abrupt("return", {
8575
+ lat: lat,
8576
+ "long": _long2
8577
+ });
8578
+
8579
+ case 12:
8580
+ case "end":
8581
+ return _context2.stop();
8582
+ }
8583
+ }
8584
+ }, _callee2);
8585
+ }));
8586
+
8587
+ return function getCurrentPosition() {
8588
+ return _ref4.apply(this, arguments);
8589
+ };
8590
+ }();
8591
+
8592
+ var getLatLong = /*#__PURE__*/function () {
8593
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(city) {
8594
+ var _resp$results, _resp$results$, _resp$results$$geomet, _resp$results$$geomet2, _resp$results2, _resp$results2$, _resp$results2$$geome, _resp$results2$$geome2;
8595
+
8596
+ var url, data, resp, lat, _long3, _resp$results3, _resp$results3$, _resp$results3$$geome, _resp$results3$$geome2, _resp$results4, _resp$results4$, _resp$results4$$geome, _resp$results4$$geome2;
8597
+
8598
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
8599
+ while (1) {
8600
+ switch (_context3.prev = _context3.next) {
8601
+ case 0:
8602
+ url = "https://maps.googleapis.com/maps/api/geocode/json?address=".concat(city, "&key=AIzaSyBqeACJgp12OLU6EkHeUtFgya2naH1LhrU");
8603
+ _context3.next = 3;
8604
+ return fetch(url);
8605
+
8606
+ case 3:
8607
+ data = _context3.sent;
8608
+ _context3.next = 6;
8609
+ return data.json();
8610
+
8611
+ case 6:
8612
+ resp = _context3.sent;
8613
+
8614
+ if ((resp === null || resp === void 0 ? void 0 : (_resp$results = resp.results) === null || _resp$results === void 0 ? void 0 : (_resp$results$ = _resp$results[0]) === null || _resp$results$ === void 0 ? void 0 : (_resp$results$$geomet = _resp$results$.geometry) === null || _resp$results$$geomet === void 0 ? void 0 : (_resp$results$$geomet2 = _resp$results$$geomet.location) === null || _resp$results$$geomet2 === void 0 ? void 0 : _resp$results$$geomet2.lat) && (resp === null || resp === void 0 ? void 0 : (_resp$results2 = resp.results) === null || _resp$results2 === void 0 ? void 0 : (_resp$results2$ = _resp$results2[0]) === null || _resp$results2$ === void 0 ? void 0 : (_resp$results2$$geome = _resp$results2$.geometry) === null || _resp$results2$$geome === void 0 ? void 0 : (_resp$results2$$geome2 = _resp$results2$$geome.location) === null || _resp$results2$$geome2 === void 0 ? void 0 : _resp$results2$$geome2.lng)) {
8615
+ lat = resp === null || resp === void 0 ? void 0 : (_resp$results3 = resp.results) === null || _resp$results3 === void 0 ? void 0 : (_resp$results3$ = _resp$results3[0]) === null || _resp$results3$ === void 0 ? void 0 : (_resp$results3$$geome = _resp$results3$.geometry) === null || _resp$results3$$geome === void 0 ? void 0 : (_resp$results3$$geome2 = _resp$results3$$geome.location) === null || _resp$results3$$geome2 === void 0 ? void 0 : _resp$results3$$geome2.lat;
8616
+ _long3 = resp === null || resp === void 0 ? void 0 : (_resp$results4 = resp.results) === null || _resp$results4 === void 0 ? void 0 : (_resp$results4$ = _resp$results4[0]) === null || _resp$results4$ === void 0 ? void 0 : (_resp$results4$$geome = _resp$results4$.geometry) === null || _resp$results4$$geome === void 0 ? void 0 : (_resp$results4$$geome2 = _resp$results4$$geome.location) === null || _resp$results4$$geome2 === void 0 ? void 0 : _resp$results4$$geome2.lng;
8617
+ }
8618
+
8619
+ return _context3.abrupt("return", {
8620
+ lat: lat,
8621
+ "long": _long3
8622
+ });
8623
+
8624
+ case 9:
8625
+ case "end":
8626
+ return _context3.stop();
8627
+ }
8628
+ }
8629
+ }, _callee3);
8630
+ }));
8631
+
8632
+ return function getLatLong(_x2) {
8633
+ return _ref5.apply(this, arguments);
8634
+ };
8635
+ }(); // Get age using moment
8636
+
8637
+
8638
+ var getAge = function getAge(date) {
8639
+ if (date) {
8640
+ var yearDiff = moment().diff(moment(date, 'DD/MM/YYYY'), 'years', false);
8641
+
8642
+ if (yearDiff > 0) {
8643
+ return yearDiff + ' Y';
8644
+ }
8645
+
8646
+ var monthDiff = moment().diff(moment(date, 'DD/MM/YYYY'), 'months', false);
8647
+
8648
+ if (monthDiff > 0) {
8649
+ return monthDiff + ' M';
8650
+ }
8651
+
8652
+ var dayDiff = moment().diff(moment(date, 'DD/MM/YYYY'), 'days', false);
8653
+ return dayDiff + ' D';
8654
+ }
8655
+
8656
+ return "";
8657
+ };
8658
+
8394
8659
  var _extraReducers$F;
8395
8660
  var __options$a = {
8396
8661
  method: "POST",
@@ -9194,543 +9459,352 @@ var DELETE_USER = createAsyncThunk("authSlice/deleteUser", /*#__PURE__*/_asyncTo
9194
9459
  }
9195
9460
  }, _callee15, null, [[2, 15]]);
9196
9461
  })));
9197
- var authSlice = createSlice({
9198
- name: "authSlice",
9199
- initialState: {
9200
- registerUsers: _objectSpread2({}, defaultState.Info),
9201
- generateOTP: _objectSpread2({}, defaultState.Info),
9202
- resendOTP: _objectSpread2({}, defaultState.Info),
9203
- signIn: _objectSpread2({}, defaultState.Info),
9204
- logout: _objectSpread2({}, defaultState.Info),
9205
- guestInfo: _objectSpread2(_objectSpread2({}, defaultState.Info), {}, {
9206
- isGuest: false
9207
- }),
9208
- loggedUserInfo: _objectSpread2(_objectSpread2({}, defaultState.Info), {}, {
9209
- isSignedIn: false
9210
- }),
9211
- forgotPassword: _objectSpread2({}, defaultState.Info),
9212
- deleteUser: _objectSpread2({}, defaultState.Info),
9213
- changePassword: _objectSpread2({}, defaultState.Info),
9214
- tokenValidate: _objectSpread2({}, defaultState.Info),
9215
- refreshToken: _objectSpread2({}, defaultState.Info)
9216
- },
9217
- extraReducers: (_extraReducers$F = {}, _defineProperty(_extraReducers$F, REGISTER_USERS.fulfilled, function (state, action) {
9218
- var _action$payload;
9219
-
9220
- state.registerUsers = (_action$payload = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload !== void 0 ? _action$payload : {};
9221
- }), _defineProperty(_extraReducers$F, REGISTER_USERS.pending, function (state, action) {
9222
- state.registerUsers.loading = true;
9223
- }), _defineProperty(_extraReducers$F, REGISTER_USERS.rejected, function (state, action) {
9224
- var _action$payload2;
9225
-
9226
- state.registerUsers = (_action$payload2 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload2 !== void 0 ? _action$payload2 : {};
9227
- }), _defineProperty(_extraReducers$F, DELETE_USER.fulfilled, function (state, action) {
9228
- var _action$payload3;
9229
-
9230
- state.deleteUser = (_action$payload3 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload3 !== void 0 ? _action$payload3 : {};
9231
- }), _defineProperty(_extraReducers$F, DELETE_USER.pending, function (state, action) {
9232
- state.deleteUser.loading = true;
9233
- }), _defineProperty(_extraReducers$F, DELETE_USER.rejected, function (state, action) {
9234
- var _action$payload4;
9235
-
9236
- state.deleteUser = (_action$payload4 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload4 !== void 0 ? _action$payload4 : {};
9237
- }), _defineProperty(_extraReducers$F, GENERATE_OTP.fulfilled, function (state, action) {
9238
- var _action$payload5;
9239
-
9240
- state.generateOTP = (_action$payload5 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload5 !== void 0 ? _action$payload5 : {};
9241
- }), _defineProperty(_extraReducers$F, GENERATE_OTP.pending, function (state, action) {
9242
- state.generateOTP.loading = true;
9243
- }), _defineProperty(_extraReducers$F, GENERATE_OTP.rejected, function (state, action) {
9244
- var _action$payload6;
9245
-
9246
- state.generateOTP = (_action$payload6 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload6 !== void 0 ? _action$payload6 : {};
9247
- }), _defineProperty(_extraReducers$F, RESEND_OTP.fulfilled, function (state, action) {
9248
- var _action$payload7;
9249
-
9250
- state.resendOTP = (_action$payload7 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload7 !== void 0 ? _action$payload7 : {};
9251
- }), _defineProperty(_extraReducers$F, RESEND_OTP.pending, function (state, action) {
9252
- state.resendOTP.loading = true;
9253
- }), _defineProperty(_extraReducers$F, RESEND_OTP.rejected, function (state, action) {
9254
- var _action$payload8;
9255
-
9256
- state.resendOTP = (_action$payload8 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload8 !== void 0 ? _action$payload8 : {};
9257
- }), _defineProperty(_extraReducers$F, SIGN_IN.fulfilled, function (state, action) {
9258
- var _action$payload9;
9259
-
9260
- state.signIn = (_action$payload9 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload9 !== void 0 ? _action$payload9 : {};
9261
- }), _defineProperty(_extraReducers$F, SIGN_IN.pending, function (state, action) {
9262
- state.signIn.loading = true;
9263
- }), _defineProperty(_extraReducers$F, SIGN_IN.rejected, function (state, action) {
9264
- var _action$payload10;
9265
-
9266
- state.signIn = (_action$payload10 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload10 !== void 0 ? _action$payload10 : {};
9267
- }), _defineProperty(_extraReducers$F, LOG_OUT.fulfilled, function (state, action) {
9268
- var _action$payload11;
9269
-
9270
- state.logout = (_action$payload11 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload11 !== void 0 ? _action$payload11 : {};
9271
- }), _defineProperty(_extraReducers$F, LOG_OUT.pending, function (state, action) {
9272
- state.logout.loading = true;
9273
- }), _defineProperty(_extraReducers$F, LOG_OUT.rejected, function (state, action) {
9274
- var _action$payload12;
9275
-
9276
- state.logout = (_action$payload12 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload12 !== void 0 ? _action$payload12 : {};
9277
- }), _defineProperty(_extraReducers$F, FORGOT_PASSWORD.fulfilled, function (state, action) {
9278
- var _action$payload13;
9279
-
9280
- state.forgotPassword = (_action$payload13 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload13 !== void 0 ? _action$payload13 : {};
9281
- }), _defineProperty(_extraReducers$F, FORGOT_PASSWORD.pending, function (state, action) {
9282
- state.forgotPassword.loading = true;
9283
- }), _defineProperty(_extraReducers$F, FORGOT_PASSWORD.rejected, function (state, action) {
9284
- var _action$payload14;
9285
-
9286
- state.forgotPassword = (_action$payload14 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload14 !== void 0 ? _action$payload14 : {};
9287
- }), _defineProperty(_extraReducers$F, GUEST_INFO.fulfilled, function (state, action) {
9288
- var _action$payload15;
9289
-
9290
- state.guestInfo = (_action$payload15 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload15 !== void 0 ? _action$payload15 : {};
9291
- }), _defineProperty(_extraReducers$F, GUEST_INFO.pending, function (state, action) {
9292
- state.guestInfo.loading = true;
9293
- }), _defineProperty(_extraReducers$F, GUEST_INFO.rejected, function (state, action) {
9294
- var _action$payload16;
9295
-
9296
- state.guestInfo = (_action$payload16 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload16 !== void 0 ? _action$payload16 : {};
9297
- }), _defineProperty(_extraReducers$F, LOGGED_USER_INFO.fulfilled, function (state, action) {
9298
- var _action$payload17;
9299
-
9300
- state.loggedUserInfo = (_action$payload17 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload17 !== void 0 ? _action$payload17 : {};
9301
- }), _defineProperty(_extraReducers$F, LOGGED_USER_INFO.pending, function (state, action) {
9302
- state.loggedUserInfo.loading = true;
9303
- }), _defineProperty(_extraReducers$F, LOGGED_USER_INFO.rejected, function (state, action) {
9304
- var _action$payload18;
9305
-
9306
- state.loggedUserInfo = (_action$payload18 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload18 !== void 0 ? _action$payload18 : {};
9307
- }), _defineProperty(_extraReducers$F, GET_USER_INFO.fulfilled, function (state, action) {
9308
- var _action$payload19;
9309
-
9310
- state.loggedUserInfo = (_action$payload19 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload19 !== void 0 ? _action$payload19 : {};
9311
- }), _defineProperty(_extraReducers$F, GET_USER_INFO.pending, function (state, action) {
9312
- state.loggedUserInfo.loading = true;
9313
- }), _defineProperty(_extraReducers$F, GET_USER_INFO.rejected, function (state, action) {
9314
- var _action$payload20;
9315
-
9316
- state.loggedUserInfo = (_action$payload20 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload20 !== void 0 ? _action$payload20 : {};
9317
- }), _defineProperty(_extraReducers$F, GET_ORG_USER_INFO.fulfilled, function (state, action) {
9318
- var _action$payload21;
9319
-
9320
- state.loggedUserInfo = (_action$payload21 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload21 !== void 0 ? _action$payload21 : {};
9321
- }), _defineProperty(_extraReducers$F, GET_ORG_USER_INFO.pending, function (state, action) {
9322
- state.loggedUserInfo.loading = true;
9323
- }), _defineProperty(_extraReducers$F, GET_ORG_USER_INFO.rejected, function (state, action) {
9324
- var _action$payload22;
9325
-
9326
- state.loggedUserInfo = (_action$payload22 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload22 !== void 0 ? _action$payload22 : {};
9327
- }), _defineProperty(_extraReducers$F, CHANGE_PASSWORD.fulfilled, function (state, action) {
9328
- var _action$payload23;
9329
-
9330
- state.changePassword = (_action$payload23 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload23 !== void 0 ? _action$payload23 : {};
9331
- }), _defineProperty(_extraReducers$F, CHANGE_PASSWORD.pending, function (state, action) {
9332
- state.changePassword.loading = true;
9333
- }), _defineProperty(_extraReducers$F, CHANGE_PASSWORD.rejected, function (state, action) {
9334
- var _action$payload24;
9335
-
9336
- state.changePassword = (_action$payload24 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload24 !== void 0 ? _action$payload24 : {};
9337
- }), _defineProperty(_extraReducers$F, TOKEN_VALIDATE.fulfilled, function (state, action) {
9338
- var _action$payload25;
9339
-
9340
- state.tokenValidate = (_action$payload25 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload25 !== void 0 ? _action$payload25 : {};
9341
- }), _defineProperty(_extraReducers$F, TOKEN_VALIDATE.pending, function (state, action) {
9342
- state.tokenValidate.loading = true;
9343
- }), _defineProperty(_extraReducers$F, TOKEN_VALIDATE.rejected, function (state, action) {
9344
- var _action$payload26;
9345
-
9346
- state.tokenValidate = (_action$payload26 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload26 !== void 0 ? _action$payload26 : {};
9347
- }), _defineProperty(_extraReducers$F, REFRESH_TOKEN.fulfilled, function (state, action) {
9348
- var _action$payload27;
9349
-
9350
- state.refreshToken = (_action$payload27 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload27 !== void 0 ? _action$payload27 : {};
9351
- }), _defineProperty(_extraReducers$F, REFRESH_TOKEN.pending, function (state, action) {
9352
- state.refreshToken.loading = true;
9353
- }), _defineProperty(_extraReducers$F, REFRESH_TOKEN.rejected, function (state, action) {
9354
- var _action$payload28;
9355
-
9356
- state.refreshToken = (_action$payload28 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload28 !== void 0 ? _action$payload28 : {};
9357
- }), _extraReducers$F)
9358
- });
9359
- var authActions = {
9360
- REGISTER_USERS: REGISTER_USERS,
9361
- GENERATE_OTP: GENERATE_OTP,
9362
- RESEND_OTP: RESEND_OTP,
9363
- SIGN_IN: SIGN_IN,
9364
- LOG_OUT: LOG_OUT,
9365
- GUEST_INFO: GUEST_INFO,
9366
- LOGGED_USER_INFO: LOGGED_USER_INFO,
9367
- FORGOT_PASSWORD: FORGOT_PASSWORD,
9368
- GET_USER_INFO: GET_USER_INFO,
9369
- GET_ORG_USER_INFO: GET_ORG_USER_INFO,
9370
- DELETE_USER: DELETE_USER,
9371
- CHANGE_PASSWORD: CHANGE_PASSWORD,
9372
- TOKEN_VALIDATE: TOKEN_VALIDATE,
9373
- REFRESH_TOKEN: REFRESH_TOKEN
9374
- };
9375
- var authSlice$1 = authSlice.reducer;
9376
-
9377
- var _extraReducers$E;
9378
- var __options$9 = {
9379
- method: "POST",
9380
- headers: {
9381
- "Content-Type": "text/plain"
9382
- },
9383
- body: {}
9384
- }; // FUZZY_SEARCH
9385
-
9386
- var FUZZY_SEARCH = createAsyncThunk("fuzzySearchReducer/fuzzySearch", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
9462
+ var GET_COUNTRY_CODE_LIST = createAsyncThunk("authSlice/country_code_list", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee16() {
9387
9463
  var payload,
9388
- _ref2,
9464
+ _ref27,
9389
9465
  rejectWithValue,
9390
- _payload$db_name,
9391
- db_name,
9392
- _payload$entity,
9393
- entity,
9394
- _payload$filter,
9395
- filter,
9396
- _payload$value,
9397
- value,
9398
- _,
9399
- _args = arguments;
9466
+ queries,
9467
+ data,
9468
+ arry,
9469
+ _args16 = arguments;
9400
9470
 
9401
- return regeneratorRuntime.wrap(function _callee$(_context) {
9471
+ return regeneratorRuntime.wrap(function _callee16$(_context16) {
9402
9472
  while (1) {
9403
- switch (_context.prev = _context.next) {
9473
+ switch (_context16.prev = _context16.next) {
9404
9474
  case 0:
9405
- payload = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
9406
- _ref2 = _args.length > 1 ? _args[1] : undefined, rejectWithValue = _ref2.rejectWithValue;
9407
- _context.prev = 2;
9408
- _payload$db_name = payload.db_name, db_name = _payload$db_name === void 0 ? "primarycare" : _payload$db_name, _payload$entity = payload.entity, entity = _payload$entity === void 0 ? "Person" : _payload$entity, _payload$filter = payload.filter, filter = _payload$filter === void 0 ? "" : _payload$filter, _payload$value = payload.value, value = _payload$value === void 0 ? "" : _payload$value;
9409
- _context.next = 6;
9410
- return fetch(urls.fuzzy_search, _objectSpread2(_objectSpread2({}, __options$9), {}, {
9411
- body: btoa(JSON.stringify({
9412
- "db_name": db_name,
9413
- "entity": entity,
9414
- "filter": filter,
9415
- "value": value
9416
- }))
9417
- }));
9475
+ payload = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {};
9476
+ _ref27 = _args16.length > 1 ? _args16[1] : undefined, rejectWithValue = _ref27.rejectWithValue;
9477
+ _context16.prev = 2;
9478
+ queries = {
9479
+ "db_name": dbName,
9480
+ "entity": "SMGeographicMaster",
9481
+ "sort": "SMGeographicMaster.GeoLocationISDCode",
9482
+ "filter": "lower(document(SMGeographicMaster.geogLevelType).display)=='country' && SMGeographicMaster.activestatus == true && SMGeographicMaster.active == true",
9483
+ "return_fields": "{_id:SMGeographicMaster._id,id:SMGeographicMaster.id,geogLevelName:SMGeographicMaster.geogLevelName,parentGeogLevelType:SMGeographicMaster.parentGeogLevelType,parentGeogLevelCode:SMGeographicMaster.parentGeogLevelCode,GeoLocationISDCode:SMGeographicMaster.GeoLocationISDCode}"
9484
+ };
9485
+ _context16.next = 6;
9486
+ return fetchData$3({
9487
+ body: JSON.stringify(queries)
9488
+ }, __readDocumentUrl__);
9418
9489
 
9419
9490
  case 6:
9420
- _ = _context.sent;
9421
- _context.next = 9;
9422
- return _.json();
9491
+ data = _context16.sent;
9492
+ arry = [];
9493
+ data.result.map(function (value) {
9494
+ var _value$GeoLocationISD;
9423
9495
 
9424
- case 9:
9425
- _ = _context.sent;
9426
- return _context.abrupt("return", _objectSpread2(_objectSpread2({}, defaultState.Info), {}, {
9427
- data: _
9496
+ arry.push({
9497
+ name: value.geogLevelName,
9498
+ flag: "https://upload.wikimedia.org/wikipedia/en/4/41/Flag_of_India.svg",
9499
+ altSpellings: value._id,
9500
+ callingCodes: value === null || value === void 0 ? void 0 : (_value$GeoLocationISD = value.GeoLocationISDCode) === null || _value$GeoLocationISD === void 0 ? void 0 : _value$GeoLocationISD.replaceAll("+", "") // label: value.GeoLocationISDCode,
9501
+ // value: value._id,
9502
+ // ...value
9503
+
9504
+ });
9505
+ });
9506
+ return _context16.abrupt("return", _objectSpread2(_objectSpread2({}, defaultState.List), {}, {
9507
+ data: arry
9428
9508
  }));
9429
9509
 
9430
- case 13:
9431
- _context.prev = 13;
9432
- _context.t0 = _context["catch"](2);
9433
- return _context.abrupt("return", rejectWithValue(_objectSpread2(_objectSpread2({}, defaultReject), {}, {
9434
- message: _context.t0.message
9510
+ case 12:
9511
+ _context16.prev = 12;
9512
+ _context16.t0 = _context16["catch"](2);
9513
+ return _context16.abrupt("return", rejectWithValue(_objectSpread2(_objectSpread2({}, defaultReject), {}, {
9514
+ message: _context16.t0.message
9435
9515
  })));
9436
9516
 
9437
- case 16:
9517
+ case 15:
9438
9518
  case "end":
9439
- return _context.stop();
9519
+ return _context16.stop();
9440
9520
  }
9441
9521
  }
9442
- }, _callee, null, [[2, 13]]);
9443
- }))); // end
9444
- // FUZZY SEARCH CREATE INITIALSTATE
9445
-
9446
- var fuzzySearchReducer = createSlice({
9447
- name: "fuzzySearchReducer",
9522
+ }, _callee16, null, [[2, 12]]);
9523
+ })));
9524
+ var authSlice = createSlice({
9525
+ name: "authSlice",
9448
9526
  initialState: {
9449
- fuzzySearch: _objectSpread2({}, defaultState.Info)
9527
+ registerUsers: _objectSpread2({}, defaultState.Info),
9528
+ generateOTP: _objectSpread2({}, defaultState.Info),
9529
+ resendOTP: _objectSpread2({}, defaultState.Info),
9530
+ signIn: _objectSpread2({}, defaultState.Info),
9531
+ logout: _objectSpread2({}, defaultState.Info),
9532
+ guestInfo: _objectSpread2(_objectSpread2({}, defaultState.Info), {}, {
9533
+ isGuest: false
9534
+ }),
9535
+ loggedUserInfo: _objectSpread2(_objectSpread2({}, defaultState.Info), {}, {
9536
+ isSignedIn: false
9537
+ }),
9538
+ forgotPassword: _objectSpread2({}, defaultState.Info),
9539
+ deleteUser: _objectSpread2({}, defaultState.Info),
9540
+ changePassword: _objectSpread2({}, defaultState.Info),
9541
+ tokenValidate: _objectSpread2({}, defaultState.Info),
9542
+ refreshToken: _objectSpread2({}, defaultState.Info),
9543
+ country_code_list: _objectSpread2({}, defaultState.Info)
9450
9544
  },
9451
- extraReducers: (_extraReducers$E = {}, _defineProperty(_extraReducers$E, FUZZY_SEARCH.fulfilled, function (state, action) {
9545
+ extraReducers: (_extraReducers$F = {}, _defineProperty(_extraReducers$F, REGISTER_USERS.fulfilled, function (state, action) {
9452
9546
  var _action$payload;
9453
9547
 
9454
- state.fuzzySearch = (_action$payload = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload !== void 0 ? _action$payload : {};
9455
- }), _defineProperty(_extraReducers$E, FUZZY_SEARCH.pending, function (state, action) {
9456
- state.fuzzySearch.loading = true;
9457
- }), _defineProperty(_extraReducers$E, FUZZY_SEARCH.rejected, function (state, action) {
9548
+ state.registerUsers = (_action$payload = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload !== void 0 ? _action$payload : {};
9549
+ }), _defineProperty(_extraReducers$F, REGISTER_USERS.pending, function (state, action) {
9550
+ state.registerUsers.loading = true;
9551
+ }), _defineProperty(_extraReducers$F, REGISTER_USERS.rejected, function (state, action) {
9458
9552
  var _action$payload2;
9459
9553
 
9460
- state.fuzzySearch = (_action$payload2 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload2 !== void 0 ? _action$payload2 : {};
9461
- }), _extraReducers$E)
9462
- }); // end
9463
- // FUZZY SEARCH CREATE ACTION LISTS
9464
-
9465
- var fuzzySearchActions = {
9466
- FUZZY_SEARCH: FUZZY_SEARCH
9467
- }; // end
9468
- var fuzzySearchReducer$1 = fuzzySearchReducer.reducer;
9469
-
9470
- var makeName = function makeName() {
9471
- var _prefix$coding, _prefix$coding$, _suffix$coding, _suffix$coding$;
9472
-
9473
- var nameObj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9474
- var _nameObj$prefix = nameObj.prefix,
9475
- prefix = _nameObj$prefix === void 0 ? "" : _nameObj$prefix,
9476
- _nameObj$text = nameObj.text,
9477
- text = _nameObj$text === void 0 ? "" : _nameObj$text,
9478
- _nameObj$given = nameObj.given,
9479
- given = _nameObj$given === void 0 ? "" : _nameObj$given,
9480
- _nameObj$family = nameObj.family,
9481
- family = _nameObj$family === void 0 ? "" : _nameObj$family,
9482
- _nameObj$suffix = nameObj.suffix,
9483
- suffix = _nameObj$suffix === void 0 ? "" : _nameObj$suffix;
9484
- var prefixVal = (prefix === null || prefix === void 0 ? void 0 : (_prefix$coding = prefix.coding) === null || _prefix$coding === void 0 ? void 0 : (_prefix$coding$ = _prefix$coding[0]) === null || _prefix$coding$ === void 0 ? void 0 : _prefix$coding$.display) || "";
9485
- var suffixVal = (suffix === null || suffix === void 0 ? void 0 : (_suffix$coding = suffix.coding) === null || _suffix$coding === void 0 ? void 0 : (_suffix$coding$ = _suffix$coding[0]) === null || _suffix$coding$ === void 0 ? void 0 : _suffix$coding$.display) || "";
9486
- return "".concat(prefixVal && prefixVal + ".").concat(text && text + " ").concat(given && given + " ").concat(family && family + " ").concat(suffixVal && suffixVal);
9487
- };
9488
-
9489
- var fetchData$3 = /*#__PURE__*/function () {
9490
- var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(input) {
9491
- var url,
9492
- __options,
9493
- res,
9494
- data,
9495
- _args = arguments;
9496
-
9497
- return regeneratorRuntime.wrap(function _callee$(_context) {
9498
- while (1) {
9499
- switch (_context.prev = _context.next) {
9500
- case 0:
9501
- url = _args.length > 1 && _args[1] !== undefined ? _args[1] : __baseUrl__;
9502
- __options = {
9503
- method: "POST",
9504
- headers: {
9505
- "Content-Type": "application/json"
9506
- },
9507
- body: {}
9508
- };
9509
- _context.next = 4;
9510
- return fetch(url, _objectSpread2(_objectSpread2({}, __options), input));
9511
-
9512
- case 4:
9513
- res = _context.sent;
9514
- _context.next = 7;
9515
- return res.json();
9516
-
9517
- case 7:
9518
- data = _context.sent;
9519
- return _context.abrupt("return", data);
9520
-
9521
- case 9:
9522
- case "end":
9523
- return _context.stop();
9524
- }
9525
- }
9526
- }, _callee);
9527
- }));
9528
-
9529
- return function fetchData(_x) {
9530
- return _ref3.apply(this, arguments);
9531
- };
9532
- }();
9554
+ state.registerUsers = (_action$payload2 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload2 !== void 0 ? _action$payload2 : {};
9555
+ }), _defineProperty(_extraReducers$F, DELETE_USER.fulfilled, function (state, action) {
9556
+ var _action$payload3;
9533
9557
 
9534
- var getImgUrl = function getImgUrl(fileId) {
9535
- return fileId ? "".concat(__imgdownloadBaseUrl__).concat(fileId) : "";
9536
- };
9558
+ state.deleteUser = (_action$payload3 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload3 !== void 0 ? _action$payload3 : {};
9559
+ }), _defineProperty(_extraReducers$F, DELETE_USER.pending, function (state, action) {
9560
+ state.deleteUser.loading = true;
9561
+ }), _defineProperty(_extraReducers$F, DELETE_USER.rejected, function (state, action) {
9562
+ var _action$payload4;
9537
9563
 
9538
- var getUtcTime = function getUtcTime(date) {
9539
- if (date) {
9540
- return moment.utc(date).unix();
9541
- } else {
9542
- return moment.utc().unix();
9543
- }
9544
- };
9564
+ state.deleteUser = (_action$payload4 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload4 !== void 0 ? _action$payload4 : {};
9565
+ }), _defineProperty(_extraReducers$F, GENERATE_OTP.fulfilled, function (state, action) {
9566
+ var _action$payload5;
9545
9567
 
9546
- var utcTOLocal$1 = function utcTOLocal(date, format) {
9547
- var Ndate = new Date();
9568
+ state.generateOTP = (_action$payload5 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload5 !== void 0 ? _action$payload5 : {};
9569
+ }), _defineProperty(_extraReducers$F, GENERATE_OTP.pending, function (state, action) {
9570
+ state.generateOTP.loading = true;
9571
+ }), _defineProperty(_extraReducers$F, GENERATE_OTP.rejected, function (state, action) {
9572
+ var _action$payload6;
9548
9573
 
9549
- if (typeof date === "number") {
9550
- Ndate = moment.unix(date);
9551
- } else {
9552
- Ndate = moment(date);
9553
- }
9574
+ state.generateOTP = (_action$payload6 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload6 !== void 0 ? _action$payload6 : {};
9575
+ }), _defineProperty(_extraReducers$F, RESEND_OTP.fulfilled, function (state, action) {
9576
+ var _action$payload7;
9554
9577
 
9555
- var fmt = format ? format : "DD-MM-YYYY";
9556
- return moment.utc(Ndate).local().format(fmt);
9557
- }; // const getUtcTime = (date) => {
9558
- // let a = null
9559
- // if (date) {
9560
- // a = new Date(date)
9561
- // } else {
9562
- // a = new Date()
9563
- // }
9564
- // a = a.toUTCString()
9565
- // return ((new Date(a).getTime())/1000)
9566
- // };
9567
- // const utcTOLocal = (date, format) => {
9568
- // let Ndate = new Date(date * 1000);
9569
- // let fmt = format ? format : "DD-MM-YYYY"
9570
- // if (format) {
9571
- // return moment(Ndate).format(fmt);
9572
- // } else {
9573
- // return moment(Ndate)
9574
- // }
9575
- // };
9578
+ state.resendOTP = (_action$payload7 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload7 !== void 0 ? _action$payload7 : {};
9579
+ }), _defineProperty(_extraReducers$F, RESEND_OTP.pending, function (state, action) {
9580
+ state.resendOTP.loading = true;
9581
+ }), _defineProperty(_extraReducers$F, RESEND_OTP.rejected, function (state, action) {
9582
+ var _action$payload8;
9576
9583
 
9584
+ state.resendOTP = (_action$payload8 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload8 !== void 0 ? _action$payload8 : {};
9585
+ }), _defineProperty(_extraReducers$F, SIGN_IN.fulfilled, function (state, action) {
9586
+ var _action$payload9;
9577
9587
 
9578
- var deg2rad = function deg2rad(deg) {
9579
- return deg * (Math.PI / 180);
9580
- };
9588
+ state.signIn = (_action$payload9 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload9 !== void 0 ? _action$payload9 : {};
9589
+ }), _defineProperty(_extraReducers$F, SIGN_IN.pending, function (state, action) {
9590
+ state.signIn.loading = true;
9591
+ }), _defineProperty(_extraReducers$F, SIGN_IN.rejected, function (state, action) {
9592
+ var _action$payload10;
9581
9593
 
9582
- var getDisctanceFromLatLonInKm = function getDisctanceFromLatLonInKm(lat1, lon1, lat2, lon2) {
9583
- var R = 6371; // Radius of the earth in km
9594
+ state.signIn = (_action$payload10 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload10 !== void 0 ? _action$payload10 : {};
9595
+ }), _defineProperty(_extraReducers$F, LOG_OUT.fulfilled, function (state, action) {
9596
+ var _action$payload11;
9584
9597
 
9585
- var dLat = deg2rad(lat2 - lat1); // deg2rad below
9598
+ state.logout = (_action$payload11 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload11 !== void 0 ? _action$payload11 : {};
9599
+ }), _defineProperty(_extraReducers$F, LOG_OUT.pending, function (state, action) {
9600
+ state.logout.loading = true;
9601
+ }), _defineProperty(_extraReducers$F, LOG_OUT.rejected, function (state, action) {
9602
+ var _action$payload12;
9586
9603
 
9587
- var dLon = deg2rad(lon2 - lon1);
9588
- var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
9589
- var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
9590
- var d = R * c; // Distance in km
9604
+ state.logout = (_action$payload12 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload12 !== void 0 ? _action$payload12 : {};
9605
+ }), _defineProperty(_extraReducers$F, FORGOT_PASSWORD.fulfilled, function (state, action) {
9606
+ var _action$payload13;
9591
9607
 
9592
- return parseFloat(d).toFixed(2);
9593
- };
9608
+ state.forgotPassword = (_action$payload13 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload13 !== void 0 ? _action$payload13 : {};
9609
+ }), _defineProperty(_extraReducers$F, FORGOT_PASSWORD.pending, function (state, action) {
9610
+ state.forgotPassword.loading = true;
9611
+ }), _defineProperty(_extraReducers$F, FORGOT_PASSWORD.rejected, function (state, action) {
9612
+ var _action$payload14;
9594
9613
 
9595
- var getLocation = function getLocation() {
9596
- return new es6Promise.Promise(function (resolve, reject) {
9597
- navigator.geolocation.getCurrentPosition(function (position) {
9598
- var lat = position.coords.latitude;
9599
- var _long = position.coords.longitude;
9600
- resolve([false, {
9601
- lat: lat,
9602
- "long": _long
9603
- }]);
9604
- }, function (error) {
9605
- resolve([true, error]);
9606
- });
9607
- });
9608
- };
9614
+ state.forgotPassword = (_action$payload14 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload14 !== void 0 ? _action$payload14 : {};
9615
+ }), _defineProperty(_extraReducers$F, GUEST_INFO.fulfilled, function (state, action) {
9616
+ var _action$payload15;
9609
9617
 
9610
- var getCurrentPosition = /*#__PURE__*/function () {
9611
- var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
9612
- var permission, lat, _long2, _yield$getLocation, _yield$getLocation2, err, currLocation;
9618
+ state.guestInfo = (_action$payload15 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload15 !== void 0 ? _action$payload15 : {};
9619
+ }), _defineProperty(_extraReducers$F, GUEST_INFO.pending, function (state, action) {
9620
+ state.guestInfo.loading = true;
9621
+ }), _defineProperty(_extraReducers$F, GUEST_INFO.rejected, function (state, action) {
9622
+ var _action$payload16;
9613
9623
 
9614
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
9615
- while (1) {
9616
- switch (_context2.prev = _context2.next) {
9617
- case 0:
9618
- _context2.next = 2;
9619
- return navigator.permissions.query({
9620
- name: 'geolocation'
9621
- })["catch"](function (err) {
9622
- return {
9623
- state: 'denied'
9624
- };
9625
- });
9624
+ state.guestInfo = (_action$payload16 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload16 !== void 0 ? _action$payload16 : {};
9625
+ }), _defineProperty(_extraReducers$F, LOGGED_USER_INFO.fulfilled, function (state, action) {
9626
+ var _action$payload17;
9626
9627
 
9627
- case 2:
9628
- permission = _context2.sent;
9628
+ state.loggedUserInfo = (_action$payload17 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload17 !== void 0 ? _action$payload17 : {};
9629
+ }), _defineProperty(_extraReducers$F, LOGGED_USER_INFO.pending, function (state, action) {
9630
+ state.loggedUserInfo.loading = true;
9631
+ }), _defineProperty(_extraReducers$F, LOGGED_USER_INFO.rejected, function (state, action) {
9632
+ var _action$payload18;
9629
9633
 
9630
- if (!(permission.state !== 'denied')) {
9631
- _context2.next = 11;
9632
- break;
9633
- }
9634
+ state.loggedUserInfo = (_action$payload18 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload18 !== void 0 ? _action$payload18 : {};
9635
+ }), _defineProperty(_extraReducers$F, GET_USER_INFO.fulfilled, function (state, action) {
9636
+ var _action$payload19;
9634
9637
 
9635
- _context2.next = 6;
9636
- return getLocation();
9638
+ state.loggedUserInfo = (_action$payload19 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload19 !== void 0 ? _action$payload19 : {};
9639
+ }), _defineProperty(_extraReducers$F, GET_USER_INFO.pending, function (state, action) {
9640
+ state.loggedUserInfo.loading = true;
9641
+ }), _defineProperty(_extraReducers$F, GET_USER_INFO.rejected, function (state, action) {
9642
+ var _action$payload20;
9637
9643
 
9638
- case 6:
9639
- _yield$getLocation = _context2.sent;
9640
- _yield$getLocation2 = _slicedToArray(_yield$getLocation, 2);
9641
- err = _yield$getLocation2[0];
9642
- currLocation = _yield$getLocation2[1];
9644
+ state.loggedUserInfo = (_action$payload20 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload20 !== void 0 ? _action$payload20 : {};
9645
+ }), _defineProperty(_extraReducers$F, GET_ORG_USER_INFO.fulfilled, function (state, action) {
9646
+ var _action$payload21;
9643
9647
 
9644
- if (!err) {
9645
- lat = currLocation.lat;
9646
- _long2 = currLocation["long"];
9647
- }
9648
+ state.loggedUserInfo = (_action$payload21 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload21 !== void 0 ? _action$payload21 : {};
9649
+ }), _defineProperty(_extraReducers$F, GET_ORG_USER_INFO.pending, function (state, action) {
9650
+ state.loggedUserInfo.loading = true;
9651
+ }), _defineProperty(_extraReducers$F, GET_ORG_USER_INFO.rejected, function (state, action) {
9652
+ var _action$payload22;
9648
9653
 
9649
- case 11:
9650
- return _context2.abrupt("return", {
9651
- lat: lat,
9652
- "long": _long2
9653
- });
9654
+ state.loggedUserInfo = (_action$payload22 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload22 !== void 0 ? _action$payload22 : {};
9655
+ }), _defineProperty(_extraReducers$F, CHANGE_PASSWORD.fulfilled, function (state, action) {
9656
+ var _action$payload23;
9654
9657
 
9655
- case 12:
9656
- case "end":
9657
- return _context2.stop();
9658
- }
9659
- }
9660
- }, _callee2);
9661
- }));
9658
+ state.changePassword = (_action$payload23 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload23 !== void 0 ? _action$payload23 : {};
9659
+ }), _defineProperty(_extraReducers$F, CHANGE_PASSWORD.pending, function (state, action) {
9660
+ state.changePassword.loading = true;
9661
+ }), _defineProperty(_extraReducers$F, CHANGE_PASSWORD.rejected, function (state, action) {
9662
+ var _action$payload24;
9662
9663
 
9663
- return function getCurrentPosition() {
9664
- return _ref4.apply(this, arguments);
9665
- };
9666
- }();
9664
+ state.changePassword = (_action$payload24 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload24 !== void 0 ? _action$payload24 : {};
9665
+ }), _defineProperty(_extraReducers$F, TOKEN_VALIDATE.fulfilled, function (state, action) {
9666
+ var _action$payload25;
9667
9667
 
9668
- var getLatLong = /*#__PURE__*/function () {
9669
- var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(city) {
9670
- var _resp$results, _resp$results$, _resp$results$$geomet, _resp$results$$geomet2, _resp$results2, _resp$results2$, _resp$results2$$geome, _resp$results2$$geome2;
9668
+ state.tokenValidate = (_action$payload25 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload25 !== void 0 ? _action$payload25 : {};
9669
+ }), _defineProperty(_extraReducers$F, TOKEN_VALIDATE.pending, function (state, action) {
9670
+ state.tokenValidate.loading = true;
9671
+ }), _defineProperty(_extraReducers$F, TOKEN_VALIDATE.rejected, function (state, action) {
9672
+ var _action$payload26;
9671
9673
 
9672
- var url, data, resp, lat, _long3, _resp$results3, _resp$results3$, _resp$results3$$geome, _resp$results3$$geome2, _resp$results4, _resp$results4$, _resp$results4$$geome, _resp$results4$$geome2;
9674
+ state.tokenValidate = (_action$payload26 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload26 !== void 0 ? _action$payload26 : {};
9675
+ }), _defineProperty(_extraReducers$F, REFRESH_TOKEN.fulfilled, function (state, action) {
9676
+ var _action$payload27;
9673
9677
 
9674
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
9675
- while (1) {
9676
- switch (_context3.prev = _context3.next) {
9677
- case 0:
9678
- url = "https://maps.googleapis.com/maps/api/geocode/json?address=".concat(city, "&key=AIzaSyBqeACJgp12OLU6EkHeUtFgya2naH1LhrU");
9679
- _context3.next = 3;
9680
- return fetch(url);
9678
+ state.refreshToken = (_action$payload27 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload27 !== void 0 ? _action$payload27 : {};
9679
+ }), _defineProperty(_extraReducers$F, REFRESH_TOKEN.pending, function (state, action) {
9680
+ state.refreshToken.loading = true;
9681
+ }), _defineProperty(_extraReducers$F, REFRESH_TOKEN.rejected, function (state, action) {
9682
+ var _action$payload28;
9681
9683
 
9682
- case 3:
9683
- data = _context3.sent;
9684
- _context3.next = 6;
9685
- return data.json();
9684
+ state.refreshToken = (_action$payload28 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload28 !== void 0 ? _action$payload28 : {};
9685
+ }), _defineProperty(_extraReducers$F, GET_COUNTRY_CODE_LIST.fulfilled, function (state, action) {
9686
+ var _action$payload29;
9686
9687
 
9687
- case 6:
9688
- resp = _context3.sent;
9688
+ state.country_code_list = (_action$payload29 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload29 !== void 0 ? _action$payload29 : {};
9689
+ }), _defineProperty(_extraReducers$F, GET_COUNTRY_CODE_LIST.pending, function (state, action) {
9690
+ state.country_code_list.loading = true;
9691
+ }), _defineProperty(_extraReducers$F, GET_COUNTRY_CODE_LIST.rejected, function (state, action) {
9692
+ var _action$payload30;
9689
9693
 
9690
- if ((resp === null || resp === void 0 ? void 0 : (_resp$results = resp.results) === null || _resp$results === void 0 ? void 0 : (_resp$results$ = _resp$results[0]) === null || _resp$results$ === void 0 ? void 0 : (_resp$results$$geomet = _resp$results$.geometry) === null || _resp$results$$geomet === void 0 ? void 0 : (_resp$results$$geomet2 = _resp$results$$geomet.location) === null || _resp$results$$geomet2 === void 0 ? void 0 : _resp$results$$geomet2.lat) && (resp === null || resp === void 0 ? void 0 : (_resp$results2 = resp.results) === null || _resp$results2 === void 0 ? void 0 : (_resp$results2$ = _resp$results2[0]) === null || _resp$results2$ === void 0 ? void 0 : (_resp$results2$$geome = _resp$results2$.geometry) === null || _resp$results2$$geome === void 0 ? void 0 : (_resp$results2$$geome2 = _resp$results2$$geome.location) === null || _resp$results2$$geome2 === void 0 ? void 0 : _resp$results2$$geome2.lng)) {
9691
- lat = resp === null || resp === void 0 ? void 0 : (_resp$results3 = resp.results) === null || _resp$results3 === void 0 ? void 0 : (_resp$results3$ = _resp$results3[0]) === null || _resp$results3$ === void 0 ? void 0 : (_resp$results3$$geome = _resp$results3$.geometry) === null || _resp$results3$$geome === void 0 ? void 0 : (_resp$results3$$geome2 = _resp$results3$$geome.location) === null || _resp$results3$$geome2 === void 0 ? void 0 : _resp$results3$$geome2.lat;
9692
- _long3 = resp === null || resp === void 0 ? void 0 : (_resp$results4 = resp.results) === null || _resp$results4 === void 0 ? void 0 : (_resp$results4$ = _resp$results4[0]) === null || _resp$results4$ === void 0 ? void 0 : (_resp$results4$$geome = _resp$results4$.geometry) === null || _resp$results4$$geome === void 0 ? void 0 : (_resp$results4$$geome2 = _resp$results4$$geome.location) === null || _resp$results4$$geome2 === void 0 ? void 0 : _resp$results4$$geome2.lng;
9693
- }
9694
+ state.country_code_list = (_action$payload30 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload30 !== void 0 ? _action$payload30 : {};
9695
+ }), _extraReducers$F)
9696
+ });
9697
+ var authActions = {
9698
+ REGISTER_USERS: REGISTER_USERS,
9699
+ GENERATE_OTP: GENERATE_OTP,
9700
+ RESEND_OTP: RESEND_OTP,
9701
+ SIGN_IN: SIGN_IN,
9702
+ LOG_OUT: LOG_OUT,
9703
+ GUEST_INFO: GUEST_INFO,
9704
+ LOGGED_USER_INFO: LOGGED_USER_INFO,
9705
+ FORGOT_PASSWORD: FORGOT_PASSWORD,
9706
+ GET_USER_INFO: GET_USER_INFO,
9707
+ GET_ORG_USER_INFO: GET_ORG_USER_INFO,
9708
+ DELETE_USER: DELETE_USER,
9709
+ CHANGE_PASSWORD: CHANGE_PASSWORD,
9710
+ TOKEN_VALIDATE: TOKEN_VALIDATE,
9711
+ REFRESH_TOKEN: REFRESH_TOKEN,
9712
+ GET_COUNTRY_CODE_LIST: GET_COUNTRY_CODE_LIST
9713
+ };
9714
+ var authSlice$1 = authSlice.reducer;
9694
9715
 
9695
- return _context3.abrupt("return", {
9696
- lat: lat,
9697
- "long": _long3
9698
- });
9716
+ var _extraReducers$E;
9717
+ var __options$9 = {
9718
+ method: "POST",
9719
+ headers: {
9720
+ "Content-Type": "text/plain"
9721
+ },
9722
+ body: {}
9723
+ }; // FUZZY_SEARCH
9699
9724
 
9700
- case 9:
9701
- case "end":
9702
- return _context3.stop();
9703
- }
9704
- }
9705
- }, _callee3);
9706
- }));
9725
+ var FUZZY_SEARCH = createAsyncThunk("fuzzySearchReducer/fuzzySearch", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
9726
+ var payload,
9727
+ _ref2,
9728
+ rejectWithValue,
9729
+ _payload$db_name,
9730
+ db_name,
9731
+ _payload$entity,
9732
+ entity,
9733
+ _payload$filter,
9734
+ filter,
9735
+ _payload$value,
9736
+ value,
9737
+ _,
9738
+ _args = arguments;
9707
9739
 
9708
- return function getLatLong(_x2) {
9709
- return _ref5.apply(this, arguments);
9710
- };
9711
- }(); // Get age using moment
9740
+ return regeneratorRuntime.wrap(function _callee$(_context) {
9741
+ while (1) {
9742
+ switch (_context.prev = _context.next) {
9743
+ case 0:
9744
+ payload = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
9745
+ _ref2 = _args.length > 1 ? _args[1] : undefined, rejectWithValue = _ref2.rejectWithValue;
9746
+ _context.prev = 2;
9747
+ _payload$db_name = payload.db_name, db_name = _payload$db_name === void 0 ? "primarycare" : _payload$db_name, _payload$entity = payload.entity, entity = _payload$entity === void 0 ? "Person" : _payload$entity, _payload$filter = payload.filter, filter = _payload$filter === void 0 ? "" : _payload$filter, _payload$value = payload.value, value = _payload$value === void 0 ? "" : _payload$value;
9748
+ _context.next = 6;
9749
+ return fetch(urls.fuzzy_search, _objectSpread2(_objectSpread2({}, __options$9), {}, {
9750
+ body: btoa(JSON.stringify({
9751
+ "db_name": db_name,
9752
+ "entity": entity,
9753
+ "filter": filter,
9754
+ "value": value
9755
+ }))
9756
+ }));
9712
9757
 
9758
+ case 6:
9759
+ _ = _context.sent;
9760
+ _context.next = 9;
9761
+ return _.json();
9713
9762
 
9714
- var getAge = function getAge(date) {
9715
- if (date) {
9716
- var yearDiff = moment().diff(moment(date, 'DD/MM/YYYY'), 'years', false);
9763
+ case 9:
9764
+ _ = _context.sent;
9765
+ return _context.abrupt("return", _objectSpread2(_objectSpread2({}, defaultState.Info), {}, {
9766
+ data: _
9767
+ }));
9717
9768
 
9718
- if (yearDiff > 0) {
9719
- return yearDiff + ' Y';
9769
+ case 13:
9770
+ _context.prev = 13;
9771
+ _context.t0 = _context["catch"](2);
9772
+ return _context.abrupt("return", rejectWithValue(_objectSpread2(_objectSpread2({}, defaultReject), {}, {
9773
+ message: _context.t0.message
9774
+ })));
9775
+
9776
+ case 16:
9777
+ case "end":
9778
+ return _context.stop();
9779
+ }
9720
9780
  }
9781
+ }, _callee, null, [[2, 13]]);
9782
+ }))); // end
9783
+ // FUZZY SEARCH CREATE INITIALSTATE
9721
9784
 
9722
- var monthDiff = moment().diff(moment(date, 'DD/MM/YYYY'), 'months', false);
9785
+ var fuzzySearchReducer = createSlice({
9786
+ name: "fuzzySearchReducer",
9787
+ initialState: {
9788
+ fuzzySearch: _objectSpread2({}, defaultState.Info)
9789
+ },
9790
+ extraReducers: (_extraReducers$E = {}, _defineProperty(_extraReducers$E, FUZZY_SEARCH.fulfilled, function (state, action) {
9791
+ var _action$payload;
9723
9792
 
9724
- if (monthDiff > 0) {
9725
- return monthDiff + ' M';
9726
- }
9793
+ state.fuzzySearch = (_action$payload = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload !== void 0 ? _action$payload : {};
9794
+ }), _defineProperty(_extraReducers$E, FUZZY_SEARCH.pending, function (state, action) {
9795
+ state.fuzzySearch.loading = true;
9796
+ }), _defineProperty(_extraReducers$E, FUZZY_SEARCH.rejected, function (state, action) {
9797
+ var _action$payload2;
9727
9798
 
9728
- var dayDiff = moment().diff(moment(date, 'DD/MM/YYYY'), 'days', false);
9729
- return dayDiff + ' D';
9730
- }
9799
+ state.fuzzySearch = (_action$payload2 = action === null || action === void 0 ? void 0 : action.payload) !== null && _action$payload2 !== void 0 ? _action$payload2 : {};
9800
+ }), _extraReducers$E)
9801
+ }); // end
9802
+ // FUZZY SEARCH CREATE ACTION LISTS
9731
9803
 
9732
- return "";
9733
- };
9804
+ var fuzzySearchActions = {
9805
+ FUZZY_SEARCH: FUZZY_SEARCH
9806
+ }; // end
9807
+ var fuzzySearchReducer$1 = fuzzySearchReducer.reducer;
9734
9808
 
9735
9809
  var _extraReducers$D;
9736
9810
  var __options$8 = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primarycare-binder",
3
- "version": "1.1.41",
3
+ "version": "1.1.42",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",